sykpcomposer 1.19.53 → 1.19.55

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.
@@ -1,6 +1,6 @@
1
- import { j as D, u as ce, a as ae, d as G, w as q, x as J, $ as Q, b as ne, c as de, e as le, f as ge, C as I, g as ue, k as pe, h as we, I as me, r as xe, i as fe, l as ye, L as Ce, P as ve, m as De, t as be } from "./index-ece3f8e5.js";
2
- import { d as Re } from "./LexicalNestedComposer.prod-916526de.js";
3
- import f, { useRef as Y, PureComponent as Ee, createRef as re, useState as U, useCallback as V, useEffect as te, Suspense as Me } from "react";
1
+ import { j as v, u as ce, a as ae, d as G, w as q, x as J, $ as Q, b as ne, c as de, e as le, f as ge, C as _, g as ue, k as pe, h as we, I as me, r as xe, i as fe, l as ye, L as Ce, P as ve, m as De, t as be } from "./index-027f44c6.js";
2
+ import { d as Re } from "./LexicalNestedComposer.prod-2196d393.js";
3
+ import f, { useRef as L, PureComponent as Ee, createRef as re, useState as K, useCallback as V, useEffect as te, Suspense as Me } from "react";
4
4
  import "react-dom";
5
5
  function ee(l, t, e) {
6
6
  return Math.min(Math.max(l, t), e);
@@ -22,10 +22,10 @@ function Pe({
22
22
  setShowCaption: p,
23
23
  captionsEnabled: s
24
24
  }) {
25
- const i = Y(null), d = Y({
25
+ const i = L(null), d = L({
26
26
  priority: "",
27
27
  value: "default"
28
- }), a = Y({
28
+ }), a = L({
29
29
  currentHeight: 0,
30
30
  currentWidth: 0,
31
31
  direction: 0,
@@ -36,14 +36,14 @@ function Pe({
36
36
  startX: 0,
37
37
  startY: 0
38
38
  }), g = r.getRootElement(), c = g !== null ? g.getBoundingClientRect().width - 20 : 100, C = g !== null ? g.getBoundingClientRect().height - 20 : 100, P = 100, x = 100, $ = (w) => {
39
- const u = w === y.east || w === y.west, m = w === y.north || w === y.south, H = w & y.north && w & y.west || w & y.south && w & y.east, M = u ? "ew" : m ? "ns" : H ? "nwse" : "nesw";
39
+ const u = w === y.east || w === y.west, m = w === y.north || w === y.south, H = w & y.north && w & y.west || w & y.south && w & y.east, E = u ? "ew" : m ? "ns" : H ? "nwse" : "nesw";
40
40
  g !== null && g.style.setProperty(
41
41
  "cursor",
42
- `${M}-resize`,
42
+ `${E}-resize`,
43
43
  "important"
44
44
  ), document.body !== null && (document.body.style.setProperty(
45
45
  "cursor",
46
- `${M}-resize`,
46
+ `${E}-resize`,
47
47
  "important"
48
48
  ), d.current.value = document.body.style.getPropertyValue(
49
49
  "-webkit-user-select"
@@ -54,7 +54,7 @@ function Pe({
54
54
  "none",
55
55
  "important"
56
56
  ));
57
- }, F = () => {
57
+ }, U = () => {
58
58
  g !== null && g.style.setProperty("cursor", "text"), document.body !== null && (document.body.style.setProperty("cursor", "default"), document.body.style.setProperty(
59
59
  "-webkit-user-select",
60
60
  d.current.value,
@@ -66,51 +66,51 @@ function Pe({
66
66
  const m = o.current, H = i.current;
67
67
  if (m !== null && H !== null) {
68
68
  w.preventDefault();
69
- const { width: M, height: b } = m.getBoundingClientRect(), v = a.current;
70
- v.startWidth = M, v.startHeight = b, v.ratio = M / b, v.currentWidth = M, v.currentHeight = b, v.startX = w.clientX, v.startY = w.clientY, v.isResizing = !0, v.direction = u, $(u), l(), H.classList.add("image-control-wrapper--resizing"), m.style.height = `${b}px`, m.style.width = `${M}px`, document.addEventListener("pointermove", L), document.addEventListener("pointerup", k);
69
+ const { width: E, height: b } = m.getBoundingClientRect(), D = a.current;
70
+ D.startWidth = E, D.startHeight = b, D.ratio = E / b, D.currentWidth = E, D.currentHeight = b, D.startX = w.clientX, D.startY = w.clientY, D.isResizing = !0, D.direction = u, $(u), l(), H.classList.add("image-control-wrapper--resizing"), m.style.height = `${b}px`, m.style.width = `${E}px`, document.addEventListener("pointermove", j), document.addEventListener("pointerup", k);
71
71
  }
72
- }, L = (w) => {
73
- const u = o.current, m = a.current, H = m.direction & (y.east | y.west), M = m.direction & (y.south | y.north);
72
+ }, j = (w) => {
73
+ const u = o.current, m = a.current, H = m.direction & (y.east | y.west), E = m.direction & (y.south | y.north);
74
74
  if (u !== null && m.isResizing) {
75
- if (H && M) {
75
+ if (H && E) {
76
76
  let b = Math.floor(m.startX - w.clientX);
77
77
  b = m.direction & y.east ? -b : b;
78
- const v = ee(
78
+ const D = ee(
79
79
  m.startWidth + b,
80
80
  P,
81
81
  c
82
- ), j = v / m.ratio;
83
- u.style.width = `${v}px`, u.style.height = `${j}px`, m.currentHeight = j, m.currentWidth = v;
84
- } else if (M) {
82
+ ), I = D / m.ratio;
83
+ u.style.width = `${D}px`, u.style.height = `${I}px`, m.currentHeight = I, m.currentWidth = D;
84
+ } else if (E) {
85
85
  let b = Math.floor(m.startY - w.clientY);
86
86
  b = m.direction & y.south ? -b : b;
87
- const v = ee(
87
+ const D = ee(
88
88
  m.startHeight + b,
89
89
  x,
90
90
  C
91
91
  );
92
- u.style.height = `${v}px`, u.style.maxHeight = `${v}px`, m.currentHeight = v;
92
+ u.style.height = `${D}px`, u.style.maxHeight = `${D}px`, m.currentHeight = D;
93
93
  } else {
94
94
  let b = Math.floor(m.startX - w.clientX);
95
95
  b = m.direction & y.east ? -b : b;
96
- const v = ee(
96
+ const D = ee(
97
97
  m.startWidth + b,
98
98
  P,
99
99
  c
100
100
  );
101
- u.style.width = `${v}px`, u.style.maxWidth = `${v}px`, m.currentWidth = v;
101
+ u.style.width = `${D}px`, u.style.maxWidth = `${D}px`, m.currentWidth = D;
102
102
  }
103
103
  u && (u.setAttribute("width", `${m.currentWidth}`), u.setAttribute("height", `${m.currentHeight}`));
104
104
  }
105
105
  }, k = () => {
106
106
  const w = o.current, u = a.current, m = i.current;
107
107
  if (w !== null && m !== null && u.isResizing) {
108
- const H = u.currentWidth, M = u.currentHeight;
109
- u.startWidth = 0, u.startHeight = 0, u.ratio = 0, u.startX = 0, u.startY = 0, u.currentWidth = 0, u.currentHeight = 0, u.isResizing = !1, m.classList.remove("image-control-wrapper--resizing"), F(), t(H, M), document.removeEventListener("pointermove", L), document.removeEventListener("pointerup", k);
108
+ const H = u.currentWidth, E = u.currentHeight;
109
+ u.startWidth = 0, u.startHeight = 0, u.ratio = 0, u.startX = 0, u.startY = 0, u.currentWidth = 0, u.currentHeight = 0, u.isResizing = !1, m.classList.remove("image-control-wrapper--resizing"), U(), t(H, E), document.removeEventListener("pointermove", j), document.removeEventListener("pointerup", k);
110
110
  }
111
111
  };
112
- return /* @__PURE__ */ D.jsxs("div", { ref: i, children: [
113
- /* @__PURE__ */ D.jsx(
112
+ return /* @__PURE__ */ v.jsxs("div", { ref: i, children: [
113
+ /* @__PURE__ */ v.jsx(
114
114
  "div",
115
115
  {
116
116
  className: "image-resizer image-resizer-n",
@@ -119,7 +119,7 @@ function Pe({
119
119
  }
120
120
  }
121
121
  ),
122
- /* @__PURE__ */ D.jsx(
122
+ /* @__PURE__ */ v.jsx(
123
123
  "div",
124
124
  {
125
125
  className: "image-resizer image-resizer-ne",
@@ -128,7 +128,7 @@ function Pe({
128
128
  }
129
129
  }
130
130
  ),
131
- /* @__PURE__ */ D.jsx(
131
+ /* @__PURE__ */ v.jsx(
132
132
  "div",
133
133
  {
134
134
  className: "image-resizer image-resizer-e",
@@ -137,7 +137,7 @@ function Pe({
137
137
  }
138
138
  }
139
139
  ),
140
- /* @__PURE__ */ D.jsx(
140
+ /* @__PURE__ */ v.jsx(
141
141
  "div",
142
142
  {
143
143
  className: "image-resizer image-resizer-se",
@@ -146,7 +146,7 @@ function Pe({
146
146
  }
147
147
  }
148
148
  ),
149
- /* @__PURE__ */ D.jsx(
149
+ /* @__PURE__ */ v.jsx(
150
150
  "div",
151
151
  {
152
152
  className: "image-resizer image-resizer-s",
@@ -155,7 +155,7 @@ function Pe({
155
155
  }
156
156
  }
157
157
  ),
158
- /* @__PURE__ */ D.jsx(
158
+ /* @__PURE__ */ v.jsx(
159
159
  "div",
160
160
  {
161
161
  className: "image-resizer image-resizer-sw",
@@ -164,7 +164,7 @@ function Pe({
164
164
  }
165
165
  }
166
166
  ),
167
- /* @__PURE__ */ D.jsx(
167
+ /* @__PURE__ */ v.jsx(
168
168
  "div",
169
169
  {
170
170
  className: "image-resizer image-resizer-w",
@@ -173,7 +173,7 @@ function Pe({
173
173
  }
174
174
  }
175
175
  ),
176
- /* @__PURE__ */ D.jsx(
176
+ /* @__PURE__ */ v.jsx(
177
177
  "div",
178
178
  {
179
179
  className: "image-resizer image-resizer-nw",
@@ -190,7 +190,7 @@ const Z = {
190
190
  width: 0,
191
191
  height: 0,
192
192
  unit: "px"
193
- }, O = (l, t, e) => Math.min(Math.max(l, t), e), He = (...l) => l.filter((t) => t && typeof t == "string").join(" "), ie = (l, t) => l === t || l.width === t.width && l.height === t.height && l.x === t.x && l.y === t.y && l.unit === t.unit;
193
+ }, B = (l, t, e) => Math.min(Math.max(l, t), e), He = (...l) => l.filter((t) => t && typeof t == "string").join(" "), ie = (l, t) => l === t || l.width === t.width && l.height === t.height && l.x === t.x && l.y === t.y && l.unit === t.unit;
194
194
  function W(l, t, e) {
195
195
  return l.unit === "%" ? { ...Z, ...l, unit: "%" } : {
196
196
  unit: "%",
@@ -200,7 +200,7 @@ function W(l, t, e) {
200
200
  height: l.height ? l.height / e * 100 : 0
201
201
  };
202
202
  }
203
- function _(l, t, e) {
203
+ function X(l, t, e) {
204
204
  return l.unit ? l.unit === "px" ? { ...Z, ...l, unit: "px" } : {
205
205
  unit: "px",
206
206
  x: l.x ? l.x * t / 100 : 0,
@@ -232,9 +232,9 @@ function $e(l, t, e, o) {
232
232
  const n = { ...l };
233
233
  return t === "ArrowLeft" ? o === "nw" ? (n.x -= e, n.y -= e, n.width += e, n.height += e) : o === "w" ? (n.x -= e, n.width += e) : o === "sw" ? (n.x -= e, n.width += e, n.height += e) : o === "ne" ? (n.y += e, n.width -= e, n.height -= e) : o === "e" ? n.width -= e : o === "se" && (n.width -= e, n.height -= e) : t === "ArrowRight" && (o === "nw" ? (n.x += e, n.y += e, n.width -= e, n.height -= e) : o === "w" ? (n.x += e, n.width -= e) : o === "sw" ? (n.x += e, n.width -= e, n.height -= e) : o === "ne" ? (n.y -= e, n.width += e, n.height += e) : o === "e" ? n.width += e : o === "se" && (n.width += e, n.height += e)), t === "ArrowUp" ? o === "nw" ? (n.x -= e, n.y -= e, n.width += e, n.height += e) : o === "n" ? (n.y -= e, n.height += e) : o === "ne" ? (n.y -= e, n.width += e, n.height += e) : o === "sw" ? (n.x += e, n.width -= e, n.height -= e) : o === "s" ? n.height -= e : o === "se" && (n.width -= e, n.height -= e) : t === "ArrowDown" && (o === "nw" ? (n.x += e, n.y += e, n.width -= e, n.height -= e) : o === "n" ? (n.y += e, n.height -= e) : o === "ne" ? (n.y += e, n.width -= e, n.height -= e) : o === "sw" ? (n.x -= e, n.width += e, n.height += e) : o === "s" ? n.height += e : o === "se" && (n.width += e, n.height += e)), n;
234
234
  }
235
- const K = { capture: !0, passive: !1 };
235
+ const O = { capture: !0, passive: !1 };
236
236
  let ze = 0;
237
- const X = class S extends Ee {
237
+ const Y = class S extends Ee {
238
238
  constructor() {
239
239
  super(...arguments), this.docMoveBound = !1, this.mouseDownOnCrop = !1, this.dragStarted = !1, this.evData = {
240
240
  startClientX: 0,
@@ -251,7 +251,7 @@ const X = class S extends Ee {
251
251
  const { crop: e, disabled: o } = this.props, n = this.getBox();
252
252
  if (!e)
253
253
  return;
254
- const r = _(e, n.width, n.height);
254
+ const r = X(e, n.width, n.height);
255
255
  if (o)
256
256
  return;
257
257
  t.cancelable && t.preventDefault(), this.bindDocMove(), this.componentRef.current.focus({ preventScroll: !0 });
@@ -292,7 +292,7 @@ const X = class S extends Ee {
292
292
  clientX: t.clientX,
293
293
  clientY: t.clientY,
294
294
  isResize: !0
295
- }, this.mouseDownOnCrop = !0, h(_(d, p.width, p.height), W(d, p.width, p.height)), this.setState({ cropIsActive: !0, newCropIsBeingDrawn: !0 });
295
+ }, this.mouseDownOnCrop = !0, h(X(d, p.width, p.height), W(d, p.width, p.height)), this.setState({ cropIsActive: !0, newCropIsBeingDrawn: !0 });
296
296
  }, this.onDocPointerMove = (t) => {
297
297
  const { crop: e, disabled: o, onChange: n, onDragStart: r } = this.props, h = this.getBox();
298
298
  if (o || !e || !this.mouseDownOnCrop)
@@ -302,7 +302,7 @@ const X = class S extends Ee {
302
302
  p.clientX = t.clientX, p.clientY = t.clientY;
303
303
  let s;
304
304
  p.isResize ? s = this.resizeCrop() : s = this.dragCrop(), ie(e, s) || n(
305
- _(s, h.width, h.height),
305
+ X(s, h.width, h.height),
306
306
  W(s, h.width, h.height)
307
307
  );
308
308
  }, this.onComponentKeyDown = (t) => {
@@ -315,8 +315,8 @@ const X = class S extends Ee {
315
315
  return;
316
316
  const s = this.getBox(), i = this.makePixelCrop(s), d = (navigator.platform.match("Mac") ? t.metaKey : t.ctrlKey) ? S.nudgeStepLarge : t.shiftKey ? S.nudgeStepMedium : S.nudgeStep;
317
317
  if (h === "ArrowLeft" ? (i.x -= d, p = !0) : h === "ArrowRight" ? (i.x += d, p = !0) : h === "ArrowUp" ? (i.y -= d, p = !0) : h === "ArrowDown" && (i.y += d, p = !0), p) {
318
- t.cancelable && t.preventDefault(), i.x = O(i.x, 0, s.width - i.width), i.y = O(i.y, 0, s.height - i.height);
319
- const a = _(i, s.width, s.height), g = W(i, s.width, s.height);
318
+ t.cancelable && t.preventDefault(), i.x = B(i.x, 0, s.width - i.width), i.y = B(i.y, 0, s.height - i.height);
319
+ const a = X(i, s.width, s.height), g = W(i, s.width, s.height);
320
320
  n(a, g), r && r(a, g);
321
321
  }
322
322
  }, this.onHandlerKeyDown = (t, e) => {
@@ -337,7 +337,7 @@ const X = class S extends Ee {
337
337
  t.stopPropagation(), t.preventDefault();
338
338
  else
339
339
  return;
340
- const c = (navigator.platform.match("Mac") ? t.metaKey : t.ctrlKey) ? S.nudgeStepLarge : t.shiftKey ? S.nudgeStepMedium : S.nudgeStep, C = _(n, g.width, g.height), P = $e(C, t.key, c, e), x = oe(
340
+ const c = (navigator.platform.match("Mac") ? t.metaKey : t.ctrlKey) ? S.nudgeStepLarge : t.shiftKey ? S.nudgeStepMedium : S.nudgeStep, C = X(n, g.width, g.height), P = $e(C, t.key, c, e), x = oe(
341
341
  P,
342
342
  o,
343
343
  e,
@@ -354,7 +354,7 @@ const X = class S extends Ee {
354
354
  }
355
355
  }, this.onDocPointerDone = (t) => {
356
356
  const { crop: e, disabled: o, onComplete: n, onDragEnd: r } = this.props, h = this.getBox();
357
- this.unbindDocMove(), !(o || !e) && this.mouseDownOnCrop && (this.mouseDownOnCrop = !1, this.dragStarted = !1, r && r(t), n && n(_(e, h.width, h.height), W(e, h.width, h.height)), this.setState({ cropIsActive: !1, newCropIsBeingDrawn: !1 }));
357
+ this.unbindDocMove(), !(o || !e) && this.mouseDownOnCrop && (this.mouseDownOnCrop = !1, this.dragStarted = !1, r && r(t), n && n(X(e, h.width, h.height), W(e, h.width, h.height)), this.setState({ cropIsActive: !1, newCropIsBeingDrawn: !1 }));
358
358
  }, this.onDragFocus = () => {
359
359
  var t;
360
360
  (t = this.componentRef.current) == null || t.scrollTo(0, 0);
@@ -376,17 +376,17 @@ const X = class S extends Ee {
376
376
  const { crop: e, onComplete: o } = this.props;
377
377
  if (o && !t.crop && e) {
378
378
  const { width: n, height: r } = this.getBox();
379
- n && r && o(_(e, n, r), W(e, n, r));
379
+ n && r && o(X(e, n, r), W(e, n, r));
380
380
  }
381
381
  }
382
382
  componentWillUnmount() {
383
383
  this.resizeObserver && this.resizeObserver.disconnect(), this.unbindDocMove();
384
384
  }
385
385
  bindDocMove() {
386
- this.docMoveBound || (this.document.addEventListener("pointermove", this.onDocPointerMove, K), this.document.addEventListener("pointerup", this.onDocPointerDone, K), this.document.addEventListener("pointercancel", this.onDocPointerDone, K), this.docMoveBound = !0);
386
+ this.docMoveBound || (this.document.addEventListener("pointermove", this.onDocPointerMove, O), this.document.addEventListener("pointerup", this.onDocPointerDone, O), this.document.addEventListener("pointercancel", this.onDocPointerDone, O), this.docMoveBound = !0);
387
387
  }
388
388
  unbindDocMove() {
389
- this.docMoveBound && (this.document.removeEventListener("pointermove", this.onDocPointerMove, K), this.document.removeEventListener("pointerup", this.onDocPointerDone, K), this.document.removeEventListener("pointercancel", this.onDocPointerDone, K), this.docMoveBound = !1);
389
+ this.docMoveBound && (this.document.removeEventListener("pointermove", this.onDocPointerMove, O), this.document.removeEventListener("pointerup", this.onDocPointerDone, O), this.document.removeEventListener("pointercancel", this.onDocPointerDone, O), this.docMoveBound = !1);
390
390
  }
391
391
  getCropStyle() {
392
392
  const { crop: t } = this.props;
@@ -400,7 +400,7 @@ const X = class S extends Ee {
400
400
  }
401
401
  dragCrop() {
402
402
  const { evData: t } = this, e = this.getBox(), o = this.makePixelCrop(e), n = t.clientX - t.startClientX, r = t.clientY - t.startClientY;
403
- return o.x = O(t.startCropX + n, 0, e.width - o.width), o.y = O(t.startCropY + r, 0, e.height - o.height), o;
403
+ return o.x = B(t.startCropX + n, 0, e.width - o.width), o.y = B(t.startCropY + r, 0, e.height - o.height), o;
404
404
  }
405
405
  getPointRegion(t, e, o, n) {
406
406
  const { evData: r } = this, h = r.clientX - t.x, p = r.clientY - t.y;
@@ -438,7 +438,7 @@ const X = class S extends Ee {
438
438
  o,
439
439
  n
440
440
  );
441
- return e || S.xyOrds.indexOf(d) > -1 ? s = C : S.xOrds.indexOf(d) > -1 ? (s.x = C.x, s.width = C.width) : S.yOrds.indexOf(d) > -1 && (s.y = C.y, s.height = C.height), s.x = O(s.x, 0, r.width - s.width), s.y = O(s.y, 0, r.height - s.height), s;
441
+ return e || S.xyOrds.indexOf(d) > -1 ? s = C : S.xOrds.indexOf(d) > -1 ? (s.x = C.x, s.width = C.width) : S.yOrds.indexOf(d) > -1 && (s.y = C.y, s.height = C.height), s.x = B(s.x, 0, r.width - s.width), s.y = B(s.y, 0, r.height - s.height), s;
442
442
  }
443
443
  renderCropSelection() {
444
444
  const {
@@ -548,7 +548,7 @@ const X = class S extends Ee {
548
548
  }
549
549
  makePixelCrop(t) {
550
550
  const e = { ...Z, ...this.props.crop || {} };
551
- return _(e, t.width, t.height);
551
+ return X(e, t.width, t.height);
552
552
  }
553
553
  render() {
554
554
  const { aspect: t, children: e, circularCrop: o, className: n, crop: r, disabled: h, locked: p, style: s, ruleOfThirds: i } = this.props, { cropIsActive: d, newCropIsBeingDrawn: a } = this.state, g = r ? this.renderCropSelection() : null, c = He(
@@ -585,7 +585,7 @@ const X = class S extends Ee {
585
585
  ))), /* @__PURE__ */ f.createElement("rect", { fill: "black", fillOpacity: 0.5, width: "100%", height: "100%", mask: `url(#hole-${this.instanceId})` })) : void 0, g);
586
586
  }
587
587
  };
588
- X.xOrds = ["e", "w"], X.yOrds = ["n", "s"], X.xyOrds = ["nw", "ne", "se", "sw"], X.nudgeStep = 1, X.nudgeStepMedium = 10, X.nudgeStepLarge = 100, X.defaultProps = {
588
+ Y.xOrds = ["e", "w"], Y.yOrds = ["n", "s"], Y.xyOrds = ["nw", "ne", "se", "sw"], Y.nudgeStep = 1, Y.nudgeStepMedium = 10, Y.nudgeStepLarge = 100, Y.defaultProps = {
589
589
  ariaLabels: {
590
590
  cropArea: "Use the arrow keys to move the crop selection area",
591
591
  nwDragHandle: "Use the arrow keys to move the north west drag handle to change the crop selection area",
@@ -598,7 +598,7 @@ X.xOrds = ["e", "w"], X.yOrds = ["n", "s"], X.xyOrds = ["nw", "ne", "se", "sw"],
598
598
  wDragHandle: "Use the up and down arrow keys to move the west drag handle to change the crop selection area"
599
599
  }
600
600
  };
601
- let Ne = X;
601
+ let Ne = Y;
602
602
  const se = be();
603
603
  function Se({
604
604
  altText: l,
@@ -613,7 +613,7 @@ function Se({
613
613
  isFocused: i,
614
614
  nodeKey: d
615
615
  }) {
616
- const [a, g] = U(null), [c, C] = U(null), [P, x] = U({
616
+ const [a, g] = K(null), [c, C] = K(null), [P, x] = K({
617
617
  //@ts-ignore
618
618
  unit: "px",
619
619
  // Can be 'px' or '%'
@@ -621,15 +621,15 @@ function Se({
621
621
  y: 25,
622
622
  width: 50,
623
623
  height: 50
624
- }), [$] = ae(), F = () => {
624
+ }), [$] = ae(), U = () => {
625
625
  if (a) {
626
626
  const u = h.current;
627
627
  if (!u || !a)
628
628
  return;
629
- const m = u.naturalWidth / u.width, H = u.naturalHeight / u.height, M = new OffscreenCanvas(
629
+ const m = u.naturalWidth / u.width, H = u.naturalHeight / u.height, E = new OffscreenCanvas(
630
630
  a.width * m,
631
631
  a.height * H
632
- ), b = M.getContext("2d");
632
+ ), b = E.getContext("2d");
633
633
  if (!b)
634
634
  throw new Error("No 2D context available");
635
635
  b.drawImage(
@@ -642,19 +642,18 @@ function Se({
642
642
  0,
643
643
  a.width * m,
644
644
  a.height * H
645
- ), M.convertToBlob({ type: "image/png" }).then((v) => {
646
- const j = URL.createObjectURL(v);
647
- C(j), s(!1);
648
- const A = new FileReader();
649
- A.onload = () => {
650
- const B = A.result;
651
- $.update(() => {
652
- const R = J(d);
653
- Q(R) && B && R.setSrc(B);
645
+ ), E.convertToBlob({ type: "image/png" }).then((D) => {
646
+ s(!1);
647
+ const I = new FileReader();
648
+ I.onload = () => {
649
+ const F = I.result;
650
+ C(F), $.update(() => {
651
+ const A = J(d);
652
+ Q(A) && F && A.setSrc(F);
654
653
  });
655
- }, A.onerror = () => {
654
+ }, I.onerror = () => {
656
655
  console.log("error");
657
- }, A.readAsDataURL(v);
656
+ }, I.readAsDataURL(D);
658
657
  });
659
658
  }
660
659
  }, z = () => {
@@ -672,17 +671,17 @@ function Se({
672
671
  }
673
672
  return !u;
674
673
  });
675
- }, L = Y(null), k = Y(null);
674
+ }, j = L(null), k = L(null);
676
675
  te(() => {
677
- a && (L.current = a);
676
+ a && (j.current = a);
678
677
  }, [a]);
679
678
  const w = (u) => {
680
679
  k.current && !k.current.contains(u.target) && s(!1);
681
680
  };
682
681
  return te(() => (document.addEventListener("mousedown", w), () => {
683
682
  document.removeEventListener("mousedown", w);
684
- }), []), /* @__PURE__ */ D.jsxs("div", { ref: k, children: [
685
- i && /* @__PURE__ */ D.jsx(
683
+ }), []), /* @__PURE__ */ v.jsxs("div", { ref: k, children: [
684
+ i && /* @__PURE__ */ v.jsx(
686
685
  "button",
687
686
  {
688
687
  style: { zIndex: 999 },
@@ -691,22 +690,22 @@ function Se({
691
690
  children: "Crop"
692
691
  }
693
692
  ),
694
- p && /* @__PURE__ */ D.jsx(
693
+ p && /* @__PURE__ */ v.jsx(
695
694
  "button",
696
695
  {
697
696
  style: { zIndex: 999 },
698
697
  className: "image-caption-button",
699
- onClick: () => F(),
698
+ onClick: () => U(),
700
699
  children: "Apply Crop"
701
700
  }
702
701
  ),
703
- p ? /* @__PURE__ */ D.jsx(
702
+ p ? /* @__PURE__ */ v.jsx(
704
703
  Ne,
705
704
  {
706
705
  crop: P,
707
706
  onChange: (u) => x(u),
708
707
  onComplete: (u) => g(u),
709
- children: /* @__PURE__ */ D.jsx(
708
+ children: /* @__PURE__ */ v.jsx(
710
709
  "img",
711
710
  {
712
711
  className: t || void 0,
@@ -724,7 +723,7 @@ function Se({
724
723
  }
725
724
  ) : (
726
725
  // When startCrop is false, show the cropped image or original image
727
- /* @__PURE__ */ D.jsx(
726
+ /* @__PURE__ */ v.jsx(
728
727
  "img",
729
728
  {
730
729
  className: t || void 0,
@@ -753,10 +752,10 @@ function Ye({
753
752
  showCaption: p,
754
753
  caption: s
755
754
  }) {
756
- const i = Y(null), d = Y(null), [a, g, c] = ce(e), [C, P] = U(!1), [x] = ae(), [$, F] = U(null), [z, L] = U(!1), k = Y(null), w = V(
757
- (R) => {
755
+ const i = L(null), d = L(null), [a, g, c] = ce(e), [C, P] = K(!1), [x] = ae(), [$, U] = K(null), [z, j] = K(!1), k = L(null), w = V(
756
+ (M) => {
758
757
  if (a && G(q())) {
759
- R.preventDefault();
758
+ M.preventDefault();
760
759
  const N = J(e);
761
760
  if (Q(N))
762
761
  return N.remove(), !0;
@@ -765,83 +764,83 @@ function Ye({
765
764
  },
766
765
  [a, e]
767
766
  ), u = V(
768
- (R) => {
769
- const E = q(), N = d.current;
770
- if (a && G(E) && E.getNodes().length === 1) {
767
+ (M) => {
768
+ const R = q(), N = d.current;
769
+ if (a && G(R) && R.getNodes().length === 1) {
771
770
  if (p)
772
- return ne(null), R.preventDefault(), s.focus(), !0;
771
+ return ne(null), M.preventDefault(), s.focus(), !0;
773
772
  if (N !== null && N !== document.activeElement)
774
- return R.preventDefault(), N.focus(), !0;
773
+ return M.preventDefault(), N.focus(), !0;
775
774
  }
776
775
  return !1;
777
776
  },
778
777
  [s, a, p]
779
778
  ), m = V(
780
- (R) => k.current === s || d.current === R.target ? (ne(null), x.update(() => {
779
+ (M) => k.current === s || d.current === M.target ? (ne(null), x.update(() => {
781
780
  g(!0);
782
- const E = x.getRootElement();
783
- E !== null && E.focus();
781
+ const R = x.getRootElement();
782
+ R !== null && R.focus();
784
783
  }), !0) : !1,
785
784
  [s, x, g]
786
785
  ), H = V(
787
- (R) => {
788
- const E = R;
789
- return C ? !0 : E.target === i.current ? (E.shiftKey ? g(!a) : (c(), g(!0)), !0) : !1;
786
+ (M) => {
787
+ const R = M;
788
+ return C ? !0 : R.target === i.current ? (R.shiftKey ? g(!a) : (c(), g(!0)), !0) : !1;
790
789
  },
791
790
  [C, a, g, c]
792
- ), M = V(
793
- (R) => {
791
+ ), E = V(
792
+ (M) => {
794
793
  x.getEditorState().read(() => {
795
- const E = q();
796
- R.target.tagName === "IMG" && de(E) && E.getNodes().length === 1 && x.dispatchCommand(
794
+ const R = q();
795
+ M.target.tagName === "IMG" && de(R) && R.getNodes().length === 1 && x.dispatchCommand(
797
796
  se,
798
- R
797
+ M
799
798
  );
800
799
  });
801
800
  },
802
801
  [x]
803
802
  );
804
803
  te(() => {
805
- let R = !0;
806
- const E = x.getRootElement(), N = le(
804
+ let M = !0;
805
+ const R = x.getRootElement(), N = le(
807
806
  x.registerUpdateListener(({ editorState: T }) => {
808
- R && F(T.read(() => q()));
807
+ M && U(T.read(() => q()));
809
808
  }),
810
809
  x.registerCommand(
811
810
  fe,
812
811
  (T, he) => (k.current = he, !1),
813
- I
812
+ _
814
813
  ),
815
814
  x.registerCommand(
816
815
  xe,
817
816
  H,
818
- I
817
+ _
819
818
  ),
820
819
  x.registerCommand(
821
820
  se,
822
821
  H,
823
- I
822
+ _
824
823
  ),
825
824
  x.registerCommand(
826
825
  me,
827
826
  (T) => T.target === i.current ? (T.preventDefault(), !0) : !1,
828
- I
827
+ _
829
828
  ),
830
829
  x.registerCommand(
831
830
  we,
832
831
  w,
833
- I
832
+ _
834
833
  ),
835
834
  x.registerCommand(
836
835
  pe,
837
836
  w,
838
- I
837
+ _
839
838
  ),
840
- x.registerCommand(ue, u, I),
841
- x.registerCommand(ge, m, I)
839
+ x.registerCommand(ue, u, _),
840
+ x.registerCommand(ge, m, _)
842
841
  );
843
- return E == null || E.addEventListener("contextmenu", M), () => {
844
- R = !1, N(), E == null || E.removeEventListener("contextmenu", M);
842
+ return R == null || R.addEventListener("contextmenu", E), () => {
843
+ M = !1, N(), R == null || R.removeEventListener("contextmenu", E);
845
844
  };
846
845
  }, [
847
846
  c,
@@ -853,29 +852,29 @@ function Ye({
853
852
  u,
854
853
  m,
855
854
  H,
856
- M,
855
+ E,
857
856
  g
858
857
  ]);
859
858
  const b = () => {
860
859
  x.update(() => {
861
- const R = J(e);
862
- Q(R) && R.setShowCaption(!0);
860
+ const M = J(e);
861
+ Q(M) && M.setShowCaption(!0);
863
862
  });
864
- }, v = (R, E) => {
863
+ }, D = (M, R) => {
865
864
  setTimeout(() => {
866
865
  P(!1);
867
866
  }, 200), x.update(() => {
868
867
  const N = J(e);
869
- console.log(N, "node"), Q(N) && N.setWidthAndHeight(R, E);
868
+ console.log(N, "node"), Q(N) && N.setWidthAndHeight(M, R);
870
869
  });
871
- }, j = () => {
870
+ }, I = () => {
872
871
  z || P(!0);
873
- }, A = a && G($) && !C, B = a || C;
874
- return /* @__PURE__ */ D.jsx(Me, { fallback: null, children: /* @__PURE__ */ D.jsxs(D.Fragment, { children: [
875
- /* @__PURE__ */ D.jsx("div", { draggable: A, children: /* @__PURE__ */ D.jsx(
872
+ }, F = a && G($) && !C, A = a || C;
873
+ return /* @__PURE__ */ v.jsx(Me, { fallback: null, children: /* @__PURE__ */ v.jsxs(v.Fragment, { children: [
874
+ /* @__PURE__ */ v.jsx("div", { draggable: F, children: /* @__PURE__ */ v.jsx(
876
875
  Se,
877
876
  {
878
- className: B ? `focused ${G($) ? "draggable" : ""}` : null,
877
+ className: A ? `focused ${G($) ? "draggable" : ""}` : null,
879
878
  src: l,
880
879
  altText: t,
881
880
  width: o,
@@ -883,20 +882,20 @@ function Ye({
883
882
  maxWidth: r,
884
883
  imageRef: i,
885
884
  startCrop: z,
886
- setStartCrop: L,
887
- isFocused: B,
885
+ setStartCrop: j,
886
+ isFocused: A,
888
887
  nodeKey: e
889
888
  }
890
889
  ) }),
891
- p && /* @__PURE__ */ D.jsx("div", { className: "image-caption-container", children: /* @__PURE__ */ D.jsx(Re, { initialEditor: s, children: /* @__PURE__ */ D.jsx(
890
+ p && /* @__PURE__ */ v.jsx("div", { className: "image-caption-container", children: /* @__PURE__ */ v.jsx(Re, { initialEditor: s, children: /* @__PURE__ */ v.jsx(
892
891
  ye,
893
892
  {
894
- contentEditable: /* @__PURE__ */ D.jsx(Ce, { className: "ImageNode__contentEditable" }),
895
- placeholder: /* @__PURE__ */ D.jsx(ve, { className: "ImageNode__placeholder", children: "Enter a caption..." }),
893
+ contentEditable: /* @__PURE__ */ v.jsx(Ce, { className: "ImageNode__contentEditable" }),
894
+ placeholder: /* @__PURE__ */ v.jsx(ve, { className: "ImageNode__placeholder", children: "Enter a caption..." }),
896
895
  ErrorBoundary: De
897
896
  }
898
897
  ) }) }),
899
- !z && h && G($) && B && /* @__PURE__ */ D.jsx(
898
+ !z && h && G($) && A && /* @__PURE__ */ v.jsx(
900
899
  Pe,
901
900
  {
902
901
  showCaption: p,
@@ -905,9 +904,9 @@ function Ye({
905
904
  buttonRef: d,
906
905
  maxWidth: r,
907
906
  onResizeStart: z ? () => {
908
- } : j,
907
+ } : I,
909
908
  onResizeEnd: z ? () => {
910
- } : v,
909
+ } : D,
911
910
  captionsEnabled: !1,
912
911
  imageRef: i
913
912
  }
@@ -918,4 +917,4 @@ export {
918
917
  se as RIGHT_CLICK_IMAGE_COMMAND,
919
918
  Ye as default
920
919
  };
921
- //# sourceMappingURL=ImageComponent-10dc0204.js.map
920
+ //# sourceMappingURL=ImageComponent-f7a7cd48.js.map