<commit_before># Maskew
# Skew the shapes of DOM elements
# <NAME>
# http://oxism.com
# 0.1.0
# MIT License


{cos, sin, PI, abs, round} = Math

rad = (deg) -> deg * PI / 180

getMetric = (style, key) -> parseInt style[key], 10

transform = (y, angle) -> "translate3d(0, #{ y }px, 0) rotate3d(0, 0, 1, #{ angle }deg)"

testProp = (prop) ->
  return prop if testEl.style[prop]?

  capProp = prop.charAt(0).toUpperCase() + prop.slice 1
  for prefix in prefixList
    if testEl.style[prefix + capProp]?
      return prefix + capProp
  false

hasSupport = true
testEl = document.createElement 'div'
prefixList = ['Webkit', 'Moz', 'O', 'ms', 'Khtml']
css =
  transform: 'transform'
  origin: 'transformOrigin'
  transformStyle: 'transformStyle'

for key, value of css
  css[key] = testProp value
  unless css[key]
    hasSupport = false
    break


class window.Maskew

  constructor: (@el, @angle, @options = {}) ->
    return @el unless hasSupport
    return new Maskew @el, @angle unless @ instanceof Maskew

    @options.interactive or= false
    @options.anchor or= 'top'
    @options.showElement or= false

    contents = @el.cloneNode true
    elStyle = window.getComputedStyle @el
    xMetrics = ['width', 'paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth']
    yMetrics = ['height', 'paddingTop', 'paddingBottom', 'borderTopWidth', 'borderBottomWidth']
    @width = 0
    @width += getMetric elStyle, key for key in xMetrics
    @height = 0
    @height += getMetric elStyle, key for key in yMetrics

    @outerMask = document.createElement 'div'
    @outerMask.style.padding = '0'
    @outerMask.style.width = @width + 'px'
    @outerMask.style.height = @height + 'px'
    @outerMask.style.overflow = 'hidden'

    if @options.showElement
      @el.style.display = 'block'
      @outerMask.style.display = @options.showElement
    else
      @outerMask.style.display = elStyle.display

    @innerMask = @outerMask.cloneNode false
    @innerMask.style[css.origin] = 'bottom left'

    @holder = @outerMask.cloneNode false
    @holder.style[css.origin] = 'inherit'

    for side in ['Top', 'Right', 'Bottom', 'Left'] then do (key = 'margin' + side) =>
      @outerMask.style[key] = elStyle[key]

    @el.style.margin = '0'

    @el.parentNode.insertBefore @outerMask, @el
    @holder.appendChild @el
    @innerMask.appendChild @holder
    @outerMask.appendChild @innerMask

    if @options.interactive
      @outerMask.style.cursor = 'ew-resize'
      eventPairs = [['TouchStart', 'MouseDown'], ['TouchMove', 'MouseMove'], ['TouchEnd', 'MouseUp']]
      for eventPair in eventPairs
        for eString in eventPair then do (fn = '_on' + eventPair[0]) =>
          @outerMask.addEventListener eString.toLowerCase(), @[fn], false

    @skew @angle


  skew: (angle) =>
    angle ?= @_dragAngle or 0
    angle = 0 if angle < 0
    sine = sin rad angle
    cosine = cos rad angle
    tlX = @height * sine
    tlY = @height * cosine
    adj = @width - tlX
    hyp = adj / cosine
    opp = sine * hyp
    yOffset = round @height - tlY + opp

    @outerMask.style.height = round(tlY - opp) + 'px'
    @innerMask.style.width = round(hyp) + 'px'
    @innerMask.style[css.transform] = transform -yOffset, angle
    @holder.style[css.transform] = transform 0, -angle

    @el.style[css.transform] = transform yOffset, 0 if @options.anchor is 'bottom'


  _onTouchStart: (e) =>
    e.preventDefault()
    if e.type is 'mousedown'
      @_x1 = e.pageX
    else if e.type is 'touchstart'
      @_x1 = e.touches[0].pageX

    @_xDelta = 0


  _onTouchMove: (e) =>
    e.preventDefault()
    if e.type is 'mousemove'
      return if e.which isnt 1<commit_msg>added destroy method<commit_after># Maskew
# Skew the shapes of DOM elements
# <NAME>
# http://oxism.com
# 0.1.0
# MIT License


{cos, sin, PI, abs, round} = Math

rad = (deg) -> deg * PI / 180

getMetric = (style, key) -> parseInt style[key], 10

transform = (y, angle) -> "translate3d(0, #{ y }px, 0) rotate3d(0, 0, 1, #{ angle }deg)"

testProp = (prop) ->
  return prop if testEl.style[prop]?

  capProp = prop.charAt(0).toUpperCase() + prop.slice 1
  for prefix in prefixList
    if testEl.style[prefix + capProp]?
      return prefix + capProp
  false

hasSupport = true
testEl = document.createElement 'div'
prefixList = ['Webkit', 'Moz', 'O', 'ms', 'Khtml']
css =
  transform: 'transform'
  origin: 'transformOrigin'
  transformStyle: 'transformStyle'

for key, value of css
  css[key] = testProp value
  unless css[key]
    hasSupport = false
    break


class window.Maskew

  constructor: (@el, @angle, @options = {}) ->
    return @el unless hasSupport
    return new Maskew @el, @angle unless @ instanceof Maskew

    @options.interactive or= false
    @options.anchor or= 'top'
    @options.showElement or= false

    contents = @el.cloneNode true
    elStyle = window.getComputedStyle @el
    xMetrics = ['width', 'paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth']
    yMetrics = ['height', 'paddingTop', 'paddingBottom', 'borderTopWidth', 'borderBottomWidth']
    @width = 0
    @width += getMetric elStyle, key for key in xMetrics
    @height = 0
    @height += getMetric elStyle, key for key in yMetrics

    @outerMask = document.createElement 'div'
    @outerMask.style.padding = '0'
    @outerMask.style.width = @width + 'px'
    @outerMask.style.height = @height + 'px'
    @outerMask.style.overflow = 'hidden'

    if @options.showElement
      @el.style.display = 'block'
      @outerMask.style.display = @options.showElement
    else
      @outerMask.style.display = elStyle.display

    @innerMask = @outerMask.cloneNode false
    @innerMask.style[css.origin] = 'bottom left'

    @holder = @outerMask.cloneNode false
    @holder.style[css.origin] = 'inherit'

    for side in ['Top', 'Right', 'Bottom', 'Left'] then do (key = 'margin' + side) =>
      @outerMask.style[key] = elStyle[key]

    @el.style.margin = '0'

    @el.parentNode.insertBefore @outerMask, @el
    @holder.appendChild @el
    @innerMask.appendChild @holder
    @outerMask.appendChild @innerMask

    if @options.interactive
      @outerMask.style.cursor = 'ew-resize'
      eventPairs = [['TouchStart', 'MouseDown'], ['TouchMove', 'MouseMove'], ['TouchEnd', 'MouseUp']]
      for eventPair in eventPairs
        for eString in eventPair then do (fn = '_on' + eventPair[0]) =>
          @outerMask.addEventListener eString.toLowerCase(), @[fn], false

    @skew @angle


  skew: (angle) =>
    angle ?= @_dragAngle or 0
    angle = 0 if angle < 0
    sine = sin rad angle
    cosine = cos rad angle
    tlX = @height * sine
    tlY = @height * cosine
    adj = @width - tlX
    hyp = adj / cosine
    opp = sine * hyp
    yOffset = round @height - tlY + opp

    @outerMask.style.height = round(tlY - opp) + 'px'
    @innerMask.style.width = round(hyp) + 'px'
    @innerMask.style[css.transform] = transform -yOffset, angle
    @holder.style[css.transform] = transform 0, -angle

    @el.style[css.transform] = transform yOffset, 0 if @options.anchor is 'bottom'
  destroy: =>
    parent = @_outerMask.parentNode
    parent.insertBefore @_el, @_outerMask
    parent.removeChild @_outerMask
    $.data @_el, 'maskew', null if $
    @[k] = null for k of @
    null


  _onTouchStart: (e) =>
    e.preventDefault()
    if e.type is 'mousedown'
      @_x1 = e.pageX
    else if e.type is 'touchstart'
      @_x1 = e.touches[0].pageX

    @_xDelta = 0


  _onTouchMove: (e) =>
    e.preventDefault()
    if e.type is 'mousemove'
      return if e.which isnt 1
{'fraction_non_alphanumeric': 0.1365989645559538, 'fraction_numerical': 0.008495951148280898, 'mean_word_length': 3.1146914254505735, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 26, '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': '2793356', 'n_tokens_mistral': 2595, 'n_tokens_neox': 2505, 'n_words': 698}