{"version":3,"file":"index-Anv74-sp.chunk.mjs","sources":["../node_modules/@nextcloud/initial-state/dist/index.js","../node_modules/@nextcloud/router/dist/index.mjs"],"sourcesContent":["/**\n * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\n/**\n * @param app app ID, e.g. \"mail\"\n * @param key name of the property\n * @param fallback optional parameter to use as default value\n * @throws if the key can't be found\n */\nexport function loadState(app, key, fallback) {\n const selector = `#initial-state-${app}-${key}`;\n if (window._nc_initial_state?.has(selector)) {\n return window._nc_initial_state.get(selector);\n }\n else if (!window._nc_initial_state) {\n window._nc_initial_state = new Map();\n }\n const elem = document.querySelector(selector);\n if (elem === null) {\n if (fallback !== undefined) {\n return fallback;\n }\n throw new Error(`Could not find initial state ${key} of ${app}`);\n }\n try {\n const parsedValue = JSON.parse(atob(elem.value));\n window._nc_initial_state.set(selector, parsedValue);\n return parsedValue;\n }\n catch (error) {\n console.error('[@nextcloud/initial-state] Could not parse initial state', { key, app, error });\n if (fallback !== undefined) {\n return fallback;\n }\n throw new Error(`Could not parse initial state ${key} of ${app}`, { cause: error });\n }\n}\n","function linkTo(app, file) {\n return generateFilePath(app, \"\", file);\n}\nconst linkToRemoteBase = (service) => \"/remote.php/\" + service;\nconst generateRemoteUrl = (service, options) => {\n const baseURL = options?.baseURL ?? getBaseUrl();\n return baseURL + linkToRemoteBase(service);\n};\nconst generateOcsUrl = (url, params, options) => {\n const allOptions = Object.assign({\n ocsVersion: 2\n }, options || {});\n const version = allOptions.ocsVersion === 1 ? 1 : 2;\n const baseURL = options?.baseURL ?? getBaseUrl();\n return baseURL + \"/ocs/v\" + version + \".php\" + _generateUrlPath(url, params, options);\n};\nconst _generateUrlPath = (url, params, options) => {\n const allOptions = Object.assign({\n escape: true\n }, options || {});\n const _build = function(text, vars) {\n vars = vars || {};\n return text.replace(\n /{([^{}]*)}/g,\n function(a, b) {\n const r = vars[b];\n if (allOptions.escape) {\n return typeof r === \"string\" || typeof r === \"number\" ? encodeURIComponent(r.toString()) : encodeURIComponent(a);\n } else {\n return typeof r === \"string\" || typeof r === \"number\" ? r.toString() : a;\n }\n }\n );\n };\n if (url.charAt(0) !== \"/\") {\n url = \"/\" + url;\n }\n return _build(url, params || {});\n};\nconst generateUrl = (url, params, options) => {\n const allOptions = Object.assign({\n noRewrite: false\n }, options || {});\n const baseOrRootURL = options?.baseURL ?? getRootUrl();\n if (window?.OC?.config?.modRewriteWorking === true && !allOptions.noRewrite) {\n return baseOrRootURL + _generateUrlPath(url, params, options);\n }\n return baseOrRootURL + \"/index.php\" + _generateUrlPath(url, params, options);\n};\nconst imagePath = (app, file) => {\n if (!file.includes(\".\")) {\n return generateFilePath(app, \"img\", `${file}.svg`);\n }\n return generateFilePath(app, \"img\", file);\n};\nconst generateFilePath = (app, type, file) => {\n const isCore = window?.OC?.coreApps?.includes(app) ?? false;\n const isPHP = file.slice(-3) === \"php\";\n let link = getRootUrl();\n if (isPHP && !isCore) {\n link += `/index.php/apps/${app}`;\n if (type) {\n link += `/${encodeURI(type)}`;\n }\n if (file !== \"index.php\") {\n link += `/${file}`;\n }\n } else if (!isPHP && !isCore) {\n link = getAppRootUrl(app);\n if (type) {\n link += `/${type}/`;\n }\n if (link.at(-1) !== \"/\") {\n link += \"/\";\n }\n link += file;\n } else {\n if ((app === \"settings\" || app === \"core\" || app === \"search\") && type === \"ajax\") {\n link += \"/index.php\";\n }\n if (app) {\n link += `/${app}`;\n }\n if (type) {\n link += `/${type}`;\n }\n link += `/${file}`;\n }\n return link;\n};\nconst getBaseUrl = () => window.location.protocol + \"//\" + window.location.host + getRootUrl();\nfunction getRootUrl() {\n let webroot = window._oc_webroot;\n if (typeof webroot === \"undefined\") {\n webroot = location.pathname;\n const pos = webroot.indexOf(\"/index.php/\");\n if (pos !== -1) {\n webroot = webroot.slice(0, pos);\n } else {\n const index = webroot.indexOf(\"/\", 1);\n webroot = webroot.slice(0, index > 0 ? index : void 0);\n }\n }\n return webroot;\n}\nfunction getAppRootUrl(app) {\n const webroots = window._oc_appswebroots ?? {};\n return webroots[app] ?? \"\";\n}\n/*!\n * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\nfunction generateAvatarUrl(user, options) {\n const size = (options?.size || 64) <= 64 ? 64 : 512;\n const guestUrl = options?.isGuestUser ? \"/guest\" : \"\";\n const themeUrl = options?.isDarkTheme ? \"/dark\" : \"\";\n return generateUrl(`/avatar${guestUrl}/{user}/{size}${themeUrl}`, {\n user,\n size\n });\n}\nexport {\n generateAvatarUrl,\n generateFilePath,\n generateOcsUrl,\n generateRemoteUrl,\n generateUrl,\n getAppRootUrl,\n getBaseUrl,\n getRootUrl,\n imagePath,\n linkTo\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["loadState","app","key","fallback","selector","elem","parsedValue","error","linkTo","file","generateFilePath","generateOcsUrl","url","params","options","version","getBaseUrl","_generateUrlPath","allOptions","_build","text","vars","a","b","generateUrl","baseOrRootURL","getRootUrl","imagePath","type","isCore","isPHP","link","getAppRootUrl","webroot","pos","index"],"mappings":";AAUO,SAASA,EAAUC,EAAKC,EAAKC,EAAU,CAC1C,MAAMC,EAAW,kBAAkBH,CAAG,IAAIC,CAAG,GAC7C,GAAI,OAAO,mBAAmB,IAAIE,CAAQ,EACtC,OAAO,OAAO,kBAAkB,IAAIA,CAAQ,EAEtC,OAAO,oBACb,OAAO,kBAAoB,IAAI,KAEnC,MAAMC,EAAO,SAAS,cAAcD,CAAQ,EAC5C,GAAIC,IAAS,KAAM,CACf,GAAIF,IAAa,OACb,OAAOA,EAEX,MAAM,IAAI,MAAM,gCAAgCD,CAAG,OAAOD,CAAG,EAAE,CACvE,CACI,GAAI,CACA,MAAMK,EAAc,KAAK,MAAM,KAAKD,EAAK,KAAK,CAAC,EAC/C,OAAA,OAAO,kBAAkB,IAAID,EAAUE,CAAW,EAC3CA,CACf,OACWC,EAAO,CA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