@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
@@ -1,231 +0,0 @@
1
- import { N as I } from "./clsx-m_C5j3RU.js";
2
- import { u as $, V as H } from "./index-BGd2HiwP.js";
3
- import { f as S, u as R, c as z, i as B, k as N } from "./useButtonProps-D-ruygH7.js";
4
- import { jsxs as d, jsx as s } from "react/jsx-runtime";
5
- import { useState as y, useRef as E, useMemo as U } from "react";
6
- import { A as j } from "./toggle-CaSwYCk4.js";
7
- import { D as F, a as O, b as Z, c as _ } from "./dialog-bDkDW-C_.js";
8
- import { T as q, a as W, b as L, c as M } from "./tabs-D1J1iB7B.js";
9
- import { B as T } from "./button-090-I3tp.js";
10
- import { I as G } from "./input-C_J-pfTx.js";
11
- function J(e, t) {
12
- let o;
13
- try {
14
- o = new URL(e);
15
- } catch {
16
- return !1;
17
- }
18
- return !(t != null && t.length) || t.length === 1 && t[0] === "." ? !0 : t.some((n) => {
19
- if (n.includes("*")) {
20
- const a = n.replace(/\./g, String.raw`\.`).replace(/\*/g, ".*");
21
- return new RegExp(`^${a}$`).test(o.hostname);
22
- }
23
- return o.hostname.includes(n);
24
- });
25
- }
26
- function ne() {
27
- const { t: e } = $(), t = S(), o = R(k.name), { icon: n, tooltip: a } = (o == null ? void 0 : o.componentProps) ?? {}, { editorDisabled: c } = z(), [u, v] = y(""), b = E(null), [g, h] = y(""), [x, p] = y(!1), m = B(k.name), i = U(() => (m == null ? void 0 : m.options) ?? {}, [m]);
28
- async function D(r) {
29
- var V;
30
- const l = (V = r == null ? void 0 : r.target) == null ? void 0 : V.files;
31
- if (!t || t.isDestroyed || l.length === 0)
32
- return;
33
- const f = l[0];
34
- let w = "";
35
- i.upload ? w = await i.upload(f) : w = URL.createObjectURL(f), t.chain().focus().setVideo({
36
- src: w,
37
- width: "100%"
38
- }).run(), p(!1);
39
- }
40
- function A(r) {
41
- r.preventDefault(), r.stopPropagation(), u && (t.chain().focus().setVideo({
42
- src: u,
43
- width: "100%"
44
- }).run(), p(!1), v(""));
45
- }
46
- function C(r) {
47
- var l;
48
- r.preventDefault(), (l = b.current) == null || l.click();
49
- }
50
- return /* @__PURE__ */ d(F, { onOpenChange: p, open: x, children: [
51
- /* @__PURE__ */ s(O, { asChild: !0, children: /* @__PURE__ */ s(
52
- j,
53
- {
54
- disabled: c,
55
- icon: n,
56
- tooltip: a,
57
- action: () => {
58
- c || p(!0);
59
- }
60
- }
61
- ) }),
62
- /* @__PURE__ */ d(Z, { children: [
63
- /* @__PURE__ */ s(_, { children: e("editor.video.dialog.title") }),
64
- /* @__PURE__ */ d(
65
- q,
66
- {
67
- activationMode: "manual",
68
- defaultValue: (i == null ? void 0 : i.resourceVideo) === "both" || (i == null ? void 0 : i.resourceVideo) === "upload" ? "upload" : "link",
69
- children: [
70
- /* @__PURE__ */ d(W, { className: "richtext-grid richtext-w-full richtext-grid-cols-2", children: [
71
- ((i == null ? void 0 : i.resourceVideo) === "both" || (i == null ? void 0 : i.resourceVideo) === "upload") && /* @__PURE__ */ s(L, { value: "upload", children: e("editor.video.dialog.tab.upload") }),
72
- ((i == null ? void 0 : i.resourceVideo) === "both" || (i == null ? void 0 : i.resourceVideo) === "link") && /* @__PURE__ */ s(L, { value: "link", children: e("editor.video.dialog.link") })
73
- ] }),
74
- /* @__PURE__ */ d(M, { value: "upload", children: [
75
- /* @__PURE__ */ s("div", { className: "richtext-flex richtext-items-center richtext-gap-[10px]", children: /* @__PURE__ */ s(T, { className: "richtext-mt-1 richtext-w-full", onClick: C, size: "sm", children: e("editor.video.dialog.tab.upload") }) }),
76
- /* @__PURE__ */ s(
77
- "input",
78
- {
79
- accept: "video/*",
80
- multiple: !0,
81
- onChange: D,
82
- ref: b,
83
- type: "file",
84
- style: {
85
- display: "none"
86
- }
87
- }
88
- )
89
- ] }),
90
- /* @__PURE__ */ d(M, { value: "link", children: [
91
- /* @__PURE__ */ s("div", { children: /* @__PURE__ */ d("div", { className: "richtext-flex richtext-items-center richtext-gap-2", children: [
92
- /* @__PURE__ */ s(
93
- G,
94
- {
95
- autoFocus: !0,
96
- placeholder: e("editor.video.dialog.placeholder"),
97
- required: !0,
98
- type: "url",
99
- value: u,
100
- onBlur: (r) => {
101
- const l = r.target.value, f = i.videoProviders || ["."];
102
- l && !J(l, f) ? h("Invalid video URL") : h("");
103
- },
104
- onChange: (r) => {
105
- v(r.target.value);
106
- }
107
- }
108
- ),
109
- /* @__PURE__ */ s(T, { onClick: A, type: "button", children: e("editor.video.dialog.button.apply") })
110
- ] }) }),
111
- g && /* @__PURE__ */ s("div", { className: "richtext-my-[5px] richtext-text-red-500", children: g })
112
- ] })
113
- ]
114
- }
115
- )
116
- ] })
117
- ] });
118
- }
119
- function K(e) {
120
- e = e.replace("https://youtu.be/", "https://www.youtube.com/watch?v=").replace("watch?v=", "embed/");
121
- const t = e.match(/^https:\/\/www\.youtube\.com\/shorts\/([a-zA-Z0-9_-]+)/);
122
- t && (e = `https://www.youtube.com/embed/${t[1]}`);
123
- const o = e.match(/^https:\/\/vimeo\.com\/(\d+)(?:\/([a-zA-Z0-9]+))?/);
124
- if (o) {
125
- const a = o[1], c = o[2];
126
- c ? e = `https://player.vimeo.com/video/${a}?h=${c}` : e = `https://player.vimeo.com/video/${a}`;
127
- }
128
- return /^https?:\/\/www.bilibili.com\/video\/.*/i.test(e) && (e = e.replace(/\?.*$/, "").replace("https://www.bilibili.com/video/", "https://player.bilibili.com/player.html?bvid=")), e.includes("drive.google.com") && (e = e.replace("/view", "/preview")), e;
129
- }
130
- const k = /* @__PURE__ */ I.create({
131
- name: "video",
132
- group: "block",
133
- atom: !0,
134
- draggable: !0,
135
- //@ts-expect-error
136
- addOptions() {
137
- return {
138
- divider: !1,
139
- spacer: !1,
140
- allowFullscreen: !0,
141
- upload: void 0,
142
- frameborder: !1,
143
- resourceVideo: "both",
144
- width: H["size-medium"],
145
- HTMLAttributes: {
146
- class: "iframe-wrapper"
147
- // style: 'display: flex;justify-content: center;',
148
- },
149
- button: ({ editor: e, t }) => {
150
- var o, n;
151
- return {
152
- componentProps: {
153
- action: () => {
154
- },
155
- isActive: () => e.isActive("video") || !1,
156
- /* If setVideo is not available(when Video Component is not imported), the button is disabled */
157
- disabled: !((n = (o = e.can()).setVideo) != null && n.call(o, {})),
158
- icon: "Video",
159
- tooltip: t("editor.video.tooltip"),
160
- videoProviders: ["."],
161
- editor: e
162
- }
163
- };
164
- }
165
- };
166
- },
167
- addAttributes() {
168
- return {
169
- src: {
170
- default: null,
171
- renderHTML: ({ src: e }) => ({
172
- src: e ? K(e) : null
173
- })
174
- },
175
- width: {
176
- default: this.options.width,
177
- renderHTML: ({ width: e }) => ({
178
- width: N(e)
179
- })
180
- },
181
- frameborder: {
182
- default: this.options.frameborder ? 1 : 0,
183
- parseHTML: () => this.options.frameborder ? 1 : 0
184
- },
185
- allowfullscreen: {
186
- default: this.options.allowFullscreen,
187
- parseHTML: () => this.options.allowFullscreen
188
- },
189
- align: {
190
- default: "center",
191
- // Default alignment
192
- renderHTML: ({ align: e }) => ({
193
- align: e
194
- })
195
- }
196
- };
197
- },
198
- parseHTML() {
199
- return [
200
- {
201
- tag: "div[data-video] iframe"
202
- }
203
- ];
204
- },
205
- renderHTML({ HTMLAttributes: e }) {
206
- const { width: t = "100%", align: o = "center" } = e ?? {}, n = {
207
- ...e,
208
- width: "100%",
209
- height: "100%"
210
- }, a = `position: relative;overflow: hidden;display: flex;flex: 1;max-width: ${t};`, c = `flex: 1;padding-bottom: ${9 / 16 * 100}%;`, h = ["div", { style: `display: flex; justify-content: ${o};` }, ["div", { style: a }, ["div", { style: c }], ["iframe", n]]];
211
- return ["div", {
212
- ...this.options.HTMLAttributes,
213
- class: "iframe-wrapper",
214
- "data-video": ""
215
- }, h];
216
- },
217
- addCommands() {
218
- return {
219
- setVideo: (e) => ({ commands: t }) => t.insertContent({
220
- type: this.name,
221
- attrs: e
222
- }),
223
- updateVideo: (e) => ({ commands: t }) => t.updateAttributes(this.name, e)
224
- };
225
- }
226
- });
227
- export {
228
- ne as R,
229
- k as V,
230
- J as c
231
- };
@@ -1 +0,0 @@
1
- "use strict";const I=require("./clsx-CXbNJWDD.cjs"),k=require("./index-DgOXAdKt.cjs"),h=require("./useButtonProps-D9ndBdmA.cjs"),o=require("react/jsx-runtime"),u=require("react"),S=require("./toggle-C9tcMm1r.cjs"),b=require("./dialog-C8J59d2J.cjs"),d=require("./tabs-IEbMQmNX.cjs"),M=require("./button-B4Sz2ZhW.cjs"),R=require("./input-DwLo4r7V.cjs");function D(e,t){let r;try{r=new URL(e)}catch{return!1}return!(t!=null&&t.length)||t.length===1&&t[0]==="."?!0:t.some(n=>{if(n.includes("*")){const l=n.replace(/\./g,String.raw`\.`).replace(/\*/g,".*");return new RegExp(`^${l}$`).test(r.hostname)}return r.hostname.includes(n)})}function $(){const{t:e}=k.useLocale(),t=h.useEditorInstance(),r=h.useButtonProps(T.name),{icon:n,tooltip:l}=(r==null?void 0:r.componentProps)??{},{editorDisabled:c}=h.useToggleActive(),[p,x]=u.useState(""),w=u.useRef(null),[y,f]=u.useState(""),[V,m]=u.useState(!1),v=h.useExtension(T.name),i=u.useMemo(()=>(v==null?void 0:v.options)??{},[v]);async function C(s){var L;const a=(L=s==null?void 0:s.target)==null?void 0:L.files;if(!t||t.isDestroyed||a.length===0)return;const g=a[0];let j="";i.upload?j=await i.upload(g):j=URL.createObjectURL(g),t.chain().focus().setVideo({src:j,width:"100%"}).run(),m(!1)}function A(s){s.preventDefault(),s.stopPropagation(),p&&(t.chain().focus().setVideo({src:p,width:"100%"}).run(),m(!1),x(""))}function q(s){var a;s.preventDefault(),(a=w.current)==null||a.click()}return o.jsxs(b.Dialog,{onOpenChange:m,open:V,children:[o.jsx(b.DialogTrigger,{asChild:!0,children:o.jsx(S.ActionButton,{disabled:c,icon:n,tooltip:l,action:()=>{c||m(!0)}})}),o.jsxs(b.DialogContent,{children:[o.jsx(b.DialogTitle,{children:e("editor.video.dialog.title")}),o.jsxs(d.Tabs,{activationMode:"manual",defaultValue:(i==null?void 0:i.resourceVideo)==="both"||(i==null?void 0:i.resourceVideo)==="upload"?"upload":"link",children:[o.jsxs(d.TabsList,{className:"richtext-grid richtext-w-full richtext-grid-cols-2",children:[((i==null?void 0:i.resourceVideo)==="both"||(i==null?void 0:i.resourceVideo)==="upload")&&o.jsx(d.TabsTrigger,{value:"upload",children:e("editor.video.dialog.tab.upload")}),((i==null?void 0:i.resourceVideo)==="both"||(i==null?void 0:i.resourceVideo)==="link")&&o.jsx(d.TabsTrigger,{value:"link",children:e("editor.video.dialog.link")})]}),o.jsxs(d.TabsContent,{value:"upload",children:[o.jsx("div",{className:"richtext-flex richtext-items-center richtext-gap-[10px]",children:o.jsx(M.Button,{className:"richtext-mt-1 richtext-w-full",onClick:q,size:"sm",children:e("editor.video.dialog.tab.upload")})}),o.jsx("input",{accept:"video/*",multiple:!0,onChange:C,ref:w,type:"file",style:{display:"none"}})]}),o.jsxs(d.TabsContent,{value:"link",children:[o.jsx("div",{children:o.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-2",children:[o.jsx(R.Input,{autoFocus:!0,placeholder:e("editor.video.dialog.placeholder"),required:!0,type:"url",value:p,onBlur:s=>{const a=s.target.value,g=i.videoProviders||["."];a&&!D(a,g)?f("Invalid video URL"):f("")},onChange:s=>{x(s.target.value)}}),o.jsx(M.Button,{onClick:A,type:"button",children:e("editor.video.dialog.button.apply")})]})}),y&&o.jsx("div",{className:"richtext-my-[5px] richtext-text-red-500",children:y})]})]})]})]})}function H(e){e=e.replace("https://youtu.be/","https://www.youtube.com/watch?v=").replace("watch?v=","embed/");const t=e.match(/^https:\/\/www\.youtube\.com\/shorts\/([a-zA-Z0-9_-]+)/);t&&(e=`https://www.youtube.com/embed/${t[1]}`);const r=e.match(/^https:\/\/vimeo\.com\/(\d+)(?:\/([a-zA-Z0-9]+))?/);if(r){const l=r[1],c=r[2];c?e=`https://player.vimeo.com/video/${l}?h=${c}`:e=`https://player.vimeo.com/video/${l}`}return/^https?:\/\/www.bilibili.com\/video\/.*/i.test(e)&&(e=e.replace(/\?.*$/,"").replace("https://www.bilibili.com/video/","https://player.bilibili.com/player.html?bvid=")),e.includes("drive.google.com")&&(e=e.replace("/view","/preview")),e}const T=I.Node3.create({name:"video",group:"block",atom:!0,draggable:!0,addOptions(){return{divider:!1,spacer:!1,allowFullscreen:!0,upload:void 0,frameborder:!1,resourceVideo:"both",width:k.VIDEO_SIZE["size-medium"],HTMLAttributes:{class:"iframe-wrapper"},button:({editor:e,t})=>{var r,n;return{componentProps:{action:()=>{},isActive:()=>e.isActive("video")||!1,disabled:!((n=(r=e.can()).setVideo)!=null&&n.call(r,{})),icon:"Video",tooltip:t("editor.video.tooltip"),videoProviders:["."],editor:e}}}}},addAttributes(){return{src:{default:null,renderHTML:({src:e})=>({src:e?H(e):null})},width:{default:this.options.width,renderHTML:({width:e})=>({width:h.getCssUnitWithDefault(e)})},frameborder:{default:this.options.frameborder?1:0,parseHTML:()=>this.options.frameborder?1:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen},align:{default:"center",renderHTML:({align:e})=>({align:e})}}},parseHTML(){return[{tag:"div[data-video] iframe"}]},renderHTML({HTMLAttributes:e}){const{width:t="100%",align:r="center"}=e??{},n={...e,width:"100%",height:"100%"},l=`position: relative;overflow: hidden;display: flex;flex: 1;max-width: ${t};`,c=`flex: 1;padding-bottom: ${9/16*100}%;`,f=["div",{style:`display: flex; justify-content: ${r};`},["div",{style:l},["div",{style:c}],["iframe",n]]];return["div",{...this.options.HTMLAttributes,class:"iframe-wrapper","data-video":""},f]},addCommands(){return{setVideo:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e}),updateVideo:e=>({commands:t})=>t.updateAttributes(this.name,e)}}});exports.RichTextVideo=$;exports.Video=T;exports.checkIsVideoUrl=D;
@@ -1,35 +0,0 @@
1
- import { jsx as n } from "react/jsx-runtime";
2
- import { Slot as x } from "@radix-ui/react-slot";
3
- import { c as h, a } from "./index-jMN4V2hr.js";
4
- import * as s from "react";
5
- const d = a(
6
- "richtext-inline-flex richtext-items-center richtext-justify-center richtext-whitespace-nowrap richtext-rounded-md richtext-text-sm richtext-font-medium richtext-ring-offset-background richtext-transition-colors focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-1 disabled:richtext-pointer-events-none disabled:richtext-opacity-50",
7
- {
8
- variants: {
9
- variant: {
10
- default: "!richtext-bg-primary !richtext-text-primary-foreground hover:!richtext-bg-primary/90",
11
- destructive: "richtext-bg-destructive richtext-text-destructive-foreground hover:richtext-bg-destructive/90",
12
- outline: "richtext-border richtext-border-input richtext-bg-background richtext-text-foreground hover:richtext-bg-accent hover:richtext-text-accent-foreground",
13
- secondary: "richtext-bg-secondary richtext-text-secondary-foreground hover:richtext-bg-secondary/80",
14
- ghost: "hover:richtext-bg-accent hover:richtext-text-accent-foreground",
15
- link: "richtext-text-primary richtext-underline-offset-4 hover:richtext-underline"
16
- },
17
- size: {
18
- default: "richtext-h-10 richtext-px-4 richtext-py-2",
19
- sm: "richtext-h-9 richtext-rounded-md richtext-px-3",
20
- lg: "richtext-h-11 richtext-rounded-md richtext-px-8",
21
- icon: "richtext-size-10"
22
- }
23
- },
24
- defaultVariants: {
25
- variant: "default",
26
- size: "default"
27
- }
28
- }
29
- ), u = s.forwardRef(
30
- ({ className: t, variant: e, size: r, asChild: i = !1, ...c }, o) => /* @__PURE__ */ n(i ? x : "button", { className: h(d({ variant: e, size: r, className: t })), ref: o, ...c })
31
- );
32
- u.displayName = "Button";
33
- export {
34
- u as B
35
- };
@@ -1 +0,0 @@
1
- "use strict";const s=require("react/jsx-runtime"),a=require("@radix-ui/react-slot"),c=require("./index-BXh8X1ch.cjs"),u=require("react");function d(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,i.get?i:{enumerable:!0,get:()=>t[e]})}}return r.default=t,Object.freeze(r)}const f=d(u),l=c.cva("richtext-inline-flex richtext-items-center richtext-justify-center richtext-whitespace-nowrap richtext-rounded-md richtext-text-sm richtext-font-medium richtext-ring-offset-background richtext-transition-colors focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-1 disabled:richtext-pointer-events-none disabled:richtext-opacity-50",{variants:{variant:{default:"!richtext-bg-primary !richtext-text-primary-foreground hover:!richtext-bg-primary/90",destructive:"richtext-bg-destructive richtext-text-destructive-foreground hover:richtext-bg-destructive/90",outline:"richtext-border richtext-border-input richtext-bg-background richtext-text-foreground hover:richtext-bg-accent hover:richtext-text-accent-foreground",secondary:"richtext-bg-secondary richtext-text-secondary-foreground hover:richtext-bg-secondary/80",ghost:"hover:richtext-bg-accent hover:richtext-text-accent-foreground",link:"richtext-text-primary richtext-underline-offset-4 hover:richtext-underline"},size:{default:"richtext-h-10 richtext-px-4 richtext-py-2",sm:"richtext-h-9 richtext-rounded-md richtext-px-3",lg:"richtext-h-11 richtext-rounded-md richtext-px-8",icon:"richtext-size-10"}},defaultVariants:{variant:"default",size:"default"}}),n=f.forwardRef(({className:t,variant:r,size:e,asChild:i=!1,...o},x)=>{const h=i?a.Slot:"button";return s.jsx(h,{className:c.cn(l({variant:r,size:e,className:t})),ref:x,...o})});n.displayName="Button";exports.Button=n;
@@ -1 +0,0 @@
1
- "use strict";const c=require("react/jsx-runtime"),h=require("@radix-ui/react-checkbox"),x=require("lucide-react"),u=require("react"),s=require("./index-BXh8X1ch.cjs");function n(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const i=n(h),d=n(u),a=d.forwardRef(({className:e,...r},t)=>c.jsx(i.Root,{ref:t,className:s.cn("!richtext-peer !richtext-h-4 !richtext-w-4 !richtext-shrink-0 !richtext-rounded-sm !richtext-border !richtext-border-primary !richtext-p-0 !richtext-ring-offset-background focus-visible:!richtext-outline-none focus-visible:!richtext-ring-2 focus-visible:!richtext-ring-ring focus-visible:!richtext-ring-offset-1 disabled:!richtext-cursor-not-allowed disabled:!richtext-opacity-50 data-[state=checked]:!richtext-bg-primary data-[state=checked]:!richtext-text-primary-foreground",e),...r,children:c.jsx(i.Indicator,{className:s.cn("!richtext-flex !richtext-items-center !richtext-justify-center !richtext-p-0 !richtext-text-current"),children:c.jsx(x.Check,{className:"!richtext-h-4 !richtext-w-4"})})}));a.displayName=i.Root.displayName;exports.Checkbox=a;
@@ -1,29 +0,0 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import * as e from "@radix-ui/react-checkbox";
3
- import { Check as h } from "lucide-react";
4
- import * as s from "react";
5
- import { c as r } from "./index-jMN4V2hr.js";
6
- const a = s.forwardRef(({ className: i, ...c }, o) => /* @__PURE__ */ t(
7
- e.Root,
8
- {
9
- ref: o,
10
- className: r(
11
- "!richtext-peer !richtext-h-4 !richtext-w-4 !richtext-shrink-0 !richtext-rounded-sm !richtext-border !richtext-border-primary !richtext-p-0 !richtext-ring-offset-background focus-visible:!richtext-outline-none focus-visible:!richtext-ring-2 focus-visible:!richtext-ring-ring focus-visible:!richtext-ring-offset-1 disabled:!richtext-cursor-not-allowed disabled:!richtext-opacity-50 data-[state=checked]:!richtext-bg-primary data-[state=checked]:!richtext-text-primary-foreground",
12
- i
13
- ),
14
- ...c,
15
- children: /* @__PURE__ */ t(
16
- e.Indicator,
17
- {
18
- className: r(
19
- "!richtext-flex !richtext-items-center !richtext-justify-center !richtext-p-0 !richtext-text-current"
20
- ),
21
- children: /* @__PURE__ */ t(h, { className: "!richtext-h-4 !richtext-w-4" })
22
- }
23
- )
24
- }
25
- ));
26
- a.displayName = e.Root.displayName;
27
- export {
28
- a as C
29
- };
@@ -1 +0,0 @@
1
- "use strict";const a=require("react/jsx-runtime"),f=require("@radix-ui/react-dialog"),u=require("lucide-react"),m=require("react"),c=require("./index-BXh8X1ch.cjs");function n(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const o=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,o.get?o:{enumerable:!0,get:()=>t[i]})}}return e.default=t,Object.freeze(e)}const r=n(f),s=n(m),p=r.Root,D=r.Trigger,y=r.Portal,x=s.forwardRef(({className:t,...e},i)=>a.jsx(r.Overlay,{ref:i,className:c.cn("richtext-fixed richtext-inset-0 richtext-z-50 richtext-bg-black/80 data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0",t),...e}));x.displayName=r.Overlay.displayName;const l=s.forwardRef(({className:t,children:e,...i},o)=>a.jsxs(y,{"data-richtext-portal":!0,children:[a.jsx(x,{}),a.jsxs(r.Content,{"data-richtext-portal":!0,ref:o,className:c.cn("richtext-fixed richtext-left-[50%] richtext-top-[50%] richtext-z-50 richtext-grid richtext-w-full richtext-max-w-lg richtext-translate-x-[-50%] richtext-translate-y-[-50%] richtext-gap-4 richtext-border !richtext-border-border richtext-bg-background richtext-p-6 richtext-shadow-lg richtext-duration-200 data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0 data-[state=closed]:richtext-zoom-out-95 data-[state=open]:richtext-zoom-in-95 data-[state=closed]:richtext-slide-out-to-left-1/2 data-[state=closed]:richtext-slide-out-to-top-[48%] data-[state=open]:richtext-slide-in-from-left-1/2 data-[state=open]:richtext-slide-in-from-top-[48%] sm:richtext-rounded-lg",t),...i,children:[e,a.jsxs(r.Close,{className:"richtext-absolute richtext-right-4 richtext-top-4 richtext-rounded-sm richtext-opacity-70 richtext-ring-offset-background richtext-transition-opacity hover:richtext-opacity-100 focus:richtext-outline-none focus:richtext-ring-2 focus:richtext-ring-ring focus:richtext-ring-offset-1 disabled:richtext-pointer-events-none data-[state=open]:richtext-bg-accent data-[state=open]:richtext-text-muted-foreground",children:[a.jsx(u.X,{className:"richtext-size-4 richtext-text-accent-foreground"}),a.jsx("span",{className:"richtext-sr-only richtext-text-accent-foreground",children:"Close"})]})]})]}));l.displayName=r.Content.displayName;function d({className:t,...e}){return a.jsx("div",{className:c.cn("richtext-flex richtext-flex-col richtext-space-y-1.5 richtext-text-center sm:richtext-text-left",t),...e})}d.displayName="DialogHeader";function h({className:t,...e}){return a.jsx("div",{className:c.cn("richtext-flex richtext-flex-col-reverse sm:richtext-flex-row sm:richtext-justify-end sm:richtext-space-x-2",t),...e})}h.displayName="DialogFooter";const g=s.forwardRef(({className:t,...e},i)=>a.jsx(r.Title,{ref:i,className:c.cn("richtext-text-lg richtext-font-semibold richtext-leading-none richtext-tracking-tight richtext-text-foreground",t),...e}));g.displayName=r.Title.displayName;const N=s.forwardRef(({className:t,...e},i)=>a.jsx(r.Description,{className:c.cn("richtext-text-sm richtext-text-muted-foreground",t),ref:i,...e}));N.displayName=r.Description.displayName;exports.Dialog=p;exports.DialogContent=l;exports.DialogFooter=h;exports.DialogHeader=d;exports.DialogTitle=g;exports.DialogTrigger=D;
@@ -1,95 +0,0 @@
1
- import { jsx as i, jsxs as s } from "react/jsx-runtime";
2
- import * as t from "@radix-ui/react-dialog";
3
- import { X as l } from "lucide-react";
4
- import * as o from "react";
5
- import { c } from "./index-jMN4V2hr.js";
6
- const D = t.Root, b = t.Trigger, d = t.Portal, x = o.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ i(
7
- t.Overlay,
8
- {
9
- ref: r,
10
- className: c(
11
- "richtext-fixed richtext-inset-0 richtext-z-50 richtext-bg-black/80 data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0",
12
- e
13
- ),
14
- ...a
15
- }
16
- ));
17
- x.displayName = t.Overlay.displayName;
18
- const h = o.forwardRef(({ className: e, children: a, ...r }, n) => /* @__PURE__ */ s(d, { "data-richtext-portal": !0, children: [
19
- /* @__PURE__ */ i(x, {}),
20
- /* @__PURE__ */ s(
21
- t.Content,
22
- {
23
- "data-richtext-portal": !0,
24
- ref: n,
25
- className: c(
26
- "richtext-fixed richtext-left-[50%] richtext-top-[50%] richtext-z-50 richtext-grid richtext-w-full richtext-max-w-lg richtext-translate-x-[-50%] richtext-translate-y-[-50%] richtext-gap-4 richtext-border !richtext-border-border richtext-bg-background richtext-p-6 richtext-shadow-lg richtext-duration-200 data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0 data-[state=closed]:richtext-zoom-out-95 data-[state=open]:richtext-zoom-in-95 data-[state=closed]:richtext-slide-out-to-left-1/2 data-[state=closed]:richtext-slide-out-to-top-[48%] data-[state=open]:richtext-slide-in-from-left-1/2 data-[state=open]:richtext-slide-in-from-top-[48%] sm:richtext-rounded-lg",
27
- e
28
- ),
29
- ...r,
30
- children: [
31
- a,
32
- /* @__PURE__ */ s(t.Close, { className: "richtext-absolute richtext-right-4 richtext-top-4 richtext-rounded-sm richtext-opacity-70 richtext-ring-offset-background richtext-transition-opacity hover:richtext-opacity-100 focus:richtext-outline-none focus:richtext-ring-2 focus:richtext-ring-ring focus:richtext-ring-offset-1 disabled:richtext-pointer-events-none data-[state=open]:richtext-bg-accent data-[state=open]:richtext-text-muted-foreground", children: [
33
- /* @__PURE__ */ i(l, { className: "richtext-size-4 richtext-text-accent-foreground" }),
34
- /* @__PURE__ */ i("span", { className: "richtext-sr-only richtext-text-accent-foreground", children: "Close" })
35
- ] })
36
- ]
37
- }
38
- )
39
- ] }));
40
- h.displayName = t.Content.displayName;
41
- function m({ className: e, ...a }) {
42
- return /* @__PURE__ */ i(
43
- "div",
44
- {
45
- className: c(
46
- "richtext-flex richtext-flex-col richtext-space-y-1.5 richtext-text-center sm:richtext-text-left",
47
- e
48
- ),
49
- ...a
50
- }
51
- );
52
- }
53
- m.displayName = "DialogHeader";
54
- function f({ className: e, ...a }) {
55
- return /* @__PURE__ */ i(
56
- "div",
57
- {
58
- className: c(
59
- "richtext-flex richtext-flex-col-reverse sm:richtext-flex-row sm:richtext-justify-end sm:richtext-space-x-2",
60
- e
61
- ),
62
- ...a
63
- }
64
- );
65
- }
66
- f.displayName = "DialogFooter";
67
- const p = o.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ i(
68
- t.Title,
69
- {
70
- ref: r,
71
- className: c(
72
- "richtext-text-lg richtext-font-semibold richtext-leading-none richtext-tracking-tight richtext-text-foreground",
73
- e
74
- ),
75
- ...a
76
- }
77
- ));
78
- p.displayName = t.Title.displayName;
79
- const g = o.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ i(
80
- t.Description,
81
- {
82
- className: c("richtext-text-sm richtext-text-muted-foreground", e),
83
- ref: r,
84
- ...a
85
- }
86
- ));
87
- g.displayName = t.Description.displayName;
88
- export {
89
- D,
90
- b as a,
91
- h as b,
92
- p as c,
93
- f as d,
94
- m as e
95
- };
@@ -1 +0,0 @@
1
- "use strict";function d(e){try{return JSON.stringify(e)}catch{return JSON.stringify({})}}function g(e,n=!1){return r=>{const o=e.startsWith("data-")?e:`data-${e}`;let t=decodeURIComponent(r.getAttribute(o));if(t==null||typeof t=="string"&&t==="null")try{const c=r.outerHTML.match(/([\S\s])+?="([\S\s])+?"/g);c&&c.length>0&&(t=(c.map(a=>a.trim()).reduce((a,u)=>{const i=u.indexOf("="),f=[u.slice(0,i),u.slice(i+1).slice(1,-1)];return a[f[0]]=f[1],a},{})[e.toLowerCase()]||"").replaceAll(""",'"'))}catch(l){console.error("Error getDatasetAttribute ",l.message,r)}if(n)try{return JSON.parse(t)}catch{return{}}if(t.includes("%")||t.includes("auto"))return t;const s=Number.parseInt(t);return s!==s?t:s}}function p(e){const{attrs:n}=e;return Object.keys(n).reduce((r,o)=>{const t=n[o];if(t==null)return r;let s="";return typeof t=="object"?s=d(t):s=t,r[o]=s,r},Object.create(null))}exports.getDatasetAttribute=g;exports.nodeAttrsToDataset=p;
@@ -1,47 +0,0 @@
1
- function d(e) {
2
- try {
3
- return JSON.stringify(e);
4
- } catch {
5
- return JSON.stringify({});
6
- }
7
- }
8
- function p(e, s = !1) {
9
- return (r) => {
10
- const o = e.startsWith("data-") ? e : `data-${e}`;
11
- let t = decodeURIComponent(r.getAttribute(o));
12
- if (t == null || typeof t == "string" && t === "null")
13
- try {
14
- const c = r.outerHTML.match(/([\S\s])+?="([\S\s])+?"/g);
15
- c && c.length > 0 && (t = (c.map((a) => a.trim()).reduce((a, u) => {
16
- const i = u.indexOf("="), f = [u.slice(0, i), u.slice(i + 1).slice(1, -1)];
17
- return a[f[0]] = f[1], a;
18
- }, {})[e.toLowerCase()] || "").replaceAll(""", '"'));
19
- } catch (l) {
20
- console.error("Error getDatasetAttribute ", l.message, r);
21
- }
22
- if (s)
23
- try {
24
- return JSON.parse(t);
25
- } catch {
26
- return {};
27
- }
28
- if (t.includes("%") || t.includes("auto"))
29
- return t;
30
- const n = Number.parseInt(t);
31
- return n !== n ? t : n;
32
- };
33
- }
34
- function h(e) {
35
- const { attrs: s } = e;
36
- return Object.keys(s).reduce((r, o) => {
37
- const t = s[o];
38
- if (t == null)
39
- return r;
40
- let n = "";
41
- return typeof t == "object" ? n = d(t) : n = t, r[o] = n, r;
42
- }, /* @__PURE__ */ Object.create(null));
43
- }
44
- export {
45
- p as g,
46
- h as n
47
- };
@@ -1 +0,0 @@
1
- "use strict";const r=require("react/jsx-runtime"),o=require("react");function A(e){return e=e||new Map,{all:e,on(s,i){const t=e.get(s);t?t.push(i):e.set(s,[i])},off(s,i){const t=e.get(s);t&&(i?t.splice(t.indexOf(i)>>>0,1):e.set(s,[]))},emit(s,i){let t=e.get(s);t&&t.slice().map(n=>{n(i)}),t=e.get("*"),t&&t.slice().map(n=>{n(s,i)})}}}const c=A(),u=o.createContext(c),f=()=>o.useContext(u);function E(e,s){const i=f();o.useEffect(()=>(s.map(t=>i.on(t,e)),()=>{s.map(t=>i.off(t,e))}),[i,s,e])}const m=c.emit;function D({children:e}){return r.jsx(u.Provider,{value:c,children:e})}const L={UPLOAD_IMAGE:e=>`UPLOAD_IMAGE-${e}`,UPLOAD_VIDEO:e=>`UPLOAD_VIDEO-${e}`,UPLOAD_ATTACHMENT:e=>`UPLOAD_ATTACHMENT-${e}`,EXCALIDRAW:e=>`EXCALIDRAW-${e}`};exports.EVENTS=L;exports.ReactBusProvider=D;exports.emit=m;exports.useListener=E;
@@ -1,72 +0,0 @@
1
- import { jsx as u } from "react/jsx-runtime";
2
- import n from "react";
3
- function f(t) {
4
- return t = t || /* @__PURE__ */ new Map(), {
5
- /**
6
- * A Map of event names to registered handler functions.
7
- */
8
- all: t,
9
- /**
10
- * Register an event handler for the given type.
11
- * @param {string|symbol} type Type of event to listen for, or `'*'` for all events
12
- * @param {Function} handler Function to call in response to given event
13
- * @memberOf mitt
14
- */
15
- on(s, o) {
16
- const e = t.get(s);
17
- e ? e.push(o) : t.set(s, [o]);
18
- },
19
- /**
20
- * Remove an event handler for the given type.
21
- * If `handler` is omitted, all handlers of the given type are removed.
22
- * @param {string|symbol} type Type of event to unregister `handler` from (`'*'` to remove a wildcard handler)
23
- * @param {Function} [handler] Handler function to remove
24
- * @memberOf mitt
25
- */
26
- off(s, o) {
27
- const e = t.get(s);
28
- e && (o ? e.splice(e.indexOf(o) >>> 0, 1) : t.set(s, []));
29
- },
30
- /**
31
- * Invoke all handlers for the given type.
32
- * If present, `'*'` handlers are invoked after type-matched handlers.
33
- *
34
- * Note: Manually firing '*' handlers is not supported.
35
- *
36
- * @param {string|symbol} type The event type to invoke
37
- * @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler
38
- * @memberOf mitt
39
- */
40
- emit(s, o) {
41
- let e = t.get(s);
42
- e && e.slice().map((i) => {
43
- i(o);
44
- }), e = t.get("*"), e && e.slice().map((i) => {
45
- i(s, o);
46
- });
47
- }
48
- };
49
- }
50
- const c = f(), r = n.createContext(c), A = () => n.useContext(r);
51
- function D(t, s) {
52
- const o = A();
53
- n.useEffect(() => (s.map((e) => o.on(e, t)), () => {
54
- s.map((e) => o.off(e, t));
55
- }), [o, s, t]);
56
- }
57
- const L = c.emit;
58
- function O({ children: t }) {
59
- return /* @__PURE__ */ u(r.Provider, { value: c, children: t });
60
- }
61
- const P = {
62
- UPLOAD_IMAGE: (t) => `UPLOAD_IMAGE-${t}`,
63
- UPLOAD_VIDEO: (t) => `UPLOAD_VIDEO-${t}`,
64
- UPLOAD_ATTACHMENT: (t) => `UPLOAD_ATTACHMENT-${t}`,
65
- EXCALIDRAW: (t) => `EXCALIDRAW-${t}`
66
- };
67
- export {
68
- P as E,
69
- O as R,
70
- L as e,
71
- D as u
72
- };
@@ -1 +0,0 @@
1
- "use strict";function s(t){return t.replace(/^.*\/|\..+$/g,"")}function u(t){return t.split(".").pop()}function c(t){return t<1024?`${t} Byte`:t<1024*1024?`${(t/1024).toFixed(2)} KB`:`${(t/1024/1024).toFixed(2)} MB`}function l(t){return t?t==="application/pdf"?"pdf":t.startsWith("application/")&&[".document","word"].some(e=>t.includes(e))?"word":t.startsWith("application/")&&["presentation"].some(e=>t.includes(e))?"excel":t.startsWith("application/")&&["sheet"].some(e=>t.includes(e))?"ppt":t.startsWith("image")?"image":t.startsWith("audio")?"audio":t.startsWith("video")?"video":"file":"file"}function d(t){return new Promise(e=>{const r=new FileReader;r.addEventListener("load",()=>{e({alt:t.name,src:r.result})},!1),r.readAsDataURL(t)})}function m(t,e){const r=t.split(","),o=r[0].match(/:(.*?);/)[1],i=atob(r[r.length-1]);let n=i.length;const a=new Uint8Array(n);for(;n--;)a[n]=i.charCodeAt(n);return new File([a],e,{type:o})}exports.dataURLtoFile=m;exports.extractFileExtension=u;exports.extractFilename=s;exports.normalizeFileSize=c;exports.normalizeFileType=l;exports.readImageAsBase64=d;
@@ -1,43 +0,0 @@
1
- function o(t) {
2
- return t.replace(/^.*\/|\..+$/g, "");
3
- }
4
- function u(t) {
5
- return t.split(".").pop();
6
- }
7
- function c(t) {
8
- return t < 1024 ? `${t} Byte` : t < 1024 * 1024 ? `${(t / 1024).toFixed(2)} KB` : `${(t / 1024 / 1024).toFixed(2)} MB`;
9
- }
10
- function d(t) {
11
- return t ? t === "application/pdf" ? "pdf" : t.startsWith("application/") && [".document", "word"].some((r) => t.includes(r)) ? "word" : t.startsWith("application/") && ["presentation"].some((r) => t.includes(r)) ? "excel" : t.startsWith("application/") && ["sheet"].some((r) => t.includes(r)) ? "ppt" : t.startsWith("image") ? "image" : t.startsWith("audio") ? "audio" : t.startsWith("video") ? "video" : "file" : "file";
12
- }
13
- function l(t) {
14
- return new Promise((r) => {
15
- const n = new FileReader();
16
- n.addEventListener(
17
- "load",
18
- () => {
19
- r({
20
- alt: t.name,
21
- src: n.result
22
- });
23
- },
24
- !1
25
- ), n.readAsDataURL(t);
26
- });
27
- }
28
- function m(t, r) {
29
- const n = t.split(","), s = n[0].match(/:(.*?);/)[1], a = atob(n[n.length - 1]);
30
- let e = a.length;
31
- const i = new Uint8Array(e);
32
- for (; e--; )
33
- i[e] = a.charCodeAt(e);
34
- return new File([i], r, { type: s });
35
- }
36
- export {
37
- c as a,
38
- o as b,
39
- m as d,
40
- u as e,
41
- d as n,
42
- l as r
43
- };