@glifox/gnosis 0.0.19 → 0.0.20

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.
package/dist/gnosis.mjs CHANGED
@@ -1,15 +1,12 @@
1
- var _ = Object.defineProperty;
2
- var O = (e, t, r) => t in e ? _(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var S = (e, t, r) => O(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { languages as V } from "@codemirror/language-data";
5
- import { markdown as W } from "@codemirror/lang-markdown";
6
- import { GFM as F } from "@lezer/markdown";
7
- import { Tag as U, styleTags as X, tags as A } from "@lezer/highlight";
8
- import { ViewPlugin as j, Decoration as l, WidgetType as $, EditorView as z } from "@codemirror/view";
1
+ import { languages as P } from "@codemirror/language-data";
2
+ import { markdown as _ } from "@codemirror/lang-markdown";
3
+ import { GFM as O } from "@lezer/markdown";
4
+ import { Tag as V, styleTags as W, tags as E } from "@lezer/highlight";
5
+ import { ViewPlugin as F, Decoration as l, WidgetType as $, EditorView as z } from "@codemirror/view";
9
6
  import { syntaxTree as I } from "@codemirror/language";
10
7
  import { EditorView as x } from "codemirror";
11
- import { StateEffect as G, StateField as K } from "@codemirror/state";
12
- const h = U.define("none"), Y = X({
8
+ import { StateEffect as U, StateField as X } from "@codemirror/state";
9
+ const h = V.define("none"), j = W({
13
10
  "Blockquote/...": h,
14
11
  HorizontalRule: h,
15
12
  "ATXHeading1/... SetextHeading1/...": h,
@@ -35,40 +32,40 @@ const h = U.define("none"), Y = X({
35
32
  LinkTitle: h,
36
33
  Paragraph: h,
37
34
  "QuoteType/.. QuoteTypeMark QuoteTypeText": h
38
- }), J = { props: [Y] }, y = (e, t, r = {}) => {
39
- const i = class {
35
+ }), rt = { props: [j] }, M = (e, t, s = {}) => {
36
+ const a = class {
37
+ decorations;
38
+ conf;
40
39
  constructor(c) {
41
- S(this, "decorations");
42
- S(this, "conf");
43
40
  this.conf = t, this.decorations = e(c, this.conf);
44
41
  }
45
42
  update(c) {
46
43
  (c.docChanged || c.viewportChanged || c.selectionSet) && (this.decorations = e(c.view, this.conf));
47
44
  }
48
45
  };
49
- return j.fromClass(i, { decorations: (a) => a.decorations, ...r });
50
- }, M = (e, t, r) => {
51
- const i = e.state.selection.ranges;
52
- for (let a of i)
53
- if (a.from >= t && a.from <= r || a.to >= t && a.to <= r || a.from <= t && a.to >= r)
46
+ return F.fromClass(a, { decorations: (i) => i.decorations, ...s });
47
+ }, y = (e, t, s) => {
48
+ const a = e.state.selection.ranges;
49
+ for (let i of a)
50
+ if (i.from >= t && i.from <= s || i.to >= t && i.to <= s || i.from <= t && i.to >= s)
54
51
  return !0;
55
52
  return !1;
56
53
  }, v = (e, t) => {
57
- for (const { from: r, to: i } of e.visibleRanges)
58
- I(e.state).iterate({ ...t, from: r, to: i });
54
+ for (const { from: s, to: a } of e.visibleRanges)
55
+ I(e.state).iterate({ ...t, from: s, to: a });
59
56
  };
60
- function ee(e, t) {
61
- const r = ["Document"], i = {}, a = {
62
- HorizontalRule: (n, s, o = !0) => [
57
+ function G(e, t) {
58
+ const s = ["Document"], a = {}, i = {
59
+ HorizontalRule: (n, r, o = !0) => [
63
60
  l.line({ class: "hr " + (o ? "sw" : "") }).range(n),
64
- l.mark({ class: "mk" }).range(n, s)
61
+ l.mark({ class: "mk" }).range(n, r)
65
62
  ]
66
63
  }, c = [];
67
64
  return v(e, {
68
- enter: ({ type: n, from: s, to: o }) => (n.name in a && c.push(...a[n.name](s, o, M(e, s, o))), r.includes(n.name) || n.name in i)
65
+ enter: ({ type: n, from: r, to: o }) => (n.name in i && c.push(...i[n.name](r, o, y(e, r, o))), s.includes(n.name) || n.name in a)
69
66
  }), l.set(c, !1);
70
67
  }
71
- const te = () => x.baseTheme({
68
+ const K = () => x.baseTheme({
72
69
  "& .hr": { position: "relative" },
73
70
  "& .hr > .mk": { fontSize: "0" },
74
71
  "& .hr.sw > .mk": { fontSize: "inherit" },
@@ -81,29 +78,29 @@ const te = () => x.baseTheme({
81
78
  width: "calc(100% - 12px)",
82
79
  height: ".2ch"
83
80
  }
84
- }), ne = () => [
85
- y(ee, {}),
86
- te()
81
+ }), Y = () => [
82
+ M(G, {}),
83
+ K()
87
84
  ];
88
- function re(e, t) {
89
- const r = ["FencedCode"], i = {
90
- StrongEmphasis: (n = !0, s, o) => l.mark({ class: "il st " + (n ? "sw" : "") }).range(s, o),
91
- Strikethrough: (n = !0, s, o) => l.mark({ class: "il sk " + (n ? "sw" : "") }).range(s, o),
92
- InlineCode: (n = !0, s, o) => l.mark({ class: "il ic " + (n ? "sw" : "") }).range(s, o),
93
- Emphasis: (n = !0, s, o) => l.mark({ class: "il it " + (n ? "sw" : "") }).range(s, o),
94
- Mark: (n, s) => l.mark({ class: "mkl" }).range(n, s)
95
- }, a = ["EmphasisMark", "CodeMark", "StrikethroughMark"], c = [];
85
+ function J(e, t) {
86
+ const s = ["FencedCode"], a = {
87
+ StrongEmphasis: (n = !0, r, o) => l.mark({ class: "il st " + (n ? "sw" : "") }).range(r, o),
88
+ Strikethrough: (n = !0, r, o) => l.mark({ class: "il sk " + (n ? "sw" : "") }).range(r, o),
89
+ InlineCode: (n = !0, r, o) => l.mark({ class: "il ic " + (n ? "sw" : "") }).range(r, o),
90
+ Emphasis: (n = !0, r, o) => l.mark({ class: "il it " + (n ? "sw" : "") }).range(r, o),
91
+ Mark: (n, r) => l.mark({ class: "mkl" }).range(n, r)
92
+ }, i = ["EmphasisMark", "CodeMark", "StrikethroughMark"], c = [];
96
93
  return v(e, {
97
- enter: ({ type: { name: n }, from: s, to: o }) => a.includes(n) ? (c.push(i.Mark(s, o)), !1) : (n in i && c.push(
98
- i[n](
99
- M(e, s, o),
100
- s,
94
+ enter: ({ type: { name: n }, from: r, to: o }) => i.includes(n) ? (c.push(a.Mark(r, o)), !1) : (n in a && c.push(
95
+ a[n](
96
+ y(e, r, o),
97
+ r,
101
98
  o
102
99
  )
103
- ), !r.includes(n))
100
+ ), !s.includes(n))
104
101
  }), l.set(c, !1);
105
102
  }
106
- const se = x.baseTheme({
103
+ const ee = x.baseTheme({
107
104
  "& .it ": { fontStyle: "italic" },
108
105
  "& .st ": { fontWeight: "bold" },
109
106
  "& .sk ": { textDecoration: "line-through" },
@@ -113,83 +110,83 @@ const se = x.baseTheme({
113
110
  borderRadius: ".6ch",
114
111
  backgroundColor: "var(--cm-ic-background, hsl(from black h s l / .2))"
115
112
  }
116
- }), oe = x.baseTheme({
113
+ }), te = x.baseTheme({
117
114
  ".il .mkl": { fontSize: "0" },
118
115
  "&.cm-focused .il.sw > .mkl": { fontSize: "inherit" }
119
- }), ie = () => [
120
- y(re, {}),
121
- se,
122
- oe
123
- ], N = (e, t, r) => {
124
- const i = e.state.sliceDoc(t, r), a = i.match(/\[(.*)\]/);
125
- return a !== null && a.length > 1 ? {
126
- text: a[1],
127
- from: t + i.indexOf(a[1]),
128
- to: t + 1 + a[1].length
116
+ }), ne = () => [
117
+ M(J, {}),
118
+ ee,
119
+ te
120
+ ], R = (e, t, s) => {
121
+ const a = e.state.sliceDoc(t, s), i = a.match(/\[(.*)\]/);
122
+ return i !== null && i.length > 1 ? {
123
+ text: i[1],
124
+ from: t + a.indexOf(i[1]),
125
+ to: t + 1 + i[1].length
129
126
  } : { text: null };
130
127
  };
131
- function ae(e, t) {
132
- const r = ["FencedCode", "Image", "Link"], i = {
128
+ function re(e, t) {
129
+ const s = ["FencedCode", "Image", "Link"], a = {
133
130
  Link: {
134
131
  marks: ["LinkMark"],
135
132
  url: "URL"
136
133
  }
137
- }, a = {
138
- Link: (n, s, o) => l.mark({ class: "link " + (o ? "sw" : "") }).range(n, s),
139
- LinkMark: (n, s) => l.mark({ class: "lk-mk" }).range(n, s),
140
- TextDec: (n, s, o) => l.mark({
134
+ }, i = {
135
+ Link: (n, r, o) => l.mark({ class: "link " + (o ? "sw" : "") }).range(n, r),
136
+ LinkMark: (n, r) => l.mark({ class: "lk-mk" }).range(n, r),
137
+ TextDec: (n, r, o) => l.mark({
141
138
  class: "lk-text url",
142
139
  tagName: "a",
143
140
  attributes: { href: o, target: "_blank" }
144
- }).range(n, s),
145
- URL: (n, s, o) => l.mark({
141
+ }).range(n, r),
142
+ URL: (n, r, o) => l.mark({
146
143
  class: "lk-url url",
147
144
  tagName: "a",
148
145
  attributes: { href: o, target: "_blank" }
149
- }).range(n, s)
146
+ }).range(n, r)
150
147
  }, c = [];
151
148
  return v(e, {
152
- enter: ({ type: { name: n }, from: s, to: o, node: d }) => {
153
- if (n === "URL" && c.push(a.URL(s, o, e.state.sliceDoc(s, o))), !(n in i)) return !r.includes(n);
154
- c.push(a.Link(s, o, M(e, s, o)));
155
- const u = i[n].marks.flatMap((w) => d.getChildren(w));
156
- c.push(...u.map(({ from: w, to: p }) => a.LinkMark(w, p)));
157
- const g = d.getChild(i[n].url);
149
+ enter: ({ type: { name: n }, from: r, to: o, node: d }) => {
150
+ if (n === "URL" && c.push(i.URL(r, o, e.state.sliceDoc(r, o))), !(n in a)) return !s.includes(n);
151
+ c.push(i.Link(r, o, y(e, r, o)));
152
+ const u = a[n].marks.flatMap((w) => d.getChildren(w));
153
+ c.push(...u.map(({ from: w, to: p }) => i.LinkMark(w, p)));
154
+ const g = d.getChild(a[n].url);
158
155
  let m = null;
159
156
  if (g !== null) {
160
157
  const { from: w, to: p } = g;
161
- m = e.state.sliceDoc(w, p), c.push(a.URL(w, p, m));
158
+ m = e.state.sliceDoc(w, p), c.push(i.URL(w, p, m));
162
159
  }
163
160
  if (d.getChild("Image") === null) {
164
- const { text: w, from: p, to: T } = N(e, s, o);
165
- w !== null && m !== null && c.push(a.TextDec(p, T, m));
161
+ const { text: w, from: p, to: T } = R(e, r, o);
162
+ w !== null && m !== null && c.push(i.TextDec(p, T, m));
166
163
  }
167
164
  return !1;
168
165
  }
169
166
  }), l.set(c, !0);
170
167
  }
171
- const ce = (e, t) => e.ctrlKey ? le(
168
+ const se = (e, t) => e.ctrlKey ? oe(
172
169
  e.target
173
170
  /* as HTMLElement */
174
- ) : !1, le = (e) => {
171
+ ) : !1, oe = (e) => {
175
172
  if (e.nodeName === "A" && e.href && e.classList.contains("url"))
176
173
  return window.open(e.href, e.target), !0;
177
- }, de = x.baseTheme({
174
+ }, ie = x.baseTheme({
178
175
  ".lk-mk, .link > .lk-url": { display: "none" },
179
176
  "&.cm-focused .link.sw .lk-mk, &.cm-focused .link.sw .lk-url": { display: "inherit" }
180
- }), ue = () => [
181
- y(ae, {}, { eventHandlers: { mousedown: ce } }),
182
- de
177
+ }), ae = () => [
178
+ M(re, {}, { eventHandlers: { mousedown: se } }),
179
+ ie
183
180
  ];
184
- class ge extends $ {
185
- constructor(t, r = null, i = "[image]") {
186
- super(), this.img = t, this.url = r, this.alt = i;
181
+ class ce extends $ {
182
+ constructor(t, s = null, a = "[image]") {
183
+ super(), this.img = t, this.url = s, this.alt = a;
187
184
  }
188
185
  toDOM() {
189
186
  let t = document.createElement("img");
190
187
  if (t.src = this.img, t.alt = this.alt, t.style.minWidth = "100px", this.url) {
191
- let r = document.createElement("a");
192
- return r.href = this.url, r.target = "_blank", r.classList.add("url"), r.appendChild(t), r;
188
+ let s = document.createElement("a");
189
+ return s.href = this.url, s.target = "_blank", s.classList.add("url"), s.appendChild(t), s;
193
190
  } else
194
191
  return t;
195
192
  }
@@ -200,64 +197,63 @@ class ge extends $ {
200
197
  return !1;
201
198
  }
202
199
  }
203
- function he(e, t) {
204
- const r = ["FencedCode", "Image"], i = [];
200
+ function le(e, t) {
201
+ const s = ["FencedCode", "Image"], a = [];
205
202
  return v(e, {
206
- enter: ({ type: { name: a }, from: c, to: n, node: s }) => {
207
- if (a === "Image" && !M(e, c, n)) {
208
- const { from: o, to: d } = s.getChild("URL"), u = e.state.sliceDoc(o, d), { text: g } = N(e, c, n);
209
- i.push(
203
+ enter: ({ type: { name: i }, from: c, to: n, node: r }) => {
204
+ if (i === "Image" && !y(e, c, n)) {
205
+ const { from: o, to: d } = r.getChild("URL"), u = e.state.sliceDoc(o, d), { text: g } = R(e, c, n);
206
+ a.push(
210
207
  l.replace({
211
- widget: new ge(u, me(e, s), g)
208
+ widget: new ce(u, de(e, r), g)
212
209
  }).range(c, n)
213
210
  );
214
211
  }
215
- return !r.includes(a);
212
+ return !s.includes(i);
216
213
  }
217
- }), l.set(i, !1);
214
+ }), l.set(a, !1);
218
215
  }
219
- const me = (e, t) => {
220
- const i = t.parent.getChild("URL");
221
- if (i !== null) {
222
- const { from: a, to: c } = i;
223
- return e.state.sliceDoc(a, c);
216
+ const de = (e, t) => {
217
+ const a = t.parent.getChild("URL");
218
+ if (a !== null) {
219
+ const { from: i, to: c } = a;
220
+ return e.state.sliceDoc(i, c);
224
221
  }
225
222
  return null;
226
- }, pe = (e, t) => e.ctrlKey ? fe(
223
+ }, ue = (e, t) => e.ctrlKey ? ge(
227
224
  e.target
228
225
  /* as HTMLElement */
229
- ) : !1, fe = (e) => {
226
+ ) : !1, ge = (e) => {
230
227
  const t = e.parentElement ?? !1;
231
228
  if (e.nodeName === "IMG" && t && t.nodeName === "A" && t.classList.contains("url"))
232
229
  return !0;
233
- }, ke = x.baseTheme({}), Ce = () => [
234
- y(he, {}, { eventHandlers: { mousedown: pe } }),
235
- ke
230
+ }, he = x.baseTheme({}), me = () => [
231
+ M(le, {}, { eventHandlers: { mousedown: ue } }),
232
+ he
236
233
  ];
237
- class be extends $ {
238
- constructor(r) {
239
- super();
240
- S(this, "checked", !1);
241
- this.checked = r;
234
+ class pe extends $ {
235
+ checked = !1;
236
+ constructor(t) {
237
+ super(), this.checked = t;
242
238
  }
243
239
  // eq(other) { return other.checked == this.checked }
244
240
  toDOM() {
245
- let r = document.createElement("span");
246
- r.setAttribute("aria-hidden", "true"), r.className = "TaskMark";
247
- let i = r.appendChild(document.createElement("input"));
248
- return i.type = "checkbox", i.checked = this.checked, r;
241
+ let t = document.createElement("span");
242
+ t.setAttribute("aria-hidden", "true"), t.className = "TaskMark";
243
+ let s = t.appendChild(document.createElement("input"));
244
+ return s.type = "checkbox", s.checked = this.checked, t;
249
245
  }
250
246
  ignoreEvent() {
251
247
  return !1;
252
248
  }
253
249
  }
254
- function we(e, t) {
255
- const r = [
250
+ function fe(e, t) {
251
+ const s = [
256
252
  "Document",
257
253
  "ListItem",
258
254
  "Task",
259
255
  "Blockquote"
260
- ], i = {
256
+ ], a = {
261
257
  BulletList: {
262
258
  class: "bl",
263
259
  offset: 2
@@ -266,12 +262,12 @@ function we(e, t) {
266
262
  class: "ol",
267
263
  offset: 3
268
264
  }
269
- }, a = {
265
+ }, i = {
270
266
  ListMark: (o, d, u, g = !0) => l.mark({ class: `${u.class} lm ${g ? "sw" : ""}` }).range(o, d),
271
267
  TaskMarker: (o, d, u, g = !0) => {
272
268
  const m = e.state.doc.sliceString(o + 1, d - 1) === "x";
273
269
  return g ? l.mark({ class: `tm ${m ? "ck" : ""}` }).range(o, d) : l.replace({
274
- widget: new be(m)
270
+ widget: new pe(m)
275
271
  }).range(o, d);
276
272
  }
277
273
  }, c = {
@@ -284,46 +280,45 @@ function we(e, t) {
284
280
  }).range(p, d)
285
281
  ];
286
282
  }
287
- }, n = [], s = [];
283
+ }, n = [], r = [];
288
284
  return v(e, {
289
285
  enter: ({ name: o, from: d, to: u, node: g }) => {
290
- if (o in i)
291
- return s.push({ name: o, from: d, to: u }), !0;
292
- if (o in a && n.push(a[o](
286
+ if (o in a)
287
+ return r.push({ name: o, from: d, to: u }), !0;
288
+ if (o in i && n.push(i[o](
293
289
  d,
294
290
  u,
295
- i[s.slice(-1)[0].name],
296
- M(e, d, u)
291
+ a[r.slice(-1)[0].name],
292
+ y(e, d, u)
297
293
  )), o in c) {
298
294
  const m = e.state.doc.lineAt(d);
299
295
  n.push(...c[o](
300
296
  d,
301
297
  m.to,
302
- i[s.slice(-1)[0].name],
298
+ a[r.slice(-1)[0].name],
303
299
  g.getChild("Task") !== null,
304
300
  d - m.from
305
301
  ));
306
302
  }
307
- return r.includes(o);
303
+ return s.includes(o);
308
304
  },
309
305
  leave: ({ name: o, from: d, to: u }) => {
310
- const g = s.slice(-1)[0];
311
- g && g.name === o && g.from === d && g.to === u && s.pop();
306
+ const g = r.slice(-1)[0];
307
+ g && g.name === o && g.from === d && g.to === u && r.pop();
312
308
  }
313
309
  }), l.set(n, !0);
314
310
  }
315
- const Le = (e, t) => {
316
- var i;
317
- let r = e.target;
318
- if (r.nodeName === "INPUT" && ((i = r.parentElement) != null && i.classList.contains("TaskMark"))) return Te(t, t.posAtDOM(r));
319
- }, Te = (e, t) => {
320
- const r = t - 2, i = t - 1;
321
- let a = e.state.doc.sliceString(Math.max(0, r), i), c;
322
- if (a === "x") c = { from: r, to: i, insert: " " };
323
- else if (a === " ") c = { from: r, to: i, insert: "x" };
311
+ const ke = (e, t) => {
312
+ let s = e.target;
313
+ if (s.nodeName === "INPUT" && s.parentElement?.classList.contains("TaskMark")) return Ce(t, t.posAtDOM(s));
314
+ }, Ce = (e, t) => {
315
+ const s = t - 2, a = t - 1;
316
+ let i = e.state.doc.sliceString(Math.max(0, s), a), c;
317
+ if (i === "x") c = { from: s, to: a, insert: " " };
318
+ else if (i === " ") c = { from: s, to: a, insert: "x" };
324
319
  else return !1;
325
320
  return e.dispatch({ changes: c }), !0;
326
- }, qe = () => x.baseTheme({
321
+ }, be = () => x.baseTheme({
327
322
  "& .lm.bl": {
328
323
  position: "relative",
329
324
  // paddingInlineStart: "1ch",
@@ -341,10 +336,10 @@ const Le = (e, t) => {
341
336
  width: ".4em"
342
337
  },
343
338
  "&light .lm.bl::before": {
344
- backgroundColor: "var(--cm-list-bullet, light-dark(black, white))"
339
+ backgroundColor: "var(--cm-list-bullet, black)"
345
340
  },
346
341
  "&dark .lm.bl::before": {
347
- backgroundColor: "var(--cm-list-bullet, light-dark(black, white))"
342
+ backgroundColor: "var(--cm-list-bullet, white)"
348
343
  },
349
344
  "&.cm-focused .lm.bl.sw, &.cm-focused .lm.bl.sw::before": {
350
345
  backgroundColor: "transparent",
@@ -361,117 +356,115 @@ const Le = (e, t) => {
361
356
  "& .cb-content .ls-text-line, & .cb-spacer .ls-text-line": {
362
357
  width: "unset !important"
363
358
  }
364
- }), xe = () => [
365
- y(we, {}, { eventHandlers: { mousedown: Le } }),
366
- qe()
367
- ], ye = (e, t) => {
368
- var i;
369
- let r = e.target;
370
- if (r.nodeName === "BUTTON" && ((i = r.parentElement) != null && i.classList.contains("wg-codeblock"))) {
359
+ }), we = () => [
360
+ M(fe, {}, { eventHandlers: { mousedown: ke } }),
361
+ be()
362
+ ], Le = (e, t) => {
363
+ let s = e.target;
364
+ if (s.nodeName === "BUTTON" && s.parentElement?.classList.contains("wg-codeblock")) {
371
365
  const a = ["FencedCode", "CodeBlock"];
372
- let c = "";
373
- const n = {
374
- enter: ({ type: { name: s }, from: o, to: d, node: u }) => (a.includes(s) && (c = Me(t, u.toTree(), o, d)), !a.includes(s))
366
+ let i = "";
367
+ const c = {
368
+ enter: ({ type: { name: n }, from: r, to: o, node: d }) => (a.includes(n) && (i = Te(t, d.toTree(), r, o)), !a.includes(n))
375
369
  };
376
370
  return I(t.state).iterate({
377
- ...n,
378
- from: t.posAtDOM(r),
379
- to: t.posAtDOM(r) + 2
380
- }), navigator.clipboard.writeText(c), !0;
371
+ ...c,
372
+ from: t.posAtDOM(s),
373
+ to: t.posAtDOM(s) + 2
374
+ }), navigator.clipboard.writeText(i), !0;
381
375
  }
382
- }, Me = (e, t, r, i) => {
383
- const a = ["CodeMark", "CodeInfo"];
384
- let c = e.state.doc.sliceString(r, i), n = /* @__PURE__ */ new Set();
376
+ }, Te = (e, t, s, a) => {
377
+ const i = ["CodeMark", "CodeInfo"];
378
+ let c = e.state.doc.sliceString(s, a), n = /* @__PURE__ */ new Set();
385
379
  t.iterate({
386
380
  enter({ type: { name: u }, from: g, node: m }) {
387
- a.includes(u) && n.add(e.state.doc.lineAt(g + r).number);
381
+ i.includes(u) && n.add(e.state.doc.lineAt(g + s).number);
388
382
  }
389
383
  });
390
- const s = e.state.doc.lineAt(r), o = r - s.from, d = [];
384
+ const r = e.state.doc.lineAt(s), o = s - r.from, d = [];
391
385
  return c.split(`
392
386
  `).forEach((u, g) => {
393
- n.has(g + s.number) || d.push(u.slice(o));
387
+ n.has(g + r.number) || d.push(u.slice(o));
394
388
  }), d.join(`
395
389
  `);
396
390
  };
397
- class B extends $ {
398
- constructor(r, i, a, c = 1) {
399
- super();
400
- S(this, "classes", "");
401
- this.classes = r, this.width = i, this.marginLeft = a, this.spaces = c;
391
+ class S extends $ {
392
+ classes = "";
393
+ constructor(t, s, a, i = 1) {
394
+ super(), this.classes = t, this.width = s, this.marginLeft = a, this.spaces = i;
402
395
  }
403
396
  toDOM() {
404
- let r = document.createElement("span");
405
- return r.setAttribute("aria-hidden", "true"), r.className = this.classes + " empty", r.textContent = " ".repeat(this.spaces), r.style.width = this.width, r.style.marginLeft = this.marginLeft, r;
397
+ let t = document.createElement("span");
398
+ return t.setAttribute("aria-hidden", "true"), t.className = this.classes + " empty", t.textContent = " ".repeat(this.spaces), t.style.width = this.width, t.style.marginLeft = this.marginLeft, t;
406
399
  }
407
400
  ignoreEvent() {
408
401
  return !1;
409
402
  }
410
403
  }
411
- const ve = (e) => `<svg class="cb-icon" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
404
+ const qe = (e) => `<svg class="cb-icon" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
412
405
  <path class="cb-icon-path cb.i1" fill-rule="evenodd" clip-rule="evenodd" d="M15 0C15.5304 0 16.0391 0.210714 16.4142 0.585786C16.7893 0.960859 17 1.46957 17 2V12C17 12.5304 16.7893 13.0391 16.4142 13.4142C16.0391 13.7893 15.5304 14 15 14H14V6C14 4.93913 13.5786 3.92172 12.8284 3.17157C12.0783 2.42143 11.0609 2 10 2H7C6.64895 1.99924 6.30395 2.09135 6 2.267V2C6 1.46957 6.21071 0.960859 6.58579 0.585786C6.96086 0.210714 7.46957 0 8 0H15Z"/>
413
406
  <path class="cb-icon-path cb.i1" fill-rule="evenodd" clip-rule="evenodd" d="M5 4.054V8H1.2C1.27464 7.84448 1.3691 7.69928 1.481 7.568L3.941 4.698C4.2169 4.37661 4.58771 4.15111 5 4.054ZM7 4V8C7 8.53043 6.78929 9.03914 6.41421 9.41421C6.03914 9.78929 5.53043 10 5 10H1V16C1 16.5304 1.21071 17.0391 1.58579 17.4142C1.96086 17.7893 2.46957 18 3 18H10C10.5304 18 11.0391 17.7893 11.4142 17.4142C11.7893 17.0391 12 16.5304 12 16V6C12 5.46957 11.7893 4.96086 11.4142 4.58579C11.0391 4.21071 10.5304 4 10 4H7Z"/>
414
407
  </svg>`;
415
- class He extends $ {
416
- constructor(t, r) {
417
- super(), this.type = t, this.code = r;
408
+ class xe extends $ {
409
+ constructor(t, s) {
410
+ super(), this.type = t, this.code = s;
418
411
  }
419
412
  toDOM() {
420
413
  let t = document.createElement("span");
421
414
  t.setAttribute("aria-hidden", "true"), t.className = "wg-codeblock";
422
- let r = document.createElement("button");
423
- return r.className = "wg-codeblock-btn", r.innerHTML = ve(), t.appendChild(r), t;
415
+ let s = document.createElement("button");
416
+ return s.className = "wg-codeblock-btn", s.innerHTML = qe(), t.appendChild(s), t;
424
417
  }
425
418
  ignoreEvent() {
426
419
  return !1;
427
420
  }
428
421
  }
429
- const E = [];
430
- function D(e, t) {
422
+ const B = [];
423
+ function A(e, t) {
431
424
  const {
432
- mode: r,
425
+ mode: s,
433
426
  /* type, mark */
434
427
  /**
435
428
  * @type {object}
436
429
  * @property {number} marginLeft - Margin left for the code block
437
430
  * @property {number} paddingLeft - Padding left for the code block
438
431
  */
439
- options: i
440
- } = t, a = ["Document", "Blockquote", "ListItem", "BulletList", "OrderedList"], c = {
441
- FencedCode: Z,
442
- CodeBlock: Z
432
+ options: a
433
+ } = t, i = ["Document", "Blockquote", "ListItem", "BulletList", "OrderedList"], c = {
434
+ FencedCode: D,
435
+ CodeBlock: D
443
436
  }, n = {
444
437
  CodeMark: (o, d, u) => [l.mark({ class: "cb-mk" }).range(d, u)],
445
438
  CodeInfo: (o, d, u) => [l.mark({ class: "cb-mi" }).range(d, u)]
446
- }, s = [];
439
+ }, r = [];
447
440
  return v(e, {
448
- enter: ({ type: { name: o }, from: d, to: u }) => (r === "type" && o in c && s.push(...c[o](e, d, u, i)), r === "mark" && o in n && s.push(...n[o](e, d, u)), a.includes(o) || o in c ? (E.push({ name: o, from: d, to: u }), !0) : !1),
449
- Leave: ({ type: { name: o }, from: d, to: u }) => a.includes(o) || o in c ? (E.pop(), !0) : !1
441
+ enter: ({ type: { name: o }, from: d, to: u }) => (s === "type" && o in c && r.push(...c[o](e, d, u, a)), s === "mark" && o in n && r.push(...n[o](e, d, u)), i.includes(o) || o in c ? (B.push({ name: o, from: d, to: u }), !0) : !1),
442
+ Leave: ({ type: { name: o }, from: d, to: u }) => i.includes(o) || o in c ? (B.pop(), !0) : !1
450
443
  }), {
451
- type: l.set(s, !0),
452
- mark: l.set(s, !0)
453
- }[r];
444
+ type: l.set(r, !0),
445
+ mark: l.set(r, !0)
446
+ }[s];
454
447
  }
455
- const Z = (e, t, r, i) => {
456
- const a = i.marginLeft, c = i.paddingLeft, n = [], s = E[E.length - 1], o = ["BulletList", "OrderedList", "ListItem"].some((b) => b === s.name), d = ["Blockquote"].some((b) => b === s.name), u = e.state.doc.lineAt(t), g = t - u.from, m = g > 0, w = M(e, u.from, r);
448
+ const D = (e, t, s, a) => {
449
+ const i = a.marginLeft, c = a.paddingLeft, n = [], r = B[B.length - 1], o = ["BulletList", "OrderedList", "ListItem"].some((b) => b === r.name), d = ["Blockquote"].some((b) => b === r.name), u = e.state.doc.lineAt(t), g = t - u.from, m = g > 0, w = y(e, u.from, s);
457
450
  n.push(
458
- l.widget({ widget: new He("view.state.sliceDoc(from, to)", "code"), side: 0 }).range(t + 1)
451
+ l.widget({ widget: new xe("view.state.sliceDoc(from, to)", "code"), side: 0 }).range(t + 1)
459
452
  );
460
- const p = u.number, T = e.state.doc.sliceString(t, r).split(`
453
+ const p = u.number, T = e.state.doc.sliceString(t, s).split(`
461
454
  `).length;
462
455
  for (let b = p; b < T + p; b++) {
463
- const { from: f, to: C } = e.state.doc.line(b), L = `100% - ${a + c}px`, q = ["cb-content"];
456
+ const { from: f, to: C } = e.state.doc.line(b), L = `100% - ${i + c}px`, q = ["cb-content"];
464
457
  w && q.push("sw"), b === p && q.push("cb-start"), b === T + p - 1 && q.push("cb-end");
465
458
  const k = Math.max(f + g, 0);
466
459
  if (C < k)
467
460
  n.push(l.widget({
468
- widget: new B(
461
+ widget: new S(
469
462
  ["left", "cb-error"].join(" "),
470
463
  "0.1px"
471
464
  ),
472
465
  side: 0
473
466
  }).range(C), l.widget({
474
- widget: new B(
467
+ widget: new S(
475
468
  ["cb-error", "right"].join(" "),
476
469
  "",
477
470
  "",
@@ -481,13 +474,13 @@ const Z = (e, t, r, i) => {
481
474
  }).range(C));
482
475
  else if (f === C && f === k)
483
476
  n.push(l.widget({
484
- widget: new B(
477
+ widget: new S(
485
478
  [...q, "left"].join(" "),
486
479
  "0"
487
480
  ),
488
481
  side: 0
489
482
  }).range(C), l.widget({
490
- widget: new B(
483
+ widget: new S(
491
484
  q.join(" "),
492
485
  `calc(${L} - ${c}px)`,
493
486
  "0"
@@ -497,7 +490,7 @@ const Z = (e, t, r, i) => {
497
490
  else if (k === C)
498
491
  q.push("wg"), n.push(
499
492
  l.widget({
500
- widget: new B(
493
+ widget: new S(
501
494
  q.join(" "),
502
495
  `calc(${L} - ${k - f}ch)`
503
496
  ),
@@ -514,24 +507,24 @@ const Z = (e, t, r, i) => {
514
507
  n.push(l.line({ class: "cb-line" }).range(f));
515
508
  }
516
509
  return n;
517
- }, $e = (e) => {
518
- const t = e.marginLeft, r = e.paddingLeft, i = 0, a = "4px", c = "1lh";
510
+ }, Me = (e) => {
511
+ const t = e.marginLeft, s = e.paddingLeft, a = 0, i = "4px", c = "1lh";
519
512
  return x.baseTheme({
520
- "& .cb-start": { borderRadius: `${a} ${a} 0 0` },
521
- "& .cb-end ": { borderRadius: `0 0 ${a} ${a}` },
522
- "& .cb-start.cb-end": { borderRadius: `${a}` },
513
+ "& .cb-start": { borderRadius: `${i} ${i} 0 0` },
514
+ "& .cb-end ": { borderRadius: `0 0 ${i} ${i}` },
515
+ "& .cb-start.cb-end": { borderRadius: `${i}` },
523
516
  "& .cm-line .cb-content": {
524
517
  display: "inline-block",
525
518
  marginLeft: `${t}px`,
526
- paddingLeft: `${r}px`,
527
- paddingRigth: `${i}px`,
519
+ paddingLeft: `${s}px`,
520
+ paddingRigth: `${a}px`,
528
521
  position: "relative"
529
522
  },
530
523
  "& .cb-content.wg": { cursor: "text" },
531
524
  "& .cb-content.wg.start": {
532
525
  maxWidth: "1px",
533
526
  Width: "1px",
534
- paddingLeft: `${r - 1}px`
527
+ paddingLeft: `${s - 1}px`
535
528
  },
536
529
  "& .cb-content.wg.end": {
537
530
  marginLeft: "0",
@@ -570,6 +563,9 @@ const Z = (e, t, r, i) => {
570
563
  fill: "currentColor",
571
564
  opacity: "0.7"
572
565
  },
566
+ "&dark .cb-icon": {
567
+ fill: "white"
568
+ },
573
569
  "& .wg-codeblock-btn:hover": { background: "rgba(0, 0, 0, 0.07)" },
574
570
  "& .wg-codeblock-btn:hover .cb-icon": { opacity: "1" },
575
571
  "& .cb-content.cb-start.cb-end .wg-codeblock": {
@@ -595,33 +591,33 @@ const Z = (e, t, r, i) => {
595
591
  cursor: "text"
596
592
  }
597
593
  });
598
- }, Se = () => {
594
+ }, ye = () => {
599
595
  const e = {
600
596
  marginLeft: 2,
601
597
  paddingLeft: 6
602
598
  };
603
599
  return [
604
- y(D, { mode: "mark" }),
605
- y(D, { mode: "type", options: e }, { eventHandlers: { mousedown: ye } }),
606
- $e(e)
600
+ M(A, { mode: "mark" }),
601
+ M(A, { mode: "type", options: e }, { eventHandlers: { mousedown: Le } }),
602
+ Me(e)
607
603
  ];
608
604
  };
609
- function Be(e, t) {
610
- const r = ["Document"], i = {
611
- ATXHeading1: (n, s = !0) => l.line({ class: "h1 hg " + (s ? "sw" : "") }).range(n),
612
- ATXHeading2: (n, s = !0) => l.line({ class: "h2 hg " + (s ? "sw" : "") }).range(n),
613
- ATXHeading3: (n, s = !0) => l.line({ class: "h3 hg " + (s ? "sw" : "") }).range(n),
614
- ATXHeading4: (n, s = !0) => l.line({ class: "h4 hg " + (s ? "sw" : "") }).range(n),
615
- ATXHeading5: (n, s = !0) => l.line({ class: "h5 hg " + (s ? "sw" : "") }).range(n),
616
- ATXHeading6: (n, s = !0) => l.line({ class: "h6 hg " + (s ? "sw" : "") }).range(n)
617
- }, a = {
618
- HeaderMark: (n, s) => l.mark({ class: "mk" }).range(n, s)
605
+ function ve(e, t) {
606
+ const s = ["Document"], a = {
607
+ ATXHeading1: (n, r = !0) => l.line({ class: "h1 hg " + (r ? "sw" : "") }).range(n),
608
+ ATXHeading2: (n, r = !0) => l.line({ class: "h2 hg " + (r ? "sw" : "") }).range(n),
609
+ ATXHeading3: (n, r = !0) => l.line({ class: "h3 hg " + (r ? "sw" : "") }).range(n),
610
+ ATXHeading4: (n, r = !0) => l.line({ class: "h4 hg " + (r ? "sw" : "") }).range(n),
611
+ ATXHeading5: (n, r = !0) => l.line({ class: "h5 hg " + (r ? "sw" : "") }).range(n),
612
+ ATXHeading6: (n, r = !0) => l.line({ class: "h6 hg " + (r ? "sw" : "") }).range(n)
613
+ }, i = {
614
+ HeaderMark: (n, r) => l.mark({ class: "mk" }).range(n, r)
619
615
  }, c = [];
620
616
  return v(e, {
621
- enter: ({ type: n, from: s, to: o }) => (n.name in i && c.push(i[n.name](s, M(e, s, o))), n.name in a && c.push(a[n.name](s, o + 1)), r.includes(n.name) || n.name in i)
617
+ enter: ({ type: n, from: r, to: o }) => (n.name in a && c.push(a[n.name](r, y(e, r, o))), n.name in i && c.push(i[n.name](r, o + 1)), s.includes(n.name) || n.name in a)
622
618
  }), l.set(c, !1);
623
619
  }
624
- const Ee = x.baseTheme({
620
+ const He = x.baseTheme({
625
621
  "& .h1 ": { fontSize: "2.00em", fontWeight: "bolder" },
626
622
  "& .h2 ": { fontSize: "1.55em", fontWeight: "bolder" },
627
623
  "& .h3 ": { fontSize: "1.35em", fontWeight: "bolder" },
@@ -636,31 +632,31 @@ const Ee = x.baseTheme({
636
632
  height: "1px",
637
633
  borderBottom: "1px solid var(--cm-border, light-dark(#ddd, #555))"
638
634
  }
639
- }), Ae = x.baseTheme({
640
- "& .hg .mk": { display: "none" },
641
- "&.cm-focused .hg.sw .mk": { display: "inline" }
642
- }), Ie = () => [
643
- y(Be, {}),
644
- Ee,
645
- Ae
646
- ], De = (e) => `<svg class="qt-icon qt-caution" width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
635
+ }), $e = x.baseTheme({
636
+ "& .hg .mk": { fontSize: "0" },
637
+ "&.cm-focused .hg.sw .mk": { fontSize: "inherit" }
638
+ }), Se = () => [
639
+ M(ve, {}),
640
+ He,
641
+ $e
642
+ ], Be = (e) => `<svg class="qt-icon qt-caution" width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
647
643
  <path fill-rule="evenodd" clip-rule="evenodd" d="M196.094 54.176C191.229 54.988 188.782 56.222 167.834 68.423C158.562 73.823 147.197 80.435 142.578 83.117C137.959 85.799 129.961 90.458 124.805 93.47C119.648 96.482 111.211 101.406 106.055 104.413C84.503 116.982 82.78 118.066 79.627 121.029C76.043 124.397 73.548 127.986 71.861 132.199C69.426 138.28 69.543 135.024 69.435 199.872L69.336 259.18L70.21 263.086C72.901 275.106 75.333 277.456 99.826 291.697C130.626 309.606 166.896 330.685 175.781 335.841C190.902 344.615 195.154 346.196 201.915 345.563C208.158 344.978 210.107 344.123 225.391 335.264C255.218 317.977 294.844 294.867 311.417 285.093C322.591 278.504 327.153 273.047 329.413 263.569L330.273 259.961V199.609V139.258L329.396 135.938C327.721 129.594 324.327 124.148 319.504 120.066C316.509 117.531 317.424 118.075 248.047 77.651C205.151 52.657 205.162 52.662 196.094 54.176ZM206.746 110.34C212.104 111.475 216.464 114.838 218.945 119.75C220.313 122.457 220.428 126.187 219.575 140.039C219.323 144.121 218.592 157.129 217.95 168.945C214.743 227.944 214.663 228.952 212.917 232.683C208.369 242.403 195.202 244.021 188.814 235.646C185.935 231.872 185.59 229.751 184.375 208.398C183.935 200.664 182.688 180.01 181.605 162.5C178.965 119.84 178.966 119.825 183.963 114.828C188.541 110.25 197.755 108.434 206.746 110.34ZM205.105 254.139C220.433 258.641 225.321 277.899 213.857 288.623C198.306 303.17 174.003 287.211 181.04 267.073C184.452 257.309 195.564 251.336 205.105 254.139Z"/>
648
- </svg>`, Ze = (e) => `<svg class="qt-icon qt-warning" width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
644
+ </svg>`, Ee = (e) => `<svg class="qt-icon qt-warning" width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
649
645
  <path fill-rule="evenodd" clip-rule="evenodd" d="M195.982 53.527C185.35 55.195 178.527 60.217 172.381 70.898C165.461 82.925 148.022 114.138 122.184 160.742C115.633 172.559 100.427 199.98 88.394 221.68C57.505 277.38 55.934 280.238 54.25 283.76C45.588 301.882 55.075 322.592 74.884 328.805L78.32 329.883L198.438 329.99C278.577 330.062 319.42 329.965 321.154 329.699C337.809 327.15 349.594 312.698 348.718 295.898C348.297 287.827 348.329 287.895 328.438 252.148C310.272 219.501 297.79 196.996 280.665 166.016C235.38 84.092 225.675 66.998 222.278 63.175C216.156 56.285 204.847 52.136 195.982 53.527ZM209.263 116.46C218.176 119.751 220.681 125.503 219.95 141.003C219.711 146.059 219.256 155.732 218.938 162.5C218.62 169.268 218.011 180.43 217.584 187.305C216.759 200.593 216.366 207.385 215.42 224.66C215.058 231.282 214.609 236.196 214.259 237.373C210.281 250.771 189.551 250.542 185.792 237.058C185.226 235.025 184.802 229.702 183.979 214.258C183.761 210.176 183.323 202.881 183.006 198.047C182.213 185.991 181.756 178.028 181.054 164.063C180.724 157.51 180.287 149.424 180.081 146.094C178.833 125.858 181.444 119.151 191.797 115.99C194.231 115.247 206.901 115.588 209.263 116.46ZM205.893 260.709C224.265 266.28 227.749 290.936 211.55 300.733C192.458 312.28 170.521 292.287 180.334 272.284C184.884 263.009 196.351 257.816 205.893 260.709Z"/>
650
- </svg>`, Qe = (e) => `<svg class="qt-icon qt-important" width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
646
+ </svg>`, Ie = (e) => `<svg class="qt-icon qt-important" width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
651
647
  <path fill-rule="evenodd" clip-rule="evenodd" d="M190.234 64.334C153.518 67.16 117.751 87.08 95.346 117.181C46.258 183.13 68.9 277.91 142.564 314.837C228.927 358.129 330.405 294.361 330.594 196.68C330.742 119.807 265.747 58.523 190.234 64.334ZM219.531 126.465C220.494 126.947 221.218 127.78 221.98 129.284L223.062 131.421L222.957 139.621L222.852 147.822L221.875 148.263C213.74 151.931 214.67 145.87 214.532 196.094C214.395 245.634 214.025 242.228 219.783 244.354C223.193 245.613 223.047 245.172 223.047 254.214C223.047 263.28 222.791 264.649 220.681 266.868L219.262 268.359H200.09H180.919L179.769 267.392C177.295 265.31 176.926 263.501 177.043 254.054C177.131 246.999 177.246 245.543 177.734 245.295C178.057 245.131 179.5 244.445 180.943 243.77C182.568 243.01 183.905 242.067 184.459 241.291L185.352 240.039L185.456 197.305C185.559 155.268 185.548 154.545 184.78 152.959C183.999 151.347 181.2 149.279 178.906 148.622C176.957 148.063 176.953 148.047 176.953 139.659C176.953 129.986 177.595 127.658 180.624 126.34C182.693 125.439 217.703 125.552 219.531 126.465Z"/>
652
- </svg>`, Re = (e) => `<svg class="qt-icon qt-note" width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
648
+ </svg>`, Ae = (e) => `<svg class="qt-icon qt-note" width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
653
649
  <path fill-rule="evenodd" clip-rule="evenodd" d="M107.227 63.8769C101.558 65.1289 95.375 67.9369 91.406 71.0639C90.01 72.1639 88.215 73.5439 87.417 74.1299C86.62 74.7159 85.96 75.3819 85.952 75.6099C85.944 75.8379 85.612 76.3739 85.214 76.8009C81.982 80.2699 78.079 87.8199 76.776 93.1259L75.781 97.1769V198.907C75.781 262.894 75.922 301.425 76.16 302.76C76.368 303.928 76.623 305.38 76.726 305.987C78.4 315.889 87.879 327.367 98.558 332.423C107.578 336.694 98.739 336.366 201.563 336.242L291.602 336.133L294.27 335.228C309.157 330.183 318.557 320.61 322.536 306.445L323.633 302.539V228.516C323.633 144.681 323.906 151.756 320.402 144.774L318.615 141.211L286.943 109.57C269.523 92.1679 253.932 76.5229 252.297 74.8049C246.111 68.3049 241.836 65.3209 236.902 64.0589C233.006 63.0629 111.686 62.8929 107.227 63.8769ZM233.77 78.3359C236.715 80.5619 300.292 144.132 300.799 145.356C301.574 147.227 300.841 149.245 299.01 150.282L297.461 151.159L274.127 151.165C258.248 151.17 250.198 151.032 248.931 150.734C240.06 148.649 234.561 144.527 231.043 137.327C228.119 131.344 228.085 130.936 228.21 104.035L228.32 80.5309L229.275 79.5149C229.801 78.9559 230.767 78.3419 231.424 78.1519C233.014 77.6899 232.904 77.6809 233.77 78.3359ZM192.354 175.195C194.09 176.288 194.73 177.166 196.549 180.952C197.924 183.813 194.551 189.489 190.695 190.803C187.744 191.808 132.089 191.686 129.883 190.669C122.396 187.22 123.011 176.607 130.837 174.194C131.386 174.024 145.033 173.917 161.164 173.954L190.492 174.023L192.354 175.195ZM269.587 217.641C271.831 218.313 276.709 223.047 275.158 223.047C275.018 223.047 275.115 223.301 275.373 223.611C277.4 226.054 274.593 231.969 270.523 233.832L268.466 234.774L199.37 234.672L130.273 234.57L128.645 233.465C122.49 229.288 123.57 220.238 130.522 217.722C132.38 217.05 267.351 216.971 269.587 217.641ZM247.509 261.237C249.631 262.341 252.9 266.371 252.223 267.048C252.125 267.146 252.179 267.824 252.344 268.555C252.508 269.285 252.542 269.985 252.417 270.109C252.293 270.233 252.148 270.627 252.096 270.984C251.721 273.539 250.106 275.678 247.498 277.074L245.898 277.93L189.258 278.036C138.155 278.132 132.426 278.082 130.664 277.516C122.018 274.742 123.019 262.33 132.031 260.562C132.783 260.414 158.711 260.317 189.648 260.347L245.898 260.4L247.509 261.237Z"/>
654
- </svg>`, ze = (e) => `<svg class="qt-icon qt-tip" width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
650
+ </svg>`, De = (e) => `<svg class="qt-icon qt-tip" width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
655
651
  <path fill-rule="evenodd" clip-rule="evenodd" d="M197.813 54.2439C196.932 54.6529 195.79 55.5789 195.274 56.3019L194.336 57.6169L194.219 70.8359L194.102 84.0549L195.076 85.3319C197.802 88.9059 203.271 88.5369 205.364 84.6369C206.151 83.1699 206.872 60.7239 206.215 58.1479C205.842 56.6839 203.21 53.9059 202.196 53.9059C201.901 53.9059 201.155 53.8149 200.537 53.7039C199.864 53.5829 198.772 53.7989 197.813 54.2439ZM116.233 86.0419C113.323 87.6899 112.27 91.6249 113.92 94.6849C115.402 97.4339 131.364 113.194 132.973 113.496C138.573 114.546 142.477 110.343 140.971 104.883C140.465 103.049 125.118 87.2169 122.574 85.9039C120.632 84.9019 118.15 84.9559 116.233 86.0419ZM277.93 85.7559C276.466 86.4829 260.132 103.191 259.49 104.618C257.281 109.529 261.871 114.699 267.084 113.171C268.604 112.726 283.491 98.5359 285.985 95.1559C289.892 89.8619 283.853 82.8139 277.93 85.7559ZM192.578 105.326C174.207 107.647 159.188 115.505 147.608 128.855C123.664 156.459 124.119 191.541 148.828 223.047C160.759 238.26 165.383 249.444 166.996 266.992C167.829 276.054 168.682 277.986 172.825 280.204C174.652 281.182 221.998 281.773 225.389 280.86C229.012 279.884 232.583 275.584 232.967 271.735C233.077 270.63 233.363 267.529 233.603 264.844C234.904 250.229 238.454 241.734 249.573 226.622C261.236 210.772 265.303 202.299 269.01 186.133C271.624 174.731 269.08 156.872 263.028 144.145C251.295 119.471 219.462 101.931 192.578 105.326ZM88.992 165.981C83.602 166.183 82.734 166.309 81.765 167.028C77.932 169.873 77.932 174.66 81.766 177.503C83.099 178.491 104.15 178.988 108.11 178.124C114.214 176.794 115.972 170.208 111.179 166.626C109.976 165.727 101.966 165.494 88.992 165.981ZM289.847 166.481C285.102 168.919 285.171 174.882 289.974 177.45C292.2 178.64 314.187 179.022 317.07 177.921C322.542 175.831 321.886 167.919 316.118 166.457C312.336 165.498 291.723 165.517 289.847 166.481ZM132.14 230.477C129.964 231.352 113.316 248.951 113.059 250.648C112.263 255.894 117.791 260.112 122.389 257.768C124.057 256.918 139.906 240.858 140.656 239.258C143.226 233.779 137.81 228.195 132.14 230.477ZM262.386 230.871C259.487 232.447 258.349 236.857 260.122 239.648C261.348 241.579 276.261 256.486 277.701 257.219C282.933 259.885 288.816 254.457 286.416 249.179C285.559 247.294 271.67 232.693 269.4 231.29C267.429 230.071 264.211 229.879 262.386 230.871ZM174.576 292.561C170.753 293.719 169.922 295.59 169.922 303.033C169.922 310.255 170.618 312.154 173.969 314.076L175.977 315.227L200.113 315.231C223.446 315.234 224.301 315.208 225.774 314.457C229.279 312.669 230.367 309.882 230.446 302.493L230.504 297.04L229.29 295.365C226.903 292.07 228.123 292.201 200.195 292.23C186.66 292.243 175.131 292.392 174.576 292.561ZM180.946 325.217C179.882 325.963 179.759 328.554 180.683 330.774C185.032 341.224 208.831 343.084 217.528 333.654C220.185 330.773 221.108 326.967 219.531 325.391C218.456 324.315 182.465 324.154 180.946 325.217Z"/>
656
- </svg>`, Q = { tip: ze, note: Re, important: Qe, warning: Ze, caution: De, none: () => "" };
657
- class Ne extends $ {
652
+ </svg>`, Z = { tip: De, note: Ae, important: Ie, warning: Ee, caution: Be, none: () => "" };
653
+ class Ze extends $ {
658
654
  constructor(t) {
659
655
  super(), this.type = t;
660
656
  }
661
657
  toDOM() {
662
658
  let t = document.createElement("span");
663
- return t.setAttribute("aria-hidden", "true"), t.className = "wg-qt-icon", t.innerHTML = this.type in Q ? Q[this.type]() : "", t;
659
+ return t.setAttribute("aria-hidden", "true"), t.className = "wg-qt-icon", t.innerHTML = this.type in Z ? Z[this.type]() : "", t;
664
660
  }
665
661
  ignoreEvent() {
666
662
  return !1;
@@ -669,70 +665,70 @@ class Ne extends $ {
669
665
  return this.type === t.type;
670
666
  }
671
667
  }
672
- function Pe(e, t) {
673
- const r = ["Document", "ListItem", "BulletList", "OrderedList"], i = {
668
+ function Qe(e, t) {
669
+ const s = ["Document", "ListItem", "BulletList", "OrderedList"], a = {
674
670
  none: "bq-none-mark",
675
671
  note: "bq-note-mark",
676
672
  tip: "bq-tip-mark",
677
673
  warning: "bq-warning-mark",
678
674
  important: "bq-important-mark",
679
675
  caution: "bq-caution-mark"
680
- }, a = {
681
- QuoteMark: (s, o, d) => {
676
+ }, i = {
677
+ QuoteMark: (r, o, d) => {
682
678
  const u = ["qt-mk"];
683
- return d in i ? u.push(i[d]) : u.push(i.none), l.mark({
679
+ return d in a ? u.push(a[d]) : u.push(a.none), l.mark({
684
680
  class: u.join(" ")
685
- }).range(s, o);
681
+ }).range(r, o);
686
682
  },
687
- QuoteType: (s, o, d) => l.widget({
688
- widget: new Ne(d),
683
+ QuoteType: (r, o, d) => l.widget({
684
+ widget: new Ze(d),
689
685
  side: 1
690
- }).range(s),
691
- BlockquoteLine: (s, o) => l.line({ class: "bq-line " + (o ? "sw" : "") }).range(s),
692
- quoteLine: (s, o, d) => {
686
+ }).range(r),
687
+ BlockquoteLine: (r, o) => l.line({ class: "bq-line " + (o ? "sw" : "") }).range(r),
688
+ quoteLine: (r, o, d) => {
693
689
  const u = `calc(100% - ${Math.max(0, d) + 1.2}ch)`;
694
690
  return l.mark({
695
691
  class: "bq-text-line",
696
692
  attributes: { style: `width: ${u}` }
697
- }).range(s, o);
693
+ }).range(r, o);
698
694
  }
699
- }, c = (s, o, d, u) => {
695
+ }, c = (r, o, d, u) => {
700
696
  const g = [], m = d.number, w = (p, T) => {
701
697
  let b = 0;
702
698
  const f = [];
703
699
  let C = 0;
704
700
  return {
705
701
  enter({ name: L, node: q, from: k, to: H }) {
706
- L === "Blockquote" && f.push(_e(s, q)), L === "QuoteMark" && (g.push(a[L](k, H, f[b])), C = H, b++), L === "QuoteType" && g.push(a[L](k, H, f[b - 1]));
702
+ L === "Blockquote" && f.push(ze(r, q)), L === "QuoteMark" && (g.push(i[L](k, H, f[b])), C = H, b++), L === "QuoteType" && g.push(i[L](k, H, f[b - 1]));
707
703
  },
708
704
  leave({ name: L, from: q, to: k }) {
709
- L === "Paragraph" && C < T && g.push(a.quoteLine(C, T, C - p));
705
+ L === "Paragraph" && C < T && g.push(i.quoteLine(C, T, C - p));
710
706
  }
711
707
  };
712
708
  };
713
709
  for (let p = m; p < u + m; p++) {
714
- const { from: T, to: b } = s.state.doc.line(p), { from: f, to: C } = o, L = M(s, f, C);
715
- g.push(a.BlockquoteLine(T, L)), I(s.state).iterate({ from: T, to: b, ...w(T, b) });
710
+ const { from: T, to: b } = r.state.doc.line(p), { from: f, to: C } = o, L = y(r, f, C);
711
+ g.push(i.BlockquoteLine(T, L)), I(r.state).iterate({ from: T, to: b, ...w(T, b) });
716
712
  }
717
713
  return g;
718
714
  }, n = [];
719
715
  return v(e, {
720
- enter: ({ name: s, from: o, to: d, node: u }) => {
721
- if (s === "Blockquote") {
716
+ enter: ({ name: r, from: o, to: d, node: u }) => {
717
+ if (r === "Blockquote") {
722
718
  const g = e.state.sliceDoc(o, d).split(`
723
719
  `), m = e.state.doc.lineAt(o);
724
720
  n.push(...c(e, u, m, g.length));
725
721
  }
726
- return r.includes(s);
722
+ return s.includes(r);
727
723
  }
728
724
  }), l.set(n, !0);
729
725
  }
730
- const _e = (e, t) => {
731
- const r = t.getChild("QuoteType");
732
- if (!r) return "none";
733
- const i = r.getChild("QuoteTypeText");
734
- return i ? e.state.sliceDoc(i.from, i.to).toLowerCase() : "none";
735
- }, Oe = () => x.baseTheme({
726
+ const ze = (e, t) => {
727
+ const s = t.getChild("QuoteType");
728
+ if (!s) return "none";
729
+ const a = s.getChild("QuoteTypeText");
730
+ return a ? e.state.sliceDoc(a.from, a.to).toLowerCase() : "none";
731
+ }, Re = () => x.baseTheme({
736
732
  "& .qt-mk": {
737
733
  // outline: "1px red solid",
738
734
  position: "relative",
@@ -781,47 +777,47 @@ const _e = (e, t) => {
781
777
  "& .wg-qt-icon > .qt-important": { fill: "var(--bq-important-mark, rebeccapurple)" },
782
778
  "& .wg-qt-icon > .qt-warning": { fill: "var(--bq-warning-mark, peru)" },
783
779
  "& .wg-qt-icon > .qt-caution": { fill: "var(--bq-caution-mark, red)" }
784
- }), Ve = () => [
785
- y(Pe, {}),
786
- Oe()
787
- ], We = {
780
+ }), Ne = () => [
781
+ M(Qe, {}),
782
+ Re()
783
+ ], Pe = {
788
784
  name: "QuoteTypeParser",
789
785
  parse(e, t) {
790
786
  if ((() => {
791
- for (let i = 0; i < e.depth; i++)
792
- if (e.parentType(i).name === "Blockquote") return !0;
787
+ for (let a = 0; a < e.depth; a++)
788
+ if (e.parentType(a).name === "Blockquote") return !0;
793
789
  return !1;
794
790
  })()) {
795
- const i = t.text.match(/^(\s*>\s*)+(\[!\w+\])\s*$/);
796
- if (i && i[2]) {
797
- const a = i[2], c = t.text.indexOf(a), n = c + a.length, s = e.elt("QuoteType", e.lineStart + c, e.lineStart + n);
798
- s.children = [
791
+ const a = t.text.match(/^(\s*>\s*)+(\[!\w+\])\s*$/);
792
+ if (a && a[2]) {
793
+ const i = a[2], c = t.text.indexOf(i), n = c + i.length, r = e.elt("QuoteType", e.lineStart + c, e.lineStart + n);
794
+ r.children = [
799
795
  e.elt("QuoteTypeMark", e.lineStart + c, e.lineStart + c + 2),
800
796
  e.elt("QuoteTypeText", e.lineStart + c + 2, e.lineStart + n - 1),
801
797
  e.elt("QuoteTypeMark", e.lineStart + n - 1, e.lineStart + n)
802
- ], e.addElement(s);
798
+ ], e.addElement(r);
803
799
  }
804
800
  }
805
801
  return !1;
806
802
  }
807
- }, Fe = {
803
+ }, _e = {
808
804
  defineNodes: [
809
- { name: "QuoteType", style: { "QuoteType/...": A.content } },
810
- { name: "QuoteTypeMark", style: A.processingInstruction },
811
- { name: "QuoteTypeText", style: A.bool }
805
+ { name: "QuoteType", style: { "QuoteType/...": E.content } },
806
+ { name: "QuoteTypeMark", style: E.processingInstruction },
807
+ { name: "QuoteTypeText", style: E.bool }
812
808
  ],
813
- parseBlock: [We]
809
+ parseBlock: [Pe]
814
810
  };
815
- class R extends $ {
816
- constructor(t, r = !1) {
817
- super(), this.content = t, this.tag = r;
811
+ class Q extends $ {
812
+ constructor(t, s = !1) {
813
+ super(), this.content = t, this.tag = s;
818
814
  }
819
815
  toDOM() {
820
816
  const t = document.createElement("div");
821
817
  t.className = "cm-html-widget", t.setAttribute("aria-hidden", "true");
822
- const r = this.content.replace(/^```html\n?/, "").replace(/```$/, "").trim();
823
- return t.innerHTML = (this.tag ? '<span class="cm-rendered-tag">RTAG</span>' : "") + r, t.querySelectorAll("script").forEach((i) => {
824
- i.parentNode.removeChild(i);
818
+ const s = this.content.replace(/^```html\n?/, "").replace(/```$/, "").trim();
819
+ return t.innerHTML = (this.tag ? '<span class="cm-rendered-tag">RTAG</span>' : "") + s, t.querySelectorAll("script").forEach((a) => {
820
+ a.parentNode.removeChild(a);
825
821
  }), t;
826
822
  }
827
823
  ignoreEvent(t) {
@@ -831,48 +827,48 @@ class R extends $ {
831
827
  return t.content === this.content;
832
828
  }
833
829
  }
834
- const P = G.define(), Ue = K.define({
830
+ const N = U.define(), Oe = X.define({
835
831
  create(e) {
836
832
  return l.none;
837
833
  },
838
834
  update(e, t) {
839
835
  e = e.map(t.changes);
840
- for (let r of t.effects)
841
- if (r.is(P))
842
- return r.value;
836
+ for (let s of t.effects)
837
+ if (s.is(N))
838
+ return s.value;
843
839
  return e;
844
840
  },
845
841
  provide: (e) => z.decorations.from(e)
846
842
  });
847
- function Xe(e) {
843
+ function Ve(e) {
848
844
  const t = [
849
845
  /<br>/,
850
846
  /<img .*\/>/
851
- ], r = {
852
- HTMLBlock: (a, c) => {
853
- const n = e.state.doc.sliceString(a, c);
847
+ ], s = {
848
+ HTMLBlock: (i, c) => {
849
+ const n = e.state.doc.sliceString(i, c);
854
850
  return [l.replace({
855
- widget: new R(n),
851
+ widget: new Q(n),
856
852
  inclusive: !1
857
- }).range(a, c)];
853
+ }).range(i, c)];
858
854
  },
859
- HTMLTag: (a, c) => {
860
- const n = e.state.doc.sliceString(a, c);
861
- return console.log(n), t.some((s) => s.test(n)) ? (console.log(n), [
855
+ HTMLTag: (i, c) => {
856
+ const n = e.state.doc.sliceString(i, c);
857
+ return console.log(n), t.some((r) => r.test(n)) ? (console.log(n), [
862
858
  l.replace({
863
- widget: new R(n, !0),
859
+ widget: new Q(n, !0),
864
860
  inclusive: !1
865
- }).range(a, c)
861
+ }).range(i, c)
866
862
  ]) : [];
867
863
  }
868
- }, i = [];
864
+ }, a = [];
869
865
  return v(e, {
870
- enter: ({ type: a, from: c, to: n, node: s }) => {
871
- a.name in r && (!M(e, c, n) || !e.hasFocus) && i.push(...r[a.name](c, n));
866
+ enter: ({ type: i, from: c, to: n, node: r }) => {
867
+ i.name in s && (!y(e, c, n) || !e.hasFocus) && a.push(...s[i.name](c, n));
872
868
  }
873
- }), l.set(i);
869
+ }), l.set(a);
874
870
  }
875
- const je = x.baseTheme({
871
+ const We = x.baseTheme({
876
872
  "& .cm-html-widget": {
877
873
  all: "unset"
878
874
  // outline: "red solid 2px",
@@ -884,60 +880,65 @@ const je = x.baseTheme({
884
880
  marginTop: "0"
885
881
  },
886
882
  "& .cm-widgetBuffer": { display: "none" }
887
- }), Ge = z.updateListener.of((e) => {
883
+ }), Fe = z.updateListener.of((e) => {
888
884
  if (e.selectionSet || e.docChanged || e.focusChanged || e.geometryChanged) {
889
- const t = Xe(e.view);
890
- e.view.dispatch({ effects: P.of(t) });
885
+ const t = Ve(e.view);
886
+ e.view.dispatch({ effects: N.of(t) });
891
887
  }
892
- }), Ke = () => [
893
- Ue,
894
- Ge,
895
- je
896
- ], ct = (e) => {
888
+ }), Ue = () => [
889
+ Oe,
890
+ Fe,
891
+ We
892
+ ], Xe = (e) => {
897
893
  const {
898
- markdown: {
899
- defaultCodeLanguage: t,
900
- codeLanguages: r,
901
- addKeymap: i,
902
- base: a,
903
- completeHTMLTags: c,
904
- htmlTagLanguage: n,
905
- extensions: s = []
906
- } = {}
907
- // theme
908
- } = e ?? {}, o = {
909
894
  defaultCodeLanguage: t,
910
- codeLanguages: r || V,
911
- addKeymap: i,
912
- base: a,
895
+ codeLanguages: s,
896
+ addKeymap: a,
897
+ base: i,
913
898
  completeHTMLTags: c,
914
899
  htmlTagLanguage: n,
915
- extensions: [...s, F, J, Fe]
900
+ extensions: r = []
901
+ } = e || {}, o = {
902
+ defaultCodeLanguage: t,
903
+ codeLanguages: s || P,
904
+ addKeymap: a,
905
+ base: i,
906
+ completeHTMLTags: c,
907
+ htmlTagLanguage: n,
908
+ extensions: [...r, O, _e]
916
909
  };
910
+ return _(o);
911
+ }, ot = (e) => {
912
+ const {
913
+ markdown: t
914
+ // theme
915
+ } = e ?? {};
917
916
  return [
918
- W(o),
917
+ Xe(t),
918
+ Y(),
919
919
  ne(),
920
- ie(),
921
- ue(),
922
- Ce(),
923
- xe(),
920
+ ae(),
921
+ me(),
922
+ we(),
923
+ ye(),
924
924
  Se(),
925
- Ie(),
926
- Ve(),
927
- Ke()
925
+ Ne(),
926
+ Ue()
928
927
  // (theme) ? themeVariant.of(catppuccin(theme)) : [],
929
928
  ];
930
929
  };
931
930
  export {
932
- Se as CodePlugin,
933
- Ie as HeadingPlugin,
934
- ne as HrPlugin,
935
- Ke as HtmlPlugin,
936
- Ce as ImagePlugin,
937
- ie as InlinePlugin,
938
- ue as LinkPlugin,
939
- xe as ListPlugin,
940
- Ve as QuotePlugin,
941
- Fe as QuoteType,
942
- ct as gnosis
931
+ ye as CodePlugin,
932
+ Se as HeadingPlugin,
933
+ Y as HrPlugin,
934
+ Ue as HtmlPlugin,
935
+ me as ImagePlugin,
936
+ ne as InlinePlugin,
937
+ ae as LinkPlugin,
938
+ we as ListPlugin,
939
+ Ne as QuotePlugin,
940
+ _e as QuoteType,
941
+ ot as gnosis,
942
+ Xe as markdown,
943
+ rt as unsetMarks
943
944
  };