epic-designer-gold
Version:
基于vue3的设计器,可视化开发页面表单
2,187 lines • 608 kB
JavaScript
var Mp = Object.defineProperty;
var Fp = (t, e, n) => e in t ? Mp(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
var fn = (t, e, n) => Fp(t, typeof e != "symbol" ? e + "" : e, n);
import { bC as Gp, bD as Up, aS as Df, bm as jp, aW as zp, aT as ze, at as Bp, au as iu, bc as qp, bf as Mf, bg as Ff, bd as Wp, br as su, aw as Jn, ax as oe, aU as Vp, aO as Kp } from "./mermaid.core-Bw3Z-klg.js";
import { k as qr, j as Il, g as ci, S as Hp, w as Yp, x as Xp, c as Gf, v as Oe, y as Uf, l as Jp, z as Qp, A as Zp, B as em, C as tm, a as jf, d as j, i as nn, r as Qe, f as pt, D as Fe } from "./_baseUniq-D2_Vs4c5.js";
import { j as _l, m as M, d as nm, f as vt, g as Wr, h as B, i as $l, l as qn, e as rm } from "./_basePickBy-Czwb4oPM.js";
import { c as qe } from "./clone-CjSIWqm4.js";
import { c as Rt, g as im } from "./_commonjsHelpers-BVfed4GL.js";
var sm = Object.prototype, am = sm.hasOwnProperty, ht = Gp(function(t, e) {
if (Up(e) || Df(e)) {
jp(e, qr(e), t);
return;
}
for (var n in e)
am.call(e, n) && zp(t, n, e[n]);
});
function zf(t, e, n) {
var r = -1, i = t.length;
e < 0 && (e = -e > i ? 0 : i + e), n = n > i ? i : n, n < 0 && (n += i), i = e > n ? 0 : n - e >>> 0, e >>>= 0;
for (var s = Array(i); ++r < i; )
s[r] = t[r + e];
return s;
}
function os(t) {
for (var e = -1, n = t == null ? 0 : t.length, r = 0, i = []; ++e < n; ) {
var s = t[e];
s && (i[r++] = s);
}
return i;
}
function om(t, e, n, r) {
for (var i = -1, s = t == null ? 0 : t.length; ++i < s; ) {
var a = t[i];
e(r, a, n(a), t);
}
return r;
}
function cm(t, e, n, r) {
return Il(t, function(i, s, a) {
e(r, i, n(i), a);
}), r;
}
function lm(t, e) {
return function(n, r) {
var i = ze(n) ? om : cm, s = e ? e() : {};
return i(n, t, ci(r), s);
};
}
var um = 200;
function dm(t, e, n, r) {
var i = -1, s = Yp, a = !0, o = t.length, c = [], l = e.length;
if (!o)
return c;
e.length >= um && (s = Xp, a = !1, e = new Hp(e));
e:
for (; ++i < o; ) {
var d = t[i], h = d;
if (d = d !== 0 ? d : 0, a && h === h) {
for (var p = l; p--; )
if (e[p] === h)
continue e;
c.push(d);
} else s(e, h, r) || c.push(d);
}
return c;
}
var Ga = Bp(function(t, e) {
return iu(t) ? dm(t, Gf(e, 1, iu, !0)) : [];
});
function Ge(t, e, n) {
var r = t == null ? 0 : t.length;
return r ? (e = e === void 0 ? 1 : _l(e), zf(t, e < 0 ? 0 : e, r)) : [];
}
function Wi(t, e, n) {
var r = t == null ? 0 : t.length;
return r ? (e = e === void 0 ? 1 : _l(e), e = r - e, zf(t, 0, e < 0 ? 0 : e)) : [];
}
function fm(t, e) {
for (var n = -1, r = t == null ? 0 : t.length; ++n < r; )
if (!e(t[n], n, t))
return !1;
return !0;
}
function hm(t, e) {
var n = !0;
return Il(t, function(r, i, s) {
return n = !!e(r, i, s), n;
}), n;
}
function It(t, e, n) {
var r = ze(t) ? fm : hm;
return r(t, ci(e));
}
function $t(t) {
return t && t.length ? t[0] : void 0;
}
function ft(t, e) {
return Gf(M(t, e));
}
var pm = Object.prototype, mm = pm.hasOwnProperty, gm = lm(function(t, e, n) {
mm.call(t, n) ? t[n].push(e) : qp(t, n, [e]);
}), ym = "[object String]";
function it(t) {
return typeof t == "string" || !ze(t) && Mf(t) && Ff(t) == ym;
}
var Tm = Math.max;
function tt(t, e, n, r) {
t = Df(t) ? t : Oe(t), n = n ? _l(n) : 0;
var i = t.length;
return n < 0 && (n = Tm(i + n, 0)), it(t) ? n <= i && t.indexOf(e, n) > -1 : !!i && Uf(t, e, n) > -1;
}
function au(t, e, n) {
var r = t == null ? 0 : t.length;
if (!r)
return -1;
var i = 0;
return Uf(t, e, i);
}
var Rm = "[object RegExp]";
function vm(t) {
return Mf(t) && Ff(t) == Rm;
}
var ou = su && su.isRegExp, rn = ou ? Wp(ou) : vm, Em = "Expected a function";
function Am(t) {
if (typeof t != "function")
throw new TypeError(Em);
return function() {
var e = arguments;
switch (e.length) {
case 0:
return !t.call(this);
case 1:
return !t.call(this, e[0]);
case 2:
return !t.call(this, e[0], e[1]);
case 3:
return !t.call(this, e[0], e[1], e[2]);
}
return !t.apply(this, e);
};
}
function Pt(t, e) {
if (t == null)
return {};
var n = Jp(Qp(t), function(r) {
return [r];
});
return e = ci(e), nm(t, n, function(r, i) {
return e(r, i[0]);
});
}
function Ua(t, e) {
var n = ze(t) ? Zp : em;
return n(t, Am(ci(e)));
}
function Sm(t, e) {
var n;
return Il(t, function(r, i, s) {
return n = e(r, i, s), !n;
}), !!n;
}
function Bf(t, e, n) {
var r = ze(t) ? tm : Sm;
return r(t, ci(e));
}
function Pl(t) {
return t && t.length ? jf(t) : [];
}
function Cm(t, e) {
return t && t.length ? jf(t, ci(e)) : [];
}
function Ke(t) {
return typeof t == "object" && t !== null && typeof t.$type == "string";
}
function wt(t) {
return typeof t == "object" && t !== null && typeof t.$refText == "string" && "ref" in t;
}
function pn(t) {
return typeof t == "object" && t !== null && typeof t.$refText == "string" && "items" in t;
}
function km(t) {
return typeof t == "object" && t !== null && typeof t.name == "string" && typeof t.type == "string" && typeof t.path == "string";
}
function Ci(t) {
return typeof t == "object" && t !== null && typeof t.info == "object" && typeof t.message == "string";
}
class qf {
constructor() {
this.subtypes = {}, this.allSubtypes = {};
}
getAllTypes() {
return Object.keys(this.types);
}
getReferenceType(e) {
var i;
const n = this.types[e.container.$type];
if (!n)
throw new Error(`Type ${e.container.$type || "undefined"} not found.`);
const r = (i = n.properties[e.property]) == null ? void 0 : i.referenceType;
if (!r)
throw new Error(`Property ${e.property || "undefined"} of type ${e.container.$type} is not a reference.`);
return r;
}
getTypeMetaData(e) {
const n = this.types[e];
return n || {
name: e,
properties: {},
superTypes: []
};
}
isInstance(e, n) {
return Ke(e) && this.isSubtype(e.$type, n);
}
isSubtype(e, n) {
if (e === n)
return !0;
let r = this.subtypes[e];
r || (r = this.subtypes[e] = {});
const i = r[n];
if (i !== void 0)
return i;
{
const s = this.types[e], a = s ? s.superTypes.some((o) => this.isSubtype(o, n)) : !1;
return r[n] = a, a;
}
}
getAllSubTypes(e) {
const n = this.allSubtypes[e];
if (n)
return n;
{
const r = this.getAllTypes(), i = [];
for (const s of r)
this.isSubtype(s, e) && i.push(s);
return this.allSubtypes[e] = i, i;
}
}
}
function Vi(t) {
return typeof t == "object" && t !== null && Array.isArray(t.content);
}
function Wf(t) {
return typeof t == "object" && t !== null && typeof t.tokenType == "object";
}
function Vf(t) {
return Vi(t) && typeof t.fullText == "string";
}
class Ue {
constructor(e, n) {
this.startFn = e, this.nextFn = n;
}
iterator() {
const e = {
state: this.startFn(),
next: () => this.nextFn(e.state),
[Symbol.iterator]: () => e
};
return e;
}
[Symbol.iterator]() {
return this.iterator();
}
isEmpty() {
return !!this.iterator().next().done;
}
count() {
const e = this.iterator();
let n = 0, r = e.next();
for (; !r.done; )
n++, r = e.next();
return n;
}
toArray() {
const e = [], n = this.iterator();
let r;
do
r = n.next(), r.value !== void 0 && e.push(r.value);
while (!r.done);
return e;
}
toSet() {
return new Set(this);
}
toMap(e, n) {
const r = this.map((i) => [
e ? e(i) : i,
n ? n(i) : i
]);
return new Map(r);
}
toString() {
return this.join();
}
concat(e) {
return new Ue(() => ({ first: this.startFn(), firstDone: !1, iterator: e[Symbol.iterator]() }), (n) => {
let r;
if (!n.firstDone) {
do
if (r = this.nextFn(n.first), !r.done)
return r;
while (!r.done);
n.firstDone = !0;
}
do
if (r = n.iterator.next(), !r.done)
return r;
while (!r.done);
return ut;
});
}
join(e = ",") {
const n = this.iterator();
let r = "", i, s = !1;
do
i = n.next(), i.done || (s && (r += e), r += Nm(i.value)), s = !0;
while (!i.done);
return r;
}
indexOf(e, n = 0) {
const r = this.iterator();
let i = 0, s = r.next();
for (; !s.done; ) {
if (i >= n && s.value === e)
return i;
s = r.next(), i++;
}
return -1;
}
every(e) {
const n = this.iterator();
let r = n.next();
for (; !r.done; ) {
if (!e(r.value))
return !1;
r = n.next();
}
return !0;
}
some(e) {
const n = this.iterator();
let r = n.next();
for (; !r.done; ) {
if (e(r.value))
return !0;
r = n.next();
}
return !1;
}
forEach(e) {
const n = this.iterator();
let r = 0, i = n.next();
for (; !i.done; )
e(i.value, r), i = n.next(), r++;
}
map(e) {
return new Ue(this.startFn, (n) => {
const { done: r, value: i } = this.nextFn(n);
return r ? ut : { done: !1, value: e(i) };
});
}
filter(e) {
return new Ue(this.startFn, (n) => {
let r;
do
if (r = this.nextFn(n), !r.done && e(r.value))
return r;
while (!r.done);
return ut;
});
}
nonNullable() {
return this.filter((e) => e != null);
}
reduce(e, n) {
const r = this.iterator();
let i = n, s = r.next();
for (; !s.done; )
i === void 0 ? i = s.value : i = e(i, s.value), s = r.next();
return i;
}
reduceRight(e, n) {
return this.recursiveReduce(this.iterator(), e, n);
}
recursiveReduce(e, n, r) {
const i = e.next();
if (i.done)
return r;
const s = this.recursiveReduce(e, n, r);
return s === void 0 ? i.value : n(s, i.value);
}
find(e) {
const n = this.iterator();
let r = n.next();
for (; !r.done; ) {
if (e(r.value))
return r.value;
r = n.next();
}
}
findIndex(e) {
const n = this.iterator();
let r = 0, i = n.next();
for (; !i.done; ) {
if (e(i.value))
return r;
i = n.next(), r++;
}
return -1;
}
includes(e) {
const n = this.iterator();
let r = n.next();
for (; !r.done; ) {
if (r.value === e)
return !0;
r = n.next();
}
return !1;
}
flatMap(e) {
return new Ue(() => ({ this: this.startFn() }), (n) => {
do {
if (n.iterator) {
const s = n.iterator.next();
if (s.done)
n.iterator = void 0;
else
return s;
}
const { done: r, value: i } = this.nextFn(n.this);
if (!r) {
const s = e(i);
if (ca(s))
n.iterator = s[Symbol.iterator]();
else
return { done: !1, value: s };
}
} while (n.iterator);
return ut;
});
}
flat(e) {
if (e === void 0 && (e = 1), e <= 0)
return this;
const n = e > 1 ? this.flat(e - 1) : this;
return new Ue(() => ({ this: n.startFn() }), (r) => {
do {
if (r.iterator) {
const a = r.iterator.next();
if (a.done)
r.iterator = void 0;
else
return a;
}
const { done: i, value: s } = n.nextFn(r.this);
if (!i)
if (ca(s))
r.iterator = s[Symbol.iterator]();
else
return { done: !1, value: s };
} while (r.iterator);
return ut;
});
}
head() {
const n = this.iterator().next();
if (!n.done)
return n.value;
}
tail(e = 1) {
return new Ue(() => {
const n = this.startFn();
for (let r = 0; r < e; r++)
if (this.nextFn(n).done)
return n;
return n;
}, this.nextFn);
}
limit(e) {
return new Ue(() => ({ size: 0, state: this.startFn() }), (n) => (n.size++, n.size > e ? ut : this.nextFn(n.state)));
}
distinct(e) {
return new Ue(() => ({ set: /* @__PURE__ */ new Set(), internalState: this.startFn() }), (n) => {
let r;
do
if (r = this.nextFn(n.internalState), !r.done) {
const i = e ? e(r.value) : r.value;
if (!n.set.has(i))
return n.set.add(i), r;
}
while (!r.done);
return ut;
});
}
exclude(e, n) {
const r = /* @__PURE__ */ new Set();
for (const i of e) {
const s = n ? n(i) : i;
r.add(s);
}
return this.filter((i) => {
const s = n ? n(i) : i;
return !r.has(s);
});
}
}
function Nm(t) {
return typeof t == "string" ? t : typeof t > "u" ? "undefined" : typeof t.toString == "function" ? t.toString() : Object.prototype.toString.call(t);
}
function ca(t) {
return !!t && typeof t[Symbol.iterator] == "function";
}
const Kf = new Ue(() => {
}, () => ut), ut = Object.freeze({ done: !0, value: void 0 });
function he(...t) {
if (t.length === 1) {
const e = t[0];
if (e instanceof Ue)
return e;
if (ca(e))
return new Ue(() => e[Symbol.iterator](), (n) => n.next());
if (typeof e.length == "number")
return new Ue(() => ({ index: 0 }), (n) => n.index < e.length ? { done: !1, value: e[n.index++] } : ut);
}
return t.length > 1 ? new Ue(() => ({ collIndex: 0, arrIndex: 0 }), (e) => {
do {
if (e.iterator) {
const n = e.iterator.next();
if (!n.done)
return n;
e.iterator = void 0;
}
if (e.array) {
if (e.arrIndex < e.array.length)
return { done: !1, value: e.array[e.arrIndex++] };
e.array = void 0, e.arrIndex = 0;
}
if (e.collIndex < t.length) {
const n = t[e.collIndex++];
ca(n) ? e.iterator = n[Symbol.iterator]() : n && typeof n.length == "number" && (e.array = n);
}
} while (e.iterator || e.array || e.collIndex < t.length);
return ut;
}) : Kf;
}
class Ll extends Ue {
constructor(e, n, r) {
super(() => ({
iterators: r != null && r.includeRoot ? [[e][Symbol.iterator]()] : [n(e)[Symbol.iterator]()],
pruned: !1
}), (i) => {
for (i.pruned && (i.iterators.pop(), i.pruned = !1); i.iterators.length > 0; ) {
const a = i.iterators[i.iterators.length - 1].next();
if (a.done)
i.iterators.pop();
else
return i.iterators.push(n(a.value)[Symbol.iterator]()), a;
}
return ut;
});
}
iterator() {
const e = {
state: this.startFn(),
next: () => this.nextFn(e.state),
prune: () => {
e.state.pruned = !0;
},
[Symbol.iterator]: () => e
};
return e;
}
}
var Mo;
(function(t) {
function e(s) {
return s.reduce((a, o) => a + o, 0);
}
t.sum = e;
function n(s) {
return s.reduce((a, o) => a * o, 0);
}
t.product = n;
function r(s) {
return s.reduce((a, o) => Math.min(a, o));
}
t.min = r;
function i(s) {
return s.reduce((a, o) => Math.max(a, o));
}
t.max = i;
})(Mo || (Mo = {}));
function Fo(t, e = {}) {
for (const [n, r] of Object.entries(t))
n.startsWith("$") || (Array.isArray(r) ? r.forEach((i, s) => {
Ke(i) && (i.$container = t, i.$containerProperty = n, i.$containerIndex = s, e.deep && Fo(i, e));
}) : Ke(r) && (r.$container = t, r.$containerProperty = n, e.deep && Fo(r, e)));
}
function ja(t, e) {
let n = t;
for (; n; ) {
if (e(n))
return n;
n = n.$container;
}
}
function Qt(t) {
const n = Ks(t).$document;
if (!n)
throw new Error("AST node has no document.");
return n;
}
function Ks(t) {
for (; t.$container; )
t = t.$container;
return t;
}
function cu(t) {
return wt(t) ? t.ref ? [t.ref] : [] : pn(t) ? t.items.map((e) => e.ref) : [];
}
function Ol(t, e) {
if (!t)
throw new Error("Node must be an AstNode.");
const n = e == null ? void 0 : e.range;
return new Ue(() => ({
keys: Object.keys(t),
keyIndex: 0,
arrayIndex: 0
}), (r) => {
for (; r.keyIndex < r.keys.length; ) {
const i = r.keys[r.keyIndex];
if (!i.startsWith("$")) {
const s = t[i];
if (Ke(s)) {
if (r.keyIndex++, lu(s, n))
return { done: !1, value: s };
} else if (Array.isArray(s)) {
for (; r.arrayIndex < s.length; ) {
const a = r.arrayIndex++, o = s[a];
if (Ke(o) && lu(o, n))
return { done: !1, value: o };
}
r.arrayIndex = 0;
}
}
r.keyIndex++;
}
return ut;
});
}
function cs(t, e) {
if (!t)
throw new Error("Root node must be an AstNode.");
return new Ll(t, (n) => Ol(n, e));
}
function Zt(t, e) {
if (!t)
throw new Error("Root node must be an AstNode.");
return new Ll(t, (n) => Ol(n, e), { includeRoot: !0 });
}
function lu(t, e) {
var r;
if (!e)
return !0;
const n = (r = t.$cstNode) == null ? void 0 : r.range;
return n ? Ym(n, e) : !1;
}
function la(t) {
return new Ue(() => ({
keys: Object.keys(t),
keyIndex: 0,
arrayIndex: 0
}), (e) => {
for (; e.keyIndex < e.keys.length; ) {
const n = e.keys[e.keyIndex];
if (!n.startsWith("$")) {
const r = t[n];
if (wt(r) || pn(r))
return e.keyIndex++, { done: !1, value: { reference: r, container: t, property: n } };
if (Array.isArray(r)) {
for (; e.arrayIndex < r.length; ) {
const i = e.arrayIndex++, s = r[i];
if (wt(s) || pn(r))
return { done: !1, value: { reference: s, container: t, property: n, index: i } };
}
e.arrayIndex = 0;
}
}
e.keyIndex++;
}
return ut;
});
}
function wm(t, e) {
const n = t.getTypeMetaData(e.$type), r = e;
for (const i of Object.values(n.properties))
i.defaultValue !== void 0 && r[i.name] === void 0 && (r[i.name] = Hf(i.defaultValue));
}
function Hf(t) {
return Array.isArray(t) ? [...t.map(Hf)] : t;
}
const lt = {
$type: "AbstractElement",
cardinality: "cardinality"
};
function bm(t) {
return Z.isInstance(t, lt.$type);
}
const Hs = {
$type: "AbstractParserRule"
};
function ls(t) {
return Z.isInstance(t, Hs.$type);
}
const xs = {
$type: "AbstractRule"
}, kt = {
$type: "AbstractType"
}, xn = {
$type: "Action",
cardinality: "cardinality",
feature: "feature",
inferredType: "inferredType",
operator: "operator",
type: "type"
};
function za(t) {
return Z.isInstance(t, xn.$type);
}
const Ys = {
$type: "Alternatives",
cardinality: "cardinality",
elements: "elements"
};
function Yf(t) {
return Z.isInstance(t, Ys.$type);
}
const uu = {
$type: "ArrayLiteral",
elements: "elements"
}, du = {
$type: "ArrayType",
elementType: "elementType"
}, Dn = {
$type: "Assignment",
cardinality: "cardinality",
feature: "feature",
operator: "operator",
predicate: "predicate",
terminal: "terminal"
};
function Wn(t) {
return Z.isInstance(t, Dn.$type);
}
const Go = {
$type: "BooleanLiteral",
true: "true"
};
function Im(t) {
return Z.isInstance(t, Go.$type);
}
const Mn = {
$type: "CharacterRange",
cardinality: "cardinality",
left: "left",
lookahead: "lookahead",
parenthesized: "parenthesized",
right: "right"
};
function _m(t) {
return Z.isInstance(t, Mn.$type);
}
const ir = {
$type: "Condition"
}, Xs = {
$type: "Conjunction",
left: "left",
right: "right"
};
function $m(t) {
return Z.isInstance(t, Xs.$type);
}
const Fn = {
$type: "CrossReference",
cardinality: "cardinality",
deprecatedSyntax: "deprecatedSyntax",
isMulti: "isMulti",
terminal: "terminal",
type: "type"
};
function Ba(t) {
return Z.isInstance(t, Fn.$type);
}
const Js = {
$type: "Disjunction",
left: "left",
right: "right"
};
function Pm(t) {
return Z.isInstance(t, Js.$type);
}
const Uo = {
$type: "EndOfFile",
cardinality: "cardinality"
};
function Lm(t) {
return Z.isInstance(t, Uo.$type);
}
const Ln = {
$type: "Grammar",
imports: "imports",
interfaces: "interfaces",
isDeclared: "isDeclared",
name: "name",
rules: "rules",
types: "types"
}, fu = {
$type: "GrammarImport",
path: "path"
}, ur = {
$type: "Group",
cardinality: "cardinality",
elements: "elements",
guardCondition: "guardCondition",
predicate: "predicate"
};
function xl(t) {
return Z.isInstance(t, ur.$type);
}
const jo = {
$type: "InferredType",
name: "name"
};
function Xf(t) {
return Z.isInstance(t, jo.$type);
}
const Vt = {
$type: "InfixRule",
call: "call",
dataType: "dataType",
inferredType: "inferredType",
name: "name",
operators: "operators",
parameters: "parameters",
returnType: "returnType"
};
function ua(t) {
return Z.isInstance(t, Vt.$type);
}
const go = {
$type: "InfixRuleOperatorList",
associativity: "associativity",
operators: "operators"
}, hu = {
$type: "InfixRuleOperators",
precedences: "precedences"
}, Li = {
$type: "Interface",
attributes: "attributes",
name: "name",
superTypes: "superTypes"
};
function Om(t) {
return Z.isInstance(t, Li.$type);
}
const Oi = {
$type: "Keyword",
cardinality: "cardinality",
predicate: "predicate",
value: "value"
};
function Vn(t) {
return Z.isInstance(t, Oi.$type);
}
const Ds = {
$type: "NamedArgument",
calledByName: "calledByName",
parameter: "parameter",
value: "value"
}, dr = {
$type: "NegatedToken",
cardinality: "cardinality",
lookahead: "lookahead",
parenthesized: "parenthesized",
terminal: "terminal"
};
function xm(t) {
return Z.isInstance(t, dr.$type);
}
const zo = {
$type: "Negation",
value: "value"
};
function Dm(t) {
return Z.isInstance(t, zo.$type);
}
const pu = {
$type: "NumberLiteral",
value: "value"
}, Ms = {
$type: "Parameter",
name: "name"
}, Bo = {
$type: "ParameterReference",
parameter: "parameter"
};
function Mm(t) {
return Z.isInstance(t, Bo.$type);
}
const Dt = {
$type: "ParserRule",
dataType: "dataType",
definition: "definition",
entry: "entry",
fragment: "fragment",
inferredType: "inferredType",
name: "name",
parameters: "parameters",
returnType: "returnType"
};
function on(t) {
return Z.isInstance(t, Dt.$type);
}
const yo = {
$type: "ReferenceType",
isMulti: "isMulti",
referenceType: "referenceType"
}, fr = {
$type: "RegexToken",
cardinality: "cardinality",
lookahead: "lookahead",
parenthesized: "parenthesized",
regex: "regex"
};
function Fm(t) {
return Z.isInstance(t, fr.$type);
}
const qo = {
$type: "ReturnType",
name: "name"
};
function Gm(t) {
return Z.isInstance(t, qo.$type);
}
const hr = {
$type: "RuleCall",
arguments: "arguments",
cardinality: "cardinality",
predicate: "predicate",
rule: "rule"
};
function Kn(t) {
return Z.isInstance(t, hr.$type);
}
const xi = {
$type: "SimpleType",
primitiveType: "primitiveType",
stringType: "stringType",
typeRef: "typeRef"
};
function Um(t) {
return Z.isInstance(t, xi.$type);
}
const mu = {
$type: "StringLiteral",
value: "value"
}, pr = {
$type: "TerminalAlternatives",
cardinality: "cardinality",
elements: "elements",
lookahead: "lookahead",
parenthesized: "parenthesized"
};
function jm(t) {
return Z.isInstance(t, pr.$type);
}
const yt = {
$type: "TerminalElement",
cardinality: "cardinality",
lookahead: "lookahead",
parenthesized: "parenthesized"
}, mr = {
$type: "TerminalGroup",
cardinality: "cardinality",
elements: "elements",
lookahead: "lookahead",
parenthesized: "parenthesized"
};
function zm(t) {
return Z.isInstance(t, mr.$type);
}
const hn = {
$type: "TerminalRule",
definition: "definition",
fragment: "fragment",
hidden: "hidden",
name: "name",
type: "type"
};
function cn(t) {
return Z.isInstance(t, hn.$type);
}
const gr = {
$type: "TerminalRuleCall",
cardinality: "cardinality",
lookahead: "lookahead",
parenthesized: "parenthesized",
rule: "rule"
};
function Bm(t) {
return Z.isInstance(t, gr.$type);
}
const Qs = {
$type: "Type",
name: "name",
type: "type"
};
function qm(t) {
return Z.isInstance(t, Qs.$type);
}
const ki = {
$type: "TypeAttribute",
defaultValue: "defaultValue",
isOptional: "isOptional",
name: "name",
type: "type"
}, Ni = {
$type: "TypeDefinition"
}, gu = {
$type: "UnionType",
types: "types"
}, Zs = {
$type: "UnorderedGroup",
cardinality: "cardinality",
elements: "elements"
};
function Jf(t) {
return Z.isInstance(t, Zs.$type);
}
const yr = {
$type: "UntilToken",
cardinality: "cardinality",
lookahead: "lookahead",
parenthesized: "parenthesized",
terminal: "terminal"
};
function Wm(t) {
return Z.isInstance(t, yr.$type);
}
const wi = {
$type: "ValueLiteral"
}, Di = {
$type: "Wildcard",
cardinality: "cardinality",
lookahead: "lookahead",
parenthesized: "parenthesized"
};
function Vm(t) {
return Z.isInstance(t, Di.$type);
}
class Qf extends qf {
constructor() {
super(...arguments), this.types = {
AbstractElement: {
name: lt.$type,
properties: {
cardinality: {
name: lt.cardinality
}
},
superTypes: []
},
AbstractParserRule: {
name: Hs.$type,
properties: {},
superTypes: [xs.$type, kt.$type]
},
AbstractRule: {
name: xs.$type,
properties: {},
superTypes: []
},
AbstractType: {
name: kt.$type,
properties: {},
superTypes: []
},
Action: {
name: xn.$type,
properties: {
cardinality: {
name: xn.cardinality
},
feature: {
name: xn.feature
},
inferredType: {
name: xn.inferredType
},
operator: {
name: xn.operator
},
type: {
name: xn.type,
referenceType: kt.$type
}
},
superTypes: [lt.$type]
},
Alternatives: {
name: Ys.$type,
properties: {
cardinality: {
name: Ys.cardinality
},
elements: {
name: Ys.elements,
defaultValue: []
}
},
superTypes: [lt.$type]
},
ArrayLiteral: {
name: uu.$type,
properties: {
elements: {
name: uu.elements,
defaultValue: []
}
},
superTypes: [wi.$type]
},
ArrayType: {
name: du.$type,
properties: {
elementType: {
name: du.elementType
}
},
superTypes: [Ni.$type]
},
Assignment: {
name: Dn.$type,
properties: {
cardinality: {
name: Dn.cardinality
},
feature: {
name: Dn.feature
},
operator: {
name: Dn.operator
},
predicate: {
name: Dn.predicate
},
terminal: {
name: Dn.terminal
}
},
superTypes: [lt.$type]
},
BooleanLiteral: {
name: Go.$type,
properties: {
true: {
name: Go.true,
defaultValue: !1
}
},
superTypes: [ir.$type, wi.$type]
},
CharacterRange: {
name: Mn.$type,
properties: {
cardinality: {
name: Mn.cardinality
},
left: {
name: Mn.left
},
lookahead: {
name: Mn.lookahead
},
parenthesized: {
name: Mn.parenthesized,
defaultValue: !1
},
right: {
name: Mn.right
}
},
superTypes: [yt.$type]
},
Condition: {
name: ir.$type,
properties: {},
superTypes: []
},
Conjunction: {
name: Xs.$type,
properties: {
left: {
name: Xs.left
},
right: {
name: Xs.right
}
},
superTypes: [ir.$type]
},
CrossReference: {
name: Fn.$type,
properties: {
cardinality: {
name: Fn.cardinality
},
deprecatedSyntax: {
name: Fn.deprecatedSyntax,
defaultValue: !1
},
isMulti: {
name: Fn.isMulti,
defaultValue: !1
},
terminal: {
name: Fn.terminal
},
type: {
name: Fn.type,
referenceType: kt.$type
}
},
superTypes: [lt.$type]
},
Disjunction: {
name: Js.$type,
properties: {
left: {
name: Js.left
},
right: {
name: Js.right
}
},
superTypes: [ir.$type]
},
EndOfFile: {
name: Uo.$type,
properties: {
cardinality: {
name: Uo.cardinality
}
},
superTypes: [lt.$type]
},
Grammar: {
name: Ln.$type,
properties: {
imports: {
name: Ln.imports,
defaultValue: []
},
interfaces: {
name: Ln.interfaces,
defaultValue: []
},
isDeclared: {
name: Ln.isDeclared,
defaultValue: !1
},
name: {
name: Ln.name
},
rules: {
name: Ln.rules,
defaultValue: []
},
types: {
name: Ln.types,
defaultValue: []
}
},
superTypes: []
},
GrammarImport: {
name: fu.$type,
properties: {
path: {
name: fu.path
}
},
superTypes: []
},
Group: {
name: ur.$type,
properties: {
cardinality: {
name: ur.cardinality
},
elements: {
name: ur.elements,
defaultValue: []
},
guardCondition: {
name: ur.guardCondition
},
predicate: {
name: ur.predicate
}
},
superTypes: [lt.$type]
},
InferredType: {
name: jo.$type,
properties: {
name: {
name: jo.name
}
},
superTypes: [kt.$type]
},
InfixRule: {
name: Vt.$type,
properties: {
call: {
name: Vt.call
},
dataType: {
name: Vt.dataType
},
inferredType: {
name: Vt.inferredType
},
name: {
name: Vt.name
},
operators: {
name: Vt.operators
},
parameters: {
name: Vt.parameters,
defaultValue: []
},
returnType: {
name: Vt.returnType,
referenceType: kt.$type
}
},
superTypes: [Hs.$type]
},
InfixRuleOperatorList: {
name: go.$type,
properties: {
associativity: {
name: go.associativity
},
operators: {
name: go.operators,
defaultValue: []
}
},
superTypes: []
},
InfixRuleOperators: {
name: hu.$type,
properties: {
precedences: {
name: hu.precedences,
defaultValue: []
}
},
superTypes: []
},
Interface: {
name: Li.$type,
properties: {
attributes: {
name: Li.attributes,
defaultValue: []
},
name: {
name: Li.name
},
superTypes: {
name: Li.superTypes,
defaultValue: [],
referenceType: kt.$type
}
},
superTypes: [kt.$type]
},
Keyword: {
name: Oi.$type,
properties: {
cardinality: {
name: Oi.cardinality
},
predicate: {
name: Oi.predicate
},
value: {
name: Oi.value
}
},
superTypes: [lt.$type]
},
NamedArgument: {
name: Ds.$type,
properties: {
calledByName: {
name: Ds.calledByName,
defaultValue: !1
},
parameter: {
name: Ds.parameter,
referenceType: Ms.$type
},
value: {
name: Ds.value
}
},
superTypes: []
},
NegatedToken: {
name: dr.$type,
properties: {
cardinality: {
name: dr.cardinality
},
lookahead: {
name: dr.lookahead
},
parenthesized: {
name: dr.parenthesized,
defaultValue: !1
},
terminal: {
name: dr.terminal
}
},
superTypes: [yt.$type]
},
Negation: {
name: zo.$type,
properties: {
value: {
name: zo.value
}
},
superTypes: [ir.$type]
},
NumberLiteral: {
name: pu.$type,
properties: {
value: {
name: pu.value
}
},
superTypes: [wi.$type]
},
Parameter: {
name: Ms.$type,
properties: {
name: {
name: Ms.name
}
},
superTypes: []
},
ParameterReference: {
name: Bo.$type,
properties: {
parameter: {
name: Bo.parameter,
referenceType: Ms.$type
}
},
superTypes: [ir.$type]
},
ParserRule: {
name: Dt.$type,
properties: {
dataType: {
name: Dt.dataType
},
definition: {
name: Dt.definition
},
entry: {
name: Dt.entry,
defaultValue: !1
},
fragment: {
name: Dt.fragment,
defaultValue: !1
},
inferredType: {
name: Dt.inferredType
},
name: {
name: Dt.name
},
parameters: {
name: Dt.parameters,
defaultValue: []
},
returnType: {
name: Dt.returnType,
referenceType: kt.$type
}
},
superTypes: [Hs.$type]
},
ReferenceType: {
name: yo.$type,
properties: {
isMulti: {
name: yo.isMulti,
defaultValue: !1
},
referenceType: {
name: yo.referenceType
}
},
superTypes: [Ni.$type]
},
RegexToken: {
name: fr.$type,
properties: {
cardinality: {
name: fr.cardinality
},
lookahead: {
name: fr.lookahead
},
parenthesized: {
name: fr.parenthesized,
defaultValue: !1
},
regex: {
name: fr.regex
}
},
superTypes: [yt.$type]
},
ReturnType: {
name: qo.$type,
properties: {
name: {
name: qo.name
}
},
superTypes: []
},
RuleCall: {
name: hr.$type,
properties: {
arguments: {
name: hr.arguments,
defaultValue: []
},
cardinality: {
name: hr.cardinality
},
predicate: {
name: hr.predicate
},
rule: {
name: hr.rule,
referenceType: xs.$type
}
},
superTypes: [lt.$type]
},
SimpleType: {
name: xi.$type,
properties: {
primitiveType: {
name: xi.primitiveType
},
stringType: {
name: xi.stringType
},
typeRef: {
name: xi.typeRef,
referenceType: kt.$type
}
},
superTypes: [Ni.$type]
},
StringLiteral: {
name: mu.$type,
properties: {
value: {
name: mu.value
}
},
superTypes: [wi.$type]
},
TerminalAlternatives: {
name: pr.$type,
properties: {
cardinality: {
name: pr.cardinality
},
elements: {
name: pr.elements,
defaultValue: []
},
lookahead: {
name: pr.lookahead
},
parenthesized: {
name: pr.parenthesized,
defaultValue: !1
}
},
superTypes: [yt.$type]
},
TerminalElement: {
name: yt.$type,
properties: {
cardinality: {
name: yt.cardinality
},
lookahead: {
name: yt.lookahead
},
parenthesized: {
name: yt.parenthesized,
defaultValue: !1
}
},
superTypes: [lt.$type]
},
TerminalGroup: {
name: mr.$type,
properties: {
cardinality: {
name: mr.cardinality
},
elements: {
name: mr.elements,
defaultValue: []
},
lookahead: {
name: mr.lookahead
},
parenthesized: {
name: mr.parenthesized,
defaultValue: !1
}
},
superTypes: [yt.$type]
},
TerminalRule: {
name: hn.$type,
properties: {
definition: {
name: hn.definition
},
fragment: {
name: hn.fragment,
defaultValue: !1
},
hidden: {
name: hn.hidden,
defaultValue: !1
},
name: {
name: hn.name
},
type: {
name: hn.type
}
},
superTypes: [xs.$type]
},
TerminalRuleCall: {
name: gr.$type,
properties: {
cardinality: {
name: gr.cardinality
},
lookahead: {
name: gr.lookahead
},
parenthesized: {
name: gr.parenthesized,
defaultValue: !1
},
rule: {
name: gr.rule,
referenceType: hn.$type
}
},
superTypes: [yt.$type]
},
Type: {
name: Qs.$type,
properties: {
name: {
name: Qs.name
},
type: {
name: Qs.type
}
},
superTypes: [kt.$type]
},
TypeAttribute: {
name: ki.$type,
properties: {
defaultValue: {
name: ki.defaultValue
},
isOptional: {
name: ki.isOptional,
defaultValue: !1
},
name: {
name: ki.name
},
type: {
name: ki.type
}
},
superTypes: []
},
TypeDefinition: {
name: Ni.$type,
properties: {},
superTypes: []
},
UnionType: {
name: gu.$type,
properties: {
types: {
name: gu.types,
defaultValue: []
}
},
superTypes: [Ni.$type]
},
UnorderedGroup: {
name: Zs.$type,
properties: {
cardinality: {
name: Zs.cardinality
},
elements: {
name: Zs.elements,
defaultValue: []
}
},
superTypes: [lt.$type]
},
UntilToken: {
name: yr.$type,
properties: {
cardinality: {
name: yr.cardinality
},
lookahead: {
name: yr.lookahead
},
parenthesized: {
name: yr.parenthesized,
defaultValue: !1
},
terminal: {
name: yr.terminal
}
},
superTypes: [yt.$type]
},
ValueLiteral: {
name: wi.$type,
properties: {},
superTypes: []
},
Wildcard: {
name: Di.$type,
properties: {
cardinality: {
name: Di.cardinality
},
lookahead: {
name: Di.lookahead
},
parenthesized: {
name: Di.parenthesized,
defaultValue: !1
}
},
superTypes: [yt.$type]
}
};
}
}
const Z = new Qf();
function Wo(t) {
return new Ll(t, (e) => Vi(e) ? e.content : [], { includeRoot: !0 });
}
function Km(t, e) {
for (; t.container; )
if (t = t.container, t === e)
return !0;
return !1;
}
function Vo(t) {
return {
start: {
character: t.startColumn - 1,
line: t.startLine - 1
},
end: {
character: t.endColumn,
// endColumn uses the correct index
line: t.endLine - 1
}
};
}
function da(t) {
if (!t)
return;
const { offset: e, end: n, range: r } = t;
return {
range: r,
offset: e,
end: n,
length: n - e
};
}
var Xt;
(function(t) {
t[t.Before = 0] = "Before", t[t.After = 1] = "After", t[t.OverlapFront = 2] = "OverlapFront", t[t.OverlapBack = 3] = "OverlapBack", t[t.Inside = 4] = "Inside", t[t.Outside = 5] = "Outside";
})(Xt || (Xt = {}));
function Hm(t, e) {
if (t.end.line < e.start.line || t.end.line === e.start.line && t.end.character <= e.start.character)
return Xt.Before;
if (t.start.line > e.end.line || t.start.line === e.end.line && t.start.character >= e.end.character)
return Xt.After;
const n = t.start.line > e.start.line || t.start.line === e.start.line && t.start.character >= e.start.character, r = t.end.line < e.end.line || t.end.line === e.end.line && t.end.character <= e.end.character;
return n && r ? Xt.Inside : n ? Xt.OverlapBack : r ? Xt.OverlapFront : Xt.Outside;
}
function Ym(t, e) {
return Hm(t, e) > Xt.After;
}
const Xm = /^[\w\p{L}]$/u;
function Jm(t, e) {
if (t) {
const n = Qm(t, !0);
if (n && yu(n, e))
return n;
if (Vf(t)) {
const r = t.content.findIndex((i) => !i.hidden);
for (let i = r - 1; i >= 0; i--) {
const s = t.content[i];
if (yu(s, e))
return s;
}
}
}
}
function yu(t, e) {
return Wf(t) && e.includes(t.tokenType.name);
}
function Qm(t, e = !0) {
for (; t.container; ) {
const n = t.container;
let r = n.content.indexOf(t);
for (; r > 0; ) {
r--;
const i = n.content[r];
if (e || !i.hidden)
return i;
}
t = n;
}
}
class Zf extends Error {
constructor(e, n) {
super(e ? `${n} at ${e.range.start.line}:${e.range.start.character}` : n);
}
}
function us(t, e = "Error: Got unexpected value.") {
throw new Error(e);
}
function W(t) {
return t.charCodeAt(0);
}
function To(t, e) {
Array.isArray(t) ? t.forEach(function(n) {
e.push(n);
}) : e.push(t);
}
function bi(t, e) {
if (t[e] === !0)
throw "duplicate flag " + e;
t[e], t[e] = !0;
}
function sr(t) {
if (t === void 0)
throw Error("Internal Error - Should never get here!");
return !0;
}
function Zm() {
throw Error("Internal Error - Should never get here!");
}
function Tu(t) {
return t.type === "Character";
}
const fa = [];
for (let t = W("0"); t <= W("9"); t++)
fa.push(t);
const ha = [W("_")].concat(fa);
for (let t = W("a"); t <= W("z"); t++)
ha.push(t);
for (let t = W("A"); t <= W("Z"); t++)
ha.push(t);
const Ru = [
W(" "),
W("\f"),
W(`
`),
W("\r"),
W(" "),
W("\v"),
W(" "),
W(" "),
W(" "),
W(" "),
W(" "),
W(" "),
W(" "),
W(" "),
W(" "),
W(" "),
W(" "),
W(" "),
W(" "),
W(" "),
W("\u2028"),
W("\u2029"),
W(" "),
W(" "),
W(" "),
W("\uFEFF")
], eg = /[0-9a-fA-F]/, Fs = /[0-9]/, tg = /[1-9]/;
class eh {
constructor() {
this.idx = 0, this.input = "", this.groupIdx = 0;
}
saveState() {
return {
idx: this.idx,
input: this.input,
groupIdx: this.groupIdx
};
}
restoreState(e) {
this.idx = e.idx, this.input = e.input, this.groupIdx = e.groupIdx;
}
pattern(e) {
this.idx = 0, this.input = e, this.groupIdx = 0, this.consumeChar("/");
const n = this.disjunction();
this.consumeChar("/");
const r = {
type: "Flags",
loc: { begin: this.idx, end: e.length },
global: !1,
ignoreCase: !1,
multiLine: !1,
unicode: !1,
sticky: !1
};
for (; this.isRegExpFlag(); )
switch (this.popChar()) {
case "g":
bi(r, "global");
break;
case "i":
bi(r, "ignoreCase");
break;
case "m":
bi(r, "multiLine");
break;
case "u":
bi(r, "unicode");
break;
case "y":
bi(r, "sticky");
break;
}
if (this.idx !== this.input.length)
throw Error("Redundant input: " + this.input.substring(this.idx));
return {
type: "Pattern",
flags: r,
value: n,
loc: this.loc(0)
};
}
disjunction() {
const e = [], n = this.idx;
for (e.push(this.alternative()); this.peekChar() === "|"; )
this.consumeChar("|"), e.push(this.alternative());
return { type: "Disjunction", value: e, loc: this.loc(n) };
}
alternative() {
const e = [], n = this.idx;
for (; this.isTerm(); )
e.push(this.term());
return { type: "Alternative", value: e, loc: this.loc(n) };
}
term() {
return this.isAssertion() ? this.assertion() : this.atom();
}
assertion() {
const e = this.idx;
switch (this.popChar()) {
case "^":
return {
type: "StartAnchor",
loc: this.loc(e)
};
case "$":
return { type: "EndAnchor", loc: this.loc(e) };
case "\\":
switch (this.popChar()) {
case "b":
return {
type: "WordBoundary",
loc: this.loc(e)
};
case "B":
return {
type: "NonWordBoundary",
loc: this.loc(e)
};
}
throw Error("Invalid Assertion Escape");
case "(":
this.consumeChar("?");
let n;
switch (this.popChar()) {
case "=":
n = "Lookahead";
break;
case "!":
n = "NegativeLookahead";
break;
case "<": {
switch (this.popChar()) {
case "=":
n = "Lookbehind";
break;
case "!":
n = "NegativeLookbehind";
}
break;
}
}
sr(n);
const r = this.disjunction();
return this.consumeChar(")"), {
type: n,
value: r,
loc: this.loc(e)
};
}
return Zm();
}
quantifier(e = !1) {
let n;
const r = this.idx;
switch (this.popChar()) {
case "*":
n = {
atLeast: 0,
atMost: 1 / 0
};
break;
case "+":
n = {
atLeast: 1,
atMost: 1 / 0
};
break;
case "?":
n = {
atLeast: 0,
atMost: 1
};
break;
case "{":
const i = this.integerIncludingZero();
switch (this.popChar()) {
case "}":
n = {
atLeast: i,
atMost: i
};
break;
case ",":
let s;
this.isDigit() ? (s = this.integerIncludingZero(), n = {
atLeast: i,
atMost: s
}) : n = {
atLeast: i,
atMost: 1 / 0
}, this.consumeChar("}");
break;
}
if (e === !0 && n === void 0)
return;
sr(n);
break;
}
if (!(e === !0 && n === void 0) && sr(n))
return this.peekChar(0) === "?" ? (this.consumeChar("?"), n.greedy = !1) : n.greedy = !0, n.type = "Quantifier", n.loc = this.loc(r), n;
}
atom() {
let e;
const n = this.idx;
switch (this.peekChar()) {
case ".":
e = this.dotAll();
break;
case "\\":
e = this.atomEscape();
break;
case "[":
e = this.characterClass();
break;
case "(":
e = this.group();
break;
}
if (e === void 0 && this.isPatternCharacter() && (e = this.patternCharacter()), sr(e))
return e.loc = this.loc(n), this.isQuantifier() && (e.quantifier = this.quantifier()), e;
}
dotAll() {
return this.consumeChar("."), {
type: "Set",
complement: !0,
value: [W(`
`), W("\r"), W("\u2028"), W("\u2029")]
};
}
atomEscape() {
switch (this.consumeChar("\\"), this.peekChar()) {
case "1":
case "2":
case "3":
case "4":
case "5":
case "6":
case "7":
case "8":
case "9":
return this.decimalEscapeAtom();
case "d":
case "D":
case "s":
case "S":
case "w":
case "W":
return this.characterClassEscape();
case "f":
case "n":
case "r":
case "t":
case "v":
return this.controlEscapeAtom();
case "c":
return this.controlLetterEscapeAtom();
case "0":
return this.nulCharacterAtom();
case "x":
return this.hexEscapeSequenceAtom();
case "u":
return this.regExpUnicodeEscapeSequenceAto