signalk-wakelogger 0.2.0-beta.4 → 0.2.0-beta.6
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/CHANGELOG.md +36 -1
- package/README.md +8 -4
- package/dist/config/defaults.d.ts +1 -0
- package/dist/config/defaults.js +2 -1
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/schema.d.ts +8 -0
- package/dist/config/schema.js +8 -0
- package/dist/config/schema.js.map +1 -1
- package/dist/courses/protocol.d.ts +1 -0
- package/dist/courses/protocol.js +5 -0
- package/dist/courses/protocol.js.map +1 -1
- package/dist/index.js +506 -50
- package/dist/index.js.map +1 -1
- package/dist/outbox/file-outbox.d.ts +1 -0
- package/dist/outbox/file-outbox.js +45 -33
- package/dist/outbox/file-outbox.js.map +1 -1
- package/dist/race/averages.d.ts +12 -0
- package/dist/race/averages.js +44 -0
- package/dist/race/averages.js.map +1 -0
- package/dist/race/detection.d.ts +65 -0
- package/dist/race/detection.js +150 -0
- package/dist/race/detection.js.map +1 -0
- package/dist/race/dynamic.d.ts +114 -0
- package/dist/race/dynamic.js +265 -0
- package/dist/race/dynamic.js.map +1 -0
- package/dist/race/observation-window.d.ts +81 -0
- package/dist/race/observation-window.js +198 -0
- package/dist/race/observation-window.js.map +1 -0
- package/dist/race/observations.d.ts +54 -0
- package/dist/race/observations.js +212 -0
- package/dist/race/observations.js.map +1 -0
- package/dist/race/onboard-service.d.ts +58 -0
- package/dist/race/onboard-service.js +229 -0
- package/dist/race/onboard-service.js.map +1 -0
- package/dist/race/onboard-store.d.ts +66 -0
- package/dist/race/onboard-store.js +141 -0
- package/dist/race/onboard-store.js.map +1 -0
- package/dist/race/pack.d.ts +126 -0
- package/dist/race/pack.js +317 -0
- package/dist/race/pack.js.map +1 -0
- package/dist/race/plan.d.ts +21 -0
- package/dist/race/plan.js +45 -0
- package/dist/race/plan.js.map +1 -0
- package/dist/race/progression-service.d.ts +33 -0
- package/dist/race/progression-service.js +84 -0
- package/dist/race/progression-service.js.map +1 -0
- package/dist/race/progression-store.d.ts +27 -0
- package/dist/race/progression-store.js +90 -0
- package/dist/race/progression-store.js.map +1 -0
- package/dist/race/race-pack-protocol.d.ts +114 -0
- package/dist/race/race-pack-protocol.js +463 -0
- package/dist/race/race-pack-protocol.js.map +1 -0
- package/dist/race/race-pack-store.d.ts +34 -0
- package/dist/race/race-pack-store.js +181 -0
- package/dist/race/race-pack-store.js.map +1 -0
- package/dist/race/sailing/physics.d.ts +86 -0
- package/dist/race/sailing/physics.js +254 -0
- package/dist/race/sailing/physics.js.map +1 -0
- package/dist/race/sailing/selection.d.ts +109 -0
- package/dist/race/sailing/selection.js +452 -0
- package/dist/race/sailing/selection.js.map +1 -0
- package/dist/signalk/normaliser.d.ts +6 -0
- package/dist/signalk/normaliser.js +11 -0
- package/dist/signalk/normaliser.js.map +1 -1
- package/dist/signalk/subscriber.js +3 -1
- package/dist/signalk/subscriber.js.map +1 -1
- package/dist/telemetry/types.d.ts +6 -0
- package/dist/tracking/history.d.ts +23 -0
- package/dist/tracking/history.js +96 -0
- package/dist/tracking/history.js.map +1 -0
- package/dist/transport/mqtt-client.d.ts +17 -2
- package/dist/transport/mqtt-client.js +102 -7
- package/dist/transport/mqtt-client.js.map +1 -1
- package/dist/transport/topics.d.ts +3 -0
- package/dist/transport/topics.js +3 -1
- package/dist/transport/topics.js.map +1 -1
- package/dist/trips/recording-store.js +25 -6
- package/dist/trips/recording-store.js.map +1 -1
- package/docs/course-sync.md +5 -2
- package/docs/onboard-race-guidance.md +547 -0
- package/docs/race-pack-schema.md +315 -0
- package/package.json +7 -5
- package/public/api-client.mjs +7 -0
- package/public/app.mjs +234 -7
- package/public/fonts/ALDRICH-LICENSE +93 -0
- package/public/fonts/aldrich-latin-400-normal.woff2 +0 -0
- package/public/index.html +10 -10
- package/public/race-plan.mjs +89 -0
- package/public/style.css +14 -1
- package/public/tracking-controls.mjs +22 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,42 @@
|
|
|
2
2
|
|
|
3
3
|
Updates for boat owners and crew: what's new, what's improved, and anything you need to do.
|
|
4
4
|
|
|
5
|
-
## [
|
|
5
|
+
## [0.2.0-beta.6] - 2026-09-26
|
|
6
|
+
|
|
7
|
+
### Onboard race planning matches Wake Logger exactly
|
|
8
|
+
|
|
9
|
+
- The onboard planner now starts the current leg from your boat's actual position, uses the real current in its speed and arrival estimates, and no longer assumes a fixed six-knot midpoint speed. Remaining distance and arrival times reflect where you actually are.
|
|
10
|
+
- Onboard wind is only used for the current leg once a genuine five-minute observation window is ready (30 good samples across at least four minutes, newest within 30 seconds). Until then the downloaded forecast is used, with a clear note.
|
|
11
|
+
- A downloaded course is only used when its course definition matches the Race Pack, so an edited course can't be planned against an old pack. Reversed courses are not planned rather than being calculated the wrong way round.
|
|
12
|
+
- Wake Logger cloud now calculates the remaining race with exactly the same rules as the onboard planner, so the two agree. Raw instrument samples are aggregated with the same method on both sides, and the Live tracking ON and OFF views show the same plan and sail recommendation.
|
|
13
|
+
|
|
14
|
+
### Reliable Race Pack and race-plan hand-over
|
|
15
|
+
|
|
16
|
+
- A removed or archived course now clears the onboard Race Pack durably, so a stale copy can't reappear after a restart or reconnect.
|
|
17
|
+
- Onboard race-plan updates are only removed once Wake Logger confirms it stored them; if the confirmation is missed they are sent again after reconnecting or restarting.
|
|
18
|
+
- Onboard race-plan updates now carry the recording session they came from, so Wake Logger links them to the right outing even when they arrive late.
|
|
19
|
+
- Switching Live tracking off sends one final onboard status and then stops transmitting immediately. The final onboard status is kept by the server after the plugin disconnects, and an unexpected connection loss still reports the vessel offline.
|
|
20
|
+
- Added a production-like broker test (`npm run test:broker:dynsec`) that runs against a real Mosquitto dynamic-security broker and the Wake Logger cloud provisioning/framing functions.
|
|
21
|
+
|
|
22
|
+
## [0.2.0-beta.5] - 2026-09-16
|
|
23
|
+
|
|
24
|
+
### Live tracking when you want it
|
|
25
|
+
|
|
26
|
+
- Turn live tracking on or off directly from the onboard map. When it's off, your trip still records on board and uploads later; turn it back on to resume live updates.
|
|
27
|
+
- The setting is remembered across restarts, and changing it does not split a trip.
|
|
28
|
+
|
|
29
|
+
### A clearer map and upload status
|
|
30
|
+
|
|
31
|
+
- The onboard map now matches Wake Logger's live instrument view, with layouts for phones and tablets and a full-screen option.
|
|
32
|
+
- Historical uploads show percentage progress and an estimated time remaining once upload speed can be measured. A coloured live-tracking indicator makes connection status easier to see.
|
|
33
|
+
- Expandable recording details keep the main upload view compact, and only real trips are created from your recordings.
|
|
34
|
+
|
|
35
|
+
### Crew can use their own Signal K accounts
|
|
36
|
+
|
|
37
|
+
- The onboard map no longer requires the Signal K administrator login. Any crew member with a Signal K account can sign in and view the map.
|
|
38
|
+
- Changing live tracking or activating a course needs an account with read/write access — ask your Signal K administrator to set this for your account. Unpairing the vessel still requires an administrator.
|
|
39
|
+
- If your crew don't have Signal K accounts yet, an administrator can add them in Signal K's **Security** settings.
|
|
40
|
+
|
|
6
41
|
|
|
7
42
|
## [0.2.0-beta.4] - 2026-09-14
|
|
8
43
|
|
package/README.md
CHANGED
|
@@ -39,9 +39,11 @@ Recording and uploading are separate. Keep Signal K and the Wake Logger plugin r
|
|
|
39
39
|
|
|
40
40
|
**For normal use:** Leave **Upload mode** set to **Automatic upload**. If internet access drops, the plugin stores readings onboard and uploads them when the connection returns.
|
|
41
41
|
|
|
42
|
-
**To deliberately defer uploading:** Pair first, then
|
|
42
|
+
**To deliberately defer uploading:** Pair first, then turn **Live tracking** off on the onboard Wake Logger map. The plugin keeps recording locally, up to your storage and age limits. Turn it on when you are ready to send your live position and upload stored history. Changing the switch does not end a trip or restart recording, and the setting survives restarts.
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
You can also choose **Record locally** or **Automatic upload** in the plugin's **Upload mode** setting. These controls change the same setting.
|
|
45
|
+
|
|
46
|
+
On reconnecting, the latest position is sent promptly while stored history uploads in the background. With the supporting Wake Logger service update, your vessel view shows the percentage of stored history uploaded and an estimated time remaining once there is enough upload progress to measure. Estimates pause when the connection is lost. Detailed recording updates are available under **Upload details**. Wake Logger uses the recorded movement and times to identify trips; switching live tracking does not itself create a new trip. Missing or rejected readings are flagged rather than presented as a complete trip.
|
|
45
47
|
|
|
46
48
|
**Before a long outing:** Check available storage and your queue limits. The default limits are seven days or 250 MB, whichever is reached first. If a limit is reached, the oldest queued readings are discarded; plugin status reports the dropped count. Recording locally controls this plugin's Wake Logger connections only—it does not switch off other apps or your boat's internet access.
|
|
47
49
|
|
|
@@ -49,9 +51,11 @@ On reconnecting, the latest position is sent promptly while stored history uploa
|
|
|
49
51
|
|
|
50
52
|
Select a saved race course for your vessel in Wake Logger while internet access is available. Check that the course has synchronised before departure. The downloaded course stays on the Signal K server and remains available offline.
|
|
51
53
|
|
|
52
|
-
Open the **Wake Logger webapp** from Signal K's Web Apps list, using a phone, tablet or computer connected to the boat's network. Sign in to Signal K if prompted.
|
|
54
|
+
Open the **Wake Logger webapp** from Signal K's Web Apps list, using a phone, tablet or computer connected to the boat's network. Sign in to Signal K if prompted. Any Signal K user account can view the onboard map; changing live tracking or activating a course requires an account with read/write access.
|
|
55
|
+
|
|
56
|
+
The onboard map uses the same instrument styling as Wake Logger's live view, adapts to phone and tablet screens, and includes a full-screen view. It shows the complete course, your boat, the next mark and current leg. Distance, bearing, cross-track error, VMG and arrival estimates appear when Signal K can calculate them; unavailable readings are left clearly marked.
|
|
53
57
|
|
|
54
|
-
|
|
58
|
+
Alongside the map, the webapp shows an **onboard race plan**. While **Live tracking** is on, Wake Logger cloud calculates the remaining race: it starts the current leg from your boat's actual position, samples the downloaded forecast at each leg's estimated time, and accounts for current, so the suggested heading, sail plan and arrival estimate keep up with how the race is actually going. When **Live tracking** is off, the vessel performs the same calculation on board from the Race Pack synchronised before departure, so the plan is still available with no internet access. If no Race Pack has synchronised yet, the map and course still work and the plan is clearly marked as unavailable.
|
|
55
59
|
|
|
56
60
|
Use **Advance point** to move to the next course point, or select a point and choose **Set point** to correct your progress. Progression is manual in this release: it does not automatically judge start-line crossings, mark roundings, gates or finishes.
|
|
57
61
|
|
package/dist/config/defaults.js
CHANGED
|
@@ -22,7 +22,8 @@ function parseConfig(value) {
|
|
|
22
22
|
samplePeriodMs: boundedNumber(input.samplePeriodMs, exports.DEFAULTS.samplePeriodMs, 250, 60_000),
|
|
23
23
|
maxOutboxMb: boundedNumber(input.maxOutboxMb, 250, 10, 4096),
|
|
24
24
|
maxOutboxDays: boundedNumber(input.maxOutboxDays, 7, 1, 30),
|
|
25
|
-
debugTelemetry: input.debugTelemetry === true
|
|
25
|
+
debugTelemetry: input.debugTelemetry === true,
|
|
26
|
+
raceProgressionMode: input.raceProgressionMode === 'suggest' || input.raceProgressionMode === 'off' ? input.raceProgressionMode : 'auto'
|
|
26
27
|
};
|
|
27
28
|
}
|
|
28
29
|
function boundedNumber(value, fallback, min, max) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":";;;AAqBA,kCAeC;AApCY,QAAA,QAAQ,GAAG;IACtB,aAAa,EAAE,gDAAgD;IAC/D,cAAc,EAAE,IAAI;IACpB,SAAS,EAAE,EAAE;IACb,eAAe,EAAE,EAAE,GAAG,IAAI;IAC1B,cAAc,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI;IACjC,cAAc,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IACvC,YAAY,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI;CACrB,CAAA;AAaV,SAAgB,WAAW,CAAC,KAAa;IACvC,MAAM,KAAK,GAAG,KAAgC,CAAA;IAC9C,OAAO;QACL,UAAU,EAAE,KAAK,CAAC,UAAU,KAAK,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW;QAC1E,WAAW,EA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
48
|
readonly default: false;
|
|
49
49
|
};
|
|
50
|
+
readonly raceProgressionMode: {
|
|
51
|
+
readonly type: "string";
|
|
52
|
+
readonly title: "Mark detection mode";
|
|
53
|
+
readonly enum: readonly ["auto", "suggest", "off"];
|
|
54
|
+
readonly enumNames: readonly ["Automatic", "Suggest", "Off"];
|
|
55
|
+
readonly default: "auto";
|
|
56
|
+
readonly description: "Automatic advances the active course point when the onboard app detects a rounding, start or finish; it also records evidence for Wake Logger. Suggest asks the crew first. Off records evidence only.";
|
|
57
|
+
};
|
|
50
58
|
};
|
|
51
59
|
};
|
package/dist/config/schema.js
CHANGED
|
@@ -49,6 +49,14 @@ exports.configSchema = {
|
|
|
49
49
|
type: 'boolean',
|
|
50
50
|
title: 'Enable telemetry debug logging',
|
|
51
51
|
default: false
|
|
52
|
+
},
|
|
53
|
+
raceProgressionMode: {
|
|
54
|
+
type: 'string',
|
|
55
|
+
title: 'Mark detection mode',
|
|
56
|
+
enum: ['auto', 'suggest', 'off'],
|
|
57
|
+
enumNames: ['Automatic', 'Suggest', 'Off'],
|
|
58
|
+
default: 'auto',
|
|
59
|
+
description: 'Automatic advances the active course point when the onboard app detects a rounding, start or finish; it also records evidence for Wake Logger. Suggest asks the crew first. Off records evidence only.'
|
|
52
60
|
}
|
|
53
61
|
}
|
|
54
62
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC1B,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACV,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,aAAa;YACpB,IAAI,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC;YACjC,SAAS,EAAE,CAAC,kBAAkB,EAAE,gBAAgB,CAAC;YACjD,OAAO,EAAE,WAAW;YACpB,WAAW,EAAE,qIAAqI;SACnJ;QACD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,0BAA0B;YACjC,WAAW,EAAE,qFAAqF;SACnG;QACD,aAAa,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,iBAAiB;YACxB,OAAO,EAAE,gDAAgD;YACzD,OAAO,EAAE,WAAW;SACrB;QACD,cAAc,EAAE;YACd,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,gCAAgC;YACvC,OAAO,EAAE,GAAG;YACZ,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,IAAI;SACd;QACD,WAAW,EAAE;YACX,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,iCAAiC;YACxC,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,GAAG;SACb;QACD,aAAa,EAAE;YACb,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,kCAAkC;YACzC,OAAO,EAAE,CAAC;YACV,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,CAAC;SACX;QACD,cAAc,EAAE;YACd,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,gCAAgC;YACvC,OAAO,EAAE,KAAK;SACf;KACF;CACO,CAAA"}
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC1B,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACV,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,aAAa;YACpB,IAAI,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC;YACjC,SAAS,EAAE,CAAC,kBAAkB,EAAE,gBAAgB,CAAC;YACjD,OAAO,EAAE,WAAW;YACpB,WAAW,EAAE,qIAAqI;SACnJ;QACD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,0BAA0B;YACjC,WAAW,EAAE,qFAAqF;SACnG;QACD,aAAa,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,iBAAiB;YACxB,OAAO,EAAE,gDAAgD;YACzD,OAAO,EAAE,WAAW;SACrB;QACD,cAAc,EAAE;YACd,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,gCAAgC;YACvC,OAAO,EAAE,GAAG;YACZ,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,IAAI;SACd;QACD,WAAW,EAAE;YACX,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,iCAAiC;YACxC,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,GAAG;SACb;QACD,aAAa,EAAE;YACb,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,kCAAkC;YACzC,OAAO,EAAE,CAAC;YACV,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,CAAC;SACX;QACD,cAAc,EAAE;YACd,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,gCAAgC;YACvC,OAAO,EAAE,KAAK;SACf;QACD,mBAAmB,EAAE;YACnB,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,qBAAqB;YAC5B,IAAI,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC;YAChC,SAAS,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,KAAK,CAAC;YAC1C,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,wMAAwM;SACtN;KACF;CACO,CAAA"}
|
package/dist/courses/protocol.js
CHANGED
|
@@ -41,13 +41,18 @@ function parseCourse(payload) {
|
|
|
41
41
|
if (doc.activeWaypointIndex !== undefined && (!Number.isSafeInteger(doc.activeWaypointIndex)
|
|
42
42
|
|| doc.activeWaypointIndex < 0 || doc.activeWaypointIndex >= points.length))
|
|
43
43
|
throw new CourseError('course_invalid_point_index');
|
|
44
|
+
if (doc.courseDefinitionDigest !== undefined && !isDigest(doc.courseDefinitionDigest))
|
|
45
|
+
throw new CourseError('course_invalid_digest');
|
|
44
46
|
return {
|
|
45
47
|
v: 1, action: 'activate', revision: doc.revision, courseId: doc.courseId, name: doc.name, updatedAt: doc.updatedAt,
|
|
46
48
|
start: point(doc.start), marks: doc.marks.map(point), finish: point(doc.finish),
|
|
47
49
|
...(Number.isSafeInteger(doc.racePlanId) ? { racePlanId: doc.racePlanId } : {}),
|
|
50
|
+
...(isDigest(doc.courseDefinitionDigest) ? { courseDefinitionDigest: doc.courseDefinitionDigest.toLowerCase() } : {}),
|
|
48
51
|
...(doc.activeWaypointIndex !== undefined ? { activeWaypointIndex: doc.activeWaypointIndex } : {})
|
|
49
52
|
};
|
|
50
53
|
}
|
|
54
|
+
const COURSE_DIGEST = /^[0-9a-fA-F]{64}$/;
|
|
55
|
+
function isDigest(value) { return typeof value === 'string' && COURSE_DIGEST.test(value); }
|
|
51
56
|
function point(value) { return { id: value.id, name: value.name, latitude: value.latitude, longitude: value.longitude, ...(value.notes !== undefined ? { notes: value.notes } : {}) }; }
|
|
52
57
|
function validText(value, maximum) { return typeof value === 'string' && value.trim().length > 0 && value.length <= maximum; }
|
|
53
58
|
function validPoint(value) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/courses/protocol.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/courses/protocol.ts"],"names":[],"mappings":";;;AA6BA,oCAAmI;AACnI,kCA0BC;AA9BD,MAAa,WAAY,SAAQ,KAAK;IACf;IAArB,YAAqB,IAAY;QAAI,KAAK,CAAC,IAAI,CAAC,CAAA;QAA3B,SAAI,GAAJ,IAAI,CAAQ;IAAgB,CAAC;CACnD;AAFD,kCAEC;AACD,SAAgB,YAAY,CAAC,MAA4B,IAAmB,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAA,CAAC,CAAC;AACnI,S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