<commit_before>(function () {
    'use strict';

    /**
     * @param {User} user
     * @param {app.utils} utils
     * @returns {Base}
     */
    const factory = function (user, utils) {

        class Base {

            /**
             * @constructor
             * @param {$rootScope.Scope} [$scope]
             */
            constructor($scope) {
                if ($scope) {
                    const stop = $scope.$on('$destroy', () => {
                        this.$onDestroy();
                        stop();
                    });
                }

                /**
                 * @type {IBaseSignals}
                 */
                this.signals = {
                    destroy: new tsUtils.Signal()
                };
                /**
                 * @type {string}
                 */
                this.cid = tsUtils.uniqueId('base');
                /**
                 * @type {object}
                 * @private
                 */
                this.__props = Object.create(null);
            }

            /**
             * @param {string[]|string} keys
             * @param callback
             * @param {Object} [options]
             * @param {Function} [options.set]
             */
            observe(keys, callback, options) {
                this.receive(utils.observe(this, keys, options), callback, this);
            }

            /**
             * @param {string[]|string} keys
             * @param callback
             * @param {Object} [options]
             * @param {Function} [options.set]
             */
            observeOnce(keys, callback, options) {
                this.receiveOnce(utils.observe(this, keys, options), callback, this);
            }

            stopObserve(keys, handler) {
                this.stopReceive(utils.observe(this, keys), handler);
            }

            /**
             * @param {string|Array<string>} syncList
             * @returns {Promise}
             */
            syncSettings(syncList) {
                syncList = Array.isArray(syncList) ? syncList : [syncList];
                return utils.whenAll(syncList.map((settingsPath) => {
                    const words = settingsPath.split(/\W/);
                    const name = words[words.length - 1];

                    this.observe(name, () => {
                        user.setSetting(settingsPath, this[name]);
                    });

                    return user.getSetting(settingsPath)
                        .then((value) => {
                            this[name] = value;
                        });
                }));
            }

            $onDestroy() {
                this.signals.destroy.dispatch();
                this.__isRemoved = true;
                this.__handlers = Object.create(null);

                tsUtils.each(this.polls, (poll, key) => {
                    if (poll) {
                        poll.destroy();
                        delete this.polls[key];
                    }
                });
                this.stopReceive();
            }

        }

        /**
         * @access protected
         * @type {*|<T, R>(signal: Signal<T>, handler: Signal.IHandler<T, R>, context?: R) => void}
         */
        Base.prototype.receive = tsUtils.Receiver.prototype.receive;
        /**
         * @access protected
         * @type {*|<T, R>(signal: Signal<T>, handler: Signal.IHandler<T, R>, context?: R) => void}
         */
        Base.prototype.receiveOnce = tsUtils.Receiver.prototype.receiveOnce;
        /**
         * @access protected
         * @type {*|((item?: TStopArg1, handler?: Signal.IHandler<any, any>) => void)}
         */
        Base.prototype.stopReceive = tsUtils.Receiver.prototype.stopReceive;

        return Base;
    };

    factory.$inject = ['user', 'utils'];

    angular.module('app.utils')
        .factory('Base', factory);
})();

/**
 * @typedef {Object} IBaseSignals
 * @property {Signal} destroy
 */
<commit_msg>CLIENT-94: remove private props from Base<commit_after>(function () {
    'use strict';

    /**
     * @param {User} user
     * @param {app.utils} utils
     * @returns {Base}
     */
    const factory = function (user, utils) {

        class Base {

            /**
             * @constructor
             * @param {$rootScope.Scope} [$scope]
             */
            constructor($scope) {
                if ($scope) {
                    const stop = $scope.$on('$destroy', () => {
                        this.$onDestroy();
                        stop();
                    });
                }

                /**
                 * @type {IBaseSignals}
                 */
                this.signals = {
                    destroy: new tsUtils.Signal()
                };
                /**
                 * @type {string}
                 */
                this.cid = tsUtils.uniqueId('base');
            }

            /**
             * @param {string[]|string} keys
             * @param callback
             * @param {Object} [options]
             * @param {Function} [options.set]
             */
            observe(keys, callback, options) {
                this.receive(utils.observe(this, keys, options), callback, this);
            }

            /**
             * @param {string[]|string} keys
             * @param callback
             * @param {Object} [options]
             * @param {Function} [options.set]
             */
            observeOnce(keys, callback, options) {
                this.receiveOnce(utils.observe(this, keys, options), callback, this);
            }

            stopObserve(keys, handler) {
                this.stopReceive(utils.observe(this, keys), handler);
            }

            /**
             * @param {string|Array<string>} syncList
             * @returns {Promise}
             */
            syncSettings(syncList) {
                syncList = Array.isArray(syncList) ? syncList : [syncList];
                return utils.whenAll(syncList.map((settingsPath) => {
                    const words = settingsPath.split(/\W/);
                    const name = words[words.length - 1];

                    this.observe(name, () => {
                        user.setSetting(settingsPath, this[name]);
                    });

                    return user.getSetting(settingsPath)
                        .then((value) => {
                            this[name] = value;
                        });
                }));
            }

            $onDestroy() {
                this.signals.destroy.dispatch();
                this.__isRemoved = true;
                this.__handlers = Object.create(null);

                tsUtils.each(this.polls, (poll, key) => {
                    if (poll) {
                        poll.destroy();
                        delete this.polls[key];
                    }
                });
                this.stopReceive();
            }

        }

        /**
         * @access protected
         * @type {*|<T, R>(signal: Signal<T>, handler: Signal.IHandler<T, R>, context?: R) => void}
         */
        Base.prototype.receive = tsUtils.Receiver.prototype.receive;
        /**
         * @access protected
         * @type {*|<T, R>(signal: Signal<T>, handler: Signal.IHandler<T, R>, context?: R) => void}
         */
        Base.prototype.receiveOnce = tsUtils.Receiver.prototype.receiveOnce;
        /**
         * @access protected
         * @type {*|((item?: TStopArg1, handler?: Signal.IHandler<any, any>) => void)}
         */
        Base.prototype.stopReceive = tsUtils.Receiver.prototype.stopReceive;

        return Base;
    };

    factory.$inject = ['user', 'utils'];

    angular.module('app.utils')
        .factory('Base', factory);
})();

/**
 * @typedef {Object} IBaseSignals
 * @property {Signal} destroy
 */

{'fraction_non_alphanumeric': 0.13512480896586856, 'fraction_numerical': 0.0007641365257259297, 'mean_word_length': 1.1609796367638965, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 35, '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': '2220198', 'n_tokens_mistral': 2075, 'n_tokens_neox': 1940, 'n_words': 366}