@robertying/thu-learn-lib 5.0.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +94 -227
- package/lib/auth.d.ts +15 -4
- package/lib/auth.d.ts.map +1 -1
- package/lib/auth.js +65 -55
- package/lib/auth.js.map +1 -1
- package/lib/calendar.d.ts +12 -5
- package/lib/calendar.d.ts.map +1 -1
- package/lib/calendar.js +118 -20
- package/lib/calendar.js.map +1 -1
- package/lib/contents.d.ts.map +1 -1
- package/lib/contents.js +10 -6
- package/lib/contents.js.map +1 -1
- package/lib/courses.d.ts.map +1 -1
- package/lib/courses.js +15 -29
- package/lib/courses.js.map +1 -1
- package/lib/discussions.d.ts.map +1 -1
- package/lib/discussions.js +8 -19
- package/lib/discussions.js.map +1 -1
- package/lib/favorites.d.ts +1 -0
- package/lib/favorites.d.ts.map +1 -1
- package/lib/favorites.js +25 -60
- package/lib/favorites.js.map +1 -1
- package/lib/files.d.ts +4 -4
- package/lib/files.d.ts.map +1 -1
- package/lib/files.js +112 -134
- package/lib/files.js.map +1 -1
- package/lib/homework.d.ts +35 -5
- package/lib/homework.d.ts.map +1 -1
- package/lib/homework.js +150 -92
- package/lib/homework.js.map +1 -1
- package/lib/index.d.ts +45 -20
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +52 -17
- package/lib/index.js.map +1 -1
- package/lib/notices.d.ts +4 -4
- package/lib/notices.d.ts.map +1 -1
- package/lib/notices.js +13 -33
- package/lib/notices.js.map +1 -1
- package/lib/questionnaires.d.ts +6 -3
- package/lib/questionnaires.d.ts.map +1 -1
- package/lib/questionnaires.js +26 -24
- package/lib/questionnaires.js.map +1 -1
- package/lib/request.d.ts +64 -20
- package/lib/request.d.ts.map +1 -1
- package/lib/request.js +174 -64
- package/lib/request.js.map +1 -1
- package/lib/timetable.d.ts +26 -0
- package/lib/timetable.d.ts.map +1 -0
- package/lib/timetable.js +110 -0
- package/lib/timetable.js.map +1 -0
- package/lib/types.d.ts +117 -76
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js +3 -0
- package/lib/types.js.map +1 -1
- package/lib/urls.d.ts +10 -20
- package/lib/urls.d.ts.map +1 -1
- package/lib/urls.js +11 -56
- package/lib/urls.js.map +1 -1
- package/lib/user.d.ts +7 -2
- package/lib/user.d.ts.map +1 -1
- package/lib/user.js +20 -6
- package/lib/user.js.map +1 -1
- package/lib/utils.d.ts +42 -4
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +80 -29
- package/lib/utils.js.map +1 -1
- package/package.json +9 -8
- package/src/auth.ts +72 -70
- package/src/calendar.ts +136 -24
- package/src/contents.ts +13 -6
- package/src/courses.ts +21 -37
- package/src/discussions.ts +10 -21
- package/src/favorites.ts +44 -80
- package/src/files.ts +124 -142
- package/src/homework.ts +207 -135
- package/src/index.ts +79 -48
- package/src/notices.ts +29 -42
- package/src/questionnaires.ts +62 -45
- package/src/request.ts +192 -69
- package/src/timetable.ts +121 -0
- package/src/types.ts +123 -87
- package/src/urls.ts +13 -64
- package/src/user.ts +22 -7
- package/src/utils.ts +97 -29
package/lib/index.js
CHANGED
|
@@ -9,17 +9,20 @@ import * as homework from './homework.js';
|
|
|
9
9
|
import * as notices from './notices.js';
|
|
10
10
|
import * as questionnaires from './questionnaires.js';
|
|
11
11
|
import { Session } from './request.js';
|
|
12
|
-
import { CourseType } from './types.js';
|
|
12
|
+
import { CourseType, FailReason } from './types.js';
|
|
13
|
+
import { apiError } from './utils.js';
|
|
13
14
|
import * as URLS from './urls.js';
|
|
14
15
|
import * as user from './user.js';
|
|
15
|
-
export { addCSRFTokenToUrl } from './request.js';
|
|
16
|
+
export { addCSRFTokenToUrl, isConnectionError } from './request.js';
|
|
17
|
+
export { checkHomeworkSubmitResponse, homeworkContentHtml } from './homework.js';
|
|
18
|
+
export { CLASS_PERIOD_TIMES, parseCourseMeeting, parseWeeks, semesterWeek } from './timetable.js';
|
|
16
19
|
export * from './types.js';
|
|
17
20
|
/** the main helper class */
|
|
18
21
|
export class Learn2018Helper {
|
|
19
22
|
#session;
|
|
20
23
|
/** you can provide a CookieJar and / or CredentialProvider in the configuration */
|
|
21
24
|
constructor(config) {
|
|
22
|
-
this.#session = new Session(config, () => auth.
|
|
25
|
+
this.#session = new Session(config, () => auth.loginWithProvider(this.#session));
|
|
23
26
|
}
|
|
24
27
|
/** whether preview URLs open the first page only (`HelperConfig.generatePreviewUrlForFirstPage`) */
|
|
25
28
|
get previewFirstPage() {
|
|
@@ -37,20 +40,27 @@ export class Learn2018Helper {
|
|
|
37
40
|
this.#session.csrfToken = csrfToken;
|
|
38
41
|
}
|
|
39
42
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
43
|
+
* Sign in to id.tsinghua.edu.cn and return the Web Learning roaming ticket, without logging in to Web Learning.
|
|
44
|
+
* Rejects with `NO_CREDENTIAL` unless `credential` has a username, a password and a fingerprint. If using
|
|
45
|
+
* alternative cookie management systems, be sure to clear id.tsinghua.edu.cn cookies before calling this function.
|
|
42
46
|
*/
|
|
43
|
-
async getRoamingTicket(
|
|
44
|
-
|
|
47
|
+
async getRoamingTicket(credential) {
|
|
48
|
+
if (!auth.isComplete(credential))
|
|
49
|
+
throw apiError(FailReason.NO_CREDENTIAL);
|
|
50
|
+
return auth.getRoamingTicket(this.#session, credential);
|
|
45
51
|
}
|
|
46
52
|
/**
|
|
47
53
|
* Login is necessary if you do not provide a `CredentialProvider`.
|
|
48
|
-
* Without
|
|
54
|
+
* Without a credential it uses the provider, and concurrent calls share one SSO login; a credential without a
|
|
55
|
+
* username, a password and a fingerprint rejects with `NO_CREDENTIAL`. Logins never overlap: one with a credential
|
|
56
|
+
* waits for a login in progress, and requests that find the session expired meanwhile wait for it.
|
|
49
57
|
*/
|
|
50
|
-
async login(
|
|
51
|
-
if (
|
|
58
|
+
async login(credential) {
|
|
59
|
+
if (credential === undefined)
|
|
52
60
|
return this.#session.relogin();
|
|
53
|
-
|
|
61
|
+
if (!auth.isComplete(credential))
|
|
62
|
+
throw apiError(FailReason.NO_CREDENTIAL);
|
|
63
|
+
return this.#session.runLogin(() => auth.login(this.#session, credential));
|
|
54
64
|
}
|
|
55
65
|
/**
|
|
56
66
|
* Make sure the session is usable without a full SSO login when possible: with a CSRF token (from an earlier login
|
|
@@ -58,7 +68,7 @@ export class Learn2018Helper {
|
|
|
58
68
|
* Use it when resuming an app instead of `login()`.
|
|
59
69
|
*/
|
|
60
70
|
async ensureSession() {
|
|
61
|
-
return this.#session.ensureSession(URLS.LEARN_CURRENT_SEMESTER
|
|
71
|
+
return this.#session.ensureSession(URLS.LEARN_CURRENT_SEMESTER);
|
|
62
72
|
}
|
|
63
73
|
/** logout (to make everyone happy) */
|
|
64
74
|
async logout() {
|
|
@@ -70,8 +80,11 @@ export class Learn2018Helper {
|
|
|
70
80
|
}
|
|
71
81
|
/**
|
|
72
82
|
* Get calendar items during the specified period (in yyyymmdd format, both inclusive).
|
|
73
|
-
* Ranges longer than 28 days are fetched in windows and merged; windows that fail
|
|
74
|
-
*
|
|
83
|
+
* Ranges longer than 28 days are fetched in windows and merged; windows that still fail are listed in `failedRanges`
|
|
84
|
+
* (a timed-out window is not retried). Rejects when every window fails (usually with `FailReason.INVALID_RESPONSE`),
|
|
85
|
+
* with `FailReason.ERROR_REGISTRAR_AUTH` when signing in to the registrar fails, or with a `RangeError` for a date
|
|
86
|
+
* that is not a valid yyyymmdd. With a `CredentialProvider`, a sign-in that id.tsinghua.edu.cn turns down (its session
|
|
87
|
+
* from the last login expired) logs in again and is tried once more.
|
|
75
88
|
*/
|
|
76
89
|
async getCalendar(startDate, endDate, options) {
|
|
77
90
|
return calendar.getCalendar(this.#session, startDate, endDate, options);
|
|
@@ -84,7 +97,8 @@ export class Learn2018Helper {
|
|
|
84
97
|
}
|
|
85
98
|
/**
|
|
86
99
|
* Get all courses in the specified semester.
|
|
87
|
-
* `timeAndLocation` is only fetched (one request per course) with `options.timeAndLocation
|
|
100
|
+
* `timeAndLocation` is only fetched (one request per course) with `options.timeAndLocation`, and left out for a
|
|
101
|
+
* course whose request failed.
|
|
88
102
|
*/
|
|
89
103
|
async getCourseList(semesterID, courseType = CourseType.STUDENT, lang = this.#session.lang, options) {
|
|
90
104
|
return courses.getCourseList(this.#session, semesterID, courseType, lang, options);
|
|
@@ -154,9 +168,15 @@ export class Learn2018Helper {
|
|
|
154
168
|
}
|
|
155
169
|
/**
|
|
156
170
|
* Get all questionnaires (课程问卷/QNR) of the specified course.
|
|
171
|
+
* Questions (`detail`, one request per questionnaire) for the questionnaires `options.details` selects, by default
|
|
172
|
+
* all; use `getQuestionnaireDetail` for the others.
|
|
157
173
|
*/
|
|
158
|
-
async getQuestionnaireList(courseID) {
|
|
159
|
-
return questionnaires.getQuestionnaireList(this.#session, courseID);
|
|
174
|
+
async getQuestionnaireList(courseID, options) {
|
|
175
|
+
return questionnaires.getQuestionnaireList(this.#session, courseID, options);
|
|
176
|
+
}
|
|
177
|
+
/** Get the questions of one questionnaire (one request). */
|
|
178
|
+
async getQuestionnaireDetail(courseID, questionnaireID) {
|
|
179
|
+
return questionnaires.getQuestionnaireDetail(this.#session, courseID, questionnaireID);
|
|
160
180
|
}
|
|
161
181
|
/**
|
|
162
182
|
* Add an item to favorites. (收藏)
|
|
@@ -206,9 +226,24 @@ export class Learn2018Helper {
|
|
|
206
226
|
async sortCourses(courseIDs) {
|
|
207
227
|
return courses.sortCourses(this.#session, courseIDs);
|
|
208
228
|
}
|
|
229
|
+
/**
|
|
230
|
+
* Submit homework `id` (the `studentHomeworkId`), the way the website's submit page does. `content` is the whole
|
|
231
|
+
* answer as HTML (the website sends its editor's HTML) and replaces the submitted one, so pass the current answer
|
|
232
|
+
* when only changing the attachment (`homeworkContentHtml` turns plain text into the editor's HTML). With no
|
|
233
|
+
* `attachment` the existing one is kept, unless `removeAttachment`: that only deletes the attachment, and `content` is
|
|
234
|
+
* ignored. In React Native, pass the attachment's `content` as `{ uri, type }`.
|
|
235
|
+
*/
|
|
209
236
|
async submitHomework(id, content = '', attachment, removeAttachment = false) {
|
|
210
237
|
return homework.submitHomework(this.#session, id, content, attachment, removeAttachment);
|
|
211
238
|
}
|
|
239
|
+
/**
|
|
240
|
+
* The request `submitHomework` would send, for sending with another HTTP client (e.g. to show upload progress, which
|
|
241
|
+
* `fetch` can't): POST `body` to `url`, then pass the answer (parsed JSON or text) to `checkHomeworkSubmitResponse`.
|
|
242
|
+
* It checks the session first (`ensureSession`), since that request doesn't log in again and retry.
|
|
243
|
+
*/
|
|
244
|
+
async getHomeworkSubmitRequest(id, content = '', attachment, removeAttachment = false) {
|
|
245
|
+
return homework.getHomeworkSubmitRequest(this.#session, id, content, attachment, removeAttachment);
|
|
246
|
+
}
|
|
212
247
|
async setLanguage(lang) {
|
|
213
248
|
return user.setLanguage(this.#session, lang);
|
|
214
249
|
}
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,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AAO,GAAG,EAAE,EACZ,UAAqC,EACrC,gBAAgB,GAAG,KAAK;QAExB,OAAO,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,gBAAgB,CAAC,CAAC;IAC3F,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,wBAAwB,CACnC,EAAU,EACV,OAAO,GAAG,EAAE,EACZ,UAAqC,EACrC,gBAAgB,GAAG,KAAK;QAExB,OAAO,QAAQ,CAAC,wBAAwB,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,gBAAgB,CAAC,CAAC;IACrG,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,IAAc;QACrC,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC/C,CAAC;IAEM,kBAAkB;QACvB,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC5B,CAAC;CACF"}
|
package/lib/notices.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { Session } from './request.ts';
|
|
2
|
-
import type {
|
|
2
|
+
import type { CourseNotification, CourseNotificationBase, NotificationListOptions, RemoteFile } from './types.ts';
|
|
3
3
|
import { CourseType } from './types.ts';
|
|
4
4
|
/**
|
|
5
5
|
* Get all notifications (课程公告) of the specified course: current and expired lists.
|
|
6
6
|
* Attachments only for the notices `options.attachments` selects.
|
|
7
7
|
*/
|
|
8
|
-
export declare function getNotificationList(s: Session, courseID: string, courseType?: CourseType, options?: NotificationListOptions): Promise<
|
|
8
|
+
export declare function getNotificationList(s: Session, courseID: string, courseType?: CourseType, options?: NotificationListOptions): Promise<CourseNotification[]>;
|
|
9
9
|
/**
|
|
10
10
|
* Get the attachment of a notice from its detail page (1 request), or `undefined` without a request if
|
|
11
|
-
* `attachmentName` says it has none.
|
|
11
|
+
* `attachmentName` says it has none, or if the page has no attachment link.
|
|
12
12
|
*/
|
|
13
|
-
export declare function getNotificationAttachment(s: Session, notification: Pick<
|
|
13
|
+
export declare function getNotificationAttachment(s: Session, notification: Pick<CourseNotificationBase, 'url' | 'attachmentName'>, courseType?: CourseType): Promise<RemoteFile | undefined>;
|
|
14
14
|
//# sourceMappingURL=notices.d.ts.map
|
package/lib/notices.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notices.d.ts","sourceRoot":"","sources":["../src/notices.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"notices.d.ts","sourceRoot":"","sources":["../src/notices.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAClH,OAAO,EAAe,UAAU,EAAc,MAAM,YAAY,CAAC;AAajE;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,CAAC,EAAE,OAAO,EACV,QAAQ,EAAE,MAAM,EAChB,UAAU,GAAE,UAA+B,EAC3C,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAW/B;AAmCD;;;GAGG;AACH,wBAAsB,yBAAyB,CAC7C,CAAC,EAAE,OAAO,EACV,YAAY,EAAE,IAAI,CAAC,sBAAsB,EAAE,KAAK,GAAG,gBAAgB,CAAC,EACpE,UAAU,GAAE,UAA+B,GAC1C,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAmBjC"}
|
package/lib/notices.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// Course notifications (课程公告).
|
|
2
2
|
import { Base64 } from 'js-base64';
|
|
3
|
-
import { $, YES } from './request.js';
|
|
4
3
|
import { ContentType, CourseType, FailReason } from './types.js';
|
|
5
4
|
import * as URLS from './urls.js';
|
|
6
|
-
import { decodeHTML, isSelected, trimAndDefine } from './utils.js';
|
|
5
|
+
import { $, YES, decodeHTML, expectSuccess, isSelected, toRequiredServerTime, toServerTime, trimAndDefine, } from './utils.js';
|
|
7
6
|
/**
|
|
8
7
|
* Get all notifications (课程公告) of the specified course: current and expired lists.
|
|
9
8
|
* Attachments only for the notices `options.attachments` selects.
|
|
@@ -20,16 +19,11 @@ export async function getNotificationList(s, courseID, courseType = CourseType.S
|
|
|
20
19
|
}));
|
|
21
20
|
}
|
|
22
21
|
async function getNotificationListKind(s, courseID, courseType, expired) {
|
|
23
|
-
const json = await
|
|
22
|
+
const json = await s.fetchJsonWithToken(URLS.LEARN_NOTIFICATION_LIST(courseType, expired), {
|
|
24
23
|
method: 'POST',
|
|
25
24
|
body: URLS.LEARN_PAGE_LIST_FORM_DATA(courseID),
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
return Promise.reject({
|
|
29
|
-
reason: FailReason.INVALID_RESPONSE,
|
|
30
|
-
extra: json,
|
|
31
|
-
});
|
|
32
|
-
}
|
|
25
|
+
});
|
|
26
|
+
expectSuccess(json, FailReason.INVALID_RESPONSE);
|
|
33
27
|
const result = (json.object?.aaData ?? json.object?.resultsList ?? []);
|
|
34
28
|
return result.map((n) => {
|
|
35
29
|
const attachmentName = courseType === CourseType.STUDENT ? n.fjmc : n.fjbt;
|
|
@@ -41,8 +35,8 @@ async function getNotificationListKind(s, courseID, courseType, expired) {
|
|
|
41
35
|
publisher: n.fbrxm,
|
|
42
36
|
hasRead: n.sfyd === YES,
|
|
43
37
|
markedImportant: Number(n.sfqd) === 1, // n.sfqd could be string '1' (teacher mode) or number 1 (student mode)
|
|
44
|
-
publishTime: n.fbsj && typeof n.fbsj === 'string' ? n.fbsj : n.fbsjStr,
|
|
45
|
-
expireTime: n.jzsj
|
|
38
|
+
publishTime: toRequiredServerTime(n.fbsj && typeof n.fbsj === 'string' ? n.fbsj : n.fbsjStr),
|
|
39
|
+
expireTime: toServerTime(n.jzsj),
|
|
46
40
|
isFavorite: n.sfsc === YES,
|
|
47
41
|
comment: n.bznr ?? undefined,
|
|
48
42
|
attachmentName: typeof attachmentName === 'string' && attachmentName ? attachmentName : undefined,
|
|
@@ -51,31 +45,17 @@ async function getNotificationListKind(s, courseID, courseType, expired) {
|
|
|
51
45
|
}
|
|
52
46
|
/**
|
|
53
47
|
* Get the attachment of a notice from its detail page (1 request), or `undefined` without a request if
|
|
54
|
-
* `attachmentName` says it has none.
|
|
48
|
+
* `attachmentName` says it has none, or if the page has no attachment link.
|
|
55
49
|
*/
|
|
56
50
|
export async function getNotificationAttachment(s, notification, courseType = CourseType.STUDENT) {
|
|
57
51
|
if (!notification.attachmentName)
|
|
58
52
|
return undefined;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
// 'body': postParams,
|
|
66
|
-
// })).json();
|
|
67
|
-
// const attachmentId = metadata.ggfjid as string;
|
|
68
|
-
/// parsed from HTML
|
|
69
|
-
const response = await s.fetchWithToken(notification.url);
|
|
70
|
-
const result = $(await response.text());
|
|
71
|
-
let path = '';
|
|
72
|
-
if (courseType === CourseType.STUDENT) {
|
|
73
|
-
path = result('.ml-10').attr('href');
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
path = result('#wjid').attr('href');
|
|
77
|
-
}
|
|
78
|
-
const size = trimAndDefine(result('div#attachment > div.fl > span[class^="color"]').first().text());
|
|
53
|
+
const result = $(await s.fetchTextWithToken(notification.url));
|
|
54
|
+
let path = (courseType === CourseType.STUDENT ? result('.ml-10') : result('#wjid')).attr('href');
|
|
55
|
+
// the page has no attachment link (removed since the list was fetched, or the page changed)
|
|
56
|
+
if (!path)
|
|
57
|
+
return undefined;
|
|
58
|
+
const size = trimAndDefine(result('div#attachment > div.fl > span[class^="color"]').first().text()) ?? '';
|
|
79
59
|
const params = new URLSearchParams(path.split('?').slice(-1)[0]);
|
|
80
60
|
const attachmentId = params.get('wjid');
|
|
81
61
|
if (!path.startsWith(URLS.LEARN_PREFIX)) {
|
package/lib/notices.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notices.js","sourceRoot":"","sources":["../src/notices.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAE/B,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"notices.js","sourceRoot":"","sources":["../src/notices.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAE/B,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAInC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EACL,CAAC,EACD,GAAG,EACH,UAAU,EACV,aAAa,EACb,UAAU,EACV,oBAAoB,EACpB,YAAY,EACZ,aAAa,GACd,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,CAAU,EACV,QAAgB,EAChB,UAAU,GAAe,UAAU,CAAC,OAAO,EAC3C,OAAO,GAA4B,EAAE;IAErC,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC9B,uBAAuB,CAAC,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,CAAC;QACvD,uBAAuB,CAAC,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,CAAC;KACvD,CAAC,CAAC;IACH,OAAO,OAAO,CAAC,GAAG,CAChB,KAAK,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,EAA+B,EAAE;QACxD,IAAI,CAAC,CAAC,CAAC,cAAc,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;YAAE,OAAO,CAAC,CAAC;QAC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CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACjE,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAE,CAAC;IACzC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;QACxC,IAAI,GAAG,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;IAClC,CAAC;IACD,OAAO;QACL,IAAI,EAAE,YAAY,CAAC,cAAc;QACjC,EAAE,EAAE,YAAY;QAChB,WAAW,EAAE,IAAI;QACjB,UAAU,EAAE,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC,CAAC,gBAAgB,CAAC;QAC3G,IAAI;KACL,CAAC;AACJ,CAAC"}
|
package/lib/questionnaires.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { Session } from './request.ts';
|
|
2
|
-
import type { Questionnaire } from './types.ts';
|
|
2
|
+
import type { Questionnaire, QuestionnaireDetail, QuestionnaireListOptions } from './types.ts';
|
|
3
3
|
/**
|
|
4
|
-
* Get all questionnaires (课程问卷/QNR) of the specified course.
|
|
4
|
+
* Get all questionnaires (课程问卷/QNR) of the specified course: ongoing and ended lists.
|
|
5
|
+
* Questions (`detail`, 1 request each) only for the questionnaires `options.details` selects (default `'all'`).
|
|
5
6
|
*/
|
|
6
|
-
export declare function getQuestionnaireList(s: Session, courseID: string): Promise<Questionnaire[]>;
|
|
7
|
+
export declare function getQuestionnaireList(s: Session, courseID: string, options?: QuestionnaireListOptions): Promise<Questionnaire[]>;
|
|
8
|
+
/** Get the questions of one questionnaire (1 request). */
|
|
9
|
+
export declare function getQuestionnaireDetail(s: Session, courseID: string, qnrID: string): Promise<QuestionnaireDetail[]>;
|
|
7
10
|
//# sourceMappingURL=questionnaires.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"questionnaires.d.ts","sourceRoot":"","sources":["../src/questionnaires.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"questionnaires.d.ts","sourceRoot":"","sources":["../src/questionnaires.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAc/F;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,CAAC,EAAE,OAAO,EACV,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,aAAa,EAAE,CAAC,CAa1B;AAyBD,0DAA0D;AAC1D,wBAAsB,sBAAsB,CAC1C,CAAC,EAAE,OAAO,EACV,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAwBhC"}
|
package/lib/questionnaires.js
CHANGED
|
@@ -1,57 +1,59 @@
|
|
|
1
1
|
// Questionnaires (课程问卷).
|
|
2
|
-
import { YES } from './request.js';
|
|
3
2
|
import { FailReason, QuestionnaireType } from './types.js';
|
|
4
3
|
import * as URLS from './urls.js';
|
|
5
|
-
import { QNR_TYPE_MAP, decodeHTML } from './utils.js';
|
|
4
|
+
import { QNR_TYPE_MAP, YES, apiError, decodeHTML, expectSuccess, isSelected, toRequiredServerTime, toServerTime, } from './utils.js';
|
|
6
5
|
/**
|
|
7
|
-
* Get all questionnaires (课程问卷/QNR) of the specified course.
|
|
6
|
+
* Get all questionnaires (课程问卷/QNR) of the specified course: ongoing and ended lists.
|
|
7
|
+
* Questions (`detail`, 1 request each) only for the questionnaires `options.details` selects (default `'all'`).
|
|
8
8
|
*/
|
|
9
|
-
export async function getQuestionnaireList(s, courseID) {
|
|
10
|
-
|
|
9
|
+
export async function getQuestionnaireList(s, courseID, options = {}) {
|
|
10
|
+
const details = options.details ?? 'all';
|
|
11
|
+
const lists = await Promise.all([
|
|
11
12
|
getQuestionnaireListAtUrl(s, courseID, URLS.LEARN_QNR_LIST_ONGOING),
|
|
12
13
|
getQuestionnaireListAtUrl(s, courseID, URLS.LEARN_QNR_LIST_ENDED),
|
|
13
|
-
])
|
|
14
|
+
]);
|
|
15
|
+
return Promise.all(lists
|
|
16
|
+
.flat()
|
|
17
|
+
.map(async (q) => isSelected(details, q) ? { ...q, detail: await getQuestionnaireDetail(s, courseID, q.id) } : q));
|
|
14
18
|
}
|
|
15
19
|
async function getQuestionnaireListAtUrl(s, courseID, url) {
|
|
16
|
-
const json = await
|
|
17
|
-
|
|
18
|
-
return Promise.reject({
|
|
19
|
-
reason: FailReason.INVALID_RESPONSE,
|
|
20
|
-
extra: json,
|
|
21
|
-
});
|
|
22
|
-
}
|
|
20
|
+
const json = await s.fetchJsonWithToken(url, { method: 'POST', body: URLS.LEARN_PAGE_LIST_FORM_DATA(courseID) });
|
|
21
|
+
expectSuccess(json, FailReason.INVALID_RESPONSE);
|
|
23
22
|
const result = (json.object?.aaData ?? []);
|
|
24
|
-
return
|
|
23
|
+
return result.map((e) => {
|
|
25
24
|
const type = QNR_TYPE_MAP.get(e.wjlx) ?? QuestionnaireType.SURVEY;
|
|
26
25
|
return {
|
|
27
26
|
id: e.wjid,
|
|
28
27
|
type,
|
|
29
28
|
title: decodeHTML(e.wjbt),
|
|
30
|
-
startTime: e.kssj,
|
|
31
|
-
endTime: e.jssj,
|
|
32
|
-
uploadTime: e.scsj,
|
|
29
|
+
startTime: toRequiredServerTime(e.kssj),
|
|
30
|
+
endTime: toRequiredServerTime(e.jssj),
|
|
31
|
+
uploadTime: toRequiredServerTime(e.scsj),
|
|
33
32
|
uploaderId: e.scr,
|
|
34
33
|
uploaderName: e.scrxm,
|
|
35
|
-
submitTime: e.tjsj
|
|
34
|
+
submitTime: toServerTime(e.tjsj),
|
|
36
35
|
isFavorite: e.sfsc === YES,
|
|
37
36
|
comment: e.bznr ?? undefined,
|
|
38
37
|
url: URLS.LEARN_QNR_SUBMIT_PAGE(e.wlkcid, e.wjid, type),
|
|
39
|
-
detail: await getQuestionnaireDetail(s, courseID, e.wjid),
|
|
40
38
|
};
|
|
41
|
-
})
|
|
39
|
+
});
|
|
42
40
|
}
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
/** Get the questions of one questionnaire (1 request). */
|
|
42
|
+
export async function getQuestionnaireDetail(s, courseID, qnrID) {
|
|
43
|
+
const json = await s.fetchJsonWithToken(URLS.LEARN_QNR_DETAIL, {
|
|
45
44
|
method: 'POST',
|
|
46
45
|
body: URLS.LEARN_QNR_DETAIL_FORM(courseID, qnrID),
|
|
47
|
-
})
|
|
46
|
+
});
|
|
47
|
+
if (!Array.isArray(json)) {
|
|
48
|
+
throw apiError(FailReason.INVALID_RESPONSE, json);
|
|
49
|
+
}
|
|
48
50
|
return json.map((e) => ({
|
|
49
51
|
id: e.wtid,
|
|
50
52
|
index: Number(e.wtbh),
|
|
51
53
|
type: e.type,
|
|
52
54
|
required: e.require === YES,
|
|
53
55
|
title: decodeHTML(e.wtbt),
|
|
54
|
-
score: e.wtfz ? Number(e.wtfz) : undefined, //
|
|
56
|
+
score: e.wtfz ? Number(e.wtfz) : undefined, // a number or a string of digits; none when missing or 0
|
|
55
57
|
options: e.list?.map((o) => ({
|
|
56
58
|
id: o.xxid,
|
|
57
59
|
index: Number(o.xxbh),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"questionnaires.js","sourceRoot":"","sources":["../src/questionnaires.ts"],"names":[],"mappings":"AAAA,yBAAyB;
|
|
1
|
+
{"version":3,"file":"questionnaires.js","sourceRoot":"","sources":["../src/questionnaires.ts"],"names":[],"mappings":"AAAA,yBAAyB;AAIzB,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,KAAK,IAAI,MAAM,WAA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CAAC;IACpD,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,CACb,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC;QACC,EAAE,EAAE,CAAC,CAAC,IAAI;QACV,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;QACrB,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,QAAQ,EAAE,CAAC,CAAC,OAAO,KAAK,GAAG;QAC3B,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;QACzB,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,yDAAyD;QACrG,OAAO,EAAG,CAAC,CAAC,IAAc,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACtC,EAAE,EAAE,CAAC,CAAC,IAAI;YACV,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;YACrB,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;SAC1B,CAAC,CAAC;KACJ,CAA+B,CACnC,CAAC;AACJ,CAAC"}
|
package/lib/request.d.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import * as cheerio from 'cheerio';
|
|
2
|
-
import type { Element } from 'cheerio';
|
|
3
1
|
import { CookieJar } from 'tough-cookie';
|
|
4
2
|
import type { CredentialProvider, Fetch, HelperConfig } from './types.ts';
|
|
5
3
|
import { Language } from './types.ts';
|
|
6
|
-
export declare const $: (html: string | Element | Element[]) => cheerio.CheerioAPI;
|
|
7
4
|
export declare const noLogin: (res: Response) => boolean;
|
|
8
|
-
export declare const YES = "\u662F";
|
|
9
5
|
/** default for `HelperConfig.maxConcurrentRequests` */
|
|
10
6
|
export declare const DEFAULT_MAX_CONCURRENT_REQUESTS = 6;
|
|
11
7
|
/** default for `HelperConfig.requestTimeout`, in milliseconds */
|
|
@@ -16,41 +12,89 @@ export declare const addCSRFTokenToUrl: (url: string, token: string) => string;
|
|
|
16
12
|
* Let at most `max` calls of `inner` run at once; the rest wait in FIFO order. A slot is freed when the response
|
|
17
13
|
* headers arrive (or the call fails), so reading a body does not hold one.
|
|
18
14
|
*/
|
|
19
|
-
export declare function limitConcurrency(inner:
|
|
15
|
+
export declare function limitConcurrency<F extends (...args: any[]) => Promise<Response>>(inner: F, max: number): F;
|
|
16
|
+
/** `RequestInit` plus a per-request `timeout` (milliseconds; 0 or `Infinity` for none) */
|
|
17
|
+
export type RequestOptions = RequestInit & {
|
|
18
|
+
timeout?: number;
|
|
19
|
+
};
|
|
20
|
+
/** a `Fetch` whose `init` can also carry a per-request `timeout` */
|
|
21
|
+
export type TimedFetch = (input: Parameters<Fetch>[0], init?: RequestOptions) => Promise<Response>;
|
|
20
22
|
/**
|
|
21
|
-
* Abort a call of `inner` that has no response headers after `ms` milliseconds
|
|
22
|
-
* `FailReason.REQUEST_TIMEOUT`. A caller's own `signal` still works
|
|
23
|
-
* which React Native has (unlike
|
|
23
|
+
* Abort a call of `inner` that has no response headers after `ms` milliseconds (or `init.timeout`, which overrides it
|
|
24
|
+
* for one request) and reject it with `FailReason.REQUEST_TIMEOUT`. A caller's own `signal` still works, also while
|
|
25
|
+
* the body is read. Uses only `AbortController` and `setTimeout`, which React Native has (unlike
|
|
26
|
+
* `AbortSignal.timeout` / `AbortSignal.any`). Note that React Native's fetch resolves only after the whole body has
|
|
27
|
+
* arrived, so there the timeout covers the download too.
|
|
24
28
|
*/
|
|
25
|
-
export declare function withTimeout(inner: Fetch, ms: number):
|
|
29
|
+
export declare function withTimeout(inner: Fetch, ms: number): TimedFetch;
|
|
30
|
+
/**
|
|
31
|
+
* Reject a call of `inner` that fails without any response (the fetch implementation's own error: `TypeError: fetch
|
|
32
|
+
* failed` in Node, `Network request failed` in React Native) with `FailReason.NETWORK_ERROR`, keeping the error in
|
|
33
|
+
* `extra`. An `ApiError` (such as `REQUEST_TIMEOUT`) and the caller's own abort pass through unchanged.
|
|
34
|
+
*/
|
|
35
|
+
export declare function withNetworkError(inner: TimedFetch): TimedFetch;
|
|
36
|
+
/** whether an error means the server was not reached: `NETWORK_ERROR`, or `REQUEST_TIMEOUT` (no answer in time) */
|
|
37
|
+
export declare const isConnectionError: (err: unknown) => boolean;
|
|
38
|
+
/** free the connection of a response we won't read */
|
|
39
|
+
export declare const discard: (res: Response) => void;
|
|
26
40
|
/**
|
|
27
41
|
* State shared by every request a `Learn2018Helper` makes: cookies, CSRF token, language and the fetch wrappers.
|
|
28
42
|
* Internal; the helper keeps it in a private field.
|
|
29
43
|
*/
|
|
30
44
|
export declare class Session {
|
|
31
45
|
#private;
|
|
32
|
-
readonly
|
|
46
|
+
readonly loginWithProvider: () => Promise<void>;
|
|
33
47
|
readonly provider?: CredentialProvider;
|
|
34
48
|
readonly cookieJar: CookieJar;
|
|
35
49
|
/** fetch with cookies, the concurrency cap and the timeout, but no login check */
|
|
36
|
-
readonly rawFetch:
|
|
50
|
+
readonly rawFetch: TimedFetch;
|
|
37
51
|
lang: Language;
|
|
38
52
|
previewFirstPage: boolean;
|
|
39
|
-
/**
|
|
40
|
-
|
|
53
|
+
/**
|
|
54
|
+
* The device fingerprints of the last SSO login. id.tsinghua.edu.cn asks for them again when another site (WebVPN,
|
|
55
|
+
* for the registrar) signs in with the same id.tsinghua.edu.cn session.
|
|
56
|
+
*/
|
|
57
|
+
fingerprints?: {
|
|
58
|
+
fingerPrint: string;
|
|
59
|
+
fingerGenPrint: string;
|
|
60
|
+
fingerGenPrint3: string;
|
|
61
|
+
};
|
|
62
|
+
/** `loginWithProvider` signs in through SSO with the `CredentialProvider` */
|
|
63
|
+
constructor(config: HelperConfig | undefined, loginWithProvider: () => Promise<void>);
|
|
41
64
|
get csrfToken(): string;
|
|
42
65
|
set csrfToken(token: string);
|
|
43
66
|
/**
|
|
44
|
-
*
|
|
67
|
+
* Run one login (`login`) at a time. It starts after a login already in progress has settled, and requests that
|
|
68
|
+
* find the session expired meanwhile wait for it instead of starting their own (two SSO logins at once reset each
|
|
69
|
+
* other's id.tsinghua.edu.cn cookie).
|
|
70
|
+
*/
|
|
71
|
+
runLogin(login: () => Promise<void>): Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Log in with the `CredentialProvider`, or wait for the login already in progress (also one with explicit
|
|
74
|
+
* credentials) instead of starting another. Called by `login()`, so it tries again after a `BAD_CREDENTIAL`.
|
|
45
75
|
*/
|
|
46
76
|
relogin(): Promise<void>;
|
|
47
|
-
/** fetch with a login check (see `#send`) */
|
|
48
|
-
readonly fetch: Fetch;
|
|
49
|
-
/** like `fetch`, but logs in first if there is no CSRF token yet and adds the current token to the URL */
|
|
50
|
-
readonly fetchWithToken: Fetch;
|
|
51
77
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
78
|
+
* `relogin` for a login nobody asked for (an expired session, no CSRF token yet, the registrar wanting a new
|
|
79
|
+
* id.tsinghua.edu.cn session), unless the last provider login was turned down with `BAD_CREDENTIAL`: then reject with
|
|
80
|
+
* that again
|
|
81
|
+
*/
|
|
82
|
+
autoRelogin(): Promise<void>;
|
|
83
|
+
/** fetch with a login check (see `#send`); logs in first if there is no CSRF token yet and adds it to the URL */
|
|
84
|
+
readonly fetchWithToken: TimedFetch;
|
|
85
|
+
/**
|
|
86
|
+
* Like `fetchWithToken`, but returns the parsed JSON body. The short login page with status 200 instead of JSON
|
|
87
|
+
* counts as an expired session (log in again and retry once, as for a 403); any other page is `INVALID_RESPONSE`.
|
|
88
|
+
*/
|
|
89
|
+
readonly fetchJsonWithToken: (input: Parameters<Fetch>[0], init?: RequestOptions) => Promise<any>;
|
|
90
|
+
/**
|
|
91
|
+
* Like `fetchWithToken`, but returns the text body (an HTML page). A short login or redirect page with status 200
|
|
92
|
+
* counts as an expired session (log in again and retry once, as for a 403).
|
|
93
|
+
*/
|
|
94
|
+
readonly fetchTextWithToken: (input: Parameters<Fetch>[0], init?: RequestOptions) => Promise<string>;
|
|
95
|
+
/**
|
|
96
|
+
* Make sure the session works: if there is a CSRF token, fetch the current semester (`probeUrl`) and log in only if
|
|
97
|
+
* the session has expired; otherwise log in.
|
|
54
98
|
*/
|
|
55
99
|
ensureSession(probeUrl: string): Promise<void>;
|
|
56
100
|
}
|
package/lib/request.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,KAAK,EAAY,kBAAkB,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACpF,OAAO,EAAc,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGlD,eAAO,MAAM,OAAO,QAAS,QAAQ,YAA4D,CAAC;AAElG,uDAAuD;AACvD,eAAO,MAAM,+BAA+B,IAAI,CAAC;AACjD,iEAAiE;AACjE,eAAO,MAAM,uBAAuB,QAAS,CAAC;AAE9C,sDAAsD;AACtD,eAAO,MAAM,iBAAiB,QAAS,MAAM,SAAS,MAAM,KAAG,MAI9D,CAAC;AAMF;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,CAyB1G;AAED,0FAA0F;AAC1F,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhE,oEAAoE;AACpE,MAAM,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,cAAc,KAAK,OAAO,CAAC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