@determaer/cmkd
Version:
Cognitive Maps of Knowledge Diagnosis (CMKD) interactive builder
1,483 lines • 140 kB
JavaScript
import { ref as J, computed as M, defineComponent as pt, resolveComponent as ft, createElementBlock as et, openBlock as N, Fragment as it, createBlock as X, renderList as At, unref as k, createVNode as Ft, createCommentVNode as st, watch as Kt, withCtx as Qt } from "vue";
const Be = (i, a, S) => {
const s = [];
return i.forEach((c) => {
i.filter(
(p) => c.connections.some((_) => p.id == _)
).forEach((p) => {
const _ = S || c.isBase, C = S || p.isBase, y = p.score < 0 || c.score < 0;
(a && y && p.isBase && c.isBase || !a && _ && C) && s.push({
objLabelOut: c,
objLabelIn: p
});
});
}), s;
}, Ve = (i, a) => {
const s = i.length, c = s * 5, g = [];
return i.forEach((p, _) => {
const C = (_ * 5 + 2) * (360 / c) + 90;
g.push({
labelId: p.id,
inAngle: (_ * 5 + 3) * (360 / c) + 90,
outAngle: C,
labelAngle: ((_ + 1) * 2 - 1) * (360 / (s * 2)) + 90,
arrowAngle: C - 2 * a
});
}), g;
}, He = (i, a) => {
const S = [90];
let s;
return a.forEach((c, g) => {
if (g == 0) {
s = c;
return;
}
if (s.prop !== c.prop) {
const p = i.find((C) => C.labelId == s.id)?.labelAngle ?? 0, _ = i.find((C) => C.labelId == c.id)?.labelAngle ?? 0;
S.push(p + (_ - p) / 2);
}
s = c;
}), S;
};
function Ut(i) {
return i instanceof Object && "id" in i && "prop" in i && "typeText" in i && "numText" in i && "type" in i && "num" in i && "score" in i && "isBase" in i && "connections" in i && "secStart" in i && "secEnd" in i && "fontStyle" in i && "arrowOut" in i && "arrowIn" in i && "level" in i && "grey" in i && "sectorName" in i;
}
const Ri = {
id: 0,
prop: 0,
typeText: "u",
numText: "1",
type: "circle",
num: 1,
score: 1,
isBase: !0,
connections: [],
secStart: !0,
secEnd: !0,
fontStyle: "normal",
arrowOut: !1,
arrowIn: !1,
level: 0,
isLabel: !0,
secLength: 1,
grey: !1,
yellow: !1,
sectorName: ""
}, We = (i, a, S) => {
const s = [];
let c, g = 9999;
return S.forEach((p, _) => {
g > p.level && (g = p.level, c = [0]);
let C = null, y = null;
const L = c[c.length - 1] ?? 0;
if (p.level > 0 && p.secLength != null)
C = L + 360 * (p.secLength / i) - 1e-4, y = {
sLevel: p.level,
shortname: p.typeText + p.numText,
object: {
id: p.id,
isLabel: p.isLabel,
fontStyle: p.fontStyle,
numText: p.numText,
typeText: p.typeText,
score: p.score
}
};
else if (p.level == 0 && p.secEnd) {
if (C = 359.9999, _ != S.length - 1) {
const O = a.find(
(H) => H.labelId === S[_ + 1]?.id
)?.labelAngle, B = a.find(
(H) => H.labelId === p.id
)?.labelAngle;
O != null && B != null && (C = B + (O - B) / 2 - 90);
}
y = {
sLevel: p.level,
shortname: p.sectorName,
object: {
id: p.id
}
};
} else return;
c.push(C), s.push({
sStart: L,
sEnd: C,
sLevel: y.sLevel,
object: y.object,
shortname: y.shortname
});
}), s;
}, se = J(800), Xe = M(() => se.value / 2), Ee = M(
() => Jt.value.reduce(
(i, a) => i = a.level > i ? a.level : i,
0
)
), vt = M(() => Xt.value.length), Ye = M(() => vt.value < 50 ? 0 : 50), Ke = M(
() => Ge.value ? 50 * le.value : 0
), Gt = (i) => (i + Ye.value) * le.value, ze = M(() => ({
outerRadius: Gt(250),
innerRadius: Gt(200),
labelRadius: Gt(225),
additionalLabelRadius: Gt(285),
lineStartRadius: Gt(190),
mergingPortsRadius: Gt(212),
sectorNameRadius: Gt(275) + Ke.value
})), oe = M(
() => Ve(Xt.value, Oe.value)
), $e = M(
() => He(oe.value, Xt.value)
), le = M(() => se.value / 800), Oe = M(() => vt.value <= 10 ? 1 : vt.value > 10 && vt.value < 20 ? 0.9 : vt.value >= 20 && vt.value < 30 ? 0.8 : vt.value >= 30 && vt.value < 40 ? 0.75 : vt.value >= 40 && vt.value < 50 ? 0.7 : vt.value >= 50 ? 0.65 : 1), ge = J(0), Ge = J(!1), Fe = J(!0), qe = J(!1), Ie = J(!1), Me = M(() => Ee.value == 0), Je = J(!1), Ze = J(!1), Qe = J(!1), ti = M(() => !!Me.value), Jt = J([]), Xt = M(
() => Jt.value.filter((i) => i.level == 0)
), ei = M(
() => We(vt.value, oe.value, Jt.value)
), ii = M(
() => Be(Xt.value, Ie.value, Fe.value)
), St = () => {
function i() {
setTimeout(() => {
ge.value++;
}, 0);
}
return {
width: se,
centerPoint: Xe,
circleNum: Ee,
discNum: vt,
angles: oe,
dividerAngles: $e,
radiuses: ze,
scaleMultiplier: le,
sizeMultiplier: Oe,
showSupportRect: Ge,
showDefaultRect: Ze,
showUnreached: Qe,
showAdditionalInCircle: Fe,
showScore: qe,
showLight: Ie,
showSectorName: ti,
oneLevel: Me,
showImportant: Je,
labels: Jt,
labelsZero: Xt,
sectors: ei,
lines: ii,
reloadCount: ge,
updateCMKD: i
};
}, ve = St(), ni = J(-1e3), ai = J(-1e3), Bt = J(!1), Vt = J(!1), Ht = J(!1), pe = J(), mt = J(), ri = M(() => mt.value != null ? [
mt.value.objLabel,
...mt.value.prevLabels,
...mt.value.nextLabels
] : []), si = M(() => {
const i = [];
return mt.value?.nextLabels.map((a) => {
mt.value?.objLabel && i.push({
objLabelIn: mt.value?.objLabel.label,
objLabelOut: a.label
});
}), mt.value?.prevLabels.map((a) => {
mt.value?.objLabel && i.push({
objLabelIn: a.label,
objLabelOut: mt.value?.objLabel.label
});
}), i;
}), be = J(), zt = J(), Dt = () => {
function i() {
Bt.value = !1, Vt.value = !1, Ht.value = !1;
}
function a(c) {
let g = [], p = [];
ve.labelsZero.value.map((_) => {
_.connections.map((C) => {
c.id === C && p.push({
label: _,
selected: !1
});
});
}), c.connections.map((_) => {
const C = ve.labelsZero.value.find(
(y) => y.id === _
);
C && g.push({
label: C,
selected: !1
});
}), Bt.value = !1, Ht.value = !1, Vt.value = !0, mt.value = {
objLabel: { label: c, selected: !0 },
nextLabels: p,
prevLabels: g
}, zt.value = {
type: "label",
object: c,
nextLabels: p,
prevLabels: g
};
}
function S(c, g) {
Bt.value = !0, Ht.value = !1, Vt.value = !1, pe.value = {
objLabelIn: c,
objLabelOut: g
}, zt.value = {
type: "line",
object: {
objLabelIn: c,
objLabelOut: g
}
};
}
function s(c) {
Bt.value = !1, Ht.value = !0, Vt.value = !1, be.value = c, zt.value = {
type: "sector",
object: c
};
}
return {
clickLayerX: ni,
clickLayerY: ai,
clickedLine: pe,
clickedLabel: mt,
labelsToDraw: ri,
linesToDraw: si,
clickedSector: be,
clickedInfo: zt,
isClickedLine: Bt,
isClickedLabel: Vt,
isClickedSector: Ht,
resetClicked: i,
setClickedLabel: a,
setClickedLine: S,
setClickedSector: s
};
}, tt = (i, a, S) => {
const s = S / 180 * Math.PI, c = i + a * Math.cos(s), g = i - a * Math.sin(s);
return { x: +c.toFixed(2), y: +g.toFixed(2) };
};
function Ai(i) {
return i instanceof Object && "objLabelIn" in i && "objLabelOut" in i && Ut(i.objLabelIn) && Ut(i.objLabelOut);
}
function Ti(i) {
return i instanceof Object && "sStart" in i && "sEnd" in i && "sLevel" in i && "object" in i && Ut(i.object);
}
function oi(i) {
return i instanceof Object && "id" in i && "isLabel" in i && "numText" in i && "typeText" in i && "score" in i && "fontStyle" in i;
}
var me = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Mt = {}, te = {}, ee = {}, _e;
function Ct() {
return _e || (_e = 1, (function(i) {
Object.defineProperty(i, "__esModule", { value: !0 }), i._registerNode = i.Konva = i.glob = void 0;
const a = Math.PI / 180;
function S() {
return typeof window < "u" && ({}.toString.call(window) === "[object Window]" || {}.toString.call(window) === "[object global]");
}
i.glob = typeof me < "u" ? me : typeof window < "u" ? window : typeof WorkerGlobalScope < "u" ? self : {}, i.Konva = {
_global: i.glob,
version: "9.3.22",
isBrowser: S(),
isUnminified: /param/.test((function(c) {
}).toString()),
dblClickWindow: 400,
getAngle(c) {
return i.Konva.angleDeg ? c * a : c;
},
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,
_fixTextRendering: !1,
pixelRatio: typeof window < "u" && window.devicePixelRatio || 1,
dragDistance: 3,
angleDeg: !0,
showWarnings: !0,
dragButtons: [0, 1],
isDragging() {
return i.Konva.DD.isDragging;
},
isTransforming() {
var c;
return (c = i.Konva.Transformer) === null || c === void 0 ? void 0 : c.isTransforming();
},
isDragReady() {
return !!i.Konva.DD.node;
},
releaseCanvasOnDestroy: !0,
document: i.glob.document,
_injectGlobal(c) {
i.glob.Konva = c;
}
};
const s = (c) => {
i.Konva[c.prototype.getClassName()] = c;
};
i._registerNode = s, i.Konva._injectGlobal(i.Konva);
})(ee)), ee;
}
var ye;
function Et() {
return ye || (ye = 1, (function(i) {
Object.defineProperty(i, "__esModule", { value: !0 }), i.Util = i.Transform = void 0;
const a = Ct();
class S {
constructor(r = [1, 0, 0, 1, 0, 0]) {
this.dirty = !1, this.m = r && r.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 S(this.m);
}
copyInto(r) {
r.m[0] = this.m[0], r.m[1] = this.m[1], r.m[2] = this.m[2], r.m[3] = this.m[3], r.m[4] = this.m[4], r.m[5] = this.m[5];
}
point(r) {
const d = this.m;
return {
x: d[0] * r.x + d[2] * r.y + d[4],
y: d[1] * r.x + d[3] * r.y + d[5]
};
}
translate(r, d) {
return this.m[4] += this.m[0] * r + this.m[2] * d, this.m[5] += this.m[1] * r + this.m[3] * d, this;
}
scale(r, d) {
return this.m[0] *= r, this.m[1] *= r, this.m[2] *= d, this.m[3] *= d, this;
}
rotate(r) {
const d = Math.cos(r), b = Math.sin(r), T = this.m[0] * d + this.m[2] * b, v = this.m[1] * d + this.m[3] * b, A = this.m[0] * -b + this.m[2] * d, m = this.m[1] * -b + this.m[3] * d;
return this.m[0] = T, this.m[1] = v, this.m[2] = A, this.m[3] = m, this;
}
getTranslation() {
return {
x: this.m[4],
y: this.m[5]
};
}
skew(r, d) {
const b = this.m[0] + this.m[2] * d, T = this.m[1] + this.m[3] * d, v = this.m[2] + this.m[0] * r, A = this.m[3] + this.m[1] * r;
return this.m[0] = b, this.m[1] = T, this.m[2] = v, this.m[3] = A, this;
}
multiply(r) {
const d = this.m[0] * r.m[0] + this.m[2] * r.m[1], b = this.m[1] * r.m[0] + this.m[3] * r.m[1], T = this.m[0] * r.m[2] + this.m[2] * r.m[3], v = this.m[1] * r.m[2] + this.m[3] * r.m[3], A = this.m[0] * r.m[4] + this.m[2] * r.m[5] + this.m[4], m = this.m[1] * r.m[4] + this.m[3] * r.m[5] + this.m[5];
return this.m[0] = d, this.m[1] = b, this.m[2] = T, this.m[3] = v, this.m[4] = A, this.m[5] = m, this;
}
invert() {
const r = 1 / (this.m[0] * this.m[3] - this.m[1] * this.m[2]), d = this.m[3] * r, b = -this.m[1] * r, T = -this.m[2] * r, v = this.m[0] * r, A = r * (this.m[2] * this.m[5] - this.m[3] * this.m[4]), m = r * (this.m[1] * this.m[4] - this.m[0] * this.m[5]);
return this.m[0] = d, this.m[1] = b, this.m[2] = T, this.m[3] = v, this.m[4] = A, this.m[5] = m, this;
}
getMatrix() {
return this.m;
}
decompose() {
const r = this.m[0], d = this.m[1], b = this.m[2], T = this.m[3], v = this.m[4], A = this.m[5], m = r * T - d * b, R = {
x: v,
y: A,
rotation: 0,
scaleX: 0,
scaleY: 0,
skewX: 0,
skewY: 0
};
if (r != 0 || d != 0) {
const I = Math.sqrt(r * r + d * d);
R.rotation = d > 0 ? Math.acos(r / I) : -Math.acos(r / I), R.scaleX = I, R.scaleY = m / I, R.skewX = (r * b + d * T) / m, R.skewY = 0;
} else if (b != 0 || T != 0) {
const I = Math.sqrt(b * b + T * T);
R.rotation = Math.PI / 2 - (T > 0 ? Math.acos(-b / I) : -Math.acos(b / I)), R.scaleX = m / I, R.scaleY = I, R.skewX = 0, R.skewY = (r * b + d * T) / m;
}
return R.rotation = i.Util._getRotation(R.rotation), R;
}
}
i.Transform = S;
const s = "[object Array]", c = "[object Number]", g = "[object String]", p = "[object Boolean]", _ = Math.PI / 180, C = 180 / Math.PI, y = "#", L = "", O = "0", B = "Konva warning: ", H = "Konva error: ", w = "rgb(", G = {
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]
}, W = /rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/;
let j = [];
const o = typeof requestAnimationFrame < "u" && requestAnimationFrame || function(t) {
setTimeout(t, 60);
};
i.Util = {
_isElement(t) {
return !!(t && t.nodeType == 1);
},
_isFunction(t) {
return !!(t && t.constructor && t.call && t.apply);
},
_isPlainObject(t) {
return !!t && t.constructor === Object;
},
_isArray(t) {
return Object.prototype.toString.call(t) === s;
},
_isNumber(t) {
return Object.prototype.toString.call(t) === c && !isNaN(t) && isFinite(t);
},
_isString(t) {
return Object.prototype.toString.call(t) === g;
},
_isBoolean(t) {
return Object.prototype.toString.call(t) === p;
},
isObject(t) {
return t instanceof Object;
},
isValidSelector(t) {
if (typeof t != "string")
return !1;
const r = t[0];
return r === "#" || r === "." || r === r.toUpperCase();
},
_sign(t) {
return t === 0 || t > 0 ? 1 : -1;
},
requestAnimFrame(t) {
j.push(t), j.length === 1 && o(function() {
const r = j;
j = [], r.forEach(function(d) {
d();
});
});
},
createCanvasElement() {
const t = document.createElement("canvas");
try {
t.style = t.style || {};
} catch {
}
return t;
},
createImageElement() {
return document.createElement("img");
},
_isInDocument(t) {
for (; t = t.parentNode; )
if (t == document)
return !0;
return !1;
},
_urlToImage(t, r) {
const d = i.Util.createImageElement();
d.onload = function() {
r(d);
}, d.src = t;
},
_rgbToHex(t, r, d) {
return ((1 << 24) + (t << 16) + (r << 8) + d).toString(16).slice(1);
},
_hexToRgb(t) {
t = t.replace(y, L);
const r = parseInt(t, 16);
return {
r: r >> 16 & 255,
g: r >> 8 & 255,
b: r & 255
};
},
getRandomColor() {
let t = (Math.random() * 16777215 << 0).toString(16);
for (; t.length < 6; )
t = O + t;
return y + t;
},
getRGB(t) {
let r;
return t in G ? (r = G[t], {
r: r[0],
g: r[1],
b: r[2]
}) : t[0] === y ? this._hexToRgb(t.substring(1)) : t.substr(0, 4) === w ? (r = W.exec(t.replace(/ /g, "")), {
r: parseInt(r[1], 10),
g: parseInt(r[2], 10),
b: parseInt(r[3], 10)
}) : {
r: 0,
g: 0,
b: 0
};
},
colorToRGBA(t) {
return t = t || "black", i.Util._namedColorToRBA(t) || i.Util._hex3ColorToRGBA(t) || i.Util._hex4ColorToRGBA(t) || i.Util._hex6ColorToRGBA(t) || i.Util._hex8ColorToRGBA(t) || i.Util._rgbColorToRGBA(t) || i.Util._rgbaColorToRGBA(t) || i.Util._hslColorToRGBA(t);
},
_namedColorToRBA(t) {
const r = G[t.toLowerCase()];
return r ? {
r: r[0],
g: r[1],
b: r[2],
a: 1
} : null;
},
_rgbColorToRGBA(t) {
if (t.indexOf("rgb(") === 0) {
t = t.match(/rgb\(([^)]+)\)/)[1];
const r = t.split(/ *, */).map(Number);
return {
r: r[0],
g: r[1],
b: r[2],
a: 1
};
}
},
_rgbaColorToRGBA(t) {
if (t.indexOf("rgba(") === 0) {
t = t.match(/rgba\(([^)]+)\)/)[1];
const r = t.split(/ *, */).map((d, b) => d.slice(-1) === "%" ? b === 3 ? parseInt(d) / 100 : parseInt(d) / 100 * 255 : Number(d));
return {
r: r[0],
g: r[1],
b: r[2],
a: r[3]
};
}
},
_hex8ColorToRGBA(t) {
if (t[0] === "#" && t.length === 9)
return {
r: parseInt(t.slice(1, 3), 16),
g: parseInt(t.slice(3, 5), 16),
b: parseInt(t.slice(5, 7), 16),
a: parseInt(t.slice(7, 9), 16) / 255
};
},
_hex6ColorToRGBA(t) {
if (t[0] === "#" && t.length === 7)
return {
r: parseInt(t.slice(1, 3), 16),
g: parseInt(t.slice(3, 5), 16),
b: parseInt(t.slice(5, 7), 16),
a: 1
};
},
_hex4ColorToRGBA(t) {
if (t[0] === "#" && t.length === 5)
return {
r: parseInt(t[1] + t[1], 16),
g: parseInt(t[2] + t[2], 16),
b: parseInt(t[3] + t[3], 16),
a: parseInt(t[4] + t[4], 16) / 255
};
},
_hex3ColorToRGBA(t) {
if (t[0] === "#" && t.length === 4)
return {
r: parseInt(t[1] + t[1], 16),
g: parseInt(t[2] + t[2], 16),
b: parseInt(t[3] + t[3], 16),
a: 1
};
},
_hslColorToRGBA(t) {
if (/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(t)) {
const [r, ...d] = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t), b = Number(d[0]) / 360, T = Number(d[1]) / 100, v = Number(d[2]) / 100;
let A, m, R;
if (T === 0)
return R = v * 255, {
r: Math.round(R),
g: Math.round(R),
b: Math.round(R),
a: 1
};
v < 0.5 ? A = v * (1 + T) : A = v + T - v * T;
const I = 2 * v - A, V = [0, 0, 0];
for (let D = 0; D < 3; D++)
m = b + 1 / 3 * -(D - 1), m < 0 && m++, m > 1 && m--, 6 * m < 1 ? R = I + (A - I) * 6 * m : 2 * m < 1 ? R = A : 3 * m < 2 ? R = I + (A - I) * (2 / 3 - m) * 6 : R = I, V[D] = R * 255;
return {
r: Math.round(V[0]),
g: Math.round(V[1]),
b: Math.round(V[2]),
a: 1
};
}
},
haveIntersection(t, r) {
return !(r.x > t.x + t.width || r.x + r.width < t.x || r.y > t.y + t.height || r.y + r.height < t.y);
},
cloneObject(t) {
const r = {};
for (const d in t)
this._isPlainObject(t[d]) ? r[d] = this.cloneObject(t[d]) : this._isArray(t[d]) ? r[d] = this.cloneArray(t[d]) : r[d] = t[d];
return r;
},
cloneArray(t) {
return t.slice(0);
},
degToRad(t) {
return t * _;
},
radToDeg(t) {
return t * C;
},
_degToRad(t) {
return i.Util.warn("Util._degToRad is removed. Please use public Util.degToRad instead."), i.Util.degToRad(t);
},
_radToDeg(t) {
return i.Util.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."), i.Util.radToDeg(t);
},
_getRotation(t) {
return a.Konva.angleDeg ? i.Util.radToDeg(t) : t;
},
_capitalize(t) {
return t.charAt(0).toUpperCase() + t.slice(1);
},
throw(t) {
throw new Error(H + t);
},
error(t) {
console.error(H + t);
},
warn(t) {
a.Konva.showWarnings && console.warn(B + t);
},
each(t, r) {
for (const d in t)
r(d, t[d]);
},
_inRange(t, r, d) {
return r <= t && t < d;
},
_getProjectionToSegment(t, r, d, b, T, v) {
let A, m, R;
const I = (t - d) * (t - d) + (r - b) * (r - b);
if (I == 0)
A = t, m = r, R = (T - d) * (T - d) + (v - b) * (v - b);
else {
const V = ((T - t) * (d - t) + (v - r) * (b - r)) / I;
V < 0 ? (A = t, m = r, R = (t - T) * (t - T) + (r - v) * (r - v)) : V > 1 ? (A = d, m = b, R = (d - T) * (d - T) + (b - v) * (b - v)) : (A = t + V * (d - t), m = r + V * (b - r), R = (A - T) * (A - T) + (m - v) * (m - v));
}
return [A, m, R];
},
_getProjectionToLine(t, r, d) {
const b = i.Util.cloneObject(t);
let T = Number.MAX_VALUE;
return r.forEach(function(v, A) {
if (!d && A === r.length - 1)
return;
const m = r[(A + 1) % r.length], R = i.Util._getProjectionToSegment(v.x, v.y, m.x, m.y, t.x, t.y), I = R[0], V = R[1], D = R[2];
D < T && (b.x = I, b.y = V, T = D);
}), b;
},
_prepareArrayForTween(t, r, d) {
const b = [], T = [];
if (t.length > r.length) {
const A = r;
r = t, t = A;
}
for (let A = 0; A < t.length; A += 2)
b.push({
x: t[A],
y: t[A + 1]
});
for (let A = 0; A < r.length; A += 2)
T.push({
x: r[A],
y: r[A + 1]
});
const v = [];
return T.forEach(function(A) {
const m = i.Util._getProjectionToLine(A, b, d);
v.push(m.x), v.push(m.y);
}), v;
},
_prepareToStringify(t) {
let r;
t.visitedByCircularReferenceRemoval = !0;
for (const d in t)
if (t.hasOwnProperty(d) && t[d] && typeof t[d] == "object") {
if (r = Object.getOwnPropertyDescriptor(t, d), t[d].visitedByCircularReferenceRemoval || i.Util._isElement(t[d]))
if (r.configurable)
delete t[d];
else
return null;
else if (i.Util._prepareToStringify(t[d]) === null)
if (r.configurable)
delete t[d];
else
return null;
}
return delete t.visitedByCircularReferenceRemoval, t;
},
_assign(t, r) {
for (const d in r)
t[d] = r[d];
return t;
},
_getFirstPointerId(t) {
return t.touches ? t.changedTouches[0].identifier : t.pointerId || 999;
},
releaseCanvas(...t) {
a.Konva.releaseCanvasOnDestroy && t.forEach((r) => {
r.width = 0, r.height = 0;
});
},
drawRoundedRectPath(t, r, d, b) {
let T = 0, v = 0, A = 0, m = 0;
typeof b == "number" ? T = v = A = m = Math.min(b, r / 2, d / 2) : (T = Math.min(b[0] || 0, r / 2, d / 2), v = Math.min(b[1] || 0, r / 2, d / 2), m = Math.min(b[2] || 0, r / 2, d / 2), A = Math.min(b[3] || 0, r / 2, d / 2)), t.moveTo(T, 0), t.lineTo(r - v, 0), t.arc(r - v, v, v, Math.PI * 3 / 2, 0, !1), t.lineTo(r, d - m), t.arc(r - m, d - m, m, 0, Math.PI / 2, !1), t.lineTo(A, d), t.arc(A, d - A, A, Math.PI / 2, Math.PI, !1), t.lineTo(0, T), t.arc(T, T, T, Math.PI, Math.PI * 3 / 2, !1);
}
};
})(te)), te;
}
var ie = {}, ut = {}, Ce;
function Zt() {
if (Ce) return ut;
Ce = 1, Object.defineProperty(ut, "__esModule", { value: !0 }), ut.RGBComponent = s, ut.alphaComponent = c, ut.getNumberValidator = g, ut.getNumberOrArrayOfNumbersValidator = p, ut.getNumberOrAutoValidator = _, ut.getStringValidator = C, ut.getStringOrGradientValidator = y, ut.getFunctionValidator = L, ut.getNumberArrayValidator = O, ut.getBooleanValidator = B, ut.getComponentValidator = H;
const i = Ct(), a = Et();
function S(w) {
return a.Util._isString(w) ? '"' + w + '"' : Object.prototype.toString.call(w) === "[object Number]" || a.Util._isBoolean(w) ? w : Object.prototype.toString.call(w);
}
function s(w) {
return w > 255 ? 255 : w < 0 ? 0 : Math.round(w);
}
function c(w) {
return w > 1 ? 1 : w < 1e-4 ? 1e-4 : w;
}
function g() {
if (i.Konva.isUnminified)
return function(w, G) {
return a.Util._isNumber(w) || a.Util.warn(S(w) + ' is a not valid value for "' + G + '" attribute. The value should be a number.'), w;
};
}
function p(w) {
if (i.Konva.isUnminified)
return function(G, W) {
let j = a.Util._isNumber(G), o = a.Util._isArray(G) && G.length == w;
return !j && !o && a.Util.warn(S(G) + ' is a not valid value for "' + W + '" attribute. The value should be a number or Array<number>(' + w + ")"), G;
};
}
function _() {
if (i.Konva.isUnminified)
return function(w, G) {
return a.Util._isNumber(w) || w === "auto" || a.Util.warn(S(w) + ' is a not valid value for "' + G + '" attribute. The value should be a number or "auto".'), w;
};
}
function C() {
if (i.Konva.isUnminified)
return function(w, G) {
return a.Util._isString(w) || a.Util.warn(S(w) + ' is a not valid value for "' + G + '" attribute. The value should be a string.'), w;
};
}
function y() {
if (i.Konva.isUnminified)
return function(w, G) {
const W = a.Util._isString(w), j = Object.prototype.toString.call(w) === "[object CanvasGradient]" || w && w.addColorStop;
return W || j || a.Util.warn(S(w) + ' is a not valid value for "' + G + '" attribute. The value should be a string or a native gradient.'), w;
};
}
function L() {
if (i.Konva.isUnminified)
return function(w, G) {
return a.Util._isFunction(w) || a.Util.warn(S(w) + ' is a not valid value for "' + G + '" attribute. The value should be a function.'), w;
};
}
function O() {
if (i.Konva.isUnminified)
return function(w, G) {
const W = Int8Array ? Object.getPrototypeOf(Int8Array) : null;
return W && w instanceof W || (a.Util._isArray(w) ? w.forEach(function(j) {
a.Util._isNumber(j) || a.Util.warn('"' + G + '" attribute has non numeric element ' + j + ". Make sure that all elements are numbers.");
}) : a.Util.warn(S(w) + ' is a not valid value for "' + G + '" attribute. The value should be a array of numbers.')), w;
};
}
function B() {
if (i.Konva.isUnminified)
return function(w, G) {
return w === !0 || w === !1 || a.Util.warn(S(w) + ' is a not valid value for "' + G + '" attribute. The value should be a boolean.'), w;
};
}
function H(w) {
if (i.Konva.isUnminified)
return function(G, W) {
return G == null || a.Util.isObject(G) || a.Util.warn(S(G) + ' is a not valid value for "' + W + '" attribute. The value should be an object with properties ' + w), G;
};
}
return ut;
}
var Se;
function ce() {
return Se || (Se = 1, (function(i) {
Object.defineProperty(i, "__esModule", { value: !0 }), i.Factory = void 0;
const a = Et(), S = Zt(), s = "get", c = "set";
i.Factory = {
addGetterSetter(g, p, _, C, y) {
i.Factory.addGetter(g, p, _), i.Factory.addSetter(g, p, C, y), i.Factory.addOverloadedGetterSetter(g, p);
},
addGetter(g, p, _) {
const C = s + a.Util._capitalize(p);
g.prototype[C] = g.prototype[C] || function() {
const y = this.attrs[p];
return y === void 0 ? _ : y;
};
},
addSetter(g, p, _, C) {
const y = c + a.Util._capitalize(p);
g.prototype[y] || i.Factory.overWriteSetter(g, p, _, C);
},
overWriteSetter(g, p, _, C) {
const y = c + a.Util._capitalize(p);
g.prototype[y] = function(L) {
return _ && L !== void 0 && L !== null && (L = _.call(this, L, p)), this._setAttr(p, L), C && C.call(this), this;
};
},
addComponentsGetterSetter(g, p, _, C, y) {
const L = _.length, O = a.Util._capitalize, B = s + O(p), H = c + O(p);
g.prototype[B] = function() {
const G = {};
for (let W = 0; W < L; W++) {
const j = _[W];
G[j] = this.getAttr(p + O(j));
}
return G;
};
const w = (0, S.getComponentValidator)(_);
g.prototype[H] = function(G) {
const W = this.attrs[p];
C && (G = C.call(this, G, p)), w && w.call(this, G, p);
for (const j in G)
G.hasOwnProperty(j) && this._setAttr(p + O(j), G[j]);
return G || _.forEach((j) => {
this._setAttr(p + O(j), void 0);
}), this._fireChangeEvent(p, W, G), y && y.call(this), this;
}, i.Factory.addOverloadedGetterSetter(g, p);
},
addOverloadedGetterSetter(g, p) {
const _ = a.Util._capitalize(p), C = c + _, y = s + _;
g.prototype[p] = function() {
return arguments.length ? (this[C](arguments[0]), this) : this[y]();
};
},
addDeprecatedGetterSetter(g, p, _, C) {
a.Util.error("Adding deprecated " + p);
const y = s + a.Util._capitalize(p), L = p + " property is deprecated and will be removed soon. Look at Konva change log for more information.";
g.prototype[y] = function() {
a.Util.error(L);
const O = this.attrs[p];
return O === void 0 ? _ : O;
}, i.Factory.addSetter(g, p, C, function() {
a.Util.error(L);
}), i.Factory.addOverloadedGetterSetter(g, p);
},
backCompat(g, p) {
a.Util.each(p, function(_, C) {
const y = g.prototype[C], L = s + a.Util._capitalize(_), O = c + a.Util._capitalize(_);
function B() {
y.apply(this, arguments), a.Util.error('"' + _ + '" method is deprecated and will be removed soon. Use ""' + C + '" instead.');
}
g.prototype[_] = B, g.prototype[L] = B, g.prototype[O] = B;
});
},
afterSetFilter() {
this._filterUpToDate = !1;
}
};
})(ie)), ie;
}
var ne = {}, Wt = {}, Lt = {}, Rt = {}, we;
function li() {
if (we) return Rt;
we = 1, Object.defineProperty(Rt, "__esModule", { value: !0 }), Rt.HitContext = Rt.SceneContext = Rt.Context = void 0;
const i = Et(), a = Ct();
function S(j) {
const o = [], t = j.length, r = i.Util;
for (let d = 0; d < t; d++) {
let b = j[d];
r._isNumber(b) ? b = Math.round(b * 1e3) / 1e3 : r._isString(b) || (b = b + ""), o.push(b);
}
return o;
}
const s = ",", c = "(", g = ")", p = "([", _ = "])", C = ";", y = "()", L = "=", O = [
"arc",
"arcTo",
"beginPath",
"bezierCurveTo",
"clearRect",
"clip",
"closePath",
"createLinearGradient",
"createPattern",
"createRadialGradient",
"drawImage",
"ellipse",
"fill",
"fillText",
"getImageData",
"createImageData",
"lineTo",
"moveTo",
"putImageData",
"quadraticCurveTo",
"rect",
"roundRect",
"restore",
"rotate",
"save",
"scale",
"setLineDash",
"setTransform",
"stroke",
"strokeText",
"transform",
"translate"
], B = [
"fillStyle",
"strokeStyle",
"shadowColor",
"shadowBlur",
"shadowOffsetX",
"shadowOffsetY",
"letterSpacing",
"lineCap",
"lineDashOffset",
"lineJoin",
"lineWidth",
"miterLimit",
"direction",
"font",
"textAlign",
"textBaseline",
"globalAlpha",
"globalCompositeOperation",
"imageSmoothingEnabled"
], H = 100;
let w = class {
constructor(o) {
this.canvas = o, a.Konva.enableTrace && (this.traceArr = [], this._enableTrace());
}
fillShape(o) {
o.fillEnabled() && this._fill(o);
}
_fill(o) {
}
strokeShape(o) {
o.hasStroke() && this._stroke(o);
}
_stroke(o) {
}
fillStrokeShape(o) {
o.attrs.fillAfterStrokeEnabled ? (this.strokeShape(o), this.fillShape(o)) : (this.fillShape(o), this.strokeShape(o));
}
getTrace(o, t) {
let r = this.traceArr, d = r.length, b = "", T, v, A, m;
for (T = 0; T < d; T++)
v = r[T], A = v.method, A ? (m = v.args, b += A, o ? b += y : i.Util._isArray(m[0]) ? b += p + m.join(s) + _ : (t && (m = m.map((R) => typeof R == "number" ? Math.floor(R) : R)), b += c + m.join(s) + g)) : (b += v.property, o || (b += L + v.val)), b += C;
return b;
}
clearTrace() {
this.traceArr = [];
}
_trace(o) {
let t = this.traceArr, r;
t.push(o), r = t.length, r >= H && t.shift();
}
reset() {
const o = this.getCanvas().getPixelRatio();
this.setTransform(1 * o, 0, 0, 1 * o, 0, 0);
}
getCanvas() {
return this.canvas;
}
clear(o) {
const t = this.getCanvas();
o ? this.clearRect(o.x || 0, o.y || 0, o.width || 0, o.height || 0) : this.clearRect(0, 0, t.getWidth() / t.pixelRatio, t.getHeight() / t.pixelRatio);
}
_applyLineCap(o) {
const t = o.attrs.lineCap;
t && this.setAttr("lineCap", t);
}
_applyOpacity(o) {
const t = o.getAbsoluteOpacity();
t !== 1 && this.setAttr("globalAlpha", t);
}
_applyLineJoin(o) {
const t = o.attrs.lineJoin;
t && this.setAttr("lineJoin", t);
}
setAttr(o, t) {
this._context[o] = t;
}
arc(o, t, r, d, b, T) {
this._context.arc(o, t, r, d, b, T);
}
arcTo(o, t, r, d, b) {
this._context.arcTo(o, t, r, d, b);
}
beginPath() {
this._context.beginPath();
}
bezierCurveTo(o, t, r, d, b, T) {
this._context.bezierCurveTo(o, t, r, d, b, T);
}
clearRect(o, t, r, d) {
this._context.clearRect(o, t, r, d);
}
clip(...o) {
this._context.clip.apply(this._context, o);
}
closePath() {
this._context.closePath();
}
createImageData(o, t) {
const r = arguments;
if (r.length === 2)
return this._context.createImageData(o, t);
if (r.length === 1)
return this._context.createImageData(o);
}
createLinearGradient(o, t, r, d) {
return this._context.createLinearGradient(o, t, r, d);
}
createPattern(o, t) {
return this._context.createPattern(o, t);
}
createRadialGradient(o, t, r, d, b, T) {
return this._context.createRadialGradient(o, t, r, d, b, T);
}
drawImage(o, t, r, d, b, T, v, A, m) {
const R = arguments, I = this._context;
R.length === 3 ? I.drawImage(o, t, r) : R.length === 5 ? I.drawImage(o, t, r, d, b) : R.length === 9 && I.drawImage(o, t, r, d, b, T, v, A, m);
}
ellipse(o, t, r, d, b, T, v, A) {
this._context.ellipse(o, t, r, d, b, T, v, A);
}
isPointInPath(o, t, r, d) {
return r ? this._context.isPointInPath(r, o, t, d) : this._context.isPointInPath(o, t, d);
}
fill(...o) {
this._context.fill.apply(this._context, o);
}
fillRect(o, t, r, d) {
this._context.fillRect(o, t, r, d);
}
strokeRect(o, t, r, d) {
this._context.strokeRect(o, t, r, d);
}
fillText(o, t, r, d) {
d ? this._context.fillText(o, t, r, d) : this._context.fillText(o, t, r);
}
measureText(o) {
return this._context.measureText(o);
}
getImageData(o, t, r, d) {
return this._context.getImageData(o, t, r, d);
}
lineTo(o, t) {
this._context.lineTo(o, t);
}
moveTo(o, t) {
this._context.moveTo(o, t);
}
rect(o, t, r, d) {
this._context.rect(o, t, r, d);
}
roundRect(o, t, r, d, b) {
this._context.roundRect(o, t, r, d, b);
}
putImageData(o, t, r) {
this._context.putImageData(o, t, r);
}
quadraticCurveTo(o, t, r, d) {
this._context.quadraticCurveTo(o, t, r, d);
}
restore() {
this._context.restore();
}
rotate(o) {
this._context.rotate(o);
}
save() {
this._context.save();
}
scale(o, t) {
this._context.scale(o, t);
}
setLineDash(o) {
this._context.setLineDash ? this._context.setLineDash(o) : "mozDash" in this._context ? this._context.mozDash = o : "webkitLineDash" in this._context && (this._context.webkitLineDash = o);
}
getLineDash() {
return this._context.getLineDash();
}
setTransform(o, t, r, d, b, T) {
this._context.setTransform(o, t, r, d, b, T);
}
stroke(o) {
o ? this._context.stroke(o) : this._context.stroke();
}
strokeText(o, t, r, d) {
this._context.strokeText(o, t, r, d);
}
transform(o, t, r, d, b, T) {
this._context.transform(o, t, r, d, b, T);
}
translate(o, t) {
this._context.translate(o, t);
}
_enableTrace() {
let o = this, t = O.length, r = this.setAttr, d, b;
const T = function(v) {
let A = o[v], m;
o[v] = function() {
return b = S(Array.prototype.slice.call(arguments, 0)), m = A.apply(o, arguments), o._trace({
method: v,
args: b
}), m;
};
};
for (d = 0; d < t; d++)
T(O[d]);
o.setAttr = function() {
r.apply(o, arguments);
const v = arguments[0];
let A = arguments[1];
(v === "shadowOffsetX" || v === "shadowOffsetY" || v === "shadowBlur") && (A = A / this.canvas.getPixelRatio()), o._trace({
property: v,
val: A
});
};
}
_applyGlobalCompositeOperation(o) {
const t = o.attrs.globalCompositeOperation;
!t || t === "source-over" || this.setAttr("globalCompositeOperation", t);
}
};
Rt.Context = w, B.forEach(function(j) {
Object.defineProperty(w.prototype, j, {
get() {
return this._context[j];
},
set(o) {
this._context[j] = o;
}
});
});
class G extends w {
constructor(o, { willReadFrequently: t = !1 } = {}) {
super(o), this._context = o._canvas.getContext("2d", {
willReadFrequently: t
});
}
_fillColor(o) {
const t = o.fill();
this.setAttr("fillStyle", t), o._fillFunc(this);
}
_fillPattern(o) {
this.setAttr("fillStyle", o._getFillPattern()), o._fillFunc(this);
}
_fillLinearGradient(o) {
const t = o._getLinearGradient();
t && (this.setAttr("fillStyle", t), o._fillFunc(this));
}
_fillRadialGradient(o) {
const t = o._getRadialGradient();
t && (this.setAttr("fillStyle", t), o._fillFunc(this));
}
_fill(o) {
const t = o.fill(), r = o.getFillPriority();
if (t && r === "color") {
this._fillColor(o);
return;
}
const d = o.getFillPatternImage();
if (d && r === "pattern") {
this._fillPattern(o);
return;
}
const b = o.getFillLinearGradientColorStops();
if (b && r === "linear-gradient") {
this._fillLinearGradient(o);
return;
}
const T = o.getFillRadialGradientColorStops();
if (T && r === "radial-gradient") {
this._fillRadialGradient(o);
return;
}
t ? this._fillColor(o) : d ? this._fillPattern(o) : b ? this._fillLinearGradient(o) : T && this._fillRadialGradient(o);
}
_strokeLinearGradient(o) {
const t = o.getStrokeLinearGradientStartPoint(), r = o.getStrokeLinearGradientEndPoint(), d = o.getStrokeLinearGradientColorStops(), b = this.createLinearGradient(t.x, t.y, r.x, r.y);
if (d) {
for (let T = 0; T < d.length; T += 2)
b.addColorStop(d[T], d[T + 1]);
this.setAttr("strokeStyle", b);
}
}
_stroke(o) {
const t = o.dash(), r = o.getStrokeScaleEnabled();
if (o.hasStroke()) {
if (!r) {
this.save();
const b = this.getCanvas().getPixelRatio();
this.setTransform(b, 0, 0, b, 0, 0);
}
this._applyLineCap(o), t && o.dashEnabled() && (this.setLineDash(t), this.setAttr("lineDashOffset", o.dashOffset())), this.setAttr("lineWidth", o.strokeWidth()), o.getShadowForStrokeEnabled() || this.setAttr("shadowColor", "rgba(0,0,0,0)"), o.getStrokeLinearGradientColorStops() ? this._strokeLinearGradient(o) : this.setAttr("strokeStyle", o.stroke()), o._strokeFunc(this), r || this.restore();
}
}
_applyShadow(o) {
var t, r, d;
const b = (t = o.getShadowRGBA()) !== null && t !== void 0 ? t : "black", T = (r = o.getShadowBlur()) !== null && r !== void 0 ? r : 5, v = (d = o.getShadowOffset()) !== null && d !== void 0 ? d : {
x: 0,
y: 0
}, A = o.getAbsoluteScale(), m = this.canvas.getPixelRatio(), R = A.x * m, I = A.y * m;
this.setAttr("shadowColor", b), this.setAttr("shadowBlur", T * Math.min(Math.abs(R), Math.abs(I))), this.setAttr("shadowOffsetX", v.x * R), this.setAttr("shadowOffsetY", v.y * I);
}
}
Rt.SceneContext = G;
class W extends w {
constructor(o) {
super(o), this._context = o._canvas.getContext("2d", {
willReadFrequently: !0
});
}
_fill(o) {
this.save(), this.setAttr("fillStyle", o.colorKey), o._fillFuncHit(this), this.restore();
}
strokeShape(o) {
o.hasHitStroke() && this._stroke(o);
}
_stroke(o) {
if (o.hasHitStroke()) {
const t = o.getStrokeScaleEnabled();
if (!t) {
this.save();
const b = this.getCanvas().getPixelRatio();
this.setTransform(b, 0, 0, b, 0, 0);
}
this._applyLineCap(o);
const r = o.hitStrokeWidth(), d = r === "auto" ? o.strokeWidth() : r;
this.setAttr("lineWidth", d), this.setAttr("strokeStyle", o.colorKey), o._strokeFuncHit(this), t || this.restore();
}
}
}
return Rt.HitContext = W, Rt;
}
var xe;
function ci() {
if (xe) return Lt;
xe = 1, Object.defineProperty(Lt, "__esModule", { value: !0 }), Lt.HitCanvas = Lt.SceneCanvas = Lt.Canvas = void 0;
const i = Et(), a = li(), S = Ct();
let s;
function c() {
if (s)
return s;
const C = i.Util.createCanvasElement(), y = C.getContext("2d");
return s = (function() {
const L = S.Konva._global.devicePixelRatio || 1, O = y.webkitBackingStorePixelRatio || y.mozBackingStorePixelRatio || y.msBackingStorePixelRatio || y.oBackingStorePixelRatio || y.backingStorePixelRatio || 1;
return L / O;
})(), i.Util.releaseCanvas(C), s;
}
let g = class {
constructor(y) {
this.pixelRatio = 1, this.width = 0, this.height = 0, this.isCache = !1;
const O = (y || {}).pixelRatio || S.Konva.pixelRatio || c();
this.pixelRatio = O, this._canvas = i.Util.createCanvasElement(), this._canvas.style.padding = "0", this._canvas.style.margin = "0", this._canvas.style.border = "0", this._canvas.style.background = "transparent", this._canvas.style.position = "absolute", this._canvas.style.top = "0", this._canvas.style.left = "0";
}
getContext() {
return this.context;
}
getPixelRatio() {
return this.pixelRatio;
}
setPixelRatio(y) {
const L = this.pixelRatio;
this.pixelRatio = y, this.setSize(this.getWidth() / L, this.getHeight() / L);
}
setWidth(y) {
this.width = this._canvas.width = y * this.pixelRatio, this._canvas.style.width = y + "px";
const L = this.pixelRatio;
this.getContext()._context.scale(L, L);
}
setHeight(y) {
this.height = this._canvas.height = y * this.pixelRatio, this._canvas.style.height = y + "px";
const L = this.pixelRatio;
this.getContext()._context.scale(L, L);
}
getWidth() {
return this.width;
}
getHeight() {
return this.height;
}
setSize(y, L) {
this.setWidth(y || 0), this.setHeight(L || 0);
}
toDataURL(y, L) {
try {
return this._canvas.toDataURL(y, L);
} catch {
try {
return this._canvas.toDataURL();
} catch (B) {
return i.Util.error("Unable to get data URL. " + B.message + " For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."), "";
}
}
}
};
Lt.Canvas = g;
class p extends g {
constructor(y = { width: 0, height: 0, willReadFrequently: !1 }) {
super(y), this.context = new a.SceneContext(this, {
willReadFrequently: y.willReadFrequently
}), this.setSize(y.width, y.height);
}
}
Lt.SceneCanvas = p;
class _ extends g {
constructor(y = { width: 0, height: 0 }) {
super(y), this.hitCanvas = !0, this.context = new a.HitContext(this),