@jieyin/editor-sdk-test 1.1.167 → 1.1.169

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -150,7 +150,6 @@ interface EditorOptions {
150
150
  showPreview?: boolean // 是否显示预览面板,默认 true
151
151
  enableGrid?: boolean // 是否启用网格,默认 true
152
152
  usePreviewEffect?: boolean // 是否使用预览效果组件,默认 true
153
- uiTheme?: 'default' | 'theme1' // 界面主题:theme1 为粉主色+藏青保存;默认不传为 default
154
153
  }
155
154
  ```
156
155
 
@@ -31,40 +31,40 @@ const Z = class P {
31
31
  }
32
32
  try {
33
33
  this.debugLog("🚀 Worker: 加载透视变换 WASM...");
34
- const r = (c) => {
35
- if (e && c === "wasm_exec.js")
34
+ const r = (i) => {
35
+ if (e && i === "wasm_exec.js")
36
36
  return e;
37
- if (t && c === "perspective.wasm")
37
+ if (t && i === "perspective.wasm")
38
38
  return t;
39
39
  try {
40
- let f = null;
41
- if (typeof import.meta < "u" && import.meta.url ? f = import.meta.url : typeof self < "u" && self.location && (f = self.location.href), f) {
42
- const l = new URL(f), d = l.pathname;
40
+ let h = null;
41
+ if (typeof import.meta < "u" && import.meta.url ? h = import.meta.url : typeof self < "u" && self.location && (h = self.location.href), h) {
42
+ const f = new URL(h), d = f.pathname;
43
43
  if (d.includes("/js/")) {
44
- const y = "../assets/" + c, m = new URL(y, l);
45
- return this.debugLog(`🔍 [WASM] 计算路径: ${c} -> ${m.pathname} (Worker: ${d})`), m.pathname;
44
+ const y = "../assets/" + i, m = new URL(y, f);
45
+ return this.debugLog(`🔍 [WASM] 计算路径: ${i} -> ${m.pathname} (Worker: ${d})`), m.pathname;
46
46
  } else if (d.includes("/assets/")) {
47
- const y = "./" + c, m = new URL(y, l);
48
- return this.debugLog(`🔍 [WASM] 计算路径: ${c} -> ${m.pathname} (Worker: ${d})`), m.pathname;
47
+ const y = "./" + i, m = new URL(y, f);
48
+ return this.debugLog(`🔍 [WASM] 计算路径: ${i} -> ${m.pathname} (Worker: ${d})`), m.pathname;
49
49
  } else
50
- return this.debugLog(`🔍 [WASM] 使用默认绝对路径: /assets/${c}`), "/assets/" + c;
50
+ return this.debugLog(`🔍 [WASM] 使用默认绝对路径: /assets/${i}`), "/assets/" + i;
51
51
  }
52
- } catch (f) {
53
- this.debugWarn("⚠️ 无法计算 WASM 相对路径,使用默认路径:", f);
52
+ } catch (h) {
53
+ this.debugWarn("⚠️ 无法计算 WASM 相对路径,使用默认路径:", h);
54
54
  }
55
- return "/assets/" + c;
55
+ return "/assets/" + i;
56
56
  }, n = e || r("wasm_exec.js"), u = t || r("perspective.wasm");
57
57
  this.debugLog("🔍 [WASM] 最终使用的路径:", { execUrl: n, moduleUrl: u }), await this.loadWasmExec(n);
58
58
  const o = typeof self < "u" ? self : globalThis;
59
59
  this.go = new o.Go();
60
- const i = await fetch(u);
61
- if (!i.ok)
62
- throw new Error(`无法加载 WASM 文件: ${i.status}`);
63
- const w = await i.arrayBuffer(), a = await WebAssembly.instantiate(w, this.go.importObject);
60
+ const c = await fetch(u);
61
+ if (!c.ok)
62
+ throw new Error(`无法加载 WASM 文件: ${c.status}`);
63
+ const w = await c.arrayBuffer(), a = await WebAssembly.instantiate(w, this.go.importObject);
64
64
  this.wasmModule = a.instance, this.go.run(this.wasmModule), this.wasmReady = !0;
65
- const h = this.call("wasmInit");
66
- if (h && h.success)
67
- this.debugLog("✅ Worker WASM 加载成功:", h);
65
+ const l = this.call("wasmInit");
66
+ if (l && l.success)
67
+ this.debugLog("✅ Worker WASM 加载成功:", l);
68
68
  else
69
69
  throw new Error("WASM 初始化失败");
70
70
  } catch (r) {
@@ -126,8 +126,8 @@ const Z = class P {
126
126
  const w = o.error || "License 验证失败";
127
127
  throw new Error(w);
128
128
  }
129
- const i = this.call("wasmVerifyLicense", t);
130
- if (!i.success || i.valid !== !0)
129
+ const c = this.call("wasmVerifyLicense", t);
130
+ if (!c.success || c.valid !== !0)
131
131
  throw new Error("WASM 验证失败");
132
132
  return !0;
133
133
  } catch (r) {
@@ -371,45 +371,45 @@ const Z = class P {
371
371
  };
372
372
  z(Z, "instance");
373
373
  let ne = Z, H = !1;
374
- const R = (...s) => {
374
+ const L = (...s) => {
375
375
  }, se = (...s) => {
376
376
  };
377
- let E = null, _ = !1, M = null, v = null, O = null, $ = null, U = null;
377
+ let E = null, R = !1, M = null, b = null, O = null, $ = null, U = null;
378
378
  function ue(s) {
379
- v = s.licenseToken, O = s.licenseApiUrl, $ = s.deviceId, U = s.domain, self.LICENSE_TOKEN = v, self.LICENSE_API_URL = O, self.DEVICE_ID = $, self.DOMAIN = U, E || (M && !_ && (M = null), G().then(() => {
379
+ b = s.licenseToken, O = s.licenseApiUrl, $ = s.deviceId, U = s.domain, self.LICENSE_TOKEN = b, self.LICENSE_API_URL = O, self.DEVICE_ID = $, self.DOMAIN = U, E || (M && !R && (M = null), G().then(() => {
380
380
  }).catch((t) => {
381
381
  }));
382
382
  }
383
383
  async function G() {
384
- return E ? void 0 : _ ? M || Promise.resolve() : v || self.LICENSE_TOKEN ? (_ = !0, M = (async () => {
384
+ return E ? void 0 : R ? M || Promise.resolve() : b || self.LICENSE_TOKEN ? (R = !0, M = (async () => {
385
385
  try {
386
386
  E = ne.getInstance();
387
387
  const t = (a) => {
388
- const h = self.WASM_URL, c = self.WASM_EXEC_URL;
389
- if (a === "perspective.wasm" && h)
390
- return h;
391
- if (a === "wasm_exec.js" && c)
392
- return c;
388
+ const l = self.WASM_URL, i = self.WASM_EXEC_URL;
389
+ if (a === "perspective.wasm" && l)
390
+ return l;
391
+ if (a === "wasm_exec.js" && i)
392
+ return i;
393
393
  try {
394
- let f = null;
395
- if (typeof import.meta < "u" && import.meta.url ? f = import.meta.url : typeof self < "u" && self.location && (f = self.location.href), f) {
396
- const l = new URL(f), d = l.pathname;
394
+ let h = null;
395
+ if (typeof import.meta < "u" && import.meta.url ? h = import.meta.url : typeof self < "u" && self.location && (h = self.location.href), h) {
396
+ const f = new URL(h), d = f.pathname;
397
397
  if (d.includes("/js/")) {
398
- const y = "../assets/" + a, m = new URL(y, l);
399
- return R(`🔍 [deform.worker] 计算路径: ${a} -> ${m.pathname} (Worker: ${d})`), m.pathname;
398
+ const y = "../assets/" + a, m = new URL(y, f);
399
+ return L(`🔍 [deform.worker] 计算路径: ${a} -> ${m.pathname} (Worker: ${d})`), m.pathname;
400
400
  } else if (d.includes("/assets/")) {
401
- const y = "./" + a, m = new URL(y, l);
402
- return R(`🔍 [deform.worker] 计算路径: ${a} -> ${m.pathname} (Worker: ${d})`), m.pathname;
401
+ const y = "./" + a, m = new URL(y, f);
402
+ return L(`🔍 [deform.worker] 计算路径: ${a} -> ${m.pathname} (Worker: ${d})`), m.pathname;
403
403
  } else
404
- return R(`🔍 [deform.worker] 使用默认绝对路径: /assets/${a}`), "/assets/" + a;
404
+ return L(`🔍 [deform.worker] 使用默认绝对路径: /assets/${a}`), "/assets/" + a;
405
405
  }
406
- } catch (f) {
407
- se("⚠️ [deform.worker] 无法计算 WASM 相对路径,使用默认路径:", f);
406
+ } catch (h) {
407
+ se("⚠️ [deform.worker] 无法计算 WASM 相对路径,使用默认路径:", h);
408
408
  }
409
409
  return "/assets/" + a;
410
410
  }, e = self.WASM_URL || t("perspective.wasm"), r = self.WASM_EXEC_URL || t("wasm_exec.js");
411
- R("🔍 [deform.worker] 最终使用的 WASM 路径:", { wasmUrl: e, wasmExecUrl: r }), await E.load(e, r);
412
- const n = v || self.LICENSE_TOKEN, u = O || self.LICENSE_API_URL, o = $ || self.DEVICE_ID, i = U || self.DOMAIN;
411
+ L("🔍 [deform.worker] 最终使用的 WASM 路径:", { wasmUrl: e, wasmExecUrl: r }), await E.load(e, r);
412
+ const n = b || self.LICENSE_TOKEN, u = O || self.LICENSE_API_URL, o = $ || self.DEVICE_ID, c = U || self.DOMAIN;
413
413
  if (!n)
414
414
  throw new Error("LICENSE_TOKEN 未设置,无法使用 WASM 功能");
415
415
  if (!await E.verifyLicense(n, u))
@@ -417,7 +417,7 @@ async function G() {
417
417
  } catch (t) {
418
418
  throw E = null, M = null, t;
419
419
  } finally {
420
- _ = !1;
420
+ R = !1;
421
421
  }
422
422
  })(), M) : Promise.resolve();
423
423
  }
@@ -455,64 +455,64 @@ function ce(s, t, e) {
455
455
  if (!r || !n)
456
456
  return "Image Not Loaded";
457
457
  s.imageSmoothingEnabled = !0, s.imageSmoothingQuality = "high";
458
- let u = null, o = null, i = null, w = null, a = 0, h = 0, c = null, f = "Unknown";
459
- if (e.size && e.size.width ? (a = e.size.width, h = e.size.height) : e.placedLayer && e.placedLayer.width ? (a = e.placedLayer.width, h = e.placedLayer.height) : e.originalWidth && (a = e.originalWidth, h = e.originalHeight), e.meshPoints && e.meshPoints.length > 0 && (u = e.meshPoints), e.transform && e.transform.length === 8) {
460
- const l = e.transform;
458
+ let u = null, o = null, c = null, w = null, a = 0, l = 0, i = null, h = "Unknown";
459
+ if (e.size && e.size.width ? (a = e.size.width, l = e.size.height) : e.placedLayer && e.placedLayer.width ? (a = e.placedLayer.width, l = e.placedLayer.height) : e.originalWidth && (a = e.originalWidth, l = e.originalHeight), e.meshPoints && e.meshPoints.length > 0 && (u = e.meshPoints), e.transform && e.transform.length === 8) {
460
+ const f = e.transform;
461
461
  o = [
462
- { x: l[0], y: l[1] },
463
- { x: l[2], y: l[3] },
464
- { x: l[4], y: l[5] },
465
- { x: l[6], y: l[7] }
462
+ { x: f[0], y: f[1] },
463
+ { x: f[2], y: f[3] },
464
+ { x: f[4], y: f[5] },
465
+ { x: f[6], y: f[7] }
466
466
  ];
467
467
  }
468
- return e.quiltSliceX && (i = e.quiltSliceX), e.quiltSliceY && (w = e.quiltSliceY), e.filterList && (c = e.filterList.find((l) => l.type === "puppet" && l.enabled)), a === 0 && i && i.length > 0 && (a = i[i.length - 1]), a === 0 && (a = 1e3), h === 0 && (h = 1e3), c && c.filter && c.filter.puppetShapeList && c.filter.puppetShapeList.length > 0 && o ? (ae(s, t, o, c.filter.puppetShapeList[0]), f = "Puppet Warp") : u && o ? i && w ? (he(s, t, o, u, i, w, a, h), f = "Quilt Mesh") : u.length === 16 ? (le(s, t, o, u), f = "Std Mesh (16pt)") : (fe(s, t, o, u), f = "Auto-Fit Mesh") : u ? (de(s, t, u), f = "Direct Mesh") : o && (K(s, t, o), f = "Transform Only"), f;
468
+ return e.quiltSliceX && (c = e.quiltSliceX), e.quiltSliceY && (w = e.quiltSliceY), e.filterList && (i = e.filterList.find((f) => f.type === "puppet" && f.enabled)), a === 0 && c && c.length > 0 && (a = c[c.length - 1]), a === 0 && (a = 1e3), l === 0 && (l = 1e3), i && i.filter && i.filter.puppetShapeList && i.filter.puppetShapeList.length > 0 && o ? (ae(s, t, o, i.filter.puppetShapeList[0]), h = "Puppet Warp") : u && o ? c && w ? (he(s, t, o, u, c, w, a, l), h = "Quilt Mesh") : u.length === 16 ? (le(s, t, o, u), h = "Std Mesh (16pt)") : (fe(s, t, o, u), h = "Auto-Fit Mesh") : u ? (de(s, t, u), h = "Direct Mesh") : o && (K(s, t, o), h = "Transform Only"), h;
469
469
  }
470
470
  function ae(s, t, e, r, n, u) {
471
471
  if (!r.originalVertexArray || !r.deformedVertexArray || !r.indexArray)
472
472
  return;
473
- const o = q(e), i = ye(o);
474
- if (!i) {
473
+ const o = q(e), c = ye(o);
474
+ if (!c) {
475
475
  K(s, t, e);
476
476
  return;
477
477
  }
478
- const w = r.originalVertexArray, a = r.deformedVertexArray, h = r.indexArray;
479
- for (let c = 0; c < h.length; c += 3) {
480
- const f = h[c], l = h[c + 1], d = h[c + 2];
481
- if (!w[f] || !w[l] || !w[d]) continue;
482
- const y = w[f], m = w[l], g = w[d], p = X(y.x, y.y, i), x = X(m.x, m.y, i), F = X(g.x, g.y, i), A = Y(t), D = { x: p.x * A.width, y: p.y * A.height }, W = { x: x.x * A.width, y: x.y * A.height }, b = { x: F.x * A.width, y: F.y * A.height }, I = a[f], C = a[l], L = a[d];
483
- k(s, t, D, W, b, I, C, L);
478
+ const w = r.originalVertexArray, a = r.deformedVertexArray, l = r.indexArray;
479
+ for (let i = 0; i < l.length; i += 3) {
480
+ const h = l[i], f = l[i + 1], d = l[i + 2];
481
+ if (!w[h] || !w[f] || !w[d]) continue;
482
+ const y = w[h], m = w[f], F = w[d], g = X(y.x, y.y, c), p = X(m.x, m.y, c), x = X(F.x, F.y, c), A = Y(t), D = { x: g.x * A.width, y: g.y * A.height }, W = { x: p.x * A.width, y: p.y * A.height }, B = { x: x.x * A.width, y: x.y * A.height }, _ = a[h], I = a[f], v = a[d];
483
+ k(s, t, D, W, B, _, I, v);
484
484
  }
485
485
  }
486
486
  function le(s, t, e, r) {
487
- let n = 1 / 0, u = -1 / 0, o = 1 / 0, i = -1 / 0;
488
- r.forEach((c) => {
489
- n = Math.min(n, c.x), u = Math.max(u, c.x), o = Math.min(o, c.y), i = Math.max(i, c.y);
487
+ let n = 1 / 0, u = -1 / 0, o = 1 / 0, c = -1 / 0;
488
+ r.forEach((i) => {
489
+ n = Math.min(n, i.x), u = Math.max(u, i.x), o = Math.min(o, i.y), c = Math.max(c, i.y);
490
490
  });
491
- const w = u - n, a = i - o;
491
+ const w = u - n, a = c - o;
492
492
  if (w < 1 || a < 1) {
493
493
  K(s, t, e);
494
494
  return;
495
495
  }
496
- const h = r.map((c) => {
497
- const f = (c.x - n) / w, l = (c.y - o) / a;
498
- return N(f, l, e);
496
+ const l = r.map((i) => {
497
+ const h = (i.x - n) / w, f = (i.y - o) / a;
498
+ return N(h, f, e);
499
499
  });
500
- V(s, t, h, "bicubic", 4, 40);
500
+ V(s, t, l, "bicubic", 4, 40);
501
501
  }
502
- function he(s, t, e, r, n, u, o, i) {
502
+ function he(s, t, e, r, n, u, o, c) {
503
503
  const w = q(e);
504
- let a = 1 / 0, h = -1 / 0, c = 1 / 0, f = -1 / 0;
505
- r.forEach((g) => {
506
- a = Math.min(a, g.x), h = Math.max(h, g.x), c = Math.min(c, g.y), f = Math.max(f, g.y);
504
+ let a = 1 / 0, l = -1 / 0, i = 1 / 0, h = -1 / 0;
505
+ r.forEach((F) => {
506
+ a = Math.min(a, F.x), l = Math.max(l, F.x), i = Math.min(i, F.y), h = Math.max(h, F.y);
507
507
  });
508
- const l = h - a || 1, d = f - c || 1, y = n.length - 1, m = u.length - 1;
509
- for (let g = 0; g < m; g++)
510
- for (let p = 0; p < y; p++) {
511
- const x = g * 3, F = p * 3, A = [], D = y * 3 + 1;
508
+ const f = l - a || 1, d = h - i || 1, y = n.length - 1, m = u.length - 1;
509
+ for (let F = 0; F < m; F++)
510
+ for (let g = 0; g < y; g++) {
511
+ const p = F * 3, x = g * 3, A = [], D = y * 3 + 1;
512
512
  try {
513
513
  for (let S = 0; S < 4; S++)
514
514
  for (let T = 0; T < 4; T++) {
515
- const J = (x + S) * D + (F + T);
515
+ const J = (p + S) * D + (x + T);
516
516
  r[J] && A.push(r[J]);
517
517
  }
518
518
  } catch {
@@ -520,30 +520,30 @@ function he(s, t, e, r, n, u, o, i) {
520
520
  }
521
521
  if (A.length < 16) continue;
522
522
  const W = A.map((S) => {
523
- const T = (S.x - a) / l, J = (S.y - c) / d;
523
+ const T = (S.x - a) / f, J = (S.y - i) / d;
524
524
  return ee(T, J, w);
525
- }), b = n[p] / o, I = n[p + 1] / o, C = u[g] / i, L = u[g + 1] / i;
526
- we(s, t, W, b, I, C, L);
525
+ }), B = n[g] / o, _ = n[g + 1] / o, I = u[F] / c, v = u[F + 1] / c;
526
+ we(s, t, W, B, _, I, v);
527
527
  }
528
528
  }
529
529
  function fe(s, t, e, r) {
530
530
  const n = q(e);
531
- let u = 1 / 0, o = -1 / 0, i = 1 / 0, w = -1 / 0;
532
- r.forEach((l) => {
533
- u = Math.min(u, l.x), o = Math.max(o, l.x), i = Math.min(i, l.y), w = Math.max(w, l.y);
531
+ let u = 1 / 0, o = -1 / 0, c = 1 / 0, w = -1 / 0;
532
+ r.forEach((f) => {
533
+ u = Math.min(u, f.x), o = Math.max(o, f.x), c = Math.min(c, f.y), w = Math.max(w, f.y);
534
534
  });
535
- const a = o - u || 1, h = w - i || 1, c = r.map((l) => {
536
- const d = (l.x - u) / a, y = (l.y - i) / h;
535
+ const a = o - u || 1, l = w - c || 1, i = r.map((f) => {
536
+ const d = (f.x - u) / a, y = (f.y - c) / l;
537
537
  return ee(d, y, n);
538
- }), f = Math.floor(Math.sqrt(r.length)) || 4;
539
- V(s, t, c, "grid", f, 40);
538
+ }), h = Math.floor(Math.sqrt(r.length)) || 4;
539
+ V(s, t, i, "grid", h, 40);
540
540
  }
541
541
  function we(s, t, e, r, n, u, o) {
542
- const w = Y(t), a = w.width, h = w.height;
543
- for (let c = 0; c < 20; c++)
544
- for (let f = 0; f < 20; f++) {
545
- const l = f / 20, d = c / 20, y = (f + 1) / 20, m = (c + 1) / 20, g = r + l * (n - r), p = r + y * (n - r), x = u + d * (o - u), F = u + m * (o - u), A = { x: g * a, y: x * h }, D = { x: p * a, y: x * h }, W = { x: g * a, y: F * h }, b = { x: p * a, y: F * h }, I = B(l, d, e), C = B(y, d, e), L = B(l, m, e), S = B(y, m, e);
546
- k(s, t, A, D, W, I, C, L), k(s, t, D, b, W, C, S, L);
542
+ const w = Y(t), a = w.width, l = w.height;
543
+ for (let i = 0; i < 20; i++)
544
+ for (let h = 0; h < 20; h++) {
545
+ const f = h / 20, d = i / 20, y = (h + 1) / 20, m = (i + 1) / 20, F = r + f * (n - r), g = r + y * (n - r), p = u + d * (o - u), x = u + m * (o - u), A = { x: F * a, y: p * l }, D = { x: g * a, y: p * l }, W = { x: F * a, y: x * l }, B = { x: g * a, y: x * l }, _ = C(f, d, e), I = C(y, d, e), v = C(f, m, e), S = C(y, m, e);
546
+ k(s, t, A, D, W, _, I, v), k(s, t, D, B, W, I, S, v);
547
547
  }
548
548
  }
549
549
  function K(s, t, e) {
@@ -553,24 +553,24 @@ function de(s, t, e) {
553
553
  V(s, t, e, "bicubic", 4, 40);
554
554
  }
555
555
  function V(s, t, e, r, n, u) {
556
- const o = Y(t), i = o.width, w = o.height;
556
+ const o = Y(t), c = o.width, w = o.height;
557
557
  for (let a = 0; a < u; a++)
558
- for (let h = 0; h < u; h++) {
559
- const c = h / u, f = a / u, l = (h + 1) / u, d = (a + 1) / u, y = { x: c * i, y: f * w }, m = { x: l * i, y: f * w }, g = { x: c * i, y: d * w }, p = { x: l * i, y: d * w };
560
- let x, F, A, D;
561
- r === "bicubic" ? (x = B(c, f, e), F = B(l, f, e), A = B(c, d, e), D = B(l, d, e)) : r === "grid" ? (x = j(c, f, e, n), F = j(l, f, e, n), A = j(c, d, e, n), D = j(l, d, e, n)) : (x = N(c, f, e), F = N(l, f, e), A = N(c, d, e), D = N(l, d, e)), k(s, t, y, m, g, x, F, A), k(s, t, m, p, g, F, D, A);
558
+ for (let l = 0; l < u; l++) {
559
+ const i = l / u, h = a / u, f = (l + 1) / u, d = (a + 1) / u, y = { x: i * c, y: h * w }, m = { x: f * c, y: h * w }, F = { x: i * c, y: d * w }, g = { x: f * c, y: d * w };
560
+ let p, x, A, D;
561
+ r === "bicubic" ? (p = C(i, h, e), x = C(f, h, e), A = C(i, d, e), D = C(f, d, e)) : r === "grid" ? (p = j(i, h, e, n), x = j(f, h, e, n), A = j(i, d, e, n), D = j(f, d, e, n)) : (p = N(i, h, e), x = N(f, h, e), A = N(i, d, e), D = N(f, d, e)), k(s, t, y, m, F, p, x, A), k(s, t, m, g, F, x, D, A);
562
562
  }
563
563
  }
564
564
  function Q(s, t) {
565
565
  const e = 1 - t;
566
566
  return s === 0 ? e * e * e : s === 1 ? 3 * e * e * t : s === 2 ? 3 * e * t * t : t * t * t;
567
567
  }
568
- function B(s, t, e) {
568
+ function C(s, t, e) {
569
569
  let r = 0, n = 0;
570
570
  for (let u = 0; u < 4; u++)
571
571
  for (let o = 0; o < 4; o++) {
572
- const i = Q(u, t) * Q(o, s);
573
- r += e[u * 4 + o].x * i, n += e[u * 4 + o].y * i;
572
+ const c = Q(u, t) * Q(o, s);
573
+ r += e[u * 4 + o].x * c, n += e[u * 4 + o].y * c;
574
574
  }
575
575
  return { x: r, y: n };
576
576
  }
@@ -580,9 +580,9 @@ function N(s, t, e) {
580
580
  }
581
581
  function j(s, t, e, r) {
582
582
  const n = r - 1, u = s * n, o = t * n;
583
- let i = Math.floor(u), w = Math.floor(o);
584
- i >= n && (i = n - 1), w >= n && (w = n - 1), i < 0 && (i = 0), w < 0 && (w = 0);
585
- const a = u - i, h = o - w, c = e[w * r + i], f = e[w * r + (i + 1)], l = e[(w + 1) * r + i], d = e[(w + 1) * r + (i + 1)], y = (1 - a) * (1 - h) * c.x + a * (1 - h) * f.x + a * h * d.x + (1 - a) * h * l.x, m = (1 - a) * (1 - h) * c.y + a * (1 - h) * f.y + a * h * d.y + (1 - a) * h * l.y;
583
+ let c = Math.floor(u), w = Math.floor(o);
584
+ c >= n && (c = n - 1), w >= n && (w = n - 1), c < 0 && (c = 0), w < 0 && (w = 0);
585
+ const a = u - c, l = o - w, i = e[w * r + c], h = e[w * r + (c + 1)], f = e[(w + 1) * r + c], d = e[(w + 1) * r + (c + 1)], y = (1 - a) * (1 - l) * i.x + a * (1 - l) * h.x + a * l * d.x + (1 - a) * l * f.x, m = (1 - a) * (1 - l) * i.y + a * (1 - l) * h.y + a * l * d.y + (1 - a) * l * f.y;
586
586
  return { x: y, y: m };
587
587
  }
588
588
  function q(s) {
@@ -621,17 +621,17 @@ function ee(s, t, e) {
621
621
  throw new Error(`WASM 应用透视变换失败: ${r}`);
622
622
  }
623
623
  }
624
- function k(s, t, e, r, n, u, o, i) {
624
+ function k(s, t, e, r, n, u, o, c) {
625
625
  if (!t || "complete" in t && !t.complete || !("naturalWidth" in t ? t.naturalWidth : t.width)) return;
626
- const a = (u.x + o.x + i.x) / 3, h = (u.y + o.y + i.y) / 3, c = (Math.hypot(u.x - a, u.y - h) + Math.hypot(o.x - a, o.y - h) + Math.hypot(i.x - a, i.y - h)) / 3, l = c > 1 ? (c + 1.65) / c : 1.5, d = a + (u.x - a) * l, y = h + (u.y - h) * l, m = a + (o.x - a) * l, g = h + (o.y - h) * l, p = a + (i.x - a) * l, x = h + (i.y - h) * l;
627
- s.save(), s.beginPath(), s.moveTo(d, y), s.lineTo(m, g), s.lineTo(p, x), s.closePath(), s.clip();
628
- const F = e.x * (n.y - r.y) - r.x * n.y + n.x * r.y + (r.x - n.x) * e.y;
629
- if (Math.abs(F) < 1e-3) {
626
+ const a = (u.x + o.x + c.x) / 3, l = (u.y + o.y + c.y) / 3, i = 1.65, h = a + (u.x - a) * i, f = l + (u.y - l) * i, d = a + (o.x - a) * i, y = l + (o.y - l) * i, m = a + (c.x - a) * i, F = l + (c.y - l) * i;
627
+ s.save(), s.beginPath(), s.moveTo(h, f), s.lineTo(d, y), s.lineTo(m, F), s.closePath(), s.clip();
628
+ const g = e.x * (n.y - r.y) - r.x * n.y + n.x * r.y + (r.x - n.x) * e.y;
629
+ if (Math.abs(g) < 1e-3) {
630
630
  s.restore();
631
631
  return;
632
632
  }
633
- const A = -(e.y * (i.x - o.x) - r.y * i.x + n.y * o.x + (r.y - n.y) * u.x) / F, D = (r.y * i.y + e.y * (o.y - i.y) - n.y * o.y + (n.y - r.y) * u.y) / F, W = (e.x * (i.x - o.x) - r.x * i.x + n.x * o.x + (r.x - n.x) * u.x) / F, b = -(r.x * i.y + e.x * (o.y - i.y) - n.x * o.y + (n.x - r.x) * u.y) / F, I = (e.x * (n.y * o.x - r.y * i.x) + e.y * (r.x * i.x - n.x * o.x) + (n.x * r.y - r.x * n.y) * u.x) / F, C = (e.x * (n.y * o.y - r.y * i.y) + e.y * (r.x * i.y - n.x * o.y) + (n.x * r.y - r.x * n.y) * u.y) / F;
634
- s.transform(A, D, W, b, I, C), s.drawImage(t, 0, 0), s.restore();
633
+ const p = -(e.y * (c.x - o.x) - r.y * c.x + n.y * o.x + (r.y - n.y) * u.x) / g, x = (r.y * c.y + e.y * (o.y - c.y) - n.y * o.y + (n.y - r.y) * u.y) / g, A = (e.x * (c.x - o.x) - r.x * c.x + n.x * o.x + (r.x - n.x) * u.x) / g, D = -(r.x * c.y + e.x * (o.y - c.y) - n.x * o.y + (n.x - r.x) * u.y) / g, W = (e.x * (n.y * o.x - r.y * c.x) + e.y * (r.x * c.x - n.x * o.x) + (n.x * r.y - r.x * n.y) * u.x) / g, B = (e.x * (n.y * o.y - r.y * c.y) + e.y * (r.x * c.y - n.x * o.y) + (n.x * r.y - r.x * n.y) * u.y) / g;
634
+ s.transform(p, x, A, D, W, B), s.drawImage(t, 0, 0), s.restore();
635
635
  }
636
636
  self.onmessage = async (s) => {
637
637
  if (s.data?.type === "SET_DEBUG") {
@@ -661,46 +661,46 @@ self.onmessage = async (s) => {
661
661
  });
662
662
  return;
663
663
  }
664
- const o = performance.now(), i = (/* @__PURE__ */ new Date()).toISOString();
665
- if (R(`[deform worker] ⏰ 开始 id=${e} 时间=${i}`, {
664
+ const o = performance.now(), c = (/* @__PURE__ */ new Date()).toISOString();
665
+ if (L(`[deform worker] ⏰ 开始 id=${e} 时间=${c}`, {
666
666
  designBitmap: { width: r.width, height: r.height },
667
667
  size: n.size,
668
668
  bounds: n.bounds,
669
669
  canvasSize: u
670
670
  }), !E || !E.isReady())
671
- if (v || self.LICENSE_TOKEN)
671
+ if (b || self.LICENSE_TOKEN)
672
672
  try {
673
- if (_ && M && await M, (!E || !E.isReady()) && await G(), !E || !E.isReady())
673
+ if (R && M && await M, (!E || !E.isReady()) && await G(), !E || !E.isReady())
674
674
  throw new Error("WASM 模块仍未就绪");
675
675
  } catch (a) {
676
- const c = performance.now() - o;
676
+ const i = performance.now() - o;
677
677
  self.postMessage({
678
678
  id: e,
679
679
  error: `WASM 初始化失败: ${a.message}`,
680
- duration: c
680
+ duration: i
681
681
  });
682
682
  return;
683
683
  }
684
684
  else {
685
685
  let a = 0;
686
- const h = 500, c = 50;
687
- let f = null;
688
- for (; a < h && !f; )
689
- await new Promise((l) => setTimeout(l, c)), a += c, f = v || self.LICENSE_TOKEN;
690
- if (f)
686
+ const l = 500, i = 50;
687
+ let h = null;
688
+ for (; a < l && !h; )
689
+ await new Promise((f) => setTimeout(f, i)), a += i, h = b || self.LICENSE_TOKEN;
690
+ if (h)
691
691
  try {
692
- if (v = f, O = O || self.LICENSE_API_URL, $ = $ || self.DEVICE_ID, U = U || self.DOMAIN, _ && M ? await M : E || await G(), !E || !E.isReady())
692
+ if (b = h, O = O || self.LICENSE_API_URL, $ = $ || self.DEVICE_ID, U = U || self.DOMAIN, R && M ? await M : E || await G(), !E || !E.isReady())
693
693
  throw new Error("WASM 模块未就绪");
694
- } catch (l) {
694
+ } catch (f) {
695
695
  const y = performance.now() - o;
696
696
  self.postMessage({
697
697
  id: e,
698
- error: `WASM 初始化失败: ${l.message}`,
698
+ error: `WASM 初始化失败: ${f.message}`,
699
699
  duration: y
700
700
  });
701
701
  return;
702
702
  }
703
- else if (!f) {
703
+ else if (!h) {
704
704
  const d = performance.now() - o;
705
705
  self.postMessage({
706
706
  id: e,
@@ -722,39 +722,39 @@ self.onmessage = async (s) => {
722
722
  return;
723
723
  }
724
724
  const a = oe(n, u);
725
- let h, c;
725
+ let l, i;
726
726
  if (u && u.width > 0 && u.height > 0)
727
- h = u.width, c = u.height;
727
+ l = u.width, i = u.height;
728
728
  else {
729
- const F = n.size || n.placedLayer || {
729
+ const x = n.size || n.placedLayer || {
730
730
  width: w.width,
731
731
  height: w.height
732
732
  };
733
- h = F.width, c = F.height;
733
+ l = x.width, i = x.height;
734
734
  }
735
- const f = new OffscreenCanvas(h, c), l = f.getContext("2d");
736
- if (!l) {
735
+ const h = new OffscreenCanvas(l, i), f = h.getContext("2d");
736
+ if (!f) {
737
737
  const A = performance.now() - o;
738
738
  self.postMessage({ id: e, error: "Canvas context unavailable", duration: A });
739
739
  return;
740
740
  }
741
- const d = ce(l, r, a), y = f.transferToImageBitmap(), g = performance.now() - o, p = (/* @__PURE__ */ new Date()).toISOString();
742
- R(
743
- `[deform worker] ✅ 结束 id=${e} 时间=${p} 耗时=${Math.round(g)}ms 变形方法=${d}`,
741
+ const d = ce(f, r, a), y = h.transferToImageBitmap(), F = performance.now() - o, g = (/* @__PURE__ */ new Date()).toISOString();
742
+ L(
743
+ `[deform worker] ✅ 结束 id=${e} 时间=${g} 耗时=${Math.round(F)}ms 变形方法=${d}`,
744
744
  {
745
745
  width: y.width,
746
746
  height: y.height
747
747
  }
748
748
  ), r.close();
749
- const x = ie(
750
- { id: e, imageBitmap: y, duration: g }
749
+ const p = ie(
750
+ { id: e, imageBitmap: y, duration: F }
751
751
  );
752
752
  self.postMessage(
753
- x,
754
- x.imageBitmap ? [x.imageBitmap] : []
753
+ p,
754
+ p.imageBitmap ? [p.imageBitmap] : []
755
755
  );
756
756
  } catch (w) {
757
- const h = performance.now() - o, c = w instanceof Error ? w.message : String(w);
758
- (/* @__PURE__ */ new Date()).toISOString(), self.postMessage({ id: e, error: c, duration: h });
757
+ const l = performance.now() - o, i = w instanceof Error ? w.message : String(w);
758
+ (/* @__PURE__ */ new Date()).toISOString(), self.postMessage({ id: e, error: i, duration: l });
759
759
  }
760
760
  };