semantic-complexity 0.0.1-cedf2072 → 0.0.2-1895c257
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/canonical/convergence.d.ts +56 -0
- package/dist/canonical/convergence.d.ts.map +1 -0
- package/dist/canonical/convergence.js +149 -0
- package/dist/canonical/convergence.js.map +1 -0
- package/dist/canonical/index.d.ts +11 -0
- package/dist/canonical/index.d.ts.map +1 -0
- package/dist/canonical/index.js +11 -0
- package/dist/canonical/index.js.map +1 -0
- package/dist/canonical/profiles.d.ts +40 -0
- package/dist/canonical/profiles.d.ts.map +1 -0
- package/dist/canonical/profiles.js +182 -0
- package/dist/canonical/profiles.js.map +1 -0
- package/dist/canonical/types.d.ts +124 -0
- package/dist/canonical/types.d.ts.map +1 -0
- package/dist/canonical/types.js +46 -0
- package/dist/canonical/types.js.map +1 -0
- package/dist/gates/delta.d.ts +45 -0
- package/dist/gates/delta.d.ts.map +1 -0
- package/dist/gates/delta.js +260 -0
- package/dist/gates/delta.js.map +1 -0
- package/dist/gates/index.d.ts +9 -0
- package/dist/gates/index.d.ts.map +1 -0
- package/dist/gates/index.js +9 -0
- package/dist/gates/index.js.map +1 -0
- package/dist/gates/types.d.ts +96 -0
- package/dist/gates/types.d.ts.map +1 -0
- package/dist/gates/types.js +59 -0
- package/dist/gates/types.js.map +1 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/metrics/meta.d.ts +90 -0
- package/dist/metrics/meta.d.ts.map +1 -0
- package/dist/metrics/meta.js +144 -0
- package/dist/metrics/meta.js.map +1 -0
- package/package.json +9 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 수렴 분석기 (Convergence Analyzer)
|
|
3
|
+
*
|
|
4
|
+
* 현재 상태에서 정준 상태로의 거리 및 방향을 계산
|
|
5
|
+
*
|
|
6
|
+
* NP-hard가 P로 환원되는 이유:
|
|
7
|
+
* - 모든 가능한 구조를 탐색하지 않음
|
|
8
|
+
* - 타입별 정준형으로의 거리만 측정
|
|
9
|
+
* - 거리 측정: O(n)
|
|
10
|
+
*/
|
|
11
|
+
import type { ModuleType, MetaDimensions, ConvergenceResult, Deviation, Vector3D } from './types.js';
|
|
12
|
+
/**
|
|
13
|
+
* 편차 계산
|
|
14
|
+
*/
|
|
15
|
+
export declare function calculateDeviation(current: MetaDimensions, ideal: MetaDimensions): Deviation;
|
|
16
|
+
/**
|
|
17
|
+
* 수렴 벡터 계산 (정준 상태로의 방향)
|
|
18
|
+
*/
|
|
19
|
+
export declare function calculateConvergenceVector(current: MetaDimensions, ideal: MetaDimensions): Vector3D;
|
|
20
|
+
/**
|
|
21
|
+
* 수렴률 계산 (0-1, 1이면 완전 정준)
|
|
22
|
+
*/
|
|
23
|
+
export declare function calculateConvergenceRate(deviation: Deviation, maxDeviation?: number): number;
|
|
24
|
+
/**
|
|
25
|
+
* 수렴 분석 수행
|
|
26
|
+
*/
|
|
27
|
+
export declare function analyzeConvergence(moduleType: ModuleType, currentMeta: MetaDimensions): ConvergenceResult;
|
|
28
|
+
/**
|
|
29
|
+
* 모든 모듈 타입에 대해 수렴 분석
|
|
30
|
+
* 가장 적합한 모듈 타입 추천에 활용
|
|
31
|
+
*/
|
|
32
|
+
export declare function analyzeAllModuleTypes(currentMeta: MetaDimensions): ConvergenceResult[];
|
|
33
|
+
/**
|
|
34
|
+
* 가장 가까운 정준 상태를 가진 모듈 타입 반환
|
|
35
|
+
*/
|
|
36
|
+
export declare function findBestFitModuleType(currentMeta: MetaDimensions): ConvergenceResult;
|
|
37
|
+
/**
|
|
38
|
+
* 수렴 상태 해석
|
|
39
|
+
*/
|
|
40
|
+
export type ConvergenceStatus = 'canonical' | 'near-canonical' | 'drifting' | 'divergent';
|
|
41
|
+
/**
|
|
42
|
+
* 수렴 상태 판정
|
|
43
|
+
*/
|
|
44
|
+
export declare function getConvergenceStatus(result: ConvergenceResult): ConvergenceStatus;
|
|
45
|
+
/**
|
|
46
|
+
* 개선 제안 생성
|
|
47
|
+
*/
|
|
48
|
+
export interface ConvergenceAdvice {
|
|
49
|
+
dimension: 'security' | 'context' | 'behavior';
|
|
50
|
+
currentValue: number;
|
|
51
|
+
idealValue: number;
|
|
52
|
+
deviation: number;
|
|
53
|
+
suggestion: string;
|
|
54
|
+
}
|
|
55
|
+
export declare function generateConvergenceAdvice(result: ConvergenceResult): ConvergenceAdvice[];
|
|
56
|
+
//# sourceMappingURL=convergence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convergence.d.ts","sourceRoot":"","sources":["../../src/canonical/convergence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACT,MAAM,YAAY,CAAC;AAYpB;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,cAAc,GACpB,SAAS,CAWX;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,cAAc,GACpB,QAAQ,CAkBV;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,SAAS,EACpB,YAAY,GAAE,MAAW,GACxB,MAAM,CAGR;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,cAAc,GAC1B,iBAAiB,CAiBnB;AAMD;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,cAAc,GAC1B,iBAAiB,EAAE,CAGrB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,cAAc,GAC1B,iBAAiB,CAKnB;AAMD;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,WAAW,GACX,gBAAgB,GAChB,UAAU,GACV,WAAW,CAAC;AAEhB;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,iBAAiB,GACxB,iBAAiB,CAWnB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC;IAC/C,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,iBAAiB,GACxB,iBAAiB,EAAE,CA4CrB"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 수렴 분석기 (Convergence Analyzer)
|
|
3
|
+
*
|
|
4
|
+
* 현재 상태에서 정준 상태로의 거리 및 방향을 계산
|
|
5
|
+
*
|
|
6
|
+
* NP-hard가 P로 환원되는 이유:
|
|
7
|
+
* - 모든 가능한 구조를 탐색하지 않음
|
|
8
|
+
* - 타입별 정준형으로의 거리만 측정
|
|
9
|
+
* - 거리 측정: O(n)
|
|
10
|
+
*/
|
|
11
|
+
import { CANONICAL_PROFILES, getIdealMetaDimensions, isCanonical, } from './profiles.js';
|
|
12
|
+
import { metaDistance, subtractMetaDimensions } from '../metrics/meta.js';
|
|
13
|
+
// ─────────────────────────────────────────────────────────────────
|
|
14
|
+
// 수렴 분석
|
|
15
|
+
// ─────────────────────────────────────────────────────────────────
|
|
16
|
+
/**
|
|
17
|
+
* 편차 계산
|
|
18
|
+
*/
|
|
19
|
+
export function calculateDeviation(current, ideal) {
|
|
20
|
+
const securityDiff = current.security - ideal.security;
|
|
21
|
+
const contextDiff = current.context - ideal.context;
|
|
22
|
+
const behaviorDiff = current.behavior - ideal.behavior;
|
|
23
|
+
return {
|
|
24
|
+
security: Math.round(securityDiff * 100) / 100,
|
|
25
|
+
context: Math.round(contextDiff * 100) / 100,
|
|
26
|
+
behavior: Math.round(behaviorDiff * 100) / 100,
|
|
27
|
+
total: Math.round(metaDistance(current, ideal) * 100) / 100,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 수렴 벡터 계산 (정준 상태로의 방향)
|
|
32
|
+
*/
|
|
33
|
+
export function calculateConvergenceVector(current, ideal) {
|
|
34
|
+
const diff = subtractMetaDimensions(ideal, current);
|
|
35
|
+
const magnitude = Math.sqrt(diff.security * diff.security +
|
|
36
|
+
diff.context * diff.context +
|
|
37
|
+
diff.behavior * diff.behavior);
|
|
38
|
+
if (magnitude === 0) {
|
|
39
|
+
return { x: 0, y: 0, z: 0 };
|
|
40
|
+
}
|
|
41
|
+
// 정규화된 방향 벡터
|
|
42
|
+
return {
|
|
43
|
+
x: Math.round((diff.security / magnitude) * 100) / 100,
|
|
44
|
+
y: Math.round((diff.context / magnitude) * 100) / 100,
|
|
45
|
+
z: Math.round((diff.behavior / magnitude) * 100) / 100,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* 수렴률 계산 (0-1, 1이면 완전 정준)
|
|
50
|
+
*/
|
|
51
|
+
export function calculateConvergenceRate(deviation, maxDeviation = 50) {
|
|
52
|
+
const rate = 1 - Math.min(deviation.total / maxDeviation, 1);
|
|
53
|
+
return Math.round(rate * 100) / 100;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* 수렴 분석 수행
|
|
57
|
+
*/
|
|
58
|
+
export function analyzeConvergence(moduleType, currentMeta) {
|
|
59
|
+
const profile = CANONICAL_PROFILES[moduleType];
|
|
60
|
+
const idealMeta = getIdealMetaDimensions(profile);
|
|
61
|
+
const deviation = calculateDeviation(currentMeta, idealMeta);
|
|
62
|
+
const vector = calculateConvergenceVector(currentMeta, idealMeta);
|
|
63
|
+
const rate = calculateConvergenceRate(deviation);
|
|
64
|
+
const stable = isCanonical(currentMeta, profile);
|
|
65
|
+
return {
|
|
66
|
+
moduleType,
|
|
67
|
+
currentState: currentMeta,
|
|
68
|
+
canonicalState: idealMeta,
|
|
69
|
+
deviation,
|
|
70
|
+
convergenceVector: vector,
|
|
71
|
+
isStable: stable,
|
|
72
|
+
convergenceRate: rate,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
// ─────────────────────────────────────────────────────────────────
|
|
76
|
+
// 다중 모듈 분석
|
|
77
|
+
// ─────────────────────────────────────────────────────────────────
|
|
78
|
+
/**
|
|
79
|
+
* 모든 모듈 타입에 대해 수렴 분석
|
|
80
|
+
* 가장 적합한 모듈 타입 추천에 활용
|
|
81
|
+
*/
|
|
82
|
+
export function analyzeAllModuleTypes(currentMeta) {
|
|
83
|
+
const types = ['api', 'app', 'lib', 'deploy'];
|
|
84
|
+
return types.map((type) => analyzeConvergence(type, currentMeta));
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* 가장 가까운 정준 상태를 가진 모듈 타입 반환
|
|
88
|
+
*/
|
|
89
|
+
export function findBestFitModuleType(currentMeta) {
|
|
90
|
+
const results = analyzeAllModuleTypes(currentMeta);
|
|
91
|
+
return results.reduce((best, current) => current.deviation.total < best.deviation.total ? current : best);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* 수렴 상태 판정
|
|
95
|
+
*/
|
|
96
|
+
export function getConvergenceStatus(result) {
|
|
97
|
+
if (result.isStable) {
|
|
98
|
+
return 'canonical';
|
|
99
|
+
}
|
|
100
|
+
if (result.convergenceRate >= 0.8) {
|
|
101
|
+
return 'near-canonical';
|
|
102
|
+
}
|
|
103
|
+
if (result.convergenceRate >= 0.5) {
|
|
104
|
+
return 'drifting';
|
|
105
|
+
}
|
|
106
|
+
return 'divergent';
|
|
107
|
+
}
|
|
108
|
+
export function generateConvergenceAdvice(result) {
|
|
109
|
+
const advice = [];
|
|
110
|
+
const { currentState, canonicalState, deviation, moduleType } = result;
|
|
111
|
+
// Security 편차 분석
|
|
112
|
+
if (Math.abs(deviation.security) > 2) {
|
|
113
|
+
advice.push({
|
|
114
|
+
dimension: 'security',
|
|
115
|
+
currentValue: currentState.security,
|
|
116
|
+
idealValue: canonicalState.security,
|
|
117
|
+
deviation: deviation.security,
|
|
118
|
+
suggestion: deviation.security > 0
|
|
119
|
+
? `${moduleType} 모듈은 외부 의존성을 줄여야 합니다. 전역 접근과 환경 변수 사용을 최소화하세요.`
|
|
120
|
+
: `${moduleType} 모듈에 보안 검증 로직이 부족합니다. 입력 검증을 강화하세요.`,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
// Context 편차 분석
|
|
124
|
+
if (Math.abs(deviation.context) > 3) {
|
|
125
|
+
advice.push({
|
|
126
|
+
dimension: 'context',
|
|
127
|
+
currentValue: currentState.context,
|
|
128
|
+
idealValue: canonicalState.context,
|
|
129
|
+
deviation: deviation.context,
|
|
130
|
+
suggestion: deviation.context > 0
|
|
131
|
+
? `${moduleType} 모듈의 맥락 밀도가 높습니다. 중첩을 줄이고 로직을 분리하세요.`
|
|
132
|
+
: `${moduleType} 모듈이 너무 단순합니다. 적절한 검증/처리 로직이 필요할 수 있습니다.`,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
// Behavior 편차 분석
|
|
136
|
+
if (Math.abs(deviation.behavior) > 2) {
|
|
137
|
+
advice.push({
|
|
138
|
+
dimension: 'behavior',
|
|
139
|
+
currentValue: currentState.behavior,
|
|
140
|
+
idealValue: canonicalState.behavior,
|
|
141
|
+
deviation: deviation.behavior,
|
|
142
|
+
suggestion: deviation.behavior > 0
|
|
143
|
+
? `${moduleType} 모듈의 상태/비동기 복잡도가 높습니다. 순수 함수로 리팩토링하세요.`
|
|
144
|
+
: `${moduleType} 모듈에 비즈니스 로직이 부족합니다.`,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
return advice;
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=convergence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convergence.js","sourceRoot":"","sources":["../../src/canon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QAAQ;YAC7B,UAAU,EAAE,SAAS,CAAC,QAAQ,GAAG,CAAC;gBAChC,CAAC,CAAC,GAAG,UAAU,wCAAwC;gBACvD,CAAC,CAAC,GAAG,UAAU,sBAAsB;SACxC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 정준성(Canonicality) 프레임워크
|
|
3
|
+
*
|
|
4
|
+
* 모듈 타입 기반 P-NP 특수해 접근
|
|
5
|
+
*/
|
|
6
|
+
export type { ModuleType, ModuleTypeInfo, MetaDimensions, MetaWeights, Range, CanonicalLevel, CanonicalProfile, Vector3D, Deviation, ConvergenceResult, Snapshot, } from './types.js';
|
|
7
|
+
export { MODULE_TYPE_INFO, DEFAULT_META_WEIGHTS, LEVEL_RANGES, } from './types.js';
|
|
8
|
+
export { CANONICAL_PROFILES, levelToRange, levelToMidpoint, getIdealMetaDimensions, getProfile, isWithinCanonicalRange, isCanonical, inferModuleType, } from './profiles.js';
|
|
9
|
+
export { calculateDeviation, calculateConvergenceVector, calculateConvergenceRate, analyzeConvergence, analyzeAllModuleTypes, findBestFitModuleType, getConvergenceStatus, generateConvergenceAdvice, } from './convergence.js';
|
|
10
|
+
export type { ConvergenceStatus, ConvergenceAdvice, } from './convergence.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/canonical/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,YAAY,EACV,UAAU,EACV,cAAc,EACd,cAAc,EACd,WAAW,EACX,KAAK,EACL,cAAc,EACd,gBAAgB,EAChB,QAAQ,EACR,SAAS,EACT,iBAAiB,EACjB,QAAQ,GACT,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,YAAY,GACb,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,sBAAsB,EACtB,UAAU,EACV,sBAAsB,EACtB,WAAW,EACX,eAAe,GAChB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,wBAAwB,EACxB,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 정준성(Canonicality) 프레임워크
|
|
3
|
+
*
|
|
4
|
+
* 모듈 타입 기반 P-NP 특수해 접근
|
|
5
|
+
*/
|
|
6
|
+
export { MODULE_TYPE_INFO, DEFAULT_META_WEIGHTS, LEVEL_RANGES, } from './types.js';
|
|
7
|
+
// Profiles
|
|
8
|
+
export { CANONICAL_PROFILES, levelToRange, levelToMidpoint, getIdealMetaDimensions, getProfile, isWithinCanonicalRange, isCanonical, inferModuleType, } from './profiles.js';
|
|
9
|
+
// Convergence
|
|
10
|
+
export { calculateDeviation, calculateConvergenceVector, calculateConvergenceRate, analyzeConvergence, analyzeAllModuleTypes, findBestFitModuleType, getConvergenceStatus, generateConvergenceAdvice, } from './convergence.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/canonical/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiBH,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,YAAY,GACb,MAAM,YAAY,CAAC;AAEpB,WAAW;AACX,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,sBAAsB,EACtB,UAAU,EACV,sBAAsB,EACtB,WAAW,EACX,eAAe,GAChB,MAAM,eAAe,CAAC;AAEvB,cAAc;AACd,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,wBAAwB,EACxB,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 모듈별 정준형 프로파일 정의
|
|
3
|
+
*
|
|
4
|
+
* 각 모듈 타입의 이상적인 메타 차원 범위를 정의
|
|
5
|
+
* P-NP 관점: 모듈 타입이 제약 조건으로 작용하여 탐색 공간 축소
|
|
6
|
+
*/
|
|
7
|
+
import type { ModuleType, CanonicalProfile, CanonicalLevel, MetaDimensions, Range } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* 모든 정준형 프로파일
|
|
10
|
+
*/
|
|
11
|
+
export declare const CANONICAL_PROFILES: Record<ModuleType, CanonicalProfile>;
|
|
12
|
+
/**
|
|
13
|
+
* 레벨을 수치 범위로 변환
|
|
14
|
+
*/
|
|
15
|
+
export declare function levelToRange(level: CanonicalLevel): Range;
|
|
16
|
+
/**
|
|
17
|
+
* 레벨의 중앙값 반환
|
|
18
|
+
*/
|
|
19
|
+
export declare function levelToMidpoint(level: CanonicalLevel): number;
|
|
20
|
+
/**
|
|
21
|
+
* 프로파일의 이상적 메타 차원값 반환
|
|
22
|
+
*/
|
|
23
|
+
export declare function getIdealMetaDimensions(profile: CanonicalProfile): MetaDimensions;
|
|
24
|
+
/**
|
|
25
|
+
* 모듈 타입으로 프로파일 조회
|
|
26
|
+
*/
|
|
27
|
+
export declare function getProfile(moduleType: ModuleType): CanonicalProfile;
|
|
28
|
+
/**
|
|
29
|
+
* 값이 정준 범위 내에 있는지 확인
|
|
30
|
+
*/
|
|
31
|
+
export declare function isWithinCanonicalRange(value: number, level: CanonicalLevel, tolerance?: number): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* 메타 차원이 프로파일의 정준 범위 내에 있는지 확인
|
|
34
|
+
*/
|
|
35
|
+
export declare function isCanonical(meta: MetaDimensions, profile: CanonicalProfile): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* 모듈 타입 자동 추론 (파일 경로 기반)
|
|
38
|
+
*/
|
|
39
|
+
export declare function inferModuleType(filePath: string): ModuleType;
|
|
40
|
+
//# sourceMappingURL=profiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../../src/canonical/profiles.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,KAAK,EACN,MAAM,YAAY,CAAC;AAkFpB;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,UAAU,EAAE,gBAAgB,CAKnE,CAAC;AAMF;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,GAAG,KAAK,CASzD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAM7D;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,gBAAgB,GAAG,cAAc,CAMhF;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,UAAU,GAAG,gBAAgB,CAEnE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,cAAc,EACrB,SAAS,GAAE,MAAU,GACpB,OAAO,CAGT;AAED;;GAEG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAMT;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAwC5D"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 모듈별 정준형 프로파일 정의
|
|
3
|
+
*
|
|
4
|
+
* 각 모듈 타입의 이상적인 메타 차원 범위를 정의
|
|
5
|
+
* P-NP 관점: 모듈 타입이 제약 조건으로 작용하여 탐색 공간 축소
|
|
6
|
+
*/
|
|
7
|
+
// ─────────────────────────────────────────────────────────────────
|
|
8
|
+
// 정준형 프로파일 정의
|
|
9
|
+
// ─────────────────────────────────────────────────────────────────
|
|
10
|
+
/**
|
|
11
|
+
* API 모듈 정준형
|
|
12
|
+
*
|
|
13
|
+
* 경계면 역할: 외부 입력 검증, 무상태, 얇은 레이어
|
|
14
|
+
*/
|
|
15
|
+
const API_PROFILE = {
|
|
16
|
+
type: 'api',
|
|
17
|
+
ideal: {
|
|
18
|
+
security: 'high', // 입력 검증, 인증/인가 집중
|
|
19
|
+
context: 'low', // 단순한 라우팅, 최소 로직
|
|
20
|
+
behavior: 'low', // 상태 없음, 부작용 최소
|
|
21
|
+
},
|
|
22
|
+
tolerance: {
|
|
23
|
+
security: 5,
|
|
24
|
+
context: 3,
|
|
25
|
+
behavior: 3,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* App 모듈 정준형
|
|
30
|
+
*
|
|
31
|
+
* 응용 로직: 비즈니스 로직 집중, 상태/비동기 허용
|
|
32
|
+
*/
|
|
33
|
+
const APP_PROFILE = {
|
|
34
|
+
type: 'app',
|
|
35
|
+
ideal: {
|
|
36
|
+
security: 'medium', // 내부 검증
|
|
37
|
+
context: 'high', // 복잡한 비즈니스 로직 허용
|
|
38
|
+
behavior: 'high', // 상태/비동기 허용
|
|
39
|
+
},
|
|
40
|
+
tolerance: {
|
|
41
|
+
security: 5,
|
|
42
|
+
context: 10,
|
|
43
|
+
behavior: 10,
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Lib 모듈 정준형
|
|
48
|
+
*
|
|
49
|
+
* 재사용 라이브러리: 순수 함수, 고응집, 저결합
|
|
50
|
+
*/
|
|
51
|
+
const LIB_PROFILE = {
|
|
52
|
+
type: 'lib',
|
|
53
|
+
ideal: {
|
|
54
|
+
security: 'low', // 외부 의존 최소
|
|
55
|
+
context: 'low', // 단순하고 명확한 인터페이스
|
|
56
|
+
behavior: 'low', // 순수 함수, 부작용 없음
|
|
57
|
+
},
|
|
58
|
+
tolerance: {
|
|
59
|
+
security: 2,
|
|
60
|
+
context: 5,
|
|
61
|
+
behavior: 3,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Deploy 모듈 정준형
|
|
66
|
+
*
|
|
67
|
+
* 배포 구성: 선언적, 로직 최소
|
|
68
|
+
*/
|
|
69
|
+
const DEPLOY_PROFILE = {
|
|
70
|
+
type: 'deploy',
|
|
71
|
+
ideal: {
|
|
72
|
+
security: 'high', // 환경 변수, 시크릿 관리
|
|
73
|
+
context: 'lowest', // 로직 없음
|
|
74
|
+
behavior: 'lowest', // 부작용 없음
|
|
75
|
+
},
|
|
76
|
+
tolerance: {
|
|
77
|
+
security: 3,
|
|
78
|
+
context: 1,
|
|
79
|
+
behavior: 1,
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* 모든 정준형 프로파일
|
|
84
|
+
*/
|
|
85
|
+
export const CANONICAL_PROFILES = {
|
|
86
|
+
api: API_PROFILE,
|
|
87
|
+
app: APP_PROFILE,
|
|
88
|
+
lib: LIB_PROFILE,
|
|
89
|
+
deploy: DEPLOY_PROFILE,
|
|
90
|
+
};
|
|
91
|
+
// ─────────────────────────────────────────────────────────────────
|
|
92
|
+
// 프로파일 유틸리티
|
|
93
|
+
// ─────────────────────────────────────────────────────────────────
|
|
94
|
+
/**
|
|
95
|
+
* 레벨을 수치 범위로 변환
|
|
96
|
+
*/
|
|
97
|
+
export function levelToRange(level) {
|
|
98
|
+
const ranges = {
|
|
99
|
+
lowest: { min: 0, max: 2 },
|
|
100
|
+
low: { min: 0, max: 5 },
|
|
101
|
+
medium: { min: 3, max: 10 },
|
|
102
|
+
high: { min: 8, max: 20 },
|
|
103
|
+
highest: { min: 15, max: Infinity },
|
|
104
|
+
};
|
|
105
|
+
return ranges[level];
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* 레벨의 중앙값 반환
|
|
109
|
+
*/
|
|
110
|
+
export function levelToMidpoint(level) {
|
|
111
|
+
const range = levelToRange(level);
|
|
112
|
+
if (range.max === Infinity) {
|
|
113
|
+
return range.min + 10; // 무한대 처리
|
|
114
|
+
}
|
|
115
|
+
return (range.min + range.max) / 2;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* 프로파일의 이상적 메타 차원값 반환
|
|
119
|
+
*/
|
|
120
|
+
export function getIdealMetaDimensions(profile) {
|
|
121
|
+
return {
|
|
122
|
+
security: levelToMidpoint(profile.ideal.security),
|
|
123
|
+
context: levelToMidpoint(profile.ideal.context),
|
|
124
|
+
behavior: levelToMidpoint(profile.ideal.behavior),
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* 모듈 타입으로 프로파일 조회
|
|
129
|
+
*/
|
|
130
|
+
export function getProfile(moduleType) {
|
|
131
|
+
return CANONICAL_PROFILES[moduleType];
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* 값이 정준 범위 내에 있는지 확인
|
|
135
|
+
*/
|
|
136
|
+
export function isWithinCanonicalRange(value, level, tolerance = 0) {
|
|
137
|
+
const range = levelToRange(level);
|
|
138
|
+
return value >= range.min - tolerance && value <= range.max + tolerance;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* 메타 차원이 프로파일의 정준 범위 내에 있는지 확인
|
|
142
|
+
*/
|
|
143
|
+
export function isCanonical(meta, profile) {
|
|
144
|
+
return (isWithinCanonicalRange(meta.security, profile.ideal.security, profile.tolerance.security) &&
|
|
145
|
+
isWithinCanonicalRange(meta.context, profile.ideal.context, profile.tolerance.context) &&
|
|
146
|
+
isWithinCanonicalRange(meta.behavior, profile.ideal.behavior, profile.tolerance.behavior));
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* 모듈 타입 자동 추론 (파일 경로 기반)
|
|
150
|
+
*/
|
|
151
|
+
export function inferModuleType(filePath) {
|
|
152
|
+
const path = filePath.toLowerCase();
|
|
153
|
+
// deploy 패턴
|
|
154
|
+
if (path.includes('/deploy/') ||
|
|
155
|
+
path.includes('/infra/') ||
|
|
156
|
+
path.includes('/k8s/') ||
|
|
157
|
+
path.includes('/helm/') ||
|
|
158
|
+
path.includes('/terraform/') ||
|
|
159
|
+
path.endsWith('.yaml') ||
|
|
160
|
+
path.endsWith('.yml')) {
|
|
161
|
+
return 'deploy';
|
|
162
|
+
}
|
|
163
|
+
// api 패턴
|
|
164
|
+
if (path.includes('/api/') ||
|
|
165
|
+
path.includes('/routes/') ||
|
|
166
|
+
path.includes('/controllers/') ||
|
|
167
|
+
path.includes('/handlers/') ||
|
|
168
|
+
path.includes('/endpoints/')) {
|
|
169
|
+
return 'api';
|
|
170
|
+
}
|
|
171
|
+
// lib 패턴
|
|
172
|
+
if (path.includes('/lib/') ||
|
|
173
|
+
path.includes('/utils/') ||
|
|
174
|
+
path.includes('/helpers/') ||
|
|
175
|
+
path.includes('/common/') ||
|
|
176
|
+
path.includes('/shared/')) {
|
|
177
|
+
return 'lib';
|
|
178
|
+
}
|
|
179
|
+
// 기본값: app
|
|
180
|
+
return 'app';
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=profiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles.js","sourceRoot":"","sources":["../../src/canonical/profiles.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH,oEAAoE;AACpE,cAAc;AACd,oEAAoE;AAEpE;;;;GAIG;AACH,MAAM,WAAW,GAAqB;IACpC,IAAI,EAAE,KAAK;IACX,KAAK,EAAE;QACL,QAAQ,EAAE,MAAM,EAAM,kBAAkB;QACxC,OAAO,EAAE,KAAK,EAAQ,iBAAiB;QACvC,QAAQ,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E,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;QACtB,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;QACzB,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC;QAC9B,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC;QAC3B,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,EAC5B,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,SAAS;IACT,IACE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;QACtB,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;QACxB,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;QAC1B,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;QACzB,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,EACzB,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,WAAW;IACX,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 정준성(Canonicality) 프레임워크 타입 정의
|
|
3
|
+
*
|
|
4
|
+
* 햄 샌드위치 정리 기반:
|
|
5
|
+
* - 🍞 Security: 구조 안정성
|
|
6
|
+
* - 🧀 Context: 맥락 밀도
|
|
7
|
+
* - 🥓 Behavior: 행동 보존성
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* 모듈 타입 정의
|
|
11
|
+
*
|
|
12
|
+
* 각 타입은 독립된 문제 클래스를 형성하여
|
|
13
|
+
* NP-hard → P 환원을 가능하게 함
|
|
14
|
+
*/
|
|
15
|
+
export type ModuleType = 'api' | 'app' | 'lib' | 'deploy';
|
|
16
|
+
/**
|
|
17
|
+
* 모듈 타입 메타데이터
|
|
18
|
+
*/
|
|
19
|
+
export interface ModuleTypeInfo {
|
|
20
|
+
type: ModuleType;
|
|
21
|
+
description: string;
|
|
22
|
+
characteristics: string[];
|
|
23
|
+
}
|
|
24
|
+
export declare const MODULE_TYPE_INFO: Record<ModuleType, ModuleTypeInfo>;
|
|
25
|
+
/**
|
|
26
|
+
* 메타 차원 점수
|
|
27
|
+
*
|
|
28
|
+
* 기존 5개 차원을 3개 상위 축으로 집계:
|
|
29
|
+
* - 🍞 Security: coupling + globalAccess + envDependency
|
|
30
|
+
* - 🧀 Context: cognitive + nestingDepth + callbackDepth
|
|
31
|
+
* - 🥓 Behavior: state + async + sideEffects
|
|
32
|
+
*/
|
|
33
|
+
export interface MetaDimensions {
|
|
34
|
+
/** 🍞 구조 안정성 (Security) */
|
|
35
|
+
security: number;
|
|
36
|
+
/** 🧀 맥락 밀도 (Context) */
|
|
37
|
+
context: number;
|
|
38
|
+
/** 🥓 행동 보존성 (Behavior) */
|
|
39
|
+
behavior: number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 메타 차원 가중치
|
|
43
|
+
*/
|
|
44
|
+
export interface MetaWeights {
|
|
45
|
+
security: number;
|
|
46
|
+
context: number;
|
|
47
|
+
behavior: number;
|
|
48
|
+
}
|
|
49
|
+
export declare const DEFAULT_META_WEIGHTS: MetaWeights;
|
|
50
|
+
/**
|
|
51
|
+
* 수치 범위
|
|
52
|
+
*/
|
|
53
|
+
export interface Range {
|
|
54
|
+
min: number;
|
|
55
|
+
max: number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 정준 레벨
|
|
59
|
+
*/
|
|
60
|
+
export type CanonicalLevel = 'lowest' | 'low' | 'medium' | 'high' | 'highest';
|
|
61
|
+
/**
|
|
62
|
+
* 레벨별 범위 매핑
|
|
63
|
+
*/
|
|
64
|
+
export declare const LEVEL_RANGES: Record<CanonicalLevel, Range>;
|
|
65
|
+
/**
|
|
66
|
+
* 모듈별 정준형 프로파일
|
|
67
|
+
*/
|
|
68
|
+
export interface CanonicalProfile {
|
|
69
|
+
type: ModuleType;
|
|
70
|
+
ideal: {
|
|
71
|
+
security: CanonicalLevel;
|
|
72
|
+
context: CanonicalLevel;
|
|
73
|
+
behavior: CanonicalLevel;
|
|
74
|
+
};
|
|
75
|
+
tolerance: {
|
|
76
|
+
security: number;
|
|
77
|
+
context: number;
|
|
78
|
+
behavior: number;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* 3D 벡터 (수렴 방향)
|
|
83
|
+
*/
|
|
84
|
+
export interface Vector3D {
|
|
85
|
+
x: number;
|
|
86
|
+
y: number;
|
|
87
|
+
z: number;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* 편차 정보
|
|
91
|
+
*/
|
|
92
|
+
export interface Deviation {
|
|
93
|
+
security: number;
|
|
94
|
+
context: number;
|
|
95
|
+
behavior: number;
|
|
96
|
+
/** L2 norm (유클리드 거리) */
|
|
97
|
+
total: number;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* 수렴 분석 결과
|
|
101
|
+
*/
|
|
102
|
+
export interface ConvergenceResult {
|
|
103
|
+
moduleType: ModuleType;
|
|
104
|
+
currentState: MetaDimensions;
|
|
105
|
+
canonicalState: MetaDimensions;
|
|
106
|
+
deviation: Deviation;
|
|
107
|
+
convergenceVector: Vector3D;
|
|
108
|
+
/** 정준 상태 도달 여부 */
|
|
109
|
+
isStable: boolean;
|
|
110
|
+
/** 수렴률 (0-1, 1이면 완전 정준) */
|
|
111
|
+
convergenceRate: number;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* 분석 스냅샷 (특정 시점의 상태)
|
|
115
|
+
*/
|
|
116
|
+
export interface Snapshot {
|
|
117
|
+
timestamp: number;
|
|
118
|
+
commitHash?: string;
|
|
119
|
+
moduleType: ModuleType;
|
|
120
|
+
meta: MetaDimensions;
|
|
121
|
+
functionCount: number;
|
|
122
|
+
totalWeighted: number;
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/canonical/types.ts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,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAMD;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,wBAAwB;IACxB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,UAAU,CAAC;IACvB,YAAY,EAAE,cAAc,CAAC;IAC7B,cAAc,EAAE,cAAc,CAAC;IAC/B,SAAS,EAAE,SAAS,CAAC;IACrB,iBAAiB,EAAE,QAAQ,CAAC;IAC5B,kBAAkB;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,2BAA2B;IAC3B,eAAe,EAAE,MAAM,CAAC;CACzB;AAMD;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,UAAU,CAAC;IACvB,IAAI,EAAE,cAAc,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 정준성(Canonicality) 프레임워크 타입 정의
|
|
3
|
+
*
|
|
4
|
+
* 햄 샌드위치 정리 기반:
|
|
5
|
+
* - 🍞 Security: 구조 안정성
|
|
6
|
+
* - 🧀 Context: 맥락 밀도
|
|
7
|
+
* - 🥓 Behavior: 행동 보존성
|
|
8
|
+
*/
|
|
9
|
+
export const MODULE_TYPE_INFO = {
|
|
10
|
+
api: {
|
|
11
|
+
type: 'api',
|
|
12
|
+
description: '경계면 (internal/external)',
|
|
13
|
+
characteristics: ['얇은 레이어', '무상태', '검증 집중'],
|
|
14
|
+
},
|
|
15
|
+
app: {
|
|
16
|
+
type: 'app',
|
|
17
|
+
description: '응용 로직',
|
|
18
|
+
characteristics: ['상태/비동기 허용', '격리됨'],
|
|
19
|
+
},
|
|
20
|
+
lib: {
|
|
21
|
+
type: 'lib',
|
|
22
|
+
description: '재사용 라이브러리',
|
|
23
|
+
characteristics: ['순수 함수', '고응집', '저결합'],
|
|
24
|
+
},
|
|
25
|
+
deploy: {
|
|
26
|
+
type: 'deploy',
|
|
27
|
+
description: '배포 구성',
|
|
28
|
+
characteristics: ['선언적', '로직 최소'],
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
export const DEFAULT_META_WEIGHTS = {
|
|
32
|
+
security: 1.0,
|
|
33
|
+
context: 1.0,
|
|
34
|
+
behavior: 1.0,
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* 레벨별 범위 매핑
|
|
38
|
+
*/
|
|
39
|
+
export const LEVEL_RANGES = {
|
|
40
|
+
lowest: { min: 0, max: 2 },
|
|
41
|
+
low: { min: 0, max: 5 },
|
|
42
|
+
medium: { min: 3, max: 10 },
|
|
43
|
+
high: { min: 8, max: 20 },
|
|
44
|
+
highest: { min: 15, max: Infinity },
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/canonical/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAuBH,MAAM,CAAC,MAAM,gBAAgB,GAAuC;IAClE,GAAG,EAAE;QACH,IAAI,EAAE,KAAK;QACX,WAAW,EAAE,yBAAyB;QACtC,eAAe,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC;KAC5C;IACD,GAAG,EAAE;QACH,IAAI,EAAE,KAAK;QACX,W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