<commit_before>module plat {
    /**
     * We need to add [plat-hide] as a css property so we can use it to temporarily 
     * hide elements.
     */
    if (isDocument(document)) {
        var style = <HTMLStyleElement>document.createElement('style');

        style.textContent = '[plat-hide] { display: none; }';
        document.head.appendChild(style);
    }

    /**
     * Class for every app. This class contains hooks for Application Lifecycle Events 
     * as well as error handling.
     */
    export class App implements IApp {
        static $Compat: ICompat;
        static $EventManagerStatic: events.IEventManagerStatic;
        static $Document: Document;
        static $Compiler: processing.ICompiler;
        static $LifecycleEventStatic: events.ILifecycleEventStatic;

        /**
         * A static method for initiating the app startup.
         */
        static start(): void {
            if (!App.$Compat.isCompatible) {
                var $exception: IExceptionStatic = acquire(__ExceptionStatic);
                $exception.fatal('PlatypusTS only supports modern browsers where ' +
                    'Object.defineProperty is defined', $exception.COMPAT);
                return;
            }

            var $EventManagerStatic = App.$EventManagerStatic;

            $EventManagerStatic.dispose('__app__');
            $EventManagerStatic.on('__app__', 'ready', App.__ready);
            $EventManagerStatic.on('__app__', 'shutdown', App.__shutdown);
            $EventManagerStatic.initialize();
        }

        /**
         * A static methods called upon app registration. Primarily used 
         * to initiate a ready state in the case that amd is being used.
         */
        static registerApp(app: any): void {
            if (!isNull(App.app) && isString(App.app.uid)) {
                App.$EventManagerStatic.dispose(App.app.uid);
            }

            App.app = app;

            if (App.$Compat.amd) {
                var $LifecycleEventStatic = App.$LifecycleEventStatic,
                    dispatch = $LifecycleEventStatic.dispatch;

                postpone(() => {
                    dispatch('ready', $LifecycleEventStatic);
                });
            }
        }

        /**
         * Kicks off compilation of the DOM from the specified node. If no node is specified, 
         * the default start node is document.body.
         * 
         * @param node The node at which DOM compilation begins.
         */
        static load(node?: Node): void {
            var $LifecycleEventStatic = App.$LifecycleEventStatic,
                $compiler = App.$Compiler,
                body = App.$Document.body;

            $LifecycleEventStatic.dispatch('beforeLoad', App);

            if (isNull(node)) {
                body.setAttribute('plat-hide', '');
                $compiler.compile(body);
                body.removeAttribute('plat-hide');
                return;
            }

            if (isFunction((<Element>node).setAttribute)) {
                (<Element>node).setAttribute('plat-hide', '');
                $compiler.compile(node);
                (<Element>node).removeAttribute('plat-hide');
            } else {
                $compiler.compile(node);
            }
        }

        /**<commit_msg>Compiling the head tag.<commit_after>module plat {
    /**
     * We need to add [plat-hide] as a css property so we can use it to temporarily 
     * hide elements.
     */
    if (isDocument(document)) {
        var style = <HTMLStyleElement>document.createElement('style');

        style.textContent = '[plat-hide] { display: none; }';
        document.head.appendChild(style);
    }

    /**
     * Class for every app. This class contains hooks for Application Lifecycle Events 
     * as well as error handling.
     */
    export class App implements IApp {
        static $Compat: ICompat;
        static $EventManagerStatic: events.IEventManagerStatic;
        static $Document: Document;
        static $Compiler: processing.ICompiler;
        static $LifecycleEventStatic: events.ILifecycleEventStatic;

        /**
         * A static method for initiating the app startup.
         */
        static start(): void {
            if (!App.$Compat.isCompatible) {
                var $exception: IExceptionStatic = acquire(__ExceptionStatic);
                $exception.fatal('PlatypusTS only supports modern browsers where ' +
                    'Object.defineProperty is defined', $exception.COMPAT);
                return;
            }

            var $EventManagerStatic = App.$EventManagerStatic;

            $EventManagerStatic.dispose('__app__');
            $EventManagerStatic.on('__app__', 'ready', App.__ready);
            $EventManagerStatic.on('__app__', 'shutdown', App.__shutdown);
            $EventManagerStatic.initialize();
        }

        /**
         * A static methods called upon app registration. Primarily used 
         * to initiate a ready state in the case that amd is being used.
         */
        static registerApp(app: any): void {
            if (!isNull(App.app) && isString(App.app.uid)) {
                App.$EventManagerStatic.dispose(App.app.uid);
            }

            App.app = app;

            if (App.$Compat.amd) {
                var $LifecycleEventStatic = App.$LifecycleEventStatic,
                    dispatch = $LifecycleEventStatic.dispatch;

                postpone(() => {
                    dispatch('ready', $LifecycleEventStatic);
                });
            }
        }

        /**
         * Kicks off compilation of the DOM from the specified node. If no node is specified, 
         * the default start node is document.body.
         * 
         * @param node The node at which DOM compilation begins.
         */
        static load(node?: Node): void {
            var $LifecycleEventStatic = App.$LifecycleEventStatic,
                $compiler = App.$Compiler,
                body = App.$Document.body,
                head = App.$Document.head;

            $LifecycleEventStatic.dispatch('beforeLoad', App);

            if (isNull(node)) {
                $compiler.compile(head);
                body.setAttribute('plat-hide', '');
                $compiler.compile(body);
                body.removeAttribute('plat-hide');
                return;
            }

            if (isFunction((<Element>node).setAttribute)) {
                (<Element>node).setAttribute('plat-hide', '');
                $compiler.compile(node);
                (<Element>node).removeAttribute('plat-hide');
            } else {
                $compiler.compile(node);
            }
        }

        /**
{'fraction_non_alphanumeric': 0.10744172145845786, 'fraction_numerical': 0.0, 'mean_word_length': 1.7363041700735895, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '6790298', 'n_tokens_mistral': 1714, 'n_tokens_neox': 1625, 'n_words': 414}