@flowie-app/ocr-extractor
Version:
Ocr extractor for React
1,489 lines (1,486 loc) • 615 kB
JavaScript
import require$$0, { useRef, useEffect } from "react";
var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function getAugmentedNamespace(s) {
if (s.__esModule)
return s;
var t = s.default;
if (typeof t == "function") {
var e = function r() {
return this instanceof r ? Reflect.construct(t, arguments, this.constructor) : t.apply(this, arguments);
};
e.prototype = t.prototype;
} else
e = {};
return Object.defineProperty(e, "__esModule", { value: !0 }), Object.keys(s).forEach(function(r) {
var n = Object.getOwnPropertyDescriptor(s, r);
Object.defineProperty(e, r, n.get ? n : {
enumerable: !0,
get: function() {
return s[r];
}
});
}), e;
}
var jsxRuntime = { exports: {} }, reactJsxRuntime_production_min = {};
/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var hasRequiredReactJsxRuntime_production_min;
function requireReactJsxRuntime_production_min() {
if (hasRequiredReactJsxRuntime_production_min)
return reactJsxRuntime_production_min;
hasRequiredReactJsxRuntime_production_min = 1;
var s = require$$0, t = Symbol.for("react.element"), e = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, n = s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, a = { key: !0, ref: !0, __self: !0, __source: !0 };
function o(h, l, c) {
var d, p = {}, _ = null, f = null;
c !== void 0 && (_ = "" + c), l.key !== void 0 && (_ = "" + l.key), l.ref !== void 0 && (f = l.ref);
for (d in l)
r.call(l, d) && !a.hasOwnProperty(d) && (p[d] = l[d]);
if (h && h.defaultProps)
for (d in l = h.defaultProps, l)
p[d] === void 0 && (p[d] = l[d]);
return { $$typeof: t, type: h, key: _, ref: f, props: p, _owner: n.current };
}
return reactJsxRuntime_production_min.Fragment = e, reactJsxRuntime_production_min.jsx = o, reactJsxRuntime_production_min.jsxs = o, reactJsxRuntime_production_min;
}
var reactJsxRuntime_development = {};
/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var hasRequiredReactJsxRuntime_development;
function requireReactJsxRuntime_development() {
return hasRequiredReactJsxRuntime_development || (hasRequiredReactJsxRuntime_development = 1, process.env.NODE_ENV !== "production" && function() {
var s = require$$0, t = Symbol.for("react.element"), e = Symbol.for("react.portal"), r = Symbol.for("react.fragment"), n = Symbol.for("react.strict_mode"), a = Symbol.for("react.profiler"), o = Symbol.for("react.provider"), h = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), c = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), _ = Symbol.for("react.lazy"), f = Symbol.for("react.offscreen"), g = Symbol.iterator, A = "@@iterator";
function E(I) {
if (I === null || typeof I != "object")
return null;
var Q = g && I[g] || I[A];
return typeof Q == "function" ? Q : null;
}
var w = s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
function P(I) {
{
for (var Q = arguments.length, et = new Array(Q > 1 ? Q - 1 : 0), st = 1; st < Q; st++)
et[st - 1] = arguments[st];
k("error", I, et);
}
}
function k(I, Q, et) {
{
var st = w.ReactDebugCurrentFrame, vt = st.getStackAddendum();
vt !== "" && (Q += "%s", et = et.concat([vt]));
var yt = et.map(function(ft) {
return String(ft);
});
yt.unshift("Warning: " + Q), Function.prototype.apply.call(console[I], console, yt);
}
}
var S = !1, m = !1, y = !1, x = !1, C = !1, T;
T = Symbol.for("react.module.reference");
function O(I) {
return !!(typeof I == "string" || typeof I == "function" || I === r || I === a || C || I === n || I === c || I === d || x || I === f || S || m || y || typeof I == "object" && I !== null && (I.$$typeof === _ || I.$$typeof === p || I.$$typeof === o || I.$$typeof === h || I.$$typeof === l || // This needs to include all possible module reference object
// types supported by any Flight configuration anywhere since
// we don't know which Flight build this will end up being used
// with.
I.$$typeof === T || I.getModuleId !== void 0));
}
function N(I, Q, et) {
var st = I.displayName;
if (st)
return st;
var vt = Q.displayName || Q.name || "";
return vt !== "" ? et + "(" + vt + ")" : et;
}
function D(I) {
return I.displayName || "Context";
}
function M(I) {
if (I == null)
return null;
if (typeof I.tag == "number" && P("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof I == "function")
return I.displayName || I.name || null;
if (typeof I == "string")
return I;
switch (I) {
case r:
return "Fragment";
case e:
return "Portal";
case a:
return "Profiler";
case n:
return "StrictMode";
case c:
return "Suspense";
case d:
return "SuspenseList";
}
if (typeof I == "object")
switch (I.$$typeof) {
case h:
var Q = I;
return D(Q) + ".Consumer";
case o:
var et = I;
return D(et._context) + ".Provider";
case l:
return N(I, I.render, "ForwardRef");
case p:
var st = I.displayName || null;
return st !== null ? st : M(I.type) || "Memo";
case _: {
var vt = I, yt = vt._payload, ft = vt._init;
try {
return M(ft(yt));
} catch {
return null;
}
}
}
return null;
}
var G = Object.assign, q = 0, W, U, u, v, b, R, F;
function L() {
}
L.__reactDisabledLog = !0;
function B() {
{
if (q === 0) {
W = console.log, U = console.info, u = console.warn, v = console.error, b = console.group, R = console.groupCollapsed, F = console.groupEnd;
var I = {
configurable: !0,
enumerable: !0,
value: L,
writable: !0
};
Object.defineProperties(console, {
info: I,
log: I,
warn: I,
error: I,
group: I,
groupCollapsed: I,
groupEnd: I
});
}
q++;
}
}
function V() {
{
if (q--, q === 0) {
var I = {
configurable: !0,
enumerable: !0,
writable: !0
};
Object.defineProperties(console, {
log: G({}, I, {
value: W
}),
info: G({}, I, {
value: U
}),
warn: G({}, I, {
value: u
}),
error: G({}, I, {
value: v
}),
group: G({}, I, {
value: b
}),
groupCollapsed: G({}, I, {
value: R
}),
groupEnd: G({}, I, {
value: F
})
});
}
q < 0 && P("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
}
}
var H = w.ReactCurrentDispatcher, Y;
function J(I, Q, et) {
{
if (Y === void 0)
try {
throw Error();
} catch (vt) {
var st = vt.stack.trim().match(/\n( *(at )?)/);
Y = st && st[1] || "";
}
return `
` + Y + I;
}
}
var z = !1, K;
{
var tt = typeof WeakMap == "function" ? WeakMap : Map;
K = new tt();
}
function Z(I, Q) {
if (!I || z)
return "";
{
var et = K.get(I);
if (et !== void 0)
return et;
}
var st;
z = !0;
var vt = Error.prepareStackTrace;
Error.prepareStackTrace = void 0;
var yt;
yt = H.current, H.current = null, B();
try {
if (Q) {
var ft = function() {
throw Error();
};
if (Object.defineProperty(ft.prototype, "props", {
set: function() {
throw Error();
}
}), typeof Reflect == "object" && Reflect.construct) {
try {
Reflect.construct(ft, []);
} catch (Dt) {
st = Dt;
}
Reflect.construct(I, [], ft);
} else {
try {
ft.call();
} catch (Dt) {
st = Dt;
}
I.call(ft.prototype);
}
} else {
try {
throw Error();
} catch (Dt) {
st = Dt;
}
I();
}
} catch (Dt) {
if (Dt && st && typeof Dt.stack == "string") {
for (var ut = Dt.stack.split(`
`), kt = st.stack.split(`
`), bt = ut.length - 1, Ct = kt.length - 1; bt >= 1 && Ct >= 0 && ut[bt] !== kt[Ct]; )
Ct--;
for (; bt >= 1 && Ct >= 0; bt--, Ct--)
if (ut[bt] !== kt[Ct]) {
if (bt !== 1 || Ct !== 1)
do
if (bt--, Ct--, Ct < 0 || ut[bt] !== kt[Ct]) {
var Ot = `
` + ut[bt].replace(" at new ", " at ");
return I.displayName && Ot.includes("<anonymous>") && (Ot = Ot.replace("<anonymous>", I.displayName)), typeof I == "function" && K.set(I, Ot), Ot;
}
while (bt >= 1 && Ct >= 0);
break;
}
}
} finally {
z = !1, H.current = yt, V(), Error.prepareStackTrace = vt;
}
var Bt = I ? I.displayName || I.name : "", Xt = Bt ? J(Bt) : "";
return typeof I == "function" && K.set(I, Xt), Xt;
}
function it(I, Q, et) {
return Z(I, !1);
}
function nt(I) {
var Q = I.prototype;
return !!(Q && Q.isReactComponent);
}
function at(I, Q, et) {
if (I == null)
return "";
if (typeof I == "function")
return Z(I, nt(I));
if (typeof I == "string")
return J(I);
switch (I) {
case c:
return J("Suspense");
case d:
return J("SuspenseList");
}
if (typeof I == "object")
switch (I.$$typeof) {
case l:
return it(I.render);
case p:
return at(I.type, Q, et);
case _: {
var st = I, vt = st._payload, yt = st._init;
try {
return at(yt(vt), Q, et);
} catch {
}
}
}
return "";
}
var lt = Object.prototype.hasOwnProperty, ct = {}, _t = w.ReactDebugCurrentFrame;
function Tt(I) {
if (I) {
var Q = I._owner, et = at(I.type, I._source, Q ? Q.type : null);
_t.setExtraStackFrame(et);
} else
_t.setExtraStackFrame(null);
}
function dt(I, Q, et, st, vt) {
{
var yt = Function.call.bind(lt);
for (var ft in I)
if (yt(I, ft)) {
var ut = void 0;
try {
if (typeof I[ft] != "function") {
var kt = Error((st || "React class") + ": " + et + " type `" + ft + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof I[ft] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
throw kt.name = "Invariant Violation", kt;
}
ut = I[ft](Q, ft, st, et, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
} catch (bt) {
ut = bt;
}
ut && !(ut instanceof Error) && (Tt(vt), P("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", st || "React class", et, ft, typeof ut), Tt(null)), ut instanceof Error && !(ut.message in ct) && (ct[ut.message] = !0, Tt(vt), P("Failed %s type: %s", et, ut.message), Tt(null));
}
}
}
var gt = Array.isArray;
function It(I) {
return gt(I);
}
function Rt(I) {
{
var Q = typeof Symbol == "function" && Symbol.toStringTag, et = Q && I[Symbol.toStringTag] || I.constructor.name || "Object";
return et;
}
}
function Et(I) {
try {
return Ft(I), !1;
} catch {
return !0;
}
}
function Ft(I) {
return "" + I;
}
function Pt(I) {
if (Et(I))
return P("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Rt(I)), Ft(I);
}
var wt = w.ReactCurrentOwner, Nt = {
key: !0,
ref: !0,
__self: !0,
__source: !0
}, xt, St, ht;
ht = {};
function X(I) {
if (lt.call(I, "ref")) {
var Q = Object.getOwnPropertyDescriptor(I, "ref").get;
if (Q && Q.isReactWarning)
return !1;
}
return I.ref !== void 0;
}
function j(I) {
if (lt.call(I, "key")) {
var Q = Object.getOwnPropertyDescriptor(I, "key").get;
if (Q && Q.isReactWarning)
return !1;
}
return I.key !== void 0;
}
function $(I, Q) {
if (typeof I.ref == "string" && wt.current && Q && wt.current.stateNode !== Q) {
var et = M(wt.current.type);
ht[et] || (P('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', M(wt.current.type), I.ref), ht[et] = !0);
}
}
function rt(I, Q) {
{
var et = function() {
xt || (xt = !0, P("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", Q));
};
et.isReactWarning = !0, Object.defineProperty(I, "key", {
get: et,
configurable: !0
});
}
}
function ot(I, Q) {
{
var et = function() {
St || (St = !0, P("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", Q));
};
et.isReactWarning = !0, Object.defineProperty(I, "ref", {
get: et,
configurable: !0
});
}
}
var pt = function(I, Q, et, st, vt, yt, ft) {
var ut = {
// This tag allows us to uniquely identify this as a React Element
$$typeof: t,
// Built-in properties that belong on the element
type: I,
key: Q,
ref: et,
props: ft,
// Record the component responsible for creating this element.
_owner: yt
};
return ut._store = {}, Object.defineProperty(ut._store, "validated", {
configurable: !1,
enumerable: !1,
writable: !0,
value: !1
}), Object.defineProperty(ut, "_self", {
configurable: !1,
enumerable: !1,
writable: !1,
value: st
}), Object.defineProperty(ut, "_source", {
configurable: !1,
enumerable: !1,
writable: !1,
value: vt
}), Object.freeze && (Object.freeze(ut.props), Object.freeze(ut)), ut;
};
function mt(I, Q, et, st, vt) {
{
var yt, ft = {}, ut = null, kt = null;
et !== void 0 && (Pt(et), ut = "" + et), j(Q) && (Pt(Q.key), ut = "" + Q.key), X(Q) && (kt = Q.ref, $(Q, vt));
for (yt in Q)
lt.call(Q, yt) && !Nt.hasOwnProperty(yt) && (ft[yt] = Q[yt]);
if (I && I.defaultProps) {
var bt = I.defaultProps;
for (yt in bt)
ft[yt] === void 0 && (ft[yt] = bt[yt]);
}
if (ut || kt) {
var Ct = typeof I == "function" ? I.displayName || I.name || "Unknown" : I;
ut && rt(ft, Ct), kt && ot(ft, Ct);
}
return pt(I, ut, kt, vt, st, wt.current, ft);
}
}
var At = w.ReactCurrentOwner, Lt = w.ReactDebugCurrentFrame;
function Mt(I) {
if (I) {
var Q = I._owner, et = at(I.type, I._source, Q ? Q.type : null);
Lt.setExtraStackFrame(et);
} else
Lt.setExtraStackFrame(null);
}
var Gt;
Gt = !1;
function Ut(I) {
return typeof I == "object" && I !== null && I.$$typeof === t;
}
function Wt() {
{
if (At.current) {
var I = M(At.current.type);
if (I)
return `
Check the render method of \`` + I + "`.";
}
return "";
}
}
function Vt(I) {
{
if (I !== void 0) {
var Q = I.fileName.replace(/^.*[\\\/]/, ""), et = I.lineNumber;
return `
Check your code at ` + Q + ":" + et + ".";
}
return "";
}
}
var Ht = {};
function jt(I) {
{
var Q = Wt();
if (!Q) {
var et = typeof I == "string" ? I : I.displayName || I.name;
et && (Q = `
Check the top-level render call using <` + et + ">.");
}
return Q;
}
}
function $t(I, Q) {
{
if (!I._store || I._store.validated || I.key != null)
return;
I._store.validated = !0;
var et = jt(Q);
if (Ht[et])
return;
Ht[et] = !0;
var st = "";
I && I._owner && I._owner !== At.current && (st = " It was passed a child from " + M(I._owner.type) + "."), Mt(I), P('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', et, st), Mt(null);
}
}
function qt(I, Q) {
{
if (typeof I != "object")
return;
if (It(I))
for (var et = 0; et < I.length; et++) {
var st = I[et];
Ut(st) && $t(st, Q);
}
else if (Ut(I))
I._store && (I._store.validated = !0);
else if (I) {
var vt = E(I);
if (typeof vt == "function" && vt !== I.entries)
for (var yt = vt.call(I), ft; !(ft = yt.next()).done; )
Ut(ft.value) && $t(ft.value, Q);
}
}
}
function Kt(I) {
{
var Q = I.type;
if (Q == null || typeof Q == "string")
return;
var et;
if (typeof Q == "function")
et = Q.propTypes;
else if (typeof Q == "object" && (Q.$$typeof === l || // Note: Memo only checks outer props here.
// Inner props are checked in the reconciler.
Q.$$typeof === p))
et = Q.propTypes;
else
return;
if (et) {
var st = M(Q);
dt(et, I.props, "prop", st, I);
} else if (Q.PropTypes !== void 0 && !Gt) {
Gt = !0;
var vt = M(Q);
P("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", vt || "Unknown");
}
typeof Q.getDefaultProps == "function" && !Q.getDefaultProps.isReactClassApproved && P("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
}
}
function Jt(I) {
{
for (var Q = Object.keys(I.props), et = 0; et < Q.length; et++) {
var st = Q[et];
if (st !== "children" && st !== "key") {
Mt(I), P("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", st), Mt(null);
break;
}
}
I.ref !== null && (Mt(I), P("Invalid attribute `ref` supplied to `React.Fragment`."), Mt(null));
}
}
function zt(I, Q, et, st, vt, yt) {
{
var ft = O(I);
if (!ft) {
var ut = "";
(I === void 0 || typeof I == "object" && I !== null && Object.keys(I).length === 0) && (ut += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
var kt = Vt(vt);
kt ? ut += kt : ut += Wt();
var bt;
I === null ? bt = "null" : It(I) ? bt = "array" : I !== void 0 && I.$$typeof === t ? (bt = "<" + (M(I.type) || "Unknown") + " />", ut = " Did you accidentally export a JSX literal instead of a component?") : bt = typeof I, P("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", bt, ut);
}
var Ct = mt(I, Q, et, vt, yt);
if (Ct == null)
return Ct;
if (ft) {
var Ot = Q.children;
if (Ot !== void 0)
if (st)
if (It(Ot)) {
for (var Bt = 0; Bt < Ot.length; Bt++)
qt(Ot[Bt], I);
Object.freeze && Object.freeze(Ot);
} else
P("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
else
qt(Ot, I);
}
return I === r ? Jt(Ct) : Kt(Ct), Ct;
}
}
function Qt(I, Q, et) {
return zt(I, Q, et, !0);
}
function Zt(I, Q, et) {
return zt(I, Q, et, !1);
}
var te = Zt, ee = Qt;
reactJsxRuntime_development.Fragment = r, reactJsxRuntime_development.jsx = te, reactJsxRuntime_development.jsxs = ee;
}()), reactJsxRuntime_development;
}
process.env.NODE_ENV === "production" ? jsxRuntime.exports = requireReactJsxRuntime_production_min() : jsxRuntime.exports = requireReactJsxRuntime_development();
var jsxRuntimeExports = jsxRuntime.exports, PI_OVER_180 = Math.PI / 180;
function detectBrowser() {
return typeof window < "u" && ({}.toString.call(window) === "[object Window]" || {}.toString.call(window) === "[object global]");
}
const glob = typeof global < "u" ? global : typeof window < "u" ? window : typeof WorkerGlobalScope < "u" ? self : {}, Konva$2 = {
_global: glob,
version: "8.4.3",
isBrowser: detectBrowser(),
isUnminified: /param/.test((function(s) {
}).toString()),
dblClickWindow: 400,
getAngle(s) {
return Konva$2.angleDeg ? s * PI_OVER_180 : s;
},
enableTrace: !1,
pointerEventsEnabled: !0,
autoDrawEnabled: !0,
hitOnDragEnabled: !1,
capturePointerEventsEnabled: !1,
_mouseListenClick: !1,
_touchListenClick: !1,
_pointerListenClick: !1,
_mouseInDblClickWindow: !1,
_touchInDblClickWindow: !1,
_pointerInDblClickWindow: !1,
_mouseDblClickPointerId: null,
_touchDblClickPointerId: null,
_pointerDblClickPointerId: null,
pixelRatio: typeof window < "u" && window.devicePixelRatio || 1,
dragDistance: 3,
angleDeg: !0,
showWarnings: !0,
dragButtons: [0, 1],
isDragging() {
return Konva$2.DD.isDragging;
},
isDragReady() {
return !!Konva$2.DD.node;
},
releaseCanvasOnDestroy: !0,
document: glob.document,
_injectGlobal(s) {
glob.Konva = s;
}
}, _registerNode = (s) => {
Konva$2[s.prototype.getClassName()] = s;
};
Konva$2._injectGlobal(Konva$2);
class Transform {
constructor(t = [1, 0, 0, 1, 0, 0]) {
this.dirty = !1, this.m = t && t.slice() || [1, 0, 0, 1, 0, 0];
}
reset() {
this.m[0] = 1, this.m[1] = 0, this.m[2] = 0, this.m[3] = 1, this.m[4] = 0, this.m[5] = 0;
}
copy() {
return new Transform(this.m);
}
copyInto(t) {
t.m[0] = this.m[0], t.m[1] = this.m[1], t.m[2] = this.m[2], t.m[3] = this.m[3], t.m[4] = this.m[4], t.m[5] = this.m[5];
}
point(t) {
var e = this.m;
return {
x: e[0] * t.x + e[2] * t.y + e[4],
y: e[1] * t.x + e[3] * t.y + e[5]
};
}
translate(t, e) {
return this.m[4] += this.m[0] * t + this.m[2] * e, this.m[5] += this.m[1] * t + this.m[3] * e, this;
}
scale(t, e) {
return this.m[0] *= t, this.m[1] *= t, this.m[2] *= e, this.m[3] *= e, this;
}
rotate(t) {
var e = Math.cos(t), r = Math.sin(t), n = this.m[0] * e + this.m[2] * r, a = this.m[1] * e + this.m[3] * r, o = this.m[0] * -r + this.m[2] * e, h = this.m[1] * -r + this.m[3] * e;
return this.m[0] = n, this.m[1] = a, this.m[2] = o, this.m[3] = h, this;
}
getTranslation() {
return {
x: this.m[4],
y: this.m[5]
};
}
skew(t, e) {
var r = this.m[0] + this.m[2] * e, n = this.m[1] + this.m[3] * e, a = this.m[2] + this.m[0] * t, o = this.m[3] + this.m[1] * t;
return this.m[0] = r, this.m[1] = n, this.m[2] = a, this.m[3] = o, this;
}
multiply(t) {
var e = this.m[0] * t.m[0] + this.m[2] * t.m[1], r = this.m[1] * t.m[0] + this.m[3] * t.m[1], n = this.m[0] * t.m[2] + this.m[2] * t.m[3], a = this.m[1] * t.m[2] + this.m[3] * t.m[3], o = this.m[0] * t.m[4] + this.m[2] * t.m[5] + this.m[4], h = this.m[1] * t.m[4] + this.m[3] * t.m[5] + this.m[5];
return this.m[0] = e, this.m[1] = r, this.m[2] = n, this.m[3] = a, this.m[4] = o, this.m[5] = h, this;
}
invert() {
var t = 1 / (this.m[0] * this.m[3] - this.m[1] * this.m[2]), e = this.m[3] * t, r = -this.m[1] * t, n = -this.m[2] * t, a = this.m[0] * t, o = t * (this.m[2] * this.m[5] - this.m[3] * this.m[4]), h = t * (this.m[1] * this.m[4] - this.m[0] * this.m[5]);
return this.m[0] = e, this.m[1] = r, this.m[2] = n, this.m[3] = a, this.m[4] = o, this.m[5] = h, this;
}
getMatrix() {
return this.m;
}
decompose() {
var t = this.m[0], e = this.m[1], r = this.m[2], n = this.m[3], a = this.m[4], o = this.m[5], h = t * n - e * r;
let l = {
x: a,
y: o,
rotation: 0,
scaleX: 0,
scaleY: 0,
skewX: 0,
skewY: 0
};
if (t != 0 || e != 0) {
var c = Math.sqrt(t * t + e * e);
l.rotation = e > 0 ? Math.acos(t / c) : -Math.acos(t / c), l.scaleX = c, l.scaleY = h / c, l.skewX = (t * r + e * n) / h, l.skewY = 0;
} else if (r != 0 || n != 0) {
var d = Math.sqrt(r * r + n * n);
l.rotation = Math.PI / 2 - (n > 0 ? Math.acos(-r / d) : -Math.acos(r / d)), l.scaleX = h / d, l.scaleY = d, l.skewX = 0, l.skewY = (t * r + e * n) / h;
}
return l.rotation = Util._getRotation(l.rotation), l;
}
}
var OBJECT_ARRAY = "[object Array]", OBJECT_NUMBER = "[object Number]", OBJECT_STRING = "[object String]", OBJECT_BOOLEAN = "[object Boolean]", PI_OVER_DEG180 = Math.PI / 180, DEG180_OVER_PI = 180 / Math.PI, HASH$1 = "#", EMPTY_STRING$1 = "", ZERO = "0", KONVA_WARNING = "Konva warning: ", KONVA_ERROR = "Konva error: ", RGB_PAREN = "rgb(", COLORS = {
aliceblue: [240, 248, 255],
antiquewhite: [250, 235, 215],
aqua: [0, 255, 255],
aquamarine: [127, 255, 212],
azure: [240, 255, 255],
beige: [245, 245, 220],
bisque: [255, 228, 196],
black: [0, 0, 0],
blanchedalmond: [255, 235, 205],
blue: [0, 0, 255],
blueviolet: [138, 43, 226],
brown: [165, 42, 42],
burlywood: [222, 184, 135],
cadetblue: [95, 158, 160],
chartreuse: [127, 255, 0],
chocolate: [210, 105, 30],
coral: [255, 127, 80],
cornflowerblue: [100, 149, 237],
cornsilk: [255, 248, 220],
crimson: [220, 20, 60],
cyan: [0, 255, 255],
darkblue: [0, 0, 139],
darkcyan: [0, 139, 139],
darkgoldenrod: [184, 132, 11],
darkgray: [169, 169, 169],
darkgreen: [0, 100, 0],
darkgrey: [169, 169, 169],
darkkhaki: [189, 183, 107],
darkmagenta: [139, 0, 139],
darkolivegreen: [85, 107, 47],
darkorange: [255, 140, 0],
darkorchid: [153, 50, 204],
darkred: [139, 0, 0],
darksalmon: [233, 150, 122],
darkseagreen: [143, 188, 143],
darkslateblue: [72, 61, 139],
darkslategray: [47, 79, 79],
darkslategrey: [47, 79, 79],
darkturquoise: [0, 206, 209],
darkviolet: [148, 0, 211],
deeppink: [255, 20, 147],
deepskyblue: [0, 191, 255],
dimgray: [105, 105, 105],
dimgrey: [105, 105, 105],
dodgerblue: [30, 144, 255],
firebrick: [178, 34, 34],
floralwhite: [255, 255, 240],
forestgreen: [34, 139, 34],
fuchsia: [255, 0, 255],
gainsboro: [220, 220, 220],
ghostwhite: [248, 248, 255],
gold: [255, 215, 0],
goldenrod: [218, 165, 32],
gray: [128, 128, 128],
green: [0, 128, 0],
greenyellow: [173, 255, 47],
grey: [128, 128, 128],
honeydew: [240, 255, 240],
hotpink: [255, 105, 180],
indianred: [205, 92, 92],
indigo: [75, 0, 130],
ivory: [255, 255, 240],
khaki: [240, 230, 140],
lavender: [230, 230, 250],
lavenderblush: [255, 240, 245],
lawngreen: [124, 252, 0],
lemonchiffon: [255, 250, 205],
lightblue: [173, 216, 230],
lightcoral: [240, 128, 128],
lightcyan: [224, 255, 255],
lightgoldenrodyellow: [250, 250, 210],
lightgray: [211, 211, 211],
lightgreen: [144, 238, 144],
lightgrey: [211, 211, 211],
lightpink: [255, 182, 193],
lightsalmon: [255, 160, 122],
lightseagreen: [32, 178, 170],
lightskyblue: [135, 206, 250],
lightslategray: [119, 136, 153],
lightslategrey: [119, 136, 153],
lightsteelblue: [176, 196, 222],
lightyellow: [255, 255, 224],
lime: [0, 255, 0],
limegreen: [50, 205, 50],
linen: [250, 240, 230],
magenta: [255, 0, 255],
maroon: [128, 0, 0],
mediumaquamarine: [102, 205, 170],
mediumblue: [0, 0, 205],
mediumorchid: [186, 85, 211],
mediumpurple: [147, 112, 219],
mediumseagreen: [60, 179, 113],
mediumslateblue: [123, 104, 238],
mediumspringgreen: [0, 250, 154],
mediumturquoise: [72, 209, 204],
mediumvioletred: [199, 21, 133],
midnightblue: [25, 25, 112],
mintcream: [245, 255, 250],
mistyrose: [255, 228, 225],
moccasin: [255, 228, 181],
navajowhite: [255, 222, 173],
navy: [0, 0, 128],
oldlace: [253, 245, 230],
olive: [128, 128, 0],
olivedrab: [107, 142, 35],
orange: [255, 165, 0],
orangered: [255, 69, 0],
orchid: [218, 112, 214],
palegoldenrod: [238, 232, 170],
palegreen: [152, 251, 152],
paleturquoise: [175, 238, 238],
palevioletred: [219, 112, 147],
papayawhip: [255, 239, 213],
peachpuff: [255, 218, 185],
peru: [205, 133, 63],
pink: [255, 192, 203],
plum: [221, 160, 203],
powderblue: [176, 224, 230],
purple: [128, 0, 128],
rebeccapurple: [102, 51, 153],
red: [255, 0, 0],
rosybrown: [188, 143, 143],
royalblue: [65, 105, 225],
saddlebrown: [139, 69, 19],
salmon: [250, 128, 114],
sandybrown: [244, 164, 96],
seagreen: [46, 139, 87],
seashell: [255, 245, 238],
sienna: [160, 82, 45],
silver: [192, 192, 192],
skyblue: [135, 206, 235],
slateblue: [106, 90, 205],
slategray: [119, 128, 144],
slategrey: [119, 128, 144],
snow: [255, 255, 250],
springgreen: [0, 255, 127],
steelblue: [70, 130, 180],
tan: [210, 180, 140],
teal: [0, 128, 128],
thistle: [216, 191, 216],
transparent: [255, 255, 255, 0],
tomato: [255, 99, 71],
turquoise: [64, 224, 208],
violet: [238, 130, 238],
wheat: [245, 222, 179],
white: [255, 255, 255],
whitesmoke: [245, 245, 245],
yellow: [255, 255, 0],
yellowgreen: [154, 205, 5]
}, RGB_REGEX = /rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/, animQueue = [];
const req = typeof requestAnimationFrame < "u" && requestAnimationFrame || function(s) {
setTimeout(s, 60);
}, Util = {
_isElement(s) {
return !!(s && s.nodeType == 1);
},
_isFunction(s) {
return !!(s && s.constructor && s.call && s.apply);
},
_isPlainObject(s) {
return !!s && s.constructor === Object;
},
_isArray(s) {
return Object.prototype.toString.call(s) === OBJECT_ARRAY;
},
_isNumber(s) {
return Object.prototype.toString.call(s) === OBJECT_NUMBER && !isNaN(s) && isFinite(s);
},
_isString(s) {
return Object.prototype.toString.call(s) === OBJECT_STRING;
},
_isBoolean(s) {
return Object.prototype.toString.call(s) === OBJECT_BOOLEAN;
},
isObject(s) {
return s instanceof Object;
},
isValidSelector(s) {
if (typeof s != "string")
return !1;
var t = s[0];
return t === "#" || t === "." || t === t.toUpperCase();
},
_sign(s) {
return s === 0 || s > 0 ? 1 : -1;
},
requestAnimFrame(s) {
animQueue.push(s), animQueue.length === 1 && req(function() {
const t = animQueue;
animQueue = [], t.forEach(function(e) {
e();
});
});
},
createCanvasElement() {
var s = document.createElement("canvas");
try {
s.style = s.style || {};
} catch {
}
return s;
},
createImageElement() {
return document.createElement("img");
},
_isInDocument(s) {
for (; s = s.parentNode; )
if (s == document)
return !0;
return !1;
},
_urlToImage(s, t) {
var e = Util.createImageElement();
e.onload = function() {
t(e);
}, e.src = s;
},
_rgbToHex(s, t, e) {
return ((1 << 24) + (s << 16) + (t << 8) + e).toString(16).slice(1);
},
_hexToRgb(s) {
s = s.replace(HASH$1, EMPTY_STRING$1);
var t = parseInt(s, 16);
return {
r: t >> 16 & 255,
g: t >> 8 & 255,
b: t & 255
};
},
getRandomColor() {
for (var s = (Math.random() * 16777215 << 0).toString(16); s.length < 6; )
s = ZERO + s;
return HASH$1 + s;
},
getRGB(s) {
var t;
return s in COLORS ? (t = COLORS[s], {
r: t[0],
g: t[1],
b: t[2]
}) : s[0] === HASH$1 ? this._hexToRgb(s.substring(1)) : s.substr(0, 4) === RGB_PAREN ? (t = RGB_REGEX.exec(s.replace(/ /g, "")), {
r: parseInt(t[1], 10),
g: parseInt(t[2], 10),
b: parseInt(t[3], 10)
}) : {
r: 0,
g: 0,
b: 0
};
},
colorToRGBA(s) {
return s = s || "black", Util._namedColorToRBA(s) || Util._hex3ColorToRGBA(s) || Util._hex4ColorToRGBA(s) || Util._hex6ColorToRGBA(s) || Util._hex8ColorToRGBA(s) || Util._rgbColorToRGBA(s) || Util._rgbaColorToRGBA(s) || Util._hslColorToRGBA(s);
},
_namedColorToRBA(s) {
var t = COLORS[s.toLowerCase()];
return t ? {
r: t[0],
g: t[1],
b: t[2],
a: 1
} : null;
},
_rgbColorToRGBA(s) {
if (s.indexOf("rgb(") === 0) {
s = s.match(/rgb\(([^)]+)\)/)[1];
var t = s.split(/ *, */).map(Number);
return {
r: t[0],
g: t[1],
b: t[2],
a: 1
};
}
},
_rgbaColorToRGBA(s) {
if (s.indexOf("rgba(") === 0) {
s = s.match(/rgba\(([^)]+)\)/)[1];
var t = s.split(/ *, */).map((e, r) => e.slice(-1) === "%" ? r === 3 ? parseInt(e) / 100 : parseInt(e) / 100 * 255 : Number(e));
return {
r: t[0],
g: t[1],
b: t[2],
a: t[3]
};
}
},
_hex8ColorToRGBA(s) {
if (s[0] === "#" && s.length === 9)
return {
r: parseInt(s.slice(1, 3), 16),
g: parseInt(s.slice(3, 5), 16),
b: parseInt(s.slice(5, 7), 16),
a: parseInt(s.slice(7, 9), 16) / 255
};
},
_hex6ColorToRGBA(s) {
if (s[0] === "#" && s.length === 7)
return {
r: parseInt(s.slice(1, 3), 16),
g: parseInt(s.slice(3, 5), 16),
b: parseInt(s.slice(5, 7), 16),
a: 1
};
},
_hex4ColorToRGBA(s) {
if (s[0] === "#" && s.length === 5)
return {
r: parseInt(s[1] + s[1], 16),
g: parseInt(s[2] + s[2], 16),
b: parseInt(s[3] + s[3], 16),
a: parseInt(s[4] + s[4], 16) / 255
};
},
_hex3ColorToRGBA(s) {
if (s[0] === "#" && s.length === 4)
return {
r: parseInt(s[1] + s[1], 16),
g: parseInt(s[2] + s[2], 16),
b: parseInt(s[3] + s[3], 16),
a: 1
};
},
_hslColorToRGBA(s) {
if (/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(s)) {
const [t, ...e] = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(s), r = Number(e[0]) / 360, n = Number(e[1]) / 100, a = Number(e[2]) / 100;
let o, h, l;
if (n === 0)
return l = a * 255, {
r: Math.round(l),
g: Math.round(l),
b: Math.round(l),
a: 1
};
a < 0.5 ? o = a * (1 + n) : o = a + n - a * n;
const c = 2 * a - o, d = [0, 0, 0];
for (let p = 0; p < 3; p++)
h = r + 1 / 3 * -(p - 1), h < 0 && h++, h > 1 && h--, 6 * h < 1 ? l = c + (o - c) * 6 * h : 2 * h < 1 ? l = o : 3 * h < 2 ? l = c + (o - c) * (2 / 3 - h) * 6 : l = c, d[p] = l * 255;
return {
r: Math.round(d[0]),
g: Math.round(d[1]),
b: Math.round(d[2]),
a: 1
};
}
},
haveIntersection(s, t) {
return !(t.x > s.x + s.width || t.x + t.width < s.x || t.y > s.y + s.height || t.y + t.height < s.y);
},
cloneObject(s) {
var t = {};
for (var e in s)
this._isPlainObject(s[e]) ? t[e] = this.cloneObject(s[e]) : this._isArray(s[e]) ? t[e] = this.cloneArray(s[e]) : t[e] = s[e];
return t;
},
cloneArray(s) {
return s.slice(0);
},
degToRad(s) {
return s * PI_OVER_DEG180;
},
radToDeg(s) {
return s * DEG180_OVER_PI;
},
_degToRad(s) {
return Util.warn("Util._degToRad is removed. Please use public Util.degToRad instead."), Util.degToRad(s);
},
_radToDeg(s) {
return Util.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."), Util.radToDeg(s);
},
_getRotation(s) {
return Konva$2.angleDeg ? Util.radToDeg(s) : s;
},
_capitalize(s) {
return s.charAt(0).toUpperCase() + s.slice(1);
},
throw(s) {
throw new Error(KONVA_ERROR + s);
},
error(s) {
console.error(KONVA_ERROR + s);
},
warn(s) {
Konva$2.showWarnings && console.warn(KONVA_WARNING + s);
},
each(s, t) {
for (var e in s)
t(e, s[e]);
},
_inRange(s, t, e) {
return t <= s && s < e;
},
_getProjectionToSegment(s, t, e, r, n, a) {
var o, h, l, c = (s - e) * (s - e) + (t - r) * (t - r);
if (c == 0)
o = s, h = t, l = (n - e) * (n - e) + (a - r) * (a - r);
else {
var d = ((n - s) * (e - s) + (a - t) * (r - t)) / c;
d < 0 ? (o = s, h = t, l = (s - n) * (s - n) + (t - a) * (t - a)) : d > 1 ? (o = e, h = r, l = (e - n) * (e - n) + (r - a) * (r - a)) : (o = s + d * (e - s), h = t + d * (r - t), l = (o - n) * (o - n) + (h - a) * (h - a));
}
return [o, h, l];
},
_getProjectionToLine(s, t, e) {
var r = Util.cloneObject(s), n = Number.MAX_VALUE;
return t.forEach(function(a, o) {
if (!(!e && o === t.length - 1)) {
var h = t[(o + 1) % t.length], l = Util._getProjectionToSegment(a.x, a.y, h.x, h.y, s.x, s.y), c = l[0], d = l[1], p = l[2];
p < n && (r.x = c, r.y = d, n = p);
}
}), r;
},
_prepareArrayForTween(s, t, e) {
var r, n = [], a = [];
if (s.length > t.length) {
var o = t;
t = s, s = o;
}
for (r = 0; r < s.length; r += 2)
n.push({
x: s[r],
y: s[r + 1]
});
for (r = 0; r < t.length; r += 2)
a.push({
x: t[r],
y: t[r + 1]
});
var h = [];
return a.forEach(function(l) {
var c = Util._getProjectionToLine(l, n, e);
h.push(c.x), h.push(c.y);
}), h;
},
_prepareToStringify(s) {
var t;
s.visitedByCircularReferenceRemoval = !0;
for (var e in s)
if (s.hasOwnProperty(e) && s[e] && typeof s[e] == "object") {
if (t = Object.getOwnPropertyDescriptor(s, e), s[e].visitedByCircularReferenceRemoval || Util._isElement(s[e]))
if (t.configurable)
delete s[e];
else
return null;
else if (Util._prepareToStringify(s[e]) === null)
if (t.configurable)
delete s[e];
else
return null;
}
return delete s.visitedByCircularReferenceRemoval, s;
},
_assign(s, t) {
for (var e in t)
s[e] = t[e];
return s;
},
_getFirstPointerId(s) {
return s.touches ? s.changedTouches[0].identifier : s.pointerId || 999;
},
releaseCanvas(...s) {
Konva$2.releaseCanvasOnDestroy && s.forEach((t) => {
t.width = 0, t.height = 0;
});
},
drawRoundedRectPath(s, t, e, r) {
let n = 0, a = 0, o = 0, h = 0;
typeof r == "number" ? n = a = o = h = Math.min(r, t / 2, e / 2) : (n = Math.min(r[0] || 0, t / 2, e / 2), a = Math.min(r[1] || 0, t / 2, e / 2), h = Math.min(r[2] || 0, t / 2, e / 2), o = Math.min(r[3] || 0, t / 2, e / 2)), s.moveTo(n, 0), s.lineTo(t - a, 0), s.arc(t - a, a, a, Math.PI * 3 / 2, 0, !1), s.lineTo(t, e - h), s.arc(t - h, e - h, h, 0, Math.PI / 2, !1), s.lineTo(o, e), s.arc(o, e - o, o, Math.PI / 2, Math.PI, !1), s.lineTo(0, n), s.arc(n, n, n, Math.PI, Math.PI * 3 / 2, !1);
}
};
function _formatValue(s) {
return Util._isString(s) ? '"' + s + '"' : Object.prototype.toString.call(s) === "[object Number]" || Util._isBoolean(s) ? s : Object.prototype.toString.call(s);
}
function RGBComponent(s) {
return s > 255 ? 255 : s < 0 ? 0 : Math.round(s);
}
function getNumberValidator() {
if (Konva$2.isUnminified)
return function(s, t) {
return Util._isNumber(s) || Util.warn(_formatValue(s) + ' is a not valid value for "' + t + '" attribute. The value should be a number.'), s;
};
}
function getNumberOrArrayOfNumbersValidator(s) {
if (Konva$2.isUnminified)
return function(t, e) {
let r = Util._isNumber(t), n = Util._isArray(t) && t.length == s;
return !r && !n && Util.warn(_formatValue(t) + ' is a not valid value for "' + e + '" attribute. The value should be a number or Array<number>(' + s + ")"), t;
};
}
function getNumberOrAutoValidator() {
if (Konva$2.isUnminified)
return function(s, t) {
var e = Util._isNumber(s), r = s === "auto";
return e || r || Util.warn(_formatValue(s) + ' is a not valid value for "' + t + '" attribute. The value should be a number or "auto".'), s;
};
}
function getStringValidator() {
if (Konva$2.isUnminified)
return function(s, t) {
return Util._isString(s) || Util.warn(_formatValue(s) + ' is a not valid value for "' + t + '" attribute. The value should be a string.'), s;
};
}
function getStringOrGradientValidator() {
if (Konva$2.isUnminified)
return function(s, t) {
const e = Util._isString(s), r = Object.prototype.toString.call(s) === "[object CanvasGradient]" || s && s.addColorStop;
return e || r || Util.warn(_formatValue(s) + ' is a not valid value for "' + t + '" attribute. The value should be a string or a native gradient.'), s;
};
}
function getNumberArrayValidator() {
if (Konva$2.isUnminified)
return function(s, t) {
const e = Int8Array ? Object.getPrototypeOf(Int8Array) : null;
return e && s instanceof e || (Util._isArray(s) ? s.forEach(function(r) {
Util._isNumber(r) || Util.warn('"' + t + '" attribute has non numeric element ' + r + ". Make sure that all elements are numbers.");
}) : Util.warn(_formatValue(s) + ' is a not valid value for "' + t + '" attribute. The value should be a array of numbers.')), s;
};
}
function getBooleanValidator() {
if (Konva$2.isUnminified)
return function(s, t) {
var e = s === !0 || s === !1;
return e || Util.warn(_formatValue(s) + ' is a not valid value for "' + t + '" attribute. The value should be a boolean.'), s;
};
}
function getComponentValidator(s) {
if (Konva$2.isUnminified)
return function(t, e) {
return t == null || Util.isObject(t) || Util.warn(_formatValue(t) + ' is a not valid value for "' + e + '" attribute. The value should be an object with properties ' + s), t;
};
}
var GET = "get", SET$1 = "set";
const Factory = {
addGetterSetter(s, t, e, r, n) {
Factory.addGetter(s, t, e), Factory.addSetter(s, t, r, n), Factory.addOverloadedGetterSetter(s, t);
},
addGetter(s, t, e) {
var r = GET + Util._capitalize(t);
s.prototype[r] = s.prototype[r] || function() {
var n = this.attrs[t];
return n === void 0 ? e : n;
};
},
addSetter(s, t, e, r) {
var n = SET$1 + Util._capitalize(t);
s.prototype[n] || Factory.overWriteSetter(s, t, e, r);
},
overWriteSetter(s, t, e, r) {
var n = SET$1 + Util._capitalize(t);
s.prototype[n] = function(a) {
return e && a !== void 0 && a !== null && (a = e.call(this, a, t)), this._setAttr(t, a), r && r.call(this), this;
};
},
addComponentsGetterSetter(s, t, e, r, n) {
var a = e.length, o = Util._capitalize, h = GET + o(t), l = SET$1 + o(t), c, d;
s.prototype[h] = function() {
var _ = {};
for (c = 0; c < a; c++)
d = e[c], _[d] = this.getAttr(t + o(d));
return _;
};
var p = getComponentValidator(e);
s.prototype[l] = function(_) {
var f = this.attrs[t], g;
r && (_ = r.call(this, _)), p && p.call(this, _, t);
for (g in _)
_.hasOwnProperty(g) && this._setAttr(t + o(g), _[g]);
return _ || e.forEach((A) => {
this._setAttr(t + o(A), void 0);
}), this._fireChangeEvent(t, f, _), n && n.call(this), this;
}, Factory.addOverloadedGetterSetter(s, t);
},
addOverloadedGetterSetter(s, t) {
var e = Util._capitalize(t), r = SET$1 + e, n = GET + e;
s.prototype[t] = function() {
return arguments.length ? (this[r](arguments[0]), this) : this[n]();
};
},
addDeprecatedGetterSetter(s, t, e, r) {
Util.error("Adding deprecated " + t);
var n = GET + Util._capitalize(t), a = t + " property is deprecated and will be removed soon. Look at Konva change log for more information.";
s.prototype[n] = function() {
Util.error(a);
var o = this.attrs[t];
return o === void 0 ? e : o;
}, Factory.addSetter(s, t, r, function() {
Util.error(a);
}), Factory.addOverloadedGetterSetter(s, t);
},
backCompat(s, t) {
Util.each(t, function(e, r) {
var n = s.prototype[r], a = GET + Util._capitalize(e), o = SET$1 + Util._capitalize(e);
function h() {
n.apply(this, arguments), Util.error('"' + e + '" method is deprecated and will be removed soon. Use ""' + r + '" instead.');
}
s.prototype[e] = h, s.prototype[a] = h, s.prototype[o] = h;
});
},
afterSetFilter() {
this._filterUpToDate = !1;
}
};
function simplifyArray(s) {
var t = [], e = s.length, r = Util, n, a;
for (n = 0; n < e; n++)
a = s[n], r._isNumber(a) ? a = Math.round(a * 1e3) / 1e3 : r._isString(a) || (a = a + ""), t.push(a);
return t;
}
var COMMA = ",", OPEN_PAREN = "(", CLOSE_PAREN = ")", OPEN_PAREN_BRACKET = "([", CLOSE_BRACKET_PAREN = "])", SEMICOLON = ";", DOUBLE_PAREN = "()", EQUALS = "=", CONTEXT_METHODS = [
"arc",
"arcTo",
"beginPath",
"bezierCurveTo",
"clearRect",
"clip",
"closePath",
"createLinearGradient",
"createPattern",
"createRadialGradient",
"drawImage",
"ellipse",
"fill",
"fillText",
"getImageData",
"createImageData",
"lineTo",
"moveTo",
"putImageData",
"quadraticCurveTo",
"rect",
"restore",
"rotate",
"save",
"scale",
"setLineDash",
"setTransform",
"stroke",
"strokeText",
"transform",
"translate"
], CONTEXT_PROPERTIES = [
"fillStyle",
"strokeStyle",
"shadowColor",
"shadowBlur",
"shadowOffsetX",
"shadowOffsetY",
"lineCap",
"lineDashOffset",
"lineJoin",
"lineWidth",
"miterLimit",
"font",
"textAlign",
"textBaseline",
"globalAlpha",
"globalCompositeOperation",
"imageSmoothingEnabled"
];
const traceArrMax = 100;
class Context {
constructor(t) {
this.canvas = t, Konva$2.enableTrace && (this.traceArr = [], this._enableTrace());
}
fillShape(t) {
t.fillEnabled() && this._fill(t);
}
_fill(t) {
}
strokeShape(t) {
t.hasStroke() && this._stroke(t);
}
_stroke(t) {
}
fillStrokeShape(t) {
t.attrs.fillAfterStrokeEnabled ? (this.strokeShape(t), this.fillShape(t)) : (this.fillShape(t), this.strokeShape(t));
}
getTrace(t, e) {
var r = this.traceArr, n = r.length, a = "", o, h, l, c;
for (o = 0; o < n; o++)
h = r[o], l = h.method, l ? (c = h.args, a += l, t ? a += DOUBLE_PAREN : Util._isArray(c[0]) ? a += OPEN_PAREN_BRACKET + c.join(COMMA) + CLOSE_BRACKET_PAREN : (e && (c = c.map((d) => typeof d == "number" ? Math.floor(d) : d)), a += OPEN_PAREN + c.join(COMMA) + CLOSE_PAREN)) : (a += h.property, t || (a += EQUALS + h.val)), a += SEMICOLON;
return a;
}
clearTrace() {
this.traceArr = [];
}
_trace(t) {
var e = this.traceArr, r;
e.push(t), r = e.length, r >= traceArrMax && e.shift();
}
reset() {
var t = this.getCanvas().getPixelRatio();
this.setTransform(1 * t, 0, 0, 1 * t, 0, 0);
}
getCanvas() {
return this.canvas;
}
clear(t) {
var e = this.getCanvas();
t ? this.clearRect(t.x || 0, t.y || 0, t.width || 0, t.height || 0) : this.clearRect(0, 0, e.getWidth() / e.pixelRatio, e.getHeight() / e.pixelRatio);
}
_applyLineCap(t) {
const e = t.attrs.lineCap;
e && this.setAttr("lineCap", e);
}
_applyOpacity(t) {
var e = t.getAbsoluteOpacity();
e !== 1 && this.setAttr("globalAlpha", e);
}
_applyLineJoin(t) {
const e = t.attrs.lineJoin;
e && this.setAttr("lineJoin", e);
}
setAttr(t, e) {
this._context[t] = e;
}
arc(t, e, r, n, a, o) {
this._context.arc(t, e, r, n, a, o);
}
arcTo(t, e, r, n, a) {
this._context