@chaibuilder/sdk 3.1.5 → 3.1.7
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/code-display-BJJV-nKI.js +64 -0
- package/dist/code-display-BcpLta9W.cjs +1 -0
- package/dist/{code-editor-CCtMapeT.js → code-editor-D1w8nUwt.js} +1 -1
- package/dist/{code-editor-DwJyCB5f.cjs → code-editor-DEY4IkBJ.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{index-ENH8SVib.cjs → index-CONV5Fbc.cjs} +4 -4
- package/dist/{index-DHTitEQZ.js → index-Cj8rTugy.js} +9 -9
- package/dist/{rte-widget-modal-BRoDWnTe.js → rte-widget-modal-CsOaIXCW.js} +1 -1
- package/dist/{rte-widget-modal-7tiucEMf.cjs → rte-widget-modal-D_Yor38o.cjs} +1 -1
- package/package.json +1 -1
- package/dist/code-display-Brl9NCVZ.cjs +0 -11
- package/dist/code-display-CX2P1oME.js +0 -620
|
@@ -1,620 +0,0 @@
|
|
|
1
|
-
import { jsxs as k, jsx as U } from "react/jsx-runtime";
|
|
2
|
-
import { v as le } from "./tooltip-4-b9QGDK.js";
|
|
3
|
-
import A, { memo as ue, useState as $, useRef as m, useCallback as ce, useEffect as P } from "react";
|
|
4
|
-
import { CheckIcon as Pe, CopyIcon as Ce, DownloadIcon as Ee } from "@radix-ui/react-icons";
|
|
5
|
-
function se(e, t) {
|
|
6
|
-
(t == null || t > e.length) && (t = e.length);
|
|
7
|
-
for (var r = 0, n = Array(t); r < t; r++) n[r] = e[r];
|
|
8
|
-
return n;
|
|
9
|
-
}
|
|
10
|
-
function Ie(e) {
|
|
11
|
-
if (Array.isArray(e)) return e;
|
|
12
|
-
}
|
|
13
|
-
function Le(e, t, r) {
|
|
14
|
-
return (t = Ve(t)) in e ? Object.defineProperty(e, t, {
|
|
15
|
-
value: r,
|
|
16
|
-
enumerable: !0,
|
|
17
|
-
configurable: !0,
|
|
18
|
-
writable: !0
|
|
19
|
-
}) : e[t] = r, e;
|
|
20
|
-
}
|
|
21
|
-
function xe(e, t) {
|
|
22
|
-
var r = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
|
|
23
|
-
if (r != null) {
|
|
24
|
-
var n, o, i, u, s = [], p = !0, h = !1;
|
|
25
|
-
try {
|
|
26
|
-
if (i = (r = r.call(e)).next, t !== 0) for (; !(p = (n = i.call(r)).done) && (s.push(n.value), s.length !== t); p = !0) ;
|
|
27
|
-
} catch (S) {
|
|
28
|
-
h = !0, o = S;
|
|
29
|
-
} finally {
|
|
30
|
-
try {
|
|
31
|
-
if (!p && r.return != null && (u = r.return(), Object(u) !== u)) return;
|
|
32
|
-
} finally {
|
|
33
|
-
if (h) throw o;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return s;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
function De() {
|
|
40
|
-
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
41
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
42
|
-
}
|
|
43
|
-
function de(e, t) {
|
|
44
|
-
var r = Object.keys(e);
|
|
45
|
-
if (Object.getOwnPropertySymbols) {
|
|
46
|
-
var n = Object.getOwnPropertySymbols(e);
|
|
47
|
-
t && (n = n.filter(function(o) {
|
|
48
|
-
return Object.getOwnPropertyDescriptor(e, o).enumerable;
|
|
49
|
-
})), r.push.apply(r, n);
|
|
50
|
-
}
|
|
51
|
-
return r;
|
|
52
|
-
}
|
|
53
|
-
function fe(e) {
|
|
54
|
-
for (var t = 1; t < arguments.length; t++) {
|
|
55
|
-
var r = arguments[t] != null ? arguments[t] : {};
|
|
56
|
-
t % 2 ? de(Object(r), !0).forEach(function(n) {
|
|
57
|
-
Le(e, n, r[n]);
|
|
58
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : de(Object(r)).forEach(function(n) {
|
|
59
|
-
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
return e;
|
|
63
|
-
}
|
|
64
|
-
function Te(e, t) {
|
|
65
|
-
if (e == null) return {};
|
|
66
|
-
var r, n, o = Ae(e, t);
|
|
67
|
-
if (Object.getOwnPropertySymbols) {
|
|
68
|
-
var i = Object.getOwnPropertySymbols(e);
|
|
69
|
-
for (n = 0; n < i.length; n++) r = i[n], t.indexOf(r) === -1 && {}.propertyIsEnumerable.call(e, r) && (o[r] = e[r]);
|
|
70
|
-
}
|
|
71
|
-
return o;
|
|
72
|
-
}
|
|
73
|
-
function Ae(e, t) {
|
|
74
|
-
if (e == null) return {};
|
|
75
|
-
var r = {};
|
|
76
|
-
for (var n in e) if ({}.hasOwnProperty.call(e, n)) {
|
|
77
|
-
if (t.indexOf(n) !== -1) continue;
|
|
78
|
-
r[n] = e[n];
|
|
79
|
-
}
|
|
80
|
-
return r;
|
|
81
|
-
}
|
|
82
|
-
function $e(e, t) {
|
|
83
|
-
return Ie(e) || xe(e, t) || ze(e, t) || De();
|
|
84
|
-
}
|
|
85
|
-
function Ne(e, t) {
|
|
86
|
-
if (typeof e != "object" || !e) return e;
|
|
87
|
-
var r = e[Symbol.toPrimitive];
|
|
88
|
-
if (r !== void 0) {
|
|
89
|
-
var n = r.call(e, t);
|
|
90
|
-
if (typeof n != "object") return n;
|
|
91
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
92
|
-
}
|
|
93
|
-
return (t === "string" ? String : Number)(e);
|
|
94
|
-
}
|
|
95
|
-
function Ve(e) {
|
|
96
|
-
var t = Ne(e, "string");
|
|
97
|
-
return typeof t == "symbol" ? t : t + "";
|
|
98
|
-
}
|
|
99
|
-
function ze(e, t) {
|
|
100
|
-
{
|
|
101
|
-
if (typeof e == "string") return se(e, t);
|
|
102
|
-
var r = {}.toString.call(e).slice(8, -1);
|
|
103
|
-
return r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set" ? Array.from(e) : r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? se(e, t) : void 0;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
function Re(e, t, r) {
|
|
107
|
-
return t in e ? Object.defineProperty(e, t, {
|
|
108
|
-
value: r,
|
|
109
|
-
enumerable: !0,
|
|
110
|
-
configurable: !0,
|
|
111
|
-
writable: !0
|
|
112
|
-
}) : e[t] = r, e;
|
|
113
|
-
}
|
|
114
|
-
function pe(e, t) {
|
|
115
|
-
var r = Object.keys(e);
|
|
116
|
-
if (Object.getOwnPropertySymbols) {
|
|
117
|
-
var n = Object.getOwnPropertySymbols(e);
|
|
118
|
-
t && (n = n.filter(function(o) {
|
|
119
|
-
return Object.getOwnPropertyDescriptor(e, o).enumerable;
|
|
120
|
-
})), r.push.apply(r, n);
|
|
121
|
-
}
|
|
122
|
-
return r;
|
|
123
|
-
}
|
|
124
|
-
function ge(e) {
|
|
125
|
-
for (var t = 1; t < arguments.length; t++) {
|
|
126
|
-
var r = arguments[t] != null ? arguments[t] : {};
|
|
127
|
-
t % 2 ? pe(Object(r), !0).forEach(function(n) {
|
|
128
|
-
Re(e, n, r[n]);
|
|
129
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : pe(Object(r)).forEach(function(n) {
|
|
130
|
-
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
return e;
|
|
134
|
-
}
|
|
135
|
-
function qe() {
|
|
136
|
-
for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
|
|
137
|
-
t[r] = arguments[r];
|
|
138
|
-
return function(n) {
|
|
139
|
-
return t.reduceRight(function(o, i) {
|
|
140
|
-
return i(o);
|
|
141
|
-
}, n);
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
function F(e) {
|
|
145
|
-
return function t() {
|
|
146
|
-
for (var r = this, n = arguments.length, o = new Array(n), i = 0; i < n; i++)
|
|
147
|
-
o[i] = arguments[i];
|
|
148
|
-
return o.length >= e.length ? e.apply(this, o) : function() {
|
|
149
|
-
for (var u = arguments.length, s = new Array(u), p = 0; p < u; p++)
|
|
150
|
-
s[p] = arguments[p];
|
|
151
|
-
return t.apply(r, [].concat(o, s));
|
|
152
|
-
};
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
function J(e) {
|
|
156
|
-
return {}.toString.call(e).includes("Object");
|
|
157
|
-
}
|
|
158
|
-
function Ue(e) {
|
|
159
|
-
return !Object.keys(e).length;
|
|
160
|
-
}
|
|
161
|
-
function W(e) {
|
|
162
|
-
return typeof e == "function";
|
|
163
|
-
}
|
|
164
|
-
function Fe(e, t) {
|
|
165
|
-
return Object.prototype.hasOwnProperty.call(e, t);
|
|
166
|
-
}
|
|
167
|
-
function He(e, t) {
|
|
168
|
-
return J(t) || E("changeType"), Object.keys(t).some(function(r) {
|
|
169
|
-
return !Fe(e, r);
|
|
170
|
-
}) && E("changeField"), t;
|
|
171
|
-
}
|
|
172
|
-
function We(e) {
|
|
173
|
-
W(e) || E("selectorType");
|
|
174
|
-
}
|
|
175
|
-
function Be(e) {
|
|
176
|
-
W(e) || J(e) || E("handlerType"), J(e) && Object.values(e).some(function(t) {
|
|
177
|
-
return !W(t);
|
|
178
|
-
}) && E("handlersType");
|
|
179
|
-
}
|
|
180
|
-
function Ke(e) {
|
|
181
|
-
e || E("initialIsRequired"), J(e) || E("initialType"), Ue(e) && E("initialContent");
|
|
182
|
-
}
|
|
183
|
-
function _e(e, t) {
|
|
184
|
-
throw new Error(e[t] || e.default);
|
|
185
|
-
}
|
|
186
|
-
var ke = {
|
|
187
|
-
initialIsRequired: "initial state is required",
|
|
188
|
-
initialType: "initial state should be an object",
|
|
189
|
-
initialContent: "initial state shouldn't be an empty object",
|
|
190
|
-
handlerType: "handler should be an object or a function",
|
|
191
|
-
handlersType: "all handlers should be a functions",
|
|
192
|
-
selectorType: "selector should be a function",
|
|
193
|
-
changeType: "provided value of changes should be an object",
|
|
194
|
-
changeField: 'it seams you want to change a field in the state which is not specified in the "initial" state',
|
|
195
|
-
default: "an unknown error accured in `state-local` package"
|
|
196
|
-
}, E = F(_e)(ke), G = {
|
|
197
|
-
changes: He,
|
|
198
|
-
selector: We,
|
|
199
|
-
handler: Be,
|
|
200
|
-
initial: Ke
|
|
201
|
-
};
|
|
202
|
-
function Ge(e) {
|
|
203
|
-
var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
204
|
-
G.initial(e), G.handler(t);
|
|
205
|
-
var r = {
|
|
206
|
-
current: e
|
|
207
|
-
}, n = F(Qe)(r, t), o = F(Je)(r), i = F(G.changes)(e), u = F(Ye)(r);
|
|
208
|
-
function s() {
|
|
209
|
-
var h = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function(S) {
|
|
210
|
-
return S;
|
|
211
|
-
};
|
|
212
|
-
return G.selector(h), h(r.current);
|
|
213
|
-
}
|
|
214
|
-
function p(h) {
|
|
215
|
-
qe(n, o, i, u)(h);
|
|
216
|
-
}
|
|
217
|
-
return [s, p];
|
|
218
|
-
}
|
|
219
|
-
function Ye(e, t) {
|
|
220
|
-
return W(t) ? t(e.current) : t;
|
|
221
|
-
}
|
|
222
|
-
function Je(e, t) {
|
|
223
|
-
return e.current = ge(ge({}, e.current), t), t;
|
|
224
|
-
}
|
|
225
|
-
function Qe(e, t, r) {
|
|
226
|
-
return W(t) ? t(e.current) : Object.keys(r).forEach(function(n) {
|
|
227
|
-
var o;
|
|
228
|
-
return (o = t[n]) === null || o === void 0 ? void 0 : o.call(t, e.current[n]);
|
|
229
|
-
}), r;
|
|
230
|
-
}
|
|
231
|
-
var Xe = {
|
|
232
|
-
create: Ge
|
|
233
|
-
}, Ze = {
|
|
234
|
-
paths: {
|
|
235
|
-
vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs"
|
|
236
|
-
}
|
|
237
|
-
};
|
|
238
|
-
function et(e) {
|
|
239
|
-
return function t() {
|
|
240
|
-
for (var r = this, n = arguments.length, o = new Array(n), i = 0; i < n; i++)
|
|
241
|
-
o[i] = arguments[i];
|
|
242
|
-
return o.length >= e.length ? e.apply(this, o) : function() {
|
|
243
|
-
for (var u = arguments.length, s = new Array(u), p = 0; p < u; p++)
|
|
244
|
-
s[p] = arguments[p];
|
|
245
|
-
return t.apply(r, [].concat(o, s));
|
|
246
|
-
};
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
function tt(e) {
|
|
250
|
-
return {}.toString.call(e).includes("Object");
|
|
251
|
-
}
|
|
252
|
-
function rt(e) {
|
|
253
|
-
return e || he("configIsRequired"), tt(e) || he("configType"), e.urls ? (nt(), {
|
|
254
|
-
paths: {
|
|
255
|
-
vs: e.urls.monacoBase
|
|
256
|
-
}
|
|
257
|
-
}) : e;
|
|
258
|
-
}
|
|
259
|
-
function nt() {
|
|
260
|
-
console.warn(ve.deprecation);
|
|
261
|
-
}
|
|
262
|
-
function ot(e, t) {
|
|
263
|
-
throw new Error(e[t] || e.default);
|
|
264
|
-
}
|
|
265
|
-
var ve = {
|
|
266
|
-
configIsRequired: "the configuration object is required",
|
|
267
|
-
configType: "the configuration object should be an object",
|
|
268
|
-
default: "an unknown error accured in `@monaco-editor/loader` package",
|
|
269
|
-
deprecation: `Deprecation warning!
|
|
270
|
-
You are using deprecated way of configuration.
|
|
271
|
-
|
|
272
|
-
Instead of using
|
|
273
|
-
monaco.config({ urls: { monacoBase: '...' } })
|
|
274
|
-
use
|
|
275
|
-
monaco.config({ paths: { vs: '...' } })
|
|
276
|
-
|
|
277
|
-
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
|
278
|
-
`
|
|
279
|
-
}, he = et(ot)(ve), it = {
|
|
280
|
-
config: rt
|
|
281
|
-
}, at = function() {
|
|
282
|
-
for (var t = arguments.length, r = new Array(t), n = 0; n < t; n++)
|
|
283
|
-
r[n] = arguments[n];
|
|
284
|
-
return function(o) {
|
|
285
|
-
return r.reduceRight(function(i, u) {
|
|
286
|
-
return u(i);
|
|
287
|
-
}, o);
|
|
288
|
-
};
|
|
289
|
-
};
|
|
290
|
-
function me(e, t) {
|
|
291
|
-
return Object.keys(t).forEach(function(r) {
|
|
292
|
-
t[r] instanceof Object && e[r] && Object.assign(t[r], me(e[r], t[r]));
|
|
293
|
-
}), fe(fe({}, e), t);
|
|
294
|
-
}
|
|
295
|
-
var ct = {
|
|
296
|
-
type: "cancelation",
|
|
297
|
-
msg: "operation is manually canceled"
|
|
298
|
-
};
|
|
299
|
-
function oe(e) {
|
|
300
|
-
var t = !1, r = new Promise(function(n, o) {
|
|
301
|
-
e.then(function(i) {
|
|
302
|
-
return t ? o(ct) : n(i);
|
|
303
|
-
}), e.catch(o);
|
|
304
|
-
});
|
|
305
|
-
return r.cancel = function() {
|
|
306
|
-
return t = !0;
|
|
307
|
-
}, r;
|
|
308
|
-
}
|
|
309
|
-
var ut = ["monaco"], lt = Xe.create({
|
|
310
|
-
config: Ze,
|
|
311
|
-
isInitialized: !1,
|
|
312
|
-
resolve: null,
|
|
313
|
-
reject: null,
|
|
314
|
-
monaco: null
|
|
315
|
-
}), be = $e(lt, 2), B = be[0], Q = be[1];
|
|
316
|
-
function st(e) {
|
|
317
|
-
var t = it.config(e), r = t.monaco, n = Te(t, ut);
|
|
318
|
-
Q(function(o) {
|
|
319
|
-
return {
|
|
320
|
-
config: me(o.config, n),
|
|
321
|
-
monaco: r
|
|
322
|
-
};
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
function dt() {
|
|
326
|
-
var e = B(function(t) {
|
|
327
|
-
var r = t.monaco, n = t.isInitialized, o = t.resolve;
|
|
328
|
-
return {
|
|
329
|
-
monaco: r,
|
|
330
|
-
isInitialized: n,
|
|
331
|
-
resolve: o
|
|
332
|
-
};
|
|
333
|
-
});
|
|
334
|
-
if (!e.isInitialized) {
|
|
335
|
-
if (Q({
|
|
336
|
-
isInitialized: !0
|
|
337
|
-
}), e.monaco)
|
|
338
|
-
return e.resolve(e.monaco), oe(ie);
|
|
339
|
-
if (window.monaco && window.monaco.editor)
|
|
340
|
-
return ye(window.monaco), e.resolve(window.monaco), oe(ie);
|
|
341
|
-
at(ft, gt)(ht);
|
|
342
|
-
}
|
|
343
|
-
return oe(ie);
|
|
344
|
-
}
|
|
345
|
-
function ft(e) {
|
|
346
|
-
return document.body.appendChild(e);
|
|
347
|
-
}
|
|
348
|
-
function pt(e) {
|
|
349
|
-
var t = document.createElement("script");
|
|
350
|
-
return e && (t.src = e), t;
|
|
351
|
-
}
|
|
352
|
-
function gt(e) {
|
|
353
|
-
var t = B(function(n) {
|
|
354
|
-
var o = n.config, i = n.reject;
|
|
355
|
-
return {
|
|
356
|
-
config: o,
|
|
357
|
-
reject: i
|
|
358
|
-
};
|
|
359
|
-
}), r = pt("".concat(t.config.paths.vs, "/loader.js"));
|
|
360
|
-
return r.onload = function() {
|
|
361
|
-
return e();
|
|
362
|
-
}, r.onerror = t.reject, r;
|
|
363
|
-
}
|
|
364
|
-
function ht() {
|
|
365
|
-
var e = B(function(r) {
|
|
366
|
-
var n = r.config, o = r.resolve, i = r.reject;
|
|
367
|
-
return {
|
|
368
|
-
config: n,
|
|
369
|
-
resolve: o,
|
|
370
|
-
reject: i
|
|
371
|
-
};
|
|
372
|
-
}), t = window.require;
|
|
373
|
-
t.config(e.config), t(["vs/editor/editor.main"], function(r) {
|
|
374
|
-
var n = r.m;
|
|
375
|
-
ye(n), e.resolve(n);
|
|
376
|
-
}, function(r) {
|
|
377
|
-
e.reject(r);
|
|
378
|
-
});
|
|
379
|
-
}
|
|
380
|
-
function ye(e) {
|
|
381
|
-
B().monaco || Q({
|
|
382
|
-
monaco: e
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
function vt() {
|
|
386
|
-
return B(function(e) {
|
|
387
|
-
var t = e.monaco;
|
|
388
|
-
return t;
|
|
389
|
-
});
|
|
390
|
-
}
|
|
391
|
-
var ie = new Promise(function(e, t) {
|
|
392
|
-
return Q({
|
|
393
|
-
resolve: e,
|
|
394
|
-
reject: t
|
|
395
|
-
});
|
|
396
|
-
}), we = {
|
|
397
|
-
config: st,
|
|
398
|
-
init: dt,
|
|
399
|
-
__getMonacoInstance: vt
|
|
400
|
-
}, mt = { wrapper: { display: "flex", position: "relative", textAlign: "initial" }, fullWidth: { width: "100%" }, hide: { display: "none" } }, ae = mt, bt = { container: { display: "flex", height: "100%", width: "100%", justifyContent: "center", alignItems: "center" } }, yt = bt;
|
|
401
|
-
function wt({ children: e }) {
|
|
402
|
-
return A.createElement("div", { style: yt.container }, e);
|
|
403
|
-
}
|
|
404
|
-
var Ot = wt, jt = Ot;
|
|
405
|
-
function Mt({ width: e, height: t, isEditorReady: r, loading: n, _ref: o, className: i, wrapperProps: u }) {
|
|
406
|
-
return A.createElement("section", { style: { ...ae.wrapper, width: e, height: t }, ...u }, !r && A.createElement(jt, null, n), A.createElement("div", { ref: o, style: { ...ae.fullWidth, ...!r && ae.hide }, className: i }));
|
|
407
|
-
}
|
|
408
|
-
var St = Mt, Oe = ue(St);
|
|
409
|
-
function Pt(e) {
|
|
410
|
-
P(e, []);
|
|
411
|
-
}
|
|
412
|
-
var je = Pt;
|
|
413
|
-
function Ct(e, t, r = !0) {
|
|
414
|
-
let n = m(!0);
|
|
415
|
-
P(n.current || !r ? () => {
|
|
416
|
-
n.current = !1;
|
|
417
|
-
} : e, t);
|
|
418
|
-
}
|
|
419
|
-
var j = Ct;
|
|
420
|
-
function H() {
|
|
421
|
-
}
|
|
422
|
-
function T(e, t, r, n) {
|
|
423
|
-
return Et(e, n) || It(e, t, r, n);
|
|
424
|
-
}
|
|
425
|
-
function Et(e, t) {
|
|
426
|
-
return e.editor.getModel(Me(e, t));
|
|
427
|
-
}
|
|
428
|
-
function It(e, t, r, n) {
|
|
429
|
-
return e.editor.createModel(t, r, n ? Me(e, n) : void 0);
|
|
430
|
-
}
|
|
431
|
-
function Me(e, t) {
|
|
432
|
-
return e.Uri.parse(t);
|
|
433
|
-
}
|
|
434
|
-
function Lt({ original: e, modified: t, language: r, originalLanguage: n, modifiedLanguage: o, originalModelPath: i, modifiedModelPath: u, keepCurrentOriginalModel: s = !1, keepCurrentModifiedModel: p = !1, theme: h = "light", loading: S = "Loading...", options: M = {}, height: X = "100%", width: Z = "100%", className: ee, wrapperProps: te = {}, beforeMount: re = H, onMount: ne = H }) {
|
|
435
|
-
let [w, N] = $(!1), [I, v] = $(!0), b = m(null), g = m(null), V = m(null), y = m(ne), l = m(re), L = m(!1);
|
|
436
|
-
je(() => {
|
|
437
|
-
let a = we.init();
|
|
438
|
-
return a.then((d) => (g.current = d) && v(!1)).catch((d) => (d == null ? void 0 : d.type) !== "cancelation" && console.error("Monaco initialization: error:", d)), () => b.current ? z() : a.cancel();
|
|
439
|
-
}), j(() => {
|
|
440
|
-
if (b.current && g.current) {
|
|
441
|
-
let a = b.current.getOriginalEditor(), d = T(g.current, e || "", n || r || "text", i || "");
|
|
442
|
-
d !== a.getModel() && a.setModel(d);
|
|
443
|
-
}
|
|
444
|
-
}, [i], w), j(() => {
|
|
445
|
-
if (b.current && g.current) {
|
|
446
|
-
let a = b.current.getModifiedEditor(), d = T(g.current, t || "", o || r || "text", u || "");
|
|
447
|
-
d !== a.getModel() && a.setModel(d);
|
|
448
|
-
}
|
|
449
|
-
}, [u], w), j(() => {
|
|
450
|
-
let a = b.current.getModifiedEditor();
|
|
451
|
-
a.getOption(g.current.editor.EditorOption.readOnly) ? a.setValue(t || "") : t !== a.getValue() && (a.executeEdits("", [{ range: a.getModel().getFullModelRange(), text: t || "", forceMoveMarkers: !0 }]), a.pushUndoStop());
|
|
452
|
-
}, [t], w), j(() => {
|
|
453
|
-
var a, d;
|
|
454
|
-
(d = (a = b.current) == null ? void 0 : a.getModel()) == null || d.original.setValue(e || "");
|
|
455
|
-
}, [e], w), j(() => {
|
|
456
|
-
let { original: a, modified: d } = b.current.getModel();
|
|
457
|
-
g.current.editor.setModelLanguage(a, n || r || "text"), g.current.editor.setModelLanguage(d, o || r || "text");
|
|
458
|
-
}, [r, n, o], w), j(() => {
|
|
459
|
-
var a;
|
|
460
|
-
(a = g.current) == null || a.editor.setTheme(h);
|
|
461
|
-
}, [h], w), j(() => {
|
|
462
|
-
var a;
|
|
463
|
-
(a = b.current) == null || a.updateOptions(M);
|
|
464
|
-
}, [M], w);
|
|
465
|
-
let K = ce(() => {
|
|
466
|
-
var C;
|
|
467
|
-
if (!g.current) return;
|
|
468
|
-
l.current(g.current);
|
|
469
|
-
let a = T(g.current, e || "", n || r || "text", i || ""), d = T(g.current, t || "", o || r || "text", u || "");
|
|
470
|
-
(C = b.current) == null || C.setModel({ original: a, modified: d });
|
|
471
|
-
}, [r, t, o, e, n, i, u]), _ = ce(() => {
|
|
472
|
-
var a;
|
|
473
|
-
!L.current && V.current && (b.current = g.current.editor.createDiffEditor(V.current, { automaticLayout: !0, ...M }), K(), (a = g.current) == null || a.editor.setTheme(h), N(!0), L.current = !0);
|
|
474
|
-
}, [M, h, K]);
|
|
475
|
-
P(() => {
|
|
476
|
-
w && y.current(b.current, g.current);
|
|
477
|
-
}, [w]), P(() => {
|
|
478
|
-
!I && !w && _();
|
|
479
|
-
}, [I, w, _]);
|
|
480
|
-
function z() {
|
|
481
|
-
var d, C, x, R;
|
|
482
|
-
let a = (d = b.current) == null ? void 0 : d.getModel();
|
|
483
|
-
s || ((C = a == null ? void 0 : a.original) == null || C.dispose()), p || ((x = a == null ? void 0 : a.modified) == null || x.dispose()), (R = b.current) == null || R.dispose();
|
|
484
|
-
}
|
|
485
|
-
return A.createElement(Oe, { width: Z, height: X, isEditorReady: w, loading: S, _ref: V, className: ee, wrapperProps: te });
|
|
486
|
-
}
|
|
487
|
-
var xt = Lt;
|
|
488
|
-
ue(xt);
|
|
489
|
-
function Dt(e) {
|
|
490
|
-
let t = m();
|
|
491
|
-
return P(() => {
|
|
492
|
-
t.current = e;
|
|
493
|
-
}, [e]), t.current;
|
|
494
|
-
}
|
|
495
|
-
var Tt = Dt, Y = /* @__PURE__ */ new Map();
|
|
496
|
-
function At({ defaultValue: e, defaultLanguage: t, defaultPath: r, value: n, language: o, path: i, theme: u = "light", line: s, loading: p = "Loading...", options: h = {}, overrideServices: S = {}, saveViewState: M = !0, keepCurrentModel: X = !1, width: Z = "100%", height: ee = "100%", className: te, wrapperProps: re = {}, beforeMount: ne = H, onMount: w = H, onChange: N, onValidate: I = H }) {
|
|
497
|
-
let [v, b] = $(!1), [g, V] = $(!0), y = m(null), l = m(null), L = m(null), K = m(w), _ = m(ne), z = m(), a = m(n), d = Tt(i), C = m(!1), x = m(!1);
|
|
498
|
-
je(() => {
|
|
499
|
-
let c = we.init();
|
|
500
|
-
return c.then((f) => (y.current = f) && V(!1)).catch((f) => (f == null ? void 0 : f.type) !== "cancelation" && console.error("Monaco initialization: error:", f)), () => l.current ? Se() : c.cancel();
|
|
501
|
-
}), j(() => {
|
|
502
|
-
var f, O, q, D;
|
|
503
|
-
let c = T(y.current, e || n || "", t || o || "", i || r || "");
|
|
504
|
-
c !== ((f = l.current) == null ? void 0 : f.getModel()) && (M && Y.set(d, (O = l.current) == null ? void 0 : O.saveViewState()), (q = l.current) == null || q.setModel(c), M && ((D = l.current) == null || D.restoreViewState(Y.get(i))));
|
|
505
|
-
}, [i], v), j(() => {
|
|
506
|
-
var c;
|
|
507
|
-
(c = l.current) == null || c.updateOptions(h);
|
|
508
|
-
}, [h], v), j(() => {
|
|
509
|
-
!l.current || n === void 0 || (l.current.getOption(y.current.editor.EditorOption.readOnly) ? l.current.setValue(n) : n !== l.current.getValue() && (x.current = !0, l.current.executeEdits("", [{ range: l.current.getModel().getFullModelRange(), text: n, forceMoveMarkers: !0 }]), l.current.pushUndoStop(), x.current = !1));
|
|
510
|
-
}, [n], v), j(() => {
|
|
511
|
-
var f, O;
|
|
512
|
-
let c = (f = l.current) == null ? void 0 : f.getModel();
|
|
513
|
-
c && o && ((O = y.current) == null || O.editor.setModelLanguage(c, o));
|
|
514
|
-
}, [o], v), j(() => {
|
|
515
|
-
var c;
|
|
516
|
-
s !== void 0 && ((c = l.current) == null || c.revealLine(s));
|
|
517
|
-
}, [s], v), j(() => {
|
|
518
|
-
var c;
|
|
519
|
-
(c = y.current) == null || c.editor.setTheme(u);
|
|
520
|
-
}, [u], v);
|
|
521
|
-
let R = ce(() => {
|
|
522
|
-
var c;
|
|
523
|
-
if (!(!L.current || !y.current) && !C.current) {
|
|
524
|
-
_.current(y.current);
|
|
525
|
-
let f = i || r, O = T(y.current, n || e || "", t || o || "", f || "");
|
|
526
|
-
l.current = (c = y.current) == null ? void 0 : c.editor.create(L.current, { model: O, automaticLayout: !0, ...h }, S), M && l.current.restoreViewState(Y.get(f)), y.current.editor.setTheme(u), s !== void 0 && l.current.revealLine(s), b(!0), C.current = !0;
|
|
527
|
-
}
|
|
528
|
-
}, [e, t, r, n, o, i, h, S, M, u, s]);
|
|
529
|
-
P(() => {
|
|
530
|
-
v && K.current(l.current, y.current);
|
|
531
|
-
}, [v]), P(() => {
|
|
532
|
-
!g && !v && R();
|
|
533
|
-
}, [g, v, R]), a.current = n, P(() => {
|
|
534
|
-
var c, f;
|
|
535
|
-
v && N && ((c = z.current) == null || c.dispose(), z.current = (f = l.current) == null ? void 0 : f.onDidChangeModelContent((O) => {
|
|
536
|
-
x.current || N(l.current.getValue(), O);
|
|
537
|
-
}));
|
|
538
|
-
}, [v, N]), P(() => {
|
|
539
|
-
if (v) {
|
|
540
|
-
let c = y.current.editor.onDidChangeMarkers((f) => {
|
|
541
|
-
var q;
|
|
542
|
-
let O = (q = l.current.getModel()) == null ? void 0 : q.uri;
|
|
543
|
-
if (O && f.find((D) => D.path === O.path)) {
|
|
544
|
-
let D = y.current.editor.getModelMarkers({ resource: O });
|
|
545
|
-
I == null || I(D);
|
|
546
|
-
}
|
|
547
|
-
});
|
|
548
|
-
return () => {
|
|
549
|
-
c == null || c.dispose();
|
|
550
|
-
};
|
|
551
|
-
}
|
|
552
|
-
return () => {
|
|
553
|
-
};
|
|
554
|
-
}, [v, I]);
|
|
555
|
-
function Se() {
|
|
556
|
-
var c, f;
|
|
557
|
-
(c = z.current) == null || c.dispose(), X ? M && Y.set(i, l.current.saveViewState()) : (f = l.current.getModel()) == null || f.dispose(), l.current.dispose();
|
|
558
|
-
}
|
|
559
|
-
return A.createElement(Oe, { width: Z, height: ee, isEditorReady: v, loading: p, _ref: L, className: te, wrapperProps: re });
|
|
560
|
-
}
|
|
561
|
-
var $t = At, Nt = ue($t), Vt = Nt;
|
|
562
|
-
function Ft({
|
|
563
|
-
code: e,
|
|
564
|
-
onCopy: t,
|
|
565
|
-
language: r = "javascript",
|
|
566
|
-
onDownload: n,
|
|
567
|
-
downloadText: o = "Download"
|
|
568
|
-
}) {
|
|
569
|
-
const [i, u] = $(!1), [s, p] = $(e);
|
|
570
|
-
return /* @__PURE__ */ k("div", { className: "flex flex-col gap-4", children: [
|
|
571
|
-
/* @__PURE__ */ U("div", { className: "h-[500px] max-h-full overflow-hidden rounded-md border py-2", children: /* @__PURE__ */ U(
|
|
572
|
-
Vt,
|
|
573
|
-
{
|
|
574
|
-
height: "100%",
|
|
575
|
-
defaultLanguage: r,
|
|
576
|
-
language: r,
|
|
577
|
-
value: s,
|
|
578
|
-
onChange: (M) => p(M || ""),
|
|
579
|
-
theme: "vs-light",
|
|
580
|
-
options: {
|
|
581
|
-
minimap: { enabled: !1 },
|
|
582
|
-
fontSize: 12,
|
|
583
|
-
lineNumbers: "off",
|
|
584
|
-
roundedSelection: !1,
|
|
585
|
-
scrollBeyondLastLine: !1,
|
|
586
|
-
automaticLayout: !0,
|
|
587
|
-
tabSize: 2,
|
|
588
|
-
insertSpaces: !0,
|
|
589
|
-
wordWrap: "on",
|
|
590
|
-
bracketPairColorization: { enabled: !0 },
|
|
591
|
-
suggest: {
|
|
592
|
-
showKeywords: !1,
|
|
593
|
-
showSnippets: !1
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
) }),
|
|
598
|
-
/* @__PURE__ */ k("div", { className: "flex justify-end gap-2", children: [
|
|
599
|
-
/* @__PURE__ */ k(le, { type: "button", variant: "outline", onClick: () => {
|
|
600
|
-
t(s), u(!0), setTimeout(() => {
|
|
601
|
-
u(!1);
|
|
602
|
-
}, 2e3);
|
|
603
|
-
}, children: [
|
|
604
|
-
i ? /* @__PURE__ */ U(Pe, { className: "text-green-500" }) : /* @__PURE__ */ U(Ce, {}),
|
|
605
|
-
" ",
|
|
606
|
-
i ? "Copied" : "Copy"
|
|
607
|
-
] }),
|
|
608
|
-
/* @__PURE__ */ k(le, { type: "button", onClick: () => {
|
|
609
|
-
n(s);
|
|
610
|
-
}, children: [
|
|
611
|
-
/* @__PURE__ */ U(Ee, {}),
|
|
612
|
-
" ",
|
|
613
|
-
o
|
|
614
|
-
] })
|
|
615
|
-
] })
|
|
616
|
-
] });
|
|
617
|
-
}
|
|
618
|
-
export {
|
|
619
|
-
Ft as default
|
|
620
|
-
};
|