@glifox/gnosis 0.0.6 → 0.0.8

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,83 +1,84 @@
1
- var V = Object.defineProperty;
2
- var X = (t, r, o) => r in t ? V(t, r, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[r] = o;
3
- var L = (t, r, o) => X(t, typeof r != "symbol" ? r + "" : r, o);
4
- import { languages as Z } from "@codemirror/language-data";
5
- import { markdown as J } from "@codemirror/lang-markdown";
6
- import { GFM as ee } from "@lezer/markdown";
7
- import { Tag as re, styleTags as te, tags as e } from "@lezer/highlight";
8
- import { ViewPlugin as ae, Decoration as h, WidgetType as S, EditorView as K } from "@codemirror/view";
9
- import { syntaxTree as H, HighlightStyle as oe, syntaxHighlighting as ne } from "@codemirror/language";
1
+ var U = Object.defineProperty;
2
+ var X = (t, r, a) => r in t ? U(t, r, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[r] = a;
3
+ var q = (t, r, a) => X(t, typeof r != "symbol" ? r + "" : r, a);
4
+ import { languages as J } from "@codemirror/language-data";
5
+ import { markdown as ee } from "@codemirror/lang-markdown";
6
+ import { GFM as re } from "@lezer/markdown";
7
+ import { Tag as te, styleTags as ae, tags as e } from "@lezer/highlight";
8
+ import { ViewPlugin as oe, Decoration as h, WidgetType as E, EditorView as A } from "@codemirror/view";
9
+ import { syntaxTree as $, HighlightStyle as ne, syntaxHighlighting as le } from "@codemirror/language";
10
10
  import { EditorView as B } from "codemirror";
11
- import { Compartment as le } from "@codemirror/state";
12
- const m = re.define("none"), ce = te({
13
- "Blockquote/...": m,
14
- HorizontalRule: m,
15
- "ATXHeading1/... SetextHeading1/...": m,
16
- "ATXHeading2/... SetextHeading2/...": m,
17
- "ATXHeading3/...": m,
18
- "ATXHeading4/...": m,
19
- "ATXHeading5/...": m,
20
- "ATXHeading6/...": m,
21
- "Comment CommentBlock": m,
22
- Escape: m,
23
- Entity: m,
24
- "Emphasis/...": m,
25
- "StrongEmphasis/...": m,
26
- "Strikethrough/...": m,
27
- "TableHeader/...": m,
28
- "Link/... Image/...": m,
29
- "OrderedList/... BulletList/...": m,
30
- "BlockQuote/...": m,
31
- "InlineCode CodeText": m,
32
- "URL Autolink": m,
33
- "HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark StrikethroughMark": m,
34
- "CodeInfo LinkLabel TaskMarker TableDelimiter": m,
35
- LinkTitle: m,
36
- Paragraph: m
37
- }), se = { props: [ce] }, C = (t, r, o = {}) => {
38
- const n = class {
39
- constructor(g) {
40
- L(this, "decorations");
41
- L(this, "conf");
42
- this.conf = r, this.decorations = t(g, this.conf);
11
+ import { Compartment as ce, StateEffect as se, StateField as ie } from "@codemirror/state";
12
+ const f = te.define("none"), ge = ae({
13
+ "Blockquote/...": f,
14
+ HorizontalRule: f,
15
+ "ATXHeading1/... SetextHeading1/...": f,
16
+ "ATXHeading2/... SetextHeading2/...": f,
17
+ "ATXHeading3/...": f,
18
+ "ATXHeading4/...": f,
19
+ "ATXHeading5/...": f,
20
+ "ATXHeading6/...": f,
21
+ "Comment CommentBlock": f,
22
+ Escape: f,
23
+ Entity: f,
24
+ "Emphasis/...": f,
25
+ "StrongEmphasis/...": f,
26
+ "Strikethrough/...": f,
27
+ "TableHeader/...": f,
28
+ "Link/... Image/...": f,
29
+ "OrderedList/... BulletList/...": f,
30
+ "BlockQuote/...": f,
31
+ "InlineCode CodeText": f,
32
+ "URL Autolink": f,
33
+ "HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark StrikethroughMark": f,
34
+ "CodeInfo LinkLabel TaskMarker TableDelimiter": f,
35
+ LinkTitle: f,
36
+ Paragraph: f,
37
+ "QuoteType/.. QuoteTypeMark QuoteTypeText": f
38
+ }), he = { props: [ge] }, v = (t, r, a = {}) => {
39
+ const o = class {
40
+ constructor(i) {
41
+ q(this, "decorations");
42
+ q(this, "conf");
43
+ this.conf = r, this.decorations = t(i, this.conf);
43
44
  }
44
- update(g) {
45
- (g.docChanged || g.viewportChanged || g.selectionSet) && (this.decorations = t(g.view, this.conf));
45
+ update(i) {
46
+ (i.docChanged || i.viewportChanged || i.selectionSet) && (this.decorations = t(i.view, this.conf));
46
47
  }
47
48
  };
48
- return ae.fromClass(n, { decorations: (s) => s.decorations, ...o });
49
- }, v = (t, r, o) => {
50
- const n = t.state.selection.ranges;
51
- for (let s of n)
52
- if (s.from >= r && s.from <= o || s.to >= r && s.to <= o || s.from <= r && s.to >= o)
49
+ return oe.fromClass(o, { decorations: (c) => c.decorations, ...a });
50
+ }, N = (t, r, a) => {
51
+ const o = t.state.selection.ranges;
52
+ for (let c of o)
53
+ if (c.from >= r && c.from <= a || c.to >= r && c.to <= a || c.from <= r && c.to >= a)
53
54
  return !0;
54
55
  return !1;
55
- }, E = (t, r) => {
56
- for (const { from: o, to: n } of t.visibleRanges)
57
- H(t.state).iterate({ ...r, from: o, to: n });
56
+ }, L = (t, r) => {
57
+ for (const { from: a, to: o } of t.visibleRanges)
58
+ $(t.state).iterate({ ...r, from: a, to: o });
58
59
  };
59
- function ge(t, r, o, n = 1) {
60
- const s = (i) => [
61
- (t[0] - (1 - i) * r[0]) / i,
62
- (t[1] - (1 - i) * r[1]) / i,
63
- (t[2] - (1 - i) * r[2]) / i
60
+ function de(t, r, a, o = 1) {
61
+ const c = (g) => [
62
+ (t[0] - (1 - g) * r[0]) / g,
63
+ (t[1] - (1 - g) * r[1]) / g,
64
+ (t[2] - (1 - g) * r[2]) / g
64
65
  ];
65
- let g = o, l = s(g);
66
- const a = l.map((i, d) => i < 0 && r[d] > 0 ? 1 - l[d] / r[d] : o), c = Math.max(...a);
67
- return c > g && (g = Math.min(c, n), t = s(g)), l = l.map((i) => Math.round(i < 0 ? 0 : i)), l.push(g), l;
66
+ let i = a, l = c(i);
67
+ const n = l.map((g, d) => g < 0 && r[d] > 0 ? 1 - l[d] / r[d] : a), s = Math.max(...n);
68
+ return s > i && (i = Math.min(s, o), t = c(i)), l = l.map((g) => Math.round(g < 0 ? 0 : g)), l.push(i), l;
68
69
  }
69
- function ie(t, r) {
70
- const o = ["Document"], n = {}, s = {
71
- HorizontalRule: (l, a, c = !0) => [
72
- h.line({ class: "hr " + (c ? "sw" : "") }).range(l),
73
- h.mark({ class: "mk" }).range(l, a)
70
+ function be(t, r) {
71
+ const a = ["Document"], o = {}, c = {
72
+ HorizontalRule: (l, n, s = !0) => [
73
+ h.line({ class: "hr " + (s ? "sw" : "") }).range(l),
74
+ h.mark({ class: "mk" }).range(l, n)
74
75
  ]
75
- }, g = [];
76
- return E(t, {
77
- enter: ({ type: l, from: a, to: c }) => (l.name in s && g.push(...s[l.name](a, c, v(t, a, c))), o.includes(l.name) || l.name in n)
78
- }), h.set(g, !1);
76
+ }, i = [];
77
+ return L(t, {
78
+ enter: ({ type: l, from: n, to: s }) => (l.name in c && i.push(...c[l.name](n, s, N(t, n, s))), a.includes(l.name) || l.name in o)
79
+ }), h.set(i, !1);
79
80
  }
80
- const he = (t) => {
81
+ const me = (t) => {
81
82
  const {
82
83
  color: r = "black"
83
84
  } = t || {};
@@ -94,29 +95,29 @@ const he = (t) => {
94
95
  },
95
96
  "&.cm-focused .hr.sw::before": { width: "0", height: "0" }
96
97
  });
97
- }, Q = (t = {}) => [
98
- C(ie, {}),
99
- he(t == null ? void 0 : t.color)
98
+ }, z = (t = {}) => [
99
+ v(be, {}),
100
+ me(t == null ? void 0 : t.color)
100
101
  ];
101
- function de(t, r) {
102
- const o = ["FencedCode"], n = {
103
- StrongEmphasis: (l = !0, a, c) => h.mark({ class: "il st " + (l ? "sw" : "") }).range(a, c),
104
- Strikethrough: (l = !0, a, c) => h.mark({ class: "il sk " + (l ? "sw" : "") }).range(a, c),
105
- InlineCode: (l = !0, a, c) => h.mark({ class: "il ic " + (l ? "sw" : "") }).range(a, c),
106
- Emphasis: (l = !0, a, c) => h.mark({ class: "il it " + (l ? "sw" : "") }).range(a, c),
107
- Mark: (l, a) => h.mark({ class: "mkl" }).range(l, a)
108
- }, s = ["EmphasisMark", "CodeMark", "StrikethroughMark"], g = [];
109
- return E(t, {
110
- enter: ({ type: { name: l }, from: a, to: c }) => s.includes(l) ? (g.push(n.Mark(a, c)), !1) : (l in n && g.push(
111
- n[l](
112
- v(t, a, c),
113
- a,
114
- c
102
+ function ue(t, r) {
103
+ const a = ["FencedCode"], o = {
104
+ StrongEmphasis: (l = !0, n, s) => h.mark({ class: "il st " + (l ? "sw" : "") }).range(n, s),
105
+ Strikethrough: (l = !0, n, s) => h.mark({ class: "il sk " + (l ? "sw" : "") }).range(n, s),
106
+ InlineCode: (l = !0, n, s) => h.mark({ class: "il ic " + (l ? "sw" : "") }).range(n, s),
107
+ Emphasis: (l = !0, n, s) => h.mark({ class: "il it " + (l ? "sw" : "") }).range(n, s),
108
+ Mark: (l, n) => h.mark({ class: "mkl" }).range(l, n)
109
+ }, c = ["EmphasisMark", "CodeMark", "StrikethroughMark"], i = [];
110
+ return L(t, {
111
+ enter: ({ type: { name: l }, from: n, to: s }) => c.includes(l) ? (i.push(o.Mark(n, s)), !1) : (l in o && i.push(
112
+ o[l](
113
+ N(t, n, s),
114
+ n,
115
+ s
115
116
  )
116
- ), !o.includes(l))
117
- }), h.set(g, !1);
117
+ ), !a.includes(l))
118
+ }), h.set(i, !1);
118
119
  }
119
- const be = B.baseTheme({
120
+ const fe = B.baseTheme({
120
121
  ".it ": { fontStyle: "italic" },
121
122
  ".st ": { fontWeight: "bold" },
122
123
  ".sk ": { textDecoration: "line-through" },
@@ -125,89 +126,111 @@ const be = B.baseTheme({
125
126
  paddingInline: ".6ch",
126
127
  borderRadius: ".6ch"
127
128
  }
128
- }), me = B.baseTheme({
129
+ }), pe = B.baseTheme({
129
130
  ".il .mkl": { fontSize: "0" },
130
131
  "&.cm-focused .il.sw .mkl": { fontSize: "inherit" }
131
- }), z = (t = {}) => {
132
+ }), Q = (t = {}) => {
132
133
  const {
133
134
  hideMarks: r = !0
134
135
  } = t;
135
136
  return [
136
- C(de, {}),
137
- be,
138
- r ? me : []
137
+ v(ue, {}),
138
+ fe,
139
+ r ? pe : []
139
140
  ];
140
141
  };
141
- class ue extends S {
142
- constructor(o) {
142
+ class ke extends E {
143
+ constructor(a) {
143
144
  super();
144
- L(this, "checked", !1);
145
- this.checked = o;
145
+ q(this, "checked", !1);
146
+ this.checked = a;
146
147
  }
147
148
  // eq(other) { return other.checked == this.checked }
148
149
  toDOM() {
149
- let o = document.createElement("span");
150
- o.setAttribute("aria-hidden", "true"), o.className = "TaskMark";
151
- let n = o.appendChild(document.createElement("input"));
152
- return n.type = "checkbox", n.checked = this.checked, o;
150
+ let a = document.createElement("span");
151
+ a.setAttribute("aria-hidden", "true"), a.className = "TaskMark";
152
+ let o = a.appendChild(document.createElement("input"));
153
+ return o.type = "checkbox", o.checked = this.checked, a;
153
154
  }
154
155
  ignoreEvent() {
155
156
  return !1;
156
157
  }
157
158
  }
158
- function fe(t, r) {
159
- const o = [
159
+ function xe(t, r) {
160
+ const a = [
160
161
  "Document",
161
162
  "ListItem",
162
- "Task"
163
- ], n = {
164
- BulletList: "bl",
165
- OrderedList: "ol"
166
- }, s = {
167
- ListMark: (a, c, i, d = !0) => h.mark({ class: `${i} lm ${d ? "sw" : ""}` }).range(a, c),
168
- TaskMarker: (a, c, i, d = !0) => {
169
- const b = t.state.doc.sliceString(a + 1, c - 1) === "x";
170
- return d ? h.mark({ class: `tm ${b ? "ck" : ""}` }).range(a, c) : h.replace({
171
- widget: new ue(b)
172
- }).range(a, c);
163
+ "Task",
164
+ "Blockquote"
165
+ ], o = {
166
+ BulletList: {
167
+ class: "bl",
168
+ offset: 2
169
+ },
170
+ OrderedList: {
171
+ class: "ol",
172
+ offset: 3
173
173
  }
174
- }, g = [], l = [];
175
- return E(t, {
176
- enter: ({ type: a, from: c, to: i }) => a.name in n ? (l.push({ name: a.name, from: c, to: i }), !0) : (a.name in s && g.push(s[a.name](
177
- c,
178
- i,
179
- n[l.slice(-1)[0].name],
180
- v(t, c, i)
181
- )), o.includes(a.name)),
182
- leave: ({ type: { name: a }, from: c, to: i }) => {
183
- const d = l.slice(-1)[0];
184
- d && d.name === a && d.from === c && d.to === i && l.pop();
174
+ }, c = {
175
+ ListMark: (s, g, d, b = !0) => h.mark({ class: `${d.class} lm ${b ? "sw" : ""}` }).range(s, g),
176
+ TaskMarker: (s, g, d, b = !0) => {
177
+ const k = t.state.doc.sliceString(s + 1, g - 1) === "x";
178
+ return b ? h.mark({ class: `tm ${k ? "ck" : ""}` }).range(s, g) : h.replace({
179
+ widget: new ke(k)
180
+ }).range(s, g);
185
181
  }
186
- }), h.set(g, !1);
182
+ }, i = {
183
+ ListItem: (s, g, d, b) => {
184
+ const k = d.offset + (b ? 4 : 0), u = s + k, m = `calc(100% - ${Math.max(0, k) + 4}ch)`;
185
+ return u >= g ? [] : [
186
+ h.mark({
187
+ class: "ls-text-line",
188
+ attributes: { style: `width: ${m}` }
189
+ }).range(u, g)
190
+ ];
191
+ }
192
+ }, l = [], n = [];
193
+ return L(t, {
194
+ enter: ({ name: s, from: g, to: d, node: b }) => s in o ? (n.push({ name: s, from: g, to: d }), !0) : (s in c && l.push(c[s](
195
+ g,
196
+ d,
197
+ o[n.slice(-1)[0].name],
198
+ N(t, g, d)
199
+ )), s in i && (console.log({ node: b, name: s }), l.push(...i[s](
200
+ g,
201
+ d,
202
+ o[n.slice(-1)[0].name],
203
+ b.getChild("Task") !== null
204
+ ))), a.includes(s)),
205
+ leave: ({ name: s, from: g, to: d }) => {
206
+ const b = n.slice(-1)[0];
207
+ b && b.name === s && b.from === g && b.to === d && n.pop();
208
+ }
209
+ }), h.set(l, !0);
187
210
  }
188
- const pe = (t, r) => {
189
- var n;
190
- let o = t.target;
191
- if (o.nodeName === "INPUT" && ((n = o.parentElement) != null && n.classList.contains("TaskMark"))) return ke(r, r.posAtDOM(o));
192
- }, ke = (t, r) => {
193
- const o = r - 2, n = r - 1;
194
- let s = t.state.doc.sliceString(Math.max(0, o), n), g;
195
- if (s === "x") g = { from: o, to: n, insert: " " };
196
- else if (s === " ") g = { from: o, to: n, insert: "x" };
211
+ const Ce = (t, r) => {
212
+ var o;
213
+ let a = t.target;
214
+ if (a.nodeName === "INPUT" && ((o = a.parentElement) != null && o.classList.contains("TaskMark"))) return ye(r, r.posAtDOM(a));
215
+ }, ye = (t, r) => {
216
+ const a = r - 2, o = r - 1;
217
+ let c = t.state.doc.sliceString(Math.max(0, a), o), i;
218
+ if (c === "x") i = { from: a, to: o, insert: " " };
219
+ else if (c === " ") i = { from: a, to: o, insert: "x" };
197
220
  else return !1;
198
- return t.dispatch({ changes: g }), !0;
199
- }, xe = (t) => {
221
+ return t.dispatch({ changes: i }), !0;
222
+ }, we = (t) => {
200
223
  const {
201
224
  color: r = "black"
202
225
  } = t || {};
203
226
  return B.baseTheme({
204
227
  /* Bullet list Point */
205
- ".lm.bl": {
228
+ "& .lm.bl": {
206
229
  position: "relative",
207
230
  paddingInlineStart: "1ch",
208
231
  color: "transparent"
209
232
  },
210
- ".lm.bl::before": {
233
+ "& .lm.bl::before": {
211
234
  content: '""',
212
235
  display: "inline",
213
236
  position: "absolute",
@@ -224,141 +247,150 @@ const pe = (t, r) => {
224
247
  "&.cm-focused .lm.bl.sw, &.cm-focused .lm.bl.sw::before": {
225
248
  backgroundColor: "transparent",
226
249
  color: "inherit"
250
+ },
251
+ /* list text line */
252
+ "& .ls-text-line": {
253
+ display: "inline-block",
254
+ ariaHidden: "true"
255
+ // border: "red 1px solid"
256
+ },
257
+ "& .cm-line .lm, & .cm-line .TaskMark, & .cm-line .tm, & .cm-line .ls-text-line": {
258
+ verticalAlign: "top"
227
259
  }
228
260
  });
229
- }, G = (t = {}) => [
230
- C(fe, {}, { eventHandlers: { mousedown: pe } }),
231
- xe(t == null ? void 0 : t.color)
232
- ], ye = (t, r) => {
233
- var n;
234
- let o = t.target;
235
- if (o.nodeName === "BUTTON" && ((n = o.parentElement) != null && n.classList.contains("wg-codeblock"))) {
236
- const s = ["FencedCode", "CodeBlock"];
237
- let g = "";
261
+ }, K = (t = {}) => [
262
+ v(xe, {}, { eventHandlers: { mousedown: Ce } }),
263
+ we(t == null ? void 0 : t.color)
264
+ ], Fe = (t, r) => {
265
+ var o;
266
+ let a = t.target;
267
+ if (a.nodeName === "BUTTON" && ((o = a.parentElement) != null && o.classList.contains("wg-codeblock"))) {
268
+ const c = ["FencedCode", "CodeBlock"];
269
+ let i = "";
238
270
  const l = {
239
- enter: ({ type: { name: a }, from: c, to: i, node: d }) => (s.includes(a) && (g = Fe(r, d.toTree(), c, i)), !s.includes(a))
271
+ enter: ({ type: { name: n }, from: s, to: g, node: d }) => (c.includes(n) && (i = Be(r, d.toTree(), s, g)), !c.includes(n))
240
272
  };
241
- return H(r.state).iterate({
273
+ return $(r.state).iterate({
242
274
  ...l,
243
- from: r.posAtDOM(o),
244
- to: r.posAtDOM(o) + 2
245
- }), navigator.clipboard.writeText(g), !0;
275
+ from: r.posAtDOM(a),
276
+ to: r.posAtDOM(a) + 2
277
+ }), navigator.clipboard.writeText(i), !0;
246
278
  }
247
- }, Fe = (t, r, o, n) => {
248
- const s = ["CodeMark", "CodeInfo"];
249
- let g = t.state.doc.sliceString(o, n), l = /* @__PURE__ */ new Set();
279
+ }, Be = (t, r, a, o) => {
280
+ const c = ["CodeMark", "CodeInfo"];
281
+ let i = t.state.doc.sliceString(a, o), l = /* @__PURE__ */ new Set();
250
282
  r.iterate({
251
- enter({ type: { name: d }, from: b, node: y }) {
252
- s.includes(d) && l.add(t.state.doc.lineAt(b + o).number);
283
+ enter({ type: { name: d }, from: b, node: k }) {
284
+ c.includes(d) && l.add(t.state.doc.lineAt(b + a).number);
253
285
  }
254
286
  });
255
- const a = t.state.doc.lineAt(o), c = o - a.from, i = [];
256
- return g.split(`
287
+ const n = t.state.doc.lineAt(a), s = a - n.from, g = [];
288
+ return i.split(`
257
289
  `).forEach((d, b) => {
258
- l.has(b + a.number) || i.push(d.slice(c));
259
- }), i.join(`
290
+ l.has(b + n.number) || g.push(d.slice(s));
291
+ }), g.join(`
260
292
  `);
261
293
  };
262
- class W extends S {
263
- constructor(o, n, s) {
294
+ class R extends E {
295
+ constructor(a, o, c) {
264
296
  super();
265
- L(this, "classes", "");
266
- this.classes = o, this.width = n, this.marginLeft = s;
297
+ q(this, "classes", "");
298
+ this.classes = a, this.width = o, this.marginLeft = c;
267
299
  }
268
300
  toDOM() {
269
- let o = document.createElement("span");
270
- return o.setAttribute("aria-hidden", "true"), o.className = this.classes + " vacio", o.textContent = " ", o.style.width = this.width, o.style.marginLeft = this.marginLeft, o;
301
+ let a = document.createElement("span");
302
+ return a.setAttribute("aria-hidden", "true"), a.className = this.classes + " vacio", a.textContent = " ", a.style.width = this.width, a.style.marginLeft = this.marginLeft, a;
271
303
  }
272
304
  ignoreEvent() {
273
305
  return !1;
274
306
  }
275
307
  }
276
- const we = (t) => `<svg class="cb-icon" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
308
+ const ve = (t) => `<svg class="cb-icon" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
277
309
  <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"/>
278
310
  <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"/>
279
311
  </svg>`;
280
- class Be extends S {
281
- constructor(r, o) {
282
- super(), this.type = r, this.code = o;
312
+ class Ne extends E {
313
+ constructor(r, a) {
314
+ super(), this.type = r, this.code = a;
283
315
  }
284
316
  toDOM() {
285
317
  let r = document.createElement("span");
286
318
  r.setAttribute("aria-hidden", "true"), r.className = "wg-codeblock";
287
- let o = document.createElement("button");
288
- return o.className = "wg-codeblock-btn", o.innerHTML = we(), r.appendChild(o), r;
319
+ let a = document.createElement("button");
320
+ return a.className = "wg-codeblock-btn", a.innerHTML = ve(), r.appendChild(a), r;
289
321
  }
290
322
  ignoreEvent() {
291
323
  return !1;
292
324
  }
293
325
  }
294
- const M = [];
295
- function I(t, r) {
326
+ const T = [];
327
+ function W(t, r) {
296
328
  const {
297
- mode: o
329
+ mode: a
298
330
  /* type, mark */
299
- } = r, n = ["Document", "Blockquote", "ListItem", "BulletList", "OrderedList"], s = {
300
- FencedCode: P,
301
- CodeBlock: P
302
- }, g = {
303
- CodeMark: (a, c, i) => [h.mark({ class: "cb-mk" }).range(c, i)],
304
- CodeInfo: (a, c, i) => [h.mark({ class: "cb-mi" }).range(c, i)]
331
+ } = r, o = ["Document", "Blockquote", "ListItem", "BulletList", "OrderedList"], c = {
332
+ FencedCode: I,
333
+ CodeBlock: I
334
+ }, i = {
335
+ CodeMark: (n, s, g) => [h.mark({ class: "cb-mk" }).range(s, g)],
336
+ CodeInfo: (n, s, g) => [h.mark({ class: "cb-mi" }).range(s, g)]
305
337
  }, l = [];
306
- return E(t, {
307
- enter: ({ type: { name: a }, from: c, to: i }) => (o === "type" && a in s && l.push(...s[a](t, c, i)), o === "mark" && a in g && l.push(...g[a](t, c, i)), n.includes(a) || a in s ? (M.push({ name: a, from: c, to: i }), !0) : !1),
308
- Leave: ({ type: { name: a }, from: c, to: i }) => n.includes(a) || a in s ? (M.pop(), !0) : !1
338
+ return L(t, {
339
+ enter: ({ type: { name: n }, from: s, to: g }) => (a === "type" && n in c && l.push(...c[n](t, s, g)), a === "mark" && n in i && l.push(...i[n](t, s, g)), o.includes(n) || n in c ? (T.push({ name: n, from: s, to: g }), !0) : !1),
340
+ Leave: ({ type: { name: n }, from: s, to: g }) => o.includes(n) || n in c ? (T.pop(), !0) : !1
309
341
  }), {
310
342
  type: h.set(l, !0),
311
343
  mark: h.set(l, !0)
312
- }[o];
344
+ }[a];
313
345
  }
314
- const P = (t, r, o) => {
315
- const n = [], s = M[M.length - 1], g = ["BulletList", "OrderedList", "ListItem"].some((f) => f === s.name), l = ["Blockquote"].some((f) => f === s.name), a = t.state.doc.lineAt(r), c = r - a.from, i = c > 0, d = v(t, a.from, o);
316
- d || n.push(
317
- h.widget({ widget: new Be("view.state.sliceDoc(from, to)", "code"), side: 0 }).range(r + 1)
346
+ const I = (t, r, a) => {
347
+ const o = [], c = T[T.length - 1], i = ["BulletList", "OrderedList", "ListItem"].some((u) => u === c.name), l = ["Blockquote"].some((u) => u === c.name), n = t.state.doc.lineAt(r), s = r - n.from, g = s > 0, d = N(t, n.from, a);
348
+ d || o.push(
349
+ h.widget({ widget: new Ne("view.state.sliceDoc(from, to)", "code"), side: 0 }).range(r + 1)
318
350
  );
319
- const b = a.number, y = t.state.doc.sliceString(r, o).split(`
351
+ const b = n.number, k = t.state.doc.sliceString(r, a).split(`
320
352
  `).length;
321
- for (let f = b; f < y + b; f++) {
322
- const { from: u, to: F } = t.state.doc.line(f), w = "100% - 1.2ch", x = ["cb-content"];
323
- d && x.push("sw"), f === b && x.push("cb-start"), f === y + b - 1 && x.push("cb-end");
324
- const p = Math.max(u + c, 0);
325
- if (F < p)
326
- x.push("free"), n.push(
353
+ for (let u = b; u < k + b; u++) {
354
+ const { from: m, to: x } = t.state.doc.line(u), F = "100% - 1.2ch", y = ["cb-content"];
355
+ d && y.push("sw"), u === b && y.push("cb-start"), u === k + b - 1 && y.push("cb-end");
356
+ const p = Math.max(m + s, 0);
357
+ if (x < p)
358
+ y.push("free"), o.push(
327
359
  h.widget({
328
- widget: new W(
329
- x.join(" "),
330
- `calc(${w} - ${p - u}ch)`,
331
- `calc(${p - F}ch + 2px)`
360
+ widget: new R(
361
+ y.join(" "),
362
+ `calc(${F} - ${p - m}ch)`,
363
+ `calc(${p - x}ch + 2px)`
332
364
  ),
333
365
  side: 1
334
- }).range(F)
366
+ }).range(x)
335
367
  ), console.log("Hello World");
336
- else if (p === F)
337
- x.push("wg"), n.push(
368
+ else if (p === x)
369
+ y.push("wg"), o.push(
338
370
  h.widget({
339
- widget: new W(
340
- x.join(" "),
341
- `calc(${w} - ${p - u}ch)`
371
+ widget: new R(
372
+ y.join(" "),
373
+ `calc(${F} - ${p - m}ch)`
342
374
  ),
343
375
  side: 1
344
376
  }).range(p)
345
377
  );
346
- else if (g || l || i) {
347
- const N = { style: `width: calc(${w} - ${p - u}ch)` };
348
- F > p && n.push(h.mark({ class: x.join(" "), attributes: N }).range(p, F)), u !== p && g && n.push(h.mark({ class: "cb-listsp" }).range(u, p)), u !== p && i && n.push(h.mark({ class: "cb-spacer" }).range(u, p)), u !== p && l && n.push(h.mark({ class: "cb-quote bq" }).range(u, p));
349
- } else if (u !== F) {
350
- const N = { style: `width: calc(${w})` };
351
- n.push(h.mark({ class: x.join(" "), attributes: N }).range(u, F));
378
+ else if (i || l || g) {
379
+ const w = { style: `width: calc(${F} - ${p - m}ch)` };
380
+ x > p && o.push(h.mark({ class: y.join(" "), attributes: w }).range(p, x)), m !== p && i && o.push(h.mark({ class: "cb-listsp" }).range(m, p)), m !== p && g && o.push(h.mark({ class: "cb-spacer" }).range(m, p)), m !== p && l && o.push(h.mark({ class: "cb-quote bq" }).range(m, p));
381
+ } else if (m !== x) {
382
+ const w = { style: `width: calc(${F})` };
383
+ o.push(h.mark({ class: y.join(" "), attributes: w }).range(m, x));
352
384
  }
353
- n.push(h.line({ class: "cb-line" }).range(u));
385
+ o.push(h.line({ class: "cb-line" }).range(m));
354
386
  }
355
- return n;
356
- }, Ce = () => {
357
- const n = "4px", s = "1lh";
387
+ return o;
388
+ }, Le = () => {
389
+ const o = "4px", c = "1lh";
358
390
  return B.baseTheme({
359
- ".cb-start": { borderRadius: `${n} ${n} 0 0` },
360
- ".cb-end ": { borderRadius: `0 0 ${n} ${n}` },
361
- ".cb-start.cb-end": { borderRadius: `${n}` },
391
+ ".cb-start": { borderRadius: `${o} ${o} 0 0` },
392
+ ".cb-end ": { borderRadius: `0 0 ${o} ${o}` },
393
+ ".cb-start.cb-end": { borderRadius: `${o}` },
362
394
  ".cb-content": {
363
395
  display: "inline-block",
364
396
  marginLeft: "2px",
@@ -399,12 +431,12 @@ const P = (t, r, o) => {
399
431
  outline: "none",
400
432
  justifyContent: "center",
401
433
  alignItems: "center",
402
- height: `calc(${s} + 4px )`,
434
+ height: `calc(${c} + 4px )`,
403
435
  width: "5ch"
404
436
  },
405
437
  ".cb-icon": {
406
- width: s,
407
- height: s,
438
+ width: c,
439
+ height: c,
408
440
  pointerEvents: "none",
409
441
  fill: "currentColor",
410
442
  opacity: "0.7"
@@ -423,41 +455,41 @@ const P = (t, r, o) => {
423
455
  width: "5ch"
424
456
  }
425
457
  });
426
- }, _ = (t) => [
427
- C(I, { mode: "mark" }),
428
- C(I, { mode: "type" }, { eventHandlers: { mousedown: ye } }),
429
- Ce()
458
+ }, G = (t) => [
459
+ v(W, { mode: "mark" }),
460
+ v(W, { mode: "type" }, { eventHandlers: { mousedown: Fe } }),
461
+ Le()
430
462
  ];
431
- function Ne(t, r) {
432
- const o = ["Document"], n = {
433
- ATXHeading1: (l, a = !0) => h.line({ class: "h1 hg " + (a ? "sw" : "") }).range(l),
434
- ATXHeading2: (l, a = !0) => h.line({ class: "h2 hg " + (a ? "sw" : "") }).range(l),
435
- ATXHeading3: (l, a = !0) => h.line({ class: "h3 hg " + (a ? "sw" : "") }).range(l),
436
- ATXHeading4: (l, a = !0) => h.line({ class: "h4 hg " + (a ? "sw" : "") }).range(l),
437
- ATXHeading5: (l, a = !0) => h.line({ class: "h5 hg " + (a ? "sw" : "") }).range(l),
438
- ATXHeading6: (l, a = !0) => h.line({ class: "h6 hg " + (a ? "sw" : "") }).range(l)
439
- }, s = {
440
- HeaderMark: (l, a) => h.mark({ class: "mk" }).range(l, a)
441
- }, g = [];
442
- return E(t, {
443
- enter: ({ type: l, from: a, to: c }) => (l.name in n && g.push(n[l.name](a, v(t, a, c))), l.name in s && g.push(s[l.name](a, c + 1)), o.includes(l.name) || l.name in n)
444
- }), h.set(g, !1);
463
+ function Ee(t, r) {
464
+ const a = ["Document"], o = {
465
+ ATXHeading1: (l, n = !0) => h.line({ class: "h1 hg " + (n ? "sw" : "") }).range(l),
466
+ ATXHeading2: (l, n = !0) => h.line({ class: "h2 hg " + (n ? "sw" : "") }).range(l),
467
+ ATXHeading3: (l, n = !0) => h.line({ class: "h3 hg " + (n ? "sw" : "") }).range(l),
468
+ ATXHeading4: (l, n = !0) => h.line({ class: "h4 hg " + (n ? "sw" : "") }).range(l),
469
+ ATXHeading5: (l, n = !0) => h.line({ class: "h5 hg " + (n ? "sw" : "") }).range(l),
470
+ ATXHeading6: (l, n = !0) => h.line({ class: "h6 hg " + (n ? "sw" : "") }).range(l)
471
+ }, c = {
472
+ HeaderMark: (l, n) => h.mark({ class: "mk" }).range(l, n)
473
+ }, i = [];
474
+ return L(t, {
475
+ enter: ({ type: l, from: n, to: s }) => (l.name in o && i.push(o[l.name](n, N(t, n, s))), l.name in c && i.push(c[l.name](n, s + 1)), a.includes(l.name) || l.name in o)
476
+ }), h.set(i, !1);
445
477
  }
446
- const ve = B.baseTheme({
478
+ const qe = B.baseTheme({
447
479
  ".h1 ": { fontSize: "2.6rem" },
448
480
  ".h2 ": { fontSize: "2.0rem" },
449
481
  ".h3 ": { fontSize: "1.8rem" },
450
482
  ".h4 ": { fontSize: "1.6rem" },
451
483
  ".h5 ": { fontSize: "1.4rem" },
452
484
  ".h6 ": { fontSize: "1.2rem" }
453
- }), Ee = B.baseTheme({
485
+ }), Me = B.baseTheme({
454
486
  ".hg .mk": { fontSize: "0" },
455
487
  "&.cm-focused .hg.sw .mk": { fontSize: "inherit" }
456
- }), Y = (t = {}) => [
457
- C(Ne, {}),
458
- ve,
459
- Ee
460
- ], Ae = {
488
+ }), _ = (t = {}) => [
489
+ v(Ee, {}),
490
+ qe,
491
+ Me
492
+ ], Te = {
461
493
  version: "1.7.1",
462
494
  latte: {
463
495
  name: "Latte",
@@ -3251,14 +3283,14 @@ const ve = B.baseTheme({
3251
3283
  }
3252
3284
  }
3253
3285
  }
3254
- }, D = (t) => Object.entries(t), { version: sr, ...Te } = Ae, j = D(Te).reduce((t, [r, o]) => (t[r] = {
3255
- ...o,
3256
- colorEntries: D(o.colors),
3257
- ansiColorEntries: D(o.ansiColors)
3286
+ }, M = (t) => Object.entries(t), { version: wr, ...Ae } = Te, Y = M(Ae).reduce((t, [r, a]) => (t[r] = {
3287
+ ...a,
3288
+ colorEntries: M(a.colors),
3289
+ ansiColorEntries: M(a.ansiColors)
3258
3290
  }, t), {});
3259
- D(j);
3260
- const k = ({ variant: t, settings: r, styles: o }) => {
3261
- const n = K.theme({
3291
+ M(Y);
3292
+ const C = ({ variant: t, settings: r, styles: a }) => {
3293
+ const o = A.theme({
3262
3294
  // eslint-disable-next-line @typescript-eslint/naming-convention
3263
3295
  "&": {
3264
3296
  backgroundColor: r.background,
@@ -3285,10 +3317,10 @@ const k = ({ variant: t, settings: r, styles: o }) => {
3285
3317
  }
3286
3318
  }, {
3287
3319
  dark: t === "dark"
3288
- }), s = oe.define(o);
3289
- return [n, ne(s)];
3320
+ }), c = ne.define(a);
3321
+ return [o, le(c)];
3290
3322
  };
3291
- k({
3323
+ C({
3292
3324
  variant: "dark",
3293
3325
  settings: {
3294
3326
  background: "#200020",
@@ -3370,7 +3402,7 @@ k({
3370
3402
  }
3371
3403
  ]
3372
3404
  });
3373
- k({
3405
+ C({
3374
3406
  variant: "light",
3375
3407
  settings: {
3376
3408
  background: "#fcfcfc",
@@ -3444,7 +3476,7 @@ k({
3444
3476
  }
3445
3477
  ]
3446
3478
  });
3447
- k({
3479
+ C({
3448
3480
  variant: "dark",
3449
3481
  settings: {
3450
3482
  background: "#15191EFA",
@@ -3500,7 +3532,7 @@ k({
3500
3532
  }
3501
3533
  ]
3502
3534
  });
3503
- k({
3535
+ C({
3504
3536
  variant: "dark",
3505
3537
  settings: {
3506
3538
  background: "#2e241d",
@@ -3550,7 +3582,7 @@ k({
3550
3582
  }
3551
3583
  ]
3552
3584
  });
3553
- k({
3585
+ C({
3554
3586
  variant: "dark",
3555
3587
  settings: {
3556
3588
  background: "#3b2627",
@@ -3612,7 +3644,7 @@ k({
3612
3644
  }
3613
3645
  ]
3614
3646
  });
3615
- k({
3647
+ C({
3616
3648
  variant: "dark",
3617
3649
  settings: {
3618
3650
  background: "#000205",
@@ -3648,7 +3680,7 @@ k({
3648
3680
  }
3649
3681
  ]
3650
3682
  });
3651
- k({
3683
+ C({
3652
3684
  variant: "light",
3653
3685
  settings: {
3654
3686
  background: "#fff",
@@ -3690,7 +3722,7 @@ k({
3690
3722
  }
3691
3723
  ]
3692
3724
  });
3693
- k({
3725
+ C({
3694
3726
  variant: "dark",
3695
3727
  settings: {
3696
3728
  background: "#00254b",
@@ -3762,7 +3794,7 @@ k({
3762
3794
  }
3763
3795
  ]
3764
3796
  });
3765
- k({
3797
+ C({
3766
3798
  variant: "dark",
3767
3799
  settings: {
3768
3800
  background: "#060521",
@@ -3822,7 +3854,7 @@ k({
3822
3854
  }
3823
3855
  ]
3824
3856
  });
3825
- k({
3857
+ C({
3826
3858
  variant: "dark",
3827
3859
  settings: {
3828
3860
  background: "#2d2f3f",
@@ -3869,7 +3901,7 @@ k({
3869
3901
  }
3870
3902
  ]
3871
3903
  });
3872
- k({
3904
+ C({
3873
3905
  variant: "light",
3874
3906
  settings: {
3875
3907
  background: "#FFFFFF",
@@ -3909,7 +3941,7 @@ k({
3909
3941
  }
3910
3942
  ]
3911
3943
  });
3912
- k({
3944
+ C({
3913
3945
  variant: "light",
3914
3946
  settings: {
3915
3947
  background: "#f2f1f8",
@@ -3984,7 +4016,7 @@ k({
3984
4016
  }
3985
4017
  ]
3986
4018
  });
3987
- k({
4019
+ C({
3988
4020
  variant: "light",
3989
4021
  settings: {
3990
4022
  background: "#faf4ed",
@@ -4038,7 +4070,7 @@ k({
4038
4070
  }
4039
4071
  ]
4040
4072
  });
4041
- k({
4073
+ C({
4042
4074
  variant: "light",
4043
4075
  settings: {
4044
4076
  background: "#FFFFFF",
@@ -4116,7 +4148,7 @@ k({
4116
4148
  }
4117
4149
  ]
4118
4150
  });
4119
- k({
4151
+ C({
4120
4152
  variant: "light",
4121
4153
  settings: {
4122
4154
  background: "#fef7e5",
@@ -4188,7 +4220,7 @@ k({
4188
4220
  }
4189
4221
  ]
4190
4222
  });
4191
- k({
4223
+ C({
4192
4224
  variant: "light",
4193
4225
  settings: {
4194
4226
  background: "#FFFFFF",
@@ -4238,19 +4270,19 @@ k({
4238
4270
  }
4239
4271
  ]
4240
4272
  });
4241
- const Le = new le(), De = (t = "latte") => {
4242
- const r = j[t].colors, o = r.base, n = t === "latte" ? "#484b64" : r.text.hex, s = Me(r.crust.rgb, o.rgb, 0.1);
4243
- return [
4244
- k({
4273
+ const De = new ce(), Se = (t = "latte") => {
4274
+ const r = Y[t].colors, a = r.base, o = t === "latte" ? "#484b64" : r.text.hex, c = He(r.crust.rgb, a.rgb, 0.1);
4275
+ return document.querySelector(":root").style.setProperty("--editor-background", a.hex), [
4276
+ C({
4245
4277
  variant: t === "latte" ? "light" : "dark",
4246
4278
  settings: {
4247
- background: o.hex,
4248
- foreground: n,
4279
+ background: a.hex,
4280
+ foreground: o,
4249
4281
  caret: r.rosewater.hex,
4250
4282
  // selection: selection,
4251
- lineHighlight: q(r.overlay1.rgb, 0.1),
4252
- gutterBackground: o.hex,
4253
- gutterForeground: n
4283
+ lineHighlight: H(r.overlay1.rgb, 0.1),
4284
+ gutterBackground: a.hex,
4285
+ gutterForeground: o
4254
4286
  },
4255
4287
  styles: [
4256
4288
  // python
@@ -4293,7 +4325,7 @@ const Le = new le(), De = (t = "latte") => {
4293
4325
  // no necesary good
4294
4326
  { tag: e.labelName, color: r.teal.hex },
4295
4327
  // no necesary good
4296
- { tag: e.variableName, color: n },
4328
+ { tag: e.variableName, color: o },
4297
4329
  // no necesary good
4298
4330
  { tag: e.operator, color: r.sky.hex },
4299
4331
  { tag: e.logicOperator, color: r.sky.hex },
@@ -4321,88 +4353,134 @@ const Le = new le(), De = (t = "latte") => {
4321
4353
  { tag: e.macroName, color: r.peach.hex }
4322
4354
  ]
4323
4355
  }),
4324
- K.theme({
4356
+ A.theme({
4325
4357
  // Editor
4326
- "& .cm-selectionBackground, ::selection": { background: `${q(r.overlay2.rgb, 0.3)} !important` },
4358
+ "& .cm-selectionBackground, ::selection": { background: `${H(r.overlay2.rgb, 0.3)} !important` },
4327
4359
  // Code
4328
- "& .cb-content, & .ic": { backgroundColor: s },
4329
- ".cb-icon": { fill: n },
4330
- ".wg-codeblock-btn:hover": { backgroundColor: q(r.overlay1.rgb, 0.2) },
4360
+ "& .cb-content, & .ic": { backgroundColor: c },
4361
+ ".cb-icon": { fill: o },
4362
+ ".wg-codeblock-btn:hover": { backgroundColor: H(r.overlay1.rgb, 0.2) },
4331
4363
  // Blockquote
4332
- ".bq-none-mark": { "--bq-none-mark": n },
4364
+ ".bq-none-mark": { "--bq-none-mark": o },
4333
4365
  ".bq-note-mark": { "--bq-note-mark": r.blue.hex },
4334
4366
  ".bq-tip-mark": { "--bq-tip-mark": r.green.hex },
4335
4367
  ".bq-warning-mark": { "--bq-warning-mark": r.peach.hex },
4336
4368
  ".bq-important-mark": { "--bq-important-mark": r.mauve.hex },
4337
4369
  ".bq-caution-mark": { "--bq-caution-mark": r.red.hex },
4370
+ ".wg-qt-icon": {
4371
+ "--bq-none-mark": o,
4372
+ "--bq-note-mark": r.blue.hex,
4373
+ "--bq-tip-mark": r.green.hex,
4374
+ "--bq-warning-mark": r.peach.hex,
4375
+ "--bq-important-mark": r.mauve.hex,
4376
+ "--bq-caution-mark": r.red.hex
4377
+ },
4338
4378
  // Links
4339
4379
  "& a.url": { color: r.blue.hex },
4340
- "& a.url:visited": { color: r.mauve.hex }
4380
+ "& a.url:visited": { color: r.mauve.hex },
4381
+ // Html
4382
+ "& .cm-rendered-tag": {
4383
+ border: `1px solid ${r.surface2.hex}`,
4384
+ borderRadius: "4px",
4385
+ fontSize: ".8em",
4386
+ padding: "0px 3px",
4387
+ background: r.surface0.hex
4388
+ }
4341
4389
  }, { dark: t !== "latte" })
4342
4390
  ];
4343
- }, Me = (t, r, o) => {
4344
- const n = [t.r, t.g, t.b], s = [r.r, r.g, r.b];
4345
- return `rgba(${ge(n, s, o, 0.3).join(", ")})`;
4346
- }, q = (t, r) => `rgba(${t.r}, ${t.g}, ${t.b}, ${r})`;
4347
- function Se(t, r) {
4348
- const o = ["Document", "ListItem", "BulletList", "OrderedList"], n = {
4391
+ }, He = (t, r, a) => {
4392
+ const o = [t.r, t.g, t.b], c = [r.r, r.g, r.b];
4393
+ return `rgba(${de(o, c, a, 0.3).join(", ")})`;
4394
+ }, H = (t, r) => `rgba(${t.r}, ${t.g}, ${t.b}, ${r})`, $e = (t) => `<svg class="qt-icon qt-caution" width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
4395
+ <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"/>
4396
+ </svg>`, Oe = (t) => `<svg class="qt-icon qt-warning" width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
4397
+ <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"/>
4398
+ </svg>`, Re = (t) => `<svg class="qt-icon qt-important" width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
4399
+ <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"/>
4400
+ </svg>`, We = (t) => `<svg class="qt-icon qt-note" width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
4401
+ <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"/>
4402
+ </svg>`, Ie = (t) => `<svg class="qt-icon qt-tip" width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
4403
+ <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"/>
4404
+ </svg>`, P = { tip: Ie, note: We, important: Re, warning: Oe, caution: $e, none: () => "" };
4405
+ class Pe extends E {
4406
+ constructor(r) {
4407
+ super(), this.type = r;
4408
+ }
4409
+ toDOM() {
4410
+ let r = document.createElement("span");
4411
+ return r.setAttribute("aria-hidden", "true"), r.className = "wg-qt-icon", r.innerHTML = this.type in P ? P[this.type]() : "", r;
4412
+ }
4413
+ ignoreEvent() {
4414
+ return !1;
4415
+ }
4416
+ eq(r) {
4417
+ return this.type === r.type;
4418
+ }
4419
+ }
4420
+ function Ze(t, r) {
4421
+ const a = ["Document", "ListItem", "BulletList", "OrderedList"], o = {
4349
4422
  none: "bq-none-mark",
4350
4423
  note: "bq-note-mark",
4351
4424
  tip: "bq-tip-mark",
4352
4425
  warning: "bq-warning-mark",
4353
4426
  important: "bq-important-mark",
4354
4427
  caution: "bq-caution-mark"
4355
- }, s = {
4356
- QuoteMark: (a, c, i) => {
4428
+ }, c = {
4429
+ QuoteMark: (n, s, g) => {
4357
4430
  const d = ["qt-mk"];
4358
- return i in n ? d.push(n[i]) : d.push(n.none), h.mark({
4431
+ return g in o ? d.push(o[g]) : d.push(o.none), h.mark({
4359
4432
  class: d.join(" ")
4360
- }).range(a, c);
4361
- },
4362
- BlockquoteLine: (a, c) => h.line({ class: "bq-line " + (c ? "sw" : "") }).range(a),
4363
- quoteLine: (a, c, i) => {
4364
- const d = `calc(100% - ${Math.max(0, i) + 1.2}ch)`;
4433
+ }).range(n, s);
4434
+ },
4435
+ QuoteType: (n, s, g) => h.widget({
4436
+ widget: new Pe(g),
4437
+ side: 1
4438
+ }).range(n),
4439
+ BlockquoteLine: (n, s) => h.line({ class: "bq-line " + (s ? "sw" : "") }).range(n),
4440
+ quoteLine: (n, s, g) => {
4441
+ const d = `calc(100% - ${Math.max(0, g) + 1.2}ch)`;
4365
4442
  return h.mark({
4366
4443
  class: "bq-text-line",
4367
4444
  attributes: { style: `width: ${d}` }
4368
- }).range(a, c);
4445
+ }).range(n, s);
4369
4446
  }
4370
- }, g = (a, c, i, d) => {
4371
- const b = [], { from: y, to: f } = c, u = i.number, F = (w, x) => {
4447
+ }, i = (n, s, g, d) => {
4448
+ const b = [], k = g.number, u = (m, x) => {
4449
+ let F = 0;
4450
+ const y = [];
4372
4451
  let p = 0;
4373
- const N = [];
4374
- let T = 0;
4375
4452
  return {
4376
- enter({ name: A, node: $, from: O, to: R }) {
4377
- A === "Blockquote" && N.push(qe(a, $)), A === "QuoteMark" && (b.push(s[A](O, R, N[p])), T = R, p++);
4453
+ enter({ name: w, node: O, from: D, to: S }) {
4454
+ w === "Blockquote" && y.push(ze(n, O)), w === "QuoteMark" && (b.push(c[w](D, S, y[F])), p = S, F++), w === "QuoteType" && b.push(c[w](D, S, y[F - 1]));
4378
4455
  },
4379
- leave({ name: A, from: $, to: O }) {
4380
- A === "Paragraph" && T < x && b.push(s.quoteLine(T, x, T - w));
4456
+ leave({ name: w, from: O, to: D }) {
4457
+ w === "Paragraph" && p < x && b.push(c.quoteLine(p, x, p - m));
4381
4458
  }
4382
4459
  };
4383
4460
  };
4384
- for (let w = u; w < d + u; w++) {
4385
- const { from: x, to: p } = a.state.doc.line(w), { from: N, to: T } = c, A = v(a, N, T);
4386
- b.push(s.BlockquoteLine(x, A)), H(a.state).iterate({ from: x, to: p, ...F(x, p) });
4461
+ for (let m = k; m < d + k; m++) {
4462
+ const { from: x, to: F } = n.state.doc.line(m), { from: y, to: p } = s, w = N(n, y, p);
4463
+ b.push(c.BlockquoteLine(x, w)), $(n.state).iterate({ from: x, to: F, ...u(x, F) });
4387
4464
  }
4388
4465
  return b;
4389
4466
  }, l = [];
4390
- return E(t, {
4391
- enter: ({ name: a }) => !(a in o),
4392
- leave: ({ name: a, from: c, to: i, node: d }) => {
4393
- if (a !== "Blockquote") return;
4394
- const b = t.state.sliceDoc(c, i).split(`
4395
- `), y = t.state.doc.lineAt(c);
4396
- l.push(...g(t, d, y, b.length));
4467
+ return L(t, {
4468
+ enter: ({ name: n, from: s, to: g, node: d }) => {
4469
+ if (n === "Blockquote") {
4470
+ const b = t.state.sliceDoc(s, g).split(`
4471
+ `), k = t.state.doc.lineAt(s);
4472
+ l.push(...i(t, d, k, b.length));
4473
+ }
4474
+ return a.includes(n);
4397
4475
  }
4398
4476
  }), h.set(l, !0);
4399
4477
  }
4400
- const qe = (t, r) => {
4401
- const o = r.getChild("QuoteType");
4402
- if (!o) return "none";
4403
- const n = o.getChild("QuoteTypeText");
4404
- return n ? t.state.sliceDoc(n.from, n.to).toLowerCase() : "none";
4405
- }, He = () => B.baseTheme({
4478
+ const ze = (t, r) => {
4479
+ const a = r.getChild("QuoteType");
4480
+ if (!a) return "none";
4481
+ const o = a.getChild("QuoteTypeText");
4482
+ return o ? t.state.sliceDoc(o.from, o.to).toLowerCase() : "none";
4483
+ }, Qe = () => B.baseTheme({
4406
4484
  "& .qt-mk": {
4407
4485
  // outline: "1px red solid",
4408
4486
  position: "relative",
@@ -4419,6 +4497,9 @@ const qe = (t, r) => {
4419
4497
  height: "200vh",
4420
4498
  zIndex: "-1"
4421
4499
  },
4500
+ "&.cm-focused .bq-line.sw .qt-mk::after": {
4501
+ opacity: 0.3
4502
+ },
4422
4503
  "& .bq-line": { lineHeight: "1.2lh", overflowY: "hidden" },
4423
4504
  "&.cm-focused .bq-line.sw .bq-none-mark, .bq-none-mark::after": { color: "var(--bq-none-mark)" },
4424
4505
  "&.cm-focused .bq-line.sw .bq-note-mark, .bq-note-mark::after": { color: "var(--bq-note-mark)" },
@@ -4428,118 +4509,132 @@ const qe = (t, r) => {
4428
4509
  "&.cm-focused .bq-line.sw .bq-caution-mark, .bq-caution-mark::after": { color: "var(--bq-caution-mark)" },
4429
4510
  "& .bq-text-line": {
4430
4511
  lineHeight: "1lh",
4431
- // backgroundColor: "rgba(0, 0, 0, 0.1)",
4432
4512
  display: "inline-block",
4433
- // maxWidth: "95%",
4434
4513
  paddingLeft: "6px",
4435
4514
  textIndent: "-7px",
4436
4515
  ariaHidden: "true"
4437
- }
4438
- }), $e = (t) => [
4439
- C(Se, t),
4440
- He()
4441
- ], Oe = {
4516
+ },
4517
+ "& .bq-text-line *": {
4518
+ verticalAlign: "middle"
4519
+ },
4520
+ "& .wg-qt-icon": {
4521
+ display: "inline-block"
4522
+ },
4523
+ "& .wg-qt-icon > .qt-icon": {
4524
+ paddingLeft: "1ch",
4525
+ width: "2em",
4526
+ height: "2em"
4527
+ },
4528
+ "& .wg-qt-icon > .qt-tip": { fill: "var(--bq-tip-mark)" },
4529
+ "& .wg-qt-icon > .qt-note": { fill: "var(--bq-note-mark)" },
4530
+ "& .wg-qt-icon > .qt-important": { fill: "var(--bq-important-mark)" },
4531
+ "& .wg-qt-icon > .qt-warning": { fill: "var(--bq-warning-mark)" },
4532
+ "& .wg-qt-icon > .qt-caution": { fill: "var(--bq-caution-mark)" }
4533
+ }), Ke = (t) => [
4534
+ v(Ze, t),
4535
+ Qe()
4536
+ ], Ge = {
4442
4537
  name: "QuoteTypeParser",
4443
4538
  parse(t, r) {
4444
4539
  if ((() => {
4445
- for (let n = 0; n < t.depth; n++)
4446
- if (t.parentType(n).name === "Blockquote") return !0;
4540
+ for (let o = 0; o < t.depth; o++)
4541
+ if (t.parentType(o).name === "Blockquote") return !0;
4447
4542
  return !1;
4448
4543
  })()) {
4449
- const n = r.text.match(/^(\s*>\s*)+(\[!\w+\])\s*$/);
4450
- if (n && n[2]) {
4451
- const s = n[2], g = r.text.indexOf(s), l = g + s.length, a = t.elt("QuoteType", t.lineStart + g, t.lineStart + l);
4452
- a.children = [
4453
- t.elt("QuoteTypeMark", t.lineStart + g, t.lineStart + g + 2),
4454
- t.elt("QuoteTypeText", t.lineStart + g + 2, t.lineStart + l - 1),
4544
+ const o = r.text.match(/^(\s*>\s*)+(\[!\w+\])\s*$/);
4545
+ if (o && o[2]) {
4546
+ const c = o[2], i = r.text.indexOf(c), l = i + c.length, n = t.elt("QuoteType", t.lineStart + i, t.lineStart + l);
4547
+ n.children = [
4548
+ t.elt("QuoteTypeMark", t.lineStart + i, t.lineStart + i + 2),
4549
+ t.elt("QuoteTypeText", t.lineStart + i + 2, t.lineStart + l - 1),
4455
4550
  t.elt("QuoteTypeMark", t.lineStart + l - 1, t.lineStart + l)
4456
- ], t.addElement(a);
4551
+ ], t.addElement(n);
4457
4552
  }
4458
4553
  }
4459
4554
  return !1;
4460
4555
  }
4461
- }, Re = {
4556
+ }, _e = {
4462
4557
  defineNodes: [
4463
4558
  { name: "QuoteType", style: { "QuoteType/...": e.content } },
4464
4559
  { name: "QuoteTypeMark", style: e.processingInstruction },
4465
4560
  { name: "QuoteTypeText", style: e.bool }
4466
4561
  ],
4467
- parseBlock: [Oe]
4468
- }, U = (t, r, o) => {
4469
- const n = t.state.sliceDoc(r, o), s = n.match(/\[(.*)\]/);
4470
- return s !== null && s.length > 1 ? {
4471
- text: s[1],
4472
- from: r + n.indexOf(s[1]),
4473
- to: r + 1 + s[1].length
4562
+ parseBlock: [Ge]
4563
+ }, j = (t, r, a) => {
4564
+ const o = t.state.sliceDoc(r, a), c = o.match(/\[(.*)\]/);
4565
+ return c !== null && c.length > 1 ? {
4566
+ text: c[1],
4567
+ from: r + o.indexOf(c[1]),
4568
+ to: r + 1 + c[1].length
4474
4569
  } : { text: null };
4475
4570
  };
4476
- function We(t, r) {
4477
- const o = ["FencedCode", "Image", "Link"], n = {
4571
+ function Ye(t, r) {
4572
+ const a = ["FencedCode", "Image", "Link"], o = {
4478
4573
  Link: {
4479
4574
  marks: ["LinkMark"],
4480
4575
  url: "URL"
4481
4576
  }
4482
- }, s = {
4483
- Link: (l, a, c) => h.mark({ class: "link " + (c ? "sw" : "") }).range(l, a),
4484
- LinkMark: (l, a) => h.mark({ class: "lk-mk" }).range(l, a),
4485
- TextDec: (l, a, c) => h.mark({
4577
+ }, c = {
4578
+ Link: (l, n, s) => h.mark({ class: "link " + (s ? "sw" : "") }).range(l, n),
4579
+ LinkMark: (l, n) => h.mark({ class: "lk-mk" }).range(l, n),
4580
+ TextDec: (l, n, s) => h.mark({
4486
4581
  class: "lk-text url",
4487
4582
  tagName: "a",
4488
- attributes: { href: c, target: "_blank" }
4489
- }).range(l, a),
4490
- URL: (l, a, c) => h.mark({
4583
+ attributes: { href: s, target: "_blank" }
4584
+ }).range(l, n),
4585
+ URL: (l, n, s) => h.mark({
4491
4586
  class: "lk-url url",
4492
4587
  tagName: "a",
4493
- attributes: { href: c, target: "_blank" }
4494
- }).range(l, a)
4495
- }, g = [];
4496
- return E(t, {
4497
- enter: ({ type: { name: l }, from: a, to: c, node: i }) => {
4498
- if (l === "URL" && g.push(s.URL(a, c, t.state.sliceDoc(a, c))), !(l in n)) return !o.includes(l);
4499
- g.push(s.Link(a, c, v(t, a, c)));
4500
- const d = n[l].marks.flatMap((f) => i.getChildren(f));
4501
- g.push(...d.map(({ from: f, to: u }) => s.LinkMark(f, u)));
4502
- const b = i.getChild(n[l].url);
4503
- let y = null;
4588
+ attributes: { href: s, target: "_blank" }
4589
+ }).range(l, n)
4590
+ }, i = [];
4591
+ return L(t, {
4592
+ enter: ({ type: { name: l }, from: n, to: s, node: g }) => {
4593
+ if (l === "URL" && i.push(c.URL(n, s, t.state.sliceDoc(n, s))), !(l in o)) return !a.includes(l);
4594
+ i.push(c.Link(n, s, N(t, n, s)));
4595
+ const d = o[l].marks.flatMap((u) => g.getChildren(u));
4596
+ i.push(...d.map(({ from: u, to: m }) => c.LinkMark(u, m)));
4597
+ const b = g.getChild(o[l].url);
4598
+ let k = null;
4504
4599
  if (b !== null) {
4505
- const { from: f, to: u } = b;
4506
- y = t.state.sliceDoc(f, u), g.push(s.URL(f, u, y));
4600
+ const { from: u, to: m } = b;
4601
+ k = t.state.sliceDoc(u, m), i.push(c.URL(u, m, k));
4507
4602
  }
4508
- if (i.getChild("Image") === null) {
4509
- const { text: f, from: u, to: F } = U(t, a, c);
4510
- f !== null && y !== null && g.push(s.TextDec(u, F, y));
4603
+ if (g.getChild("Image") === null) {
4604
+ const { text: u, from: m, to: x } = j(t, n, s);
4605
+ u !== null && k !== null && i.push(c.TextDec(m, x, k));
4511
4606
  }
4512
4607
  return !1;
4513
4608
  }
4514
- }), h.set(g, !0);
4609
+ }), h.set(i, !0);
4515
4610
  }
4516
- const Ie = (t, r) => t.ctrlKey ? Pe(
4611
+ const je = (t, r) => t.ctrlKey ? Ve(
4517
4612
  t.target
4518
4613
  /* as HTMLElement */
4519
- ) : !1, Pe = (t) => {
4614
+ ) : !1, Ve = (t) => {
4520
4615
  if (t.nodeName === "A" && t.href && t.classList.contains("url"))
4521
4616
  return window.open(t.href, t.target), !0;
4522
- }, Ke = B.baseTheme({
4617
+ }, Ue = B.baseTheme({
4523
4618
  ".lk-mk, .link > .lk-url": { display: "none" },
4524
4619
  "&.cm-focused .link.sw .lk-mk, &.cm-focused .link.sw .lk-url": { display: "inherit" }
4525
- }), Qe = (t = {}) => {
4620
+ }), Xe = (t = {}) => {
4526
4621
  const {
4527
4622
  hideMarks: r = !0
4528
4623
  } = t;
4529
4624
  return [
4530
- C(We, {}, { eventHandlers: { mousedown: Ie } }),
4531
- Ke
4625
+ v(Ye, {}, { eventHandlers: { mousedown: je } }),
4626
+ Ue
4532
4627
  ];
4533
4628
  };
4534
- class ze extends S {
4535
- constructor(r, o = null, n = "[image]") {
4536
- super(), this.img = r, this.url = o, this.alt = n;
4629
+ class Je extends E {
4630
+ constructor(r, a = null, o = "[image]") {
4631
+ super(), this.img = r, this.url = a, this.alt = o;
4537
4632
  }
4538
4633
  toDOM() {
4539
4634
  let r = document.createElement("img");
4540
4635
  if (r.src = this.img, r.alt = this.alt, r.style.minWidth = "100px", this.url) {
4541
- let o = document.createElement("a");
4542
- return o.href = this.url, o.target = "_blank", o.classList.add("url"), o.appendChild(r), o;
4636
+ let a = document.createElement("a");
4637
+ return a.href = this.url, a.target = "_blank", a.classList.add("url"), a.appendChild(r), a;
4543
4638
  } else
4544
4639
  return r;
4545
4640
  }
@@ -4550,90 +4645,173 @@ class ze extends S {
4550
4645
  return !1;
4551
4646
  }
4552
4647
  }
4553
- function Ge(t, r) {
4554
- const o = ["FencedCode", "Image"], n = [];
4555
- return E(t, {
4556
- enter: ({ type: { name: s }, from: g, to: l, node: a }) => {
4557
- if (s === "Image" && !v(t, g, l)) {
4558
- const { from: c, to: i } = a.getChild("URL"), d = t.state.sliceDoc(c, i), { text: b } = U(t, g, l);
4559
- n.push(
4648
+ function er(t, r) {
4649
+ const a = ["FencedCode", "Image"], o = [];
4650
+ return L(t, {
4651
+ enter: ({ type: { name: c }, from: i, to: l, node: n }) => {
4652
+ if (c === "Image" && !N(t, i, l)) {
4653
+ const { from: s, to: g } = n.getChild("URL"), d = t.state.sliceDoc(s, g), { text: b } = j(t, i, l);
4654
+ o.push(
4560
4655
  h.replace({
4561
- widget: new ze(d, _e(t, a), b)
4562
- }).range(g, l)
4656
+ widget: new Je(d, rr(t, n), b)
4657
+ }).range(i, l)
4563
4658
  );
4564
4659
  }
4565
- return !o.includes(s);
4660
+ return !a.includes(c);
4566
4661
  }
4567
- }), h.set(n, !1);
4662
+ }), h.set(o, !1);
4568
4663
  }
4569
- const _e = (t, r) => {
4570
- const n = r.parent.getChild("URL");
4571
- if (n !== null) {
4572
- const { from: s, to: g } = n;
4573
- return t.state.sliceDoc(s, g);
4664
+ const rr = (t, r) => {
4665
+ const o = r.parent.getChild("URL");
4666
+ if (o !== null) {
4667
+ const { from: c, to: i } = o;
4668
+ return t.state.sliceDoc(c, i);
4574
4669
  }
4575
4670
  return null;
4576
- }, Ye = (t, r) => t.ctrlKey ? je(
4671
+ }, tr = (t, r) => t.ctrlKey ? ar(
4577
4672
  t.target
4578
4673
  /* as HTMLElement */
4579
- ) : !1, je = (t) => {
4674
+ ) : !1, ar = (t) => {
4580
4675
  const r = t.parentElement ?? !1;
4581
4676
  if (t.nodeName === "IMG" && r && r.nodeName === "A" && r.classList.contains("url"))
4582
4677
  return !0;
4583
- }, Ue = B.baseTheme({}), Ve = (t = {}) => {
4678
+ }, or = B.baseTheme({}), nr = (t = {}) => {
4584
4679
  const {
4585
4680
  hideMarks: r = !0
4586
4681
  } = t;
4587
4682
  return [
4588
- C(Ge, {}, { eventHandlers: { mousedown: Ye } }),
4589
- Ue
4683
+ v(er, {}, { eventHandlers: { mousedown: tr } }),
4684
+ or
4590
4685
  ];
4591
- }, Xe = (t = { markdown: {} }) => {
4686
+ };
4687
+ class Z extends E {
4688
+ constructor(r, a = !1) {
4689
+ super(), this.content = r, this.tag = a;
4690
+ }
4691
+ toDOM() {
4692
+ const r = document.createElement("div");
4693
+ r.className = "cm-html-widget", r.setAttribute("aria-hidden", "true");
4694
+ const a = this.content.replace(/^```html\n?/, "").replace(/```$/, "").trim();
4695
+ return r.innerHTML = (this.tag ? '<span class="cm-rendered-tag">RTAG</span>' : "") + a, r.querySelectorAll("script").forEach((o) => {
4696
+ o.parentNode.removeChild(o);
4697
+ }), r;
4698
+ }
4699
+ ignoreEvent(r) {
4700
+ return r.type === "click";
4701
+ }
4702
+ eq(r) {
4703
+ return r.content === this.content;
4704
+ }
4705
+ }
4706
+ const V = se.define(), lr = ie.define({
4707
+ create(t) {
4708
+ return h.none;
4709
+ },
4710
+ update(t, r) {
4711
+ t = t.map(r.changes);
4712
+ for (let a of r.effects)
4713
+ if (a.is(V))
4714
+ return a.value;
4715
+ return t;
4716
+ },
4717
+ provide: (t) => A.decorations.from(t)
4718
+ });
4719
+ function cr(t) {
4720
+ const r = [
4721
+ /<br>/,
4722
+ /<img .*\/>/
4723
+ ], a = {
4724
+ HTMLBlock: (c, i) => {
4725
+ const l = t.state.doc.sliceString(c, i);
4726
+ return [h.replace({
4727
+ widget: new Z(l),
4728
+ inclusive: !1
4729
+ }).range(c, i)];
4730
+ },
4731
+ HTMLTag: (c, i) => {
4732
+ const l = t.state.doc.sliceString(c, i);
4733
+ return console.log(l), r.some((n) => n.test(l)) ? (console.log(l), [
4734
+ h.replace({
4735
+ widget: new Z(l, !0),
4736
+ inclusive: !1
4737
+ }).range(c, i)
4738
+ ]) : [];
4739
+ }
4740
+ }, o = [];
4741
+ return L(t, {
4742
+ enter: ({ type: c, from: i, to: l, node: n }) => {
4743
+ c.name in a && (!N(t, i, l) || !t.hasFocus) && o.push(...a[c.name](i, l));
4744
+ }
4745
+ }), h.set(o);
4746
+ }
4747
+ const sr = B.baseTheme({
4748
+ "& .cm-html-widget": {
4749
+ all: "unset"
4750
+ // outline: "red solid 2px",
4751
+ },
4752
+ "& .cm-html-widget > *": {
4753
+ paddingTop: "0",
4754
+ paddingBottom: "0",
4755
+ marginBottom: "0",
4756
+ marginTop: "0"
4757
+ },
4758
+ "& .cm-widgetBuffer": { display: "none" }
4759
+ }), ir = A.updateListener.of((t) => {
4760
+ if (t.selectionSet || t.docChanged || t.focusChanged || t.geometryChanged) {
4761
+ const r = cr(t.view);
4762
+ t.view.dispatch({ effects: V.of(r) });
4763
+ }
4764
+ }), gr = (t = {}) => [
4765
+ lr,
4766
+ ir,
4767
+ sr
4768
+ ], hr = (t = { markdown: {} }) => {
4592
4769
  const {
4593
4770
  markdown: {
4594
4771
  defaultCodeLanguage: r,
4595
- codeLanguages: o,
4596
- addKeymap: n,
4597
- base: s,
4598
- completeHTMLTags: g,
4772
+ codeLanguages: a,
4773
+ addKeymap: o,
4774
+ base: c,
4775
+ completeHTMLTags: i,
4599
4776
  htmlTagLanguage: l,
4600
- extensions: a = []
4777
+ extensions: n = []
4601
4778
  },
4602
- inline: c,
4603
- Heading: i,
4779
+ inline: s,
4780
+ Heading: g,
4604
4781
  Hr: d,
4605
4782
  List: b,
4606
- Code: y
4607
- } = t, f = {
4783
+ Code: k
4784
+ } = t, u = {
4608
4785
  defaultCodeLanguage: r,
4609
- codeLanguages: o || Z,
4610
- addKeymap: n,
4611
- base: s,
4612
- completeHTMLTags: g,
4786
+ codeLanguages: a || J,
4787
+ addKeymap: o,
4788
+ base: c,
4789
+ completeHTMLTags: i,
4613
4790
  htmlTagLanguage: l,
4614
- extensions: [...a, ee, se, Re]
4791
+ extensions: [...n, re, he, _e]
4615
4792
  };
4616
4793
  return [
4617
- J(f),
4618
- Le.of(De()),
4619
- z(c),
4620
- Y(i),
4621
- G(b),
4622
- Q(d),
4623
- _(),
4624
- Qe(),
4625
- Ve(),
4626
- $e()
4794
+ ee(u),
4795
+ De.of(Se()),
4796
+ Q(s),
4797
+ _(g),
4798
+ K(b),
4799
+ z(d),
4800
+ G(),
4801
+ Xe(),
4802
+ nr(),
4803
+ Ke(),
4804
+ gr()
4627
4805
  ];
4628
4806
  };
4629
- typeof window < "u" && (window.gnosis = Xe, window.HrPlugin = Q, window.ListPlugin = G, window.CodePlugin = _, window.InlinePlugin = z, window.HeadingPlugin = Y);
4807
+ typeof window < "u" && (window.gnosis = hr, window.HrPlugin = z, window.ListPlugin = K, window.CodePlugin = G, window.InlinePlugin = Q, window.HeadingPlugin = _);
4630
4808
  export {
4631
- _ as CodePlugin,
4632
- Y as HeadingPlugin,
4633
- Q as HrPlugin,
4634
- z as InlinePlugin,
4635
- G as ListPlugin,
4636
- De as catppuccin,
4637
- Xe as gnosis,
4638
- Le as themeVariant
4809
+ G as CodePlugin,
4810
+ _ as HeadingPlugin,
4811
+ z as HrPlugin,
4812
+ Q as InlinePlugin,
4813
+ K as ListPlugin,
4814
+ Se as catppuccin,
4815
+ hr as gnosis,
4816
+ De as themeVariant
4639
4817
  };