exports.id = 8759;
exports.ids = [8759];
exports.modules = {

/***/ 855588:
/***/ ((__unused_webpack_module, exports) => {

"use strict";

/*
 *  This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.done2 = exports.done1 = exports.done = void 0;
// This is a convenience function to provide as a callback when working interactively.
function _done(n, ...args) {
    const start_time = new Date().valueOf();
    const f = function (...args) {
        if (n !== 1) {
            try {
                args = [JSON.stringify(args, null, n)];
            }
            catch (error) { }
        }
        // do nothing
        console.log(`*** TOTALLY DONE! (${(new Date().valueOf() - start_time) / 1000}s since start) `, ...Array.from(args));
    };
    if (args.length > 0) {
        f(...Array.from(args || []));
    }
    else {
        return f;
    }
}
function done(...args) {
    return _done(0, ...Array.from(args));
}
exports.done = done;
function done1(...args) {
    return _done(1, ...Array.from(args));
}
exports.done1 = done1;
function done2(...args) {
    return _done(2, ...Array.from(args));
}
exports.done2 = done2;
//# sourceMappingURL=done.js.map

/***/ }),

/***/ 840165:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

/*
 *  This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */
/*
 * decaffeinate suggestions:
 * DS207: Consider shorter variations of null checks
 * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
 */
//##############################################################################
//
// CoCalc: Collaborative web-based calculation
// Copyright (C) 2017, Sagemath Inc.
// AGPLv3
//
//##############################################################################
/*
Custom Prop Validation for immutable.js types, so they work just like other
React prop-types.

FUTURE: Put prop validation code in a debug area so that it doesn't get loaded for production

In addition to React Prop checks, we implement the following type checkers:
immutable,
immutable.List,
immutable.Map,
immutable.Set,
immutable.Stack,
which may be chained with .isRequired just like normal React prop checks

Additional validations may be added with the following signature
rtypes.custom_checker_name<function (
        props,
        propName,
        componentName,
        location,
        propFullName,
        secret
    ) => <Error-Like-Object or null>
>
Check React lib to see if this has changed.

*/
const check_is_immutable = function (props, propName, componentName, location, propFullName) {
    if (componentName == null) {
        componentName = "ANONYMOUS";
    }
    if (props[propName] == null || props[propName].toJS != null) {
        return null;
    }
    else {
        const type = typeof props[propName];
        return new Error(`Invalid prop \`${propName}\` of` +
            ` type ${type} supplied to` +
            ` \`${componentName}\`, expected an immutable collection or frozen object.`);
    }
};
const allow_isRequired = function (validate) {
    const check_type = function (isRequired, props, propName, componentName, location) {
        if (componentName == null) {
            componentName = "ANONYMOUS";
        }
        if (props[propName] == null && isRequired) {
            return new Error(`Required prop \`${propName}\` was not specified in \`${componentName}\``);
        }
        return validate(props, propName, componentName, location);
    };
    const chainedCheckType = check_type.bind(null, false);
    chainedCheckType.isRequired = check_type.bind(null, true);
    chainedCheckType.isRequired.category = "IMMUTABLE";
    chainedCheckType.category = "IMMUTABLE";
    return chainedCheckType;
};
const create_immutable_type_required_chain = function (validate) {
    const check_type = function (immutable_type_name, props, propName, componentName) {
        if (componentName == null) {
            componentName = "ANONYMOUS";
        }
        if (immutable_type_name && props[propName] != null) {
            const T = immutable_type_name;
            if (props[propName].toJS == null) {
                return new Error(`NOT EVEN IMMUTABLE, wanted immutable.${T} ${props}, ${propName}`);
            }
            if (__webpack_require__(805687)[`${T}`][`is${T}`](props[propName])) {
                return null;
            }
            else {
                return new Error(`Component \`${componentName}\`` +
                    ` expected ${propName} to be an immutable.${T}` +
                    ` but was supplied ${props[propName]}`);
            }
        }
        else {
            return validate(props, propName, componentName, location);
        }
    };
    // To add more immutable.js types, mimic code below.
    const check_immutable_chain = allow_isRequired(check_type.bind(null, undefined));
    check_immutable_chain.Map = allow_isRequired(check_type.bind(null, "Map"));
    check_immutable_chain.List = allow_isRequired(check_type.bind(null, "List"));
    check_immutable_chain.Set = allow_isRequired(check_type.bind(null, "Set"));
    check_immutable_chain.Stack = allow_isRequired(check_type.bind(null, "Stack"));
    check_immutable_chain.category = "IMMUTABLE";
    return check_immutable_chain;
};
exports.immutable = create_immutable_type_required_chain(check_is_immutable);
//# sourceMappingURL=immutable-types.js.map

/***/ }),

/***/ 690211:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";

/*
 *  This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.wrap_log = exports.log = exports.get_uptime = exports.get_start_time_ts = void 0;
const misc_1 = __webpack_require__(477389);
let smc_logger_timestamp, smc_logger_timestamp_last, smc_start_time;
smc_logger_timestamp =
    smc_logger_timestamp_last =
        smc_start_time =
            new Date().getTime() / 1000.0;
const get_start_time_ts = () => new Date(smc_start_time * 1000);
exports.get_start_time_ts = get_start_time_ts;
const get_uptime = () => (0, misc_1.seconds2hms)(new Date().getTime() / 1000.0 - smc_start_time);
exports.get_uptime = get_uptime;
function log(..._args) {
    smc_logger_timestamp = new Date().getTime() / 1000.0;
    const t = (0, misc_1.seconds2hms)(smc_logger_timestamp - smc_start_time);
    const dt = (0, misc_1.seconds2hms)(smc_logger_timestamp - smc_logger_timestamp_last);
    // support for string interpolation for the actual console.log
    const [msg, ...args] = Array.from(Array.prototype.slice.call(arguments));
    let prompt = `[${t} Δ ${dt} - ${new Date().toISOString()}]`;
    if (typeof msg == "string") {
        prompt = `${prompt} ${msg}`;
        console.log_original(prompt, ...Array.from(args));
    }
    else {
        console.log_original(prompt, msg, ...Array.from(args));
    }
    smc_logger_timestamp_last = smc_logger_timestamp;
}
exports.log = log;
function wrap_log() {
    if (!misc_1.RUNNING_IN_NODE && typeof window != "undefined") {
        window.console.log_original = window.console.log;
        window.console.log = log;
    }
}
exports.wrap_log = wrap_log;
//# sourceMappingURL=log.js.map

/***/ }),

/***/ 416779:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";

/*
 *  This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.map_mutate_out_undefined_and_null = exports.map_without_undefined_and_null = exports.is_zero_map = exports.sum = exports.map_max = exports.map_min = exports.map_limit = void 0;
const lodash_1 = __webpack_require__(988593);
const type_checking_1 = __webpack_require__(307614);
// compare the values in a map a by the values of b
// or just by b if b is a number, using func(a, b)
function map_comp_fn(func, fallback) {
    return (a, b) => {
        const c = {};
        if (typeof b === "number") {
            for (let k in a) {
                let v = a[k];
                c[k] = func(v, b);
            }
        }
        else {
            for (let k in a) {
                let v = a[k];
                c[k] = func(v, b[k] ?? fallback);
            }
        }
        return c;
    };
}
exports.map_limit = map_comp_fn(Math.min, Number.MAX_VALUE);
exports.map_min = exports.map_limit;
exports.map_max = map_comp_fn(Math.max, Number.MIN_VALUE);
// arithmetic sum of an array
function sum(arr, start = 0) {
    if (start == null) {
        start = 0;
    }
    return (0, lodash_1.reduce)(arr, (a, b) => a + b, start);
}
exports.sum = sum;
// returns true if the given map is undefined or empty, or all the values are falsy
function is_zero_map(map) {
    if (map == null) {
        return true;
    }
    for (let k in map) {
        if (map[k]) {
            return false;
        }
    }
    return true;
}
exports.is_zero_map = is_zero_map;
// Returns copy of map with no undefined/null values (recursive).
// Doesn't modify map.  If map is an array, just returns it
// with no change even if it has undefined values.
function map_without_undefined_and_null(map) {
    if (map == null) {
        return;
    }
    if ((0, type_checking_1.is_array)(map)) {
        return map;
    }
    const new_map = {};
    for (let k in map) {
        const v = map[k];
        if (v == null) {
            continue;
        }
        else {
            new_map[k] = (0, type_checking_1.is_object)(v) ? map_without_undefined_and_null(v) : v;
        }
    }
    return new_map;
}
exports.map_without_undefined_and_null = map_without_undefined_and_null;
// modify map in places deleting keys with null or undefined
// values; NOT recursive.
function map_mutate_out_undefined_and_null(map) {
    for (let k in map) {
        const v = map[k];
        if (v == null) {
            delete map[k];
        }
    }
}
exports.map_mutate_out_undefined_and_null = map_mutate_out_undefined_and_null;
//# sourceMappingURL=maps.js.map

/***/ }),

/***/ 962860:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

/*
 *  This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */
//##############################################################################
//
// CoCalc: Collaborative web-based calculation
// Copyright (C) 2017, Sagemath Inc.
// AGPLv3
//
//##############################################################################
/*
Handling of input opts to functions and type checking.
*/
let DEBUG, TEST_MODE, val;
const PropTypes = __webpack_require__(430195);
const immutable_types = __webpack_require__(840165);
/*
Testing related env/DEVEL/DEBUG stuff
*/
if (__guard__(typeof process !== "undefined" && process !== null
    ? process.env
    : undefined, (x) => x.DEVEL) &&
    !__guard__(typeof process !== "undefined" && process !== null
        ? process.env
        : undefined, (x1) => x1.SMC_TEST)) {
    // Running on node and DEVEL is set and not running under test suite
    DEBUG = true;
}
else {
    DEBUG = false;
}
// console.debug only logs if DEBUG is true
if (DEBUG) {
    console.debug = console.log;
}
else {
    console.debug = function () { };
}
if (__guard__(typeof process !== "undefined" && process !== null
    ? process.env
    : undefined, (x2) => x2.SMC_TEST)) {
    // in test mode we *do* want exception to get thrown below when type checks fails
    TEST_MODE = true;
}
// Checks property types on a target object with checkers in a declaration.
// Declarations should throw an Error for mismatches and undefined if OK.
const types = (exports.types = function (target, declaration, identifier) {
    if (identifier == null) {
        identifier = "check.types";
    }
    if (typeof target !== "object") {
        throw new Error("Types was given a non-object to check");
    }
    if (typeof declaration !== "object") {
        throw new Error(`Types was given a ${typeof declaration} as a declaration instead of an object`);
    }
    return PropTypes.checkPropTypes(declaration, target, "checking a", identifier);
});
for (let key in PropTypes) {
    val = PropTypes[key];
    if (key !== "checkPropTypes" && key !== "PropTypes") {
        types[key] = val;
    }
}
types.immutable = immutable_types.immutable;
// Returns a new object with properties determined by those of obj1 and
// obj2.  The properties in obj1 *must* all also appear in obj2.  If an
// obj2 property has value "defaults.required", then it must appear in
// obj1.  For each property P of obj2 not specified in obj1, the
// corresponding value obj1[P] is set (all in a new copy of obj1) to
// be obj2[P].
exports.defaults = function (obj1, obj2, allow_extra, strict) {
    let err;
    if (strict == null) {
        strict = false;
    }
    if (obj1 == null) {
        obj1 = {};
    }
    const error = function () {
        try {
            return `(obj1=${exports.trunc(exports.to_json(obj1), 1024)}, obj2=${exports.trunc(exports.to_json(obj2), 1024)})`;
        }
        catch (err) {
            return "";
        }
    };
    if (obj1 == null) {
        // useful special case
        obj1 = {};
    }
    if (typeof obj1 !== "object") {
        // We put explicit traces before the errors in this function,
        // since otherwise they can be very hard to debug.
        err = `BUG -- Traceback -- misc.defaults -- TypeError: function takes inputs as an object ${error()}`;
        if (strict || DEBUG || TEST_MODE) {
            throw new Error(err);
        }
        else {
            console.log(err);
            console.trace();
            return obj2;
        }
    }
    const r = {};
    for (var prop in obj2) {
        val = obj2[prop];
        if (obj1.hasOwnProperty(prop) && obj1[prop] != null) {
            if (obj2[prop] === exports.defaults.required && obj1[prop] == null) {
                err = `misc.defaults -- TypeError: property '${prop}' must be specified: ${error()}`;
                if (strict || DEBUG || TEST_MODE) {
                    throw new Error(err);
                }
                else {
                    console.warn(err);
                    console.trace();
                }
            }
            r[prop] = obj1[prop];
        }
        else if (obj2[prop] != null) {
            // only record not undefined properties
            if (obj2[prop] === exports.defaults.required) {
                err = `misc.defaults -- TypeError: property '${prop}' must be specified: ${error()}`;
                if (strict || DEBUG || TEST_MODE) {
                    throw new Error(err);
                }
                else {
                    console.warn(err);
                    console.trace();
                }
            }
            else {
                r[prop] = obj2[prop];
            }
        }
    }
    if (!allow_extra) {
        for (prop in obj1) {
            val = obj1[prop];
            if (!obj2.hasOwnProperty(prop)) {
                err = `misc.defaults -- TypeError: got an unexpected argument '${prop}' ${error()}`;
                console.trace();
                if (strict || DEBUG || TEST_MODE) {
                    throw new Error(err);
                }
                else {
                    console.warn(err);
                }
            }
        }
    }
    return r;
};
// WARNING -- don't accidentally use this as a default:
const required = (exports.required = exports.defaults.required =
    "__!!!!!!this is a required property!!!!!!__");
function __guard__(value, transform) {
    return typeof value !== "undefined" && value !== null
        ? transform(value)
        : undefined;
}
//# sourceMappingURL=opts.js.map

/***/ }),

/***/ 307614:
/***/ ((__unused_webpack_module, exports) => {

"use strict";

/*
 *  This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.is_set = exports.is_date = exports.is_object = exports.is_string = exports.is_integer = exports.is_array = void 0;
function is_array(obj) {
    return Object.prototype.toString.call(obj) === "[object Array]";
}
exports.is_array = is_array;
function is_integer(obj) {
    return Number.isInteger?.(obj) ?? (typeof obj
        === "number" && obj
        % 1 === 0);
}
exports.is_integer = is_integer;
function is_string(obj) {
    return typeof obj === "string";
}
exports.is_string = is_string;
// An object -- this is more constraining that typeof(obj) == 'object', e.g., it does
// NOT include Date.
function is_object(obj) {
    return Object.prototype.toString.call(obj) === "[object Object]";
}
exports.is_object = is_object;
function is_date(obj) {
    return obj instanceof Date;
}
exports.is_date = is_date;
function is_set(obj) {
    return Object.prototype.toString.call(obj) === "[object Set]";
}
exports.is_set = is_set;
//# sourceMappingURL=type-checking.js.map

/***/ })

};
;