@netless/appliance-plugin 1.1.34-beta.3 → 1.1.35-beta.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.
Files changed (51) hide show
  1. package/READMA.zh-CN.md +33 -1
  2. package/README.md +32 -0
  3. package/cdn/cdn.js +1 -1
  4. package/cdn/fullWorker-BShzOf.js +486 -0
  5. package/cdn/subWorker-DofGU2.js +486 -0
  6. package/dist/appliance-plugin.js +1 -1
  7. package/dist/appliance-plugin.mjs +1 -1
  8. package/dist/assets/fullWorker-BLBp1QlT.js +593 -0
  9. package/dist/assets/subWorker-CA5sK8hX.js +593 -0
  10. package/dist/{bridge-Bb-MjyNY.mjs → bridge-D6IerdOk.mjs} +6 -6
  11. package/dist/{bridge-m2Uim0rf.js → bridge-s6K3XU2g.js} +1 -1
  12. package/dist/bridge.js +1 -1
  13. package/dist/bridge.mjs +1 -1
  14. package/dist/core/autoShape/index.d.ts +12 -0
  15. package/dist/core/autoShape/mapper.d.ts +3 -0
  16. package/dist/core/autoShape/recognizer.d.ts +8 -0
  17. package/dist/core/autoShape/registry.d.ts +2 -0
  18. package/dist/core/autoShape/templates.d.ts +2 -0
  19. package/dist/core/autoShape/types.d.ts +78 -0
  20. package/dist/core/mainEngine.d.ts +9 -0
  21. package/dist/core/tools/pencil.d.ts +3 -0
  22. package/dist/core/types.d.ts +7 -0
  23. package/dist/fullWorker.js +147 -147
  24. package/dist/index-328yD4vj.js +1 -0
  25. package/dist/{index-B5p02yLM.mjs → index-4k563Sm-.mjs} +3076 -2293
  26. package/dist/index-C89lvDjQ.js +1 -0
  27. package/dist/{index-C-ITXa9_.js → index-CBE_U7Gn.js} +3 -3
  28. package/dist/{index-BAEfMWKR.mjs → index-CPmHcL9u.mjs} +1041 -1013
  29. package/dist/{index-BbVM6AMN.mjs → index-D-IWIyEl.mjs} +260 -253
  30. package/dist/{index-D9CYiyfx.mjs → index-D1p6YXf0.mjs} +3014 -2238
  31. package/dist/{index-HS0sRcOj.js → index-DDL0Hq_X.js} +3 -3
  32. package/dist/{index-on8Dtynb.mjs → index-DR2km5D4.mjs} +215 -208
  33. package/dist/index-DXx1-O0K.js +1 -0
  34. package/dist/index-DbLWM-6h.js +1 -0
  35. package/dist/{index-O6ldDna3.mjs → index-IQRiGPX7.mjs} +1041 -1013
  36. package/dist/plugin/multi/containerManager.d.ts +7 -0
  37. package/dist/plugin/types.d.ts +24 -0
  38. package/dist/subWorker.js +147 -147
  39. package/dist/svgToImageLoader-B3gIDAQo.js +1 -0
  40. package/dist/svgToImageLoader-DZz5bAo4.mjs +22 -0
  41. package/package.json +11 -5
  42. package/cdn/fullWorker-cY8Uuj.js +0 -486
  43. package/cdn/subWorker-BleGf3.js +0 -486
  44. package/dist/assets/fullWorker-BuSPsz-_.js +0 -593
  45. package/dist/assets/subWorker-B0NfJ2Bk.js +0 -593
  46. package/dist/index-BVYBjZU_.js +0 -1
  47. package/dist/index-D696FwsD.js +0 -1
  48. package/dist/index-DTeRhVER.js +0 -1
  49. package/dist/index-DnT8RFOT.js +0 -1
  50. package/dist/svgToImageLoader-DPRAAhwW.js +0 -1
  51. package/dist/svgToImageLoader-mXH53h-l.mjs +0 -18
@@ -1,7 +1,7 @@
1
1
  var K = Object.defineProperty;
2
2
  var j = (o, e, t) => e in o ? K(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var p = (o, e, t) => j(o, typeof e != "symbol" ? e + "" : e, t);
4
- import { E as B, a as k, b as D, c as x, d as E, V as P, S as Z } from "./index-D9CYiyfx.mjs";
3
+ var u = (o, e, t) => j(o, typeof e != "symbol" ? e + "" : e, t);
4
+ import { E as B, a as y, b as D, c as M, d as E, V as P, S as Z } from "./index-D1p6YXf0.mjs";
5
5
  import { isEqual as W, isString as _, clone as J, throttle as Q } from "lodash";
6
6
  import "spritejs";
7
7
  import "lz-string";
@@ -15,7 +15,7 @@ import { Transformer as ee } from "markmap-lib";
15
15
  import { O as te } from "./ObserverMap-BudneEfB.mjs";
16
16
  class re {
17
17
  constructor() {
18
- p(this, "threadEngine");
18
+ u(this, "threadEngine");
19
19
  }
20
20
  registerBackgroundThread(e) {
21
21
  return this.threadEngine = e, this;
@@ -24,11 +24,11 @@ class re {
24
24
  class ae extends re {
25
25
  constructor() {
26
26
  super(...arguments);
27
- p(this, "emitEventType", B.CopyNode);
27
+ u(this, "emitEventType", B.CopyNode);
28
28
  }
29
29
  async consume(t) {
30
30
  const { msgType: r, dataType: s, emitEventType: i } = t;
31
- if (r === k.FullWork && s === D.Local && i === this.emitEventType)
31
+ if (r === y.FullWork && s === D.Local && i === this.emitEventType)
32
32
  return this.consumeForLocalWorker(t), !0;
33
33
  }
34
34
  async consumeForLocalWorker(t) {
@@ -39,7 +39,7 @@ class ae extends re {
39
39
  }
40
40
  class se {
41
41
  constructor(e) {
42
- p(this, "builders", /* @__PURE__ */ new Map());
42
+ u(this, "builders", /* @__PURE__ */ new Map());
43
43
  this.builders = new Map(e.map((t) => [t, this.build(t)]));
44
44
  }
45
45
  build(e) {
@@ -79,16 +79,16 @@ async function ne() {
79
79
  function oe() {
80
80
  return (N == null ? void 0 : N.default) || null;
81
81
  }
82
- const I = class I {
82
+ const T = class T {
83
83
  constructor() {
84
84
  // 使用 workId 作为 key,存储每个实例的 mermaid 代码块
85
- p(this, "mermaidCodeBlocksByWorkId", /* @__PURE__ */ new Map());
85
+ u(this, "mermaidCodeBlocksByWorkId", /* @__PURE__ */ new Map());
86
86
  }
87
87
  /**
88
88
  * 获取 MermaidManager 单例实例
89
89
  */
90
90
  static getInstance() {
91
- return I.instance || (I.instance = new I()), I.instance;
91
+ return T.instance || (T.instance = new T()), T.instance;
92
92
  }
93
93
  /**
94
94
  * 生成唯一的 mermaid ID
@@ -134,39 +134,39 @@ const I = class I {
134
134
  */
135
135
  extendMarkdown(e, t) {
136
136
  const r = e.md.renderer, s = r.rules.fence, i = this;
137
- r.rules.fence = (a, n, c, d, w) => {
138
- const u = a[n];
139
- if (u.info.trim() === "mermaid") {
140
- const g = i.generateId();
141
- return i.createContainer(g, u.content, t);
137
+ r.rules.fence = (a, n, c, h, g) => {
138
+ const p = a[n];
139
+ if (p.info.trim() === "mermaid") {
140
+ const f = i.generateId();
141
+ return i.createContainer(f, p.content, t);
142
142
  }
143
- return s ? s(a, n, c, d, w) : "";
143
+ return s ? s(a, n, c, h, g) : "";
144
144
  };
145
145
  }
146
146
  // 为了向后兼容,保留静态方法(内部使用单例)
147
147
  static generateId() {
148
- return I.getInstance().generateId();
148
+ return T.getInstance().generateId();
149
149
  }
150
150
  static createContainer(e, t, r) {
151
- return I.getInstance().createContainer(
151
+ return T.getInstance().createContainer(
152
152
  e,
153
153
  t,
154
154
  r
155
155
  );
156
156
  }
157
157
  static getCode(e, t) {
158
- return I.getInstance().getCode(e, t);
158
+ return T.getInstance().getCode(e, t);
159
159
  }
160
160
  static clear(e) {
161
- I.getInstance().clear(e);
161
+ T.getInstance().clear(e);
162
162
  }
163
163
  static extendMarkdown(e, t) {
164
- I.getInstance().extendMarkdown(e, t);
164
+ T.getInstance().extendMarkdown(e, t);
165
165
  }
166
166
  };
167
- p(I, "instance", null);
168
- let b = I;
169
- class T {
167
+ u(T, "instance", null);
168
+ let O = T;
169
+ class b {
170
170
  /**
171
171
  * 检查 markmap 节点及其子节点是否包含 mermaid 代码块
172
172
  * @param node markmap 节点数据
@@ -179,7 +179,7 @@ class T {
179
179
  return !0;
180
180
  if (e.children && Array.isArray(e.children)) {
181
181
  for (const t of e.children)
182
- if (T.checkNodeHasMermaid(t))
182
+ if (b.checkNodeHasMermaid(t))
183
183
  return !0;
184
184
  }
185
185
  return !1;
@@ -191,7 +191,7 @@ class T {
191
191
  * @returns Promise<void>
192
192
  */
193
193
  static async renderMermaidAfterDOMUpdate(e, t) {
194
- await T.renderMermaidBlocks(e, t);
194
+ await b.renderMermaidBlocks(e, t);
195
195
  }
196
196
  /**
197
197
  * 渲染所有 mermaid 容器中的图表
@@ -214,42 +214,42 @@ class T {
214
214
  let s = null, i = !1;
215
215
  for (let n = 0; n < 30; n++) {
216
216
  const c = e.querySelectorAll("foreignObject");
217
- if (s = e.querySelectorAll(".mermaid-container"), s.length > 0 || (c.length > 0 && (i = !0), await new Promise((d) => setTimeout(d, 50)), i && n >= 20))
217
+ if (s = e.querySelectorAll(".mermaid-container"), s.length > 0 || (c.length > 0 && (i = !0), await new Promise((h) => setTimeout(h, 50)), i && n >= 20))
218
218
  break;
219
219
  }
220
220
  if (!s || s.length === 0)
221
221
  return;
222
222
  const a = Array.from(s).map(
223
223
  async (n, c) => {
224
- const d = n, w = d.getAttribute("data-mermaid-id"), u = w ? b.getCode(w, t) : void 0, l = d.querySelector(
224
+ const h = n, g = h.getAttribute("data-mermaid-id"), p = g ? O.getCode(g, t) : void 0, d = h.querySelector(
225
225
  ".mermaid-placeholder"
226
226
  );
227
- if (!(!l || !u))
227
+ if (!(!d || !p))
228
228
  try {
229
- const f = `mermaid-${t.replace(/[^a-zA-Z0-9_-]/g, "-")}-${Date.now()}-${c}`, { svg: v } = await r.render(f, u);
230
- if (l && l.parentNode) {
231
- const y = document.createElement("div");
232
- y.innerHTML = v;
233
- const m = y.querySelector("svg");
234
- if (m) {
235
- if (!m.getAttribute("viewBox") && m.getAttribute("width") && m.getAttribute("height")) {
236
- const A = m.getAttribute("width"), S = m.getAttribute("height"), M = parseFloat((A == null ? void 0 : A.replace(/px|%/, "")) || "0"), O = parseFloat(
237
- (S == null ? void 0 : S.replace(/px|%/, "")) || "0"
229
+ const w = `mermaid-${t.replace(/[^a-zA-Z0-9_-]/g, "-")}-${Date.now()}-${c}`, { svg: v } = await r.render(w, p);
230
+ if (d && d.parentNode) {
231
+ const I = document.createElement("div");
232
+ I.innerHTML = v;
233
+ const l = I.querySelector("svg");
234
+ if (l) {
235
+ if (!l.getAttribute("viewBox") && l.getAttribute("width") && l.getAttribute("height")) {
236
+ const S = l.getAttribute("width"), k = l.getAttribute("height"), x = parseFloat((S == null ? void 0 : S.replace(/px|%/, "")) || "0"), A = parseFloat(
237
+ (k == null ? void 0 : k.replace(/px|%/, "")) || "0"
238
238
  );
239
- M > 0 && O > 0 && m.setAttribute(
239
+ x > 0 && A > 0 && l.setAttribute(
240
240
  "viewBox",
241
- `0 0 ${M} ${O}`
241
+ `0 0 ${x} ${A}`
242
242
  );
243
243
  }
244
- m.style.display = "block", m.style.maxWidth = "100%", m.style.width = "auto", m.style.height = "auto", m.style.overflow = "visible", m.style.verticalAlign = "top", m.style.objectFit = "contain";
245
- const h = document.createElement("div");
246
- h.className = "mermaid-wrapper", h.style.width = "100%", h.style.height = "auto", h.style.overflow = "hidden", h.style.display = "inline-block", h.style.verticalAlign = "top", h.style.margin = "0", h.style.padding = "0", h.style.boxSizing = "border-box", h.style.position = "relative", this.isSafari() && (h.style.clipPath = "inset(100% 0 0 0)", h.style.pointerEvents = "none"), h.appendChild(m), m.style.width = "100%", m.style.height = "100%", m.style.maxWidth = "100%", m.style.maxHeight = "100%", m.style.objectFit = "contain", m.setAttribute("data-type", "mermaid"), this.isSafari() && (m.style.opacity = "0"), l.parentNode.replaceChild(h, l);
244
+ l.style.display = "block", l.style.maxWidth = "100%", l.style.width = "auto", l.style.height = "auto", l.style.overflow = "visible", l.style.verticalAlign = "top", l.style.objectFit = "contain";
245
+ const m = document.createElement("div");
246
+ m.className = "mermaid-wrapper", m.style.width = "100%", m.style.height = "auto", m.style.overflow = "hidden", m.style.display = "inline-block", m.style.verticalAlign = "top", m.style.margin = "0", m.style.padding = "0", m.style.boxSizing = "border-box", m.style.position = "relative", this.isSafari() && (m.style.clipPath = "inset(100% 0 0 0)", m.style.pointerEvents = "none"), m.appendChild(l), l.style.width = "100%", l.style.height = "100%", l.style.maxWidth = "100%", l.style.maxHeight = "100%", l.style.objectFit = "contain", l.setAttribute("data-type", "mermaid"), this.isSafari() && (l.style.opacity = "0"), d.parentNode.replaceChild(m, d);
247
247
  } else
248
- l.outerHTML = v;
248
+ d.outerHTML = v;
249
249
  }
250
- } catch (g) {
251
- const f = g instanceof Error ? g.message : String(g);
252
- l && (l.textContent = `Mermaid 渲染失败: ${f}`, l.style.color = "red", l.style.fontSize = "12px");
250
+ } catch (f) {
251
+ const w = f instanceof Error ? f.message : String(f);
252
+ d && (d.textContent = `Mermaid 渲染失败: ${w}`, d.style.color = "red", d.style.fontSize = "12px");
253
253
  }
254
254
  }
255
255
  );
@@ -292,8 +292,8 @@ class T {
292
292
  'svg[data-type="mermaid"]'
293
293
  );
294
294
  if (!n) {
295
- const w = a.querySelector(".mermaid-wrapper");
296
- w && (n = w.querySelector(
295
+ const g = a.querySelector(".mermaid-wrapper");
296
+ g && (n = g.querySelector(
297
297
  'svg[data-type="mermaid"]'
298
298
  ));
299
299
  }
@@ -301,67 +301,67 @@ class T {
301
301
  return;
302
302
  const c = a.querySelector(
303
303
  ".mermaid-container"
304
- ), d = c == null ? void 0 : c.getAttribute("data-mermaid-id");
305
- if (d)
304
+ ), h = c == null ? void 0 : c.getAttribute("data-mermaid-id");
305
+ if (h)
306
306
  try {
307
- const w = parseFloat(a.getAttribute("x") || "0"), u = parseFloat(a.getAttribute("y") || "0"), l = parseFloat(
307
+ const g = parseFloat(a.getAttribute("x") || "0"), p = parseFloat(a.getAttribute("y") || "0"), d = parseFloat(
308
308
  a.getAttribute("width") || "0"
309
- ), g = parseFloat(
309
+ ), f = parseFloat(
310
310
  a.getAttribute("height") || "0"
311
311
  );
312
- if (l <= 0 || g <= 0)
312
+ if (d <= 0 || f <= 0)
313
313
  return;
314
- const f = a.parentElement;
315
- if (!f || f.tagName !== "g")
314
+ const w = a.parentElement;
315
+ if (!w || w.tagName !== "g")
316
316
  return;
317
- let v = f.getAttribute("transform");
317
+ let v = w.getAttribute("transform");
318
318
  if (!v)
319
- v = `translate(${w}, ${u})`;
319
+ v = `translate(${g}, ${p})`;
320
320
  else {
321
- const S = v.match(
321
+ const k = v.match(
322
322
  /translate\(([^,]+),([^)]+)\)/
323
323
  );
324
- if (S) {
325
- const M = parseFloat(S[1]), O = parseFloat(S[2]), F = M + w, R = O + u;
324
+ if (k) {
325
+ const x = parseFloat(k[1]), A = parseFloat(k[2]), F = x + g, R = A + p;
326
326
  v = v.replace(
327
327
  /translate\([^)]+\)/,
328
328
  `translate(${F}, ${R})`
329
329
  );
330
330
  } else
331
- v = `translate(${w}, ${u}) ${v}`;
331
+ v = `translate(${g}, ${p}) ${v}`;
332
332
  }
333
- const y = e.querySelector(
334
- `g[data-mermaid-wrapper][data-mermaid-id="${d}"][data-mermaid-clone="true"]`
333
+ const I = e.querySelector(
334
+ `g[data-mermaid-wrapper][data-mermaid-id="${h}"][data-mermaid-clone="true"]`
335
335
  );
336
- let m;
337
- if (y) {
338
- m = y;
339
- const S = m.querySelector('svg[data-type="mermaid"]');
340
- S && m.removeChild(S);
336
+ let l;
337
+ if (I) {
338
+ l = I;
339
+ const k = l.querySelector('svg[data-type="mermaid"]');
340
+ k && l.removeChild(k);
341
341
  } else
342
- m = document.createElementNS(
342
+ l = document.createElementNS(
343
343
  "http://www.w3.org/2000/svg",
344
344
  "g"
345
- ), m.setAttribute("data-mermaid-wrapper", "true"), m.setAttribute("data-mermaid-clone", "true"), m.setAttribute("data-mermaid-id", d);
346
- m.setAttribute("transform", v);
347
- const h = n.cloneNode(!0);
348
- if (h.setAttribute("width", l.toString()), h.setAttribute("height", g.toString()), h.setAttribute("data-mermaid-transformed", "true"), h.style.width = "", h.style.height = "", h.style.maxWidth = "", h.style.maxHeight = "", h.style.transform = "", h.style.transformOrigin = "", h.style.display = "block", h.style.overflow = "visible", h.style.opacity = "1", !h.getAttribute("viewBox")) {
349
- const S = h.getAttribute("width"), M = h.getAttribute("height");
350
- if (S && M) {
351
- const O = parseFloat(
352
- S.replace(/px|%/, "") || "0"
345
+ ), l.setAttribute("data-mermaid-wrapper", "true"), l.setAttribute("data-mermaid-clone", "true"), l.setAttribute("data-mermaid-id", h);
346
+ l.setAttribute("transform", v);
347
+ const m = n.cloneNode(!0);
348
+ if (m.setAttribute("width", d.toString()), m.setAttribute("height", f.toString()), m.setAttribute("data-mermaid-transformed", "true"), m.style.width = "", m.style.height = "", m.style.maxWidth = "", m.style.maxHeight = "", m.style.transform = "", m.style.transformOrigin = "", m.style.display = "block", m.style.overflow = "visible", m.style.opacity = "1", !m.getAttribute("viewBox")) {
349
+ const k = m.getAttribute("width"), x = m.getAttribute("height");
350
+ if (k && x) {
351
+ const A = parseFloat(
352
+ k.replace(/px|%/, "") || "0"
353
353
  ), F = parseFloat(
354
- M.replace(/px|%/, "") || "0"
354
+ x.replace(/px|%/, "") || "0"
355
355
  );
356
- O > 0 && F > 0 && h.setAttribute(
356
+ A > 0 && F > 0 && m.setAttribute(
357
357
  "viewBox",
358
- `0 0 ${O} ${F}`
358
+ `0 0 ${A} ${F}`
359
359
  );
360
360
  }
361
361
  }
362
- m.appendChild(h), y || (f && f.parentNode ? f.parentNode.insertBefore(m, f.nextSibling) : e.appendChild(m)), c && (c.style.opacity = "0", c.style.pointerEvents = "none");
363
- } catch (w) {
364
- console.error("[transformMermaidSvgToMarkmapSvg] error: ", w);
362
+ l.appendChild(m), I || (w && w.parentNode ? w.parentNode.insertBefore(l, w.nextSibling) : e.appendChild(l)), c && (c.style.opacity = "0", c.style.pointerEvents = "none");
363
+ } catch (g) {
364
+ console.error("[transformMermaidSvgToMarkmapSvg] error: ", g);
365
365
  }
366
366
  }
367
367
  );
@@ -378,40 +378,40 @@ class T {
378
378
  static injectMermaidHtml(e, t, r) {
379
379
  const s = [], i = t.split(`
380
380
  `);
381
- let a = "", n = !1, c = [], d = -1;
382
- for (let u = 0; u < i.length; u++) {
383
- const l = i[u], g = l.match(/^(#{1,6})\s+(.+)$/);
384
- if (g && (a = g[2].trim()), l.trim().startsWith("```mermaid"))
385
- n = !0, c = [], d = u;
386
- else if (n && l.trim() === "```") {
381
+ let a = "", n = !1, c = [], h = -1;
382
+ for (let p = 0; p < i.length; p++) {
383
+ const d = i[p], f = d.match(/^(#{1,6})\s+(.+)$/);
384
+ if (f && (a = f[2].trim()), d.trim().startsWith("```mermaid"))
385
+ n = !0, c = [], h = p;
386
+ else if (n && d.trim() === "```") {
387
387
  n = !1;
388
- const f = c.join(`
388
+ const w = c.join(`
389
389
  `);
390
- f && a && s.push({
390
+ w && a && s.push({
391
391
  title: a,
392
- content: f,
393
- index: d
392
+ content: w,
393
+ index: h
394
394
  }), c = [];
395
- } else n && c.push(l);
395
+ } else n && c.push(d);
396
396
  }
397
- const w = (u) => {
398
- if (!u) return;
399
- const l = u.content || "", g = T.decodeHtmlEntities(l);
400
- for (const f of s)
401
- if (g.includes(f.title) || l.includes(f.title)) {
402
- const v = b.generateId(), y = b.createContainer(
397
+ const g = (p) => {
398
+ if (!p) return;
399
+ const d = p.content || "", f = b.decodeHtmlEntities(d);
400
+ for (const w of s)
401
+ if (f.includes(w.title) || d.includes(w.title)) {
402
+ const v = O.generateId(), I = O.createContainer(
403
403
  v,
404
- f.content,
404
+ w.content,
405
405
  r
406
406
  );
407
- u.content ? u.content = u.content + y : u.content = y;
407
+ p.content ? p.content = p.content + I : p.content = I;
408
408
  break;
409
409
  }
410
- u.children && u.children.length > 0 && u.children.forEach((f) => {
411
- w(f);
410
+ p.children && p.children.length > 0 && p.children.forEach((w) => {
411
+ g(w);
412
412
  });
413
413
  };
414
- return w(e), e;
414
+ return g(e), e;
415
415
  }
416
416
  /**
417
417
  * 解码 HTML 实体
@@ -434,17 +434,17 @@ class T {
434
434
  class U extends ee {
435
435
  constructor(t) {
436
436
  super(t);
437
- p(this, "currentWorkId", null);
437
+ u(this, "currentWorkId", null);
438
438
  }
439
439
  /**
440
440
  * 设置当前工作 ID(用于命名空间隔离)
441
441
  * @param workId 工作 ID
442
442
  */
443
443
  setWorkId(t) {
444
- this.currentWorkId = t, t && b.extendMarkdown(this, t);
444
+ this.currentWorkId = t, t && O.extendMarkdown(this, t);
445
445
  }
446
446
  transform(t, r) {
447
- this.currentWorkId ? b.clear(this.currentWorkId) : b.clear();
447
+ this.currentWorkId ? O.clear(this.currentWorkId) : O.clear();
448
448
  const s = this.convertKatexToText(t), i = super.transform(s, r);
449
449
  return i.root && this.processKatexInRoot(i.root), i;
450
450
  }
@@ -526,22 +526,22 @@ class U extends ee {
526
526
  const c = n.src || n.getAttribute("src");
527
527
  if (!c || a.has(c) || (a.add(c), n.complete && n.naturalWidth > 0))
528
528
  return;
529
- const d = new Promise((w) => {
530
- const u = setTimeout(() => {
531
- w();
529
+ const h = new Promise((g) => {
530
+ const p = setTimeout(() => {
531
+ g();
532
532
  }, r);
533
533
  if (n.complete && n.naturalWidth > 0) {
534
- clearTimeout(u), w();
534
+ clearTimeout(p), g();
535
535
  return;
536
536
  }
537
- const l = () => {
538
- clearTimeout(u), n.removeEventListener("load", l), n.removeEventListener("error", g), w();
539
- }, g = () => {
540
- clearTimeout(u), n.removeEventListener("load", l), n.removeEventListener("error", g), w();
537
+ const d = () => {
538
+ clearTimeout(p), n.removeEventListener("load", d), n.removeEventListener("error", f), g();
539
+ }, f = () => {
540
+ clearTimeout(p), n.removeEventListener("load", d), n.removeEventListener("error", f), g();
541
541
  };
542
- n.addEventListener("load", l), n.addEventListener("error", g), !n.src && c && (n.src = c);
542
+ n.addEventListener("load", d), n.addEventListener("error", f), !n.src && c && (n.src = c);
543
543
  });
544
- i.push(d);
544
+ i.push(h);
545
545
  }), i.length > 0 && await Promise.all(i);
546
546
  }
547
547
  }
@@ -568,12 +568,12 @@ async function de(o) {
568
568
  i.querySelectorAll("image").forEach((n) => {
569
569
  n.href && !n.href.baseVal.startsWith("data:") && (n.getAttribute("crossorigin") || n.setAttribute("crossorigin", "anonymous"), t.push(
570
570
  new Promise((c) => {
571
- const d = new Image();
572
- d.crossOrigin = "anonymous", d.onload = () => {
571
+ const h = new Image();
572
+ h.crossOrigin = "anonymous", h.onload = () => {
573
573
  c(void 0);
574
- }, d.onerror = () => {
574
+ }, h.onerror = () => {
575
575
  c(void 0);
576
- }, d.src = n.href.baseVal;
576
+ }, h.src = n.href.baseVal;
577
577
  })
578
578
  ));
579
579
  });
@@ -592,7 +592,7 @@ async function me(o) {
592
592
  await new Promise((a) => setTimeout(a, 50));
593
593
  }
594
594
  }
595
- async function ue(o) {
595
+ async function pe(o) {
596
596
  const e = o.querySelectorAll("svg");
597
597
  if (!e.length)
598
598
  return;
@@ -604,7 +604,7 @@ async function ue(o) {
604
604
  await Promise.all(t);
605
605
  }
606
606
  async function G(o) {
607
- if (T.hasMermaidSvg(o)) {
607
+ if (b.hasMermaidSvg(o)) {
608
608
  const r = Date.now();
609
609
  let s = !1;
610
610
  for (; Date.now() - r < 5e3 && !s; ) {
@@ -612,8 +612,8 @@ async function G(o) {
612
612
  if (i.length > 0) {
613
613
  let a = !0;
614
614
  for (const n of Array.from(i)) {
615
- const c = parseFloat(n.getAttribute("width") || "0"), d = parseFloat(n.getAttribute("height") || "0");
616
- if (n.querySelector(".mermaid-container") && (c < 50 || d < 50)) {
615
+ const c = parseFloat(n.getAttribute("width") || "0"), h = parseFloat(n.getAttribute("height") || "0");
616
+ if (n.querySelector(".mermaid-container") && (c < 50 || h < 50)) {
617
617
  a = !1;
618
618
  break;
619
619
  }
@@ -628,42 +628,42 @@ async function G(o) {
628
628
  }
629
629
  }
630
630
  }
631
- async function pe(o, e = {}) {
631
+ async function ue(o, e = {}) {
632
632
  const { width: t = o.offsetWidth, height: r = o.offsetHeight } = e, s = o.offsetWidth || t, i = o.offsetHeight || r;
633
633
  try {
634
- const { loadSvgToImageLib: a, getSvgToImageLib: n } = await import("./svgToImageLoader-mXH53h-l.mjs");
634
+ const { loadSvgToImageLib: a, getSvgToImageLib: n } = await import("./svgToImageLoader-DZz5bAo4.mjs");
635
635
  let c = n();
636
636
  if (!c)
637
637
  try {
638
638
  c = await a();
639
- } catch (l) {
640
- return console.error("[loadSvgToImageLib] error: ", l), null;
639
+ } catch (d) {
640
+ return console.error("[loadSvgToImageLib] error: ", d), null;
641
641
  }
642
- const d = o.style.width, w = o.style.height, u = o.style.display;
642
+ const h = o.style.width, g = o.style.height, p = o.style.display;
643
643
  o.style.width || (o.style.width = `${s}px`), o.style.height || (o.style.height = `${i}px`), (!o.style.display || o.style.display === "none") && (o.style.display = "block");
644
644
  try {
645
- await new Promise((g) => {
645
+ await new Promise((f) => {
646
646
  requestAnimationFrame(() => {
647
647
  requestAnimationFrame(() => {
648
- g();
648
+ f();
649
649
  });
650
650
  });
651
651
  });
652
- const l = await c.toPng(o, {
652
+ const d = await c.toPng(o, {
653
653
  width: s,
654
654
  height: i,
655
655
  quality: 1
656
656
  });
657
- return o.style.width = d, o.style.height = w, o.style.display = u, new Promise((g) => {
658
- const f = new Image();
659
- f.crossOrigin = "anonymous", f.onload = () => {
660
- g(f);
661
- }, f.onerror = () => {
662
- g(null);
663
- }, f.src = l;
657
+ return o.style.width = h, o.style.height = g, o.style.display = p, new Promise((f) => {
658
+ const w = new Image();
659
+ w.crossOrigin = "anonymous", w.onload = () => {
660
+ f(w);
661
+ }, w.onerror = () => {
662
+ f(null);
663
+ }, w.src = d;
664
664
  });
665
- } catch (l) {
666
- return o.style.width = d, o.style.height = w, o.style.display = u, console.error("[divToImageElement] error: ", l), null;
665
+ } catch (d) {
666
+ return o.style.width = h, o.style.height = g, o.style.display = p, console.error("[divToImageElement] error: ", d), null;
667
667
  }
668
668
  } catch (a) {
669
669
  return console.error("[divToImageElement] error: ", a), null;
@@ -671,14 +671,14 @@ async function pe(o, e = {}) {
671
671
  }
672
672
  class ge {
673
673
  constructor(e) {
674
- p(this, "toolsType", x.BackgroundSVG);
675
- p(this, "vNodes");
676
- p(this, "workOptions");
677
- p(this, "workId");
678
- p(this, "markmapInstance", null);
679
- p(this, "isDestroyed", !1);
680
- p(this, "element");
681
- p(this, "manager");
674
+ u(this, "toolsType", M.BackgroundSVG);
675
+ u(this, "vNodes");
676
+ u(this, "workOptions");
677
+ u(this, "workId");
678
+ u(this, "markmapInstance", null);
679
+ u(this, "isDestroyed", !1);
680
+ u(this, "element");
681
+ u(this, "manager");
682
682
  const { vNodes: t, workId: r, toolsOpt: s, manager: i } = e;
683
683
  this.workId = r, this.vNodes = t, this.workOptions = s, this.manager = i, this.element = this.createElement(), this.manager.fullLayer.appendChild(this.element), this.vNodes.setInfo(this.workId, {
684
684
  workShape: this
@@ -707,8 +707,8 @@ class ge {
707
707
  this.isDestroyed || !this.element || !this.element.parentNode || (this.updateElementPosition(e), await this.updateSvg(e));
708
708
  }
709
709
  isSameSize(e) {
710
- const { width: t, height: r } = e, { width: s, height: i } = this.workOptions, a = t * this.manager.camera.scale, n = r * this.manager.camera.scale, c = s * this.manager.camera.scale, d = i * this.manager.camera.scale;
711
- return a === c && n === d;
710
+ const { width: t, height: r } = e, { width: s, height: i } = this.workOptions, a = t * this.manager.camera.scale, n = r * this.manager.camera.scale, c = s * this.manager.camera.scale, h = i * this.manager.camera.scale;
711
+ return a === c && n === h;
712
712
  }
713
713
  isSamePosition(e) {
714
714
  const { centerX: t, centerY: r } = e, { centerX: s, centerY: i } = this.workOptions, a = this.manager.getPagePoint(s, i), n = this.manager.getPagePoint(t, r);
@@ -729,8 +729,8 @@ class ge {
729
729
  updateElementPosition(e) {
730
730
  if (this.isDestroyed || !this.element || !this.fullLayer)
731
731
  return;
732
- const { centerX: t, centerY: r, width: s, height: i, zIndex: a } = this.workOptions, n = this.manager.getPagePoint(t, r), c = s * this.manager.camera.scale, d = i * this.manager.camera.scale;
733
- (!e || e && !this.isSameSize(e)) && (this.element.setAttribute("width", `${c}`), this.element.setAttribute("height", `${d}`), this.element.style.width = `${c}px`, this.element.style.height = `${d}px`), (!e || e && !this.isSamePosition(e)) && (this.element.style.left = `${n.x}px`, this.element.style.top = `${n.y}px`), (!e || e && !this.isSameZIndex(e)) && (this.element.style.zIndex = (a || 0).toString());
732
+ const { centerX: t, centerY: r, width: s, height: i, zIndex: a } = this.workOptions, n = this.manager.getPagePoint(t, r), c = s * this.manager.camera.scale, h = i * this.manager.camera.scale;
733
+ (!e || e && !this.isSameSize(e)) && (this.element.setAttribute("width", `${c}`), this.element.setAttribute("height", `${h}`), this.element.style.width = `${c}px`, this.element.style.height = `${h}px`), (!e || e && !this.isSamePosition(e)) && (this.element.style.left = `${n.x}px`, this.element.style.top = `${n.y}px`), (!e || e && !this.isSameZIndex(e)) && (this.element.style.zIndex = (a || 0).toString());
734
734
  }
735
735
  async updateSvg(e) {
736
736
  const { type: t, state: r } = this.workOptions;
@@ -740,20 +740,20 @@ class ge {
740
740
  this.element,
741
741
  this.manager.markmapOptions
742
742
  ), this.markmapInstance.handleClick = async (n, c) => {
743
- var u, l, g;
744
- (u = this.markmapInstance) == null || u.toggleNode(c);
745
- const d = this.serializeData((l = this.markmapInstance) == null ? void 0 : l.state.data);
743
+ var p, d, f;
744
+ (p = this.markmapInstance) == null || p.toggleNode(c);
745
+ const h = this.serializeData((d = this.markmapInstance) == null ? void 0 : d.state.data);
746
746
  this.setWorkOptions(
747
747
  {
748
748
  ...this.workOptions,
749
- state: d
749
+ state: h
750
750
  },
751
751
  !1
752
- ), T.checkNodeHasMermaid(c) && await T.renderMermaidAfterDOMUpdate(
752
+ ), b.checkNodeHasMermaid(c) && await b.renderMermaidAfterDOMUpdate(
753
753
  this.element,
754
754
  this.workId
755
- ), this.scenePath && this.collector && ((g = this.collector) == null || g.dispatch({
756
- type: k.UpdateNode,
755
+ ), this.scenePath && this.collector && ((f = this.collector) == null || f.dispatch({
756
+ type: y.UpdateNode,
757
757
  workId: this.workId,
758
758
  opt: this.workOptions,
759
759
  isSync: !0,
@@ -765,12 +765,12 @@ class ge {
765
765
  L.setWorkId(this.workId);
766
766
  const i = L.transform(s);
767
767
  let { root: a } = i;
768
- s && q(s) && (a = T.injectMermaidHtml(a, s, this.workId));
768
+ s && q(s) && (a = b.injectMermaidHtml(a, s, this.workId));
769
769
  try {
770
770
  r && Array.isArray(r) && this.transformState(
771
771
  r,
772
772
  a
773
- ), await this.markmapInstance.setData(a), !this.isDestroyed && this.element && this.fullLayer && this.markmapInstance && (window.markmapInstance = this.markmapInstance, s && q(s) && await T.renderMermaidAfterDOMUpdate(
773
+ ), await this.markmapInstance.setData(a), !this.isDestroyed && this.element && this.fullLayer && this.markmapInstance && (window.markmapInstance = this.markmapInstance, s && q(s) && await b.renderMermaidAfterDOMUpdate(
774
774
  this.element,
775
775
  this.workId
776
776
  ), await this.fit(
@@ -799,7 +799,7 @@ class ge {
799
799
  var t;
800
800
  !this.isDestroyed && this.element && this.fullLayer && this.markmapInstance && (e && this.element && await U.waitForImagesInForeignObjects(
801
801
  this.element
802
- ), await ((t = this.markmapInstance) == null ? void 0 : t.fit()), this.element && T.isSafari() && T.hasMermaidSvg(this.element) && (await G(this.element), await T.transformMermaidSvgToMarkmapSvg(
802
+ ), await ((t = this.markmapInstance) == null ? void 0 : t.fit()), this.element && b.isSafari() && b.hasMermaidSvg(this.element) && (await G(this.element), await b.transformMermaidSvgToMarkmapSvg(
803
803
  this.element
804
804
  )));
805
805
  }
@@ -844,7 +844,7 @@ class ge {
844
844
  function X(o) {
845
845
  const { toolsType: e, ...t } = o;
846
846
  switch (e) {
847
- case x.BackgroundSVG:
847
+ case M.BackgroundSVG:
848
848
  return new ge(t);
849
849
  default:
850
850
  return;
@@ -852,9 +852,9 @@ function X(o) {
852
852
  }
853
853
  class Y {
854
854
  constructor(e) {
855
- p(this, "viewId");
856
- p(this, "fullLayer");
857
- p(this, "curNodeMap");
855
+ u(this, "viewId");
856
+ u(this, "fullLayer");
857
+ u(this, "curNodeMap");
858
858
  this.viewId = e, this.curNodeMap = new te();
859
859
  }
860
860
  init(e) {
@@ -889,14 +889,14 @@ class Y {
889
889
  }
890
890
  class fe {
891
891
  constructor(e, t) {
892
- p(this, "opt");
893
- p(this, "viewId");
894
- p(this, "fullLayer");
895
- p(this, "vNodes");
896
- p(this, "master");
897
- p(this, "cameraOpt");
898
- p(this, "methodBuilder");
899
- p(this, "updateCamera", Q(async (e) => {
892
+ u(this, "opt");
893
+ u(this, "viewId");
894
+ u(this, "fullLayer");
895
+ u(this, "vNodes");
896
+ u(this, "master");
897
+ u(this, "cameraOpt");
898
+ u(this, "methodBuilder");
899
+ u(this, "updateCamera", Q(async (e) => {
900
900
  const { cameraOpt: t } = e;
901
901
  t && !W(this.cameraOpt, t) && await this.setCameraOpt(t);
902
902
  }, 100));
@@ -938,13 +938,13 @@ class fe {
938
938
  this.vNodes.clear();
939
939
  }
940
940
  canUseFullLayer(e) {
941
- return e === x.BackgroundSVG;
941
+ return e === M.BackgroundSVG;
942
942
  }
943
943
  async consumeFull(e) {
944
944
  const { toolsType: t, opt: r, workId: s } = e;
945
945
  if (s != null && s.toString() && t && this.canUseFullLayer(t))
946
946
  switch (t) {
947
- case x.BackgroundSVG:
947
+ case M.BackgroundSVG:
948
948
  await this.setFullWork({
949
949
  toolsType: t,
950
950
  opt: r,
@@ -961,7 +961,7 @@ class fe {
961
961
  const n = this.vNodes.get(i);
962
962
  return !n || !n.workShape ? (a = this.createWorkShapeNode({
963
963
  toolsOpt: r,
964
- toolsType: x.BackgroundSVG,
964
+ toolsType: M.BackgroundSVG,
965
965
  workId: i
966
966
  }), a && await a.init()) : (a = n.workShape, await a.setWorkOptions(r)), a;
967
967
  }
@@ -984,29 +984,29 @@ class fe {
984
984
  if (!await this.methodBuilder.consumeForBackgroundThread(e)) {
985
985
  const { msgType: t, toolsType: r } = e;
986
986
  switch (t) {
987
- case k.Destroy: {
987
+ case y.Destroy: {
988
988
  this.destroy();
989
989
  break;
990
990
  }
991
- case k.Clear: {
991
+ case y.Clear: {
992
992
  this.clearAll();
993
993
  break;
994
994
  }
995
- case k.UpdateCamera: {
995
+ case y.UpdateCamera: {
996
996
  this.updateCamera(e);
997
997
  break;
998
998
  }
999
- case k.UpdateTools: {
1000
- this.toggleFullLayer(r === x.Clicker);
999
+ case y.UpdateTools: {
1000
+ this.toggleFullLayer(r === M.Clicker);
1001
1001
  break;
1002
1002
  }
1003
- case k.BackgroundSVGUpdate:
1004
- case k.UpdateNode:
1005
- case k.FullWork: {
1003
+ case y.BackgroundSVGUpdate:
1004
+ case y.UpdateNode:
1005
+ case y.FullWork: {
1006
1006
  r && this.canUseFullLayer(r) && await this.consumeFull(e);
1007
1007
  break;
1008
1008
  }
1009
- case k.BackgroundSVGDelete: {
1009
+ case y.BackgroundSVGDelete: {
1010
1010
  this.removeWork(e);
1011
1011
  break;
1012
1012
  }
@@ -1025,13 +1025,13 @@ class fe {
1025
1025
  }
1026
1026
  class we {
1027
1027
  constructor(e, t) {
1028
- p(this, "viewId");
1029
- p(this, "fullLayer");
1030
- p(this, "master");
1031
- p(this, "vNodes");
1032
- p(this, "cameraOpt");
1033
- p(this, "opt");
1034
- p(this, "workShapes", /* @__PURE__ */ new Map());
1028
+ u(this, "viewId");
1029
+ u(this, "fullLayer");
1030
+ u(this, "master");
1031
+ u(this, "vNodes");
1032
+ u(this, "cameraOpt");
1033
+ u(this, "opt");
1034
+ u(this, "workShapes", /* @__PURE__ */ new Map());
1035
1035
  this.viewId = e, this.opt = t, this.master = t.master, this.fullLayer = t.container, this.vNodes = new Y(e), this.vNodes.init(this.fullLayer);
1036
1036
  }
1037
1037
  get camera() {
@@ -1076,15 +1076,15 @@ class we {
1076
1076
  if (t && r && s) {
1077
1077
  await this.setCameraOpt(s);
1078
1078
  for (const [i, a] of Object.entries(r))
1079
- if (a != null && a.type && (a == null ? void 0 : a.toolsType) === x.BackgroundSVG)
1079
+ if (a != null && a.type && (a == null ? void 0 : a.toolsType) === M.BackgroundSVG)
1080
1080
  switch (a == null ? void 0 : a.type) {
1081
- case k.UpdateNode:
1082
- case k.FullWork: {
1081
+ case y.UpdateNode:
1082
+ case y.FullWork: {
1083
1083
  const { opt: n } = a, c = {
1084
1084
  ...a,
1085
1085
  opt: n,
1086
1086
  workId: i,
1087
- msgType: k.FullWork,
1087
+ msgType: y.FullWork,
1088
1088
  dataType: D.Service,
1089
1089
  viewId: this.viewId
1090
1090
  };
@@ -1094,12 +1094,12 @@ class we {
1094
1094
  }
1095
1095
  try {
1096
1096
  if (t) {
1097
- await G(this.fullLayer), await de(this.fullLayer), await ue(this.fullLayer);
1098
- const i = await pe(this.fullLayer);
1097
+ await G(this.fullLayer), await de(this.fullLayer), await pe(this.fullLayer);
1098
+ const i = await ue(this.fullLayer);
1099
1099
  i && this.opt.post({
1100
1100
  sp: [
1101
1101
  {
1102
- type: k.Snapshot,
1102
+ type: y.Snapshot,
1103
1103
  scenePath: t,
1104
1104
  imageElement: i,
1105
1105
  viewId: this.viewId,
@@ -1113,7 +1113,7 @@ class we {
1113
1113
  this.opt.post({
1114
1114
  sp: [
1115
1115
  {
1116
- type: k.ReportError,
1116
+ type: y.ReportError,
1117
1117
  reportString: `[SnapshotThreadImpl] getSnapshotRender error: ${a}`
1118
1118
  }
1119
1119
  ]
@@ -1136,7 +1136,7 @@ class we {
1136
1136
  const n = this.vNodes.get(i);
1137
1137
  return !n || !n.workShape ? (a = this.createWorkShapeNode({
1138
1138
  toolsOpt: r,
1139
- toolsType: x.BackgroundSVG,
1139
+ toolsType: M.BackgroundSVG,
1140
1140
  workId: i
1141
1141
  }), a && await a.init()) : (a = n.workShape, await a.setWorkOptions(r)), a;
1142
1142
  }
@@ -1155,10 +1155,10 @@ class we {
1155
1155
  }
1156
1156
  class Ne {
1157
1157
  constructor(e) {
1158
- p(this, "backgroundThreadMap", /* @__PURE__ */ new Map());
1159
- p(this, "snapshotThread");
1160
- p(this, "master");
1161
- p(this, "post", (e) => {
1158
+ u(this, "backgroundThreadMap", /* @__PURE__ */ new Map());
1159
+ u(this, "snapshotThread");
1160
+ u(this, "master");
1161
+ u(this, "post", (e) => {
1162
1162
  const { sp: t } = e;
1163
1163
  t && this.master.collectorSyncData(t);
1164
1164
  });
@@ -1171,75 +1171,78 @@ class Ne {
1171
1171
  return new we(e, t);
1172
1172
  }
1173
1173
  async consume(e) {
1174
- var t, r, s, i, a;
1175
- for (const n of e.values()) {
1174
+ var t, r, s, i, a, n;
1175
+ for (const c of e.values()) {
1176
1176
  const {
1177
- msgType: c,
1178
- viewId: d,
1179
- layerOpt: w,
1180
- offscreenCanvasOpt: u,
1181
- cameraOpt: l,
1182
- tasksqueue: g,
1183
- mainTasksqueueCount: f
1184
- } = n;
1185
- if (c === k.Console) {
1177
+ msgType: h,
1178
+ viewId: g,
1179
+ layerOpt: p,
1180
+ offscreenCanvasOpt: d,
1181
+ cameraOpt: f,
1182
+ tasksqueue: w,
1183
+ mainTasksqueueCount: v
1184
+ } = c;
1185
+ if (h === y.Console) {
1186
1186
  console.log(this);
1187
1187
  continue;
1188
1188
  }
1189
- if (c === k.Init) {
1190
- const y = (t = this.master.control.viewContainerManager.getView(d)) == null ? void 0 : t.displayer, m = (r = y == null ? void 0 : y.backgroundContainerRef) == null ? void 0 : r.current;
1191
- if (y && m && w && u) {
1192
- const h = this.createBackgroundThread(d, {
1193
- displayer: y,
1189
+ if (h === y.Init) {
1190
+ const l = (t = this.master.control.viewContainerManager.getView(g)) == null ? void 0 : t.displayer, m = (r = l == null ? void 0 : l.backgroundContainerRef) == null ? void 0 : r.current;
1191
+ if (l && m && p && d) {
1192
+ const S = this.backgroundThreadMap.get(g);
1193
+ S == null || S.destroy();
1194
+ const k = this.createBackgroundThread(g, {
1195
+ displayer: l,
1194
1196
  container: m,
1195
- layerOpt: w,
1197
+ layerOpt: p,
1196
1198
  master: this.master,
1197
- canvasOpt: u,
1199
+ canvasOpt: d,
1198
1200
  post: this.post
1199
1201
  });
1200
- this.backgroundThreadMap.set(d, h), h && l && await h.setCameraOpt(l);
1202
+ this.backgroundThreadMap.set(g, k), k && f && await k.setCameraOpt(f);
1201
1203
  }
1202
1204
  continue;
1203
1205
  }
1204
- if (c === k.Snapshot) {
1205
- const y = (s = this.master.control.viewContainerManager.getView(d)) == null ? void 0 : s.displayer, h = (a = ((i = this.master.control.viewContainerManager.mainView) == null ? void 0 : i.displayer).backgroundSnapshotContainerRef) == null ? void 0 : a.current;
1206
- if (y && h && l) {
1207
- h.style.width = `${l.width}px`, h.style.height = `${l.height}px`;
1208
- const A = {
1206
+ if (h === y.Snapshot) {
1207
+ const l = (s = this.master.control.viewContainerManager.getView(g)) == null ? void 0 : s.displayer, S = (a = ((i = this.master.control.viewContainerManager.mainView) == null ? void 0 : i.displayer).backgroundSnapshotContainerRef) == null ? void 0 : a.current;
1208
+ if (l && S && f) {
1209
+ (n = this.snapshotThread) == null || n.destroy(), S.style.width = `${f.width}px`, S.style.height = `${f.height}px`;
1210
+ const k = {
1209
1211
  ...P.defaultLayerOpt,
1210
1212
  offscreen: !1,
1211
- width: l.width,
1212
- height: l.height
1213
- }, S = {
1213
+ width: f.width,
1214
+ height: f.height
1215
+ }, x = {
1214
1216
  ...P.defaultScreenCanvasOpt,
1215
- width: l.width,
1216
- height: l.height
1217
+ width: f.width,
1218
+ height: f.height
1217
1219
  };
1218
- this.snapshotThread = this.createSnapshotThread(d, {
1219
- displayer: y,
1220
- container: h,
1221
- layerOpt: A,
1220
+ this.snapshotThread = this.createSnapshotThread(g, {
1221
+ displayer: l,
1222
+ container: S,
1223
+ layerOpt: k,
1222
1224
  master: this.master,
1223
- canvasOpt: S,
1225
+ canvasOpt: x,
1224
1226
  post: this.post
1225
- }), await this.snapshotThread.getSnapshot(n), this.snapshotThread.destroy(), this.snapshotThread = void 0;
1227
+ }), await this.snapshotThread.getSnapshot(c), this.snapshotThread.destroy(), this.snapshotThread = void 0;
1226
1228
  continue;
1227
1229
  }
1228
1230
  }
1229
- if (c === k.TasksQueue && (g != null && g.size)) {
1230
- for (const [y, m] of this.backgroundThreadMap.entries()) {
1231
- const h = g.get(y);
1232
- h && (await m.on(h), f && this.post({ workerTasksqueueCount: f }));
1231
+ if (h === y.TasksQueue && (w != null && w.size)) {
1232
+ for (const [l, m] of this.backgroundThreadMap.entries()) {
1233
+ const S = w.get(l);
1234
+ S && (await m.on(S), v && this.post({ workerTasksqueueCount: v }));
1233
1235
  }
1234
1236
  continue;
1235
1237
  }
1236
- if (d === Z) {
1237
- for (const y of this.backgroundThreadMap.values())
1238
- y.on(n), c === k.Destroy && this.backgroundThreadMap.delete(d);
1238
+ if (g === Z) {
1239
+ for (const l of this.backgroundThreadMap.values())
1240
+ await l.on(c);
1241
+ h === y.Destroy && this.backgroundThreadMap.clear();
1239
1242
  continue;
1240
1243
  }
1241
- const v = this.backgroundThreadMap.get(d);
1242
- v && (v.on(n), c === k.Destroy && this.backgroundThreadMap.delete(d));
1244
+ const I = this.backgroundThreadMap.get(g);
1245
+ I && (await I.on(c), h === y.Destroy && this.backgroundThreadMap.delete(g));
1243
1246
  }
1244
1247
  }
1245
1248
  async consumeTargetOne(e, t) {
@@ -1247,6 +1250,10 @@ class Ne {
1247
1250
  r && await r.on(t);
1248
1251
  }
1249
1252
  destroy() {
1253
+ var e;
1254
+ (e = this.snapshotThread) == null || e.destroy(), this.snapshotThread = void 0;
1255
+ for (const t of this.backgroundThreadMap.values())
1256
+ t.destroy();
1250
1257
  this.backgroundThreadMap.clear();
1251
1258
  }
1252
1259
  }