@lucablockltd/ultimate-packaging 1.5.0 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1086,6 +1086,203 @@ async function exportDimensionPdf(params) {
1086
1086
  const arrayBuffer = doc.output("arraybuffer");
1087
1087
  return new Blob([arrayBuffer], { type: "application/pdf" });
1088
1088
  }
1089
+
1090
+ // src/utils/readyToPrint.ts
1091
+ var DIM_PADDING2 = 15;
1092
+ var FOOTER_H2 = 40;
1093
+ var MARGIN2 = 5;
1094
+ function camelToCapitalize2(str) {
1095
+ return str.replace(/([A-Z])/g, " $1").replace(/^./, (s) => s.toUpperCase());
1096
+ }
1097
+ function hexToRgb2(hex) {
1098
+ return {
1099
+ r: parseInt(hex.slice(1, 3), 16),
1100
+ g: parseInt(hex.slice(3, 5), 16),
1101
+ b: parseInt(hex.slice(5, 7), 16)
1102
+ };
1103
+ }
1104
+ function drawPath(doc, d, ox, oy) {
1105
+ const commands = parseSvgPath(d);
1106
+ let startX = 0;
1107
+ let startY = 0;
1108
+ let curX = 0;
1109
+ let curY = 0;
1110
+ for (const cmd of commands) {
1111
+ switch (cmd.type) {
1112
+ case "M":
1113
+ curX = cmd.x + ox;
1114
+ curY = cmd.y + oy;
1115
+ startX = curX;
1116
+ startY = curY;
1117
+ break;
1118
+ case "L": {
1119
+ const nx = cmd.x + ox;
1120
+ const ny = cmd.y + oy;
1121
+ doc.line(curX, curY, nx, ny);
1122
+ curX = nx;
1123
+ curY = ny;
1124
+ break;
1125
+ }
1126
+ case "C": {
1127
+ const x0 = curX;
1128
+ const y0 = curY;
1129
+ const x1 = cmd.x1 + ox;
1130
+ const y1 = cmd.y1 + oy;
1131
+ const x2 = cmd.x2 + ox;
1132
+ const y2 = cmd.y2 + oy;
1133
+ const x3 = cmd.x + ox;
1134
+ const y3 = cmd.y + oy;
1135
+ const steps = 20;
1136
+ let prevX = x0;
1137
+ let prevY = y0;
1138
+ for (let si = 1; si <= steps; si++) {
1139
+ const t = si / steps;
1140
+ const mt = 1 - t;
1141
+ const nx = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;
1142
+ const ny = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;
1143
+ doc.line(prevX, prevY, nx, ny);
1144
+ prevX = nx;
1145
+ prevY = ny;
1146
+ }
1147
+ curX = x3;
1148
+ curY = y3;
1149
+ break;
1150
+ }
1151
+ case "Q": {
1152
+ const qx0 = curX;
1153
+ const qy0 = curY;
1154
+ const qx1 = cmd.x1 + ox;
1155
+ const qy1 = cmd.y1 + oy;
1156
+ const qx2 = cmd.x + ox;
1157
+ const qy2 = cmd.y + oy;
1158
+ const qSteps = 16;
1159
+ let qPrevX = qx0;
1160
+ let qPrevY = qy0;
1161
+ for (let si = 1; si <= qSteps; si++) {
1162
+ const t = si / qSteps;
1163
+ const mt = 1 - t;
1164
+ const nx = mt * mt * qx0 + 2 * mt * t * qx1 + t * t * qx2;
1165
+ const ny = mt * mt * qy0 + 2 * mt * t * qy1 + t * t * qy2;
1166
+ doc.line(qPrevX, qPrevY, nx, ny);
1167
+ qPrevX = nx;
1168
+ qPrevY = ny;
1169
+ }
1170
+ curX = qx2;
1171
+ curY = qy2;
1172
+ break;
1173
+ }
1174
+ case "Z":
1175
+ doc.line(curX, curY, startX, startY);
1176
+ curX = startX;
1177
+ curY = startY;
1178
+ break;
1179
+ }
1180
+ }
1181
+ }
1182
+ async function readyToPrintPdf(params) {
1183
+ const { modelId, dieline, dimensions, attributes, unit, factor, theme } = params;
1184
+ const { width: vw, height: vh } = dieline.viewBox;
1185
+ const contentW = vw + DIM_PADDING2 * 2;
1186
+ const contentH = vh + DIM_PADDING2 * 2;
1187
+ const pageW = contentW + MARGIN2 * 2;
1188
+ const pageH = contentH + MARGIN2 * 2 + FOOTER_H2;
1189
+ const { jsPDF } = await import('jspdf');
1190
+ const doc = new jsPDF({
1191
+ orientation: pageW > pageH ? "landscape" : "portrait",
1192
+ unit: "mm",
1193
+ format: [pageW, pageH]
1194
+ });
1195
+ const ox = MARGIN2 + DIM_PADDING2;
1196
+ const oy = MARGIN2 + DIM_PADDING2;
1197
+ const creaseRgb = hexToRgb2(theme.colorFoldLine);
1198
+ doc.setDrawColor(creaseRgb.r, creaseRgb.g, creaseRgb.b);
1199
+ doc.setLineWidth(0.3);
1200
+ for (const d of dieline.crease) {
1201
+ drawPath(doc, d, ox, oy);
1202
+ }
1203
+ const cutRgb = hexToRgb2(theme.colorDieLine);
1204
+ doc.setDrawColor(cutRgb.r, cutRgb.g, cutRgb.b);
1205
+ doc.setLineWidth(0.3);
1206
+ for (const d of dieline.cut) {
1207
+ drawPath(doc, d, ox, oy);
1208
+ }
1209
+ const tick = 1.5;
1210
+ for (const dim of dimensions) {
1211
+ if (dim.orientation === "horizontal") {
1212
+ const y = dim.y1 + dim.offset + oy;
1213
+ const x1 = dim.x1 + ox;
1214
+ const x2 = dim.x2 + ox;
1215
+ doc.setDrawColor(0, 0, 0);
1216
+ doc.setLineWidth(0.2);
1217
+ doc.line(x1, y, x2, y);
1218
+ doc.setLineWidth(0.3);
1219
+ doc.line(x1, y - tick, x1, y + tick);
1220
+ doc.line(x2, y - tick, x2, y + tick);
1221
+ const midX = (x1 + x2) / 2;
1222
+ doc.setFontSize(3.5 * 2.83);
1223
+ doc.setTextColor(0, 0, 0);
1224
+ doc.text(dim.label, midX, y - 1.5, { align: "center" });
1225
+ } else {
1226
+ const x = dim.x1 + dim.offset + ox;
1227
+ const y1 = dim.y1 + oy;
1228
+ const y2 = dim.y2 + oy;
1229
+ doc.setDrawColor(0, 0, 0);
1230
+ doc.setLineWidth(0.2);
1231
+ doc.line(x, y1, x, y2);
1232
+ doc.setLineWidth(0.3);
1233
+ doc.line(x - tick, y1, x + tick, y1);
1234
+ doc.line(x - tick, y2, x + tick, y2);
1235
+ const midY = (y1 + y2) / 2;
1236
+ doc.setFontSize(3.5 * 2.83);
1237
+ doc.setTextColor(0, 0, 0);
1238
+ const textX = x - 1.5;
1239
+ const tw = doc.getTextWidth(dim.label);
1240
+ doc.text(dim.label, textX, midY + tw / 2, { angle: 90 });
1241
+ }
1242
+ }
1243
+ const footerY = pageH - FOOTER_H2;
1244
+ const halfW = (pageW - MARGIN2 * 2) / 2;
1245
+ const centerX = MARGIN2 + halfW;
1246
+ doc.setDrawColor(180, 180, 180);
1247
+ doc.setLineWidth(0.3);
1248
+ doc.line(MARGIN2, footerY, pageW - MARGIN2, footerY);
1249
+ doc.line(centerX, footerY, centerX, pageH - MARGIN2);
1250
+ doc.setTextColor(0, 0, 0);
1251
+ doc.setFontSize(9);
1252
+ doc.text("Luca Block Co.,Ltd.", MARGIN2 + 3, footerY + 6);
1253
+ doc.text(
1254
+ `Cartons-Tuck end boxes-${modelId}`,
1255
+ pageW - MARGIN2 - 3,
1256
+ footerY + 6,
1257
+ { align: "right" }
1258
+ );
1259
+ const attrEntries = Object.entries(attributes);
1260
+ const col1X = MARGIN2 + 3;
1261
+ const col2X = MARGIN2 + 3 + halfW / 2;
1262
+ const attrStartY = footerY + 14;
1263
+ const lineH = 5;
1264
+ doc.setFontSize(7);
1265
+ const half = Math.ceil(attrEntries.length / 2);
1266
+ for (let i = 0; i < half; i++) {
1267
+ const [key, val] = attrEntries[i];
1268
+ doc.text(
1269
+ `${camelToCapitalize2(key)}: ${(val * factor).toFixed(1)} ${unit}`,
1270
+ col1X,
1271
+ attrStartY + i * lineH
1272
+ );
1273
+ const j = i + half;
1274
+ if (j < attrEntries.length) {
1275
+ const [key2, val2] = attrEntries[j];
1276
+ doc.text(
1277
+ `${camelToCapitalize2(key2)}: ${(val2 * factor).toFixed(1)} ${unit}`,
1278
+ col2X,
1279
+ attrStartY + i * lineH
1280
+ );
1281
+ }
1282
+ }
1283
+ const arrayBuffer = doc.output("arraybuffer");
1284
+ return new Blob([arrayBuffer], { type: "application/pdf" });
1285
+ }
1089
1286
  function DebugOverlay({ data, fontSize }) {
1090
1287
  const ptR = fontSize * 0.3;
1091
1288
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -1301,6 +1498,18 @@ var DIE_LINE_BECF_1010A = forwardRef(
1301
1498
  factor,
1302
1499
  theme
1303
1500
  });
1501
+ },
1502
+ readyToPrint: async () => {
1503
+ const dimData = generateDimensions(attributes, unit);
1504
+ return readyToPrintPdf({
1505
+ modelId: MODEL_ID,
1506
+ dieline,
1507
+ dimensions: dimData,
1508
+ attributes,
1509
+ unit,
1510
+ factor,
1511
+ theme
1512
+ });
1304
1513
  }
1305
1514
  }),
1306
1515
  [attributes, dieline, factor, unit, serializeSvg, theme]
@@ -1401,6 +1610,7 @@ var CANVAS_BECF_1010A = forwardRef(
1401
1610
  });
1402
1611
  },
1403
1612
  exportDimension: () => dieLineRef.current.exportDimension(),
1613
+ readyToPrint: () => dieLineRef.current.readyToPrint(),
1404
1614
  resetView: () => canvasRef.current?.resetView(),
1405
1615
  fitView: () => canvasRef.current?.fitView()
1406
1616
  }), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
@@ -1994,6 +2204,18 @@ var DIE_LINE_BECF_1030A = forwardRef(
1994
2204
  factor,
1995
2205
  theme
1996
2206
  });
2207
+ },
2208
+ readyToPrint: async () => {
2209
+ const dimData = generateDimensions2(attributes, unit);
2210
+ return readyToPrintPdf({
2211
+ modelId: MODEL_ID2,
2212
+ dieline,
2213
+ dimensions: dimData,
2214
+ attributes,
2215
+ unit,
2216
+ factor,
2217
+ theme
2218
+ });
1997
2219
  }
1998
2220
  }),
1999
2221
  [attributes, dieline, factor, unit, serializeSvg, theme]
@@ -2094,6 +2316,7 @@ var CANVAS_BECF_1030A = forwardRef(
2094
2316
  });
2095
2317
  },
2096
2318
  exportDimension: () => dieLineRef.current.exportDimension(),
2319
+ readyToPrint: () => dieLineRef.current.readyToPrint(),
2097
2320
  resetView: () => canvasRef.current?.resetView(),
2098
2321
  fitView: () => canvasRef.current?.fitView()
2099
2322
  }), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
@@ -2689,6 +2912,18 @@ var DIE_LINE_BECF_1040A = forwardRef(
2689
2912
  factor,
2690
2913
  theme
2691
2914
  });
2915
+ },
2916
+ readyToPrint: async () => {
2917
+ const dimData = generateDimensions3(attributes, unit);
2918
+ return readyToPrintPdf({
2919
+ modelId: MODEL_ID3,
2920
+ dieline,
2921
+ dimensions: dimData,
2922
+ attributes,
2923
+ unit,
2924
+ factor,
2925
+ theme
2926
+ });
2692
2927
  }
2693
2928
  }),
2694
2929
  [attributes, dieline, factor, unit, serializeSvg, theme]
@@ -2789,6 +3024,7 @@ var CANVAS_BECF_1040A = forwardRef(
2789
3024
  });
2790
3025
  },
2791
3026
  exportDimension: () => dieLineRef.current.exportDimension(),
3027
+ readyToPrint: () => dieLineRef.current.readyToPrint(),
2792
3028
  resetView: () => canvasRef.current?.resetView(),
2793
3029
  fitView: () => canvasRef.current?.fitView()
2794
3030
  }), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
@@ -3404,6 +3640,18 @@ var DIE_LINE_BECF_11D01 = forwardRef(
3404
3640
  factor,
3405
3641
  theme
3406
3642
  });
3643
+ },
3644
+ readyToPrint: async () => {
3645
+ const dimData = generateDimensions4(attributes, unit);
3646
+ return readyToPrintPdf({
3647
+ modelId: MODEL_ID4,
3648
+ dieline,
3649
+ dimensions: dimData,
3650
+ attributes,
3651
+ unit,
3652
+ factor,
3653
+ theme
3654
+ });
3407
3655
  }
3408
3656
  }),
3409
3657
  [attributes, dieline, factor, unit, serializeSvg, theme]
@@ -3500,6 +3748,7 @@ var CANVAS_BECF_11D01 = forwardRef(
3500
3748
  });
3501
3749
  },
3502
3750
  exportDimension: () => dieLineRef.current.exportDimension(),
3751
+ readyToPrint: () => dieLineRef.current.readyToPrint(),
3503
3752
  resetView: () => canvasRef.current?.resetView(),
3504
3753
  fitView: () => canvasRef.current?.fitView()
3505
3754
  }), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
@@ -3534,10 +3783,10 @@ var MODEL_BECF_11D01 = forwardRef(
3534
3783
  // src/components/dieline/bags-pillows/becf-12101/generate.ts
3535
3784
  var DIP = 15;
3536
3785
  var ROPE_R = 3;
3537
- var ROPE_Y = 20;
3538
- var D_MAX = 40;
3539
- function calcD(c, b) {
3540
- return Math.min(c - 2 - b / 2, D_MAX);
3786
+ var D_SMALL = 30;
3787
+ var D_LARGE = 40;
3788
+ function calcD(c) {
3789
+ return c < 300 ? D_SMALL : D_LARGE;
3541
3790
  }
3542
3791
  function calcKulak(b) {
3543
3792
  if (b <= 13) return b - 1;
@@ -3551,10 +3800,10 @@ function calcX(a) {
3551
3800
  }
3552
3801
  function getAutoCalcValues(attr) {
3553
3802
  const { length: A, width: B, height: C, glueArea } = attr;
3554
- const D = calcD(C, B);
3803
+ const D = calcD(C);
3555
3804
  const kulak = glueArea ?? calcKulak(B);
3556
3805
  const X = calcX(A);
3557
- return { d: D, kulak, dip: DIP, ropeR: ROPE_R, ropeY: ROPE_Y, ropeX: X };
3806
+ return { d: D, kulak, dip: DIP, ropeR: ROPE_R, ropeY: D / 2, ropeX: X };
3558
3807
  }
3559
3808
  function line5(x1, y1, x2, y2) {
3560
3809
  return `M${x1} ${y1} L${x2} ${y2}`;
@@ -3564,7 +3813,7 @@ function circlePath(cx, cy, r) {
3564
3813
  }
3565
3814
  function generateBecf12101(attr) {
3566
3815
  const { length: A, width: B, height: C, glueArea } = attr;
3567
- const D = calcD(C, B);
3816
+ const D = calcD(C);
3568
3817
  const kulak = glueArea ?? calcKulak(B);
3569
3818
  const X = calcX(A);
3570
3819
  const xFront = kulak;
@@ -3593,8 +3842,8 @@ function generateBecf12101(attr) {
3593
3842
  cut.push(line5(kulak + 2 * A + B - B / 2, yBottomFlap, kulak + 2 * A + B - B / 2, yEnd));
3594
3843
  const frontCx = kulak + A / 2;
3595
3844
  const backCx = kulak + A + B + A / 2;
3596
- const ropeTopY = yFoldTop - ROPE_Y;
3597
- const ropeBotY = yFoldTop + ROPE_Y;
3845
+ const ropeTopY = D / 2;
3846
+ const ropeBotY = yFoldTop + D / 2;
3598
3847
  cut.push(circlePath(frontCx - X / 2, ropeTopY, ROPE_R));
3599
3848
  cut.push(circlePath(frontCx - X / 2, ropeBotY, ROPE_R));
3600
3849
  cut.push(circlePath(frontCx + X / 2, ropeTopY, ROPE_R));
@@ -3621,7 +3870,7 @@ function generateBecf12101(attr) {
3621
3870
  }
3622
3871
  function generateBecf12101DebugSections(attr) {
3623
3872
  const { length: A, width: B, height: C, glueArea } = attr;
3624
- const D = calcD(C, B);
3873
+ const D = calcD(C);
3625
3874
  const kulak = glueArea ?? calcKulak(B);
3626
3875
  const X = calcX(A);
3627
3876
  const xFront = kulak;
@@ -3655,8 +3904,8 @@ function generateBecf12101DebugSections(attr) {
3655
3904
  crease.push(line5(xSide2Mid, yFoldBottomStart, xEnd, D + C - 2));
3656
3905
  const frontCx = kulak + A / 2;
3657
3906
  const backCx = kulak + A + B + A / 2;
3658
- const ropeTopY = yFoldTop - ROPE_Y;
3659
- const ropeBotY = yFoldTop + ROPE_Y;
3907
+ const ropeTopY = D / 2;
3908
+ const ropeBotY = yFoldTop + D / 2;
3660
3909
  let ci = 0;
3661
3910
  const sections = [
3662
3911
  {
@@ -3704,7 +3953,7 @@ function generateBecf12101DebugSections(attr) {
3704
3953
  }
3705
3954
  function generateOuterContour5(attr) {
3706
3955
  const { length: A, width: B, height: C, glueArea } = attr;
3707
- const D = calcD(C, B);
3956
+ const D = calcD(C);
3708
3957
  const kulak = glueArea ?? calcKulak(B);
3709
3958
  const totalWidth = kulak + 2 * A + 2 * B - 2;
3710
3959
  const totalHeight = D + C + B / 2 + DIP;
@@ -3762,7 +4011,7 @@ function contourToPath5(points) {
3762
4011
  }
3763
4012
  function generateDimensions5(attr, unit) {
3764
4013
  const { length: A, width: B, height: C, glueArea } = attr;
3765
- const D = calcD(C, B);
4014
+ const D = calcD(C);
3766
4015
  const kulak = glueArea ?? calcKulak(B);
3767
4016
  const factor = unit === "cm" ? 0.1 : unit === "in" ? 1 / 25.4 : 1;
3768
4017
  const suffix = unit;
@@ -3772,10 +4021,10 @@ function generateDimensions5(attr, unit) {
3772
4021
  const xBack = kulak + A + B;
3773
4022
  const yFoldTop = D;
3774
4023
  const yFoldBottom = D + C;
4024
+ const yBottomFlap = D + C + B / 2;
3775
4025
  const yEnd = D + C + B / 2 + DIP;
3776
4026
  const totalWidth = kulak + 2 * A + 2 * B - 2;
3777
4027
  const totalHeight = yEnd;
3778
- const bottomSection = B / 2 + DIP;
3779
4028
  return [
3780
4029
  // Overall dimensions (outside)
3781
4030
  {
@@ -3796,7 +4045,17 @@ function generateDimensions5(attr, unit) {
3796
4045
  orientation: "vertical",
3797
4046
  offset: -12
3798
4047
  },
3799
- // Height (C) — body area (centered on back panel)
4048
+ // Top flap (D)
4049
+ {
4050
+ x1: xBack + A * 0.6,
4051
+ y1: 0,
4052
+ x2: xBack + A * 0.6,
4053
+ y2: yFoldTop,
4054
+ label: fmt(D),
4055
+ orientation: "vertical",
4056
+ offset: -10
4057
+ },
4058
+ // Body height (h = C)
3800
4059
  {
3801
4060
  x1: xBack + A * 0.6,
3802
4061
  y1: yFoldTop,
@@ -3806,23 +4065,23 @@ function generateDimensions5(attr, unit) {
3806
4065
  orientation: "vertical",
3807
4066
  offset: -10
3808
4067
  },
3809
- // Top flap (D) (centered on back panel)
4068
+ // W-fold lower (B/2) yFoldBottom to yBottomFlap
3810
4069
  {
3811
4070
  x1: xBack + A * 0.6,
3812
- y1: 0,
4071
+ y1: yFoldBottom,
3813
4072
  x2: xBack + A * 0.6,
3814
- y2: yFoldTop,
3815
- label: fmt(D),
4073
+ y2: yBottomFlap,
4074
+ label: fmt(B / 2),
3816
4075
  orientation: "vertical",
3817
4076
  offset: -10
3818
4077
  },
3819
- // Bottom section (B/2 + _dip) (centered on back panel)
4078
+ // DIP bottom glue tab
3820
4079
  {
3821
4080
  x1: xBack + A * 0.6,
3822
- y1: yFoldBottom,
4081
+ y1: yBottomFlap,
3823
4082
  x2: xBack + A * 0.6,
3824
4083
  y2: yEnd,
3825
- label: fmt(bottomSection),
4084
+ label: fmt(DIP),
3826
4085
  orientation: "vertical",
3827
4086
  offset: -10
3828
4087
  },
@@ -4010,6 +4269,18 @@ var DIE_LINE_BECF_12101 = forwardRef(
4010
4269
  factor,
4011
4270
  theme
4012
4271
  });
4272
+ },
4273
+ readyToPrint: async () => {
4274
+ const dimData = generateDimensions5(attributes, unit);
4275
+ return readyToPrintPdf({
4276
+ modelId: MODEL_ID5,
4277
+ dieline,
4278
+ dimensions: dimData,
4279
+ attributes,
4280
+ unit,
4281
+ factor,
4282
+ theme
4283
+ });
4013
4284
  }
4014
4285
  };
4015
4286
  },
@@ -4107,6 +4378,7 @@ var CANVAS_BECF_12101 = forwardRef(
4107
4378
  });
4108
4379
  },
4109
4380
  exportDimension: () => dieLineRef.current.exportDimension(),
4381
+ readyToPrint: () => dieLineRef.current.readyToPrint(),
4110
4382
  resetView: () => canvasRef.current?.resetView(),
4111
4383
  fitView: () => canvasRef.current?.fitView()
4112
4384
  }), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
@@ -4139,14 +4411,14 @@ var MODEL_BECF_12101 = forwardRef(
4139
4411
  );
4140
4412
 
4141
4413
  // src/components/dieline/bags-pillows/becf-12109/generate.ts
4142
- var DIP2 = 13;
4414
+ var DIP2 = 15;
4143
4415
  var ROPE_R2 = 3;
4144
- var ROPE_Y2 = 20;
4145
- var D_MAX2 = 40;
4416
+ var D_SMALL2 = 30;
4417
+ var D_LARGE2 = 40;
4146
4418
  var NOTCH_X = 3;
4147
4419
  var NOTCH_Y = 5;
4148
- function calcD2(c, b) {
4149
- return Math.min(c - 2 - b / 2, D_MAX2);
4420
+ function calcD2(c) {
4421
+ return c < 300 ? D_SMALL2 : D_LARGE2;
4150
4422
  }
4151
4423
  function calcKulak2(b) {
4152
4424
  if (b <= 13) return b - 1;
@@ -4160,10 +4432,10 @@ function calcX2(a) {
4160
4432
  }
4161
4433
  function getAutoCalcValues2(attr) {
4162
4434
  const { length: A, width: B, height: C, glueArea } = attr;
4163
- const D = calcD2(C, B);
4435
+ const D = calcD2(C);
4164
4436
  const kulak = glueArea ?? calcKulak2(B);
4165
4437
  const X = calcX2(A);
4166
- return { d: D, kulak, dip: DIP2, ropeR: ROPE_R2, ropeY: ROPE_Y2, ropeX: X };
4438
+ return { d: D, kulak, dip: DIP2, ropeR: ROPE_R2, ropeY: D / 2, ropeX: X };
4167
4439
  }
4168
4440
  function line6(x1, y1, x2, y2) {
4169
4441
  return `M${x1} ${y1} L${x2} ${y2}`;
@@ -4173,7 +4445,7 @@ function circlePath2(cx, cy, r) {
4173
4445
  }
4174
4446
  function generateBecf12109(attr) {
4175
4447
  const { length: A, width: B, height: C, glueArea } = attr;
4176
- const D = calcD2(C, B);
4448
+ const D = calcD2(C);
4177
4449
  const kulak = glueArea ?? calcKulak2(B);
4178
4450
  const X = calcX2(A);
4179
4451
  const xFront = kulak;
@@ -4216,8 +4488,8 @@ function generateBecf12109(attr) {
4216
4488
  cut.push(line6(xSide2 + NOTCH_X, totalHeight, xEnd - NOTCH_X, totalHeight));
4217
4489
  const frontCx = kulak + A / 2;
4218
4490
  const backCx = kulak + A + B + A / 2;
4219
- const ropeTopY = yFoldTop - ROPE_Y2;
4220
- const ropeBotY = yFoldTop + ROPE_Y2;
4491
+ const ropeTopY = D / 2;
4492
+ const ropeBotY = yFoldTop + D / 2;
4221
4493
  cut.push(circlePath2(frontCx - X / 2, ropeTopY, ROPE_R2));
4222
4494
  cut.push(circlePath2(frontCx - X / 2, ropeBotY, ROPE_R2));
4223
4495
  cut.push(circlePath2(frontCx + X / 2, ropeTopY, ROPE_R2));
@@ -4243,7 +4515,7 @@ function generateBecf12109(attr) {
4243
4515
  }
4244
4516
  function generateBecf12109DebugSections(attr) {
4245
4517
  const { length: A, width: B, height: C, glueArea } = attr;
4246
- const D = calcD2(C, B);
4518
+ const D = calcD2(C);
4247
4519
  const kulak = glueArea ?? calcKulak2(B);
4248
4520
  const X = calcX2(A);
4249
4521
  const xFront = kulak;
@@ -4276,8 +4548,8 @@ function generateBecf12109DebugSections(attr) {
4276
4548
  crease.push(line6(xSide2Mid, yFoldBottomStart, xEnd, D + C - 2));
4277
4549
  const frontCx = kulak + A / 2;
4278
4550
  const backCx = kulak + A + B + A / 2;
4279
- const ropeTopY = yFoldTop - ROPE_Y2;
4280
- const ropeBotY = yFoldTop + ROPE_Y2;
4551
+ const ropeTopY = D / 2;
4552
+ const ropeBotY = yFoldTop + D / 2;
4281
4553
  const boundaries = [xFront, xSide1, xBack, xSide2, xEnd];
4282
4554
  const vNotchPaths = [];
4283
4555
  for (let i = 0; i < boundaries.length; i++) {
@@ -4351,7 +4623,7 @@ function generateBecf12109DebugSections(attr) {
4351
4623
  }
4352
4624
  function generateOuterContour6(attr) {
4353
4625
  const { length: A, width: B, height: C, glueArea } = attr;
4354
- const D = calcD2(C, B);
4626
+ const D = calcD2(C);
4355
4627
  const kulak = glueArea ?? calcKulak2(B);
4356
4628
  const xFront = kulak;
4357
4629
  const xSide1 = kulak + A;
@@ -4444,7 +4716,7 @@ function contourToPath6(points) {
4444
4716
  }
4445
4717
  function generateDimensions6(attr, unit) {
4446
4718
  const { length: A, width: B, height: C, glueArea } = attr;
4447
- const D = calcD2(C, B);
4719
+ const D = calcD2(C);
4448
4720
  const kulak = glueArea ?? calcKulak2(B);
4449
4721
  const factor = unit === "cm" ? 0.1 : unit === "in" ? 1 / 25.4 : 1;
4450
4722
  const suffix = unit;
@@ -4454,10 +4726,10 @@ function generateDimensions6(attr, unit) {
4454
4726
  const xBack = kulak + A + B;
4455
4727
  const yFoldTop = D;
4456
4728
  const yFoldBottom = D + C;
4729
+ const yBottomFlap = D + C + B / 2;
4457
4730
  const yEnd = D + C + B / 2 + DIP2;
4458
4731
  const totalWidth = kulak + 2 * A + 2 * B - 2;
4459
4732
  const totalHeight = yEnd;
4460
- const bottomSection = B / 2 + DIP2;
4461
4733
  return [
4462
4734
  // Overall dimensions (outside)
4463
4735
  {
@@ -4478,7 +4750,17 @@ function generateDimensions6(attr, unit) {
4478
4750
  orientation: "vertical",
4479
4751
  offset: -12
4480
4752
  },
4481
- // Height (C) — body area (centered on back panel)
4753
+ // Top flap (D)
4754
+ {
4755
+ x1: xBack + A * 0.6,
4756
+ y1: 0,
4757
+ x2: xBack + A * 0.6,
4758
+ y2: yFoldTop,
4759
+ label: fmt(D),
4760
+ orientation: "vertical",
4761
+ offset: -10
4762
+ },
4763
+ // Body height (h = C)
4482
4764
  {
4483
4765
  x1: xBack + A * 0.6,
4484
4766
  y1: yFoldTop,
@@ -4488,23 +4770,23 @@ function generateDimensions6(attr, unit) {
4488
4770
  orientation: "vertical",
4489
4771
  offset: -10
4490
4772
  },
4491
- // Top flap (D) (centered on back panel)
4773
+ // W-fold lower (B/2) yFoldBottom to yBottomFlap
4492
4774
  {
4493
4775
  x1: xBack + A * 0.6,
4494
- y1: 0,
4776
+ y1: yFoldBottom,
4495
4777
  x2: xBack + A * 0.6,
4496
- y2: yFoldTop,
4497
- label: fmt(D),
4778
+ y2: yBottomFlap,
4779
+ label: fmt(B / 2),
4498
4780
  orientation: "vertical",
4499
4781
  offset: -10
4500
4782
  },
4501
- // Bottom section (B/2 + _dip) (centered on back panel)
4783
+ // DIP bottom glue tab
4502
4784
  {
4503
4785
  x1: xBack + A * 0.6,
4504
- y1: yFoldBottom,
4786
+ y1: yBottomFlap,
4505
4787
  x2: xBack + A * 0.6,
4506
4788
  y2: yEnd,
4507
- label: fmt(bottomSection),
4789
+ label: fmt(DIP2),
4508
4790
  orientation: "vertical",
4509
4791
  offset: -10
4510
4792
  },
@@ -4692,6 +4974,18 @@ var DIE_LINE_BECF_12109 = forwardRef(
4692
4974
  factor,
4693
4975
  theme
4694
4976
  });
4977
+ },
4978
+ readyToPrint: async () => {
4979
+ const dimData = generateDimensions6(attributes, unit);
4980
+ return readyToPrintPdf({
4981
+ modelId: MODEL_ID6,
4982
+ dieline,
4983
+ dimensions: dimData,
4984
+ attributes,
4985
+ unit,
4986
+ factor,
4987
+ theme
4988
+ });
4695
4989
  }
4696
4990
  };
4697
4991
  },
@@ -4789,6 +5083,7 @@ var CANVAS_BECF_12109 = forwardRef(
4789
5083
  });
4790
5084
  },
4791
5085
  exportDimension: () => dieLineRef.current.exportDimension(),
5086
+ readyToPrint: () => dieLineRef.current.readyToPrint(),
4792
5087
  resetView: () => canvasRef.current?.resetView(),
4793
5088
  fitView: () => canvasRef.current?.fitView()
4794
5089
  }), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
@@ -4825,9 +5120,9 @@ var DIP3 = 15;
4825
5120
  var RIBBON_HALF_W = 9;
4826
5121
  var RIBBON_DX = 2;
4827
5122
  var RIBBON_DY = 2;
4828
- var D_MAX3 = 40;
5123
+ var D_MAX = 40;
4829
5124
  function calcD3(c, b) {
4830
- return Math.min(c - 2 - b / 2, D_MAX3);
5125
+ return Math.min(c - 2 - b / 2, D_MAX);
4831
5126
  }
4832
5127
  function calcKulak3(b) {
4833
5128
  if (b <= 13) return b - 1;
@@ -5302,6 +5597,18 @@ var DIE_LINE_BECF_C_12101 = forwardRef(
5302
5597
  factor,
5303
5598
  theme
5304
5599
  });
5600
+ },
5601
+ readyToPrint: async () => {
5602
+ const dimData = generateDimensions7(attributes, unit);
5603
+ return readyToPrintPdf({
5604
+ modelId: MODEL_ID7,
5605
+ dieline,
5606
+ dimensions: dimData,
5607
+ attributes,
5608
+ unit,
5609
+ factor,
5610
+ theme
5611
+ });
5305
5612
  }
5306
5613
  };
5307
5614
  },
@@ -5399,6 +5706,7 @@ var CANVAS_BECF_C_12101 = forwardRef(
5399
5706
  });
5400
5707
  },
5401
5708
  exportDimension: () => dieLineRef.current.exportDimension(),
5709
+ readyToPrint: () => dieLineRef.current.readyToPrint(),
5402
5710
  resetView: () => canvasRef.current?.resetView(),
5403
5711
  fitView: () => canvasRef.current?.fitView()
5404
5712
  }), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
@@ -5435,11 +5743,11 @@ var DIP4 = 13;
5435
5743
  var RIBBON_HALF_W2 = 9;
5436
5744
  var RIBBON_DX2 = 2;
5437
5745
  var RIBBON_DY2 = 2;
5438
- var D_MAX4 = 40;
5746
+ var D_MAX2 = 40;
5439
5747
  var NOTCH_X2 = 3;
5440
5748
  var NOTCH_Y2 = 5;
5441
5749
  function calcD4(c, b) {
5442
- return Math.min(c - 2 - b / 2, D_MAX4);
5750
+ return Math.min(c - 2 - b / 2, D_MAX2);
5443
5751
  }
5444
5752
  function calcKulak4(b) {
5445
5753
  if (b <= 13) return b - 1;
@@ -6002,6 +6310,18 @@ var DIE_LINE_BECF_C_12109 = forwardRef(
6002
6310
  factor,
6003
6311
  theme
6004
6312
  });
6313
+ },
6314
+ readyToPrint: async () => {
6315
+ const dimData = generateDimensions8(attributes, unit);
6316
+ return readyToPrintPdf({
6317
+ modelId: MODEL_ID8,
6318
+ dieline,
6319
+ dimensions: dimData,
6320
+ attributes,
6321
+ unit,
6322
+ factor,
6323
+ theme
6324
+ });
6005
6325
  }
6006
6326
  };
6007
6327
  },
@@ -6099,6 +6419,7 @@ var CANVAS_BECF_C_12109 = forwardRef(
6099
6419
  });
6100
6420
  },
6101
6421
  exportDimension: () => dieLineRef.current.exportDimension(),
6422
+ readyToPrint: () => dieLineRef.current.readyToPrint(),
6102
6423
  resetView: () => canvasRef.current?.resetView(),
6103
6424
  fitView: () => canvasRef.current?.fitView()
6104
6425
  }), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
@@ -6478,6 +6799,10 @@ var DIE_LINE_BECF_B_12101 = forwardRef(
6478
6799
  exportDimension: async () => {
6479
6800
  const dimData = generateDimensions9(attributes, unit);
6480
6801
  return exportDimensionPdf({ modelId: MODEL_ID9, dieline, dimensions: dimData, attributes, unit, factor, theme });
6802
+ },
6803
+ readyToPrint: async () => {
6804
+ const dimData = generateDimensions9(attributes, unit);
6805
+ return readyToPrintPdf({ modelId: MODEL_ID9, dieline, dimensions: dimData, attributes, unit, factor, theme });
6481
6806
  }
6482
6807
  };
6483
6808
  }, [attributes, dieline, factor, unit, serializeSvg, theme]);
@@ -6544,6 +6869,7 @@ var CANVAS_BECF_B_12101 = forwardRef(
6544
6869
  });
6545
6870
  },
6546
6871
  exportDimension: () => dieLineRef.current.exportDimension(),
6872
+ readyToPrint: () => dieLineRef.current.readyToPrint(),
6547
6873
  resetView: () => canvasRef.current?.resetView(),
6548
6874
  fitView: () => canvasRef.current?.fitView()
6549
6875
  }), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
@@ -7003,6 +7329,10 @@ var DIE_LINE_BECF_B_12109 = forwardRef(
7003
7329
  exportDimension: async () => {
7004
7330
  const dimData = generateDimensions10(attributes, unit);
7005
7331
  return exportDimensionPdf({ modelId: MODEL_ID10, dieline, dimensions: dimData, attributes, unit, factor, theme });
7332
+ },
7333
+ readyToPrint: async () => {
7334
+ const dimData = generateDimensions10(attributes, unit);
7335
+ return readyToPrintPdf({ modelId: MODEL_ID10, dieline, dimensions: dimData, attributes, unit, factor, theme });
7006
7336
  }
7007
7337
  };
7008
7338
  }, [attributes, dieline, factor, unit, serializeSvg, theme]);
@@ -7069,6 +7399,7 @@ var CANVAS_BECF_B_12109 = forwardRef(
7069
7399
  });
7070
7400
  },
7071
7401
  exportDimension: () => dieLineRef.current.exportDimension(),
7402
+ readyToPrint: () => dieLineRef.current.readyToPrint(),
7072
7403
  resetView: () => canvasRef.current?.resetView(),
7073
7404
  fitView: () => canvasRef.current?.fitView()
7074
7405
  }), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
@@ -7751,6 +8082,18 @@ var DIE_LINE_BECF_10A0A = forwardRef(
7751
8082
  factor,
7752
8083
  theme
7753
8084
  });
8085
+ },
8086
+ readyToPrint: async () => {
8087
+ const dimData = generateDimensions11(attributes, unit);
8088
+ return readyToPrintPdf({
8089
+ modelId: MODEL_ID11,
8090
+ dieline,
8091
+ dimensions: dimData,
8092
+ attributes,
8093
+ unit,
8094
+ factor,
8095
+ theme
8096
+ });
7754
8097
  }
7755
8098
  };
7756
8099
  }, [attributes, dieline, factor, unit, serializeSvg, theme]);
@@ -7919,6 +8262,7 @@ var CANVAS_BECF_10A0A = forwardRef((props, ref) => {
7919
8262
  });
7920
8263
  },
7921
8264
  exportDimension: () => dieLineRef.current.exportDimension(),
8265
+ readyToPrint: () => dieLineRef.current.readyToPrint(),
7922
8266
  resetView: () => canvasRef.current?.resetView(),
7923
8267
  fitView: () => canvasRef.current?.fitView()
7924
8268
  }),
@@ -11273,12 +11617,12 @@ var AUTO_LAYOUT = forwardRef(
11273
11617
  });
11274
11618
  }
11275
11619
  if (pdfGriper > 0) {
11276
- const hexToRgb2 = (hex) => ({
11620
+ const hexToRgb3 = (hex) => ({
11277
11621
  r: parseInt(hex.slice(1, 3), 16),
11278
11622
  g: parseInt(hex.slice(3, 5), 16),
11279
11623
  b: parseInt(hex.slice(5, 7), 16)
11280
11624
  });
11281
- const gc = hexToRgb2(theme.colorGriper);
11625
+ const gc = hexToRgb3(theme.colorGriper);
11282
11626
  doc.setFillColor(gc.r, gc.g, gc.b);
11283
11627
  const depth = pdfGriper;
11284
11628
  switch (gripperSide) {
@@ -11301,7 +11645,7 @@ var AUTO_LAYOUT = forwardRef(
11301
11645
  const totalMarks = (ARROW_COLORS_HEX.length - 1) * ARROW_SPACING2;
11302
11646
  const isHoriz = gripperSide === "top" || gripperSide === "bottom";
11303
11647
  ARROW_COLORS_HEX.forEach((hex, idx) => {
11304
- const ac = hexToRgb2(hex);
11648
+ const ac = hexToRgb3(hex);
11305
11649
  doc.setFillColor(ac.r, ac.g, ac.b);
11306
11650
  if (isHoriz) {
11307
11651
  const cx = (pw - totalMarks) / 2 + idx * ARROW_SPACING2;
@@ -11769,7 +12113,7 @@ var BECF_12101_DEFAULT_ATTRIBUTES = {
11769
12113
  length: 100,
11770
12114
  width: 50,
11771
12115
  height: 150,
11772
- glueArea: 13
12116
+ glueArea: 15
11773
12117
  };
11774
12118
 
11775
12119
  // src/statics/bags-pillows/becf-12109/DEFAULT_ATTRIBUTES.ts
@@ -11777,7 +12121,7 @@ var BECF_12109_DEFAULT_ATTRIBUTES = {
11777
12121
  length: 100,
11778
12122
  width: 50,
11779
12123
  height: 150,
11780
- glueArea: 13
12124
+ glueArea: 15
11781
12125
  };
11782
12126
 
11783
12127
  // src/statics/bags-pillows/becf-c-12101/DEFAULT_ATTRIBUTES.ts
@@ -11785,7 +12129,7 @@ var BECF_C_12101_DEFAULT_ATTRIBUTES = {
11785
12129
  length: 100,
11786
12130
  width: 50,
11787
12131
  height: 150,
11788
- glueArea: 13
12132
+ glueArea: 15
11789
12133
  };
11790
12134
 
11791
12135
  // src/statics/bags-pillows/becf-c-12109/DEFAULT_ATTRIBUTES.ts
@@ -11793,7 +12137,7 @@ var BECF_C_12109_DEFAULT_ATTRIBUTES = {
11793
12137
  length: 100,
11794
12138
  width: 50,
11795
12139
  height: 150,
11796
- glueArea: 13
12140
+ glueArea: 15
11797
12141
  };
11798
12142
 
11799
12143
  // src/statics/bags-pillows/becf-b-12101/DEFAULT_ATTRIBUTES.ts
@@ -11801,7 +12145,7 @@ var BECF_B_12101_DEFAULT_ATTRIBUTES = {
11801
12145
  length: 100,
11802
12146
  width: 50,
11803
12147
  height: 150,
11804
- glueArea: 13
12148
+ glueArea: 15
11805
12149
  };
11806
12150
 
11807
12151
  // src/statics/bags-pillows/becf-b-12109/DEFAULT_ATTRIBUTES.ts
@@ -11809,7 +12153,7 @@ var BECF_B_12109_DEFAULT_ATTRIBUTES = {
11809
12153
  length: 100,
11810
12154
  width: 50,
11811
12155
  height: 150,
11812
- glueArea: 13
12156
+ glueArea: 15
11813
12157
  };
11814
12158
 
11815
12159
  // src/statics/snap-lock-boxes/becf-10a0a/DEFAULT_ATTRIBUTES.ts
@@ -11817,7 +12161,7 @@ var BECF_10A0A_DEFAULT_ATTRIBUTES = {
11817
12161
  length: 100,
11818
12162
  width: 50,
11819
12163
  height: 150,
11820
- glueArea: 13
12164
+ glueArea: 15
11821
12165
  };
11822
12166
 
11823
12167
  // src/statics/modelList.ts