@data_wise/hyper-markdown 1.5.3 → 1.5.5

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.
@@ -65880,6 +65880,12 @@ class R0t extends Xk {
65880
65880
  setDataSourceFunctions(e) {
65881
65881
  this.dataSourceFunctions = e;
65882
65882
  }
65883
+ // 获取容器行号(如果存在)
65884
+ _getLineNumber(e) {
65885
+ var n;
65886
+ const r = (n = e == null ? void 0 : e.dataset) == null ? void 0 : n.lineStart;
65887
+ return r ? parseInt(r, 10) : null;
65888
+ }
65883
65889
  /**
65884
65890
  * 渲染所有数据集容器
65885
65891
  */
@@ -65892,53 +65898,54 @@ class R0t extends Xk {
65892
65898
  const r = Array.from(e).map(async (a, s) => {
65893
65899
  if (a.dataset.rendered)
65894
65900
  return;
65895
- const o = a.dataset.originalCode || a.textContent || a.dataset.dataset || "", l = a.dataset.datasetId || `dataset-${s}`;
65901
+ const o = a.dataset.originalCode || a.textContent || a.dataset.dataset || "", l = a.dataset.datasetId || `dataset-${s}`, u = this._getLineNumber(a);
65896
65902
  try {
65897
- const u = a.dataset.dataset || "", h = a.dataset.isDatasource === "true" || a.dataset.isDatasource === !0;
65898
- if (!u.trim())
65903
+ const h = a.dataset.dataset || "", d = a.dataset.isDatasource === "true" || a.dataset.isDatasource === !0;
65904
+ if (!h.trim())
65899
65905
  throw new Error("数据集内容为空");
65900
- let d;
65901
- if (h)
65902
- d = await this.parseDataSourceQuery(u);
65906
+ let f;
65907
+ if (d)
65908
+ f = await this.parseDataSourceQuery(h);
65903
65909
  else
65904
65910
  try {
65905
- d = new Function(`return (${u})`)();
65911
+ f = new Function(`return (${h})`)();
65906
65912
  } catch {
65907
65913
  try {
65908
- d = JSON.parse(u);
65914
+ f = JSON.parse(h);
65909
65915
  } catch {
65910
65916
  throw new Error("无法解析数据集配置");
65911
65917
  }
65912
65918
  }
65913
- this.renderDataset(a, d, l), a.dataset.rendered = "true";
65914
- } catch (u) {
65919
+ this.renderDataset(a, f, l), a.dataset.rendered = "true";
65920
+ } catch (h) {
65915
65921
  console.error("❌ Dataset 渲染错误详情:", {
65916
- message: u.message,
65917
- name: u.name,
65918
- stack: u.stack,
65922
+ message: h.message,
65923
+ name: h.name,
65924
+ stack: h.stack,
65919
65925
  datasetId: l,
65920
65926
  code: o
65921
65927
  });
65922
- const h = `
65928
+ const d = `
65923
65929
  <div class="dataset-error" style="user-select: text; cursor: text; white-space: pre-wrap; word-wrap: break-word;">
65924
65930
  ❌ 数据集渲染错误
65925
65931
 
65926
- 错误信息: ${u.message}
65932
+ 错误信息: ${h.message}
65927
65933
 
65928
- ${u.stack ? `堆栈信息:
65929
- ${u.stack}` : ""}
65934
+ ${h.stack ? `堆栈信息:
65935
+ ${h.stack}` : ""}
65930
65936
 
65931
65937
  数据集ID: ${l}
65932
65938
  </div>
65933
65939
  `;
65934
- throw a.innerHTML = h, this.addError({
65940
+ throw a.innerHTML = d, this.addError({
65935
65941
  type: "Dataset",
65936
- message: u.message,
65942
+ message: h.message,
65937
65943
  code: o,
65938
65944
  datasetId: l,
65939
- stack: u.stack,
65940
- timestamp: Date.now()
65941
- }), u;
65945
+ stack: h.stack,
65946
+ timestamp: Date.now(),
65947
+ line: u
65948
+ }), h;
65942
65949
  }
65943
65950
  }), i = (await Promise.allSettled(r)).filter((a) => a.status === "rejected");
65944
65951
  i.length > 0 && (console.error(`
@@ -66012,32 +66019,34 @@ ${"=".repeat(60)}`), console.error(`❌ ${i.length} 个数据集渲染失败`),
66012
66019
  * 渲染单个数据集
66013
66020
  */
66014
66021
  renderDataset(e, r, n) {
66022
+ const i = this._getLineNumber(e);
66015
66023
  try {
66016
66024
  if (!this.validateDataset(r)) {
66017
66025
  console.error("Dataset validation failed for dataset:", r), console.error("Dataset ID:", n), e.innerHTML = '<div class="dataset-error">数据集格式错误</div>';
66018
66026
  return;
66019
66027
  }
66020
- const i = this.createDatasetHTML(r, n);
66021
- e.innerHTML = i, this.datasets.set(n, r), this.dataset[n] = r, this.bindToggleEvent(e, n), this.bindFilterEvents(e, n);
66022
- } catch (i) {
66028
+ const a = this.createDatasetHTML(r, n);
66029
+ e.innerHTML = a, this.datasets.set(n, r), this.dataset[n] = r, this.bindToggleEvent(e, n), this.bindFilterEvents(e, n);
66030
+ } catch (a) {
66023
66031
  throw console.error("❌ Dataset renderDataset 错误详情:", {
66024
- message: i.message,
66025
- name: i.name,
66026
- stack: i.stack,
66032
+ message: a.message,
66033
+ name: a.name,
66034
+ stack: a.stack,
66027
66035
  datasetId: n
66028
66036
  }), e.innerHTML = `<div class="dataset-error" style="user-select: text; cursor: text; white-space: pre-wrap; word-wrap: break-word;">
66029
- ❌ 数据集渲染错误: ${i.message}
66037
+ ❌ 数据集渲染错误: ${a.message}
66030
66038
 
66031
- ${i.stack ? `堆栈信息:
66032
- ${i.stack}` : ""}
66039
+ ${a.stack ? `堆栈信息:
66040
+ ${a.stack}` : ""}
66033
66041
 
66034
66042
  数据集ID: ${n}
66035
66043
  </div>`, this.addError({
66036
66044
  type: "Dataset",
66037
- message: i.message,
66045
+ message: a.message,
66038
66046
  code: `datasetId: ${n}`,
66039
- stack: i.stack
66040
- }), i;
66047
+ stack: a.stack,
66048
+ line: i
66049
+ }), a;
66041
66050
  }
66042
66051
  }
66043
66052
  /**
@@ -66198,32 +66207,33 @@ ${i.stack}` : ""}
66198
66207
  * 显示预览数据
66199
66208
  */
66200
66209
  showPreview(e, r) {
66201
- const n = e.querySelector(".dataset-preview");
66210
+ const n = e.querySelector(".dataset-preview"), i = this._getLineNumber(e);
66202
66211
  try {
66203
- let i = this.dataset[r];
66204
- if (i || (i = this.datasets.get(r)), i) {
66205
- const a = this.getDatasetFields(i), s = this.getPreviewRows(i, a, 5), o = n.querySelector("tbody");
66206
- o.innerHTML = s.join(""), this.addPagination(e, r, i, a);
66212
+ let a = this.dataset[r];
66213
+ if (a || (a = this.datasets.get(r)), a) {
66214
+ const s = this.getDatasetFields(a), o = this.getPreviewRows(a, s, 5), l = n.querySelector("tbody");
66215
+ l.innerHTML = o.join(""), this.addPagination(e, r, a, s);
66207
66216
  } else {
66208
- const a = n.querySelector("tbody");
66209
- a.innerHTML = '<tr><td colspan="100">数据集不存在</td></tr>';
66217
+ const s = n.querySelector("tbody");
66218
+ s.innerHTML = '<tr><td colspan="100">数据集不存在</td></tr>';
66210
66219
  }
66211
66220
  n.style.display = "block";
66212
- } catch (i) {
66221
+ } catch (a) {
66213
66222
  console.error("❌ Dataset 预览错误详情:", {
66214
- message: i.message,
66215
- name: i.name,
66216
- stack: i.stack,
66223
+ message: a.message,
66224
+ name: a.name,
66225
+ stack: a.stack,
66217
66226
  datasetId: r
66218
66227
  });
66219
- const a = n.querySelector("tbody");
66220
- a.innerHTML = `<tr><td colspan="100" style="color: red; white-space: pre-wrap;">预览错误: ${i.message}
66228
+ const s = n.querySelector("tbody");
66229
+ s.innerHTML = `<tr><td colspan="100" style="color: red; white-space: pre-wrap;">预览错误: ${a.message}
66221
66230
 
66222
- ${i.stack || ""}</td></tr>`, this.addError({
66231
+ ${a.stack || ""}</td></tr>`, this.addError({
66223
66232
  type: "Dataset",
66224
- message: `预览错误: ${i.message}`,
66233
+ message: `预览错误: ${a.message}`,
66225
66234
  code: `datasetId: ${r}`,
66226
- stack: i.stack
66235
+ stack: a.stack,
66236
+ line: i
66227
66237
  }), n.style.display = "block";
66228
66238
  }
66229
66239
  }
@@ -66292,7 +66302,8 @@ ${l.stack || ""}</td></tr>`, this.addError({
66292
66302
  type: "Dataset",
66293
66303
  message: `分页更新错误: ${l.message}`,
66294
66304
  code: `datasetId: ${r}`,
66295
- stack: l.stack
66305
+ stack: l.stack,
66306
+ line: this._getLineNumber(e)
66296
66307
  });
66297
66308
  }
66298
66309
  }
@@ -66531,27 +66542,28 @@ function k0t(t) {
66531
66542
  return s.renderToken(r, n, i);
66532
66543
  };
66533
66544
  t.renderer.rules.fence = (r, n, i, a, s) => {
66534
- const o = r[n], l = o.content.trim(), u = o.info.trim();
66545
+ var f, p;
66546
+ const o = r[n], l = o.content.trim(), u = o.info.trim(), h = (((f = o.map) == null ? void 0 : f[0]) ?? n) + 1, d = ((p = o.map) == null ? void 0 : p[1]) ?? h;
66535
66547
  if (u.startsWith("dataset"))
66536
66548
  try {
66537
- let h = `dataset-${n}-${Date.now()}`;
66538
- const d = u.match(/datasetId:\s*(\S+)/);
66539
- d && d[1] && (h = d[1]);
66540
- const f = u.includes("datasourceId:");
66541
- let p = l;
66542
- if (f) {
66543
- const v = u.match(/datasourceId:\s*(\S+)/);
66544
- v && v[1] && (p = `datasetId: ${d ? d[1] : h} datasourceId: ${v[1]}
66549
+ let g = `dataset-${n}-${Date.now()}`;
66550
+ const m = u.match(/datasetId:\s*(\S+)/);
66551
+ m && m[1] && (g = m[1]);
66552
+ const A = u.includes("datasourceId:");
66553
+ let v = l;
66554
+ if (A) {
66555
+ const S = u.match(/datasourceId:\s*(\S+)/);
66556
+ S && S[1] && (v = `datasetId: ${m ? m[1] : g} datasourceId: ${S[1]}
66545
66557
  ${l}`);
66546
66558
  }
66547
- const g = p.replace(/'/g, "&#39;").replace(/"/g, "&quot;"), A = `\`\`\`${u}
66559
+ const y = v.replace(/'/g, "&#39;").replace(/"/g, "&quot;"), b = `\`\`\`${u}
66548
66560
  ${l}
66549
66561
  \`\`\``.replace(/'/g, "&#39;").replace(/"/g, "&quot;");
66550
66562
  return `
66551
- <div class="dataset-container" data-dataset="${g}" data-dataset-id="${h}" data-is-datasource="${f}" data-original-code="${A}">${l}</div>
66563
+ <div class="dataset-container" data-dataset="${y}" data-dataset-id="${g}" data-is-datasource="${A}" data-original-code="${b}" data-line-start="${h}" data-line-end="${d}">${l}</div>
66552
66564
  `;
66553
- } catch (h) {
66554
- return `<pre class="error">Invalid dataset configuration: ${h.message}</pre>`;
66565
+ } catch (g) {
66566
+ return `<pre class="error">Invalid dataset configuration: ${g.message}</pre>`;
66555
66567
  }
66556
66568
  return e(r, n, i, a, s);
66557
66569
  };
@@ -110664,6 +110676,12 @@ class IDt extends Xk {
110664
110676
  setTheme(e) {
110665
110677
  this.theme = e === "dark" ? "dark" : null;
110666
110678
  }
110679
+ // 获取容器行号(如果存在)
110680
+ _getLineNumber(e) {
110681
+ var n;
110682
+ const r = (n = e == null ? void 0 : e.dataset) == null ? void 0 : n.lineStart;
110683
+ return r ? parseInt(r, 10) : null;
110684
+ }
110667
110685
  /**
110668
110686
  * 解析配置代码(提取公共方法)
110669
110687
  */
@@ -110833,7 +110851,8 @@ ${i}
110833
110851
  type: "ECharts",
110834
110852
  message: d.message,
110835
110853
  code: i,
110836
- stack: d.stack
110854
+ stack: d.stack,
110855
+ line: this._getLineNumber(e)
110837
110856
  }), d;
110838
110857
  }
110839
110858
  const s = (l = a.series) == null ? void 0 : l.find((d) => d.type === "map");
@@ -110845,7 +110864,8 @@ ${i}
110845
110864
  type: "ECharts",
110846
110865
  message: `地图数据加载失败: ${d.message}`,
110847
110866
  code: n,
110848
- stack: d.stack
110867
+ stack: d.stack,
110868
+ line: this._getLineNumber(e)
110849
110869
  }), d;
110850
110870
  }
110851
110871
  let o = e._echartsInstance;
@@ -110900,7 +110920,8 @@ ${s.stack}` : ""}
110900
110920
  type: "ECharts",
110901
110921
  message: s.message,
110902
110922
  code: a.dataset.options,
110903
- stack: s.stack
110923
+ stack: s.stack,
110924
+ line: this._getLineNumber(a)
110904
110925
  }), s;
110905
110926
  }
110906
110927
  }), i = (await Promise.allSettled(r)).filter((a) => a.status === "rejected");
@@ -110958,7 +110979,8 @@ ${s.stack}` : ""}
110958
110979
  type: "ECharts",
110959
110980
  message: s.message,
110960
110981
  code: a.dataset.options,
110961
- stack: s.stack
110982
+ stack: s.stack,
110983
+ line: this._getLineNumber(a)
110962
110984
  }), s;
110963
110985
  }
110964
110986
  }), i = (await Promise.allSettled(r)).filter((a) => a.status === "rejected");
@@ -110990,14 +111012,15 @@ function NDt(t) {
110990
111012
  return s.renderToken(r, n, i);
110991
111013
  };
110992
111014
  t.renderer.rules.fence = (r, n, i, a, s) => {
110993
- const o = r[n], l = o.content.trim();
110994
- if (o.info.trim() === "echarts")
111015
+ var f, p;
111016
+ const o = r[n], l = o.content.trim(), u = o.info.trim(), h = (((f = o.map) == null ? void 0 : f[0]) ?? n) + 1, d = ((p = o.map) == null ? void 0 : p[1]) ?? h;
111017
+ if (u === "echarts")
110995
111018
  try {
110996
111019
  return `
110997
- <div class="echarts-container" data-options="${l.replace(/"/g, "&quot;")}"></div>
111020
+ <div class="echarts-container" data-options="${l.replace(/"/g, "&quot;")}" data-line-start="${h}" data-line-end="${d}"></div>
110998
111021
  `;
110999
- } catch (h) {
111000
- return `<pre class="error">ECharts配置处理错误: ${h.message}</pre>`;
111022
+ } catch (g) {
111023
+ return `<pre class="error">ECharts配置处理错误: ${g.message}</pre>`;
111001
111024
  }
111002
111025
  return e(r, n, i, a, s);
111003
111026
  };
@@ -111026,6 +111049,7 @@ function LDt(t) {
111026
111049
  return `</div>
111027
111050
  `;
111028
111051
  } catch (a) {
111052
+ const s = e[r].map ? e[r].map[0] + 1 : null;
111029
111053
  return console.error("❌ Container 渲染错误详情:", {
111030
111054
  message: a.message,
111031
111055
  name: a.name,
@@ -111035,7 +111059,8 @@ function LDt(t) {
111035
111059
  type: "Container",
111036
111060
  message: a.message,
111037
111061
  code: e[r].info,
111038
- stack: a.stack
111062
+ stack: a.stack,
111063
+ line: s
111039
111064
  }), `<div class="container-error" style="user-select: text; cursor: text; white-space: pre-wrap; word-wrap: break-word;">
111040
111065
  ❌ Container 渲染错误: ${a.message}
111041
111066
 
@@ -111063,6 +111088,7 @@ ${a.stack}` : ""}
111063
111088
  return `</div>
111064
111089
  `;
111065
111090
  } catch (i) {
111091
+ const a = r[n].map ? r[n].map[0] + 1 : null;
111066
111092
  return console.error("❌ Container 渲染错误详情:", {
111067
111093
  message: i.message,
111068
111094
  name: i.name,
@@ -111072,7 +111098,8 @@ ${a.stack}` : ""}
111072
111098
  type: "Container",
111073
111099
  message: i.message,
111074
111100
  code: r[n].info,
111075
- stack: i.stack
111101
+ stack: i.stack,
111102
+ line: a
111076
111103
  }), `<div class="container-error" style="user-select: text; cursor: text; white-space: pre-wrap; word-wrap: break-word;">
111077
111104
  ❌ Container 渲染错误: ${i.message}
111078
111105
 
@@ -135403,6 +135430,12 @@ class aJt extends Xk {
135403
135430
  constructor() {
135404
135431
  super(), this.mermaidInstance = iJt, this.renderQueue = [], this.isRendering = !1, this.idCounter = 0, this.initialized = !1, this.currentTheme = "default";
135405
135432
  }
135433
+ // 获取容器行号(如果存在)
135434
+ _getLineNumber(e) {
135435
+ var n;
135436
+ const r = (n = e == null ? void 0 : e.dataset) == null ? void 0 : n.lineStart;
135437
+ return r ? parseInt(r, 10) : null;
135438
+ }
135406
135439
  /**
135407
135440
  * 初始化 Mermaid
135408
135441
  * @param {string} theme - 主题名称 ('default' 或 'dark')
@@ -135540,7 +135573,8 @@ ${r}
135540
135573
  type: "Mermaid",
135541
135574
  message: i.message || String(i),
135542
135575
  code: r,
135543
- stack: i.stack
135576
+ stack: i.stack,
135577
+ line: this._getLineNumber(e)
135544
135578
  }), i;
135545
135579
  }
135546
135580
  }
@@ -135600,9 +135634,10 @@ function sJt(t) {
135600
135634
  return s.renderToken(r, n, i);
135601
135635
  };
135602
135636
  t.renderer.rules.fence = (r, n, i, a, s) => {
135603
- const o = r[n], l = o.content.trim();
135604
- return o.info.trim() === "mermaid" ? `
135605
- <div class="mermaid">
135637
+ var f, p;
135638
+ const o = r[n], l = o.content.trim(), u = o.info.trim(), h = (((f = o.map) == null ? void 0 : f[0]) ?? n) + 1, d = ((p = o.map) == null ? void 0 : p[1]) ?? h;
135639
+ return u === "mermaid" ? `
135640
+ <div class="mermaid" data-line-start="${h}" data-line-end="${d}">
135606
135641
  ${l}
135607
135642
  </div>
135608
135643
  ` : e(r, n, i, a, s);
@@ -135780,6 +135815,12 @@ class uJt extends Xk {
135780
135815
  setTheme(e) {
135781
135816
  this.theme = e;
135782
135817
  }
135818
+ // 获取容器行号(如果存在)
135819
+ _getLineNumber(e) {
135820
+ var n;
135821
+ const r = (n = e == null ? void 0 : e.dataset) == null ? void 0 : n.lineStart;
135822
+ return r ? parseInt(r, 10) : null;
135823
+ }
135783
135824
  /**
135784
135825
  * 解析配置代码
135785
135826
  */
@@ -135829,7 +135870,8 @@ ${i}
135829
135870
  type: "D3",
135830
135871
  message: a.message,
135831
135872
  code: n,
135832
- stack: a.stack
135873
+ stack: a.stack,
135874
+ line: this._getLineNumber(e)
135833
135875
  }), a;
135834
135876
  }
135835
135877
  }
@@ -135975,7 +136017,8 @@ ${s.stack}` : ""}
135975
136017
  type: "D3",
135976
136018
  message: s.message,
135977
136019
  code: a.dataset.config,
135978
- stack: s.stack
136020
+ stack: s.stack,
136021
+ line: this._getLineNumber(a)
135979
136022
  }), s;
135980
136023
  }
135981
136024
  }), i = (await Promise.allSettled(r)).filter((a) => a.status === "rejected");
@@ -136033,7 +136076,8 @@ ${s.stack}` : ""}
136033
136076
  type: "D3",
136034
136077
  message: s.message,
136035
136078
  code: a.dataset.config,
136036
- stack: s.stack
136079
+ stack: s.stack,
136080
+ line: this._getLineNumber(a)
136037
136081
  }), s;
136038
136082
  }
136039
136083
  }), i = (await Promise.allSettled(r)).filter((a) => a.status === "rejected");
@@ -136060,14 +136104,15 @@ function hJt(t) {
136060
136104
  return s.renderToken(r, n, i);
136061
136105
  };
136062
136106
  t.renderer.rules.fence = (r, n, i, a, s) => {
136063
- const o = r[n], l = o.content.trim(), u = o.info.trim();
136107
+ var f, p;
136108
+ const o = r[n], l = o.content.trim(), u = o.info.trim(), h = (((f = o.map) == null ? void 0 : f[0]) ?? n) + 1, d = ((p = o.map) == null ? void 0 : p[1]) ?? h;
136064
136109
  if (u === "d3" || u === "d3js")
136065
136110
  try {
136066
136111
  return `
136067
- <div class="d3-container" data-config="${l.replace(/"/g, "&quot;")}"></div>
136112
+ <div class="d3-container" data-config="${l.replace(/"/g, "&quot;")}" data-line-start="${h}" data-line-end="${d}"></div>
136068
136113
  `;
136069
- } catch (h) {
136070
- return `<pre class="error">D3配置处理错误: ${h.message}</pre>`;
136114
+ } catch (g) {
136115
+ return `<pre class="error">D3配置处理错误: ${g.message}</pre>`;
136071
136116
  }
136072
136117
  return e(r, n, i, a, s);
136073
136118
  };
@@ -175581,48 +175626,101 @@ const U1r = {
175581
175626
  ...this.d3Renderer.getErrors(),
175582
175627
  ...sB.getErrors()
175583
175628
  ].forEach((n) => {
175584
- const i = this.findErrorLocation(n.message, e, n.type, n.code);
175585
- i && t.push(i);
175629
+ const i = this.findErrorLocation(
175630
+ n.message,
175631
+ e,
175632
+ n.type,
175633
+ n.code,
175634
+ n.line
175635
+ );
175636
+ i ? t.push(i) : n && n.message && t.push({
175637
+ line: typeof n.line == "number" && n.line > 0 ? n.line : -1,
175638
+ lineEnd: typeof n.line == "number" && n.line > 0 ? n.line : -1,
175639
+ type: n.type || "Unknown",
175640
+ message: n.message,
175641
+ code: n.code || "",
175642
+ severity: "error"
175643
+ });
175586
175644
  }), this.renderErrors = t, this.$emit("errors", t);
175587
175645
  },
175588
- findErrorLocation(t, e, r = null, n = null) {
175589
- let i = -1, a = r || "Unknown", s = t;
175590
- r || (t.includes("ECharts") ? a = "ECharts" : t.includes("D3") ? a = "D3" : t.includes("数据集") || t.includes("dataset") ? a = "Dataset" : t.includes("Mermaid") && (a = "Mermaid"));
175591
- let o = -1;
175592
- for (let l = 0; l < e.length; l++) {
175593
- const u = e[l];
175594
- a === "ECharts" && u.includes("```echarts") || a === "D3" && (u.includes("```d3") || u.includes("```d3js")) || (a === "Dataset" && u.includes("```dataset") ? n && n.includes(u.trim()) && (o = l + 1) : a === "Mermaid" && u.includes("```mermaid") || a === "Container" && u.includes("::: cell"));
175595
- }
175596
- if (o > 0 && (i = o), i > 0) {
175597
- const l = Math.max(0, i - 1);
175598
- let u = l + 1;
175599
- if (a === "Container") {
175600
- for (let f = l + 1; f < e.length; f++)
175601
- if (e[f].trim() === ":::") {
175602
- u = f + 1;
175646
+ findErrorLocation(t, e, r = null, n = null, i = null) {
175647
+ let a = -1, s = r || "Unknown", o = t;
175648
+ if (typeof i == "number" && i > 0 && (a = i), r || (t.includes("ECharts") ? s = "ECharts" : t.includes("D3") ? s = "D3" : t.includes("数据集") || t.includes("dataset") ? s = "Dataset" : t.includes("Mermaid") && (s = "Mermaid")), a > 0) {
175649
+ const { codeSnippet: h, startLine: d, endLine: f } = this._extractBlockByLine(e, a, s) || {}, p = o.replace(/^(ECharts|数据集|Mermaid|Container)(渲染|配置处理)?错误:\s*/i, "").replace(/\s*at\s+.*$/gm, "").split(`
175650
+ `)[0].trim();
175651
+ if (d)
175652
+ return {
175653
+ line: d,
175654
+ type: s,
175655
+ message: p,
175656
+ code: h,
175657
+ severity: "error",
175658
+ lineEnd: f
175659
+ };
175660
+ }
175661
+ let l = [], u = -1;
175662
+ for (let h = 0; h < e.length; h++) {
175663
+ const d = e[h];
175664
+ s === "ECharts" && d.includes("```echarts") || s === "D3" && (d.includes("```d3") || d.includes("```d3js")) ? l.push(h + 1) : s === "Dataset" && d.includes("```dataset") ? (l.push(h + 1), n && n.includes(d.trim()) && (u = h + 1)) : (s === "Mermaid" && d.includes("```mermaid") || s === "Container" && d.includes("::: cell")) && l.push(h + 1);
175665
+ }
175666
+ if (u > 0 ? a = u : l.length > 0 && (a = l[l.length - 1]), a > 0) {
175667
+ const h = Math.max(0, a - 1);
175668
+ let d = h + 1;
175669
+ if (s === "Container") {
175670
+ for (let g = h + 1; g < e.length; g++)
175671
+ if (e[g].trim() === ":::") {
175672
+ d = g + 1;
175603
175673
  break;
175604
175674
  }
175605
175675
  } else
175606
- for (let f = l + 1; f < e.length; f++)
175607
- if (e[f].trim() === "```") {
175608
- u = f + 1;
175676
+ for (let g = h + 1; g < e.length; g++)
175677
+ if (e[g].trim() === "```") {
175678
+ d = g + 1;
175609
175679
  break;
175610
175680
  }
175611
- u = Math.min(e.length, u);
175612
- const h = e.slice(l, u).join(`
175681
+ d = Math.min(e.length, d);
175682
+ const f = e.slice(h, d).join(`
175613
175683
  `);
175614
- let d = s.replace(/^(ECharts|数据集|Mermaid|Container)(渲染|配置处理)?错误:\s*/i, "").replace(/\s*at\s+.*$/gm, "").split(`
175684
+ let p = o.replace(/^(ECharts|数据集|Mermaid|Container)(渲染|配置处理)?错误:\s*/i, "").replace(/\s*at\s+.*$/gm, "").split(`
175615
175685
  `)[0].trim();
175616
175686
  return {
175617
- line: i,
175618
- type: a,
175619
- message: d,
175620
- code: h,
175687
+ line: a,
175688
+ type: s,
175689
+ message: p,
175690
+ code: f,
175621
175691
  severity: "error"
175622
175692
  };
175623
175693
  }
175624
175694
  return null;
175625
175695
  },
175696
+ /**
175697
+ * 根据行号提取对应的代码块片段
175698
+ */
175699
+ _extractBlockByLine(t, e, r) {
175700
+ const n = r === "Container", i = n ? ":::" : "```", a = e - 1;
175701
+ let s = a, o = a;
175702
+ for (let l = a; l >= 0; l--) {
175703
+ const u = t[l].trim();
175704
+ if (!n && u.startsWith("```") || n && u.startsWith(":::")) {
175705
+ s = l;
175706
+ break;
175707
+ }
175708
+ }
175709
+ for (let l = a + 1; l < t.length; l++) {
175710
+ const u = t[l].trim();
175711
+ if (!n && u === "```" || n && u === ":::") {
175712
+ o = l;
175713
+ break;
175714
+ }
175715
+ }
175716
+ return o < s && (o = Math.min(t.length - 1, a + 3)), {
175717
+ codeSnippet: t.slice(s, o + 1).join(`
175718
+ `),
175719
+ startLine: s + 1,
175720
+ endLine: o + 1,
175721
+ marker: i
175722
+ };
175723
+ },
175626
175724
  handleEditSave(t) {
175627
175725
  if (this.currentComponentId && this.currentComponentType) {
175628
175726
  const e = this.currentTokenStart, r = this.currentTokenEnd;
@@ -175786,7 +175884,7 @@ function H1r(t, e, r, n, i, a) {
175786
175884
  }, null, 8, ["visible", "content", "component-type", "onSave", "onClose"])
175787
175885
  ], 14, Q1r);
175788
175886
  }
175789
- const t$r = /* @__PURE__ */ Oue(U1r, [["render", H1r], ["__scopeId", "data-v-43b57683"]]);
175887
+ const t$r = /* @__PURE__ */ Oue(U1r, [["render", H1r], ["__scopeId", "data-v-d65d3d55"]]);
175790
175888
  var q1r = "[object Symbol]";
175791
175889
  function vy(t) {
175792
175890
  return typeof t == "symbol" || ih(t) && Gg(t) == q1r;