codedeck 0.7.3 → 0.7.4
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/cli/index.js +0 -0
- package/dist/config/paths.js +12 -1
- package/dist/config/paths.js.map +1 -1
- package/dist/daemon/ipc.js +8 -3
- package/dist/daemon/ipc.js.map +1 -1
- package/dist/drivers/antigravity/driver.js +4 -5
- package/dist/drivers/antigravity/driver.js.map +1 -1
- package/dist/drivers/grok/driver.js +2 -11
- package/dist/drivers/grok/driver.js.map +1 -1
- package/dist/drivers/helpers.js +42 -27
- package/dist/drivers/helpers.js.map +1 -1
- package/dist/drivers/opencode/driver.js +4 -4
- package/dist/drivers/opencode/driver.js.map +1 -1
- package/dist/open/launchers/claude.js +4 -18
- package/dist/open/launchers/claude.js.map +1 -1
- package/dist/utils/command.js +158 -0
- package/dist/utils/command.js.map +1 -0
- package/package.json +1 -1
- package/dist/cli/commands/profile.js +0 -196
- package/dist/cli/commands/profile.js.map +0 -1
- package/dist/cli/commands/web.js +0 -328
- package/dist/cli/commands/web.js.map +0 -1
- package/dist/daemon/process-manager.js +0 -55
- package/dist/daemon/process-manager.js.map +0 -1
- package/dist/web/canvas-page.js +0 -1118
- package/dist/web/canvas-page.js.map +0 -1
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
const DEFAULT_PATHEXT = ".COM;.EXE;.BAT;.CMD";
|
|
4
|
+
function isWindows(opts) {
|
|
5
|
+
return (opts?.platform ?? process.platform) === "win32";
|
|
6
|
+
}
|
|
7
|
+
function pathApi(opts) {
|
|
8
|
+
return isWindows(opts) ? path.win32 : path.posix;
|
|
9
|
+
}
|
|
10
|
+
// Windows env names are case-insensitive, but a spread copy of process.env
|
|
11
|
+
// is a plain object: read "Path" as well as "PATH".
|
|
12
|
+
function envValue(env, name) {
|
|
13
|
+
if (env[name] !== undefined)
|
|
14
|
+
return env[name];
|
|
15
|
+
const key = Object.keys(env).find((k) => k.toUpperCase() === name);
|
|
16
|
+
return key === undefined ? undefined : env[key];
|
|
17
|
+
}
|
|
18
|
+
function windowsExtensions(env) {
|
|
19
|
+
const raw = envValue(env, "PATHEXT") || DEFAULT_PATHEXT;
|
|
20
|
+
return raw
|
|
21
|
+
.split(";")
|
|
22
|
+
.map((ext) => ext.trim().toLowerCase())
|
|
23
|
+
.filter((ext) => ext.startsWith("."));
|
|
24
|
+
}
|
|
25
|
+
function isRunnableFile(candidate, opts) {
|
|
26
|
+
const io = opts?.fs ?? fs;
|
|
27
|
+
try {
|
|
28
|
+
if (!io.statSync(candidate).isFile())
|
|
29
|
+
return false;
|
|
30
|
+
// Windows has no executable bit; the extension decides runnability.
|
|
31
|
+
if (!isWindows(opts))
|
|
32
|
+
io.accessSync(candidate, fs.constants.X_OK);
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// Candidate file names for one base path. On Windows a name that already
|
|
40
|
+
// carries a PATHEXT extension is tried as is; otherwise only the PATHEXT
|
|
41
|
+
// spellings are tried, never the bare name, so npm's extensionless POSIX
|
|
42
|
+
// shim next to `claude.cmd` is skipped exactly as cmd.exe skips it.
|
|
43
|
+
function candidates(base, opts) {
|
|
44
|
+
if (!isWindows(opts))
|
|
45
|
+
return [base];
|
|
46
|
+
const exts = windowsExtensions(opts?.env ?? process.env);
|
|
47
|
+
const ext = path.win32.extname(base).toLowerCase();
|
|
48
|
+
if (ext && exts.includes(ext))
|
|
49
|
+
return [base];
|
|
50
|
+
return exts.map((e) => base + e);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Resolve a command to an absolute runnable file, like `which` on POSIX and
|
|
54
|
+
* `where` on Windows. A name containing a path separator is resolved against
|
|
55
|
+
* the cwd instead of PATH. Returns undefined when nothing runnable is found.
|
|
56
|
+
*/
|
|
57
|
+
export function resolveCommand(command, opts) {
|
|
58
|
+
if (!command)
|
|
59
|
+
return undefined;
|
|
60
|
+
const windows = isWindows(opts);
|
|
61
|
+
const p = pathApi(opts);
|
|
62
|
+
const env = opts?.env ?? process.env;
|
|
63
|
+
const cwd = opts?.cwd ?? process.cwd();
|
|
64
|
+
const hasSeparator = command.includes("/") || (windows && command.includes("\\"));
|
|
65
|
+
if (hasSeparator || p.isAbsolute(command)) {
|
|
66
|
+
const base = p.resolve(cwd, command);
|
|
67
|
+
return candidates(base, opts).find((c) => isRunnableFile(c, opts));
|
|
68
|
+
}
|
|
69
|
+
const dirs = (envValue(env, "PATH") ?? "").split(p.delimiter);
|
|
70
|
+
// cmd.exe searches the current directory first; spawn/CreateProcess does
|
|
71
|
+
// not, and a planted claude.cmd in a repo must never win. Skip it.
|
|
72
|
+
for (const dir of dirs) {
|
|
73
|
+
const clean = dir.trim().replace(/^"(.*)"$/, "$1");
|
|
74
|
+
if (!clean)
|
|
75
|
+
continue;
|
|
76
|
+
const base = p.resolve(cwd, clean, command);
|
|
77
|
+
const hit = candidates(base, opts).find((c) => isRunnableFile(c, opts));
|
|
78
|
+
if (hit)
|
|
79
|
+
return hit;
|
|
80
|
+
}
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
// npm's cmd-shim ends with: "%_prog%" "%dp0%\node_modules\pkg\cli.js" %*
|
|
84
|
+
// (older shims spell it "%~dp0\..."). Capture the target relative to the shim.
|
|
85
|
+
const CMD_SHIM_TARGET = /"%(?:~?dp0)%?\\([^"]+)"\s+%\*/i;
|
|
86
|
+
/**
|
|
87
|
+
* For an npm cmd-shim, the file it launches. Running that directly keeps
|
|
88
|
+
* prompts away from cmd.exe, which truncates arguments at a newline and
|
|
89
|
+
* expands `%VAR%` and `^` inside them.
|
|
90
|
+
*/
|
|
91
|
+
export function unwrapCmdShim(shimPath, opts) {
|
|
92
|
+
const io = opts?.fs ?? fs;
|
|
93
|
+
let text;
|
|
94
|
+
try {
|
|
95
|
+
text = String(io.readFileSync(shimPath, "utf8"));
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
const match = CMD_SHIM_TARGET.exec(text);
|
|
101
|
+
if (!match)
|
|
102
|
+
return undefined;
|
|
103
|
+
const target = path.win32.resolve(path.win32.dirname(shimPath), match[1]);
|
|
104
|
+
if (!io.existsSync(target))
|
|
105
|
+
return undefined;
|
|
106
|
+
if (/\.(c|m)?js$/i.test(target)) {
|
|
107
|
+
// The shim prefers a node.exe that sits next to it.
|
|
108
|
+
const localNode = path.win32.join(path.win32.dirname(shimPath), "node.exe");
|
|
109
|
+
return { cmd: io.existsSync(localNode) ? localNode : process.execPath, prefix: [target] };
|
|
110
|
+
}
|
|
111
|
+
if (/\.(exe|com)$/i.test(target))
|
|
112
|
+
return { cmd: target, prefix: [] };
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
// cmd.exe metacharacters, escaped with ^ (same set as cross-spawn).
|
|
116
|
+
const CMD_META = /([()\][%!^"`<>&|;, *?])/g;
|
|
117
|
+
function escapeCmdArgument(arg, doubleEscape) {
|
|
118
|
+
// CommandLineToArgvW quoting first, then cmd.exe caret escaping.
|
|
119
|
+
let quoted = arg.replace(/(\\*)"/g, '$1$1\\"').replace(/(\\*)$/, "$1$1");
|
|
120
|
+
quoted = `"${quoted}"`.replace(CMD_META, "^$1");
|
|
121
|
+
return doubleEscape ? quoted.replace(CMD_META, "^$1") : quoted;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* How to spawn `command` with `args` on this platform. POSIX passes through.
|
|
125
|
+
* Windows resolves PATHEXT (so `claude` becomes `...\npm\claude.cmd`), runs
|
|
126
|
+
* an npm shim's real target directly, and only falls back to cmd.exe, with
|
|
127
|
+
* its quoting, for a batch file it cannot unwrap.
|
|
128
|
+
*/
|
|
129
|
+
export function spawnTarget(command, args, opts) {
|
|
130
|
+
if (!isWindows(opts))
|
|
131
|
+
return { cmd: command, args };
|
|
132
|
+
const resolved = resolveCommand(command, opts) ?? command;
|
|
133
|
+
if (!/\.(cmd|bat)$/i.test(resolved))
|
|
134
|
+
return { cmd: resolved, args };
|
|
135
|
+
const shim = unwrapCmdShim(resolved, opts);
|
|
136
|
+
if (shim)
|
|
137
|
+
return { cmd: shim.cmd, args: [...shim.prefix, ...args] };
|
|
138
|
+
const env = opts?.env ?? process.env;
|
|
139
|
+
const comspec = envValue(env, "COMSPEC") || "cmd.exe";
|
|
140
|
+
const doubleEscape = /node_modules[\\/]\.bin[\\/][^\\/]+\.cmd$/i.test(resolved);
|
|
141
|
+
const line = [resolved.replace(CMD_META, "^$1"), ...args.map((a) => escapeCmdArgument(a, doubleEscape))].join(" ");
|
|
142
|
+
return {
|
|
143
|
+
cmd: comspec,
|
|
144
|
+
args: ["/d", "/s", "/c", `"${line}"`],
|
|
145
|
+
windowsVerbatimArguments: true,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* An installer's fixed location (`~/.local/bin/agy`, `~/.opencode/bin/opencode`).
|
|
150
|
+
* POSIX keeps the plain existence check; Windows also tries the PATHEXT
|
|
151
|
+
* spellings, because the installer writes `agy.exe`, not `agy`.
|
|
152
|
+
*/
|
|
153
|
+
export function findLocalBinary(file, opts) {
|
|
154
|
+
if (!isWindows(opts))
|
|
155
|
+
return (opts?.fs ?? fs).existsSync(file) ? file : undefined;
|
|
156
|
+
return resolveCommand(file, opts);
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/utils/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAsB7B,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAE9C,SAAS,SAAS,CAAC,IAAiB;IAClC,OAAO,CAAC,IAAI,EAAE,QA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OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnH,OAAO;QACL,GAAG,EAAE,OAAO;QACZ,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,IAAI,GAAG,CAAC;QACrC,wBAAwB,EAAE,IAAI;KAC/B,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,IAAiB;IAC7D,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;QAAE,OAAO,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IAClF,OAAO,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACpC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import { extractProfileSnapshot, getProfileSnapshot, listProfiles, loadConfig, parseProfileName, resolveEffectiveConfig, saveConfig, serializeConfig, } from "../../config/config.js";
|
|
2
|
-
import { ROLES } from "../../core/roles.js";
|
|
3
|
-
export const PROFILE_ACTIONS = ["list", "show", "save", "use", "delete"];
|
|
4
|
-
export class ProfileUsageError extends Error {
|
|
5
|
-
constructor(message) {
|
|
6
|
-
super(message);
|
|
7
|
-
this.name = "ProfileUsageError";
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
function isProfileAction(value) {
|
|
11
|
-
return PROFILE_ACTIONS.includes(value);
|
|
12
|
-
}
|
|
13
|
-
export function parseProfileArgs(args) {
|
|
14
|
-
let action;
|
|
15
|
-
let name;
|
|
16
|
-
let json = false;
|
|
17
|
-
for (const arg of args) {
|
|
18
|
-
if (arg === "--json") {
|
|
19
|
-
json = true;
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
if (arg.startsWith("-"))
|
|
23
|
-
throw new ProfileUsageError(`Unknown option "${arg}".`);
|
|
24
|
-
if (action === undefined) {
|
|
25
|
-
if (!isProfileAction(arg)) {
|
|
26
|
-
throw new ProfileUsageError(`Unknown action "${arg}". Available: ${PROFILE_ACTIONS.join(", ")}.`);
|
|
27
|
-
}
|
|
28
|
-
action = arg;
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
if (name !== undefined)
|
|
32
|
-
throw new ProfileUsageError(`Unexpected argument "${arg}".`);
|
|
33
|
-
name = arg;
|
|
34
|
-
}
|
|
35
|
-
if (action === undefined) {
|
|
36
|
-
throw new ProfileUsageError(`Missing action. Available: ${PROFILE_ACTIONS.join(", ")}.`);
|
|
37
|
-
}
|
|
38
|
-
if (action !== "list" && name === undefined) {
|
|
39
|
-
throw new ProfileUsageError(`profile ${action} needs a name.`);
|
|
40
|
-
}
|
|
41
|
-
if (action === "list" && name !== undefined) {
|
|
42
|
-
throw new ProfileUsageError(`Unexpected argument "${name}".`);
|
|
43
|
-
}
|
|
44
|
-
return { action, ...(name === undefined ? {} : { name }), json };
|
|
45
|
-
}
|
|
46
|
-
function agentSummary(snapshot) {
|
|
47
|
-
return ROLES.map((role) => {
|
|
48
|
-
const binding = snapshot.agents?.[role];
|
|
49
|
-
return `${role} ${binding ? `${binding.harness}:${binding.model}` : "unset"}`;
|
|
50
|
-
}).join(" · ");
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Pure profile transition over the loaded file. IO stays in the caller so
|
|
54
|
-
* the whole matrix is testable without touching the disk.
|
|
55
|
-
*/
|
|
56
|
-
export function applyProfileAction(config, action, rawName) {
|
|
57
|
-
if (action === "list") {
|
|
58
|
-
const names = listProfiles(config);
|
|
59
|
-
const active = config.activeProfile;
|
|
60
|
-
const text = names.length === 0
|
|
61
|
-
? "No profiles saved yet."
|
|
62
|
-
: names.map((name) => `${active === name ? "*" : " "} ${name}`).join("\n");
|
|
63
|
-
return { config, save: false, text, payload: { active: active ?? null, profiles: names } };
|
|
64
|
-
}
|
|
65
|
-
const name = parseProfileName(rawName);
|
|
66
|
-
if (action === "show") {
|
|
67
|
-
const snapshot = getProfileSnapshot(config, name);
|
|
68
|
-
if (!snapshot) {
|
|
69
|
-
const available = listProfiles(config);
|
|
70
|
-
throw new ProfileUsageError(`Unknown profile "${name}". Available: ${available.join(", ") || "none"}.`);
|
|
71
|
-
}
|
|
72
|
-
return { config, save: false, text: serializeConfig(snapshot), payload: snapshot };
|
|
73
|
-
}
|
|
74
|
-
if (action === "save") {
|
|
75
|
-
// Re-save an existing target explicitly. A new name clones the effective
|
|
76
|
-
// setup currently in use, so saving a profile works as a "save as" action
|
|
77
|
-
// without changing which profile remains active.
|
|
78
|
-
const existing = getProfileSnapshot(config, name);
|
|
79
|
-
const source = existing === undefined ? resolveEffectiveConfig(config) : resolveEffectiveConfig(config, name);
|
|
80
|
-
const snapshot = extractProfileSnapshot(source);
|
|
81
|
-
const profiles = { ...(config.profiles ?? {}), [name]: snapshot };
|
|
82
|
-
const next = { ...config, profiles };
|
|
83
|
-
return {
|
|
84
|
-
config: next,
|
|
85
|
-
save: true,
|
|
86
|
-
text: `saved profile "${name}": ${agentSummary(snapshot)}`,
|
|
87
|
-
payload: { name, profile: snapshot },
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
if (action === "use") {
|
|
91
|
-
if (!getProfileSnapshot(config, name)) {
|
|
92
|
-
const available = listProfiles(config);
|
|
93
|
-
throw new ProfileUsageError(`Unknown profile "${name}". Available: ${available.join(", ") || "none"}.`);
|
|
94
|
-
}
|
|
95
|
-
if (config.activeProfile === name) {
|
|
96
|
-
return { config, save: false, text: `profile "${name}" is already active.`, payload: { name } };
|
|
97
|
-
}
|
|
98
|
-
return {
|
|
99
|
-
config: { ...config, activeProfile: name },
|
|
100
|
-
save: true,
|
|
101
|
-
text: `using profile "${name}"`,
|
|
102
|
-
payload: { name },
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
if (!getProfileSnapshot(config, name)) {
|
|
106
|
-
const available = listProfiles(config);
|
|
107
|
-
throw new ProfileUsageError(`Unknown profile "${name}". Available: ${available.join(", ") || "none"}.`);
|
|
108
|
-
}
|
|
109
|
-
const profiles = { ...(config.profiles ?? {}) };
|
|
110
|
-
delete profiles[name];
|
|
111
|
-
const next = { ...config, profiles };
|
|
112
|
-
if (Object.keys(profiles).length === 0)
|
|
113
|
-
delete next.profiles;
|
|
114
|
-
if (next.activeProfile === name)
|
|
115
|
-
delete next.activeProfile;
|
|
116
|
-
return { config: next, save: true, text: `deleted profile "${name}"`, payload: { name } };
|
|
117
|
-
}
|
|
118
|
-
export async function executeProfileAction(args, dependencies = {}) {
|
|
119
|
-
const stdout = dependencies.stdout ?? process.stdout;
|
|
120
|
-
const stderr = dependencies.stderr ?? process.stderr;
|
|
121
|
-
const fail = (message) => {
|
|
122
|
-
stderr.write(`${message}\n`);
|
|
123
|
-
return 2;
|
|
124
|
-
};
|
|
125
|
-
let parsed;
|
|
126
|
-
try {
|
|
127
|
-
parsed = parseProfileArgs(args);
|
|
128
|
-
}
|
|
129
|
-
catch (error) {
|
|
130
|
-
return fail(error instanceof Error ? error.message : String(error));
|
|
131
|
-
}
|
|
132
|
-
let config;
|
|
133
|
-
try {
|
|
134
|
-
config = (dependencies.load ?? loadConfig)();
|
|
135
|
-
}
|
|
136
|
-
catch (error) {
|
|
137
|
-
stderr.write(`Cannot read config: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
138
|
-
return 1;
|
|
139
|
-
}
|
|
140
|
-
let result;
|
|
141
|
-
try {
|
|
142
|
-
result = applyProfileAction(config, parsed.action, parsed.name);
|
|
143
|
-
}
|
|
144
|
-
catch (error) {
|
|
145
|
-
return fail(error instanceof Error ? error.message : String(error));
|
|
146
|
-
}
|
|
147
|
-
if (parsed.json) {
|
|
148
|
-
stdout.write(`${JSON.stringify(result.payload, null, 2)}\n`);
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
stdout.write(`${result.text}\n`);
|
|
152
|
-
}
|
|
153
|
-
if (!result.save)
|
|
154
|
-
return 0;
|
|
155
|
-
try {
|
|
156
|
-
(dependencies.save ?? saveConfig)(result.config);
|
|
157
|
-
}
|
|
158
|
-
catch (error) {
|
|
159
|
-
stderr.write(`Cannot save config: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
160
|
-
return 1;
|
|
161
|
-
}
|
|
162
|
-
return 0;
|
|
163
|
-
}
|
|
164
|
-
export function registerProfileCommand(program) {
|
|
165
|
-
const profile = program
|
|
166
|
-
.command("profile")
|
|
167
|
-
.description("Save and switch named agent setups");
|
|
168
|
-
const run = (args) => async (opts) => {
|
|
169
|
-
const tokens = [...args];
|
|
170
|
-
if (opts.json)
|
|
171
|
-
tokens.push("--json");
|
|
172
|
-
process.exitCode = await executeProfileAction(tokens);
|
|
173
|
-
};
|
|
174
|
-
profile
|
|
175
|
-
.command("list")
|
|
176
|
-
.description("list saved profiles (* marks the active one)")
|
|
177
|
-
.option("--json", "output JSON")
|
|
178
|
-
.action(run(["list"]));
|
|
179
|
-
const named = [
|
|
180
|
-
{ action: "show", description: "print a saved profile" },
|
|
181
|
-
{ action: "save", description: "snapshot the current setup as a profile (the active profile itself re-saves its own setup)" },
|
|
182
|
-
{ action: "use", description: "make a profile the active setup" },
|
|
183
|
-
{ action: "delete", description: "delete a saved profile" },
|
|
184
|
-
];
|
|
185
|
-
for (const { action, description } of named) {
|
|
186
|
-
profile
|
|
187
|
-
.command(action)
|
|
188
|
-
.description(description)
|
|
189
|
-
.argument("<name>", "profile name")
|
|
190
|
-
.option("--json", "output JSON")
|
|
191
|
-
.action(async (name, opts) => {
|
|
192
|
-
process.exitCode = await executeProfileAction(opts.json ? [action, name, "--json"] : [action, name]);
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
//# s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