<commit_before>namespace Scene {

    let ScaleFactor = 1

    const Sprites = document.createElement("img")
    Sprites.style.touchAction = "manipulation" // Improves responsiveness on IE/Edge on touchscreens.
    Sprites.style.webkitBackfaceVisibility = "hidden" // Prevents a "pop" on Chrome when all transitions have finished.
    Sprites.style.position = "absolute"
    Sprites.style.pointerEvents = "all"

    type CachedSprite = [HTMLDivElement, HTMLImageElement]
    const CachedSprites: CachedSprite[] = []
    const CachedGroups: HTMLDivElement[] = []

    function CreateSprite(): CachedSprite {
        const container = CreateGroup()
        const image = Sprites.cloneNode(true) as HTMLImageElement
        container.appendChild(image)
        return [container, image]
    }

    function CacheSprite(sprite: CachedSprite) {
        const parent = sprite[0].parentElement
        if (parent) parent.removeChild(sprite[0])
        CachedSprites.push(sprite)
    }

    function UncacheSprite(): CachedSprite {
        const output = CachedSprites.pop() || CreateSprite()
        if ("transform" in output[0].style) {
            output[0].style.transform = "initial"
        } else {
            output[0].style.left = "0px"
            output[0].style.top = "0px"
        }
        return output
    }

    function CreateGroup() {
        const element = document.createElement("div")
        element.style.position = "absolute"
        element.style.pointerEvents = "none"
        return element
    }

    function CacheGroup(group: HTMLDivElement) {
        CachedGroups.push(group)
    }

    function UncacheGroup(): HTMLDivElement {
        const output = CachedGroups.pop() || CreateGroup()
        if ("transform" in output.style) {
            output.style.transform = "initial"
        } else {
            output.style.top = "0px"
            output.style.left = "0px"
        }
        return output
    }

    // Called by the engine to load the sprite sheet and perform any "massaging" required to get them to draw as pixelated sprites.
    // You should not need to call this yourself.
    export function LoadSprites(then: () => void) {
        SetLoadingMessage("Loading sprites...")
        let loaded = false
        Sprites.onload = () => {
            // Resizing the image can re-trigger the loaded event.
            if (loaded) return
            loaded = true
            SetLoadingMessage("Processing sprites...")
            if ("imageRendering" in Sprites.style) {<commit_msg>Fixed transforms not resetting when elements are cached then uncached on IE10/11.<commit_after>namespace Scene {

    let ScaleFactor = 1

    const Sprites = document.createElement("img")
    Sprites.style.touchAction = "manipulation" // Improves responsiveness on IE/Edge on touchscreens.
    Sprites.style.webkitBackfaceVisibility = "hidden" // Prevents a "pop" on Chrome when all transitions have finished.
    Sprites.style.position = "absolute"
    Sprites.style.pointerEvents = "all"

    type CachedSprite = [HTMLDivElement, HTMLImageElement]
    const CachedSprites: CachedSprite[] = []
    const CachedGroups: HTMLDivElement[] = []

    function CreateSprite(): CachedSprite {
        const container = CreateGroup()
        const image = Sprites.cloneNode(true) as HTMLImageElement
        container.appendChild(image)
        return [container, image]
    }

    function CacheSprite(sprite: CachedSprite) {
        const parent = sprite[0].parentElement
        if (parent) parent.removeChild(sprite[0])
        CachedSprites.push(sprite)
    }

    function UncacheSprite(): CachedSprite {
        const output = CachedSprites.pop() || CreateSprite()
        if ("transform" in output[0].style) {
            output[0].style.transform = "translate(0px, 0px)"
        } else {
            output[0].style.left = "0px"
            output[0].style.top = "0px"
        }
        return output
    }

    function CreateGroup() {
        const element = document.createElement("div")
        element.style.position = "absolute"
        element.style.pointerEvents = "none"
        return element
    }

    function CacheGroup(group: HTMLDivElement) {
        CachedGroups.push(group)
    }

    function UncacheGroup(): HTMLDivElement {
        const output = CachedGroups.pop() || CreateGroup()
        if ("transform" in output.style) {
            output.style.transform = "translate(0px, 0px)"
        } else {
            output.style.top = "0px"
            output.style.left = "0px"
        }
        return output
    }

    // Called by the engine to load the sprite sheet and perform any "massaging" required to get them to draw as pixelated sprites.
    // You should not need to call this yourself.
    export function LoadSprites(then: () => void) {
        SetLoadingMessage("Loading sprites...")
        let loaded = false
        Sprites.onload = () => {
            // Resizing the image can re-trigger the loaded event.
            if (loaded) return
            loaded = true
            SetLoadingMessage("Processing sprites...")
            if ("imageRendering" in Sprites.style) {
{'fraction_non_alphanumeric': 0.10054559625876851, 'fraction_numerical': 0.005845674201091193, 'mean_word_length': 2.422, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '7519775', 'n_tokens_mistral': 1412, 'n_tokens_neox': 1376, 'n_words': 375}