md-editor-v3 4.0.4 → 4.1.0-beta.1

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.
@@ -1,38 +1,40 @@
1
1
  var Ze = Object.defineProperty;
2
- var Je = (e, o, n) => o in e ? Ze(e, o, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[o] = n;
3
- var U = (e, o, n) => (Je(e, typeof o != "symbol" ? o + "" : o, n), n);
4
- import { defineComponent as O, createVNode as t, inject as A, ref as q, onMounted as W, reactive as Y, computed as me, watch as B, nextTick as ue, Fragment as Ke, toRef as ae, shallowRef as Xe, onBeforeUnmount as Qe } from "vue";
5
- import { p as a, a as G, s as et, b as tt, d as lt } from "./chunks/config.mjs";
6
- import { a as Q, D as ot } from "./chunks/index2.mjs";
2
+ var Je = (e, o, a) => o in e ? Ze(e, o, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[o] = a;
3
+ var q = (e, o, a) => (Je(e, typeof o != "symbol" ? o + "" : o, a), a);
4
+ import { defineComponent as O, createVNode as t, inject as A, ref as U, onMounted as W, reactive as Z, computed as fe, watch as I, nextTick as me, Fragment as Ke, toRef as ne, shallowRef as Xe, onBeforeUnmount as Qe } from "vue";
5
+ import { p as n, a as _, s as et, b as tt, d as lt } from "./chunks/config.mjs";
6
+ import { a as ee, D as ot } from "./chunks/index2.mjs";
7
7
  import { b as h, a as at } from "./chunks/index4.mjs";
8
- import { linkTo as nt, debounce as rt, throttle as it, smoothScroll as De } from "@vavt/util";
9
- import { C as st, a as ct, O as je, T as dt, b as ut, e as mt, c as ft, u as gt, d as ht, f as bt, g as vt, h as kt, i as pt, M as Ct } from "./chunks/index.mjs";
8
+ import { linkTo as nt, debounce as rt, throttle as it, smoothScroll as Ee } from "@vavt/util";
9
+ import { C as st, a as ct, O as je, T as dt, b as ut, e as mt, c as ft, u as gt, d as ht, f as bt, g as vt, h as pt, i as kt, M as Ct } from "./chunks/index.mjs";
10
10
  import { a as $t } from "./chunks/dom.mjs";
11
11
  import { a as _e, M as yt } from "./chunks/index3.mjs";
12
- import { minimalSetup as xt, EditorView as ne } from "codemirror";
13
- import { EditorView as fe, placeholder as wt, keymap as Tt } from "@codemirror/view";
12
+ import { minimalSetup as xt, EditorView as re } from "codemirror";
13
+ import { EditorView as ge, placeholder as wt, keymap as Tt } from "@codemirror/view";
14
14
  import { languages as St } from "@codemirror/language-data";
15
15
  import { markdown as At } from "@codemirror/lang-markdown";
16
- import { deleteLine as Mt, indentWithTab as Lt, undo as Dt, redo as Et } from "@codemirror/commands";
17
- import { HighlightStyle as We, syntaxHighlighting as ze, indentUnit as Ht } from "@codemirror/language";
18
- import { tags as i } from "@lezer/highlight";
19
- import { EditorSelection as re, EditorState as ie, Compartment as Ft, StateEffect as It } from "@codemirror/state";
20
- import { g as Ee } from "./chunks/vue-tsx.mjs";
16
+ import { htmlCompletionSource as Mt, html as Lt } from "@codemirror/lang-html";
17
+ import { deleteLine as Dt, indentWithTab as Et, undo as Ht, redo as Bt } from "@codemirror/commands";
18
+ import { HighlightStyle as We, syntaxHighlighting as ze, indentUnit as Ft } from "@codemirror/language";
19
+ import { tags as s } from "@lezer/highlight";
20
+ import { EditorSelection as Y, EditorState as se, Compartment as It, StateEffect as Ot } from "@codemirror/state";
21
+ import { autocompletion as Vt } from "@codemirror/autocomplete";
22
+ import { g as He } from "./chunks/vue-tsx.mjs";
21
23
  import Ye from "./MdCatalog.mjs";
22
- import Bt from "./NormalToolbar.mjs";
24
+ import Rt from "./NormalToolbar.mjs";
23
25
  import "medium-zoom";
24
26
  import "copy-to-clipboard";
25
27
  import "markdown-it";
26
28
  import "markdown-it-image-figures";
27
29
  import "markdown-it-task-lists";
28
30
  import "lru-cache";
29
- const Ot = /* @__PURE__ */ O({
31
+ const Nt = /* @__PURE__ */ O({
30
32
  setup() {
31
33
  return () => t("div", {
32
- class: `${a}-divider`
34
+ class: `${n}-divider`
33
35
  }, null);
34
36
  }
35
- }), Vt = {
37
+ }), Pt = {
36
38
  noPrettier: {
37
39
  type: Boolean
38
40
  },
@@ -73,30 +75,30 @@ const Ot = /* @__PURE__ */ O({
73
75
  noUploadImg: {
74
76
  type: Boolean
75
77
  }
76
- }, Rt = (e) => {
77
- var f, d, u, k;
78
+ }, qt = (e) => {
79
+ var f, u, d, p;
78
80
  const o = A("editorId");
79
- let n = (d = (f = G.editorExtensions) == null ? void 0 : f.screenfull) == null ? void 0 : d.instance;
80
- const l = (k = (u = G.editorExtensions) == null ? void 0 : u.screenfull) == null ? void 0 : k.js, s = q(!1), r = ($) => {
81
- if (!n) {
81
+ let a = (u = (f = _.editorExtensions) == null ? void 0 : f.screenfull) == null ? void 0 : u.instance;
82
+ const l = (p = (d = _.editorExtensions) == null ? void 0 : d.screenfull) == null ? void 0 : p.js, i = U(!1), r = ($) => {
83
+ if (!a) {
82
84
  h.emit(o, "errorCatcher", {
83
85
  name: "fullscreen",
84
86
  message: "fullscreen is undefined"
85
87
  });
86
88
  return;
87
89
  }
88
- n.isEnabled ? (s.value = !0, ($ === void 0 ? !n.isFullscreen : $) ? n.request() : n.exit()) : console.error("browser does not support screenfull!");
90
+ a.isEnabled ? (i.value = !0, ($ === void 0 ? !a.isFullscreen : $) ? a.request() : a.exit()) : console.error("browser does not support screenfull!");
89
91
  }, c = () => {
90
- n && n.isEnabled && n.on("change", () => {
91
- (s.value || e.setting.fullscreen) && (s.value = !1, e.updateSetting("fullscreen"));
92
+ a && a.isEnabled && a.on("change", () => {
93
+ (i.value || e.setting.fullscreen) && (i.value = !1, e.updateSetting("fullscreen"));
92
94
  });
93
- }, g = () => {
94
- n = window.screenfull, c();
95
+ }, m = () => {
96
+ a = window.screenfull, c();
95
97
  };
96
98
  return W(() => {
97
- if (c(), !n) {
99
+ if (c(), !a) {
98
100
  const $ = document.createElement("script");
99
- $.src = l || et, $.onload = g, $.id = `${a}-screenfull`, $t($, "screenfull");
101
+ $.src = l || et, $.onload = m, $.id = `${n}-screenfull`, $t($, "screenfull");
100
102
  }
101
103
  }), W(() => {
102
104
  h.on(o, {
@@ -104,7 +106,7 @@ const Ot = /* @__PURE__ */ O({
104
106
  callback: r
105
107
  });
106
108
  }), { fullscreenHandler: r };
107
- }, Nt = {
109
+ }, Ut = {
108
110
  tableShape: {
109
111
  type: Array,
110
112
  default: () => [6, 4]
@@ -114,24 +116,24 @@ const Ot = /* @__PURE__ */ O({
114
116
  default: () => {
115
117
  }
116
118
  }
117
- }, Pt = /* @__PURE__ */ O({
119
+ }, Gt = /* @__PURE__ */ O({
118
120
  name: "TableShape",
119
- props: Nt,
121
+ props: Ut,
120
122
  setup(e) {
121
- const o = Y({
123
+ const o = Z({
122
124
  x: -1,
123
125
  y: -1
124
126
  });
125
127
  return () => t("div", {
126
- class: `${a}-table-shape`,
128
+ class: `${n}-table-shape`,
127
129
  onMouseleave: () => {
128
130
  o.x = -1, o.y = -1;
129
131
  }
130
- }, [new Array(e.tableShape[1]).fill("").map((n, l) => t("div", {
131
- class: `${a}-table-shape-row`,
132
+ }, [new Array(e.tableShape[1]).fill("").map((a, l) => t("div", {
133
+ class: `${n}-table-shape-row`,
132
134
  key: `table-shape-row-${l}`
133
- }, [new Array(e.tableShape[0]).fill("").map((s, r) => t("div", {
134
- class: `${a}-table-shape-col`,
135
+ }, [new Array(e.tableShape[0]).fill("").map((i, r) => t("div", {
136
+ class: `${n}-table-shape-col`,
135
137
  key: `table-shape-col-${r}`,
136
138
  onMouseenter: () => {
137
139
  o.x = l, o.y = r;
@@ -140,10 +142,10 @@ const Ot = /* @__PURE__ */ O({
140
142
  e.onSelected(o);
141
143
  }
142
144
  }, [t("div", {
143
- class: [`${a}-table-shape-col-default`, l <= o.x && r <= o.y && `${a}-table-shape-col-include`]
145
+ class: [`${n}-table-shape-col-default`, l <= o.x && r <= o.y && `${n}-table-shape-col-include`]
144
146
  }, null)]))]))]);
145
147
  }
146
- }), Ut = Pt, qt = {
148
+ }), Kt = Gt, jt = {
147
149
  type: {
148
150
  type: String,
149
151
  default: "link"
@@ -162,10 +164,10 @@ const Ot = /* @__PURE__ */ O({
162
164
  default: () => {
163
165
  }
164
166
  }
165
- }, Gt = /* @__PURE__ */ O({
166
- props: qt,
167
+ }, _t = /* @__PURE__ */ O({
168
+ props: jt,
167
169
  setup(e) {
168
- const o = A("usedLanguageText"), n = A("editorId"), l = me(() => {
170
+ const o = A("usedLanguageText"), a = A("editorId"), l = fe(() => {
169
171
  var r, c;
170
172
  switch (e.type) {
171
173
  case "link":
@@ -175,13 +177,13 @@ const Ot = /* @__PURE__ */ O({
175
177
  default:
176
178
  return "";
177
179
  }
178
- }), s = Y({
180
+ }), i = Z({
179
181
  desc: "",
180
182
  url: ""
181
183
  });
182
- return B(() => e.visible, (r) => {
184
+ return I(() => e.visible, (r) => {
183
185
  r || setTimeout(() => {
184
- s.desc = "", s.url = "";
186
+ i.desc = "", i.url = "";
185
187
  }, 200);
186
188
  }), () => t(_e, {
187
189
  title: l.value,
@@ -189,50 +191,50 @@ const Ot = /* @__PURE__ */ O({
189
191
  onClose: e.onCancel
190
192
  }, {
191
193
  default: () => {
192
- var r, c, g, f, d;
194
+ var r, c, m, f, u;
193
195
  return [t("div", {
194
- class: `${a}-form-item`
196
+ class: `${n}-form-item`
195
197
  }, [t("label", {
196
- class: `${a}-label`,
197
- for: `link-desc-${n}`
198
+ class: `${n}-label`,
199
+ for: `link-desc-${a}`
198
200
  }, [(r = o.value.linkModalTips) == null ? void 0 : r.descLabel]), t("input", {
199
201
  placeholder: (c = o.value.linkModalTips) == null ? void 0 : c.descLabelPlaceHolder,
200
- class: `${a}-input`,
201
- id: `link-desc-${n}`,
202
+ class: `${n}-input`,
203
+ id: `link-desc-${a}`,
202
204
  type: "text",
203
- value: s.desc,
204
- onChange: (u) => {
205
- s.desc = u.target.value;
205
+ value: i.desc,
206
+ onChange: (d) => {
207
+ i.desc = d.target.value;
206
208
  },
207
209
  autocomplete: "off"
208
210
  }, null)]), t("div", {
209
- class: `${a}-form-item`
211
+ class: `${n}-form-item`
210
212
  }, [t("label", {
211
- class: `${a}-label`,
212
- for: `link-url-${n}`
213
- }, [(g = o.value.linkModalTips) == null ? void 0 : g.urlLabel]), t("input", {
213
+ class: `${n}-label`,
214
+ for: `link-url-${a}`
215
+ }, [(m = o.value.linkModalTips) == null ? void 0 : m.urlLabel]), t("input", {
214
216
  placeholder: (f = o.value.linkModalTips) == null ? void 0 : f.urlLabelPlaceHolder,
215
- class: `${a}-input`,
216
- id: `link-url-${n}`,
217
+ class: `${n}-input`,
218
+ id: `link-url-${a}`,
217
219
  type: "text",
218
- value: s.url,
219
- onChange: (u) => {
220
- s.url = u.target.value;
220
+ value: i.url,
221
+ onChange: (d) => {
222
+ i.url = d.target.value;
221
223
  },
222
224
  autocomplete: "off"
223
225
  }, null)]), t("div", {
224
- class: `${a}-form-item`
226
+ class: `${n}-form-item`
225
227
  }, [t("button", {
226
- class: [`${a}-btn`, `${a}-btn-row`],
228
+ class: [`${n}-btn`, `${n}-btn-row`],
227
229
  type: "button",
228
230
  onClick: () => {
229
- e.onOk(s), s.desc = "", s.url = "";
231
+ e.onOk(i), i.desc = "", i.url = "";
230
232
  }
231
- }, [(d = o.value.linkModalTips) == null ? void 0 : d.buttonOK])])];
233
+ }, [(u = o.value.linkModalTips) == null ? void 0 : u.buttonOK])])];
232
234
  }
233
235
  });
234
236
  }
235
- }), Kt = {
237
+ }), Wt = {
236
238
  visible: {
237
239
  type: Boolean,
238
240
  default: !1
@@ -247,13 +249,13 @@ const Ot = /* @__PURE__ */ O({
247
249
  default: () => {
248
250
  }
249
251
  }
250
- }, jt = /* @__PURE__ */ O({
251
- props: Kt,
252
+ }, zt = /* @__PURE__ */ O({
253
+ props: Wt,
252
254
  setup(e) {
253
- var u, k, $;
254
- const o = A("usedLanguageText"), n = A("editorId");
255
- let l = ($ = (k = (u = G) == null ? void 0 : u.editorExtensions) == null ? void 0 : k.cropper) == null ? void 0 : $.instance;
256
- const s = q(), r = q(), c = q(), g = Y({
255
+ var d, p, $;
256
+ const o = A("usedLanguageText"), a = A("editorId");
257
+ let l = ($ = (p = (d = _) == null ? void 0 : d.editorExtensions) == null ? void 0 : p.cropper) == null ? void 0 : $.instance;
258
+ const i = U(), r = U(), c = U(), m = Z({
257
259
  cropperInited: !1,
258
260
  imgSelected: !1,
259
261
  imgSrc: "",
@@ -261,109 +263,109 @@ const Ot = /* @__PURE__ */ O({
261
263
  isFullscreen: !1
262
264
  });
263
265
  let f = null;
264
- B(() => e.visible, () => {
265
- e.visible && !g.cropperInited && (l = l || window.Cropper, s.value.onchange = () => {
266
+ I(() => e.visible, () => {
267
+ e.visible && !m.cropperInited && (l = l || window.Cropper, i.value.onchange = () => {
266
268
  if (!l) {
267
- h.emit(n, "errorCatcher", {
269
+ h.emit(a, "errorCatcher", {
268
270
  name: "Cropper",
269
271
  message: "Cropper is undefined"
270
272
  });
271
273
  return;
272
274
  }
273
- const b = s.value.files || [];
274
- if (g.imgSelected = !0, (b == null ? void 0 : b.length) > 0) {
275
+ const b = i.value.files || [];
276
+ if (m.imgSelected = !0, (b == null ? void 0 : b.length) > 0) {
275
277
  const v = new FileReader();
276
- v.onload = (m) => {
277
- g.imgSrc = m.target.result, ue(() => {
278
+ v.onload = (g) => {
279
+ m.imgSrc = g.target.result, me(() => {
278
280
  f = new l(r.value, {
279
281
  viewMode: 2,
280
- preview: `.${a}-clip-preview-target`
282
+ preview: `.${n}-clip-preview-target`
281
283
  // aspectRatio: 16 / 9,
282
284
  });
283
285
  });
284
286
  }, v.readAsDataURL(b[0]);
285
287
  }
286
288
  });
287
- }), B(() => [g.imgSelected], () => {
289
+ }), I(() => [m.imgSelected], () => {
288
290
  c.value.style = "";
289
- }), B(() => g.isFullscreen, () => {
290
- ue(() => {
291
+ }), I(() => m.isFullscreen, () => {
292
+ me(() => {
291
293
  f == null || f.destroy(), c.value.style = "", r.value && (f = new l(r.value, {
292
294
  viewMode: 2,
293
- preview: `.${a}-clip-preview-target`
295
+ preview: `.${n}-clip-preview-target`
294
296
  // aspectRatio: 16 / 9,
295
297
  }));
296
298
  });
297
299
  });
298
- const d = () => {
299
- f.clear(), f.destroy(), f = null, s.value.value = "", g.imgSelected = !1;
300
+ const u = () => {
301
+ f.clear(), f.destroy(), f = null, i.value.value = "", m.imgSelected = !1;
300
302
  };
301
303
  return () => {
302
304
  var b;
303
305
  return t(_e, {
304
- class: `${a}-modal-clip`,
306
+ class: `${n}-modal-clip`,
305
307
  title: (b = o.value.clipModalTips) == null ? void 0 : b.title,
306
308
  visible: e.visible,
307
309
  onClose: e.onCancel,
308
310
  showAdjust: !0,
309
- isFullscreen: g.isFullscreen,
311
+ isFullscreen: m.isFullscreen,
310
312
  onAdjust: (v) => {
311
- g.isFullscreen = v;
313
+ m.isFullscreen = v;
312
314
  },
313
315
  width: "668px",
314
316
  height: "421px"
315
317
  }, {
316
318
  default: () => {
317
- var v, m;
319
+ var v, g;
318
320
  return [t("div", {
319
- class: `${a}-form-item ${a}-clip`
321
+ class: `${n}-form-item ${n}-clip`
320
322
  }, [t("div", {
321
- class: `${a}-clip-main`
322
- }, [g.imgSelected ? t("div", {
323
- class: `${a}-clip-cropper`
323
+ class: `${n}-clip-main`
324
+ }, [m.imgSelected ? t("div", {
325
+ class: `${n}-clip-cropper`
324
326
  }, [t("img", {
325
- src: g.imgSrc,
327
+ src: m.imgSrc,
326
328
  ref: r,
327
329
  style: {
328
330
  display: "none"
329
331
  },
330
332
  alt: ""
331
333
  }, null), t("div", {
332
- class: `${a}-clip-delete`,
333
- onClick: d
334
+ class: `${n}-clip-delete`,
335
+ onClick: u
334
336
  }, [t("svg", {
335
- class: `${a}-icon`,
337
+ class: `${n}-icon`,
336
338
  "aria-hidden": "true"
337
339
  }, [t("use", {
338
340
  "xlink:href": "#md-editor-icon-delete"
339
341
  }, null)])])]) : t("div", {
340
- class: `${a}-clip-upload`,
342
+ class: `${n}-clip-upload`,
341
343
  onClick: () => {
342
- s.value.click();
344
+ i.value.click();
343
345
  }
344
346
  }, [t("svg", {
345
- class: `${a}-icon`,
347
+ class: `${n}-icon`,
346
348
  "aria-hidden": "true"
347
349
  }, [t("use", {
348
350
  "xlink:href": "#md-editor-icon-upload"
349
351
  }, null)])])]), t("div", {
350
- class: `${a}-clip-preview`
352
+ class: `${n}-clip-preview`
351
353
  }, [t("div", {
352
- class: `${a}-clip-preview-target`,
354
+ class: `${n}-clip-preview-target`,
353
355
  ref: c
354
356
  }, null)])]), t("div", {
355
- class: `${a}-form-item`
357
+ class: `${n}-form-item`
356
358
  }, [t("button", {
357
- class: `${a}-btn`,
359
+ class: `${n}-btn`,
358
360
  type: "button",
359
361
  onClick: () => {
360
362
  if (f) {
361
363
  const y = f.getCroppedCanvas();
362
- h.emit(n, "uploadImage", [at(y.toDataURL("image/png"))], e.onOk), d();
364
+ h.emit(a, "uploadImage", [at(y.toDataURL("image/png"))], e.onOk), u();
363
365
  }
364
366
  }
365
- }, [((v = o.value.clipModalTips) == null ? void 0 : v.buttonUpload) || ((m = o.value.linkModalTips) == null ? void 0 : m.buttonOK)])]), t("input", {
366
- ref: s,
367
+ }, [((v = o.value.clipModalTips) == null ? void 0 : v.buttonUpload) || ((g = o.value.linkModalTips) == null ? void 0 : g.buttonOK)])]), t("input", {
368
+ ref: i,
367
369
  accept: "image/*",
368
370
  type: "file",
369
371
  multiple: !1,
@@ -375,7 +377,7 @@ const Ot = /* @__PURE__ */ O({
375
377
  });
376
378
  };
377
379
  }
378
- }), _t = {
380
+ }), Yt = {
379
381
  type: {
380
382
  type: String,
381
383
  default: "link"
@@ -398,27 +400,27 @@ const Ot = /* @__PURE__ */ O({
398
400
  default: () => {
399
401
  }
400
402
  }
401
- }, Wt = /* @__PURE__ */ O({
402
- props: _t,
403
+ }, Zt = /* @__PURE__ */ O({
404
+ props: Yt,
403
405
  setup(e) {
404
- return () => t(Ke, null, [t(Gt, {
406
+ return () => t(Ke, null, [t(_t, {
405
407
  type: e.type,
406
408
  visible: e.linkVisible,
407
409
  onOk: e.onOk,
408
410
  onCancel: e.onCancel
409
- }, null), t(jt, {
411
+ }, null), t(zt, {
410
412
  visible: e.clipVisible,
411
413
  onOk: e.onOk,
412
414
  onCancel: e.onCancel
413
415
  }, null)]);
414
416
  }
415
- }), zt = /* @__PURE__ */ O({
417
+ }), Jt = /* @__PURE__ */ O({
416
418
  name: "MDEditorToolbar",
417
- props: Vt,
419
+ props: Pt,
418
420
  setup(e) {
419
- const o = A("editorId"), n = A("usedLanguageText"), {
421
+ const o = A("editorId"), a = A("usedLanguageText"), {
420
422
  fullscreenHandler: l
421
- } = Rt(e), s = `${o}-toolbar-wrapper`, r = Y({
423
+ } = qt(e), i = `${o}-toolbar-wrapper`, r = Z({
422
424
  title: !1,
423
425
  catalog: !1,
424
426
  // 图片上传下拉
@@ -430,137 +432,137 @@ const Ot = /* @__PURE__ */ O({
430
432
  katex: !1
431
433
  }), c = (b, v) => {
432
434
  h.emit(o, "replace", b, v);
433
- }, g = Y({
435
+ }, m = Z({
434
436
  type: "link",
435
437
  linkVisible: !1,
436
438
  clipVisible: !1
437
- }), f = q();
439
+ }), f = U();
438
440
  W(() => {
439
441
  h.on(o, {
440
442
  name: "openModals",
441
443
  callback(b) {
442
- g.type = b, g.linkVisible = !0;
444
+ m.type = b, m.linkVisible = !0;
443
445
  }
444
446
  });
445
447
  });
446
- const d = me(() => {
447
- const b = e.toolbars.filter((x) => !e.toolbarsExclude.includes(x)), v = b.indexOf("="), m = v === -1 ? b : b.slice(0, v + 1), y = v === -1 ? [] : b.slice(v, Number.MAX_SAFE_INTEGER);
448
- return [m, y];
449
- }), u = q(), k = () => {
450
- h.emit(o, "uploadImage", Array.from(u.value.files || [])), u.value.value = "";
448
+ const u = fe(() => {
449
+ const b = e.toolbars.filter((x) => !e.toolbarsExclude.includes(x)), v = b.indexOf("="), g = v === -1 ? b : b.slice(0, v + 1), y = v === -1 ? [] : b.slice(v, Number.MAX_SAFE_INTEGER);
450
+ return [g, y];
451
+ }), d = U(), p = () => {
452
+ h.emit(o, "uploadImage", Array.from(d.value.files || [])), d.value.value = "";
451
453
  };
452
454
  W(() => {
453
- u.value.addEventListener("change", k);
455
+ d.value.addEventListener("change", p);
454
456
  });
455
457
  const $ = (b) => {
456
- var v, m, y, x, T, w, M, p, S, R, L, D, V, F, E, K, N, le, Z, j, P, J, _, H, I, X, oe, ge, he, be, ve, ke, pe, Ce, $e, ye, xe, we, Te, Se, Ae, Me, Le;
458
+ var v, g, y, x, T, w, M, k, S, R, L, D, V, B, E, G, N, oe, J, K, P, X, j, H, F, Q, ae, he, be, ve, pe, ke, Ce, $e, ye, xe, we, Te, Se, Ae, Me, Le, De;
457
459
  if (tt.includes(b))
458
460
  switch (b) {
459
461
  case "-":
460
- return t(Ot, null, null);
462
+ return t(Nt, null, null);
461
463
  case "bold":
462
464
  return t("div", {
463
- class: `${a}-toolbar-item`,
464
- title: (v = n.value.toolbarTips) == null ? void 0 : v.bold,
465
+ class: `${n}-toolbar-item`,
466
+ title: (v = a.value.toolbarTips) == null ? void 0 : v.bold,
465
467
  onClick: () => {
466
468
  c("bold");
467
469
  }
468
470
  }, [t("svg", {
469
- class: `${a}-icon`,
471
+ class: `${n}-icon`,
470
472
  "aria-hidden": "true"
471
473
  }, [t("use", {
472
474
  "xlink:href": "#md-editor-icon-bold"
473
475
  }, null)])]);
474
476
  case "underline":
475
477
  return t("div", {
476
- class: `${a}-toolbar-item`,
477
- title: (m = n.value.toolbarTips) == null ? void 0 : m.underline,
478
+ class: `${n}-toolbar-item`,
479
+ title: (g = a.value.toolbarTips) == null ? void 0 : g.underline,
478
480
  onClick: () => {
479
481
  c("underline");
480
482
  }
481
483
  }, [t("svg", {
482
- class: `${a}-icon`,
484
+ class: `${n}-icon`,
483
485
  "aria-hidden": "true"
484
486
  }, [t("use", {
485
487
  "xlink:href": "#md-editor-icon-underline"
486
488
  }, null)])]);
487
489
  case "italic":
488
490
  return t("div", {
489
- class: `${a}-toolbar-item`,
490
- title: (y = n.value.toolbarTips) == null ? void 0 : y.italic,
491
+ class: `${n}-toolbar-item`,
492
+ title: (y = a.value.toolbarTips) == null ? void 0 : y.italic,
491
493
  onClick: () => {
492
494
  c("italic");
493
495
  }
494
496
  }, [t("svg", {
495
- class: `${a}-icon`,
497
+ class: `${n}-icon`,
496
498
  "aria-hidden": "true"
497
499
  }, [t("use", {
498
500
  "xlink:href": "#md-editor-icon-italic"
499
501
  }, null)])]);
500
502
  case "strikeThrough":
501
503
  return t("div", {
502
- class: `${a}-toolbar-item`,
503
- title: (x = n.value.toolbarTips) == null ? void 0 : x.strikeThrough,
504
+ class: `${n}-toolbar-item`,
505
+ title: (x = a.value.toolbarTips) == null ? void 0 : x.strikeThrough,
504
506
  onClick: () => {
505
507
  c("strikeThrough");
506
508
  }
507
509
  }, [t("svg", {
508
- class: `${a}-icon`,
510
+ class: `${n}-icon`,
509
511
  "aria-hidden": "true"
510
512
  }, [t("use", {
511
513
  "xlink:href": "#md-editor-icon-strike-through"
512
514
  }, null)])]);
513
515
  case "title":
514
- return t(Q, {
515
- relative: `#${s}`,
516
+ return t(ee, {
517
+ relative: `#${i}`,
516
518
  visible: r.title,
517
519
  onChange: (C) => {
518
520
  r.title = C;
519
521
  },
520
522
  overlay: t("ul", {
521
- class: `${a}-menu`,
523
+ class: `${n}-menu`,
522
524
  onClick: () => {
523
525
  r.title = !1;
524
526
  }
525
527
  }, [t("li", {
526
- class: `${a}-menu-item`,
528
+ class: `${n}-menu-item`,
527
529
  onClick: () => {
528
530
  c("h1");
529
531
  }
530
- }, [(T = n.value.titleItem) == null ? void 0 : T.h1]), t("li", {
531
- class: `${a}-menu-item`,
532
+ }, [(T = a.value.titleItem) == null ? void 0 : T.h1]), t("li", {
533
+ class: `${n}-menu-item`,
532
534
  onClick: () => {
533
535
  c("h2");
534
536
  }
535
- }, [(w = n.value.titleItem) == null ? void 0 : w.h2]), t("li", {
536
- class: `${a}-menu-item`,
537
+ }, [(w = a.value.titleItem) == null ? void 0 : w.h2]), t("li", {
538
+ class: `${n}-menu-item`,
537
539
  onClick: () => {
538
540
  c("h3");
539
541
  }
540
- }, [(M = n.value.titleItem) == null ? void 0 : M.h3]), t("li", {
541
- class: `${a}-menu-item`,
542
+ }, [(M = a.value.titleItem) == null ? void 0 : M.h3]), t("li", {
543
+ class: `${n}-menu-item`,
542
544
  onClick: () => {
543
545
  c("h4");
544
546
  }
545
- }, [(p = n.value.titleItem) == null ? void 0 : p.h4]), t("li", {
546
- class: `${a}-menu-item`,
547
+ }, [(k = a.value.titleItem) == null ? void 0 : k.h4]), t("li", {
548
+ class: `${n}-menu-item`,
547
549
  onClick: () => {
548
550
  c("h5");
549
551
  }
550
- }, [(S = n.value.titleItem) == null ? void 0 : S.h5]), t("li", {
551
- class: `${a}-menu-item`,
552
+ }, [(S = a.value.titleItem) == null ? void 0 : S.h5]), t("li", {
553
+ class: `${n}-menu-item`,
552
554
  onClick: () => {
553
555
  c("h6");
554
556
  }
555
- }, [(R = n.value.titleItem) == null ? void 0 : R.h6])])
557
+ }, [(R = a.value.titleItem) == null ? void 0 : R.h6])])
556
558
  }, {
557
559
  default: () => {
558
560
  var C;
559
561
  return [t("div", {
560
- class: `${a}-toolbar-item`,
561
- title: (C = n.value.toolbarTips) == null ? void 0 : C.title
562
+ class: `${n}-toolbar-item`,
563
+ title: (C = a.value.toolbarTips) == null ? void 0 : C.title
562
564
  }, [t("svg", {
563
- class: `${a}-icon`,
565
+ class: `${n}-icon`,
564
566
  "aria-hidden": "true"
565
567
  }, [t("use", {
566
568
  "xlink:href": "#md-editor-icon-title"
@@ -569,168 +571,168 @@ const Ot = /* @__PURE__ */ O({
569
571
  });
570
572
  case "sub":
571
573
  return t("div", {
572
- class: `${a}-toolbar-item`,
573
- title: (L = n.value.toolbarTips) == null ? void 0 : L.sub,
574
+ class: `${n}-toolbar-item`,
575
+ title: (L = a.value.toolbarTips) == null ? void 0 : L.sub,
574
576
  onClick: () => {
575
577
  c("sub");
576
578
  }
577
579
  }, [t("svg", {
578
- class: `${a}-icon`,
580
+ class: `${n}-icon`,
579
581
  "aria-hidden": "true"
580
582
  }, [t("use", {
581
583
  "xlink:href": "#md-editor-icon-sub"
582
584
  }, null)])]);
583
585
  case "sup":
584
586
  return t("div", {
585
- class: `${a}-toolbar-item`,
586
- title: (D = n.value.toolbarTips) == null ? void 0 : D.sup,
587
+ class: `${n}-toolbar-item`,
588
+ title: (D = a.value.toolbarTips) == null ? void 0 : D.sup,
587
589
  onClick: () => {
588
590
  c("sup");
589
591
  }
590
592
  }, [t("svg", {
591
- class: `${a}-icon`,
593
+ class: `${n}-icon`,
592
594
  "aria-hidden": "true"
593
595
  }, [t("use", {
594
596
  "xlink:href": "#md-editor-icon-sup"
595
597
  }, null)])]);
596
598
  case "quote":
597
599
  return t("div", {
598
- class: `${a}-toolbar-item`,
599
- title: (V = n.value.toolbarTips) == null ? void 0 : V.quote,
600
+ class: `${n}-toolbar-item`,
601
+ title: (V = a.value.toolbarTips) == null ? void 0 : V.quote,
600
602
  onClick: () => {
601
603
  c("quote");
602
604
  }
603
605
  }, [t("svg", {
604
- class: `${a}-icon`,
606
+ class: `${n}-icon`,
605
607
  "aria-hidden": "true"
606
608
  }, [t("use", {
607
609
  "xlink:href": "#md-editor-icon-quote"
608
610
  }, null)])]);
609
611
  case "unorderedList":
610
612
  return t("div", {
611
- class: `${a}-toolbar-item`,
612
- title: (F = n.value.toolbarTips) == null ? void 0 : F.unorderedList,
613
+ class: `${n}-toolbar-item`,
614
+ title: (B = a.value.toolbarTips) == null ? void 0 : B.unorderedList,
613
615
  onClick: () => {
614
616
  c("unorderedList");
615
617
  }
616
618
  }, [t("svg", {
617
- class: `${a}-icon`,
619
+ class: `${n}-icon`,
618
620
  "aria-hidden": "true"
619
621
  }, [t("use", {
620
622
  "xlink:href": "#md-editor-icon-unordered-list"
621
623
  }, null)])]);
622
624
  case "orderedList":
623
625
  return t("div", {
624
- class: `${a}-toolbar-item`,
625
- title: (E = n.value.toolbarTips) == null ? void 0 : E.orderedList,
626
+ class: `${n}-toolbar-item`,
627
+ title: (E = a.value.toolbarTips) == null ? void 0 : E.orderedList,
626
628
  onClick: () => {
627
629
  c("orderedList");
628
630
  }
629
631
  }, [t("svg", {
630
- class: `${a}-icon`,
632
+ class: `${n}-icon`,
631
633
  "aria-hidden": "true"
632
634
  }, [t("use", {
633
635
  "xlink:href": "#md-editor-icon-ordered-list"
634
636
  }, null)])]);
635
637
  case "task":
636
638
  return t("div", {
637
- class: `${a}-toolbar-item`,
638
- title: (K = n.value.toolbarTips) == null ? void 0 : K.task,
639
+ class: `${n}-toolbar-item`,
640
+ title: (G = a.value.toolbarTips) == null ? void 0 : G.task,
639
641
  onClick: () => {
640
642
  c("task");
641
643
  }
642
644
  }, [t("svg", {
643
- class: `${a}-icon`,
645
+ class: `${n}-icon`,
644
646
  "aria-hidden": "true"
645
647
  }, [t("use", {
646
648
  "xlink:href": "#md-editor-icon-task"
647
649
  }, null)])]);
648
650
  case "codeRow":
649
651
  return t("div", {
650
- class: `${a}-toolbar-item`,
651
- title: (N = n.value.toolbarTips) == null ? void 0 : N.codeRow,
652
+ class: `${n}-toolbar-item`,
653
+ title: (N = a.value.toolbarTips) == null ? void 0 : N.codeRow,
652
654
  onClick: () => {
653
655
  c("codeRow");
654
656
  }
655
657
  }, [t("svg", {
656
- class: `${a}-icon`,
658
+ class: `${n}-icon`,
657
659
  "aria-hidden": "true"
658
660
  }, [t("use", {
659
661
  "xlink:href": "#md-editor-icon-code-row"
660
662
  }, null)])]);
661
663
  case "code":
662
664
  return t("div", {
663
- class: `${a}-toolbar-item`,
664
- title: (le = n.value.toolbarTips) == null ? void 0 : le.code,
665
+ class: `${n}-toolbar-item`,
666
+ title: (oe = a.value.toolbarTips) == null ? void 0 : oe.code,
665
667
  onClick: () => {
666
668
  c("code");
667
669
  }
668
670
  }, [t("svg", {
669
- class: `${a}-icon`,
671
+ class: `${n}-icon`,
670
672
  "aria-hidden": "true"
671
673
  }, [t("use", {
672
674
  "xlink:href": "#md-editor-icon-code"
673
675
  }, null)])]);
674
676
  case "link":
675
677
  return t("div", {
676
- class: `${a}-toolbar-item`,
677
- title: (Z = n.value.toolbarTips) == null ? void 0 : Z.link,
678
+ class: `${n}-toolbar-item`,
679
+ title: (J = a.value.toolbarTips) == null ? void 0 : J.link,
678
680
  onClick: () => {
679
- g.type = "link", g.linkVisible = !0;
681
+ m.type = "link", m.linkVisible = !0;
680
682
  }
681
683
  }, [t("svg", {
682
- class: `${a}-icon`,
684
+ class: `${n}-icon`,
683
685
  "aria-hidden": "true"
684
686
  }, [t("use", {
685
687
  "xlink:href": "#md-editor-icon-link"
686
688
  }, null)])]);
687
689
  case "image":
688
690
  return e.noUploadImg ? t("div", {
689
- class: `${a}-toolbar-item`,
690
- title: (j = n.value.toolbarTips) == null ? void 0 : j.image,
691
+ class: `${n}-toolbar-item`,
692
+ title: (K = a.value.toolbarTips) == null ? void 0 : K.image,
691
693
  onClick: () => {
692
- g.type = "image", g.linkVisible = !0;
694
+ m.type = "image", m.linkVisible = !0;
693
695
  }
694
696
  }, [t("svg", {
695
- class: `${a}-icon`,
697
+ class: `${n}-icon`,
696
698
  "aria-hidden": "true"
697
699
  }, [t("use", {
698
700
  "xlink:href": "#md-editor-icon-image"
699
- }, null)])]) : t(Q, {
700
- relative: `#${s}`,
701
+ }, null)])]) : t(ee, {
702
+ relative: `#${i}`,
701
703
  visible: r.image,
702
704
  onChange: (C) => {
703
705
  r.image = C;
704
706
  },
705
707
  overlay: t("ul", {
706
- class: `${a}-menu`,
708
+ class: `${n}-menu`,
707
709
  onClick: () => {
708
710
  r.title = !1;
709
711
  }
710
712
  }, [t("li", {
711
- class: `${a}-menu-item`,
713
+ class: `${n}-menu-item`,
712
714
  onClick: () => {
713
- g.type = "image", g.linkVisible = !0;
715
+ m.type = "image", m.linkVisible = !0;
714
716
  }
715
- }, [(P = n.value.imgTitleItem) == null ? void 0 : P.link]), t("li", {
716
- class: `${a}-menu-item`,
717
+ }, [(P = a.value.imgTitleItem) == null ? void 0 : P.link]), t("li", {
718
+ class: `${n}-menu-item`,
717
719
  onClick: () => {
718
- u.value.click();
720
+ d.value.click();
719
721
  }
720
- }, [(J = n.value.imgTitleItem) == null ? void 0 : J.upload]), t("li", {
721
- class: `${a}-menu-item`,
722
+ }, [(X = a.value.imgTitleItem) == null ? void 0 : X.upload]), t("li", {
723
+ class: `${n}-menu-item`,
722
724
  onClick: () => {
723
- g.clipVisible = !0;
725
+ m.clipVisible = !0;
724
726
  }
725
- }, [(_ = n.value.imgTitleItem) == null ? void 0 : _.clip2upload])])
727
+ }, [(j = a.value.imgTitleItem) == null ? void 0 : j.clip2upload])])
726
728
  }, {
727
729
  default: () => {
728
730
  var C;
729
731
  return [t("div", {
730
- class: `${a}-toolbar-item`,
731
- title: (C = n.value.toolbarTips) == null ? void 0 : C.image
732
+ class: `${n}-toolbar-item`,
733
+ title: (C = a.value.toolbarTips) == null ? void 0 : C.image
732
734
  }, [t("svg", {
733
- class: `${a}-icon`,
735
+ class: `${n}-icon`,
734
736
  "aria-hidden": "true"
735
737
  }, [t("use", {
736
738
  "xlink:href": "#md-editor-icon-image"
@@ -738,14 +740,14 @@ const Ot = /* @__PURE__ */ O({
738
740
  }
739
741
  });
740
742
  case "table":
741
- return t(Q, {
742
- relative: `#${s}`,
743
+ return t(ee, {
744
+ relative: `#${i}`,
743
745
  visible: r.table,
744
746
  onChange: (C) => {
745
747
  r.table = C;
746
748
  },
747
749
  key: "bar-table",
748
- overlay: t(Ut, {
750
+ overlay: t(Kt, {
749
751
  tableShape: e.tableShape,
750
752
  onSelected: (C) => {
751
753
  c("table", {
@@ -757,10 +759,10 @@ const Ot = /* @__PURE__ */ O({
757
759
  default: () => {
758
760
  var C;
759
761
  return [t("div", {
760
- class: `${a}-toolbar-item`,
761
- title: (C = n.value.toolbarTips) == null ? void 0 : C.table
762
+ class: `${n}-toolbar-item`,
763
+ title: (C = a.value.toolbarTips) == null ? void 0 : C.table
762
764
  }, [t("svg", {
763
- class: `${a}-icon`,
765
+ class: `${n}-icon`,
764
766
  "aria-hidden": "true"
765
767
  }, [t("use", {
766
768
  "xlink:href": "#md-editor-icon-table"
@@ -769,195 +771,195 @@ const Ot = /* @__PURE__ */ O({
769
771
  });
770
772
  case "revoke":
771
773
  return t("div", {
772
- class: `${a}-toolbar-item`,
773
- title: (H = n.value.toolbarTips) == null ? void 0 : H.revoke,
774
+ class: `${n}-toolbar-item`,
775
+ title: (H = a.value.toolbarTips) == null ? void 0 : H.revoke,
774
776
  onClick: () => {
775
777
  h.emit(o, "ctrlZ");
776
778
  }
777
779
  }, [t("svg", {
778
- class: `${a}-icon`,
780
+ class: `${n}-icon`,
779
781
  "aria-hidden": "true"
780
782
  }, [t("use", {
781
783
  "xlink:href": "#md-editor-icon-revoke"
782
784
  }, null)])]);
783
785
  case "next":
784
786
  return t("div", {
785
- class: `${a}-toolbar-item`,
786
- title: (I = n.value.toolbarTips) == null ? void 0 : I.next,
787
+ class: `${n}-toolbar-item`,
788
+ title: (F = a.value.toolbarTips) == null ? void 0 : F.next,
787
789
  onClick: () => {
788
790
  h.emit(o, "ctrlShiftZ");
789
791
  }
790
792
  }, [t("svg", {
791
- class: `${a}-icon`,
793
+ class: `${n}-icon`,
792
794
  "aria-hidden": "true"
793
795
  }, [t("use", {
794
796
  "xlink:href": "#md-editor-icon-next"
795
797
  }, null)])]);
796
798
  case "save":
797
799
  return t("div", {
798
- class: `${a}-toolbar-item`,
799
- title: (X = n.value.toolbarTips) == null ? void 0 : X.save,
800
+ class: `${n}-toolbar-item`,
801
+ title: (Q = a.value.toolbarTips) == null ? void 0 : Q.save,
800
802
  onClick: () => {
801
803
  h.emit(o, je);
802
804
  }
803
805
  }, [t("svg", {
804
- class: `${a}-icon`,
806
+ class: `${n}-icon`,
805
807
  "aria-hidden": "true"
806
808
  }, [t("use", {
807
809
  "xlink:href": "#md-editor-icon-baocun"
808
810
  }, null)])]);
809
811
  case "prettier":
810
812
  return e.noPrettier ? "" : t("div", {
811
- class: `${a}-toolbar-item`,
812
- title: (oe = n.value.toolbarTips) == null ? void 0 : oe.prettier,
813
+ class: `${n}-toolbar-item`,
814
+ title: (ae = a.value.toolbarTips) == null ? void 0 : ae.prettier,
813
815
  onClick: () => {
814
816
  c("prettier");
815
817
  }
816
818
  }, [t("svg", {
817
- class: `${a}-icon`,
819
+ class: `${n}-icon`,
818
820
  "aria-hidden": "true"
819
821
  }, [t("use", {
820
822
  "xlink:href": "#md-editor-icon-prettier"
821
823
  }, null)])]);
822
824
  case "pageFullscreen":
823
825
  return !e.setting.fullscreen && t("div", {
824
- class: `${a}-toolbar-item`,
825
- title: (ge = n.value.toolbarTips) == null ? void 0 : ge.pageFullscreen,
826
+ class: `${n}-toolbar-item`,
827
+ title: (he = a.value.toolbarTips) == null ? void 0 : he.pageFullscreen,
826
828
  onClick: () => {
827
829
  e.updateSetting("pageFullscreen");
828
830
  }
829
831
  }, [t("svg", {
830
- class: `${a}-icon`,
832
+ class: `${n}-icon`,
831
833
  "aria-hidden": "true"
832
834
  }, [t("use", {
833
835
  "xlink:href": `#md-editor-icon-${e.setting.pageFullscreen ? "suoxiao" : "fangda"}`
834
836
  }, null)])]);
835
837
  case "fullscreen":
836
838
  return t("div", {
837
- class: `${a}-toolbar-item`,
838
- title: (he = n.value.toolbarTips) == null ? void 0 : he.fullscreen,
839
+ class: `${n}-toolbar-item`,
840
+ title: (be = a.value.toolbarTips) == null ? void 0 : be.fullscreen,
839
841
  onClick: () => {
840
842
  l();
841
843
  }
842
844
  }, [t("svg", {
843
- class: `${a}-icon`,
845
+ class: `${n}-icon`,
844
846
  "aria-hidden": "true"
845
847
  }, [t("use", {
846
848
  "xlink:href": `#md-editor-icon-${e.setting.fullscreen ? "fullscreen-exit" : "fullscreen"}`
847
849
  }, null)])]);
848
850
  case "preview":
849
851
  return t("div", {
850
- class: `${a}-toolbar-item`,
851
- title: (be = n.value.toolbarTips) == null ? void 0 : be.preview,
852
+ class: `${n}-toolbar-item`,
853
+ title: (ve = a.value.toolbarTips) == null ? void 0 : ve.preview,
852
854
  onClick: () => {
853
855
  e.updateSetting("preview");
854
856
  }
855
857
  }, [t("svg", {
856
- class: `${a}-icon`,
858
+ class: `${n}-icon`,
857
859
  "aria-hidden": "true"
858
860
  }, [t("use", {
859
861
  "xlink:href": "#md-editor-icon-preview"
860
862
  }, null)])]);
861
863
  case "htmlPreview":
862
864
  return t("div", {
863
- class: `${a}-toolbar-item`,
864
- title: (ve = n.value.toolbarTips) == null ? void 0 : ve.htmlPreview,
865
+ class: `${n}-toolbar-item`,
866
+ title: (pe = a.value.toolbarTips) == null ? void 0 : pe.htmlPreview,
865
867
  onClick: () => {
866
868
  e.updateSetting("htmlPreview");
867
869
  }
868
870
  }, [t("svg", {
869
- class: `${a}-icon`,
871
+ class: `${n}-icon`,
870
872
  "aria-hidden": "true"
871
873
  }, [t("use", {
872
874
  "xlink:href": "#md-editor-icon-coding"
873
875
  }, null)])]);
874
876
  case "catalog":
875
877
  return t("div", {
876
- class: `${a}-toolbar-item`,
877
- title: (ke = n.value.toolbarTips) == null ? void 0 : ke.catalog,
878
+ class: `${n}-toolbar-item`,
879
+ title: (ke = a.value.toolbarTips) == null ? void 0 : ke.catalog,
878
880
  onClick: () => {
879
881
  h.emit(o, ct);
880
882
  },
881
883
  key: "bar-catalog"
882
884
  }, [t("svg", {
883
- class: `${a}-icon`,
885
+ class: `${n}-icon`,
884
886
  "aria-hidden": "true"
885
887
  }, [t("use", {
886
888
  "xlink:href": "#md-editor-icon-catalog"
887
889
  }, null)])]);
888
890
  case "github":
889
891
  return t("div", {
890
- class: `${a}-toolbar-item`,
891
- title: (pe = n.value.toolbarTips) == null ? void 0 : pe.github,
892
+ class: `${n}-toolbar-item`,
893
+ title: (Ce = a.value.toolbarTips) == null ? void 0 : Ce.github,
892
894
  onClick: () => nt("https://github.com/imzbf/md-editor-v3")
893
895
  }, [t("svg", {
894
- class: `${a}-icon`,
896
+ class: `${n}-icon`,
895
897
  "aria-hidden": "true"
896
898
  }, [t("use", {
897
899
  "xlink:href": "#md-editor-icon-github"
898
900
  }, null)])]);
899
901
  case "mermaid":
900
- return t(Q, {
901
- relative: `#${s}`,
902
+ return t(ee, {
903
+ relative: `#${i}`,
902
904
  visible: r.mermaid,
903
905
  onChange: (C) => {
904
906
  r.mermaid = C;
905
907
  },
906
908
  overlay: t("ul", {
907
- class: `${a}-menu`,
909
+ class: `${n}-menu`,
908
910
  onClick: () => {
909
911
  r.mermaid = !1;
910
912
  }
911
913
  }, [t("li", {
912
- class: `${a}-menu-item`,
914
+ class: `${n}-menu-item`,
913
915
  onClick: () => {
914
916
  c("flow");
915
917
  }
916
- }, [(Ce = n.value.mermaid) == null ? void 0 : Ce.flow]), t("li", {
917
- class: `${a}-menu-item`,
918
+ }, [($e = a.value.mermaid) == null ? void 0 : $e.flow]), t("li", {
919
+ class: `${n}-menu-item`,
918
920
  onClick: () => {
919
921
  c("sequence");
920
922
  }
921
- }, [($e = n.value.mermaid) == null ? void 0 : $e.sequence]), t("li", {
922
- class: `${a}-menu-item`,
923
+ }, [(ye = a.value.mermaid) == null ? void 0 : ye.sequence]), t("li", {
924
+ class: `${n}-menu-item`,
923
925
  onClick: () => {
924
926
  c("gantt");
925
927
  }
926
- }, [(ye = n.value.mermaid) == null ? void 0 : ye.gantt]), t("li", {
927
- class: `${a}-menu-item`,
928
+ }, [(xe = a.value.mermaid) == null ? void 0 : xe.gantt]), t("li", {
929
+ class: `${n}-menu-item`,
928
930
  onClick: () => {
929
931
  c("class");
930
932
  }
931
- }, [(xe = n.value.mermaid) == null ? void 0 : xe.class]), t("li", {
932
- class: `${a}-menu-item`,
933
+ }, [(we = a.value.mermaid) == null ? void 0 : we.class]), t("li", {
934
+ class: `${n}-menu-item`,
933
935
  onClick: () => {
934
936
  c("state");
935
937
  }
936
- }, [(we = n.value.mermaid) == null ? void 0 : we.state]), t("li", {
937
- class: `${a}-menu-item`,
938
+ }, [(Te = a.value.mermaid) == null ? void 0 : Te.state]), t("li", {
939
+ class: `${n}-menu-item`,
938
940
  onClick: () => {
939
941
  c("pie");
940
942
  }
941
- }, [(Te = n.value.mermaid) == null ? void 0 : Te.pie]), t("li", {
942
- class: `${a}-menu-item`,
943
+ }, [(Se = a.value.mermaid) == null ? void 0 : Se.pie]), t("li", {
944
+ class: `${n}-menu-item`,
943
945
  onClick: () => {
944
946
  c("relationship");
945
947
  }
946
- }, [(Se = n.value.mermaid) == null ? void 0 : Se.relationship]), t("li", {
947
- class: `${a}-menu-item`,
948
+ }, [(Ae = a.value.mermaid) == null ? void 0 : Ae.relationship]), t("li", {
949
+ class: `${n}-menu-item`,
948
950
  onClick: () => {
949
951
  c("journey");
950
952
  }
951
- }, [(Ae = n.value.mermaid) == null ? void 0 : Ae.journey])]),
953
+ }, [(Me = a.value.mermaid) == null ? void 0 : Me.journey])]),
952
954
  key: "bar-mermaid"
953
955
  }, {
954
956
  default: () => {
955
957
  var C;
956
958
  return [t("div", {
957
- class: `${a}-toolbar-item`,
958
- title: (C = n.value.toolbarTips) == null ? void 0 : C.mermaid
959
+ class: `${n}-toolbar-item`,
960
+ title: (C = a.value.toolbarTips) == null ? void 0 : C.mermaid
959
961
  }, [t("svg", {
960
- class: `${a}-icon`,
962
+ class: `${n}-icon`,
961
963
  "aria-hidden": "true"
962
964
  }, [t("use", {
963
965
  "xlink:href": "#md-editor-icon-mermaid"
@@ -965,37 +967,37 @@ const Ot = /* @__PURE__ */ O({
965
967
  }
966
968
  });
967
969
  case "katex":
968
- return t(Q, {
969
- relative: `#${s}`,
970
+ return t(ee, {
971
+ relative: `#${i}`,
970
972
  visible: r.katex,
971
973
  onChange: (C) => {
972
974
  r.katex = C;
973
975
  },
974
976
  overlay: t("ul", {
975
- class: `${a}-menu`,
977
+ class: `${n}-menu`,
976
978
  onClick: () => {
977
979
  r.katex = !1;
978
980
  }
979
981
  }, [t("li", {
980
- class: `${a}-menu-item`,
982
+ class: `${n}-menu-item`,
981
983
  onClick: () => {
982
984
  c("katexInline");
983
985
  }
984
- }, [(Me = n.value.katex) == null ? void 0 : Me.inline]), t("li", {
985
- class: `${a}-menu-item`,
986
+ }, [(Le = a.value.katex) == null ? void 0 : Le.inline]), t("li", {
987
+ class: `${n}-menu-item`,
986
988
  onClick: () => {
987
989
  c("katexBlock");
988
990
  }
989
- }, [(Le = n.value.katex) == null ? void 0 : Le.block])]),
991
+ }, [(De = a.value.katex) == null ? void 0 : De.block])]),
990
992
  key: "bar-katex"
991
993
  }, {
992
994
  default: () => {
993
995
  var C;
994
996
  return [t("div", {
995
- class: `${a}-toolbar-item`,
996
- title: (C = n.value.toolbarTips) == null ? void 0 : C.katex
997
+ class: `${n}-toolbar-item`,
998
+ title: (C = a.value.toolbarTips) == null ? void 0 : C.katex
997
999
  }, [t("svg", {
998
- class: `${a}-icon`,
1000
+ class: `${n}-icon`,
999
1001
  "aria-hidden": "true"
1000
1002
  }, [t("use", {
1001
1003
  "xlink:href": "#md-editor-icon-formula"
@@ -1007,57 +1009,57 @@ const Ot = /* @__PURE__ */ O({
1007
1009
  return e.defToolbars instanceof Array ? e.defToolbars[b] || "" : e.defToolbars && e.defToolbars.children instanceof Array && e.defToolbars.children[b] || "";
1008
1010
  };
1009
1011
  return () => {
1010
- const b = d.value[0].map((m) => $(m)), v = d.value[1].map((m) => $(m));
1012
+ const b = u.value[0].map((g) => $(g)), v = u.value[1].map((g) => $(g));
1011
1013
  return t(Ke, null, [e.toolbars.length > 0 && t("div", {
1012
- class: `${a}-toolbar-wrapper`,
1013
- id: s
1014
+ class: `${n}-toolbar-wrapper`,
1015
+ id: i
1014
1016
  }, [t("div", {
1015
- class: `${a}-toolbar`
1017
+ class: `${n}-toolbar`
1016
1018
  }, [t("div", {
1017
- class: `${a}-toolbar-left`,
1019
+ class: `${n}-toolbar-left`,
1018
1020
  ref: f
1019
1021
  }, [b]), t("div", {
1020
- class: `${a}-toolbar-right`
1022
+ class: `${n}-toolbar-right`
1021
1023
  }, [v])])]), t("input", {
1022
- ref: u,
1024
+ ref: d,
1023
1025
  accept: "image/*",
1024
1026
  type: "file",
1025
1027
  multiple: !0,
1026
1028
  style: {
1027
1029
  display: "none"
1028
1030
  }
1029
- }, null), t(Wt, {
1030
- linkVisible: g.linkVisible,
1031
- clipVisible: g.clipVisible,
1032
- type: g.type,
1031
+ }, null), t(Zt, {
1032
+ linkVisible: m.linkVisible,
1033
+ clipVisible: m.clipVisible,
1034
+ type: m.type,
1033
1035
  onCancel: () => {
1034
- g.linkVisible = !1, g.clipVisible = !1;
1036
+ m.linkVisible = !1, m.clipVisible = !1;
1035
1037
  },
1036
- onOk: (m) => {
1037
- m && c(g.type, {
1038
- desc: m.desc,
1039
- url: m.url
1040
- }), g.linkVisible = !1, g.clipVisible = !1;
1038
+ onOk: (g) => {
1039
+ g && c(m.type, {
1040
+ desc: g.desc,
1041
+ url: g.url
1042
+ }), m.linkVisible = !1, m.clipVisible = !1;
1041
1043
  }
1042
1044
  }, null)]);
1043
1045
  };
1044
1046
  }
1045
- }), Yt = (e, o) => {
1046
- const n = rt(() => {
1047
+ }), Xt = (e, o) => {
1048
+ const a = rt(() => {
1047
1049
  e.removeEventListener("scroll", l), e.addEventListener("scroll", l), o.removeEventListener("scroll", l), o.addEventListener("scroll", l);
1048
- }, 50), l = (s) => {
1049
- const r = e.clientHeight, c = o.clientHeight, g = e.scrollHeight, f = o.scrollHeight, d = (g - r) / (f - c);
1050
- s.target === e ? (o.removeEventListener("scroll", l), o.scrollTo({
1051
- top: e.scrollTop / d
1050
+ }, 50), l = (i) => {
1051
+ const r = e.clientHeight, c = o.clientHeight, m = e.scrollHeight, f = o.scrollHeight, u = (m - r) / (f - c);
1052
+ i.target === e ? (o.removeEventListener("scroll", l), o.scrollTo({
1053
+ top: e.scrollTop / u
1052
1054
  // behavior: 'smooth'
1053
- }), n()) : (e.removeEventListener("scroll", l), e.scrollTo({
1054
- top: o.scrollTop * d
1055
+ }), a()) : (e.removeEventListener("scroll", l), e.scrollTo({
1056
+ top: o.scrollTop * u
1055
1057
  // behavior: 'smooth'
1056
- }), n());
1058
+ }), a());
1057
1059
  };
1058
1060
  return [
1059
1061
  () => {
1060
- n().finally(() => {
1062
+ a().finally(() => {
1061
1063
  e.dispatchEvent(new Event("scroll"));
1062
1064
  });
1063
1065
  },
@@ -1065,219 +1067,219 @@ const Ot = /* @__PURE__ */ O({
1065
1067
  e.removeEventListener("scroll", l), o.removeEventListener("scroll", l);
1066
1068
  }
1067
1069
  ];
1068
- }, Zt = (e, o, n) => {
1069
- const { view: l } = n, s = (k) => l.lineBlockAt(l.state.doc.line(k).from).top, r = (k) => l.lineBlockAt(l.state.doc.line(k).from).height;
1070
+ }, Qt = (e, o, a) => {
1071
+ const { view: l } = a, i = (p) => l.lineBlockAt(l.state.doc.line(p).from).top, r = (p) => l.lineBlockAt(l.state.doc.line(p).from).height;
1070
1072
  let c = [];
1071
- const g = () => {
1073
+ const m = () => {
1072
1074
  c = [];
1073
- const k = Array.from(o.querySelectorAll("[data-line]")).map(
1074
- (m) => Number(m.dataset.line) + 1
1075
+ const p = Array.from(o.querySelectorAll("[data-line]")).map(
1076
+ (g) => Number(g.dataset.line) + 1
1075
1077
  ), { lines: $ } = l.state.doc;
1076
- let b = 1, v = k.shift() ?? $;
1077
- for (let m = 1; m <= $; m++)
1078
- m === v && (b = m, v = k.shift() || $ + 1), c.push({
1078
+ let b = 1, v = p.shift() ?? $;
1079
+ for (let g = 1; g <= $; g++)
1080
+ g === v && (b = g, v = p.shift() || $ + 1), c.push({
1079
1081
  start: b,
1080
1082
  end: v - 1
1081
1083
  });
1082
1084
  };
1083
- let f = 0, d = 0;
1084
- const u = it((k) => {
1085
- var v, m, y, x, T, w, M;
1085
+ let f = 0, u = 0;
1086
+ const d = it((p) => {
1087
+ var v, g, y, x, T, w, M;
1086
1088
  if (!((v = o.firstElementChild) != null && v.firstElementChild))
1087
1089
  return;
1088
1090
  const $ = l.lineBlockAtHeight(l.scrollDOM.scrollTop), { number: b } = l.state.doc.lineAt($.from);
1089
1091
  if (!(b > c.length) && !(l.state.doc.lines < c[c.length - 1].end))
1090
- if (k.target === e) {
1091
- if (d !== 0)
1092
+ if (p.target === e) {
1093
+ if (u !== 0)
1092
1094
  return;
1093
1095
  f++;
1094
- const p = c[b - 1], S = s(p.end) + r(p.end);
1096
+ const k = c[b - 1], S = i(k.end) + r(k.end);
1095
1097
  let R = 0;
1096
- const L = s(p.start), D = o.querySelector(`[data-line="${p.start - 1}"]`) || ((m = o.firstElementChild) == null ? void 0 : m.firstElementChild), V = o.querySelector(`[data-line="${p.end}"]`) || ((y = o.lastElementChild) == null ? void 0 : y.lastElementChild);
1097
- let F = 0, E = 0;
1098
- L === 0 ? (R = (l.scrollDOM.scrollTop - L) / (S - L), F = V.offsetTop) : S > l.scrollDOM.scrollHeight - l.scrollDOM.clientHeight ? (R = (l.scrollDOM.scrollTop - L) / (l.scrollDOM.scrollHeight - l.scrollDOM.clientHeight - L), E = D.offsetTop, F = o.scrollHeight - o.clientHeight - E + 10) : (R = (l.scrollDOM.scrollTop - L) / (S - L), E = D.offsetTop, F = V.offsetTop - E);
1099
- const K = E - 10 + F * R;
1100
- De(o, K, () => {
1098
+ const L = i(k.start), D = o.querySelector(`[data-line="${k.start - 1}"]`) || ((g = o.firstElementChild) == null ? void 0 : g.firstElementChild), V = o.querySelector(`[data-line="${k.end}"]`) || ((y = o.lastElementChild) == null ? void 0 : y.lastElementChild);
1099
+ let B = 0, E = 0;
1100
+ L === 0 ? (R = (l.scrollDOM.scrollTop - L) / (S - L), B = V.offsetTop) : S > l.scrollDOM.scrollHeight - l.scrollDOM.clientHeight ? (R = (l.scrollDOM.scrollTop - L) / (l.scrollDOM.scrollHeight - l.scrollDOM.clientHeight - L), E = D.offsetTop, B = o.scrollHeight - o.clientHeight - E + 10) : (R = (l.scrollDOM.scrollTop - L) / (S - L), E = D.offsetTop, B = V.offsetTop - E);
1101
+ const G = E - 10 + B * R;
1102
+ Ee(o, G, () => {
1101
1103
  f--;
1102
1104
  });
1103
1105
  } else {
1104
1106
  if (f !== 0)
1105
1107
  return;
1106
- d++;
1107
- const p = Array.from(
1108
+ u++;
1109
+ const k = Array.from(
1108
1110
  o.querySelectorAll("[data-line]")
1109
1111
  ), S = o.scrollTop, R = o.scrollHeight;
1110
- let L = p.length === 0 ? 1 : Math.ceil(
1111
- Number(p[p.length - 1].dataset.line) * (S / R)
1112
+ let L = k.length === 0 ? 1 : Math.ceil(
1113
+ Number(k[k.length - 1].dataset.line) * (S / R)
1112
1114
  ), D = (x = o.firstElementChild) == null ? void 0 : x.firstElementChild;
1113
1115
  for (let H = L; H >= 0; H--) {
1114
- const I = o.querySelector(`[data-line="${H}"]`);
1115
- if (I && I.offsetTop <= S) {
1116
- D = I, L = H;
1116
+ const F = o.querySelector(`[data-line="${H}"]`);
1117
+ if (F && F.offsetTop <= S) {
1118
+ D = F, L = H;
1117
1119
  break;
1118
1120
  }
1119
1121
  }
1120
- let V = (T = o.firstElementChild) == null ? void 0 : T.firstElementChild, F = (w = o.firstElementChild) == null ? void 0 : w.lastElementChild;
1121
- for (; p.length > 0; ) {
1122
- const H = p.indexOf(D);
1123
- if (H + 1 >= p.length)
1122
+ let V = (T = o.firstElementChild) == null ? void 0 : T.firstElementChild, B = (w = o.firstElementChild) == null ? void 0 : w.lastElementChild;
1123
+ for (; k.length > 0; ) {
1124
+ const H = k.indexOf(D);
1125
+ if (H + 1 >= k.length)
1124
1126
  break;
1125
- const I = p[H + 1];
1127
+ const F = k[H + 1];
1126
1128
  if (H === -1) {
1127
- F = I;
1129
+ B = F;
1128
1130
  break;
1129
1131
  }
1130
- const X = D.offsetTop;
1131
- if (X > S) {
1132
+ const Q = D.offsetTop;
1133
+ if (Q > S) {
1132
1134
  if (H === 0) {
1133
- V = D, F = I;
1135
+ V = D, B = F;
1134
1136
  break;
1135
1137
  }
1136
- D = p[H - 1];
1138
+ D = k[H - 1];
1137
1139
  continue;
1138
1140
  }
1139
- const oe = I.offsetTop;
1140
- if (X <= S && oe > S) {
1141
- V = D, F = I;
1141
+ const ae = F.offsetTop;
1142
+ if (Q <= S && ae > S) {
1143
+ V = D, B = F;
1142
1144
  break;
1143
1145
  }
1144
- D = I;
1146
+ D = F;
1145
1147
  }
1146
- const E = V.offsetTop, K = F.offsetTop;
1148
+ const E = V.offsetTop, G = B.offsetTop;
1147
1149
  let N = 0;
1148
- const { start: le, end: Z } = c[Number(V.dataset.line || 0)], j = s(le);
1149
- let P = s(Z);
1150
- const J = r(Z);
1151
- let _ = 0;
1152
- V === ((M = o.firstElementChild) == null ? void 0 : M.firstElementChild) ? (N = Math.max(S / K, 0), _ = P + J - j) : P > l.scrollDOM.scrollHeight - l.scrollDOM.clientHeight ? (N = Math.max(
1150
+ const { start: oe, end: J } = c[Number(V.dataset.line || 0)], K = i(oe);
1151
+ let P = i(J);
1152
+ const X = r(J);
1153
+ let j = 0;
1154
+ V === ((M = o.firstElementChild) == null ? void 0 : M.firstElementChild) ? (N = Math.max(S / G, 0), j = P + X - K) : P > l.scrollDOM.scrollHeight - l.scrollDOM.clientHeight ? (N = Math.max(
1153
1155
  (S - E) / (o.scrollHeight - E - o.clientHeight),
1154
1156
  0
1155
- ), P = s(l.state.doc.lines) + r(l.state.doc.lines), _ = 8 + P - j - e.clientHeight) : (N = Math.max(
1156
- (S - E) / (K - E),
1157
+ ), P = i(l.state.doc.lines) + r(l.state.doc.lines), j = 8 + P - K - e.clientHeight) : (N = Math.max(
1158
+ (S - E) / (G - E),
1157
1159
  0
1158
- ), _ = P + J - j), De(e, j + _ * N, () => {
1159
- d--;
1160
+ ), j = P + X - K), Ee(e, K + j * N, () => {
1161
+ u--;
1160
1162
  });
1161
1163
  }
1162
1164
  }, 10);
1163
1165
  return [
1164
1166
  () => {
1165
- g(), e.addEventListener("scroll", u), o.addEventListener("scroll", u), e.dispatchEvent(new Event("scroll"));
1167
+ m(), e.addEventListener("scroll", d), o.addEventListener("scroll", d), e.dispatchEvent(new Event("scroll"));
1166
1168
  },
1167
1169
  () => {
1168
- c = [], e.removeEventListener("scroll", u), o.removeEventListener("scroll", u);
1170
+ c = [], e.removeEventListener("scroll", d), o.removeEventListener("scroll", d);
1169
1171
  }
1170
1172
  ];
1171
- }, Jt = (e, o, n) => {
1173
+ }, el = (e, o, a) => {
1172
1174
  const l = A("editorId");
1173
- let s = () => {
1175
+ let i = () => {
1174
1176
  }, r = () => {
1175
1177
  };
1176
1178
  const c = () => {
1177
- s();
1178
- const g = document.querySelector(".cm-scroller"), f = document.querySelector(
1179
+ i();
1180
+ const m = document.querySelector(".cm-scroller"), f = document.querySelector(
1179
1181
  `[id="${l}-preview-wrapper"][data-show="true"]`
1180
- ), d = document.querySelector(
1182
+ ), u = document.querySelector(
1181
1183
  `[id="${l}-html-wrapper"][data-show="true"]`
1182
1184
  );
1183
- (f || d) && ([r, s] = (f ? Zt : Yt)(
1184
- g,
1185
- f || d,
1186
- n.value
1185
+ (f || u) && ([r, i] = (f ? Qt : Xt)(
1186
+ m,
1187
+ f || u,
1188
+ a.value
1187
1189
  )), e.scrollAuto && r();
1188
1190
  };
1189
- B(
1191
+ I(
1190
1192
  [
1191
1193
  o,
1192
- ae(e.setting, "preview"),
1193
- ae(e.setting, "htmlPreview"),
1194
- ae(e.setting, "fullscreen"),
1195
- ae(e.setting, "pageFullscreen")
1194
+ ne(e.setting, "preview"),
1195
+ ne(e.setting, "htmlPreview"),
1196
+ ne(e.setting, "fullscreen"),
1197
+ ne(e.setting, "pageFullscreen")
1196
1198
  ],
1197
1199
  () => {
1198
- ue(c);
1200
+ me(c);
1199
1201
  }
1200
- ), B(
1202
+ ), I(
1201
1203
  () => e.scrollAuto,
1202
- (g) => {
1203
- g ? r() : s();
1204
+ (m) => {
1205
+ m ? r() : i();
1204
1206
  }
1205
1207
  ), W(c);
1206
- }, Xt = Jt, Qt = (e, o, n) => {
1207
- var u, k, $, b, v, m;
1208
- let l = "", s = 0, r = 0, c = !0, g = !1;
1209
- const f = o.getSelectedText(), d = (u = G.editorConfig) == null ? void 0 : u.mermaidTemplate;
1208
+ }, tl = el, ll = (e, o, a) => {
1209
+ var d, p, $, b, v, g;
1210
+ let l = "", i = 0, r = 0, c = !0, m = !1;
1211
+ const f = o.getSelectedText(), u = (d = _.editorConfig) == null ? void 0 : d.mermaidTemplate;
1210
1212
  if (/^h[1-6]{1}$/.test(e)) {
1211
1213
  const y = e.replace(/^h(\d)/, (x, T) => new Array(Number(T)).fill("#", 0, T).join(""));
1212
- l = `${y} ${f}`, s = y.length + 1;
1214
+ l = `${y} ${f}`, i = y.length + 1;
1213
1215
  } else if (e === "prettier") {
1214
- const y = window.prettier || (($ = (k = G.editorExtensions) == null ? void 0 : k.prettier) == null ? void 0 : $.prettierInstance), x = [
1215
- ((b = window.prettierPlugins) == null ? void 0 : b.markdown) || ((m = (v = G.editorExtensions) == null ? void 0 : v.prettier) == null ? void 0 : m.parserMarkdownInstance)
1216
+ const y = window.prettier || (($ = (p = _.editorExtensions) == null ? void 0 : p.prettier) == null ? void 0 : $.prettierInstance), x = [
1217
+ ((b = window.prettierPlugins) == null ? void 0 : b.markdown) || ((g = (v = _.editorExtensions) == null ? void 0 : v.prettier) == null ? void 0 : g.parserMarkdownInstance)
1216
1218
  ];
1217
- !y || x[0] === void 0 ? (h.emit(n.editorId, "errorCatcher", {
1219
+ !y || x[0] === void 0 ? (h.emit(a.editorId, "errorCatcher", {
1218
1220
  name: "prettier",
1219
1221
  message: "prettier is undefined"
1220
1222
  }), l = o.getValue()) : l = y.format(o.getValue(), {
1221
1223
  parser: "markdown",
1222
1224
  plugins: x
1223
- }), c = !1, g = !0;
1225
+ }), c = !1, m = !0;
1224
1226
  } else
1225
1227
  switch (e) {
1226
1228
  case "bold": {
1227
- l = `**${f}**`, s = 2, r = -2;
1229
+ l = `**${f}**`, i = 2, r = -2;
1228
1230
  break;
1229
1231
  }
1230
1232
  case "underline": {
1231
- l = `<u>${f}</u>`, s = 3, r = -4;
1233
+ l = `<u>${f}</u>`, i = 3, r = -4;
1232
1234
  break;
1233
1235
  }
1234
1236
  case "italic": {
1235
- l = `*${f}*`, s = 1, r = -1;
1237
+ l = `*${f}*`, i = 1, r = -1;
1236
1238
  break;
1237
1239
  }
1238
1240
  case "strikeThrough": {
1239
- l = `~~${f}~~`, s = 2, r = -2;
1241
+ l = `~~${f}~~`, i = 2, r = -2;
1240
1242
  break;
1241
1243
  }
1242
1244
  case "sub": {
1243
- l = `<sub>${f}</sub>`, s = 5, r = -6;
1245
+ l = `<sub>${f}</sub>`, i = 5, r = -6;
1244
1246
  break;
1245
1247
  }
1246
1248
  case "sup": {
1247
- l = `<sup>${f}</sup>`, s = 5, r = -6;
1249
+ l = `<sup>${f}</sup>`, i = 5, r = -6;
1248
1250
  break;
1249
1251
  }
1250
1252
  case "codeRow": {
1251
- l = "`" + f + "`", s = 1, r = -1;
1253
+ l = "`" + f + "`", i = 1, r = -1;
1252
1254
  break;
1253
1255
  }
1254
1256
  case "quote": {
1255
- l = `> ${f}`, s = 2;
1257
+ l = `> ${f}`, i = 2;
1256
1258
  break;
1257
1259
  }
1258
1260
  case "orderedList": {
1259
- l = `1. ${f}`, s = 3;
1261
+ l = `1. ${f}`, i = 3;
1260
1262
  break;
1261
1263
  }
1262
1264
  case "unorderedList": {
1263
- l = `- ${f}`, s = 2;
1265
+ l = `- ${f}`, i = 2;
1264
1266
  break;
1265
1267
  }
1266
1268
  case "task": {
1267
- l = `- [ ] ${f}`, s = 6;
1269
+ l = `- [ ] ${f}`, i = 6;
1268
1270
  break;
1269
1271
  }
1270
1272
  case "code": {
1271
- const y = n.text || f || "", x = n.mode || "language";
1273
+ const y = a.text || f || "", x = a.mode || "language";
1272
1274
  l = `\`\`\`${x}
1273
1275
  ${y}
1274
1276
  \`\`\`
1275
- `, s = 3, r = 3 + x.length - l.length;
1277
+ `, i = 3, r = 3 + x.length - l.length;
1276
1278
  break;
1277
1279
  }
1278
1280
  case "table": {
1279
1281
  l = "|";
1280
- const { selectedShape: y = { x: 1, y: 1 } } = n, { x, y: T } = y;
1282
+ const { selectedShape: y = { x: 1, y: 1 } } = a, { x, y: T } = y;
1281
1283
  for (let w = 0; w <= T; w++)
1282
1284
  l += " col |";
1283
1285
  l += `
@@ -1290,16 +1292,16 @@ ${y}
1290
1292
  for (let M = 0; M <= T; M++)
1291
1293
  l += " content |";
1292
1294
  }
1293
- s = 2, r = 5 - l.length;
1295
+ i = 2, r = 5 - l.length;
1294
1296
  break;
1295
1297
  }
1296
1298
  case "link": {
1297
- const { desc: y, url: x } = n;
1299
+ const { desc: y, url: x } = a;
1298
1300
  l = `[${y}](${x})`, c = !1;
1299
1301
  break;
1300
1302
  }
1301
1303
  case "image": {
1302
- const { desc: y, url: x, urls: T } = n;
1304
+ const { desc: y, url: x, urls: T } = a;
1303
1305
  T instanceof Array ? l = T.reduce((w, M) => w + `![${y}](${M})
1304
1306
  `, "") : l = `![${y}](${x})
1305
1307
  `, c = !1;
@@ -1307,73 +1309,73 @@ ${y}
1307
1309
  }
1308
1310
  case "flow": {
1309
1311
  l = `\`\`\`mermaid
1310
- ${(d == null ? void 0 : d.flow) || `flowchart TD
1312
+ ${(u == null ? void 0 : u.flow) || `flowchart TD
1311
1313
  Start --> Stop`}
1312
1314
  \`\`\`
1313
- `, s = 3, r = 10 - l.length;
1315
+ `, i = 3, r = 10 - l.length;
1314
1316
  break;
1315
1317
  }
1316
1318
  case "sequence": {
1317
1319
  l = `\`\`\`mermaid
1318
- ${(d == null ? void 0 : d.sequence) || `sequenceDiagram
1320
+ ${(u == null ? void 0 : u.sequence) || `sequenceDiagram
1319
1321
  A->>B: hello!
1320
1322
  B-->>A: hi!
1321
1323
  A-)B: bye!`}
1322
1324
  \`\`\`
1323
- `, s = 3, r = 10 - l.length;
1325
+ `, i = 3, r = 10 - l.length;
1324
1326
  break;
1325
1327
  }
1326
1328
  case "gantt": {
1327
1329
  l = `\`\`\`mermaid
1328
- ${(d == null ? void 0 : d.gantt) || `gantt
1330
+ ${(u == null ? void 0 : u.gantt) || `gantt
1329
1331
  title A Gantt Diagram
1330
1332
  dateFormat YYYY-MM-DD
1331
1333
  section Section
1332
1334
  A task :a1, 2014-01-01, 30d
1333
1335
  Another task :after a1, 20d`}
1334
1336
  \`\`\`
1335
- `, s = 3, r = 10 - l.length;
1337
+ `, i = 3, r = 10 - l.length;
1336
1338
  break;
1337
1339
  }
1338
1340
  case "class": {
1339
1341
  l = `\`\`\`mermaid
1340
- ${(d == null ? void 0 : d.class) || `classDiagram
1342
+ ${(u == null ? void 0 : u.class) || `classDiagram
1341
1343
  class Animal
1342
1344
  Vehicle <|-- Car`}
1343
1345
  \`\`\`
1344
- `, s = 3, r = 10 - l.length;
1346
+ `, i = 3, r = 10 - l.length;
1345
1347
  break;
1346
1348
  }
1347
1349
  case "state": {
1348
1350
  l = `\`\`\`mermaid
1349
- ${(d == null ? void 0 : d.state) || `stateDiagram-v2
1351
+ ${(u == null ? void 0 : u.state) || `stateDiagram-v2
1350
1352
  s1 --> s2`}
1351
1353
  \`\`\`
1352
- `, s = 3, r = 10 - l.length;
1354
+ `, i = 3, r = 10 - l.length;
1353
1355
  break;
1354
1356
  }
1355
1357
  case "pie": {
1356
1358
  l = `\`\`\`mermaid
1357
- ${(d == null ? void 0 : d.pie) || `pie title Pets adopted by volunteers
1359
+ ${(u == null ? void 0 : u.pie) || `pie title Pets adopted by volunteers
1358
1360
  "Dogs" : 386
1359
1361
  "Cats" : 85
1360
1362
  "Rats" : 15`}
1361
1363
  \`\`\`
1362
- `, s = 3, r = 10 - l.length;
1364
+ `, i = 3, r = 10 - l.length;
1363
1365
  break;
1364
1366
  }
1365
1367
  case "relationship": {
1366
1368
  l = `\`\`\`mermaid
1367
- ${(d == null ? void 0 : d.relationship) || `erDiagram
1369
+ ${(u == null ? void 0 : u.relationship) || `erDiagram
1368
1370
  CAR ||--o{ NAMED-DRIVER : allows
1369
1371
  PERSON ||--o{ NAMED-DRIVER : is`}
1370
1372
  \`\`\`
1371
- `, s = 3, r = 10 - l.length;
1373
+ `, i = 3, r = 10 - l.length;
1372
1374
  break;
1373
1375
  }
1374
1376
  case "journey": {
1375
1377
  l = `\`\`\`mermaid
1376
- ${(d == null ? void 0 : d.journey) || `journey
1378
+ ${(u == null ? void 0 : u.journey) || `journey
1377
1379
  title My working day
1378
1380
  section Go to work
1379
1381
  Make tea: 5: Me
@@ -1383,23 +1385,23 @@ ${(d == null ? void 0 : d.journey) || `journey
1383
1385
  Go downstairs: 5: Me
1384
1386
  Sit down: 5: Me`}
1385
1387
  \`\`\`
1386
- `, s = 3, r = 10 - l.length;
1388
+ `, i = 3, r = 10 - l.length;
1387
1389
  break;
1388
1390
  }
1389
1391
  case "katexInline": {
1390
- l = "$$", s = 1, r = -1;
1392
+ l = "$$", i = 1, r = -1;
1391
1393
  break;
1392
1394
  }
1393
1395
  case "katexBlock": {
1394
1396
  l = `$$
1395
1397
 
1396
1398
  $$
1397
- `, s = 3, r = -4;
1399
+ `, i = 3, r = -4;
1398
1400
  break;
1399
1401
  }
1400
1402
  case "universal": {
1401
- const { generate: y } = n, x = y(f);
1402
- l = x.targetValue, c = x.select, s = x.deviationStart, r = x.deviationEnd;
1403
+ const { generate: y } = a, x = y(f);
1404
+ l = x.targetValue, c = x.select, i = x.deviationStart, r = x.deviationEnd;
1403
1405
  }
1404
1406
  }
1405
1407
  return {
@@ -1408,25 +1410,25 @@ $$
1408
1410
  // 是否选中
1409
1411
  select: c,
1410
1412
  // 选中时,开始位置的偏移量
1411
- deviationStart: s,
1413
+ deviationStart: i,
1412
1414
  // 结束的偏移量
1413
1415
  deviationEnd: r,
1414
1416
  // 是否整个替换
1415
- replaceAll: g
1417
+ replaceAll: m
1416
1418
  }
1417
1419
  };
1418
- }, el = "#e5c07b", He = "var(--md-color)", tl = "#56b6c2", ll = "#ffffff", ee = "var(--md-color)", Fe = "#e5c07b", ol = "#e5c07b", al = "var(--md-color)", Ie = "#d19a66", nl = "#c678dd", rl = "#21252b", Be = "#2c313a", Oe = "var(--md-bk-color)", se = "#353a42", il = "#ceedfa33", Ve = "#528bff", sl = fe.theme(
1420
+ }, ol = "#e5c07b", Be = "var(--md-color)", al = "#56b6c2", nl = "#ffffff", te = "var(--md-color)", Fe = "#e5c07b", rl = "#e5c07b", il = "var(--md-color)", Ie = "#d19a66", sl = "#c678dd", cl = "#21252b", dl = "#2c313a", Oe = "var(--md-bk-color)", ce = "var(--md-bk-color)", ul = "#ceedfa33", Ve = "#528bff", ml = ge.theme(
1419
1421
  {
1420
1422
  "&": {
1421
- color: ee,
1423
+ color: te,
1422
1424
  backgroundColor: Oe
1423
1425
  },
1424
1426
  ".cm-content": {
1425
1427
  caretColor: Ve
1426
1428
  },
1427
1429
  ".cm-cursor, .cm-dropCursor": { borderLeftColor: Ve },
1428
- "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: il },
1429
- ".cm-panels": { backgroundColor: rl, color: ee },
1430
+ "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: ul },
1431
+ ".cm-panels": { backgroundColor: cl, color: te },
1430
1432
  ".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
1431
1433
  ".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
1432
1434
  ".cm-searchMatch": {
@@ -1443,12 +1445,12 @@ $$
1443
1445
  },
1444
1446
  ".cm-gutters": {
1445
1447
  backgroundColor: Oe,
1446
- color: ee,
1448
+ color: te,
1447
1449
  borderRight: "1px solid",
1448
1450
  borderColor: "var(--md-border-color)"
1449
1451
  },
1450
1452
  ".cm-activeLineGutter": {
1451
- backgroundColor: Be
1453
+ backgroundColor: dl
1452
1454
  },
1453
1455
  ".cm-foldPlaceholder": {
1454
1456
  backgroundColor: "transparent",
@@ -1456,80 +1458,79 @@ $$
1456
1458
  color: "#ddd"
1457
1459
  },
1458
1460
  ".cm-tooltip": {
1459
- border: "none",
1460
- backgroundColor: se
1461
+ border: "1px solid var(--md-border-color)",
1462
+ backgroundColor: ce
1461
1463
  },
1462
1464
  ".cm-tooltip .cm-tooltip-arrow:before": {
1463
1465
  borderTopColor: "transparent",
1464
1466
  borderBottomColor: "transparent"
1465
1467
  },
1466
1468
  ".cm-tooltip .cm-tooltip-arrow:after": {
1467
- borderTopColor: se,
1468
- borderBottomColor: se
1469
+ borderTopColor: ce,
1470
+ borderBottomColor: ce
1469
1471
  },
1470
1472
  ".cm-tooltip-autocomplete": {
1471
1473
  "& > ul > li[aria-selected]": {
1472
- backgroundColor: Be,
1473
- color: ee
1474
+ color: te
1474
1475
  }
1475
1476
  }
1476
1477
  },
1477
1478
  { dark: !0 }
1478
- ), cl = We.define([
1479
- { tag: i.keyword, color: nl },
1480
- { tag: [i.name, i.deleted, i.character, i.propertyName, i.macroName], color: He },
1481
- { tag: [i.function(i.variableName), i.labelName], color: ol },
1482
- { tag: [i.color, i.constant(i.name), i.standard(i.name)], color: Ie },
1483
- { tag: [i.definition(i.name), i.separator], color: ee },
1479
+ ), fl = We.define([
1480
+ { tag: s.keyword, color: sl },
1481
+ { tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: Be },
1482
+ { tag: [s.function(s.variableName), s.labelName], color: rl },
1483
+ { tag: [s.color, s.constant(s.name), s.standard(s.name)], color: Ie },
1484
+ { tag: [s.definition(s.name), s.separator], color: te },
1484
1485
  {
1485
1486
  tag: [
1486
- i.typeName,
1487
- i.className,
1488
- i.number,
1489
- i.changed,
1490
- i.annotation,
1491
- i.modifier,
1492
- i.self,
1493
- i.namespace
1487
+ s.typeName,
1488
+ s.className,
1489
+ s.number,
1490
+ s.changed,
1491
+ s.annotation,
1492
+ s.modifier,
1493
+ s.self,
1494
+ s.namespace
1494
1495
  ],
1495
- color: el
1496
+ color: ol
1496
1497
  },
1497
1498
  {
1498
1499
  tag: [
1499
- i.operator,
1500
- i.operatorKeyword,
1501
- i.url,
1502
- i.escape,
1503
- i.regexp,
1504
- i.link,
1505
- i.special(i.string)
1500
+ s.operator,
1501
+ s.operatorKeyword,
1502
+ s.url,
1503
+ s.escape,
1504
+ s.regexp,
1505
+ s.link,
1506
+ s.special(s.string)
1506
1507
  ],
1507
- color: tl
1508
- },
1509
- { tag: [i.meta, i.comment], color: Fe },
1510
- { tag: i.strong, fontWeight: "bold" },
1511
- { tag: i.emphasis, fontStyle: "italic" },
1512
- { tag: i.strikethrough, textDecoration: "line-through" },
1513
- { tag: i.link, color: Fe, textDecoration: "underline" },
1514
- { tag: i.heading, fontWeight: "bold", color: He },
1515
- { tag: [i.atom, i.bool, i.special(i.variableName)], color: Ie },
1516
- { tag: [i.processingInstruction, i.string, i.inserted], color: al },
1517
- { tag: i.invalid, color: ll }
1518
- ]), dl = [
1519
- sl,
1520
- ze(cl)
1521
- ], ul = "#e5c07b", Re = "#3f4a54", ml = "#56b6c2", fl = "#fff", te = "#3f4a54", Ne = "#2d8cf0", gl = "#2d8cf0", hl = "#3f4a54", Pe = "#d19a66", bl = "#c678dd", vl = "#21252b", Ue = "#ceedfa33", qe = "var(--md-bk-color)", ce = "#353a42", kl = "#bad5fa", Ge = "#3f4a54", pl = fe.theme(
1508
+ color: al
1509
+ },
1510
+ { tag: [s.meta, s.comment], color: Fe },
1511
+ { tag: s.strong, fontWeight: "bold" },
1512
+ { tag: s.emphasis, fontStyle: "italic" },
1513
+ { tag: s.strikethrough, textDecoration: "line-through" },
1514
+ { tag: s.link, color: Fe, textDecoration: "underline" },
1515
+ { tag: s.heading, fontWeight: "bold", color: Be },
1516
+ { tag: [s.atom, s.bool, s.special(s.variableName)], color: Ie },
1517
+ { tag: [s.processingInstruction, s.string, s.inserted], color: il },
1518
+ { tag: s.invalid, color: nl }
1519
+ ]), gl = [
1520
+ ml,
1521
+ ze(fl)
1522
+ ], hl = "#e5c07b", Re = "#3f4a54", bl = "#56b6c2", vl = "#fff", le = "#3f4a54", Ne = "#2d8cf0", pl = "#2d8cf0", kl = "#3f4a54", Pe = "#d19a66", Cl = "#c678dd", $l = "#21252b", yl = "#ceedfa33", qe = "var(--md-bk-color)", de = "var(--md-bk-color)", xl = "#bad5fa", Ue = "#3f4a54", wl = ge.theme(
1522
1523
  {
1523
1524
  "&": {
1524
- color: te,
1525
+ color: le,
1525
1526
  backgroundColor: qe
1526
1527
  },
1527
1528
  ".cm-content": {
1528
- caretColor: Ge
1529
+ caretColor: Ue
1529
1530
  },
1530
- ".cm-cursor, .cm-dropCursor": { borderLeftColor: Ge },
1531
- "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: kl },
1532
- ".cm-panels": { backgroundColor: vl, color: te },
1531
+ ".cm-cursor, .cm-dropCursor": { borderLeftColor: Ue },
1532
+ "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: xl },
1533
+ ".cm-panels": { backgroundColor: $l, color: le },
1533
1534
  ".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
1534
1535
  ".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
1535
1536
  ".cm-searchMatch": {
@@ -1546,12 +1547,12 @@ $$
1546
1547
  },
1547
1548
  ".cm-gutters": {
1548
1549
  backgroundColor: qe,
1549
- color: te,
1550
+ color: le,
1550
1551
  borderRight: "1px solid",
1551
1552
  borderColor: "var(--md-border-color)"
1552
1553
  },
1553
1554
  ".cm-activeLineGutter": {
1554
- backgroundColor: Ue
1555
+ backgroundColor: yl
1555
1556
  },
1556
1557
  ".cm-foldPlaceholder": {
1557
1558
  backgroundColor: "transparent",
@@ -1559,87 +1560,204 @@ $$
1559
1560
  color: "#ddd"
1560
1561
  },
1561
1562
  ".cm-tooltip": {
1562
- border: "none",
1563
- backgroundColor: ce
1563
+ border: "1px solid var(--md-border-color)",
1564
+ backgroundColor: de
1564
1565
  },
1565
1566
  ".cm-tooltip .cm-tooltip-arrow:before": {
1566
1567
  borderTopColor: "transparent",
1567
1568
  borderBottomColor: "transparent"
1568
1569
  },
1569
1570
  ".cm-tooltip .cm-tooltip-arrow:after": {
1570
- borderTopColor: ce,
1571
- borderBottomColor: ce
1571
+ borderTopColor: de,
1572
+ borderBottomColor: de
1572
1573
  },
1573
1574
  ".cm-tooltip-autocomplete": {
1574
1575
  "& > ul > li[aria-selected]": {
1575
- backgroundColor: Ue,
1576
- color: te
1576
+ color: le
1577
1577
  }
1578
1578
  }
1579
- },
1580
- { dark: !0 }
1581
- ), Cl = We.define([
1582
- { tag: i.keyword, color: bl },
1583
- { tag: [i.name, i.deleted, i.character, i.propertyName, i.macroName], color: Re },
1584
- { tag: [i.function(i.variableName), i.labelName], color: gl },
1585
- { tag: [i.color, i.constant(i.name), i.standard(i.name)], color: Pe },
1586
- { tag: [i.definition(i.name), i.separator], color: te },
1579
+ }
1580
+ // { dark: true }
1581
+ ), Tl = We.define([
1582
+ { tag: s.keyword, color: Cl },
1583
+ { tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: Re },
1584
+ { tag: [s.function(s.variableName), s.labelName], color: pl },
1585
+ { tag: [s.color, s.constant(s.name), s.standard(s.name)], color: Pe },
1586
+ { tag: [s.definition(s.name), s.separator], color: le },
1587
1587
  {
1588
1588
  tag: [
1589
- i.typeName,
1590
- i.className,
1591
- i.number,
1592
- i.changed,
1593
- i.annotation,
1594
- i.modifier,
1595
- i.self,
1596
- i.namespace
1589
+ s.typeName,
1590
+ s.className,
1591
+ s.number,
1592
+ s.changed,
1593
+ s.annotation,
1594
+ s.modifier,
1595
+ s.self,
1596
+ s.namespace
1597
1597
  ],
1598
- color: ul
1598
+ color: hl
1599
1599
  },
1600
1600
  {
1601
1601
  tag: [
1602
- i.operator,
1603
- i.operatorKeyword,
1604
- i.url,
1605
- i.escape,
1606
- i.regexp,
1607
- i.link,
1608
- i.special(i.string)
1602
+ s.operator,
1603
+ s.operatorKeyword,
1604
+ s.url,
1605
+ s.escape,
1606
+ s.regexp,
1607
+ s.link,
1608
+ s.special(s.string)
1609
1609
  ],
1610
- color: ml
1611
- },
1612
- { tag: [i.meta, i.comment], color: Ne },
1613
- { tag: i.strong, fontWeight: "bold" },
1614
- { tag: i.emphasis, fontStyle: "italic" },
1615
- { tag: i.strikethrough, textDecoration: "line-through" },
1616
- { tag: i.link, color: Ne, textDecoration: "underline" },
1617
- { tag: i.heading, fontWeight: "bold", color: Re },
1618
- { tag: [i.atom, i.bool, i.special(i.variableName)], color: Pe },
1619
- { tag: [i.processingInstruction, i.string, i.inserted], color: hl },
1620
- { tag: i.invalid, color: fl }
1621
- ]), $l = [
1622
- pl,
1623
- ze(Cl)
1624
- ], z = (e) => {
1625
- const o = new Ft();
1610
+ color: bl
1611
+ },
1612
+ { tag: [s.meta, s.comment], color: Ne },
1613
+ { tag: s.strong, fontWeight: "bold" },
1614
+ { tag: s.emphasis, fontStyle: "italic" },
1615
+ { tag: s.strikethrough, textDecoration: "line-through" },
1616
+ { tag: s.link, color: Ne, textDecoration: "underline" },
1617
+ { tag: s.heading, fontWeight: "bold", color: Re },
1618
+ { tag: [s.atom, s.bool, s.special(s.variableName)], color: Pe },
1619
+ { tag: [s.processingInstruction, s.string, s.inserted], color: kl },
1620
+ { tag: s.invalid, color: vl }
1621
+ ]), Sl = [
1622
+ wl,
1623
+ ze(Tl)
1624
+ ], ie = (e, o, a, l, i) => (r, c, m, f) => {
1625
+ const u = `${e}${o}`.slice(f - m);
1626
+ r.dispatch(r.state.replaceSelection(`${u}${a}${l}`));
1627
+ const d = m + c.label.length + (i === "title" ? a.length : 0);
1628
+ r.dispatch({
1629
+ selection: Y.create(
1630
+ [
1631
+ Y.range(
1632
+ m + c.label.length + (i === "title" ? 1 : -o.length),
1633
+ d
1634
+ ),
1635
+ Y.cursor(d)
1636
+ ],
1637
+ 1
1638
+ )
1639
+ }), r.focus();
1640
+ }, Ge = (e) => (o, a, l, i) => {
1641
+ const r = e.slice(i - l);
1642
+ o.dispatch(o.state.replaceSelection(`${r} `));
1643
+ }, Al = (e) => {
1644
+ const o = (a) => {
1645
+ const l = a.matchBefore(
1646
+ /^#+|^-\s*\[*\s*\]*|`+|\[|!\[*|^\|\s?\|?|^\$\$?|!+\s*\w*/
1647
+ );
1648
+ return l === null || l.from == l.to && a.explicit ? null : {
1649
+ from: l.from,
1650
+ options: [
1651
+ // 标题
1652
+ ...["h1", "h2", "h3", "h4", "h5", "h6"].map((i, r) => {
1653
+ const c = new Array(r + 1).fill("#").join("");
1654
+ return {
1655
+ label: c,
1656
+ type: "text",
1657
+ apply: Ge(c)
1658
+ };
1659
+ }),
1660
+ // 任务列表
1661
+ ...["unchecked", "checked"].map((i) => {
1662
+ const r = i === "checked" ? "- [x]" : "- [ ]";
1663
+ return {
1664
+ label: r,
1665
+ type: "text",
1666
+ apply: Ge(r)
1667
+ };
1668
+ }),
1669
+ // 代码
1670
+ ...[
1671
+ ["`", ""],
1672
+ ["```", "language"],
1673
+ ["```mermaid\n", ""]
1674
+ ].map((i) => ({
1675
+ label: `${i[0]}${i[1]}`,
1676
+ type: "text",
1677
+ apply: ie(i[0], i[1], "", i[0] === "`" ? "`" : "\n```", "type")
1678
+ })),
1679
+ // 链接
1680
+ {
1681
+ label: "[]()",
1682
+ type: "text"
1683
+ },
1684
+ {
1685
+ label: "![]()",
1686
+ type: "text"
1687
+ },
1688
+ // 表格
1689
+ {
1690
+ label: "| |",
1691
+ type: "text",
1692
+ detail: "table",
1693
+ apply: `| col | col | col |
1694
+ | - | - | - |
1695
+ | content | content | content |
1696
+ | content | content | content |`
1697
+ },
1698
+ // 公式
1699
+ {
1700
+ label: "$",
1701
+ type: "text",
1702
+ apply: ie("$", "", "", "$", "type")
1703
+ },
1704
+ {
1705
+ label: "$$",
1706
+ type: "text",
1707
+ apply: ie("$$", "", `
1708
+ `, `
1709
+ $$`, "title")
1710
+ },
1711
+ // 那啥?
1712
+ ...[
1713
+ "note",
1714
+ "abstract",
1715
+ "info",
1716
+ "tip",
1717
+ "success",
1718
+ "question",
1719
+ "warning",
1720
+ "failure",
1721
+ "danger",
1722
+ "bug",
1723
+ "example",
1724
+ "quote",
1725
+ "hint",
1726
+ "caution",
1727
+ "error",
1728
+ "attention"
1729
+ ].map((i) => ({
1730
+ label: `!!! ${i}`,
1731
+ type: "text",
1732
+ apply: ie("!!!", ` ${i}`, " Title", `
1733
+
1734
+ !!!`, "title")
1735
+ }))
1736
+ ]
1737
+ };
1738
+ };
1739
+ return Vt({
1740
+ override: e ? [o, Mt, ...e] : [o]
1741
+ });
1742
+ }, Ml = Al, z = (e) => {
1743
+ const o = new It();
1626
1744
  return (l) => (o.get(e.state) ? e.dispatch({ effects: o.reconfigure(l) }) : e.dispatch({
1627
- effects: It.appendConfig.of(o.of(l))
1745
+ effects: Ot.appendConfig.of(o.of(l))
1628
1746
  }), !0);
1629
1747
  };
1630
- class yl {
1748
+ class Ll {
1631
1749
  constructor(o) {
1632
- U(this, "view");
1750
+ q(this, "view");
1633
1751
  // 切换tabSize的执行方法。切换时,Compartment实例需要相同
1634
- U(this, "toggleTabSize");
1635
- U(this, "togglePlaceholder");
1752
+ q(this, "toggleTabSize");
1753
+ q(this, "togglePlaceholder");
1636
1754
  /**
1637
1755
  * 设置全部的扩展
1638
1756
  */
1639
- U(this, "setExtensions");
1640
- U(this, "toggleDisabled");
1641
- U(this, "toggleReadOnly");
1642
- U(this, "toggleMaxlength");
1757
+ q(this, "setExtensions");
1758
+ q(this, "toggleDisabled");
1759
+ q(this, "toggleReadOnly");
1760
+ q(this, "toggleMaxlength");
1643
1761
  this.view = o, this.toggleTabSize = z(this.view), this.togglePlaceholder = z(this.view), this.setExtensions = z(this.view), this.toggleDisabled = z(this.view), this.toggleReadOnly = z(this.view), this.toggleMaxlength = z(this.view);
1644
1762
  }
1645
1763
  getValue() {
@@ -1652,10 +1770,10 @@ class yl {
1652
1770
  * @param from 插入开始位置
1653
1771
  * @param to 插入结束位置
1654
1772
  */
1655
- setValue(o, n = 0, l = this.view.state.doc.length) {
1773
+ setValue(o, a = 0, l = this.view.state.doc.length) {
1656
1774
  this.view.dispatch({
1657
1775
  changes: {
1658
- from: n,
1776
+ from: a,
1659
1777
  to: l,
1660
1778
  insert: o
1661
1779
  }
@@ -1665,8 +1783,8 @@ class yl {
1665
1783
  * 获取选中的文本
1666
1784
  */
1667
1785
  getSelectedText() {
1668
- const { from: o, to: n } = this.view.state.selection.main;
1669
- return this.view.state.sliceDoc(o, n);
1786
+ const { from: o, to: a } = this.view.state.selection.main;
1787
+ return this.view.state.sliceDoc(o, a);
1670
1788
  }
1671
1789
  /**
1672
1790
  * 使用新的内容替换选中的内容
@@ -1674,7 +1792,7 @@ class yl {
1674
1792
  * @param text 待替换内容
1675
1793
  * @param options 替换后是否选中
1676
1794
  */
1677
- replaceSelectedText(o, n = {
1795
+ replaceSelectedText(o, a = {
1678
1796
  // 是否选中
1679
1797
  select: !0,
1680
1798
  // 选中时,开始位置的偏移量
@@ -1684,18 +1802,18 @@ class yl {
1684
1802
  // 直接替换所有文本
1685
1803
  replaceAll: !1
1686
1804
  }) {
1687
- if (n.replaceAll) {
1805
+ if (a.replaceAll) {
1688
1806
  this.setValue(o);
1689
1807
  return;
1690
1808
  }
1691
1809
  const { from: l } = this.view.state.selection.main;
1692
- if (this.view.dispatch(this.view.state.replaceSelection(o)), n.select) {
1693
- const s = l + o.length + n.deviationEnd;
1810
+ if (this.view.dispatch(this.view.state.replaceSelection(o)), a.select) {
1811
+ const i = l + o.length + a.deviationEnd;
1694
1812
  this.view.dispatch({
1695
- selection: re.create(
1813
+ selection: Y.create(
1696
1814
  [
1697
- re.range(l + n.deviationStart, s),
1698
- re.cursor(s)
1815
+ Y.range(l + a.deviationStart, i),
1816
+ Y.cursor(i)
1699
1817
  ],
1700
1818
  1
1701
1819
  )
@@ -1709,8 +1827,8 @@ class yl {
1709
1827
  */
1710
1828
  setTabSize(o) {
1711
1829
  this.toggleTabSize([
1712
- ie.tabSize.of(o),
1713
- Ht.of(" ".repeat(o))
1830
+ se.tabSize.of(o),
1831
+ Ft.of(" ".repeat(o))
1714
1832
  ]);
1715
1833
  }
1716
1834
  /**
@@ -1725,50 +1843,50 @@ class yl {
1725
1843
  this.view.focus();
1726
1844
  }
1727
1845
  setDisabled(o) {
1728
- this.toggleDisabled([fe.editable.of(!o)]);
1846
+ this.toggleDisabled([ge.editable.of(!o)]);
1729
1847
  }
1730
1848
  setReadOnly(o) {
1731
- this.toggleReadOnly([ie.readOnly.of(o)]);
1849
+ this.toggleReadOnly([se.readOnly.of(o)]);
1732
1850
  }
1733
1851
  setMaxLength(o) {
1734
1852
  this.toggleMaxlength([
1735
- ie.changeFilter.of((n) => n.newDoc.length <= o)
1853
+ se.changeFilter.of((a) => a.newDoc.length <= o)
1736
1854
  ]);
1737
1855
  }
1738
1856
  }
1739
- const xl = (e) => {
1857
+ const Dl = (e) => {
1740
1858
  const o = A("editorId");
1741
1859
  return (l) => {
1742
1860
  if (l.clipboardData) {
1743
1861
  if (l.clipboardData.files.length > 0) {
1744
- const { files: s } = l.clipboardData;
1862
+ const { files: i } = l.clipboardData;
1745
1863
  h.emit(
1746
1864
  o,
1747
1865
  "uploadImage",
1748
- Array.from(s).filter((r) => /image\/.*/.test(r.type))
1866
+ Array.from(i).filter((r) => /image\/.*/.test(r.type))
1749
1867
  ), l.preventDefault();
1750
1868
  }
1751
1869
  if (e.autoDetectCode && l.clipboardData.types.includes("vscode-editor-data")) {
1752
- const s = JSON.parse(l.clipboardData.getData("vscode-editor-data"));
1870
+ const i = JSON.parse(l.clipboardData.getData("vscode-editor-data"));
1753
1871
  h.emit(o, "replace", "code", {
1754
- mode: s.mode,
1872
+ mode: i.mode,
1755
1873
  text: l.clipboardData.getData("text/plain")
1756
1874
  }), l.preventDefault();
1757
1875
  }
1758
1876
  }
1759
1877
  };
1760
- }, wl = xl, Tl = (e) => {
1878
+ }, El = Dl, Hl = (e) => {
1761
1879
  const o = A("editorId");
1762
1880
  W(() => {
1763
1881
  h.on(o, {
1764
1882
  name: dt,
1765
1883
  callback() {
1766
- var n;
1767
- (n = e.value) == null || n.focus();
1884
+ var a;
1885
+ (a = e.value) == null || a.focus();
1768
1886
  }
1769
1887
  });
1770
1888
  });
1771
- }, Sl = Tl, Al = (e, o) => [
1889
+ }, Bl = Hl, Fl = (e, o) => [
1772
1890
  {
1773
1891
  key: "Ctrl-b",
1774
1892
  mac: "Cmd-b",
@@ -1777,7 +1895,7 @@ const xl = (e) => {
1777
1895
  {
1778
1896
  key: "Ctrl-d",
1779
1897
  mac: "Cmd-d",
1780
- run: Mt,
1898
+ run: Dt,
1781
1899
  preventDefault: !0
1782
1900
  },
1783
1901
  {
@@ -1847,8 +1965,8 @@ const xl = (e) => {
1847
1965
  key: "Ctrl-c",
1848
1966
  mac: "Cmd-c",
1849
1967
  shift: () => (h.emit(e, "replace", "code"), !0),
1850
- any(M, p) {
1851
- return (p.ctrlKey || p.metaKey) && p.altKey && p.code === "KeyC" ? (h.emit(e, "replace", "codeRow"), !0) : !1;
1968
+ any(M, k) {
1969
+ return (k.ctrlKey || k.metaKey) && k.altKey && k.code === "KeyC" ? (h.emit(e, "replace", "codeRow"), !0) : !1;
1852
1970
  }
1853
1971
  },
1854
1972
  {
@@ -1862,96 +1980,101 @@ const xl = (e) => {
1862
1980
  shift: () => o.noPrettier ? !1 : (h.emit(e, "replace", "prettier"), !0)
1863
1981
  },
1864
1982
  {
1865
- any: (M, p) => (p.ctrlKey || p.metaKey) && p.altKey && p.shiftKey && p.code === "KeyT" ? (h.emit(e, "replace", "table"), !0) : !1
1983
+ any: (M, k) => (k.ctrlKey || k.metaKey) && k.altKey && k.shiftKey && k.code === "KeyT" ? (h.emit(e, "replace", "table"), !0) : !1
1866
1984
  }
1867
- ], Ml = Al, Ll = (e) => {
1868
- const o = A("tabWidth"), n = A("editorId"), l = A("theme"), s = q(), r = Xe(), c = Ml(n, e), g = wl(e), f = [
1869
- Tt.of([...c, Lt]),
1985
+ ], Il = Fl, Ol = (e) => {
1986
+ const o = A("tabWidth"), a = A("editorId"), l = A("theme"), i = U(), r = Xe(), c = Il(a, e), m = El(e), f = [
1987
+ Tt.of([...c, Et]),
1870
1988
  xt,
1989
+ Lt(),
1871
1990
  At({ codeLanguages: St }),
1872
1991
  // 横向换行
1873
- ne.lineWrapping,
1874
- ne.updateListener.of((u) => {
1875
- u.docChanged && e.onChange(u.state.doc.toString());
1992
+ re.lineWrapping,
1993
+ re.updateListener.of((d) => {
1994
+ d.docChanged && e.onChange(d.state.doc.toString());
1876
1995
  }),
1877
- ne.domEventHandlers({
1878
- paste: g,
1996
+ re.domEventHandlers({
1997
+ paste: m,
1879
1998
  blur: e.onBlur,
1880
1999
  focus: e.onFocus
1881
2000
  })
1882
- ], d = () => l.value === "light" ? G.codeMirrorExtensions(
1883
- l.value,
1884
- [...f, $l],
1885
- [...c]
1886
- ) : G.codeMirrorExtensions(
1887
- l.value,
1888
- [...f, dl],
1889
- [...c]
1890
- );
2001
+ ], u = () => {
2002
+ const d = [
2003
+ ...f,
2004
+ l.value === "light" ? Sl : gl,
2005
+ Ml(e.completions)
2006
+ ];
2007
+ return _.codeMirrorExtensions(l.value, d, [
2008
+ ...c
2009
+ ]);
2010
+ };
1891
2011
  return W(() => {
1892
- const u = new ne({
2012
+ const d = new re({
1893
2013
  doc: e.value,
1894
- parent: s.value
2014
+ parent: i.value
1895
2015
  });
1896
- r.value = new yl(u), r.value.setTabSize(o), r.value.setExtensions(d()), r.value.setDisabled(e.disabled), r.value.setReadOnly(e.readonly), e.placeholder && r.value.setPlaceholder(e.placeholder), e.autofocus && u.focus(), e.maxlength && r.value.setMaxLength(e.maxlength), h.on(n, {
2016
+ r.value = new Ll(d), r.value.setTabSize(o), r.value.setExtensions(u()), r.value.setDisabled(e.disabled), r.value.setReadOnly(e.readonly), e.placeholder && r.value.setPlaceholder(e.placeholder), e.autofocus && d.focus(), e.maxlength && r.value.setMaxLength(e.maxlength), h.on(a, {
1897
2017
  name: "ctrlZ",
1898
2018
  callback() {
1899
- Dt(u);
2019
+ Ht(d);
1900
2020
  }
1901
- }), h.on(n, {
2021
+ }), h.on(a, {
1902
2022
  name: "ctrlShiftZ",
1903
2023
  callback() {
1904
- Et(u);
2024
+ Bt(d);
1905
2025
  }
1906
- }), h.on(n, {
2026
+ }), h.on(a, {
1907
2027
  name: "replace",
1908
- callback(k, $ = {}) {
1909
- var m;
1910
- const { text: b, options: v } = Qt(k, r.value, $);
1911
- (m = r.value) == null || m.replaceSelectedText(b, v);
2028
+ callback(p, $ = {}) {
2029
+ var g;
2030
+ const { text: b, options: v } = ll(p, r.value, $);
2031
+ (g = r.value) == null || g.replaceSelectedText(b, v);
1912
2032
  }
1913
2033
  });
1914
- }), B(
1915
- () => l.value,
2034
+ }), I(
2035
+ [() => l.value, e.completions],
1916
2036
  () => {
1917
- var u, k;
1918
- l.value === "dark" ? (u = r.value) == null || u.setExtensions(d()) : (k = r.value) == null || k.setExtensions(d());
2037
+ var d;
2038
+ (d = r.value) == null || d.setExtensions(u());
2039
+ },
2040
+ {
2041
+ deep: !0
1919
2042
  }
1920
- ), B(
2043
+ ), I(
1921
2044
  () => e.value,
1922
2045
  () => {
1923
- var u, k;
1924
- ((u = r.value) == null ? void 0 : u.getValue()) !== e.value && ((k = r.value) == null || k.setValue(e.value));
2046
+ var d, p;
2047
+ ((d = r.value) == null ? void 0 : d.getValue()) !== e.value && ((p = r.value) == null || p.setValue(e.value));
1925
2048
  }
1926
- ), B(
2049
+ ), I(
1927
2050
  () => e.placeholder,
1928
2051
  () => {
1929
- var u;
1930
- (u = r.value) == null || u.setPlaceholder(e.placeholder);
2052
+ var d;
2053
+ (d = r.value) == null || d.setPlaceholder(e.placeholder);
1931
2054
  }
1932
- ), B(
2055
+ ), I(
1933
2056
  () => e.disabled,
1934
2057
  () => {
1935
- var u;
1936
- (u = r.value) == null || u.setDisabled(e.disabled);
2058
+ var d;
2059
+ (d = r.value) == null || d.setDisabled(e.disabled);
1937
2060
  }
1938
- ), B(
2061
+ ), I(
1939
2062
  () => e.readonly,
1940
2063
  () => {
1941
- var u;
1942
- (u = r.value) == null || u.setDisabled(e.readonly);
2064
+ var d;
2065
+ (d = r.value) == null || d.setDisabled(e.readonly);
1943
2066
  }
1944
- ), B(
2067
+ ), I(
1945
2068
  () => e.maxlength,
1946
2069
  () => {
1947
- var u;
1948
- e.maxlength && ((u = r.value) == null || u.setMaxLength(e.maxlength));
2070
+ var d;
2071
+ e.maxlength && ((d = r.value) == null || d.setMaxLength(e.maxlength));
1949
2072
  }
1950
- ), Sl(r), {
1951
- inputWrapperRef: s,
2073
+ ), Bl(r), {
2074
+ inputWrapperRef: i,
1952
2075
  codeMirrorUt: r
1953
2076
  };
1954
- }, Dl = Ll, El = {
2077
+ }, Vl = Ol, Rl = {
1955
2078
  value: {
1956
2079
  type: String,
1957
2080
  default: ""
@@ -2040,25 +2163,28 @@ const xl = (e) => {
2040
2163
  noHighlight: {
2041
2164
  type: Boolean,
2042
2165
  default: !1
2166
+ },
2167
+ completions: {
2168
+ type: Array
2043
2169
  }
2044
- }, Hl = /* @__PURE__ */ O({
2170
+ }, Nl = /* @__PURE__ */ O({
2045
2171
  name: "MDEditorContent",
2046
- props: El,
2172
+ props: Rl,
2047
2173
  setup(e) {
2048
- const o = q(""), {
2049
- inputWrapperRef: n,
2174
+ const o = U(""), {
2175
+ inputWrapperRef: a,
2050
2176
  codeMirrorUt: l
2051
- } = Dl(e);
2052
- return Xt(e, o, l), () => t("div", {
2053
- class: `${a}-content`
2177
+ } = Vl(e);
2178
+ return tl(e, o, l), () => t("div", {
2179
+ class: `${n}-content`
2054
2180
  }, [t("div", {
2055
- class: `${a}-input-wrapper`,
2056
- ref: n
2181
+ class: `${n}-input-wrapper`,
2182
+ ref: a
2057
2183
  }, null), t(ut, {
2058
2184
  modelValue: e.value,
2059
2185
  setting: e.setting,
2060
- onHtmlChanged: (s) => {
2061
- o.value = s, e.onHtmlChanged(s);
2186
+ onHtmlChanged: (i) => {
2187
+ o.value = i, e.onHtmlChanged(i);
2062
2188
  },
2063
2189
  onGetCatalog: e.onGetCatalog,
2064
2190
  mdHeadingId: e.mdHeadingId,
@@ -2069,7 +2195,7 @@ const xl = (e) => {
2069
2195
  noHighlight: e.noHighlight
2070
2196
  }, null)]);
2071
2197
  }
2072
- }), Fl = /* @__PURE__ */ O({
2198
+ }), Pl = /* @__PURE__ */ O({
2073
2199
  props: {
2074
2200
  modelValue: {
2075
2201
  type: String,
@@ -2079,15 +2205,15 @@ const xl = (e) => {
2079
2205
  setup(e) {
2080
2206
  const o = A("usedLanguageText");
2081
2207
  return () => {
2082
- var n, l;
2208
+ var a, l;
2083
2209
  return t("div", {
2084
- class: `${a}-footer-item`
2210
+ class: `${n}-footer-item`
2085
2211
  }, [t("label", {
2086
- class: `${a}-footer-label`
2087
- }, [`${(n = o.value.footer) == null ? void 0 : n.markdownTotal}:`]), t("span", null, [((l = e.modelValue) == null ? void 0 : l.length) || 0])]);
2212
+ class: `${n}-footer-label`
2213
+ }, [`${(a = o.value.footer) == null ? void 0 : a.markdownTotal}:`]), t("span", null, [((l = e.modelValue) == null ? void 0 : l.length) || 0])]);
2088
2214
  };
2089
2215
  }
2090
- }), Il = {
2216
+ }), ql = {
2091
2217
  checked: {
2092
2218
  type: Boolean,
2093
2219
  default: !1
@@ -2097,17 +2223,17 @@ const xl = (e) => {
2097
2223
  default: () => {
2098
2224
  }
2099
2225
  }
2100
- }, Bl = /* @__PURE__ */ O({
2101
- props: Il,
2226
+ }, Ul = /* @__PURE__ */ O({
2227
+ props: ql,
2102
2228
  setup(e) {
2103
2229
  return () => t("div", {
2104
- class: [`${a}-checkbox`, e.checked && `${a}-checkbox-checked`],
2230
+ class: [`${n}-checkbox`, e.checked && `${n}-checkbox-checked`],
2105
2231
  onClick: () => {
2106
2232
  e.onChange(!e.checked);
2107
2233
  }
2108
2234
  }, null);
2109
2235
  }
2110
- }), Ol = {
2236
+ }), Gl = {
2111
2237
  scrollAuto: {
2112
2238
  type: Boolean
2113
2239
  },
@@ -2116,26 +2242,26 @@ const xl = (e) => {
2116
2242
  default: () => {
2117
2243
  }
2118
2244
  }
2119
- }, Vl = /* @__PURE__ */ O({
2120
- props: Ol,
2245
+ }, Kl = /* @__PURE__ */ O({
2246
+ props: Gl,
2121
2247
  setup(e) {
2122
2248
  const o = A("usedLanguageText");
2123
2249
  return () => {
2124
- var n;
2250
+ var a;
2125
2251
  return t("div", {
2126
- class: `${a}-footer-item`
2252
+ class: `${n}-footer-item`
2127
2253
  }, [t("label", {
2128
- class: `${a}-footer-label`,
2254
+ class: `${n}-footer-label`,
2129
2255
  onClick: () => {
2130
2256
  e.onScrollAutoChange(!e.scrollAuto);
2131
2257
  }
2132
- }, [(n = o.value.footer) == null ? void 0 : n.scrollAuto]), t(Bl, {
2258
+ }, [(a = o.value.footer) == null ? void 0 : a.scrollAuto]), t(Ul, {
2133
2259
  checked: e.scrollAuto,
2134
2260
  onChange: e.onScrollAutoChange
2135
2261
  }, null)]);
2136
2262
  };
2137
2263
  }
2138
- }), Rl = {
2264
+ }), jl = {
2139
2265
  modelValue: {
2140
2266
  type: String,
2141
2267
  default: ""
@@ -2155,22 +2281,22 @@ const xl = (e) => {
2155
2281
  defFooters: {
2156
2282
  type: Object
2157
2283
  }
2158
- }, Nl = /* @__PURE__ */ O({
2284
+ }, _l = /* @__PURE__ */ O({
2159
2285
  name: "MDEditorFooter",
2160
- props: Rl,
2286
+ props: jl,
2161
2287
  setup(e) {
2162
- const o = me(() => {
2163
- const l = e.footers.indexOf("="), s = l === -1 ? e.footers : e.footers.slice(0, l), r = l === -1 ? [] : e.footers.slice(l, Number.MAX_SAFE_INTEGER);
2164
- return [s, r];
2165
- }), n = (l) => {
2288
+ const o = fe(() => {
2289
+ const l = e.footers.indexOf("="), i = l === -1 ? e.footers : e.footers.slice(0, l), r = l === -1 ? [] : e.footers.slice(l, Number.MAX_SAFE_INTEGER);
2290
+ return [i, r];
2291
+ }), a = (l) => {
2166
2292
  if (lt.includes(l))
2167
2293
  switch (l) {
2168
2294
  case "markdownTotal":
2169
- return t(Fl, {
2295
+ return t(Pl, {
2170
2296
  modelValue: e.modelValue
2171
2297
  }, null);
2172
2298
  case "scrollSwitch":
2173
- return t(Vl, {
2299
+ return t(Kl, {
2174
2300
  scrollAuto: e.scrollAuto,
2175
2301
  onScrollAutoChange: e.onScrollAutoChange
2176
2302
  }, null);
@@ -2179,62 +2305,62 @@ const xl = (e) => {
2179
2305
  return e.defFooters instanceof Array ? e.defFooters[l] || "" : e.defFooters && e.defFooters.children instanceof Array && e.defFooters.children[l] || "";
2180
2306
  };
2181
2307
  return () => {
2182
- const l = o.value[0].map((r) => n(r)), s = o.value[1].map((r) => n(r));
2308
+ const l = o.value[0].map((r) => a(r)), i = o.value[1].map((r) => a(r));
2183
2309
  return t("div", {
2184
- class: `${a}-footer`
2310
+ class: `${n}-footer`
2185
2311
  }, [t("div", {
2186
- class: `${a}-footer-left`
2312
+ class: `${n}-footer-left`
2187
2313
  }, [l]), t("div", {
2188
- class: `${a}-footer-right`
2189
- }, [s])]);
2314
+ class: `${n}-footer-right`
2315
+ }, [i])]);
2190
2316
  };
2191
2317
  }
2192
- }), Pl = /* @__PURE__ */ O({
2318
+ }), Wl = /* @__PURE__ */ O({
2193
2319
  name: "MdEditorV3",
2194
2320
  props: mt,
2195
2321
  emits: ft,
2196
2322
  setup(e, o) {
2197
2323
  const {
2198
- editorId: n,
2324
+ editorId: a,
2199
2325
  noKatex: l,
2200
- noMermaid: s,
2326
+ noMermaid: i,
2201
2327
  noPrettier: r,
2202
2328
  noUploadImg: c,
2203
- noHighlight: g
2204
- } = e, f = Y({
2329
+ noHighlight: m
2330
+ } = e, f = Z({
2205
2331
  scrollAuto: e.scrollAuto
2206
2332
  });
2207
2333
  gt(e, o), ht(e), bt(e);
2208
- const [d, u] = vt(e, o), k = kt(e);
2334
+ const [u, d] = vt(e, o), p = pt(e);
2209
2335
  return Qe(() => {
2210
- h.clear(n);
2211
- }), pt(e, o, k, d, u), () => {
2336
+ h.clear(a);
2337
+ }), kt(e, o, p, u, d), () => {
2212
2338
  var v;
2213
- const $ = Ee({
2339
+ const $ = He({
2214
2340
  props: e,
2215
2341
  ctx: o
2216
- }, "defToolbars"), b = Ee({
2342
+ }, "defToolbars"), b = He({
2217
2343
  props: e,
2218
2344
  ctx: o
2219
2345
  }, "defFooters");
2220
2346
  return t("div", {
2221
- id: n,
2222
- class: [a, e.class, e.theme === "dark" && `${a}-dark`, d.fullscreen || d.pageFullscreen ? `${a}-fullscreen` : ""],
2347
+ id: a,
2348
+ class: [n, e.class, e.theme === "dark" && `${n}-dark`, u.fullscreen || u.pageFullscreen ? `${n}-fullscreen` : ""],
2223
2349
  style: e.style
2224
- }, [t(zt, {
2350
+ }, [t(Jt, {
2225
2351
  noPrettier: r,
2226
2352
  toolbars: e.toolbars,
2227
2353
  toolbarsExclude: e.toolbarsExclude,
2228
- setting: d,
2229
- updateSetting: u,
2354
+ setting: u,
2355
+ updateSetting: d,
2230
2356
  tableShape: e.tableShape,
2231
2357
  defToolbars: $,
2232
2358
  noUploadImg: c
2233
- }, null), t(Hl, {
2359
+ }, null), t(Nl, {
2234
2360
  value: e.modelValue,
2235
- setting: d,
2361
+ setting: u,
2236
2362
  mdHeadingId: e.mdHeadingId,
2237
- noMermaid: s,
2363
+ noMermaid: i,
2238
2364
  noPrettier: r,
2239
2365
  sanitize: e.sanitize,
2240
2366
  placeholder: e.placeholder,
@@ -2246,39 +2372,40 @@ const xl = (e) => {
2246
2372
  readonly: e.readOnly,
2247
2373
  maxlength: e.maxLength,
2248
2374
  autoDetectCode: e.autoDetectCode,
2249
- noHighlight: g,
2250
- onChange: (m) => {
2251
- e.onChange ? e.onChange(m) : (o.emit("update:modelValue", m), o.emit("onChange", m));
2375
+ noHighlight: m,
2376
+ onChange: (g) => {
2377
+ e.onChange ? e.onChange(g) : (o.emit("update:modelValue", g), o.emit("onChange", g));
2252
2378
  },
2253
- onHtmlChanged: (m) => {
2254
- e.onHtmlChanged ? e.onHtmlChanged(m) : o.emit("onHtmlChanged", m);
2379
+ onHtmlChanged: (g) => {
2380
+ e.onHtmlChanged ? e.onHtmlChanged(g) : o.emit("onHtmlChanged", g);
2255
2381
  },
2256
- onGetCatalog: (m) => {
2257
- e.onGetCatalog ? e.onGetCatalog(m) : o.emit("onGetCatalog", m);
2382
+ onGetCatalog: (g) => {
2383
+ e.onGetCatalog ? e.onGetCatalog(g) : o.emit("onGetCatalog", g);
2258
2384
  },
2259
- onBlur: (m) => {
2260
- e.onBlur ? e.onBlur(m) : o.emit("onBlur", m);
2385
+ onBlur: (g) => {
2386
+ e.onBlur ? e.onBlur(g) : o.emit("onBlur", g);
2261
2387
  },
2262
- onFocus: (m) => {
2263
- e.onFocus ? e.onFocus(m) : o.emit("onFocus", m);
2264
- }
2265
- }, null), ((v = e.footers) == null ? void 0 : v.length) > 0 && t(Nl, {
2388
+ onFocus: (g) => {
2389
+ e.onFocus ? e.onFocus(g) : o.emit("onFocus", g);
2390
+ },
2391
+ completions: e.completions
2392
+ }, null), ((v = e.footers) == null ? void 0 : v.length) > 0 && t(_l, {
2266
2393
  modelValue: e.modelValue,
2267
2394
  footers: e.footers,
2268
2395
  defFooters: b,
2269
2396
  scrollAuto: f.scrollAuto,
2270
- onScrollAutoChange: (m) => f.scrollAuto = m
2271
- }, null), k.value && t(Ye, {
2397
+ onScrollAutoChange: (g) => f.scrollAuto = g
2398
+ }, null), p.value && t(Ye, {
2272
2399
  theme: e.theme,
2273
- class: `${a}-catalog-editor`,
2274
- editorId: n,
2400
+ class: `${n}-catalog-editor`,
2401
+ editorId: a,
2275
2402
  mdHeadingId: e.mdHeadingId,
2276
2403
  key: "internal-catalog"
2277
2404
  }, null)]);
2278
2405
  };
2279
2406
  }
2280
- }), de = Pl;
2281
- de.install = (e) => (e.component(de.name, de), e.use(Bt).use(ot).use(yt).use(Ye).use(Ct), e);
2407
+ }), ue = Wl;
2408
+ ue.install = (e) => (e.component(ue.name, ue), e.use(Rt).use(ot).use(yt).use(Ye).use(Ct), e);
2282
2409
  export {
2283
- de as default
2410
+ ue as default
2284
2411
  };