spawn-term 0.1.31 → 0.1.33
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.
|
@@ -60,8 +60,12 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
60
60
|
}
|
|
61
61
|
return newObj;
|
|
62
62
|
}
|
|
63
|
-
var
|
|
64
|
-
var
|
|
63
|
+
var REGEX_NEW_LINE = /\r\n|[\n\v\f\r\x85\u2028\u2029]/g;
|
|
64
|
+
var REGEX_ANSI = (0, _ansiRegex.default)();
|
|
65
|
+
var DEFAULT_SUMMARY = {
|
|
66
|
+
type: _types.DataType.stdout,
|
|
67
|
+
text: ''
|
|
68
|
+
};
|
|
65
69
|
// From: https://github.com/sindresorhus/cli-spinners/blob/00de8fbeee16fa49502fa4f687449f70f2c8ca2c/spinners.json#L2
|
|
66
70
|
var spinner = {
|
|
67
71
|
interval: 80,
|
|
@@ -98,13 +102,13 @@ var Header = /*#__PURE__*/ (0, _react.memo)(function Header(param) {
|
|
|
98
102
|
}, function(a, b) {
|
|
99
103
|
return a.group === b.group && a.title === b.title && a.state === b.state;
|
|
100
104
|
});
|
|
101
|
-
var
|
|
102
|
-
var
|
|
105
|
+
var RunningSummary = /*#__PURE__*/ (0, _react.memo)(function RunningSummary(param) {
|
|
106
|
+
var line = param.line;
|
|
103
107
|
return /*#__PURE__*/ _react.default.createElement(_ink.Box, {
|
|
104
108
|
marginLeft: 2
|
|
105
109
|
}, /*#__PURE__*/ _react.default.createElement(_ink.Text, {
|
|
106
110
|
color: "gray"
|
|
107
|
-
},
|
|
111
|
+
}, line.text.replace(REGEX_ANSI, '')));
|
|
108
112
|
});
|
|
109
113
|
var Lines = /*#__PURE__*/ (0, _react.memo)(function Lines(param) {
|
|
110
114
|
var lines = param.lines;
|
|
@@ -122,6 +126,20 @@ var Lines = /*#__PURE__*/ (0, _react.memo)(function Lines(param) {
|
|
|
122
126
|
var Expanded = /*#__PURE__*/ (0, _react.memo)(function Expanded(param) {
|
|
123
127
|
var item = param.item;
|
|
124
128
|
var data = item.data;
|
|
129
|
+
var lines = (0, _react.useMemo)(function() {
|
|
130
|
+
var lines = [];
|
|
131
|
+
data.forEach(function(x) {
|
|
132
|
+
x.text.split(REGEX_NEW_LINE).forEach(function(text) {
|
|
133
|
+
return lines.push({
|
|
134
|
+
type: x.type,
|
|
135
|
+
text: text
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
return lines;
|
|
140
|
+
}, [
|
|
141
|
+
data
|
|
142
|
+
]);
|
|
125
143
|
return /*#__PURE__*/ _react.default.createElement(_ink.Box, {
|
|
126
144
|
flexDirection: "column"
|
|
127
145
|
}, /*#__PURE__*/ _react.default.createElement(Header, {
|
|
@@ -129,7 +147,7 @@ var Expanded = /*#__PURE__*/ (0, _react.memo)(function Expanded(param) {
|
|
|
129
147
|
title: item.title,
|
|
130
148
|
state: item.state
|
|
131
149
|
}), /*#__PURE__*/ _react.default.createElement(Lines, {
|
|
132
|
-
lines:
|
|
150
|
+
lines: lines
|
|
133
151
|
}));
|
|
134
152
|
});
|
|
135
153
|
var Contracted = /*#__PURE__*/ (0, _react.memo)(function Contracted(param) {
|
|
@@ -138,10 +156,10 @@ var Contracted = /*#__PURE__*/ (0, _react.memo)(function Contracted(param) {
|
|
|
138
156
|
var lines = (0, _react.useMemo)(function() {
|
|
139
157
|
var lines = [];
|
|
140
158
|
data.forEach(function(x) {
|
|
141
|
-
x.text.split(
|
|
159
|
+
x.text.split(REGEX_NEW_LINE).forEach(function(text) {
|
|
142
160
|
return lines.push({
|
|
143
161
|
type: x.type,
|
|
144
|
-
text: text
|
|
162
|
+
text: text
|
|
145
163
|
});
|
|
146
164
|
});
|
|
147
165
|
});
|
|
@@ -157,10 +175,10 @@ var Contracted = /*#__PURE__*/ (0, _react.memo)(function Contracted(param) {
|
|
|
157
175
|
}, [
|
|
158
176
|
lines
|
|
159
177
|
]);
|
|
160
|
-
var
|
|
178
|
+
var summary = (0, _react.useMemo)(function() {
|
|
161
179
|
return lines.filter(function(line) {
|
|
162
180
|
return line.text.length > 0 && errors.indexOf(line) < 0;
|
|
163
|
-
}).pop() ||
|
|
181
|
+
}).pop() || DEFAULT_SUMMARY;
|
|
164
182
|
}, [
|
|
165
183
|
lines,
|
|
166
184
|
errors
|
|
@@ -171,8 +189,8 @@ var Contracted = /*#__PURE__*/ (0, _react.memo)(function Contracted(param) {
|
|
|
171
189
|
group: item.group,
|
|
172
190
|
title: item.title,
|
|
173
191
|
state: item.state
|
|
174
|
-
}), state === 'running' && /*#__PURE__*/ _react.default.createElement(
|
|
175
|
-
|
|
192
|
+
}), state === 'running' && /*#__PURE__*/ _react.default.createElement(RunningSummary, {
|
|
193
|
+
line: summary
|
|
176
194
|
}), errors.length > 0 && /*#__PURE__*/ _react.default.createElement(Lines, {
|
|
177
195
|
lines: errors
|
|
178
196
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/ChildProcess.tsx"],"sourcesContent":["import React, { memo, useMemo } from 'react';\nimport { Box, Text
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/ChildProcess.tsx"],"sourcesContent":["import React, { memo, useMemo } from 'react';\nimport { Box, Text } from '../ink.mjs';\nimport ansiRegex from '../lib/ansiRegex';\nimport figures from '../lib/figures';\nimport Spinner from './Spinner';\n\nimport type { ChildProcess as ChildProcessT, Data, State } from '../types';\nimport { DataType } from '../types';\n\nconst REGEX_NEW_LINE = /\\r\\n|[\\n\\v\\f\\r\\x85\\u2028\\u2029]/g;\nconst REGEX_ANSI = ansiRegex();\nconst DEFAULT_SUMMARY = { type: DataType.stdout, text: '' };\n\ntype ItemProps = {\n item: ChildProcessT;\n};\n\n// From: https://github.com/sindresorhus/cli-spinners/blob/00de8fbeee16fa49502fa4f687449f70f2c8ca2c/spinners.json#L2\nconst spinner = {\n interval: 80,\n frames: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'],\n};\n\nconst ICONS = {\n error: <Text color=\"red\">{figures.cross}</Text>,\n success: <Text color=\"green\">{figures.tick}</Text>,\n running: <Spinner {...spinner} />,\n};\n\ntype HeaderProps = {\n group?: string;\n title: string;\n state: State;\n};\n\nconst Header = memo(\n function Header({ group, title, state }: HeaderProps) {\n const icon = ICONS[state];\n\n return (\n <Box>\n <Box marginRight={1}>{icon}</Box>\n {group && <Text bold>{`${group}${figures.pointer} `}</Text>}\n <Text>{title}</Text>\n </Box>\n );\n },\n (a, b) => a.group === b.group && a.title === b.title && a.state === b.state\n);\n\ntype RunningSummaryProps = {\n line: Data;\n};\n\nconst RunningSummary = memo(function RunningSummary({ line }: RunningSummaryProps) {\n return (\n <Box marginLeft={2}>\n <Text color=\"gray\">{line.text.replace(REGEX_ANSI, '')}</Text>\n </Box>\n );\n});\n\ntype LinesProps = {\n lines: Data[];\n};\n\nconst Lines = memo(function Lines({ lines }: LinesProps) {\n return (\n <Box flexDirection=\"column\" marginLeft={2}>\n {lines.map((line, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: <explanation>\n <Box key={index} flexDirection=\"column\">\n {/* @ts-ignore */}\n <ink-text>{line.text}</ink-text>\n </Box>\n ))}\n </Box>\n );\n});\n\nconst Expanded = memo(function Expanded({ item }: ItemProps) {\n const { data } = item;\n const lines = useMemo(() => {\n const lines = [];\n data.forEach((x) => {\n x.text.split(REGEX_NEW_LINE).forEach((text) => lines.push({ type: x.type, text }));\n });\n return lines;\n }, [data]) as Data[];\n\n return (\n <Box flexDirection=\"column\">\n <Header group={item.group} title={item.title} state={item.state} />\n <Lines lines={lines} />\n </Box>\n );\n});\n\nconst Contracted = memo(function Contracted({ item }: ItemProps) {\n const { state, data } = item;\n\n const lines = useMemo(() => {\n const lines = [];\n data.forEach((x) => {\n x.text.split(REGEX_NEW_LINE).forEach((text) => lines.push({ type: x.type, text }));\n });\n return lines;\n }, [data]);\n\n // remove ansi codes when displaying single lines\n const errors = useMemo(() => lines.filter((line) => line.type === DataType.stderr), [lines]);\n const summary = useMemo(() => lines.filter((line) => line.text.length > 0 && errors.indexOf(line) < 0).pop() || DEFAULT_SUMMARY, [lines, errors]);\n\n return (\n <Box flexDirection=\"column\">\n <Header group={item.group} title={item.title} state={item.state} />\n {state === 'running' && <RunningSummary line={summary} />}\n {errors.length > 0 && <Lines lines={errors} />}\n </Box>\n );\n});\n\nexport default memo(function ChildProcess({ item }: ItemProps) {\n const { expanded } = item;\n return expanded ? <Expanded item={item} /> : <Contracted item={item} />;\n});\n"],"names":["REGEX_NEW_LINE","REGEX_ANSI","ansiRegex","DEFAULT_SUMMARY","type","DataType","stdout","text","spinner","interval","frames","ICONS","error","Text","color","figures","cross","success","tick","running","Spinner","Header","memo","group","title","state","icon","Box","marginRight","bold","pointer","a","b","RunningSummary","line","marginLeft","replace","Lines","lines","flexDirection","map","index","key","ink-text","Expanded","item","data","useMemo","forEach","x","split","push","Contracted","errors","filter","stderr","summary","length","indexOf","pop","ChildProcess","expanded"],"mappings":";;;;+BA0HA;;;eAAA;;;6DA1HqC;mBACX;gEACJ;8DACF;8DACA;qBAGK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzB,IAAMA,iBAAiB;AACvB,IAAMC,aAAaC,IAAAA,kBAAS;AAC5B,IAAMC,kBAAkB;IAAEC,MAAMC,eAAQ,CAACC,MAAM;IAAEC,MAAM;AAAG;AAM1D,oHAAoH;AACpH,IAAMC,UAAU;IACdC,UAAU;IACVC,QAAQ;QAAC;QAAK;QAAK;QAAK;QAAK;QAAK;QAAK;QAAK;QAAK;QAAK;KAAI;AAC5D;AAEA,IAAMC,QAAQ;IACZC,qBAAO,6BAACC,SAAI;QAACC,OAAM;OAAOC,gBAAO,CAACC,KAAK;IACvCC,uBAAS,6BAACJ,SAAI;QAACC,OAAM;OAASC,gBAAO,CAACG,IAAI;IAC1CC,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AO;IAEhJ,qBACE,6BAAC1B,QAAG;QAACY,eAAc;qBACjB,6BAAClB;QAAOE,OAAOsB,KAAKtB,KAAK;QAAEC,OAAOqB,KAAKrB,KAAK;QAAEC,OAAOoB,KAAKpB,KAAK;QAC9DA,UAAU,2BAAa,6BAACQ;QAAeC,MAAMsB;QAC7CH,OAAOI,MAAM,GAAG,mBAAK,6BAACpB;QAAMC,OAAOe;;AAG1C;IAEA,yBAAe/B,IAAAA,WAAI,EAAC,SAASsC,aAAa,KAAmB;QAAnB,AAAEf,OAAF,MAAEA;IAC1C,IAAM,AAAEgB,WAAahB,KAAbgB;IACR,OAAOA,yBAAW,6BAACjB;QAASC,MAAMA;uBAAW,6BAACO;QAAWP,MAAMA;;AACjE"}
|
|
@@ -4,8 +4,12 @@ import ansiRegex from '../lib/ansiRegex.mjs';
|
|
|
4
4
|
import figures from '../lib/figures.mjs';
|
|
5
5
|
import Spinner from './Spinner.mjs';
|
|
6
6
|
import { DataType } from '../types.mjs';
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const REGEX_NEW_LINE = /\r\n|[\n\v\f\r\x85\u2028\u2029]/g;
|
|
8
|
+
const REGEX_ANSI = ansiRegex();
|
|
9
|
+
const DEFAULT_SUMMARY = {
|
|
10
|
+
type: DataType.stdout,
|
|
11
|
+
text: ''
|
|
12
|
+
};
|
|
9
13
|
// From: https://github.com/sindresorhus/cli-spinners/blob/00de8fbeee16fa49502fa4f687449f70f2c8ca2c/spinners.json#L2
|
|
10
14
|
const spinner = {
|
|
11
15
|
interval: 80,
|
|
@@ -39,12 +43,12 @@ const Header = /*#__PURE__*/ memo(function Header({ group, title, state }) {
|
|
|
39
43
|
bold: true
|
|
40
44
|
}, `${group}${figures.pointer} `), /*#__PURE__*/ React.createElement(Text, null, title));
|
|
41
45
|
}, (a, b)=>a.group === b.group && a.title === b.title && a.state === b.state);
|
|
42
|
-
const
|
|
46
|
+
const RunningSummary = /*#__PURE__*/ memo(function RunningSummary({ line }) {
|
|
43
47
|
return /*#__PURE__*/ React.createElement(Box, {
|
|
44
48
|
marginLeft: 2
|
|
45
49
|
}, /*#__PURE__*/ React.createElement(Text, {
|
|
46
50
|
color: "gray"
|
|
47
|
-
},
|
|
51
|
+
}, line.text.replace(REGEX_ANSI, '')));
|
|
48
52
|
});
|
|
49
53
|
const Lines = /*#__PURE__*/ memo(function Lines({ lines }) {
|
|
50
54
|
return /*#__PURE__*/ React.createElement(Box, {
|
|
@@ -58,6 +62,18 @@ const Lines = /*#__PURE__*/ memo(function Lines({ lines }) {
|
|
|
58
62
|
});
|
|
59
63
|
const Expanded = /*#__PURE__*/ memo(function Expanded({ item }) {
|
|
60
64
|
const { data } = item;
|
|
65
|
+
const lines = useMemo(()=>{
|
|
66
|
+
const lines = [];
|
|
67
|
+
data.forEach((x)=>{
|
|
68
|
+
x.text.split(REGEX_NEW_LINE).forEach((text)=>lines.push({
|
|
69
|
+
type: x.type,
|
|
70
|
+
text
|
|
71
|
+
}));
|
|
72
|
+
});
|
|
73
|
+
return lines;
|
|
74
|
+
}, [
|
|
75
|
+
data
|
|
76
|
+
]);
|
|
61
77
|
return /*#__PURE__*/ React.createElement(Box, {
|
|
62
78
|
flexDirection: "column"
|
|
63
79
|
}, /*#__PURE__*/ React.createElement(Header, {
|
|
@@ -65,7 +81,7 @@ const Expanded = /*#__PURE__*/ memo(function Expanded({ item }) {
|
|
|
65
81
|
title: item.title,
|
|
66
82
|
state: item.state
|
|
67
83
|
}), /*#__PURE__*/ React.createElement(Lines, {
|
|
68
|
-
lines:
|
|
84
|
+
lines: lines
|
|
69
85
|
}));
|
|
70
86
|
});
|
|
71
87
|
const Contracted = /*#__PURE__*/ memo(function Contracted({ item }) {
|
|
@@ -73,9 +89,9 @@ const Contracted = /*#__PURE__*/ memo(function Contracted({ item }) {
|
|
|
73
89
|
const lines = useMemo(()=>{
|
|
74
90
|
const lines = [];
|
|
75
91
|
data.forEach((x)=>{
|
|
76
|
-
x.text.split(
|
|
92
|
+
x.text.split(REGEX_NEW_LINE).forEach((text)=>lines.push({
|
|
77
93
|
type: x.type,
|
|
78
|
-
text
|
|
94
|
+
text
|
|
79
95
|
}));
|
|
80
96
|
});
|
|
81
97
|
return lines;
|
|
@@ -86,7 +102,7 @@ const Contracted = /*#__PURE__*/ memo(function Contracted({ item }) {
|
|
|
86
102
|
const errors = useMemo(()=>lines.filter((line)=>line.type === DataType.stderr), [
|
|
87
103
|
lines
|
|
88
104
|
]);
|
|
89
|
-
const
|
|
105
|
+
const summary = useMemo(()=>lines.filter((line)=>line.text.length > 0 && errors.indexOf(line) < 0).pop() || DEFAULT_SUMMARY, [
|
|
90
106
|
lines,
|
|
91
107
|
errors
|
|
92
108
|
]);
|
|
@@ -96,8 +112,8 @@ const Contracted = /*#__PURE__*/ memo(function Contracted({ item }) {
|
|
|
96
112
|
group: item.group,
|
|
97
113
|
title: item.title,
|
|
98
114
|
state: item.state
|
|
99
|
-
}), state === 'running' && /*#__PURE__*/ React.createElement(
|
|
100
|
-
|
|
115
|
+
}), state === 'running' && /*#__PURE__*/ React.createElement(RunningSummary, {
|
|
116
|
+
line: summary
|
|
101
117
|
}), errors.length > 0 && /*#__PURE__*/ React.createElement(Lines, {
|
|
102
118
|
lines: errors
|
|
103
119
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/ChildProcess.tsx"],"sourcesContent":["import React, { memo, useMemo } from 'react';\nimport { Box, Text
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/components/ChildProcess.tsx"],"sourcesContent":["import React, { memo, useMemo } from 'react';\nimport { Box, Text } from '../ink.mjs';\nimport ansiRegex from '../lib/ansiRegex';\nimport figures from '../lib/figures';\nimport Spinner from './Spinner';\n\nimport type { ChildProcess as ChildProcessT, Data, State } from '../types';\nimport { DataType } from '../types';\n\nconst REGEX_NEW_LINE = /\\r\\n|[\\n\\v\\f\\r\\x85\\u2028\\u2029]/g;\nconst REGEX_ANSI = ansiRegex();\nconst DEFAULT_SUMMARY = { type: DataType.stdout, text: '' };\n\ntype ItemProps = {\n item: ChildProcessT;\n};\n\n// From: https://github.com/sindresorhus/cli-spinners/blob/00de8fbeee16fa49502fa4f687449f70f2c8ca2c/spinners.json#L2\nconst spinner = {\n interval: 80,\n frames: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'],\n};\n\nconst ICONS = {\n error: <Text color=\"red\">{figures.cross}</Text>,\n success: <Text color=\"green\">{figures.tick}</Text>,\n running: <Spinner {...spinner} />,\n};\n\ntype HeaderProps = {\n group?: string;\n title: string;\n state: State;\n};\n\nconst Header = memo(\n function Header({ group, title, state }: HeaderProps) {\n const icon = ICONS[state];\n\n return (\n <Box>\n <Box marginRight={1}>{icon}</Box>\n {group && <Text bold>{`${group}${figures.pointer} `}</Text>}\n <Text>{title}</Text>\n </Box>\n );\n },\n (a, b) => a.group === b.group && a.title === b.title && a.state === b.state\n);\n\ntype RunningSummaryProps = {\n line: Data;\n};\n\nconst RunningSummary = memo(function RunningSummary({ line }: RunningSummaryProps) {\n return (\n <Box marginLeft={2}>\n <Text color=\"gray\">{line.text.replace(REGEX_ANSI, '')}</Text>\n </Box>\n );\n});\n\ntype LinesProps = {\n lines: Data[];\n};\n\nconst Lines = memo(function Lines({ lines }: LinesProps) {\n return (\n <Box flexDirection=\"column\" marginLeft={2}>\n {lines.map((line, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: <explanation>\n <Box key={index} flexDirection=\"column\">\n {/* @ts-ignore */}\n <ink-text>{line.text}</ink-text>\n </Box>\n ))}\n </Box>\n );\n});\n\nconst Expanded = memo(function Expanded({ item }: ItemProps) {\n const { data } = item;\n const lines = useMemo(() => {\n const lines = [];\n data.forEach((x) => {\n x.text.split(REGEX_NEW_LINE).forEach((text) => lines.push({ type: x.type, text }));\n });\n return lines;\n }, [data]) as Data[];\n\n return (\n <Box flexDirection=\"column\">\n <Header group={item.group} title={item.title} state={item.state} />\n <Lines lines={lines} />\n </Box>\n );\n});\n\nconst Contracted = memo(function Contracted({ item }: ItemProps) {\n const { state, data } = item;\n\n const lines = useMemo(() => {\n const lines = [];\n data.forEach((x) => {\n x.text.split(REGEX_NEW_LINE).forEach((text) => lines.push({ type: x.type, text }));\n });\n return lines;\n }, [data]);\n\n // remove ansi codes when displaying single lines\n const errors = useMemo(() => lines.filter((line) => line.type === DataType.stderr), [lines]);\n const summary = useMemo(() => lines.filter((line) => line.text.length > 0 && errors.indexOf(line) < 0).pop() || DEFAULT_SUMMARY, [lines, errors]);\n\n return (\n <Box flexDirection=\"column\">\n <Header group={item.group} title={item.title} state={item.state} />\n {state === 'running' && <RunningSummary line={summary} />}\n {errors.length > 0 && <Lines lines={errors} />}\n </Box>\n );\n});\n\nexport default memo(function ChildProcess({ item }: ItemProps) {\n const { expanded } = item;\n return expanded ? <Expanded item={item} /> : <Contracted item={item} />;\n});\n"],"names":["React","memo","useMemo","Box","Text","ansiRegex","figures","Spinner","DataType","REGEX_NEW_LINE","REGEX_ANSI","DEFAULT_SUMMARY","type","stdout","text","spinner","interval","frames","ICONS","error","color","cross","success","tick","running","Header","group","title","state","icon","marginRight","bold","pointer","a","b","RunningSummary","line","marginLeft","replace","Lines","lines","flexDirection","map","index","key","ink-text","Expanded","item","data","forEach","x","split","push","Contracted","errors","filter","stderr","summary","length","indexOf","pop","ChildProcess","expanded"],"mappings":"AAAA,OAAOA,SAASC,IAAI,EAAEC,OAAO,QAAQ,QAAQ;AAC7C,SAASC,GAAG,EAAEC,IAAI,QAAQ,aAAa;AACvC,OAAOC,eAAe,mBAAmB;AACzC,OAAOC,aAAa,iBAAiB;AACrC,OAAOC,aAAa,YAAY;AAGhC,SAASC,QAAQ,QAAQ,WAAW;AAEpC,MAAMC,iBAAiB;AACvB,MAAMC,aAAaL;AACnB,MAAMM,kBAAkB;IAAEC,MAAMJ,SAASK,MAAM;IAAEC,MAAM;AA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