@ebay/nice-dag-react 1.0.7 → 1.0.8

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/lib/index.js ADDED
@@ -0,0 +1,748 @@
1
+ import K, { useCallback as F, useRef as G, useState as dr, useMemo as vr, useEffect as xe } from "react";
2
+ import Ne from "react-dom";
3
+ import pr from "@ebay/nice-dag-core";
4
+ var oe = { exports: {} }, W = {};
5
+ /**
6
+ * @license React
7
+ * react-jsx-runtime.production.min.js
8
+ *
9
+ * Copyright (c) Facebook, Inc. and its affiliates.
10
+ *
11
+ * This source code is licensed under the MIT license found in the
12
+ * LICENSE file in the root directory of this source tree.
13
+ */
14
+ var je;
15
+ function gr() {
16
+ if (je)
17
+ return W;
18
+ je = 1;
19
+ var c = K, l = Symbol.for("react.element"), T = Symbol.for("react.fragment"), E = Object.prototype.hasOwnProperty, C = c.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, m = { key: !0, ref: !0, __self: !0, __source: !0 };
20
+ function x(O, p, P) {
21
+ var i, b = {}, g = null, y = null;
22
+ P !== void 0 && (g = "" + P), p.key !== void 0 && (g = "" + p.key), p.ref !== void 0 && (y = p.ref);
23
+ for (i in p)
24
+ E.call(p, i) && !m.hasOwnProperty(i) && (b[i] = p[i]);
25
+ if (O && O.defaultProps)
26
+ for (i in p = O.defaultProps, p)
27
+ b[i] === void 0 && (b[i] = p[i]);
28
+ return { $$typeof: l, type: O, key: g, ref: y, props: b, _owner: C.current };
29
+ }
30
+ return W.Fragment = T, W.jsx = x, W.jsxs = x, W;
31
+ }
32
+ var Y = {};
33
+ /**
34
+ * @license React
35
+ * react-jsx-runtime.development.js
36
+ *
37
+ * Copyright (c) Facebook, Inc. and its affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ */
42
+ var ke;
43
+ function hr() {
44
+ return ke || (ke = 1, process.env.NODE_ENV !== "production" && function() {
45
+ var c = K, l = Symbol.for("react.element"), T = Symbol.for("react.portal"), E = Symbol.for("react.fragment"), C = Symbol.for("react.strict_mode"), m = Symbol.for("react.profiler"), x = Symbol.for("react.provider"), O = Symbol.for("react.context"), p = Symbol.for("react.forward_ref"), P = Symbol.for("react.suspense"), i = Symbol.for("react.suspense_list"), b = Symbol.for("react.memo"), g = Symbol.for("react.lazy"), y = Symbol.for("react.offscreen"), L = Symbol.iterator, M = "@@iterator";
46
+ function D(e) {
47
+ if (e === null || typeof e != "object")
48
+ return null;
49
+ var r = L && e[L] || e[M];
50
+ return typeof r == "function" ? r : null;
51
+ }
52
+ var _ = c.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
53
+ function f(e) {
54
+ {
55
+ for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), n = 1; n < r; n++)
56
+ t[n - 1] = arguments[n];
57
+ H("error", e, t);
58
+ }
59
+ }
60
+ function H(e, r, t) {
61
+ {
62
+ var n = _.ReactDebugCurrentFrame, u = n.getStackAddendum();
63
+ u !== "" && (r += "%s", t = t.concat([u]));
64
+ var s = t.map(function(o) {
65
+ return String(o);
66
+ });
67
+ s.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, s);
68
+ }
69
+ }
70
+ var A = !1, Ae = !1, Ie = !1, $e = !1, We = !1, ie;
71
+ ie = Symbol.for("react.module.reference");
72
+ function Ye(e) {
73
+ return !!(typeof e == "string" || typeof e == "function" || e === E || e === m || We || e === C || e === P || e === i || $e || e === y || A || Ae || Ie || typeof e == "object" && e !== null && (e.$$typeof === g || e.$$typeof === b || e.$$typeof === x || e.$$typeof === O || e.$$typeof === p || e.$$typeof === ie || e.getModuleId !== void 0));
74
+ }
75
+ function Le(e, r, t) {
76
+ var n = e.displayName;
77
+ if (n)
78
+ return n;
79
+ var u = r.displayName || r.name || "";
80
+ return u !== "" ? t + "(" + u + ")" : t;
81
+ }
82
+ function ue(e) {
83
+ return e.displayName || "Context";
84
+ }
85
+ function w(e) {
86
+ if (e == null)
87
+ return null;
88
+ if (typeof e.tag == "number" && f("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
89
+ return e.displayName || e.name || null;
90
+ if (typeof e == "string")
91
+ return e;
92
+ switch (e) {
93
+ case E:
94
+ return "Fragment";
95
+ case T:
96
+ return "Portal";
97
+ case m:
98
+ return "Profiler";
99
+ case C:
100
+ return "StrictMode";
101
+ case P:
102
+ return "Suspense";
103
+ case i:
104
+ return "SuspenseList";
105
+ }
106
+ if (typeof e == "object")
107
+ switch (e.$$typeof) {
108
+ case O:
109
+ var r = e;
110
+ return ue(r) + ".Consumer";
111
+ case x:
112
+ var t = e;
113
+ return ue(t._context) + ".Provider";
114
+ case p:
115
+ return Le(e, e.render, "ForwardRef");
116
+ case b:
117
+ var n = e.displayName || null;
118
+ return n !== null ? n : w(e.type) || "Memo";
119
+ case g: {
120
+ var u = e, s = u._payload, o = u._init;
121
+ try {
122
+ return w(o(s));
123
+ } catch {
124
+ return null;
125
+ }
126
+ }
127
+ }
128
+ return null;
129
+ }
130
+ var j = Object.assign, I = 0, se, ce, fe, le, de, ve, pe;
131
+ function ge() {
132
+ }
133
+ ge.__reactDisabledLog = !0;
134
+ function Me() {
135
+ {
136
+ if (I === 0) {
137
+ se = console.log, ce = console.info, fe = console.warn, le = console.error, de = console.group, ve = console.groupCollapsed, pe = console.groupEnd;
138
+ var e = {
139
+ configurable: !0,
140
+ enumerable: !0,
141
+ value: ge,
142
+ writable: !0
143
+ };
144
+ Object.defineProperties(console, {
145
+ info: e,
146
+ log: e,
147
+ warn: e,
148
+ error: e,
149
+ group: e,
150
+ groupCollapsed: e,
151
+ groupEnd: e
152
+ });
153
+ }
154
+ I++;
155
+ }
156
+ }
157
+ function Ve() {
158
+ {
159
+ if (I--, I === 0) {
160
+ var e = {
161
+ configurable: !0,
162
+ enumerable: !0,
163
+ writable: !0
164
+ };
165
+ Object.defineProperties(console, {
166
+ log: j({}, e, {
167
+ value: se
168
+ }),
169
+ info: j({}, e, {
170
+ value: ce
171
+ }),
172
+ warn: j({}, e, {
173
+ value: fe
174
+ }),
175
+ error: j({}, e, {
176
+ value: le
177
+ }),
178
+ group: j({}, e, {
179
+ value: de
180
+ }),
181
+ groupCollapsed: j({}, e, {
182
+ value: ve
183
+ }),
184
+ groupEnd: j({}, e, {
185
+ value: pe
186
+ })
187
+ });
188
+ }
189
+ I < 0 && f("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
190
+ }
191
+ }
192
+ var X = _.ReactCurrentDispatcher, Z;
193
+ function V(e, r, t) {
194
+ {
195
+ if (Z === void 0)
196
+ try {
197
+ throw Error();
198
+ } catch (u) {
199
+ var n = u.stack.trim().match(/\n( *(at )?)/);
200
+ Z = n && n[1] || "";
201
+ }
202
+ return `
203
+ ` + Z + e;
204
+ }
205
+ }
206
+ var Q = !1, U;
207
+ {
208
+ var Ue = typeof WeakMap == "function" ? WeakMap : Map;
209
+ U = new Ue();
210
+ }
211
+ function he(e, r) {
212
+ if (!e || Q)
213
+ return "";
214
+ {
215
+ var t = U.get(e);
216
+ if (t !== void 0)
217
+ return t;
218
+ }
219
+ var n;
220
+ Q = !0;
221
+ var u = Error.prepareStackTrace;
222
+ Error.prepareStackTrace = void 0;
223
+ var s;
224
+ s = X.current, X.current = null, Me();
225
+ try {
226
+ if (r) {
227
+ var o = function() {
228
+ throw Error();
229
+ };
230
+ if (Object.defineProperty(o.prototype, "props", {
231
+ set: function() {
232
+ throw Error();
233
+ }
234
+ }), typeof Reflect == "object" && Reflect.construct) {
235
+ try {
236
+ Reflect.construct(o, []);
237
+ } catch (S) {
238
+ n = S;
239
+ }
240
+ Reflect.construct(e, [], o);
241
+ } else {
242
+ try {
243
+ o.call();
244
+ } catch (S) {
245
+ n = S;
246
+ }
247
+ e.call(o.prototype);
248
+ }
249
+ } else {
250
+ try {
251
+ throw Error();
252
+ } catch (S) {
253
+ n = S;
254
+ }
255
+ e();
256
+ }
257
+ } catch (S) {
258
+ if (S && n && typeof S.stack == "string") {
259
+ for (var a = S.stack.split(`
260
+ `), h = n.stack.split(`
261
+ `), d = a.length - 1, v = h.length - 1; d >= 1 && v >= 0 && a[d] !== h[v]; )
262
+ v--;
263
+ for (; d >= 1 && v >= 0; d--, v--)
264
+ if (a[d] !== h[v]) {
265
+ if (d !== 1 || v !== 1)
266
+ do
267
+ if (d--, v--, v < 0 || a[d] !== h[v]) {
268
+ var R = `
269
+ ` + a[d].replace(" at new ", " at ");
270
+ return e.displayName && R.includes("<anonymous>") && (R = R.replace("<anonymous>", e.displayName)), typeof e == "function" && U.set(e, R), R;
271
+ }
272
+ while (d >= 1 && v >= 0);
273
+ break;
274
+ }
275
+ }
276
+ } finally {
277
+ Q = !1, X.current = s, Ve(), Error.prepareStackTrace = u;
278
+ }
279
+ var N = e ? e.displayName || e.name : "", De = N ? V(N) : "";
280
+ return typeof e == "function" && U.set(e, De), De;
281
+ }
282
+ function Be(e, r, t) {
283
+ return he(e, !1);
284
+ }
285
+ function qe(e) {
286
+ var r = e.prototype;
287
+ return !!(r && r.isReactComponent);
288
+ }
289
+ function B(e, r, t) {
290
+ if (e == null)
291
+ return "";
292
+ if (typeof e == "function")
293
+ return he(e, qe(e));
294
+ if (typeof e == "string")
295
+ return V(e);
296
+ switch (e) {
297
+ case P:
298
+ return V("Suspense");
299
+ case i:
300
+ return V("SuspenseList");
301
+ }
302
+ if (typeof e == "object")
303
+ switch (e.$$typeof) {
304
+ case p:
305
+ return Be(e.render);
306
+ case b:
307
+ return B(e.type, r, t);
308
+ case g: {
309
+ var n = e, u = n._payload, s = n._init;
310
+ try {
311
+ return B(s(u), r, t);
312
+ } catch {
313
+ }
314
+ }
315
+ }
316
+ return "";
317
+ }
318
+ var q = Object.prototype.hasOwnProperty, me = {}, Ee = _.ReactDebugCurrentFrame;
319
+ function J(e) {
320
+ if (e) {
321
+ var r = e._owner, t = B(e.type, e._source, r ? r.type : null);
322
+ Ee.setExtraStackFrame(t);
323
+ } else
324
+ Ee.setExtraStackFrame(null);
325
+ }
326
+ function Je(e, r, t, n, u) {
327
+ {
328
+ var s = Function.call.bind(q);
329
+ for (var o in e)
330
+ if (s(e, o)) {
331
+ var a = void 0;
332
+ try {
333
+ if (typeof e[o] != "function") {
334
+ var h = Error((n || "React class") + ": " + t + " type `" + o + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[o] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
335
+ throw h.name = "Invariant Violation", h;
336
+ }
337
+ a = e[o](r, o, n, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
338
+ } catch (d) {
339
+ a = d;
340
+ }
341
+ a && !(a instanceof Error) && (J(u), f("%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).", n || "React class", t, o, typeof a), J(null)), a instanceof Error && !(a.message in me) && (me[a.message] = !0, J(u), f("Failed %s type: %s", t, a.message), J(null));
342
+ }
343
+ }
344
+ }
345
+ var Ge = Array.isArray;
346
+ function ee(e) {
347
+ return Ge(e);
348
+ }
349
+ function ze(e) {
350
+ {
351
+ var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
352
+ return t;
353
+ }
354
+ }
355
+ function Ke(e) {
356
+ try {
357
+ return be(e), !1;
358
+ } catch {
359
+ return !0;
360
+ }
361
+ }
362
+ function be(e) {
363
+ return "" + e;
364
+ }
365
+ function Re(e) {
366
+ if (Ke(e))
367
+ return f("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", ze(e)), be(e);
368
+ }
369
+ var $ = _.ReactCurrentOwner, He = {
370
+ key: !0,
371
+ ref: !0,
372
+ __self: !0,
373
+ __source: !0
374
+ }, ye, _e, re;
375
+ re = {};
376
+ function Xe(e) {
377
+ if (q.call(e, "ref")) {
378
+ var r = Object.getOwnPropertyDescriptor(e, "ref").get;
379
+ if (r && r.isReactWarning)
380
+ return !1;
381
+ }
382
+ return e.ref !== void 0;
383
+ }
384
+ function Ze(e) {
385
+ if (q.call(e, "key")) {
386
+ var r = Object.getOwnPropertyDescriptor(e, "key").get;
387
+ if (r && r.isReactWarning)
388
+ return !1;
389
+ }
390
+ return e.key !== void 0;
391
+ }
392
+ function Qe(e, r) {
393
+ if (typeof e.ref == "string" && $.current && r && $.current.stateNode !== r) {
394
+ var t = w($.current.type);
395
+ re[t] || (f('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', w($.current.type), e.ref), re[t] = !0);
396
+ }
397
+ }
398
+ function er(e, r) {
399
+ {
400
+ var t = function() {
401
+ ye || (ye = !0, f("%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));
402
+ };
403
+ t.isReactWarning = !0, Object.defineProperty(e, "key", {
404
+ get: t,
405
+ configurable: !0
406
+ });
407
+ }
408
+ }
409
+ function rr(e, r) {
410
+ {
411
+ var t = function() {
412
+ _e || (_e = !0, f("%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));
413
+ };
414
+ t.isReactWarning = !0, Object.defineProperty(e, "ref", {
415
+ get: t,
416
+ configurable: !0
417
+ });
418
+ }
419
+ }
420
+ var tr = function(e, r, t, n, u, s, o) {
421
+ var a = {
422
+ $$typeof: l,
423
+ type: e,
424
+ key: r,
425
+ ref: t,
426
+ props: o,
427
+ _owner: s
428
+ };
429
+ return a._store = {}, Object.defineProperty(a._store, "validated", {
430
+ configurable: !1,
431
+ enumerable: !1,
432
+ writable: !0,
433
+ value: !1
434
+ }), Object.defineProperty(a, "_self", {
435
+ configurable: !1,
436
+ enumerable: !1,
437
+ writable: !1,
438
+ value: n
439
+ }), Object.defineProperty(a, "_source", {
440
+ configurable: !1,
441
+ enumerable: !1,
442
+ writable: !1,
443
+ value: u
444
+ }), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
445
+ };
446
+ function nr(e, r, t, n, u) {
447
+ {
448
+ var s, o = {}, a = null, h = null;
449
+ t !== void 0 && (Re(t), a = "" + t), Ze(r) && (Re(r.key), a = "" + r.key), Xe(r) && (h = r.ref, Qe(r, u));
450
+ for (s in r)
451
+ q.call(r, s) && !He.hasOwnProperty(s) && (o[s] = r[s]);
452
+ if (e && e.defaultProps) {
453
+ var d = e.defaultProps;
454
+ for (s in d)
455
+ o[s] === void 0 && (o[s] = d[s]);
456
+ }
457
+ if (a || h) {
458
+ var v = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
459
+ a && er(o, v), h && rr(o, v);
460
+ }
461
+ return tr(e, a, h, u, n, $.current, o);
462
+ }
463
+ }
464
+ var te = _.ReactCurrentOwner, Te = _.ReactDebugCurrentFrame;
465
+ function k(e) {
466
+ if (e) {
467
+ var r = e._owner, t = B(e.type, e._source, r ? r.type : null);
468
+ Te.setExtraStackFrame(t);
469
+ } else
470
+ Te.setExtraStackFrame(null);
471
+ }
472
+ var ne;
473
+ ne = !1;
474
+ function ae(e) {
475
+ return typeof e == "object" && e !== null && e.$$typeof === l;
476
+ }
477
+ function Ce() {
478
+ {
479
+ if (te.current) {
480
+ var e = w(te.current.type);
481
+ if (e)
482
+ return `
483
+
484
+ Check the render method of \`` + e + "`.";
485
+ }
486
+ return "";
487
+ }
488
+ }
489
+ function ar(e) {
490
+ {
491
+ if (e !== void 0) {
492
+ var r = e.fileName.replace(/^.*[\\\/]/, ""), t = e.lineNumber;
493
+ return `
494
+
495
+ Check your code at ` + r + ":" + t + ".";
496
+ }
497
+ return "";
498
+ }
499
+ }
500
+ var Oe = {};
501
+ function or(e) {
502
+ {
503
+ var r = Ce();
504
+ if (!r) {
505
+ var t = typeof e == "string" ? e : e.displayName || e.name;
506
+ t && (r = `
507
+
508
+ Check the top-level render call using <` + t + ">.");
509
+ }
510
+ return r;
511
+ }
512
+ }
513
+ function Pe(e, r) {
514
+ {
515
+ if (!e._store || e._store.validated || e.key != null)
516
+ return;
517
+ e._store.validated = !0;
518
+ var t = or(r);
519
+ if (Oe[t])
520
+ return;
521
+ Oe[t] = !0;
522
+ var n = "";
523
+ e && e._owner && e._owner !== te.current && (n = " It was passed a child from " + w(e._owner.type) + "."), k(e), f('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, n), k(null);
524
+ }
525
+ }
526
+ function we(e, r) {
527
+ {
528
+ if (typeof e != "object")
529
+ return;
530
+ if (ee(e))
531
+ for (var t = 0; t < e.length; t++) {
532
+ var n = e[t];
533
+ ae(n) && Pe(n, r);
534
+ }
535
+ else if (ae(e))
536
+ e._store && (e._store.validated = !0);
537
+ else if (e) {
538
+ var u = D(e);
539
+ if (typeof u == "function" && u !== e.entries)
540
+ for (var s = u.call(e), o; !(o = s.next()).done; )
541
+ ae(o.value) && Pe(o.value, r);
542
+ }
543
+ }
544
+ }
545
+ function ir(e) {
546
+ {
547
+ var r = e.type;
548
+ if (r == null || typeof r == "string")
549
+ return;
550
+ var t;
551
+ if (typeof r == "function")
552
+ t = r.propTypes;
553
+ else if (typeof r == "object" && (r.$$typeof === p || r.$$typeof === b))
554
+ t = r.propTypes;
555
+ else
556
+ return;
557
+ if (t) {
558
+ var n = w(r);
559
+ Je(t, e.props, "prop", n, e);
560
+ } else if (r.PropTypes !== void 0 && !ne) {
561
+ ne = !0;
562
+ var u = w(r);
563
+ f("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", u || "Unknown");
564
+ }
565
+ typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && f("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
566
+ }
567
+ }
568
+ function ur(e) {
569
+ {
570
+ for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
571
+ var n = r[t];
572
+ if (n !== "children" && n !== "key") {
573
+ k(e), f("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), k(null);
574
+ break;
575
+ }
576
+ }
577
+ e.ref !== null && (k(e), f("Invalid attribute `ref` supplied to `React.Fragment`."), k(null));
578
+ }
579
+ }
580
+ function Se(e, r, t, n, u, s) {
581
+ {
582
+ var o = Ye(e);
583
+ if (!o) {
584
+ var a = "";
585
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (a += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
586
+ var h = ar(u);
587
+ h ? a += h : a += Ce();
588
+ var d;
589
+ e === null ? d = "null" : ee(e) ? d = "array" : e !== void 0 && e.$$typeof === l ? (d = "<" + (w(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : d = typeof e, f("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", d, a);
590
+ }
591
+ var v = nr(e, r, t, u, s);
592
+ if (v == null)
593
+ return v;
594
+ if (o) {
595
+ var R = r.children;
596
+ if (R !== void 0)
597
+ if (n)
598
+ if (ee(R)) {
599
+ for (var N = 0; N < R.length; N++)
600
+ we(R[N], e);
601
+ Object.freeze && Object.freeze(R);
602
+ } else
603
+ f("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
604
+ else
605
+ we(R, e);
606
+ }
607
+ return e === E ? ur(v) : ir(v), v;
608
+ }
609
+ }
610
+ function sr(e, r, t) {
611
+ return Se(e, r, t, !0);
612
+ }
613
+ function cr(e, r, t) {
614
+ return Se(e, r, t, !1);
615
+ }
616
+ var fr = cr, lr = sr;
617
+ Y.Fragment = E, Y.jsx = fr, Y.jsxs = lr;
618
+ }()), Y;
619
+ }
620
+ (function(c) {
621
+ process.env.NODE_ENV === "production" ? c.exports = gr() : c.exports = hr();
622
+ })(oe);
623
+ const Fe = oe.exports.Fragment, z = oe.exports.jsx;
624
+ class mr extends K.Component {
625
+ render() {
626
+ if (this.props.niceDag && this.props.node.ref) {
627
+ const l = this.props.niceDag.getElementByNodeId(this.props.node.id);
628
+ if (l)
629
+ return Ne.createPortal(/* @__PURE__ */ z(Fe, {
630
+ children: this.props.render(this.props)
631
+ }), l);
632
+ }
633
+ return null;
634
+ }
635
+ }
636
+ class Er extends K.Component {
637
+ render() {
638
+ return this.props.niceDag && this.props.edge.ref ? Ne.createPortal(/* @__PURE__ */ z(Fe, {
639
+ children: this.props.render(this.props)
640
+ }), this.props.edge.ref) : null;
641
+ }
642
+ }
643
+ function Tr(c) {
644
+ const l = F(() => {
645
+ c.remove();
646
+ }, [c]), T = F((E, C = 40) => {
647
+ c.insertNodes(E, C);
648
+ }, [c]);
649
+ return {
650
+ onEdgeRemove: l,
651
+ onNodeInsert: T
652
+ };
653
+ }
654
+ function Cr({
655
+ node: c,
656
+ niceDag: l
657
+ }) {
658
+ const T = F(() => {
659
+ c.remove();
660
+ }, [c]), E = F((m) => {
661
+ l.startEdgeDragging(c, m);
662
+ }, [l, c]), C = F((m) => {
663
+ l.startNodeDragging(c, m);
664
+ }, [l, c]);
665
+ return {
666
+ onNodeRemove: T,
667
+ startEdgeDragging: E,
668
+ startNodeDragging: C
669
+ };
670
+ }
671
+ function br(c) {
672
+ const {
673
+ initNodes: l
674
+ } = c;
675
+ if (!l)
676
+ throw new Error("initNodes can't be undefined!");
677
+ }
678
+ function Or(c) {
679
+ br(c);
680
+ const {
681
+ onMount: l,
682
+ renderNode: T,
683
+ renderEdge: E,
684
+ scrollPosition: C,
685
+ initNodes: m,
686
+ minimapConfig: x,
687
+ ...O
688
+ } = c, p = G(null), P = G(null), i = G(null), b = G(), [g, y] = dr(0), L = F(() => {
689
+ i.current && i.current.destory();
690
+ }, [y]), M = vr(() => ({
691
+ onChange: () => {
692
+ y(g + 1);
693
+ }
694
+ }), [y, g]);
695
+ return xe(() => {
696
+ if (b.current !== m) {
697
+ if (!i.current) {
698
+ const D = pr.init({
699
+ container: p.current,
700
+ minimapContainer: P.current,
701
+ minimapConfig: x,
702
+ ...O
703
+ }, c.editable);
704
+ i.current = D;
705
+ }
706
+ i.current.withNodes(m).render(), y(g + 1), b.current = m, l && l();
707
+ }
708
+ return i.current.addNiceDagChangeListener(M), () => {
709
+ i.current.removeNiceDagChangeListener(M);
710
+ };
711
+ }, [m, y, g, l]), xe(() => (i.current && i.current.isDestoried && (i.current.withNodes(m).render(), y(g + 1)), () => {
712
+ i.current && i.current.destory();
713
+ }), []), {
714
+ niceDag: i.current,
715
+ niceDagEl: p,
716
+ minimapEl: P,
717
+ render: () => {
718
+ if (i.current) {
719
+ const D = i.current.getAllNodes();
720
+ let _ = (D == null ? void 0 : D.length) > 0 ? D.map((f) => /* @__PURE__ */ z(mr, {
721
+ render: T,
722
+ node: f,
723
+ niceDag: i.current,
724
+ patchVersion: g
725
+ }, f.id)) : null;
726
+ if (E) {
727
+ const f = i.current.getAllEdges(), H = (f == null ? void 0 : f.length) > 0 ? f.map((A) => /* @__PURE__ */ z(Er, {
728
+ render: E,
729
+ edge: A,
730
+ patchVersion: g,
731
+ niceDag: i.current
732
+ }, `edge-${A.source.id}-${A.target.id}`)) : [];
733
+ _ = [..._, ...H];
734
+ }
735
+ return _;
736
+ }
737
+ return null;
738
+ },
739
+ reset: L
740
+ };
741
+ }
742
+ export {
743
+ Er as NiceDagEdge,
744
+ mr as NiceDagNode,
745
+ Or as useNiceDag,
746
+ Tr as useNiceDagEdge,
747
+ Cr as useNiceDagNode
748
+ };