@clevertask/scribe 0.0.14 → 0.1.0

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 (68) hide show
  1. package/README.md +26 -25
  2. package/dist/BarMenu-BDtEfu-R.js +327 -0
  3. package/dist/assets/index.css +1 -1
  4. package/dist/components/Menu/BarMenu.d.ts +0 -1
  5. package/dist/components/Menu/BarMenu.d.ts.map +1 -1
  6. package/dist/components/Menu/BarMenu.js +8 -119
  7. package/dist/components/Menu/BubbleMenu.d.ts.map +1 -1
  8. package/dist/components/Menu/BubbleMenu.js +2070 -159
  9. package/dist/components/Menu/Mobile/ListOptionBar.d.ts.map +1 -1
  10. package/dist/components/Menu/Mobile/ListOptionBar.js +42 -34
  11. package/dist/components/Scribe/extension/emoji/EmojiList.d.ts +19 -1
  12. package/dist/components/Scribe/extension/emoji/EmojiList.d.ts.map +1 -1
  13. package/dist/components/Scribe/extension/emoji/EmojiList.js +38 -27
  14. package/dist/components/Scribe/extension/emoji/suggest.d.ts +2 -4
  15. package/dist/components/Scribe/extension/emoji/suggest.d.ts.map +1 -1
  16. package/dist/components/Scribe/extension/emoji/suggest.js +20 -15
  17. package/dist/components/Scribe/extension/extension-link.d.ts.map +1 -1
  18. package/dist/components/Scribe/extension/extension-link.js +2 -986
  19. package/dist/components/Scribe/extension/extension-markdown-paste.d.ts +4 -0
  20. package/dist/components/Scribe/extension/extension-markdown-paste.d.ts.map +1 -0
  21. package/dist/components/Scribe/extension/extension-markdown-paste.js +46 -0
  22. package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
  23. package/dist/components/Scribe/extension/getPopupMountTarget.d.ts +3 -0
  24. package/dist/components/Scribe/extension/getPopupMountTarget.d.ts.map +1 -0
  25. package/dist/components/Scribe/extension/getPopupMountTarget.js +16 -0
  26. package/dist/components/Scribe/extension/index.d.ts +1 -1
  27. package/dist/components/Scribe/extension/index.d.ts.map +1 -1
  28. package/dist/components/Scribe/extension/index.js +37047 -32
  29. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.d.ts +4 -1
  30. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.d.ts.map +1 -1
  31. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +3732 -13
  32. package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
  33. package/dist/components/Scribe/extension/slashCommand/items.d.ts.map +1 -1
  34. package/dist/components/Scribe/extension/slashCommand/renderItems.d.ts +1 -1
  35. package/dist/components/Scribe/extension/slashCommand/renderItems.d.ts.map +1 -1
  36. package/dist/components/Scribe/extension/slashCommand/renderItems.js +21 -16
  37. package/dist/components/Scribe/index.d.ts +0 -1
  38. package/dist/components/Scribe/index.d.ts.map +1 -1
  39. package/dist/components/Scribe/index.js +83 -90
  40. package/dist/extension-link-D3eyOFkn.js +1030 -0
  41. package/dist/icons/ToolbarIcons.d.ts +19 -0
  42. package/dist/icons/ToolbarIcons.d.ts.map +1 -0
  43. package/dist/icons/ToolbarIcons.js +135 -0
  44. package/dist/index-DZylq4Bc.js +232 -0
  45. package/dist/index-FY_iYS6i.js +1410 -0
  46. package/dist/index-PJNQPLn5.js +841 -0
  47. package/dist/{index-flsxByQS.js → index-hHvpW2H6.js} +6552 -5417
  48. package/dist/main.css +200 -1120
  49. package/dist/main.js +1 -1
  50. package/dist/markdown-to-html-BwS08CTi.js +1135 -0
  51. package/dist/{purify.es-BRDuGiV2.js → purify.es-BPDBzHtc.js} +1 -1
  52. package/dist/tippy.esm-DLHdsnfG.js +1711 -0
  53. package/dist/utils/convert-legacy-math-delimiters.d.ts.map +1 -1
  54. package/dist/utils/create-scribe-editor.d.ts +3 -3
  55. package/dist/utils/create-scribe-editor.d.ts.map +1 -1
  56. package/dist/utils/create-scribe-editor.js +8 -4
  57. package/dist/utils/html-to-markdown.d.ts.map +1 -1
  58. package/dist/utils/html-to-markdown.js +663 -18
  59. package/dist/utils/index.d.ts +1 -1
  60. package/dist/utils/index.js +3 -3
  61. package/dist/utils/markdown-to-html.js +3 -4
  62. package/package.json +59 -62
  63. package/dist/clsx-OuTLNxxd.js +0 -16
  64. package/dist/index-BfaHEr44.js +0 -159
  65. package/dist/index-Bvgjhwaj.js +0 -2349
  66. package/dist/index-DAuPG8ME.js +0 -50919
  67. package/dist/marked.esm-H7n4rMcO.js +0 -1554
  68. package/dist/turndown.browser.es-RmA_HBaI.js +0 -649
@@ -0,0 +1,841 @@
1
+ import A, { useState as ce, useDebugValue as le, forwardRef as fe, version as z, useLayoutEffect as de, useEffect as he, useContext as B, createContext as U, useMemo as k } from "react";
2
+ import pe, { flushSync as me } from "react-dom";
3
+ import { jsx as R, jsxs as Ee, Fragment as ie } from "react/jsx-runtime";
4
+ var L = { exports: {} }, I = {};
5
+ var K;
6
+ function ve() {
7
+ if (K) return I;
8
+ K = 1;
9
+ var e = A;
10
+ function t(d, E) {
11
+ return d === E && (d !== 0 || 1 / d === 1 / E) || d !== d && E !== E;
12
+ }
13
+ var r = typeof Object.is == "function" ? Object.is : t, n = e.useState, o = e.useEffect, a = e.useLayoutEffect, u = e.useDebugValue;
14
+ function s(d, E) {
15
+ var c = E(), f = n({ inst: { value: c, getSnapshot: E } }), p = f[0].inst, i = f[1];
16
+ return a(
17
+ function() {
18
+ p.value = c, p.getSnapshot = E, y(p) && i({ inst: p });
19
+ },
20
+ [d, c, E]
21
+ ), o(
22
+ function() {
23
+ return y(p) && i({ inst: p }), d(function() {
24
+ y(p) && i({ inst: p });
25
+ });
26
+ },
27
+ [d]
28
+ ), u(c), c;
29
+ }
30
+ function y(d) {
31
+ var E = d.getSnapshot;
32
+ d = d.value;
33
+ try {
34
+ var c = E();
35
+ return !r(d, c);
36
+ } catch {
37
+ return !0;
38
+ }
39
+ }
40
+ function v(d, E) {
41
+ return E();
42
+ }
43
+ var h = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? v : s;
44
+ return I.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : h, I;
45
+ }
46
+ var D = {};
47
+ var H;
48
+ function ye() {
49
+ return H || (H = 1, process.env.NODE_ENV !== "production" && (function() {
50
+ function e(c, f) {
51
+ return c === f && (c !== 0 || 1 / c === 1 / f) || c !== c && f !== f;
52
+ }
53
+ function t(c, f) {
54
+ h || o.startTransition === void 0 || (h = !0, console.error(
55
+ "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
56
+ ));
57
+ var p = f();
58
+ if (!d) {
59
+ var i = f();
60
+ a(p, i) || (console.error(
61
+ "The result of getSnapshot should be cached to avoid an infinite loop"
62
+ ), d = !0);
63
+ }
64
+ i = u({
65
+ inst: { value: p, getSnapshot: f }
66
+ });
67
+ var l = i[0].inst, m = i[1];
68
+ return y(
69
+ function() {
70
+ l.value = p, l.getSnapshot = f, r(l) && m({ inst: l });
71
+ },
72
+ [c, p, f]
73
+ ), s(
74
+ function() {
75
+ return r(l) && m({ inst: l }), c(function() {
76
+ r(l) && m({ inst: l });
77
+ });
78
+ },
79
+ [c]
80
+ ), v(p), p;
81
+ }
82
+ function r(c) {
83
+ var f = c.getSnapshot;
84
+ c = c.value;
85
+ try {
86
+ var p = f();
87
+ return !a(c, p);
88
+ } catch {
89
+ return !0;
90
+ }
91
+ }
92
+ function n(c, f) {
93
+ return f();
94
+ }
95
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
96
+ var o = A, a = typeof Object.is == "function" ? Object.is : e, u = o.useState, s = o.useEffect, y = o.useLayoutEffect, v = o.useDebugValue, h = !1, d = !1, E = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? n : t;
97
+ D.useSyncExternalStore = o.useSyncExternalStore !== void 0 ? o.useSyncExternalStore : E, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
98
+ })()), D;
99
+ }
100
+ var F;
101
+ function $() {
102
+ return F || (F = 1, process.env.NODE_ENV === "production" ? L.exports = ve() : L.exports = ye()), L.exports;
103
+ }
104
+ var _e = $();
105
+ const { getOwnPropertyNames: Se, getOwnPropertySymbols: Oe } = Object, { hasOwnProperty: be } = Object.prototype;
106
+ function x(e, t) {
107
+ return function(n, o, a) {
108
+ return e(n, o, a) && t(n, o, a);
109
+ };
110
+ }
111
+ function q(e) {
112
+ return function(r, n, o) {
113
+ if (!r || !n || typeof r != "object" || typeof n != "object")
114
+ return e(r, n, o);
115
+ const { cache: a } = o, u = a.get(r), s = a.get(n);
116
+ if (u && s)
117
+ return u === n && s === r;
118
+ a.set(r, n), a.set(n, r);
119
+ const y = e(r, n, o);
120
+ return a.delete(r), a.delete(n), y;
121
+ };
122
+ }
123
+ function ge(e) {
124
+ return e?.[Symbol.toStringTag];
125
+ }
126
+ function Y(e) {
127
+ return Se(e).concat(Oe(e));
128
+ }
129
+ const Ae = (
130
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
131
+ Object.hasOwn || ((e, t) => be.call(e, t))
132
+ );
133
+ function C(e, t) {
134
+ return e === t || !e && !t && e !== e && t !== t;
135
+ }
136
+ const Re = "__v", we = "__o", Ce = "_owner", { getOwnPropertyDescriptor: J, keys: X } = Object;
137
+ function Te(e, t) {
138
+ return e.byteLength === t.byteLength && V(new Uint8Array(e), new Uint8Array(t));
139
+ }
140
+ function je(e, t, r) {
141
+ let n = e.length;
142
+ if (t.length !== n)
143
+ return !1;
144
+ for (; n-- > 0; )
145
+ if (!r.equals(e[n], t[n], n, n, e, t, r))
146
+ return !1;
147
+ return !0;
148
+ }
149
+ function Le(e, t) {
150
+ return e.byteLength === t.byteLength && V(new Uint8Array(e.buffer, e.byteOffset, e.byteLength), new Uint8Array(t.buffer, t.byteOffset, t.byteLength));
151
+ }
152
+ function qe(e, t) {
153
+ return C(e.getTime(), t.getTime());
154
+ }
155
+ function Ne(e, t) {
156
+ return e.name === t.name && e.message === t.message && e.cause === t.cause && e.stack === t.stack;
157
+ }
158
+ function Ve(e, t) {
159
+ return e === t;
160
+ }
161
+ function Z(e, t, r) {
162
+ const n = e.size;
163
+ if (n !== t.size)
164
+ return !1;
165
+ if (!n)
166
+ return !0;
167
+ const o = new Array(n), a = e.entries();
168
+ let u, s, y = 0;
169
+ for (; (u = a.next()) && !u.done; ) {
170
+ const v = t.entries();
171
+ let h = !1, d = 0;
172
+ for (; (s = v.next()) && !s.done; ) {
173
+ if (o[d]) {
174
+ d++;
175
+ continue;
176
+ }
177
+ const E = u.value, c = s.value;
178
+ if (r.equals(E[0], c[0], y, d, e, t, r) && r.equals(E[1], c[1], E[0], c[0], e, t, r)) {
179
+ h = o[d] = !0;
180
+ break;
181
+ }
182
+ d++;
183
+ }
184
+ if (!h)
185
+ return !1;
186
+ y++;
187
+ }
188
+ return !0;
189
+ }
190
+ const Ie = C;
191
+ function De(e, t, r) {
192
+ const n = X(e);
193
+ let o = n.length;
194
+ if (X(t).length !== o)
195
+ return !1;
196
+ for (; o-- > 0; )
197
+ if (!ue(e, t, r, n[o]))
198
+ return !1;
199
+ return !0;
200
+ }
201
+ function j(e, t, r) {
202
+ const n = Y(e);
203
+ let o = n.length;
204
+ if (Y(t).length !== o)
205
+ return !1;
206
+ let a, u, s;
207
+ for (; o-- > 0; )
208
+ if (a = n[o], !ue(e, t, r, a) || (u = J(e, a), s = J(t, a), (u || s) && (!u || !s || u.configurable !== s.configurable || u.enumerable !== s.enumerable || u.writable !== s.writable)))
209
+ return !1;
210
+ return !0;
211
+ }
212
+ function xe(e, t) {
213
+ return C(e.valueOf(), t.valueOf());
214
+ }
215
+ function Me(e, t) {
216
+ return e.source === t.source && e.flags === t.flags;
217
+ }
218
+ function Q(e, t, r) {
219
+ const n = e.size;
220
+ if (n !== t.size)
221
+ return !1;
222
+ if (!n)
223
+ return !0;
224
+ const o = new Array(n), a = e.values();
225
+ let u, s;
226
+ for (; (u = a.next()) && !u.done; ) {
227
+ const y = t.values();
228
+ let v = !1, h = 0;
229
+ for (; (s = y.next()) && !s.done; ) {
230
+ if (!o[h] && r.equals(u.value, s.value, u.value, s.value, e, t, r)) {
231
+ v = o[h] = !0;
232
+ break;
233
+ }
234
+ h++;
235
+ }
236
+ if (!v)
237
+ return !1;
238
+ }
239
+ return !0;
240
+ }
241
+ function V(e, t) {
242
+ let r = e.byteLength;
243
+ if (t.byteLength !== r || e.byteOffset !== t.byteOffset)
244
+ return !1;
245
+ for (; r-- > 0; )
246
+ if (e[r] !== t[r])
247
+ return !1;
248
+ return !0;
249
+ }
250
+ function Ge(e, t) {
251
+ return e.hostname === t.hostname && e.pathname === t.pathname && e.protocol === t.protocol && e.port === t.port && e.hash === t.hash && e.username === t.username && e.password === t.password;
252
+ }
253
+ function ue(e, t, r, n) {
254
+ return (n === Ce || n === we || n === Re) && (e.$$typeof || t.$$typeof) ? !0 : Ae(t, n) && r.equals(e[n], t[n], n, n, e, t, r);
255
+ }
256
+ const Be = "[object ArrayBuffer]", Ue = "[object Arguments]", $e = "[object Boolean]", Pe = "[object DataView]", We = "[object Date]", ze = "[object Error]", ke = "[object Map]", Ke = "[object Number]", He = "[object Object]", Fe = "[object RegExp]", Ye = "[object Set]", Je = "[object String]", Xe = {
257
+ "[object Int8Array]": !0,
258
+ "[object Uint8Array]": !0,
259
+ "[object Uint8ClampedArray]": !0,
260
+ "[object Int16Array]": !0,
261
+ "[object Uint16Array]": !0,
262
+ "[object Int32Array]": !0,
263
+ "[object Uint32Array]": !0,
264
+ "[object Float16Array]": !0,
265
+ "[object Float32Array]": !0,
266
+ "[object Float64Array]": !0,
267
+ "[object BigInt64Array]": !0,
268
+ "[object BigUint64Array]": !0
269
+ }, Ze = "[object URL]", Qe = Object.prototype.toString;
270
+ function et({ areArrayBuffersEqual: e, areArraysEqual: t, areDataViewsEqual: r, areDatesEqual: n, areErrorsEqual: o, areFunctionsEqual: a, areMapsEqual: u, areNumbersEqual: s, areObjectsEqual: y, arePrimitiveWrappersEqual: v, areRegExpsEqual: h, areSetsEqual: d, areTypedArraysEqual: E, areUrlsEqual: c, unknownTagComparators: f }) {
271
+ return function(i, l, m) {
272
+ if (i === l)
273
+ return !0;
274
+ if (i == null || l == null)
275
+ return !1;
276
+ const g = typeof i;
277
+ if (g !== typeof l)
278
+ return !1;
279
+ if (g !== "object")
280
+ return g === "number" ? s(i, l, m) : g === "function" ? a(i, l, m) : !1;
281
+ const O = i.constructor;
282
+ if (O !== l.constructor)
283
+ return !1;
284
+ if (O === Object)
285
+ return y(i, l, m);
286
+ if (Array.isArray(i))
287
+ return t(i, l, m);
288
+ if (O === Date)
289
+ return n(i, l, m);
290
+ if (O === RegExp)
291
+ return h(i, l, m);
292
+ if (O === Map)
293
+ return u(i, l, m);
294
+ if (O === Set)
295
+ return d(i, l, m);
296
+ const S = Qe.call(i);
297
+ if (S === We)
298
+ return n(i, l, m);
299
+ if (S === Fe)
300
+ return h(i, l, m);
301
+ if (S === ke)
302
+ return u(i, l, m);
303
+ if (S === Ye)
304
+ return d(i, l, m);
305
+ if (S === He)
306
+ return typeof i.then != "function" && typeof l.then != "function" && y(i, l, m);
307
+ if (S === Ze)
308
+ return c(i, l, m);
309
+ if (S === ze)
310
+ return o(i, l, m);
311
+ if (S === Ue)
312
+ return y(i, l, m);
313
+ if (Xe[S])
314
+ return E(i, l, m);
315
+ if (S === Be)
316
+ return e(i, l, m);
317
+ if (S === Pe)
318
+ return r(i, l, m);
319
+ if (S === $e || S === Ke || S === Je)
320
+ return v(i, l, m);
321
+ if (f) {
322
+ let _ = f[S];
323
+ if (!_) {
324
+ const b = ge(i);
325
+ b && (_ = f[b]);
326
+ }
327
+ if (_)
328
+ return _(i, l, m);
329
+ }
330
+ return !1;
331
+ };
332
+ }
333
+ function tt({ circular: e, createCustomConfig: t, strict: r }) {
334
+ let n = {
335
+ areArrayBuffersEqual: Te,
336
+ areArraysEqual: r ? j : je,
337
+ areDataViewsEqual: Le,
338
+ areDatesEqual: qe,
339
+ areErrorsEqual: Ne,
340
+ areFunctionsEqual: Ve,
341
+ areMapsEqual: r ? x(Z, j) : Z,
342
+ areNumbersEqual: Ie,
343
+ areObjectsEqual: r ? j : De,
344
+ arePrimitiveWrappersEqual: xe,
345
+ areRegExpsEqual: Me,
346
+ areSetsEqual: r ? x(Q, j) : Q,
347
+ areTypedArraysEqual: r ? x(V, j) : V,
348
+ areUrlsEqual: Ge,
349
+ unknownTagComparators: void 0
350
+ };
351
+ if (t && (n = Object.assign({}, n, t(n))), e) {
352
+ const o = q(n.areArraysEqual), a = q(n.areMapsEqual), u = q(n.areObjectsEqual), s = q(n.areSetsEqual);
353
+ n = Object.assign({}, n, {
354
+ areArraysEqual: o,
355
+ areMapsEqual: a,
356
+ areObjectsEqual: u,
357
+ areSetsEqual: s
358
+ });
359
+ }
360
+ return n;
361
+ }
362
+ function rt(e) {
363
+ return function(t, r, n, o, a, u, s) {
364
+ return e(t, r, s);
365
+ };
366
+ }
367
+ function nt({ circular: e, comparator: t, createState: r, equals: n, strict: o }) {
368
+ if (r)
369
+ return function(s, y) {
370
+ const { cache: v = e ? /* @__PURE__ */ new WeakMap() : void 0, meta: h } = r();
371
+ return t(s, y, {
372
+ cache: v,
373
+ equals: n,
374
+ meta: h,
375
+ strict: o
376
+ });
377
+ };
378
+ if (e)
379
+ return function(s, y) {
380
+ return t(s, y, {
381
+ cache: /* @__PURE__ */ new WeakMap(),
382
+ equals: n,
383
+ meta: void 0,
384
+ strict: o
385
+ });
386
+ };
387
+ const a = {
388
+ cache: void 0,
389
+ equals: n,
390
+ meta: void 0,
391
+ strict: o
392
+ };
393
+ return function(s, y) {
394
+ return t(s, y, a);
395
+ };
396
+ }
397
+ const ot = w();
398
+ w({ strict: !0 });
399
+ w({ circular: !0 });
400
+ w({
401
+ circular: !0,
402
+ strict: !0
403
+ });
404
+ w({
405
+ createInternalComparator: () => C
406
+ });
407
+ w({
408
+ strict: !0,
409
+ createInternalComparator: () => C
410
+ });
411
+ w({
412
+ circular: !0,
413
+ createInternalComparator: () => C
414
+ });
415
+ w({
416
+ circular: !0,
417
+ createInternalComparator: () => C,
418
+ strict: !0
419
+ });
420
+ function w(e = {}) {
421
+ const { circular: t = !1, createInternalComparator: r, createState: n, strict: o = !1 } = e, a = tt(e), u = et(a), s = r ? r(u) : rt(u);
422
+ return nt({ circular: t, comparator: u, createState: n, equals: s, strict: o });
423
+ }
424
+ var N = { exports: {} }, M = {};
425
+ var ee;
426
+ function it() {
427
+ if (ee) return M;
428
+ ee = 1;
429
+ var e = A, t = $();
430
+ function r(v, h) {
431
+ return v === h && (v !== 0 || 1 / v === 1 / h) || v !== v && h !== h;
432
+ }
433
+ var n = typeof Object.is == "function" ? Object.is : r, o = t.useSyncExternalStore, a = e.useRef, u = e.useEffect, s = e.useMemo, y = e.useDebugValue;
434
+ return M.useSyncExternalStoreWithSelector = function(v, h, d, E, c) {
435
+ var f = a(null);
436
+ if (f.current === null) {
437
+ var p = { hasValue: !1, value: null };
438
+ f.current = p;
439
+ } else p = f.current;
440
+ f = s(
441
+ function() {
442
+ function l(_) {
443
+ if (!m) {
444
+ if (m = !0, g = _, _ = E(_), c !== void 0 && p.hasValue) {
445
+ var b = p.value;
446
+ if (c(b, _))
447
+ return O = b;
448
+ }
449
+ return O = _;
450
+ }
451
+ if (b = O, n(g, _)) return b;
452
+ var T = E(_);
453
+ return c !== void 0 && c(b, T) ? (g = _, b) : (g = _, O = T);
454
+ }
455
+ var m = !1, g, O, S = d === void 0 ? null : d;
456
+ return [
457
+ function() {
458
+ return l(h());
459
+ },
460
+ S === null ? void 0 : function() {
461
+ return l(S());
462
+ }
463
+ ];
464
+ },
465
+ [h, d, E, c]
466
+ );
467
+ var i = o(v, f[0], f[1]);
468
+ return u(
469
+ function() {
470
+ p.hasValue = !0, p.value = i;
471
+ },
472
+ [i]
473
+ ), y(i), i;
474
+ }, M;
475
+ }
476
+ var G = {};
477
+ var te;
478
+ function ut() {
479
+ return te || (te = 1, process.env.NODE_ENV !== "production" && (function() {
480
+ function e(v, h) {
481
+ return v === h && (v !== 0 || 1 / v === 1 / h) || v !== v && h !== h;
482
+ }
483
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
484
+ var t = A, r = $(), n = typeof Object.is == "function" ? Object.is : e, o = r.useSyncExternalStore, a = t.useRef, u = t.useEffect, s = t.useMemo, y = t.useDebugValue;
485
+ G.useSyncExternalStoreWithSelector = function(v, h, d, E, c) {
486
+ var f = a(null);
487
+ if (f.current === null) {
488
+ var p = { hasValue: !1, value: null };
489
+ f.current = p;
490
+ } else p = f.current;
491
+ f = s(
492
+ function() {
493
+ function l(_) {
494
+ if (!m) {
495
+ if (m = !0, g = _, _ = E(_), c !== void 0 && p.hasValue) {
496
+ var b = p.value;
497
+ if (c(b, _))
498
+ return O = b;
499
+ }
500
+ return O = _;
501
+ }
502
+ if (b = O, n(g, _))
503
+ return b;
504
+ var T = E(_);
505
+ return c !== void 0 && c(b, T) ? (g = _, b) : (g = _, O = T);
506
+ }
507
+ var m = !1, g, O, S = d === void 0 ? null : d;
508
+ return [
509
+ function() {
510
+ return l(h());
511
+ },
512
+ S === null ? void 0 : function() {
513
+ return l(S());
514
+ }
515
+ ];
516
+ },
517
+ [h, d, E, c]
518
+ );
519
+ var i = o(v, f[0], f[1]);
520
+ return u(
521
+ function() {
522
+ p.hasValue = !0, p.value = i;
523
+ },
524
+ [i]
525
+ ), y(i), i;
526
+ }, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
527
+ })()), G;
528
+ }
529
+ var re;
530
+ function st() {
531
+ return re || (re = 1, process.env.NODE_ENV === "production" ? N.exports = it() : N.exports = ut()), N.exports;
532
+ }
533
+ var at = st(), ct = (...e) => (t) => {
534
+ e.forEach((r) => {
535
+ typeof r == "function" ? r(t) : r && (r.current = t);
536
+ });
537
+ }, lt = ({ contentComponent: e }) => {
538
+ const t = _e.useSyncExternalStore(
539
+ e.subscribe,
540
+ e.getSnapshot,
541
+ e.getServerSnapshot
542
+ );
543
+ return /* @__PURE__ */ R(ie, { children: Object.values(t) });
544
+ };
545
+ function ft() {
546
+ const e = /* @__PURE__ */ new Set();
547
+ let t = {};
548
+ return {
549
+ /**
550
+ * Subscribe to the editor instance's changes.
551
+ */
552
+ subscribe(r) {
553
+ return e.add(r), () => {
554
+ e.delete(r);
555
+ };
556
+ },
557
+ getSnapshot() {
558
+ return t;
559
+ },
560
+ getServerSnapshot() {
561
+ return t;
562
+ },
563
+ /**
564
+ * Adds a new NodeView Renderer to the editor.
565
+ */
566
+ setRenderer(r, n) {
567
+ t = {
568
+ ...t,
569
+ [r]: pe.createPortal(n.reactElement, n.element, r)
570
+ }, e.forEach((o) => o());
571
+ },
572
+ /**
573
+ * Removes a NodeView Renderer from the editor.
574
+ */
575
+ removeRenderer(r) {
576
+ const n = { ...t };
577
+ delete n[r], t = n, e.forEach((o) => o());
578
+ }
579
+ };
580
+ }
581
+ var dt = class extends A.Component {
582
+ constructor(e) {
583
+ var t;
584
+ super(e), this.editorContentRef = A.createRef(), this.initialized = !1, this.state = {
585
+ hasContentComponentInitialized: !!((t = e.editor) != null && t.contentComponent)
586
+ };
587
+ }
588
+ componentDidMount() {
589
+ this.init();
590
+ }
591
+ componentDidUpdate() {
592
+ this.init();
593
+ }
594
+ init() {
595
+ var e;
596
+ const t = this.props.editor;
597
+ if (t && !t.isDestroyed && ((e = t.view.dom) != null && e.parentNode)) {
598
+ if (t.contentComponent)
599
+ return;
600
+ const r = this.editorContentRef.current;
601
+ r.append(...t.view.dom.parentNode.childNodes), t.setOptions({
602
+ element: r
603
+ }), t.contentComponent = ft(), this.state.hasContentComponentInitialized || (this.unsubscribeToContentComponent = t.contentComponent.subscribe(() => {
604
+ this.setState((n) => n.hasContentComponentInitialized ? n : {
605
+ hasContentComponentInitialized: !0
606
+ }), this.unsubscribeToContentComponent && this.unsubscribeToContentComponent();
607
+ })), t.createNodeViews(), this.initialized = !0;
608
+ }
609
+ }
610
+ componentWillUnmount() {
611
+ var e;
612
+ const t = this.props.editor;
613
+ if (t) {
614
+ this.initialized = !1, t.isDestroyed || t.view.setProps({
615
+ nodeViews: {}
616
+ }), this.unsubscribeToContentComponent && this.unsubscribeToContentComponent(), t.contentComponent = null;
617
+ try {
618
+ if (!((e = t.view.dom) != null && e.parentNode))
619
+ return;
620
+ const r = document.createElement("div");
621
+ r.append(...t.view.dom.parentNode.childNodes), t.setOptions({
622
+ element: r
623
+ });
624
+ } catch {
625
+ }
626
+ }
627
+ }
628
+ render() {
629
+ const { editor: e, innerRef: t, ...r } = this.props;
630
+ return /* @__PURE__ */ Ee(ie, { children: [
631
+ /* @__PURE__ */ R("div", { ref: ct(t, this.editorContentRef), ...r }),
632
+ e?.contentComponent && /* @__PURE__ */ R(lt, { contentComponent: e.contentComponent })
633
+ ] });
634
+ }
635
+ }, ht = fe(
636
+ (e, t) => {
637
+ const r = A.useMemo(() => Math.floor(Math.random() * 4294967295).toString(), [e.editor]);
638
+ return A.createElement(dt, {
639
+ key: r,
640
+ innerRef: t,
641
+ ...e
642
+ });
643
+ }
644
+ ), pt = A.memo(ht), mt = typeof window < "u" ? de : he, Et = class {
645
+ constructor(e) {
646
+ this.transactionNumber = 0, this.lastTransactionNumber = 0, this.subscribers = /* @__PURE__ */ new Set(), this.editor = e, this.lastSnapshot = { editor: e, transactionNumber: 0 }, this.getSnapshot = this.getSnapshot.bind(this), this.getServerSnapshot = this.getServerSnapshot.bind(this), this.watch = this.watch.bind(this), this.subscribe = this.subscribe.bind(this);
647
+ }
648
+ /**
649
+ * Get the current editor instance.
650
+ */
651
+ getSnapshot() {
652
+ return this.transactionNumber === this.lastTransactionNumber ? this.lastSnapshot : (this.lastTransactionNumber = this.transactionNumber, this.lastSnapshot = { editor: this.editor, transactionNumber: this.transactionNumber }, this.lastSnapshot);
653
+ }
654
+ /**
655
+ * Always disable the editor on the server-side.
656
+ */
657
+ getServerSnapshot() {
658
+ return { editor: null, transactionNumber: 0 };
659
+ }
660
+ /**
661
+ * Subscribe to the editor instance's changes.
662
+ */
663
+ subscribe(e) {
664
+ return this.subscribers.add(e), () => {
665
+ this.subscribers.delete(e);
666
+ };
667
+ }
668
+ /**
669
+ * Watch the editor instance for changes.
670
+ */
671
+ watch(e) {
672
+ if (this.editor = e, this.editor) {
673
+ const t = () => {
674
+ this.transactionNumber += 1, this.subscribers.forEach((n) => n());
675
+ }, r = this.editor;
676
+ return r.on("transaction", t), () => {
677
+ r.off("transaction", t);
678
+ };
679
+ }
680
+ }
681
+ };
682
+ function wt(e) {
683
+ var t;
684
+ const [r] = ce(() => new Et(e.editor)), n = at.useSyncExternalStoreWithSelector(
685
+ r.subscribe,
686
+ r.getSnapshot,
687
+ r.getServerSnapshot,
688
+ e.selector,
689
+ (t = e.equalityFn) != null ? t : ot
690
+ );
691
+ return mt(() => r.watch(e.editor), [e.editor, r]), le(n), n;
692
+ }
693
+ process.env.NODE_ENV;
694
+ var P = U({
695
+ editor: null
696
+ });
697
+ P.Consumer;
698
+ var Ct = () => B(P), vt = U({
699
+ onDragStart: () => {
700
+ },
701
+ nodeViewContentChildren: void 0,
702
+ nodeViewContentRef: () => {
703
+ }
704
+ }), yt = () => B(vt);
705
+ A.forwardRef((e, t) => {
706
+ const { onDragStart: r } = yt(), n = e.as || "div";
707
+ return (
708
+ // @ts-ignore
709
+ /* @__PURE__ */ R(
710
+ n,
711
+ {
712
+ ...e,
713
+ ref: t,
714
+ "data-node-view-wrapper": "",
715
+ onDragStart: r,
716
+ style: {
717
+ whiteSpace: "normal",
718
+ ...e.style
719
+ }
720
+ }
721
+ )
722
+ );
723
+ });
724
+ function ne(e) {
725
+ return !!(typeof e == "function" && e.prototype && e.prototype.isReactComponent);
726
+ }
727
+ function oe(e) {
728
+ return !!(typeof e == "object" && e.$$typeof && (e.$$typeof.toString() === "Symbol(react.forward_ref)" || e.$$typeof.description === "react.forward_ref"));
729
+ }
730
+ function _t(e) {
731
+ return !!(typeof e == "object" && e.$$typeof && (e.$$typeof.toString() === "Symbol(react.memo)" || e.$$typeof.description === "react.memo"));
732
+ }
733
+ function St(e) {
734
+ if (ne(e) || oe(e))
735
+ return !0;
736
+ if (_t(e)) {
737
+ const t = e.type;
738
+ if (t)
739
+ return ne(t) || oe(t);
740
+ }
741
+ return !1;
742
+ }
743
+ function Ot() {
744
+ try {
745
+ if (z)
746
+ return parseInt(z.split(".")[0], 10) >= 19;
747
+ } catch {
748
+ }
749
+ return !1;
750
+ }
751
+ var Tt = class {
752
+ /**
753
+ * Immediately creates element and renders the provided React component.
754
+ */
755
+ constructor(e, { editor: t, props: r = {}, as: n = "div", className: o = "" }) {
756
+ this.ref = null, this.destroyed = !1, this.id = Math.floor(Math.random() * 4294967295).toString(), this.component = e, this.editor = t, this.props = r, this.element = document.createElement(n), this.element.classList.add("react-renderer"), o && this.element.classList.add(...o.split(" ")), this.editor.isInitialized ? me(() => {
757
+ this.render();
758
+ }) : queueMicrotask(() => {
759
+ this.destroyed || this.render();
760
+ });
761
+ }
762
+ /**
763
+ * Render the React component.
764
+ */
765
+ render() {
766
+ var e;
767
+ if (this.destroyed)
768
+ return;
769
+ const t = this.component, r = this.props, n = this.editor, o = Ot(), a = St(t), u = { ...r };
770
+ u.ref && !(o || a) && delete u.ref, !u.ref && (o || a) && (u.ref = (s) => {
771
+ this.ref = s;
772
+ }), this.reactElement = /* @__PURE__ */ R(t, { ...u }), (e = n?.contentComponent) == null || e.setRenderer(this.id, this);
773
+ }
774
+ /**
775
+ * Re-renders the React component with new props.
776
+ */
777
+ updateProps(e = {}) {
778
+ this.destroyed || (this.props = {
779
+ ...this.props,
780
+ ...e
781
+ }, this.render());
782
+ }
783
+ /**
784
+ * Destroy the React component.
785
+ */
786
+ destroy() {
787
+ var e;
788
+ this.destroyed = !0;
789
+ const t = this.editor;
790
+ (e = t?.contentComponent) == null || e.removeRenderer(this.id);
791
+ try {
792
+ this.element && this.element.parentNode && this.element.parentNode.removeChild(this.element);
793
+ } catch {
794
+ }
795
+ }
796
+ /**
797
+ * Update the attributes of the element that holds the React component.
798
+ */
799
+ updateAttributes(e) {
800
+ Object.keys(e).forEach((t) => {
801
+ this.element.setAttribute(t, e[t]);
802
+ });
803
+ }
804
+ };
805
+ A.createContext({
806
+ markViewContentRef: () => {
807
+ }
808
+ });
809
+ var W = U({
810
+ get editor() {
811
+ throw new Error("useTiptap must be used within a <Tiptap> provider");
812
+ }
813
+ });
814
+ W.displayName = "TiptapContext";
815
+ var bt = () => B(W);
816
+ function se({ editor: e, instance: t, children: r }) {
817
+ const n = e ?? t;
818
+ if (!n)
819
+ throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");
820
+ const o = k(() => ({ editor: n }), [n]), a = k(() => ({ editor: n }), [n]);
821
+ return /* @__PURE__ */ R(P.Provider, { value: a, children: /* @__PURE__ */ R(W.Provider, { value: o, children: r }) });
822
+ }
823
+ se.displayName = "Tiptap";
824
+ function ae({ ...e }) {
825
+ const { editor: t } = bt();
826
+ return /* @__PURE__ */ R(pt, { editor: t, ...e });
827
+ }
828
+ ae.displayName = "Tiptap.Content";
829
+ Object.assign(se, {
830
+ /**
831
+ * The Tiptap Content component that renders the EditorContent with the editor instance from the context.
832
+ * @see TiptapContent
833
+ */
834
+ Content: ae
835
+ });
836
+ export {
837
+ pt as E,
838
+ Tt as R,
839
+ Ct as a,
840
+ wt as u
841
+ };