marhup 0.1.7 → 0.1.9
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 +481 -4
- package/dist/cli.js +659 -78
- package/dist/cli.js.map +1 -1
- package/dist/errors.d.ts +29 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +62 -0
- package/dist/errors.js.map +1 -0
- package/dist/generator/code.d.ts +4 -3
- package/dist/generator/code.d.ts.map +1 -1
- package/dist/generator/code.js +7 -7
- package/dist/generator/code.js.map +1 -1
- package/dist/generator/gen-animations.d.ts +13 -0
- package/dist/generator/gen-animations.d.ts.map +1 -0
- package/dist/generator/gen-animations.js +77 -0
- package/dist/generator/gen-animations.js.map +1 -0
- package/dist/generator/image.d.ts +4 -3
- package/dist/generator/image.d.ts.map +1 -1
- package/dist/generator/image.js +67 -80
- package/dist/generator/image.js.map +1 -1
- package/dist/generator/index.d.ts +2 -0
- package/dist/generator/index.d.ts.map +1 -1
- package/dist/generator/index.js +9 -18
- package/dist/generator/index.js.map +1 -1
- package/dist/generator/list.d.ts +4 -3
- package/dist/generator/list.d.ts.map +1 -1
- package/dist/generator/list.js +15 -17
- package/dist/generator/list.js.map +1 -1
- package/dist/generator/mermaid.d.ts +9 -4
- package/dist/generator/mermaid.d.ts.map +1 -1
- package/dist/generator/mermaid.js +120 -85
- package/dist/generator/mermaid.js.map +1 -1
- package/dist/generator/pptx.d.ts +1 -1
- package/dist/generator/pptx.d.ts.map +1 -1
- package/dist/generator/pptx.js +232 -60
- package/dist/generator/pptx.js.map +1 -1
- package/dist/generator/presentation.d.ts +149 -0
- package/dist/generator/presentation.d.ts.map +1 -0
- package/dist/generator/presentation.js +163 -0
- package/dist/generator/presentation.js.map +1 -0
- package/dist/generator/table.d.ts +4 -3
- package/dist/generator/table.d.ts.map +1 -1
- package/dist/generator/table.js +12 -33
- package/dist/generator/table.js.map +1 -1
- package/dist/generator/text.d.ts +5 -4
- package/dist/generator/text.d.ts.map +1 -1
- package/dist/generator/text.js +34 -20
- package/dist/generator/text.js.map +1 -1
- package/dist/generator/video.d.ts +18 -0
- package/dist/generator/video.d.ts.map +1 -0
- package/dist/generator/video.js +83 -0
- package/dist/generator/video.js.map +1 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +144 -55
- package/dist/index.js.map +1 -1
- package/dist/layout/auto.d.ts +14 -2
- package/dist/layout/auto.d.ts.map +1 -1
- package/dist/layout/auto.js +129 -37
- package/dist/layout/auto.js.map +1 -1
- package/dist/layout/engine.d.ts +1 -1
- package/dist/layout/engine.d.ts.map +1 -1
- package/dist/layout/engine.js +10 -12
- package/dist/layout/engine.js.map +1 -1
- package/dist/layout/index.d.ts +1 -1
- package/dist/layout/index.d.ts.map +1 -1
- package/dist/layout/index.js +2 -10
- package/dist/layout/index.js.map +1 -1
- package/dist/layout/types.d.ts +1 -0
- package/dist/layout/types.d.ts.map +1 -1
- package/dist/layout/types.js +1 -2
- package/dist/layout/types.js.map +1 -1
- package/dist/mcp-handlers.d.ts.map +1 -1
- package/dist/mcp-handlers.js +45 -54
- package/dist/mcp-handlers.js.map +1 -1
- package/dist/mcp.js +10 -12
- package/dist/mcp.js.map +1 -1
- package/dist/parser/frontmatter.d.ts.map +1 -1
- package/dist/parser/frontmatter.js +95 -16
- package/dist/parser/frontmatter.js.map +1 -1
- package/dist/parser/grid.d.ts +5 -7
- package/dist/parser/grid.d.ts.map +1 -1
- package/dist/parser/grid.js +217 -30
- package/dist/parser/grid.js.map +1 -1
- package/dist/parser/index.js +3 -13
- package/dist/parser/index.js.map +1 -1
- package/dist/parser/markdown.d.ts +1 -1
- package/dist/parser/markdown.d.ts.map +1 -1
- package/dist/parser/markdown.js +249 -137
- package/dist/parser/markdown.js.map +1 -1
- package/dist/theme/default.d.ts +1 -1
- package/dist/theme/default.d.ts.map +1 -1
- package/dist/theme/default.js +16 -8
- package/dist/theme/default.js.map +1 -1
- package/dist/theme/index.d.ts +11 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +70 -7
- package/dist/theme/index.js.map +1 -1
- package/dist/types/index.d.ts +56 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +4 -6
- package/dist/types/index.js.map +1 -1
- package/dist/types/plugin.d.ts +50 -0
- package/dist/types/plugin.d.ts.map +1 -0
- package/dist/types/plugin.js +5 -0
- package/dist/types/plugin.js.map +1 -0
- package/dist/utils/file-lock.d.ts +27 -0
- package/dist/utils/file-lock.d.ts.map +1 -0
- package/dist/utils/file-lock.js +118 -0
- package/dist/utils/file-lock.js.map +1 -0
- package/dist/utils/i18n.d.ts +5 -0
- package/dist/utils/i18n.d.ts.map +1 -0
- package/dist/utils/i18n.js +41 -0
- package/dist/utils/i18n.js.map +1 -0
- package/dist/utils/logger.d.ts +7 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +43 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/path-validation.d.ts +20 -0
- package/dist/utils/path-validation.d.ts.map +1 -0
- package/dist/utils/path-validation.js +39 -0
- package/dist/utils/path-validation.js.map +1 -0
- package/dist/utils/plugin-manager.d.ts +18 -0
- package/dist/utils/plugin-manager.d.ts.map +1 -0
- package/dist/utils/plugin-manager.js +108 -0
- package/dist/utils/plugin-manager.js.map +1 -0
- package/dist/utils/sanitizer.d.ts +14 -0
- package/dist/utils/sanitizer.d.ts.map +1 -0
- package/dist/utils/sanitizer.js +73 -0
- package/dist/utils/sanitizer.js.map +1 -0
- package/package.json +23 -8
package/dist/layout/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* レイアウトモジュール
|
|
3
3
|
*/
|
|
4
4
|
export { layoutSlide, gridToCoordinates } from './engine.js';
|
|
5
|
-
export { autoPlaceElements, estimateElementHeight, findAvailablePosition } from './auto.js';
|
|
5
|
+
export { autoPlaceElements, estimateElementHeight, estimateElementWidth, findAvailablePosition, findBestAvailablePosition, validateGridPosition } from './auto.js';
|
|
6
6
|
export type { PlacedElement, GridMap, LayoutResult } from './types.js';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACnK,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/layout/index.js
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* レイアウトモジュール
|
|
4
3
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var engine_js_1 = require("./engine.js");
|
|
8
|
-
Object.defineProperty(exports, "layoutSlide", { enumerable: true, get: function () { return engine_js_1.layoutSlide; } });
|
|
9
|
-
Object.defineProperty(exports, "gridToCoordinates", { enumerable: true, get: function () { return engine_js_1.gridToCoordinates; } });
|
|
10
|
-
var auto_js_1 = require("./auto.js");
|
|
11
|
-
Object.defineProperty(exports, "autoPlaceElements", { enumerable: true, get: function () { return auto_js_1.autoPlaceElements; } });
|
|
12
|
-
Object.defineProperty(exports, "estimateElementHeight", { enumerable: true, get: function () { return auto_js_1.estimateElementHeight; } });
|
|
13
|
-
Object.defineProperty(exports, "findAvailablePosition", { enumerable: true, get: function () { return auto_js_1.findAvailablePosition; } });
|
|
4
|
+
export { layoutSlide, gridToCoordinates } from './engine.js';
|
|
5
|
+
export { autoPlaceElements, estimateElementHeight, estimateElementWidth, findAvailablePosition, findBestAvailablePosition, validateGridPosition } from './auto.js';
|
|
14
6
|
//# sourceMappingURL=index.js.map
|
package/dist/layout/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/layout/types.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/layout/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGlF,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC3B,OAAO,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,YAAY,CAAC;IACvB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAGD,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAGD,MAAM,MAAM,OAAO,GAAG,QAAQ,EAAE,EAAE,CAAC;AAGnC,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;CAClB"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/layout/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGlF,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC3B,OAAO,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,YAAY,CAAC;IACvB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAGD,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAGD,MAAM,MAAM,OAAO,GAAG,QAAQ,EAAE,EAAE,CAAC;AAGnC,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;CAClB"}
|
package/dist/layout/types.js
CHANGED
package/dist/layout/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/layout/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/layout/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-handlers.d.ts","sourceRoot":"","sources":["../src/mcp-handlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"mcp-handlers.d.ts","sourceRoot":"","sources":["../src/mcp-handlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC1C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACpC,QAAQ,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC;CACH;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,cAAc,EAAE,CAyDrD;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,CA0HvC;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,UAAU,CAAC,CA0GrB"}
|
package/dist/mcp-handlers.js
CHANGED
|
@@ -1,52 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* MCP ツールハンドラー
|
|
4
3
|
* テスト可能な形でMCPツールのロジックを提供
|
|
5
4
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
Object.defineProperty(o, k2, desc);
|
|
13
|
-
}) : (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
o[k2] = m[k];
|
|
16
|
-
}));
|
|
17
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
-
}) : function(o, v) {
|
|
20
|
-
o["default"] = v;
|
|
21
|
-
});
|
|
22
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
-
var ownKeys = function(o) {
|
|
24
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
-
var ar = [];
|
|
26
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
-
return ar;
|
|
28
|
-
};
|
|
29
|
-
return ownKeys(o);
|
|
30
|
-
};
|
|
31
|
-
return function (mod) {
|
|
32
|
-
if (mod && mod.__esModule) return mod;
|
|
33
|
-
var result = {};
|
|
34
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
-
__setModuleDefault(result, mod);
|
|
36
|
-
return result;
|
|
37
|
-
};
|
|
38
|
-
})();
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.getToolDefinitions = getToolDefinitions;
|
|
41
|
-
exports.getMarhupGuide = getMarhupGuide;
|
|
42
|
-
exports.handleToolCall = handleToolCall;
|
|
43
|
-
const fs = __importStar(require("fs"));
|
|
44
|
-
const path = __importStar(require("path"));
|
|
45
|
-
const index_1 = require("./index");
|
|
5
|
+
import * as fs from 'fs';
|
|
6
|
+
import * as path from 'path';
|
|
7
|
+
import { marhup, marhupFile } from './index.js';
|
|
8
|
+
import { MarhupError } from './errors.js';
|
|
9
|
+
import { t } from './utils/i18n.js';
|
|
46
10
|
/**
|
|
47
11
|
* 利用可能なツール一覧を取得
|
|
48
12
|
*/
|
|
49
|
-
function getToolDefinitions() {
|
|
13
|
+
export function getToolDefinitions() {
|
|
50
14
|
return [
|
|
51
15
|
{
|
|
52
16
|
name: 'convert_markdown_to_pptx',
|
|
@@ -102,7 +66,7 @@ function getToolDefinitions() {
|
|
|
102
66
|
/**
|
|
103
67
|
* Markdownテキストから記法ガイドを生成
|
|
104
68
|
*/
|
|
105
|
-
function getMarhupGuide() {
|
|
69
|
+
export function getMarhupGuide() {
|
|
106
70
|
return `# marhup Markdown記法ガイド
|
|
107
71
|
|
|
108
72
|
## 基本構造
|
|
@@ -111,15 +75,20 @@ function getMarhupGuide() {
|
|
|
111
75
|
---
|
|
112
76
|
title: プレゼンテーションタイトル
|
|
113
77
|
grid: 12x9
|
|
78
|
+
aliases:
|
|
79
|
+
title: "[1-12, 1]"
|
|
80
|
+
contents: "[1-12, 2-8]"
|
|
81
|
+
left: "[1-6, 2-8]"
|
|
82
|
+
right: "[7-12, 2-8]"
|
|
114
83
|
---
|
|
115
84
|
|
|
116
|
-
# スライド1タイトル [
|
|
85
|
+
# スライド1タイトル [title]
|
|
117
86
|
|
|
118
87
|
コンテンツ...
|
|
119
88
|
|
|
120
89
|
---
|
|
121
90
|
|
|
122
|
-
# スライド2タイトル [
|
|
91
|
+
# スライド2タイトル [title]
|
|
123
92
|
|
|
124
93
|
コンテンツ...
|
|
125
94
|
\`\`\`
|
|
@@ -128,12 +97,34 @@ grid: 12x9
|
|
|
128
97
|
|
|
129
98
|
- **列**: 1〜12(左→右)
|
|
130
99
|
- **行**: 1〜9(上→下)
|
|
131
|
-
- **記法**: \`[列開始-列終了, 行開始-行終了]\`
|
|
100
|
+
- **記法**: \`[列開始-列終了, 行開始-行終了]\` または定義した別名
|
|
101
|
+
|
|
102
|
+
## 別名定義
|
|
103
|
+
|
|
104
|
+
Front Matterでグリッド位置に別名を定義できます:
|
|
105
|
+
|
|
106
|
+
\`\`\`markdown
|
|
107
|
+
---
|
|
108
|
+
aliases:
|
|
109
|
+
title: "[1-12, 1]"
|
|
110
|
+
contents: "[1-12, 2-8]"
|
|
111
|
+
left: "[1-6, 2-8]"
|
|
112
|
+
right: "[7-12, 2-8]"
|
|
113
|
+
---
|
|
114
|
+
\`\`\`
|
|
115
|
+
|
|
116
|
+
定義した別名は \`[別名]\` で使用できます:
|
|
117
|
+
|
|
118
|
+
\`\`\`markdown
|
|
119
|
+
# タイトル [title]
|
|
120
|
+
本文 [contents]
|
|
121
|
+
\`\`\`
|
|
132
122
|
|
|
133
123
|
例:
|
|
134
124
|
- \`[1-12, 1]\` - 全幅、1行目
|
|
135
125
|
- \`[1-6, 2-5]\` - 左半分、2〜5行目
|
|
136
126
|
- \`[7-12, 2-5]\` - 右半分、2〜5行目
|
|
127
|
+
- \`[title]\` - 定義したタイトル位置
|
|
137
128
|
|
|
138
129
|
## 要素の配置
|
|
139
130
|
|
|
@@ -201,20 +192,20 @@ graph TD
|
|
|
201
192
|
/**
|
|
202
193
|
* ツールを実行
|
|
203
194
|
*/
|
|
204
|
-
async function handleToolCall(name, args) {
|
|
195
|
+
export async function handleToolCall(name, args) {
|
|
205
196
|
try {
|
|
206
197
|
switch (name) {
|
|
207
198
|
case 'convert_markdown_to_pptx': {
|
|
208
199
|
const { markdown, outputPath, basePath } = args;
|
|
209
200
|
if (!markdown || !outputPath) {
|
|
210
|
-
throw new
|
|
201
|
+
throw new MarhupError(t('errors.requiredParameters', { params: 'markdown and outputPath' }), 'MISSING_PARAMETERS', t('errors.specifyBothMarkdownAndOutputPath'));
|
|
211
202
|
}
|
|
212
203
|
// 出力ディレクトリが存在しない場合は作成
|
|
213
204
|
const outputDir = path.dirname(outputPath);
|
|
214
205
|
if (!fs.existsSync(outputDir)) {
|
|
215
206
|
fs.mkdirSync(outputDir, { recursive: true });
|
|
216
207
|
}
|
|
217
|
-
await
|
|
208
|
+
await marhup(markdown, {
|
|
218
209
|
output: outputPath,
|
|
219
210
|
basePath: basePath || process.cwd(),
|
|
220
211
|
});
|
|
@@ -230,17 +221,17 @@ async function handleToolCall(name, args) {
|
|
|
230
221
|
case 'convert_file_to_pptx': {
|
|
231
222
|
const { inputPath, outputPath } = args;
|
|
232
223
|
if (!inputPath || !outputPath) {
|
|
233
|
-
throw new
|
|
224
|
+
throw new MarhupError(t('errors.requiredParameters', { params: 'inputPath and outputPath' }), 'MISSING_PARAMETERS', t('errors.specifyBothInputPathAndOutputPath'));
|
|
234
225
|
}
|
|
235
226
|
if (!fs.existsSync(inputPath)) {
|
|
236
|
-
throw new
|
|
227
|
+
throw new MarhupError(t('errors.inputFileNotFound', { path: inputPath }), 'FILE_NOT_FOUND', t('errors.suggestionCheckFilePath'), inputPath);
|
|
237
228
|
}
|
|
238
229
|
// 出力ディレクトリが存在しない場合は作成
|
|
239
230
|
const outputDir = path.dirname(outputPath);
|
|
240
231
|
if (!fs.existsSync(outputDir)) {
|
|
241
232
|
fs.mkdirSync(outputDir, { recursive: true });
|
|
242
233
|
}
|
|
243
|
-
await
|
|
234
|
+
await marhupFile(inputPath, { output: outputPath });
|
|
244
235
|
return {
|
|
245
236
|
content: [
|
|
246
237
|
{
|
|
@@ -265,12 +256,12 @@ async function handleToolCall(name, args) {
|
|
|
265
256
|
}
|
|
266
257
|
}
|
|
267
258
|
catch (error) {
|
|
268
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
259
|
+
const errorMessage = error instanceof MarhupError ? error.toString() : (error instanceof Error ? error.message : String(error));
|
|
269
260
|
return {
|
|
270
261
|
content: [
|
|
271
262
|
{
|
|
272
263
|
type: 'text',
|
|
273
|
-
text:
|
|
264
|
+
text: t('errors.errorPrefix', { message: errorMessage }),
|
|
274
265
|
},
|
|
275
266
|
],
|
|
276
267
|
isError: true,
|
package/dist/mcp-handlers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-handlers.js","sourceRoot":"","sources":["../src/mcp-handlers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mcp-handlers.js","sourceRoot":"","sources":["../src/mcp-handlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,Y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AAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAChI,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,CAAC,CAAC,oBAAoB,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;iBACzD;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/mcp.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
2
|
/**
|
|
4
3
|
* marhup MCP Server
|
|
5
4
|
* Model Context Protocol サーバーとしてmarhup機能を提供
|
|
6
5
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const server = new index_js_1.Server({
|
|
6
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
7
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
8
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
9
|
+
import { getToolDefinitions, handleToolCall } from './mcp-handlers.js';
|
|
10
|
+
const server = new Server({
|
|
13
11
|
name: 'marhup',
|
|
14
12
|
version: '0.1.0',
|
|
15
13
|
}, {
|
|
@@ -18,22 +16,22 @@ const server = new index_js_1.Server({
|
|
|
18
16
|
},
|
|
19
17
|
});
|
|
20
18
|
// ツール一覧
|
|
21
|
-
server.setRequestHandler(
|
|
19
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
22
20
|
return {
|
|
23
|
-
tools:
|
|
21
|
+
tools: getToolDefinitions(),
|
|
24
22
|
};
|
|
25
23
|
});
|
|
26
24
|
// ツール実行
|
|
27
|
-
server.setRequestHandler(
|
|
25
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
28
26
|
const { name, arguments: args } = request.params;
|
|
29
|
-
const result = await
|
|
27
|
+
const result = await handleToolCall(name, args);
|
|
30
28
|
return {
|
|
31
29
|
...result,
|
|
32
30
|
};
|
|
33
31
|
});
|
|
34
32
|
// サーバー起動
|
|
35
33
|
async function main() {
|
|
36
|
-
const transport = new
|
|
34
|
+
const transport = new StdioServerTransport();
|
|
37
35
|
await server.connect(transport);
|
|
38
36
|
console.error('marhup MCP server started');
|
|
39
37
|
}
|
package/dist/mcp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":";AACA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEvE,MAAM,MAAM,GAAG,IAAI,MAAM,CACvB;IACE,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,OAAO;CACjB,EACD;IACE,YAAY,EAAE;QACZ,KAAK,EAAE,EAAE;KACV;CACF,CACF,CAAC;AAEF,QAAQ;AACR,MAAM,CAAC,iBAAiB,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE;IAC1D,OAAO;QACL,KAAK,EAAE,kBAAkB,EAAE;KAC5B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,QAAQ;AACR,MAAM,CAAC,iBAAiB,CAAC,qBAAqB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;IAChE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IACjD,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,IAAI,EAAE,IAA+B,CAAC,CAAC;IAC3E,OAAO;QACL,GAAG,MAAM;KACD,CAAC;AACb,CAAC,CAAC,CAAC;AAEH,SAAS;AACT,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;AAC7C,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../../src/parser/frontmatter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../../src/parser/frontmatter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAuD,MAAM,mBAAmB,CAAC;AAuI/G;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG;IACjD,WAAW,EAAE,gBAAgB,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;CACd,CAwCA;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAS/E"}
|
|
@@ -1,18 +1,93 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* YAML Front Matter パーサー
|
|
4
3
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
4
|
+
import YAML from 'yaml';
|
|
5
|
+
import { FrontmatterError } from '../errors.js';
|
|
6
|
+
/**
|
|
7
|
+
* Front Matterの構造を検証
|
|
8
|
+
*/
|
|
9
|
+
function validateFrontmatter(frontmatter) {
|
|
10
|
+
const validated = {};
|
|
11
|
+
for (const [key, value] of Object.entries(frontmatter)) {
|
|
12
|
+
switch (key) {
|
|
13
|
+
case 'title':
|
|
14
|
+
if (typeof value !== 'string') {
|
|
15
|
+
throw new FrontmatterError(`'title' must be a string, got ${typeof value}`, 'title', value, 'Use a string value for the title, e.g., title: "My Presentation"');
|
|
16
|
+
}
|
|
17
|
+
validated.title = value;
|
|
18
|
+
break;
|
|
19
|
+
case 'grid':
|
|
20
|
+
if (typeof value !== 'string') {
|
|
21
|
+
throw new FrontmatterError(`'grid' must be a string, got ${typeof value}`, 'grid', value, 'Use a grid size string like "12x9" or "16x10"');
|
|
22
|
+
}
|
|
23
|
+
validated.grid = value;
|
|
24
|
+
break;
|
|
25
|
+
case 'layout':
|
|
26
|
+
if (typeof value !== 'string') {
|
|
27
|
+
throw new FrontmatterError(`'layout' must be a string, got ${typeof value}`, 'layout', value, 'Use "auto" for automatic layout or "manual" for custom positioning');
|
|
28
|
+
}
|
|
29
|
+
validated.layout = value;
|
|
30
|
+
break;
|
|
31
|
+
case 'theme':
|
|
32
|
+
if (typeof value === 'string') {
|
|
33
|
+
validated.theme = value;
|
|
34
|
+
}
|
|
35
|
+
else if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
|
36
|
+
// Allow partial theme overrides
|
|
37
|
+
validated.theme = value;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
throw new FrontmatterError(`'theme' must be a string or an object, got ${typeof value}`, 'theme', value, 'Use a theme name like "default" or an object with theme properties');
|
|
41
|
+
}
|
|
42
|
+
break;
|
|
43
|
+
case 'classes':
|
|
44
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
45
|
+
throw new FrontmatterError(`'classes' must be an object, got ${typeof value}`, 'classes', value, 'Use an object with class names as keys and style objects as values');
|
|
46
|
+
}
|
|
47
|
+
for (const [className, classProps] of Object.entries(value)) {
|
|
48
|
+
if (typeof classProps !== 'object' || classProps === null || Array.isArray(classProps)) {
|
|
49
|
+
throw new FrontmatterError(`Class '${className}' must be an object, got ${typeof classProps}`, `classes.${className}`, classProps, 'Each class should be an object with CSS properties');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
validated.classes = value;
|
|
53
|
+
break;
|
|
54
|
+
case 'aliases':
|
|
55
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
56
|
+
throw new FrontmatterError(`'aliases' must be an object, got ${typeof value}`, 'aliases', value, 'Use an object with alias names as keys and grid positions as values');
|
|
57
|
+
}
|
|
58
|
+
for (const [aliasKey, aliasValue] of Object.entries(value)) {
|
|
59
|
+
if (typeof aliasValue !== 'string') {
|
|
60
|
+
throw new FrontmatterError(`Alias '${aliasKey}' must be a string, got ${typeof aliasValue}`, `aliases.${aliasKey}`, aliasValue, 'Each alias should be a grid position string like "[1-6,1-4]"');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
validated.aliases = value;
|
|
64
|
+
break;
|
|
65
|
+
case 'animations':
|
|
66
|
+
if (!Array.isArray(value)) {
|
|
67
|
+
throw new FrontmatterError(`'animations' must be an array, got ${typeof value}`, 'animations', value, 'Use an array of animation objects');
|
|
68
|
+
}
|
|
69
|
+
// Basic validation - more detailed validation can be added later
|
|
70
|
+
validated.animations = value;
|
|
71
|
+
break;
|
|
72
|
+
case 'transition':
|
|
73
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
74
|
+
throw new FrontmatterError(`'transition' must be an object, got ${typeof value}`, 'transition', value, 'Use an object with transition properties like { type: "fade", duration: 1, direction: "left" }');
|
|
75
|
+
}
|
|
76
|
+
// Basic validation - more detailed validation can be added later
|
|
77
|
+
validated.transition = value;
|
|
78
|
+
break;
|
|
79
|
+
default:
|
|
80
|
+
// その他のキーはそのまま
|
|
81
|
+
validated[key] = value;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return validated;
|
|
86
|
+
}
|
|
12
87
|
/**
|
|
13
88
|
* Front Matterを抽出してパース
|
|
14
89
|
*/
|
|
15
|
-
function parseFrontmatter(content) {
|
|
90
|
+
export function parseFrontmatter(content) {
|
|
16
91
|
const frontmatterRegex = /^---\s*\n([\s\S]*?)\n---\s*\n?/;
|
|
17
92
|
const match = content.match(frontmatterRegex);
|
|
18
93
|
if (!match) {
|
|
@@ -24,21 +99,25 @@ function parseFrontmatter(content) {
|
|
|
24
99
|
const yamlContent = match[1];
|
|
25
100
|
const body = content.slice(match[0].length);
|
|
26
101
|
try {
|
|
27
|
-
const
|
|
102
|
+
const parsed = YAML.parse(yamlContent) || {};
|
|
103
|
+
const frontmatter = validateFrontmatter(parsed);
|
|
28
104
|
return { frontmatter, body };
|
|
29
105
|
}
|
|
30
106
|
catch (error) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
107
|
+
if (error instanceof FrontmatterError) {
|
|
108
|
+
// Validation error - re-throw with file context
|
|
109
|
+
throw new FrontmatterError(error.message, error.code, undefined, 'Check your YAML syntax and ensure all values have correct types', undefined, // filePath will be added by caller
|
|
110
|
+
undefined // lineNumber
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
// YAML parsing error
|
|
114
|
+
throw new FrontmatterError(`Invalid YAML syntax: ${error instanceof Error ? error.message : 'Unknown YAML error'}`, undefined, undefined, 'Check your YAML syntax. Ensure proper indentation and valid YAML format.', undefined, undefined);
|
|
36
115
|
}
|
|
37
116
|
}
|
|
38
117
|
/**
|
|
39
118
|
* グリッド文字列をパース
|
|
40
119
|
*/
|
|
41
|
-
function parseGridString(gridStr) {
|
|
120
|
+
export function parseGridString(gridStr) {
|
|
42
121
|
const match = gridStr.match(/^(\d+)\s*x\s*(\d+)$/i);
|
|
43
122
|
if (!match) {
|
|
44
123
|
return { cols: 12, rows: 9 };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontmatter.js","sourceRoot":"","sources":["../../src/parser/frontmatter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"frontmatter.js","sourceRoot":"","sources":["../../src/parser/frontmatter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD;;GAEG;AACH,SAAS,mBAAmB,CAAC,WAAoC;IAC/D,MAAM,SAAS,GAAqB,EAAE,CAAC;IAEvC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;QACvD,QAAQ,GAAG,EAAE,CAAC;YACZ,KAAK,OAAO;gBACV,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;oBAC9B,MAAM,IAAI,gBAAgB,CACxB,iCAAiC,OAAO,KAAK,EAAE,EAC/C,OAAO,EACP,KAAK,EACL,kEAAkE,CACnE,CAAC;gBACJ,CAAC;gBACD,SAAS,CAAC,KAAK,GAAG,KAAK,CAAC;gBACxB,MAAM;YACR,KAAK,MAAM;gBACT,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;oBAC9B,MAAM,IAAI,gBAAgB,CACxB,gCAAgC,OAAO,KAAK,EAAE,EAC9C,MAAM,EACN,KAAK,EACL,+CAA+C,CAChD,CAAC;gBACJ,CAAC;gBACD,SAAS,CAAC,IAAI,GAAG,KAAK,CAAC;gB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qBAAqB;QACrB,MAAM,IAAI,gBAAgB,CACxB,wBAAwB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,oBAAoB,EAAE,EACvF,SAAS,EACT,SAAS,EACT,0EAA0E,EAC1E,SAAS,EACT,SAAS,CACV,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;IACpD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IAC/B,CAAC;IACD,OAAO;QACL,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QAC5B,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;KAC7B,CAAC;AACJ,CAAC"}
|
package/dist/parser/grid.d.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* グリッド記法パーサー
|
|
3
3
|
*/
|
|
4
|
-
import type { GridPosition, StyleOptions } from '../types/index';
|
|
5
|
-
|
|
6
|
-
* 行からグリッド位置を抽出
|
|
7
|
-
*/
|
|
8
|
-
export declare function extractGridPosition(text: string): {
|
|
4
|
+
import type { GridPosition, StyleOptions, AnimationConfig, GridConfig } from '../types/index.js';
|
|
5
|
+
export declare function extractGridPosition(text: string, aliases?: Record<string, string>, gridConfig?: GridConfig): {
|
|
9
6
|
position: GridPosition | undefined;
|
|
10
7
|
cleanText: string;
|
|
11
8
|
};
|
|
@@ -19,16 +16,17 @@ export declare function extractStyle(text: string): {
|
|
|
19
16
|
/**
|
|
20
17
|
* テキストからグリッド位置とスタイルを両方抽出
|
|
21
18
|
*/
|
|
22
|
-
export declare function extractGridAndStyle(text: string): {
|
|
19
|
+
export declare function extractGridAndStyle(text: string, aliases?: Record<string, string>, gridConfig?: GridConfig): {
|
|
23
20
|
position: GridPosition | undefined;
|
|
24
21
|
style: StyleOptions | undefined;
|
|
22
|
+
animation: AnimationConfig | undefined;
|
|
25
23
|
cleanText: string;
|
|
26
24
|
};
|
|
27
25
|
/**
|
|
28
26
|
* ブロックの開始行からグリッド位置を抽出(ブロック用)
|
|
29
27
|
* 例: "[1-6, 2-8]" で始まる行
|
|
30
28
|
*/
|
|
31
|
-
export declare function parseBlockGridLine(line: string): {
|
|
29
|
+
export declare function parseBlockGridLine(line: string, aliases?: Record<string, string>, gridConfig?: GridConfig): {
|
|
32
30
|
isGridBlock: boolean;
|
|
33
31
|
position: GridPosition | undefined;
|
|
34
32
|
style: StyleOptions | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../src/parser/grid.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../src/parser/grid.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AA0EjG,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,UAAU,CAAC,EAAE,UAAU,GAAG;IAC5G,QAAQ,EAAE,YAAY,GAAG,SAAS,CAAC;IACnC,SAAS,EAAE,MAAM,CAAC;CACnB,CAuCA;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG;IAC1C,KAAK,EAAE,YAAY,GAAG,SAAS,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;CACnB,CAyH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