n8n-nodes-k2think 0.1.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/LICENSE +5 -0
- package/README.md +41 -0
- package/dist/credentials/K2ThinkApi.credentials.d.ts +9 -0
- package/dist/credentials/K2ThinkApi.credentials.js +45 -0
- package/dist/credentials/K2ThinkApi.credentials.js.map +1 -0
- package/dist/nodes/K2Think/K2Think.node.d.ts +5 -0
- package/dist/nodes/K2Think/K2Think.node.js +171 -0
- package/dist/nodes/K2Think/K2Think.node.js.map +1 -0
- package/dist/nodes/K2Think/k2think.svg +4 -0
- package/index.js +3 -0
- package/package.json +61 -0
package/LICENSE
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# n8n-nodes-k2think
|
|
2
|
+
|
|
3
|
+
An [n8n](https://n8n.io) community node for **K2 Think V2** (MBZUAI-IFM) — the reasoning model served from the OpenAI-compatible gateway at `api.k2think.ai`.
|
|
4
|
+
|
|
5
|
+
This is an **action node**: drop it into any workflow to send a prompt to K2 Think and get the answer back. It handles the gateway's quirks for you:
|
|
6
|
+
|
|
7
|
+
- uses `max_completion_tokens` (not `max_tokens`)
|
|
8
|
+
- non-streaming
|
|
9
|
+
- automatically strips the `<think>…</think>` reasoning preamble (toggleable)
|
|
10
|
+
- adds token headroom so the reasoning never truncates the answer
|
|
11
|
+
|
|
12
|
+
> **Note on the AI Agent node:** n8n's "Chat Model" sub-nodes (the kind that plug into the AI Agent / Chains) are built on LangChain, which requires a runtime dependency and therefore cannot be verified for n8n Cloud. This package is a dependency-free action node so it *can* be verified and installed on Cloud. To use K2 Think as an Agent model on Cloud today, use the built-in **OpenAI Chat Model** node with a credential whose Base URL is `https://api.k2think.ai/v1`.
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
### n8n Cloud / Self-hosted UI
|
|
17
|
+
Settings → Community Nodes → Install → `n8n-nodes-k2think` (available after npm publish + n8n verification).
|
|
18
|
+
|
|
19
|
+
### Self-hosted (manual)
|
|
20
|
+
```bash
|
|
21
|
+
cd ~/.n8n/nodes
|
|
22
|
+
npm install n8n-nodes-k2think
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Credentials
|
|
26
|
+
|
|
27
|
+
Create a **K2 Think API** credential:
|
|
28
|
+
- **API Key** — your `api.k2think.ai` key
|
|
29
|
+
- **Base URL** — defaults to `https://api.k2think.ai/v1`
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
Add the **K2 Think** node, pick the credential, set:
|
|
34
|
+
- **Model** — `MBZUAI-IFM/K2-Think-v2`
|
|
35
|
+
- **Prompt** — your user message
|
|
36
|
+
- **System Prompt** (optional)
|
|
37
|
+
- **Options** — temperature, max completion tokens, reasoning headroom, strip `<think>`, output field, include raw
|
|
38
|
+
|
|
39
|
+
## License
|
|
40
|
+
|
|
41
|
+
MIT
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class K2ThinkApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
properties: INodeProperties[];
|
|
7
|
+
authenticate: IAuthenticateGeneric;
|
|
8
|
+
test: ICredentialTestRequest;
|
|
9
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.K2ThinkApi = void 0;
|
|
4
|
+
class K2ThinkApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'k2ThinkApi';
|
|
7
|
+
this.displayName = 'K2 Think API';
|
|
8
|
+
this.documentationUrl = 'https://ifm.ai/docs';
|
|
9
|
+
this.properties = [
|
|
10
|
+
{
|
|
11
|
+
displayName: 'API Key',
|
|
12
|
+
name: 'apiKey',
|
|
13
|
+
type: 'string',
|
|
14
|
+
typeOptions: { password: true },
|
|
15
|
+
default: '',
|
|
16
|
+
required: true,
|
|
17
|
+
description: 'Your K2 Think (api.k2think.ai) API key',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
displayName: 'Base URL',
|
|
21
|
+
name: 'baseUrl',
|
|
22
|
+
type: 'string',
|
|
23
|
+
default: 'https://api.k2think.ai/v1',
|
|
24
|
+
description: 'The OpenAI-compatible base URL for the K2 Think gateway',
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
this.authenticate = {
|
|
28
|
+
type: 'generic',
|
|
29
|
+
properties: {
|
|
30
|
+
headers: {
|
|
31
|
+
Authorization: '=Bearer {{$credentials.apiKey}}',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
this.test = {
|
|
36
|
+
request: {
|
|
37
|
+
baseURL: '={{$credentials.baseUrl}}',
|
|
38
|
+
url: '/models',
|
|
39
|
+
method: 'GET',
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.K2ThinkApi = K2ThinkApi;
|
|
45
|
+
//# sourceMappingURL=K2ThinkApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"K2ThinkApi.credentials.js","sourceRoot":"","sources":["../../credentials/K2ThinkApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,UAAU;IAAvB;QACC,SAAI,GAAG,YAAY,CAAC;QAEpB,gBAAW,GAAG,cAAc,CAAC;QAE7B,qBAAgB,GAAG,qBAAqB,CAAC;QAEzC,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,wCAAwC;aACrD;YACD;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,2BAA2B;gBACpC,WAAW,EAAE,yDAAyD;aACtE;SACD,CAAC;QAGF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,iCAAiC;iBAChD;aACD;SACD,CAAC;QAIF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,2BAA2B;gBACpC,GAAG,EAAE,SAAS;gBACd,MAAM,EAAE,KAAK;aACb;SACD,CAAC;IACH,CAAC;CAAA;AA7CD,gCA6CC"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.K2Think = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
class K2Think {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.description = {
|
|
8
|
+
displayName: 'K2 Think',
|
|
9
|
+
name: 'k2Think',
|
|
10
|
+
icon: 'file:k2think.svg',
|
|
11
|
+
group: ['transform'],
|
|
12
|
+
version: 1,
|
|
13
|
+
subtitle: '={{ "Chat: " + $parameter["model"] }}',
|
|
14
|
+
description: 'Call the K2 Think V2 reasoning model (MBZUAI-IFM)',
|
|
15
|
+
defaults: {
|
|
16
|
+
name: 'K2 Think',
|
|
17
|
+
},
|
|
18
|
+
inputs: ['main'],
|
|
19
|
+
outputs: ['main'],
|
|
20
|
+
credentials: [
|
|
21
|
+
{
|
|
22
|
+
name: 'k2ThinkApi',
|
|
23
|
+
required: true,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
properties: [
|
|
27
|
+
{
|
|
28
|
+
displayName: 'Model',
|
|
29
|
+
name: 'model',
|
|
30
|
+
type: 'string',
|
|
31
|
+
default: 'MBZUAI-IFM/K2-Think-v2',
|
|
32
|
+
required: true,
|
|
33
|
+
description: 'The model ID to send to the gateway',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
displayName: 'System Prompt',
|
|
37
|
+
name: 'systemPrompt',
|
|
38
|
+
type: 'string',
|
|
39
|
+
typeOptions: { rows: 2 },
|
|
40
|
+
default: '',
|
|
41
|
+
description: 'Optional system message prepended to the conversation',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
displayName: 'Prompt',
|
|
45
|
+
name: 'prompt',
|
|
46
|
+
type: 'string',
|
|
47
|
+
typeOptions: { rows: 4 },
|
|
48
|
+
default: '',
|
|
49
|
+
required: true,
|
|
50
|
+
description: 'The user message to send to K2 Think',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
displayName: 'Options',
|
|
54
|
+
name: 'options',
|
|
55
|
+
type: 'collection',
|
|
56
|
+
placeholder: 'Add Option',
|
|
57
|
+
default: {},
|
|
58
|
+
options: [
|
|
59
|
+
{
|
|
60
|
+
displayName: 'Include Full API Response',
|
|
61
|
+
name: 'includeRaw',
|
|
62
|
+
type: 'boolean',
|
|
63
|
+
default: false,
|
|
64
|
+
description: 'Whether to also include the raw API response under "raw"',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
displayName: 'Max Completion Tokens',
|
|
68
|
+
name: 'maxCompletionTokens',
|
|
69
|
+
type: 'number',
|
|
70
|
+
typeOptions: { minValue: 1 },
|
|
71
|
+
default: 1024,
|
|
72
|
+
description: 'Max tokens for the answer. The K2 gateway uses max_completion_tokens (not max_tokens). Headroom is added automatically for the reasoning preamble.',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
displayName: 'Put Output In Field',
|
|
76
|
+
name: 'outputField',
|
|
77
|
+
type: 'string',
|
|
78
|
+
default: 'response',
|
|
79
|
+
description: 'Name of the field to place the model response in',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
displayName: 'Reasoning Headroom',
|
|
83
|
+
name: 'reasoningHeadroom',
|
|
84
|
+
type: 'number',
|
|
85
|
+
typeOptions: { minValue: 0 },
|
|
86
|
+
default: 3500,
|
|
87
|
+
description: 'Extra tokens added on top of Max Completion Tokens so the long <think> preamble does not truncate the answer',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
displayName: 'Strip Think Reasoning',
|
|
91
|
+
name: 'stripThinking',
|
|
92
|
+
type: 'boolean',
|
|
93
|
+
default: true,
|
|
94
|
+
description: 'Whether to remove the <think>...</think> reasoning preamble from the output, keeping only the final answer',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
displayName: 'Temperature',
|
|
98
|
+
name: 'temperature',
|
|
99
|
+
type: 'number',
|
|
100
|
+
typeOptions: { minValue: 0, maxValue: 2, numberPrecision: 2 },
|
|
101
|
+
default: 0.7,
|
|
102
|
+
description: 'Sampling temperature (0 = deterministic)',
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
async execute() {
|
|
110
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
111
|
+
const items = this.getInputData();
|
|
112
|
+
const returnData = [];
|
|
113
|
+
for (let i = 0; i < items.length; i++) {
|
|
114
|
+
try {
|
|
115
|
+
const model = this.getNodeParameter('model', i);
|
|
116
|
+
const systemPrompt = this.getNodeParameter('systemPrompt', i, '');
|
|
117
|
+
const prompt = this.getNodeParameter('prompt', i);
|
|
118
|
+
const options = this.getNodeParameter('options', i, {});
|
|
119
|
+
if (!prompt) {
|
|
120
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Prompt is empty', {
|
|
121
|
+
itemIndex: i,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
const credentials = await this.getCredentials('k2ThinkApi');
|
|
125
|
+
const baseUrl = (credentials.baseUrl || 'https://api.k2think.ai/v1').replace(/\/+$/, '');
|
|
126
|
+
const messages = [];
|
|
127
|
+
if (systemPrompt)
|
|
128
|
+
messages.push({ role: 'system', content: systemPrompt });
|
|
129
|
+
messages.push({ role: 'user', content: prompt });
|
|
130
|
+
const maxCompletionTokens = ((_a = options.maxCompletionTokens) !== null && _a !== void 0 ? _a : 1024) + ((_b = options.reasoningHeadroom) !== null && _b !== void 0 ? _b : 3500);
|
|
131
|
+
const body = {
|
|
132
|
+
model,
|
|
133
|
+
messages,
|
|
134
|
+
temperature: (_c = options.temperature) !== null && _c !== void 0 ? _c : 0.7,
|
|
135
|
+
max_completion_tokens: maxCompletionTokens,
|
|
136
|
+
stream: false,
|
|
137
|
+
};
|
|
138
|
+
const response = (await this.helpers.httpRequestWithAuthentication.call(this, 'k2ThinkApi', {
|
|
139
|
+
method: 'POST',
|
|
140
|
+
url: `${baseUrl}/chat/completions`,
|
|
141
|
+
body,
|
|
142
|
+
json: true,
|
|
143
|
+
}));
|
|
144
|
+
let content = (_g = (_f = (_e = (_d = response.choices) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.message) === null || _f === void 0 ? void 0 : _f.content) !== null && _g !== void 0 ? _g : '';
|
|
145
|
+
if (options.stripThinking !== false) {
|
|
146
|
+
content = content.replace(/<think>[\s\S]*?<\/think>/gi, '').trim();
|
|
147
|
+
}
|
|
148
|
+
const outputField = options.outputField || 'response';
|
|
149
|
+
const json = { [outputField]: content };
|
|
150
|
+
if (options.includeRaw)
|
|
151
|
+
json.raw = response;
|
|
152
|
+
returnData.push({ json, pairedItem: { item: i } });
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
if (this.continueOnFail()) {
|
|
156
|
+
returnData.push({
|
|
157
|
+
json: { error: error.message },
|
|
158
|
+
pairedItem: { item: i },
|
|
159
|
+
});
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
if (error instanceof n8n_workflow_1.NodeOperationError)
|
|
163
|
+
throw error;
|
|
164
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return [returnData];
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
exports.K2Think = K2Think;
|
|
171
|
+
//# sourceMappingURL=K2Think.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"K2Think.node.js","sourceRoot":"","sources":["../../../nodes/K2Think/K2Think.node.ts"],"names":[],"mappings":";;;AAAA,+CASsB;AAEtB,MAAa,OAAO;IAApB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,UAAU;YACvB,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,kBAAkB;YACxB,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,uCAAuC;YACjD,WAAW,EAAE,mDAAmD;YAChE,QAAQ,EAAE;gBACT,IAAI,EAAE,UAAU;aAChB;YACD,MAAM,EAAE,CAAC,MAAM,CAAC;YAChB,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,YAAY;oBAClB,QAAQ,EAAE,IAAI;iBACd;aACD;YACD,UAAU,EAAE;gBACX;oBACC,WAAW,EAAE,OAAO;oBACpB,IAAI,EAAE,OAAO;oBACb,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,wBAAwB;oBACjC,QAAQ,EAAE,IAAI;oBACd,WAAW,EAAE,qCAAqC;iBAClD;gBACD;oBACC,WAAW,EAAE,eAAe;oBAC5B,IAAI,EAAE,cAAc;oBACpB,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;oBACxB,OAAO,EAAE,EAAE;oBACX,WAAW,EAAE,uDAAuD;iBACpE;gBACD;oBACC,WAAW,EAAE,QAAQ;oBACrB,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;oBACxB,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CAAC,EAAE,EAAE,CAAC,CAAC;YACpD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBAC3B,UAAU,CAAC,IAAI,CAAC;wBACf,IAAI,EAAE,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE;wBACzC,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;qBACvB,CAAC,CAAC;oBACH,SAAS;gBACV,CAAC;gBACD,IAAI,KAAK,YAAY,iCAAkB;oBAAE,MAAM,KAAK,CAAC;gBACrD,MAAM,IAAI,2BAAY,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAmB,CAAC,CAAC;YAC7D,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AA/LD,0BA+LC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 60" width="60" height="60">
|
|
2
|
+
<rect width="60" height="60" rx="12" fill="#0B5FFF"/>
|
|
3
|
+
<text x="30" y="39" font-family="Arial, Helvetica, sans-serif" font-size="26" font-weight="700" fill="#ffffff" text-anchor="middle">K2</text>
|
|
4
|
+
</svg>
|
package/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "n8n-nodes-k2think",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "n8n community node for the K2 Think V2 reasoning model (MBZUAI-IFM), OpenAI-compatible gateway at api.k2think.ai",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"n8n-community-node-package",
|
|
7
|
+
"n8n",
|
|
8
|
+
"k2think",
|
|
9
|
+
"k2-think",
|
|
10
|
+
"mbzuai",
|
|
11
|
+
"llm",
|
|
12
|
+
"ai"
|
|
13
|
+
],
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"homepage": "https://ifm.ai",
|
|
16
|
+
"author": {
|
|
17
|
+
"name": "MBZUAI IFM Community",
|
|
18
|
+
"email": "contactmalekchat@gmail.com"
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/MBZUAI-IFM/n8n-nodes-k2think.git"
|
|
23
|
+
},
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=20.15"
|
|
26
|
+
},
|
|
27
|
+
"main": "index.js",
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "npx rimraf dist && tsc && gulp build:icons",
|
|
30
|
+
"dev": "tsc --watch",
|
|
31
|
+
"format": "prettier nodes credentials --write",
|
|
32
|
+
"lint": "eslint nodes credentials package.json",
|
|
33
|
+
"lintfix": "eslint nodes credentials package.json --fix",
|
|
34
|
+
"prepublishOnly": "npm run build && npm run lint"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist"
|
|
38
|
+
],
|
|
39
|
+
"n8n": {
|
|
40
|
+
"n8nNodesApiVersion": 1,
|
|
41
|
+
"credentials": [
|
|
42
|
+
"dist/credentials/K2ThinkApi.credentials.js"
|
|
43
|
+
],
|
|
44
|
+
"nodes": [
|
|
45
|
+
"dist/nodes/K2Think/K2Think.node.js"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@typescript-eslint/parser": "~8.32.0",
|
|
50
|
+
"eslint": "^8.57.0",
|
|
51
|
+
"eslint-plugin-n8n-nodes-base": "^1.16.3",
|
|
52
|
+
"gulp": "^5.0.0",
|
|
53
|
+
"n8n-workflow": "*",
|
|
54
|
+
"prettier": "^3.5.3",
|
|
55
|
+
"rimraf": "^5.0.5",
|
|
56
|
+
"typescript": "^5.8.2"
|
|
57
|
+
},
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"n8n-workflow": "*"
|
|
60
|
+
}
|
|
61
|
+
}
|