<commit_before>namespace Vidyano.WebComponents {
    "use strict";

    @WebComponent.register({
        properties: {
            menuTitle: String,
            activeProgramUnit: Object,
            programUnits: Array,
            collapsed: {
                type: Boolean,
                reflectToAttribute: true
            },
            collapsedWithGlobalSearch: {
                type: Boolean,
                computed: "_computeCollapsedWithGlobalSearch(collapsed, hasGlobalSearch)"
            },
            hasGlobalSearch: {
                type: Boolean,
                computed: "_computeHasGlobalSearch(app)"
            },
            filter: {
                type: String,
                observer: "_filterChanged"
            },
            filtering: {
                type: Boolean,
                reflectToAttribute: true
            },
            currentProgramUnit: Object,
            isResizing: {
                type: Boolean,
                reflectToAttribute: true,
                readOnly: true
            }
        },
        listeners: {
            "reset-filter": "_resetFilter"
        }
    })
    export class Menu extends WebComponent {
        private static _minResizeWidth: number;
        private _resizeWidth: number;
        filter: string;
        filtering: boolean;
        activeProgramUnit: ProgramUnit;
        collapsed: boolean;
        hasGlobalSearch: boolean;

        private _setIsResizing: (val: boolean) => void;

        attached() {
            super.attached();

            Enumerable.from(Polymer.dom(this.app).querySelectorAll("[vi-menu-element~='footer']")).forEach(element => Polymer.dom(this.$["footerElements"]).appendChild(element));
            Enumerable.from(Polymer.dom(this.app).querySelectorAll("[vi-menu-element~='header']")).forEach(element => Polymer.dom(this.$["headerElements"]).appendChild(element));

            // Fix for FireFox line-height calc bug (https://bugzilla.mozilla.org/show_bug.cgi?id=594933)
            this.customStyle["--vi-menu-expanded-header-height"] = (parseInt(this.getComputedStyleValue("--theme-h1")) * 2) + "px";

            if (!Menu._minResizeWidth)
                Menu._minResizeWidth = this.offsetWidth;

            const menuWidth = parseInt(Vidyano.cookie("menu-width"));
            if (menuWidth)
                this.customStyle["--vi-menu--expand-width"] = `${menuWidth}px`;

            this.updateStyles();

            this.collapsed = BooleanEx.parse(Vidyano.cookie("menu-collapsed"));
        }

        detached() {
            super.detached();

            Enumerable.from(Polymer.dom(this.$["footerElements"]).children).forEach(element => Polymer.dom(this.app).appendChild(element));
            Enumerable.from(Polymer.dom(this.$["headerElements"]).children).forEach(element => Polymer.dom(this.app).appendChild(element));
        }

        private _filterChanged() {
            this.filtering = !StringEx.isNullOrEmpty(this.filter);
        }

        private _search() {
            if (this.collapsed && this.filter)
                Popup.closeAll();

            if (!this.filtering || !this.hasGlobalSearch)
                return;

            this.app.changePath(this.app.getUrlForPersistentObject(this.app.service.application.globalSearchId, this.filter));
            this.filter = "";
        }

        private _computeHasGlobalSearch(isAttached: boolean): boolean {
            if (!isAttached)
                return false;

            return this.app.service.application.globalSearchId !== "00000000-0000-0000-0000-000000000000";
        }

        private _computeCollapsedWithGlobalSearch(collapsed: boolean, hasGlobalSearch: boolean): boolean {
            return collapsed && hasGlobalSearch;
        }

        private _toggleCollapse() {
            this.collapsed = !this.collapsed;
            Vidyano.cookie("menu-collapsed", String(this.collapsed));
        }

        private _hasGroupItems(programUnitItems: ProgramUnitItemGroup[]): boolean {
            return !!programUnitItems && programUnitItems.some(item => item instanceof ProgramUnitItemGroup);
        }

        private _countItems(programUnitItems: any[]): number {
            return !!programUnitItems ? programUnitItems.length : 0;
        }

        private _focusSearch() {
            const inputSearch = <InputSearch>Polymer.dom(this.root).querySelector("#collapsedInputSearch");
            inputSearch.focus();
        }

        private _catchInputSearchTap(e: TapEvent) {
            e.stopPropagation();
        }

        private _resetFilter(e: CustomEvent) {
            this.filter = "";
        }<commit_msg>Use correct observer variable<commit_after>namespace Vidyano.WebComponents {
    "use strict";

    @WebComponent.register({
        properties: {
            menuTitle: String,
            activeProgramUnit: Object,
            programUnits: Array,
            collapsed: {
                type: Boolean,
                reflectToAttribute: true
            },
            collapsedWithGlobalSearch: {
                type: Boolean,
                computed: "_computeCollapsedWithGlobalSearch(collapsed, hasGlobalSearch)"
            },
            hasGlobalSearch: {
                type: Boolean,
                computed: "_computeHasGlobalSearch(app.service.application.globalSearchId)"
            },
            filter: {
                type: String,
                observer: "_filterChanged"
            },
            filtering: {
                type: Boolean,
                reflectToAttribute: true
            },
            currentProgramUnit: Object,
            isResizing: {
                type: Boolean,
                reflectToAttribute: true,
                readOnly: true
            }
        },
        listeners: {
            "reset-filter": "_resetFilter"
        }
    })
    export class Menu extends WebComponent {
        private static _minResizeWidth: number;
        private _resizeWidth: number;
        filter: string;
        filtering: boolean;
        activeProgramUnit: ProgramUnit;
        collapsed: boolean;
        hasGlobalSearch: boolean;

        private _setIsResizing: (val: boolean) => void;

        attached() {
            super.attached();

            Enumerable.from(Polymer.dom(this.app).querySelectorAll("[vi-menu-element~='footer']")).forEach(element => Polymer.dom(this.$["footerElements"]).appendChild(element));
            Enumerable.from(Polymer.dom(this.app).querySelectorAll("[vi-menu-element~='header']")).forEach(element => Polymer.dom(this.$["headerElements"]).appendChild(element));

            // Fix for FireFox line-height calc bug (https://bugzilla.mozilla.org/show_bug.cgi?id=594933)
            this.customStyle["--vi-menu-expanded-header-height"] = (parseInt(this.getComputedStyleValue("--theme-h1")) * 2) + "px";

            if (!Menu._minResizeWidth)
                Menu._minResizeWidth = this.offsetWidth;

            const menuWidth = parseInt(Vidyano.cookie("menu-width"));
            if (menuWidth)
                this.customStyle["--vi-menu--expand-width"] = `${menuWidth}px`;

            this.updateStyles();

            this.collapsed = BooleanEx.parse(Vidyano.cookie("menu-collapsed"));
        }

        detached() {
            super.detached();

            Enumerable.from(Polymer.dom(this.$["footerElements"]).children).forEach(element => Polymer.dom(this.app).appendChild(element));
            Enumerable.from(Polymer.dom(this.$["headerElements"]).children).forEach(element => Polymer.dom(this.app).appendChild(element));
        }

        private _filterChanged() {
            this.filtering = !StringEx.isNullOrEmpty(this.filter);
        }

        private _search() {
            if (this.collapsed && this.filter)
                Popup.closeAll();

            if (!this.filtering || !this.hasGlobalSearch)
                return;

            this.app.changePath(this.app.getUrlForPersistentObject(this.app.service.application.globalSearchId, this.filter));
            this.filter = "";
        }

        private _computeHasGlobalSearch(globalSearchId: string): boolean {
            return globalSearchId !== "00000000-0000-0000-0000-000000000000";
        }

        private _computeCollapsedWithGlobalSearch(collapsed: boolean, hasGlobalSearch: boolean): boolean {
            return collapsed && hasGlobalSearch;
        }

        private _toggleCollapse() {
            this.collapsed = !this.collapsed;
            Vidyano.cookie("menu-collapsed", String(this.collapsed));
        }

        private _hasGroupItems(programUnitItems: ProgramUnitItemGroup[]): boolean {
            return !!programUnitItems && programUnitItems.some(item => item instanceof ProgramUnitItemGroup);
        }

        private _countItems(programUnitItems: any[]): number {
            return !!programUnitItems ? programUnitItems.length : 0;
        }

        private _focusSearch() {
            const inputSearch = <InputSearch>Polymer.dom(this.root).querySelector("#collapsedInputSearch");
            inputSearch.focus();
        }

        private _catchInputSearchTap(e: TapEvent) {
            e.stopPropagation();
        }

        private _resetFilter(e: CustomEvent) {
            this.filter = "";
        }
{'fraction_non_alphanumeric': 0.1147011308562197, 'fraction_numerical': 0.008831448572967152, 'mean_word_length': 2.036625245258339, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, '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': '6515493', 'n_tokens_mistral': 2471, 'n_tokens_neox': 2329, 'n_words': 377}