@milkdown/crepe 7.3.3

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.
Files changed (241) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -0
  3. package/lib/apl-p0IPP13W.js +76 -0
  4. package/lib/asciiarmor-lJsBxlJJ.js +34 -0
  5. package/lib/asn1-Q9v1zIy5.js +102 -0
  6. package/lib/asterisk-foNkeTjy.js +273 -0
  7. package/lib/brainfuck-0XqyXpNS.js +35 -0
  8. package/lib/clike-ak6Z6Yhe.js +639 -0
  9. package/lib/clojure-iYO8U8Sg.js +810 -0
  10. package/lib/clsx-7d8NmkQq.js +21 -0
  11. package/lib/cmake-SVzjkxV_.js +28 -0
  12. package/lib/cobol-APHEnAOX.js +74 -0
  13. package/lib/coffeescript-KqQa0SYG.js +182 -0
  14. package/lib/commonlisp-bwqNqR5V.js +79 -0
  15. package/lib/core/crepe.d.ts +21 -0
  16. package/lib/core/crepe.d.ts.map +1 -0
  17. package/lib/core/index.d.ts +3 -0
  18. package/lib/core/index.d.ts.map +1 -0
  19. package/lib/core/slice.d.ts +12 -0
  20. package/lib/core/slice.d.ts.map +1 -0
  21. package/lib/crystal-BViWuDpA.js +217 -0
  22. package/lib/css-KHXHXfXg.js +1572 -0
  23. package/lib/cypher-XpTt4zQ3.js +69 -0
  24. package/lib/d-fLig6yqY.js +139 -0
  25. package/lib/diff-WoKGLpy6.js +18 -0
  26. package/lib/dockerfile-u6f6Vw2s.js +194 -0
  27. package/lib/dtd-SIJRUW6K.js +91 -0
  28. package/lib/dylan-4HCLhpWP.js +238 -0
  29. package/lib/ebnf-h_0lged5.js +77 -0
  30. package/lib/ecl-Lf4FF0lf.js +133 -0
  31. package/lib/eiffel-qlw8KUyf.js +112 -0
  32. package/lib/elm-QRnB3zXs.js +108 -0
  33. package/lib/erlang-fyVKb7eK.js +488 -0
  34. package/lib/factor-BEeN4upY.js +65 -0
  35. package/lib/fcl-lRek3hEb.js +106 -0
  36. package/lib/feature/block-edit/handle/component.d.ts +9 -0
  37. package/lib/feature/block-edit/handle/component.d.ts.map +1 -0
  38. package/lib/feature/block-edit/handle/index.d.ts +12 -0
  39. package/lib/feature/block-edit/handle/index.d.ts.map +1 -0
  40. package/lib/feature/block-edit/index.d.ts +3 -0
  41. package/lib/feature/block-edit/index.d.ts.map +1 -0
  42. package/lib/feature/block-edit/menu/component.d.ts +14 -0
  43. package/lib/feature/block-edit/menu/component.d.ts.map +1 -0
  44. package/lib/feature/block-edit/menu/config.d.ts +21 -0
  45. package/lib/feature/block-edit/menu/config.d.ts.map +1 -0
  46. package/lib/feature/block-edit/menu/icons.d.ts +14 -0
  47. package/lib/feature/block-edit/menu/icons.d.ts.map +1 -0
  48. package/lib/feature/block-edit/menu/index.d.ts +9 -0
  49. package/lib/feature/block-edit/menu/index.d.ts.map +1 -0
  50. package/lib/feature/code-mirror/index.d.ts +3 -0
  51. package/lib/feature/code-mirror/index.d.ts.map +1 -0
  52. package/lib/feature/gap-cursor/index.d.ts +3 -0
  53. package/lib/feature/gap-cursor/index.d.ts.map +1 -0
  54. package/lib/feature/image-block/index.d.ts +3 -0
  55. package/lib/feature/image-block/index.d.ts.map +1 -0
  56. package/lib/feature/index.d.ts +18 -0
  57. package/lib/feature/index.d.ts.map +1 -0
  58. package/lib/feature/link-tooltip/consts.d.ts +5 -0
  59. package/lib/feature/link-tooltip/consts.d.ts.map +1 -0
  60. package/lib/feature/link-tooltip/index.d.ts +3 -0
  61. package/lib/feature/link-tooltip/index.d.ts.map +1 -0
  62. package/lib/feature/list-item/consts.d.ts +2 -0
  63. package/lib/feature/list-item/consts.d.ts.map +1 -0
  64. package/lib/feature/list-item/index.d.ts +3 -0
  65. package/lib/feature/list-item/index.d.ts.map +1 -0
  66. package/lib/feature/placeholder/index.d.ts +10 -0
  67. package/lib/feature/placeholder/index.d.ts.map +1 -0
  68. package/lib/feature/shared.d.ts +3 -0
  69. package/lib/feature/shared.d.ts.map +1 -0
  70. package/lib/feature/toolbar/component.d.ts +13 -0
  71. package/lib/feature/toolbar/component.d.ts.map +1 -0
  72. package/lib/feature/toolbar/consts.d.ts +5 -0
  73. package/lib/feature/toolbar/consts.d.ts.map +1 -0
  74. package/lib/feature/toolbar/index.d.ts +3 -0
  75. package/lib/feature/toolbar/index.d.ts.map +1 -0
  76. package/lib/forth-ua2bRd8T.js +60 -0
  77. package/lib/fortran-WnF7znuN.js +443 -0
  78. package/lib/gas-wowve1o7.js +183 -0
  79. package/lib/gherkin-m7GIChu3.js +34 -0
  80. package/lib/go-th443Dhb.js +158 -0
  81. package/lib/groovy-tR4RiZnc.js +161 -0
  82. package/lib/haskell-jxVBofv5.js +375 -0
  83. package/lib/haxe-kWPI2tq3.js +390 -0
  84. package/lib/hooks-82sqkbtE.js +21 -0
  85. package/lib/http-3GIFWUlG.js +45 -0
  86. package/lib/icons-HYkfuR-O.js +50 -0
  87. package/lib/idl-PvpMZg-l.js +947 -0
  88. package/lib/index-0RbcZMbq.js +8 -0
  89. package/lib/index-4afXjFMY.js +517 -0
  90. package/lib/index-7MeyepDG.js +78 -0
  91. package/lib/index-7QgQq3x3.js +551 -0
  92. package/lib/index-7pgP6qYs.js +107 -0
  93. package/lib/index-8DvtgRVa.js +19511 -0
  94. package/lib/index-8Gg-jEP4.js +288 -0
  95. package/lib/index-8S8qcncB.js +507 -0
  96. package/lib/index-9A_GmGh4.js +1039 -0
  97. package/lib/index-EJJfYLzA.js +928 -0
  98. package/lib/index-Eg39w5kL.js +984 -0
  99. package/lib/index-FIk_7oPb.js +168 -0
  100. package/lib/index-LlbrXb_n.js +368 -0
  101. package/lib/index-MovKtgMG.js +121 -0
  102. package/lib/index-N9GtIS4X.js +64 -0
  103. package/lib/index-Pwn25-kf.js +8 -0
  104. package/lib/index-SdFSDosa.js +1295 -0
  105. package/lib/index-W5Th22-Z.js +1744 -0
  106. package/lib/index-XiXSFLmI.js +20975 -0
  107. package/lib/index-bknOViGv.js +47 -0
  108. package/lib/index-bkuIUPFS.js +275 -0
  109. package/lib/index-jPA8J9Eo.js +8 -0
  110. package/lib/index-lsG76a9s.js +552 -0
  111. package/lib/index-oTRzPo3B.js +146 -0
  112. package/lib/index-rrf6_6DC.js +317 -0
  113. package/lib/index-vJbZIHYF.js +81 -0
  114. package/lib/index-vPRh55CO.js +137 -0
  115. package/lib/index-vxy63hib.js +323 -0
  116. package/lib/index-wn1_LgCS.js +99 -0
  117. package/lib/index-xHADmDT3.js +12 -0
  118. package/lib/index-yt2EpMtv.js +141 -0
  119. package/lib/index.d.ts +4 -0
  120. package/lib/index.d.ts.map +1 -0
  121. package/lib/index.es.js +7 -0
  122. package/lib/javascript-8ZHqHagw.js +758 -0
  123. package/lib/jinja2-vsOFe0qD.js +154 -0
  124. package/lib/julia-dlp_pbN1.js +241 -0
  125. package/lib/livescript-Gf5R-LT6.js +273 -0
  126. package/lib/lua-c5Y_JsBp.js +221 -0
  127. package/lib/mathematica-iiGTGmUs.js +35 -0
  128. package/lib/mbox-ZJh86H8B.js +78 -0
  129. package/lib/meta-tAGyVRPE.js +511 -0
  130. package/lib/mirc-i0qkCa0y.js +73 -0
  131. package/lib/mllike-Dy551fZW.js +275 -0
  132. package/lib/modelica-n6tGqUT9.js +94 -0
  133. package/lib/mscgen-aKSbB7D9.js +104 -0
  134. package/lib/mumps-lNiKA6sp.js +25 -0
  135. package/lib/nginx--YmuCfDj.js +93 -0
  136. package/lib/nsis-zhS8iA09.js +62 -0
  137. package/lib/ntriples-E3jQl3MC.js +79 -0
  138. package/lib/octave-EQvkGIeG.js +144 -0
  139. package/lib/oz-W2cpqFf6.js +152 -0
  140. package/lib/pascal-lCh6ouNZ.js +79 -0
  141. package/lib/perl-PxEQBX0B.js +915 -0
  142. package/lib/pig-Y_bNcrzS.js +56 -0
  143. package/lib/powershell-GaQP-TZr.js +249 -0
  144. package/lib/properties-mbRyn54L.js +26 -0
  145. package/lib/prosemirror-noTDkx-k.js +4 -0
  146. package/lib/protobuf-8CJideyJ.js +49 -0
  147. package/lib/puppet-ABBaChNZ.js +45 -0
  148. package/lib/python-sKdHg3Ka.js +321 -0
  149. package/lib/q-_1yG40Nm.js +89 -0
  150. package/lib/r-Ziz56bHT.js +108 -0
  151. package/lib/rpm-ORjGOHaQ.js +57 -0
  152. package/lib/ruby-jlbYq0dT.js +233 -0
  153. package/lib/sas-2n7xeUuO.js +107 -0
  154. package/lib/schema-tKk3m1fu.js +62 -0
  155. package/lib/scheme-XCs-NPeU.js +126 -0
  156. package/lib/shell-0_1Um7Dq.js +184 -0
  157. package/lib/sieve-7uyJD1x1.js +73 -0
  158. package/lib/simple-mode--HIzBxba.js +95 -0
  159. package/lib/smalltalk-PEFzrlQ-.js +48 -0
  160. package/lib/solr-BLBaHahN.js +41 -0
  161. package/lib/sparql-4F9ZWf1b.js +204 -0
  162. package/lib/spreadsheet-SGSo6blj.js +49 -0
  163. package/lib/sql-tebLBzN0.js +291 -0
  164. package/lib/stex-SFJcFGOO.js +130 -0
  165. package/lib/stylus-rwwWYWFm.js +256 -0
  166. package/lib/swift-eorJ0tCv.js +238 -0
  167. package/lib/tcl-IwXMB8U4.js +82 -0
  168. package/lib/textile-ok2VyjwC.js +299 -0
  169. package/lib/theme/classic/index.d.ts +3 -0
  170. package/lib/theme/classic/index.d.ts.map +1 -0
  171. package/lib/theme/classic-dark/index.d.ts +3 -0
  172. package/lib/theme/classic-dark/index.d.ts.map +1 -0
  173. package/lib/theme/headless/index.d.ts +3 -0
  174. package/lib/theme/headless/index.d.ts.map +1 -0
  175. package/lib/theme/index.d.ts +8 -0
  176. package/lib/theme/index.d.ts.map +1 -0
  177. package/lib/theme/shared.d.ts +3 -0
  178. package/lib/theme/shared.d.ts.map +1 -0
  179. package/lib/tiddlywiki-DLhz8_pc.js +156 -0
  180. package/lib/tiki-DFAqFElY.js +183 -0
  181. package/lib/tippy.esm-MZ2vxByW.js +1813 -0
  182. package/lib/toml-ryxpTZEV.js +49 -0
  183. package/lib/tooltip-plugin-gcwyQdiT.js +119 -0
  184. package/lib/troff-ZzZyvNct.js +36 -0
  185. package/lib/ttcn-6gvkqqpW.js +136 -0
  186. package/lib/ttcn-cfg-oSu-Dq5C.js +98 -0
  187. package/lib/turtle-10ofr5au.js +87 -0
  188. package/lib/use-css-light-dom-EKWZDmbJ.js +82 -0
  189. package/lib/utils/index.d.ts +4 -0
  190. package/lib/utils/index.d.ts.map +1 -0
  191. package/lib/vb-a6n6fzrD.js +74 -0
  192. package/lib/vbscript-dgvo8jPt.js +324 -0
  193. package/lib/velocity-CBncCrwO.js +97 -0
  194. package/lib/verilog-KlcACt6C.js +271 -0
  195. package/lib/vhdl-NMd7Gf35.js +117 -0
  196. package/lib/webidl-z1UE5DN_.js +160 -0
  197. package/lib/xquery-hDt5jWTp.js +431 -0
  198. package/lib/yacas-ftgh_qwr.js +74 -0
  199. package/lib/yaml-DnNTfjXK.js +53 -0
  200. package/lib/z80-dA1PqWe1.js +62 -0
  201. package/package.json +87 -0
  202. package/src/core/crepe.ts +98 -0
  203. package/src/core/index.ts +4 -0
  204. package/src/core/slice.ts +44 -0
  205. package/src/feature/block-edit/handle/component.ts +68 -0
  206. package/src/feature/block-edit/handle/index.ts +81 -0
  207. package/src/feature/block-edit/index.ts +17 -0
  208. package/src/feature/block-edit/menu/component.ts +210 -0
  209. package/src/feature/block-edit/menu/config.ts +335 -0
  210. package/src/feature/block-edit/menu/icons.ts +171 -0
  211. package/src/feature/block-edit/menu/index.ts +113 -0
  212. package/src/feature/block-edit/style.css +126 -0
  213. package/src/feature/code-mirror/index.ts +60 -0
  214. package/src/feature/code-mirror/style.css +159 -0
  215. package/src/feature/gap-cursor/index.ts +31 -0
  216. package/src/feature/image-block/index.ts +59 -0
  217. package/src/feature/image-block/style.css +215 -0
  218. package/src/feature/index.ts +66 -0
  219. package/src/feature/link-tooltip/consts.ts +47 -0
  220. package/src/feature/link-tooltip/index.ts +22 -0
  221. package/src/feature/link-tooltip/style.css +107 -0
  222. package/src/feature/list-item/consts.ts +15 -0
  223. package/src/feature/list-item/index.ts +30 -0
  224. package/src/feature/list-item/style.css +23 -0
  225. package/src/feature/placeholder/index.ts +87 -0
  226. package/src/feature/placeholder/style.css +9 -0
  227. package/src/feature/shared.ts +4 -0
  228. package/src/feature/toolbar/component.ts +101 -0
  229. package/src/feature/toolbar/consts.ts +26 -0
  230. package/src/feature/toolbar/index.ts +92 -0
  231. package/src/feature/toolbar/style.css +37 -0
  232. package/src/index.ts +5 -0
  233. package/src/theme/classic/index.ts +12 -0
  234. package/src/theme/classic/style.css +192 -0
  235. package/src/theme/classic-dark/index.ts +12 -0
  236. package/src/theme/classic-dark/style.css +197 -0
  237. package/src/theme/headless/index.ts +9 -0
  238. package/src/theme/index.ts +26 -0
  239. package/src/theme/shared.ts +4 -0
  240. package/src/utils/index.ts +12 -0
  241. package/src/vite-env.d.ts +2 -0
@@ -0,0 +1,1039 @@
1
+ var wt = (i, t, o) => {
2
+ if (!t.has(i))
3
+ throw TypeError("Cannot " + o);
4
+ };
5
+ var l = (i, t, o) => (wt(i, t, "read from private field"), o ? o.call(i) : t.get(i)), p = (i, t, o) => {
6
+ if (t.has(i))
7
+ throw TypeError("Cannot add the same private member more than once");
8
+ t instanceof WeakSet ? t.add(i) : t.set(i, o);
9
+ }, c = (i, t, o, e) => (wt(i, t, "write to private field"), e ? e.call(i, o) : t.set(i, o), o);
10
+ var Ct = (i, t, o) => (wt(i, t, "access private method"), o);
11
+ import { d as It, t as Tt, p as ee } from "./tippy.esm-MZ2vxByW.js";
12
+ import { j as ne, y as oe, q as St, f as y, $ as at, x as Rt, z as Dt, P as At, T as Ot, A as se, B as Nt, E as K, G as ie, H as le, I as re, J as ce, c as ae, K as de, i as he } from "./index-XiXSFLmI.js";
13
+ import { i as pe, a as ue } from "./index-xHADmDT3.js";
14
+ import { h as w, c as zt, e as me, u as Ft, a as yt } from "./meta-tAGyVRPE.js";
15
+ import { a as ge, u as fe, b as W } from "./hooks-82sqkbtE.js";
16
+ import { i as we } from "./schema-tKk3m1fu.js";
17
+ const E = typeof navigator < "u" ? navigator : null, Bt = typeof document < "u" ? document : null, q = E && E.userAgent || "", bt = /Edge\/(\d+)/.exec(q), qt = /MSIE \d/.exec(q), Ht = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(q), mt = !!(qt || Ht || bt), Ce = qt ? document.documentMode : Ht ? +Ht[1] : bt ? +bt[1] : 0, ve = !mt && /gecko\/(\d+)/i.test(q);
18
+ ve && +(/Firefox\/(\d+)/.exec(q) || [0, 0])[1];
19
+ const Lt = !mt && /Chrome\/(\d+)/.exec(q);
20
+ Lt && +Lt[1];
21
+ const ke = !mt && !!E && /Apple Computer/.test(E.vendor), Kt = ke && (/Mobile\/\w+/.test(q) || !!E && E.maxTouchPoints > 2);
22
+ Kt || E && /Mac/.test(E.platform);
23
+ const ye = !!Bt && "webkitFontSmoothing" in Bt.documentElement.style, be = ye ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
24
+ function He(i, t) {
25
+ var n;
26
+ const { state: o } = i, e = o.selection.$anchor;
27
+ for (let s = e.depth; s > 0; s--)
28
+ if (e.node(s).type.spec.tableRole === "table") {
29
+ const d = i.posAtCoords({ left: t.clientX, top: t.clientY });
30
+ if (!d)
31
+ return null;
32
+ const u = (n = i.dragging) == null ? void 0 : n.slice;
33
+ if (!u)
34
+ return null;
35
+ const m = i.state.doc.resolve(d.pos), v = ne(i.state.doc, m.pos, u);
36
+ if (v == null || v < 0)
37
+ return null;
38
+ let g = o.tr;
39
+ g = g.delete(e.before(s), e.after(s));
40
+ const C = g.mapping.map(v);
41
+ return g = g.replaceRange(C, C, u), g;
42
+ }
43
+ return null;
44
+ }
45
+ function xe(i, t, o) {
46
+ let e = i.nodeDOM(o.pos);
47
+ e || (e = i.nodeDOM(o.pos - 1));
48
+ let n = e == null ? void 0 : e.parentElement;
49
+ for (; n && n !== t && o.pos === i.posAtDOM(n, 0); )
50
+ e = n, n = n.parentElement;
51
+ return e;
52
+ }
53
+ const Me = (i) => !i.type.isBlock;
54
+ function Ve(i) {
55
+ let t = i.parent;
56
+ const o = i.node();
57
+ return t === o && (t = i.node(i.depth - 1)), !t || t.type.name === "doc" ? !1 : t.firstChild === o;
58
+ }
59
+ function _e(i, t, o) {
60
+ const e = t.dom.parentElement;
61
+ if (!e)
62
+ return null;
63
+ const n = t.posAtDOM(i, 0);
64
+ if (n <= 0)
65
+ return null;
66
+ let s = t.state.doc.resolve(n), r = s.node();
67
+ if (r.type.name === "doc") {
68
+ const u = t.state.doc.nodeAt(n);
69
+ if (!u)
70
+ return null;
71
+ r = u;
72
+ }
73
+ for (; r && (Me(r) || Ve(s) || !o(r)); )
74
+ s = t.state.doc.resolve(s.before()), r = s.node();
75
+ s = s.pos - s.parentOffset === 0 ? s : t.state.doc.resolve(s.pos - s.parentOffset);
76
+ const d = xe(t, e, s);
77
+ return d ? { node: r, $pos: s, el: d } : null;
78
+ }
79
+ let $t = null;
80
+ function Pe() {
81
+ return $t || ($t = document.implementation.createHTMLDocument("title"));
82
+ }
83
+ const Se = {
84
+ thead: ["table"],
85
+ tbody: ["table"],
86
+ tfoot: ["table"],
87
+ caption: ["table"],
88
+ colgroup: ["table"],
89
+ col: ["table", "colgroup"],
90
+ tr: ["table", "tbody"],
91
+ td: ["table", "tbody", "tr"],
92
+ th: ["table", "tbody", "tr"]
93
+ };
94
+ function Be(i, t) {
95
+ const o = [];
96
+ let { openStart: e, openEnd: n, content: s } = t;
97
+ for (; e > 1 && n > 1 && s.childCount === 1 && s.firstChild.childCount === 1; ) {
98
+ e -= 1, n -= 1;
99
+ const k = s.firstChild;
100
+ o.push(
101
+ k.type.name,
102
+ k.attrs !== k.type.defaultAttrs ? k.attrs : null
103
+ ), s = k.content;
104
+ }
105
+ const r = i.someProp("clipboardSerializer") || oe.fromSchema(i.state.schema), d = Pe(), u = d.createElement("div");
106
+ u.appendChild(r.serializeFragment(s, { document: d }));
107
+ let m = u.firstChild, v, g = 0;
108
+ for (; m && m.nodeType === 1 && (v = Se[m.nodeName.toLowerCase()]); ) {
109
+ for (let k = v.length - 1; k >= 0; k--) {
110
+ const b = d.createElement(v[k]);
111
+ for (; u.firstChild; )
112
+ b.appendChild(u.firstChild);
113
+ u.appendChild(b), g++;
114
+ }
115
+ m = u.firstChild;
116
+ }
117
+ m && m.nodeType === 1 && m.setAttribute(
118
+ "data-pm-slice",
119
+ `${e} ${n}${g ? ` -${g}` : ""} ${JSON.stringify(o)}`
120
+ );
121
+ const C = i.someProp("clipboardTextSerializer", (k) => k(t, i)) || t.content.textBetween(0, t.content.size, `
122
+
123
+ `);
124
+ return { dom: u, text: C };
125
+ }
126
+ const Zt = mt && Ce < 15 || Kt && be < 604, Et = 20;
127
+ var j, tt, R, V, U, x, ht, Wt, D, Y, A, O, et, G, J, Q, nt;
128
+ class Le {
129
+ constructor() {
130
+ /// @internal
131
+ p(this, ht);
132
+ /// @internal
133
+ p(this, D);
134
+ /// @internal
135
+ p(this, j, void 0);
136
+ p(this, tt, void 0);
137
+ p(this, R, void 0);
138
+ p(this, V, void 0);
139
+ p(this, U, void 0);
140
+ p(this, x, void 0);
141
+ /// @internal
142
+ p(this, A, void 0);
143
+ p(this, O, void 0);
144
+ p(this, et, void 0);
145
+ p(this, G, void 0);
146
+ p(this, J, void 0);
147
+ p(this, Q, void 0);
148
+ p(this, nt, void 0);
149
+ c(this, tt, () => {
150
+ if (!l(this, V))
151
+ return null;
152
+ const t = l(this, V), o = l(this, D, Y);
153
+ if (o && St.isSelectable(t.node)) {
154
+ const e = St.create(o.state.doc, t.$pos.pos - (t.node.isLeaf ? 0 : 1));
155
+ return o.dispatch(o.state.tr.setSelection(e)), o.focus(), c(this, R, e), e;
156
+ }
157
+ return null;
158
+ }), c(this, R, null), c(this, V, null), c(this, U, void 0), c(this, x, !1), c(this, O, () => {
159
+ var t;
160
+ (t = l(this, A)) == null || t.call(this, { type: "hide" }), c(this, V, null);
161
+ }), c(this, et, (t) => {
162
+ var o;
163
+ c(this, V, t), (o = l(this, A)) == null || o.call(this, { type: "show", active: t });
164
+ }), this.bind = (t, o) => {
165
+ c(this, j, t), c(this, A, o);
166
+ }, this.addEvent = (t) => {
167
+ t.addEventListener("mousedown", l(this, G)), t.addEventListener("mouseup", l(this, J)), t.addEventListener("dragstart", l(this, Q));
168
+ }, this.removeEvent = (t) => {
169
+ t.removeEventListener("mousedown", l(this, G)), t.removeEventListener("mouseup", l(this, J)), t.removeEventListener("dragstart", l(this, Q));
170
+ }, this.unBind = () => {
171
+ c(this, A, void 0);
172
+ }, c(this, G, () => {
173
+ var t;
174
+ c(this, U, (t = l(this, V)) == null ? void 0 : t.el.getBoundingClientRect()), l(this, tt).call(this);
175
+ }), c(this, J, () => {
176
+ if (!l(this, x)) {
177
+ requestAnimationFrame(() => {
178
+ var t;
179
+ l(this, U) && ((t = l(this, D, Y)) == null || t.focus());
180
+ });
181
+ return;
182
+ }
183
+ c(this, x, !1), c(this, R, null);
184
+ }), c(this, Q, (t) => {
185
+ c(this, x, !0);
186
+ const o = l(this, R), e = l(this, D, Y);
187
+ if (e && t.dataTransfer && o) {
188
+ const n = o.content();
189
+ t.dataTransfer.effectAllowed = "copyMove";
190
+ const { dom: s, text: r } = Be(e, n);
191
+ t.dataTransfer.clearData(), t.dataTransfer.setData(Zt ? "Text" : "text/html", s.innerHTML), Zt || t.dataTransfer.setData("text/plain", r), e.dragging = {
192
+ slice: n,
193
+ move: !0
194
+ };
195
+ }
196
+ }), this.keydownCallback = () => (l(this, O).call(this), !1), c(this, nt, (t, o) => {
197
+ if (!t.editable || l(this, x))
198
+ return;
199
+ const { y: e } = o, n = t.dom.getBoundingClientRect().width / 2, s = document.elementFromPoint(n, e);
200
+ if (!(s instanceof Element)) {
201
+ l(this, O).call(this);
202
+ return;
203
+ }
204
+ const r = l(this, ht, Wt);
205
+ if (!r)
206
+ return;
207
+ const d = _e(s, t, r);
208
+ if (!d) {
209
+ l(this, O).call(this);
210
+ return;
211
+ }
212
+ l(this, et).call(this, d);
213
+ }), this.mousemoveCallback = (t, o) => (t.composing || !t.editable || It(l(this, nt), 20)(t, o), !1), this.dragoverCallback = (t, o) => {
214
+ var e;
215
+ if (l(this, x)) {
216
+ const n = (e = l(this, D, Y)) == null ? void 0 : e.dom.parentElement;
217
+ if (!n)
218
+ return !1;
219
+ const s = n.scrollHeight > n.clientHeight, r = n.getBoundingClientRect();
220
+ if (s) {
221
+ if (n.scrollTop > 0 && Math.abs(o.y - r.y) < Et) {
222
+ const m = n.scrollTop > 10 ? n.scrollTop - 10 : 0;
223
+ return n.scrollTop = m, !1;
224
+ }
225
+ const d = Math.round(t.dom.getBoundingClientRect().height);
226
+ if (Math.round(n.scrollTop + r.height) < d && Math.abs(o.y - (r.height + r.y)) < Et) {
227
+ const m = n.scrollTop + 10;
228
+ return n.scrollTop = m, !1;
229
+ }
230
+ }
231
+ }
232
+ return !1;
233
+ }, this.dragenterCallback = () => {
234
+ c(this, x, !0);
235
+ }, this.dragleaveCallback = () => {
236
+ c(this, x, !1), c(this, V, null);
237
+ }, this.dropCallback = (t, o) => {
238
+ const e = o, n = He(t, e);
239
+ return c(this, x, !1), n ? (t.dispatch(n), e.preventDefault(), !0) : !1;
240
+ };
241
+ }
242
+ }
243
+ j = new WeakMap(), tt = new WeakMap(), R = new WeakMap(), V = new WeakMap(), U = new WeakMap(), x = new WeakMap(), ht = new WeakSet(), Wt = function() {
244
+ var t;
245
+ return (t = l(this, j)) == null ? void 0 : t.get(dt.key).filterNodes;
246
+ }, D = new WeakSet(), Y = function() {
247
+ var t;
248
+ return (t = l(this, j)) == null ? void 0 : t.get(y);
249
+ }, A = new WeakMap(), O = new WeakMap(), et = new WeakMap(), G = new WeakMap(), J = new WeakMap(), Q = new WeakMap(), nt = new WeakMap();
250
+ function gt(i, t) {
251
+ return Object.assign(i, {
252
+ meta: {
253
+ package: "@milkdown/plugin-block",
254
+ ...t
255
+ }
256
+ }), i;
257
+ }
258
+ const $e = (i) => {
259
+ const { name: t } = i.type;
260
+ return !(t.startsWith("table") && t !== "table");
261
+ }, dt = at({ filterNodes: $e }, "blockConfig");
262
+ gt(dt, {
263
+ displayName: "Ctx<blockConfig>"
264
+ });
265
+ const xt = at(new Le(), "blockService");
266
+ gt(dt, {
267
+ displayName: "Ctx<blockService>"
268
+ });
269
+ const Mt = at({}, "blockSpec");
270
+ gt(dt, {
271
+ displayName: "Ctx<blockSpec>"
272
+ });
273
+ const Vt = Rt((i) => {
274
+ const t = new Dt("MILKDOWN_BLOCK"), o = i.get(xt.key), e = i.get(Mt.key);
275
+ return new At({
276
+ key: t,
277
+ ...e,
278
+ props: {
279
+ ...e.props,
280
+ handleDOMEvents: {
281
+ drop: (n, s) => o.dropCallback(n, s),
282
+ mousemove: (n, s) => o.mousemoveCallback(n, s),
283
+ keydown: () => o.keydownCallback(),
284
+ dragover: (n, s) => o.dragoverCallback(n, s),
285
+ dragleave: () => o.dragleaveCallback(),
286
+ dragenter: () => o.dragenterCallback()
287
+ }
288
+ }
289
+ });
290
+ });
291
+ gt(Vt, {
292
+ displayName: "Prose<block>"
293
+ });
294
+ var _, S, ot, X, N, z, pt, jt;
295
+ class Ze {
296
+ constructor(t) {
297
+ /// @internal
298
+ p(this, pt);
299
+ /// @internal
300
+ p(this, _, void 0);
301
+ /// @internal
302
+ p(this, S, void 0);
303
+ /// @internal
304
+ p(this, ot, void 0);
305
+ /// @internal
306
+ p(this, X, void 0);
307
+ /// @internal
308
+ p(this, N, void 0);
309
+ p(this, z, void 0);
310
+ c(this, z, null), this.update = (o) => {
311
+ requestAnimationFrame(() => {
312
+ if (!l(this, _))
313
+ try {
314
+ Ct(this, pt, jt).call(this, o);
315
+ } catch {
316
+ }
317
+ });
318
+ }, this.destroy = () => {
319
+ var o, e, n;
320
+ (o = l(this, N)) == null || o.unBind(), (e = l(this, N)) == null || e.removeEvent(l(this, S)), (n = l(this, _)) == null || n.destroy(), c(this, _, void 0);
321
+ }, this.show = (o) => {
322
+ requestAnimationFrame(() => {
323
+ var e, n;
324
+ (e = l(this, _)) == null || e.setProps({
325
+ getReferenceClientRect: () => o.el.getBoundingClientRect()
326
+ }), (n = l(this, _)) == null || n.show();
327
+ });
328
+ }, this.hide = () => {
329
+ var o;
330
+ (o = l(this, _)) == null || o.hide();
331
+ }, c(this, X, t.ctx), c(this, S, t.content), c(this, ot, t.tippyOptions ?? {});
332
+ }
333
+ get activeNode() {
334
+ return l(this, z);
335
+ }
336
+ }
337
+ _ = new WeakMap(), S = new WeakMap(), ot = new WeakMap(), X = new WeakMap(), N = new WeakMap(), z = new WeakMap(), pt = new WeakSet(), jt = function(t) {
338
+ const o = l(this, X).get(xt.key);
339
+ o.bind(l(this, X), (e) => {
340
+ e.type === "hide" ? (this.hide(), c(this, z, null)) : (this.show(e.active), c(this, z, e.active));
341
+ }), c(this, N, o), l(this, N).addEvent(l(this, S)), l(this, S).draggable = !0, c(this, _, Tt(t.dom, {
342
+ trigger: "manual",
343
+ placement: "left-start",
344
+ interactive: !0,
345
+ ...l(this, ot),
346
+ content: l(this, S)
347
+ }));
348
+ };
349
+ const ft = [Mt, dt, xt, Vt];
350
+ ft.key = Mt.key;
351
+ ft.pluginKey = Vt.key;
352
+ function Ee(i) {
353
+ const t = at({}, `${i}_SLASH_SPEC`), o = Rt((n) => {
354
+ const s = n.get(t.key);
355
+ return new At({
356
+ key: new Dt(`${i}_SLASH`),
357
+ ...s
358
+ });
359
+ }), e = [t, o];
360
+ return e.key = t.key, e.pluginKey = o.key, t.meta = {
361
+ package: "@milkdown/plugin-slash",
362
+ displayName: `Ctx<slashSpec>|${i}`
363
+ }, o.meta = {
364
+ package: "@milkdown/plugin-slash",
365
+ displayName: `Prose<slash>|${i}`
366
+ }, e;
367
+ }
368
+ var P, st, it, F, lt, rt, ut, Ut;
369
+ class Ie {
370
+ constructor(t) {
371
+ /// @internal
372
+ p(this, ut);
373
+ /// @internal
374
+ p(this, P, void 0);
375
+ /// @internal
376
+ p(this, st, void 0);
377
+ /// @internal
378
+ p(this, it, void 0);
379
+ /// @internal
380
+ p(this, F, void 0);
381
+ /// @internal
382
+ p(this, lt, void 0);
383
+ p(this, rt, void 0);
384
+ c(this, rt, (o, e) => {
385
+ const { state: n, composing: s } = o, { selection: r, doc: d } = n, { ranges: u } = r, m = Math.min(...u.map((C) => C.$from.pos)), v = Math.max(...u.map((C) => C.$to.pos)), g = e && e.doc.eq(d) && e.selection.eq(r);
386
+ if (l(this, P) ?? c(this, P, Tt(o.dom, {
387
+ trigger: "manual",
388
+ placement: "bottom-start",
389
+ interactive: !0,
390
+ ...l(this, st),
391
+ content: this.element
392
+ })), !(s || g)) {
393
+ if (!l(this, lt).call(this, o, e)) {
394
+ this.hide();
395
+ return;
396
+ }
397
+ l(this, P).setProps({
398
+ getReferenceClientRect: () => ee(o, m, v)
399
+ }), this.show();
400
+ }
401
+ }), this.update = (o, e) => {
402
+ It(l(this, rt), l(this, it))(o, e);
403
+ }, this.getContent = (o, e = (n) => n.type.name === "paragraph") => {
404
+ const { selection: n } = o.state, { empty: s, $from: r } = n, d = o.state.selection instanceof Ot, u = this.element.contains(document.activeElement), m = !o.hasFocus() && !u, v = !o.editable, C = !se(e)(o.state.selection);
405
+ if (!(m || v || !s || !d || C))
406
+ return r.parent.textBetween(Math.max(0, r.parentOffset - 500), r.parentOffset, void 0, "");
407
+ }, this.destroy = () => {
408
+ var o;
409
+ (o = l(this, P)) == null || o.destroy();
410
+ }, this.show = () => {
411
+ var o;
412
+ (o = l(this, P)) == null || o.show();
413
+ }, this.hide = () => {
414
+ var o;
415
+ (o = l(this, P)) == null || o.hide();
416
+ }, this.getInstance = () => l(this, P), this.element = t.content, c(this, st, t.tippyOptions ?? {}), c(this, it, t.debounce ?? 200), c(this, lt, t.shouldShow ?? Ct(this, ut, Ut)), c(this, F, t.trigger ?? "/");
417
+ }
418
+ }
419
+ P = new WeakMap(), st = new WeakMap(), it = new WeakMap(), F = new WeakMap(), lt = new WeakMap(), rt = new WeakMap(), ut = new WeakSet(), Ut = function(t) {
420
+ const o = this.getContent(t);
421
+ if (!o)
422
+ return !1;
423
+ const e = o.at(-1);
424
+ return e ? Array.isArray(l(this, F)) ? l(this, F).includes(e) : l(this, F) === e : !1;
425
+ };
426
+ const Te = w`
427
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
428
+ <g clip-path="url(#clip0_992_5547)">
429
+ <path d="M5 5.5C5 6.33 5.67 7 6.5 7H10.5V17.5C10.5 18.33 11.17 19 12 19C12.83 19 13.5 18.33 13.5 17.5V7H17.5C18.33 7 19 6.33 19 5.5C19 4.67 18.33 4 17.5 4H6.5C5.67 4 5 4.67 5 5.5Z" fill="#817567"/>
430
+ </g>
431
+ <defs>
432
+ <clipPath id="clip0_992_5547">
433
+ <rect width="24" height="24" fill="white"/>
434
+ </clipPath>
435
+ </defs>
436
+ </svg>
437
+ `, Re = w`
438
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
439
+ <g clip-path="url(#clip0_992_5553)">
440
+ <path d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM12 17H14V7H10V9H12V17Z" fill="#817567"/>
441
+ </g>
442
+ <defs>
443
+ <clipPath id="clip0_992_5553">
444
+ <rect width="24" height="24" fill="white"/>
445
+ </clipPath>
446
+ </defs>
447
+ </svg>
448
+ `, De = w`
449
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
450
+ <g clip-path="url(#clip0_992_5559)">
451
+ <path d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15H11V13H13C14.1 13 15 12.11 15 11V9C15 7.89 14.1 7 13 7H9V9H13V11H11C9.9 11 9 11.89 9 13V17H15V15Z" fill="#817567"/>
452
+ </g>
453
+ <defs>
454
+ <clipPath id="clip0_992_5559">
455
+ <rect width="24" height="24" fill="white"/>
456
+ </clipPath>
457
+ </defs>
458
+ </svg>
459
+ `, Ae = w`
460
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
461
+ <g clip-path="url(#clip0_992_5565)">
462
+ <path d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15V13.5C15 12.67 14.33 12 13.5 12C14.33 12 15 11.33 15 10.5V9C15 7.89 14.1 7 13 7H9V9H13V11H11V13H13V15H9V17H13C14.1 17 15 16.11 15 15Z" fill="#817567"/>
463
+ </g>
464
+ <defs>
465
+ <clipPath id="clip0_992_5565">
466
+ <rect width="24" height="24" fill="white"/>
467
+ </clipPath>
468
+ </defs>
469
+ </svg>
470
+ `, Oe = w`
471
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
472
+ <g clip-path="url(#clip0_977_7757)">
473
+ <path d="M19.04 3H5.04004C3.94004 3 3.04004 3.9 3.04004 5V19C3.04004 20.1 3.94004 21 5.04004 21H19.04C20.14 21 21.04 20.1 21.04 19V5C21.04 3.9 20.14 3 19.04 3ZM19.04 19H5.04004V5H19.04V19ZM13.04 17H15.04V7H13.04V11H11.04V7H9.04004V13H13.04V17Z" fill="#817567"/>
474
+ </g>
475
+ <defs>
476
+ <clipPath id="clip0_977_7757">
477
+ <rect width="24" height="24" fill="white"/>
478
+ </clipPath>
479
+ </defs>
480
+ </svg>
481
+ `, Ne = w`
482
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
483
+ <g clip-path="url(#clip0_977_7760)">
484
+ <path d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15V13C15 11.89 14.1 11 13 11H11V9H15V7H9V13H13V15H9V17H13C14.1 17 15 16.11 15 15Z" fill="#817567"/>
485
+ </g>
486
+ <defs>
487
+ <clipPath id="clip0_977_7760">
488
+ <rect width="24" height="24" fill="white"/>
489
+ </clipPath>
490
+ </defs>
491
+ </svg>
492
+ `, ze = w`
493
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
494
+ <g clip-path="url(#clip0_977_7763)">
495
+ <path d="M11 17H13C14.1 17 15 16.11 15 15V13C15 11.89 14.1 11 13 11H11V9H15V7H11C9.9 7 9 7.89 9 9V15C9 16.11 9.9 17 11 17ZM11 13H13V15H11V13ZM19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19Z" fill="#817567"/>
496
+ </g>
497
+ <defs>
498
+ <clipPath id="clip0_977_7763">
499
+ <rect width="24" height="24" fill="white"/>
500
+ </clipPath>
501
+ </defs>
502
+ </svg>
503
+ `, Fe = w`
504
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
505
+ <g clip-path="url(#clip0_977_8070)">
506
+ <path d="M4 10.5C3.17 10.5 2.5 11.17 2.5 12C2.5 12.83 3.17 13.5 4 13.5C4.83 13.5 5.5 12.83 5.5 12C5.5 11.17 4.83 10.5 4 10.5ZM4 4.5C3.17 4.5 2.5 5.17 2.5 6C2.5 6.83 3.17 7.5 4 7.5C4.83 7.5 5.5 6.83 5.5 6C5.5 5.17 4.83 4.5 4 4.5ZM4 16.5C3.17 16.5 2.5 17.18 2.5 18C2.5 18.82 3.18 19.5 4 19.5C4.82 19.5 5.5 18.82 5.5 18C5.5 17.18 4.83 16.5 4 16.5ZM8 19H20C20.55 19 21 18.55 21 18C21 17.45 20.55 17 20 17H8C7.45 17 7 17.45 7 18C7 18.55 7.45 19 8 19ZM8 13H20C20.55 13 21 12.55 21 12C21 11.45 20.55 11 20 11H8C7.45 11 7 11.45 7 12C7 12.55 7.45 13 8 13ZM7 6C7 6.55 7.45 7 8 7H20C20.55 7 21 6.55 21 6C21 5.45 20.55 5 20 5H8C7.45 5 7 5.45 7 6Z" fill="#817567"/>
507
+ </g>
508
+ <defs>
509
+ <clipPath id="clip0_977_8070">
510
+ <rect width="24" height="24" fill="white"/>
511
+ </clipPath>
512
+ </defs>
513
+ </svg>
514
+ `, qe = w`
515
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
516
+ <g clip-path="url(#clip0_977_8067)">
517
+ <path d="M8 7H20C20.55 7 21 6.55 21 6C21 5.45 20.55 5 20 5H8C7.45 5 7 5.45 7 6C7 6.55 7.45 7 8 7ZM20 17H8C7.45 17 7 17.45 7 18C7 18.55 7.45 19 8 19H20C20.55 19 21 18.55 21 18C21 17.45 20.55 17 20 17ZM20 11H8C7.45 11 7 11.45 7 12C7 12.55 7.45 13 8 13H20C20.55 13 21 12.55 21 12C21 11.45 20.55 11 20 11ZM4.5 16H2.5C2.22 16 2 16.22 2 16.5C2 16.78 2.22 17 2.5 17H4V17.5H3.5C3.22 17.5 3 17.72 3 18C3 18.28 3.22 18.5 3.5 18.5H4V19H2.5C2.22 19 2 19.22 2 19.5C2 19.78 2.22 20 2.5 20H4.5C4.78 20 5 19.78 5 19.5V16.5C5 16.22 4.78 16 4.5 16ZM2.5 5H3V7.5C3 7.78 3.22 8 3.5 8C3.78 8 4 7.78 4 7.5V4.5C4 4.22 3.78 4 3.5 4H2.5C2.22 4 2 4.22 2 4.5C2 4.78 2.22 5 2.5 5ZM4.5 10H2.5C2.22 10 2 10.22 2 10.5C2 10.78 2.22 11 2.5 11H3.8L2.12 12.96C2.04 13.05 2 13.17 2 13.28V13.5C2 13.78 2.22 14 2.5 14H4.5C4.78 14 5 13.78 5 13.5C5 13.22 4.78 13 4.5 13H3.2L4.88 11.04C4.96 10.95 5 10.83 5 10.72V10.5C5 10.22 4.78 10 4.5 10Z" fill="#817567"/>
518
+ </g>
519
+ <defs>
520
+ <clipPath id="clip0_977_8067">
521
+ <rect width="24" height="24" fill="white"/>
522
+ </clipPath>
523
+ </defs>
524
+ </svg>
525
+ `, Ke = w`
526
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
527
+ <g clip-path="url(#clip0_977_7897)">
528
+ <path d="M7.17 17C7.68 17 8.15 16.71 8.37 16.26L9.79 13.42C9.93 13.14 10 12.84 10 12.53V8C10 7.45 9.55 7 9 7H5C4.45 7 4 7.45 4 8V12C4 12.55 4.45 13 5 13H7L5.97 15.06C5.52 15.95 6.17 17 7.17 17ZM17.17 17C17.68 17 18.15 16.71 18.37 16.26L19.79 13.42C19.93 13.14 20 12.84 20 12.53V8C20 7.45 19.55 7 19 7H15C14.45 7 14 7.45 14 8V12C14 12.55 14.45 13 15 13H17L15.97 15.06C15.52 15.95 16.17 17 17.17 17Z" fill="#817567"/>
529
+ </g>
530
+ <defs>
531
+ <clipPath id="clip0_977_7897">
532
+ <rect width="24" height="24" fill="white"/>
533
+ </clipPath>
534
+ </defs>
535
+ </svg>
536
+ `, We = w`
537
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
538
+ <g clip-path="url(#clip0_977_7900)">
539
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M19 13H5C4.45 13 4 12.55 4 12C4 11.45 4.45 11 5 11H19C19.55 11 20 11.45 20 12C20 12.55 19.55 13 19 13Z" fill="#817567"/>
540
+ </g>
541
+ <defs>
542
+ <clipPath id="clip0_977_7900">
543
+ <rect width="24" height="24" fill="white"/>
544
+ </clipPath>
545
+ </defs>
546
+ </svg>
547
+ `, je = w`
548
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
549
+ <g clip-path="url(#clip0_977_8075)">
550
+ <path d="M19 5V19H5V5H19ZM19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM14.14 11.86L11.14 15.73L9 13.14L6 17H18L14.14 11.86Z" fill="#817567"/>
551
+ </g>
552
+ <defs>
553
+ <clipPath id="clip0_977_8075">
554
+ <rect width="24" height="24" fill="white"/>
555
+ </clipPath>
556
+ </defs>
557
+ </svg>
558
+ `, Ue = w`
559
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
560
+ <g clip-path="url(#clip0_977_8081)">
561
+ <path d="M9.4 16.6L4.8 12L9.4 7.4L8 6L2 12L8 18L9.4 16.6ZM14.6 16.6L19.2 12L14.6 7.4L16 6L22 12L16 18L14.6 16.6Z" fill="#817567"/>
562
+ </g>
563
+ <defs>
564
+ <clipPath id="clip0_977_8081">
565
+ <rect width="24" height="24" fill="white"/>
566
+ </clipPath>
567
+ </defs>
568
+ </svg>
569
+ `;
570
+ function _t(i) {
571
+ const { $from: t, $to: o } = i.selection, { pos: e } = t, { pos: n } = o;
572
+ return i = i.deleteRange(e - t.node().content.size, n), i;
573
+ }
574
+ function Ge(i, t, o = null) {
575
+ const { from: e, to: n } = i.selection;
576
+ return i.setBlockType(e, n, t, o);
577
+ }
578
+ function Je(i, t, o = null) {
579
+ const { $from: e, $to: n } = i.selection, s = e.blockRange(n), r = s && de(s, t, o);
580
+ return r ? i.wrap(s, r) : null;
581
+ }
582
+ function Qe(i, t, o = null) {
583
+ const e = t.createAndFill(o);
584
+ return e ? i.replaceSelectionWith(e) : null;
585
+ }
586
+ function T(i, t = null) {
587
+ return (o, e) => {
588
+ if (e) {
589
+ const n = Ge(_t(o.tr), i, t);
590
+ e(n.scrollIntoView());
591
+ }
592
+ return !0;
593
+ };
594
+ }
595
+ function vt(i, t = null) {
596
+ return (o, e) => {
597
+ const n = Je(_t(o.tr), i, t);
598
+ return n ? (e && e(n.scrollIntoView()), !0) : !1;
599
+ };
600
+ }
601
+ function kt(i, t = null) {
602
+ return (o, e) => {
603
+ const n = Qe(_t(o.tr), i, t);
604
+ return n ? (e && e(n.scrollIntoView()), !0) : !1;
605
+ };
606
+ }
607
+ function Xe(i) {
608
+ let t = [
609
+ {
610
+ key: "text",
611
+ label: "Text",
612
+ items: [
613
+ {
614
+ key: "text",
615
+ label: "Text",
616
+ icon: Te,
617
+ onRun: (e) => {
618
+ const n = e.get(y), { dispatch: s, state: r } = n;
619
+ T(Nt.type(e))(r, s);
620
+ }
621
+ },
622
+ {
623
+ key: "h1",
624
+ label: "Heading 1",
625
+ icon: Re,
626
+ onRun: (e) => {
627
+ const n = e.get(y), { dispatch: s, state: r } = n;
628
+ T(K.type(e), { level: 1 })(r, s);
629
+ }
630
+ },
631
+ {
632
+ key: "h2",
633
+ label: "Heading 2",
634
+ icon: De,
635
+ onRun: (e) => {
636
+ const n = e.get(y), { dispatch: s, state: r } = n;
637
+ T(K.type(e), { level: 2 })(r, s);
638
+ }
639
+ },
640
+ {
641
+ key: "h3",
642
+ label: "Heading 3",
643
+ icon: Ae,
644
+ onRun: (e) => {
645
+ const n = e.get(y), { dispatch: s, state: r } = n;
646
+ T(K.type(e), { level: 3 })(r, s);
647
+ }
648
+ },
649
+ {
650
+ key: "h4",
651
+ label: "Heading 4",
652
+ icon: Oe,
653
+ onRun: (e) => {
654
+ const n = e.get(y), { dispatch: s, state: r } = n;
655
+ T(K.type(e), { level: 4 })(r, s);
656
+ }
657
+ },
658
+ {
659
+ key: "h5",
660
+ label: "Heading 5",
661
+ icon: Ne,
662
+ onRun: (e) => {
663
+ const n = e.get(y), { dispatch: s, state: r } = n;
664
+ T(K.type(e), { level: 5 })(r, s);
665
+ }
666
+ },
667
+ {
668
+ key: "h6",
669
+ label: "Heading 6",
670
+ icon: ze,
671
+ onRun: (e) => {
672
+ const n = e.get(y), { dispatch: s, state: r } = n;
673
+ T(K.type(e), { level: 6 })(r, s);
674
+ }
675
+ },
676
+ {
677
+ key: "quote",
678
+ label: "Quote",
679
+ icon: Ke,
680
+ onRun: (e) => {
681
+ const n = e.get(y), { dispatch: s, state: r } = n;
682
+ vt(ie.type(e))(r, s);
683
+ }
684
+ },
685
+ {
686
+ key: "divider",
687
+ label: "Divider",
688
+ icon: We,
689
+ onRun: (e) => {
690
+ const n = e.get(y), { dispatch: s, state: r } = n;
691
+ kt(le.type(e))(r, s);
692
+ }
693
+ }
694
+ ]
695
+ },
696
+ {
697
+ key: "list",
698
+ label: "List",
699
+ items: [
700
+ {
701
+ key: "bullet-list",
702
+ label: "Bullet List",
703
+ icon: Fe,
704
+ onRun: (e) => {
705
+ const n = e.get(y), { dispatch: s, state: r } = n;
706
+ vt(re.type(e))(r, s);
707
+ }
708
+ },
709
+ {
710
+ key: "ordered-list",
711
+ label: "Ordered List",
712
+ icon: qe,
713
+ onRun: (e) => {
714
+ const n = e.get(y), { dispatch: s, state: r } = n;
715
+ vt(ce.type(e))(r, s);
716
+ }
717
+ }
718
+ ]
719
+ },
720
+ {
721
+ key: "advanced",
722
+ label: "Advanced",
723
+ items: [
724
+ {
725
+ key: "image",
726
+ label: "Image",
727
+ icon: je,
728
+ onRun: (e) => {
729
+ const n = e.get(y), { dispatch: s, state: r } = n;
730
+ kt(we.type(e))(r, s);
731
+ }
732
+ },
733
+ {
734
+ key: "code",
735
+ label: "Code",
736
+ icon: Ue,
737
+ onRun: (e) => {
738
+ const n = e.get(y), { dispatch: s, state: r } = n;
739
+ kt(ae.type(e))(r, s);
740
+ }
741
+ }
742
+ ]
743
+ }
744
+ ];
745
+ i && (t = t.map((e) => {
746
+ const n = e.items.filter((s) => s.label.toLowerCase().includes(i.toLowerCase()));
747
+ return {
748
+ ...e,
749
+ items: n
750
+ };
751
+ }).filter((e) => e.items.length > 0));
752
+ const o = t.flatMap((e) => e.items);
753
+ return o.forEach((e, n) => {
754
+ Object.assign(e, {
755
+ index: n
756
+ });
757
+ }), t.reduce((e, n) => {
758
+ const s = e + n.items.length;
759
+ return Object.assign(n, {
760
+ range: [e, s]
761
+ }), s;
762
+ }, 0), {
763
+ groups: t,
764
+ size: o.length
765
+ };
766
+ }
767
+ const Gt = ({
768
+ show: i,
769
+ hide: t,
770
+ ctx: o,
771
+ filter: e
772
+ }) => {
773
+ const { groups: n, size: s } = ge(() => Xe(e), [e]), r = me(), [d, u] = fe(0), m = Ft({ x: -999, y: -999 }), v = W((h) => {
774
+ const a = m.current;
775
+ if (!a)
776
+ return;
777
+ const { x: f, y: H } = h;
778
+ a.x = f, a.y = H;
779
+ }, []);
780
+ yt(() => {
781
+ s === 0 && i && (t == null || t());
782
+ }, [s, i]);
783
+ const g = W((h, a) => {
784
+ u((f) => {
785
+ const H = typeof h == "function" ? h(f) : h;
786
+ return a == null || a(H), H;
787
+ });
788
+ }, []), C = W((h) => {
789
+ var a;
790
+ (a = r.current.querySelector(`[data-index="${h}"]`)) == null || a.scrollIntoView({
791
+ behavior: "smooth",
792
+ block: "end"
793
+ });
794
+ }, []), k = W((h) => {
795
+ const a = n.flatMap((f) => f.items).at(h);
796
+ a && o && a.onRun(o), t == null || t();
797
+ }, [n]), b = W((h) => {
798
+ if (h.key === "Escape") {
799
+ h.preventDefault(), t == null || t();
800
+ return;
801
+ }
802
+ if (h.key === "ArrowDown")
803
+ return h.preventDefault(), g((a) => a < s - 1 ? a + 1 : a, C);
804
+ if (h.key === "ArrowUp")
805
+ return h.preventDefault(), g((a) => a <= 0 ? a : a - 1, C);
806
+ if (h.key === "ArrowLeft")
807
+ return h.preventDefault(), g((a) => {
808
+ const f = n.find((I) => I.range[0] <= a && I.range[1] > a);
809
+ if (!f)
810
+ return a;
811
+ const H = n[n.indexOf(f) - 1];
812
+ return H ? H.range[1] - 1 : a;
813
+ }, C);
814
+ if (h.key === "ArrowRight")
815
+ return h.preventDefault(), g((a) => {
816
+ const f = n.find((I) => I.range[0] <= a && I.range[1] > a);
817
+ if (!f)
818
+ return a;
819
+ const H = n[n.indexOf(f) + 1];
820
+ return H ? H.range[0] : a;
821
+ }, C);
822
+ h.key === "Enter" && (h.preventDefault(), k(d));
823
+ }, [t, n, d]), te = W((h) => (a) => {
824
+ const f = m.current;
825
+ if (!f)
826
+ return;
827
+ const { x: H, y: I } = a;
828
+ H === f.x && I === f.y || g(h);
829
+ }, []);
830
+ return yt(() => (i ? document.addEventListener("keydown", b, { capture: !0 }) : document.removeEventListener("keydown", b, { capture: !0 }), () => {
831
+ document.removeEventListener("keydown", b, { capture: !0 });
832
+ }), [i, b]), w`
833
+ <host onmousedown=${(h) => h.preventDefault()}>
834
+ <nav class="tab-group">
835
+ <ul>
836
+ ${n.map((h) => w`<li
837
+ key=${h.key}
838
+ onmousedown=${() => g(h.range[0], C)}
839
+ class=${d >= h.range[0] && d < h.range[1] ? "selected" : ""}
840
+ >
841
+ ${h.label}
842
+ </li>`)}
843
+ </ul>
844
+ </nav>
845
+ <div class="menu-groups" onmousemove=${v}>
846
+ ${n.map((h) => w`
847
+ <div key=${h.key} class="menu-group">
848
+ <h6>${h.label}</h6>
849
+ <ul>
850
+ ${h.items.map(
851
+ (a) => w`<li
852
+ key=${a.key}
853
+ data-index=${a.index}
854
+ class=${d === a.index ? "hover" : ""}
855
+ onmouseenter=${te(a.index)}
856
+ onmousedown=${() => {
857
+ var f;
858
+ (f = r.current.querySelector(`[data-index="${a.index}"]`)) == null || f.classList.add("active");
859
+ }}
860
+ onmouseup=${() => {
861
+ var f;
862
+ (f = r.current.querySelector(`[data-index="${a.index}"]`)) == null || f.classList.remove("active"), k(a.index);
863
+ }}
864
+ >
865
+ ${a.icon}
866
+ <span>${a.label}</span>
867
+ </li>`
868
+ )}
869
+ </ul>
870
+ </div>
871
+ `)}
872
+ </div>
873
+ </host>
874
+ `;
875
+ };
876
+ Gt.props = {
877
+ ctx: Object,
878
+ show: Boolean,
879
+ filter: String,
880
+ hide: Function
881
+ };
882
+ const Jt = zt(Gt), Qt = Ee("CREPE_MENU"), Pt = at({
883
+ show: () => {
884
+ },
885
+ hide: () => {
886
+ }
887
+ }, "menuAPICtx");
888
+ customElements.define("milkdown-slash-menu", Jt);
889
+ function Ye(i) {
890
+ i.set(Qt.key, {
891
+ view: (t) => new tn(i, t)
892
+ });
893
+ }
894
+ var M, B, L;
895
+ class tn {
896
+ constructor(t, o) {
897
+ p(this, M, void 0);
898
+ p(this, B, void 0);
899
+ p(this, L, void 0);
900
+ c(this, L, null), this.update = (n) => {
901
+ l(this, B).update(n);
902
+ }, this.show = (n) => {
903
+ c(this, L, n), l(this, M).filter = "", l(this, B).show();
904
+ }, this.hide = () => {
905
+ c(this, L, null), l(this, B).hide();
906
+ }, this.destroy = () => {
907
+ l(this, B).destroy(), l(this, M).remove();
908
+ }, c(this, M, new Jt()), l(this, M).hide = this.hide, l(this, M).ctx = t;
909
+ const e = this;
910
+ c(this, B, new Ie({
911
+ content: l(this, M),
912
+ debounce: 20,
913
+ tippyOptions: {
914
+ arrow: !1,
915
+ delay: 0,
916
+ duration: 0,
917
+ onShow: () => {
918
+ l(this, M).show = !0;
919
+ },
920
+ onHidden: () => {
921
+ l(this, M).show = !1;
922
+ }
923
+ },
924
+ shouldShow(n) {
925
+ if (pe(n.state.selection) || ue(n.state.selection))
926
+ return !1;
927
+ const s = this.getContent(n, (d) => ["paragraph", "heading"].includes(d.type.name));
928
+ if (s == null)
929
+ return !1;
930
+ const r = l(e, L);
931
+ return l(e, M).filter = s.startsWith("/") ? s.slice(1) : s, typeof r == "number" ? n.state.doc.resolve(r).node() !== n.state.doc.resolve(n.state.selection.from).node() ? (c(e, L, null), !1) : !0 : !!s.startsWith("/");
932
+ }
933
+ })), this.update(o), t.set(Pt.key, {
934
+ show: (n) => this.show(n),
935
+ hide: () => this.hide()
936
+ });
937
+ }
938
+ }
939
+ M = new WeakMap(), B = new WeakMap(), L = new WeakMap();
940
+ const en = w`
941
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
942
+ <g clip-path="url(#clip0_971_7680)">
943
+ <path d="M11 18C11 19.1 10.1 20 9 20C7.9 20 7 19.1 7 18C7 16.9 7.9 16 9 16C10.1 16 11 16.9 11 18ZM9 10C7.9 10 7 10.9 7 12C7 13.1 7.9 14 9 14C10.1 14 11 13.1 11 12C11 10.9 10.1 10 9 10ZM9 4C7.9 4 7 4.9 7 6C7 7.1 7.9 8 9 8C10.1 8 11 7.1 11 6C11 4.9 10.1 4 9 4ZM15 8C16.1 8 17 7.1 17 6C17 4.9 16.1 4 15 4C13.9 4 13 4.9 13 6C13 7.1 13.9 8 15 8ZM15 10C13.9 10 13 10.9 13 12C13 13.1 13.9 14 15 14C16.1 14 17 13.1 17 12C17 10.9 16.1 10 15 10ZM15 16C13.9 16 13 16.9 13 18C13 19.1 13.9 20 15 20C16.1 20 17 19.1 17 18C17 16.9 16.1 16 15 16Z" fill="#817567"/>
944
+ </g>
945
+ <defs>
946
+ <clipPath id="clip0_971_7680">
947
+ <rect width="24" height="24" fill="white"/>
948
+ </clipPath>
949
+ </defs>
950
+ </svg>
951
+ `, nn = w`
952
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
953
+ <g clip-path="url(#clip0_971_7676)">
954
+ <path d="M18 13H13V18C13 18.55 12.55 19 12 19C11.45 19 11 18.55 11 18V13H6C5.45 13 5 12.55 5 12C5 11.45 5.45 11 6 11H11V6C11 5.45 11.45 5 12 5C12.55 5 13 5.45 13 6V11H18C18.55 11 19 11.45 19 12C19 12.55 18.55 13 18 13Z" fill="#817567"/>
955
+ </g>
956
+ <defs>
957
+ <clipPath id="clip0_971_7676">
958
+ <rect width="24" height="24" fill="white"/>
959
+ </clipPath>
960
+ </defs>
961
+ </svg>
962
+ `, Xt = ({ onAdd: i }) => {
963
+ const t = Ft();
964
+ return yt(() => {
965
+ var n;
966
+ (n = t.current) == null || n.classList.remove("active");
967
+ }), w`
968
+ <host>
969
+ <div ref=${t} onmousedown=${(n) => {
970
+ var s;
971
+ n.preventDefault(), n.stopPropagation(), (s = t.current) == null || s.classList.add("active");
972
+ }} onmouseup=${(n) => {
973
+ var s;
974
+ n.preventDefault(), n.stopPropagation(), i == null || i(), (s = t.current) == null || s.classList.remove("active");
975
+ }} class="operation-item">
976
+ ${nn}
977
+ </div>
978
+ <div class="operation-item">
979
+ ${en}
980
+ </div>
981
+ </host>
982
+ `;
983
+ };
984
+ Xt.props = {
985
+ show: Boolean,
986
+ onAdd: Function
987
+ };
988
+ const Yt = zt(Xt);
989
+ var $, Z, ct;
990
+ class on {
991
+ constructor(t, o) {
992
+ p(this, $, void 0);
993
+ p(this, Z, void 0);
994
+ p(this, ct, void 0);
995
+ this.update = (n) => {
996
+ l(this, Z).update(n);
997
+ }, this.destroy = () => {
998
+ l(this, Z).destroy(), l(this, $).remove();
999
+ }, this.onAdd = () => {
1000
+ const n = l(this, ct), s = n.get(y);
1001
+ s.hasFocus() || s.focus();
1002
+ const { state: r, dispatch: d } = s, u = l(this, Z).activeNode;
1003
+ if (!u)
1004
+ return;
1005
+ const m = u.$pos, v = ["hr", "image-block"].includes(u.node.type.name), g = v ? u.node.nodeSize : u.node.content.size, C = m.pos + g + (["blockquote"].includes(m.parent.type.name) ? 1 : 0), k = ["blockquote"].includes(m.parent.type.name) || v ? 1 : 2;
1006
+ let b = r.tr.insert(C, Nt.type(n).create());
1007
+ b = b.setSelection(Ot.create(b.doc, C + k)), d(b.scrollIntoView()), l(this, Z).hide(), n.get(Pt.key).show(b.selection.from);
1008
+ }, c(this, ct, t);
1009
+ const e = new Yt();
1010
+ c(this, $, e), l(this, $).onAdd = this.onAdd, c(this, Z, new Ze({
1011
+ ctx: t,
1012
+ content: e,
1013
+ tippyOptions: {
1014
+ arrow: !1,
1015
+ delay: 0,
1016
+ duration: 0,
1017
+ onShow: () => {
1018
+ l(this, $).show = !0;
1019
+ },
1020
+ onHidden: () => {
1021
+ l(this, $).show = !1;
1022
+ }
1023
+ }
1024
+ })), this.update(o);
1025
+ }
1026
+ }
1027
+ $ = new WeakMap(), Z = new WeakMap(), ct = new WeakMap();
1028
+ customElements.define("milkdown-block-handle", Yt);
1029
+ function sn(i) {
1030
+ i.set(ft.key, {
1031
+ view: (t) => new on(i, t)
1032
+ });
1033
+ }
1034
+ const ln = '.milkdown milkdown-block-handle{cursor:pointer;display:flex;justify-content:center;align-items:center;gap:2px;padding-right:4px}.milkdown milkdown-block-handle .operation-item{border-radius:4px;width:32px;height:32px;padding:4px}.milkdown milkdown-block-handle .operation-item svg{width:24px;height:24px}.milkdown milkdown-block-handle .operation-item:hover{background:var(--crepe-color-hover)}.milkdown milkdown-block-handle .operation-item.active{background:var(--crepe-color-selected)}.milkdown milkdown-slash-menu{display:block;width:254px;font-family:var(--crepe-font-default);color:var(--crepe-color-on-surface);background:var(--crepe-color-surface);border-radius:12px;box-shadow:var(--crepe-shadow-1)}.milkdown milkdown-slash-menu ul{list-style-type:none}.milkdown milkdown-slash-menu ul li{cursor:pointer;border-radius:8px}.milkdown milkdown-slash-menu .tab-group{border-bottom:1px solid color-mix(in srgb,var(--crepe-color-outline),transparent 80%);padding:12px 12px 0}.milkdown milkdown-slash-menu .tab-group ul{padding:8px 10px;display:flex;gap:10px;flex-wrap:nowrap}.milkdown milkdown-slash-menu .tab-group ul li{padding:6px 10px;font-size:14px;font-style:normal;font-weight:600;line-height:20px}.milkdown milkdown-slash-menu .tab-group ul li:hover{background:var(--crepe-color-hover)}.milkdown milkdown-slash-menu .tab-group ul li.selected{background:var(--crepe-color-selected)}.milkdown milkdown-slash-menu .menu-groups{padding:0 12px 12px;max-height:420px;overflow:auto}.milkdown milkdown-slash-menu .menu-groups .menu-group h6{font-size:14px;font-style:normal;font-weight:600;line-height:20px;padding:14px 10px;text-transform:uppercase;color:color-mix(in srgb,var(--crepe-color-on-surface),transparent 40%)}.milkdown milkdown-slash-menu .menu-groups .menu-group li{display:flex;justify-content:flex-start;align-items:center;gap:16px;padding:14px 10px}.milkdown milkdown-slash-menu .menu-groups .menu-group li.hover{background:var(--crepe-color-hover)}.milkdown milkdown-slash-menu .menu-groups .menu-group li.active{background:var(--crepe-color-selected)}.milkdown milkdown-slash-menu .menu-groups .menu-group li>svg{width:24px;height:24px;color:var(--crepe-color-outline)}.milkdown milkdown-slash-menu .menu-groups .menu-group li>span{font-size:14px;font-style:normal;font-weight:600;line-height:20px}.milkdown milkdown-slash-menu .menu-groups .menu-group+.menu-group:before{content:"";display:block;height:1px;background:color-mix(in srgb,var(--crepe-color-outline),transparent 80%);margin:0 10px}', mn = (i) => {
1035
+ i.config(he(ln)).config(sn).config(Ye).use(Pt).use(ft).use(Qt);
1036
+ };
1037
+ export {
1038
+ mn as defineFeature
1039
+ };