"use strict";
exports.id = 2058;
exports.ids = [2058];
exports.modules = {

/***/ 422004:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (/* binding */ Head)
/* harmony export */ });
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(920997);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var next_head__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(40968);
/* harmony import */ var next_head__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(next_head__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var lib_customize__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(481617);
/* harmony import */ var lib_base_path__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(621923);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(371017);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__);




const FAVICON = "/webapp/favicon-32x32.png";

function Head({ title  }) {
    const { siteName  } = (0,lib_customize__WEBPACK_IMPORTED_MODULE_2__/* .useCustomize */ .i)();
    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)((next_head__WEBPACK_IMPORTED_MODULE_1___default()), {
        children: [
            /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("title", {
                children: [
                    siteName,
                    " ",
                    siteName ? "\u2013" : "",
                    " ",
                    title
                ]
            }),
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("meta", {
                name: "description",
                content: "CoCalc landing pages and documentation"
            }),
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("link", {
                rel: "icon",
                href: (0,path__WEBPACK_IMPORTED_MODULE_3__.join)(lib_base_path__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z ?? "", FAVICON)
            })
        ]
    });
};


/***/ }),

/***/ 811185:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (/* binding */ useAPI)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(616689);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var lib_api_post__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(456658);
/* harmony import */ var _mounted__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(189275);
/* harmony import */ var awaiting__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(986954);
/* harmony import */ var awaiting__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(awaiting__WEBPACK_IMPORTED_MODULE_3__);




function useAPI(endpoint2, params2, cache_s2) {
    const { 0: error , 1: setError  } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)("");
    const { 0: result1 , 1: setResult  } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(undefined);
    const { 0: calling , 1: setCalling  } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
    const queue = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)([]);
    const isMounted = (0,_mounted__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)();
    async function call(endpoint1 = endpoint2, params1 = params2, cache_s1 = cache_s2) {
        if (endpoint1 == undefined) return;
        if (calling) {
            queue.current.push({
                endpoint: endpoint1,
                params: params1,
                cache_s: cache_s1
            });
            return;
        }
        setCalling(true);
        let result;
        try {
            result = await (0,lib_api_post__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(endpoint1, params1, cache_s2);
        } catch (err) {
            if (!isMounted.current) return;
            setCalling(false);
            setError(`${err}`);
            setResult({
                error: err
            });
            queue.current = [];
            return;
        }
        if (!isMounted.current) return;
        setCalling(false);
        setResult(result);
        if (queue.current.length > 0) {
            const next = queue.current.shift();
            if (next == null) return;
            const { endpoint , params , cache_s  } = next;
            if (!isMounted.current) return;
            await (0,awaiting__WEBPACK_IMPORTED_MODULE_3__.delay)(1);
            call(endpoint, params, cache_s);
        }
    }
    (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(()=>{
        if (endpoint2) {
            call(endpoint2, params2, cache_s2);
        }
    }, [
        endpoint2 + JSON.stringify(params2)
    ]);
    return {
        error,
        result: result1,
        calling,
        call
    };
};


/***/ })

};
;