@dbml/parse 9.0.0-alpha.10 → 9.0.0-alpha.12

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.
@@ -15459,13 +15459,167 @@ function Qb(e, t, n = !1) {
15459
15459
  return i;
15460
15460
  }
15461
15461
  //#endregion
15462
- //#region src/compiler/queries/transform/utils.ts
15462
+ //#region src/core/utils/setting.ts
15463
15463
  function $b(e, t) {
15464
- if ((e.schema && e.schema.length > 0 ? e.schema : "public") !== (t.schema && t.schema.length > 0 ? t.schema : "public") || e.table !== t.table) return !1;
15465
- let n = e.fields ?? [], r = t.fields ?? [];
15464
+ let n = rx(e);
15465
+ if (n) {
15466
+ let e = n.elementList ?? [], r = e.findIndex((e) => e instanceof I ? hs(e)?.toLowerCase() === t.toLowerCase() : !1);
15467
+ if (r !== -1) return {
15468
+ kind: "attribute",
15469
+ settingsList: n,
15470
+ settingNode: e[r],
15471
+ settingIndex: r
15472
+ };
15473
+ }
15474
+ if (e instanceof F) {
15475
+ let n = ix(e, t);
15476
+ if (n) return {
15477
+ kind: "body",
15478
+ declaration: n
15479
+ };
15480
+ }
15481
+ }
15482
+ function ex(e, t) {
15483
+ let n = rx(e);
15484
+ if (n) {
15485
+ let e = n.end - 1;
15486
+ return {
15487
+ start: e,
15488
+ end: e,
15489
+ newText: `, ${t}`
15490
+ };
15491
+ }
15492
+ if (e instanceof F) {
15493
+ let n = e.body;
15494
+ if (n && !(n instanceof z)) return {
15495
+ start: n.start,
15496
+ end: n.start,
15497
+ newText: `[${t}] `
15498
+ };
15499
+ }
15500
+ return {
15501
+ start: e.end,
15502
+ end: e.end,
15503
+ newText: ` [${t}]`
15504
+ };
15505
+ }
15506
+ function tx(e, t, n, r) {
15507
+ if (n === null) return nx(e, t, r);
15508
+ let i = n === void 0 ? t : `${t}: ${n}`, a = $b(e, t);
15509
+ if (a) {
15510
+ let e = a.kind === "attribute" ? a.settingNode : a.declaration;
15511
+ return {
15512
+ start: e.start,
15513
+ end: e.end,
15514
+ newText: i
15515
+ };
15516
+ }
15517
+ return ex(e, i);
15518
+ }
15519
+ function nx(e, t, n) {
15520
+ let r = $b(e, t);
15521
+ if (!r) return;
15522
+ if (r.kind === "body") return {
15523
+ start: r.declaration.start,
15524
+ end: r.declaration.end,
15525
+ newText: ""
15526
+ };
15527
+ let { settingsList: i, settingIndex: a } = r, o = i.elementList ?? [];
15528
+ if (o.length === 1) {
15529
+ let e = i.start;
15530
+ for (; e > 0 && n[e - 1] === " ";) e--;
15531
+ return {
15532
+ start: e,
15533
+ end: i.end,
15534
+ newText: ""
15535
+ };
15536
+ }
15537
+ let s = o[a];
15538
+ if (a === 0) {
15539
+ let e = o[a + 1];
15540
+ return {
15541
+ start: s.start,
15542
+ end: e.start,
15543
+ newText: ""
15544
+ };
15545
+ }
15546
+ return {
15547
+ start: o[a - 1].end,
15548
+ end: s.end,
15549
+ newText: ""
15550
+ };
15551
+ }
15552
+ function rx(e) {
15553
+ if (e instanceof z) return e.args.find((e) => e instanceof V);
15554
+ if (e instanceof F) {
15555
+ if (e.attributeList) return e.attributeList;
15556
+ let t = e.body;
15557
+ if (t instanceof z) return t.args.find((e) => e instanceof V);
15558
+ }
15559
+ }
15560
+ function ix(e, t) {
15561
+ let n = e.body;
15562
+ if (!(!n || Po(e) || n instanceof z)) {
15563
+ for (let e of n.body) if (e instanceof F && e.type?.value?.toLowerCase() === t.toLowerCase()) return e;
15564
+ }
15565
+ }
15566
+ //#endregion
15567
+ //#region src/compiler/queries/transform/utils/ref.ts
15568
+ function ax(e, n, r) {
15569
+ let a = e.parseFile(n).getValue().ast, o = e.nodeSymbol(a).getFiltered(t);
15570
+ if (!o) return;
15571
+ let s = e.getSource(n) ?? "";
15572
+ for (let t of e.symbolMetadata(o)) if (t instanceof pc && sx(e, t, r)) {
15573
+ if (t.declaration instanceof I) {
15574
+ let n = t.op(e);
15575
+ if (!n) continue;
15576
+ let r = t.declaration.parentOfKind(z);
15577
+ if (!r) continue;
15578
+ let a = nx(r, i.Ref, s);
15579
+ if (!a) continue;
15580
+ return {
15581
+ kind: "inline",
15582
+ op: n,
15583
+ fullStart: a.start,
15584
+ fullEnd: a.end
15585
+ };
15586
+ }
15587
+ if (t.declaration instanceof F) {
15588
+ let e = cs(t.declaration)[0];
15589
+ if (e instanceof z) return {
15590
+ kind: "standalone",
15591
+ node: e
15592
+ };
15593
+ }
15594
+ }
15595
+ }
15596
+ function ox(e, t, n) {
15597
+ if (!e?.name || e.name !== n.tableName) return !1;
15598
+ let r = n.fieldNames ?? [];
15599
+ return r.length === 0 ? !0 : t.length === r.length ? t.every((e, t) => e.name === r[t]) : !1;
15600
+ }
15601
+ function sx(e, t, n) {
15602
+ let r = t.leftTable(e), i = t.leftColumns(e), a = t.rightTable(e), o = t.rightColumns(e), [s, c] = n.endpoints;
15603
+ return ox(r, i, s) && ox(a, o, c) || ox(r, i, c) && ox(a, o, s);
15604
+ }
15605
+ //#endregion
15606
+ //#region src/compiler/queries/transform/utils/index.ts
15607
+ function cx(e) {
15608
+ return e && e.length > 0 ? e : y;
15609
+ }
15610
+ function lx(e, t) {
15611
+ if (cx(e.schemaName) !== cx(t.schemaName) || e.tableName !== t.tableName) return !1;
15612
+ let n = e.fieldNames ?? [], r = t.fieldNames ?? [];
15466
15613
  return n.length === r.length ? n.every((e, t) => e === r[t]) : !1;
15467
15614
  }
15468
- function ex(e) {
15615
+ function ux(e, t) {
15616
+ if (cx(e.schemaName) !== cx(t.schemaName) || e.tableName !== t.tableName) return !1;
15617
+ let n = t.fieldNames ?? [];
15618
+ if (n.length === 0) return !0;
15619
+ let r = e.fieldNames ?? [];
15620
+ return r.length === n.length ? r.every((e, t) => e === n[t]) : !1;
15621
+ }
15622
+ function dx(e) {
15469
15623
  if (typeof e != "string") return {
15470
15624
  schema: e.schema ?? "public",
15471
15625
  table: e.table
@@ -15489,24 +15643,33 @@ function ex(e) {
15489
15643
  table: n
15490
15644
  };
15491
15645
  }
15492
- function tx(e, n, r, i, a = M.Table) {
15646
+ function fx(e, n, r, i, a = M.Table) {
15493
15647
  let o = e.parseFile(n).getValue().ast, s = e.nodeSymbol(o).getFiltered(t);
15494
15648
  if (!s) return;
15495
15649
  if (r === "public") return e.lookupMembers(s, a, i) ?? void 0;
15496
15650
  let c = e.lookupMembers(s, M.Schema, r);
15497
15651
  if (c) return e.lookupMembers(c, a, i) ?? void 0;
15498
15652
  }
15499
- function nx(e) {
15653
+ function px(e) {
15500
15654
  return e.startsWith("\"") && e.endsWith("\"") && e.length >= 2 ? e.slice(1, -1) : e;
15501
15655
  }
15656
+ function mx(e) {
15657
+ let t = [];
15658
+ e.schemaName && e.schemaName !== "public" && t.push(_g(e.schemaName)), t.push(_g(e.tableName));
15659
+ for (let n of e.fieldNames ?? []) t.push(_g(n));
15660
+ return t.join(".");
15661
+ }
15662
+ function hx(e, t) {
15663
+ return t === void 0 ? e : t === null ? "" : `${e}: ${t}`;
15664
+ }
15502
15665
  //#endregion
15503
15666
  //#region src/compiler/queries/transform/renameTable.ts
15504
- function rx(e, t) {
15667
+ function gx(e, t) {
15505
15668
  if (!e || !(e instanceof F)) return !1;
15506
15669
  let n = e.name;
15507
15670
  return n ? t.substring(n.start, n.end).includes("\"") : !1;
15508
15671
  }
15509
- function ix(e, t, n) {
15672
+ function _x(e, t, n) {
15510
15673
  let r = !gg(t), i = !gg(e), a = n || r, o = n || i;
15511
15674
  return {
15512
15675
  schema: e,
@@ -15517,10 +15680,10 @@ function ix(e, t, n) {
15517
15680
  shouldQuoteTable: a
15518
15681
  };
15519
15682
  }
15520
- function ax(e, t, n, r, i, a) {
15521
- return n === i && r === a ? !1 : tx(e, t, i, a) !== void 0;
15683
+ function vx(e, t, n, r, i, a) {
15684
+ return n === i && r === a ? !1 : fx(e, t, i, a) !== void 0;
15522
15685
  }
15523
- function ox(e, t, n) {
15686
+ function yx(e, t, n) {
15524
15687
  let r = e.start - 1;
15525
15688
  for (; r >= 0 && /\s/.test(n[r]);) r--;
15526
15689
  if (r < 0 || n[r] !== ".") return null;
@@ -15535,19 +15698,19 @@ function ox(e, t, n) {
15535
15698
  for (a = r + 1; r >= 0 && /[a-zA-Z0-9_]/.test(n[r]);) r--;
15536
15699
  i = r + 1;
15537
15700
  }
15538
- return nx(n.substring(i, a)) === t ? {
15701
+ return px(n.substring(i, a)) === t ? {
15539
15702
  start: i,
15540
15703
  end: e.end
15541
15704
  } : null;
15542
15705
  }
15543
- function sx(e) {
15706
+ function bx(e) {
15544
15707
  return e.schema === "public" ? e.formattedTable : `${e.formattedSchema}.${e.formattedTable}`;
15545
15708
  }
15546
- function cx(e, t, n, r, i) {
15547
- let a = [], o = /* @__PURE__ */ new Set(), s = sx(r);
15709
+ function xx(e, t, n, r, i) {
15710
+ let a = [], o = /* @__PURE__ */ new Set(), s = bx(r);
15548
15711
  for (let r of e) {
15549
- if (nx(i.substring(r.start, r.end)) !== n) continue;
15550
- let e = ox(r, t, i) ?? {
15712
+ if (px(i.substring(r.start, r.end)) !== n) continue;
15713
+ let e = yx(r, t, i) ?? {
15551
15714
  start: r.start,
15552
15715
  end: r.end
15553
15716
  }, c = `${e.start}-${e.end}`;
@@ -15559,19 +15722,19 @@ function cx(e, t, n, r, i) {
15559
15722
  }
15560
15723
  return a;
15561
15724
  }
15562
- function lx(e, n, r) {
15563
- let i = ex(n), a = ex(r), o = i.schema, s = i.table, c = a.schema, l = a.table, u = tx(this, e, o, s);
15564
- if (!u || u instanceof Us || ax(this, e, o, s, c, l)) return /* @__PURE__ */ new Map();
15725
+ function Sx(e, n, r) {
15726
+ let i = dx(n), a = dx(r), o = i.schema, s = i.table, c = a.schema, l = a.table, u = fx(this, e, o, s);
15727
+ if (!u || u instanceof Us || vx(this, e, o, s, c, l)) return /* @__PURE__ */ new Map();
15565
15728
  if (u instanceof Ws && u.useSpecifierDeclaration instanceof Ys && u.useSpecifierDeclaration.alias) {
15566
15729
  let n = u.useSpecifierDeclaration;
15567
- if (this.nodeAlias(n).getFiltered(t) === s) return ux(this, e, n, u, c, l);
15730
+ if (this.nodeAlias(n).getFiltered(t) === s) return Cx(this, e, n, u, c, l);
15568
15731
  }
15569
- return dx(this, u, o, s, c, l);
15732
+ return wx(this, u, o, s, c, l);
15570
15733
  }
15571
- function ux(e, t, n, r, i, a) {
15734
+ function Cx(e, t, n, r, i, a) {
15572
15735
  let o = e.getSource(t) ?? "";
15573
15736
  if (!n.alias) return /* @__PURE__ */ new Map();
15574
- let s = ix(i, a, o.substring(n.alias.start, n.alias.end).includes("\"")), c = [];
15737
+ let s = _x(i, a, o.substring(n.alias.start, n.alias.end).includes("\"")), c = [];
15575
15738
  c.push({
15576
15739
  start: n.alias.start,
15577
15740
  end: n.alias.end,
@@ -15585,12 +15748,12 @@ function ux(e, t, n, r, i, a) {
15585
15748
  });
15586
15749
  return new Map([[t.absolute, Qb(o, c)]]);
15587
15750
  }
15588
- function dx(e, t, n, r, i, a) {
15751
+ function wx(e, t, n, r, i, a) {
15589
15752
  let o = t.originalSymbol, s = o.declaration;
15590
15753
  if (!s || !(s instanceof F)) return /* @__PURE__ */ new Map();
15591
15754
  let c = s.filepath;
15592
15755
  if (!c) return /* @__PURE__ */ new Map();
15593
- let l = ix(i, a, rx(s, e.getSource(c) ?? "")), u = /* @__PURE__ */ new Map(), d = (e, t) => {
15756
+ let l = _x(i, a, gx(s, e.getSource(c) ?? "")), u = /* @__PURE__ */ new Map(), d = (e, t) => {
15594
15757
  let n = e.absolute, r = u.get(n);
15595
15758
  r || (r = {
15596
15759
  fp: e,
@@ -15600,13 +15763,13 @@ function dx(e, t, n, r, i, a) {
15600
15763
  f && d(c, {
15601
15764
  start: f.start,
15602
15765
  end: f.end,
15603
- newText: sx(l)
15766
+ newText: bx(l)
15604
15767
  });
15605
15768
  let p = e.symbolReferences(o);
15606
15769
  for (let t of p) {
15607
15770
  if (t === f) continue;
15608
15771
  let i = t.filepath, a = e.getSource(i) ?? "";
15609
- for (let e of cx([t], n, r, l, a)) d(i, e);
15772
+ for (let e of xx([t], n, r, l, a)) d(i, e);
15610
15773
  }
15611
15774
  let m = /* @__PURE__ */ new Map();
15612
15775
  for (let { fp: t, edits: n } of u.values()) {
@@ -15616,131 +15779,26 @@ function dx(e, t, n, r, i, a) {
15616
15779
  return m;
15617
15780
  }
15618
15781
  //#endregion
15619
- //#region src/core/utils/setting.ts
15620
- function fx(e, t) {
15621
- let n = gx(e);
15622
- if (n) {
15623
- let e = n.elementList ?? [], r = e.findIndex((e) => e instanceof I ? hs(e)?.toLowerCase() === t.toLowerCase() : !1);
15624
- if (r !== -1) return {
15625
- kind: "attribute",
15626
- settingsList: n,
15627
- settingNode: e[r],
15628
- settingIndex: r
15629
- };
15630
- }
15631
- if (e instanceof F) {
15632
- let n = _x(e, t);
15633
- if (n) return {
15634
- kind: "body",
15635
- declaration: n
15636
- };
15637
- }
15638
- }
15639
- function px(e, t) {
15640
- let n = gx(e);
15641
- if (n) {
15642
- let e = n.end - 1;
15643
- return {
15644
- start: e,
15645
- end: e,
15646
- newText: `, ${t}`
15647
- };
15648
- }
15649
- if (e instanceof F) {
15650
- let n = e.body;
15651
- if (n && !(n instanceof z)) return {
15652
- start: n.start,
15653
- end: n.start,
15654
- newText: `[${t}] `
15655
- };
15656
- }
15657
- return {
15658
- start: e.end,
15659
- end: e.end,
15660
- newText: ` [${t}]`
15661
- };
15662
- }
15663
- function mx(e, t, n, r) {
15664
- if (n === null) return hx(e, t, r);
15665
- let i = n === void 0 ? t : `${t}: ${n}`, a = fx(e, t);
15666
- if (a) {
15667
- let e = a.kind === "attribute" ? a.settingNode : a.declaration;
15668
- return {
15669
- start: e.start,
15670
- end: e.end,
15671
- newText: i
15672
- };
15673
- }
15674
- return px(e, i);
15675
- }
15676
- function hx(e, t, n) {
15677
- let r = fx(e, t);
15678
- if (!r) return;
15679
- if (r.kind === "body") return {
15680
- start: r.declaration.start,
15681
- end: r.declaration.end,
15682
- newText: ""
15683
- };
15684
- let { settingsList: i, settingIndex: a } = r, o = i.elementList ?? [];
15685
- if (o.length === 1) {
15686
- let e = i.start;
15687
- for (; e > 0 && n[e - 1] === " ";) e--;
15688
- return {
15689
- start: e,
15690
- end: i.end,
15691
- newText: ""
15692
- };
15693
- }
15694
- let s = o[a];
15695
- if (a === 0) {
15696
- let e = o[a + 1];
15697
- return {
15698
- start: s.start,
15699
- end: e.start,
15700
- newText: ""
15701
- };
15702
- }
15703
- return {
15704
- start: o[a - 1].end,
15705
- end: s.end,
15706
- newText: ""
15707
- };
15708
- }
15709
- function gx(e) {
15710
- if (e instanceof z) return e.args.find((e) => e instanceof V);
15711
- if (e instanceof F) {
15712
- if (e.attributeList) return e.attributeList;
15713
- let t = e.body;
15714
- if (t instanceof z) return t.args.find((e) => e instanceof V);
15715
- }
15716
- }
15717
- function _x(e, t) {
15718
- let n = e.body;
15719
- if (!(!n || Po(e) || n instanceof z)) {
15720
- for (let e of n.body) if (e instanceof F && e.type?.value?.toLowerCase() === t.toLowerCase()) return e;
15721
- }
15722
- }
15723
- //#endregion
15724
15782
  //#region src/core/utils/note.ts
15725
- function vx(e, t) {
15726
- let n = xx(e);
15783
+ function Tx(e, t) {
15784
+ let n = Ox(e);
15727
15785
  if (n) return {
15728
15786
  start: n.noteValueStart,
15729
15787
  end: n.noteValueEnd,
15730
15788
  newText: wg(t)
15731
15789
  };
15732
15790
  }
15733
- function yx(e) {
15734
- let t = xx(e);
15791
+ function Ex(e) {
15792
+ let t = Ox(e);
15735
15793
  if (t) return {
15736
15794
  start: t.fullNoteStart,
15737
15795
  end: t.fullNoteEnd,
15738
15796
  newText: ""
15739
15797
  };
15740
15798
  }
15741
- function bx(e, t) {
15742
- if (xx(e) || !(e instanceof F)) return;
15743
- let n = Sx(e);
15799
+ function Dx(e, t) {
15800
+ if (Ox(e) || !(e instanceof F)) return;
15801
+ let n = kx(e);
15744
15802
  if (n !== void 0) return {
15745
15803
  start: n,
15746
15804
  end: n,
@@ -15764,12 +15822,12 @@ function bx(e, t) {
15764
15822
  };
15765
15823
  }
15766
15824
  }
15767
- function xx(e) {
15825
+ function Ox(e) {
15768
15826
  if (!(e instanceof F)) return;
15769
15827
  let t = e.body;
15770
15828
  if (t && !(t instanceof z)) for (let e of t.body) {
15771
15829
  if (!(e instanceof F) || !e.isKind(r.Note)) continue;
15772
- let t = Cx(e);
15830
+ let t = Ax(e);
15773
15831
  if (t) return {
15774
15832
  kind: qs.ELEMENT_DECLARATION,
15775
15833
  noteValueStart: t.start,
@@ -15779,18 +15837,18 @@ function xx(e) {
15779
15837
  };
15780
15838
  }
15781
15839
  let n = e.attributeList ?? (t instanceof z ? t.args.find((e) => e instanceof V) : void 0);
15782
- if (n) return wx(n);
15840
+ if (n) return jx(n);
15783
15841
  }
15784
- function Sx(e) {
15842
+ function kx(e) {
15785
15843
  let t = e.body;
15786
15844
  if (!(!t || t instanceof z) && t.blockCloseBrace) return t.blockCloseBrace.start;
15787
15845
  }
15788
- function Cx(e) {
15846
+ function Ax(e) {
15789
15847
  let t = e.body;
15790
15848
  if (t instanceof z) return t.callee ?? void 0;
15791
15849
  if (t instanceof B && t.body[0] instanceof z) return t.body[0].callee ?? void 0;
15792
15850
  }
15793
- function wx(e) {
15851
+ function jx(e) {
15794
15852
  let t = S(e).getValue()[i.Note];
15795
15853
  if (!t?.length) return;
15796
15854
  let n = t[0];
@@ -15806,175 +15864,168 @@ function wx(e) {
15806
15864
  }
15807
15865
  //#endregion
15808
15866
  //#region src/compiler/queries/transform/syncDep.ts
15809
- function Tx(e) {
15810
- let t = [], n = new jb(e, To).lex();
15811
- if (n.getErrors().length > 0) return t;
15812
- let i = new Fb(e, n.getValue(), new Ks(), To).parse();
15813
- if (i.getErrors().length > 0) return t;
15814
- let a = i.getValue().ast;
15815
- for (let e of a.declarations) {
15816
- if (!(e instanceof F) || !e.isKind(r.Dep)) continue;
15817
- let n = [], i = e.body;
15867
+ function Mx(e) {
15868
+ let t = Fx(e);
15869
+ return t ? Nx(t) : [];
15870
+ }
15871
+ function Nx(e) {
15872
+ let t = [];
15873
+ for (let n of e.declarations) {
15874
+ if (!(n instanceof F) || !n.isKind(r.Dep)) continue;
15875
+ let e = [], i = n.body;
15818
15876
  if (i instanceof z) {
15819
15877
  if (i.callee instanceof R) {
15820
- let e = Nx(i.callee);
15821
- e && n.push(e);
15878
+ let t = Vx(i.callee);
15879
+ t && e.push(t);
15822
15880
  }
15823
15881
  } else if (i) {
15824
- for (let e of i.body) if (e instanceof z && e.callee instanceof R) {
15825
- let t = Nx(e.callee);
15826
- t && n.push(t);
15882
+ for (let t of i.body) if (t instanceof z && t.callee instanceof R) {
15883
+ let n = Vx(t.callee);
15884
+ n && e.push(n);
15827
15885
  }
15828
15886
  }
15829
15887
  t.push({
15830
- startIndex: e.start,
15831
- endIndex: e.end,
15832
- declaration: e,
15833
- edges: n
15888
+ startIndex: n.start,
15889
+ endIndex: n.end,
15890
+ declaration: n,
15891
+ edges: e
15834
15892
  });
15835
15893
  }
15836
15894
  return t;
15837
15895
  }
15838
- function Ex(e) {
15839
- let t = [], n = new jb(e, To).lex();
15840
- if (n.getErrors().length > 0) return t;
15841
- let a = new Fb(e, n.getValue(), new Ks(), To).parse();
15842
- if (a.getErrors().length > 0) return t;
15843
- let o = a.getValue().ast;
15844
- for (let n of o.declarations) {
15845
- if (!(n instanceof F) || !n.isKind(r.Table)) continue;
15846
- let a = n.name ? O(n.name) ?? [] : [];
15847
- if (a.length === 0) continue;
15848
- let o = a[a.length - 1], s = a.length > 1 ? a[a.length - 2] : void 0, c = n.body;
15849
- if (!(!c || c instanceof z)) for (let n of c.body) {
15850
- if (!(n instanceof z) || !n.callee) continue;
15851
- let r = O(n.callee)?.at(-1);
15896
+ function Px(e, t) {
15897
+ let n = [];
15898
+ for (let a of t.declarations) {
15899
+ if (!(a instanceof F) || !a.isKind(r.Table)) continue;
15900
+ let t = a.name ? O(a.name) ?? [] : [];
15901
+ if (t.length === 0) continue;
15902
+ let o = t[t.length - 1], s = t.length > 1 ? t[t.length - 2] : void 0, c = a.body;
15903
+ if (!(!c || c instanceof z)) for (let t of c.body) {
15904
+ if (!(t instanceof z) || !t.callee) continue;
15905
+ let r = O(t.callee)?.at(-1);
15852
15906
  if (!r) continue;
15853
15907
  let a = {
15854
- schema: s,
15855
- table: o,
15856
- fields: [r]
15857
- }, c = hx(n, i.Dep, e);
15858
- if (c) for (let e of Bx(n, a)) t.push({
15908
+ schemaName: s,
15909
+ tableName: o,
15910
+ fieldNames: [r]
15911
+ }, c = nx(t, i.Dep, e);
15912
+ if (c) for (let e of qx(t, a)) n.push({
15859
15913
  edge: e,
15860
15914
  stripStart: c.start,
15861
15915
  stripEnd: c.end
15862
15916
  });
15863
15917
  }
15864
15918
  }
15865
- return t;
15919
+ return n;
15866
15920
  }
15867
- function Dx(e, t) {
15868
- return `Dep [color: ${t}] {\n ${Fx(e.upstream)} -> ${Fx(e.downstream)}\n}`;
15869
- }
15870
- function Ox(e, t, n) {
15871
- let r = this.getSource(e) ?? "", i = n ?? Tx(r), a = Ex(r), o = [];
15872
- for (let e of t) o.push(...Vx(r, e, i, a));
15873
- return o.sort((e, t) => t.start - e.start), {
15874
- newDbml: Qb(r, o, !0),
15875
- edits: o
15876
- };
15921
+ function Fx(e) {
15922
+ let t = new jb(e, To).lex();
15923
+ if (t.getErrors().length > 0) return;
15924
+ let n = new Fb(e, t.getValue(), new Ks(), To).parse();
15925
+ if (!(n.getErrors().length > 0)) return n.getValue().ast;
15877
15926
  }
15878
- function kx(e) {
15879
- return e && e.length > 0 ? e : y;
15927
+ function Ix(e, t) {
15928
+ return `Dep [color: ${t}] {\n ${mx(e.upstream)} -> ${mx(e.downstream)}\n}`;
15880
15929
  }
15881
- function Ax(e, t) {
15930
+ function Lx(e, t, n) {
15931
+ let r = this.getSource(e) ?? "", i = this.parseFile(e).getValue().ast, a = n ?? Nx(i), o = Px(r, i), s = [];
15932
+ for (let e of t) s.push(...Jx(r, e, a, o));
15933
+ return s.sort((e, t) => t.start - e.start), {
15934
+ newDbml: Qb(r, s, !0),
15935
+ edits: s
15936
+ };
15937
+ }
15938
+ function Rx(e, t) {
15882
15939
  if (e.length === 0) return;
15883
15940
  if (!t) {
15884
15941
  let t = e[e.length - 1];
15885
15942
  return {
15886
- schema: e.length > 1 ? e[e.length - 2] : void 0,
15887
- table: t,
15888
- fields: []
15943
+ schemaName: e.length > 1 ? e[e.length - 2] : null,
15944
+ tableName: t,
15945
+ fieldNames: []
15889
15946
  };
15890
15947
  }
15891
15948
  let n = [e[e.length - 1]], r = e[e.length - 2];
15892
15949
  return {
15893
- schema: e.length > 2 ? e[e.length - 3] : void 0,
15894
- table: r,
15895
- fields: n
15950
+ schemaName: e.length > 2 ? e[e.length - 3] : null,
15951
+ tableName: r,
15952
+ fieldNames: n
15896
15953
  };
15897
15954
  }
15898
- function jx(e, t) {
15899
- return $b(e.upstream, t.upstream) && $b(e.downstream, t.downstream);
15955
+ function zx(e, t) {
15956
+ return lx(e.upstream, t.upstream) && lx(e.downstream, t.downstream);
15900
15957
  }
15901
- function Mx(e, t) {
15902
- return e.edges.some((e) => jx(e, t));
15958
+ function Bx(e, t) {
15959
+ return e.edges.some((e) => zx(e, t));
15903
15960
  }
15904
- function Nx(e) {
15961
+ function Vx(e) {
15905
15962
  let t = e.op?.value;
15906
15963
  if (t !== "->" && t !== "<-") return;
15907
15964
  let n = e.leftExpression, r = e.rightExpression;
15908
15965
  if (!n || !r) return;
15909
15966
  let i = t === "<-" ? r : n, a = t === "<-" ? n : r, o = O(i), s = O(a);
15910
15967
  if (!o || !s) return;
15911
- let c = o.length > 1 && s.length > 1, l = Ax(o, c), u = Ax(s, c);
15968
+ let c = o.length > 1 && s.length > 1, l = Rx(o, c), u = Rx(s, c);
15912
15969
  if (!(!l || !u)) return {
15913
15970
  upstream: l,
15914
15971
  downstream: u
15915
15972
  };
15916
15973
  }
15917
- function Px(e) {
15974
+ function Hx(e) {
15918
15975
  if (e.name instanceof Zs) return as(e.name)?.toLowerCase();
15919
15976
  }
15920
- function Fx(e) {
15921
- let t = kx(e.schema), n = [];
15922
- t !== "public" && n.push(_g(t)), n.push(_g(e.table));
15923
- for (let t of e.fields ?? []) n.push(_g(t));
15924
- return n.join(".");
15925
- }
15926
- function Ix(e, t) {
15927
- return e.find((e) => Mx(e, t));
15977
+ function Ux(e, t) {
15978
+ return e.find((e) => Bx(e, t));
15928
15979
  }
15929
- function Lx(e, t, n) {
15980
+ function Wx(e, t, n) {
15930
15981
  let r = [];
15931
15982
  if (e.color !== void 0) {
15932
- let a = mx(t.declaration, i.Color, e.color, n);
15983
+ let a = tx(t.declaration, i.Color, e.color, n);
15933
15984
  a && r.push(a);
15934
15985
  }
15935
15986
  if (e.note === null) {
15936
- let e = yx(t.declaration);
15987
+ let e = Ex(t.declaration);
15937
15988
  e && r.push(e);
15938
15989
  } else if (e.note !== void 0) {
15939
- let n = vx(t.declaration, e.note) ?? bx(t.declaration, e.note);
15990
+ let n = Tx(t.declaration, e.note) ?? Dx(t.declaration, e.note);
15940
15991
  n && r.push(n);
15941
15992
  }
15942
15993
  return r;
15943
15994
  }
15944
- function Rx(e, t, n, r) {
15945
- let i = Ix(n, t.edge);
15946
- if (i) return Lx(t, i, e);
15947
- let a = Dx(t.edge, t.color ?? ""), o = {
15995
+ function Gx(e, t, n, r) {
15996
+ let i = Ux(n, t.edge);
15997
+ if (i) return Wx(t, i, e);
15998
+ let a = Ix(t.edge, t.color ?? ""), o = {
15948
15999
  start: e.length,
15949
16000
  end: e.length,
15950
16001
  newText: "\n\n" + a + "\n"
15951
- }, s = r.find((e) => jx(e.edge, t.edge));
16002
+ }, s = r.find((e) => zx(e.edge, t.edge));
15952
16003
  return s ? [{
15953
16004
  start: s.stripStart,
15954
16005
  end: s.stripEnd,
15955
16006
  newText: ""
15956
16007
  }, o] : [o];
15957
16008
  }
15958
- function zx(e, t, n) {
16009
+ function Kx(e, t, n) {
15959
16010
  let r = e.color === void 0 && e.note === void 0;
15960
- return Lx({
16011
+ return Wx({
15961
16012
  ...e,
15962
16013
  color: r ? null : e.color
15963
16014
  }, t, n);
15964
16015
  }
15965
- function Bx(e, t) {
16016
+ function qx(e, t) {
15966
16017
  let n = e.args.find((e) => e instanceof V);
15967
16018
  if (!n) return [];
15968
16019
  let r = [];
15969
16020
  for (let e of n.elementList) {
15970
- if (Px(e) !== i.Dep) continue;
16021
+ if (Hx(e) !== i.Dep) continue;
15971
16022
  let n = e.value;
15972
16023
  if (!(n instanceof L) || !n.expression) continue;
15973
16024
  let a = n.op?.value;
15974
16025
  if (a !== "->" && a !== "<-") continue;
15975
16026
  let o = O(n.expression);
15976
16027
  if (!o) continue;
15977
- let s = Ax(o, o.length > 1);
16028
+ let s = Rx(o, o.length > 1);
15978
16029
  s && r.push(a === "->" ? {
15979
16030
  upstream: t,
15980
16031
  downstream: s
@@ -15985,104 +16036,98 @@ function Bx(e, t) {
15985
16036
  }
15986
16037
  return r;
15987
16038
  }
15988
- function Vx(e, t, n, r) {
16039
+ function Jx(e, t, n, r) {
15989
16040
  switch (t.operation) {
15990
- case "create": return Rx(e, t, n, r);
16041
+ case "create": return Gx(e, t, n, r);
15991
16042
  case "update": {
15992
- let r = Ix(n, t.edge);
15993
- return r ? Lx(t, r, e) : [];
16043
+ let r = Ux(n, t.edge);
16044
+ return r ? Wx(t, r, e) : [];
15994
16045
  }
15995
16046
  case "remove": {
15996
- let r = Ix(n, t.edge);
15997
- return r ? zx(t, r, e) : [];
16047
+ let r = Ux(n, t.edge);
16048
+ return r ? Kx(t, r, e) : [];
15998
16049
  }
15999
16050
  default: return [];
16000
16051
  }
16001
16052
  }
16002
16053
  //#endregion
16003
16054
  //#region src/compiler/queries/transform/updateElementSetting.ts
16004
- function Hx(e, t, n, r) {
16005
- let i = this.getSource(e) ?? "";
16006
- if (t.kind === "dep") return Wx(i, t, n, r);
16007
- if (t.kind === "ref") return Gx(i, t, n, r);
16008
- let a = Ux(this, e, t);
16009
- if (!a) return i;
16010
- let o = mx(a, n, r, i);
16011
- return o ? Qb(i, [o]) : i;
16012
- }
16013
- function Ux(e, t, n) {
16055
+ function Yx(e, t, n, r) {
16056
+ if (t.kind === "dep") return Qx(this, e, t, n, r);
16057
+ if (t.kind === "ref") return $x(this, e, t, n, r);
16058
+ let i = Zx(this, e, t);
16059
+ if (!i) return [];
16060
+ let a = tx(i, n, r, this.getSource(e) ?? "");
16061
+ return a ? [a] : [];
16062
+ }
16063
+ function Xx(e, t, n, r) {
16064
+ let i = this.getSource(e) ?? "", a = this.updateElementSettingEdit(e, t, n, r);
16065
+ return a.length === 0 ? i : Qb(i, a);
16066
+ }
16067
+ function Zx(e, t, n) {
16014
16068
  let r = ("schema" in n ? n.schema : void 0) ?? "public";
16015
16069
  switch (n.kind) {
16016
16070
  case M.Column: {
16017
- let i = tx(e, t, r, n.table, M.Table);
16071
+ let i = fx(e, t, r, n.table, M.Table);
16018
16072
  return i ? e.lookupMembers(i, M.Column, n.column)?.declaration : void 0;
16019
16073
  }
16020
- case M.Table: return tx(e, t, r, n.table)?.declaration;
16074
+ case M.Table: return fx(e, t, r, n.table)?.declaration;
16021
16075
  case M.Enum:
16022
16076
  case M.StickyNote:
16023
- case M.TableGroup: return tx(e, t, r, n.name, n.kind)?.declaration;
16024
- case M.Schema: return tx(e, t, n.schema, "", M.Schema)?.declaration;
16077
+ case M.TableGroup: return fx(e, t, r, n.name, n.kind)?.declaration;
16078
+ case M.Schema: return fx(e, t, n.schema, "", M.Schema)?.declaration;
16025
16079
  default: return;
16026
16080
  }
16027
16081
  }
16028
- function Wx(e, t, n, r) {
16029
- let i = Tx(e).find((e) => e.edges.some((e) => $b(e.upstream, t.upstream) && $b(e.downstream, t.downstream)));
16030
- if (!i) return e;
16031
- let { declaration: a } = i, { body: o } = a;
16032
- if (o instanceof z) {
16033
- let t = mx(a, n, r, e);
16034
- if (t) return Qb(e, [t]);
16035
- let i = mx(o, n, r, e);
16036
- return i ? Qb(e, [i]) : e;
16082
+ function Qx(e, t, n, r, i) {
16083
+ let a = e.getSource(t) ?? "", o = e.parseFile(t).getValue().ast, s = Nx(o).find((e) => e.edges.some((e) => lx(e.upstream, n.upstream) && lx(e.downstream, n.downstream)));
16084
+ if (!s) {
16085
+ if (i === null) return [];
16086
+ let e = Px(a, o).find((e) => ux(e.edge.upstream, n.upstream) && ux(e.edge.downstream, n.downstream));
16087
+ if (!e) return [];
16088
+ let t = mx(n.upstream), s = mx(n.downstream), c = hx(r, i), l = c ? `Dep [${c}] {\n ${t} -> ${s}\n}` : `Dep {\n ${t} -> ${s}\n}`;
16089
+ return [{
16090
+ start: e.stripStart,
16091
+ end: e.stripEnd,
16092
+ newText: ""
16093
+ }, {
16094
+ start: a.length,
16095
+ end: a.length,
16096
+ newText: "\n\n" + l + "\n"
16097
+ }];
16037
16098
  }
16038
- let s = mx(a, n, r, e);
16039
- return s ? Qb(e, [s]) : e;
16040
- }
16041
- function Gx(e, t, n, r) {
16042
- let i = Jx(e, t);
16043
- if (!i) return e;
16044
- let a = mx(i, n, r, e);
16045
- return a ? Qb(e, [a]) : e;
16046
- }
16047
- function Kx(e) {
16048
- if (e.length !== 0) return e.length === 1 ? { table: e[0] } : e.length === 2 ? {
16049
- table: e[0],
16050
- fields: [e[1]]
16051
- } : {
16052
- schema: e[0],
16053
- table: e[1],
16054
- fields: e.slice(2)
16055
- };
16056
- }
16057
- function qx(e, t) {
16058
- let n = e.leftExpression ? O(e.leftExpression) : null, r = e.rightExpression ? O(e.rightExpression) : null;
16059
- if (!n || !r) return !1;
16060
- let i = Kx(n), a = Kx(r);
16061
- if (!i || !a) return !1;
16062
- let [o, s] = t.endpoints;
16063
- return $b(i, o) && $b(a, s) || $b(i, s) && $b(a, o);
16064
- }
16065
- function Jx(e, t) {
16066
- let n = new jb(e, To).lex();
16067
- if (n.getErrors().length > 0) return;
16068
- let i = new Fb(e, n.getValue(), new Ks(), To).parse();
16069
- if (i.getErrors().length > 0) return;
16070
- let a = i.getValue().ast;
16071
- for (let e of a.declarations) {
16072
- if (!(e instanceof F) || !e.isKind(r.Ref)) continue;
16073
- let n = e.body;
16074
- if (n instanceof z && n.callee instanceof R) {
16075
- if (qx(n.callee, t)) return n;
16076
- continue;
16077
- }
16078
- if (n && !(n instanceof z)) {
16079
- for (let e of n.body) if (e instanceof z && e.callee instanceof R && qx(e.callee, t)) return e;
16080
- }
16099
+ let { declaration: c } = s, { body: l } = c;
16100
+ if (l instanceof z) {
16101
+ let e = tx(c, r, i, a);
16102
+ if (e) return [e];
16103
+ let t = tx(l, r, i, a);
16104
+ return t ? [t] : [];
16105
+ }
16106
+ let u = tx(c, r, i, a);
16107
+ return u ? [u] : [];
16108
+ }
16109
+ function $x(e, t, n, r, i) {
16110
+ let a = e.getSource(t) ?? "", o = ax(e, t, n);
16111
+ if (!o) return [];
16112
+ if (o.kind === "inline") {
16113
+ if (i === null) return [];
16114
+ let e = mx(n.endpoints[0]), t = mx(n.endpoints[1]), s = hx(r, i), c = s ? `Ref: ${e} ${o.op} ${t} [${s}]` : `Ref: ${e} ${o.op} ${t}`;
16115
+ return [{
16116
+ start: o.fullStart,
16117
+ end: o.fullEnd,
16118
+ newText: ""
16119
+ }, {
16120
+ start: a.length,
16121
+ end: a.length,
16122
+ newText: "\n\n" + c + "\n"
16123
+ }];
16081
16124
  }
16125
+ let s = tx(o.node, r, i, a);
16126
+ return s ? [s] : [];
16082
16127
  }
16083
16128
  //#endregion
16084
16129
  //#region src/compiler/queries/transform/syncDiagramView.ts
16085
- function Yx(e) {
16130
+ function eS(e) {
16086
16131
  let t = [], n = new jb(e, To).lex();
16087
16132
  if (n.getErrors().length > 0) return t;
16088
16133
  let i = new Fb(e, n.getValue(), new Ks(), To).parse();
@@ -16098,36 +16143,36 @@ function Yx(e) {
16098
16143
  }
16099
16144
  return t;
16100
16145
  }
16101
- function Xx(e, t, n) {
16146
+ function tS(e, t, n) {
16102
16147
  e.push(` ${t} {`), n.forEach((t) => e.push(` ${t}`)), e.push(" }");
16103
16148
  }
16104
- function Zx(e, t) {
16149
+ function nS(e, t) {
16105
16150
  e.push(` ${t} { * }`);
16106
16151
  }
16107
- function Qx(e) {
16152
+ function rS(e) {
16108
16153
  return e == null ? "null" : e.length === 0 ? "empty" : "items";
16109
16154
  }
16110
- function $x(e, t) {
16155
+ function iS(e, t) {
16111
16156
  let n = `DiagramView ${_g(e)} {`, r = (e) => _g(e.name), i = t?.tables?.map((e) => {
16112
16157
  let t = _g(e.name);
16113
16158
  return e.schemaName === "public" ? t : `${_g(e.schemaName)}.${t}`;
16114
16159
  }) ?? [], a = t?.tableGroups?.map(r) ?? [], o = t?.schemas?.map(r) ?? [], s = t?.stickyNotes?.map(r) ?? [];
16115
16160
  if (!t) return `${n}\n}`;
16116
16161
  let c = {
16117
- tables: Qx(t.tables),
16118
- tableGroups: Qx(t.tableGroups),
16119
- schemas: Qx(t.schemas),
16120
- stickyNotes: Qx(t.stickyNotes)
16162
+ tables: rS(t.tables),
16163
+ tableGroups: rS(t.tableGroups),
16164
+ schemas: rS(t.schemas),
16165
+ stickyNotes: rS(t.stickyNotes)
16121
16166
  };
16122
16167
  if (Object.values(c).every((e) => e === "null")) return `${n}\n}`;
16123
16168
  if (Object.values(c).every((e) => e === "empty")) return `${n}\n *\n}`;
16124
16169
  let l = c.tables === "items" || c.tableGroups === "items" || c.schemas === "items", u = c.tables === "empty" && c.tableGroups === "empty" && c.schemas === "empty", d = [n];
16125
- return l ? (c.tables === "items" && Xx(d, "Tables", i), c.tableGroups === "items" && Xx(d, "TableGroups", a), c.schemas === "items" && Xx(d, "Schemas", o)) : u && Zx(d, "Tables"), c.stickyNotes === "items" ? Xx(d, "Notes", s) : c.stickyNotes === "empty" && Zx(d, "Notes"), d.push("}"), d.join("\n");
16170
+ return l ? (c.tables === "items" && tS(d, "Tables", i), c.tableGroups === "items" && tS(d, "TableGroups", a), c.schemas === "items" && tS(d, "Schemas", o)) : u && nS(d, "Tables"), c.stickyNotes === "items" ? tS(d, "Notes", s) : c.stickyNotes === "empty" && nS(d, "Notes"), d.push("}"), d.join("\n");
16126
16171
  }
16127
- function eS(e, t, n) {
16128
- let r = this.getSource(e) ?? "", i = n ?? Yx(r), a = [];
16172
+ function aS(e, t, n) {
16173
+ let r = this.getSource(e) ?? "", i = n ?? eS(r), a = [];
16129
16174
  for (let e of t) {
16130
- let t = tS(r, e, i);
16175
+ let t = oS(r, e, i);
16131
16176
  a.push(...t);
16132
16177
  }
16133
16178
  return a.sort((e, t) => t.start - e.start), {
@@ -16135,29 +16180,29 @@ function eS(e, t, n) {
16135
16180
  edits: a
16136
16181
  };
16137
16182
  }
16138
- function tS(e, t, n) {
16183
+ function oS(e, t, n) {
16139
16184
  switch (t.operation) {
16140
- case "create": return nS(e, t, n);
16141
- case "update": return rS(e, t, n);
16142
- case "delete": return iS(e, t, n);
16185
+ case "create": return sS(e, t, n);
16186
+ case "update": return cS(e, t, n);
16187
+ case "delete": return lS(e, t, n);
16143
16188
  default: return [];
16144
16189
  }
16145
16190
  }
16146
- function nS(e, t, n) {
16147
- if (n.find((e) => e.name === t.name)) return rS(e, t, n);
16148
- let r = "\n\n" + $x(t.name, t.visibleEntities) + "\n";
16191
+ function sS(e, t, n) {
16192
+ if (n.find((e) => e.name === t.name)) return cS(e, t, n);
16193
+ let r = "\n\n" + iS(t.name, t.visibleEntities) + "\n";
16149
16194
  return [{
16150
16195
  start: e.length,
16151
16196
  end: e.length,
16152
16197
  newText: r
16153
16198
  }];
16154
16199
  }
16155
- function rS(e, t, n) {
16200
+ function cS(e, t, n) {
16156
16201
  let r = n.find((e) => e.name === t.name);
16157
16202
  if (!r) return [];
16158
16203
  let i = [];
16159
16204
  if (t.newName || t.visibleEntities) {
16160
- let e = $x(t.newName || t.name, t.visibleEntities);
16205
+ let e = iS(t.newName || t.name, t.visibleEntities);
16161
16206
  i.push({
16162
16207
  start: r.startIndex,
16163
16208
  end: r.endIndex,
@@ -16166,7 +16211,7 @@ function rS(e, t, n) {
16166
16211
  }
16167
16212
  return i;
16168
16213
  }
16169
- function iS(e, t, n) {
16214
+ function lS(e, t, n) {
16170
16215
  let r = n.find((e) => e.name === t.name);
16171
16216
  if (!r) return [];
16172
16217
  let i = r.startIndex, a = r.endIndex;
@@ -16186,9 +16231,9 @@ function iS(e, t, n) {
16186
16231
  }
16187
16232
  //#endregion
16188
16233
  //#region src/compiler/index.ts
16189
- var aS = Symbol("COMPUTING"), oS = class {
16234
+ var uS = Symbol("COMPUTING"), dS = class {
16190
16235
  constructor(e) {
16191
- this.layout = e, this.nodeIdGenerator = new Ks(), this.symbolIdGenerator = new ws(), this.symbolFactory = new $a(this.symbolIdGenerator), this.sourceSnapshot = /* @__PURE__ */ new Map(), this.globalCache = /* @__PURE__ */ new Map(), this.globallyQuerying = !1, this.localCache = /* @__PURE__ */ new Map(), this.parseFile = this.localQuery(Hb), this.parseProject = this.globalQuery(Ub), this.validateNode = this.localQuery(U_), this.validateFile = this.localQuery(Ab), this.nodeFullname = this.localQuery(G_), this.nodeAlias = this.localQuery(K_), this.nodeSettings = this.localQuery(W_), this.canonicalName = this.globalQuery(db), this.bindNode = this.globalQuery($g), this.bindFile = this.globalQuery(Eb), this.bindProject = this.globalQuery(Db), this.interpretSymbol = this.globalQuery(t_), this.interpretMetadata = this.globalQuery(n_), this.interpretFile = this.globalQuery(Ob), this.interpretProject = this.globalQuery(kb), this.nodeSymbol = this.globalQuery(Xg), this.nodeMetadata = this.globalQuery(e_), this.symbolMembers = this.globalQuery(Zg), this.symbolMembersLookupMap = this.globalQuery(Wb), this.lookupMembers = this.globalQuery(Gb), this.nodeReferee = this.globalQuery(Qg), this.resolutionIndex = this.globalQuery(qb), this.symbolReferences = this.globalQuery(Yb), this.symbolParent = this.globalQuery(Jb), this.symbolMetadata = this.globalQuery(Xb), this.symbolAliases = this.globalQuery(Kb), this.symbolUses = this.globalQuery(Zb), this.fileDependencies = this.localQuery(mb), this.reachableFiles = this.globalQuery(gb), this.usableMembers = this.globalQuery(Qh), this.nodeAtPosition = this.localQuery(Tb), this.renameTable = lx.bind(this), this.updateElementSetting = Hx.bind(this), this.syncDiagramView = eS.bind(this), this.syncDep = Ox.bind(this), this.token = {
16236
+ this.layout = e, this.nodeIdGenerator = new Ks(), this.symbolIdGenerator = new ws(), this.symbolFactory = new $a(this.symbolIdGenerator), this.sourceSnapshot = /* @__PURE__ */ new Map(), this.globalCache = /* @__PURE__ */ new Map(), this.globallyQuerying = !1, this.localCache = /* @__PURE__ */ new Map(), this.parseFile = this.localQuery(Hb), this.parseProject = this.globalQuery(Ub), this.validateNode = this.localQuery(U_), this.validateFile = this.localQuery(Ab), this.nodeFullname = this.localQuery(G_), this.nodeAlias = this.localQuery(K_), this.nodeSettings = this.localQuery(W_), this.canonicalName = this.globalQuery(db), this.bindNode = this.globalQuery($g), this.bindFile = this.globalQuery(Eb), this.bindProject = this.globalQuery(Db), this.interpretSymbol = this.globalQuery(t_), this.interpretMetadata = this.globalQuery(n_), this.interpretFile = this.globalQuery(Ob), this.interpretProject = this.globalQuery(kb), this.nodeSymbol = this.globalQuery(Xg), this.nodeMetadata = this.globalQuery(e_), this.symbolMembers = this.globalQuery(Zg), this.symbolMembersLookupMap = this.globalQuery(Wb), this.lookupMembers = this.globalQuery(Gb), this.nodeReferee = this.globalQuery(Qg), this.resolutionIndex = this.globalQuery(qb), this.symbolReferences = this.globalQuery(Yb), this.symbolParent = this.globalQuery(Jb), this.symbolMetadata = this.globalQuery(Xb), this.symbolAliases = this.globalQuery(Kb), this.symbolUses = this.globalQuery(Zb), this.fileDependencies = this.localQuery(mb), this.reachableFiles = this.globalQuery(gb), this.usableMembers = this.globalQuery(Qh), this.nodeAtPosition = this.localQuery(Tb), this.renameTable = Sx.bind(this), this.updateElementSetting = Xx.bind(this), this.updateElementSettingEdit = Yx.bind(this), this.syncDiagramView = aS.bind(this), this.syncDep = Lx.bind(this), this.token = {
16192
16237
  invalidStream: this.localQuery(wb),
16193
16238
  flatStream: this.localQuery(Cb)
16194
16239
  }, this.parse = {
@@ -16230,10 +16275,10 @@ var aS = Symbol("COMPUTING"), oS = class {
16230
16275
  r || (r = /* @__PURE__ */ new Map(), this.globalCache.set(t, r));
16231
16276
  let i = n.length === 0 ? "" : n.length === 1 ? Ec(n[0]) : n.map((e) => Ec(e)).join("\0"), a = r.get(i);
16232
16277
  if (a) {
16233
- if (a === aS) throw Error(`Cycle detected in query: ${e.name}(${i})`);
16278
+ if (a === uS) throw Error(`Cycle detected in query: ${e.name}(${i})`);
16234
16279
  return a;
16235
16280
  }
16236
- r.set(i, aS);
16281
+ r.set(i, uS);
16237
16282
  try {
16238
16283
  let t = e.apply(this, n);
16239
16284
  return r.set(i, t), t;
@@ -16255,10 +16300,10 @@ var aS = Symbol("COMPUTING"), oS = class {
16255
16300
  let c = s.get(t);
16256
16301
  if (c || (c = /* @__PURE__ */ new Map(), s.set(t, c)), c.has(o)) {
16257
16302
  let t = c.get(o);
16258
- if (t === aS) throw Error(`Cycle detected in query: ${e.name}(${a}, ${o})`);
16303
+ if (t === uS) throw Error(`Cycle detected in query: ${e.name}(${a}, ${o})`);
16259
16304
  return t;
16260
16305
  }
16261
- c.set(o, aS);
16306
+ c.set(o, uS);
16262
16307
  try {
16263
16308
  let t = e.apply(this, n);
16264
16309
  return c.set(o, t), t;
@@ -16276,7 +16321,7 @@ var aS = Symbol("COMPUTING"), oS = class {
16276
16321
  diagnosticsProvider: new ny(this)
16277
16322
  };
16278
16323
  }
16279
- }, sS = class e {
16324
+ }, fS = class e {
16280
16325
  constructor(e = {}) {
16281
16326
  this.files = e instanceof Map ? new Map(e) : new Map(Object.entries(e));
16282
16327
  }
@@ -16320,4 +16365,4 @@ var aS = Symbol("COMPUTING"), oS = class {
16320
16365
  }
16321
16366
  };
16322
16367
  //#endregion
16323
- export { cc as ArrayNode, I as AttributeNode, B as BlockExpressionNode, H as CallExpressionNode, tc as CommaExpressionNode, x as CompileError, b as CompileErrorCode, oS as Compiler, X as CompletionItemInsertTextRule, Y as CompletionItemKind, Ay as DBMLCompletionItemProvider, ty as DBMLDefinitionProvider, ny as DBMLDiagnosticsProvider, ry as DBMLReferencesProvider, To as DEFAULT_ENTRY, F as ElementDeclarationNode, r as ElementKind, sc as EmptyNode, Qm as FALSY_VALUES, yo as Filepath, z as FunctionApplicationNode, $s as FunctionExpressionNode, nc as GroupExpressionNode, Zs as IdentifierStreamNode, R as InfixExpressionNode, V as ListExpressionNode, rc as LiteralNode, Qv as MarkerSeverity, sS as MemoryProjectLayout, dc as MetadataKind, Qs as PostfixExpressionNode, L as PrefixExpressionNode, oc as PrimaryExpressionNode, P as ProgramNode, Q as ScopeKind, M as SymbolKind, N as SyntaxNode, Ks as SyntaxNodeIdGenerator, qs as SyntaxNodeKind, Va as SyntaxToken, v as SyntaxTokenKind, Zm as TRUTHY_VALUES, ec as TupleExpressionNode, t as UNHANDLED, Vv as Uri, Js as UseDeclarationNode, Xs as UseSpecifierListNode, Ys as UseSpecifierNode, ac as VariableNode, ic as WildcardNode, _g as addDoubleQuoteIfNeeded, ib as dbmlLanguageConfig, ab as dbmlMonarchTokensProvider, yg as escapeString, fs as extractNumericLiteral, Jm as extractSignedNumber, Tx as findDepBlocks, Yx as findDiagramViewBlocks, bg as formatRecordValue, Al as getRecordValueType, Dl as isBinaryType, Tl as isBooleanType, Ol as isDateTimeType, Km as isEmptyStringLiteral, Cl as isFloatType, qm as isFunctionExpression, Sl as isIntegerType, Gm as isNullish, wl as isNumericType, za as isOp, Ba as isOpToken, kl as isSerialType, El as isStringType, Ra as isTriviaToken, gg as isValidIdentifier, xl as normalizeTypeName, xg as splitQualifiedIdentifier, $m as tryExtractBoolean, ah as tryExtractDateTime, eh as tryExtractEnum, Xm as tryExtractInteger, Ym as tryExtractNumeric, th as tryExtractString, vg as unescapeString, Oh as validateForeignKeys, _h as validatePrimaryKey, wh as validateUnique };
16368
+ export { cc as ArrayNode, I as AttributeNode, B as BlockExpressionNode, H as CallExpressionNode, tc as CommaExpressionNode, x as CompileError, b as CompileErrorCode, dS as Compiler, X as CompletionItemInsertTextRule, Y as CompletionItemKind, Ay as DBMLCompletionItemProvider, ty as DBMLDefinitionProvider, ny as DBMLDiagnosticsProvider, ry as DBMLReferencesProvider, To as DEFAULT_ENTRY, F as ElementDeclarationNode, r as ElementKind, sc as EmptyNode, Qm as FALSY_VALUES, yo as Filepath, z as FunctionApplicationNode, $s as FunctionExpressionNode, nc as GroupExpressionNode, Zs as IdentifierStreamNode, R as InfixExpressionNode, V as ListExpressionNode, rc as LiteralNode, Qv as MarkerSeverity, fS as MemoryProjectLayout, dc as MetadataKind, Qs as PostfixExpressionNode, L as PrefixExpressionNode, oc as PrimaryExpressionNode, P as ProgramNode, Q as ScopeKind, M as SymbolKind, N as SyntaxNode, Ks as SyntaxNodeIdGenerator, qs as SyntaxNodeKind, Va as SyntaxToken, v as SyntaxTokenKind, Zm as TRUTHY_VALUES, ec as TupleExpressionNode, t as UNHANDLED, Vv as Uri, Js as UseDeclarationNode, Xs as UseSpecifierListNode, Ys as UseSpecifierNode, ac as VariableNode, ic as WildcardNode, _g as addDoubleQuoteIfNeeded, ib as dbmlLanguageConfig, ab as dbmlMonarchTokensProvider, yg as escapeString, fs as extractNumericLiteral, Jm as extractSignedNumber, Mx as findDepBlocks, eS as findDiagramViewBlocks, bg as formatRecordValue, Al as getRecordValueType, Dl as isBinaryType, Tl as isBooleanType, Ol as isDateTimeType, Km as isEmptyStringLiteral, Cl as isFloatType, qm as isFunctionExpression, Sl as isIntegerType, Gm as isNullish, wl as isNumericType, za as isOp, Ba as isOpToken, kl as isSerialType, El as isStringType, Ra as isTriviaToken, gg as isValidIdentifier, xl as normalizeTypeName, xg as splitQualifiedIdentifier, $m as tryExtractBoolean, ah as tryExtractDateTime, eh as tryExtractEnum, Xm as tryExtractInteger, Ym as tryExtractNumeric, th as tryExtractString, vg as unescapeString, Oh as validateForeignKeys, _h as validatePrimaryKey, wh as validateUnique };