System.register([], function (_export, _context) {
    "use strict";

    function pushIfMissing(array, item) {
        // check for already existing.
        var exists = false;
        var len = array.length;
        for (var i = 0; i < len; i++) if (array[i] == item) {
            exists = true;
            break;
        }

        // do not add an already existing item
        if (!exists) {
            array.push(item);
        }

        // return true if the given element was pushed, otherwise false
        return !exists;
    }

    _export('pushIfMissing', pushIfMissing);

    function removeIfExisting(array, item) {
        var index = array.indexOf(item);
        if (index !== -1) {
            array.splice(index, 1);
            // return true if the given element was actually removed
            return true;
        }
        return false;
    }

    _export('removeIfExisting', removeIfExisting);

    function isPrimitive(elem) {
        var getType = function (elem) {
            return Object.prototype.toString.call(elem).slice(8, -1);
        };

        var type = getType(elem);

        return type === 'String' || type === 'RegExp' || type === 'Boolean' || type === 'Number' || type === 'Null' || type === 'Undefined';
    }

    _export('isPrimitive', isPrimitive);

    function identity(x) {
        return x;
    }

    _export('identity', identity);

    return {
        setters: [],
        execute: function () {
            _recorder_._src_client_reactive_active_group_utils_js = _recorder_._src_client_reactive_active_group_utils_js || {};
            _recorder_._src_client_reactive_active_group_utils_js.identity = identity;
            _recorder_._src_client_reactive_active_group_utils_js.isPrimitive = isPrimitive;
            _recorder_._src_client_reactive_active_group_utils_js.removeIfExisting = removeIfExisting;
            _recorder_._src_client_reactive_active_group_utils_js.pushIfMissing = pushIfMissing;
            class Stack {
                constructor() {
                    this.arr = [];
                }

                push(el) {
                    this.arr.push(el);
                }

                pop() {
                    this.arr.length--;
                }

                top() {
                    return this.arr.last();
                }
            }

            _export('Stack', Stack);

            _recorder_._src_client_reactive_active_group_utils_js.Stack = Stack;
        }
    };
});