@floegence/floe-webapp-core 0.101.44 → 0.101.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,2153 @@
|
|
|
1
|
+
function rn(o) {
|
|
2
|
+
return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o;
|
|
3
|
+
}
|
|
4
|
+
function nt(o) {
|
|
5
|
+
throw new Error('Could not dynamically require "' + o + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
6
|
+
}
|
|
7
|
+
var _t = { exports: {} }, ir;
|
|
8
|
+
function nn() {
|
|
9
|
+
return ir || (ir = 1, (function(o, c) {
|
|
10
|
+
(function(_) {
|
|
11
|
+
o.exports = _();
|
|
12
|
+
})(function() {
|
|
13
|
+
return (/* @__PURE__ */ (function() {
|
|
14
|
+
function _(a, f, C) {
|
|
15
|
+
function M(W, d) {
|
|
16
|
+
if (!f[W]) {
|
|
17
|
+
if (!a[W]) {
|
|
18
|
+
var g = typeof nt == "function" && nt;
|
|
19
|
+
if (!d && g) return g(W, !0);
|
|
20
|
+
if (O) return O(W, !0);
|
|
21
|
+
var p = new Error("Cannot find module '" + W + "'");
|
|
22
|
+
throw p.code = "MODULE_NOT_FOUND", p;
|
|
23
|
+
}
|
|
24
|
+
var v = f[W] = { exports: {} };
|
|
25
|
+
a[W][0].call(v.exports, function(m) {
|
|
26
|
+
var S = a[W][1][m];
|
|
27
|
+
return M(S || m);
|
|
28
|
+
}, v, v.exports, _, a, f, C);
|
|
29
|
+
}
|
|
30
|
+
return f[W].exports;
|
|
31
|
+
}
|
|
32
|
+
for (var O = typeof nt == "function" && nt, L = 0; L < C.length; L++) M(C[L]);
|
|
33
|
+
return M;
|
|
34
|
+
}
|
|
35
|
+
return _;
|
|
36
|
+
})())({ 1: [function(_, a, f) {
|
|
37
|
+
Object.defineProperty(f, "__esModule", {
|
|
38
|
+
value: !0
|
|
39
|
+
}), f.default = void 0;
|
|
40
|
+
function C(p) {
|
|
41
|
+
"@babel/helpers - typeof";
|
|
42
|
+
return C = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(v) {
|
|
43
|
+
return typeof v;
|
|
44
|
+
} : function(v) {
|
|
45
|
+
return v && typeof Symbol == "function" && v.constructor === Symbol && v !== Symbol.prototype ? "symbol" : typeof v;
|
|
46
|
+
}, C(p);
|
|
47
|
+
}
|
|
48
|
+
function M(p, v) {
|
|
49
|
+
if (!(p instanceof v)) throw new TypeError("Cannot call a class as a function");
|
|
50
|
+
}
|
|
51
|
+
function O(p, v) {
|
|
52
|
+
for (var m = 0; m < v.length; m++) {
|
|
53
|
+
var S = v[m];
|
|
54
|
+
S.enumerable = S.enumerable || !1, S.configurable = !0, "value" in S && (S.writable = !0), Object.defineProperty(p, W(S.key), S);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function L(p, v, m) {
|
|
58
|
+
return v && O(p.prototype, v), Object.defineProperty(p, "prototype", { writable: !1 }), p;
|
|
59
|
+
}
|
|
60
|
+
function W(p) {
|
|
61
|
+
var v = d(p, "string");
|
|
62
|
+
return C(v) == "symbol" ? v : v + "";
|
|
63
|
+
}
|
|
64
|
+
function d(p, v) {
|
|
65
|
+
if (C(p) != "object" || !p) return p;
|
|
66
|
+
var m = p[Symbol.toPrimitive];
|
|
67
|
+
if (m !== void 0) {
|
|
68
|
+
var S = m.call(p, v);
|
|
69
|
+
if (C(S) != "object") return S;
|
|
70
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
71
|
+
}
|
|
72
|
+
return String(p);
|
|
73
|
+
}
|
|
74
|
+
f.default = /* @__PURE__ */ (function() {
|
|
75
|
+
function p() {
|
|
76
|
+
var v = this, m = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, S = m.defaultLayoutOptions, u = S === void 0 ? {} : S, b = m.algorithms, l = b === void 0 ? ["layered", "stress", "mrtree", "radial", "force", "disco", "sporeOverlap", "sporeCompaction", "rectpacking"] : b, E = m.workerFactory, I = m.workerUrl;
|
|
77
|
+
if (M(this, p), this.defaultLayoutOptions = u, this.initialized = !1, typeof I > "u" && typeof E > "u")
|
|
78
|
+
throw new Error("Cannot construct an ELK without both 'workerUrl' and 'workerFactory'.");
|
|
79
|
+
var U = E;
|
|
80
|
+
typeof I < "u" && typeof E > "u" && (U = function(G) {
|
|
81
|
+
return new Worker(G);
|
|
82
|
+
});
|
|
83
|
+
var w = U(I);
|
|
84
|
+
if (typeof w.postMessage != "function")
|
|
85
|
+
throw new TypeError("Created worker does not provide the required 'postMessage' function.");
|
|
86
|
+
this.worker = new g(w), this.worker.postMessage({
|
|
87
|
+
cmd: "register",
|
|
88
|
+
algorithms: l
|
|
89
|
+
}).then(function($) {
|
|
90
|
+
return v.initialized = !0;
|
|
91
|
+
}).catch(console.err);
|
|
92
|
+
}
|
|
93
|
+
return L(p, [{
|
|
94
|
+
key: "layout",
|
|
95
|
+
value: function(m) {
|
|
96
|
+
var S = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, u = S.layoutOptions, b = u === void 0 ? this.defaultLayoutOptions : u, l = S.logging, E = l === void 0 ? !1 : l, I = S.measureExecutionTime, U = I === void 0 ? !1 : I;
|
|
97
|
+
return m ? this.worker.postMessage({
|
|
98
|
+
cmd: "layout",
|
|
99
|
+
graph: m,
|
|
100
|
+
layoutOptions: b,
|
|
101
|
+
options: {
|
|
102
|
+
logging: E,
|
|
103
|
+
measureExecutionTime: U
|
|
104
|
+
}
|
|
105
|
+
}) : Promise.reject(new Error("Missing mandatory parameter 'graph'."));
|
|
106
|
+
}
|
|
107
|
+
}, {
|
|
108
|
+
key: "knownLayoutAlgorithms",
|
|
109
|
+
value: function() {
|
|
110
|
+
return this.worker.postMessage({
|
|
111
|
+
cmd: "algorithms"
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}, {
|
|
115
|
+
key: "knownLayoutOptions",
|
|
116
|
+
value: function() {
|
|
117
|
+
return this.worker.postMessage({
|
|
118
|
+
cmd: "options"
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}, {
|
|
122
|
+
key: "knownLayoutCategories",
|
|
123
|
+
value: function() {
|
|
124
|
+
return this.worker.postMessage({
|
|
125
|
+
cmd: "categories"
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}, {
|
|
129
|
+
key: "terminateWorker",
|
|
130
|
+
value: function() {
|
|
131
|
+
this.worker && this.worker.terminate();
|
|
132
|
+
}
|
|
133
|
+
}]);
|
|
134
|
+
})();
|
|
135
|
+
var g = /* @__PURE__ */ (function() {
|
|
136
|
+
function p(v) {
|
|
137
|
+
var m = this;
|
|
138
|
+
if (M(this, p), v === void 0)
|
|
139
|
+
throw new Error("Missing mandatory parameter 'worker'.");
|
|
140
|
+
this.resolvers = {}, this.worker = v, this.worker.onmessage = function(S) {
|
|
141
|
+
setTimeout(function() {
|
|
142
|
+
m.receive(m, S);
|
|
143
|
+
}, 0);
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
return L(p, [{
|
|
147
|
+
key: "postMessage",
|
|
148
|
+
value: function(m) {
|
|
149
|
+
var S = this.id || 0;
|
|
150
|
+
this.id = S + 1, m.id = S;
|
|
151
|
+
var u = this;
|
|
152
|
+
return new Promise(function(b, l) {
|
|
153
|
+
u.resolvers[S] = function(E, I) {
|
|
154
|
+
E ? (u.convertGwtStyleError(E), l(E)) : b(I);
|
|
155
|
+
}, u.worker.postMessage(m);
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}, {
|
|
159
|
+
key: "receive",
|
|
160
|
+
value: function(m, S) {
|
|
161
|
+
var u = S.data, b = m.resolvers[u.id];
|
|
162
|
+
b && (delete m.resolvers[u.id], u.error ? b(u.error) : b(null, u.data));
|
|
163
|
+
}
|
|
164
|
+
}, {
|
|
165
|
+
key: "terminate",
|
|
166
|
+
value: function() {
|
|
167
|
+
this.worker && this.worker.terminate();
|
|
168
|
+
}
|
|
169
|
+
}, {
|
|
170
|
+
key: "convertGwtStyleError",
|
|
171
|
+
value: function(m) {
|
|
172
|
+
if (m) {
|
|
173
|
+
var S = m.__java$exception;
|
|
174
|
+
S && (S.cause && S.cause.backingJsObject && (m.cause = S.cause.backingJsObject, this.convertGwtStyleError(m.cause)), delete m.__java$exception);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}]);
|
|
178
|
+
})();
|
|
179
|
+
}, {}], 2: [function(_, a, f) {
|
|
180
|
+
var C = _("./elk-api.js").default;
|
|
181
|
+
Object.defineProperty(a.exports, "__esModule", {
|
|
182
|
+
value: !0
|
|
183
|
+
}), a.exports = C, C.default = C;
|
|
184
|
+
}, { "./elk-api.js": 1 }] }, {}, [2])(2);
|
|
185
|
+
});
|
|
186
|
+
})(_t)), _t.exports;
|
|
187
|
+
}
|
|
188
|
+
var on = nn(), an = /* @__PURE__ */ rn(on);
|
|
189
|
+
const Y = 1e-5, re = 8, _e = 1.5, Mt = (o) => o.horizontal ? "y" : "x", hr = (o) => o.horizontal ? "x" : "y", ee = (o) => o.path[o.index][Mt(o)], ze = (o, c) => {
|
|
190
|
+
const _ = hr(o);
|
|
191
|
+
return Math.min(
|
|
192
|
+
Math.max(o.path[o.index][_], o.path[o.index + 1][_]),
|
|
193
|
+
Math.max(c.path[c.index][_], c.path[c.index + 1][_])
|
|
194
|
+
) - Math.max(
|
|
195
|
+
Math.min(o.path[o.index][_], o.path[o.index + 1][_]),
|
|
196
|
+
Math.min(c.path[c.index][_], c.path[c.index + 1][_])
|
|
197
|
+
);
|
|
198
|
+
};
|
|
199
|
+
function sn(o, c, _, a) {
|
|
200
|
+
const f = new Map(o.nodes.map((d) => [d.id, d])), C = () => o.edges.flatMap(
|
|
201
|
+
(d) => d.sections.flatMap(
|
|
202
|
+
(g) => g.slice(1).map((p, v) => ({ edge: d, path: g, index: v, horizontal: p.y === g[v].y }))
|
|
203
|
+
)
|
|
204
|
+
);
|
|
205
|
+
let M = C();
|
|
206
|
+
const O = (d, g, p, v) => {
|
|
207
|
+
if (d.x === g.x && d.y === g.y) return !0;
|
|
208
|
+
if (v) return !1;
|
|
209
|
+
const m = Math.abs(g.y - p.y) < Y || Math.abs(g.y - p.y - p.height) < Y, S = m ? "x" : "y", u = m ? "y" : "x", b = m ? p.width : p.height, l = Math.min(a, b / 4);
|
|
210
|
+
return d[u] === g[u] && d[S] >= p[S] + l - Y && d[S] <= p[S] + b - l + Y;
|
|
211
|
+
}, L = (d, g) => {
|
|
212
|
+
const { path: p, index: v, edge: m } = d, S = Mt(d), u = p.map((l) => ({ ...l }));
|
|
213
|
+
p[v][S] = g, p[v + 1][S] = g;
|
|
214
|
+
let b = O(
|
|
215
|
+
p[0],
|
|
216
|
+
u[0],
|
|
217
|
+
f.get(m.source),
|
|
218
|
+
m.source === m.target ? "loop" : m.sourcePort
|
|
219
|
+
) && O(
|
|
220
|
+
p.at(-1),
|
|
221
|
+
u.at(-1),
|
|
222
|
+
f.get(m.target),
|
|
223
|
+
m.source === m.target ? "loop" : m.targetPort
|
|
224
|
+
);
|
|
225
|
+
for (let l = Math.max(0, v - 1); b && l <= Math.min(p.length - 2, v + 1); l++) {
|
|
226
|
+
const E = p[l], I = p[l + 1], U = u[l], w = u[l + 1], $ = U.x === w.x ? "y" : "x", G = Math.abs(I[$] - E[$]), te = l === 0 || l === p.length - 2 ? Math.min(_, Math.abs(w[$] - U[$])) : Y;
|
|
227
|
+
if ((I[$] - E[$]) * (w[$] - U[$]) <= 0 || G < te - Y) {
|
|
228
|
+
b = !1;
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
231
|
+
for (const h of c.get(m.id))
|
|
232
|
+
if (!(l === 0 && h.id === m.source || l === p.length - 2 && h.id === m.target) && Math.max(E.x, I.x) > h.x - _ + Y && Math.min(E.x, I.x) < h.x + h.width + _ - Y && Math.max(E.y, I.y) > h.y - _ + Y && Math.min(E.y, I.y) < h.y + h.height + _ - Y) {
|
|
233
|
+
b = !1;
|
|
234
|
+
break;
|
|
235
|
+
}
|
|
236
|
+
if (!b) break;
|
|
237
|
+
const i = { ...d, index: l, horizontal: E.y === I.y };
|
|
238
|
+
for (const h of M) {
|
|
239
|
+
if (h.edge.id === m.id || h.horizontal !== i.horizontal || ze(i, h) <= Y || Math.abs(ee(i) - ee(h)) >= _e - Y)
|
|
240
|
+
continue;
|
|
241
|
+
const A = { ...i, path: u };
|
|
242
|
+
if (l === v || ze(A, h) <= Y || Math.abs(ee(A) - ee(h)) > Math.abs(ee(i) - ee(h)) + Y) {
|
|
243
|
+
b = !1;
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
if (!b) for (let l = 0; l < p.length; l++) Object.assign(p[l], u[l]);
|
|
249
|
+
return b;
|
|
250
|
+
}, W = (d) => {
|
|
251
|
+
const { edge: g, path: p, index: v } = d;
|
|
252
|
+
if (g.source === g.target) return !1;
|
|
253
|
+
const m = hr(d), S = Mt(d), u = p[v], b = p[v + 1], l = Math.min(u[m], b[m]), E = Math.max(u[m], b[m]), I = /* @__PURE__ */ new Set([(l + E) / 2]), U = c.get(g.id).filter(
|
|
254
|
+
(h) => h[S] - _ <= u[S] + 2 * re && h[S] + (d.horizontal ? h.height : h.width) + _ >= u[S] - 2 * re
|
|
255
|
+
), w = M.filter((h) => {
|
|
256
|
+
const k = h.path[h.index], A = h.path[h.index + 1];
|
|
257
|
+
return Math.min(k[S], A[S]) <= u[S] + 2 * re && Math.max(k[S], A[S]) >= u[S] - 2 * re;
|
|
258
|
+
});
|
|
259
|
+
for (const h of U) {
|
|
260
|
+
const k = d.horizontal ? h.width : h.height;
|
|
261
|
+
I.add(h[m] - _ - re), I.add(h[m] + k + _ + re);
|
|
262
|
+
}
|
|
263
|
+
for (const h of w)
|
|
264
|
+
h.horizontal !== d.horizontal && (I.add(ee(h) - re), I.add(ee(h) + re));
|
|
265
|
+
const $ = /* @__PURE__ */ new Set([
|
|
266
|
+
-re,
|
|
267
|
+
re,
|
|
268
|
+
-2 * re,
|
|
269
|
+
2 * re,
|
|
270
|
+
-_e,
|
|
271
|
+
_e
|
|
272
|
+
]);
|
|
273
|
+
for (const h of w)
|
|
274
|
+
if (h.horizontal === d.horizontal) {
|
|
275
|
+
const k = ee(h) - u[S];
|
|
276
|
+
$.add(k - _e), $.add(k + _e);
|
|
277
|
+
}
|
|
278
|
+
const G = [...$].filter(
|
|
279
|
+
(h) => Math.abs(h) >= _e - Y && Math.abs(h) <= 2 * re
|
|
280
|
+
).sort((h, k) => Math.abs(h) - Math.abs(k)), te = /* @__PURE__ */ new Map(), i = (h, k, A, N) => {
|
|
281
|
+
const j = JSON.stringify([h.x, h.y, k.x, k.y, A, N]), D = te.get(j);
|
|
282
|
+
if (D !== void 0) return D;
|
|
283
|
+
const H = (() => {
|
|
284
|
+
if (h.x === k.x == (h.y === k.y)) return !1;
|
|
285
|
+
if (A || N) {
|
|
286
|
+
const V = A ? p[0] : p.at(-2), me = A ? p[1] : p.at(-1), ue = V.x === me.x ? "y" : "x";
|
|
287
|
+
if ((k[ue] - h[ue]) * (me[ue] - V[ue]) <= 0 || Math.abs(k[ue] - h[ue]) < Math.min(_, Math.abs(me[ue] - V[ue])) - Y)
|
|
288
|
+
return !1;
|
|
289
|
+
}
|
|
290
|
+
for (const V of c.get(g.id))
|
|
291
|
+
if (!(A && V.id === g.source || N && V.id === g.target) && Math.max(h.x, k.x) > V.x - _ + Y && Math.min(h.x, k.x) < V.x + V.width + _ - Y && Math.max(h.y, k.y) > V.y - _ + Y && Math.min(h.y, k.y) < V.y + V.height + _ - Y)
|
|
292
|
+
return !1;
|
|
293
|
+
const se = { path: [h, k], index: 0, horizontal: h.y === k.y };
|
|
294
|
+
return !M.some(
|
|
295
|
+
(V) => V.edge.id !== g.id && V.horizontal === se.horizontal && Math.abs(ee(se) - ee(V)) < _e - Y && ze(se, V) > Y
|
|
296
|
+
);
|
|
297
|
+
})();
|
|
298
|
+
return te.set(j, H), H;
|
|
299
|
+
};
|
|
300
|
+
for (const h of [...I].filter((k) => k > l + re && k < E - re).sort((k, A) => Math.abs(k - (l + E) / 2) - Math.abs(A - (l + E) / 2)))
|
|
301
|
+
for (const k of G)
|
|
302
|
+
for (const A of G) {
|
|
303
|
+
if (k === A) continue;
|
|
304
|
+
const N = { ...u, [S]: u[S] + k }, j = { ...b, [S]: b[S] + A }, D = [
|
|
305
|
+
...p.slice(0, v),
|
|
306
|
+
N,
|
|
307
|
+
{ ...N, [m]: h },
|
|
308
|
+
{ ...j, [m]: h },
|
|
309
|
+
j,
|
|
310
|
+
...p.slice(v + 2)
|
|
311
|
+
];
|
|
312
|
+
if (!O(
|
|
313
|
+
D[0],
|
|
314
|
+
p[0],
|
|
315
|
+
f.get(g.source),
|
|
316
|
+
g.source === g.target ? "loop" : g.sourcePort
|
|
317
|
+
) || !O(
|
|
318
|
+
D.at(-1),
|
|
319
|
+
p.at(-1),
|
|
320
|
+
f.get(g.target),
|
|
321
|
+
g.source === g.target ? "loop" : g.targetPort
|
|
322
|
+
))
|
|
323
|
+
continue;
|
|
324
|
+
let q = !0;
|
|
325
|
+
for (let H = Math.max(0, v - 1); q && H <= Math.min(D.length - 2, v + 3); H++)
|
|
326
|
+
q = i(D[H], D[H + 1], H === 0, H === D.length - 2);
|
|
327
|
+
if (q)
|
|
328
|
+
return g.sections = g.sections.map((H) => H === p ? D : H), M = C(), !0;
|
|
329
|
+
}
|
|
330
|
+
return !1;
|
|
331
|
+
};
|
|
332
|
+
for (let d = 0; d < M.length; d++) {
|
|
333
|
+
let g = !1, p = !1;
|
|
334
|
+
e: for (let v = 0; v < M.length; v++)
|
|
335
|
+
for (let m = v + 1; m < M.length; m++) {
|
|
336
|
+
const S = M[v], u = M[m];
|
|
337
|
+
if (S.edge.id === u.edge.id || S.horizontal !== u.horizontal || Math.abs(ee(S) - ee(u)) > Y || ze(S, u) <= Y)
|
|
338
|
+
continue;
|
|
339
|
+
p = !0;
|
|
340
|
+
let b = !1;
|
|
341
|
+
for (const l of [u, S]) {
|
|
342
|
+
const E = ee(l), I = /* @__PURE__ */ new Set();
|
|
343
|
+
for (const w of M)
|
|
344
|
+
w.horizontal === l.horizontal && ze(l, w) > Y && (I.add(ee(w) - re), I.add(ee(w) + re), I.add(ee(w) - _e), I.add(ee(w) + _e));
|
|
345
|
+
if ([...I].sort((w, $) => {
|
|
346
|
+
const G = (te) => Math.abs(te - E) + (Math.abs(te - E) < re - Y ? re : 0);
|
|
347
|
+
return G(w) - G($) || w - $;
|
|
348
|
+
}).some((w) => L(l, w))) {
|
|
349
|
+
g = !0, b = !0;
|
|
350
|
+
break;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
if (!b && (W(u) || W(S))) {
|
|
354
|
+
g = !0;
|
|
355
|
+
break e;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
if (!p || !g) break;
|
|
359
|
+
}
|
|
360
|
+
for (let d = 0; d < M.length; d++)
|
|
361
|
+
for (const g of M.slice(d + 1)) {
|
|
362
|
+
const p = M[d];
|
|
363
|
+
if (p.edge.id === g.edge.id || p.horizontal !== g.horizontal || Math.abs(ee(p) - ee(g)) > Y || ze(p, g) <= Y)
|
|
364
|
+
continue;
|
|
365
|
+
const v = (m) => m.edge.sourcePort || m.edge.targetPort || m.edge.source === m.edge.target;
|
|
366
|
+
if (!v(p) && !v(g))
|
|
367
|
+
throw new Error(
|
|
368
|
+
`Graph edges cannot be separated within fixed geometry: ${p.edge.id}, ${g.edge.id}`
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
var cn = (o) => ({ avoidLib: void 0, async load(c = void 0) {
|
|
373
|
+
if (this.avoidLib) console.log("Avoid library is already initialized");
|
|
374
|
+
else {
|
|
375
|
+
let _ = function(a, f) {
|
|
376
|
+
return c !== void 0 && a.endsWith(".wasm") ? c : f + a;
|
|
377
|
+
};
|
|
378
|
+
this.avoidLib = await o({ locateFile: _ });
|
|
379
|
+
}
|
|
380
|
+
}, getInstance() {
|
|
381
|
+
if (!this.avoidLib) throw new Error("Avoid library should be initialized before using");
|
|
382
|
+
return this.avoidLib;
|
|
383
|
+
} }), ln = (() => {
|
|
384
|
+
var o = import.meta.url;
|
|
385
|
+
return async function(c = {}) {
|
|
386
|
+
var _, a = c, f, C, M = new Promise((e, t) => {
|
|
387
|
+
f = e, C = t;
|
|
388
|
+
}), O = "./this.program", L = "", W;
|
|
389
|
+
if (typeof document < "u" && document.currentScript && (L = document.currentScript.src), o && (L = o), L.startsWith("blob:") ? L = "" : L = L.slice(0, L.replace(/[?#].*/, "").lastIndexOf("/") + 1), typeof window != "object" && typeof WorkerGlobalScope > "u") throw Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");
|
|
390
|
+
W = async (e) => {
|
|
391
|
+
if (u(!A(e), "readAsync does not work with file:// URLs"), e = await fetch(e, { credentials: "same-origin" }), e.ok) return e.arrayBuffer();
|
|
392
|
+
throw Error(e.status + " : " + e.url);
|
|
393
|
+
};
|
|
394
|
+
var d = console.log.bind(console), g = console.error.bind(console);
|
|
395
|
+
u(!0, "worker environment detected but not enabled at build time. Add `worker` to `-sENVIRONMENT` to enable."), u(!0, "node environment detected but not enabled at build time. Add `node` to `-sENVIRONMENT` to enable."), u(!0, "shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.");
|
|
396
|
+
var p;
|
|
397
|
+
typeof WebAssembly != "object" && g("no native wasm support detected");
|
|
398
|
+
var v, m = !1, S;
|
|
399
|
+
function u(e, t) {
|
|
400
|
+
e || Z("Assertion failed" + (t ? ": " + t : ""));
|
|
401
|
+
}
|
|
402
|
+
var b, l, E, I, U, w, $, G, te, i, h = !1, k = !1, A = (e) => e.startsWith("file://");
|
|
403
|
+
function N() {
|
|
404
|
+
var e = er();
|
|
405
|
+
u((e & 3) == 0), e == 0 && (e += 4), w[e >> 2] = 34821223, w[e + 4 >> 2] = 2310721022, w[0] = 1668509029;
|
|
406
|
+
}
|
|
407
|
+
function j() {
|
|
408
|
+
if (!m) {
|
|
409
|
+
var e = er();
|
|
410
|
+
e == 0 && (e += 4);
|
|
411
|
+
var t = w[e >> 2], r = w[e + 4 >> 2];
|
|
412
|
+
t == 34821223 && r == 2310721022 || Z(`Stack overflow! Stack cookie has been overwritten at ${Le(e)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${Le(r)} ${Le(t)}`), w[0] != 1668509029 && Z("Runtime error: The application has corrupted its heap memory area (address zero)!");
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
var D = new Int16Array(1), q = new Int8Array(D.buffer);
|
|
416
|
+
if (D[0] = 25459, q[0] !== 115 || q[1] !== 99) throw "Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)";
|
|
417
|
+
function H(e) {
|
|
418
|
+
Object.getOwnPropertyDescriptor(a, e) || Object.defineProperty(a, e, { configurable: !0, set() {
|
|
419
|
+
Z(`Attempt to set \`Module.${e}\` after it has already been processed. This can happen, for example, when code is injected via '--post-js' rather than '--pre-js'`);
|
|
420
|
+
} });
|
|
421
|
+
}
|
|
422
|
+
function se(e) {
|
|
423
|
+
return e === "FS_createPath" || e === "FS_createDataFile" || e === "FS_createPreloadedFile" || e === "FS_unlink" || e === "addRunDependency" || e === "FS_createLazyFile" || e === "FS_createDevice" || e === "removeRunDependency";
|
|
424
|
+
}
|
|
425
|
+
function V(e, t) {
|
|
426
|
+
typeof globalThis > "u" || Object.getOwnPropertyDescriptor(globalThis, e) || Object.defineProperty(globalThis, e, { configurable: !0, get() {
|
|
427
|
+
t();
|
|
428
|
+
} });
|
|
429
|
+
}
|
|
430
|
+
function me(e, t) {
|
|
431
|
+
V(e, () => {
|
|
432
|
+
ke(`\`${e}\` is not longer defined by emscripten. ${t}`);
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
me("buffer", "Please use HEAP8.buffer or wasmMemory.buffer"), me("asm", "Please use wasmExports instead");
|
|
436
|
+
function ue(e) {
|
|
437
|
+
Object.getOwnPropertyDescriptor(a, e) || Object.defineProperty(a, e, { configurable: !0, get() {
|
|
438
|
+
var t = `'${e}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;
|
|
439
|
+
se(e) && (t += ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"), Z(t);
|
|
440
|
+
} });
|
|
441
|
+
}
|
|
442
|
+
function Be() {
|
|
443
|
+
var e = v.buffer;
|
|
444
|
+
b = new Int8Array(e), E = new Int16Array(e), l = new Uint8Array(e), I = new Uint16Array(e), U = new Int32Array(e), w = new Uint32Array(e), $ = new Float32Array(e), i = new Float64Array(e), G = new BigInt64Array(e), te = new BigUint64Array(e);
|
|
445
|
+
}
|
|
446
|
+
u(typeof Int32Array < "u" && typeof Float64Array < "u" && Int32Array.prototype.subarray != null && Int32Array.prototype.set != null, "JS engine does not provide full typed array support");
|
|
447
|
+
var we = 0, J = null, ce = {}, ne = null;
|
|
448
|
+
function Te() {
|
|
449
|
+
we++, a.monitorRunDependencies?.(we), u(!ce["wasm-instantiate"]), ce["wasm-instantiate"] = 1, ne === null && typeof setInterval < "u" && (ne = setInterval(() => {
|
|
450
|
+
if (m) clearInterval(ne), ne = null;
|
|
451
|
+
else {
|
|
452
|
+
var e = !1, t;
|
|
453
|
+
for (t in ce) e || (e = !0, g("still waiting on run dependencies:")), g(`dependency: ${t}`);
|
|
454
|
+
e && g("(end of list)");
|
|
455
|
+
}
|
|
456
|
+
}, 1e4));
|
|
457
|
+
}
|
|
458
|
+
function Z(e) {
|
|
459
|
+
throw a.onAbort?.(e), e = "Aborted(" + e + ")", g(e), m = !0, h && Kr(), e = new WebAssembly.RuntimeError(e), C(e), e;
|
|
460
|
+
}
|
|
461
|
+
function he() {
|
|
462
|
+
Z("Filesystem support (FS) was not included. The problem is that you are using files from JS, but files were not used from C/C++, so filesystem support was not auto-included. You can force-include filesystem support with -sFORCE_FILESYSTEM");
|
|
463
|
+
}
|
|
464
|
+
function oe(e, t) {
|
|
465
|
+
return (...r) => {
|
|
466
|
+
u(h, `native function \`${e}\` called before runtime initialization`), u(!k, `native function \`${e}\` called after runtime exit (use NO_EXIT_RUNTIME to keep it alive after main() exits)`);
|
|
467
|
+
var n = le[e];
|
|
468
|
+
return u(n, `exported native function \`${e}\` not found`), u(r.length <= t, `native function \`${e}\` called with ${r.length} args but expects ${t}`), n(...r);
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
var Ee = 0;
|
|
472
|
+
function ie(e) {
|
|
473
|
+
return (...t) => {
|
|
474
|
+
if (m) throw "program has already aborted!";
|
|
475
|
+
Ee++;
|
|
476
|
+
try {
|
|
477
|
+
return e(...t);
|
|
478
|
+
} catch (r) {
|
|
479
|
+
if (m || 1 < Ee || r === "unwind") throw r;
|
|
480
|
+
Z("unhandled exception: " + [r, r.stack]);
|
|
481
|
+
} finally {
|
|
482
|
+
Ee--;
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
function Me() {
|
|
487
|
+
var e = Ae.get, t = {};
|
|
488
|
+
Ae.get = (r) => {
|
|
489
|
+
var n = e.call(Ae, r), s = t[r];
|
|
490
|
+
return s && s.S === n || (s = t[r] = { S: n, ca: ie(n) }), s.ca;
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
var Se;
|
|
494
|
+
async function mr(e) {
|
|
495
|
+
if (!p) try {
|
|
496
|
+
var t = await W(e);
|
|
497
|
+
return new Uint8Array(t);
|
|
498
|
+
} catch {
|
|
499
|
+
}
|
|
500
|
+
if (e == Se && p) e = new Uint8Array(p);
|
|
501
|
+
else throw "both async and sync fetching of the wasm failed";
|
|
502
|
+
return e;
|
|
503
|
+
}
|
|
504
|
+
async function yr(e, t) {
|
|
505
|
+
try {
|
|
506
|
+
var r = await mr(e);
|
|
507
|
+
return await WebAssembly.instantiate(r, t);
|
|
508
|
+
} catch (n) {
|
|
509
|
+
g(`failed to asynchronously prepare wasm: ${n}`), A(Se) && g(`warning: Loading from a file URI (${Se}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`), Z(n);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
async function wr(e) {
|
|
513
|
+
var t = Se;
|
|
514
|
+
if (!p && typeof WebAssembly.instantiateStreaming == "function") try {
|
|
515
|
+
var r = fetch(t, { credentials: "same-origin" });
|
|
516
|
+
return await WebAssembly.instantiateStreaming(r, e);
|
|
517
|
+
} catch (n) {
|
|
518
|
+
g(`wasm streaming compile failed: ${n}`), g("falling back to ArrayBuffer instantiation");
|
|
519
|
+
}
|
|
520
|
+
return yr(t, e);
|
|
521
|
+
}
|
|
522
|
+
class St {
|
|
523
|
+
name = "ExitStatus";
|
|
524
|
+
constructor(t) {
|
|
525
|
+
this.message = `Program terminated with exit(${t})`, this.status = t;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
var kt = (e) => {
|
|
529
|
+
for (; 0 < e.length; ) e.shift()(a);
|
|
530
|
+
}, It = [], Pt = [], vr = () => {
|
|
531
|
+
var e = a.preRun.shift();
|
|
532
|
+
Pt.push(e);
|
|
533
|
+
}, Fe = !1, Le = (e) => (u(typeof e == "number"), "0x" + (e >>> 0).toString(16).padStart(8, "0")), ke = (e) => {
|
|
534
|
+
ke.M || (ke.M = {}), ke.M[e] || (ke.M[e] = 1, g(e));
|
|
535
|
+
}, Ae, At = typeof TextDecoder < "u" ? new TextDecoder() : void 0, Ct = (e, t = 0, r = NaN) => {
|
|
536
|
+
var n = t + r;
|
|
537
|
+
for (r = t; e[r] && !(r >= n); ) ++r;
|
|
538
|
+
if (16 < r - t && e.buffer && At) return At.decode(e.subarray(t, r));
|
|
539
|
+
for (n = ""; t < r; ) {
|
|
540
|
+
var s = e[t++];
|
|
541
|
+
if (s & 128) {
|
|
542
|
+
var y = e[t++] & 63;
|
|
543
|
+
if ((s & 224) == 192) n += String.fromCharCode((s & 31) << 6 | y);
|
|
544
|
+
else {
|
|
545
|
+
var x = e[t++] & 63;
|
|
546
|
+
(s & 240) == 224 ? s = (s & 15) << 12 | y << 6 | x : ((s & 248) != 240 && ke("Invalid UTF-8 leading byte " + Le(s) + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!"), s = (s & 7) << 18 | y << 12 | x << 6 | e[t++] & 63), 65536 > s ? n += String.fromCharCode(s) : (s -= 65536, n += String.fromCharCode(55296 | s >> 10, 56320 | s & 1023));
|
|
547
|
+
}
|
|
548
|
+
} else n += String.fromCharCode(s);
|
|
549
|
+
}
|
|
550
|
+
return n;
|
|
551
|
+
}, Ne = (e, t) => (u(typeof e == "number", `UTF8ToString expects a number (got ${typeof e})`), e ? Ct(l, e, t) : ""), it = (e) => (e = e.getArg(le.__cpp_exception, 0), en(e)), Ot = (e) => {
|
|
552
|
+
var t = it(e);
|
|
553
|
+
e = rr();
|
|
554
|
+
var r = tr(4), n = tr(4);
|
|
555
|
+
if (tn(t, r, n), t = w[r >> 2], n = w[n >> 2], r = Ne(t), xe(t), n) {
|
|
556
|
+
var s = Ne(n);
|
|
557
|
+
xe(n);
|
|
558
|
+
}
|
|
559
|
+
return Xr(e), [r, s];
|
|
560
|
+
}, Ie = (e) => {
|
|
561
|
+
if (e === null) return "null";
|
|
562
|
+
var t = typeof e;
|
|
563
|
+
return t === "object" || t === "array" || t === "function" ? e.toString() : "" + e;
|
|
564
|
+
}, Rt, ae = (e) => {
|
|
565
|
+
for (var t = ""; l[e]; ) t += Rt[l[e++]];
|
|
566
|
+
return t;
|
|
567
|
+
}, Ue = {}, Ce = {}, Ve = {}, z = a.BindingError = class extends Error {
|
|
568
|
+
constructor(e) {
|
|
569
|
+
super(e), this.name = "BindingError";
|
|
570
|
+
}
|
|
571
|
+
}, br = (e) => {
|
|
572
|
+
throw new z(e);
|
|
573
|
+
};
|
|
574
|
+
function xr(e, t, r = {}) {
|
|
575
|
+
var n = t.name;
|
|
576
|
+
if (!e) throw new z(`type "${n}" must have a positive integer typeid pointer`);
|
|
577
|
+
if (Ce.hasOwnProperty(e)) {
|
|
578
|
+
if (r.V) return;
|
|
579
|
+
throw new z(`Cannot register type '${n}' twice`);
|
|
580
|
+
}
|
|
581
|
+
Ce[e] = t, delete Ve[e], Ue.hasOwnProperty(e) && (t = Ue[e], delete Ue[e], t.forEach((s) => s()));
|
|
582
|
+
}
|
|
583
|
+
function fe(e, t, r = {}) {
|
|
584
|
+
if (t.o === void 0) throw new TypeError("registerType registeredInstance requires argPackAdvance");
|
|
585
|
+
return xr(e, t, r);
|
|
586
|
+
}
|
|
587
|
+
var $t = (e, t, r) => {
|
|
588
|
+
switch (t) {
|
|
589
|
+
case 1:
|
|
590
|
+
return r ? (n) => b[n] : (n) => l[n];
|
|
591
|
+
case 2:
|
|
592
|
+
return r ? (n) => E[n >> 1] : (n) => I[n >> 1];
|
|
593
|
+
case 4:
|
|
594
|
+
return r ? (n) => U[n >> 2] : (n) => w[n >> 2];
|
|
595
|
+
case 8:
|
|
596
|
+
return r ? (n) => G[n >> 3] : (n) => te[n >> 3];
|
|
597
|
+
default:
|
|
598
|
+
throw new TypeError(`invalid integer width (${t}): ${e}`);
|
|
599
|
+
}
|
|
600
|
+
}, at = (e) => {
|
|
601
|
+
throw new z(e.g.j.h.name + " instance already deleted");
|
|
602
|
+
}, st = !1, Ft = () => {
|
|
603
|
+
}, Lt = (e, t, r) => t === r ? e : r.m === void 0 ? null : (e = Lt(e, t, r.m), e === null ? null : r.R(e)), Nt = {}, _r = {}, Tr = (e, t) => {
|
|
604
|
+
if (t === void 0) throw new z("ptr should not be undefined");
|
|
605
|
+
for (; e.m; ) t = e.H(t), e = e.m;
|
|
606
|
+
return _r[t];
|
|
607
|
+
}, Je = a.InternalError = class extends Error {
|
|
608
|
+
constructor(e) {
|
|
609
|
+
super(e), this.name = "InternalError";
|
|
610
|
+
}
|
|
611
|
+
}, Ye = (e, t) => {
|
|
612
|
+
if (!t.j || !t.i) throw new Je("makeClassHandle requires ptr and ptrType");
|
|
613
|
+
if (!!t.v != !!t.l) throw new Je("Both smartPtrType and smartPtr must be specified");
|
|
614
|
+
return t.count = { value: 1 }, He(Object.create(e, { g: { value: t, writable: !0 } }));
|
|
615
|
+
};
|
|
616
|
+
function Ut(e) {
|
|
617
|
+
function t() {
|
|
618
|
+
return this.K ? Ye(this.h.A, { j: this.Y, i: r, v: this, l: e }) : Ye(this.h.A, { j: this, i: e });
|
|
619
|
+
}
|
|
620
|
+
var r = this.U(e);
|
|
621
|
+
if (!r) return this.N(e), null;
|
|
622
|
+
var n = Tr(this.h, r);
|
|
623
|
+
if (n !== void 0) return n.g.count.value === 0 ? (n.g.i = r, n.g.l = e, n.clone()) : (n = n.clone(), this.N(e), n);
|
|
624
|
+
if (n = this.h.T(r), n = Nt[n], !n) return t.call(this);
|
|
625
|
+
n = this.J ? n.P : n.pointerType;
|
|
626
|
+
var s = Lt(r, this.h, n.h);
|
|
627
|
+
return s === null ? t.call(this) : this.K ? Ye(n.h.A, { j: n, i: s, v: this, l: e }) : Ye(n.h.A, { j: n, i: s });
|
|
628
|
+
}
|
|
629
|
+
var He = (e) => typeof FinalizationRegistry > "u" ? (He = (t) => t, e) : (st = new FinalizationRegistry((t) => {
|
|
630
|
+
console.warn(t.X), t = t.g, --t.count.value, t.count.value === 0 && (t.l ? t.v.B(t.l) : t.j.h.B(t.i));
|
|
631
|
+
}), He = (t) => {
|
|
632
|
+
var r = t.g;
|
|
633
|
+
if (r.l) {
|
|
634
|
+
var n = { g: r };
|
|
635
|
+
r = Error(`Embind found a leaked C++ instance ${r.j.h.name} <${Le(r.i)}>.
|
|
636
|
+
We'll free it automatically in this case, but this functionality is not reliable across various environments.
|
|
637
|
+
Make sure to invoke .delete() manually once you're done with the instance instead.
|
|
638
|
+
Originally allocated`), "captureStackTrace" in Error && Error.captureStackTrace(r, Ut), n.X = r.stack.replace(/^Error: /, ""), st.register(t, n, t);
|
|
639
|
+
}
|
|
640
|
+
return t;
|
|
641
|
+
}, Ft = (t) => {
|
|
642
|
+
st.unregister(t);
|
|
643
|
+
}, He(e));
|
|
644
|
+
function Ke() {
|
|
645
|
+
}
|
|
646
|
+
var qe = (e, t) => Object.defineProperty(t, "name", { value: e }), jt = (e, t, r) => {
|
|
647
|
+
if (e[t].u === void 0) {
|
|
648
|
+
var n = e[t];
|
|
649
|
+
e[t] = function(...s) {
|
|
650
|
+
if (!e[t].u.hasOwnProperty(s.length)) throw new z(`Function '${r}' called with an invalid number of arguments (${s.length}) - expects one of (${e[t].u})!`);
|
|
651
|
+
return e[t].u[s.length].apply(this, s);
|
|
652
|
+
}, e[t].u = [], e[t].u[n.C] = n;
|
|
653
|
+
}
|
|
654
|
+
}, Wt = (e, t) => {
|
|
655
|
+
if (a.hasOwnProperty(e)) throw new z(`Cannot register public name '${e}' twice`);
|
|
656
|
+
a[e] = t, a[e].C = void 0;
|
|
657
|
+
}, Er = (e) => {
|
|
658
|
+
u(typeof e == "string"), e = e.replace(/[^a-zA-Z0-9_]/g, "$");
|
|
659
|
+
var t = e.charCodeAt(0);
|
|
660
|
+
return 48 <= t && 57 >= t ? `_${e}` : e;
|
|
661
|
+
};
|
|
662
|
+
function Mr(e, t, r, n, s, y, x, T) {
|
|
663
|
+
this.name = e, this.constructor = t, this.A = r, this.B = n, this.m = s, this.T = y, this.H = x, this.R = T, this.Z = [];
|
|
664
|
+
}
|
|
665
|
+
var Xe = (e, t, r) => {
|
|
666
|
+
for (; t !== r; ) {
|
|
667
|
+
if (!t.H) throw new z(`Expected null or instance of ${r.name}, got an instance of ${t.name}`);
|
|
668
|
+
e = t.H(e), t = t.m;
|
|
669
|
+
}
|
|
670
|
+
return e;
|
|
671
|
+
};
|
|
672
|
+
function Sr(e, t) {
|
|
673
|
+
if (t === null) {
|
|
674
|
+
if (this.L) throw new z(`null is not a valid ${this.name}`);
|
|
675
|
+
return 0;
|
|
676
|
+
}
|
|
677
|
+
if (!t.g) throw new z(`Cannot pass "${Ie(t)}" as a ${this.name}`);
|
|
678
|
+
if (!t.g.i) throw new z(`Cannot pass deleted object as a pointer of type ${this.name}`);
|
|
679
|
+
return Xe(t.g.i, t.g.j.h, this.h);
|
|
680
|
+
}
|
|
681
|
+
function kr(e, t) {
|
|
682
|
+
if (t === null) {
|
|
683
|
+
if (this.L) throw new z(`null is not a valid ${this.name}`);
|
|
684
|
+
if (this.K) {
|
|
685
|
+
var r = this.$();
|
|
686
|
+
return e !== null && e.push(this.B, r), r;
|
|
687
|
+
}
|
|
688
|
+
return 0;
|
|
689
|
+
}
|
|
690
|
+
if (!t || !t.g) throw new z(`Cannot pass "${Ie(t)}" as a ${this.name}`);
|
|
691
|
+
if (!t.g.i) throw new z(`Cannot pass deleted object as a pointer of type ${this.name}`);
|
|
692
|
+
if (!this.J && t.g.j.J) throw new z(`Cannot convert argument of type ${t.g.v ? t.g.v.name : t.g.j.name} to parameter type ${this.name}`);
|
|
693
|
+
if (r = Xe(t.g.i, t.g.j.h, this.h), this.K) {
|
|
694
|
+
if (t.g.l === void 0) throw new z("Passing raw pointer to smart pointer is illegal");
|
|
695
|
+
switch (this.ba) {
|
|
696
|
+
case 0:
|
|
697
|
+
if (t.g.v === this) r = t.g.l;
|
|
698
|
+
else throw new z(`Cannot convert argument of type ${t.g.v ? t.g.v.name : t.g.j.name} to parameter type ${this.name}`);
|
|
699
|
+
break;
|
|
700
|
+
case 1:
|
|
701
|
+
r = t.g.l;
|
|
702
|
+
break;
|
|
703
|
+
case 2:
|
|
704
|
+
if (t.g.v === this) r = t.g.l;
|
|
705
|
+
else {
|
|
706
|
+
var n = t.clone();
|
|
707
|
+
r = this.aa(r, et(() => n.delete())), e !== null && e.push(this.B, r);
|
|
708
|
+
}
|
|
709
|
+
break;
|
|
710
|
+
default:
|
|
711
|
+
throw new z("Unsupporting sharing policy");
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
return r;
|
|
715
|
+
}
|
|
716
|
+
function Ir(e, t) {
|
|
717
|
+
if (t === null) {
|
|
718
|
+
if (this.L) throw new z(`null is not a valid ${this.name}`);
|
|
719
|
+
return 0;
|
|
720
|
+
}
|
|
721
|
+
if (!t.g) throw new z(`Cannot pass "${Ie(t)}" as a ${this.name}`);
|
|
722
|
+
if (!t.g.i) throw new z(`Cannot pass deleted object as a pointer of type ${this.name}`);
|
|
723
|
+
if (t.g.j.J) throw new z(`Cannot convert argument of type ${t.g.j.name} to parameter type ${this.name}`);
|
|
724
|
+
return Xe(t.g.i, t.g.j.h, this.h);
|
|
725
|
+
}
|
|
726
|
+
function Ze(e) {
|
|
727
|
+
return this.fromWireType(w[e >> 2]);
|
|
728
|
+
}
|
|
729
|
+
function Qe(e, t, r, n, s, y, x, T, R, F, P) {
|
|
730
|
+
this.name = e, this.h = t, this.L = r, this.J = n, this.K = s, this.Y = y, this.ba = x, this.O = T, this.$ = R, this.aa = F, this.B = P, s || t.m !== void 0 ? this.toWireType = kr : (this.toWireType = n ? Sr : Ir, this.s = null);
|
|
731
|
+
}
|
|
732
|
+
var Pr = (e, t) => {
|
|
733
|
+
if (!a.hasOwnProperty(e)) throw new Je("Replacing nonexistent public symbol");
|
|
734
|
+
a[e] = t, a[e].C = void 0;
|
|
735
|
+
}, Dt = [], ve = (e, t, r = !1) => {
|
|
736
|
+
if (u(!r, "Async bindings are only supported with JSPI."), e = ae(e), (r = Dt[t]) || (Dt[t] = r = Ae.get(t)), u(Ae.get(t) == r, "JavaScript-side Wasm function table mirror is out of date!"), typeof r != "function") throw new z(`unknown function pointer with signature ${e}: ${t}`);
|
|
737
|
+
return r;
|
|
738
|
+
};
|
|
739
|
+
class Ar extends Error {
|
|
740
|
+
}
|
|
741
|
+
var Gt = (e) => {
|
|
742
|
+
e = Hr(e);
|
|
743
|
+
var t = ae(e);
|
|
744
|
+
return xe(e), t;
|
|
745
|
+
}, je = (e, t) => {
|
|
746
|
+
function r(y) {
|
|
747
|
+
s[y] || Ce[y] || (Ve[y] ? Ve[y].forEach(r) : (n.push(y), s[y] = !0));
|
|
748
|
+
}
|
|
749
|
+
var n = [], s = {};
|
|
750
|
+
throw t.forEach(r), new Ar(`${e}: ` + n.map(Gt).join([", "]));
|
|
751
|
+
}, be = (e, t, r) => {
|
|
752
|
+
function n(T) {
|
|
753
|
+
if (T = r(T), T.length !== e.length) throw new Je("Mismatched type converter count");
|
|
754
|
+
for (var R = 0; R < e.length; ++R) fe(e[R], T[R]);
|
|
755
|
+
}
|
|
756
|
+
e.forEach((T) => Ve[T] = t);
|
|
757
|
+
var s = Array(t.length), y = [], x = 0;
|
|
758
|
+
t.forEach((T, R) => {
|
|
759
|
+
Ce.hasOwnProperty(T) ? s[R] = Ce[T] : (y.push(T), Ue.hasOwnProperty(T) || (Ue[T] = []), Ue[T].push(() => {
|
|
760
|
+
s[R] = Ce[T], ++x, x === y.length && n(s);
|
|
761
|
+
}));
|
|
762
|
+
}), y.length === 0 && n(s);
|
|
763
|
+
}, ct = (e) => {
|
|
764
|
+
for (; e.length; ) {
|
|
765
|
+
var t = e.pop();
|
|
766
|
+
e.pop()(t);
|
|
767
|
+
}
|
|
768
|
+
};
|
|
769
|
+
function zt(e) {
|
|
770
|
+
for (var t = 1; t < e.length; ++t) if (e[t] !== null && e[t].s === void 0) return !0;
|
|
771
|
+
return !1;
|
|
772
|
+
}
|
|
773
|
+
function Cr(e, t, r, n, s) {
|
|
774
|
+
(e < t || e > r) && s(`function ${n} called with ${e} arguments, expected ${t == r ? t : `${t} to ${r}`}`);
|
|
775
|
+
}
|
|
776
|
+
function lt(e, t, r, n, s, y) {
|
|
777
|
+
var x = t.length;
|
|
778
|
+
if (2 > x) throw new z("argTypes array size mismatch! Must at least get return value and 'this' types!");
|
|
779
|
+
u(!y, "Async bindings are only supported with JSPI.");
|
|
780
|
+
var T = t[1] !== null && r !== null, R = zt(t);
|
|
781
|
+
r = t[0].name !== "void";
|
|
782
|
+
for (var F = x - 2, P = t.length - 2, B = t.length - 1; 2 <= B && t[B].optional; --B) P--;
|
|
783
|
+
for (n = [e, br, n, s, ct, t[0], t[1]], s = 0; s < x - 2; ++s) n.push(t[s + 2]);
|
|
784
|
+
if (!R) for (s = T ? 1 : 2; s < t.length; ++s) t[s].s !== null && n.push(t[s].s);
|
|
785
|
+
for (n.push(Cr, P, F), R = zt(t), F = t.length - 2, P = [], s = ["fn"], T && s.push("thisWired"), x = 0; x < F; ++x) P.push(`arg${x}`), s.push(`arg${x}Wired`);
|
|
786
|
+
P = P.join(","), s = s.join(","), P = `return function (${P}) {
|
|
787
|
+
checkArgCount(arguments.length, minArgs, maxArgs, humanName, throwBindingError);
|
|
788
|
+
`, R && (P += `var destructors = [];
|
|
789
|
+
`);
|
|
790
|
+
var K = R ? "destructors" : "null";
|
|
791
|
+
for (B = "humanName throwBindingError invoker fn runDestructors retType classParam".split(" "), T && (P += `var thisWired = classParam['toWireType'](${K}, this);
|
|
792
|
+
`), x = 0; x < F; ++x) P += `var arg${x}Wired = argType${x}['toWireType'](${K}, arg${x});
|
|
793
|
+
`, B.push(`argType${x}`);
|
|
794
|
+
if (P += (r || y ? "var rv = " : "") + `invoker(${s});
|
|
795
|
+
`, R) P += `runDestructors(destructors);
|
|
796
|
+
`;
|
|
797
|
+
else for (x = T ? 1 : 2; x < t.length; ++x) y = x === 1 ? "thisWired" : "arg" + (x - 2) + "Wired", t[x].s !== null && (P += `${y}_dtor(${y});
|
|
798
|
+
`, B.push(`${y}_dtor`));
|
|
799
|
+
r && (P += `var ret = retType['fromWireType'](rv);
|
|
800
|
+
return ret;
|
|
801
|
+
`), P += `}
|
|
802
|
+
`, B.push("checkArgCount", "minArgs", "maxArgs"), P = `if (arguments.length !== ${B.length}){ throw new Error(humanName + "Expected ${B.length} closure arguments " + arguments.length + " given."); }
|
|
803
|
+
${P}`;
|
|
804
|
+
let [X, Q] = [B, P];
|
|
805
|
+
return t = new Function(...X, Q)(...n), qe(e, t);
|
|
806
|
+
}
|
|
807
|
+
for (var ut = (e, t) => {
|
|
808
|
+
for (var r = [], n = 0; n < e; n++) r.push(w[t + 4 * n >> 2]);
|
|
809
|
+
return r;
|
|
810
|
+
}, Bt = (e) => {
|
|
811
|
+
e = e.trim();
|
|
812
|
+
let t = e.indexOf("(");
|
|
813
|
+
return t === -1 ? e : (u(e.endsWith(")"), "Parentheses for argument names should match."), e.slice(0, t));
|
|
814
|
+
}, Ht = (e, t, r) => {
|
|
815
|
+
if (!(e instanceof Object)) throw new z(`${r} with invalid "this": ${e}`);
|
|
816
|
+
if (!(e instanceof t.h.constructor)) throw new z(`${r} incompatible with "this" of type ${e.constructor.name}`);
|
|
817
|
+
if (!e.g.i) throw new z(`cannot call emscripten binding method ${r} on deleted object`);
|
|
818
|
+
return Xe(e.g.i, e.g.j.h, t.h);
|
|
819
|
+
}, dt = [], ge = [], ht = (e) => {
|
|
820
|
+
9 < e && --ge[e + 1] === 0 && (u(ge[e] !== void 0, "Decref for unallocated handle."), ge[e] = void 0, dt.push(e));
|
|
821
|
+
}, ft = (e) => {
|
|
822
|
+
if (!e) throw new z(`Cannot use deleted val. handle = ${e}`);
|
|
823
|
+
return u(e === 2 || ge[e] !== void 0 && e % 2 === 0, `invalid handle: ${e}`), ge[e];
|
|
824
|
+
}, et = (e) => {
|
|
825
|
+
switch (e) {
|
|
826
|
+
case void 0:
|
|
827
|
+
return 2;
|
|
828
|
+
case null:
|
|
829
|
+
return 4;
|
|
830
|
+
case !0:
|
|
831
|
+
return 6;
|
|
832
|
+
case !1:
|
|
833
|
+
return 8;
|
|
834
|
+
default:
|
|
835
|
+
let t = dt.pop() || ge.length;
|
|
836
|
+
return ge[t] = e, ge[t + 1] = 1, t;
|
|
837
|
+
}
|
|
838
|
+
}, Vt = { name: "emscripten::val", fromWireType: (e) => {
|
|
839
|
+
var t = ft(e);
|
|
840
|
+
return ht(e), t;
|
|
841
|
+
}, toWireType: (e, t) => et(t), o: 8, readValueFromPointer: Ze, s: null }, Or = (e, t, r) => {
|
|
842
|
+
switch (t) {
|
|
843
|
+
case 1:
|
|
844
|
+
return r ? function(n) {
|
|
845
|
+
return this.fromWireType(b[n]);
|
|
846
|
+
} : function(n) {
|
|
847
|
+
return this.fromWireType(l[n]);
|
|
848
|
+
};
|
|
849
|
+
case 2:
|
|
850
|
+
return r ? function(n) {
|
|
851
|
+
return this.fromWireType(E[n >> 1]);
|
|
852
|
+
} : function(n) {
|
|
853
|
+
return this.fromWireType(I[n >> 1]);
|
|
854
|
+
};
|
|
855
|
+
case 4:
|
|
856
|
+
return r ? function(n) {
|
|
857
|
+
return this.fromWireType(U[n >> 2]);
|
|
858
|
+
} : function(n) {
|
|
859
|
+
return this.fromWireType(w[n >> 2]);
|
|
860
|
+
};
|
|
861
|
+
default:
|
|
862
|
+
throw new TypeError(`invalid integer width (${t}): ${e}`);
|
|
863
|
+
}
|
|
864
|
+
}, gt = (e, t) => {
|
|
865
|
+
var r = Ce[e];
|
|
866
|
+
if (r === void 0) throw e = `${t} has unknown type ${Gt(e)}`, new z(e);
|
|
867
|
+
return r;
|
|
868
|
+
}, Rr = (e, t) => {
|
|
869
|
+
switch (t) {
|
|
870
|
+
case 4:
|
|
871
|
+
return function(r) {
|
|
872
|
+
return this.fromWireType($[r >> 2]);
|
|
873
|
+
};
|
|
874
|
+
case 8:
|
|
875
|
+
return function(r) {
|
|
876
|
+
return this.fromWireType(i[r >> 3]);
|
|
877
|
+
};
|
|
878
|
+
default:
|
|
879
|
+
throw new TypeError(`invalid float width (${t}): ${e}`);
|
|
880
|
+
}
|
|
881
|
+
}, $r = Object.assign({ optional: !0 }, Vt), We = (e, t, r) => {
|
|
882
|
+
u(typeof r == "number", "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!");
|
|
883
|
+
var n = l;
|
|
884
|
+
if (u(typeof e == "string", `stringToUTF8Array expects a string (got ${typeof e})`), 0 < r) {
|
|
885
|
+
var s = t;
|
|
886
|
+
r = t + r - 1;
|
|
887
|
+
for (var y = 0; y < e.length; ++y) {
|
|
888
|
+
var x = e.charCodeAt(y);
|
|
889
|
+
if (55296 <= x && 57343 >= x) {
|
|
890
|
+
var T = e.charCodeAt(++y);
|
|
891
|
+
x = 65536 + ((x & 1023) << 10) | T & 1023;
|
|
892
|
+
}
|
|
893
|
+
if (127 >= x) {
|
|
894
|
+
if (t >= r) break;
|
|
895
|
+
n[t++] = x;
|
|
896
|
+
} else {
|
|
897
|
+
if (2047 >= x) {
|
|
898
|
+
if (t + 1 >= r) break;
|
|
899
|
+
n[t++] = 192 | x >> 6;
|
|
900
|
+
} else {
|
|
901
|
+
if (65535 >= x) {
|
|
902
|
+
if (t + 2 >= r) break;
|
|
903
|
+
n[t++] = 224 | x >> 12;
|
|
904
|
+
} else {
|
|
905
|
+
if (t + 3 >= r) break;
|
|
906
|
+
1114111 < x && ke("Invalid Unicode code point " + Le(x) + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."), n[t++] = 240 | x >> 18, n[t++] = 128 | x >> 12 & 63;
|
|
907
|
+
}
|
|
908
|
+
n[t++] = 128 | x >> 6 & 63;
|
|
909
|
+
}
|
|
910
|
+
n[t++] = 128 | x & 63;
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
n[t] = 0, e = t - s;
|
|
914
|
+
} else e = 0;
|
|
915
|
+
return e;
|
|
916
|
+
}, tt = (e) => {
|
|
917
|
+
for (var t = 0, r = 0; r < e.length; ++r) {
|
|
918
|
+
var n = e.charCodeAt(r);
|
|
919
|
+
127 >= n ? t++ : 2047 >= n ? t += 2 : 55296 <= n && 57343 >= n ? (t += 4, ++r) : t += 3;
|
|
920
|
+
}
|
|
921
|
+
return t;
|
|
922
|
+
}, Jt = typeof TextDecoder < "u" ? new TextDecoder("utf-16le") : void 0, Fr = (e, t) => {
|
|
923
|
+
u(e % 2 == 0, "Pointer passed to UTF16ToString must be aligned to two bytes!");
|
|
924
|
+
for (var r = e >> 1, n = r + t / 2; !(r >= n) && I[r]; ) ++r;
|
|
925
|
+
if (r <<= 1, 32 < r - e && Jt) return Jt.decode(l.subarray(e, r));
|
|
926
|
+
for (r = "", n = 0; !(n >= t / 2); ++n) {
|
|
927
|
+
var s = E[e + 2 * n >> 1];
|
|
928
|
+
if (s == 0) break;
|
|
929
|
+
r += String.fromCharCode(s);
|
|
930
|
+
}
|
|
931
|
+
return r;
|
|
932
|
+
}, Lr = (e, t, r) => {
|
|
933
|
+
if (u(t % 2 == 0, "Pointer passed to stringToUTF16 must be aligned to two bytes!"), u(typeof r == "number", "stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"), r ??= 2147483647, 2 > r) return 0;
|
|
934
|
+
r -= 2;
|
|
935
|
+
var n = t;
|
|
936
|
+
r = r < 2 * e.length ? r / 2 : e.length;
|
|
937
|
+
for (var s = 0; s < r; ++s) E[t >> 1] = e.charCodeAt(s), t += 2;
|
|
938
|
+
return E[t >> 1] = 0, t - n;
|
|
939
|
+
}, Nr = (e) => 2 * e.length, Ur = (e, t) => {
|
|
940
|
+
u(e % 4 == 0, "Pointer passed to UTF32ToString must be aligned to four bytes!");
|
|
941
|
+
for (var r = 0, n = ""; !(r >= t / 4); ) {
|
|
942
|
+
var s = U[e + 4 * r >> 2];
|
|
943
|
+
if (s == 0) break;
|
|
944
|
+
++r, 65536 <= s ? (s -= 65536, n += String.fromCharCode(55296 | s >> 10, 56320 | s & 1023)) : n += String.fromCharCode(s);
|
|
945
|
+
}
|
|
946
|
+
return n;
|
|
947
|
+
}, jr = (e, t, r) => {
|
|
948
|
+
if (u(t % 4 == 0, "Pointer passed to stringToUTF32 must be aligned to four bytes!"), u(typeof r == "number", "stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"), r ??= 2147483647, 4 > r) return 0;
|
|
949
|
+
var n = t;
|
|
950
|
+
r = n + r - 4;
|
|
951
|
+
for (var s = 0; s < e.length; ++s) {
|
|
952
|
+
var y = e.charCodeAt(s);
|
|
953
|
+
if (55296 <= y && 57343 >= y) {
|
|
954
|
+
var x = e.charCodeAt(++s);
|
|
955
|
+
y = 65536 + ((y & 1023) << 10) | x & 1023;
|
|
956
|
+
}
|
|
957
|
+
if (U[t >> 2] = y, t += 4, t + 4 > r) break;
|
|
958
|
+
}
|
|
959
|
+
return U[t >> 2] = 0, t - n;
|
|
960
|
+
}, Wr = (e) => {
|
|
961
|
+
for (var t = 0, r = 0; r < e.length; ++r) {
|
|
962
|
+
var n = e.charCodeAt(r);
|
|
963
|
+
55296 <= n && 57343 >= n && ++r, t += 4;
|
|
964
|
+
}
|
|
965
|
+
return t;
|
|
966
|
+
}, De = 0, pt = [], Dr = (e) => {
|
|
967
|
+
var t = pt.length;
|
|
968
|
+
return pt.push(e), t;
|
|
969
|
+
}, Gr = (e, t) => {
|
|
970
|
+
for (var r = Array(e), n = 0; n < e; ++n) r[n] = gt(w[t + 4 * n >> 2], `parameter ${n}`);
|
|
971
|
+
return r;
|
|
972
|
+
}, zr = (e, t, r) => {
|
|
973
|
+
var n = [];
|
|
974
|
+
return e = e.toWireType(n, r), n.length && (w[t >> 2] = et(n)), e;
|
|
975
|
+
}, Ge = {}, Yt = (e) => {
|
|
976
|
+
if (!(e instanceof St || e == "unwind")) throw j(), e instanceof WebAssembly.RuntimeError && 0 >= rr() && g("Stack overflow detected. You can try increasing -sSTACK_SIZE (currently set to 65536)"), e;
|
|
977
|
+
}, Kt = (e) => {
|
|
978
|
+
throw S = e, Fe || 0 < De || (a.onExit?.(e), m = !0), new St(e);
|
|
979
|
+
}, Br = (e) => {
|
|
980
|
+
if (k || m) g("user callback triggered after runtime exited or application aborted. Ignoring.");
|
|
981
|
+
else try {
|
|
982
|
+
if (e(), !(k || Fe || 0 < De)) try {
|
|
983
|
+
if (S = e = S, Fe || 0 < De || (u(!k), j(), Jr(), Vr(0), wt[1].length && vt(1, 10), wt[2].length && vt(2, 10), k = !0), Fe || 0 < De) {
|
|
984
|
+
var t = `program exited (with status: ${e}), but keepRuntimeAlive() is set (counter=${De}) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`;
|
|
985
|
+
C(t), g(t);
|
|
986
|
+
}
|
|
987
|
+
Kt(e);
|
|
988
|
+
} catch (r) {
|
|
989
|
+
Yt(r);
|
|
990
|
+
}
|
|
991
|
+
} catch (r) {
|
|
992
|
+
Yt(r);
|
|
993
|
+
}
|
|
994
|
+
}, mt = {}, qt = () => {
|
|
995
|
+
if (!yt) {
|
|
996
|
+
var e = { USER: "web_user", LOGNAME: "web_user", PATH: "/", PWD: "/", HOME: "/home/web_user", LANG: (typeof navigator == "object" && navigator.languages && navigator.languages[0] || "C").replace("-", "_") + ".UTF-8", _: O || "./this.program" }, t;
|
|
997
|
+
for (t in mt) mt[t] === void 0 ? delete e[t] : e[t] = mt[t];
|
|
998
|
+
var r = [];
|
|
999
|
+
for (t in e) r.push(`${t}=${e[t]}`);
|
|
1000
|
+
yt = r;
|
|
1001
|
+
}
|
|
1002
|
+
return yt;
|
|
1003
|
+
}, yt, wt = [null, [], []], vt = (e, t) => {
|
|
1004
|
+
var r = wt[e];
|
|
1005
|
+
u(r), t === 0 || t === 10 ? ((e === 1 ? d : g)(Ct(r)), r.length = 0) : r.push(t);
|
|
1006
|
+
}, Xt = Array(256), rt = 0; 256 > rt; ++rt) Xt[rt] = String.fromCharCode(rt);
|
|
1007
|
+
Rt = Xt, (() => {
|
|
1008
|
+
let e = Ke.prototype;
|
|
1009
|
+
Object.assign(e, { isAliasOf: function(r) {
|
|
1010
|
+
if (!(this instanceof Ke && r instanceof Ke)) return !1;
|
|
1011
|
+
var n = this.g.j.h, s = this.g.i;
|
|
1012
|
+
r.g = r.g;
|
|
1013
|
+
var y = r.g.j.h;
|
|
1014
|
+
for (r = r.g.i; n.m; ) s = n.H(s), n = n.m;
|
|
1015
|
+
for (; y.m; ) r = y.H(r), y = y.m;
|
|
1016
|
+
return n === y && s === r;
|
|
1017
|
+
}, clone: function() {
|
|
1018
|
+
if (this.g.i || at(this), this.g.G) return this.g.count.value += 1, this;
|
|
1019
|
+
var r = He, n = Object, s = n.create, y = Object.getPrototypeOf(this), x = this.g;
|
|
1020
|
+
return r = r(s.call(n, y, { g: { value: { count: x.count, F: x.F, G: x.G, i: x.i, j: x.j, l: x.l, v: x.v } } })), r.g.count.value += 1, r.g.F = !1, r;
|
|
1021
|
+
}, delete() {
|
|
1022
|
+
if (this.g.i || at(this), this.g.F && !this.g.G) throw new z("Object already scheduled for deletion");
|
|
1023
|
+
Ft(this);
|
|
1024
|
+
var r = this.g;
|
|
1025
|
+
--r.count.value, r.count.value === 0 && (r.l ? r.v.B(r.l) : r.j.h.B(r.i)), this.g.G || (this.g.l = void 0, this.g.i = void 0);
|
|
1026
|
+
}, isDeleted: function() {
|
|
1027
|
+
return !this.g.i;
|
|
1028
|
+
}, deleteLater: function() {
|
|
1029
|
+
if (this.g.i || at(this), this.g.F && !this.g.G) throw new z("Object already scheduled for deletion");
|
|
1030
|
+
return this.g.F = !0, this;
|
|
1031
|
+
} });
|
|
1032
|
+
let t = Symbol.dispose;
|
|
1033
|
+
t && (e[t] = e.delete);
|
|
1034
|
+
})(), Object.assign(Qe.prototype, { U(e) {
|
|
1035
|
+
return this.O && (e = this.O(e)), e;
|
|
1036
|
+
}, N(e) {
|
|
1037
|
+
this.B?.(e);
|
|
1038
|
+
}, o: 8, readValueFromPointer: Ze, fromWireType: Ut }), ge.push(0, 1, void 0, 1, null, 1, !0, 1, !1, 1), u(ge.length === 10), a.count_emval_handles = () => ge.length / 2 - 5 - dt.length, a.noExitRuntime && (Fe = a.noExitRuntime), a.print && (d = a.print), a.printErr && (g = a.printErr), a.wasmBinary && (p = a.wasmBinary), a.FS_createDataFile = function() {
|
|
1039
|
+
he();
|
|
1040
|
+
}, a.FS_createPreloadedFile = function() {
|
|
1041
|
+
he();
|
|
1042
|
+
}, Object.getOwnPropertyDescriptor(a, "fetchSettings") && Z("`Module.fetchSettings` was supplied but `fetchSettings` not included in INCOMING_MODULE_JS_API"), a.thisProgram && (O = a.thisProgram), u(typeof a.memoryInitializerPrefixURL > "u", "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"), u(typeof a.pthreadMainPrefixURL > "u", "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"), u(typeof a.cdInitializerPrefixURL > "u", "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"), u(typeof a.filePackagePrefixURL > "u", "Module.filePackagePrefixURL option was removed, use Module.locateFile instead"), u(typeof a.read > "u", "Module.read option was removed"), u(typeof a.readAsync > "u", "Module.readAsync option was removed (modify readAsync in JS)"), u(typeof a.readBinary > "u", "Module.readBinary option was removed (modify readBinary in JS)"), u(typeof a.setWindowTitle > "u", "Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)"), u(typeof a.TOTAL_MEMORY > "u", "Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"), u(typeof a.ENVIRONMENT > "u", "Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)"), u(typeof a.STACK_SIZE > "u", "STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time"), u(typeof a.wasmMemory > "u", "Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"), u(typeof a.INITIAL_MEMORY > "u", "Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically"), "writeI53ToI64 writeI53ToI64Clamped writeI53ToI64Signaling writeI53ToU64Clamped writeI53ToU64Signaling readI53FromI64 readI53FromU64 convertI32PairToI53 convertI32PairToI53Checked convertU32PairToI53 getTempRet0 setTempRet0 zeroMemory strError inetPton4 inetNtop4 inetPton6 inetNtop6 readSockaddr writeSockaddr emscriptenLog readEmAsmArgs jstoi_q listenOnce autoResumeAudioContext getDynCaller dynCall runtimeKeepalivePush runtimeKeepalivePop asmjsMangle asyncLoad mmapAlloc HandleAllocator getNativeTypeSize addOnInit addOnPostCtor addOnPreMain addOnExit STACK_SIZE STACK_ALIGN POINTER_SIZE ASSERTIONS getCFunc ccall cwrap uleb128Encode sigToWasmTypes generateFuncType convertJsFunctionToWasm getEmptyTableSlot updateTableMap getFunctionAddress addFunction removeFunction reallyNegative unSign strLen reSign formatString intArrayFromString intArrayToString AsciiToString stringToAscii stringToNewUTF8 stringToUTF8OnStack writeArrayToMemory registerKeyEventCallback maybeCStringToJsString findEventTarget getBoundingClientRect fillMouseEventData registerMouseEventCallback registerWheelEventCallback registerUiEventCallback registerFocusEventCallback fillDeviceOrientationEventData registerDeviceOrientationEventCallback fillDeviceMotionEventData registerDeviceMotionEventCallback screenOrientation fillOrientationChangeEventData registerOrientationChangeEventCallback fillFullscreenChangeEventData registerFullscreenChangeEventCallback JSEvents_requestFullscreen JSEvents_resizeCanvasForFullscreen registerRestoreOldStyle hideEverythingExceptGivenElement restoreHiddenElements setLetterbox softFullscreenResizeWebGLRenderTarget doRequestFullscreen fillPointerlockChangeEventData registerPointerlockChangeEventCallback registerPointerlockErrorEventCallback requestPointerLock fillVisibilityChangeEventData registerVisibilityChangeEventCallback registerTouchEventCallback fillGamepadEventData registerGamepadEventCallback registerBeforeUnloadEventCallback fillBatteryEventData battery registerBatteryEventCallback setCanvasElementSize getCanvasElementSize jsStackTrace getCallstack convertPCtoSourceLocation wasiRightsToMuslOFlags wasiOFlagsToMuslOFlags initRandomFill randomFill safeSetTimeout setImmediateWrapped safeRequestAnimationFrame clearImmediateWrapped registerPostMainLoop registerPreMainLoop getPromise makePromise idsToPromises makePromiseCallback Browser_asyncPrepareDataCounter isLeapYear ydayFromDate arraySum addDays getSocketFromFD getSocketAddress heapObjectForWebGLType toTypedArrayIndex webgl_enable_ANGLE_instanced_arrays webgl_enable_OES_vertex_array_object webgl_enable_WEBGL_draw_buffers webgl_enable_WEBGL_multi_draw webgl_enable_EXT_polygon_offset_clamp webgl_enable_EXT_clip_control webgl_enable_WEBGL_polygon_mode emscriptenWebGLGet computeUnpackAlignedImageSize colorChannelsInGlTextureFormat emscriptenWebGLGetTexPixelData emscriptenWebGLGetUniform webglGetUniformLocation webglPrepareUniformLocationsBeforeFirstUse webglGetLeftBracePos emscriptenWebGLGetVertexAttrib __glGetActiveAttribOrUniform writeGLArray registerWebGlEventCallback runAndAbortIfError ALLOC_NORMAL ALLOC_STACK allocate writeStringToMemory writeAsciiToMemory demangle stackTrace getFunctionArgsName createJsInvokerSignature PureVirtualError registerInheritedInstance unregisterInheritedInstance getInheritedInstanceCount getLiveInheritedInstances setDelayFunction getStringOrSymbol emval_get_global".split(" ").forEach(function(e) {
|
|
1043
|
+
V(e, () => {
|
|
1044
|
+
var t = `\`${e}\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`, r = e;
|
|
1045
|
+
r.startsWith("_") || (r = "$" + e), t += ` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${r}')`, se(e) && (t += ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"), ke(t);
|
|
1046
|
+
}), ue(e);
|
|
1047
|
+
}), "run addRunDependency removeRunDependency out err callMain abort wasmMemory wasmExports HEAPF32 HEAPF64 HEAP8 HEAPU8 HEAP16 HEAPU16 HEAP32 HEAPU32 HEAP64 HEAPU64 writeStackCookie checkStackCookie INT53_MAX INT53_MIN bigintToI53Checked stackSave stackRestore stackAlloc ptrToString exitJS getHeapMax growMemory ENV ERRNO_CODES DNS Protocols Sockets timers warnOnce readEmAsmArgsArray jstoi_s getExecutableName handleException keepRuntimeAlive callUserCallback maybeExit alignMemory wasmTable noExitRuntime addOnPreRun addOnPostRun freeTableIndexes functionsInTableMap setValue getValue PATH PATH_FS UTF8Decoder UTF8ArrayToString UTF8ToString stringToUTF8Array stringToUTF8 lengthBytesUTF8 UTF16Decoder UTF16ToString stringToUTF16 lengthBytesUTF16 UTF32ToString stringToUTF32 lengthBytesUTF32 JSEvents specialHTMLTargets findCanvasEventTarget currentFullscreenStrategy restoreOldWindowedStyle UNWIND_CACHE ExitStatus getEnvStrings checkWasiClock flush_NO_FILESYSTEM emSetImmediate emClearImmediate_deps emClearImmediate promiseMap getExceptionMessageCommon getCppExceptionTag getCppExceptionThrownObjectFromWebAssemblyException Browser getPreloadedImageData__data wget MONTH_DAYS_REGULAR MONTH_DAYS_LEAP MONTH_DAYS_REGULAR_CUMULATIVE MONTH_DAYS_LEAP_CUMULATIVE SYSCALLS tempFixedLengthArray miniTempWebGLFloatBuffers miniTempWebGLIntBuffers GL AL GLUT EGL GLEW IDBStore SDL SDL_gfx allocateUTF8 allocateUTF8OnStack print printErr InternalError BindingError throwInternalError throwBindingError registeredTypes awaitingDependencies typeDependencies tupleRegistrations structRegistrations sharedRegisterType whenDependentTypesAreResolved embind_charCodes embind_init_charCodes readLatin1String getTypeName getFunctionName heap32VectorToArray requireRegisteredType usesDestructorStack checkArgCount getRequiredArgCount createJsInvoker UnboundTypeError GenericWireTypeSize EmValType EmValOptionalType throwUnboundTypeError ensureOverloadTable exposePublicSymbol replacePublicSymbol createNamedFunction embindRepr registeredInstances getBasestPointer getInheritedInstance registeredPointers registerType integerReadValueFromPointer enumReadValueFromPointer floatReadValueFromPointer readPointer runDestructors craftInvokerFunction embind__requireFunction genericPointerToWireType constNoSmartPtrRawPointerToWireType nonConstNoSmartPtrRawPointerToWireType init_RegisteredPointer RegisteredPointer RegisteredPointer_fromWireType runDestructor releaseClassHandle finalizationRegistry detachFinalizer_deps detachFinalizer attachFinalizer makeClassHandle init_ClassHandle ClassHandle throwInstanceAlreadyDeleted deletionQueue flushPendingDeletes delayFunction RegisteredClass shallowCopyInternalPointer downcastPointer upcastPointer validateThis char_0 char_9 makeLegalFunctionName emval_freelist emval_handles emval_symbols init_emval count_emval_handles Emval emval_returnValue emval_lookupTypes emval_methodCallers emval_addMethodCaller reflectConstruct".split(" ").forEach(ue), a.getExceptionMessage = Ot, a.incrementExceptionRefcount = (e) => {
|
|
1048
|
+
e = it(e), Qr(e);
|
|
1049
|
+
}, a.decrementExceptionRefcount = (e) => {
|
|
1050
|
+
e = it(e), Zr(e);
|
|
1051
|
+
};
|
|
1052
|
+
var Zt = { __assert_fail: (e, t, r, n) => Z(`Assertion failed: ${Ne(e)}, at: ` + [t ? Ne(t) : "unknown filename", r, n ? Ne(n) : "unknown function"]), __throw_exception_with_stack_trace: (e) => {
|
|
1053
|
+
throw e = new WebAssembly.Exception(le.__cpp_exception, [e], { traceStack: !0 }), e.message = Ot(e), e;
|
|
1054
|
+
}, _abort_js: () => Z("native code called abort()"), _embind_register_bigint: (e, t, r, n, s) => {
|
|
1055
|
+
t = ae(t);
|
|
1056
|
+
var y = t.indexOf("u") != -1;
|
|
1057
|
+
y && (s = (1n << 64n) - 1n), fe(e, { name: t, fromWireType: (x) => x, toWireType: function(x, T) {
|
|
1058
|
+
if (typeof T != "bigint" && typeof T != "number") throw new TypeError(`Cannot convert "${Ie(T)}" to ${this.name}`);
|
|
1059
|
+
if (typeof T == "number" && (T = BigInt(T)), T < n || T > s) throw new TypeError(`Passing a number "${Ie(T)}" from JS side to C/C++ side to an argument of type "${t}", which is outside the valid range [${n}, ${s}]!`);
|
|
1060
|
+
return T;
|
|
1061
|
+
}, o: 8, readValueFromPointer: $t(t, r, !y), s: null });
|
|
1062
|
+
}, _embind_register_bool: (e, t, r, n) => {
|
|
1063
|
+
t = ae(t), fe(e, { name: t, fromWireType: function(s) {
|
|
1064
|
+
return !!s;
|
|
1065
|
+
}, toWireType: function(s, y) {
|
|
1066
|
+
return y ? r : n;
|
|
1067
|
+
}, o: 8, readValueFromPointer: function(s) {
|
|
1068
|
+
return this.fromWireType(l[s]);
|
|
1069
|
+
}, s: null });
|
|
1070
|
+
}, _embind_register_class: (e, t, r, n, s, y, x, T, R, F, P, B, K) => {
|
|
1071
|
+
P = ae(P), y = ve(s, y), T &&= ve(x, T), F &&= ve(R, F), K = ve(B, K);
|
|
1072
|
+
var X = Er(P);
|
|
1073
|
+
Wt(X, function() {
|
|
1074
|
+
je(`Cannot construct ${P} due to unbound types`, [n]);
|
|
1075
|
+
}), be([e, t, r], n ? [n] : [], (Q) => {
|
|
1076
|
+
if (Q = Q[0], n) var de = Q.h, Oe = de.A;
|
|
1077
|
+
else Oe = Ke.prototype;
|
|
1078
|
+
Q = qe(P, function(...xt) {
|
|
1079
|
+
if (Object.getPrototypeOf(this) !== Re) throw new z(`Use 'new' to construct ${P}`);
|
|
1080
|
+
if (pe.D === void 0) throw new z(`${P} has no accessible constructor`);
|
|
1081
|
+
var or = pe.D[xt.length];
|
|
1082
|
+
if (or === void 0) throw new z(`Tried to invoke ctor of ${P} with invalid number of parameters (${xt.length}) - expected (${Object.keys(pe.D).toString()}) parameters instead!`);
|
|
1083
|
+
return or.apply(this, xt);
|
|
1084
|
+
});
|
|
1085
|
+
var Re = Object.create(Oe, { constructor: { value: Q } });
|
|
1086
|
+
Q.prototype = Re;
|
|
1087
|
+
var pe = new Mr(P, Q, Re, K, de, y, T, F);
|
|
1088
|
+
if (pe.m) {
|
|
1089
|
+
var Pe;
|
|
1090
|
+
(Pe = pe.m).I ?? (Pe.I = []), pe.m.I.push(pe);
|
|
1091
|
+
}
|
|
1092
|
+
return de = new Qe(P, pe, !0, !1, !1), Pe = new Qe(P + "*", pe, !1, !1, !1), Oe = new Qe(P + " const*", pe, !1, !0, !1), Nt[e] = { pointerType: Pe, P: Oe }, Pr(X, Q), [de, Pe, Oe];
|
|
1093
|
+
});
|
|
1094
|
+
}, _embind_register_class_class_function: (e, t, r, n, s, y, x, T) => {
|
|
1095
|
+
var R = ut(r, n);
|
|
1096
|
+
t = ae(t), t = Bt(t), y = ve(s, y, T), be([], [e], (F) => {
|
|
1097
|
+
function P() {
|
|
1098
|
+
je(`Cannot call ${B} due to unbound types`, R);
|
|
1099
|
+
}
|
|
1100
|
+
F = F[0];
|
|
1101
|
+
var B = `${F.name}.${t}`;
|
|
1102
|
+
t.startsWith("@@") && (t = Symbol[t.substring(2)]);
|
|
1103
|
+
var K = F.h.constructor;
|
|
1104
|
+
return K[t] === void 0 ? (P.C = r - 1, K[t] = P) : (jt(K, t, B), K[t].u[r - 1] = P), be([], R, (X) => {
|
|
1105
|
+
if (X = lt(B, [X[0], null].concat(X.slice(1)), null, y, x, T), K[t].u === void 0 ? (X.C = r - 1, K[t] = X) : K[t].u[r - 1] = X, F.h.I) for (let Q of F.h.I) Q.constructor.hasOwnProperty(t) || (Q.constructor[t] = X);
|
|
1106
|
+
return [];
|
|
1107
|
+
}), [];
|
|
1108
|
+
});
|
|
1109
|
+
}, _embind_register_class_constructor: (e, t, r, n, s, y) => {
|
|
1110
|
+
u(0 < t);
|
|
1111
|
+
var x = ut(t, r);
|
|
1112
|
+
s = ve(n, s), be([], [e], (T) => {
|
|
1113
|
+
T = T[0];
|
|
1114
|
+
var R = `constructor ${T.name}`;
|
|
1115
|
+
if (T.h.D === void 0 && (T.h.D = []), T.h.D[t - 1] !== void 0) throw new z(`Cannot register multiple constructors with identical number of parameters (${t - 1}) for class '${T.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);
|
|
1116
|
+
return T.h.D[t - 1] = () => {
|
|
1117
|
+
je(`Cannot construct ${T.name} due to unbound types`, x);
|
|
1118
|
+
}, be([], x, (F) => (F.splice(1, 0, null), T.h.D[t - 1] = lt(R, F, null, s, y), [])), [];
|
|
1119
|
+
});
|
|
1120
|
+
}, _embind_register_class_function: (e, t, r, n, s, y, x, T, R) => {
|
|
1121
|
+
var F = ut(r, n);
|
|
1122
|
+
t = ae(t), t = Bt(t), y = ve(s, y, R), be([], [e], (P) => {
|
|
1123
|
+
function B() {
|
|
1124
|
+
je(`Cannot call ${K} due to unbound types`, F);
|
|
1125
|
+
}
|
|
1126
|
+
P = P[0];
|
|
1127
|
+
var K = `${P.name}.${t}`;
|
|
1128
|
+
t.startsWith("@@") && (t = Symbol[t.substring(2)]), T && P.h.Z.push(t);
|
|
1129
|
+
var X = P.h.A, Q = X[t];
|
|
1130
|
+
return Q === void 0 || Q.u === void 0 && Q.className !== P.name && Q.C === r - 2 ? (B.C = r - 2, B.className = P.name, X[t] = B) : (jt(X, t, K), X[t].u[r - 2] = B), be([], F, (de) => (de = lt(K, de, P, y, x, R), X[t].u === void 0 ? (de.C = r - 2, X[t] = de) : X[t].u[r - 2] = de, [])), [];
|
|
1131
|
+
});
|
|
1132
|
+
}, _embind_register_class_property: (e, t, r, n, s, y, x, T, R, F) => {
|
|
1133
|
+
t = ae(t), s = ve(n, s), be([], [e], (P) => {
|
|
1134
|
+
P = P[0];
|
|
1135
|
+
var B = `${P.name}.${t}`, K = { get() {
|
|
1136
|
+
je(`Cannot access ${B} due to unbound types`, [r, x]);
|
|
1137
|
+
}, enumerable: !0, configurable: !0 };
|
|
1138
|
+
return K.set = R ? () => je(`Cannot access ${B} due to unbound types`, [r, x]) : () => {
|
|
1139
|
+
throw new z(B + " is a read-only property");
|
|
1140
|
+
}, Object.defineProperty(P.h.A, t, K), be([], R ? [r, x] : [r], (X) => {
|
|
1141
|
+
var Q = X[0], de = { get() {
|
|
1142
|
+
var Re = Ht(this, P, B + " getter");
|
|
1143
|
+
return Q.fromWireType(s(y, Re));
|
|
1144
|
+
}, enumerable: !0 };
|
|
1145
|
+
if (R) {
|
|
1146
|
+
R = ve(T, R);
|
|
1147
|
+
var Oe = X[1];
|
|
1148
|
+
de.set = function(Re) {
|
|
1149
|
+
var pe = Ht(this, P, B + " setter"), Pe = [];
|
|
1150
|
+
R(F, pe, Oe.toWireType(Pe, Re)), ct(Pe);
|
|
1151
|
+
};
|
|
1152
|
+
}
|
|
1153
|
+
return Object.defineProperty(P.h.A, t, de), [];
|
|
1154
|
+
}), [];
|
|
1155
|
+
});
|
|
1156
|
+
}, _embind_register_emval: (e) => fe(e, Vt), _embind_register_enum: (e, t, r, n) => {
|
|
1157
|
+
function s() {
|
|
1158
|
+
}
|
|
1159
|
+
t = ae(t), s.values = {}, fe(e, { name: t, constructor: s, fromWireType: function(y) {
|
|
1160
|
+
return this.constructor.values[y];
|
|
1161
|
+
}, toWireType: (y, x) => x.value, o: 8, readValueFromPointer: Or(t, r, n), s: null }), Wt(t, s);
|
|
1162
|
+
}, _embind_register_enum_value: (e, t, r) => {
|
|
1163
|
+
var n = gt(e, "enum");
|
|
1164
|
+
t = ae(t), e = n.constructor, n = Object.create(n.constructor.prototype, { value: { value: r }, constructor: { value: qe(`${n.name}_${t}`, function() {
|
|
1165
|
+
}) } }), e.values[r] = n, e[t] = n;
|
|
1166
|
+
}, _embind_register_float: (e, t, r) => {
|
|
1167
|
+
t = ae(t), fe(e, { name: t, fromWireType: (n) => n, toWireType: (n, s) => {
|
|
1168
|
+
if (typeof s != "number" && typeof s != "boolean") throw new TypeError(`Cannot convert ${Ie(s)} to ${this.name}`);
|
|
1169
|
+
return s;
|
|
1170
|
+
}, o: 8, readValueFromPointer: Rr(t, r), s: null });
|
|
1171
|
+
}, _embind_register_integer: (e, t, r, n, s) => {
|
|
1172
|
+
t = ae(t), s === -1 && (s = 4294967295);
|
|
1173
|
+
var y = (F) => F;
|
|
1174
|
+
if (n === 0) {
|
|
1175
|
+
var x = 32 - 8 * r;
|
|
1176
|
+
y = (F) => F << x >>> x;
|
|
1177
|
+
}
|
|
1178
|
+
var T = (F, P) => {
|
|
1179
|
+
if (typeof F != "number" && typeof F != "boolean") throw new TypeError(`Cannot convert "${Ie(F)}" to ${P}`);
|
|
1180
|
+
if (F < n || F > s) throw new TypeError(`Passing a number "${Ie(F)}" from JS side to C/C++ side to an argument of type "${t}", which is outside the valid range [${n}, ${s}]!`);
|
|
1181
|
+
}, R = t.includes("unsigned") ? function(F, P) {
|
|
1182
|
+
return T(P, this.name), P >>> 0;
|
|
1183
|
+
} : function(F, P) {
|
|
1184
|
+
return T(P, this.name), P;
|
|
1185
|
+
};
|
|
1186
|
+
fe(e, { name: t, fromWireType: y, toWireType: R, o: 8, readValueFromPointer: $t(t, r, n !== 0), s: null });
|
|
1187
|
+
}, _embind_register_memory_view: (e, t, r) => {
|
|
1188
|
+
function n(y) {
|
|
1189
|
+
return new s(b.buffer, w[y + 4 >> 2], w[y >> 2]);
|
|
1190
|
+
}
|
|
1191
|
+
var s = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array, BigInt64Array, BigUint64Array][t];
|
|
1192
|
+
r = ae(r), fe(e, { name: r, fromWireType: n, o: 8, readValueFromPointer: n }, { V: !0 });
|
|
1193
|
+
}, _embind_register_optional: (e) => {
|
|
1194
|
+
fe(e, $r);
|
|
1195
|
+
}, _embind_register_std_string: (e, t) => {
|
|
1196
|
+
t = ae(t), fe(e, { name: t, fromWireType: function(r) {
|
|
1197
|
+
for (var n = w[r >> 2], s = r + 4, y, x = s, T = 0; T <= n; ++T) {
|
|
1198
|
+
var R = s + T;
|
|
1199
|
+
(T == n || l[R] == 0) && (x = Ne(x, R - x), y === void 0 ? y = x : (y += "\0", y += x), x = R + 1);
|
|
1200
|
+
}
|
|
1201
|
+
return xe(r), y;
|
|
1202
|
+
}, toWireType: function(r, n) {
|
|
1203
|
+
n instanceof ArrayBuffer && (n = new Uint8Array(n));
|
|
1204
|
+
var s = typeof n == "string";
|
|
1205
|
+
if (!(s || ArrayBuffer.isView(n) && n.BYTES_PER_ELEMENT == 1)) throw new z("Cannot pass non-string to std::string");
|
|
1206
|
+
var y = s ? tt(n) : n.length, x = Qt(4 + y + 1), T = x + 4;
|
|
1207
|
+
return w[x >> 2] = y, s ? We(n, T, y + 1) : l.set(n, T), r !== null && r.push(xe, x), x;
|
|
1208
|
+
}, o: 8, readValueFromPointer: Ze, s(r) {
|
|
1209
|
+
xe(r);
|
|
1210
|
+
} });
|
|
1211
|
+
}, _embind_register_std_wstring: (e, t, r) => {
|
|
1212
|
+
if (r = ae(r), t === 2) var n = Fr, s = Lr, y = Nr, x = (T) => I[T >> 1];
|
|
1213
|
+
else t === 4 && (n = Ur, s = jr, y = Wr, x = (T) => w[T >> 2]);
|
|
1214
|
+
fe(e, { name: r, fromWireType: (T) => {
|
|
1215
|
+
for (var R = w[T >> 2], F, P = T + 4, B = 0; B <= R; ++B) {
|
|
1216
|
+
var K = T + 4 + B * t;
|
|
1217
|
+
(B == R || x(K) == 0) && (P = n(P, K - P), F === void 0 ? F = P : (F += "\0", F += P), P = K + t);
|
|
1218
|
+
}
|
|
1219
|
+
return xe(T), F;
|
|
1220
|
+
}, toWireType: (T, R) => {
|
|
1221
|
+
if (typeof R != "string") throw new z(`Cannot pass non-string to C++ string type ${r}`);
|
|
1222
|
+
var F = y(R), P = Qt(4 + F + t);
|
|
1223
|
+
return w[P >> 2] = F / t, s(R, P + 4, F + t), T !== null && T.push(xe, P), P;
|
|
1224
|
+
}, o: 8, readValueFromPointer: Ze, s(T) {
|
|
1225
|
+
xe(T);
|
|
1226
|
+
} });
|
|
1227
|
+
}, _embind_register_void: (e, t) => {
|
|
1228
|
+
t = ae(t), fe(e, { W: !0, name: t, o: 0, fromWireType: () => {
|
|
1229
|
+
}, toWireType: () => {
|
|
1230
|
+
} });
|
|
1231
|
+
}, _emscripten_runtime_keepalive_clear: () => {
|
|
1232
|
+
Fe = !1, De = 0;
|
|
1233
|
+
}, _emval_call: (e, t, r, n) => (e = pt[e], t = ft(t), e(null, t, r, n)), _emval_decref: ht, _emval_get_method_caller: (e, t, r) => {
|
|
1234
|
+
t = Gr(e, t);
|
|
1235
|
+
var n = t.shift();
|
|
1236
|
+
e--;
|
|
1237
|
+
var s = `return function (obj, func, destructorsRef, args) {
|
|
1238
|
+
`, y = 0, x = [];
|
|
1239
|
+
r === 0 && x.push("obj");
|
|
1240
|
+
for (var T = ["retType"], R = [n], F = 0; F < e; ++F) x.push(`arg${F}`), T.push(`argType${F}`), R.push(t[F]), s += ` var arg${F} = argType${F}.readValueFromPointer(args${y ? "+" + y : ""});
|
|
1241
|
+
`, y += t[F].o;
|
|
1242
|
+
return s += ` var rv = ${r === 1 ? "new func" : "func.call"}(${x.join(", ")});
|
|
1243
|
+
`, n.W || (T.push("emval_returnValue"), R.push(zr), s += ` return emval_returnValue(retType, destructorsRef, rv);
|
|
1244
|
+
`), e = new Function(...T, s + `};
|
|
1245
|
+
`)(...R), r = `methodCaller<(${t.map((P) => P.name).join(", ")}) => ${n.name}>`, Dr(qe(r, e));
|
|
1246
|
+
}, _emval_incref: (e) => {
|
|
1247
|
+
9 < e && (ge[e + 1] += 1);
|
|
1248
|
+
}, _emval_run_destructors: (e) => {
|
|
1249
|
+
var t = ft(e);
|
|
1250
|
+
ct(t), ht(e);
|
|
1251
|
+
}, _emval_take_value: (e, t) => (e = gt(e, "_emval_take_value"), e = e.readValueFromPointer(t), et(e)), _setitimer_js: (e, t) => {
|
|
1252
|
+
if (Ge[e] && (clearTimeout(Ge[e].id), delete Ge[e]), !t) return 0;
|
|
1253
|
+
var r = setTimeout(() => {
|
|
1254
|
+
u(e in Ge), delete Ge[e], Br(() => Yr(e, performance.now()));
|
|
1255
|
+
}, t);
|
|
1256
|
+
return Ge[e] = { id: r, da: t }, 0;
|
|
1257
|
+
}, _tzset_js: (e, t, r, n) => {
|
|
1258
|
+
var s = (/* @__PURE__ */ new Date()).getFullYear(), y = new Date(s, 0, 1).getTimezoneOffset();
|
|
1259
|
+
s = new Date(s, 6, 1).getTimezoneOffset(), w[e >> 2] = 60 * Math.max(y, s), U[t >> 2] = +(y != s), t = (x) => {
|
|
1260
|
+
var T = Math.abs(x);
|
|
1261
|
+
return `UTC${0 <= x ? "-" : "+"}${String(Math.floor(T / 60)).padStart(2, "0")}${String(T % 60).padStart(2, "0")}`;
|
|
1262
|
+
}, e = t(y), t = t(s), u(e), u(t), u(16 >= tt(e), `timezone name truncated to fit in TZNAME_MAX (${e})`), u(16 >= tt(t), `timezone name truncated to fit in TZNAME_MAX (${t})`), s < y ? (We(e, r, 17), We(t, n, 17)) : (We(e, n, 17), We(t, r, 17));
|
|
1263
|
+
}, clock_time_get: function(e, t, r) {
|
|
1264
|
+
return 0 <= e && 3 >= e ? (G[r >> 3] = BigInt(Math.round(1e6 * (e === 0 ? Date.now() : performance.now()))), 0) : 28;
|
|
1265
|
+
}, emscripten_resize_heap: (e) => {
|
|
1266
|
+
var t = l.length;
|
|
1267
|
+
if (e >>>= 0, u(e > t), 2147483648 < e) return g(`Cannot enlarge memory, requested ${e} bytes, but the limit is ${2147483648} bytes!`), !1;
|
|
1268
|
+
for (var r = 1; 4 >= r; r *= 2) {
|
|
1269
|
+
var n = t * (1 + 0.2 / r);
|
|
1270
|
+
n = Math.min(n, e + 100663296);
|
|
1271
|
+
var s = Math, y = s.min;
|
|
1272
|
+
n = Math.max(e, n), u(65536, "alignment argument is required"), s = y.call(s, 2147483648, 65536 * Math.ceil(n / 65536));
|
|
1273
|
+
e: {
|
|
1274
|
+
y = s, n = v.buffer;
|
|
1275
|
+
var x = (y - n.byteLength + 65535) / 65536 | 0;
|
|
1276
|
+
try {
|
|
1277
|
+
v.grow(x), Be();
|
|
1278
|
+
var T = 1;
|
|
1279
|
+
break e;
|
|
1280
|
+
} catch (R) {
|
|
1281
|
+
g(`growMemory: Attempted to grow heap from ${n.byteLength} bytes to ${y} bytes, but got error: ${R}`);
|
|
1282
|
+
}
|
|
1283
|
+
T = void 0;
|
|
1284
|
+
}
|
|
1285
|
+
if (T) return !0;
|
|
1286
|
+
}
|
|
1287
|
+
return g(`Failed to grow the heap from ${t} bytes to ${s} bytes, not enough memory!`), !1;
|
|
1288
|
+
}, environ_get: (e, t) => {
|
|
1289
|
+
var r = 0, n = 0, s;
|
|
1290
|
+
for (s of qt()) {
|
|
1291
|
+
var y = t + r;
|
|
1292
|
+
w[e + n >> 2] = y, r += We(s, y, 1 / 0) + 1, n += 4;
|
|
1293
|
+
}
|
|
1294
|
+
return 0;
|
|
1295
|
+
}, environ_sizes_get: (e, t) => {
|
|
1296
|
+
var r = qt();
|
|
1297
|
+
w[e >> 2] = r.length, e = 0;
|
|
1298
|
+
for (var n of r) e += tt(n) + 1;
|
|
1299
|
+
return w[t >> 2] = e, 0;
|
|
1300
|
+
}, fd_close: () => {
|
|
1301
|
+
Z("fd_close called without SYSCALLS_REQUIRE_FILESYSTEM");
|
|
1302
|
+
}, fd_seek: function() {
|
|
1303
|
+
return 70;
|
|
1304
|
+
}, fd_write: (e, t, r, n) => {
|
|
1305
|
+
for (var s = 0, y = 0; y < r; y++) {
|
|
1306
|
+
var x = w[t >> 2], T = w[t + 4 >> 2];
|
|
1307
|
+
t += 8;
|
|
1308
|
+
for (var R = 0; R < T; R++) vt(e, l[x + R]);
|
|
1309
|
+
s += T;
|
|
1310
|
+
}
|
|
1311
|
+
return w[n >> 2] = s, 0;
|
|
1312
|
+
}, proc_exit: Kt }, le = await (async function() {
|
|
1313
|
+
function e(y) {
|
|
1314
|
+
y = le = y.exports;
|
|
1315
|
+
var x = {};
|
|
1316
|
+
for (R in y) {
|
|
1317
|
+
var T = y[R];
|
|
1318
|
+
x[R] = typeof T == "function" ? ie(T) : T;
|
|
1319
|
+
}
|
|
1320
|
+
if (le = x, v = le.memory, u(v, "memory not found in wasm exports"), Be(), Ae = le.__indirect_function_table, u(Ae, "table not found in wasm exports"), Me(), we--, a.monitorRunDependencies?.(we), u(ce["wasm-instantiate"]), delete ce["wasm-instantiate"], we == 0 && (ne !== null && (clearInterval(ne), ne = null), J)) {
|
|
1321
|
+
var R = J;
|
|
1322
|
+
J = null, R();
|
|
1323
|
+
}
|
|
1324
|
+
return le;
|
|
1325
|
+
}
|
|
1326
|
+
function t(y) {
|
|
1327
|
+
return u(a === r, "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"), r = null, e(y.instance);
|
|
1328
|
+
}
|
|
1329
|
+
Te();
|
|
1330
|
+
var r = a, n = { env: Zt, wasi_snapshot_preview1: Zt };
|
|
1331
|
+
if (a.instantiateWasm) return new Promise((y, x) => {
|
|
1332
|
+
try {
|
|
1333
|
+
a.instantiateWasm(n, (T, R) => {
|
|
1334
|
+
y(e(T, R));
|
|
1335
|
+
});
|
|
1336
|
+
} catch (T) {
|
|
1337
|
+
g(`Module.instantiateWasm callback failed with error: ${T}`), x(T);
|
|
1338
|
+
}
|
|
1339
|
+
});
|
|
1340
|
+
Se ??= a.locateFile ? a.locateFile ? a.locateFile("libavoid.wasm", L) : L + "libavoid.wasm" : new URL("" + new URL("../libavoid.wasm?no-inline", import.meta.url).href, import.meta.url).href;
|
|
1341
|
+
try {
|
|
1342
|
+
var s = await wr(n);
|
|
1343
|
+
return t(s);
|
|
1344
|
+
} catch (y) {
|
|
1345
|
+
return C(y), Promise.reject(y);
|
|
1346
|
+
}
|
|
1347
|
+
})(), Hr = oe("__getTypeName", 1), Qt = oe("malloc", 1), xe = oe("free", 1), Vr = oe("fflush", 1), Jr = oe("__funcs_on_exit", 0), er = le.emscripten_stack_get_end, Yr = oe("_emscripten_timeout", 2), Kr = le.__trap, qr = le.emscripten_stack_init, Xr = le._emscripten_stack_restore, tr = le._emscripten_stack_alloc, rr = le.emscripten_stack_get_current, Zr = oe("__cxa_decrement_exception_refcount", 1), Qr = oe("__cxa_increment_exception_refcount", 1), en = oe("__thrown_object_from_unwind_exception", 1), tn = oe("__get_exception_message", 3), nr;
|
|
1348
|
+
function bt() {
|
|
1349
|
+
function e() {
|
|
1350
|
+
if (u(!nr), nr = !0, a.calledRun = !0, !m) {
|
|
1351
|
+
if (u(!h), h = !0, j(), le.__wasm_call_ctors(), f(a), a.onRuntimeInitialized?.(), H("onRuntimeInitialized"), u(!a._main, 'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'), j(), a.postRun) for (typeof a.postRun == "function" && (a.postRun = [a.postRun]); a.postRun.length; ) {
|
|
1352
|
+
var t = a.postRun.shift();
|
|
1353
|
+
It.push(t);
|
|
1354
|
+
}
|
|
1355
|
+
H("postRun"), kt(It);
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
if (0 < we) J = bt;
|
|
1359
|
+
else {
|
|
1360
|
+
if (qr(), N(), a.preRun) for (typeof a.preRun == "function" && (a.preRun = [a.preRun]); a.preRun.length; ) vr();
|
|
1361
|
+
H("preRun"), kt(Pt), 0 < we ? J = bt : (a.setStatus ? (a.setStatus("Running..."), setTimeout(() => {
|
|
1362
|
+
setTimeout(() => a.setStatus(""), 1), e();
|
|
1363
|
+
}, 1)) : e(), j());
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
if (a.preInit) for (typeof a.preInit == "function" && (a.preInit = [a.preInit]); 0 < a.preInit.length; ) a.preInit.shift()();
|
|
1367
|
+
H("preInit"), bt(), _ = M;
|
|
1368
|
+
for (let e of Object.keys(a)) e in c || Object.defineProperty(c, e, { configurable: !0, get() {
|
|
1369
|
+
Z(`Access to module property ('${e}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`);
|
|
1370
|
+
} });
|
|
1371
|
+
return _;
|
|
1372
|
+
};
|
|
1373
|
+
})(), un = ln, ar = cn(un), dn = "" + new URL("../libavoid.wasm?no-inline", import.meta.url).href;
|
|
1374
|
+
let sr;
|
|
1375
|
+
const cr = { NORTH: 1, SOUTH: 2, WEST: 4, EAST: 8 }, $e = ["NORTH", "EAST", "SOUTH", "WEST"], ye = (o) => o.delete();
|
|
1376
|
+
async function ot(o, c = {}) {
|
|
1377
|
+
const _ = c.edgeClearance ?? 4, a = c.edgeAnchorInset ?? 8;
|
|
1378
|
+
if (!Number.isFinite(a) || a < 0)
|
|
1379
|
+
throw new Error("Graph edge anchor inset must be finite and nonnegative");
|
|
1380
|
+
if (!Number.isFinite(_) || _ < 0)
|
|
1381
|
+
throw new Error("Graph edge clearance must be finite and nonnegative");
|
|
1382
|
+
if (c.routing === "none")
|
|
1383
|
+
return Tt({
|
|
1384
|
+
...o,
|
|
1385
|
+
edges: o.edges.map((g) => ({ ...g, sections: [] }))
|
|
1386
|
+
});
|
|
1387
|
+
if (!o.nodes.length) return o;
|
|
1388
|
+
if (!o.edges.length) return Tt(o);
|
|
1389
|
+
await (sr ??= ar.load(dn).catch((g) => {
|
|
1390
|
+
throw sr = void 0, g;
|
|
1391
|
+
}));
|
|
1392
|
+
const f = ar.getInstance(), C = new Map(o.nodes.map((g) => [g.id, g])), M = (g) => {
|
|
1393
|
+
const p = [];
|
|
1394
|
+
for (let v = C.get(g).parentId; v; v = C.get(v).parentId)
|
|
1395
|
+
p.push(v);
|
|
1396
|
+
return p;
|
|
1397
|
+
}, O = /* @__PURE__ */ new Map();
|
|
1398
|
+
for (const g of o.edges) {
|
|
1399
|
+
const p = /* @__PURE__ */ new Set([...M(g.source), ...M(g.target)]), v = JSON.stringify([...p].sort()), m = O.get(v) ?? { open: p, edges: [] };
|
|
1400
|
+
m.edges.push(g), O.set(v, m);
|
|
1401
|
+
}
|
|
1402
|
+
const L = /* @__PURE__ */ new Map(), W = /* @__PURE__ */ new Map();
|
|
1403
|
+
for (const { open: g, edges: p } of O.values()) {
|
|
1404
|
+
const v = new f.Router(2);
|
|
1405
|
+
try {
|
|
1406
|
+
v.setRoutingParameter(f.RoutingParameter.shapeBufferDistance, _), v.setRoutingParameter(f.RoutingParameter.idealNudgingDistance, 8), v.setRoutingParameter(f.RoutingParameter.crossingPenalty, 80), v.setRoutingParameter(f.RoutingParameter.fixedSharedPathPenalty, 120), v.setRoutingParameter(f.RoutingParameter.portDirectionPenalty, 0), v.setRoutingOption(
|
|
1407
|
+
f.RoutingOption.nudgeOrthogonalSegmentsConnectedToShapes,
|
|
1408
|
+
c.edgeAnchorInset === void 0 && !p.some((i) => i.sourcePort || i.targetPort || i.source === i.target)
|
|
1409
|
+
), v.setRoutingOption(f.RoutingOption.nudgeSharedPathsWithCommonEndPoint, !0), v.setRoutingOption(f.RoutingOption.penaliseOrthogonalSharedPathsAtConnEnds, !0);
|
|
1410
|
+
const m = new Map(
|
|
1411
|
+
o.nodes.filter((i) => !g.has(i.id) && M(i.id).every((h) => g.has(h))).map((i) => {
|
|
1412
|
+
const h = new f.Point(i.x, i.y), k = new f.Point(i.x + i.width, i.y + i.height), A = new f.Rectangle(h, k), N = new f.ShapeRef(v, A);
|
|
1413
|
+
return ye(h), ye(k), ye(A), [i.id, N];
|
|
1414
|
+
})
|
|
1415
|
+
), S = (i) => [i.source, i.target].sort().join("\0"), u = /* @__PURE__ */ new Map();
|
|
1416
|
+
for (const i of p)
|
|
1417
|
+
u.set(S(i), (u.get(S(i)) ?? 0) + 1);
|
|
1418
|
+
const b = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
|
|
1419
|
+
for (const i of p) {
|
|
1420
|
+
const h = S(i), k = b.get(h) ?? 0;
|
|
1421
|
+
b.set(h, k + 1), l.set(i.id, (k - (u.get(h) - 1) / 2) * 12);
|
|
1422
|
+
}
|
|
1423
|
+
let E = $e.length + 2;
|
|
1424
|
+
const I = /* @__PURE__ */ new Map(), U = (i, h) => Math.max(0, Math.min(1, i / h));
|
|
1425
|
+
for (const i of o.nodes) {
|
|
1426
|
+
const h = m.get(i.id);
|
|
1427
|
+
if (!h) continue;
|
|
1428
|
+
const k = (A, N, j, D, q) => {
|
|
1429
|
+
const H = new f.ShapeConnectionPin(
|
|
1430
|
+
h,
|
|
1431
|
+
A,
|
|
1432
|
+
U(N, i.width),
|
|
1433
|
+
U(j, i.height),
|
|
1434
|
+
!0,
|
|
1435
|
+
0,
|
|
1436
|
+
D
|
|
1437
|
+
);
|
|
1438
|
+
H.setExclusive(q), H.setConnectionCost(
|
|
1439
|
+
i.width / 2 + i.height / 2 - Math.abs(N - i.width / 2) - Math.abs(j - i.height / 2)
|
|
1440
|
+
);
|
|
1441
|
+
};
|
|
1442
|
+
for (const A of new Set(i.ports?.map((N) => N.side))) {
|
|
1443
|
+
const { x: N, y: j } = lr(i, A), D = $e.indexOf(A) + 2;
|
|
1444
|
+
k(D, N - i.x, j - i.y, cr[A], !1), I.set(
|
|
1445
|
+
JSON.stringify([
|
|
1446
|
+
i.id,
|
|
1447
|
+
U(N - i.x, i.width),
|
|
1448
|
+
U(j - i.y, i.height),
|
|
1449
|
+
A
|
|
1450
|
+
]),
|
|
1451
|
+
D
|
|
1452
|
+
);
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
const w = o.nodes.filter((i) => m.has(i.id));
|
|
1456
|
+
for (const i of p) W.set(i.id, w);
|
|
1457
|
+
const $ = (i, h, k, A, N, j = !1) => {
|
|
1458
|
+
const D = _ + 8, q = {
|
|
1459
|
+
left: Math.min(i.x, h.x) - D,
|
|
1460
|
+
right: Math.max(i.x + i.width, h.x + h.width) + D,
|
|
1461
|
+
top: Math.min(i.y, h.y) - D,
|
|
1462
|
+
bottom: Math.max(i.y + i.height, h.y + h.height) + D
|
|
1463
|
+
}, H = w.filter(
|
|
1464
|
+
(J) => J.x <= q.right && J.x + J.width >= q.left && J.y <= q.bottom && J.y + J.height >= q.top
|
|
1465
|
+
), se = m.get(i.id);
|
|
1466
|
+
if (se && k)
|
|
1467
|
+
return new f.ConnEnd(
|
|
1468
|
+
se,
|
|
1469
|
+
$e.indexOf(i.ports.find((J) => J.id === k).side) + 2
|
|
1470
|
+
);
|
|
1471
|
+
const V = k ? [
|
|
1472
|
+
{
|
|
1473
|
+
side: i.ports.find((J) => J.id === k).side,
|
|
1474
|
+
position: lr(i, i.ports.find((J) => J.id === k).side)
|
|
1475
|
+
}
|
|
1476
|
+
] : N ? [{ side: "EAST", position: N }] : (j ? [ur(i, h).source] : $e).flatMap((J) => {
|
|
1477
|
+
const ce = hn(i, J, h, A, a);
|
|
1478
|
+
if (j) return [{ side: J, position: ce }];
|
|
1479
|
+
const ne = J === "NORTH" || J === "SOUTH", Te = ne ? i.x : i.y, Z = ne ? i.width : i.height, he = Te + Math.min(a, Z / 4), oe = Te + Z - Math.min(a, Z / 4), Ee = [
|
|
1480
|
+
ne ? ce.x : ce.y,
|
|
1481
|
+
he,
|
|
1482
|
+
oe,
|
|
1483
|
+
...H.flatMap((ie) => {
|
|
1484
|
+
const Me = ne ? ie.x : ie.y, Se = Me + (ne ? ie.width : ie.height);
|
|
1485
|
+
return [Me - _, Se + _, Me - _ - 8, Se + _ + 8];
|
|
1486
|
+
}).filter((ie) => ie >= he && ie <= oe)
|
|
1487
|
+
];
|
|
1488
|
+
return [...new Set(Ee)].map((ie) => ({
|
|
1489
|
+
side: J,
|
|
1490
|
+
position: ne ? { x: ie, y: ce.y } : { x: ce.x, y: ie }
|
|
1491
|
+
}));
|
|
1492
|
+
});
|
|
1493
|
+
if (se) {
|
|
1494
|
+
const J = (Z, he) => JSON.stringify([
|
|
1495
|
+
i.id,
|
|
1496
|
+
U(he.x - i.x, i.width),
|
|
1497
|
+
U(he.y - i.y, i.height),
|
|
1498
|
+
Z
|
|
1499
|
+
]), ce = !!(k || N), ne = ce ? I.get(J(V[0].side, V[0].position)) : void 0;
|
|
1500
|
+
if (ne !== void 0) return new f.ConnEnd(se, ne);
|
|
1501
|
+
const Te = ce ? E++ : 1;
|
|
1502
|
+
for (const { side: Z, position: he } of V) {
|
|
1503
|
+
const oe = J(Z, he);
|
|
1504
|
+
if (I.has(oe)) continue;
|
|
1505
|
+
I.set(oe, Te);
|
|
1506
|
+
const Ee = he.x - i.x, ie = he.y - i.y, Me = new f.ShapeConnectionPin(
|
|
1507
|
+
se,
|
|
1508
|
+
Te,
|
|
1509
|
+
U(Ee, i.width),
|
|
1510
|
+
U(ie, i.height),
|
|
1511
|
+
!0,
|
|
1512
|
+
0,
|
|
1513
|
+
cr[Z]
|
|
1514
|
+
);
|
|
1515
|
+
Me.setExclusive(!ce), Me.setConnectionCost(
|
|
1516
|
+
i.width / 2 + i.height / 2 - Math.abs(Ee - i.width / 2) - Math.abs(ie - i.height / 2)
|
|
1517
|
+
);
|
|
1518
|
+
}
|
|
1519
|
+
return new f.ConnEnd(se, Te);
|
|
1520
|
+
}
|
|
1521
|
+
const me = ur(i, h).source, ue = V.find((J) => J.side === me)?.position ?? V[0].position, Be = new f.Point(ue.x, ue.y), we = new f.ConnEnd(Be);
|
|
1522
|
+
return ye(Be), we;
|
|
1523
|
+
}, G = (i) => +!!(i.sourcePort || i.targetPort || i.source === i.target || b.get([i.source, i.target].sort().join("\0")) > 1), te = [...p].sort((i, h) => G(h) - G(i)).map((i) => {
|
|
1524
|
+
const h = C.get(i.source), k = C.get(i.target), A = i.source === i.target, N = b.get([i.source, i.target].sort().join("\0")) > 1, j = $(
|
|
1525
|
+
h,
|
|
1526
|
+
k,
|
|
1527
|
+
i.sourcePort,
|
|
1528
|
+
l.get(i.id),
|
|
1529
|
+
A ? { x: h.x + h.width, y: h.y + h.height / 3 } : void 0,
|
|
1530
|
+
N
|
|
1531
|
+
), D = $(
|
|
1532
|
+
k,
|
|
1533
|
+
h,
|
|
1534
|
+
i.targetPort,
|
|
1535
|
+
l.get(i.id),
|
|
1536
|
+
A ? {
|
|
1537
|
+
x: k.x + k.width,
|
|
1538
|
+
y: k.y + k.height * 2 / 3
|
|
1539
|
+
} : void 0,
|
|
1540
|
+
N
|
|
1541
|
+
), q = new f.ConnRef(v, j, D);
|
|
1542
|
+
if (ye(j), ye(D), A) {
|
|
1543
|
+
const H = new f.CheckpointVector();
|
|
1544
|
+
for (const se of [
|
|
1545
|
+
h.y + h.height / 3,
|
|
1546
|
+
h.y + h.height * 2 / 3
|
|
1547
|
+
]) {
|
|
1548
|
+
const V = new f.Point(
|
|
1549
|
+
h.x + h.width + Math.max(24, _ + 4),
|
|
1550
|
+
se
|
|
1551
|
+
), me = new f.Checkpoint(V);
|
|
1552
|
+
H.push_back(me), ye(V), ye(me);
|
|
1553
|
+
}
|
|
1554
|
+
q.setRoutingCheckpoints(H), ye(H);
|
|
1555
|
+
}
|
|
1556
|
+
return { edge: i, connection: q };
|
|
1557
|
+
});
|
|
1558
|
+
v.processTransaction();
|
|
1559
|
+
for (const { edge: i, connection: h } of te) {
|
|
1560
|
+
const k = h.displayRoute(), A = Array.from({ length: k.size() }, (N, j) => {
|
|
1561
|
+
const D = k.at(j), q = { x: D.x, y: D.y };
|
|
1562
|
+
return ye(D), q;
|
|
1563
|
+
});
|
|
1564
|
+
if (ye(k), !h.hasValidRoute() || A.length < 2 || A.some((N) => !Number.isFinite(N.x) || !Number.isFinite(N.y)) || A.some((N, j) => j > 0 && N.x !== A[j - 1].x && N.y !== A[j - 1].y))
|
|
1565
|
+
throw new Error(`Graph edge cannot be routed: ${i.id}`);
|
|
1566
|
+
L.set(i.id, A);
|
|
1567
|
+
}
|
|
1568
|
+
} finally {
|
|
1569
|
+
v.delete();
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
const d = o.edges.map((g) => ({ ...g, sections: [L.get(g.id)] }));
|
|
1573
|
+
return sn({ ...o, edges: d }, W, _, a), Tt({
|
|
1574
|
+
nodes: o.nodes,
|
|
1575
|
+
edges: d,
|
|
1576
|
+
bounds: o.bounds
|
|
1577
|
+
});
|
|
1578
|
+
}
|
|
1579
|
+
function Tt(o) {
|
|
1580
|
+
const c = [
|
|
1581
|
+
...o.nodes.flatMap((f) => [
|
|
1582
|
+
{ x: f.x, y: f.y },
|
|
1583
|
+
{ x: f.x + f.width, y: f.y + f.height }
|
|
1584
|
+
]),
|
|
1585
|
+
...o.edges.flatMap((f) => f.sections.flat())
|
|
1586
|
+
];
|
|
1587
|
+
if (!c.length) return { ...o, bounds: { x: 0, y: 0, width: 0, height: 0 } };
|
|
1588
|
+
const _ = Math.min(...c.map((f) => f.x)), a = Math.min(...c.map((f) => f.y));
|
|
1589
|
+
return {
|
|
1590
|
+
nodes: o.nodes,
|
|
1591
|
+
edges: o.edges,
|
|
1592
|
+
bounds: {
|
|
1593
|
+
x: _,
|
|
1594
|
+
y: a,
|
|
1595
|
+
width: Math.max(...c.map((f) => f.x)) - _,
|
|
1596
|
+
height: Math.max(...c.map((f) => f.y)) - a
|
|
1597
|
+
}
|
|
1598
|
+
};
|
|
1599
|
+
}
|
|
1600
|
+
function lr(o, c) {
|
|
1601
|
+
return {
|
|
1602
|
+
x: c === "WEST" ? o.x : c === "EAST" ? o.x + o.width : o.x + o.width / 2,
|
|
1603
|
+
y: c === "NORTH" ? o.y : c === "SOUTH" ? o.y + o.height : o.y + o.height / 2
|
|
1604
|
+
};
|
|
1605
|
+
}
|
|
1606
|
+
function ur(o, c) {
|
|
1607
|
+
const _ = (d, g) => g.x >= d.x && g.y >= d.y && g.x + g.width <= d.x + d.width && g.y + g.height <= d.y + d.height, a = _(o, c) ? o : _(c, o) ? c : void 0;
|
|
1608
|
+
if (a) {
|
|
1609
|
+
const d = a === o ? c : o, g = {
|
|
1610
|
+
NORTH: d.y - a.y,
|
|
1611
|
+
EAST: a.x + a.width - d.x - d.width,
|
|
1612
|
+
SOUTH: a.y + a.height - d.y - d.height,
|
|
1613
|
+
WEST: d.x - a.x
|
|
1614
|
+
}, p = [...$e].sort((v, m) => g[v] - g[m])[0];
|
|
1615
|
+
return { source: p, target: p };
|
|
1616
|
+
}
|
|
1617
|
+
const f = c.x + c.width / 2 - (o.x + o.width / 2), C = c.y + c.height / 2 - (o.y + o.height / 2), M = Math.max(o.x - (c.x + c.width), c.x - (o.x + o.width), 0), O = Math.max(
|
|
1618
|
+
o.y - (c.y + c.height),
|
|
1619
|
+
c.y - (o.y + o.height),
|
|
1620
|
+
0
|
|
1621
|
+
), W = (O === 0 && M > 0 ? !0 : M === 0 && O > 0 ? !1 : M === 0 && O === 0 ? Math.abs(f) >= Math.abs(C) : M <= O) ? f >= 0 ? "EAST" : "WEST" : C >= 0 ? "SOUTH" : "NORTH";
|
|
1622
|
+
return { source: W, target: $e[($e.indexOf(W) + 2) % 4] };
|
|
1623
|
+
}
|
|
1624
|
+
function hn(o, c, _, a = 0, f = 8) {
|
|
1625
|
+
const C = (d) => Math.min(f, d / 4), M = (d, g, p) => Math.max(g + C(p), Math.min(g + p - C(p), d)), O = (d, g, p, v) => {
|
|
1626
|
+
const m = Math.max(d, p), S = Math.min(d + g, p + v);
|
|
1627
|
+
return m < S ? (m + S) / 2 + a : void 0;
|
|
1628
|
+
}, L = _.x + _.width / 2, W = _.y + _.height / 2;
|
|
1629
|
+
switch (c) {
|
|
1630
|
+
case "NORTH":
|
|
1631
|
+
return {
|
|
1632
|
+
x: M(
|
|
1633
|
+
O(o.x, o.width, _.x, _.width) ?? L + a,
|
|
1634
|
+
o.x,
|
|
1635
|
+
o.width
|
|
1636
|
+
),
|
|
1637
|
+
y: o.y
|
|
1638
|
+
};
|
|
1639
|
+
case "EAST":
|
|
1640
|
+
return {
|
|
1641
|
+
x: o.x + o.width,
|
|
1642
|
+
y: M(
|
|
1643
|
+
O(o.y, o.height, _.y, _.height) ?? W + a,
|
|
1644
|
+
o.y,
|
|
1645
|
+
o.height
|
|
1646
|
+
)
|
|
1647
|
+
};
|
|
1648
|
+
case "SOUTH":
|
|
1649
|
+
return {
|
|
1650
|
+
x: M(
|
|
1651
|
+
O(o.x, o.width, _.x, _.width) ?? L + a,
|
|
1652
|
+
o.x,
|
|
1653
|
+
o.width
|
|
1654
|
+
),
|
|
1655
|
+
y: o.y + o.height
|
|
1656
|
+
};
|
|
1657
|
+
case "WEST":
|
|
1658
|
+
return {
|
|
1659
|
+
x: o.x,
|
|
1660
|
+
y: M(
|
|
1661
|
+
O(o.y, o.height, _.y, _.height) ?? W + a,
|
|
1662
|
+
o.y,
|
|
1663
|
+
o.height
|
|
1664
|
+
)
|
|
1665
|
+
};
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
function fr(o, c, _, a, f, C = { x: 0, y: 0 }) {
|
|
1669
|
+
const M = c.flow === "row", O = c.maxPerLine ?? Math.max(1, o.length);
|
|
1670
|
+
let L = 0, W = 0;
|
|
1671
|
+
for (let d = 0; d < o.length; d += O) {
|
|
1672
|
+
const g = o.slice(d, d + O);
|
|
1673
|
+
let p = 0, v = 0;
|
|
1674
|
+
for (const m of g)
|
|
1675
|
+
f(
|
|
1676
|
+
m,
|
|
1677
|
+
C.x + _.left + (M ? p : L) - m.x,
|
|
1678
|
+
C.y + _.top + (M ? L : p) - m.y
|
|
1679
|
+
), p += (M ? m.width : m.height) + a, v = Math.max(v, M ? m.height : m.width);
|
|
1680
|
+
W = Math.max(W, p - a), L += v + a;
|
|
1681
|
+
}
|
|
1682
|
+
return L = Math.max(0, L - a), {
|
|
1683
|
+
width: _.left + (M ? W : L) + _.right,
|
|
1684
|
+
height: _.top + (M ? L : W) + _.bottom
|
|
1685
|
+
};
|
|
1686
|
+
}
|
|
1687
|
+
function gr(o, c, _) {
|
|
1688
|
+
if (!c.positions?.length || c.positionMode === "compact")
|
|
1689
|
+
return c.routing !== "none" && c.edgeClearance === void 0 && c.edgeAnchorInset === void 0 ? o : ot(o, c);
|
|
1690
|
+
const a = new Map(o.nodes.map((d) => [d.id, { ...d }])), f = /* @__PURE__ */ new Map();
|
|
1691
|
+
for (const d of c.positions) {
|
|
1692
|
+
if (!a.has(d.nodeId) || f.has(d.nodeId) || !Number.isFinite(d.x) || !Number.isFinite(d.y))
|
|
1693
|
+
throw new Error(`Invalid graph position: ${d.nodeId}`);
|
|
1694
|
+
f.set(d.nodeId, d);
|
|
1695
|
+
}
|
|
1696
|
+
const C = /* @__PURE__ */ new Map();
|
|
1697
|
+
for (const d of a.values())
|
|
1698
|
+
if (d.parentId) {
|
|
1699
|
+
const g = C.get(d.parentId) ?? [];
|
|
1700
|
+
g.push(d), C.set(d.parentId, g);
|
|
1701
|
+
}
|
|
1702
|
+
const M = c.groupPadding ?? { top: 64, left: 28, right: 28, bottom: 28 }, O = c.positionMode === "preferred" || c.positionMode === "compressed", L = new Map(_.map((d) => [d.id, d])), W = (d, g, p) => {
|
|
1703
|
+
const v = { x: d.x, y: d.y }, m = f.get(d.id);
|
|
1704
|
+
d.x = m?.x ?? d.x + g, d.y = m?.y ?? d.y + p;
|
|
1705
|
+
const S = C.get(d.id) ?? [];
|
|
1706
|
+
for (const I of S) W(I, d.x - v.x, d.y - v.y);
|
|
1707
|
+
if (!S.length || O) return;
|
|
1708
|
+
const u = Math.min(...S.map((I) => I.x)) - M.left, b = Math.min(...S.map((I) => I.y)) - M.top;
|
|
1709
|
+
if (m && (u < d.x || b < d.y))
|
|
1710
|
+
throw new Error(`Pinned child lies outside group content: ${d.id}`);
|
|
1711
|
+
const l = Math.max(
|
|
1712
|
+
d.x + d.width,
|
|
1713
|
+
...S.map((I) => I.x + I.width + M.right)
|
|
1714
|
+
), E = Math.max(
|
|
1715
|
+
d.y + d.height,
|
|
1716
|
+
...S.map((I) => I.y + I.height + M.bottom)
|
|
1717
|
+
);
|
|
1718
|
+
m || (d.x = Math.min(d.x, u), d.y = Math.min(d.y, b)), d.width = l - d.x, d.height = E - d.y;
|
|
1719
|
+
};
|
|
1720
|
+
for (const d of a.values()) d.parentId || W(d, 0, 0);
|
|
1721
|
+
if (O) {
|
|
1722
|
+
const d = Math.max(16, c.spacing ?? 64), g = (u, b, l) => {
|
|
1723
|
+
u.x += b, u.y += l;
|
|
1724
|
+
for (const E of C.get(u.id) ?? []) g(E, b, l);
|
|
1725
|
+
}, p = (u) => {
|
|
1726
|
+
if (c.positionMode === "compressed")
|
|
1727
|
+
for (const b of ["x", "y"]) {
|
|
1728
|
+
const l = b === "x" ? "width" : "height";
|
|
1729
|
+
let E = -1 / 0, I = 0;
|
|
1730
|
+
for (const U of [...u].sort((w, $) => w[b] - $[b])) {
|
|
1731
|
+
const w = U[b];
|
|
1732
|
+
Number.isFinite(E) && (I += Math.max(0, w - E - d)), E = Math.max(E, w + U[l]), g(U, b === "x" ? -I : 0, b === "y" ? -I : 0);
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
}, v = (u) => {
|
|
1736
|
+
const b = [];
|
|
1737
|
+
for (const l of [...u].sort(
|
|
1738
|
+
(E, I) => E.y - I.y || E.x - I.x || E.id.localeCompare(I.id)
|
|
1739
|
+
)) {
|
|
1740
|
+
const E = { x: l.x, y: l.y };
|
|
1741
|
+
for (const w of [...b].sort(($, G) => $.x - G.x))
|
|
1742
|
+
l.y < w.y + w.height + d && l.y + l.height + d > w.y && E.x < w.x + w.width + d && E.x + l.width + d > w.x && (E.x = w.x + w.width + d);
|
|
1743
|
+
const I = { x: l.x, y: l.y };
|
|
1744
|
+
for (const w of [...b].sort(($, G) => $.y - G.y))
|
|
1745
|
+
l.x < w.x + w.width + d && l.x + l.width + d > w.x && I.y < w.y + w.height + d && I.y + l.height + d > w.y && (I.y = w.y + w.height + d);
|
|
1746
|
+
const U = E.x - l.x < I.y - l.y ? E : I;
|
|
1747
|
+
g(l, U.x - l.x, U.y - l.y), b.push(l);
|
|
1748
|
+
}
|
|
1749
|
+
}, m = (u) => {
|
|
1750
|
+
const b = C.get(u.id) ?? [];
|
|
1751
|
+
if (!b.length) return;
|
|
1752
|
+
for (const G of b) m(G);
|
|
1753
|
+
const l = c.groupLayouts?.[u.id];
|
|
1754
|
+
if (l) {
|
|
1755
|
+
const G = fr(
|
|
1756
|
+
b,
|
|
1757
|
+
l,
|
|
1758
|
+
M,
|
|
1759
|
+
c.spacing ?? 64,
|
|
1760
|
+
g,
|
|
1761
|
+
u
|
|
1762
|
+
);
|
|
1763
|
+
u.width = Math.max(L.get(u.id).width, G.width), u.height = Math.max(L.get(u.id).height, G.height);
|
|
1764
|
+
return;
|
|
1765
|
+
}
|
|
1766
|
+
v(b), p(b);
|
|
1767
|
+
const E = Math.max(12, M.left), I = Math.max(12, M.top), U = Math.max(12, M.right), w = Math.max(12, M.bottom), $ = f.get(u.id);
|
|
1768
|
+
u.x = Math.min($?.x ?? 1 / 0, Math.min(...b.map((G) => G.x)) - E), u.y = Math.min($?.y ?? 1 / 0, Math.min(...b.map((G) => G.y)) - I), u.width = Math.max(
|
|
1769
|
+
L.get(u.id).width,
|
|
1770
|
+
Math.max(...b.map((G) => G.x + G.width)) + U - u.x
|
|
1771
|
+
), u.height = Math.max(
|
|
1772
|
+
L.get(u.id).height,
|
|
1773
|
+
Math.max(...b.map((G) => G.y + G.height)) + w - u.y
|
|
1774
|
+
);
|
|
1775
|
+
}, S = [...a.values()].filter((u) => !u.parentId);
|
|
1776
|
+
for (const u of S) m(u);
|
|
1777
|
+
v(S), p(S);
|
|
1778
|
+
}
|
|
1779
|
+
return ot({ ...o, nodes: [...a.values()] }, c);
|
|
1780
|
+
}
|
|
1781
|
+
async function fn(o, c, _) {
|
|
1782
|
+
const a = new Map(o.nodes.map((b) => [b.id, { ...b, x: 0, y: 0 }])), f = new Map(o.nodes.map((b, l) => [b.id, l])), C = /* @__PURE__ */ new Map();
|
|
1783
|
+
for (const b of a.values()) {
|
|
1784
|
+
const l = C.get(b.parentId) ?? [];
|
|
1785
|
+
l.push(b), C.set(b.parentId, l);
|
|
1786
|
+
}
|
|
1787
|
+
const M = /* @__PURE__ */ new Set([
|
|
1788
|
+
...o.nodes.flatMap((b) => [b.id, ...(b.ports ?? []).map((l) => l.id)]),
|
|
1789
|
+
...o.edges.map((b) => b.id)
|
|
1790
|
+
]);
|
|
1791
|
+
let O = "$packed";
|
|
1792
|
+
for (; M.has(O); ) O += "$";
|
|
1793
|
+
const L = c.groupPadding ?? { top: 64, right: 28, bottom: 28, left: 28 }, W = c.direction ?? "RIGHT", d = new Map(
|
|
1794
|
+
(c.positions ?? []).map((b) => [
|
|
1795
|
+
b.nodeId,
|
|
1796
|
+
W === "RIGHT" || W === "LEFT" ? b.y : b.x
|
|
1797
|
+
])
|
|
1798
|
+
), g = (b, l, E) => {
|
|
1799
|
+
b.x += l, b.y += E;
|
|
1800
|
+
for (const I of C.get(b.id) ?? []) g(I, l, E);
|
|
1801
|
+
}, p = (b, l) => {
|
|
1802
|
+
let E = a.get(b);
|
|
1803
|
+
for (; E && E.parentId !== l; )
|
|
1804
|
+
E = E.parentId ? a.get(E.parentId) : void 0;
|
|
1805
|
+
return E;
|
|
1806
|
+
}, v = async (b) => {
|
|
1807
|
+
const l = [...C.get(b) ?? []], E = b === void 0 ? void 0 : c.groupLayouts?.[b];
|
|
1808
|
+
!E && (b !== void 0 || !c.layers) && l.sort(
|
|
1809
|
+
(w, $) => (d.get(w.id) ?? 1 / 0) - (d.get($.id) ?? 1 / 0) || f.get(w.id) - f.get($.id)
|
|
1810
|
+
);
|
|
1811
|
+
for (const w of l) {
|
|
1812
|
+
if (!C.has(w.id)) continue;
|
|
1813
|
+
const $ = await v(w.id);
|
|
1814
|
+
w.width = Math.max(w.width, $.width), w.height = Math.max(w.height, $.height);
|
|
1815
|
+
}
|
|
1816
|
+
if (!l.length) return { width: 0, height: 0 };
|
|
1817
|
+
if (E) return fr(l, E, L, c.spacing ?? 64, g);
|
|
1818
|
+
if (b === void 0 && c.layers)
|
|
1819
|
+
return gn(l, o, c, p, g);
|
|
1820
|
+
const I = /* @__PURE__ */ new Map();
|
|
1821
|
+
for (const w of o.edges) {
|
|
1822
|
+
const $ = p(w.source, b), G = p(w.target, b);
|
|
1823
|
+
if (!$ || !G || $.id === G.id) continue;
|
|
1824
|
+
const te = JSON.stringify([$.id, G.id]);
|
|
1825
|
+
I.has(te) || I.set(te, { id: w.id, sources: [$.id], targets: [G.id] });
|
|
1826
|
+
}
|
|
1827
|
+
const U = await _.layout({
|
|
1828
|
+
id: b ?? O,
|
|
1829
|
+
children: l.map((w) => ({ id: w.id, width: w.width, height: w.height })),
|
|
1830
|
+
edges: [...I.values()],
|
|
1831
|
+
layoutOptions: {
|
|
1832
|
+
"elk.algorithm": I.size ? "layered" : "rectpacking",
|
|
1833
|
+
"elk.direction": W,
|
|
1834
|
+
"elk.edgeRouting": "ORTHOGONAL",
|
|
1835
|
+
"elk.separateConnectedComponents": "true",
|
|
1836
|
+
...c.aspectRatio !== void 0 ? { "elk.aspectRatio": String(c.aspectRatio) } : {},
|
|
1837
|
+
"elk.spacing.componentComponent": String(c.spacing ?? 64),
|
|
1838
|
+
"elk.spacing.nodeNode": String(c.spacing ?? 64),
|
|
1839
|
+
"elk.layered.spacing.nodeNodeBetweenLayers": String(c.spacing ?? 64),
|
|
1840
|
+
"elk.layered.considerModelOrder.strategy": "NODES",
|
|
1841
|
+
"elk.padding": b ? `[top=${L.top},left=${L.left},bottom=${L.bottom},right=${L.right}]` : "[top=12,left=12,bottom=12,right=12]",
|
|
1842
|
+
"elk.randomSeed": "1"
|
|
1843
|
+
}
|
|
1844
|
+
});
|
|
1845
|
+
for (const w of U.children ?? []) {
|
|
1846
|
+
const $ = a.get(w.id);
|
|
1847
|
+
g($, (w.x ?? 0) - $.x, (w.y ?? 0) - $.y);
|
|
1848
|
+
}
|
|
1849
|
+
return { width: U.width ?? 0, height: U.height ?? 0 };
|
|
1850
|
+
}, m = await v(), S = (!c.positions?.length || c.positionMode === "compact" || c.layers) && c.anchor && a.get(c.anchor.nodeId);
|
|
1851
|
+
if (S) {
|
|
1852
|
+
const b = c.anchor.position.x - S.x, l = c.anchor.position.y - S.y;
|
|
1853
|
+
for (const E of C.get(void 0) ?? []) g(E, b, l);
|
|
1854
|
+
}
|
|
1855
|
+
const u = {
|
|
1856
|
+
nodes: [...a.values()],
|
|
1857
|
+
edges: o.edges.map((b) => ({ ...b, sections: [] })),
|
|
1858
|
+
bounds: { x: 0, y: 0, ...m }
|
|
1859
|
+
};
|
|
1860
|
+
return c.positions?.length && c.positionMode !== "compact" && !c.layers ? gr(u, c, o.nodes) : ot(u, c);
|
|
1861
|
+
}
|
|
1862
|
+
function gn(o, c, _, a, f) {
|
|
1863
|
+
const C = _.direction ?? "RIGHT", M = C === "RIGHT" || C === "LEFT", O = C === "RIGHT" || C === "DOWN", L = new Map(o.map((i, h) => [i.id, h])), W = new Map(
|
|
1864
|
+
(_.positions ?? []).filter((i) => L.has(i.nodeId)).map((i) => [i.nodeId, M ? i.y : i.x])
|
|
1865
|
+
), d = (i, h) => L.get(i) - L.get(h) || i.localeCompare(h), g = (i, h) => (W.get(i) ?? 1 / 0) - (W.get(h) ?? 1 / 0) || d(i, h), p = new Map(o.map((i) => [i.id, /* @__PURE__ */ new Set()]));
|
|
1866
|
+
for (const i of c.edges) {
|
|
1867
|
+
const h = a(i.source, void 0)?.id, k = a(i.target, void 0)?.id;
|
|
1868
|
+
h && k && h !== k && (p.get(h)?.add(k), p.get(k)?.add(h));
|
|
1869
|
+
}
|
|
1870
|
+
const v = _.layers ?? [], m = /* @__PURE__ */ new Map();
|
|
1871
|
+
v.forEach((i, h) => i.forEach((k) => m.set(k, h)));
|
|
1872
|
+
const S = new Set(o.map((i) => i.id)), u = [];
|
|
1873
|
+
for (const i of [...S].sort(d)) {
|
|
1874
|
+
if (!S.has(i)) continue;
|
|
1875
|
+
const h = [], k = [i];
|
|
1876
|
+
S.delete(i);
|
|
1877
|
+
for (let A = 0; A < k.length; A++) {
|
|
1878
|
+
const N = k[A];
|
|
1879
|
+
h.push(N);
|
|
1880
|
+
for (const j of [...p.get(N)].sort(d))
|
|
1881
|
+
S.delete(j) && k.push(j);
|
|
1882
|
+
}
|
|
1883
|
+
u.push(h);
|
|
1884
|
+
}
|
|
1885
|
+
let b = v.length;
|
|
1886
|
+
for (const i of u) {
|
|
1887
|
+
const h = i.filter((N) => m.has(N));
|
|
1888
|
+
if (!h.length) {
|
|
1889
|
+
i.sort(d).forEach((N) => m.set(N, b)), b++;
|
|
1890
|
+
continue;
|
|
1891
|
+
}
|
|
1892
|
+
const k = /* @__PURE__ */ new Map(), A = [...h].sort((N, j) => m.get(N) - m.get(j) || d(N, j));
|
|
1893
|
+
for (const N of A) k.set(N, 0);
|
|
1894
|
+
for (let N = 0; N < A.length; N++) {
|
|
1895
|
+
const j = A[N];
|
|
1896
|
+
for (const D of [...p.get(j)].sort(d))
|
|
1897
|
+
k.has(D) || (k.set(D, k.get(j) + 1), m.set(D, m.get(j)), A.push(D));
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
const l = Math.max(v.length, b), E = Array.from({ length: l }, () => []);
|
|
1901
|
+
for (const i of o) E[m.get(i.id)].push(i);
|
|
1902
|
+
for (const i of E) i.sort((h, k) => g(h.id, k.id));
|
|
1903
|
+
const I = (i, h) => {
|
|
1904
|
+
const k = new Map(E[h].map((j, D) => [j.id, D])), A = new Map(E[i].map((j, D) => [j.id, D])), N = (j) => {
|
|
1905
|
+
const D = [...p.get(j) ?? []].flatMap((q) => {
|
|
1906
|
+
const H = k.get(q);
|
|
1907
|
+
return m.get(q) === h && H !== void 0 ? [H] : [];
|
|
1908
|
+
});
|
|
1909
|
+
return D.length ? D.reduce((q, H) => q + H, 0) / D.length : A.get(j);
|
|
1910
|
+
};
|
|
1911
|
+
E[i].sort((j, D) => N(j.id) - N(D.id) || g(j.id, D.id));
|
|
1912
|
+
};
|
|
1913
|
+
for (let i = 1; i < E.length; i++) I(i, i - 1);
|
|
1914
|
+
for (let i = E.length - 2; i >= 0; i--) I(i, i + 1);
|
|
1915
|
+
const U = _.spacing ?? 64;
|
|
1916
|
+
let w = 0, $ = 0;
|
|
1917
|
+
const G = [], te = [];
|
|
1918
|
+
for (const i of E) {
|
|
1919
|
+
let h = 0;
|
|
1920
|
+
const k = Math.max(0, ...i.map((A) => M ? A.width : A.height));
|
|
1921
|
+
G.push(w), te.push(k);
|
|
1922
|
+
for (const A of i) {
|
|
1923
|
+
const N = w + (k - (M ? A.width : A.height)) / 2, j = M ? N : h, D = M ? h : N;
|
|
1924
|
+
f(A, j - A.x, D - A.y), h += (M ? A.height : A.width) + U;
|
|
1925
|
+
}
|
|
1926
|
+
$ = Math.max($, Math.max(0, h - U)), w += k + U;
|
|
1927
|
+
}
|
|
1928
|
+
if (w = Math.max(0, w - U), !O)
|
|
1929
|
+
for (const i of o) {
|
|
1930
|
+
const h = m.get(i.id), A = w - G[h] - te[h] + (te[h] - (M ? i.width : i.height)) / 2;
|
|
1931
|
+
f(i, M ? A - i.x : 0, M ? 0 : A - i.y);
|
|
1932
|
+
}
|
|
1933
|
+
return M ? { width: w, height: $ } : { width: $, height: w };
|
|
1934
|
+
}
|
|
1935
|
+
function pr(o) {
|
|
1936
|
+
const c = /* @__PURE__ */ new Set(), _ = (f) => {
|
|
1937
|
+
if (!f || c.has(f)) throw new Error(`Duplicate or empty graph ID: ${f}`);
|
|
1938
|
+
c.add(f);
|
|
1939
|
+
}, a = new Map(o.nodes.map((f) => [f.id, f]));
|
|
1940
|
+
for (const f of o.nodes) {
|
|
1941
|
+
if (_(f.id), ![f.width, f.height].every((O) => Number.isFinite(O) && O > 0))
|
|
1942
|
+
throw new Error(`Invalid dimensions for graph node: ${f.id}`);
|
|
1943
|
+
for (const O of f.ports ?? []) _(O.id);
|
|
1944
|
+
const C = /* @__PURE__ */ new Set([f.id]);
|
|
1945
|
+
let M = f.parentId;
|
|
1946
|
+
for (; M !== void 0; ) {
|
|
1947
|
+
const O = a.get(M);
|
|
1948
|
+
if (!O || O.kind !== "group")
|
|
1949
|
+
throw new Error(`Invalid parent for graph node: ${f.id}`);
|
|
1950
|
+
if (C.has(M)) throw new Error(`Cyclic graph containment: ${f.id}`);
|
|
1951
|
+
C.add(M), M = O.parentId;
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
for (const f of o.edges) {
|
|
1955
|
+
_(f.id);
|
|
1956
|
+
for (const [C, M] of [
|
|
1957
|
+
[f.source, f.sourcePort],
|
|
1958
|
+
[f.target, f.targetPort]
|
|
1959
|
+
]) {
|
|
1960
|
+
const O = a.get(C);
|
|
1961
|
+
if (!O || M !== void 0 && !O.ports?.some((L) => L.id === M))
|
|
1962
|
+
throw new Error(`Invalid endpoint for graph edge: ${f.id}`);
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
async function pn(o, c, _) {
|
|
1967
|
+
if (pr(o), c.routing !== void 0 && !["all", "none"].includes(c.routing))
|
|
1968
|
+
throw new Error("Invalid graph routing mode");
|
|
1969
|
+
if (wn(o, c), c.edgeClearance !== void 0 && (!Number.isFinite(c.edgeClearance) || c.edgeClearance < 0))
|
|
1970
|
+
throw new Error("Graph edge clearance must be finite and nonnegative");
|
|
1971
|
+
if (c.edgeAnchorInset !== void 0 && (!Number.isFinite(c.edgeAnchorInset) || c.edgeAnchorInset < 0))
|
|
1972
|
+
throw new Error("Graph edge anchor inset must be finite and nonnegative");
|
|
1973
|
+
const a = yn(o, c);
|
|
1974
|
+
if (c.aspectRatio !== void 0 && (!Number.isFinite(c.aspectRatio) || c.aspectRatio <= 0))
|
|
1975
|
+
throw new Error("Graph layout aspect ratio must be finite and positive");
|
|
1976
|
+
const f = c.groupPadding ?? { top: 64, right: 28, bottom: 28, left: 28 };
|
|
1977
|
+
if (![...Object.values(f), c.spacing ?? 64].every((l) => Number.isFinite(l) && l >= 0))
|
|
1978
|
+
throw new Error("Graph layout spacing must be finite and nonnegative");
|
|
1979
|
+
if (c.layers && (vn(o, c.layers), c.positionMode === "fixed" && c.positions?.length))
|
|
1980
|
+
throw new Error("Fixed positions cannot be combined with graph layers");
|
|
1981
|
+
if (c.aspectRatio !== void 0 || c.layers || Object.keys(c.groupLayouts ?? {}).length)
|
|
1982
|
+
return fn(a, c, _);
|
|
1983
|
+
const C = /* @__PURE__ */ new Map();
|
|
1984
|
+
for (const l of a.nodes)
|
|
1985
|
+
C.set(l.id, {
|
|
1986
|
+
id: l.id,
|
|
1987
|
+
width: l.width,
|
|
1988
|
+
height: l.height,
|
|
1989
|
+
...l.kind === "group" ? { children: [] } : {},
|
|
1990
|
+
ports: l.ports?.map((E) => ({
|
|
1991
|
+
id: E.id,
|
|
1992
|
+
width: 1,
|
|
1993
|
+
height: 1,
|
|
1994
|
+
layoutOptions: { "elk.port.side": E.side }
|
|
1995
|
+
})),
|
|
1996
|
+
layoutOptions: {
|
|
1997
|
+
"elk.portConstraints": "FIXED_ORDER",
|
|
1998
|
+
"elk.padding": `[top=${f.top},left=${f.left},bottom=${f.bottom},right=${f.right}]`
|
|
1999
|
+
}
|
|
2000
|
+
});
|
|
2001
|
+
const M = [];
|
|
2002
|
+
for (const l of a.nodes)
|
|
2003
|
+
(l.parentId ? C.get(l.parentId).children : M).push(C.get(l.id));
|
|
2004
|
+
const O = /* @__PURE__ */ new Set([
|
|
2005
|
+
...a.nodes.flatMap((l) => [l.id, ...(l.ports ?? []).map((E) => E.id)]),
|
|
2006
|
+
...a.edges.map((l) => l.id)
|
|
2007
|
+
]);
|
|
2008
|
+
let L = "$graph";
|
|
2009
|
+
for (; O.has(L); ) L += "$";
|
|
2010
|
+
const W = await _.layout({
|
|
2011
|
+
id: L,
|
|
2012
|
+
children: M,
|
|
2013
|
+
edges: a.edges.map((l) => ({
|
|
2014
|
+
id: l.id,
|
|
2015
|
+
sources: [l.sourcePort ?? l.source],
|
|
2016
|
+
targets: [l.targetPort ?? l.target]
|
|
2017
|
+
})),
|
|
2018
|
+
layoutOptions: {
|
|
2019
|
+
"elk.algorithm": "layered",
|
|
2020
|
+
"elk.direction": c.direction ?? "RIGHT",
|
|
2021
|
+
"elk.edgeRouting": "ORTHOGONAL",
|
|
2022
|
+
"elk.hierarchyHandling": "INCLUDE_CHILDREN",
|
|
2023
|
+
"elk.spacing.nodeNode": String(c.spacing ?? 64),
|
|
2024
|
+
"elk.layered.spacing.nodeNodeBetweenLayers": String(c.spacing ?? 64),
|
|
2025
|
+
"elk.layered.considerModelOrder.strategy": "NODES",
|
|
2026
|
+
"elk.randomSeed": "1"
|
|
2027
|
+
}
|
|
2028
|
+
}), d = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), p = (l) => {
|
|
2029
|
+
for (const E of l.edges ?? []) {
|
|
2030
|
+
const I = E.container ?? l.id, U = d.get(I) ?? { x: 0, y: 0 };
|
|
2031
|
+
g.set(
|
|
2032
|
+
E.id,
|
|
2033
|
+
(E.sections ?? []).map(
|
|
2034
|
+
(w) => [w.startPoint, ...w.bendPoints ?? [], w.endPoint].map(($) => ({
|
|
2035
|
+
x: $.x + U.x,
|
|
2036
|
+
y: $.y + U.y
|
|
2037
|
+
}))
|
|
2038
|
+
)
|
|
2039
|
+
);
|
|
2040
|
+
}
|
|
2041
|
+
for (const E of l.children ?? []) p(E);
|
|
2042
|
+
}, v = (l, E, I) => {
|
|
2043
|
+
const U = E + (l.x ?? 0), w = I + (l.y ?? 0);
|
|
2044
|
+
d.set(l.id, { x: U, y: w, width: l.width ?? 0, height: l.height ?? 0 });
|
|
2045
|
+
for (const $ of l.children ?? []) v($, U, w);
|
|
2046
|
+
};
|
|
2047
|
+
for (const l of W.children ?? []) v(l, 0, 0);
|
|
2048
|
+
p(W);
|
|
2049
|
+
const m = (!c.positions?.length || c.positionMode === "compact") && c.anchor && d.get(c.anchor.nodeId), S = m ? c.anchor.position.x - m.x : 0, u = m ? c.anchor.position.y - m.y : 0, b = a.nodes.map((l) => {
|
|
2050
|
+
const E = d.get(l.id);
|
|
2051
|
+
return { ...l, ...E, x: E.x + S, y: E.y + u };
|
|
2052
|
+
});
|
|
2053
|
+
return gr(
|
|
2054
|
+
{
|
|
2055
|
+
nodes: b,
|
|
2056
|
+
edges: a.edges.map((l) => ({
|
|
2057
|
+
...l,
|
|
2058
|
+
sections: (g.get(l.id) ?? []).map(
|
|
2059
|
+
(E) => E.map((I) => ({ x: I.x + S, y: I.y + u }))
|
|
2060
|
+
)
|
|
2061
|
+
})),
|
|
2062
|
+
bounds: { x: S, y: u, width: W.width ?? 0, height: W.height ?? 0 }
|
|
2063
|
+
},
|
|
2064
|
+
c,
|
|
2065
|
+
a.nodes
|
|
2066
|
+
);
|
|
2067
|
+
}
|
|
2068
|
+
async function mn(o, c, _ = {}) {
|
|
2069
|
+
pr({ nodes: o.nodes, edges: c });
|
|
2070
|
+
for (const f of o.nodes)
|
|
2071
|
+
if (![f.x, f.y].every(Number.isFinite))
|
|
2072
|
+
throw new Error(`Invalid geometry for graph node: ${f.id}`);
|
|
2073
|
+
return (await ot(
|
|
2074
|
+
{
|
|
2075
|
+
...o,
|
|
2076
|
+
edges: c.map((f) => ({ ...f, sections: [] }))
|
|
2077
|
+
},
|
|
2078
|
+
_
|
|
2079
|
+
)).edges;
|
|
2080
|
+
}
|
|
2081
|
+
function yn(o, c) {
|
|
2082
|
+
if (c.positionMode !== "compact" || !c.positions?.length) return o;
|
|
2083
|
+
const _ = c.direction ?? "RIGHT", a = new Map(
|
|
2084
|
+
c.positions.map((M) => [
|
|
2085
|
+
M.nodeId,
|
|
2086
|
+
_ === "RIGHT" || _ === "LEFT" ? M.y : M.x
|
|
2087
|
+
])
|
|
2088
|
+
), f = new Map(o.nodes.map((M, O) => [M.id, O]));
|
|
2089
|
+
return { nodes: [...o.nodes].sort((M, O) => {
|
|
2090
|
+
const L = (M.parentId ?? "").localeCompare(O.parentId ?? ""), W = c.layers && !M.parentId && !O.parentId || M.parentId === O.parentId && M.parentId && c.groupLayouts?.[M.parentId] ? 0 : (a.get(M.id) ?? 1 / 0) - (a.get(O.id) ?? 1 / 0);
|
|
2091
|
+
return L || W || f.get(M.id) - f.get(O.id);
|
|
2092
|
+
}), edges: o.edges };
|
|
2093
|
+
}
|
|
2094
|
+
function wn(o, c) {
|
|
2095
|
+
const _ = new Map(o.nodes.map((a) => [a.id, a]));
|
|
2096
|
+
for (const [a, f] of Object.entries(c.groupLayouts ?? {}))
|
|
2097
|
+
if (_.get(a)?.kind !== "group" || !f || !["row", "column"].includes(f.flow) || f.maxPerLine !== void 0 && (!Number.isSafeInteger(f.maxPerLine) || f.maxPerLine <= 0))
|
|
2098
|
+
throw new Error(`Invalid graph group layout: ${a}`);
|
|
2099
|
+
if ((c.positionMode ?? "fixed") === "fixed") {
|
|
2100
|
+
for (const a of c.positions ?? [])
|
|
2101
|
+
for (let f = _.get(a.nodeId)?.parentId; f; f = _.get(f)?.parentId)
|
|
2102
|
+
if (c.groupLayouts?.[f])
|
|
2103
|
+
throw new Error(
|
|
2104
|
+
`Fixed positions cannot constrain members of a graph group layout: ${a.nodeId}`
|
|
2105
|
+
);
|
|
2106
|
+
}
|
|
2107
|
+
}
|
|
2108
|
+
function vn(o, c) {
|
|
2109
|
+
const _ = new Map(o.nodes.map((f) => [f.id, f])), a = /* @__PURE__ */ new Set();
|
|
2110
|
+
for (const [f, C] of c.entries()) {
|
|
2111
|
+
if (!C.length) throw new Error(`Graph layer must not be empty: ${f}`);
|
|
2112
|
+
for (const M of C) {
|
|
2113
|
+
const O = _.get(M);
|
|
2114
|
+
if (!O || O.parentId) throw new Error(`Graph layer object must be a root node: ${M}`);
|
|
2115
|
+
if (a.has(M)) throw new Error(`Graph object appears in multiple layers: ${M}`);
|
|
2116
|
+
a.add(M);
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
}
|
|
2120
|
+
const bn = new an({
|
|
2121
|
+
workerFactory: () => {
|
|
2122
|
+
const o = new Worker(new URL("elk-worker-CrDP6jPz.js", import.meta.url), { type: "module" });
|
|
2123
|
+
return o.addEventListener("error", (c) => {
|
|
2124
|
+
throw new Error(c.message || "Graph ELK worker failed");
|
|
2125
|
+
}), o.addEventListener("messageerror", () => {
|
|
2126
|
+
throw new Error("Invalid graph ELK worker response");
|
|
2127
|
+
}), o;
|
|
2128
|
+
}
|
|
2129
|
+
});
|
|
2130
|
+
let dr = Promise.resolve();
|
|
2131
|
+
const Et = /* @__PURE__ */ new Map();
|
|
2132
|
+
self.onmessage = ({ data: o }) => {
|
|
2133
|
+
if ("cancel" in o) {
|
|
2134
|
+
const _ = Et.get(o.id);
|
|
2135
|
+
_ && (_.canceled = !0);
|
|
2136
|
+
return;
|
|
2137
|
+
}
|
|
2138
|
+
const c = { canceled: !1 };
|
|
2139
|
+
Et.set(o.id, c), dr = dr.then(async () => {
|
|
2140
|
+
try {
|
|
2141
|
+
if (c.canceled || (await new Promise((a) => setTimeout(a, 0)), c.canceled)) return;
|
|
2142
|
+
const _ = o.kind === "route" ? { edges: await mn(o.geometry, o.edges, o.options) } : { layout: await pn(o.input, o.options, bn) };
|
|
2143
|
+
c.canceled || self.postMessage({ id: o.id, ..._ });
|
|
2144
|
+
} catch (_) {
|
|
2145
|
+
c.canceled || self.postMessage({
|
|
2146
|
+
id: o.id,
|
|
2147
|
+
error: _ instanceof Error ? _.message : String(_)
|
|
2148
|
+
});
|
|
2149
|
+
} finally {
|
|
2150
|
+
Et.delete(o.id);
|
|
2151
|
+
}
|
|
2152
|
+
});
|
|
2153
|
+
};
|