@remarkablejames/editor 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/lib/ActionMenuButton-DI9_8wC0.cjs +1 -0
  2. package/lib/{ActionMenuButton-nxV91Fqo.js → ActionMenuButton-DL05l66z.js} +9 -10
  3. package/lib/Attachment.cjs +1 -19
  4. package/lib/Attachment.js +7 -270
  5. package/lib/Blockquote.cjs +2 -2
  6. package/lib/Blockquote.js +13 -12
  7. package/lib/Bold.cjs +1 -1
  8. package/lib/Bold.js +11 -10
  9. package/lib/BulletList.cjs +1 -1
  10. package/lib/BulletList.js +9 -8
  11. package/lib/Callout.cjs +1 -1
  12. package/lib/Callout.js +41 -45
  13. package/lib/Clear.cjs +1 -1
  14. package/lib/Clear.js +13 -14
  15. package/lib/Code.cjs +1 -1
  16. package/lib/Code.js +6 -5
  17. package/lib/CodeBlock.cjs +1 -1
  18. package/lib/CodeBlock.js +30 -31
  19. package/lib/CodeView.cjs +1 -1
  20. package/lib/CodeView.js +9 -8
  21. package/lib/Color.cjs +1 -1
  22. package/lib/Color.js +18 -19
  23. package/lib/Column.cjs +1 -1
  24. package/lib/Column.js +9 -8
  25. package/lib/Drawer-DEzhWKwY.cjs +2 -0
  26. package/lib/{Drawer-CF6Z_IA2.js → Drawer-DhM1qM6R.js} +41 -47
  27. package/lib/Drawer.cjs +1 -1
  28. package/lib/Drawer.js +3 -3
  29. package/lib/Emoji.cjs +1 -1
  30. package/lib/Emoji.js +14 -15
  31. package/lib/Excalidraw.cjs +1 -1
  32. package/lib/Excalidraw.js +28 -33
  33. package/lib/ExportPdf.cjs +3 -3
  34. package/lib/ExportPdf.js +14 -13
  35. package/lib/ExportWord.cjs +1 -1
  36. package/lib/ExportWord.js +6 -6
  37. package/lib/FontFamily.cjs +1 -1
  38. package/lib/FontFamily.js +7 -6
  39. package/lib/FontSize.cjs +1 -1
  40. package/lib/FontSize.js +15 -14
  41. package/lib/Heading.cjs +1 -1
  42. package/lib/Heading.js +26 -26
  43. package/lib/Highlight.cjs +1 -1
  44. package/lib/Highlight.js +22 -23
  45. package/lib/History.cjs +1 -1
  46. package/lib/History.js +11 -11
  47. package/lib/HorizontalRule.cjs +1 -1
  48. package/lib/HorizontalRule.js +10 -9
  49. package/lib/Iframe-DbYJ82AI.cjs +1 -0
  50. package/lib/{Iframe-Dfd3LI7b.js → Iframe-yDX_zHls.js} +11 -14
  51. package/lib/Iframe.cjs +1 -1
  52. package/lib/Iframe.js +3 -3
  53. package/lib/Image.cjs +1 -1
  54. package/lib/Image.js +4 -5
  55. package/lib/ImageGif.cjs +1 -1
  56. package/lib/ImageGif.js +83 -86
  57. package/lib/ImportWord.cjs +1 -1
  58. package/lib/ImportWord.js +26 -28
  59. package/lib/{Indent-CDVF9DWN.js → Indent-CA46zsbb.js} +31 -30
  60. package/lib/Indent-CYaCq_Mv.cjs +1 -0
  61. package/lib/Indent.cjs +1 -1
  62. package/lib/Indent.js +2 -2
  63. package/lib/Italic.cjs +1 -1
  64. package/lib/Italic.js +12 -11
  65. package/lib/Katex-Dh-kTBjf.cjs +4 -0
  66. package/lib/{Katex-DqhWWAA-.js → Katex-g3ZS3zUf.js} +19 -22
  67. package/lib/Katex.cjs +1 -1
  68. package/lib/Katex.js +2 -2
  69. package/lib/LineHeight.cjs +1 -1
  70. package/lib/LineHeight.js +19 -20
  71. package/lib/Link.cjs +1 -1
  72. package/lib/Link.js +2 -2
  73. package/lib/LinkEditBlock-ClqpI1FH.cjs +5 -0
  74. package/lib/{LinkEditBlock-xP0pGVhB.js → LinkEditBlock-qE5KHPQs.js} +19 -24
  75. package/lib/Mention.js +3 -3
  76. package/lib/Mermaid-BmUChJSB.cjs +2 -0
  77. package/lib/{Mermaid-BJ6ryVdY.js → Mermaid-CefRECZY.js} +45 -48
  78. package/lib/Mermaid.cjs +1 -1
  79. package/lib/Mermaid.js +2 -2
  80. package/lib/MoreMark.cjs +1 -1
  81. package/lib/MoreMark.js +26 -28
  82. package/lib/OrderedList.cjs +1 -1
  83. package/lib/OrderedList.js +11 -10
  84. package/lib/PaywallSeparator.cjs +1 -1
  85. package/lib/PaywallSeparator.js +9 -9
  86. package/lib/SearchAndReplace.cjs +1 -1
  87. package/lib/SearchAndReplace.js +37 -42
  88. package/lib/SlashCommand.cjs +1 -1
  89. package/lib/SlashCommand.js +5 -5
  90. package/lib/{SlashCommandNodeView-DS9FqMiY.js → SlashCommandNodeView-BsIrWlhS.js} +19 -21
  91. package/lib/SlashCommandNodeView-DpXsfGmo.cjs +1 -0
  92. package/lib/Strike.cjs +1 -1
  93. package/lib/Strike.js +12 -11
  94. package/lib/Table-B-0TePQ3.cjs +5 -0
  95. package/lib/{Table-CcG-JNtV.js → Table-CG0nisk4.js} +46 -46
  96. package/lib/Table.cjs +1 -1
  97. package/lib/Table.js +1 -1
  98. package/lib/TaskList.cjs +1 -1
  99. package/lib/TaskList.js +12 -11
  100. package/lib/TextAlign.cjs +1 -1
  101. package/lib/TextAlign.js +26 -27
  102. package/lib/TextDirection.cjs +1 -1
  103. package/lib/TextDirection.js +18 -19
  104. package/lib/TextUnderline.cjs +1 -1
  105. package/lib/TextUnderline.js +9 -8
  106. package/lib/{Twitter-BIL3o833.js → Twitter-DlGSWdh7.js} +18 -22
  107. package/lib/Twitter-DvMmVNMF.cjs +1 -0
  108. package/lib/Twitter.cjs +1 -1
  109. package/lib/Twitter.js +2 -2
  110. package/lib/Video.cjs +1 -1
  111. package/lib/Video.js +4 -5
  112. package/lib/bubble.cjs +3 -3
  113. package/lib/bubble.js +77 -86
  114. package/lib/{clsx-m_C5j3RU.js → clsx-BUPZHhq3.js} +24 -24
  115. package/lib/{dropdown-menu-DWt_xj4h.js → dropdown-menu-D-mNjyKn.js} +1 -1
  116. package/lib/{dropdown-menu-tUP872Zv.cjs → dropdown-menu-gOopBX-L.cjs} +1 -1
  117. package/lib/index-CUnpdrCy.cjs +28 -0
  118. package/lib/index-CelRl0mr.js +5447 -0
  119. package/lib/{index-C8FjP66D.js → index-D4M4hrH4.js} +1 -1
  120. package/lib/{index-s3l5RdyW.js → index-DZj2z9_1.js} +1 -1
  121. package/lib/{index-C1KQsOcg.js → index-Dl3OjzmR.js} +1 -1
  122. package/lib/{index-B3Ijnbxs.js → index-RkKGy5oa.js} +1 -1
  123. package/lib/index.cjs +4 -4
  124. package/lib/index.js +151 -464
  125. package/lib/{popover-C3A6zzNV.cjs → popover-DEMkixfo.cjs} +1 -1
  126. package/lib/{popover-BC7FRr8B.js → popover-SMtif0E1.js} +1 -1
  127. package/lib/{renderNodeView-C_hPIdEs.js → renderNodeView-dj6AaFSX.js} +2 -2
  128. package/lib/{select-B8HIWDXf.cjs → select-BqlizSg4.cjs} +1 -1
  129. package/lib/{select-DSKqhVGR.js → select-Dc3RkAhQ.js} +1 -1
  130. package/lib/{separator-BJWSNjvr.js → separator-DWLSmuSh.js} +12 -13
  131. package/lib/separator-DuP4NoiV.cjs +1 -0
  132. package/lib/style.css +1 -1
  133. package/lib/{textarea-CtVdqwSM.cjs → textarea-C89l2GRG.cjs} +1 -1
  134. package/lib/{textarea-Ch5w3PiI.js → textarea-DvciwVxS.js} +1 -1
  135. package/lib/theme.cjs +1 -1
  136. package/lib/theme.js +18 -18
  137. package/lib/{updatePosition-DvfTZHcH.js → updatePosition-C294Pixi.js} +2 -2
  138. package/package.json +1 -1
  139. package/lib/ActionMenuButton-D9o3Kwmv.cjs +0 -1
  140. package/lib/Drawer-Bh-y5bs8.cjs +0 -2
  141. package/lib/Icon-BvGyfX2j.js +0 -15
  142. package/lib/Icon-wjwoRc9F.cjs +0 -1
  143. package/lib/Iframe-BbfZKbPY.cjs +0 -1
  144. package/lib/ImageCropper-CY1ETEjC.cjs +0 -10
  145. package/lib/ImageCropper-DrSdjo9x.js +0 -979
  146. package/lib/Indent-Q1VuhSM2.cjs +0 -1
  147. package/lib/Katex-K1QU2SB2.cjs +0 -4
  148. package/lib/LinkEditBlock-CBYGLs3J.cjs +0 -5
  149. package/lib/Mermaid-D3_nLeOW.cjs +0 -2
  150. package/lib/SlashCommandNodeView-CUJrDQS7.cjs +0 -1
  151. package/lib/Table-CV6pUoVf.cjs +0 -5
  152. package/lib/Twitter-BfSTqPDh.cjs +0 -1
  153. package/lib/Video-DAKr90QL.js +0 -231
  154. package/lib/Video-HAinT0w6.cjs +0 -1
  155. package/lib/button-090-I3tp.js +0 -35
  156. package/lib/button-B4Sz2ZhW.cjs +0 -1
  157. package/lib/checkbox-BCPsu7yR.cjs +0 -1
  158. package/lib/checkbox-DiXWHAI0.js +0 -29
  159. package/lib/dialog-C8J59d2J.cjs +0 -1
  160. package/lib/dialog-bDkDW-C_.js +0 -95
  161. package/lib/dom-dataset-BqoJhJXt.cjs +0 -1
  162. package/lib/dom-dataset-CIEeltF6.js +0 -47
  163. package/lib/events.constant-Bke62qxm.cjs +0 -1
  164. package/lib/events.constant-CSWD3-ho.js +0 -72
  165. package/lib/file-i7e4nQY2.cjs +0 -1
  166. package/lib/file-jDdkhyj7.js +0 -43
  167. package/lib/index-BXh8X1ch.cjs +0 -1
  168. package/lib/index-jMN4V2hr.js +0 -2763
  169. package/lib/input-C_J-pfTx.js +0 -21
  170. package/lib/input-DwLo4r7V.cjs +0 -1
  171. package/lib/isNumber-BTYSVlKo.cjs +0 -1
  172. package/lib/isNumber-WaBzl_0s.js +0 -15
  173. package/lib/label-BgIVynq3.cjs +0 -1
  174. package/lib/label-ClsOg9Hr.js +0 -11
  175. package/lib/separator-D6ruF682.cjs +0 -1
  176. package/lib/tabs-D1J1iB7B.js +0 -46
  177. package/lib/tabs-IEbMQmNX.cjs +0 -1
  178. package/lib/throttle-CRNq0z-O.js +0 -249
  179. package/lib/throttle-gTTvqDTW.cjs +0 -1
  180. package/lib/toggle-C9tcMm1r.cjs +0 -1
  181. package/lib/toggle-CaSwYCk4.js +0 -89
  182. package/lib/use-toast-C6zPo25l.cjs +0 -1
  183. package/lib/use-toast-CEOqhXfx.js +0 -97
  184. package/lib/useButtonProps-D-ruygH7.js +0 -165
  185. package/lib/useButtonProps-D9ndBdmA.cjs +0 -1
package/lib/theme.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-NsYff_Ni.cjs"),n={light:{default:{radius:"0.65rem",background:"0 0% 100%",foreground:"240 10% 3.9%",card:"0 0% 100%","card-foreground":"240 10% 3.9%",popover:"0 0% 100%","popover-foreground":"240 10% 3.9%",primary:"240 5.9% 10%","primary-foreground":"0 0% 98%",secondary:"240 4.8% 95.9%","secondary-foreground":"240 5.9% 10%",muted:"240 4.8% 95.9%","muted-foreground":"240 3.8% 46.1%",accent:"240 4.8% 95.9%","accent-foreground":"240 5.9% 10%",destructive:"0 84.2% 60.2%","destructive-foreground":"0 0% 98%",border:"240 5.9% 90%",input:"240 5.9% 90%",ring:"240 5.9% 10%"},red:{radius:"0.65rem",background:"0 0% 100%",foreground:"0 0% 3.9%",card:"0 0% 100%","card-foreground":"0 0% 3.9%",popover:"0 0% 100%","popover-foreground":"0 0% 3.9%",primary:"0 72.2% 50.6%","primary-foreground":"0 85.7% 97.3%",secondary:"0 0% 96.1%","secondary-foreground":"0 0% 9%",muted:"0 0% 96.1%","muted-foreground":"0 0% 45.1%",accent:"0 0% 96.1%","accent-foreground":"0 0% 9%",destructive:"0 84.2% 60.2%","destructive-foreground":"0 0% 98%",border:"0 0% 89.8%",input:"0 0% 89.8%",ring:"0 72.2% 50.6%"},blue:{radius:"0.65rem",background:"0 0% 100%",foreground:"222.2 84% 4.9%",card:"0 0% 100%","card-foreground":"222.2 84% 4.9%",popover:"0 0% 100%","popover-foreground":"222.2 84% 4.9%",primary:"221.2 83.2% 53.3%","primary-foreground":"210 40% 98%",secondary:"210 40% 96.1%","secondary-foreground":"222.2 47.4% 11.2%",muted:"210 40% 96.1%","muted-foreground":"215.4 16.3% 46.9%",accent:"210 40% 96.1%","accent-foreground":"222.2 47.4% 11.2%",destructive:"0 84.2% 60.2%","destructive-foreground":"210 40% 98%",border:"214.3 31.8% 91.4%",input:"214.3 31.8% 91.4%",ring:"221.2 83.2% 53.3%"},green:{radius:"0.65rem",background:"0 0% 100%",foreground:"240 10% 3.9%",card:"0 0% 100%","card-foreground":"240 10% 3.9%",popover:"0 0% 100%","popover-foreground":"240 10% 3.9%",primary:"142.1 76.2% 36.3%","primary-foreground":"355.7 100% 97.3%",secondary:"240 4.8% 95.9%","secondary-foreground":"240 5.9% 10%",muted:"240 4.8% 95.9%","muted-foreground":"240 3.8% 46.1%",accent:"240 4.8% 95.9%","accent-foreground":"240 5.9% 10%",destructive:"0 84.2% 60.2%","destructive-foreground":"0 0% 98%",border:"240 5.9% 90%",input:"240 5.9% 90%",ring:"142.1 76.2% 36.3%"},orange:{radius:"0.65rem",background:"0 0% 100%",foreground:"20 14.3% 4.1%",card:"0 0% 100%","card-foreground":"20 14.3% 4.1%",popover:"0 0% 100%","popover-foreground":"20 14.3% 4.1%",primary:"24.6 95% 53.1%","primary-foreground":"60 9.1% 97.8%",secondary:"60 4.8% 95.9%","secondary-foreground":"24 9.8% 10%",muted:"60 4.8% 95.9%","muted-foreground":"25 5.3% 44.7%",accent:"60 4.8% 95.9%","accent-foreground":"24 9.8% 10%",destructive:"0 84.2% 60.2%","destructive-foreground":"60 9.1% 97.8%",border:"20 5.9% 90%",input:"20 5.9% 90%"},rose:{radius:"0.65rem",background:"0 0% 100%",foreground:"240 10% 3.9%",card:"0 0% 100%","card-foreground":"240 10% 3.9%",popover:"0 0% 100%","popover-foreground":"240 10% 3.9%",primary:"346.8 77.2% 49.8%","primary-foreground":"355.7 100% 97.3%",secondary:"240 4.8% 95.9%","secondary-foreground":"240 5.9% 10%",muted:"240 4.8% 95.9%","muted-foreground":"240 3.8% 46.1%",accent:"240 4.8% 95.9%","accent-foreground":"240 5.9% 10%",destructive:"0 84.2% 60.2%","destructive-foreground":"0 0% 98%",border:"240 5.9% 90%",input:"240 5.9% 90%",ring:"346.8 77.2% 49.8%"},violet:{radius:"0.65rem",background:"0 0% 100%",foreground:"224 71.4% 4.1%",card:"0 0% 100%","card-foreground":"224 71.4% 4.1%",popover:"0 0% 100%","popover-foreground":"224 71.4% 4.1%",primary:"262.1 83.3% 57.8%","primary-foreground":"210 20% 98%",secondary:"220 14.3% 95.9%","secondary-foreground":"220.9 39.3% 11%",muted:"220 14.3% 95.9%","muted-foreground":"220 8.9% 46.1%",accent:"220 14.3% 95.9%","accent-foreground":"220.9 39.3% 11%",destructive:"0 84.2% 60.2%","destructive-foreground":"210 20% 98%",border:"220 13% 91%",input:"220 13% 91%",ring:"262.1 83.3% 57.8%"},yellow:{radius:"0.65rem",background:"0 0% 100%",foreground:"20 14.3% 4.1%",card:"0 0% 100%","card-foreground":"20 14.3% 4.1%",popover:"0 0% 100%","popover-foreground":"20 14.3% 4.1%",primary:"47.9 95.8% 53.1%","primary-foreground":"26 83.3% 14.1%",secondary:"60 4.8% 95.9%","secondary-foreground":"24 9.8% 10%",muted:"60 4.8% 95.9%","muted-foreground":"25 5.3% 44.7%",accent:"60 4.8% 95.9%","accent-foreground":"24 9.8% 10%",destructive:"0 84.2% 60.2%","destructive-foreground":"60 9.1% 97.8%",border:"20 5.9% 90%",input:"20 5.9% 90%",ring:"20 14.3% 4.1"}},dark:{default:{radius:"0.65rem",background:"222 18% 13%",foreground:"210 20% 94%",card:"222 16% 15%","card-foreground":"210 20% 94%",popover:"222 16% 16%","popover-foreground":"210 20% 94%",primary:"210 20% 96%","primary-foreground":"222 18% 13%",secondary:"222 13% 21%","secondary-foreground":"210 20% 94%",muted:"222 13% 21%","muted-foreground":"215 14% 68%",accent:"222 13% 23%","accent-foreground":"210 20% 96%",destructive:"0 62.8% 30.6%","destructive-foreground":"210 20% 96%",border:"222 13% 28%",input:"222 13% 28%",ring:"215 14% 68%"},red:{radius:"0.65rem",background:"0 0% 3.9%",foreground:"0 0% 98%",card:"0 0% 3.9%","card-foreground":"0 0% 98%",popover:"0 0% 3.9%","popover-foreground":"0 0% 98%",primary:"0 72.2% 50.6%","primary-foreground":"0 85.7% 97.3%",secondary:"0 0% 14.9%","secondary-foreground":"0 0% 98%",muted:"0 0% 14.9%","muted-foreground":"0 0% 63.9%",accent:"0 0% 14.9%","accent-foreground":"0 0% 98%",destructive:"0 62.8% 30.6%","destructive-foreground":"0 0% 98%",border:"0 0% 14.9%",input:"0 0% 14.9%",ring:"0 72.2% 50.6%"},blue:{radius:"0.65rem",background:"222.2 84% 4.9%",foreground:"210 40% 98%",card:"222.2 84% 4.9%","card-foreground":"210 40% 98%",popover:"222.2 84% 4.9%","popover-foreground":"210 40% 98%",primary:"217.2 91.2% 59.8%","primary-foreground":"222.2 47.4% 11.2%",secondary:"217.2 32.6% 17.5%","secondary-foreground":"210 40% 98%",muted:"217.2 32.6% 17.5%","muted-foreground":"215 20.2% 65.1%",accent:"217.2 32.6% 17.5%","accent-foreground":"210 40% 98%",destructive:"0 62.8% 30.6%","destructive-foreground":"210 40% 98%",border:"217.2 32.6% 17.5%",input:"217.2 32.6% 17.5%",ring:"224.3 76.3% 48%"},green:{radius:"0.65rem",background:"20 14.3% 4.1%",foreground:"0 0% 95%",card:"24 9.8% 10%","card-foreground":"0 0% 95%",popover:"0 0% 9%","popover-foreground":"0 0% 95%",primary:"142.1 70.6% 45.3%","primary-foreground":"144.9 80.4% 10%",secondary:"240 3.7% 15.9%","secondary-foreground":"0 0% 98%",muted:"0 0% 15%","muted-foreground":"240 5% 64.9%",accent:"12 6.5% 15.1%","accent-foreground":"0 0% 98%",destructive:"0 62.8% 30.6%","destructive-foreground":"0 85.7% 97.3%",border:"240 3.7% 15.9%",input:"240 3.7% 15.9%",ring:"142.4 71.8% 29.2%"},orange:{radius:"0.65rem",background:"20 14.3% 4.1%",foreground:"60 9.1% 97.8%",card:"20 14.3% 4.1%","card-foreground":"60 9.1% 97.8%",popover:"20 14.3% 4.1%","popover-foreground":"60 9.1% 97.8%",primary:"20.5 90.2% 48.2%","primary-foreground":"60 9.1% 97.8%",secondary:"12 6.5% 15.1%","secondary-foreground":"60 9.1% 97.8%",muted:"12 6.5% 15.1%","muted-foreground":"24 5.4% 63.9%",accent:"12 6.5% 15.1%","accent-foreground":"60 9.1% 97.8%",destructive:"0 72.2% 50.6%","destructive-foreground":"60 9.1% 97.8%",border:"12 6.5% 15.1%",input:"12 6.5% 15.1%",ring:"20.5 90.2% 48.2%"},rose:{radius:"0.65rem",background:"20 14.3% 4.1%",foreground:"0 0% 95%",card:"24 9.8% 10%","card-foreground":"0 0% 95%",popover:"0 0% 9%","popover-foreground":"0 0% 95%",primary:"346.8 77.2% 49.8%","primary-foreground":"355.7 100% 97.3%",secondary:"240 3.7% 15.9%","secondary-foreground":"0 0% 98%",muted:"0 0% 15%","muted-foreground":"240 5% 64.9%",accent:"12 6.5% 15.1%","accent-foreground":"0 0% 98%",destructive:"0 62.8% 30.6%","destructive-foreground":"0 85.7% 97.3%",border:"240 3.7% 15.9%",input:"240 3.7% 15.9%",ring:"346.8 77.2% 49.8%"},violet:{radius:"0.65rem",background:"224 71.4% 4.1%",foreground:"210 20% 98%",card:"224 71.4% 4.1%","card-foreground":"210 20% 98%",popover:"224 71.4% 4.1%","popover-foreground":"210 20% 98%",primary:"263.4 70% 50.4%","primary-foreground":"210 20% 98%",secondary:"215 27.9% 16.9%","secondary-foreground":"210 20% 98%",muted:"215 27.9% 16.9%","muted-foreground":"217.9 10.6% 64.9%",accent:"215 27.9% 16.9%","accent-foreground":"210 20% 98%",destructive:"0 62.8% 30.6%","destructive-foreground":"210 20% 98%",border:"215 27.9% 16.9%",input:"215 27.9% 16.9%",ring:"263.4 70% 50.4%"},yellow:{radius:"0.65rem",background:"20 14.3% 4.1%",foreground:"60 9.1% 97.8%",card:"20 14.3% 4.1%","card-foreground":"60 9.1% 97.8%",popover:"20 14.3% 4.1%","popover-foreground":"60 9.1% 97.8%",primary:"47.9 95.8% 53.1%","primary-foreground":"26 83.3% 14.1%",secondary:"12 6.5% 15.1%","secondary-foreground":"60 9.1% 97.8%",muted:"12 6.5% 15.1%","muted-foreground":"24 5.4% 63.9%",accent:"12 6.5% 15.1%","accent-foreground":"60 9.1% 97.8%",destructive:"0 62.8% 30.6%","destructive-foreground":"60 9.1% 97.8%",border:"12 6.5% 15.1%",input:"12 6.5% 15.1%",ring:"35.5 91.7% 32.9%"}}},d=o.y({theme:"light",color:"default",borderRadius:"0.65rem"});function c(){const{theme:r,color:e,borderRadius:u}=o.b(d);return{theme:r,color:e,borderRadius:u}}const t={setTheme:r=>{o.v(d).setValue(e=>({...e,theme:r}))},setColor:r=>{o.v(d).setValue(e=>({...e,color:r}))},setBorderRadius:r=>{o.v(d).setValue(e=>({...e,borderRadius:r}))}};exports.THEME=n;exports.themeActions=t;exports.useTheme=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-NsYff_Ni.cjs"),n={light:{default:{radius:"0.65rem",background:"0 0% 100%",foreground:"240 10% 3.9%",card:"0 0% 100%","card-foreground":"240 10% 3.9%",popover:"0 0% 100%","popover-foreground":"240 10% 3.9%",primary:"240 5.9% 10%","primary-foreground":"0 0% 98%",secondary:"240 4.8% 95.9%","secondary-foreground":"240 5.9% 10%",muted:"240 4.8% 95.9%","muted-foreground":"240 3.8% 46.1%",accent:"240 4.8% 95.9%","accent-foreground":"240 5.9% 10%",destructive:"0 84.2% 60.2%","destructive-foreground":"0 0% 98%",border:"240 5.9% 90%",input:"240 5.9% 90%",ring:"240 5.9% 10%"},red:{radius:"0.65rem",background:"0 0% 100%",foreground:"0 0% 3.9%",card:"0 0% 100%","card-foreground":"0 0% 3.9%",popover:"0 0% 100%","popover-foreground":"0 0% 3.9%",primary:"0 72.2% 50.6%","primary-foreground":"0 85.7% 97.3%",secondary:"0 0% 96.1%","secondary-foreground":"0 0% 9%",muted:"0 0% 96.1%","muted-foreground":"0 0% 45.1%",accent:"0 0% 96.1%","accent-foreground":"0 0% 9%",destructive:"0 84.2% 60.2%","destructive-foreground":"0 0% 98%",border:"0 0% 89.8%",input:"0 0% 89.8%",ring:"0 72.2% 50.6%"},blue:{radius:"0.65rem",background:"0 0% 100%",foreground:"222.2 84% 4.9%",card:"0 0% 100%","card-foreground":"222.2 84% 4.9%",popover:"0 0% 100%","popover-foreground":"222.2 84% 4.9%",primary:"221.2 83.2% 53.3%","primary-foreground":"210 40% 98%",secondary:"210 40% 96.1%","secondary-foreground":"222.2 47.4% 11.2%",muted:"210 40% 96.1%","muted-foreground":"215.4 16.3% 46.9%",accent:"210 40% 96.1%","accent-foreground":"222.2 47.4% 11.2%",destructive:"0 84.2% 60.2%","destructive-foreground":"210 40% 98%",border:"214.3 31.8% 91.4%",input:"214.3 31.8% 91.4%",ring:"221.2 83.2% 53.3%"},green:{radius:"0.65rem",background:"0 0% 100%",foreground:"240 10% 3.9%",card:"0 0% 100%","card-foreground":"240 10% 3.9%",popover:"0 0% 100%","popover-foreground":"240 10% 3.9%",primary:"142.1 76.2% 36.3%","primary-foreground":"355.7 100% 97.3%",secondary:"240 4.8% 95.9%","secondary-foreground":"240 5.9% 10%",muted:"240 4.8% 95.9%","muted-foreground":"240 3.8% 46.1%",accent:"240 4.8% 95.9%","accent-foreground":"240 5.9% 10%",destructive:"0 84.2% 60.2%","destructive-foreground":"0 0% 98%",border:"240 5.9% 90%",input:"240 5.9% 90%",ring:"142.1 76.2% 36.3%"},orange:{radius:"0.65rem",background:"0 0% 100%",foreground:"20 14.3% 4.1%",card:"0 0% 100%","card-foreground":"20 14.3% 4.1%",popover:"0 0% 100%","popover-foreground":"20 14.3% 4.1%",primary:"24.6 95% 53.1%","primary-foreground":"60 9.1% 97.8%",secondary:"60 4.8% 95.9%","secondary-foreground":"24 9.8% 10%",muted:"60 4.8% 95.9%","muted-foreground":"25 5.3% 44.7%",accent:"60 4.8% 95.9%","accent-foreground":"24 9.8% 10%",destructive:"0 84.2% 60.2%","destructive-foreground":"60 9.1% 97.8%",border:"20 5.9% 90%",input:"20 5.9% 90%"},rose:{radius:"0.65rem",background:"0 0% 100%",foreground:"240 10% 3.9%",card:"0 0% 100%","card-foreground":"240 10% 3.9%",popover:"0 0% 100%","popover-foreground":"240 10% 3.9%",primary:"346.8 77.2% 49.8%","primary-foreground":"355.7 100% 97.3%",secondary:"240 4.8% 95.9%","secondary-foreground":"240 5.9% 10%",muted:"240 4.8% 95.9%","muted-foreground":"240 3.8% 46.1%",accent:"240 4.8% 95.9%","accent-foreground":"240 5.9% 10%",destructive:"0 84.2% 60.2%","destructive-foreground":"0 0% 98%",border:"240 5.9% 90%",input:"240 5.9% 90%",ring:"346.8 77.2% 49.8%"},violet:{radius:"0.65rem",background:"0 0% 100%",foreground:"224 71.4% 4.1%",card:"0 0% 100%","card-foreground":"224 71.4% 4.1%",popover:"0 0% 100%","popover-foreground":"224 71.4% 4.1%",primary:"262.1 83.3% 57.8%","primary-foreground":"210 20% 98%",secondary:"220 14.3% 95.9%","secondary-foreground":"220.9 39.3% 11%",muted:"220 14.3% 95.9%","muted-foreground":"220 8.9% 46.1%",accent:"220 14.3% 95.9%","accent-foreground":"220.9 39.3% 11%",destructive:"0 84.2% 60.2%","destructive-foreground":"210 20% 98%",border:"220 13% 91%",input:"220 13% 91%",ring:"262.1 83.3% 57.8%"},yellow:{radius:"0.65rem",background:"0 0% 100%",foreground:"20 14.3% 4.1%",card:"0 0% 100%","card-foreground":"20 14.3% 4.1%",popover:"0 0% 100%","popover-foreground":"20 14.3% 4.1%",primary:"47.9 95.8% 53.1%","primary-foreground":"26 83.3% 14.1%",secondary:"60 4.8% 95.9%","secondary-foreground":"24 9.8% 10%",muted:"60 4.8% 95.9%","muted-foreground":"25 5.3% 44.7%",accent:"60 4.8% 95.9%","accent-foreground":"24 9.8% 10%",destructive:"0 84.2% 60.2%","destructive-foreground":"60 9.1% 97.8%",border:"20 5.9% 90%",input:"20 5.9% 90%",ring:"20 14.3% 4.1"}},dark:{default:{radius:"0.65rem",background:"0 0% 12.9%",foreground:"0 0% 98.5%",card:"0 0% 12.9%","card-foreground":"0 0% 98.5%",popover:"0 0% 12.9%","popover-foreground":"0 0% 98.5%",primary:"0 0% 92.2%","primary-foreground":"0 0% 20.5%",secondary:"0 0% 26.9%","secondary-foreground":"0 0% 98.5%",muted:"0 0% 26.9%","muted-foreground":"0 0% 70.8%",accent:"0 0% 26.9%","accent-foreground":"0 0% 98.5%",destructive:"0 62.8% 30.6%","destructive-foreground":"0 0% 98.5%",border:"0 0% 100% / 10%",input:"0 0% 100% / 15%",ring:"0 0% 55.6%"},red:{radius:"0.65rem",background:"0 0% 3.9%",foreground:"0 0% 98%",card:"0 0% 3.9%","card-foreground":"0 0% 98%",popover:"0 0% 3.9%","popover-foreground":"0 0% 98%",primary:"0 72.2% 50.6%","primary-foreground":"0 85.7% 97.3%",secondary:"0 0% 14.9%","secondary-foreground":"0 0% 98%",muted:"0 0% 14.9%","muted-foreground":"0 0% 63.9%",accent:"0 0% 14.9%","accent-foreground":"0 0% 98%",destructive:"0 62.8% 30.6%","destructive-foreground":"0 0% 98%",border:"0 0% 14.9%",input:"0 0% 14.9%",ring:"0 72.2% 50.6%"},blue:{radius:"0.65rem",background:"222.2 84% 4.9%",foreground:"210 40% 98%",card:"222.2 84% 4.9%","card-foreground":"210 40% 98%",popover:"222.2 84% 4.9%","popover-foreground":"210 40% 98%",primary:"217.2 91.2% 59.8%","primary-foreground":"222.2 47.4% 11.2%",secondary:"217.2 32.6% 17.5%","secondary-foreground":"210 40% 98%",muted:"217.2 32.6% 17.5%","muted-foreground":"215 20.2% 65.1%",accent:"217.2 32.6% 17.5%","accent-foreground":"210 40% 98%",destructive:"0 62.8% 30.6%","destructive-foreground":"210 40% 98%",border:"217.2 32.6% 17.5%",input:"217.2 32.6% 17.5%",ring:"224.3 76.3% 48%"},green:{radius:"0.65rem",background:"20 14.3% 4.1%",foreground:"0 0% 95%",card:"24 9.8% 10%","card-foreground":"0 0% 95%",popover:"0 0% 9%","popover-foreground":"0 0% 95%",primary:"142.1 70.6% 45.3%","primary-foreground":"144.9 80.4% 10%",secondary:"240 3.7% 15.9%","secondary-foreground":"0 0% 98%",muted:"0 0% 15%","muted-foreground":"240 5% 64.9%",accent:"12 6.5% 15.1%","accent-foreground":"0 0% 98%",destructive:"0 62.8% 30.6%","destructive-foreground":"0 85.7% 97.3%",border:"240 3.7% 15.9%",input:"240 3.7% 15.9%",ring:"142.4 71.8% 29.2%"},orange:{radius:"0.65rem",background:"20 14.3% 4.1%",foreground:"60 9.1% 97.8%",card:"20 14.3% 4.1%","card-foreground":"60 9.1% 97.8%",popover:"20 14.3% 4.1%","popover-foreground":"60 9.1% 97.8%",primary:"20.5 90.2% 48.2%","primary-foreground":"60 9.1% 97.8%",secondary:"12 6.5% 15.1%","secondary-foreground":"60 9.1% 97.8%",muted:"12 6.5% 15.1%","muted-foreground":"24 5.4% 63.9%",accent:"12 6.5% 15.1%","accent-foreground":"60 9.1% 97.8%",destructive:"0 72.2% 50.6%","destructive-foreground":"60 9.1% 97.8%",border:"12 6.5% 15.1%",input:"12 6.5% 15.1%",ring:"20.5 90.2% 48.2%"},rose:{radius:"0.65rem",background:"20 14.3% 4.1%",foreground:"0 0% 95%",card:"24 9.8% 10%","card-foreground":"0 0% 95%",popover:"0 0% 9%","popover-foreground":"0 0% 95%",primary:"346.8 77.2% 49.8%","primary-foreground":"355.7 100% 97.3%",secondary:"240 3.7% 15.9%","secondary-foreground":"0 0% 98%",muted:"0 0% 15%","muted-foreground":"240 5% 64.9%",accent:"12 6.5% 15.1%","accent-foreground":"0 0% 98%",destructive:"0 62.8% 30.6%","destructive-foreground":"0 85.7% 97.3%",border:"240 3.7% 15.9%",input:"240 3.7% 15.9%",ring:"346.8 77.2% 49.8%"},violet:{radius:"0.65rem",background:"224 71.4% 4.1%",foreground:"210 20% 98%",card:"224 71.4% 4.1%","card-foreground":"210 20% 98%",popover:"224 71.4% 4.1%","popover-foreground":"210 20% 98%",primary:"263.4 70% 50.4%","primary-foreground":"210 20% 98%",secondary:"215 27.9% 16.9%","secondary-foreground":"210 20% 98%",muted:"215 27.9% 16.9%","muted-foreground":"217.9 10.6% 64.9%",accent:"215 27.9% 16.9%","accent-foreground":"210 20% 98%",destructive:"0 62.8% 30.6%","destructive-foreground":"210 20% 98%",border:"215 27.9% 16.9%",input:"215 27.9% 16.9%",ring:"263.4 70% 50.4%"},yellow:{radius:"0.65rem",background:"20 14.3% 4.1%",foreground:"60 9.1% 97.8%",card:"20 14.3% 4.1%","card-foreground":"60 9.1% 97.8%",popover:"20 14.3% 4.1%","popover-foreground":"60 9.1% 97.8%",primary:"47.9 95.8% 53.1%","primary-foreground":"26 83.3% 14.1%",secondary:"12 6.5% 15.1%","secondary-foreground":"60 9.1% 97.8%",muted:"12 6.5% 15.1%","muted-foreground":"24 5.4% 63.9%",accent:"12 6.5% 15.1%","accent-foreground":"60 9.1% 97.8%",destructive:"0 62.8% 30.6%","destructive-foreground":"60 9.1% 97.8%",border:"12 6.5% 15.1%",input:"12 6.5% 15.1%",ring:"35.5 91.7% 32.9%"}}},d=o.y({theme:"light",color:"default",borderRadius:"0.65rem"});function c(){const{theme:r,color:e,borderRadius:u}=o.b(d);return{theme:r,color:e,borderRadius:u}}const t={setTheme:r=>{o.v(d).setValue(e=>({...e,theme:r}))},setColor:r=>{o.v(d).setValue(e=>({...e,color:r}))},setBorderRadius:r=>{o.v(d).setValue(e=>({...e,borderRadius:r}))}};exports.THEME=n;exports.themeActions=t;exports.useTheme=c;
package/lib/theme.js CHANGED
@@ -180,25 +180,25 @@ const t = {
180
180
  dark: {
181
181
  default: {
182
182
  radius: "0.65rem",
183
- background: "222 18% 13%",
184
- foreground: "210 20% 94%",
185
- card: "222 16% 15%",
186
- "card-foreground": "210 20% 94%",
187
- popover: "222 16% 16%",
188
- "popover-foreground": "210 20% 94%",
189
- primary: "210 20% 96%",
190
- "primary-foreground": "222 18% 13%",
191
- secondary: "222 13% 21%",
192
- "secondary-foreground": "210 20% 94%",
193
- muted: "222 13% 21%",
194
- "muted-foreground": "215 14% 68%",
195
- accent: "222 13% 23%",
196
- "accent-foreground": "210 20% 96%",
183
+ background: "0 0% 12.9%",
184
+ foreground: "0 0% 98.5%",
185
+ card: "0 0% 12.9%",
186
+ "card-foreground": "0 0% 98.5%",
187
+ popover: "0 0% 12.9%",
188
+ "popover-foreground": "0 0% 98.5%",
189
+ primary: "0 0% 92.2%",
190
+ "primary-foreground": "0 0% 20.5%",
191
+ secondary: "0 0% 26.9%",
192
+ "secondary-foreground": "0 0% 98.5%",
193
+ muted: "0 0% 26.9%",
194
+ "muted-foreground": "0 0% 70.8%",
195
+ accent: "0 0% 26.9%",
196
+ "accent-foreground": "0 0% 98.5%",
197
197
  destructive: "0 62.8% 30.6%",
198
- "destructive-foreground": "210 20% 96%",
199
- border: "222 13% 28%",
200
- input: "222 13% 28%",
201
- ring: "215 14% 68%"
198
+ "destructive-foreground": "0 0% 98.5%",
199
+ border: "0 0% 100% / 10%",
200
+ input: "0 0% 100% / 15%",
201
+ ring: "0 0% 55.6%"
202
202
  },
203
203
  red: {
204
204
  radius: "0.65rem",
@@ -1,5 +1,5 @@
1
- import { c as a, s as n, f as l } from "./index-C8FjP66D.js";
2
- import { d as p } from "./clsx-m_C5j3RU.js";
1
+ import { c as a, s as n, f as l } from "./index-D4M4hrH4.js";
2
+ import { d as p } from "./clsx-BUPZHhq3.js";
3
3
  function m(o, t) {
4
4
  a({
5
5
  getBoundingClientRect: () => p(o.view, o.state.selection.from, o.state.selection.to)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remarkablejames/editor",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "A modern WYSIWYG rich text editor based on tiptap and shadcn ui for React",
5
5
  "keywords": [
6
6
  "editor",
@@ -1 +0,0 @@
1
- "use strict";const e=require("react/jsx-runtime"),a=require("@radix-ui/react-slot"),s=require("react"),i=require("./useButtonProps-D9ndBdmA.cjs"),d=require("./button-B4Sz2ZhW.cjs"),u=require("./index-BXh8X1ch.cjs"),m=s.forwardRef(({asChild:h=!1,tooltip:c,...t},l)=>{var x;const n=u.icons[t.icon],r=h?a.Slot:d.Button;return e.jsxs(i.Tooltip,{children:[e.jsx(i.TooltipTrigger,{asChild:!0,children:e.jsx(r,{className:"richtext-h-[32px] richtext-min-w-24 richtext-overflow-hidden richtext-px-[5px] richtext-py-0","data-state":t!=null&&t.dataState?"on":"off",disabled:t==null?void 0:t.disabled,ref:l,variant:"ghost",...t,children:e.jsxs("div",{className:"richtext-flex richtext-h-full richtext-items-center richtext-font-normal",children:[(t==null?void 0:t.title)&&e.jsx("div",{className:"richtext-grow richtext-truncate richtext-text-left richtext-text-sm",children:t==null?void 0:t.title}),n&&e.jsx(n,{className:"richtext-ml-1 richtext-size-3 richtext-shrink-0 richtext-text-zinc-500"})]})})}),c&&e.jsx(i.TooltipContent,{children:e.jsxs("div",{className:"richtext-flex richtext-max-w-24 richtext-flex-col richtext-items-center richtext-text-center",children:[c&&e.jsx("div",{children:c}),e.jsx("div",{className:"richtext-flex",children:!!((x=t==null?void 0:t.shortcutKeys)!=null&&x.length)&&e.jsx("span",{children:i.getShortcutKeys(t==null?void 0:t.shortcutKeys)})})]})})]})});exports.ActionMenuButton=m;
@@ -1,2 +0,0 @@
1
- "use strict";const I=require("./clsx-CXbNJWDD.cjs"),$=require("./throttle-gTTvqDTW.cjs"),e=require("react/jsx-runtime"),g=require("react"),B=require("./index-DgOXAdKt.cjs"),O=require("./useButtonProps-D9ndBdmA.cjs"),m=require("easydrawer"),re=require("./toggle-C9tcMm1r.cjs"),P=require("./dialog-C8J59d2J.cjs"),p=require("./index-BXh8X1ch.cjs"),oe=require("./file-i7e4nQY2.cjs"),le=require("./button-B4Sz2ZhW.cjs"),W={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function ne({editor:t,node:r,updateAttributes:o,getPos:n,selected:v}){const[j,S]=g.useState({width:B.IMAGE_MAX_SIZE,height:B.IMAGE_MAX_SIZE}),[u,a]=g.useState({width:0,height:0}),[M]=g.useState([W.TOP_LEFT,W.TOP_RIGHT,W.BOTTOM_LEFT,W.BOTTOM_RIGHT]),[b,_]=g.useState(!1),[c,h]=g.useState({x:0,y:0,w:0,h:0,dir:""}),{align:T}=r==null?void 0:r.attrs,f=g.useMemo(()=>{const{src:d,alt:E,width:H,height:k}=r==null?void 0:r.attrs,A=I.isNumber(H)?`${H}px`:H,C=I.isNumber(k)?`${k}px`:k;return{src:d||void 0,alt:E||void 0,style:{width:A||void 0,height:C||void 0}}},[r==null?void 0:r.attrs]),s=g.useMemo(()=>{const{style:{width:d}}=f;return{width:d==="100%"?d:void 0}},[f]);function V(d){a({width:d.target.width,height:d.target.height})}const z=g.useCallback(()=>{t.commands.setNodeSelection(n())},[]),D=g.useCallback($.throttle(()=>{const{width:d}=getComputedStyle(t.view.dom);S(E=>({...E,width:Number.parseInt(d,10)}))},B.IMAGE_THROTTLE_WAIT_TIME),[t]);function G(d,E){d.preventDefault(),d.stopPropagation();const H=u.width,k=u.height,A=H/k;let C=Number(r.attrs.width),N=Number(r.attrs.height);const y=j.width;C&&!N?(C=C>y?y:C,N=Math.round(C/A)):N&&!C?(C=Math.round(N*A),C=C>y?y:C):!C&&!N?(C=H>y?y:H,N=Math.round(C/A)):C=C>y?y:C,_(!0),h({x:d.clientX,y:d.clientY,w:C,h:N,dir:E})}const x=g.useCallback($.throttle(d=>{if(d.preventDefault(),d.stopPropagation(),!b)return;const{x:E,w:H,dir:k}=c,A=(d.clientX-E)*(/l/.test(k)?-1:1),{width:C,height:N}=r==null?void 0:r.attrs,y=C/N,Z=O.clamp(H+A,B.IMAGE_MIN_SIZE,j.width),te=Math.round(Z/y);o({width:Z,height:te})},B.IMAGE_THROTTLE_WAIT_TIME),[b,c,j,o,r==null?void 0:r.attrs]),i=g.useCallback(d=>{d.preventDefault(),d.stopPropagation(),b&&(h({x:0,y:0,w:0,h:0,dir:""}),_(!1),z())},[b,z]),w=g.useCallback(()=>{document==null||document.addEventListener("mousemove",x,!0),document==null||document.addEventListener("mouseup",i,!0)},[x,i]),L=g.useCallback(()=>{document==null||document.removeEventListener("mousemove",x,!0),document==null||document.removeEventListener("mouseup",i,!0)},[x,i]);g.useEffect(()=>(b?w():L(),()=>{L()}),[b,w,L]);const q=g.useMemo(()=>new ResizeObserver(()=>D()),[D]);return g.useEffect(()=>(q.observe(t.view.dom),()=>{q.disconnect()}),[t.view.dom,q]),e.jsx(I.NodeViewWrapper,{className:"image-view",style:{...s,width:"100%",textAlign:T},children:e.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:{...s,background:"#fff"},className:`image-view__body ${v?"image-view__body--focused":""} ${b?"image-view__body--resizing":""}`,children:[e.jsx("img",{alt:f.alt,className:"image-view__body__image block",height:"auto",onClick:z,onLoad:V,src:f.src,style:f.style}),t.view.editable&&(v||b)&&e.jsx("div",{className:"image-resizer",children:M==null?void 0:M.map(d=>e.jsx("span",{className:`image-resizer__handler image-resizer__handler--${d}`,onMouseDown:E=>G(E,d)},`image-dir-${d}`))})]})})}const F="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",se=t=>{t=t.replace(/\r\n/g,`
2
- `);let r=0,o="";for(;r<t.length;r++){const n=t.charCodeAt(r);n<128?o+=String.fromCharCode(n):n>127&&n<2048?(o+=String.fromCharCode(n>>6|192),o+=String.fromCharCode(63&n|128)):(o+=String.fromCharCode(n>>12|224),o+=String.fromCharCode(n>>6&63|128),o+=String.fromCharCode(63&n|128))}return o},ie=t=>{let r,o,n,v,j,S,u,a=0,M="";for(t=se(t);a<t.length;)r=t.charCodeAt(a++),o=t.charCodeAt(a++),n=t.charCodeAt(a++),v=r>>2,j=(3&r)<<4|o>>4,S=(15&o)<<2|n>>6,u=63&n,isNaN(o)?S=u=64:isNaN(n)&&(u=64),M=M+F.charAt(v)+F.charAt(j)+F.charAt(S)+F.charAt(u);return M},ae=t=>typeof t=="string"?"string":typeof SVGElement<"u"&&t instanceof SVGElement?"element":void 0,K=t=>"data:image/svg+xml;base64,"+ie(t),ce=t=>K(new XMLSerializer().serializeToString(t)),Q=t=>{switch(ae(t)){case"string":return K(t);case"element":return ce(t);default:return t}};function he(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{color:"currentColor",d:"M2 9.2v3.6M12.8 2H9.2M7.5 20H9M20 7.5V9M2.133 4.699c.155-.727.415-1.274.854-1.712c.426-.426.954-.684 1.652-.84m15.228 2.552c-.155-.727-.415-1.274-.854-1.712c-.417-.417-.932-.673-1.608-.83M4.64 19.853c-.698-.156-1.226-.414-1.652-.84c-.43-.43-.69-.965-.845-1.673m11.638 3.626c-1.812.125-3.607-8.326-2.374-9.559s9.684.561 9.559 2.373c-.087 1.187-2.095 1.656-2.037 2.711c.018.309.408.59 1.188 1.154c.543.39 1.096.77 1.629 1.175a.66.66 0 0 1 .234.687a3.35 3.35 0 0 1-2.472 2.473a.66.66 0 0 1-.688-.235c-.404-.533-.784-1.086-1.175-1.628c-.563-.78-.844-1.17-1.153-1.188c-1.055-.059-1.524 1.95-2.71 2.037",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})})}function ue(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M20.06 18a4 4 0 0 1-.2-.89c-.67.7-1.48 1.05-2.41 1.05c-.83 0-1.52-.24-2.05-.71c-.53-.45-.8-1.06-.8-1.79c0-.88.33-1.56 1-2.05s1.61-.73 2.83-.73h1.4v-.64q0-.735-.45-1.17c-.3-.29-.75-.43-1.33-.43c-.52 0-.95.12-1.3.36c-.35.25-.52.54-.52.89h-1.46c0-.43.15-.84.45-1.24c.28-.4.71-.71 1.22-.94c.51-.21 1.06-.35 1.69-.35c.98 0 1.74.24 2.29.73s.84 1.16.86 2.02V16c0 .8.1 1.42.3 1.88V18zm-2.4-1.12c.45 0 .88-.11 1.29-.32c.4-.21.7-.49.88-.83v-1.57H18.7c-1.77 0-2.66.47-2.66 1.41c0 .43.15.73.46.96c.3.23.68.35 1.16.35m-12.2-3.17h4.07L7.5 8.29zM6.64 6h1.72l4.71 12h-1.93l-.97-2.57H4.82L3.86 18H1.93z",fill:"currentColor"})})}function de(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M3 21v-4.25L16.2 3.575q.3-.275.663-.425t.762-.15t.775.15t.65.45L20.425 5q.3.275.438.65T21 6.4q0 .4-.137.763t-.438.662L7.25 21zM17.6 7.8L19 6.4L17.6 5l-1.4 1.4z",fill:"currentColor"})})}function ge(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 256 256",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M253.66 106.34a8 8 0 0 0-11.32 0L192 156.69L107.31 72l50.35-50.34a8 8 0 1 0-11.32-11.32L96 60.69a16 16 0 0 0-2.82 18.81L72 100.69a16 16 0 0 0 0 22.62l4.69 4.69l-58.35 58.34a8 8 0 0 0 3.13 13.25l72 24A7.9 7.9 0 0 0 96 224a8 8 0 0 0 5.66-2.34L136 187.31l4.69 4.69a16 16 0 0 0 22.62 0l21.19-21.18a16 16 0 0 0 18.81-2.82l50.35-50.34a8 8 0 0 0 0-11.32M93.84 206.85l-55-18.35L88 139.31L124.69 176ZM152 180.69L83.31 112L104 91.31L172.69 160Z",fill:"currentColor"})})}function me(t){return e.jsxs("svg",{height:"1em",viewBox:"0 0 16 16",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:[e.jsx("path",{d:"m2.648 9.937l7.29-7.288a2.21 2.21 0 0 1 3.124 0l2.29 2.288a2.21 2.21 0 0 1 0 3.126L10.413 13H12.5a.5.5 0 0 1 0 1H4.501a2.2 2.2 0 0 1-1.563-.647l.707-.707c.227.226.535.354.856.354h4.005a1.2 1.2 0 0 0 .848-.354l1.292-1.293l-4-4l-3.29 3.291a1.21 1.21 0 0 0 0 1.712l.29.29l-.708.707l-.29-.29a2.21 2.21 0 0 1 0-3.126M8 6h6.89a1.2 1.2 0 0 0-.246-.356L14 5H9zm2-2h3l-.645-.644a1.21 1.21 0 0 0-1.71 0zm4.89 3H7.708l1 1H14l.644-.644A1.2 1.2 0 0 0 14.891 7zM9.708 9l1.646 1.646L13 9z",fill:"currentColor"}),e.jsx("path",{d:"M14 11.5a.5.5 0 1 1-1 0a.5.5 0 0 1 1 0m1.5-.5a.5.5 0 1 0 0-1a.5.5 0 0 0 0 1m-1 2a.5.5 0 0 0 0 1h1a.5.5 0 0 0 0-1z",fill:"currentColor"})]})}function pe(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M3 3h18v18H3zm2 2v14h14V5z",fill:"currentColor"})})}function xe(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M2 20V4h20v16zm2-2h16V6H4zm0 0V6z",fill:"currentColor"})})}function we(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M12 22q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9T2 12t.788-3.9t2.137-3.175T8.1 2.788T12 2t3.9.788t3.175 2.137T21.213 8.1T22 12t-.788 3.9t-2.137 3.175t-3.175 2.138T12 22m0-2q3.35 0 5.675-2.325T20 12t-2.325-5.675T12 4T6.325 6.325T4 12t2.325 5.675T12 20m0-8",fill:"currentColor"})})}function ve(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M10.363 3.591L2.257 17.125a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636-2.87L13.637 3.59a1.914 1.914 0 0 0-3.274 0z",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})})}function Ce(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"m6.8 21l-5.2-9l5.2-9h10.4l5.2 9l-5.2 9zm1.15-2h8.1l4.025-7l-4.025-7h-8.1L3.9 12zM12 12",fill:"currentColor"})})}function fe(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsxs("g",{fill:"none",fillRule:"evenodd",children:[e.jsx("path",{d:"m12.594 23.258l-.012.002l-.071.035l-.02.004l-.014-.004l-.071-.036q-.016-.004-.024.006l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.016-.018m.264-.113l-.014.002l-.184.093l-.01.01l-.003.011l.018.43l.005.012l.008.008l.201.092q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.003-.011l.018-.43l-.003-.012l-.01-.01z"}),e.jsx("path",{d:"M10.586 2.807a2 2 0 0 1 2.828 0l7.778 7.779a2 2 0 0 1 0 2.828l-7.778 7.778a2 2 0 0 1-2.828 0l-7.778-7.778a2 2 0 0 1 0-2.828zM12 4.222L4.222 12L12 19.778L19.778 12z",fill:"currentColor"})]})})}function Te(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M16.01 11H4v2h12.01v3L20 12l-3.99-4z",fill:"currentColor"})})}function je(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{clipRule:"evenodd",d:"M7.53 3.47a.75.75 0 0 1 0 1.06L5.81 6.25H15a5.75 5.75 0 0 1 0 11.5H8a.75.75 0 0 1 0-1.5h7a4.25 4.25 0 0 0 0-8.5H5.81l1.72 1.72a.75.75 0 1 1-1.06 1.06l-3-3a.75.75 0 0 1 0-1.06l3-3a.75.75 0 0 1 1.06 0",fill:"currentColor",fillRule:"evenodd"})})}function be(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{clipRule:"evenodd",d:"M16.47 3.47a.75.75 0 0 1 1.06 0l3 3a.75.75 0 0 1 0 1.06l-3 3a.75.75 0 1 1-1.06-1.06l1.72-1.72H9a4.25 4.25 0 0 0 0 8.5h7a.75.75 0 0 1 0 1.5H9a5.75 5.75 0 0 1 0-11.5h9.19l-1.72-1.72a.75.75 0 0 1 0-1.06",fill:"currentColor",fillRule:"evenodd"})})}function Se(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M7 21q-.825 0-1.412-.587T5 19V6H4V4h5V3h6v1h5v2h-1v13q0 .825-.587 1.413T17 21zm2-4h2V8H9zm4 0h2V8h-2z",fill:"currentColor"})})}function Me(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 256 256",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M211.81 83.79a28 28 0 0 1-33.12 4.83l-90.07 90.07a28 28 0 1 1-44.43-6.48a28 28 0 0 1 33.12-4.83l90.07-90.07a28 28 0 1 1 44.43 6.48",fill:"currentColor"})})}function ye(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M12 20.325q-.35 0-.712-.125t-.638-.4l-1.725-1.575q-2.65-2.425-4.788-4.812T2 8.15Q2 5.8 3.575 4.225T7.5 2.65q1.325 0 2.5.562t2 1.538q.825-.975 2-1.537t2.5-.563q2.35 0 3.925 1.575T22 8.15q0 2.875-2.125 5.275T15.05 18.25l-1.7 1.55q-.275.275-.637.4t-.713.125M11.05 6.75q-.725-1.025-1.55-1.563t-2-.537q-1.5 0-2.5 1t-1 2.5q0 1.3.925 2.763t2.213 2.837t2.65 2.575T12 18.3q.85-.775 2.213-1.975t2.65-2.575t2.212-2.837T20 8.15q0-1.5-1-2.5t-2.5-1q-1.175 0-2 .538T12.95 6.75q-.175.25-.425.375T12 7.25t-.525-.125t-.425-.375m.95 4.725",fill:"currentColor"})})}function Ee(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"m7.625 6.4l2.8-3.625q.3-.4.713-.587T12 2t.863.188t.712.587l2.8 3.625l4.25 1.425q.65.2 1.025.738t.375 1.187q0 .3-.088.6t-.287.575l-2.75 3.9l.1 4.1q.025.875-.575 1.475t-1.4.6q-.05 0-.55-.075L12 19.675l-4.475 1.25q-.125.05-.275.063T6.975 21q-.8 0-1.4-.6T5 18.925l.1-4.125l-2.725-3.875q-.2-.275-.288-.575T2 9.75q0-.625.363-1.162t1.012-.763zM8.85 8.125L4 9.725L7.1 14.2L7 18.975l5-1.375l5 1.4l-.1-4.8L20 9.775l-4.85-1.65L12 4zM12 11.5",fill:"currentColor"})})}function He(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M12.01 6c2.61 0 4.89 1.86 5.4 4.43l.3 1.5l1.52.11c1.56.11 2.78 1.41 2.78 2.96c0 1.65-1.35 3-3 3h-13c-2.21 0-4-1.79-4-4c0-2.05 1.53-3.76 3.56-3.97l1.07-.11l.5-.95A5.46 5.46 0 0 1 12.01 6m0-2C9.12 4 6.6 5.64 5.35 8.04C2.35 8.36.01 10.91.01 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5c0-2.64-2.05-4.78-4.64-4.96C18.68 6.59 15.65 4 12.01 4",fill:"currentColor"})})}function Ne(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M5.586 6.45A2 2 0 0 1 7.509 5h11.84a2 2 0 0 1 1.923 2.55l-2.858 10A2 2 0 0 1 16.491 19H4.651a2 2 0 0 1-1.923-2.55z",fill:"none",stroke:"currentColor",strokeWidth:"2"})})}const Le="_wrapper_pva9d_1",ke="_tool_pva9d_17",Ae="_active_pva9d_37",_e="_pen_pva9d_41",ze="_line_pva9d_48",qe="_options_pva9d_56",Be="_colorWrap_pva9d_66",Pe="_color_pva9d_66",Re="_colorActive_pva9d_83",l={wrapper:Le,tool:ke,active:Ae,pen:_e,line:ze,options:qe,colorWrap:Be,color:Pe,colorActive:Re},Ie=[m.Color4.blackHighlight,m.Color4.ofRGBA(166/255,81/255,167/255,.3),m.Color4.ofRGBA(247/255,78/255,158/255,.3),m.Color4.ofRGBA(166/255,83/255,88/255,.3),m.Color4.ofRGBA(246/255,130/255,28/255,.3),m.Color4.ofRGBA(166/255,198/255,0,.3),m.Color4.ofRGBA(98/255,186/255,70/255,.3)],X=[m.Color4.black,m.Color4.fromHex("#007AFF"),m.Color4.fromHex("#A651A7"),m.Color4.fromHex("#F74E9E"),m.Color4.fromHex("#FF5358"),m.Color4.fromHex("#F6821C"),m.Color4.fromHex("#FFC600"),m.Color4.fromHex("#62BA46"),m.Color4.fromHex("#E6BFE8"),m.Color4.fromHex("#FEA3D2"),m.Color4.fromHex("#FFA0A3"),m.Color4.fromHex("#FBC276"),m.Color4.fromHex("#FFFB85"),m.Color4.fromHex("#AADC99")];function De({onChange:t}){const[r,o]=g.useState(m.Color4.blackHighlight);return e.jsx("div",{className:l.colorWrap,children:Ie.map((n,v)=>e.jsx("button",{style:{backgroundColor:n.toHexString()},className:p.cn(l.color,{[l.colorActive]:r.toHexString()===n.toHexString()}),onClick:()=>{o(n),t(n)}},v))})}function U({onChange:t}){const[r,o]=g.useState(m.Color4.black);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:l.colorWrap,children:X.slice(0,7).map((n,v)=>e.jsx("button",{style:{backgroundColor:n.toHexString()},className:p.cn(l.color,{[l.colorActive]:r.toHexString()===n.toHexString()}),onClick:()=>{o(n),t(n)}},v))}),e.jsx("div",{className:l.colorWrap,children:X.slice(7).map((n,v)=>e.jsx("button",{style:{backgroundColor:n.toHexString()},className:p.cn(l.color,{[l.colorActive]:r.toHexString()===n.toHexString()}),onClick:()=>{o(n),t(n)}},v))})]})}function We({setColorPen:t,setThicknessPen:r}){const[o,n]=g.useState(2);return e.jsxs("div",{className:l.options,children:[e.jsx("div",{children:e.jsx(U,{onChange:v=>t(v)})}),e.jsx("div",{className:l.line}),e.jsx("div",{children:e.jsx("input",{max:10,min:1,step:.1,type:"range",value:o,onChange:v=>{r(Number.parseFloat(v.target.value)),n(Number.parseFloat(v.target.value))}})})]})}function Fe({setColorHighlight:t}){return e.jsx("div",{className:l.options,children:e.jsx(De,{onChange:r=>t(r)})})}function Oe({changeColorShape:t,changeBorderColorShape:r,onThicknessChange:o}){return e.jsxs("div",{className:l.options,children:[e.jsx("div",{children:e.jsx(U,{onChange:n=>t(n)})}),e.jsx("div",{className:l.line}),e.jsx("div",{children:e.jsx(U,{onChange:n=>r(n)})}),e.jsx("div",{className:l.line}),e.jsx("div",{children:e.jsx("input",{defaultValue:0,max:20,min:0,step:1,type:"range",onChange:n=>{o(Number.parseFloat(n.target.value))}})})]})}function Y(t){const{setColorPen:r,refEditor:o,setThicknessPen:n,setColorHighlight:v,changeBorderColorShape:j,onUndo:S,changeColorShape:u,changeShape:a,onThicknessChange:M,onRedo:b,onClear:_}=t,[c,h]=g.useState(null),[T,f]=g.useState(0);return e.jsx(e.Fragment,{children:e.jsxs("div",{className:l.wrapper,children:[e.jsxs("div",{className:l.pen,children:[e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="select"}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();if(c==="select"){h(null),s[0].setEnabled(!1);return}h("select"),s[0].setEnabled(!0)},children:e.jsx(he,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="text"}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();if(o.current.toolController.setToolEnabled(s[1]),c==="text"){s[1].setEnabled(!1),h(null);return}h("text"),s[1].setEnabled(!0)},children:e.jsx(ue,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="pencil"}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();if(c==="pencil"){h(null),s[2].setEnabled(!1);return}h("pencil"),s[2].setEnabled(!0)},children:e.jsx(de,{})}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="highlighter"}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();if(c==="highlighter"){h(null),s[3].setEnabled(!1);return}h("highlighter"),s[3].setEnabled(!0)},children:e.jsx(ge,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="eraser"}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();if(c==="eraser"){h(null),s[4].setEnabled(!1);return}h("eraser"),s[4].setEnabled(!0)},children:e.jsx(me,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="shapes"&&T===0}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();o.current.toolController.setToolEnabled(s[5]),h("shapes"),s[5].setEnabled(!0),a(0),f(0)},children:e.jsx(pe,{})}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="shapes"&&T===1}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();o.current.toolController.setToolEnabled(s[5]),h("shapes"),s[5].setEnabled(!0),a(1),f(1)},children:e.jsx(xe,{})}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="shapes"&&T===2}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();o.current.toolController.setToolEnabled(s[5]),h("shapes"),s[5].setEnabled(!0),a(2),f(2)},children:e.jsx(we,{})}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="shapes"&&T===3}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();o.current.toolController.setToolEnabled(s[5]),h("shapes"),s[5].setEnabled(!0),a(3),f(3)},children:e.jsx(ve,{})}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="shapes"&&T===4}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();o.current.toolController.setToolEnabled(s[5]),h("shapes"),s[5].setEnabled(!0),a(4),f(4)},children:e.jsx(Ce,{})}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="shapes"&&T===5}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();o.current.toolController.setToolEnabled(s[5]),h("shapes"),s[5].setEnabled(!0),a(5),f(5)},children:e.jsx(fe,{})}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="shapes"&&T===6}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();o.current.toolController.setToolEnabled(s[5]),h("shapes"),s[5].setEnabled(!0),a(6),f(6)},children:e.jsx(Te,{})}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="shapes"&&T===7}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();o.current.toolController.setToolEnabled(s[5]),h("shapes"),s[5].setEnabled(!0),a(7),f(7)},children:e.jsx(Me,{})}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="shapes"&&T===8}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();o.current.toolController.setToolEnabled(s[5]),h("shapes"),s[5].setEnabled(!0),a(8),f(8)},children:e.jsx(ye,{})}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="shapes"&&T===9}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();o.current.toolController.setToolEnabled(s[5]),h("shapes"),s[5].setEnabled(!0),a(9),f(9)},children:e.jsx(Ee,{})}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="shapes"&&T===10}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();o.current.toolController.setToolEnabled(s[5]),h("shapes"),s[5].setEnabled(!0),a(10),f(10)},children:e.jsx(He,{})}),e.jsx("button",{className:p.cn(l.tool,{[l.active]:c==="shapes"&&T===11}),onClick:()=>{const s=o.current.toolController.getPrimaryTools();o.current.toolController.setToolEnabled(s[5]),h("shapes"),s[5].setEnabled(!0),a(11),f(11)},children:e.jsx(Ne,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:p.cn(l.tool),onClick:S,children:e.jsx(je,{})}),e.jsx("button",{className:p.cn(l.tool),onClick:b,children:e.jsx(be,{})}),e.jsx("button",{className:p.cn(l.tool),onClick:_,children:e.jsx(Se,{})})]}),e.jsxs("div",{className:l.optionsWrap,children:[c==="pencil"&&e.jsx(We,{setColorPen:r,setThicknessPen:n}),c==="highlighter"&&e.jsx(Fe,{setColorHighlight:v}),c==="shapes"&&e.jsx(Oe,{changeBorderColorShape:j,changeColorShape:u,changeShape:a,onThicknessChange:M})]})]})})}function J(t=8){return Math.random().toString(36).substring(2,t+2)}let R=!1;function Ve(){const t=O.useEditorInstance(),r=O.useButtonProps(ee.name),{isActive:o=void 0,upload:n}=(r==null?void 0:r.componentProps)??{},{editorDisabled:v}=O.useToggleActive(o),[j,S]=g.useState(!1),u=g.useRef(null),a=g.useRef(null),M=()=>{(async()=>{const i=document.querySelector("#easydrawer");i&&(u.current=new m.Editor(i,{wheelEventsEnabled:!1,disableZoom:!0}),a.current=m.makeDropdownToolbar(u.current),a.current.addDefaultToolWidgets())})()};g.useEffect(()=>{j&&setTimeout(()=>{M()},200)},[j]);const b=async()=>{if(u.current){const x=u.current.toSVG(),i=x.outerHTML,w=`drawer-${J()}.svg`;let L=Q(x.outerHTML);if(n){const q=oe.dataURLtoFile(L,w);L=await n(q)}t==null||t.chain().focus().setDrawer({type:"drawer",src:L,alt:encodeURIComponent(i),width:426,height:212},!!i).run()}S(!1)},_=x=>{const i=u.current.toolController.getPrimaryTools()[2],w=a.current.getWidgetById("pen-1");i&&w&&(i.setColor(x),w.serializeState())},c=x=>{const i=u.current.toolController.getPrimaryTools()[2],w=a.current.getWidgetById("pen-1");i&&w&&(i.setThickness(x),w.serializeState())},h=x=>{const i=u.current.toolController.getPrimaryTools()[3],w=a.current.getWidgetById("pen-2");i&&w&&(i.setColor(x),w.serializeState())},T=x=>{const i=a.current.getWidgetById("shape");i&&i.setShapeType(x)},f=x=>{const i=u.current.toolController.getPrimaryTools()[5],w=a.current.getWidgetById("shape");i&&w&&(i.setColor(x),w.serializeState())},s=x=>{const i=u.current.toolController.getPrimaryTools()[5],w=a.current.getWidgetById("shape");i&&w&&(i.setThickness(x),w.serializeState())},V=x=>{const i=u.current.toolController.getPrimaryTools()[5],w=a.current.getWidgetById("shape");i&&w&&(i.setBorderColor(x),w.serializeState())},z=()=>{if(R){for(;u.current.history.redoStackSize>0;)u.current.history.redo();R=!1;return}u.current.history.undo()},D=()=>{R||u.current.history.redo()},G=()=>{if(!R){for(;u.current.history.undoStackSize>0;)z();R=!0}};return r?e.jsxs(P.Dialog,{onOpenChange:S,open:j,children:[e.jsx(P.DialogTrigger,{asChild:!0,children:e.jsx(re.ActionButton,{disabled:v,action:()=>{v||S(!0)},icon:"PencilRuler",tooltip:"Drawer"})}),e.jsxs(P.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[e.jsx(P.DialogTitle,{children:"Drawer"}),e.jsxs("div",{style:{height:"600px",width:"100%",borderWidth:1,background:"white",position:"relative"},children:[e.jsx("div",{className:"richtext-size-full",id:"easydrawer"}),e.jsx(Y,{changeBorderColorShape:V,changeColorShape:f,changeShape:T,onClear:G,onRedo:D,onThicknessChange:s,onUndo:z,refEditor:u,setColorHighlight:h,setColorPen:_,setThicknessPen:c})]}),e.jsx(P.DialogFooter,{children:e.jsx(le.Button,{onClick:b,type:"button",children:"Save changes"})})]})]}):e.jsx(e.Fragment,{})}const ee=$.index_default.extend({name:"richTextDrawer",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),inline:!1,content:"",marks:"",group:"block",draggable:!1,selectable:!0,atom:!0,HTMLAttributes:{class:"drawer"},button:({t:r,extension:o})=>{var n;return{componentProps:{action:()=>!0,isActive:()=>!1,disabled:!1,icon:"PencilRuler",tooltip:r("editor.drawer.tooltip"),upload:(n=o==null?void 0:o.options)==null?void 0:n.upload}}}}},addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),width:{default:null,parseHTML:r=>{const o=r.querySelector("img"),n=o==null?void 0:o.getAttribute("width");return n?Number.parseInt(n,10):320},renderHTML:r=>({width:r.width})},height:{default:null,parseHTML:r=>{const o=r.querySelector("img"),n=o==null?void 0:o.getAttribute("height");return n?Number.parseInt(n,10):212},renderHTML:r=>({height:r.height})},align:{default:"center",parseHTML:r=>r.getAttribute("align"),renderHTML:r=>({align:r.align})}}},addNodeView(){return I.ReactNodeViewRenderer(ne)},addCommands(){return{setDrawer:(t,r)=>({commands:o,editor:n})=>r?o.insertContent({type:this.name,attrs:t}):o.insertContentAt(n.state.selection.anchor,{type:this.name,attrs:t}),setAlignImageDrawer:t=>({commands:r})=>r.updateAttributes(this.name,{align:t})}},renderHTML({HTMLAttributes:t}){const{align:r}=t;return["div",{style:r?`text-align: ${r};`:"",class:"imageDrawer"},["img",I.mergeAttributes(this.options.HTMLAttributes,t)]]},parseHTML(){return[{tag:"div[class=imageDrawer]",getAttrs:t=>{const r=t.querySelector("img"),o=r==null?void 0:r.getAttribute("width"),n=r==null?void 0:r.getAttribute("height");return{src:r==null?void 0:r.getAttribute("src"),alt:r==null?void 0:r.getAttribute("alt"),width:o?Number.parseInt(o,10):null,height:n?Number.parseInt(n,10):null,align:(r==null?void 0:r.getAttribute("align"))||t.style.textAlign||null}}}]}});exports.ControlDrawer=Y;exports.Drawer=ee;exports.RichTextDrawer=Ve;exports.i=Q;exports.shortId=J;
@@ -1,15 +0,0 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { i } from "./index-jMN4V2hr.js";
3
- function a(n) {
4
- const c = i[n.name];
5
- return c ? /* @__PURE__ */ t(
6
- c,
7
- {
8
- onClick: n == null ? void 0 : n.onClick,
9
- className: `richtext-h-4 richtext-w-4 ${(n == null ? void 0 : n.className) || ""}`
10
- }
11
- ) : null;
12
- }
13
- export {
14
- a as I
15
- };
@@ -1 +0,0 @@
1
- "use strict";const e=require("react/jsx-runtime"),t=require("./index-BXh8X1ch.cjs");function i(n){const c=t.icons[n.name];return c?e.jsx(c,{onClick:n==null?void 0:n.onClick,className:`richtext-h-4 richtext-w-4 ${(n==null?void 0:n.className)||""}`}):null}exports.IconComponent=i;
@@ -1 +0,0 @@
1
- "use strict";const u=require("./clsx-CXbNJWDD.cjs"),s=require("react/jsx-runtime"),y=require("re-resizable"),g=require("react"),h=require("./dom-dataset-BqoJhJXt.cjs"),S=require("./toggle-C9tcMm1r.cjs"),f=require("./useButtonProps-D9ndBdmA.cjs"),I=require("./input-DwLo4r7V.cjs"),P=require("./button-B4Sz2ZhW.cjs"),m={youtube:{example:"https://www.youtube.com/watch?v=I4sMhHbHYXM",src:"https://www.youtube.com/embed/I4sMhHbHYXM",srcPrefix:"https://www.youtube.com/embed",linkRule:[/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\s/]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[&?]v=)|youtu\.be\/)([\w-]{11})/]},youku:{example:"https://v.youku.com/v_show/id_XNDM0NDM4MTcy.html?spm=a2h0c.8166622.PhoneSokuUgc_4.dtitle",src:"https://player.youku.com/embed/XNDM0NDM4MTcy",srcPrefix:"https://player.youku.com/embed",linkRule:[String.raw`v.youku.com\/v_show\/id_\w+\=*`],idRule:String.raw`id_\w+\=*`},bilibili:{example:"https://www.bilibili.com/video/BV1EJ411u7DN",src:"https://player.bilibili.com/player.html?bvid=BV1EJ411u7DN",srcPrefix:"https://player.bilibili.com/player.html?bvid",linkRule:[String.raw`www.bilibili.com\/video\/\w+`]},qqvideo:{example:"https://v.qq.com/x/cover/mzc0020006aw1mn/u0033nvzb5v.html",src:"https://v.qq.com/txp/iframe/player.html?vid=u0033nvzb5v",srcPrefix:"https://v.qq.com/txp/iframe/player.html?vid",linkRule:[String.raw`v.qq.com\/x\/cover\/\w+\/\w+`]},amap:{example:"https://ditu.amap.com/",src:"https://www.amap.com/place/B000A45467",srcPrefix:"",linkRule:[String.raw`\.amap\.com`]},baidu_map:{example:"https://j.map.baidu.com/15/fo",src:"https://j.map.baidu.com/15/fo",srcPrefix:"",linkRule:[String.raw`map\.baidu\.com`]},modao:{example:"https://free.modao.cc/app/2cd26580a6717a147454df7470e7ec464093cba3/embed/v2#screen=sk71k6d1dfxulzx",src:"https://free.modao.cc/app/6UkpAxcGE3nPz52GLqhnOZgC7MATBSy/embed/v2",srcPrefix:"",linkRule:[String.raw`https:\/\/\w+.modao.cc\/app\/\w+\/embed\/v2`],tips:"Modao > More > Share > Embed > COPY"},lanhu:{example:"https://lanhuapp.com/link/#/invite?sid=evP7L",src:"https://lanhuapp.com/url/evP7L",srcPrefix:"",linkRule:[String.raw`https:\/\/lanhuapp.com\/url\/\w+`],tips:"Lanhu > Project > Share > Copy Link"},figma:{example:"https://www.figma.com/file/aS9uSgPXoNpaPkzbjNcK8v/Demo?node-id=0%3A1",src:"https://www.figma.com/file/aS9uSgPXoNpaPkzbjNcK8v/Demo?node-id=0%3A1",srcPrefix:"https://www.figma.com/embed?embed_host=share&url",linkRule:[String.raw`https:\/\/www.figma.com\/file\/\w+`]},canva:{example:"https://www.canva.cn/design/DAD61-t29UI/view",src:"https://www.canva.cn/design/DAD61-t29UI/view",srcPrefix:"",linkRule:[String.raw`https:\/\/www.canva.cn\/design\/.+\/view`]},processon:{example:"https://www.processon.com/embed/5ea99d8607912948b0e6fe78",src:"https://www.processon.com/embed/5ea99d8607912948b0e6fe78",srcPrefix:"",linkRule:[String.raw`https:\/\/www.processon.com\/embed\/\w+`]},codepen:{example:"https://codepen.io/mekery/embed/YzyrKOJ",src:"https://codepen.io/mekery/embed/YzyrKOJ",srcPrefix:"",linkRule:[String.raw`https:\/\/codepen.io\/.+\/embed\/\w+`]},jinshuju:{example:"https://jinshuju.net/f/q9YvVf",src:"https://jinshuju.net/f/q9YvVf",srcPrefix:"",linkRule:[String.raw`https:\/\/jinshuju.net\/f\/\w+`]},iframe:{example:"https://v.youku.com/v_show/id_XNDM0NDM4MTcy.html",src:"https://player.youku.com/embed/XNDM0NDM4MTcy",srcPrefix:"",linkRule:[".+"]},googlemaps:{example:"https://goo.gl/maps/8Ys8b4K1ZJY2",src:"https://www.google.com/maps/embed?pb=https://goo.gl/maps/8Ys8b4K1ZJY2",srcPrefix:"",linkRule:[String.raw`https:\/\/goo.gl\/maps\/\w+`]}};function R(e){const t=m.youtube,i=e.matchedUrl;e.validLink=!0;const r=i.split("="),n=r.length;if(n>0){const c=r[n-1];e.src=`${t.srcPrefix}/${c}`,e.validId=!0}return e}function j(e){const t=m.youku,i=e.matchedUrl,r=t.idRule,n=new RegExp(r),c=i.match(n);if(c&&c.length>0){const o=c[0].slice(3);e.validId=!0,e.src=`${t.srcPrefix}/${o}`}else e.validId=!1;return e}function M(e){const t=m.bilibili,r=e.matchedUrl.split("/"),n=r.length;if(n>0){const c=r[n-1];e.src=`${t.srcPrefix}=${c}`,e.validId=!0}return e}function q(e){const t=m.qqvideo,r=e.matchedUrl.split("/"),n=r.length;if(n>0){const c=r[n-1];e.src=`${t.srcPrefix}=${c}`,e.validId=!0}return e}function N(e,t){return t.src=e,t.validId=!0,t}function U(e,t){return t.src=e,t.validId=!0,t}function A(e,t){return t.src=e,t.validId=!0,t.originalLink=e,t}function D(e){return e.src=e.matchedUrl,e.validId=!0,e.originalLink=e.src,e}function L(e){return e.src=e.matchedUrl,e.validId=!0,e.originalLink=e.src,e}function _(e){const t=m.figma;return e.src=`${t.srcPrefix}=${encodeURIComponent(e.matchedUrl)}`,e.validId=!0,e.originalLink=e.matchedUrl,e}function $(e,t){return t.src=`${t.matchedUrl}?embed`,t.validId=!0,t.originalLink=e,t}function T(e,t){return t.src=`${t.matchedUrl}`,t.validId=!0,t.originalLink=e,t}function z(e){return e.src=`${e.matchedUrl}`,e.validId=!0,e.originalLink=e.src,e}function Y(e,t){return t.src=`${t.matchedUrl}?background=white&banner=show&embedded=true`,t.validId=!0,t.originalLink=e,t}function C(e,t){return t.src=`${t.matchedUrl}`,t.validId=!0,t.originalLink=e,t}function E(e,t,i){if(e==="googlemaps")return i.validLink=!0,i.matchedUrl=t,i;const n=m[e].linkRule;for(const c of n){const o=new RegExp(c),a=t.match(o);if(a&&a.length>0)return i.validLink=!0,i.matchedUrl=e==="youtube"?a[1]:a[0],i}return i}function H(e){var i,r;let t="iframe";return((i=e.includes)!=null&&i.call(e,"youtube")||(r=e.includes)!=null&&r.call(e,"youtu.be"))&&(t="youtube"),e.includes("youku")&&(t="youku"),e.includes("bilibili")&&(t="bilibili"),e.includes("qq")&&(t="qqvideo"),e.includes("amap")&&(t="amap"),e.includes("map.baidu")&&(t="baidu_map"),(e.includes("google.com/maps")||e.includes("maps.app.goo.gl"))&&(t="googlemaps"),e.includes("modao")&&(t="modao"),e.includes("lanhuapp")&&(t="lanhu"),e.includes("figma")&&(t="figma"),e.includes("canva")&&(t="canva"),e.includes("processon")&&(t="processon"),e.includes("codepen")&&(t="codepen"),e.includes("jinshuju")&&(t="jinshuju"),e.includes("iframe")&&(t="iframe"),t}function x(e){let t={validLink:!1,validId:!1,matchedUrl:"",originalLink:e,src:""};const i=H(e);if(t=E(i,e,t),!t.validLink)return t;switch(i){case"youtube":return R(t);case"youku":return j(t);case"bilibili":return M(t);case"qqvideo":return q(t);case"amap":return N(e,t);case"baidu_map":return U(e,t);case"googlemaps":return A(e,t);case"modao":return D(t);case"lanhu":return L(t);case"figma":return _(t);case"canva":return $(e,t);case"processon":return T(e,t);case"codepen":return z(t);case"jinshuju":return Y(e,t);case"iframe":return C(e,t);default:return e}}const B="_wrap_5y04w_1",V="_innerWrap_5y04w_15",v={wrap:B,innerWrap:V};function K({editor:e,node:t,updateAttributes:i}){const r=f.useEditableEditor(),{src:n,width:c,height:o}=t.attrs,[a,p]=g.useState("");function l(){if(!a)return;const d=x(a);e.chain().updateAttributes(w.name,{src:(d==null?void 0:d.src)||a}).setNodeSelection(e.state.selection.from).focus().run()}const k=g.useCallback(d=>{i({width:d.width,height:d.height})},[i]);return s.jsxs(u.NodeViewWrapper,{children:[!n&&s.jsxs("div",{className:"richtext-mx-auto richtext-my-[12px] richtext-flex richtext-max-w-[600px] richtext-items-center richtext-justify-center richtext-gap-[10px] richtext-rounded-[12px] richtext-border richtext-border-solid richtext-border-border richtext-p-[10px]",children:[s.jsx(I.Input,{autoFocus:!0,className:"richtext-flex-1",onInput:d=>p(d.target.value),placeholder:"Enter link",type:"url",value:a}),s.jsx(P.Button,{className:"richtext-w-[60px]",onClick:l,children:"OK"})]}),n&&s.jsx(y.Resizable,{size:{width:Number.parseInt(c),height:Number.parseInt(o)},onResizeStop:(d,X,J,b)=>{k({width:Number.parseInt(c)+b.width,height:Number.parseInt(o)+b.height})},children:s.jsx("div",{className:u.clsx(v.wrap,"render-wrapper"),children:s.jsx("div",{className:v.innerWrap,style:{pointerEvents:r?"none":"auto"},children:s.jsx("iframe",{className:"richtext-my-[12px]",src:n})})})})]})}function O(){const e=f.useButtonProps(w.name),{icon:t=void 0,tooltip:i=void 0,shortcutKeys:r=void 0,tooltipOptions:n={},action:c=void 0,isActive:o=void 0}=(e==null?void 0:e.componentProps)??{},{editorDisabled:a,update:p}=f.useToggleActive(o),l=()=>{a||c&&(c(),p())};return e?s.jsx(S.ActionButton,{action:l,disabled:a,icon:t,shortcutKeys:r,tooltip:i,tooltipOptions:n}):s.jsx(s.Fragment,{})}const w=u.Node3.create({name:"iframe",content:"",marks:"",group:"block",selectable:!0,atom:!0,draggable:!0,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"iframe"},button:({editor:t,extension:i,t:r})=>({componentProps:{action:n=>t.commands.setIframe(n),upload:i.options.upload,icon:"Iframe",tooltip:r("editor.iframe.tooltip")}})}},addAttributes(){return{width:{default:600,parseHTML:h.getDatasetAttribute("width")},height:{default:300,parseHTML:h.getDatasetAttribute("height")},src:{default:null,parseHTML:h.getDatasetAttribute("src")},defaultShowPicker:{default:!1},frameborder:{default:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:e}){return["iframe",u.mergeAttributes(this.options.HTMLAttributes,e)]},addCommands(){return{setIframe:e=>({tr:t,commands:i,chain:r})=>{var c,o,a;if(((a=(o=(c=t.selection)==null?void 0:c.node)==null?void 0:o.type)==null?void 0:a.name)==this.name)return i.updateAttributes(this.name,e);const n=e||{url:""};return r().insertContent({type:this.name,attrs:n}).run()}}},addInputRules(){return[u.nodeInputRule({find:/^\$iframe\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]},addNodeView(){return u.ReactNodeViewRenderer(K)}});exports.Iframe=w;exports.RichTextIframe=O;exports.getServiceSrc=x;
@@ -1,10 +0,0 @@
1
- "use strict";const n=require("react/jsx-runtime"),u=require("react"),re=require("react-image-crop"),P=require("./button-B4Sz2ZhW.cjs"),z=require("./dialog-C8J59d2J.cjs"),W=require("./clsx-CXbNJWDD.cjs"),Z=require("./throttle-gTTvqDTW.cjs"),O=require("./index-DgOXAdKt.cjs"),G=require("./isNumber-BTYSVlKo.cjs"),se=require("./toggle-C9tcMm1r.cjs"),B=require("./useButtonProps-D9ndBdmA.cjs"),Q=require("./file-i7e4nQY2.cjs"),V=require("./Icon-wjwoRc9F.cjs"),ne=require("./use-toast-C6zPo25l.cjs"),q=require("./tabs-IEbMQmNX.cjs"),le=require("./checkbox-BCPsu7yR.cjs"),ee=require("./label-BgIVynq3.cjs"),te=require("./input-DwLo4r7V.cjs"),X={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function oe({src:e,style:t}){return n.jsxs("div",{style:{position:"relative",display:"inline-block",overflow:"hidden",borderRadius:8,background:"hsl(var(--muted, 220 14% 96%))",minHeight:120,minWidth:180,...t},children:[e&&n.jsx("img",{src:e,alt:"","aria-hidden":!0,style:{display:"block",width:"100%",height:"100%",objectFit:"cover",filter:"blur(20px) saturate(0.5)",transform:"scale(1.1)",opacity:.5}}),n.jsx("div",{style:{position:"absolute",inset:0,background:"linear-gradient(110deg, transparent 30%, hsl(var(--muted-foreground, 220 9% 46%) / 0.08) 50%, transparent 70%)",animation:"richtext-skeleton-shimmer 1.8s ease-in-out infinite"}}),n.jsxs("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,pointerEvents:"none"},children:[n.jsx("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"hsl(var(--muted-foreground, 220 9% 46%))",animation:"richtext-skeleton-spin 1s linear infinite"},children:n.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),n.jsx("span",{style:{fontSize:12,fontWeight:500,color:"hsl(var(--muted-foreground, 220 9% 46%))",userSelect:"none"},children:"Uploading…"})]}),n.jsx("style",{children:`
2
- @keyframes richtext-skeleton-shimmer {
3
- 0% { transform: translateX(-100%); }
4
- 100% { transform: translateX(100%); }
5
- }
6
- @keyframes richtext-skeleton-spin {
7
- from { transform: rotate(0deg); }
8
- to { transform: rotate(360deg); }
9
- }
10
- `})]})}function ce(e){var H,_,D,R;const[t,l]=u.useState({width:O.IMAGE_MAX_SIZE,height:O.IMAGE_MAX_SIZE}),[a,r]=u.useState({width:0,height:0}),[d]=u.useState([X.TOP_LEFT,X.TOP_RIGHT,X.BOTTOM_LEFT,X.BOTTOM_RIGHT]),[o,v]=u.useState(!1),[c,p]=u.useState({x:0,y:0,w:0,h:0,dir:""}),{align:I,inline:w,uploading:M}=(H=e==null?void 0:e.node)==null?void 0:H.attrs,m=w&&(I==="left"||I==="right"),f=u.useMemo(()=>{var K;const{src:i,alt:s,width:b,height:T,flipX:C,flipY:g}=(K=e==null?void 0:e.node)==null?void 0:K.attrs,N=G.isNumber(b)?`${b}px`:b,E=G.isNumber(T)?`${T}px`:T,Y=[];C&&Y.push("rotateX(180deg)"),g&&Y.push("rotateY(180deg)");const ae=Y.join(" ");return{src:i||void 0,alt:s||void 0,style:{width:N||void 0,height:E||void 0,transform:ae||"none",...m?{float:I}:{}}}},[(_=e==null?void 0:e.node)==null?void 0:_.attrs]),A=u.useMemo(()=>{const{style:{width:i}}=f;return{width:i==="100%"?i:void 0}},[f]);function S(i){r({width:i.target.width,height:i.target.height})}function j(){const{editor:i,getPos:s}=e;i.commands.setNodeSelection(s())}const h=u.useCallback(Z.throttle(()=>{const{editor:i}=e,{width:s}=getComputedStyle(i.view.dom);l(b=>({...b,width:Number.parseInt(s,10)}))},O.IMAGE_THROTTLE_WAIT_TIME),[e==null?void 0:e.editor]);function F(i,s){i.preventDefault(),i.stopPropagation();const b=a.width,T=a.height,C=b/T;let g=Number(e.node.attrs.width),N=Number(e.node.attrs.height);const E=t.width;g&&!N?(g=g>E?E:g,N=Math.round(g/C)):N&&!g?(g=Math.round(N*C),g=g>E?E:g):!g&&!N?(g=b>E?E:b,N=Math.round(g/C)):g=g>E?E:g,v(!0),p({x:i.clientX,y:i.clientY,w:g,h:N,dir:s})}const y=u.useCallback(Z.throttle(i=>{if(i.preventDefault(),i.stopPropagation(),!o)return;const{x:s,w:b,dir:T}=c,C=(i.clientX-s)*(/l/.test(T)?-1:1),g=G.clamp(b+C,O.IMAGE_MIN_SIZE,t.width);e.updateAttributes({width:g,height:null})},O.IMAGE_THROTTLE_WAIT_TIME),[o,c,t,e.updateAttributes]),U=u.useCallback(i=>{i.preventDefault(),i.stopPropagation(),o&&(p({x:0,y:0,w:0,h:0,dir:""}),v(!1),j())},[o,j]),x=u.useCallback(()=>{document==null||document.addEventListener("mousemove",y,!0),document==null||document.addEventListener("mouseup",U,!0)},[y,U]),L=u.useCallback(()=>{document==null||document.removeEventListener("mousemove",y,!0),document==null||document.removeEventListener("mouseup",U,!0)},[y,U]);u.useEffect(()=>(o?x():L(),()=>{L()}),[o,x,L]);const k=u.useMemo(()=>new ResizeObserver(()=>h()),[h]);return u.useEffect(()=>(k.observe(e.editor.view.dom),()=>{k.disconnect()}),[e.editor.view.dom,k]),M?n.jsx(W.NodeViewWrapper,{as:w?"span":"div",className:"image-view",style:{float:m?I:void 0,margin:m?I==="left"?"1em 1em 1em 0":"1em 0 1em 1em":void 0,display:w?"inline":"block",textAlign:m?void 0:I,width:((D=f.style)==null?void 0:D.width)??"auto",...m?{}:A},children:n.jsx("div",{style:A,className:"image-view__body",children:n.jsx(oe,{src:f.src,style:f.style})})}):n.jsx(W.NodeViewWrapper,{as:w?"span":"div",className:"image-view",style:{float:m?I:void 0,margin:m?I==="left"?"1em 1em 1em 0":"1em 0 1em 1em":void 0,display:w?"inline":"block",textAlign:m?void 0:I,width:((R=f.style)==null?void 0:R.width)??"auto",...m?{}:A},children:n.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:A,className:`image-view__body ${e!=null&&e.selected?"image-view__body--focused":""} ${o?"image-view__body--resizing":""}`,children:[n.jsx("img",{alt:f.alt,className:"image-view__body__image block",height:"auto",onClick:j,onLoad:S,src:f.src,style:f.style}),(e==null?void 0:e.editor.view.editable)&&((e==null?void 0:e.selected)||o)&&n.jsx("div",{className:"image-resizer",children:d==null?void 0:d.map(i=>n.jsx("span",{className:`image-resizer__handler image-resizer__handler--${i}`,onMouseDown:s=>F(s,i)},`image-dir-${i}`))})]})})}function ue(e,t){const l=e.type,a=e.name.toLowerCase(),r=a.split(".").pop();if(!r)return!1;const o=l||{heif:"image/heif",heic:"image/heic",dng:"image/x-adobe-dng",cr2:"image/x-canon-cr2",nef:"image/x-nikon-nef",arw:"image/x-sony-arw",raf:"image/x-fuji-raf",orf:"image/x-olympus-orf"}[r];return t.some(v=>{if(v.startsWith("."))return a.endsWith(v);if(v.endsWith("/*")){const c=v.split("/")[0];return o==null?void 0:o.startsWith(c+"/")}return o===v})}function J(e,t){const{acceptMimes:l,maxSize:a,t:r,toast:d}=t,o=[];return(Array.isArray(e)?e:Object.values(e)).forEach(c=>{if(!ue(c,l)){t.onError?t.onError({type:"type",message:r("editor.upload.fileTypeNotSupported",{fileName:c.name}),file:c}):d({variant:"destructive",title:r("editor.upload.fileTypeNotSupported",{fileName:c.name})});return}if(c.size>a){const p=(a/1024/1024).toFixed(2);t.onError?t.onError({type:"size",message:r("editor.upload.fileSizeTooBig",{fileName:c.name,size:p}),file:c}):d({variant:"destructive",title:r("editor.upload.fileSizeTooBig",{fileName:c.name,size:p})});return}o.push(c)}),o}function de(){const{t:e}=O.useLocale(),{toast:t}=ne.useToast(),l=B.useEditorInstance(),a=B.useButtonProps($.name),{icon:r,tooltip:d}=(a==null?void 0:a.componentProps)??{},{editorDisabled:o}=B.useToggleActive(),[v,c]=u.useState(!1),p=B.useExtension($.name),[I,w]=u.useState(""),[M,m]=u.useState(""),f=u.useRef(null),A=(p==null?void 0:p.options.defaultInline)||!1,[S,j]=u.useState(A),h=u.useMemo(()=>p==null?void 0:p.options,[p]);function F(x){var D;const L=(D=x==null?void 0:x.target)==null?void 0:D.files;if(!l||l.isDestroyed||L.length===0){x.target.value="";return}const k=J(L,{acceptMimes:h==null?void 0:h.acceptMimes,maxSize:h==null?void 0:h.maxSize,t:e,toast:t,onError:h.onError});if(k.length<=0){x.target.value="";return}c(!1);const H=M,_=S;if(m(""),j(A),h.upload){const R=h!=null&&h.multiple?k:[k[0]];for(const i of R)l.chain().focus().insertImagePlaceholder({file:i,inline:_,alt:H}).run()}else{const R=h!=null&&h.multiple?k:[k[0]];for(const i of R){const s=URL.createObjectURL(i);l.chain().focus().setImageInline({src:s,inline:_,alt:H}).run()}}x.target.value=""}function y(x){x.preventDefault(),x.stopPropagation(),l.chain().focus().setImageInline({src:I,inline:S,alt:M}).run(),c(!1),j(A),w(""),m("")}function U(x){var L;x.preventDefault(),(L=f.current)==null||L.click()}return a?n.jsxs(z.Dialog,{onOpenChange:c,open:v,children:[n.jsx(z.DialogTrigger,{asChild:!0,children:n.jsx(se.ActionButton,{disabled:o,icon:r,tooltip:d,action:()=>{o||c(!0)}})}),n.jsxs(z.DialogContent,{children:[n.jsx(z.DialogTitle,{children:e("editor.image.dialog.title")}),n.jsxs(q.Tabs,{activationMode:"manual",defaultValue:h.resourceImage==="both"||h.resourceImage==="upload"?"upload":"link",children:[h.resourceImage==="both"&&n.jsxs(q.TabsList,{className:"richtext-grid richtext-w-full richtext-grid-cols-2",children:[n.jsx(q.TabsTrigger,{value:"upload",children:e("editor.image.dialog.tab.upload")}),n.jsx(q.TabsTrigger,{value:"link",children:e("editor.image.dialog.tab.url")})]}),n.jsxs("div",{className:"richtext-my-[10px] richtext-flex richtext-items-center richtext-gap-[4px]",children:[n.jsx(le.Checkbox,{checked:S,onCheckedChange:x=>{j(x)}}),n.jsx(ee.Label,{children:e("editor.link.dialog.inline")})]}),h.enableAlt&&n.jsxs("div",{className:"richtext-my-[10px]",children:[n.jsx(ee.Label,{className:"mb-[6px]",children:e("editor.imageUpload.alt")}),n.jsx(te.Input,{onChange:x=>m(x.target.value),required:!0,type:"text",value:M})]}),n.jsxs(q.TabsContent,{value:"upload",children:[n.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-[10px]",children:[n.jsx(P.Button,{className:"richtext-mt-1 richtext-w-full",onClick:U,size:"sm",children:e("editor.image.dialog.tab.upload")}),n.jsx(ie,{alt:M,disabled:!1,editor:l,imageInline:S,onClose:()=>{m("")}})]}),n.jsx("input",{accept:h.acceptMimes.join(",")||"image/*",multiple:h.multiple,onChange:F,ref:f,style:{display:"none"},type:"file"})]}),n.jsx(q.TabsContent,{value:"link",children:n.jsx("form",{onSubmit:y,children:n.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2",children:[n.jsx(te.Input,{autoFocus:!0,onChange:x=>w(x.target.value),placeholder:e("editor.image.dialog.placeholder"),required:!0,type:"url",value:I}),n.jsx(P.Button,{type:"submit",children:e("editor.image.dialog.button.apply")})]})})})]})]})]}):n.jsx(n.Fragment,{})}const he={acceptMimes:["image/jpeg","image/gif","image/png","image/jpg"],maxSize:1024*1024*5,multiple:!0,resourceImage:"both",defaultInline:!1,enableAlt:!0},$=Z.index_default.extend({group:"inline",inline:!0,defining:!0,draggable:!0,selectable:!0,addOptions(){var e;return{...he,...(e=this.parent)==null?void 0:e.call(this),upload:()=>Promise.reject("Image Upload Function"),button:({editor:t,extension:l,t:a})=>{var r,d;return{componentProps:{action:()=>!0,upload:l.options.upload,disabled:!((d=(r=t.can()).setImage)!=null&&d.call(r,{})),icon:"ImageUp",tooltip:a("editor.image.tooltip")}}}}},addAttributes(){var e;return{...(e=this.parent)==null?void 0:e.call(this),uploading:{default:!1,parseHTML:()=>!1,renderHTML:()=>({})},imageId:{default:null,parseHTML:t=>t.getAttribute("data-image-id"),renderHTML:t=>t.imageId?{"data-image-id":t.imageId}:{}},flipX:{default:!1},flipY:{default:!1},width:{default:null,parseHTML:t=>{const l=t.style.width||t.getAttribute("width")||null;return l?Number.parseInt(l,10):null},renderHTML:t=>({width:t.width})},align:{default:"center",parseHTML:t=>t.getAttribute("align"),renderHTML:t=>({align:t.align})},inline:{default:!1,parseHTML:t=>!!t.getAttribute("inline"),renderHTML:t=>({inline:t.inline})},alt:{default:"",parseHTML:t=>t.getAttribute("alt"),renderHTML:t=>({alt:t.alt})}}},addNodeView(){return W.ReactNodeViewRenderer(ce)},addCommands(){var l;const e=this.name,t=this.options;return{...(l=this.parent)==null?void 0:l.call(this),setImageInline:a=>({commands:r})=>r.insertContent({type:e,attrs:{...a,imageId:a.imageId??null,inline:a.inline??t.defaultInline}}),insertImagePlaceholder:({file:a,inline:r,alt:d})=>({editor:o,commands:v})=>{const c=URL.createObjectURL(a);if(!v.insertContent({type:e,attrs:{src:c,alt:d??"",inline:r??t.defaultInline,uploading:!0,imageId:null}}))return!1;const I=t.upload;return I&&I(a).then(w=>{const{doc:M}=o.state;let m=null;M.descendants((f,A)=>{if(f.type.name===e&&f.attrs.uploading===!0&&f.attrs.src===c)return m=A,!1}),m!==null&&o.view.dispatch(o.state.tr.setNodeMarkup(m,void 0,{...o.state.doc.nodeAt(m).attrs,src:w.cdnUrl,imageId:w.imageId,uploading:!1})),URL.revokeObjectURL(c)}).catch(w=>{console.error("Image upload failed",w);const{doc:M}=o.state;let m=null;if(M.descendants((f,A)=>{if(f.type.name===e&&f.attrs.uploading===!0&&f.attrs.src===c)return m=A,!1}),m!==null){const f=o.state.doc.nodeAt(m);f&&o.view.dispatch(o.state.tr.delete(m,m+f.nodeSize))}URL.revokeObjectURL(c)}),!0},updateImage:a=>({commands:r})=>r.updateAttributes(this.name,a),setAlignImage:a=>({commands:r})=>r.updateAttributes(this.name,{align:a})}},renderHTML({HTMLAttributes:e}){const{flipX:t,flipY:l,align:a,inline:r}=e,d=r&&(a==="left"||a==="right"),o=t||l?`transform: rotateX(${t?"180":"0"}deg) rotateY(${l?"180":"0"}deg);`:"",v=d?"":`text-align: ${a};`,I=`${d?`float: ${a};`:""}${d?a==="left"?"margin: 1em 1em 1em 0;":"margin: 1em 0 1em 1em;":""}${o}`;return[r?"span":"div",{style:v,class:"image"},["img",W.mergeAttributes({height:"auto",style:I},this.options.HTMLAttributes,e)]]},parseHTML(){return[{tag:"span.image img",getAttrs:e=>{var d;const t=e==null?void 0:e.parentElement,l=e==null?void 0:e.getAttribute("width"),a=(e==null?void 0:e.getAttribute("flipx"))||!1,r=(e==null?void 0:e.getAttribute("flipy"))||!1;return{src:e==null?void 0:e.getAttribute("src"),alt:e==null?void 0:e.getAttribute("alt"),caption:e==null?void 0:e.getAttribute("caption"),width:l?Number.parseInt(l,10):null,align:(e==null?void 0:e.getAttribute("align"))||((d=t==null?void 0:t.style)==null?void 0:d.textAlign)||null,inline:(e==null?void 0:e.getAttribute("inline"))||!1,flipX:a==="true",flipY:r==="true"}}},{tag:"div[class=image]",getAttrs:e=>{const t=e.querySelector("img"),l=t==null?void 0:t.getAttribute("width"),a=(t==null?void 0:t.getAttribute("flipx"))||!1,r=(t==null?void 0:t.getAttribute("flipy"))||!1;return{src:t==null?void 0:t.getAttribute("src"),alt:t==null?void 0:t.getAttribute("alt"),caption:t==null?void 0:t.getAttribute("caption"),width:l?Number.parseInt(l,10):null,align:(t==null?void 0:t.getAttribute("align"))||e.style.textAlign||null,inline:(t==null?void 0:t.getAttribute("inline"))||!1,flipX:a==="true",flipY:r==="true"}}},{tag:'img[src]:not([src^="data:"])'}]}});function ie({editor:e,imageInline:t,onClose:l,disabled:a,alt:r}){var D,R;const{t:d}=O.useLocale(),{toast:o}=ne.useToast(),[v,c]=u.useState(!1),[p,I]=u.useState(!1),w=u.useRef(null),[M,m]=u.useState(),[f,A]=u.useState(""),S=u.useRef(null),[j,h]=u.useState({src:"",file:null}),F=B.useExtension($.name),y=u.useMemo(()=>(F==null?void 0:F.options)??{},[F]);function U(i){if(w.current&&i.width&&i.height){const s=x(w.current,i);A(s)}}function x(i,s){const b=document.createElement("canvas"),T=i.naturalWidth/i.width,C=i.naturalHeight/i.height;b.width=s.width*T,b.height=s.height*C;const g=b.getContext("2d");return g&&(g.imageSmoothingEnabled=!1,g.drawImage(i,s.x*T,s.y*C,s.width*T,s.height*C,0,0,s.width*T,s.height*C)),b.toDataURL("image/png",1)}const L=u.useCallback(()=>{var s;if(p)return;const i=Q.dataURLtoFile(f,((s=j==null?void 0:j.file)==null?void 0:s.name)||"image.png");if(c(!1),h({src:"",file:null}),_(),l(),y.upload)e.chain().focus().insertImagePlaceholder({file:i,inline:t,alt:r}).run();else{const b=URL.createObjectURL(i);e.chain().focus().setImageInline({src:b,inline:t,alt:r}).run()}},[f,e,t,p,l,(D=j==null?void 0:j.file)==null?void 0:D.name,y,r]);function k(i){var s;i.preventDefault(),(s=S.current)==null||s.click()}const H=async i=>{var g;const s=(g=i==null?void 0:i.target)==null?void 0:g.files;if(!e||e.isDestroyed||s.length===0){i.target.value="";return}const b=J(s,{acceptMimes:y==null?void 0:y.acceptMimes,maxSize:y==null?void 0:y.maxSize,t:d,toast:o,onError:y.onError});if(b.length<=0){i.target.value="";return}const T=b[0],C=await Q.readImageAsBase64(T);c(!0),h({src:C.src,file:T})},_=()=>{S.current&&(S.current.value="")};return n.jsxs(n.Fragment,{children:[n.jsx(P.Button,{className:"richtext-mt-1 richtext-w-full",disabled:a,onClick:k,size:"sm",children:d("editor.image.dialog.tab.uploadCrop")}),n.jsxs(z.Dialog,{open:v,onOpenChange:i=>{c(i),i||(h({src:"",file:null}),_())},children:[n.jsx(z.DialogTrigger,{}),n.jsxs(z.DialogContent,{children:[n.jsx(z.DialogTitle,{children:d("editor.image.dialog.tab.uploadCrop")}),n.jsx("div",{children:j.src&&n.jsx(re,{className:"richtext-w-full",crop:M,onChange:i=>m(i),onComplete:i=>U(i),children:n.jsx("img",{alt:"Crop me",ref:w,src:j.src})})}),n.jsxs(z.DialogFooter,{children:[n.jsxs(P.Button,{disabled:p,onClick:()=>{c(!1),h({src:"",file:null}),_()},children:[d("editor.imageUpload.cancel"),n.jsx(V.IconComponent,{className:"richtext-ml-1",name:"Trash2"})]}),n.jsx(P.Button,{className:"richtext-w-fit",disabled:p||!M,onClick:L,children:p?n.jsxs(n.Fragment,{children:[d("editor.imageUpload.uploading"),n.jsx(V.IconComponent,{className:"richtext-ml-1 richtext-animate-spin",name:"Loader"})]}):n.jsxs(n.Fragment,{children:[d("editor.imageUpload.crop"),n.jsx(V.IconComponent,{className:"richtext-ml-1",name:"Crop"})]})})]})]})]}),n.jsx("input",{accept:((R=y==null?void 0:y.acceptMimes)==null?void 0:R.join(","))||"image/*",multiple:!1,onChange:H,ref:S,style:{display:"none"},type:"file"})]})}exports.Image=$;exports.ImageCropper=ie;exports.RichTextImage=de;exports.validateFiles=J;