assignment-user-matcher 1.15.0 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +378 -9
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/learning/atomic-ingestion.d.ts +11 -0
- package/dist/learning/atomic-ingestion.d.ts.map +1 -0
- package/dist/learning/atomic-ingestion.js +187 -0
- package/dist/learning/auto-weights.d.ts +13 -2
- package/dist/learning/auto-weights.d.ts.map +1 -1
- package/dist/learning/auto-weights.js +203 -35
- package/dist/learning/features.d.ts +5 -3
- package/dist/learning/features.d.ts.map +1 -1
- package/dist/learning/features.js +105 -4
- package/dist/learning/policy.d.ts +57 -0
- package/dist/learning/policy.d.ts.map +1 -0
- package/dist/learning/policy.js +71 -0
- package/dist/managers/LearningManager.d.ts +312 -35
- package/dist/managers/LearningManager.d.ts.map +1 -1
- package/dist/managers/LearningManager.js +1006 -168
- package/dist/matcher.class.d.ts +98 -11
- package/dist/matcher.class.d.ts.map +1 -1
- package/dist/matcher.class.js +247 -40
- package/dist/scheduling/constraints/cost.d.ts.map +1 -1
- package/dist/scheduling/constraints/cost.js +3 -2
- package/dist/scheduling/constraints/employee-scope.d.ts +5 -0
- package/dist/scheduling/constraints/employee-scope.d.ts.map +1 -0
- package/dist/scheduling/constraints/employee-scope.js +157 -0
- package/dist/scheduling/constraints/notice.d.ts.map +1 -1
- package/dist/scheduling/constraints/notice.js +8 -5
- package/dist/scheduling/constraints/rest-days.d.ts.map +1 -1
- package/dist/scheduling/constraints/rest-days.js +6 -6
- package/dist/scheduling/cost.d.ts.map +1 -1
- package/dist/scheduling/cost.js +2 -1
- package/dist/scheduling/engine/construction.d.ts +11 -3
- package/dist/scheduling/engine/construction.d.ts.map +1 -1
- package/dist/scheduling/engine/construction.js +31 -6
- package/dist/scheduling/engine/objective.d.ts +4 -4
- package/dist/scheduling/engine/objective.d.ts.map +1 -1
- package/dist/scheduling/engine/objective.js +12 -4
- package/dist/scheduling/engine/propagation.js +2 -1
- package/dist/scheduling/engine/search.d.ts +1 -0
- package/dist/scheduling/engine/search.d.ts.map +1 -1
- package/dist/scheduling/engine/search.js +1 -1
- package/dist/scheduling/engine/state.d.ts.map +1 -1
- package/dist/scheduling/engine/state.js +4 -0
- package/dist/scheduling/index.d.ts +1 -1
- package/dist/scheduling/index.d.ts.map +1 -1
- package/dist/scheduling/model.d.ts +1 -1
- package/dist/scheduling/model.d.ts.map +1 -1
- package/dist/scheduling/model.js +184 -42
- package/dist/scheduling/operations.d.ts +4 -0
- package/dist/scheduling/operations.d.ts.map +1 -1
- package/dist/scheduling/operations.js +36 -16
- package/dist/scheduling/provenance.d.ts +1 -1
- package/dist/scheduling/provenance.d.ts.map +1 -1
- package/dist/scheduling/provenance.js +16 -2
- package/dist/scheduling/scheduler.class.d.ts +1 -1
- package/dist/scheduling/scheduler.class.d.ts.map +1 -1
- package/dist/scheduling/scheduler.class.js +5 -3
- package/dist/scheduling/time.d.ts +2 -0
- package/dist/scheduling/time.d.ts.map +1 -1
- package/dist/scheduling/time.js +26 -1
- package/dist/scheduling/types.d.ts +78 -3
- package/dist/scheduling/types.d.ts.map +1 -1
- package/dist/types/matcher.d.ts +309 -4
- package/dist/types/matcher.d.ts.map +1 -1
- package/dist/utils/keys.d.ts +12 -2
- package/dist/utils/keys.d.ts.map +1 -1
- package/dist/utils/keys.js +35 -2
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notice.d.ts","sourceRoot":"","sources":["../../../src/scheduling/constraints/notice.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAER,UAAU,EAEV,oBAAoB,EACpB,WAAW,EAEd,MAAM,UAAU,CAAC;AAGlB,eAAO,MAAM,eAAe,oCAAoC,CAAC;AAEjE,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,oBAAoB,CAoEjE;AAwBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,GAAG,SAAS;;;;;;
|
|
1
|
+
{"version":3,"file":"notice.d.ts","sourceRoot":"","sources":["../../../src/scheduling/constraints/notice.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAER,UAAU,EAEV,oBAAoB,EACpB,WAAW,EAEd,MAAM,UAAU,CAAC;AAGlB,eAAO,MAAM,eAAe,oCAAoC,CAAC;AAEjE,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,oBAAoB,CAoEjE;AAwBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,GAAG,SAAS;;;;;;IA2BlF"}
|
|
@@ -113,24 +113,27 @@ function noticeShortfall(state, inst, rule) {
|
|
|
113
113
|
* that matters.
|
|
114
114
|
*/
|
|
115
115
|
function cancellationLedger(state, rule) {
|
|
116
|
-
if (!rule?.cancellationCompensationMinutes)
|
|
117
|
-
return [];
|
|
118
116
|
const out = [];
|
|
119
117
|
for (const key of state.ctx.publishedPairs) {
|
|
120
118
|
const [employeeId, instanceId] = key.split('|');
|
|
119
|
+
const applied = Object.prototype.hasOwnProperty.call(state.ctx.employeeById.get(employeeId)?.rules ?? {}, 'notice')
|
|
120
|
+
? (0, support_1.rulesFor)(state.ctx, employeeId).notice
|
|
121
|
+
: ((0, support_1.rulesFor)(state.ctx, employeeId).notice ?? rule);
|
|
122
|
+
if (!applied?.cancellationCompensationMinutes)
|
|
123
|
+
continue;
|
|
121
124
|
if (state.assignments.get(instanceId)?.has(employeeId))
|
|
122
125
|
continue;
|
|
123
126
|
const inst = state.ctx.instanceById.get(instanceId);
|
|
124
|
-
if (
|
|
127
|
+
if (applied.cancellationDeadlineMinutes !== undefined &&
|
|
125
128
|
state.ctx.asOfMinute !== undefined &&
|
|
126
129
|
inst !== undefined &&
|
|
127
|
-
inst.startMinute - state.ctx.asOfMinute >=
|
|
130
|
+
inst.startMinute - state.ctx.asOfMinute >= applied.cancellationDeadlineMinutes) {
|
|
128
131
|
continue; // cancelled with the deadline still ahead — no liability
|
|
129
132
|
}
|
|
130
133
|
out.push({
|
|
131
134
|
kind: 'lateCancellationPay',
|
|
132
135
|
employeeId,
|
|
133
|
-
minutes: Math.max(
|
|
136
|
+
minutes: Math.max(applied.cancellationCompensationMinutes, inst?.workingMinutes ?? 0),
|
|
134
137
|
reason: `published assignment "${instanceId}" was cancelled`,
|
|
135
138
|
citation: exports.NOTICE_CITATION,
|
|
136
139
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rest-days.d.ts","sourceRoot":"","sources":["../../../src/scheduling/constraints/rest-days.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAER,WAAW,EACX,WAAW,EAEX,oBAAoB,EACpB,WAAW,EACd,MAAM,UAAU,CAAC;AAIlB,eAAO,MAAM,eAAe,qCAAqC,CAAC;AAElE,wBAAgB,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,oBAAoB,CAgEhE;AAwBD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,GAAG,SAAS,GAAG,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"rest-days.d.ts","sourceRoot":"","sources":["../../../src/scheduling/constraints/rest-days.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAER,WAAW,EACX,WAAW,EAEX,oBAAoB,EACpB,WAAW,EACd,MAAM,UAAU,CAAC;AAIlB,eAAO,MAAM,eAAe,qCAAqC,CAAC;AAElE,wBAAgB,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,oBAAoB,CAgEhE;AAwBD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,GAAG,SAAS,GAAG,WAAW,EAAE,CAwBvG"}
|
|
@@ -107,18 +107,18 @@ function sundaysInPeriod(state) {
|
|
|
107
107
|
* honest output is a dated debt the operator can act on.
|
|
108
108
|
*/
|
|
109
109
|
function compensatoryRestLedger(state, rule) {
|
|
110
|
-
const within = rule?.compensatoryRestWithinDays;
|
|
111
|
-
if (!within)
|
|
112
|
-
return [];
|
|
113
110
|
const out = [];
|
|
114
111
|
for (const [instanceId, employees] of state.assignments) {
|
|
115
112
|
const inst = state.ctx.instanceById.get(instanceId);
|
|
116
113
|
if (!inst || employees.size === 0)
|
|
117
114
|
continue;
|
|
118
|
-
const deadlineDays = inst.isPublicHoliday ? within.holiday : inst.isSunday ? within.sunday : undefined;
|
|
119
|
-
if (deadlineDays === undefined)
|
|
120
|
-
continue;
|
|
121
115
|
for (const employeeId of employees) {
|
|
116
|
+
const within = (Object.prototype.hasOwnProperty.call(state.ctx.employeeById.get(employeeId)?.rules ?? {}, 'restDays')
|
|
117
|
+
? (0, support_1.rulesFor)(state.ctx, employeeId).restDays
|
|
118
|
+
: ((0, support_1.rulesFor)(state.ctx, employeeId).restDays ?? rule))?.compensatoryRestWithinDays;
|
|
119
|
+
const deadlineDays = inst.isPublicHoliday ? within?.holiday : inst.isSunday ? within?.sunday : undefined;
|
|
120
|
+
if (deadlineDays === undefined)
|
|
121
|
+
continue;
|
|
122
122
|
out.push({
|
|
123
123
|
kind: 'substituteRestDay',
|
|
124
124
|
employeeId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cost.d.ts","sourceRoot":"","sources":["../../src/scheduling/cost.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;
|
|
1
|
+
{"version":3,"file":"cost.d.ts","sourceRoot":"","sources":["../../src/scheduling/cost.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGlG;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,YAAY,GAAG,SAAS,EAAE,UAAU,CAAC,EAAE,cAAc,GAAG,MAAM,CAsBvH;AAaD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,SAAS,GAAG,MAAM,CAIpG;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC7B,IAAI,EAAE,aAAa,EACnB,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,MAAM,EACrB,UAAU,CAAC,EAAE,cAAc,GAC5B,MAAM,CAQR;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG,SAAS,CAiBrH"}
|
package/dist/scheduling/cost.js
CHANGED
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
*/
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.rosterCost = exports.marginalCostCents = exports.overtimeSurchargeCents = exports.shiftCostCents = void 0;
|
|
27
|
+
const support_1 = require("./constraints/support");
|
|
27
28
|
const engagement_floor_1 = require("./constraints/engagement-floor");
|
|
28
29
|
/**
|
|
29
30
|
* Price of one shift for one cost model, excluding any overtime surcharge.
|
|
@@ -108,7 +109,7 @@ function rosterCost(state) {
|
|
|
108
109
|
for (const instanceId of state.byEmployee.get(employee.id) ?? []) {
|
|
109
110
|
const inst = ctx.instanceById.get(instanceId);
|
|
110
111
|
if (inst)
|
|
111
|
-
cents += shiftCostCents(inst, employee.cost, ctx.
|
|
112
|
+
cents += shiftCostCents(inst, employee.cost, (0, support_1.rulesFor)(ctx, employee.id).engagement);
|
|
112
113
|
}
|
|
113
114
|
cents += overtimeSurchargeCents(state.minutesByEmployee.get(employee.id) ?? 0, employee.cost);
|
|
114
115
|
if (cents > 0)
|
|
@@ -29,9 +29,17 @@ export declare function constructionOrder(ctx: ModelContext, propagation: Propag
|
|
|
29
29
|
* shifts with room. Each pick is the eligible, hard-compliant shift that
|
|
30
30
|
* closes the most of the gap, preferring the least-staffed occurrence so the
|
|
31
31
|
* extra headcount spreads rather than piles onto one day. Repeats until no
|
|
32
|
-
* assignment would bring anyone closer to their target.
|
|
33
|
-
*
|
|
34
|
-
*
|
|
32
|
+
* assignment would bring anyone closer to their target.
|
|
33
|
+
*
|
|
34
|
+
* **Room is `maxEmployees`, and a shift that states none has none.** A shift
|
|
35
|
+
* asking for one person needs one person; a second body there does not do a
|
|
36
|
+
* second body's work, and planning one would be inventing demand to absorb
|
|
37
|
+
* contracted hours. Left unbounded this pass staffs everybody on everything —
|
|
38
|
+
* five full-timers on twenty-two single-person shifts came out as a hundred
|
|
39
|
+
* and ten assignments, all of them lawful and none of them wanted. So the
|
|
40
|
+
* caller states where extra people are useful, the same way they state every
|
|
41
|
+
* other fact about the work, and `maxEmployees` is that statement. Filling
|
|
42
|
+
* unstaffed cover is a different matter and stays the greedy fill's job.
|
|
35
43
|
*/
|
|
36
44
|
export declare function fillToContract(ctx: ModelContext, state: InternalState, propagation: PropagationResult, rand: () => number): void;
|
|
37
45
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"construction.d.ts","sourceRoot":"","sources":["../../../src/scheduling/engine/construction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAU,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAGrD,wEAAwE;AACxE,wBAAgB,aAAa,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAKtH;
|
|
1
|
+
{"version":3,"file":"construction.d.ts","sourceRoot":"","sources":["../../../src/scheduling/engine/construction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAU,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAGrD,wEAAwE;AACxE,wBAAgB,aAAa,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAKtH;AAkED,gGAAgG;AAChG,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,YAAY,EAAE,WAAW,EAAE,iBAAiB,GAAG,MAAM,EAAE,CAS7F;AAwDD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,cAAc,CAC1B,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,aAAa,EACpB,WAAW,EAAE,iBAAiB,EAC9B,IAAI,EAAE,MAAM,MAAM,GACnB,IAAI,CA0CN;AAKD;;;;GAIG;AACH,wBAAgB,UAAU,CACtB,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,aAAa,EACpB,WAAW,EAAE,iBAAiB,EAC9B,SAAS,EAAE,UAAU,GAAG,UAAU,EAClC,IAAI,EAAE,MAAM,MAAM,EAClB,WAAW,CAAC,EAAE,MAAM,EAAE,GACvB,IAAI,CA6BN"}
|
|
@@ -48,6 +48,8 @@ function rankCandidate(ctx, state, instanceId, employeeId, objective, rand) {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
+
const planned = state.minutesByEmployee.get(employeeId) ?? 0;
|
|
52
|
+
const contracted = ctx.contractedPeriodMinutes.get(employeeId);
|
|
51
53
|
if (objective === 'balanced') {
|
|
52
54
|
// Less-loaded employees first so hours equalize — measured against the
|
|
53
55
|
// hours each of them is owed, not against zero. Raw minutes read a
|
|
@@ -56,11 +58,22 @@ function rankCandidate(ctx, state, instanceId, employeeId, objective, rand) {
|
|
|
56
58
|
// distance from a contracted total is the load a person actually
|
|
57
59
|
// carries. Without a contract there is nothing to measure against, so
|
|
58
60
|
// absolute hours remain the only reading.
|
|
59
|
-
const planned = state.minutesByEmployee.get(employeeId) ?? 0;
|
|
60
|
-
const contracted = ctx.contractedPeriodMinutes.get(employeeId);
|
|
61
61
|
rank += (contracted === undefined ? planned : planned - contracted) / 60;
|
|
62
62
|
reasons.push('selected to balance hours');
|
|
63
63
|
}
|
|
64
|
+
else if (contracted !== undefined) {
|
|
65
|
+
// Furthest from their contract first, even under the standard
|
|
66
|
+
// objective. `contractHoursPenalty` sums |planned − contracted|, which
|
|
67
|
+
// is *flat* under redistribution while everybody is still short: with
|
|
68
|
+
// less work than the team is contracted for, moving a shift from the
|
|
69
|
+
// person on 67h to the person on none leaves the score untouched, and
|
|
70
|
+
// the search has no reason to prefer either. The objective cannot
|
|
71
|
+
// separate those rosters, so construction has to — otherwise a team
|
|
72
|
+
// whose demand is thinner than its payroll gets one person loaded and
|
|
73
|
+
// one with nothing, both scoring identically.
|
|
74
|
+
rank += (planned - contracted) / 60;
|
|
75
|
+
reasons.push('furthest from their contracted hours');
|
|
76
|
+
}
|
|
64
77
|
else {
|
|
65
78
|
reasons.push('eligible under all constraints');
|
|
66
79
|
}
|
|
@@ -143,9 +156,17 @@ function closesGap(ctx, state, employeeId, workingMinutes) {
|
|
|
143
156
|
* shifts with room. Each pick is the eligible, hard-compliant shift that
|
|
144
157
|
* closes the most of the gap, preferring the least-staffed occurrence so the
|
|
145
158
|
* extra headcount spreads rather than piles onto one day. Repeats until no
|
|
146
|
-
* assignment would bring anyone closer to their target.
|
|
147
|
-
*
|
|
148
|
-
*
|
|
159
|
+
* assignment would bring anyone closer to their target.
|
|
160
|
+
*
|
|
161
|
+
* **Room is `maxEmployees`, and a shift that states none has none.** A shift
|
|
162
|
+
* asking for one person needs one person; a second body there does not do a
|
|
163
|
+
* second body's work, and planning one would be inventing demand to absorb
|
|
164
|
+
* contracted hours. Left unbounded this pass staffs everybody on everything —
|
|
165
|
+
* five full-timers on twenty-two single-person shifts came out as a hundred
|
|
166
|
+
* and ten assignments, all of them lawful and none of them wanted. So the
|
|
167
|
+
* caller states where extra people are useful, the same way they state every
|
|
168
|
+
* other fact about the work, and `maxEmployees` is that statement. Filling
|
|
169
|
+
* unstaffed cover is a different matter and stays the greedy fill's job.
|
|
149
170
|
*/
|
|
150
171
|
function fillToContract(ctx, state, propagation, rand) {
|
|
151
172
|
if (!ctx.fillToContract)
|
|
@@ -168,7 +189,11 @@ function fillToContract(ctx, state, propagation, rand) {
|
|
|
168
189
|
if (!inst || inst.workingMinutes <= 0 || state.isAssigned(entry.employeeId, instanceId))
|
|
169
190
|
continue;
|
|
170
191
|
const staffed = state.assignments.get(instanceId)?.size ?? 0;
|
|
171
|
-
|
|
192
|
+
// `maxEmployees ?? minEmployees`: unstated room is no room.
|
|
193
|
+
// `hardCompliant` below re-checks the declared maximum through
|
|
194
|
+
// the group-composition rule; this is the bound that keeps an
|
|
195
|
+
// unstated one from meaning "unlimited".
|
|
196
|
+
if (staffed >= (inst.maxEmployees ?? inst.minEmployees))
|
|
172
197
|
continue;
|
|
173
198
|
if (!closesGap(ctx, state, entry.employeeId, inst.workingMinutes))
|
|
174
199
|
continue;
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
* gradient to climb out of an infeasible region; a 0/1 flag leaves it on a
|
|
20
20
|
* plateau with nothing to follow.
|
|
21
21
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
22
|
+
* Built-in aggregates use dedicated scoring terms below. Custom `evaluate`
|
|
23
|
+
* hooks also contribute to the score, so extension rules can steer search.
|
|
24
|
+
* Their authors should keep these hooks cheap: they run for each candidate
|
|
25
|
+
* roster. All aggregate hooks run again during final validation.
|
|
26
26
|
*/
|
|
27
27
|
import type { FairnessRule, ModelContext, SearchState } from '../types';
|
|
28
28
|
export declare const UNFILLED_WEIGHT = 10000;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objective.d.ts","sourceRoot":"","sources":["../../../src/scheduling/engine/objective.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAKxE,eAAO,MAAM,eAAe,QAAS,CAAC;AACtC,eAAO,MAAM,oBAAoB,OAAQ,CAAC;AAC1C,eAAO,MAAM,gBAAgB,MAAM,CAAC;AACpC,6EAA6E;AAC7E,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC,2DAA2D;AAC3D,MAAM,WAAW,QAAQ;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,+EAA+E;AAC/E,wBAAgB,aAAa,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,GAAG,MAAM,CAI9D;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,GAAG,OAAO,CAE1D;AAED,gEAAgE;AAChE,wBAAgB,YAAY,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAI9F;AAED,6EAA6E;AAC7E,wBAAgB,WAAW,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,E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CACjB,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,UAAU,GAAG,UAAU,EAClC,cAAc,EAAE,MAAM,GACvB,MAAM,CAGR"}
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
* gradient to climb out of an infeasible region; a 0/1 flag leaves it on a
|
|
21
21
|
* plateau with nothing to follow.
|
|
22
22
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
23
|
+
* Built-in aggregates use dedicated scoring terms below. Custom `evaluate`
|
|
24
|
+
* hooks also contribute to the score, so extension rules can steer search.
|
|
25
|
+
* Their authors should keep these hooks cheap: they run for each candidate
|
|
26
|
+
* roster. All aggregate hooks run again during final validation.
|
|
27
27
|
*/
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.score = exports.scoreLex = exports.softBreaches = exports.breachTotals = exports.minHoursShortfalls = exports.hoursVariance = exports.unfilledSlots = exports.tagShortage = exports.slotShortage = exports.isBetter = exports.compareScores = exports.DEFAULT_SOFT_WEIGHT = exports.MIN_HOURS_WEIGHT = exports.TAG_SHORTFALL_WEIGHT = exports.UNFILLED_WEIGHT = void 0;
|
|
@@ -136,6 +136,14 @@ exports.softBreaches = softBreaches;
|
|
|
136
136
|
/** The full three-level score. Lower is better at every level. */
|
|
137
137
|
function scoreLex(ctx, state, objective, minHoursWeight, fairnessRules) {
|
|
138
138
|
const totals = breachTotals(ctx, state);
|
|
139
|
+
for (const constraint of ctx.aggregateConstraints ?? []) {
|
|
140
|
+
for (const violation of constraint.evaluate?.(state) ?? []) {
|
|
141
|
+
const magnitude = violation.actual !== undefined && violation.required !== undefined
|
|
142
|
+
? Math.max(1, Math.abs(violation.actual - violation.required))
|
|
143
|
+
: 1;
|
|
144
|
+
totals[violation.severity] += magnitude * (constraint.weight ?? exports.DEFAULT_SOFT_WEIGHT);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
139
147
|
for (const inst of ctx.instances) {
|
|
140
148
|
totals.medium += slotShortage(ctx, state, inst.id) * exports.UNFILLED_WEIGHT;
|
|
141
149
|
totals.medium += tagShortage(ctx, state, inst.id) * exports.TAG_SHORTFALL_WEIGHT;
|
|
@@ -15,7 +15,8 @@ function propagate(ctx) {
|
|
|
15
15
|
eligibility.set(emp.id, new Set(ctx.instances.map((i) => i.id)));
|
|
16
16
|
}
|
|
17
17
|
for (const constraint of ctx.constraints) {
|
|
18
|
-
constraint.
|
|
18
|
+
if (constraint.hardness === 'hard')
|
|
19
|
+
constraint.prune?.(ctx, eligibility);
|
|
19
20
|
}
|
|
20
21
|
const eligibleByInstance = new Map();
|
|
21
22
|
for (const inst of ctx.instances)
|
|
@@ -29,6 +29,7 @@ export interface SearchOptions {
|
|
|
29
29
|
objective: 'standard' | 'balanced';
|
|
30
30
|
minHoursWeight: number;
|
|
31
31
|
timeBudgetMs: number;
|
|
32
|
+
maxIterations?: number;
|
|
32
33
|
rand: () => number;
|
|
33
34
|
now?: () => number;
|
|
34
35
|
/** Late-acceptance history length. Larger accepts more drift. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/scheduling/engine/search.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,OAAO,EAAgE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC1G,OAAO,EAAmC,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAG9E,MAAM,WAAW,aAAa;IAC1B,SAAS,EAAE,UAAU,GAAG,UAAU,CAAC;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,MAAM,CAAC;IACnB,GAAG,CAAC,EA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AAM,WAAW,aAAa;IAC1B,IAAI,EAAE,aAAa,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;CAC7B;AAiCD;;;;;GAKG;AACH,wBAAgB,cAAc,CAC1B,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,aAAa,EACpB,WAAW,EAAE,iBAAiB,EAC9B,OAAO,EAAE,aAAa,EACtB,gBAAgB,EAAE,MAAM,aAAa,GACtC,aAAa,CA4Ef"}
|
|
@@ -71,7 +71,7 @@ function improveWithLns(ctx, state, propagation, options, createEmptyState) {
|
|
|
71
71
|
const historyLength = Math.max(1, options.historyLength ?? DEFAULT_HISTORY_LENGTH);
|
|
72
72
|
const history = new Array(historyLength).fill(workingScore);
|
|
73
73
|
let iteration = 0;
|
|
74
|
-
while (now() < deadline) {
|
|
74
|
+
while (now() < deadline && iteration < (options.maxIterations ?? Infinity)) {
|
|
75
75
|
const total = (0, state_1.assignedPairs)(working).length;
|
|
76
76
|
if (total === 0)
|
|
77
77
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/scheduling/engine/state.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG1D,MAAM,WAAW,aAAc,SAAQ,WAAW;IAC9C,0FAA0F;IAC1F,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAClC;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,YAAY,GAAG,aAAa,CAsB5D;AAED,wBAAgB,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/scheduling/engine/state.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG1D,MAAM,WAAW,aAAc,SAAQ,WAAW;IAC9C,0FAA0F;IAC1F,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAClC;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,YAAY,GAAG,aAAa,CAsB5D;AAED,wBAAgB,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAuB5G;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAY3F;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAE9E;AAED,yFAAyF;AACzF,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,KAAK,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAQrG"}
|
|
@@ -44,6 +44,8 @@ function assign(state, employeeId, instanceId, reasons) {
|
|
|
44
44
|
// employee the model never saw would corrupt the fairness and cost sums.
|
|
45
45
|
if (!inst || !state.ctx.employeeById.has(employeeId))
|
|
46
46
|
return;
|
|
47
|
+
if (state.isAssigned(employeeId, instanceId))
|
|
48
|
+
return;
|
|
47
49
|
state.assignments.get(instanceId)?.add(employeeId);
|
|
48
50
|
state.byEmployee.get(employeeId)?.add(instanceId);
|
|
49
51
|
// `minutesByEmployee` tracks *working* time, which unpaid breaks and duty
|
|
@@ -65,6 +67,8 @@ function unassign(state, employeeId, instanceId) {
|
|
|
65
67
|
const inst = state.ctx.instanceById.get(instanceId);
|
|
66
68
|
if (!inst || !state.ctx.employeeById.has(employeeId))
|
|
67
69
|
return;
|
|
70
|
+
if (!state.isAssigned(employeeId, instanceId))
|
|
71
|
+
return;
|
|
68
72
|
state.assignments.get(instanceId)?.delete(employeeId);
|
|
69
73
|
state.byEmployee.get(employeeId)?.delete(instanceId);
|
|
70
74
|
state.minutesByEmployee.set(employeeId, (state.minutesByEmployee.get(employeeId) ?? 0) - inst.workingMinutes);
|
|
@@ -8,6 +8,6 @@ export { PeriodClock, type MinuteRange, type ClockRange } from './time';
|
|
|
8
8
|
export { expandShiftInstances } from './model';
|
|
9
9
|
export { hours, days, weeklyAverageOver } from './rules';
|
|
10
10
|
export { DEFAULT_CONTRACT_HOURS_WEIGHT, contractedPeriodMinutes, fullTimeWeeklyMinutes, resolveContractedWeeklyMinutes, } from './contract-hours';
|
|
11
|
-
export type { AssignmentPair, AvailabilityRule, BreakRule, ClockRangeConfig, ConsecutiveRule, ConstraintOptions, ConstraintViolation, ContractHoursRule, ContractHoursSummary, DailyRestRule, DutyClassification, DutyQuota, Employee, EmployeeContract, EmployeeCost, EmployeeProtection, EngagementRule, FairnessRule, HistoricalAssignment, LedgerEntry, ModelContext, NightVolumeQuota, NightWorkRule, NoticeRule, ObjectiveWeights, OvertimeRule, Qualification, RestDayRule, RollingAverage, RuleVerdict, ScheduleInput, ScheduleProvenance, ScheduleResult, ScheduledAssignment, SchedulingConstraint, SearchState, Severity, ShiftInstance, ShiftTemplate, Site, SiteIndex, TimeOffEntry, WeeklyRestRule, WorkingTimeLimits, WorkingTimeRules, } from './types';
|
|
11
|
+
export type { AssignmentPair, AvailabilityRule, BreakRule, ClockRangeConfig, ConsecutiveRule, ConstraintOptions, ConstraintViolation, ContractHoursRule, ContractHoursSummary, DailyRestRule, DutyClassification, DutyQuota, Employee, EmployeeContract, EmployeeCost, EmployeeProtection, EngagementRule, FairnessRule, HistoricalAssignment, LedgerEntry, ModelContext, NightVolumeQuota, NightWorkRule, NoticeRule, ObjectiveWeights, OvertimeRule, Qualification, RestDayRule, RollingAverage, RuleVerdict, ScheduleInput, ScheduleProvenance, ScheduleResult, ScheduledAssignment, SchedulingConstraint, SearchState, Severity, ShiftInstance, ShiftTemplate, ShiftDemandOverride, Site, SiteIndex, TimeOffEntry, WeeklyRestRule, WorkingTimeLimits, WorkingTimeRules, } from './types';
|
|
12
12
|
export type { PersonTimeline, TimelineEntry, TimelineIndex } from './engine/timeline';
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scheduling/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAClF,OAAO,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAClD,4FAA4F;AAC5F,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAGlE,OAAO,EACH,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,mBAAmB,GAC3B,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,QAAQ,CAAC;AAKxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAI/C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAKzD,OAAO,EACH,6BAA6B,EAC7B,uBAAuB,EACvB,qBAAqB,EACrB,8BAA8B,GACjC,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACR,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,kBAAkB,EAClB,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,WAAW,EACX,cAAc,EACd,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,EACX,QAAQ,EACR,aAAa,EACb,aAAa,EACb,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,gBAAgB,GACnB,MAAM,SAAS,CAAC;AAIjB,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scheduling/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAClF,OAAO,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAClD,4FAA4F;AAC5F,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAGlE,OAAO,EACH,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,mBAAmB,GAC3B,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,QAAQ,CAAC;AAKxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAI/C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAKzD,OAAO,EACH,6BAA6B,EAC7B,uBAAuB,EACvB,qBAAqB,EACrB,8BAA8B,GACjC,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACR,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,kBAAkB,EAClB,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,WAAW,EACX,cAAc,EACd,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,EACX,QAAQ,EACR,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,gBAAgB,GACnB,MAAM,SAAS,CAAC;AAIjB,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -52,7 +52,7 @@ export declare function expandTemplate(template: ShiftTemplate, clock: PeriodClo
|
|
|
52
52
|
*/
|
|
53
53
|
export declare function mergeRules(base: WorkingTimeRules | undefined, override: WorkingTimeRules | undefined): WorkingTimeRules;
|
|
54
54
|
/** Resolve built-in constraints with caller hardness/weight overrides, then append customs. */
|
|
55
|
-
export declare function resolveConstraints(options: ConstraintOptions | undefined, rules?: WorkingTimeRules, objectives?: ObjectiveWeights): SchedulingConstraint[];
|
|
55
|
+
export declare function resolveConstraints(options: ConstraintOptions | undefined, rules?: WorkingTimeRules, objectives?: ObjectiveWeights, employeeRules?: Map<string, WorkingTimeRules>): SchedulingConstraint[];
|
|
56
56
|
/**
|
|
57
57
|
* Normalize and validate the scheduling problem. Throws
|
|
58
58
|
* `ScheduleValidationError` on malformed input — never a silent wrong schedule.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/scheduling/model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/scheduling/model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAER,gBAAgB,EAChB,iBAAiB,EAGjB,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,gBAAgB,EACnB,MAAM,SAAS,CAAC;AASjB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAmE,MAAM,QAAQ,CAAC;AAEvH,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAE9C;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,aAAa,GAAG,aAAa,EAAE,CAqB1E;AAED,sEAAsE;AACtE,wBAAgB,cAAc,CAC1B,QAAQ,EAAE,aAAa,EACvB,KAAK,EAAE,WAAW,EAClB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE;IAAE,SAAS,CAAC,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAAC,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAAE,GACpF,aAAa,EAAE,CAgHjB;AA2ND;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,gBAAgB,G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