<commit_before>import { Subject } from 'most-subject'
import { ScopeChecker } from './ScopeChecker'
import { IsolateModule } from './modules/isolate'
import { getScope, getSelectors } from './util'

interface MatchesSelector {
  (element: Element, selector: string): boolean
}
let matchesSelector: MatchesSelector
declare var require: any
try {
  matchesSelector = require(`matches-selector`)
} catch (e) {
  matchesSelector = <MatchesSelector> Function.prototype
}

let gDestinationId: number = 0

interface Destination {
  subject: Subject<Event>
  scopeChecker: ScopeChecker
  selector: string
  destinationId: number
}

export interface MotorcycleDOMEvent extends Event {
  propagationHasBeenStopped?: boolean
  ownerTarget?: HTMLElement
}

function findDestinationId (arr: Array<Destination>, searchId: number): number {

    let minIndex = 0
    let maxIndex = arr.length - 1
    let currentIndex: number
    let currentElement: Destination

    while (minIndex <= maxIndex) {
        currentIndex = (minIndex + maxIndex) / 2 | 0
        currentElement = arr[currentIndex]
        let currentId: number = currentElement.destinationId
        if (currentId < searchId) {
            minIndex = currentIndex + 1
        } else if (currentId > searchId) {
            maxIndex = currentIndex - 1<commit_msg>fix(EventDelegator): update to use local matchesSelector<commit_after>import { Subject } from 'most-subject'
import { ScopeChecker } from './ScopeChecker'
import { IsolateModule } from './modules/isolate'
import { getScope, getSelectors, matchesSelector } from './util'

let gDestinationId: number = 0

interface Destination {
  subject: Subject<Event>
  scopeChecker: ScopeChecker
  selector: string
  destinationId: number
}

export interface MotorcycleDOMEvent extends Event {
  propagationHasBeenStopped?: boolean
  ownerTarget?: HTMLElement
}

function findDestinationId (arr: Array<Destination>, searchId: number): number {

    let minIndex = 0
    let maxIndex = arr.length - 1
    let currentIndex: number
    let currentElement: Destination

    while (minIndex <= maxIndex) {
        currentIndex = (minIndex + maxIndex) / 2 | 0
        currentElement = arr[currentIndex]
        let currentId: number = currentElement.destinationId
        if (currentId < searchId) {
            minIndex = currentIndex + 1
        } else if (currentId > searchId) {
            maxIndex = currentIndex - 1
{'fraction_non_alphanumeric': 0.08623548922056384, 'fraction_numerical': 0.005804311774461028, 'mean_word_length': 3.6763565891472867, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 10, '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': '3180186', 'n_tokens_mistral': 666, 'n_tokens_neox': 660, 'n_words': 201}