@snowcone-app/canvas 0.41.4 → 0.41.5

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 (58) hide show
  1. package/dist/{CanvasRenderer-JcBrIZ6I.js → CanvasRenderer-3M-52sAd.js} +4 -4
  2. package/dist/{CanvasRenderer-JcBrIZ6I.js.map → CanvasRenderer-3M-52sAd.js.map} +1 -1
  3. package/dist/{CanvasStateV1-BJ5-75NN.js → CanvasStateV1-C9tFMK5q.js} +3 -3
  4. package/dist/{CanvasStateV1-BJ5-75NN.js.map → CanvasStateV1-C9tFMK5q.js.map} +1 -1
  5. package/dist/{ContextualToolbars-wmbHxn5a.js → ContextualToolbars-B2LTNu7r.js} +358 -358
  6. package/dist/{ContextualToolbars-wmbHxn5a.js.map → ContextualToolbars-B2LTNu7r.js.map} +1 -1
  7. package/dist/{EditorCanvasImpl-CSDnCIpN.js → EditorCanvasImpl-CKqnla_y.js} +26 -26
  8. package/dist/EditorCanvasImpl-CKqnla_y.js.map +1 -0
  9. package/dist/{ExportManager-CHlByUYV.js → ExportManager-9_RjQEv0.js} +2 -2
  10. package/dist/{ExportManager-CHlByUYV.js.map → ExportManager-9_RjQEv0.js.map} +1 -1
  11. package/dist/{FontAnalyzer-Bj2KrX80.js → FontAnalyzer-Ch1jgTq7.js} +88 -68
  12. package/dist/FontAnalyzer-Ch1jgTq7.js.map +1 -0
  13. package/dist/ImagePanel-DY9Ve3X7.js +1016 -0
  14. package/dist/{ImagePanel-0ZwDDaCy.js.map → ImagePanel-DY9Ve3X7.js.map} +1 -1
  15. package/dist/SnowconeCanvas-BSFMazgl.js +1098 -0
  16. package/dist/SnowconeCanvas-BSFMazgl.js.map +1 -0
  17. package/dist/advanced.mjs +44 -44
  18. package/dist/api/stable.d.ts +1 -1
  19. package/dist/components/embed/SnowconeCanvas.d.ts +15 -0
  20. package/dist/components/embed/kernel.d.ts +3 -1
  21. package/dist/core/ArtboardElement.d.ts +2 -0
  22. package/dist/core/ArtboardManager.d.ts +11 -0
  23. package/dist/{custom-icons-up58ZbC9.js → custom-icons-D_XezOul.js} +2 -2
  24. package/dist/{custom-icons-up58ZbC9.js.map → custom-icons-D_XezOul.js.map} +1 -1
  25. package/dist/design-builder-BFM94eA9.js +1859 -0
  26. package/dist/design-builder-BFM94eA9.js.map +1 -0
  27. package/dist/{embed-GXevsHX5.js → embed-KG_YnRHA.js} +10 -10
  28. package/dist/{embed-GXevsHX5.js.map → embed-KG_YnRHA.js.map} +1 -1
  29. package/dist/embed.mjs +12 -12
  30. package/dist/{guards-CQeF53PN.js → guards-D_mw4DgS.js} +2 -2
  31. package/dist/{guards-CQeF53PN.js.map → guards-D_mw4DgS.js.map} +1 -1
  32. package/dist/index.mjs +9 -9
  33. package/dist/internals.mjs +6 -6
  34. package/dist/{placement-D31o3YYC.js → placement-tSiIVhrL.js} +3 -3
  35. package/dist/{placement-D31o3YYC.js.map → placement-tSiIVhrL.js.map} +1 -1
  36. package/dist/placement.mjs +2 -2
  37. package/dist/{template-fields-tobyHoMe.js → template-fields-C0qoE_ZH.js} +32 -32
  38. package/dist/{template-fields-tobyHoMe.js.map → template-fields-C0qoE_ZH.js.map} +1 -1
  39. package/dist/testing.mjs +3 -3
  40. package/dist/{useCommands-Cm3mDB-l.js → useCommands-DSapP-w1.js} +7 -7
  41. package/dist/{useCommands-Cm3mDB-l.js.map → useCommands-DSapP-w1.js.map} +1 -1
  42. package/dist/{usePieceGuideBundle-BTnUn33k.js → usePieceGuideBundle-oBykb3X8.js} +2 -2
  43. package/dist/{usePieceGuideBundle-BTnUn33k.js.map → usePieceGuideBundle-oBykb3X8.js.map} +1 -1
  44. package/dist/utils/newImagePlacement.d.ts +56 -0
  45. package/dist/{validation-D4zxugNJ.js → validation-D6zVSeTh.js} +307 -307
  46. package/dist/{validation-D4zxugNJ.js.map → validation-D6zVSeTh.js.map} +1 -1
  47. package/dist/vendor/ui/primitives/badge.d.ts +1 -1
  48. package/dist/vendor/ui/primitives/link.d.ts +1 -1
  49. package/dist/vendor/ui/primitives/spinner.d.ts +1 -1
  50. package/example/package.json +1 -1
  51. package/package.json +1 -1
  52. package/dist/EditorCanvasImpl-CSDnCIpN.js.map +0 -1
  53. package/dist/FontAnalyzer-Bj2KrX80.js.map +0 -1
  54. package/dist/ImagePanel-0ZwDDaCy.js +0 -984
  55. package/dist/SnowconeCanvas-BZk7PRpk.js +0 -1215
  56. package/dist/SnowconeCanvas-BZk7PRpk.js.map +0 -1
  57. package/dist/design-builder-DUEwCUmA.js +0 -1676
  58. package/dist/design-builder-DUEwCUmA.js.map +0 -1
@@ -199,7 +199,7 @@ class at {
199
199
  * Clone the artboard
200
200
  */
201
201
  clone() {
202
- return new at({
202
+ const t = new at({
203
203
  id: this.id,
204
204
  name: this.name,
205
205
  x: this.x,
@@ -219,6 +219,7 @@ class at {
219
219
  imageMask: this.imageMask ? { ...this.imageMask } : void 0,
220
220
  elementIds: Array.from(this.elementIds)
221
221
  });
222
+ return t.imageFit = this.imageFit ? { ...this.imageFit } : void 0, t;
222
223
  }
223
224
  /**
224
225
  * Serialize to JSON
@@ -276,7 +277,26 @@ class at {
276
277
  }
277
278
  class Cs {
278
279
  constructor() {
279
- this.artboards = /* @__PURE__ */ new Map(), this.elementToArtboard = /* @__PURE__ */ new Map(), this.activeArtboardId = null;
280
+ this.artboards = /* @__PURE__ */ new Map(), this.elementToArtboard = /* @__PURE__ */ new Map(), this.activeArtboardId = null, this.placeholderIds = /* @__PURE__ */ new Set();
281
+ }
282
+ /** Mark elements as the host's placeholder (see `placeholderOnlyElementIds`). */
283
+ markPlaceholders(t) {
284
+ for (const e of t) this.placeholderIds.add(e);
285
+ }
286
+ /** The element is no longer a placeholder (its picture was replaced by the shopper's own). */
287
+ unmarkPlaceholder(t) {
288
+ this.placeholderIds.delete(t);
289
+ }
290
+ isPlaceholder(t) {
291
+ return this.placeholderIds.has(t);
292
+ }
293
+ /**
294
+ * When the artboard holds ONLY the host's placeholder (at least one element, every one a placeholder): their ids,
295
+ * which a new picture REPLACES instead of stacking on. `null` as soon as anything of the shopper's own is there.
296
+ */
297
+ placeholderOnlyElementIds(t) {
298
+ const e = this.getElementsOnArtboard(t);
299
+ return e.length === 0 ? null : e.every((s) => this.placeholderIds.has(s)) ? e : null;
280
300
  }
281
301
  /**
282
302
  * Create a new artboard
@@ -456,7 +476,7 @@ class Cs {
456
476
  * Clear all artboards
457
477
  */
458
478
  clear() {
459
- this.artboards.clear(), this.elementToArtboard.clear(), this.activeArtboardId = null;
479
+ this.artboards.clear(), this.elementToArtboard.clear(), this.activeArtboardId = null, this.placeholderIds.clear();
460
480
  }
461
481
  /**
462
482
  * Serialize to JSON
@@ -492,7 +512,7 @@ class Cs {
492
512
  }
493
513
  }
494
514
  }
495
- const I = {
515
+ const D = {
496
516
  /**
497
517
  * Forward transform (local → world, for rendering)
498
518
  * Converts degrees to radians with the canvas convention (negative = clockwise)
@@ -554,7 +574,7 @@ class tt {
554
574
  * Uses visual bounding box for better user experience
555
575
  */
556
576
  hitTest(t, e) {
557
- const s = this.getVisualBoundingBox(), i = this.getRotationAnchor(), r = I.toRadiansInverse(this.rotation), h = Math.cos(r), a = Math.sin(r), n = t - i.x, l = e - i.y, c = n * h - l * a, g = n * a + l * h, d = i.x + c, u = i.y + g;
577
+ const s = this.getVisualBoundingBox(), i = this.getRotationAnchor(), r = D.toRadiansInverse(this.rotation), h = Math.cos(r), a = Math.sin(r), n = t - i.x, l = e - i.y, c = n * h - l * a, g = n * a + l * h, d = i.x + c, u = i.y + g;
558
578
  return d >= s.x && d <= s.x + s.width && u >= s.y && u <= s.y + s.height;
559
579
  }
560
580
  /**
@@ -562,7 +582,7 @@ class tt {
562
582
  * Common implementation for all elements
563
583
  */
564
584
  applyCanvasTransform(t) {
565
- t.translate(this.x, this.y), t.rotate(I.toRadians(this.rotation));
585
+ t.translate(this.x, this.y), t.rotate(D.toRadians(this.rotation));
566
586
  }
567
587
  /**
568
588
  * Serialize to JSON
@@ -2329,13 +2349,13 @@ function Ae(o) {
2329
2349
  const t = o || document.documentElement;
2330
2350
  return getComputedStyle(t).getPropertyValue("--foreground").trim() || "oklch(0.2103 0.0059 285.89)";
2331
2351
  }
2332
- function Ds(o) {
2352
+ function Is(o) {
2333
2353
  if (typeof window > "u" || typeof document > "u")
2334
2354
  return "oklch(0.9607 0 0)";
2335
2355
  const t = o || document.documentElement;
2336
2356
  return getComputedStyle(t).getPropertyValue("--background").trim() || "oklch(0.9607 0 0)";
2337
2357
  }
2338
- function Is(o) {
2358
+ function Ds(o) {
2339
2359
  const t = Ae(o);
2340
2360
  return t.startsWith("oklch(") ? `${t.slice(0, -1)} / 0.2)` : "rgba(0,0,0,0.2)";
2341
2361
  }
@@ -2375,7 +2395,7 @@ function Hs(o) {
2375
2395
  const t = document.documentElement, e = getComputedStyle(t).getPropertyValue("--foreground").trim();
2376
2396
  return e.startsWith("oklch(") ? `${e.slice(0, -1)} / 0.5)` : e || "oklch(0.2103 0.0059 285.89 / 0.5)";
2377
2397
  }
2378
- const Ps = 1, Ls = "#ffffff", De = 20, Ws = 6, Ns = 24, Ie = 16, ke = 36, Ee = 24, _s = 4, Xs = "#FFFFFF", zs = 2, Ys = 0.1, Us = Fe(), Gs = [8, 10, 12, 14, 16, 18, 20, 24, 28, 32, 36, 48, 64, 72, 96, 128], Z = 0, te = 1.2, ee = 50, Oe = 8, Be = 999, Re = /* @__PURE__ */ new Set([
2398
+ const Ps = 1, Ls = "#ffffff", Ie = 20, Ws = 6, Ns = 24, De = 16, ke = 36, Ee = 24, _s = 4, Xs = "#FFFFFF", zs = 2, Ys = 0.1, Us = Fe(), Gs = [8, 10, 12, 14, 16, 18, 20, 24, 28, 32, 36, 48, 64, 72, 96, 128], Z = 0, te = 1.2, ee = 50, Oe = 8, Be = 999, Re = /* @__PURE__ */ new Set([
2379
2399
  "Arial",
2380
2400
  "Arial Black",
2381
2401
  "Verdana",
@@ -2490,14 +2510,14 @@ function st(o) {
2490
2510
  }
2491
2511
  });
2492
2512
  }
2493
- const Dt = /* @__PURE__ */ new Set();
2513
+ const It = /* @__PURE__ */ new Set();
2494
2514
  function Vs(o) {
2495
- return Dt.add(o), () => {
2496
- Dt.delete(o);
2515
+ return It.add(o), () => {
2516
+ It.delete(o);
2497
2517
  };
2498
2518
  }
2499
2519
  function _e(o) {
2500
- Dt.forEach((t) => {
2520
+ It.forEach((t) => {
2501
2521
  try {
2502
2522
  t(o);
2503
2523
  } catch (e) {
@@ -2609,17 +2629,17 @@ function qs(o) {
2609
2629
  const t = o;
2610
2630
  return `b${t.brightness}c${t.contrast}s${t.saturation}`;
2611
2631
  }
2612
- let It = null;
2632
+ let Dt = null;
2613
2633
  function js(o) {
2614
- It = o;
2634
+ Dt = o;
2615
2635
  }
2616
2636
  function ze(o, t) {
2617
2637
  if (Pt(t)) return o;
2618
- if (!It)
2638
+ if (!Dt)
2619
2639
  throw new Error(
2620
2640
  "[image-adjustments] no adjusted-source provider registered. Painting an image with non-neutral adjustments requires the rendering engine: import 'src/rendering/image-adjustments.js' (rendering/element-painters does this for every paint driver; a direct element.render() call in a test must import it too)."
2621
2641
  );
2622
- return It(o, t);
2642
+ return Dt(o, t);
2623
2643
  }
2624
2644
  const kt = "frame", ie = Object.freeze({ cropX: 0, cropY: 0, cropWidth: 1, cropHeight: 1 });
2625
2645
  function Ye(o) {
@@ -2811,7 +2831,7 @@ class bt extends tt {
2811
2831
  let s = this.transformData.width / 2 - (this.transformData.cropX * this.transformData.width + t / 2), i = this.transformData.height / 2 - (this.transformData.cropY * this.transformData.height + e / 2);
2812
2832
  const r = this.transformData.flipHorizontal ? -1 : 1, h = this.transformData.flipVertical ? -1 : 1;
2813
2833
  s *= r, i *= h;
2814
- const a = Math.cos(I.toRadians(this.rotation)), n = Math.sin(I.toRadians(this.rotation)), l = s * a - i * n, c = s * n + i * a, g = this.x + l, d = this.y + c;
2834
+ const a = Math.cos(D.toRadians(this.rotation)), n = Math.sin(D.toRadians(this.rotation)), l = s * a - i * n, c = s * n + i * a, g = this.x + l, d = this.y + c;
2815
2835
  return {
2816
2836
  x: g - this.transformData.width / 2,
2817
2837
  y: d - this.transformData.height / 2,
@@ -2852,7 +2872,7 @@ class bt extends tt {
2852
2872
  let s = this.transformData.width / 2 - (this.transformData.cropX * this.transformData.width + t / 2), i = this.transformData.height / 2 - (this.transformData.cropY * this.transformData.height + e / 2);
2853
2873
  const r = this.transformData.flipHorizontal ? -1 : 1, h = this.transformData.flipVertical ? -1 : 1;
2854
2874
  s *= r, i *= h;
2855
- const a = Math.cos(I.toRadians(this.rotation)), n = Math.sin(I.toRadians(this.rotation)), l = s * a - i * n, c = s * n + i * a;
2875
+ const a = Math.cos(D.toRadians(this.rotation)), n = Math.sin(D.toRadians(this.rotation)), l = s * a - i * n, c = s * n + i * a;
2856
2876
  return {
2857
2877
  x: this.x + l,
2858
2878
  y: this.y + c
@@ -2888,7 +2908,7 @@ class bt extends tt {
2888
2908
  this.imageElement,
2889
2909
  this.transformData.adjustments
2890
2910
  ), r = i.width, h = i.height;
2891
- t.save(), this.opacity !== void 0 && this.opacity !== 1 && (t.globalAlpha = t.globalAlpha * this.opacity), t.translate(this.x, this.y), t.rotate(I.toRadians(this.rotation));
2911
+ t.save(), this.opacity !== void 0 && this.opacity !== 1 && (t.globalAlpha = t.globalAlpha * this.opacity), t.translate(this.x, this.y), t.rotate(D.toRadians(this.rotation));
2892
2912
  const a = this.transformData.flipHorizontal ? -1 : 1, n = this.transformData.flipVertical ? -1 : 1;
2893
2913
  if (t.scale(a, n), this.isCropping) {
2894
2914
  const l = this.transformData.width * this.transformData.cropWidth, c = this.transformData.height * this.transformData.cropHeight, g = this.transformData.width / 2 - (this.transformData.cropX * this.transformData.width + l / 2), d = this.transformData.height / 2 - (this.transformData.cropY * this.transformData.height + c / 2), u = g - this.transformData.width / 2, f = d - this.transformData.height / 2, m = this.transformData.borderRadius || 0;
@@ -2949,7 +2969,7 @@ class bt extends tt {
2949
2969
  * Shows different visuals for loading, retrying, error, and no-image states.
2950
2970
  */
2951
2971
  renderPlaceholder(t) {
2952
- t.save(), t.translate(this.x, this.y), t.rotate(I.toRadians(this.rotation));
2972
+ t.save(), t.translate(this.x, this.y), t.rotate(D.toRadians(this.rotation));
2953
2973
  const e = this.transformData.width * this.transformData.cropWidth, s = this.transformData.height * this.transformData.cropHeight, i = -e / 2, r = -s / 2;
2954
2974
  let h, a, n;
2955
2975
  this.imageLoadState === "error" ? (h = "#f0e0e0", a = "#993333", n = "Image failed to load") : this.imageLoadState === "retrying" ? (h = "#e0e0e0", a = "#666", n = "Retrying...") : this.imageLoadState === "loading" ? (h = "#e0e0e0", a = "#666", n = "Loading...") : (h = "#e0e0e0", a = "#666", n = this.imageUrl ? "Loading..." : "No image"), t.fillStyle = h, t.fillRect(i, r, e, s), t.fillStyle = a, t.font = "14px system-ui, -apple-system, sans-serif", t.textAlign = "center", t.textBaseline = "middle", t.fillText(n, 0, 0), t.restore();
@@ -3077,7 +3097,7 @@ class bt extends tt {
3077
3097
  getCropBoxWorldCorners() {
3078
3098
  const t = this.getCropBoxBounds();
3079
3099
  if (!t) return null;
3080
- const e = Math.cos(I.toRadians(this.rotation)), s = Math.sin(I.toRadians(this.rotation));
3100
+ const e = Math.cos(D.toRadians(this.rotation)), s = Math.sin(D.toRadians(this.rotation));
3081
3101
  return [
3082
3102
  { x: t.x, y: t.y },
3083
3103
  // top-left
@@ -3097,7 +3117,7 @@ class bt extends tt {
3097
3117
  * Local coordinates are relative to this.x, this.y (the center of the visible area)
3098
3118
  */
3099
3119
  worldToLocal(t, e) {
3100
- const s = t - this.x, i = e - this.y, r = Math.cos(I.toRadiansInverse(this.rotation)), h = Math.sin(I.toRadiansInverse(this.rotation));
3120
+ const s = t - this.x, i = e - this.y, r = Math.cos(D.toRadiansInverse(this.rotation)), h = Math.sin(D.toRadiansInverse(this.rotation));
3101
3121
  let a = s * r - i * h, n = s * h + i * r;
3102
3122
  const l = this.transformData.flipHorizontal ? -1 : 1, c = this.transformData.flipVertical ? -1 : 1;
3103
3123
  return a *= l, n *= c, {
@@ -3113,7 +3133,7 @@ class bt extends tt {
3113
3133
  localToWorld(t, e) {
3114
3134
  const s = this.transformData.flipHorizontal ? -1 : 1, i = this.transformData.flipVertical ? -1 : 1;
3115
3135
  let r = t * s, h = e * i;
3116
- const a = Math.cos(I.toRadians(this.rotation)), n = Math.sin(I.toRadians(this.rotation)), l = r * a - h * n, c = r * n + h * a;
3136
+ const a = Math.cos(D.toRadians(this.rotation)), n = Math.sin(D.toRadians(this.rotation)), l = r * a - h * n, c = r * n + h * a;
3117
3137
  return {
3118
3138
  x: this.x + l,
3119
3139
  y: this.y + c
@@ -3130,7 +3150,7 @@ class bt extends tt {
3130
3150
  if (!this.isCropping || this.isFrameLockedInCrop()) return null;
3131
3151
  const i = this.getCropBoxBounds();
3132
3152
  if (!i) return null;
3133
- const r = this.worldToLocal(t, e), h = 1 / s, a = Ie * h, n = ke * h, l = Ee * h, c = [
3153
+ const r = this.worldToLocal(t, e), h = 1 / s, a = De * h, n = ke * h, l = Ee * h, c = [
3134
3154
  { x: i.x, y: i.y, anchor: "top-left" },
3135
3155
  { x: i.x + i.width, y: i.y, anchor: "top-right" },
3136
3156
  { x: i.x, y: i.y + i.height, anchor: "bottom-left" },
@@ -3183,7 +3203,7 @@ class bt extends tt {
3183
3203
  l + a > 1 && (a = 1 - l), c + n > 1 && (n = 1 - c);
3184
3204
  let g = 0, d = 0;
3185
3205
  if (r) {
3186
- const u = this.transformData.cropX * this.transformData.width + this.transformData.cropWidth * this.transformData.width / 2, f = this.transformData.cropY * this.transformData.height + this.transformData.cropHeight * this.transformData.height / 2, m = l * this.transformData.width + a * this.transformData.width / 2, y = c * this.transformData.height + n * this.transformData.height / 2, p = m - u, w = y - f, b = Math.cos(I.toRadians(this.rotation)), x = Math.sin(I.toRadians(this.rotation));
3206
+ const u = this.transformData.cropX * this.transformData.width + this.transformData.cropWidth * this.transformData.width / 2, f = this.transformData.cropY * this.transformData.height + this.transformData.cropHeight * this.transformData.height / 2, m = l * this.transformData.width + a * this.transformData.width / 2, y = c * this.transformData.height + n * this.transformData.height / 2, p = m - u, w = y - f, b = Math.cos(D.toRadians(this.rotation)), x = Math.sin(D.toRadians(this.rotation));
3187
3207
  g = p * b - w * x, d = p * x + w * b;
3188
3208
  }
3189
3209
  this.transformData.cropX = l, this.transformData.cropY = c, this.transformData.cropWidth = a, this.transformData.cropHeight = n, r && (this.x += g, this.y += d);
@@ -3880,12 +3900,12 @@ function Lt(o, t, e, s, i = !1, r = !1, h, a = !1, n) {
3880
3900
  }
3881
3901
  return M.length > 0 && (M[0] = m + M[0], M[M.length - 1] = M[M.length - 1] + y), M;
3882
3902
  }
3883
- const b = w.join(" "), x = m + b + y, T = d(x), D = t < 200, F = a ? Rt(t) : Math.max(20, t * (D ? 0.08 : 0.05));
3903
+ const b = w.join(" "), x = m + b + y, T = d(x), I = t < 200, F = a ? Rt(t) : Math.max(20, t * (I ? 0.08 : 0.05));
3884
3904
  if (T <= t + F)
3885
3905
  return [x];
3886
3906
  const v = [];
3887
3907
  let A = "";
3888
- const k = a ? Rt(t) : Math.max(15, t * (D ? 0.05 : 0.03));
3908
+ const k = a ? Rt(t) : Math.max(15, t * (I ? 0.05 : 0.03));
3889
3909
  for (let M = 0; M < w.length; M++) {
3890
3910
  const E = w[M];
3891
3911
  if (d(E) > t + k) {
@@ -3935,9 +3955,9 @@ function Ut(o, t, e, s, i = !1, r = !1, h, a = !1, n) {
3935
3955
  const y = Ht(e, s, i, r);
3936
3956
  let p = 0;
3937
3957
  c.forEach((x, T) => {
3938
- const D = d[T].isParagraphStart, C = d[T].isParagraphEnd;
3958
+ const I = d[T].isParagraphStart, C = d[T].isParagraphEnd;
3939
3959
  let F = x;
3940
- if (!D) {
3960
+ if (!I) {
3941
3961
  const v = x.match(/^ +/), A = v ? v[0].length : 0;
3942
3962
  A > 0 && (F = F.substring(A));
3943
3963
  }
@@ -3979,8 +3999,8 @@ function je() {
3979
3999
  }
3980
4000
  function Ze(o, t, e) {
3981
4001
  const s = je(), i = [], r = t + Rt(t), h = (p, w) => {
3982
- const b = w.fontSize || e.fontSize, x = w.fontFamily || e.fontFamily, T = w.bold !== void 0 ? w.bold : e.bold || !1, D = w.italic !== void 0 ? w.italic : e.italic || !1, C = w.letterSpacing !== void 0 ? w.letterSpacing : e.letterSpacing ?? 0;
3983
- return s.font = ht(b, x, T, D), xt(s.measureText(p).width, p, C);
4002
+ const b = w.fontSize || e.fontSize, x = w.fontFamily || e.fontFamily, T = w.bold !== void 0 ? w.bold : e.bold || !1, I = w.italic !== void 0 ? w.italic : e.italic || !1, C = w.letterSpacing !== void 0 ? w.letterSpacing : e.letterSpacing ?? 0;
4003
+ return s.font = ht(b, x, T, I), xt(s.measureText(p).width, p, C);
3984
4004
  }, a = (p, w) => p.fontSize === w.fontSize && p.fontFamily === w.fontFamily && p.color === w.color && p.bold === w.bold && p.italic === w.italic && p.underline === w.underline && p.strikethrough === w.strikethrough && p.letterSpacing === w.letterSpacing, n = [];
3985
4005
  o.forEach((p) => {
3986
4006
  n.length > 0 && a(n[n.length - 1].style, p.style) ? n[n.length - 1].text += p.text : n.push({ text: p.text, style: p.style });
@@ -4010,15 +4030,15 @@ function Ze(o, t, e) {
4010
4030
  F !== x ? (b.push({ text: T, style: n[x].style }), T = l[C], x = F) : T += l[C];
4011
4031
  }
4012
4032
  T.length > 0 && b.push({ text: T, style: n[x].style });
4013
- const D = b.reduce((C, F) => C + h(F.text, F.style), 0);
4033
+ const I = b.reduce((C, F) => C + h(F.text, F.style), 0);
4014
4034
  if (p.text === " ") {
4015
4035
  if (f.length > 0) {
4016
4036
  const C = f[f.length - 1];
4017
4037
  a(C.style, b[0].style) ? C.text += " " : f.push({ text: " ", style: b[0].style });
4018
4038
  } else
4019
4039
  f.push({ text: " ", style: b[0].style });
4020
- m += D;
4021
- } else if (D > r) {
4040
+ m += I;
4041
+ } else if (I > r) {
4022
4042
  f.length > 0 && y();
4023
4043
  for (const C of b) {
4024
4044
  const F = Array.from(C.text);
@@ -4046,13 +4066,13 @@ function Ze(o, t, e) {
4046
4066
  f.push({ text: v, style: C.style });
4047
4067
  }
4048
4068
  } else
4049
- m + D > r && f.length > 0 && y(), b.forEach((C) => {
4069
+ m + I > r && f.length > 0 && y(), b.forEach((C) => {
4050
4070
  if (f.length > 0) {
4051
4071
  const F = f[f.length - 1];
4052
4072
  a(F.style, C.style) ? F.text += C.text : f.push({ ...C });
4053
4073
  } else
4054
4074
  f.push({ ...C });
4055
- }), m += D;
4075
+ }), m += I;
4056
4076
  }), y(), i.length === 0 && i.push([]), i;
4057
4077
  }
4058
4078
  function Ke(o) {
@@ -4097,7 +4117,7 @@ function ts(o, t, e, s) {
4097
4117
  const i = o.transformData;
4098
4118
  if (ot(i) !== void 0) {
4099
4119
  ae(i, Math.max(ee, e));
4100
- const h = I.toRadiansInverse(o.rotation), a = Math.cos(h), n = Math.sin(h), l = s.transformData, g = ot(l) ?? s.width ?? 0, u = (ot(i) ?? 0) - g;
4120
+ const h = D.toRadiansInverse(o.rotation), a = Math.cos(h), n = Math.sin(h), l = s.transformData, g = ot(l) ?? s.width ?? 0, u = (ot(i) ?? 0) - g;
4101
4121
  t === "middle-left" ? (o.x = s.x - u / 2 * a, o.y = s.y - u / 2 * n) : t === "middle-right" && (o.x = s.x + u / 2 * a, o.y = s.y + u / 2 * n);
4102
4122
  }
4103
4123
  }
@@ -4329,7 +4349,7 @@ class es extends j {
4329
4349
  }
4330
4350
  }
4331
4351
  function ss(o, t, e, s) {
4332
- const i = I.toRadians(s), r = Math.cos(i), h = Math.sin(i);
4352
+ const i = D.toRadians(s), r = Math.cos(i), h = Math.sin(i);
4333
4353
  let a = 0, n = 0;
4334
4354
  e === "top-left" ? (a = o.width, n = o.height) : e === "top-right" ? (a = 0, n = o.height) : e === "bottom-left" ? (a = o.width, n = 0) : e === "bottom-right" && (a = 0, n = 0);
4335
4355
  const l = o.x + (a * r - n * h), c = o.y + (a * h + n * r);
@@ -4339,14 +4359,14 @@ function ss(o, t, e, s) {
4339
4359
  return { x: u, y: f };
4340
4360
  }
4341
4361
  function Ti(o, t, e, s = 1) {
4342
- const i = o.width / 2, r = o.height + De / s, h = o.x + i, a = o.y + r, n = I.toRadians(t), l = Math.cos(n), c = Math.sin(n), g = h - e.x, d = a - e.y, u = g * l - d * c, f = g * c + d * l;
4362
+ const i = o.width / 2, r = o.height + Ie / s, h = o.x + i, a = o.y + r, n = D.toRadians(t), l = Math.cos(n), c = Math.sin(n), g = h - e.x, d = a - e.y, u = g * l - d * c, f = g * c + d * l;
4343
4363
  return {
4344
4364
  x: e.x + u,
4345
4365
  y: e.y + f
4346
4366
  };
4347
4367
  }
4348
4368
  function Fi(o, t, e) {
4349
- const s = I.toRadians(t), i = Math.cos(s), r = Math.sin(s), h = (c, g) => {
4369
+ const s = D.toRadians(t), i = Math.cos(s), r = Math.sin(s), h = (c, g) => {
4350
4370
  const d = o.x + c, u = o.y + g, f = d - e.x, m = u - e.y, y = f * i - m * r, p = f * r + m * i;
4351
4371
  return {
4352
4372
  x: e.x + y,
@@ -4387,20 +4407,20 @@ function Mi(o, t, e, s, i) {
4387
4407
  return r * r + h * h <= i * i;
4388
4408
  }
4389
4409
  function Ai(o, t, e, s) {
4390
- const i = I.toRadiansInverse(s), r = Math.cos(i), h = Math.sin(i), a = o - e.x, n = t - e.y, l = a * r - n * h, c = a * h + n * r;
4410
+ const i = D.toRadiansInverse(s), r = Math.cos(i), h = Math.sin(i), a = o - e.x, n = t - e.y, l = a * r - n * h, c = a * h + n * r;
4391
4411
  return l >= 0 && l <= e.width && c >= 0 && c <= e.height;
4392
4412
  }
4393
4413
  function et(o, t, e = "Arial", s = !1, i = !1) {
4394
4414
  const h = document.createElement("canvas").getContext("2d"), a = s ? "bold" : "normal", n = i ? "italic" : "normal";
4395
4415
  return h.font = `${n} ${a} ${t}px ${e}`, h.measureText(o).width;
4396
4416
  }
4397
- function Di(o) {
4417
+ function Ii(o) {
4398
4418
  return {
4399
4419
  x: o.x + o.width / 2,
4400
4420
  y: o.y + o.height / 2
4401
4421
  };
4402
4422
  }
4403
- function Ii(o, t, e, s) {
4423
+ function Di(o, t, e, s) {
4404
4424
  return Math.atan2(s - t, e - o);
4405
4425
  }
4406
4426
  function ki(o, t, e) {
@@ -4596,8 +4616,8 @@ class ns extends j {
4596
4616
  // bottom-left
4597
4617
  { x: y / 2, y: a }
4598
4618
  // bottom-right
4599
- ].forEach((D) => {
4600
- const C = D.x, F = D.y + x * r * D.x, v = p + C, A = b + F;
4619
+ ].forEach((I) => {
4620
+ const C = I.x, F = I.y + x * r * I.x, v = p + C, A = b + F;
4601
4621
  n = Math.min(n, v), l = Math.max(l, v), c = Math.min(c, A), g = Math.max(g, A);
4602
4622
  }), d += y;
4603
4623
  });
@@ -4710,7 +4730,7 @@ class cs extends j {
4710
4730
  { x: f / 2, y: r }
4711
4731
  // bottom-right
4712
4732
  ].forEach((x) => {
4713
- const T = x.x, D = x.y + w * He * x.x, C = m + T, F = p + D;
4733
+ const T = x.x, I = x.y + w * He * x.x, C = m + T, F = p + I;
4714
4734
  h = Math.min(h, C), a = Math.max(a, C), n = Math.min(n, F), l = Math.max(l, F);
4715
4735
  }), c += f;
4716
4736
  });
@@ -4768,7 +4788,7 @@ class ds extends j {
4768
4788
  const t = this.text.split(""), e = t.map((u) => et(u, this.fontSize, this.fontFamily)), s = e.reduce((u, f) => u + f, 0), i = 0.3, h = this.fontSize / 2;
4769
4789
  let a = 1 / 0, n = -1 / 0, l = 1 / 0, c = -1 / 0, g = -s / 2;
4770
4790
  t.forEach((u, f) => {
4771
- const m = e[f], y = g + m / 2, p = y / (this.transformData.width / 2), w = Math.abs(p), b = this.transformData.amplitude * w, x = b * this.fontSize * Math.sin(this.transformData.frequency * Math.PI * p), T = b * this.transformData.frequency * Math.PI * Math.cos(this.transformData.frequency * Math.PI * p), D = this.transformData.amplitude * Math.sign(p) * Math.sin(this.transformData.frequency * Math.PI * p), C = T + D;
4791
+ const m = e[f], y = g + m / 2, p = y / (this.transformData.width / 2), w = Math.abs(p), b = this.transformData.amplitude * w, x = b * this.fontSize * Math.sin(this.transformData.frequency * Math.PI * p), T = b * this.transformData.frequency * Math.PI * Math.cos(this.transformData.frequency * Math.PI * p), I = this.transformData.amplitude * Math.sign(p) * Math.sin(this.transformData.frequency * Math.PI * p), C = T + I;
4772
4792
  [
4773
4793
  { x: -m / 2, y: -h },
4774
4794
  // top-left
@@ -4964,7 +4984,7 @@ class fs extends j {
4964
4984
  { x: p / 2, y: n }
4965
4985
  // bottom-right
4966
4986
  ].forEach((T) => {
4967
- const D = T.x, C = T.y + r * h * T.x, F = w + D, v = b + C;
4987
+ const I = T.x, C = T.y + r * h * T.x, F = w + I, v = b + C;
4968
4988
  l = Math.min(l, F), c = Math.max(c, F), g = Math.min(g, v), d = Math.max(d, v);
4969
4989
  }), u += p;
4970
4990
  });
@@ -5224,7 +5244,7 @@ class Wt extends tt {
5224
5244
  this.renderWithOffscreen(t, i);
5225
5245
  return;
5226
5246
  }
5227
- t.save(), t.translate(this.x, this.y), t.rotate(I.toRadians(this.rotation)), t.fillStyle = dt(t, this.transformData);
5247
+ t.save(), t.translate(this.x, this.y), t.rotate(D.toRadians(this.rotation)), t.fillStyle = dt(t, this.transformData);
5228
5248
  const h = this.transformData.fillOpacity ?? 1;
5229
5249
  t.globalAlpha = i * h, this.renderShape(t), t.restore(), r && this.renderStroke(t, i);
5230
5250
  }
@@ -5245,14 +5265,14 @@ class Wt extends tt {
5245
5265
  const g = this.transformData.fillOpacity ?? 1;
5246
5266
  c.globalAlpha = g, c.beginPath(), this.traceShapePath(c), c.fill(), c.restore(), c.save(), c.translate(a / 2, n / 2);
5247
5267
  const d = this.stroke;
5248
- c.strokeStyle = d.color || "#000000", c.lineWidth = d.width || 2, c.lineCap = d.lineCap || "round", c.lineJoin = d.lineJoin || "round", c.globalAlpha = d.opacity ?? 1, d.dashArray && d.dashArray.length > 0 && c.setLineDash(d.dashArray), c.beginPath(), this.traceShapePath(c), c.stroke(), c.restore(), t.save(), t.translate(this.x, this.y), t.rotate(I.toRadians(this.rotation)), t.globalAlpha = e, t.drawImage(l, -a / 2, -n / 2), t.restore();
5268
+ c.strokeStyle = d.color || "#000000", c.lineWidth = d.width || 2, c.lineCap = d.lineCap || "round", c.lineJoin = d.lineJoin || "round", c.globalAlpha = d.opacity ?? 1, d.dashArray && d.dashArray.length > 0 && c.setLineDash(d.dashArray), c.beginPath(), this.traceShapePath(c), c.stroke(), c.restore(), t.save(), t.translate(this.x, this.y), t.rotate(D.toRadians(this.rotation)), t.globalAlpha = e, t.drawImage(l, -a / 2, -n / 2), t.restore();
5249
5269
  }
5250
5270
  /**
5251
5271
  * Direct render (no offscreen) — used as fallback
5252
5272
  */
5253
5273
  renderDirect(t, e) {
5254
5274
  var s;
5255
- t.save(), t.translate(this.x, this.y), t.rotate(I.toRadians(this.rotation)), t.fillStyle = dt(t, this.transformData), t.globalAlpha = e * (this.transformData.fillOpacity ?? 1), this.renderShape(t), t.restore(), (s = this.stroke) != null && s.enabled && this.renderStroke(t, e);
5275
+ t.save(), t.translate(this.x, this.y), t.rotate(D.toRadians(this.rotation)), t.fillStyle = dt(t, this.transformData), t.globalAlpha = e * (this.transformData.fillOpacity ?? 1), this.renderShape(t), t.restore(), (s = this.stroke) != null && s.enabled && this.renderStroke(t, e);
5256
5276
  }
5257
5277
  /**
5258
5278
  * Trace the shape path without filling or stroking — used by offscreen render
@@ -5313,7 +5333,7 @@ class Wt extends tt {
5313
5333
  * Render the stroke for this shape element
5314
5334
  */
5315
5335
  renderStroke(t, e) {
5316
- t.save(), t.translate(this.x, this.y), t.rotate(I.toRadians(this.rotation));
5336
+ t.save(), t.translate(this.x, this.y), t.rotate(D.toRadians(this.rotation));
5317
5337
  const s = this.stroke;
5318
5338
  t.strokeStyle = s.color || "#000000", t.lineWidth = s.width || 2, t.lineCap = s.lineCap || "round", t.lineJoin = s.lineJoin || "round", t.globalAlpha = e * (s.opacity ?? 1), s.dashArray && s.dashArray.length > 0 && t.setLineDash(s.dashArray);
5319
5339
  const { shapeType: i, width: r, height: h } = this.transformData;
@@ -5703,7 +5723,7 @@ class Nt extends tt {
5703
5723
  y: f.y + (((g = f.handleIn) == null ? void 0 : g.y) || 0)
5704
5724
  }, b = { x: f.x, y: f.y }, x = 20;
5705
5725
  for (let T = 0; T <= x; T++) {
5706
- const D = T / x, C = this.bezierPoint(y, p, w, b, D);
5726
+ const I = T / x, C = this.bezierPoint(y, p, w, b, I);
5707
5727
  e = Math.min(e, C.x), s = Math.min(s, C.y), i = Math.max(i, C.x), r = Math.max(r, C.y);
5708
5728
  }
5709
5729
  }
@@ -5730,7 +5750,7 @@ class Nt extends tt {
5730
5750
  const { points: i, closed: r, fillEnabled: h, fillColor: a, fillOpacity: n, strokeEnabled: l, strokeColor: c, strokeWidth: g } = this.transformData;
5731
5751
  if (i.length === 0)
5732
5752
  return;
5733
- t.save(), t.translate(this.x, this.y), t.rotate(I.toRadians(this.rotation));
5753
+ t.save(), t.translate(this.x, this.y), t.rotate(D.toRadians(this.rotation));
5734
5754
  const d = this.calculatePathBounds(), u = d.x + d.width / 2, f = d.y + d.height / 2;
5735
5755
  t.translate(-u, -f), t.beginPath(), this.renderPath(t), h && r && a && (t.fillStyle = a, t.globalAlpha = n ?? 1, t.fill()), l && c && g && (t.strokeStyle = c, t.lineWidth = g, t.lineCap = "round", t.lineJoin = "round", t.globalAlpha = 1, t.stroke()), t.restore();
5736
5756
  }
@@ -6310,8 +6330,8 @@ class yt extends tt {
6310
6330
  }
6311
6331
  const c = -i.rotation * Math.PI / 180, g = Math.cos(c), d = Math.sin(c), u = i.x + (n * g - l * d), f = i.y + (n * d + l * g);
6312
6332
  this.children.forEach((p, w) => {
6313
- const b = i.childrenStartData[w], x = b.x - u, T = b.y - f, D = u + x * a, C = f + T * a;
6314
- if (p.x = D, p.y = C, p instanceof bt) {
6333
+ const b = i.childrenStartData[w], x = b.x - u, T = b.y - f, I = u + x * a, C = f + T * a;
6334
+ if (p.x = I, p.y = C, p instanceof bt) {
6315
6335
  const F = b.transformData, v = F.width * a, A = F.height * a;
6316
6336
  p.transformData.width = v, p.transformData.height = A;
6317
6337
  } else if (p instanceof yt) {
@@ -7293,9 +7313,9 @@ class Ss {
7293
7313
  if (!b) continue;
7294
7314
  const x = this.getCoverageIndex(b, a.id), T = w;
7295
7315
  if (x !== -1 && T.alternateSets) {
7296
- const D = T.alternateSets[x];
7297
- if (D)
7298
- for (const C of D)
7316
+ const I = T.alternateSets[x];
7317
+ if (I)
7318
+ for (const C of I)
7299
7319
  r.push({
7300
7320
  glyphIndex: C,
7301
7321
  unicode: e,
@@ -7518,10 +7538,10 @@ export {
7518
7538
  Ye as a0,
7519
7539
  Kt as a1,
7520
7540
  is as a2,
7521
- Ie as a3,
7541
+ De as a3,
7522
7542
  P as a4,
7523
- Ii as a5,
7524
- I as a6,
7543
+ Di as a5,
7544
+ D as a6,
7525
7545
  ki as a7,
7526
7546
  _s as a8,
7527
7547
  ks as a9,
@@ -7553,9 +7573,9 @@ export {
7553
7573
  ms as aZ,
7554
7574
  $t as a_,
7555
7575
  Es as aa,
7556
- Is as ab,
7576
+ Ds as ab,
7557
7577
  Ae as ac,
7558
- Ds as ad,
7578
+ Is as ad,
7559
7579
  As as ae,
7560
7580
  Z as af,
7561
7581
  ht as ag,
@@ -7595,10 +7615,10 @@ export {
7595
7615
  Hs as bd,
7596
7616
  Ys as be,
7597
7617
  Ei as bf,
7598
- De as bg,
7618
+ Ie as bg,
7599
7619
  Fs as bh,
7600
7620
  Os as bi,
7601
- Di as bj,
7621
+ Ii as bj,
7602
7622
  wt as c,
7603
7623
  ns as d,
7604
7624
  Cs as e,
@@ -7624,4 +7644,4 @@ export {
7624
7644
  Vs as y,
7625
7645
  $i as z
7626
7646
  };
7627
- //# sourceMappingURL=FontAnalyzer-Bj2KrX80.js.map
7647
+ //# sourceMappingURL=FontAnalyzer-Ch1jgTq7.js.map