@mnemonik/cli 7.131.1 → 7.133.0
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/auth/claudeCodeSignIn.d.ts +16 -25
- package/dist/auth/claudeCodeSignIn.d.ts.map +1 -1
- package/dist/auth/claudeCodeSignIn.js +31 -29
- package/dist/auth/claudeCodeSignIn.js.map +1 -1
- package/dist/auth/codexAuthorization.d.ts +47 -0
- package/dist/auth/codexAuthorization.d.ts.map +1 -0
- package/dist/auth/codexAuthorization.js +882 -0
- package/dist/auth/codexAuthorization.js.map +1 -0
- package/dist/auth/cursorAuthorization.d.ts +47 -0
- package/dist/auth/cursorAuthorization.d.ts.map +1 -0
- package/dist/auth/cursorAuthorization.js +116 -0
- package/dist/auth/cursorAuthorization.js.map +1 -0
- package/dist/auth/status.d.ts +62 -26
- package/dist/auth/status.d.ts.map +1 -1
- package/dist/auth/status.js +37 -23
- package/dist/auth/status.js.map +1 -1
- package/dist/auth/storedAuthorization.d.ts +50 -0
- package/dist/auth/storedAuthorization.d.ts.map +1 -0
- package/dist/auth/storedAuthorization.js +24 -0
- package/dist/auth/storedAuthorization.js.map +1 -0
- package/dist/authorizationWords.d.ts +69 -0
- package/dist/authorizationWords.d.ts.map +1 -0
- package/dist/authorizationWords.js +5275 -0
- package/dist/authorizationWords.js.map +1 -0
- package/dist/digests.json +47 -31
- package/dist/humanReason.js +6 -6
- package/dist/humanReason.js.map +1 -1
- package/dist/install/hosts.d.ts.map +1 -1
- package/dist/install/hosts.js +2 -1
- package/dist/install/hosts.js.map +1 -1
- package/dist/installation.d.ts +2 -0
- package/dist/installation.d.ts.map +1 -1
- package/dist/installation.js +12 -0
- package/dist/installation.js.map +1 -1
- package/dist/output.d.ts +5 -2
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +7 -3
- package/dist/output.js.map +1 -1
- package/dist/router.d.ts +10 -10
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +137 -109
- package/dist/router.js.map +1 -1
- package/dist/sbom.json +21 -21
- package/dist/scanner-release.json +18 -18
- package/dist/status.d.ts +67 -35
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +140 -39
- package/dist/status.js.map +1 -1
- package/package.json +31 -31
|
@@ -1,39 +1,30 @@
|
|
|
1
|
+
import { type StoredAuthorization } from './storedAuthorization.js';
|
|
1
2
|
/**
|
|
2
3
|
* What Claude Code itself holds for Mnemonik's MCP server on this computer.
|
|
3
4
|
*
|
|
4
|
-
* On 2026-10-12 a network outage emptied Claude Code's stored Mnemonik
|
|
5
|
-
* while the server still held a valid grant, and status said
|
|
6
|
-
* server's grant says
|
|
7
|
-
* whether Claude Code can use it. Read the way Claude
|
|
5
|
+
* On 2026-10-12 a network outage emptied Claude Code's stored Mnemonik
|
|
6
|
+
* authorization while the server still held a valid grant, and status said
|
|
7
|
+
* signed in. The server's grant says an authorization exists; only Claude
|
|
8
|
+
* Code's own store says whether Claude Code can use it. Read the way Claude
|
|
9
|
+
* Code 2.1.296 reads it:
|
|
8
10
|
*
|
|
9
11
|
* - The entry is `mcpOAuth["mnemonik|" + sha256(JSON.stringify({type, url,
|
|
10
|
-
* headers}))[0..16]]`, keyed by the declaration in ~/.claude.json, so
|
|
11
|
-
* stored for an older declaration (other headers) is not this one's.
|
|
12
|
+
* headers}))[0..16]]`, keyed by the declaration in ~/.claude.json, so an
|
|
13
|
+
* authorization stored for an older declaration (other headers) is not this one's.
|
|
12
14
|
* - Linux and Windows keep the document in ~/.claude/.credentials.json; a
|
|
13
15
|
* missing file means Claude Code holds nothing.
|
|
14
16
|
* - macOS keeps it in the login Keychain, generic password service
|
|
15
17
|
* `Claude Code-credentials`, account $USER, written and read with
|
|
16
18
|
* /usr/bin/security; the file is read only when that item does not exist.
|
|
19
|
+
* Over SSH the Keychain is locked and `security` exits 36
|
|
20
|
+
* (errSecInteractionNotAllowed); that is said as such, never as "missing".
|
|
17
21
|
* - Windows uses Credential Manager instead when CLAUDE_CODE_FORCE_WINDOWS_CREDMAN
|
|
18
22
|
* is 1 or ~/.claude.json caches `tengu_windows_credman: true`; that store is
|
|
19
23
|
* not read here.
|
|
20
24
|
*
|
|
21
|
-
* Only key names, presence and `expiresAt` are looked at.
|
|
22
|
-
* returned, printed or logged, and a parse error (whose message can quote the
|
|
23
|
-
* input) is never passed on.
|
|
25
|
+
* Only key names, presence and `expiresAt` are looked at (storedAuthorization.ts).
|
|
24
26
|
*/
|
|
25
|
-
export type
|
|
26
|
-
export interface StoredSignIn {
|
|
27
|
-
/**
|
|
28
|
-
* `signed_in`: an access token that has not expired. `refreshable`: the access
|
|
29
|
-
* token has expired or is gone, and a refresh token renews it the next time
|
|
30
|
-
* Claude Code connects. `missing`: nothing Claude Code can use; it shows
|
|
31
|
-
* mnemonik as needing authentication. `unreadable`: it could not be read.
|
|
32
|
-
*/
|
|
33
|
-
state: StoredSignInState;
|
|
34
|
-
/** When the stored access token expires or expired; null when unknown. */
|
|
35
|
-
expiresAt: string | null;
|
|
36
|
-
}
|
|
27
|
+
export type { StoredAuthorization } from './storedAuthorization.js';
|
|
37
28
|
export declare const CLAUDE_CODE_KEYCHAIN_SERVICE = "Claude Code-credentials";
|
|
38
29
|
export type KeychainRead = (service: string, account: string) => Promise<{
|
|
39
30
|
code: number | null;
|
|
@@ -54,10 +45,10 @@ export declare function claudeCodeCredentialKey(name: string, declaration: {
|
|
|
54
45
|
headers?: unknown;
|
|
55
46
|
}): string;
|
|
56
47
|
/** One stored entry, judged as Claude Code judges it when it connects. */
|
|
57
|
-
export declare function
|
|
48
|
+
export declare function claudeCodeEntryState(entry: unknown, now: number): StoredAuthorization;
|
|
58
49
|
/**
|
|
59
|
-
* Claude Code's stored Mnemonik
|
|
60
|
-
* Claude Code has no Mnemonik HTTP declaration that
|
|
50
|
+
* Claude Code's stored Mnemonik authorization on this computer, or undefined
|
|
51
|
+
* when Claude Code has no Mnemonik HTTP declaration that authorizes with OAuth here.
|
|
61
52
|
*/
|
|
62
|
-
export declare function
|
|
53
|
+
export declare function claudeCodeStoredAuthorization(options: ClaudeCodeStoreOptions): Promise<StoredAuthorization | undefined>;
|
|
63
54
|
//# sourceMappingURL=claudeCodeSignIn.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claudeCodeSignIn.d.ts","sourceRoot":"","sources":["../../src/auth/claudeCodeSignIn.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"claudeCodeSignIn.d.ts","sourceRoot":"","sources":["../../src/auth/claudeCodeSignIn.ts"],"names":[],"mappings":"AAKA,OAAO,EAIL,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,YAAY,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAMpE,eAAO,MAAM,4BAA4B,4BAA4B,CAAC;AAEtE,MAAM,MAAM,YAAY,GAAG,CACzB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,KACZ,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEtD,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,YAAY,CAAC;CACzB;AAqED,gFAAgF;AAChF,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAC5D,MAAM,CAMR;AAKD,0EAA0E;AAC1E,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,mBAAmB,CAYrF;AAED;;;GAGG;AACH,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAwC1C"}
|
|
@@ -6,10 +6,14 @@ import { createHash } from "node:crypto";
|
|
|
6
6
|
import { readFile } from "node:fs/promises";
|
|
7
7
|
import { userInfo } from "node:os";
|
|
8
8
|
import { join } from "node:path";
|
|
9
|
+
import {
|
|
10
|
+
object,
|
|
11
|
+
parseObject as parse,
|
|
12
|
+
unreadable
|
|
13
|
+
} from "./storedAuthorization.js";
|
|
9
14
|
var KEYCHAIN_ITEM_NOT_FOUND = 44;
|
|
15
|
+
var KEYCHAIN_LOCKED = 36;
|
|
10
16
|
var CLAUDE_CODE_KEYCHAIN_SERVICE = "Claude Code-credentials";
|
|
11
|
-
var object = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
12
|
-
var present = (value) => typeof value === "string" && value.length > 0;
|
|
13
17
|
var readKeychain = (service, account) => new Promise((resolve) => {
|
|
14
18
|
execFile(
|
|
15
19
|
"/usr/bin/security",
|
|
@@ -29,47 +33,45 @@ function keychainAccount(env) {
|
|
|
29
33
|
}
|
|
30
34
|
return name && /^[a-zA-Z0-9._-]+$/u.test(name) ? name : "claude-code-user";
|
|
31
35
|
}
|
|
32
|
-
function parse(text) {
|
|
33
|
-
try {
|
|
34
|
-
const value = JSON.parse(text);
|
|
35
|
-
return object(value) ? value : void 0;
|
|
36
|
-
} catch {
|
|
37
|
-
return void 0;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
36
|
async function credentialDocument(options, config) {
|
|
41
37
|
const { env, home, platform } = options;
|
|
38
|
+
const parsed = (text2, failure) => {
|
|
39
|
+
const document = parse(text2);
|
|
40
|
+
return document ? { document } : { unreadable: failure };
|
|
41
|
+
};
|
|
42
42
|
if (platform === "darwin") {
|
|
43
43
|
const item = await options.keychain(CLAUDE_CODE_KEYCHAIN_SERVICE, keychainAccount(env)).catch(() => void 0);
|
|
44
|
-
if (
|
|
45
|
-
if (item
|
|
46
|
-
if (item
|
|
44
|
+
if (item?.code === 0) return parsed(item.stdout.trim(), unreadable("keychain_unreadable"));
|
|
45
|
+
if (item?.code === KEYCHAIN_LOCKED) return { unreadable: unreadable("keychain_locked") };
|
|
46
|
+
if (item?.code !== KEYCHAIN_ITEM_NOT_FOUND)
|
|
47
|
+
return { unreadable: unreadable("keychain_unreadable") };
|
|
47
48
|
}
|
|
48
49
|
if (platform === "win32" && (env.CLAUDE_CODE_FORCE_WINDOWS_CREDMAN === "1" || object(config.cachedGrowthBookFeatures) && config.cachedGrowthBookFeatures.tengu_windows_credman === true))
|
|
49
|
-
return
|
|
50
|
+
return { unreadable: unreadable("credential_manager") };
|
|
50
51
|
let text;
|
|
51
52
|
try {
|
|
52
53
|
text = await readFile(join(home, ".claude", ".credentials.json"), "utf8");
|
|
53
54
|
} catch (error) {
|
|
54
|
-
return error.code === "ENOENT" ? null :
|
|
55
|
+
return error.code === "ENOENT" ? { document: null } : { unreadable: unreadable("file_unreadable") };
|
|
55
56
|
}
|
|
56
|
-
return
|
|
57
|
+
return parsed(text, unreadable("file_unreadable"));
|
|
57
58
|
}
|
|
58
59
|
function claudeCodeCredentialKey(name, declaration) {
|
|
59
60
|
const type = declaration.type === "streamable-http" ? "http" : declaration.type;
|
|
60
61
|
const digest = createHash("sha256").update(JSON.stringify({ type, url: declaration.url, headers: declaration.headers || {} })).digest("hex");
|
|
61
62
|
return `${name}|${digest.slice(0, 16)}`;
|
|
62
63
|
}
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
var token = (value) => typeof value === "string" && value.length > 0;
|
|
65
|
+
function claudeCodeEntryState(entry, now) {
|
|
66
|
+
if (!object(entry) || !token(entry.accessToken) && !token(entry.refreshToken))
|
|
65
67
|
return { state: "missing", expiresAt: null };
|
|
66
68
|
const expires = typeof entry.expiresAt === "number" && Number.isFinite(entry.expiresAt) ? entry.expiresAt : void 0;
|
|
67
69
|
const expiresAt = expires === void 0 ? null : new Date(expires).toISOString();
|
|
68
|
-
if (
|
|
69
|
-
return { state: "
|
|
70
|
-
return { state:
|
|
70
|
+
if (token(entry.accessToken) && (expires === void 0 || expires > now))
|
|
71
|
+
return { state: "authorized", expiresAt };
|
|
72
|
+
return { state: token(entry.refreshToken) ? "renewable" : "missing", expiresAt };
|
|
71
73
|
}
|
|
72
|
-
async function
|
|
74
|
+
async function claudeCodeStoredAuthorization(options) {
|
|
73
75
|
const env = options.env ?? process.env;
|
|
74
76
|
const raw = await readFile(join(options.home, ".claude.json"), "utf8").catch(() => void 0);
|
|
75
77
|
const config = raw === void 0 ? void 0 : parse(raw);
|
|
@@ -78,8 +80,8 @@ async function claudeCodeStoredSignIn(options) {
|
|
|
78
80
|
return void 0;
|
|
79
81
|
if (declaration.headersHelper !== void 0 || object(declaration.headers) && Object.keys(declaration.headers).some((name) => name.toLowerCase() === "authorization"))
|
|
80
82
|
return void 0;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
+
if (env.CLAUDE_CONFIG_DIR || env.CLAUDE_SECURESTORAGE_CONFIG_DIR !== void 0)
|
|
84
|
+
return unreadable("custom_folder");
|
|
83
85
|
const document = await credentialDocument(
|
|
84
86
|
{
|
|
85
87
|
home: options.home,
|
|
@@ -89,18 +91,18 @@ async function claudeCodeStoredSignIn(options) {
|
|
|
89
91
|
},
|
|
90
92
|
config
|
|
91
93
|
);
|
|
92
|
-
if (
|
|
93
|
-
const entries = object(document?.mcpOAuth) ? document.mcpOAuth : {};
|
|
94
|
+
if ("unreadable" in document) return document.unreadable;
|
|
95
|
+
const entries = object(document.document?.mcpOAuth) ? document.document.mcpOAuth : {};
|
|
94
96
|
const key = claudeCodeCredentialKey("mnemonik", {
|
|
95
97
|
type: declaration.type,
|
|
96
98
|
url: declaration.url,
|
|
97
99
|
headers: declaration.headers
|
|
98
100
|
});
|
|
99
|
-
return
|
|
101
|
+
return claudeCodeEntryState(entries[key], (options.now ?? Date.now)());
|
|
100
102
|
}
|
|
101
103
|
export {
|
|
102
104
|
CLAUDE_CODE_KEYCHAIN_SERVICE,
|
|
103
105
|
claudeCodeCredentialKey,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
+
claudeCodeEntryState,
|
|
107
|
+
claudeCodeStoredAuthorization
|
|
106
108
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claudeCodeSignIn.js","sourceRoot":"","sources":["../../src/auth/claudeCodeSignIn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"claudeCodeSignIn.js","sourceRoot":"","sources":["../../src/auth/claudeCodeSignIn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,MAAM,EACN,WAAW,IAAI,KAAK,EACpB,UAAU,GAEX,MAAM,0BAA0B,CAAC;AA6BlC,uGAAuG;AACvG,MAAM,uBAAuB,GAAG,EAAE,CAAC;AACnC,wGAAwG;AACxG,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAAM,CAAC,MAAM,4BAA4B,GAAG,yBAAyB,CAAC;AAgBtE,MAAM,YAAY,GAAiB,CAAC,OAAO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GAAG;QACpB,OAAO,EAAE,WAAW,CAAC,OAAO;KAC7B,CAAC,CAAC;IACH,OAAO,oBAAoB,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AACzE,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type StoredAuthorization } from './storedAuthorization.js';
|
|
2
|
+
/**
|
|
3
|
+
* What Codex itself holds for Mnemonik's MCP server on this computer.
|
|
4
|
+
*
|
|
5
|
+
* Until 2026-10-13 Codex's authorization came from the server's record alone,
|
|
6
|
+
* so the false "authorized" seen for Claude Code on 2026-10-12 could happen for
|
|
7
|
+
* Codex too. Read the way Codex 0.162.1 reads it (codex-rs/rmcp-client/src/oauth.rs,
|
|
8
|
+
* resolved_store.rs; codex-rs/config/src/types.rs):
|
|
9
|
+
*
|
|
10
|
+
* - Where: `mcp_oauth_credentials_store` at the top of $CODEX_HOME/config.toml
|
|
11
|
+
* (CODEX_HOME defaults to ~/.codex): `auto` (the default) tries the
|
|
12
|
+
* operating system's keyring first and falls back to the file; `file` uses
|
|
13
|
+
* $CODEX_HOME/.credentials.json only; `keyring` uses the keyring only. The
|
|
14
|
+
* keyring (macOS Keychain, Windows Credential Manager, the Secret Service on
|
|
15
|
+
* Linux) is never read here: that store is said to be unchecked.
|
|
16
|
+
* - The file is a JSON object of entries keyed `mnemonik|` and the first 16
|
|
17
|
+
* hex characters of the SHA-256 of `{"type":"http","url":<url>,"headers":{}}`
|
|
18
|
+
* (codexCredentialKey; headers are always empty in the key, whatever the
|
|
19
|
+
* declaration sends). For a plain server name Codex finds the entry by its
|
|
20
|
+
* `server_name` and `server_url`, in key order, skipping executor-owned ones.
|
|
21
|
+
* - `auto` with an entry in the file: Codex wrote it there because its keyring
|
|
22
|
+
* failed, and it removes the file entry whenever a keyring save succeeds, so
|
|
23
|
+
* the file entry is the one it uses. `auto` with nothing in the file: on macOS
|
|
24
|
+
* and Windows the keyring holds it (unchecked); on Linux it can only be in a
|
|
25
|
+
* Secret Service keyring, so when this user has none, Codex holds nothing.
|
|
26
|
+
* - Usable as Codex judges it (oauth_tokens_are_usable): a client id; then an
|
|
27
|
+
* access token that does not expire within 30 seconds, or else a refresh
|
|
28
|
+
* token together with the issuer it is bound to.
|
|
29
|
+
*
|
|
30
|
+
* Only key names, presence and `expires_at` are looked at.
|
|
31
|
+
*/
|
|
32
|
+
export interface CodexStoreOptions {
|
|
33
|
+
home: string;
|
|
34
|
+
platform?: NodeJS.Platform;
|
|
35
|
+
env?: NodeJS.ProcessEnv;
|
|
36
|
+
now?: () => number;
|
|
37
|
+
}
|
|
38
|
+
/** Codex's key for a server's stored authorization (compute_store_key). */
|
|
39
|
+
export declare function codexCredentialKey(name: string, url: string): string;
|
|
40
|
+
/** One file entry, judged as Codex judges it when it connects. */
|
|
41
|
+
export declare function codexEntryState(entry: Record<string, unknown>, now: number): StoredAuthorization;
|
|
42
|
+
/**
|
|
43
|
+
* Codex's stored Mnemonik authorization on this computer, or undefined when
|
|
44
|
+
* Codex has no Mnemonik HTTP declaration that authorizes with OAuth here.
|
|
45
|
+
*/
|
|
46
|
+
export declare function codexStoredAuthorization(options: CodexStoreOptions): Promise<StoredAuthorization | undefined>;
|
|
47
|
+
//# sourceMappingURL=codexAuthorization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codexAuthorization.d.ts","sourceRoot":"","sources":["../../src/auth/codexAuthorization.ts"],"names":[],"mappings":"AAIA,OAAO,EAKL,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAKD,2EAA2E;AAC3E,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAKpE;AAED,kEAAkE;AAClE,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,mBAAmB,CAahG;AAgBD;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAyD1C"}
|