eddyter 1.4.11 → 1.4.12

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.
@@ -0,0 +1,528 @@
1
+ import { jsx as j } from "react/jsx-runtime";
2
+ import A, { Component as q, forwardRef as I } from "react";
3
+ import { _ as V, a as $ } from "./objectWithoutPropertiesLoose-DO0w4vQT.js";
4
+ import { g as N } from "./index-Dh0oRk6u.js";
5
+ function H(e, n) {
6
+ if (e == null)
7
+ return {};
8
+ var r, t, o = V(e, n);
9
+ if (Object.getOwnPropertySymbols) {
10
+ var a = Object.getOwnPropertySymbols(e);
11
+ for (t = 0; t < a.length; t++)
12
+ r = a[t], n.indexOf(r) === -1 && {}.propertyIsEnumerable.call(e, r) && (o[r] = e[r]);
13
+ }
14
+ return o;
15
+ }
16
+ function O(e) {
17
+ "@babel/helpers - typeof";
18
+ return O = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
19
+ return typeof n;
20
+ } : function(n) {
21
+ return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
22
+ }, O(e);
23
+ }
24
+ function Y(e, n, r) {
25
+ return Object.defineProperty(e, "prototype", {
26
+ writable: !1
27
+ }), e;
28
+ }
29
+ function X(e, n) {
30
+ if (!(e instanceof n))
31
+ throw new TypeError("Cannot call a class as a function");
32
+ }
33
+ function M(e, n) {
34
+ return M = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(r, t) {
35
+ return r.__proto__ = t, r;
36
+ }, M(e, n);
37
+ }
38
+ function G(e, n) {
39
+ if (typeof n != "function" && n !== null)
40
+ throw new TypeError("Super expression must either be null or a function");
41
+ e.prototype = Object.create(n && n.prototype, {
42
+ constructor: {
43
+ value: e,
44
+ writable: !0,
45
+ configurable: !0
46
+ }
47
+ }), Object.defineProperty(e, "prototype", {
48
+ writable: !1
49
+ }), n && M(e, n);
50
+ }
51
+ function T(e) {
52
+ return T = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(n) {
53
+ return n.__proto__ || Object.getPrototypeOf(n);
54
+ }, T(e);
55
+ }
56
+ function U() {
57
+ try {
58
+ var e = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
59
+ }));
60
+ } catch {
61
+ }
62
+ return (U = function() {
63
+ return !!e;
64
+ })();
65
+ }
66
+ function J(e) {
67
+ if (e === void 0)
68
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
69
+ return e;
70
+ }
71
+ function K(e, n) {
72
+ if (n && (O(n) == "object" || typeof n == "function"))
73
+ return n;
74
+ if (n !== void 0)
75
+ throw new TypeError("Derived constructors may only return object or undefined");
76
+ return J(e);
77
+ }
78
+ function Q(e) {
79
+ var n = U();
80
+ return function() {
81
+ var r, t = T(e);
82
+ if (n) {
83
+ var o = T(this).constructor;
84
+ r = Reflect.construct(t, arguments, o);
85
+ } else
86
+ r = t.apply(this, arguments);
87
+ return K(this, r);
88
+ };
89
+ }
90
+ var S = { exports: {} }, R, L;
91
+ function Z() {
92
+ if (L)
93
+ return R;
94
+ L = 1;
95
+ var e = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
96
+ return R = e, R;
97
+ }
98
+ var D, k;
99
+ function tt() {
100
+ if (k)
101
+ return D;
102
+ k = 1;
103
+ var e = /* @__PURE__ */ Z();
104
+ function n() {
105
+ }
106
+ function r() {
107
+ }
108
+ return r.resetWarningCache = n, D = function() {
109
+ function t(c, i, h, s, u, p) {
110
+ if (p !== e) {
111
+ var l = new Error(
112
+ "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
113
+ );
114
+ throw l.name = "Invariant Violation", l;
115
+ }
116
+ }
117
+ t.isRequired = t;
118
+ function o() {
119
+ return t;
120
+ }
121
+ var a = {
122
+ array: t,
123
+ bigint: t,
124
+ bool: t,
125
+ func: t,
126
+ number: t,
127
+ object: t,
128
+ string: t,
129
+ symbol: t,
130
+ any: t,
131
+ arrayOf: o,
132
+ element: t,
133
+ elementType: t,
134
+ instanceOf: o,
135
+ node: t,
136
+ objectOf: o,
137
+ oneOf: o,
138
+ oneOfType: o,
139
+ shape: o,
140
+ exact: o,
141
+ checkPropTypes: r,
142
+ resetWarningCache: n
143
+ };
144
+ return a.PropTypes = a, a;
145
+ }, D;
146
+ }
147
+ var z;
148
+ function et() {
149
+ return z || (z = 1, S.exports = /* @__PURE__ */ tt()()), S.exports;
150
+ }
151
+ var nt = /* @__PURE__ */ et();
152
+ const g = /* @__PURE__ */ N(nt);
153
+ function b(e, n, r) {
154
+ this.x = e, this.y = n, this.time = r || (/* @__PURE__ */ new Date()).getTime();
155
+ }
156
+ b.prototype.velocityFrom = function(e) {
157
+ return this.time !== e.time ? this.distanceTo(e) / (this.time - e.time) : 1;
158
+ };
159
+ b.prototype.distanceTo = function(e) {
160
+ return Math.sqrt(Math.pow(this.x - e.x, 2) + Math.pow(this.y - e.y, 2));
161
+ };
162
+ b.prototype.equals = function(e) {
163
+ return this.x === e.x && this.y === e.y && this.time === e.time;
164
+ };
165
+ function W(e, n, r, t) {
166
+ this.startPoint = e, this.control1 = n, this.control2 = r, this.endPoint = t;
167
+ }
168
+ W.prototype.length = function() {
169
+ for (var e = 10, n = 0, r = void 0, t = void 0, o = 0; o <= e; o += 1) {
170
+ var a = o / e, c = this._point(a, this.startPoint.x, this.control1.x, this.control2.x, this.endPoint.x), i = this._point(a, this.startPoint.y, this.control1.y, this.control2.y, this.endPoint.y);
171
+ if (o > 0) {
172
+ var h = c - r, s = i - t;
173
+ n += Math.sqrt(h * h + s * s);
174
+ }
175
+ r = c, t = i;
176
+ }
177
+ return n;
178
+ };
179
+ W.prototype._point = function(e, n, r, t, o) {
180
+ return n * (1 - e) * (1 - e) * (1 - e) + 3 * r * (1 - e) * (1 - e) * e + 3 * t * (1 - e) * e * e + o * e * e * e;
181
+ };
182
+ function rt(e, n, r) {
183
+ var t, o, a, c = null, i = 0;
184
+ r || (r = {});
185
+ var h = function() {
186
+ i = r.leading === !1 ? 0 : Date.now(), c = null, a = e.apply(t, o), c || (t = o = null);
187
+ };
188
+ return function() {
189
+ var s = Date.now();
190
+ !i && r.leading === !1 && (i = s);
191
+ var u = n - (s - i);
192
+ return t = this, o = arguments, u <= 0 || u > n ? (c && (clearTimeout(c), c = null), i = s, a = e.apply(t, o), c || (t = o = null)) : !c && r.trailing !== !1 && (c = setTimeout(h, u)), a;
193
+ };
194
+ }
195
+ function d(e, n) {
196
+ var r = this, t = n || {};
197
+ this.velocityFilterWeight = t.velocityFilterWeight || 0.7, this.minWidth = t.minWidth || 0.5, this.maxWidth = t.maxWidth || 2.5, this.throttle = "throttle" in t ? t.throttle : 16, this.minDistance = "minDistance" in t ? t.minDistance : 5, this.throttle ? this._strokeMoveUpdate = rt(d.prototype._strokeUpdate, this.throttle) : this._strokeMoveUpdate = d.prototype._strokeUpdate, this.dotSize = t.dotSize || function() {
198
+ return (this.minWidth + this.maxWidth) / 2;
199
+ }, this.penColor = t.penColor || "black", this.backgroundColor = t.backgroundColor || "rgba(0,0,0,0)", this.onBegin = t.onBegin, this.onEnd = t.onEnd, this._canvas = e, this._ctx = e.getContext("2d"), this.clear(), this._handleMouseDown = function(o) {
200
+ o.which === 1 && (r._mouseButtonDown = !0, r._strokeBegin(o));
201
+ }, this._handleMouseMove = function(o) {
202
+ r._mouseButtonDown && r._strokeMoveUpdate(o);
203
+ }, this._handleMouseUp = function(o) {
204
+ o.which === 1 && r._mouseButtonDown && (r._mouseButtonDown = !1, r._strokeEnd(o));
205
+ }, this._handleTouchStart = function(o) {
206
+ if (o.targetTouches.length === 1) {
207
+ var a = o.changedTouches[0];
208
+ r._strokeBegin(a);
209
+ }
210
+ }, this._handleTouchMove = function(o) {
211
+ o.preventDefault();
212
+ var a = o.targetTouches[0];
213
+ r._strokeMoveUpdate(a);
214
+ }, this._handleTouchEnd = function(o) {
215
+ var a = o.target === r._canvas;
216
+ a && (o.preventDefault(), r._strokeEnd(o));
217
+ }, this.on();
218
+ }
219
+ d.prototype.clear = function() {
220
+ var e = this._ctx, n = this._canvas;
221
+ e.fillStyle = this.backgroundColor, e.clearRect(0, 0, n.width, n.height), e.fillRect(0, 0, n.width, n.height), this._data = [], this._reset(), this._isEmpty = !0;
222
+ };
223
+ d.prototype.fromDataURL = function(e) {
224
+ var n = this, r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, t = new Image(), o = r.ratio || window.devicePixelRatio || 1, a = r.width || this._canvas.width / o, c = r.height || this._canvas.height / o;
225
+ this._reset(), t.src = e, t.onload = function() {
226
+ n._ctx.drawImage(t, 0, 0, a, c);
227
+ }, this._isEmpty = !1;
228
+ };
229
+ d.prototype.toDataURL = function(e) {
230
+ var n;
231
+ switch (e) {
232
+ case "image/svg+xml":
233
+ return this._toSVG();
234
+ default:
235
+ for (var r = arguments.length, t = Array(r > 1 ? r - 1 : 0), o = 1; o < r; o++)
236
+ t[o - 1] = arguments[o];
237
+ return (n = this._canvas).toDataURL.apply(n, [e].concat(t));
238
+ }
239
+ };
240
+ d.prototype.on = function() {
241
+ this._handleMouseEvents(), this._handleTouchEvents();
242
+ };
243
+ d.prototype.off = function() {
244
+ this._canvas.removeEventListener("mousedown", this._handleMouseDown), this._canvas.removeEventListener("mousemove", this._handleMouseMove), document.removeEventListener("mouseup", this._handleMouseUp), this._canvas.removeEventListener("touchstart", this._handleTouchStart), this._canvas.removeEventListener("touchmove", this._handleTouchMove), this._canvas.removeEventListener("touchend", this._handleTouchEnd);
245
+ };
246
+ d.prototype.isEmpty = function() {
247
+ return this._isEmpty;
248
+ };
249
+ d.prototype._strokeBegin = function(e) {
250
+ this._data.push([]), this._reset(), this._strokeUpdate(e), typeof this.onBegin == "function" && this.onBegin(e);
251
+ };
252
+ d.prototype._strokeUpdate = function(e) {
253
+ var n = e.clientX, r = e.clientY, t = this._createPoint(n, r), o = this._data[this._data.length - 1], a = o && o[o.length - 1], c = a && t.distanceTo(a) < this.minDistance;
254
+ if (!(a && c)) {
255
+ var i = this._addPoint(t), h = i.curve, s = i.widths;
256
+ h && s && this._drawCurve(h, s.start, s.end), this._data[this._data.length - 1].push({
257
+ x: t.x,
258
+ y: t.y,
259
+ time: t.time,
260
+ color: this.penColor
261
+ });
262
+ }
263
+ };
264
+ d.prototype._strokeEnd = function(e) {
265
+ var n = this.points.length > 2, r = this.points[0];
266
+ if (!n && r && this._drawDot(r), r) {
267
+ var t = this._data[this._data.length - 1], o = t[t.length - 1];
268
+ r.equals(o) || t.push({
269
+ x: r.x,
270
+ y: r.y,
271
+ time: r.time,
272
+ color: this.penColor
273
+ });
274
+ }
275
+ typeof this.onEnd == "function" && this.onEnd(e);
276
+ };
277
+ d.prototype._handleMouseEvents = function() {
278
+ this._mouseButtonDown = !1, this._canvas.addEventListener("mousedown", this._handleMouseDown), this._canvas.addEventListener("mousemove", this._handleMouseMove), document.addEventListener("mouseup", this._handleMouseUp);
279
+ };
280
+ d.prototype._handleTouchEvents = function() {
281
+ this._canvas.style.msTouchAction = "none", this._canvas.style.touchAction = "none", this._canvas.addEventListener("touchstart", this._handleTouchStart), this._canvas.addEventListener("touchmove", this._handleTouchMove), this._canvas.addEventListener("touchend", this._handleTouchEnd);
282
+ };
283
+ d.prototype._reset = function() {
284
+ this.points = [], this._lastVelocity = 0, this._lastWidth = (this.minWidth + this.maxWidth) / 2, this._ctx.fillStyle = this.penColor;
285
+ };
286
+ d.prototype._createPoint = function(e, n, r) {
287
+ var t = this._canvas.getBoundingClientRect();
288
+ return new b(e - t.left, n - t.top, r || (/* @__PURE__ */ new Date()).getTime());
289
+ };
290
+ d.prototype._addPoint = function(e) {
291
+ var n = this.points, r = void 0;
292
+ if (n.push(e), n.length > 2) {
293
+ n.length === 3 && n.unshift(n[0]), r = this._calculateCurveControlPoints(n[0], n[1], n[2]);
294
+ var t = r.c2;
295
+ r = this._calculateCurveControlPoints(n[1], n[2], n[3]);
296
+ var o = r.c1, a = new W(n[1], t, o, n[2]), c = this._calculateCurveWidths(a);
297
+ return n.shift(), { curve: a, widths: c };
298
+ }
299
+ return {};
300
+ };
301
+ d.prototype._calculateCurveControlPoints = function(e, n, r) {
302
+ var t = e.x - n.x, o = e.y - n.y, a = n.x - r.x, c = n.y - r.y, i = { x: (e.x + n.x) / 2, y: (e.y + n.y) / 2 }, h = { x: (n.x + r.x) / 2, y: (n.y + r.y) / 2 }, s = Math.sqrt(t * t + o * o), u = Math.sqrt(a * a + c * c), p = i.x - h.x, l = i.y - h.y, f = u / (s + u), y = { x: h.x + p * f, y: h.y + l * f }, v = n.x - y.x, _ = n.y - y.y;
303
+ return {
304
+ c1: new b(i.x + v, i.y + _),
305
+ c2: new b(h.x + v, h.y + _)
306
+ };
307
+ };
308
+ d.prototype._calculateCurveWidths = function(e) {
309
+ var n = e.startPoint, r = e.endPoint, t = { start: null, end: null }, o = this.velocityFilterWeight * r.velocityFrom(n) + (1 - this.velocityFilterWeight) * this._lastVelocity, a = this._strokeWidth(o);
310
+ return t.start = this._lastWidth, t.end = a, this._lastVelocity = o, this._lastWidth = a, t;
311
+ };
312
+ d.prototype._strokeWidth = function(e) {
313
+ return Math.max(this.maxWidth / (e + 1), this.minWidth);
314
+ };
315
+ d.prototype._drawPoint = function(e, n, r) {
316
+ var t = this._ctx;
317
+ t.moveTo(e, n), t.arc(e, n, r, 0, 2 * Math.PI, !1), this._isEmpty = !1;
318
+ };
319
+ d.prototype._drawCurve = function(e, n, r) {
320
+ var t = this._ctx, o = r - n, a = Math.floor(e.length());
321
+ t.beginPath();
322
+ for (var c = 0; c < a; c += 1) {
323
+ var i = c / a, h = i * i, s = h * i, u = 1 - i, p = u * u, l = p * u, f = l * e.startPoint.x;
324
+ f += 3 * p * i * e.control1.x, f += 3 * u * h * e.control2.x, f += s * e.endPoint.x;
325
+ var y = l * e.startPoint.y;
326
+ y += 3 * p * i * e.control1.y, y += 3 * u * h * e.control2.y, y += s * e.endPoint.y;
327
+ var v = n + s * o;
328
+ this._drawPoint(f, y, v);
329
+ }
330
+ t.closePath(), t.fill();
331
+ };
332
+ d.prototype._drawDot = function(e) {
333
+ var n = this._ctx, r = typeof this.dotSize == "function" ? this.dotSize() : this.dotSize;
334
+ n.beginPath(), this._drawPoint(e.x, e.y, r), n.closePath(), n.fill();
335
+ };
336
+ d.prototype._fromData = function(e, n, r) {
337
+ for (var t = 0; t < e.length; t += 1) {
338
+ var o = e[t];
339
+ if (o.length > 1)
340
+ for (var a = 0; a < o.length; a += 1) {
341
+ var c = o[a], i = new b(c.x, c.y, c.time), h = c.color;
342
+ if (a === 0)
343
+ this.penColor = h, this._reset(), this._addPoint(i);
344
+ else if (a !== o.length - 1) {
345
+ var s = this._addPoint(i), u = s.curve, p = s.widths;
346
+ u && p && n(u, p, h);
347
+ }
348
+ }
349
+ else {
350
+ this._reset();
351
+ var l = o[0];
352
+ r(l);
353
+ }
354
+ }
355
+ };
356
+ d.prototype._toSVG = function() {
357
+ var e = this, n = this._data, r = this._canvas, t = Math.max(window.devicePixelRatio || 1, 1), o = 0, a = 0, c = r.width / t, i = r.height / t, h = document.createElementNS("http://www.w3.org/2000/svg", "svg");
358
+ h.setAttributeNS(null, "width", r.width), h.setAttributeNS(null, "height", r.height), this._fromData(n, function(m, x, P) {
359
+ var w = document.createElement("path");
360
+ if (!isNaN(m.control1.x) && !isNaN(m.control1.y) && !isNaN(m.control2.x) && !isNaN(m.control2.y)) {
361
+ var B = "M " + m.startPoint.x.toFixed(3) + "," + m.startPoint.y.toFixed(3) + " " + ("C " + m.control1.x.toFixed(3) + "," + m.control1.y.toFixed(3) + " ") + (m.control2.x.toFixed(3) + "," + m.control2.y.toFixed(3) + " ") + (m.endPoint.x.toFixed(3) + "," + m.endPoint.y.toFixed(3));
362
+ w.setAttribute("d", B), w.setAttribute("stroke-width", (x.end * 2.25).toFixed(3)), w.setAttribute("stroke", P), w.setAttribute("fill", "none"), w.setAttribute("stroke-linecap", "round"), h.appendChild(w);
363
+ }
364
+ }, function(m) {
365
+ var x = document.createElement("circle"), P = typeof e.dotSize == "function" ? e.dotSize() : e.dotSize;
366
+ x.setAttribute("r", P), x.setAttribute("cx", m.x), x.setAttribute("cy", m.y), x.setAttribute("fill", m.color), h.appendChild(x);
367
+ });
368
+ var s = "data:image/svg+xml;base64,", u = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"' + (' viewBox="' + o + " " + a + " " + c + " " + i + '"') + (' width="' + c + '"') + (' height="' + i + '"') + ">", p = h.innerHTML;
369
+ if (p === void 0) {
370
+ var l = document.createElement("dummy"), f = h.childNodes;
371
+ l.innerHTML = "";
372
+ for (var y = 0; y < f.length; y += 1)
373
+ l.appendChild(f[y].cloneNode(!0));
374
+ p = l.innerHTML;
375
+ }
376
+ var v = "</svg>", _ = u + p + v;
377
+ return s + btoa(_);
378
+ };
379
+ d.prototype.fromData = function(e) {
380
+ var n = this;
381
+ this.clear(), this._fromData(e, function(r, t) {
382
+ return n._drawCurve(r, t.start, t.end);
383
+ }, function(r) {
384
+ return n._drawDot(r);
385
+ }), this._data = e;
386
+ };
387
+ d.prototype.toData = function() {
388
+ return this._data;
389
+ };
390
+ var C = { exports: {} }, ot = C.exports, F;
391
+ function it() {
392
+ return F || (F = 1, function(e, n) {
393
+ (function(r, t) {
394
+ e.exports = t();
395
+ })(ot, function() {
396
+ return function(r) {
397
+ function t(a) {
398
+ if (o[a])
399
+ return o[a].exports;
400
+ var c = o[a] = { exports: {}, id: a, loaded: !1 };
401
+ return r[a].call(c.exports, c, c.exports, t), c.loaded = !0, c.exports;
402
+ }
403
+ var o = {};
404
+ return t.m = r, t.c = o, t.p = "", t(0);
405
+ }([function(r, t) {
406
+ function o(s) {
407
+ var u = s.getContext("2d"), p = s.width, l = s.height, f = u.getImageData(0, 0, p, l).data, y = i(!0, p, l, f), v = i(!1, p, l, f), _ = h(!0, p, l, f), m = h(!1, p, l, f), x = m - _ + 1, P = v - y + 1, w = u.getImageData(_, y, x, P);
408
+ return s.width = x, s.height = P, u.clearRect(0, 0, x, P), u.putImageData(w, 0, 0), s;
409
+ }
410
+ function a(s, u, p, l) {
411
+ return { red: l[4 * (p * u + s)], green: l[4 * (p * u + s) + 1], blue: l[4 * (p * u + s) + 2], alpha: l[4 * (p * u + s) + 3] };
412
+ }
413
+ function c(s, u, p, l) {
414
+ return a(s, u, p, l).alpha;
415
+ }
416
+ function i(s, u, p, l) {
417
+ for (var f = s ? 1 : -1, y = s ? 0 : p - 1, v = y; s ? v < p : v > -1; v += f)
418
+ for (var _ = 0; _ < u; _++)
419
+ if (c(_, v, u, l))
420
+ return v;
421
+ return null;
422
+ }
423
+ function h(s, u, p, l) {
424
+ for (var f = s ? 1 : -1, y = s ? 0 : u - 1, v = y; s ? v < u : v > -1; v += f)
425
+ for (var _ = 0; _ < p; _++)
426
+ if (c(v, _, u, l))
427
+ return v;
428
+ return null;
429
+ }
430
+ Object.defineProperty(t, "__esModule", { value: !0 }), t.default = o;
431
+ }]);
432
+ });
433
+ }(C)), C.exports;
434
+ }
435
+ var at = it();
436
+ const st = /* @__PURE__ */ N(at);
437
+ var ct = ["canvasProps", "clearOnResize"], E = /* @__PURE__ */ function(e) {
438
+ G(r, e);
439
+ var n = Q(r);
440
+ function r() {
441
+ var t;
442
+ X(this, r);
443
+ for (var o = arguments.length, a = new Array(o), c = 0; c < o; c++)
444
+ a[c] = arguments[c];
445
+ return t = n.call.apply(n, [this].concat(a)), t.staticThis = t.constructor, t._sigPad = null, t._canvas = null, t.setRef = function(i) {
446
+ t._canvas = i, t._canvas === null && (t._sigPad = null);
447
+ }, t._excludeOurProps = function() {
448
+ var i = t.props;
449
+ i.canvasProps, i.clearOnResize;
450
+ var h = H(i, ct);
451
+ return h;
452
+ }, t.componentDidMount = function() {
453
+ var i = t.getCanvas();
454
+ t._sigPad = new d(i, t._excludeOurProps()), t._resizeCanvas(), t.on();
455
+ }, t.componentWillUnmount = function() {
456
+ t.off();
457
+ }, t.componentDidUpdate = function() {
458
+ Object.assign(t._sigPad, t._excludeOurProps());
459
+ }, t.getCanvas = function() {
460
+ if (t._canvas === null)
461
+ throw t.staticThis.refNullError;
462
+ return t._canvas;
463
+ }, t.getTrimmedCanvas = function() {
464
+ var i = t.getCanvas(), h = document.createElement("canvas");
465
+ return h.width = i.width, h.height = i.height, h.getContext("2d").drawImage(i, 0, 0), st(h);
466
+ }, t.getSignaturePad = function() {
467
+ if (t._sigPad === null)
468
+ throw t.staticThis.refNullError;
469
+ return t._sigPad;
470
+ }, t._checkClearOnResize = function() {
471
+ t.props.clearOnResize && t._resizeCanvas();
472
+ }, t._resizeCanvas = function() {
473
+ var i, h, s = (i = t.props.canvasProps) !== null && i !== void 0 ? i : {}, u = s.width, p = s.height;
474
+ if (!(typeof u < "u" && typeof p < "u")) {
475
+ var l = t.getCanvas(), f = Math.max((h = window.devicePixelRatio) !== null && h !== void 0 ? h : 1, 1);
476
+ typeof u > "u" && (l.width = l.offsetWidth * f), typeof p > "u" && (l.height = l.offsetHeight * f), l.getContext("2d").scale(f, f), t.clear();
477
+ }
478
+ }, t.render = function() {
479
+ var i = t.props.canvasProps;
480
+ return /* @__PURE__ */ A.createElement("canvas", $({
481
+ ref: t.setRef
482
+ }, i));
483
+ }, t.on = function() {
484
+ return window.addEventListener("resize", t._checkClearOnResize), t.getSignaturePad().on();
485
+ }, t.off = function() {
486
+ return window.removeEventListener("resize", t._checkClearOnResize), t.getSignaturePad().off();
487
+ }, t.clear = function() {
488
+ return t.getSignaturePad().clear();
489
+ }, t.isEmpty = function() {
490
+ return t.getSignaturePad().isEmpty();
491
+ }, t.fromDataURL = function(i, h) {
492
+ return t.getSignaturePad().fromDataURL(i, h);
493
+ }, t.toDataURL = function(i, h) {
494
+ return t.getSignaturePad().toDataURL(i, h);
495
+ }, t.fromData = function(i) {
496
+ return t.getSignaturePad().fromData(i);
497
+ }, t.toData = function() {
498
+ return t.getSignaturePad().toData();
499
+ }, t;
500
+ }
501
+ return Y(r);
502
+ }(q);
503
+ E.propTypes = {
504
+ // signature_pad's props
505
+ velocityFilterWeight: g.number,
506
+ minWidth: g.number,
507
+ maxWidth: g.number,
508
+ minDistance: g.number,
509
+ dotSize: g.oneOfType([g.number, g.func]),
510
+ penColor: g.string,
511
+ throttle: g.number,
512
+ onEnd: g.func,
513
+ onBegin: g.func,
514
+ // props specific to the React wrapper
515
+ canvasProps: g.object,
516
+ clearOnResize: g.bool
517
+ };
518
+ E.defaultProps = {
519
+ clearOnResize: !0
520
+ };
521
+ E.refNullError = new Error("react-signature-canvas is currently mounting or unmounting: React refs are null during this phase.");
522
+ const ht = I(
523
+ (e, n) => /* @__PURE__ */ j(E, { ref: n, ...e })
524
+ );
525
+ ht.displayName = "LazySignatureCanvas";
526
+ export {
527
+ ht as default
528
+ };