unifi-protect 4.26.0 → 4.27.1

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 CHANGED
@@ -44,7 +44,7 @@ npm install unifi-protect
44
44
 
45
45
  ## Documentation
46
46
 
47
- Documentation and examples for using this library to access UniFi Protect controllers is [available here](https://github.com/hjdhjd/unifi-protect/blob/main/docs/classes/ProtectApi.md). Additionally, if you'd like to see all this in action in a well-documented, real-world example, please take a good look at my [homebridge-unifi-protect](https://github.com/hjdhjd/homebridge-unifi-protect) project. It relies heavily on this library for the core functionality it provides.
47
+ Documentation and examples for using this library to access UniFi Protect controllers is [available here](https://github.com/hjdhjd/unifi-protect/blob/main/docs/ProtectApi.md). Additionally, if you'd like to see all this in action in a well-documented, real-world example, please take a good look at my [homebridge-unifi-protect](https://github.com/hjdhjd/homebridge-unifi-protect) project. It relies heavily on this library for the core functionality it provides.
48
48
 
49
49
  ## UniFi Protect Realtime Events API
50
50
  So...how does UniFi Protect provide realtime events? On UniFi OS-based controllers, it uses a websocket called `updates`. This connection provides a realtime stream of health, status, and events that the cameras encounter - including motion events and doorbell ring events.
@@ -133,6 +133,6 @@ The final part of the update packet is the data frame. The data frame can be thr
133
133
  This is mostly of interest to the true developer nerds amongst us.
134
134
 
135
135
  [![License](https://img.shields.io/npm/l/unifi-protect?color=%230559C9&logo=open%20source%20initiative&logoColor=%23FFFFFF&style=for-the-badge)](https://github.com/hjdhjd/unifi-protect/blob/main/LICENSE.md)
136
- [![Build Status](https://img.shields.io/github/workflow/status/hjdhjd/unifi-protect/Continuous%20Integration?color=%230559C9&logo=github-actions&logoColor=%23FFFFFF&style=for-the-badge)](https://github.com/hjdhjd/unifi-protect/actions?query=workflow%3A%22Continuous+Integration%22)
136
+ [![Build Status](https://img.shields.io/github/actions/workflow/status/hjdhjd/unifi-protect/ci.yml?branch=main&color=%230559C9&logo=github-actions&logoColor=%23FFFFFF&style=for-the-badge)](https://github.com/hjdhjd/unifi-protect/actions?query=workflow%3A%22Continuous+Integration%22)
137
137
  [![Dependencies](https://img.shields.io/librariesio/release/npm/unifi-protect?color=%230559C9&logo=dependabot&style=for-the-badge)](https://libraries.io/npm/uniti-protect)
138
138
  [![GitHub commits since latest release (by SemVer)](https://img.shields.io/github/commits-since/hjdhjd/unifi-protect/latest?color=%230559C9&logo=github&sort=semver&style=for-the-badge)](https://github.com/hjdhjd/unifi-protect/commits/main)
@@ -1 +1 @@
1
- {"version":3,"file":"protect-api-events.js","sourceRoot":"","sources":["../src/protect-api-events.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,yDAAyD;AACzD,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAEnC,oCAAoC;AACpC,IAAK,sBAIJ;AAJD,WAAK,sBAAsB;IAEzB,uEAAU,CAAA;IACV,yEAAW,CAAA;AACb,CAAC,EAJI,sBAAsB,KAAtB,sBAAsB,QAI1B;AAED,qCAAqC;AACrC,IAAK,gBAKJ;AALD,WAAK,gBAAgB;IAEnB,uDAAQ,CAAA;IACR,2DAAU,CAAA;IACV,2DAAU,CAAA;AACZ,CAAC,EALI,gBAAgB,KAAhB,gBAAgB,QAKpB;AAED;;;;;;;;;;;;GAYG;AACH,IAAK,wBAOJ;AAPD,WAAK,wBAAwB;IAE3B,uEAAQ,CAAA;IACR,2FAAkB,CAAA;IAClB,+EAAY,CAAA;IACZ,6EAAW,CAAA;IACX,uFAAgB,CAAA;AAClB,CAAC,EAPI,wBAAwB,KAAxB,wBAAwB,QAO5B;AAsCD;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAE3B,gBAAgB;IAChB;IAEA,CAAC;IAED;;;;;;;;;;OAUG;IACI,MAAM,CAAC,YAAY,CAAC,GAAmB,EAAE,MAAc;QAE5D,gGAAgG;QAEhG,IAAI,UAAU,CAAC;QAEf,IAAI,CAAC;YAEH,8HAA8H;YAC9H,qBAAqB;YACrB,UAAU,GAAG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AAC,IAAI,CAAC;QACjH,CAAC;QAED,0CAA0C;QAC1C,QAAO,aAAa,EAAE,CAAC;YAErB,KAAK,gBAAgB,CAAC,IAAI;gBAExB,4CAA4C;gBAC5C,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAS,CAAC;YAEhD,KAAK,gBAAgB,CAAC,MAAM;gBAE1B,OAAO,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAElC,KAAK,gBAAgB,CAAC,MAAM;gBAE1B,OAAO,OAAO,CAAC;YAEjB;gBAEE,GAAG,CAAC,KAAK,CAAC,sEAAsE,EAAE,aAAa,CAAC,CAAC;gBAEjG,OAAO,IAAI,CAAC;QAChB,CAAC;IACH,CAAC;CACF"}
@@ -6,6 +6,7 @@ import { Readable } from "node:stream";
6
6
  /**
7
7
  * Options for configuring a livestream session.
8
8
  *
9
+ * @property chunkSize - Optionally specify the maximum payload size of each websocket packet. Larger sizes mean lower fragmentation. Defaults to 4096.
9
10
  * @property emitTimestamps - Optionally emit the decode timestamps of frames as timestamp events. This is the same information that appears in `tfdt` boxes.
10
11
  * @property lens - Optionally specify alternate cameras on a Protect device, such as a package camera.
11
12
  * @property segmentLength - Optionally specify the segment length, in milliseconds, of each fMP4 segment. Defaults to 100ms.
@@ -14,6 +15,7 @@ import { Readable } from "node:stream";
14
15
  * Defaults to false.
15
16
  */
16
17
  export interface LivestreamOptions {
18
+ chunkSize: number;
17
19
  emitTimestamps: boolean;
18
20
  lens: number;
19
21
  requestId: string;
@@ -34,6 +36,23 @@ export interface LivestreamOptions {
34
36
  * alternatively listen individually for the initialization segment or regular fMP4 segments if you'd like to distinguish between the two types of segments.
35
37
  *
36
38
  * Those are the basics that gets us up and running.
39
+ *
40
+ * @event close - Emitted when the livestream WebSocket connection has been closed. This event fires after cleanup is complete and the connection is fully
41
+ * terminated.
42
+ * @event codec - Emitted when codec information is received from the controller. The codec string is passed as an argument in the format "codec,container"
43
+ * (e.g., "hev1.1.6.L150,mp4a.40.2"). Only emitted when not using stream mode.
44
+ * @event initsegment - Emitted when an fMP4 initialization segment (FTYP and MOOV boxes) is received. The complete initialization segment Buffer is passed as an
45
+ * argument. Only emitted when not using stream mode.
46
+ * @event mdat - Emitted when an MDAT box (media data) has been received as part of a segment. The MDAT Buffer is passed as an argument. Only emitted when not
47
+ * using stream mode.
48
+ * @event message - Emitted when any complete fMP4 segment is received, whether initialization or regular segment. The complete segment Buffer is passed as an
49
+ * argument. Only emitted when not using stream mode.
50
+ * @event moof - Emitted when a MOOF box (movie fragment metadata) has been received as part of a segment. The MOOF Buffer is passed as an argument. Only emitted
51
+ * when not using stream mode.
52
+ * @event segment - Emitted when a non-initialization fMP4 segment (MOOF/MDAT pair) is fully assembled. The complete segment Buffer is passed as an argument. Only
53
+ * emitted when not using stream mode.
54
+ * @event timestamps - Emitted when decode timestamp information is received from the controller. An array of numbers containing the decode timestamps of frames in the
55
+ * next segment is passed as an argument, mirroring the tfdt box contents.
37
56
  */
38
57
  export declare class ProtectLivestream extends EventEmitter {
39
58
  private _initSegment;
@@ -58,6 +77,13 @@ export declare class ProtectLivestream extends EventEmitter {
58
77
  *
59
78
  * @returns Returns `true` if the livestream has successfully started, `false` otherwise.
60
79
  *
80
+ * @event close - Emitted when the livestream connection terminates for any reason, including manual stops or errors.
81
+ * @event codec - Emitted with the codec information string when received from the controller (stream mode disabled only).
82
+ * @event initsegment - Emitted with the initialization segment Buffer containing FTYP and MOOV boxes (stream mode disabled only).
83
+ * @event message - Emitted with each complete fMP4 segment Buffer, both initialization and regular segments (stream mode disabled only).
84
+ * @event segment - Emitted with each complete non-initialization segment Buffer containing MOOF/MDAT pairs (stream mode disabled only).
85
+ * @event timestamps - Emitted with decode timestamp arrays when extendedVideoMetadata is enabled in options.
86
+ *
61
87
  * @remarks Once a livestream session has started, the following events can be listened for (unless you've specified `useStream` in `options`, in which case only the
62
88
  * `close` event is available):
63
89
  *
@@ -68,14 +94,34 @@ export declare class ProtectLivestream extends EventEmitter {
68
94
  * | `initsegment` | An fMP4 initialization segment has been received. The segment will be passed as an argument to any listeners. |
69
95
  * | `message` | An fMP4 segment has been received. No distinction is made between segment types. The segment will be passed as an argument to any listeners. |
70
96
  * | `segment` | A non-initialization fMP4 segment has been received. The segment will be passed as an argument to any listeners. |
71
- * | `timestamp` | A `BigInt` representing the decode timestamp of frames. It mirrors what is provided in the `tfdt` box in fMP4 segments. |
97
+ * | `timestamps` | An array of numbers containing the decode timestamps of the frames in the next segment. It mirrors what is provided in the `tfdt` box. |
72
98
  */
73
99
  start(cameraId: string, channel: number, options?: Partial<LivestreamOptions>): Promise<boolean>;
74
100
  /**
75
101
  * Stop an fMP4 livestream session from the Protect controller.
76
102
  */
77
103
  stop(): void;
104
+ /**
105
+ * Configure the websocket to populate the prebuffer.
106
+ *
107
+ * @event close - Emitted when the WebSocket connection closes or encounters an error requiring termination.
108
+ *
109
+ * @internal
110
+ */
78
111
  private launchLivestream;
112
+ /**
113
+ * Process fMP4 packets as they arrive over the websocket.
114
+ *
115
+ * @event codec - Emitted when we have received a codec packet.
116
+ * @event initsegment - Emitted when we have received the initialization segment.
117
+ * @event mdat - Emitted at segment end with the accumulated MDAT box data.
118
+ * @event message - Emitted with complete segments (both initialization and regular).
119
+ * @event moof - Emitted at segment end with the accumulated MOOF box data.
120
+ * @event segment - Emitted when we have received a complete non-initialization segment.
121
+ * @event timestamps - Emitted when we have received the decode timestamp arrays (when we have extendedVideoMetadata enabled).
122
+ *
123
+ * @internal
124
+ */
79
125
  private processLivestream;
80
126
  /**
81
127
  * Retrieve the initialization segment that must be at the start of every fMP4 stream.
@@ -73,6 +73,23 @@ var ProtectLiveFrame;
73
73
  * alternatively listen individually for the initialization segment or regular fMP4 segments if you'd like to distinguish between the two types of segments.
74
74
  *
75
75
  * Those are the basics that gets us up and running.
76
+ *
77
+ * @event close - Emitted when the livestream WebSocket connection has been closed. This event fires after cleanup is complete and the connection is fully
78
+ * terminated.
79
+ * @event codec - Emitted when codec information is received from the controller. The codec string is passed as an argument in the format "codec,container"
80
+ * (e.g., "hev1.1.6.L150,mp4a.40.2"). Only emitted when not using stream mode.
81
+ * @event initsegment - Emitted when an fMP4 initialization segment (FTYP and MOOV boxes) is received. The complete initialization segment Buffer is passed as an
82
+ * argument. Only emitted when not using stream mode.
83
+ * @event mdat - Emitted when an MDAT box (media data) has been received as part of a segment. The MDAT Buffer is passed as an argument. Only emitted when not
84
+ * using stream mode.
85
+ * @event message - Emitted when any complete fMP4 segment is received, whether initialization or regular segment. The complete segment Buffer is passed as an
86
+ * argument. Only emitted when not using stream mode.
87
+ * @event moof - Emitted when a MOOF box (movie fragment metadata) has been received as part of a segment. The MOOF Buffer is passed as an argument. Only emitted
88
+ * when not using stream mode.
89
+ * @event segment - Emitted when a non-initialization fMP4 segment (MOOF/MDAT pair) is fully assembled. The complete segment Buffer is passed as an argument. Only
90
+ * emitted when not using stream mode.
91
+ * @event timestamps - Emitted when decode timestamp information is received from the controller. An array of numbers containing the decode timestamps of frames in the
92
+ * next segment is passed as an argument, mirroring the tfdt box contents.
76
93
  */
77
94
  export class ProtectLivestream extends EventEmitter {
78
95
  _initSegment;
@@ -112,6 +129,13 @@ export class ProtectLivestream extends EventEmitter {
112
129
  *
113
130
  * @returns Returns `true` if the livestream has successfully started, `false` otherwise.
114
131
  *
132
+ * @event close - Emitted when the livestream connection terminates for any reason, including manual stops or errors.
133
+ * @event codec - Emitted with the codec information string when received from the controller (stream mode disabled only).
134
+ * @event initsegment - Emitted with the initialization segment Buffer containing FTYP and MOOV boxes (stream mode disabled only).
135
+ * @event message - Emitted with each complete fMP4 segment Buffer, both initialization and regular segments (stream mode disabled only).
136
+ * @event segment - Emitted with each complete non-initialization segment Buffer containing MOOF/MDAT pairs (stream mode disabled only).
137
+ * @event timestamps - Emitted with decode timestamp arrays when extendedVideoMetadata is enabled in options.
138
+ *
115
139
  * @remarks Once a livestream session has started, the following events can be listened for (unless you've specified `useStream` in `options`, in which case only the
116
140
  * `close` event is available):
117
141
  *
@@ -122,9 +146,10 @@ export class ProtectLivestream extends EventEmitter {
122
146
  * | `initsegment` | An fMP4 initialization segment has been received. The segment will be passed as an argument to any listeners. |
123
147
  * | `message` | An fMP4 segment has been received. No distinction is made between segment types. The segment will be passed as an argument to any listeners. |
124
148
  * | `segment` | A non-initialization fMP4 segment has been received. The segment will be passed as an argument to any listeners. |
125
- * | `timestamp` | A `BigInt` representing the decode timestamp of frames. It mirrors what is provided in the `tfdt` box in fMP4 segments. |
149
+ * | `timestamps` | An array of numbers containing the decode timestamps of the frames in the next segment. It mirrors what is provided in the `tfdt` box. |
126
150
  */
127
151
  async start(cameraId, channel, options = {}) {
152
+ options.chunkSize ??= 4096;
128
153
  options.emitTimestamps ??= false;
129
154
  options.lens ??= 0;
130
155
  options.requestId ??= cameraId + "-" + channel.toString();
@@ -159,7 +184,13 @@ export class ProtectLivestream extends EventEmitter {
159
184
  // Flag that we are no longer running.
160
185
  this.ws = null;
161
186
  }
162
- // Configure the websocket to populate the prebuffer.
187
+ /**
188
+ * Configure the websocket to populate the prebuffer.
189
+ *
190
+ * @event close - Emitted when the WebSocket connection closes or encounters an error requiring termination.
191
+ *
192
+ * @internal
193
+ */
163
194
  async launchLivestream(cameraId, channel, options) {
164
195
  const logError = (message, ...parameters) => this.log.error(options.requestId + ": " + message, ...parameters);
165
196
  // To ensure there are minimal performance implications to the Protect NVR, enforce a 100ms floor for segment length. Protect happens to default to a 100ms segment
@@ -167,10 +198,11 @@ export class ProtectLivestream extends EventEmitter {
167
198
  if (options.segmentLength < 100) {
168
199
  options.segmentLength = 100;
169
200
  }
170
- // Parameters that can be set for the livestream. We allow the modification of a useful subset of these,
171
- // though not all of them, in order to simplify the API experience and ensure things always work.
201
+ // Parameters that can be set for the livestream. We allow the modification of a useful subset of these, though not all of them, in order to simplify the API
202
+ // experience and ensure things always work.
172
203
  //
173
- // allowPartialGOP: Allow partial groups of pictures. This is necessary for a valid fMP4 stream that can be used in realtime.
204
+ // allowPartialGOP: Allow partial groups of pictures. Protect will start a fragment even if it doesn’t begin on a keyframe. This reduces end-to-end latency
205
+ // at the cost of potentially cutting a GOP in half (i.e. you may see inter-frame artifacts at the very start of some segments).
174
206
  // camera: The camera ID of the camera you are trying to livestream.
175
207
  // channel: The camera channel to use for this livestream.
176
208
  // extendedVideoMetadata: Provide extended metadata in the MOOV box when possible.
@@ -184,7 +216,7 @@ export class ProtectLivestream extends EventEmitter {
184
216
  allowPartialGOP: "",
185
217
  camera: cameraId,
186
218
  channel: channel.toString(),
187
- chunkSize: "4096",
219
+ chunkSize: options.chunkSize.toString(),
188
220
  ...(options.emitTimestamps ? { extendedVideoMetadata: "" } : {}),
189
221
  fragmentDurationMillis: options.segmentLength.toString(),
190
222
  lens: options.lens.toString(),
@@ -213,11 +245,6 @@ export class ProtectLivestream extends EventEmitter {
213
245
  // Open the livestream WebSocket. We create a new dispatcher here because WebSocket upgrades can only happen over HTTP/1.1 and we've asked for HTTP/2 whenever
214
246
  // possible in our global pool.
215
247
  this.ws = new WebSocket(wsUrl, { dispatcher: this.agent });
216
- if (!this.ws) {
217
- this.ws = null;
218
- logError("unable to connect to the livestream websocket API endpoint.");
219
- return false;
220
- }
221
248
  // The user's requested that we use a stream interface instead of an event interface to push complete fMP4 segments.
222
249
  if (options.useStream) {
223
250
  this._stream = new Readable({
@@ -226,7 +253,7 @@ export class ProtectLivestream extends EventEmitter {
226
253
  });
227
254
  }
228
255
  // Start our heartbeat once we've opened the connection.
229
- this.ws?.addEventListener("open", () => {
256
+ this.ws.addEventListener("open", () => {
230
257
  this.lastMessage = Date.now();
231
258
  // Heartbeat the controller. We need this because if we don't heartbeat the controller, it can sometimes just decide not to give us a livestream to work with, or
232
259
  // lockup due to regressions in the controller firmware. This ensures we can never hang waiting on data from the API, especially in a livestream scenario.
@@ -242,8 +269,8 @@ export class ProtectLivestream extends EventEmitter {
242
269
  }
243
270
  if ((Date.now() - this.lastMessage) > PROTECT_API_TIMEOUT) {
244
271
  logError("the livestream API is not responding.");
245
- if ((this.ws?.readyState === WebSocket.CLOSING) || (this.ws?.readyState === WebSocket.OPEN)) {
246
- this.ws?.close();
272
+ if ((this.ws.readyState === WebSocket.CLOSING) || (this.ws.readyState === WebSocket.OPEN)) {
273
+ this.ws.close();
247
274
  }
248
275
  }
249
276
  }, PROTECT_API_TIMEOUT);
@@ -251,7 +278,7 @@ export class ProtectLivestream extends EventEmitter {
251
278
  this.processLivestream();
252
279
  }, { once: true });
253
280
  // Catch any errors and inform the user, if needed.
254
- this.ws?.addEventListener("error", this.errorHandler = (event) => {
281
+ this.ws.addEventListener("error", this.errorHandler = (event) => {
255
282
  const error = event.error;
256
283
  // Ignore timeout errors, but notify the user about anything else.
257
284
  if (error.code !== "ETIMEDOUT") {
@@ -260,7 +287,7 @@ export class ProtectLivestream extends EventEmitter {
260
287
  }
261
288
  this.stop();
262
289
  }, { once: true });
263
- this.ws?.addEventListener("close", async () => {
290
+ this.ws.addEventListener("close", async () => {
264
291
  // Clear out our heartbeat since we're closing.
265
292
  if (this.heartbeat) {
266
293
  clearInterval(this.heartbeat);
@@ -278,7 +305,19 @@ export class ProtectLivestream extends EventEmitter {
278
305
  }
279
306
  return true;
280
307
  }
281
- // Process fMP4 packets as they arrive over the websocket.
308
+ /**
309
+ * Process fMP4 packets as they arrive over the websocket.
310
+ *
311
+ * @event codec - Emitted when we have received a codec packet.
312
+ * @event initsegment - Emitted when we have received the initialization segment.
313
+ * @event mdat - Emitted at segment end with the accumulated MDAT box data.
314
+ * @event message - Emitted with complete segments (both initialization and regular).
315
+ * @event moof - Emitted at segment end with the accumulated MOOF box data.
316
+ * @event segment - Emitted when we have received a complete non-initialization segment.
317
+ * @event timestamps - Emitted when we have received the decode timestamp arrays (when we have extendedVideoMetadata enabled).
318
+ *
319
+ * @internal
320
+ */
282
321
  processLivestream() {
283
322
  // Check to ensure our websocket is live.
284
323
  if (!this.ws) {
@@ -356,6 +395,7 @@ export class ProtectLivestream extends EventEmitter {
356
395
  const dataStart = offset + 4;
357
396
  const dataEnd = dataStart + length;
358
397
  const data = packet.subarray(dataStart, dataEnd);
398
+ const timestamps = [];
359
399
  // Figure out which data type we've got based on our header, and process it.
360
400
  switch (header) {
361
401
  // We've got audio data. Add it to our current segment.
@@ -407,8 +447,9 @@ export class ProtectLivestream extends EventEmitter {
407
447
  // We've got a timestamp packet. Protect sends over decode timestamps identical to what's in the tfdt box in the segment.
408
448
  case ProtectLiveFrame.TIMESTAMP:
409
449
  for (let offset = 0; offset < data.length; offset += 8) {
410
- this.emit("timestamp", data.readBigUInt64BE(offset));
450
+ timestamps.push(Number(data.readBigUInt64BE(offset)));
411
451
  }
452
+ this.emit("timestamps", timestamps);
412
453
  break;
413
454
  // MDAT box. Add it to the MDAT portion of our segment.
414
455
  case ProtectLiveFrame.MDAT:
@@ -1 +1 @@
1
- {"version":3,"file":"protect-api-livestream.js","sourceRoot":"","sources":["../src/protect-api-livestream.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,uCAAuC;AACvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,sCAAsC;AACtC,OAAO,EAAE,KAAK,EAAsC,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC9E,OAAO,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGpD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,4EAA4E;AAC5E,IAAK,gBAWJ;AAXD,WAAK,gBAAgB;IAEnB,mEAAe,CAAA;IACf,iFAAsB,CAAA;IACtB,yEAAkB,CAAA;IAClB,uEAAiB,CAAA;IACjB,yDAAU,CAAA;IACV,2DAAW,CAAA;IACX,2DAAW,CAAA;IACX,yDAAU,CAAA;IACV,qEAAgB,CAAA;AAClB,CAAC,EAXI,gBAAgB,KAAhB,gBAAgB,QAW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