@yu_robotics/remote-cli-router 1.0.1 → 1.0.2
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/dist/binding/BindingManager.d.ts +28 -16
- package/dist/binding/BindingManager.d.ts.map +1 -1
- package/dist/binding/BindingManager.js +117 -26
- package/dist/binding/BindingManager.js.map +1 -1
- package/dist/feishu/FeishuLongConnHandler.d.ts +30 -0
- package/dist/feishu/FeishuLongConnHandler.d.ts.map +1 -1
- package/dist/feishu/FeishuLongConnHandler.js +250 -17
- package/dist/feishu/FeishuLongConnHandler.js.map +1 -1
- package/dist/storage/JsonStore.d.ts +18 -18
- package/dist/storage/JsonStore.d.ts.map +1 -1
- package/dist/storage/JsonStore.js +82 -29
- package/dist/storage/JsonStore.js.map +1 -1
- package/dist/storage/MemoryStore.d.ts +6 -6
- package/dist/storage/MemoryStore.d.ts.map +1 -1
- package/dist/storage/MemoryStore.js +24 -14
- package/dist/storage/MemoryStore.js.map +1 -1
- package/dist/types/index.d.ts +15 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utils/ToolFormatter.d.ts +2 -2
- package/dist/utils/ToolFormatter.d.ts.map +1 -1
- package/dist/utils/ToolFormatter.js +67 -17
- package/dist/utils/ToolFormatter.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DeviceBinding, UserBinding } from '../types';
|
|
2
2
|
import { JsonStore } from '../storage/JsonStore';
|
|
3
3
|
/**
|
|
4
4
|
* Binding Manager
|
|
5
5
|
* Responsible for managing user and device binding relationships
|
|
6
|
+
* Supports multiple devices per user with one active device
|
|
6
7
|
*/
|
|
7
8
|
export declare class BindingManager {
|
|
8
9
|
private store;
|
|
@@ -13,45 +14,56 @@ export declare class BindingManager {
|
|
|
13
14
|
* @param deviceName Device name
|
|
14
15
|
* @returns Binding code object
|
|
15
16
|
*/
|
|
16
|
-
generateBindingCode(deviceId: string, deviceName: string): Promise<BindingCode>;
|
|
17
|
+
generateBindingCode(deviceId: string, deviceName: string): Promise<import('../types').BindingCode>;
|
|
17
18
|
/**
|
|
18
19
|
* Verify binding code
|
|
19
20
|
* @param code Binding code
|
|
20
21
|
* @returns Binding code object, returns null if invalid or expired
|
|
21
22
|
*/
|
|
22
|
-
verifyBindingCode(code: string): Promise<BindingCode | null>;
|
|
23
|
+
verifyBindingCode(code: string): Promise<import('../types').BindingCode | null>;
|
|
23
24
|
/**
|
|
24
|
-
* Bind user and device
|
|
25
|
-
*
|
|
26
|
-
* @param deviceId Device unique identifier
|
|
27
|
-
* @param deviceName Device name
|
|
25
|
+
* Bind user and device (supports multi-device)
|
|
26
|
+
* First device becomes active; subsequent devices are added as inactive.
|
|
28
27
|
*/
|
|
29
28
|
bindUser(openId: string, deviceId: string, deviceName: string): Promise<void>;
|
|
30
29
|
/**
|
|
31
30
|
* Get user binding information
|
|
32
|
-
* @param openId Feishu user open_id
|
|
33
|
-
* @returns Binding information, returns null if not bound
|
|
34
31
|
*/
|
|
35
32
|
getUserBinding(openId: string): Promise<UserBinding | null>;
|
|
36
33
|
/**
|
|
37
|
-
* Get
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
* Get all devices for a user
|
|
35
|
+
*/
|
|
36
|
+
getUserDevices(openId: string): Promise<DeviceBinding[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Get the active device for a user
|
|
39
|
+
*/
|
|
40
|
+
getActiveDevice(openId: string): Promise<DeviceBinding | null>;
|
|
41
|
+
/**
|
|
42
|
+
* Switch the active device for a user
|
|
43
|
+
* @returns true if switch was successful
|
|
44
|
+
*/
|
|
45
|
+
switchActiveDevice(openId: string, deviceId: string): Promise<boolean>;
|
|
46
|
+
/**
|
|
47
|
+
* Unbind a specific device from a user
|
|
48
|
+
* If the active device is removed, promotes the first remaining device.
|
|
49
|
+
* If no devices remain, removes the entire user binding.
|
|
50
|
+
* @returns true if device was found and removed
|
|
51
|
+
*/
|
|
52
|
+
unbindDevice(openId: string, deviceId: string): Promise<boolean>;
|
|
53
|
+
/**
|
|
54
|
+
* Get device binding information via reverse lookup
|
|
40
55
|
*/
|
|
41
56
|
getDeviceBinding(deviceId: string): Promise<UserBinding | null>;
|
|
42
57
|
/**
|
|
43
|
-
* Unbind user
|
|
44
|
-
* @param openId Feishu user open_id
|
|
58
|
+
* Unbind all devices for a user
|
|
45
59
|
*/
|
|
46
60
|
unbindUser(openId: string): Promise<void>;
|
|
47
61
|
/**
|
|
48
62
|
* Update user last active time
|
|
49
|
-
* @param openId Feishu user open_id
|
|
50
63
|
*/
|
|
51
64
|
updateLastActive(openId: string): Promise<void>;
|
|
52
65
|
/**
|
|
53
66
|
* Generate random binding code (format: XXX-XXX-XXX)
|
|
54
|
-
* @returns Binding code string
|
|
55
67
|
*/
|
|
56
68
|
private generateRandomCode;
|
|
57
69
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BindingManager.d.ts","sourceRoot":"","sources":["../../src/binding/BindingManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"BindingManager.d.ts","sourceRoot":"","sources":["../../src/binding/BindingManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD;;;;GAIG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,KAAK,CAAY;gBAEb,KAAK,EAAE,SAAS;IAI5B;;;;;OAKG;IACG,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC;IAiBxG;;;;OAIG;IACG,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,UAAU,EAAE,WAAW,GAAG,IAAI,CAAC;IAIrF;;;OAGG;IACG,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA6CnF;;OAEG;IACG,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAIjE;;OAEG;IACG,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAK9D;;OAEG;IACG,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAQpE;;;OAGG;IACG,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAsB5E;;;;;OAKG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAgCtE;;OAEG;IACG,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAQrE;;OAEG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/C;;OAEG;IACG,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrD;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAe1B;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
|
|
@@ -4,6 +4,7 @@ exports.BindingManager = void 0;
|
|
|
4
4
|
/**
|
|
5
5
|
* Binding Manager
|
|
6
6
|
* Responsible for managing user and device binding relationships
|
|
7
|
+
* Supports multiple devices per user with one active device
|
|
7
8
|
*/
|
|
8
9
|
class BindingManager {
|
|
9
10
|
store;
|
|
@@ -39,62 +40,152 @@ class BindingManager {
|
|
|
39
40
|
return this.store.getBindingCode(code);
|
|
40
41
|
}
|
|
41
42
|
/**
|
|
42
|
-
* Bind user and device
|
|
43
|
-
*
|
|
44
|
-
* @param deviceId Device unique identifier
|
|
45
|
-
* @param deviceName Device name
|
|
43
|
+
* Bind user and device (supports multi-device)
|
|
44
|
+
* First device becomes active; subsequent devices are added as inactive.
|
|
46
45
|
*/
|
|
47
46
|
async bindUser(openId, deviceId, deviceName) {
|
|
48
47
|
const now = Date.now();
|
|
49
|
-
// Check if user already has a binding
|
|
50
48
|
const existingBinding = await this.getUserBinding(openId);
|
|
51
49
|
if (existingBinding) {
|
|
52
|
-
//
|
|
50
|
+
// Check if device already exists (rebinding scenario)
|
|
51
|
+
const deviceIndex = existingBinding.devices.findIndex(d => d.deviceId === deviceId);
|
|
52
|
+
if (deviceIndex >= 0) {
|
|
53
|
+
// Update existing device entry
|
|
54
|
+
existingBinding.devices[deviceIndex].deviceName = deviceName;
|
|
55
|
+
existingBinding.devices[deviceIndex].lastActiveAt = now;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
// Add new device as inactive
|
|
59
|
+
existingBinding.devices.push({
|
|
60
|
+
deviceId,
|
|
61
|
+
deviceName,
|
|
62
|
+
boundAt: now,
|
|
63
|
+
lastActiveAt: now,
|
|
64
|
+
isActive: false,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
existingBinding.updatedAt = now;
|
|
68
|
+
await this.store.setUserBinding(openId, existingBinding);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
// First device for this user - set as active
|
|
72
|
+
const binding = {
|
|
73
|
+
openId,
|
|
74
|
+
devices: [{
|
|
75
|
+
deviceId,
|
|
76
|
+
deviceName,
|
|
77
|
+
boundAt: now,
|
|
78
|
+
lastActiveAt: now,
|
|
79
|
+
isActive: true,
|
|
80
|
+
}],
|
|
81
|
+
activeDeviceId: deviceId,
|
|
82
|
+
createdAt: now,
|
|
83
|
+
updatedAt: now,
|
|
84
|
+
};
|
|
85
|
+
await this.store.setUserBinding(openId, binding);
|
|
53
86
|
}
|
|
54
|
-
// Create new binding relationship
|
|
55
|
-
const binding = {
|
|
56
|
-
openId,
|
|
57
|
-
deviceId,
|
|
58
|
-
deviceName,
|
|
59
|
-
boundAt: now,
|
|
60
|
-
lastActiveAt: now
|
|
61
|
-
};
|
|
62
|
-
// Store user -> device mapping
|
|
63
|
-
await this.store.setUserBinding(openId, binding);
|
|
64
87
|
}
|
|
65
88
|
/**
|
|
66
89
|
* Get user binding information
|
|
67
|
-
* @param openId Feishu user open_id
|
|
68
|
-
* @returns Binding information, returns null if not bound
|
|
69
90
|
*/
|
|
70
91
|
async getUserBinding(openId) {
|
|
71
92
|
return this.store.getUserBinding(openId);
|
|
72
93
|
}
|
|
73
94
|
/**
|
|
74
|
-
* Get
|
|
75
|
-
|
|
76
|
-
|
|
95
|
+
* Get all devices for a user
|
|
96
|
+
*/
|
|
97
|
+
async getUserDevices(openId) {
|
|
98
|
+
const binding = this.store.getUserBinding(openId);
|
|
99
|
+
return binding?.devices || [];
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Get the active device for a user
|
|
103
|
+
*/
|
|
104
|
+
async getActiveDevice(openId) {
|
|
105
|
+
const binding = this.store.getUserBinding(openId);
|
|
106
|
+
if (!binding || !binding.activeDeviceId) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
return binding.devices.find(d => d.deviceId === binding.activeDeviceId) || null;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Switch the active device for a user
|
|
113
|
+
* @returns true if switch was successful
|
|
114
|
+
*/
|
|
115
|
+
async switchActiveDevice(openId, deviceId) {
|
|
116
|
+
const binding = this.store.getUserBinding(openId);
|
|
117
|
+
if (!binding) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
const targetDevice = binding.devices.find(d => d.deviceId === deviceId);
|
|
121
|
+
if (!targetDevice) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
// Update isActive flags
|
|
125
|
+
for (const device of binding.devices) {
|
|
126
|
+
device.isActive = device.deviceId === deviceId;
|
|
127
|
+
}
|
|
128
|
+
binding.activeDeviceId = deviceId;
|
|
129
|
+
binding.updatedAt = Date.now();
|
|
130
|
+
await this.store.setUserBinding(openId, binding);
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Unbind a specific device from a user
|
|
135
|
+
* If the active device is removed, promotes the first remaining device.
|
|
136
|
+
* If no devices remain, removes the entire user binding.
|
|
137
|
+
* @returns true if device was found and removed
|
|
138
|
+
*/
|
|
139
|
+
async unbindDevice(openId, deviceId) {
|
|
140
|
+
const binding = this.store.getUserBinding(openId);
|
|
141
|
+
if (!binding) {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
const deviceIndex = binding.devices.findIndex(d => d.deviceId === deviceId);
|
|
145
|
+
if (deviceIndex < 0) {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
// Remove device
|
|
149
|
+
binding.devices.splice(deviceIndex, 1);
|
|
150
|
+
await this.store.removeDeviceToUserMap(deviceId);
|
|
151
|
+
if (binding.devices.length === 0) {
|
|
152
|
+
// No devices left, delete the entire binding
|
|
153
|
+
await this.store.deleteUserBinding(openId);
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
// If the removed device was the active one, promote first remaining device
|
|
157
|
+
if (binding.activeDeviceId === deviceId) {
|
|
158
|
+
binding.devices[0].isActive = true;
|
|
159
|
+
binding.activeDeviceId = binding.devices[0].deviceId;
|
|
160
|
+
}
|
|
161
|
+
binding.updatedAt = Date.now();
|
|
162
|
+
await this.store.setUserBinding(openId, binding);
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Get device binding information via reverse lookup
|
|
77
167
|
*/
|
|
78
168
|
async getDeviceBinding(deviceId) {
|
|
79
|
-
|
|
169
|
+
const openId = this.store.getUserByDeviceId(deviceId);
|
|
170
|
+
if (!openId) {
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
return this.store.getUserBinding(openId);
|
|
80
174
|
}
|
|
81
175
|
/**
|
|
82
|
-
* Unbind user
|
|
83
|
-
* @param openId Feishu user open_id
|
|
176
|
+
* Unbind all devices for a user
|
|
84
177
|
*/
|
|
85
178
|
async unbindUser(openId) {
|
|
86
179
|
await this.store.deleteUserBinding(openId);
|
|
87
180
|
}
|
|
88
181
|
/**
|
|
89
182
|
* Update user last active time
|
|
90
|
-
* @param openId Feishu user open_id
|
|
91
183
|
*/
|
|
92
184
|
async updateLastActive(openId) {
|
|
93
185
|
await this.store.updateLastActive(openId);
|
|
94
186
|
}
|
|
95
187
|
/**
|
|
96
188
|
* Generate random binding code (format: XXX-XXX-XXX)
|
|
97
|
-
* @returns Binding code string
|
|
98
189
|
*/
|
|
99
190
|
generateRandomCode() {
|
|
100
191
|
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BindingManager.js","sourceRoot":"","sources":["../../src/binding/BindingManager.ts"],"names":[],"mappings":";;;AAGA
|
|
1
|
+
{"version":3,"file":"BindingManager.js","sourceRoot":"","sources":["../../src/binding/BindingManager.ts"],"names":[],"mappings":";;;AAGA;;;;GAIG;AACH,MAAa,cAAc;IACjB,KAAK,CAAY;IAEzB,YAAY,KAAgB;QAC1B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,mBAAmB,CAAC,QAAgB,EAAE,UAAkB;QAC5D,8CAA8C;QAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACvC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,MAAM,WAAW,GAAG;YAClB,IAAI;YACJ,QAAQ;YACR,SAAS,EAAE,GAAG;YACd,SAAS,EAAE,GAAG,GAAG,CAAC,GAAG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KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC3B,IAAI,OAAO,GAAG,EAAE,CAAC;YACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC3B,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;YACpE,CAAC;YACD,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACzB,CAAC;QAED,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;CACF;AAnOD,wCAmOC"}
|
|
@@ -70,8 +70,38 @@ export declare class FeishuLongConnHandler {
|
|
|
70
70
|
private handleStatusCommand;
|
|
71
71
|
/**
|
|
72
72
|
* Handle unbind command
|
|
73
|
+
* Usage: /unbind or /unbind all (unbind all devices)
|
|
74
|
+
* For unbinding specific device, use /device unbind <device-id>
|
|
73
75
|
*/
|
|
74
76
|
private handleUnbindCommand;
|
|
77
|
+
/**
|
|
78
|
+
* Handle device command
|
|
79
|
+
* Usage:
|
|
80
|
+
* /device - List all bound devices (same as /device list)
|
|
81
|
+
* /device list - List all bound devices
|
|
82
|
+
* /device switch <device-id|index> - Switch active device (by ID or index number)
|
|
83
|
+
* /device <device-id|index> - Quick switch to device (by ID or index number)
|
|
84
|
+
* /device unbind <device-id|index> - Unbind a specific device (by ID or index number)
|
|
85
|
+
*/
|
|
86
|
+
private handleDeviceCommand;
|
|
87
|
+
/**
|
|
88
|
+
* Handle /device list
|
|
89
|
+
*/
|
|
90
|
+
private handleDeviceList;
|
|
91
|
+
/**
|
|
92
|
+
* Resolve device identifier (ID or index) to device ID
|
|
93
|
+
* @returns Resolved device ID or null if not found
|
|
94
|
+
*/
|
|
95
|
+
private resolveDeviceIdentifier;
|
|
96
|
+
/**
|
|
97
|
+
* Handle /device switch <device-id-or-index>
|
|
98
|
+
* Also handles quick switch: /device <device-id-or-index>
|
|
99
|
+
*/
|
|
100
|
+
private handleDeviceSwitch;
|
|
101
|
+
/**
|
|
102
|
+
* Handle /device unbind <device-id-or-index>
|
|
103
|
+
*/
|
|
104
|
+
private handleDeviceUnbind;
|
|
75
105
|
/**
|
|
76
106
|
* Handle help command
|
|
77
107
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeishuLongConnHandler.d.ts","sourceRoot":"","sources":["../../src/feishu/FeishuLongConnHandler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,SAAS,CAAC;CAClB;AAED;;;GAGG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,QAAQ,CAA8B;IAC9C,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,aAAa,CAA8B;IACnD,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,SAAS,CAAS;IAE1B,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAQ;IAE7C,OAAO,CAAC,aAAa,CAAoC;IAGzD,OAAO,CAAC,oBAAoB,CAAkC;IAE9D,OAAO,CAAC,YAAY,CAAwC;IAE5D,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAoB;IACrD,OAAO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