"use strict";
/*
 * ATTENTION: An "eval-source-map" devtool has been used.
 * This devtool is neither made for production nor for readable output files.
 * It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools.
 * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
 * or disable the default devtool with "devtool: false".
 * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
 */
self["webpackHotUpdate_N_E"]("app/admin/documents/page",{

/***/ "(app-pages-browser)/./src/lib/services.ts":
/*!*****************************!*\
  !*** ./src/lib/services.ts ***!
  \*****************************/
/***/ (function(module, __webpack_exports__, __webpack_require__) {

eval(__webpack_require__.ts("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   getFeed: function() { return /* binding */ getFeed; },\n/* harmony export */   getIngestionStatus: function() { return /* binding */ getIngestionStatus; },\n/* harmony export */   getLeaderboard: function() { return /* binding */ getLeaderboard; },\n/* harmony export */   patchCurriculumWeekOrder: function() { return /* binding */ patchCurriculumWeekOrder; },\n/* harmony export */   postComplete: function() { return /* binding */ postComplete; },\n/* harmony export */   postCurriculumConfirm: function() { return /* binding */ postCurriculumConfirm; },\n/* harmony export */   postGenerateAll: function() { return /* binding */ postGenerateAll; },\n/* harmony export */   postIngest: function() { return /* binding */ postIngest; }\n/* harmony export */ });\nvar _process_env_NEXT_PUBLIC_INGESTION_URL;\nconst INGESTION_URL = (_process_env_NEXT_PUBLIC_INGESTION_URL = \"http://localhost:3001\") !== null && _process_env_NEXT_PUBLIC_INGESTION_URL !== void 0 ? _process_env_NEXT_PUBLIC_INGESTION_URL : \"http://localhost:3001\";\nvar _process_env_NEXT_PUBLIC_GENERATION_URL;\nconst GENERATION_URL = (_process_env_NEXT_PUBLIC_GENERATION_URL = \"http://localhost:3002\") !== null && _process_env_NEXT_PUBLIC_GENERATION_URL !== void 0 ? _process_env_NEXT_PUBLIC_GENERATION_URL : \"http://localhost:3002\";\nvar _process_env_NEXT_PUBLIC_CURRICULUM_URL;\nconst CURRICULUM_URL = (_process_env_NEXT_PUBLIC_CURRICULUM_URL = \"http://localhost:3003\") !== null && _process_env_NEXT_PUBLIC_CURRICULUM_URL !== void 0 ? _process_env_NEXT_PUBLIC_CURRICULUM_URL : \"http://localhost:3003\";\nvar _process_env_NEXT_PUBLIC_PROGRESS_URL;\nconst PROGRESS_URL = (_process_env_NEXT_PUBLIC_PROGRESS_URL = \"http://localhost:3005\") !== null && _process_env_NEXT_PUBLIC_PROGRESS_URL !== void 0 ? _process_env_NEXT_PUBLIC_PROGRESS_URL : \"http://localhost:3005\";\nasync function handleResponse(res) {\n    if (!res.ok) {\n        const text = await res.text().catch(()=>res.statusText);\n        throw new Error(\"HTTP \".concat(res.status, \": \").concat(text));\n    }\n    return res.json();\n}\nasync function postIngest(payload) {\n    const res = await fetch(\"\".concat(INGESTION_URL, \"/ingest\"), {\n        method: \"POST\",\n        headers: {\n            \"Content-Type\": \"application/json\"\n        },\n        body: JSON.stringify(payload)\n    });\n    return handleResponse(res);\n}\nasync function getIngestionStatus(jobId) {\n    const res = await fetch(\"\".concat(INGESTION_URL, \"/ingest/status/\").concat(encodeURIComponent(jobId)));\n    return handleResponse(res);\n}\nasync function postGenerateAll(themeId) {\n    const res = await fetch(\"\".concat(GENERATION_URL, \"/generate\"), {\n        method: \"POST\",\n        headers: {\n            \"Content-Type\": \"application/json\"\n        },\n        body: JSON.stringify({\n            themeId\n        })\n    });\n    const data = await handleResponse(res);\n    return {\n        queued: data.totalItems\n    };\n}\nasync function postComplete(payload) {\n    const res = await fetch(\"\".concat(PROGRESS_URL, \"/complete\"), {\n        method: \"POST\",\n        headers: {\n            \"Content-Type\": \"application/json\"\n        },\n        body: JSON.stringify(payload)\n    });\n    return handleResponse(res);\n}\nasync function getLeaderboard() {\n    const res = await fetch(\"\".concat(PROGRESS_URL, \"/leaderboard\"));\n    return handleResponse(res);\n}\nasync function getFeed() {\n    const res = await fetch(\"\".concat(PROGRESS_URL, \"/feed\"));\n    return handleResponse(res);\n}\nasync function postCurriculumConfirm(versionId) {\n    const res = await fetch(\"\".concat(CURRICULUM_URL, \"/curriculum/versions/\").concat(encodeURIComponent(versionId), \"/confirm\"), {\n        method: \"POST\",\n        headers: {\n            \"Content-Type\": \"application/json\"\n        }\n    });\n    if (!res.ok) {\n        const text = await res.text().catch(()=>res.statusText);\n        throw new Error(\"HTTP \".concat(res.status, \": \").concat(text));\n    }\n}\nasync function patchCurriculumWeekOrder(weekId, position) {\n    const res = await fetch(\"\".concat(CURRICULUM_URL, \"/curriculum/weeks/\").concat(encodeURIComponent(weekId), \"/order\"), {\n        method: \"PATCH\",\n        headers: {\n            \"Content-Type\": \"application/json\"\n        },\n        body: JSON.stringify({\n            position\n        })\n    });\n    if (!res.ok) {\n        const text = await res.text().catch(()=>res.statusText);\n        throw new Error(\"HTTP \".concat(res.status, \": \").concat(text));\n    }\n}\n\n\n;\n    // Wrapped in an IIFE to avoid polluting the global scope\n    ;\n    (function () {\n        var _a, _b;\n        // Legacy CSS implementations will `eval` browser code in a Node.js context\n        // to extract CSS. For backwards compatibility, we need to check we're in a\n        // browser context before continuing.\n        if (typeof self !== 'undefined' &&\n            // AMP / No-JS mode does not inject these helpers:\n            '$RefreshHelpers$' in self) {\n            // @ts-ignore __webpack_module__ is global\n            var currentExports = module.exports;\n            // @ts-ignore __webpack_module__ is global\n            var prevSignature = (_b = (_a = module.hot.data) === null || _a === void 0 ? void 0 : _a.prevSignature) !== null && _b !== void 0 ? _b : null;\n            // This cannot happen in MainTemplate because the exports mismatch between\n            // templating and execution.\n            self.$RefreshHelpers$.registerExportsForReactRefresh(currentExports, module.id);\n            // A module can be accepted automatically based on its exports, e.g. when\n            // it is a Refresh Boundary.\n            if (self.$RefreshHelpers$.isReactRefreshBoundary(currentExports)) {\n                // Save the previous exports signature on update so we can compare the boundary\n                // signatures. We avoid saving exports themselves since it causes memory leaks (https://github.com/vercel/next.js/pull/53797)\n                module.hot.dispose(function (data) {\n                    data.prevSignature =\n                        self.$RefreshHelpers$.getRefreshBoundarySignature(currentExports);\n                });\n                // Unconditionally accept an update to this module, we'll check if it's\n                // still a Refresh Boundary later.\n                // @ts-ignore importMeta is replaced in the loader\n                module.hot.accept();\n                // This field is set when the previous version of this module was a\n                // Refresh Boundary, letting us know we need to check for invalidation or\n                // enqueue an update.\n                if (prevSignature !== null) {\n                    // A boundary can become ineligible if its exports are incompatible\n                    // with the previous exports.\n                    //\n                    // For example, if you add/remove/change exports, we'll want to\n                    // re-execute the importing modules, and force those components to\n                    // re-render. Similarly, if you convert a class component to a\n                    // function, we want to invalidate the boundary.\n                    if (self.$RefreshHelpers$.shouldInvalidateReactRefreshBoundary(prevSignature, self.$RefreshHelpers$.getRefreshBoundarySignature(currentExports))) {\n                        module.hot.invalidate();\n                    }\n                    else {\n                        self.$RefreshHelpers$.scheduleUpdate();\n                    }\n                }\n            }\n            else {\n                // Since we just executed the code for the module, it's possible that the\n                // new exports made it ineligible for being a boundary.\n                // We only care about the case when we were _previously_ a boundary,\n                // because we already accepted this update (accidental side effect).\n                var isNoLongerABoundary = prevSignature !== null;\n                if (isNoLongerABoundary) {\n                    module.hot.invalidate();\n                }\n            }\n        }\n    })();\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64, \n//# sourceURL=webpack-internal:///(app-pages-browser)/./src/lib/services.ts\n"));

/***/ })

});