reactjs-tiptap-editor 1.0.5 → 1.0.7

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 (165) hide show
  1. package/lib/{ActionMenuButton-CmYQziyT.js → ActionMenuButton-fTe9ka2F.js} +10 -13
  2. package/lib/ActionMenuButton-wU6jxKJv.cjs +1 -0
  3. package/lib/Attachment.cjs +2 -2
  4. package/lib/Attachment.js +23 -25
  5. package/lib/Blockquote.cjs +2 -2
  6. package/lib/Blockquote.js +5 -6
  7. package/lib/Bold.cjs +1 -1
  8. package/lib/Bold.js +5 -6
  9. package/lib/BulletList.cjs +1 -1
  10. package/lib/BulletList.js +11 -12
  11. package/lib/Clear.cjs +1 -1
  12. package/lib/Clear.js +3 -3
  13. package/lib/Code.cjs +1 -1
  14. package/lib/Code.js +9 -10
  15. package/lib/CodeBlock.cjs +39 -39
  16. package/lib/CodeBlock.js +837 -946
  17. package/lib/CodeView.cjs +1 -1
  18. package/lib/CodeView.js +8 -9
  19. package/lib/Color.cjs +1 -1
  20. package/lib/Color.js +18 -19
  21. package/lib/Column.cjs +1 -1
  22. package/lib/Column.js +5 -6
  23. package/lib/Drawer-BGSwHoka.cjs +1 -0
  24. package/lib/{Drawer-BCMlTDss.js → Drawer-DmtILKW4.js} +16 -17
  25. package/lib/Drawer.cjs +1 -1
  26. package/lib/Drawer.js +3 -3
  27. package/lib/Emoji.cjs +1 -1
  28. package/lib/Emoji.js +15 -16
  29. package/lib/Excalidraw-BG2U9i30.cjs +1 -0
  30. package/lib/{Excalidraw-1dKmqI-3.js → Excalidraw-CrG8fW-7.js} +31 -32
  31. package/lib/Excalidraw.cjs +1 -1
  32. package/lib/Excalidraw.js +2 -2
  33. package/lib/ExportPdf.cjs +1 -1
  34. package/lib/ExportPdf.js +17 -18
  35. package/lib/ExportWord.cjs +1 -1
  36. package/lib/ExportWord.js +5 -6
  37. package/lib/FontFamily.cjs +1 -1
  38. package/lib/FontFamily.js +5 -5
  39. package/lib/FontSize.cjs +1 -1
  40. package/lib/FontSize.js +5 -5
  41. package/lib/Heading.cjs +1 -1
  42. package/lib/Heading.js +15 -15
  43. package/lib/Highlight.cjs +1 -1
  44. package/lib/Highlight.js +7 -8
  45. package/lib/History.cjs +1 -1
  46. package/lib/History.js +8 -10
  47. package/lib/HorizontalRule.cjs +1 -1
  48. package/lib/HorizontalRule.js +5 -6
  49. package/lib/Icon-C3j4ls73.cjs +1 -0
  50. package/lib/{Icon-C-qYUAS1.js → Icon-CysGlJkv.js} +3 -4
  51. package/lib/{Iframe-B_GAN9lj.js → Iframe-BmqguWbj.js} +13 -14
  52. package/lib/Iframe-CXDghI6m.cjs +1 -0
  53. package/lib/Iframe.cjs +1 -1
  54. package/lib/Iframe.js +2 -2
  55. package/lib/Image.cjs +1 -1
  56. package/lib/Image.js +48 -49
  57. package/lib/ImageGif.cjs +1 -1
  58. package/lib/ImageGif.js +22 -23
  59. package/lib/ImportWord.cjs +2 -2
  60. package/lib/ImportWord.js +10 -11
  61. package/lib/Indent-B1glTHHl.cjs +1 -0
  62. package/lib/{Indent-DCTAYr8i.js → Indent-BhnGkEaY.js} +24 -25
  63. package/lib/Indent.cjs +1 -1
  64. package/lib/Indent.js +2 -2
  65. package/lib/Italic.cjs +1 -1
  66. package/lib/Italic.js +10 -11
  67. package/lib/Katex-BKL_6NWF.cjs +4 -0
  68. package/lib/{Katex-CxEAc1xw.js → Katex-D4eBjS34.js} +21 -22
  69. package/lib/Katex.cjs +1 -1
  70. package/lib/Katex.js +2 -2
  71. package/lib/LineHeight.cjs +1 -1
  72. package/lib/LineHeight.js +14 -15
  73. package/lib/Link.cjs +1 -1
  74. package/lib/Link.js +2 -2
  75. package/lib/{LinkEditBlock-C8rPUoNH.js → LinkEditBlock-D1eSM0kn.js} +55 -56
  76. package/lib/{LinkEditBlock-DiSXJpTN.cjs → LinkEditBlock-DW17TyCA.cjs} +2 -2
  77. package/lib/Mention.js +2 -2
  78. package/lib/Mermaid.cjs +2 -2
  79. package/lib/Mermaid.js +20 -20
  80. package/lib/MoreMark.cjs +1 -1
  81. package/lib/MoreMark.js +23 -25
  82. package/lib/OrderedList.cjs +1 -1
  83. package/lib/OrderedList.js +5 -6
  84. package/lib/SearchAndReplace.cjs +1 -1
  85. package/lib/SearchAndReplace.js +18 -19
  86. package/lib/SlashCommand.cjs +1 -1
  87. package/lib/SlashCommand.js +43 -41
  88. package/lib/Strike.cjs +1 -1
  89. package/lib/Strike.js +5 -6
  90. package/lib/{Table-B9w1GsCg.js → Table-BIZppoiY.js} +7 -8
  91. package/lib/Table-CIzgfvr9.cjs +9 -0
  92. package/lib/Table.cjs +1 -1
  93. package/lib/Table.js +1 -1
  94. package/lib/TaskList.cjs +1 -1
  95. package/lib/TaskList.js +13 -14
  96. package/lib/TextAlign.cjs +1 -1
  97. package/lib/TextAlign.js +17 -19
  98. package/lib/TextDirection.cjs +1 -1
  99. package/lib/TextDirection.js +17 -19
  100. package/lib/TextUnderline.cjs +1 -1
  101. package/lib/TextUnderline.js +5 -6
  102. package/lib/{Twitter-B-GTNq1g.js → Twitter-DhczYjbR.js} +19 -20
  103. package/lib/Twitter-DwWVNAV5.cjs +1 -0
  104. package/lib/Twitter.cjs +1 -1
  105. package/lib/Twitter.js +2 -2
  106. package/lib/Video.cjs +1 -1
  107. package/lib/Video.js +24 -25
  108. package/lib/bubble.cjs +4 -4
  109. package/lib/bubble.js +602 -591
  110. package/lib/button-B6ukqDUf.cjs +1 -0
  111. package/lib/{button-Crm67hfl.js → button-C81t4pb1.js} +3 -4
  112. package/lib/{checkbox-DViVmgJ6.js → checkbox-CUE9ex4D.js} +1 -1
  113. package/lib/{checkbox-NQC2MdGT.cjs → checkbox-ZdxysUFa.cjs} +1 -1
  114. package/lib/{dialog-DaHBd2zw.cjs → dialog-Cfx8yjkr.cjs} +1 -1
  115. package/lib/{dialog-Ce9Cjfft.js → dialog-DMJStzBb.js} +1 -1
  116. package/lib/{dropdown-menu-CQykJhBs.js → dropdown-menu-B8iyTZcP.js} +1 -1
  117. package/lib/{dropdown-menu-CSCDQtq0.cjs → dropdown-menu-Busg3FNn.cjs} +1 -1
  118. package/lib/{index-DuZCJJSp.js → index--knBGB61.js} +1118 -504
  119. package/lib/{index-nFjllrEl.js → index-BvYjBPF9.js} +7 -7
  120. package/lib/index-D42xFOzI.cjs +7 -0
  121. package/lib/{index-D-FhWysc.js → index-Dwt9--mS.js} +1 -1
  122. package/lib/{index-BeUrdBxf.js → index-RKufd2EL.js} +1 -1
  123. package/lib/{index-prphFVsp.js → index-ccgHvIfu.js} +1 -1
  124. package/lib/index.cjs +2 -2
  125. package/lib/index.js +8 -9
  126. package/lib/{input-tU3H__39.cjs → input-BxzQAIRv.cjs} +1 -1
  127. package/lib/{input-DfqFAyKo.js → input-DR_5pbuA.js} +1 -1
  128. package/lib/{isNumber-CTm1pIvN.js → isNumber-1y3eeW-y.js} +1 -1
  129. package/lib/label-BfWfLggp.cjs +1 -0
  130. package/lib/label-D-0oXKCn.js +18 -0
  131. package/lib/{popover-CoepUobG.js → popover-D3spkemr.js} +1 -1
  132. package/lib/{popover-CZWSQZ0q.cjs → popover-sP8CwbV-.cjs} +1 -1
  133. package/lib/{separator-6SnwzytZ.js → separator-rM48NeAo.js} +18 -18
  134. package/lib/{separator-DCQD8P6s.cjs → separator-yycaNdlI.cjs} +1 -1
  135. package/lib/{store-726Zjszt.cjs → store-BajRl43v.cjs} +1 -1
  136. package/lib/{store-ibARMQ3h.js → store-NKeQOve_.js} +1 -1
  137. package/lib/{tabs-DrkJL_C2.js → tabs-Cb6Bmpbb.js} +1 -1
  138. package/lib/{tabs-B_ArrG09.cjs → tabs-D2nCIOVL.cjs} +1 -1
  139. package/lib/{textarea-CIs52G8B.js → textarea-BYZu1lUC.js} +1 -1
  140. package/lib/{textarea-CmZVZKOo.cjs → textarea-Cbwi_h4h.cjs} +1 -1
  141. package/lib/{throttle-CGM5M2yG.js → throttle-CjwXmkIY.js} +1 -1
  142. package/lib/{updatePosition-DpMKxYdN.js → updatePosition-BAGpT34H.js} +1 -1
  143. package/lib/{useButtonProps-D0SrPzuG.js → useButtonProps-BIH_9bXT.js} +35 -47
  144. package/lib/useButtonProps-TfmRCM9r.cjs +1 -0
  145. package/package.json +5 -1
  146. package/lib/ActionMenuButton-BS1m0efQ.cjs +0 -1
  147. package/lib/Drawer-DPVStAKs.cjs +0 -1
  148. package/lib/Excalidraw-BP-xjF6S.cjs +0 -1
  149. package/lib/Icon-BjR_or8V.cjs +0 -1
  150. package/lib/Iframe-CeasogsD.cjs +0 -1
  151. package/lib/Indent-BGmFt7Dc.cjs +0 -1
  152. package/lib/Katex-CFZB-dZq.cjs +0 -4
  153. package/lib/Table-B4s9CpR4.cjs +0 -9
  154. package/lib/Twitter-BVlF0vEs.cjs +0 -1
  155. package/lib/button-xNppt_aK.cjs +0 -1
  156. package/lib/index-BQ17A_37.js +0 -393
  157. package/lib/index-CNzHZDls.cjs +0 -7
  158. package/lib/index-DmOTQudI.cjs +0 -1
  159. package/lib/label-DC33TZy_.js +0 -19
  160. package/lib/label-DkDE77kc.cjs +0 -1
  161. package/lib/toggle-Bo07J-M7.cjs +0 -1
  162. package/lib/toggle-MUGlaI1L.js +0 -92
  163. package/lib/tooltip-BTFcHrd9.js +0 -24
  164. package/lib/tooltip-DFjcKu9a.cjs +0 -1
  165. package/lib/useButtonProps-bei1vI37.cjs +0 -1
package/lib/bubble.js CHANGED
@@ -1,53 +1,52 @@
1
1
  import { jsx as p, Fragment as M, jsxs as S } from "react/jsx-runtime";
2
- import ms, { useRef as Lt, useEffect as st, useCallback as L, useState as z, useMemo as Pt, Fragment as ti } from "react";
3
- import { a3 as Yr, f as ws, E as ke, a4 as Gr, a5 as Jr, O as bs, a6 as ve, a7 as qr, U as ei, Q as ys, x as Ie, F as Oe, T as ni, A as Xr, v as Zr, a8 as Qr, a9 as to } from "./index-nFjllrEl.js";
4
- import { f as xs, s as Ss, o as ks, a as vs, b as Cs, d as _s, h as Es, i as Ts, c as ii } from "./floating-ui.dom-U1vPFQ5f.js";
5
- import { Plugin as Ce, PluginKey as te, NodeSelection as eo, TextSelection as no, SelectionRange as io, Selection as so } from "@tiptap/pm/state";
6
- import { C as ro, T as oo } from "./Table-B9w1GsCg.js";
7
- import { createPortal as Ds } from "react-dom";
8
- import { A as y } from "./toggle-MUGlaI1L.js";
2
+ import gs, { useRef as Lt, useEffect as st, useCallback as L, useState as z, useMemo as Pt, Fragment as ti } from "react";
3
+ import { a3 as jr, f as ms, E as ke, a4 as Yr, a5 as Gr, H as ws, a6 as ve, a7 as Jr, U as ei, Q as bs, x as Ae, F as Oe, T as ni, A as qr, v as Xr, a8 as Zr, a9 as Qr } from "./index-BvYjBPF9.js";
4
+ import { f as ys, s as xs, o as Ss, a as ks, b as vs, d as Cs, h as _s, i as Es, c as ii } from "./floating-ui.dom-U1vPFQ5f.js";
5
+ import { Plugin as Ce, PluginKey as te, NodeSelection as to, TextSelection as eo, SelectionRange as no, Selection as io } from "@tiptap/pm/state";
6
+ import { C as so, T as ro } from "./Table-BIZppoiY.js";
7
+ import { createPortal as Ts } from "react-dom";
8
+ import { k as X, A as y } from "./index--knBGB61.js";
9
9
  import { MultipleColumnNode as _i } from "./Column.js";
10
- import { u as X, p as je, V as Ei } from "./index-0OnGZkVF.js";
11
- import { c as Y, d as As } from "./useButtonProps-D0SrPzuG.js";
12
- import { b as Z } from "./index-DuZCJJSp.js";
10
+ import { u as Z, p as We, V as Ei } from "./index-0OnGZkVF.js";
11
+ import { c as Y, d as Ds } from "./useButtonProps-BIH_9bXT.js";
13
12
  import { d as _e } from "./delete-node-IyVmiRbI.js";
14
- import { C as lo, D as kn } from "./Drawer-BCMlTDss.js";
15
- import { Editor as co, makeDropdownToolbar as ao } from "easydrawer";
16
- import { s as Is, i as Os } from "./shortId-WJVkrvml.js";
17
- import { D as on, a as ln, b as cn, c as an, d as hn, e as ho } from "./dialog-Ce9Cjfft.js";
18
- import { d as Ms } from "./file-BLas99n7.js";
19
- import { B as Jt } from "./button-Crm67hfl.js";
20
- import { u as ee, K as Ke } from "./Katex-CxEAc1xw.js";
21
- import { S as Nt } from "./separator-6SnwzytZ.js";
22
- import { L as vn } from "./label-DC33TZy_.js";
23
- import { P as uo, a as fo, b as po } from "./popover-CoepUobG.js";
24
- import { I as Be } from "./input-DfqFAyKo.js";
25
- import { E as oe, t as go } from "./Excalidraw-1dKmqI-3.js";
26
- import { I as le, g as mo } from "./Iframe-B_GAN9lj.js";
27
- import wo from "katex";
28
- import { Pencil as bo, Trash2 as yo } from "lucide-react";
29
- import { T as Rs } from "./textarea-CIs52G8B.js";
30
- import { L as Ti, a as xo, R as So } from "./LinkEditBlock-C8rPUoNH.js";
31
- import { Image as ko } from "./Image.js";
32
- import { ImageGif as vo } from "./ImageGif.js";
33
- import { Video as Co } from "./Video.js";
13
+ import { S as Nt } from "./separator-rM48NeAo.js";
14
+ import { C as oo, D as kn } from "./Drawer-DmtILKW4.js";
15
+ import { Editor as lo, makeDropdownToolbar as co } from "easydrawer";
16
+ import { s as Is, i as As } from "./shortId-WJVkrvml.js";
17
+ import { B as Jt } from "./button-C81t4pb1.js";
18
+ import { D as on, a as ln, b as cn, c as an, d as hn, e as ao } from "./dialog-DMJStzBb.js";
19
+ import { d as Os } from "./file-BLas99n7.js";
20
+ import { u as ee, K as je } from "./Katex-D4eBjS34.js";
21
+ import { I as Be } from "./input-DR_5pbuA.js";
22
+ import { L as vn } from "./label-D-0oXKCn.js";
23
+ import { P as ho, a as uo, b as fo } from "./popover-D3spkemr.js";
24
+ import { E as oe, t as po } from "./Excalidraw-CrG8fW-7.js";
25
+ import { I as le, g as go } from "./Iframe-BmqguWbj.js";
26
+ import mo from "katex";
27
+ import { Pencil as wo, Trash2 as bo } from "lucide-react";
28
+ import { T as Ms } from "./textarea-BYZu1lUC.js";
29
+ import { L as Ti, a as yo, R as xo } from "./LinkEditBlock-D1eSM0kn.js";
30
+ import { Image as So } from "./Image.js";
31
+ import { ImageGif as ko } from "./ImageGif.js";
32
+ import { Video as vo } from "./Video.js";
34
33
  import { Mermaid as Un } from "./Mermaid.js";
35
- import { RichTextBold as _o } from "./Bold.js";
36
- import { RichTextCode as Eo } from "./Code.js";
37
- import "./index-prphFVsp.js";
38
- import { RichTextColor as To } from "./Color.js";
39
- import { RichTextHighlight as Do } from "./Highlight.js";
40
- import { RichTextItalic as Ao } from "./Italic.js";
34
+ import { RichTextBold as Co } from "./Bold.js";
35
+ import { RichTextCode as _o } from "./Code.js";
36
+ import "./index-ccgHvIfu.js";
37
+ import { RichTextColor as Eo } from "./Color.js";
38
+ import { RichTextHighlight as To } from "./Highlight.js";
39
+ import { RichTextItalic as Do } from "./Italic.js";
41
40
  import { RichTextStrike as Io } from "./Strike.js";
42
- import { RichTextAlign as Oo, TextAlign as Mo } from "./TextAlign.js";
43
- import { RichTextUnderline as Di } from "./TextUnderline.js";
44
- import { T as Ai, F as Ro } from "./Twitter-B-GTNq1g.js";
41
+ import { RichTextAlign as Ao, TextAlign as Oo } from "./TextAlign.js";
42
+ import { RichTextUnderline as Mo } from "./TextUnderline.js";
43
+ import { T as Di, F as Ro } from "./Twitter-DhczYjbR.js";
45
44
  import { DecorationSet as Ii, Decoration as No } from "@tiptap/pm/view";
46
45
  import { NodeRange as Uo } from "@tiptap/pm/model";
47
- import { I as rt } from "./Icon-C-qYUAS1.js";
48
- import { Clear as Lo } from "./Clear.js";
49
- import { I as Po, a as Oi, s as Mi } from "./Indent-DCTAYr8i.js";
50
- import { D as Bo, a as Vo, b as Ho, f as mt, d as $o, g as Ri, h as Ni, i as Ui, j as Li } from "./dropdown-menu-CQykJhBs.js";
46
+ import { I as rt } from "./Icon-CysGlJkv.js";
47
+ import { D as Lo, a as Po, b as Bo, f as mt, d as Vo, g as Ai, h as Oi, i as Mi, j as Ri } from "./dropdown-menu-B8iyTZcP.js";
48
+ import { Clear as Ho } from "./Clear.js";
49
+ import { I as $o, a as Ni, s as Ui } from "./Indent-BhnGkEaY.js";
51
50
  function Fo(e, t) {
52
51
  const n = Math.min(e.top, t.top), i = Math.max(e.bottom, t.bottom), s = Math.min(e.left, t.left), o = Math.max(e.right, t.right) - s, l = i - n, c = s, a = n;
53
52
  return new DOMRect(c, a, o, l);
@@ -80,7 +79,7 @@ var zo = class {
80
79
  onUpdate: void 0,
81
80
  onDestroy: void 0
82
81
  }, this.shouldShow = ({ view: d, state: h, from: u, to: f }) => {
83
- const { doc: g, selection: m } = h, { empty: b } = m, w = !g.textBetween(u, f).length && Yr(h.selection), D = this.element.contains(document.activeElement);
82
+ const { doc: g, selection: m } = h, { empty: b } = m, w = !g.textBetween(u, f).length && jr(h.selection), D = this.element.contains(document.activeElement);
84
83
  return !(!(d.hasFocus() || D) || b || w || !this.editor.isEditable);
85
84
  }, this.mousedownHandler = () => {
86
85
  this.preventHide = !0;
@@ -128,16 +127,16 @@ var zo = class {
128
127
  }
129
128
  get middlewares() {
130
129
  const e = [];
131
- return this.floatingUIOptions.flip && e.push(xs(typeof this.floatingUIOptions.flip != "boolean" ? this.floatingUIOptions.flip : void 0)), this.floatingUIOptions.shift && e.push(
132
- Ss(typeof this.floatingUIOptions.shift != "boolean" ? this.floatingUIOptions.shift : void 0)
130
+ return this.floatingUIOptions.flip && e.push(ys(typeof this.floatingUIOptions.flip != "boolean" ? this.floatingUIOptions.flip : void 0)), this.floatingUIOptions.shift && e.push(
131
+ xs(typeof this.floatingUIOptions.shift != "boolean" ? this.floatingUIOptions.shift : void 0)
133
132
  ), this.floatingUIOptions.offset && e.push(
134
- ks(typeof this.floatingUIOptions.offset != "boolean" ? this.floatingUIOptions.offset : void 0)
135
- ), this.floatingUIOptions.arrow && e.push(vs(this.floatingUIOptions.arrow)), this.floatingUIOptions.size && e.push(Cs(typeof this.floatingUIOptions.size != "boolean" ? this.floatingUIOptions.size : void 0)), this.floatingUIOptions.autoPlacement && e.push(
136
- _s(
133
+ Ss(typeof this.floatingUIOptions.offset != "boolean" ? this.floatingUIOptions.offset : void 0)
134
+ ), this.floatingUIOptions.arrow && e.push(ks(this.floatingUIOptions.arrow)), this.floatingUIOptions.size && e.push(vs(typeof this.floatingUIOptions.size != "boolean" ? this.floatingUIOptions.size : void 0)), this.floatingUIOptions.autoPlacement && e.push(
135
+ Cs(
137
136
  typeof this.floatingUIOptions.autoPlacement != "boolean" ? this.floatingUIOptions.autoPlacement : void 0
138
137
  )
139
- ), this.floatingUIOptions.hide && e.push(Es(typeof this.floatingUIOptions.hide != "boolean" ? this.floatingUIOptions.hide : void 0)), this.floatingUIOptions.inline && e.push(
140
- Ts(typeof this.floatingUIOptions.inline != "boolean" ? this.floatingUIOptions.inline : void 0)
138
+ ), this.floatingUIOptions.hide && e.push(_s(typeof this.floatingUIOptions.hide != "boolean" ? this.floatingUIOptions.hide : void 0)), this.floatingUIOptions.inline && e.push(
139
+ Es(typeof this.floatingUIOptions.inline != "boolean" ? this.floatingUIOptions.inline : void 0)
141
140
  ), e;
142
141
  }
143
142
  get virtualElement() {
@@ -145,12 +144,12 @@ var zo = class {
145
144
  const { selection: t } = this.editor.state, n = (e = this.getReferencedVirtualElement) == null ? void 0 : e.call(this);
146
145
  if (n)
147
146
  return n;
148
- const i = ws(this.view, t.from, t.to);
147
+ const i = ms(this.view, t.from, t.to);
149
148
  let s = {
150
149
  getBoundingClientRect: () => i,
151
150
  getClientRects: () => [i]
152
151
  };
153
- if (t instanceof eo) {
152
+ if (t instanceof to) {
154
153
  let r = this.view.nodeDOM(t.from);
155
154
  const o = r.dataset.nodeViewWrapper ? r : r.querySelector("[data-node-view-wrapper]");
156
155
  o && (r = o), r && (s = {
@@ -158,7 +157,7 @@ var zo = class {
158
157
  getClientRects: () => [r.getBoundingClientRect()]
159
158
  });
160
159
  }
161
- if (t instanceof ro) {
160
+ if (t instanceof so) {
162
161
  const { $anchorCell: r, $headCell: o } = t, l = r ? r.pos : o.pos, c = o ? o.pos : r.pos, a = this.view.nodeDOM(l), d = this.view.nodeDOM(c);
163
162
  if (!a || !d)
164
163
  return;
@@ -219,7 +218,7 @@ var zo = class {
219
218
  destroy() {
220
219
  this.hide(), this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.removeEventListener("dragstart", this.dragstartHandler), window.removeEventListener("resize", this.resizeHandler), this.scrollTarget.removeEventListener("scroll", this.resizeHandler), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler), this.editor.off("transaction", this.transactionHandler), this.floatingUIOptions.onDestroy && this.floatingUIOptions.onDestroy();
221
220
  }
222
- }, Ns = (e) => new Ce({
221
+ }, Rs = (e) => new Ce({
223
222
  key: typeof e.pluginKey == "string" ? new te(e.pluginKey) : e.pluginKey,
224
223
  view: (t) => new zo({ view: t, ...e })
225
224
  });
@@ -236,7 +235,7 @@ ke.create({
236
235
  },
237
236
  addProseMirrorPlugins() {
238
237
  return this.options.element ? [
239
- Ns({
238
+ Rs({
240
239
  pluginKey: this.options.pluginKey,
241
240
  editor: this.editor,
242
241
  element: this.options.element,
@@ -249,7 +248,7 @@ ke.create({
249
248
  ] : [];
250
249
  }
251
250
  });
252
- var Wo = class {
251
+ var Ko = class {
253
252
  constructor({ editor: e, element: t, view: n, options: i, appendTo: s, shouldShow: r }) {
254
253
  this.preventHide = !1, this.isVisible = !1, this.shouldShow = ({ view: o, state: l }) => {
255
254
  const { selection: c } = l, { $anchor: a, empty: d } = c, h = a.depth === 1, u = a.parent.isTextblock && !a.parent.type.spec.code && !a.parent.textContent && a.parent.childCount === 0 && !this.getTextContent(a.parent);
@@ -291,20 +290,20 @@ var Wo = class {
291
290
  }, this.element.tabIndex = 0, r && (this.shouldShow = r), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.update(n, n.state), this.getShouldShow() && (this.show(), this.updatePosition());
292
291
  }
293
292
  getTextContent(e) {
294
- return Gr(e, { textSerializers: Jr(this.editor.schema) });
293
+ return Yr(e, { textSerializers: Gr(this.editor.schema) });
295
294
  }
296
295
  get middlewares() {
297
296
  const e = [];
298
- return this.floatingUIOptions.flip && e.push(xs(typeof this.floatingUIOptions.flip != "boolean" ? this.floatingUIOptions.flip : void 0)), this.floatingUIOptions.shift && e.push(
299
- Ss(typeof this.floatingUIOptions.shift != "boolean" ? this.floatingUIOptions.shift : void 0)
297
+ return this.floatingUIOptions.flip && e.push(ys(typeof this.floatingUIOptions.flip != "boolean" ? this.floatingUIOptions.flip : void 0)), this.floatingUIOptions.shift && e.push(
298
+ xs(typeof this.floatingUIOptions.shift != "boolean" ? this.floatingUIOptions.shift : void 0)
300
299
  ), this.floatingUIOptions.offset && e.push(
301
- ks(typeof this.floatingUIOptions.offset != "boolean" ? this.floatingUIOptions.offset : void 0)
302
- ), this.floatingUIOptions.arrow && e.push(vs(this.floatingUIOptions.arrow)), this.floatingUIOptions.size && e.push(Cs(typeof this.floatingUIOptions.size != "boolean" ? this.floatingUIOptions.size : void 0)), this.floatingUIOptions.autoPlacement && e.push(
303
- _s(
300
+ Ss(typeof this.floatingUIOptions.offset != "boolean" ? this.floatingUIOptions.offset : void 0)
301
+ ), this.floatingUIOptions.arrow && e.push(ks(this.floatingUIOptions.arrow)), this.floatingUIOptions.size && e.push(vs(typeof this.floatingUIOptions.size != "boolean" ? this.floatingUIOptions.size : void 0)), this.floatingUIOptions.autoPlacement && e.push(
302
+ Cs(
304
303
  typeof this.floatingUIOptions.autoPlacement != "boolean" ? this.floatingUIOptions.autoPlacement : void 0
305
304
  )
306
- ), this.floatingUIOptions.hide && e.push(Es(typeof this.floatingUIOptions.hide != "boolean" ? this.floatingUIOptions.hide : void 0)), this.floatingUIOptions.inline && e.push(
307
- Ts(typeof this.floatingUIOptions.inline != "boolean" ? this.floatingUIOptions.inline : void 0)
305
+ ), this.floatingUIOptions.hide && e.push(_s(typeof this.floatingUIOptions.hide != "boolean" ? this.floatingUIOptions.hide : void 0)), this.floatingUIOptions.inline && e.push(
306
+ Es(typeof this.floatingUIOptions.inline != "boolean" ? this.floatingUIOptions.inline : void 0)
308
307
  ), e;
309
308
  }
310
309
  getShouldShow(e) {
@@ -320,7 +319,7 @@ var Wo = class {
320
319
  });
321
320
  }
322
321
  updatePosition() {
323
- const { selection: e } = this.editor.state, t = ws(this.view, e.from, e.to);
322
+ const { selection: e } = this.editor.state, t = ms(this.view, e.from, e.to);
324
323
  ii({
325
324
  getBoundingClientRect: () => t,
326
325
  getClientRects: () => [t]
@@ -350,9 +349,9 @@ var Wo = class {
350
349
  destroy() {
351
350
  this.hide(), this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler), this.floatingUIOptions.onDestroy && this.floatingUIOptions.onDestroy();
352
351
  }
353
- }, Us = (e) => new Ce({
352
+ }, Ns = (e) => new Ce({
354
353
  key: typeof e.pluginKey == "string" ? new te(e.pluginKey) : e.pluginKey,
355
- view: (t) => new Wo({ view: t, ...e })
354
+ view: (t) => new Ko({ view: t, ...e })
356
355
  });
357
356
  ke.create({
358
357
  name: "floatingMenu",
@@ -367,7 +366,7 @@ ke.create({
367
366
  },
368
367
  addProseMirrorPlugins() {
369
368
  return this.options.element ? [
370
- Us({
369
+ Ns({
371
370
  pluginKey: this.options.pluginKey,
372
371
  editor: this.editor,
373
372
  element: this.options.element,
@@ -378,7 +377,7 @@ ke.create({
378
377
  ] : [];
379
378
  }
380
379
  });
381
- var tt = ms.forwardRef(
380
+ var tt = gs.forwardRef(
382
381
  ({
383
382
  pluginKey: e = "bubbleMenu",
384
383
  editor: t,
@@ -393,7 +392,7 @@ var tt = ms.forwardRef(
393
392
  }, d) => {
394
393
  const h = Lt(document.createElement("div"));
395
394
  typeof d == "function" ? d(h.current) : d && (d.current = h.current);
396
- const { editor: u } = bs(), f = t || u, g = {
395
+ const { editor: u } = ws(), f = t || u, g = {
397
396
  updateDelay: n,
398
397
  resizeDelay: i,
399
398
  appendTo: s,
@@ -411,7 +410,7 @@ var tt = ms.forwardRef(
411
410
  }
412
411
  const b = h.current;
413
412
  b.style.visibility = "hidden", b.style.position = "absolute";
414
- const w = Ns({
413
+ const w = Rs({
415
414
  ...m.current,
416
415
  editor: f,
417
416
  element: b
@@ -423,14 +422,14 @@ var tt = ms.forwardRef(
423
422
  b.parentNode && b.parentNode.removeChild(b);
424
423
  });
425
424
  };
426
- }, [f]), Ds(/* @__PURE__ */ p("div", { ...a, children: c }), h.current);
425
+ }, [f]), Ts(/* @__PURE__ */ p("div", { ...a, children: c }), h.current);
427
426
  }
428
427
  );
429
- ms.forwardRef(
428
+ gs.forwardRef(
430
429
  ({ pluginKey: e = "floatingMenu", editor: t, appendTo: n, shouldShow: i = null, options: s, children: r, ...o }, l) => {
431
430
  const c = Lt(document.createElement("div"));
432
431
  typeof l == "function" ? l(c.current) : l && (l.current = c.current);
433
- const { editor: a } = bs();
432
+ const { editor: a } = ws();
434
433
  return st(() => {
435
434
  const d = c.current;
436
435
  if (d.style.visibility = "hidden", d.style.position = "absolute", t != null && t.isDestroyed || a != null && a.isDestroyed)
@@ -442,7 +441,7 @@ ms.forwardRef(
442
441
  );
443
442
  return;
444
443
  }
445
- const u = Us({
444
+ const u = Ns({
446
445
  editor: h,
447
446
  element: d,
448
447
  pluginKey: e,
@@ -455,16 +454,17 @@ ms.forwardRef(
455
454
  d.parentNode && d.parentNode.removeChild(d);
456
455
  });
457
456
  };
458
- }, [t, a, n, e, i, s]), Ds(/* @__PURE__ */ p("div", { ...o, children: r }), c.current);
457
+ }, [t, a, n, e, i, s]), Ts(/* @__PURE__ */ p("div", { ...o, children: r }), c.current);
459
458
  }
460
459
  );
461
- function zd() {
462
- const e = Z(), t = Y(), { t: n } = X(), i = L(() => t.isActive(_i.name), [t]), s = L(() => _e(_i.name, t), [t]), r = L(() => t.chain().focus().addColBefore().run(), [t]), o = L(() => t.chain().focus().addColAfter().run(), [t]), l = L(() => t.chain().focus().deleteCol().run(), [t]);
460
+ function Fd() {
461
+ const e = X(), t = Y(), { t: n } = Z(), i = L(() => t.isActive(_i.name), [t]), s = L(() => _e(_i.name, t), [t]), r = L(() => t.chain().focus().addColBefore().run(), [t]), o = L(() => t.chain().focus().addColAfter().run(), [t]), l = L(() => t.chain().focus().deleteCol().run(), [t]);
463
462
  return e ? /* @__PURE__ */ p(
464
463
  tt,
465
464
  {
466
465
  editor: t,
467
466
  options: { placement: "bottom", offset: 8, flip: !0 },
467
+ pluginKey: "RichTextBubbleColumns",
468
468
  shouldShow: i,
469
469
  children: /* @__PURE__ */ S("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: [
470
470
  /* @__PURE__ */ p(
@@ -503,7 +503,7 @@ function zd() {
503
503
  }
504
504
  ) : /* @__PURE__ */ p(M, {});
505
505
  }
506
- function jo(e, t) {
506
+ function Wo(e, t) {
507
507
  const n = ["size-small", "size-medium", "size-large"], i = [
508
508
  "SizeS",
509
509
  "SizeM",
@@ -515,12 +515,12 @@ function jo(e, t) {
515
515
  componentProps: {
516
516
  tooltip: t(`editor.${s.replace("-", ".")}.tooltip`),
517
517
  icon: i[r],
518
- action: () => e.commands.updateImage({ width: je[s] }),
519
- isActive: () => e.isActive("image", { width: je[s] })
518
+ action: () => e.commands.updateImage({ width: We[s] }),
519
+ isActive: () => e.isActive("image", { width: We[s] })
520
520
  }
521
521
  }));
522
522
  }
523
- function Ko(e, t) {
523
+ function jo(e, t) {
524
524
  const n = ["size-small", "size-medium", "size-large"], i = [
525
525
  "SizeS",
526
526
  "SizeM",
@@ -532,8 +532,8 @@ function Ko(e, t) {
532
532
  componentProps: {
533
533
  tooltip: t(`editor.${s.replace("-", ".")}.tooltip`),
534
534
  icon: i[r],
535
- action: () => e.commands.updateImageGif({ width: je[s] }),
536
- isActive: () => e.isActive("image", { width: je[s] })
535
+ action: () => e.commands.updateImageGif({ width: We[s] }),
536
+ isActive: () => e.isActive("image", { width: We[s] })
537
537
  }
538
538
  }));
539
539
  }
@@ -686,7 +686,7 @@ function Qo(e, t) {
686
686
  }
687
687
  }
688
688
  },
689
- ...jo(e, t),
689
+ ...Wo(e, t),
690
690
  ...Yo(e, t),
691
691
  {
692
692
  type: "remove",
@@ -705,7 +705,7 @@ function Qo(e, t) {
705
705
  }
706
706
  function tl(e, t) {
707
707
  return [
708
- ...Ko(e, t),
708
+ ...jo(e, t),
709
709
  ...Go(e, t),
710
710
  {
711
711
  type: "remove",
@@ -802,10 +802,10 @@ function sl({ editor: e, attrs: t, extension: n }) {
802
802
  const [i, s] = z(!1), r = Lt(null), o = Lt(null), { alt: l, align: c } = t, a = n == null ? void 0 : n.options.upload, d = () => {
803
803
  (async () => {
804
804
  const x = document.querySelector("#easydrawer");
805
- x && (r.current = new co(x, {
805
+ x && (r.current = new lo(x, {
806
806
  wheelEventsEnabled: !1,
807
807
  disableZoom: !0
808
- }), o.current = ao(r.current), o.current.addDefaultToolWidgets(), r.current.loadFromSVG(decodeURIComponent(l)));
808
+ }), o.current = co(r.current), o.current.addDefaultToolWidgets(), r.current.loadFromSVG(decodeURIComponent(l)));
809
809
  })();
810
810
  };
811
811
  st(() => {
@@ -816,9 +816,9 @@ function sl({ editor: e, attrs: t, extension: n }) {
816
816
  const h = async () => {
817
817
  if (r.current) {
818
818
  const E = r.current.toSVG(), x = E.outerHTML, k = `drawer-${Is()}.svg`;
819
- let N = Os(E.outerHTML);
819
+ let N = As(E.outerHTML);
820
820
  if (a) {
821
- const H = Ms(N, k);
821
+ const H = Os(N, k);
822
822
  N = await a(H);
823
823
  }
824
824
  e == null || e.chain().focus().setDrawer(
@@ -854,7 +854,7 @@ function sl({ editor: e, attrs: t, extension: n }) {
854
854
  }, D = (E) => {
855
855
  const x = r.current.toolController.getPrimaryTools()[5], k = o.current.getWidgetById("shape");
856
856
  x && k && (x.setBorderColor(E), k.serializeState());
857
- }, A = () => {
857
+ }, I = () => {
858
858
  if (ce) {
859
859
  for (; r.current.history.redoStackSize > 0; )
860
860
  r.current.history.redo();
@@ -888,7 +888,7 @@ function sl({ editor: e, attrs: t, extension: n }) {
888
888
  }
889
889
  ),
890
890
  /* @__PURE__ */ p(
891
- lo,
891
+ oo,
892
892
  {
893
893
  changeBorderColorShape: D,
894
894
  changeColorShape: b,
@@ -896,7 +896,7 @@ function sl({ editor: e, attrs: t, extension: n }) {
896
896
  onClear: () => {
897
897
  if (!ce) {
898
898
  for (; r.current.history.undoStackSize > 0; )
899
- A();
899
+ I();
900
900
  ce = !0;
901
901
  }
902
902
  },
@@ -904,7 +904,7 @@ function sl({ editor: e, attrs: t, extension: n }) {
904
904
  ce || r.current.history.redo();
905
905
  },
906
906
  onThicknessChange: w,
907
- onUndo: A,
907
+ onUndo: I,
908
908
  refEditor: r,
909
909
  setColorHighlight: g,
910
910
  setColorPen: u,
@@ -943,8 +943,8 @@ function rl({ item: e, disabled: t, editor: n }) {
943
943
  }
944
944
  ) }) : /* @__PURE__ */ p(M, {});
945
945
  }
946
- function Wd() {
947
- const { lang: e, t } = X(), n = Z(), i = Y(), s = ee(i, kn.name), r = As(kn.name), o = ({ editor: c }) => {
946
+ function zd() {
947
+ const { lang: e, t } = Z(), n = X(), i = Y(), s = ee(i, kn.name), r = Ds(kn.name), o = ({ editor: c }) => {
948
948
  const { selection: a } = c.view.state, { $from: d, to: h } = a;
949
949
  let u = !1;
950
950
  return c.view.state.doc.nodesBetween(d.pos, h, (f) => {
@@ -957,6 +957,7 @@ function Wd() {
957
957
  {
958
958
  editor: i,
959
959
  options: { placement: "bottom", offset: 8, flip: !0 },
960
+ pluginKey: "RichTextBubbleDrawer",
960
961
  shouldShow: o,
961
962
  children: l != null && l.length ? /* @__PURE__ */ p("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: l == null ? void 0 : l.map((c, a) => c.type === "edit" && (s != null && s.src) ? /* @__PURE__ */ p(
962
963
  sl,
@@ -977,8 +978,8 @@ function Wd() {
977
978
  }
978
979
  ) : /* @__PURE__ */ p(M, {});
979
980
  }
980
- const Ls = ({ width: e, maxWidth: t, height: n, onOk: i, children: s }) => {
981
- const { t: r } = X(), [o, l] = z({
981
+ const Us = ({ width: e, maxWidth: t, height: n, onOk: i, children: s }) => {
982
+ const { t: r } = Z(), [o, l] = z({
982
983
  width: "",
983
984
  height: "",
984
985
  maxWidth: ""
@@ -993,9 +994,9 @@ const Ls = ({ width: e, maxWidth: t, height: n, onOk: i, children: s }) => {
993
994
  function c(a) {
994
995
  a.preventDefault(), a.stopPropagation(), i(o);
995
996
  }
996
- return /* @__PURE__ */ S(uo, { modal: !0, children: [
997
- /* @__PURE__ */ p(fo, { asChild: !0, children: s }),
998
- /* @__PURE__ */ p(po, { children: /* @__PURE__ */ S(
997
+ return /* @__PURE__ */ S(ho, { modal: !0, children: [
998
+ /* @__PURE__ */ p(uo, { asChild: !0, children: s }),
999
+ /* @__PURE__ */ p(fo, { children: /* @__PURE__ */ S(
999
1000
  "form",
1000
1001
  {
1001
1002
  className: "richtext-flex richtext-flex-col richtext-gap-2",
@@ -1054,8 +1055,8 @@ function ol(e) {
1054
1055
  s.disconnect();
1055
1056
  }), { width: Mt.get("width") };
1056
1057
  }
1057
- function jd() {
1058
- const e = Z(), t = Y(), { t: n } = X(), { width: i } = ol(t), s = ee(t, oe.name, {
1058
+ function Kd() {
1059
+ const e = X(), t = Y(), { t: n } = Z(), { width: i } = ol(t), s = ee(t, oe.name, {
1059
1060
  defaultShowPicker: !1,
1060
1061
  createUser: "",
1061
1062
  width: 0,
@@ -1066,7 +1067,7 @@ function jd() {
1066
1067
  },
1067
1068
  [t]
1068
1069
  ), d = L(() => {
1069
- go({ ...s, editor: t });
1070
+ po({ ...s, editor: t });
1070
1071
  }, [t, s]), h = L(() => t.isActive(oe.name), [t]), u = L(() => _e(oe.name, t), [t]);
1071
1072
  return st(() => {
1072
1073
  r && (d(), t.chain().updateAttributes(oe.name, { defaultShowPicker: !1 }).focus().run());
@@ -1075,6 +1076,7 @@ function jd() {
1075
1076
  {
1076
1077
  editor: t,
1077
1078
  options: { placement: "bottom", offset: 8, flip: !0 },
1079
+ pluginKey: "RichTextBubbleExcalidraw",
1078
1080
  shouldShow: h,
1079
1081
  children: /* @__PURE__ */ S("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: [
1080
1082
  /* @__PURE__ */ p(
@@ -1086,7 +1088,7 @@ function jd() {
1086
1088
  }
1087
1089
  ),
1088
1090
  /* @__PURE__ */ p(
1089
- Ls,
1091
+ Us,
1090
1092
  {
1091
1093
  height: c,
1092
1094
  maxWidth: i,
@@ -1113,8 +1115,8 @@ function jd() {
1113
1115
  }
1114
1116
  ) : /* @__PURE__ */ p(M, {});
1115
1117
  }
1116
- function Kd() {
1117
- const e = Z(), t = Y(), { t: n } = X(), { width: i, height: s, src: r } = ee(t, le.name, {
1118
+ function Wd() {
1119
+ const e = X(), t = Y(), { t: n } = Z(), { width: i, height: s, src: r } = ee(t, le.name, {
1118
1120
  width: 0,
1119
1121
  height: 0,
1120
1122
  src: "",
@@ -1127,9 +1129,9 @@ function Kd() {
1127
1129
  o && a(r);
1128
1130
  }, [o, r]);
1129
1131
  const h = L((w) => {
1130
- var A;
1131
- (A = w == null ? void 0 : w.preventDefault) == null || A.call(w);
1132
- const D = mo(c);
1132
+ var I;
1133
+ (I = w == null ? void 0 : w.preventDefault) == null || I.call(w);
1134
+ const D = go(c);
1133
1135
  t.chain().updateAttributes(le.name, {
1134
1136
  src: (D == null ? void 0 : D.src) || c
1135
1137
  }).setNodeSelection(t.state.selection.from).focus().run(), l(!1);
@@ -1149,6 +1151,7 @@ function Kd() {
1149
1151
  {
1150
1152
  editor: t,
1151
1153
  options: { placement: "bottom", offset: 8, flip: !0 },
1154
+ pluginKey: "RichTextBubbleIframe",
1152
1155
  shouldShow: m,
1153
1156
  children: /* @__PURE__ */ S("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: [
1154
1157
  /* @__PURE__ */ p(
@@ -1168,7 +1171,7 @@ function Kd() {
1168
1171
  }
1169
1172
  ),
1170
1173
  /* @__PURE__ */ p(
1171
- Ls,
1174
+ Us,
1172
1175
  {
1173
1176
  height: s,
1174
1177
  onOk: g,
@@ -1201,7 +1204,7 @@ function Kd() {
1201
1204
  children: [
1202
1205
  /* @__PURE__ */ p(ln, {}),
1203
1206
  /* @__PURE__ */ S(cn, { children: [
1204
- /* @__PURE__ */ p(ho, { children: /* @__PURE__ */ p(an, { children: "Edit Link Iframe" }) }),
1207
+ /* @__PURE__ */ p(ao, { children: /* @__PURE__ */ p(an, { children: "Edit Link Iframe" }) }),
1205
1208
  /* @__PURE__ */ p(
1206
1209
  Be,
1207
1210
  {
@@ -1241,20 +1244,20 @@ function ll({
1241
1244
  visible: t,
1242
1245
  toggleVisible: n
1243
1246
  }) {
1244
- const { t: i } = X(), s = Y(), r = ee(s, Ke.name, {
1247
+ const { t: i } = Z(), s = Y(), r = ee(s, je.name, {
1245
1248
  text: "",
1246
1249
  defaultShowPicker: !1
1247
1250
  }), { text: o, defaultShowPicker: l } = r, [c, a] = z(o || "");
1248
1251
  st(() => {
1249
1252
  t && a(o || "");
1250
1253
  }, [t]), st(() => {
1251
- l && (n(!0), s.chain().updateAttributes(Ke.name, { defaultShowPicker: !1 }).focus().run());
1254
+ l && (n(!0), s.chain().updateAttributes(je.name, { defaultShowPicker: !1 }).focus().run());
1252
1255
  }, [s, l, n]);
1253
1256
  const d = L(() => {
1254
1257
  s.chain().focus().setKatex({ text: c }).run(), a(""), n(!1);
1255
1258
  }, [s, c, n]), h = Pt(() => {
1256
1259
  try {
1257
- return wo.renderToString(`${c}`);
1260
+ return mo.renderToString(`${c}`);
1258
1261
  } catch {
1259
1262
  return c;
1260
1263
  }
@@ -1283,7 +1286,7 @@ function ll({
1283
1286
  style: { height: "100%", border: "1px solid hsl(var(--border))" },
1284
1287
  children: /* @__PURE__ */ S("div", { className: "richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]", children: [
1285
1288
  /* @__PURE__ */ p(
1286
- Rs,
1289
+ Ms,
1287
1290
  {
1288
1291
  autoFocus: !0,
1289
1292
  className: "richtext-flex-1",
@@ -1321,13 +1324,14 @@ function ll({
1321
1324
  }
1322
1325
  );
1323
1326
  }
1324
- function Yd() {
1325
- const e = Z(), t = Y(), [n, i] = z(!1), s = L(() => t.isActive(Ke.name), [t]), r = L(() => _e(Ke.name, t), [t]);
1327
+ function jd() {
1328
+ const e = X(), t = Y(), [n, i] = z(!1), s = L(() => t.isActive(je.name), [t]), r = L(() => _e(je.name, t), [t]);
1326
1329
  return e ? /* @__PURE__ */ p(
1327
1330
  tt,
1328
1331
  {
1329
1332
  editor: t,
1330
1333
  options: { placement: "bottom", offset: 8, flip: !0 },
1334
+ pluginKey: "RichTextBubbleKatex",
1331
1335
  shouldShow: s,
1332
1336
  children: /* @__PURE__ */ S("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: [
1333
1337
  /* @__PURE__ */ p(
@@ -1340,7 +1344,7 @@ function Yd() {
1340
1344
  {
1341
1345
  action: () => i(!n),
1342
1346
  tooltip: "Edit",
1343
- children: /* @__PURE__ */ p(bo, { size: 16 })
1347
+ children: /* @__PURE__ */ p(wo, { size: 16 })
1344
1348
  }
1345
1349
  )
1346
1350
  }
@@ -1350,7 +1354,7 @@ function Yd() {
1350
1354
  {
1351
1355
  action: r,
1352
1356
  tooltip: "Delete",
1353
- children: /* @__PURE__ */ p(yo, { size: 16 })
1357
+ children: /* @__PURE__ */ p(bo, { size: 16 })
1354
1358
  }
1355
1359
  )
1356
1360
  ] })
@@ -1358,7 +1362,7 @@ function Yd() {
1358
1362
  ) : /* @__PURE__ */ p(M, {});
1359
1363
  }
1360
1364
  function cl(e) {
1361
- const { t } = X();
1365
+ const { t } = Z();
1362
1366
  return /* @__PURE__ */ S("div", { className: "richtext-flex richtext-flex-nowrap", children: [
1363
1367
  /* @__PURE__ */ p(
1364
1368
  y,
@@ -1396,8 +1400,8 @@ function cl(e) {
1396
1400
  )
1397
1401
  ] });
1398
1402
  }
1399
- function Gd() {
1400
- const e = Z(), t = Y(), [n, i] = z(!1), s = ee(t, Ti.name), r = s == null ? void 0 : s.href, o = L(({ editor: d }) => d.isActive(Ti.name), []), l = (d, h, u) => {
1403
+ function Yd() {
1404
+ const e = X(), t = Y(), [n, i] = z(!1), s = ee(t, Ti.name), r = s == null ? void 0 : s.href, o = L(({ editor: d }) => d.isActive(Ti.name), []), l = (d, h, u) => {
1401
1405
  const f = t.state.selection, { from: g } = f, m = (h == null ? void 0 : h.length) ?? 0, b = g + m;
1402
1406
  t.chain().extendMarkRange("link").insertContent({
1403
1407
  type: "text",
@@ -1422,13 +1426,14 @@ function Gd() {
1422
1426
  {
1423
1427
  editor: t,
1424
1428
  options: { placement: "bottom", offset: 8, flip: !0 },
1429
+ pluginKey: "RichTextBubbleLink",
1425
1430
  shouldShow: o,
1426
1431
  children: /* @__PURE__ */ p(M, { children: n ? /* @__PURE__ */ p(
1427
1432
  "div",
1428
1433
  {
1429
1434
  className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-4 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",
1430
1435
  children: /* @__PURE__ */ p(
1431
- xo,
1436
+ yo,
1432
1437
  {
1433
1438
  editor: t,
1434
1439
  onClose: a,
@@ -1474,16 +1479,16 @@ function si({ item: e, disabled: t, editor: n }) {
1474
1479
  ) }) : /* @__PURE__ */ p(M, {});
1475
1480
  }
1476
1481
  function al(e) {
1477
- return e.type.name === ko.name;
1482
+ return e.type.name === So.name;
1478
1483
  }
1479
1484
  function hl(e) {
1480
- return e.type.name === vo.name;
1485
+ return e.type.name === ko.name;
1481
1486
  }
1482
1487
  function dl(e) {
1483
- return e.type.name === Co.name;
1488
+ return e.type.name === vo.name;
1484
1489
  }
1485
- function Jd() {
1486
- const { lang: e, t } = X(), n = Z(), i = Y(), s = ({ editor: o }) => {
1490
+ function Gd() {
1491
+ const { lang: e, t } = Z(), n = X(), i = Y(), s = ({ editor: o }) => {
1487
1492
  const { selection: l } = o.view.state, { $from: c, to: a } = l;
1488
1493
  let d = !1;
1489
1494
  return o.view.state.doc.nodesBetween(c.pos, a, (h) => {
@@ -1496,6 +1501,7 @@ function Jd() {
1496
1501
  {
1497
1502
  editor: i,
1498
1503
  options: { placement: "bottom", offset: 8, flip: !0 },
1504
+ pluginKey: "RichTextBubbleImage",
1499
1505
  shouldShow: s,
1500
1506
  children: r != null && r.length ? /* @__PURE__ */ p("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: r == null ? void 0 : r.map((o, l) => /* @__PURE__ */ p(
1501
1507
  si,
@@ -1508,8 +1514,8 @@ function Jd() {
1508
1514
  }
1509
1515
  ) : /* @__PURE__ */ p(M, {});
1510
1516
  }
1511
- function qd() {
1512
- const { lang: e, t } = X(), n = Z(), i = Y(), s = ({ editor: o }) => {
1517
+ function Jd() {
1518
+ const { lang: e, t } = Z(), n = X(), i = Y(), s = ({ editor: o }) => {
1513
1519
  const { selection: l } = o.view.state, { $from: c, to: a } = l;
1514
1520
  let d = !1;
1515
1521
  return o.view.state.doc.nodesBetween(c.pos, a, (h) => {
@@ -1522,6 +1528,7 @@ function qd() {
1522
1528
  {
1523
1529
  editor: i,
1524
1530
  options: { placement: "bottom", offset: 8, flip: !0 },
1531
+ pluginKey: "RichTextBubbleImageGif",
1525
1532
  shouldShow: s,
1526
1533
  children: r != null && r.length ? /* @__PURE__ */ p("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: r == null ? void 0 : r.map((o, l) => /* @__PURE__ */ p(
1527
1534
  si,
@@ -1534,8 +1541,8 @@ function qd() {
1534
1541
  }
1535
1542
  ) : /* @__PURE__ */ p(M, {});
1536
1543
  }
1537
- function Xd() {
1538
- const { t: e } = X(), t = Z(), n = Y(), i = ({ editor: r }) => {
1544
+ function qd() {
1545
+ const { t: e } = Z(), t = X(), n = Y(), i = ({ editor: r }) => {
1539
1546
  const { selection: o } = r.view.state, { $from: l, to: c } = o;
1540
1547
  let a = !1;
1541
1548
  return r.view.state.doc.nodesBetween(l.pos, c, (d) => {
@@ -1548,6 +1555,7 @@ function Xd() {
1548
1555
  {
1549
1556
  editor: n,
1550
1557
  options: { placement: "bottom", offset: 8, flip: !0 },
1558
+ pluginKey: "RichTextBubbleVideo",
1551
1559
  shouldShow: i,
1552
1560
  children: s != null && s.length ? /* @__PURE__ */ p("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: s == null ? void 0 : s.map((r, o) => /* @__PURE__ */ p(
1553
1561
  si,
@@ -1560,18 +1568,18 @@ function Xd() {
1560
1568
  }
1561
1569
  ) : /* @__PURE__ */ p(M, {});
1562
1570
  }
1563
- const Pi = `graph TB
1571
+ const Li = `graph TB
1564
1572
  a-->b`, ul = ({ editor: e, attrs: t, extension: n }) => {
1565
- const { alt: i, align: s } = t, [r, o] = z(decodeURIComponent(i ?? Pi)), [l, c] = z(""), [a, d] = z(!1), h = Lt(null), [u, f] = z(null), g = n == null ? void 0 : n.options.upload, m = L(
1566
- (A) => {
1567
- A && import("mermaid").then((v) => {
1573
+ const { alt: i, align: s } = t, [r, o] = z(decodeURIComponent(i ?? Li)), [l, c] = z(""), [a, d] = z(!1), h = Lt(null), [u, f] = z(null), g = n == null ? void 0 : n.options.upload, m = L(
1574
+ (I) => {
1575
+ I && import("mermaid").then((v) => {
1568
1576
  f(v.default);
1569
1577
  });
1570
1578
  },
1571
1579
  []
1572
- ), b = async (A) => {
1580
+ ), b = async (I) => {
1573
1581
  try {
1574
- const { svg: v } = await u.render("mermaid-svg", A);
1582
+ const { svg: v } = await u.render("mermaid-svg", I);
1575
1583
  c(v);
1576
1584
  } catch {
1577
1585
  c("");
@@ -1612,12 +1620,12 @@ a-->b`, ul = ({ editor: e, attrs: t, extension: n }) => {
1612
1620
  style: { height: "100%", border: "1px solid hsl(var(--border))" },
1613
1621
  children: /* @__PURE__ */ S("div", { className: "richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]", children: [
1614
1622
  /* @__PURE__ */ p(
1615
- Rs,
1623
+ Ms,
1616
1624
  {
1617
1625
  autoFocus: !0,
1618
1626
  className: "richtext-flex-1",
1619
- defaultValue: Pi,
1620
- onChange: (A) => o(A.target.value),
1627
+ defaultValue: Li,
1628
+ onChange: (I) => o(I.target.value),
1621
1629
  placeholder: "Text",
1622
1630
  required: !0,
1623
1631
  rows: 10,
@@ -1645,10 +1653,10 @@ a-->b`, ul = ({ editor: e, attrs: t, extension: n }) => {
1645
1653
  onClick: async () => {
1646
1654
  if (r !== "") {
1647
1655
  if (r) {
1648
- const A = h.current.querySelector("svg"), { width: v, height: P } = A.getBoundingClientRect(), E = `mermaid-${Is()}.svg`;
1649
- let x = Os(A.outerHTML);
1656
+ const I = h.current.querySelector("svg"), { width: v, height: P } = I.getBoundingClientRect(), E = `mermaid-${Is()}.svg`;
1657
+ let x = As(I.outerHTML);
1650
1658
  if (g) {
1651
- const k = Ms(x, E);
1659
+ const k = Os(x, E);
1652
1660
  x = await g(k);
1653
1661
  }
1654
1662
  e == null || e.chain().focus().setMermaid(
@@ -1695,8 +1703,8 @@ function fl({ item: e, disabled: t, editor: n }) {
1695
1703
  function pl(e) {
1696
1704
  return e.type.name === Un.name;
1697
1705
  }
1698
- function Zd() {
1699
- const { lang: e, t } = X(), n = Z(), i = Y(), s = ee(i, Un.name), r = As(Un.name), o = ({ editor: c }) => {
1706
+ function Xd() {
1707
+ const { lang: e, t } = Z(), n = X(), i = Y(), s = ee(i, Un.name), r = Ds(Un.name), o = ({ editor: c }) => {
1700
1708
  const { selection: a } = c.view.state, { $from: d, to: h } = a;
1701
1709
  let u = !1;
1702
1710
  return c.view.state.doc.nodesBetween(d.pos, h, (f) => {
@@ -1709,6 +1717,7 @@ function Zd() {
1709
1717
  {
1710
1718
  editor: i,
1711
1719
  options: { placement: "bottom", offset: 8, flip: !0 },
1720
+ pluginKey: "RichTextBubbleMermaid",
1712
1721
  shouldShow: o,
1713
1722
  children: l != null && l.length ? /* @__PURE__ */ p("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: l == null ? void 0 : l.map((c, a) => c.type === "edit" && (s != null && s.src) ? /* @__PURE__ */ p(
1714
1723
  ul,
@@ -1729,9 +1738,9 @@ function Zd() {
1729
1738
  }
1730
1739
  ) : /* @__PURE__ */ p(M, {});
1731
1740
  }
1732
- function Qd({ hiddenActions: e = [] }) {
1733
- var m, b, w, D, A, v, P, E, x, k, N, H, et, It, Ot, _, ft, re;
1734
- const { t } = X(), n = Z(), i = Y(), s = ({ editor: Wt }) => qr(Wt.view.state, oo.name), r = (Wt) => e.includes(Wt);
1741
+ function Zd({ hiddenActions: e = [] }) {
1742
+ var m, b, w, D, I, v, P, E, x, k, N, H, et, At, Ot, _, ft, re;
1743
+ const { t } = Z(), n = X(), i = Y(), s = ({ editor: Kt }) => Jr(Kt.view.state, ro.name), r = (Kt) => e.includes(Kt);
1735
1744
  function o() {
1736
1745
  i.chain().focus().addColumnBefore().run();
1737
1746
  }
@@ -1764,8 +1773,8 @@ function Qd({ hiddenActions: e = [] }) {
1764
1773
  {
1765
1774
  editor: i,
1766
1775
  options: { placement: "bottom", offset: 8, flip: !0 },
1776
+ pluginKey: "RichTextBubbleTable",
1767
1777
  shouldShow: s,
1768
- updateDelay: 0,
1769
1778
  children: /* @__PURE__ */ S("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: [
1770
1779
  !r("addColumnBefore") && /* @__PURE__ */ p(
1771
1780
  y,
@@ -1791,7 +1800,7 @@ function Qd({ hiddenActions: e = [] }) {
1791
1800
  y,
1792
1801
  {
1793
1802
  action: c,
1794
- disabled: !((v = i == null ? void 0 : (A = i.can()).deleteColumn) != null && v.call(A)),
1803
+ disabled: !((v = i == null ? void 0 : (I = i.can()).deleteColumn) != null && v.call(I)),
1795
1804
  icon: "DeleteColumn",
1796
1805
  tooltip: t("editor.table.menu.deleteColumn"),
1797
1806
  tooltipOptions: { sideOffset: 15 }
@@ -1845,7 +1854,7 @@ function Qd({ hiddenActions: e = [] }) {
1845
1854
  y,
1846
1855
  {
1847
1856
  action: u,
1848
- disabled: !((It = (et = i == null ? void 0 : i.can()) == null ? void 0 : et.mergeCells) != null && It.call(et)),
1857
+ disabled: !((At = (et = i == null ? void 0 : i.can()) == null ? void 0 : et.mergeCells) != null && At.call(et)),
1849
1858
  icon: "TableCellsMerge",
1850
1859
  tooltip: t("editor.table.menu.mergeCells"),
1851
1860
  tooltipOptions: { sideOffset: 15 }
@@ -1884,13 +1893,12 @@ function Qd({ hiddenActions: e = [] }) {
1884
1893
  }
1885
1894
  function gl() {
1886
1895
  return /* @__PURE__ */ S(M, { children: [
1887
- /* @__PURE__ */ p(_o, {}),
1888
- /* @__PURE__ */ p(Ao, {}),
1889
- /* @__PURE__ */ p(Di, {}),
1890
- /* @__PURE__ */ p(Di, {}),
1896
+ /* @__PURE__ */ p(Co, {}),
1897
+ /* @__PURE__ */ p(Do, {}),
1898
+ /* @__PURE__ */ p(Mo, {}),
1891
1899
  /* @__PURE__ */ p(Io, {}),
1892
- /* @__PURE__ */ p(Eo, {}),
1893
- /* @__PURE__ */ p(So, {}),
1900
+ /* @__PURE__ */ p(_o, {}),
1901
+ /* @__PURE__ */ p(xo, {}),
1894
1902
  /* @__PURE__ */ p(
1895
1903
  Nt,
1896
1904
  {
@@ -1898,35 +1906,37 @@ function gl() {
1898
1906
  orientation: "vertical"
1899
1907
  }
1900
1908
  ),
1909
+ /* @__PURE__ */ p(Eo, {}),
1901
1910
  /* @__PURE__ */ p(To, {}),
1902
- /* @__PURE__ */ p(Do, {}),
1903
- /* @__PURE__ */ p(Oo, {})
1911
+ /* @__PURE__ */ p(Ao, {})
1904
1912
  ] });
1905
1913
  }
1906
- function tu({ buttonBubble: e }) {
1907
- const t = Y(), n = Z(), i = ({ editor: s }) => {
1914
+ function Qd({ buttonBubble: e }) {
1915
+ const t = Y(), n = X(), i = ({ editor: s }) => {
1908
1916
  const { selection: r } = s.view.state, { $from: o, to: l } = r;
1909
- return o.pos === l ? !1 : r instanceof no;
1917
+ return o.pos === l ? !1 : r instanceof eo;
1910
1918
  };
1911
1919
  return n ? /* @__PURE__ */ p(
1912
1920
  tt,
1913
1921
  {
1914
1922
  editor: t,
1915
1923
  options: { placement: "bottom", offset: 8, flip: !0 },
1924
+ pluginKey: "RichTextBubbleText",
1916
1925
  shouldShow: i,
1917
1926
  children: e ? /* @__PURE__ */ p(M, { children: e }) : /* @__PURE__ */ p("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: /* @__PURE__ */ p(gl, {}) })
1918
1927
  }
1919
1928
  ) : /* @__PURE__ */ p(M, {});
1920
1929
  }
1921
- function eu() {
1922
- const { t: e } = X(), t = Z(), n = Y(), [i, s] = z(!1), r = L(({ editor: c }) => c.isActive(Ai.name), []), o = (c) => {
1930
+ function tu() {
1931
+ const { t: e } = Z(), t = X(), n = Y(), [i, s] = z(!1), r = L(({ editor: c }) => c.isActive(Di.name), []), o = (c) => {
1923
1932
  n.commands.updateTweet({ src: c }), s(!1);
1924
- }, l = L(() => _e(Ai.name, n), [n]);
1933
+ }, l = L(() => _e(Di.name, n), [n]);
1925
1934
  return t ? /* @__PURE__ */ p(
1926
1935
  tt,
1927
1936
  {
1928
1937
  editor: n,
1929
1938
  options: { placement: "bottom", offset: 8, flip: !0 },
1939
+ pluginKey: "RichTextBubbleTwitter",
1930
1940
  shouldShow: r,
1931
1941
  children: /* @__PURE__ */ p(M, { children: i ? /* @__PURE__ */ p("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-border richtext-bg-popover richtext-p-4 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none", children: /* @__PURE__ */ p(
1932
1942
  Ro,
@@ -1986,7 +1996,7 @@ const ct = () => /* @__PURE__ */ new Map(), Ln = (e) => {
1986
1996
  return !0;
1987
1997
  return !1;
1988
1998
  }, Pn = Array.isArray;
1989
- class Ps {
1999
+ class Ls {
1990
2000
  constructor() {
1991
2001
  this._observers = ct();
1992
2002
  }
@@ -2048,7 +2058,7 @@ class Ps {
2048
2058
  this._observers = ct();
2049
2059
  }
2050
2060
  }
2051
- const xt = Math.floor, Ve = Math.abs, qt = (e, t) => e < t ? e : t, Et = (e, t) => e > t ? e : t, Bs = (e) => e !== 0 ? e < 0 : 1 / e < 0, Bi = 1, Vi = 2, _n = 4, En = 8, ue = 32, bt = 64, K = 128, xl = 1 << 29, dn = 31, Bn = 63, Ut = 127, Sl = 2147483647, Vs = Number.MAX_SAFE_INTEGER, kl = Number.isInteger || ((e) => typeof e == "number" && isFinite(e) && xt(e) === e), vl = String.fromCharCode, Cl = (e) => e.toLowerCase(), _l = /^\s*/g, El = (e) => e.replace(_l, ""), Tl = /([A-Z])/g, Hi = (e, t) => El(e.replace(Tl, (n) => `${t}${Cl(n)}`)), Dl = (e) => {
2061
+ const xt = Math.floor, Ve = Math.abs, qt = (e, t) => e < t ? e : t, Et = (e, t) => e > t ? e : t, Ps = (e) => e !== 0 ? e < 0 : 1 / e < 0, Pi = 1, Bi = 2, _n = 4, En = 8, ue = 32, bt = 64, j = 128, xl = 1 << 29, dn = 31, Bn = 63, Ut = 127, Sl = 2147483647, Bs = Number.MAX_SAFE_INTEGER, kl = Number.isInteger || ((e) => typeof e == "number" && isFinite(e) && xt(e) === e), vl = String.fromCharCode, Cl = (e) => e.toLowerCase(), _l = /^\s*/g, El = (e) => e.replace(_l, ""), Tl = /([A-Z])/g, Vi = (e, t) => El(e.replace(Tl, (n) => `${t}${Cl(n)}`)), Dl = (e) => {
2052
2062
  const t = unescape(encodeURIComponent(e)), n = t.length, i = new Uint8Array(n);
2053
2063
  for (let s = 0; s < n; s++)
2054
2064
  i[s] = /** @type {number} */
@@ -2057,7 +2067,7 @@ const xt = Math.floor, Ve = Math.abs, qt = (e, t) => e < t ? e : t, Et = (e, t)
2057
2067
  }, fe = (
2058
2068
  /** @type {TextEncoder} */
2059
2069
  typeof TextEncoder < "u" ? new TextEncoder() : null
2060
- ), Al = (e) => fe.encode(e), Il = fe ? Al : Dl;
2070
+ ), Il = (e) => fe.encode(e), Al = fe ? Il : Dl;
2061
2071
  let he = typeof TextDecoder > "u" ? null : new TextDecoder("utf-8", { fatal: !0, ignoreBOM: !0 });
2062
2072
  he && he.decode(new Uint8Array()).length === 1 && (he = null);
2063
2073
  class Ee {
@@ -2089,12 +2099,12 @@ const Te = () => new Ee(), Ol = (e) => {
2089
2099
  e.cpos === n && (e.bufs.push(e.cbuf), e.cbuf = new Uint8Array(n * 2), e.cpos = 0), e.cbuf[e.cpos++] = t;
2090
2100
  }, Vn = $, T = (e, t) => {
2091
2101
  for (; t > Ut; )
2092
- $(e, K | Ut & t), t = xt(t / 128);
2102
+ $(e, j | Ut & t), t = xt(t / 128);
2093
2103
  $(e, Ut & t);
2094
2104
  }, ri = (e, t) => {
2095
- const n = Bs(t);
2096
- for (n && (t = -t), $(e, (t > Bn ? K : 0) | (n ? bt : 0) | Bn & t), t = xt(t / 64); t > 0; )
2097
- $(e, (t > Ut ? K : 0) | Ut & t), t = xt(t / 128);
2105
+ const n = Ps(t);
2106
+ for (n && (t = -t), $(e, (t > Bn ? j : 0) | (n ? bt : 0) | Bn & t), t = xt(t / 64); t > 0; )
2107
+ $(e, (t > Ut ? j : 0) | Ut & t), t = xt(t / 128);
2098
2108
  }, Hn = new Uint8Array(3e4), Nl = Hn.length / 3, Ul = (e, t) => {
2099
2109
  if (t.length < Nl) {
2100
2110
  const n = fe.encodeInto(t, Hn).written || 0;
@@ -2102,7 +2112,7 @@ const Te = () => new Ee(), Ol = (e) => {
2102
2112
  for (let i = 0; i < n; i++)
2103
2113
  $(e, Hn[i]);
2104
2114
  } else
2105
- Q(e, Il(t));
2115
+ Q(e, Al(t));
2106
2116
  }, Ll = (e, t) => {
2107
2117
  const n = unescape(encodeURIComponent(t)), i = n.length;
2108
2118
  T(e, i);
@@ -2112,7 +2122,7 @@ const Te = () => new Ee(), Ol = (e) => {
2112
2122
  /** @type {number} */
2113
2123
  n.codePointAt(s)
2114
2124
  );
2115
- }, jt = fe && /** @type {any} */
2125
+ }, Wt = fe && /** @type {any} */
2116
2126
  fe.encodeInto ? Ul : Ll, un = (e, t) => {
2117
2127
  const n = e.cbuf.length, i = e.cpos, s = qt(n - i, t.length), r = t.length - s;
2118
2128
  e.cbuf.set(t.subarray(0, s), i), e.cpos += s, r > 0 && (e.bufs.push(e.cbuf), e.cbuf = new Uint8Array(Et(n * 2, r)), e.cbuf.set(t.subarray(s)), e.cpos = r);
@@ -2125,10 +2135,10 @@ fe.encodeInto ? Ul : Ll, un = (e, t) => {
2125
2135
  }, Pl = (e, t) => oi(e, 4).setFloat32(0, t, !1), Bl = (e, t) => oi(e, 8).setFloat64(0, t, !1), Vl = (e, t) => (
2126
2136
  /** @type {any} */
2127
2137
  oi(e, 8).setBigInt64(0, t, !1)
2128
- ), $i = new DataView(new ArrayBuffer(4)), Hl = (e) => ($i.setFloat32(0, e), $i.getFloat32(0) === e), Xt = (e, t) => {
2138
+ ), Hi = new DataView(new ArrayBuffer(4)), Hl = (e) => (Hi.setFloat32(0, e), Hi.getFloat32(0) === e), Xt = (e, t) => {
2129
2139
  switch (typeof t) {
2130
2140
  case "string":
2131
- $(e, 119), jt(e, t);
2141
+ $(e, 119), Wt(e, t);
2132
2142
  break;
2133
2143
  case "number":
2134
2144
  kl(t) && Ve(t) <= Sl ? ($(e, 125), ri(e, t)) : Hl(t) ? ($(e, 124), Pl(e, t)) : ($(e, 123), Bl(e, t));
@@ -2151,7 +2161,7 @@ fe.encodeInto ? Ul : Ll, un = (e, t) => {
2151
2161
  T(e, n.length);
2152
2162
  for (let i = 0; i < n.length; i++) {
2153
2163
  const s = n[i];
2154
- jt(e, s), Xt(e, t[s]);
2164
+ Wt(e, s), Xt(e, t[s]);
2155
2165
  }
2156
2166
  }
2157
2167
  break;
@@ -2162,7 +2172,7 @@ fe.encodeInto ? Ul : Ll, un = (e, t) => {
2162
2172
  $(e, 127);
2163
2173
  }
2164
2174
  };
2165
- class Fi extends Ee {
2175
+ class $i extends Ee {
2166
2176
  /**
2167
2177
  * @param {function(Encoder, T):void} writer
2168
2178
  */
@@ -2176,7 +2186,7 @@ class Fi extends Ee {
2176
2186
  this.s === t ? this.count++ : (this.count > 0 && T(this, this.count - 1), this.count = 1, this.w(this, t), this.s = t);
2177
2187
  }
2178
2188
  }
2179
- const zi = (e) => {
2189
+ const Fi = (e) => {
2180
2190
  e.count > 0 && (ri(e.encoder, e.count === 1 ? e.s : -e.s), e.count > 1 && T(e.encoder, e.count - 2));
2181
2191
  };
2182
2192
  class He {
@@ -2187,7 +2197,7 @@ class He {
2187
2197
  * @param {number} v
2188
2198
  */
2189
2199
  write(t) {
2190
- this.s === t ? this.count++ : (zi(this), this.count = 1, this.s = t);
2200
+ this.s === t ? this.count++ : (Fi(this), this.count = 1, this.s = t);
2191
2201
  }
2192
2202
  /**
2193
2203
  * Flush the encoded state and transform this to a Uint8Array.
@@ -2195,10 +2205,10 @@ class He {
2195
2205
  * Note that this should only be called once.
2196
2206
  */
2197
2207
  toUint8Array() {
2198
- return zi(this), lt(this.encoder);
2208
+ return Fi(this), lt(this.encoder);
2199
2209
  }
2200
2210
  }
2201
- const Wi = (e) => {
2211
+ const zi = (e) => {
2202
2212
  if (e.count > 0) {
2203
2213
  const t = e.diff * 2 + (e.count === 1 ? 0 : 1);
2204
2214
  ri(e.encoder, t), e.count > 1 && T(e.encoder, e.count - 2);
@@ -2212,7 +2222,7 @@ class Tn {
2212
2222
  * @param {number} v
2213
2223
  */
2214
2224
  write(t) {
2215
- this.diff === t - this.s ? (this.s = t, this.count++) : (Wi(this), this.count = 1, this.diff = t - this.s, this.s = t);
2225
+ this.diff === t - this.s ? (this.s = t, this.count++) : (zi(this), this.count = 1, this.diff = t - this.s, this.s = t);
2216
2226
  }
2217
2227
  /**
2218
2228
  * Flush the encoded state and transform this to a Uint8Array.
@@ -2220,7 +2230,7 @@ class Tn {
2220
2230
  * Note that this should only be called once.
2221
2231
  */
2222
2232
  toUint8Array() {
2223
- return Wi(this), lt(this.encoder);
2233
+ return zi(this), lt(this.encoder);
2224
2234
  }
2225
2235
  }
2226
2236
  class $l {
@@ -2235,14 +2245,14 @@ class $l {
2235
2245
  }
2236
2246
  toUint8Array() {
2237
2247
  const t = new Ee();
2238
- return this.sarr.push(this.s), this.s = "", jt(t, this.sarr.join("")), un(t, this.lensE.toUint8Array()), lt(t);
2248
+ return this.sarr.push(this.s), this.s = "", Wt(t, this.sarr.join("")), un(t, this.lensE.toUint8Array()), lt(t);
2239
2249
  }
2240
2250
  }
2241
2251
  const Tt = (e) => new Error(e), at = () => {
2242
2252
  throw Tt("Method unimplemented");
2243
2253
  }, q = () => {
2244
2254
  throw Tt("Unexpected case");
2245
- }, Hs = Tt("Unexpected end of array"), $s = Tt("Integer out of Range");
2255
+ }, Vs = Tt("Unexpected end of array"), Hs = Tt("Integer out of Range");
2246
2256
  class fn {
2247
2257
  /**
2248
2258
  * @param {Uint8Array} uint8Array Binary data to decode
@@ -2259,26 +2269,26 @@ const li = (e) => new fn(e), Fl = (e) => e.pos !== e.arr.length, zl = (e, t) =>
2259
2269
  const i = e.arr.length;
2260
2270
  for (; e.pos < i; ) {
2261
2271
  const s = e.arr[e.pos++];
2262
- if (t = t + (s & Ut) * n, n *= 128, s < K)
2272
+ if (t = t + (s & Ut) * n, n *= 128, s < j)
2263
2273
  return t;
2264
- if (t > Vs)
2265
- throw $s;
2274
+ if (t > Bs)
2275
+ throw Hs;
2266
2276
  }
2267
- throw Hs;
2277
+ throw Vs;
2268
2278
  }, ci = (e) => {
2269
2279
  let t = e.arr[e.pos++], n = t & Bn, i = 64;
2270
2280
  const s = (t & bt) > 0 ? -1 : 1;
2271
- if ((t & K) === 0)
2281
+ if ((t & j) === 0)
2272
2282
  return s * n;
2273
2283
  const r = e.arr.length;
2274
2284
  for (; e.pos < r; ) {
2275
- if (t = e.arr[e.pos++], n = n + (t & Ut) * i, i *= 128, t < K)
2285
+ if (t = e.arr[e.pos++], n = n + (t & Ut) * i, i *= 128, t < j)
2276
2286
  return s * n;
2277
- if (n > Vs)
2278
- throw $s;
2287
+ if (n > Bs)
2288
+ throw Hs;
2279
2289
  }
2280
- throw Hs;
2281
- }, Wl = (e) => {
2290
+ throw Vs;
2291
+ }, Kl = (e) => {
2282
2292
  let t = R(e);
2283
2293
  if (t === 0)
2284
2294
  return "";
@@ -2298,13 +2308,13 @@ const li = (e) => new fn(e), Fl = (e) => e.pos !== e.arr.length, zl = (e, t) =>
2298
2308
  }
2299
2309
  return decodeURIComponent(escape(n));
2300
2310
  }
2301
- }, jl = (e) => (
2311
+ }, Wl = (e) => (
2302
2312
  /** @type any */
2303
2313
  he.decode(nt(e))
2304
- ), $n = he ? jl : Wl, ai = (e, t) => {
2314
+ ), $n = he ? Wl : Kl, ai = (e, t) => {
2305
2315
  const n = new DataView(e.arr.buffer, e.arr.byteOffset + e.pos, t);
2306
2316
  return e.pos += t, n;
2307
- }, Kl = (e) => ai(e, 4).getFloat32(0, !1), Yl = (e) => ai(e, 8).getFloat64(0, !1), Gl = (e) => (
2317
+ }, jl = (e) => ai(e, 4).getFloat32(0, !1), Yl = (e) => ai(e, 8).getFloat64(0, !1), Gl = (e) => (
2308
2318
  /** @type {any} */
2309
2319
  ai(e, 8).getBigInt64(0, !1)
2310
2320
  ), Jl = [
@@ -2315,7 +2325,7 @@ const li = (e) => new fn(e), Fl = (e) => e.pos !== e.arr.length, zl = (e, t) =>
2315
2325
  // CASE 126: null
2316
2326
  ci,
2317
2327
  // CASE 125: integer
2318
- Kl,
2328
+ jl,
2319
2329
  // CASE 124: float32
2320
2330
  Yl,
2321
2331
  // CASE 123: float64
@@ -2344,7 +2354,7 @@ const li = (e) => new fn(e), Fl = (e) => e.pos !== e.arr.length, zl = (e, t) =>
2344
2354
  nt
2345
2355
  // CASE 116: Uint8Array
2346
2356
  ], Ye = (e) => Jl[127 - pe(e)](e);
2347
- class ji extends fn {
2357
+ class Ki extends fn {
2348
2358
  /**
2349
2359
  * @param {Uint8Array} uint8Array
2350
2360
  * @param {function(Decoder):T} reader
@@ -2367,7 +2377,7 @@ class $e extends fn {
2367
2377
  read() {
2368
2378
  if (this.count === 0) {
2369
2379
  this.s = ci(this);
2370
- const t = Bs(this.s);
2380
+ const t = Ps(this.s);
2371
2381
  this.count = 1, t && (this.s = -this.s, this.count = R(this) + 2);
2372
2382
  }
2373
2383
  return this.count--, /** @type {number} */
@@ -2407,16 +2417,16 @@ class ql {
2407
2417
  return this.spos = t, n;
2408
2418
  }
2409
2419
  }
2410
- const Xl = crypto.getRandomValues.bind(crypto), Zl = Math.random, Fs = () => Xl(new Uint32Array(1))[0], Ql = (e) => e[xt(Zl() * e.length)], tc = "10000000-1000-4000-8000" + -1e11, ec = () => tc.replace(
2420
+ const Xl = crypto.getRandomValues.bind(crypto), Zl = Math.random, $s = () => Xl(new Uint32Array(1))[0], Ql = (e) => e[xt(Zl() * e.length)], tc = "10000000-1000-4000-8000" + -1e11, ec = () => tc.replace(
2411
2421
  /[018]/g,
2412
2422
  /** @param {number} c */
2413
- (e) => (e ^ Fs() & 15 >> e / 4).toString(16)
2414
- ), nc = Date.now, Ki = (e) => (
2423
+ (e) => (e ^ $s() & 15 >> e / 4).toString(16)
2424
+ ), nc = Date.now, Wi = (e) => (
2415
2425
  /** @type {Promise<T>} */
2416
2426
  new Promise(e)
2417
2427
  );
2418
2428
  Promise.all.bind(Promise);
2419
- const Yi = (e) => e === void 0 ? null : e;
2429
+ const ji = (e) => e === void 0 ? null : e;
2420
2430
  class ic {
2421
2431
  constructor() {
2422
2432
  this.map = /* @__PURE__ */ new Map();
@@ -2435,27 +2445,27 @@ class ic {
2435
2445
  return this.map.get(t);
2436
2446
  }
2437
2447
  }
2438
- let zs = new ic(), sc = !0;
2448
+ let Fs = new ic(), sc = !0;
2439
2449
  try {
2440
- typeof localStorage < "u" && localStorage && (zs = localStorage, sc = !1);
2450
+ typeof localStorage < "u" && localStorage && (Fs = localStorage, sc = !1);
2441
2451
  } catch {
2442
2452
  }
2443
- const rc = zs, oc = Object.assign, Ws = Object.keys, lc = (e, t) => {
2453
+ const rc = Fs, oc = Object.assign, zs = Object.keys, lc = (e, t) => {
2444
2454
  for (const n in e)
2445
2455
  t(e[n], n);
2446
- }, Gi = (e) => Ws(e).length, cc = (e) => {
2456
+ }, Yi = (e) => zs(e).length, cc = (e) => {
2447
2457
  for (const t in e)
2448
2458
  return !1;
2449
2459
  return !0;
2450
- }, js = (e, t) => {
2460
+ }, Ks = (e, t) => {
2451
2461
  for (const n in e)
2452
2462
  if (!t(e[n], n))
2453
2463
  return !1;
2454
2464
  return !0;
2455
- }, ac = (e, t) => Object.prototype.hasOwnProperty.call(e, t), hc = (e, t) => e === t || Gi(e) === Gi(t) && js(e, (n, i) => (n !== void 0 || ac(t, i)) && t[i] === n), dc = Object.freeze, Ks = (e) => {
2465
+ }, ac = (e, t) => Object.prototype.hasOwnProperty.call(e, t), hc = (e, t) => e === t || Yi(e) === Yi(t) && Ks(e, (n, i) => (n !== void 0 || ac(t, i)) && t[i] === n), dc = Object.freeze, Ws = (e) => {
2456
2466
  for (const t in e) {
2457
2467
  const n = e[t];
2458
- (typeof n == "object" || typeof n == "function") && Ks(e[t]);
2468
+ (typeof n == "object" || typeof n == "function") && Ws(e[t]);
2459
2469
  }
2460
2470
  return dc(e);
2461
2471
  }, hi = (e, t, n = 0) => {
@@ -2465,7 +2475,7 @@ const rc = zs, oc = Object.assign, Ws = Object.keys, lc = (e, t) => {
2465
2475
  } finally {
2466
2476
  n < e.length && hi(e, t, n + 1);
2467
2477
  }
2468
- }, uc = (e, t) => t.includes(e), Zt = typeof process < "u" && process.release && /node|io\.js/.test(process.release.name) && Object.prototype.toString.call(typeof process < "u" ? process : 0) === "[object process]", Ys = typeof window < "u" && typeof document < "u" && !Zt;
2478
+ }, uc = (e, t) => t.includes(e), Zt = typeof process < "u" && process.release && /node|io\.js/.test(process.release.name) && Object.prototype.toString.call(typeof process < "u" ? process : 0) === "[object process]", js = typeof window < "u" && typeof document < "u" && !Zt;
2469
2479
  let pt;
2470
2480
  const fc = () => {
2471
2481
  if (pt === void 0)
@@ -2481,19 +2491,19 @@ const fc = () => {
2481
2491
  } else typeof location == "object" ? (pt = ct(), (location.search || "?").slice(1).split("&").forEach((e) => {
2482
2492
  if (e.length !== 0) {
2483
2493
  const [t, n] = e.split("=");
2484
- pt.set(`--${Hi(t, "-")}`, n), pt.set(`-${Hi(t, "-")}`, n);
2494
+ pt.set(`--${Vi(t, "-")}`, n), pt.set(`-${Vi(t, "-")}`, n);
2485
2495
  }
2486
2496
  })) : pt = ct();
2487
2497
  return pt;
2488
- }, Fn = (e) => fc().has(e), Ge = (e) => Yi(Zt ? process.env[e.toUpperCase().replaceAll("-", "_")] : rc.getItem(e)), Gs = (e) => Fn("--" + e) || Ge(e) !== null;
2489
- Gs("production");
2498
+ }, Fn = (e) => fc().has(e), Ge = (e) => ji(Zt ? process.env[e.toUpperCase().replaceAll("-", "_")] : rc.getItem(e)), Ys = (e) => Fn("--" + e) || Ge(e) !== null;
2499
+ Ys("production");
2490
2500
  const pc = Zt && uc(process.env.FORCE_COLOR, ["true", "1", "2"]), gc = pc || !Fn("--no-colors") && // @todo deprecate --no-colors
2491
- !Gs("no-color") && (!Zt || process.stdout.isTTY) && (!Zt || Fn("--color") || Ge("COLORTERM") !== null || (Ge("TERM") || "").includes("color")), mc = (e) => {
2501
+ !Ys("no-color") && (!Zt || process.stdout.isTTY) && (!Zt || Fn("--color") || Ge("COLORTERM") !== null || (Ge("TERM") || "").includes("color")), mc = (e) => {
2492
2502
  let t = "";
2493
2503
  for (let n = 0; n < e.byteLength; n++)
2494
2504
  t += vl(e[n]);
2495
2505
  return btoa(t);
2496
- }, wc = (e) => Buffer.from(e.buffer, e.byteOffset, e.byteLength).toString("base64"), bc = Ys ? mc : wc, yc = (e) => Ol((t) => Xt(t, e));
2506
+ }, wc = (e) => Buffer.from(e.buffer, e.byteOffset, e.byteLength).toString("base64"), bc = js ? mc : wc, yc = (e) => Ol((t) => Xt(t, e));
2497
2507
  class xc {
2498
2508
  /**
2499
2509
  * @param {L} left
@@ -2518,7 +2528,7 @@ const kc = (e) => ml(e, (t, n) => `${n}:${t};`).join(""), vc = (e) => class {
2518
2528
  destroy() {
2519
2529
  e(this._);
2520
2530
  }
2521
- }, Cc = vc(clearTimeout), Js = (e, t) => new Cc(setTimeout(t, e)), kt = Symbol, qs = kt(), Xs = kt(), _c = kt(), Ec = kt(), Tc = kt(), Zs = kt(), Dc = kt(), di = kt(), Ac = kt(), Ic = (e) => {
2531
+ }, Cc = vc(clearTimeout), Gs = (e, t) => new Cc(setTimeout(t, e)), kt = Symbol, Js = kt(), qs = kt(), _c = kt(), Ec = kt(), Tc = kt(), Xs = kt(), Dc = kt(), di = kt(), Ic = kt(), Ac = (e) => {
2522
2532
  var s;
2523
2533
  e.length === 1 && ((s = e[0]) == null ? void 0 : s.constructor) === Function && (e = /** @type {Array<string|Symbol|Object|number>} */
2524
2534
  /** @type {[function]} */
@@ -2540,16 +2550,16 @@ const kc = (e) => ml(e, (t, n) => `${n}:${t};`).join(""), vc = (e) => class {
2540
2550
  }
2541
2551
  return n;
2542
2552
  }, Oc = {
2543
- [qs]: wt("font-weight", "bold"),
2544
- [Xs]: wt("font-weight", "normal"),
2553
+ [Js]: wt("font-weight", "bold"),
2554
+ [qs]: wt("font-weight", "normal"),
2545
2555
  [_c]: wt("color", "blue"),
2546
2556
  [Tc]: wt("color", "green"),
2547
2557
  [Ec]: wt("color", "grey"),
2548
- [Zs]: wt("color", "red"),
2558
+ [Xs]: wt("color", "red"),
2549
2559
  [Dc]: wt("color", "purple"),
2550
2560
  [di]: wt("color", "orange"),
2551
2561
  // not well supported in chrome when debugging node with inspector - TODO: deprecate
2552
- [Ac]: wt("color", "black")
2562
+ [Ic]: wt("color", "black")
2553
2563
  }, Mc = (e) => {
2554
2564
  var o;
2555
2565
  e.length === 1 && ((o = e[0]) == null ? void 0 : o.constructor) === Function && (e = /** @type {Array<string|Symbol|Object|number>} */
@@ -2576,11 +2586,11 @@ const kc = (e) => ml(e, (t, n) => `${n}:${t};`).join(""), vc = (e) => class {
2576
2586
  l instanceof Symbol || s.push(l);
2577
2587
  }
2578
2588
  return s;
2579
- }, Qs = gc ? Mc : Ic, Rc = (...e) => {
2580
- console.log(...Qs(e)), er.forEach((t) => t.print(e));
2581
- }, tr = (...e) => {
2582
- console.warn(...Qs(e)), e.unshift(di), er.forEach((t) => t.print(e));
2583
- }, er = Bt(), nr = (e) => ({
2589
+ }, Zs = gc ? Mc : Ac, Rc = (...e) => {
2590
+ console.log(...Zs(e)), tr.forEach((t) => t.print(e));
2591
+ }, Qs = (...e) => {
2592
+ console.warn(...Zs(e)), e.unshift(di), tr.forEach((t) => t.print(e));
2593
+ }, tr = Bt(), er = (e) => ({
2584
2594
  /**
2585
2595
  * @return {IterableIterator<T>}
2586
2596
  */
@@ -2589,13 +2599,13 @@ const kc = (e) => ml(e, (t, n) => `${n}:${t};`).join(""), vc = (e) => class {
2589
2599
  },
2590
2600
  // @ts-ignore
2591
2601
  next: e
2592
- }), Nc = (e, t) => nr(() => {
2602
+ }), Nc = (e, t) => er(() => {
2593
2603
  let n;
2594
2604
  do
2595
2605
  n = e.next();
2596
2606
  while (!n.done && !t(n.value));
2597
2607
  return n;
2598
- }), An = (e, t) => nr(() => {
2608
+ }), In = (e, t) => er(() => {
2599
2609
  const { done: n, value: i } = e.next();
2600
2610
  return { done: n, value: n ? void 0 : t(i) };
2601
2611
  });
@@ -2621,7 +2631,7 @@ const Dt = (e, t, n) => t.clients.forEach((i, s) => {
2621
2631
  if (r != null) {
2622
2632
  const o = r[r.length - 1], l = o.id.clock + o.length;
2623
2633
  for (let c = 0, a = i[c]; c < i.length && a.clock < l; a = i[++c])
2624
- hr(e, r, a.clock, a.len, n);
2634
+ ar(e, r, a.clock, a.len, n);
2625
2635
  }
2626
2636
  }), Uc = (e, t) => {
2627
2637
  let n = 0, i = e.length - 1;
@@ -2665,8 +2675,8 @@ const Dt = (e, t, n) => t.clients.forEach((i, s) => {
2665
2675
  /** @type {Array<DeleteItem>} */
2666
2676
  []
2667
2677
  )).push(new ui(n, i));
2668
- }, ir = () => new ne(), Lc = (e) => {
2669
- const t = ir();
2678
+ }, nr = () => new ne(), Lc = (e) => {
2679
+ const t = nr();
2670
2680
  return e.clients.forEach((n, i) => {
2671
2681
  const s = [];
2672
2682
  for (let r = 0; r < n.length; r++) {
@@ -2707,7 +2717,7 @@ const Dt = (e, t, n) => t.clients.forEach((i, s) => {
2707
2717
  }
2708
2718
  }
2709
2719
  return t;
2710
- }, Ji = (e, t, n) => {
2720
+ }, Gi = (e, t, n) => {
2711
2721
  const i = new ne(), s = R(e.restDecoder);
2712
2722
  for (let r = 0; r < s; r++) {
2713
2723
  e.resetDsCurVal();
@@ -2728,18 +2738,18 @@ const Dt = (e, t, n) => t.clients.forEach((i, s) => {
2728
2738
  return T(r.restEncoder, 0), pi(r, i), r.toUint8Array();
2729
2739
  }
2730
2740
  return null;
2731
- }, sr = Fs;
2732
- class Ft extends Ps {
2741
+ }, ir = $s;
2742
+ class Ft extends Ls {
2733
2743
  /**
2734
2744
  * @param {DocOpts} opts configuration
2735
2745
  */
2736
2746
  constructor({ guid: t = ec(), collectionid: n = null, gc: i = !0, gcFilter: s = () => !0, meta: r = null, autoLoad: o = !1, shouldLoad: l = !0 } = {}) {
2737
- super(), this.gc = i, this.gcFilter = s, this.clientID = sr(), this.guid = t, this.collectionid = n, this.share = /* @__PURE__ */ new Map(), this.store = new cr(), this._transaction = null, this._transactionCleanups = [], this.subdocs = /* @__PURE__ */ new Set(), this._item = null, this.shouldLoad = l, this.autoLoad = o, this.meta = r, this.isLoaded = !1, this.isSynced = !1, this.isDestroyed = !1, this.whenLoaded = Ki((a) => {
2747
+ super(), this.gc = i, this.gcFilter = s, this.clientID = ir(), this.guid = t, this.collectionid = n, this.share = /* @__PURE__ */ new Map(), this.store = new lr(), this._transaction = null, this._transactionCleanups = [], this.subdocs = /* @__PURE__ */ new Set(), this._item = null, this.shouldLoad = l, this.autoLoad = o, this.meta = r, this.isLoaded = !1, this.isSynced = !1, this.isDestroyed = !1, this.whenLoaded = Wi((a) => {
2738
2748
  this.on("load", () => {
2739
2749
  this.isLoaded = !0, a(this);
2740
2750
  });
2741
2751
  });
2742
- const c = () => Ki((a) => {
2752
+ const c = () => Wi((a) => {
2743
2753
  const d = (h) => {
2744
2754
  (h === void 0 || h === !0) && (this.off("sync", d), a());
2745
2755
  };
@@ -2866,7 +2876,7 @@ class Ft extends Ps {
2866
2876
  * @public
2867
2877
  */
2868
2878
  getText(t = "") {
2869
- return this.get(t, At);
2879
+ return this.get(t, It);
2870
2880
  }
2871
2881
  /**
2872
2882
  * @template T
@@ -2890,7 +2900,7 @@ class Ft extends Ps {
2890
2900
  getXmlElement(t = "") {
2891
2901
  return (
2892
2902
  /** @type {YXmlElement<{[key:string]:string}>} */
2893
- this.get(t, W)
2903
+ this.get(t, K)
2894
2904
  );
2895
2905
  }
2896
2906
  /**
@@ -2971,19 +2981,19 @@ class Je extends Bc {
2971
2981
  * @param {decoding.Decoder} decoder
2972
2982
  */
2973
2983
  constructor(t) {
2974
- super(t), this.keys = [], R(t), this.keyClockDecoder = new Dn(nt(t)), this.clientDecoder = new $e(nt(t)), this.leftClockDecoder = new Dn(nt(t)), this.rightClockDecoder = new Dn(nt(t)), this.infoDecoder = new ji(nt(t), pe), this.stringDecoder = new ql(nt(t)), this.parentInfoDecoder = new ji(nt(t), pe), this.typeRefDecoder = new $e(nt(t)), this.lenDecoder = new $e(nt(t));
2984
+ super(t), this.keys = [], R(t), this.keyClockDecoder = new Dn(nt(t)), this.clientDecoder = new $e(nt(t)), this.leftClockDecoder = new Dn(nt(t)), this.rightClockDecoder = new Dn(nt(t)), this.infoDecoder = new Ki(nt(t), pe), this.stringDecoder = new ql(nt(t)), this.parentInfoDecoder = new Ki(nt(t), pe), this.typeRefDecoder = new $e(nt(t)), this.lenDecoder = new $e(nt(t));
2975
2985
  }
2976
2986
  /**
2977
2987
  * @return {ID}
2978
2988
  */
2979
2989
  readLeftID() {
2980
- return new Kt(this.clientDecoder.read(), this.leftClockDecoder.read());
2990
+ return new jt(this.clientDecoder.read(), this.leftClockDecoder.read());
2981
2991
  }
2982
2992
  /**
2983
2993
  * @return {ID}
2984
2994
  */
2985
2995
  readRightID() {
2986
- return new Kt(this.clientDecoder.read(), this.rightClockDecoder.read());
2996
+ return new jt(this.clientDecoder.read(), this.rightClockDecoder.read());
2987
2997
  }
2988
2998
  /**
2989
2999
  * Read the next client id.
@@ -3114,7 +3124,7 @@ class Hc extends Vc {
3114
3124
  * @param {string} s
3115
3125
  */
3116
3126
  writeString(t) {
3117
- jt(this.restEncoder, t);
3127
+ Wt(this.restEncoder, t);
3118
3128
  }
3119
3129
  /**
3120
3130
  * @param {boolean} isYKey
@@ -3152,13 +3162,13 @@ class Hc extends Vc {
3152
3162
  * @param {any} embed
3153
3163
  */
3154
3164
  writeJSON(t) {
3155
- jt(this.restEncoder, JSON.stringify(t));
3165
+ Wt(this.restEncoder, JSON.stringify(t));
3156
3166
  }
3157
3167
  /**
3158
3168
  * @param {string} key
3159
3169
  */
3160
3170
  writeKey(t) {
3161
- jt(this.restEncoder, t);
3171
+ Wt(this.restEncoder, t);
3162
3172
  }
3163
3173
  }
3164
3174
  class $c {
@@ -3187,7 +3197,7 @@ class $c {
3187
3197
  }
3188
3198
  class pn extends $c {
3189
3199
  constructor() {
3190
- super(), this.keyMap = /* @__PURE__ */ new Map(), this.keyClock = 0, this.keyClockEncoder = new Tn(), this.clientEncoder = new He(), this.leftClockEncoder = new Tn(), this.rightClockEncoder = new Tn(), this.infoEncoder = new Fi(Vn), this.stringEncoder = new $l(), this.parentInfoEncoder = new Fi(Vn), this.typeRefEncoder = new He(), this.lenEncoder = new He();
3200
+ super(), this.keyMap = /* @__PURE__ */ new Map(), this.keyClock = 0, this.keyClockEncoder = new Tn(), this.clientEncoder = new He(), this.leftClockEncoder = new Tn(), this.rightClockEncoder = new Tn(), this.infoEncoder = new $i(Vn), this.stringEncoder = new $l(), this.parentInfoEncoder = new $i(Vn), this.typeRefEncoder = new He(), this.lenEncoder = new He();
3191
3201
  }
3192
3202
  toUint8Array() {
3193
3203
  const t = Te();
@@ -3286,7 +3296,7 @@ const Fc = (e, t, n, i) => {
3286
3296
  r.write(e, i - r.id.clock);
3287
3297
  for (let o = s + 1; o < t.length; o++)
3288
3298
  t[o].write(e, 0);
3289
- }, rr = (e, t, n) => {
3299
+ }, sr = (e, t, n) => {
3290
3300
  const i = /* @__PURE__ */ new Map();
3291
3301
  n.forEach((s, r) => {
3292
3302
  B(t, r) > s && i.set(r, s);
@@ -3321,11 +3331,11 @@ const Fc = (e, t, n, i) => {
3321
3331
  break;
3322
3332
  }
3323
3333
  default: {
3324
- const h = (d & (bt | K)) === 0, u = new I(
3334
+ const h = (d & (bt | j)) === 0, u = new A(
3325
3335
  C(l, c),
3326
3336
  null,
3327
3337
  // left
3328
- (d & K) === K ? e.readLeftID() : null,
3338
+ (d & j) === j ? e.readLeftID() : null,
3329
3339
  // origin
3330
3340
  null,
3331
3341
  // right
@@ -3335,7 +3345,7 @@ const Fc = (e, t, n, i) => {
3335
3345
  // parent
3336
3346
  h && (d & ue) === ue ? e.readString() : null,
3337
3347
  // parentSub
3338
- Mr(e, d)
3348
+ Or(e, d)
3339
3349
  // item content
3340
3350
  );
3341
3351
  o[a] = u, c += u.length;
@@ -3344,7 +3354,7 @@ const Fc = (e, t, n, i) => {
3344
3354
  }
3345
3355
  }
3346
3356
  return n;
3347
- }, Wc = (e, t, n) => {
3357
+ }, Kc = (e, t, n) => {
3348
3358
  const i = [];
3349
3359
  let s = Vt(n.keys()).sort((f, g) => f - g);
3350
3360
  if (s.length === 0)
@@ -3367,7 +3377,7 @@ const Fc = (e, t, n, i) => {
3367
3377
  let o = r();
3368
3378
  if (o === null)
3369
3379
  return null;
3370
- const l = new cr(), c = /* @__PURE__ */ new Map(), a = (f, g) => {
3380
+ const l = new lr(), c = /* @__PURE__ */ new Map(), a = (f, g) => {
3371
3381
  const m = c.get(f);
3372
3382
  (m == null || m > g) && c.set(f, g);
3373
3383
  };
@@ -3426,13 +3436,13 @@ const Fc = (e, t, n, i) => {
3426
3436
  }
3427
3437
  if (l.clients.size > 0) {
3428
3438
  const f = new pn();
3429
- return rr(f, l, /* @__PURE__ */ new Map()), T(f.restEncoder, 0), { missing: c, update: f.toUint8Array() };
3439
+ return sr(f, l, /* @__PURE__ */ new Map()), T(f.restEncoder, 0), { missing: c, update: f.toUint8Array() };
3430
3440
  }
3431
3441
  return null;
3432
- }, jc = (e, t) => rr(e, t.doc.store, t.beforeState), Kc = (e, t, n, i = new Je(e)) => O(t, (s) => {
3442
+ }, Wc = (e, t) => sr(e, t.doc.store, t.beforeState), jc = (e, t, n, i = new Je(e)) => O(t, (s) => {
3433
3443
  s.local = !1;
3434
3444
  let r = !1;
3435
- const o = s.doc, l = o.store, c = zc(i, o), a = Wc(s, l, c), d = l.pendingStructs;
3445
+ const o = s.doc, l = o.store, c = zc(i, o), a = Kc(s, l, c), d = l.pendingStructs;
3436
3446
  if (d) {
3437
3447
  for (const [u, f] of d.missing)
3438
3448
  if (f < B(l, u)) {
@@ -3444,16 +3454,16 @@ const Fc = (e, t, n, i) => {
3444
3454
  const g = d.missing.get(u);
3445
3455
  (g == null || g > f) && d.missing.set(u, f);
3446
3456
  }
3447
- d.update = ss([d.update, a.update]);
3457
+ d.update = is([d.update, a.update]);
3448
3458
  }
3449
3459
  } else
3450
3460
  l.pendingStructs = a;
3451
- const h = Ji(i, s, l);
3461
+ const h = Gi(i, s, l);
3452
3462
  if (l.pendingDs) {
3453
3463
  const u = new Je(li(l.pendingDs));
3454
3464
  R(u.restDecoder);
3455
- const f = Ji(u, s, l);
3456
- h && f ? l.pendingDs = ss([h, f]) : l.pendingDs = h || f;
3465
+ const f = Gi(u, s, l);
3466
+ h && f ? l.pendingDs = is([h, f]) : l.pendingDs = h || f;
3457
3467
  } else
3458
3468
  l.pendingDs = h;
3459
3469
  if (r) {
@@ -3461,22 +3471,22 @@ const Fc = (e, t, n, i) => {
3461
3471
  /** @type {{update: Uint8Array}} */
3462
3472
  l.pendingStructs.update
3463
3473
  );
3464
- l.pendingStructs = null, Wn(s.doc, u);
3474
+ l.pendingStructs = null, Kn(s.doc, u);
3465
3475
  }
3466
- }, n, !1), Wn = (e, t, n, i = Je) => {
3476
+ }, n, !1), Kn = (e, t, n, i = Je) => {
3467
3477
  const s = li(t);
3468
- Kc(s, e, n, new i(s));
3478
+ jc(s, e, n, new i(s));
3469
3479
  };
3470
3480
  class Yc {
3471
3481
  constructor() {
3472
3482
  this.l = [];
3473
3483
  }
3474
3484
  }
3475
- const qi = () => new Yc(), Xi = (e, t) => e.l.push(t), Zi = (e, t) => {
3485
+ const Ji = () => new Yc(), qi = (e, t) => e.l.push(t), Xi = (e, t) => {
3476
3486
  const n = e.l, i = n.length;
3477
3487
  e.l = n.filter((s) => t !== s), i === e.l.length && console.error("[yjs] Tried to remove event handler that doesn't exist.");
3478
- }, or = (e, t, n) => hi(e.l, [t, n]);
3479
- class Kt {
3488
+ }, rr = (e, t, n) => hi(e.l, [t, n]);
3489
+ class jt {
3480
3490
  /**
3481
3491
  * @param {number} client client id
3482
3492
  * @param {number} clock unique per client id, continuous number
@@ -3485,7 +3495,7 @@ class Kt {
3485
3495
  this.client = t, this.clock = n;
3486
3496
  }
3487
3497
  }
3488
- const Me = (e, t) => e === t || e !== null && t !== null && e.client === t.client && e.clock === t.clock, C = (e, t) => new Kt(e, t), me = (e) => {
3498
+ const Me = (e, t) => e === t || e !== null && t !== null && e.client === t.client && e.clock === t.clock, C = (e, t) => new jt(e, t), me = (e) => {
3489
3499
  for (const [t, n] of e.doc.share.entries())
3490
3500
  if (n === e)
3491
3501
  return t;
@@ -3523,7 +3533,7 @@ class Gc {
3523
3533
  const Jc = (e, t, n = 0) => new Gc(e, t, n), Re = (e, t, n) => {
3524
3534
  let i = null, s = null;
3525
3535
  return e._item === null ? s = me(e) : i = C(e._item.id.client, e._item.id.clock), new qe(i, s, t, n);
3526
- }, In = (e, t, n = 0) => {
3536
+ }, An = (e, t, n = 0) => {
3527
3537
  let i = e._start;
3528
3538
  if (n < 0) {
3529
3539
  if (t === 0)
@@ -3554,7 +3564,7 @@ const Jc = (e, t, n = 0) => new Gc(e, t, n), Re = (e, t, n) => {
3554
3564
  if (B(i, s.client) <= s.clock)
3555
3565
  return null;
3556
3566
  const d = n ? Gn(i, s) : qc(i, s), h = d.item;
3557
- if (!(h instanceof I))
3567
+ if (!(h instanceof A))
3558
3568
  return null;
3559
3569
  if (c = /** @type {AbstractType<any>} */
3560
3570
  h.parent, c._item === null || !c._item.deleted) {
@@ -3570,7 +3580,7 @@ const Jc = (e, t, n = 0) => new Gc(e, t, n), Re = (e, t, n) => {
3570
3580
  if (B(i, r.client) <= r.clock)
3571
3581
  return null;
3572
3582
  const { item: d } = n ? Gn(i, r) : { item: Yt(i, r) };
3573
- if (d instanceof I && d.content instanceof ut)
3583
+ if (d instanceof A && d.content instanceof ut)
3574
3584
  c = d.content.type;
3575
3585
  else
3576
3586
  return null;
@@ -3589,14 +3599,14 @@ class gi {
3589
3599
  this.ds = t, this.sv = n;
3590
3600
  }
3591
3601
  }
3592
- const lr = (e, t) => new gi(e, t), On = (e) => lr(Lc(e.store), gn(e.store)), Rt = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.get(e.id.client) || 0) > e.id.clock && !ie(t.ds, e.id), jn = (e, t) => {
3593
- const n = St(e.meta, jn, Bt), i = e.doc.store;
3602
+ const or = (e, t) => new gi(e, t), On = (e) => or(Lc(e.store), gn(e.store)), Rt = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.get(e.id.client) || 0) > e.id.clock && !ie(t.ds, e.id), Wn = (e, t) => {
3603
+ const n = St(e.meta, Wn, Bt), i = e.doc.store;
3594
3604
  n.has(t) || (t.sv.forEach((s, r) => {
3595
3605
  s < B(i, r) && G(e, C(r, s));
3596
3606
  }), Dt(e, t.ds, (s) => {
3597
3607
  }), n.add(t));
3598
3608
  };
3599
- class cr {
3609
+ class lr {
3600
3610
  constructor() {
3601
3611
  this.clients = /* @__PURE__ */ new Map(), this.pendingStructs = null, this.pendingDs = null;
3602
3612
  }
@@ -3613,7 +3623,7 @@ const gn = (e) => {
3613
3623
  return 0;
3614
3624
  const i = n[n.length - 1];
3615
3625
  return i.id.clock + i.length;
3616
- }, ar = (e, t) => {
3626
+ }, cr = (e, t) => {
3617
3627
  let n = e.clients.get(t.id.client);
3618
3628
  if (n === void 0)
3619
3629
  n = [], e.clients.set(t.id.client, n);
@@ -3644,16 +3654,16 @@ const gn = (e) => {
3644
3654
  }, Yt = (
3645
3655
  /** @type {function(StructStore,ID):Item} */
3646
3656
  Zc
3647
- ), Kn = (e, t, n) => {
3657
+ ), jn = (e, t, n) => {
3648
3658
  const i = ht(t, n), s = t[i];
3649
- return s.id.clock < n && s instanceof I ? (t.splice(i + 1, 0, en(e, s, n - s.id.clock)), i + 1) : i;
3659
+ return s.id.clock < n && s instanceof A ? (t.splice(i + 1, 0, en(e, s, n - s.id.clock)), i + 1) : i;
3650
3660
  }, G = (e, t) => {
3651
3661
  const n = (
3652
3662
  /** @type {Array<Item>} */
3653
3663
  e.doc.store.clients.get(t.client)
3654
3664
  );
3655
- return n[Kn(e, n, t.clock)];
3656
- }, Qi = (e, t, n) => {
3665
+ return n[jn(e, n, t.clock)];
3666
+ }, Zi = (e, t, n) => {
3657
3667
  const i = t.clients.get(n.client), s = ht(i, n.clock), r = i[s];
3658
3668
  return n.clock !== r.id.clock + r.length - 1 && r.constructor !== it && i.splice(s + 1, 0, en(e, r, n.clock - r.id.clock + 1)), r;
3659
3669
  }, Qc = (e, t, n) => {
@@ -3662,13 +3672,13 @@ const gn = (e) => {
3662
3672
  e.clients.get(t.id.client)
3663
3673
  );
3664
3674
  i[ht(i, t.id.clock)] = n;
3665
- }, hr = (e, t, n, i, s) => {
3675
+ }, ar = (e, t, n, i, s) => {
3666
3676
  if (i === 0)
3667
3677
  return;
3668
3678
  const r = n + i;
3669
- let o = Kn(e, t, n), l;
3679
+ let o = jn(e, t, n), l;
3670
3680
  do
3671
- l = t[o++], r < l.id.clock + l.length && Kn(e, t, r), s(l);
3681
+ l = t[o++], r < l.id.clock + l.length && jn(e, t, r), s(l);
3672
3682
  while (o < t.length && t[o].id.clock < r);
3673
3683
  };
3674
3684
  class ta {
@@ -3681,14 +3691,14 @@ class ta {
3681
3691
  this.doc = t, this.deleteSet = new ne(), this.beforeState = gn(t.store), this.afterState = /* @__PURE__ */ new Map(), this.changed = /* @__PURE__ */ new Map(), this.changedParentTypes = /* @__PURE__ */ new Map(), this._mergeStructs = [], this.origin = n, this.meta = /* @__PURE__ */ new Map(), this.local = i, this.subdocsAdded = /* @__PURE__ */ new Set(), this.subdocsRemoved = /* @__PURE__ */ new Set(), this.subdocsLoaded = /* @__PURE__ */ new Set(), this._needFormattingCleanup = !1;
3682
3692
  }
3683
3693
  }
3684
- const ts = (e, t) => t.deleteSet.clients.size === 0 && !wl(t.afterState, (n, i) => t.beforeState.get(i) !== n) ? !1 : (fi(t.deleteSet), jc(e, t), pi(e, t.deleteSet), !0), es = (e, t, n) => {
3694
+ const Qi = (e, t) => t.deleteSet.clients.size === 0 && !wl(t.afterState, (n, i) => t.beforeState.get(i) !== n) ? !1 : (fi(t.deleteSet), Wc(e, t), pi(e, t.deleteSet), !0), ts = (e, t, n) => {
3685
3695
  const i = t._item;
3686
3696
  (i === null || i.id.clock < (e.beforeState.get(i.id.client) || 0) && !i.deleted) && St(e.changed, t, Bt).add(n);
3687
3697
  }, Fe = (e, t) => {
3688
3698
  let n = e[t], i = e[t - 1], s = t;
3689
3699
  for (; s > 0; n = i, i = e[--s - 1]) {
3690
3700
  if (i.deleted === n.deleted && i.constructor === n.constructor && i.mergeWith(n)) {
3691
- n instanceof I && n.parentSub !== null && /** @type {AbstractType<any>} */
3701
+ n instanceof A && n.parentSub !== null && /** @type {AbstractType<any>} */
3692
3702
  n.parent._map.get(n.parentSub) === n && n.parent._map.set(
3693
3703
  n.parentSub,
3694
3704
  /** @type {Item} */
@@ -3712,7 +3722,7 @@ const ts = (e, t) => t.deleteSet.clients.size === 0 && !wl(t.afterState, (n, i)
3712
3722
  const h = r[a];
3713
3723
  if (l.clock + l.len <= h.id.clock)
3714
3724
  break;
3715
- h instanceof I && h.deleted && !h.keep && n(h) && h.gc(t, !1);
3725
+ h instanceof A && h.deleted && !h.keep && n(h) && h.gc(t, !1);
3716
3726
  }
3717
3727
  }
3718
3728
  }
@@ -3728,7 +3738,7 @@ const ts = (e, t) => t.deleteSet.clients.size === 0 && !wl(t.afterState, (n, i)
3728
3738
  c -= 1 + Fe(s, c);
3729
3739
  }
3730
3740
  });
3731
- }, dr = (e, t) => {
3741
+ }, hr = (e, t) => {
3732
3742
  if (t < e.length) {
3733
3743
  const n = e[t], i = n.doc, s = i.store, r = n.deleteSet, o = n._mergeStructs;
3734
3744
  try {
@@ -3744,7 +3754,7 @@ const ts = (e, t) => t.deleteSet.clients.size === 0 && !wl(t.afterState, (n, i)
3744
3754
  (d) => d.target._item === null || !d.target._item.deleted
3745
3755
  ), c.forEach((d) => {
3746
3756
  d.currentTarget = a, d._path = null;
3747
- }), c.sort((d, h) => d.path.length - h.path.length), or(a._dEH, c, n));
3757
+ }), c.sort((d, h) => d.path.length - h.path.length), rr(a._dEH, c, n));
3748
3758
  });
3749
3759
  }), l.push(() => i.emit("afterTransaction", [n, i])), hi(l, []), n._needFormattingCleanup && ka(n);
3750
3760
  } finally {
@@ -3766,18 +3776,18 @@ const ts = (e, t) => t.deleteSet.clients.size === 0 && !wl(t.afterState, (n, i)
3766
3776
  ), g = ht(f, u);
3767
3777
  g + 1 < f.length && Fe(f, g + 1) > 1 || g > 0 && Fe(f, g);
3768
3778
  }
3769
- if (!n.local && n.afterState.get(i.clientID) !== n.beforeState.get(i.clientID) && (Rc(di, qs, "[yjs] ", Xs, Zs, "Changed the client-id because another client seems to be using it."), i.clientID = sr()), i.emit("afterTransactionCleanup", [n, i]), i._observers.has("update")) {
3779
+ if (!n.local && n.afterState.get(i.clientID) !== n.beforeState.get(i.clientID) && (Rc(di, Js, "[yjs] ", qs, Xs, "Changed the client-id because another client seems to be using it."), i.clientID = ir()), i.emit("afterTransactionCleanup", [n, i]), i._observers.has("update")) {
3770
3780
  const d = new Hc();
3771
- ts(d, n) && i.emit("update", [d.toUint8Array(), n.origin, i, n]);
3781
+ Qi(d, n) && i.emit("update", [d.toUint8Array(), n.origin, i, n]);
3772
3782
  }
3773
3783
  if (i._observers.has("updateV2")) {
3774
3784
  const d = new pn();
3775
- ts(d, n) && i.emit("updateV2", [d.toUint8Array(), n.origin, i, n]);
3785
+ Qi(d, n) && i.emit("updateV2", [d.toUint8Array(), n.origin, i, n]);
3776
3786
  }
3777
3787
  const { subdocsAdded: l, subdocsLoaded: c, subdocsRemoved: a } = n;
3778
3788
  (l.size > 0 || a.size > 0 || c.size > 0) && (l.forEach((d) => {
3779
3789
  d.clientID = i.clientID, d.collectionid == null && (d.collectionid = i.collectionid), i.subdocs.add(d);
3780
- }), a.forEach((d) => i.subdocs.delete(d)), i.emit("subdocs", [{ loaded: c, added: l, removed: a }, i, n]), a.forEach((d) => d.destroy())), e.length <= t + 1 ? (i._transactionCleanups = [], i.emit("afterAllTransactions", [i, e])) : dr(e, t + 1);
3790
+ }), a.forEach((d) => i.subdocs.delete(d)), i.emit("subdocs", [{ loaded: c, added: l, removed: a }, i, n]), a.forEach((d) => d.destroy())), e.length <= t + 1 ? (i._transactionCleanups = [], i.emit("afterAllTransactions", [i, e])) : hr(e, t + 1);
3781
3791
  }
3782
3792
  }
3783
3793
  }, O = (e, t, n = null, i = !0) => {
@@ -3789,7 +3799,7 @@ const ts = (e, t) => t.deleteSet.clients.size === 0 && !wl(t.afterState, (n, i)
3789
3799
  } finally {
3790
3800
  if (r) {
3791
3801
  const l = e._transaction === s[0];
3792
- e._transaction = null, l && dr(s, 0);
3802
+ e._transaction = null, l && hr(s, 0);
3793
3803
  }
3794
3804
  }
3795
3805
  return o;
@@ -3803,15 +3813,15 @@ class ia {
3803
3813
  this.insertions = n, this.deletions = t, this.meta = /* @__PURE__ */ new Map();
3804
3814
  }
3805
3815
  }
3806
- const ns = (e, t, n) => {
3816
+ const es = (e, t, n) => {
3807
3817
  Dt(e, n.deletions, (i) => {
3808
- i instanceof I && t.scope.some((s) => s === e.doc || we(
3818
+ i instanceof A && t.scope.some((s) => s === e.doc || we(
3809
3819
  /** @type {AbstractType<any>} */
3810
3820
  s,
3811
3821
  i
3812
3822
  )) && xi(i, !1);
3813
3823
  });
3814
- }, is = (e, t, n) => {
3824
+ }, ns = (e, t, n) => {
3815
3825
  let i = null;
3816
3826
  const s = e.doc, r = e.scope;
3817
3827
  O(s, (l) => {
@@ -3822,7 +3832,7 @@ const ns = (e, t, n) => {
3822
3832
  ), d = /* @__PURE__ */ new Set(), h = [];
3823
3833
  let u = !1;
3824
3834
  Dt(l, a.insertions, (f) => {
3825
- if (f instanceof I) {
3835
+ if (f instanceof A) {
3826
3836
  if (f.redone !== null) {
3827
3837
  let { item: g, diff: m } = Gn(c, f.id);
3828
3838
  m > 0 && (g = G(l, C(g.id.client, g.id.clock + m))), f = g;
@@ -3835,14 +3845,14 @@ const ns = (e, t, n) => {
3835
3845
  )) && h.push(f);
3836
3846
  }
3837
3847
  }), Dt(l, a.deletions, (f) => {
3838
- f instanceof I && r.some((g) => g === l.doc || we(
3848
+ f instanceof A && r.some((g) => g === l.doc || we(
3839
3849
  /** @type {AbstractType<any>} */
3840
3850
  g,
3841
3851
  f
3842
3852
  )) && // Never redo structs in stackItem.insertions because they were created and deleted in the same capture interval.
3843
3853
  !ie(a.insertions, f.id) && d.add(f);
3844
3854
  }), d.forEach((f) => {
3845
- u = Or(l, f, d, a.insertions, e.ignoreRemoteMapChanges, e) !== null || u;
3855
+ u = Ar(l, f, d, a.insertions, e.ignoreRemoteMapChanges, e) !== null || u;
3846
3856
  });
3847
3857
  for (let f = h.length - 1; f >= 0; f--) {
3848
3858
  const g = h[f];
@@ -3861,7 +3871,7 @@ const ns = (e, t, n) => {
3861
3871
  }
3862
3872
  return o;
3863
3873
  };
3864
- class ur extends Ps {
3874
+ class dr extends Ls {
3865
3875
  /**
3866
3876
  * @param {Doc|AbstractType<any>|Array<AbstractType<any>>} typeScope Limits the scope of the UndoManager. If this is set to a ydoc instance, all changes on that ydoc will be undone. If set to a specific type, only changes on that type or its children will be undone. Also accepts an array of types.
3867
3877
  * @param {UndoManagerOptions} options
@@ -3887,8 +3897,8 @@ class ur extends Ps {
3887
3897
  a ? this.stopCapturing() : d || this.clear(!1, !0);
3888
3898
  const u = new ne();
3889
3899
  c.afterState.forEach((b, w) => {
3890
- const D = c.beforeState.get(w) || 0, A = b - D;
3891
- A > 0 && ge(u, w, D, A);
3900
+ const D = c.beforeState.get(w) || 0, I = b - D;
3901
+ I > 0 && ge(u, w, D, I);
3892
3902
  });
3893
3903
  const f = nc();
3894
3904
  let g = !1;
@@ -3902,7 +3912,7 @@ class ur extends Ps {
3902
3912
  c.deleteSet,
3903
3913
  /** @param {Item|GC} item */
3904
3914
  (b) => {
3905
- b instanceof I && this.scope.some((w) => w === c.doc || we(
3915
+ b instanceof A && this.scope.some((w) => w === c.doc || we(
3906
3916
  /** @type {AbstractType<any>} */
3907
3917
  w,
3908
3918
  b
@@ -3923,7 +3933,7 @@ class ur extends Ps {
3923
3933
  addToScope(t) {
3924
3934
  const n = new Set(this.scope);
3925
3935
  t = Pn(t) ? t : [t], t.forEach((i) => {
3926
- n.has(i) || (n.add(i), (i instanceof F ? i.doc !== this.doc : i !== this.doc) && tr("[yjs#509] Not same Y.Doc"), this.scope.push(i));
3936
+ n.has(i) || (n.add(i), (i instanceof F ? i.doc !== this.doc : i !== this.doc) && Qs("[yjs#509] Not same Y.Doc"), this.scope.push(i));
3927
3937
  });
3928
3938
  }
3929
3939
  /**
@@ -3940,7 +3950,7 @@ class ur extends Ps {
3940
3950
  }
3941
3951
  clear(t = !0, n = !0) {
3942
3952
  (t && this.canUndo() || n && this.canRedo()) && this.doc.transact((i) => {
3943
- t && (this.undoStack.forEach((s) => ns(i, this, s)), this.undoStack = []), n && (this.redoStack.forEach((s) => ns(i, this, s)), this.redoStack = []), this.emit("stack-cleared", [{ undoStackCleared: t, redoStackCleared: n }]);
3953
+ t && (this.undoStack.forEach((s) => es(i, this, s)), this.undoStack = []), n && (this.redoStack.forEach((s) => es(i, this, s)), this.redoStack = []), this.emit("stack-cleared", [{ undoStackCleared: t, redoStackCleared: n }]);
3944
3954
  });
3945
3955
  }
3946
3956
  /**
@@ -3975,7 +3985,7 @@ class ur extends Ps {
3975
3985
  this.undoing = !0;
3976
3986
  let t;
3977
3987
  try {
3978
- t = is(this, this.undoStack, "undo");
3988
+ t = ns(this, this.undoStack, "undo");
3979
3989
  } finally {
3980
3990
  this.undoing = !1;
3981
3991
  }
@@ -3990,7 +4000,7 @@ class ur extends Ps {
3990
4000
  this.redoing = !0;
3991
4001
  let t;
3992
4002
  try {
3993
- t = is(this, this.redoStack, "redo");
4003
+ t = ns(this, this.redoStack, "redo");
3994
4004
  } finally {
3995
4005
  this.redoing = !1;
3996
4006
  }
@@ -4027,11 +4037,11 @@ function* sa(e) {
4027
4037
  const c = R(e.restDecoder);
4028
4038
  yield new ot(C(s, r), c), r += c;
4029
4039
  } else if ((dn & l) !== 0) {
4030
- const c = (l & (bt | K)) === 0, a = new I(
4040
+ const c = (l & (bt | j)) === 0, a = new A(
4031
4041
  C(s, r),
4032
4042
  null,
4033
4043
  // left
4034
- (l & K) === K ? e.readLeftID() : null,
4044
+ (l & j) === j ? e.readLeftID() : null,
4035
4045
  // origin
4036
4046
  null,
4037
4047
  // right
@@ -4042,7 +4052,7 @@ function* sa(e) {
4042
4052
  // parent
4043
4053
  c && (l & ue) === ue ? e.readString() : null,
4044
4054
  // parentSub
4045
- Mr(e, l)
4055
+ Or(e, l)
4046
4056
  // item content
4047
4057
  );
4048
4058
  yield a, r += a.length;
@@ -4091,7 +4101,7 @@ const la = (e, t) => {
4091
4101
  /** @type {Item} */
4092
4102
  e
4093
4103
  ), { client: i, clock: s } = n.id;
4094
- return new I(
4104
+ return new A(
4095
4105
  C(i, s + t),
4096
4106
  null,
4097
4107
  C(i, s + t - 1),
@@ -4102,7 +4112,7 @@ const la = (e, t) => {
4102
4112
  n.content.splice(t)
4103
4113
  );
4104
4114
  }
4105
- }, ss = (e, t = Je, n = pn) => {
4115
+ }, is = (e, t = Je, n = pn) => {
4106
4116
  if (e.length === 1)
4107
4117
  return e[0];
4108
4118
  const i = e.map((d) => new t(li(d)));
@@ -4161,19 +4171,19 @@ const la = (e, t) => {
4161
4171
  r !== null && (ae(l, r.struct, r.offset), r = null), ca(l);
4162
4172
  const c = i.map((d) => Pc(d)), a = zn(c);
4163
4173
  return pi(o, a), o.toUint8Array();
4164
- }, fr = (e) => {
4174
+ }, ur = (e) => {
4165
4175
  e.written > 0 && (e.clientStructs.push({ written: e.written, restEncoder: lt(e.encoder.restEncoder) }), e.encoder.restEncoder = Te(), e.written = 0);
4166
4176
  }, ae = (e, t, n) => {
4167
- e.written > 0 && e.currClient !== t.id.client && fr(e), e.written === 0 && (e.currClient = t.id.client, e.encoder.writeClient(t.id.client), T(e.encoder.restEncoder, t.id.clock + n)), t.write(e.encoder, n), e.written++;
4177
+ e.written > 0 && e.currClient !== t.id.client && ur(e), e.written === 0 && (e.currClient = t.id.client, e.encoder.writeClient(t.id.client), T(e.encoder.restEncoder, t.id.clock + n)), t.write(e.encoder, n), e.written++;
4168
4178
  }, ca = (e) => {
4169
- fr(e);
4179
+ ur(e);
4170
4180
  const t = e.encoder.restEncoder;
4171
4181
  T(t, e.clientStructs.length);
4172
4182
  for (let n = 0; n < e.clientStructs.length; n++) {
4173
4183
  const i = e.clientStructs[n];
4174
4184
  T(t, i.written), un(t, i.restEncoder);
4175
4185
  }
4176
- }, rs = "You must not compute changes after the event-handler fired.";
4186
+ }, ss = "You must not compute changes after the event-handler fired.";
4177
4187
  class mn {
4178
4188
  /**
4179
4189
  * @param {T} target The changed type.
@@ -4215,7 +4225,7 @@ class mn {
4215
4225
  get keys() {
4216
4226
  if (this._keys === null) {
4217
4227
  if (this.transaction.doc._transactionCleanups.length === 0)
4218
- throw Tt(rs);
4228
+ throw Tt(ss);
4219
4229
  const t = /* @__PURE__ */ new Map(), n = this.target;
4220
4230
  /** @type Set<string|null> */
4221
4231
  this.transaction.changed.get(n).forEach((s) => {
@@ -4283,7 +4293,7 @@ class mn {
4283
4293
  let t = this._changes;
4284
4294
  if (t === null) {
4285
4295
  if (this.transaction.doc._transactionCleanups.length === 0)
4286
- throw Tt(rs);
4296
+ throw Tt(ss);
4287
4297
  const n = this.target, i = Bt(), s = Bt(), r = [];
4288
4298
  if (t = {
4289
4299
  added: i,
@@ -4326,9 +4336,9 @@ const aa = (e, t) => {
4326
4336
  t._item.parent;
4327
4337
  }
4328
4338
  return n;
4329
- }, j = () => {
4330
- tr("Invalid access: Add Yjs type to a document before reading data.");
4331
- }, pr = 80;
4339
+ }, W = () => {
4340
+ Qs("Invalid access: Add Yjs type to a document before reading data.");
4341
+ }, fr = 80;
4332
4342
  let mi = 0;
4333
4343
  class ha {
4334
4344
  /**
@@ -4341,12 +4351,12 @@ class ha {
4341
4351
  }
4342
4352
  const da = (e) => {
4343
4353
  e.timestamp = mi++;
4344
- }, gr = (e, t, n) => {
4354
+ }, pr = (e, t, n) => {
4345
4355
  e.p.marker = !1, e.p = t, t.marker = !0, e.index = n, e.timestamp = mi++;
4346
4356
  }, ua = (e, t, n) => {
4347
- if (e.length >= pr) {
4357
+ if (e.length >= fr) {
4348
4358
  const i = e.reduce((s, r) => s.timestamp < r.timestamp ? s : r);
4349
- return gr(i, t, n), i;
4359
+ return pr(i, t, n), i;
4350
4360
  } else {
4351
4361
  const i = new ha(t, n);
4352
4362
  return e.push(i), i;
@@ -4369,7 +4379,7 @@ const da = (e) => {
4369
4379
  for (; i.left !== null && i.left.id.client === i.id.client && i.left.id.clock + i.left.length === i.id.clock; )
4370
4380
  i = i.left, !i.deleted && i.countable && (s -= i.length);
4371
4381
  return n !== null && Ve(n.index - s) < /** @type {YText|YArray<any>} */
4372
- i.parent.length / pr ? (gr(n, i, s), n) : ua(e._searchMarker, i, s);
4382
+ i.parent.length / fr ? (pr(n, i, s), n) : ua(e._searchMarker, i, s);
4373
4383
  }, be = (e, t, n) => {
4374
4384
  for (let i = e.length - 1; i >= 0; i--) {
4375
4385
  const s = e[i];
@@ -4390,11 +4400,11 @@ const da = (e) => {
4390
4400
  for (; St(s, e, () => []).push(n), e._item !== null; )
4391
4401
  e = /** @type {AbstractType<any>} */
4392
4402
  e._item.parent;
4393
- or(i._eH, n, t);
4403
+ rr(i._eH, n, t);
4394
4404
  };
4395
4405
  class F {
4396
4406
  constructor() {
4397
- this._item = null, this._map = /* @__PURE__ */ new Map(), this._start = null, this.doc = null, this._length = 0, this._eH = qi(), this._dEH = qi(), this._searchMarker = null;
4407
+ this._item = null, this._map = /* @__PURE__ */ new Map(), this._start = null, this.doc = null, this._length = 0, this._eH = Ji(), this._dEH = Ji(), this._searchMarker = null;
4398
4408
  }
4399
4409
  /**
4400
4410
  * @return {AbstractType<any>|null}
@@ -4464,7 +4474,7 @@ class F {
4464
4474
  * @param {function(EventType, Transaction):void} f Observer function
4465
4475
  */
4466
4476
  observe(t) {
4467
- Xi(this._eH, t);
4477
+ qi(this._eH, t);
4468
4478
  }
4469
4479
  /**
4470
4480
  * Observe all events that are created by this type and its children.
@@ -4472,7 +4482,7 @@ class F {
4472
4482
  * @param {function(Array<YEvent<any>>,Transaction):void} f Observer function
4473
4483
  */
4474
4484
  observeDeep(t) {
4475
- Xi(this._dEH, t);
4485
+ qi(this._dEH, t);
4476
4486
  }
4477
4487
  /**
4478
4488
  * Unregister an observer function.
@@ -4480,7 +4490,7 @@ class F {
4480
4490
  * @param {function(EventType,Transaction):void} f Observer function
4481
4491
  */
4482
4492
  unobserve(t) {
4483
- Zi(this._eH, t);
4493
+ Xi(this._eH, t);
4484
4494
  }
4485
4495
  /**
4486
4496
  * Unregister an observer function.
@@ -4488,7 +4498,7 @@ class F {
4488
4498
  * @param {function(Array<YEvent<any>>,Transaction):void} f Observer function
4489
4499
  */
4490
4500
  unobserveDeep(t) {
4491
- Zi(this._dEH, t);
4501
+ Xi(this._dEH, t);
4492
4502
  }
4493
4503
  /**
4494
4504
  * @abstract
@@ -4497,8 +4507,8 @@ class F {
4497
4507
  toJSON() {
4498
4508
  }
4499
4509
  }
4500
- const mr = (e, t, n) => {
4501
- e.doc ?? j(), t < 0 && (t = e._length + t), n < 0 && (n = e._length + n);
4510
+ const gr = (e, t, n) => {
4511
+ e.doc ?? W(), t < 0 && (t = e._length + t), n < 0 && (n = e._length + n);
4502
4512
  let i = n - t;
4503
4513
  const s = [];
4504
4514
  let r = e._start;
@@ -4516,8 +4526,8 @@ const mr = (e, t, n) => {
4516
4526
  r = r.right;
4517
4527
  }
4518
4528
  return s;
4519
- }, wr = (e) => {
4520
- e.doc ?? j();
4529
+ }, mr = (e) => {
4530
+ e.doc ?? W();
4521
4531
  const t = [];
4522
4532
  let n = e._start;
4523
4533
  for (; n !== null; ) {
@@ -4529,7 +4539,7 @@ const mr = (e, t, n) => {
4529
4539
  n = n.right;
4530
4540
  }
4531
4541
  return t;
4532
- }, br = (e, t) => {
4542
+ }, wr = (e, t) => {
4533
4543
  const n = [];
4534
4544
  let i = e._start;
4535
4545
  for (; i !== null; ) {
@@ -4543,7 +4553,7 @@ const mr = (e, t, n) => {
4543
4553
  return n;
4544
4554
  }, ye = (e, t) => {
4545
4555
  let n = 0, i = e._start;
4546
- for (e.doc ?? j(); i !== null; ) {
4556
+ for (e.doc ?? W(); i !== null; ) {
4547
4557
  if (i.countable && !i.deleted) {
4548
4558
  const s = i.content.getContent();
4549
4559
  for (let r = 0; r < s.length; r++)
@@ -4551,7 +4561,7 @@ const mr = (e, t, n) => {
4551
4561
  }
4552
4562
  i = i.right;
4553
4563
  }
4554
- }, yr = (e, t) => {
4564
+ }, br = (e, t) => {
4555
4565
  const n = [];
4556
4566
  return ye(e, (i, s) => {
4557
4567
  n.push(t(i, s, e));
@@ -4580,8 +4590,8 @@ const mr = (e, t, n) => {
4580
4590
  };
4581
4591
  }
4582
4592
  };
4583
- }, xr = (e, t) => {
4584
- e.doc ?? j();
4593
+ }, yr = (e, t) => {
4594
+ e.doc ?? W();
4585
4595
  const n = wn(e, t);
4586
4596
  let i = e._start;
4587
4597
  for (n !== null && (i = n.p, t -= n.index); i !== null; i = i.right)
@@ -4595,7 +4605,7 @@ const mr = (e, t, n) => {
4595
4605
  const r = e.doc, o = r.clientID, l = r.store, c = n === null ? t._start : n.right;
4596
4606
  let a = [];
4597
4607
  const d = () => {
4598
- a.length > 0 && (s = new I(C(o, B(l, o)), s, s && s.lastId, c, c && c.id, t, null, new $t(a)), s.integrate(e, 0), a = []);
4608
+ a.length > 0 && (s = new A(C(o, B(l, o)), s, s && s.lastId, c, c && c.id, t, null, new $t(a)), s.integrate(e, 0), a = []);
4599
4609
  };
4600
4610
  i.forEach((h) => {
4601
4611
  if (h === null)
@@ -4613,28 +4623,28 @@ const mr = (e, t, n) => {
4613
4623
  switch (d(), h.constructor) {
4614
4624
  case Uint8Array:
4615
4625
  case ArrayBuffer:
4616
- s = new I(C(o, B(l, o)), s, s && s.lastId, c, c && c.id, t, null, new De(new Uint8Array(
4626
+ s = new A(C(o, B(l, o)), s, s && s.lastId, c, c && c.id, t, null, new De(new Uint8Array(
4617
4627
  /** @type {Uint8Array} */
4618
4628
  h
4619
4629
  ))), s.integrate(e, 0);
4620
4630
  break;
4621
4631
  case Ft:
4622
- s = new I(C(o, B(l, o)), s, s && s.lastId, c, c && c.id, t, null, new Ae(
4632
+ s = new A(C(o, B(l, o)), s, s && s.lastId, c, c && c.id, t, null, new Ie(
4623
4633
  /** @type {Doc} */
4624
4634
  h
4625
4635
  )), s.integrate(e, 0);
4626
4636
  break;
4627
4637
  default:
4628
4638
  if (h instanceof F)
4629
- s = new I(C(o, B(l, o)), s, s && s.lastId, c, c && c.id, t, null, new ut(h)), s.integrate(e, 0);
4639
+ s = new A(C(o, B(l, o)), s, s && s.lastId, c, c && c.id, t, null, new ut(h)), s.integrate(e, 0);
4630
4640
  else
4631
4641
  throw new Error("Unexpected content type in insert operation");
4632
4642
  }
4633
4643
  }
4634
4644
  }), d();
4635
- }, Sr = () => Tt("Length exceeded!"), kr = (e, t, n, i) => {
4645
+ }, xr = () => Tt("Length exceeded!"), Sr = (e, t, n, i) => {
4636
4646
  if (n > t._length)
4637
- throw Sr();
4647
+ throw xr();
4638
4648
  if (n === 0)
4639
4649
  return t._searchMarker && be(t._searchMarker, n, i.length), Xe(e, t, null, i);
4640
4650
  const s = n, r = wn(t, n);
@@ -4654,7 +4664,7 @@ const mr = (e, t, n) => {
4654
4664
  for (; s.right; )
4655
4665
  s = s.right;
4656
4666
  return Xe(e, t, s, n);
4657
- }, vr = (e, t, n, i) => {
4667
+ }, kr = (e, t, n, i) => {
4658
4668
  if (i === 0)
4659
4669
  return;
4660
4670
  const s = n, r = i, o = wn(t, n);
@@ -4664,7 +4674,7 @@ const mr = (e, t, n) => {
4664
4674
  for (; i > 0 && l !== null; )
4665
4675
  l.deleted || (i < l.length && G(e, C(l.id.client, l.id.clock + i)), l.delete(e), i -= l.length), l = l.right;
4666
4676
  if (i > 0)
4667
- throw Sr();
4677
+ throw xr();
4668
4678
  t._searchMarker && be(
4669
4679
  t._searchMarker,
4670
4680
  s,
@@ -4697,7 +4707,7 @@ const mr = (e, t, n) => {
4697
4707
  );
4698
4708
  break;
4699
4709
  case Ft:
4700
- l = new Ae(
4710
+ l = new Ie(
4701
4711
  /** @type {Doc} */
4702
4712
  i
4703
4713
  );
@@ -4708,18 +4718,18 @@ const mr = (e, t, n) => {
4708
4718
  else
4709
4719
  throw new Error("Unexpected content type");
4710
4720
  }
4711
- new I(C(o, B(r.store, o)), s, s && s.lastId, null, null, t, n, l).integrate(e, 0);
4721
+ new A(C(o, B(r.store, o)), s, s && s.lastId, null, null, t, n, l).integrate(e, 0);
4712
4722
  }, bi = (e, t) => {
4713
- e.doc ?? j();
4723
+ e.doc ?? W();
4714
4724
  const n = e._map.get(t);
4715
4725
  return n !== void 0 && !n.deleted ? n.content.getContent()[n.length - 1] : void 0;
4716
- }, Cr = (e) => {
4726
+ }, vr = (e) => {
4717
4727
  const t = {};
4718
- return e.doc ?? j(), e._map.forEach((n, i) => {
4728
+ return e.doc ?? W(), e._map.forEach((n, i) => {
4719
4729
  n.deleted || (t[i] = n.content.getContent()[n.length - 1]);
4720
4730
  }), t;
4721
- }, _r = (e, t) => {
4722
- e.doc ?? j();
4731
+ }, Cr = (e, t) => {
4732
+ e.doc ?? W();
4723
4733
  const n = e._map.get(t);
4724
4734
  return n !== void 0 && !n.deleted;
4725
4735
  }, ga = (e, t) => {
@@ -4730,7 +4740,7 @@ const mr = (e, t, n) => {
4730
4740
  r = r.left;
4731
4741
  r !== null && Rt(r, t) && (n[s] = r.content.getContent()[r.length - 1]);
4732
4742
  }), n;
4733
- }, Ne = (e) => (e.doc ?? j(), Nc(
4743
+ }, Ne = (e) => (e.doc ?? W(), Nc(
4734
4744
  e._map.entries(),
4735
4745
  /** @param {any} entry */
4736
4746
  (t) => !t[1].deleted
@@ -4791,7 +4801,7 @@ class Gt extends F {
4791
4801
  )), t;
4792
4802
  }
4793
4803
  get length() {
4794
- return this.doc ?? j(), this._length;
4804
+ return this.doc ?? W(), this._length;
4795
4805
  }
4796
4806
  /**
4797
4807
  * Creates YArrayEvent and calls observers.
@@ -4820,7 +4830,7 @@ class Gt extends F {
4820
4830
  */
4821
4831
  insert(t, n) {
4822
4832
  this.doc !== null ? O(this.doc, (i) => {
4823
- kr(
4833
+ Sr(
4824
4834
  i,
4825
4835
  this,
4826
4836
  t,
@@ -4862,7 +4872,7 @@ class Gt extends F {
4862
4872
  */
4863
4873
  delete(t, n = 1) {
4864
4874
  this.doc !== null ? O(this.doc, (i) => {
4865
- vr(i, this, t, n);
4875
+ kr(i, this, t, n);
4866
4876
  }) : this._prelimContent.splice(t, n);
4867
4877
  }
4868
4878
  /**
@@ -4872,7 +4882,7 @@ class Gt extends F {
4872
4882
  * @return {T}
4873
4883
  */
4874
4884
  get(t) {
4875
- return xr(this, t);
4885
+ return yr(this, t);
4876
4886
  }
4877
4887
  /**
4878
4888
  * Transforms this YArray to a JavaScript Array.
@@ -4880,7 +4890,7 @@ class Gt extends F {
4880
4890
  * @return {Array<T>}
4881
4891
  */
4882
4892
  toArray() {
4883
- return wr(this);
4893
+ return mr(this);
4884
4894
  }
4885
4895
  /**
4886
4896
  * Returns a portion of this YArray into a JavaScript Array selected
@@ -4891,7 +4901,7 @@ class Gt extends F {
4891
4901
  * @return {Array<T>}
4892
4902
  */
4893
4903
  slice(t = 0, n = this.length) {
4894
- return mr(this, t, n);
4904
+ return gr(this, t, n);
4895
4905
  }
4896
4906
  /**
4897
4907
  * Transforms this Shared Type to a JSON object.
@@ -4911,7 +4921,7 @@ class Gt extends F {
4911
4921
  * callback function
4912
4922
  */
4913
4923
  map(t) {
4914
- return yr(
4924
+ return br(
4915
4925
  this,
4916
4926
  /** @type {any} */
4917
4927
  t
@@ -5009,7 +5019,7 @@ class Qt extends F {
5009
5019
  * @return {Object<string,any>}
5010
5020
  */
5011
5021
  toJSON() {
5012
- this.doc ?? j();
5022
+ this.doc ?? W();
5013
5023
  const t = {};
5014
5024
  return this._map.forEach((n, i) => {
5015
5025
  if (!n.deleted) {
@@ -5032,7 +5042,7 @@ class Qt extends F {
5032
5042
  * @return {IterableIterator<string>}
5033
5043
  */
5034
5044
  keys() {
5035
- return An(
5045
+ return In(
5036
5046
  Ne(this),
5037
5047
  /** @param {any} v */
5038
5048
  (t) => t[0]
@@ -5044,7 +5054,7 @@ class Qt extends F {
5044
5054
  * @return {IterableIterator<MapType>}
5045
5055
  */
5046
5056
  values() {
5047
- return An(
5057
+ return In(
5048
5058
  Ne(this),
5049
5059
  /** @param {any} v */
5050
5060
  (t) => t[1].content.getContent()[t[1].length - 1]
@@ -5056,7 +5066,7 @@ class Qt extends F {
5056
5066
  * @return {IterableIterator<[string, MapType]>}
5057
5067
  */
5058
5068
  entries() {
5059
- return An(
5069
+ return In(
5060
5070
  Ne(this),
5061
5071
  /** @param {any} v */
5062
5072
  (t) => (
@@ -5071,7 +5081,7 @@ class Qt extends F {
5071
5081
  * @param {function(MapType,string,YMap<MapType>):void} f A function to execute on every element of this YArray.
5072
5082
  */
5073
5083
  forEach(t) {
5074
- this.doc ?? j(), this._map.forEach((n, i) => {
5084
+ this.doc ?? W(), this._map.forEach((n, i) => {
5075
5085
  n.deleted || t(n.content.getContent()[n.length - 1], i, this);
5076
5086
  });
5077
5087
  }
@@ -5131,7 +5141,7 @@ class Qt extends F {
5131
5141
  * @return {boolean}
5132
5142
  */
5133
5143
  has(t) {
5134
- return _r(this, t);
5144
+ return Cr(this, t);
5135
5145
  }
5136
5146
  /**
5137
5147
  * Removes all elements from this YMap.
@@ -5180,7 +5190,7 @@ class Yn {
5180
5190
  this.left = this.right, this.right = this.right.right;
5181
5191
  }
5182
5192
  }
5183
- const os = (e, t, n) => {
5193
+ const rs = (e, t, n) => {
5184
5194
  for (; t.right !== null && n > 0; ) {
5185
5195
  switch (t.right.content.constructor) {
5186
5196
  case V:
@@ -5201,12 +5211,12 @@ const os = (e, t, n) => {
5201
5211
  const s = /* @__PURE__ */ new Map(), r = i ? wn(t, n) : null;
5202
5212
  if (r) {
5203
5213
  const o = new Yn(r.p.left, r.p, r.index, s);
5204
- return os(e, o, n - r.index);
5214
+ return rs(e, o, n - r.index);
5205
5215
  } else {
5206
5216
  const o = new Yn(null, t._start, 0, s);
5207
- return os(e, o, n);
5217
+ return rs(e, o, n);
5208
5218
  }
5209
- }, Er = (e, t, n, i) => {
5219
+ }, _r = (e, t, n, i) => {
5210
5220
  for (; n.right !== null && (n.right.deleted === !0 || n.right.content.constructor === V && Ct(
5211
5221
  i.get(
5212
5222
  /** @type {ContentFormat} */
@@ -5221,13 +5231,13 @@ const os = (e, t, n) => {
5221
5231
  ), n.forward();
5222
5232
  const s = e.doc, r = s.clientID;
5223
5233
  i.forEach((o, l) => {
5224
- const c = n.left, a = n.right, d = new I(C(r, B(s.store, r)), c, c && c.lastId, a, a && a.id, t, null, new V(l, o));
5234
+ const c = n.left, a = n.right, d = new A(C(r, B(s.store, r)), c, c && c.lastId, a, a && a.id, t, null, new V(l, o));
5225
5235
  d.integrate(e, 0), n.right = d, n.forward();
5226
5236
  });
5227
5237
  }, se = (e, t) => {
5228
5238
  const { key: n, value: i } = t;
5229
5239
  i === null ? e.delete(n) : e.set(n, i);
5230
- }, Tr = (e, t) => {
5240
+ }, Er = (e, t) => {
5231
5241
  for (; e.right !== null; ) {
5232
5242
  if (!(e.right.deleted || e.right.content.constructor === V && Ct(
5233
5243
  t[
@@ -5239,14 +5249,14 @@ const os = (e, t, n) => {
5239
5249
  ))) break;
5240
5250
  e.forward();
5241
5251
  }
5242
- }, Dr = (e, t, n, i) => {
5252
+ }, Tr = (e, t, n, i) => {
5243
5253
  const s = e.doc, r = s.clientID, o = /* @__PURE__ */ new Map();
5244
5254
  for (const l in i) {
5245
5255
  const c = i[l], a = n.currentAttributes.get(l) ?? null;
5246
5256
  if (!Ct(a, c)) {
5247
5257
  o.set(l, a);
5248
5258
  const { left: d, right: h } = n;
5249
- n.right = new I(C(r, B(s.store, r)), d, d && d.lastId, h, h && h.id, t, null, new V(l, c)), n.right.integrate(e, 0), n.forward();
5259
+ n.right = new A(C(r, B(s.store, r)), d, d && d.lastId, h, h && h.id, t, null, new V(l, c)), n.right.integrate(e, 0), n.forward();
5250
5260
  }
5251
5261
  }
5252
5262
  return o;
@@ -5255,17 +5265,17 @@ const os = (e, t, n) => {
5255
5265
  s[f] === void 0 && (s[f] = null);
5256
5266
  });
5257
5267
  const r = e.doc, o = r.clientID;
5258
- Tr(n, s);
5259
- const l = Dr(e, t, n, s), c = i.constructor === String ? new dt(
5268
+ Er(n, s);
5269
+ const l = Tr(e, t, n, s), c = i.constructor === String ? new dt(
5260
5270
  /** @type {string} */
5261
5271
  i
5262
5272
  ) : i instanceof F ? new ut(i) : new zt(i);
5263
5273
  let { left: a, right: d, index: h } = n;
5264
- t._searchMarker && be(t._searchMarker, n.index, c.getLength()), d = new I(C(o, B(r.store, o)), a, a && a.lastId, d, d && d.id, t, null, c), d.integrate(e, 0), n.right = d, n.index = h, n.forward(), Er(e, t, n, l);
5265
- }, ls = (e, t, n, i, s) => {
5274
+ t._searchMarker && be(t._searchMarker, n.index, c.getLength()), d = new A(C(o, B(r.store, o)), a, a && a.lastId, d, d && d.id, t, null, c), d.integrate(e, 0), n.right = d, n.index = h, n.forward(), _r(e, t, n, l);
5275
+ }, os = (e, t, n, i, s) => {
5266
5276
  const r = e.doc, o = r.clientID;
5267
- Tr(n, s);
5268
- const l = Dr(e, t, n, s);
5277
+ Er(n, s);
5278
+ const l = Tr(e, t, n, s);
5269
5279
  t: for (; n.right !== null && (i > 0 || l.size > 0 && (n.right.deleted || n.right.content.constructor === V)); ) {
5270
5280
  if (!n.right.deleted)
5271
5281
  switch (n.right.content.constructor) {
@@ -5298,10 +5308,10 @@ const os = (e, t, n) => {
5298
5308
  for (; i > 0; i--)
5299
5309
  c += `
5300
5310
  `;
5301
- n.right = new I(C(o, B(r.store, o)), n.left, n.left && n.left.lastId, n.right, n.right && n.right.id, t, null, new dt(c)), n.right.integrate(e, 0), n.forward();
5311
+ n.right = new A(C(o, B(r.store, o)), n.left, n.left && n.left.lastId, n.right, n.right && n.right.id, t, null, new dt(c)), n.right.integrate(e, 0), n.forward();
5302
5312
  }
5303
- Er(e, t, n, l);
5304
- }, Ar = (e, t, n, i, s) => {
5313
+ _r(e, t, n, l);
5314
+ }, Dr = (e, t, n, i, s) => {
5305
5315
  let r = t;
5306
5316
  const o = ct();
5307
5317
  for (; r && (!r.countable || r.deleted); ) {
@@ -5373,7 +5383,7 @@ const os = (e, t, n) => {
5373
5383
  );
5374
5384
  break;
5375
5385
  default:
5376
- t += Ar(n, i, s, r, o), r = Ln(o), i = s;
5386
+ t += Dr(n, i, s, r, o), r = Ln(o), i = s;
5377
5387
  break;
5378
5388
  }
5379
5389
  s = s.right;
@@ -5384,7 +5394,7 @@ const os = (e, t, n) => {
5384
5394
  const t = /* @__PURE__ */ new Set(), n = e.doc;
5385
5395
  for (const [i, s] of e.afterState.entries()) {
5386
5396
  const r = e.beforeState.get(i) || 0;
5387
- s !== r && hr(
5397
+ s !== r && ar(
5388
5398
  e,
5389
5399
  /** @type {Array<Item|GC>} */
5390
5400
  n.store.clients.get(i),
@@ -5416,7 +5426,7 @@ const os = (e, t, n) => {
5416
5426
  for (const s of t)
5417
5427
  Sa(s);
5418
5428
  });
5419
- }, cs = (e, t, n) => {
5429
+ }, ls = (e, t, n) => {
5420
5430
  const i = n, s = Ln(t.currentAttributes), r = t.right;
5421
5431
  for (; n > 0 && t.right !== null; ) {
5422
5432
  if (t.right.deleted === !1)
@@ -5429,7 +5439,7 @@ const os = (e, t, n) => {
5429
5439
  }
5430
5440
  t.forward();
5431
5441
  }
5432
- r && Ar(e, r, t.right, s, t.currentAttributes);
5442
+ r && Dr(e, r, t.right, s, t.currentAttributes);
5433
5443
  const o = (
5434
5444
  /** @type {AbstractType<any>} */
5435
5445
  /** @type {Item} */
@@ -5558,7 +5568,7 @@ class va extends mn {
5558
5568
  );
5559
5569
  }
5560
5570
  }
5561
- class At extends F {
5571
+ class It extends F {
5562
5572
  /**
5563
5573
  * @param {String} [string] The initial value of the YText.
5564
5574
  */
@@ -5571,7 +5581,7 @@ class At extends F {
5571
5581
  * @type {number}
5572
5582
  */
5573
5583
  get length() {
5574
- return this.doc ?? j(), this._length;
5584
+ return this.doc ?? W(), this._length;
5575
5585
  }
5576
5586
  /**
5577
5587
  * @param {Doc} y
@@ -5587,7 +5597,7 @@ class At extends F {
5587
5597
  this._pending = null;
5588
5598
  }
5589
5599
  _copy() {
5590
- return new At();
5600
+ return new It();
5591
5601
  }
5592
5602
  /**
5593
5603
  * Makes a copy of this data type that can be included somewhere else.
@@ -5597,7 +5607,7 @@ class At extends F {
5597
5607
  * @return {YText}
5598
5608
  */
5599
5609
  clone() {
5600
- const t = new At();
5610
+ const t = new It();
5601
5611
  return t.applyDelta(this.toDelta()), t;
5602
5612
  }
5603
5613
  /**
@@ -5617,7 +5627,7 @@ class At extends F {
5617
5627
  * @public
5618
5628
  */
5619
5629
  toString() {
5620
- this.doc ?? j();
5630
+ this.doc ?? W();
5621
5631
  let t = "", n = this._start;
5622
5632
  for (; n !== null; )
5623
5633
  !n.deleted && n.countable && n.content.constructor === dt && (t += /** @type {ContentString} */
@@ -5652,7 +5662,7 @@ class At extends F {
5652
5662
  const l = !n && typeof o.insert == "string" && r === t.length - 1 && s.right === null && o.insert.slice(-1) === `
5653
5663
  ` ? o.insert.slice(0, -1) : o.insert;
5654
5664
  (typeof l != "string" || l.length > 0) && Mn(i, this, s, l, o.attributes || {});
5655
- } else o.retain !== void 0 ? ls(i, this, s, o.retain, o.attributes || {}) : o.delete !== void 0 && cs(i, s, o.delete);
5665
+ } else o.retain !== void 0 ? os(i, this, s, o.retain, o.attributes || {}) : o.delete !== void 0 && ls(i, s, o.delete);
5656
5666
  }
5657
5667
  }) : this._pending.push(() => this.applyDelta(t));
5658
5668
  }
@@ -5667,7 +5677,7 @@ class At extends F {
5667
5677
  * @public
5668
5678
  */
5669
5679
  toDelta(t, n, i) {
5670
- this.doc ?? j();
5680
+ this.doc ?? W();
5671
5681
  const s = [], r = /* @__PURE__ */ new Map(), o = (
5672
5682
  /** @type {Doc} */
5673
5683
  this.doc
@@ -5725,7 +5735,7 @@ class At extends F {
5725
5735
  a();
5726
5736
  };
5727
5737
  return t || n ? O(o, (h) => {
5728
- t && jn(h, t), n && jn(h, n), d();
5738
+ t && Wn(h, t), n && Wn(h, n), d();
5729
5739
  }, "cleanup") : d(), s;
5730
5740
  }
5731
5741
  /**
@@ -5779,7 +5789,7 @@ class At extends F {
5779
5789
  return;
5780
5790
  const i = this.doc;
5781
5791
  i !== null ? O(i, (s) => {
5782
- cs(s, Ue(s, this, t, !0), n);
5792
+ ls(s, Ue(s, this, t, !0), n);
5783
5793
  }) : this._pending.push(() => this.delete(t, n));
5784
5794
  }
5785
5795
  /**
@@ -5798,7 +5808,7 @@ class At extends F {
5798
5808
  const s = this.doc;
5799
5809
  s !== null ? O(s, (r) => {
5800
5810
  const o = Ue(r, this, t, !1);
5801
- o.right !== null && ls(r, this, o, n, i);
5811
+ o.right !== null && os(r, this, o, n, i);
5802
5812
  }) : this._pending.push(() => this.format(t, n, i));
5803
5813
  }
5804
5814
  /**
@@ -5857,7 +5867,7 @@ class At extends F {
5857
5867
  * @public
5858
5868
  */
5859
5869
  getAttributes() {
5860
- return Cr(this);
5870
+ return vr(this);
5861
5871
  }
5862
5872
  /**
5863
5873
  * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
@@ -5866,7 +5876,7 @@ class At extends F {
5866
5876
  t.writeTypeRef(za);
5867
5877
  }
5868
5878
  }
5869
- const Ca = (e) => new At();
5879
+ const Ca = (e) => new It();
5870
5880
  class Rn {
5871
5881
  /**
5872
5882
  * @param {YXmlFragment | YXmlElement} root
@@ -5874,7 +5884,7 @@ class Rn {
5874
5884
  */
5875
5885
  constructor(t, n = () => !0) {
5876
5886
  this._filter = n, this._root = t, this._currentNode = /** @type {Item} */
5877
- t._start, this._firstCall = !0, t.doc ?? j();
5887
+ t._start, this._firstCall = !0, t.doc ?? W();
5878
5888
  }
5879
5889
  [Symbol.iterator]() {
5880
5890
  return this;
@@ -5892,7 +5902,7 @@ class Rn {
5892
5902
  if (t !== null && (!this._firstCall || t.deleted || !this._filter(n)))
5893
5903
  do
5894
5904
  if (n = /** @type {any} */
5895
- t.content.type, !t.deleted && (n.constructor === W || n.constructor === Ht) && n._start !== null)
5905
+ t.content.type, !t.deleted && (n.constructor === K || n.constructor === Ht) && n._start !== null)
5896
5906
  t = n._start;
5897
5907
  else
5898
5908
  for (; t !== null; ) {
@@ -5956,7 +5966,7 @@ class Ht extends F {
5956
5966
  return t.insert(0, this.toArray().map((n) => n instanceof F ? n.clone() : n)), t;
5957
5967
  }
5958
5968
  get length() {
5959
- return this.doc ?? j(), this._prelimContent === null ? this._length : this._prelimContent.length;
5969
+ return this.doc ?? W(), this._prelimContent === null ? this._length : this._prelimContent.length;
5960
5970
  }
5961
5971
  /**
5962
5972
  * Create a subtree of childNodes.
@@ -6027,7 +6037,7 @@ class Ht extends F {
6027
6037
  * @return {string} The string representation of all children.
6028
6038
  */
6029
6039
  toString() {
6030
- return yr(this, (t) => t.toString()).join("");
6040
+ return br(this, (t) => t.toString()).join("");
6031
6041
  }
6032
6042
  /**
6033
6043
  * @return {string}
@@ -6068,7 +6078,7 @@ class Ht extends F {
6068
6078
  */
6069
6079
  insert(t, n) {
6070
6080
  this.doc !== null ? O(this.doc, (i) => {
6071
- kr(i, this, t, n);
6081
+ Sr(i, this, t, n);
6072
6082
  }) : this._prelimContent.splice(t, 0, ...n);
6073
6083
  }
6074
6084
  /**
@@ -6105,7 +6115,7 @@ class Ht extends F {
6105
6115
  */
6106
6116
  delete(t, n = 1) {
6107
6117
  this.doc !== null ? O(this.doc, (i) => {
6108
- vr(i, this, t, n);
6118
+ kr(i, this, t, n);
6109
6119
  }) : this._prelimContent.splice(t, n);
6110
6120
  }
6111
6121
  /**
@@ -6114,7 +6124,7 @@ class Ht extends F {
6114
6124
  * @return {Array<YXmlElement|YXmlText|YXmlHook>}
6115
6125
  */
6116
6126
  toArray() {
6117
- return wr(this);
6127
+ return mr(this);
6118
6128
  }
6119
6129
  /**
6120
6130
  * Appends content to this YArray.
@@ -6139,7 +6149,7 @@ class Ht extends F {
6139
6149
  * @return {YXmlElement|YXmlText}
6140
6150
  */
6141
6151
  get(t) {
6142
- return xr(this, t);
6152
+ return yr(this, t);
6143
6153
  }
6144
6154
  /**
6145
6155
  * Returns a portion of this YXmlFragment into a JavaScript Array selected
@@ -6150,7 +6160,7 @@ class Ht extends F {
6150
6160
  * @return {Array<YXmlElement|YXmlText>}
6151
6161
  */
6152
6162
  slice(t = 0, n = this.length) {
6153
- return mr(this, t, n);
6163
+ return gr(this, t, n);
6154
6164
  }
6155
6165
  /**
6156
6166
  * Executes a provided function on once on every child element.
@@ -6169,11 +6179,11 @@ class Ht extends F {
6169
6179
  * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.
6170
6180
  */
6171
6181
  _write(t) {
6172
- t.writeTypeRef(ja);
6182
+ t.writeTypeRef(Wa);
6173
6183
  }
6174
6184
  }
6175
6185
  const _a = (e) => new Ht();
6176
- class W extends Ht {
6186
+ class K extends Ht {
6177
6187
  constructor(t = "UNDEFINED") {
6178
6188
  super(), this.nodeName = t, this._prelimAttrs = /* @__PURE__ */ new Map();
6179
6189
  }
@@ -6221,7 +6231,7 @@ class W extends Ht {
6221
6231
  * @return {YXmlElement}
6222
6232
  */
6223
6233
  _copy() {
6224
- return new W(this.nodeName);
6234
+ return new K(this.nodeName);
6225
6235
  }
6226
6236
  /**
6227
6237
  * Makes a copy of this data type that can be included somewhere else.
@@ -6231,7 +6241,7 @@ class W extends Ht {
6231
6241
  * @return {YXmlElement<KV>}
6232
6242
  */
6233
6243
  clone() {
6234
- const t = new W(this.nodeName), n = this.getAttributes();
6244
+ const t = new K(this.nodeName), n = this.getAttributes();
6235
6245
  return lc(n, (i, s) => {
6236
6246
  typeof i == "string" && t.setAttribute(s, i);
6237
6247
  }), t.insert(0, this.toArray().map((i) => i instanceof F ? i.clone() : i)), t;
@@ -6313,7 +6323,7 @@ class W extends Ht {
6313
6323
  hasAttribute(t) {
6314
6324
  return (
6315
6325
  /** @type {any} */
6316
- _r(this, t)
6326
+ Cr(this, t)
6317
6327
  );
6318
6328
  }
6319
6329
  /**
@@ -6327,7 +6337,7 @@ class W extends Ht {
6327
6337
  getAttributes(t) {
6328
6338
  return (
6329
6339
  /** @type {any} */
6330
- t ? ga(this, t) : Cr(this)
6340
+ t ? ga(this, t) : vr(this)
6331
6341
  );
6332
6342
  }
6333
6343
  /**
@@ -6364,10 +6374,10 @@ class W extends Ht {
6364
6374
  * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.
6365
6375
  */
6366
6376
  _write(t) {
6367
- t.writeTypeRef(Wa), t.writeKey(this.nodeName);
6377
+ t.writeTypeRef(Ka), t.writeKey(this.nodeName);
6368
6378
  }
6369
6379
  }
6370
- const Ea = (e) => new W(e.readKey());
6380
+ const Ea = (e) => new K(e.readKey());
6371
6381
  class Ta extends mn {
6372
6382
  /**
6373
6383
  * @param {YXmlElement|YXmlText|YXmlFragment} target The target on which the event is created.
@@ -6437,11 +6447,11 @@ class Qe extends Qt {
6437
6447
  * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.
6438
6448
  */
6439
6449
  _write(t) {
6440
- t.writeTypeRef(Ka), t.writeKey(this.hookName);
6450
+ t.writeTypeRef(ja), t.writeKey(this.hookName);
6441
6451
  }
6442
6452
  }
6443
6453
  const Da = (e) => new Qe(e.readKey());
6444
- class J extends At {
6454
+ class J extends It {
6445
6455
  /**
6446
6456
  * @type {YXmlElement|YXmlText|null}
6447
6457
  */
@@ -6536,7 +6546,7 @@ class J extends At {
6536
6546
  t.writeTypeRef(Ya);
6537
6547
  }
6538
6548
  }
6539
- const Aa = (e) => new J();
6549
+ const Ia = (e) => new J();
6540
6550
  class yi {
6541
6551
  /**
6542
6552
  * @param {ID} id
@@ -6577,7 +6587,7 @@ class yi {
6577
6587
  throw at();
6578
6588
  }
6579
6589
  }
6580
- const Ia = 0;
6590
+ const Aa = 0;
6581
6591
  class it extends yi {
6582
6592
  get deleted() {
6583
6593
  return !0;
@@ -6596,14 +6606,14 @@ class it extends yi {
6596
6606
  * @param {number} offset
6597
6607
  */
6598
6608
  integrate(t, n) {
6599
- n > 0 && (this.id.clock += n, this.length -= n), ar(t.doc.store, this);
6609
+ n > 0 && (this.id.clock += n, this.length -= n), cr(t.doc.store, this);
6600
6610
  }
6601
6611
  /**
6602
6612
  * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
6603
6613
  * @param {number} offset
6604
6614
  */
6605
6615
  write(t, n) {
6606
- t.writeInfo(Ia), t.writeLen(this.length - n);
6616
+ t.writeInfo(Aa), t.writeLen(this.length - n);
6607
6617
  }
6608
6618
  /**
6609
6619
  * @param {Transaction} transaction
@@ -6768,7 +6778,7 @@ class xe {
6768
6778
  }
6769
6779
  }
6770
6780
  const Ma = (e) => new xe(e.readLen()), Ir = (e, t) => new Ft({ guid: e, ...t, shouldLoad: t.shouldLoad || t.autoLoad || !1 });
6771
- class Ae {
6781
+ class Ie {
6772
6782
  /**
6773
6783
  * @param {Doc} doc
6774
6784
  */
@@ -6799,7 +6809,7 @@ class Ae {
6799
6809
  * @return {ContentDoc}
6800
6810
  */
6801
6811
  copy() {
6802
- return new Ae(Ir(this.doc.guid, this.opts));
6812
+ return new Ie(Ir(this.doc.guid, this.opts));
6803
6813
  }
6804
6814
  /**
6805
6815
  * @param {number} offset
@@ -6847,7 +6857,7 @@ class Ae {
6847
6857
  return 9;
6848
6858
  }
6849
6859
  }
6850
- const Ra = (e) => new Ae(Ir(e.readString(), e.readAny()));
6860
+ const Ra = (e) => new Ie(Ir(e.readString(), e.readAny()));
6851
6861
  class zt {
6852
6862
  /**
6853
6863
  * @param {Object} embed
@@ -7100,7 +7110,7 @@ class $t {
7100
7110
  * @param {Array<any>} arr
7101
7111
  */
7102
7112
  constructor(t) {
7103
- this.arr = t, Pa && Ks(t);
7113
+ this.arr = t, Pa && Ws(t);
7104
7114
  }
7105
7115
  /**
7106
7116
  * @return {number}
@@ -7267,8 +7277,8 @@ const Va = (e) => new dt(e.readString()), Ha = [
7267
7277
  Ea,
7268
7278
  _a,
7269
7279
  Da,
7270
- Aa
7271
- ], $a = 0, Fa = 1, za = 2, Wa = 3, ja = 4, Ka = 5, Ya = 6;
7280
+ Ia
7281
+ ], $a = 0, Fa = 1, za = 2, Ka = 3, Wa = 4, ja = 5, Ya = 6;
7272
7282
  class ut {
7273
7283
  /**
7274
7284
  * @param {AbstractType<any>} type
@@ -7365,7 +7375,7 @@ const Ga = (e) => new ut(Ha[e.readTypeRef()](e)), Gn = (e, t) => {
7365
7375
  let n = t, i = 0, s;
7366
7376
  do
7367
7377
  i > 0 && (n = C(n.client, n.clock + i)), s = Yt(e, n), i = n.clock - s.id.clock, n = s.redone;
7368
- while (n !== null && s instanceof I);
7378
+ while (n !== null && s instanceof A);
7369
7379
  return {
7370
7380
  item: s,
7371
7381
  diff: i
@@ -7375,7 +7385,7 @@ const Ga = (e) => new ut(Ha[e.readTypeRef()](e)), Gn = (e, t) => {
7375
7385
  e.keep = t, e = /** @type {AbstractType<any>} */
7376
7386
  e.parent._item;
7377
7387
  }, en = (e, t, n) => {
7378
- const { client: i, clock: s } = t.id, r = new I(
7388
+ const { client: i, clock: s } = t.id, r = new A(
7379
7389
  C(i, s + n),
7380
7390
  t,
7381
7391
  C(i, s + n - 1),
@@ -7386,11 +7396,11 @@ const Ga = (e) => new ut(Ha[e.readTypeRef()](e)), Gn = (e, t) => {
7386
7396
  t.content.splice(n)
7387
7397
  );
7388
7398
  return t.deleted && r.markDeleted(), t.keep && (r.keep = !0), t.redone !== null && (r.redone = C(t.redone.client, t.redone.clock + n)), t.right = r, r.right !== null && (r.right.left = r), e._mergeStructs.push(r), r.parentSub !== null && r.right === null && r.parent._map.set(r.parentSub, r), t.length = n, r;
7389
- }, as = (e, t) => yl(
7399
+ }, cs = (e, t) => yl(
7390
7400
  e,
7391
7401
  /** @param {StackItem} s */
7392
7402
  (n) => ie(n.deletions, t)
7393
- ), Or = (e, t, n, i, s, r) => {
7403
+ ), Ar = (e, t, n, i, s, r) => {
7394
7404
  const o = e.doc, l = o.store, c = o.clientID, a = t.redone;
7395
7405
  if (a !== null)
7396
7406
  return G(e, a);
@@ -7399,7 +7409,7 @@ const Ga = (e) => new ut(Ha[e.readTypeRef()](e)), Gn = (e, t) => {
7399
7409
  t.parent._item
7400
7410
  ), h = null, u;
7401
7411
  if (d !== null && d.deleted === !0) {
7402
- if (d.redone === null && (!n.has(d) || Or(e, d, n, i, s, r) === null))
7412
+ if (d.redone === null && (!n.has(d) || Ar(e, d, n, i, s, r) === null))
7403
7413
  return null;
7404
7414
  for (; d.redone !== null; )
7405
7415
  d = G(e, d.redone);
@@ -7437,13 +7447,13 @@ const Ga = (e) => new ut(Ha[e.readTypeRef()](e)), Gn = (e, t) => {
7437
7447
  u = u.right;
7438
7448
  }
7439
7449
  } else if (u = null, t.right && !s) {
7440
- for (h = t; h !== null && h.right !== null && (h.right.redone || ie(i, h.right.id) || as(r.undoStack, h.right.id) || as(r.redoStack, h.right.id)); )
7450
+ for (h = t; h !== null && h.right !== null && (h.right.redone || ie(i, h.right.id) || cs(r.undoStack, h.right.id) || cs(r.redoStack, h.right.id)); )
7441
7451
  for (h = h.right; h.redone; ) h = G(e, h.redone);
7442
7452
  if (h && h.right !== null)
7443
7453
  return null;
7444
7454
  } else
7445
7455
  h = f._map.get(t.parentSub) || null;
7446
- const g = B(l, c), m = C(c, g), b = new I(
7456
+ const g = B(l, c), m = C(c, g), b = new A(
7447
7457
  m,
7448
7458
  h,
7449
7459
  h && h.lastId,
@@ -7455,7 +7465,7 @@ const Ga = (e) => new ut(Ha[e.readTypeRef()](e)), Gn = (e, t) => {
7455
7465
  );
7456
7466
  return t.redone = m, xi(b, !0), b.integrate(e, 0), b;
7457
7467
  };
7458
- class I extends yi {
7468
+ class A extends yi {
7459
7469
  /**
7460
7470
  * @param {ID} id
7461
7471
  * @param {Item | null} left
@@ -7467,7 +7477,7 @@ class I extends yi {
7467
7477
  * @param {AbstractContent} content
7468
7478
  */
7469
7479
  constructor(t, n, i, s, r, o, l, c) {
7470
- super(t, c.getLength()), this.origin = i, this.left = n, this.right = s, this.rightOrigin = r, this.parent = o, this.parentSub = l, this.redone = null, this.content = c, this.info = this.content.isCountable() ? Vi : 0;
7480
+ super(t, c.getLength()), this.origin = i, this.left = n, this.right = s, this.rightOrigin = r, this.parent = o, this.parentSub = l, this.redone = null, this.content = c, this.info = this.content.isCountable() ? Bi : 0;
7471
7481
  }
7472
7482
  /**
7473
7483
  * This is used to mark the item as an indexed fast-search marker
@@ -7484,13 +7494,13 @@ class I extends yi {
7484
7494
  * If true, do not garbage collect this Item.
7485
7495
  */
7486
7496
  get keep() {
7487
- return (this.info & Bi) > 0;
7497
+ return (this.info & Pi) > 0;
7488
7498
  }
7489
7499
  set keep(t) {
7490
- this.keep !== t && (this.info ^= Bi);
7500
+ this.keep !== t && (this.info ^= Pi);
7491
7501
  }
7492
7502
  get countable() {
7493
- return (this.info & Vi) > 0;
7503
+ return (this.info & Bi) > 0;
7494
7504
  }
7495
7505
  /**
7496
7506
  * Whether this item was deleted or not.
@@ -7517,13 +7527,13 @@ class I extends yi {
7517
7527
  return this.origin.client;
7518
7528
  if (this.rightOrigin && this.rightOrigin.client !== this.id.client && this.rightOrigin.clock >= B(n, this.rightOrigin.client))
7519
7529
  return this.rightOrigin.client;
7520
- if (this.parent && this.parent.constructor === Kt && this.id.client !== this.parent.client && this.parent.clock >= B(n, this.parent.client))
7530
+ if (this.parent && this.parent.constructor === jt && this.id.client !== this.parent.client && this.parent.clock >= B(n, this.parent.client))
7521
7531
  return this.parent.client;
7522
- if (this.origin && (this.left = Qi(t, n, this.origin), this.origin = this.left.lastId), this.rightOrigin && (this.right = G(t, this.rightOrigin), this.rightOrigin = this.right.id), this.left && this.left.constructor === it || this.right && this.right.constructor === it)
7532
+ if (this.origin && (this.left = Zi(t, n, this.origin), this.origin = this.left.lastId), this.rightOrigin && (this.right = G(t, this.rightOrigin), this.rightOrigin = this.right.id), this.left && this.left.constructor === it || this.right && this.right.constructor === it)
7523
7533
  this.parent = null;
7524
7534
  else if (!this.parent)
7525
- this.left && this.left.constructor === I ? (this.parent = this.left.parent, this.parentSub = this.left.parentSub) : this.right && this.right.constructor === I && (this.parent = this.right.parent, this.parentSub = this.right.parentSub);
7526
- else if (this.parent.constructor === Kt) {
7535
+ this.left && this.left.constructor === A ? (this.parent = this.left.parent, this.parentSub = this.left.parentSub) : this.right && this.right.constructor === A && (this.parent = this.right.parent, this.parentSub = this.right.parentSub);
7536
+ else if (this.parent.constructor === jt) {
7527
7537
  const i = Yt(n, this.parent);
7528
7538
  i.constructor === it ? this.parent = null : this.parent = /** @type {ContentType} */
7529
7539
  i.content.type;
@@ -7535,7 +7545,7 @@ class I extends yi {
7535
7545
  * @param {number} offset
7536
7546
  */
7537
7547
  integrate(t, n) {
7538
- if (n > 0 && (this.id.clock += n, this.left = Qi(t, t.doc.store, C(this.id.client, this.id.clock - 1)), this.origin = this.left.lastId, this.content = this.content.splice(n), this.length -= n), this.parent) {
7548
+ if (n > 0 && (this.id.clock += n, this.left = Zi(t, t.doc.store, C(this.id.client, this.id.clock - 1)), this.origin = this.left.lastId, this.content = this.content.splice(n), this.length -= n), this.parent) {
7539
7549
  if (!this.left && (!this.right || this.right.left !== null) || this.left && this.left.right !== this.right) {
7540
7550
  let i = this.left, s;
7541
7551
  if (i !== null)
@@ -7576,7 +7586,7 @@ class I extends yi {
7576
7586
  this.parent._start, this.parent._start = this;
7577
7587
  this.right = i;
7578
7588
  }
7579
- this.right !== null ? this.right.left = this : this.parentSub !== null && (this.parent._map.set(this.parentSub, this), this.left !== null && this.left.delete(t)), this.parentSub === null && this.countable && !this.deleted && (this.parent._length += this.length), ar(t.doc.store, this), this.content.integrate(t, this), es(
7589
+ this.right !== null ? this.right.left = this : this.parentSub !== null && (this.parent._map.set(this.parentSub, this), this.left !== null && this.left.delete(t)), this.parentSub === null && this.countable && !this.deleted && (this.parent._length += this.length), cr(t.doc.store, this), this.content.integrate(t, this), ts(
7580
7590
  t,
7581
7591
  /** @type {AbstractType<any>} */
7582
7592
  this.parent,
@@ -7640,7 +7650,7 @@ class I extends yi {
7640
7650
  /** @type {AbstractType<any>} */
7641
7651
  this.parent
7642
7652
  );
7643
- this.countable && this.parentSub === null && (n._length -= this.length), this.markDeleted(), ge(t.deleteSet, this.id.client, this.id.clock, this.length), es(t, n, this.parentSub), this.content.delete(t);
7653
+ this.countable && this.parentSub === null && (n._length -= this.length), this.markDeleted(), ge(t.deleteSet, this.id.client, this.id.clock, this.length), ts(t, n, this.parentSub), this.content.delete(t);
7644
7654
  }
7645
7655
  }
7646
7656
  /**
@@ -7662,7 +7672,7 @@ class I extends yi {
7662
7672
  * @param {number} offset
7663
7673
  */
7664
7674
  write(t, n) {
7665
- const i = n > 0 ? C(this.id.client, this.id.clock + n - 1) : this.origin, s = this.rightOrigin, r = this.parentSub, o = this.content.getRef() & dn | (i === null ? 0 : K) | // origin is defined
7675
+ const i = n > 0 ? C(this.id.client, this.id.clock + n - 1) : this.origin, s = this.rightOrigin, r = this.parentSub, o = this.content.getRef() & dn | (i === null ? 0 : j) | // origin is defined
7666
7676
  (s === null ? 0 : bt) | // right origin is defined
7667
7677
  (r === null ? 0 : ue);
7668
7678
  if (t.writeInfo(o), i !== null && t.writeLeftID(i), s !== null && t.writeRightID(s), i === null && s === null) {
@@ -7677,13 +7687,13 @@ class I extends yi {
7677
7687
  t.writeParentInfo(!0), t.writeString(a);
7678
7688
  } else
7679
7689
  t.writeParentInfo(!1), t.writeLeftID(c.id);
7680
- } else l.constructor === String ? (t.writeParentInfo(!0), t.writeString(l)) : l.constructor === Kt ? (t.writeParentInfo(!1), t.writeLeftID(l)) : q();
7690
+ } else l.constructor === String ? (t.writeParentInfo(!0), t.writeString(l)) : l.constructor === jt ? (t.writeParentInfo(!1), t.writeLeftID(l)) : q();
7681
7691
  r !== null && t.writeString(r);
7682
7692
  }
7683
7693
  this.content.write(t, n);
7684
7694
  }
7685
7695
  }
7686
- const Mr = (e, t) => Ja[t & dn](e), Ja = [
7696
+ const Or = (e, t) => Ja[t & dn](e), Ja = [
7687
7697
  () => {
7688
7698
  q();
7689
7699
  },
@@ -7747,12 +7757,12 @@ class ot extends yi {
7747
7757
  return null;
7748
7758
  }
7749
7759
  }
7750
- const Rr = (
7760
+ const Mr = (
7751
7761
  /** @type {any} */
7752
7762
  typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : {}
7753
- ), Nr = "__ $YJS$ __";
7754
- Rr[Nr] === !0 && console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");
7755
- Rr[Nr] = !0;
7763
+ ), Rr = "__ $YJS$ __";
7764
+ Mr[Rr] === !0 && console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");
7765
+ Mr[Rr] = !0;
7756
7766
  const Xa = () => {
7757
7767
  let e = !0;
7758
7768
  return (t, n) => {
@@ -7879,7 +7889,7 @@ class ch {
7879
7889
  if (n % 64 !== 0) {
7880
7890
  for (this._W.fill(0, o, 16); n < t.length; )
7881
7891
  this._W[o] |= t[n] << (3 - n % 4) * 8, n++;
7882
- this._W[o] |= K << (3 - n % 4) * 8;
7892
+ this._W[o] |= j << (3 - n % 4) * 8;
7883
7893
  }
7884
7894
  this._updateHash();
7885
7895
  }
@@ -7889,7 +7899,7 @@ class ch {
7889
7899
  for (; n < t.length; s++)
7890
7900
  for (let o = 3; o >= 0 && n < t.length; o--)
7891
7901
  this._W[s] |= t[n++] << o * 8;
7892
- i || (this._W[s - (n % 4 === 0 ? 0 : 1)] |= K << (3 - n % 4) * 8), this._W[14] = t.byteLength / xl, this._W[15] = t.byteLength * 8, this._updateHash();
7902
+ i || (this._W[s - (n % 4 === 0 ? 0 : 1)] |= j << (3 - n % 4) * 8), this._W[14] = t.byteLength / xl, this._W[15] = t.byteLength * 8, this._updateHash();
7893
7903
  const r = new Uint8Array(32);
7894
7904
  for (let o = 0; o < this._H.length; o++)
7895
7905
  for (let l = 0; l < 4; l++)
@@ -7925,7 +7935,7 @@ t.sv.get(e.id.client) > e.id.clock && !ie(t.ds, e.id), uh = [{ light: "#ecd44433
7925
7935
  mapping: r
7926
7936
  } = {}) => {
7927
7937
  let o = !1;
7928
- const l = new wh(e, r), c = new ys({
7938
+ const l = new wh(e, r), c = new bs({
7929
7939
  props: {
7930
7940
  editable: (a) => {
7931
7941
  const d = U.getState(a);
@@ -7957,7 +7967,7 @@ t.sv.get(e.id.client) > e.id.clock && !ie(t.ds, e.id), uh = [{ light: "#ecd44433
7957
7967
  for (const u in h)
7958
7968
  d[u] = h[u];
7959
7969
  }
7960
- return d.addToHistory = a.getMeta("addToHistory") !== !1, d.isChangeOrigin = h !== void 0 && !!h.isChangeOrigin, d.isUndoRedoOperation = h !== void 0 && !!h.isChangeOrigin && !!h.isUndoRedoOperation, l.prosemirrorView !== null && h !== void 0 && (h.snapshot != null || h.prevSnapshot != null) && Js(0, () => {
7970
+ return d.addToHistory = a.getMeta("addToHistory") !== !1, d.isChangeOrigin = h !== void 0 && !!h.isChangeOrigin, d.isUndoRedoOperation = h !== void 0 && !!h.isChangeOrigin && !!h.isUndoRedoOperation, l.prosemirrorView !== null && h !== void 0 && (h.snapshot != null || h.prevSnapshot != null) && Gs(0, () => {
7961
7971
  l.prosemirrorView != null && (h.restore == null ? l._renderSnapshot(
7962
7972
  h.snapshot,
7963
7973
  h.prevSnapshot,
@@ -8003,7 +8013,7 @@ t.sv.get(e.id.client) > e.id.clock && !ie(t.ds, e.id), uh = [{ light: "#ecd44433
8003
8013
  }, gh = (e, t, n) => {
8004
8014
  if (t !== null && t.anchor !== null && t.head !== null)
8005
8015
  if (t.type === "all")
8006
- e.setSelection(new Xr(e.doc));
8016
+ e.setSelection(new qr(e.doc));
8007
8017
  else if (t.type === "node") {
8008
8018
  const i = de(
8009
8019
  n.doc,
@@ -8028,7 +8038,7 @@ t.sv.get(e.id.client) > e.id.clock && !ie(t.ds, e.id), uh = [{ light: "#ecd44433
8028
8038
  }
8029
8039
  }, mh = (e, t) => {
8030
8040
  const n = e.doc.resolve(t);
8031
- return n.nodeAfter ? Zr.create(e.doc, t) : ni.near(n);
8041
+ return n.nodeAfter ? Xr.create(e.doc, t) : ni.near(n);
8032
8042
  }, Jn = (e, t) => ({
8033
8043
  type: (
8034
8044
  /** @type {any} */
@@ -8069,7 +8079,7 @@ class wh {
8069
8079
  return this.prosemirrorView.state.tr.setMeta("addToHistory", !1);
8070
8080
  }
8071
8081
  _isLocalCursorInView() {
8072
- return this.prosemirrorView.hasFocus() ? (Ys && this._domSelectionInView === null && (Js(0, () => {
8082
+ return this.prosemirrorView.hasFocus() ? (js && this._domSelectionInView === null && (Gs(0, () => {
8073
8083
  this._domSelectionInView = null;
8074
8084
  }), this._domSelectionInView = this._isDomSelectionInView()), this._domSelectionInView) : !1;
8075
8085
  }
@@ -8086,7 +8096,7 @@ class wh {
8086
8096
  * @param {Y.Snapshot} prevSnapshot
8087
8097
  */
8088
8098
  renderSnapshot(t, n) {
8089
- n || (n = lr(ir(), /* @__PURE__ */ new Map())), this.prosemirrorView.dispatch(
8099
+ n || (n = or(nr(), /* @__PURE__ */ new Map())), this.prosemirrorView.dispatch(
8090
8100
  this._tr.setMeta(U, { snapshot: t, prevSnapshot: n })
8091
8101
  );
8092
8102
  }
@@ -8102,7 +8112,7 @@ class wh {
8102
8112
  ).filter((i) => i !== null), n = this._tr.replace(
8103
8113
  0,
8104
8114
  this.prosemirrorView.state.doc.content.size,
8105
- new Ie(Oe.from(t), 0, 0)
8115
+ new Ae(Oe.from(t), 0, 0)
8106
8116
  );
8107
8117
  n.setMeta(U, { snapshot: null, prevSnapshot: null }), this.prosemirrorView.dispatch(n);
8108
8118
  });
@@ -8119,7 +8129,7 @@ class wh {
8119
8129
  ).filter((s) => s !== null), i = this._tr.replace(
8120
8130
  0,
8121
8131
  this.prosemirrorView.state.doc.content.size,
8122
- new Ie(Oe.from(n), 0, 0)
8132
+ new Ae(Oe.from(n), 0, 0)
8123
8133
  );
8124
8134
  if (t) {
8125
8135
  const s = qt(Et(t.anchor, 0), i.doc.content.size), r = qt(Et(t.head, 0), i.doc.content.size);
@@ -8138,7 +8148,7 @@ class wh {
8138
8148
  _renderSnapshot(t, n, i) {
8139
8149
  let s = this.doc, r = this.type;
8140
8150
  if (t || (t = On(this.doc)), t instanceof Uint8Array || n instanceof Uint8Array)
8141
- if ((!(t instanceof Uint8Array) || !(n instanceof Uint8Array)) && q(), s = new Ft({ gc: !1 }), Wn(s, n), n = On(s), Wn(s, t), t = On(s), r._item === null) {
8151
+ if ((!(t instanceof Uint8Array) || !(n instanceof Uint8Array)) && q(), s = new Ft({ gc: !1 }), Kn(s, n), n = On(s), Kn(s, t), t = On(s), r._item === null) {
8142
8152
  const o = Array.from(this.doc.share.keys()).find(
8143
8153
  (l) => this.doc.share.get(l) === this.type
8144
8154
  );
@@ -8171,7 +8181,7 @@ class wh {
8171
8181
  f
8172
8182
  )
8173
8183
  };
8174
- }, a = br(
8184
+ }, a = wr(
8175
8185
  r,
8176
8186
  new gi(n.ds, t.sv)
8177
8187
  ).map((h) => !h._item.deleted || nn(h._item, t) || nn(h._item, n) ? ze(
@@ -8184,7 +8194,7 @@ class wh {
8184
8194
  ) : null).filter((h) => h !== null), d = this._tr.replace(
8185
8195
  0,
8186
8196
  this.prosemirrorView.state.doc.content.size,
8187
- new Ie(Oe.from(a), 0, 0)
8197
+ new Ae(Oe.from(a), 0, 0)
8188
8198
  );
8189
8199
  this.prosemirrorView.dispatch(
8190
8200
  d.setMeta(U, { isChangeOrigin: !0 })
@@ -8209,7 +8219,7 @@ class wh {
8209
8219
  n,
8210
8220
  n.deleteSet,
8211
8221
  (l) => {
8212
- if (l.constructor === I) {
8222
+ if (l.constructor === A) {
8213
8223
  const c = (
8214
8224
  /** @type {Y.ContentType} */
8215
8225
  /** @type {Y.Item} */
@@ -8220,7 +8230,7 @@ class wh {
8220
8230
  }
8221
8231
  ), n.changed.forEach(s), n.changedParentTypes.forEach(s);
8222
8232
  const r = this.type.toArray().map(
8223
- (l) => Ur(
8233
+ (l) => Nr(
8224
8234
  /** @type {Y.XmlElement | Y.XmlHook} */
8225
8235
  l,
8226
8236
  this.prosemirrorView.state.schema,
@@ -8230,9 +8240,9 @@ class wh {
8230
8240
  let o = this._tr.replace(
8231
8241
  0,
8232
8242
  this.prosemirrorView.state.doc.content.size,
8233
- new Ie(Oe.from(r), 0, 0)
8243
+ new Ae(Oe.from(r), 0, 0)
8234
8244
  );
8235
- gh(o, this.beforeTransactionSelection, this), o = o.setMeta(U, { isChangeOrigin: !0, isUndoRedoOperation: n.origin instanceof ur }), this.beforeTransactionSelection !== null && this._isLocalCursorInView() && o.scrollIntoView(), this.prosemirrorView.dispatch(o);
8245
+ gh(o, this.beforeTransactionSelection, this), o = o.setMeta(U, { isChangeOrigin: !0, isUndoRedoOperation: n.origin instanceof dr }), this.beforeTransactionSelection !== null && this._isLocalCursorInView() && o.scrollIntoView(), this.prosemirrorView.dispatch(o);
8236
8246
  });
8237
8247
  }
8238
8248
  /**
@@ -8257,13 +8267,13 @@ class wh {
8257
8267
  this.prosemirrorView != null && (this.prosemirrorView = null, this.type.unobserveDeep(this._observeFunction), this.doc.off("beforeAllTransactions", this.beforeAllTransactions), this.doc.off("afterAllTransactions", this.afterAllTransactions));
8258
8268
  }
8259
8269
  }
8260
- const Ur = (e, t, n, i, s, r) => {
8270
+ const Nr = (e, t, n, i, s, r) => {
8261
8271
  const o = (
8262
8272
  /** @type {PModel.Node} */
8263
8273
  n.mapping.get(e)
8264
8274
  );
8265
8275
  if (o === void 0) {
8266
- if (e instanceof W)
8276
+ if (e instanceof K)
8267
8277
  return ze(
8268
8278
  e,
8269
8279
  t,
@@ -8278,8 +8288,8 @@ const Ur = (e, t, n, i, s, r) => {
8278
8288
  }, ze = (e, t, n, i, s, r) => {
8279
8289
  const o = [], l = (c) => {
8280
8290
  var a, d;
8281
- if (c instanceof W) {
8282
- const h = Ur(
8291
+ if (c instanceof K) {
8292
+ const h = Nr(
8283
8293
  c,
8284
8294
  t,
8285
8295
  n,
@@ -8293,7 +8303,7 @@ const Ur = (e, t, n, i, s, r) => {
8293
8303
  /** @type {Y.ContentType} */
8294
8304
  (d = (a = c._item.right) == null ? void 0 : a.content) == null ? void 0 : d.type
8295
8305
  );
8296
- h instanceof At && !h._item.deleted && h._item.id.client === h.doc.clientID && (c.applyDelta([
8306
+ h instanceof It && !h._item.deleted && h._item.id.client === h.doc.clientID && (c.applyDelta([
8297
8307
  { retain: c.length },
8298
8308
  ...h.toDelta()
8299
8309
  ]), h.doc.transact((f) => {
@@ -8312,7 +8322,7 @@ const Ur = (e, t, n, i, s, r) => {
8312
8322
  });
8313
8323
  }
8314
8324
  };
8315
- i === void 0 || s === void 0 ? e.toArray().forEach(l) : br(e, new gi(s.ds, i.sv)).forEach(l);
8325
+ i === void 0 || s === void 0 ? e.toArray().forEach(l) : wr(e, new gi(s.ds, i.sv)).forEach(l);
8316
8326
  try {
8317
8327
  const c = e.getAttributes(i);
8318
8328
  i !== void 0 && (nn(
@@ -8356,11 +8366,11 @@ const Ur = (e, t, n, i, s, r) => {
8356
8366
  const n = new J(), i = e.map((s) => ({
8357
8367
  // @ts-ignore
8358
8368
  insert: s.text,
8359
- attributes: Pr(s.marks, t)
8369
+ attributes: Lr(s.marks, t)
8360
8370
  }));
8361
8371
  return n.applyDelta(i), t.mapping.set(n, e), n;
8362
8372
  }, xh = (e, t) => {
8363
- const n = new W(e.type.name);
8373
+ const n = new K(e.type.name);
8364
8374
  for (const i in e.attrs) {
8365
8375
  const s = e.attrs[i];
8366
8376
  s !== null && i !== "ychange" && n.setAttribute(i, s);
@@ -8371,12 +8381,12 @@ const Ur = (e, t, n, i, s, r) => {
8371
8381
  (i) => qn(i, t)
8372
8382
  )
8373
8383
  ), t.mapping.set(n, e), n;
8374
- }, qn = (e, t) => e instanceof Array ? yh(e, t) : xh(e, t), hs = (e) => typeof e == "object" && e !== null, Si = (e, t) => {
8384
+ }, qn = (e, t) => e instanceof Array ? yh(e, t) : xh(e, t), as = (e) => typeof e == "object" && e !== null, Si = (e, t) => {
8375
8385
  const n = Object.keys(e).filter((s) => e[s] !== null);
8376
8386
  let i = n.length === Object.keys(t).filter((s) => t[s] !== null).length;
8377
8387
  for (let s = 0; s < n.length && i; s++) {
8378
8388
  const r = n[s], o = e[r], l = t[r];
8379
- i = r === "ychange" || o === l || hs(o) && hs(l) && Si(o, l);
8389
+ i = r === "ychange" || o === l || as(o) && as(l) && Si(o, l);
8380
8390
  }
8381
8391
  return i;
8382
8392
  }, yn = (e) => {
@@ -8392,12 +8402,12 @@ const Ur = (e, t, n, i, s, r) => {
8392
8402
  n.push(s);
8393
8403
  }
8394
8404
  return n;
8395
- }, Lr = (e, t) => {
8405
+ }, Ur = (e, t) => {
8396
8406
  const n = e.toDelta();
8397
8407
  return n.length === t.length && n.every(
8398
8408
  /** @type {(d:any,i:number) => boolean} */
8399
8409
  (i, s) => i.insert === /** @type {any} */
8400
- t[s].text && Ws(i.attributes || {}).length === t[s].marks.length && js(i.attributes, (r, o) => {
8410
+ t[s].text && zs(i.attributes || {}).length === t[s].marks.length && Ks(i.attributes, (r, o) => {
8401
8411
  var d;
8402
8412
  const l = ki(o), c = t[s].marks;
8403
8413
  return c.find(
@@ -8410,16 +8420,16 @@ const Ur = (e, t, n, i, s, r) => {
8410
8420
  })
8411
8421
  );
8412
8422
  }, Se = (e, t) => {
8413
- if (e instanceof W && !(t instanceof Array) && Zn(e, t)) {
8423
+ if (e instanceof K && !(t instanceof Array) && Zn(e, t)) {
8414
8424
  const n = yn(t);
8415
8425
  return e._length === n.length && Si(e.getAttributes(), t.attrs) && e.toArray().every(
8416
8426
  (i, s) => Se(i, n[s])
8417
8427
  );
8418
8428
  }
8419
- return e instanceof J && t instanceof Array && Lr(e, t);
8429
+ return e instanceof J && t instanceof Array && Ur(e, t);
8420
8430
  }, sn = (e, t) => e === t || e instanceof Array && t instanceof Array && e.length === t.length && e.every(
8421
8431
  (n, i) => t[i] === n
8422
- ), ds = (e, t, n) => {
8432
+ ), hs = (e, t, n) => {
8423
8433
  const i = e.toArray(), s = yn(t), r = s.length, o = i.length, l = qt(o, r);
8424
8434
  let c = 0, a = 0, d = !1;
8425
8435
  for (; c < l; c++) {
@@ -8456,7 +8466,7 @@ const Ur = (e, t, n, i, s, r) => {
8456
8466
  /** @type {any} */
8457
8467
  a.text
8458
8468
  ),
8459
- attributes: Object.assign({}, i, Pr(a.marks, n))
8469
+ attributes: Object.assign({}, i, Lr(a.marks, n))
8460
8470
  })), { insert: o, remove: l, index: c } = eh(
8461
8471
  s,
8462
8472
  r.map((a) => a.insert).join("")
@@ -8472,7 +8482,7 @@ const Ur = (e, t, n, i, s, r) => {
8472
8482
  for (const i in e)
8473
8483
  n.push(t.mark(ki(i), e[i]));
8474
8484
  return n;
8475
- }, Pr = (e, t) => {
8485
+ }, Lr = (e, t) => {
8476
8486
  const n = {};
8477
8487
  return e.forEach((i) => {
8478
8488
  if (i.type.name !== "ychange") {
@@ -8481,9 +8491,9 @@ const Ur = (e, t, n, i, s, r) => {
8481
8491
  }
8482
8492
  }), n;
8483
8493
  }, Xn = (e, t, n, i) => {
8484
- if (t instanceof W && t.nodeName !== n.type.name)
8494
+ if (t instanceof K && t.nodeName !== n.type.name)
8485
8495
  throw new Error("node name mismatch!");
8486
- if (i.mapping.set(t, n), t instanceof W) {
8496
+ if (i.mapping.set(t, n), t instanceof K) {
8487
8497
  const h = t.getAttributes(), u = n.attrs;
8488
8498
  for (const f in u)
8489
8499
  u[f] !== null ? h[f] !== u[f] && f !== "ychange" && t.setAttribute(f, u[f]) : t.removeAttribute(f);
@@ -8512,24 +8522,24 @@ const Ur = (e, t, n, i, s, r) => {
8512
8522
  for (; l - a - d > 0 && r - a - d > 0; ) {
8513
8523
  const u = o[a], f = s[a], g = o[l - d - 1], m = s[r - d - 1];
8514
8524
  if (u instanceof J && f instanceof Array)
8515
- Lr(u, f) || kh(u, f, i), a += 1;
8525
+ Ur(u, f) || kh(u, f, i), a += 1;
8516
8526
  else {
8517
- let b = u instanceof W && Zn(u, f), w = g instanceof W && Zn(g, m);
8527
+ let b = u instanceof K && Zn(u, f), w = g instanceof K && Zn(g, m);
8518
8528
  if (b && w) {
8519
- const D = ds(
8529
+ const D = hs(
8520
8530
  /** @type {Y.XmlElement} */
8521
8531
  u,
8522
8532
  /** @type {PModel.Node} */
8523
8533
  f,
8524
8534
  i
8525
- ), A = ds(
8535
+ ), I = hs(
8526
8536
  /** @type {Y.XmlElement} */
8527
8537
  g,
8528
8538
  /** @type {PModel.Node} */
8529
8539
  m,
8530
8540
  i
8531
8541
  );
8532
- D.foundMappedChild && !A.foundMappedChild ? w = !1 : !D.foundMappedChild && A.foundMappedChild || D.equalityFactor < A.equalityFactor ? b = !1 : w = !1;
8542
+ D.foundMappedChild && !I.foundMappedChild ? w = !1 : !D.foundMappedChild && I.foundMappedChild || D.equalityFactor < I.equalityFactor ? b = !1 : w = !1;
8533
8543
  }
8534
8544
  b ? (Xn(
8535
8545
  e,
@@ -8560,7 +8570,7 @@ const Ur = (e, t, n, i, s, r) => {
8560
8570
  }, U);
8561
8571
  }, Zn = (e, t) => !(t instanceof Array) && e.nodeName === t.type.name, rn = (e, t, n) => {
8562
8572
  if (e === 0)
8563
- return In(t, 0, -1);
8573
+ return An(t, 0, -1);
8564
8574
  let i = t._first === null ? null : (
8565
8575
  /** @type {Y.ContentType} */
8566
8576
  t._first.content.type
@@ -8568,7 +8578,7 @@ const Ur = (e, t, n, i, s, r) => {
8568
8578
  for (; i !== null && t !== i; ) {
8569
8579
  if (i instanceof J) {
8570
8580
  if (i._length >= e)
8571
- return In(i, e, -1);
8581
+ return An(i, e, -1);
8572
8582
  if (e -= i._length, i._item !== null && i._item.next !== null)
8573
8583
  i = /** @type {Y.ContentType} */
8574
8584
  i._item.next.content.type;
@@ -8616,7 +8626,7 @@ const Ur = (e, t, n, i, s, r) => {
8616
8626
  if (e === 0 && i.constructor !== J && i !== t)
8617
8627
  return _h(i._item.parent, i._item);
8618
8628
  }
8619
- return In(t, t._length, -1);
8629
+ return An(t, t._length, -1);
8620
8630
  }, _h = (e, t) => {
8621
8631
  let n = null, i = null;
8622
8632
  return e._item === null ? i = me(e) : n = C(e._item.id.client, e._item.id.clock), new qe(n, i, t.id);
@@ -8686,7 +8696,7 @@ function Eh(e) {
8686
8696
  })), l;
8687
8697
  }
8688
8698
  );
8689
- else if (i instanceof W) {
8699
+ else if (i instanceof K) {
8690
8700
  s = {
8691
8701
  type: i.nodeName
8692
8702
  };
@@ -8711,13 +8721,13 @@ const Th = (e) => {
8711
8721
  const t = yt.getState(e).undoManager;
8712
8722
  if (t != null)
8713
8723
  return t.redo(), !0;
8714
- }, Ah = /* @__PURE__ */ new Set(["paragraph"]), Ih = (e, t) => !(e instanceof I) || !(e.content instanceof ut) || !(e.content.type instanceof At || e.content.type instanceof W && t.has(e.content.type.nodeName)) || e.content.type._length === 0, Oh = ({ protectedNodes: e = Ah, trackedOrigins: t = [], undoManager: n = null } = {}) => new ys({
8724
+ }, Ih = /* @__PURE__ */ new Set(["paragraph"]), Ah = (e, t) => !(e instanceof A) || !(e.content instanceof ut) || !(e.content.type instanceof It || e.content.type instanceof K && t.has(e.content.type.nodeName)) || e.content.type._length === 0, Oh = ({ protectedNodes: e = Ih, trackedOrigins: t = [], undoManager: n = null } = {}) => new bs({
8715
8725
  key: yt,
8716
8726
  state: {
8717
8727
  init: (i, s) => {
8718
- const r = U.getState(s), o = n || new ur(r.type, {
8728
+ const r = U.getState(s), o = n || new dr(r.type, {
8719
8729
  trackedOrigins: new Set([U].concat(t)),
8720
- deleteFilter: (l) => Ih(l, e),
8730
+ deleteFilter: (l) => Ah(l, e),
8721
8731
  captureTransaction: (l) => l.meta.get("addToHistory") !== !1
8722
8732
  });
8723
8733
  return {
@@ -8758,18 +8768,18 @@ const Th = (e) => {
8758
8768
  };
8759
8769
  }
8760
8770
  });
8761
- function Br(e) {
8771
+ function Pr(e) {
8762
8772
  return !!e.getMeta(U);
8763
8773
  }
8764
8774
  function Mh(e, t) {
8765
8775
  const n = U.getState(e);
8766
8776
  return de(n.doc, n.type, t, n.binding.mapping) || 0;
8767
8777
  }
8768
- function Vr(e, t) {
8778
+ function Br(e, t) {
8769
8779
  const n = U.getState(e);
8770
8780
  return rn(t, n.type, n.binding.mapping);
8771
8781
  }
8772
- var We = class Hr extends to {
8782
+ var Ke = class Vr extends Qr {
8773
8783
  constructor(t, n) {
8774
8784
  super(t), this.yRelativePosition = n;
8775
8785
  }
@@ -8777,7 +8787,7 @@ var We = class Hr extends to {
8777
8787
  * Creates a CollaborationMappablePosition from a JSON object.
8778
8788
  */
8779
8789
  static fromJSON(t) {
8780
- return new Hr(t.position, t.yRelativePosition);
8790
+ return new Vr(t.position, t.yRelativePosition);
8781
8791
  }
8782
8792
  /**
8783
8793
  * Converts the CollaborationMappablePosition to a JSON object.
@@ -8790,23 +8800,23 @@ var We = class Hr extends to {
8790
8800
  }
8791
8801
  };
8792
8802
  function Rh(e, t) {
8793
- const n = Vr(t, e);
8794
- return new We(e, n);
8803
+ const n = Br(t, e);
8804
+ return new Ke(e, n);
8795
8805
  }
8796
8806
  function Nh(e, t, n) {
8797
- const i = e instanceof We ? e.yRelativePosition : null;
8798
- if (Br(t) && i) {
8807
+ const i = e instanceof Ke ? e.yRelativePosition : null;
8808
+ if (Pr(t) && i) {
8799
8809
  const o = Mh(n, i);
8800
8810
  return {
8801
- position: new We(o, i),
8811
+ position: new Ke(o, i),
8802
8812
  mapResult: null
8803
8813
  };
8804
8814
  }
8805
- const s = Qr(e, t), r = s.position.position;
8815
+ const s = Zr(e, t), r = s.position.position;
8806
8816
  return {
8807
- position: new We(
8817
+ position: new Ke(
8808
8818
  r,
8809
- i ?? Vr(n, r)
8819
+ i ?? Br(n, r)
8810
8820
  ),
8811
8821
  mapResult: s.mapResult
8812
8822
  };
@@ -8899,7 +8909,7 @@ ke.create({
8899
8909
  ].filter(Boolean);
8900
8910
  }
8901
8911
  });
8902
- function us(e) {
8912
+ function ds(e) {
8903
8913
  if (!e.length)
8904
8914
  return Ii.empty;
8905
8915
  const t = [], n = e[0].$from.node(0);
@@ -8920,22 +8930,22 @@ function xn(e, t, n) {
8920
8930
  const a = o + c, d = a + l.nodeSize;
8921
8931
  if (a < r.start || a >= r.end)
8922
8932
  return;
8923
- const h = new io(s.resolve(a), s.resolve(d));
8933
+ const h = new no(s.resolve(a), s.resolve(d));
8924
8934
  i.push(h);
8925
8935
  }), i;
8926
8936
  }
8927
- var Uh = class $r {
8937
+ var Uh = class Hr {
8928
8938
  constructor(t, n) {
8929
8939
  this.anchor = t, this.head = n;
8930
8940
  }
8931
8941
  map(t) {
8932
- return new $r(t.map(this.anchor), t.map(this.head));
8942
+ return new Hr(t.map(this.anchor), t.map(this.head));
8933
8943
  }
8934
8944
  resolve(t) {
8935
8945
  const n = t.resolve(this.anchor), i = t.resolve(this.head);
8936
8946
  return new _t(n, i);
8937
8947
  }
8938
- }, _t = class vt extends so {
8948
+ }, _t = class vt extends io {
8939
8949
  constructor(t, n, i, s = 1) {
8940
8950
  const { doc: r } = t, o = t === n, l = t.pos === r.content.size && n.pos === r.content.size, c = o && !l ? r.resolve(n.pos + (s > 0 ? 1 : -1)) : n, a = o && l ? r.resolve(t.pos - (s > 0 ? 1 : -1)) : t, d = xn(a.min(c), a.max(c), i), h = c.pos >= t.pos ? d[0].$from : d[d.length - 1].$to, u = c.pos >= t.pos ? d[d.length - 1].$to : d[0].$from;
8941
8951
  super(h, u, d), this.depth = i;
@@ -9069,12 +9079,12 @@ ke.create({
9069
9079
  decorations: (n) => {
9070
9080
  const { selection: i } = n, s = Le(i);
9071
9081
  if (e = !1, !t)
9072
- return s ? (e = !0, us(i.ranges)) : null;
9082
+ return s ? (e = !0, ds(i.ranges)) : null;
9073
9083
  const { $from: r, $to: o } = i;
9074
9084
  if (!s && r.sameParent(o))
9075
9085
  return null;
9076
9086
  const l = xn(r, o, this.options.depth);
9077
- return l.length ? (e = !0, us(l)) : null;
9087
+ return l.length ? (e = !0, ds(l)) : null;
9078
9088
  }
9079
9089
  }
9080
9090
  })
@@ -9108,7 +9118,7 @@ function Vh(e, t, n, i = 5) {
9108
9118
  let f = l;
9109
9119
  return h && u && (f = l), { x: Math.min(Math.max(f.left + i, t), f.right - i), y: a };
9110
9120
  }
9111
- var Fr = (e) => {
9121
+ var $r = (e) => {
9112
9122
  const { x: t, y: n, editor: i } = e, { view: s, state: r } = i, { x: o, y: l } = Vh(s, t, n, 5), c = s.root.elementsFromPoint(o, l);
9113
9123
  let a;
9114
9124
  if (Array.prototype.some.call(c, (u) => {
@@ -9144,12 +9154,12 @@ function $h(e, t, n) {
9144
9154
  top: n
9145
9155
  };
9146
9156
  }
9147
- function zr(e) {
9157
+ function Fr(e) {
9148
9158
  var t;
9149
9159
  (t = e.parentNode) == null || t.removeChild(e);
9150
9160
  }
9151
9161
  function Fh(e, t) {
9152
- const { doc: n } = t.view.state, i = Fr({
9162
+ const { doc: n } = t.view.state, i = $r({
9153
9163
  editor: t,
9154
9164
  x: e.clientX,
9155
9165
  y: e.clientY
@@ -9176,12 +9186,12 @@ function zh(e, t) {
9176
9186
  a.forEach((b) => {
9177
9187
  const w = n.nodeDOM(b.$from.pos), D = Ph(w);
9178
9188
  h.append(D);
9179
- }), h.style.position = "absolute", h.style.top = "-10000px", document.body.append(h), e.dataTransfer.clearData(), e.dataTransfer.setDragImage(h, 0, 0), n.dragging = { slice: m, move: !0 }, d.setSelection(g), n.dispatch(d), document.addEventListener("drop", () => zr(h), { once: !0 });
9189
+ }), h.style.position = "absolute", h.style.top = "-10000px", document.body.append(h), e.dataTransfer.clearData(), e.dataTransfer.setDragImage(h, 0, 0), n.dragging = { slice: m, move: !0 }, d.setSelection(g), n.dispatch(d), document.addEventListener("drop", () => Fr(h), { once: !0 });
9180
9190
  }
9181
- var fs = (e, t) => {
9191
+ var us = (e, t) => {
9182
9192
  const n = e.resolve(t), { depth: i } = n;
9183
9193
  return i === 0 ? t : n.pos - n.parentOffset - 1;
9184
- }, ps = (e, t) => {
9194
+ }, fs = (e, t) => {
9185
9195
  const n = e.nodeAt(t), i = e.resolve(t);
9186
9196
  let { depth: s } = i, r = n;
9187
9197
  for (; s > 0; ) {
@@ -9192,16 +9202,16 @@ var fs = (e, t) => {
9192
9202
  }, Nn = (e, t) => {
9193
9203
  const n = U.getState(e);
9194
9204
  return n ? rn(t, n.type, n.binding.mapping) : null;
9195
- }, Wh = (e, t) => {
9205
+ }, Kh = (e, t) => {
9196
9206
  const n = U.getState(e);
9197
9207
  return n ? de(n.doc, n.type, t, n.binding.mapping) || 0 : -1;
9198
- }, gs = (e, t) => {
9208
+ }, ps = (e, t) => {
9199
9209
  let n = t;
9200
9210
  for (; n != null && n.parentNode && n.parentNode !== e.dom; )
9201
9211
  n = n.parentNode;
9202
9212
  return n;
9203
- }, Wr = new te("dragHandle"), jr = ({
9204
- pluginKey: e = Wr,
9213
+ }, zr = new te("dragHandle"), Kr = ({
9214
+ pluginKey: e = zr,
9205
9215
  element: t,
9206
9216
  editor: n,
9207
9217
  computePositionConfig: i,
@@ -9241,12 +9251,12 @@ var fs = (e, t) => {
9241
9251
  t && (t.style.pointerEvents = "none");
9242
9252
  }, 0);
9243
9253
  }
9244
- function A(v) {
9254
+ function I(v) {
9245
9255
  l == null || l(v), m(), t && (t.style.pointerEvents = "auto", t.dataset.dragging = "false");
9246
9256
  }
9247
- return t.addEventListener("dragstart", D), t.addEventListener("dragend", A), c.appendChild(t), {
9257
+ return t.addEventListener("dragstart", D), t.addEventListener("dragend", I), c.appendChild(t), {
9248
9258
  unbind() {
9249
- t.removeEventListener("dragstart", D), t.removeEventListener("dragend", A), f && (cancelAnimationFrame(f), f = null, g = null);
9259
+ t.removeEventListener("dragstart", D), t.removeEventListener("dragend", I), f && (cancelAnimationFrame(f), f = null, g = null);
9250
9260
  },
9251
9261
  plugin: new Ce({
9252
9262
  key: typeof e == "string" ? new te(e) : e,
@@ -9259,8 +9269,8 @@ var fs = (e, t) => {
9259
9269
  if (k !== void 0 && (a = k), N)
9260
9270
  return m(), a = !1, d = null, h = -1, r == null || r({ editor: n, node: null, pos: -1 }), P;
9261
9271
  if (v.docChanged && h !== -1 && t)
9262
- if (Br(v)) {
9263
- const H = Wh(x, u);
9272
+ if (Pr(v)) {
9273
+ const H = Kh(x, u);
9264
9274
  H !== h && (h = H);
9265
9275
  } else {
9266
9276
  const H = v.mapping.map(h);
@@ -9282,14 +9292,14 @@ var fs = (e, t) => {
9282
9292
  if (a ? t.draggable = !1 : t.draggable = !0, v.state.doc.eq(x.doc) || h === -1)
9283
9293
  return;
9284
9294
  let k = v.nodeDOM(h);
9285
- if (k = gs(v, k), k === v.dom || (k == null ? void 0 : k.nodeType) !== 1)
9295
+ if (k = ps(v, k), k === v.dom || (k == null ? void 0 : k.nodeType) !== 1)
9286
9296
  return;
9287
- const N = v.posAtDOM(k, 0), H = ps(n.state.doc, N), et = fs(n.state.doc, N);
9297
+ const N = v.posAtDOM(k, 0), H = fs(n.state.doc, N), et = us(n.state.doc, N);
9288
9298
  d = H, h = et, u = Nn(v.state, h), r == null || r({ editor: n, node: d, pos: h }), w(k);
9289
9299
  },
9290
9300
  // TODO: Kills even on hot reload
9291
9301
  destroy() {
9292
- f && (cancelAnimationFrame(f), f = null, g = null), t && zr(c);
9302
+ f && (cancelAnimationFrame(f), f = null, g = null), t && Fr(c);
9293
9303
  }
9294
9304
  };
9295
9305
  },
@@ -9307,7 +9317,7 @@ var fs = (e, t) => {
9307
9317
  return;
9308
9318
  const { x: E, y: x } = g;
9309
9319
  g = null;
9310
- const k = Fr({
9320
+ const k = $r({
9311
9321
  x: E,
9312
9322
  y: x,
9313
9323
  editor: n
@@ -9315,12 +9325,12 @@ var fs = (e, t) => {
9315
9325
  if (!k.resultElement)
9316
9326
  return;
9317
9327
  let N = k.resultElement;
9318
- if (N = gs(v, N), N === v.dom || (N == null ? void 0 : N.nodeType) !== 1)
9328
+ if (N = ps(v, N), N === v.dom || (N == null ? void 0 : N.nodeType) !== 1)
9319
9329
  return;
9320
- const H = v.posAtDOM(N, 0), et = ps(n.state.doc, H);
9330
+ const H = v.posAtDOM(N, 0), et = fs(n.state.doc, H);
9321
9331
  if (et !== d) {
9322
- const It = fs(n.state.doc, H);
9323
- d = et, h = It, u = Nn(v.state, h), r == null || r({ editor: n, node: d, pos: h }), w(N), b();
9332
+ const At = us(n.state.doc, H);
9333
+ d = et, h = At, u = Nn(v.state, h), r == null || r({ editor: n, node: d, pos: h }), w(N), b();
9324
9334
  }
9325
9335
  })), !1;
9326
9336
  }
@@ -9357,7 +9367,7 @@ ke.create({
9357
9367
  addProseMirrorPlugins() {
9358
9368
  const e = this.options.render();
9359
9369
  return [
9360
- jr({
9370
+ Kr({
9361
9371
  computePositionConfig: { ...Qn, ...this.options.computePositionConfig },
9362
9372
  getReferencedVirtualElement: this.options.getReferencedVirtualElement,
9363
9373
  element: e,
@@ -9369,12 +9379,12 @@ ke.create({
9369
9379
  ];
9370
9380
  }
9371
9381
  });
9372
- var jh = (e) => {
9382
+ var Wh = (e) => {
9373
9383
  const {
9374
9384
  className: t = "drag-handle",
9375
9385
  children: n,
9376
9386
  editor: i,
9377
- pluginKey: s = Wr,
9387
+ pluginKey: s = zr,
9378
9388
  onNodeChange: r,
9379
9389
  onElementDragStart: o,
9380
9390
  onElementDragEnd: l,
@@ -9384,7 +9394,7 @@ var jh = (e) => {
9384
9394
  let u = null;
9385
9395
  return a ? i.isDestroyed ? () => {
9386
9396
  h.current = null;
9387
- } : (h.current || (u = jr({
9397
+ } : (h.current || (u = Kr({
9388
9398
  editor: i,
9389
9399
  element: a,
9390
9400
  pluginKey: s,
@@ -9410,10 +9420,10 @@ var jh = (e) => {
9410
9420
  children: n
9411
9421
  }
9412
9422
  );
9413
- }, Kh = jh;
9414
- function iu() {
9415
- var E, x, k, N, H, et, It, Ot;
9416
- const e = Y(), t = Z(), { t: n } = X(), [i, s] = z(null), [r, o] = z(-1), [l, c] = z(!1), a = (x = (E = e == null ? void 0 : e.extensionManager) == null ? void 0 : E.extensions) == null ? void 0 : x.some((_) => (_ == null ? void 0 : _.name) === Mo.name), d = (N = (k = e == null ? void 0 : e.extensionManager) == null ? void 0 : k.extensions) == null ? void 0 : N.some((_) => (_ == null ? void 0 : _.name) === Po.name), h = (et = (H = e == null ? void 0 : e.extensionManager) == null ? void 0 : H.extensions) == null ? void 0 : et.some((_) => (_ == null ? void 0 : _.name) === Lo.name);
9423
+ }, jh = Wh;
9424
+ function nu() {
9425
+ var E, x, k, N, H, et, At, Ot;
9426
+ const e = Y(), t = X(), { t: n } = Z(), [i, s] = z(null), [r, o] = z(-1), [l, c] = z(!1), a = (x = (E = e == null ? void 0 : e.extensionManager) == null ? void 0 : E.extensions) == null ? void 0 : x.some((_) => (_ == null ? void 0 : _.name) === Oo.name), d = (N = (k = e == null ? void 0 : e.extensionManager) == null ? void 0 : k.extensions) == null ? void 0 : N.some((_) => (_ == null ? void 0 : _.name) === $o.name), h = (et = (H = e == null ? void 0 : e.extensionManager) == null ? void 0 : H.extensions) == null ? void 0 : et.some((_) => (_ == null ? void 0 : _.name) === Ho.name);
9417
9427
  function u() {
9418
9428
  const _ = e.chain();
9419
9429
  _.setNodeSelection(r).unsetAllMarks(), (i == null ? void 0 : i.type.name) !== "paragraph" && _.setParagraph(), _.run();
@@ -9430,27 +9440,27 @@ function iu() {
9430
9440
  e.commands.setTextAlign(_);
9431
9441
  }
9432
9442
  function b() {
9433
- const _ = Mi(e.state.tr, r, 1);
9443
+ const _ = Ui(e.state.tr, r, 1);
9434
9444
  _.setMeta("hideDragHandle", !0), e.view.dispatch && e.view.dispatch(_);
9435
9445
  }
9436
9446
  function w() {
9437
- const _ = Mi(e.state.tr, r, -1);
9447
+ const _ = Ui(e.state.tr, r, -1);
9438
9448
  e.view.dispatch && e.view.dispatch(_);
9439
9449
  }
9440
9450
  function D() {
9441
9451
  e.chain().setMeta("hideDragHandle", !0).setNodeSelection(r).deleteSelection().run();
9442
9452
  }
9443
- function A({ node: _, pos: ft }) {
9453
+ function I({ node: _, pos: ft }) {
9444
9454
  _ && s(_), o(ft);
9445
9455
  }
9446
9456
  function v() {
9447
9457
  var _;
9448
9458
  if (r !== -1) {
9449
- const ft = (i == null ? void 0 : i.nodeSize) || 0, re = r + ft, Wt = (i == null ? void 0 : i.type.name) === "paragraph" && ((_ = i == null ? void 0 : i.content) == null ? void 0 : _.size) === 0, Kr = Wt ? r + 2 : re + 2;
9450
- e.chain().command(({ dispatch: vi, tr: Sn, state: Ci }) => vi ? (Wt ? Sn.insertText("/", r, r + 1) : Sn.insert(
9459
+ const ft = (i == null ? void 0 : i.nodeSize) || 0, re = r + ft, Kt = (i == null ? void 0 : i.type.name) === "paragraph" && ((_ = i == null ? void 0 : i.content) == null ? void 0 : _.size) === 0, Wr = Kt ? r + 2 : re + 2;
9460
+ e.chain().command(({ dispatch: vi, tr: Sn, state: Ci }) => vi ? (Kt ? Sn.insertText("/", r, r + 1) : Sn.insert(
9451
9461
  re,
9452
9462
  Ci.schema.nodes.paragraph.create(null, [Ci.schema.text("/")])
9453
- ), vi(Sn)) : !0).focus(Kr).run();
9463
+ ), vi(Sn)) : !0).focus(Wr).run();
9454
9464
  }
9455
9465
  }
9456
9466
  st(() => (l ? e.commands.setMeta("lockDragHandle", !0) : e.commands.setMeta("lockDragHandle", !1), () => {
@@ -9461,10 +9471,11 @@ function iu() {
9461
9471
  };
9462
9472
  return /* @__PURE__ */ S(M, { children: [
9463
9473
  /* @__PURE__ */ p(
9464
- Kh,
9474
+ jh,
9465
9475
  {
9466
9476
  editor: e,
9467
- onNodeChange: A,
9477
+ onNodeChange: I,
9478
+ pluginKey: "RichTextBubbleMenuDragHandle",
9468
9479
  children: /* @__PURE__ */ S("div", { className: "richtext-flex richtext-items-center richtext-gap-0.5 richtext-duration-200 richtext-ease-in-out [transition-property:top,_left]", children: [
9469
9480
  /* @__PURE__ */ p(
9470
9481
  y,
@@ -9490,14 +9501,14 @@ function iu() {
9490
9501
  }
9491
9502
  ),
9492
9503
  /* @__PURE__ */ S(
9493
- Bo,
9504
+ Lo,
9494
9505
  {
9495
9506
  onOpenChange: P,
9496
9507
  open: l,
9497
9508
  children: [
9498
- /* @__PURE__ */ p("div", { className: "richtext-relative richtext-flex richtext-flex-col", children: /* @__PURE__ */ p(Vo, { className: "richtext-absolute richtext-left-0 richtext-top-0 richtext-z-0 richtext-size-[28px]" }) }),
9509
+ /* @__PURE__ */ p("div", { className: "richtext-relative richtext-flex richtext-flex-col", children: /* @__PURE__ */ p(Po, { className: "richtext-absolute richtext-left-0 richtext-top-0 richtext-z-0 richtext-size-[28px]" }) }),
9499
9510
  /* @__PURE__ */ S(
9500
- Ho,
9511
+ Bo,
9501
9512
  {
9502
9513
  align: "start",
9503
9514
  className: "richtext-w-48",
@@ -9549,13 +9560,13 @@ function iu() {
9549
9560
  ]
9550
9561
  }
9551
9562
  ),
9552
- a || d ? /* @__PURE__ */ p($o, {}) : null,
9553
- a ? /* @__PURE__ */ S(Ri, { children: [
9554
- /* @__PURE__ */ S(Ni, { className: "richtext-flex richtext-gap-3", children: [
9563
+ a || d ? /* @__PURE__ */ p(Vo, {}) : null,
9564
+ a ? /* @__PURE__ */ S(Ai, { children: [
9565
+ /* @__PURE__ */ S(Oi, { className: "richtext-flex richtext-gap-3", children: [
9555
9566
  /* @__PURE__ */ p(rt, { name: "AlignCenter" }),
9556
9567
  /* @__PURE__ */ p("span", { children: n("editor.textalign.tooltip") })
9557
9568
  ] }),
9558
- /* @__PURE__ */ p(Ui, { children: /* @__PURE__ */ S(Li, { children: [
9569
+ /* @__PURE__ */ p(Mi, { children: /* @__PURE__ */ S(Ri, { children: [
9559
9570
  /* @__PURE__ */ S(
9560
9571
  mt,
9561
9572
  {
@@ -9591,17 +9602,17 @@ function iu() {
9591
9602
  )
9592
9603
  ] }) })
9593
9604
  ] }) : null,
9594
- d ? /* @__PURE__ */ S(Ri, { children: [
9595
- /* @__PURE__ */ S(Ni, { className: "richtext-flex richtext-gap-3", children: [
9605
+ d ? /* @__PURE__ */ S(Ai, { children: [
9606
+ /* @__PURE__ */ S(Oi, { className: "richtext-flex richtext-gap-3", children: [
9596
9607
  /* @__PURE__ */ p(rt, { name: "IndentIncrease" }),
9597
9608
  /* @__PURE__ */ p("span", { children: n("editor.indent") })
9598
9609
  ] }),
9599
- /* @__PURE__ */ p(Ui, { children: /* @__PURE__ */ S(Li, { children: [
9610
+ /* @__PURE__ */ p(Mi, { children: /* @__PURE__ */ S(Ri, { children: [
9600
9611
  /* @__PURE__ */ S(
9601
9612
  mt,
9602
9613
  {
9603
9614
  className: "richtext-flex richtext-gap-3",
9604
- disabled: ((It = i == null ? void 0 : i.attrs) == null ? void 0 : It.indent) >= Oi.max,
9615
+ disabled: ((At = i == null ? void 0 : i.attrs) == null ? void 0 : At.indent) >= Ni.max,
9605
9616
  onClick: b,
9606
9617
  children: [
9607
9618
  /* @__PURE__ */ p(rt, { name: "IndentIncrease" }),
@@ -9613,7 +9624,7 @@ function iu() {
9613
9624
  mt,
9614
9625
  {
9615
9626
  className: "richtext-flex richtext-gap-3",
9616
- disabled: ((Ot = i == null ? void 0 : i.attrs) == null ? void 0 : Ot.indent) <= Oi.min,
9627
+ disabled: ((Ot = i == null ? void 0 : i.attrs) == null ? void 0 : Ot.indent) <= Ni.min,
9617
9628
  onClick: w,
9618
9629
  children: [
9619
9630
  /* @__PURE__ */ p(rt, { name: "IndentDecrease" }),
@@ -9632,18 +9643,18 @@ function iu() {
9632
9643
  ] });
9633
9644
  }
9634
9645
  export {
9635
- zd as RichTextBubbleColumns,
9636
- Wd as RichTextBubbleDrawer,
9637
- jd as RichTextBubbleExcalidraw,
9638
- Kd as RichTextBubbleIframe,
9639
- Jd as RichTextBubbleImage,
9640
- qd as RichTextBubbleImageGif,
9641
- Yd as RichTextBubbleKatex,
9642
- Gd as RichTextBubbleLink,
9643
- iu as RichTextBubbleMenuDragHandle,
9644
- Zd as RichTextBubbleMermaid,
9645
- Qd as RichTextBubbleTable,
9646
- tu as RichTextBubbleText,
9647
- eu as RichTextBubbleTwitter,
9648
- Xd as RichTextBubbleVideo
9646
+ Fd as RichTextBubbleColumns,
9647
+ zd as RichTextBubbleDrawer,
9648
+ Kd as RichTextBubbleExcalidraw,
9649
+ Wd as RichTextBubbleIframe,
9650
+ Gd as RichTextBubbleImage,
9651
+ Jd as RichTextBubbleImageGif,
9652
+ jd as RichTextBubbleKatex,
9653
+ Yd as RichTextBubbleLink,
9654
+ nu as RichTextBubbleMenuDragHandle,
9655
+ Xd as RichTextBubbleMermaid,
9656
+ Zd as RichTextBubbleTable,
9657
+ Qd as RichTextBubbleText,
9658
+ tu as RichTextBubbleTwitter,
9659
+ qd as RichTextBubbleVideo
9649
9660
  };