@ebay/nice-dag-react 1.0.7 → 1.0.9

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,763 @@
1
+ import M, { useCallback as A, useRef as K, useState as dr, useMemo as vr, useEffect as Ne } from "react";
2
+ import ie from "react-dom";
3
+ import pr from "@ebay/nice-dag-core";
4
+ var ue = { exports: {} }, V = {};
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 Fe;
15
+ function gr() {
16
+ if (Fe)
17
+ return V;
18
+ Fe = 1;
19
+ var s = M, l = Symbol.for("react.element"), T = Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, y = s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, P = { key: !0, ref: !0, __self: !0, __source: !0 };
20
+ function _(w, p, O) {
21
+ var g, u = {}, C = null, R = null;
22
+ O !== void 0 && (C = "" + O), p.key !== void 0 && (C = "" + p.key), p.ref !== void 0 && (R = p.ref);
23
+ for (g in p)
24
+ m.call(p, g) && !P.hasOwnProperty(g) && (u[g] = p[g]);
25
+ if (w && w.defaultProps)
26
+ for (g in p = w.defaultProps, p)
27
+ u[g] === void 0 && (u[g] = p[g]);
28
+ return { $$typeof: l, type: w, key: C, ref: R, props: u, _owner: y.current };
29
+ }
30
+ return V.Fragment = T, V.jsx = _, V.jsxs = _, V;
31
+ }
32
+ var L = {};
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 Ae;
43
+ function hr() {
44
+ return Ae || (Ae = 1, process.env.NODE_ENV !== "production" && function() {
45
+ var s = M, l = Symbol.for("react.element"), T = Symbol.for("react.portal"), m = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), P = Symbol.for("react.profiler"), _ = Symbol.for("react.provider"), w = Symbol.for("react.context"), p = Symbol.for("react.forward_ref"), O = Symbol.for("react.suspense"), g = Symbol.for("react.suspense_list"), u = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), R = Symbol.for("react.offscreen"), D = Symbol.iterator, H = "@@iterator";
46
+ function U(e) {
47
+ if (e === null || typeof e != "object")
48
+ return null;
49
+ var r = D && e[D] || e[H];
50
+ return typeof r == "function" ? r : null;
51
+ }
52
+ var E = s.__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
+ S("error", e, t);
58
+ }
59
+ }
60
+ function S(e, r, t) {
61
+ {
62
+ var n = E.ReactDebugCurrentFrame, i = n.getStackAddendum();
63
+ i !== "" && (r += "%s", t = t.concat([i]));
64
+ var c = t.map(function(o) {
65
+ return String(o);
66
+ });
67
+ c.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, c);
68
+ }
69
+ }
70
+ var X = !1, $ = !1, Ie = !1, $e = !1, We = !1, ce;
71
+ ce = Symbol.for("react.module.reference");
72
+ function Ye(e) {
73
+ return !!(typeof e == "string" || typeof e == "function" || e === m || e === P || We || e === y || e === O || e === g || $e || e === R || X || $ || Ie || typeof e == "object" && e !== null && (e.$$typeof === C || e.$$typeof === u || e.$$typeof === _ || e.$$typeof === w || e.$$typeof === p || e.$$typeof === ce || e.getModuleId !== void 0));
74
+ }
75
+ function Ve(e, r, t) {
76
+ var n = e.displayName;
77
+ if (n)
78
+ return n;
79
+ var i = r.displayName || r.name || "";
80
+ return i !== "" ? t + "(" + i + ")" : t;
81
+ }
82
+ function le(e) {
83
+ return e.displayName || "Context";
84
+ }
85
+ function x(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 m:
94
+ return "Fragment";
95
+ case T:
96
+ return "Portal";
97
+ case P:
98
+ return "Profiler";
99
+ case y:
100
+ return "StrictMode";
101
+ case O:
102
+ return "Suspense";
103
+ case g:
104
+ return "SuspenseList";
105
+ }
106
+ if (typeof e == "object")
107
+ switch (e.$$typeof) {
108
+ case w:
109
+ var r = e;
110
+ return le(r) + ".Consumer";
111
+ case _:
112
+ var t = e;
113
+ return le(t._context) + ".Provider";
114
+ case p:
115
+ return Ve(e, e.render, "ForwardRef");
116
+ case u:
117
+ var n = e.displayName || null;
118
+ return n !== null ? n : x(e.type) || "Memo";
119
+ case C: {
120
+ var i = e, c = i._payload, o = i._init;
121
+ try {
122
+ return x(o(c));
123
+ } catch {
124
+ return null;
125
+ }
126
+ }
127
+ }
128
+ return null;
129
+ }
130
+ var k = Object.assign, W = 0, fe, de, ve, pe, ge, he, me;
131
+ function Ee() {
132
+ }
133
+ Ee.__reactDisabledLog = !0;
134
+ function Le() {
135
+ {
136
+ if (W === 0) {
137
+ fe = console.log, de = console.info, ve = console.warn, pe = console.error, ge = console.group, he = console.groupCollapsed, me = console.groupEnd;
138
+ var e = {
139
+ configurable: !0,
140
+ enumerable: !0,
141
+ value: Ee,
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
+ W++;
155
+ }
156
+ }
157
+ function Me() {
158
+ {
159
+ if (W--, W === 0) {
160
+ var e = {
161
+ configurable: !0,
162
+ enumerable: !0,
163
+ writable: !0
164
+ };
165
+ Object.defineProperties(console, {
166
+ log: k({}, e, {
167
+ value: fe
168
+ }),
169
+ info: k({}, e, {
170
+ value: de
171
+ }),
172
+ warn: k({}, e, {
173
+ value: ve
174
+ }),
175
+ error: k({}, e, {
176
+ value: pe
177
+ }),
178
+ group: k({}, e, {
179
+ value: ge
180
+ }),
181
+ groupCollapsed: k({}, e, {
182
+ value: he
183
+ }),
184
+ groupEnd: k({}, e, {
185
+ value: me
186
+ })
187
+ });
188
+ }
189
+ W < 0 && f("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
190
+ }
191
+ }
192
+ var Z = E.ReactCurrentDispatcher, Q;
193
+ function B(e, r, t) {
194
+ {
195
+ if (Q === void 0)
196
+ try {
197
+ throw Error();
198
+ } catch (i) {
199
+ var n = i.stack.trim().match(/\n( *(at )?)/);
200
+ Q = n && n[1] || "";
201
+ }
202
+ return `
203
+ ` + Q + e;
204
+ }
205
+ }
206
+ var ee = !1, q;
207
+ {
208
+ var Ue = typeof WeakMap == "function" ? WeakMap : Map;
209
+ q = new Ue();
210
+ }
211
+ function Re(e, r) {
212
+ if (!e || ee)
213
+ return "";
214
+ {
215
+ var t = q.get(e);
216
+ if (t !== void 0)
217
+ return t;
218
+ }
219
+ var n;
220
+ ee = !0;
221
+ var i = Error.prepareStackTrace;
222
+ Error.prepareStackTrace = void 0;
223
+ var c;
224
+ c = Z.current, Z.current = null, Le();
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 (j) {
238
+ n = j;
239
+ }
240
+ Reflect.construct(e, [], o);
241
+ } else {
242
+ try {
243
+ o.call();
244
+ } catch (j) {
245
+ n = j;
246
+ }
247
+ e.call(o.prototype);
248
+ }
249
+ } else {
250
+ try {
251
+ throw Error();
252
+ } catch (j) {
253
+ n = j;
254
+ }
255
+ e();
256
+ }
257
+ } catch (j) {
258
+ if (j && n && typeof j.stack == "string") {
259
+ for (var a = j.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 b = `
269
+ ` + a[d].replace(" at new ", " at ");
270
+ return e.displayName && b.includes("<anonymous>") && (b = b.replace("<anonymous>", e.displayName)), typeof e == "function" && q.set(e, b), b;
271
+ }
272
+ while (d >= 1 && v >= 0);
273
+ break;
274
+ }
275
+ }
276
+ } finally {
277
+ ee = !1, Z.current = c, Me(), Error.prepareStackTrace = i;
278
+ }
279
+ var F = e ? e.displayName || e.name : "", ke = F ? B(F) : "";
280
+ return typeof e == "function" && q.set(e, ke), ke;
281
+ }
282
+ function Be(e, r, t) {
283
+ return Re(e, !1);
284
+ }
285
+ function qe(e) {
286
+ var r = e.prototype;
287
+ return !!(r && r.isReactComponent);
288
+ }
289
+ function J(e, r, t) {
290
+ if (e == null)
291
+ return "";
292
+ if (typeof e == "function")
293
+ return Re(e, qe(e));
294
+ if (typeof e == "string")
295
+ return B(e);
296
+ switch (e) {
297
+ case O:
298
+ return B("Suspense");
299
+ case g:
300
+ return B("SuspenseList");
301
+ }
302
+ if (typeof e == "object")
303
+ switch (e.$$typeof) {
304
+ case p:
305
+ return Be(e.render);
306
+ case u:
307
+ return J(e.type, r, t);
308
+ case C: {
309
+ var n = e, i = n._payload, c = n._init;
310
+ try {
311
+ return J(c(i), r, t);
312
+ } catch {
313
+ }
314
+ }
315
+ }
316
+ return "";
317
+ }
318
+ var G = Object.prototype.hasOwnProperty, be = {}, ye = E.ReactDebugCurrentFrame;
319
+ function z(e) {
320
+ if (e) {
321
+ var r = e._owner, t = J(e.type, e._source, r ? r.type : null);
322
+ ye.setExtraStackFrame(t);
323
+ } else
324
+ ye.setExtraStackFrame(null);
325
+ }
326
+ function Je(e, r, t, n, i) {
327
+ {
328
+ var c = Function.call.bind(G);
329
+ for (var o in e)
330
+ if (c(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) && (z(i), 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), z(null)), a instanceof Error && !(a.message in be) && (be[a.message] = !0, z(i), f("Failed %s type: %s", t, a.message), z(null));
342
+ }
343
+ }
344
+ }
345
+ var Ge = Array.isArray;
346
+ function re(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 _e(e), !1;
358
+ } catch {
359
+ return !0;
360
+ }
361
+ }
362
+ function _e(e) {
363
+ return "" + e;
364
+ }
365
+ function Ce(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)), _e(e);
368
+ }
369
+ var Y = E.ReactCurrentOwner, He = {
370
+ key: !0,
371
+ ref: !0,
372
+ __self: !0,
373
+ __source: !0
374
+ }, Te, Pe, te;
375
+ te = {};
376
+ function Xe(e) {
377
+ if (G.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 (G.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" && Y.current && r && Y.current.stateNode !== r) {
394
+ var t = x(Y.current.type);
395
+ te[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', x(Y.current.type), e.ref), te[t] = !0);
396
+ }
397
+ }
398
+ function er(e, r) {
399
+ {
400
+ var t = function() {
401
+ Te || (Te = !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
+ Pe || (Pe = !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, i, c, o) {
421
+ var a = {
422
+ $$typeof: l,
423
+ type: e,
424
+ key: r,
425
+ ref: t,
426
+ props: o,
427
+ _owner: c
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: i
444
+ }), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
445
+ };
446
+ function nr(e, r, t, n, i) {
447
+ {
448
+ var c, o = {}, a = null, h = null;
449
+ t !== void 0 && (Ce(t), a = "" + t), Ze(r) && (Ce(r.key), a = "" + r.key), Xe(r) && (h = r.ref, Qe(r, i));
450
+ for (c in r)
451
+ G.call(r, c) && !He.hasOwnProperty(c) && (o[c] = r[c]);
452
+ if (e && e.defaultProps) {
453
+ var d = e.defaultProps;
454
+ for (c in d)
455
+ o[c] === void 0 && (o[c] = d[c]);
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, i, n, Y.current, o);
462
+ }
463
+ }
464
+ var ne = E.ReactCurrentOwner, we = E.ReactDebugCurrentFrame;
465
+ function N(e) {
466
+ if (e) {
467
+ var r = e._owner, t = J(e.type, e._source, r ? r.type : null);
468
+ we.setExtraStackFrame(t);
469
+ } else
470
+ we.setExtraStackFrame(null);
471
+ }
472
+ var ae;
473
+ ae = !1;
474
+ function oe(e) {
475
+ return typeof e == "object" && e !== null && e.$$typeof === l;
476
+ }
477
+ function Oe() {
478
+ {
479
+ if (ne.current) {
480
+ var e = x(ne.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 De = {};
501
+ function or(e) {
502
+ {
503
+ var r = Oe();
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 Se(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 (De[t])
520
+ return;
521
+ De[t] = !0;
522
+ var n = "";
523
+ e && e._owner && e._owner !== ne.current && (n = " It was passed a child from " + x(e._owner.type) + "."), N(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), N(null);
524
+ }
525
+ }
526
+ function xe(e, r) {
527
+ {
528
+ if (typeof e != "object")
529
+ return;
530
+ if (re(e))
531
+ for (var t = 0; t < e.length; t++) {
532
+ var n = e[t];
533
+ oe(n) && Se(n, r);
534
+ }
535
+ else if (oe(e))
536
+ e._store && (e._store.validated = !0);
537
+ else if (e) {
538
+ var i = U(e);
539
+ if (typeof i == "function" && i !== e.entries)
540
+ for (var c = i.call(e), o; !(o = c.next()).done; )
541
+ oe(o.value) && Se(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 === u))
554
+ t = r.propTypes;
555
+ else
556
+ return;
557
+ if (t) {
558
+ var n = x(r);
559
+ Je(t, e.props, "prop", n, e);
560
+ } else if (r.PropTypes !== void 0 && !ae) {
561
+ ae = !0;
562
+ var i = x(r);
563
+ f("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", i || "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
+ N(e), f("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), N(null);
574
+ break;
575
+ }
576
+ }
577
+ e.ref !== null && (N(e), f("Invalid attribute `ref` supplied to `React.Fragment`."), N(null));
578
+ }
579
+ }
580
+ function je(e, r, t, n, i, c) {
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(i);
587
+ h ? a += h : a += Oe();
588
+ var d;
589
+ e === null ? d = "null" : re(e) ? d = "array" : e !== void 0 && e.$$typeof === l ? (d = "<" + (x(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, i, c);
592
+ if (v == null)
593
+ return v;
594
+ if (o) {
595
+ var b = r.children;
596
+ if (b !== void 0)
597
+ if (n)
598
+ if (re(b)) {
599
+ for (var F = 0; F < b.length; F++)
600
+ xe(b[F], e);
601
+ Object.freeze && Object.freeze(b);
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
+ xe(b, e);
606
+ }
607
+ return e === m ? ur(v) : ir(v), v;
608
+ }
609
+ }
610
+ function sr(e, r, t) {
611
+ return je(e, r, t, !0);
612
+ }
613
+ function cr(e, r, t) {
614
+ return je(e, r, t, !1);
615
+ }
616
+ var lr = cr, fr = sr;
617
+ L.Fragment = m, L.jsx = lr, L.jsxs = fr;
618
+ }()), L;
619
+ }
620
+ (function(s) {
621
+ process.env.NODE_ENV === "production" ? s.exports = gr() : s.exports = hr();
622
+ })(ue);
623
+ const se = ue.exports.Fragment, I = ue.exports.jsx;
624
+ class mr extends M.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 ie.createPortal(/* @__PURE__ */ I(se, {
630
+ children: this.props.render(this.props)
631
+ }), l);
632
+ }
633
+ return null;
634
+ }
635
+ }
636
+ class Er extends M.Component {
637
+ render() {
638
+ return this.props.niceDag && this.props.edge.ref ? ie.createPortal(/* @__PURE__ */ I(se, {
639
+ children: this.props.render(this.props)
640
+ }), this.props.edge.ref) : null;
641
+ }
642
+ }
643
+ class Rr extends M.Component {
644
+ render() {
645
+ if (this.props.niceDag) {
646
+ const l = this.props.niceDag.getRootContentElement();
647
+ return ie.createPortal(/* @__PURE__ */ I(se, {
648
+ children: this.props.render(this.props.niceDag)
649
+ }), l);
650
+ }
651
+ return null;
652
+ }
653
+ }
654
+ function Tr(s) {
655
+ const l = A(() => {
656
+ s.remove();
657
+ }, [s]), T = A((m, y = 40) => {
658
+ s.insertNodes(m, y);
659
+ }, [s]);
660
+ return {
661
+ onEdgeRemove: l,
662
+ onNodeInsert: T
663
+ };
664
+ }
665
+ function Pr({
666
+ node: s,
667
+ niceDag: l
668
+ }) {
669
+ const T = A(() => {
670
+ s.remove();
671
+ }, [s]), m = A((P) => {
672
+ l.startEdgeDragging(s, P);
673
+ }, [l, s]), y = A((P) => {
674
+ l.startNodeDragging(s, P);
675
+ }, [l, s]);
676
+ return {
677
+ onNodeRemove: T,
678
+ startEdgeDragging: m,
679
+ startNodeDragging: y
680
+ };
681
+ }
682
+ function br(s) {
683
+ const {
684
+ initNodes: l
685
+ } = s;
686
+ if (!l)
687
+ throw new Error("initNodes can't be undefined!");
688
+ }
689
+ function wr(s) {
690
+ br(s);
691
+ const {
692
+ onMount: l,
693
+ renderNode: T,
694
+ renderRootView: m,
695
+ renderEdge: y,
696
+ scrollPosition: P,
697
+ initNodes: _,
698
+ minimapConfig: w,
699
+ ...p
700
+ } = s, O = K(null), g = K(null), u = K(null), C = K(), [R, D] = dr(0), H = A(() => {
701
+ u.current && u.current.destory();
702
+ }, [D]), U = vr(() => ({
703
+ onChange: () => {
704
+ D(R + 1);
705
+ }
706
+ }), [D, R]);
707
+ return Ne(() => {
708
+ if (C.current !== _) {
709
+ if (!u.current) {
710
+ const E = pr.init({
711
+ container: O.current,
712
+ minimapContainer: g.current,
713
+ minimapConfig: w,
714
+ ...p
715
+ }, s.editable);
716
+ u.current = E;
717
+ }
718
+ u.current.withNodes(_).render(), D(R + 1), C.current = _, l && l();
719
+ }
720
+ return u.current.addNiceDagChangeListener(U), () => {
721
+ u.current.removeNiceDagChangeListener(U);
722
+ };
723
+ }, [_, D, R, l]), Ne(() => (u.current && u.current.isDestoried && (u.current.withNodes(_).render(), D(R + 1)), () => {
724
+ u.current && u.current.destory();
725
+ }), []), {
726
+ niceDag: u.current,
727
+ niceDagEl: O,
728
+ minimapEl: g,
729
+ render: () => {
730
+ if (u.current) {
731
+ const E = u.current.getAllNodes();
732
+ let f = (E == null ? void 0 : E.length) > 0 ? E.map((S) => /* @__PURE__ */ I(mr, {
733
+ render: T,
734
+ node: S,
735
+ niceDag: u.current,
736
+ patchVersion: R
737
+ }, S.id)) : null;
738
+ if (m && (f = [...f, /* @__PURE__ */ I(Rr, {
739
+ niceDag: u.current,
740
+ render: m
741
+ })]), y) {
742
+ const S = u.current.getAllEdges(), X = (S == null ? void 0 : S.length) > 0 ? S.map(($) => /* @__PURE__ */ I(Er, {
743
+ render: y,
744
+ edge: $,
745
+ patchVersion: R,
746
+ niceDag: u.current
747
+ }, `edge-${$.source.id}-${$.target.id}`)) : [];
748
+ f = [...f, ...X];
749
+ }
750
+ return f;
751
+ }
752
+ return null;
753
+ },
754
+ reset: H
755
+ };
756
+ }
757
+ export {
758
+ Er as NiceDagEdge,
759
+ mr as NiceDagNode,
760
+ wr as useNiceDag,
761
+ Tr as useNiceDagEdge,
762
+ Pr as useNiceDagNode
763
+ };