@davincidreams/dynamic-canvas-react 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/README.md +399 -0
- package/dist/dynamic-canvas.cjs.js +65 -0
- package/dist/dynamic-canvas.es.js +966 -0
- package/dist/dynamic-canvas.umd.js +65 -0
- package/dist/index.d.ts +302 -0
- package/package.json +54 -0
|
@@ -0,0 +1,966 @@
|
|
|
1
|
+
import ne, { createContext as hr, useState as Y, useEffect as Pe, useContext as mr, useRef as br } from "react";
|
|
2
|
+
import { Check as gr, Copy as xr } from "lucide-react";
|
|
3
|
+
var te = { exports: {} }, V = {};
|
|
4
|
+
/**
|
|
5
|
+
* @license React
|
|
6
|
+
* react-jsx-runtime.production.min.js
|
|
7
|
+
*
|
|
8
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
9
|
+
*
|
|
10
|
+
* This source code is licensed under the MIT license found in the
|
|
11
|
+
* LICENSE file in the root directory of this source tree.
|
|
12
|
+
*/
|
|
13
|
+
var Oe;
|
|
14
|
+
function yr() {
|
|
15
|
+
if (Oe) return V;
|
|
16
|
+
Oe = 1;
|
|
17
|
+
var i = ne, n = Symbol.for("react.element"), o = Symbol.for("react.fragment"), s = Object.prototype.hasOwnProperty, f = i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, g = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
18
|
+
function y(x, h, T) {
|
|
19
|
+
var p, R = {}, S = null, P = null;
|
|
20
|
+
T !== void 0 && (S = "" + T), h.key !== void 0 && (S = "" + h.key), h.ref !== void 0 && (P = h.ref);
|
|
21
|
+
for (p in h) s.call(h, p) && !g.hasOwnProperty(p) && (R[p] = h[p]);
|
|
22
|
+
if (x && x.defaultProps) for (p in h = x.defaultProps, h) R[p] === void 0 && (R[p] = h[p]);
|
|
23
|
+
return { $$typeof: n, type: x, key: S, ref: P, props: R, _owner: f.current };
|
|
24
|
+
}
|
|
25
|
+
return V.Fragment = o, V.jsx = y, V.jsxs = y, V;
|
|
26
|
+
}
|
|
27
|
+
var U = {};
|
|
28
|
+
/**
|
|
29
|
+
* @license React
|
|
30
|
+
* react-jsx-runtime.development.js
|
|
31
|
+
*
|
|
32
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the MIT license found in the
|
|
35
|
+
* LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/
|
|
37
|
+
var ke;
|
|
38
|
+
function Rr() {
|
|
39
|
+
return ke || (ke = 1, process.env.NODE_ENV !== "production" && function() {
|
|
40
|
+
var i = ne, n = Symbol.for("react.element"), o = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), f = Symbol.for("react.strict_mode"), g = Symbol.for("react.profiler"), y = Symbol.for("react.provider"), x = Symbol.for("react.context"), h = Symbol.for("react.forward_ref"), T = Symbol.for("react.suspense"), p = Symbol.for("react.suspense_list"), R = Symbol.for("react.memo"), S = Symbol.for("react.lazy"), P = Symbol.for("react.offscreen"), N = Symbol.iterator, $ = "@@iterator";
|
|
41
|
+
function O(e) {
|
|
42
|
+
if (e === null || typeof e != "object")
|
|
43
|
+
return null;
|
|
44
|
+
var r = N && e[N] || e[$];
|
|
45
|
+
return typeof r == "function" ? r : null;
|
|
46
|
+
}
|
|
47
|
+
var j = i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
48
|
+
function E(e) {
|
|
49
|
+
{
|
|
50
|
+
for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), a = 1; a < r; a++)
|
|
51
|
+
t[a - 1] = arguments[a];
|
|
52
|
+
$e("error", e, t);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function $e(e, r, t) {
|
|
56
|
+
{
|
|
57
|
+
var a = j.ReactDebugCurrentFrame, d = a.getStackAddendum();
|
|
58
|
+
d !== "" && (r += "%s", t = t.concat([d]));
|
|
59
|
+
var v = t.map(function(u) {
|
|
60
|
+
return String(u);
|
|
61
|
+
});
|
|
62
|
+
v.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, v);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
var Ae = !1, Fe = !1, Ie = !1, We = !1, Me = !1, ae;
|
|
66
|
+
ae = Symbol.for("react.module.reference");
|
|
67
|
+
function Le(e) {
|
|
68
|
+
return !!(typeof e == "string" || typeof e == "function" || e === s || e === g || Me || e === f || e === T || e === p || We || e === P || Ae || Fe || Ie || typeof e == "object" && e !== null && (e.$$typeof === S || e.$$typeof === R || e.$$typeof === y || e.$$typeof === x || e.$$typeof === h || // This needs to include all possible module reference object
|
|
69
|
+
// types supported by any Flight configuration anywhere since
|
|
70
|
+
// we don't know which Flight build this will end up being used
|
|
71
|
+
// with.
|
|
72
|
+
e.$$typeof === ae || e.getModuleId !== void 0));
|
|
73
|
+
}
|
|
74
|
+
function Ye(e, r, t) {
|
|
75
|
+
var a = e.displayName;
|
|
76
|
+
if (a)
|
|
77
|
+
return a;
|
|
78
|
+
var d = r.displayName || r.name || "";
|
|
79
|
+
return d !== "" ? t + "(" + d + ")" : t;
|
|
80
|
+
}
|
|
81
|
+
function oe(e) {
|
|
82
|
+
return e.displayName || "Context";
|
|
83
|
+
}
|
|
84
|
+
function D(e) {
|
|
85
|
+
if (e == null)
|
|
86
|
+
return null;
|
|
87
|
+
if (typeof e.tag == "number" && E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
88
|
+
return e.displayName || e.name || null;
|
|
89
|
+
if (typeof e == "string")
|
|
90
|
+
return e;
|
|
91
|
+
switch (e) {
|
|
92
|
+
case s:
|
|
93
|
+
return "Fragment";
|
|
94
|
+
case o:
|
|
95
|
+
return "Portal";
|
|
96
|
+
case g:
|
|
97
|
+
return "Profiler";
|
|
98
|
+
case f:
|
|
99
|
+
return "StrictMode";
|
|
100
|
+
case T:
|
|
101
|
+
return "Suspense";
|
|
102
|
+
case p:
|
|
103
|
+
return "SuspenseList";
|
|
104
|
+
}
|
|
105
|
+
if (typeof e == "object")
|
|
106
|
+
switch (e.$$typeof) {
|
|
107
|
+
case x:
|
|
108
|
+
var r = e;
|
|
109
|
+
return oe(r) + ".Consumer";
|
|
110
|
+
case y:
|
|
111
|
+
var t = e;
|
|
112
|
+
return oe(t._context) + ".Provider";
|
|
113
|
+
case h:
|
|
114
|
+
return Ye(e, e.render, "ForwardRef");
|
|
115
|
+
case R:
|
|
116
|
+
var a = e.displayName || null;
|
|
117
|
+
return a !== null ? a : D(e.type) || "Memo";
|
|
118
|
+
case S: {
|
|
119
|
+
var d = e, v = d._payload, u = d._init;
|
|
120
|
+
try {
|
|
121
|
+
return D(u(v));
|
|
122
|
+
} catch {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
var A = Object.assign, M = 0, se, ie, ce, le, ue, fe, de;
|
|
130
|
+
function ve() {
|
|
131
|
+
}
|
|
132
|
+
ve.__reactDisabledLog = !0;
|
|
133
|
+
function Ve() {
|
|
134
|
+
{
|
|
135
|
+
if (M === 0) {
|
|
136
|
+
se = console.log, ie = console.info, ce = console.warn, le = console.error, ue = console.group, fe = console.groupCollapsed, de = console.groupEnd;
|
|
137
|
+
var e = {
|
|
138
|
+
configurable: !0,
|
|
139
|
+
enumerable: !0,
|
|
140
|
+
value: ve,
|
|
141
|
+
writable: !0
|
|
142
|
+
};
|
|
143
|
+
Object.defineProperties(console, {
|
|
144
|
+
info: e,
|
|
145
|
+
log: e,
|
|
146
|
+
warn: e,
|
|
147
|
+
error: e,
|
|
148
|
+
group: e,
|
|
149
|
+
groupCollapsed: e,
|
|
150
|
+
groupEnd: e
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
M++;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
function Ue() {
|
|
157
|
+
{
|
|
158
|
+
if (M--, M === 0) {
|
|
159
|
+
var e = {
|
|
160
|
+
configurable: !0,
|
|
161
|
+
enumerable: !0,
|
|
162
|
+
writable: !0
|
|
163
|
+
};
|
|
164
|
+
Object.defineProperties(console, {
|
|
165
|
+
log: A({}, e, {
|
|
166
|
+
value: se
|
|
167
|
+
}),
|
|
168
|
+
info: A({}, e, {
|
|
169
|
+
value: ie
|
|
170
|
+
}),
|
|
171
|
+
warn: A({}, e, {
|
|
172
|
+
value: ce
|
|
173
|
+
}),
|
|
174
|
+
error: A({}, e, {
|
|
175
|
+
value: le
|
|
176
|
+
}),
|
|
177
|
+
group: A({}, e, {
|
|
178
|
+
value: ue
|
|
179
|
+
}),
|
|
180
|
+
groupCollapsed: A({}, e, {
|
|
181
|
+
value: fe
|
|
182
|
+
}),
|
|
183
|
+
groupEnd: A({}, e, {
|
|
184
|
+
value: de
|
|
185
|
+
})
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
M < 0 && E("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
var K = j.ReactCurrentDispatcher, G;
|
|
192
|
+
function z(e, r, t) {
|
|
193
|
+
{
|
|
194
|
+
if (G === void 0)
|
|
195
|
+
try {
|
|
196
|
+
throw Error();
|
|
197
|
+
} catch (d) {
|
|
198
|
+
var a = d.stack.trim().match(/\n( *(at )?)/);
|
|
199
|
+
G = a && a[1] || "";
|
|
200
|
+
}
|
|
201
|
+
return `
|
|
202
|
+
` + G + e;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
var H = !1, B;
|
|
206
|
+
{
|
|
207
|
+
var ze = typeof WeakMap == "function" ? WeakMap : Map;
|
|
208
|
+
B = new ze();
|
|
209
|
+
}
|
|
210
|
+
function pe(e, r) {
|
|
211
|
+
if (!e || H)
|
|
212
|
+
return "";
|
|
213
|
+
{
|
|
214
|
+
var t = B.get(e);
|
|
215
|
+
if (t !== void 0)
|
|
216
|
+
return t;
|
|
217
|
+
}
|
|
218
|
+
var a;
|
|
219
|
+
H = !0;
|
|
220
|
+
var d = Error.prepareStackTrace;
|
|
221
|
+
Error.prepareStackTrace = void 0;
|
|
222
|
+
var v;
|
|
223
|
+
v = K.current, K.current = null, Ve();
|
|
224
|
+
try {
|
|
225
|
+
if (r) {
|
|
226
|
+
var u = function() {
|
|
227
|
+
throw Error();
|
|
228
|
+
};
|
|
229
|
+
if (Object.defineProperty(u.prototype, "props", {
|
|
230
|
+
set: function() {
|
|
231
|
+
throw Error();
|
|
232
|
+
}
|
|
233
|
+
}), typeof Reflect == "object" && Reflect.construct) {
|
|
234
|
+
try {
|
|
235
|
+
Reflect.construct(u, []);
|
|
236
|
+
} catch (C) {
|
|
237
|
+
a = C;
|
|
238
|
+
}
|
|
239
|
+
Reflect.construct(e, [], u);
|
|
240
|
+
} else {
|
|
241
|
+
try {
|
|
242
|
+
u.call();
|
|
243
|
+
} catch (C) {
|
|
244
|
+
a = C;
|
|
245
|
+
}
|
|
246
|
+
e.call(u.prototype);
|
|
247
|
+
}
|
|
248
|
+
} else {
|
|
249
|
+
try {
|
|
250
|
+
throw Error();
|
|
251
|
+
} catch (C) {
|
|
252
|
+
a = C;
|
|
253
|
+
}
|
|
254
|
+
e();
|
|
255
|
+
}
|
|
256
|
+
} catch (C) {
|
|
257
|
+
if (C && a && typeof C.stack == "string") {
|
|
258
|
+
for (var c = C.stack.split(`
|
|
259
|
+
`), _ = a.stack.split(`
|
|
260
|
+
`), m = c.length - 1, b = _.length - 1; m >= 1 && b >= 0 && c[m] !== _[b]; )
|
|
261
|
+
b--;
|
|
262
|
+
for (; m >= 1 && b >= 0; m--, b--)
|
|
263
|
+
if (c[m] !== _[b]) {
|
|
264
|
+
if (m !== 1 || b !== 1)
|
|
265
|
+
do
|
|
266
|
+
if (m--, b--, b < 0 || c[m] !== _[b]) {
|
|
267
|
+
var w = `
|
|
268
|
+
` + c[m].replace(" at new ", " at ");
|
|
269
|
+
return e.displayName && w.includes("<anonymous>") && (w = w.replace("<anonymous>", e.displayName)), typeof e == "function" && B.set(e, w), w;
|
|
270
|
+
}
|
|
271
|
+
while (m >= 1 && b >= 0);
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
} finally {
|
|
276
|
+
H = !1, K.current = v, Ue(), Error.prepareStackTrace = d;
|
|
277
|
+
}
|
|
278
|
+
var W = e ? e.displayName || e.name : "", F = W ? z(W) : "";
|
|
279
|
+
return typeof e == "function" && B.set(e, F), F;
|
|
280
|
+
}
|
|
281
|
+
function Be(e, r, t) {
|
|
282
|
+
return pe(e, !1);
|
|
283
|
+
}
|
|
284
|
+
function Je(e) {
|
|
285
|
+
var r = e.prototype;
|
|
286
|
+
return !!(r && r.isReactComponent);
|
|
287
|
+
}
|
|
288
|
+
function J(e, r, t) {
|
|
289
|
+
if (e == null)
|
|
290
|
+
return "";
|
|
291
|
+
if (typeof e == "function")
|
|
292
|
+
return pe(e, Je(e));
|
|
293
|
+
if (typeof e == "string")
|
|
294
|
+
return z(e);
|
|
295
|
+
switch (e) {
|
|
296
|
+
case T:
|
|
297
|
+
return z("Suspense");
|
|
298
|
+
case p:
|
|
299
|
+
return z("SuspenseList");
|
|
300
|
+
}
|
|
301
|
+
if (typeof e == "object")
|
|
302
|
+
switch (e.$$typeof) {
|
|
303
|
+
case h:
|
|
304
|
+
return Be(e.render);
|
|
305
|
+
case R:
|
|
306
|
+
return J(e.type, r, t);
|
|
307
|
+
case S: {
|
|
308
|
+
var a = e, d = a._payload, v = a._init;
|
|
309
|
+
try {
|
|
310
|
+
return J(v(d), r, t);
|
|
311
|
+
} catch {
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
return "";
|
|
316
|
+
}
|
|
317
|
+
var L = Object.prototype.hasOwnProperty, he = {}, me = j.ReactDebugCurrentFrame;
|
|
318
|
+
function q(e) {
|
|
319
|
+
if (e) {
|
|
320
|
+
var r = e._owner, t = J(e.type, e._source, r ? r.type : null);
|
|
321
|
+
me.setExtraStackFrame(t);
|
|
322
|
+
} else
|
|
323
|
+
me.setExtraStackFrame(null);
|
|
324
|
+
}
|
|
325
|
+
function qe(e, r, t, a, d) {
|
|
326
|
+
{
|
|
327
|
+
var v = Function.call.bind(L);
|
|
328
|
+
for (var u in e)
|
|
329
|
+
if (v(e, u)) {
|
|
330
|
+
var c = void 0;
|
|
331
|
+
try {
|
|
332
|
+
if (typeof e[u] != "function") {
|
|
333
|
+
var _ = Error((a || "React class") + ": " + t + " type `" + u + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[u] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
334
|
+
throw _.name = "Invariant Violation", _;
|
|
335
|
+
}
|
|
336
|
+
c = e[u](r, u, a, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
337
|
+
} catch (m) {
|
|
338
|
+
c = m;
|
|
339
|
+
}
|
|
340
|
+
c && !(c instanceof Error) && (q(d), E("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", a || "React class", t, u, typeof c), q(null)), c instanceof Error && !(c.message in he) && (he[c.message] = !0, q(d), E("Failed %s type: %s", t, c.message), q(null));
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
var Ke = Array.isArray;
|
|
345
|
+
function X(e) {
|
|
346
|
+
return Ke(e);
|
|
347
|
+
}
|
|
348
|
+
function Ge(e) {
|
|
349
|
+
{
|
|
350
|
+
var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
351
|
+
return t;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
function He(e) {
|
|
355
|
+
try {
|
|
356
|
+
return be(e), !1;
|
|
357
|
+
} catch {
|
|
358
|
+
return !0;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
function be(e) {
|
|
362
|
+
return "" + e;
|
|
363
|
+
}
|
|
364
|
+
function ge(e) {
|
|
365
|
+
if (He(e))
|
|
366
|
+
return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ge(e)), be(e);
|
|
367
|
+
}
|
|
368
|
+
var xe = j.ReactCurrentOwner, Xe = {
|
|
369
|
+
key: !0,
|
|
370
|
+
ref: !0,
|
|
371
|
+
__self: !0,
|
|
372
|
+
__source: !0
|
|
373
|
+
}, ye, Re;
|
|
374
|
+
function Qe(e) {
|
|
375
|
+
if (L.call(e, "ref")) {
|
|
376
|
+
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
377
|
+
if (r && r.isReactWarning)
|
|
378
|
+
return !1;
|
|
379
|
+
}
|
|
380
|
+
return e.ref !== void 0;
|
|
381
|
+
}
|
|
382
|
+
function Ze(e) {
|
|
383
|
+
if (L.call(e, "key")) {
|
|
384
|
+
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
385
|
+
if (r && r.isReactWarning)
|
|
386
|
+
return !1;
|
|
387
|
+
}
|
|
388
|
+
return e.key !== void 0;
|
|
389
|
+
}
|
|
390
|
+
function er(e, r) {
|
|
391
|
+
typeof e.ref == "string" && xe.current;
|
|
392
|
+
}
|
|
393
|
+
function rr(e, r) {
|
|
394
|
+
{
|
|
395
|
+
var t = function() {
|
|
396
|
+
ye || (ye = !0, E("%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://reactjs.org/link/special-props)", r));
|
|
397
|
+
};
|
|
398
|
+
t.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
399
|
+
get: t,
|
|
400
|
+
configurable: !0
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
function tr(e, r) {
|
|
405
|
+
{
|
|
406
|
+
var t = function() {
|
|
407
|
+
Re || (Re = !0, E("%s: `ref` 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://reactjs.org/link/special-props)", r));
|
|
408
|
+
};
|
|
409
|
+
t.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
410
|
+
get: t,
|
|
411
|
+
configurable: !0
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
var nr = function(e, r, t, a, d, v, u) {
|
|
416
|
+
var c = {
|
|
417
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
418
|
+
$$typeof: n,
|
|
419
|
+
// Built-in properties that belong on the element
|
|
420
|
+
type: e,
|
|
421
|
+
key: r,
|
|
422
|
+
ref: t,
|
|
423
|
+
props: u,
|
|
424
|
+
// Record the component responsible for creating this element.
|
|
425
|
+
_owner: v
|
|
426
|
+
};
|
|
427
|
+
return c._store = {}, Object.defineProperty(c._store, "validated", {
|
|
428
|
+
configurable: !1,
|
|
429
|
+
enumerable: !1,
|
|
430
|
+
writable: !0,
|
|
431
|
+
value: !1
|
|
432
|
+
}), Object.defineProperty(c, "_self", {
|
|
433
|
+
configurable: !1,
|
|
434
|
+
enumerable: !1,
|
|
435
|
+
writable: !1,
|
|
436
|
+
value: a
|
|
437
|
+
}), Object.defineProperty(c, "_source", {
|
|
438
|
+
configurable: !1,
|
|
439
|
+
enumerable: !1,
|
|
440
|
+
writable: !1,
|
|
441
|
+
value: d
|
|
442
|
+
}), Object.freeze && (Object.freeze(c.props), Object.freeze(c)), c;
|
|
443
|
+
};
|
|
444
|
+
function ar(e, r, t, a, d) {
|
|
445
|
+
{
|
|
446
|
+
var v, u = {}, c = null, _ = null;
|
|
447
|
+
t !== void 0 && (ge(t), c = "" + t), Ze(r) && (ge(r.key), c = "" + r.key), Qe(r) && (_ = r.ref, er(r, d));
|
|
448
|
+
for (v in r)
|
|
449
|
+
L.call(r, v) && !Xe.hasOwnProperty(v) && (u[v] = r[v]);
|
|
450
|
+
if (e && e.defaultProps) {
|
|
451
|
+
var m = e.defaultProps;
|
|
452
|
+
for (v in m)
|
|
453
|
+
u[v] === void 0 && (u[v] = m[v]);
|
|
454
|
+
}
|
|
455
|
+
if (c || _) {
|
|
456
|
+
var b = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
457
|
+
c && rr(u, b), _ && tr(u, b);
|
|
458
|
+
}
|
|
459
|
+
return nr(e, c, _, d, a, xe.current, u);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
var Q = j.ReactCurrentOwner, Ee = j.ReactDebugCurrentFrame;
|
|
463
|
+
function I(e) {
|
|
464
|
+
if (e) {
|
|
465
|
+
var r = e._owner, t = J(e.type, e._source, r ? r.type : null);
|
|
466
|
+
Ee.setExtraStackFrame(t);
|
|
467
|
+
} else
|
|
468
|
+
Ee.setExtraStackFrame(null);
|
|
469
|
+
}
|
|
470
|
+
var Z;
|
|
471
|
+
Z = !1;
|
|
472
|
+
function ee(e) {
|
|
473
|
+
return typeof e == "object" && e !== null && e.$$typeof === n;
|
|
474
|
+
}
|
|
475
|
+
function _e() {
|
|
476
|
+
{
|
|
477
|
+
if (Q.current) {
|
|
478
|
+
var e = D(Q.current.type);
|
|
479
|
+
if (e)
|
|
480
|
+
return `
|
|
481
|
+
|
|
482
|
+
Check the render method of \`` + e + "`.";
|
|
483
|
+
}
|
|
484
|
+
return "";
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
function or(e) {
|
|
488
|
+
return "";
|
|
489
|
+
}
|
|
490
|
+
var Ce = {};
|
|
491
|
+
function sr(e) {
|
|
492
|
+
{
|
|
493
|
+
var r = _e();
|
|
494
|
+
if (!r) {
|
|
495
|
+
var t = typeof e == "string" ? e : e.displayName || e.name;
|
|
496
|
+
t && (r = `
|
|
497
|
+
|
|
498
|
+
Check the top-level render call using <` + t + ">.");
|
|
499
|
+
}
|
|
500
|
+
return r;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
function Te(e, r) {
|
|
504
|
+
{
|
|
505
|
+
if (!e._store || e._store.validated || e.key != null)
|
|
506
|
+
return;
|
|
507
|
+
e._store.validated = !0;
|
|
508
|
+
var t = sr(r);
|
|
509
|
+
if (Ce[t])
|
|
510
|
+
return;
|
|
511
|
+
Ce[t] = !0;
|
|
512
|
+
var a = "";
|
|
513
|
+
e && e._owner && e._owner !== Q.current && (a = " It was passed a child from " + D(e._owner.type) + "."), I(e), E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, a), I(null);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
function je(e, r) {
|
|
517
|
+
{
|
|
518
|
+
if (typeof e != "object")
|
|
519
|
+
return;
|
|
520
|
+
if (X(e))
|
|
521
|
+
for (var t = 0; t < e.length; t++) {
|
|
522
|
+
var a = e[t];
|
|
523
|
+
ee(a) && Te(a, r);
|
|
524
|
+
}
|
|
525
|
+
else if (ee(e))
|
|
526
|
+
e._store && (e._store.validated = !0);
|
|
527
|
+
else if (e) {
|
|
528
|
+
var d = O(e);
|
|
529
|
+
if (typeof d == "function" && d !== e.entries)
|
|
530
|
+
for (var v = d.call(e), u; !(u = v.next()).done; )
|
|
531
|
+
ee(u.value) && Te(u.value, r);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
function ir(e) {
|
|
536
|
+
{
|
|
537
|
+
var r = e.type;
|
|
538
|
+
if (r == null || typeof r == "string")
|
|
539
|
+
return;
|
|
540
|
+
var t;
|
|
541
|
+
if (typeof r == "function")
|
|
542
|
+
t = r.propTypes;
|
|
543
|
+
else if (typeof r == "object" && (r.$$typeof === h || // Note: Memo only checks outer props here.
|
|
544
|
+
// Inner props are checked in the reconciler.
|
|
545
|
+
r.$$typeof === R))
|
|
546
|
+
t = r.propTypes;
|
|
547
|
+
else
|
|
548
|
+
return;
|
|
549
|
+
if (t) {
|
|
550
|
+
var a = D(r);
|
|
551
|
+
qe(t, e.props, "prop", a, e);
|
|
552
|
+
} else if (r.PropTypes !== void 0 && !Z) {
|
|
553
|
+
Z = !0;
|
|
554
|
+
var d = D(r);
|
|
555
|
+
E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", d || "Unknown");
|
|
556
|
+
}
|
|
557
|
+
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
function cr(e) {
|
|
561
|
+
{
|
|
562
|
+
for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
|
|
563
|
+
var a = r[t];
|
|
564
|
+
if (a !== "children" && a !== "key") {
|
|
565
|
+
I(e), E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", a), I(null);
|
|
566
|
+
break;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
e.ref !== null && (I(e), E("Invalid attribute `ref` supplied to `React.Fragment`."), I(null));
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
var we = {};
|
|
573
|
+
function Se(e, r, t, a, d, v) {
|
|
574
|
+
{
|
|
575
|
+
var u = Le(e);
|
|
576
|
+
if (!u) {
|
|
577
|
+
var c = "";
|
|
578
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (c += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
579
|
+
var _ = or();
|
|
580
|
+
_ ? c += _ : c += _e();
|
|
581
|
+
var m;
|
|
582
|
+
e === null ? m = "null" : X(e) ? m = "array" : e !== void 0 && e.$$typeof === n ? (m = "<" + (D(e.type) || "Unknown") + " />", c = " Did you accidentally export a JSX literal instead of a component?") : m = typeof e, E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", m, c);
|
|
583
|
+
}
|
|
584
|
+
var b = ar(e, r, t, d, v);
|
|
585
|
+
if (b == null)
|
|
586
|
+
return b;
|
|
587
|
+
if (u) {
|
|
588
|
+
var w = r.children;
|
|
589
|
+
if (w !== void 0)
|
|
590
|
+
if (a)
|
|
591
|
+
if (X(w)) {
|
|
592
|
+
for (var W = 0; W < w.length; W++)
|
|
593
|
+
je(w[W], e);
|
|
594
|
+
Object.freeze && Object.freeze(w);
|
|
595
|
+
} else
|
|
596
|
+
E("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
597
|
+
else
|
|
598
|
+
je(w, e);
|
|
599
|
+
}
|
|
600
|
+
if (L.call(r, "key")) {
|
|
601
|
+
var F = D(e), C = Object.keys(r).filter(function(pr) {
|
|
602
|
+
return pr !== "key";
|
|
603
|
+
}), re = C.length > 0 ? "{key: someKey, " + C.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
604
|
+
if (!we[F + re]) {
|
|
605
|
+
var vr = C.length > 0 ? "{" + C.join(": ..., ") + ": ...}" : "{}";
|
|
606
|
+
E(`A props object containing a "key" prop is being spread into JSX:
|
|
607
|
+
let props = %s;
|
|
608
|
+
<%s {...props} />
|
|
609
|
+
React keys must be passed directly to JSX without using spread:
|
|
610
|
+
let props = %s;
|
|
611
|
+
<%s key={someKey} {...props} />`, re, F, vr, F), we[F + re] = !0;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
return e === s ? cr(b) : ir(b), b;
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
function lr(e, r, t) {
|
|
618
|
+
return Se(e, r, t, !0);
|
|
619
|
+
}
|
|
620
|
+
function ur(e, r, t) {
|
|
621
|
+
return Se(e, r, t, !1);
|
|
622
|
+
}
|
|
623
|
+
var fr = ur, dr = lr;
|
|
624
|
+
U.Fragment = s, U.jsx = fr, U.jsxs = dr;
|
|
625
|
+
}()), U;
|
|
626
|
+
}
|
|
627
|
+
process.env.NODE_ENV === "production" ? te.exports = yr() : te.exports = Rr();
|
|
628
|
+
var l = te.exports;
|
|
629
|
+
const k = {
|
|
630
|
+
colors: {
|
|
631
|
+
background: "#ffffff",
|
|
632
|
+
surface: "#f8fafc",
|
|
633
|
+
primary: "#0ea5e9",
|
|
634
|
+
secondary: "#6366f1",
|
|
635
|
+
text: "#0f172a",
|
|
636
|
+
muted: "#64748b",
|
|
637
|
+
border: "#e2e8f0",
|
|
638
|
+
highlight: "#f1f5f9"
|
|
639
|
+
},
|
|
640
|
+
spacing: {
|
|
641
|
+
xs: "4px",
|
|
642
|
+
sm: "8px",
|
|
643
|
+
md: "16px",
|
|
644
|
+
lg: "24px",
|
|
645
|
+
xl: "32px"
|
|
646
|
+
},
|
|
647
|
+
typography: {
|
|
648
|
+
font: "Inter, system-ui, -apple-system, sans-serif",
|
|
649
|
+
sizes: {
|
|
650
|
+
xs: "12px",
|
|
651
|
+
sm: "14px",
|
|
652
|
+
md: "16px",
|
|
653
|
+
lg: "18px",
|
|
654
|
+
xl: "20px"
|
|
655
|
+
},
|
|
656
|
+
weights: {
|
|
657
|
+
normal: 400,
|
|
658
|
+
medium: 500,
|
|
659
|
+
bold: 700
|
|
660
|
+
}
|
|
661
|
+
},
|
|
662
|
+
borderRadius: {
|
|
663
|
+
sm: "4px",
|
|
664
|
+
md: "8px",
|
|
665
|
+
lg: "12px",
|
|
666
|
+
xl: "16px"
|
|
667
|
+
},
|
|
668
|
+
shadows: {
|
|
669
|
+
sm: "0 1px 2px rgba(0, 0, 0, 0.05)",
|
|
670
|
+
md: "0 4px 6px rgba(0, 0, 0, 0.1)",
|
|
671
|
+
lg: "0 10px 15px rgba(0, 0, 0, 0.1)"
|
|
672
|
+
}
|
|
673
|
+
}, Cr = {
|
|
674
|
+
...k,
|
|
675
|
+
colors: {
|
|
676
|
+
...k.colors,
|
|
677
|
+
background: "#ffffff",
|
|
678
|
+
surface: "#f8fafc",
|
|
679
|
+
text: "#0f172a",
|
|
680
|
+
muted: "#64748b",
|
|
681
|
+
border: "#e2e8f0",
|
|
682
|
+
highlight: "#f1f5f9"
|
|
683
|
+
}
|
|
684
|
+
}, Tr = {
|
|
685
|
+
...k,
|
|
686
|
+
colors: {
|
|
687
|
+
...k.colors,
|
|
688
|
+
background: "#0f172a",
|
|
689
|
+
surface: "#1e293b",
|
|
690
|
+
text: "#f8fafc",
|
|
691
|
+
muted: "#94a3b8",
|
|
692
|
+
border: "#334155",
|
|
693
|
+
highlight: "#1e293b"
|
|
694
|
+
}
|
|
695
|
+
}, Ne = hr(void 0), jr = ({
|
|
696
|
+
children: i,
|
|
697
|
+
initialTheme: n = k,
|
|
698
|
+
initialThemeMode: o = "light",
|
|
699
|
+
initialContent: s
|
|
700
|
+
}) => {
|
|
701
|
+
const [f, g] = Y(n), [y, x] = Y(o), [h, T] = Y(s), [p, R] = Y("side-by-side"), [S, P] = Y(0.4);
|
|
702
|
+
Pe(() => {
|
|
703
|
+
const $ = () => {
|
|
704
|
+
const O = y === "dark" || y === "system" && window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
705
|
+
g(O ? {
|
|
706
|
+
...k,
|
|
707
|
+
colors: {
|
|
708
|
+
...k.colors,
|
|
709
|
+
background: "#0f172a",
|
|
710
|
+
surface: "#1e293b",
|
|
711
|
+
text: "#f8fafc",
|
|
712
|
+
muted: "#94a3b8",
|
|
713
|
+
border: "#334155",
|
|
714
|
+
highlight: "#1e293b"
|
|
715
|
+
}
|
|
716
|
+
} : {
|
|
717
|
+
...k,
|
|
718
|
+
colors: {
|
|
719
|
+
...k.colors,
|
|
720
|
+
background: "#ffffff",
|
|
721
|
+
surface: "#f8fafc",
|
|
722
|
+
text: "#0f172a",
|
|
723
|
+
muted: "#64748b",
|
|
724
|
+
border: "#e2e8f0",
|
|
725
|
+
highlight: "#f1f5f9"
|
|
726
|
+
}
|
|
727
|
+
});
|
|
728
|
+
};
|
|
729
|
+
if ($(), y === "system") {
|
|
730
|
+
const O = window.matchMedia("(prefers-color-scheme: dark)"), j = () => $();
|
|
731
|
+
return O.addEventListener("change", j), () => O.removeEventListener("change", j);
|
|
732
|
+
}
|
|
733
|
+
}, [y]);
|
|
734
|
+
const N = {
|
|
735
|
+
theme: f,
|
|
736
|
+
setTheme: g,
|
|
737
|
+
themeMode: y,
|
|
738
|
+
setThemeMode: x
|
|
739
|
+
};
|
|
740
|
+
return /* @__PURE__ */ l.jsx(Ne.Provider, { value: N, children: i });
|
|
741
|
+
}, De = () => {
|
|
742
|
+
const i = mr(Ne);
|
|
743
|
+
if (i === void 0)
|
|
744
|
+
throw new Error("useCanvas must be used within a CanvasProvider");
|
|
745
|
+
return i;
|
|
746
|
+
}, wr = () => {
|
|
747
|
+
const { content: i, setCanvasContent: n } = De();
|
|
748
|
+
return { content: i, setContent: n };
|
|
749
|
+
}, Sr = () => {
|
|
750
|
+
const { layout: i, widthRatio: n, setCanvasLayout: o, setCanvasWidthRatio: s } = De();
|
|
751
|
+
return { layout: i, widthRatio: n, setLayout: o, setWidthRatio: s };
|
|
752
|
+
}, Or = ({
|
|
753
|
+
children: i,
|
|
754
|
+
theme: n,
|
|
755
|
+
className: o = ""
|
|
756
|
+
}) => {
|
|
757
|
+
const s = {
|
|
758
|
+
container: `
|
|
759
|
+
w-full h-full
|
|
760
|
+
bg-[${n.colors.background}]
|
|
761
|
+
border-[${n.colors.border}]
|
|
762
|
+
rounded-xl
|
|
763
|
+
overflow-hidden
|
|
764
|
+
${o}
|
|
765
|
+
`,
|
|
766
|
+
header: `
|
|
767
|
+
px-6 py-4
|
|
768
|
+
border-b-[1px]
|
|
769
|
+
border-[${n.colors.border}]
|
|
770
|
+
bg-[${n.colors.surface}]
|
|
771
|
+
`,
|
|
772
|
+
toolbar: `
|
|
773
|
+
flex items-center justify-between
|
|
774
|
+
px-6 py-3
|
|
775
|
+
border-b-[1px]
|
|
776
|
+
border-[${n.colors.border}]
|
|
777
|
+
bg-[${n.colors.surface}]
|
|
778
|
+
`
|
|
779
|
+
};
|
|
780
|
+
return /* @__PURE__ */ l.jsx("div", { className: s.container, children: i });
|
|
781
|
+
}, kr = ({
|
|
782
|
+
title: i,
|
|
783
|
+
description: n,
|
|
784
|
+
theme: o
|
|
785
|
+
}) => /* @__PURE__ */ l.jsxs("div", { className: `
|
|
786
|
+
px-6 py-4
|
|
787
|
+
border-b-[1px]
|
|
788
|
+
border-[${o.colors.border}]
|
|
789
|
+
bg-[${o.colors.surface}]
|
|
790
|
+
`, children: [
|
|
791
|
+
i && /* @__PURE__ */ l.jsx("h2", { className: `text-xl font-bold text-[${o.colors.text}] mb-1`, children: i }),
|
|
792
|
+
n && /* @__PURE__ */ l.jsx("p", { className: `text-sm text-[${o.colors.muted}]`, children: n })
|
|
793
|
+
] }), Pr = ({
|
|
794
|
+
children: i,
|
|
795
|
+
theme: n
|
|
796
|
+
}) => /* @__PURE__ */ l.jsx("div", { className: `
|
|
797
|
+
flex-1
|
|
798
|
+
overflow-y-auto
|
|
799
|
+
p-6
|
|
800
|
+
bg-[${n.colors.background}]
|
|
801
|
+
`, children: i }), Nr = ({
|
|
802
|
+
children: i,
|
|
803
|
+
theme: n
|
|
804
|
+
}) => /* @__PURE__ */ l.jsx("div", { className: `
|
|
805
|
+
flex items-center justify-between
|
|
806
|
+
px-6 py-3
|
|
807
|
+
border-b-[1px]
|
|
808
|
+
border-[${n.colors.border}]
|
|
809
|
+
bg-[${n.colors.surface}]
|
|
810
|
+
`, children: i }), Dr = ({ content: i, theme: n }) => {
|
|
811
|
+
const o = br(null);
|
|
812
|
+
return Pe(() => {
|
|
813
|
+
if (!o.current) return;
|
|
814
|
+
const s = o.current, f = s.getContext("2d");
|
|
815
|
+
if (!f) return;
|
|
816
|
+
const { data: g, options: y = {} } = i, { colors: x = [] } = y, h = s.width, T = s.height, p = 40, R = (h - p * 2) / g.labels.length - 10, S = Math.max(...g.values, 1);
|
|
817
|
+
g.values.forEach((P, N) => {
|
|
818
|
+
const $ = P / S * (T - p * 2), O = p + N * (R + 10), j = T - p - $;
|
|
819
|
+
f.fillStyle = x[N % x.length] || n.colors.primary, f.fillRect(O, j, R, $), f.fillStyle = n.colors.text, f.font = "12px sans-serif", f.textAlign = "center", f.fillText(g.labels[N], O + R / 2, T - p + 20), f.fillStyle = n.colors.muted, f.fillText(P.toString(), O + R / 2, j - 10);
|
|
820
|
+
}), f.strokeStyle = n.colors.border, f.lineWidth = 1, f.beginPath(), f.moveTo(p, p), f.lineTo(p, T - p), f.lineTo(h - p, T - p), f.stroke();
|
|
821
|
+
}, [i, n]), /* @__PURE__ */ l.jsx("div", { className: "chart-renderer", children: /* @__PURE__ */ l.jsx(
|
|
822
|
+
"canvas",
|
|
823
|
+
{
|
|
824
|
+
ref: o,
|
|
825
|
+
width: 600,
|
|
826
|
+
height: 300,
|
|
827
|
+
style: { width: "100%", height: "auto" }
|
|
828
|
+
}
|
|
829
|
+
) });
|
|
830
|
+
}, $r = ({ content: i, theme: n }) => {
|
|
831
|
+
const { events: o, options: s = {} } = i, { orientation: f = "horizontal", compact: g = !1 } = s, y = f === "horizontal";
|
|
832
|
+
return /* @__PURE__ */ l.jsx("div", { className: "timeline-renderer", children: /* @__PURE__ */ l.jsx("div", { className: `timeline ${y ? "timeline-horizontal" : "timeline-vertical"}`, children: o.map((x, h) => /* @__PURE__ */ l.jsxs("div", { className: "timeline-item", children: [
|
|
833
|
+
/* @__PURE__ */ l.jsx("div", { className: "timeline-marker", children: /* @__PURE__ */ l.jsx("div", { className: "marker-dot" }) }),
|
|
834
|
+
/* @__PURE__ */ l.jsxs("div", { className: "timeline-content", children: [
|
|
835
|
+
/* @__PURE__ */ l.jsx("div", { className: "timeline-date", children: x.date }),
|
|
836
|
+
/* @__PURE__ */ l.jsx("div", { className: "timeline-title", children: x.title }),
|
|
837
|
+
x.description && /* @__PURE__ */ l.jsx("div", { className: "timeline-description", children: x.description })
|
|
838
|
+
] })
|
|
839
|
+
] }, h)) }) });
|
|
840
|
+
}, Ar = ({ content: i, theme: n }) => {
|
|
841
|
+
const [o, s] = ne.useState(!1), f = () => {
|
|
842
|
+
navigator.clipboard.writeText(i.code), s(!0), setTimeout(() => s(!1), 2e3);
|
|
843
|
+
};
|
|
844
|
+
return /* @__PURE__ */ l.jsxs("div", { className: "code-renderer", children: [
|
|
845
|
+
/* @__PURE__ */ l.jsxs("div", { className: "code-header", children: [
|
|
846
|
+
/* @__PURE__ */ l.jsx("span", { className: "code-language", children: i.language }),
|
|
847
|
+
i.filename && /* @__PURE__ */ l.jsx("span", { className: "code-filename", children: i.filename }),
|
|
848
|
+
/* @__PURE__ */ l.jsx(
|
|
849
|
+
"button",
|
|
850
|
+
{
|
|
851
|
+
onClick: f,
|
|
852
|
+
className: "code-copy-button",
|
|
853
|
+
style: { color: n.colors.primary },
|
|
854
|
+
children: o ? /* @__PURE__ */ l.jsx(gr, { size: 16 }) : /* @__PURE__ */ l.jsx(xr, { size: 16 })
|
|
855
|
+
}
|
|
856
|
+
)
|
|
857
|
+
] }),
|
|
858
|
+
/* @__PURE__ */ l.jsx("pre", { className: "code-content", children: /* @__PURE__ */ l.jsx("code", { children: i.code }) })
|
|
859
|
+
] });
|
|
860
|
+
}, Fr = ({ content: i, theme: n }) => /* @__PURE__ */ l.jsx("div", { className: "document-renderer", children: /* @__PURE__ */ l.jsxs("div", { className: "document-content", children: [
|
|
861
|
+
/* @__PURE__ */ l.jsx("h3", { className: "document-title", style: { color: n.colors.text }, children: i.title }),
|
|
862
|
+
/* @__PURE__ */ l.jsx("div", { className: "document-body", style: { color: n.colors.text }, children: i.content })
|
|
863
|
+
] }) }), Ir = ({ content: i, theme: n }) => {
|
|
864
|
+
const { component: o, props: s = {} } = i;
|
|
865
|
+
return o ? /* @__PURE__ */ l.jsx("div", { className: "custom-renderer", style: { color: n.colors.text }, children: /* @__PURE__ */ l.jsx(o, { ...s }) }) : /* @__PURE__ */ l.jsx("div", { className: "custom-renderer", style: { color: n.colors.text }, children: /* @__PURE__ */ l.jsx("p", { children: "No custom component provided" }) });
|
|
866
|
+
};
|
|
867
|
+
class Wr {
|
|
868
|
+
/**
|
|
869
|
+
* Detect the content type from a string
|
|
870
|
+
*/
|
|
871
|
+
static detectType(n) {
|
|
872
|
+
const o = n.trim();
|
|
873
|
+
return o.includes("```") || /[\n\s]*\w+\s*=\s*\{/.test(o) ? "code" : o.includes("#") || o.includes("##") ? "document" : /\d{4}-\d{2}-\d{2}/.test(o) ? "timeline" : /\d+\s*%|\[\s*\d+\s*,\s*\d+\s*\]/.test(o) ? "chart" : "custom";
|
|
874
|
+
}
|
|
875
|
+
/**
|
|
876
|
+
* Extract chart data from content
|
|
877
|
+
*/
|
|
878
|
+
static extractChartData(n) {
|
|
879
|
+
const o = n.match(/-?\d+(\.\d+)?/g);
|
|
880
|
+
if (!o) return null;
|
|
881
|
+
const s = o.map(Number), f = s.slice(0, Math.ceil(s.length / 2)), g = s.slice(Math.ceil(s.length / 2));
|
|
882
|
+
return {
|
|
883
|
+
labels: f,
|
|
884
|
+
values: g
|
|
885
|
+
};
|
|
886
|
+
}
|
|
887
|
+
/**
|
|
888
|
+
* Extract timeline events from content
|
|
889
|
+
*/
|
|
890
|
+
static extractTimelineEvents(n) {
|
|
891
|
+
const o = n.split(`
|
|
892
|
+
`), s = [];
|
|
893
|
+
return o.forEach((f) => {
|
|
894
|
+
const g = f.match(/(\d{4}-\d{2}-\d{2})/);
|
|
895
|
+
g && s.push({
|
|
896
|
+
date: g[1],
|
|
897
|
+
title: f.replace(g[0], "").trim(),
|
|
898
|
+
description: ""
|
|
899
|
+
});
|
|
900
|
+
}), s.length > 0 ? s : null;
|
|
901
|
+
}
|
|
902
|
+
/**
|
|
903
|
+
* Extract code from content
|
|
904
|
+
*/
|
|
905
|
+
static extractCode(n) {
|
|
906
|
+
const o = n.match(/```(\w+)?\n([\s\S]*?)```/);
|
|
907
|
+
return o ? {
|
|
908
|
+
code: o[2],
|
|
909
|
+
language: o[1] || "text"
|
|
910
|
+
} : null;
|
|
911
|
+
}
|
|
912
|
+
/**
|
|
913
|
+
* Analyze content and return appropriate content object
|
|
914
|
+
*/
|
|
915
|
+
static analyze(n) {
|
|
916
|
+
switch (this.detectType(n)) {
|
|
917
|
+
case "chart":
|
|
918
|
+
return {
|
|
919
|
+
type: "chart",
|
|
920
|
+
data: this.extractChartData(n) || { labels: [], values: [] }
|
|
921
|
+
};
|
|
922
|
+
case "timeline":
|
|
923
|
+
return {
|
|
924
|
+
type: "timeline",
|
|
925
|
+
events: this.extractTimelineEvents(n) || []
|
|
926
|
+
};
|
|
927
|
+
case "code": {
|
|
928
|
+
const s = this.extractCode(n);
|
|
929
|
+
return {
|
|
930
|
+
type: "code",
|
|
931
|
+
code: (s == null ? void 0 : s.code) || n,
|
|
932
|
+
language: (s == null ? void 0 : s.language) || "text"
|
|
933
|
+
};
|
|
934
|
+
}
|
|
935
|
+
case "document":
|
|
936
|
+
return {
|
|
937
|
+
type: "document",
|
|
938
|
+
content: n
|
|
939
|
+
};
|
|
940
|
+
default:
|
|
941
|
+
return {
|
|
942
|
+
type: "custom",
|
|
943
|
+
data: n
|
|
944
|
+
};
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
export {
|
|
949
|
+
Or as CanvasContainer,
|
|
950
|
+
Pr as CanvasContent,
|
|
951
|
+
kr as CanvasHeader,
|
|
952
|
+
jr as CanvasProvider,
|
|
953
|
+
Nr as CanvasToolbar,
|
|
954
|
+
Dr as ChartRenderer,
|
|
955
|
+
Ar as CodeRenderer,
|
|
956
|
+
Wr as ContentAnalyzer,
|
|
957
|
+
Ir as CustomRenderer,
|
|
958
|
+
Fr as DocumentRenderer,
|
|
959
|
+
$r as TimelineRenderer,
|
|
960
|
+
Tr as darkTheme,
|
|
961
|
+
k as defaultTheme,
|
|
962
|
+
Cr as lightTheme,
|
|
963
|
+
De as useCanvas,
|
|
964
|
+
wr as useCanvasContent,
|
|
965
|
+
Sr as useCanvasLayout
|
|
966
|
+
};
|