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

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

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (/* binding */ editURL)
/* harmony export */ });
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(371017);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var lib_base_path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(348397);
/*
 *  This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */ 

function editURL(options) {
    const type = options["type"];
    switch(type){
        case "anonymous":
            return anonymousURL(options);
        case "collaborator":
        default:
            return collaboratorURL(options);
    }
};
// needed since we're making a link outside of the nextjs server.
function withBasePath(url) {
    return (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(lib_base_path__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z, url);
}
function anonymousURL({ id , path , relativePath  }) {
    const app = "/static/app.html";
    return withBasePath(encodeURI(`${app}?anonymous=true&launch=share/${id}/${(0,path__WEBPACK_IMPORTED_MODULE_0__.join)(path, relativePath ?? "")}`));
}
function collaboratorURL({ project_id , path , relativePath  }) {
    const projectURL = (0,path__WEBPACK_IMPORTED_MODULE_0__.join)("/projects", project_id);
    if (!path) {
        return withBasePath(projectURL);
    }
    return withBasePath((0,path__WEBPACK_IMPORTED_MODULE_0__.join)(projectURL, "files", path, relativePath ?? ""));
}


/***/ })

};
;