@mp-consulting/homebridge-daikin-cloud 1.5.2 → 1.6.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 +40 -27
- package/config.schema.json +66 -12
- package/dist/src/accessories/air-conditioning-accessory.js +1 -1
- package/dist/src/accessories/air-conditioning-accessory.js.map +1 -1
- package/dist/src/accessories/altherma-accessory.js +1 -1
- package/dist/src/accessories/altherma-accessory.js.map +1 -1
- package/dist/src/accessories/base-accessory.d.ts +5 -4
- package/dist/src/accessories/base-accessory.d.ts.map +1 -1
- package/dist/src/accessories/base-accessory.js +9 -10
- package/dist/src/accessories/base-accessory.js.map +1 -1
- package/dist/src/api/daikin-api.d.ts +22 -6
- package/dist/src/api/daikin-api.d.ts.map +1 -1
- package/dist/src/api/daikin-api.js +49 -23
- package/dist/src/api/daikin-api.js.map +1 -1
- package/dist/src/api/daikin-controller.d.ts +4 -48
- package/dist/src/api/daikin-controller.d.ts.map +1 -1
- package/dist/src/api/daikin-controller.js +14 -84
- package/dist/src/api/daikin-controller.js.map +1 -1
- package/dist/src/api/daikin-mobile-oauth.d.ts +11 -40
- package/dist/src/api/daikin-mobile-oauth.d.ts.map +1 -1
- package/dist/src/api/daikin-mobile-oauth.js +36 -160
- package/dist/src/api/daikin-mobile-oauth.js.map +1 -1
- package/dist/src/api/daikin-oauth.d.ts +10 -37
- package/dist/src/api/daikin-oauth.d.ts.map +1 -1
- package/dist/src/api/daikin-oauth.js +36 -166
- package/dist/src/api/daikin-oauth.js.map +1 -1
- package/dist/src/api/daikin-schemas.d.ts +20 -22
- package/dist/src/api/daikin-schemas.d.ts.map +1 -1
- package/dist/src/api/daikin-schemas.js +17 -49
- package/dist/src/api/daikin-schemas.js.map +1 -1
- package/dist/src/api/daikin-types.d.ts +11 -23
- package/dist/src/api/daikin-types.d.ts.map +1 -1
- package/dist/src/api/daikin-types.js.map +1 -1
- package/dist/src/api/daikin-websocket.d.ts +4 -5
- package/dist/src/api/daikin-websocket.d.ts.map +1 -1
- package/dist/src/api/daikin-websocket.js +62 -34
- package/dist/src/api/daikin-websocket.js.map +1 -1
- package/dist/src/api/http-defaults.d.ts +3 -2
- package/dist/src/api/http-defaults.d.ts.map +1 -1
- package/dist/src/api/http-defaults.js.map +1 -1
- package/dist/src/api/http-transport.d.ts +14 -2
- package/dist/src/api/http-transport.d.ts.map +1 -1
- package/dist/src/api/http-transport.js +32 -9
- package/dist/src/api/http-transport.js.map +1 -1
- package/dist/src/api/token-client.d.ts +82 -0
- package/dist/src/api/token-client.d.ts.map +1 -0
- package/dist/src/api/token-client.js +188 -0
- package/dist/src/api/token-client.js.map +1 -0
- package/dist/src/api/token-storage.d.ts +6 -0
- package/dist/src/api/token-storage.d.ts.map +1 -1
- package/dist/src/api/token-storage.js +27 -1
- package/dist/src/api/token-storage.js.map +1 -1
- package/dist/src/config/config-manager.d.ts +69 -125
- package/dist/src/config/config-manager.d.ts.map +1 -1
- package/dist/src/config/config-manager.js +288 -225
- package/dist/src/config/config-manager.js.map +1 -1
- package/dist/src/constants/api.constants.d.ts +6 -0
- package/dist/src/constants/api.constants.d.ts.map +1 -1
- package/dist/src/constants/api.constants.js +7 -1
- package/dist/src/constants/api.constants.js.map +1 -1
- package/dist/src/constants/auth.constants.d.ts +11 -0
- package/dist/src/constants/auth.constants.d.ts.map +1 -1
- package/dist/src/constants/auth.constants.js +12 -1
- package/dist/src/constants/auth.constants.js.map +1 -1
- package/dist/src/constants/device.constants.d.ts +1 -7
- package/dist/src/constants/device.constants.d.ts.map +1 -1
- package/dist/src/constants/device.constants.js +2 -11
- package/dist/src/constants/device.constants.js.map +1 -1
- package/dist/src/constants/time.constants.d.ts +0 -2
- package/dist/src/constants/time.constants.d.ts.map +1 -1
- package/dist/src/constants/time.constants.js +1 -3
- package/dist/src/constants/time.constants.js.map +1 -1
- package/dist/src/device/accessory-factory.d.ts +0 -5
- package/dist/src/device/accessory-factory.d.ts.map +1 -1
- package/dist/src/device/accessory-factory.js +0 -7
- package/dist/src/device/accessory-factory.js.map +1 -1
- package/dist/src/device/capability-detector.d.ts +9 -1
- package/dist/src/device/capability-detector.d.ts.map +1 -1
- package/dist/src/device/capability-detector.js +32 -28
- package/dist/src/device/capability-detector.js.map +1 -1
- package/dist/src/device/capability-docs.d.ts.map +1 -1
- package/dist/src/device/capability-docs.js +3 -0
- package/dist/src/device/capability-docs.js.map +1 -1
- package/dist/src/device/data-paths.d.ts +18 -0
- package/dist/src/device/data-paths.d.ts.map +1 -0
- package/dist/src/device/data-paths.js +20 -0
- package/dist/src/device/data-paths.js.map +1 -0
- package/dist/src/device/profiles/device-profile.d.ts +0 -5
- package/dist/src/device/profiles/device-profile.d.ts.map +1 -1
- package/dist/src/device/profiles/device-profile.js +0 -21
- package/dist/src/device/profiles/device-profile.js.map +1 -1
- package/dist/src/features/base-feature.d.ts +53 -9
- package/dist/src/features/base-feature.d.ts.map +1 -1
- package/dist/src/features/base-feature.js +93 -40
- package/dist/src/features/base-feature.js.map +1 -1
- package/dist/src/features/feature-manager.d.ts +27 -15
- package/dist/src/features/feature-manager.d.ts.map +1 -1
- package/dist/src/features/feature-manager.js +27 -24
- package/dist/src/features/feature-manager.js.map +1 -1
- package/dist/src/features/index.d.ts +1 -0
- package/dist/src/features/index.d.ts.map +1 -1
- package/dist/src/features/index.js +1 -0
- package/dist/src/features/index.js.map +1 -1
- package/dist/src/features/modes/auto-fan-mode.feature.d.ts +16 -10
- package/dist/src/features/modes/auto-fan-mode.feature.d.ts.map +1 -1
- package/dist/src/features/modes/auto-fan-mode.feature.js +16 -40
- package/dist/src/features/modes/auto-fan-mode.feature.js.map +1 -1
- package/dist/src/features/modes/dry-operation-mode.feature.d.ts +12 -9
- package/dist/src/features/modes/dry-operation-mode.feature.d.ts.map +1 -1
- package/dist/src/features/modes/dry-operation-mode.feature.js +11 -30
- package/dist/src/features/modes/dry-operation-mode.feature.js.map +1 -1
- package/dist/src/features/modes/econo-mode.feature.d.ts +12 -9
- package/dist/src/features/modes/econo-mode.feature.d.ts.map +1 -1
- package/dist/src/features/modes/econo-mode.feature.js +11 -31
- package/dist/src/features/modes/econo-mode.feature.js.map +1 -1
- package/dist/src/features/modes/fan-only-operation-mode.feature.d.ts +12 -9
- package/dist/src/features/modes/fan-only-operation-mode.feature.d.ts.map +1 -1
- package/dist/src/features/modes/fan-only-operation-mode.feature.js +11 -30
- package/dist/src/features/modes/fan-only-operation-mode.feature.js.map +1 -1
- package/dist/src/features/modes/firmware-update.feature.d.ts +7 -6
- package/dist/src/features/modes/firmware-update.feature.d.ts.map +1 -1
- package/dist/src/features/modes/firmware-update.feature.js +15 -22
- package/dist/src/features/modes/firmware-update.feature.js.map +1 -1
- package/dist/src/features/modes/holiday-mode.feature.d.ts +2 -1
- package/dist/src/features/modes/holiday-mode.feature.d.ts.map +1 -1
- package/dist/src/features/modes/holiday-mode.feature.js +5 -15
- package/dist/src/features/modes/holiday-mode.feature.js.map +1 -1
- package/dist/src/features/modes/indoor-silent-mode.feature.d.ts +15 -12
- package/dist/src/features/modes/indoor-silent-mode.feature.d.ts.map +1 -1
- package/dist/src/features/modes/indoor-silent-mode.feature.js +15 -39
- package/dist/src/features/modes/indoor-silent-mode.feature.js.map +1 -1
- package/dist/src/features/modes/oscillation-mode.feature.d.ts +5 -6
- package/dist/src/features/modes/oscillation-mode.feature.d.ts.map +1 -1
- package/dist/src/features/modes/oscillation-mode.feature.js +14 -36
- package/dist/src/features/modes/oscillation-mode.feature.js.map +1 -1
- package/dist/src/features/modes/outdoor-silent-mode.feature.d.ts +12 -9
- package/dist/src/features/modes/outdoor-silent-mode.feature.d.ts.map +1 -1
- package/dist/src/features/modes/outdoor-silent-mode.feature.js +11 -31
- package/dist/src/features/modes/outdoor-silent-mode.feature.js.map +1 -1
- package/dist/src/features/modes/powerful-mode.feature.d.ts +14 -10
- package/dist/src/features/modes/powerful-mode.feature.d.ts.map +1 -1
- package/dist/src/features/modes/powerful-mode.feature.js +13 -32
- package/dist/src/features/modes/powerful-mode.feature.js.map +1 -1
- package/dist/src/features/modes/streamer-mode.feature.d.ts +12 -9
- package/dist/src/features/modes/streamer-mode.feature.d.ts.map +1 -1
- package/dist/src/features/modes/streamer-mode.feature.js +11 -31
- package/dist/src/features/modes/streamer-mode.feature.js.map +1 -1
- package/dist/src/features/on-off-data-point-feature.d.ts +43 -0
- package/dist/src/features/on-off-data-point-feature.d.ts.map +1 -0
- package/dist/src/features/on-off-data-point-feature.js +49 -0
- package/dist/src/features/on-off-data-point-feature.js.map +1 -0
- package/dist/src/platform.d.ts +56 -9
- package/dist/src/platform.d.ts.map +1 -1
- package/dist/src/platform.js +248 -128
- package/dist/src/platform.js.map +1 -1
- package/dist/src/services/climate-control/fan-speed.d.ts +45 -0
- package/dist/src/services/climate-control/fan-speed.d.ts.map +1 -0
- package/dist/src/services/climate-control/fan-speed.js +104 -0
- package/dist/src/services/climate-control/fan-speed.js.map +1 -0
- package/dist/src/services/climate-control/separate-fan.service.d.ts +45 -0
- package/dist/src/services/climate-control/separate-fan.service.d.ts.map +1 -0
- package/dist/src/services/climate-control/separate-fan.service.js +82 -0
- package/dist/src/services/climate-control/separate-fan.service.js.map +1 -0
- package/dist/src/services/climate-control/setpoint-resolver.d.ts +68 -0
- package/dist/src/services/climate-control/setpoint-resolver.d.ts.map +1 -0
- package/dist/src/services/climate-control/setpoint-resolver.js +170 -0
- package/dist/src/services/climate-control/setpoint-resolver.js.map +1 -0
- package/dist/src/services/climate-control/swing-controller.d.ts +28 -0
- package/dist/src/services/climate-control/swing-controller.d.ts.map +1 -0
- package/dist/src/services/climate-control/swing-controller.js +65 -0
- package/dist/src/services/climate-control/swing-controller.js.map +1 -0
- package/dist/src/services/climate-control.service.d.ts +39 -48
- package/dist/src/services/climate-control.service.d.ts.map +1 -1
- package/dist/src/services/climate-control.service.js +223 -554
- package/dist/src/services/climate-control.service.js.map +1 -1
- package/dist/src/services/hot-water-tank.service.d.ts +17 -8
- package/dist/src/services/hot-water-tank.service.d.ts.map +1 -1
- package/dist/src/services/hot-water-tank.service.js +102 -157
- package/dist/src/services/hot-water-tank.service.js.map +1 -1
- package/dist/src/types/daikin-enums.d.ts +0 -5
- package/dist/src/types/daikin-enums.d.ts.map +1 -1
- package/dist/src/types/daikin-enums.js +1 -7
- package/dist/src/types/daikin-enums.js.map +1 -1
- package/dist/src/types/device-capabilities.d.ts +1 -0
- package/dist/src/types/device-capabilities.d.ts.map +1 -1
- package/dist/src/utils/errors.d.ts +9 -0
- package/dist/src/utils/errors.d.ts.map +1 -0
- package/dist/src/utils/errors.js +25 -0
- package/dist/src/utils/errors.js.map +1 -0
- package/dist/src/utils/hap-write.d.ts +22 -0
- package/dist/src/utils/hap-write.d.ts.map +1 -0
- package/dist/src/utils/hap-write.js +33 -0
- package/dist/src/utils/hap-write.js.map +1 -0
- package/dist/src/utils/sleep.d.ts +5 -0
- package/dist/src/utils/sleep.d.ts.map +1 -0
- package/dist/src/utils/sleep.js +10 -0
- package/dist/src/utils/sleep.js.map +1 -0
- package/homebridge-ui/README.md +25 -2
- package/homebridge-ui/public/index.html +19 -17
- package/homebridge-ui/public/script.js +95 -32
- package/homebridge-ui/public/styles.css +109 -0
- package/homebridge-ui/server.js +687 -453
- package/package.json +3 -3
- package/dist/src/utils/log-context.d.ts +0 -105
- package/dist/src/utils/log-context.d.ts.map +0 -1
- package/dist/src/utils/log-context.js +0 -206
- package/dist/src/utils/log-context.js.map +0 -1
- package/dist/src/utils/update-mapper.d.ts +0 -59
- package/dist/src/utils/update-mapper.d.ts.map +0 -1
- package/dist/src/utils/update-mapper.js +0 -192
- package/dist/src/utils/update-mapper.js.map +0 -1
|
@@ -2,263 +2,326 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Configuration Manager
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Single source of truth for the plugin configuration: the raw Homebridge
|
|
6
|
+
* platform config is normalized once (type coercion, schema bounds, defaults)
|
|
7
|
+
* and every consumer reads it through the typed getters below.
|
|
7
8
|
*/
|
|
8
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.ConfigManager = void 0;
|
|
10
|
-
|
|
10
|
+
exports.ConfigManager = exports.FEATURE_CONFIG_KEYS = void 0;
|
|
11
|
+
exports.validateConfig = validateConfig;
|
|
11
12
|
const constants_1 = require("../constants");
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const strings_1 = require("../utils/strings");
|
|
14
|
+
/**
|
|
15
|
+
* Per-feature config toggles (the `show*` keys of config.schema.json).
|
|
16
|
+
*
|
|
17
|
+
* - `extra`: switches that follow the legacy `showExtraFeatures` catch-all when
|
|
18
|
+
* their own key is not set.
|
|
19
|
+
* - `standalone`: default off and never follow `showExtraFeatures` (a separate
|
|
20
|
+
* Fan tile, and a switch that installs firmware).
|
|
21
|
+
*
|
|
22
|
+
* Kept in sync with config.schema.json and homebridge-ui/public/script.js by
|
|
23
|
+
* test/unit/config/feature-config-keys.test.ts.
|
|
24
|
+
*/
|
|
25
|
+
exports.FEATURE_CONFIG_KEYS = {
|
|
26
|
+
extra: [
|
|
27
|
+
'showPowerfulMode',
|
|
28
|
+
'showEconoMode',
|
|
29
|
+
'showStreamerMode',
|
|
30
|
+
'showOutdoorSilentMode',
|
|
31
|
+
'showIndoorSilentMode',
|
|
32
|
+
'showAutoFanMode',
|
|
33
|
+
'showOscillationSwitch',
|
|
34
|
+
'showDryMode',
|
|
35
|
+
'showFanOnlyMode',
|
|
36
|
+
'showHolidayMode',
|
|
37
|
+
],
|
|
38
|
+
standalone: [
|
|
39
|
+
'showSeparateFanControl',
|
|
40
|
+
'showFirmwareUpdateSwitch',
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
/** Schema bounds (config.schema.json) the numeric settings are clamped to */
|
|
44
|
+
const UPDATE_INTERVAL_MINUTES_MIN = 1;
|
|
45
|
+
const UPDATE_INTERVAL_MINUTES_MAX = 60;
|
|
46
|
+
const FORCE_UPDATE_DELAY_MS_MIN = 5 * constants_1.ONE_SECOND_MS;
|
|
47
|
+
const FORCE_UPDATE_DELAY_MS_MAX = 300 * constants_1.ONE_SECOND_MS;
|
|
48
|
+
const PORT_MIN = 1;
|
|
49
|
+
const PORT_MAX = 65535;
|
|
50
|
+
const PRIVILEGED_PORT_MAX = 1023;
|
|
51
|
+
const DEVELOPER_PORTAL_RECOMMENDED_INTERVAL_MINUTES = 15;
|
|
52
|
+
/** Number from a number or numeric string; NaN for anything else (including '' and null). */
|
|
53
|
+
function toNumber(value) {
|
|
54
|
+
if (typeof value === 'number') {
|
|
55
|
+
return value;
|
|
17
56
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*/
|
|
21
|
-
getNormalized() {
|
|
22
|
-
if (!this.normalized) {
|
|
23
|
-
this.normalized = this.normalize();
|
|
24
|
-
}
|
|
25
|
-
return this.normalized;
|
|
57
|
+
if (typeof value === 'string' && value.trim() !== '') {
|
|
58
|
+
return Number(value);
|
|
26
59
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
60
|
+
return NaN;
|
|
61
|
+
}
|
|
62
|
+
function isSet(value) {
|
|
63
|
+
return value !== undefined && value !== null && value !== '';
|
|
64
|
+
}
|
|
65
|
+
function nonEmptyString(value) {
|
|
66
|
+
return typeof value === 'string' && value !== '' ? value : undefined;
|
|
67
|
+
}
|
|
68
|
+
function clamp(value, min, max) {
|
|
69
|
+
return Math.min(max, Math.max(min, value));
|
|
70
|
+
}
|
|
71
|
+
function resolveAuthMode(config) {
|
|
72
|
+
return config.authMode === 'mobile_app' ? 'mobile_app' : 'developer_portal';
|
|
73
|
+
}
|
|
74
|
+
/** Parsed port, or undefined when it is not an integer within 1-65535. */
|
|
75
|
+
function parsePort(value) {
|
|
76
|
+
const port = toNumber(value);
|
|
77
|
+
return Number.isInteger(port) && port >= PORT_MIN && port <= PORT_MAX ? port : undefined;
|
|
78
|
+
}
|
|
79
|
+
/** Update interval in minutes: unset/0/non-numeric uses the default, the rest is clamped to the schema bounds. */
|
|
80
|
+
function resolveUpdateIntervalMinutes(value) {
|
|
81
|
+
const minutes = toNumber(value);
|
|
82
|
+
if (!Number.isFinite(minutes) || minutes === 0) {
|
|
83
|
+
return constants_1.DEFAULT_UPDATE_INTERVAL_MINUTES;
|
|
32
84
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
85
|
+
return clamp(minutes, UPDATE_INTERVAL_MINUTES_MIN, UPDATE_INTERVAL_MINUTES_MAX);
|
|
86
|
+
}
|
|
87
|
+
/** Force update delay in ms: unset/0/non-numeric uses the default, the rest is clamped to the schema bounds. */
|
|
88
|
+
function resolveForceUpdateDelayMs(value) {
|
|
89
|
+
const delay = toNumber(value);
|
|
90
|
+
if (!Number.isFinite(delay) || delay === 0) {
|
|
91
|
+
return constants_1.DEFAULT_FORCE_UPDATE_DELAY_MS;
|
|
38
92
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
93
|
+
return clamp(delay, FORCE_UPDATE_DELAY_MS_MIN, FORCE_UPDATE_DELAY_MS_MAX);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Feature toggle semantics, defined once:
|
|
97
|
+
* - the per-feature key is a boolean: that value
|
|
98
|
+
* - otherwise (absent, null, anything else): `extra` features follow
|
|
99
|
+
* `showExtraFeatures`, `standalone` features are off
|
|
100
|
+
*/
|
|
101
|
+
function resolveFeatures(config) {
|
|
102
|
+
const legacy = config.showExtraFeatures === true;
|
|
103
|
+
const features = {};
|
|
104
|
+
for (const key of exports.FEATURE_CONFIG_KEYS.extra) {
|
|
105
|
+
const value = config[key];
|
|
106
|
+
features[key] = typeof value === 'boolean' ? value : legacy;
|
|
44
107
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
*/
|
|
48
|
-
getDeveloperCredentials() {
|
|
49
|
-
const { clientId, clientSecret, callbackServerExternalAddress, callbackServerPort } = this.config;
|
|
50
|
-
if (!clientId || !clientSecret || !callbackServerExternalAddress) {
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
return {
|
|
54
|
-
clientId,
|
|
55
|
-
clientSecret,
|
|
56
|
-
callbackServerExternalAddress,
|
|
57
|
-
callbackServerPort: callbackServerPort || 8582,
|
|
58
|
-
oidcCallbackServerBindAddr: this.config.oidcCallbackServerBindAddr,
|
|
59
|
-
};
|
|
108
|
+
for (const key of exports.FEATURE_CONFIG_KEYS.standalone) {
|
|
109
|
+
features[key] = config[key] === true;
|
|
60
110
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
111
|
+
return features;
|
|
112
|
+
}
|
|
113
|
+
function normalize(config) {
|
|
114
|
+
const excluded = Array.isArray(config.excludedDevicesByDeviceId) ? config.excludedDevicesByDeviceId : [];
|
|
115
|
+
return {
|
|
116
|
+
name: nonEmptyString(config.name),
|
|
117
|
+
authMode: resolveAuthMode(config),
|
|
118
|
+
httpTransport: config.httpTransport === 'curl' || config.httpTransport === 'node' ? config.httpTransport : undefined,
|
|
119
|
+
clientId: nonEmptyString(config.clientId),
|
|
120
|
+
clientSecret: nonEmptyString(config.clientSecret),
|
|
121
|
+
callbackServerExternalAddress: nonEmptyString(config.callbackServerExternalAddress),
|
|
122
|
+
callbackServerPort: parsePort(config.callbackServerPort) ?? constants_1.DEFAULT_CALLBACK_PORT,
|
|
123
|
+
oidcCallbackServerBindAddr: nonEmptyString(config.oidcCallbackServerBindAddr) ?? constants_1.DEFAULT_CALLBACK_BIND_ADDR,
|
|
124
|
+
email: nonEmptyString(config.daikinEmail) ?? nonEmptyString(config.email),
|
|
125
|
+
password: nonEmptyString(config.daikinPassword) ?? nonEmptyString(config.password),
|
|
126
|
+
updateIntervalMs: resolveUpdateIntervalMinutes(config.updateIntervalInMinutes) * constants_1.ONE_MINUTE_MS,
|
|
127
|
+
forceUpdateDelayMs: resolveForceUpdateDelayMs(config.forceUpdateDelay),
|
|
128
|
+
excludedDeviceIds: new Set(excluded.filter((id) => typeof id === 'string')),
|
|
129
|
+
features: resolveFeatures(config),
|
|
130
|
+
webSocketEnabled: config.enableWebSocket !== false,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
/** Legacy credential keys that are in use because the canonical key is absent */
|
|
134
|
+
function legacyCredentialKeysInUse(config) {
|
|
135
|
+
const keys = [];
|
|
136
|
+
if (!config.daikinEmail && config.email) {
|
|
137
|
+
keys.push('email');
|
|
138
|
+
}
|
|
139
|
+
if (!config.daikinPassword && config.password) {
|
|
140
|
+
keys.push('password');
|
|
141
|
+
}
|
|
142
|
+
return keys;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Validate a raw plugin config. Pure: also used by the custom UI server
|
|
146
|
+
* (homebridge-ui/server.js) for its /config/validate endpoint.
|
|
147
|
+
*
|
|
148
|
+
* Errors are configurations the plugin cannot work with; out-of-range numeric
|
|
149
|
+
* settings are only warnings, because normalization clamps them.
|
|
150
|
+
*/
|
|
151
|
+
function validateConfig(config) {
|
|
152
|
+
const errors = [];
|
|
153
|
+
const warnings = [];
|
|
154
|
+
const authMode = resolveAuthMode(config);
|
|
155
|
+
// Validate authentication credentials
|
|
156
|
+
if (authMode === 'developer_portal') {
|
|
157
|
+
if (!config.clientId) {
|
|
158
|
+
errors.push('Client ID is required for Developer Portal mode');
|
|
159
|
+
}
|
|
160
|
+
if (!config.clientSecret) {
|
|
161
|
+
errors.push('Client Secret is required for Developer Portal mode');
|
|
162
|
+
}
|
|
163
|
+
if (!config.callbackServerExternalAddress) {
|
|
164
|
+
errors.push('Callback Server Address is required for Developer Portal mode');
|
|
165
|
+
}
|
|
166
|
+
else if (config.callbackServerExternalAddress === 'localhost' || config.callbackServerExternalAddress === '127.0.0.1') {
|
|
167
|
+
// The Daikin redirect must reach this host from the user's browser
|
|
168
|
+
errors.push('Callback address cannot be localhost. Use your external IP or domain.');
|
|
69
169
|
}
|
|
70
|
-
return { email, password };
|
|
71
170
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
171
|
+
else {
|
|
172
|
+
if (!config.daikinEmail && !config.email) {
|
|
173
|
+
errors.push('Email is required for Mobile App mode (config key: "daikinEmail")');
|
|
174
|
+
}
|
|
175
|
+
if (!config.daikinPassword && !config.password) {
|
|
176
|
+
errors.push('Password is required for Mobile App mode (config key: "daikinPassword")');
|
|
177
|
+
}
|
|
178
|
+
const legacyKeys = legacyCredentialKeysInUse(config);
|
|
179
|
+
if (legacyKeys.length > 0) {
|
|
180
|
+
warnings.push(`Using deprecated config key(s) ${legacyKeys.map(k => `"${k}"`).join(' and ')}. `
|
|
181
|
+
+ 'Rename to "daikinEmail"/"daikinPassword" — the old names will stop working in a future release.');
|
|
182
|
+
}
|
|
77
183
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
184
|
+
// Validate port
|
|
185
|
+
if (isSet(config.callbackServerPort)) {
|
|
186
|
+
const port = parsePort(config.callbackServerPort);
|
|
187
|
+
if (port === undefined) {
|
|
188
|
+
errors.push(`Invalid port number: ${config.callbackServerPort}. Must be between ${PORT_MIN} and ${PORT_MAX}.`);
|
|
189
|
+
}
|
|
190
|
+
else if (port <= PRIVILEGED_PORT_MAX) {
|
|
191
|
+
warnings.push(`Port ${port} is privileged (< 1024) and may require root permissions.`);
|
|
192
|
+
}
|
|
83
193
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
194
|
+
// Validate update interval
|
|
195
|
+
if (isSet(config.updateIntervalInMinutes)) {
|
|
196
|
+
const raw = toNumber(config.updateIntervalInMinutes);
|
|
197
|
+
const minutes = resolveUpdateIntervalMinutes(config.updateIntervalInMinutes);
|
|
198
|
+
if (raw !== minutes) {
|
|
199
|
+
warnings.push(`Update interval must be between ${UPDATE_INTERVAL_MINUTES_MIN} and ${UPDATE_INTERVAL_MINUTES_MAX} minutes, `
|
|
200
|
+
+ `got: ${config.updateIntervalInMinutes}. Using ${minutes} minutes.`);
|
|
91
201
|
}
|
|
92
|
-
if (
|
|
93
|
-
|
|
202
|
+
else if (authMode === 'developer_portal' && minutes < DEVELOPER_PORTAL_RECOMMENDED_INTERVAL_MINUTES) {
|
|
203
|
+
warnings.push(`Update interval ${minutes}min may exceed Developer Portal rate limit (200 calls/day). Recommended: 15+ minutes.`);
|
|
94
204
|
}
|
|
95
|
-
return keys;
|
|
96
205
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
206
|
+
// Validate force update delay
|
|
207
|
+
if (isSet(config.forceUpdateDelay)) {
|
|
208
|
+
const raw = toNumber(config.forceUpdateDelay);
|
|
209
|
+
const delay = resolveForceUpdateDelayMs(config.forceUpdateDelay);
|
|
210
|
+
if (raw !== delay) {
|
|
211
|
+
warnings.push(`Force update delay must be between ${FORCE_UPDATE_DELAY_MS_MIN} and ${FORCE_UPDATE_DELAY_MS_MAX} ms, `
|
|
212
|
+
+ `got: ${config.forceUpdateDelay}. Using ${delay} ms.`);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return {
|
|
216
|
+
valid: errors.length === 0,
|
|
217
|
+
errors,
|
|
218
|
+
warnings,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
class ConfigManager {
|
|
222
|
+
config;
|
|
223
|
+
normalized;
|
|
224
|
+
constructor(config) {
|
|
225
|
+
this.config = config;
|
|
226
|
+
this.normalized = normalize(config);
|
|
227
|
+
}
|
|
228
|
+
// ---------------------------------------------------------------------------
|
|
229
|
+
// Platform
|
|
230
|
+
// ---------------------------------------------------------------------------
|
|
231
|
+
/** Platform name as configured in Homebridge */
|
|
232
|
+
getName() {
|
|
233
|
+
return this.normalized.name;
|
|
234
|
+
}
|
|
235
|
+
/** HTTP transport from the config (the DAIKIN_HTTP_TRANSPORT env var still wins, see configureHttpTransport) */
|
|
236
|
+
getHttpTransport() {
|
|
237
|
+
return this.normalized.httpTransport;
|
|
238
|
+
}
|
|
239
|
+
/** Polling interval in milliseconds, clamped to 1-60 minutes */
|
|
100
240
|
getUpdateIntervalMs() {
|
|
101
|
-
|
|
102
|
-
return constants_1.ONE_MINUTE_MS * minutes;
|
|
241
|
+
return this.normalized.updateIntervalMs;
|
|
103
242
|
}
|
|
104
|
-
/**
|
|
105
|
-
* Get force update delay in milliseconds
|
|
106
|
-
*/
|
|
243
|
+
/** Delay before refreshing after a change, in milliseconds, clamped to 5-300 seconds */
|
|
107
244
|
getForceUpdateDelayMs() {
|
|
108
|
-
return this.
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Get excluded device IDs as a Set
|
|
112
|
-
*/
|
|
113
|
-
getExcludedDeviceIds() {
|
|
114
|
-
return new Set(this.config.excludedDevicesByDeviceId || []);
|
|
245
|
+
return this.normalized.forceUpdateDelayMs;
|
|
115
246
|
}
|
|
116
|
-
/**
|
|
117
|
-
* Check if a device is excluded
|
|
118
|
-
*/
|
|
247
|
+
/** Whether the device (raw Daikin device ID) is listed in excludedDevicesByDeviceId */
|
|
119
248
|
isDeviceExcluded(deviceId) {
|
|
120
|
-
return this.
|
|
249
|
+
return this.normalized.excludedDeviceIds.has(deviceId);
|
|
121
250
|
}
|
|
122
|
-
/**
|
|
123
|
-
* Get feature configuration
|
|
124
|
-
*/
|
|
125
|
-
getFeatures() {
|
|
126
|
-
const legacy = this.config.showExtraFeatures === true;
|
|
127
|
-
return {
|
|
128
|
-
powerfulMode: this.config.showPowerfulMode ?? legacy,
|
|
129
|
-
econoMode: this.config.showEconoMode ?? legacy,
|
|
130
|
-
streamerMode: this.config.showStreamerMode ?? legacy,
|
|
131
|
-
outdoorSilentMode: this.config.showOutdoorSilentMode ?? legacy,
|
|
132
|
-
indoorSilentMode: this.config.showIndoorSilentMode ?? legacy,
|
|
133
|
-
autoFanMode: this.config.showAutoFanMode ?? legacy,
|
|
134
|
-
oscillationMode: this.config.showOscillationSwitch ?? legacy,
|
|
135
|
-
dryMode: this.config.showDryMode ?? legacy,
|
|
136
|
-
fanOnlyMode: this.config.showFanOnlyMode ?? legacy,
|
|
137
|
-
holidayMode: this.config.showHolidayMode ?? legacy,
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Check if WebSocket is enabled
|
|
142
|
-
*/
|
|
251
|
+
/** WebSocket push updates are on unless explicitly disabled */
|
|
143
252
|
isWebSocketEnabled() {
|
|
144
|
-
return this.
|
|
253
|
+
return this.normalized.webSocketEnabled;
|
|
145
254
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
authMode: this.getAuthMode(),
|
|
152
|
-
tokenFilePath: '', // This will be set by the controller
|
|
153
|
-
clientId: this.config.clientId,
|
|
154
|
-
clientSecret: this.config.clientSecret,
|
|
155
|
-
callbackServerExternalAddress: this.config.callbackServerExternalAddress,
|
|
156
|
-
callbackServerPort: this.config.callbackServerPort,
|
|
157
|
-
oidcCallbackServerBindAddr: this.config.oidcCallbackServerBindAddr,
|
|
158
|
-
email: this.getMobileEmail(),
|
|
159
|
-
password: this.getMobilePassword(),
|
|
160
|
-
};
|
|
161
|
-
const result = (0, daikin_schemas_1.safeValidateData)(daikin_schemas_1.DaikinControllerConfigSchema, configData);
|
|
162
|
-
if (!result.success) {
|
|
163
|
-
return {
|
|
164
|
-
valid: false,
|
|
165
|
-
errors: [result.error],
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
return { valid: true, errors: [] };
|
|
255
|
+
// ---------------------------------------------------------------------------
|
|
256
|
+
// Authentication / controller
|
|
257
|
+
// ---------------------------------------------------------------------------
|
|
258
|
+
getAuthMode() {
|
|
259
|
+
return this.normalized.authMode;
|
|
169
260
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
if (!this.config.clientSecret) {
|
|
183
|
-
errors.push('Client Secret is required for Developer Portal mode');
|
|
184
|
-
}
|
|
185
|
-
if (!this.config.callbackServerExternalAddress) {
|
|
186
|
-
errors.push('Callback Server Address is required for Developer Portal mode');
|
|
187
|
-
}
|
|
188
|
-
// Warn about localhost
|
|
189
|
-
if (this.config.callbackServerExternalAddress === 'localhost' ||
|
|
190
|
-
this.config.callbackServerExternalAddress === '127.0.0.1') {
|
|
191
|
-
errors.push('Callback address cannot be localhost. Use your external IP or domain.');
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
else if (authMode === 'mobile_app') {
|
|
195
|
-
if (!this.getMobileEmail()) {
|
|
196
|
-
errors.push('Email is required for Mobile App mode (config key: "daikinEmail")');
|
|
197
|
-
}
|
|
198
|
-
if (!this.getMobilePassword()) {
|
|
199
|
-
errors.push('Password is required for Mobile App mode (config key: "daikinPassword")');
|
|
200
|
-
}
|
|
201
|
-
const legacyKeys = this.getLegacyCredentialKeysInUse();
|
|
202
|
-
if (legacyKeys.length > 0) {
|
|
203
|
-
warnings.push(`Using deprecated config key(s) ${legacyKeys.map(k => `"${k}"`).join(' and ')}. `
|
|
204
|
-
+ 'Rename to "daikinEmail"/"daikinPassword" — the old names will stop working in a future release.');
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
// Validate port
|
|
208
|
-
if (this.config.callbackServerPort !== undefined) {
|
|
209
|
-
const port = typeof this.config.callbackServerPort === 'string'
|
|
210
|
-
? parseInt(this.config.callbackServerPort, 10)
|
|
211
|
-
: this.config.callbackServerPort;
|
|
212
|
-
if (isNaN(port) || port < 1 || port > 65535) {
|
|
213
|
-
errors.push(`Invalid port number: ${this.config.callbackServerPort}. Must be between 1 and 65535.`);
|
|
214
|
-
}
|
|
215
|
-
else if (port < 1024) {
|
|
216
|
-
warnings.push(`Port ${port} is privileged (< 1024) and may require root permissions.`);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
// Validate update interval
|
|
220
|
-
if (this.config.updateIntervalInMinutes !== undefined) {
|
|
221
|
-
const interval = this.config.updateIntervalInMinutes;
|
|
222
|
-
if (interval < 1 || interval > 60) {
|
|
223
|
-
errors.push(`Update interval must be between 1 and 60 minutes, got: ${interval}`);
|
|
224
|
-
}
|
|
225
|
-
else if (authMode === 'developer_portal' && interval < 15) {
|
|
226
|
-
warnings.push(`Update interval ${interval}min may exceed Developer Portal rate limit (200 calls/day). Recommended: 15+ minutes.`);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
// Validate force update delay
|
|
230
|
-
if (this.config.forceUpdateDelay !== undefined) {
|
|
231
|
-
const delay = this.config.forceUpdateDelay;
|
|
232
|
-
const delaySeconds = Math.floor(delay / 1000);
|
|
233
|
-
if (delaySeconds < 1 || delaySeconds > 300) {
|
|
234
|
-
errors.push(`Force update delay must be between 1 and 300 seconds, got: ${delaySeconds}`);
|
|
235
|
-
}
|
|
261
|
+
isMobileAppMode() {
|
|
262
|
+
return this.normalized.authMode === 'mobile_app';
|
|
263
|
+
}
|
|
264
|
+
/** Client ID and secret are present (the minimum to start the Developer Portal controller) */
|
|
265
|
+
hasDeveloperCredentials() {
|
|
266
|
+
return this.normalized.clientId !== undefined && this.normalized.clientSecret !== undefined;
|
|
267
|
+
}
|
|
268
|
+
/** Mobile app email and password (falling back to the legacy keys), or null when either is missing */
|
|
269
|
+
getMobileCredentials() {
|
|
270
|
+
const { email, password } = this.normalized;
|
|
271
|
+
if (!email || !password) {
|
|
272
|
+
return null;
|
|
236
273
|
}
|
|
274
|
+
return { email, password };
|
|
275
|
+
}
|
|
276
|
+
/** Legacy credential keys that are in use because the canonical key is absent */
|
|
277
|
+
getLegacyCredentialKeysInUse() {
|
|
278
|
+
return legacyCredentialKeysInUse(this.config);
|
|
279
|
+
}
|
|
280
|
+
/** Configuration for the DaikinCloudController, with defaults applied */
|
|
281
|
+
getControllerConfig(tokenFilePath) {
|
|
282
|
+
const n = this.normalized;
|
|
237
283
|
return {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
284
|
+
authMode: n.authMode,
|
|
285
|
+
tokenFilePath,
|
|
286
|
+
// Developer Portal fields
|
|
287
|
+
clientId: n.clientId,
|
|
288
|
+
clientSecret: n.clientSecret,
|
|
289
|
+
callbackServerExternalAddress: n.callbackServerExternalAddress,
|
|
290
|
+
callbackServerPort: n.callbackServerPort,
|
|
291
|
+
oidcCallbackServerBindAddr: n.oidcCallbackServerBindAddr,
|
|
292
|
+
// Mobile App fields
|
|
293
|
+
email: n.email,
|
|
294
|
+
password: n.password,
|
|
241
295
|
};
|
|
242
296
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
297
|
+
// ---------------------------------------------------------------------------
|
|
298
|
+
// Features
|
|
299
|
+
// ---------------------------------------------------------------------------
|
|
300
|
+
/** Whether a feature switch / service is enabled (see resolveFeatures for the semantics) */
|
|
301
|
+
isFeatureEnabled(key) {
|
|
302
|
+
return this.normalized.features[key];
|
|
303
|
+
}
|
|
304
|
+
// ---------------------------------------------------------------------------
|
|
305
|
+
// Validation / diagnostics
|
|
306
|
+
// ---------------------------------------------------------------------------
|
|
307
|
+
validate() {
|
|
308
|
+
return validateConfig(this.config);
|
|
309
|
+
}
|
|
310
|
+
/** The raw config with credentials and device IDs masked, for debug logging */
|
|
311
|
+
getRedactedConfig() {
|
|
312
|
+
const config = this.config;
|
|
247
313
|
return {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
314
|
+
...config,
|
|
315
|
+
clientId: strings_1.StringUtils.mask(config.clientId),
|
|
316
|
+
clientSecret: strings_1.StringUtils.mask(config.clientSecret),
|
|
317
|
+
daikinEmail: strings_1.StringUtils.mask(config.daikinEmail),
|
|
318
|
+
daikinPassword: config.daikinPassword ? '***' : undefined,
|
|
319
|
+
// Legacy aliases, masked too so they never leak into debug logs
|
|
320
|
+
email: strings_1.StringUtils.mask(config.email),
|
|
321
|
+
password: config.password ? '***' : undefined,
|
|
322
|
+
excludedDevicesByDeviceId: [...this.normalized.excludedDeviceIds].map(deviceId => strings_1.StringUtils.mask(deviceId)),
|
|
254
323
|
};
|
|
255
324
|
}
|
|
256
|
-
/**
|
|
257
|
-
* Get raw config value (escape hatch for migration)
|
|
258
|
-
*/
|
|
259
|
-
getRawConfig() {
|
|
260
|
-
return this.config;
|
|
261
|
-
}
|
|
262
325
|
}
|
|
263
326
|
exports.ConfigManager = ConfigManager;
|
|
264
327
|
//# sourceMappingURL=config-manager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-manager.js","sourceRoot":"","sources":["../../../src/config/config-manager.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"config-manager.js","sourceRoot":"","sources":["../../../src/config/config-manager.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAkPH,wCAwEC;AAtTD,4CAOsB;AACtB,8CAA+C;AAE/C;;;;;;;;;;GAUG;AACU,QAAA,mBAAmB,GAAG;IACjC,KAAK,EAAE;QACL,kBAAkB;QAClB,eAAe;QACf,kBAAkB;QAClB,uBAAuB;QACvB,sBAAsB;QACtB,iBAAiB;QACjB,uBAAuB;QACvB,aAAa;QACb,iBAAiB;QACjB,iBAAiB;KAClB;IACD,UAAU,EAAE;QACV,wBAAwB;QACxB,0BAA0B;KAC3B;CACO,CAAC;AAMX,6EAA6E;AAC7E,MAAM,2BAA2B,GAAG,CAAC,CAAC;AACtC,MAAM,2BAA2B,GAAG,EAAE,CAAC;AACvC,MAAM,yBAAyB,GAAG,CAAC,GAAG,yBAAa,CAAC;AACpD,MAAM,yBAAyB,GAAG,GAAG,GAAG,yBAAa,CA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;YAChE,KAAK,EAAE,qBAAW,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;YACrC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;YAC7C,yBAAyB,EAAE,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,qBAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SAC9G,CAAC;IACJ,CAAC;CACF;AA5HD,sCA4HC"}
|
|
@@ -35,4 +35,10 @@ export declare const HTTP_REQUEST_TIMEOUT_MS = 30000;
|
|
|
35
35
|
export declare const WRITE_INTER_REQUEST_DELAY_MS = 400;
|
|
36
36
|
/** Daikin WebSocket URL for real-time updates */
|
|
37
37
|
export declare const DAIKIN_WEBSOCKET_URL = "wss://wsapi.onecta.daikineurope.com";
|
|
38
|
+
/**
|
|
39
|
+
* File (in the Homebridge storage path) where the plugin records the last
|
|
40
|
+
* rate-limit headers it saw, so the settings UI can show them without
|
|
41
|
+
* spending an API call. Contents: RateLimitStatusFile.
|
|
42
|
+
*/
|
|
43
|
+
export declare const RATE_LIMIT_STATUS_FILE = ".daikin-rate-limit.json";
|
|
38
44
|
//# sourceMappingURL=api.constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.constants.d.ts","sourceRoot":"","sources":["../../../src/constants/api.constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,wBAAwB;AACxB,eAAO,MAAM,WAAW;;;;;;;;;;;;CAYd,CAAC;AAEX,4DAA4D;AAC5D,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAE9C,8DAA8D;AAC9D,eAAO,MAAM,4BAA4B,QAAQ,CAAC;AAElD,kFAAkF;AAClF,eAAO,MAAM,4BAA4B,KAAK,CAAC;AAE/C,wDAAwD;AACxD,eAAO,MAAM,kBAAkB,IAAI,CAAC;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