ranui
Version:
A framework-agnostic Web Components UI library built on native custom elements, with TypeScript types, light/dark theming, SSR and PWA support.
1,051 lines (1,046 loc) • 31.5 kB
JavaScript
import { n as r } from "./chunk-Y2CYZVJY-0JxdZxki.js";
import { m as $ } from "./src-DtRLxcYO.js";
import { J as ye, et as le, f as K, rt as me, tt as he, x as H, z as G } from "./chunk-WYO6CB5R-DDHkKowO.js";
import "./chunk-ICXQ74PX-DR8rL-xF.js";
import { t as be } from "./chunk-VAUOI2AC-izt0o4id.js";
import "./chunk-HOUHSVGY-DRQcQeMT.js";
import "./chunk-Q4XR5HBZ-3BHjjc9u.js";
import { t as ke } from "./chunk-5VM5RSS4-Cni2Ogq2.js";
import "./chunk-OGEWGWER-BV51ll2w.js";
import "./chunk-C7G6YPKG-CA-DNpvI.js";
import { a as Ee, c as _e, i as Se } from "./chunk-ZGVPDNZ5-6uMbTJXy.js";
import { n as Ne, t as xe } from "./chunk-ZIRB5QZD-C7OH2FI2.js";
var ee = (function() {
var e = /* @__PURE__ */ r(function(i, t, o, c) {
for (o = o || {}, c = i.length; c--; o[i[c]] = t) ;
return o;
}, "o"), g = [1, 4], p = [1, 13], s = [1, 12], d = [1, 15], b = [1, 16], _ = [1, 20], h = [1, 19], L = [
6,
7,
8
], O = [1, 26], u = [1, 24], T = [1, 25], S = [
6,
7,
11
], R = [1, 31], v = [
6,
7,
11,
24
], f = [
1,
6,
13,
16,
17,
20,
23
], C = [1, 35], w = [1, 36], A = [
1,
6,
7,
11,
13,
16,
17,
20,
23
], B = [1, 38], M = {
trace: /* @__PURE__ */ r(function() {
}, "trace"),
yy: {},
symbols_: {
error: 2,
start: 3,
mindMap: 4,
spaceLines: 5,
SPACELINE: 6,
NL: 7,
KANBAN: 8,
document: 9,
stop: 10,
EOF: 11,
statement: 12,
SPACELIST: 13,
node: 14,
shapeData: 15,
ICON: 16,
CLASS: 17,
nodeWithId: 18,
nodeWithoutId: 19,
NODE_DSTART: 20,
NODE_DESCR: 21,
NODE_DEND: 22,
NODE_ID: 23,
SHAPE_DATA: 24,
$accept: 0,
$end: 1
},
terminals_: {
2: "error",
6: "SPACELINE",
7: "NL",
8: "KANBAN",
11: "EOF",
13: "SPACELIST",
16: "ICON",
17: "CLASS",
20: "NODE_DSTART",
21: "NODE_DESCR",
22: "NODE_DEND",
23: "NODE_ID",
24: "SHAPE_DATA"
},
productions_: [
0,
[3, 1],
[3, 2],
[5, 1],
[5, 2],
[5, 2],
[4, 2],
[4, 3],
[10, 1],
[10, 1],
[10, 1],
[10, 2],
[10, 2],
[9, 3],
[9, 2],
[12, 3],
[12, 2],
[12, 2],
[12, 2],
[12, 1],
[12, 2],
[12, 1],
[12, 1],
[12, 1],
[12, 1],
[14, 1],
[14, 1],
[19, 3],
[18, 1],
[18, 4],
[15, 2],
[15, 1]
],
performAction: /* @__PURE__ */ r(function(t, o, c, l, y, n, U) {
var a = n.length - 1;
switch (y) {
case 6:
case 7:
return l;
case 8:
l.getLogger().trace("Stop NL ");
break;
case 9:
l.getLogger().trace("Stop EOF ");
break;
case 11:
l.getLogger().trace("Stop NL2 ");
break;
case 12:
l.getLogger().trace("Stop EOF2 ");
break;
case 15:
l.getLogger().info("Node: ", n[a - 1].id), l.addNode(n[a - 2].length, n[a - 1].id, n[a - 1].descr, n[a - 1].type, n[a]);
break;
case 16:
l.getLogger().info("Node: ", n[a].id), l.addNode(n[a - 1].length, n[a].id, n[a].descr, n[a].type);
break;
case 17:
l.getLogger().trace("Icon: ", n[a]), l.decorateNode({ icon: n[a] });
break;
case 18:
case 23:
l.decorateNode({ class: n[a] });
break;
case 19:
l.getLogger().trace("SPACELIST");
break;
case 20:
l.getLogger().trace("Node: ", n[a - 1].id), l.addNode(0, n[a - 1].id, n[a - 1].descr, n[a - 1].type, n[a]);
break;
case 21:
l.getLogger().trace("Node: ", n[a].id), l.addNode(0, n[a].id, n[a].descr, n[a].type);
break;
case 22:
l.decorateNode({ icon: n[a] });
break;
case 27:
l.getLogger().trace("node found ..", n[a - 2]), this.$ = {
id: n[a - 1],
descr: n[a - 1],
type: l.getType(n[a - 2], n[a])
};
break;
case 28:
this.$ = {
id: n[a],
descr: n[a],
type: 0
};
break;
case 29:
l.getLogger().trace("node found ..", n[a - 3]), this.$ = {
id: n[a - 3],
descr: n[a - 1],
type: l.getType(n[a - 2], n[a])
};
break;
case 30:
this.$ = n[a - 1] + n[a];
break;
case 31:
this.$ = n[a];
break;
}
}, "anonymous"),
table: [
{
3: 1,
4: 2,
5: 3,
6: [1, 5],
8: g
},
{ 1: [3] },
{ 1: [2, 1] },
{
4: 6,
6: [1, 7],
7: [1, 8],
8: g
},
{
6: p,
7: [1, 10],
9: 9,
12: 11,
13: s,
14: 14,
16: d,
17: b,
18: 17,
19: 18,
20: _,
23: h
},
e(L, [2, 3]),
{ 1: [2, 2] },
e(L, [2, 4]),
e(L, [2, 5]),
{
1: [2, 6],
6: p,
12: 21,
13: s,
14: 14,
16: d,
17: b,
18: 17,
19: 18,
20: _,
23: h
},
{
6: p,
9: 22,
12: 11,
13: s,
14: 14,
16: d,
17: b,
18: 17,
19: 18,
20: _,
23: h
},
{
6: O,
7: u,
10: 23,
11: T
},
e(S, [2, 24], {
18: 17,
19: 18,
14: 27,
16: [1, 28],
17: [1, 29],
20: _,
23: h
}),
e(S, [2, 19]),
e(S, [2, 21], {
15: 30,
24: R
}),
e(S, [2, 22]),
e(S, [2, 23]),
e(v, [2, 25]),
e(v, [2, 26]),
e(v, [2, 28], { 20: [1, 32] }),
{ 21: [1, 33] },
{
6: O,
7: u,
10: 34,
11: T
},
{
1: [2, 7],
6: p,
12: 21,
13: s,
14: 14,
16: d,
17: b,
18: 17,
19: 18,
20: _,
23: h
},
e(f, [2, 14], {
7: C,
11: w
}),
e(A, [2, 8]),
e(A, [2, 9]),
e(A, [2, 10]),
e(S, [2, 16], {
15: 37,
24: R
}),
e(S, [2, 17]),
e(S, [2, 18]),
e(S, [2, 20], { 24: B }),
e(v, [2, 31]),
{ 21: [1, 39] },
{ 22: [1, 40] },
e(f, [2, 13], {
7: C,
11: w
}),
e(A, [2, 11]),
e(A, [2, 12]),
e(S, [2, 15], { 24: B }),
e(v, [2, 30]),
{ 22: [1, 41] },
e(v, [2, 27]),
e(v, [2, 29])
],
defaultActions: {
2: [2, 1],
6: [2, 2]
},
parseError: /* @__PURE__ */ r(function(t, o) {
if (o.recoverable) this.trace(t);
else {
var c = new Error(t);
throw c.hash = o, c;
}
}, "parseError"),
parse: /* @__PURE__ */ r(function(t) {
var o = this, c = [0], l = [], y = [null], n = [], U = this.table, a = "", W = 0, se = 0, re = 0, ge = 2, ae = 1, de = n.slice.call(arguments, 1), k = Object.create(this.lexer), P = { yy: {} };
for (var Y in this.yy) Object.prototype.hasOwnProperty.call(this.yy, Y) && (P.yy[Y] = this.yy[Y]);
k.setInput(t, P.yy), P.yy.lexer = k, P.yy.parser = this, typeof k.yylloc > "u" && (k.yylloc = {});
var J = k.yylloc;
n.push(J);
var pe = k.options && k.options.ranges;
typeof P.yy.parseError == "function" ? this.parseError = P.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
function fe(x) {
c.length = c.length - 2 * x, y.length = y.length - x, n.length = n.length - x;
}
r(fe, "popStack");
function oe() {
var x = l.pop() || k.lex() || ae;
return typeof x != "number" && (x instanceof Array && (l = x, x = l.pop()), x = o.symbols_[x] || x), x;
}
r(oe, "lex");
for (var E, q, V, N, Q, F = {}, z, I, ce, X; ; ) {
if (V = c[c.length - 1], this.defaultActions[V] ? N = this.defaultActions[V] : ((E === null || typeof E > "u") && (E = oe()), N = U[V] && U[V][E]), typeof N > "u" || !N.length || !N[0]) {
var Z = "";
X = [];
for (z in U[V]) this.terminals_[z] && z > ge && X.push("'" + this.terminals_[z] + "'");
k.showPosition ? Z = "Parse error on line " + (W + 1) + `:
` + k.showPosition() + `
Expecting ` + X.join(", ") + ", got '" + (this.terminals_[E] || E) + "'" : Z = "Parse error on line " + (W + 1) + ": Unexpected " + (E == ae ? "end of input" : "'" + (this.terminals_[E] || E) + "'"), this.parseError(Z, {
text: k.match,
token: this.terminals_[E] || E,
line: k.yylineno,
loc: J,
expected: X
});
}
if (N[0] instanceof Array && N.length > 1) throw new Error("Parse Error: multiple actions possible at state: " + V + ", token: " + E);
switch (N[0]) {
case 1:
c.push(E), y.push(k.yytext), n.push(k.yylloc), c.push(N[1]), E = null, q ? (E = q, q = null) : (se = k.yyleng, a = k.yytext, W = k.yylineno, J = k.yylloc, re > 0 && re--);
break;
case 2:
if (I = this.productions_[N[1]][1], F.$ = y[y.length - I], F._$ = {
first_line: n[n.length - (I || 1)].first_line,
last_line: n[n.length - 1].last_line,
first_column: n[n.length - (I || 1)].first_column,
last_column: n[n.length - 1].last_column
}, pe && (F._$.range = [n[n.length - (I || 1)].range[0], n[n.length - 1].range[1]]), Q = this.performAction.apply(F, [
a,
se,
W,
P.yy,
N[1],
y,
n
].concat(de)), typeof Q < "u") return Q;
I && (c = c.slice(0, -1 * I * 2), y = y.slice(0, -1 * I), n = n.slice(0, -1 * I)), c.push(this.productions_[N[1]][0]), y.push(F.$), n.push(F._$), ce = U[c[c.length - 2]][c[c.length - 1]], c.push(ce);
break;
case 3:
return !0;
}
}
return !0;
}, "parse")
};
M.lexer = /* @__PURE__ */ (function() {
return {
EOF: 1,
parseError: /* @__PURE__ */ r(function(t, o) {
if (this.yy.parser) this.yy.parser.parseError(t, o);
else throw new Error(t);
}, "parseError"),
setInput: /* @__PURE__ */ r(function(i, t) {
return this.yy = t || this.yy || {}, this._input = i, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
first_line: 1,
first_column: 0,
last_line: 1,
last_column: 0
}, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
}, "setInput"),
input: /* @__PURE__ */ r(function() {
var i = this._input[0];
return this.yytext += i, this.yyleng++, this.offset++, this.match += i, this.matched += i, i.match(/(?:\r\n?|\n).*/g) ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), i;
}, "input"),
unput: /* @__PURE__ */ r(function(i) {
var t = i.length, o = i.split(/(?:\r\n?|\n)/g);
this._input = i + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - t), this.offset -= t;
var c = this.match.split(/(?:\r\n?|\n)/g);
this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), o.length - 1 && (this.yylineno -= o.length - 1);
var l = this.yylloc.range;
return this.yylloc = {
first_line: this.yylloc.first_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.first_column,
last_column: o ? (o.length === c.length ? this.yylloc.first_column : 0) + c[c.length - o.length].length - o[0].length : this.yylloc.first_column - t
}, this.options.ranges && (this.yylloc.range = [l[0], l[0] + this.yyleng - t]), this.yyleng = this.yytext.length, this;
}, "unput"),
more: /* @__PURE__ */ r(function() {
return this._more = !0, this;
}, "more"),
reject: /* @__PURE__ */ r(function() {
if (this.options.backtrack_lexer) this._backtrack = !0;
else return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
` + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
return this;
}, "reject"),
less: /* @__PURE__ */ r(function(i) {
this.unput(this.match.slice(i));
}, "less"),
pastInput: /* @__PURE__ */ r(function() {
var i = this.matched.substr(0, this.matched.length - this.match.length);
return (i.length > 20 ? "..." : "") + i.substr(-20).replace(/\n/g, "");
}, "pastInput"),
upcomingInput: /* @__PURE__ */ r(function() {
var i = this.match;
return i.length < 20 && (i += this._input.substr(0, 20 - i.length)), (i.substr(0, 20) + (i.length > 20 ? "..." : "")).replace(/\n/g, "");
}, "upcomingInput"),
showPosition: /* @__PURE__ */ r(function() {
var i = this.pastInput(), t = new Array(i.length + 1).join("-");
return i + this.upcomingInput() + `
` + t + "^";
}, "showPosition"),
test_match: /* @__PURE__ */ r(function(i, t) {
var o, c, l;
if (this.options.backtrack_lexer && (l = {
yylineno: this.yylineno,
yylloc: {
first_line: this.yylloc.first_line,
last_line: this.last_line,
first_column: this.yylloc.first_column,
last_column: this.yylloc.last_column
},
yytext: this.yytext,
match: this.match,
matches: this.matches,
matched: this.matched,
yyleng: this.yyleng,
offset: this.offset,
_more: this._more,
_input: this._input,
yy: this.yy,
conditionStack: this.conditionStack.slice(0),
done: this.done
}, this.options.ranges && (l.yylloc.range = this.yylloc.range.slice(0))), c = i[0].match(/(?:\r\n?|\n).*/g), c && (this.yylineno += c.length), this.yylloc = {
first_line: this.yylloc.last_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.last_column,
last_column: c ? c[c.length - 1].length - c[c.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + i[0].length
}, this.yytext += i[0], this.match += i[0], this.matches = i, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(i[0].length), this.matched += i[0], o = this.performAction.call(this, this.yy, this, t, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), o) return o;
if (this._backtrack) {
for (var y in l) this[y] = l[y];
return !1;
}
return !1;
}, "test_match"),
next: /* @__PURE__ */ r(function() {
if (this.done) return this.EOF;
this._input || (this.done = !0);
var i, t, o, c;
this._more || (this.yytext = "", this.match = "");
for (var l = this._currentRules(), y = 0; y < l.length; y++)
if (o = this._input.match(this.rules[l[y]]), o && (!t || o[0].length > t[0].length)) {
if (t = o, c = y, this.options.backtrack_lexer) {
if (i = this.test_match(o, l[y]), i !== !1) return i;
if (this._backtrack) {
t = !1;
continue;
} else return !1;
} else if (!this.options.flex) break;
}
return t ? (i = this.test_match(t, l[c]), i !== !1 ? i : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
}, "next"),
lex: /* @__PURE__ */ r(function() {
var t = this.next();
return t || this.lex();
}, "lex"),
begin: /* @__PURE__ */ r(function(t) {
this.conditionStack.push(t);
}, "begin"),
popState: /* @__PURE__ */ r(function() {
return this.conditionStack.length - 1 > 0 ? this.conditionStack.pop() : this.conditionStack[0];
}, "popState"),
_currentRules: /* @__PURE__ */ r(function() {
return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
}, "_currentRules"),
topState: /* @__PURE__ */ r(function(t) {
return t = this.conditionStack.length - 1 - Math.abs(t || 0), t >= 0 ? this.conditionStack[t] : "INITIAL";
}, "topState"),
pushState: /* @__PURE__ */ r(function(t) {
this.begin(t);
}, "pushState"),
stateStackSize: /* @__PURE__ */ r(function() {
return this.conditionStack.length;
}, "stateStackSize"),
options: { "case-insensitive": !0 },
performAction: /* @__PURE__ */ r(function(t, o, c, l) {
switch (c) {
case 0:
return this.pushState("shapeData"), o.yytext = "", 24;
case 1:
return this.pushState("shapeDataStr"), 24;
case 2:
return this.popState(), 24;
case 3:
return o.yytext = o.yytext.replace(/\n\s*/g, "<br/>"), 24;
case 4:
return 24;
case 5:
this.popState();
break;
case 6:
return t.getLogger().trace("Found comment", o.yytext), 6;
case 7:
return 8;
case 8:
this.begin("CLASS");
break;
case 9:
return this.popState(), 17;
case 10:
this.popState();
break;
case 11:
t.getLogger().trace("Begin icon"), this.begin("ICON");
break;
case 12:
return t.getLogger().trace("SPACELINE"), 6;
case 13:
return 7;
case 14:
return 16;
case 15:
t.getLogger().trace("end icon"), this.popState();
break;
case 16:
return t.getLogger().trace("Exploding node"), this.begin("NODE"), 20;
case 17:
return t.getLogger().trace("Cloud"), this.begin("NODE"), 20;
case 18:
return t.getLogger().trace("Explosion Bang"), this.begin("NODE"), 20;
case 19:
return t.getLogger().trace("Cloud Bang"), this.begin("NODE"), 20;
case 20:
return this.begin("NODE"), 20;
case 21:
return this.begin("NODE"), 20;
case 22:
return this.begin("NODE"), 20;
case 23:
return this.begin("NODE"), 20;
case 24:
return 13;
case 25:
return 23;
case 26:
return 11;
case 27:
this.begin("NSTR2");
break;
case 28:
return "NODE_DESCR";
case 29:
this.popState();
break;
case 30:
t.getLogger().trace("Starting NSTR"), this.begin("NSTR");
break;
case 31:
return t.getLogger().trace("description:", o.yytext), "NODE_DESCR";
case 32:
this.popState();
break;
case 33:
return this.popState(), t.getLogger().trace("node end ))"), "NODE_DEND";
case 34:
return this.popState(), t.getLogger().trace("node end )"), "NODE_DEND";
case 35:
return this.popState(), t.getLogger().trace("node end ...", o.yytext), "NODE_DEND";
case 36:
return this.popState(), t.getLogger().trace("node end (("), "NODE_DEND";
case 37:
return this.popState(), t.getLogger().trace("node end (-"), "NODE_DEND";
case 38:
return this.popState(), t.getLogger().trace("node end (-"), "NODE_DEND";
case 39:
return this.popState(), t.getLogger().trace("node end (("), "NODE_DEND";
case 40:
return this.popState(), t.getLogger().trace("node end (("), "NODE_DEND";
case 41:
return t.getLogger().trace("Long description:", o.yytext), 21;
case 42:
return t.getLogger().trace("Long description:", o.yytext), 21;
}
}, "anonymous"),
rules: [
/^(?:@\{)/i,
/^(?:["])/i,
/^(?:["])/i,
/^(?:[^\"]+)/i,
/^(?:[^}^"]+)/i,
/^(?:\})/i,
/^(?:\s*%%.*)/i,
/^(?:kanban\b)/i,
/^(?::::)/i,
/^(?:.+)/i,
/^(?:\n)/i,
/^(?:::icon\()/i,
/^(?:[\s]+[\n])/i,
/^(?:[\n]+)/i,
/^(?:[^\)]+)/i,
/^(?:\))/i,
/^(?:-\))/i,
/^(?:\(-)/i,
/^(?:\)\))/i,
/^(?:\))/i,
/^(?:\(\()/i,
/^(?:\{\{)/i,
/^(?:\()/i,
/^(?:\[)/i,
/^(?:[\s]+)/i,
/^(?:[^\(\[\n\)\{\}@]+)/i,
/^(?:$)/i,
/^(?:["][`])/i,
/^(?:[^`"]+)/i,
/^(?:[`]["])/i,
/^(?:["])/i,
/^(?:[^"]+)/i,
/^(?:["])/i,
/^(?:[\)]\))/i,
/^(?:[\)])/i,
/^(?:[\]])/i,
/^(?:\}\})/i,
/^(?:\(-)/i,
/^(?:-\))/i,
/^(?:\(\()/i,
/^(?:\()/i,
/^(?:[^\)\]\(\}]+)/i,
/^(?:.+(?!\(\())/i
],
conditions: {
shapeDataEndBracket: {
rules: [],
inclusive: !1
},
shapeDataStr: {
rules: [2, 3],
inclusive: !1
},
shapeData: {
rules: [
1,
4,
5
],
inclusive: !1
},
CLASS: {
rules: [9, 10],
inclusive: !1
},
ICON: {
rules: [14, 15],
inclusive: !1
},
NSTR2: {
rules: [28, 29],
inclusive: !1
},
NSTR: {
rules: [31, 32],
inclusive: !1
},
NODE: {
rules: [
27,
30,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42
],
inclusive: !1
},
INITIAL: {
rules: [
0,
6,
7,
8,
11,
12,
13,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
],
inclusive: !0
}
}
};
})();
function j() {
this.yy = {};
}
return r(j, "Parser"), j.prototype = M, M.Parser = j, new j();
})();
ee.parser = ee;
var De = ee, D = [], ie = [], te = 0, ne = {}, Le = /* @__PURE__ */ r(() => {
D = [], ie = [], te = 0, ne = {};
}, "clear"), ve = /* @__PURE__ */ r((e) => {
if (D.length === 0) return null;
const g = D[0].level;
let p = null;
for (let s = D.length - 1; s >= 0; s--)
if (D[s].level === g && !p && (p = D[s]), D[s].level < g) throw new Error('Items without section detected, found section ("' + D[s].label + '")');
return e === p?.level ? null : p;
}, "getSection"), ue = /* @__PURE__ */ r(function() {
return ie;
}, "getSections"), Oe = /* @__PURE__ */ r(function() {
const e = [], g = [], p = ue(), s = H();
for (const d of p) {
const b = {
id: d.id,
label: G(d.label ?? "", s),
labelType: "markdown",
isGroup: !0,
ticket: d.ticket,
shape: "kanbanSection",
level: d.level,
look: s.look
};
g.push(b);
const _ = D.filter((h) => h.parentId === d.id);
for (const h of _) {
const L = {
id: h.id,
parentId: d.id,
label: G(h.label ?? "", s),
labelType: "markdown",
isGroup: !1,
ticket: h?.ticket,
priority: h?.priority,
assigned: h?.assigned,
icon: h?.icon,
shape: "kanbanItem",
level: h.level,
rx: 5,
ry: 5,
cssStyles: ["text-align: left"]
};
g.push(L);
}
}
return {
nodes: g,
edges: e,
other: {},
config: H()
};
}, "getData"), Ie = /* @__PURE__ */ r((e, g, p, s, d) => {
const b = H();
let _ = b.mindmap?.padding ?? K.mindmap.padding;
switch (s) {
case m.ROUNDED_RECT:
case m.RECT:
case m.HEXAGON:
_ *= 2;
}
const h = {
id: G(g, b) || "kbn" + te++,
level: e,
label: G(p, b),
width: b.mindmap?.maxNodeWidth ?? K.mindmap.maxNodeWidth,
padding: _,
isGroup: !1
};
if (d !== void 0) {
let O;
d.includes(`
`) ? O = d + `
` : O = `{
` + d + `
}`;
const u = Ne(O, { schema: xe });
if (u.shape && (u.shape !== u.shape.toLowerCase() || u.shape.includes("_"))) throw new Error(`No such shape: ${u.shape}. Shape names should be lowercase.`);
u?.shape && u.shape === "kanbanItem" && (h.shape = u?.shape), u?.label && (h.label = u?.label), u?.icon && (h.icon = u?.icon.toString()), u?.assigned && (h.assigned = u?.assigned.toString()), u?.ticket && (h.ticket = u?.ticket.toString()), u?.priority && (h.priority = u?.priority);
}
const L = ve(e);
L ? h.parentId = L.id || "kbn" + te++ : ie.push(h), D.push(h);
}, "addNode"), m = {
DEFAULT: 0,
NO_BORDER: 0,
ROUNDED_RECT: 1,
RECT: 2,
CIRCLE: 3,
CLOUD: 4,
BANG: 5,
HEXAGON: 6
}, Ce = {
clear: Le,
addNode: Ie,
getSections: ue,
getData: Oe,
nodeType: m,
getType: /* @__PURE__ */ r((e, g) => {
switch ($.debug("In get type", e, g), e) {
case "[":
return m.RECT;
case "(":
return g === ")" ? m.ROUNDED_RECT : m.CLOUD;
case "((":
return m.CIRCLE;
case ")":
return m.CLOUD;
case "))":
return m.BANG;
case "{{":
return m.HEXAGON;
default:
return m.DEFAULT;
}
}, "getType"),
setElementForId: /* @__PURE__ */ r((e, g) => {
ne[e] = g;
}, "setElementForId"),
decorateNode: /* @__PURE__ */ r((e) => {
if (!e) return;
const g = H(), p = D[D.length - 1];
e.icon && (p.icon = G(e.icon, g)), e.class && (p.cssClasses = G(e.class, g));
}, "decorateNode"),
type2Str: /* @__PURE__ */ r((e) => {
switch (e) {
case m.DEFAULT:
return "no-border";
case m.RECT:
return "rect";
case m.ROUNDED_RECT:
return "rounded-rect";
case m.CIRCLE:
return "circle";
case m.CLOUD:
return "cloud";
case m.BANG:
return "bang";
case m.HEXAGON:
return "hexgon";
default:
return "no-border";
}
}, "type2Str"),
getLogger: /* @__PURE__ */ r(() => $, "getLogger"),
getElementById: /* @__PURE__ */ r((e) => ne[e], "getElementById")
}, we = { draw: /* @__PURE__ */ r(async (e, g, p, s) => {
$.debug(`Rendering kanban diagram
` + e);
const d = s.db.getData(), b = H();
b.htmlLabels = !1;
const _ = be(g);
for (const f of d.nodes) f.domId = `${g}-${f.id}`;
const h = _.append("g");
h.attr("class", "sections");
const L = _.append("g");
L.attr("class", "items");
const O = d.nodes.filter((f) => f.isGroup);
let u = 0;
const T = 10, S = [];
let R = 25;
for (const f of O) {
const C = b?.kanban?.sectionWidth || 200;
u = u + 1, f.x = C * u + (u - 1) * T / 2, f.width = C, f.y = 0, f.height = C * 3, f.rx = 5, f.ry = 5, f.cssClasses = f.cssClasses + " section-" + u;
const w = await Se(h, f);
R = Math.max(R, w?.labelBBox?.height), S.push(w);
}
let v = 0;
for (const f of O) {
const C = S[v];
v = v + 1;
const w = b?.kanban?.sectionWidth || 200, A = -w * 3 / 2 + R;
let B = A;
const M = d.nodes.filter((t) => t.parentId === f.id);
for (const t of M) {
if (t.isGroup) throw new Error("Groups within groups are not allowed in Kanban diagrams");
t.x = f.x, t.width = w - 1.5 * T;
const o = (await Ee(L, t, { config: b })).node().getBBox();
t.y = B + o.height / 2, await _e(t), B = t.y + o.height / 2 + T / 2;
}
const j = C.cluster.select("rect"), i = Math.max(B - A + 3 * T, 50) + (R - 25);
j.attr("height", i);
}
ye(void 0, _, b.mindmap?.padding ?? K.kanban.padding, b.mindmap?.useMaxWidth ?? K.kanban.useMaxWidth);
}, "draw") }, Ae = /* @__PURE__ */ r((e) => {
let g = "";
for (let s = 0; s < e.THEME_COLOR_LIMIT; s++)
e["lineColor" + s] = e["lineColor" + s] || e["cScaleInv" + s], me(e["lineColor" + s]) ? e["lineColor" + s] = he(e["lineColor" + s], 20) : e["lineColor" + s] = le(e["lineColor" + s], 20);
const p = /* @__PURE__ */ r((s, d) => e.darkMode ? le(s, d) : he(s, d), "adjuster");
for (let s = 0; s < e.THEME_COLOR_LIMIT; s++) {
const d = "" + (17 - 3 * s);
g += `
.section-${s - 1} rect, .section-${s - 1} path, .section-${s - 1} circle, .section-${s - 1} polygon, .section-${s - 1} path {
fill: ${p(e["cScale" + s], 10)};
stroke: ${p(e["cScale" + s], 10)};
}
.section-${s - 1} text {
fill: ${e["cScaleLabel" + s]};
}
.node-icon-${s - 1} {
font-size: 40px;
color: ${e["cScaleLabel" + s]};
}
.section-edge-${s - 1}{
stroke: ${e["cScale" + s]};
}
.edge-depth-${s - 1}{
stroke-width: ${d};
}
.section-${s - 1} line {
stroke: ${e["cScaleInv" + s]} ;
stroke-width: 3;
}
.disabled, .disabled circle, .disabled text {
fill: lightgray;
}
.disabled text {
fill: #efefef;
}
.node rect,
.node circle,
.node ellipse,
.node polygon,
.node path {
fill: ${e.background};
stroke: ${e.nodeBorder};
stroke-width: 1px;
}
.kanban-ticket-link {
fill: ${e.background};
stroke: ${e.nodeBorder};
text-decoration: underline;
}
`;
}
return g;
}, "genSections"), ze = {
db: Ce,
renderer: we,
parser: De,
styles: /* @__PURE__ */ r((e) => `
.edge {
stroke-width: 3;
}
${Ae(e)}
.section-root rect, .section-root path, .section-root circle, .section-root polygon {
fill: ${e.git0};
}
.section-root text {
fill: ${e.gitBranchLabel0};
}
.icon-container {
height:100%;
display: flex;
justify-content: center;
align-items: center;
}
.edge {
fill: none;
}
.cluster-label, .label {
color: ${e.textColor};
fill: ${e.textColor};
}
.kanban-label {
dy: 1em;
alignment-baseline: middle;
text-anchor: middle;
dominant-baseline: middle;
text-align: center;
}
${ke()}
`, "getStyles")
};
export {
ze as diagram
};