<commit_before>import { Document, Touch, TouchEvent, UIEvent, window } from '@ephox/dom-globals';
import { Element, Location } from '@ephox/sugar';

const point = (type: string, element: Element<any>, x: number, y: number): void => {
  const touch = {
    identifier: Date.now(),
    target: element.dom(),
    clientX: x,
    clientY: y,
    pageX: x,
    pageY: y,
    radiusX: 2.5,
    radiusY: 2.5,
    rotationAngle: 10,
    force: 0.5,
  };

  // Adapted from https://stackoverflow.com/a/42447620/11275515
  if (typeof TouchEvent === 'function' && typeof Touch === 'function') {
    // @ts-ignore
    const touchAction = new Touch(touch);
    const ev: TouchEvent = new TouchEvent(type, {
      cancelable: true,
      bubbles: true,
      view: window,
      touches: [touchAction],
      targetTouches: [],
      changedTouches: [touchAction]
    });
    element.dom().dispatchEvent(ev);
  } else {
    // No native touch event support, so we need to simulate with a UIEvent
    let ev: any;
    if (typeof UIEvent === 'function') {
      ev = new UIEvent(type, {
        cancelable: true,
        bubbles: true,
        view: window
      } as any);
    } else {
      // IE 11 doesn't support the UIEvent constructor, so we need to fallback to using createEvent
      ev = (<Document> element.dom().ownerDocument).createEvent('UIEvent');
      ev.initUIEvent(type, true, true, window, null);
    }
    // Patch in the touch properties
    ev.touches = [touch];
    ev.targetTouches = [];
    ev.changedTouches = [touch];
    element.dom().dispatchEvent(ev);
  }
};
<commit_msg>Formatting.<commit_after>import { Document, Touch, TouchEvent, UIEvent, window } from '@ephox/dom-globals';
import { Element, Location } from '@ephox/sugar';

const point = (type: string, element: Element<any>, x: number, y: number): void => {
  const touch = {
    identifier: Date.now(),
    target: element.dom(),
    clientX: x,
    clientY: y,
    pageX: x,
    pageY: y,
    radiusX: 2.5,
    radiusY: 2.5,
    rotationAngle: 10,
    force: 0.5,
  };

  // Adapted from https://stackoverflow.com/a/42447620/11275515
  if (typeof TouchEvent === 'function' && typeof Touch === 'function') {
    // @ts-ignore
    const touchAction = new Touch(touch);
    const ev: TouchEvent = new TouchEvent(type, {
      cancelable: true,
      bubbles: true,
      view: window,
      touches: [ touchAction ],
      targetTouches: [],
      changedTouches: [ touchAction ]
    });
    element.dom().dispatchEvent(ev);
  } else {
    // No native touch event support, so we need to simulate with a UIEvent
    let ev: any;
    if (typeof UIEvent === 'function') {
      ev = new UIEvent(type, {
        cancelable: true,
        bubbles: true,
        view: window
      } as any);
    } else {
      // IE 11 doesn't support the UIEvent constructor, so we need to fallback to using createEvent
      ev = (<Document> element.dom().ownerDocument).createEvent('UIEvent');
      ev.initUIEvent(type, true, true, window, null);
    }
    // Patch in the touch properties
    ev.touches = [ touch ];
    ev.targetTouches = [];
    ev.changedTouches = [ touch ];
    element.dom().dispatchEvent(ev);
  }
};

{'fraction_non_alphanumeric': 0.13867924528301886, 'fraction_numerical': 0.016352201257861635, 'mean_word_length': 2.6902552204176335, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 2, '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': '6738386', 'n_tokens_mistral': 1048, 'n_tokens_neox': 1013, 'n_words': 290}