@pixldocs/canvas-renderer 0.5.373 → 0.5.375

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.
@@ -2,7 +2,7 @@
2
2
  var __defProp = Object.defineProperty;
3
3
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- var _a, _b;
5
+ var _a, _b, _c;
6
6
  const jsxRuntime = require("react/jsx-runtime");
7
7
  const react = require("react");
8
8
  const reactDom = require("react-dom");
@@ -311,14 +311,14 @@ function lineToString(line) {
311
311
  return Array.isArray(line) ? line.join("") : String(line ?? "");
312
312
  }
313
313
  function measureTextLineWithCanvas(textbox, lineText, lineIndex) {
314
- var _a2, _b2, _c, _d, _e;
314
+ var _a2, _b2, _c2, _d, _e;
315
315
  if (!lineText) return 0;
316
316
  const ctx = getMeasureContext();
317
317
  if (!ctx) return null;
318
318
  const tb = textbox;
319
319
  const fontSize = Number(((_a2 = tb.getValueOfPropertyAt) == null ? void 0 : _a2.call(tb, lineIndex, 0, "fontSize")) ?? textbox.fontSize ?? 16);
320
320
  const fontStyle = String(((_b2 = tb.getValueOfPropertyAt) == null ? void 0 : _b2.call(tb, lineIndex, 0, "fontStyle")) ?? textbox.fontStyle ?? "normal");
321
- const fontWeight = String(((_c = tb.getValueOfPropertyAt) == null ? void 0 : _c.call(tb, lineIndex, 0, "fontWeight")) ?? textbox.fontWeight ?? "400");
321
+ const fontWeight = String(((_c2 = tb.getValueOfPropertyAt) == null ? void 0 : _c2.call(tb, lineIndex, 0, "fontWeight")) ?? textbox.fontWeight ?? "400");
322
322
  const fontFamily = String(((_d = tb.getValueOfPropertyAt) == null ? void 0 : _d.call(tb, lineIndex, 0, "fontFamily")) ?? textbox.fontFamily ?? "Open Sans");
323
323
  const charSpacing = Number(((_e = tb.getValueOfPropertyAt) == null ? void 0 : _e.call(tb, lineIndex, 0, "charSpacing")) ?? textbox.charSpacing ?? 0);
324
324
  ctx.save();
@@ -3638,14 +3638,14 @@ const clearFontCacheAndRerender = (canvas, options = {}) => {
3638
3638
  canvas.requestRenderAll();
3639
3639
  };
3640
3640
  const ensureFontLoaded = async (fontFamily) => {
3641
- var _a2, _b2, _c;
3641
+ var _a2, _b2, _c2;
3642
3642
  if (!fontFamily) return;
3643
3643
  if (LOCAL_FONTS.has(fontFamily)) {
3644
3644
  try {
3645
3645
  const isLoaded = (_a2 = document.fonts) == null ? void 0 : _a2.check(`16px "${fontFamily}"`);
3646
3646
  if (isLoaded) return;
3647
3647
  await ((_b2 = document.fonts) == null ? void 0 : _b2.load(`16px "${fontFamily}"`));
3648
- await ((_c = document.fonts) == null ? void 0 : _c.load(`bold 16px "${fontFamily}"`));
3648
+ await ((_c2 = document.fonts) == null ? void 0 : _c2.load(`bold 16px "${fontFamily}"`));
3649
3649
  } catch (e) {
3650
3650
  console.warn(`Failed to ensure local font loaded: ${fontFamily}`, e);
3651
3651
  }
@@ -4139,7 +4139,7 @@ function createImageClipPath(element, imgWidth, imgHeight) {
4139
4139
  }
4140
4140
  }
4141
4141
  async function loadImageAsync(element, placeholder, fc, fabricRef, syncLockedRef, isTransforming) {
4142
- var _a2, _b2, _c, _d;
4142
+ var _a2, _b2, _c2, _d;
4143
4143
  const imageUrl = element.src || element.imageUrl;
4144
4144
  if (!imageUrl) return;
4145
4145
  const nextSvgColorMap = element.svgColorMap ? JSON.stringify(element.svgColorMap) : "";
@@ -4304,7 +4304,7 @@ async function loadImageAsync(element, placeholder, fc, fabricRef, syncLockedRef
4304
4304
  const existingImg = (_a2 = existingCropGroup.__cropData) == null ? void 0 : _a2._img;
4305
4305
  if (existingImg) {
4306
4306
  panX = ((_b2 = existingImg._ct) == null ? void 0 : _b2.panX) ?? existingImg.__panX ?? 0.5;
4307
- panY = ((_c = existingImg._ct) == null ? void 0 : _c.panY) ?? existingImg.__panY ?? 0.5;
4307
+ panY = ((_c2 = existingImg._ct) == null ? void 0 : _c2.panY) ?? existingImg.__panY ?? 0.5;
4308
4308
  zoom = ((_d = existingImg._ct) == null ? void 0 : _d.zoom) ?? 1;
4309
4309
  }
4310
4310
  }
@@ -4539,7 +4539,7 @@ async function detectMaskType(svgUrl) {
4539
4539
  }
4540
4540
  }
4541
4541
  async function applySvgMaskToCropGroup(cropGroup, svgUrl) {
4542
- var _a2, _b2, _c;
4542
+ var _a2, _b2, _c2;
4543
4543
  if (!isCropGroup(cropGroup)) {
4544
4544
  throw new Error("Selected object is not a crop group / image");
4545
4545
  }
@@ -4569,7 +4569,7 @@ async function applySvgMaskToCropGroup(cropGroup, svgUrl) {
4569
4569
  child.dirty = true;
4570
4570
  }
4571
4571
  }
4572
- (_c = cropGroup.canvas) == null ? void 0 : _c.requestRenderAll();
4572
+ (_c2 = cropGroup.canvas) == null ? void 0 : _c2.requestRenderAll();
4573
4573
  }
4574
4574
  function loadSvgAsImage(svgUrl) {
4575
4575
  return new Promise((resolve, reject) => {
@@ -4630,7 +4630,7 @@ async function buildLuminanceAlphaCanvas(svgUrl, frameW, frameH) {
4630
4630
  return canvas;
4631
4631
  }
4632
4632
  async function applyLuminanceMaskToCropGroup(cropGroup, svgUrl) {
4633
- var _a2, _b2, _c;
4633
+ var _a2, _b2, _c2;
4634
4634
  if (!isCropGroup(cropGroup)) {
4635
4635
  throw new Error("Selected object is not a crop group / image");
4636
4636
  }
@@ -4665,7 +4665,7 @@ async function applyLuminanceMaskToCropGroup(cropGroup, svgUrl) {
4665
4665
  child.dirty = true;
4666
4666
  }
4667
4667
  }
4668
- (_c = cropGroup.canvas) == null ? void 0 : _c.requestRenderAll();
4668
+ (_c2 = cropGroup.canvas) == null ? void 0 : _c2.requestRenderAll();
4669
4669
  }
4670
4670
  async function applyMaskToCropGroup(cropGroup, svgUrl, maskType) {
4671
4671
  if (maskType === "luminance") {
@@ -4684,7 +4684,7 @@ function getAppliedSvgMaskType(obj) {
4684
4684
  return t === "luminance" || t === "shape" ? t : null;
4685
4685
  }
4686
4686
  function clearSvgMaskFromCropGroup(cropGroup) {
4687
- var _a2, _b2, _c;
4687
+ var _a2, _b2, _c2;
4688
4688
  if (!isCropGroup(cropGroup)) return;
4689
4689
  const frameW = ((_a2 = cropGroup._ct) == null ? void 0 : _a2.frameW) ?? cropGroup.width ?? 0;
4690
4690
  const frameH = ((_b2 = cropGroup._ct) == null ? void 0 : _b2.frameH) ?? cropGroup.height ?? 0;
@@ -4706,7 +4706,7 @@ function clearSvgMaskFromCropGroup(cropGroup) {
4706
4706
  delete cropGroup.__svgMaskUrl;
4707
4707
  delete cropGroup.__svgMaskType;
4708
4708
  cropGroup.dirty = true;
4709
- (_c = cropGroup.canvas) == null ? void 0 : _c.requestRenderAll();
4709
+ (_c2 = cropGroup.canvas) == null ? void 0 : _c2.requestRenderAll();
4710
4710
  }
4711
4711
  const svgMaskApply = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4712
4712
  __proto__: null,
@@ -6198,7 +6198,7 @@ function calculateScaleSnapGuides(scalingObj, corner, canvas, canvasWidth, canva
6198
6198
  const MIN_SNAP_BOX = 20;
6199
6199
  const SNAP_HYSTERESIS_PX = 6;
6200
6200
  function applyScaleSnapToBox(box, corner, canvas, canvasWidth, canvasHeight, snapToGuides, snapThreshold, excludeObjectId, options) {
6201
- var _a2, _b2, _c, _d, _e, _f, _g, _h;
6201
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h;
6202
6202
  const hysteresis = (options == null ? void 0 : options.hysteresis) ?? SNAP_HYSTERESIS_PX;
6203
6203
  const activeSnapRef = options == null ? void 0 : options.activeSnapRef;
6204
6204
  const roundSnappedOnly = (options == null ? void 0 : options.roundSnappedOnly) ?? false;
@@ -6294,7 +6294,7 @@ function applyScaleSnapToBox(box, corner, canvas, canvasWidth, canvasHeight, sna
6294
6294
  let snappedTop = false;
6295
6295
  let snappedBottom = false;
6296
6296
  if (resizingLeft) {
6297
- const stick = (_c = activeSnapRef == null ? void 0 : activeSnapRef.current) == null ? void 0 : _c.left;
6297
+ const stick = (_c2 = activeSnapRef == null ? void 0 : activeSnapRef.current) == null ? void 0 : _c2.left;
6298
6298
  if (stick !== void 0) {
6299
6299
  const dist = Math.abs(box.left - stick);
6300
6300
  if (dist <= releaseDist) {
@@ -6948,7 +6948,7 @@ function scaleLocalToScreen(target, p) {
6948
6948
  return new fabric__namespace.Point(p.x * sx * zx, p.y * sy * zy);
6949
6949
  }
6950
6950
  function applyTextPathControls(textbox) {
6951
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
6951
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
6952
6952
  const obj = textbox;
6953
6953
  if (!hasActiveTextPath(obj)) {
6954
6954
  obj.__pdTextPathHovered = false;
@@ -6971,7 +6971,7 @@ function applyTextPathControls(textbox) {
6971
6971
  delete obj.controls.bzMidT1;
6972
6972
  delete obj.controls.tpRot;
6973
6973
  delete obj.controls.tpPivot;
6974
- (_c = obj.setControlsVisibility) == null ? void 0 : _c.call(obj, { tl: true, tr: true, bl: true, br: true, mt: true, mb: true, ml: true, mr: true, mtr: true });
6974
+ (_c2 = obj.setControlsVisibility) == null ? void 0 : _c2.call(obj, { tl: true, tr: true, bl: true, br: true, mt: true, mb: true, ml: true, mr: true, mtr: true });
6975
6975
  obj.hasBorders = true;
6976
6976
  obj.__pdTextPathControls = false;
6977
6977
  obj.setCoords();
@@ -7671,10 +7671,10 @@ function textPathBoundsContainScenePoint(obj, point) {
7671
7671
  }
7672
7672
  }
7673
7673
  function drawTextPathBounds(ctx, obj, bounds, hostCanvas) {
7674
- var _a2, _b2, _c;
7674
+ var _a2, _b2, _c2;
7675
7675
  const host = hostCanvas || obj.canvas || ((_a2 = obj.group) == null ? void 0 : _a2.canvas);
7676
7676
  if (!host) return;
7677
- const retina = ((_b2 = host.getRetinaScaling) == null ? void 0 : _b2.call(host)) || ((_c = obj.getCanvasRetinaScaling) == null ? void 0 : _c.call(obj)) || 1;
7677
+ const retina = ((_b2 = host.getRetinaScaling) == null ? void 0 : _b2.call(host)) || ((_c2 = obj.getCanvasRetinaScaling) == null ? void 0 : _c2.call(obj)) || 1;
7678
7678
  const matrix = fabric__namespace.util.multiplyTransformMatrices(host.viewportTransform || [1, 0, 0, 1, 0, 0], obj.calcTransformMatrix());
7679
7679
  const corners = [
7680
7680
  new fabric__namespace.Point(bounds.minX, bounds.minY),
@@ -7696,8 +7696,8 @@ function drawTextPathBounds(ctx, obj, bounds, hostCanvas) {
7696
7696
  }
7697
7697
  if (typeof TextboxProto._renderControls === "function" && !TextboxProto.__pixldocsOrigRenderControls) {
7698
7698
  let drawWarpGuides = function(ctx) {
7699
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j;
7700
- const hostCanvas = this.canvas || ((_a2 = this.group) == null ? void 0 : _a2.canvas) || ((_c = (_b2 = this.group) == null ? void 0 : _b2.group) == null ? void 0 : _c.canvas);
7699
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j;
7700
+ const hostCanvas = this.canvas || ((_a2 = this.group) == null ? void 0 : _a2.canvas) || ((_c2 = (_b2 = this.group) == null ? void 0 : _b2.group) == null ? void 0 : _c2.canvas);
7701
7701
  if (!hostCanvas) return;
7702
7702
  const hoverBounds = getTextPathHitBounds(this);
7703
7703
  const active = (_d = hostCanvas.getActiveObject) == null ? void 0 : _d.call(hostCanvas);
@@ -8120,14 +8120,14 @@ function buildRoundedRectPath2D(ctx, x, y, w, h, rTL, rTR, rBR, rBL) {
8120
8120
  ctx.closePath();
8121
8121
  }
8122
8122
  function measureLineGlyphWidth(obj, lineIndex) {
8123
- var _a2, _b2, _c, _d, _e, _f;
8123
+ var _a2, _b2, _c2, _d, _e, _f;
8124
8124
  try {
8125
8125
  const rawLine = (_a2 = obj == null ? void 0 : obj._textLines) == null ? void 0 : _a2[lineIndex];
8126
8126
  const lineText = Array.isArray(rawLine) ? rawLine.join("") : String(rawLine ?? "");
8127
8127
  if (!lineText) return 0;
8128
8128
  const fontSize = Number(((_b2 = obj.getValueOfPropertyAt) == null ? void 0 : _b2.call(obj, lineIndex, 0, "fontSize")) ?? obj.fontSize ?? 0);
8129
8129
  if (!fontSize) return 0;
8130
- const fontStyle = String(((_c = obj.getValueOfPropertyAt) == null ? void 0 : _c.call(obj, lineIndex, 0, "fontStyle")) ?? obj.fontStyle ?? "normal");
8130
+ const fontStyle = String(((_c2 = obj.getValueOfPropertyAt) == null ? void 0 : _c2.call(obj, lineIndex, 0, "fontStyle")) ?? obj.fontStyle ?? "normal");
8131
8131
  const fontWeight = String(((_d = obj.getValueOfPropertyAt) == null ? void 0 : _d.call(obj, lineIndex, 0, "fontWeight")) ?? obj.fontWeight ?? "400");
8132
8132
  const fontFamily = String(((_e = obj.getValueOfPropertyAt) == null ? void 0 : _e.call(obj, lineIndex, 0, "fontFamily")) ?? obj.fontFamily ?? "sans-serif");
8133
8133
  const charSpacing = Number(((_f = obj.getValueOfPropertyAt) == null ? void 0 : _f.call(obj, lineIndex, 0, "charSpacing")) ?? obj.charSpacing ?? 0);
@@ -9518,7 +9518,7 @@ function createShape(element) {
9518
9518
  }
9519
9519
  }
9520
9520
  function createText(element) {
9521
- var _a2, _b2, _c, _d, _e;
9521
+ var _a2, _b2, _c2, _d, _e;
9522
9522
  const overflowPolicy = element.overflowPolicy || "grow-and-push";
9523
9523
  let text = element.text ?? "";
9524
9524
  let fontSize = element.fontSize || 16;
@@ -9734,7 +9734,7 @@ function createText(element) {
9734
9734
  } catch {
9735
9735
  }
9736
9736
  try {
9737
- const baseCtrls = (_d = (_c = fabric__namespace.Object) == null ? void 0 : _c.prototype) == null ? void 0 : _d.controls;
9737
+ const baseCtrls = (_d = (_c2 = fabric__namespace.Object) == null ? void 0 : _c2.prototype) == null ? void 0 : _d.controls;
9738
9738
  if (baseCtrls) {
9739
9739
  textbox.controls = {
9740
9740
  ...textbox.controls || {},
@@ -10532,6 +10532,24 @@ try {
10532
10532
  const height = Math.max(0, ((size == null ? void 0 : size.y) ?? 0) - border);
10533
10533
  ctx.strokeRect(-width / 2, -height / 2, width, height);
10534
10534
  };
10535
+ if (typeof InteractiveBase.prototype.drawControlsConnectingLines === "function") {
10536
+ const originalDrawControlConnections = InteractiveBase.prototype.drawControlsConnectingLines;
10537
+ InteractiveBase.prototype.drawControlsConnectingLines = function(ctx, size) {
10538
+ var _a2;
10539
+ const disabledRotateConnections = [];
10540
+ try {
10541
+ (_a2 = this.forEachControl) == null ? void 0 : _a2.call(this, (control, key) => {
10542
+ if (key === "mtr" || String((control == null ? void 0 : control.actionName) ?? "") === "rotate") {
10543
+ disabledRotateConnections.push([control, control.withConnection]);
10544
+ control.withConnection = false;
10545
+ }
10546
+ });
10547
+ originalDrawControlConnections.call(this, ctx, size);
10548
+ } finally {
10549
+ for (const [control, wasConnected] of disabledRotateConnections) control.withConnection = wasConnected;
10550
+ }
10551
+ };
10552
+ }
10535
10553
  }
10536
10554
  if (InteractiveBase == null ? void 0 : InteractiveBase.ownDefaults) {
10537
10555
  Object.assign(InteractiveBase.ownDefaults, {
@@ -10592,13 +10610,13 @@ try {
10592
10610
  };
10593
10611
  const COLLAPSE_THRESHOLD_PX = 32;
10594
10612
  const shouldCollapseHandles = (fabricObject) => {
10595
- var _a2, _b2, _c;
10613
+ var _a2, _b2, _c2;
10596
10614
  try {
10597
10615
  const canvas = fabricObject == null ? void 0 : fabricObject.canvas;
10598
10616
  if (!canvas) return false;
10599
10617
  const zoom = ((_a2 = canvas.getZoom) == null ? void 0 : _a2.call(canvas)) ?? 1;
10600
10618
  const w = (((_b2 = fabricObject.getScaledWidth) == null ? void 0 : _b2.call(fabricObject)) ?? fabricObject.width ?? 0) * zoom;
10601
- const h = (((_c = fabricObject.getScaledHeight) == null ? void 0 : _c.call(fabricObject)) ?? fabricObject.height ?? 0) * zoom;
10619
+ const h = (((_c2 = fabricObject.getScaledHeight) == null ? void 0 : _c2.call(fabricObject)) ?? fabricObject.height ?? 0) * zoom;
10602
10620
  return Math.min(w, h) < COLLAPSE_THRESHOLD_PX;
10603
10621
  } catch {
10604
10622
  return false;
@@ -10616,11 +10634,11 @@ try {
10616
10634
  control.__pixldocsCollapseVisibilityWrapped = true;
10617
10635
  };
10618
10636
  const renderPill = (ctx, left, top, _styleOverride, fabricObject, orientation, controlKey) => {
10619
- var _a2, _b2, _c;
10637
+ var _a2, _b2, _c2;
10620
10638
  const action = (_b2 = (_a2 = fabricObject.canvas) == null ? void 0 : _a2._currentTransform) == null ? void 0 : _b2.action;
10621
10639
  if (action === "drag" && fabricObject.__pixldocsDragMoved) return;
10622
10640
  if (shouldCollapseHandles(fabricObject) && !isVisibleControlWhenCollapsed(controlKey)) return;
10623
- const angle = ((_c = fabricObject.getTotalAngle) == null ? void 0 : _c.call(fabricObject)) ?? (fabricObject.angle ?? 0);
10641
+ const angle = ((_c2 = fabricObject.getTotalAngle) == null ? void 0 : _c2.call(fabricObject)) ?? (fabricObject.angle ?? 0);
10624
10642
  const p = getHoverProgress(fabricObject, controlKey);
10625
10643
  const scale = getVisualScale(fabricObject);
10626
10644
  const pillLen = PILL_LEN * scale;
@@ -10817,7 +10835,7 @@ try {
10817
10835
  mtr.x = 0;
10818
10836
  mtr.y = -0.5;
10819
10837
  mtr.cursorStyle = getRotateCursor(null);
10820
- mtr.cursorStyleHandler = (_e, _c, fabricObject) => {
10838
+ mtr.cursorStyleHandler = (_e, _c2, fabricObject) => {
10821
10839
  const cursor = getRotateCursor(fabricObject);
10822
10840
  try {
10823
10841
  const canvas = fabricObject == null ? void 0 : fabricObject.canvas;
@@ -10960,6 +10978,35 @@ try {
10960
10978
  }
10961
10979
  return controls;
10962
10980
  };
10981
+ const ControlProto = (_b = fabric__namespace.Control) == null ? void 0 : _b.prototype;
10982
+ if (ControlProto && !ControlProto.__pixldocsCanvaRenderFallback) {
10983
+ const originalControlRender = ControlProto.render;
10984
+ ControlProto.render = function(ctx, left, top, styleOverride, fabricObject) {
10985
+ const actionName = String(this.actionName ?? "");
10986
+ if (actionName !== "rotate" && actionName !== "drag") {
10987
+ const x = Number(this.x ?? 0);
10988
+ const y = Number(this.y ?? 0);
10989
+ const atLeftRight = Math.abs(Math.abs(x) - 0.5) < 1e-3;
10990
+ const atTopBottom = Math.abs(Math.abs(y) - 0.5) < 1e-3;
10991
+ const atCenterX = Math.abs(x) < 1e-3;
10992
+ const atCenterY = Math.abs(y) < 1e-3;
10993
+ if (atLeftRight && atCenterY) {
10994
+ const key = x < 0 ? "ml" : "mr";
10995
+ return renderPill(ctx, left, top, styleOverride, fabricObject, "vertical", key);
10996
+ }
10997
+ if (atCenterX && atTopBottom) {
10998
+ const key = y < 0 ? "mt" : "mb";
10999
+ return renderPill(ctx, left, top, styleOverride, fabricObject, "horizontal", key);
11000
+ }
11001
+ if (atLeftRight && atTopBottom) {
11002
+ const key = `${y < 0 ? "t" : "b"}${x < 0 ? "l" : "r"}`;
11003
+ return renderCornerDot(ctx, left, top, styleOverride, fabricObject, key);
11004
+ }
11005
+ }
11006
+ return originalControlRender.call(this, ctx, left, top, styleOverride, fabricObject);
11007
+ };
11008
+ ControlProto.__pixldocsCanvaRenderFallback = true;
11009
+ }
10963
11010
  ensureCanvaControlRenders = (obj) => {
10964
11011
  try {
10965
11012
  if (obj && obj.controls) installPillRenders(obj.controls);
@@ -10992,7 +11039,7 @@ try {
10992
11039
  wrapClassCreateControls(fabric__namespace.IText);
10993
11040
  wrapClassCreateControls(fabric__namespace.ActiveSelection);
10994
11041
  wrapClassCreateControls(fabric__namespace.Group);
10995
- const CanvasProto = (_b = fabric__namespace.Canvas) == null ? void 0 : _b.prototype;
11042
+ const CanvasProto = (_c = fabric__namespace.Canvas) == null ? void 0 : _c.prototype;
10996
11043
  if (CanvasProto && typeof CanvasProto._setCursorFromEvent === "function") {
10997
11044
  const origSet = CanvasProto._setCursorFromEvent;
10998
11045
  CanvasProto._setCursorFromEvent = function(e, target) {
@@ -11140,14 +11187,14 @@ const matrixForRotDriftLog = (matrix) => {
11140
11187
  return matrix.map((entry) => roundRotDriftNumber(entry));
11141
11188
  };
11142
11189
  const summarizeRotDriftObject = (obj, worldMatrix) => {
11143
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
11190
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
11144
11191
  if (!obj) return null;
11145
11192
  const anyObj = obj;
11146
11193
  try {
11147
11194
  const ownMatrix = (_a2 = obj.calcOwnMatrix) == null ? void 0 : _a2.call(obj);
11148
11195
  const calcWorld = worldMatrix ?? ((_b2 = obj.calcTransformMatrix) == null ? void 0 : _b2.call(obj));
11149
11196
  const decomposed = calcWorld ? fabric__namespace.util.qrDecompose(calcWorld) : null;
11150
- const center = (_c = obj.getCenterPoint) == null ? void 0 : _c.call(obj);
11197
+ const center = (_c2 = obj.getCenterPoint) == null ? void 0 : _c2.call(obj);
11151
11198
  const rect = (_d = obj.getBoundingRect) == null ? void 0 : _d.call(obj);
11152
11199
  return {
11153
11200
  id: getObjectId(obj),
@@ -12678,7 +12725,7 @@ const PageCanvas = react.forwardRef(
12678
12725
  clearSectionGroupTransientSnapshot();
12679
12726
  });
12680
12727
  const syncSelectionToStore = () => {
12681
- var _a2, _b2, _c, _d;
12728
+ var _a2, _b2, _c2, _d;
12682
12729
  if (!isActiveRef.current || isRebuildingRef.current || isSyncingSelectionToFabricRef.current || !allowSelection) return;
12683
12730
  const walkToTopmostGroup = (childId, children, activeEditingGroupId) => {
12684
12731
  let topmost = null;
@@ -12747,7 +12794,7 @@ const PageCanvas = react.forwardRef(
12747
12794
  }
12748
12795
  if (ids.length > 1 && !(active instanceof fabric__namespace.ActiveSelection && active.__pixldocsGroupSelection)) {
12749
12796
  const state = useEditorStore.getState();
12750
- const currentPage2 = (_c = state.canvas.pages) == null ? void 0 : _c.find((p) => p.id === pageId);
12797
+ const currentPage2 = (_c2 = state.canvas.pages) == null ? void 0 : _c2.find((p) => p.id === pageId);
12751
12798
  const children = (currentPage2 == null ? void 0 : currentPage2.children) ?? [];
12752
12799
  const activeEditingGroupId = fabricCanvas.__activeEditingGroupId ?? null;
12753
12800
  const involvedGroupIds = /* @__PURE__ */ new Set();
@@ -12888,7 +12935,7 @@ const PageCanvas = react.forwardRef(
12888
12935
  }
12889
12936
  });
12890
12937
  fabricCanvas.on("mouse:dblclick", (opt) => {
12891
- var _a2, _b2, _c;
12938
+ var _a2, _b2, _c2;
12892
12939
  const target = opt == null ? void 0 : opt.target;
12893
12940
  if (!target) return;
12894
12941
  if (target.isEditing) return;
@@ -12984,7 +13031,7 @@ const PageCanvas = react.forwardRef(
12984
13031
  const selectedId = selectionIdx < 0 ? childId : chain[selectionIdx].id;
12985
13032
  selectElements([selectedId], false, false);
12986
13033
  try {
12987
- (_c = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _c.call(fabricCanvas);
13034
+ (_c2 = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _c2.call(fabricCanvas);
12988
13035
  } catch {
12989
13036
  }
12990
13037
  });
@@ -13135,7 +13182,7 @@ const PageCanvas = react.forwardRef(
13135
13182
  };
13136
13183
  const isMultiSelectModifier = (event) => !!((event == null ? void 0 : event.shiftKey) || (event == null ? void 0 : event.metaKey) || (event == null ? void 0 : event.ctrlKey));
13137
13184
  const pickChildInActiveSelectionAtPointer = (selection, event) => {
13138
- var _a2, _b2, _c, _d, _e;
13185
+ var _a2, _b2, _c2, _d, _e;
13139
13186
  try {
13140
13187
  const pointer = fabricCanvas.getPointer(event);
13141
13188
  const viewportPointer = (_a2 = fabricCanvas.getViewportPoint) == null ? void 0 : _a2.call(fabricCanvas, event);
@@ -13146,7 +13193,7 @@ const PageCanvas = react.forwardRef(
13146
13193
  const obj = members[i];
13147
13194
  const id = getObjectId(obj);
13148
13195
  if (!id || id === "__background__" || obj.visible === false) continue;
13149
- (_c = obj.setCoords) == null ? void 0 : _c.call(obj);
13196
+ (_c2 = obj.setCoords) == null ? void 0 : _c2.call(obj);
13150
13197
  const containsScene = typeof obj.containsPoint === "function" && obj.containsPoint(pointer);
13151
13198
  const containsViewport = !!(viewportPointer && typeof obj.containsPoint === "function" && obj.containsPoint(viewportPointer));
13152
13199
  if (containsScene || containsViewport) return obj;
@@ -13180,7 +13227,7 @@ const PageCanvas = react.forwardRef(
13180
13227
  };
13181
13228
  let pendingShiftMultiSelect = null;
13182
13229
  const applyShiftMultiSelect = (target, event, baselineActive = fabricCanvas.getActiveObject(), baselineObjects = fabricCanvas.getActiveObjects()) => {
13183
- var _a2, _b2, _c;
13230
+ var _a2, _b2, _c2;
13184
13231
  if (!target || !target.selectable) return false;
13185
13232
  const active = baselineActive;
13186
13233
  if (!active || ((_a2 = active.getActiveControl) == null ? void 0 : _a2.call(active))) return false;
@@ -13215,7 +13262,7 @@ const PageCanvas = react.forwardRef(
13215
13262
  });
13216
13263
  }
13217
13264
  (_b2 = event == null ? void 0 : event.preventDefault) == null ? void 0 : _b2.call(event);
13218
- (_c = event == null ? void 0 : event.stopPropagation) == null ? void 0 : _c.call(event);
13265
+ (_c2 = event == null ? void 0 : event.stopPropagation) == null ? void 0 : _c2.call(event);
13219
13266
  return true;
13220
13267
  };
13221
13268
  const markMixedLogicalSelection = (selection, groupIds, groupMemberIds) => {
@@ -13252,9 +13299,9 @@ const PageCanvas = react.forwardRef(
13252
13299
  return !!(((_a2 = o == null ? void 0 : o._ct) == null ? void 0 : _a2.isCropGroup) || (o == null ? void 0 : o.__cropGroup));
13253
13300
  };
13254
13301
  const promoteToCropGroup = (opt) => {
13255
- var _a2, _b2, _c, _d, _e, _f;
13302
+ var _a2, _b2, _c2, _d, _e, _f;
13256
13303
  const t = opt.target;
13257
- if (((_a2 = opt.e) == null ? void 0 : _a2.type) !== "mousedown" && ((_b2 = opt.e) == null ? void 0 : _b2.type) !== "pointerdown" && ((_c = opt.e) == null ? void 0 : _c.type) !== "touchstart") {
13304
+ if (((_a2 = opt.e) == null ? void 0 : _a2.type) !== "mousedown" && ((_b2 = opt.e) == null ? void 0 : _b2.type) !== "pointerdown" && ((_c2 = opt.e) == null ? void 0 : _c2.type) !== "touchstart") {
13258
13305
  if (t && isCropGroup2(t)) {
13259
13306
  fabricCanvas._hoveredTarget = t;
13260
13307
  } else if ((t == null ? void 0 : t.group) && isCropGroup2(t.group)) {
@@ -13424,14 +13471,14 @@ const PageCanvas = react.forwardRef(
13424
13471
  };
13425
13472
  fabricCanvas.__updateDrilledGroupOutline = updateDrilledGroupOutline;
13426
13473
  fabricCanvas.on("mouse:down:before", (opt) => {
13427
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
13474
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
13428
13475
  const activeBeforeMouseDown = fabricCanvas.getActiveObject();
13429
13476
  if (editLockRef.current) {
13430
13477
  const active = fabricCanvas.getActiveObject();
13431
13478
  if (active && (((_a2 = active._ct) == null ? void 0 : _a2.isCropGroup) || active.__cropGroup)) {
13432
13479
  opt.target = active;
13433
13480
  if (opt.e) {
13434
- (_c = (_b2 = opt.e).preventDefault) == null ? void 0 : _c.call(_b2);
13481
+ (_c2 = (_b2 = opt.e).preventDefault) == null ? void 0 : _c2.call(_b2);
13435
13482
  (_e = (_d = opt.e).stopPropagation) == null ? void 0 : _e.call(_d);
13436
13483
  }
13437
13484
  }
@@ -13687,7 +13734,7 @@ const PageCanvas = react.forwardRef(
13687
13734
  o.__lockScaleDuringCrop = false;
13688
13735
  });
13689
13736
  fabricCanvas.on("mouse:up", (e) => {
13690
- var _a2, _b2, _c;
13737
+ var _a2, _b2, _c2;
13691
13738
  clearTransforming();
13692
13739
  setGuides([]);
13693
13740
  setRotationLabel(null);
@@ -13781,7 +13828,7 @@ const PageCanvas = react.forwardRef(
13781
13828
  }
13782
13829
  }
13783
13830
  const activeObj = fabricCanvas.getActiveObject();
13784
- if (activeObj && (activeObj.__cropGroup || ((_c = activeObj._ct) == null ? void 0 : _c.isCropGroup))) {
13831
+ if (activeObj && (activeObj.__cropGroup || ((_c2 = activeObj._ct) == null ? void 0 : _c2.isCropGroup))) {
13785
13832
  activeObj.__lockScaleDuringCrop = false;
13786
13833
  if (activeObj.__cropDrag) {
13787
13834
  delete activeObj.__cropDrag;
@@ -13877,7 +13924,7 @@ const PageCanvas = react.forwardRef(
13877
13924
  fabricCanvas.on("selection:cleared", () => {
13878
13925
  });
13879
13926
  fabricCanvas.on("object:scaling", (e) => {
13880
- var _a2, _b2, _c, _d, _e, _f, _g, _h;
13927
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h;
13881
13928
  if (!isActiveRef.current) return;
13882
13929
  const t = e.target;
13883
13930
  if (t) lastResizeScaleTargetRef.current = t;
@@ -14053,7 +14100,7 @@ const PageCanvas = react.forwardRef(
14053
14100
  time: Math.round(performance.now()),
14054
14101
  corner,
14055
14102
  groupSelectionId: obj.__pixldocsGroupSelection,
14056
- currentTransformAction: (_c = fabricCanvas._currentTransform) == null ? void 0 : _c.action,
14103
+ currentTransformAction: (_c2 = fabricCanvas._currentTransform) == null ? void 0 : _c2.action,
14057
14104
  selection: summarizeFabricObjectForResizeDebug(obj),
14058
14105
  textChildren: obj.getObjects().filter((child) => child instanceof fabric__namespace.Textbox).map((child) => summarizeFabricObjectForResizeDebug(child))
14059
14106
  };
@@ -14571,7 +14618,7 @@ const PageCanvas = react.forwardRef(
14571
14618
  });
14572
14619
  let cropGroupSaveTimer = null;
14573
14620
  fabricCanvas.on("object:modified", (e) => {
14574
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j;
14621
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j;
14575
14622
  try {
14576
14623
  if (suppressObjectModifiedDuringInternalReselectRef.current) return;
14577
14624
  dragStarted = false;
@@ -14726,12 +14773,12 @@ const PageCanvas = react.forwardRef(
14726
14773
  clearTimeout(cropGroupSaveTimer);
14727
14774
  }
14728
14775
  cropGroupSaveTimer = setTimeout(() => {
14729
- var _a3, _b3, _c2;
14776
+ var _a3, _b3, _c3;
14730
14777
  const { updateElement: updateElement2 } = useEditorStore.getState();
14731
14778
  const img = ct._img;
14732
14779
  const zoom3 = ((_a3 = img == null ? void 0 : img._ct) == null ? void 0 : _a3.zoom) ?? 1;
14733
14780
  const panX = ((_b3 = img == null ? void 0 : img._ct) == null ? void 0 : _b3.panX) ?? 0.5;
14734
- const panY = ((_c2 = img == null ? void 0 : img._ct) == null ? void 0 : _c2.panY) ?? 0.5;
14781
+ const panY = ((_c3 = img == null ? void 0 : img._ct) == null ? void 0 : _c3.panY) ?? 0.5;
14735
14782
  const stateCrop = useEditorStore.getState();
14736
14783
  const pageCrop = stateCrop.canvas.pages.find((p) => p.id === pageId);
14737
14784
  const pageChildrenCrop = (pageCrop == null ? void 0 : pageCrop.children) ?? [];
@@ -14761,7 +14808,7 @@ const PageCanvas = react.forwardRef(
14761
14808
  }
14762
14809
  if (active && active instanceof fabric__namespace.Group && active.__docuforgeSectionGroup && getObjectId(active)) {
14763
14810
  const groupId = getObjectId(active);
14764
- const pageChildrenSec = ((_c = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _c.children) ?? [];
14811
+ const pageChildrenSec = ((_c2 = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _c2.children) ?? [];
14765
14812
  const modifiedTarget2 = e == null ? void 0 : e.target;
14766
14813
  const resizeScaleTarget = lastResizeScaleTargetRef.current;
14767
14814
  lastResizeScaleTargetRef.current = null;
@@ -15896,7 +15943,7 @@ const PageCanvas = react.forwardRef(
15896
15943
  visibilityUpdateInProgressRef.current = false;
15897
15944
  }
15898
15945
  doSyncRef.current = () => {
15899
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k;
15946
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k;
15900
15947
  const shouldSkipUpdates2 = syncLockedRef.current || editLockRef.current;
15901
15948
  const state = useEditorStore.getState();
15902
15949
  const elementsToSync = elements;
@@ -15940,7 +15987,7 @@ const PageCanvas = react.forwardRef(
15940
15987
  const activeObjId = activeObj ? getObjectId(activeObj) : null;
15941
15988
  const isTextBeingEdited = activeObjId && editingTextIdRef.current === activeObjId;
15942
15989
  const isMultiSelect = activeObj instanceof fabric__namespace.ActiveSelection;
15943
- if (activeObj && isMultiSelect && !(((_c = activeObj._ct) == null ? void 0 : _c.isCropGroup) || activeObj.__cropGroup) && !isTextBeingEdited) {
15990
+ if (activeObj && isMultiSelect && !(((_c2 = activeObj._ct) == null ? void 0 : _c2.isCropGroup) || activeObj.__cropGroup) && !isTextBeingEdited) {
15944
15991
  fc.discardActiveObject();
15945
15992
  }
15946
15993
  }
@@ -17098,7 +17145,7 @@ const PageCanvas = react.forwardRef(
17098
17145
  return unsub;
17099
17146
  }, []);
17100
17147
  const updateFabricObject = (obj, element, skipPositionUpdate = false) => {
17101
- var _a2, _b2, _c;
17148
+ var _a2, _b2, _c2;
17102
17149
  const fc = fabricRef.current;
17103
17150
  if (fc && isTransforming(fc)) {
17104
17151
  return;
@@ -17619,7 +17666,7 @@ const PageCanvas = react.forwardRef(
17619
17666
  } catch {
17620
17667
  }
17621
17668
  obj.dirty = true;
17622
- (_c = obj.setCoords) == null ? void 0 : _c.call(obj);
17669
+ (_c2 = obj.setCoords) == null ? void 0 : _c2.call(obj);
17623
17670
  obj.__lastTextBgShadowJson = JSON.stringify({
17624
17671
  c: element.textBgColor ?? null,
17625
17672
  g: element.textBgGradient ?? null,
@@ -17927,7 +17974,7 @@ const PageCanvas = react.forwardRef(
17927
17974
  return Math.max(min, Math.min(max, v));
17928
17975
  };
17929
17976
  const applyEdgeFadeFrameClipPath = (group, element, frameW, frameH, shape, rxRatio) => {
17930
- var _a2, _b2, _c;
17977
+ var _a2, _b2, _c2;
17931
17978
  const fadeElement = element;
17932
17979
  const fadeGroup = group;
17933
17980
  const inputKey = edgeFadeKey(fadeElement);
@@ -18062,10 +18109,10 @@ const PageCanvas = react.forwardRef(
18062
18109
  children.forEach((child) => {
18063
18110
  child.dirty = true;
18064
18111
  });
18065
- (_c = group.canvas) == null ? void 0 : _c.requestRenderAll();
18112
+ (_c2 = group.canvas) == null ? void 0 : _c2.requestRenderAll();
18066
18113
  };
18067
18114
  const loadImageAsync2 = async (element, placeholder, fc) => {
18068
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
18115
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
18069
18116
  const imageUrl = element.src || element.imageUrl;
18070
18117
  if (!imageUrl) return;
18071
18118
  const elementId = element.id;
@@ -18100,7 +18147,7 @@ const PageCanvas = react.forwardRef(
18100
18147
  const willUseCropGroupForFade = imageFitForFade !== "fill" || clipShapeForFade && clipShapeForFade !== "none";
18101
18148
  try {
18102
18149
  if (hasEdgeFade(element) && !willUseCropGroupForFade) {
18103
- const srcEl = (_c = img.getElement) == null ? void 0 : _c.call(img);
18150
+ const srcEl = (_c2 = img.getElement) == null ? void 0 : _c2.call(img);
18104
18151
  if (srcEl) {
18105
18152
  const baked = bakeEdgeFade(srcEl, element);
18106
18153
  img.setElement(baked);
@@ -18867,14 +18914,14 @@ function PreviewCanvas({
18867
18914
  onDynamicFieldClick,
18868
18915
  onReady
18869
18916
  }) {
18870
- var _a2, _b2, _c, _d, _e;
18917
+ var _a2, _b2, _c2, _d, _e;
18871
18918
  const canvasRef = react.useRef(null);
18872
18919
  const containerRef = react.useRef(null);
18873
18920
  const [containerWidth, setContainerWidth] = react.useState(0);
18874
18921
  const [hoveredFieldId, setHoveredFieldId] = react.useState(null);
18875
18922
  const page = (_a2 = config == null ? void 0 : config.pages) == null ? void 0 : _a2[pageIndex];
18876
18923
  const canvasWidth = ((_b2 = config == null ? void 0 : config.canvas) == null ? void 0 : _b2.width) || 612;
18877
- const canvasHeight = ((_c = config == null ? void 0 : config.canvas) == null ? void 0 : _c.height) || 792;
18924
+ const canvasHeight = ((_c2 = config == null ? void 0 : config.canvas) == null ? void 0 : _c2.height) || 792;
18878
18925
  const elementToFieldMap = react.useMemo(
18879
18926
  () => buildElementToFieldMap(config == null ? void 0 : config.dynamicFields),
18880
18927
  [config == null ? void 0 : config.dynamicFields]
@@ -18930,7 +18977,7 @@ function PreviewCanvas({
18930
18977
  };
18931
18978
  }, [(_d = page == null ? void 0 : page.settings) == null ? void 0 : _d.backgroundColor, (_e = page == null ? void 0 : page.settings) == null ? void 0 : _e.backgroundGradient]);
18932
18979
  const projectSettings = react.useMemo(() => {
18933
- var _a3, _b3, _c2;
18980
+ var _a3, _b3, _c3;
18934
18981
  const vars = ((_a3 = config.themeConfig) == null ? void 0 : _a3.variables) || {};
18935
18982
  return {
18936
18983
  showGrid: false,
@@ -18939,7 +18986,7 @@ function PreviewCanvas({
18939
18986
  snapToGuides: false,
18940
18987
  snapThreshold: 5,
18941
18988
  primaryColor: (_b3 = vars.primary) == null ? void 0 : _b3.value,
18942
- secondaryColor: (_c2 = vars.secondary) == null ? void 0 : _c2.value
18989
+ secondaryColor: (_c3 = vars.secondary) == null ? void 0 : _c3.value
18943
18990
  };
18944
18991
  }, [config.themeConfig]);
18945
18992
  const handleDynamicFieldClick = react.useCallback((elementId) => {
@@ -19090,7 +19137,7 @@ const PreviewCanvas$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.def
19090
19137
  PreviewCanvas
19091
19138
  }, Symbol.toStringTag, { value: "Module" }));
19092
19139
  function applyThemeToConfig(config, themeOverrides) {
19093
- var _a2, _b2, _c;
19140
+ var _a2, _b2, _c2;
19094
19141
  if (!themeOverrides || Object.keys(themeOverrides).length === 0) return config;
19095
19142
  const cloned = JSON.parse(JSON.stringify(config));
19096
19143
  if ((_a2 = cloned.themeConfig) == null ? void 0 : _a2.variables) {
@@ -19122,7 +19169,7 @@ function applyThemeToConfig(config, themeOverrides) {
19122
19169
  }
19123
19170
  }
19124
19171
  for (const page of cloned.pages || []) {
19125
- const bgBinding = (_c = page.themeBindings) == null ? void 0 : _c.backgroundColor;
19172
+ const bgBinding = (_c2 = page.themeBindings) == null ? void 0 : _c2.backgroundColor;
19126
19173
  if (bgBinding && varMap.has(bgBinding) && page.settings) {
19127
19174
  page.settings.backgroundColor = varMap.get(bgBinding);
19128
19175
  }
@@ -20041,7 +20088,7 @@ function getNestedRepeatableEntryCount(parentId, parentIndex, childId, formValue
20041
20088
  return Math.max(1, maxIndex);
20042
20089
  }
20043
20090
  function applyFormDataToConfig(config, mappings, formValues, repeatableSectionsFromSchema, repeatableEntryCounts, repeatableNestedEntryCounts, displayFormatMap, repeatablePagesFromSchema) {
20044
- var _a2, _b2, _c;
20091
+ var _a2, _b2, _c2;
20045
20092
  const cloned = JSON.parse(JSON.stringify(config));
20046
20093
  if (!cloned.pages) return cloned;
20047
20094
  const dynamicFields = cloned.dynamicFields;
@@ -20605,7 +20652,7 @@ function applyFormDataToConfig(config, mappings, formValues, repeatableSectionsF
20605
20652
  }
20606
20653
  }
20607
20654
  for (const page of pages) {
20608
- if ((_c = page.children) == null ? void 0 : _c.length) {
20655
+ if ((_c2 = page.children) == null ? void 0 : _c2.length) {
20609
20656
  page.children = applyStackReflowToPageTree(page.children, { preserveExplicitTextHeights: true });
20610
20657
  }
20611
20658
  }
@@ -20818,7 +20865,7 @@ function splitNestedForOverflow(flowStack, stayChildren, overflowChildren, overf
20818
20865
  return { stayChildren: newStay, overflowChildren: newOverflow };
20819
20866
  }
20820
20867
  function paginateSinglePage(sourcePage, pageOffsetIndex) {
20821
- var _a2, _b2, _c, _d, _e, _f;
20868
+ var _a2, _b2, _c2, _d, _e, _f;
20822
20869
  const contentTop = (_a2 = sourcePage.settings) == null ? void 0 : _a2.contentTop;
20823
20870
  const contentBottom = (_b2 = sourcePage.settings) == null ? void 0 : _b2.contentBottom;
20824
20871
  if (contentTop == null || contentBottom == null || contentBottom <= contentTop) {
@@ -20895,7 +20942,7 @@ function paginateSinglePage(sourcePage, pageOffsetIndex) {
20895
20942
  children: applyStackReflowToPageTree(updatedContChildren)
20896
20943
  };
20897
20944
  if (nextOverflowChildren.length > 0) {
20898
- const originalFlowStack = ((_c = currentOverflows[si]) == null ? void 0 : _c.flowStack) ?? contFlowStack;
20945
+ const originalFlowStack = ((_c2 = currentOverflows[si]) == null ? void 0 : _c2.flowStack) ?? contFlowStack;
20899
20946
  nextOverflows.push({ flowStack: originalFlowStack, overflowChildren: nextOverflowChildren });
20900
20947
  }
20901
20948
  }
@@ -23089,7 +23136,7 @@ async function resolveTemplateData(options) {
23089
23136
  };
23090
23137
  }
23091
23138
  async function resolveFromForm(options) {
23092
- var _a2, _b2, _c;
23139
+ var _a2, _b2, _c2;
23093
23140
  const { templateId, formSchemaId, sectionState, flatFormData: directFlatFormData, themeId, supabaseUrl, supabaseAnonKey, prefetched } = options;
23094
23141
  const hasSectionStateInput = !!sectionState && Object.keys(sectionState).length > 0;
23095
23142
  if (!formSchemaId && !hasSectionStateInput) {
@@ -23291,7 +23338,7 @@ async function resolveFromForm(options) {
23291
23338
  displayFormatMap.size > 0 ? displayFormatMap : void 0,
23292
23339
  buildRepeatablePagesInputForApply(formSchema, mergedSectionState)
23293
23340
  );
23294
- if ((_c = resolvedConfig.themeConfig) == null ? void 0 : _c.variables) {
23341
+ if ((_c2 = resolvedConfig.themeConfig) == null ? void 0 : _c2.variables) {
23295
23342
  const baseOverrides = {};
23296
23343
  for (const [key, def] of Object.entries(resolvedConfig.themeConfig.variables)) {
23297
23344
  baseOverrides[key] = def.value;
@@ -23326,12 +23373,12 @@ function themeBaseId(id) {
23326
23373
  return out;
23327
23374
  }
23328
23375
  function applyThemeVariantToConfig(config, themeConfig, themeId) {
23329
- var _a2, _b2, _c, _d;
23376
+ var _a2, _b2, _c2, _d;
23330
23377
  if (!themeConfig) return config;
23331
23378
  const variant = themeId && themeId !== "default" ? (_a2 = themeConfig.variants) == null ? void 0 : _a2.find((v) => v.id === themeId) : null;
23332
23379
  const shouldApplyDefaults = !variant && ((_b2 = themeConfig.properties) == null ? void 0 : _b2.length);
23333
23380
  if (!variant && !shouldApplyDefaults) return config;
23334
- if (!((_c = themeConfig.properties) == null ? void 0 : _c.length)) return config;
23381
+ if (!((_c2 = themeConfig.properties) == null ? void 0 : _c2.length)) return config;
23335
23382
  const result = JSON.parse(JSON.stringify(config));
23336
23383
  const cloneIdMap = config.__cloneIdMap || {};
23337
23384
  const pageElements = result.pages.map((page) => flattenAll(page.children || []));
@@ -24242,7 +24289,7 @@ function ensureFabricGradientDef(doc, obj, width, height) {
24242
24289
  return `url(#${id})`;
24243
24290
  }
24244
24291
  function warpTextboxSvgAlongPath(svg, obj) {
24245
- var _a2, _b2, _c, _d, _e;
24292
+ var _a2, _b2, _c2, _d, _e;
24246
24293
  const tp = obj == null ? void 0 : obj.textPath;
24247
24294
  if (!tp || !tp.preset || tp.preset === "none") return svg;
24248
24295
  if (tp.preset === "rise" || tp.preset === "angle") {
@@ -24346,7 +24393,7 @@ function warpTextboxSvgAlongPath(svg, obj) {
24346
24393
  for (const el of Array.from(doc.querySelectorAll("*"))) stripFilter(el);
24347
24394
  for (const filter of Array.from(doc.querySelectorAll("filter"))) {
24348
24395
  try {
24349
- (_c = filter.parentNode) == null ? void 0 : _c.removeChild(filter);
24396
+ (_c2 = filter.parentNode) == null ? void 0 : _c2.removeChild(filter);
24350
24397
  } catch {
24351
24398
  }
24352
24399
  }
@@ -24681,9 +24728,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24681
24728
  }
24682
24729
  return svgString;
24683
24730
  }
24684
- const resolvedPackageVersion = "0.5.373";
24731
+ const resolvedPackageVersion = "0.5.375";
24685
24732
  const PACKAGE_VERSION = resolvedPackageVersion;
24686
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.373";
24733
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.375";
24687
24734
  const roundParityValue = (value) => {
24688
24735
  if (typeof value !== "number") return value;
24689
24736
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -24860,12 +24907,12 @@ function installUnderlineFix(fab) {
24860
24907
  if (!TextProto || typeof TextProto._renderTextDecoration !== "function") return;
24861
24908
  const original = TextProto._renderTextDecoration;
24862
24909
  const measureLineTextWidth = (obj, ctx, lineIndex) => {
24863
- var _a3, _b2, _c, _d, _e, _f;
24910
+ var _a3, _b2, _c2, _d, _e, _f;
24864
24911
  const rawLine = (_a3 = obj._textLines) == null ? void 0 : _a3[lineIndex];
24865
24912
  const lineText = Array.isArray(rawLine) ? rawLine.join("") : String(rawLine ?? "");
24866
24913
  if (!lineText) return 0;
24867
24914
  const fontSize = Number(((_b2 = obj.getValueOfPropertyAt) == null ? void 0 : _b2.call(obj, lineIndex, 0, "fontSize")) ?? obj.fontSize ?? 0);
24868
- const fontStyle = String(((_c = obj.getValueOfPropertyAt) == null ? void 0 : _c.call(obj, lineIndex, 0, "fontStyle")) ?? obj.fontStyle ?? "normal");
24915
+ const fontStyle = String(((_c2 = obj.getValueOfPropertyAt) == null ? void 0 : _c2.call(obj, lineIndex, 0, "fontStyle")) ?? obj.fontStyle ?? "normal");
24869
24916
  const fontWeight = String(((_d = obj.getValueOfPropertyAt) == null ? void 0 : _d.call(obj, lineIndex, 0, "fontWeight")) ?? obj.fontWeight ?? "400");
24870
24917
  const fontFamily = String(((_e = obj.getValueOfPropertyAt) == null ? void 0 : _e.call(obj, lineIndex, 0, "fontFamily")) ?? obj.fontFamily ?? "sans-serif");
24871
24918
  const charSpacing = Number(((_f = obj.getValueOfPropertyAt) == null ? void 0 : _f.call(obj, lineIndex, 0, "charSpacing")) ?? obj.charSpacing ?? 0);
@@ -25497,7 +25544,7 @@ class PixldocsRenderer {
25497
25544
  await this.waitForCanvasScene(container, cloned, i);
25498
25545
  }
25499
25546
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25500
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-BrAC0-i_.cjs"));
25547
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-DsexMYcA.cjs"));
25501
25548
  const prepared = preparePagesForExport(
25502
25549
  cloned.pages,
25503
25550
  canvasWidth,
@@ -26181,7 +26228,7 @@ class PixldocsRenderer {
26181
26228
  logJsonLine("[canvas-renderer][fabric-text-parity]", { stage, textboxes: sample.length, sample });
26182
26229
  }
26183
26230
  async waitForStableTextMetrics(container, config, options = {}) {
26184
- var _a2, _b2, _c;
26231
+ var _a2, _b2, _c2;
26185
26232
  if (typeof document !== "undefined") {
26186
26233
  void ensureFontsForResolvedConfig(config);
26187
26234
  await this.waitForRelevantFonts(config);
@@ -26225,7 +26272,7 @@ class PixldocsRenderer {
26225
26272
  (_a2 = fabricInstance.calcOffset) == null ? void 0 : _a2.call(fabricInstance);
26226
26273
  (_b2 = fabricInstance.renderAll) == null ? void 0 : _b2.call(fabricInstance);
26227
26274
  await waitForPaint();
26228
- (_c = fabricInstance.renderAll) == null ? void 0 : _c.call(fabricInstance);
26275
+ (_c2 = fabricInstance.renderAll) == null ? void 0 : _c2.call(fabricInstance);
26229
26276
  await waitForPaint();
26230
26277
  this.logFabricTextParitySnapshot("after-stable-text-metrics", fabricInstance);
26231
26278
  }
@@ -26739,7 +26786,7 @@ function normalizeSvgExplicitColors(svg) {
26739
26786
  function bakeGroupOpacityIntoChildren(svg) {
26740
26787
  const DRAWABLE = /* @__PURE__ */ new Set(["path", "rect", "circle", "ellipse", "polygon", "polyline", "line", "text", "tspan"]);
26741
26788
  function walkAndBake(el, inheritedOpacity) {
26742
- var _a2, _b2, _c, _d;
26789
+ var _a2, _b2, _c2, _d;
26743
26790
  if (isInSvgDefinitionSubtree(el)) {
26744
26791
  for (let i = 0; i < el.children.length; i++) walkAndBake(el.children[i], 1);
26745
26792
  return;
@@ -26751,7 +26798,7 @@ function bakeGroupOpacityIntoChildren(svg) {
26751
26798
  const combinedOpacity = inheritedOpacity * ownOpacity;
26752
26799
  if (ownOpacity < 0.999 && tag !== "image") {
26753
26800
  el.removeAttribute("opacity");
26754
- if ((_c = el.style) == null ? void 0 : _c.opacity) el.style.removeProperty("opacity");
26801
+ if ((_c2 = el.style) == null ? void 0 : _c2.opacity) el.style.removeProperty("opacity");
26755
26802
  }
26756
26803
  if (DRAWABLE.has(tag) && combinedOpacity < 0.999) {
26757
26804
  multiplySvgOpacityAttr(el, "fill-opacity", combinedOpacity);
@@ -27548,7 +27595,7 @@ async function convertSvgTextDecorationsToLinesString(svgStr) {
27548
27595
  }
27549
27596
  }
27550
27597
  async function rasterizeShadowMarkers(svg) {
27551
- var _a2, _b2, _c, _d, _e, _f;
27598
+ var _a2, _b2, _c2, _d, _e, _f;
27552
27599
  if (typeof window === "undefined" || typeof document === "undefined") return;
27553
27600
  const markers = Array.from(svg.querySelectorAll("g.__pdShadowRaster"));
27554
27601
  if (markers.length === 0) return;
@@ -27580,7 +27627,7 @@ async function rasterizeShadowMarkers(svg) {
27580
27627
  );
27581
27628
  try {
27582
27629
  const fontSpecs = collectFontSpecsFromMarkup(innerXml);
27583
- if (fontSpecs.length > 0 && ((_c = document.fonts) == null ? void 0 : _c.load)) {
27630
+ if (fontSpecs.length > 0 && ((_c2 = document.fonts) == null ? void 0 : _c2.load)) {
27584
27631
  await Promise.all(
27585
27632
  fontSpecs.map(
27586
27633
  (spec) => document.fonts.load(spec).catch(() => void 0)
@@ -27817,7 +27864,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27817
27864
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27818
27865
  sanitizeSvgTreeForPdf(svgToDraw);
27819
27866
  try {
27820
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-BrAC0-i_.cjs"));
27867
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-DsexMYcA.cjs"));
27821
27868
  try {
27822
27869
  await logTextMeasurementDiagnostic(svgToDraw);
27823
27870
  } catch {
@@ -28214,4 +28261,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
28214
28261
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
28215
28262
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
28216
28263
  exports.warmTemplateFromForm = warmTemplateFromForm;
28217
- //# sourceMappingURL=index-CKSrApMp.cjs.map
28264
+ //# sourceMappingURL=index-DGMdAoOS.cjs.map