daikin-local-control 0.1.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/DESIGN.md +98 -0
- package/LICENSE +674 -0
- package/README.md +317 -0
- package/UNSUPPORTED.md +43 -0
- package/dist/authentication.d.ts +24 -0
- package/dist/authentication.d.ts.map +1 -0
- package/dist/authentication.js +30 -0
- package/dist/authentication.js.map +1 -0
- package/dist/clients/classic.d.ts +53 -0
- package/dist/clients/classic.d.ts.map +1 -0
- package/dist/clients/classic.js +142 -0
- package/dist/clients/classic.js.map +1 -0
- package/dist/clients/client.d.ts +21 -0
- package/dist/clients/client.d.ts.map +1 -0
- package/dist/clients/client.js +2 -0
- package/dist/clients/client.js.map +1 -0
- package/dist/clients/dsiot.d.ts +28 -0
- package/dist/clients/dsiot.d.ts.map +1 -0
- package/dist/clients/dsiot.js +66 -0
- package/dist/clients/dsiot.js.map +1 -0
- package/dist/codecs/classic/capabilities.d.ts +19 -0
- package/dist/codecs/classic/capabilities.d.ts.map +1 -0
- package/dist/codecs/classic/capabilities.js +208 -0
- package/dist/codecs/classic/capabilities.js.map +1 -0
- package/dist/codecs/classic/extendedControl.d.ts +20 -0
- package/dist/codecs/classic/extendedControl.d.ts.map +1 -0
- package/dist/codecs/classic/extendedControl.js +88 -0
- package/dist/codecs/classic/extendedControl.js.map +1 -0
- package/dist/codecs/classic/keyValue.d.ts +10 -0
- package/dist/codecs/classic/keyValue.d.ts.map +1 -0
- package/dist/codecs/classic/keyValue.js +36 -0
- package/dist/codecs/classic/keyValue.js.map +1 -0
- package/dist/codecs/classic/state.d.ts +18 -0
- package/dist/codecs/classic/state.d.ts.map +1 -0
- package/dist/codecs/classic/state.js +235 -0
- package/dist/codecs/classic/state.js.map +1 -0
- package/dist/codecs/credentials.d.ts +8 -0
- package/dist/codecs/credentials.d.ts.map +1 -0
- package/dist/codecs/credentials.js +14 -0
- package/dist/codecs/credentials.js.map +1 -0
- package/dist/codecs/device.d.ts +6 -0
- package/dist/codecs/device.d.ts.map +1 -0
- package/dist/codecs/device.js +35 -0
- package/dist/codecs/device.js.map +1 -0
- package/dist/codecs/dsiot/capabilities.d.ts +5 -0
- package/dist/codecs/dsiot/capabilities.d.ts.map +1 -0
- package/dist/codecs/dsiot/capabilities.js +139 -0
- package/dist/codecs/dsiot/capabilities.js.map +1 -0
- package/dist/codecs/dsiot/multireq.d.ts +37 -0
- package/dist/codecs/dsiot/multireq.d.ts.map +1 -0
- package/dist/codecs/dsiot/multireq.js +122 -0
- package/dist/codecs/dsiot/multireq.js.map +1 -0
- package/dist/codecs/dsiot/state.d.ts +92 -0
- package/dist/codecs/dsiot/state.d.ts.map +1 -0
- package/dist/codecs/dsiot/state.js +461 -0
- package/dist/codecs/dsiot/state.js.map +1 -0
- package/dist/discovery.d.ts +17 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +67 -0
- package/dist/discovery.js.map +1 -0
- package/dist/error.d.ts +15 -0
- package/dist/error.d.ts.map +1 -0
- package/dist/error.js +20 -0
- package/dist/error.js.map +1 -0
- package/dist/factory.d.ts +26 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/factory.js +31 -0
- package/dist/factory.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/models/capabilities.d.ts +42 -0
- package/dist/models/capabilities.d.ts.map +1 -0
- package/dist/models/capabilities.js +2 -0
- package/dist/models/capabilities.js.map +1 -0
- package/dist/models/device.d.ts +24 -0
- package/dist/models/device.d.ts.map +1 -0
- package/dist/models/device.js +2 -0
- package/dist/models/device.js.map +1 -0
- package/dist/models/extendedControl.d.ts +31 -0
- package/dist/models/extendedControl.d.ts.map +1 -0
- package/dist/models/extendedControl.js +7 -0
- package/dist/models/extendedControl.js.map +1 -0
- package/dist/models/state.d.ts +56 -0
- package/dist/models/state.d.ts.map +1 -0
- package/dist/models/state.js +49 -0
- package/dist/models/state.js.map +1 -0
- package/dist/transport.d.ts +75 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +118 -0
- package/dist/transport.js.map +1 -0
- package/package.json +62 -0
- package/src/authentication.ts +53 -0
- package/src/clients/classic.ts +251 -0
- package/src/clients/client.ts +29 -0
- package/src/clients/dsiot.ts +116 -0
- package/src/codecs/classic/capabilities.ts +272 -0
- package/src/codecs/classic/extendedControl.ts +132 -0
- package/src/codecs/classic/keyValue.ts +39 -0
- package/src/codecs/classic/state.ts +302 -0
- package/src/codecs/credentials.ts +19 -0
- package/src/codecs/device.ts +41 -0
- package/src/codecs/dsiot/capabilities.ts +209 -0
- package/src/codecs/dsiot/multireq.ts +162 -0
- package/src/codecs/dsiot/state.ts +644 -0
- package/src/discovery.ts +85 -0
- package/src/error.ts +20 -0
- package/src/factory.ts +66 -0
- package/src/index.ts +21 -0
- package/src/models/capabilities.ts +52 -0
- package/src/models/device.ts +25 -0
- package/src/models/extendedControl.ts +41 -0
- package/src/models/state.ts +110 -0
- package/src/transport.ts +191 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { DaikinError } from "../../error.js";
|
|
2
|
+
// The DSIOT (BRP084, `type=GPF`) protocol speaks one endpoint, `/dsiot/multireq`,
|
|
3
|
+
// carrying operations on property trees. A request addresses a resource (`to`);
|
|
4
|
+
// a tree node has pn (name) / pt (type) / pch (children) / pv (value) / md
|
|
5
|
+
// (metadata: mi min, mx max, st step).
|
|
6
|
+
export const DSIOT_OPERATIONS = {
|
|
7
|
+
get: 2,
|
|
8
|
+
update: 3,
|
|
9
|
+
delete: 4,
|
|
10
|
+
};
|
|
11
|
+
/** The indoor and the outdoor unit are separate edges on the adapter. */
|
|
12
|
+
export const DSIOT_EDGES = {
|
|
13
|
+
indoor: "adr_0100",
|
|
14
|
+
outdoor: "adr_0200",
|
|
15
|
+
};
|
|
16
|
+
const EDGE_ROOT = "/dsiot/edge";
|
|
17
|
+
/** What a read fetches, as the `to` of a request: whole trees, never single
|
|
18
|
+
* leaves. */
|
|
19
|
+
export const DSIOT_TARGETS = {
|
|
20
|
+
adapterInfo: `${EDGE_ROOT}.adp_i?filter=pv`,
|
|
21
|
+
indoorStatus: `${EDGE_ROOT}/${DSIOT_EDGES.indoor}.dgc_status?filter=pv,md`,
|
|
22
|
+
outdoorStatus: `${EDGE_ROOT}/${DSIOT_EDGES.outdoor}.dgc_status?filter=pv,md`,
|
|
23
|
+
};
|
|
24
|
+
export function buildDsiotMultireqGet(targets) {
|
|
25
|
+
return {
|
|
26
|
+
requests: targets.map((to) => ({ op: DSIOT_OPERATIONS.get, to })),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/** Builds the body of a multireq write: one `update` request per resource on
|
|
30
|
+
* `edge`, carrying every leaf in a single tree. A `path` that names a resource
|
|
31
|
+
* alone throws an `Error`. */
|
|
32
|
+
export function buildDsiotMultireqUpdate(updates, edge = DSIOT_EDGES.indoor) {
|
|
33
|
+
const roots = [];
|
|
34
|
+
for (const { path, value } of updates) {
|
|
35
|
+
const [rootName, ...rest] = path.split(".");
|
|
36
|
+
if (rootName === undefined || rest.length === 0) {
|
|
37
|
+
throw new Error(`Cannot write the DSIOT path "${path}"`);
|
|
38
|
+
}
|
|
39
|
+
let node = childNamed(roots, rootName);
|
|
40
|
+
for (const name of rest) {
|
|
41
|
+
node.pch ??= [];
|
|
42
|
+
node = childNamed(node.pch, name);
|
|
43
|
+
}
|
|
44
|
+
node.pv = value;
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
requests: roots.map((pc) => ({
|
|
48
|
+
op: DSIOT_OPERATIONS.update,
|
|
49
|
+
to: `${EDGE_ROOT}/${edge}.${pc.pn}`,
|
|
50
|
+
pc,
|
|
51
|
+
})),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function childNamed(siblings, name) {
|
|
55
|
+
let child = siblings.find((node) => node.pn === name);
|
|
56
|
+
if (child === undefined) {
|
|
57
|
+
child = { pn: name };
|
|
58
|
+
siblings.push(child);
|
|
59
|
+
}
|
|
60
|
+
return child;
|
|
61
|
+
}
|
|
62
|
+
/** Flattens a `/dsiot/multireq` reply into dotted paths -> `pv`, plus
|
|
63
|
+
* `<path>.md.mi` / `.md.mx` / `.md.st` where metadata came back.
|
|
64
|
+
*
|
|
65
|
+
* Each of its `responses` carries its own `rsc`; any not starting with 200 is
|
|
66
|
+
* the adapter refusing, and throws a `DaikinError`: status 401 for `rsc` 401
|
|
67
|
+
* or 4001, 503 for 503, 502 for anything else. A body that is not JSON, or has
|
|
68
|
+
* no `responses` array, throws one with status 502. */
|
|
69
|
+
export function parseDsiotMultireqReply(body) {
|
|
70
|
+
let parsed;
|
|
71
|
+
try {
|
|
72
|
+
parsed = JSON.parse(body);
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
throw new DaikinError("DSIOT reply was not JSON", 502);
|
|
76
|
+
}
|
|
77
|
+
const responses = parsed
|
|
78
|
+
?.responses;
|
|
79
|
+
if (!Array.isArray(responses)) {
|
|
80
|
+
throw new DaikinError("DSIOT reply had no `responses` array", 502);
|
|
81
|
+
}
|
|
82
|
+
const values = {};
|
|
83
|
+
for (const response of responses) {
|
|
84
|
+
assertRscOk(response.rsc);
|
|
85
|
+
if (response.pc) {
|
|
86
|
+
flatten(response.pc, undefined, values);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return values;
|
|
90
|
+
}
|
|
91
|
+
function assertRscOk(rsc) {
|
|
92
|
+
if (rsc === undefined || String(rsc).startsWith("200")) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const code = String(rsc);
|
|
96
|
+
if (code === "401" || code === "4001") {
|
|
97
|
+
throw new DaikinError(`Daikin rejected the credentials (rsc=${code})`, 401);
|
|
98
|
+
}
|
|
99
|
+
throw new DaikinError(`Daikin command failed (rsc=${code})`, code === "503" ? 503 : 502);
|
|
100
|
+
}
|
|
101
|
+
function flatten(node, parent, values) {
|
|
102
|
+
const path = parent === undefined ? node.pn : `${parent}.${node.pn}`;
|
|
103
|
+
if (node.pch) {
|
|
104
|
+
for (const child of node.pch) {
|
|
105
|
+
flatten(child, path, values);
|
|
106
|
+
}
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (node.pv !== undefined) {
|
|
110
|
+
values[path] = stringify(node.pv);
|
|
111
|
+
}
|
|
112
|
+
for (const key of ["mi", "mx", "st"]) {
|
|
113
|
+
const metadata = node.md?.[key];
|
|
114
|
+
if (metadata !== undefined && metadata !== null) {
|
|
115
|
+
values[`${path}.md.${key}`] = stringify(metadata);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function stringify(value) {
|
|
120
|
+
return typeof value === "string" ? value : JSON.stringify(value);
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=multireq.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multireq.js","sourceRoot":"","sources":["../../../src/codecs/dsiot/multireq.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,kFAAkF;AAClF,gFAAgF;AAChF,2EAA2E;AAC3E,uCAAuC;AAEvC,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,GAAG,EAAE,CAAC;IACN,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;CACD,CAAC;AAEX,yEAAyE;AACzE,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,MAAM,EAAE,UAAU;IAClB,OAAO,EAAE,UAAU;CACX,CAAC;AAEX,MAAM,SAAS,GAAG,aAAa,CAAC;AAEhC;aACa;AACb,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,WAAW,EAAE,GAAG,SAAS,kBAAkB;IAC3C,YAAY,EAAE,GAAG,SAAS,IAAI,WAAW,CAAC,MAAM,0BAA0B;IAC1E,aAAa,EAAE,GAAG,SAAS,IAAI,WAAW,CAAC,OAAO,0BAA0B;C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AC,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { type DaikinControl, type DaikinSensors, type DaikinState, type FanSpeed, type HorizontalPosition, type OperatingMode, type VerticalPosition } from "../../models/state.js";
|
|
2
|
+
import type { DsiotUpdate } from "./multireq.js";
|
|
3
|
+
/** Full dotted paths into the `dgc_status` trees. `e_1002` lives on the indoor
|
|
4
|
+
* edge and `e_1003` on the outdoor edge. */
|
|
5
|
+
export declare const DSIOT_PATHS: {
|
|
6
|
+
readonly power: "dgc_status.e_1002.e_A002.p_01";
|
|
7
|
+
/** Sent with every control. */
|
|
8
|
+
readonly powerTransition: "dgc_status.e_1002.e_3003.p_2D";
|
|
9
|
+
readonly mode: "dgc_status.e_1002.e_3001.p_01";
|
|
10
|
+
readonly indoorTemperature: "dgc_status.e_1002.e_A00B.p_01";
|
|
11
|
+
readonly indoorHumidity: "dgc_status.e_1002.e_A00B.p_02";
|
|
12
|
+
readonly outdoorTemperature: "dgc_status.e_1003.e_A00D.p_01";
|
|
13
|
+
readonly model: "dgc_status.e_1002.e_A001.p_0D";
|
|
14
|
+
readonly modelType: "dgc_status.e_1002.e_A001.p_07";
|
|
15
|
+
readonly energyMonitoring: "dgc_status.e_1002.e_A011.p_01";
|
|
16
|
+
};
|
|
17
|
+
export interface DsiotSetpoint {
|
|
18
|
+
path: string;
|
|
19
|
+
/** Auto and dehumidify are a signed byte; cool and heat are little-endian. */
|
|
20
|
+
signed: boolean;
|
|
21
|
+
/** The dehumidify setpoint is read-only. */
|
|
22
|
+
writable: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface DsiotHumidity {
|
|
25
|
+
/** Counted in steps of the leaf's `md.st`. */
|
|
26
|
+
value: string;
|
|
27
|
+
/** The setting: `00` or `05` off, `01` the percentage in `value`, and one
|
|
28
|
+
* value for each `HumiditySetting`. */
|
|
29
|
+
flag: string;
|
|
30
|
+
}
|
|
31
|
+
export interface DsiotModePaths {
|
|
32
|
+
/** Absent in fan mode. */
|
|
33
|
+
setpoint?: DsiotSetpoint;
|
|
34
|
+
/** Absent in fan mode. */
|
|
35
|
+
humidity?: DsiotHumidity;
|
|
36
|
+
fanSpeed: string;
|
|
37
|
+
vertical: string;
|
|
38
|
+
horizontal: string;
|
|
39
|
+
}
|
|
40
|
+
export declare const DSIOT_MODE_NODE = "dgc_status.e_1002.e_3001";
|
|
41
|
+
export declare const DSIOT_MODE_PATHS: Record<OperatingMode, DsiotModePaths>;
|
|
42
|
+
export declare function encodeDsiotBoolean(on: boolean): string;
|
|
43
|
+
export declare function decodeDsiotBoolean(pv: string | undefined): boolean;
|
|
44
|
+
export declare function decodeDsiotLittleEndian(pv: string): number;
|
|
45
|
+
export declare function encodeDsiotSetpoint(setpointInC: number): string;
|
|
46
|
+
export declare function decodeDsiotSetpoint(pv: string | undefined, signed: boolean): number | null;
|
|
47
|
+
/** Indoor temperature: a signed byte of whole °C. */
|
|
48
|
+
export declare function decodeDsiotIndoorTemperature(pv: string | undefined): number | null;
|
|
49
|
+
/** Indoor humidity: an unsigned byte of %. */
|
|
50
|
+
export declare function decodeDsiotIndoorHumidity(pv: string | undefined): number | null;
|
|
51
|
+
/** Outdoor temperature: a signed little-endian 16-bit count of half degrees. */
|
|
52
|
+
export declare function decodeDsiotOutdoorTemperature(pv: string | undefined): number | null;
|
|
53
|
+
export declare function encodeDsiotMode(mode: OperatingMode): string;
|
|
54
|
+
export declare function decodeDsiotMode(pv: string | undefined): OperatingMode | undefined;
|
|
55
|
+
export declare function encodeDsiotFanSpeed(speed: FanSpeed): string;
|
|
56
|
+
export declare function decodeDsiotFanSpeed(pv: string | undefined): FanSpeed | undefined;
|
|
57
|
+
/** The values a louver leaf holds besides a fixed position, which is 1-14.
|
|
58
|
+
* The leaf is three bytes, little-endian, and bit n of its `md.mx` is set
|
|
59
|
+
* when the unit takes value n. */
|
|
60
|
+
export declare const DSIOT_LOUVER_VALUES: {
|
|
61
|
+
readonly stop: 0;
|
|
62
|
+
readonly swing: 15;
|
|
63
|
+
readonly auto: 16;
|
|
64
|
+
readonly naturalWind: 19;
|
|
65
|
+
readonly floorWarming: 25;
|
|
66
|
+
};
|
|
67
|
+
export declare const DSIOT_LOUVER_STOP = "000000";
|
|
68
|
+
export declare const DSIOT_LOUVER_SWING = "0F0000";
|
|
69
|
+
export declare function isDsiotLouverSwinging(pv: string | undefined): boolean;
|
|
70
|
+
/** The value each `VerticalPosition` is held as. A fixed position has none: it
|
|
71
|
+
* is held as the value at its rank among the fixed values the unit takes. */
|
|
72
|
+
export declare const DSIOT_VERTICAL_POSITION_VALUES: Partial<Record<VerticalPosition, number>>;
|
|
73
|
+
/** The value each `HorizontalPosition` is held as. `stop` and a fixed position
|
|
74
|
+
* have none: see UNSUPPORTED.md. */
|
|
75
|
+
export declare const DSIOT_HORIZONTAL_POSITION_VALUES: Partial<Record<HorizontalPosition, number>>;
|
|
76
|
+
/** Turns the flattened indoor `dgc_status` tree, read with `md`, into a
|
|
77
|
+
* `DaikinState`. Every value is per mode: the setpoint, humidity, fan speed and
|
|
78
|
+
* louvers each have a leaf for each mode, and the state reads the current
|
|
79
|
+
* mode's. */
|
|
80
|
+
export declare function parseDsiotState(values: Record<string, string>): DaikinState;
|
|
81
|
+
/** Turns `values`, the flattened indoor `dgc_status` tree read with `md`, and
|
|
82
|
+
* a control into the leaves `buildDsiotMultireqUpdate` writes: power, its
|
|
83
|
+
* transition and the mode every time, then whichever of the target mode's
|
|
84
|
+
* leaves the control changes. It drops a `targetTemperatureInC` in a mode without
|
|
85
|
+
* a writable setpoint, a `targetHumidity` in a mode the unit has no humidity
|
|
86
|
+
* leaves for, and a louver position the unit does not take. It always writes
|
|
87
|
+
* the `auto` fan speed in dehumidify, and in cool while a humidity setting is
|
|
88
|
+
* on. A unit in a mode outside `OperatingMode` keeps it unless the control
|
|
89
|
+
* sets one, and gets power, its transition and that mode alone. */
|
|
90
|
+
export declare function applyDsiotControl(values: Record<string, string>, control: DaikinControl): DsiotUpdate[];
|
|
91
|
+
export declare function parseDsiotSensors(values: Record<string, string>): DaikinSensors;
|
|
92
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/codecs/dsiot/state.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,QAAQ,EAGb,KAAK,kBAAkB,EAEvB,KAAK,aAAa,EAIlB,KAAK,gBAAgB,EACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD;4CAC4C;AAC5C,eAAO,MAAM,WAAW;aACtB,KAAK,EAAE,+BAA+B;IACtC,+BAA+B;aAC/B,eAAe,EAAE,+BAA+B;aAChD,IAAI,EAAE,+BAA+B;aACrC,iBAAiB,EAAE,+BAA+B;aAClD,cAAc,EAAE,+BAA+B;aAC/C,kBAAkB,EAAE,+BAA+B;aACnD,KAAK,EAAE,+BAA+B;aACtC,SAAS,EAAE,+BAA+B;aAC1C,gBAAgB,EAAE,+BAA+B;CACzC,CAAC;AAEX,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,MAAM,EAAE,OAAO,CAAC;IAChB,4CAA4C;IAC5C,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,8CAA8C;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd;2CACuC;IACvC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WA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