diff --git a/asset-manifest.json b/asset-manifest.json
index 701639f..2b1ce77 100644
--- a/asset-manifest.json
+++ b/asset-manifest.json
@@ -1,8 +1,8 @@
{
"files": {
"main.css": "/brs-extensions/static/css/main.ef6e7c69.chunk.css",
- "main.js": "/brs-extensions/static/js/main.303a61b2.chunk.js",
- "main.js.map": "/brs-extensions/static/js/main.303a61b2.chunk.js.map",
+ "main.js": "/brs-extensions/static/js/main.e9790dc5.chunk.js",
+ "main.js.map": "/brs-extensions/static/js/main.e9790dc5.chunk.js.map",
"runtime-main.js": "/brs-extensions/static/js/runtime-main.3fca17c7.js",
"runtime-main.js.map": "/brs-extensions/static/js/runtime-main.3fca17c7.js.map",
"static/js/2.a39b3895.chunk.js": "/brs-extensions/static/js/2.a39b3895.chunk.js",
@@ -17,6 +17,6 @@
"static/js/runtime-main.3fca17c7.js",
"static/js/2.a39b3895.chunk.js",
"static/css/main.ef6e7c69.chunk.css",
- "static/js/main.303a61b2.chunk.js"
+ "static/js/main.e9790dc5.chunk.js"
]
}
\ No newline at end of file
diff --git a/index.html b/index.html
index 5393938..8e1675c 100644
--- a/index.html
+++ b/index.html
@@ -1 +1 @@
-
Расширения БРС
\ No newline at end of file
+Расширения БРС
\ No newline at end of file
diff --git a/static/js/main.303a61b2.chunk.js.map b/static/js/main.303a61b2.chunk.js.map
deleted file mode 100644
index 1366685..0000000
--- a/static/js/main.303a61b2.chunk.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"sources":["helpers/cache.ts","helpers/CustomError.ts","Constants.ts","apis/BrsUrlProvider.ts","apis/BrsAuth.ts","apis/GoogleAuth.ts","Context.tsx","components/shared/SubmitWithLoading/index.tsx","components/login/BrsLoginForm/index.tsx","components/login/GoogleLoginButton.tsx","components/shared/CustomAlert.tsx","components/login/LoginPage/index.tsx","components/login/LoginPageContainer.tsx","apis/BrsApi.ts","apis/GoogleApi.ts","helpers/tools.ts","helpers/brsHelpers.ts","helpers/emojiRegex.ts","managers/SpreadsheetManager.ts","components/shared/NestedList/index.tsx","components/work/RunWorkerButtons.tsx","helpers/fio.ts","managers/MarksManager.ts","components/work/GoogleTableFetch/index.tsx","managers/ReportManager.ts","components/work/WorkerDialog/index.tsx","components/work/GoogleTableFetch/GoogleTableFetchForm.tsx","components/shared/SessionExpiredAlert.tsx","components/work/LoadingPane/index.tsx","components/work/WorkPage/index.tsx","components/work/WorkPageContainer.tsx","App.tsx","reportWebVitals.ts","index.tsx"],"names":["StorageType","StatusCode","TABLE_URL_PATTERN","BRS_URL","BrsUrlProvider","withProxy","this","save","name","data","whereTo","json","JSON","stringify","Local","LocalAndSession","localStorage","setItem","Session","sessionStorage","read","whereFrom","content","getItem","parse","clear","storageType","removeItem","LoginStatus","CustomError","statusCode","message","BrsAuth","brsUrlProvider","_sid","_safeUserName","_userName","BrsUnauthorized","a","loginInfo","cache","saveLoginInfo","sid","userName","checkSidAsync","sidCheckResult","success","request","method","url","baseUrl","headers","response","match","login","password","requestSidAsync","Error","cookie","result","checkResult","InvalidCredentials","Succeed","safeUserName","replaceAll","body","resolveWithFullResponse","simple","then","x","DISCOVERY_DOCS","GoogleAuth","gapi","client","Promise","resolve","load","init","clientId","discoveryDocs","scope","catch","console","error","handler","auth2","getAuthInstance","isSignedIn","listen","get","basicProfile","currentUser","getBasicProfile","getName","getEmail","signOut","Context","createContext","SubmitWithLoading","props","title","loading","className","onClick","disabled","Button","type","fullWidth","variant","color","CircularProgress","size","BrsLoginForm","onSubmit","submitting","signedIn","onLogout","React","useState","setLogin","setPassword","setSid","Fragment","e","preventDefault","TextField","margin","id","label","autoFocus","value","onChange","target","autoComplete","href","rel","GoogleLoginButton","onSignedIn","onFailure","Container","buttonText","onSuccess","CustomAlert","open","onClose","Snackbar","autoHideDuration","anchorOrigin","vertical","horizontal","severity","Alert","elevation","LoginPage","handleBrsSubmit","credentials","setState","submitLoading","loginBrsAsync","loginStatus","alertMessage","openAlert","alertType","brsAuthorized","brsAuth","authBySidAsync","loginAsync","handleCloseAlert","handleGoogleSignedIn","googleAuthorized","handleGoogleLoginFailed","startWork","redirect","handleBrsLogout","logout","handleGoogleLogout","googleAuth","renderGreeting","renderBrsLogin","state","brsLoading","renderGoogleLogin","getUserName","renderStartWorkButton","ensureInitializedAsync","tryRestoreAsync","listenAuthorized","authorized","checkAuth","checkAuthorized","to","component","maxWidth","Component","LoginPageContainer","Consumer","context","StudentFailure","TermType","BrsApi","year","termType","course","isModule","cacheName","getDisciplineCacheName","cacheResult","getDisciplineTotalAsync","total","getDisciplineInternalAsync","Math","max","disciplines","page","pageSize","queryString","requestApiJsonAsync","paging","numberOfElements","moduleParameter","discipline","getStudentMarksAsync","students","uniqueStudents","s","knownStudent","studentUuid","Object","keys","map","k","cardType","markType","getStudentMarksInternalAsync","disciplineLoad","groupHistoryId","groupId","groupUuid","techgroup","isTotal","showActiveStudents","groupPart","disciplineMeta","lecture","laboratory","practice","additionalPractice","fillCardMetaAsync","getControlActionColumnsCachedAsync","currentColumns","intermediateColumns","length","cardMeta","currentControlActions","extractControlActions","currentFactor","intermediateControlActions","intermediateFactor","totalFactor","fillFactors","totalColumns","fillTotalFactors","getControlActionColumnsInternalAsync","modulePart","requestApiAsync","prefix","suffix","linesWithId","split","trim","filter","startsWith","columns","substr","uuidPrefix","c","uuid","uuidWithoutPrefix","maxValue","isIntermediate","intermediate","controlAction","column","parseFloat","controlActionId","mark","cardTypeKey","disciplineLoadUuid","isNaN","toString","studentFailure","NoFailure","updateMarksAsync","updateMarksInternalAsync","uri","options","trimLeft","getSpreadsheet","spreadsheetId","sheets","range","spreadsheets","values","meta","readAsync","getMetaAsync","normalizeString","str","toLowerCase","replace","compareNormalized","s1","s2","parseAnyFloat","groupBy","items","key","reduce","reducer","item","itemKey","push","getKeys","obj","pluralize","count","version1","version2","version5","round10","round","round100","failureMapping","NotChosen","NotAllowedByDeansOffice","NotAppeared","Неуважительная","DisrespectfulReason","Уважительная","RespectfulReason","NotAllowedByTeacher","ShouldNotPass","AcademicLeave","Выбыл","DroppedOut","parseStudentFailure","input","undefined","formatStudentFailure","emojiRegex","SpreadsheetManager","sheetName","readRowsFromSpreadsheetAsync","rows","header","getHeader","indices","buildIndicesBy","dataRange","buildDataRange","readStudentsAsync","actualStudents","disciplineKeyColumn","disciplineValueColumn","controlActionConfigs","buildControlActionConfig","disciplineConfig","buildDisciplineConfig","datas","courseColumn","academicGroupColumn","studentGroups","student","courses","buildDisciplineConfigFromSpreadsheetTitleAsync","disciplineConfigs","config","readRange","fullNameIndex","fullNameColumn","left","surnameIndex","surnameColumn","nameIndex","nameColumn","patronymicIndex","patronymicColumn","groupNameIndex","groupColumn","courseIndex","academicGroupIndex","idIndex","failureIndex","failureColumn","sheet","googleApi","row","fullName1","surname","patronymic","fullName2","fullName","groupName","course1","academicGroup","course2","failure","properties","readTitleFromSpreadsheetAsync","normalizedHeader","groupColumnIndex","indexOf","fullNameColumnIndex","surnameColumnIndex","nameColumnIndex","patronymicColumnIndex","courseColumnIndex","academicGroupColumnIndex","failureColumnIndex","disciplineParameterKeyColumnIndex","disciplineParameterValueColumnIndex","leftIndex","min","it","right","leftLetter","String","fromCharCode","charCodeAt","rightLetter","index","propertyIndex","sameColumns","matchCount","matchIndex","spreadsheetTitle","prepared","commaIndex","lastIndexOf","substring","time","timeParts","Spring","Fall","parseInt","configs","defaultStudentFailure","errors","i","addDisciplineConfigParameter","errorNames","filterNull","errorNamesString","n","join","yearParts","NestedList","icons","listSubheader","ListSubheader","hidden","List","aria-labelledby","subheader","renderNestedItems","ListItem","ListItemText","primary","level","NestedListItem","nestedItems","colored","collapsed","renderAsText","setOpen","hasSubItems","icon","IconPlace","ListItemIcon","button","style","paddingLeft","ExpandLess","ExpandMore","Collapse","in","unmountOnExit","paddingTop","paddingBottom","disablePadding","RunWorkerButtons","enabled","onRunWorkSafe","onRunWorkUnsafe","Grid","container","justify","toKey","fio","MarkUpdateStatus","autoControlActionNames","Set","MarksManager","brsApi","reportManager","cancelPending","spreadsheetData","isSuitableDiscipline","newReport","merge","succeed","marks","skipped","putMarksForDisciplineAsync","finishReport","cancelReport","getDisciplineMetaAsync","checkControlActionsConfiguration","getAllStudentMarksAsync","brsStudents","mergeStudents","mergedStudents","skippedActualStudents","skippedBrsStudents","logMergedStudents","putMarksForStudentsAsync","updateFailuresForSkippedStudentsAsync","updateAllMarksAsync","tryGetAutoControlActionConfig","controlActions","getControlActions","getSuitableControlAction","ratings","notFinishedStudents","tryCount","putMarksForStudentsOnceAsync","studentId","ratingResults","r","finished","rating","status","Failed","groupedResults","entries","rawStudents","formatMarkUpdateStatus","infoString","failed","currentReport","all","putMarksForStudentAsync","oldRating","brs","newRating","Skipped","newFinished","actual","autoControlActionConfig","log","updated","putAutoMarksForStudentAsync","putManualMarksForStudentAsync","brsFailureStatus","actualFailure","failureStatus","putStudentFailureAsync","Updated","studentName","autoMarkString","autoMark","controlActionGroups","getControlActionGroups","currentControlActionGroups","factor","intermediateControlActionGroups","output","putMarksTryFillActionsWithMaxScoreAsync","intermediateMark","currentMark","controlActionGroup","actualMark","putMarkAsync","actualMarkString","brsMarkString","brsMark","needUpdateMark","actualMarkOutput","controlActionOutput","putStudentMarkAsync","suitableControlActions","errorMessages","group","teacherName","onInvalidConfiguration","updateFailureForStudent","studentFio","description","autoConfigs","has","groups","pushControlActionGroups","activeBrsStudents","isStudentActiveAndShouldPass","actualStudent","suitableStudents","brsStudent","brsFullName","actualFullName","areStudentsLike","some","ms","report","failedActual","failedBrs","studentStatus","LastAction","ReportManager","onReportFinished","_currentReport","DialogContent","withStyles","root","padding","MuiDialogContent","DialogActions","display","justifyContent","MuiDialogActions","WorkerDialog","marksManager","logConfigurationErrors","logItems","logMessage","reportToNestedListItems","marksDatas","marksData","suitableDisciplines","putMarksToBrsAsync","onError","okLoading","cancelWork","cancel","disciplineTime","mainItem","hasErrors","mergeResultsTitle","failedActualCount","failedBrsCount","mergeInfoItem","marksItem","skippedItem","Dialog","dividers","onClosed","GoogleTableFetchForm","tableUrl","setTableUrl","urlError","setUrlError","regExp","spreadsheetInfo","maybeSheetId","sheetId","event","helperText","required","GoogleTableFetch","workerSaveMode","loadDisciplines","getActualSpreadsheetDataAsync","spreadsheetDatas","allMissed","missedCount","getActualDisciplinesAsync","disciplinesToListItems","showDisciplines","lastAction","LoadDisciplines","allDisciplinesMissed","missedDisciplinesCount","showWorkerButtons","updateCachedDisciplines","clearDisciplineCacheAsync","runWork","RunWork","runWorker","handleRunWorkSafe","handleRunWorkUnsafe","handleWorkerClosed","None","tableUrlError","availableDisciplines","actualGroups","Array","from","availableGroups","normalizedGroup","availableForActual","flat","disciplineTitle","getDisciplineCachedAsync","allDisciplines","d","getSheetName","spreadsheetManager","getSpreadsheetDataAsync","maybeSheet","ViewModule","memo","Transition","forwardRef","ref","Slide","direction","SessionExpiredAlert","sessionName","onOk","TransitionComponent","keepMounted","aria-describedby","DialogTitle","DialogContentText","LoadingPane","WorkPage","handleError","errorMessage","handleSessionExpired","openSessionExpiredAlert","handleSessionExpiredOk","returnToLoginPage","closeError","showControls","setTimeout","marginTop","WorkPageContainer","urlProvider","App","Provider","hashType","path","exact","reportWebVitals","onPerfEntry","Function","getCLS","getFID","getFCP","getLCP","getTTFB","ReactDOM","render","document","getElementById"],"mappings":"+lBAAYA,ECAAC,E,kECGCC,EACT,yGAKSC,EAAU,0BCPFC,E,WAGjB,WAAYC,GAAqB,yBAFhBA,eAEe,EAC5BC,KAAKD,UAAYA,E,yCAGrB,WACI,OAAOC,KAAKD,UAAL,UDCW,0DCDX,YAAkCF,GAAYA,M,8CHJtD,SAASI,EACdC,EACAC,EACAC,GAEA,IAAKD,EACH,OAAO,EAGT,IAAME,EAAOC,KAAKC,UAAUJ,GAU5B,OARIC,IAAYV,EAAYc,OAASJ,IAAYV,EAAYe,iBAC3DC,aAAaC,QAAQT,EAAMG,GAE3BD,IAAYV,EAAYkB,SACxBR,IAAYV,EAAYe,iBAExBI,eAAeF,QAAQT,EAAMG,IAExB,EAGF,SAASS,EACdZ,EACAa,GACC,IAAD,EACIC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AAKotB,kBAHhB,iKAOA,cAAC,GAAD,CACEnO,OAAQjf,KAAK6F,MAAMoZ,OACnBwI,QAASznB,KAAK+sB,0B,GAtGUhmB,IAAM4E,WCR7B,SAAS8hB,KACtB,OACE,cAAC,EAAQ5hB,SAAT,UACG,SAACC,GAAD,OACCA,GACE,cAAC,GAAD,CACEhC,QAASgC,EAAQhC,QACjBmV,OAAQnT,EAAQmT,OAChBvU,WAAYoB,EAAQpB,gBCFhC,IAAMgjB,GAAc,IAAI5tB,GAAe,GACjCgK,GAAU,IAAIpI,EAAQgsB,IACtBzO,GAAS,IAAIhT,GAAOnC,GAAS4jB,IAC7BhjB,GAAa,IAAIzG,EAER,SAAS0pB,KACtB,OACE,cAAC,EAAQC,SAAT,CAAkBhmB,MAAO,CAAEkC,WAASmV,UAAQvU,eAA5C,SACE,cAAC,IAAD,CAAYmjB,SAAS,UAArB,SACE,eAAC,IAAD,WACE,cAAC,IAAD,CAAOC,KAAK,QAAQriB,UAAWgiB,KAC/B,cAAC,IAAD,CAAOM,OAAK,EAACD,KAAK,GAAGriB,UAAWG,WCnB1C,IAYeoiB,GAZS,SAACC,GACnBA,GAAeA,aAAuBC,UACxC,8BAAqBpqB,MAAK,YAAkD,IAA/CqqB,EAA8C,EAA9CA,OAAQC,EAAsC,EAAtCA,OAAQC,EAA8B,EAA9BA,OAAQC,EAAsB,EAAtBA,OAAQC,EAAc,EAAdA,QAC3DJ,EAAOF,GACPG,EAAOH,GACPI,EAAOJ,GACPK,EAAOL,GACPM,EAAQN,O,OCFdO,IAASC,OAAO,cAACd,GAAD,IAASe,SAASC,eAAe,SAKjDX,O","file":"static/js/main.303a61b2.chunk.js","sourcesContent":["export enum StorageType {\n Local,\n Session,\n LocalAndSession,\n}\n\nexport function save(\n name: string,\n data: object | string,\n whereTo: StorageType\n) {\n if (!data) {\n return false;\n }\n\n const json = JSON.stringify(data);\n\n if (whereTo === StorageType.Local || whereTo === StorageType.LocalAndSession)\n localStorage.setItem(name, json);\n if (\n whereTo === StorageType.Session ||\n whereTo === StorageType.LocalAndSession\n )\n sessionStorage.setItem(name, json);\n\n return true;\n}\n\nexport function read(\n name: string,\n whereFrom: StorageType\n) {\n let content: string | null = null;\n\n if (whereFrom === StorageType.Local) content = localStorage.getItem(name);\n if (whereFrom === StorageType.Session) content = sessionStorage.getItem(name);\n if (whereFrom === StorageType.LocalAndSession)\n content = sessionStorage.getItem(name) ?? localStorage.getItem(name);\n\n if (!content) {\n return null;\n }\n\n const data = JSON.parse(content);\n return data ? (data as T) : null;\n}\n\nexport function clear(name: string, storageType: StorageType) {\n if (\n storageType === StorageType.Local ||\n storageType === StorageType.LocalAndSession\n )\n localStorage.removeItem(name);\n if (\n storageType === StorageType.Session ||\n storageType === StorageType.LocalAndSession\n )\n sessionStorage.removeItem(name);\n\n return true;\n}\n","export enum StatusCode {\n BrsUnauthorized = 1,\n GoogleUnauthorized,\n}\n\nexport default class CustomError {\n readonly message: string;\n readonly statusCode: StatusCode;\n\n constructor(statusCode: StatusCode, message: string = \"\") {\n this.statusCode = statusCode;\n this.message = message;\n }\n}\n","export const SID_GAINING_INSTRUCTION_URL =\n \"https://docs.google.com/document/d/1btXePo-5bE8RyX7RFXnBuS-UN9SmwUithpc_UXhAWsg/edit\";\n\nexport const TABLE_URL_PATTERN =\n \"https://docs.google.com/spreadsheets/d/1Owzl3JfmFASIdC7ZMMw-0kkA3pwFSab1QdVO5dhZoxY/edit#gid=675912523\";\n\nexport const TABLE_TEMPLATE_URL =\n \"https://docs.google.com/spreadsheets/d/sjwa1/edit#gid=0\";\n\nexport const BRS_URL = \"https://brs.urfu.ru/mrd\";\n\nexport const CORS_PROXY = \"https://bbamc5stve2edro7t455.containers.yandexcloud.net\";\n","import {BRS_URL, CORS_PROXY} from \"../Constants\";\n\nexport default class BrsUrlProvider {\n private readonly withProxy: boolean;\n\n constructor(withProxy: boolean) {\n this.withProxy = withProxy;\n }\n\n get baseUrl() {\n return this.withProxy ? `${CORS_PROXY}/${BRS_URL}` : BRS_URL;\n }\n}\n","import request from \"request-promise\";\nimport BrsUrlProvider from \"./BrsUrlProvider\";\nimport * as cache from \"../helpers/cache\";\nimport { StorageType } from \"../helpers/cache\";\nimport CustomError, { StatusCode } from \"../helpers/CustomError\";\n\nexport enum LoginStatus {\n Succeed,\n InvalidCredentials,\n Error,\n}\n\nexport default class BrsAuth {\n readonly brsUrlProvider: BrsUrlProvider;\n\n constructor(brsUrlProvider: BrsUrlProvider) {\n this.brsUrlProvider = brsUrlProvider;\n }\n\n private _sid: string | null = null;\n\n get sid() {\n if (!this._sid)\n throw new CustomError(\n StatusCode.BrsUnauthorized,\n \"Нет авторизации в БРС\"\n );\n return this._sid;\n }\n\n private _safeUserName: string | null = null;\n\n get safeUserName() {\n if (!this._safeUserName)\n throw new CustomError(\n StatusCode.BrsUnauthorized,\n \"Нет авторизации в БРС\"\n );\n return this._safeUserName;\n }\n\n private _userName?: string = \"Anonymous\";\n\n get userName() {\n return this._userName;\n }\n\n checkAuth() {\n return !!(this._sid && this._safeUserName);\n }\n\n async tryRestoreAsync() {\n if (!!(this._sid && this._safeUserName)) return;\n\n let loginInfo = cache.read(\"loginInfo\", StorageType.Session);\n if (loginInfo) {\n this.saveLoginInfo(loginInfo.sid, loginInfo.userName);\n return;\n }\n\n loginInfo = cache.read(\"loginInfo\", StorageType.Local);\n if (!loginInfo) return;\n\n const sidCheckResult = await this.checkSidAsync(loginInfo.sid);\n if (sidCheckResult?.success)\n this.saveLoginInfo(loginInfo.sid, loginInfo.userName);\n }\n\n private async checkSidAsync(sid: string): Promise {\n try {\n const response: string = await request({\n method: \"GET\",\n url: this.brsUrlProvider.baseUrl + \"/mvc/mobile\",\n headers: {\n \"X-Cookie\": `JSESSIONID=${sid}`,\n \"X-Requested-With\": \"XMLHttpRequest\",\n },\n });\n\n const userName = response.match(/username\">([А-ЯЁа-яё -]+));\n if (userName) return { success: true, userName: userName[1] };\n return { success: false, userName: \"Anonymous\" };\n } catch (e) {\n return null;\n }\n }\n\n async loginAsync(login: string, password: string): Promise {\n const response = await this.requestSidAsync(login, password);\n\n if (!response || !(\"x-set-cookie\" in response.headers)) {\n return LoginStatus.Error;\n }\n\n const cookie = response.headers[\"x-set-cookie\"] as string;\n const result = cookie.match(/(?<=JSESSIONID=)\\w+/);\n\n if (!result) return LoginStatus.Error;\n\n const sid = result[0];\n\n const checkResult = await this.checkSidAsync(sid);\n if (checkResult === null) return LoginStatus.Error;\n if (!checkResult.success) return LoginStatus.InvalidCredentials;\n\n this.saveLoginInfo(sid, checkResult.userName);\n\n return LoginStatus.Succeed;\n }\n\n async authBySidAsync(sid: string): Promise {\n if (!sid) return LoginStatus.InvalidCredentials;\n\n const checkResult = await this.checkSidAsync(sid);\n if (checkResult === null) return LoginStatus.Error;\n if (!checkResult.success) return LoginStatus.InvalidCredentials;\n\n this.saveLoginInfo(sid, checkResult.userName);\n\n return LoginStatus.Succeed;\n }\n\n private saveLoginInfo(sid: string, userName: string) {\n const safeUserName = userName.replaceAll(/[^A-Za-zА-ЯЁа-яё]/g, \"_\");\n\n cache.save(\n \"loginInfo\",\n { sid, safeUserName, userName },\n StorageType.LocalAndSession\n );\n\n this._sid = sid;\n this._safeUserName = safeUserName;\n this._userName = userName;\n }\n\n logout() {\n this._sid = null;\n this._safeUserName = null;\n cache.clear(\"loginInfo\", StorageType.LocalAndSession);\n }\n\n private async requestSidAsync(login: string, password: string) {\n return await request({\n url: this.brsUrlProvider.baseUrl + `/login`,\n method: \"POST\",\n body: `username=${login}&password=${password}`,\n resolveWithFullResponse: true,\n simple: false,\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded; charset=UTF-8\",\n },\n }).then(\n (x) => x,\n () => null\n );\n }\n}\n\ninterface LoginInfo {\n sid: string;\n safeUserName: string;\n userName: string;\n}\n\ninterface SidCheckResult {\n success: boolean;\n userName: string;\n}\n","const CLIENT_ID =\n \"122993083593-pacve8csj86voko30ia65raeg0ncrtuv.apps.googleusercontent.com\";\nconst DISCOVERY_DOCS = [\n \"https://sheets.googleapis.com/$discovery/rest?version=v4\",\n];\nconst SCOPES = \"profile email https://www.googleapis.com/auth/spreadsheets\";\n\nexport default class GoogleAuth {\n async ensureInitializedAsync() {\n if (gapi.client) return;\n\n await new Promise((resolve) => {\n gapi.load(\"client:auth2\", resolve);\n });\n\n // NOTE: выполнение init не надо ждать\n gapi.client\n .init({\n clientId: CLIENT_ID,\n discoveryDocs: DISCOVERY_DOCS,\n scope: SCOPES,\n })\n .catch(console.error);\n }\n\n listenAuthorized(handler: (authorized: boolean) => void) {\n gapi.auth2?.getAuthInstance()?.isSignedIn?.listen(handler);\n }\n\n checkAuthorized() {\n return gapi.auth2?.getAuthInstance()?.isSignedIn?.get();\n }\n\n getUserName(): string | undefined {\n const basicProfile = gapi.auth2\n ?.getAuthInstance()\n ?.currentUser?.get()\n ?.getBasicProfile();\n return basicProfile?.getName() || basicProfile?.getEmail();\n }\n\n async logout() {\n await gapi.auth2?.getAuthInstance()?.signOut();\n }\n}\n","import { createContext } from \"react\";\nimport BrsAuth from \"./apis/BrsAuth\";\nimport BrsApi from \"./apis/BrsApi\";\nimport GoogleAuth from \"./apis/GoogleAuth\";\n\nconst Context =\n createContext<{\n brsAuth: BrsAuth;\n brsApi: BrsApi;\n googleAuth: GoogleAuth;\n } | null>(null);\n\nexport default Context;\n","import { Button, CircularProgress } from \"@material-ui/core\";\nimport React from \"react\";\nimport \"./styles.css\";\n\nexport default function SubmitWithLoading(props: Props) {\n const { title, loading, className, onClick, disabled = false } = props;\n\n return (\n \n \n {loading && (\n \n )}\n
\n );\n}\n\ninterface Props {\n title: string;\n loading: boolean;\n className?: string;\n onClick?: () => void;\n disabled?: boolean;\n}\n","import { Button, CircularProgress, TextField } from \"@material-ui/core\";\nimport SubmitWithLoading from \"../../shared/SubmitWithLoading\";\nimport React, { FormEvent } from \"react\";\nimport \"./styles.css\";\nimport { SID_GAINING_INSTRUCTION_URL } from \"../../../Constants\";\n\nexport default function BrsLoginForm({\n onSubmit,\n submitting,\n loading,\n signedIn,\n onLogout,\n userName,\n}: Props) {\n const [login, setLogin] = React.useState(\"\");\n const [password, setPassword] = React.useState(\"\");\n const [sid, setSid] = React.useState(\"\");\n\n function handleUserNameChanged(e: React.ChangeEvent) {\n const value = e.target.value;\n setLogin(value);\n setSid(\"\");\n }\n\n function handlePasswordChanged(e: React.ChangeEvent) {\n const value = e.target.value;\n setPassword(value);\n setSid(\"\");\n }\n\n function handleSidChanged(e: React.ChangeEvent) {\n const value = e.target.value;\n setSid(value);\n setLogin(\"\");\n setPassword(\"\");\n }\n\n function handleSubmit(e: FormEvent) {\n e.preventDefault();\n\n if (loading) return;\n\n onSubmit({ login: login, password, sid });\n }\n\n return signedIn ? (\n \n Добро пожаловать, {userName}
\n \n \n ) : (\n \n
\n Войдите в БРС, чтобы сервис мог получить информацию о ваших\n курсах и выставлять оценки от вашего имени\n
\n
Это можно сделать через учетную запись БРС
\n
\n {loading && (\n
\n )}\n
\n );\n}\n\ninterface Props {\n submitting: boolean;\n loading: boolean;\n onSubmit: (credentials: Credentials) => void;\n onLogout: () => void;\n signedIn: boolean;\n userName?: string;\n}\n\nexport interface Credentials {\n login: string;\n password: string;\n sid: string;\n}\n","import GoogleLogin from \"react-google-login\";\nimport React from \"react\";\nimport { Button, Container } from \"@material-ui/core\";\n\nconst CLIENT_ID =\n \"122993083593-pacve8csj86voko30ia65raeg0ncrtuv.apps.googleusercontent.com\";\nconst SCOPES = \"profile email https://www.googleapis.com/auth/spreadsheets\";\n\nexport default function GoogleLoginButton(props: Props) {\n const { onSignedIn, onFailure, signedIn, userName, onLogout } = props;\n\n return (\n \n {signedIn ? (\n \n Добро пожаловать, {userName}
\n \n \n ) : (\n \n \n Войдите в Google, чтобы сервис мог загружать оценки студентов\n из ваших Google Таблиц\n
\n \n \n )}\n \n );\n}\n\ninterface Props {\n onSignedIn: () => void;\n onFailure: (error: any) => void;\n onLogout: () => void;\n signedIn: boolean;\n userName?: string;\n}\n","import React from \"react\";\nimport MuiAlert, { AlertProps } from \"@material-ui/lab/Alert\";\nimport { Snackbar } from \"@material-ui/core\";\n\nexport default function CustomAlert(props: Props) {\n const { open, message, type, onClose } = props;\n\n return (\n \n \n \n {message}\n \n \n \n );\n}\n\nfunction Alert(props: AlertProps) {\n return ;\n}\n\ninterface Props {\n open: boolean;\n message: string;\n type: \"error\" | \"success\";\n onClose: () => void;\n}\n","import React from \"react\";\nimport \"./styles.css\";\nimport { Redirect } from \"react-router-dom\";\nimport { Button, Container } from \"@material-ui/core\";\nimport BrsAuth, { LoginStatus } from \"../../../apis/BrsAuth\";\nimport BrsLoginForm, { Credentials } from \"../BrsLoginForm\";\nimport GoogleAuth from \"../../../apis/GoogleAuth\";\nimport GoogleLoginButton from \"../GoogleLoginButton\";\nimport CustomAlert from \"../../shared/CustomAlert\";\nimport { TABLE_URL_PATTERN } from \"../../../Constants\";\n\nexport default class LoginPage extends React.Component {\n constructor(props: Props) {\n super(props);\n\n this.state = {\n brsLoading: true,\n brsAuthorized: false,\n googleAuthorized: false,\n redirect: false,\n submitLoading: false,\n openAlert: false,\n alertMessage: \"\",\n alertType: \"error\",\n };\n }\n\n async componentDidMount() {\n await this.props.googleAuth.ensureInitializedAsync();\n await this.props.brsAuth.tryRestoreAsync();\n\n this.props.googleAuth.listenAuthorized((authorized) => {\n this.setState({ googleAuthorized: authorized });\n });\n\n const brsAuthorized = this.props.brsAuth.checkAuth();\n const googleAuthorized = this.props.googleAuth.checkAuthorized();\n this.setState({ brsLoading: false, brsAuthorized, googleAuthorized });\n }\n\n handleBrsSubmit = async (credentials: Credentials) => {\n this.setState({ submitLoading: true });\n\n const loginStatus = await this.loginBrsAsync(credentials);\n\n this.setState({ submitLoading: false });\n\n switch (loginStatus) {\n case LoginStatus.Succeed:\n this.setState({\n alertMessage: \"Авторизация прошла успешно\",\n openAlert: true,\n alertType: \"success\",\n brsAuthorized: true,\n });\n break;\n case LoginStatus.Error:\n this.setState({\n alertMessage: \"Что-то пошло не так :( Попробуйте позже\",\n openAlert: true,\n alertType: \"error\",\n });\n break;\n case LoginStatus.InvalidCredentials:\n this.setState({\n alertMessage: \"Неверные логин, пароль или JSESSIONID\",\n openAlert: true,\n alertType: \"error\",\n });\n }\n };\n\n loginBrsAsync = async (credentials: Credentials): Promise => {\n if (credentials.sid) {\n return await this.props.brsAuth.authBySidAsync(credentials.sid);\n }\n if (credentials.login && credentials.password) {\n return await this.props.brsAuth.loginAsync(\n credentials.login,\n credentials.password\n );\n }\n return LoginStatus.InvalidCredentials;\n };\n\n handleCloseAlert = () => {\n this.setState({ openAlert: false });\n };\n\n handleGoogleSignedIn = () => {\n this.setState({ googleAuthorized: true });\n };\n\n handleGoogleLoginFailed = (error: any) => {\n console.error(error);\n\n this.setState({\n openAlert: true,\n alertType: \"error\",\n alertMessage: \"Не удалось подключить Ваш Google аккаунт :(\",\n });\n };\n\n startWork = () => {\n this.setState({ redirect: true });\n };\n\n handleBrsLogout = () => {\n this.props.brsAuth.logout();\n this.setState({\n brsAuthorized: false,\n alertMessage: \"Вы вышли из аккаунта БРС\",\n alertType: \"success\",\n openAlert: true,\n });\n };\n\n handleGoogleLogout = async () => {\n await this.props.googleAuth.logout();\n this.setState({\n googleAuthorized: false,\n alertType: \"success\",\n alertMessage: \"Вы вышли из аккаунта Google\",\n openAlert: true,\n });\n };\n\n renderGreeting = () => {\n return (\n \n
Добро пожаловать в Расширения БРС
\n
Как все работает
\n
\n - \n В Google Таблицах вы заполняете оценки за курс по некоторому{\" \"}\n \n шаблону\n \n
\n - \n После этого импортируете Google Таблицу в сервис и выполняете\n пробный запуск выставления оценок, чтобы исключить ошибки\n
\n - Наконец делаете запуск с реальным выставлением оценок
\n
\n
Правила хранения данных
\n
\n Ваш логин и пароль передаются в БРС и нигде не сохраняются\n
\n Данные о доступных вам курсах сохраняются только в вашем браузере\n
\n
\n
\n );\n };\n\n renderBrsLogin = () => {\n return (\n \n );\n };\n\n renderGoogleLogin = () => {\n return (\n \n );\n };\n\n renderStartWorkButton = () => {\n return (\n \n );\n };\n\n render() {\n return (\n \n {this.state.redirect && }\n \n {this.renderGreeting()}\n \n {this.renderBrsLogin()}\n
\n {this.renderGoogleLogin()}\n \n \n {this.renderStartWorkButton()}\n \n \n \n
\n );\n }\n}\n\ninterface State {\n brsLoading: boolean;\n brsAuthorized: boolean;\n googleAuthorized: boolean;\n submitLoading: boolean;\n redirect: boolean;\n openAlert: boolean;\n alertMessage: string;\n alertType: \"error\" | \"success\";\n}\n\ninterface Props {\n brsAuth: BrsAuth;\n googleAuth: GoogleAuth;\n}\n","import React from \"react\";\nimport Context from \"../../Context\";\nimport LoginPage from \"./LoginPage\";\n\nexport default function LoginPageContainer() {\n return (\n \n {(context) =>\n context && (\n \n )\n }\n \n );\n}\n","import \"bluebird\";\nimport request from \"request-promise\";\nimport * as cache from \"../helpers/cache\";\nimport { StorageType } from \"../helpers/cache\";\nimport BrsAuth from \"./BrsAuth\";\nimport BrsUrlProvider from \"./BrsUrlProvider\";\nimport CustomError, { StatusCode } from \"../helpers/CustomError\";\n\nexport enum StudentFailure {\n /** -, дефис, все хорошо */ NoFailure = -1,\n /** Не выбрана */ NotChosen = -19,\n /** Не допущен (деканат) */ NotAllowedByDeansOffice = -18,\n /** Не явился */ NotAppeared = 0,\n /** Неуважительная */ DisrespectfulReason = 12,\n /** Уважительная */ RespectfulReason = 13,\n /** Не допущен */ NotAllowedByTeacher = 18,\n /** Не должен сдавать */ ShouldNotPass = 19,\n /** Академический отпуск */ AcademicLeave = 20,\n /** Выбыл */ DroppedOut = 21,\n}\n\nexport enum TermType {\n Fall = 1,\n Spring = 2,\n}\n\nexport default class BrsApi {\n readonly brsAuth: BrsAuth;\n private readonly brsUrlProvider: BrsUrlProvider;\n\n constructor(brsAuth: BrsAuth, brsUrlProvider: BrsUrlProvider) {\n this.brsAuth = brsAuth;\n this.brsUrlProvider = brsUrlProvider;\n }\n\n async getDisciplineCachedAsync(\n year: number,\n termType: TermType,\n course: number,\n isModule: boolean\n ) {\n const cacheName = this.getDisciplineCacheName(\n year,\n termType,\n course,\n isModule\n );\n const cacheResult = cache.read(\n cacheName,\n StorageType.Session\n );\n if (cacheResult) {\n return cacheResult;\n }\n\n const total = await this.getDisciplineTotalAsync(\n year,\n termType,\n course,\n isModule\n );\n\n const result = await this.getDisciplineInternalAsync(\n year,\n termType,\n course,\n isModule,\n 1,\n Math.max(1000, total), // quick fix because total from BRS is not correct\n total\n );\n\n cache.save(cacheName, result.disciplines, StorageType.Session);\n return result.disciplines;\n }\n\n async getDisciplineInternalAsync(\n year: number,\n termType: TermType,\n course: number,\n isModule: boolean,\n page: number,\n pageSize: number,\n total: number\n ) {\n const queryString = `?year=${year}&termType=${termType}&course=${course}&total=${total}&page=${page}&pageSize=${pageSize}&search=`;\n if (isModule) {\n const paging = await this.requestApiJsonAsync>(\n \"/mvc/mobile/module/fetch\" + queryString\n );\n const disciplines = paging.content;\n for (const d of disciplines) {\n d.isModule = true;\n }\n return {disciplines, numberOfElements: paging.numberOfElements};\n } else {\n const paging = await this.requestApiJsonAsync>(\n \"/mvc/mobile/discipline/fetch\" + queryString\n );\n const disciplines = paging.content;\n for (const d of disciplines) {\n d.isModule = false;\n }\n return {disciplines, numberOfElements: paging.numberOfElements};\n }\n }\n\n async clearDisciplineCacheAsync(\n year: number,\n termType: TermType,\n course: number,\n isModule: boolean\n ) {\n const cacheName = this.getDisciplineCacheName(\n year,\n termType,\n course,\n isModule\n );\n cache.clear(cacheName, StorageType.Session);\n }\n\n async getDisciplineTotalAsync(\n year: number,\n termType: TermType,\n course: number,\n isModule: boolean\n ) {\n const moduleParameter = isModule ? \"&its=true\" : \"\";\n const queryString =\n `?year=${year}&termType=${termType}&course=${course}` + moduleParameter;\n const total = await this.requestApiJsonAsync(\n \"/mvc/mobile/discipline/amount\" + queryString\n );\n return total;\n }\n\n async getAllStudentMarksAsync(discipline: Discipline) {\n const students = [\n ...(await this.getStudentMarksAsync(discipline, \"lecture\", \"current\")),\n ...(await this.getStudentMarksAsync(\n discipline,\n \"lecture\",\n \"intermediate\"\n )),\n ...(await this.getStudentMarksAsync(discipline, \"laboratory\", \"current\")),\n ...(await this.getStudentMarksAsync(\n discipline,\n \"laboratory\",\n \"intermediate\"\n )),\n ...(await this.getStudentMarksAsync(discipline, \"practice\", \"current\")),\n ...(await this.getStudentMarksAsync(\n discipline,\n \"practice\",\n \"intermediate\"\n )),\n ...(await this.getStudentMarksAsync(\n discipline,\n \"additionalPractice\",\n \"current\"\n )),\n ...(await this.getStudentMarksAsync(\n discipline,\n \"additionalPractice\",\n \"intermediate\"\n )),\n ];\n\n const uniqueStudents: { [id: string]: StudentMark } = {};\n for (const s of students) {\n const knownStudent = uniqueStudents[s.studentUuid] || {};\n uniqueStudents[s.studentUuid] = { ...knownStudent, ...s };\n }\n\n return Object.keys(uniqueStudents).map((k) => uniqueStudents[k]);\n }\n\n async getStudentMarksAsync(\n discipline: Discipline,\n cardType: CardType,\n markType: MarkType\n ) {\n return this.getStudentMarksInternalAsync(\n discipline.disciplineLoad,\n discipline.isModule,\n discipline.groupHistoryId,\n discipline.groupId,\n cardType,\n markType\n );\n }\n\n async getStudentMarksInternalAsync(\n disciplineLoad: string,\n isModule: boolean,\n groupUuid: string,\n techgroup: string,\n cardType: CardType,\n markType: MarkType,\n isTotal: boolean = false,\n showActiveStudents: boolean = false\n ) {\n const groupPart = isModule\n ? `techgroup=${techgroup}`\n : `groupUuid=${groupUuid}`;\n return this.requestApiJsonAsync(\n `/mvc/mobile/studentMarks/fetch?disciplineLoad=${disciplineLoad}&${groupPart}` +\n `&cardType=${cardType}&hasTest=false&isTotal=${isTotal}` +\n `&intermediate=${markType === \"intermediate\"}` +\n `&selectedTeachers=null&showActiveStudents=${showActiveStudents}`\n );\n }\n\n async getDisciplineMetaAsync(\n discipline: Discipline\n ): Promise {\n const disciplineMeta: DisciplineMeta = {\n lecture: null,\n laboratory: null,\n practice: null,\n additionalPractice: null,\n };\n\n await this.fillCardMetaAsync(disciplineMeta, discipline, \"lecture\");\n await this.fillCardMetaAsync(disciplineMeta, discipline, \"laboratory\");\n await this.fillCardMetaAsync(disciplineMeta, discipline, \"practice\");\n await this.fillCardMetaAsync(\n disciplineMeta,\n discipline,\n \"additionalPractice\"\n );\n\n return disciplineMeta;\n }\n\n async fillCardMetaAsync(\n disciplineMeta: DisciplineMeta,\n discipline: Discipline,\n cardType: CardType\n ) {\n const currentColumns = await this.getControlActionColumnsCachedAsync(\n discipline,\n cardType,\n \"current\"\n );\n const intermediateColumns = await this.getControlActionColumnsCachedAsync(\n discipline,\n cardType,\n \"intermediate\"\n );\n if (currentColumns.length + intermediateColumns.length === 0) {\n return;\n }\n\n const cardMeta = {\n currentControlActions: this.extractControlActions(currentColumns),\n currentFactor: 0,\n intermediateControlActions:\n this.extractControlActions(intermediateColumns),\n intermediateFactor: 0,\n totalFactor: 0,\n };\n this.fillFactors(cardMeta, currentColumns);\n this.fillFactors(cardMeta, intermediateColumns);\n disciplineMeta[cardType] = cardMeta;\n\n const totalColumns = await this.getControlActionColumnsCachedAsync(\n discipline,\n cardType,\n \"total\"\n );\n this.fillTotalFactors(disciplineMeta, totalColumns);\n }\n\n async getControlActionColumnsCachedAsync(\n discipline: Discipline,\n cardType: CardType,\n markType: MarkType\n ) {\n const cacheName =\n `${this.brsAuth.safeUserName}_getControlActionColumns_${discipline.disciplineLoad}` +\n `_${discipline.isModule}_${discipline.groupHistoryId}_${discipline.groupId}_${cardType}_${markType}`;\n const cacheResult = cache.read(\n cacheName,\n StorageType.Session\n );\n if (cacheResult) {\n return cacheResult;\n }\n\n const result = await this.getControlActionColumnsInternalAsync(\n discipline.disciplineLoad,\n discipline.isModule,\n discipline.groupHistoryId,\n discipline.groupId,\n cardType,\n markType\n );\n cache.save(cacheName, result, StorageType.Session);\n return result;\n }\n\n async getControlActionColumnsInternalAsync(\n disciplineLoad: string,\n isModule: boolean,\n groupUuid: string,\n techgroup: string,\n cardType: CardType,\n markType: MarkType\n ) {\n const modulePart = isModule ? \"/module\" : \"\";\n const groupPart = isModule ? techgroup : groupUuid;\n const response = await this.requestApiAsync(\n `/mvc/mobile/view/mark/${disciplineLoad}/${groupPart}/teachers${modulePart}/${cardType}/${markType}`\n );\n\n const prefix = \"gridColumns = toTextArray(\";\n const suffix = \");\";\n const linesWithId = response\n .split(\"\\r\\n\")\n .map((s) => s.trim())\n .filter((s) => s.startsWith(prefix));\n if (linesWithId.length !== 1) {\n throw new Error(\n \"Не удалось разобрать страницу БРС со списком контрольных мероприятий. Ожидается, что эта страница содержит единственную строчку с идентификатором техкарты.\"\n );\n }\n\n const columns: Array =\n JSON.parse(\n linesWithId[0].substr(\n prefix.length,\n linesWithId[0].length - prefix.length - suffix.length\n )\n ) || [];\n\n return columns;\n }\n\n extractControlActions(columns: ControlActionColumn[]) {\n const uuidPrefix = \"technologyCard\";\n const result = columns\n .filter((c) => c.uuid && c.uuid.startsWith(uuidPrefix))\n .map((c) => ({\n uuid: c.uuid,\n uuidWithoutPrefix: c.uuid.substr(uuidPrefix.length),\n maxValue: c.maxValue,\n isIntermediate: c.intermediate > 0,\n controlAction: c.controlAction,\n }));\n\n return result as ControlAction[];\n }\n\n fillFactors(cardMeta: CardMeta, columns: ControlActionColumn[]) {\n for (const column of columns) {\n switch (column.uuid) {\n case \"currentWithFactor\":\n cardMeta.currentFactor =\n typeof column.value === \"string\"\n ? parseFloat(column.value)\n : column.value;\n break;\n case \"intermediateWithFactor\":\n cardMeta.intermediateFactor =\n typeof column.value === \"string\"\n ? parseFloat(column.value)\n : column.value;\n break;\n default:\n break;\n }\n }\n }\n\n fillTotalFactors(\n disciplineMeta: DisciplineMeta,\n columns: ControlActionColumn[]\n ) {\n for (const column of columns) {\n switch (column.uuid) {\n case \"lecture\":\n case \"laboratory\":\n case \"practice\":\n case \"additionalPractice\":\n const uuid: CardType = column.uuid;\n const cardMeta = disciplineMeta[uuid];\n if (cardMeta !== null) {\n cardMeta.totalFactor =\n typeof column.value === \"string\"\n ? parseFloat(column.value)\n : column.value;\n }\n break;\n default:\n break;\n }\n }\n }\n\n async putStudentMarkAsync(\n studentUuid: string,\n controlActionId: string,\n mark: number,\n groupId: string,\n cardTypeKey: CardType,\n disciplineLoadUuid: string\n ) {\n const body = `student=${studentUuid}&techcard=${controlActionId}&mark=${\n isNaN(mark) ? \"\" : mark.toString()\n }&groupId=${groupId}&cardTypeKey=${cardTypeKey}&disciplineLoadUuid=${disciplineLoadUuid}`;\n return this.requestApiJsonAsync(\n `/mvc/mobile/studentMarks/put`,\n {\n method: \"POST\",\n body,\n json: false,\n },\n {\n \"Content-Type\": \"application/x-www-form-urlencoded; charset=UTF-8\",\n }\n );\n }\n\n async putStudentFailureAsync(\n studentUuid: string,\n discipline: Discipline,\n studentFailure: StudentFailure = StudentFailure.NoFailure,\n cardType: CardType = \"lecture\"\n ) {\n const body = `markFailure=${studentFailure}&cardType=${cardType}&disciplineLoad=${discipline.disciplineLoad}&studentId=${studentUuid}`;\n await this.requestApiAsync(\n `/mvc/mobile/failure/update`,\n {\n method: \"POST\",\n body,\n json: false,\n },\n {\n \"Content-Type\": \"application/x-www-form-urlencoded; charset=UTF-8\",\n }\n );\n }\n\n async updateAllMarksAsync(discipline: Discipline) {\n await this.updateMarksAsync(discipline, \"lecture\", \"intermediate\");\n await this.updateMarksAsync(discipline, \"lecture\", \"current\");\n await this.updateMarksAsync(discipline, \"lecture\", \"intermediate\");\n await this.updateMarksAsync(discipline, \"laboratory\", \"current\");\n await this.updateMarksAsync(discipline, \"laboratory\", \"intermediate\");\n await this.updateMarksAsync(discipline, \"practice\", \"current\");\n await this.updateMarksAsync(discipline, \"practice\", \"intermediate\");\n }\n\n async updateMarksAsync(\n discipline: Discipline,\n cardType: CardType,\n markType: MarkType\n ) {\n return this.updateMarksInternalAsync(\n discipline.disciplineLoad,\n discipline.isModule,\n discipline.groupHistoryId,\n discipline.groupId,\n cardType,\n markType\n );\n }\n\n async updateMarksInternalAsync(\n disciplineLoad: string,\n isModule: boolean,\n groupUuid: string,\n techgroup: string,\n cardType: CardType,\n markType: MarkType\n ) {\n const modulePart = isModule ? \"/module\" : \"\";\n const groupPart = isModule\n ? `techgroup=${techgroup}`\n : `groupUuid=${groupUuid}`;\n const body =\n `disciplineLoad=${disciplineLoad}&${groupPart}` +\n `&cardType=${cardType}&hasTest=false&isTotal=false` +\n `&intermediate=${markType === \"intermediate\"}` +\n `&selectedTeachers=null&showActiveStudents=true`;\n return this.requestApiAsync(\n `/mvc/mobile/updateMarks${modulePart}`,\n {\n method: \"POST\",\n body,\n json: false,\n },\n {\n \"Content-Type\": \"application/x-www-form-urlencoded; charset=UTF-8\",\n }\n );\n }\n\n getDisciplineCacheName(\n year: number,\n termType: TermType,\n course: number,\n isModule: boolean\n ) {\n return `${this.brsAuth.safeUserName}_getDiscipline_${year}_${termType}_${course}_${isModule}`;\n }\n\n async requestApiJsonAsync(\n uri: string,\n options?: RequestOptions,\n headers?: RequestHeaders\n ): Promise {\n const response = await this.requestApiAsync(uri, options, headers);\n\n return JSON.parse(response);\n }\n\n async requestApiAsync(\n uri: string,\n options?: RequestOptions,\n headers?: RequestHeaders\n ): Promise {\n const response = await request({\n method: \"GET\",\n ...options,\n url: this.brsUrlProvider.baseUrl + uri,\n headers: {\n \"X-Cookie\": `JSESSIONID=${this.brsAuth.sid}`,\n \"X-Requested-With\": \"XMLHttpRequest\",\n ...headers,\n },\n });\n\n if (response.trimLeft().startsWith(\"\")) {\n throw new CustomError(StatusCode.BrsUnauthorized, uri + \" is Forbidden\");\n }\n\n return response;\n }\n}\n\nexport type CardType =\n | \"lecture\"\n | \"laboratory\"\n | \"practice\"\n | \"additionalPractice\";\nexport type MarkType = \"current\" | \"intermediate\" | \"total\";\n\nexport interface Discipline {\n groupId: string;\n discipline: string;\n group: string;\n disciplineLoad: string;\n groupHistoryId: string;\n isModule: boolean;\n teacherName?: string;\n}\n\n// eslint-disable-next-line\nconst studentMarkSample: StudentMark = {\n studentPersonalNumber: \"09800106\",\n isEdit: false,\n studentUuid:\n \"studen18hc2jg0000magk6mi3iec84bsundigr18hc2jg0000m53o7mlgvora278\",\n status: 1,\n studentStatus: \"Активный\",\n ignoreCurrentDebars: false,\n studentFio: \"Анисимова Маргарита Васильевна\",\n isExtern: false,\n teacherName: \"\",\n cardType: \"lecture\",\n studentName: \"Анисимова М.В.\",\n studentGroup: \"РИ-180001\",\n registerClosed: false,\n subgroupsITS: \"\",\n disciplineLoad: \"unpldd18hc2jg0000m5kojcd3te76bnk\",\n};\n\nexport interface StudentMark {\n studentPersonalNumber: string;\n isEdit: boolean;\n studentUuid: string;\n status: number;\n studentStatus: string;\n ignoreCurrentDebars: boolean;\n studentFio: string;\n isExtern: boolean;\n teacherName: string;\n cardType: CardType;\n studentName: string;\n studentGroup: string;\n registerClosed: boolean;\n subgroupsITS: string;\n disciplineLoad: string;\n failure?: StudentFailure;\n failureName?: string;\n\n [props: string]: number | string | boolean | undefined;\n}\n\nexport interface DisciplineMeta {\n lecture: CardMeta | null;\n laboratory: CardMeta | null;\n practice: CardMeta | null;\n additionalPractice: CardMeta | null;\n}\n\nexport interface CardMeta {\n currentFactor: number;\n currentControlActions: ControlAction[];\n intermediateFactor: number;\n intermediateControlActions: ControlAction[];\n totalFactor: number;\n}\n\nexport interface ControlAction {\n uuid: string;\n uuidWithoutPrefix: string;\n controlAction: string;\n maxValue: number;\n isIntermediate: boolean;\n}\n\ninterface ControlActionColumn {\n controlAction: string;\n uuid: string;\n maxValue: number;\n intermediate: number;\n value: number | string;\n}\n\ninterface RequestOptions {\n method?: string;\n body?: object | string;\n json?: boolean;\n}\n\ninterface RequestHeaders {\n \"Content-Type\"?: string;\n}\n\ninterface Paging {\n content: T[];\n last: boolean;\n totalPages: number;\n totalElements: number;\n size: number;\n number: number;\n sort: any;\n first: boolean;\n numberOfElements: number;\n}\n","export function getSpreadsheet(spreadsheetId: string): Spreadsheet {\n const sheets = gapi.client.sheets;\n\n async function readAsync(range: string) {\n const response = await sheets.spreadsheets.values.get({\n spreadsheetId,\n range,\n });\n return response.result;\n }\n\n async function getMetaAsync() {\n const response = await sheets.spreadsheets.get({ spreadsheetId });\n const meta = JSON.parse(response.body) as SpreadsheetMeta;\n return meta;\n }\n\n return {\n readAsync,\n getMetaAsync\n };\n}\n\nexport interface Spreadsheet {\n readAsync: (range: string) => Promise;\n getMetaAsync: () => Promise\n}\n\nexport interface ValueRange {\n majorDimension?: string | null;\n range?: string | null;\n values?: any[][] | null;\n}\n\nexport interface SpreadsheetMeta {\n spreadsheetId: string;\n properties: SpreadsheetProperties;\n sheets: Sheet[];\n}\n\nexport interface SpreadsheetProperties {\n title: string;\n}\n\nexport interface Sheet {\n properties: SheetProperties;\n}\n\nexport interface SheetProperties {\n sheetId: number;\n title: string;\n}\n","export function fixSpaces(str: string) {\n return str && str.replace(/[\\s]/g, \" \");\n}\n\nexport function normalizeString(str: string) {\n return (\n str &&\n str\n .toLowerCase()\n .replace(\"ё\", \"е\")\n .replace(/[^A-Za-zА-ЯЁа-яё0-9]/g, \"\")\n );\n}\n\nexport function compareNormalized(s1: string, s2: string) {\n return normalizeString(s1) === normalizeString(s2);\n}\n\nexport function parseAnyFloat(s: string) {\n return parseFloat(s && s.replace(\",\", \".\"));\n}\n\nexport function groupBy(items: TItem[], key: keyof TItem) {\n const reducer: { [group: string]: TItem[] } = {};\n return items.reduce((reducer, item) => {\n const itemKey = `${item[key]}`;\n (reducer[itemKey] = reducer[itemKey] || []).push(item);\n return reducer;\n }, reducer);\n}\n\nexport function getKeys(obj: T): (keyof T)[] {\n const keys = Object.keys(obj) as (keyof T)[];\n return keys;\n}\n\nexport function filterNull(items: (T | null)[]): T[] {\n const result: T[] = [];\n for (const item of items) {\n if (item !== null) {\n result.push(item);\n }\n }\n return result;\n}\n\nexport function pluralize(\n count: number,\n version1: string,\n version2: string,\n version5: string\n) {\n if (\n count % 10 === 0 ||\n count % 10 >= 5 ||\n (count % 100 > 10 && count % 100 < 20)\n )\n return version5;\n return count % 10 === 1 ? version1 : version2;\n}\n\nexport function round10(value: number) {\n return Math.round(value * 10) / 10;\n}\n\nexport function round100(value: number) {\n return Math.round(value * 100) / 100;\n}\n","import { StudentFailure } from \"../apis/BrsApi\";\nimport { compareNormalized } from \"./tools\";\n\nconst failureMapping: { [key: string]: StudentFailure } = {\n \"-\": StudentFailure.NoFailure,\n \"Не выбрана\": StudentFailure.NotChosen,\n \"Не допущен (деканат)\": StudentFailure.NotAllowedByDeansOffice,\n \"Не явился\": StudentFailure.NotAppeared,\n Неуважительная: StudentFailure.DisrespectfulReason,\n Уважительная: StudentFailure.RespectfulReason,\n \"Не допущен\": StudentFailure.NotAllowedByTeacher,\n \"Не должен сдавать\": StudentFailure.ShouldNotPass,\n \"Академический отпуск\": StudentFailure.AcademicLeave,\n Выбыл: StudentFailure.DroppedOut,\n};\n\nexport function parseStudentFailure(input: string): StudentFailure | null {\n if (input === null || input === undefined) {\n return null;\n }\n\n for (let key of Object.keys(failureMapping)) {\n if (compareNormalized(key, input)) {\n return failureMapping[key];\n }\n }\n\n return StudentFailure.NoFailure;\n}\n\nexport function formatStudentFailure(\n input: StudentFailure | null | undefined\n): string | null {\n if (input === null || input === undefined) {\n return null;\n }\n\n for (let key of Object.keys(failureMapping)) {\n if (failureMapping[key] === input) {\n return key;\n }\n }\n\n return \"-\";\n}\n","export const emojiRegex =\n /[#*0-9]\\uFE0F?\\u20E3|[\\xA9\\xAE\\u203C\\u2049\\u2122\\u2139\\u2194-\\u2199\\u21A9\\u21AA\\u231A\\u231B\\u2328\\u23CF\\u23ED-\\u23EF\\u23F1\\u23F2\\u23F8-\\u23FA\\u24C2\\u25AA\\u25AB\\u25B6\\u25C0\\u25FB\\u25FC\\u25FE\\u2600-\\u2604\\u260E\\u2611\\u2614\\u2615\\u2618\\u2620\\u2622\\u2623\\u2626\\u262A\\u262E\\u262F\\u2638-\\u263A\\u2640\\u2642\\u2648-\\u2653\\u265F\\u2660\\u2663\\u2665\\u2666\\u2668\\u267B\\u267E\\u267F\\u2692\\u2694-\\u2697\\u2699\\u269B\\u269C\\u26A0\\u26A7\\u26AA\\u26B0\\u26B1\\u26BD\\u26BE\\u26C4\\u26C8\\u26CF\\u26D1\\u26E9\\u26F0-\\u26F5\\u26F7\\u26F8\\u26FA\\u2702\\u2708\\u2709\\u270F\\u2712\\u2714\\u2716\\u271D\\u2721\\u2733\\u2734\\u2744\\u2747\\u2757\\u2763\\u27A1\\u2934\\u2935\\u2B05-\\u2B07\\u2B1B\\u2B1C\\u2B55\\u3030\\u303D\\u3297\\u3299]\\uFE0F?|[\\u261D\\u270C\\u270D](?:\\uFE0F|\\uD83C[\\uDFFB-\\uDFFF])?|[\\u270A\\u270B](?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\u23E9-\\u23EC\\u23F0\\u23F3\\u25FD\\u2693\\u26A1\\u26AB\\u26C5\\u26CE\\u26D4\\u26EA\\u26FD\\u2705\\u2728\\u274C\\u274E\\u2753-\\u2755\\u2795-\\u2797\\u27B0\\u27BF\\u2B50]|\\u26D3\\uFE0F?(?:\\u200D\\uD83D\\uDCA5)?|\\u26F9(?:\\uFE0F|\\uD83C[\\uDFFB-\\uDFFF])?(?:\\u200D[\\u2640\\u2642]\\uFE0F?)?|\\u2764\\uFE0F?(?:\\u200D(?:\\uD83D\\uDD25|\\uD83E\\uDE79))?|\\uD83C(?:[\\uDC04\\uDD70\\uDD71\\uDD7E\\uDD7F\\uDE02\\uDE37\\uDF21\\uDF24-\\uDF2C\\uDF36\\uDF7D\\uDF96\\uDF97\\uDF99-\\uDF9B\\uDF9E\\uDF9F\\uDFCD\\uDFCE\\uDFD4-\\uDFDF\\uDFF5\\uDFF7]\\uFE0F?|[\\uDF85\\uDFC2\\uDFC7](?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDFC4\\uDFCA](?:\\uD83C[\\uDFFB-\\uDFFF])?(?:\\u200D[\\u2640\\u2642]\\uFE0F?)?|[\\uDFCB\\uDFCC](?:\\uFE0F|\\uD83C[\\uDFFB-\\uDFFF])?(?:\\u200D[\\u2640\\u2642]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uDC44\\uDC45\\uDC51-\\uDC65\\uDC6A\\uDC79-\\uDC7B\\uDC7D-\\uDC80\\uDC84\\uDC88-\\uDC8E\\uDC90\\uDC92-\\uDCA9\\uDCAB-\\uDCFC\\uDCFF-\\uDD3D\\uDD4B-\\uDD4E\\uDD50-\\uDD67\\uDDA4\\uDDFB-\\uDE2D\\uDE2F-\\uDE34\\uDE37-\\uDE41\\uDE43\\uDE44\\uDE48-\\uDE4A\\uDE80-\\uDEA2\\uDEA4-\\uDEB3\\uDEB7-\\uDEBF\\uDEC1-\\uDEC5\\uDED0-\\uDED2\\uDED5-\\uDED7\\uDEDC-\\uDEDF\\uDEEB\\uDEEC\\uDEF4-\\uDEFC\\uDFE0-\\uDFEB\\uDFF0]|\\uDC08(?:\\u200D\\u2B1B)?|\\uDC15(?:\\u200D\\uD83E\\uDDBA)?|\\uDC26(?:\\u200D(?:\\u2B1B|\\uD83D\\uDD25))?|\\uDC3B(?:\\u200D\\u2744\\uFE0F?)?|\\uDC41\\uFE0F?(?:\\u200D\\uD83D\\uDDE8\\uFE0F?)?|\\uDC68(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D(?:[\\uDC68\\uDC69]\\u200D\\uD83D(?:\\uDC66(?:\\u200D\\uD83D\\uDC66)?|\\uDC67(?:\\u200D\\uD83D[\\uDC66\\uDC67])?)|[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uDC66(?:\\u200D\\uD83D\\uDC66)?|\\uDC67(?:\\u200D\\uD83D[\\uDC66\\uDC67])?)|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]))|\\uD83C(?:\\uDFFB(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]|\\uDD1D\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFC-\\uDFFF])))?|\\uDFFC(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]|\\uDD1D\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFB\\uDFFD-\\uDFFF])))?|\\uDFFD(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]|\\uDD1D\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFB\\uDFFC\\uDFFE\\uDFFF])))?|\\uDFFE(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]|\\uDD1D\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFB-\\uDFFD\\uDFFF])))?|\\uDFFF(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]|\\uDD1D\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFB-\\uDFFE])))?))?|\\uDC69(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?[\\uDC68\\uDC69]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D(?:[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uDC66(?:\\u200D\\uD83D\\uDC66)?|\\uDC67(?:\\u200D\\uD83D[\\uDC66\\uDC67])?|\\uDC69\\u200D\\uD83D(?:\\uDC66(?:\\u200D\\uD83D\\uDC66)?|\\uDC67(?:\\u200D\\uD83D[\\uDC66\\uDC67])?))|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]))|\\uD83C(?:\\uDFFB(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:[\\uDC68\\uDC69]|\\uDC8B\\u200D\\uD83D[\\uDC68\\uDC69])\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]|\\uDD1D\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFC-\\uDFFF])))?|\\uDFFC(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:[\\uDC68\\uDC69]|\\uDC8B\\u200D\\uD83D[\\uDC68\\uDC69])\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]|\\uDD1D\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFB\\uDFFD-\\uDFFF])))?|\\uDFFD(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:[\\uDC68\\uDC69]|\\uDC8B\\u200D\\uD83D[\\uDC68\\uDC69])\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]|\\uDD1D\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFB\\uDFFC\\uDFFE\\uDFFF])))?|\\uDFFE(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:[\\uDC68\\uDC69]|\\uDC8B\\u200D\\uD83D[\\uDC68\\uDC69])\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]|\\uDD1D\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFB-\\uDFFD\\uDFFF])))?|\\uDFFF(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:[\\uDC68\\uDC69]|\\uDC8B\\u200D\\uD83D[\\uDC68\\uDC69])\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D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\uDECE-\\uDEDB\\uDEE0-\\uDEE8]|\\uDD3C(?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF])?|\\uDDCE(?:\\uD83C[\\uDFFB-\\uDFFF])?(?:\\u200D(?:[\\u2640\\u2642]\\uFE0F?(?:\\u200D\\u27A1\\uFE0F?)?|\\u27A1\\uFE0F?))?|\\uDDD1(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF84\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]|\\uDD1D\\u200D\\uD83E\\uDDD1|\\uDDD1\\u200D\\uD83E\\uDDD2(?:\\u200D\\uD83E\\uDDD2)?|\\uDDD2(?:\\u200D\\uD83E\\uDDD2)?))|\\uD83C(?:\\uDFFB(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D(?:\\uD83D\\uDC8B\\u200D)?\\uD83E\\uDDD1\\uD83C[\\uDFFC-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF84\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]|\\uDD1D\\u200D\\uD83E\\uDDD1\\uD83C[\\uDFFB-\\uDFFF])))?|\\uDFFC(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D(?:\\uD83D\\uDC8B\\u200D)?\\uD83E\\uDDD1\\uD83C[\\uDFFB\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u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D(?:\\uD83D\\uDC8B\\u200D)?\\uD83E\\uDDD1\\uD83C[\\uDFFB-\\uDFFE]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF84\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]|\\uDD1D\\u200D\\uD83E\\uDDD1\\uD83C[\\uDFFB-\\uDFFF])))?))?|\\uDEF1(?:\\uD83C(?:\\uDFFB(?:\\u200D\\uD83E\\uDEF2\\uD83C[\\uDFFC-\\uDFFF])?|\\uDFFC(?:\\u200D\\uD83E\\uDEF2\\uD83C[\\uDFFB\\uDFFD-\\uDFFF])?|\\uDFFD(?:\\u200D\\uD83E\\uDEF2\\uD83C[\\uDFFB\\uDFFC\\uDFFE\\uDFFF])?|\\uDFFE(?:\\u200D\\uD83E\\uDEF2\\uD83C[\\uDFFB-\\uDFFD\\uDFFF])?|\\uDFFF(?:\\u200D\\uD83E\\uDEF2\\uD83C[\\uDFFB-\\uDFFE])?))?)/g;\n","import { StudentFailure, TermType } from \"../apis/BrsApi\";\nimport { ControlActionConfig } from \"./MarksManager\";\nimport * as googleApi from \"../apis/GoogleApi\";\nimport {\n compareNormalized,\n getKeys,\n filterNull,\n normalizeString,\n} from \"../helpers/tools\";\nimport { parseStudentFailure } from \"../helpers/brsHelpers\";\nimport { emojiRegex } from \"../helpers/emojiRegex\";\n\nexport interface ActualStudent {\n fullName: string;\n groupName: string | null;\n course: number | null;\n id: string | null;\n failure: StudentFailure | null;\n properties: string[];\n}\n\nexport interface SpreadsheetDatas {\n datas: SpreadsheetData[];\n}\n\nexport interface SpreadsheetData {\n actualStudents: ActualStudent[];\n disciplineConfig: DisciplineConfig;\n controlActionConfigs: ControlActionConfig[];\n}\n\nexport interface DisciplineConfig {\n name: string;\n year: number;\n termType: number;\n course: number;\n isModule: boolean;\n defaultStudentFailure: StudentFailure;\n}\n\ntype DisciplineConfigErrors = {\n [key in keyof DisciplineConfig]: string | null;\n};\n\nexport default class SpreadsheetManager {\n private readonly spreadsheetId: string;\n\n constructor(spreadsheetId: string) {\n this.spreadsheetId = spreadsheetId;\n }\n\n async getSpreadsheetDataAsync(sheetName: string): Promise {\n const rows = await readRowsFromSpreadsheetAsync(\n this.spreadsheetId,\n sheetName\n );\n const header = getHeader(rows);\n\n const indices = buildIndicesBy(header);\n const dataRange = buildDataRange(sheetName, indices);\n\n const actualStudents = await readStudentsAsync(\n this.spreadsheetId,\n dataRange,\n indices\n );\n\n if (\n indices.disciplineKeyColumn >= 0 &&\n indices.disciplineValueColumn >= 0\n ) {\n // Получение параметров из таблицы ключей и значений\n const controlActionConfigs = buildControlActionConfig(header, indices);\n const disciplineConfig = buildDisciplineConfig(rows, indices);\n return {\n datas: [{ actualStudents, disciplineConfig, controlActionConfigs }],\n };\n } else if (indices.courseColumn >= 0 || indices.academicGroupColumn >= 0) {\n // Получение параметров из заголовка таблицы\n const controlActionConfigs = buildControlActionConfig(header, indices);\n const studentGroups: { [course: number]: ActualStudent[] } = {};\n for (const student of actualStudents) {\n if (student.course !== null) {\n if (!studentGroups[student.course]) {\n studentGroups[student.course] = [];\n }\n studentGroups[student.course].push(student);\n }\n }\n\n const courses = getKeys(studentGroups);\n const disciplineConfigs =\n await buildDisciplineConfigFromSpreadsheetTitleAsync(\n this.spreadsheetId,\n courses\n );\n\n const datas = disciplineConfigs.map((config) => ({\n actualStudents: studentGroups[config.course],\n disciplineConfig: config,\n controlActionConfigs,\n }));\n\n return {\n datas,\n };\n } else {\n throw new Error(`Некорректная структура входной таблицы`);\n }\n }\n}\n\nasync function readStudentsAsync(\n spreadsheetId: string,\n readRange: string,\n indices: Indices\n) {\n const fullNameIndex =\n indices.fullNameColumn >= 0 ? indices.fullNameColumn - indices.left : null;\n const surnameIndex =\n indices.surnameColumn >= 0 ? indices.surnameColumn - indices.left : null;\n const nameIndex =\n indices.nameColumn >= 0 ? indices.nameColumn - indices.left : null;\n const patronymicIndex =\n indices.patronymicColumn >= 0\n ? indices.patronymicColumn - indices.left\n : null;\n const groupNameIndex =\n indices.groupColumn >= 0 ? indices.groupColumn - indices.left : null;\n const courseIndex =\n indices.courseColumn >= 0 ? indices.courseColumn - indices.left : null;\n const academicGroupIndex =\n indices.academicGroupColumn >= 0\n ? indices.academicGroupColumn - indices.left\n : null;\n const idIndex = null;\n const failureIndex = indices.failureColumn - indices.left;\n\n const sheet = googleApi.getSpreadsheet(spreadsheetId);\n const rows = (await sheet.readAsync(readRange)).values || [];\n\n const result: ActualStudent[] = [];\n for (const row of rows) {\n const fullName1 = fullNameIndex !== null ? row[fullNameIndex].trim() : null;\n const surname = surnameIndex !== null ? row[surnameIndex] : null;\n const name = nameIndex !== null ? row[nameIndex] : null;\n const patronymic = patronymicIndex !== null ? row[patronymicIndex] : null;\n const fullName2 =\n surname !== null && surname.length > 0\n ? `${surname.trim()} ${name?.trim() ?? \"\"} ${\n patronymic?.trim() ?? \"\"\n }`.trim()\n : null;\n const fullName =\n fullName1 !== null && fullName1.length > 0 ? fullName1 : fullName2;\n\n const groupName = groupNameIndex !== null ? row[groupNameIndex] : null;\n\n const course1 = courseIndex !== null ? row[courseIndex] : null;\n const academicGroup =\n academicGroupIndex !== null ? row[academicGroupIndex] : null;\n const course2 = academicGroup?.match(/\\d/)?.[0];\n const course = course1 !== null && course1.length > 0 ? course1 : course2;\n\n const id = idIndex !== null ? row[idIndex] : null;\n const failure =\n failureIndex !== null ? parseStudentFailure(row[failureIndex]) : null;\n if (fullName !== null && fullName.length > 0) {\n result.push({\n fullName: fullName,\n groupName,\n id: id,\n course,\n failure: failure,\n properties: row,\n });\n }\n }\n return result;\n}\n\nasync function readRowsFromSpreadsheetAsync(\n spreadsheetId: string,\n sheetName: string\n) {\n const sheet = googleApi.getSpreadsheet(spreadsheetId);\n const rows = (await sheet.readAsync(sheetName + \"!A1:ZZ100\"))\n .values as string[][];\n return rows || null;\n}\n\nasync function readTitleFromSpreadsheetAsync(spreadsheetId: string) {\n const sheet = googleApi.getSpreadsheet(spreadsheetId);\n return (await sheet.getMetaAsync()).properties.title;\n}\n\nfunction getHeader(rows: string[][]) {\n const header = rows && rows[0];\n if (!header) throw new Error(`Лист Google-таблицы не содержит строк`);\n return header;\n}\n\nfunction buildIndicesBy(header: string[]): Indices {\n const defaultGroupColumnName = \"Группа в БРС\";\n const defaultFullNameColumnName = \"Фамилия Имя в БРС\";\n const defaultSurnameColumnName = \"Фамилия\";\n const defaultNameColumnName = \"Имя\";\n const defaultPatronymicColumnName = \"Отчество\";\n const defaultCourseColumnName = \"Год обучения\";\n const defaultAcademicGroupColumnName = \"Группа\";\n const defaultFailureColumnName = \"Причина отсутствия\";\n const disciplineParameterKeyColumnPrefix = \"Названия параметров\";\n const disciplineParameterValueColumnPrefix = \"Значения параметров\";\n\n const normalizedHeader = header && header.map((s) => normalizeString(s));\n const groupColumnIndex = normalizedHeader.indexOf(\n normalizeString(defaultGroupColumnName)\n );\n const fullNameColumnIndex = normalizedHeader.indexOf(\n normalizeString(defaultFullNameColumnName)\n );\n const surnameColumnIndex = normalizedHeader.indexOf(\n normalizeString(defaultSurnameColumnName)\n );\n const nameColumnIndex = normalizedHeader.indexOf(\n normalizeString(defaultNameColumnName)\n );\n const patronymicColumnIndex = normalizedHeader.indexOf(\n normalizeString(defaultPatronymicColumnName)\n );\n const courseColumnIndex = normalizedHeader.indexOf(\n normalizeString(defaultCourseColumnName)\n );\n const academicGroupColumnIndex = normalizedHeader.indexOf(\n normalizeString(defaultAcademicGroupColumnName)\n );\n const failureColumnIndex = normalizedHeader.indexOf(\n normalizeString(defaultFailureColumnName)\n );\n const disciplineParameterKeyColumnIndex = normalizedHeader.indexOf(\n normalizeString(disciplineParameterKeyColumnPrefix)\n );\n const disciplineParameterValueColumnIndex = normalizedHeader.indexOf(\n normalizeString(disciplineParameterValueColumnPrefix)\n );\n\n if (\n failureColumnIndex < 0 ||\n (fullNameColumnIndex < 0 && surnameColumnIndex < 0) ||\n fullNameColumnIndex >= failureColumnIndex ||\n surnameColumnIndex >= failureColumnIndex ||\n nameColumnIndex >= failureColumnIndex ||\n patronymicColumnIndex >= failureColumnIndex ||\n (groupColumnIndex >= 0 && groupColumnIndex > failureColumnIndex) ||\n (courseColumnIndex >= 0 && courseColumnIndex > failureColumnIndex) ||\n (academicGroupColumnIndex >= 0 &&\n academicGroupColumnIndex > failureColumnIndex) ||\n (disciplineParameterKeyColumnIndex >= 0 &&\n disciplineParameterKeyColumnIndex <= failureColumnIndex) ||\n (disciplineParameterValueColumnIndex >= 0 &&\n disciplineParameterValueColumnIndex <= failureColumnIndex) ||\n (disciplineParameterKeyColumnIndex >= 0 &&\n disciplineParameterValueColumnIndex !==\n disciplineParameterKeyColumnIndex + 1)\n )\n throw new Error(`Неправильный порядок столбцов`);\n\n const leftIndex = Math.min(\n ...[\n fullNameColumnIndex,\n surnameColumnIndex,\n nameColumnIndex,\n patronymicColumnIndex,\n groupColumnIndex,\n courseColumnIndex,\n academicGroupColumnIndex,\n ].filter((it) => it >= 0)\n );\n const rightIndex = failureColumnIndex;\n\n return {\n groupColumn: groupColumnIndex,\n fullNameColumn: fullNameColumnIndex,\n surnameColumn: surnameColumnIndex,\n nameColumn: nameColumnIndex,\n patronymicColumn: patronymicColumnIndex,\n courseColumn: courseColumnIndex,\n academicGroupColumn: academicGroupColumnIndex,\n failureColumn: failureColumnIndex,\n disciplineKeyColumn: disciplineParameterKeyColumnIndex,\n disciplineValueColumn: disciplineParameterValueColumnIndex,\n left: leftIndex,\n right: rightIndex,\n };\n}\n\nfunction buildDataRange(sheetName: string, indices: Indices) {\n const leftLetter = String.fromCharCode(\"A\".charCodeAt(0) + indices.left);\n const rightLetter = String.fromCharCode(\"A\".charCodeAt(0) + indices.right);\n return `${sheetName}!${leftLetter}2:${rightLetter}`;\n}\n\nfunction buildControlActionConfig(header: string[], indices: Indices) {\n const controlActionConfigs: ControlActionConfig[] = [];\n for (let index = indices.left; index <= indices.right; index++) {\n if (\n index === indices.groupColumn ||\n index === indices.fullNameColumn ||\n index === indices.courseColumn ||\n index === indices.academicGroupColumn ||\n index === indices.failureColumn ||\n !header[index]\n ) {\n continue;\n }\n controlActionConfigs.push({\n controlAction: header[index],\n propertyIndex: index - indices.left,\n });\n }\n\n for (const config of controlActionConfigs) {\n const sameColumns = controlActionConfigs.filter((c) =>\n compareNormalized(c.controlAction, config.controlAction)\n );\n if (sameColumns.length > 1) {\n config.matchCount = sameColumns.length;\n for (let matchIndex = 0; matchIndex < sameColumns.length; matchIndex++) {\n sameColumns[matchIndex].matchIndex = matchIndex;\n }\n }\n }\n\n return controlActionConfigs;\n}\n\nasync function buildDisciplineConfigFromSpreadsheetTitleAsync(\n spreadsheetId: string,\n courses: number[]\n): Promise {\n const spreadsheetTitle = await readTitleFromSpreadsheetAsync(spreadsheetId);\n\n const prepared = spreadsheetTitle.replaceAll(emojiRegex, \"\").trim();\n const commaIndex = prepared.lastIndexOf(\",\");\n const name = prepared.substring(0, commaIndex).trim();\n const time = prepared.substring(commaIndex + 1).trim();\n const timeParts = time.split(\" \");\n const termType = compareNormalized(timeParts[0], \"весна\")\n ? TermType.Spring\n : TermType.Fall;\n const year =\n parseInt(timeParts[1], 10) + (termType === TermType.Spring ? -1 : 0);\n\n const configs = courses.map((it) => ({\n name,\n year,\n termType,\n course: it,\n isModule: true,\n defaultStudentFailure: StudentFailure.NoFailure,\n }));\n\n return configs;\n}\n\nfunction buildDisciplineConfig(rows: string[][], indices: Indices) {\n const result: DisciplineConfig = {\n name: \"\",\n year: 0,\n termType: TermType.Fall,\n course: 1,\n isModule: false,\n defaultStudentFailure: StudentFailure.NoFailure,\n };\n const errors: DisciplineConfigErrors = {\n name: \"Дисциплина\",\n year: \"Учебный год\",\n termType: \"Семестр\",\n course: \"Курс\",\n isModule: \"ИТС\",\n defaultStudentFailure: \"Причина отсутствия по умолчанию\",\n };\n\n for (let i = 0; i < rows.length; i++) {\n const key = rows[i][indices.disciplineKeyColumn]?.trim();\n if (!key) {\n break;\n }\n const value = rows[i][indices.disciplineValueColumn]?.trim();\n addDisciplineConfigParameter(result, errors, key, value);\n }\n\n const errorNames = filterNull(getKeys(errors).map((k) => errors[k]));\n if (errorNames.length > 0) {\n const errorNamesString = errorNames.map((n) => `«${n}»`).join(\", \");\n throw new Error(\n `Следующие параметры дисциплины не заданы: ${errorNamesString}`\n );\n }\n\n return result;\n}\n\nfunction addDisciplineConfigParameter(\n config: DisciplineConfig,\n errors: DisciplineConfigErrors,\n key: string,\n value: string\n) {\n if (compareNormalized(key, \"Дисциплина\")) {\n if (value) {\n config.name = value;\n errors.name = null;\n }\n } else if (compareNormalized(key, \"ИТС\")) {\n if (value) {\n config.isModule = value.toLowerCase() === \"да\";\n errors.isModule = null;\n }\n } else if (compareNormalized(key, \"Год\")) {\n if (value) {\n config.year = parseInt(value.toLowerCase(), 10);\n errors.year = null;\n }\n } else if (compareNormalized(key, \"Учебный год\")) {\n if (value) {\n const yearParts = value.toLowerCase().split(\"/\");\n config.year = parseInt(yearParts[0], 10);\n errors.year = null;\n }\n } else if (compareNormalized(key, \"Семестр\")) {\n if (value) {\n if (value.toLowerCase() === \"осенний\") {\n config.termType = TermType.Fall;\n errors.termType = null;\n } else if (value.toLowerCase() === \"весенний\") {\n config.termType = TermType.Spring;\n errors.termType = null;\n }\n }\n } else if (compareNormalized(key, \"Курс\")) {\n if (value) {\n const lowerValue = value.toLowerCase().trim();\n if (lowerValue === \"все курсы\") {\n config.course = 0;\n errors.course = null;\n } else {\n config.course = parseInt(value.toLowerCase(), 10);\n errors.course = null;\n }\n }\n } else if (compareNormalized(key, \"Причина отсутствия по умолчанию\")) {\n config.defaultStudentFailure =\n parseStudentFailure(value) ?? StudentFailure.NoFailure;\n errors.defaultStudentFailure = null;\n }\n}\n\ninterface Indices {\n groupColumn: number;\n fullNameColumn: number;\n surnameColumn: number;\n nameColumn: number;\n patronymicColumn: number;\n courseColumn: number;\n academicGroupColumn: number;\n failureColumn: number;\n disciplineKeyColumn: number;\n disciplineValueColumn: number;\n left: number;\n right: number;\n}\n","import React from \"react\";\nimport \"./styles.css\";\nimport {\n Collapse,\n List,\n ListItem,\n ListItemIcon,\n ListItemText,\n ListSubheader,\n} from \"@material-ui/core\";\nimport { ExpandLess, ExpandMore } from \"@material-ui/icons\";\n\nexport default function NestedList(props: NestedListProps) {\n const { title, items, icons } = props;\n\n const listSubheader = (\n \n );\n\n return (\n \n {items.length ? renderNestedItems(items, 0, icons) : renderEmpty()}\n
\n );\n}\n\nfunction renderNestedItems(\n items: NestedItem[],\n level: number,\n icons?: (JSX.Element | null)[]\n) {\n return items.map((item, index) => (\n \n ));\n}\n\nfunction renderEmpty() {\n return (\n \n \n \n );\n}\n\nfunction renderNestedItemsAsText(items: NestedItem[]) {\n return items.map((item, index) => {item.title}
);\n}\n\nfunction NestedListItem({ item, level, icons }: NestedListItemProps) {\n const { title, nestedItems, colored, collapsed, renderAsText } = item;\n\n const [open, setOpen] = React.useState(!collapsed);\n\n const hasSubItems = nestedItems && nestedItems.length > 0;\n\n const color = colored && \"colored-back\";\n\n const icon = icons && icons[level];\n const IconPlace = icon && {icon};\n\n return (\n \n setOpen(!open)}\n style={level ? { paddingLeft: 40 * level } : undefined}\n className={\"hover \" + color}\n >\n {IconPlace}\n \n {hasSubItems && (open ? : )}\n \n {hasSubItems && (\n \n {renderAsText ? (\n \n {nestedItems && renderNestedItemsAsText(nestedItems)}\n
\n ) : (\n \n {nestedItems && renderNestedItems(nestedItems, level + 1, icons)}\n
\n )}\n \n )}\n \n );\n}\n\nexport interface NestedItem {\n title: string;\n colored?: boolean;\n collapsed?: boolean;\n renderAsText?: boolean;\n nestedItems?: NestedItem[];\n}\n\ninterface NestedListProps {\n items: NestedItem[];\n title?: string;\n icons?: (JSX.Element | null)[];\n}\n\ninterface NestedListItemProps {\n item: NestedItem;\n level: number;\n renderAsText?: boolean;\n icons?: (JSX.Element | null)[];\n}\n","import { Button, Grid } from \"@material-ui/core\";\nimport React from \"react\";\n\nexport default function RunWorkerButtons({\n enabled,\n onRunWorkSafe,\n onRunWorkUnsafe,\n}: Props) {\n return (\n \n \n \n \n \n \n \n \n );\n}\n\ninterface Props {\n enabled: boolean;\n onRunWorkSafe: () => void;\n onRunWorkUnsafe: () => void;\n}\n","export function toShow(fio: string) {\n return fio.replace(\"ё\", \"е\").replace(/[ ]+/, \" \");\n}\n\nexport function toKey(fio: string) {\n return fio.toLowerCase().replace(\"ё\", \"е\").replace(/[ ]+/, \" \").trim();\n}\n","import BrsApi, {\n ControlAction,\n Discipline,\n DisciplineMeta,\n CardMeta,\n StudentFailure,\n StudentMark,\n} from \"../apis/BrsApi\";\nimport {\n compareNormalized,\n groupBy,\n normalizeString,\n parseAnyFloat,\n pluralize,\n round10,\n round100,\n} from \"../helpers/tools\";\nimport * as fio from \"../helpers/fio\";\nimport { ActualStudent, SpreadsheetData } from \"./SpreadsheetManager\";\nimport { formatStudentFailure } from \"../helpers/brsHelpers\";\nimport ReportManager from \"./ReportManager\";\nimport { BrsReport } from \"./BrsReport\";\n\nconst autoControlActionNames = new Set([\"auto\", \"баллы\"])\n\nenum MarkUpdateStatus {\n Updated,\n Failed,\n Skipped,\n}\n\nexport default class MarksManager {\n private readonly brsApi: BrsApi;\n private readonly save: boolean;\n private cancelPending: boolean = false;\n\n readonly reportManager: ReportManager;\n\n constructor(\n brsApi: BrsApi,\n reportManager: ReportManager,\n save: boolean\n ) {\n this.brsApi = brsApi;\n this.reportManager = reportManager;\n this.save = save;\n }\n\n cancel() {\n this.cancelPending = true;\n }\n\n async putMarksToBrsAsync(\n spreadsheetData: SpreadsheetData,\n disciplines: Discipline[]\n ) {\n const { actualStudents, disciplineConfig, controlActionConfigs } =\n spreadsheetData;\n try {\n for (const discipline of disciplines) {\n const students = actualStudents.filter((s) =>\n isSuitableDiscipline(s, discipline)\n );\n if (students.length === 0) {\n continue;\n }\n\n this.reportManager.newReport({\n disciplineConfig: disciplineConfig,\n discipline: discipline,\n merge: { succeed: 0 },\n marks: [],\n skipped: [],\n });\n\n var isSuccessful = await this.putMarksForDisciplineAsync(\n discipline,\n students,\n disciplineConfig.defaultStudentFailure,\n controlActionConfigs\n );\n\n if (isSuccessful) {\n this.reportManager.finishReport();\n } else {\n this.reportManager.cancelReport();\n }\n\n if (this.cancelPending) {\n break;\n }\n }\n\n return null;\n } catch (e) {\n return e;\n }\n }\n\n async putMarksForDisciplineAsync(\n discipline: Discipline,\n actualStudents: ActualStudent[],\n defaultStudentFailure: StudentFailure,\n controlActionConfigs: ControlActionConfig[]\n ) {\n const disciplineMeta = await this.brsApi.getDisciplineMetaAsync(discipline);\n\n if (\n !this.checkControlActionsConfiguration(\n discipline,\n disciplineMeta,\n controlActionConfigs\n )\n )\n return false;\n\n const brsStudents = await this.brsApi.getAllStudentMarksAsync(discipline);\n const { mergedStudents, skippedActualStudents, skippedBrsStudents } =\n this.mergeStudents(actualStudents, brsStudents);\n\n this.logMergedStudents(\n mergedStudents,\n skippedActualStudents,\n skippedBrsStudents\n );\n\n await this.putMarksForStudentsAsync(\n discipline,\n disciplineMeta,\n mergedStudents,\n controlActionConfigs\n );\n\n await this.updateFailuresForSkippedStudentsAsync(\n skippedBrsStudents,\n discipline,\n defaultStudentFailure\n );\n\n if (this.save) {\n await this.brsApi.updateAllMarksAsync(discipline);\n }\n\n return true;\n }\n\n checkControlActionsConfiguration(\n discipline: Discipline,\n disciplineMeta: DisciplineMeta,\n controlActionConfigs: ControlActionConfig[]\n ) {\n const autoControlActionConfig =\n this.tryGetAutoControlActionConfig(controlActionConfigs);\n if (autoControlActionConfig) {\n return true;\n }\n\n const controlActions = this.getControlActions(disciplineMeta);\n for (const config of controlActionConfigs) {\n if (!this.getSuitableControlAction(discipline, config, controlActions)) {\n return false;\n }\n }\n return true;\n }\n\n async putMarksForStudentsAsync(\n discipline: Discipline,\n disciplineMeta: DisciplineMeta,\n students: MergedStudent[],\n controlActionConfigs: ControlActionConfig[]\n ) {\n const ratings: Ratings = {};\n let notFinishedStudents = students;\n\n // 3 попытки при реальной записи нужно для проверки успешности 2-ой попытки\n // 2 попытки при отсутствии записи позволяют проверить работоспособность кода\n const tryCount = this.save ? 3 : 2;\n for (let i = 0; i < tryCount; i++) {\n notFinishedStudents = await this.putMarksForStudentsOnceAsync(\n ratings,\n discipline,\n disciplineMeta,\n notFinishedStudents,\n controlActionConfigs\n );\n }\n\n const ratingResults: Array = [];\n for (const studentId in ratings) {\n const r = ratings[studentId];\n\n if (this.save && !r.finished) {\n r.rating.status = MarkUpdateStatus.Failed;\n }\n\n ratingResults.push(r.rating);\n }\n\n const groupedResults = Object.entries(groupBy(ratingResults, \"status\")).map(\n ([groupKey, rawStudents]) => ({\n title: formatMarkUpdateStatus(rawStudents[0][\"status\"]),\n students: rawStudents.map((s) => s.infoString),\n failed: rawStudents[0][\"status\"] === MarkUpdateStatus.Failed,\n })\n );\n\n this.reportManager.currentReport.marks.push(...groupedResults);\n }\n\n async putMarksForStudentsOnceAsync(\n ratings: Ratings,\n discipline: Discipline,\n disciplineMeta: DisciplineMeta,\n students: MergedStudent[],\n controlActionConfigs: ControlActionConfig[]\n ) {\n const ratingResults = await Promise.all(\n students.map(async (student) => {\n return await this.putMarksForStudentAsync(\n discipline,\n disciplineMeta,\n student,\n controlActionConfigs\n );\n })\n );\n for (const rating of ratingResults) {\n // 1) S → S stop\n // 2) US → U stop, UU → U, UF → F, FS → F stop, FU → U, FF → F\n const oldRating = ratings[rating.student.brs.studentUuid]?.rating;\n const newRating =\n oldRating && rating.status === MarkUpdateStatus.Skipped\n ? oldRating\n : rating;\n const newFinished = rating.status === MarkUpdateStatus.Skipped;\n\n ratings[rating.student.brs.studentUuid] = {\n rating: newRating,\n finished: newFinished,\n };\n }\n\n const brsStudents: { [studentId: string]: StudentMark } = {};\n for (const s of await this.brsApi.getAllStudentMarksAsync(discipline)) {\n brsStudents[s.studentUuid] = s;\n }\n\n const notFinishedStudents = students\n .filter((s) => !ratings[s.brs.studentUuid]?.finished)\n .map((s) => ({\n actual: s.actual,\n brs: brsStudents[s.brs.studentUuid] || s.brs,\n }));\n\n return notFinishedStudents;\n }\n\n async putMarksForStudentAsync(\n discipline: Discipline,\n disciplineMeta: DisciplineMeta,\n student: MergedStudent,\n controlActionConfigs: ControlActionConfig[]\n ): Promise {\n const autoControlActionConfig =\n this.tryGetAutoControlActionConfig(controlActionConfigs);\n\n const controlActions = this.getControlActions(disciplineMeta);\n\n const log: PutMarksLog = {\n failed: 0,\n updated: 0,\n marks: [],\n };\n\n if (autoControlActionConfig !== null) {\n await this.putAutoMarksForStudentAsync(\n log,\n discipline,\n disciplineMeta,\n student,\n autoControlActionConfig\n );\n } else {\n await this.putManualMarksForStudentAsync(\n log,\n discipline,\n student,\n controlActionConfigs,\n controlActions\n );\n }\n\n const brsFailureStatus =\n (student.brs.failure as StudentFailure) ?? StudentFailure.NoFailure;\n const actualFailure = student.actual.failure ?? StudentFailure.NoFailure;\n let failureStatus: string;\n if (actualFailure === brsFailureStatus) {\n failureStatus = `${formatStudentFailure(actualFailure)}`;\n } else {\n failureStatus = `${formatStudentFailure(actualFailure)}!`;\n try {\n if (this.save) {\n await this.brsApi.putStudentFailureAsync(\n student.brs.studentUuid,\n discipline,\n actualFailure\n );\n }\n log.updated++;\n } catch (error) {\n log.failed++;\n }\n }\n\n const status =\n log.failed > 0\n ? MarkUpdateStatus.Failed\n : log.updated > 0\n ? MarkUpdateStatus.Updated\n : MarkUpdateStatus.Skipped;\n const studentName = student.actual.fullName.substr(0, 30);\n let infoString = `${studentName} баллы: ${log.marks.join(\" \")}`;\n if (failureStatus && failureStatus !== \"-\")\n infoString += `, ${failureStatus}`;\n\n return { student, status, infoString };\n }\n\n async putAutoMarksForStudentAsync(\n log: PutMarksLog,\n discipline: Discipline,\n disciplineMeta: DisciplineMeta,\n student: MergedStudent,\n autoControlActionConfig: ControlActionConfig\n ) {\n const autoMarkString =\n student.actual.properties[autoControlActionConfig.propertyIndex];\n const autoMark = parseAnyFloat(autoMarkString);\n\n const controlActionGroups = this.getControlActionGroups(disciplineMeta);\n\n const currentControlActionGroups = controlActionGroups.filter(\n (it) => !it.isIntermediate\n );\n const currentFactor = currentControlActionGroups.reduce(\n (result, it) => result + it.factor,\n 0\n );\n\n const intermediateControlActionGroups = controlActionGroups.filter(\n (it) => it.isIntermediate\n );\n const intermediateFactor = intermediateControlActionGroups.reduce(\n (result, it) => it.factor,\n 0\n );\n\n const output = `[auto=${autoMark}]`;\n log.marks.push(` ${output}`.substr(`${output}`.length - 1));\n\n // NOTE: Если баллов достаточно для удовлетворительной оценки,\n // то заполняем КМы по возможности максимальными оценками с первого к последнему.\n if (40 <= autoMark) {\n await this.putMarksTryFillActionsWithMaxScoreAsync(\n log,\n discipline,\n student,\n controlActionGroups,\n autoMark\n );\n }\n // NOTE: Если баллов достаточно, чтобы поставить за семестр 40, то ставим\n else if (currentFactor * 40 <= autoMark) {\n const currentMark = 40;\n const rawIntermediateMark =\n currentFactor > 0\n ? (autoMark - currentFactor * currentMark) / intermediateFactor\n : 0;\n const intermediateMark = round100(rawIntermediateMark);\n\n await this.putMarksTryFillActionsWithMaxScoreAsync(\n log,\n discipline,\n student,\n currentControlActionGroups,\n currentMark\n );\n\n await this.putMarksTryFillActionsWithMaxScoreAsync(\n log,\n discipline,\n student,\n intermediateControlActionGroups,\n intermediateMark\n );\n }\n // NOTE: Иначе ставим за семестр все, что возможно, а за сессию 0.\n else {\n const intermediateMark = 0;\n const rawCurrentMark =\n currentFactor > 0\n ? (autoMark - intermediateFactor * intermediateMark) / currentFactor\n : 0;\n const currentMark = round100(rawCurrentMark);\n\n await this.putMarksTryFillActionsWithMaxScoreAsync(\n log,\n discipline,\n student,\n currentControlActionGroups,\n currentMark\n );\n\n await this.putMarksTryFillActionsWithMaxScoreAsync(\n log,\n discipline,\n student,\n intermediateControlActionGroups,\n intermediateMark\n );\n }\n }\n\n async putMarksTryFillActionsWithMaxScoreAsync(\n log: PutMarksLog,\n discipline: Discipline,\n student: MergedStudent,\n controlActionGroups: ControlActionGroup[],\n mark: number\n ) {\n for (const controlActionGroup of controlActionGroups) {\n const controlActions = controlActionGroup.controlActions;\n\n let value = mark;\n for (let i = 0; i < controlActions.length; i++) {\n const controlAction = controlActions[i];\n const actualMark =\n controlAction.maxValue < value\n ? controlAction.maxValue\n : round10(value);\n value -= actualMark;\n\n await this.putMarkAsync(\n log,\n discipline,\n student,\n controlAction,\n actualMark\n );\n }\n }\n }\n\n async putManualMarksForStudentAsync(\n log: PutMarksLog,\n discipline: Discipline,\n student: MergedStudent,\n controlActionConfigs: ControlActionConfig[],\n controlActions: ControlAction[]\n ) {\n for (const config of controlActionConfigs) {\n const controlAction = this.getSuitableControlAction(\n discipline,\n config,\n controlActions\n );\n if (!controlAction) {\n throw new Error(\n `Подходящее контрольное мероприятие для «${config.controlAction}» не найдено в БРС`\n );\n }\n\n const actualMarkString = student.actual.properties[config.propertyIndex];\n const actualMark = parseAnyFloat(actualMarkString);\n\n await this.putMarkAsync(\n log,\n discipline,\n student,\n controlAction,\n actualMark\n );\n }\n\n return log;\n }\n\n async putMarkAsync(\n log: PutMarksLog,\n discipline: Discipline,\n student: MergedStudent,\n controlAction: ControlAction,\n actualMark: number\n ) {\n const brsMarkString = student.brs[controlAction.uuid] as string;\n const brsMark = parseAnyFloat(brsMarkString);\n\n const needUpdateMark =\n !isNaN(actualMark) &&\n !(isNaN(brsMark) ? actualMark === 0 : brsMark === actualMark);\n const actualMarkOutput = !isNaN(actualMark) ? actualMark.toString() : \"-\";\n const controlActionOutput = controlAction.controlAction.substring(0, 3);\n\n if (needUpdateMark) {\n log.marks.push(\n ` ${controlActionOutput}=${actualMarkOutput}!`.substr(\n `${actualMarkOutput}`.length - 1\n )\n );\n } else {\n log.marks.push(\n ` ${controlActionOutput}=${actualMarkOutput} `.substr(\n `${actualMarkOutput}`.length - 1\n )\n );\n return;\n }\n\n try {\n if (this.save) {\n await this.brsApi.putStudentMarkAsync(\n student.brs.studentUuid,\n controlAction.uuidWithoutPrefix,\n actualMark,\n discipline.groupHistoryId,\n student.brs.cardType,\n student.brs.disciplineLoad\n );\n }\n log.updated++;\n } catch (error) {\n log.failed++;\n }\n }\n\n getSuitableControlAction(\n discipline: Discipline,\n config: ControlActionConfig,\n controlActions: ControlAction[]\n ) {\n const suitableControlActions = controlActions.filter((a) =>\n compareNormalized(a.controlAction, config.controlAction)\n );\n\n const errorMessages = [];\n\n if (suitableControlActions.length === 0) {\n errorMessages.push(\n `Группа ${discipline.group}` +\n (discipline.teacherName !== undefined\n ? `, преподаватель ${discipline.teacherName}`\n : \"\")\n );\n errorMessages.push(\n `- контрольное мероприятие «${config.controlAction}» не сопоставлено с БРС`\n );\n errorMessages.push(\n `- найденные в БРС контрольные мероприятия: ${controlActions\n .map((a) => a.controlAction)\n .join(\", \")}`\n );\n\n this.reportManager.onInvalidConfiguration(errorMessages);\n\n return null;\n }\n\n if (config.matchIndex !== undefined || config.matchCount !== undefined) {\n if (\n config.matchIndex === undefined ||\n config.matchCount === undefined ||\n suitableControlActions.length !== config.matchCount ||\n config.matchIndex >= config.matchCount\n ) {\n errorMessages.push(\n `Неверная конфигурация контрольного мероприятия «${config.controlAction}»`\n );\n if (suitableControlActions.length !== config.matchCount) {\n errorMessages.push(\n `В БРС найдено ${suitableControlActions.length} ${pluralize(\n suitableControlActions.length,\n \"подходящее контрольное мероприятие\",\n \"подходящих контрольных мероприятия\",\n \"подходящих контрольных мероприятий\"\n )}, а в таблице указано ${config.matchCount}`\n );\n }\n\n this.reportManager.onInvalidConfiguration(errorMessages);\n\n return null;\n }\n return suitableControlActions[config.matchIndex];\n }\n\n if (suitableControlActions.length > 1) {\n errorMessages.push(\n `Несколько контрольных мероприятий найдено для «${config.controlAction}»`\n );\n errorMessages.push(\n `Найденные контрольные мероприятия: ${suitableControlActions\n .map((a) => a.controlAction)\n .join(\", \")}`\n );\n\n this.reportManager.onInvalidConfiguration(errorMessages);\n\n return null;\n }\n\n return suitableControlActions[0];\n }\n\n async updateFailuresForSkippedStudentsAsync(\n students: StudentMark[],\n discipline: Discipline,\n defaultStudentFailure: StudentFailure\n ) {\n const ratingResults = await Promise.all(\n students.map((student) =>\n this.updateFailureForStudent(student, discipline, defaultStudentFailure)\n )\n );\n\n if (ratingResults.length > 0) {\n const groupedResults = Object.entries(\n groupBy(ratingResults, \"status\")\n ).map(([groupKey, rawStudents]) => ({\n title: formatMarkUpdateStatus(rawStudents[0][\"status\"]),\n students: rawStudents.map((s) => s.infoString),\n }));\n\n this.reportManager.currentReport.skipped.push(...groupedResults);\n }\n }\n\n async updateFailureForStudent(\n student: StudentMark,\n discipline: Discipline,\n defaultStudentFailure: StudentFailure\n ) {\n let status: MarkUpdateStatus;\n const brsFailureStatus = student.failure\n ? (student.failure as StudentFailure)\n : StudentFailure.NoFailure;\n const actualFailure = defaultStudentFailure;\n if (actualFailure === brsFailureStatus) {\n status = MarkUpdateStatus.Skipped;\n } else {\n try {\n if (this.save) {\n await this.brsApi.putStudentFailureAsync(\n student.studentUuid,\n discipline,\n actualFailure\n );\n }\n status = MarkUpdateStatus.Updated;\n } catch (error) {\n status = MarkUpdateStatus.Failed;\n }\n }\n\n const studentName = student.studentFio.substr(0, 30);\n const description =\n status !== MarkUpdateStatus.Skipped\n ? `выставлено «${formatStudentFailure(\n actualFailure\n )}», было «${formatStudentFailure(brsFailureStatus)}»`\n : `«${formatStudentFailure(actualFailure)}»`;\n\n const infoString = `${studentName}, ${description}`;\n\n return { status, infoString };\n }\n\n tryGetAutoControlActionConfig(\n controlActionConfigs: ControlActionConfig[]\n ): ControlActionConfig | null {\n const autoConfigs = controlActionConfigs.filter(\n (it) => autoControlActionNames.has(it.controlAction.toLowerCase())\n );\n\n if (autoConfigs.length === 1) {\n return autoConfigs[0];\n }\n\n if (autoConfigs.length > 1) {\n this.reportManager.onInvalidConfiguration([\n `Найдено несколько колонок с автоитогом`,\n ]);\n }\n return null;\n }\n\n getControlActions(disciplineMeta: DisciplineMeta) {\n const controlActions = [\n ...(disciplineMeta.lecture?.currentControlActions || []),\n ...(disciplineMeta.lecture?.intermediateControlActions || []),\n ...(disciplineMeta.laboratory?.currentControlActions || []),\n ...(disciplineMeta.laboratory?.intermediateControlActions || []),\n ...(disciplineMeta.practice?.currentControlActions || []),\n ...(disciplineMeta.practice?.intermediateControlActions || []),\n ...(disciplineMeta.additionalPractice?.currentControlActions || []),\n ...(disciplineMeta.additionalPractice?.intermediateControlActions || []),\n ];\n\n return controlActions;\n }\n\n getControlActionGroups(disciplineMeta: DisciplineMeta) {\n const groups: ControlActionGroup[] = [];\n\n if (disciplineMeta.lecture) {\n this.pushControlActionGroups(groups, disciplineMeta.lecture);\n }\n if (disciplineMeta.laboratory) {\n this.pushControlActionGroups(groups, disciplineMeta.laboratory);\n }\n if (disciplineMeta.practice) {\n this.pushControlActionGroups(groups, disciplineMeta.practice);\n }\n if (disciplineMeta.additionalPractice) {\n this.pushControlActionGroups(groups, disciplineMeta.additionalPractice);\n }\n\n return groups;\n }\n\n pushControlActionGroups(groups: ControlActionGroup[], cardMeta: CardMeta) {\n if (cardMeta.currentControlActions.length > 0) {\n const factor = round100(cardMeta.currentFactor * cardMeta.totalFactor);\n const controlActions = cardMeta.currentControlActions;\n groups.push({ factor, controlActions, isIntermediate: false });\n }\n if (cardMeta.intermediateControlActions.length > 0) {\n const factor = round100(\n cardMeta.intermediateFactor * cardMeta.totalFactor\n );\n const controlActions = cardMeta.intermediateControlActions;\n groups.push({ factor, controlActions, isIntermediate: true });\n }\n }\n\n mergeStudents(actualStudents: ActualStudent[], brsStudents: StudentMark[]) {\n const activeBrsStudents = brsStudents.filter(isStudentActiveAndShouldPass);\n\n const mergedStudents: MergedStudent[] = [];\n const skippedActualStudents: ActualStudent[] = [];\n for (const actualStudent of actualStudents) {\n const suitableStudents = activeBrsStudents.filter((brsStudent) =>\n areStudentsLike(brsStudent, actualStudent)\n );\n if (suitableStudents.length === 1) {\n mergedStudents.push({\n actual: actualStudent,\n brs: suitableStudents[0],\n });\n } else {\n skippedActualStudents.push(actualStudent);\n }\n }\n\n const skippedBrsStudents: StudentMark[] = [];\n for (const brsStudent of activeBrsStudents) {\n if (\n !mergedStudents.some(\n (ms) => ms.brs.studentUuid === brsStudent.studentUuid\n )\n ) {\n skippedBrsStudents.push(brsStudent);\n }\n }\n\n return { mergedStudents, skippedActualStudents, skippedBrsStudents };\n }\n\n logMergedStudents(\n mergedStudents: MergedStudent[],\n skippedActualStudents: ActualStudent[],\n skippedBrsStudents: StudentMark[]\n ) {\n const report = this.reportManager.currentReport;\n\n report.merge.succeed = mergedStudents.length;\n\n if (skippedActualStudents.length > 0)\n report.merge.failedActual = skippedActualStudents.map((s) => s.fullName);\n\n if (skippedBrsStudents.length > 0) {\n report.merge.failedBrs = skippedBrsStudents.map((s) => s.studentFio);\n }\n }\n}\n\nfunction isStudentActiveAndShouldPass(brsStudent: StudentMark) {\n return (\n brsStudent.studentStatus !== \"Переведен\" &&\n brsStudent.studentStatus !== \"Отчислен\" &&\n brsStudent.studentStatus !== \"Переведен\" &&\n brsStudent.studentStatus !== \"Отп.акад.\" &&\n brsStudent.failure !== StudentFailure.ShouldNotPass\n );\n}\n\nfunction areStudentsLike(\n brsStudent: StudentMark,\n actualStudent: ActualStudent\n) {\n const brsFullName = fio.toKey(brsStudent.studentFio);\n const actualFullName = fio.toKey(actualStudent.fullName);\n return brsFullName.startsWith(actualFullName);\n}\n\nfunction isSuitableDiscipline(\n actualStudent: ActualStudent,\n discipline: Discipline\n) {\n if (actualStudent.groupName && actualStudent.groupName.length > 0) {\n const s = normalizeString(actualStudent.groupName)\n const d = normalizeString(discipline.group)\n return d.startsWith(s)\n }\n\n return true;\n}\n\nfunction formatMarkUpdateStatus(status: MarkUpdateStatus) {\n switch (status) {\n case MarkUpdateStatus.Updated:\n return \"ОБНОВЛЕНО\";\n case MarkUpdateStatus.Skipped:\n return \"ПРОПУЩЕНО\";\n case MarkUpdateStatus.Failed:\n return \"ПРОВАЛЕНО\";\n default:\n throw new Error(\"Неизвестный статус обновления оценок\");\n }\n}\n\nexport interface ControlActionConfig {\n controlAction: string;\n matchIndex?: number;\n matchCount?: number;\n propertyIndex: number;\n}\n\ninterface MergedStudent {\n actual: ActualStudent;\n brs: StudentMark;\n}\n\ninterface PutMarksLog {\n updated: number;\n failed: number;\n marks: string[];\n}\n\ninterface ControlActionGroup {\n factor: number;\n controlActions: ControlAction[];\n isIntermediate: boolean;\n}\n\ninterface RatingResult {\n student: MergedStudent;\n status: MarkUpdateStatus;\n infoString: string;\n}\n\ninterface Ratings {\n [studentId: string]: { rating: RatingResult; finished: boolean };\n}\n","import React, { memo } from \"react\";\nimport SpreadsheetManager, {\n DisciplineConfig,\n SpreadsheetData,\n SpreadsheetDatas,\n} from \"../../../managers/SpreadsheetManager\";\nimport NestedList, { NestedItem } from \"../../shared/NestedList\";\nimport { Collapse, Container } from \"@material-ui/core\";\nimport {\n compareNormalized,\n filterNull,\n normalizeString,\n} from \"../../../helpers/tools\";\nimport * as googleApi from \"../../../apis/GoogleApi\";\nimport BrsApi, { Discipline, TermType } from \"../../../apis/BrsApi\";\nimport \"./styles.css\";\nimport RunWorkerButtons from \"../RunWorkerButtons\";\nimport WorkerDialog, { MarksData } from \"../WorkerDialog\";\nimport GroupIcon from \"@material-ui/icons/Group\";\nimport { ViewModule } from \"@material-ui/icons\";\nimport GoogleTableFetchForm from \"./GoogleTableFetchForm\";\n\nenum LastAction {\n None,\n LoadDisciplines,\n RunWork,\n}\n\nclass GoogleTableFetch extends React.Component {\n marksDatas: Array = [];\n workerSaveMode: boolean = false;\n spreadsheetId: string = \"\";\n sheetId: string | null = null;\n\n constructor(props: Props) {\n super(props);\n\n this.state = {\n tableUrl: \"\",\n loading: false,\n showDisciplines: false,\n lastAction: LastAction.None,\n tableUrlError: { error: false, message: \"\" },\n disciplines: [],\n allDisciplinesMissed: false,\n missedDisciplinesCount: 0,\n showWorkerButtons: false,\n runWorker: false,\n };\n }\n\n loadDisciplines = async (spreadsheetId: string, sheetId: string | null) => {\n this.spreadsheetId = spreadsheetId;\n this.sheetId = sheetId;\n\n this.setState({ loading: true });\n\n const spreadsheetDatas = await this.getActualSpreadsheetDataAsync(\n spreadsheetId,\n sheetId\n );\n if (!spreadsheetDatas?.datas || spreadsheetDatas.datas.length === 0) {\n this.setState({ loading: false });\n return false;\n }\n\n this.marksDatas = [];\n const nestedItems: NestedItem[] = [];\n let allMissed = true;\n let missedCount = 0;\n for (const data of spreadsheetDatas.datas) {\n const disciplines = await this.getActualDisciplinesAsync(\n data.disciplineConfig\n );\n if (!disciplines) {\n this.setState({ loading: false });\n return false;\n }\n this.marksDatas.push({\n spreadsheetData: data,\n suitableDisciplines: disciplines,\n });\n\n const items = this.disciplinesToListItems(disciplines, data);\n allMissed = allMissed && items.allMissed;\n missedCount += items.missedCount;\n nestedItems.push(...items.disciplines);\n }\n\n this.setState({\n loading: false,\n disciplines: nestedItems,\n showDisciplines: true,\n lastAction: LastAction.LoadDisciplines,\n allDisciplinesMissed: allMissed,\n missedDisciplinesCount: missedCount,\n showWorkerButtons: !allMissed,\n });\n\n return !allMissed;\n };\n\n disciplinesToListItems(\n availableDisciplines: Discipline[],\n spreadsheetData: SpreadsheetData\n ): { allMissed: boolean; missedCount: number; disciplines: NestedItem[] } {\n const actualGroups = Array.from(\n new Set(spreadsheetData.actualStudents.map((s) => s.groupName || \"\"))\n );\n const availableGroups = Array.from(\n new Set(availableDisciplines.map((s) => s.group))\n );\n\n let missedCount = 0;\n const nestedItems: NestedItem[] = actualGroups\n .map((group) => {\n if (group.length > 0) {\n const normalizedGroup = normalizeString(group);\n const availableForActual = availableGroups.filter((it) =>\n normalizeString(it).startsWith(normalizedGroup)\n );\n\n if (availableForActual.length === 0) {\n missedCount++;\n return [{ title: group, colored: true }];\n } else {\n return availableForActual.map((it) => ({\n title: it,\n colored: false,\n }));\n }\n } else {\n if (availableGroups.length === 0) {\n missedCount++;\n return [{ title: 'Автоопределение → нет вариантов', colored: true }];\n } else {\n return availableGroups.map((it) => ({\n title: `Автоопределение → ${it}`,\n colored: false,\n }));\n }\n }\n })\n .flat();\n\n const disciplineConfig = spreadsheetData.disciplineConfig;\n const disciplineTime =\n disciplineConfig.termType === TermType.Fall\n ? `осень ${disciplineConfig.year}`\n : disciplineConfig.termType === TermType.Spring\n ? `весна ${disciplineConfig.year + 1}`\n : `${disciplineConfig.year}/${disciplineConfig.year + 1}`;\n const disciplineTitle = `${disciplineConfig.name}, ${disciplineTime}, ${disciplineConfig.course} курс`;\n return {\n allMissed: missedCount === actualGroups.length,\n missedCount,\n disciplines: [\n {\n title: disciplineTitle,\n nestedItems,\n },\n ],\n };\n }\n\n async getActualDisciplinesAsync(disciplineConfig: DisciplineConfig) {\n try {\n const allDisciplines = await this.props.brsApi.getDisciplineCachedAsync(\n disciplineConfig.year,\n disciplineConfig.termType,\n disciplineConfig.course,\n disciplineConfig.isModule\n );\n\n return allDisciplines.filter((d) =>\n compareNormalized(d.discipline, disciplineConfig.name)\n );\n } catch (error: any) {\n this.props.onError(error);\n }\n }\n\n async getActualSpreadsheetDataAsync(\n spreadsheetId: string,\n sheetId: string | null\n ) {\n const sheetName = await this.getSheetName(spreadsheetId, sheetId);\n if (!sheetName) {\n return null;\n }\n\n let spreadsheetData: SpreadsheetDatas;\n try {\n const spreadsheetManager = new SpreadsheetManager(spreadsheetId);\n spreadsheetData = await spreadsheetManager.getSpreadsheetDataAsync(\n sheetName\n );\n } catch (e: any) {\n this.props.onError(e.message || JSON.stringify(e));\n return null;\n }\n\n return spreadsheetData;\n }\n\n async getSheetName(\n spreadsheetId: string,\n sheetId: string | null\n ): Promise {\n try {\n const meta = await googleApi.getSpreadsheet(spreadsheetId).getMetaAsync();\n const sheets = meta.sheets.map((it) => it.properties);\n const maybeSheet = sheetId\n ? sheets.filter((s) => s.sheetId.toString() === sheetId)[0]\n : sheets[0];\n if (!maybeSheet) {\n this.props.onError(\"Таблица не найдена\");\n return null;\n }\n return maybeSheet.title;\n } catch (e: any) {\n this.props.onError(e.message || JSON.stringify(e));\n return null;\n }\n }\n\n updateCachedDisciplines = (\n event: React.MouseEvent\n ) => {\n event.preventDefault();\n this.setState({ showDisciplines: false });\n\n for (const marksData of this.marksDatas) {\n const disciplineConfig = marksData.spreadsheetData?.disciplineConfig;\n if (!disciplineConfig) return;\n\n this.props.brsApi\n .clearDisciplineCacheAsync(\n disciplineConfig.year,\n disciplineConfig.termType,\n disciplineConfig.course,\n disciplineConfig.isModule\n )\n .then(\n (x) => x,\n (error) => {\n this.props.onError(error);\n }\n );\n }\n\n this.loadDisciplines(this.spreadsheetId, this.sheetId);\n };\n\n runWork = async (save: boolean) => {\n if (this.state.lastAction !== LastAction.LoadDisciplines) {\n const success = await this.loadDisciplines(\n this.spreadsheetId,\n this.sheetId\n );\n if (!success) {\n return;\n }\n }\n\n this.workerSaveMode = save;\n this.setState({\n lastAction: LastAction.RunWork,\n runWorker: true,\n });\n };\n\n handleRunWorkSafe = () => this.runWork(false);\n\n handleRunWorkUnsafe = () => this.runWork(true);\n\n handleWorkerClosed = () => this.setState({ runWorker: false });\n\n render() {\n return (\n \n \n Вставьте ссылку на лист Google Таблицы с оценками\n
\n \n\n \n Загруженные дисциплины из Google Таблицы
\n {this.state.missedDisciplinesCount > 0 && (\n \n Группы, к которым у вас нет доступа в БРС,{\" \"}\n подсвечены\n
\n )}\n\n , ]}\n />\n\n {this.state.allDisciplinesMissed ? (\n \n У вас нет доступа ни к одной из перечисленных групп в БРС
\n Возможные действия:\n \n - \n Убедитесь, что название дисциплины в БРС и в Google Таблицах\n совпадает\n
\n - Запросите доступ на дисциплину в БРС
\n - Убедитесь, что техкарта согласована в БРС
\n - \n \n
\n
\n \n ) : (\n \n \n Если вам доступны не все группы, которые вам доступны в БРС, то{\" \"}\n \n
\n \n \n \n \n )}\n \n {this.state.runWorker && (\n \n )}\n \n );\n }\n}\n\nexport default memo(GoogleTableFetch);\n\ninterface Props {\n brsApi: BrsApi;\n onError: (errorMessage: string) => void;\n}\n\ninterface State {\n tableUrl: string;\n loading: boolean;\n showDisciplines: boolean;\n lastAction: LastAction;\n tableUrlError: { error: boolean; message: string };\n disciplines: NestedItem[];\n allDisciplinesMissed: boolean;\n missedDisciplinesCount: number;\n showWorkerButtons: boolean;\n runWorker: boolean;\n}\n","export default class ReportManager {\n private _currentReport: TReport | null = null;\n private readonly onReportFinished: (report: TReport) => void;\n\n readonly onInvalidConfiguration: (errorMessages: string[]) => void;\n\n constructor(\n onReportFinished: (report: TReport) => void,\n onInvalidConfiguration: (errorMessages: string[]) => void\n ) {\n this.onReportFinished = onReportFinished;\n this.onInvalidConfiguration = onInvalidConfiguration;\n }\n\n get currentReport() {\n if (!this._currentReport)\n throw new Error(\"Построение отчета еще не начато\");\n return this._currentReport;\n }\n\n newReport(report: TReport) {\n this.finishReport();\n this._currentReport = report\n }\n\n finishReport() {\n if (this._currentReport) this.onReportFinished(this._currentReport);\n this._currentReport = null;\n }\n\n cancelReport() {\n this._currentReport = null;\n }\n}\n","import React from \"react\";\nimport \"./styles.css\";\nimport { withStyles } from \"@material-ui/core/styles\";\nimport { Dialog } from \"@material-ui/core\";\nimport MuiDialogTitle from \"@material-ui/core/DialogTitle\";\nimport MuiDialogContent from \"@material-ui/core/DialogContent\";\nimport MuiDialogActions from \"@material-ui/core/DialogActions\";\nimport SubmitWithLoading from \"../../shared/SubmitWithLoading\";\nimport MarksManager from \"../../../managers/MarksManager\";\nimport BrsApi, { Discipline, TermType } from \"../../../apis/BrsApi\";\nimport { SpreadsheetData } from \"../../../managers/SpreadsheetManager\";\nimport NestedList, { NestedItem } from \"../../shared/NestedList\";\nimport ReportManager from \"../../../managers/ReportManager\";\nimport { pluralize } from \"../../../helpers/tools\";\nimport { BrsReport } from \"../../../managers/BrsReport\";\n\nconst DialogContent = withStyles(() => ({\n root: {\n padding: 0,\n },\n}))(MuiDialogContent);\n\nconst DialogActions = withStyles(() => ({\n root: {\n display: \"flex\",\n justifyContent: \"space-around\",\n },\n}))(MuiDialogActions);\n\nexport default class WorkerDialog extends React.Component {\n marksManager: MarksManager;\n\n constructor(props: Props) {\n super(props);\n\n const { brsApi, save } = props;\n const reportManager = new ReportManager(\n this.logMessage,\n this.logConfigurationErrors\n );\n this.marksManager = new MarksManager(brsApi, reportManager, save);\n\n this.state = {\n okLoading: true,\n cancelPending: false,\n logItems: [],\n };\n }\n\n componentDidMount() {\n this.startWork();\n }\n\n componentWillUnmount() {\n this.marksManager.cancel();\n }\n\n logConfigurationErrors = (errorMessages: string[]) => {\n const logItems = errorMessages.map((title) => ({ title, colored: true }));\n this.setState({ logItems });\n };\n\n logMessage = async (report: BrsReport) => {\n const logItems = await this.reportToNestedListItems(report);\n this.setState({ logItems });\n };\n\n reportToNestedListItems(report: BrsReport): Promise {\n const logItems = this.state.logItems;\n return new Promise((resolve) => {\n const disciplineConfig = report.disciplineConfig;\n const disciplineTime =\n disciplineConfig.termType === TermType.Fall\n ? `осень ${disciplineConfig.year}`\n : disciplineConfig.termType === TermType.Spring\n ? `весна ${disciplineConfig.year + 1}`\n : `${disciplineConfig.year}/${disciplineConfig.year + 1}`;\n let title = `Группа ${report.discipline.group} (${disciplineTime}, ${disciplineConfig.course} курс)`;\n\n const nestedItems: NestedItem[] = [];\n const mainItem: NestedItem = { title, collapsed: true, nestedItems };\n\n let hasErrors = false;\n\n const merge = report.merge;\n let mergeResultsTitle = `Сопоставление: ${merge.succeed} успешно`;\n const failedActualCount = merge.failedActual?.length || 0;\n mergeResultsTitle += `, ${failedActualCount} ${pluralize(\n failedActualCount,\n \"неизвестный\",\n \"неизвестных\",\n \"неизвестных\"\n )} в таблице`;\n const failedBrsCount = merge.failedBrs?.length || 0;\n mergeResultsTitle += `, ${failedBrsCount} ${pluralize(\n failedBrsCount,\n \"неизвестный\",\n \"неизвестных\",\n \"неизвестных\"\n )} в БРС`;\n\n const mergeInfoItem: NestedItem = {\n title: mergeResultsTitle,\n nestedItems: [],\n collapsed: true,\n };\n nestedItems.push(mergeInfoItem);\n\n if (!!merge.failedActual) {\n hasErrors = true;\n title = `Не удалось сопоставить ${\n merge.failedActual.length\n } ${pluralize(\n merge.failedActual.length,\n \"студента\",\n \"студентов\",\n \"студентов\"\n )} из Google Таблицы`;\n mergeInfoItem.nestedItems?.push({\n title,\n nestedItems: merge.failedActual.map((s) => ({ title: s })),\n colored: true,\n collapsed: false,\n renderAsText: true,\n });\n }\n if (!!merge.failedBrs) {\n hasErrors = true;\n title = `Не удалось сопоставить ${merge.failedBrs.length} ${pluralize(\n merge.failedBrs.length,\n \"студента\",\n \"студентов\",\n \"студентов\"\n )} из БРС`;\n mergeInfoItem.nestedItems?.push({\n title,\n nestedItems: merge.failedBrs.map((s) => ({ title: s })),\n colored: true,\n collapsed: false,\n renderAsText: true,\n });\n }\n\n const marks = report.marks;\n const marksItem: NestedItem = {\n title: \"Выставление баллов\",\n collapsed: true,\n };\n marksItem.nestedItems = marks.map(({ title, students, failed }) => ({\n title: `${title}: ${students?.length ?? 0} ${pluralize(\n students?.length ?? 0,\n \"студент\",\n \"студента\",\n \"студентов\"\n )}`,\n nestedItems: students?.map((s) => ({ title: s })),\n colored: !!failed,\n collapsed: false,\n renderAsText: true,\n }));\n nestedItems.push(marksItem);\n hasErrors =\n hasErrors || marks.filter(({ failed }) => !!failed).length > 0;\n\n const skipped = report.skipped;\n if (skipped.length > 0) {\n const skippedItem: NestedItem = {\n title: \"Неизвестные студенты из БРС\",\n collapsed: true,\n };\n skippedItem.nestedItems = skipped.map(({ title, students }) => ({\n title: `${title}: ${students?.length ?? 0} ${pluralize(\n students?.length ?? 0,\n \"студент\",\n \"студента\",\n \"студентов\"\n )}`,\n nestedItems: students?.map((s) => ({ title: s })),\n collapsed: false,\n renderAsText: true,\n }));\n nestedItems.push(skippedItem);\n }\n\n if (hasErrors) {\n mainItem.colored = true;\n }\n logItems.push(mainItem);\n\n resolve(logItems);\n });\n }\n\n startWork = async () => {\n for (const marksData of this.props.marksDatas) {\n const { spreadsheetData, suitableDisciplines } = marksData;\n\n const error = await this.marksManager.putMarksToBrsAsync(\n spreadsheetData,\n suitableDisciplines\n );\n\n if (error) {\n if (typeof error === \"object\") {\n this.props.onError(error.toString());\n } else if (typeof error === \"string\") {\n this.props.onError(error);\n }\n }\n }\n\n this.setState({\n cancelPending: false,\n okLoading: false,\n });\n };\n\n cancelWork = () => {\n this.setState({ cancelPending: true });\n this.marksManager.cancel();\n };\n\n render() {\n return (\n \n \n \n );\n }\n}\n\nexport interface MarksData {\n spreadsheetData: SpreadsheetData;\n suitableDisciplines: Discipline[];\n}\n\ninterface Props {\n marksDatas: MarksData[];\n brsApi: BrsApi;\n save: boolean;\n onClosed: () => void;\n onError: (errorMessage: string) => void;\n}\n\ninterface State {\n okLoading: boolean;\n cancelPending: boolean;\n logItems: NestedItem[];\n}\n","import { TextField } from \"@material-ui/core\";\nimport SubmitWithLoading from \"../../shared/SubmitWithLoading\";\nimport React, { FormEvent, useState } from \"react\";\nimport { TABLE_URL_PATTERN, TABLE_TEMPLATE_URL } from \"../../../Constants\";\n\nexport default function GoogleTableFetchForm({ loading, onSubmit }: Props) {\n const [tableUrl, setTableUrl] = useState(\"\");\n const [urlError, setUrlError] = useState(null as null | string);\n\n const handleUrlChanged = (event: React.ChangeEvent<{ value: string }>) => {\n const target = event.target;\n if (urlError) setUrlError(null);\n setTableUrl(target.value);\n };\n\n const handleSubmit = (e: FormEvent) => {\n e.preventDefault();\n\n const regExp =\n /d\\/(?[a-zA-Z0-9-_]+)\\/edit(#gid=(?[0-9]+))?/;\n const spreadsheetInfo = tableUrl.match(regExp);\n\n if (!spreadsheetInfo?.groups || !spreadsheetInfo.groups.spreadsheetId) {\n setUrlError(\"Неверный url-адрес.\");\n return null;\n }\n\n const spreadsheetId = spreadsheetInfo.groups.spreadsheetId;\n const maybeSheetId = spreadsheetInfo.groups.sheetId || null;\n\n onSubmit(spreadsheetId, maybeSheetId);\n };\n\n return (\n \n );\n}\n\ninterface Props {\n loading: boolean;\n onSubmit: (spreadsheetId: string, sheetId: string | null) => void;\n}\n","import React from \"react\";\nimport {\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogContentText,\n DialogTitle,\n Slide,\n} from \"@material-ui/core\";\nimport { TransitionProps } from \"@material-ui/core/transitions\";\n\nconst Transition = React.forwardRef(function Transition(\n props: TransitionProps & { children?: React.ReactElement },\n ref: React.Ref\n) {\n return ;\n});\n\nexport default function SessionExpiredAlert({\n open,\n sessionName,\n onOk,\n}: Props) {\n return (\n \n \n \n );\n}\n\ninterface Props {\n open: boolean;\n sessionName: string;\n onOk: () => void;\n}\n","import React from \"react\";\nimport \"./styles.css\";\nimport { CircularProgress } from \"@material-ui/core\";\n\nexport default function LoadingPane() {\n return (\n \n \n
\n );\n}\n","import React from \"react\";\nimport { Button, Container } from \"@material-ui/core\";\nimport GoogleTableFetch from \"../GoogleTableFetch\";\nimport BrsApi from \"../../../apis/BrsApi\";\nimport SessionExpiredAlert from \"../../shared/SessionExpiredAlert\";\nimport CustomAlert from \"../../shared/CustomAlert\";\nimport GoogleAuth from \"../../../apis/GoogleAuth\";\nimport BrsAuth from \"../../../apis/BrsAuth\";\nimport { StatusCode } from \"../../../helpers/CustomError\";\nimport LoadingPane from \"../LoadingPane\";\nimport { Redirect } from \"react-router-dom\";\n\nexport default class WorkPage extends React.Component {\n constructor(props: Props) {\n super(props);\n\n this.state = {\n showControls: false,\n runWork: false,\n openSessionExpiredAlert: false,\n sessionName: \"\",\n errorMessage: \"\",\n loading: true,\n redirect: false,\n };\n }\n\n async componentDidMount() {\n await this.props.googleAuth.ensureInitializedAsync();\n await this.props.brsAuth.tryRestoreAsync();\n\n const brsAuthorized = this.props.brsAuth.checkAuth();\n if (!brsAuthorized) this.handleSessionExpired(\"БРС\");\n\n const googleAuthorized = this.props.googleAuth.checkAuthorized();\n if (!googleAuthorized) {\n setTimeout(() => {\n const googleAuthorized = this.props.googleAuth.checkAuthorized();\n if (!googleAuthorized) this.handleSessionExpired(\"Google\");\n else this.setState({ loading: false });\n }, 1000);\n } else {\n this.setState({ loading: false });\n }\n }\n\n handleError = (error: any) => {\n const errorMessage: string = error.message || JSON.stringify(error);\n if (error.statusCode)\n if (error.statusCode === StatusCode.BrsUnauthorized)\n this.handleSessionExpired(\"БРС\");\n else this.handleSessionExpired(\"Google\");\n else if (error.name === \"RequestError\")\n this.setState({\n errorMessage: \"В данный момент сервер недоступен. Попробуйте позже.\",\n });\n else this.setState({ errorMessage });\n };\n\n handleSessionExpired = (sessionName: SessionName) => {\n this.setState({\n openSessionExpiredAlert: true,\n sessionName,\n loading: false,\n });\n };\n\n handleSessionExpiredOk = () => {\n if (this.state.sessionName === \"БРС\") {\n this.props.brsAuth.logout();\n this.returnToLoginPage();\n this.setState({ redirect: true });\n } else if (this.state.sessionName === \"Google\") {\n this.returnToLoginPage();\n }\n };\n\n closeError = () => {\n this.setState({ errorMessage: \"\" });\n };\n\n returnToLoginPage = () => {\n this.setState({ redirect: true });\n };\n\n render() {\n return (\n \n {this.state.loading && }\n \n {this.state.errorMessage && (\n \n )}\n {this.state.redirect && }\n \n \n \n \n \n
\n \n );\n }\n}\n\ntype SessionName = \"БРС\" | \"Google\";\n\ninterface State {\n showControls: boolean;\n openSessionExpiredAlert: boolean;\n sessionName: SessionName | \"\";\n errorMessage: string;\n runWork: boolean;\n loading: boolean;\n redirect: boolean;\n}\n\ninterface Props {\n brsAuth: BrsAuth;\n brsApi: BrsApi;\n googleAuth: GoogleAuth;\n}\n","import React from \"react\";\nimport Context from \"../../Context\";\nimport WorkPage from \"./WorkPage\";\n\nexport default function WorkPageContainer() {\n return (\n \n {(context) =>\n context && (\n \n )\n }\n \n );\n}\n","import React from \"react\";\nimport { HashRouter, Route, Switch } from \"react-router-dom\";\nimport BrsUrlProvider from \"./apis/BrsUrlProvider\";\nimport BrsAuth from \"./apis/BrsAuth\";\nimport GoogleAuth from \"./apis/GoogleAuth\";\nimport LoginPageContainer from \"./components/login/LoginPageContainer\";\nimport WorkPageContainer from \"./components/work/WorkPageContainer\";\nimport BrsApi from \"./apis/BrsApi\";\nimport Context from \"./Context\";\n\nconst urlProvider = new BrsUrlProvider(true);\nconst brsAuth = new BrsAuth(urlProvider);\nconst brsApi = new BrsApi(brsAuth, urlProvider);\nconst googleAuth = new GoogleAuth();\n\nexport default function App() {\n return (\n \n \n \n \n \n \n \n \n );\n}\n","import { ReportHandler } from \"web-vitals\";\n\nconst reportWebVitals = (onPerfEntry?: ReportHandler) => {\n if (onPerfEntry && onPerfEntry instanceof Function) {\n import(\"web-vitals\").then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {\n getCLS(onPerfEntry);\n getFID(onPerfEntry);\n getFCP(onPerfEntry);\n getLCP(onPerfEntry);\n getTTFB(onPerfEntry);\n });\n }\n};\n\nexport default reportWebVitals;\n","import React from \"react\";\nimport ReactDOM from \"react-dom\";\nimport App from \"./App\";\nimport reportWebVitals from \"./reportWebVitals\";\n\nimport \"./index.css\";\n\nReactDOM.render(, document.getElementById(\"root\"));\n\n// If you want to start measuring performance in your app, pass a function\n// to log results (for example: reportWebVitals(console.log))\n// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals\nreportWebVitals();\n"],"sourceRoot":""}
\ No newline at end of file
diff --git a/static/js/main.303a61b2.chunk.js b/static/js/main.e9790dc5.chunk.js
similarity index 99%
rename from static/js/main.303a61b2.chunk.js
rename to static/js/main.e9790dc5.chunk.js
index cc25234..8dfa68e 100644
--- a/static/js/main.303a61b2.chunk.js
+++ b/static/js/main.e9790dc5.chunk.js
@@ -1,2 +1,2 @@
-(this["webpackJsonpbrs-extensions"]=this["webpackJsonpbrs-extensions"]||[]).push([[0],{314:function(e,t){},316:function(e,t){},325:function(e,t){},327:function(e,t){},352:function(e,t){},354:function(e,t){},355:function(e,t){},360:function(e,t){},362:function(e,t){},368:function(e,t){},370:function(e,t){},389:function(e,t){},401:function(e,t){},404:function(e,t){},430:function(e,t){},525:function(e,t,u){},526:function(e,t,u){},531:function(e,t,u){},533:function(e,t,u){},534:function(e,t,u){},535:function(e,t,u){},540:function(e,t,u){},541:function(e,t,u){},542:function(e,t,u){"use strict";u.r(t);var n,r,a=u(0),s=u.n(a),i=u(19),c=u.n(i),o=u(120),D=u(28),l=u(22),d=u(21),p="https://docs.google.com/spreadsheets/d/1Owzl3JfmFASIdC7ZMMw-0kkA3pwFSab1QdVO5dhZoxY/edit#gid=675912523",F="https://brs.urfu.ru/mrd",h=function(){function e(t){Object(l.a)(this,e),this.withProxy=void 0,this.withProxy=t}return Object(d.a)(e,[{key:"baseUrl",get:function(){return this.withProxy?"".concat("https://bbamc5stve2edro7t455.containers.yandexcloud.net","/").concat(F):F}}]),e}(),f=u(3),C=u.n(f),b=u(7),v=u(103),m=u.n(v);function g(e,t,u){if(!t)return!1;var r=JSON.stringify(t);return u!==n.Local&&u!==n.LocalAndSession||localStorage.setItem(e,r),u!==n.Session&&u!==n.LocalAndSession||sessionStorage.setItem(e,r),!0}function E(e,t){var u,r=null;if(t===n.Local&&(r=localStorage.getItem(e)),t===n.Session&&(r=sessionStorage.getItem(e)),t===n.LocalAndSession&&(r=null!==(u=sessionStorage.getItem(e))&&void 0!==u?u:localStorage.getItem(e)),!r)return null;var a=JSON.parse(r);return a||null}function A(e,t){return t!==n.Local&&t!==n.LocalAndSession||localStorage.removeItem(e),t!==n.Session&&t!==n.LocalAndSession||sessionStorage.removeItem(e),!0}!function(e){e[e.Local=0]="Local",e[e.Session=1]="Session",e[e.LocalAndSession=2]="LocalAndSession"}(n||(n={})),function(e){e[e.BrsUnauthorized=1]="BrsUnauthorized",e[e.GoogleUnauthorized=2]="GoogleUnauthorized"}(r||(r={}));var y,x=function e(t){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";Object(l.a)(this,e),this.message=void 0,this.statusCode=void 0,this.statusCode=t,this.message=u};!function(e){e[e.Succeed=0]="Succeed",e[e.InvalidCredentials=1]="InvalidCredentials",e[e.Error=2]="Error"}(y||(y={}));var j=function(){function e(t){Object(l.a)(this,e),this.brsUrlProvider=void 0,this._sid=null,this._safeUserName=null,this._userName="Anonymous",this.brsUrlProvider=t}return Object(d.a)(e,[{key:"sid",get:function(){if(!this._sid)throw new x(r.BrsUnauthorized,"\u041d\u0435\u0442 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u0411\u0420\u0421");return this._sid}},{key:"safeUserName",get:function(){if(!this._safeUserName)throw new x(r.BrsUnauthorized,"\u041d\u0435\u0442 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u0411\u0420\u0421");return this._safeUserName}},{key:"userName",get:function(){return this._userName}},{key:"checkAuth",value:function(){return!(!this._sid||!this._safeUserName)}},{key:"tryRestoreAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(){var t,u;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._sid||!this._safeUserName){e.next=2;break}return e.abrupt("return");case 2:if(!(t=E("loginInfo",n.Session))){e.next=6;break}return this.saveLoginInfo(t.sid,t.userName),e.abrupt("return");case 6:if(t=E("loginInfo",n.Local)){e.next=9;break}return e.abrupt("return");case 9:return e.next=11,this.checkSidAsync(t.sid);case 11:(null===(u=e.sent)||void 0===u?void 0:u.success)&&this.saveLoginInfo(t.sid,t.userName);case 13:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"checkSidAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t){var u,n;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,m()({method:"GET",url:this.brsUrlProvider.baseUrl+"/mvc/mobile",headers:{"X-Cookie":"JSESSIONID=".concat(t),"X-Requested-With":"XMLHttpRequest"}});case 3:if(u=e.sent,!(n=u.match(/username">([\u0410-\u042f\u0401\u0430-\u044f\u0451 -]+)))){e.next=7;break}return e.abrupt("return",{success:!0,userName:n[1]});case 7:return e.abrupt("return",{success:!1,userName:"Anonymous"});case 10:return e.prev=10,e.t0=e.catch(0),e.abrupt("return",null);case 13:case"end":return e.stop()}}),e,this,[[0,10]])})));return function(t){return e.apply(this,arguments)}}()},{key:"loginAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u){var n,r,a,s,i;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.requestSidAsync(t,u);case 2:if((n=e.sent)&&"x-set-cookie"in n.headers){e.next=5;break}return e.abrupt("return",y.Error);case 5:if(r=n.headers["x-set-cookie"],a=r.match(/(?<=JSESSIONID=)\w+/)){e.next=9;break}return e.abrupt("return",y.Error);case 9:return s=a[0],e.next=12,this.checkSidAsync(s);case 12:if(null!==(i=e.sent)){e.next=15;break}return e.abrupt("return",y.Error);case 15:if(i.success){e.next=17;break}return e.abrupt("return",y.InvalidCredentials);case 17:return this.saveLoginInfo(s,i.userName),e.abrupt("return",y.Succeed);case 19:case"end":return e.stop()}}),e,this)})));return function(t,u){return e.apply(this,arguments)}}()},{key:"authBySidAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t){var u;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return",y.InvalidCredentials);case 2:return e.next=4,this.checkSidAsync(t);case 4:if(null!==(u=e.sent)){e.next=7;break}return e.abrupt("return",y.Error);case 7:if(u.success){e.next=9;break}return e.abrupt("return",y.InvalidCredentials);case 9:return this.saveLoginInfo(t,u.userName),e.abrupt("return",y.Succeed);case 11:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"saveLoginInfo",value:function(e,t){var u=t.replaceAll(/[^A-Za-z\u0410-\u042f\u0401\u0430-\u044f\u0451]/g,"_");g("loginInfo",{sid:e,safeUserName:u,userName:t},n.LocalAndSession),this._sid=e,this._safeUserName=u,this._userName=t}},{key:"logout",value:function(){this._sid=null,this._safeUserName=null,A("loginInfo",n.LocalAndSession)}},{key:"requestSidAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u){return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,m()({url:this.brsUrlProvider.baseUrl+"/login",method:"POST",body:"username=".concat(t,"&password=").concat(u),resolveWithFullResponse:!0,simple:!1,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}).then((function(e){return e}),(function(){return null}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})));return function(t,u){return e.apply(this,arguments)}}()}]),e}(),k=["https://sheets.googleapis.com/$discovery/rest?version=v4"],O=function(){function e(){Object(l.a)(this,e)}return Object(d.a)(e,[{key:"ensureInitializedAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(){return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!gapi.client){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,new Promise((function(e){gapi.load("client:auth2",e)}));case 4:gapi.client.init({clientId:"122993083593-pacve8csj86voko30ia65raeg0ncrtuv.apps.googleusercontent.com",discoveryDocs:k,scope:"profile email https://www.googleapis.com/auth/spreadsheets"}).catch(console.error);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()},{key:"listenAuthorized",value:function(e){var t,u,n;null===(t=gapi.auth2)||void 0===t||null===(u=t.getAuthInstance())||void 0===u||null===(n=u.isSignedIn)||void 0===n||n.listen(e)}},{key:"checkAuthorized",value:function(){var e,t,u;return null===(e=gapi.auth2)||void 0===e||null===(t=e.getAuthInstance())||void 0===t||null===(u=t.isSignedIn)||void 0===u?void 0:u.get()}},{key:"getUserName",value:function(){var e,t,u,n,r=null===(e=gapi.auth2)||void 0===e||null===(t=e.getAuthInstance())||void 0===t||null===(u=t.currentUser)||void 0===u||null===(n=u.get())||void 0===n?void 0:n.getBasicProfile();return(null===r||void 0===r?void 0:r.getName())||(null===r||void 0===r?void 0:r.getEmail())}},{key:"logout",value:function(){var e=Object(b.a)(C.a.mark((function e(){var t,u;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(t=gapi.auth2)||void 0===t||null===(u=t.getAuthInstance())||void 0===u?void 0:u.signOut();case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()}]),e}(),B=Object(a.createContext)(null),S=u(50),w=u(67),N=(u(525),u(574)),I=u(582),M=u(27),L=u(597),T=u(578),U=(u(526),u(2));function W(e){var t=e.title,u=e.loading,n=e.className,r=e.onClick,a=e.disabled,s=void 0!==a&&a;return Object(U.jsxs)("div",{className:"submit-with-loading "+n,children:[Object(U.jsx)(N.a,{type:"submit",fullWidth:!0,variant:"contained",color:"primary",onClick:r,disabled:u||s,children:t}),u&&Object(U.jsx)(T.a,{color:"secondary",size:24,className:"button-progress"})]})}u(531);function R(e){var t=e.onSubmit,u=e.submitting,n=e.loading,r=e.signedIn,a=e.onLogout,i=e.userName,c=s.a.useState(""),o=Object(M.a)(c,2),D=o[0],l=o[1],d=s.a.useState(""),p=Object(M.a)(d,2),F=p[0],h=p[1],f=s.a.useState(""),C=Object(M.a)(f,2),b=C[0],v=C[1];return r?Object(U.jsxs)(s.a.Fragment,{children:[Object(U.jsxs)("p",{children:["\u0414\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c, ",i]}),Object(U.jsx)(N.a,{type:"button",fullWidth:!0,variant:"contained",onClick:a,color:"primary",children:"\u0412\u044b\u0439\u0442\u0438 \u0438\u0437 \u0411\u0420\u0421"})]}):Object(U.jsxs)("div",{className:"brs-login-form",children:[Object(U.jsxs)("p",{children:[Object(U.jsx)("b",{children:"\u0412\u043e\u0439\u0434\u0438\u0442\u0435 \u0432 \u0411\u0420\u0421"}),", \u0447\u0442\u043e\u0431\u044b \u0441\u0435\u0440\u0432\u0438\u0441 \u043c\u043e\u0433 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0432\u0430\u0448\u0438\u0445 \u043a\u0443\u0440\u0441\u0430\u0445 \u0438 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043e\u0446\u0435\u043d\u043a\u0438 \u043e\u0442 \u0432\u0430\u0448\u0435\u0433\u043e \u0438\u043c\u0435\u043d\u0438"]}),Object(U.jsx)("p",{children:"\u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0443\u0447\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0411\u0420\u0421"}),Object(U.jsxs)("form",{className:"form",onSubmit:function(e){e.preventDefault(),n||t({login:D,password:F,sid:b})},children:[Object(U.jsx)(L.a,{className:"form-component",variant:"outlined",margin:"normal",fullWidth:!0,id:"username",label:"\u0418\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f",name:"username",autoFocus:!0,value:D,disabled:n,onChange:function(e){var t=e.target.value;l(t),v("")}}),Object(U.jsx)(L.a,{className:"form-component",variant:"outlined",margin:"normal",fullWidth:!0,name:"password",label:"\u041f\u0430\u0440\u043e\u043b\u044c",type:"password",id:"password",autoComplete:"current-password",value:F,disabled:n,onChange:function(e){var t=e.target.value;h(t),v("")}}),Object(U.jsx)("p",{className:"form-component text-align-center",children:"\u0438\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 JSESSIONID \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0435\u0434\u0438\u043d\u043e\u0439 \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0423\u0440\u0424\u0423"}),Object(U.jsx)(L.a,{className:"form-component",variant:"outlined",margin:"normal",fullWidth:!0,name:"sid",label:"JSESSIONID",type:"password",id:"sid",value:b,disabled:n,onChange:function(e){var t=e.target.value;v(t),l(""),h("")}}),Object(U.jsx)("a",{href:"https://docs.google.com/document/d/1btXePo-5bE8RyX7RFXnBuS-UN9SmwUithpc_UXhAWsg/edit",className:"button-link",target:"_blank",rel:"noreferrer",children:"\u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c JSESSIONID"}),Object(U.jsx)(W,{className:"vertical-margin-medium",title:"\u0432\u043e\u0439\u0442\u0438",loading:u,disabled:n})]}),n&&Object(U.jsx)(T.a,{color:"primary",size:150,className:"progress"})]})}var P=u(269),G=u.n(P);function _(e){var t=e.onSignedIn,u=e.onFailure,n=e.signedIn,r=e.userName,a=e.onLogout;return Object(U.jsx)(s.a.Fragment,{children:n?Object(U.jsxs)(I.a,{className:"text-align-center",children:[Object(U.jsxs)("p",{children:["\u0414\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c, ",r]}),Object(U.jsx)(N.a,{type:"button",fullWidth:!0,variant:"contained",onClick:a,color:"primary",children:"\u0412\u044b\u0439\u0442\u0438 \u0438\u0437 Google"})]}):Object(U.jsxs)(I.a,{className:"text-align-center",children:[Object(U.jsxs)("p",{children:[Object(U.jsx)("b",{children:"\u0412\u043e\u0439\u0434\u0438\u0442\u0435 \u0432 Google"}),", \u0447\u0442\u043e\u0431\u044b \u0441\u0435\u0440\u0432\u0438\u0441 \u043c\u043e\u0433 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u043e\u0446\u0435\u043d\u043a\u0438 \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 \u0432\u0430\u0448\u0438\u0445 Google\xa0\u0422\u0430\u0431\u043b\u0438\u0446"]}),Object(U.jsx)(G.a,{clientId:"122993083593-pacve8csj86voko30ia65raeg0ncrtuv.apps.googleusercontent.com",buttonText:"\u0412\u043e\u0439\u0442\u0438 \u0432 \u0430\u043a\u043a\u0430\u0443\u043d\u0442 Google",onSuccess:t,onFailure:u,scope:"profile email https://www.googleapis.com/auth/spreadsheets",isSignedIn:!0})]})})}var z=u(54),J=u(598),q=u(600);function X(e){var t=e.open,u=e.message,n=e.type,r=e.onClose;return Object(U.jsx)(s.a.Fragment,{children:Object(U.jsx)(q.a,{open:t,autoHideDuration:1e4,anchorOrigin:{vertical:"top",horizontal:"center"},onClose:r,children:Object(U.jsx)(H,{severity:n,onClose:r,children:u})})})}function H(e){return Object(U.jsx)(J.a,Object(z.a)({elevation:6,variant:"filled"},e))}var V=function(e){Object(S.a)(u,e);var t=Object(w.a)(u);function u(e){var n;return Object(l.a)(this,u),(n=t.call(this,e)).handleBrsSubmit=function(){var e=Object(b.a)(C.a.mark((function e(t){var u;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.setState({submitLoading:!0}),e.next=3,n.loginBrsAsync(t);case 3:u=e.sent,n.setState({submitLoading:!1}),e.t0=u,e.next=e.t0===y.Succeed?8:e.t0===y.Error?10:e.t0===y.InvalidCredentials?12:13;break;case 8:return n.setState({alertMessage:"\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0448\u043b\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e",openAlert:!0,alertType:"success",brsAuthorized:!0}),e.abrupt("break",13);case 10:return n.setState({alertMessage:"\u0427\u0442\u043e-\u0442\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a :( \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043f\u043e\u0437\u0436\u0435",openAlert:!0,alertType:"error"}),e.abrupt("break",13);case 12:n.setState({alertMessage:"\u041d\u0435\u0432\u0435\u0440\u043d\u044b\u0435 \u043b\u043e\u0433\u0438\u043d, \u043f\u0430\u0440\u043e\u043b\u044c \u0438\u043b\u0438 JSESSIONID",openAlert:!0,alertType:"error"});case 13:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),n.loginBrsAsync=function(){var e=Object(b.a)(C.a.mark((function e(t){return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.sid){e.next=4;break}return e.next=3,n.props.brsAuth.authBySidAsync(t.sid);case 3:return e.abrupt("return",e.sent);case 4:if(!t.login||!t.password){e.next=8;break}return e.next=7,n.props.brsAuth.loginAsync(t.login,t.password);case 7:return e.abrupt("return",e.sent);case 8:return e.abrupt("return",y.InvalidCredentials);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),n.handleCloseAlert=function(){n.setState({openAlert:!1})},n.handleGoogleSignedIn=function(){n.setState({googleAuthorized:!0})},n.handleGoogleLoginFailed=function(e){console.error(e),n.setState({openAlert:!0,alertType:"error",alertMessage:"\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0412\u0430\u0448 Google \u0430\u043a\u043a\u0430\u0443\u043d\u0442 :("})},n.startWork=function(){n.setState({redirect:!0})},n.handleBrsLogout=function(){n.props.brsAuth.logout(),n.setState({brsAuthorized:!1,alertMessage:"\u0412\u044b \u0432\u044b\u0448\u043b\u0438 \u0438\u0437 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430 \u0411\u0420\u0421",alertType:"success",openAlert:!0})},n.handleGoogleLogout=Object(b.a)(C.a.mark((function e(){return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.props.googleAuth.logout();case 2:n.setState({googleAuthorized:!1,alertType:"success",alertMessage:"\u0412\u044b \u0432\u044b\u0448\u043b\u0438 \u0438\u0437 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430 Google",openAlert:!0});case 3:case"end":return e.stop()}}),e)}))),n.renderGreeting=function(){return Object(U.jsxs)("div",{className:"greeting",children:[Object(U.jsx)("h2",{children:"\u0414\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u0432 \u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0411\u0420\u0421"}),Object(U.jsx)("h3",{className:"block-header",children:"\u041a\u0430\u043a \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442"}),Object(U.jsxs)("ol",{children:[Object(U.jsxs)("li",{children:["\u0412 Google\xa0\u0422\u0430\u0431\u043b\u0438\u0446\u0430\u0445 \u0432\u044b \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0435 \u043e\u0446\u0435\u043d\u043a\u0438 \u0437\u0430 \u043a\u0443\u0440\u0441 \u043f\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443"," ",Object(U.jsx)("a",{href:p,target:"_blank",rel:"noreferrer",className:"button-link",children:"\u0448\u0430\u0431\u043b\u043e\u043d\u0443"})]}),Object(U.jsx)("li",{children:"\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0435 Google \u0422\u0430\u0431\u043b\u0438\u0446\u0443 \u0432 \u0441\u0435\u0440\u0432\u0438\u0441 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0435 \u043f\u0440\u043e\u0431\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0446\u0435\u043d\u043e\u043a, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438"}),Object(U.jsx)("li",{children:"\u041d\u0430\u043a\u043e\u043d\u0435\u0446 \u0434\u0435\u043b\u0430\u0435\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u043a \u0441 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u043e\u0446\u0435\u043d\u043e\u043a"})]}),Object(U.jsx)("h3",{className:"block-header",children:"\u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445"}),Object(U.jsxs)("p",{children:["\u0412\u0430\u0448 \u043b\u043e\u0433\u0438\u043d \u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u0411\u0420\u0421 \u0438 \u043d\u0438\u0433\u0434\u0435 \u043d\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f",Object(U.jsx)("br",{}),"\u0414\u0430\u043d\u043d\u044b\u0435 \u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0432\u0430\u043c \u043a\u0443\u0440\u0441\u0430\u0445 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0432\u0430\u0448\u0435\u043c \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435"]}),Object(U.jsx)("hr",{})]})},n.renderBrsLogin=function(){return Object(U.jsx)(R,{onSubmit:n.handleBrsSubmit,loading:n.state.brsLoading,signedIn:n.state.brsAuthorized,onLogout:n.handleBrsLogout,userName:n.props.brsAuth.userName,submitting:n.state.submitLoading})},n.renderGoogleLogin=function(){return Object(U.jsx)(_,{onSignedIn:n.handleGoogleSignedIn,signedIn:n.state.googleAuthorized,userName:n.props.googleAuth.getUserName(),onLogout:n.handleGoogleLogout,onFailure:n.handleGoogleLoginFailed})},n.renderStartWorkButton=function(){return Object(U.jsx)(N.a,{variant:"contained",onClick:n.startWork,disabled:!n.state.brsAuthorized||!n.state.googleAuthorized,color:"secondary",children:"\u043d\u0430\u0447\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443"})},n.state={brsLoading:!0,brsAuthorized:!1,googleAuthorized:!1,redirect:!1,submitLoading:!1,openAlert:!1,alertMessage:"",alertType:"error"},n}return Object(d.a)(u,[{key:"componentDidMount",value:function(){var e=Object(b.a)(C.a.mark((function e(){var t,u,n=this;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.props.googleAuth.ensureInitializedAsync();case 2:return e.next=4,this.props.brsAuth.tryRestoreAsync();case 4:this.props.googleAuth.listenAuthorized((function(e){n.setState({googleAuthorized:e})})),t=this.props.brsAuth.checkAuth(),u=this.props.googleAuth.checkAuthorized(),this.setState({brsLoading:!1,brsAuthorized:t,googleAuthorized:u});case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"render",value:function(){return Object(U.jsxs)("div",{className:"login-page",children:[this.state.redirect&&Object(U.jsx)(D.a,{to:"/work"}),Object(U.jsxs)(I.a,{component:"main",maxWidth:"md",children:[this.renderGreeting(),Object(U.jsxs)(I.a,{maxWidth:"xs",children:[Object(U.jsx)(I.a,{children:this.renderBrsLogin()}),Object(U.jsx)("hr",{className:"vertical-margin-medium"}),Object(U.jsx)(I.a,{children:this.renderGoogleLogin()})]}),Object(U.jsx)(I.a,{className:"text-align-center vertical-margin-large",children:this.renderStartWorkButton()}),Object(U.jsx)(X,{open:this.state.openAlert,message:this.state.alertMessage,type:this.state.alertType,onClose:this.handleCloseAlert})]})]})}}]),u}(s.a.Component);function Z(){return Object(U.jsx)(B.Consumer,{children:function(e){return e&&Object(U.jsx)(V,{brsAuth:e.brsAuth,googleAuth:e.googleAuth})}})}var K,Y,Q=u(13),$=u(23);u(175);!function(e){e[e.NoFailure=-1]="NoFailure",e[e.NotChosen=-19]="NotChosen",e[e.NotAllowedByDeansOffice=-18]="NotAllowedByDeansOffice",e[e.NotAppeared=0]="NotAppeared",e[e.DisrespectfulReason=12]="DisrespectfulReason",e[e.RespectfulReason=13]="RespectfulReason",e[e.NotAllowedByTeacher=18]="NotAllowedByTeacher",e[e.ShouldNotPass=19]="ShouldNotPass",e[e.AcademicLeave=20]="AcademicLeave",e[e.DroppedOut=21]="DroppedOut"}(K||(K={})),function(e){e[e.Fall=1]="Fall",e[e.Spring=2]="Spring"}(Y||(Y={}));var ee=function(){function e(t,u){Object(l.a)(this,e),this.brsAuth=void 0,this.brsUrlProvider=void 0,this.brsAuth=t,this.brsUrlProvider=u}return Object(d.a)(e,[{key:"getDisciplineCachedAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,r,a){var s,i,c,o;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=this.getDisciplineCacheName(t,u,r,a),!(i=E(s,n.Session))){e.next=4;break}return e.abrupt("return",i);case 4:return e.next=6,this.getDisciplineTotalAsync(t,u,r,a);case 6:return c=e.sent,e.next=9,this.getDisciplineInternalAsync(t,u,r,a,1,Math.max(1e3,c),c);case 9:return o=e.sent,g(s,o.disciplines,n.Session),e.abrupt("return",o.disciplines);case 12:case"end":return e.stop()}}),e,this)})));return function(t,u,n,r){return e.apply(this,arguments)}}()},{key:"getDisciplineInternalAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n,r,a,s,i){var c,o,D,l,d,p,F,h,f;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c="?year=".concat(t,"&termType=").concat(u,"&course=").concat(n,"&total=").concat(i,"&page=").concat(a,"&pageSize=").concat(s,"&search="),!r){e.next=11;break}return e.next=4,this.requestApiJsonAsync("/mvc/mobile/module/fetch"+c);case 4:o=e.sent,D=o.content,l=Object($.a)(D);try{for(l.s();!(d=l.n()).done;)d.value.isModule=!0}catch(C){l.e(C)}finally{l.f()}return e.abrupt("return",{disciplines:D,numberOfElements:o.numberOfElements});case 11:return e.next=13,this.requestApiJsonAsync("/mvc/mobile/discipline/fetch"+c);case 13:p=e.sent,F=p.content,h=Object($.a)(F);try{for(h.s();!(f=h.n()).done;)f.value.isModule=!1}catch(C){h.e(C)}finally{h.f()}return e.abrupt("return",{disciplines:F,numberOfElements:p.numberOfElements});case 18:case"end":return e.stop()}}),e,this)})));return function(t,u,n,r,a,s,i){return e.apply(this,arguments)}}()},{key:"clearDisciplineCacheAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,r,a){return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:A(this.getDisciplineCacheName(t,u,r,a),n.Session);case 2:case"end":return e.stop()}}),e,this)})));return function(t,u,n,r){return e.apply(this,arguments)}}()},{key:"getDisciplineTotalAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n,r){var a,s,i;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=r?"&its=true":"",s="?year=".concat(t,"&termType=").concat(u,"&course=").concat(n)+a,e.next=4,this.requestApiJsonAsync("/mvc/mobile/discipline/amount"+s);case 4:return i=e.sent,e.abrupt("return",i);case 6:case"end":return e.stop()}}),e,this)})));return function(t,u,n,r){return e.apply(this,arguments)}}()},{key:"getAllStudentMarksAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t){var u,n,r,a,s,i;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=[],e.t1=Q.a,e.next=4,this.getStudentMarksAsync(t,"lecture","current");case 4:return e.t2=e.sent,e.t3=(0,e.t1)(e.t2),e.t4=Q.a,e.next=9,this.getStudentMarksAsync(t,"lecture","intermediate");case 9:return e.t5=e.sent,e.t6=(0,e.t4)(e.t5),e.t7=Q.a,e.next=14,this.getStudentMarksAsync(t,"laboratory","current");case 14:return e.t8=e.sent,e.t9=(0,e.t7)(e.t8),e.t10=Q.a,e.next=19,this.getStudentMarksAsync(t,"laboratory","intermediate");case 19:return e.t11=e.sent,e.t12=(0,e.t10)(e.t11),e.t13=Q.a,e.next=24,this.getStudentMarksAsync(t,"practice","current");case 24:return e.t14=e.sent,e.t15=(0,e.t13)(e.t14),e.t16=Q.a,e.next=29,this.getStudentMarksAsync(t,"practice","intermediate");case 29:return e.t17=e.sent,e.t18=(0,e.t16)(e.t17),e.t19=Q.a,e.next=34,this.getStudentMarksAsync(t,"additionalPractice","current");case 34:return e.t20=e.sent,e.t21=(0,e.t19)(e.t20),e.t22=Q.a,e.next=39,this.getStudentMarksAsync(t,"additionalPractice","intermediate");case 39:e.t23=e.sent,e.t24=(0,e.t22)(e.t23),u=e.t0.concat.call(e.t0,e.t3,e.t6,e.t9,e.t12,e.t15,e.t18,e.t21,e.t24),n={},r=Object($.a)(u);try{for(r.s();!(a=r.n()).done;)s=a.value,i=n[s.studentUuid]||{},n[s.studentUuid]=Object(z.a)(Object(z.a)({},i),s)}catch(c){r.e(c)}finally{r.f()}return e.abrupt("return",Object.keys(n).map((function(e){return n[e]})));case 46:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"getStudentMarksAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n){return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.getStudentMarksInternalAsync(t.disciplineLoad,t.isModule,t.groupHistoryId,t.groupId,u,n));case 1:case"end":return e.stop()}}),e,this)})));return function(t,u,n){return e.apply(this,arguments)}}()},{key:"getStudentMarksInternalAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n,r,a,s){var i,c,o,D=arguments;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=D.length>6&&void 0!==D[6]&&D[6],c=D.length>7&&void 0!==D[7]&&D[7],o=u?"techgroup=".concat(r):"groupUuid=".concat(n),e.abrupt("return",this.requestApiJsonAsync("/mvc/mobile/studentMarks/fetch?disciplineLoad=".concat(t,"&").concat(o)+"&cardType=".concat(a,"&hasTest=false&isTotal=").concat(i)+"&intermediate=".concat("intermediate"===s)+"&selectedTeachers=null&showActiveStudents=".concat(c)));case 4:case"end":return e.stop()}}),e,this)})));return function(t,u,n,r,a,s){return e.apply(this,arguments)}}()},{key:"getDisciplineMetaAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t){var u;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u={lecture:null,laboratory:null,practice:null,additionalPractice:null},e.next=3,this.fillCardMetaAsync(u,t,"lecture");case 3:return e.next=5,this.fillCardMetaAsync(u,t,"laboratory");case 5:return e.next=7,this.fillCardMetaAsync(u,t,"practice");case 7:return e.next=9,this.fillCardMetaAsync(u,t,"additionalPractice");case 9:return e.abrupt("return",u);case 10:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"fillCardMetaAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n){var r,a,s,i;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getControlActionColumnsCachedAsync(u,n,"current");case 2:return r=e.sent,e.next=5,this.getControlActionColumnsCachedAsync(u,n,"intermediate");case 5:if(a=e.sent,r.length+a.length!==0){e.next=8;break}return e.abrupt("return");case 8:return s={currentControlActions:this.extractControlActions(r),currentFactor:0,intermediateControlActions:this.extractControlActions(a),intermediateFactor:0,totalFactor:0},this.fillFactors(s,r),this.fillFactors(s,a),t[n]=s,e.next=14,this.getControlActionColumnsCachedAsync(u,n,"total");case 14:i=e.sent,this.fillTotalFactors(t,i);case 16:case"end":return e.stop()}}),e,this)})));return function(t,u,n){return e.apply(this,arguments)}}()},{key:"getControlActionColumnsCachedAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,r){var a,s,i;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a="".concat(this.brsAuth.safeUserName,"_getControlActionColumns_").concat(t.disciplineLoad)+"_".concat(t.isModule,"_").concat(t.groupHistoryId,"_").concat(t.groupId,"_").concat(u,"_").concat(r),!(s=E(a,n.Session))){e.next=4;break}return e.abrupt("return",s);case 4:return e.next=6,this.getControlActionColumnsInternalAsync(t.disciplineLoad,t.isModule,t.groupHistoryId,t.groupId,u,r);case 6:return i=e.sent,g(a,i,n.Session),e.abrupt("return",i);case 9:case"end":return e.stop()}}),e,this)})));return function(t,u,n){return e.apply(this,arguments)}}()},{key:"getControlActionColumnsInternalAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n,r,a,s){var i,c,o,D,l,d,p;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=u?"/module":"",c=u?r:n,e.next=4,this.requestApiAsync("/mvc/mobile/view/mark/".concat(t,"/").concat(c,"/teachers").concat(i,"/").concat(a,"/").concat(s));case 4:if(o=e.sent,D="gridColumns = toTextArray(",l=");",1===(d=o.split("\r\n").map((function(e){return e.trim()})).filter((function(e){return e.startsWith(D)}))).length){e.next=10;break}throw new Error("\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0411\u0420\u0421 \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0440\u043e\u043f\u0440\u0438\u044f\u0442\u0438\u0439. \u041e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u044d\u0442\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u0441 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c \u0442\u0435\u0445\u043a\u0430\u0440\u0442\u044b.");case 10:return p=JSON.parse(d[0].substr(D.length,d[0].length-D.length-l.length))||[],e.abrupt("return",p);case 12:case"end":return e.stop()}}),e,this)})));return function(t,u,n,r,a,s){return e.apply(this,arguments)}}()},{key:"extractControlActions",value:function(e){var t="technologyCard";return e.filter((function(e){return e.uuid&&e.uuid.startsWith(t)})).map((function(e){return{uuid:e.uuid,uuidWithoutPrefix:e.uuid.substr(t.length),maxValue:e.maxValue,isIntermediate:e.intermediate>0,controlAction:e.controlAction}}))}},{key:"fillFactors",value:function(e,t){var u,n=Object($.a)(t);try{for(n.s();!(u=n.n()).done;){var r=u.value;switch(r.uuid){case"currentWithFactor":e.currentFactor="string"===typeof r.value?parseFloat(r.value):r.value;break;case"intermediateWithFactor":e.intermediateFactor="string"===typeof r.value?parseFloat(r.value):r.value}}}catch(a){n.e(a)}finally{n.f()}}},{key:"fillTotalFactors",value:function(e,t){var u,n=Object($.a)(t);try{for(n.s();!(u=n.n()).done;){var r=u.value;switch(r.uuid){case"lecture":case"laboratory":case"practice":case"additionalPractice":var a=e[r.uuid];null!==a&&(a.totalFactor="string"===typeof r.value?parseFloat(r.value):r.value)}}}catch(s){n.e(s)}finally{n.f()}}},{key:"putStudentMarkAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n,r,a,s){var i;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i="student=".concat(t,"&techcard=").concat(u,"&mark=").concat(isNaN(n)?"":n.toString(),"&groupId=").concat(r,"&cardTypeKey=").concat(a,"&disciplineLoadUuid=").concat(s),e.abrupt("return",this.requestApiJsonAsync("/mvc/mobile/studentMarks/put",{method:"POST",body:i,json:!1},{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}));case 2:case"end":return e.stop()}}),e,this)})));return function(t,u,n,r,a,s){return e.apply(this,arguments)}}()},{key:"putStudentFailureAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u){var n,r,a,s=arguments;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s.length>2&&void 0!==s[2]?s[2]:K.NoFailure,r=s.length>3&&void 0!==s[3]?s[3]:"lecture",a="markFailure=".concat(n,"&cardType=").concat(r,"&disciplineLoad=").concat(u.disciplineLoad,"&studentId=").concat(t),e.next=5,this.requestApiAsync("/mvc/mobile/failure/update",{method:"POST",body:a,json:!1},{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"});case 5:case"end":return e.stop()}}),e,this)})));return function(t,u){return e.apply(this,arguments)}}()},{key:"updateAllMarksAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t){return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.updateMarksAsync(t,"lecture","intermediate");case 2:return e.next=4,this.updateMarksAsync(t,"lecture","current");case 4:return e.next=6,this.updateMarksAsync(t,"lecture","intermediate");case 6:return e.next=8,this.updateMarksAsync(t,"laboratory","current");case 8:return e.next=10,this.updateMarksAsync(t,"laboratory","intermediate");case 10:return e.next=12,this.updateMarksAsync(t,"practice","current");case 12:return e.next=14,this.updateMarksAsync(t,"practice","intermediate");case 14:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"updateMarksAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n){return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.updateMarksInternalAsync(t.disciplineLoad,t.isModule,t.groupHistoryId,t.groupId,u,n));case 1:case"end":return e.stop()}}),e,this)})));return function(t,u,n){return e.apply(this,arguments)}}()},{key:"updateMarksInternalAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n,r,a,s){var i,c,o;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=u?"/module":"",c=u?"techgroup=".concat(r):"groupUuid=".concat(n),o="disciplineLoad=".concat(t,"&").concat(c)+"&cardType=".concat(a,"&hasTest=false&isTotal=false")+"&intermediate=".concat("intermediate"===s)+"&selectedTeachers=null&showActiveStudents=true",e.abrupt("return",this.requestApiAsync("/mvc/mobile/updateMarks".concat(i),{method:"POST",body:o,json:!1},{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}));case 4:case"end":return e.stop()}}),e,this)})));return function(t,u,n,r,a,s){return e.apply(this,arguments)}}()},{key:"getDisciplineCacheName",value:function(e,t,u,n){return"".concat(this.brsAuth.safeUserName,"_getDiscipline_").concat(e,"_").concat(t,"_").concat(u,"_").concat(n)}},{key:"requestApiJsonAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n){var r;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.requestApiAsync(t,u,n);case 2:return r=e.sent,e.abrupt("return",JSON.parse(r));case 4:case"end":return e.stop()}}),e,this)})));return function(t,u,n){return e.apply(this,arguments)}}()},{key:"requestApiAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n){var a;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,m()(Object(z.a)(Object(z.a)({method:"GET"},u),{},{url:this.brsUrlProvider.baseUrl+t,headers:Object(z.a)({"X-Cookie":"JSESSIONID=".concat(this.brsAuth.sid),"X-Requested-With":"XMLHttpRequest"},n)}));case 2:if(!(a=e.sent).trimLeft().startsWith("")){e.next=5;break}throw new x(r.BrsUnauthorized,t+" is Forbidden");case 5:return e.abrupt("return",a);case 6:case"end":return e.stop()}}),e,this)})));return function(t,u,n){return e.apply(this,arguments)}}()}]),e}();function te(e){var t=gapi.client.sheets;function u(){return(u=Object(b.a)(C.a.mark((function u(n){var r;return C.a.wrap((function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,t.spreadsheets.values.get({spreadsheetId:e,range:n});case 2:return r=u.sent,u.abrupt("return",r.result);case 4:case"end":return u.stop()}}),u)})))).apply(this,arguments)}function n(){return(n=Object(b.a)(C.a.mark((function u(){var n,r;return C.a.wrap((function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,t.spreadsheets.get({spreadsheetId:e});case 2:return n=u.sent,r=JSON.parse(n.body),u.abrupt("return",r);case 5:case"end":return u.stop()}}),u)})))).apply(this,arguments)}return{readAsync:function(e){return u.apply(this,arguments)},getMetaAsync:function(){return n.apply(this,arguments)}}}function ue(e){return e&&e.toLowerCase().replace("\u0451","\u0435").replace(/[^A-Za-z\u0410-\u042f\u0401\u0430-\u044f\u04510-9]/g,"")}function ne(e,t){return ue(e)===ue(t)}function re(e){return parseFloat(e&&e.replace(",","."))}function ae(e,t){return e.reduce((function(e,u){var n="".concat(u[t]);return(e[n]=e[n]||[]).push(u),e}),{})}function se(e){return Object.keys(e)}function ie(e,t,u,n){return e%10===0||e%10>=5||e%100>10&&e%100<20?n:e%10===1?t:u}function ce(e){return Math.round(10*e)/10}function oe(e){return Math.round(100*e)/100}var De={"-":K.NoFailure,"\u041d\u0435 \u0432\u044b\u0431\u0440\u0430\u043d\u0430":K.NotChosen,"\u041d\u0435 \u0434\u043e\u043f\u0443\u0449\u0435\u043d (\u0434\u0435\u043a\u0430\u043d\u0430\u0442)":K.NotAllowedByDeansOffice,"\u041d\u0435 \u044f\u0432\u0438\u043b\u0441\u044f":K.NotAppeared,"\u041d\u0435\u0443\u0432\u0430\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f":K.DisrespectfulReason,"\u0423\u0432\u0430\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f":K.RespectfulReason,"\u041d\u0435 \u0434\u043e\u043f\u0443\u0449\u0435\u043d":K.NotAllowedByTeacher,"\u041d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u0434\u0430\u0432\u0430\u0442\u044c":K.ShouldNotPass,"\u0410\u043a\u0430\u0434\u0435\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043e\u0442\u043f\u0443\u0441\u043a":K.AcademicLeave,"\u0412\u044b\u0431\u044b\u043b":K.DroppedOut};function le(e){if(null===e||void 0===e)return null;for(var t=0,u=Object.keys(De);t=0&&r.disciplineValueColumn>=0)){e.next=15;break}return i=ye(n,r),c=ke(u,r),e.abrupt("return",{datas:[{actualStudents:s,disciplineConfig:c,controlActionConfigs:i}]});case 15:if(!(r.courseColumn>=0||r.academicGroupColumn>=0)){e.next=28;break}o=ye(n,r),D={},l=Object($.a)(s);try{for(l.s();!(d=l.n()).done;)null!==(p=d.value).course&&(D[p.course]||(D[p.course]=[]),D[p.course].push(p))}catch(C){l.e(C)}finally{l.f()}return F=se(D),e.next=23,xe(this.spreadsheetId,F);case 23:return h=e.sent,f=h.map((function(e){return{actualStudents:D[e.course],disciplineConfig:e,controlActionConfigs:o}})),e.abrupt("return",{datas:f});case 28:throw new Error("\u041d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b");case 29:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()}]),e}();function he(e,t,u){return fe.apply(this,arguments)}function fe(){return(fe=Object(b.a)(C.a.mark((function e(t,u,n){var r,a,s,i,c,o,D,l,d,p,F,h,f,b,v,m,g,E,A,y,x,j,k,O,B,S,w,N,I,M,L;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.fullNameColumn>=0?n.fullNameColumn-n.left:null,a=n.surnameColumn>=0?n.surnameColumn-n.left:null,s=n.nameColumn>=0?n.nameColumn-n.left:null,i=n.patronymicColumn>=0?n.patronymicColumn-n.left:null,c=n.groupColumn>=0?n.groupColumn-n.left:null,o=n.courseColumn>=0?n.courseColumn-n.left:null,D=n.academicGroupColumn>=0?n.academicGroupColumn-n.left:null,l=null,d=n.failureColumn-n.left,p=te(t),e.next=12,p.readAsync(u);case 12:if(e.t0=e.sent.values,e.t0){e.next=15;break}e.t0=[];case 15:F=e.t0,h=[],f=Object($.a)(F);try{for(f.s();!(b=f.n()).done;)E=b.value,A=null!==r?E[r].trim():null,y=null!==a?E[a]:null,x=null!==s?E[s]:null,j=null!==i?E[i]:null,k=null!==y&&y.length>0?"".concat(y.trim()," ").concat(null!==(v=null===x||void 0===x?void 0:x.trim())&&void 0!==v?v:""," ").concat(null!==(m=null===j||void 0===j?void 0:j.trim())&&void 0!==m?m:"").trim():null,O=null!==A&&A.length>0?A:k,B=null!==c?E[c]:null,S=null!==o?E[o]:null,w=null!==D?E[D]:null,N=null===w||void 0===w||null===(g=w.match(/\d/))||void 0===g?void 0:g[0],I=null!==S&&S.length>0?S:N,M=null!==l?E[l]:null,L=null!==d?le(E[d]):null,null!==O&&O.length>0&&h.push({fullName:O,groupName:B,id:M,course:I,failure:L,properties:E})}catch(C){f.e(C)}finally{f.f()}return e.abrupt("return",h);case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ce(e,t){return be.apply(this,arguments)}function be(){return(be=Object(b.a)(C.a.mark((function e(t,u){var n,r;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=te(t),e.next=3,n.readAsync(u+"!A1:ZZ100");case 3:return r=e.sent.values,e.abrupt("return",r||null);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ve(e){return me.apply(this,arguments)}function me(){return(me=Object(b.a)(C.a.mark((function e(t){var u;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=te(t),e.next=3,u.getMetaAsync();case 3:return e.abrupt("return",e.sent.properties.title);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ge(e){var t=e&&e[0];if(!t)throw new Error("\u041b\u0438\u0441\u0442 Google-\u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u0442\u0440\u043e\u043a");return t}function Ee(e){var t=e&&e.map((function(e){return ue(e)})),u=t.indexOf(ue("\u0413\u0440\u0443\u043f\u043f\u0430 \u0432 \u0411\u0420\u0421")),n=t.indexOf(ue("\u0424\u0430\u043c\u0438\u043b\u0438\u044f \u0418\u043c\u044f \u0432 \u0411\u0420\u0421")),r=t.indexOf(ue("\u0424\u0430\u043c\u0438\u043b\u0438\u044f")),a=t.indexOf(ue("\u0418\u043c\u044f")),s=t.indexOf(ue("\u041e\u0442\u0447\u0435\u0441\u0442\u0432\u043e")),i=t.indexOf(ue("\u0413\u043e\u0434 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f")),c=t.indexOf(ue("\u0413\u0440\u0443\u043f\u043f\u0430")),o=t.indexOf(ue("\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f")),D=t.indexOf(ue("\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432")),l=t.indexOf(ue("\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432"));if(o<0||n<0&&r<0||n>=o||r>=o||a>=o||s>=o||u>=0&&u>o||i>=0&&i>o||c>=0&&c>o||D>=0&&D<=o||l>=0&&l<=o||D>=0&&l!==D+1)throw new Error("\u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432");var d=Math.min.apply(Math,Object(Q.a)([n,r,a,s,u,i,c].filter((function(e){return e>=0}))));return{groupColumn:u,fullNameColumn:n,surnameColumn:r,nameColumn:a,patronymicColumn:s,courseColumn:i,academicGroupColumn:c,failureColumn:o,disciplineKeyColumn:D,disciplineValueColumn:l,left:d,right:o}}function Ae(e,t){var u=String.fromCharCode("A".charCodeAt(0)+t.left),n=String.fromCharCode("A".charCodeAt(0)+t.right);return"".concat(e,"!").concat(u,"2:").concat(n)}function ye(e,t){for(var u=[],n=t.left;n<=t.right;n++)n!==t.groupColumn&&n!==t.fullNameColumn&&n!==t.courseColumn&&n!==t.academicGroupColumn&&n!==t.failureColumn&&e[n]&&u.push({controlAction:e[n],propertyIndex:n-t.left});for(var r=function(){var e=s[a],t=u.filter((function(t){return ne(t.controlAction,e.controlAction)}));if(t.length>1){e.matchCount=t.length;for(var n=0;n0){var D=o.map((function(e){return"\xab".concat(e,"\xbb")})).join(", ");throw new Error("\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u044b \u043d\u0435 \u0437\u0430\u0434\u0430\u043d\u044b: ".concat(D))}return u}function Oe(e,t,u,n){if(ne(u,"\u0414\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u0430"))n&&(e.name=n,t.name=null);else if(ne(u,"\u0418\u0422\u0421"))n&&(e.isModule="\u0434\u0430"===n.toLowerCase(),t.isModule=null);else if(ne(u,"\u0413\u043e\u0434"))n&&(e.year=parseInt(n.toLowerCase(),10),t.year=null);else if(ne(u,"\u0423\u0447\u0435\u0431\u043d\u044b\u0439 \u0433\u043e\u0434")){if(n){var r=n.toLowerCase().split("/");e.year=parseInt(r[0],10),t.year=null}}else if(ne(u,"\u0421\u0435\u043c\u0435\u0441\u0442\u0440"))n&&("\u043e\u0441\u0435\u043d\u043d\u0438\u0439"===n.toLowerCase()?(e.termType=Y.Fall,t.termType=null):"\u0432\u0435\u0441\u0435\u043d\u043d\u0438\u0439"===n.toLowerCase()&&(e.termType=Y.Spring,t.termType=null));else if(ne(u,"\u041a\u0443\u0440\u0441")){if(n)"\u0432\u0441\u0435 \u043a\u0443\u0440\u0441\u044b"===n.toLowerCase().trim()?(e.course=0,t.course=null):(e.course=parseInt(n.toLowerCase(),10),t.course=null)}else if(ne(u,"\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e")){var a;e.defaultStudentFailure=null!==(a=le(n))&&void 0!==a?a:K.NoFailure,t.defaultStudentFailure=null}}u(533);var Be=u(583),Se=u(581),we=u(584),Ne=u(585),Ie=u(586),Me=u(589),Le=u(587),Te=u(588);function Ue(e){var t=e.title,u=e.items,n=e.icons,r=Object(U.jsx)(Be.a,{component:"div",id:"nested-list-subheader",hidden:!t,children:t});return Object(U.jsx)(Se.a,{component:"nav","aria-labelledby":"nested-list-subheader",subheader:r,className:"nested-list primary",children:u.length?We(u,0,n):Object(U.jsx)(we.a,{className:"text-align-center",children:Object(U.jsx)(Ne.a,{primary:"..."})})})}function We(e,t,u){return e.map((function(e,n){return Object(U.jsx)(Re,{item:e,icons:u,level:t},n)}))}function Re(e){var t,u=e.item,n=e.level,r=e.icons,a=u.title,i=u.nestedItems,c=u.colored,o=u.collapsed,D=u.renderAsText,l=s.a.useState(!o),d=Object(M.a)(l,2),p=d[0],F=d[1],h=i&&i.length>0,f=c&&"colored-back",C=r&&r[n],b=C&&Object(U.jsx)(Ie.a,{children:C});return Object(U.jsxs)(s.a.Fragment,{children:[Object(U.jsxs)(we.a,{button:!0,onClick:function(){return F(!p)},style:n?{paddingLeft:40*n}:void 0,className:"hover "+f,children:[b,Object(U.jsx)(Ne.a,{primary:a}),h&&(p?Object(U.jsx)(Le.a,{}):Object(U.jsx)(Te.a,{}))]}),h&&Object(U.jsx)(Me.a,{in:p,unmountOnExit:!0,children:D?Object(U.jsx)("div",{style:{paddingLeft:40*(n+1),paddingTop:10,paddingBottom:10},children:i&&(t=i,t.map((function(e,t){return Object(U.jsx)("div",{children:e.title},t)})))}):Object(U.jsx)(Se.a,{component:"div",disablePadding:!0,children:i&&We(i,n+1,r)})})]})}u(534);var Pe=u(590);function Ge(e){var t=e.enabled,u=e.onRunWorkSafe,n=e.onRunWorkUnsafe;return Object(U.jsxs)(Pe.a,{container:!0,justify:"space-around",children:[Object(U.jsx)(Pe.a,{item:!0,children:Object(U.jsx)(N.a,{variant:"contained",disabled:!t,onClick:u,color:"primary",children:"\u041f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u043e"})}),Object(U.jsx)(Pe.a,{item:!0,children:Object(U.jsx)(N.a,{variant:"contained",disabled:!t,onClick:n,color:"secondary",children:"\u0421\u0434\u0435\u043b\u0430\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u043e"})})]})}u(535);var _e=u(6),ze=u(601),Je=u(593),qe=u(591),Xe=u(592);function He(e){return e.toLowerCase().replace("\u0451","\u0435").replace(/[ ]+/," ").trim()}var Ve,Ze=new Set(["auto","\u0431\u0430\u043b\u043b\u044b"]);!function(e){e[e.Updated=0]="Updated",e[e.Failed=1]="Failed",e[e.Skipped=2]="Skipped"}(Ve||(Ve={}));var Ke=function(){function e(t,u,n){Object(l.a)(this,e),this.brsApi=void 0,this.save=void 0,this.cancelPending=!1,this.reportManager=void 0,this.brsApi=t,this.reportManager=u,this.save=n}return Object(d.a)(e,[{key:"cancel",value:function(){this.cancelPending=!0}},{key:"putMarksToBrsAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u){var n,r,a,s,i,c,o,D=this;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.actualStudents,r=t.disciplineConfig,a=t.controlActionConfigs,e.prev=1,s=Object($.a)(u),e.prev=3,c=C.a.mark((function e(){var t,u;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.value,0!==(u=n.filter((function(e){return Qe(e,t)}))).length){e.next=4;break}return e.abrupt("return","continue");case 4:return D.reportManager.newReport({disciplineConfig:r,discipline:t,merge:{succeed:0},marks:[],skipped:[]}),e.next=7,D.putMarksForDisciplineAsync(t,u,r.defaultStudentFailure,a);case 7:if(e.sent?D.reportManager.finishReport():D.reportManager.cancelReport(),!D.cancelPending){e.next=11;break}return e.abrupt("return","break");case 11:case"end":return e.stop()}}),e)})),s.s();case 6:if((i=s.n()).done){e.next=15;break}return e.delegateYield(c(),"t0",8);case 8:if("continue"!==(o=e.t0)){e.next=11;break}return e.abrupt("continue",13);case 11:if("break"!==o){e.next=13;break}return e.abrupt("break",15);case 13:e.next=6;break;case 15:e.next=20;break;case 17:e.prev=17,e.t1=e.catch(3),s.e(e.t1);case 20:return e.prev=20,s.f(),e.finish(20);case 23:return e.abrupt("return",null);case 26:return e.prev=26,e.t2=e.catch(1),e.abrupt("return",e.t2);case 29:case"end":return e.stop()}}),e,null,[[1,26],[3,17,20,23]])})));return function(t,u){return e.apply(this,arguments)}}()},{key:"putMarksForDisciplineAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n,r){var a,s,i,c,o,D;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.brsApi.getDisciplineMetaAsync(t);case 2:if(a=e.sent,this.checkControlActionsConfiguration(t,a,r)){e.next=5;break}return e.abrupt("return",!1);case 5:return e.next=7,this.brsApi.getAllStudentMarksAsync(t);case 7:return s=e.sent,i=this.mergeStudents(u,s),c=i.mergedStudents,o=i.skippedActualStudents,D=i.skippedBrsStudents,this.logMergedStudents(c,o,D),e.next=12,this.putMarksForStudentsAsync(t,a,c,r);case 12:return e.next=14,this.updateFailuresForSkippedStudentsAsync(D,t,n);case 14:if(!this.save){e.next=17;break}return e.next=17,this.brsApi.updateAllMarksAsync(t);case 17:return e.abrupt("return",!0);case 18:case"end":return e.stop()}}),e,this)})));return function(t,u,n,r){return e.apply(this,arguments)}}()},{key:"checkControlActionsConfiguration",value:function(e,t,u){if(this.tryGetAutoControlActionConfig(u))return!0;var n,r=this.getControlActions(t),a=Object($.a)(u);try{for(a.s();!(n=a.n()).done;){var s=n.value;if(!this.getSuitableControlAction(e,s,r))return!1}}catch(i){a.e(i)}finally{a.f()}return!0}},{key:"putMarksForStudentsAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n,r){var a,s,i,c,o,D,l,d,p;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s={},i=n,c=this.save?3:2,o=0;case 4:if(!(o0?Ve.Failed:o.updated>0?Ve.Updated:Ve.Skipped,F=n.actual.fullName.substr(0,30),h="".concat(F," \u0431\u0430\u043b\u043b\u044b: ").concat(o.marks.join(" ")),d&&"-"!==d&&(h+=", ".concat(d)),e.abrupt("return",{student:n,status:p,infoString:h});case 32:case"end":return e.stop()}}),e,this,[[17,24]])})));return function(t,u,n,r){return e.apply(this,arguments)}}()},{key:"putAutoMarksForStudentAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n,r,a){var s,i,c,o,D,l,d,p,F,h,f;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=r.actual.properties[a.propertyIndex],i=re(s),c=this.getControlActionGroups(n),o=c.filter((function(e){return!e.isIntermediate})),D=o.reduce((function(e,t){return e+t.factor}),0),l=c.filter((function(e){return e.isIntermediate})),d=l.reduce((function(e,t){return t.factor}),0),p="[auto=".concat(i,"]"),t.marks.push(" ".concat(p).substr("".concat(p).length-1)),!(40<=i)){e.next=14;break}return e.next=12,this.putMarksTryFillActionsWithMaxScoreAsync(t,u,r,c,i);case 12:e.next=31;break;case 14:if(!(40*D<=i)){e.next=24;break}return 40,F=oe(D>0?(i-40*D)/d:0),e.next=20,this.putMarksTryFillActionsWithMaxScoreAsync(t,u,r,o,40);case 20:return e.next=22,this.putMarksTryFillActionsWithMaxScoreAsync(t,u,r,l,F);case 22:e.next=31;break;case 24:return h=0,f=oe(D>0?(i-d*h)/D:0),e.next=29,this.putMarksTryFillActionsWithMaxScoreAsync(t,u,r,o,f);case 29:return e.next=31,this.putMarksTryFillActionsWithMaxScoreAsync(t,u,r,l,h);case 31:case"end":return e.stop()}}),e,this)})));return function(t,u,n,r,a){return e.apply(this,arguments)}}()},{key:"putMarksTryFillActionsWithMaxScoreAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n,r,a){var s,i,c,o,D,l,d,p;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s=Object($.a)(r),e.prev=1,s.s();case 3:if((i=s.n()).done){e.next=19;break}c=i.value,o=c.controlActions,D=a,l=0;case 8:if(!(l=t.matchCount?(r.push("\u041d\u0435\u0432\u0435\u0440\u043d\u0430\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u0435\u0440\u043e\u043f\u0440\u0438\u044f\u0442\u0438\u044f \xab".concat(t.controlAction,"\xbb")),n.length!==t.matchCount&&r.push("\u0412 \u0411\u0420\u0421 \u043d\u0430\u0439\u0434\u0435\u043d\u043e ".concat(n.length," ").concat(ie(n.length,"\u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u043e\u0435 \u043c\u0435\u0440\u043e\u043f\u0440\u0438\u044f\u0442\u0438\u0435","\u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0440\u043e\u043f\u0440\u0438\u044f\u0442\u0438\u044f","\u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0440\u043e\u043f\u0440\u0438\u044f\u0442\u0438\u0439"),", \u0430 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e ").concat(t.matchCount)),this.reportManager.onInvalidConfiguration(r),null):n[t.matchIndex]:n.length>1?(r.push("\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0440\u043e\u043f\u0440\u0438\u044f\u0442\u0438\u0439 \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u0434\u043b\u044f \xab".concat(t.controlAction,"\xbb")),r.push("\u041d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0440\u043e\u043f\u0440\u0438\u044f\u0442\u0438\u044f: ".concat(n.map((function(e){return e.controlAction})).join(", "))),this.reportManager.onInvalidConfiguration(r),null):n[0]}},{key:"updateFailuresForSkippedStudentsAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n){var r,a,s,i=this;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(t.map((function(e){return i.updateFailureForStudent(e,u,n)})));case 2:(r=e.sent).length>0&&(s=Object.entries(ae(r,"status")).map((function(e){var t=Object(M.a)(e,2),u=(t[0],t[1]);return{title:$e(u[0].status),students:u.map((function(e){return e.infoString}))}})),(a=this.reportManager.currentReport.skipped).push.apply(a,Object(Q.a)(s)));case 4:case"end":return e.stop()}}),e,this)})));return function(t,u,n){return e.apply(this,arguments)}}()},{key:"updateFailureForStudent",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n){var r,a,s,i,c,o;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=t.failure?t.failure:K.NoFailure,(s=n)!==a){e.next=6;break}r=Ve.Skipped,e.next=16;break;case 6:if(e.prev=6,!this.save){e.next=10;break}return e.next=10,this.brsApi.putStudentFailureAsync(t.studentUuid,u,s);case 10:r=Ve.Updated,e.next=16;break;case 13:e.prev=13,e.t0=e.catch(6),r=Ve.Failed;case 16:return i=t.studentFio.substr(0,30),c=r!==Ve.Skipped?"\u0432\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \xab".concat(de(s),"\xbb, \u0431\u044b\u043b\u043e \xab").concat(de(a),"\xbb"):"\xab".concat(de(s),"\xbb"),o="".concat(i,", ").concat(c),e.abrupt("return",{status:r,infoString:o});case 20:case"end":return e.stop()}}),e,this,[[6,13]])})));return function(t,u,n){return e.apply(this,arguments)}}()},{key:"tryGetAutoControlActionConfig",value:function(e){var t=e.filter((function(e){return Ze.has(e.controlAction.toLowerCase())}));return 1===t.length?t[0]:(t.length>1&&this.reportManager.onInvalidConfiguration(["\u041d\u0430\u0439\u0434\u0435\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u0441 \u0430\u0432\u0442\u043e\u0438\u0442\u043e\u0433\u043e\u043c"]),null)}},{key:"getControlActions",value:function(e){var t,u,n,r,a,s,i,c;return[].concat(Object(Q.a)((null===(t=e.lecture)||void 0===t?void 0:t.currentControlActions)||[]),Object(Q.a)((null===(u=e.lecture)||void 0===u?void 0:u.intermediateControlActions)||[]),Object(Q.a)((null===(n=e.laboratory)||void 0===n?void 0:n.currentControlActions)||[]),Object(Q.a)((null===(r=e.laboratory)||void 0===r?void 0:r.intermediateControlActions)||[]),Object(Q.a)((null===(a=e.practice)||void 0===a?void 0:a.currentControlActions)||[]),Object(Q.a)((null===(s=e.practice)||void 0===s?void 0:s.intermediateControlActions)||[]),Object(Q.a)((null===(i=e.additionalPractice)||void 0===i?void 0:i.currentControlActions)||[]),Object(Q.a)((null===(c=e.additionalPractice)||void 0===c?void 0:c.intermediateControlActions)||[]))}},{key:"getControlActionGroups",value:function(e){var t=[];return e.lecture&&this.pushControlActionGroups(t,e.lecture),e.laboratory&&this.pushControlActionGroups(t,e.laboratory),e.practice&&this.pushControlActionGroups(t,e.practice),e.additionalPractice&&this.pushControlActionGroups(t,e.additionalPractice),t}},{key:"pushControlActionGroups",value:function(e,t){if(t.currentControlActions.length>0){var u=oe(t.currentFactor*t.totalFactor),n=t.currentControlActions;e.push({factor:u,controlActions:n,isIntermediate:!1})}if(t.intermediateControlActions.length>0){var r=oe(t.intermediateFactor*t.totalFactor),a=t.intermediateControlActions;e.push({factor:r,controlActions:a,isIntermediate:!0})}}},{key:"mergeStudents",value:function(e,t){var u,n=t.filter(Ye),r=[],a=[],s=Object($.a)(e);try{var i=function(){var e=u.value,t=n.filter((function(t){return function(e,t){var u=He(e.studentFio),n=He(t.fullName);return u.startsWith(n)}(t,e)}));1===t.length?r.push({actual:e,brs:t[0]}):a.push(e)};for(s.s();!(u=s.n()).done;)i()}catch(d){s.e(d)}finally{s.f()}var c,o=[],D=Object($.a)(n);try{var l=function(){var e=c.value;r.some((function(t){return t.brs.studentUuid===e.studentUuid}))||o.push(e)};for(D.s();!(c=D.n()).done;)l()}catch(d){D.e(d)}finally{D.f()}return{mergedStudents:r,skippedActualStudents:a,skippedBrsStudents:o}}},{key:"logMergedStudents",value:function(e,t,u){var n=this.reportManager.currentReport;n.merge.succeed=e.length,t.length>0&&(n.merge.failedActual=t.map((function(e){return e.fullName}))),u.length>0&&(n.merge.failedBrs=u.map((function(e){return e.studentFio})))}}]),e}();function Ye(e){return"\u041f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043d"!==e.studentStatus&&"\u041e\u0442\u0447\u0438\u0441\u043b\u0435\u043d"!==e.studentStatus&&"\u041f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043d"!==e.studentStatus&&"\u041e\u0442\u043f.\u0430\u043a\u0430\u0434."!==e.studentStatus&&e.failure!==K.ShouldNotPass}function Qe(e,t){if(e.groupName&&e.groupName.length>0){var u=ue(e.groupName);return ue(t.group).startsWith(u)}return!0}function $e(e){switch(e){case Ve.Updated:return"\u041e\u0411\u041d\u041e\u0412\u041b\u0415\u041d\u041e";case Ve.Skipped:return"\u041f\u0420\u041e\u041f\u0423\u0429\u0415\u041d\u041e";case Ve.Failed:return"\u041f\u0420\u041e\u0412\u0410\u041b\u0415\u041d\u041e";default:throw new Error("\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u0441\u0442\u0430\u0442\u0443\u0441 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0446\u0435\u043d\u043e\u043a")}}var et,tt=function(){function e(t,u){Object(l.a)(this,e),this._currentReport=null,this.onReportFinished=void 0,this.onInvalidConfiguration=void 0,this.onReportFinished=t,this.onInvalidConfiguration=u}return Object(d.a)(e,[{key:"currentReport",get:function(){if(!this._currentReport)throw new Error("\u041f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u043e\u0442\u0447\u0435\u0442\u0430 \u0435\u0449\u0435 \u043d\u0435 \u043d\u0430\u0447\u0430\u0442\u043e");return this._currentReport}},{key:"newReport",value:function(e){this.finishReport(),this._currentReport=e}},{key:"finishReport",value:function(){this._currentReport&&this.onReportFinished(this._currentReport),this._currentReport=null}},{key:"cancelReport",value:function(){this._currentReport=null}}]),e}(),ut=Object(_e.a)((function(){return{root:{padding:0}}}))(qe.a),nt=Object(_e.a)((function(){return{root:{display:"flex",justifyContent:"space-around"}}}))(Xe.a),rt=function(e){Object(S.a)(u,e);var t=Object(w.a)(u);function u(e){var n;Object(l.a)(this,u),(n=t.call(this,e)).marksManager=void 0,n.logConfigurationErrors=function(e){var t=e.map((function(e){return{title:e,colored:!0}}));n.setState({logItems:t})},n.logMessage=function(){var e=Object(b.a)(C.a.mark((function e(t){var u;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.reportToNestedListItems(t);case 2:u=e.sent,n.setState({logItems:u});case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),n.startWork=Object(b.a)(C.a.mark((function e(){var t,u,r,a,s,i;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=Object($.a)(n.props.marksDatas),e.prev=1,t.s();case 3:if((u=t.n()).done){e.next=12;break}return r=u.value,a=r.spreadsheetData,s=r.suitableDisciplines,e.next=8,n.marksManager.putMarksToBrsAsync(a,s);case 8:(i=e.sent)&&("object"===typeof i?n.props.onError(i.toString()):"string"===typeof i&&n.props.onError(i));case 10:e.next=3;break;case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(1),t.e(e.t0);case 17:return e.prev=17,t.f(),e.finish(17);case 20:n.setState({cancelPending:!1,okLoading:!1});case 21:case"end":return e.stop()}}),e,null,[[1,14,17,20]])}))),n.cancelWork=function(){n.setState({cancelPending:!0}),n.marksManager.cancel()};var r=e.brsApi,a=e.save,s=new tt(n.logMessage,n.logConfigurationErrors);return n.marksManager=new Ke(r,s,a),n.state={okLoading:!0,cancelPending:!1,logItems:[]},n}return Object(d.a)(u,[{key:"componentDidMount",value:function(){this.startWork()}},{key:"componentWillUnmount",value:function(){this.marksManager.cancel()}},{key:"reportToNestedListItems",value:function(e){var t=this.state.logItems;return new Promise((function(u){var n,r,a=e.disciplineConfig,s=a.termType===Y.Fall?"\u043e\u0441\u0435\u043d\u044c ".concat(a.year):a.termType===Y.Spring?"\u0432\u0435\u0441\u043d\u0430 ".concat(a.year+1):"".concat(a.year,"/").concat(a.year+1),i="\u0413\u0440\u0443\u043f\u043f\u0430 ".concat(e.discipline.group," (").concat(s,", ").concat(a.course," \u043a\u0443\u0440\u0441)"),c=[],o={title:i,collapsed:!0,nestedItems:c},D=!1,l=e.merge,d="\u0421\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435: ".concat(l.succeed," \u0443\u0441\u043f\u0435\u0448\u043d\u043e"),p=(null===(n=l.failedActual)||void 0===n?void 0:n.length)||0;d+=", ".concat(p," ").concat(ie(p,"\u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439","\u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445","\u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445")," \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435");var F,h,f=(null===(r=l.failedBrs)||void 0===r?void 0:r.length)||0,C={title:d+=", ".concat(f," ").concat(ie(f,"\u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439","\u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445","\u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445")," \u0432 \u0411\u0420\u0421"),nestedItems:[],collapsed:!0};(c.push(C),l.failedActual)&&(D=!0,i="\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c ".concat(l.failedActual.length," ").concat(ie(l.failedActual.length,"\u0441\u0442\u0443\u0434\u0435\u043d\u0442\u0430","\u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432","\u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432")," \u0438\u0437 Google \u0422\u0430\u0431\u043b\u0438\u0446\u044b"),null===(F=C.nestedItems)||void 0===F||F.push({title:i,nestedItems:l.failedActual.map((function(e){return{title:e}})),colored:!0,collapsed:!1,renderAsText:!0}));l.failedBrs&&(D=!0,i="\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c ".concat(l.failedBrs.length," ").concat(ie(l.failedBrs.length,"\u0441\u0442\u0443\u0434\u0435\u043d\u0442\u0430","\u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432","\u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432")," \u0438\u0437 \u0411\u0420\u0421"),null===(h=C.nestedItems)||void 0===h||h.push({title:i,nestedItems:l.failedBrs.map((function(e){return{title:e}})),colored:!0,collapsed:!1,renderAsText:!0}));var b=e.marks,v={title:"\u0412\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u0430\u043b\u043b\u043e\u0432",collapsed:!0};v.nestedItems=b.map((function(e){var t,u,n=e.title,r=e.students,a=e.failed;return{title:"".concat(n,": ").concat(null!==(t=null===r||void 0===r?void 0:r.length)&&void 0!==t?t:0," ").concat(ie(null!==(u=null===r||void 0===r?void 0:r.length)&&void 0!==u?u:0,"\u0441\u0442\u0443\u0434\u0435\u043d\u0442","\u0441\u0442\u0443\u0434\u0435\u043d\u0442\u0430","\u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432")),nestedItems:null===r||void 0===r?void 0:r.map((function(e){return{title:e}})),colored:!!a,collapsed:!1,renderAsText:!0}})),c.push(v),D=D||b.filter((function(e){return!!e.failed})).length>0;var m=e.skipped;if(m.length>0){var g={title:"\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u044b \u0438\u0437 \u0411\u0420\u0421",collapsed:!0};g.nestedItems=m.map((function(e){var t,u,n=e.title,r=e.students;return{title:"".concat(n,": ").concat(null!==(t=null===r||void 0===r?void 0:r.length)&&void 0!==t?t:0," ").concat(ie(null!==(u=null===r||void 0===r?void 0:r.length)&&void 0!==u?u:0,"\u0441\u0442\u0443\u0434\u0435\u043d\u0442","\u0441\u0442\u0443\u0434\u0435\u043d\u0442\u0430","\u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432")),nestedItems:null===r||void 0===r?void 0:r.map((function(e){return{title:e}})),collapsed:!1,renderAsText:!0}})),c.push(g)}D&&(o.colored=!0),t.push(o),u(t)}))}},{key:"render",value:function(){return Object(U.jsx)(s.a.Fragment,{children:Object(U.jsxs)(ze.a,{open:!0,maxWidth:"md",fullWidth:!0,className:"worker-dialog",children:[Object(U.jsx)(Je.a,{children:"\u0416\u0443\u0440\u043d\u0430\u043b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439"}),Object(U.jsx)(ut,{dividers:!0,children:Object(U.jsx)(Ue,{items:this.state.logItems})}),Object(U.jsxs)(nt,{children:[Object(U.jsx)(W,{loading:this.state.okLoading,onClick:this.props.onClosed,title:"\u043e\u043a"}),Object(U.jsx)(W,{loading:this.state.cancelPending,disabled:!this.state.okLoading,onClick:this.cancelWork,title:"\u043e\u0442\u043c\u0435\u043d\u0430"})]})]})})}}]),u}(s.a.Component),at=u(270),st=u.n(at),it=u(594),ct=u(271);function ot(e){var t=e.loading,u=e.onSubmit,n=Object(a.useState)(""),r=Object(M.a)(n,2),s=r[0],i=r[1],c=Object(a.useState)(null),o=Object(M.a)(c,2),D=o[0],l=o[1];return Object(U.jsxs)("form",{onSubmit:function(e){e.preventDefault();var t=Object(ct.a)(/d\/([\x2D0-9A-Z_a-z]+)\/edit(#gid=([0-9]+))?/,{spreadsheetId:1,sheetId:3}),n=s.match(t);if(!(null===n||void 0===n?void 0:n.groups)||!n.groups.spreadsheetId)return l("\u041d\u0435\u0432\u0435\u0440\u043d\u044b\u0439 url-\u0430\u0434\u0440\u0435\u0441."),null;var r=n.groups.spreadsheetId,a=n.groups.sheetId||null;u(r,a)},className:"vertical-margin-min",children:[Object(U.jsx)(L.a,{name:"table-url",label:"\u0421\u0441\u044b\u043b\u043a\u0430 \u0432\u0438\u0434\u0430 https://docs.google.com/spreadsheets/d/sjwa1/edit#gid=0",type:"text",className:"tableUrl",value:s,onChange:function(e){var t=e.target;D&&l(null),i(t.value)},error:!!D,helperText:D,required:!0}),Object(U.jsx)(W,{title:"\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c",loading:t,className:"submit"}),Object(U.jsx)("a",{href:p,target:"_blank",rel:"noreferrer",className:"button-link",children:"\u041f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0434\u043b\u044f \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430 \u0432 \u0411\u0420\u0421"})]})}!function(e){e[e.None=0]="None",e[e.LoadDisciplines=1]="LoadDisciplines",e[e.RunWork=2]="RunWork"}(et||(et={}));var Dt=function(e){Object(S.a)(u,e);var t=Object(w.a)(u);function u(e){var n;return Object(l.a)(this,u),(n=t.call(this,e)).marksDatas=[],n.workerSaveMode=!1,n.spreadsheetId="",n.sheetId=null,n.loadDisciplines=function(){var e=Object(b.a)(C.a.mark((function e(t,u){var r,a,s,i,c,o,D,l,d;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.spreadsheetId=t,n.sheetId=u,n.setState({loading:!0}),e.next=5,n.getActualSpreadsheetDataAsync(t,u);case 5:if((null===(r=e.sent)||void 0===r?void 0:r.datas)&&0!==r.datas.length){e.next=9;break}return n.setState({loading:!1}),e.abrupt("return",!1);case 9:n.marksDatas=[],a=[],s=!0,i=0,c=Object($.a)(r.datas),e.prev=14,c.s();case 16:if((o=c.n()).done){e.next=31;break}return D=o.value,e.next=20,n.getActualDisciplinesAsync(D.disciplineConfig);case 20:if(l=e.sent){e.next=24;break}return n.setState({loading:!1}),e.abrupt("return",!1);case 24:n.marksDatas.push({spreadsheetData:D,suitableDisciplines:l}),d=n.disciplinesToListItems(l,D),s=s&&d.allMissed,i+=d.missedCount,a.push.apply(a,Object(Q.a)(d.disciplines));case 29:e.next=16;break;case 31:e.next=36;break;case 33:e.prev=33,e.t0=e.catch(14),c.e(e.t0);case 36:return e.prev=36,c.f(),e.finish(36);case 39:return n.setState({loading:!1,disciplines:a,showDisciplines:!0,lastAction:et.LoadDisciplines,allDisciplinesMissed:s,missedDisciplinesCount:i,showWorkerButtons:!s}),e.abrupt("return",!s);case 41:case"end":return e.stop()}}),e,null,[[14,33,36,39]])})));return function(t,u){return e.apply(this,arguments)}}(),n.updateCachedDisciplines=function(e){e.preventDefault(),n.setState({showDisciplines:!1});var t,u=Object($.a)(n.marksDatas);try{for(u.s();!(t=u.n()).done;){var r,a=null===(r=t.value.spreadsheetData)||void 0===r?void 0:r.disciplineConfig;if(!a)return;n.props.brsApi.clearDisciplineCacheAsync(a.year,a.termType,a.course,a.isModule).then((function(e){return e}),(function(e){n.props.onError(e)}))}}catch(s){u.e(s)}finally{u.f()}n.loadDisciplines(n.spreadsheetId,n.sheetId)},n.runWork=function(){var e=Object(b.a)(C.a.mark((function e(t){return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n.state.lastAction===et.LoadDisciplines){e.next=6;break}return e.next=3,n.loadDisciplines(n.spreadsheetId,n.sheetId);case 3:if(e.sent){e.next=6;break}return e.abrupt("return");case 6:n.workerSaveMode=t,n.setState({lastAction:et.RunWork,runWorker:!0});case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),n.handleRunWorkSafe=function(){return n.runWork(!1)},n.handleRunWorkUnsafe=function(){return n.runWork(!0)},n.handleWorkerClosed=function(){return n.setState({runWorker:!1})},n.state={tableUrl:"",loading:!1,showDisciplines:!1,lastAction:et.None,tableUrlError:{error:!1,message:""},disciplines:[],allDisciplinesMissed:!1,missedDisciplinesCount:0,showWorkerButtons:!1,runWorker:!1},n}return Object(d.a)(u,[{key:"disciplinesToListItems",value:function(e,t){var u=Array.from(new Set(t.actualStudents.map((function(e){return e.groupName||""})))),n=Array.from(new Set(e.map((function(e){return e.group})))),r=0,a=u.map((function(e){if(e.length>0){var t=ue(e),u=n.filter((function(e){return ue(e).startsWith(t)}));return 0===u.length?(r++,[{title:e,colored:!0}]):u.map((function(e){return{title:e,colored:!1}}))}return 0===n.length?(r++,[{title:"\u0410\u0432\u0442\u043e\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u2192 \u043d\u0435\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432",colored:!0}]):n.map((function(e){return{title:"\u0410\u0432\u0442\u043e\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u2192 ".concat(e),colored:!1}}))})).flat(),s=t.disciplineConfig,i=s.termType===Y.Fall?"\u043e\u0441\u0435\u043d\u044c ".concat(s.year):s.termType===Y.Spring?"\u0432\u0435\u0441\u043d\u0430 ".concat(s.year+1):"".concat(s.year,"/").concat(s.year+1),c="".concat(s.name,", ").concat(i,", ").concat(s.course," \u043a\u0443\u0440\u0441");return{allMissed:r===u.length,missedCount:r,disciplines:[{title:c,nestedItems:a}]}}},{key:"getActualDisciplinesAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t){var u;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.props.brsApi.getDisciplineCachedAsync(t.year,t.termType,t.course,t.isModule);case 3:return u=e.sent,e.abrupt("return",u.filter((function(e){return ne(e.discipline,t.name)})));case 7:e.prev=7,e.t0=e.catch(0),this.props.onError(e.t0);case 10:case"end":return e.stop()}}),e,this,[[0,7]])})));return function(t){return e.apply(this,arguments)}}()},{key:"getActualSpreadsheetDataAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u){var n,r,a;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getSheetName(t,u);case 2:if(n=e.sent){e.next=5;break}return e.abrupt("return",null);case 5:return e.prev=5,a=new Fe(t),e.next=9,a.getSpreadsheetDataAsync(n);case 9:r=e.sent,e.next=16;break;case 12:return e.prev=12,e.t0=e.catch(5),this.props.onError(e.t0.message||JSON.stringify(e.t0)),e.abrupt("return",null);case 16:return e.abrupt("return",r);case 17:case"end":return e.stop()}}),e,this,[[5,12]])})));return function(t,u){return e.apply(this,arguments)}}()},{key:"getSheetName",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u){var n,r,a;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,te(t).getMetaAsync();case 3:if(n=e.sent,r=n.sheets.map((function(e){return e.properties})),a=u?r.filter((function(e){return e.sheetId.toString()===u}))[0]:r[0]){e.next=9;break}return this.props.onError("\u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430"),e.abrupt("return",null);case 9:return e.abrupt("return",a.title);case 12:return e.prev=12,e.t0=e.catch(0),this.props.onError(e.t0.message||JSON.stringify(e.t0)),e.abrupt("return",null);case 16:case"end":return e.stop()}}),e,this,[[0,12]])})));return function(t,u){return e.apply(this,arguments)}}()},{key:"render",value:function(){return Object(U.jsxs)("span",{className:"spreadsheet-fetch",children:[Object(U.jsx)("h3",{className:"vertical-margin-min",children:"\u0412\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043b\u0438\u0441\u0442 Google \u0422\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u043e\u0446\u0435\u043d\u043a\u0430\u043c\u0438"}),Object(U.jsx)(ot,{loading:this.state.loading,onSubmit:this.loadDisciplines}),Object(U.jsxs)(Me.a,{in:this.state.showDisciplines,className:"vertical-margin-min",children:[Object(U.jsx)("h3",{children:"\u0417\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0435 \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u044b \u0438\u0437 Google \u0422\u0430\u0431\u043b\u0438\u0446\u044b"}),this.state.missedDisciplinesCount>0&&Object(U.jsxs)("p",{children:["\u0413\u0440\u0443\u043f\u043f\u044b, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0443 \u0432\u0430\u0441 \u043d\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0432 \u0411\u0420\u0421,"," ",Object(U.jsx)("b",{className:"colored-text",children:" \u043f\u043e\u0434\u0441\u0432\u0435\u0447\u0435\u043d\u044b"})]}),Object(U.jsx)(Ue,{items:this.state.disciplines,icons:[Object(U.jsx)(it.a,{}),Object(U.jsx)(st.a,{})]}),this.state.allDisciplinesMissed?Object(U.jsxs)(s.a.Fragment,{children:[Object(U.jsx)("p",{children:"\u0423 \u0432\u0430\u0441 \u043d\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043d\u0438 \u043a \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u0433\u0440\u0443\u043f\u043f \u0432 \u0411\u0420\u0421"}),Object(U.jsx)("span",{children:"\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f:"}),Object(U.jsxs)("ol",{className:"no-margin",children:[Object(U.jsx)("li",{children:"\u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u044b \u0432 \u0411\u0420\u0421 \u0438 \u0432 Google \u0422\u0430\u0431\u043b\u0438\u0446\u0430\u0445 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442"}),Object(U.jsx)("li",{children:"\u0417\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u0435 \u0434\u043e\u0441\u0442\u0443\u043f \u043d\u0430 \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u0443 \u0432 \u0411\u0420\u0421"}),Object(U.jsx)("li",{children:"\u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0442\u0435\u0445\u043a\u0430\u0440\u0442\u0430 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u0430 \u0432 \u0411\u0420\u0421"}),Object(U.jsx)("li",{children:Object(U.jsx)("button",{className:"button-link",onClick:this.updateCachedDisciplines,children:"\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u0435 \u043a\u044d\u0448 \u0433\u0440\u0443\u043f\u043f"})})]})]}):Object(U.jsxs)(s.a.Fragment,{children:[Object(U.jsxs)("p",{children:["\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043d\u0435 \u0432\u0441\u0435 \u0433\u0440\u0443\u043f\u043f\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0430\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432 \u0411\u0420\u0421, \u0442\u043e"," ",Object(U.jsx)("button",{className:"button-link",onClick:this.updateCachedDisciplines,children:"\u043e\u0431\u043d\u043e\u0432\u0438\u0442\u0435 \u043a\u044d\u0448 \u0433\u0440\u0443\u043f\u043f"})]}),Object(U.jsx)(I.a,{className:"vertical-margin-medium",children:Object(U.jsx)(Ge,{enabled:this.state.showWorkerButtons,onRunWorkSafe:this.handleRunWorkSafe,onRunWorkUnsafe:this.handleRunWorkUnsafe})})]})]}),this.state.runWorker&&Object(U.jsx)(rt,{marksDatas:this.marksDatas,onClosed:this.handleWorkerClosed,brsApi:this.props.brsApi,onError:this.props.onError,save:this.workerSaveMode})]})}}]),u}(s.a.Component),lt=Object(a.memo)(Dt),dt=u(595),pt=u(596),Ft=s.a.forwardRef((function(e,t){return Object(U.jsx)(dt.a,Object(z.a)({direction:"up",ref:t},e))}));function ht(e){var t=e.open,u=e.sessionName,n=e.onOk;return Object(U.jsx)(s.a.Fragment,{children:Object(U.jsxs)(ze.a,{open:t,TransitionComponent:Ft,keepMounted:!0,"aria-labelledby":"alert-dialog-slide-title","aria-describedby":"alert-dialog-slide-description",children:[Object(U.jsx)(Je.a,{id:"alert-dialog-slide-title",children:"\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f"}),Object(U.jsx)(qe.a,{children:Object(U.jsxs)(pt.a,{id:"alert-dialog-slide-description",children:["\u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441\u0435\u0441\u0441\u0438\u0438 ",u," \u0438\u0441\u0442\u0435\u043a\u043b\u043e.",Object(U.jsx)("br",{}),"\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f."]})}),Object(U.jsx)(Xe.a,{style:{display:"flex",justifyContent:"space-around"},children:Object(U.jsx)(N.a,{onClick:n,color:"primary",children:"\u041e\u043a"})})]})})}u(540);function ft(){return Object(U.jsx)("div",{className:"loading-pane",children:Object(U.jsx)(T.a,{size:100,className:"progress"})})}var Ct=function(e){Object(S.a)(u,e);var t=Object(w.a)(u);function u(e){var n;return Object(l.a)(this,u),(n=t.call(this,e)).handleError=function(e){var t=e.message||JSON.stringify(e);e.statusCode?e.statusCode===r.BrsUnauthorized?n.handleSessionExpired("\u0411\u0420\u0421"):n.handleSessionExpired("Google"):"RequestError"===e.name?n.setState({errorMessage:"\u0412 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043f\u043e\u0437\u0436\u0435."}):n.setState({errorMessage:t})},n.handleSessionExpired=function(e){n.setState({openSessionExpiredAlert:!0,sessionName:e,loading:!1})},n.handleSessionExpiredOk=function(){"\u0411\u0420\u0421"===n.state.sessionName?(n.props.brsAuth.logout(),n.returnToLoginPage(),n.setState({redirect:!0})):"Google"===n.state.sessionName&&n.returnToLoginPage()},n.closeError=function(){n.setState({errorMessage:""})},n.returnToLoginPage=function(){n.setState({redirect:!0})},n.state={showControls:!1,runWork:!1,openSessionExpiredAlert:!1,sessionName:"",errorMessage:"",loading:!0,redirect:!1},n}return Object(d.a)(u,[{key:"componentDidMount",value:function(){var e=Object(b.a)(C.a.mark((function e(){var t=this;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.props.googleAuth.ensureInitializedAsync();case 2:return e.next=4,this.props.brsAuth.tryRestoreAsync();case 4:this.props.brsAuth.checkAuth()||this.handleSessionExpired("\u0411\u0420\u0421"),this.props.googleAuth.checkAuthorized()?this.setState({loading:!1}):setTimeout((function(){t.props.googleAuth.checkAuthorized()?t.setState({loading:!1}):t.handleSessionExpired("Google")}),1e3);case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"render",value:function(){return Object(U.jsxs)(s.a.Fragment,{children:[this.state.loading&&Object(U.jsx)(ft,{}),Object(U.jsx)(ht,{open:this.state.openSessionExpiredAlert,sessionName:this.state.sessionName,onOk:this.handleSessionExpiredOk}),this.state.errorMessage&&Object(U.jsx)(X,{open:!!this.state.errorMessage,message:this.state.errorMessage,type:"error",onClose:this.closeError}),this.state.redirect&&Object(U.jsx)(D.a,{to:"/"}),Object(U.jsx)("div",{className:"work-page",children:Object(U.jsxs)(I.a,{maxWidth:"md",children:[Object(U.jsx)(N.a,{variant:"contained",style:{marginTop:10},onClick:this.returnToLoginPage,children:"\u0412\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0432\u0445\u043e\u0434\u0430"}),Object(U.jsx)(lt,{brsApi:this.props.brsApi,onError:this.handleError})]})})]})}}]),u}(s.a.Component);function bt(){return Object(U.jsx)(B.Consumer,{children:function(e){return e&&Object(U.jsx)(Ct,{brsAuth:e.brsAuth,brsApi:e.brsApi,googleAuth:e.googleAuth})}})}var vt=new h(!0),mt=new j(vt),gt=new ee(mt,vt),Et=new O;function At(){return Object(U.jsx)(B.Provider,{value:{brsAuth:mt,brsApi:gt,googleAuth:Et},children:Object(U.jsx)(o.a,{hashType:"noslash",children:Object(U.jsxs)(D.d,{children:[Object(U.jsx)(D.b,{path:"/work",component:bt}),Object(U.jsx)(D.b,{exact:!0,path:"",component:Z})]})})})}var yt=function(e){e&&e instanceof Function&&u.e(3).then(u.bind(null,602)).then((function(t){var u=t.getCLS,n=t.getFID,r=t.getFCP,a=t.getLCP,s=t.getTTFB;u(e),n(e),r(e),a(e),s(e)}))};u(541);c.a.render(Object(U.jsx)(At,{}),document.getElementById("root")),yt()}},[[542,1,2]]]);
-//# sourceMappingURL=main.303a61b2.chunk.js.map
\ No newline at end of file
+(this["webpackJsonpbrs-extensions"]=this["webpackJsonpbrs-extensions"]||[]).push([[0],{314:function(e,t){},316:function(e,t){},325:function(e,t){},327:function(e,t){},352:function(e,t){},354:function(e,t){},355:function(e,t){},360:function(e,t){},362:function(e,t){},368:function(e,t){},370:function(e,t){},389:function(e,t){},401:function(e,t){},404:function(e,t){},430:function(e,t){},525:function(e,t,u){},526:function(e,t,u){},531:function(e,t,u){},533:function(e,t,u){},534:function(e,t,u){},535:function(e,t,u){},540:function(e,t,u){},541:function(e,t,u){},542:function(e,t,u){"use strict";u.r(t);var n,r,a=u(0),s=u.n(a),i=u(19),c=u.n(i),o=u(120),D=u(28),l=u(22),d=u(21),p="https://docs.google.com/spreadsheets/d/1Owzl3JfmFASIdC7ZMMw-0kkA3pwFSab1QdVO5dhZoxY/edit#gid=675912523",F="https://brs.urfu.ru/mrd",h=function(){function e(t){Object(l.a)(this,e),this.withProxy=void 0,this.withProxy=t}return Object(d.a)(e,[{key:"baseUrl",get:function(){return this.withProxy?"".concat("https://bbamc5stve2edro7t455.containers.yandexcloud.net","/").concat(F):F}}]),e}(),f=u(3),C=u.n(f),b=u(7),v=u(103),m=u.n(v);function g(e,t,u){if(!t)return!1;var r=JSON.stringify(t);return u!==n.Local&&u!==n.LocalAndSession||localStorage.setItem(e,r),u!==n.Session&&u!==n.LocalAndSession||sessionStorage.setItem(e,r),!0}function E(e,t){var u,r=null;if(t===n.Local&&(r=localStorage.getItem(e)),t===n.Session&&(r=sessionStorage.getItem(e)),t===n.LocalAndSession&&(r=null!==(u=sessionStorage.getItem(e))&&void 0!==u?u:localStorage.getItem(e)),!r)return null;var a=JSON.parse(r);return a||null}function A(e,t){return t!==n.Local&&t!==n.LocalAndSession||localStorage.removeItem(e),t!==n.Session&&t!==n.LocalAndSession||sessionStorage.removeItem(e),!0}!function(e){e[e.Local=0]="Local",e[e.Session=1]="Session",e[e.LocalAndSession=2]="LocalAndSession"}(n||(n={})),function(e){e[e.BrsUnauthorized=1]="BrsUnauthorized",e[e.GoogleUnauthorized=2]="GoogleUnauthorized"}(r||(r={}));var y,x=function e(t){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";Object(l.a)(this,e),this.message=void 0,this.statusCode=void 0,this.statusCode=t,this.message=u};!function(e){e[e.Succeed=0]="Succeed",e[e.InvalidCredentials=1]="InvalidCredentials",e[e.Error=2]="Error"}(y||(y={}));var j=function(){function e(t){Object(l.a)(this,e),this.brsUrlProvider=void 0,this._sid=null,this._safeUserName=null,this._userName="Anonymous",this.brsUrlProvider=t}return Object(d.a)(e,[{key:"sid",get:function(){if(!this._sid)throw new x(r.BrsUnauthorized,"\u041d\u0435\u0442 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u0411\u0420\u0421");return this._sid}},{key:"safeUserName",get:function(){if(!this._safeUserName)throw new x(r.BrsUnauthorized,"\u041d\u0435\u0442 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u0411\u0420\u0421");return this._safeUserName}},{key:"userName",get:function(){return this._userName}},{key:"checkAuth",value:function(){return!(!this._sid||!this._safeUserName)}},{key:"tryRestoreAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(){var t,u;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._sid||!this._safeUserName){e.next=2;break}return e.abrupt("return");case 2:if(!(t=E("loginInfo",n.Session))){e.next=6;break}return this.saveLoginInfo(t.sid,t.userName),e.abrupt("return");case 6:if(t=E("loginInfo",n.Local)){e.next=9;break}return e.abrupt("return");case 9:return e.next=11,this.checkSidAsync(t.sid);case 11:(null===(u=e.sent)||void 0===u?void 0:u.success)&&this.saveLoginInfo(t.sid,t.userName);case 13:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"checkSidAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t){var u,n;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,m()({method:"GET",url:this.brsUrlProvider.baseUrl+"/mvc/mobile",headers:{"X-Cookie":"JSESSIONID=".concat(t),"X-Requested-With":"XMLHttpRequest"}});case 3:if(u=e.sent,!(n=u.match(/username">([\u0410-\u042f\u0401\u0430-\u044f\u0451 -]+)))){e.next=7;break}return e.abrupt("return",{success:!0,userName:n[1]});case 7:return e.abrupt("return",{success:!1,userName:"Anonymous"});case 10:return e.prev=10,e.t0=e.catch(0),e.abrupt("return",null);case 13:case"end":return e.stop()}}),e,this,[[0,10]])})));return function(t){return e.apply(this,arguments)}}()},{key:"loginAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u){var n,r,a,s,i;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.requestSidAsync(t,u);case 2:if((n=e.sent)&&"x-set-cookie"in n.headers){e.next=5;break}return e.abrupt("return",y.Error);case 5:if(r=n.headers["x-set-cookie"],a=r.match(/(?<=JSESSIONID=)\w+/)){e.next=9;break}return e.abrupt("return",y.Error);case 9:return s=a[0],e.next=12,this.checkSidAsync(s);case 12:if(null!==(i=e.sent)){e.next=15;break}return e.abrupt("return",y.Error);case 15:if(i.success){e.next=17;break}return e.abrupt("return",y.InvalidCredentials);case 17:return this.saveLoginInfo(s,i.userName),e.abrupt("return",y.Succeed);case 19:case"end":return e.stop()}}),e,this)})));return function(t,u){return e.apply(this,arguments)}}()},{key:"authBySidAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t){var u;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return",y.InvalidCredentials);case 2:return e.next=4,this.checkSidAsync(t);case 4:if(null!==(u=e.sent)){e.next=7;break}return e.abrupt("return",y.Error);case 7:if(u.success){e.next=9;break}return e.abrupt("return",y.InvalidCredentials);case 9:return this.saveLoginInfo(t,u.userName),e.abrupt("return",y.Succeed);case 11:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"saveLoginInfo",value:function(e,t){var u=t.replaceAll(/[^A-Za-z\u0410-\u042f\u0401\u0430-\u044f\u0451]/g,"_");g("loginInfo",{sid:e,safeUserName:u,userName:t},n.LocalAndSession),this._sid=e,this._safeUserName=u,this._userName=t}},{key:"logout",value:function(){this._sid=null,this._safeUserName=null,A("loginInfo",n.LocalAndSession)}},{key:"requestSidAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u){return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,m()({url:this.brsUrlProvider.baseUrl+"/login",method:"POST",body:"username=".concat(t,"&password=").concat(u),resolveWithFullResponse:!0,simple:!1,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}).then((function(e){return e}),(function(){return null}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})));return function(t,u){return e.apply(this,arguments)}}()}]),e}(),k=["https://sheets.googleapis.com/$discovery/rest?version=v4"],O=function(){function e(){Object(l.a)(this,e)}return Object(d.a)(e,[{key:"ensureInitializedAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(){return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!gapi.client){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,new Promise((function(e){gapi.load("client:auth2",e)}));case 4:gapi.client.init({clientId:"122993083593-pacve8csj86voko30ia65raeg0ncrtuv.apps.googleusercontent.com",discoveryDocs:k,scope:"profile email https://www.googleapis.com/auth/spreadsheets"}).catch(console.error);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()},{key:"listenAuthorized",value:function(e){var t,u,n;null===(t=gapi.auth2)||void 0===t||null===(u=t.getAuthInstance())||void 0===u||null===(n=u.isSignedIn)||void 0===n||n.listen(e)}},{key:"checkAuthorized",value:function(){var e,t,u;return null===(e=gapi.auth2)||void 0===e||null===(t=e.getAuthInstance())||void 0===t||null===(u=t.isSignedIn)||void 0===u?void 0:u.get()}},{key:"getUserName",value:function(){var e,t,u,n,r=null===(e=gapi.auth2)||void 0===e||null===(t=e.getAuthInstance())||void 0===t||null===(u=t.currentUser)||void 0===u||null===(n=u.get())||void 0===n?void 0:n.getBasicProfile();return(null===r||void 0===r?void 0:r.getName())||(null===r||void 0===r?void 0:r.getEmail())}},{key:"logout",value:function(){var e=Object(b.a)(C.a.mark((function e(){var t,u;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(t=gapi.auth2)||void 0===t||null===(u=t.getAuthInstance())||void 0===u?void 0:u.signOut();case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()}]),e}(),B=Object(a.createContext)(null),S=u(50),w=u(67),N=(u(525),u(574)),I=u(582),M=u(27),L=u(597),T=u(578),U=(u(526),u(2));function W(e){var t=e.title,u=e.loading,n=e.className,r=e.onClick,a=e.disabled,s=void 0!==a&&a;return Object(U.jsxs)("div",{className:"submit-with-loading "+n,children:[Object(U.jsx)(N.a,{type:"submit",fullWidth:!0,variant:"contained",color:"primary",onClick:r,disabled:u||s,children:t}),u&&Object(U.jsx)(T.a,{color:"secondary",size:24,className:"button-progress"})]})}u(531);function R(e){var t=e.onSubmit,u=e.submitting,n=e.loading,r=e.signedIn,a=e.onLogout,i=e.userName,c=s.a.useState(""),o=Object(M.a)(c,2),D=o[0],l=o[1],d=s.a.useState(""),p=Object(M.a)(d,2),F=p[0],h=p[1],f=s.a.useState(""),C=Object(M.a)(f,2),b=C[0],v=C[1];return r?Object(U.jsxs)(s.a.Fragment,{children:[Object(U.jsxs)("p",{children:["\u0414\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c, ",i]}),Object(U.jsx)(N.a,{type:"button",fullWidth:!0,variant:"contained",onClick:a,color:"primary",children:"\u0412\u044b\u0439\u0442\u0438 \u0438\u0437 \u0411\u0420\u0421"})]}):Object(U.jsxs)("div",{className:"brs-login-form",children:[Object(U.jsxs)("p",{children:[Object(U.jsx)("b",{children:"\u0412\u043e\u0439\u0434\u0438\u0442\u0435 \u0432 \u0411\u0420\u0421"}),", \u0447\u0442\u043e\u0431\u044b \u0441\u0435\u0440\u0432\u0438\u0441 \u043c\u043e\u0433 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0432\u0430\u0448\u0438\u0445 \u043a\u0443\u0440\u0441\u0430\u0445 \u0438 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043e\u0446\u0435\u043d\u043a\u0438 \u043e\u0442 \u0432\u0430\u0448\u0435\u0433\u043e \u0438\u043c\u0435\u043d\u0438"]}),Object(U.jsx)("p",{children:"\u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0443\u0447\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0411\u0420\u0421"}),Object(U.jsxs)("form",{className:"form",onSubmit:function(e){e.preventDefault(),n||t({login:D,password:F,sid:b})},children:[Object(U.jsx)(L.a,{className:"form-component",variant:"outlined",margin:"normal",fullWidth:!0,id:"username",label:"\u0418\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f",name:"username",autoFocus:!0,value:D,disabled:n,onChange:function(e){var t=e.target.value;l(t),v("")}}),Object(U.jsx)(L.a,{className:"form-component",variant:"outlined",margin:"normal",fullWidth:!0,name:"password",label:"\u041f\u0430\u0440\u043e\u043b\u044c",type:"password",id:"password",autoComplete:"current-password",value:F,disabled:n,onChange:function(e){var t=e.target.value;h(t),v("")}}),Object(U.jsx)("p",{className:"form-component text-align-center",children:"\u0438\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 JSESSIONID \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0435\u0434\u0438\u043d\u043e\u0439 \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0423\u0440\u0424\u0423"}),Object(U.jsx)(L.a,{className:"form-component",variant:"outlined",margin:"normal",fullWidth:!0,name:"sid",label:"JSESSIONID",type:"password",id:"sid",value:b,disabled:n,onChange:function(e){var t=e.target.value;v(t),l(""),h("")}}),Object(U.jsx)("a",{href:"https://docs.google.com/document/d/1btXePo-5bE8RyX7RFXnBuS-UN9SmwUithpc_UXhAWsg/edit",className:"button-link",target:"_blank",rel:"noreferrer",children:"\u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c JSESSIONID"}),Object(U.jsx)(W,{className:"vertical-margin-medium",title:"\u0432\u043e\u0439\u0442\u0438",loading:u,disabled:n})]}),n&&Object(U.jsx)(T.a,{color:"primary",size:150,className:"progress"})]})}var P=u(269),G=u.n(P);function _(e){var t=e.onSignedIn,u=e.onFailure,n=e.signedIn,r=e.userName,a=e.onLogout;return Object(U.jsx)(s.a.Fragment,{children:n?Object(U.jsxs)(I.a,{className:"text-align-center",children:[Object(U.jsxs)("p",{children:["\u0414\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c, ",r]}),Object(U.jsx)(N.a,{type:"button",fullWidth:!0,variant:"contained",onClick:a,color:"primary",children:"\u0412\u044b\u0439\u0442\u0438 \u0438\u0437 Google"})]}):Object(U.jsxs)(I.a,{className:"text-align-center",children:[Object(U.jsxs)("p",{children:[Object(U.jsx)("b",{children:"\u0412\u043e\u0439\u0434\u0438\u0442\u0435 \u0432 Google"}),", \u0447\u0442\u043e\u0431\u044b \u0441\u0435\u0440\u0432\u0438\u0441 \u043c\u043e\u0433 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u043e\u0446\u0435\u043d\u043a\u0438 \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 \u0432\u0430\u0448\u0438\u0445 Google\xa0\u0422\u0430\u0431\u043b\u0438\u0446"]}),Object(U.jsx)(G.a,{clientId:"122993083593-pacve8csj86voko30ia65raeg0ncrtuv.apps.googleusercontent.com",buttonText:"\u0412\u043e\u0439\u0442\u0438 \u0432 \u0430\u043a\u043a\u0430\u0443\u043d\u0442 Google",onSuccess:t,onFailure:u,scope:"profile email https://www.googleapis.com/auth/spreadsheets",isSignedIn:!0})]})})}var z=u(54),J=u(598),q=u(600);function X(e){var t=e.open,u=e.message,n=e.type,r=e.onClose;return Object(U.jsx)(s.a.Fragment,{children:Object(U.jsx)(q.a,{open:t,autoHideDuration:1e4,anchorOrigin:{vertical:"top",horizontal:"center"},onClose:r,children:Object(U.jsx)(H,{severity:n,onClose:r,children:u})})})}function H(e){return Object(U.jsx)(J.a,Object(z.a)({elevation:6,variant:"filled"},e))}var V=function(e){Object(S.a)(u,e);var t=Object(w.a)(u);function u(e){var n;return Object(l.a)(this,u),(n=t.call(this,e)).handleBrsSubmit=function(){var e=Object(b.a)(C.a.mark((function e(t){var u;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.setState({submitLoading:!0}),e.next=3,n.loginBrsAsync(t);case 3:u=e.sent,n.setState({submitLoading:!1}),e.t0=u,e.next=e.t0===y.Succeed?8:e.t0===y.Error?10:e.t0===y.InvalidCredentials?12:13;break;case 8:return n.setState({alertMessage:"\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0448\u043b\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e",openAlert:!0,alertType:"success",brsAuthorized:!0}),e.abrupt("break",13);case 10:return n.setState({alertMessage:"\u0427\u0442\u043e-\u0442\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a :( \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043f\u043e\u0437\u0436\u0435",openAlert:!0,alertType:"error"}),e.abrupt("break",13);case 12:n.setState({alertMessage:"\u041d\u0435\u0432\u0435\u0440\u043d\u044b\u0435 \u043b\u043e\u0433\u0438\u043d, \u043f\u0430\u0440\u043e\u043b\u044c \u0438\u043b\u0438 JSESSIONID",openAlert:!0,alertType:"error"});case 13:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),n.loginBrsAsync=function(){var e=Object(b.a)(C.a.mark((function e(t){return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.sid){e.next=4;break}return e.next=3,n.props.brsAuth.authBySidAsync(t.sid);case 3:return e.abrupt("return",e.sent);case 4:if(!t.login||!t.password){e.next=8;break}return e.next=7,n.props.brsAuth.loginAsync(t.login,t.password);case 7:return e.abrupt("return",e.sent);case 8:return e.abrupt("return",y.InvalidCredentials);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),n.handleCloseAlert=function(){n.setState({openAlert:!1})},n.handleGoogleSignedIn=function(){n.setState({googleAuthorized:!0})},n.handleGoogleLoginFailed=function(e){console.error(e),n.setState({openAlert:!0,alertType:"error",alertMessage:"\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0412\u0430\u0448 Google \u0430\u043a\u043a\u0430\u0443\u043d\u0442 :("})},n.startWork=function(){n.setState({redirect:!0})},n.handleBrsLogout=function(){n.props.brsAuth.logout(),n.setState({brsAuthorized:!1,alertMessage:"\u0412\u044b \u0432\u044b\u0448\u043b\u0438 \u0438\u0437 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430 \u0411\u0420\u0421",alertType:"success",openAlert:!0})},n.handleGoogleLogout=Object(b.a)(C.a.mark((function e(){return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.props.googleAuth.logout();case 2:n.setState({googleAuthorized:!1,alertType:"success",alertMessage:"\u0412\u044b \u0432\u044b\u0448\u043b\u0438 \u0438\u0437 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430 Google",openAlert:!0});case 3:case"end":return e.stop()}}),e)}))),n.renderGreeting=function(){return Object(U.jsxs)("div",{className:"greeting",children:[Object(U.jsx)("h2",{children:"\u0414\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u0432 \u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0411\u0420\u0421"}),Object(U.jsx)("h3",{className:"block-header",children:"\u041a\u0430\u043a \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442"}),Object(U.jsxs)("ol",{children:[Object(U.jsxs)("li",{children:["\u0412 Google\xa0\u0422\u0430\u0431\u043b\u0438\u0446\u0430\u0445 \u0432\u044b \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0435 \u043e\u0446\u0435\u043d\u043a\u0438 \u0437\u0430 \u043a\u0443\u0440\u0441 \u043f\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443"," ",Object(U.jsx)("a",{href:p,target:"_blank",rel:"noreferrer",className:"button-link",children:"\u0448\u0430\u0431\u043b\u043e\u043d\u0443"})]}),Object(U.jsx)("li",{children:"\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0435 Google \u0422\u0430\u0431\u043b\u0438\u0446\u0443 \u0432 \u0441\u0435\u0440\u0432\u0438\u0441 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0435 \u043f\u0440\u043e\u0431\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0446\u0435\u043d\u043e\u043a, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438"}),Object(U.jsx)("li",{children:"\u041d\u0430\u043a\u043e\u043d\u0435\u0446 \u0434\u0435\u043b\u0430\u0435\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u043a \u0441 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u043e\u0446\u0435\u043d\u043e\u043a"})]}),Object(U.jsx)("h3",{className:"block-header",children:"\u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445"}),Object(U.jsxs)("p",{children:["\u0412\u0430\u0448 \u043b\u043e\u0433\u0438\u043d \u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u0411\u0420\u0421 \u0438 \u043d\u0438\u0433\u0434\u0435 \u043d\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f",Object(U.jsx)("br",{}),"\u0414\u0430\u043d\u043d\u044b\u0435 \u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0432\u0430\u043c \u043a\u0443\u0440\u0441\u0430\u0445 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0432\u0430\u0448\u0435\u043c \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435"]}),Object(U.jsx)("hr",{})]})},n.renderBrsLogin=function(){return Object(U.jsx)(R,{onSubmit:n.handleBrsSubmit,loading:n.state.brsLoading,signedIn:n.state.brsAuthorized,onLogout:n.handleBrsLogout,userName:n.props.brsAuth.userName,submitting:n.state.submitLoading})},n.renderGoogleLogin=function(){return Object(U.jsx)(_,{onSignedIn:n.handleGoogleSignedIn,signedIn:n.state.googleAuthorized,userName:n.props.googleAuth.getUserName(),onLogout:n.handleGoogleLogout,onFailure:n.handleGoogleLoginFailed})},n.renderStartWorkButton=function(){return Object(U.jsx)(N.a,{variant:"contained",onClick:n.startWork,disabled:!n.state.brsAuthorized||!n.state.googleAuthorized,color:"secondary",children:"\u043d\u0430\u0447\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443"})},n.state={brsLoading:!0,brsAuthorized:!1,googleAuthorized:!1,redirect:!1,submitLoading:!1,openAlert:!1,alertMessage:"",alertType:"error"},n}return Object(d.a)(u,[{key:"componentDidMount",value:function(){var e=Object(b.a)(C.a.mark((function e(){var t,u,n=this;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.props.googleAuth.ensureInitializedAsync();case 2:return e.next=4,this.props.brsAuth.tryRestoreAsync();case 4:this.props.googleAuth.listenAuthorized((function(e){n.setState({googleAuthorized:e})})),t=this.props.brsAuth.checkAuth(),u=this.props.googleAuth.checkAuthorized(),this.setState({brsLoading:!1,brsAuthorized:t,googleAuthorized:u});case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"render",value:function(){return Object(U.jsxs)("div",{className:"login-page",children:[this.state.redirect&&Object(U.jsx)(D.a,{to:"/work"}),Object(U.jsxs)(I.a,{component:"main",maxWidth:"md",children:[this.renderGreeting(),Object(U.jsxs)(I.a,{maxWidth:"xs",children:[Object(U.jsx)(I.a,{children:this.renderBrsLogin()}),Object(U.jsx)("hr",{className:"vertical-margin-medium"}),Object(U.jsx)(I.a,{children:this.renderGoogleLogin()})]}),Object(U.jsx)(I.a,{className:"text-align-center vertical-margin-large",children:this.renderStartWorkButton()}),Object(U.jsx)(X,{open:this.state.openAlert,message:this.state.alertMessage,type:this.state.alertType,onClose:this.handleCloseAlert})]})]})}}]),u}(s.a.Component);function Z(){return Object(U.jsx)(B.Consumer,{children:function(e){return e&&Object(U.jsx)(V,{brsAuth:e.brsAuth,googleAuth:e.googleAuth})}})}var K,Y,Q=u(13),$=u(23);u(175);!function(e){e[e.NoFailure=-1]="NoFailure",e[e.NotChosen=-19]="NotChosen",e[e.NotAllowedByDeansOffice=-18]="NotAllowedByDeansOffice",e[e.NotAppeared=0]="NotAppeared",e[e.DisrespectfulReason=12]="DisrespectfulReason",e[e.RespectfulReason=13]="RespectfulReason",e[e.NotAllowedByTeacher=18]="NotAllowedByTeacher",e[e.ShouldNotPass=19]="ShouldNotPass",e[e.AcademicLeave=20]="AcademicLeave",e[e.DroppedOut=21]="DroppedOut"}(K||(K={})),function(e){e[e.Fall=1]="Fall",e[e.Spring=2]="Spring"}(Y||(Y={}));var ee=function(){function e(t,u){Object(l.a)(this,e),this.brsAuth=void 0,this.brsUrlProvider=void 0,this.brsAuth=t,this.brsUrlProvider=u}return Object(d.a)(e,[{key:"getDisciplineCachedAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,r,a){var s,i,c,o;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=this.getDisciplineCacheName(t,u,r,a),!(i=E(s,n.Session))){e.next=4;break}return e.abrupt("return",i);case 4:return e.next=6,this.getDisciplineTotalAsync(t,u,r,a);case 6:return c=e.sent,e.next=9,this.getDisciplineInternalAsync(t,u,r,a,1,Math.max(1e4,c),c);case 9:return o=e.sent,g(s,o.disciplines,n.Session),e.abrupt("return",o.disciplines);case 12:case"end":return e.stop()}}),e,this)})));return function(t,u,n,r){return e.apply(this,arguments)}}()},{key:"getDisciplineInternalAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n,r,a,s,i){var c,o,D,l,d,p,F,h,f;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c="?year=".concat(t,"&termType=").concat(u,"&course=").concat(n,"&total=").concat(i,"&page=").concat(a,"&pageSize=").concat(s,"&search="),!r){e.next=11;break}return e.next=4,this.requestApiJsonAsync("/mvc/mobile/module/fetch"+c);case 4:o=e.sent,D=o.content,l=Object($.a)(D);try{for(l.s();!(d=l.n()).done;)d.value.isModule=!0}catch(C){l.e(C)}finally{l.f()}return e.abrupt("return",{disciplines:D,numberOfElements:o.numberOfElements});case 11:return e.next=13,this.requestApiJsonAsync("/mvc/mobile/discipline/fetch"+c);case 13:p=e.sent,F=p.content,h=Object($.a)(F);try{for(h.s();!(f=h.n()).done;)f.value.isModule=!1}catch(C){h.e(C)}finally{h.f()}return e.abrupt("return",{disciplines:F,numberOfElements:p.numberOfElements});case 18:case"end":return e.stop()}}),e,this)})));return function(t,u,n,r,a,s,i){return e.apply(this,arguments)}}()},{key:"clearDisciplineCacheAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,r,a){return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:A(this.getDisciplineCacheName(t,u,r,a),n.Session);case 2:case"end":return e.stop()}}),e,this)})));return function(t,u,n,r){return e.apply(this,arguments)}}()},{key:"getDisciplineTotalAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n,r){var a,s,i;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=r?"&its=true":"",s="?year=".concat(t,"&termType=").concat(u,"&course=").concat(n)+a,e.next=4,this.requestApiJsonAsync("/mvc/mobile/discipline/amount"+s);case 4:return i=e.sent,e.abrupt("return",i);case 6:case"end":return e.stop()}}),e,this)})));return function(t,u,n,r){return e.apply(this,arguments)}}()},{key:"getAllStudentMarksAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t){var u,n,r,a,s,i;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=[],e.t1=Q.a,e.next=4,this.getStudentMarksAsync(t,"lecture","current");case 4:return e.t2=e.sent,e.t3=(0,e.t1)(e.t2),e.t4=Q.a,e.next=9,this.getStudentMarksAsync(t,"lecture","intermediate");case 9:return e.t5=e.sent,e.t6=(0,e.t4)(e.t5),e.t7=Q.a,e.next=14,this.getStudentMarksAsync(t,"laboratory","current");case 14:return e.t8=e.sent,e.t9=(0,e.t7)(e.t8),e.t10=Q.a,e.next=19,this.getStudentMarksAsync(t,"laboratory","intermediate");case 19:return e.t11=e.sent,e.t12=(0,e.t10)(e.t11),e.t13=Q.a,e.next=24,this.getStudentMarksAsync(t,"practice","current");case 24:return e.t14=e.sent,e.t15=(0,e.t13)(e.t14),e.t16=Q.a,e.next=29,this.getStudentMarksAsync(t,"practice","intermediate");case 29:return e.t17=e.sent,e.t18=(0,e.t16)(e.t17),e.t19=Q.a,e.next=34,this.getStudentMarksAsync(t,"additionalPractice","current");case 34:return e.t20=e.sent,e.t21=(0,e.t19)(e.t20),e.t22=Q.a,e.next=39,this.getStudentMarksAsync(t,"additionalPractice","intermediate");case 39:e.t23=e.sent,e.t24=(0,e.t22)(e.t23),u=e.t0.concat.call(e.t0,e.t3,e.t6,e.t9,e.t12,e.t15,e.t18,e.t21,e.t24),n={},r=Object($.a)(u);try{for(r.s();!(a=r.n()).done;)s=a.value,i=n[s.studentUuid]||{},n[s.studentUuid]=Object(z.a)(Object(z.a)({},i),s)}catch(c){r.e(c)}finally{r.f()}return e.abrupt("return",Object.keys(n).map((function(e){return n[e]})));case 46:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"getStudentMarksAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n){return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.getStudentMarksInternalAsync(t.disciplineLoad,t.isModule,t.groupHistoryId,t.groupId,u,n));case 1:case"end":return e.stop()}}),e,this)})));return function(t,u,n){return e.apply(this,arguments)}}()},{key:"getStudentMarksInternalAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n,r,a,s){var i,c,o,D=arguments;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=D.length>6&&void 0!==D[6]&&D[6],c=D.length>7&&void 0!==D[7]&&D[7],o=u?"techgroup=".concat(r):"groupUuid=".concat(n),e.abrupt("return",this.requestApiJsonAsync("/mvc/mobile/studentMarks/fetch?disciplineLoad=".concat(t,"&").concat(o)+"&cardType=".concat(a,"&hasTest=false&isTotal=").concat(i)+"&intermediate=".concat("intermediate"===s)+"&selectedTeachers=null&showActiveStudents=".concat(c)));case 4:case"end":return e.stop()}}),e,this)})));return function(t,u,n,r,a,s){return e.apply(this,arguments)}}()},{key:"getDisciplineMetaAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t){var u;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u={lecture:null,laboratory:null,practice:null,additionalPractice:null},e.next=3,this.fillCardMetaAsync(u,t,"lecture");case 3:return e.next=5,this.fillCardMetaAsync(u,t,"laboratory");case 5:return e.next=7,this.fillCardMetaAsync(u,t,"practice");case 7:return e.next=9,this.fillCardMetaAsync(u,t,"additionalPractice");case 9:return e.abrupt("return",u);case 10:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"fillCardMetaAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n){var r,a,s,i;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getControlActionColumnsCachedAsync(u,n,"current");case 2:return r=e.sent,e.next=5,this.getControlActionColumnsCachedAsync(u,n,"intermediate");case 5:if(a=e.sent,r.length+a.length!==0){e.next=8;break}return e.abrupt("return");case 8:return s={currentControlActions:this.extractControlActions(r),currentFactor:0,intermediateControlActions:this.extractControlActions(a),intermediateFactor:0,totalFactor:0},this.fillFactors(s,r),this.fillFactors(s,a),t[n]=s,e.next=14,this.getControlActionColumnsCachedAsync(u,n,"total");case 14:i=e.sent,this.fillTotalFactors(t,i);case 16:case"end":return e.stop()}}),e,this)})));return function(t,u,n){return e.apply(this,arguments)}}()},{key:"getControlActionColumnsCachedAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,r){var a,s,i;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a="".concat(this.brsAuth.safeUserName,"_getControlActionColumns_").concat(t.disciplineLoad)+"_".concat(t.isModule,"_").concat(t.groupHistoryId,"_").concat(t.groupId,"_").concat(u,"_").concat(r),!(s=E(a,n.Session))){e.next=4;break}return e.abrupt("return",s);case 4:return e.next=6,this.getControlActionColumnsInternalAsync(t.disciplineLoad,t.isModule,t.groupHistoryId,t.groupId,u,r);case 6:return i=e.sent,g(a,i,n.Session),e.abrupt("return",i);case 9:case"end":return e.stop()}}),e,this)})));return function(t,u,n){return e.apply(this,arguments)}}()},{key:"getControlActionColumnsInternalAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n,r,a,s){var i,c,o,D,l,d,p;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=u?"/module":"",c=u?r:n,e.next=4,this.requestApiAsync("/mvc/mobile/view/mark/".concat(t,"/").concat(c,"/teachers").concat(i,"/").concat(a,"/").concat(s));case 4:if(o=e.sent,D="gridColumns = toTextArray(",l=");",1===(d=o.split("\r\n").map((function(e){return e.trim()})).filter((function(e){return e.startsWith(D)}))).length){e.next=10;break}throw new Error("\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0411\u0420\u0421 \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0440\u043e\u043f\u0440\u0438\u044f\u0442\u0438\u0439. \u041e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u044d\u0442\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u0441 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c \u0442\u0435\u0445\u043a\u0430\u0440\u0442\u044b.");case 10:return p=JSON.parse(d[0].substr(D.length,d[0].length-D.length-l.length))||[],e.abrupt("return",p);case 12:case"end":return e.stop()}}),e,this)})));return function(t,u,n,r,a,s){return e.apply(this,arguments)}}()},{key:"extractControlActions",value:function(e){var t="technologyCard";return e.filter((function(e){return e.uuid&&e.uuid.startsWith(t)})).map((function(e){return{uuid:e.uuid,uuidWithoutPrefix:e.uuid.substr(t.length),maxValue:e.maxValue,isIntermediate:e.intermediate>0,controlAction:e.controlAction}}))}},{key:"fillFactors",value:function(e,t){var u,n=Object($.a)(t);try{for(n.s();!(u=n.n()).done;){var r=u.value;switch(r.uuid){case"currentWithFactor":e.currentFactor="string"===typeof r.value?parseFloat(r.value):r.value;break;case"intermediateWithFactor":e.intermediateFactor="string"===typeof r.value?parseFloat(r.value):r.value}}}catch(a){n.e(a)}finally{n.f()}}},{key:"fillTotalFactors",value:function(e,t){var u,n=Object($.a)(t);try{for(n.s();!(u=n.n()).done;){var r=u.value;switch(r.uuid){case"lecture":case"laboratory":case"practice":case"additionalPractice":var a=e[r.uuid];null!==a&&(a.totalFactor="string"===typeof r.value?parseFloat(r.value):r.value)}}}catch(s){n.e(s)}finally{n.f()}}},{key:"putStudentMarkAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n,r,a,s){var i;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i="student=".concat(t,"&techcard=").concat(u,"&mark=").concat(isNaN(n)?"":n.toString(),"&groupId=").concat(r,"&cardTypeKey=").concat(a,"&disciplineLoadUuid=").concat(s),e.abrupt("return",this.requestApiJsonAsync("/mvc/mobile/studentMarks/put",{method:"POST",body:i,json:!1},{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}));case 2:case"end":return e.stop()}}),e,this)})));return function(t,u,n,r,a,s){return e.apply(this,arguments)}}()},{key:"putStudentFailureAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u){var n,r,a,s=arguments;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s.length>2&&void 0!==s[2]?s[2]:K.NoFailure,r=s.length>3&&void 0!==s[3]?s[3]:"lecture",a="markFailure=".concat(n,"&cardType=").concat(r,"&disciplineLoad=").concat(u.disciplineLoad,"&studentId=").concat(t),e.next=5,this.requestApiAsync("/mvc/mobile/failure/update",{method:"POST",body:a,json:!1},{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"});case 5:case"end":return e.stop()}}),e,this)})));return function(t,u){return e.apply(this,arguments)}}()},{key:"updateAllMarksAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t){return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.updateMarksAsync(t,"lecture","intermediate");case 2:return e.next=4,this.updateMarksAsync(t,"lecture","current");case 4:return e.next=6,this.updateMarksAsync(t,"lecture","intermediate");case 6:return e.next=8,this.updateMarksAsync(t,"laboratory","current");case 8:return e.next=10,this.updateMarksAsync(t,"laboratory","intermediate");case 10:return e.next=12,this.updateMarksAsync(t,"practice","current");case 12:return e.next=14,this.updateMarksAsync(t,"practice","intermediate");case 14:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"updateMarksAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n){return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.updateMarksInternalAsync(t.disciplineLoad,t.isModule,t.groupHistoryId,t.groupId,u,n));case 1:case"end":return e.stop()}}),e,this)})));return function(t,u,n){return e.apply(this,arguments)}}()},{key:"updateMarksInternalAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n,r,a,s){var i,c,o;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=u?"/module":"",c=u?"techgroup=".concat(r):"groupUuid=".concat(n),o="disciplineLoad=".concat(t,"&").concat(c)+"&cardType=".concat(a,"&hasTest=false&isTotal=false")+"&intermediate=".concat("intermediate"===s)+"&selectedTeachers=null&showActiveStudents=true",e.abrupt("return",this.requestApiAsync("/mvc/mobile/updateMarks".concat(i),{method:"POST",body:o,json:!1},{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}));case 4:case"end":return e.stop()}}),e,this)})));return function(t,u,n,r,a,s){return e.apply(this,arguments)}}()},{key:"getDisciplineCacheName",value:function(e,t,u,n){return"".concat(this.brsAuth.safeUserName,"_getDiscipline_").concat(e,"_").concat(t,"_").concat(u,"_").concat(n)}},{key:"requestApiJsonAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n){var r;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.requestApiAsync(t,u,n);case 2:return r=e.sent,e.abrupt("return",JSON.parse(r));case 4:case"end":return e.stop()}}),e,this)})));return function(t,u,n){return e.apply(this,arguments)}}()},{key:"requestApiAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n){var a;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,m()(Object(z.a)(Object(z.a)({method:"GET"},u),{},{url:this.brsUrlProvider.baseUrl+t,headers:Object(z.a)({"X-Cookie":"JSESSIONID=".concat(this.brsAuth.sid),"X-Requested-With":"XMLHttpRequest"},n)}));case 2:if(!(a=e.sent).trimLeft().startsWith("")){e.next=5;break}throw new x(r.BrsUnauthorized,t+" is Forbidden");case 5:return e.abrupt("return",a);case 6:case"end":return e.stop()}}),e,this)})));return function(t,u,n){return e.apply(this,arguments)}}()}]),e}();function te(e){var t=gapi.client.sheets;function u(){return(u=Object(b.a)(C.a.mark((function u(n){var r;return C.a.wrap((function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,t.spreadsheets.values.get({spreadsheetId:e,range:n});case 2:return r=u.sent,u.abrupt("return",r.result);case 4:case"end":return u.stop()}}),u)})))).apply(this,arguments)}function n(){return(n=Object(b.a)(C.a.mark((function u(){var n,r;return C.a.wrap((function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,t.spreadsheets.get({spreadsheetId:e});case 2:return n=u.sent,r=JSON.parse(n.body),u.abrupt("return",r);case 5:case"end":return u.stop()}}),u)})))).apply(this,arguments)}return{readAsync:function(e){return u.apply(this,arguments)},getMetaAsync:function(){return n.apply(this,arguments)}}}function ue(e){return e&&e.toLowerCase().replace("\u0451","\u0435").replace(/[^A-Za-z\u0410-\u042f\u0401\u0430-\u044f\u04510-9]/g,"")}function ne(e,t){return ue(e)===ue(t)}function re(e){return parseFloat(e&&e.replace(",","."))}function ae(e,t){return e.reduce((function(e,u){var n="".concat(u[t]);return(e[n]=e[n]||[]).push(u),e}),{})}function se(e){return Object.keys(e)}function ie(e,t,u,n){return e%10===0||e%10>=5||e%100>10&&e%100<20?n:e%10===1?t:u}function ce(e){return Math.round(10*e)/10}function oe(e){return Math.round(100*e)/100}var De={"-":K.NoFailure,"\u041d\u0435 \u0432\u044b\u0431\u0440\u0430\u043d\u0430":K.NotChosen,"\u041d\u0435 \u0434\u043e\u043f\u0443\u0449\u0435\u043d (\u0434\u0435\u043a\u0430\u043d\u0430\u0442)":K.NotAllowedByDeansOffice,"\u041d\u0435 \u044f\u0432\u0438\u043b\u0441\u044f":K.NotAppeared,"\u041d\u0435\u0443\u0432\u0430\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f":K.DisrespectfulReason,"\u0423\u0432\u0430\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f":K.RespectfulReason,"\u041d\u0435 \u0434\u043e\u043f\u0443\u0449\u0435\u043d":K.NotAllowedByTeacher,"\u041d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u0434\u0430\u0432\u0430\u0442\u044c":K.ShouldNotPass,"\u0410\u043a\u0430\u0434\u0435\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043e\u0442\u043f\u0443\u0441\u043a":K.AcademicLeave,"\u0412\u044b\u0431\u044b\u043b":K.DroppedOut};function le(e){if(null===e||void 0===e)return null;for(var t=0,u=Object.keys(De);t=0&&r.disciplineValueColumn>=0)){e.next=15;break}return i=ye(n,r),c=ke(u,r),e.abrupt("return",{datas:[{actualStudents:s,disciplineConfig:c,controlActionConfigs:i}]});case 15:if(!(r.courseColumn>=0||r.academicGroupColumn>=0)){e.next=28;break}o=ye(n,r),D={},l=Object($.a)(s);try{for(l.s();!(d=l.n()).done;)null!==(p=d.value).course&&(D[p.course]||(D[p.course]=[]),D[p.course].push(p))}catch(C){l.e(C)}finally{l.f()}return F=se(D),e.next=23,xe(this.spreadsheetId,F);case 23:return h=e.sent,f=h.map((function(e){return{actualStudents:D[e.course],disciplineConfig:e,controlActionConfigs:o}})),e.abrupt("return",{datas:f});case 28:throw new Error("\u041d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b");case 29:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()}]),e}();function he(e,t,u){return fe.apply(this,arguments)}function fe(){return(fe=Object(b.a)(C.a.mark((function e(t,u,n){var r,a,s,i,c,o,D,l,d,p,F,h,f,b,v,m,g,E,A,y,x,j,k,O,B,S,w,N,I,M,L;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.fullNameColumn>=0?n.fullNameColumn-n.left:null,a=n.surnameColumn>=0?n.surnameColumn-n.left:null,s=n.nameColumn>=0?n.nameColumn-n.left:null,i=n.patronymicColumn>=0?n.patronymicColumn-n.left:null,c=n.groupColumn>=0?n.groupColumn-n.left:null,o=n.courseColumn>=0?n.courseColumn-n.left:null,D=n.academicGroupColumn>=0?n.academicGroupColumn-n.left:null,l=null,d=n.failureColumn-n.left,p=te(t),e.next=12,p.readAsync(u);case 12:if(e.t0=e.sent.values,e.t0){e.next=15;break}e.t0=[];case 15:F=e.t0,h=[],f=Object($.a)(F);try{for(f.s();!(b=f.n()).done;)E=b.value,A=null!==r?E[r].trim():null,y=null!==a?E[a]:null,x=null!==s?E[s]:null,j=null!==i?E[i]:null,k=null!==y&&y.length>0?"".concat(y.trim()," ").concat(null!==(v=null===x||void 0===x?void 0:x.trim())&&void 0!==v?v:""," ").concat(null!==(m=null===j||void 0===j?void 0:j.trim())&&void 0!==m?m:"").trim():null,O=null!==A&&A.length>0?A:k,B=null!==c?E[c]:null,S=null!==o?E[o]:null,w=null!==D?E[D]:null,N=null===w||void 0===w||null===(g=w.match(/\d/))||void 0===g?void 0:g[0],I=null!==S&&S.length>0?S:N,M=null!==l?E[l]:null,L=null!==d?le(E[d]):null,null!==O&&O.length>0&&h.push({fullName:O,groupName:B,id:M,course:I,failure:L,properties:E})}catch(C){f.e(C)}finally{f.f()}return e.abrupt("return",h);case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ce(e,t){return be.apply(this,arguments)}function be(){return(be=Object(b.a)(C.a.mark((function e(t,u){var n,r;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=te(t),e.next=3,n.readAsync(u+"!A1:ZZ100");case 3:return r=e.sent.values,e.abrupt("return",r||null);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ve(e){return me.apply(this,arguments)}function me(){return(me=Object(b.a)(C.a.mark((function e(t){var u;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=te(t),e.next=3,u.getMetaAsync();case 3:return e.abrupt("return",e.sent.properties.title);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ge(e){var t=e&&e[0];if(!t)throw new Error("\u041b\u0438\u0441\u0442 Google-\u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u0442\u0440\u043e\u043a");return t}function Ee(e){var t=e&&e.map((function(e){return ue(e)})),u=t.indexOf(ue("\u0413\u0440\u0443\u043f\u043f\u0430 \u0432 \u0411\u0420\u0421")),n=t.indexOf(ue("\u0424\u0430\u043c\u0438\u043b\u0438\u044f \u0418\u043c\u044f \u0432 \u0411\u0420\u0421")),r=t.indexOf(ue("\u0424\u0430\u043c\u0438\u043b\u0438\u044f")),a=t.indexOf(ue("\u0418\u043c\u044f")),s=t.indexOf(ue("\u041e\u0442\u0447\u0435\u0441\u0442\u0432\u043e")),i=t.indexOf(ue("\u0413\u043e\u0434 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f")),c=t.indexOf(ue("\u0413\u0440\u0443\u043f\u043f\u0430")),o=t.indexOf(ue("\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f")),D=t.indexOf(ue("\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432")),l=t.indexOf(ue("\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432"));if(o<0||n<0&&r<0||n>=o||r>=o||a>=o||s>=o||u>=0&&u>o||i>=0&&i>o||c>=0&&c>o||D>=0&&D<=o||l>=0&&l<=o||D>=0&&l!==D+1)throw new Error("\u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432");var d=Math.min.apply(Math,Object(Q.a)([n,r,a,s,u,i,c].filter((function(e){return e>=0}))));return{groupColumn:u,fullNameColumn:n,surnameColumn:r,nameColumn:a,patronymicColumn:s,courseColumn:i,academicGroupColumn:c,failureColumn:o,disciplineKeyColumn:D,disciplineValueColumn:l,left:d,right:o}}function Ae(e,t){var u=String.fromCharCode("A".charCodeAt(0)+t.left),n=String.fromCharCode("A".charCodeAt(0)+t.right);return"".concat(e,"!").concat(u,"2:").concat(n)}function ye(e,t){for(var u=[],n=t.left;n<=t.right;n++)n!==t.groupColumn&&n!==t.fullNameColumn&&n!==t.courseColumn&&n!==t.academicGroupColumn&&n!==t.failureColumn&&e[n]&&u.push({controlAction:e[n],propertyIndex:n-t.left});for(var r=function(){var e=s[a],t=u.filter((function(t){return ne(t.controlAction,e.controlAction)}));if(t.length>1){e.matchCount=t.length;for(var n=0;n0){var D=o.map((function(e){return"\xab".concat(e,"\xbb")})).join(", ");throw new Error("\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u044b \u043d\u0435 \u0437\u0430\u0434\u0430\u043d\u044b: ".concat(D))}return u}function Oe(e,t,u,n){if(ne(u,"\u0414\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u0430"))n&&(e.name=n,t.name=null);else if(ne(u,"\u0418\u0422\u0421"))n&&(e.isModule="\u0434\u0430"===n.toLowerCase(),t.isModule=null);else if(ne(u,"\u0413\u043e\u0434"))n&&(e.year=parseInt(n.toLowerCase(),10),t.year=null);else if(ne(u,"\u0423\u0447\u0435\u0431\u043d\u044b\u0439 \u0433\u043e\u0434")){if(n){var r=n.toLowerCase().split("/");e.year=parseInt(r[0],10),t.year=null}}else if(ne(u,"\u0421\u0435\u043c\u0435\u0441\u0442\u0440"))n&&("\u043e\u0441\u0435\u043d\u043d\u0438\u0439"===n.toLowerCase()?(e.termType=Y.Fall,t.termType=null):"\u0432\u0435\u0441\u0435\u043d\u043d\u0438\u0439"===n.toLowerCase()&&(e.termType=Y.Spring,t.termType=null));else if(ne(u,"\u041a\u0443\u0440\u0441")){if(n)"\u0432\u0441\u0435 \u043a\u0443\u0440\u0441\u044b"===n.toLowerCase().trim()?(e.course=0,t.course=null):(e.course=parseInt(n.toLowerCase(),10),t.course=null)}else if(ne(u,"\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e")){var a;e.defaultStudentFailure=null!==(a=le(n))&&void 0!==a?a:K.NoFailure,t.defaultStudentFailure=null}}u(533);var Be=u(583),Se=u(581),we=u(584),Ne=u(585),Ie=u(586),Me=u(589),Le=u(587),Te=u(588);function Ue(e){var t=e.title,u=e.items,n=e.icons,r=Object(U.jsx)(Be.a,{component:"div",id:"nested-list-subheader",hidden:!t,children:t});return Object(U.jsx)(Se.a,{component:"nav","aria-labelledby":"nested-list-subheader",subheader:r,className:"nested-list primary",children:u.length?We(u,0,n):Object(U.jsx)(we.a,{className:"text-align-center",children:Object(U.jsx)(Ne.a,{primary:"..."})})})}function We(e,t,u){return e.map((function(e,n){return Object(U.jsx)(Re,{item:e,icons:u,level:t},n)}))}function Re(e){var t,u=e.item,n=e.level,r=e.icons,a=u.title,i=u.nestedItems,c=u.colored,o=u.collapsed,D=u.renderAsText,l=s.a.useState(!o),d=Object(M.a)(l,2),p=d[0],F=d[1],h=i&&i.length>0,f=c&&"colored-back",C=r&&r[n],b=C&&Object(U.jsx)(Ie.a,{children:C});return Object(U.jsxs)(s.a.Fragment,{children:[Object(U.jsxs)(we.a,{button:!0,onClick:function(){return F(!p)},style:n?{paddingLeft:40*n}:void 0,className:"hover "+f,children:[b,Object(U.jsx)(Ne.a,{primary:a}),h&&(p?Object(U.jsx)(Le.a,{}):Object(U.jsx)(Te.a,{}))]}),h&&Object(U.jsx)(Me.a,{in:p,unmountOnExit:!0,children:D?Object(U.jsx)("div",{style:{paddingLeft:40*(n+1),paddingTop:10,paddingBottom:10},children:i&&(t=i,t.map((function(e,t){return Object(U.jsx)("div",{children:e.title},t)})))}):Object(U.jsx)(Se.a,{component:"div",disablePadding:!0,children:i&&We(i,n+1,r)})})]})}u(534);var Pe=u(590);function Ge(e){var t=e.enabled,u=e.onRunWorkSafe,n=e.onRunWorkUnsafe;return Object(U.jsxs)(Pe.a,{container:!0,justify:"space-around",children:[Object(U.jsx)(Pe.a,{item:!0,children:Object(U.jsx)(N.a,{variant:"contained",disabled:!t,onClick:u,color:"primary",children:"\u041f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u043e"})}),Object(U.jsx)(Pe.a,{item:!0,children:Object(U.jsx)(N.a,{variant:"contained",disabled:!t,onClick:n,color:"secondary",children:"\u0421\u0434\u0435\u043b\u0430\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u043e"})})]})}u(535);var _e=u(6),ze=u(601),Je=u(593),qe=u(591),Xe=u(592);function He(e){return e.toLowerCase().replace("\u0451","\u0435").replace(/[ ]+/," ").trim()}var Ve,Ze=new Set(["auto","\u0431\u0430\u043b\u043b\u044b"]);!function(e){e[e.Updated=0]="Updated",e[e.Failed=1]="Failed",e[e.Skipped=2]="Skipped"}(Ve||(Ve={}));var Ke=function(){function e(t,u,n){Object(l.a)(this,e),this.brsApi=void 0,this.save=void 0,this.cancelPending=!1,this.reportManager=void 0,this.brsApi=t,this.reportManager=u,this.save=n}return Object(d.a)(e,[{key:"cancel",value:function(){this.cancelPending=!0}},{key:"putMarksToBrsAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u){var n,r,a,s,i,c,o,D=this;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.actualStudents,r=t.disciplineConfig,a=t.controlActionConfigs,e.prev=1,s=Object($.a)(u),e.prev=3,c=C.a.mark((function e(){var t,u;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.value,0!==(u=n.filter((function(e){return Qe(e,t)}))).length){e.next=4;break}return e.abrupt("return","continue");case 4:return D.reportManager.newReport({disciplineConfig:r,discipline:t,merge:{succeed:0},marks:[],skipped:[]}),e.next=7,D.putMarksForDisciplineAsync(t,u,r.defaultStudentFailure,a);case 7:if(e.sent?D.reportManager.finishReport():D.reportManager.cancelReport(),!D.cancelPending){e.next=11;break}return e.abrupt("return","break");case 11:case"end":return e.stop()}}),e)})),s.s();case 6:if((i=s.n()).done){e.next=15;break}return e.delegateYield(c(),"t0",8);case 8:if("continue"!==(o=e.t0)){e.next=11;break}return e.abrupt("continue",13);case 11:if("break"!==o){e.next=13;break}return e.abrupt("break",15);case 13:e.next=6;break;case 15:e.next=20;break;case 17:e.prev=17,e.t1=e.catch(3),s.e(e.t1);case 20:return e.prev=20,s.f(),e.finish(20);case 23:return e.abrupt("return",null);case 26:return e.prev=26,e.t2=e.catch(1),e.abrupt("return",e.t2);case 29:case"end":return e.stop()}}),e,null,[[1,26],[3,17,20,23]])})));return function(t,u){return e.apply(this,arguments)}}()},{key:"putMarksForDisciplineAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n,r){var a,s,i,c,o,D;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.brsApi.getDisciplineMetaAsync(t);case 2:if(a=e.sent,this.checkControlActionsConfiguration(t,a,r)){e.next=5;break}return e.abrupt("return",!1);case 5:return e.next=7,this.brsApi.getAllStudentMarksAsync(t);case 7:return s=e.sent,i=this.mergeStudents(u,s),c=i.mergedStudents,o=i.skippedActualStudents,D=i.skippedBrsStudents,this.logMergedStudents(c,o,D),e.next=12,this.putMarksForStudentsAsync(t,a,c,r);case 12:return e.next=14,this.updateFailuresForSkippedStudentsAsync(D,t,n);case 14:if(!this.save){e.next=17;break}return e.next=17,this.brsApi.updateAllMarksAsync(t);case 17:return e.abrupt("return",!0);case 18:case"end":return e.stop()}}),e,this)})));return function(t,u,n,r){return e.apply(this,arguments)}}()},{key:"checkControlActionsConfiguration",value:function(e,t,u){if(this.tryGetAutoControlActionConfig(u))return!0;var n,r=this.getControlActions(t),a=Object($.a)(u);try{for(a.s();!(n=a.n()).done;){var s=n.value;if(!this.getSuitableControlAction(e,s,r))return!1}}catch(i){a.e(i)}finally{a.f()}return!0}},{key:"putMarksForStudentsAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n,r){var a,s,i,c,o,D,l,d,p;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s={},i=n,c=this.save?3:2,o=0;case 4:if(!(o0?Ve.Failed:o.updated>0?Ve.Updated:Ve.Skipped,F=n.actual.fullName.substr(0,30),h="".concat(F," \u0431\u0430\u043b\u043b\u044b: ").concat(o.marks.join(" ")),d&&"-"!==d&&(h+=", ".concat(d)),e.abrupt("return",{student:n,status:p,infoString:h});case 32:case"end":return e.stop()}}),e,this,[[17,24]])})));return function(t,u,n,r){return e.apply(this,arguments)}}()},{key:"putAutoMarksForStudentAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n,r,a){var s,i,c,o,D,l,d,p,F,h,f;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=r.actual.properties[a.propertyIndex],i=re(s),c=this.getControlActionGroups(n),o=c.filter((function(e){return!e.isIntermediate})),D=o.reduce((function(e,t){return e+t.factor}),0),l=c.filter((function(e){return e.isIntermediate})),d=l.reduce((function(e,t){return t.factor}),0),p="[auto=".concat(i,"]"),t.marks.push(" ".concat(p).substr("".concat(p).length-1)),!(40<=i)){e.next=14;break}return e.next=12,this.putMarksTryFillActionsWithMaxScoreAsync(t,u,r,c,i);case 12:e.next=31;break;case 14:if(!(40*D<=i)){e.next=24;break}return 40,F=oe(D>0?(i-40*D)/d:0),e.next=20,this.putMarksTryFillActionsWithMaxScoreAsync(t,u,r,o,40);case 20:return e.next=22,this.putMarksTryFillActionsWithMaxScoreAsync(t,u,r,l,F);case 22:e.next=31;break;case 24:return h=0,f=oe(D>0?(i-d*h)/D:0),e.next=29,this.putMarksTryFillActionsWithMaxScoreAsync(t,u,r,o,f);case 29:return e.next=31,this.putMarksTryFillActionsWithMaxScoreAsync(t,u,r,l,h);case 31:case"end":return e.stop()}}),e,this)})));return function(t,u,n,r,a){return e.apply(this,arguments)}}()},{key:"putMarksTryFillActionsWithMaxScoreAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n,r,a){var s,i,c,o,D,l,d,p;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s=Object($.a)(r),e.prev=1,s.s();case 3:if((i=s.n()).done){e.next=19;break}c=i.value,o=c.controlActions,D=a,l=0;case 8:if(!(l=t.matchCount?(r.push("\u041d\u0435\u0432\u0435\u0440\u043d\u0430\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u0435\u0440\u043e\u043f\u0440\u0438\u044f\u0442\u0438\u044f \xab".concat(t.controlAction,"\xbb")),n.length!==t.matchCount&&r.push("\u0412 \u0411\u0420\u0421 \u043d\u0430\u0439\u0434\u0435\u043d\u043e ".concat(n.length," ").concat(ie(n.length,"\u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u043e\u0435 \u043c\u0435\u0440\u043e\u043f\u0440\u0438\u044f\u0442\u0438\u0435","\u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0440\u043e\u043f\u0440\u0438\u044f\u0442\u0438\u044f","\u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0440\u043e\u043f\u0440\u0438\u044f\u0442\u0438\u0439"),", \u0430 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e ").concat(t.matchCount)),this.reportManager.onInvalidConfiguration(r),null):n[t.matchIndex]:n.length>1?(r.push("\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0440\u043e\u043f\u0440\u0438\u044f\u0442\u0438\u0439 \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u0434\u043b\u044f \xab".concat(t.controlAction,"\xbb")),r.push("\u041d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0440\u043e\u043f\u0440\u0438\u044f\u0442\u0438\u044f: ".concat(n.map((function(e){return e.controlAction})).join(", "))),this.reportManager.onInvalidConfiguration(r),null):n[0]}},{key:"updateFailuresForSkippedStudentsAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n){var r,a,s,i=this;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(t.map((function(e){return i.updateFailureForStudent(e,u,n)})));case 2:(r=e.sent).length>0&&(s=Object.entries(ae(r,"status")).map((function(e){var t=Object(M.a)(e,2),u=(t[0],t[1]);return{title:$e(u[0].status),students:u.map((function(e){return e.infoString}))}})),(a=this.reportManager.currentReport.skipped).push.apply(a,Object(Q.a)(s)));case 4:case"end":return e.stop()}}),e,this)})));return function(t,u,n){return e.apply(this,arguments)}}()},{key:"updateFailureForStudent",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u,n){var r,a,s,i,c,o;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=t.failure?t.failure:K.NoFailure,(s=n)!==a){e.next=6;break}r=Ve.Skipped,e.next=16;break;case 6:if(e.prev=6,!this.save){e.next=10;break}return e.next=10,this.brsApi.putStudentFailureAsync(t.studentUuid,u,s);case 10:r=Ve.Updated,e.next=16;break;case 13:e.prev=13,e.t0=e.catch(6),r=Ve.Failed;case 16:return i=t.studentFio.substr(0,30),c=r!==Ve.Skipped?"\u0432\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \xab".concat(de(s),"\xbb, \u0431\u044b\u043b\u043e \xab").concat(de(a),"\xbb"):"\xab".concat(de(s),"\xbb"),o="".concat(i,", ").concat(c),e.abrupt("return",{status:r,infoString:o});case 20:case"end":return e.stop()}}),e,this,[[6,13]])})));return function(t,u,n){return e.apply(this,arguments)}}()},{key:"tryGetAutoControlActionConfig",value:function(e){var t=e.filter((function(e){return Ze.has(e.controlAction.toLowerCase())}));return 1===t.length?t[0]:(t.length>1&&this.reportManager.onInvalidConfiguration(["\u041d\u0430\u0439\u0434\u0435\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u0441 \u0430\u0432\u0442\u043e\u0438\u0442\u043e\u0433\u043e\u043c"]),null)}},{key:"getControlActions",value:function(e){var t,u,n,r,a,s,i,c;return[].concat(Object(Q.a)((null===(t=e.lecture)||void 0===t?void 0:t.currentControlActions)||[]),Object(Q.a)((null===(u=e.lecture)||void 0===u?void 0:u.intermediateControlActions)||[]),Object(Q.a)((null===(n=e.laboratory)||void 0===n?void 0:n.currentControlActions)||[]),Object(Q.a)((null===(r=e.laboratory)||void 0===r?void 0:r.intermediateControlActions)||[]),Object(Q.a)((null===(a=e.practice)||void 0===a?void 0:a.currentControlActions)||[]),Object(Q.a)((null===(s=e.practice)||void 0===s?void 0:s.intermediateControlActions)||[]),Object(Q.a)((null===(i=e.additionalPractice)||void 0===i?void 0:i.currentControlActions)||[]),Object(Q.a)((null===(c=e.additionalPractice)||void 0===c?void 0:c.intermediateControlActions)||[]))}},{key:"getControlActionGroups",value:function(e){var t=[];return e.lecture&&this.pushControlActionGroups(t,e.lecture),e.laboratory&&this.pushControlActionGroups(t,e.laboratory),e.practice&&this.pushControlActionGroups(t,e.practice),e.additionalPractice&&this.pushControlActionGroups(t,e.additionalPractice),t}},{key:"pushControlActionGroups",value:function(e,t){if(t.currentControlActions.length>0){var u=oe(t.currentFactor*t.totalFactor),n=t.currentControlActions;e.push({factor:u,controlActions:n,isIntermediate:!1})}if(t.intermediateControlActions.length>0){var r=oe(t.intermediateFactor*t.totalFactor),a=t.intermediateControlActions;e.push({factor:r,controlActions:a,isIntermediate:!0})}}},{key:"mergeStudents",value:function(e,t){var u,n=t.filter(Ye),r=[],a=[],s=Object($.a)(e);try{var i=function(){var e=u.value,t=n.filter((function(t){return function(e,t){var u=He(e.studentFio),n=He(t.fullName);return u.startsWith(n)}(t,e)}));1===t.length?r.push({actual:e,brs:t[0]}):a.push(e)};for(s.s();!(u=s.n()).done;)i()}catch(d){s.e(d)}finally{s.f()}var c,o=[],D=Object($.a)(n);try{var l=function(){var e=c.value;r.some((function(t){return t.brs.studentUuid===e.studentUuid}))||o.push(e)};for(D.s();!(c=D.n()).done;)l()}catch(d){D.e(d)}finally{D.f()}return{mergedStudents:r,skippedActualStudents:a,skippedBrsStudents:o}}},{key:"logMergedStudents",value:function(e,t,u){var n=this.reportManager.currentReport;n.merge.succeed=e.length,t.length>0&&(n.merge.failedActual=t.map((function(e){return e.fullName}))),u.length>0&&(n.merge.failedBrs=u.map((function(e){return e.studentFio})))}}]),e}();function Ye(e){return"\u041f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043d"!==e.studentStatus&&"\u041e\u0442\u0447\u0438\u0441\u043b\u0435\u043d"!==e.studentStatus&&"\u041f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043d"!==e.studentStatus&&"\u041e\u0442\u043f.\u0430\u043a\u0430\u0434."!==e.studentStatus&&e.failure!==K.ShouldNotPass}function Qe(e,t){if(e.groupName&&e.groupName.length>0){var u=ue(e.groupName);return ue(t.group).startsWith(u)}return!0}function $e(e){switch(e){case Ve.Updated:return"\u041e\u0411\u041d\u041e\u0412\u041b\u0415\u041d\u041e";case Ve.Skipped:return"\u041f\u0420\u041e\u041f\u0423\u0429\u0415\u041d\u041e";case Ve.Failed:return"\u041f\u0420\u041e\u0412\u0410\u041b\u0415\u041d\u041e";default:throw new Error("\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u0441\u0442\u0430\u0442\u0443\u0441 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0446\u0435\u043d\u043e\u043a")}}var et,tt=function(){function e(t,u){Object(l.a)(this,e),this._currentReport=null,this.onReportFinished=void 0,this.onInvalidConfiguration=void 0,this.onReportFinished=t,this.onInvalidConfiguration=u}return Object(d.a)(e,[{key:"currentReport",get:function(){if(!this._currentReport)throw new Error("\u041f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u043e\u0442\u0447\u0435\u0442\u0430 \u0435\u0449\u0435 \u043d\u0435 \u043d\u0430\u0447\u0430\u0442\u043e");return this._currentReport}},{key:"newReport",value:function(e){this.finishReport(),this._currentReport=e}},{key:"finishReport",value:function(){this._currentReport&&this.onReportFinished(this._currentReport),this._currentReport=null}},{key:"cancelReport",value:function(){this._currentReport=null}}]),e}(),ut=Object(_e.a)((function(){return{root:{padding:0}}}))(qe.a),nt=Object(_e.a)((function(){return{root:{display:"flex",justifyContent:"space-around"}}}))(Xe.a),rt=function(e){Object(S.a)(u,e);var t=Object(w.a)(u);function u(e){var n;Object(l.a)(this,u),(n=t.call(this,e)).marksManager=void 0,n.logConfigurationErrors=function(e){var t=e.map((function(e){return{title:e,colored:!0}}));n.setState({logItems:t})},n.logMessage=function(){var e=Object(b.a)(C.a.mark((function e(t){var u;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.reportToNestedListItems(t);case 2:u=e.sent,n.setState({logItems:u});case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),n.startWork=Object(b.a)(C.a.mark((function e(){var t,u,r,a,s,i;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=Object($.a)(n.props.marksDatas),e.prev=1,t.s();case 3:if((u=t.n()).done){e.next=12;break}return r=u.value,a=r.spreadsheetData,s=r.suitableDisciplines,e.next=8,n.marksManager.putMarksToBrsAsync(a,s);case 8:(i=e.sent)&&("object"===typeof i?n.props.onError(i.toString()):"string"===typeof i&&n.props.onError(i));case 10:e.next=3;break;case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(1),t.e(e.t0);case 17:return e.prev=17,t.f(),e.finish(17);case 20:n.setState({cancelPending:!1,okLoading:!1});case 21:case"end":return e.stop()}}),e,null,[[1,14,17,20]])}))),n.cancelWork=function(){n.setState({cancelPending:!0}),n.marksManager.cancel()};var r=e.brsApi,a=e.save,s=new tt(n.logMessage,n.logConfigurationErrors);return n.marksManager=new Ke(r,s,a),n.state={okLoading:!0,cancelPending:!1,logItems:[]},n}return Object(d.a)(u,[{key:"componentDidMount",value:function(){this.startWork()}},{key:"componentWillUnmount",value:function(){this.marksManager.cancel()}},{key:"reportToNestedListItems",value:function(e){var t=this.state.logItems;return new Promise((function(u){var n,r,a=e.disciplineConfig,s=a.termType===Y.Fall?"\u043e\u0441\u0435\u043d\u044c ".concat(a.year):a.termType===Y.Spring?"\u0432\u0435\u0441\u043d\u0430 ".concat(a.year+1):"".concat(a.year,"/").concat(a.year+1),i="\u0413\u0440\u0443\u043f\u043f\u0430 ".concat(e.discipline.group," (").concat(s,", ").concat(a.course," \u043a\u0443\u0440\u0441)"),c=[],o={title:i,collapsed:!0,nestedItems:c},D=!1,l=e.merge,d="\u0421\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435: ".concat(l.succeed," \u0443\u0441\u043f\u0435\u0448\u043d\u043e"),p=(null===(n=l.failedActual)||void 0===n?void 0:n.length)||0;d+=", ".concat(p," ").concat(ie(p,"\u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439","\u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445","\u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445")," \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435");var F,h,f=(null===(r=l.failedBrs)||void 0===r?void 0:r.length)||0,C={title:d+=", ".concat(f," ").concat(ie(f,"\u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439","\u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445","\u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445")," \u0432 \u0411\u0420\u0421"),nestedItems:[],collapsed:!0};(c.push(C),l.failedActual)&&(D=!0,i="\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c ".concat(l.failedActual.length," ").concat(ie(l.failedActual.length,"\u0441\u0442\u0443\u0434\u0435\u043d\u0442\u0430","\u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432","\u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432")," \u0438\u0437 Google \u0422\u0430\u0431\u043b\u0438\u0446\u044b"),null===(F=C.nestedItems)||void 0===F||F.push({title:i,nestedItems:l.failedActual.map((function(e){return{title:e}})),colored:!0,collapsed:!1,renderAsText:!0}));l.failedBrs&&(D=!0,i="\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c ".concat(l.failedBrs.length," ").concat(ie(l.failedBrs.length,"\u0441\u0442\u0443\u0434\u0435\u043d\u0442\u0430","\u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432","\u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432")," \u0438\u0437 \u0411\u0420\u0421"),null===(h=C.nestedItems)||void 0===h||h.push({title:i,nestedItems:l.failedBrs.map((function(e){return{title:e}})),colored:!0,collapsed:!1,renderAsText:!0}));var b=e.marks,v={title:"\u0412\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u0430\u043b\u043b\u043e\u0432",collapsed:!0};v.nestedItems=b.map((function(e){var t,u,n=e.title,r=e.students,a=e.failed;return{title:"".concat(n,": ").concat(null!==(t=null===r||void 0===r?void 0:r.length)&&void 0!==t?t:0," ").concat(ie(null!==(u=null===r||void 0===r?void 0:r.length)&&void 0!==u?u:0,"\u0441\u0442\u0443\u0434\u0435\u043d\u0442","\u0441\u0442\u0443\u0434\u0435\u043d\u0442\u0430","\u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432")),nestedItems:null===r||void 0===r?void 0:r.map((function(e){return{title:e}})),colored:!!a,collapsed:!1,renderAsText:!0}})),c.push(v),D=D||b.filter((function(e){return!!e.failed})).length>0;var m=e.skipped;if(m.length>0){var g={title:"\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u044b \u0438\u0437 \u0411\u0420\u0421",collapsed:!0};g.nestedItems=m.map((function(e){var t,u,n=e.title,r=e.students;return{title:"".concat(n,": ").concat(null!==(t=null===r||void 0===r?void 0:r.length)&&void 0!==t?t:0," ").concat(ie(null!==(u=null===r||void 0===r?void 0:r.length)&&void 0!==u?u:0,"\u0441\u0442\u0443\u0434\u0435\u043d\u0442","\u0441\u0442\u0443\u0434\u0435\u043d\u0442\u0430","\u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432")),nestedItems:null===r||void 0===r?void 0:r.map((function(e){return{title:e}})),collapsed:!1,renderAsText:!0}})),c.push(g)}D&&(o.colored=!0),t.push(o),u(t)}))}},{key:"render",value:function(){return Object(U.jsx)(s.a.Fragment,{children:Object(U.jsxs)(ze.a,{open:!0,maxWidth:"md",fullWidth:!0,className:"worker-dialog",children:[Object(U.jsx)(Je.a,{children:"\u0416\u0443\u0440\u043d\u0430\u043b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439"}),Object(U.jsx)(ut,{dividers:!0,children:Object(U.jsx)(Ue,{items:this.state.logItems})}),Object(U.jsxs)(nt,{children:[Object(U.jsx)(W,{loading:this.state.okLoading,onClick:this.props.onClosed,title:"\u043e\u043a"}),Object(U.jsx)(W,{loading:this.state.cancelPending,disabled:!this.state.okLoading,onClick:this.cancelWork,title:"\u043e\u0442\u043c\u0435\u043d\u0430"})]})]})})}}]),u}(s.a.Component),at=u(270),st=u.n(at),it=u(594),ct=u(271);function ot(e){var t=e.loading,u=e.onSubmit,n=Object(a.useState)(""),r=Object(M.a)(n,2),s=r[0],i=r[1],c=Object(a.useState)(null),o=Object(M.a)(c,2),D=o[0],l=o[1];return Object(U.jsxs)("form",{onSubmit:function(e){e.preventDefault();var t=Object(ct.a)(/d\/([\x2D0-9A-Z_a-z]+)\/edit(#gid=([0-9]+))?/,{spreadsheetId:1,sheetId:3}),n=s.match(t);if(!(null===n||void 0===n?void 0:n.groups)||!n.groups.spreadsheetId)return l("\u041d\u0435\u0432\u0435\u0440\u043d\u044b\u0439 url-\u0430\u0434\u0440\u0435\u0441."),null;var r=n.groups.spreadsheetId,a=n.groups.sheetId||null;u(r,a)},className:"vertical-margin-min",children:[Object(U.jsx)(L.a,{name:"table-url",label:"\u0421\u0441\u044b\u043b\u043a\u0430 \u0432\u0438\u0434\u0430 https://docs.google.com/spreadsheets/d/sjwa1/edit#gid=0",type:"text",className:"tableUrl",value:s,onChange:function(e){var t=e.target;D&&l(null),i(t.value)},error:!!D,helperText:D,required:!0}),Object(U.jsx)(W,{title:"\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c",loading:t,className:"submit"}),Object(U.jsx)("a",{href:p,target:"_blank",rel:"noreferrer",className:"button-link",children:"\u041f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0434\u043b\u044f \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430 \u0432 \u0411\u0420\u0421"})]})}!function(e){e[e.None=0]="None",e[e.LoadDisciplines=1]="LoadDisciplines",e[e.RunWork=2]="RunWork"}(et||(et={}));var Dt=function(e){Object(S.a)(u,e);var t=Object(w.a)(u);function u(e){var n;return Object(l.a)(this,u),(n=t.call(this,e)).marksDatas=[],n.workerSaveMode=!1,n.spreadsheetId="",n.sheetId=null,n.loadDisciplines=function(){var e=Object(b.a)(C.a.mark((function e(t,u){var r,a,s,i,c,o,D,l,d;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.spreadsheetId=t,n.sheetId=u,n.setState({loading:!0}),e.next=5,n.getActualSpreadsheetDataAsync(t,u);case 5:if((null===(r=e.sent)||void 0===r?void 0:r.datas)&&0!==r.datas.length){e.next=9;break}return n.setState({loading:!1}),e.abrupt("return",!1);case 9:n.marksDatas=[],a=[],s=!0,i=0,c=Object($.a)(r.datas),e.prev=14,c.s();case 16:if((o=c.n()).done){e.next=31;break}return D=o.value,e.next=20,n.getActualDisciplinesAsync(D.disciplineConfig);case 20:if(l=e.sent){e.next=24;break}return n.setState({loading:!1}),e.abrupt("return",!1);case 24:n.marksDatas.push({spreadsheetData:D,suitableDisciplines:l}),d=n.disciplinesToListItems(l,D),s=s&&d.allMissed,i+=d.missedCount,a.push.apply(a,Object(Q.a)(d.disciplines));case 29:e.next=16;break;case 31:e.next=36;break;case 33:e.prev=33,e.t0=e.catch(14),c.e(e.t0);case 36:return e.prev=36,c.f(),e.finish(36);case 39:return n.setState({loading:!1,disciplines:a,showDisciplines:!0,lastAction:et.LoadDisciplines,allDisciplinesMissed:s,missedDisciplinesCount:i,showWorkerButtons:!s}),e.abrupt("return",!s);case 41:case"end":return e.stop()}}),e,null,[[14,33,36,39]])})));return function(t,u){return e.apply(this,arguments)}}(),n.updateCachedDisciplines=function(e){e.preventDefault(),n.setState({showDisciplines:!1});var t,u=Object($.a)(n.marksDatas);try{for(u.s();!(t=u.n()).done;){var r,a=null===(r=t.value.spreadsheetData)||void 0===r?void 0:r.disciplineConfig;if(!a)return;n.props.brsApi.clearDisciplineCacheAsync(a.year,a.termType,a.course,a.isModule).then((function(e){return e}),(function(e){n.props.onError(e)}))}}catch(s){u.e(s)}finally{u.f()}n.loadDisciplines(n.spreadsheetId,n.sheetId)},n.runWork=function(){var e=Object(b.a)(C.a.mark((function e(t){return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n.state.lastAction===et.LoadDisciplines){e.next=6;break}return e.next=3,n.loadDisciplines(n.spreadsheetId,n.sheetId);case 3:if(e.sent){e.next=6;break}return e.abrupt("return");case 6:n.workerSaveMode=t,n.setState({lastAction:et.RunWork,runWorker:!0});case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),n.handleRunWorkSafe=function(){return n.runWork(!1)},n.handleRunWorkUnsafe=function(){return n.runWork(!0)},n.handleWorkerClosed=function(){return n.setState({runWorker:!1})},n.state={tableUrl:"",loading:!1,showDisciplines:!1,lastAction:et.None,tableUrlError:{error:!1,message:""},disciplines:[],allDisciplinesMissed:!1,missedDisciplinesCount:0,showWorkerButtons:!1,runWorker:!1},n}return Object(d.a)(u,[{key:"disciplinesToListItems",value:function(e,t){var u=Array.from(new Set(t.actualStudents.map((function(e){return e.groupName||""})))),n=Array.from(new Set(e.map((function(e){return e.group})))),r=0,a=u.map((function(e){if(e.length>0){var t=ue(e),u=n.filter((function(e){return ue(e).startsWith(t)}));return 0===u.length?(r++,[{title:e,colored:!0}]):u.map((function(e){return{title:e,colored:!1}}))}return 0===n.length?(r++,[{title:"\u0410\u0432\u0442\u043e\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u2192 \u043d\u0435\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432",colored:!0}]):n.map((function(e){return{title:"\u0410\u0432\u0442\u043e\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u2192 ".concat(e),colored:!1}}))})).flat(),s=t.disciplineConfig,i=s.termType===Y.Fall?"\u043e\u0441\u0435\u043d\u044c ".concat(s.year):s.termType===Y.Spring?"\u0432\u0435\u0441\u043d\u0430 ".concat(s.year+1):"".concat(s.year,"/").concat(s.year+1),c="".concat(s.name,", ").concat(i,", ").concat(s.course," \u043a\u0443\u0440\u0441");return{allMissed:r===u.length,missedCount:r,disciplines:[{title:c,nestedItems:a}]}}},{key:"getActualDisciplinesAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t){var u;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.props.brsApi.getDisciplineCachedAsync(t.year,t.termType,t.course,t.isModule);case 3:return u=e.sent,e.abrupt("return",u.filter((function(e){return ne(e.discipline,t.name)})));case 7:e.prev=7,e.t0=e.catch(0),this.props.onError(e.t0);case 10:case"end":return e.stop()}}),e,this,[[0,7]])})));return function(t){return e.apply(this,arguments)}}()},{key:"getActualSpreadsheetDataAsync",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u){var n,r,a;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getSheetName(t,u);case 2:if(n=e.sent){e.next=5;break}return e.abrupt("return",null);case 5:return e.prev=5,a=new Fe(t),e.next=9,a.getSpreadsheetDataAsync(n);case 9:r=e.sent,e.next=16;break;case 12:return e.prev=12,e.t0=e.catch(5),this.props.onError(e.t0.message||JSON.stringify(e.t0)),e.abrupt("return",null);case 16:return e.abrupt("return",r);case 17:case"end":return e.stop()}}),e,this,[[5,12]])})));return function(t,u){return e.apply(this,arguments)}}()},{key:"getSheetName",value:function(){var e=Object(b.a)(C.a.mark((function e(t,u){var n,r,a;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,te(t).getMetaAsync();case 3:if(n=e.sent,r=n.sheets.map((function(e){return e.properties})),a=u?r.filter((function(e){return e.sheetId.toString()===u}))[0]:r[0]){e.next=9;break}return this.props.onError("\u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430"),e.abrupt("return",null);case 9:return e.abrupt("return",a.title);case 12:return e.prev=12,e.t0=e.catch(0),this.props.onError(e.t0.message||JSON.stringify(e.t0)),e.abrupt("return",null);case 16:case"end":return e.stop()}}),e,this,[[0,12]])})));return function(t,u){return e.apply(this,arguments)}}()},{key:"render",value:function(){return Object(U.jsxs)("span",{className:"spreadsheet-fetch",children:[Object(U.jsx)("h3",{className:"vertical-margin-min",children:"\u0412\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043b\u0438\u0441\u0442 Google \u0422\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u043e\u0446\u0435\u043d\u043a\u0430\u043c\u0438"}),Object(U.jsx)(ot,{loading:this.state.loading,onSubmit:this.loadDisciplines}),Object(U.jsxs)(Me.a,{in:this.state.showDisciplines,className:"vertical-margin-min",children:[Object(U.jsx)("h3",{children:"\u0417\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0435 \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u044b \u0438\u0437 Google \u0422\u0430\u0431\u043b\u0438\u0446\u044b"}),this.state.missedDisciplinesCount>0&&Object(U.jsxs)("p",{children:["\u0413\u0440\u0443\u043f\u043f\u044b, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0443 \u0432\u0430\u0441 \u043d\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0432 \u0411\u0420\u0421,"," ",Object(U.jsx)("b",{className:"colored-text",children:" \u043f\u043e\u0434\u0441\u0432\u0435\u0447\u0435\u043d\u044b"})]}),Object(U.jsx)(Ue,{items:this.state.disciplines,icons:[Object(U.jsx)(it.a,{}),Object(U.jsx)(st.a,{})]}),this.state.allDisciplinesMissed?Object(U.jsxs)(s.a.Fragment,{children:[Object(U.jsx)("p",{children:"\u0423 \u0432\u0430\u0441 \u043d\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043d\u0438 \u043a \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u0433\u0440\u0443\u043f\u043f \u0432 \u0411\u0420\u0421"}),Object(U.jsx)("span",{children:"\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f:"}),Object(U.jsxs)("ol",{className:"no-margin",children:[Object(U.jsx)("li",{children:"\u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u044b \u0432 \u0411\u0420\u0421 \u0438 \u0432 Google \u0422\u0430\u0431\u043b\u0438\u0446\u0430\u0445 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442"}),Object(U.jsx)("li",{children:"\u0417\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u0435 \u0434\u043e\u0441\u0442\u0443\u043f \u043d\u0430 \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u0443 \u0432 \u0411\u0420\u0421"}),Object(U.jsx)("li",{children:"\u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0442\u0435\u0445\u043a\u0430\u0440\u0442\u0430 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u0430 \u0432 \u0411\u0420\u0421"}),Object(U.jsx)("li",{children:Object(U.jsx)("button",{className:"button-link",onClick:this.updateCachedDisciplines,children:"\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u0435 \u043a\u044d\u0448 \u0433\u0440\u0443\u043f\u043f"})})]})]}):Object(U.jsxs)(s.a.Fragment,{children:[Object(U.jsxs)("p",{children:["\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043d\u0435 \u0432\u0441\u0435 \u0433\u0440\u0443\u043f\u043f\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0430\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432 \u0411\u0420\u0421, \u0442\u043e"," ",Object(U.jsx)("button",{className:"button-link",onClick:this.updateCachedDisciplines,children:"\u043e\u0431\u043d\u043e\u0432\u0438\u0442\u0435 \u043a\u044d\u0448 \u0433\u0440\u0443\u043f\u043f"})]}),Object(U.jsx)(I.a,{className:"vertical-margin-medium",children:Object(U.jsx)(Ge,{enabled:this.state.showWorkerButtons,onRunWorkSafe:this.handleRunWorkSafe,onRunWorkUnsafe:this.handleRunWorkUnsafe})})]})]}),this.state.runWorker&&Object(U.jsx)(rt,{marksDatas:this.marksDatas,onClosed:this.handleWorkerClosed,brsApi:this.props.brsApi,onError:this.props.onError,save:this.workerSaveMode})]})}}]),u}(s.a.Component),lt=Object(a.memo)(Dt),dt=u(595),pt=u(596),Ft=s.a.forwardRef((function(e,t){return Object(U.jsx)(dt.a,Object(z.a)({direction:"up",ref:t},e))}));function ht(e){var t=e.open,u=e.sessionName,n=e.onOk;return Object(U.jsx)(s.a.Fragment,{children:Object(U.jsxs)(ze.a,{open:t,TransitionComponent:Ft,keepMounted:!0,"aria-labelledby":"alert-dialog-slide-title","aria-describedby":"alert-dialog-slide-description",children:[Object(U.jsx)(Je.a,{id:"alert-dialog-slide-title",children:"\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f"}),Object(U.jsx)(qe.a,{children:Object(U.jsxs)(pt.a,{id:"alert-dialog-slide-description",children:["\u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441\u0435\u0441\u0441\u0438\u0438 ",u," \u0438\u0441\u0442\u0435\u043a\u043b\u043e.",Object(U.jsx)("br",{}),"\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f."]})}),Object(U.jsx)(Xe.a,{style:{display:"flex",justifyContent:"space-around"},children:Object(U.jsx)(N.a,{onClick:n,color:"primary",children:"\u041e\u043a"})})]})})}u(540);function ft(){return Object(U.jsx)("div",{className:"loading-pane",children:Object(U.jsx)(T.a,{size:100,className:"progress"})})}var Ct=function(e){Object(S.a)(u,e);var t=Object(w.a)(u);function u(e){var n;return Object(l.a)(this,u),(n=t.call(this,e)).handleError=function(e){var t=e.message||JSON.stringify(e);e.statusCode?e.statusCode===r.BrsUnauthorized?n.handleSessionExpired("\u0411\u0420\u0421"):n.handleSessionExpired("Google"):"RequestError"===e.name?n.setState({errorMessage:"\u0412 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043f\u043e\u0437\u0436\u0435."}):n.setState({errorMessage:t})},n.handleSessionExpired=function(e){n.setState({openSessionExpiredAlert:!0,sessionName:e,loading:!1})},n.handleSessionExpiredOk=function(){"\u0411\u0420\u0421"===n.state.sessionName?(n.props.brsAuth.logout(),n.returnToLoginPage(),n.setState({redirect:!0})):"Google"===n.state.sessionName&&n.returnToLoginPage()},n.closeError=function(){n.setState({errorMessage:""})},n.returnToLoginPage=function(){n.setState({redirect:!0})},n.state={showControls:!1,runWork:!1,openSessionExpiredAlert:!1,sessionName:"",errorMessage:"",loading:!0,redirect:!1},n}return Object(d.a)(u,[{key:"componentDidMount",value:function(){var e=Object(b.a)(C.a.mark((function e(){var t=this;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.props.googleAuth.ensureInitializedAsync();case 2:return e.next=4,this.props.brsAuth.tryRestoreAsync();case 4:this.props.brsAuth.checkAuth()||this.handleSessionExpired("\u0411\u0420\u0421"),this.props.googleAuth.checkAuthorized()?this.setState({loading:!1}):setTimeout((function(){t.props.googleAuth.checkAuthorized()?t.setState({loading:!1}):t.handleSessionExpired("Google")}),1e3);case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"render",value:function(){return Object(U.jsxs)(s.a.Fragment,{children:[this.state.loading&&Object(U.jsx)(ft,{}),Object(U.jsx)(ht,{open:this.state.openSessionExpiredAlert,sessionName:this.state.sessionName,onOk:this.handleSessionExpiredOk}),this.state.errorMessage&&Object(U.jsx)(X,{open:!!this.state.errorMessage,message:this.state.errorMessage,type:"error",onClose:this.closeError}),this.state.redirect&&Object(U.jsx)(D.a,{to:"/"}),Object(U.jsx)("div",{className:"work-page",children:Object(U.jsxs)(I.a,{maxWidth:"md",children:[Object(U.jsx)(N.a,{variant:"contained",style:{marginTop:10},onClick:this.returnToLoginPage,children:"\u0412\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0432\u0445\u043e\u0434\u0430"}),Object(U.jsx)(lt,{brsApi:this.props.brsApi,onError:this.handleError})]})})]})}}]),u}(s.a.Component);function bt(){return Object(U.jsx)(B.Consumer,{children:function(e){return e&&Object(U.jsx)(Ct,{brsAuth:e.brsAuth,brsApi:e.brsApi,googleAuth:e.googleAuth})}})}var vt=new h(!0),mt=new j(vt),gt=new ee(mt,vt),Et=new O;function At(){return Object(U.jsx)(B.Provider,{value:{brsAuth:mt,brsApi:gt,googleAuth:Et},children:Object(U.jsx)(o.a,{hashType:"noslash",children:Object(U.jsxs)(D.d,{children:[Object(U.jsx)(D.b,{path:"/work",component:bt}),Object(U.jsx)(D.b,{exact:!0,path:"",component:Z})]})})})}var yt=function(e){e&&e instanceof Function&&u.e(3).then(u.bind(null,602)).then((function(t){var u=t.getCLS,n=t.getFID,r=t.getFCP,a=t.getLCP,s=t.getTTFB;u(e),n(e),r(e),a(e),s(e)}))};u(541);c.a.render(Object(U.jsx)(At,{}),document.getElementById("root")),yt()}},[[542,1,2]]]);
+//# sourceMappingURL=main.e9790dc5.chunk.js.map
\ No newline at end of file
diff --git a/static/js/main.e9790dc5.chunk.js.map b/static/js/main.e9790dc5.chunk.js.map
new file mode 100644
index 0000000..fac6bb7
--- /dev/null
+++ b/static/js/main.e9790dc5.chunk.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["helpers/cache.ts","helpers/CustomError.ts","Constants.ts","apis/BrsUrlProvider.ts","apis/BrsAuth.ts","apis/GoogleAuth.ts","Context.tsx","components/shared/SubmitWithLoading/index.tsx","components/login/BrsLoginForm/index.tsx","components/login/GoogleLoginButton.tsx","components/shared/CustomAlert.tsx","components/login/LoginPage/index.tsx","components/login/LoginPageContainer.tsx","apis/BrsApi.ts","apis/GoogleApi.ts","helpers/tools.ts","helpers/brsHelpers.ts","helpers/emojiRegex.ts","managers/SpreadsheetManager.ts","components/shared/NestedList/index.tsx","components/work/RunWorkerButtons.tsx","helpers/fio.ts","managers/MarksManager.ts","components/work/GoogleTableFetch/index.tsx","managers/ReportManager.ts","components/work/WorkerDialog/index.tsx","components/work/GoogleTableFetch/GoogleTableFetchForm.tsx","components/shared/SessionExpiredAlert.tsx","components/work/LoadingPane/index.tsx","components/work/WorkPage/index.tsx","components/work/WorkPageContainer.tsx","App.tsx","reportWebVitals.ts","index.tsx"],"names":["StorageType","StatusCode","TABLE_URL_PATTERN","BRS_URL","BrsUrlProvider","withProxy","this","save","name","data","whereTo","json","JSON","stringify","Local","LocalAndSession","localStorage","setItem","Session","sessionStorage","read","whereFrom","content","getItem","parse","clear","storageType","removeItem","LoginStatus","CustomError","statusCode","message","BrsAuth","brsUrlProvider","_sid","_safeUserName","_userName","BrsUnauthorized","a","loginInfo","cache","saveLoginInfo","sid","userName","checkSidAsync","sidCheckResult","success","request","method","url","baseUrl","headers","response","match","login","password","requestSidAsync","Error","cookie","result","checkResult","InvalidCredentials","Succeed","safeUserName","replaceAll","body","resolveWithFullResponse","simple","then","x","DISCOVERY_DOCS","GoogleAuth","gapi","client","Promise","resolve","load","init","clientId","discoveryDocs","scope","catch","console","error","handler","auth2","getAuthInstance","isSignedIn","listen","get","basicProfile","currentUser","getBasicProfile","getName","getEmail","signOut","Context","createContext","SubmitWithLoading","props","title","loading","className","onClick","disabled","Button","type","fullWidth","variant","color","CircularProgress","size","BrsLoginForm","onSubmit","submitting","signedIn","onLogout","React","useState","setLogin","setPassword","setSid","Fragment","e","preventDefault","TextField","margin","id","label","autoFocus","value","onChange","target","autoComplete","href","rel","GoogleLoginButton","onSignedIn","onFailure","Container","buttonText","onSuccess","CustomAlert","open","onClose","Snackbar","autoHideDuration","anchorOrigin","vertical","horizontal","severity","Alert","elevation","LoginPage","handleBrsSubmit","credentials","setState","submitLoading","loginBrsAsync","loginStatus","alertMessage","openAlert","alertType","brsAuthorized","brsAuth","authBySidAsync","loginAsync","handleCloseAlert","handleGoogleSignedIn","googleAuthorized","handleGoogleLoginFailed","startWork","redirect","handleBrsLogout","logout","handleGoogleLogout","googleAuth","renderGreeting","renderBrsLogin","state","brsLoading","renderGoogleLogin","getUserName","renderStartWorkButton","ensureInitializedAsync","tryRestoreAsync","listenAuthorized","authorized","checkAuth","checkAuthorized","to","component","maxWidth","Component","LoginPageContainer","Consumer","context","StudentFailure","TermType","BrsApi","year","termType","course","isModule","cacheName","getDisciplineCacheName","cacheResult","getDisciplineTotalAsync","total","getDisciplineInternalAsync","Math","max","disciplines","page","pageSize","queryString","requestApiJsonAsync","paging","numberOfElements","moduleParameter","discipline","getStudentMarksAsync","students","uniqueStudents","s","knownStudent","studentUuid","Object","keys","map","k","cardType","markType","getStudentMarksInternalAsync","disciplineLoad","groupHistoryId","groupId","groupUuid","techgroup","isTotal","showActiveStudents","groupPart","disciplineMeta","lecture","laboratory","practice","additionalPractice","fillCardMetaAsync","getControlActionColumnsCachedAsync","currentColumns","intermediateColumns","length","cardMeta","currentControlActions","extractControlActions","currentFactor","intermediateControlActions","intermediateFactor","totalFactor","fillFactors","totalColumns","fillTotalFactors","getControlActionColumnsInternalAsync","modulePart","requestApiAsync","prefix","suffix","linesWithId","split","trim","filter","startsWith","columns","substr","uuidPrefix","c","uuid","uuidWithoutPrefix","maxValue","isIntermediate","intermediate","controlAction","column","parseFloat","controlActionId","mark","cardTypeKey","disciplineLoadUuid","isNaN","toString","studentFailure","NoFailure","updateMarksAsync","updateMarksInternalAsync","uri","options","trimLeft","getSpreadsheet","spreadsheetId","sheets","range","spreadsheets","values","meta","readAsync","getMetaAsync","normalizeString","str","toLowerCase","replace","compareNormalized","s1","s2","parseAnyFloat","groupBy","items","key","reduce","reducer","item","itemKey","push","getKeys","obj","pluralize","count","version1","version2","version5","round10","round","round100","failureMapping","NotChosen","NotAllowedByDeansOffice","NotAppeared","Неуважительная","DisrespectfulReason","Уважительная","RespectfulReason","NotAllowedByTeacher","ShouldNotPass","AcademicLeave","Выбыл","DroppedOut","parseStudentFailure","input","undefined","formatStudentFailure","emojiRegex","SpreadsheetManager","sheetName","readRowsFromSpreadsheetAsync","rows","header","getHeader","indices","buildIndicesBy","dataRange","buildDataRange","readStudentsAsync","actualStudents","disciplineKeyColumn","disciplineValueColumn","controlActionConfigs","buildControlActionConfig","disciplineConfig","buildDisciplineConfig","datas","courseColumn","academicGroupColumn","studentGroups","student","courses","buildDisciplineConfigFromSpreadsheetTitleAsync","disciplineConfigs","config","readRange","fullNameIndex","fullNameColumn","left","surnameIndex","surnameColumn","nameIndex","nameColumn","patronymicIndex","patronymicColumn","groupNameIndex","groupColumn","courseIndex","academicGroupIndex","idIndex","failureIndex","failureColumn","sheet","googleApi","row","fullName1","surname","patronymic","fullName2","fullName","groupName","course1","academicGroup","course2","failure","properties","readTitleFromSpreadsheetAsync","normalizedHeader","groupColumnIndex","indexOf","fullNameColumnIndex","surnameColumnIndex","nameColumnIndex","patronymicColumnIndex","courseColumnIndex","academicGroupColumnIndex","failureColumnIndex","disciplineParameterKeyColumnIndex","disciplineParameterValueColumnIndex","leftIndex","min","it","right","leftLetter","String","fromCharCode","charCodeAt","rightLetter","index","propertyIndex","sameColumns","matchCount","matchIndex","spreadsheetTitle","prepared","commaIndex","lastIndexOf","substring","time","timeParts","Spring","Fall","parseInt","configs","defaultStudentFailure","errors","i","addDisciplineConfigParameter","errorNames","filterNull","errorNamesString","n","join","yearParts","NestedList","icons","listSubheader","ListSubheader","hidden","List","aria-labelledby","subheader","renderNestedItems","ListItem","ListItemText","primary","level","NestedListItem","nestedItems","colored","collapsed","renderAsText","setOpen","hasSubItems","icon","IconPlace","ListItemIcon","button","style","paddingLeft","ExpandLess","ExpandMore","Collapse","in","unmountOnExit","paddingTop","paddingBottom","disablePadding","RunWorkerButtons","enabled","onRunWorkSafe","onRunWorkUnsafe","Grid","container","justify","toKey","fio","MarkUpdateStatus","autoControlActionNames","Set","MarksManager","brsApi","reportManager","cancelPending","spreadsheetData","isSuitableDiscipline","newReport","merge","succeed","marks","skipped","putMarksForDisciplineAsync","finishReport","cancelReport","getDisciplineMetaAsync","checkControlActionsConfiguration","getAllStudentMarksAsync","brsStudents","mergeStudents","mergedStudents","skippedActualStudents","skippedBrsStudents","logMergedStudents","putMarksForStudentsAsync","updateFailuresForSkippedStudentsAsync","updateAllMarksAsync","tryGetAutoControlActionConfig","controlActions","getControlActions","getSuitableControlAction","ratings","notFinishedStudents","tryCount","putMarksForStudentsOnceAsync","studentId","ratingResults","r","finished","rating","status","Failed","groupedResults","entries","rawStudents","formatMarkUpdateStatus","infoString","failed","currentReport","all","putMarksForStudentAsync","oldRating","brs","newRating","Skipped","newFinished","actual","autoControlActionConfig","log","updated","putAutoMarksForStudentAsync","putManualMarksForStudentAsync","brsFailureStatus","actualFailure","failureStatus","putStudentFailureAsync","Updated","studentName","autoMarkString","autoMark","controlActionGroups","getControlActionGroups","currentControlActionGroups","factor","intermediateControlActionGroups","output","putMarksTryFillActionsWithMaxScoreAsync","intermediateMark","currentMark","controlActionGroup","actualMark","putMarkAsync","actualMarkString","brsMarkString","brsMark","needUpdateMark","actualMarkOutput","controlActionOutput","putStudentMarkAsync","suitableControlActions","errorMessages","group","teacherName","onInvalidConfiguration","updateFailureForStudent","studentFio","description","autoConfigs","has","groups","pushControlActionGroups","activeBrsStudents","isStudentActiveAndShouldPass","actualStudent","suitableStudents","brsStudent","brsFullName","actualFullName","areStudentsLike","some","ms","report","failedActual","failedBrs","studentStatus","LastAction","ReportManager","onReportFinished","_currentReport","DialogContent","withStyles","root","padding","MuiDialogContent","DialogActions","display","justifyContent","MuiDialogActions","WorkerDialog","marksManager","logConfigurationErrors","logItems","logMessage","reportToNestedListItems","marksDatas","marksData","suitableDisciplines","putMarksToBrsAsync","onError","okLoading","cancelWork","cancel","disciplineTime","mainItem","hasErrors","mergeResultsTitle","failedActualCount","failedBrsCount","mergeInfoItem","marksItem","skippedItem","Dialog","dividers","onClosed","GoogleTableFetchForm","tableUrl","setTableUrl","urlError","setUrlError","regExp","spreadsheetInfo","maybeSheetId","sheetId","event","helperText","required","GoogleTableFetch","workerSaveMode","loadDisciplines","getActualSpreadsheetDataAsync","spreadsheetDatas","allMissed","missedCount","getActualDisciplinesAsync","disciplinesToListItems","showDisciplines","lastAction","LoadDisciplines","allDisciplinesMissed","missedDisciplinesCount","showWorkerButtons","updateCachedDisciplines","clearDisciplineCacheAsync","runWork","RunWork","runWorker","handleRunWorkSafe","handleRunWorkUnsafe","handleWorkerClosed","None","tableUrlError","availableDisciplines","actualGroups","Array","from","availableGroups","normalizedGroup","availableForActual","flat","disciplineTitle","getDisciplineCachedAsync","allDisciplines","d","getSheetName","spreadsheetManager","getSpreadsheetDataAsync","maybeSheet","ViewModule","memo","Transition","forwardRef","ref","Slide","direction","SessionExpiredAlert","sessionName","onOk","TransitionComponent","keepMounted","aria-describedby","DialogTitle","DialogContentText","LoadingPane","WorkPage","handleError","errorMessage","handleSessionExpired","openSessionExpiredAlert","handleSessionExpiredOk","returnToLoginPage","closeError","showControls","setTimeout","marginTop","WorkPageContainer","urlProvider","App","Provider","hashType","path","exact","reportWebVitals","onPerfEntry","Function","getCLS","getFID","getFCP","getLCP","getTTFB","ReactDOM","render","document","getElementById"],"mappings":"+lBAAYA,ECAAC,E,kECGCC,EACT,yGAKSC,EAAU,0BCPFC,E,WAGjB,WAAYC,GAAqB,yBAFhBA,eAEe,EAC5BC,KAAKD,UAAYA,E,yCAGrB,WACI,OAAOC,KAAKD,UAAL,UDCW,0DCDX,YAAkCF,GAAYA,M,8CHJtD,SAASI,EACdC,EACAC,EACAC,GAEA,IAAKD,EACH,OAAO,EAGT,IAAME,EAAOC,KAAKC,UAAUJ,GAU5B,OARIC,IAAYV,EAAYc,OAASJ,IAAYV,EAAYe,iBAC3DC,aAAaC,QAAQT,EAAMG,GAE3BD,IAAYV,EAAYkB,SACxBR,IAAYV,EAAYe,iBAExBI,eAAeF,QAAQT,EAAMG,IAExB,EAGF,SAASS,EACdZ,EACAa,GACC,IAAD,EACIC,EAAyB,KAO7B,GALID,IAAcrB,EAAYc,QAAOQ,EAAUN,aAAaO,QAAQf,IAChEa,IAAcrB,EAAYkB,UAASI,EAAUH,eAAeI,QAAQf,IACpEa,IAAcrB,EAAYe,kBAC5BO,EAAO,UAAGH,eAAeI,QAAQf,UAA1B,QAAmCQ,aAAaO,QAAQf,KAE5Dc,EACH,OAAO,KAGT,IAAMb,EAAOG,KAAKY,MAAMF,GACxB,OAAOb,GAAqB,KAGvB,SAASgB,EAAMjB,EAAckB,GAYlC,OAVEA,IAAgB1B,EAAYc,OAC5BY,IAAgB1B,EAAYe,iBAE5BC,aAAaW,WAAWnB,GAExBkB,IAAgB1B,EAAYkB,SAC5BQ,IAAgB1B,EAAYe,iBAE5BI,eAAeQ,WAAWnB,IAErB,G,SA3DGR,O,iBAAAA,I,qBAAAA,I,sCAAAA,M,cCAAC,O,qCAAAA,I,4CAAAA,M,SGMA2B,EHDSC,EAInB,WAAYC,GAA+C,IAAvBC,EAAsB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WgiB,KAC/B,cAAC,IAAD,CAAOM,OAAK,EAACD,KAAK,GAAGriB,UAAWG,WCnB1C,IAYeoiB,GAZS,SAACC,GACnBA,GAAeA,aAAuBC,UACxC,8BAAqBpqB,MAAK,YAAkD,IAA/CqqB,EAA8C,EAA9CA,OAAQC,EAAsC,EAAtCA,OAAQC,EAA8B,EAA9BA,OAAQC,EAAsB,EAAtBA,OAAQC,EAAc,EAAdA,QAC3DJ,EAAOF,GACPG,EAAOH,GACPI,EAAOJ,GACPK,EAAOL,GACPM,EAAQN,O,OCFdO,IAASC,OAAO,cAACd,GAAD,IAASe,SAASC,eAAe,SAKjDX,O","file":"static/js/main.e9790dc5.chunk.js","sourcesContent":["export enum StorageType {\n Local,\n Session,\n LocalAndSession,\n}\n\nexport function save(\n name: string,\n data: object | string,\n whereTo: StorageType\n) {\n if (!data) {\n return false;\n }\n\n const json = JSON.stringify(data);\n\n if (whereTo === StorageType.Local || whereTo === StorageType.LocalAndSession)\n localStorage.setItem(name, json);\n if (\n whereTo === StorageType.Session ||\n whereTo === StorageType.LocalAndSession\n )\n sessionStorage.setItem(name, json);\n\n return true;\n}\n\nexport function read(\n name: string,\n whereFrom: StorageType\n) {\n let content: string | null = null;\n\n if (whereFrom === StorageType.Local) content = localStorage.getItem(name);\n if (whereFrom === StorageType.Session) content = sessionStorage.getItem(name);\n if (whereFrom === StorageType.LocalAndSession)\n content = sessionStorage.getItem(name) ?? localStorage.getItem(name);\n\n if (!content) {\n return null;\n }\n\n const data = JSON.parse(content);\n return data ? (data as T) : null;\n}\n\nexport function clear(name: string, storageType: StorageType) {\n if (\n storageType === StorageType.Local ||\n storageType === StorageType.LocalAndSession\n )\n localStorage.removeItem(name);\n if (\n storageType === StorageType.Session ||\n storageType === StorageType.LocalAndSession\n )\n sessionStorage.removeItem(name);\n\n return true;\n}\n","export enum StatusCode {\n BrsUnauthorized = 1,\n GoogleUnauthorized,\n}\n\nexport default class CustomError {\n readonly message: string;\n readonly statusCode: StatusCode;\n\n constructor(statusCode: StatusCode, message: string = \"\") {\n this.statusCode = statusCode;\n this.message = message;\n }\n}\n","export const SID_GAINING_INSTRUCTION_URL =\n \"https://docs.google.com/document/d/1btXePo-5bE8RyX7RFXnBuS-UN9SmwUithpc_UXhAWsg/edit\";\n\nexport const TABLE_URL_PATTERN =\n \"https://docs.google.com/spreadsheets/d/1Owzl3JfmFASIdC7ZMMw-0kkA3pwFSab1QdVO5dhZoxY/edit#gid=675912523\";\n\nexport const TABLE_TEMPLATE_URL =\n \"https://docs.google.com/spreadsheets/d/sjwa1/edit#gid=0\";\n\nexport const BRS_URL = \"https://brs.urfu.ru/mrd\";\n\nexport const CORS_PROXY = \"https://bbamc5stve2edro7t455.containers.yandexcloud.net\";\n","import {BRS_URL, CORS_PROXY} from \"../Constants\";\n\nexport default class BrsUrlProvider {\n private readonly withProxy: boolean;\n\n constructor(withProxy: boolean) {\n this.withProxy = withProxy;\n }\n\n get baseUrl() {\n return this.withProxy ? `${CORS_PROXY}/${BRS_URL}` : BRS_URL;\n }\n}\n","import request from \"request-promise\";\nimport BrsUrlProvider from \"./BrsUrlProvider\";\nimport * as cache from \"../helpers/cache\";\nimport { StorageType } from \"../helpers/cache\";\nimport CustomError, { StatusCode } from \"../helpers/CustomError\";\n\nexport enum LoginStatus {\n Succeed,\n InvalidCredentials,\n Error,\n}\n\nexport default class BrsAuth {\n readonly brsUrlProvider: BrsUrlProvider;\n\n constructor(brsUrlProvider: BrsUrlProvider) {\n this.brsUrlProvider = brsUrlProvider;\n }\n\n private _sid: string | null = null;\n\n get sid() {\n if (!this._sid)\n throw new CustomError(\n StatusCode.BrsUnauthorized,\n \"Нет авторизации в БРС\"\n );\n return this._sid;\n }\n\n private _safeUserName: string | null = null;\n\n get safeUserName() {\n if (!this._safeUserName)\n throw new CustomError(\n StatusCode.BrsUnauthorized,\n \"Нет авторизации в БРС\"\n );\n return this._safeUserName;\n }\n\n private _userName?: string = \"Anonymous\";\n\n get userName() {\n return this._userName;\n }\n\n checkAuth() {\n return !!(this._sid && this._safeUserName);\n }\n\n async tryRestoreAsync() {\n if (!!(this._sid && this._safeUserName)) return;\n\n let loginInfo = cache.read(\"loginInfo\", StorageType.Session);\n if (loginInfo) {\n this.saveLoginInfo(loginInfo.sid, loginInfo.userName);\n return;\n }\n\n loginInfo = cache.read(\"loginInfo\", StorageType.Local);\n if (!loginInfo) return;\n\n const sidCheckResult = await this.checkSidAsync(loginInfo.sid);\n if (sidCheckResult?.success)\n this.saveLoginInfo(loginInfo.sid, loginInfo.userName);\n }\n\n private async checkSidAsync(sid: string): Promise {\n try {\n const response: string = await request({\n method: \"GET\",\n url: this.brsUrlProvider.baseUrl + \"/mvc/mobile\",\n headers: {\n \"X-Cookie\": `JSESSIONID=${sid}`,\n \"X-Requested-With\": \"XMLHttpRequest\",\n },\n });\n\n const userName = response.match(/username\">([А-ЯЁа-яё -]+));\n if (userName) return { success: true, userName: userName[1] };\n return { success: false, userName: \"Anonymous\" };\n } catch (e) {\n return null;\n }\n }\n\n async loginAsync(login: string, password: string): Promise {\n const response = await this.requestSidAsync(login, password);\n\n if (!response || !(\"x-set-cookie\" in response.headers)) {\n return LoginStatus.Error;\n }\n\n const cookie = response.headers[\"x-set-cookie\"] as string;\n const result = cookie.match(/(?<=JSESSIONID=)\\w+/);\n\n if (!result) return LoginStatus.Error;\n\n const sid = result[0];\n\n const checkResult = await this.checkSidAsync(sid);\n if (checkResult === null) return LoginStatus.Error;\n if (!checkResult.success) return LoginStatus.InvalidCredentials;\n\n this.saveLoginInfo(sid, checkResult.userName);\n\n return LoginStatus.Succeed;\n }\n\n async authBySidAsync(sid: string): Promise {\n if (!sid) return LoginStatus.InvalidCredentials;\n\n const checkResult = await this.checkSidAsync(sid);\n if (checkResult === null) return LoginStatus.Error;\n if (!checkResult.success) return LoginStatus.InvalidCredentials;\n\n this.saveLoginInfo(sid, checkResult.userName);\n\n return LoginStatus.Succeed;\n }\n\n private saveLoginInfo(sid: string, userName: string) {\n const safeUserName = userName.replaceAll(/[^A-Za-zА-ЯЁа-яё]/g, \"_\");\n\n cache.save(\n \"loginInfo\",\n { sid, safeUserName, userName },\n StorageType.LocalAndSession\n );\n\n this._sid = sid;\n this._safeUserName = safeUserName;\n this._userName = userName;\n }\n\n logout() {\n this._sid = null;\n this._safeUserName = null;\n cache.clear(\"loginInfo\", StorageType.LocalAndSession);\n }\n\n private async requestSidAsync(login: string, password: string) {\n return await request({\n url: this.brsUrlProvider.baseUrl + `/login`,\n method: \"POST\",\n body: `username=${login}&password=${password}`,\n resolveWithFullResponse: true,\n simple: false,\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded; charset=UTF-8\",\n },\n }).then(\n (x) => x,\n () => null\n );\n }\n}\n\ninterface LoginInfo {\n sid: string;\n safeUserName: string;\n userName: string;\n}\n\ninterface SidCheckResult {\n success: boolean;\n userName: string;\n}\n","const CLIENT_ID =\n \"122993083593-pacve8csj86voko30ia65raeg0ncrtuv.apps.googleusercontent.com\";\nconst DISCOVERY_DOCS = [\n \"https://sheets.googleapis.com/$discovery/rest?version=v4\",\n];\nconst SCOPES = \"profile email https://www.googleapis.com/auth/spreadsheets\";\n\nexport default class GoogleAuth {\n async ensureInitializedAsync() {\n if (gapi.client) return;\n\n await new Promise((resolve) => {\n gapi.load(\"client:auth2\", resolve);\n });\n\n // NOTE: выполнение init не надо ждать\n gapi.client\n .init({\n clientId: CLIENT_ID,\n discoveryDocs: DISCOVERY_DOCS,\n scope: SCOPES,\n })\n .catch(console.error);\n }\n\n listenAuthorized(handler: (authorized: boolean) => void) {\n gapi.auth2?.getAuthInstance()?.isSignedIn?.listen(handler);\n }\n\n checkAuthorized() {\n return gapi.auth2?.getAuthInstance()?.isSignedIn?.get();\n }\n\n getUserName(): string | undefined {\n const basicProfile = gapi.auth2\n ?.getAuthInstance()\n ?.currentUser?.get()\n ?.getBasicProfile();\n return basicProfile?.getName() || basicProfile?.getEmail();\n }\n\n async logout() {\n await gapi.auth2?.getAuthInstance()?.signOut();\n }\n}\n","import { createContext } from \"react\";\nimport BrsAuth from \"./apis/BrsAuth\";\nimport BrsApi from \"./apis/BrsApi\";\nimport GoogleAuth from \"./apis/GoogleAuth\";\n\nconst Context =\n createContext<{\n brsAuth: BrsAuth;\n brsApi: BrsApi;\n googleAuth: GoogleAuth;\n } | null>(null);\n\nexport default Context;\n","import { Button, CircularProgress } from \"@material-ui/core\";\nimport React from \"react\";\nimport \"./styles.css\";\n\nexport default function SubmitWithLoading(props: Props) {\n const { title, loading, className, onClick, disabled = false } = props;\n\n return (\n \n \n {loading && (\n \n )}\n
\n );\n}\n\ninterface Props {\n title: string;\n loading: boolean;\n className?: string;\n onClick?: () => void;\n disabled?: boolean;\n}\n","import { Button, CircularProgress, TextField } from \"@material-ui/core\";\nimport SubmitWithLoading from \"../../shared/SubmitWithLoading\";\nimport React, { FormEvent } from \"react\";\nimport \"./styles.css\";\nimport { SID_GAINING_INSTRUCTION_URL } from \"../../../Constants\";\n\nexport default function BrsLoginForm({\n onSubmit,\n submitting,\n loading,\n signedIn,\n onLogout,\n userName,\n}: Props) {\n const [login, setLogin] = React.useState(\"\");\n const [password, setPassword] = React.useState(\"\");\n const [sid, setSid] = React.useState(\"\");\n\n function handleUserNameChanged(e: React.ChangeEvent) {\n const value = e.target.value;\n setLogin(value);\n setSid(\"\");\n }\n\n function handlePasswordChanged(e: React.ChangeEvent) {\n const value = e.target.value;\n setPassword(value);\n setSid(\"\");\n }\n\n function handleSidChanged(e: React.ChangeEvent) {\n const value = e.target.value;\n setSid(value);\n setLogin(\"\");\n setPassword(\"\");\n }\n\n function handleSubmit(e: FormEvent) {\n e.preventDefault();\n\n if (loading) return;\n\n onSubmit({ login: login, password, sid });\n }\n\n return signedIn ? (\n \n Добро пожаловать, {userName}
\n \n \n ) : (\n \n
\n Войдите в БРС, чтобы сервис мог получить информацию о ваших\n курсах и выставлять оценки от вашего имени\n
\n
Это можно сделать через учетную запись БРС
\n
\n {loading && (\n
\n )}\n
\n );\n}\n\ninterface Props {\n submitting: boolean;\n loading: boolean;\n onSubmit: (credentials: Credentials) => void;\n onLogout: () => void;\n signedIn: boolean;\n userName?: string;\n}\n\nexport interface Credentials {\n login: string;\n password: string;\n sid: string;\n}\n","import GoogleLogin from \"react-google-login\";\nimport React from \"react\";\nimport { Button, Container } from \"@material-ui/core\";\n\nconst CLIENT_ID =\n \"122993083593-pacve8csj86voko30ia65raeg0ncrtuv.apps.googleusercontent.com\";\nconst SCOPES = \"profile email https://www.googleapis.com/auth/spreadsheets\";\n\nexport default function GoogleLoginButton(props: Props) {\n const { onSignedIn, onFailure, signedIn, userName, onLogout } = props;\n\n return (\n \n {signedIn ? (\n \n Добро пожаловать, {userName}
\n \n \n ) : (\n \n \n Войдите в Google, чтобы сервис мог загружать оценки студентов\n из ваших Google Таблиц\n
\n \n \n )}\n \n );\n}\n\ninterface Props {\n onSignedIn: () => void;\n onFailure: (error: any) => void;\n onLogout: () => void;\n signedIn: boolean;\n userName?: string;\n}\n","import React from \"react\";\nimport MuiAlert, { AlertProps } from \"@material-ui/lab/Alert\";\nimport { Snackbar } from \"@material-ui/core\";\n\nexport default function CustomAlert(props: Props) {\n const { open, message, type, onClose } = props;\n\n return (\n \n \n \n {message}\n \n \n \n );\n}\n\nfunction Alert(props: AlertProps) {\n return ;\n}\n\ninterface Props {\n open: boolean;\n message: string;\n type: \"error\" | \"success\";\n onClose: () => void;\n}\n","import React from \"react\";\nimport \"./styles.css\";\nimport { Redirect } from \"react-router-dom\";\nimport { Button, Container } from \"@material-ui/core\";\nimport BrsAuth, { LoginStatus } from \"../../../apis/BrsAuth\";\nimport BrsLoginForm, { Credentials } from \"../BrsLoginForm\";\nimport GoogleAuth from \"../../../apis/GoogleAuth\";\nimport GoogleLoginButton from \"../GoogleLoginButton\";\nimport CustomAlert from \"../../shared/CustomAlert\";\nimport { TABLE_URL_PATTERN } from \"../../../Constants\";\n\nexport default class LoginPage extends React.Component {\n constructor(props: Props) {\n super(props);\n\n this.state = {\n brsLoading: true,\n brsAuthorized: false,\n googleAuthorized: false,\n redirect: false,\n submitLoading: false,\n openAlert: false,\n alertMessage: \"\",\n alertType: \"error\",\n };\n }\n\n async componentDidMount() {\n await this.props.googleAuth.ensureInitializedAsync();\n await this.props.brsAuth.tryRestoreAsync();\n\n this.props.googleAuth.listenAuthorized((authorized) => {\n this.setState({ googleAuthorized: authorized });\n });\n\n const brsAuthorized = this.props.brsAuth.checkAuth();\n const googleAuthorized = this.props.googleAuth.checkAuthorized();\n this.setState({ brsLoading: false, brsAuthorized, googleAuthorized });\n }\n\n handleBrsSubmit = async (credentials: Credentials) => {\n this.setState({ submitLoading: true });\n\n const loginStatus = await this.loginBrsAsync(credentials);\n\n this.setState({ submitLoading: false });\n\n switch (loginStatus) {\n case LoginStatus.Succeed:\n this.setState({\n alertMessage: \"Авторизация прошла успешно\",\n openAlert: true,\n alertType: \"success\",\n brsAuthorized: true,\n });\n break;\n case LoginStatus.Error:\n this.setState({\n alertMessage: \"Что-то пошло не так :( Попробуйте позже\",\n openAlert: true,\n alertType: \"error\",\n });\n break;\n case LoginStatus.InvalidCredentials:\n this.setState({\n alertMessage: \"Неверные логин, пароль или JSESSIONID\",\n openAlert: true,\n alertType: \"error\",\n });\n }\n };\n\n loginBrsAsync = async (credentials: Credentials): Promise => {\n if (credentials.sid) {\n return await this.props.brsAuth.authBySidAsync(credentials.sid);\n }\n if (credentials.login && credentials.password) {\n return await this.props.brsAuth.loginAsync(\n credentials.login,\n credentials.password\n );\n }\n return LoginStatus.InvalidCredentials;\n };\n\n handleCloseAlert = () => {\n this.setState({ openAlert: false });\n };\n\n handleGoogleSignedIn = () => {\n this.setState({ googleAuthorized: true });\n };\n\n handleGoogleLoginFailed = (error: any) => {\n console.error(error);\n\n this.setState({\n openAlert: true,\n alertType: \"error\",\n alertMessage: \"Не удалось подключить Ваш Google аккаунт :(\",\n });\n };\n\n startWork = () => {\n this.setState({ redirect: true });\n };\n\n handleBrsLogout = () => {\n this.props.brsAuth.logout();\n this.setState({\n brsAuthorized: false,\n alertMessage: \"Вы вышли из аккаунта БРС\",\n alertType: \"success\",\n openAlert: true,\n });\n };\n\n handleGoogleLogout = async () => {\n await this.props.googleAuth.logout();\n this.setState({\n googleAuthorized: false,\n alertType: \"success\",\n alertMessage: \"Вы вышли из аккаунта Google\",\n openAlert: true,\n });\n };\n\n renderGreeting = () => {\n return (\n \n
Добро пожаловать в Расширения БРС
\n
Как все работает
\n
\n - \n В Google Таблицах вы заполняете оценки за курс по некоторому{\" \"}\n \n шаблону\n \n
\n - \n После этого импортируете Google Таблицу в сервис и выполняете\n пробный запуск выставления оценок, чтобы исключить ошибки\n
\n - Наконец делаете запуск с реальным выставлением оценок
\n
\n
Правила хранения данных
\n
\n Ваш логин и пароль передаются в БРС и нигде не сохраняются\n
\n Данные о доступных вам курсах сохраняются только в вашем браузере\n
\n
\n
\n );\n };\n\n renderBrsLogin = () => {\n return (\n \n );\n };\n\n renderGoogleLogin = () => {\n return (\n \n );\n };\n\n renderStartWorkButton = () => {\n return (\n \n );\n };\n\n render() {\n return (\n \n {this.state.redirect && }\n \n {this.renderGreeting()}\n \n {this.renderBrsLogin()}\n
\n {this.renderGoogleLogin()}\n \n \n {this.renderStartWorkButton()}\n \n \n \n
\n );\n }\n}\n\ninterface State {\n brsLoading: boolean;\n brsAuthorized: boolean;\n googleAuthorized: boolean;\n submitLoading: boolean;\n redirect: boolean;\n openAlert: boolean;\n alertMessage: string;\n alertType: \"error\" | \"success\";\n}\n\ninterface Props {\n brsAuth: BrsAuth;\n googleAuth: GoogleAuth;\n}\n","import React from \"react\";\nimport Context from \"../../Context\";\nimport LoginPage from \"./LoginPage\";\n\nexport default function LoginPageContainer() {\n return (\n \n {(context) =>\n context && (\n \n )\n }\n \n );\n}\n","import \"bluebird\";\nimport request from \"request-promise\";\nimport * as cache from \"../helpers/cache\";\nimport { StorageType } from \"../helpers/cache\";\nimport BrsAuth from \"./BrsAuth\";\nimport BrsUrlProvider from \"./BrsUrlProvider\";\nimport CustomError, { StatusCode } from \"../helpers/CustomError\";\n\nexport enum StudentFailure {\n /** -, дефис, все хорошо */ NoFailure = -1,\n /** Не выбрана */ NotChosen = -19,\n /** Не допущен (деканат) */ NotAllowedByDeansOffice = -18,\n /** Не явился */ NotAppeared = 0,\n /** Неуважительная */ DisrespectfulReason = 12,\n /** Уважительная */ RespectfulReason = 13,\n /** Не допущен */ NotAllowedByTeacher = 18,\n /** Не должен сдавать */ ShouldNotPass = 19,\n /** Академический отпуск */ AcademicLeave = 20,\n /** Выбыл */ DroppedOut = 21,\n}\n\nexport enum TermType {\n Fall = 1,\n Spring = 2,\n}\n\nexport default class BrsApi {\n readonly brsAuth: BrsAuth;\n private readonly brsUrlProvider: BrsUrlProvider;\n\n constructor(brsAuth: BrsAuth, brsUrlProvider: BrsUrlProvider) {\n this.brsAuth = brsAuth;\n this.brsUrlProvider = brsUrlProvider;\n }\n\n async getDisciplineCachedAsync(\n year: number,\n termType: TermType,\n course: number,\n isModule: boolean\n ) {\n const cacheName = this.getDisciplineCacheName(\n year,\n termType,\n course,\n isModule\n );\n const cacheResult = cache.read(\n cacheName,\n StorageType.Session\n );\n if (cacheResult) {\n return cacheResult;\n }\n\n const total = await this.getDisciplineTotalAsync(\n year,\n termType,\n course,\n isModule\n );\n\n const result = await this.getDisciplineInternalAsync(\n year,\n termType,\n course,\n isModule,\n 1,\n Math.max(10000, total), // quick fix because total from BRS is not correct\n total\n );\n\n cache.save(cacheName, result.disciplines, StorageType.Session);\n return result.disciplines;\n }\n\n async getDisciplineInternalAsync(\n year: number,\n termType: TermType,\n course: number,\n isModule: boolean,\n page: number,\n pageSize: number,\n total: number\n ) {\n const queryString = `?year=${year}&termType=${termType}&course=${course}&total=${total}&page=${page}&pageSize=${pageSize}&search=`;\n if (isModule) {\n const paging = await this.requestApiJsonAsync>(\n \"/mvc/mobile/module/fetch\" + queryString\n );\n const disciplines = paging.content;\n for (const d of disciplines) {\n d.isModule = true;\n }\n return {disciplines, numberOfElements: paging.numberOfElements};\n } else {\n const paging = await this.requestApiJsonAsync>(\n \"/mvc/mobile/discipline/fetch\" + queryString\n );\n const disciplines = paging.content;\n for (const d of disciplines) {\n d.isModule = false;\n }\n return {disciplines, numberOfElements: paging.numberOfElements};\n }\n }\n\n async clearDisciplineCacheAsync(\n year: number,\n termType: TermType,\n course: number,\n isModule: boolean\n ) {\n const cacheName = this.getDisciplineCacheName(\n year,\n termType,\n course,\n isModule\n );\n cache.clear(cacheName, StorageType.Session);\n }\n\n async getDisciplineTotalAsync(\n year: number,\n termType: TermType,\n course: number,\n isModule: boolean\n ) {\n const moduleParameter = isModule ? \"&its=true\" : \"\";\n const queryString =\n `?year=${year}&termType=${termType}&course=${course}` + moduleParameter;\n const total = await this.requestApiJsonAsync(\n \"/mvc/mobile/discipline/amount\" + queryString\n );\n return total;\n }\n\n async getAllStudentMarksAsync(discipline: Discipline) {\n const students = [\n ...(await this.getStudentMarksAsync(discipline, \"lecture\", \"current\")),\n ...(await this.getStudentMarksAsync(\n discipline,\n \"lecture\",\n \"intermediate\"\n )),\n ...(await this.getStudentMarksAsync(discipline, \"laboratory\", \"current\")),\n ...(await this.getStudentMarksAsync(\n discipline,\n \"laboratory\",\n \"intermediate\"\n )),\n ...(await this.getStudentMarksAsync(discipline, \"practice\", \"current\")),\n ...(await this.getStudentMarksAsync(\n discipline,\n \"practice\",\n \"intermediate\"\n )),\n ...(await this.getStudentMarksAsync(\n discipline,\n \"additionalPractice\",\n \"current\"\n )),\n ...(await this.getStudentMarksAsync(\n discipline,\n \"additionalPractice\",\n \"intermediate\"\n )),\n ];\n\n const uniqueStudents: { [id: string]: StudentMark } = {};\n for (const s of students) {\n const knownStudent = uniqueStudents[s.studentUuid] || {};\n uniqueStudents[s.studentUuid] = { ...knownStudent, ...s };\n }\n\n return Object.keys(uniqueStudents).map((k) => uniqueStudents[k]);\n }\n\n async getStudentMarksAsync(\n discipline: Discipline,\n cardType: CardType,\n markType: MarkType\n ) {\n return this.getStudentMarksInternalAsync(\n discipline.disciplineLoad,\n discipline.isModule,\n discipline.groupHistoryId,\n discipline.groupId,\n cardType,\n markType\n );\n }\n\n async getStudentMarksInternalAsync(\n disciplineLoad: string,\n isModule: boolean,\n groupUuid: string,\n techgroup: string,\n cardType: CardType,\n markType: MarkType,\n isTotal: boolean = false,\n showActiveStudents: boolean = false\n ) {\n const groupPart = isModule\n ? `techgroup=${techgroup}`\n : `groupUuid=${groupUuid}`;\n return this.requestApiJsonAsync(\n `/mvc/mobile/studentMarks/fetch?disciplineLoad=${disciplineLoad}&${groupPart}` +\n `&cardType=${cardType}&hasTest=false&isTotal=${isTotal}` +\n `&intermediate=${markType === \"intermediate\"}` +\n `&selectedTeachers=null&showActiveStudents=${showActiveStudents}`\n );\n }\n\n async getDisciplineMetaAsync(\n discipline: Discipline\n ): Promise {\n const disciplineMeta: DisciplineMeta = {\n lecture: null,\n laboratory: null,\n practice: null,\n additionalPractice: null,\n };\n\n await this.fillCardMetaAsync(disciplineMeta, discipline, \"lecture\");\n await this.fillCardMetaAsync(disciplineMeta, discipline, \"laboratory\");\n await this.fillCardMetaAsync(disciplineMeta, discipline, \"practice\");\n await this.fillCardMetaAsync(\n disciplineMeta,\n discipline,\n \"additionalPractice\"\n );\n\n return disciplineMeta;\n }\n\n async fillCardMetaAsync(\n disciplineMeta: DisciplineMeta,\n discipline: Discipline,\n cardType: CardType\n ) {\n const currentColumns = await this.getControlActionColumnsCachedAsync(\n discipline,\n cardType,\n \"current\"\n );\n const intermediateColumns = await this.getControlActionColumnsCachedAsync(\n discipline,\n cardType,\n \"intermediate\"\n );\n if (currentColumns.length + intermediateColumns.length === 0) {\n return;\n }\n\n const cardMeta = {\n currentControlActions: this.extractControlActions(currentColumns),\n currentFactor: 0,\n intermediateControlActions:\n this.extractControlActions(intermediateColumns),\n intermediateFactor: 0,\n totalFactor: 0,\n };\n this.fillFactors(cardMeta, currentColumns);\n this.fillFactors(cardMeta, intermediateColumns);\n disciplineMeta[cardType] = cardMeta;\n\n const totalColumns = await this.getControlActionColumnsCachedAsync(\n discipline,\n cardType,\n \"total\"\n );\n this.fillTotalFactors(disciplineMeta, totalColumns);\n }\n\n async getControlActionColumnsCachedAsync(\n discipline: Discipline,\n cardType: CardType,\n markType: MarkType\n ) {\n const cacheName =\n `${this.brsAuth.safeUserName}_getControlActionColumns_${discipline.disciplineLoad}` +\n `_${discipline.isModule}_${discipline.groupHistoryId}_${discipline.groupId}_${cardType}_${markType}`;\n const cacheResult = cache.read(\n cacheName,\n StorageType.Session\n );\n if (cacheResult) {\n return cacheResult;\n }\n\n const result = await this.getControlActionColumnsInternalAsync(\n discipline.disciplineLoad,\n discipline.isModule,\n discipline.groupHistoryId,\n discipline.groupId,\n cardType,\n markType\n );\n cache.save(cacheName, result, StorageType.Session);\n return result;\n }\n\n async getControlActionColumnsInternalAsync(\n disciplineLoad: string,\n isModule: boolean,\n groupUuid: string,\n techgroup: string,\n cardType: CardType,\n markType: MarkType\n ) {\n const modulePart = isModule ? \"/module\" : \"\";\n const groupPart = isModule ? techgroup : groupUuid;\n const response = await this.requestApiAsync(\n `/mvc/mobile/view/mark/${disciplineLoad}/${groupPart}/teachers${modulePart}/${cardType}/${markType}`\n );\n\n const prefix = \"gridColumns = toTextArray(\";\n const suffix = \");\";\n const linesWithId = response\n .split(\"\\r\\n\")\n .map((s) => s.trim())\n .filter((s) => s.startsWith(prefix));\n if (linesWithId.length !== 1) {\n throw new Error(\n \"Не удалось разобрать страницу БРС со списком контрольных мероприятий. Ожидается, что эта страница содержит единственную строчку с идентификатором техкарты.\"\n );\n }\n\n const columns: Array =\n JSON.parse(\n linesWithId[0].substr(\n prefix.length,\n linesWithId[0].length - prefix.length - suffix.length\n )\n ) || [];\n\n return columns;\n }\n\n extractControlActions(columns: ControlActionColumn[]) {\n const uuidPrefix = \"technologyCard\";\n const result = columns\n .filter((c) => c.uuid && c.uuid.startsWith(uuidPrefix))\n .map((c) => ({\n uuid: c.uuid,\n uuidWithoutPrefix: c.uuid.substr(uuidPrefix.length),\n maxValue: c.maxValue,\n isIntermediate: c.intermediate > 0,\n controlAction: c.controlAction,\n }));\n\n return result as ControlAction[];\n }\n\n fillFactors(cardMeta: CardMeta, columns: ControlActionColumn[]) {\n for (const column of columns) {\n switch (column.uuid) {\n case \"currentWithFactor\":\n cardMeta.currentFactor =\n typeof column.value === \"string\"\n ? parseFloat(column.value)\n : column.value;\n break;\n case \"intermediateWithFactor\":\n cardMeta.intermediateFactor =\n typeof column.value === \"string\"\n ? parseFloat(column.value)\n : column.value;\n break;\n default:\n break;\n }\n }\n }\n\n fillTotalFactors(\n disciplineMeta: DisciplineMeta,\n columns: ControlActionColumn[]\n ) {\n for (const column of columns) {\n switch (column.uuid) {\n case \"lecture\":\n case \"laboratory\":\n case \"practice\":\n case \"additionalPractice\":\n const uuid: CardType = column.uuid;\n const cardMeta = disciplineMeta[uuid];\n if (cardMeta !== null) {\n cardMeta.totalFactor =\n typeof column.value === \"string\"\n ? parseFloat(column.value)\n : column.value;\n }\n break;\n default:\n break;\n }\n }\n }\n\n async putStudentMarkAsync(\n studentUuid: string,\n controlActionId: string,\n mark: number,\n groupId: string,\n cardTypeKey: CardType,\n disciplineLoadUuid: string\n ) {\n const body = `student=${studentUuid}&techcard=${controlActionId}&mark=${\n isNaN(mark) ? \"\" : mark.toString()\n }&groupId=${groupId}&cardTypeKey=${cardTypeKey}&disciplineLoadUuid=${disciplineLoadUuid}`;\n return this.requestApiJsonAsync(\n `/mvc/mobile/studentMarks/put`,\n {\n method: \"POST\",\n body,\n json: false,\n },\n {\n \"Content-Type\": \"application/x-www-form-urlencoded; charset=UTF-8\",\n }\n );\n }\n\n async putStudentFailureAsync(\n studentUuid: string,\n discipline: Discipline,\n studentFailure: StudentFailure = StudentFailure.NoFailure,\n cardType: CardType = \"lecture\"\n ) {\n const body = `markFailure=${studentFailure}&cardType=${cardType}&disciplineLoad=${discipline.disciplineLoad}&studentId=${studentUuid}`;\n await this.requestApiAsync(\n `/mvc/mobile/failure/update`,\n {\n method: \"POST\",\n body,\n json: false,\n },\n {\n \"Content-Type\": \"application/x-www-form-urlencoded; charset=UTF-8\",\n }\n );\n }\n\n async updateAllMarksAsync(discipline: Discipline) {\n await this.updateMarksAsync(discipline, \"lecture\", \"intermediate\");\n await this.updateMarksAsync(discipline, \"lecture\", \"current\");\n await this.updateMarksAsync(discipline, \"lecture\", \"intermediate\");\n await this.updateMarksAsync(discipline, \"laboratory\", \"current\");\n await this.updateMarksAsync(discipline, \"laboratory\", \"intermediate\");\n await this.updateMarksAsync(discipline, \"practice\", \"current\");\n await this.updateMarksAsync(discipline, \"practice\", \"intermediate\");\n }\n\n async updateMarksAsync(\n discipline: Discipline,\n cardType: CardType,\n markType: MarkType\n ) {\n return this.updateMarksInternalAsync(\n discipline.disciplineLoad,\n discipline.isModule,\n discipline.groupHistoryId,\n discipline.groupId,\n cardType,\n markType\n );\n }\n\n async updateMarksInternalAsync(\n disciplineLoad: string,\n isModule: boolean,\n groupUuid: string,\n techgroup: string,\n cardType: CardType,\n markType: MarkType\n ) {\n const modulePart = isModule ? \"/module\" : \"\";\n const groupPart = isModule\n ? `techgroup=${techgroup}`\n : `groupUuid=${groupUuid}`;\n const body =\n `disciplineLoad=${disciplineLoad}&${groupPart}` +\n `&cardType=${cardType}&hasTest=false&isTotal=false` +\n `&intermediate=${markType === \"intermediate\"}` +\n `&selectedTeachers=null&showActiveStudents=true`;\n return this.requestApiAsync(\n `/mvc/mobile/updateMarks${modulePart}`,\n {\n method: \"POST\",\n body,\n json: false,\n },\n {\n \"Content-Type\": \"application/x-www-form-urlencoded; charset=UTF-8\",\n }\n );\n }\n\n getDisciplineCacheName(\n year: number,\n termType: TermType,\n course: number,\n isModule: boolean\n ) {\n return `${this.brsAuth.safeUserName}_getDiscipline_${year}_${termType}_${course}_${isModule}`;\n }\n\n async requestApiJsonAsync(\n uri: string,\n options?: RequestOptions,\n headers?: RequestHeaders\n ): Promise {\n const response = await this.requestApiAsync(uri, options, headers);\n\n return JSON.parse(response);\n }\n\n async requestApiAsync(\n uri: string,\n options?: RequestOptions,\n headers?: RequestHeaders\n ): Promise {\n const response = await request({\n method: \"GET\",\n ...options,\n url: this.brsUrlProvider.baseUrl + uri,\n headers: {\n \"X-Cookie\": `JSESSIONID=${this.brsAuth.sid}`,\n \"X-Requested-With\": \"XMLHttpRequest\",\n ...headers,\n },\n });\n\n if (response.trimLeft().startsWith(\"\")) {\n throw new CustomError(StatusCode.BrsUnauthorized, uri + \" is Forbidden\");\n }\n\n return response;\n }\n}\n\nexport type CardType =\n | \"lecture\"\n | \"laboratory\"\n | \"practice\"\n | \"additionalPractice\";\nexport type MarkType = \"current\" | \"intermediate\" | \"total\";\n\nexport interface Discipline {\n groupId: string;\n discipline: string;\n group: string;\n disciplineLoad: string;\n groupHistoryId: string;\n isModule: boolean;\n teacherName?: string;\n}\n\n// eslint-disable-next-line\nconst studentMarkSample: StudentMark = {\n studentPersonalNumber: \"09800106\",\n isEdit: false,\n studentUuid:\n \"studen18hc2jg0000magk6mi3iec84bsundigr18hc2jg0000m53o7mlgvora278\",\n status: 1,\n studentStatus: \"Активный\",\n ignoreCurrentDebars: false,\n studentFio: \"Анисимова Маргарита Васильевна\",\n isExtern: false,\n teacherName: \"\",\n cardType: \"lecture\",\n studentName: \"Анисимова М.В.\",\n studentGroup: \"РИ-180001\",\n registerClosed: false,\n subgroupsITS: \"\",\n disciplineLoad: \"unpldd18hc2jg0000m5kojcd3te76bnk\",\n};\n\nexport interface StudentMark {\n studentPersonalNumber: string;\n isEdit: boolean;\n studentUuid: string;\n status: number;\n studentStatus: string;\n ignoreCurrentDebars: boolean;\n studentFio: string;\n isExtern: boolean;\n teacherName: string;\n cardType: CardType;\n studentName: string;\n studentGroup: string;\n registerClosed: boolean;\n subgroupsITS: string;\n disciplineLoad: string;\n failure?: StudentFailure;\n failureName?: string;\n\n [props: string]: number | string | boolean | undefined;\n}\n\nexport interface DisciplineMeta {\n lecture: CardMeta | null;\n laboratory: CardMeta | null;\n practice: CardMeta | null;\n additionalPractice: CardMeta | null;\n}\n\nexport interface CardMeta {\n currentFactor: number;\n currentControlActions: ControlAction[];\n intermediateFactor: number;\n intermediateControlActions: ControlAction[];\n totalFactor: number;\n}\n\nexport interface ControlAction {\n uuid: string;\n uuidWithoutPrefix: string;\n controlAction: string;\n maxValue: number;\n isIntermediate: boolean;\n}\n\ninterface ControlActionColumn {\n controlAction: string;\n uuid: string;\n maxValue: number;\n intermediate: number;\n value: number | string;\n}\n\ninterface RequestOptions {\n method?: string;\n body?: object | string;\n json?: boolean;\n}\n\ninterface RequestHeaders {\n \"Content-Type\"?: string;\n}\n\ninterface Paging {\n content: T[];\n last: boolean;\n totalPages: number;\n totalElements: number;\n size: number;\n number: number;\n sort: any;\n first: boolean;\n numberOfElements: number;\n}\n","export function getSpreadsheet(spreadsheetId: string): Spreadsheet {\n const sheets = gapi.client.sheets;\n\n async function readAsync(range: string) {\n const response = await sheets.spreadsheets.values.get({\n spreadsheetId,\n range,\n });\n return response.result;\n }\n\n async function getMetaAsync() {\n const response = await sheets.spreadsheets.get({ spreadsheetId });\n const meta = JSON.parse(response.body) as SpreadsheetMeta;\n return meta;\n }\n\n return {\n readAsync,\n getMetaAsync\n };\n}\n\nexport interface Spreadsheet {\n readAsync: (range: string) => Promise;\n getMetaAsync: () => Promise\n}\n\nexport interface ValueRange {\n majorDimension?: string | null;\n range?: string | null;\n values?: any[][] | null;\n}\n\nexport interface SpreadsheetMeta {\n spreadsheetId: string;\n properties: SpreadsheetProperties;\n sheets: Sheet[];\n}\n\nexport interface SpreadsheetProperties {\n title: string;\n}\n\nexport interface Sheet {\n properties: SheetProperties;\n}\n\nexport interface SheetProperties {\n sheetId: number;\n title: string;\n}\n","export function fixSpaces(str: string) {\n return str && str.replace(/[\\s]/g, \" \");\n}\n\nexport function normalizeString(str: string) {\n return (\n str &&\n str\n .toLowerCase()\n .replace(\"ё\", \"е\")\n .replace(/[^A-Za-zА-ЯЁа-яё0-9]/g, \"\")\n );\n}\n\nexport function compareNormalized(s1: string, s2: string) {\n return normalizeString(s1) === normalizeString(s2);\n}\n\nexport function parseAnyFloat(s: string) {\n return parseFloat(s && s.replace(\",\", \".\"));\n}\n\nexport function groupBy(items: TItem[], key: keyof TItem) {\n const reducer: { [group: string]: TItem[] } = {};\n return items.reduce((reducer, item) => {\n const itemKey = `${item[key]}`;\n (reducer[itemKey] = reducer[itemKey] || []).push(item);\n return reducer;\n }, reducer);\n}\n\nexport function getKeys(obj: T): (keyof T)[] {\n const keys = Object.keys(obj) as (keyof T)[];\n return keys;\n}\n\nexport function filterNull(items: (T | null)[]): T[] {\n const result: T[] = [];\n for (const item of items) {\n if (item !== null) {\n result.push(item);\n }\n }\n return result;\n}\n\nexport function pluralize(\n count: number,\n version1: string,\n version2: string,\n version5: string\n) {\n if (\n count % 10 === 0 ||\n count % 10 >= 5 ||\n (count % 100 > 10 && count % 100 < 20)\n )\n return version5;\n return count % 10 === 1 ? version1 : version2;\n}\n\nexport function round10(value: number) {\n return Math.round(value * 10) / 10;\n}\n\nexport function round100(value: number) {\n return Math.round(value * 100) / 100;\n}\n","import { StudentFailure } from \"../apis/BrsApi\";\nimport { compareNormalized } from \"./tools\";\n\nconst failureMapping: { [key: string]: StudentFailure } = {\n \"-\": StudentFailure.NoFailure,\n \"Не выбрана\": StudentFailure.NotChosen,\n \"Не допущен (деканат)\": StudentFailure.NotAllowedByDeansOffice,\n \"Не явился\": StudentFailure.NotAppeared,\n Неуважительная: StudentFailure.DisrespectfulReason,\n Уважительная: StudentFailure.RespectfulReason,\n \"Не допущен\": StudentFailure.NotAllowedByTeacher,\n \"Не должен сдавать\": StudentFailure.ShouldNotPass,\n \"Академический отпуск\": StudentFailure.AcademicLeave,\n Выбыл: StudentFailure.DroppedOut,\n};\n\nexport function parseStudentFailure(input: string): StudentFailure | null {\n if (input === null || input === undefined) {\n return null;\n }\n\n for (let key of Object.keys(failureMapping)) {\n if (compareNormalized(key, input)) {\n return failureMapping[key];\n }\n }\n\n return StudentFailure.NoFailure;\n}\n\nexport function formatStudentFailure(\n input: StudentFailure | null | undefined\n): string | null {\n if (input === null || input === undefined) {\n return null;\n }\n\n for (let key of Object.keys(failureMapping)) {\n if (failureMapping[key] === input) {\n return key;\n }\n }\n\n return \"-\";\n}\n","export const emojiRegex =\n /[#*0-9]\\uFE0F?\\u20E3|[\\xA9\\xAE\\u203C\\u2049\\u2122\\u2139\\u2194-\\u2199\\u21A9\\u21AA\\u231A\\u231B\\u2328\\u23CF\\u23ED-\\u23EF\\u23F1\\u23F2\\u23F8-\\u23FA\\u24C2\\u25AA\\u25AB\\u25B6\\u25C0\\u25FB\\u25FC\\u25FE\\u2600-\\u2604\\u260E\\u2611\\u2614\\u2615\\u2618\\u2620\\u2622\\u2623\\u2626\\u262A\\u262E\\u262F\\u2638-\\u263A\\u2640\\u2642\\u2648-\\u2653\\u265F\\u2660\\u2663\\u2665\\u2666\\u2668\\u267B\\u267E\\u267F\\u2692\\u2694-\\u2697\\u2699\\u269B\\u269C\\u26A0\\u26A7\\u26AA\\u26B0\\u26B1\\u26BD\\u26BE\\u26C4\\u26C8\\u26CF\\u26D1\\u26E9\\u26F0-\\u26F5\\u26F7\\u26F8\\u26FA\\u2702\\u2708\\u2709\\u270F\\u2712\\u2714\\u2716\\u271D\\u2721\\u2733\\u2734\\u2744\\u2747\\u2757\\u2763\\u27A1\\u2934\\u2935\\u2B05-\\u2B07\\u2B1B\\u2B1C\\u2B55\\u3030\\u303D\\u3297\\u3299]\\uFE0F?|[\\u261D\\u270C\\u270D](?:\\uFE0F|\\uD83C[\\uDFFB-\\uDFFF])?|[\\u270A\\u270B](?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\u23E9-\\u23EC\\u23F0\\u23F3\\u25FD\\u2693\\u26A1\\u26AB\\u26C5\\u26CE\\u26D4\\u26EA\\u26FD\\u2705\\u2728\\u274C\\u274E\\u2753-\\u2755\\u2795-\\u2797\\u27B0\\u27BF\\u2B50]|\\u26D3\\uFE0F?(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?)?|\\uDC41\\uFE0F?(?:\\u200D\\uD83D\\uDDE8\\uFE0F?)?|\\uDC68(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D(?:[\\uDC68\\uDC69]\\u200D\\uD83D(?:\\uDC66(?:\\u200D\\uD83D\\uDC66)?|\\uDC67(?:\\u200D\\uD83D[\\uDC66\\uDC67])?)|[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uDC66(?:\\u200D\\uD83D\\uDC66)?|\\uDC67(?:\\u200D\\uD83D[\\uDC66\\uDC67])?)|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]))|\\uD83C(?:\\uDFFB(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]|\\uDD1D\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFC-\\uDFFF])))?|\\uDFFC(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]|\\uDD1D\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFB\\uDFFD-\\uDFFF])))?|\\uDFFD(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]|\\uDD1D\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFB\\uDFFC\\uDFFE\\uDFFF])))?|\\uDFFE(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]|\\uDD1D\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFB-\\uDFFD\\uDFFF])))?|\\uDFFF(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]|\\uDD1D\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFB-\\uDFFE])))?))?|\\uDC69(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?[\\uDC68\\uDC69]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D(?:[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uDC66(?:\\u200D\\uD83D\\uDC66)?|\\uDC67(?:\\u200D\\uD83D[\\uDC66\\uDC67])?|\\uDC69\\u200D\\uD83D(?:\\uDC66(?:\\u200D\\uD83D\\uDC66)?|\\uDC67(?:\\u200D\\uD83D[\\uDC66\\uDC67])?))|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]))|\\uD83C(?:\\uDFFB(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:[\\uDC68\\uDC69]|\\uDC8B\\u200D\\uD83D[\\uDC68\\uDC69])\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]|\\uDD1D\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFC-\\uDFFF])))?|\\uDFFC(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:[\\uDC68\\uDC69]|\\uDC8B\\u200D\\uD83D[\\uDC68\\uDC69])\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]|\\uDD1D\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFB\\uDFFD-\\uDFFF])))?|\\uDFFD(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:[\\uDC68\\uDC69]|\\uDC8B\\u200D\\uD83D[\\uDC68\\uDC69])\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]|\\uDD1D\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFB\\uDFFC\\uDFFE\\uDFFF])))?|\\uDFFE(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:[\\uDC68\\uDC69]|\\uDC8B\\u200D\\uD83D[\\uDC68\\uDC69])\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]|\\uDD1D\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFB-\\uDFFD\\uDFFF])))?|\\uDFFF(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:[\\uDC68\\uDC69]|\\uDC8B\\u200D\\uD83D[\\uDC68\\uDC69])\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]|\\uDD1D\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFB-\\uDFFE])))?))?|\\uDC6F(?:\\u200D[\\u2640\\u2642]\\uFE0F?)?|\\uDD75(?:\\uFE0F|\\uD83C[\\uDFFB-\\uDFFF])?(?:\\u200D[\\u2640\\u2642]\\uFE0F?)?|\\uDE2E(?:\\u200D\\uD83D\\uDCA8)?|\\uDE35(?:\\u200D\\uD83D\\uDCAB)?|\\uDE36(?:\\u200D\\uD83C\\uDF2B\\uFE0F?)?|\\uDE42(?:\\u200D[\\u2194\\u2195]\\uFE0F?)?|\\uDEB6(?:\\uD83C[\\uDFFB-\\uDFFF])?(?:\\u200D(?:[\\u2640\\u2642]\\uFE0F?(?:\\u200D\\u27A1\\uFE0F?)?|\\u27A1\\uFE0F?))?)|\\uD83E(?:[\\uDD0C\\uDD0F\\uDD18-\\uDD1F\\uDD30-\\uDD34\\uDD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?|\\uDDD2(?:\\u200D\\uD83E\\uDDD2)?))|\\uD83C(?:\\uDFFB(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D(?:\\uD83D\\uDC8B\\u200D)?\\uD83E\\uDDD1\\uD83C[\\uDFFC-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF84\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]|\\uDD1D\\u200D\\uD83E\\uDDD1\\uD83C[\\uDFFB-\\uDFFF])))?|\\uDFFC(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D(?:\\uD83D\\uDC8B\\u200D)?\\uD83E\\uDDD1\\uD83C[\\uDFFB\\uDFFD-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF84\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:[\\uDDAF\\uDDBC\\uDDBD](?:\\u200D\\u27A1\\uFE0F?)?|[\\uDDB0-\\uDDB3]|\\uDD1D\\u200D\\uD83E\\uDDD1\\uD83C[\\uDFFB-\\uDFFF])))?|\\uDFFD(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D(?:\\uD83D\\uDC8B\\u200D)?\\uD83E\\uDDD1\\uD83C[\\uDFFB\\uDFFC\\uDFFE\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF84\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE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\uD83C[\\uDFFB\\uDFFC\\uDFFE\\uDFFF])?|\\uDFFE(?:\\u200D\\uD83E\\uDEF2\\uD83C[\\uDFFB-\\uDFFD\\uDFFF])?|\\uDFFF(?:\\u200D\\uD83E\\uDEF2\\uD83C[\\uDFFB-\\uDFFE])?))?)/g;\n","import { StudentFailure, TermType } from \"../apis/BrsApi\";\nimport { ControlActionConfig } from \"./MarksManager\";\nimport * as googleApi from \"../apis/GoogleApi\";\nimport {\n compareNormalized,\n getKeys,\n filterNull,\n normalizeString,\n} from \"../helpers/tools\";\nimport { parseStudentFailure } from \"../helpers/brsHelpers\";\nimport { emojiRegex } from \"../helpers/emojiRegex\";\n\nexport interface ActualStudent {\n fullName: string;\n groupName: string | null;\n course: number | null;\n id: string | null;\n failure: StudentFailure | null;\n properties: string[];\n}\n\nexport interface SpreadsheetDatas {\n datas: SpreadsheetData[];\n}\n\nexport interface SpreadsheetData {\n actualStudents: ActualStudent[];\n disciplineConfig: DisciplineConfig;\n controlActionConfigs: ControlActionConfig[];\n}\n\nexport interface DisciplineConfig {\n name: string;\n year: number;\n termType: number;\n course: number;\n isModule: boolean;\n defaultStudentFailure: StudentFailure;\n}\n\ntype DisciplineConfigErrors = {\n [key in keyof DisciplineConfig]: string | null;\n};\n\nexport default class SpreadsheetManager {\n private readonly spreadsheetId: string;\n\n constructor(spreadsheetId: string) {\n this.spreadsheetId = spreadsheetId;\n }\n\n async getSpreadsheetDataAsync(sheetName: string): Promise {\n const rows = await readRowsFromSpreadsheetAsync(\n this.spreadsheetId,\n sheetName\n );\n const header = getHeader(rows);\n\n const indices = buildIndicesBy(header);\n const dataRange = buildDataRange(sheetName, indices);\n\n const actualStudents = await readStudentsAsync(\n this.spreadsheetId,\n dataRange,\n indices\n );\n\n if (\n indices.disciplineKeyColumn >= 0 &&\n indices.disciplineValueColumn >= 0\n ) {\n // Получение параметров из таблицы ключей и значений\n const controlActionConfigs = buildControlActionConfig(header, indices);\n const disciplineConfig = buildDisciplineConfig(rows, indices);\n return {\n datas: [{ actualStudents, disciplineConfig, controlActionConfigs }],\n };\n } else if (indices.courseColumn >= 0 || indices.academicGroupColumn >= 0) {\n // Получение параметров из заголовка таблицы\n const controlActionConfigs = buildControlActionConfig(header, indices);\n const studentGroups: { [course: number]: ActualStudent[] } = {};\n for (const student of actualStudents) {\n if (student.course !== null) {\n if (!studentGroups[student.course]) {\n studentGroups[student.course] = [];\n }\n studentGroups[student.course].push(student);\n }\n }\n\n const courses = getKeys(studentGroups);\n const disciplineConfigs =\n await buildDisciplineConfigFromSpreadsheetTitleAsync(\n this.spreadsheetId,\n courses\n );\n\n const datas = disciplineConfigs.map((config) => ({\n actualStudents: studentGroups[config.course],\n disciplineConfig: config,\n controlActionConfigs,\n }));\n\n return {\n datas,\n };\n } else {\n throw new Error(`Некорректная структура входной таблицы`);\n }\n }\n}\n\nasync function readStudentsAsync(\n spreadsheetId: string,\n readRange: string,\n indices: Indices\n) {\n const fullNameIndex =\n indices.fullNameColumn >= 0 ? indices.fullNameColumn - indices.left : null;\n const surnameIndex =\n indices.surnameColumn >= 0 ? indices.surnameColumn - indices.left : null;\n const nameIndex =\n indices.nameColumn >= 0 ? indices.nameColumn - indices.left : null;\n const patronymicIndex =\n indices.patronymicColumn >= 0\n ? indices.patronymicColumn - indices.left\n : null;\n const groupNameIndex =\n indices.groupColumn >= 0 ? indices.groupColumn - indices.left : null;\n const courseIndex =\n indices.courseColumn >= 0 ? indices.courseColumn - indices.left : null;\n const academicGroupIndex =\n indices.academicGroupColumn >= 0\n ? indices.academicGroupColumn - indices.left\n : null;\n const idIndex = null;\n const failureIndex = indices.failureColumn - indices.left;\n\n const sheet = googleApi.getSpreadsheet(spreadsheetId);\n const rows = (await sheet.readAsync(readRange)).values || [];\n\n const result: ActualStudent[] = [];\n for (const row of rows) {\n const fullName1 = fullNameIndex !== null ? row[fullNameIndex].trim() : null;\n const surname = surnameIndex !== null ? row[surnameIndex] : null;\n const name = nameIndex !== null ? row[nameIndex] : null;\n const patronymic = patronymicIndex !== null ? row[patronymicIndex] : null;\n const fullName2 =\n surname !== null && surname.length > 0\n ? `${surname.trim()} ${name?.trim() ?? \"\"} ${\n patronymic?.trim() ?? \"\"\n }`.trim()\n : null;\n const fullName =\n fullName1 !== null && fullName1.length > 0 ? fullName1 : fullName2;\n\n const groupName = groupNameIndex !== null ? row[groupNameIndex] : null;\n\n const course1 = courseIndex !== null ? row[courseIndex] : null;\n const academicGroup =\n academicGroupIndex !== null ? row[academicGroupIndex] : null;\n const course2 = academicGroup?.match(/\\d/)?.[0];\n const course = course1 !== null && course1.length > 0 ? course1 : course2;\n\n const id = idIndex !== null ? row[idIndex] : null;\n const failure =\n failureIndex !== null ? parseStudentFailure(row[failureIndex]) : null;\n if (fullName !== null && fullName.length > 0) {\n result.push({\n fullName: fullName,\n groupName,\n id: id,\n course,\n failure: failure,\n properties: row,\n });\n }\n }\n return result;\n}\n\nasync function readRowsFromSpreadsheetAsync(\n spreadsheetId: string,\n sheetName: string\n) {\n const sheet = googleApi.getSpreadsheet(spreadsheetId);\n const rows = (await sheet.readAsync(sheetName + \"!A1:ZZ100\"))\n .values as string[][];\n return rows || null;\n}\n\nasync function readTitleFromSpreadsheetAsync(spreadsheetId: string) {\n const sheet = googleApi.getSpreadsheet(spreadsheetId);\n return (await sheet.getMetaAsync()).properties.title;\n}\n\nfunction getHeader(rows: string[][]) {\n const header = rows && rows[0];\n if (!header) throw new Error(`Лист Google-таблицы не содержит строк`);\n return header;\n}\n\nfunction buildIndicesBy(header: string[]): Indices {\n const defaultGroupColumnName = \"Группа в БРС\";\n const defaultFullNameColumnName = \"Фамилия Имя в БРС\";\n const defaultSurnameColumnName = \"Фамилия\";\n const defaultNameColumnName = \"Имя\";\n const defaultPatronymicColumnName = \"Отчество\";\n const defaultCourseColumnName = \"Год обучения\";\n const defaultAcademicGroupColumnName = \"Группа\";\n const defaultFailureColumnName = \"Причина отсутствия\";\n const disciplineParameterKeyColumnPrefix = \"Названия параметров\";\n const disciplineParameterValueColumnPrefix = \"Значения параметров\";\n\n const normalizedHeader = header && header.map((s) => normalizeString(s));\n const groupColumnIndex = normalizedHeader.indexOf(\n normalizeString(defaultGroupColumnName)\n );\n const fullNameColumnIndex = normalizedHeader.indexOf(\n normalizeString(defaultFullNameColumnName)\n );\n const surnameColumnIndex = normalizedHeader.indexOf(\n normalizeString(defaultSurnameColumnName)\n );\n const nameColumnIndex = normalizedHeader.indexOf(\n normalizeString(defaultNameColumnName)\n );\n const patronymicColumnIndex = normalizedHeader.indexOf(\n normalizeString(defaultPatronymicColumnName)\n );\n const courseColumnIndex = normalizedHeader.indexOf(\n normalizeString(defaultCourseColumnName)\n );\n const academicGroupColumnIndex = normalizedHeader.indexOf(\n normalizeString(defaultAcademicGroupColumnName)\n );\n const failureColumnIndex = normalizedHeader.indexOf(\n normalizeString(defaultFailureColumnName)\n );\n const disciplineParameterKeyColumnIndex = normalizedHeader.indexOf(\n normalizeString(disciplineParameterKeyColumnPrefix)\n );\n const disciplineParameterValueColumnIndex = normalizedHeader.indexOf(\n normalizeString(disciplineParameterValueColumnPrefix)\n );\n\n if (\n failureColumnIndex < 0 ||\n (fullNameColumnIndex < 0 && surnameColumnIndex < 0) ||\n fullNameColumnIndex >= failureColumnIndex ||\n surnameColumnIndex >= failureColumnIndex ||\n nameColumnIndex >= failureColumnIndex ||\n patronymicColumnIndex >= failureColumnIndex ||\n (groupColumnIndex >= 0 && groupColumnIndex > failureColumnIndex) ||\n (courseColumnIndex >= 0 && courseColumnIndex > failureColumnIndex) ||\n (academicGroupColumnIndex >= 0 &&\n academicGroupColumnIndex > failureColumnIndex) ||\n (disciplineParameterKeyColumnIndex >= 0 &&\n disciplineParameterKeyColumnIndex <= failureColumnIndex) ||\n (disciplineParameterValueColumnIndex >= 0 &&\n disciplineParameterValueColumnIndex <= failureColumnIndex) ||\n (disciplineParameterKeyColumnIndex >= 0 &&\n disciplineParameterValueColumnIndex !==\n disciplineParameterKeyColumnIndex + 1)\n )\n throw new Error(`Неправильный порядок столбцов`);\n\n const leftIndex = Math.min(\n ...[\n fullNameColumnIndex,\n surnameColumnIndex,\n nameColumnIndex,\n patronymicColumnIndex,\n groupColumnIndex,\n courseColumnIndex,\n academicGroupColumnIndex,\n ].filter((it) => it >= 0)\n );\n const rightIndex = failureColumnIndex;\n\n return {\n groupColumn: groupColumnIndex,\n fullNameColumn: fullNameColumnIndex,\n surnameColumn: surnameColumnIndex,\n nameColumn: nameColumnIndex,\n patronymicColumn: patronymicColumnIndex,\n courseColumn: courseColumnIndex,\n academicGroupColumn: academicGroupColumnIndex,\n failureColumn: failureColumnIndex,\n disciplineKeyColumn: disciplineParameterKeyColumnIndex,\n disciplineValueColumn: disciplineParameterValueColumnIndex,\n left: leftIndex,\n right: rightIndex,\n };\n}\n\nfunction buildDataRange(sheetName: string, indices: Indices) {\n const leftLetter = String.fromCharCode(\"A\".charCodeAt(0) + indices.left);\n const rightLetter = String.fromCharCode(\"A\".charCodeAt(0) + indices.right);\n return `${sheetName}!${leftLetter}2:${rightLetter}`;\n}\n\nfunction buildControlActionConfig(header: string[], indices: Indices) {\n const controlActionConfigs: ControlActionConfig[] = [];\n for (let index = indices.left; index <= indices.right; index++) {\n if (\n index === indices.groupColumn ||\n index === indices.fullNameColumn ||\n index === indices.courseColumn ||\n index === indices.academicGroupColumn ||\n index === indices.failureColumn ||\n !header[index]\n ) {\n continue;\n }\n controlActionConfigs.push({\n controlAction: header[index],\n propertyIndex: index - indices.left,\n });\n }\n\n for (const config of controlActionConfigs) {\n const sameColumns = controlActionConfigs.filter((c) =>\n compareNormalized(c.controlAction, config.controlAction)\n );\n if (sameColumns.length > 1) {\n config.matchCount = sameColumns.length;\n for (let matchIndex = 0; matchIndex < sameColumns.length; matchIndex++) {\n sameColumns[matchIndex].matchIndex = matchIndex;\n }\n }\n }\n\n return controlActionConfigs;\n}\n\nasync function buildDisciplineConfigFromSpreadsheetTitleAsync(\n spreadsheetId: string,\n courses: number[]\n): Promise {\n const spreadsheetTitle = await readTitleFromSpreadsheetAsync(spreadsheetId);\n\n const prepared = spreadsheetTitle.replaceAll(emojiRegex, \"\").trim();\n const commaIndex = prepared.lastIndexOf(\",\");\n const name = prepared.substring(0, commaIndex).trim();\n const time = prepared.substring(commaIndex + 1).trim();\n const timeParts = time.split(\" \");\n const termType = compareNormalized(timeParts[0], \"весна\")\n ? TermType.Spring\n : TermType.Fall;\n const year =\n parseInt(timeParts[1], 10) + (termType === TermType.Spring ? -1 : 0);\n\n const configs = courses.map((it) => ({\n name,\n year,\n termType,\n course: it,\n isModule: true,\n defaultStudentFailure: StudentFailure.NoFailure,\n }));\n\n return configs;\n}\n\nfunction buildDisciplineConfig(rows: string[][], indices: Indices) {\n const result: DisciplineConfig = {\n name: \"\",\n year: 0,\n termType: TermType.Fall,\n course: 1,\n isModule: false,\n defaultStudentFailure: StudentFailure.NoFailure,\n };\n const errors: DisciplineConfigErrors = {\n name: \"Дисциплина\",\n year: \"Учебный год\",\n termType: \"Семестр\",\n course: \"Курс\",\n isModule: \"ИТС\",\n defaultStudentFailure: \"Причина отсутствия по умолчанию\",\n };\n\n for (let i = 0; i < rows.length; i++) {\n const key = rows[i][indices.disciplineKeyColumn]?.trim();\n if (!key) {\n break;\n }\n const value = rows[i][indices.disciplineValueColumn]?.trim();\n addDisciplineConfigParameter(result, errors, key, value);\n }\n\n const errorNames = filterNull(getKeys(errors).map((k) => errors[k]));\n if (errorNames.length > 0) {\n const errorNamesString = errorNames.map((n) => `«${n}»`).join(\", \");\n throw new Error(\n `Следующие параметры дисциплины не заданы: ${errorNamesString}`\n );\n }\n\n return result;\n}\n\nfunction addDisciplineConfigParameter(\n config: DisciplineConfig,\n errors: DisciplineConfigErrors,\n key: string,\n value: string\n) {\n if (compareNormalized(key, \"Дисциплина\")) {\n if (value) {\n config.name = value;\n errors.name = null;\n }\n } else if (compareNormalized(key, \"ИТС\")) {\n if (value) {\n config.isModule = value.toLowerCase() === \"да\";\n errors.isModule = null;\n }\n } else if (compareNormalized(key, \"Год\")) {\n if (value) {\n config.year = parseInt(value.toLowerCase(), 10);\n errors.year = null;\n }\n } else if (compareNormalized(key, \"Учебный год\")) {\n if (value) {\n const yearParts = value.toLowerCase().split(\"/\");\n config.year = parseInt(yearParts[0], 10);\n errors.year = null;\n }\n } else if (compareNormalized(key, \"Семестр\")) {\n if (value) {\n if (value.toLowerCase() === \"осенний\") {\n config.termType = TermType.Fall;\n errors.termType = null;\n } else if (value.toLowerCase() === \"весенний\") {\n config.termType = TermType.Spring;\n errors.termType = null;\n }\n }\n } else if (compareNormalized(key, \"Курс\")) {\n if (value) {\n const lowerValue = value.toLowerCase().trim();\n if (lowerValue === \"все курсы\") {\n config.course = 0;\n errors.course = null;\n } else {\n config.course = parseInt(value.toLowerCase(), 10);\n errors.course = null;\n }\n }\n } else if (compareNormalized(key, \"Причина отсутствия по умолчанию\")) {\n config.defaultStudentFailure =\n parseStudentFailure(value) ?? StudentFailure.NoFailure;\n errors.defaultStudentFailure = null;\n }\n}\n\ninterface Indices {\n groupColumn: number;\n fullNameColumn: number;\n surnameColumn: number;\n nameColumn: number;\n patronymicColumn: number;\n courseColumn: number;\n academicGroupColumn: number;\n failureColumn: number;\n disciplineKeyColumn: number;\n disciplineValueColumn: number;\n left: number;\n right: number;\n}\n","import React from \"react\";\nimport \"./styles.css\";\nimport {\n Collapse,\n List,\n ListItem,\n ListItemIcon,\n ListItemText,\n ListSubheader,\n} from \"@material-ui/core\";\nimport { ExpandLess, ExpandMore } from \"@material-ui/icons\";\n\nexport default function NestedList(props: NestedListProps) {\n const { title, items, icons } = props;\n\n const listSubheader = (\n \n );\n\n return (\n \n {items.length ? renderNestedItems(items, 0, icons) : renderEmpty()}\n
\n );\n}\n\nfunction renderNestedItems(\n items: NestedItem[],\n level: number,\n icons?: (JSX.Element | null)[]\n) {\n return items.map((item, index) => (\n \n ));\n}\n\nfunction renderEmpty() {\n return (\n \n \n \n );\n}\n\nfunction renderNestedItemsAsText(items: NestedItem[]) {\n return items.map((item, index) => {item.title}
);\n}\n\nfunction NestedListItem({ item, level, icons }: NestedListItemProps) {\n const { title, nestedItems, colored, collapsed, renderAsText } = item;\n\n const [open, setOpen] = React.useState(!collapsed);\n\n const hasSubItems = nestedItems && nestedItems.length > 0;\n\n const color = colored && \"colored-back\";\n\n const icon = icons && icons[level];\n const IconPlace = icon && {icon};\n\n return (\n \n setOpen(!open)}\n style={level ? { paddingLeft: 40 * level } : undefined}\n className={\"hover \" + color}\n >\n {IconPlace}\n \n {hasSubItems && (open ? : )}\n \n {hasSubItems && (\n \n {renderAsText ? (\n \n {nestedItems && renderNestedItemsAsText(nestedItems)}\n
\n ) : (\n \n {nestedItems && renderNestedItems(nestedItems, level + 1, icons)}\n
\n )}\n \n )}\n \n );\n}\n\nexport interface NestedItem {\n title: string;\n colored?: boolean;\n collapsed?: boolean;\n renderAsText?: boolean;\n nestedItems?: NestedItem[];\n}\n\ninterface NestedListProps {\n items: NestedItem[];\n title?: string;\n icons?: (JSX.Element | null)[];\n}\n\ninterface NestedListItemProps {\n item: NestedItem;\n level: number;\n renderAsText?: boolean;\n icons?: (JSX.Element | null)[];\n}\n","import { Button, Grid } from \"@material-ui/core\";\nimport React from \"react\";\n\nexport default function RunWorkerButtons({\n enabled,\n onRunWorkSafe,\n onRunWorkUnsafe,\n}: Props) {\n return (\n \n \n \n \n \n \n \n \n );\n}\n\ninterface Props {\n enabled: boolean;\n onRunWorkSafe: () => void;\n onRunWorkUnsafe: () => void;\n}\n","export function toShow(fio: string) {\n return fio.replace(\"ё\", \"е\").replace(/[ ]+/, \" \");\n}\n\nexport function toKey(fio: string) {\n return fio.toLowerCase().replace(\"ё\", \"е\").replace(/[ ]+/, \" \").trim();\n}\n","import BrsApi, {\n ControlAction,\n Discipline,\n DisciplineMeta,\n CardMeta,\n StudentFailure,\n StudentMark,\n} from \"../apis/BrsApi\";\nimport {\n compareNormalized,\n groupBy,\n normalizeString,\n parseAnyFloat,\n pluralize,\n round10,\n round100,\n} from \"../helpers/tools\";\nimport * as fio from \"../helpers/fio\";\nimport { ActualStudent, SpreadsheetData } from \"./SpreadsheetManager\";\nimport { formatStudentFailure } from \"../helpers/brsHelpers\";\nimport ReportManager from \"./ReportManager\";\nimport { BrsReport } from \"./BrsReport\";\n\nconst autoControlActionNames = new Set([\"auto\", \"баллы\"])\n\nenum MarkUpdateStatus {\n Updated,\n Failed,\n Skipped,\n}\n\nexport default class MarksManager {\n private readonly brsApi: BrsApi;\n private readonly save: boolean;\n private cancelPending: boolean = false;\n\n readonly reportManager: ReportManager;\n\n constructor(\n brsApi: BrsApi,\n reportManager: ReportManager,\n save: boolean\n ) {\n this.brsApi = brsApi;\n this.reportManager = reportManager;\n this.save = save;\n }\n\n cancel() {\n this.cancelPending = true;\n }\n\n async putMarksToBrsAsync(\n spreadsheetData: SpreadsheetData,\n disciplines: Discipline[]\n ) {\n const { actualStudents, disciplineConfig, controlActionConfigs } =\n spreadsheetData;\n try {\n for (const discipline of disciplines) {\n const students = actualStudents.filter((s) =>\n isSuitableDiscipline(s, discipline)\n );\n if (students.length === 0) {\n continue;\n }\n\n this.reportManager.newReport({\n disciplineConfig: disciplineConfig,\n discipline: discipline,\n merge: { succeed: 0 },\n marks: [],\n skipped: [],\n });\n\n var isSuccessful = await this.putMarksForDisciplineAsync(\n discipline,\n students,\n disciplineConfig.defaultStudentFailure,\n controlActionConfigs\n );\n\n if (isSuccessful) {\n this.reportManager.finishReport();\n } else {\n this.reportManager.cancelReport();\n }\n\n if (this.cancelPending) {\n break;\n }\n }\n\n return null;\n } catch (e) {\n return e;\n }\n }\n\n async putMarksForDisciplineAsync(\n discipline: Discipline,\n actualStudents: ActualStudent[],\n defaultStudentFailure: StudentFailure,\n controlActionConfigs: ControlActionConfig[]\n ) {\n const disciplineMeta = await this.brsApi.getDisciplineMetaAsync(discipline);\n\n if (\n !this.checkControlActionsConfiguration(\n discipline,\n disciplineMeta,\n controlActionConfigs\n )\n )\n return false;\n\n const brsStudents = await this.brsApi.getAllStudentMarksAsync(discipline);\n const { mergedStudents, skippedActualStudents, skippedBrsStudents } =\n this.mergeStudents(actualStudents, brsStudents);\n\n this.logMergedStudents(\n mergedStudents,\n skippedActualStudents,\n skippedBrsStudents\n );\n\n await this.putMarksForStudentsAsync(\n discipline,\n disciplineMeta,\n mergedStudents,\n controlActionConfigs\n );\n\n await this.updateFailuresForSkippedStudentsAsync(\n skippedBrsStudents,\n discipline,\n defaultStudentFailure\n );\n\n if (this.save) {\n await this.brsApi.updateAllMarksAsync(discipline);\n }\n\n return true;\n }\n\n checkControlActionsConfiguration(\n discipline: Discipline,\n disciplineMeta: DisciplineMeta,\n controlActionConfigs: ControlActionConfig[]\n ) {\n const autoControlActionConfig =\n this.tryGetAutoControlActionConfig(controlActionConfigs);\n if (autoControlActionConfig) {\n return true;\n }\n\n const controlActions = this.getControlActions(disciplineMeta);\n for (const config of controlActionConfigs) {\n if (!this.getSuitableControlAction(discipline, config, controlActions)) {\n return false;\n }\n }\n return true;\n }\n\n async putMarksForStudentsAsync(\n discipline: Discipline,\n disciplineMeta: DisciplineMeta,\n students: MergedStudent[],\n controlActionConfigs: ControlActionConfig[]\n ) {\n const ratings: Ratings = {};\n let notFinishedStudents = students;\n\n // 3 попытки при реальной записи нужно для проверки успешности 2-ой попытки\n // 2 попытки при отсутствии записи позволяют проверить работоспособность кода\n const tryCount = this.save ? 3 : 2;\n for (let i = 0; i < tryCount; i++) {\n notFinishedStudents = await this.putMarksForStudentsOnceAsync(\n ratings,\n discipline,\n disciplineMeta,\n notFinishedStudents,\n controlActionConfigs\n );\n }\n\n const ratingResults: Array = [];\n for (const studentId in ratings) {\n const r = ratings[studentId];\n\n if (this.save && !r.finished) {\n r.rating.status = MarkUpdateStatus.Failed;\n }\n\n ratingResults.push(r.rating);\n }\n\n const groupedResults = Object.entries(groupBy(ratingResults, \"status\")).map(\n ([groupKey, rawStudents]) => ({\n title: formatMarkUpdateStatus(rawStudents[0][\"status\"]),\n students: rawStudents.map((s) => s.infoString),\n failed: rawStudents[0][\"status\"] === MarkUpdateStatus.Failed,\n })\n );\n\n this.reportManager.currentReport.marks.push(...groupedResults);\n }\n\n async putMarksForStudentsOnceAsync(\n ratings: Ratings,\n discipline: Discipline,\n disciplineMeta: DisciplineMeta,\n students: MergedStudent[],\n controlActionConfigs: ControlActionConfig[]\n ) {\n const ratingResults = await Promise.all(\n students.map(async (student) => {\n return await this.putMarksForStudentAsync(\n discipline,\n disciplineMeta,\n student,\n controlActionConfigs\n );\n })\n );\n for (const rating of ratingResults) {\n // 1) S → S stop\n // 2) US → U stop, UU → U, UF → F, FS → F stop, FU → U, FF → F\n const oldRating = ratings[rating.student.brs.studentUuid]?.rating;\n const newRating =\n oldRating && rating.status === MarkUpdateStatus.Skipped\n ? oldRating\n : rating;\n const newFinished = rating.status === MarkUpdateStatus.Skipped;\n\n ratings[rating.student.brs.studentUuid] = {\n rating: newRating,\n finished: newFinished,\n };\n }\n\n const brsStudents: { [studentId: string]: StudentMark } = {};\n for (const s of await this.brsApi.getAllStudentMarksAsync(discipline)) {\n brsStudents[s.studentUuid] = s;\n }\n\n const notFinishedStudents = students\n .filter((s) => !ratings[s.brs.studentUuid]?.finished)\n .map((s) => ({\n actual: s.actual,\n brs: brsStudents[s.brs.studentUuid] || s.brs,\n }));\n\n return notFinishedStudents;\n }\n\n async putMarksForStudentAsync(\n discipline: Discipline,\n disciplineMeta: DisciplineMeta,\n student: MergedStudent,\n controlActionConfigs: ControlActionConfig[]\n ): Promise {\n const autoControlActionConfig =\n this.tryGetAutoControlActionConfig(controlActionConfigs);\n\n const controlActions = this.getControlActions(disciplineMeta);\n\n const log: PutMarksLog = {\n failed: 0,\n updated: 0,\n marks: [],\n };\n\n if (autoControlActionConfig !== null) {\n await this.putAutoMarksForStudentAsync(\n log,\n discipline,\n disciplineMeta,\n student,\n autoControlActionConfig\n );\n } else {\n await this.putManualMarksForStudentAsync(\n log,\n discipline,\n student,\n controlActionConfigs,\n controlActions\n );\n }\n\n const brsFailureStatus =\n (student.brs.failure as StudentFailure) ?? StudentFailure.NoFailure;\n const actualFailure = student.actual.failure ?? StudentFailure.NoFailure;\n let failureStatus: string;\n if (actualFailure === brsFailureStatus) {\n failureStatus = `${formatStudentFailure(actualFailure)}`;\n } else {\n failureStatus = `${formatStudentFailure(actualFailure)}!`;\n try {\n if (this.save) {\n await this.brsApi.putStudentFailureAsync(\n student.brs.studentUuid,\n discipline,\n actualFailure\n );\n }\n log.updated++;\n } catch (error) {\n log.failed++;\n }\n }\n\n const status =\n log.failed > 0\n ? MarkUpdateStatus.Failed\n : log.updated > 0\n ? MarkUpdateStatus.Updated\n : MarkUpdateStatus.Skipped;\n const studentName = student.actual.fullName.substr(0, 30);\n let infoString = `${studentName} баллы: ${log.marks.join(\" \")}`;\n if (failureStatus && failureStatus !== \"-\")\n infoString += `, ${failureStatus}`;\n\n return { student, status, infoString };\n }\n\n async putAutoMarksForStudentAsync(\n log: PutMarksLog,\n discipline: Discipline,\n disciplineMeta: DisciplineMeta,\n student: MergedStudent,\n autoControlActionConfig: ControlActionConfig\n ) {\n const autoMarkString =\n student.actual.properties[autoControlActionConfig.propertyIndex];\n const autoMark = parseAnyFloat(autoMarkString);\n\n const controlActionGroups = this.getControlActionGroups(disciplineMeta);\n\n const currentControlActionGroups = controlActionGroups.filter(\n (it) => !it.isIntermediate\n );\n const currentFactor = currentControlActionGroups.reduce(\n (result, it) => result + it.factor,\n 0\n );\n\n const intermediateControlActionGroups = controlActionGroups.filter(\n (it) => it.isIntermediate\n );\n const intermediateFactor = intermediateControlActionGroups.reduce(\n (result, it) => it.factor,\n 0\n );\n\n const output = `[auto=${autoMark}]`;\n log.marks.push(` ${output}`.substr(`${output}`.length - 1));\n\n // NOTE: Если баллов достаточно для удовлетворительной оценки,\n // то заполняем КМы по возможности максимальными оценками с первого к последнему.\n if (40 <= autoMark) {\n await this.putMarksTryFillActionsWithMaxScoreAsync(\n log,\n discipline,\n student,\n controlActionGroups,\n autoMark\n );\n }\n // NOTE: Если баллов достаточно, чтобы поставить за семестр 40, то ставим\n else if (currentFactor * 40 <= autoMark) {\n const currentMark = 40;\n const rawIntermediateMark =\n currentFactor > 0\n ? (autoMark - currentFactor * currentMark) / intermediateFactor\n : 0;\n const intermediateMark = round100(rawIntermediateMark);\n\n await this.putMarksTryFillActionsWithMaxScoreAsync(\n log,\n discipline,\n student,\n currentControlActionGroups,\n currentMark\n );\n\n await this.putMarksTryFillActionsWithMaxScoreAsync(\n log,\n discipline,\n student,\n intermediateControlActionGroups,\n intermediateMark\n );\n }\n // NOTE: Иначе ставим за семестр все, что возможно, а за сессию 0.\n else {\n const intermediateMark = 0;\n const rawCurrentMark =\n currentFactor > 0\n ? (autoMark - intermediateFactor * intermediateMark) / currentFactor\n : 0;\n const currentMark = round100(rawCurrentMark);\n\n await this.putMarksTryFillActionsWithMaxScoreAsync(\n log,\n discipline,\n student,\n currentControlActionGroups,\n currentMark\n );\n\n await this.putMarksTryFillActionsWithMaxScoreAsync(\n log,\n discipline,\n student,\n intermediateControlActionGroups,\n intermediateMark\n );\n }\n }\n\n async putMarksTryFillActionsWithMaxScoreAsync(\n log: PutMarksLog,\n discipline: Discipline,\n student: MergedStudent,\n controlActionGroups: ControlActionGroup[],\n mark: number\n ) {\n for (const controlActionGroup of controlActionGroups) {\n const controlActions = controlActionGroup.controlActions;\n\n let value = mark;\n for (let i = 0; i < controlActions.length; i++) {\n const controlAction = controlActions[i];\n const actualMark =\n controlAction.maxValue < value\n ? controlAction.maxValue\n : round10(value);\n value -= actualMark;\n\n await this.putMarkAsync(\n log,\n discipline,\n student,\n controlAction,\n actualMark\n );\n }\n }\n }\n\n async putManualMarksForStudentAsync(\n log: PutMarksLog,\n discipline: Discipline,\n student: MergedStudent,\n controlActionConfigs: ControlActionConfig[],\n controlActions: ControlAction[]\n ) {\n for (const config of controlActionConfigs) {\n const controlAction = this.getSuitableControlAction(\n discipline,\n config,\n controlActions\n );\n if (!controlAction) {\n throw new Error(\n `Подходящее контрольное мероприятие для «${config.controlAction}» не найдено в БРС`\n );\n }\n\n const actualMarkString = student.actual.properties[config.propertyIndex];\n const actualMark = parseAnyFloat(actualMarkString);\n\n await this.putMarkAsync(\n log,\n discipline,\n student,\n controlAction,\n actualMark\n );\n }\n\n return log;\n }\n\n async putMarkAsync(\n log: PutMarksLog,\n discipline: Discipline,\n student: MergedStudent,\n controlAction: ControlAction,\n actualMark: number\n ) {\n const brsMarkString = student.brs[controlAction.uuid] as string;\n const brsMark = parseAnyFloat(brsMarkString);\n\n const needUpdateMark =\n !isNaN(actualMark) &&\n !(isNaN(brsMark) ? actualMark === 0 : brsMark === actualMark);\n const actualMarkOutput = !isNaN(actualMark) ? actualMark.toString() : \"-\";\n const controlActionOutput = controlAction.controlAction.substring(0, 3);\n\n if (needUpdateMark) {\n log.marks.push(\n ` ${controlActionOutput}=${actualMarkOutput}!`.substr(\n `${actualMarkOutput}`.length - 1\n )\n );\n } else {\n log.marks.push(\n ` ${controlActionOutput}=${actualMarkOutput} `.substr(\n `${actualMarkOutput}`.length - 1\n )\n );\n return;\n }\n\n try {\n if (this.save) {\n await this.brsApi.putStudentMarkAsync(\n student.brs.studentUuid,\n controlAction.uuidWithoutPrefix,\n actualMark,\n discipline.groupHistoryId,\n student.brs.cardType,\n student.brs.disciplineLoad\n );\n }\n log.updated++;\n } catch (error) {\n log.failed++;\n }\n }\n\n getSuitableControlAction(\n discipline: Discipline,\n config: ControlActionConfig,\n controlActions: ControlAction[]\n ) {\n const suitableControlActions = controlActions.filter((a) =>\n compareNormalized(a.controlAction, config.controlAction)\n );\n\n const errorMessages = [];\n\n if (suitableControlActions.length === 0) {\n errorMessages.push(\n `Группа ${discipline.group}` +\n (discipline.teacherName !== undefined\n ? `, преподаватель ${discipline.teacherName}`\n : \"\")\n );\n errorMessages.push(\n `- контрольное мероприятие «${config.controlAction}» не сопоставлено с БРС`\n );\n errorMessages.push(\n `- найденные в БРС контрольные мероприятия: ${controlActions\n .map((a) => a.controlAction)\n .join(\", \")}`\n );\n\n this.reportManager.onInvalidConfiguration(errorMessages);\n\n return null;\n }\n\n if (config.matchIndex !== undefined || config.matchCount !== undefined) {\n if (\n config.matchIndex === undefined ||\n config.matchCount === undefined ||\n suitableControlActions.length !== config.matchCount ||\n config.matchIndex >= config.matchCount\n ) {\n errorMessages.push(\n `Неверная конфигурация контрольного мероприятия «${config.controlAction}»`\n );\n if (suitableControlActions.length !== config.matchCount) {\n errorMessages.push(\n `В БРС найдено ${suitableControlActions.length} ${pluralize(\n suitableControlActions.length,\n \"подходящее контрольное мероприятие\",\n \"подходящих контрольных мероприятия\",\n \"подходящих контрольных мероприятий\"\n )}, а в таблице указано ${config.matchCount}`\n );\n }\n\n this.reportManager.onInvalidConfiguration(errorMessages);\n\n return null;\n }\n return suitableControlActions[config.matchIndex];\n }\n\n if (suitableControlActions.length > 1) {\n errorMessages.push(\n `Несколько контрольных мероприятий найдено для «${config.controlAction}»`\n );\n errorMessages.push(\n `Найденные контрольные мероприятия: ${suitableControlActions\n .map((a) => a.controlAction)\n .join(\", \")}`\n );\n\n this.reportManager.onInvalidConfiguration(errorMessages);\n\n return null;\n }\n\n return suitableControlActions[0];\n }\n\n async updateFailuresForSkippedStudentsAsync(\n students: StudentMark[],\n discipline: Discipline,\n defaultStudentFailure: StudentFailure\n ) {\n const ratingResults = await Promise.all(\n students.map((student) =>\n this.updateFailureForStudent(student, discipline, defaultStudentFailure)\n )\n );\n\n if (ratingResults.length > 0) {\n const groupedResults = Object.entries(\n groupBy(ratingResults, \"status\")\n ).map(([groupKey, rawStudents]) => ({\n title: formatMarkUpdateStatus(rawStudents[0][\"status\"]),\n students: rawStudents.map((s) => s.infoString),\n }));\n\n this.reportManager.currentReport.skipped.push(...groupedResults);\n }\n }\n\n async updateFailureForStudent(\n student: StudentMark,\n discipline: Discipline,\n defaultStudentFailure: StudentFailure\n ) {\n let status: MarkUpdateStatus;\n const brsFailureStatus = student.failure\n ? (student.failure as StudentFailure)\n : StudentFailure.NoFailure;\n const actualFailure = defaultStudentFailure;\n if (actualFailure === brsFailureStatus) {\n status = MarkUpdateStatus.Skipped;\n } else {\n try {\n if (this.save) {\n await this.brsApi.putStudentFailureAsync(\n student.studentUuid,\n discipline,\n actualFailure\n );\n }\n status = MarkUpdateStatus.Updated;\n } catch (error) {\n status = MarkUpdateStatus.Failed;\n }\n }\n\n const studentName = student.studentFio.substr(0, 30);\n const description =\n status !== MarkUpdateStatus.Skipped\n ? `выставлено «${formatStudentFailure(\n actualFailure\n )}», было «${formatStudentFailure(brsFailureStatus)}»`\n : `«${formatStudentFailure(actualFailure)}»`;\n\n const infoString = `${studentName}, ${description}`;\n\n return { status, infoString };\n }\n\n tryGetAutoControlActionConfig(\n controlActionConfigs: ControlActionConfig[]\n ): ControlActionConfig | null {\n const autoConfigs = controlActionConfigs.filter(\n (it) => autoControlActionNames.has(it.controlAction.toLowerCase())\n );\n\n if (autoConfigs.length === 1) {\n return autoConfigs[0];\n }\n\n if (autoConfigs.length > 1) {\n this.reportManager.onInvalidConfiguration([\n `Найдено несколько колонок с автоитогом`,\n ]);\n }\n return null;\n }\n\n getControlActions(disciplineMeta: DisciplineMeta) {\n const controlActions = [\n ...(disciplineMeta.lecture?.currentControlActions || []),\n ...(disciplineMeta.lecture?.intermediateControlActions || []),\n ...(disciplineMeta.laboratory?.currentControlActions || []),\n ...(disciplineMeta.laboratory?.intermediateControlActions || []),\n ...(disciplineMeta.practice?.currentControlActions || []),\n ...(disciplineMeta.practice?.intermediateControlActions || []),\n ...(disciplineMeta.additionalPractice?.currentControlActions || []),\n ...(disciplineMeta.additionalPractice?.intermediateControlActions || []),\n ];\n\n return controlActions;\n }\n\n getControlActionGroups(disciplineMeta: DisciplineMeta) {\n const groups: ControlActionGroup[] = [];\n\n if (disciplineMeta.lecture) {\n this.pushControlActionGroups(groups, disciplineMeta.lecture);\n }\n if (disciplineMeta.laboratory) {\n this.pushControlActionGroups(groups, disciplineMeta.laboratory);\n }\n if (disciplineMeta.practice) {\n this.pushControlActionGroups(groups, disciplineMeta.practice);\n }\n if (disciplineMeta.additionalPractice) {\n this.pushControlActionGroups(groups, disciplineMeta.additionalPractice);\n }\n\n return groups;\n }\n\n pushControlActionGroups(groups: ControlActionGroup[], cardMeta: CardMeta) {\n if (cardMeta.currentControlActions.length > 0) {\n const factor = round100(cardMeta.currentFactor * cardMeta.totalFactor);\n const controlActions = cardMeta.currentControlActions;\n groups.push({ factor, controlActions, isIntermediate: false });\n }\n if (cardMeta.intermediateControlActions.length > 0) {\n const factor = round100(\n cardMeta.intermediateFactor * cardMeta.totalFactor\n );\n const controlActions = cardMeta.intermediateControlActions;\n groups.push({ factor, controlActions, isIntermediate: true });\n }\n }\n\n mergeStudents(actualStudents: ActualStudent[], brsStudents: StudentMark[]) {\n const activeBrsStudents = brsStudents.filter(isStudentActiveAndShouldPass);\n\n const mergedStudents: MergedStudent[] = [];\n const skippedActualStudents: ActualStudent[] = [];\n for (const actualStudent of actualStudents) {\n const suitableStudents = activeBrsStudents.filter((brsStudent) =>\n areStudentsLike(brsStudent, actualStudent)\n );\n if (suitableStudents.length === 1) {\n mergedStudents.push({\n actual: actualStudent,\n brs: suitableStudents[0],\n });\n } else {\n skippedActualStudents.push(actualStudent);\n }\n }\n\n const skippedBrsStudents: StudentMark[] = [];\n for (const brsStudent of activeBrsStudents) {\n if (\n !mergedStudents.some(\n (ms) => ms.brs.studentUuid === brsStudent.studentUuid\n )\n ) {\n skippedBrsStudents.push(brsStudent);\n }\n }\n\n return { mergedStudents, skippedActualStudents, skippedBrsStudents };\n }\n\n logMergedStudents(\n mergedStudents: MergedStudent[],\n skippedActualStudents: ActualStudent[],\n skippedBrsStudents: StudentMark[]\n ) {\n const report = this.reportManager.currentReport;\n\n report.merge.succeed = mergedStudents.length;\n\n if (skippedActualStudents.length > 0)\n report.merge.failedActual = skippedActualStudents.map((s) => s.fullName);\n\n if (skippedBrsStudents.length > 0) {\n report.merge.failedBrs = skippedBrsStudents.map((s) => s.studentFio);\n }\n }\n}\n\nfunction isStudentActiveAndShouldPass(brsStudent: StudentMark) {\n return (\n brsStudent.studentStatus !== \"Переведен\" &&\n brsStudent.studentStatus !== \"Отчислен\" &&\n brsStudent.studentStatus !== \"Переведен\" &&\n brsStudent.studentStatus !== \"Отп.акад.\" &&\n brsStudent.failure !== StudentFailure.ShouldNotPass\n );\n}\n\nfunction areStudentsLike(\n brsStudent: StudentMark,\n actualStudent: ActualStudent\n) {\n const brsFullName = fio.toKey(brsStudent.studentFio);\n const actualFullName = fio.toKey(actualStudent.fullName);\n return brsFullName.startsWith(actualFullName);\n}\n\nfunction isSuitableDiscipline(\n actualStudent: ActualStudent,\n discipline: Discipline\n) {\n if (actualStudent.groupName && actualStudent.groupName.length > 0) {\n const s = normalizeString(actualStudent.groupName)\n const d = normalizeString(discipline.group)\n return d.startsWith(s)\n }\n\n return true;\n}\n\nfunction formatMarkUpdateStatus(status: MarkUpdateStatus) {\n switch (status) {\n case MarkUpdateStatus.Updated:\n return \"ОБНОВЛЕНО\";\n case MarkUpdateStatus.Skipped:\n return \"ПРОПУЩЕНО\";\n case MarkUpdateStatus.Failed:\n return \"ПРОВАЛЕНО\";\n default:\n throw new Error(\"Неизвестный статус обновления оценок\");\n }\n}\n\nexport interface ControlActionConfig {\n controlAction: string;\n matchIndex?: number;\n matchCount?: number;\n propertyIndex: number;\n}\n\ninterface MergedStudent {\n actual: ActualStudent;\n brs: StudentMark;\n}\n\ninterface PutMarksLog {\n updated: number;\n failed: number;\n marks: string[];\n}\n\ninterface ControlActionGroup {\n factor: number;\n controlActions: ControlAction[];\n isIntermediate: boolean;\n}\n\ninterface RatingResult {\n student: MergedStudent;\n status: MarkUpdateStatus;\n infoString: string;\n}\n\ninterface Ratings {\n [studentId: string]: { rating: RatingResult; finished: boolean };\n}\n","import React, { memo } from \"react\";\nimport SpreadsheetManager, {\n DisciplineConfig,\n SpreadsheetData,\n SpreadsheetDatas,\n} from \"../../../managers/SpreadsheetManager\";\nimport NestedList, { NestedItem } from \"../../shared/NestedList\";\nimport { Collapse, Container } from \"@material-ui/core\";\nimport {\n compareNormalized,\n filterNull,\n normalizeString,\n} from \"../../../helpers/tools\";\nimport * as googleApi from \"../../../apis/GoogleApi\";\nimport BrsApi, { Discipline, TermType } from \"../../../apis/BrsApi\";\nimport \"./styles.css\";\nimport RunWorkerButtons from \"../RunWorkerButtons\";\nimport WorkerDialog, { MarksData } from \"../WorkerDialog\";\nimport GroupIcon from \"@material-ui/icons/Group\";\nimport { ViewModule } from \"@material-ui/icons\";\nimport GoogleTableFetchForm from \"./GoogleTableFetchForm\";\n\nenum LastAction {\n None,\n LoadDisciplines,\n RunWork,\n}\n\nclass GoogleTableFetch extends React.Component {\n marksDatas: Array = [];\n workerSaveMode: boolean = false;\n spreadsheetId: string = \"\";\n sheetId: string | null = null;\n\n constructor(props: Props) {\n super(props);\n\n this.state = {\n tableUrl: \"\",\n loading: false,\n showDisciplines: false,\n lastAction: LastAction.None,\n tableUrlError: { error: false, message: \"\" },\n disciplines: [],\n allDisciplinesMissed: false,\n missedDisciplinesCount: 0,\n showWorkerButtons: false,\n runWorker: false,\n };\n }\n\n loadDisciplines = async (spreadsheetId: string, sheetId: string | null) => {\n this.spreadsheetId = spreadsheetId;\n this.sheetId = sheetId;\n\n this.setState({ loading: true });\n\n const spreadsheetDatas = await this.getActualSpreadsheetDataAsync(\n spreadsheetId,\n sheetId\n );\n if (!spreadsheetDatas?.datas || spreadsheetDatas.datas.length === 0) {\n this.setState({ loading: false });\n return false;\n }\n\n this.marksDatas = [];\n const nestedItems: NestedItem[] = [];\n let allMissed = true;\n let missedCount = 0;\n for (const data of spreadsheetDatas.datas) {\n const disciplines = await this.getActualDisciplinesAsync(\n data.disciplineConfig\n );\n if (!disciplines) {\n this.setState({ loading: false });\n return false;\n }\n this.marksDatas.push({\n spreadsheetData: data,\n suitableDisciplines: disciplines,\n });\n\n const items = this.disciplinesToListItems(disciplines, data);\n allMissed = allMissed && items.allMissed;\n missedCount += items.missedCount;\n nestedItems.push(...items.disciplines);\n }\n\n this.setState({\n loading: false,\n disciplines: nestedItems,\n showDisciplines: true,\n lastAction: LastAction.LoadDisciplines,\n allDisciplinesMissed: allMissed,\n missedDisciplinesCount: missedCount,\n showWorkerButtons: !allMissed,\n });\n\n return !allMissed;\n };\n\n disciplinesToListItems(\n availableDisciplines: Discipline[],\n spreadsheetData: SpreadsheetData\n ): { allMissed: boolean; missedCount: number; disciplines: NestedItem[] } {\n const actualGroups = Array.from(\n new Set(spreadsheetData.actualStudents.map((s) => s.groupName || \"\"))\n );\n const availableGroups = Array.from(\n new Set(availableDisciplines.map((s) => s.group))\n );\n\n let missedCount = 0;\n const nestedItems: NestedItem[] = actualGroups\n .map((group) => {\n if (group.length > 0) {\n const normalizedGroup = normalizeString(group);\n const availableForActual = availableGroups.filter((it) =>\n normalizeString(it).startsWith(normalizedGroup)\n );\n\n if (availableForActual.length === 0) {\n missedCount++;\n return [{ title: group, colored: true }];\n } else {\n return availableForActual.map((it) => ({\n title: it,\n colored: false,\n }));\n }\n } else {\n if (availableGroups.length === 0) {\n missedCount++;\n return [{ title: 'Автоопределение → нет вариантов', colored: true }];\n } else {\n return availableGroups.map((it) => ({\n title: `Автоопределение → ${it}`,\n colored: false,\n }));\n }\n }\n })\n .flat();\n\n const disciplineConfig = spreadsheetData.disciplineConfig;\n const disciplineTime =\n disciplineConfig.termType === TermType.Fall\n ? `осень ${disciplineConfig.year}`\n : disciplineConfig.termType === TermType.Spring\n ? `весна ${disciplineConfig.year + 1}`\n : `${disciplineConfig.year}/${disciplineConfig.year + 1}`;\n const disciplineTitle = `${disciplineConfig.name}, ${disciplineTime}, ${disciplineConfig.course} курс`;\n return {\n allMissed: missedCount === actualGroups.length,\n missedCount,\n disciplines: [\n {\n title: disciplineTitle,\n nestedItems,\n },\n ],\n };\n }\n\n async getActualDisciplinesAsync(disciplineConfig: DisciplineConfig) {\n try {\n const allDisciplines = await this.props.brsApi.getDisciplineCachedAsync(\n disciplineConfig.year,\n disciplineConfig.termType,\n disciplineConfig.course,\n disciplineConfig.isModule\n );\n\n return allDisciplines.filter((d) =>\n compareNormalized(d.discipline, disciplineConfig.name)\n );\n } catch (error: any) {\n this.props.onError(error);\n }\n }\n\n async getActualSpreadsheetDataAsync(\n spreadsheetId: string,\n sheetId: string | null\n ) {\n const sheetName = await this.getSheetName(spreadsheetId, sheetId);\n if (!sheetName) {\n return null;\n }\n\n let spreadsheetData: SpreadsheetDatas;\n try {\n const spreadsheetManager = new SpreadsheetManager(spreadsheetId);\n spreadsheetData = await spreadsheetManager.getSpreadsheetDataAsync(\n sheetName\n );\n } catch (e: any) {\n this.props.onError(e.message || JSON.stringify(e));\n return null;\n }\n\n return spreadsheetData;\n }\n\n async getSheetName(\n spreadsheetId: string,\n sheetId: string | null\n ): Promise {\n try {\n const meta = await googleApi.getSpreadsheet(spreadsheetId).getMetaAsync();\n const sheets = meta.sheets.map((it) => it.properties);\n const maybeSheet = sheetId\n ? sheets.filter((s) => s.sheetId.toString() === sheetId)[0]\n : sheets[0];\n if (!maybeSheet) {\n this.props.onError(\"Таблица не найдена\");\n return null;\n }\n return maybeSheet.title;\n } catch (e: any) {\n this.props.onError(e.message || JSON.stringify(e));\n return null;\n }\n }\n\n updateCachedDisciplines = (\n event: React.MouseEvent\n ) => {\n event.preventDefault();\n this.setState({ showDisciplines: false });\n\n for (const marksData of this.marksDatas) {\n const disciplineConfig = marksData.spreadsheetData?.disciplineConfig;\n if (!disciplineConfig) return;\n\n this.props.brsApi\n .clearDisciplineCacheAsync(\n disciplineConfig.year,\n disciplineConfig.termType,\n disciplineConfig.course,\n disciplineConfig.isModule\n )\n .then(\n (x) => x,\n (error) => {\n this.props.onError(error);\n }\n );\n }\n\n this.loadDisciplines(this.spreadsheetId, this.sheetId);\n };\n\n runWork = async (save: boolean) => {\n if (this.state.lastAction !== LastAction.LoadDisciplines) {\n const success = await this.loadDisciplines(\n this.spreadsheetId,\n this.sheetId\n );\n if (!success) {\n return;\n }\n }\n\n this.workerSaveMode = save;\n this.setState({\n lastAction: LastAction.RunWork,\n runWorker: true,\n });\n };\n\n handleRunWorkSafe = () => this.runWork(false);\n\n handleRunWorkUnsafe = () => this.runWork(true);\n\n handleWorkerClosed = () => this.setState({ runWorker: false });\n\n render() {\n return (\n \n \n Вставьте ссылку на лист Google Таблицы с оценками\n
\n \n\n \n Загруженные дисциплины из Google Таблицы
\n {this.state.missedDisciplinesCount > 0 && (\n \n Группы, к которым у вас нет доступа в БРС,{\" \"}\n подсвечены\n
\n )}\n\n , ]}\n />\n\n {this.state.allDisciplinesMissed ? (\n \n У вас нет доступа ни к одной из перечисленных групп в БРС
\n Возможные действия:\n \n - \n Убедитесь, что название дисциплины в БРС и в Google Таблицах\n совпадает\n
\n - Запросите доступ на дисциплину в БРС
\n - Убедитесь, что техкарта согласована в БРС
\n - \n \n
\n
\n \n ) : (\n \n \n Если вам доступны не все группы, которые вам доступны в БРС, то{\" \"}\n \n
\n \n \n \n \n )}\n \n {this.state.runWorker && (\n \n )}\n \n );\n }\n}\n\nexport default memo(GoogleTableFetch);\n\ninterface Props {\n brsApi: BrsApi;\n onError: (errorMessage: string) => void;\n}\n\ninterface State {\n tableUrl: string;\n loading: boolean;\n showDisciplines: boolean;\n lastAction: LastAction;\n tableUrlError: { error: boolean; message: string };\n disciplines: NestedItem[];\n allDisciplinesMissed: boolean;\n missedDisciplinesCount: number;\n showWorkerButtons: boolean;\n runWorker: boolean;\n}\n","export default class ReportManager {\n private _currentReport: TReport | null = null;\n private readonly onReportFinished: (report: TReport) => void;\n\n readonly onInvalidConfiguration: (errorMessages: string[]) => void;\n\n constructor(\n onReportFinished: (report: TReport) => void,\n onInvalidConfiguration: (errorMessages: string[]) => void\n ) {\n this.onReportFinished = onReportFinished;\n this.onInvalidConfiguration = onInvalidConfiguration;\n }\n\n get currentReport() {\n if (!this._currentReport)\n throw new Error(\"Построение отчета еще не начато\");\n return this._currentReport;\n }\n\n newReport(report: TReport) {\n this.finishReport();\n this._currentReport = report\n }\n\n finishReport() {\n if (this._currentReport) this.onReportFinished(this._currentReport);\n this._currentReport = null;\n }\n\n cancelReport() {\n this._currentReport = null;\n }\n}\n","import React from \"react\";\nimport \"./styles.css\";\nimport { withStyles } from \"@material-ui/core/styles\";\nimport { Dialog } from \"@material-ui/core\";\nimport MuiDialogTitle from \"@material-ui/core/DialogTitle\";\nimport MuiDialogContent from \"@material-ui/core/DialogContent\";\nimport MuiDialogActions from \"@material-ui/core/DialogActions\";\nimport SubmitWithLoading from \"../../shared/SubmitWithLoading\";\nimport MarksManager from \"../../../managers/MarksManager\";\nimport BrsApi, { Discipline, TermType } from \"../../../apis/BrsApi\";\nimport { SpreadsheetData } from \"../../../managers/SpreadsheetManager\";\nimport NestedList, { NestedItem } from \"../../shared/NestedList\";\nimport ReportManager from \"../../../managers/ReportManager\";\nimport { pluralize } from \"../../../helpers/tools\";\nimport { BrsReport } from \"../../../managers/BrsReport\";\n\nconst DialogContent = withStyles(() => ({\n root: {\n padding: 0,\n },\n}))(MuiDialogContent);\n\nconst DialogActions = withStyles(() => ({\n root: {\n display: \"flex\",\n justifyContent: \"space-around\",\n },\n}))(MuiDialogActions);\n\nexport default class WorkerDialog extends React.Component {\n marksManager: MarksManager;\n\n constructor(props: Props) {\n super(props);\n\n const { brsApi, save } = props;\n const reportManager = new ReportManager(\n this.logMessage,\n this.logConfigurationErrors\n );\n this.marksManager = new MarksManager(brsApi, reportManager, save);\n\n this.state = {\n okLoading: true,\n cancelPending: false,\n logItems: [],\n };\n }\n\n componentDidMount() {\n this.startWork();\n }\n\n componentWillUnmount() {\n this.marksManager.cancel();\n }\n\n logConfigurationErrors = (errorMessages: string[]) => {\n const logItems = errorMessages.map((title) => ({ title, colored: true }));\n this.setState({ logItems });\n };\n\n logMessage = async (report: BrsReport) => {\n const logItems = await this.reportToNestedListItems(report);\n this.setState({ logItems });\n };\n\n reportToNestedListItems(report: BrsReport): Promise {\n const logItems = this.state.logItems;\n return new Promise((resolve) => {\n const disciplineConfig = report.disciplineConfig;\n const disciplineTime =\n disciplineConfig.termType === TermType.Fall\n ? `осень ${disciplineConfig.year}`\n : disciplineConfig.termType === TermType.Spring\n ? `весна ${disciplineConfig.year + 1}`\n : `${disciplineConfig.year}/${disciplineConfig.year + 1}`;\n let title = `Группа ${report.discipline.group} (${disciplineTime}, ${disciplineConfig.course} курс)`;\n\n const nestedItems: NestedItem[] = [];\n const mainItem: NestedItem = { title, collapsed: true, nestedItems };\n\n let hasErrors = false;\n\n const merge = report.merge;\n let mergeResultsTitle = `Сопоставление: ${merge.succeed} успешно`;\n const failedActualCount = merge.failedActual?.length || 0;\n mergeResultsTitle += `, ${failedActualCount} ${pluralize(\n failedActualCount,\n \"неизвестный\",\n \"неизвестных\",\n \"неизвестных\"\n )} в таблице`;\n const failedBrsCount = merge.failedBrs?.length || 0;\n mergeResultsTitle += `, ${failedBrsCount} ${pluralize(\n failedBrsCount,\n \"неизвестный\",\n \"неизвестных\",\n \"неизвестных\"\n )} в БРС`;\n\n const mergeInfoItem: NestedItem = {\n title: mergeResultsTitle,\n nestedItems: [],\n collapsed: true,\n };\n nestedItems.push(mergeInfoItem);\n\n if (!!merge.failedActual) {\n hasErrors = true;\n title = `Не удалось сопоставить ${\n merge.failedActual.length\n } ${pluralize(\n merge.failedActual.length,\n \"студента\",\n \"студентов\",\n \"студентов\"\n )} из Google Таблицы`;\n mergeInfoItem.nestedItems?.push({\n title,\n nestedItems: merge.failedActual.map((s) => ({ title: s })),\n colored: true,\n collapsed: false,\n renderAsText: true,\n });\n }\n if (!!merge.failedBrs) {\n hasErrors = true;\n title = `Не удалось сопоставить ${merge.failedBrs.length} ${pluralize(\n merge.failedBrs.length,\n \"студента\",\n \"студентов\",\n \"студентов\"\n )} из БРС`;\n mergeInfoItem.nestedItems?.push({\n title,\n nestedItems: merge.failedBrs.map((s) => ({ title: s })),\n colored: true,\n collapsed: false,\n renderAsText: true,\n });\n }\n\n const marks = report.marks;\n const marksItem: NestedItem = {\n title: \"Выставление баллов\",\n collapsed: true,\n };\n marksItem.nestedItems = marks.map(({ title, students, failed }) => ({\n title: `${title}: ${students?.length ?? 0} ${pluralize(\n students?.length ?? 0,\n \"студент\",\n \"студента\",\n \"студентов\"\n )}`,\n nestedItems: students?.map((s) => ({ title: s })),\n colored: !!failed,\n collapsed: false,\n renderAsText: true,\n }));\n nestedItems.push(marksItem);\n hasErrors =\n hasErrors || marks.filter(({ failed }) => !!failed).length > 0;\n\n const skipped = report.skipped;\n if (skipped.length > 0) {\n const skippedItem: NestedItem = {\n title: \"Неизвестные студенты из БРС\",\n collapsed: true,\n };\n skippedItem.nestedItems = skipped.map(({ title, students }) => ({\n title: `${title}: ${students?.length ?? 0} ${pluralize(\n students?.length ?? 0,\n \"студент\",\n \"студента\",\n \"студентов\"\n )}`,\n nestedItems: students?.map((s) => ({ title: s })),\n collapsed: false,\n renderAsText: true,\n }));\n nestedItems.push(skippedItem);\n }\n\n if (hasErrors) {\n mainItem.colored = true;\n }\n logItems.push(mainItem);\n\n resolve(logItems);\n });\n }\n\n startWork = async () => {\n for (const marksData of this.props.marksDatas) {\n const { spreadsheetData, suitableDisciplines } = marksData;\n\n const error = await this.marksManager.putMarksToBrsAsync(\n spreadsheetData,\n suitableDisciplines\n );\n\n if (error) {\n if (typeof error === \"object\") {\n this.props.onError(error.toString());\n } else if (typeof error === \"string\") {\n this.props.onError(error);\n }\n }\n }\n\n this.setState({\n cancelPending: false,\n okLoading: false,\n });\n };\n\n cancelWork = () => {\n this.setState({ cancelPending: true });\n this.marksManager.cancel();\n };\n\n render() {\n return (\n \n \n \n );\n }\n}\n\nexport interface MarksData {\n spreadsheetData: SpreadsheetData;\n suitableDisciplines: Discipline[];\n}\n\ninterface Props {\n marksDatas: MarksData[];\n brsApi: BrsApi;\n save: boolean;\n onClosed: () => void;\n onError: (errorMessage: string) => void;\n}\n\ninterface State {\n okLoading: boolean;\n cancelPending: boolean;\n logItems: NestedItem[];\n}\n","import { TextField } from \"@material-ui/core\";\nimport SubmitWithLoading from \"../../shared/SubmitWithLoading\";\nimport React, { FormEvent, useState } from \"react\";\nimport { TABLE_URL_PATTERN, TABLE_TEMPLATE_URL } from \"../../../Constants\";\n\nexport default function GoogleTableFetchForm({ loading, onSubmit }: Props) {\n const [tableUrl, setTableUrl] = useState(\"\");\n const [urlError, setUrlError] = useState(null as null | string);\n\n const handleUrlChanged = (event: React.ChangeEvent<{ value: string }>) => {\n const target = event.target;\n if (urlError) setUrlError(null);\n setTableUrl(target.value);\n };\n\n const handleSubmit = (e: FormEvent) => {\n e.preventDefault();\n\n const regExp =\n /d\\/(?[a-zA-Z0-9-_]+)\\/edit(#gid=(?[0-9]+))?/;\n const spreadsheetInfo = tableUrl.match(regExp);\n\n if (!spreadsheetInfo?.groups || !spreadsheetInfo.groups.spreadsheetId) {\n setUrlError(\"Неверный url-адрес.\");\n return null;\n }\n\n const spreadsheetId = spreadsheetInfo.groups.spreadsheetId;\n const maybeSheetId = spreadsheetInfo.groups.sheetId || null;\n\n onSubmit(spreadsheetId, maybeSheetId);\n };\n\n return (\n \n );\n}\n\ninterface Props {\n loading: boolean;\n onSubmit: (spreadsheetId: string, sheetId: string | null) => void;\n}\n","import React from \"react\";\nimport {\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogContentText,\n DialogTitle,\n Slide,\n} from \"@material-ui/core\";\nimport { TransitionProps } from \"@material-ui/core/transitions\";\n\nconst Transition = React.forwardRef(function Transition(\n props: TransitionProps & { children?: React.ReactElement },\n ref: React.Ref\n) {\n return ;\n});\n\nexport default function SessionExpiredAlert({\n open,\n sessionName,\n onOk,\n}: Props) {\n return (\n \n \n \n );\n}\n\ninterface Props {\n open: boolean;\n sessionName: string;\n onOk: () => void;\n}\n","import React from \"react\";\nimport \"./styles.css\";\nimport { CircularProgress } from \"@material-ui/core\";\n\nexport default function LoadingPane() {\n return (\n \n \n
\n );\n}\n","import React from \"react\";\nimport { Button, Container } from \"@material-ui/core\";\nimport GoogleTableFetch from \"../GoogleTableFetch\";\nimport BrsApi from \"../../../apis/BrsApi\";\nimport SessionExpiredAlert from \"../../shared/SessionExpiredAlert\";\nimport CustomAlert from \"../../shared/CustomAlert\";\nimport GoogleAuth from \"../../../apis/GoogleAuth\";\nimport BrsAuth from \"../../../apis/BrsAuth\";\nimport { StatusCode } from \"../../../helpers/CustomError\";\nimport LoadingPane from \"../LoadingPane\";\nimport { Redirect } from \"react-router-dom\";\n\nexport default class WorkPage extends React.Component {\n constructor(props: Props) {\n super(props);\n\n this.state = {\n showControls: false,\n runWork: false,\n openSessionExpiredAlert: false,\n sessionName: \"\",\n errorMessage: \"\",\n loading: true,\n redirect: false,\n };\n }\n\n async componentDidMount() {\n await this.props.googleAuth.ensureInitializedAsync();\n await this.props.brsAuth.tryRestoreAsync();\n\n const brsAuthorized = this.props.brsAuth.checkAuth();\n if (!brsAuthorized) this.handleSessionExpired(\"БРС\");\n\n const googleAuthorized = this.props.googleAuth.checkAuthorized();\n if (!googleAuthorized) {\n setTimeout(() => {\n const googleAuthorized = this.props.googleAuth.checkAuthorized();\n if (!googleAuthorized) this.handleSessionExpired(\"Google\");\n else this.setState({ loading: false });\n }, 1000);\n } else {\n this.setState({ loading: false });\n }\n }\n\n handleError = (error: any) => {\n const errorMessage: string = error.message || JSON.stringify(error);\n if (error.statusCode)\n if (error.statusCode === StatusCode.BrsUnauthorized)\n this.handleSessionExpired(\"БРС\");\n else this.handleSessionExpired(\"Google\");\n else if (error.name === \"RequestError\")\n this.setState({\n errorMessage: \"В данный момент сервер недоступен. Попробуйте позже.\",\n });\n else this.setState({ errorMessage });\n };\n\n handleSessionExpired = (sessionName: SessionName) => {\n this.setState({\n openSessionExpiredAlert: true,\n sessionName,\n loading: false,\n });\n };\n\n handleSessionExpiredOk = () => {\n if (this.state.sessionName === \"БРС\") {\n this.props.brsAuth.logout();\n this.returnToLoginPage();\n this.setState({ redirect: true });\n } else if (this.state.sessionName === \"Google\") {\n this.returnToLoginPage();\n }\n };\n\n closeError = () => {\n this.setState({ errorMessage: \"\" });\n };\n\n returnToLoginPage = () => {\n this.setState({ redirect: true });\n };\n\n render() {\n return (\n \n {this.state.loading && }\n \n {this.state.errorMessage && (\n \n )}\n {this.state.redirect && }\n \n \n \n \n \n
\n \n );\n }\n}\n\ntype SessionName = \"БРС\" | \"Google\";\n\ninterface State {\n showControls: boolean;\n openSessionExpiredAlert: boolean;\n sessionName: SessionName | \"\";\n errorMessage: string;\n runWork: boolean;\n loading: boolean;\n redirect: boolean;\n}\n\ninterface Props {\n brsAuth: BrsAuth;\n brsApi: BrsApi;\n googleAuth: GoogleAuth;\n}\n","import React from \"react\";\nimport Context from \"../../Context\";\nimport WorkPage from \"./WorkPage\";\n\nexport default function WorkPageContainer() {\n return (\n \n {(context) =>\n context && (\n \n )\n }\n \n );\n}\n","import React from \"react\";\nimport { HashRouter, Route, Switch } from \"react-router-dom\";\nimport BrsUrlProvider from \"./apis/BrsUrlProvider\";\nimport BrsAuth from \"./apis/BrsAuth\";\nimport GoogleAuth from \"./apis/GoogleAuth\";\nimport LoginPageContainer from \"./components/login/LoginPageContainer\";\nimport WorkPageContainer from \"./components/work/WorkPageContainer\";\nimport BrsApi from \"./apis/BrsApi\";\nimport Context from \"./Context\";\n\nconst urlProvider = new BrsUrlProvider(true);\nconst brsAuth = new BrsAuth(urlProvider);\nconst brsApi = new BrsApi(brsAuth, urlProvider);\nconst googleAuth = new GoogleAuth();\n\nexport default function App() {\n return (\n \n \n \n \n \n \n \n \n );\n}\n","import { ReportHandler } from \"web-vitals\";\n\nconst reportWebVitals = (onPerfEntry?: ReportHandler) => {\n if (onPerfEntry && onPerfEntry instanceof Function) {\n import(\"web-vitals\").then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {\n getCLS(onPerfEntry);\n getFID(onPerfEntry);\n getFCP(onPerfEntry);\n getLCP(onPerfEntry);\n getTTFB(onPerfEntry);\n });\n }\n};\n\nexport default reportWebVitals;\n","import React from \"react\";\nimport ReactDOM from \"react-dom\";\nimport App from \"./App\";\nimport reportWebVitals from \"./reportWebVitals\";\n\nimport \"./index.css\";\n\nReactDOM.render(, document.getElementById(\"root\"));\n\n// If you want to start measuring performance in your app, pass a function\n// to log results (for example: reportWebVitals(console.log))\n// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals\nreportWebVitals();\n"],"sourceRoot":""}
\ No newline at end of file