@anu3ev/fabric-image-editor 0.9.21 → 0.9.23

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 (2) hide show
  1. package/dist/main.js +469 -419
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -14099,9 +14099,36 @@ function lc({ rawScale: e, effectiveSize: t }) {
14099
14099
  return t <= 0 ? e : Math.max(1, Math.round(t * e)) / t;
14100
14100
  }
14101
14101
  //#endregion
14102
+ //#region src/editor/crop-manager/domain/crop-resize-mode.ts
14103
+ var uc = [
14104
+ "scale",
14105
+ "scaleX",
14106
+ "scaleY"
14107
+ ], dc = [
14108
+ "tl",
14109
+ "tr",
14110
+ "bl",
14111
+ "br",
14112
+ "ml",
14113
+ "mr",
14114
+ "mt",
14115
+ "mb"
14116
+ ];
14117
+ function fc({ target: e, shiftKey: t = !1 }) {
14118
+ let n = e, r = n.cropActiveResizePreserveAspectRatio;
14119
+ if (typeof r == "boolean") return r;
14120
+ let i = n.preserveAspectRatio ?? !0;
14121
+ return t ? !i : i;
14122
+ }
14123
+ function pc({ transform: e }) {
14124
+ if (!e) return !1;
14125
+ let { action: t, corner: n } = e;
14126
+ return !!(t && uc.includes(t) || n && dc.includes(n));
14127
+ }
14128
+ //#endregion
14102
14129
  //#region src/editor/snapping-manager/scaling.ts
14103
- var uc = 1e-6, dc = 1;
14104
- function fc({ transform: e }) {
14130
+ var mc = 1e-6, hc = 1;
14131
+ function gc({ transform: e }) {
14105
14132
  let { corner: t = "", action: n = "" } = e, r = t === "ml" || t === "mr" || n === "scaleX", i = t === "mt" || t === "mb" || n === "scaleY", a = t === "tl" || t === "tr" || t === "bl" || t === "br" || n === "scale";
14106
14133
  return {
14107
14134
  isCornerHandle: a,
@@ -14109,7 +14136,7 @@ function fc({ transform: e }) {
14109
14136
  shouldSnapY: i || a
14110
14137
  };
14111
14138
  }
14112
- function pc({ target: e, transform: t }) {
14139
+ function _c({ target: e, transform: t }) {
14113
14140
  let { originX: n, originY: r } = t, { originX: i = "left", originY: a = "top", scaleX: o = 1, scaleY: s = 1 } = e;
14114
14141
  return {
14115
14142
  originX: n ?? i,
@@ -14118,30 +14145,28 @@ function pc({ target: e, transform: t }) {
14118
14145
  scaleY: s
14119
14146
  };
14120
14147
  }
14121
- function mc({ target: e, event: t, isCornerHandle: n }) {
14122
- let r = e;
14123
- if (r.cropSource) {
14124
- let e = r.preserveAspectRatio ?? !0;
14125
- return t.e?.shiftKey ? !e : e;
14126
- }
14127
- return n;
14148
+ function vc({ target: e, event: t, isCornerHandle: n }) {
14149
+ return e.cropSource ? fc({
14150
+ target: e,
14151
+ shiftKey: t.e?.shiftKey
14152
+ }) : n;
14128
14153
  }
14129
- function hc({ bounds: e, corner: t, originX: n, originY: r, shouldSnapX: i, shouldSnapY: a, threshold: o, anchors: s }) {
14130
- let c = Nc({
14154
+ function yc({ bounds: e, corner: t, originX: n, originY: r, shouldSnapX: i, shouldSnapY: a, threshold: o, anchors: s }) {
14155
+ let c = Lc({
14131
14156
  bounds: e,
14132
14157
  corner: t,
14133
14158
  originX: n,
14134
14159
  shouldSnapX: i
14135
- }), l = Pc({
14160
+ }), l = Rc({
14136
14161
  bounds: e,
14137
14162
  corner: t,
14138
14163
  originY: r,
14139
14164
  shouldSnapY: a
14140
- }), u = Lc({
14165
+ }), u = Vc({
14141
14166
  anchors: s.vertical,
14142
14167
  candidates: c,
14143
14168
  threshold: o
14144
- }), d = Lc({
14169
+ }), d = Vc({
14145
14170
  anchors: s.horizontal,
14146
14171
  candidates: l,
14147
14172
  threshold: o
@@ -14151,13 +14176,13 @@ function hc({ bounds: e, corner: t, originX: n, originY: r, shouldSnapX: i, shou
14151
14176
  horizontalSnap: d
14152
14177
  };
14153
14178
  }
14154
- function gc(e) {
14155
- return e.shouldUseUniformScaleSnap ? vc(e) : Ac(e);
14179
+ function bc(e) {
14180
+ return e.shouldUseUniformScaleSnap ? Sc(e) : Pc(e);
14156
14181
  }
14157
- function _c({ target: e, bounds: t, originX: n, verticalAnchors: r, threshold: i }) {
14158
- let a = Lc({
14182
+ function xc({ target: e, bounds: t, originX: n, verticalAnchors: r, threshold: i }) {
14183
+ let a = Vc({
14159
14184
  anchors: r,
14160
- candidates: Nc({
14185
+ candidates: Lc({
14161
14186
  bounds: t,
14162
14187
  originX: n,
14163
14188
  shouldSnapX: !0
@@ -14165,13 +14190,13 @@ function _c({ target: e, bounds: t, originX: n, verticalAnchors: r, threshold: i
14165
14190
  threshold: i
14166
14191
  }), { guidePosition: o } = a;
14167
14192
  if (o === null) return null;
14168
- let s = Kc({
14193
+ let s = Xc({
14169
14194
  bounds: t,
14170
14195
  originX: n,
14171
14196
  snap: a
14172
14197
  });
14173
14198
  if (s === null) return null;
14174
- let c = Zc({
14199
+ let c = tl({
14175
14200
  target: e,
14176
14201
  boundsWidth: s
14177
14202
  });
@@ -14183,8 +14208,8 @@ function _c({ target: e, bounds: t, originX: n, verticalAnchors: r, threshold: i
14183
14208
  }
14184
14209
  };
14185
14210
  }
14186
- function vc({ target: e, bounds: t, originX: n, originY: r, scaleX: i, scaleY: a, originalScaleX: o, originalScaleY: s, verticalSnap: c, horizontalSnap: l }) {
14187
- let u = Rc({
14211
+ function Sc({ target: e, bounds: t, originX: n, originY: r, scaleX: i, scaleY: a, originalScaleX: o, originalScaleY: s, verticalSnap: c, horizontalSnap: l }) {
14212
+ let u = Hc({
14188
14213
  bounds: t,
14189
14214
  originX: n,
14190
14215
  originY: r,
@@ -14192,7 +14217,7 @@ function vc({ target: e, bounds: t, originX: n, originY: r, scaleX: i, scaleY: a
14192
14217
  horizontalSnap: l
14193
14218
  });
14194
14219
  if (!u) return null;
14195
- let { guide: d, scaleFactor: f, snapGuards: p } = u, m = yc({
14220
+ let { guide: d, scaleFactor: f, snapGuards: p } = u, m = Cc({
14196
14221
  target: e,
14197
14222
  bounds: t,
14198
14223
  originX: n,
@@ -14210,17 +14235,17 @@ function vc({ target: e, bounds: t, originX: n, originY: r, scaleX: i, scaleY: a
14210
14235
  nextScaleY: a * m
14211
14236
  };
14212
14237
  }
14213
- function yc({ target: e, bounds: t, originX: n, originY: r, scaleX: i, scaleY: a, originalScaleX: o, originalScaleY: s, snapGuards: c }) {
14214
- if (!bc({ target: e })) return null;
14215
- let l = xc({
14238
+ function Cc({ target: e, bounds: t, originX: n, originY: r, scaleX: i, scaleY: a, originalScaleX: o, originalScaleY: s, snapGuards: c }) {
14239
+ if (!wc({ target: e })) return null;
14240
+ let l = Tc({
14216
14241
  scaleX: i,
14217
14242
  scaleY: a,
14218
14243
  originalScaleX: o,
14219
14244
  originalScaleY: s,
14220
14245
  snapGuards: c
14221
14246
  });
14222
- return l === null || !Oc({
14223
- bounds: Cc({
14247
+ return l === null || !Mc({
14248
+ bounds: Dc({
14224
14249
  bounds: t,
14225
14250
  originX: n,
14226
14251
  originY: r,
@@ -14229,13 +14254,13 @@ function yc({ target: e, bounds: t, originX: n, originY: r, scaleX: i, scaleY: a
14229
14254
  snapGuards: c
14230
14255
  }) ? null : l;
14231
14256
  }
14232
- function bc({ target: e }) {
14257
+ function wc({ target: e }) {
14233
14258
  return !!e.cropSource;
14234
14259
  }
14235
- function xc({ scaleX: e, scaleY: t, originalScaleX: n, originalScaleY: r, snapGuards: i }) {
14260
+ function Tc({ scaleX: e, scaleY: t, originalScaleX: n, originalScaleY: r, snapGuards: i }) {
14236
14261
  let a = [];
14237
14262
  for (let o of i) {
14238
- let i = Sc({
14263
+ let i = Ec({
14239
14264
  snapGuard: o,
14240
14265
  scaleX: e,
14241
14266
  scaleY: t,
@@ -14247,19 +14272,19 @@ function xc({ scaleX: e, scaleY: t, originalScaleX: n, originalScaleY: r, snapGu
14247
14272
  }
14248
14273
  let [o] = a;
14249
14274
  if (o === void 0 || !Number.isFinite(o) || o <= 0) return null;
14250
- for (let e of a) if (Math.abs(e - o) > uc) return null;
14275
+ for (let e of a) if (Math.abs(e - o) > mc) return null;
14251
14276
  return o;
14252
14277
  }
14253
- function Sc({ snapGuard: e, scaleX: t, scaleY: n, originalScaleX: r, originalScaleY: i }) {
14278
+ function Ec({ snapGuard: e, scaleX: t, scaleY: n, originalScaleX: r, originalScaleY: i }) {
14254
14279
  let a = e.type === "vertical" ? t : n, o = e.type === "vertical" ? r : i;
14255
- return typeof o != "number" || !Number.isFinite(o) || !Number.isFinite(a) || Math.abs(a) <= uc ? null : o / a;
14280
+ return typeof o != "number" || !Number.isFinite(o) || !Number.isFinite(a) || Math.abs(a) <= mc ? null : o / a;
14256
14281
  }
14257
- function Cc({ bounds: e, originX: t, originY: n, scaleFactor: r }) {
14258
- let i = wc({
14282
+ function Dc({ bounds: e, originX: t, originY: n, scaleFactor: r }) {
14283
+ let i = Oc({
14259
14284
  bounds: e,
14260
14285
  originX: t,
14261
14286
  scaleFactor: r
14262
- }), a = Tc({
14287
+ }), a = kc({
14263
14288
  bounds: e,
14264
14289
  originY: n,
14265
14290
  scaleFactor: r
@@ -14271,8 +14296,8 @@ function Cc({ bounds: e, originX: t, originY: n, scaleFactor: r }) {
14271
14296
  centerY: a.top + (a.bottom - a.top) / 2
14272
14297
  };
14273
14298
  }
14274
- function wc({ bounds: e, originX: t, scaleFactor: n }) {
14275
- let { left: r, right: i, centerX: a } = e, o = (i - r) * n, s = Ec({ originX: t });
14299
+ function Oc({ bounds: e, originX: t, scaleFactor: n }) {
14300
+ let { left: r, right: i, centerX: a } = e, o = (i - r) * n, s = Ac({ originX: t });
14276
14301
  return s === "right" ? {
14277
14302
  left: i - o,
14278
14303
  right: i
@@ -14284,8 +14309,8 @@ function wc({ bounds: e, originX: t, scaleFactor: n }) {
14284
14309
  right: r + o
14285
14310
  };
14286
14311
  }
14287
- function Tc({ bounds: e, originY: t, scaleFactor: n }) {
14288
- let { top: r, bottom: i, centerY: a } = e, o = (i - r) * n, s = Dc({ originY: t });
14312
+ function kc({ bounds: e, originY: t, scaleFactor: n }) {
14313
+ let { top: r, bottom: i, centerY: a } = e, o = (i - r) * n, s = jc({ originY: t });
14289
14314
  return s === "bottom" ? {
14290
14315
  top: i - o,
14291
14316
  bottom: i
@@ -14297,25 +14322,25 @@ function Tc({ bounds: e, originY: t, scaleFactor: n }) {
14297
14322
  bottom: r + o
14298
14323
  };
14299
14324
  }
14300
- function Ec({ originX: e }) {
14325
+ function Ac({ originX: e }) {
14301
14326
  return e === "center" || e === "right" ? e : "left";
14302
14327
  }
14303
- function Dc({ originY: e }) {
14328
+ function jc({ originY: e }) {
14304
14329
  return e === "center" || e === "bottom" ? e : "top";
14305
14330
  }
14306
- function Oc({ bounds: e, snapGuards: t }) {
14307
- for (let n of t) if (kc({
14331
+ function Mc({ bounds: e, snapGuards: t }) {
14332
+ for (let n of t) if (Nc({
14308
14333
  bounds: e,
14309
14334
  snapGuard: n
14310
- }) > dc) return !1;
14335
+ }) > hc) return !1;
14311
14336
  return !0;
14312
14337
  }
14313
- function kc({ bounds: e, snapGuard: t }) {
14338
+ function Nc({ bounds: e, snapGuard: t }) {
14314
14339
  let { edge: n, position: r } = t;
14315
14340
  return Math.abs(n === "left" ? e.left - r : n === "right" ? e.right - r : n === "top" ? e.top - r : e.bottom - r);
14316
14341
  }
14317
- function Ac(e) {
14318
- let t = jc(e), n = Mc(e);
14342
+ function Pc(e) {
14343
+ let t = Fc(e), n = Ic(e);
14319
14344
  if (!t && !n) return null;
14320
14345
  let r = [], i = [], a = null, o = null;
14321
14346
  return t && (r.push(t.guide), i.push(t.snapGuard), a = t.nextScale), n && (r.push(n.guide), i.push(n.snapGuard), o = n.nextScale), {
@@ -14325,16 +14350,16 @@ function Ac(e) {
14325
14350
  nextScaleY: o
14326
14351
  };
14327
14352
  }
14328
- function jc({ target: e, bounds: t, originX: n, scaleX: r, scaleY: i, verticalSnap: a }) {
14353
+ function Fc({ target: e, bounds: t, originX: n, scaleX: r, scaleY: i, verticalSnap: a }) {
14329
14354
  let { guidePosition: o } = a;
14330
14355
  if (o === null) return null;
14331
- let s = Kc({
14356
+ let s = Xc({
14332
14357
  bounds: t,
14333
14358
  originX: n,
14334
14359
  snap: a
14335
14360
  });
14336
14361
  if (s === null) return null;
14337
- let { angle: c = 0 } = e, { width: l, height: u } = Jc({ target: e }), d = Yc({
14362
+ let { angle: c = 0 } = e, { width: l, height: u } = Qc({ target: e }), d = $c({
14338
14363
  desiredWidth: s,
14339
14364
  baseWidth: l,
14340
14365
  baseHeight: u,
@@ -14342,7 +14367,7 @@ function jc({ target: e, bounds: t, originX: n, scaleX: r, scaleY: i, verticalSn
14342
14367
  angle: c
14343
14368
  });
14344
14369
  if (d === null) return null;
14345
- let f = Hc({
14370
+ let f = Kc({
14346
14371
  type: "vertical",
14347
14372
  snap: a
14348
14373
  });
@@ -14355,16 +14380,16 @@ function jc({ target: e, bounds: t, originX: n, scaleX: r, scaleY: i, verticalSn
14355
14380
  }
14356
14381
  } : null;
14357
14382
  }
14358
- function Mc({ target: e, bounds: t, originY: n, scaleX: r, scaleY: i, horizontalSnap: a }) {
14383
+ function Ic({ target: e, bounds: t, originY: n, scaleX: r, scaleY: i, horizontalSnap: a }) {
14359
14384
  let { guidePosition: o } = a;
14360
14385
  if (o === null) return null;
14361
- let s = qc({
14386
+ let s = Zc({
14362
14387
  bounds: t,
14363
14388
  originY: n,
14364
14389
  snap: a
14365
14390
  });
14366
14391
  if (s === null) return null;
14367
- let { angle: c = 0 } = e, { width: l, height: u } = Jc({ target: e }), d = Xc({
14392
+ let { angle: c = 0 } = e, { width: l, height: u } = Qc({ target: e }), d = el({
14368
14393
  desiredHeight: s,
14369
14394
  baseWidth: l,
14370
14395
  baseHeight: u,
@@ -14372,7 +14397,7 @@ function Mc({ target: e, bounds: t, originY: n, scaleX: r, scaleY: i, horizontal
14372
14397
  angle: c
14373
14398
  });
14374
14399
  if (d === null) return null;
14375
- let f = Hc({
14400
+ let f = Kc({
14376
14401
  type: "horizontal",
14377
14402
  snap: a
14378
14403
  });
@@ -14385,12 +14410,12 @@ function Mc({ target: e, bounds: t, originY: n, scaleX: r, scaleY: i, horizontal
14385
14410
  }
14386
14411
  } : null;
14387
14412
  }
14388
- function Nc({ bounds: e, corner: t = "", originX: n, shouldSnapX: r }) {
14413
+ function Lc({ bounds: e, corner: t = "", originX: n, shouldSnapX: r }) {
14389
14414
  let i = [];
14390
14415
  if (!r) return i;
14391
14416
  let { left: a, right: o } = e, s = "left";
14392
14417
  (n === "center" || n === "right") && (s = n);
14393
- let c = Fc({ controlKey: t });
14418
+ let c = zc({ controlKey: t });
14394
14419
  return c && s !== "center" ? (i.push({
14395
14420
  edge: c,
14396
14421
  position: c === "left" ? a : o
@@ -14408,12 +14433,12 @@ function Nc({ bounds: e, corner: t = "", originX: n, shouldSnapX: r }) {
14408
14433
  position: o
14409
14434
  })), i);
14410
14435
  }
14411
- function Pc({ bounds: e, corner: t = "", originY: n, shouldSnapY: r }) {
14436
+ function Rc({ bounds: e, corner: t = "", originY: n, shouldSnapY: r }) {
14412
14437
  let i = [];
14413
14438
  if (!r) return i;
14414
14439
  let { top: a, bottom: o } = e, s = "top";
14415
14440
  (n === "center" || n === "bottom") && (s = n);
14416
- let c = Ic({ controlKey: t });
14441
+ let c = Bc({ controlKey: t });
14417
14442
  return c && s !== "center" ? (i.push({
14418
14443
  edge: c,
14419
14444
  position: c === "top" ? a : o
@@ -14431,13 +14456,13 @@ function Pc({ bounds: e, corner: t = "", originY: n, shouldSnapY: r }) {
14431
14456
  position: o
14432
14457
  })), i);
14433
14458
  }
14434
- function Fc({ controlKey: e }) {
14459
+ function zc({ controlKey: e }) {
14435
14460
  return e === "tl" || e === "bl" || e === "ml" ? "left" : e === "tr" || e === "br" || e === "mr" ? "right" : null;
14436
14461
  }
14437
- function Ic({ controlKey: e }) {
14462
+ function Bc({ controlKey: e }) {
14438
14463
  return e === "tl" || e === "tr" || e === "mt" ? "top" : e === "bl" || e === "br" || e === "mb" ? "bottom" : null;
14439
14464
  }
14440
- function Lc({ anchors: e, candidates: t, threshold: n }) {
14465
+ function Vc({ anchors: e, candidates: t, threshold: n }) {
14441
14466
  let r = 0, i = n + 1, a = null, o = null;
14442
14467
  for (let s of t) {
14443
14468
  let { position: t } = s;
@@ -14452,31 +14477,31 @@ function Lc({ anchors: e, candidates: t, threshold: n }) {
14452
14477
  candidate: o
14453
14478
  };
14454
14479
  }
14455
- function Rc({ bounds: e, originX: t, originY: n, verticalSnap: r, horizontalSnap: i }) {
14456
- let a = Uc({
14480
+ function Hc({ bounds: e, originX: t, originY: n, verticalSnap: r, horizontalSnap: i }) {
14481
+ let a = qc({
14457
14482
  bounds: e,
14458
14483
  originX: t,
14459
14484
  snap: r
14460
- }), o = Wc({
14485
+ }), o = Jc({
14461
14486
  bounds: e,
14462
14487
  originY: n,
14463
14488
  snap: i
14464
- }), s = Gc({
14489
+ }), s = Yc({
14465
14490
  scaleFactorX: a,
14466
14491
  scaleFactorY: o,
14467
14492
  verticalSnap: r,
14468
14493
  horizontalSnap: i
14469
14494
  }), c = null;
14470
- if (s === "x" && (c = zc({
14495
+ if (s === "x" && (c = Uc({
14471
14496
  type: "vertical",
14472
14497
  scaleFactor: a,
14473
14498
  snap: r
14474
- })), s === "y" && (c = zc({
14499
+ })), s === "y" && (c = Uc({
14475
14500
  type: "horizontal",
14476
14501
  scaleFactor: o,
14477
14502
  snap: i
14478
14503
  })), !c) return null;
14479
- let l = Bc({
14504
+ let l = Wc({
14480
14505
  scaleFactor: c.scaleFactor,
14481
14506
  scaleFactorX: a,
14482
14507
  scaleFactorY: o,
@@ -14489,10 +14514,10 @@ function Rc({ bounds: e, originX: t, originY: n, verticalSnap: r, horizontalSnap
14489
14514
  scaleFactor: c.scaleFactor
14490
14515
  };
14491
14516
  }
14492
- function zc({ type: e, scaleFactor: t, snap: n }) {
14517
+ function Uc({ type: e, scaleFactor: t, snap: n }) {
14493
14518
  let { guidePosition: r } = n;
14494
14519
  if (t === null || r === null) return null;
14495
- let i = Hc({
14520
+ let i = Kc({
14496
14521
  type: e,
14497
14522
  snap: n
14498
14523
  });
@@ -14505,15 +14530,15 @@ function zc({ type: e, scaleFactor: t, snap: n }) {
14505
14530
  }
14506
14531
  } : null;
14507
14532
  }
14508
- function Bc({ scaleFactor: e, scaleFactorX: t, scaleFactorY: n, verticalSnap: r, horizontalSnap: i }) {
14533
+ function Wc({ scaleFactor: e, scaleFactorX: t, scaleFactorY: n, verticalSnap: r, horizontalSnap: i }) {
14509
14534
  let a = [];
14510
- return Vc({
14535
+ return Gc({
14511
14536
  snapGuards: a,
14512
14537
  scaleFactor: e,
14513
14538
  axisScaleFactor: t,
14514
14539
  type: "vertical",
14515
14540
  snap: r
14516
- }), Vc({
14541
+ }), Gc({
14517
14542
  snapGuards: a,
14518
14543
  scaleFactor: e,
14519
14544
  axisScaleFactor: n,
@@ -14521,15 +14546,15 @@ function Bc({ scaleFactor: e, scaleFactorX: t, scaleFactorY: n, verticalSnap: r,
14521
14546
  snap: i
14522
14547
  }), a;
14523
14548
  }
14524
- function Vc({ snapGuards: e, scaleFactor: t, axisScaleFactor: n, type: r, snap: i }) {
14525
- if (n === null || Math.abs(n - t) > uc) return;
14526
- let a = Hc({
14549
+ function Gc({ snapGuards: e, scaleFactor: t, axisScaleFactor: n, type: r, snap: i }) {
14550
+ if (n === null || Math.abs(n - t) > mc) return;
14551
+ let a = Kc({
14527
14552
  type: r,
14528
14553
  snap: i
14529
14554
  });
14530
14555
  a && e.push(a);
14531
14556
  }
14532
- function Hc({ type: e, snap: t }) {
14557
+ function Kc({ type: e, snap: t }) {
14533
14558
  let { candidate: n, guidePosition: r } = t;
14534
14559
  return !n || r === null ? null : {
14535
14560
  type: e,
@@ -14537,10 +14562,10 @@ function Hc({ type: e, snap: t }) {
14537
14562
  position: r
14538
14563
  };
14539
14564
  }
14540
- function Uc({ bounds: e, originX: t, snap: n }) {
14565
+ function qc({ bounds: e, originX: t, snap: n }) {
14541
14566
  let { left: r, right: i } = e, a = i - r;
14542
14567
  if (n.guidePosition === null || a <= 0) return null;
14543
- let o = Kc({
14568
+ let o = Xc({
14544
14569
  bounds: e,
14545
14570
  originX: t,
14546
14571
  snap: n
@@ -14549,10 +14574,10 @@ function Uc({ bounds: e, originX: t, snap: n }) {
14549
14574
  let s = o / a;
14550
14575
  return !Number.isFinite(s) || s <= 0 ? null : s;
14551
14576
  }
14552
- function Wc({ bounds: e, originY: t, snap: n }) {
14577
+ function Jc({ bounds: e, originY: t, snap: n }) {
14553
14578
  let { top: r, bottom: i } = e, a = i - r;
14554
14579
  if (n.guidePosition === null || a <= 0) return null;
14555
- let o = qc({
14580
+ let o = Zc({
14556
14581
  bounds: e,
14557
14582
  originY: t,
14558
14583
  snap: n
@@ -14561,10 +14586,10 @@ function Wc({ bounds: e, originY: t, snap: n }) {
14561
14586
  let s = o / a;
14562
14587
  return !Number.isFinite(s) || s <= 0 ? null : s;
14563
14588
  }
14564
- function Gc({ scaleFactorX: e, scaleFactorY: t, verticalSnap: n, horizontalSnap: r }) {
14589
+ function Yc({ scaleFactorX: e, scaleFactorY: t, verticalSnap: n, horizontalSnap: r }) {
14565
14590
  return e !== null && t === null ? "x" : t !== null && e === null ? "y" : e === null || t === null ? null : Math.abs(n.delta) <= Math.abs(r.delta) ? "x" : "y";
14566
14591
  }
14567
- function Kc({ bounds: e, originX: t, snap: n }) {
14592
+ function Xc({ bounds: e, originX: t, snap: n }) {
14568
14593
  let { left: r, right: i, centerX: a } = e, { candidate: o, guidePosition: s } = n;
14569
14594
  if (!o || s === null) return null;
14570
14595
  let c = "left";
@@ -14572,7 +14597,7 @@ function Kc({ bounds: e, originX: t, snap: n }) {
14572
14597
  let { edge: l } = o, u = null;
14573
14598
  return c !== "center" && l === "left" && (u = i - s), c !== "center" && l === "right" && (u = s - r), c === "center" && l === "left" && (u = (a - s) * 2), c === "center" && l === "right" && (u = (s - a) * 2), u === null || !Number.isFinite(u) || u <= 0 ? null : u;
14574
14599
  }
14575
- function qc({ bounds: e, originY: t, snap: n }) {
14600
+ function Zc({ bounds: e, originY: t, snap: n }) {
14576
14601
  let { top: r, bottom: i, centerY: a } = e, { candidate: o, guidePosition: s } = n;
14577
14602
  if (!o || s === null) return null;
14578
14603
  let c = "top";
@@ -14580,7 +14605,7 @@ function qc({ bounds: e, originY: t, snap: n }) {
14580
14605
  let { edge: l } = o, u = null;
14581
14606
  return c !== "center" && l === "top" && (u = i - s), c !== "center" && l === "bottom" && (u = s - r), c === "center" && l === "top" && (u = (a - s) * 2), c === "center" && l === "bottom" && (u = (s - a) * 2), u === null || !Number.isFinite(u) || u <= 0 ? null : u;
14582
14607
  }
14583
- function Jc({ target: e }) {
14608
+ function Qc({ target: e }) {
14584
14609
  let { width: t = 0, height: n = 0 } = e, r = t, i = n;
14585
14610
  if (e instanceof v) {
14586
14611
  let { paddingTop: a = 0, paddingRight: o = 0, paddingBottom: s = 0, paddingLeft: c = 0, strokeWidth: l = 0 } = e;
@@ -14591,28 +14616,28 @@ function Jc({ target: e }) {
14591
14616
  height: i
14592
14617
  };
14593
14618
  }
14594
- function Yc({ desiredWidth: e, baseWidth: t, baseHeight: n, scaleY: r, angle: i }) {
14619
+ function $c({ desiredWidth: e, baseWidth: t, baseHeight: n, scaleY: r, angle: i }) {
14595
14620
  let a = i * Math.PI / 180, o = Math.abs(Math.cos(a)), s = Math.abs(Math.sin(a)), c = t * o, l = n * r * s;
14596
14621
  if (c <= 0) return null;
14597
14622
  let u = (e - l) / c;
14598
14623
  return !Number.isFinite(u) || u <= 0 ? null : u;
14599
14624
  }
14600
- function Xc({ desiredHeight: e, baseWidth: t, baseHeight: n, scaleX: r, angle: i }) {
14625
+ function el({ desiredHeight: e, baseWidth: t, baseHeight: n, scaleX: r, angle: i }) {
14601
14626
  let a = i * Math.PI / 180, o = Math.abs(Math.cos(a)), s = Math.abs(Math.sin(a)), c = n * o, l = t * r * s;
14602
14627
  if (c <= 0) return null;
14603
14628
  let u = (e - l) / c;
14604
14629
  return !Number.isFinite(u) || u <= 0 ? null : u;
14605
14630
  }
14606
- function Zc({ target: e, boundsWidth: t }) {
14631
+ function tl({ target: e, boundsWidth: t }) {
14607
14632
  let { paddingLeft: n = 0, paddingRight: r = 0, strokeWidth: i = 0 } = e, a = t - n - r - i;
14608
14633
  return !Number.isFinite(a) || a <= 0 ? null : Math.max(1, Math.round(a));
14609
14634
  }
14610
14635
  //#endregion
14611
14636
  //#region src/editor/snapping-manager/utils.ts
14612
- var Qc = ({ anchors: e, bounds: t }) => {
14637
+ var nl = ({ anchors: e, bounds: t }) => {
14613
14638
  let { left: n, right: r, centerX: i, top: a, bottom: o, centerY: s } = t;
14614
14639
  e.vertical.push(n, i, r), e.horizontal.push(a, s, o);
14615
- }, $c = ({ bounds: e, type: t, primaryStart: n, primaryEnd: r }) => {
14640
+ }, rl = ({ bounds: e, type: t, primaryStart: n, primaryEnd: r }) => {
14616
14641
  let i = [], a = n === "top" ? "left" : "top", o = r === "bottom" ? "right" : "bottom", s = [...e].sort((e, t) => e[n] - t[n]);
14617
14642
  for (let e = 0; e < s.length; e += 1) {
14618
14643
  let c = s[e], l = null, u = Infinity;
@@ -14633,33 +14658,33 @@ var Qc = ({ anchors: e, bounds: t }) => {
14633
14658
  });
14634
14659
  }
14635
14660
  return i;
14636
- }, el = ({ bounds: e }) => ({
14637
- vertical: $c({
14661
+ }, il = ({ bounds: e }) => ({
14662
+ vertical: rl({
14638
14663
  bounds: e,
14639
14664
  type: "vertical",
14640
14665
  primaryStart: "top",
14641
14666
  primaryEnd: "bottom"
14642
14667
  }),
14643
- horizontal: $c({
14668
+ horizontal: rl({
14644
14669
  bounds: e,
14645
14670
  type: "horizontal",
14646
14671
  primaryStart: "left",
14647
14672
  primaryEnd: "right"
14648
14673
  })
14649
- }), tl = [
14674
+ }), al = [
14650
14675
  "montage-area",
14651
14676
  "background",
14652
14677
  "interaction-blocker"
14653
- ], nl = ({ activeObject: t }) => {
14678
+ ], ol = ({ activeObject: t }) => {
14654
14679
  let n = /* @__PURE__ */ new Set();
14655
14680
  return t ? (n.add(t), t instanceof e && t.getObjects().forEach((e) => n.add(e)), n) : n;
14656
- }, rl = ({ object: e, excluded: t, ignoredIds: n = tl }) => {
14681
+ }, sl = ({ object: e, excluded: t, ignoredIds: n = al }) => {
14657
14682
  if (t.has(e)) return !0;
14658
14683
  let { visible: r = !0 } = e;
14659
14684
  if (!r) return !0;
14660
14685
  let { id: i } = e;
14661
14686
  return !!(i && n.includes(i));
14662
- }, il = class {
14687
+ }, cl = class {
14663
14688
  constructor({ editor: e }) {
14664
14689
  this.anchors = {
14665
14690
  vertical: [],
@@ -14767,7 +14792,7 @@ var Qc = ({ anchors: e, bounds: t }) => {
14767
14792
  target: t,
14768
14793
  transform: n
14769
14794
  })) return this._clearGuides(), null;
14770
- let { shouldSnapX: i, shouldSnapY: a, isCornerHandle: o } = fc({ transform: n });
14795
+ let { shouldSnapX: i, shouldSnapY: a, isCornerHandle: o } = gc({ transform: n });
14771
14796
  if (!i && !a) return this._finishObjectScalingWithoutSnap({
14772
14797
  target: t,
14773
14798
  transform: n,
@@ -14791,10 +14816,10 @@ var Qc = ({ anchors: e, bounds: t }) => {
14791
14816
  transform: r,
14792
14817
  canApplyPixelScalingStep: i
14793
14818
  }), null;
14794
- let l = 5 / (this.canvas.getZoom() || 1), { originX: u, originY: d, scaleX: f, scaleY: p } = pc({
14819
+ let l = 5 / (this.canvas.getZoom() || 1), { originX: u, originY: d, scaleX: f, scaleY: p } = _c({
14795
14820
  target: n,
14796
14821
  transform: r
14797
- }), m = hc({
14822
+ }), m = yc({
14798
14823
  bounds: c,
14799
14824
  corner: r.corner,
14800
14825
  originX: u,
@@ -14809,11 +14834,11 @@ var Qc = ({ anchors: e, bounds: t }) => {
14809
14834
  transform: r,
14810
14835
  canApplyPixelScalingStep: i
14811
14836
  }), null;
14812
- let h = mc({
14837
+ let h = vc({
14813
14838
  target: n,
14814
14839
  event: t,
14815
14840
  isCornerHandle: a
14816
- }), g = gc({
14841
+ }), g = bc({
14817
14842
  target: n,
14818
14843
  bounds: c,
14819
14844
  originX: u,
@@ -14983,7 +15008,7 @@ var Qc = ({ anchors: e, bounds: t }) => {
14983
15008
  this._clearGuides();
14984
15009
  return;
14985
15010
  }
14986
- let { canvas: c } = this, l = 5 / (c.getZoom() || 1), { originX: u, originY: d } = t, { originX: f = "left", originY: p = "top" } = e, m = u ?? f, h = d ?? p, g = _c({
15011
+ let { canvas: c } = this, l = 5 / (c.getZoom() || 1), { originX: u, originY: d } = t, { originX: f = "left", originY: p = "top" } = e, m = u ?? f, h = d ?? p, g = xc({
14987
15012
  target: e,
14988
15013
  bounds: s,
14989
15014
  originX: m,
@@ -15067,14 +15092,14 @@ var Qc = ({ anchors: e, bounds: t }) => {
15067
15092
  object: i,
15068
15093
  activeObject: e
15069
15094
  });
15070
- t && (Qc({
15095
+ t && (nl({
15071
15096
  anchors: n,
15072
15097
  bounds: t
15073
15098
  }), r.push(t));
15074
15099
  }
15075
15100
  let { montageArea: i } = this.editor, a = W({ object: i });
15076
15101
  if (a) {
15077
- Qc({
15102
+ nl({
15078
15103
  anchors: n,
15079
15104
  bounds: a
15080
15105
  });
@@ -15086,12 +15111,12 @@ var Qc = ({ anchors: e, bounds: t }) => {
15086
15111
  bottom: i
15087
15112
  };
15088
15113
  } else this.guideBounds = this._calculateViewportBounds();
15089
- this.anchors = n, this.spacingPatterns = el({ bounds: r }), this.cachedTargetBounds = r;
15114
+ this.anchors = n, this.spacingPatterns = il({ bounds: r }), this.cachedTargetBounds = r;
15090
15115
  }
15091
15116
  _collectTargets({ activeObject: e }) {
15092
- let t = nl({ activeObject: e }), n = [];
15117
+ let t = ol({ activeObject: e }), n = [];
15093
15118
  return this.canvas.forEachObject((e) => {
15094
- rl({
15119
+ sl({
15095
15120
  object: e,
15096
15121
  excluded: t
15097
15122
  }) || n.push(e);
@@ -15126,7 +15151,7 @@ var Qc = ({ anchors: e, bounds: t }) => {
15126
15151
  bottom: (r - s) / a
15127
15152
  };
15128
15153
  }
15129
- }, al = "#3D8BF4", ol = class e {
15154
+ }, ll = "#3D8BF4", ul = class e {
15130
15155
  constructor({ editor: e }) {
15131
15156
  this.activeGuides = [], this.isAltPressed = !1, this.pendingEvent = null, this.frameRequest = null, this.isToolbarHidden = !1, this.isTargetMontageArea = !1, this.lastMouseEvent = null, this.editor = e, this.canvas = e.canvas, this._onMouseMove = this._handleMouseMove.bind(this), this._onBeforeRender = this._handleBeforeRender.bind(this), this._onAfterRender = this._handleAfterRender.bind(this), this._onSelectionCleared = this._handleSelectionCleared.bind(this), this._onKeyDown = this._handleKeyDown.bind(this), this._onKeyUp = this._handleKeyUp.bind(this), this._onWindowBlur = this._handleWindowBlur.bind(this), this._bindEvents();
15132
15157
  }
@@ -15219,8 +15244,8 @@ var Qc = ({ anchors: e, bounds: t }) => {
15219
15244
  this.isTargetMontageArea = l, this.activeGuides = d, this._hideToolbar(), n.requestRenderAll();
15220
15245
  }
15221
15246
  static _resolveTarget({ event: e, activeObject: t }) {
15222
- let { target: n } = e, r = nl({ activeObject: t });
15223
- return n && !rl({
15247
+ let { target: n } = e, r = ol({ activeObject: t });
15248
+ return n && !sl({
15224
15249
  object: n,
15225
15250
  excluded: r
15226
15251
  }) ? n : null;
@@ -15337,7 +15362,7 @@ var Qc = ({ anchors: e, bounds: t }) => {
15337
15362
  let { canvas: e } = this, t = e.getSelectionContext();
15338
15363
  if (!t) return;
15339
15364
  let { viewportTransform: n } = e, r = e.getZoom() || 1, i = this.activeGuides.some((e) => e.type === "vertical"), a = this.activeGuides.some((e) => e.type === "horizontal"), o = i && a && !this.isTargetMontageArea, s = o ? 12 / r : 0;
15340
- t.save(), Array.isArray(n) && t.transform(...n), t.lineWidth = 1 / r, t.strokeStyle = al, t.setLineDash([]);
15365
+ t.save(), Array.isArray(n) && t.transform(...n), t.lineWidth = 1 / r, t.strokeStyle = ll, t.setLineDash([]);
15341
15366
  for (let e of this.activeGuides) {
15342
15367
  let { type: n, axis: i, start: a, end: c, distance: l } = e, u = Math.abs(c - a), d = o ? (a <= c ? -1 : 1) * (u / 2 + s) : 0;
15343
15368
  t.beginPath(), n === "vertical" ? (t.moveTo(i, a), t.lineTo(i, c)) : (t.moveTo(a, i), t.lineTo(c, i)), t.stroke(), os({
@@ -15348,7 +15373,7 @@ var Qc = ({ anchors: e, bounds: t }) => {
15348
15373
  end: c,
15349
15374
  text: ko({ distance: l }).toString(),
15350
15375
  zoom: r,
15351
- color: al,
15376
+ color: ll,
15352
15377
  lineWidth: 1,
15353
15378
  offsetAlongAxis: d,
15354
15379
  offsetPerpendicular: 0
@@ -15366,13 +15391,13 @@ var Qc = ({ anchors: e, bounds: t }) => {
15366
15391
  let { toolbar: e } = this.editor;
15367
15392
  e?.showAfterTemporary?.(), this.isToolbarHidden = !1;
15368
15393
  }
15369
- }, sl = 16, cl = 16, ll = Kt, ul = qt, dl = sl;
15370
- function fl({ sourceSize: e, size: t, aspectRatio: n, allowOverflow: r }) {
15371
- return t ? yl({
15394
+ }, dl = 16, fl = 16, pl = Kt, ml = qt, hl = dl;
15395
+ function gl({ sourceSize: e, size: t, aspectRatio: n, allowOverflow: r }) {
15396
+ return t ? Cl({
15372
15397
  size: t,
15373
15398
  sourceSize: e,
15374
15399
  allowOverflow: r
15375
- }) : n ? vl({
15400
+ }) : n ? Sl({
15376
15401
  aspectRatio: n,
15377
15402
  sourceSize: e
15378
15403
  }) : {
@@ -15386,29 +15411,29 @@ function Z({ source: e }) {
15386
15411
  height: e.height
15387
15412
  };
15388
15413
  }
15389
- function pl({ source: e, frame: t }) {
15414
+ function _l({ source: e, frame: t }) {
15390
15415
  let n = e.calcTransformMatrix(), r = w.invertTransform(n), i = t.calcTransformMatrix();
15391
- return gl({ points: _l({ frame: t }).map((e) => e.transform(i).transform(r)) });
15416
+ return bl({ points: xl({ frame: t }).map((e) => e.transform(i).transform(r)) });
15392
15417
  }
15393
- function ml({ source: e, frame: t }) {
15394
- bl({
15418
+ function vl({ source: e, frame: t }) {
15419
+ wl({
15395
15420
  source: e,
15396
15421
  frame: t
15397
- }), Sl({
15422
+ }), El({
15398
15423
  source: e,
15399
15424
  frame: t
15400
15425
  });
15401
15426
  }
15402
- function hl({ source: e, frame: t }) {
15403
- xl({
15427
+ function yl({ source: e, frame: t }) {
15428
+ Tl({
15404
15429
  source: e,
15405
15430
  frame: t
15406
- }), Sl({
15431
+ }), El({
15407
15432
  source: e,
15408
15433
  frame: t
15409
15434
  });
15410
15435
  }
15411
- function gl({ points: e }) {
15436
+ function bl({ points: e }) {
15412
15437
  let t = Math.min(...e.map((e) => e.x)), n = Math.min(...e.map((e) => e.y)), r = Math.max(...e.map((e) => e.x)), i = Math.max(...e.map((e) => e.y));
15413
15438
  return {
15414
15439
  left: t,
@@ -15417,7 +15442,7 @@ function gl({ points: e }) {
15417
15442
  height: i - n
15418
15443
  };
15419
15444
  }
15420
- function _l({ frame: e }) {
15445
+ function xl({ frame: e }) {
15421
15446
  let t = e.width / 2, n = e.height / 2;
15422
15447
  return [
15423
15448
  new m(-t, -n),
@@ -15426,7 +15451,7 @@ function _l({ frame: e }) {
15426
15451
  new m(-t, n)
15427
15452
  ];
15428
15453
  }
15429
- function vl({ sourceSize: e, aspectRatio: t }) {
15454
+ function Sl({ sourceSize: e, aspectRatio: t }) {
15430
15455
  let n = e.width / e.height, r = t.width / t.height;
15431
15456
  return r >= n ? {
15432
15457
  width: e.width,
@@ -15436,49 +15461,49 @@ function vl({ sourceSize: e, aspectRatio: t }) {
15436
15461
  height: e.height
15437
15462
  };
15438
15463
  }
15439
- function yl({ size: e, sourceSize: t, allowOverflow: n }) {
15440
- let r = n ? ll : Math.min(t.width, ll), i = n ? ul : Math.min(t.height, ul);
15464
+ function Cl({ size: e, sourceSize: t, allowOverflow: n }) {
15465
+ let r = n ? pl : Math.min(t.width, pl), i = n ? ml : Math.min(t.height, ml);
15441
15466
  return {
15442
- width: El({
15467
+ width: Al({
15443
15468
  value: e.width,
15444
- min: sl,
15469
+ min: dl,
15445
15470
  max: r
15446
15471
  }),
15447
- height: El({
15472
+ height: Al({
15448
15473
  value: e.height,
15449
- min: cl,
15474
+ min: fl,
15450
15475
  max: i
15451
15476
  })
15452
15477
  };
15453
15478
  }
15454
- function bl({ source: e, frame: t }) {
15455
- let n = pl({
15479
+ function wl({ source: e, frame: t }) {
15480
+ let n = _l({
15456
15481
  source: e,
15457
15482
  frame: t
15458
- }), r = Z({ source: e }), i = r.width / Math.max(n.width, sl), a = r.height / Math.max(n.height, cl);
15483
+ }), r = Z({ source: e }), i = r.width / Math.max(n.width, dl), a = r.height / Math.max(n.height, fl);
15459
15484
  i < 1 && t.set({ scaleX: (t.scaleX ?? 1) * i }), a < 1 && t.set({ scaleY: (t.scaleY ?? 1) * a }), t.setCoords();
15460
15485
  }
15461
- function xl({ source: e, frame: t }) {
15462
- let n = pl({
15486
+ function Tl({ source: e, frame: t }) {
15487
+ let n = _l({
15463
15488
  source: e,
15464
15489
  frame: t
15465
- }), r = Z({ source: e }), i = r.width / Math.max(n.width, sl), a = r.height / Math.max(n.height, cl), o = Math.min(i, a);
15490
+ }), r = Z({ source: e }), i = r.width / Math.max(n.width, dl), a = r.height / Math.max(n.height, fl), o = Math.min(i, a);
15466
15491
  o < 1 && t.set({
15467
15492
  scaleX: (t.scaleX ?? 1) * o,
15468
15493
  scaleY: (t.scaleY ?? 1) * o
15469
15494
  }), t.setCoords();
15470
15495
  }
15471
- function Sl({ source: e, frame: t }) {
15472
- let n = pl({
15496
+ function El({ source: e, frame: t }) {
15497
+ let n = _l({
15473
15498
  source: e,
15474
15499
  frame: t
15475
- }), r = Cl({ sourceSize: Z({ source: e }) }), i = wl({ rect: n }), a = Tl({
15500
+ }), r = Dl({ sourceSize: Z({ source: e }) }), i = Ol({ rect: n }), a = kl({
15476
15501
  rect: n,
15477
15502
  sourceBounds: r
15478
15503
  }), o = new m(i.x + a.x, i.y + a.y).transform(e.calcTransformMatrix());
15479
15504
  t.setPositionByOrigin(o, "center", "center"), t.setCoords();
15480
15505
  }
15481
- function Cl({ sourceSize: e }) {
15506
+ function Dl({ sourceSize: e }) {
15482
15507
  return {
15483
15508
  left: -e.width / 2,
15484
15509
  top: -e.height / 2,
@@ -15486,68 +15511,68 @@ function Cl({ sourceSize: e }) {
15486
15511
  height: e.height
15487
15512
  };
15488
15513
  }
15489
- function wl({ rect: e }) {
15514
+ function Ol({ rect: e }) {
15490
15515
  return new m(e.left + e.width / 2, e.top + e.height / 2);
15491
15516
  }
15492
- function Tl({ rect: e, sourceBounds: t }) {
15517
+ function kl({ rect: e, sourceBounds: t }) {
15493
15518
  let n = t.left + t.width, r = t.top + t.height, i = 0, a = 0;
15494
15519
  return e.left < t.left && (i = t.left - e.left), e.left + e.width > n && (i = n - e.left - e.width), e.top < t.top && (a = t.top - e.top), e.top + e.height > r && (a = r - e.top - e.height), new m(i, a);
15495
15520
  }
15496
- function El({ value: e, min: t, max: n }) {
15521
+ function Al({ value: e, min: t, max: n }) {
15497
15522
  return Math.max(t, Math.min(n, e));
15498
15523
  }
15499
15524
  //#endregion
15500
15525
  //#region src/editor/crop-manager/domain/crop-source-scale.ts
15501
- var Dl = 1, Ol = 1e-9;
15502
- function kl({ sourceSize: e, startRect: t, anchorX: n, anchorY: r }) {
15526
+ var jl = 1, Ml = 1e-9;
15527
+ function Nl({ sourceSize: e, startRect: t, anchorX: n, anchorY: r }) {
15503
15528
  let i = Math.max(1, t.width), a = Math.max(1, t.height);
15504
- if (Ll({
15529
+ if (Vl({
15505
15530
  sourceSize: e,
15506
15531
  rect: t,
15507
15532
  axis: "x"
15508
- }) || Ll({
15533
+ }) || Vl({
15509
15534
  sourceSize: e,
15510
15535
  rect: t,
15511
15536
  axis: "y"
15512
15537
  })) return 1;
15513
- let o = Bl({
15538
+ let o = Wl({
15514
15539
  sourceSize: e,
15515
15540
  rect: t,
15516
15541
  axis: "x",
15517
15542
  anchor: n
15518
- }), s = Bl({
15543
+ }), s = Wl({
15519
15544
  sourceSize: e,
15520
15545
  rect: t,
15521
15546
  axis: "y",
15522
15547
  anchor: r
15523
15548
  }), c = Math.min(o / i, s / a), l = Math.min(e.width / i, e.height / a), u = Math.min(c, l);
15524
- return (u - 1) * Math.min(i, a) <= Dl ? 1 : Math.max(1, u);
15549
+ return (u - 1) * Math.min(i, a) <= jl ? 1 : Math.max(1, u);
15525
15550
  }
15526
- function Al({ sourceSize: e, startRect: t, anchorX: n, anchorY: r }) {
15551
+ function Pl({ sourceSize: e, startRect: t, anchorX: n, anchorY: r }) {
15527
15552
  let i = Math.max(1, t.width), a = Math.max(1, t.height);
15528
- if (Ll({
15553
+ if (Vl({
15529
15554
  sourceSize: e,
15530
15555
  rect: t,
15531
15556
  axis: "x"
15532
- }) || Ll({
15557
+ }) || Vl({
15533
15558
  sourceSize: e,
15534
15559
  rect: t,
15535
15560
  axis: "y"
15536
15561
  })) return null;
15537
- let o = Ml({
15562
+ let o = Il({
15538
15563
  sourceSize: e,
15539
15564
  startRect: t,
15540
15565
  axis: "x",
15541
15566
  anchor: n
15542
- }), s = Ml({
15567
+ }), s = Il({
15543
15568
  sourceSize: e,
15544
15569
  startRect: t,
15545
15570
  axis: "y",
15546
15571
  anchor: r
15547
15572
  }), c = Math.max(1, Math.min(o.scale, s.scale));
15548
- return (c - 1) * Math.min(i, a) <= Dl ? null : {
15573
+ return (c - 1) * Math.min(i, a) <= jl ? null : {
15549
15574
  scale: c,
15550
- rect: Nl({
15575
+ rect: Ll({
15551
15576
  sourceSize: e,
15552
15577
  startRect: t,
15553
15578
  anchorX: n,
@@ -15558,35 +15583,35 @@ function Al({ sourceSize: e, startRect: t, anchorX: n, anchorY: r }) {
15558
15583
  })
15559
15584
  };
15560
15585
  }
15561
- function jl({ sourceSize: e, startRect: t, axis: n, anchor: r }) {
15562
- let i = Math.max(1, zl({
15586
+ function Fl({ sourceSize: e, startRect: t, axis: n, anchor: r }) {
15587
+ let i = Math.max(1, Ul({
15563
15588
  rect: t,
15564
15589
  axis: n
15565
15590
  }));
15566
- if (Ll({
15591
+ if (Vl({
15567
15592
  sourceSize: e,
15568
15593
  rect: t,
15569
15594
  axis: n
15570
15595
  })) return 1;
15571
- let a = Bl({
15596
+ let a = Wl({
15572
15597
  sourceSize: e,
15573
15598
  rect: t,
15574
15599
  axis: n,
15575
15600
  anchor: r
15576
- }), o = Rl({
15601
+ }), o = Hl({
15577
15602
  sourceSize: e,
15578
15603
  axis: n
15579
15604
  }), s = Math.min(a, o) / i;
15580
- return (s - 1) * i <= Dl ? 1 : Math.max(1, s);
15605
+ return (s - 1) * i <= jl ? 1 : Math.max(1, s);
15581
15606
  }
15582
- function Ml({ sourceSize: e, startRect: t, axis: n, anchor: r }) {
15583
- let i = Rl({
15607
+ function Il({ sourceSize: e, startRect: t, axis: n, anchor: r }) {
15608
+ let i = Hl({
15584
15609
  sourceSize: e,
15585
15610
  axis: n
15586
- }), a = Math.max(1, zl({
15611
+ }), a = Math.max(1, Ul({
15587
15612
  rect: t,
15588
15613
  axis: n
15589
- })), o = Bl({
15614
+ })), o = Wl({
15590
15615
  sourceSize: e,
15591
15616
  rect: t,
15592
15617
  axis: n,
@@ -15597,27 +15622,27 @@ function Ml({ sourceSize: e, startRect: t, axis: n, anchor: r }) {
15597
15622
  scale: s / a
15598
15623
  };
15599
15624
  }
15600
- function Nl({ sourceSize: e, startRect: t, anchorX: n, anchorY: r, widthLimit: i, heightLimit: a, scale: o }) {
15625
+ function Ll({ sourceSize: e, startRect: t, anchorX: n, anchorY: r, widthLimit: i, heightLimit: a, scale: o }) {
15601
15626
  let s = t.width * o, c = t.height * o;
15602
15627
  return {
15603
- left: Pl({
15628
+ left: Rl({
15604
15629
  sourceSize: e,
15605
15630
  startRect: t,
15606
15631
  axis: "x",
15607
15632
  anchor: n,
15608
15633
  nextLength: s,
15609
- shouldSnapToSource: Fl({
15634
+ shouldSnapToSource: zl({
15610
15635
  scale: o,
15611
15636
  limit: i.scale
15612
15637
  })
15613
15638
  }),
15614
- top: Pl({
15639
+ top: Rl({
15615
15640
  sourceSize: e,
15616
15641
  startRect: t,
15617
15642
  axis: "y",
15618
15643
  anchor: r,
15619
15644
  nextLength: c,
15620
- shouldSnapToSource: Fl({
15645
+ shouldSnapToSource: zl({
15621
15646
  scale: o,
15622
15647
  limit: a.scale
15623
15648
  })
@@ -15626,59 +15651,59 @@ function Nl({ sourceSize: e, startRect: t, anchorX: n, anchorY: r, widthLimit: i
15626
15651
  height: c
15627
15652
  };
15628
15653
  }
15629
- function Pl({ sourceSize: e, startRect: t, axis: n, anchor: r, nextLength: i, shouldSnapToSource: a }) {
15630
- let o = Rl({
15654
+ function Rl({ sourceSize: e, startRect: t, axis: n, anchor: r, nextLength: i, shouldSnapToSource: a }) {
15655
+ let o = Hl({
15631
15656
  sourceSize: e,
15632
15657
  axis: n
15633
- }), s = -o / 2, c = o / 2, l = n === "x" ? t.left : t.top, u = zl({
15658
+ }), s = -o / 2, c = o / 2, l = n === "x" ? t.left : t.top, u = Ul({
15634
15659
  rect: t,
15635
15660
  axis: n
15636
15661
  });
15637
- return a ? r === "min" ? c - i : r === "max" ? s : s + (o - i) / 2 : Il({
15662
+ return a ? r === "min" ? c - i : r === "max" ? s : s + (o - i) / 2 : Bl({
15638
15663
  start: l,
15639
15664
  length: u,
15640
15665
  nextLength: i,
15641
15666
  anchor: r
15642
15667
  });
15643
15668
  }
15644
- function Fl({ scale: e, limit: t }) {
15645
- return Math.abs(e - t) <= Ol;
15669
+ function zl({ scale: e, limit: t }) {
15670
+ return Math.abs(e - t) <= Ml;
15646
15671
  }
15647
- function Il({ start: e, length: t, nextLength: n, anchor: r }) {
15672
+ function Bl({ start: e, length: t, nextLength: n, anchor: r }) {
15648
15673
  return r === "min" ? e : r === "max" ? e + t - n : e + (t - n) / 2;
15649
15674
  }
15650
- function Ll({ sourceSize: e, rect: t, axis: n }) {
15651
- let r = Rl({
15675
+ function Vl({ sourceSize: e, rect: t, axis: n }) {
15676
+ let r = Hl({
15652
15677
  sourceSize: e,
15653
15678
  axis: n
15654
- }), i = zl({
15679
+ }), i = Ul({
15655
15680
  rect: t,
15656
15681
  axis: n
15657
15682
  });
15658
15683
  return Math.round(i) >= Math.round(r);
15659
15684
  }
15660
- function Rl({ sourceSize: e, axis: t }) {
15685
+ function Hl({ sourceSize: e, axis: t }) {
15661
15686
  return t === "x" ? e.width : e.height;
15662
15687
  }
15663
- function zl({ rect: e, axis: t }) {
15688
+ function Ul({ rect: e, axis: t }) {
15664
15689
  return t === "x" ? e.width : e.height;
15665
15690
  }
15666
- function Bl({ sourceSize: e, rect: t, axis: n, anchor: r }) {
15691
+ function Wl({ sourceSize: e, rect: t, axis: n, anchor: r }) {
15667
15692
  let i = n === "x" ? e.width : e.height, a = n === "x" ? t.left : t.top, o = n === "x" ? t.width : t.height, s = -i / 2, c = i / 2, l = a + o, u = a + o / 2;
15668
- return r === "min" ? c - Vl({
15693
+ return r === "min" ? c - Gl({
15669
15694
  value: a,
15670
15695
  boundary: s
15671
- }) : r === "max" ? Vl({
15696
+ }) : r === "max" ? Gl({
15672
15697
  value: l,
15673
15698
  boundary: c
15674
15699
  }) - s : Math.min(u - s, c - u) * 2;
15675
15700
  }
15676
- function Vl({ value: e, boundary: t }) {
15677
- return Math.abs(e - t) <= Dl ? t : e;
15701
+ function Gl({ value: e, boundary: t }) {
15702
+ return Math.abs(e - t) <= jl ? t : e;
15678
15703
  }
15679
15704
  //#endregion
15680
15705
  //#region src/editor/crop-manager/domain/crop-frame-size.ts
15681
- function Hl({ frame: e, scaleX: t = e.scaleX ?? 1, scaleY: n = e.scaleY ?? 1 }) {
15706
+ function Kl({ frame: e, scaleX: t = e.scaleX ?? 1, scaleY: n = e.scaleY ?? 1 }) {
15682
15707
  let r = Math.abs(e.cropSourceScaleX ?? 1) || 1, i = Math.abs(e.cropSourceScaleY ?? 1) || 1;
15683
15708
  return {
15684
15709
  width: Math.max(1, e.width * Math.abs(t) / r),
@@ -15687,159 +15712,159 @@ function Hl({ frame: e, scaleX: t = e.scaleX ?? 1, scaleY: n = e.scaleY ?? 1 })
15687
15712
  }
15688
15713
  //#endregion
15689
15714
  //#region src/editor/crop-manager/interaction/crop-controls.ts
15690
- var Ul = .001, Wl = 1, Gl = 1e-6, Kl = 1e-9, ql = [
15715
+ var ql = .001, Jl = 1, Yl = 1e-6, Xl = 1e-9, Zl = [
15691
15716
  "tl",
15692
15717
  "tr",
15693
15718
  "bl",
15694
15719
  "br"
15695
- ], Jl = [
15720
+ ], Ql = [
15696
15721
  "ml",
15697
15722
  "mr",
15698
15723
  "mt",
15699
15724
  "mb"
15700
- ], Yl = {
15725
+ ], $l = {
15701
15726
  ml: "w-resize",
15702
15727
  mr: "e-resize",
15703
15728
  mt: "n-resize",
15704
15729
  mb: "s-resize"
15705
15730
  };
15706
- function Xl({ transform: e }) {
15731
+ function eu({ transform: e }) {
15707
15732
  let { originX: t, originY: n } = e;
15708
15733
  return (t === "center" || t === .5) && (n === "center" || n === .5);
15709
15734
  }
15710
- function Zl({ transform: e, x: t, y: n }) {
15735
+ function tu({ transform: e, x: t, y: n }) {
15711
15736
  let r = e, { target: i } = r, { scaleX: a = 1, scaleY: o = 1 } = i;
15712
- if (tu({
15737
+ if (au({
15713
15738
  transform: r,
15714
15739
  x: t,
15715
15740
  y: n
15716
- })) return nu({ transform: r }), !0;
15741
+ })) return ou({ transform: r }), !0;
15717
15742
  let s = x.getLocalPoint(r, r.originX, r.originY, t, n);
15718
- return iu({ transform: r }), cu({
15743
+ return cu({ transform: r }), fu({
15719
15744
  transform: r,
15720
15745
  localPoint: s
15721
15746
  }), a !== i.scaleX || o !== i.scaleY;
15722
15747
  }
15723
- function Ql({ transform: e, x: t, y: n }) {
15748
+ function nu({ transform: e, x: t, y: n }) {
15724
15749
  let r = e, { target: i } = r, { scaleX: a = 1, scaleY: o = 1 } = i;
15725
- if (tu({
15750
+ if (au({
15726
15751
  transform: r,
15727
15752
  x: t,
15728
15753
  y: n
15729
- })) return nu({ transform: r }), !0;
15754
+ })) return ou({ transform: r }), !0;
15730
15755
  let s = x.getLocalPoint(r, r.originX, r.originY, t, n);
15731
- return iu({ transform: r }), yu({
15756
+ return cu({ transform: r }), Cu({
15732
15757
  transform: r,
15733
15758
  localPoint: s
15734
15759
  }), a !== i.scaleX || o !== i.scaleY;
15735
15760
  }
15736
- function $l({ transform: e, axis: t, x: n, y: r }) {
15761
+ function ru({ transform: e, axis: t, x: n, y: r }) {
15737
15762
  let i = e, { target: a } = i, o = t === "x" ? a.scaleX ?? 1 : a.scaleY ?? 1;
15738
- if (tu({
15763
+ if (au({
15739
15764
  transform: i,
15740
15765
  x: n,
15741
15766
  y: r
15742
- })) return ru({
15767
+ })) return su({
15743
15768
  transform: i,
15744
15769
  axis: t
15745
15770
  }), !0;
15746
15771
  let s = x.getLocalPoint(i, i.originX, i.originY, n, r);
15747
- return iu({ transform: i }), lu({
15772
+ return cu({ transform: i }), pu({
15748
15773
  transform: i,
15749
15774
  axis: t,
15750
15775
  localPoint: s
15751
15776
  }), t === "x" ? o !== a.scaleX : o !== a.scaleY;
15752
15777
  }
15753
- function eu({ transform: e, axis: t, x: n, y: r }) {
15778
+ function iu({ transform: e, axis: t, x: n, y: r }) {
15754
15779
  let i = e, { target: a } = i, { scaleX: o = 1, scaleY: s = 1 } = a;
15755
- if (tu({
15780
+ if (au({
15756
15781
  transform: i,
15757
15782
  x: n,
15758
15783
  y: r
15759
- })) return nu({ transform: i }), !0;
15784
+ })) return ou({ transform: i }), !0;
15760
15785
  let c = x.getLocalPoint(i, i.originX, i.originY, n, r);
15761
- return iu({ transform: i }), uu({
15786
+ return cu({ transform: i }), mu({
15762
15787
  transform: i,
15763
15788
  axis: t,
15764
15789
  localPoint: c
15765
15790
  }), o !== a.scaleX || s !== a.scaleY;
15766
15791
  }
15767
- function tu({ transform: e, x: t, y: n }) {
15768
- return Math.abs(t - e.ex) <= Ul && Math.abs(n - e.ey) <= Ul;
15792
+ function au({ transform: e, x: t, y: n }) {
15793
+ return Math.abs(t - e.ex) <= ql && Math.abs(n - e.ey) <= ql;
15769
15794
  }
15770
- function nu({ transform: e }) {
15795
+ function ou({ transform: e }) {
15771
15796
  e.target.set({
15772
15797
  scaleX: e.original.scaleX,
15773
15798
  scaleY: e.original.scaleY
15774
15799
  });
15775
15800
  }
15776
- function ru({ transform: e, axis: t }) {
15801
+ function su({ transform: e, axis: t }) {
15777
15802
  if (t === "x") {
15778
15803
  e.target.set("scaleX", e.original.scaleX);
15779
15804
  return;
15780
15805
  }
15781
15806
  e.target.set("scaleY", e.original.scaleY);
15782
15807
  }
15783
- function iu({ transform: e }) {
15784
- let { signX: t, signY: n } = au({ controlKey: e.corner });
15808
+ function cu({ transform: e }) {
15809
+ let { signX: t, signY: n } = lu({ controlKey: e.corner });
15785
15810
  e.signX === void 0 && (e.signX = t), e.signY === void 0 && (e.signY = n);
15786
15811
  }
15787
- function au({ controlKey: e }) {
15812
+ function lu({ controlKey: e }) {
15788
15813
  return {
15789
- signX: ou({ controlKey: e }),
15790
- signY: su({ controlKey: e })
15814
+ signX: uu({ controlKey: e }),
15815
+ signY: du({ controlKey: e })
15791
15816
  };
15792
15817
  }
15793
- function ou({ controlKey: e }) {
15818
+ function uu({ controlKey: e }) {
15794
15819
  return e === "tl" || e === "bl" || e === "ml" ? -1 : 1;
15795
15820
  }
15796
- function su({ controlKey: e }) {
15821
+ function du({ controlKey: e }) {
15797
15822
  return e === "tl" || e === "tr" || e === "mt" ? -1 : 1;
15798
15823
  }
15799
- function cu({ transform: e, localPoint: t }) {
15824
+ function fu({ transform: e, localPoint: t }) {
15800
15825
  let { target: n } = e;
15801
- fu({ transform: e });
15802
- let r = du({
15826
+ gu({ transform: e });
15827
+ let r = hu({
15803
15828
  transform: e,
15804
15829
  axis: "x",
15805
15830
  localPoint: t
15806
- }), i = du({
15831
+ }), i = hu({
15807
15832
  transform: e,
15808
15833
  axis: "y",
15809
15834
  localPoint: t
15810
15835
  });
15811
- n.lockScalingX || n.set("scaleX", r.scale), n.lockScalingY || n.set("scaleY", i.scale), (r.sourceClamped || i.sourceClamped) && pu({
15836
+ n.lockScalingX || n.set("scaleX", r.scale), n.lockScalingY || n.set("scaleY", i.scale), (r.sourceClamped || i.sourceClamped) && _u({
15812
15837
  transform: e,
15813
15838
  preserveAspectRatio: !1
15814
15839
  });
15815
15840
  }
15816
- function lu({ transform: e, axis: t, localPoint: n }) {
15841
+ function pu({ transform: e, axis: t, localPoint: n }) {
15817
15842
  let { target: r } = e;
15818
15843
  if (t === "x" && r.lockScalingX || t === "y" && r.lockScalingY) return;
15819
- fu({ transform: e });
15820
- let i = du({
15844
+ gu({ transform: e });
15845
+ let i = hu({
15821
15846
  transform: e,
15822
15847
  axis: t,
15823
15848
  localPoint: n
15824
15849
  });
15825
- t === "x" ? r.set("scaleX", i.scale) : r.set("scaleY", i.scale), i.sourceClamped && pu({
15850
+ t === "x" ? r.set("scaleX", i.scale) : r.set("scaleY", i.scale), i.sourceClamped && _u({
15826
15851
  transform: e,
15827
15852
  preserveAspectRatio: !1
15828
15853
  });
15829
15854
  }
15830
- function uu({ transform: e, axis: t, localPoint: n }) {
15855
+ function mu({ transform: e, axis: t, localPoint: n }) {
15831
15856
  let { target: r } = e;
15832
15857
  if (r.lockScalingX || r.lockScalingY) return;
15833
- let i = du({
15858
+ let i = hu({
15834
15859
  transform: e,
15835
15860
  axis: t,
15836
15861
  localPoint: n,
15837
15862
  constrainToSource: !1
15838
- }), a = t === "x" ? e.original.scaleX : e.original.scaleY, o = Cu({
15863
+ }), a = t === "x" ? e.original.scaleX : e.original.scaleY, o = Du({
15839
15864
  target: r,
15840
15865
  transform: e,
15841
15866
  scale: a > 0 ? i.scale / a : 1,
15842
- forceMinimum: Au({
15867
+ forceMinimum: Pu({
15843
15868
  transform: e,
15844
15869
  axis: t,
15845
15870
  localPoint: n
@@ -15847,17 +15872,17 @@ function uu({ transform: e, axis: t, localPoint: n }) {
15847
15872
  });
15848
15873
  r.set("scaleX", o.scaleX), r.set("scaleY", o.scaleY);
15849
15874
  }
15850
- function du({ transform: e, axis: t, localPoint: n, constrainToSource: r = !0 }) {
15851
- let { target: i } = e, a = Su({ target: i }), o = ku({ target: i }), s = t === "x" ? i.scaleX ?? 1 : i.scaleY ?? 1, c = t === "x" ? e.original.scaleX : e.original.scaleY, l = t === "x" ? n.x : n.y, u = t === "x" ? a.x : a.y, d = t === "x" ? o.minScaleX : o.minScaleY, f = r ? _u({
15875
+ function hu({ transform: e, axis: t, localPoint: n, constrainToSource: r = !0 }) {
15876
+ let { target: i } = e, a = Eu({ target: i }), o = Nu({ target: i }), s = t === "x" ? i.scaleX ?? 1 : i.scaleY ?? 1, c = t === "x" ? e.original.scaleX : e.original.scaleY, l = t === "x" ? n.x : n.y, u = t === "x" ? a.x : a.y, d = t === "x" ? o.minScaleX : o.minScaleY, f = r ? xu({
15852
15877
  target: i,
15853
15878
  transform: e,
15854
15879
  axis: t
15855
- }) : null, p = gu({
15880
+ }) : null, p = bu({
15856
15881
  axis: t,
15857
15882
  limits: o,
15858
15883
  sourceMaximumScale: f
15859
15884
  });
15860
- if (Au({
15885
+ if (Pu({
15861
15886
  transform: e,
15862
15887
  axis: t,
15863
15888
  localPoint: n
@@ -15866,11 +15891,11 @@ function du({ transform: e, axis: t, localPoint: n, constrainToSource: r = !0 })
15866
15891
  sourceClamped: !1
15867
15892
  };
15868
15893
  let m = Math.abs((l || 0) * s / u);
15869
- Xl({ transform: e }) && (m *= 2);
15870
- let h = hu({
15894
+ eu({ transform: e }) && (m *= 2);
15895
+ let h = yu({
15871
15896
  target: i,
15872
15897
  axis: t,
15873
- scale: Fu({
15898
+ scale: zu({
15874
15899
  value: m,
15875
15900
  min: d,
15876
15901
  max: p
@@ -15880,7 +15905,7 @@ function du({ transform: e, axis: t, localPoint: n, constrainToSource: r = !0 })
15880
15905
  });
15881
15906
  return {
15882
15907
  scale: h,
15883
- sourceClamped: mu({
15908
+ sourceClamped: vu({
15884
15909
  scale: h,
15885
15910
  maximumScale: p,
15886
15911
  sourceMaximumScale: f,
@@ -15888,108 +15913,108 @@ function du({ transform: e, axis: t, localPoint: n, constrainToSource: r = !0 })
15888
15913
  })
15889
15914
  };
15890
15915
  }
15891
- function fu({ transform: e }) {
15916
+ function gu({ transform: e }) {
15892
15917
  e.cropSourceScaleClamped = !1, e.cropSourceBoundScale = null, e.cropSourceScaleAnchorX = void 0, e.cropSourceScaleAnchorY = void 0, e.cropSourceScalePreserveAspectRatio = void 0;
15893
15918
  }
15894
- function pu({ transform: e, preserveAspectRatio: t }) {
15919
+ function _u({ transform: e, preserveAspectRatio: t }) {
15895
15920
  let { target: n } = e;
15896
- e.cropSourceScaleClamped = !0, e.cropSourceScalePreserveAspectRatio = t, e.cropSourceScaleAnchorX = Du({ transform: e }), e.cropSourceScaleAnchorY = Ou({ transform: e }), e.cropSourceBoundScale = {
15921
+ e.cropSourceScaleClamped = !0, e.cropSourceScalePreserveAspectRatio = t, e.cropSourceScaleAnchorX = ju({ transform: e }), e.cropSourceScaleAnchorY = Mu({ transform: e }), e.cropSourceBoundScale = {
15897
15922
  scaleX: n.scaleX ?? 1,
15898
15923
  scaleY: n.scaleY ?? 1
15899
15924
  };
15900
15925
  }
15901
- function mu({ scale: e, maximumScale: t, sourceMaximumScale: n, originalScale: r }) {
15902
- return n === null || Math.abs(t - n) > Kl || Math.abs(e - n) > Kl ? !1 : Math.abs(Math.abs(r) - n) > Kl;
15926
+ function vu({ scale: e, maximumScale: t, sourceMaximumScale: n, originalScale: r }) {
15927
+ return n === null || Math.abs(t - n) > Xl || Math.abs(e - n) > Xl ? !1 : Math.abs(Math.abs(r) - n) > Xl;
15903
15928
  }
15904
- function hu({ target: e, axis: t, scale: n, maximumScale: r, sourceMaximumScale: i }) {
15905
- return i === null || Math.abs(r - i) > Kl ? n : vu({
15929
+ function yu({ target: e, axis: t, scale: n, maximumScale: r, sourceMaximumScale: i }) {
15930
+ return i === null || Math.abs(r - i) > Xl ? n : Su({
15906
15931
  target: e,
15907
15932
  axis: t,
15908
15933
  fromScale: n,
15909
15934
  toScale: i
15910
- }) <= Wl + Gl ? i : n;
15935
+ }) <= Jl + Yl ? i : n;
15911
15936
  }
15912
- function gu({ axis: e, limits: t, sourceMaximumScale: n }) {
15937
+ function bu({ axis: e, limits: t, sourceMaximumScale: n }) {
15913
15938
  let r = e === "x" ? t.minScaleX : t.minScaleY, i = e === "x" ? t.maxScaleX : t.maxScaleY;
15914
15939
  return n === null ? i : Math.max(r, Math.min(i, n));
15915
15940
  }
15916
- function _u({ target: e, transform: t, axis: n }) {
15917
- let r = Tu({
15941
+ function xu({ target: e, transform: t, axis: n }) {
15942
+ let r = ku({
15918
15943
  target: e,
15919
15944
  transform: t
15920
15945
  });
15921
15946
  if (!r) return null;
15922
- let i = n === "x" ? t.original.scaleX : t.original.scaleY, a = jl({
15947
+ let i = n === "x" ? t.original.scaleX : t.original.scaleY, a = Fl({
15923
15948
  sourceSize: r.sourceSize,
15924
15949
  startRect: r.startRect,
15925
15950
  axis: n,
15926
- anchor: Eu({
15951
+ anchor: Au({
15927
15952
  transform: t,
15928
15953
  axis: n
15929
15954
  })
15930
15955
  });
15931
15956
  return Math.abs(i) * a;
15932
15957
  }
15933
- function vu({ target: e, axis: t, fromScale: n, toScale: r }) {
15958
+ function Su({ target: e, axis: t, fromScale: n, toScale: r }) {
15934
15959
  let i = e, a = t === "x" ? Math.abs(i.cropSourceScaleX ?? 1) || 1 : Math.abs(i.cropSourceScaleY ?? 1) || 1, o = t === "x" ? e.width : e.height;
15935
15960
  return Math.abs(r - n) * Math.max(1, o) / a;
15936
15961
  }
15937
- function yu({ transform: e, localPoint: t }) {
15962
+ function Cu({ transform: e, localPoint: t }) {
15938
15963
  let { target: n } = e;
15939
15964
  if (n.lockScalingX || n.lockScalingY) return;
15940
- let r = Cu({
15965
+ let r = Du({
15941
15966
  target: n,
15942
15967
  transform: e,
15943
- scale: bu({
15968
+ scale: wu({
15944
15969
  transform: e,
15945
15970
  localPoint: t,
15946
- dimensions: Su({ target: n })
15971
+ dimensions: Eu({ target: n })
15947
15972
  }),
15948
- forceMinimum: ju({
15973
+ forceMinimum: Fu({
15949
15974
  transform: e,
15950
15975
  localPoint: t
15951
15976
  })
15952
15977
  });
15953
15978
  n.set("scaleX", r.scaleX), n.set("scaleY", r.scaleY);
15954
15979
  }
15955
- function bu({ transform: e, localPoint: t, dimensions: n }) {
15980
+ function wu({ transform: e, localPoint: t, dimensions: n }) {
15956
15981
  let r = "gestureScale" in e && typeof e.gestureScale == "number" ? e.gestureScale : null;
15957
15982
  if (r !== null) return r;
15958
- let i = Math.abs(t.x) + Math.abs(t.y), a = xu({
15983
+ let i = Math.abs(t.x) + Math.abs(t.y), a = Tu({
15959
15984
  transform: e,
15960
15985
  dimensions: n
15961
15986
  }), o = a > 0 ? i / a : 1;
15962
- return Xl({ transform: e }) && (o *= 2), o;
15987
+ return eu({ transform: e }) && (o *= 2), o;
15963
15988
  }
15964
- function xu({ transform: e, dimensions: t }) {
15989
+ function Tu({ transform: e, dimensions: t }) {
15965
15990
  let { target: n, original: r } = e, i = n.scaleX ?? 1, a = n.scaleY ?? 1;
15966
15991
  return Math.abs(t.x * r.scaleX / i) + Math.abs(t.y * r.scaleY / a);
15967
15992
  }
15968
- function Su({ target: e }) {
15993
+ function Eu({ target: e }) {
15969
15994
  let t = Math.abs(e.scaleX ?? 1), n = Math.abs(e.scaleY ?? 1);
15970
15995
  return {
15971
15996
  x: Math.max(1, e.width * t),
15972
15997
  y: Math.max(1, e.height * n)
15973
15998
  };
15974
15999
  }
15975
- function Cu({ target: e, transform: t, scale: n, forceMinimum: r }) {
15976
- let i = Hl({
16000
+ function Du({ target: e, transform: t, scale: n, forceMinimum: r }) {
16001
+ let i = Kl({
15977
16002
  frame: e,
15978
16003
  scaleX: t.original.scaleX,
15979
16004
  scaleY: t.original.scaleY
15980
- }), a = Math.max(sl / i.width, cl / i.height), o = Math.min(ll / i.width, ul / i.height), s = wu({
16005
+ }), a = Math.max(dl / i.width, fl / i.height), o = Math.min(pl / i.width, ml / i.height), s = Ou({
15981
16006
  target: e,
15982
16007
  transform: t
15983
16008
  }), c = Math.max(a, Math.min(o, s ?? o));
15984
16009
  t.cropSourceScaleClamped = !r && n > c, t.cropSourceScalePreserveAspectRatio = t.cropSourceScaleClamped;
15985
16010
  let l = a;
15986
- r || (l = Fu({
16011
+ r || (l = zu({
15987
16012
  value: n,
15988
16013
  min: a,
15989
16014
  max: c
15990
16015
  }));
15991
16016
  let u = t.original.scaleX * l, d = t.original.scaleY * l;
15992
- return t.cropSourceScaleClamped ? (t.cropSourceScaleAnchorX = Du({ transform: t }), t.cropSourceScaleAnchorY = Ou({ transform: t }), t.cropSourceBoundScale = {
16017
+ return t.cropSourceScaleClamped ? (t.cropSourceScaleAnchorX = ju({ transform: t }), t.cropSourceScaleAnchorY = Mu({ transform: t }), t.cropSourceBoundScale = {
15993
16018
  scaleX: u,
15994
16019
  scaleY: d
15995
16020
  }) : (t.cropSourceBoundScale = null, t.cropSourceScaleAnchorX = void 0, t.cropSourceScaleAnchorY = void 0, t.cropSourceScalePreserveAspectRatio = void 0), {
@@ -15997,104 +16022,106 @@ function Cu({ target: e, transform: t, scale: n, forceMinimum: r }) {
15997
16022
  scaleY: d
15998
16023
  };
15999
16024
  }
16000
- function wu({ target: e, transform: t }) {
16001
- let n = Tu({
16025
+ function Ou({ target: e, transform: t }) {
16026
+ let n = ku({
16002
16027
  target: e,
16003
16028
  transform: t
16004
16029
  });
16005
- return n ? kl({
16030
+ return n ? Nl({
16006
16031
  sourceSize: n.sourceSize,
16007
16032
  startRect: n.startRect,
16008
- anchorX: Du({ transform: t }),
16009
- anchorY: Ou({ transform: t })
16033
+ anchorX: ju({ transform: t }),
16034
+ anchorY: Mu({ transform: t })
16010
16035
  }) : null;
16011
16036
  }
16012
- function Tu({ target: e, transform: t }) {
16037
+ function ku({ target: e, transform: t }) {
16013
16038
  if (t.cropSourceScaleBounds !== void 0) return t.cropSourceScaleBounds;
16014
16039
  let n = e;
16015
16040
  return n.cropAllowFrameOverflow !== !1 || !n.cropSource ? (t.cropSourceScaleBounds = null, null) : (t.cropSourceScaleBounds = {
16016
16041
  sourceSize: Z({ source: n.cropSource }),
16017
- startRect: pl({
16042
+ startRect: _l({
16018
16043
  source: n.cropSource,
16019
16044
  frame: n
16020
16045
  })
16021
16046
  }, t.cropSourceScaleBounds);
16022
16047
  }
16023
- function Eu({ transform: e, axis: t }) {
16024
- return t === "x" ? Du({ transform: e }) : Ou({ transform: e });
16048
+ function Au({ transform: e, axis: t }) {
16049
+ return t === "x" ? ju({ transform: e }) : Mu({ transform: e });
16025
16050
  }
16026
- function Du({ transform: e }) {
16051
+ function ju({ transform: e }) {
16027
16052
  return e.corner === "tl" || e.corner === "bl" || e.corner === "ml" ? "max" : e.corner === "tr" || e.corner === "br" || e.corner === "mr" || e.originX === "left" || e.originX === 0 ? "min" : e.originX === "right" || e.originX === 1 ? "max" : "center";
16028
16053
  }
16029
- function Ou({ transform: e }) {
16054
+ function Mu({ transform: e }) {
16030
16055
  return e.corner === "tl" || e.corner === "tr" || e.corner === "mt" ? "max" : e.corner === "bl" || e.corner === "br" || e.corner === "mb" || e.originY === "top" || e.originY === 0 ? "min" : e.originY === "bottom" || e.originY === 1 ? "max" : "center";
16031
16056
  }
16032
- function ku({ target: e }) {
16057
+ function Nu({ target: e }) {
16033
16058
  let t = e, n = Math.abs(t.cropSourceScaleX ?? 1) || 1, r = Math.abs(t.cropSourceScaleY ?? 1) || 1, i = Math.max(1, e.width), a = Math.max(1, e.height);
16034
16059
  return {
16035
- minScaleX: sl * n / i,
16036
- maxScaleX: ll * n / i,
16037
- minScaleY: cl * r / a,
16038
- maxScaleY: ul * r / a
16060
+ minScaleX: dl * n / i,
16061
+ maxScaleX: pl * n / i,
16062
+ minScaleY: fl * r / a,
16063
+ maxScaleY: ml * r / a
16039
16064
  };
16040
16065
  }
16041
- function Au({ transform: e, axis: t, localPoint: n }) {
16066
+ function Pu({ transform: e, axis: t, localPoint: n }) {
16042
16067
  let { target: r } = e;
16043
16068
  if (!r.lockScalingFlip) return !1;
16044
16069
  let i = t === "x" ? e.signX ?? 1 : e.signY ?? 1, a = t === "x" ? n.x : n.y;
16045
16070
  return i !== Math.sign(a || i);
16046
16071
  }
16047
- function ju({ transform: e, localPoint: t }) {
16048
- return Au({
16072
+ function Fu({ transform: e, localPoint: t }) {
16073
+ return Pu({
16049
16074
  transform: e,
16050
16075
  axis: "x",
16051
16076
  localPoint: t
16052
- }) || Au({
16077
+ }) || Pu({
16053
16078
  transform: e,
16054
16079
  axis: "y",
16055
16080
  localPoint: t
16056
16081
  });
16057
16082
  }
16058
- function Mu({ eventData: e, target: t }) {
16059
- let n = t.preserveAspectRatio ?? !0;
16060
- return e.shiftKey ? !n : n;
16083
+ function Iu({ eventData: e, target: t }) {
16084
+ return fc({
16085
+ target: t,
16086
+ shiftKey: e.shiftKey
16087
+ });
16061
16088
  }
16062
- function Nu() {
16063
- let e = x.wrapWithFireEvent("scaling", x.wrapWithFixedAnchor((e, t, n, r) => Zl({
16089
+ function Lu() {
16090
+ let e = x.wrapWithFireEvent("scaling", x.wrapWithFixedAnchor((e, t, n, r) => tu({
16064
16091
  transform: t,
16065
16092
  x: n,
16066
16093
  y: r
16067
- }))), t = x.wrapWithFireEvent("scaling", x.wrapWithFixedAnchor((e, t, n, r) => Ql({
16094
+ }))), t = x.wrapWithFireEvent("scaling", x.wrapWithFixedAnchor((e, t, n, r) => nu({
16068
16095
  transform: t,
16069
16096
  x: n,
16070
16097
  y: r
16071
16098
  })));
16072
- return (n, r, i, a) => Mu({
16099
+ return (n, r, i, a) => Iu({
16073
16100
  eventData: n,
16074
16101
  target: r.target
16075
16102
  }) ? t(n, r, i, a) : e(n, r, i, a);
16076
16103
  }
16077
- function Pu({ axis: e }) {
16078
- let t = x.wrapWithFireEvent("scaling", x.wrapWithFixedAnchor((t, n, r, i) => $l({
16104
+ function Ru({ axis: e }) {
16105
+ let t = x.wrapWithFireEvent("scaling", x.wrapWithFixedAnchor((t, n, r, i) => ru({
16079
16106
  transform: n,
16080
16107
  axis: e,
16081
16108
  x: r,
16082
16109
  y: i
16083
- }))), n = x.wrapWithFireEvent("scaling", x.wrapWithFixedAnchor((t, n, r, i) => eu({
16110
+ }))), n = x.wrapWithFireEvent("scaling", x.wrapWithFixedAnchor((t, n, r, i) => iu({
16084
16111
  transform: n,
16085
16112
  axis: e,
16086
16113
  x: r,
16087
16114
  y: i
16088
16115
  })));
16089
- return (e, r, i, a) => Mu({
16116
+ return (e, r, i, a) => Iu({
16090
16117
  eventData: e,
16091
16118
  target: r.target
16092
16119
  }) ? n(e, r, i, a) : t(e, r, i, a);
16093
16120
  }
16094
- function Fu({ value: e, min: t, max: n }) {
16121
+ function zu({ value: e, min: t, max: n }) {
16095
16122
  return Math.max(t, Math.min(n, e));
16096
16123
  }
16097
- function Iu({ control: e, actionHandler: t, cursorStyleHandler: n, getActionName: i }) {
16124
+ function Bu({ control: e, actionHandler: t, cursorStyleHandler: n, getActionName: i }) {
16098
16125
  let a = {
16099
16126
  ...e,
16100
16127
  actionHandler: t
@@ -16103,55 +16130,55 @@ function Iu({ control: e, actionHandler: t, cursorStyleHandler: n, getActionName
16103
16130
  let o = new r(a);
16104
16131
  return o.cropResizeControl = !0, o;
16105
16132
  }
16106
- function Lu({ controlKey: e }) {
16107
- return Yl[e];
16133
+ function Vu({ controlKey: e }) {
16134
+ return $l[e];
16108
16135
  }
16109
- function Ru({ axis: e }) {
16136
+ function Hu({ axis: e }) {
16110
16137
  return e === "x" ? "scaleX" : "scaleY";
16111
16138
  }
16112
- function zu({ target: e }) {
16113
- let t = { ...e.controls }, n = !1, r = Nu(), i = Pu({ axis: "x" }), a = Pu({ axis: "y" });
16114
- ql.forEach((i) => {
16139
+ function Uu({ target: e }) {
16140
+ let t = { ...e.controls }, n = !1, r = Lu(), i = Ru({ axis: "x" }), a = Ru({ axis: "y" });
16141
+ Zl.forEach((i) => {
16115
16142
  let a = e.controls[i];
16116
- a && (a.cropResizeControl || (t[i] = Iu({
16143
+ a && (a.cropResizeControl || (t[i] = Bu({
16117
16144
  control: a,
16118
16145
  actionHandler: r
16119
16146
  }), n = !0));
16120
- }), Jl.forEach((r) => {
16147
+ }), Ql.forEach((r) => {
16121
16148
  let o = e.controls[r];
16122
16149
  if (!o || o.cropResizeControl) return;
16123
16150
  let s = r === "ml" || r === "mr", c = s ? i : a, l = s ? "x" : "y";
16124
- t[r] = Iu({
16151
+ t[r] = Bu({
16125
16152
  control: o,
16126
16153
  actionHandler: c,
16127
- cursorStyleHandler: () => Lu({ controlKey: r }),
16128
- getActionName: () => Ru({ axis: l })
16154
+ cursorStyleHandler: () => Vu({ controlKey: r }),
16155
+ getActionName: () => Hu({ axis: l })
16129
16156
  }), n = !0;
16130
16157
  }), n && (e.controls = t);
16131
16158
  }
16132
16159
  //#endregion
16133
16160
  //#region src/editor/crop-manager/domain/crop-frame.ts
16134
- var Bu = "rgba(47, 128, 237, 0.42)", Vu = class extends _ {
16161
+ var Wu = "rgba(47, 128, 237, 0.42)", Gu = class extends _ {
16135
16162
  constructor(e) {
16136
16163
  let { showGrid: t, source: n = null, allowFrameOverflow: r = !0, sourceScaleX: i = 1, sourceScaleY: a = 1, preserveAspectRatio: o = !0, ...s } = e;
16137
- super(s), this._showGrid = t, this.cropSource = n, this.cropAllowFrameOverflow = r, this.cropSourceScaleX = i, this.cropSourceScaleY = a, this.preserveAspectRatio = o;
16164
+ super(s), this._showGrid = t, this.cropSource = n, this.cropAllowFrameOverflow = r, this.cropSourceScaleX = i, this.cropSourceScaleY = a, this.preserveAspectRatio = o, this.cropActiveResizePreserveAspectRatio = null;
16138
16165
  }
16139
16166
  _render(e) {
16140
- super._render(e), this._showGrid && Uu({
16167
+ super._render(e), this._showGrid && Ju({
16141
16168
  ctx: e,
16142
16169
  width: this.width,
16143
16170
  height: this.height
16144
16171
  });
16145
16172
  }
16146
16173
  getObjectDisplaySize() {
16147
- return Hl({ frame: this });
16174
+ return Kl({ frame: this });
16148
16175
  }
16149
16176
  getObjectSnappingBounds() {
16150
- return Gu({ frame: this });
16177
+ return Xu({ frame: this });
16151
16178
  }
16152
16179
  };
16153
- function Hu({ source: e, cropSize: t, showGrid: n, allowFrameOverflow: r, preserveAspectRatio: i }) {
16154
- let a = e.getCenterPoint(), o = e.scaleX ?? 1, s = e.scaleY ?? 1, c = new Vu({
16180
+ function Ku({ source: e, cropSize: t, showGrid: n, allowFrameOverflow: r, preserveAspectRatio: i }) {
16181
+ let a = e.getCenterPoint(), o = e.scaleX ?? 1, s = e.scaleY ?? 1, c = new Gu({
16155
16182
  id: `crop-frame-${D()}`,
16156
16183
  left: a.x,
16157
16184
  top: a.y,
@@ -16183,18 +16210,22 @@ function Hu({ source: e, cropSize: t, showGrid: n, allowFrameOverflow: r, preser
16183
16210
  sourceScaleX: o,
16184
16211
  sourceScaleY: s
16185
16212
  });
16186
- return c.setControlsVisibility({ mtr: !1 }), zu({ target: c }), c;
16213
+ return c.setControlsVisibility({ mtr: !1 }), Uu({ target: c }), c;
16187
16214
  }
16188
- function Uu({ ctx: e, width: t, height: n }) {
16215
+ function qu({ frame: e, preserveAspectRatio: t }) {
16216
+ if (!(e instanceof Gu)) throw Error("Crop session frame должен быть CropFrame");
16217
+ e.cropActiveResizePreserveAspectRatio = t;
16218
+ }
16219
+ function Ju({ ctx: e, width: t, height: n }) {
16189
16220
  if (!(t <= 0 || n <= 0)) {
16190
- e.save(), e.strokeStyle = Bu, e.lineWidth = 1, e.setLineDash([]);
16221
+ e.save(), e.strokeStyle = Wu, e.lineWidth = 1, e.setLineDash([]);
16191
16222
  for (let r = 1; r <= 2; r += 1) {
16192
16223
  let i = -t / 2 + t * r / 3, a = -n / 2 + n * r / 3;
16193
- Wu({
16224
+ Yu({
16194
16225
  ctx: e,
16195
16226
  x: i,
16196
16227
  height: n
16197
- }), qu({
16228
+ }), Qu({
16198
16229
  ctx: e,
16199
16230
  y: a,
16200
16231
  width: t
@@ -16203,19 +16234,19 @@ function Uu({ ctx: e, width: t, height: n }) {
16203
16234
  e.restore();
16204
16235
  }
16205
16236
  }
16206
- function Wu({ ctx: e, x: t, height: n }) {
16237
+ function Yu({ ctx: e, x: t, height: n }) {
16207
16238
  e.beginPath(), e.moveTo(t, -n / 2), e.lineTo(t, n / 2), e.stroke();
16208
16239
  }
16209
- function Gu({ frame: e }) {
16240
+ function Xu({ frame: e }) {
16210
16241
  let t = e.calcTransformMatrix(), n = e.width / 2, r = e.height / 2;
16211
- return Ku({ points: [
16242
+ return Zu({ points: [
16212
16243
  new m(-n, -r),
16213
16244
  new m(n, -r),
16214
16245
  new m(n, r),
16215
16246
  new m(-n, r)
16216
16247
  ].map((e) => e.transform(t)) });
16217
16248
  }
16218
- function Ku({ points: e }) {
16249
+ function Zu({ points: e }) {
16219
16250
  let t = Math.min(...e.map((e) => e.x)), n = Math.max(...e.map((e) => e.x)), r = Math.min(...e.map((e) => e.y)), i = Math.max(...e.map((e) => e.y));
16220
16251
  return {
16221
16252
  left: t,
@@ -16226,27 +16257,27 @@ function Ku({ points: e }) {
16226
16257
  centerY: r + (i - r) / 2
16227
16258
  };
16228
16259
  }
16229
- function qu({ ctx: e, y: t, width: n }) {
16260
+ function Qu({ ctx: e, y: t, width: n }) {
16230
16261
  e.beginPath(), e.moveTo(-n / 2, t), e.lineTo(n / 2, t), e.stroke();
16231
16262
  }
16232
16263
  //#endregion
16233
16264
  //#region src/editor/crop-manager/domain/crop-result.ts
16234
- var Ju = 1e-6;
16235
- function Yu({ session: e }) {
16236
- return e.mode === "canvas" ? ed({ session: e }) : td({
16265
+ var $u = 1e-6;
16266
+ function ed({ session: e }) {
16267
+ return e.mode === "canvas" ? ad({ session: e }) : od({
16237
16268
  target: e.target,
16238
16269
  frame: e.frame
16239
16270
  });
16240
16271
  }
16241
- function Xu({ rect: e, sourceSize: t }) {
16242
- let n = Math.max(0, Zu({ value: e.width })), r = Math.max(0, Zu({ value: e.height }));
16272
+ function td({ rect: e, sourceSize: t }) {
16273
+ let n = Math.max(0, nd({ value: e.width })), r = Math.max(0, nd({ value: e.height }));
16243
16274
  return {
16244
- left: Qu({
16275
+ left: rd({
16245
16276
  start: e.left,
16246
16277
  length: n,
16247
16278
  sourceLength: t?.width
16248
16279
  }),
16249
- top: Qu({
16280
+ top: rd({
16250
16281
  start: e.top,
16251
16282
  length: r,
16252
16283
  sourceLength: t?.height
@@ -16255,20 +16286,20 @@ function Xu({ rect: e, sourceSize: t }) {
16255
16286
  height: r
16256
16287
  };
16257
16288
  }
16258
- function Zu({ value: e }) {
16259
- return Math.round(e + Ju);
16289
+ function nd({ value: e }) {
16290
+ return Math.round(e + $u);
16260
16291
  }
16261
- function Qu({ start: e, length: t, sourceLength: n }) {
16262
- let r = Zu({ value: e });
16292
+ function rd({ start: e, length: t, sourceLength: n }) {
16293
+ let r = nd({ value: e });
16263
16294
  if (n === void 0) return r;
16264
- let i = Math.max(0, Zu({ value: n })), a = Math.max(0, i - t);
16295
+ let i = Math.max(0, nd({ value: n })), a = Math.max(0, i - t);
16265
16296
  return Math.min(Math.max(0, r), a);
16266
16297
  }
16267
- function $u({ rect: e }) {
16268
- return e.width >= dl && e.height >= dl;
16298
+ function id({ rect: e }) {
16299
+ return e.width >= hl && e.height >= hl;
16269
16300
  }
16270
- function ed({ session: e }) {
16271
- let t = pl({
16301
+ function ad({ session: e }) {
16302
+ let t = _l({
16272
16303
  source: e.source,
16273
16304
  frame: e.frame
16274
16305
  }), n = Z({ source: e.source });
@@ -16279,8 +16310,8 @@ function ed({ session: e }) {
16279
16310
  height: t.height
16280
16311
  };
16281
16312
  }
16282
- function td({ target: e, frame: t }) {
16283
- let n = pl({
16313
+ function od({ target: e, frame: t }) {
16314
+ let n = _l({
16284
16315
  source: e,
16285
16316
  frame: t
16286
16317
  }), r = -e.width / 2, i = -e.height / 2;
@@ -16293,8 +16324,8 @@ function td({ target: e, frame: t }) {
16293
16324
  }
16294
16325
  //#endregion
16295
16326
  //#region src/editor/crop-manager/mutation/crop-apply.ts
16296
- function nd({ editor: e, frame: t, rect: n }) {
16297
- return $u({ rect: n }) ? (ud({
16327
+ function sd({ editor: e, frame: t, rect: n }) {
16328
+ return id({ rect: n }) ? (hd({
16298
16329
  editor: e,
16299
16330
  frame: t,
16300
16331
  offset: new m(-n.left, -n.top)
@@ -16304,9 +16335,9 @@ function nd({ editor: e, frame: t, rect: n }) {
16304
16335
  rect: n
16305
16336
  }) : null;
16306
16337
  }
16307
- function rd({ editor: e, target: t, frame: n, rect: r }) {
16308
- if (!$u({ rect: r })) return null;
16309
- let i = id({
16338
+ function cd({ editor: e, target: t, frame: n, rect: r }) {
16339
+ if (!id({ rect: r })) return null;
16340
+ let i = ld({
16310
16341
  target: t,
16311
16342
  frame: n,
16312
16343
  rect: r
@@ -16317,21 +16348,21 @@ function rd({ editor: e, target: t, frame: n, rect: r }) {
16317
16348
  rect: i
16318
16349
  }) : null;
16319
16350
  }
16320
- function id({ target: e, frame: t, rect: n }) {
16321
- let r = Math.max(dl, n.width), i = Math.max(dl, n.height), a = {
16351
+ function ld({ target: e, frame: t, rect: n }) {
16352
+ let r = Math.max(hl, n.width), i = Math.max(hl, n.height), a = {
16322
16353
  width: r,
16323
16354
  height: i
16324
16355
  };
16325
- if (ad({
16356
+ if (ud({
16326
16357
  target: e,
16327
16358
  rect: n
16328
- })) od({
16359
+ })) dd({
16329
16360
  target: e,
16330
16361
  size: a,
16331
16362
  rect: n
16332
16363
  });
16333
16364
  else {
16334
- let t = sd({
16365
+ let t = fd({
16335
16366
  target: e,
16336
16367
  size: a,
16337
16368
  rect: n
@@ -16351,10 +16382,10 @@ function id({ target: e, frame: t, rect: n }) {
16351
16382
  height: i
16352
16383
  };
16353
16384
  }
16354
- function ad({ target: e, rect: t }) {
16385
+ function ud({ target: e, rect: t }) {
16355
16386
  return t.left >= 0 && t.top >= 0 && t.left + t.width <= e.width && t.top + t.height <= e.height;
16356
16387
  }
16357
- function od({ target: e, size: t, rect: n }) {
16388
+ function dd({ target: e, size: t, rect: n }) {
16358
16389
  let r = (e.cropX ?? 0) + n.left, i = (e.cropY ?? 0) + n.top;
16359
16390
  e.set({
16360
16391
  cropX: r,
@@ -16363,25 +16394,25 @@ function od({ target: e, size: t, rect: n }) {
16363
16394
  height: t.height
16364
16395
  });
16365
16396
  }
16366
- function sd({ target: e, size: t, rect: n }) {
16367
- let r = e.getElement(), i = cd({ target: e });
16397
+ function fd({ target: e, size: t, rect: n }) {
16398
+ let r = e.getElement(), i = pd({ target: e });
16368
16399
  if (!r || !i) return null;
16369
16400
  let a = i.createElement("canvas");
16370
16401
  a.width = Math.round(t.width), a.height = Math.round(t.height);
16371
16402
  let o = a.getContext("2d");
16372
16403
  if (!o) return null;
16373
- let s = ld({
16404
+ let s = md({
16374
16405
  target: e,
16375
16406
  size: t,
16376
16407
  rect: n
16377
16408
  });
16378
16409
  return s && o.drawImage(r, s.sourceX, s.sourceY, s.sourceWidth, s.sourceHeight, s.destinationX, s.destinationY, s.sourceWidth, s.sourceHeight), a;
16379
16410
  }
16380
- function cd({ target: e }) {
16411
+ function pd({ target: e }) {
16381
16412
  let t = e.canvas?.getElement();
16382
16413
  return t?.ownerDocument ? t.ownerDocument : typeof document < "u" ? document : null;
16383
16414
  }
16384
- function ld({ target: e, size: t, rect: n }) {
16415
+ function md({ target: e, size: t, rect: n }) {
16385
16416
  let r = Math.max(0, n.left), i = Math.max(0, n.top), a = Math.min(e.width, n.left + t.width), o = Math.min(e.height, n.top + t.height), s = a - r, c = o - i;
16386
16417
  return s <= 0 || c <= 0 ? null : {
16387
16418
  sourceX: (e.cropX ?? 0) + r,
@@ -16392,7 +16423,7 @@ function ld({ target: e, size: t, rect: n }) {
16392
16423
  destinationY: i - n.top
16393
16424
  };
16394
16425
  }
16395
- function ud({ editor: e, frame: t, offset: n }) {
16426
+ function hd({ editor: e, frame: t, offset: n }) {
16396
16427
  e.canvasManager.getObjects().forEach((e) => {
16397
16428
  e !== t && (e.set({
16398
16429
  left: (e.left ?? 0) + n.x,
@@ -16402,12 +16433,12 @@ function ud({ editor: e, frame: t, offset: n }) {
16402
16433
  }
16403
16434
  //#endregion
16404
16435
  //#region src/editor/crop-manager/index.ts
16405
- var dd = {
16436
+ var gd = {
16406
16437
  allowFrameOverflow: !0,
16407
16438
  showGrid: !0,
16408
16439
  cancelOnSelectionClear: !0,
16409
16440
  preserveAspectRatio: !0
16410
- }, fd = .5, pd = 1e-9, md = 1, hd = class {
16441
+ }, _d = .5, vd = 1e-9, yd = 1, bd = class {
16411
16442
  constructor({ editor: e }) {
16412
16443
  this._handleCropFrameChanged = (e) => {
16413
16444
  let { _session: t } = this;
@@ -16426,7 +16457,14 @@ var dd = {
16426
16457
  }), n || this._rememberSourceBoundFrameIfNeeded({
16427
16458
  session: t,
16428
16459
  event: e
16429
- }), this.editor.canvas.fire("editor:crop:changed", this.getState()), this.editor.canvas.requestRenderAll();
16460
+ }), pc({ transform: e?.transform }) && (this._activeResizePreserveAspectRatio = t.effectivePreserveAspectRatio), this.editor.canvas.fire("editor:crop:changed", this.getState()), this.editor.canvas.requestRenderAll();
16461
+ }, this._handleCropFrameModified = (e) => {
16462
+ this._handleCropFrameChanged(e);
16463
+ let { _session: t } = this;
16464
+ t && (qu({
16465
+ frame: t.frame,
16466
+ preserveAspectRatio: null
16467
+ }), this._activeResizePreserveAspectRatio = null, t.effectivePreserveAspectRatio = t.options.preserveAspectRatio);
16430
16468
  }, this._handleCanvasSelectionChanged = () => {
16431
16469
  let { _session: e } = this;
16432
16470
  e && e.options.cancelOnSelectionClear && (this._isSpacePanActive() || this.editor.canvas.getActiveObject() !== e.frame && this.cancel());
@@ -16435,7 +16473,7 @@ var dd = {
16435
16473
  if (!t || !t.options.cancelOnSelectionClear || this._isSpacePanActive() || e === t.frame) return;
16436
16474
  let n = null;
16437
16475
  t.mode === "image" && (n = t.target), this._cancelFromPointerDown({ nextActiveObject: n });
16438
- }, this.editor = e, this._session = null;
16476
+ }, this.editor = e, this._session = null, this._activeResizePreserveAspectRatio = null;
16439
16477
  }
16440
16478
  get isActive() {
16441
16479
  return !!this._session;
@@ -16443,13 +16481,14 @@ var dd = {
16443
16481
  getState() {
16444
16482
  let { _session: e } = this;
16445
16483
  if (!e) return null;
16446
- let t = Yu({ session: e }), n = e.options.allowFrameOverflow ? void 0 : Z({ source: e.source });
16484
+ let t = ed({ session: e }), n = e.options.allowFrameOverflow ? void 0 : Z({ source: e.source });
16447
16485
  return {
16448
16486
  mode: e.mode,
16449
16487
  frame: e.frame,
16450
16488
  options: e.options,
16451
16489
  target: e.target,
16452
- rect: Xu({
16490
+ effectivePreserveAspectRatio: e.effectivePreserveAspectRatio,
16491
+ rect: td({
16453
16492
  rect: t,
16454
16493
  sourceSize: n
16455
16494
  })
@@ -16460,15 +16499,18 @@ var dd = {
16460
16499
  }
16461
16500
  _getEffectivePreserveAspectRatio(e) {
16462
16501
  let { _session: t } = this;
16463
- return t ? this._isSourceScaleClamped({ event: e }) ? e?.transform?.cropSourceScalePreserveAspectRatio ?? !0 : e?.e?.shiftKey ? !t.options.preserveAspectRatio : t.options.preserveAspectRatio : !0;
16502
+ return t ? this._isSourceScaleClamped({ event: e }) ? e?.transform?.cropSourceScalePreserveAspectRatio ?? !0 : fc({
16503
+ target: t.frame,
16504
+ shiftKey: e?.e?.shiftKey
16505
+ }) : !0;
16464
16506
  }
16465
16507
  isFrameOverflowingSource({ target: e }) {
16466
16508
  let { _session: t } = this;
16467
16509
  if (!t || !e || t.options.allowFrameOverflow || t.frame !== e) return !1;
16468
- let n = pl({
16510
+ let n = _l({
16469
16511
  source: t.source,
16470
16512
  frame: t.frame
16471
- }), r = Z({ source: t.source }), i = -r.width / 2 - fd, a = -r.height / 2 - fd, o = r.width / 2 + fd, s = r.height / 2 + fd;
16513
+ }), r = Z({ source: t.source }), i = -r.width / 2 - _d, a = -r.height / 2 - _d, o = r.width / 2 + _d, s = r.height / 2 + _d;
16472
16514
  return n.left < i || n.top < a || n.left + n.width > o || n.top + n.height > s;
16473
16515
  }
16474
16516
  isFrameSourceScaleClamped({ target: e, transform: t }) {
@@ -16525,7 +16567,7 @@ var dd = {
16525
16567
  setAspectRatio({ aspectRatio: e }) {
16526
16568
  let { _session: t } = this;
16527
16569
  if (!t) return null;
16528
- let n = fl({
16570
+ let n = gl({
16529
16571
  sourceSize: Z({ source: t.source }),
16530
16572
  aspectRatio: e ?? void 0,
16531
16573
  allowOverflow: t.options.allowFrameOverflow
@@ -16538,7 +16580,7 @@ var dd = {
16538
16580
  setSize({ size: e }) {
16539
16581
  let { _session: t } = this;
16540
16582
  if (!t) return null;
16541
- let n = fl({
16583
+ let n = gl({
16542
16584
  sourceSize: Z({ source: t.source }),
16543
16585
  size: e,
16544
16586
  allowOverflow: t.options.allowFrameOverflow
@@ -16548,12 +16590,20 @@ var dd = {
16548
16590
  size: n
16549
16591
  }), this.getState();
16550
16592
  }
16551
- setPreserveAspectRatio({ preserveAspectRatio: e }) {
16552
- let { _session: t } = this;
16553
- return t ? (t.options.preserveAspectRatio = e, t.effectivePreserveAspectRatio = e, this._setFramePreserveAspectRatio({
16554
- frame: t.frame,
16593
+ setPreserveAspectRatio({ preserveAspectRatio: e, keepCurrentResizeMode: t = !1 }) {
16594
+ let { _session: n } = this;
16595
+ if (!n) return null;
16596
+ let r = this._activeResizePreserveAspectRatio;
16597
+ return n.options.preserveAspectRatio = e, this._setFramePreserveAspectRatio({
16598
+ frame: n.frame,
16555
16599
  preserveAspectRatio: e
16556
- }), this.editor.canvas.requestRenderAll(), this.getState()) : null;
16600
+ }), qu({
16601
+ frame: n.frame,
16602
+ preserveAspectRatio: null
16603
+ }), n.effectivePreserveAspectRatio = e, t && r !== null && (n.effectivePreserveAspectRatio = r, qu({
16604
+ frame: n.frame,
16605
+ preserveAspectRatio: r
16606
+ })), this.editor.canvas.requestRenderAll(), this.getState();
16557
16607
  }
16558
16608
  resetFrameToSource({ target: e }) {
16559
16609
  let { _session: t } = this;
@@ -16618,16 +16668,16 @@ var dd = {
16618
16668
  }
16619
16669
  _resolveSessionOptions({ options: e }) {
16620
16670
  return {
16621
- allowFrameOverflow: e.allowFrameOverflow ?? dd.allowFrameOverflow,
16622
- showGrid: e.showGrid ?? dd.showGrid,
16623
- cancelOnSelectionClear: e.cancelOnSelectionClear ?? dd.cancelOnSelectionClear,
16624
- preserveAspectRatio: e.preserveAspectRatio ?? dd.preserveAspectRatio
16671
+ allowFrameOverflow: e.allowFrameOverflow ?? gd.allowFrameOverflow,
16672
+ showGrid: e.showGrid ?? gd.showGrid,
16673
+ cancelOnSelectionClear: e.cancelOnSelectionClear ?? gd.cancelOnSelectionClear,
16674
+ preserveAspectRatio: e.preserveAspectRatio ?? gd.preserveAspectRatio
16625
16675
  };
16626
16676
  }
16627
16677
  _createCropFrameForSource({ source: e, options: t, sessionOptions: n }) {
16628
- return Hu({
16678
+ return Ku({
16629
16679
  source: e,
16630
- cropSize: fl({
16680
+ cropSize: gl({
16631
16681
  sourceSize: Z({ source: e }),
16632
16682
  size: t.size,
16633
16683
  aspectRatio: t.aspectRatio,
@@ -16639,7 +16689,7 @@ var dd = {
16639
16689
  });
16640
16690
  }
16641
16691
  _setFramePreserveAspectRatio({ frame: e, preserveAspectRatio: t }) {
16642
- if (!(e instanceof Vu)) throw Error("Crop session frame должен быть CropFrame");
16692
+ if (!(e instanceof Gu)) throw Error("Crop session frame должен быть CropFrame");
16643
16693
  e.preserveAspectRatio = t;
16644
16694
  }
16645
16695
  _activateSession({ session: e }) {
@@ -16647,10 +16697,10 @@ var dd = {
16647
16697
  n.suspendHistory(), this.editor.toolbar.hideTemporarily(), e.interactivity = this._disableSceneObjects(), this._session = e, this._bindCropFrameEvents({ frame: e.frame }), t.add(e.frame), t.bringObjectToFront(e.frame), t.setActiveObject(e.frame), this._clampFrameIfNeeded({ session: e }), this._bindCanvasSelectionEvents({ session: e }), t.requestRenderAll(), t.fire("editor:crop:started", this.getState());
16648
16698
  }
16649
16699
  _bindCropFrameEvents({ frame: e }) {
16650
- e.on("moving", this._handleCropFrameChanged), e.on("scaling", this._handleCropFrameChanged), e.on("modified", this._handleCropFrameChanged);
16700
+ e.on("moving", this._handleCropFrameChanged), e.on("scaling", this._handleCropFrameChanged), e.on("modified", this._handleCropFrameModified);
16651
16701
  }
16652
16702
  _unbindCropFrameEvents({ frame: e }) {
16653
- e.off("moving", this._handleCropFrameChanged), e.off("scaling", this._handleCropFrameChanged), e.off("modified", this._handleCropFrameChanged);
16703
+ e.off("moving", this._handleCropFrameChanged), e.off("scaling", this._handleCropFrameChanged), e.off("modified", this._handleCropFrameModified);
16654
16704
  }
16655
16705
  _bindCanvasSelectionEvents({ session: e }) {
16656
16706
  e.options.cancelOnSelectionClear && (this.editor.canvas.on("mouse:down:before", this._handleCanvasMouseDownBefore), this.editor.canvas.on("selection:cleared", this._handleCanvasSelectionChanged), this.editor.canvas.on("selection:updated", this._handleCanvasSelectionChanged));
@@ -16702,7 +16752,7 @@ var dd = {
16702
16752
  }) : !1;
16703
16753
  }
16704
16754
  _restoreFrameScaleAnchorFromTransform({ session: e, transform: t }) {
16705
- let n = Yu({ session: e }), r = this._getAnchoredSourceBoundRectFromTransform({
16755
+ let n = ed({ session: e }), r = this._getAnchoredSourceBoundRectFromTransform({
16706
16756
  transform: t,
16707
16757
  size: {
16708
16758
  width: n.width,
@@ -16782,7 +16832,7 @@ var dd = {
16782
16832
  if (!i || typeof a != "number" || typeof o != "number" || a === 0 || o === 0) return null;
16783
16833
  let s = n ?? e.scaleX ?? a, c = r ?? e.scaleY ?? o;
16784
16834
  if (!Number.isFinite(s) || !Number.isFinite(c)) return null;
16785
- let l = t.cropSourceScaleAnchorX ?? this._getTransformAnchorX({ transform: t }), u = t.cropSourceScaleAnchorY ?? this._getTransformAnchorY({ transform: t }), d = Al({
16835
+ let l = t.cropSourceScaleAnchorX ?? this._getTransformAnchorX({ transform: t }), u = t.cropSourceScaleAnchorY ?? this._getTransformAnchorY({ transform: t }), d = Pl({
16786
16836
  sourceSize: i.sourceSize,
16787
16837
  startRect: i.startRect,
16788
16838
  anchorX: l,
@@ -16790,7 +16840,7 @@ var dd = {
16790
16840
  });
16791
16841
  if (!d) return null;
16792
16842
  let f = Math.max(Math.abs(s / a), Math.abs(c / o)), p = Math.max(0, d.scale - f) * Math.min(i.startRect.width, i.startRect.height);
16793
- if (f <= d.scale + pd && p > md) return null;
16843
+ if (f <= d.scale + vd && p > yd) return null;
16794
16844
  let m = {
16795
16845
  scaleX: a * d.scale,
16796
16846
  scaleY: o * d.scale
@@ -16867,28 +16917,28 @@ var dd = {
16867
16917
  _clampFrameIfNeeded({ session: e, preserveAspectRatio: t = !1 }) {
16868
16918
  if (!e.options.allowFrameOverflow) {
16869
16919
  if (t) {
16870
- hl({
16920
+ yl({
16871
16921
  source: e.source,
16872
16922
  frame: e.frame
16873
16923
  });
16874
16924
  return;
16875
16925
  }
16876
- ml({
16926
+ vl({
16877
16927
  source: e.source,
16878
16928
  frame: e.frame
16879
16929
  });
16880
16930
  }
16881
16931
  }
16882
16932
  _applySessionCrop({ session: e }) {
16883
- let t = e.options.allowFrameOverflow ? void 0 : Z({ source: e.source }), n = Xu({
16884
- rect: Yu({ session: e }),
16933
+ let t = e.options.allowFrameOverflow ? void 0 : Z({ source: e.source }), n = td({
16934
+ rect: ed({ session: e }),
16885
16935
  sourceSize: t
16886
16936
  });
16887
- return e.mode === "canvas" ? nd({
16937
+ return e.mode === "canvas" ? sd({
16888
16938
  editor: this.editor,
16889
16939
  frame: e.frame,
16890
16940
  rect: n
16891
- }) : rd({
16941
+ }) : cd({
16892
16942
  editor: this.editor,
16893
16943
  target: e.target,
16894
16944
  frame: e.frame,
@@ -16897,7 +16947,7 @@ var dd = {
16897
16947
  }
16898
16948
  _finishSession({ nextActiveObject: e }) {
16899
16949
  let { _session: t } = this;
16900
- t && (this._unbindCropFrameEvents({ frame: t.frame }), this._unbindCanvasSelectionEvents(), this.editor.canvas.remove(t.frame), this._restoreSceneObjects({ interactivity: t.interactivity }), this.editor.historyManager.resumeHistory(), this._session = null, this._restoreActiveObject({ object: e }), this.editor.toolbar.showAfterTemporary(), this.editor.canvas.requestRenderAll());
16950
+ t && (this._unbindCropFrameEvents({ frame: t.frame }), this._unbindCanvasSelectionEvents(), this.editor.canvas.remove(t.frame), this._restoreSceneObjects({ interactivity: t.interactivity }), this.editor.historyManager.resumeHistory(), this._activeResizePreserveAspectRatio = null, this._session = null, this._restoreActiveObject({ object: e }), this.editor.toolbar.showAfterTemporary(), this.editor.canvas.requestRenderAll());
16901
16951
  }
16902
16952
  _disableSceneObjects() {
16903
16953
  return this.editor.canvasManager.getObjects().map((e) => {
@@ -16956,13 +17006,13 @@ var dd = {
16956
17006
  }
16957
17007
  });
16958
17008
  }
16959
- }, gd = class e {
17009
+ }, xd = class e {
16960
17010
  constructor(e, t) {
16961
17011
  this.options = t, this.containerId = e, this.editorId = `${e}-${D()}`, this.init();
16962
17012
  }
16963
17013
  async init() {
16964
17014
  let { editorContainerWidth: e, editorContainerHeight: n, canvasWrapperWidth: r, canvasWrapperHeight: i, canvasCSSWidth: a, canvasCSSHeight: o, initialImage: s, initialState: c, scaleType: l, showRotationAngle: u, showObjectSizeOnScale: d, showViewportScrollbars: f, _onReadyCallback: p } = this.options;
16965
- if (ve.apply(), this.canvas = new t(this.containerId, this.options), this.moduleLoader = new ee(), this.workerManager = new ne(), this.errorManager = new Qa({ editor: this }), this.historyManager = new Wt({ editor: this }), this.toolbar = new at({ editor: this }), this.transformManager = new tn({ editor: this }), this.zoomManager = new nn({ editor: this }), this.canvasManager = new en({ editor: this }), this.imageManager = new Xt({ editor: this }), this.layerManager = new Wn({ editor: this }), this.shapeManager = new Wa({ editor: this }), this.interactionBlocker = new Hn({ editor: this }), this.backgroundManager = new Un({ editor: this }), this.clipboardManager = new Ka({ editor: this }), this.objectLockManager = new qa({ editor: this }), this.groupingManager = new Ja({ editor: this }), this.selectionManager = new Ya({ editor: this }), this.deletionManager = new Xa({ editor: this }), this.panConstraintManager = new eo({ editor: this }), this.snappingManager = new il({ editor: this }), this.measurementManager = new ol({ editor: this }), this.fontManager = new ye(this.options.fonts ?? []), this.textManager = new xo({ editor: this }), this.templateManager = new Eo({ editor: this }), this.cropManager = new hd({ editor: this }), u && (this.angleIndicator = new lt({ editor: this })), d && (this.objectSizeIndicator = new ft({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.interactionBlocker.ensureOverlay(), this.listeners = new F({
17015
+ if (ve.apply(), this.canvas = new t(this.containerId, this.options), this.moduleLoader = new ee(), this.workerManager = new ne(), this.errorManager = new Qa({ editor: this }), this.historyManager = new Wt({ editor: this }), this.toolbar = new at({ editor: this }), this.transformManager = new tn({ editor: this }), this.zoomManager = new nn({ editor: this }), this.canvasManager = new en({ editor: this }), this.imageManager = new Xt({ editor: this }), this.layerManager = new Wn({ editor: this }), this.shapeManager = new Wa({ editor: this }), this.interactionBlocker = new Hn({ editor: this }), this.backgroundManager = new Un({ editor: this }), this.clipboardManager = new Ka({ editor: this }), this.objectLockManager = new qa({ editor: this }), this.groupingManager = new Ja({ editor: this }), this.selectionManager = new Ya({ editor: this }), this.deletionManager = new Xa({ editor: this }), this.panConstraintManager = new eo({ editor: this }), this.snappingManager = new cl({ editor: this }), this.measurementManager = new ul({ editor: this }), this.fontManager = new ye(this.options.fonts ?? []), this.textManager = new xo({ editor: this }), this.templateManager = new Eo({ editor: this }), this.cropManager = new bd({ editor: this }), u && (this.angleIndicator = new lt({ editor: this })), d && (this.objectSizeIndicator = new ft({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.interactionBlocker.ensureOverlay(), this.listeners = new F({
16966
17016
  editor: this,
16967
17017
  options: this.options
16968
17018
  }), this.canvasManager.setEditorContainerWidth(e), this.canvasManager.setEditorContainerHeight(n), this.canvasManager.setCanvasWrapperWidth(r), this.canvasManager.setCanvasWrapperHeight(i), this.canvasManager.setCanvasCSSWidth(a), this.canvasManager.setCanvasCSSHeight(o), this.canvasManager.updateCanvas(), this.zoomManager.calculateAndApplyDefaultZoom(), f && (this.viewportScrollbars = new vt({ editor: this })), await this.fontManager.loadFonts(), c) {
@@ -17070,7 +17120,7 @@ var dd = {
17070
17120
  "U+A640-A69F",
17071
17121
  "U+FE2E-FE2F",
17072
17122
  "U+2116"
17073
- ].join(", "), _d = {
17123
+ ].join(", "), Sd = {
17074
17124
  preserveObjectStacking: !0,
17075
17125
  controlsAboveOverlay: !0,
17076
17126
  centeredRotation: !0,
@@ -17928,20 +17978,20 @@ var dd = {
17928
17978
  };
17929
17979
  //#endregion
17930
17980
  //#region src/main.ts
17931
- function vd(e, t = {}) {
17981
+ function Cd(e, t = {}) {
17932
17982
  let n = {
17933
- ..._d,
17983
+ ...Sd,
17934
17984
  ...t
17935
17985
  }, r = document.getElementById(e);
17936
17986
  if (!r) return Promise.reject(/* @__PURE__ */ Error(`Контейнер с ID "${e}" не найден.`));
17937
17987
  let i = document.createElement("canvas");
17938
17988
  return i.id = `${e}-canvas`, r.appendChild(i), n.editorContainer = r, new Promise((t) => {
17939
17989
  n._onReadyCallback = t;
17940
- let r = new gd(i.id, n);
17990
+ let r = new xd(i.id, n);
17941
17991
  window[e] = r;
17942
17992
  });
17943
17993
  }
17944
17994
  //#endregion
17945
- export { vd as default };
17995
+ export { Cd as default };
17946
17996
 
17947
17997
  //# sourceMappingURL=main.js.map