@vestcards/shared 1.3.0 → 1.4.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/dist/date-Bn1ahM0R.cjs +1 -0
- package/dist/date-D5P-dKAx.js +134 -0
- package/dist/date.cjs +1 -1
- package/dist/date.d.ts +35 -0
- package/dist/date.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +31 -0
- package/dist/index.js +59 -52
- package/dist/spaced-repetition.cjs +1 -1
- package/dist/spaced-repetition.d.ts +25 -4
- package/dist/spaced-repetition.js +243 -222
- package/package.json +1 -1
- package/dist/date-DS8JYZte.js +0 -103
- package/dist/date-DoLsSDIb.cjs +0 -1
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
import { t as e } from "./date-
|
|
1
|
+
import { t as e } from "./date-D5P-dKAx.js";
|
|
2
2
|
import { i as t, n, r } from "./fsrs-D2XsH28s.js";
|
|
3
3
|
//#region src/spaced-repetition/config.ts
|
|
4
|
-
var i = .9, a =
|
|
4
|
+
var i = .9, a = .1542, o = i ** (-1 / a) - 1, s = 50, c = {
|
|
5
|
+
learnDailyLimit: {
|
|
6
|
+
recommended: 200,
|
|
7
|
+
min: 100,
|
|
8
|
+
max: 500,
|
|
9
|
+
step: 50
|
|
10
|
+
},
|
|
11
|
+
newCardsPerDeckDailyLimit: {
|
|
12
|
+
recommended: 10,
|
|
13
|
+
min: 1,
|
|
14
|
+
max: 50,
|
|
15
|
+
step: 5
|
|
16
|
+
}
|
|
17
|
+
}, l = 10, u = (e, t) => e === c.learnDailyLimit.recommended && t === c.newCardsPerDeckDailyLimit.recommended, d = ((e) => (e[e.New = 0] = "New", e[e.Learning = 1] = "Learning", e[e.Review = 2] = "Review", e[e.Relearning = 3] = "Relearning", e))(d || {}), f = ((e) => (e[e.Manual = 0] = "Manual", e[e.Again = 1] = "Again", e[e.Hard = 2] = "Hard", e[e.Good = 3] = "Good", e[e.Easy = 4] = "Easy", e))(f || {}), p = class e {
|
|
5
18
|
static card(t) {
|
|
6
19
|
return {
|
|
7
20
|
...t,
|
|
@@ -12,7 +25,7 @@ var i = .9, a = 50, o = 200, s = 10, c = 10, l = ((e) => (e[e.New = 0] = "New",
|
|
|
12
25
|
}
|
|
13
26
|
static rating(e) {
|
|
14
27
|
if (typeof e == "string") {
|
|
15
|
-
let t =
|
|
28
|
+
let t = f[`${e.charAt(0).toUpperCase()}${e.slice(1).toLowerCase()}`];
|
|
16
29
|
if (t === void 0) throw Error(`Invalid rating:[${e}]`);
|
|
17
30
|
return t;
|
|
18
31
|
} else if (typeof e == "number") return e;
|
|
@@ -20,7 +33,7 @@ var i = .9, a = 50, o = 200, s = 10, c = 10, l = ((e) => (e[e.New = 0] = "New",
|
|
|
20
33
|
}
|
|
21
34
|
static state(e) {
|
|
22
35
|
if (typeof e == "string") {
|
|
23
|
-
let t =
|
|
36
|
+
let t = d[`${e.charAt(0).toUpperCase()}${e.slice(1).toLowerCase()}`];
|
|
24
37
|
if (t === void 0) throw Error(`Invalid state:[${e}]`);
|
|
25
38
|
return t;
|
|
26
39
|
} else if (typeof e == "number") return e;
|
|
@@ -44,22 +57,22 @@ var i = .9, a = 50, o = 200, s = 10, c = 10, l = ((e) => (e[e.New = 0] = "New",
|
|
|
44
57
|
review: e.time(t.review)
|
|
45
58
|
};
|
|
46
59
|
}
|
|
47
|
-
},
|
|
60
|
+
}, m = "4.7.1";
|
|
48
61
|
Date.prototype.scheduler = function(e, t) {
|
|
49
|
-
return
|
|
62
|
+
return ee(this, e, t);
|
|
50
63
|
}, Date.prototype.diff = function(e, t) {
|
|
51
|
-
return
|
|
64
|
+
return te(this, e, t);
|
|
52
65
|
}, Date.prototype.format = function() {
|
|
53
|
-
return
|
|
66
|
+
return ne(this);
|
|
54
67
|
}, Date.prototype.dueFormat = function(e, t, n) {
|
|
55
|
-
return
|
|
68
|
+
return re(this, e, t, n);
|
|
56
69
|
};
|
|
57
|
-
function
|
|
58
|
-
return new Date(n ?
|
|
70
|
+
function ee(e, t, n) {
|
|
71
|
+
return new Date(n ? p.time(e).getTime() + t * 24 * 60 * 60 * 1e3 : p.time(e).getTime() + t * 60 * 1e3);
|
|
59
72
|
}
|
|
60
|
-
function
|
|
73
|
+
function te(e, t, n) {
|
|
61
74
|
if (!e || !t) throw Error("Invalid date");
|
|
62
|
-
let r =
|
|
75
|
+
let r = p.time(e).getTime() - p.time(t).getTime(), i = 0;
|
|
63
76
|
switch (n) {
|
|
64
77
|
case "days":
|
|
65
78
|
i = Math.floor(r / (1440 * 60 * 1e3));
|
|
@@ -70,8 +83,8 @@ function m(e, t, n) {
|
|
|
70
83
|
}
|
|
71
84
|
return i;
|
|
72
85
|
}
|
|
73
|
-
function
|
|
74
|
-
let t =
|
|
86
|
+
function ne(e) {
|
|
87
|
+
let t = p.time(e), n = t.getFullYear(), r = t.getMonth() + 1, i = t.getDate(), a = t.getHours(), o = t.getMinutes(), s = t.getSeconds();
|
|
75
88
|
return `${n}-${h(r)}-${h(i)} ${h(a)}:${h(o)}:${h(s)}`;
|
|
76
89
|
}
|
|
77
90
|
function h(e) {
|
|
@@ -91,18 +104,18 @@ var g = [
|
|
|
91
104
|
"month",
|
|
92
105
|
"year"
|
|
93
106
|
];
|
|
94
|
-
function
|
|
95
|
-
e =
|
|
107
|
+
function re(e, t, n, r = _) {
|
|
108
|
+
e = p.time(e), t = p.time(t), r.length !== _.length && (r = _);
|
|
96
109
|
let i = e.getTime() - t.getTime(), a;
|
|
97
110
|
for (i /= 1e3, a = 0; a < g.length && !(i < g[a]); a++) i /= g[a];
|
|
98
111
|
return `${Math.floor(i)}${n ? r[a] : ""}`;
|
|
99
112
|
}
|
|
100
|
-
var
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
]),
|
|
113
|
+
var ie = Object.freeze([
|
|
114
|
+
f.Again,
|
|
115
|
+
f.Hard,
|
|
116
|
+
f.Good,
|
|
117
|
+
f.Easy
|
|
118
|
+
]), ae = [
|
|
106
119
|
{
|
|
107
120
|
start: 2.5,
|
|
108
121
|
end: 7,
|
|
@@ -119,9 +132,9 @@ var ne = Object.freeze([
|
|
|
119
132
|
factor: .05
|
|
120
133
|
}
|
|
121
134
|
];
|
|
122
|
-
function
|
|
135
|
+
function oe(e, t, n) {
|
|
123
136
|
let r = 1;
|
|
124
|
-
for (let t of
|
|
137
|
+
for (let t of ae) r += t.factor * Math.max(Math.min(e, t.end) - t.start, 0);
|
|
125
138
|
e = Math.min(e, n);
|
|
126
139
|
let i = Math.max(2, Math.round(e - r)), a = Math.min(Math.round(e + r), n);
|
|
127
140
|
return e > t && (i = Math.max(i, t + 1)), i = Math.min(i, a), {
|
|
@@ -132,11 +145,11 @@ function ie(e, t, n) {
|
|
|
132
145
|
function v(e, t, n) {
|
|
133
146
|
return Math.min(Math.max(e, t), n);
|
|
134
147
|
}
|
|
135
|
-
function
|
|
148
|
+
function se(e, t) {
|
|
136
149
|
let n = Date.UTC(e.getUTCFullYear(), e.getUTCMonth(), e.getUTCDate()), r = Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate());
|
|
137
150
|
return Math.floor((r - n) / 864e5);
|
|
138
151
|
}
|
|
139
|
-
var
|
|
152
|
+
var ce = Object.freeze([
|
|
140
153
|
.40255,
|
|
141
154
|
1.18385,
|
|
142
155
|
3.173,
|
|
@@ -157,8 +170,8 @@ var oe = Object.freeze([
|
|
|
157
170
|
.51655,
|
|
158
171
|
.6621
|
|
159
172
|
]);
|
|
160
|
-
`${
|
|
161
|
-
var y = .01,
|
|
173
|
+
`${m}`;
|
|
174
|
+
var y = .01, le = Object.freeze([
|
|
162
175
|
Object.freeze([y, 100]),
|
|
163
176
|
Object.freeze([y, 100]),
|
|
164
177
|
Object.freeze([y, 100]),
|
|
@@ -179,8 +192,8 @@ var y = .01, se = Object.freeze([
|
|
|
179
192
|
Object.freeze([0, 2]),
|
|
180
193
|
Object.freeze([0, 2])
|
|
181
194
|
]), b = (e) => {
|
|
182
|
-
let t = [...
|
|
183
|
-
return e?.w && (e.w.length === 19 ? t = [...e.w] : e.w.length === 17 && (t = e?.w.concat([0, 0]), t[4] = +(t[5] * 2 + t[4]).toFixed(8), t[5] = +(Math.log(t[5] * 3 + 1) / 3).toFixed(8), t[6] = +(t[6] + .5).toFixed(8), console.debug("[FSRS V5]auto fill w to 19 length"))), t = t.map((e, t) => v(e,
|
|
195
|
+
let t = [...ce];
|
|
196
|
+
return e?.w && (e.w.length === 19 ? t = [...e.w] : e.w.length === 17 && (t = e?.w.concat([0, 0]), t[4] = +(t[5] * 2 + t[4]).toFixed(8), t[5] = +(Math.log(t[5] * 3 + 1) / 3).toFixed(8), t[6] = +(t[6] + .5).toFixed(8), console.debug("[FSRS V5]auto fill w to 19 length"))), t = t.map((e, t) => v(e, le[t][0], le[t][1])), {
|
|
184
197
|
request_retention: e?.request_retention || .9,
|
|
185
198
|
maximum_interval: e?.maximum_interval || 36500,
|
|
186
199
|
w: t,
|
|
@@ -190,25 +203,25 @@ var y = .01, se = Object.freeze([
|
|
|
190
203
|
};
|
|
191
204
|
function x(e, t) {
|
|
192
205
|
let n = {
|
|
193
|
-
due: e ?
|
|
206
|
+
due: e ? p.time(e) : /* @__PURE__ */ new Date(),
|
|
194
207
|
stability: 0,
|
|
195
208
|
difficulty: 0,
|
|
196
209
|
elapsed_days: 0,
|
|
197
210
|
scheduled_days: 0,
|
|
198
211
|
reps: 0,
|
|
199
212
|
lapses: 0,
|
|
200
|
-
state:
|
|
213
|
+
state: d.New,
|
|
201
214
|
last_review: void 0
|
|
202
215
|
};
|
|
203
216
|
return t && typeof t == "function" ? t(n) : n;
|
|
204
217
|
}
|
|
205
|
-
var
|
|
218
|
+
var ue = class {
|
|
206
219
|
c;
|
|
207
220
|
s0;
|
|
208
221
|
s1;
|
|
209
222
|
s2;
|
|
210
223
|
constructor(e) {
|
|
211
|
-
let t =
|
|
224
|
+
let t = de();
|
|
212
225
|
this.c = 1, this.s0 = t(" "), this.s1 = t(" "), this.s2 = t(" "), e ??= +/* @__PURE__ */ new Date(), this.s0 -= t(e), this.s0 < 0 && (this.s0 += 1), this.s1 -= t(e), this.s1 < 0 && (this.s1 += 1), this.s2 -= t(e), this.s2 < 0 && (this.s2 += 1);
|
|
213
226
|
}
|
|
214
227
|
next() {
|
|
@@ -227,7 +240,7 @@ var ce = class {
|
|
|
227
240
|
};
|
|
228
241
|
}
|
|
229
242
|
};
|
|
230
|
-
function
|
|
243
|
+
function de() {
|
|
231
244
|
let e = 4022871197;
|
|
232
245
|
return function(t) {
|
|
233
246
|
t = String(t);
|
|
@@ -239,15 +252,15 @@ function le() {
|
|
|
239
252
|
return (e >>> 0) * 23283064365386963e-26;
|
|
240
253
|
};
|
|
241
254
|
}
|
|
242
|
-
function
|
|
243
|
-
let t = new
|
|
255
|
+
function fe(e) {
|
|
256
|
+
let t = new ue(e), n = () => t.next();
|
|
244
257
|
return n.int32 = () => t.next() * 4294967296 | 0, n.double = () => n() + (n() * 2097152 | 0) * 11102230246251565e-32, n.state = () => t.state, n.importState = (e) => (t.state = e, n), n;
|
|
245
258
|
}
|
|
246
|
-
var
|
|
247
|
-
function
|
|
248
|
-
return +((1 +
|
|
259
|
+
var pe = -.5, me = 19 / 81;
|
|
260
|
+
function he(e, t) {
|
|
261
|
+
return +((1 + me * e / t) ** +pe).toFixed(8);
|
|
249
262
|
}
|
|
250
|
-
var
|
|
263
|
+
var ge = class {
|
|
251
264
|
param;
|
|
252
265
|
intervalModifier;
|
|
253
266
|
_seed;
|
|
@@ -262,7 +275,7 @@ var me = class {
|
|
|
262
275
|
}
|
|
263
276
|
calculate_interval_modifier(e) {
|
|
264
277
|
if (e <= 0 || e > 1) throw Error("Requested retention rate should be in the range (0,1]");
|
|
265
|
-
return +((e ** (1 /
|
|
278
|
+
return +((e ** (1 / pe) - 1) / me).toFixed(8);
|
|
266
279
|
}
|
|
267
280
|
get parameters() {
|
|
268
281
|
return this.param;
|
|
@@ -291,7 +304,7 @@ var me = class {
|
|
|
291
304
|
}
|
|
292
305
|
apply_fuzz(e, t) {
|
|
293
306
|
if (!this.param.enable_fuzz || e < 2.5) return Math.round(e);
|
|
294
|
-
let n =
|
|
307
|
+
let n = fe(this._seed)(), { min_ivl: r, max_ivl: i } = oe(e, t, this.param.maximum_interval);
|
|
295
308
|
return Math.floor(n * (i - r + 1) + r);
|
|
296
309
|
}
|
|
297
310
|
next_interval(e, t) {
|
|
@@ -303,7 +316,7 @@ var me = class {
|
|
|
303
316
|
}
|
|
304
317
|
next_difficulty(e, t) {
|
|
305
318
|
let n = -this.param.w[6] * (t - 3), r = e + this.linear_damping(n, e);
|
|
306
|
-
return this.constrain_difficulty(this.mean_reversion(this.init_difficulty(
|
|
319
|
+
return this.constrain_difficulty(this.mean_reversion(this.init_difficulty(f.Easy), r));
|
|
307
320
|
}
|
|
308
321
|
constrain_difficulty(e) {
|
|
309
322
|
return Math.min(Math.max(+e.toFixed(8), 1), 10);
|
|
@@ -312,7 +325,7 @@ var me = class {
|
|
|
312
325
|
return +(this.param.w[7] * e + (1 - this.param.w[7]) * t).toFixed(8);
|
|
313
326
|
}
|
|
314
327
|
next_recall_stability(e, t, n, r) {
|
|
315
|
-
let i =
|
|
328
|
+
let i = f.Hard === r ? this.param.w[15] : 1, a = f.Easy === r ? this.param.w[16] : 1;
|
|
316
329
|
return +v(t * (1 + Math.exp(this.param.w[8]) * (11 - e) * t ** +-this.param.w[9] * (Math.exp((1 - n) * this.param.w[10]) - 1) * i * a), y, 36500).toFixed(8);
|
|
317
330
|
}
|
|
318
331
|
next_forget_stability(e, t, n) {
|
|
@@ -321,7 +334,7 @@ var me = class {
|
|
|
321
334
|
next_short_term_stability(e, t) {
|
|
322
335
|
return +v(e * Math.exp(this.param.w[17] * (t - 3 + this.param.w[18])), y, 36500).toFixed(8);
|
|
323
336
|
}
|
|
324
|
-
forgetting_curve =
|
|
337
|
+
forgetting_curve = he;
|
|
325
338
|
next_state(e, t, n) {
|
|
326
339
|
let { difficulty: r, stability: i } = e ?? {
|
|
327
340
|
difficulty: 0,
|
|
@@ -349,46 +362,46 @@ var me = class {
|
|
|
349
362
|
};
|
|
350
363
|
}
|
|
351
364
|
};
|
|
352
|
-
function
|
|
365
|
+
function _e() {
|
|
353
366
|
return `${this.review_time.getTime()}_${this.current.reps}_${this.current.difficulty * this.current.stability}`;
|
|
354
367
|
}
|
|
355
|
-
var S = ((e) => (e.SCHEDULER = "Scheduler", e.SEED = "Seed", e))(S || {}),
|
|
368
|
+
var S = ((e) => (e.SCHEDULER = "Scheduler", e.SEED = "Seed", e))(S || {}), ve = class {
|
|
356
369
|
last;
|
|
357
370
|
current;
|
|
358
371
|
review_time;
|
|
359
372
|
next = /* @__PURE__ */ new Map();
|
|
360
373
|
algorithm;
|
|
361
374
|
initSeedStrategy;
|
|
362
|
-
constructor(e, t, n, r = { seed:
|
|
363
|
-
this.algorithm = n, this.initSeedStrategy = r.seed.bind(this), this.last =
|
|
375
|
+
constructor(e, t, n, r = { seed: _e }) {
|
|
376
|
+
this.algorithm = n, this.initSeedStrategy = r.seed.bind(this), this.last = p.card(e), this.current = p.card(e), this.review_time = p.time(t), this.init();
|
|
364
377
|
}
|
|
365
378
|
init() {
|
|
366
379
|
let { state: e, last_review: t } = this.current, n = 0;
|
|
367
|
-
e !==
|
|
380
|
+
e !== d.New && t && (n = se(t, this.review_time)), this.current.last_review = this.review_time, this.current.elapsed_days = n, this.current.reps += 1, this.algorithm.seed = this.initSeedStrategy();
|
|
368
381
|
}
|
|
369
382
|
preview() {
|
|
370
383
|
return {
|
|
371
|
-
[
|
|
372
|
-
[
|
|
373
|
-
[
|
|
374
|
-
[
|
|
384
|
+
[f.Again]: this.review(f.Again),
|
|
385
|
+
[f.Hard]: this.review(f.Hard),
|
|
386
|
+
[f.Good]: this.review(f.Good),
|
|
387
|
+
[f.Easy]: this.review(f.Easy),
|
|
375
388
|
[Symbol.iterator]: this.previewIterator.bind(this)
|
|
376
389
|
};
|
|
377
390
|
}
|
|
378
391
|
*previewIterator() {
|
|
379
|
-
for (let e of
|
|
392
|
+
for (let e of ie) yield this.review(e);
|
|
380
393
|
}
|
|
381
394
|
review(e) {
|
|
382
395
|
let { state: t } = this.last, n;
|
|
383
396
|
switch (t) {
|
|
384
|
-
case
|
|
397
|
+
case d.New:
|
|
385
398
|
n = this.newState(e);
|
|
386
399
|
break;
|
|
387
|
-
case
|
|
388
|
-
case
|
|
400
|
+
case d.Learning:
|
|
401
|
+
case d.Relearning:
|
|
389
402
|
n = this.learningState(e);
|
|
390
403
|
break;
|
|
391
|
-
case
|
|
404
|
+
case d.Review:
|
|
392
405
|
n = this.reviewState(e);
|
|
393
406
|
break;
|
|
394
407
|
}
|
|
@@ -409,24 +422,24 @@ var S = ((e) => (e.SCHEDULER = "Scheduler", e.SEED = "Seed", e))(S || {}), ge =
|
|
|
409
422
|
review: this.review_time
|
|
410
423
|
};
|
|
411
424
|
}
|
|
412
|
-
},
|
|
425
|
+
}, ye = class extends ve {
|
|
413
426
|
newState(e) {
|
|
414
427
|
let t = this.next.get(e);
|
|
415
428
|
if (t) return t;
|
|
416
|
-
let n =
|
|
429
|
+
let n = p.card(this.current);
|
|
417
430
|
switch (n.difficulty = this.algorithm.init_difficulty(e), n.stability = this.algorithm.init_stability(e), e) {
|
|
418
|
-
case
|
|
419
|
-
n.scheduled_days = 0, n.due = this.review_time.scheduler(1), n.state =
|
|
431
|
+
case f.Again:
|
|
432
|
+
n.scheduled_days = 0, n.due = this.review_time.scheduler(1), n.state = d.Learning;
|
|
420
433
|
break;
|
|
421
|
-
case
|
|
422
|
-
n.scheduled_days = 0, n.due = this.review_time.scheduler(5), n.state =
|
|
434
|
+
case f.Hard:
|
|
435
|
+
n.scheduled_days = 0, n.due = this.review_time.scheduler(5), n.state = d.Learning;
|
|
423
436
|
break;
|
|
424
|
-
case
|
|
425
|
-
n.scheduled_days = 0, n.due = this.review_time.scheduler(10), n.state =
|
|
437
|
+
case f.Good:
|
|
438
|
+
n.scheduled_days = 0, n.due = this.review_time.scheduler(10), n.state = d.Learning;
|
|
426
439
|
break;
|
|
427
|
-
case
|
|
440
|
+
case f.Easy: {
|
|
428
441
|
let e = this.algorithm.next_interval(n.stability, this.current.elapsed_days);
|
|
429
|
-
n.scheduled_days = e, n.due = this.review_time.scheduler(e, !0), n.state =
|
|
442
|
+
n.scheduled_days = e, n.due = this.review_time.scheduler(e, !0), n.state = d.Review;
|
|
430
443
|
break;
|
|
431
444
|
}
|
|
432
445
|
default: throw Error("Invalid grade");
|
|
@@ -440,22 +453,22 @@ var S = ((e) => (e.SCHEDULER = "Scheduler", e.SEED = "Seed", e))(S || {}), ge =
|
|
|
440
453
|
learningState(e) {
|
|
441
454
|
let t = this.next.get(e);
|
|
442
455
|
if (t) return t;
|
|
443
|
-
let { state: n, difficulty: r, stability: i } = this.last, a =
|
|
456
|
+
let { state: n, difficulty: r, stability: i } = this.last, a = p.card(this.current), o = this.current.elapsed_days;
|
|
444
457
|
switch (a.difficulty = this.algorithm.next_difficulty(r, e), a.stability = this.algorithm.next_short_term_stability(i, e), e) {
|
|
445
|
-
case
|
|
458
|
+
case f.Again:
|
|
446
459
|
a.scheduled_days = 0, a.due = this.review_time.scheduler(5, !1), a.state = n;
|
|
447
460
|
break;
|
|
448
|
-
case
|
|
461
|
+
case f.Hard:
|
|
449
462
|
a.scheduled_days = 0, a.due = this.review_time.scheduler(10), a.state = n;
|
|
450
463
|
break;
|
|
451
|
-
case
|
|
464
|
+
case f.Good: {
|
|
452
465
|
let e = this.algorithm.next_interval(a.stability, o);
|
|
453
|
-
a.scheduled_days = e, a.due = this.review_time.scheduler(e, !0), a.state =
|
|
466
|
+
a.scheduled_days = e, a.due = this.review_time.scheduler(e, !0), a.state = d.Review;
|
|
454
467
|
break;
|
|
455
468
|
}
|
|
456
|
-
case
|
|
457
|
-
let e = this.algorithm.next_short_term_stability(i,
|
|
458
|
-
a.scheduled_days = n, a.due = this.review_time.scheduler(n, !0), a.state =
|
|
469
|
+
case f.Easy: {
|
|
470
|
+
let e = this.algorithm.next_short_term_stability(i, f.Good), t = this.algorithm.next_interval(e, o), n = Math.max(this.algorithm.next_interval(a.stability, o), t + 1);
|
|
471
|
+
a.scheduled_days = n, a.due = this.review_time.scheduler(n, !0), a.state = d.Review;
|
|
459
472
|
break;
|
|
460
473
|
}
|
|
461
474
|
default: throw Error("Invalid grade");
|
|
@@ -469,27 +482,27 @@ var S = ((e) => (e.SCHEDULER = "Scheduler", e.SEED = "Seed", e))(S || {}), ge =
|
|
|
469
482
|
reviewState(e) {
|
|
470
483
|
let t = this.next.get(e);
|
|
471
484
|
if (t) return t;
|
|
472
|
-
let n = this.current.elapsed_days, { difficulty: r, stability: i } = this.last, a = this.algorithm.forgetting_curve(n, i), o =
|
|
485
|
+
let n = this.current.elapsed_days, { difficulty: r, stability: i } = this.last, a = this.algorithm.forgetting_curve(n, i), o = p.card(this.current), s = p.card(this.current), c = p.card(this.current), l = p.card(this.current);
|
|
473
486
|
this.next_ds(o, s, c, l, r, i, a), this.next_interval(o, s, c, l, n), this.next_state(o, s, c, l), o.lapses += 1;
|
|
474
|
-
let
|
|
487
|
+
let u = {
|
|
475
488
|
card: o,
|
|
476
|
-
log: this.buildLog(
|
|
477
|
-
},
|
|
489
|
+
log: this.buildLog(f.Again)
|
|
490
|
+
}, d = {
|
|
478
491
|
card: s,
|
|
479
|
-
log: super.buildLog(
|
|
492
|
+
log: super.buildLog(f.Hard)
|
|
480
493
|
}, m = {
|
|
481
494
|
card: c,
|
|
482
|
-
log: super.buildLog(
|
|
495
|
+
log: super.buildLog(f.Good)
|
|
483
496
|
}, ee = {
|
|
484
497
|
card: l,
|
|
485
|
-
log: super.buildLog(
|
|
498
|
+
log: super.buildLog(f.Easy)
|
|
486
499
|
};
|
|
487
|
-
return this.next.set(
|
|
500
|
+
return this.next.set(f.Again, u), this.next.set(f.Hard, d), this.next.set(f.Good, m), this.next.set(f.Easy, ee), this.next.get(e);
|
|
488
501
|
}
|
|
489
502
|
next_ds(e, t, n, r, i, a, o) {
|
|
490
|
-
e.difficulty = this.algorithm.next_difficulty(i,
|
|
503
|
+
e.difficulty = this.algorithm.next_difficulty(i, f.Again);
|
|
491
504
|
let s = a / Math.exp(this.algorithm.parameters.w[17] * this.algorithm.parameters.w[18]), c = this.algorithm.next_forget_stability(i, a, o);
|
|
492
|
-
e.stability = v(+s.toFixed(8), y, c), t.difficulty = this.algorithm.next_difficulty(i,
|
|
505
|
+
e.stability = v(+s.toFixed(8), y, c), t.difficulty = this.algorithm.next_difficulty(i, f.Hard), t.stability = this.algorithm.next_recall_stability(i, a, o, f.Hard), n.difficulty = this.algorithm.next_difficulty(i, f.Good), n.stability = this.algorithm.next_recall_stability(i, a, o, f.Good), r.difficulty = this.algorithm.next_difficulty(i, f.Easy), r.stability = this.algorithm.next_recall_stability(i, a, o, f.Easy);
|
|
493
506
|
}
|
|
494
507
|
next_interval(e, t, n, r, i) {
|
|
495
508
|
let a, o;
|
|
@@ -498,18 +511,18 @@ var S = ((e) => (e.SCHEDULER = "Scheduler", e.SEED = "Seed", e))(S || {}), ge =
|
|
|
498
511
|
e.scheduled_days = 0, e.due = this.review_time.scheduler(5), t.scheduled_days = a, t.due = this.review_time.scheduler(a, !0), n.scheduled_days = o, n.due = this.review_time.scheduler(o, !0), r.scheduled_days = s, r.due = this.review_time.scheduler(s, !0);
|
|
499
512
|
}
|
|
500
513
|
next_state(e, t, n, r) {
|
|
501
|
-
e.state =
|
|
514
|
+
e.state = d.Relearning, t.state = d.Review, n.state = d.Review, r.state = d.Review;
|
|
502
515
|
}
|
|
503
|
-
},
|
|
516
|
+
}, be = class extends ve {
|
|
504
517
|
newState(e) {
|
|
505
518
|
let t = this.next.get(e);
|
|
506
519
|
if (t) return t;
|
|
507
520
|
this.current.scheduled_days = 0, this.current.elapsed_days = 0;
|
|
508
|
-
let n =
|
|
521
|
+
let n = p.card(this.current), r = p.card(this.current), i = p.card(this.current), a = p.card(this.current);
|
|
509
522
|
return this.init_ds(n, r, i, a), this.next_interval(n, r, i, a, 0), this.next_state(n, r, i, a), this.update_next(n, r, i, a), this.next.get(e);
|
|
510
523
|
}
|
|
511
524
|
init_ds(e, t, n, r) {
|
|
512
|
-
e.difficulty = this.algorithm.init_difficulty(
|
|
525
|
+
e.difficulty = this.algorithm.init_difficulty(f.Again), e.stability = this.algorithm.init_stability(f.Again), t.difficulty = this.algorithm.init_difficulty(f.Hard), t.stability = this.algorithm.init_stability(f.Hard), n.difficulty = this.algorithm.init_difficulty(f.Good), n.stability = this.algorithm.init_stability(f.Good), r.difficulty = this.algorithm.init_difficulty(f.Easy), r.stability = this.algorithm.init_stability(f.Easy);
|
|
513
526
|
}
|
|
514
527
|
learningState(e) {
|
|
515
528
|
return this.reviewState(e);
|
|
@@ -517,36 +530,36 @@ var S = ((e) => (e.SCHEDULER = "Scheduler", e.SEED = "Seed", e))(S || {}), ge =
|
|
|
517
530
|
reviewState(e) {
|
|
518
531
|
let t = this.next.get(e);
|
|
519
532
|
if (t) return t;
|
|
520
|
-
let n = this.current.elapsed_days, { difficulty: r, stability: i } = this.last, a = this.algorithm.forgetting_curve(n, i), o =
|
|
533
|
+
let n = this.current.elapsed_days, { difficulty: r, stability: i } = this.last, a = this.algorithm.forgetting_curve(n, i), o = p.card(this.current), s = p.card(this.current), c = p.card(this.current), l = p.card(this.current);
|
|
521
534
|
return this.next_ds(o, s, c, l, r, i, a), this.next_interval(o, s, c, l, n), this.next_state(o, s, c, l), o.lapses += 1, this.update_next(o, s, c, l), this.next.get(e);
|
|
522
535
|
}
|
|
523
536
|
next_ds(e, t, n, r, i, a, o) {
|
|
524
|
-
e.difficulty = this.algorithm.next_difficulty(i,
|
|
537
|
+
e.difficulty = this.algorithm.next_difficulty(i, f.Again), e.stability = v(a, y, this.algorithm.next_forget_stability(i, a, o)), t.difficulty = this.algorithm.next_difficulty(i, f.Hard), t.stability = this.algorithm.next_recall_stability(i, a, o, f.Hard), n.difficulty = this.algorithm.next_difficulty(i, f.Good), n.stability = this.algorithm.next_recall_stability(i, a, o, f.Good), r.difficulty = this.algorithm.next_difficulty(i, f.Easy), r.stability = this.algorithm.next_recall_stability(i, a, o, f.Easy);
|
|
525
538
|
}
|
|
526
539
|
next_interval(e, t, n, r, i) {
|
|
527
540
|
let a, o, s, c;
|
|
528
541
|
a = this.algorithm.next_interval(e.stability, i), o = this.algorithm.next_interval(t.stability, i), s = this.algorithm.next_interval(n.stability, i), c = this.algorithm.next_interval(r.stability, i), a = Math.min(a, o), o = Math.max(o, a + 1), s = Math.max(s, o + 1), c = Math.max(c, s + 1), e.scheduled_days = a, e.due = this.review_time.scheduler(a, !0), t.scheduled_days = o, t.due = this.review_time.scheduler(o, !0), n.scheduled_days = s, n.due = this.review_time.scheduler(s, !0), r.scheduled_days = c, r.due = this.review_time.scheduler(c, !0);
|
|
529
542
|
}
|
|
530
543
|
next_state(e, t, n, r) {
|
|
531
|
-
e.state =
|
|
544
|
+
e.state = d.Review, t.state = d.Review, n.state = d.Review, r.state = d.Review;
|
|
532
545
|
}
|
|
533
546
|
update_next(e, t, n, r) {
|
|
534
547
|
let i = {
|
|
535
548
|
card: e,
|
|
536
|
-
log: this.buildLog(
|
|
549
|
+
log: this.buildLog(f.Again)
|
|
537
550
|
}, a = {
|
|
538
551
|
card: t,
|
|
539
|
-
log: super.buildLog(
|
|
552
|
+
log: super.buildLog(f.Hard)
|
|
540
553
|
}, o = {
|
|
541
554
|
card: n,
|
|
542
|
-
log: super.buildLog(
|
|
555
|
+
log: super.buildLog(f.Good)
|
|
543
556
|
}, s = {
|
|
544
557
|
card: r,
|
|
545
|
-
log: super.buildLog(
|
|
558
|
+
log: super.buildLog(f.Easy)
|
|
546
559
|
};
|
|
547
|
-
this.next.set(
|
|
560
|
+
this.next.set(f.Again, i), this.next.set(f.Hard, a), this.next.set(f.Good, o), this.next.set(f.Easy, s);
|
|
548
561
|
}
|
|
549
|
-
},
|
|
562
|
+
}, xe = class {
|
|
550
563
|
fsrs;
|
|
551
564
|
constructor(e) {
|
|
552
565
|
this.fsrs = e;
|
|
@@ -557,8 +570,8 @@ var S = ((e) => (e.SCHEDULER = "Scheduler", e.SEED = "Seed", e))(S || {}), ge =
|
|
|
557
570
|
handleManualRating(e, t, n, r, i, a, o) {
|
|
558
571
|
if (typeof t > "u") throw Error("reschedule: state is required for manual rating");
|
|
559
572
|
let s, c;
|
|
560
|
-
if (t ===
|
|
561
|
-
rating:
|
|
573
|
+
if (t === d.New) s = {
|
|
574
|
+
rating: f.Manual,
|
|
562
575
|
state: t,
|
|
563
576
|
due: o ?? n,
|
|
564
577
|
stability: e.stability,
|
|
@@ -572,7 +585,7 @@ var S = ((e) => (e.SCHEDULER = "Scheduler", e.SEED = "Seed", e))(S || {}), ge =
|
|
|
572
585
|
if (typeof o > "u") throw Error("reschedule: due is required for manual rating");
|
|
573
586
|
let l = o.diff(n, "days");
|
|
574
587
|
s = {
|
|
575
|
-
rating:
|
|
588
|
+
rating: f.Manual,
|
|
576
589
|
state: e.state,
|
|
577
590
|
due: e.last_review || e.due,
|
|
578
591
|
stability: e.stability,
|
|
@@ -602,9 +615,9 @@ var S = ((e) => (e.SCHEDULER = "Scheduler", e.SEED = "Seed", e))(S || {}), ge =
|
|
|
602
615
|
let n = [], r = x(e.due);
|
|
603
616
|
for (let e of t) {
|
|
604
617
|
let t;
|
|
605
|
-
if (e.review =
|
|
618
|
+
if (e.review = p.time(e.review), e.rating === f.Manual) {
|
|
606
619
|
let n = 0;
|
|
607
|
-
r.state !==
|
|
620
|
+
r.state !== d.New && r.last_review && (n = e.review.diff(r.last_review, "days")), t = this.handleManualRating(r, e.state, e.review, n, e.stability, e.difficulty, e.due ? p.time(e.due) : void 0);
|
|
608
621
|
} else t = this.replay(r, e.review, e.rating);
|
|
609
622
|
n.push(t), r = t.card;
|
|
610
623
|
}
|
|
@@ -612,21 +625,21 @@ var S = ((e) => (e.SCHEDULER = "Scheduler", e.SEED = "Seed", e))(S || {}), ge =
|
|
|
612
625
|
}
|
|
613
626
|
calculateManualRecord(e, t, n, r) {
|
|
614
627
|
if (!n) return null;
|
|
615
|
-
let { card: i, log: a } = n, o =
|
|
616
|
-
return o.due.getTime() === i.due.getTime() ? null : (o.scheduled_days = i.due.diff(o.due, "days"), this.handleManualRating(o, i.state,
|
|
628
|
+
let { card: i, log: a } = n, o = p.card(e);
|
|
629
|
+
return o.due.getTime() === i.due.getTime() ? null : (o.scheduled_days = i.due.diff(o.due, "days"), this.handleManualRating(o, i.state, p.time(t), a.elapsed_days, r ? i.stability : void 0, r ? i.difficulty : void 0, i.due));
|
|
617
630
|
}
|
|
618
|
-
},
|
|
631
|
+
}, Se = class extends ge {
|
|
619
632
|
strategyHandler = /* @__PURE__ */ new Map();
|
|
620
633
|
Scheduler;
|
|
621
634
|
constructor(e) {
|
|
622
635
|
super(e);
|
|
623
636
|
let { enable_short_term: t } = this.parameters;
|
|
624
|
-
this.Scheduler = t ?
|
|
637
|
+
this.Scheduler = t ? ye : be;
|
|
625
638
|
}
|
|
626
639
|
params_handler_proxy() {
|
|
627
640
|
let e = this;
|
|
628
641
|
return { set: function(t, n, r) {
|
|
629
|
-
return n === "request_retention" && Number.isFinite(r) ? e.intervalModifier = e.calculate_interval_modifier(Number(r)) : n === "enable_short_term" && (e.Scheduler = r === !0 ?
|
|
642
|
+
return n === "request_retention" && Number.isFinite(r) ? e.intervalModifier = e.calculate_interval_modifier(Number(r)) : n === "enable_short_term" && (e.Scheduler = r === !0 ? ye : be), Reflect.set(t, n, r), !0;
|
|
630
643
|
} };
|
|
631
644
|
}
|
|
632
645
|
useStrategy(e, t) {
|
|
@@ -637,36 +650,36 @@ var S = ((e) => (e.SCHEDULER = "Scheduler", e.SEED = "Seed", e))(S || {}), ge =
|
|
|
637
650
|
}
|
|
638
651
|
getScheduler(e, t) {
|
|
639
652
|
let n = this.strategyHandler.get(S.SEED);
|
|
640
|
-
return new ((this.strategyHandler.get(S.SCHEDULER)) || this.Scheduler)(e, t, this, { seed: n ||
|
|
653
|
+
return new ((this.strategyHandler.get(S.SCHEDULER)) || this.Scheduler)(e, t, this, { seed: n || _e });
|
|
641
654
|
}
|
|
642
655
|
repeat(e, t, n) {
|
|
643
656
|
let r = this.getScheduler(e, t).preview();
|
|
644
657
|
return n && typeof n == "function" ? n(r) : r;
|
|
645
658
|
}
|
|
646
659
|
next(e, t, n, r) {
|
|
647
|
-
let i = this.getScheduler(e, t), a =
|
|
648
|
-
if (a ===
|
|
660
|
+
let i = this.getScheduler(e, t), a = p.rating(n);
|
|
661
|
+
if (a === f.Manual) throw Error("Cannot review a manual rating");
|
|
649
662
|
let o = i.review(a);
|
|
650
663
|
return r && typeof r == "function" ? r(o) : o;
|
|
651
664
|
}
|
|
652
665
|
get_retrievability(e, t, n = !0) {
|
|
653
|
-
let r =
|
|
654
|
-
t = t ?
|
|
655
|
-
let i = r.state ===
|
|
666
|
+
let r = p.card(e);
|
|
667
|
+
t = t ? p.time(t) : /* @__PURE__ */ new Date();
|
|
668
|
+
let i = r.state === d.New ? 0 : Math.max(t.diff(r.last_review, "days"), 0), a = r.state === d.New ? 0 : this.forgetting_curve(i, +r.stability.toFixed(8));
|
|
656
669
|
return n ? `${(a * 100).toFixed(2)}%` : a;
|
|
657
670
|
}
|
|
658
671
|
rollback(e, t, n) {
|
|
659
|
-
let r =
|
|
660
|
-
if (i.rating ===
|
|
672
|
+
let r = p.card(e), i = p.review_log(t);
|
|
673
|
+
if (i.rating === f.Manual) throw Error("Cannot rollback a manual rating");
|
|
661
674
|
let a, o, s;
|
|
662
675
|
switch (i.state) {
|
|
663
|
-
case
|
|
676
|
+
case d.New:
|
|
664
677
|
a = i.due, o = void 0, s = 0;
|
|
665
678
|
break;
|
|
666
|
-
case
|
|
667
|
-
case
|
|
668
|
-
case
|
|
669
|
-
a = i.review, o = i.due, s = r.lapses - +(i.rating ===
|
|
679
|
+
case d.Learning:
|
|
680
|
+
case d.Relearning:
|
|
681
|
+
case d.Review:
|
|
682
|
+
a = i.review, o = i.due, s = r.lapses - +(i.rating === f.Again && i.state === d.Review);
|
|
670
683
|
break;
|
|
671
684
|
}
|
|
672
685
|
let c = {
|
|
@@ -684,10 +697,10 @@ var S = ((e) => (e.SCHEDULER = "Scheduler", e.SEED = "Seed", e))(S || {}), ge =
|
|
|
684
697
|
return n && typeof n == "function" ? n(c) : c;
|
|
685
698
|
}
|
|
686
699
|
forget(e, t, n = !1, r) {
|
|
687
|
-
let i =
|
|
688
|
-
t =
|
|
689
|
-
let a = i.state ===
|
|
690
|
-
rating:
|
|
700
|
+
let i = p.card(e);
|
|
701
|
+
t = p.time(t);
|
|
702
|
+
let a = i.state === d.New ? 0 : t.diff(i.last_review, "days"), o = {
|
|
703
|
+
rating: f.Manual,
|
|
691
704
|
state: i.state,
|
|
692
705
|
due: i.due,
|
|
693
706
|
stability: i.stability,
|
|
@@ -706,7 +719,7 @@ var S = ((e) => (e.SCHEDULER = "Scheduler", e.SEED = "Seed", e))(S || {}), ge =
|
|
|
706
719
|
scheduled_days: 0,
|
|
707
720
|
reps: n ? 0 : i.reps,
|
|
708
721
|
lapses: n ? 0 : i.lapses,
|
|
709
|
-
state:
|
|
722
|
+
state: d.New,
|
|
710
723
|
last_review: i.last_review
|
|
711
724
|
},
|
|
712
725
|
log: o
|
|
@@ -715,8 +728,8 @@ var S = ((e) => (e.SCHEDULER = "Scheduler", e.SEED = "Seed", e))(S || {}), ge =
|
|
|
715
728
|
}
|
|
716
729
|
reschedule(e, t = [], n = {}) {
|
|
717
730
|
let { recordLogHandler: r, reviewsOrderBy: i, skipManual: a = !0, now: o = /* @__PURE__ */ new Date(), update_memory_state: s = !1 } = n;
|
|
718
|
-
i && typeof i == "function" && t.sort(i), a && (t = t.filter((e) => e.rating !==
|
|
719
|
-
let c = new
|
|
731
|
+
i && typeof i == "function" && t.sort(i), a && (t = t.filter((e) => e.rating !== f.Manual));
|
|
732
|
+
let c = new xe(this), l = c.reschedule(n.first_card || x(), t), u = l.length, d = p.card(e), m = c.calculateManualRecord(d, o, u ? l[u - 1] : void 0, s);
|
|
720
733
|
return r && typeof r == "function" ? {
|
|
721
734
|
collections: l.map(r),
|
|
722
735
|
reschedule_item: m ? r(m) : null
|
|
@@ -725,14 +738,14 @@ var S = ((e) => (e.SCHEDULER = "Scheduler", e.SEED = "Seed", e))(S || {}), ge =
|
|
|
725
738
|
reschedule_item: m
|
|
726
739
|
};
|
|
727
740
|
}
|
|
728
|
-
},
|
|
741
|
+
}, Ce = ((e) => new Se(e || {}))(b({
|
|
729
742
|
request_retention: i,
|
|
730
743
|
enable_fuzz: !0,
|
|
731
744
|
maximum_interval: 100
|
|
732
|
-
})),
|
|
745
|
+
})), we = (e) => e.due ? e : {
|
|
733
746
|
...e,
|
|
734
747
|
due: /* @__PURE__ */ new Date()
|
|
735
|
-
},
|
|
748
|
+
}, Te = (e) => t.indexOf(e), Ee = (e) => ({
|
|
736
749
|
due: e.due,
|
|
737
750
|
stability: e.stability,
|
|
738
751
|
difficulty: e.difficulty,
|
|
@@ -740,19 +753,19 @@ var S = ((e) => (e.SCHEDULER = "Scheduler", e.SEED = "Seed", e))(S || {}), ge =
|
|
|
740
753
|
scheduled_days: e.scheduledDays,
|
|
741
754
|
reps: e.reps,
|
|
742
755
|
lapses: e.lapses,
|
|
743
|
-
state:
|
|
756
|
+
state: Te(e.state),
|
|
744
757
|
last_review: e.lastReview
|
|
745
|
-
}),
|
|
746
|
-
let r = /* @__PURE__ */ new Date(), i = we(
|
|
747
|
-
return
|
|
748
|
-
let i = r[
|
|
758
|
+
}), De = (e, t, n) => {
|
|
759
|
+
let r = /* @__PURE__ */ new Date(), i = Ee(we(e));
|
|
760
|
+
return Ce.repeat(i, r, (r) => {
|
|
761
|
+
let i = r[je(t)], a = C(i.card, e), o = i.log;
|
|
749
762
|
return {
|
|
750
763
|
nextCard: a,
|
|
751
764
|
reviewLog: {
|
|
752
765
|
id: 0,
|
|
753
766
|
cardReviewId: e.id,
|
|
754
767
|
grade: t,
|
|
755
|
-
state:
|
|
768
|
+
state: Ae(o.state),
|
|
756
769
|
due: o.due,
|
|
757
770
|
stability: o.stability,
|
|
758
771
|
difficulty: o.difficulty,
|
|
@@ -765,18 +778,18 @@ var S = ((e) => (e.SCHEDULER = "Scheduler", e.SEED = "Seed", e))(S || {}), ge =
|
|
|
765
778
|
};
|
|
766
779
|
});
|
|
767
780
|
};
|
|
768
|
-
function
|
|
769
|
-
let t = /* @__PURE__ */ new Date(), n = we(
|
|
770
|
-
for (let e of
|
|
771
|
-
let t = i[e].card.due, n =
|
|
781
|
+
function Oe(e) {
|
|
782
|
+
let t = /* @__PURE__ */ new Date(), n = Ee(we(e)), i = Ce.repeat(n, t), a = Object.fromEntries(r.map((e) => [e, /* @__PURE__ */ new Date()]));
|
|
783
|
+
for (let e of ie) {
|
|
784
|
+
let t = i[e].card.due, n = ke(e);
|
|
772
785
|
a[n] = t;
|
|
773
786
|
}
|
|
774
787
|
return a;
|
|
775
788
|
}
|
|
776
|
-
function
|
|
789
|
+
function ke(e) {
|
|
777
790
|
return r[e];
|
|
778
791
|
}
|
|
779
|
-
function
|
|
792
|
+
function Ae(e) {
|
|
780
793
|
return t[e];
|
|
781
794
|
}
|
|
782
795
|
function C(e, t) {
|
|
@@ -789,16 +802,16 @@ function C(e, t) {
|
|
|
789
802
|
scheduledDays: e.scheduled_days,
|
|
790
803
|
reps: e.reps,
|
|
791
804
|
lapses: e.lapses,
|
|
792
|
-
state:
|
|
805
|
+
state: Ae(e.state),
|
|
793
806
|
lastReview: e.last_review ?? null
|
|
794
807
|
};
|
|
795
808
|
}
|
|
796
|
-
function
|
|
809
|
+
function je(e) {
|
|
797
810
|
let t = r.indexOf(e);
|
|
798
811
|
if (t === -1) throw Error(`Invalid rating: ${e}`);
|
|
799
812
|
return t;
|
|
800
813
|
}
|
|
801
|
-
function
|
|
814
|
+
function Me(e, t) {
|
|
802
815
|
let r = x();
|
|
803
816
|
return {
|
|
804
817
|
id: "",
|
|
@@ -816,8 +829,16 @@ function Ae(e, t) {
|
|
|
816
829
|
};
|
|
817
830
|
}
|
|
818
831
|
//#endregion
|
|
832
|
+
//#region src/spaced-repetition/retention.ts
|
|
833
|
+
function Ne(e, t) {
|
|
834
|
+
return t <= 0 ? 0 : (1 + o * e / t) ** -a;
|
|
835
|
+
}
|
|
836
|
+
function Pe(e, t) {
|
|
837
|
+
return Ne(e, t) * 100;
|
|
838
|
+
}
|
|
839
|
+
//#endregion
|
|
819
840
|
//#region ../../node_modules/immer/dist/immer.mjs
|
|
820
|
-
var
|
|
841
|
+
var Fe = Symbol.for("immer-nothing"), Ie = Symbol.for("immer-draftable"), w = Symbol.for("immer-state"), Le = process.env.NODE_ENV === "production" ? [] : [
|
|
821
842
|
function(e) {
|
|
822
843
|
return `The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`;
|
|
823
844
|
},
|
|
@@ -847,7 +868,7 @@ var je = Symbol.for("immer-nothing"), Me = Symbol.for("immer-draftable"), w = Sy
|
|
|
847
868
|
];
|
|
848
869
|
function T(e, ...t) {
|
|
849
870
|
if (process.env.NODE_ENV !== "production") {
|
|
850
|
-
let n =
|
|
871
|
+
let n = Le[e], r = typeof n == "function" ? n.apply(null, t) : n;
|
|
851
872
|
throw Error(`[Immer] ${r}`);
|
|
852
873
|
}
|
|
853
874
|
throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`);
|
|
@@ -857,18 +878,18 @@ function D(e) {
|
|
|
857
878
|
return !!e && !!e[w];
|
|
858
879
|
}
|
|
859
880
|
function O(e) {
|
|
860
|
-
return e ?
|
|
881
|
+
return e ? Be(e) || Array.isArray(e) || !!e[Ie] || !!e.constructor?.[Ie] || M(e) || N(e) : !1;
|
|
861
882
|
}
|
|
862
|
-
var
|
|
863
|
-
function
|
|
883
|
+
var Re = Object.prototype.constructor.toString(), ze = /* @__PURE__ */ new WeakMap();
|
|
884
|
+
function Be(e) {
|
|
864
885
|
if (!e || typeof e != "object") return !1;
|
|
865
886
|
let t = Object.getPrototypeOf(e);
|
|
866
887
|
if (t === null || t === Object.prototype) return !0;
|
|
867
888
|
let n = Object.hasOwnProperty.call(t, "constructor") && t.constructor;
|
|
868
889
|
if (n === Object) return !0;
|
|
869
890
|
if (typeof n != "function") return !1;
|
|
870
|
-
let r =
|
|
871
|
-
return r === void 0 && (r = Function.toString.call(n),
|
|
891
|
+
let r = ze.get(n);
|
|
892
|
+
return r === void 0 && (r = Function.toString.call(n), ze.set(n, r)), r === Re;
|
|
872
893
|
}
|
|
873
894
|
function k(e, t, n = !0) {
|
|
874
895
|
A(e) === 0 ? (n ? Reflect.ownKeys(e) : Object.keys(e)).forEach((n) => {
|
|
@@ -882,11 +903,11 @@ function A(e) {
|
|
|
882
903
|
function j(e, t) {
|
|
883
904
|
return A(e) === 2 ? e.has(t) : Object.prototype.hasOwnProperty.call(e, t);
|
|
884
905
|
}
|
|
885
|
-
function
|
|
906
|
+
function Ve(e, t, n) {
|
|
886
907
|
let r = A(e);
|
|
887
908
|
r === 2 ? e.set(t, n) : r === 3 ? e.add(n) : e[t] = n;
|
|
888
909
|
}
|
|
889
|
-
function
|
|
910
|
+
function He(e, t) {
|
|
890
911
|
return e === t ? e !== 0 || 1 / e == 1 / t : e !== e && t !== t;
|
|
891
912
|
}
|
|
892
913
|
function M(e) {
|
|
@@ -902,7 +923,7 @@ function F(e, t) {
|
|
|
902
923
|
if (M(e)) return new Map(e);
|
|
903
924
|
if (N(e)) return new Set(e);
|
|
904
925
|
if (Array.isArray(e)) return Array.prototype.slice.call(e);
|
|
905
|
-
let n =
|
|
926
|
+
let n = Be(e);
|
|
906
927
|
if (t === !0 || t === "class_only" && !n) {
|
|
907
928
|
let t = Object.getOwnPropertyDescriptors(e);
|
|
908
929
|
delete t[w];
|
|
@@ -930,23 +951,23 @@ function I(e, t = !1) {
|
|
|
930
951
|
delete: L
|
|
931
952
|
}), Object.freeze(e), t && Object.values(e).forEach((e) => I(e, !0)), e);
|
|
932
953
|
}
|
|
933
|
-
function
|
|
954
|
+
function Ue() {
|
|
934
955
|
T(2);
|
|
935
956
|
}
|
|
936
|
-
var L = { value:
|
|
957
|
+
var L = { value: Ue };
|
|
937
958
|
function R(e) {
|
|
938
959
|
return typeof e != "object" || !e ? !0 : Object.isFrozen(e);
|
|
939
960
|
}
|
|
940
|
-
var
|
|
961
|
+
var We = {};
|
|
941
962
|
function z(e) {
|
|
942
|
-
let t =
|
|
963
|
+
let t = We[e];
|
|
943
964
|
return t || T(0, e), t;
|
|
944
965
|
}
|
|
945
966
|
var B;
|
|
946
|
-
function
|
|
967
|
+
function Ge() {
|
|
947
968
|
return B;
|
|
948
969
|
}
|
|
949
|
-
function
|
|
970
|
+
function Ke(e, t) {
|
|
950
971
|
return {
|
|
951
972
|
drafts_: [],
|
|
952
973
|
parent_: e,
|
|
@@ -955,47 +976,47 @@ function He(e, t) {
|
|
|
955
976
|
unfinalizedDrafts_: 0
|
|
956
977
|
};
|
|
957
978
|
}
|
|
958
|
-
function
|
|
979
|
+
function qe(e, t) {
|
|
959
980
|
t && (z("Patches"), e.patches_ = [], e.inversePatches_ = [], e.patchListener_ = t);
|
|
960
981
|
}
|
|
961
982
|
function V(e) {
|
|
962
|
-
H(e), e.drafts_.forEach(
|
|
983
|
+
H(e), e.drafts_.forEach(Ye), e.drafts_ = null;
|
|
963
984
|
}
|
|
964
985
|
function H(e) {
|
|
965
986
|
e === B && (B = e.parent_);
|
|
966
987
|
}
|
|
967
|
-
function
|
|
968
|
-
return B =
|
|
988
|
+
function Je(e) {
|
|
989
|
+
return B = Ke(B, e);
|
|
969
990
|
}
|
|
970
|
-
function
|
|
991
|
+
function Ye(e) {
|
|
971
992
|
let t = e[w];
|
|
972
993
|
t.type_ === 0 || t.type_ === 1 ? t.revoke_() : t.revoked_ = !0;
|
|
973
994
|
}
|
|
974
|
-
function
|
|
995
|
+
function Xe(e, t) {
|
|
975
996
|
t.unfinalizedDrafts_ = t.drafts_.length;
|
|
976
997
|
let n = t.drafts_[0];
|
|
977
|
-
return e !== void 0 && e !== n ? (n[w].modified_ && (V(t), T(4)), O(e) && (e = U(t, e), t.parent_ || W(t, e)), t.patches_ && z("Patches").generateReplacementPatches_(n[w].base_, e, t.patches_, t.inversePatches_)) : e = U(t, n, []), V(t), t.patches_ && t.patchListener_(t.patches_, t.inversePatches_), e ===
|
|
998
|
+
return e !== void 0 && e !== n ? (n[w].modified_ && (V(t), T(4)), O(e) && (e = U(t, e), t.parent_ || W(t, e)), t.patches_ && z("Patches").generateReplacementPatches_(n[w].base_, e, t.patches_, t.inversePatches_)) : e = U(t, n, []), V(t), t.patches_ && t.patchListener_(t.patches_, t.inversePatches_), e === Fe ? void 0 : e;
|
|
978
999
|
}
|
|
979
1000
|
function U(e, t, n) {
|
|
980
1001
|
if (R(t)) return t;
|
|
981
1002
|
let r = e.immer_.shouldUseStrictIteration(), i = t[w];
|
|
982
|
-
if (!i) return k(t, (r, a) =>
|
|
1003
|
+
if (!i) return k(t, (r, a) => Ze(e, i, t, r, a, n), r), t;
|
|
983
1004
|
if (i.scope_ !== e) return t;
|
|
984
1005
|
if (!i.modified_) return W(e, i.base_, !0), i.base_;
|
|
985
1006
|
if (!i.finalized_) {
|
|
986
1007
|
i.finalized_ = !0, i.scope_.unfinalizedDrafts_--;
|
|
987
1008
|
let t = i.copy_, a = t, o = !1;
|
|
988
|
-
i.type_ === 3 && (a = new Set(t), t.clear(), o = !0), k(a, (r, a) =>
|
|
1009
|
+
i.type_ === 3 && (a = new Set(t), t.clear(), o = !0), k(a, (r, a) => Ze(e, i, t, r, a, n, o), r), W(e, t, !1), n && e.patches_ && z("Patches").generatePatches_(i, n, e.patches_, e.inversePatches_);
|
|
989
1010
|
}
|
|
990
1011
|
return i.copy_;
|
|
991
1012
|
}
|
|
992
|
-
function
|
|
1013
|
+
function Ze(e, t, n, r, i, a, o) {
|
|
993
1014
|
if (i == null || typeof i != "object" && !o) return;
|
|
994
1015
|
let s = R(i);
|
|
995
1016
|
if (!(s && !o)) {
|
|
996
1017
|
if (process.env.NODE_ENV !== "production" && i === n && T(5), D(i)) {
|
|
997
1018
|
let o = U(e, i, a && t && t.type_ !== 3 && !j(t.assigned_, r) ? a.concat(r) : void 0);
|
|
998
|
-
if (
|
|
1019
|
+
if (Ve(n, r, o), D(o)) e.canAutoFreeze_ = !1;
|
|
999
1020
|
else return;
|
|
1000
1021
|
} else o && n.add(i);
|
|
1001
1022
|
if (O(i) && !s) {
|
|
@@ -1007,10 +1028,10 @@ function qe(e, t, n, r, i, a, o) {
|
|
|
1007
1028
|
function W(e, t, n = !1) {
|
|
1008
1029
|
!e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ && I(t, n);
|
|
1009
1030
|
}
|
|
1010
|
-
function
|
|
1031
|
+
function Qe(e, t) {
|
|
1011
1032
|
let n = Array.isArray(e), r = {
|
|
1012
1033
|
type_: +!!n,
|
|
1013
|
-
scope_: t ? t.scope_ :
|
|
1034
|
+
scope_: t ? t.scope_ : Ge(),
|
|
1014
1035
|
modified_: !1,
|
|
1015
1036
|
finalized_: !1,
|
|
1016
1037
|
assigned_: {},
|
|
@@ -1029,7 +1050,7 @@ var G = {
|
|
|
1029
1050
|
get(e, t) {
|
|
1030
1051
|
if (t === w) return e;
|
|
1031
1052
|
let n = P(e);
|
|
1032
|
-
if (!j(n, t)) return
|
|
1053
|
+
if (!j(n, t)) return $e(e, n, t);
|
|
1033
1054
|
let r = n[t];
|
|
1034
1055
|
return e.finalized_ || !O(r) ? r : r === q(e.base_, t) ? (Y(e), e.copy_[t] = X(r, e)) : r;
|
|
1035
1056
|
},
|
|
@@ -1040,12 +1061,12 @@ var G = {
|
|
|
1040
1061
|
return Reflect.ownKeys(P(e));
|
|
1041
1062
|
},
|
|
1042
1063
|
set(e, t, n) {
|
|
1043
|
-
let r =
|
|
1064
|
+
let r = et(P(e), t);
|
|
1044
1065
|
if (r?.set) return r.set.call(e.draft_, n), !0;
|
|
1045
1066
|
if (!e.modified_) {
|
|
1046
1067
|
let r = q(P(e), t), i = r?.[w];
|
|
1047
1068
|
if (i && i.base_ === n) return e.copy_[t] = n, e.assigned_[t] = !1, !0;
|
|
1048
|
-
if (
|
|
1069
|
+
if (He(n, r) && (n !== void 0 || j(e.base_, t))) return !0;
|
|
1049
1070
|
Y(e), J(e);
|
|
1050
1071
|
}
|
|
1051
1072
|
return e.copy_[t] === n && (n !== void 0 || t in e.copy_) || Number.isNaN(n) && Number.isNaN(e.copy_[t]) ? !0 : (e.copy_[t] = n, e.assigned_[t] = !0, !0);
|
|
@@ -1085,11 +1106,11 @@ function q(e, t) {
|
|
|
1085
1106
|
let n = e[w];
|
|
1086
1107
|
return (n ? P(n) : e)[t];
|
|
1087
1108
|
}
|
|
1088
|
-
function
|
|
1089
|
-
let r =
|
|
1109
|
+
function $e(e, t, n) {
|
|
1110
|
+
let r = et(t, n);
|
|
1090
1111
|
return r ? "value" in r ? r.value : r.get?.call(e.draft_) : void 0;
|
|
1091
1112
|
}
|
|
1092
|
-
function
|
|
1113
|
+
function et(e, t) {
|
|
1093
1114
|
if (!(t in e)) return;
|
|
1094
1115
|
let n = E(e);
|
|
1095
1116
|
for (; n;) {
|
|
@@ -1104,7 +1125,7 @@ function J(e) {
|
|
|
1104
1125
|
function Y(e) {
|
|
1105
1126
|
e.copy_ ||= F(e.base_, e.scope_.immer_.useStrictShallowCopy_);
|
|
1106
1127
|
}
|
|
1107
|
-
var
|
|
1128
|
+
var tt = class {
|
|
1108
1129
|
constructor(e) {
|
|
1109
1130
|
this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.useStrictIteration_ = !0, this.produce = (e, t, n) => {
|
|
1110
1131
|
if (typeof e == "function" && typeof t != "function") {
|
|
@@ -1118,15 +1139,15 @@ var Ze = class {
|
|
|
1118
1139
|
typeof t != "function" && T(6), n !== void 0 && typeof n != "function" && T(7);
|
|
1119
1140
|
let r;
|
|
1120
1141
|
if (O(e)) {
|
|
1121
|
-
let i =
|
|
1142
|
+
let i = Je(this), a = X(e, void 0), o = !0;
|
|
1122
1143
|
try {
|
|
1123
1144
|
r = t(a), o = !1;
|
|
1124
1145
|
} finally {
|
|
1125
1146
|
o ? V(i) : H(i);
|
|
1126
1147
|
}
|
|
1127
|
-
return
|
|
1148
|
+
return qe(i, n), Xe(r, i);
|
|
1128
1149
|
} else if (!e || typeof e != "object") {
|
|
1129
|
-
if (r = t(e), r === void 0 && (r = e), r ===
|
|
1150
|
+
if (r = t(e), r === void 0 && (r = e), r === Fe && (r = void 0), this.autoFreeze_ && I(r, !0), n) {
|
|
1130
1151
|
let t = [], i = [];
|
|
1131
1152
|
z("Patches").generateReplacementPatches_(e, r, t, i), n(t, i);
|
|
1132
1153
|
}
|
|
@@ -1145,15 +1166,15 @@ var Ze = class {
|
|
|
1145
1166
|
}, typeof e?.autoFreeze == "boolean" && this.setAutoFreeze(e.autoFreeze), typeof e?.useStrictShallowCopy == "boolean" && this.setUseStrictShallowCopy(e.useStrictShallowCopy), typeof e?.useStrictIteration == "boolean" && this.setUseStrictIteration(e.useStrictIteration);
|
|
1146
1167
|
}
|
|
1147
1168
|
createDraft(e) {
|
|
1148
|
-
O(e) || T(8), D(e) && (e =
|
|
1149
|
-
let t =
|
|
1169
|
+
O(e) || T(8), D(e) && (e = nt(e));
|
|
1170
|
+
let t = Je(this), n = X(e, void 0);
|
|
1150
1171
|
return n[w].isManual_ = !0, H(t), n;
|
|
1151
1172
|
}
|
|
1152
1173
|
finishDraft(e, t) {
|
|
1153
1174
|
let n = e && e[w];
|
|
1154
1175
|
(!n || !n.isManual_) && T(9);
|
|
1155
1176
|
let { scope_: r } = n;
|
|
1156
|
-
return
|
|
1177
|
+
return qe(r, t), Xe(void 0, r);
|
|
1157
1178
|
}
|
|
1158
1179
|
setAutoFreeze(e) {
|
|
1159
1180
|
this.autoFreeze_ = e;
|
|
@@ -1182,13 +1203,13 @@ var Ze = class {
|
|
|
1182
1203
|
}
|
|
1183
1204
|
};
|
|
1184
1205
|
function X(e, t) {
|
|
1185
|
-
let n = M(e) ? z("MapSet").proxyMap_(e, t) : N(e) ? z("MapSet").proxySet_(e, t) :
|
|
1186
|
-
return (t ? t.scope_ :
|
|
1206
|
+
let n = M(e) ? z("MapSet").proxyMap_(e, t) : N(e) ? z("MapSet").proxySet_(e, t) : Qe(e, t);
|
|
1207
|
+
return (t ? t.scope_ : Ge()).drafts_.push(n), n;
|
|
1187
1208
|
}
|
|
1188
|
-
function
|
|
1189
|
-
return D(e) || T(10, e),
|
|
1209
|
+
function nt(e) {
|
|
1210
|
+
return D(e) || T(10, e), rt(e);
|
|
1190
1211
|
}
|
|
1191
|
-
function
|
|
1212
|
+
function rt(e) {
|
|
1192
1213
|
if (!O(e) || R(e)) return e;
|
|
1193
1214
|
let t = e[w], n, r = !0;
|
|
1194
1215
|
if (t) {
|
|
@@ -1196,13 +1217,13 @@ function Z(e) {
|
|
|
1196
1217
|
t.finalized_ = !0, n = F(e, t.scope_.immer_.useStrictShallowCopy_), r = t.scope_.immer_.shouldUseStrictIteration();
|
|
1197
1218
|
} else n = F(e, !0);
|
|
1198
1219
|
return k(n, (e, t) => {
|
|
1199
|
-
|
|
1220
|
+
Ve(n, e, rt(t));
|
|
1200
1221
|
}, r), t && (t.finalized_ = !1), n;
|
|
1201
1222
|
}
|
|
1202
|
-
var
|
|
1223
|
+
var Z = new tt().produce;
|
|
1203
1224
|
//#endregion
|
|
1204
1225
|
//#region src/spaced-repetition/utils.ts
|
|
1205
|
-
function
|
|
1226
|
+
function it(e, t) {
|
|
1206
1227
|
let n = e + t, r = 0;
|
|
1207
1228
|
for (let e = 0; e < n.length; e++) {
|
|
1208
1229
|
let t = n.charCodeAt(e);
|
|
@@ -1210,10 +1231,10 @@ function et(e, t) {
|
|
|
1210
1231
|
}
|
|
1211
1232
|
return r;
|
|
1212
1233
|
}
|
|
1213
|
-
function
|
|
1214
|
-
return (
|
|
1234
|
+
function at(e, t) {
|
|
1235
|
+
return (it(e, t) >>> 0) / 4294967295;
|
|
1215
1236
|
}
|
|
1216
|
-
function
|
|
1237
|
+
function ot(e, t = /* @__PURE__ */ new Set()) {
|
|
1217
1238
|
if (e.reviewCards.length === 0 && e.newCards.length === 0) return;
|
|
1218
1239
|
if (e.reviewCards.length === 0) return Q(e.newCards, t) ?? e.newCards[0];
|
|
1219
1240
|
if (e.newCards.length === 0) return Q(e.reviewCards, t) ?? e.reviewCards[0];
|
|
@@ -1221,42 +1242,42 @@ function nt(e, t = /* @__PURE__ */ new Set()) {
|
|
|
1221
1242
|
if (!n) return r ?? e.newCards[0];
|
|
1222
1243
|
if (!r) return n ?? e.reviewCards[0];
|
|
1223
1244
|
let i = e.newCards.length, a = (.33 + i / (i + e.reviewCards.length)) / 2;
|
|
1224
|
-
return
|
|
1245
|
+
return at(n.card.id, r.card.id) < a ? n : r;
|
|
1225
1246
|
}
|
|
1226
1247
|
function Q(e, t) {
|
|
1227
1248
|
return e.find((e) => !t.has(e.card.id));
|
|
1228
1249
|
}
|
|
1229
|
-
function
|
|
1250
|
+
function st(e, t) {
|
|
1230
1251
|
let n = $(e, t);
|
|
1231
|
-
return n ?
|
|
1232
|
-
|
|
1252
|
+
return n ? Z(e, (e) => {
|
|
1253
|
+
lt(e, n);
|
|
1233
1254
|
}) : e;
|
|
1234
1255
|
}
|
|
1235
|
-
function
|
|
1256
|
+
function ct(t, n, r) {
|
|
1236
1257
|
let i = $(n, r);
|
|
1237
1258
|
if (!i) return n;
|
|
1238
|
-
let { nextCard: a } =
|
|
1239
|
-
return
|
|
1240
|
-
|
|
1259
|
+
let { nextCard: a } = De(i.cardReview, t, 30), o = a.due && (0, e.isSameDay)(a.due, /* @__PURE__ */ new Date());
|
|
1260
|
+
return Z(n, (e) => {
|
|
1261
|
+
lt(e, i), o && ut(e, {
|
|
1241
1262
|
...i,
|
|
1242
1263
|
cardReview: a
|
|
1243
1264
|
});
|
|
1244
1265
|
});
|
|
1245
1266
|
}
|
|
1246
|
-
function
|
|
1247
|
-
t.cardReview.state === "New" ? e.newCards = e.newCards.filter((e) => e.card.id !== t.card.id) : e.reviewCards = e.reviewCards.filter((e) => e.card.id !== t.card.id),
|
|
1267
|
+
function lt(e, t) {
|
|
1268
|
+
t.cardReview.state === "New" ? e.newCards = e.newCards.filter((e) => e.card.id !== t.card.id) : e.reviewCards = e.reviewCards.filter((e) => e.card.id !== t.card.id), dt(e, t.cardReview.state, "decrease");
|
|
1248
1269
|
}
|
|
1249
|
-
function
|
|
1270
|
+
function ut(e, t) {
|
|
1250
1271
|
if (t.cardReview.state === "New") {
|
|
1251
1272
|
let n = e.newCards.findIndex((e) => e.cardReview.due && t.cardReview.due && e.cardReview.due >= t.cardReview.due || e.cardReview.difficulty >= t.cardReview.difficulty);
|
|
1252
1273
|
n === -1 ? e.newCards.push(t) : e.newCards.splice(n, 0, t);
|
|
1253
1274
|
} else {
|
|
1254
|
-
let n =
|
|
1275
|
+
let n = ft(e, e.reviewCards);
|
|
1255
1276
|
e.reviewCards.splice(n, 0, t);
|
|
1256
1277
|
}
|
|
1257
|
-
|
|
1278
|
+
dt(e, t.cardReview.state, "increase");
|
|
1258
1279
|
}
|
|
1259
|
-
function
|
|
1280
|
+
function dt(e, t, n) {
|
|
1260
1281
|
let r = n === "increase" ? 1 : -1;
|
|
1261
1282
|
switch (t) {
|
|
1262
1283
|
case "New":
|
|
@@ -1278,14 +1299,14 @@ function st(e, t, n) {
|
|
|
1278
1299
|
function $(e, t) {
|
|
1279
1300
|
return e.newCards.find((e) => e.card.id === t) ?? e.reviewCards.find((e) => e.card.id === t);
|
|
1280
1301
|
}
|
|
1281
|
-
function
|
|
1302
|
+
function ft(e, t) {
|
|
1282
1303
|
if (t.length === 0) return 0;
|
|
1283
1304
|
let n = Math.max(4, Math.floor(t.length / 3));
|
|
1284
1305
|
return Math.min(n, t.length);
|
|
1285
1306
|
}
|
|
1286
1307
|
//#endregion
|
|
1287
1308
|
//#region src/spaced-repetition/session-manager.ts
|
|
1288
|
-
var
|
|
1309
|
+
var pt = 5, mt = {
|
|
1289
1310
|
newCards: [],
|
|
1290
1311
|
reviewCards: [],
|
|
1291
1312
|
stats: {
|
|
@@ -1294,7 +1315,7 @@ var lt = 5, ut = {
|
|
|
1294
1315
|
review: 0,
|
|
1295
1316
|
total: 0
|
|
1296
1317
|
}
|
|
1297
|
-
},
|
|
1318
|
+
}, ht = class {
|
|
1298
1319
|
recentlyReviewed = /* @__PURE__ */ new Set();
|
|
1299
1320
|
_reviewsCompleted = 0;
|
|
1300
1321
|
_correctGrades = 0;
|
|
@@ -1305,11 +1326,11 @@ var lt = 5, ut = {
|
|
|
1305
1326
|
};
|
|
1306
1327
|
}
|
|
1307
1328
|
nextCard(e) {
|
|
1308
|
-
return
|
|
1329
|
+
return ot(e, this.recentlyReviewed);
|
|
1309
1330
|
}
|
|
1310
1331
|
onRate(e, t) {
|
|
1311
1332
|
return this.recentlyReviewed.add(e), this.recentlyReviewed.size > 5 && this.recentlyReviewed.delete(this.recentlyReviewed.values().next().value), this._reviewsCompleted++, (t === "Good" || t === "Easy") && this._correctGrades++, this.getProgress();
|
|
1312
1333
|
}
|
|
1313
1334
|
};
|
|
1314
1335
|
//#endregion
|
|
1315
|
-
export { i as FSRS_RETENTION,
|
|
1336
|
+
export { i as FSRS_RETENTION, o as FSRS_RETENTION_FACTOR, a as FSRS_RETRIEVABILITY_DECAY, ht as FlashcardSessionManager, c as LEARNING_SETTINGS_LIMITS, s as MAX_CARDS_TO_FETCH, pt as RECENTLY_REVIEWED_SET_SIZE, l as THRESHOLD_CARDS_FOR_REFETCH, Pe as calculateRetentionPercentage, Ne as calculateRetrievability, mt as defaultSessionData, ot as getNextCardFromSession, Oe as getReviewDateForEachRating, $ as getSessionCard, De as gradeCard, u as isRecommendedLearningSettings, C as mergeFsrsCard, Me as newCardReview, ct as removeCardFromSessionData, st as skipCardFromSessionData };
|