sykpcomposer 0.0.256 → 0.0.257

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,9 +1,9 @@
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, m as Ce, t as ve } from "./index-ef98e4fa.js";
2
- import { d as De, L as be, P as Re } from "./LexicalNestedComposer.prod-b1e8e0ed.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 b, u as ge, a as de, x as q, $ as J, d as G, w as ee, b as oe, c as ue, e as pe, f as we, C as I, g as me, k as fe, h as xe, I as ye, r as Ce, i as ve, l as De, m as be, t as Re } from "./index-80dad39e.js";
2
+ import { d as Ee, L as Me, P as Pe } from "./LexicalNestedComposer.prod-be302eab.js";
3
+ import x, { useRef as Y, PureComponent as $e, createRef as se, useState as F, useEffect as te, useCallback as V, Suspense as He } from "react";
4
4
  import "react-dom";
5
- function ee(l, t, e) {
6
- return Math.min(Math.max(l, t), e);
5
+ function ie(d, t, e) {
6
+ return Math.min(Math.max(d, t), e);
7
7
  }
8
8
  const y = {
9
9
  east: 1,
@@ -11,8 +11,8 @@ const y = {
11
11
  south: 2,
12
12
  west: 4
13
13
  };
14
- function Pe({
15
- onResizeStart: l,
14
+ function ze({
15
+ onResizeStart: d,
16
16
  onResizeEnd: t,
17
17
  buttonRef: e,
18
18
  imageRef: o,
@@ -22,7 +22,7 @@ function Pe({
22
22
  setShowCaption: p,
23
23
  captionsEnabled: s
24
24
  }) {
25
- const i = Y(null), d = Y({
25
+ const i = Y(null), l = Y({
26
26
  priority: "",
27
27
  value: "default"
28
28
  }), a = Y({
@@ -35,8 +35,8 @@ function Pe({
35
35
  startWidth: 0,
36
36
  startX: 0,
37
37
  startY: 0
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";
38
+ }), g = r.getRootElement(), c = g !== null ? g.getBoundingClientRect().width - 20 : 100, C = g !== null ? g.getBoundingClientRect().height - 20 : 100, P = 100, f = 100, H = (m) => {
39
+ const u = m === y.east || m === y.west, w = m === y.north || m === y.south, N = m & y.north && m & y.west || m & y.south && m & y.east, M = u ? "ew" : w ? "ns" : N ? "nwse" : "nesw";
40
40
  g !== null && g.style.setProperty(
41
41
  "cursor",
42
42
  `${M}-resize`,
@@ -45,196 +45,196 @@ function Pe({
45
45
  "cursor",
46
46
  `${M}-resize`,
47
47
  "important"
48
- ), d.current.value = document.body.style.getPropertyValue(
48
+ ), l.current.value = document.body.style.getPropertyValue(
49
49
  "-webkit-user-select"
50
- ), d.current.priority = document.body.style.getPropertyPriority(
50
+ ), l.current.priority = document.body.style.getPropertyPriority(
51
51
  "-webkit-user-select"
52
52
  ), document.body.style.setProperty(
53
53
  "-webkit-user-select",
54
54
  "none",
55
55
  "important"
56
56
  ));
57
- }, F = () => {
57
+ }, T = () => {
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
- d.current.value,
61
- d.current.priority
60
+ l.current.value,
61
+ l.current.priority
62
62
  ));
63
- }, z = (w, u) => {
63
+ }, z = (m, u) => {
64
64
  if (!r.isEditable())
65
65
  return;
66
- const m = o.current, H = i.current;
67
- if (m !== null && H !== null) {
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);
66
+ const w = o.current, N = i.current;
67
+ if (w !== null && N !== null) {
68
+ m.preventDefault();
69
+ const { width: M, height: v } = w.getBoundingClientRect(), D = a.current;
70
+ D.startWidth = M, D.startHeight = v, D.ratio = M / v, D.currentWidth = M, D.currentHeight = v, D.startX = m.clientX, D.startY = m.clientY, D.isResizing = !0, D.direction = u, H(u), d(), N.classList.add("image-control-wrapper--resizing"), w.style.height = `${v}px`, w.style.width = `${M}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);
74
- if (u !== null && m.isResizing) {
75
- if (H && M) {
76
- let b = Math.floor(m.startX - w.clientX);
77
- b = m.direction & y.east ? -b : b;
78
- const v = ee(
79
- m.startWidth + b,
72
+ }, j = (m) => {
73
+ const u = o.current, w = a.current, N = w.direction & (y.east | y.west), M = w.direction & (y.south | y.north);
74
+ if (u !== null && w.isResizing) {
75
+ if (N && M) {
76
+ let v = Math.floor(w.startX - m.clientX);
77
+ v = w.direction & y.east ? -v : v;
78
+ const D = ie(
79
+ w.startWidth + v,
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;
82
+ ), A = D / w.ratio;
83
+ u.style.width = `${D}px`, u.style.height = `${A}px`, w.currentHeight = A, w.currentWidth = D;
84
84
  } else if (M) {
85
- let b = Math.floor(m.startY - w.clientY);
86
- b = m.direction & y.south ? -b : b;
87
- const v = ee(
88
- m.startHeight + b,
89
- x,
85
+ let v = Math.floor(w.startY - m.clientY);
86
+ v = w.direction & y.south ? -v : v;
87
+ const D = ie(
88
+ w.startHeight + v,
89
+ f,
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`, w.currentHeight = D;
93
93
  } else {
94
- let b = Math.floor(m.startX - w.clientX);
95
- b = m.direction & y.east ? -b : b;
96
- const v = ee(
97
- m.startWidth + b,
94
+ let v = Math.floor(w.startX - m.clientX);
95
+ v = w.direction & y.east ? -v : v;
96
+ const D = ie(
97
+ w.startWidth + v,
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`, w.currentWidth = D;
102
102
  }
103
- u && (u.setAttribute("width", `${m.currentWidth}`), u.setAttribute("height", `${m.currentHeight}`));
103
+ u && (u.setAttribute("width", `${w.currentWidth}`), u.setAttribute("height", `${w.currentHeight}`));
104
104
  }
105
105
  }, k = () => {
106
- const w = o.current, u = a.current, m = i.current;
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);
106
+ const m = o.current, u = a.current, w = i.current;
107
+ if (m !== null && w !== null && u.isResizing) {
108
+ const N = 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, w.classList.remove("image-control-wrapper--resizing"), T(), t(N, M), 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__ */ b.jsxs("div", { ref: i, children: [
113
+ /* @__PURE__ */ b.jsx(
114
114
  "div",
115
115
  {
116
116
  className: "image-resizer image-resizer-n",
117
- onPointerDown: (w) => {
118
- z(w, y.north);
117
+ onPointerDown: (m) => {
118
+ z(m, y.north);
119
119
  }
120
120
  }
121
121
  ),
122
- /* @__PURE__ */ D.jsx(
122
+ /* @__PURE__ */ b.jsx(
123
123
  "div",
124
124
  {
125
125
  className: "image-resizer image-resizer-ne",
126
- onPointerDown: (w) => {
127
- z(w, y.north | y.east);
126
+ onPointerDown: (m) => {
127
+ z(m, y.north | y.east);
128
128
  }
129
129
  }
130
130
  ),
131
- /* @__PURE__ */ D.jsx(
131
+ /* @__PURE__ */ b.jsx(
132
132
  "div",
133
133
  {
134
134
  className: "image-resizer image-resizer-e",
135
- onPointerDown: (w) => {
136
- z(w, y.east);
135
+ onPointerDown: (m) => {
136
+ z(m, y.east);
137
137
  }
138
138
  }
139
139
  ),
140
- /* @__PURE__ */ D.jsx(
140
+ /* @__PURE__ */ b.jsx(
141
141
  "div",
142
142
  {
143
143
  className: "image-resizer image-resizer-se",
144
- onPointerDown: (w) => {
145
- z(w, y.south | y.east);
144
+ onPointerDown: (m) => {
145
+ z(m, y.south | y.east);
146
146
  }
147
147
  }
148
148
  ),
149
- /* @__PURE__ */ D.jsx(
149
+ /* @__PURE__ */ b.jsx(
150
150
  "div",
151
151
  {
152
152
  className: "image-resizer image-resizer-s",
153
- onPointerDown: (w) => {
154
- z(w, y.south);
153
+ onPointerDown: (m) => {
154
+ z(m, y.south);
155
155
  }
156
156
  }
157
157
  ),
158
- /* @__PURE__ */ D.jsx(
158
+ /* @__PURE__ */ b.jsx(
159
159
  "div",
160
160
  {
161
161
  className: "image-resizer image-resizer-sw",
162
- onPointerDown: (w) => {
163
- z(w, y.south | y.west);
162
+ onPointerDown: (m) => {
163
+ z(m, y.south | y.west);
164
164
  }
165
165
  }
166
166
  ),
167
- /* @__PURE__ */ D.jsx(
167
+ /* @__PURE__ */ b.jsx(
168
168
  "div",
169
169
  {
170
170
  className: "image-resizer image-resizer-w",
171
- onPointerDown: (w) => {
172
- z(w, y.west);
171
+ onPointerDown: (m) => {
172
+ z(m, y.west);
173
173
  }
174
174
  }
175
175
  ),
176
- /* @__PURE__ */ D.jsx(
176
+ /* @__PURE__ */ b.jsx(
177
177
  "div",
178
178
  {
179
179
  className: "image-resizer image-resizer-nw",
180
- onPointerDown: (w) => {
181
- z(w, y.north | y.west);
180
+ onPointerDown: (m) => {
181
+ z(m, y.north | y.west);
182
182
  }
183
183
  }
184
184
  )
185
185
  ] });
186
186
  }
187
- const Z = {
187
+ const ne = {
188
188
  x: 0,
189
189
  y: 0,
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;
194
- function W(l, t, e) {
195
- return l.unit === "%" ? { ...Z, ...l, unit: "%" } : {
193
+ }, W = (d, t, e) => Math.min(Math.max(d, t), e), Ne = (...d) => d.filter((t) => t && typeof t == "string").join(" "), ae = (d, t) => d === t || d.width === t.width && d.height === t.height && d.x === t.x && d.y === t.y && d.unit === t.unit;
194
+ function U(d, t, e) {
195
+ return d.unit === "%" ? { ...ne, ...d, unit: "%" } : {
196
196
  unit: "%",
197
- x: l.x ? l.x / t * 100 : 0,
198
- y: l.y ? l.y / e * 100 : 0,
199
- width: l.width ? l.width / t * 100 : 0,
200
- height: l.height ? l.height / e * 100 : 0
197
+ x: d.x ? d.x / t * 100 : 0,
198
+ y: d.y ? d.y / e * 100 : 0,
199
+ width: d.width ? d.width / t * 100 : 0,
200
+ height: d.height ? d.height / e * 100 : 0
201
201
  };
202
202
  }
203
- function _(l, t, e) {
204
- return l.unit ? l.unit === "px" ? { ...Z, ...l, unit: "px" } : {
203
+ function _(d, t, e) {
204
+ return d.unit ? d.unit === "px" ? { ...ne, ...d, unit: "px" } : {
205
205
  unit: "px",
206
- x: l.x ? l.x * t / 100 : 0,
207
- y: l.y ? l.y * e / 100 : 0,
208
- width: l.width ? l.width * t / 100 : 0,
209
- height: l.height ? l.height * e / 100 : 0
210
- } : { ...Z, ...l, unit: "px" };
206
+ x: d.x ? d.x * t / 100 : 0,
207
+ y: d.y ? d.y * e / 100 : 0,
208
+ width: d.width ? d.width * t / 100 : 0,
209
+ height: d.height ? d.height * e / 100 : 0
210
+ } : { ...ne, ...d, unit: "px" };
211
211
  }
212
- function oe(l, t, e, o, n, r = 0, h = 0, p = o, s = n) {
213
- const i = { ...l };
214
- let d = Math.min(r, o), a = Math.min(h, n), g = Math.min(p, o), c = Math.min(s, n);
215
- t && (t > 1 ? (d = h ? h * t : d, a = d / t, g = p * t) : (a = r ? r / t : a, d = a * t, c = s / t)), i.y < 0 && (i.height = Math.max(i.height + i.y, a), i.y = 0), i.x < 0 && (i.width = Math.max(i.width + i.x, d), i.x = 0);
212
+ function he(d, t, e, o, n, r = 0, h = 0, p = o, s = n) {
213
+ const i = { ...d };
214
+ let l = Math.min(r, o), a = Math.min(h, n), g = Math.min(p, o), c = Math.min(s, n);
215
+ t && (t > 1 ? (l = h ? h * t : l, a = l / t, g = p * t) : (a = r ? r / t : a, l = a * t, c = s / t)), i.y < 0 && (i.height = Math.max(i.height + i.y, a), i.y = 0), i.x < 0 && (i.width = Math.max(i.width + i.x, l), i.x = 0);
216
216
  const C = o - (i.x + i.width);
217
- C < 0 && (i.x = Math.min(i.x, o - d), i.width += C);
217
+ C < 0 && (i.x = Math.min(i.x, o - l), i.width += C);
218
218
  const P = n - (i.y + i.height);
219
- if (P < 0 && (i.y = Math.min(i.y, n - a), i.height += P), i.width < d && ((e === "sw" || e == "nw") && (i.x -= d - i.width), i.width = d), i.height < a && ((e === "nw" || e == "ne") && (i.y -= a - i.height), i.height = a), i.width > g && ((e === "sw" || e == "nw") && (i.x -= g - i.width), i.width = g), i.height > c && ((e === "nw" || e == "ne") && (i.y -= c - i.height), i.height = c), t) {
220
- const x = i.width / i.height;
221
- if (x < t) {
222
- const $ = Math.max(i.width / t, a);
223
- (e === "nw" || e == "ne") && (i.y -= $ - i.height), i.height = $;
224
- } else if (x > t) {
225
- const $ = Math.max(i.height * t, d);
226
- (e === "sw" || e == "nw") && (i.x -= $ - i.width), i.width = $;
219
+ if (P < 0 && (i.y = Math.min(i.y, n - a), i.height += P), i.width < l && ((e === "sw" || e == "nw") && (i.x -= l - i.width), i.width = l), i.height < a && ((e === "nw" || e == "ne") && (i.y -= a - i.height), i.height = a), i.width > g && ((e === "sw" || e == "nw") && (i.x -= g - i.width), i.width = g), i.height > c && ((e === "nw" || e == "ne") && (i.y -= c - i.height), i.height = c), t) {
220
+ const f = i.width / i.height;
221
+ if (f < t) {
222
+ const H = Math.max(i.width / t, a);
223
+ (e === "nw" || e == "ne") && (i.y -= H - i.height), i.height = H;
224
+ } else if (f > t) {
225
+ const H = Math.max(i.height * t, l);
226
+ (e === "sw" || e == "nw") && (i.x -= H - i.width), i.width = H;
227
227
  }
228
228
  }
229
229
  return i;
230
230
  }
231
- function $e(l, t, e, o) {
232
- const n = { ...l };
231
+ function Se(d, t, e, o) {
232
+ const n = { ...d };
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
235
  const K = { capture: !0, passive: !1 };
236
- let ze = 0;
237
- const X = class S extends Ee {
236
+ let ke = 0;
237
+ const X = class S extends $e {
238
238
  constructor() {
239
239
  super(...arguments), this.docMoveBound = !1, this.mouseDownOnCrop = !1, this.dragStarted = !1, this.evData = {
240
240
  startClientX: 0,
@@ -244,7 +244,7 @@ const X = class S extends Ee {
244
244
  clientX: 0,
245
245
  clientY: 0,
246
246
  isResize: !0
247
- }, this.componentRef = re(), this.mediaRef = re(), this.initChangeCalled = !1, this.instanceId = `rc-${ze++}`, this.state = {
247
+ }, this.componentRef = se(), this.mediaRef = se(), this.initChangeCalled = !1, this.instanceId = `rc-${ke++}`, this.state = {
248
248
  cropIsActive: !1,
249
249
  newCropIsBeingDrawn: !1
250
250
  }, this.onCropPointerDown = (t) => {
@@ -256,16 +256,16 @@ const X = class S extends Ee {
256
256
  return;
257
257
  t.cancelable && t.preventDefault(), this.bindDocMove(), this.componentRef.current.focus({ preventScroll: !0 });
258
258
  const h = t.target.dataset.ord, p = !!h;
259
- let s = t.clientX, i = t.clientY, d = r.x, a = r.y;
259
+ let s = t.clientX, i = t.clientY, l = r.x, a = r.y;
260
260
  if (h) {
261
261
  const g = t.clientX - n.x, c = t.clientY - n.y;
262
262
  let C = 0, P = 0;
263
- h === "ne" || h == "e" ? (C = g - (r.x + r.width), P = c - r.y, d = r.x, a = r.y + r.height) : h === "se" || h === "s" ? (C = g - (r.x + r.width), P = c - (r.y + r.height), d = r.x, a = r.y) : h === "sw" || h == "w" ? (C = g - r.x, P = c - (r.y + r.height), d = r.x + r.width, a = r.y) : (h === "nw" || h == "n") && (C = g - r.x, P = c - r.y, d = r.x + r.width, a = r.y + r.height), s = d + n.x + C, i = a + n.y + P;
263
+ h === "ne" || h == "e" ? (C = g - (r.x + r.width), P = c - r.y, l = r.x, a = r.y + r.height) : h === "se" || h === "s" ? (C = g - (r.x + r.width), P = c - (r.y + r.height), l = r.x, a = r.y) : h === "sw" || h == "w" ? (C = g - r.x, P = c - (r.y + r.height), l = r.x + r.width, a = r.y) : (h === "nw" || h == "n") && (C = g - r.x, P = c - r.y, l = r.x + r.width, a = r.y + r.height), s = l + n.x + C, i = a + n.y + P;
264
264
  }
265
265
  this.evData = {
266
266
  startClientX: s,
267
267
  startClientY: i,
268
- startCropX: d,
268
+ startCropX: l,
269
269
  startCropY: a,
270
270
  clientX: t.clientX,
271
271
  clientY: t.clientY,
@@ -277,7 +277,7 @@ const X = class S extends Ee {
277
277
  if (o || n || r && e)
278
278
  return;
279
279
  t.cancelable && t.preventDefault(), this.bindDocMove(), this.componentRef.current.focus({ preventScroll: !0 });
280
- const s = t.clientX - p.x, i = t.clientY - p.y, d = {
280
+ const s = t.clientX - p.x, i = t.clientY - p.y, l = {
281
281
  unit: "px",
282
282
  x: s,
283
283
  y: i,
@@ -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(_(l, p.width, p.height), U(l, 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)
@@ -301,9 +301,9 @@ const X = class S extends Ee {
301
301
  const { evData: p } = this;
302
302
  p.clientX = t.clientX, p.clientY = t.clientY;
303
303
  let s;
304
- p.isResize ? s = this.resizeCrop() : s = this.dragCrop(), ie(e, s) || n(
304
+ p.isResize ? s = this.resizeCrop() : s = this.dragCrop(), ae(e, s) || n(
305
305
  _(s, h.width, h.height),
306
- W(s, h.width, h.height)
306
+ U(s, h.width, h.height)
307
307
  );
308
308
  }, this.onComponentKeyDown = (t) => {
309
309
  const { crop: e, disabled: o, onChange: n, onComplete: r } = this.props;
@@ -313,10 +313,10 @@ const X = class S extends Ee {
313
313
  let p = !1;
314
314
  if (!e)
315
315
  return;
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
- 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);
316
+ const s = this.getBox(), i = this.makePixelCrop(s), l = (navigator.platform.match("Mac") ? t.metaKey : t.ctrlKey) ? S.nudgeStepLarge : t.shiftKey ? S.nudgeStepMedium : S.nudgeStep;
317
+ if (h === "ArrowLeft" ? (i.x -= l, p = !0) : h === "ArrowRight" ? (i.x += l, p = !0) : h === "ArrowUp" ? (i.y -= l, p = !0) : h === "ArrowDown" && (i.y += l, p = !0), p) {
318
+ t.cancelable && t.preventDefault(), i.x = W(i.x, 0, s.width - i.width), i.y = W(i.y, 0, s.height - i.height);
319
+ const a = _(i, s.width, s.height), g = U(i, s.width, s.height);
320
320
  n(a, g), r && r(a, g);
321
321
  }
322
322
  }, this.onHandlerKeyDown = (t, e) => {
@@ -328,7 +328,7 @@ const X = class S extends Ee {
328
328
  minHeight: p = 0,
329
329
  maxWidth: s,
330
330
  maxHeight: i,
331
- onChange: d,
331
+ onChange: l,
332
332
  onComplete: a
333
333
  } = this.props, g = this.getBox();
334
334
  if (r || !n)
@@ -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 = _(n, g.width, g.height), P = Se(C, t.key, c, e), f = he(
341
341
  P,
342
342
  o,
343
343
  e,
@@ -348,13 +348,13 @@ const X = class S extends Ee {
348
348
  s,
349
349
  i
350
350
  );
351
- if (!ie(n, x)) {
352
- const $ = W(x, g.width, g.height);
353
- d(x, $), a && a(x, $);
351
+ if (!ae(n, f)) {
352
+ const H = U(f, g.width, g.height);
353
+ l(f, H), a && a(f, H);
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(_(e, h.width, h.height), U(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,7 +376,7 @@ 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(_(e, n, r), U(e, n, r));
380
380
  }
381
381
  }
382
382
  componentWillUnmount() {
@@ -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 = W(t.startCropX + n, 0, e.width - o.width), o.y = W(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;
@@ -416,9 +416,9 @@ const X = class S extends Ee {
416
416
  resizeCrop() {
417
417
  const { evData: t } = this, { aspect: e = 0, maxWidth: o, maxHeight: n } = this.props, r = this.getBox(), [h, p] = this.resolveMinDimensions(r, e, this.props.minWidth, this.props.minHeight);
418
418
  let s = this.makePixelCrop(r);
419
- const i = this.getPointRegion(r, t.ord, h, p), d = t.ord || i;
419
+ const i = this.getPointRegion(r, t.ord, h, p), l = t.ord || i;
420
420
  let a = t.clientX - t.startClientX, g = t.clientY - t.startClientY;
421
- (h && d === "nw" || d === "w" || d === "sw") && (a = Math.min(a, -h)), (p && d === "nw" || d === "n" || d === "ne") && (g = Math.min(g, -p));
421
+ (h && l === "nw" || l === "w" || l === "sw") && (a = Math.min(a, -h)), (p && l === "nw" || l === "n" || l === "ne") && (g = Math.min(g, -p));
422
422
  const c = {
423
423
  unit: "px",
424
424
  x: 0,
@@ -427,7 +427,7 @@ const X = class S extends Ee {
427
427
  height: 0
428
428
  };
429
429
  i === "ne" ? (c.x = t.startCropX, c.width = a, e ? (c.height = c.width / e, c.y = t.startCropY - c.height) : (c.height = Math.abs(g), c.y = t.startCropY - c.height)) : i === "se" ? (c.x = t.startCropX, c.y = t.startCropY, c.width = a, e ? c.height = c.width / e : c.height = g) : i === "sw" ? (c.x = t.startCropX + a, c.y = t.startCropY, c.width = Math.abs(a), e ? c.height = c.width / e : c.height = g) : i === "nw" && (c.x = t.startCropX + a, c.width = Math.abs(a), e ? (c.height = c.width / e, c.y = t.startCropY - c.height) : (c.height = Math.abs(g), c.y = t.startCropY + g));
430
- const C = oe(
430
+ const C = he(
431
431
  c,
432
432
  e,
433
433
  i,
@@ -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(l) > -1 ? s = C : S.xOrds.indexOf(l) > -1 ? (s.x = C.x, s.width = C.width) : S.yOrds.indexOf(l) > -1 && (s.y = C.y, s.height = C.height), s.x = W(s.x, 0, r.width - s.width), s.y = W(s.y, 0, r.height - s.height), s;
442
442
  }
443
443
  renderCropSelection() {
444
444
  const {
@@ -450,7 +450,7 @@ const X = class S extends Ee {
450
450
  crop: h
451
451
  } = this.props, p = this.getCropStyle();
452
452
  if (h)
453
- return /* @__PURE__ */ f.createElement(
453
+ return /* @__PURE__ */ x.createElement(
454
454
  "div",
455
455
  {
456
456
  style: p,
@@ -461,7 +461,7 @@ const X = class S extends Ee {
461
461
  onKeyDown: this.onComponentKeyDown,
462
462
  role: "group"
463
463
  },
464
- !e && !o && /* @__PURE__ */ f.createElement("div", { className: "ReactCrop__drag-elements", onFocus: this.onDragFocus }, /* @__PURE__ */ f.createElement("div", { className: "ReactCrop__drag-bar ord-n", "data-ord": "n" }), /* @__PURE__ */ f.createElement("div", { className: "ReactCrop__drag-bar ord-e", "data-ord": "e" }), /* @__PURE__ */ f.createElement("div", { className: "ReactCrop__drag-bar ord-s", "data-ord": "s" }), /* @__PURE__ */ f.createElement("div", { className: "ReactCrop__drag-bar ord-w", "data-ord": "w" }), /* @__PURE__ */ f.createElement(
464
+ !e && !o && /* @__PURE__ */ x.createElement("div", { className: "ReactCrop__drag-elements", onFocus: this.onDragFocus }, /* @__PURE__ */ x.createElement("div", { className: "ReactCrop__drag-bar ord-n", "data-ord": "n" }), /* @__PURE__ */ x.createElement("div", { className: "ReactCrop__drag-bar ord-e", "data-ord": "e" }), /* @__PURE__ */ x.createElement("div", { className: "ReactCrop__drag-bar ord-s", "data-ord": "s" }), /* @__PURE__ */ x.createElement("div", { className: "ReactCrop__drag-bar ord-w", "data-ord": "w" }), /* @__PURE__ */ x.createElement(
465
465
  "div",
466
466
  {
467
467
  className: "ReactCrop__drag-handle ord-nw",
@@ -471,7 +471,7 @@ const X = class S extends Ee {
471
471
  onKeyDown: (s) => this.onHandlerKeyDown(s, "nw"),
472
472
  role: "button"
473
473
  }
474
- ), /* @__PURE__ */ f.createElement(
474
+ ), /* @__PURE__ */ x.createElement(
475
475
  "div",
476
476
  {
477
477
  className: "ReactCrop__drag-handle ord-n",
@@ -481,7 +481,7 @@ const X = class S extends Ee {
481
481
  onKeyDown: (s) => this.onHandlerKeyDown(s, "n"),
482
482
  role: "button"
483
483
  }
484
- ), /* @__PURE__ */ f.createElement(
484
+ ), /* @__PURE__ */ x.createElement(
485
485
  "div",
486
486
  {
487
487
  className: "ReactCrop__drag-handle ord-ne",
@@ -491,7 +491,7 @@ const X = class S extends Ee {
491
491
  onKeyDown: (s) => this.onHandlerKeyDown(s, "ne"),
492
492
  role: "button"
493
493
  }
494
- ), /* @__PURE__ */ f.createElement(
494
+ ), /* @__PURE__ */ x.createElement(
495
495
  "div",
496
496
  {
497
497
  className: "ReactCrop__drag-handle ord-e",
@@ -501,7 +501,7 @@ const X = class S extends Ee {
501
501
  onKeyDown: (s) => this.onHandlerKeyDown(s, "e"),
502
502
  role: "button"
503
503
  }
504
- ), /* @__PURE__ */ f.createElement(
504
+ ), /* @__PURE__ */ x.createElement(
505
505
  "div",
506
506
  {
507
507
  className: "ReactCrop__drag-handle ord-se",
@@ -511,7 +511,7 @@ const X = class S extends Ee {
511
511
  onKeyDown: (s) => this.onHandlerKeyDown(s, "se"),
512
512
  role: "button"
513
513
  }
514
- ), /* @__PURE__ */ f.createElement(
514
+ ), /* @__PURE__ */ x.createElement(
515
515
  "div",
516
516
  {
517
517
  className: "ReactCrop__drag-handle ord-s",
@@ -521,7 +521,7 @@ const X = class S extends Ee {
521
521
  onKeyDown: (s) => this.onHandlerKeyDown(s, "s"),
522
522
  role: "button"
523
523
  }
524
- ), /* @__PURE__ */ f.createElement(
524
+ ), /* @__PURE__ */ x.createElement(
525
525
  "div",
526
526
  {
527
527
  className: "ReactCrop__drag-handle ord-sw",
@@ -531,7 +531,7 @@ const X = class S extends Ee {
531
531
  onKeyDown: (s) => this.onHandlerKeyDown(s, "sw"),
532
532
  role: "button"
533
533
  }
534
- ), /* @__PURE__ */ f.createElement(
534
+ ), /* @__PURE__ */ x.createElement(
535
535
  "div",
536
536
  {
537
537
  className: "ReactCrop__drag-handle ord-w",
@@ -542,19 +542,19 @@ const X = class S extends Ee {
542
542
  role: "button"
543
543
  }
544
544
  )),
545
- n && /* @__PURE__ */ f.createElement("div", { className: "ReactCrop__selection-addon", onPointerDown: (s) => s.stopPropagation() }, n(this.state)),
546
- r && /* @__PURE__ */ f.createElement(f.Fragment, null, /* @__PURE__ */ f.createElement("div", { className: "ReactCrop__rule-of-thirds-hz" }), /* @__PURE__ */ f.createElement("div", { className: "ReactCrop__rule-of-thirds-vt" }))
545
+ n && /* @__PURE__ */ x.createElement("div", { className: "ReactCrop__selection-addon", onPointerDown: (s) => s.stopPropagation() }, n(this.state)),
546
+ r && /* @__PURE__ */ x.createElement(x.Fragment, null, /* @__PURE__ */ x.createElement("div", { className: "ReactCrop__rule-of-thirds-hz" }), /* @__PURE__ */ x.createElement("div", { className: "ReactCrop__rule-of-thirds-vt" }))
547
547
  );
548
548
  }
549
549
  makePixelCrop(t) {
550
- const e = { ...Z, ...this.props.crop || {} };
550
+ const e = { ...ne, ...this.props.crop || {} };
551
551
  return _(e, t.width, t.height);
552
552
  }
553
553
  render() {
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(
554
+ const { aspect: t, children: e, circularCrop: o, className: n, crop: r, disabled: h, locked: p, style: s, ruleOfThirds: i } = this.props, { cropIsActive: l, newCropIsBeingDrawn: a } = this.state, g = r ? this.renderCropSelection() : null, c = Ne(
555
555
  "ReactCrop",
556
556
  n,
557
- d && "ReactCrop--active",
557
+ l && "ReactCrop--active",
558
558
  h && "ReactCrop--disabled",
559
559
  p && "ReactCrop--locked",
560
560
  a && "ReactCrop--new-crop",
@@ -564,7 +564,7 @@ const X = class S extends Ee {
564
564
  !this.dragStarted && r && !r.width && !r.height && "ReactCrop--invisible-crop",
565
565
  o && "ReactCrop--no-animate"
566
566
  );
567
- return /* @__PURE__ */ f.createElement("div", { ref: this.componentRef, className: c, style: s }, /* @__PURE__ */ f.createElement("div", { ref: this.mediaRef, className: "ReactCrop__child-wrapper", onPointerDown: this.onComponentPointerDown }, e), r ? /* @__PURE__ */ f.createElement("svg", { className: "ReactCrop__crop-mask", width: "100%", height: "100%" }, /* @__PURE__ */ f.createElement("defs", null, /* @__PURE__ */ f.createElement("mask", { id: `hole-${this.instanceId}` }, /* @__PURE__ */ f.createElement("rect", { width: "100%", height: "100%", fill: "white" }), o ? /* @__PURE__ */ f.createElement(
567
+ return /* @__PURE__ */ x.createElement("div", { ref: this.componentRef, className: c, style: s }, /* @__PURE__ */ x.createElement("div", { ref: this.mediaRef, className: "ReactCrop__child-wrapper", onPointerDown: this.onComponentPointerDown }, e), r ? /* @__PURE__ */ x.createElement("svg", { className: "ReactCrop__crop-mask", width: "100%", height: "100%" }, /* @__PURE__ */ x.createElement("defs", null, /* @__PURE__ */ x.createElement("mask", { id: `hole-${this.instanceId}` }, /* @__PURE__ */ x.createElement("rect", { width: "100%", height: "100%", fill: "white" }), o ? /* @__PURE__ */ x.createElement(
568
568
  "ellipse",
569
569
  {
570
570
  cx: `${r.x + r.width / 2}${r.unit}`,
@@ -573,7 +573,7 @@ const X = class S extends Ee {
573
573
  ry: `${r.height / 2}${r.unit}`,
574
574
  fill: "black"
575
575
  }
576
- ) : /* @__PURE__ */ f.createElement(
576
+ ) : /* @__PURE__ */ x.createElement(
577
577
  "rect",
578
578
  {
579
579
  x: `${r.x}${r.unit}`,
@@ -582,7 +582,7 @@ const X = class S extends Ee {
582
582
  height: `${r.height}${r.unit}`,
583
583
  fill: "black"
584
584
  }
585
- ))), /* @__PURE__ */ f.createElement("rect", { fill: "black", fillOpacity: 0.5, width: "100%", height: "100%", mask: `url(#hole-${this.instanceId})` })) : void 0, g);
585
+ ))), /* @__PURE__ */ x.createElement("rect", { fill: "black", fillOpacity: 0.5, width: "100%", height: "100%", mask: `url(#hole-${this.instanceId})` })) : void 0, g);
586
586
  }
587
587
  };
588
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 = {
@@ -598,10 +598,10 @@ 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;
602
- const se = ve();
603
- function Se({
604
- altText: l,
601
+ let Ie = X;
602
+ const ce = Re();
603
+ function _e({
604
+ altText: d,
605
605
  className: t,
606
606
  src: e,
607
607
  width: o,
@@ -611,9 +611,9 @@ function Se({
611
611
  startCrop: p,
612
612
  setStartCrop: s,
613
613
  isFocused: i,
614
- nodeKey: d
614
+ nodeKey: l
615
615
  }) {
616
- const [a, g] = U(null), [c, C] = U(null), [P, x] = U({
616
+ const [a, g] = F(null), [c, C] = F(null), [P, f] = F({
617
617
  //@ts-ignore
618
618
  unit: "px",
619
619
  // Can be 'px' or '%'
@@ -621,68 +621,68 @@ function Se({
621
621
  y: 25,
622
622
  width: 50,
623
623
  height: 50
624
- }), [$] = ae(), F = () => {
624
+ }), [H] = de(), T = () => {
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(
630
- a.width * m,
631
- a.height * H
632
- ), b = M.getContext("2d");
633
- if (!b)
629
+ const w = u.naturalWidth / u.width, N = u.naturalHeight / u.height, M = new OffscreenCanvas(
630
+ a.width * w,
631
+ a.height * N
632
+ ), v = M.getContext("2d");
633
+ if (!v)
634
634
  throw new Error("No 2D context available");
635
- b.drawImage(
635
+ v.drawImage(
636
636
  u,
637
- a.x * m,
638
- a.y * H,
639
- a.width * m,
640
- a.height * H,
637
+ a.x * w,
638
+ a.y * N,
639
+ a.width * w,
640
+ a.height * N,
641
641
  0,
642
642
  0,
643
- a.width * m,
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);
643
+ a.width * w,
644
+ a.height * N
645
+ ), M.convertToBlob({ type: "image/png" }).then((D) => {
646
+ const A = URL.createObjectURL(D);
647
+ C(A), s(!1);
648
+ const B = new FileReader();
649
+ B.onload = () => {
650
+ const Q = B.result;
651
+ H.update(() => {
652
+ const O = q(l);
653
+ J(O) && Q && O.setSrc(Q);
654
654
  });
655
- }, A.onerror = () => {
655
+ }, B.onerror = () => {
656
656
  console.log("error");
657
- }, A.readAsDataURL(v);
657
+ }, B.readAsDataURL(D);
658
658
  });
659
659
  }
660
660
  }, z = () => {
661
661
  p || s((u) => {
662
662
  if (u === !1) {
663
- const m = h.current;
664
- x({
663
+ const w = h.current;
664
+ f({
665
665
  unit: "px",
666
666
  // Can be 'px' or '%'
667
667
  x: 0,
668
668
  y: 0,
669
- width: m.width,
670
- height: m.height
669
+ width: w.width,
670
+ height: w.height
671
671
  });
672
672
  }
673
673
  return !u;
674
674
  });
675
- }, L = Y(null), k = Y(null);
675
+ }, j = Y(null), k = Y(null);
676
676
  te(() => {
677
- a && (L.current = a);
677
+ a && (j.current = a);
678
678
  }, [a]);
679
- const w = (u) => {
679
+ const m = (u) => {
680
680
  k.current && !k.current.contains(u.target) && s(!1);
681
681
  };
682
- return te(() => (document.addEventListener("mousedown", w), () => {
683
- document.removeEventListener("mousedown", w);
684
- }), []), /* @__PURE__ */ D.jsxs("div", { ref: k, children: [
685
- i && /* @__PURE__ */ D.jsx(
682
+ return te(() => (document.addEventListener("mousedown", m), () => {
683
+ document.removeEventListener("mousedown", m);
684
+ }), []), /* @__PURE__ */ b.jsxs("div", { ref: k, children: [
685
+ i && /* @__PURE__ */ b.jsx(
686
686
  "button",
687
687
  {
688
688
  style: { zIndex: 999 },
@@ -691,27 +691,27 @@ function Se({
691
691
  children: "Crop"
692
692
  }
693
693
  ),
694
- p && /* @__PURE__ */ D.jsx(
694
+ p && /* @__PURE__ */ b.jsx(
695
695
  "button",
696
696
  {
697
697
  style: { zIndex: 999 },
698
698
  className: "image-caption-button",
699
- onClick: () => F(),
699
+ onClick: () => T(),
700
700
  children: "Apply Crop"
701
701
  }
702
702
  ),
703
- p ? /* @__PURE__ */ D.jsx(
704
- Ne,
703
+ p ? /* @__PURE__ */ b.jsx(
704
+ Ie,
705
705
  {
706
706
  crop: P,
707
- onChange: (u) => x(u),
707
+ onChange: (u) => f(u),
708
708
  onComplete: (u) => g(u),
709
- children: /* @__PURE__ */ D.jsx(
709
+ children: /* @__PURE__ */ b.jsx(
710
710
  "img",
711
711
  {
712
712
  className: t || void 0,
713
713
  src: c || e,
714
- alt: l,
714
+ alt: d,
715
715
  ref: h,
716
716
  style: {
717
717
  height: n,
@@ -724,12 +724,12 @@ function Se({
724
724
  }
725
725
  ) : (
726
726
  // When startCrop is false, show the cropped image or original image
727
- /* @__PURE__ */ D.jsx(
727
+ /* @__PURE__ */ b.jsx(
728
728
  "img",
729
729
  {
730
730
  className: t || void 0,
731
731
  src: c || e,
732
- alt: l,
732
+ alt: d,
733
733
  ref: h,
734
734
  style: {
735
735
  height: n,
@@ -742,8 +742,8 @@ function Se({
742
742
  )
743
743
  ] });
744
744
  }
745
- function Ye({
746
- src: l,
745
+ function Ae({
746
+ src: d,
747
747
  altText: t,
748
748
  nodeKey: e,
749
749
  width: o,
@@ -753,161 +753,179 @@ function Ye({
753
753
  showCaption: p,
754
754
  caption: s
755
755
  }) {
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) => {
758
- if (a && G(q())) {
759
- R.preventDefault();
760
- const N = J(e);
761
- if (Q(N))
762
- return N.remove(), !0;
756
+ const i = Y(null), l = Y(null), [a, g, c] = ge(e), [C, P] = F(!1), [f] = de(), [H, T] = F(null), [z, j] = F(!1), k = Y(null), m = async (E) => {
757
+ const $ = await (await fetch(E)).blob();
758
+ return new Promise((L, re) => {
759
+ const Z = new FileReader();
760
+ Z.readAsDataURL($), Z.onloadend = () => {
761
+ const le = Z.result;
762
+ L(le);
763
+ }, Z.onerror = re;
764
+ });
765
+ };
766
+ te(() => {
767
+ /^(https?|ftp):\/\/[^\s/$.?#].[^\s]*$/i.test(d) && m(d).then((R) => {
768
+ f.update(() => {
769
+ const $ = q(e);
770
+ J($) && R && $.setSrc(R);
771
+ });
772
+ });
773
+ }, [d]);
774
+ const u = V(
775
+ (E) => {
776
+ if (a && G(ee())) {
777
+ E.preventDefault();
778
+ const $ = q(e);
779
+ if (J($))
780
+ return $.remove(), !0;
763
781
  }
764
782
  return !1;
765
783
  },
766
784
  [a, e]
767
- ), u = V(
768
- (R) => {
769
- const E = q(), N = d.current;
770
- if (a && G(E) && E.getNodes().length === 1) {
785
+ ), w = V(
786
+ (E) => {
787
+ const R = ee(), $ = l.current;
788
+ if (a && G(R) && R.getNodes().length === 1) {
771
789
  if (p)
772
- return ne(null), R.preventDefault(), s.focus(), !0;
773
- if (N !== null && N !== document.activeElement)
774
- return R.preventDefault(), N.focus(), !0;
790
+ return oe(null), E.preventDefault(), s.focus(), !0;
791
+ if ($ !== null && $ !== document.activeElement)
792
+ return E.preventDefault(), $.focus(), !0;
775
793
  }
776
794
  return !1;
777
795
  },
778
796
  [s, a, p]
779
- ), m = V(
780
- (R) => k.current === s || d.current === R.target ? (ne(null), x.update(() => {
797
+ ), N = V(
798
+ (E) => k.current === s || l.current === E.target ? (oe(null), f.update(() => {
781
799
  g(!0);
782
- const E = x.getRootElement();
783
- E !== null && E.focus();
800
+ const R = f.getRootElement();
801
+ R !== null && R.focus();
784
802
  }), !0) : !1,
785
- [s, x, g]
786
- ), 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;
803
+ [s, f, g]
804
+ ), M = V(
805
+ (E) => {
806
+ const R = E;
807
+ return C ? !0 : R.target === i.current ? (R.shiftKey ? g(!a) : (c(), g(!0)), !0) : !1;
790
808
  },
791
809
  [C, a, g, c]
792
- ), M = V(
793
- (R) => {
794
- x.getEditorState().read(() => {
795
- const E = q();
796
- R.target.tagName === "IMG" && de(E) && E.getNodes().length === 1 && x.dispatchCommand(
797
- se,
798
- R
810
+ ), v = V(
811
+ (E) => {
812
+ f.getEditorState().read(() => {
813
+ const R = ee();
814
+ E.target.tagName === "IMG" && ue(R) && R.getNodes().length === 1 && f.dispatchCommand(
815
+ ce,
816
+ E
799
817
  );
800
818
  });
801
819
  },
802
- [x]
820
+ [f]
803
821
  );
804
822
  te(() => {
805
- let R = !0;
806
- const E = x.getRootElement(), N = le(
807
- x.registerUpdateListener(({ editorState: T }) => {
808
- R && F(T.read(() => q()));
823
+ let E = !0;
824
+ const R = f.getRootElement(), $ = pe(
825
+ f.registerUpdateListener(({ editorState: L }) => {
826
+ E && T(L.read(() => ee()));
809
827
  }),
810
- x.registerCommand(
811
- fe,
812
- (T, he) => (k.current = he, !1),
828
+ f.registerCommand(
829
+ ve,
830
+ (L, re) => (k.current = re, !1),
813
831
  I
814
832
  ),
815
- x.registerCommand(
816
- xe,
817
- H,
833
+ f.registerCommand(
834
+ Ce,
835
+ M,
818
836
  I
819
837
  ),
820
- x.registerCommand(
821
- se,
822
- H,
838
+ f.registerCommand(
839
+ ce,
840
+ M,
823
841
  I
824
842
  ),
825
- x.registerCommand(
826
- me,
827
- (T) => T.target === i.current ? (T.preventDefault(), !0) : !1,
843
+ f.registerCommand(
844
+ ye,
845
+ (L) => L.target === i.current ? (L.preventDefault(), !0) : !1,
828
846
  I
829
847
  ),
830
- x.registerCommand(
831
- we,
832
- w,
848
+ f.registerCommand(
849
+ xe,
850
+ u,
833
851
  I
834
852
  ),
835
- x.registerCommand(
836
- pe,
837
- w,
853
+ f.registerCommand(
854
+ fe,
855
+ u,
838
856
  I
839
857
  ),
840
- x.registerCommand(ue, u, I),
841
- x.registerCommand(ge, m, I)
858
+ f.registerCommand(me, w, I),
859
+ f.registerCommand(we, N, I)
842
860
  );
843
- return E == null || E.addEventListener("contextmenu", M), () => {
844
- R = !1, N(), E == null || E.removeEventListener("contextmenu", M);
861
+ return R == null || R.addEventListener("contextmenu", v), () => {
862
+ E = !1, $(), R == null || R.removeEventListener("contextmenu", v);
845
863
  };
846
864
  }, [
847
865
  c,
848
- x,
866
+ f,
849
867
  C,
850
868
  a,
851
869
  e,
852
- w,
853
870
  u,
854
- m,
855
- H,
871
+ w,
872
+ N,
856
873
  M,
874
+ v,
857
875
  g
858
876
  ]);
859
- const b = () => {
860
- x.update(() => {
861
- const R = J(e);
862
- Q(R) && R.setShowCaption(!0);
877
+ const D = () => {
878
+ f.update(() => {
879
+ const E = q(e);
880
+ J(E) && E.setShowCaption(!0);
863
881
  });
864
- }, v = (R, E) => {
882
+ }, A = (E, R) => {
865
883
  setTimeout(() => {
866
884
  P(!1);
867
- }, 200), x.update(() => {
868
- const N = J(e);
869
- console.log(N, "node"), Q(N) && N.setWidthAndHeight(R, E);
885
+ }, 200), f.update(() => {
886
+ const $ = q(e);
887
+ console.log($, "node"), J($) && $.setWidthAndHeight(E, R);
870
888
  });
871
- }, j = () => {
889
+ }, B = () => {
872
890
  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(
876
- Se,
891
+ }, Q = a && G(H) && !C, O = a || C;
892
+ return /* @__PURE__ */ b.jsx(He, { fallback: null, children: /* @__PURE__ */ b.jsxs(b.Fragment, { children: [
893
+ /* @__PURE__ */ b.jsx("div", { draggable: Q, children: /* @__PURE__ */ b.jsx(
894
+ _e,
877
895
  {
878
- className: B ? `focused ${G($) ? "draggable" : ""}` : null,
879
- src: l,
896
+ className: O ? `focused ${G(H) ? "draggable" : ""}` : null,
897
+ src: d,
880
898
  altText: t,
881
899
  width: o,
882
900
  height: n,
883
901
  maxWidth: r,
884
902
  imageRef: i,
885
903
  startCrop: z,
886
- setStartCrop: L,
887
- isFocused: B,
904
+ setStartCrop: j,
905
+ isFocused: O,
888
906
  nodeKey: e
889
907
  }
890
908
  ) }),
891
- p && /* @__PURE__ */ D.jsx("div", { className: "image-caption-container", children: /* @__PURE__ */ D.jsx(De, { initialEditor: s, children: /* @__PURE__ */ D.jsx(
892
- ye,
909
+ p && /* @__PURE__ */ b.jsx("div", { className: "image-caption-container", children: /* @__PURE__ */ b.jsx(Ee, { initialEditor: s, children: /* @__PURE__ */ b.jsx(
910
+ De,
893
911
  {
894
- contentEditable: /* @__PURE__ */ D.jsx(be, { className: "ImageNode__contentEditable" }),
895
- placeholder: /* @__PURE__ */ D.jsx(Re, { className: "ImageNode__placeholder", children: "Enter a caption..." }),
896
- ErrorBoundary: Ce
912
+ contentEditable: /* @__PURE__ */ b.jsx(Me, { className: "ImageNode__contentEditable" }),
913
+ placeholder: /* @__PURE__ */ b.jsx(Pe, { className: "ImageNode__placeholder", children: "Enter a caption..." }),
914
+ ErrorBoundary: be
897
915
  }
898
916
  ) }) }),
899
- !z && h && G($) && B && /* @__PURE__ */ D.jsx(
900
- Pe,
917
+ !z && h && G(H) && O && /* @__PURE__ */ b.jsx(
918
+ ze,
901
919
  {
902
920
  showCaption: p,
903
- setShowCaption: b,
904
- editor: x,
905
- buttonRef: d,
921
+ setShowCaption: D,
922
+ editor: f,
923
+ buttonRef: l,
906
924
  maxWidth: r,
907
925
  onResizeStart: z ? () => {
908
- } : j,
926
+ } : B,
909
927
  onResizeEnd: z ? () => {
910
- } : v,
928
+ } : A,
911
929
  captionsEnabled: !1,
912
930
  imageRef: i
913
931
  }
@@ -915,7 +933,7 @@ function Ye({
915
933
  ] }) });
916
934
  }
917
935
  export {
918
- se as RIGHT_CLICK_IMAGE_COMMAND,
919
- Ye as default
936
+ ce as RIGHT_CLICK_IMAGE_COMMAND,
937
+ Ae as default
920
938
  };
921
- //# sourceMappingURL=ImageComponent-2de0808d.js.map
939
+ //# sourceMappingURL=ImageComponent-cf344a7e.js.map