markmap-view 0.18.4-alpha.4 → 0.18.5-alpha.6

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/index.js CHANGED
@@ -1,6 +1,7 @@
1
- import { scaleOrdinal as G, schemeCategory10 as at, linkHorizontal as lt, zoomTransform as w, select as ct, zoom as ht, min as P, max as W, zoomIdentity as dt, minIndex as pt } from "d3";
2
- import { Hook as ut, getId as mt, debounce as gt, addClass as ft, walkTree as C, childSelector as v, noop as S } from "markmap-common";
3
- const V = typeof navigator < "u" && navigator.userAgent.includes("Macintosh"), xt = G(at), U = {
1
+ import { Hook as at, getId as lt, debounce as ct, addClass as ht, walkTree as C, noop as w } from "markmap-common";
2
+ import { loadCSS as xe, loadJS as ye } from "markmap-common";
3
+ import { scaleOrdinal as G, schemeCategory10 as dt, linkHorizontal as pt, zoomTransform as S, select as ut, zoom as mt, min as P, max as W, zoomIdentity as gt, minIndex as ft } from "d3";
4
+ const V = typeof navigator < "u" && navigator.userAgent.includes("Macintosh"), xt = G(dt), U = {
4
5
  autoFit: !1,
5
6
  color: (e) => {
6
7
  var t;
@@ -22,23 +23,23 @@ const V = typeof navigator < "u" && navigator.userAgent.includes("Macintosh"), x
22
23
  toggleRecursively: !1
23
24
  };
24
25
  function ue(e) {
25
- const t = {}, s = { ...e }, { color: n, colorFreezeLevel: o } = s;
26
- if ((n == null ? void 0 : n.length) === 1) {
27
- const r = n[0];
28
- t.color = () => r;
29
- } else if (n != null && n.length) {
30
- const r = G(n);
31
- t.color = (c) => r(`${c.state.path}`);
26
+ const t = {}, n = { ...e }, { color: r, colorFreezeLevel: o } = n;
27
+ if ((r == null ? void 0 : r.length) === 1) {
28
+ const s = r[0];
29
+ t.color = () => s;
30
+ } else if (r != null && r.length) {
31
+ const s = G(r);
32
+ t.color = (c) => s(`${c.state.path}`);
32
33
  }
33
34
  if (o) {
34
- const r = t.color || U.color;
35
+ const s = t.color || U.color;
35
36
  t.color = (c) => (c = {
36
37
  ...c,
37
38
  state: {
38
39
  ...c.state,
39
40
  path: c.state.path.split(".").slice(0, o).join(".")
40
41
  }
41
- }, r(c));
42
+ }, s(c));
42
43
  }
43
44
  return [
44
45
  "duration",
@@ -50,75 +51,86 @@ function ue(e) {
50
51
  "paddingX",
51
52
  "spacingHorizontal",
52
53
  "spacingVertical"
53
- ].forEach((r) => {
54
- const c = s[r];
55
- typeof c == "number" && (t[r] = c);
56
- }), ["zoom", "pan"].forEach((r) => {
57
- const c = s[r];
58
- c != null && (t[r] = !!c);
54
+ ].forEach((s) => {
55
+ const c = n[s];
56
+ typeof c == "number" && (t[s] = c);
57
+ }), ["zoom", "pan"].forEach((s) => {
58
+ const c = n[s];
59
+ c != null && (t[s] = !!c);
59
60
  }), t;
60
61
  }
61
62
  function yt(e) {
62
63
  let t = 0;
63
- for (let s = 0; s < e.length; s++)
64
- t = (t << 5) - t + e.charCodeAt(s) | 0;
64
+ for (let n = 0; n < e.length; n++)
65
+ t = (t << 5) - t + e.charCodeAt(n) | 0;
65
66
  return (t >>> 0).toString(36);
66
67
  }
68
+ function v(e) {
69
+ if (typeof e == "string") {
70
+ const n = e;
71
+ e = (r) => r.tagName === n;
72
+ }
73
+ const t = e;
74
+ return function() {
75
+ let r = Array.from(this.childNodes);
76
+ return t && (r = r.filter((o) => t(o))), r;
77
+ };
78
+ }
67
79
  function kt(e) {
68
- var t = 0, s = e.children, n = s && s.length;
69
- if (!n) t = 1;
70
- else for (; --n >= 0; ) t += s[n].value;
80
+ var t = 0, n = e.children, r = n && n.length;
81
+ if (!r) t = 1;
82
+ else for (; --r >= 0; ) t += n[r].value;
71
83
  e.value = t;
72
84
  }
73
85
  function vt() {
74
86
  return this.eachAfter(kt);
75
87
  }
76
88
  function bt(e) {
77
- var t = this, s, n = [t], o, a, l;
89
+ var t = this, n, r = [t], o, a, l;
78
90
  do
79
- for (s = n.reverse(), n = []; t = s.pop(); )
91
+ for (n = r.reverse(), r = []; t = n.pop(); )
80
92
  if (e(t), o = t.children, o) for (a = 0, l = o.length; a < l; ++a)
81
- n.push(o[a]);
82
- while (n.length);
93
+ r.push(o[a]);
94
+ while (r.length);
83
95
  return this;
84
96
  }
85
97
  function zt(e) {
86
- for (var t = this, s = [t], n, o; t = s.pop(); )
87
- if (e(t), n = t.children, n) for (o = n.length - 1; o >= 0; --o)
88
- s.push(n[o]);
98
+ for (var t = this, n = [t], r, o; t = n.pop(); )
99
+ if (e(t), r = t.children, r) for (o = r.length - 1; o >= 0; --o)
100
+ n.push(r[o]);
89
101
  return this;
90
102
  }
91
103
  function Et(e) {
92
- for (var t = this, s = [t], n = [], o, a, l; t = s.pop(); )
93
- if (n.push(t), o = t.children, o) for (a = 0, l = o.length; a < l; ++a)
94
- s.push(o[a]);
95
- for (; t = n.pop(); )
104
+ for (var t = this, n = [t], r = [], o, a, l; t = n.pop(); )
105
+ if (r.push(t), o = t.children, o) for (a = 0, l = o.length; a < l; ++a)
106
+ n.push(o[a]);
107
+ for (; t = r.pop(); )
96
108
  e(t);
97
109
  return this;
98
110
  }
99
- function wt(e) {
111
+ function Ct(e) {
100
112
  return this.eachAfter(function(t) {
101
- for (var s = +e(t.data) || 0, n = t.children, o = n && n.length; --o >= 0; ) s += n[o].value;
102
- t.value = s;
113
+ for (var n = +e(t.data) || 0, r = t.children, o = r && r.length; --o >= 0; ) n += r[o].value;
114
+ t.value = n;
103
115
  });
104
116
  }
105
- function Ct(e) {
117
+ function wt(e) {
106
118
  return this.eachBefore(function(t) {
107
119
  t.children && t.children.sort(e);
108
120
  });
109
121
  }
110
122
  function St(e) {
111
- for (var t = this, s = Rt(t, e), n = [t]; t !== s; )
112
- t = t.parent, n.push(t);
113
- for (var o = n.length; e !== s; )
114
- n.splice(o, 0, e), e = e.parent;
115
- return n;
123
+ for (var t = this, n = Rt(t, e), r = [t]; t !== n; )
124
+ t = t.parent, r.push(t);
125
+ for (var o = r.length; e !== n; )
126
+ r.splice(o, 0, e), e = e.parent;
127
+ return r;
116
128
  }
117
129
  function Rt(e, t) {
118
130
  if (e === t) return e;
119
- var s = e.ancestors(), n = t.ancestors(), o = null;
120
- for (e = s.pop(), t = n.pop(); e === t; )
121
- o = e, e = s.pop(), t = n.pop();
131
+ var n = e.ancestors(), r = t.ancestors(), o = null;
132
+ for (e = n.pop(), t = r.pop(); e === t; )
133
+ o = e, e = n.pop(), t = r.pop();
122
134
  return o;
123
135
  }
124
136
  function Xt() {
@@ -140,28 +152,28 @@ function jt() {
140
152
  }
141
153
  function Ot() {
142
154
  var e = this, t = [];
143
- return e.each(function(s) {
144
- s !== e && t.push({ source: s.parent, target: s });
155
+ return e.each(function(n) {
156
+ n !== e && t.push({ source: n.parent, target: n });
145
157
  }), t;
146
158
  }
147
- function B(e, t) {
148
- var s = new R(e), n = +e.value && (s.value = e.value), o, a = [s], l, r, c, p;
149
- for (t == null && (t = At); o = a.pop(); )
150
- if (n && (o.value = +o.data.value), (r = t(o.data)) && (p = r.length))
159
+ function A(e, t) {
160
+ var n = new R(e), r = +e.value && (n.value = e.value), o, a = [n], l, s, c, p;
161
+ for (t == null && (t = Bt); o = a.pop(); )
162
+ if (r && (o.value = +o.data.value), (s = t(o.data)) && (p = s.length))
151
163
  for (o.children = new Array(p), c = p - 1; c >= 0; --c)
152
- a.push(l = o.children[c] = new R(r[c])), l.parent = o, l.depth = o.depth + 1;
153
- return s.eachBefore(Ft);
164
+ a.push(l = o.children[c] = new R(s[c])), l.parent = o, l.depth = o.depth + 1;
165
+ return n.eachBefore($t);
154
166
  }
155
- function Bt() {
156
- return B(this).eachBefore($t);
167
+ function At() {
168
+ return A(this).eachBefore(Ft);
157
169
  }
158
- function At(e) {
170
+ function Bt(e) {
159
171
  return e.children;
160
172
  }
161
- function $t(e) {
173
+ function Ft(e) {
162
174
  e.data = e.data.data;
163
175
  }
164
- function Ft(e) {
176
+ function $t(e) {
165
177
  var t = 0;
166
178
  do
167
179
  e.height = t;
@@ -170,28 +182,28 @@ function Ft(e) {
170
182
  function R(e) {
171
183
  this.data = e, this.depth = this.height = 0, this.parent = null;
172
184
  }
173
- R.prototype = B.prototype = {
185
+ R.prototype = A.prototype = {
174
186
  constructor: R,
175
187
  count: vt,
176
188
  each: bt,
177
189
  eachAfter: Et,
178
190
  eachBefore: zt,
179
- sum: wt,
180
- sort: Ct,
191
+ sum: Ct,
192
+ sort: wt,
181
193
  path: St,
182
194
  ancestors: Xt,
183
195
  descendants: Mt,
184
196
  leaves: jt,
185
197
  links: Ot,
186
- copy: Bt
198
+ copy: At
187
199
  };
188
- const Tt = "d3-flextree", Dt = "2.1.2", _t = "build/d3-flextree.js", Ht = "index", Nt = { name: "Chris Maloney", url: "http://chrismaloney.org" }, Lt = "Flexible tree layout algorithm that allows for variable node sizes.", Pt = ["d3", "d3-module", "layout", "tree", "hierarchy", "d3-hierarchy", "plugin", "d3-plugin", "infovis", "visualization", "2d"], Wt = "https://github.com/klortho/d3-flextree", It = "WTFPL", Kt = { type: "git", url: "https://github.com/klortho/d3-flextree.git" }, Gt = { clean: "rm -rf build demo test", "build:demo": "rollup -c --environment BUILD:demo", "build:dev": "rollup -c --environment BUILD:dev", "build:prod": "rollup -c --environment BUILD:prod", "build:test": "rollup -c --environment BUILD:test", build: "rollup -c", lint: "eslint index.js src", "test:main": "node test/bundle.js", "test:browser": "node test/browser-tests.js", test: "npm-run-all test:*", prepare: "npm-run-all clean build lint test" }, Vt = { "d3-hierarchy": "^1.1.5" }, Ut = { "babel-plugin-external-helpers": "^6.22.0", "babel-preset-es2015-rollup": "^3.0.0", d3: "^4.13.0", "d3-selection-multi": "^1.0.1", eslint: "^4.19.1", jsdom: "^11.6.2", "npm-run-all": "^4.1.2", rollup: "^0.55.3", "rollup-plugin-babel": "^2.7.1", "rollup-plugin-commonjs": "^8.0.2", "rollup-plugin-copy": "^0.2.3", "rollup-plugin-json": "^2.3.0", "rollup-plugin-node-resolve": "^3.0.2", "rollup-plugin-uglify": "^3.0.0", "uglify-es": "^3.3.9" }, Yt = {
200
+ const Tt = "d3-flextree", Dt = "2.1.2", Nt = "build/d3-flextree.js", _t = "index", Ht = { name: "Chris Maloney", url: "http://chrismaloney.org" }, Lt = "Flexible tree layout algorithm that allows for variable node sizes.", Pt = ["d3", "d3-module", "layout", "tree", "hierarchy", "d3-hierarchy", "plugin", "d3-plugin", "infovis", "visualization", "2d"], Wt = "https://github.com/klortho/d3-flextree", It = "WTFPL", Kt = { type: "git", url: "https://github.com/klortho/d3-flextree.git" }, Gt = { clean: "rm -rf build demo test", "build:demo": "rollup -c --environment BUILD:demo", "build:dev": "rollup -c --environment BUILD:dev", "build:prod": "rollup -c --environment BUILD:prod", "build:test": "rollup -c --environment BUILD:test", build: "rollup -c", lint: "eslint index.js src", "test:main": "node test/bundle.js", "test:browser": "node test/browser-tests.js", test: "npm-run-all test:*", prepare: "npm-run-all clean build lint test" }, Vt = { "d3-hierarchy": "^1.1.5" }, Ut = { "babel-plugin-external-helpers": "^6.22.0", "babel-preset-es2015-rollup": "^3.0.0", d3: "^4.13.0", "d3-selection-multi": "^1.0.1", eslint: "^4.19.1", jsdom: "^11.6.2", "npm-run-all": "^4.1.2", rollup: "^0.55.3", "rollup-plugin-babel": "^2.7.1", "rollup-plugin-commonjs": "^8.0.2", "rollup-plugin-copy": "^0.2.3", "rollup-plugin-json": "^2.3.0", "rollup-plugin-node-resolve": "^3.0.2", "rollup-plugin-uglify": "^3.0.0", "uglify-es": "^3.3.9" }, Yt = {
189
201
  name: Tt,
190
202
  version: Dt,
191
- main: _t,
192
- module: Ht,
203
+ main: Nt,
204
+ module: _t,
193
205
  "jsnext:main": "index",
194
- author: Nt,
206
+ author: Ht,
195
207
  description: Lt,
196
208
  keywords: Pt,
197
209
  homepage: Wt,
@@ -207,17 +219,17 @@ const Tt = "d3-flextree", Dt = "2.1.2", _t = "build/d3-flextree.js", Ht = "index
207
219
  });
208
220
  function Z(e) {
209
221
  const t = Object.assign({}, qt, e);
210
- function s(r) {
211
- const c = t[r];
222
+ function n(s) {
223
+ const c = t[s];
212
224
  return typeof c == "function" ? c : () => c;
213
225
  }
214
- function n(r) {
215
- const c = l(a(), r, (p) => p.children);
226
+ function r(s) {
227
+ const c = l(a(), s, (p) => p.children);
216
228
  return c.update(), c.data;
217
229
  }
218
230
  function o() {
219
- const r = s("nodeSize"), c = s("spacing");
220
- return class Y extends B.prototype.constructor {
231
+ const s = n("nodeSize"), c = n("spacing");
232
+ return class Y extends A.prototype.constructor {
221
233
  constructor(h) {
222
234
  super(h);
223
235
  }
@@ -226,7 +238,7 @@ function Z(e) {
226
238
  return h.each((u) => u.data = u.data.data), h;
227
239
  }
228
240
  get size() {
229
- return r(this);
241
+ return s(this);
230
242
  }
231
243
  spacing(h) {
232
244
  return c(this, h);
@@ -296,8 +308,8 @@ function Z(e) {
296
308
  };
297
309
  }
298
310
  function a() {
299
- const r = o(), c = s("nodeSize"), p = s("spacing");
300
- return class extends r {
311
+ const s = o(), c = n("nodeSize"), p = n("spacing");
312
+ return class extends s {
301
313
  constructor(h) {
302
314
  super(h), Object.assign(this, {
303
315
  x: 0,
@@ -337,9 +349,9 @@ function Z(e) {
337
349
  }
338
350
  };
339
351
  }
340
- function l(r, c, p) {
352
+ function l(s, c, p) {
341
353
  const h = (u, m) => {
342
- const g = new r(u);
354
+ const g = new s(u);
343
355
  Object.assign(g, {
344
356
  parent: m,
345
357
  depth: m === null ? 0 : m.depth + 1,
@@ -357,127 +369,127 @@ function Z(e) {
357
369
  };
358
370
  return h(c, null);
359
371
  }
360
- return Object.assign(n, {
361
- nodeSize(r) {
362
- return arguments.length ? (t.nodeSize = r, n) : t.nodeSize;
372
+ return Object.assign(r, {
373
+ nodeSize(s) {
374
+ return arguments.length ? (t.nodeSize = s, r) : t.nodeSize;
363
375
  },
364
- spacing(r) {
365
- return arguments.length ? (t.spacing = r, n) : t.spacing;
376
+ spacing(s) {
377
+ return arguments.length ? (t.spacing = s, r) : t.spacing;
366
378
  },
367
- children(r) {
368
- return arguments.length ? (t.children = r, n) : t.children;
379
+ children(s) {
380
+ return arguments.length ? (t.children = s, r) : t.children;
369
381
  },
370
- hierarchy(r, c) {
382
+ hierarchy(s, c) {
371
383
  const p = typeof c > "u" ? t.children : c;
372
- return l(o(), r, p);
384
+ return l(o(), s, p);
373
385
  },
374
- dump(r) {
375
- const c = s("nodeSize"), p = (h) => (u) => {
386
+ dump(s) {
387
+ const c = n("nodeSize"), p = (h) => (u) => {
376
388
  const m = h + " ", g = h + " ", { x: y, y: x } = u, b = c(u), k = u.children || [], z = k.length === 0 ? " " : `,${m}children: [${g}${k.map(p(g)).join(g)}${m}],${h}`;
377
389
  return `{ size: [${b.join(", ")}],${m}x: ${y}, y: ${x}${z}},`;
378
390
  };
379
391
  return p(`
380
- `)(r);
392
+ `)(s);
381
393
  }
382
- }), n;
394
+ }), r;
383
395
  }
384
396
  Z.version = Zt;
385
- const q = (e, t = 0) => (e.y = t, (e.children || []).reduce((s, n) => {
386
- const [o, a] = s;
387
- q(n, e.y + e.ySize);
388
- const l = (o === 0 ? n.lExt : n.rExt).bottom;
397
+ const q = (e, t = 0) => (e.y = t, (e.children || []).reduce((n, r) => {
398
+ const [o, a] = n;
399
+ q(r, e.y + e.ySize);
400
+ const l = (o === 0 ? r.lExt : r.rExt).bottom;
389
401
  o !== 0 && Qt(e, o, a);
390
- const r = ae(l, o, a);
391
- return [o + 1, r];
392
- }, [0, null]), Jt(e), oe(e), e), J = (e, t, s) => {
393
- typeof t > "u" && (t = -e.relX - e.prelim, s = 0);
394
- const n = t + e.relX;
395
- return e.relX = n + e.prelim - s, e.prelim = 0, e.x = s + e.relX, (e.children || []).forEach((o) => J(o, n, e.x)), e;
402
+ const s = ae(l, o, a);
403
+ return [o + 1, s];
404
+ }, [0, null]), Jt(e), oe(e), e), J = (e, t, n) => {
405
+ typeof t > "u" && (t = -e.relX - e.prelim, n = 0);
406
+ const r = t + e.relX;
407
+ return e.relX = r + e.prelim - n, e.prelim = 0, e.x = n + e.relX, (e.children || []).forEach((o) => J(o, r, e.x)), e;
396
408
  }, Jt = (e) => {
397
- (e.children || []).reduce((t, s) => {
398
- const [n, o] = t, a = n + s.shift, l = o + a + s.change;
399
- return s.relX += l, [a, l];
409
+ (e.children || []).reduce((t, n) => {
410
+ const [r, o] = t, a = r + n.shift, l = o + a + n.change;
411
+ return n.relX += l, [a, l];
400
412
  }, [0, 0]);
401
- }, Qt = (e, t, s) => {
402
- const n = e.children[t - 1], o = e.children[t];
403
- let a = n, l = n.relX, r = o, c = o.relX, p = !0;
404
- for (; a && r; ) {
405
- a.bottom > s.lowY && (s = s.next);
406
- const h = l + a.prelim - (c + r.prelim) + a.xSize / 2 + r.xSize / 2 + a.spacing(r);
407
- (h > 0 || h < 0 && p) && (c += h, te(o, h), ee(e, t, s.index, h)), p = !1;
408
- const u = a.bottom, m = r.bottom;
409
- u <= m && (a = ne(a), a && (l += a.relX)), u >= m && (r = re(r), r && (c += r.relX));
413
+ }, Qt = (e, t, n) => {
414
+ const r = e.children[t - 1], o = e.children[t];
415
+ let a = r, l = r.relX, s = o, c = o.relX, p = !0;
416
+ for (; a && s; ) {
417
+ a.bottom > n.lowY && (n = n.next);
418
+ const h = l + a.prelim - (c + s.prelim) + a.xSize / 2 + s.xSize / 2 + a.spacing(s);
419
+ (h > 0 || h < 0 && p) && (c += h, te(o, h), ee(e, t, n.index, h)), p = !1;
420
+ const u = a.bottom, m = s.bottom;
421
+ u <= m && (a = ne(a), a && (l += a.relX)), u >= m && (s = re(s), s && (c += s.relX));
410
422
  }
411
- !a && r ? se(e, t, r, c) : a && !r && ie(e, t, a, l);
423
+ !a && s ? se(e, t, s, c) : a && !s && ie(e, t, a, l);
412
424
  }, te = (e, t) => {
413
425
  e.relX += t, e.lExtRelX += t, e.rExtRelX += t;
414
- }, ee = (e, t, s, n) => {
415
- const o = e.children[t], a = t - s;
426
+ }, ee = (e, t, n, r) => {
427
+ const o = e.children[t], a = t - n;
416
428
  if (a > 1) {
417
- const l = n / a;
418
- e.children[s + 1].shift += l, o.shift -= l, o.change -= n - l;
429
+ const l = r / a;
430
+ e.children[n + 1].shift += l, o.shift -= l, o.change -= r - l;
419
431
  }
420
- }, re = (e) => e.hasChildren ? e.firstChild : e.lThr, ne = (e) => e.hasChildren ? e.lastChild : e.rThr, se = (e, t, s, n) => {
432
+ }, re = (e) => e.hasChildren ? e.firstChild : e.lThr, ne = (e) => e.hasChildren ? e.lastChild : e.rThr, se = (e, t, n, r) => {
421
433
  const o = e.firstChild, a = o.lExt, l = e.children[t];
422
- a.lThr = s;
423
- const r = n - s.relX - o.lExtRelX;
424
- a.relX += r, a.prelim -= r, o.lExt = l.lExt, o.lExtRelX = l.lExtRelX;
425
- }, ie = (e, t, s, n) => {
434
+ a.lThr = n;
435
+ const s = r - n.relX - o.lExtRelX;
436
+ a.relX += s, a.prelim -= s, o.lExt = l.lExt, o.lExtRelX = l.lExtRelX;
437
+ }, ie = (e, t, n, r) => {
426
438
  const o = e.children[t], a = o.rExt, l = e.children[t - 1];
427
- a.rThr = s;
428
- const r = n - s.relX - o.rExtRelX;
429
- a.relX += r, a.prelim -= r, o.rExt = l.rExt, o.rExtRelX = l.rExtRelX;
439
+ a.rThr = n;
440
+ const s = r - n.relX - o.rExtRelX;
441
+ a.relX += s, a.prelim -= s, o.rExt = l.rExt, o.rExtRelX = l.rExtRelX;
430
442
  }, oe = (e) => {
431
443
  if (e.hasChildren) {
432
- const t = e.firstChild, s = e.lastChild, n = (t.prelim + t.relX - t.xSize / 2 + s.relX + s.prelim + s.xSize / 2) / 2;
444
+ const t = e.firstChild, n = e.lastChild, r = (t.prelim + t.relX - t.xSize / 2 + n.relX + n.prelim + n.xSize / 2) / 2;
433
445
  Object.assign(e, {
434
- prelim: n,
446
+ prelim: r,
435
447
  lExt: t.lExt,
436
448
  lExtRelX: t.lExtRelX,
437
- rExt: s.rExt,
438
- rExtRelX: s.rExtRelX
449
+ rExt: n.rExt,
450
+ rExtRelX: n.rExtRelX
439
451
  });
440
452
  }
441
- }, ae = (e, t, s) => {
442
- for (; s !== null && e >= s.lowY; )
443
- s = s.next;
453
+ }, ae = (e, t, n) => {
454
+ for (; n !== null && e >= n.lowY; )
455
+ n = n.next;
444
456
  return {
445
457
  lowY: e,
446
458
  index: t,
447
- next: s
459
+ next: n
448
460
  };
449
- }, Q = ".markmap{--markmap-max-width: 9999px;--markmap-a-color: #0097e6;--markmap-a-hover-color: #00a8ff;--markmap-code-bg: #f0f0f0;--markmap-code-color: #555;--markmap-highlight-bg: #ffeaa7;--markmap-table-border: 1px solid currentColor;--markmap-font: 300 16px/20px sans-serif;--markmap-circle-open-bg: #fff;--markmap-text-color: #333;font:var(--markmap-font);color:var(--markmap-text-color)}.markmap-link{fill:none}.markmap-node>circle{cursor:pointer}.markmap-foreign{display:inline-block}.markmap-foreign p{margin:0}.markmap-foreign a{color:var(--markmap-a-color)}.markmap-foreign a:hover{color:var(--markmap-a-hover-color)}.markmap-foreign code{padding:.25em;font-size:calc(1em - 2px);color:var(--markmap-code-color);background-color:var(--markmap-code-bg);border-radius:2px}.markmap-foreign pre{margin:0}.markmap-foreign pre>code{display:block}.markmap-foreign del{text-decoration:line-through}.markmap-foreign em{font-style:italic}.markmap-foreign strong{font-weight:700}.markmap-foreign mark{background:var(--markmap-highlight-bg)}.markmap-foreign table,.markmap-foreign th,.markmap-foreign td{border-collapse:collapse;border:var(--markmap-table-border)}.markmap-foreign img{display:inline-block}.markmap-foreign svg{fill:currentColor}.markmap-foreign>div{width:var(--markmap-max-width);text-align:left}.markmap-foreign>div>div{display:inline-block}.markmap-dark .markmap{--markmap-code-bg: #1a1b26;--markmap-code-color: #ddd;--markmap-circle-open-bg: #444;--markmap-text-color: #eee}", me = Q, j = lt();
461
+ }, Q = ".markmap{--markmap-max-width: 9999px;--markmap-a-color: #0097e6;--markmap-a-hover-color: #00a8ff;--markmap-code-bg: #f0f0f0;--markmap-code-color: #555;--markmap-highlight-bg: #ffeaa7;--markmap-table-border: 1px solid currentColor;--markmap-font: 300 16px/20px sans-serif;--markmap-circle-open-bg: #fff;--markmap-text-color: #333;font:var(--markmap-font);color:var(--markmap-text-color)}.markmap-link{fill:none}.markmap-node>circle{cursor:pointer}.markmap-foreign{display:inline-block}.markmap-foreign p{margin:0}.markmap-foreign a{color:var(--markmap-a-color)}.markmap-foreign a:hover{color:var(--markmap-a-hover-color)}.markmap-foreign code{padding:.25em;font-size:calc(1em - 2px);color:var(--markmap-code-color);background-color:var(--markmap-code-bg);border-radius:2px}.markmap-foreign pre{margin:0}.markmap-foreign pre>code{display:block}.markmap-foreign del{text-decoration:line-through}.markmap-foreign em{font-style:italic}.markmap-foreign strong{font-weight:700}.markmap-foreign mark{background:var(--markmap-highlight-bg)}.markmap-foreign table,.markmap-foreign th,.markmap-foreign td{border-collapse:collapse;border:var(--markmap-table-border)}.markmap-foreign img{display:inline-block}.markmap-foreign svg{fill:currentColor}.markmap-foreign>div{width:var(--markmap-max-width);text-align:left}.markmap-foreign>div>div{display:inline-block}.markmap-dark .markmap{--markmap-code-bg: #1a1b26;--markmap-code-color: #ddd;--markmap-circle-open-bg: #444;--markmap-text-color: #eee}", me = Q, j = pt();
450
462
  function I(e) {
451
463
  return Math.max(4 - 2 * e.state.depth, 1.5);
452
464
  }
453
465
  function K(e, t) {
454
- const s = pt(e, t);
455
- return e[s];
466
+ const n = ft(e, t);
467
+ return e[n];
456
468
  }
457
469
  function O(e) {
458
470
  e.stopPropagation();
459
471
  }
460
- const le = new ut();
472
+ const le = new at();
461
473
  class tt {
462
- constructor(t, s) {
463
- this.options = U, this.revokers = [], this.handleZoom = (n) => {
464
- const { transform: o } = n;
474
+ constructor(t, n) {
475
+ this.options = U, this.revokers = [], this.handleZoom = (r) => {
476
+ const { transform: o } = r;
465
477
  this.g.attr("transform", o);
466
- }, this.handlePan = (n) => {
467
- n.preventDefault();
468
- const o = w(this.svg.node()), a = o.translate(
469
- -n.deltaX / o.k,
470
- -n.deltaY / o.k
478
+ }, this.handlePan = (r) => {
479
+ r.preventDefault();
480
+ const o = S(this.svg.node()), a = o.translate(
481
+ -r.deltaX / o.k,
482
+ -r.deltaY / o.k
471
483
  );
472
484
  this.svg.call(this.zoom.transform, a);
473
- }, this.handleClick = (n, o) => {
485
+ }, this.handleClick = (r, o) => {
474
486
  let a = this.options.toggleRecursively;
475
- (V ? n.metaKey : n.ctrlKey) && (a = !a), this.toggleNode(o, a);
476
- }, this.ensureView = this.ensureVisible, this.svg = t.datum ? t : ct(t), this.styleNode = this.svg.append("style"), this.zoom = ht().filter((n) => this.options.scrollForPan && n.type === "wheel" ? n.ctrlKey && !n.button : (!n.ctrlKey || n.type === "wheel") && !n.button).on("zoom", this.handleZoom), this.setOptions(s), this.state = {
477
- id: this.options.id || this.svg.attr("id") || mt(),
487
+ (V ? r.metaKey : r.ctrlKey) && (a = !a), this.toggleNode(o, a);
488
+ }, this.ensureView = this.ensureVisible, this.svg = t.datum ? t : ut(t), this.styleNode = this.svg.append("style"), this.zoom = mt().filter((r) => this.options.scrollForPan && r.type === "wheel" ? r.ctrlKey && !r.button : (!r.ctrlKey || r.type === "wheel") && !r.button).on("zoom", this.handleZoom), this.setOptions(n), this.state = {
489
+ id: this.options.id || this.svg.attr("id") || lt(),
478
490
  rect: { x1: 0, y1: 0, x2: 0, y2: 0 }
479
491
  }, this.g = this.svg.append("g"), this.observer = new ResizeObserver(
480
- gt(() => {
492
+ ct(() => {
481
493
  this.renderData();
482
494
  }, 100)
483
495
  ), this.revokers.push(
@@ -488,41 +500,41 @@ class tt {
488
500
  );
489
501
  }
490
502
  getStyleContent() {
491
- const { style: t } = this.options, { id: s } = this.state, n = typeof t == "function" ? t(s) : "";
492
- return [this.options.embedGlobalCSS && Q, n].filter(Boolean).join(`
503
+ const { style: t } = this.options, { id: n } = this.state, r = typeof t == "function" ? t(n) : "";
504
+ return [this.options.embedGlobalCSS && Q, r].filter(Boolean).join(`
493
505
  `);
494
506
  }
495
507
  updateStyle() {
496
508
  this.svg.attr(
497
509
  "class",
498
- ft(this.svg.attr("class"), "markmap", this.state.id)
510
+ ht(this.svg.attr("class"), "markmap", this.state.id)
499
511
  );
500
512
  const t = this.getStyleContent();
501
513
  this.styleNode.text(t);
502
514
  }
503
- async toggleNode(t, s = !1) {
515
+ async toggleNode(t, n = !1) {
504
516
  var o, a;
505
- const n = (o = t.payload) != null && o.fold ? 0 : 1;
506
- s ? C(t, (l, r) => {
517
+ const r = (o = t.payload) != null && o.fold ? 0 : 1;
518
+ n ? C(t, (l, s) => {
507
519
  l.payload = {
508
520
  ...l.payload,
509
- fold: n
510
- }, r();
521
+ fold: r
522
+ }, s();
511
523
  }) : t.payload = {
512
524
  ...t.payload,
513
525
  fold: (a = t.payload) != null && a.fold ? 0 : 1
514
526
  }, await this.renderData(t);
515
527
  }
516
528
  _initializeData(t) {
517
- let s = 0;
518
- const { color: n, initialExpandLevel: o } = this.options;
529
+ let n = 0;
530
+ const { color: r, initialExpandLevel: o } = this.options;
519
531
  let a = 0, l = 0;
520
- C(t, (r, c, p) => {
532
+ C(t, (s, c, p) => {
521
533
  var u, m, g, y;
522
- l += 1, r.children = (u = r.children) == null ? void 0 : u.map((x) => ({ ...x })), s += 1, r.state = {
523
- ...r.state,
534
+ l += 1, s.children = (u = s.children) == null ? void 0 : u.map((x) => ({ ...x })), n += 1, s.state = {
535
+ ...s.state,
524
536
  depth: l,
525
- id: s,
537
+ id: n,
526
538
  rect: {
527
539
  x: 0,
528
540
  y: 0,
@@ -530,47 +542,47 @@ class tt {
530
542
  height: 0
531
543
  },
532
544
  size: [0, 0]
533
- }, r.state.key = [(m = p == null ? void 0 : p.state) == null ? void 0 : m.id, r.state.id].filter(Boolean).join(".") + yt(r.content), r.state.path = [(g = p == null ? void 0 : p.state) == null ? void 0 : g.path, r.state.id].filter(Boolean).join("."), n(r);
534
- const h = ((y = r.payload) == null ? void 0 : y.fold) === 2;
535
- h ? a += 1 : (a || o >= 0 && r.state.depth >= o) && (r.payload = { ...r.payload, fold: 1 }), c(), h && (a -= 1), l -= 1;
545
+ }, s.state.key = [(m = p == null ? void 0 : p.state) == null ? void 0 : m.id, s.state.id].filter(Boolean).join(".") + yt(s.content), s.state.path = [(g = p == null ? void 0 : p.state) == null ? void 0 : g.path, s.state.id].filter(Boolean).join("."), r(s);
546
+ const h = ((y = s.payload) == null ? void 0 : y.fold) === 2;
547
+ h ? a += 1 : (a || o >= 0 && s.state.depth >= o) && (s.payload = { ...s.payload, fold: 1 }), c(), h && (a -= 1), l -= 1;
536
548
  });
537
549
  }
538
550
  _relayout() {
539
551
  if (!this.state.data) return;
540
552
  this.g.selectAll(v("g")).selectAll(
541
553
  v("foreignObject")
542
- ).each(function(r) {
554
+ ).each(function(s) {
543
555
  var h;
544
556
  const c = (h = this.firstChild) == null ? void 0 : h.firstChild, p = [c.scrollWidth, c.scrollHeight];
545
- r.state.size = p;
557
+ s.state.size = p;
546
558
  });
547
- const { spacingHorizontal: t, paddingX: s, spacingVertical: n } = this.options, o = Z({}).children((r) => {
559
+ const { spacingHorizontal: t, paddingX: n, spacingVertical: r } = this.options, o = Z({}).children((s) => {
548
560
  var c;
549
- if (!((c = r.payload) != null && c.fold)) return r.children;
550
- }).nodeSize((r) => {
551
- const [c, p] = r.data.state.size;
552
- return [p, c + (c ? s * 2 : 0) + t];
553
- }).spacing((r, c) => r.parent === c.parent ? n : n * 2), a = o.hierarchy(this.state.data);
561
+ if (!((c = s.payload) != null && c.fold)) return s.children;
562
+ }).nodeSize((s) => {
563
+ const [c, p] = s.data.state.size;
564
+ return [p, c + (c ? n * 2 : 0) + t];
565
+ }).spacing((s, c) => s.parent === c.parent ? r : r * 2), a = o.hierarchy(this.state.data);
554
566
  o(a);
555
567
  const l = a.descendants();
556
- l.forEach((r) => {
557
- const c = r.data;
568
+ l.forEach((s) => {
569
+ const c = s.data;
558
570
  c.state.rect = {
559
- x: r.y,
560
- y: r.x - r.xSize / 2,
561
- width: r.ySize - t,
562
- height: r.xSize
571
+ x: s.y,
572
+ y: s.x - s.xSize / 2,
573
+ width: s.ySize - t,
574
+ height: s.xSize
563
575
  };
564
576
  }), this.state.rect = {
565
- x1: P(l, (r) => r.data.state.rect.x) || 0,
566
- y1: P(l, (r) => r.data.state.rect.y) || 0,
577
+ x1: P(l, (s) => s.data.state.rect.x) || 0,
578
+ y1: P(l, (s) => s.data.state.rect.y) || 0,
567
579
  x2: W(
568
580
  l,
569
- (r) => r.data.state.rect.x + r.data.state.rect.width
581
+ (s) => s.data.state.rect.x + s.data.state.rect.width
570
582
  ) || 0,
571
583
  y2: W(
572
584
  l,
573
- (r) => r.data.state.rect.y + r.data.state.rect.height
585
+ (s) => s.data.state.rect.y + s.data.state.rect.height
574
586
  ) || 0
575
587
  };
576
588
  }
@@ -580,39 +592,39 @@ class tt {
580
592
  ...t
581
593
  }, this.options.zoom ? this.svg.call(this.zoom) : this.svg.on(".zoom", null), this.options.pan ? this.svg.on("wheel", this.handlePan) : this.svg.on("wheel", null);
582
594
  }
583
- async setData(t, s) {
584
- s && this.setOptions(s), t && (this.state.data = t), this.state.data && (this._initializeData(this.state.data), this.updateStyle(), await this.renderData());
595
+ async setData(t, n) {
596
+ n && this.setOptions(n), t && (this.state.data = t), this.state.data && (this._initializeData(this.state.data), this.updateStyle(), await this.renderData());
585
597
  }
586
598
  async renderData(t) {
587
- const { paddingX: s, autoFit: n, color: o, maxWidth: a } = this.options, l = this.state.data;
599
+ const { paddingX: n, autoFit: r, color: o, maxWidth: a } = this.options, l = this.state.data;
588
600
  if (!l) return;
589
- const r = {}, c = {}, p = [];
601
+ const s = {}, c = {}, p = [];
590
602
  C(l, (i, d, f) => {
591
603
  var E;
592
- (E = i.payload) != null && E.fold || d(), r[i.state.id] = i, f && (c[i.state.id] = f.state.id), p.push(i);
604
+ (E = i.payload) != null && E.fold || d(), s[i.state.id] = i, f && (c[i.state.id] = f.state.id), p.push(i);
593
605
  });
594
606
  const h = {}, u = {}, m = (i) => {
595
607
  !i || h[i.state.id] || C(i, (d, f) => {
596
608
  h[d.state.id] = i.state.id, f();
597
609
  });
598
- }, g = (i) => u[h[i.state.id]] || l.state.rect, y = (i) => (r[h[i.state.id]] || l).state.rect;
610
+ }, g = (i) => u[h[i.state.id]] || l.state.rect, y = (i) => (s[h[i.state.id]] || l).state.rect;
599
611
  u[l.state.id] = l.state.rect, t && m(t);
600
612
  const x = this.g.selectAll(v("g")).each((i) => {
601
613
  u[i.state.id] = i.state.rect;
602
614
  }).data(p, (i) => i.state.key), b = x.enter().append("g").attr("data-depth", (i) => i.state.depth).attr("data-path", (i) => i.state.path).each((i) => {
603
- m(r[c[i.state.id]]);
615
+ m(s[c[i.state.id]]);
604
616
  }), k = x.exit().each((i) => {
605
- m(r[c[i.state.id]]);
617
+ m(s[c[i.state.id]]);
606
618
  }), z = x.merge(b).attr(
607
619
  "class",
608
620
  (i) => {
609
621
  var d;
610
622
  return ["markmap-node", ((d = i.payload) == null ? void 0 : d.fold) && "markmap-fold"].filter(Boolean).join(" ");
611
623
  }
612
- ), A = z.selectAll(v("line")).data(
624
+ ), B = z.selectAll(v("line")).data(
613
625
  (i) => [i],
614
626
  (i) => i.state.key
615
- ), $ = A.enter().append("line").attr("stroke", (i) => o(i)).attr("stroke-width", 0), F = A.merge($), T = z.selectAll(v("circle")).data(
627
+ ), F = B.enter().append("line").attr("stroke", (i) => o(i)).attr("stroke-width", 0), $ = B.merge(F), T = z.selectAll(v("circle")).data(
616
628
  (i) => {
617
629
  var d;
618
630
  return (d = i.children) != null && d.length ? [i] : [];
@@ -624,24 +636,24 @@ class tt {
624
636
  var d;
625
637
  return (d = i.payload) != null && d.fold && i.children ? o(i) : "var(--markmap-circle-open-bg)";
626
638
  }
627
- ), _ = this.observer, H = z.selectAll(v("foreignObject")).data(
639
+ ), N = this.observer, _ = z.selectAll(v("foreignObject")).data(
628
640
  (i) => [i],
629
641
  (i) => i.state.key
630
- ), X = H.enter().append("foreignObject").attr("class", "markmap-foreign").attr("x", s).attr("y", 0).style("opacity", 0).on("mousedown", O).on("dblclick", O);
642
+ ), X = _.enter().append("foreignObject").attr("class", "markmap-foreign").attr("x", n).attr("y", 0).style("opacity", 0).on("mousedown", O).on("dblclick", O);
631
643
  X.append("xhtml:div").append("xhtml:div").html((i) => i.content).attr("xmlns", "http://www.w3.org/1999/xhtml"), X.each(function() {
632
644
  var d;
633
645
  const i = (d = this.firstChild) == null ? void 0 : d.firstChild;
634
- _.observe(i);
646
+ N.observe(i);
635
647
  });
636
- const N = k.selectAll(
648
+ const H = k.selectAll(
637
649
  v("foreignObject")
638
650
  );
639
- N.each(function() {
651
+ H.each(function() {
640
652
  var d;
641
653
  const i = (d = this.firstChild) == null ? void 0 : d.firstChild;
642
- _.unobserve(i);
654
+ N.unobserve(i);
643
655
  });
644
- const L = X.merge(H), et = p.flatMap(
656
+ const L = X.merge(_), et = p.flatMap(
645
657
  (i) => {
646
658
  var d;
647
659
  return (d = i.payload) != null && d.fold ? [] : i.children.map((f) => ({ source: i, target: f }));
@@ -669,11 +681,11 @@ class tt {
669
681
  const st = k.selectAll(
670
682
  v("line")
671
683
  );
672
- this.transition(st).attr("x1", (i) => i.state.rect.width).attr("stroke-width", 0), $.attr("x1", (i) => i.state.rect.width).attr("x2", (i) => i.state.rect.width), F.attr("y1", (i) => i.state.rect.height).attr("y2", (i) => i.state.rect.height), this.transition(F).attr("x1", -1).attr("x2", (i) => i.state.rect.width + 2).attr("stroke", (i) => o(i)).attr("stroke-width", I);
684
+ this.transition(st).attr("x1", (i) => i.state.rect.width).attr("stroke-width", 0), F.attr("x1", (i) => i.state.rect.width).attr("x2", (i) => i.state.rect.width), $.attr("y1", (i) => i.state.rect.height).attr("y2", (i) => i.state.rect.height), this.transition($).attr("x1", -1).attr("x2", (i) => i.state.rect.width + 2).attr("stroke", (i) => o(i)).attr("stroke-width", I);
673
685
  const it = k.selectAll(
674
686
  v("circle")
675
687
  );
676
- this.transition(it).attr("r", 0).attr("stroke-width", 0), D.attr("cx", (i) => i.state.rect.width).attr("cy", (i) => i.state.rect.height), this.transition(D).attr("r", 6).attr("stroke-width", "1.5"), this.transition(N).style("opacity", 0), L.attr("width", (i) => Math.max(0, i.state.rect.width - s * 2)).attr("height", (i) => i.state.rect.height), this.transition(L).style("opacity", 1), this.transition(rt).attr("d", (i) => {
688
+ this.transition(it).attr("r", 0).attr("stroke-width", 0), D.attr("cx", (i) => i.state.rect.width).attr("cy", (i) => i.state.rect.height), this.transition(D).attr("r", 6).attr("stroke-width", "1.5"), this.transition(H).style("opacity", 0), L.attr("width", (i) => Math.max(0, i.state.rect.width - n * 2)).attr("height", (i) => i.state.rect.height), this.transition(L).style("opacity", 1), this.transition(rt).attr("d", (i) => {
677
689
  const d = y(i.target), f = [
678
690
  d.x + d.width,
679
691
  d.y + d.height
@@ -688,105 +700,108 @@ class tt {
688
700
  f.state.rect.y + f.state.rect.height
689
701
  ];
690
702
  return j({ source: E, target: ot });
691
- }), n && this.fit();
703
+ }), r && this.fit();
692
704
  }
693
705
  transition(t) {
694
- const { duration: s } = this.options;
695
- return t.transition().duration(s);
706
+ const { duration: n } = this.options;
707
+ return t.transition().duration(n);
696
708
  }
697
709
  /**
698
710
  * Fit the content to the viewport.
699
711
  */
700
712
  async fit(t = this.options.maxInitialScale) {
701
- const s = this.svg.node(), { width: n, height: o } = s.getBoundingClientRect(), { fitRatio: a } = this.options, { x1: l, y1: r, x2: c, y2: p } = this.state.rect, h = c - l, u = p - r, m = Math.min(
702
- n / h * a,
713
+ const n = this.svg.node(), { width: r, height: o } = n.getBoundingClientRect(), { fitRatio: a } = this.options, { x1: l, y1: s, x2: c, y2: p } = this.state.rect, h = c - l, u = p - s, m = Math.min(
714
+ r / h * a,
703
715
  o / u * a,
704
716
  t
705
- ), g = dt.translate(
706
- (n - h * m) / 2 - l * m,
707
- (o - u * m) / 2 - r * m
717
+ ), g = gt.translate(
718
+ (r - h * m) / 2 - l * m,
719
+ (o - u * m) / 2 - s * m
708
720
  ).scale(m);
709
- return this.transition(this.svg).call(this.zoom.transform, g).end().catch(S);
721
+ return this.transition(this.svg).call(this.zoom.transform, g).end().catch(w);
710
722
  }
711
723
  findElement(t) {
712
- let s;
724
+ let n;
713
725
  return this.g.selectAll(v("g")).each(function(o) {
714
- o === t && (s = {
726
+ o === t && (n = {
715
727
  data: o,
716
728
  g: this
717
729
  });
718
- }), s;
730
+ }), n;
719
731
  }
720
732
  /**
721
733
  * Pan the content to make the provided node visible in the viewport.
722
734
  */
723
- async ensureVisible(t, s) {
735
+ async ensureVisible(t, n) {
724
736
  var b;
725
- const n = (b = this.findElement(t)) == null ? void 0 : b.data;
726
- if (!n) return;
727
- const o = this.svg.node(), a = o.getBoundingClientRect(), l = w(o), [r, c] = [
728
- n.state.rect.x,
729
- n.state.rect.x + n.state.rect.width + 2
737
+ const r = (b = this.findElement(t)) == null ? void 0 : b.data;
738
+ if (!r) return;
739
+ const o = this.svg.node(), a = o.getBoundingClientRect(), l = S(o), [s, c] = [
740
+ r.state.rect.x,
741
+ r.state.rect.x + r.state.rect.width + 2
730
742
  ].map((k) => k * l.k + l.x), [p, h] = [
731
- n.state.rect.y,
732
- n.state.rect.y + n.state.rect.height
743
+ r.state.rect.y,
744
+ r.state.rect.y + r.state.rect.height
733
745
  ].map((k) => k * l.k + l.y), u = {
734
746
  left: 0,
735
747
  right: 0,
736
748
  top: 0,
737
749
  bottom: 0,
738
- ...s
739
- }, m = [u.left - r, a.width - u.right - c], g = [u.top - p, a.height - u.bottom - h], y = m[0] * m[1] > 0 ? K(m, Math.abs) / l.k : 0, x = g[0] * g[1] > 0 ? K(g, Math.abs) / l.k : 0;
750
+ ...n
751
+ }, m = [u.left - s, a.width - u.right - c], g = [u.top - p, a.height - u.bottom - h], y = m[0] * m[1] > 0 ? K(m, Math.abs) / l.k : 0, x = g[0] * g[1] > 0 ? K(g, Math.abs) / l.k : 0;
740
752
  if (y || x) {
741
753
  const k = l.translate(y, x);
742
- return this.transition(this.svg).call(this.zoom.transform, k).end().catch(S);
754
+ return this.transition(this.svg).call(this.zoom.transform, k).end().catch(w);
743
755
  }
744
756
  }
745
- async centerNode(t, s) {
757
+ async centerNode(t, n) {
746
758
  var y;
747
- const n = (y = this.findElement(t)) == null ? void 0 : y.data;
748
- if (!n) return;
749
- const o = this.svg.node(), a = o.getBoundingClientRect(), l = w(o), r = (n.state.rect.x + n.state.rect.width / 2) * l.k + l.x, c = (n.state.rect.y + n.state.rect.height / 2) * l.k + l.y, p = {
759
+ const r = (y = this.findElement(t)) == null ? void 0 : y.data;
760
+ if (!r) return;
761
+ const o = this.svg.node(), a = o.getBoundingClientRect(), l = S(o), s = (r.state.rect.x + r.state.rect.width / 2) * l.k + l.x, c = (r.state.rect.y + r.state.rect.height / 2) * l.k + l.y, p = {
750
762
  left: 0,
751
763
  right: 0,
752
764
  top: 0,
753
765
  bottom: 0,
754
- ...s
755
- }, h = (p.left + a.width - p.right) / 2, u = (p.top + a.height - p.bottom) / 2, m = (h - r) / l.k, g = (u - c) / l.k;
766
+ ...n
767
+ }, h = (p.left + a.width - p.right) / 2, u = (p.top + a.height - p.bottom) / 2, m = (h - s) / l.k, g = (u - c) / l.k;
756
768
  if (m || g) {
757
769
  const x = l.translate(m, g);
758
- return this.transition(this.svg).call(this.zoom.transform, x).end().catch(S);
770
+ return this.transition(this.svg).call(this.zoom.transform, x).end().catch(w);
759
771
  }
760
772
  }
761
773
  /**
762
774
  * Scale content with it pinned at the center of the viewport.
763
775
  */
764
776
  async rescale(t) {
765
- const s = this.svg.node(), { width: n, height: o } = s.getBoundingClientRect(), a = n / 2, l = o / 2, r = w(s), c = r.translate(
766
- (a - r.x) * (1 - t) / r.k,
767
- (l - r.y) * (1 - t) / r.k
777
+ const n = this.svg.node(), { width: r, height: o } = n.getBoundingClientRect(), a = r / 2, l = o / 2, s = S(n), c = s.translate(
778
+ (a - s.x) * (1 - t) / s.k,
779
+ (l - s.y) * (1 - t) / s.k
768
780
  ).scale(t);
769
- return this.transition(this.svg).call(this.zoom.transform, c).end().catch(S);
781
+ return this.transition(this.svg).call(this.zoom.transform, c).end().catch(w);
770
782
  }
771
783
  destroy() {
772
784
  this.svg.on(".zoom", null), this.svg.html(null), this.revokers.forEach((t) => {
773
785
  t();
774
786
  });
775
787
  }
776
- static create(t, s, n = null) {
777
- const o = new tt(t, s);
778
- return n && o.setData(n).then(() => {
788
+ static create(t, n, r = null) {
789
+ const o = new tt(t, n);
790
+ return r && o.setData(r).then(() => {
779
791
  o.fit();
780
792
  }), o;
781
793
  }
782
794
  }
783
795
  export {
784
796
  tt as Markmap,
797
+ v as childSelector,
785
798
  xt as defaultColorFn,
786
799
  U as defaultOptions,
787
800
  ue as deriveOptions,
788
801
  me as globalCSS,
789
802
  V as isMacintosh,
803
+ xe as loadCSS,
804
+ ye as loadJS,
790
805
  le as refreshHook,
791
806
  yt as simpleHash
792
807
  };