@gui-chat-plugin/mindmap 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/react.js CHANGED
@@ -1,404 +1,307 @@
1
+ import { n as e, t } from "./chunk-vKJrgz-R.js";
2
+ import { a as n, i as r, n as i, o as a, r as o, t as s } from "./samples-Dy-Tx8gM.js";
1
3
  /* empty css */
2
- import { TOOL_NAME as re, samples as te, pluginCore as ne } from "./core.js";
3
- import { SYSTEM_PROMPT as ge, TOOL_DEFINITION as Re, executeMindMap as je } from "./core.js";
4
- import ae, { useState as se, useEffect as oe } from "react";
5
- var b = { exports: {} }, h = {};
6
- /**
7
- * @license React
8
- * react-jsx-runtime.production.js
9
- *
10
- * Copyright (c) Meta Platforms, Inc. and affiliates.
11
- *
12
- * This source code is licensed under the MIT license found in the
13
- * LICENSE file in the root directory of this source tree.
14
- */
15
- var M;
16
- function ie() {
17
- if (M) return h;
18
- M = 1;
19
- var n = Symbol.for("react.transitional.element"), a = Symbol.for("react.fragment");
20
- function u(x, f, d) {
21
- var t = null;
22
- if (d !== void 0 && (t = "" + d), f.key !== void 0 && (t = "" + f.key), "key" in f) {
23
- d = {};
24
- for (var i in f)
25
- i !== "key" && (d[i] = f[i]);
26
- } else d = f;
27
- return f = d.ref, {
28
- $$typeof: n,
29
- type: x,
30
- key: t,
31
- ref: f !== void 0 ? f : null,
32
- props: d
33
- };
34
- }
35
- return h.Fragment = a, h.jsx = u, h.jsxs = u, h;
4
+ import { useEffect as c, useState as l } from "react";
5
+ //#region node_modules/react/cjs/react-jsx-runtime.production.js
6
+ var u = /* @__PURE__ */ t(((e) => {
7
+ var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
8
+ function r(e, n, r) {
9
+ var i = null;
10
+ if (r !== void 0 && (i = "" + r), n.key !== void 0 && (i = "" + n.key), "key" in n) for (var a in r = {}, n) a !== "key" && (r[a] = n[a]);
11
+ else r = n;
12
+ return n = r.ref, {
13
+ $$typeof: t,
14
+ type: e,
15
+ key: i,
16
+ ref: n === void 0 ? null : n,
17
+ props: r
18
+ };
19
+ }
20
+ e.Fragment = n, e.jsx = r, e.jsxs = r;
21
+ })), d = /* @__PURE__ */ t(((t) => {
22
+ process.env.NODE_ENV !== "production" && (function() {
23
+ function n(e) {
24
+ if (e == null) return null;
25
+ if (typeof e == "function") return e.$$typeof === k ? null : e.displayName || e.name || null;
26
+ if (typeof e == "string") return e;
27
+ switch (e) {
28
+ case v: return "Fragment";
29
+ case b: return "Profiler";
30
+ case y: return "StrictMode";
31
+ case w: return "Suspense";
32
+ case T: return "SuspenseList";
33
+ case O: return "Activity";
34
+ }
35
+ if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
36
+ case _: return "Portal";
37
+ case S: return e.displayName || "Context";
38
+ case x: return (e._context.displayName || "Context") + ".Consumer";
39
+ case C:
40
+ var t = e.render;
41
+ return e = e.displayName, e ||= (e = t.displayName || t.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
42
+ case E: return t = e.displayName || null, t === null ? n(e.type) || "Memo" : t;
43
+ case D:
44
+ t = e._payload, e = e._init;
45
+ try {
46
+ return n(e(t));
47
+ } catch {}
48
+ }
49
+ return null;
50
+ }
51
+ function r(e) {
52
+ return "" + e;
53
+ }
54
+ function i(e) {
55
+ try {
56
+ r(e);
57
+ var t = !1;
58
+ } catch {
59
+ t = !0;
60
+ }
61
+ if (t) {
62
+ t = console;
63
+ var n = t.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
64
+ return n.call(t, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", i), r(e);
65
+ }
66
+ }
67
+ function a(e) {
68
+ if (e === v) return "<>";
69
+ if (typeof e == "object" && e && e.$$typeof === D) return "<...>";
70
+ try {
71
+ var t = n(e);
72
+ return t ? "<" + t + ">" : "<...>";
73
+ } catch {
74
+ return "<...>";
75
+ }
76
+ }
77
+ function o() {
78
+ var e = A.A;
79
+ return e === null ? null : e.getOwner();
80
+ }
81
+ function s() {
82
+ return Error("react-stack-top-frame");
83
+ }
84
+ function c(e) {
85
+ if (j.call(e, "key")) {
86
+ var t = Object.getOwnPropertyDescriptor(e, "key").get;
87
+ if (t && t.isReactWarning) return !1;
88
+ }
89
+ return e.key !== void 0;
90
+ }
91
+ function l(e, t) {
92
+ function n() {
93
+ P || (P = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", t));
94
+ }
95
+ n.isReactWarning = !0, Object.defineProperty(e, "key", {
96
+ get: n,
97
+ configurable: !0
98
+ });
99
+ }
100
+ function u() {
101
+ var e = n(this.type);
102
+ return F[e] || (F[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
103
+ }
104
+ function d(e, t, n, r, i, a) {
105
+ var o = n.ref;
106
+ return e = {
107
+ $$typeof: g,
108
+ type: e,
109
+ key: t,
110
+ props: n,
111
+ _owner: r
112
+ }, (o === void 0 ? null : o) === null ? Object.defineProperty(e, "ref", {
113
+ enumerable: !1,
114
+ value: null
115
+ }) : Object.defineProperty(e, "ref", {
116
+ enumerable: !1,
117
+ get: u
118
+ }), e._store = {}, Object.defineProperty(e._store, "validated", {
119
+ configurable: !1,
120
+ enumerable: !1,
121
+ writable: !0,
122
+ value: 0
123
+ }), Object.defineProperty(e, "_debugInfo", {
124
+ configurable: !1,
125
+ enumerable: !1,
126
+ writable: !0,
127
+ value: null
128
+ }), Object.defineProperty(e, "_debugStack", {
129
+ configurable: !1,
130
+ enumerable: !1,
131
+ writable: !0,
132
+ value: i
133
+ }), Object.defineProperty(e, "_debugTask", {
134
+ configurable: !1,
135
+ enumerable: !1,
136
+ writable: !0,
137
+ value: a
138
+ }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
139
+ }
140
+ function f(e, t, r, a, s, u) {
141
+ var f = t.children;
142
+ if (f !== void 0) if (a) if (M(f)) {
143
+ for (a = 0; a < f.length; a++) p(f[a]);
144
+ Object.freeze && Object.freeze(f);
145
+ } else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
146
+ else p(f);
147
+ if (j.call(t, "key")) {
148
+ f = n(e);
149
+ var m = Object.keys(t).filter(function(e) {
150
+ return e !== "key";
151
+ });
152
+ a = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", R[f + a] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", a, f, m, f), R[f + a] = !0);
153
+ }
154
+ if (f = null, r !== void 0 && (i(r), f = "" + r), c(t) && (i(t.key), f = "" + t.key), "key" in t) for (var h in r = {}, t) h !== "key" && (r[h] = t[h]);
155
+ else r = t;
156
+ return f && l(r, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), d(e, f, r, o(), s, u);
157
+ }
158
+ function p(e) {
159
+ m(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === D && (e._payload.status === "fulfilled" ? m(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
160
+ }
161
+ function m(e) {
162
+ return typeof e == "object" && !!e && e.$$typeof === g;
163
+ }
164
+ var h = e("react"), g = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), b = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), S = Symbol.for("react.context"), C = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), k = Symbol.for("react.client.reference"), A = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, j = Object.prototype.hasOwnProperty, M = Array.isArray, N = console.createTask ? console.createTask : function() {
165
+ return null;
166
+ };
167
+ h = { react_stack_bottom_frame: function(e) {
168
+ return e();
169
+ } };
170
+ var P, F = {}, I = h.react_stack_bottom_frame.bind(h, s)(), L = N(a(s)), R = {};
171
+ t.Fragment = v, t.jsx = function(e, t, n) {
172
+ var r = 1e4 > A.recentlyCreatedOwnerStacks++;
173
+ return f(e, t, n, !1, r ? Error("react-stack-top-frame") : I, r ? N(a(e)) : L);
174
+ }, t.jsxs = function(e, t, n) {
175
+ var r = 1e4 > A.recentlyCreatedOwnerStacks++;
176
+ return f(e, t, n, !0, r ? Error("react-stack-top-frame") : I, r ? N(a(e)) : L);
177
+ };
178
+ })();
179
+ })), f = (/* @__PURE__ */ t(((e, t) => {
180
+ process.env.NODE_ENV === "production" ? t.exports = u() : t.exports = d();
181
+ })))(), p = 800, m = 600;
182
+ function h(e) {
183
+ return Math.max(80, e.length * 8 + 40);
36
184
  }
37
- var E = {};
38
- /**
39
- * @license React
40
- * react-jsx-runtime.development.js
41
- *
42
- * Copyright (c) Meta Platforms, Inc. and affiliates.
43
- *
44
- * This source code is licensed under the MIT license found in the
45
- * LICENSE file in the root directory of this source tree.
46
- */
47
- var W;
48
- function le() {
49
- return W || (W = 1, process.env.NODE_ENV !== "production" && (function() {
50
- function n(e) {
51
- if (e == null) return null;
52
- if (typeof e == "function")
53
- return e.$$typeof === Q ? null : e.displayName || e.name || null;
54
- if (typeof e == "string") return e;
55
- switch (e) {
56
- case T:
57
- return "Fragment";
58
- case U:
59
- return "Profiler";
60
- case V:
61
- return "StrictMode";
62
- case G:
63
- return "Suspense";
64
- case X:
65
- return "SuspenseList";
66
- case Z:
67
- return "Activity";
68
- }
69
- if (typeof e == "object")
70
- switch (typeof e.tag == "number" && console.error(
71
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
72
- ), e.$$typeof) {
73
- case L:
74
- return "Portal";
75
- case J:
76
- return e.displayName || "Context";
77
- case q:
78
- return (e._context.displayName || "Context") + ".Consumer";
79
- case B:
80
- var r = e.render;
81
- return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
82
- case H:
83
- return r = e.displayName || null, r !== null ? r : n(e.type) || "Memo";
84
- case g:
85
- r = e._payload, e = e._init;
86
- try {
87
- return n(e(r));
88
- } catch {
89
- }
90
- }
91
- return null;
92
- }
93
- function a(e) {
94
- return "" + e;
95
- }
96
- function u(e) {
97
- try {
98
- a(e);
99
- var r = !1;
100
- } catch {
101
- r = !0;
102
- }
103
- if (r) {
104
- r = console;
105
- var s = r.error, l = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
106
- return s.call(
107
- r,
108
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
109
- l
110
- ), a(e);
111
- }
112
- }
113
- function x(e) {
114
- if (e === T) return "<>";
115
- if (typeof e == "object" && e !== null && e.$$typeof === g)
116
- return "<...>";
117
- try {
118
- var r = n(e);
119
- return r ? "<" + r + ">" : "<...>";
120
- } catch {
121
- return "<...>";
122
- }
123
- }
124
- function f() {
125
- var e = R.A;
126
- return e === null ? null : e.getOwner();
127
- }
128
- function d() {
129
- return Error("react-stack-top-frame");
130
- }
131
- function t(e) {
132
- if (P.call(e, "key")) {
133
- var r = Object.getOwnPropertyDescriptor(e, "key").get;
134
- if (r && r.isReactWarning) return !1;
135
- }
136
- return e.key !== void 0;
137
- }
138
- function i(e, r) {
139
- function s() {
140
- S || (S = !0, console.error(
141
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
142
- r
143
- ));
144
- }
145
- s.isReactWarning = !0, Object.defineProperty(e, "key", {
146
- get: s,
147
- configurable: !0
148
- });
149
- }
150
- function m() {
151
- var e = n(this.type);
152
- return C[e] || (C[e] = !0, console.error(
153
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
154
- )), e = this.props.ref, e !== void 0 ? e : null;
155
- }
156
- function z(e, r, s, l, v, y) {
157
- var c = s.ref;
158
- return e = {
159
- $$typeof: N,
160
- type: e,
161
- key: r,
162
- props: s,
163
- _owner: l
164
- }, (c !== void 0 ? c : null) !== null ? Object.defineProperty(e, "ref", {
165
- enumerable: !1,
166
- get: m
167
- }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
168
- configurable: !1,
169
- enumerable: !1,
170
- writable: !0,
171
- value: 0
172
- }), Object.defineProperty(e, "_debugInfo", {
173
- configurable: !1,
174
- enumerable: !1,
175
- writable: !0,
176
- value: null
177
- }), Object.defineProperty(e, "_debugStack", {
178
- configurable: !1,
179
- enumerable: !1,
180
- writable: !0,
181
- value: v
182
- }), Object.defineProperty(e, "_debugTask", {
183
- configurable: !1,
184
- enumerable: !1,
185
- writable: !0,
186
- value: y
187
- }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
188
- }
189
- function w(e, r, s, l, v, y) {
190
- var c = r.children;
191
- if (c !== void 0)
192
- if (l)
193
- if (K(c)) {
194
- for (l = 0; l < c.length; l++)
195
- O(c[l]);
196
- Object.freeze && Object.freeze(c);
197
- } else
198
- console.error(
199
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
200
- );
201
- else O(c);
202
- if (P.call(r, "key")) {
203
- c = n(e);
204
- var p = Object.keys(r).filter(function(ee) {
205
- return ee !== "key";
206
- });
207
- l = 0 < p.length ? "{key: someKey, " + p.join(": ..., ") + ": ...}" : "{key: someKey}", Y[c + l] || (p = 0 < p.length ? "{" + p.join(": ..., ") + ": ...}" : "{}", console.error(
208
- `A props object containing a "key" prop is being spread into JSX:
209
- let props = %s;
210
- <%s {...props} />
211
- React keys must be passed directly to JSX without using spread:
212
- let props = %s;
213
- <%s key={someKey} {...props} />`,
214
- l,
215
- c,
216
- p,
217
- c
218
- ), Y[c + l] = !0);
219
- }
220
- if (c = null, s !== void 0 && (u(s), c = "" + s), t(r) && (u(r.key), c = "" + r.key), "key" in r) {
221
- s = {};
222
- for (var k in r)
223
- k !== "key" && (s[k] = r[k]);
224
- } else s = r;
225
- return c && i(
226
- s,
227
- typeof e == "function" ? e.displayName || e.name || "Unknown" : e
228
- ), z(
229
- e,
230
- c,
231
- s,
232
- f(),
233
- v,
234
- y
235
- );
236
- }
237
- function O(e) {
238
- A(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === g && (e._payload.status === "fulfilled" ? A(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
239
- }
240
- function A(e) {
241
- return typeof e == "object" && e !== null && e.$$typeof === N;
242
- }
243
- var _ = ae, N = Symbol.for("react.transitional.element"), L = Symbol.for("react.portal"), T = Symbol.for("react.fragment"), V = Symbol.for("react.strict_mode"), U = Symbol.for("react.profiler"), q = Symbol.for("react.consumer"), J = Symbol.for("react.context"), B = Symbol.for("react.forward_ref"), G = Symbol.for("react.suspense"), X = Symbol.for("react.suspense_list"), H = Symbol.for("react.memo"), g = Symbol.for("react.lazy"), Z = Symbol.for("react.activity"), Q = Symbol.for("react.client.reference"), R = _.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, P = Object.prototype.hasOwnProperty, K = Array.isArray, j = console.createTask ? console.createTask : function() {
244
- return null;
245
- };
246
- _ = {
247
- react_stack_bottom_frame: function(e) {
248
- return e();
249
- }
250
- };
251
- var S, C = {}, $ = _.react_stack_bottom_frame.bind(
252
- _,
253
- d
254
- )(), I = j(x(d)), Y = {};
255
- E.Fragment = T, E.jsx = function(e, r, s) {
256
- var l = 1e4 > R.recentlyCreatedOwnerStacks++;
257
- return w(
258
- e,
259
- r,
260
- s,
261
- !1,
262
- l ? Error("react-stack-top-frame") : $,
263
- l ? j(x(e)) : I
264
- );
265
- }, E.jsxs = function(e, r, s) {
266
- var l = 1e4 > R.recentlyCreatedOwnerStacks++;
267
- return w(
268
- e,
269
- r,
270
- s,
271
- !0,
272
- l ? Error("react-stack-top-frame") : $,
273
- l ? j(x(e)) : I
274
- );
275
- };
276
- })()), E;
185
+ function g(e, t) {
186
+ return e.length <= t ? e : e.slice(0, t - 3) + "...";
277
187
  }
278
- var D;
279
- function ce() {
280
- return D || (D = 1, process.env.NODE_ENV === "production" ? b.exports = ie() : b.exports = le()), b.exports;
188
+ function _({ selectedResult: e, sendTextMessage: t }) {
189
+ let [n, r] = l(null);
190
+ c(() => {
191
+ e?.toolName === "createMindMap" && e.data && r(e.data);
192
+ }, [e]);
193
+ let i = (e) => n?.nodes.find((t) => t.id === e), a = (e) => {
194
+ t && t(`I want to expand the "${e.text}" branch. Add related sub-ideas.`);
195
+ };
196
+ return n ? /* @__PURE__ */ (0, f.jsx)("div", {
197
+ className: "size-full bg-gray-50 overflow-hidden",
198
+ children: /* @__PURE__ */ (0, f.jsxs)("div", {
199
+ className: "size-full relative",
200
+ children: [
201
+ /* @__PURE__ */ (0, f.jsx)("div", {
202
+ className: "absolute top-4 left-4 z-10",
203
+ children: /* @__PURE__ */ (0, f.jsx)("h2", {
204
+ className: "text-xl font-bold text-gray-800 bg-white/80 px-3 py-1 rounded-lg shadow",
205
+ children: n.title
206
+ })
207
+ }),
208
+ /* @__PURE__ */ (0, f.jsxs)("svg", {
209
+ className: "size-full",
210
+ viewBox: `0 0 ${p} ${m}`,
211
+ preserveAspectRatio: "xMidYMid meet",
212
+ children: [/* @__PURE__ */ (0, f.jsx)("g", {
213
+ className: "connections",
214
+ children: n.connections.map((e) => {
215
+ let t = i(e.from), n = i(e.to);
216
+ return /* @__PURE__ */ (0, f.jsxs)("g", { children: [/* @__PURE__ */ (0, f.jsx)("line", {
217
+ x1: t?.x || 0,
218
+ y1: t?.y || 0,
219
+ x2: n?.x || 0,
220
+ y2: n?.y || 0,
221
+ stroke: "#94A3B8",
222
+ strokeWidth: "2",
223
+ className: "transition-all duration-300"
224
+ }), e.label && /* @__PURE__ */ (0, f.jsx)("text", {
225
+ x: ((t?.x || 0) + (n?.x || 0)) / 2,
226
+ y: ((t?.y || 0) + (n?.y || 0)) / 2 - 5,
227
+ textAnchor: "middle",
228
+ className: "text-xs fill-gray-500",
229
+ children: e.label
230
+ })] }, `${e.from}-${e.to}`);
231
+ })
232
+ }), /* @__PURE__ */ (0, f.jsx)("g", {
233
+ className: "nodes",
234
+ children: n.nodes.map((e) => /* @__PURE__ */ (0, f.jsxs)("g", {
235
+ transform: `translate(${e.x}, ${e.y})`,
236
+ className: "cursor-pointer transition-transform duration-200 hover:scale-110",
237
+ onClick: () => a(e),
238
+ children: [/* @__PURE__ */ (0, f.jsx)("rect", {
239
+ x: -h(e.text) / 2,
240
+ y: -20,
241
+ width: h(e.text),
242
+ height: 40,
243
+ rx: 20,
244
+ fill: e.color || "#4F46E5",
245
+ className: "drop-shadow-md"
246
+ }), /* @__PURE__ */ (0, f.jsx)("text", {
247
+ textAnchor: "middle",
248
+ dominantBaseline: "middle",
249
+ fill: "white",
250
+ className: "text-sm font-medium select-none pointer-events-none",
251
+ children: g(e.text, 20)
252
+ })]
253
+ }, e.id))
254
+ })]
255
+ }),
256
+ /* @__PURE__ */ (0, f.jsx)("div", {
257
+ className: "absolute bottom-4 left-4 right-4 text-center",
258
+ children: /* @__PURE__ */ (0, f.jsx)("p", {
259
+ className: "text-sm text-gray-500 bg-white/80 px-3 py-2 rounded-lg inline-block",
260
+ children: "Click a node to expand it with new ideas"
261
+ })
262
+ })
263
+ ]
264
+ })
265
+ }) : /* @__PURE__ */ (0, f.jsx)("div", {
266
+ className: "size-full flex items-center justify-center",
267
+ children: /* @__PURE__ */ (0, f.jsx)("p", {
268
+ className: "text-gray-400",
269
+ children: "No mind map data"
270
+ })
271
+ });
281
272
  }
282
- var o = ce();
283
- const ue = 800, fe = 600;
284
- function F(n) {
285
- return Math.max(80, n.length * 8 + 40);
273
+ //#endregion
274
+ //#region src/react/Preview.tsx
275
+ function v({ result: e }) {
276
+ let t = e.data, n = t?.nodes && t.nodes.length > 0, r = t?.title || "Mind Map", i = t?.nodes?.length || 0;
277
+ return /* @__PURE__ */ (0, f.jsxs)("div", {
278
+ className: "p-3 bg-indigo-50 rounded-lg text-center",
279
+ children: [
280
+ /* @__PURE__ */ (0, f.jsx)("div", {
281
+ className: "text-2xl mb-1",
282
+ children: "🧠"
283
+ }),
284
+ /* @__PURE__ */ (0, f.jsx)("div", {
285
+ className: "text-indigo-700 font-medium text-sm truncate",
286
+ children: r
287
+ }),
288
+ n ? /* @__PURE__ */ (0, f.jsxs)("div", {
289
+ className: "text-xs text-gray-500 mt-1",
290
+ children: [i, " ideas"]
291
+ }) : /* @__PURE__ */ (0, f.jsx)("div", {
292
+ className: "text-xs text-amber-600 mt-1",
293
+ children: e.message || "No data"
294
+ })
295
+ ]
296
+ });
286
297
  }
287
- function de(n, a) {
288
- return n.length <= a ? n : n.slice(0, a - 3) + "...";
289
- }
290
- function me({ selectedResult: n, sendTextMessage: a }) {
291
- const [u, x] = se(null);
292
- oe(() => {
293
- (n == null ? void 0 : n.toolName) === re && n.data && x(n.data);
294
- }, [n]);
295
- const f = (t) => u == null ? void 0 : u.nodes.find((i) => i.id === t), d = (t) => {
296
- a && a(
297
- `I want to expand the "${t.text}" branch. Add related sub-ideas.`
298
- );
299
- };
300
- return u ? /* @__PURE__ */ o.jsx("div", { className: "size-full bg-gray-50 overflow-hidden", children: /* @__PURE__ */ o.jsxs("div", { className: "size-full relative", children: [
301
- /* @__PURE__ */ o.jsx("div", { className: "absolute top-4 left-4 z-10", children: /* @__PURE__ */ o.jsx("h2", { className: "text-xl font-bold text-gray-800 bg-white/80 px-3 py-1 rounded-lg shadow", children: u.title }) }),
302
- /* @__PURE__ */ o.jsxs(
303
- "svg",
304
- {
305
- className: "size-full",
306
- viewBox: `0 0 ${ue} ${fe}`,
307
- preserveAspectRatio: "xMidYMid meet",
308
- children: [
309
- /* @__PURE__ */ o.jsx("g", { className: "connections", children: u.connections.map((t) => {
310
- const i = f(t.from), m = f(t.to);
311
- return /* @__PURE__ */ o.jsxs("g", { children: [
312
- /* @__PURE__ */ o.jsx(
313
- "line",
314
- {
315
- x1: (i == null ? void 0 : i.x) || 0,
316
- y1: (i == null ? void 0 : i.y) || 0,
317
- x2: (m == null ? void 0 : m.x) || 0,
318
- y2: (m == null ? void 0 : m.y) || 0,
319
- stroke: "#94A3B8",
320
- strokeWidth: "2",
321
- className: "transition-all duration-300"
322
- }
323
- ),
324
- t.label && /* @__PURE__ */ o.jsx(
325
- "text",
326
- {
327
- x: (((i == null ? void 0 : i.x) || 0) + ((m == null ? void 0 : m.x) || 0)) / 2,
328
- y: (((i == null ? void 0 : i.y) || 0) + ((m == null ? void 0 : m.y) || 0)) / 2 - 5,
329
- textAnchor: "middle",
330
- className: "text-xs fill-gray-500",
331
- children: t.label
332
- }
333
- )
334
- ] }, `${t.from}-${t.to}`);
335
- }) }),
336
- /* @__PURE__ */ o.jsx("g", { className: "nodes", children: u.nodes.map((t) => /* @__PURE__ */ o.jsxs(
337
- "g",
338
- {
339
- transform: `translate(${t.x}, ${t.y})`,
340
- className: "cursor-pointer transition-transform duration-200 hover:scale-110",
341
- onClick: () => d(t),
342
- children: [
343
- /* @__PURE__ */ o.jsx(
344
- "rect",
345
- {
346
- x: -F(t.text) / 2,
347
- y: -20,
348
- width: F(t.text),
349
- height: 40,
350
- rx: 20,
351
- fill: t.color || "#4F46E5",
352
- className: "drop-shadow-md"
353
- }
354
- ),
355
- /* @__PURE__ */ o.jsx(
356
- "text",
357
- {
358
- textAnchor: "middle",
359
- dominantBaseline: "middle",
360
- fill: "white",
361
- className: "text-sm font-medium select-none pointer-events-none",
362
- children: de(t.text, 20)
363
- }
364
- )
365
- ]
366
- },
367
- t.id
368
- )) })
369
- ]
370
- }
371
- ),
372
- /* @__PURE__ */ o.jsx("div", { className: "absolute bottom-4 left-4 right-4 text-center", children: /* @__PURE__ */ o.jsx("p", { className: "text-sm text-gray-500 bg-white/80 px-3 py-2 rounded-lg inline-block", children: "Click a node to expand it with new ideas" }) })
373
- ] }) }) : /* @__PURE__ */ o.jsx("div", { className: "size-full flex items-center justify-center", children: /* @__PURE__ */ o.jsx("p", { className: "text-gray-400", children: "No mind map data" }) });
374
- }
375
- function xe({ result: n }) {
376
- var d;
377
- const a = n.data, u = (a == null ? void 0 : a.nodes) && a.nodes.length > 0, x = (a == null ? void 0 : a.title) || "Mind Map", f = ((d = a == null ? void 0 : a.nodes) == null ? void 0 : d.length) || 0;
378
- return /* @__PURE__ */ o.jsxs("div", { className: "p-3 bg-indigo-50 rounded-lg text-center", children: [
379
- /* @__PURE__ */ o.jsx("div", { className: "text-2xl mb-1", children: "🧠" }),
380
- /* @__PURE__ */ o.jsx("div", { className: "text-indigo-700 font-medium text-sm truncate", children: x }),
381
- u ? /* @__PURE__ */ o.jsxs("div", { className: "text-xs text-gray-500 mt-1", children: [
382
- f,
383
- " ideas"
384
- ] }) : /* @__PURE__ */ o.jsx("div", { className: "text-xs text-amber-600 mt-1", children: n.message || "No data" })
385
- ] });
386
- }
387
- const pe = {
388
- ...ne,
389
- ViewComponent: me,
390
- PreviewComponent: xe,
391
- samples: te
392
- }, ve = { plugin: pe };
393
- export {
394
- xe as Preview,
395
- ge as SYSTEM_PROMPT,
396
- Re as TOOL_DEFINITION,
397
- re as TOOL_NAME,
398
- me as View,
399
- ve as default,
400
- je as executeMindMap,
401
- pe as plugin,
402
- ne as pluginCore,
403
- te as samples
404
- };
298
+ //#endregion
299
+ //#region src/react/index.ts
300
+ var y = {
301
+ ...o,
302
+ ViewComponent: _,
303
+ PreviewComponent: v,
304
+ samples: s
305
+ }, b = { plugin: y };
306
+ //#endregion
307
+ export { v as Preview, r as SYSTEM_PROMPT, n as TOOL_DEFINITION, a as TOOL_NAME, _ as View, b as default, i as executeMindMap, y as plugin, o as pluginCore, s as samples };