@vue-skuilder/standalone-ui 0.2.28 → 0.2.30

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.
@@ -24642,6 +24642,7 @@ var init_v4 = __esmMin((() => {
24642
24642
  ContentNavigator: () => ContentNavigator,
24643
24643
  CouchDBToStaticPacker: () => CouchDBToStaticPacker,
24644
24644
  CourseLookup: () => CourseLookup,
24645
+ DEFAULT_REGULATOR_CONFIG: () => DEFAULT_REGULATOR_CONFIG,
24645
24646
  DIVERSITY_FLOOR: () => DIVERSITY_FLOOR,
24646
24647
  DIVERSITY_STRENGTH: () => DIVERSITY_STRENGTH,
24647
24648
  DocType: () => DocType,
@@ -24650,11 +24651,13 @@ var init_v4 = __esmMin((() => {
24650
24651
  FileSystemError: () => FileSystemError,
24651
24652
  GuestUsername: () => GuestUsername,
24652
24653
  HYDRATION_MARKER_ID: () => HYDRATION_MARKER_ID,
24654
+ INTAKE_CLOCK_KEY: () => INTAKE_CLOCK_KEY,
24653
24655
  Loggable: () => Loggable,
24654
24656
  NOT_SET: () => NOT_SET,
24655
24657
  NavigatorRole: () => NavigatorRole,
24656
24658
  NavigatorRoles: () => NavigatorRoles,
24657
24659
  Navigators: () => Navigators,
24660
+ PIPELINE_STAGES: () => PIPELINE_STAGES,
24658
24661
  QuotaRoundRobinMixer: () => QuotaRoundRobinMixer,
24659
24662
  REVIEW_TIME_FORMAT: () => REVIEW_TIME_FORMAT2,
24660
24663
  SessionController: () => SessionController,
@@ -24662,6 +24665,7 @@ var init_v4 = __esmMin((() => {
24662
24665
  TagFilteredContentSource: () => TagFilteredContentSource,
24663
24666
  _resetDataLayer: () => _resetDataLayer,
24664
24667
  aggregateOutcomesForGradient: () => aggregateOutcomesForGradient,
24668
+ applyReading: () => applyReading,
24665
24669
  areQuestionRecords: () => areQuestionRecords,
24666
24670
  buildStrategyStateId: () => buildStrategyStateId,
24667
24671
  captureMixerRun: () => captureMixerRun,
@@ -24680,6 +24684,7 @@ var init_v4 = __esmMin((() => {
24680
24684
  drainCapturedRuns: () => drainCapturedRuns,
24681
24685
  endSessionTracking: () => endSessionTracking,
24682
24686
  ensureAppDataDirectory: () => ensureAppDataDirectory,
24687
+ frozenMsAt: () => frozenMsAt,
24683
24688
  getActiveController: () => getActiveController,
24684
24689
  getActivePipeline: () => getActivePipeline,
24685
24690
  getAppDataDirectory: () => getAppDataDirectory,
@@ -24689,6 +24694,7 @@ var init_v4 = __esmMin((() => {
24689
24694
  getDbPath: () => getDbPath,
24690
24695
  getDefaultLearnableWeight: () => getDefaultLearnableWeight,
24691
24696
  getLapses: () => getLapses,
24697
+ getRegisteredFilterKind: () => getRegisteredFilterKind,
24692
24698
  getRegisteredNavigator: () => getRegisteredNavigator,
24693
24699
  getRegisteredNavigatorNames: () => getRegisteredNavigatorNames,
24694
24700
  getRegisteredNavigatorRole: () => getRegisteredNavigatorRole,
@@ -24702,6 +24708,8 @@ var init_v4 = __esmMin((() => {
24702
24708
  initializeDataDirectory: () => initializeDataDirectory,
24703
24709
  initializeDataLayer: () => initializeDataLayer,
24704
24710
  initializeNavigatorRegistry: () => initializeNavigatorRegistry,
24711
+ intakeHours: () => intakeHours,
24712
+ intakeReading: () => intakeReading,
24705
24713
  isDataShapeRegistered: () => isDataShapeRegistered,
24706
24714
  isDataShapeSchemaAvailable: () => isDataShapeSchemaAvailable,
24707
24715
  isFilter: () => isFilter,
@@ -24721,6 +24729,7 @@ var init_v4 = __esmMin((() => {
24721
24729
  newSessionId: () => newSessionId,
24722
24730
  parseCardHistoryID: () => parseCardHistoryID,
24723
24731
  pipelineDebugAPI: () => pipelineDebugAPI,
24732
+ planPipeline: () => planPipeline,
24724
24733
  processCustomQuestionsData: () => processCustomQuestionsData,
24725
24734
  recordCardPresentation: () => recordCardPresentation,
24726
24735
  recordUserOutcome: () => recordUserOutcome,
@@ -24734,12 +24743,16 @@ var init_v4 = __esmMin((() => {
24734
24743
  removeCustomQuestionTypes: () => removeCustomQuestionTypes,
24735
24744
  removeDataShape: () => removeDataShape,
24736
24745
  removeQuestionType: () => removeQuestionType,
24746
+ resetIntakeClock: () => resetIntakeClock,
24747
+ reviewMassReading: () => reviewMassReading,
24748
+ reviewWeight: () => reviewWeight,
24737
24749
  runPeriodUpdate: () => runPeriodUpdate,
24738
24750
  scoreAccuracyInZone: () => scoreAccuracyInZone,
24739
24751
  sessionDebugAPI: () => sessionDebugAPI,
24740
24752
  setDebugSessionId: () => setDebugSessionId,
24741
24753
  snapshotQueues: () => snapshotQueues,
24742
24754
  startSessionTracking: () => startSessionTracking,
24755
+ stepIntakeClock: () => stepIntakeClock,
24743
24756
  toggleSessionOverlay: () => toggleSessionOverlay,
24744
24757
  updateLearningState: () => updateLearningState,
24745
24758
  updateStrategyWeight: () => updateStrategyWeight,
@@ -24952,43 +24965,43 @@ function parseCardElo(t) {
24952
24965
  let u = c.reason.match(/card:\s*(\d+)/);
24953
24966
  return u ? parseInt(u[1], 10) : void 0;
24954
24967
  }
24955
- function buildRunReport(t, c, u, d, m, g, b, S, C, w, T) {
24956
- let E = new Set(S.map((t) => t.cardId)), toReport = (t) => ({
24968
+ function buildRunReport(t, c, u, d, m, g, b, S, C, w, T, E) {
24969
+ let D = new Set(S.map((t) => t.cardId)), toReport = (t) => ({
24957
24970
  cardId: t.cardId,
24958
24971
  courseId: t.courseId,
24959
24972
  origin: getOrigin(t),
24960
24973
  generator: t.provenance[0]?.strategyName || t.provenance[0]?.strategy,
24961
24974
  finalScore: t.score,
24962
- cardElo: parseCardElo(t.provenance),
24975
+ cardElo: t.cardElo ?? parseCardElo(t.provenance),
24963
24976
  provenance: t.provenance,
24964
24977
  tags: t.tags,
24965
- selected: E.has(t.cardId)
24966
- }), D = [], O = [], xr = [], Sr = 0;
24967
- for (let t of b) E.has(t.cardId) ? D.push(toReport(t)) : Sr < DISCARDED_KEEP_TOP ? (O.push(toReport(t)), Sr++) : xr.push(t);
24968
- let Cr = [...D, ...O], wr;
24969
- if (xr.length > 0) {
24978
+ selected: D.has(t.cardId)
24979
+ }), O = [], xr = [], Sr = [], Cr = 0;
24980
+ for (let t of b) D.has(t.cardId) ? O.push(toReport(t)) : Cr < DISCARDED_KEEP_TOP ? (xr.push(toReport(t)), Cr++) : Sr.push(t);
24981
+ let wr = [...O, ...xr], Tr;
24982
+ if (Sr.length > 0) {
24970
24983
  let t = Infinity, c = -Infinity, u = Infinity, d = -Infinity, m = !1;
24971
- for (let g of xr) {
24984
+ for (let g of Sr) {
24972
24985
  g.score < t && (t = g.score), g.score > c && (c = g.score);
24973
24986
  let b = parseCardElo(g.provenance);
24974
24987
  b !== void 0 && (m = !0, b < u && (u = b), b > d && (d = b));
24975
24988
  }
24976
24989
  let g = m ? `, ELO ${u}\u2013${d}` : "";
24977
- wr = {
24978
- count: xr.length,
24990
+ Tr = {
24991
+ count: Sr.length,
24979
24992
  scoreRange: [t, c],
24980
24993
  eloRange: m ? [u, d] : void 0,
24981
- note: `${xr.length} additional candidate(s) scored below the top ${DISCARDED_KEEP_TOP} near-misses and were not retained (score ${t.toExponential(2)}\u2013${c.toExponential(2)}${g}). Likely ELO-window pull remnants filtered out by hierarchy/lesson/priority gates.`
24994
+ note: `${Sr.length} additional candidate(s) scored below the top ${DISCARDED_KEEP_TOP} near-misses and were not retained (score ${t.toExponential(2)}\u2013${c.toExponential(2)}${g}). Likely ELO-window pull remnants filtered out by hierarchy/lesson/priority gates.`
24982
24995
  };
24983
24996
  }
24984
- let isUnselectedNew = (t) => !t.reviewID && !E.has(t.cardId), generatorScore = (t) => t.provenance[0]?.score ?? 0, Tr = new Set(b.map((t) => t.cardId)), hintExcluded = (t) => t.score > 0 && !Tr.has(t.cardId), Er;
24985
- for (let t of b) isUnselectedNew(t) && (!Er || t.score > Er.score) && (Er = t);
24986
- let Dr;
24987
- for (let t of T ?? b) !isUnselectedNew(t) || hintExcluded(t) || (!Dr || generatorScore(t) > generatorScore(Dr)) && (Dr = t);
24988
- let Or = Er || Dr ? {
24989
- ...Er ? { nextInLine: toReport(Er) } : {},
24990
- ...Dr && Dr.cardId !== Er?.cardId ? { topGenerated: toReport(Dr) } : {}
24991
- } : void 0, kr = S.filter((t) => getOrigin(t) === "review").length, Ar = S.filter((t) => getOrigin(t) === "new").length;
24997
+ let isUnselectedNew = (t) => !t.reviewID && !D.has(t.cardId), generatorScore = (t) => t.provenance[0]?.score ?? 0, Er = new Set(b.map((t) => t.cardId)), hintExcluded = (t) => t.score > 0 && !Er.has(t.cardId), Dr;
24998
+ for (let t of b) isUnselectedNew(t) && (!Dr || t.score > Dr.score) && (Dr = t);
24999
+ let Or;
25000
+ for (let t of T ?? b) !isUnselectedNew(t) || hintExcluded(t) || (!Or || generatorScore(t) > generatorScore(Or)) && (Or = t);
25001
+ let kr = Dr || Or ? {
25002
+ ...Dr ? { nextInLine: toReport(Dr) } : {},
25003
+ ...Or && Or.cardId !== Dr?.cardId ? { topGenerated: toReport(Or) } : {}
25004
+ } : void 0, Ar = S.filter((t) => getOrigin(t) === "review").length, jr = S.filter((t) => getOrigin(t) === "new").length;
24992
25005
  return {
24993
25006
  courseId: t,
24994
25007
  courseName: c,
@@ -24999,11 +25012,12 @@ function buildRunReport(t, c, u, d, m, g, b, S, C, w, T) {
24999
25012
  filters: g,
25000
25013
  hints: w,
25001
25014
  finalCount: S.length,
25002
- reviewsSelected: kr,
25003
- newSelected: Ar,
25004
- cards: Cr,
25005
- unselectedNew: Or,
25006
- discardedTail: wr
25015
+ reviewsSelected: Ar,
25016
+ newSelected: jr,
25017
+ cards: wr,
25018
+ unselectedNew: kr,
25019
+ discardedTail: Tr,
25020
+ ...E ? { regulators: E } : {}
25007
25021
  };
25008
25022
  }
25009
25023
  function formatProvenance(t) {
@@ -25212,6 +25226,16 @@ function mountPipelineDebugger() {
25212
25226
  function captureSrsBacklog(t) {
25213
25227
  snapshots.set(t.courseId, t);
25214
25228
  }
25229
+ function noteReviewPressure(t, c) {
25230
+ let u = snapshots.get(t);
25231
+ u && snapshots.set(t, {
25232
+ ...u,
25233
+ reviewMass: c.mass,
25234
+ healthyBacklog: c.healthyMass,
25235
+ backlogGrowthRate: c.rate,
25236
+ backlogMultiplier: c.multiplier
25237
+ });
25238
+ }
25215
25239
  function getSrsBacklogDebug() {
25216
25240
  return [...snapshots.values()].sort((t, c) => c.timestamp - t.timestamp);
25217
25241
  }
@@ -25297,32 +25321,183 @@ function unmetIntroExposeTags(t, c, u) {
25297
25321
  function pickTopByScore(t, c) {
25298
25322
  return [...t].sort((t, c) => c.score - t.score || t.cardId.localeCompare(c.cardId)).slice(0, c);
25299
25323
  }
25324
+ function clamp01(t) {
25325
+ return Math.min(1, Math.max(0, t));
25326
+ }
25327
+ function reviewWeight(t, c, u) {
25328
+ return t.reviewUrgency !== void 0 && c !== void 0 && c > 0 ? clamp01(t.reviewUrgency * (t.score / c)) : clamp01(t.score / u);
25329
+ }
25330
+ function reviewMassReading(t, c, u = DEFAULT_REGULATOR_CONFIG.reviewMass) {
25331
+ let d = t.reduce((t, d) => t + reviewWeight(d, c.get(d.cardId), u.referenceScore), 0);
25332
+ return {
25333
+ name: "review-mass",
25334
+ class: "review",
25335
+ urgency: d,
25336
+ multiplier: d > u.healthyMass ? u.rate ** +((d - u.healthyMass) / u.healthyMass) : 1,
25337
+ applied: t.length,
25338
+ inputs: {
25339
+ due: t.length,
25340
+ mass: d,
25341
+ healthyMass: u.healthyMass
25342
+ }
25343
+ };
25344
+ }
25345
+ function resetIntakeClock(t) {
25346
+ return {
25347
+ lastNewAt: new Date(t).toISOString(),
25348
+ frozenMs: 0,
25349
+ unservableSince: null
25350
+ };
25351
+ }
25352
+ function frozenMsAt(t, c) {
25353
+ let u = t.unservableSince ? Math.max(0, c - Date.parse(t.unservableSince)) : 0;
25354
+ return t.frozenMs + u;
25355
+ }
25356
+ function intakeHours(t, c) {
25357
+ let u = c - Date.parse(t.lastNewAt);
25358
+ return Math.max(0, u - frozenMsAt(t, c)) / 36e5;
25359
+ }
25360
+ function stepIntakeClock(t, c, u) {
25361
+ return u === 0 && !t.unservableSince ? {
25362
+ ...t,
25363
+ unservableSince: new Date(c).toISOString()
25364
+ } : u > 0 && t.unservableSince ? {
25365
+ ...t,
25366
+ frozenMs: frozenMsAt(t, c),
25367
+ unservableSince: null
25368
+ } : t;
25369
+ }
25370
+ function intakeReading(t, c, u, d = DEFAULT_REGULATOR_CONFIG.intake) {
25371
+ let m = intakeHours(t, c);
25372
+ return {
25373
+ name: "intake",
25374
+ class: "new",
25375
+ urgency: m,
25376
+ multiplier: u.eligibleNew > 0 ? d.rate ** +(m / d.scaleHours) : 1,
25377
+ applied: u.eligibleNew,
25378
+ inputs: {
25379
+ hoursSinceNew: m,
25380
+ frozenHours: frozenMsAt(t, c) / 36e5,
25381
+ eligibleNew: u.eligibleNew,
25382
+ newCandidates: u.newCandidates
25383
+ }
25384
+ };
25385
+ }
25386
+ function applyReading(t, c) {
25387
+ if (c.multiplier === 1) return;
25388
+ let u = c.name === "review-mass" ? `review mass ${c.urgency.toFixed(1)} (healthy ${c.inputs.healthyMass}) \u2192 \xD7${c.multiplier.toFixed(2)}` : `${c.urgency.toFixed(1)}h since a new card \u2192 \xD7${c.multiplier.toFixed(2)}`;
25389
+ for (let d of t) d.score *= c.multiplier, d.provenance.push({
25390
+ strategy: "regulator",
25391
+ strategyName: `Regulator: ${REGULATOR_LABEL[c.name]}`,
25392
+ strategyId: `regulator-${c.name}`,
25393
+ action: c.multiplier > 1 ? "boosted" : "penalized",
25394
+ score: d.score,
25395
+ reason: u
25396
+ });
25397
+ }
25300
25398
  function computeMultiplier(t, c, u, d) {
25301
25399
  let m = t / c, g = Math.exp(-(m * m));
25302
25400
  return u + (d - u) * g;
25303
25401
  }
25304
- function createEloDistanceFilter(t) {
25305
- let c = t?.halfLife ?? DEFAULT_HALF_LIFE, u = t?.minMultiplier ?? DEFAULT_MIN_MULTIPLIER, d = t?.maxMultiplier ?? DEFAULT_MAX_MULTIPLIER;
25402
+ function resolveConfig(t) {
25306
25403
  return {
25307
- name: "ELO Distance Filter",
25308
- async transform(t, m) {
25309
- let { course: g, userElo: b } = m, S = t.map((t) => t.cardId), C = await g.getCardEloData(S);
25310
- return t.map((t, m) => {
25311
- let g = C[m]?.global?.score ?? 1e3, S = Math.abs(g - b), w = computeMultiplier(S, c, u, d), T = t.score * w, E = w < d - .01 ? "penalized" : "passed";
25312
- return {
25313
- ...t,
25314
- score: T,
25315
- provenance: [...t.provenance, {
25316
- strategy: "eloDistance",
25317
- strategyName: "ELO Distance Filter",
25318
- strategyId: "ELO_DISTANCE_FILTER",
25319
- action: E,
25320
- score: T,
25321
- reason: `ELO distance ${Math.round(S)} (card: ${Math.round(g)}, user: ${Math.round(b)}) \u2192 ${w.toFixed(2)}x`
25322
- }]
25323
- };
25324
- });
25404
+ ...DEFAULT_ELO_DISTANCE_CONFIG,
25405
+ ...t
25406
+ };
25407
+ }
25408
+ function readMultiDimElo() {
25409
+ try {
25410
+ return typeof localStorage < "u" && localStorage.getItem(MULTI_DIM_ELO_KEY) === "true";
25411
+ } catch {
25412
+ return !1;
25413
+ }
25414
+ }
25415
+ function mountMultiDimEloToggle() {
25416
+ if (typeof window > "u") return;
25417
+ let t = window;
25418
+ t.skuilder = t.skuilder || {}, Object.defineProperty(t.skuilder, "multiDimElo", {
25419
+ configurable: !0,
25420
+ enumerable: !0,
25421
+ get: () => multiDimElo,
25422
+ set: (t) => {
25423
+ multiDimElo = t === !0;
25424
+ try {
25425
+ multiDimElo ? localStorage.setItem(MULTI_DIM_ELO_KEY, "true") : localStorage.removeItem(MULTI_DIM_ELO_KEY);
25426
+ } catch (t) {
25427
+ logger.warn(`[EloDistance] multiDimElo not persisted (localStorage unavailable): ${t}`);
25428
+ }
25429
+ logger.info(`[EloDistance] multiDimElo ${multiDimElo ? "on: tag-aware" : "off: per strategy config"} ELO distance from the next replan`);
25430
+ }
25431
+ });
25432
+ }
25433
+ function tagAwareGap(t, c, u, d) {
25434
+ let m = c.global.score - u.global.score, g = [];
25435
+ for (let m of t) {
25436
+ let t = u.tags[m];
25437
+ if (!t || t.score === COUNT_ONLY_SENTINEL || t.count < d) continue;
25438
+ let b = c.tags[m]?.score ?? c.global.score;
25439
+ g.push({
25440
+ tag: m,
25441
+ gap: b - t.score,
25442
+ weight: t.count / (t.count + TAG_CONFIDENCE_HALF)
25443
+ });
25444
+ }
25445
+ if (g.length === 0) return {
25446
+ gap: m,
25447
+ globalGap: m,
25448
+ tags: g
25449
+ };
25450
+ let b = g.reduce((t, c) => t + c.weight, 0), S = g.reduce((t, c) => t + c.weight * c.gap, 0) / b, C = b / (b + 1);
25451
+ return {
25452
+ gap: C * S + (1 - C) * m,
25453
+ globalGap: m,
25454
+ tags: g
25455
+ };
25456
+ }
25457
+ function tagReason(t, c) {
25458
+ let u = [...t].sort((t, c) => Math.abs(c.gap) * c.weight - Math.abs(t.gap) * t.weight).slice(0, 3).map((t) => `${t.tag} ${t.gap >= 0 ? "+" : ""}${Math.round(t.gap)}`).join(", "), d = t.length > 3 ? `, +${t.length - 3} more` : "";
25459
+ return ` on ${t.length} shared tag(s) [${u}${d}] (global ${c >= 0 ? "+" : ""}${Math.round(c)})`;
25460
+ }
25461
+ async function applyEloDistance(t, c, u, d) {
25462
+ let { course: m, userElo: g, userCourseElo: b } = c, { halfLife: S, minMultiplier: C, maxMultiplier: w } = u, T = (u.tagAware || multiDimElo) && b !== void 0, E = t.filter((t) => T || t.cardElo === void 0).map((t) => t.cardId), D = /* @__PURE__ */ new Map();
25463
+ if (E.length > 0) {
25464
+ let t = await m.getCardEloData(E);
25465
+ E.forEach((c, u) => {
25466
+ t[u] && D.set(c, t[u]);
25467
+ });
25468
+ }
25469
+ return t.map((t) => {
25470
+ let c = D.get(t.cardId), m = c?.global?.score ?? t.cardElo ?? DEFAULT_CARD_ELO, E = Math.abs(m - g), O = "";
25471
+ if (T) {
25472
+ let d = c ? tagAwareGap(t.tags ?? [], c, b, u.minTagCount) : void 0;
25473
+ d && (E = Math.abs(d.gap)), O = d?.tags.length ? `, tag-aware${tagReason(d.tags, d.globalGap)}` : ", tag-aware: global (no shared tags)";
25325
25474
  }
25475
+ let xr = computeMultiplier(E, S, C, w), Sr = t.score * xr, Cr = xr < w - .01 ? "penalized" : "passed";
25476
+ return {
25477
+ ...t,
25478
+ cardElo: m,
25479
+ score: Sr,
25480
+ provenance: [...t.provenance, {
25481
+ strategy: "eloDistance",
25482
+ strategyName: d.name,
25483
+ strategyId: d.strategyId,
25484
+ action: Cr,
25485
+ score: Sr,
25486
+ reason: `ELO distance ${Math.round(E)} (card: ${Math.round(m)}, user: ${Math.round(g)})${O} \u2192 ${xr.toFixed(2)}x`
25487
+ }]
25488
+ };
25489
+ });
25490
+ }
25491
+ function createEloDistanceFilter(t) {
25492
+ let c = resolveConfig(t), u = {
25493
+ name: "ELO Distance Filter",
25494
+ strategyId: "ELO_DISTANCE_FILTER"
25495
+ };
25496
+ return {
25497
+ name: u.name,
25498
+ kind: "signal",
25499
+ liveOnly: !0,
25500
+ transform: (t, d) => applyEloDistance(t, d, c, u)
25326
25501
  };
25327
25502
  }
25328
25503
  function aggregateOutcomesForGradient(t, c) {
@@ -25611,10 +25786,60 @@ function createDefaultSrsStrategy(t) {
25611
25786
  serializedData: ""
25612
25787
  };
25613
25788
  }
25789
+ function createDefaultEloDistanceStrategy(t) {
25790
+ return {
25791
+ _id: "NAVIGATION_STRATEGY-eloDistance-default",
25792
+ docType: "NAVIGATION_STRATEGY",
25793
+ name: "ELO Distance (default)",
25794
+ description: "Scales every candidate, new or review, by its distance from the learner's ELO",
25795
+ implementingClass: "eloDistance",
25796
+ course: t,
25797
+ serializedData: JSON.stringify(DEFAULT_ELO_DISTANCE_CONFIG)
25798
+ };
25799
+ }
25614
25800
  function createDefaultPipeline(t, c) {
25615
- let u = c.getCourseID(), d = new ELONavigator(t, c, createDefaultEloStrategy(u)), m = new SRSNavigator(t, c, createDefaultSrsStrategy(u)), g = new CompositeGenerator([d, m]), b = createEloDistanceFilter();
25801
+ let u = c.getCourseID(), d = new ELONavigator(t, c, createDefaultEloStrategy(u)), m = new SRSNavigator(t, c, createDefaultSrsStrategy(u)), g = new CompositeGenerator([d, m]), b = new EloDistanceFilter(t, c, createDefaultEloDistanceStrategy(u));
25616
25802
  return new Pipeline(g, [b], t, c);
25617
25803
  }
25804
+ function planned(t, c, u) {
25805
+ let d = c === "filter" ? getRegisteredFilterKind(t.implementingClass) : void 0;
25806
+ return {
25807
+ role: c,
25808
+ origin: u,
25809
+ name: t.name,
25810
+ implementingClass: t.implementingClass,
25811
+ strategy: t,
25812
+ ...d ? { kind: d } : {}
25813
+ };
25814
+ }
25815
+ function planPipeline(t, c) {
25816
+ if (t.length === 0) return {
25817
+ kind: "default",
25818
+ generators: [planned(createDefaultEloStrategy(c), "generator", "default-pipeline"), planned(createDefaultSrsStrategy(c), "generator", "default-pipeline")],
25819
+ filters: [planned(createDefaultEloDistanceStrategy(c), "filter", "default-pipeline")],
25820
+ skipped: [],
25821
+ warnings: [],
25822
+ notes: [],
25823
+ regulators: DEFAULT_REGULATOR_CONFIG
25824
+ };
25825
+ let u = [], d = [], m = [], g = [];
25826
+ for (let c of t) isGenerator(c.implementingClass) ? u.push(planned(c, "generator", "strategy-doc")) : isFilter(c.implementingClass) ? d.push(planned(c, "filter", "strategy-doc")) : (m.push({
25827
+ strategy: c,
25828
+ reason: "not a registered generator or filter"
25829
+ }), g.push(`Unknown strategy type '${c.implementingClass}', skipping: ${c.name}`));
25830
+ let b = new Set(u.map((t) => t.implementingClass));
25831
+ b.has(createDefaultEloStrategy(c).implementingClass) || u.push(planned(createDefaultEloStrategy(c), "generator", "assembler-default")), b.has(createDefaultSrsStrategy(c).implementingClass) || u.push(planned(createDefaultSrsStrategy(c), "generator", "assembler-default"));
25832
+ let S = createDefaultEloDistanceStrategy(c);
25833
+ return d.some((t) => t.implementingClass === S.implementingClass) || d.push(planned(S, "filter", "assembler-default")), d.sort((t, c) => t.name.localeCompare(c.name)), {
25834
+ kind: "assembled",
25835
+ generators: u,
25836
+ filters: d,
25837
+ skipped: m,
25838
+ warnings: g,
25839
+ notes: [],
25840
+ regulators: DEFAULT_REGULATOR_CONFIG
25841
+ };
25842
+ }
25618
25843
  function registerNavigator(t, c, u) {
25619
25844
  navigatorRegistry.set(t, {
25620
25845
  constructor: c,
@@ -25630,6 +25855,9 @@ function hasRegisteredNavigator(t) {
25630
25855
  function getRegisteredNavigatorRole(t) {
25631
25856
  return navigatorRegistry.get(t)?.role;
25632
25857
  }
25858
+ function getRegisteredFilterKind(t) {
25859
+ return navigatorRegistry.get(t)?.constructor?.kind;
25860
+ }
25633
25861
  function getRegisteredNavigatorNames() {
25634
25862
  return Array.from(navigatorRegistry.keys());
25635
25863
  }
@@ -25637,13 +25865,14 @@ async function initializeNavigatorRegistry() {
25637
25865
  logger.debug("[NavigatorRegistry] Initializing built-in navigators...");
25638
25866
  let [t, c] = await Promise.all([Promise.resolve().then(() => (init_elo(), elo_exports)), Promise.resolve().then(() => (init_srs(), srs_exports))]), u = await Promise.resolve().then(() => (init_prescribed(), prescribed_exports));
25639
25867
  registerNavigator("elo", t.default), registerNavigator("srs", c.default), registerNavigator("prescribed", u.default);
25640
- let [d, m, g, b] = await Promise.all([
25868
+ let [d, m, g, b, S] = await Promise.all([
25641
25869
  Promise.resolve().then(() => (init_hierarchyDefinition(), hierarchyDefinition_exports)),
25642
25870
  Promise.resolve().then(() => (init_interferenceMitigator(), interferenceMitigator_exports)),
25643
25871
  Promise.resolve().then(() => (init_relativePriority(), relativePriority_exports)),
25644
- Promise.resolve().then(() => (init_userTagPreference(), userTagPreference_exports))
25872
+ Promise.resolve().then(() => (init_userTagPreference(), userTagPreference_exports)),
25873
+ Promise.resolve().then(() => (init_eloDistance(), eloDistance_exports))
25645
25874
  ]);
25646
- registerNavigator("hierarchyDefinition", d.default), registerNavigator("interferenceMitigator", m.default), registerNavigator("relativePriority", g.default), registerNavigator("userTagPreference", b.default), logger.debug(`[NavigatorRegistry] Initialized ${navigatorRegistry.size} navigators: ${getRegisteredNavigatorNames().join(", ")}`);
25875
+ registerNavigator("hierarchyDefinition", d.default), registerNavigator("interferenceMitigator", m.default), registerNavigator("relativePriority", g.default), registerNavigator("userTagPreference", b.default), registerNavigator("eloDistance", S.default), logger.debug(`[NavigatorRegistry] Initialized ${navigatorRegistry.size} navigators: ${getRegisteredNavigatorNames().join(", ")}`);
25647
25876
  }
25648
25877
  function getCardOrigin(t) {
25649
25878
  if (t.provenance.length === 0) throw Error("Card has no provenance - cannot determine origin");
@@ -26264,8 +26493,8 @@ function hintsHtml(t) {
26264
26493
  }
26265
26494
  function backlogHtml(t) {
26266
26495
  return t.length ? `<div style="margin-bottom:6px"><div style="color:#93c5fd">review backpressure</div>${t.map((t) => {
26267
- let c = t.backlogMultiplier >= 3, u = t.backlogMultiplier <= 1 ? "#86efac" : c ? "#fca5a5" : "#fcd34d", d = t.backlogMultiplier > 1 ? `climbing (\xD7${t.backlogGrowthRate.toFixed(2)} per ${t.healthyBacklog}-review excess, unbounded)` : "healthy — no pressure", m = t.topReviewScore === null ? "—" : t.topReviewScore.toFixed(2), g = t.nextDueIn ? ` <span style="opacity:.6">\xB7 next due ${esc(t.nextDueIn)}</span>` : "";
26268
- return `<div style="margin-left:6px"><span style="opacity:.7">${esc(t.courseId.slice(0, 8))}</span> due ${t.dueNow}/${t.scheduledTotal} <span style="opacity:.6">(healthy ${t.healthyBacklog})</span>${g}<div style="margin-left:6px">pressure <span style="color:${u}">\xD7${t.backlogMultiplier.toFixed(2)}</span> <span style="opacity:.6">${d} \xB7 top review ${m}</span></div></div>`;
26496
+ let c = t.backlogMultiplier >= 3, u = t.backlogMultiplier <= 1 ? "#86efac" : c ? "#fca5a5" : "#fcd34d", d = t.backlogMultiplier > 1 ? `climbing (\xD7${t.backlogGrowthRate.toFixed(2)} per ${t.healthyBacklog} of mass in excess, unbounded)` : "healthy — no pressure", m = t.reviewMass === null ? "" : ` \xB7 mass ${t.reviewMass.toFixed(1)}`, g = t.topReviewScore === null ? "—" : t.topReviewScore.toFixed(2), b = t.nextDueIn ? ` <span style="opacity:.6">\xB7 next due ${esc(t.nextDueIn)}</span>` : "";
26497
+ return `<div style="margin-left:6px"><span style="opacity:.7">${esc(t.courseId.slice(0, 8))}</span> due ${t.dueNow}/${t.scheduledTotal}${m} <span style="opacity:.6">(healthy mass ${t.healthyBacklog})</span>${b}<div style="margin-left:6px">pressure <span style="color:${u}">\xD7${t.backlogMultiplier.toFixed(2)}</span> <span style="opacity:.6">${d} \xB7 top review ${g}</span></div></div>`;
26269
26498
  }).join("")}</div>` : "";
26270
26499
  }
26271
26500
  function pressureColor(t, c) {
@@ -26333,8 +26562,8 @@ function snapshotToText(t) {
26333
26562
  if (u && (u.boostTags && Object.keys(u.boostTags).length && d.push(` boost: ${Object.entries(u.boostTags).map(([t, c]) => `${t}\xD7${c}`).join(", ")}`), u.boostCards && Object.keys(u.boostCards).length && d.push(` boostCards: ${Object.entries(u.boostCards).map(([t, c]) => `${t}\xD7${c}`).join(", ")}`), u.requireCards?.length && d.push(` require: ${u.requireCards.join(", ")}`), u.requireTags?.length && d.push(` requireTags: ${u.requireTags.join(", ")}`), u.excludeTags?.length && d.push(` exclude: ${u.excludeTags.join(", ")}`), u.excludeCards?.length && d.push(` excludeCards: ${u.excludeCards.join(", ")}`)), c.push(d.length ? d.join("\n") : " none"), t.reviewBacklog.length) {
26334
26563
  c.push(""), c.push("review backpressure:");
26335
26564
  for (let u of t.reviewBacklog) {
26336
- let t = u.backlogMultiplier > 1 ? "climbing" : "healthy", d = u.topReviewScore === null ? "—" : u.topReviewScore.toFixed(2), m = u.nextDueIn ? `, next due ${u.nextDueIn}` : "";
26337
- c.push(` ${u.courseId.slice(0, 8)}: due ${u.dueNow}/${u.scheduledTotal} (healthy ${u.healthyBacklog})${m}; pressure \xD7${u.backlogMultiplier.toFixed(2)} ${t}; top review ${d}`);
26565
+ let t = u.backlogMultiplier > 1 ? "climbing" : "healthy", d = u.topReviewScore === null ? "—" : u.topReviewScore.toFixed(2), m = u.nextDueIn ? `, next due ${u.nextDueIn}` : "", g = u.reviewMass === null ? "" : `, mass ${u.reviewMass.toFixed(1)}`;
26566
+ c.push(` ${u.courseId.slice(0, 8)}: due ${u.dueNow}/${u.scheduledTotal}${g} (healthy mass ${u.healthyBacklog})${m}; pressure \xD7${u.backlogMultiplier.toFixed(2)} ${t}; top review ${d}`);
26338
26567
  }
26339
26568
  }
26340
26569
  if (t.strategyPressure.length) {
@@ -26499,6 +26728,14 @@ function toRunCardTrail(t) {
26499
26728
  }))
26500
26729
  };
26501
26730
  }
26731
+ function persistedReading(t) {
26732
+ return {
26733
+ ...t,
26734
+ urgency: sig4(t.urgency),
26735
+ multiplier: sig4(t.multiplier),
26736
+ inputs: Object.fromEntries(Object.entries(t.inputs).map(([t, c]) => [t, sig4(c)]))
26737
+ };
26738
+ }
26502
26739
  function persistedRunCards(t) {
26503
26740
  let c = t.cards.filter((t) => t.selected), u = t.cards.filter((t) => !t.selected).slice(0, PERSISTED_RUNNERS_UP);
26504
26741
  return [...c, ...u].map(toRunCard);
@@ -27010,7 +27247,7 @@ async function registerCustomQuestionTypes(t, c, u, d) {
27010
27247
  };
27011
27248
  }
27012
27249
  }
27013
- var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import___vite_browser_external, import___vite_browser_external$1, import___vite_browser_external$2, __defProp, __getOwnPropNames, __glob, __esm, __export, init_adminDB, init_classroomDB, init_SyncStrategy, isDevelopment, logger, init_logger, GuestUsername, log, DocType, DocTypePrefixes, init_types_legacy, init_util, pouchdb_setup_default, init_pouchdb_setup, Loggable, init_Loggable, UpdateQueue, init_updateQueue, CLIENT_CACHE, init_clientCache, AlreadyTaggedErr, init_courseAPI, courseLookupDBTitle, CourseLookup, init_courseLookupDB, diversityRerank_exports, DIVERSITY_STRENGTH, DIVERSITY_FLOOR, STRATEGY, STRATEGY_ID, STRATEGY_NAME, init_diversityRerank, PipelineDebugger_exports, _activePipeline, MAX_RUNS, runHistory, _currentSessionId, _pendingRuns, DISCARDED_KEEP_TOP, _uiContainer, _selectedRunIndex, _cardSearchQuery, pipelineDebugAPI, init_PipelineDebugger, SrsDebugger_exports, snapshots, init_SrsDebugger, StrategyPressureDebugger_exports, snapshots2, init_StrategyPressureDebugger, CompositeGenerator_exports, AggregationMode, DEFAULT_AGGREGATION_MODE, FREQUENCY_BOOST_FACTOR, CompositeGenerator, init_CompositeGenerator, elo_exports, ELO_RELEVANCE_SIGMA, ELONavigator, init_elo, generators_exports, init_generators, prescribed_exports, DEFAULT_FRESHNESS_WINDOW, DEFAULT_MAX_DIRECT_PER_RUN, DEFAULT_MAX_SUPPORT_PER_RUN, DEFAULT_HIERARCHY_DEPTH, DEFAULT_MIN_COUNT, DEFAULT_PRACTICE_MIN_COUNT, DEFAULT_MAX_PRACTICE_PER_RUN, BASE_TARGET_SCORE, BASE_SUPPORT_SCORE, DISCOVERED_SUPPORT_SCORE, BASE_PRACTICE_SCORE, PRACTICE_BASE_MULT, MAX_PRACTICE_MULTIPLIER, PRACTICE_STALENESS_BUMP_PER_DAY, MAX_TARGET_MULTIPLIER, MAX_SUPPORT_MULTIPLIER, PRESCRIBED_DEBUG_VERSION, PrescribedCardsGenerator, init_prescribed, srs_exports, DEFAULT_HEALTHY_BACKLOG, BACKLOG_GROWTH_RATE, SRSNavigator, init_srs, types_exports, init_types, globImport_generators, init_, DEFAULT_LEARNABLE_WEIGHT, init_contentNavigationStrategy, WeightedFilter_exports, WeightedFilter, init_WeightedFilter, eloDistance_exports, DEFAULT_HALF_LIFE, DEFAULT_MIN_MULTIPLIER, DEFAULT_MAX_MULTIPLIER, init_eloDistance, hierarchyDefinition_exports, DEFAULT_MIN_COUNT2, HierarchyDefinitionNavigator, init_hierarchyDefinition, userTagPreference_exports, UserTagPreferenceFilter, init_userTagPreference, filters_exports, init_filters, inferredPreferenceStub_exports, INFERRED_PREFERENCE_NAVIGATOR_STUB, init_inferredPreferenceStub, interferenceMitigator_exports, DEFAULT_MIN_COUNT3, DEFAULT_MIN_ELAPSED_DAYS, DEFAULT_INTERFERENCE_DECAY, InterferenceMitigatorNavigator, init_interferenceMitigator, relativePriority_exports, DEFAULT_PRIORITY, DEFAULT_PRIORITY_INFLUENCE, DEFAULT_COMBINE_MODE, RelativePriorityNavigator, init_relativePriority, types_exports2, init_types2, userGoalStub_exports, USER_GOAL_NAVIGATOR_STUB, init_userGoalStub, globImport_filters, init_2, init_gradient, MIN_OBSERVATIONS_FOR_UPDATE, LEARNING_RATE, MAX_WEIGHT_DELTA, MIN_R_SQUARED_FOR_GRADIENT, FLAT_GRADIENT_THRESHOLD, MAX_HISTORY_LENGTH, init_learning, init_signal, init_recording, MIN_SPREAD, MAX_SPREAD, MIN_WEIGHT, MAX_WEIGHT, init_orchestration, Pipeline_exports, VERBOSE_RESULTS, Pipeline, init_Pipeline, defaults_exports, init_defaults, PipelineAssembler_exports, PipelineAssembler, init_PipelineAssembler, globImport, init_3, navigators_exports, navigatorRegistry, Navigators, NavigatorRole, NavigatorRoles, ContentNavigator, init_navigators, CoursesDB, CourseDB, init_courseDB, classroomLookupDBTitle, CLASSROOM_CONFIG, ClassroomDBBase, StudentClassroomDB, TeacherClassroomDB, ClassroomLookupDB, init_classroomDB2, AdminDB, init_adminDB2, CourseSyncService_exports, DEFAULT_REPLICATION, CourseSyncService, init_CourseSyncService, init_auth, CouchDBSyncStrategy_exports, log2, CouchDBSyncStrategy, init_CouchDBSyncStrategy, isBrowser, GUEST_LOCAL_DB, localUserDB, pouchDBincludeCredentialsConfig, REVIEW_TIME_FORMAT, init_couch, duration, init_SpacedRepetition, SrsService, init_SrsService, init_tagRecent, EloService, init_EloService, ResponseProcessor, init_ResponseProcessor, CardHydrationService, init_CardHydrationService, ItemQueue, init_ItemQueue, init_studySession, init_types3, CouchDBToStaticPacker, init_CouchDBToStaticPacker, init_packer, DEFAULT_MIGRATION_OPTIONS, init_types4, FileSystemError, init_FileSystemAdapter, nodeFS, init_validation, nodeFS2, nodePath, StaticToCouchDBMigrator, init_StaticToCouchDBMigrator, init_migrator, init_dataDirectory, init_util2, QuotaRoundRobinMixer, init_SourceMixer, MAX_RUNS2, runHistory2, mixerDebugAPI, init_MixerDebugger, activeController, OVERLAY_ID, POLL_MS, INLINE_THRESHOLD, SPINNER_FRAMES, spinnerFrame, overlayEl, pollHandle, lastSnapshot, copyFlashUntil, minified, expanded, init_SessionOverlay, activeSession, sessionHistory, MAX_HISTORY, sessionDebugAPI, init_SessionDebugger, PERSISTED_RUNNERS_UP, SessionController, init_SessionController, TagFilteredContentSource, init_TagFilteredContentSource, init_study, REVIEW_TIME_FORMAT2, log3, init_userDBHelpers, UsrCrsData, init_user_course_relDB, log4, HYDRATION_TIMEOUT_MS, BaseUser, userCoursesDoc, userClassroomsDoc, init_BaseUserDB, init_common, PouchDataLayerProvider_exports, CouchDataLayerProvider, init_PouchDataLayerProvider, pathUtils, nodeFS3, StaticDataUnpacker, init_StaticDataUnpacker, StaticCourseDB, init_courseDB2, StaticCoursesDB, init_coursesDB, NoOpSyncStrategy, init_NoOpSyncStrategy, StaticDataLayerProvider_exports, StaticDataLayerProvider, init_StaticDataLayerProvider, NOT_SET, ENV, dataLayerInstance, init_factory, init_contentSource, init_courseDB3, init_dataLayerProvider, init_userDB, init_interfaces, init_user, init_strategyState, init_userOutcome, HYDRATION_MARKER_ID, init_hydration, init_cardProcessor, init_types5, init_bulkImport, userDBDebugAPI, init_UserDBDebugger, init_core, init_dist = __esmMin((() => {
27250
+ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import___vite_browser_external, import___vite_browser_external$1, import___vite_browser_external$2, __defProp, __getOwnPropNames, __glob, __esm, __export, init_adminDB, init_classroomDB, init_SyncStrategy, isDevelopment, logger, init_logger, GuestUsername, log, DocType, DocTypePrefixes, init_types_legacy, init_util, pouchdb_setup_default, init_pouchdb_setup, Loggable, init_Loggable, UpdateQueue, init_updateQueue, CLIENT_CACHE, init_clientCache, AlreadyTaggedErr, init_courseAPI, courseLookupDBTitle, CourseLookup, init_courseLookupDB, diversityRerank_exports, DIVERSITY_STRENGTH, DIVERSITY_FLOOR, STRATEGY, STRATEGY_ID, STRATEGY_NAME, init_diversityRerank, PipelineDebugger_exports, _activePipeline, MAX_RUNS, runHistory, _currentSessionId, _pendingRuns, DISCARDED_KEEP_TOP, _uiContainer, _selectedRunIndex, _cardSearchQuery, pipelineDebugAPI, init_PipelineDebugger, SrsDebugger_exports, snapshots, init_SrsDebugger, StrategyPressureDebugger_exports, snapshots2, init_StrategyPressureDebugger, CompositeGenerator_exports, AggregationMode, DEFAULT_AGGREGATION_MODE, FREQUENCY_BOOST_FACTOR, CompositeGenerator, init_CompositeGenerator, elo_exports, ELONavigator, init_elo, generators_exports, init_generators, prescribed_exports, DEFAULT_FRESHNESS_WINDOW, DEFAULT_MAX_DIRECT_PER_RUN, DEFAULT_MAX_SUPPORT_PER_RUN, DEFAULT_HIERARCHY_DEPTH, DEFAULT_MIN_COUNT, DEFAULT_PRACTICE_MIN_COUNT, DEFAULT_MAX_PRACTICE_PER_RUN, BASE_TARGET_SCORE, BASE_SUPPORT_SCORE, DISCOVERED_SUPPORT_SCORE, BASE_PRACTICE_SCORE, PRACTICE_BASE_MULT, MAX_PRACTICE_MULTIPLIER, PRACTICE_STALENESS_BUMP_PER_DAY, MAX_TARGET_MULTIPLIER, MAX_SUPPORT_MULTIPLIER, PRESCRIBED_DEBUG_VERSION, PrescribedCardsGenerator, init_prescribed, regulators_exports, DEFAULT_REGULATOR_CONFIG, INTAKE_CLOCK_KEY, REGULATOR_LABEL, init_regulators, srs_exports, SRSNavigator, init_srs, types_exports, init_types, globImport_generators, init_, DEFAULT_LEARNABLE_WEIGHT, init_contentNavigationStrategy, WeightedFilter_exports, WeightedFilter, init_WeightedFilter, eloDistance_exports, DEFAULT_ELO_DISTANCE_CONFIG, TAG_CONFIDENCE_HALF, COUNT_ONLY_SENTINEL, DEFAULT_CARD_ELO, MULTI_DIM_ELO_KEY, multiDimElo, EloDistanceFilter, init_eloDistance, hierarchyDefinition_exports, DEFAULT_MIN_COUNT2, HierarchyDefinitionNavigator, init_hierarchyDefinition, userTagPreference_exports, UserTagPreferenceFilter, init_userTagPreference, filters_exports, init_filters, inferredPreferenceStub_exports, INFERRED_PREFERENCE_NAVIGATOR_STUB, init_inferredPreferenceStub, interferenceMitigator_exports, DEFAULT_MIN_COUNT3, DEFAULT_MIN_ELAPSED_DAYS, DEFAULT_INTERFERENCE_DECAY, InterferenceMitigatorNavigator, init_interferenceMitigator, relativePriority_exports, DEFAULT_PRIORITY, DEFAULT_PRIORITY_INFLUENCE, DEFAULT_COMBINE_MODE, RelativePriorityNavigator, init_relativePriority, types_exports2, init_types2, userGoalStub_exports, USER_GOAL_NAVIGATOR_STUB, init_userGoalStub, globImport_filters, init_2, init_gradient, MIN_OBSERVATIONS_FOR_UPDATE, LEARNING_RATE, MAX_WEIGHT_DELTA, MIN_R_SQUARED_FOR_GRADIENT, FLAT_GRADIENT_THRESHOLD, MAX_HISTORY_LENGTH, init_learning, init_signal, init_recording, MIN_SPREAD, MAX_SPREAD, MIN_WEIGHT, MAX_WEIGHT, init_orchestration, Pipeline_exports, VERBOSE_RESULTS, Pipeline, init_Pipeline, defaults_exports, init_defaults, pipelinePlan_exports, PIPELINE_STAGES, init_pipelinePlan, PipelineAssembler_exports, PipelineAssembler, init_PipelineAssembler, globImport, init_3, navigators_exports, navigatorRegistry, Navigators, NavigatorRole, NavigatorRoles, ContentNavigator, init_navigators, CoursesDB, CourseDB, init_courseDB, classroomLookupDBTitle, CLASSROOM_CONFIG, ClassroomDBBase, StudentClassroomDB, TeacherClassroomDB, ClassroomLookupDB, init_classroomDB2, AdminDB, init_adminDB2, CourseSyncService_exports, DEFAULT_REPLICATION, CourseSyncService, init_CourseSyncService, init_auth, CouchDBSyncStrategy_exports, log2, CouchDBSyncStrategy, init_CouchDBSyncStrategy, isBrowser, GUEST_LOCAL_DB, localUserDB, pouchDBincludeCredentialsConfig, REVIEW_TIME_FORMAT, init_couch, duration, init_SpacedRepetition, SrsService, init_SrsService, init_tagRecent, EloService, init_EloService, ResponseProcessor, init_ResponseProcessor, CardHydrationService, init_CardHydrationService, ItemQueue, init_ItemQueue, init_studySession, init_types3, CouchDBToStaticPacker, init_CouchDBToStaticPacker, init_packer, DEFAULT_MIGRATION_OPTIONS, init_types4, FileSystemError, init_FileSystemAdapter, nodeFS, init_validation, nodeFS2, nodePath, StaticToCouchDBMigrator, init_StaticToCouchDBMigrator, init_migrator, init_dataDirectory, init_util2, QuotaRoundRobinMixer, init_SourceMixer, MAX_RUNS2, runHistory2, mixerDebugAPI, init_MixerDebugger, activeController, OVERLAY_ID, POLL_MS, INLINE_THRESHOLD, SPINNER_FRAMES, spinnerFrame, overlayEl, pollHandle, lastSnapshot, copyFlashUntil, minified, expanded, init_SessionOverlay, activeSession, sessionHistory, MAX_HISTORY, sessionDebugAPI, init_SessionDebugger, PERSISTED_RUNNERS_UP, SessionController, init_SessionController, TagFilteredContentSource, init_TagFilteredContentSource, init_study, REVIEW_TIME_FORMAT2, log3, init_userDBHelpers, UsrCrsData, init_user_course_relDB, log4, HYDRATION_TIMEOUT_MS, BaseUser, userCoursesDoc, userClassroomsDoc, init_BaseUserDB, init_common, PouchDataLayerProvider_exports, CouchDataLayerProvider, init_PouchDataLayerProvider, pathUtils, nodeFS3, StaticDataUnpacker, init_StaticDataUnpacker, StaticCourseDB, init_courseDB2, StaticCoursesDB, init_coursesDB, NoOpSyncStrategy, init_NoOpSyncStrategy, StaticDataLayerProvider_exports, StaticDataLayerProvider, init_StaticDataLayerProvider, NOT_SET, ENV, dataLayerInstance, init_factory, init_contentSource, init_courseDB3, init_dataLayerProvider, init_userDB, init_interfaces, init_user, init_strategyState, init_userOutcome, HYDRATION_MARKER_ID, init_hydration, init_cardProcessor, init_types5, init_bulkImport, userDBDebugAPI, init_UserDBDebugger, init_core, init_dist = __esmMin((() => {
27014
27251
  init_defineProperty(), init_index_browser_es$5(), init_index_browser_es(), init_index_es(), init_dist$1(), init_esm_browser(), init_moment(), import_browser_ponyfill = /* @__PURE__ */ __toESM$2(require_browser_ponyfill(), 1), import_browser_ponyfill$1 = /* @__PURE__ */ __toESM$2(require_browser_ponyfill(), 1), import_browser = /* @__PURE__ */ __toESM$2(require_browser(), 1), import___vite_browser_external = /* @__PURE__ */ __toESM$2(require___vite_browser_external(), 1), import___vite_browser_external$1 = /* @__PURE__ */ __toESM$2(require___vite_browser_external(), 1), import___vite_browser_external$2 = /* @__PURE__ */ __toESM$2(require___vite_browser_external(), 1), __defProp = Object.defineProperty, __getOwnPropNames = Object.getOwnPropertyNames, __glob = (t) => (c) => {
27015
27252
  var u = t[c];
27016
27253
  if (u) return u();
@@ -27399,7 +27636,8 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
27399
27636
  } }), SrsDebugger_exports = {}, __export(SrsDebugger_exports, {
27400
27637
  captureSrsBacklog: () => captureSrsBacklog,
27401
27638
  clearSrsBacklogDebug: () => clearSrsBacklogDebug,
27402
- getSrsBacklogDebug: () => getSrsBacklogDebug
27639
+ getSrsBacklogDebug: () => getSrsBacklogDebug,
27640
+ noteReviewPressure: () => noteReviewPressure
27403
27641
  }), init_SrsDebugger = __esm({ "src/core/navigators/SrsDebugger.ts"() {
27404
27642
  snapshots = /* @__PURE__ */ new Map();
27405
27643
  } }), StrategyPressureDebugger_exports = {}, __export(StrategyPressureDebugger_exports, {
@@ -27503,7 +27741,7 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
27503
27741
  }
27504
27742
  };
27505
27743
  } }), elo_exports = {}, __export(elo_exports, { default: () => ELONavigator }), init_elo = __esm({ "src/core/navigators/generators/elo.ts"() {
27506
- init_navigators(), init_logger(), ELO_RELEVANCE_SIGMA = 300, ELONavigator = class extends ContentNavigator {
27744
+ init_navigators(), init_logger(), ELONavigator = class extends ContentNavigator {
27507
27745
  constructor(t, c, u) {
27508
27746
  super(t, c, u), _defineProperty$2(this, "name", void 0), this.name = u?.name || "ELO";
27509
27747
  }
@@ -27517,18 +27755,19 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
27517
27755
  ...t,
27518
27756
  status: "new"
27519
27757
  })).map((t) => {
27520
- let c = t.elo ?? 1e3, d = Math.abs(c - u), m = Math.exp(-((d / ELO_RELEVANCE_SIGMA) ** 2)), g = m * (.5 + .5 * Math.random());
27758
+ let c = t.elo ?? 1e3, d = Math.abs(c - u), m = .5 + .5 * Math.random();
27521
27759
  return {
27522
27760
  cardId: t.cardID,
27523
27761
  courseId: t.courseID,
27524
- score: g,
27762
+ score: m,
27763
+ cardElo: c,
27525
27764
  provenance: [{
27526
27765
  strategy: "elo",
27527
27766
  strategyName: this.strategyName || this.name,
27528
27767
  strategyId: this.strategyId || "NAVIGATION_STRATEGY-ELO-default",
27529
27768
  action: "generated",
27530
- score: g,
27531
- reason: `ELO distance ${Math.round(d)} (card: ${Math.round(c)}, user: ${Math.round(u)}), relevance ${m.toFixed(3)}, key ${g.toFixed(3)}`
27769
+ score: m,
27770
+ reason: `new card near learner ELO: distance ${Math.round(d)} (card: ${Math.round(c)}, user: ${Math.round(u)}), jitter ${m.toFixed(3)}`
27532
27771
  }]
27533
27772
  };
27534
27773
  });
@@ -27966,18 +28205,36 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
27966
28205
  return c.count < d ? !1 : t.masteryThreshold?.minElo === void 0 ? t.masteryThreshold?.minCount === void 0 ? c.score >= u : !0 : c.score >= t.masteryThreshold.minElo;
27967
28206
  }
27968
28207
  };
28208
+ } }), regulators_exports = {}, __export(regulators_exports, {
28209
+ DEFAULT_REGULATOR_CONFIG: () => DEFAULT_REGULATOR_CONFIG,
28210
+ INTAKE_CLOCK_KEY: () => INTAKE_CLOCK_KEY,
28211
+ applyReading: () => applyReading,
28212
+ frozenMsAt: () => frozenMsAt,
28213
+ intakeHours: () => intakeHours,
28214
+ intakeReading: () => intakeReading,
28215
+ resetIntakeClock: () => resetIntakeClock,
28216
+ reviewMassReading: () => reviewMassReading,
28217
+ reviewWeight: () => reviewWeight,
28218
+ stepIntakeClock: () => stepIntakeClock
28219
+ }), init_regulators = __esm({ "src/core/navigators/regulators.ts"() {
28220
+ DEFAULT_REGULATOR_CONFIG = {
28221
+ reviewMass: {
28222
+ referenceScore: .95,
28223
+ healthyMass: 20,
28224
+ rate: 2
28225
+ },
28226
+ intake: {
28227
+ rate: 2,
28228
+ scaleHours: 24
28229
+ }
28230
+ }, INTAKE_CLOCK_KEY = "IntakeClock", REGULATOR_LABEL = {
28231
+ "review-mass": "Review mass",
28232
+ intake: "Intake"
28233
+ };
27969
28234
  } }), srs_exports = {}, __export(srs_exports, { default: () => SRSNavigator }), init_srs = __esm({ "src/core/navigators/generators/srs.ts"() {
27970
- init_navigators(), init_SrsDebugger(), init_logger(), DEFAULT_HEALTHY_BACKLOG = 20, BACKLOG_GROWTH_RATE = 2, SRSNavigator = class extends ContentNavigator {
28235
+ init_navigators(), init_SrsDebugger(), init_regulators(), init_logger(), SRSNavigator = class extends ContentNavigator {
27971
28236
  constructor(t, c, u) {
27972
- super(t, c, u), _defineProperty$2(this, "name", void 0), _defineProperty$2(this, "healthyBacklog", void 0), this.name = u?.name || "SRS", this.healthyBacklog = this.parseConfig(u?.serializedData).healthyBacklog ?? DEFAULT_HEALTHY_BACKLOG;
27973
- }
27974
- parseConfig(t) {
27975
- if (!t) return {};
27976
- try {
27977
- return JSON.parse(t);
27978
- } catch {
27979
- return logger.warn("[SRS] Failed to parse strategy config, using defaults"), {};
27980
- }
28237
+ super(t, c, u), _defineProperty$2(this, "name", void 0), this.name = u?.name || "SRS";
27981
28238
  }
27982
28239
  async getWeightedCards(t, c) {
27983
28240
  if (!this.user || !this.course) throw Error("SRSNavigator requires user and course to be set");
@@ -27989,24 +28246,23 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
27989
28246
  for (let t of u) this.user.removeScheduledCardReview(t);
27990
28247
  }
27991
28248
  }
27992
- let b = this.computeBacklogMultiplier(g.length), S = d.filter((t) => !m.isAfter(hooks.utc(t.reviewTime))), C = null;
27993
- if (S.length > 0) {
27994
- let t = S.reduce((t, c) => hooks.utc(t.reviewTime).isBefore(hooks.utc(c.reviewTime)) ? t : c), c = hooks.duration(hooks.utc(t.reviewTime).diff(m));
27995
- C = c.asHours() < 1 ? `${Math.round(c.asMinutes())}m` : c.asHours() < 24 ? `${Math.round(c.asHours())}h` : `${Math.round(c.asDays())}d`;
28249
+ let b = d.filter((t) => !m.isAfter(hooks.utc(t.reviewTime))), S = null;
28250
+ if (b.length > 0) {
28251
+ let t = b.reduce((t, c) => hooks.utc(t.reviewTime).isBefore(hooks.utc(c.reviewTime)) ? t : c), c = hooks.duration(hooks.utc(t.reviewTime).diff(m));
28252
+ S = c.asHours() < 1 ? `${Math.round(c.asMinutes())}m` : c.asHours() < 24 ? `${Math.round(c.asHours())}h` : `${Math.round(c.asDays())}d`;
27996
28253
  }
27997
- if (g.length > 0) {
27998
- let t = b > 1 ? ` [backlog pressure: \xD7${b.toFixed(2)}]` : " [healthy backlog]";
27999
- logger.info(`[SRS] Course ${u}: ${g.length} reviews due now (of ${d.length} scheduled)${t}`);
28000
- } else if (d.length > 0) {
28254
+ if (g.length > 0) logger.info(`[SRS] Course ${u}: ${g.length} reviews due now (of ${d.length} scheduled)`);
28255
+ else if (d.length > 0) {
28001
28256
  let t = [...d].sort((t, c) => hooks.utc(t.reviewTime).diff(hooks.utc(c.reviewTime)))[0], c = hooks.utc(t.reviewTime), g = hooks.duration(c.diff(m)), b = g.asHours() < 1 ? `${Math.round(g.asMinutes())}m` : g.asHours() < 24 ? `${Math.round(g.asHours())}h` : `${Math.round(g.asDays())}d`;
28002
28257
  logger.info(`[SRS] Course ${u}: 0 reviews due now (${d.length} scheduled, next in ${b})`);
28003
28258
  } else logger.info(`[SRS] Course ${u}: No reviews scheduled`);
28004
- let w = g.map((t) => {
28005
- let { score: c, reason: u } = this.computeUrgencyScore(t, m, b);
28259
+ let C = g.map((t) => {
28260
+ let { score: c, urgency: u, reason: d } = this.computeUrgencyScore(t, m);
28006
28261
  return {
28007
28262
  cardId: t.cardId,
28008
28263
  courseId: t.courseId,
28009
28264
  score: c,
28265
+ reviewUrgency: u,
28010
28266
  reviewID: t._id,
28011
28267
  provenance: [{
28012
28268
  strategy: "srs",
@@ -28014,7 +28270,7 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28014
28270
  strategyId: this.strategyId || "NAVIGATION_STRATEGY-SRS-default",
28015
28271
  action: "generated",
28016
28272
  score: c,
28017
- reason: u
28273
+ reason: d
28018
28274
  }]
28019
28275
  };
28020
28276
  }).sort((t, c) => c.score - t.score);
@@ -28022,28 +28278,25 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28022
28278
  courseId: u,
28023
28279
  scheduledTotal: d.length,
28024
28280
  dueNow: g.length,
28025
- healthyBacklog: this.healthyBacklog,
28026
- backlogMultiplier: b,
28027
- backlogGrowthRate: BACKLOG_GROWTH_RATE,
28028
- topReviewScore: w.length > 0 ? w[0].score : null,
28029
- nextDueIn: C,
28281
+ healthyBacklog: DEFAULT_REGULATOR_CONFIG.reviewMass.healthyMass,
28282
+ reviewMass: null,
28283
+ backlogMultiplier: 1,
28284
+ backlogGrowthRate: DEFAULT_REGULATOR_CONFIG.reviewMass.rate,
28285
+ topReviewScore: C.length > 0 ? C[0].score : null,
28286
+ nextDueIn: S,
28030
28287
  timestamp: Date.now()
28031
- }), { cards: w.slice(0, t) };
28032
- }
28033
- computeBacklogMultiplier(t) {
28034
- if (t <= this.healthyBacklog) return 1;
28035
- let c = (t - this.healthyBacklog) / this.healthyBacklog;
28036
- return BACKLOG_GROWTH_RATE ** +c;
28037
- }
28038
- computeUrgencyScore(t, c, u) {
28039
- let d = hooks.utc(t.scheduledAt), m = hooks.utc(t.reviewTime), g = Math.max(1, m.diff(d, "hours")), b = c.diff(m, "hours"), S = b / g, C = .3 + .7 * Math.exp(-g / 720), w = (.5 + (Math.min(1, Math.max(0, S)) * .5 + C * .5) * .45) * u, T = [
28040
- `${Math.round(b)}h overdue`,
28041
- `interval: ${Math.round(g)}h`,
28042
- `relative: ${S.toFixed(2)}`,
28043
- `recency: ${C.toFixed(2)}`
28288
+ }), { cards: C.slice(0, t) };
28289
+ }
28290
+ computeUrgencyScore(t, c) {
28291
+ let u = hooks.utc(t.scheduledAt), d = hooks.utc(t.reviewTime), m = Math.max(1, d.diff(u, "hours")), g = c.diff(d, "hours"), b = g / m, S = .3 + .7 * Math.exp(-m / 720), C = Math.min(1, Math.max(0, b)) * .5 + S * .5, w = .5 + C * .45, T = [
28292
+ `${Math.round(g)}h overdue`,
28293
+ `interval: ${Math.round(m)}h`,
28294
+ `relative: ${b.toFixed(2)}`,
28295
+ `recency: ${S.toFixed(2)}`
28044
28296
  ];
28045
- return u > 1 && T.push(`backlog: \xD7${u.toFixed(2)}`), T.push("review"), {
28297
+ return T.push("review"), {
28046
28298
  score: w,
28299
+ urgency: C,
28047
28300
  reason: T.join(", ")
28048
28301
  };
28049
28302
  }
@@ -28066,7 +28319,7 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28066
28319
  } }), WeightedFilter_exports = {}, __export(WeightedFilter_exports, { WeightedFilter: () => WeightedFilter }), init_WeightedFilter = __esm({ "src/core/navigators/filters/WeightedFilter.ts"() {
28067
28320
  init_contentNavigationStrategy(), WeightedFilter = class {
28068
28321
  constructor(t, c = DEFAULT_LEARNABLE_WEIGHT, u = !1, d) {
28069
- _defineProperty$2(this, "name", void 0), _defineProperty$2(this, "inner", void 0), _defineProperty$2(this, "learnable", void 0), _defineProperty$2(this, "staticWeight", void 0), _defineProperty$2(this, "strategyId", void 0), this.inner = t, this.name = t.name, this.learnable = c, this.staticWeight = u, this.strategyId = d;
28322
+ _defineProperty$2(this, "name", void 0), _defineProperty$2(this, "kind", void 0), _defineProperty$2(this, "liveOnly", void 0), _defineProperty$2(this, "inner", void 0), _defineProperty$2(this, "learnable", void 0), _defineProperty$2(this, "staticWeight", void 0), _defineProperty$2(this, "strategyId", void 0), this.inner = t, this.name = t.name, this.kind = t.kind, this.liveOnly = t.liveOnly, this.learnable = c, this.staticWeight = u, this.strategyId = d;
28070
28323
  }
28071
28324
  async transform(t, c) {
28072
28325
  let u = this.learnable.weight, d;
@@ -28104,16 +28357,45 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28104
28357
  }
28105
28358
  };
28106
28359
  } }), eloDistance_exports = {}, __export(eloDistance_exports, {
28107
- DEFAULT_HALF_LIFE: () => DEFAULT_HALF_LIFE,
28108
- DEFAULT_MAX_MULTIPLIER: () => DEFAULT_MAX_MULTIPLIER,
28109
- DEFAULT_MIN_MULTIPLIER: () => DEFAULT_MIN_MULTIPLIER,
28110
- createEloDistanceFilter: () => createEloDistanceFilter
28360
+ DEFAULT_ELO_DISTANCE_CONFIG: () => DEFAULT_ELO_DISTANCE_CONFIG,
28361
+ createEloDistanceFilter: () => createEloDistanceFilter,
28362
+ default: () => EloDistanceFilter,
28363
+ mountMultiDimEloToggle: () => mountMultiDimEloToggle,
28364
+ tagAwareGap: () => tagAwareGap
28111
28365
  }), init_eloDistance = __esm({ "src/core/navigators/filters/eloDistance.ts"() {
28112
- DEFAULT_HALF_LIFE = 200, DEFAULT_MIN_MULTIPLIER = .3, DEFAULT_MAX_MULTIPLIER = 1;
28366
+ var t;
28367
+ init_navigators(), init_logger(), DEFAULT_ELO_DISTANCE_CONFIG = {
28368
+ halfLife: 300,
28369
+ minMultiplier: .05,
28370
+ maxMultiplier: 1,
28371
+ tagAware: !1,
28372
+ minTagCount: 3
28373
+ }, TAG_CONFIDENCE_HALF = 10, COUNT_ONLY_SENTINEL = -1, DEFAULT_CARD_ELO = 1e3, MULTI_DIM_ELO_KEY = "skuilder:multiDimElo", multiDimElo = readMultiDimElo(), mountMultiDimEloToggle(), EloDistanceFilter = (t = class _EloDistanceFilter extends ContentNavigator {
28374
+ constructor(t, c, u) {
28375
+ super(t, c, u), _defineProperty$2(this, "name", void 0), _defineProperty$2(this, "kind", _EloDistanceFilter.kind), _defineProperty$2(this, "liveOnly", !0), _defineProperty$2(this, "config", void 0), this.name = u.name || "ELO Distance";
28376
+ let d;
28377
+ try {
28378
+ d = u.serializedData ? JSON.parse(u.serializedData) : void 0;
28379
+ } catch {
28380
+ d = void 0;
28381
+ }
28382
+ this.config = resolveConfig(d);
28383
+ }
28384
+ transform(t, c) {
28385
+ return applyEloDistance(t, c, this.config, {
28386
+ name: this.name,
28387
+ strategyId: this.strategyId || "NAVIGATION_STRATEGY-eloDistance-default"
28388
+ });
28389
+ }
28390
+ async getWeightedCards(t) {
28391
+ throw Error("EloDistanceFilter is a filter and should not be used as a generator. Use Pipeline with a generator and this filter via transform().");
28392
+ }
28393
+ }, _defineProperty$2(t, "kind", "signal"), t);
28113
28394
  } }), hierarchyDefinition_exports = {}, __export(hierarchyDefinition_exports, { default: () => HierarchyDefinitionNavigator }), init_hierarchyDefinition = __esm({ "src/core/navigators/filters/hierarchyDefinition.ts"() {
28114
- init_navigators(), init_logger(), DEFAULT_MIN_COUNT2 = 3, HierarchyDefinitionNavigator = class extends ContentNavigator {
28395
+ var t;
28396
+ init_navigators(), init_logger(), DEFAULT_MIN_COUNT2 = 3, HierarchyDefinitionNavigator = (t = class _HierarchyDefinitionNavigator extends ContentNavigator {
28115
28397
  constructor(t, c, u) {
28116
- super(t, c, u), _defineProperty$2(this, "config", void 0), _defineProperty$2(this, "name", void 0), this.config = this.parseConfig(u.serializedData), this.name = u.name || "Hierarchy Definition";
28398
+ super(t, c, u), _defineProperty$2(this, "config", void 0), _defineProperty$2(this, "name", void 0), _defineProperty$2(this, "kind", _HierarchyDefinitionNavigator.kind), this.config = this.parseConfig(u.serializedData), this.name = u.name || "Hierarchy Definition";
28117
28399
  }
28118
28400
  parseConfig(t) {
28119
28401
  try {
@@ -28226,11 +28508,12 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28226
28508
  async getWeightedCards(t) {
28227
28509
  throw Error("HierarchyDefinitionNavigator is a filter and should not be used as a generator. Use Pipeline with a generator and this filter via transform().");
28228
28510
  }
28229
- };
28511
+ }, _defineProperty$2(t, "kind", "gate"), t);
28230
28512
  } }), userTagPreference_exports = {}, __export(userTagPreference_exports, { default: () => UserTagPreferenceFilter }), init_userTagPreference = __esm({ "src/core/navigators/filters/userTagPreference.ts"() {
28231
- init_navigators(), UserTagPreferenceFilter = class extends ContentNavigator {
28513
+ var t;
28514
+ init_navigators(), UserTagPreferenceFilter = (t = class _UserTagPreferenceFilter extends ContentNavigator {
28232
28515
  constructor(t, c, u) {
28233
- super(t, c, u), _defineProperty$2(this, "_strategyData", void 0), _defineProperty$2(this, "name", void 0), this._strategyData = u, this.name = u.name || "User Tag Preferences";
28516
+ super(t, c, u), _defineProperty$2(this, "_strategyData", void 0), _defineProperty$2(this, "name", void 0), _defineProperty$2(this, "kind", _UserTagPreferenceFilter.kind), this._strategyData = u, this.name = u.name || "User Tag Preferences";
28234
28517
  }
28235
28518
  computeMultiplier(t, c) {
28236
28519
  let u = t.map((t) => c[t]).filter((t) => t !== void 0);
@@ -28271,8 +28554,9 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28271
28554
  async getWeightedCards(t) {
28272
28555
  throw Error("UserTagPreferenceFilter is a filter and should not be used as a generator. Use Pipeline with a generator and this filter via transform().");
28273
28556
  }
28274
- };
28557
+ }, _defineProperty$2(t, "kind", "signal"), t);
28275
28558
  } }), filters_exports = {}, __export(filters_exports, {
28559
+ EloDistanceFilter: () => EloDistanceFilter,
28276
28560
  UserTagPreferenceFilter: () => UserTagPreferenceFilter,
28277
28561
  createEloDistanceFilter: () => createEloDistanceFilter
28278
28562
  }), init_filters = __esm({ "src/core/navigators/filters/index.ts"() {
@@ -28280,9 +28564,10 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28280
28564
  } }), inferredPreferenceStub_exports = {}, __export(inferredPreferenceStub_exports, { INFERRED_PREFERENCE_NAVIGATOR_STUB: () => INFERRED_PREFERENCE_NAVIGATOR_STUB }), init_inferredPreferenceStub = __esm({ "src/core/navigators/filters/inferredPreferenceStub.ts"() {
28281
28565
  INFERRED_PREFERENCE_NAVIGATOR_STUB = !0;
28282
28566
  } }), interferenceMitigator_exports = {}, __export(interferenceMitigator_exports, { default: () => InterferenceMitigatorNavigator }), init_interferenceMitigator = __esm({ "src/core/navigators/filters/interferenceMitigator.ts"() {
28283
- init_navigators(), DEFAULT_MIN_COUNT3 = 10, DEFAULT_MIN_ELAPSED_DAYS = 3, DEFAULT_INTERFERENCE_DECAY = .8, InterferenceMitigatorNavigator = class extends ContentNavigator {
28567
+ var t;
28568
+ init_navigators(), DEFAULT_MIN_COUNT3 = 10, DEFAULT_MIN_ELAPSED_DAYS = 3, DEFAULT_INTERFERENCE_DECAY = .8, InterferenceMitigatorNavigator = (t = class _InterferenceMitigatorNavigator extends ContentNavigator {
28284
28569
  constructor(t, c, u) {
28285
- super(t, c, u), _defineProperty$2(this, "config", void 0), _defineProperty$2(this, "name", void 0), _defineProperty$2(this, "interferenceMap", void 0), this.config = this.parseConfig(u.serializedData), this.interferenceMap = this.buildInterferenceMap(), this.name = u.name || "Interference Mitigator";
28570
+ super(t, c, u), _defineProperty$2(this, "config", void 0), _defineProperty$2(this, "name", void 0), _defineProperty$2(this, "kind", _InterferenceMitigatorNavigator.kind), _defineProperty$2(this, "interferenceMap", void 0), this.config = this.parseConfig(u.serializedData), this.interferenceMap = this.buildInterferenceMap(), this.name = u.name || "Interference Mitigator";
28286
28571
  }
28287
28572
  parseConfig(t) {
28288
28573
  try {
@@ -28397,11 +28682,12 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28397
28682
  async getWeightedCards(t) {
28398
28683
  throw Error("InterferenceMitigatorNavigator is a filter and should not be used as a generator. Use Pipeline with a generator and this filter via transform().");
28399
28684
  }
28400
- };
28685
+ }, _defineProperty$2(t, "kind", "signal"), t);
28401
28686
  } }), relativePriority_exports = {}, __export(relativePriority_exports, { default: () => RelativePriorityNavigator }), init_relativePriority = __esm({ "src/core/navigators/filters/relativePriority.ts"() {
28402
- init_navigators(), DEFAULT_PRIORITY = .5, DEFAULT_PRIORITY_INFLUENCE = .5, DEFAULT_COMBINE_MODE = "max", RelativePriorityNavigator = class extends ContentNavigator {
28687
+ var t;
28688
+ init_navigators(), DEFAULT_PRIORITY = .5, DEFAULT_PRIORITY_INFLUENCE = .5, DEFAULT_COMBINE_MODE = "max", RelativePriorityNavigator = (t = class _RelativePriorityNavigator extends ContentNavigator {
28403
28689
  constructor(t, c, u) {
28404
- super(t, c, u), _defineProperty$2(this, "config", void 0), _defineProperty$2(this, "name", void 0), this.config = this.parseConfig(u.serializedData), this.name = u.name || "Relative Priority";
28690
+ super(t, c, u), _defineProperty$2(this, "config", void 0), _defineProperty$2(this, "name", void 0), _defineProperty$2(this, "kind", _RelativePriorityNavigator.kind), this.config = this.parseConfig(u.serializedData), this.name = u.name || "Relative Priority";
28405
28691
  }
28406
28692
  parseConfig(t) {
28407
28693
  try {
@@ -28463,7 +28749,7 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28463
28749
  async getWeightedCards(t) {
28464
28750
  throw Error("RelativePriorityNavigator is a filter and should not be used as a generator. Use Pipeline with a generator and this filter via transform().");
28465
28751
  }
28466
- };
28752
+ }, _defineProperty$2(t, "kind", "signal"), t);
28467
28753
  } }), types_exports2 = {}, init_types2 = __esm({ "src/core/navigators/filters/types.ts"() {} }), userGoalStub_exports = {}, __export(userGoalStub_exports, { USER_GOAL_NAVIGATOR_STUB: () => USER_GOAL_NAVIGATOR_STUB }), init_userGoalStub = __esm({ "src/core/navigators/filters/userGoalStub.ts"() {
28468
28754
  USER_GOAL_NAVIGATOR_STUB = !0;
28469
28755
  } }), init_2 = __esm({ "import(\"./filters/**/*\") in src/core/navigators/index.ts"() {
@@ -28491,9 +28777,9 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28491
28777
  Pipeline: () => Pipeline,
28492
28778
  mergeHints: () => mergeHints2
28493
28779
  }), init_Pipeline = __esm({ "src/core/navigators/Pipeline.ts"() {
28494
- init_navigators(), init_logger(), init_orchestration(), init_PipelineDebugger(), init_diversityRerank(), VERBOSE_RESULTS = !0, Pipeline = class extends ContentNavigator {
28780
+ init_navigators(), init_logger(), init_orchestration(), init_PipelineDebugger(), init_diversityRerank(), init_regulators(), init_SrsDebugger(), VERBOSE_RESULTS = !0, Pipeline = class extends ContentNavigator {
28495
28781
  constructor(t, c, u, d) {
28496
- super(), _defineProperty$2(this, "generator", void 0), _defineProperty$2(this, "filters", void 0), _defineProperty$2(this, "_cachedOrchestration", null), _defineProperty$2(this, "_tagCache", /* @__PURE__ */ new Map()), _defineProperty$2(this, "_ephemeralHints", null), this.generator = t, this.filters = c, this.user = u, this.course = d, d.getCourseConfig().then((t) => {
28782
+ super(), _defineProperty$2(this, "generator", void 0), _defineProperty$2(this, "filters", void 0), _defineProperty$2(this, "_cachedOrchestration", null), _defineProperty$2(this, "_tagCache", /* @__PURE__ */ new Map()), _defineProperty$2(this, "_ephemeralHints", null), _defineProperty$2(this, "_intakeClock", null), _defineProperty$2(this, "_intakeClockWrite", Promise.resolve()), this.generator = t, this.filters = c, this.user = u, this.course = d, d.getCourseConfig().then((t) => {
28497
28783
  logger.debug(`[pipeline] Crated pipeline for ${t.name}`);
28498
28784
  }).catch((t) => {
28499
28785
  logger.error(`[pipeline] Failed to lookup courseCfg: ${t}`);
@@ -28518,12 +28804,12 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28518
28804
  }
28519
28805
  }
28520
28806
  w = Array.from(t.entries()).map(([t, c]) => {
28521
- let u = c.cards.filter((t) => t.provenance[0]?.reason?.includes("new card")), d = c.cards.filter((t) => t.provenance[0]?.reason?.includes("review"));
28807
+ let u = c.cards.filter((t) => t.reviewID).length;
28522
28808
  return {
28523
28809
  name: t,
28524
28810
  cardCount: c.cards.length,
28525
- newCount: u.length,
28526
- reviewCount: d.length,
28811
+ newCount: c.cards.length - u,
28812
+ reviewCount: u,
28527
28813
  topScore: Math.max(...c.cards.map((t) => t.score), 0)
28528
28814
  };
28529
28815
  });
@@ -28544,17 +28830,18 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28544
28830
  logger.info(`[Pipeline] Pre-fetched ${c.length} required card(s) into pool: ${c.join(", ")}`);
28545
28831
  }
28546
28832
  }
28547
- let O = new Set(b.filter((t) => t.provenance.some((t) => t.strategy === "prescribed")).map((t) => t.cardId)), xr = [];
28833
+ let O = new Set(b.filter((t) => t.provenance.some((t) => t.strategy === "prescribed")).map((t) => t.cardId)), xr = [], Sr = new Map(b.map((t) => [t.cardId, t.score])), Cr = /* @__PURE__ */ new Set();
28548
28834
  for (let t of this.filters) {
28549
28835
  let c = b.length, d = new Map(b.map((t) => [t.cardId, t.score]));
28550
28836
  b = await t.transform(b, u);
28551
- let m = 0, g = 0, S = 0, C = c - b.length;
28837
+ let m = 0, g = 0, S = 0, C = c - b.length, w = t.kind ?? "gate";
28552
28838
  for (let t of b) {
28553
28839
  let c = d.get(t.cardId) ?? 0;
28554
- t.score > c ? m++ : t.score < c ? g++ : S++;
28840
+ t.score > c ? m++ : t.score < c ? (g++, w === "gate" && Cr.add(t.cardId)) : S++;
28555
28841
  }
28556
28842
  if (xr.push({
28557
28843
  name: t.name,
28844
+ kind: w,
28558
28845
  boosted: m,
28559
28846
  penalized: g,
28560
28847
  passed: S,
@@ -28565,21 +28852,21 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28565
28852
  }
28566
28853
  logger.debug(`[Pipeline] Filter '${t.name}': ${d.size} \u2192 ${b.length} cards (\u2191${m} \u2193${g} =${S})`);
28567
28854
  }
28568
- let Sr = b;
28855
+ let wr = b;
28569
28856
  b = b.filter((t) => t.score > 0);
28570
- let Cr = this._ephemeralHints;
28571
- Cr && (this._ephemeralHints = null, b = this.applyHints(b, Cr, E)), b = diversityRerank(b), b.sort((t, c) => c.score - t.score);
28572
- let wr = performance.now(), Tr = b.slice(0, t);
28573
- logger.info(`[Pipeline:timing] total=${(wr - c).toFixed(0)}ms (context=${(d - c).toFixed(0)} generate=${(S - d).toFixed(0)} hydrate=${(T - S).toFixed(0)} filter=${(wr - T).toFixed(0)})`);
28574
- let Er = Tr.slice(0, 3).map((t) => t.score);
28575
- logExecutionSummary(this.generator.name, C, this.filters.length, Tr.length, Er, xr), logResultCards(Tr), logCardProvenance(Tr, 3);
28857
+ let Tr = await this.regulate(b, Sr, Cr), Er = this._ephemeralHints;
28858
+ Er && (this._ephemeralHints = null, b = this.applyHints(b, Er, E)), b = diversityRerank(b), b.sort((t, c) => c.score - t.score);
28859
+ let Dr = performance.now(), Or = b.slice(0, t);
28860
+ logger.info(`[Pipeline:timing] total=${(Dr - c).toFixed(0)}ms (context=${(d - c).toFixed(0)} generate=${(S - d).toFixed(0)} hydrate=${(T - S).toFixed(0)} filter=${(Dr - T).toFixed(0)})`);
28861
+ let kr = Or.slice(0, 3).map((t) => t.score);
28862
+ logExecutionSummary(this.generator.name, C, this.filters.length, Or.length, kr, xr), logResultCards(Or), logCardProvenance(Or, 3);
28576
28863
  try {
28577
28864
  let t = await this.course?.getCourseConfig().then((t) => t.name).catch(() => void 0);
28578
- captureRun(buildRunReport(this.course?.getCourseID() || "unknown", t, this.generator.name, w, C, xr, b, Tr, u.userElo, Cr ?? void 0, Sr));
28865
+ captureRun(buildRunReport(this.course?.getCourseID() || "unknown", t, this.generator.name, w, C, xr, b, Or, u.userElo, Er ?? void 0, wr, Tr));
28579
28866
  } catch (t) {
28580
28867
  logger.debug(`[Pipeline] Failed to capture debug run: ${t}`);
28581
28868
  }
28582
- return { cards: Tr };
28869
+ return { cards: Or };
28583
28870
  }
28584
28871
  async hydrateTags(t) {
28585
28872
  if (t.length === 0) return t;
@@ -28649,20 +28936,55 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28649
28936
  }
28650
28937
  return logger.info(`[Pipeline] Hints applied: ${d} \u2192 ${t.length} cards`), t;
28651
28938
  }
28939
+ async regulate(t, c, u) {
28940
+ let d = DEFAULT_REGULATOR_CONFIG, m = t.filter((t) => t.reviewID), g = t.filter((t) => !t.reviewID), b = g.filter((t) => !u.has(t.cardId)), S = reviewMassReading(m, c, d.reviewMass);
28941
+ applyReading(m, S), noteReviewPressure(this.course.getCourseID(), {
28942
+ mass: S.urgency,
28943
+ healthyMass: d.reviewMass.healthyMass,
28944
+ rate: d.reviewMass.rate,
28945
+ multiplier: S.multiplier
28946
+ });
28947
+ let C = Date.now(), w = await this.loadIntakeClock(C), T = stepIntakeClock(w, C, b.length);
28948
+ T !== w && this.saveIntakeClock(T);
28949
+ let E = intakeReading(T, C, {
28950
+ eligibleNew: b.length,
28951
+ newCandidates: g.length
28952
+ }, d.intake);
28953
+ return applyReading(b, E), logger.info(`[Pipeline:regulators] review mass ${S.urgency.toFixed(1)} over ${m.length} due \u2192 \xD7${S.multiplier.toFixed(2)}; intake ${E.urgency.toFixed(1)}h, ${b.length}/${g.length} new eligible \u2192 \xD7${E.multiplier.toFixed(2)}`), [S, E];
28954
+ }
28955
+ notePresented(t) {
28956
+ t.status !== "new" || t.courseId !== this.course?.getCourseID() || this.saveIntakeClock(resetIntakeClock(Date.now()));
28957
+ }
28958
+ async loadIntakeClock(t) {
28959
+ if (this._intakeClock) return this._intakeClock;
28960
+ let c = null;
28961
+ try {
28962
+ c = await this.user.getStrategyState(this.course.getCourseID(), INTAKE_CLOCK_KEY);
28963
+ } catch (t) {
28964
+ logger.warn(`[Pipeline:regulators] Could not read the intake clock: ${t}`);
28965
+ }
28966
+ return c ? this._intakeClock = c : this.saveIntakeClock(resetIntakeClock(t)), this._intakeClock;
28967
+ }
28968
+ saveIntakeClock(t) {
28969
+ this._intakeClock = t;
28970
+ let c = this.course.getCourseID();
28971
+ this._intakeClockWrite = this._intakeClockWrite.then(() => this.user.putStrategyState(c, INTAKE_CLOCK_KEY, t)).catch((t) => logger.warn(`[Pipeline:regulators] Could not save the intake clock: ${t}`));
28972
+ }
28652
28973
  async buildContext() {
28653
- let t = 1e3;
28974
+ let t = 1e3, c;
28654
28975
  try {
28655
- t = toCourseElo((await this.user.getCourseRegDoc(this.course.getCourseID())).elo).global.score;
28976
+ c = toCourseElo((await this.user.getCourseRegDoc(this.course.getCourseID())).elo), t = c.global.score;
28656
28977
  } catch (t) {
28657
28978
  logger.debug(`[Pipeline] Could not get user ELO, using default: ${t}`);
28658
28979
  }
28659
28980
  this._cachedOrchestration || (this._cachedOrchestration = await createOrchestrationContext(this.user, this.course));
28660
- let c = this._cachedOrchestration;
28981
+ let u = this._cachedOrchestration;
28661
28982
  return {
28662
28983
  user: this.user,
28663
28984
  course: this.course,
28664
28985
  userElo: t,
28665
- orchestration: c
28986
+ ...c ? { userCourseElo: c } : {},
28987
+ orchestration: u
28666
28988
  };
28667
28989
  }
28668
28990
  getCourseID() {
@@ -28709,7 +29031,7 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28709
29031
  }));
28710
29032
  m = await this.hydrateTags(m);
28711
29033
  let g = m.slice(), b = await this.buildContext();
28712
- for (let t of this.filters) m = await t.transform(m, b);
29034
+ for (let t of this.forecastFilters()) m = await t.transform(m, b);
28713
29035
  if (t?.hints && (m = this.applyHints(m, t.hints, g)), m = m.filter((t) => t.score >= c), u) {
28714
29036
  let t;
28715
29037
  try {
@@ -28721,6 +29043,9 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28721
29043
  }
28722
29044
  return m.sort((t, c) => c.score - t.score), t?.limit ? m.slice(0, t.limit) : m;
28723
29045
  }
29046
+ forecastFilters() {
29047
+ return this.filters.filter((t) => !t.liveOnly);
29048
+ }
28724
29049
  async diagnoseCardSpace(t) {
28725
29050
  let c = t?.threshold ?? .1, u = performance.now(), d = await this.course.getAllCardIds(), m = d.map((t) => ({
28726
29051
  cardId: t,
@@ -28730,7 +29055,7 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28730
29055
  }));
28731
29056
  m = await this.hydrateTags(m);
28732
29057
  let g = await this.buildContext(), b = [];
28733
- for (let t of this.filters) {
29058
+ for (let t of this.forecastFilters()) {
28734
29059
  m = await t.transform(m, g);
28735
29060
  let u = m.filter((t) => t.score >= c).length;
28736
29061
  b.push({
@@ -28774,13 +29099,55 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28774
29099
  }
28775
29100
  };
28776
29101
  } }), defaults_exports = {}, __export(defaults_exports, {
29102
+ createDefaultEloDistanceStrategy: () => createDefaultEloDistanceStrategy,
28777
29103
  createDefaultEloStrategy: () => createDefaultEloStrategy,
28778
29104
  createDefaultPipeline: () => createDefaultPipeline,
28779
29105
  createDefaultSrsStrategy: () => createDefaultSrsStrategy
28780
29106
  }), init_defaults = __esm({ "src/core/navigators/defaults.ts"() {
28781
29107
  init_navigators(), init_Pipeline(), init_CompositeGenerator(), init_elo(), init_srs(), init_eloDistance(), init_types_legacy();
29108
+ } }), pipelinePlan_exports = {}, __export(pipelinePlan_exports, {
29109
+ PIPELINE_STAGES: () => PIPELINE_STAGES,
29110
+ planPipeline: () => planPipeline
29111
+ }), init_pipelinePlan = __esm({ "src/core/navigators/pipelinePlan.ts"() {
29112
+ init_navigators(), init_regulators(), init_defaults(), PIPELINE_STAGES = [
29113
+ {
29114
+ key: "generate",
29115
+ title: "Generate",
29116
+ summary: "Each generator proposes candidates (up to 500 in all), scored on what is specific to its source. A card proposed by several generators keeps their mean score, raised 10% per extra generator."
29117
+ },
29118
+ {
29119
+ key: "filter",
29120
+ title: "Filter",
29121
+ summary: "Each filter multiplies candidate scores, in the order shown. A gate says a card is not ready yet; a signal expresses preference. Gates usually penalize rather than remove, so a gated card stays in the pool at a low score."
29122
+ },
29123
+ {
29124
+ key: "drop-zero",
29125
+ title: "Drop zero scores",
29126
+ summary: "Candidates whose score reached 0 leave the pool."
29127
+ },
29128
+ {
29129
+ key: "regulate",
29130
+ title: "Regulate",
29131
+ summary: "Balances reviews against new cards. Review mass: the due reviews weighed by their filtered scores; above a healthy level, every review is lifted. Intake: hours since a new card was last presented; new cards no gate penalized are lifted, and the clock stops while there are none."
29132
+ },
29133
+ {
29134
+ key: "hints",
29135
+ title: "Apply hints",
29136
+ summary: "The session's hints (from the app: an intro's follow-up, a difficulty boost) exclude, boost, or require cards. Required cards skip the filters entirely."
29137
+ },
29138
+ {
29139
+ key: "diversity",
29140
+ title: "Diversity re-rank",
29141
+ summary: "Demotes candidates that repeat a distinctive tag already ranked above them, so one concept or answer cannot take the whole head of the queue. Sees this run only, not what the session already served."
29142
+ },
29143
+ {
29144
+ key: "select",
29145
+ title: "Select",
29146
+ summary: "Highest scores first, up to the run's limit. The session mixes them into its supply queue."
29147
+ }
29148
+ ];
28782
29149
  } }), PipelineAssembler_exports = {}, __export(PipelineAssembler_exports, { PipelineAssembler: () => PipelineAssembler }), init_PipelineAssembler = __esm({ "src/core/navigators/PipelineAssembler.ts"() {
28783
- init_navigators(), init_WeightedFilter(), init_Pipeline(), init_logger(), init_CompositeGenerator(), init_defaults(), PipelineAssembler = class {
29150
+ init_navigators(), init_WeightedFilter(), init_Pipeline(), init_logger(), init_CompositeGenerator(), init_pipelinePlan(), PipelineAssembler = class {
28784
29151
  async assemble(t) {
28785
29152
  let { strategies: c, user: u, course: d } = t, m = [];
28786
29153
  if (c.length === 0) return {
@@ -28789,32 +29156,33 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28789
29156
  filterStrategies: [],
28790
29157
  warnings: m
28791
29158
  };
28792
- let g = [], b = [];
28793
- for (let t of c) isGenerator(t.implementingClass) ? g.push(t) : isFilter(t.implementingClass) ? b.push(t) : m.push(`Unknown strategy type '${t.implementingClass}', skipping: ${t.name}`);
28794
- let S = d.getCourseID(), C = g.some((t) => t.implementingClass === "elo"), w = g.some((t) => t.implementingClass === "srs");
28795
- if (C || (logger.debug("[PipelineAssembler] No ELO generator configured, adding default"), g.push(createDefaultEloStrategy(S))), w || (logger.debug("[PipelineAssembler] No SRS generator configured, adding default"), g.push(createDefaultSrsStrategy(S))), g.length === 0) return m.push("No generator strategy found"), {
29159
+ let g = planPipeline(c, d.getCourseID());
29160
+ m.push(...g.warnings);
29161
+ for (let t of [...g.generators, ...g.filters]) t.origin === "assembler-default" && logger.debug(`[PipelineAssembler] No ${t.implementingClass} ${t.role} configured, adding default`);
29162
+ let b = g.generators.map((t) => t.strategy), S = g.filters.map((t) => t.strategy);
29163
+ if (b.length === 0) return m.push("No generator strategy found"), {
28796
29164
  pipeline: null,
28797
29165
  generatorStrategies: [],
28798
29166
  filterStrategies: [],
28799
29167
  warnings: m
28800
29168
  };
28801
- let T;
28802
- g.length === 1 ? (T = await ContentNavigator.create(u, d, g[0]), logger.debug(`[PipelineAssembler] Using single generator: ${g[0].name}`)) : (logger.debug(`[PipelineAssembler] Using CompositeGenerator for ${g.length} generators: ${g.map((t) => t.name).join(", ")}`), T = await CompositeGenerator.fromStrategies(u, d, g));
28803
- let E = [], D = [...b].sort((t, c) => t.name.localeCompare(c.name));
28804
- for (let t of D) try {
29169
+ let C;
29170
+ b.length === 1 ? (C = await ContentNavigator.create(u, d, b[0]), logger.debug(`[PipelineAssembler] Using single generator: ${b[0].name}`)) : (logger.debug(`[PipelineAssembler] Using CompositeGenerator for ${b.length} generators: ${b.map((t) => t.name).join(", ")}`), C = await CompositeGenerator.fromStrategies(u, d, b));
29171
+ let w = [];
29172
+ for (let t of S) try {
28805
29173
  let c = await ContentNavigator.create(u, d, t);
28806
29174
  if ("transform" in c && typeof c.transform == "function") {
28807
29175
  let u = c;
28808
- t.learnable && (u = new WeightedFilter(u, t.learnable, t.staticWeight, t._id)), E.push(u), logger.debug(`[PipelineAssembler] Added filter: ${t.name}`);
29176
+ t.learnable && (u = new WeightedFilter(u, t.learnable, t.staticWeight, t._id)), w.push(u), logger.debug(`[PipelineAssembler] Added filter: ${t.name}`);
28809
29177
  } else m.push(`Filter '${t.name}' does not implement CardFilter.transform(), skipping`);
28810
29178
  } catch (c) {
28811
29179
  m.push(`Failed to instantiate filter '${t.name}': ${c}`);
28812
29180
  }
28813
- let O = new Pipeline(T, E, u, d);
28814
- return logger.debug(`[PipelineAssembler] Assembled pipeline with ${g.length} generator(s) and ${E.length} filter(s)`), {
28815
- pipeline: O,
28816
- generatorStrategies: g,
28817
- filterStrategies: D,
29181
+ let T = new Pipeline(C, w, u, d);
29182
+ return logger.debug(`[PipelineAssembler] Assembled pipeline with ${b.length} generator(s) and ${w.length} filter(s)`), {
29183
+ pipeline: T,
29184
+ generatorStrategies: b,
29185
+ filterStrategies: S,
28818
29186
  warnings: m
28819
29187
  };
28820
29188
  }
@@ -28844,7 +29212,9 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28844
29212
  "./generators/prescribed.ts": () => Promise.resolve().then(() => (init_prescribed(), prescribed_exports)),
28845
29213
  "./generators/srs.ts": () => Promise.resolve().then(() => (init_srs(), srs_exports)),
28846
29214
  "./generators/types.ts": () => Promise.resolve().then(() => (init_types(), types_exports)),
28847
- "./index.ts": () => Promise.resolve().then(() => (init_navigators(), navigators_exports))
29215
+ "./index.ts": () => Promise.resolve().then(() => (init_navigators(), navigators_exports)),
29216
+ "./pipelinePlan.ts": () => Promise.resolve().then(() => (init_pipelinePlan(), pipelinePlan_exports)),
29217
+ "./regulators.ts": () => Promise.resolve().then(() => (init_regulators(), regulators_exports))
28848
29218
  });
28849
29219
  } }), navigators_exports = {}, __export(navigators_exports, {
28850
29220
  ContentNavigator: () => ContentNavigator,
@@ -28860,6 +29230,7 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28860
29230
  drainCapturedRuns: () => drainCapturedRuns,
28861
29231
  getActivePipeline: () => getActivePipeline,
28862
29232
  getCardOrigin: () => getCardOrigin,
29233
+ getRegisteredFilterKind: () => getRegisteredFilterKind,
28863
29234
  getRegisteredNavigator: () => getRegisteredNavigator,
28864
29235
  getRegisteredNavigatorNames: () => getRegisteredNavigatorNames,
28865
29236
  getRegisteredNavigatorRole: () => getRegisteredNavigatorRole,
@@ -28875,14 +29246,15 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28875
29246
  registerNavigator: () => registerNavigator,
28876
29247
  setDebugSessionId: () => setDebugSessionId
28877
29248
  }), init_navigators = __esm({ "src/core/navigators/index.ts"() {
28878
- init_diversityRerank(), init_PipelineDebugger(), init_SrsDebugger(), init_StrategyPressureDebugger(), init_logger(), init_(), init_2(), init_3(), navigatorRegistry = /* @__PURE__ */ new Map(), Navigators = /* @__PURE__ */ ((t) => (t.ELO = "elo", t.SRS = "srs", t.PRESCRIBED = "prescribed", t.HIERARCHY = "hierarchyDefinition", t.INTERFERENCE = "interferenceMitigator", t.RELATIVE_PRIORITY = "relativePriority", t.USER_TAG_PREFERENCE = "userTagPreference", t))(Navigators || {}), NavigatorRole = /* @__PURE__ */ ((t) => (t.GENERATOR = "generator", t.FILTER = "filter", t))(NavigatorRole || {}), NavigatorRoles = {
29249
+ init_diversityRerank(), init_PipelineDebugger(), init_SrsDebugger(), init_StrategyPressureDebugger(), init_logger(), init_(), init_2(), init_3(), navigatorRegistry = /* @__PURE__ */ new Map(), Navigators = /* @__PURE__ */ ((t) => (t.ELO = "elo", t.SRS = "srs", t.PRESCRIBED = "prescribed", t.HIERARCHY = "hierarchyDefinition", t.INTERFERENCE = "interferenceMitigator", t.RELATIVE_PRIORITY = "relativePriority", t.USER_TAG_PREFERENCE = "userTagPreference", t.ELO_DISTANCE = "eloDistance", t))(Navigators || {}), NavigatorRole = /* @__PURE__ */ ((t) => (t.GENERATOR = "generator", t.FILTER = "filter", t))(NavigatorRole || {}), NavigatorRoles = {
28879
29250
  elo: "generator",
28880
29251
  srs: "generator",
28881
29252
  prescribed: "generator",
28882
29253
  hierarchyDefinition: "filter",
28883
29254
  interferenceMitigator: "filter",
28884
29255
  relativePriority: "filter",
28885
- userTagPreference: "filter"
29256
+ userTagPreference: "filter",
29257
+ eloDistance: "filter"
28886
29258
  }, ContentNavigator = class {
28887
29259
  constructor(t, c, u) {
28888
29260
  _defineProperty$2(this, "user", void 0), _defineProperty$2(this, "course", void 0), _defineProperty$2(this, "strategyName", void 0), _defineProperty$2(this, "strategyId", void 0), _defineProperty$2(this, "learnable", void 0), _defineProperty$2(this, "staticWeight", void 0), this.user = t, this.course = c, u && (this.strategyName = u.name, this.strategyId = u._id, this.learnable = u.learnable, this.staticWeight = u.staticWeight);
@@ -29232,6 +29604,9 @@ ${t.stack}` : JSON.stringify(t);
29232
29604
  setEphemeralHints(t) {
29233
29605
  this._pendingHints = t;
29234
29606
  }
29607
+ notePresented(t) {
29608
+ t.status === "new" && this._getCurrentUser().then((t) => this._getCachedNavigator(t)).then(({ navigator: c }) => c.notePresented?.(t)).catch((t) => logger.warn(`[courseDB] Could not note a presentation: ${t}`));
29609
+ }
29235
29610
  async getWeightedCards(t) {
29236
29611
  let c = await this._getCurrentUser();
29237
29612
  try {
@@ -31111,7 +31486,8 @@ ${t.stack}` : JSON.stringify(t);
31111
31486
  ...u.hints ? { hints: u.hints } : {},
31112
31487
  ...u.discardedTail ? { discardedTail: u.discardedTail } : {},
31113
31488
  cards: persistedRunCards(u),
31114
- ...u.unselectedNew ? { unselectedNew: persistedUnselectedNew(u.unselectedNew) } : {}
31489
+ ...u.unselectedNew ? { unselectedNew: persistedUnselectedNew(u.unselectedNew) } : {},
31490
+ ...u.regulators ? { regulators: u.regulators.map(persistedReading) } : {}
31115
31491
  });
31116
31492
  }
31117
31493
  }
@@ -31441,7 +31817,13 @@ ${t.stack}` : JSON.stringify(t);
31441
31817
  if (c || (c = await this.hydrationService.waitForCard(t.cardID)), this.removeItemFromQueue(t), c) {
31442
31818
  await this.hydrationService.ensureHydratedCards(), this._currentCard = c;
31443
31819
  let u = t.status === "review" || t.status === "failed-review" ? "review" : t.status === "new" || t.status === "failed-new" ? "new" : "failed", d = t.status.startsWith("failed") ? "failedQ" : "supplyQ";
31444
- return recordCardPresentation(t.cardID, t.courseID, this.courseNameCache.get(t.courseID), u, d, t.score), snapshotQueues(this.supplyQ.length, this.failedQ.length), c;
31820
+ recordCardPresentation(t.cardID, t.courseID, this.courseNameCache.get(t.courseID), u, d, t.score);
31821
+ for (let c of this.sources) c.notePresented?.({
31822
+ cardId: t.cardID,
31823
+ courseId: t.courseID,
31824
+ status: t.status
31825
+ });
31826
+ return snapshotQueues(this.supplyQ.length, this.failedQ.length), c;
31445
31827
  }
31446
31828
  this.log(`Skipping card ${t.cardID}: hydration failed, trying next`), isReview(t) && this.srsService.removeReview(t.reviewID);
31447
31829
  }
@@ -32786,6 +33168,9 @@ Currently logged-in as ${this._username}.`);
32786
33168
  setEphemeralHints(t) {
32787
33169
  this._pendingHints = t;
32788
33170
  }
33171
+ notePresented(t) {
33172
+ t.status === "new" && this.createNavigator(this.userDB).then((c) => c.notePresented?.(t)).catch((t) => logger.warn(`[static/courseDB] Could not note a presentation: ${t}`));
33173
+ }
32789
33174
  async getWeightedCards(t) {
32790
33175
  try {
32791
33176
  let c = await this.createNavigator(this.userDB);
@@ -33122,7 +33507,7 @@ ${c.id}:`), logger.info(JSON.stringify(c.doc, null, 2));
33122
33507
  }, mountUserDBDebugger();
33123
33508
  } }), init_core = __esm({ "src/core/index.ts"() {
33124
33509
  init_interfaces(), init_types_legacy(), init_user(), init_strategyState(), init_userOutcome(), init_studySession(), init_hydration(), init_Loggable(), init_util(), init_navigators(), init_bulkImport(), init_orchestration(), init_UserDBDebugger();
33125
- } }), init_core(), init_courseLookupDB(), init_logger(), init_study(), init_util2(), init_factory(), init_userDBHelpers();
33510
+ } }), init_core(), init_pipelinePlan(), init_regulators(), init_courseLookupDB(), init_logger(), init_study(), init_util2(), init_factory(), init_userDBHelpers();
33126
33511
  }));
33127
33512
  //#endregion
33128
33513
  //#region ../../node_modules/vue-router/dist/vue-router.mjs