rayo-editor 0.0.1

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 (43) hide show
  1. package/README.md +563 -0
  2. package/dist/components/BlogEditor.d.ts +4 -0
  3. package/dist/components/BlogEditor.d.ts.map +1 -0
  4. package/dist/components/DiffOverlay.d.ts +4 -0
  5. package/dist/components/DiffOverlay.d.ts.map +1 -0
  6. package/dist/components/ImageGenerationLoader.d.ts +5 -0
  7. package/dist/components/ImageGenerationLoader.d.ts.map +1 -0
  8. package/dist/components/RayoEditor.d.ts +74 -0
  9. package/dist/components/RayoEditor.d.ts.map +1 -0
  10. package/dist/components/ReviewButtons.d.ts +4 -0
  11. package/dist/components/ReviewButtons.d.ts.map +1 -0
  12. package/dist/components/TitleTextarea.d.ts +4 -0
  13. package/dist/components/TitleTextarea.d.ts.map +1 -0
  14. package/dist/components/index.d.ts +7 -0
  15. package/dist/components/index.d.ts.map +1 -0
  16. package/dist/hooks/index.d.ts +3 -0
  17. package/dist/hooks/index.d.ts.map +1 -0
  18. package/dist/hooks/useContentProcessing.d.ts +83 -0
  19. package/dist/hooks/useContentProcessing.d.ts.map +1 -0
  20. package/dist/hooks/useEditorDiff.d.ts +65 -0
  21. package/dist/hooks/useEditorDiff.d.ts.map +1 -0
  22. package/dist/index.d.ts +213 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.mjs +1011 -0
  25. package/dist/index.umd.js +32 -0
  26. package/dist/styles.css +1150 -0
  27. package/dist/types/diff.types.d.ts +84 -0
  28. package/dist/types/diff.types.d.ts.map +1 -0
  29. package/dist/types/editor.types.d.ts +59 -0
  30. package/dist/types/editor.types.d.ts.map +1 -0
  31. package/dist/utils/contentProcessing.d.ts +81 -0
  32. package/dist/utils/contentProcessing.d.ts.map +1 -0
  33. package/dist/utils/diffDetection.d.ts +85 -0
  34. package/dist/utils/diffDetection.d.ts.map +1 -0
  35. package/dist/utils/errorHandling.d.ts +57 -0
  36. package/dist/utils/errorHandling.d.ts.map +1 -0
  37. package/dist/utils/imageHandling.d.ts +52 -0
  38. package/dist/utils/imageHandling.d.ts.map +1 -0
  39. package/dist/utils/index.d.ts +6 -0
  40. package/dist/utils/index.d.ts.map +1 -0
  41. package/dist/utils/proximityMatching.d.ts +80 -0
  42. package/dist/utils/proximityMatching.d.ts.map +1 -0
  43. package/package.json +70 -0
package/dist/index.mjs ADDED
@@ -0,0 +1,1011 @@
1
+ import Oe, { useRef as ee, useCallback as te, useEffect as ke, useState as P } from "react";
2
+ var re = { exports: {} }, W = {};
3
+ /**
4
+ * @license React
5
+ * react-jsx-runtime.production.min.js
6
+ *
7
+ * Copyright (c) Facebook, Inc. and its affiliates.
8
+ *
9
+ * This source code is licensed under the MIT license found in the
10
+ * LICENSE file in the root directory of this source tree.
11
+ */
12
+ var Ce;
13
+ function gr() {
14
+ if (Ce)
15
+ return W;
16
+ Ce = 1;
17
+ var a = Oe, o = Symbol.for("react.element"), n = Symbol.for("react.fragment"), s = Object.prototype.hasOwnProperty, i = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, l = { key: !0, ref: !0, __self: !0, __source: !0 };
18
+ function R(v, h, x) {
19
+ var m, E = {}, _ = null, O = null;
20
+ x !== void 0 && (_ = "" + x), h.key !== void 0 && (_ = "" + h.key), h.ref !== void 0 && (O = h.ref);
21
+ for (m in h)
22
+ s.call(h, m) && !l.hasOwnProperty(m) && (E[m] = h[m]);
23
+ if (v && v.defaultProps)
24
+ for (m in h = v.defaultProps, h)
25
+ E[m] === void 0 && (E[m] = h[m]);
26
+ return { $$typeof: o, type: v, key: _, ref: O, props: E, _owner: i.current };
27
+ }
28
+ return W.Fragment = n, W.jsx = R, W.jsxs = R, W;
29
+ }
30
+ var L = {};
31
+ /**
32
+ * @license React
33
+ * react-jsx-runtime.development.js
34
+ *
35
+ * Copyright (c) Facebook, Inc. and its affiliates.
36
+ *
37
+ * This source code is licensed under the MIT license found in the
38
+ * LICENSE file in the root directory of this source tree.
39
+ */
40
+ var Pe;
41
+ function hr() {
42
+ return Pe || (Pe = 1, process.env.NODE_ENV !== "production" && function() {
43
+ var a = Oe, o = Symbol.for("react.element"), n = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), l = Symbol.for("react.profiler"), R = Symbol.for("react.provider"), v = Symbol.for("react.context"), h = Symbol.for("react.forward_ref"), x = Symbol.for("react.suspense"), m = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), _ = Symbol.for("react.lazy"), O = Symbol.for("react.offscreen"), ne = Symbol.iterator, De = "@@iterator";
44
+ function Ie(e) {
45
+ if (e === null || typeof e != "object")
46
+ return null;
47
+ var r = ne && e[ne] || e[De];
48
+ return typeof r == "function" ? r : null;
49
+ }
50
+ var I = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
51
+ function j(e) {
52
+ {
53
+ for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), u = 1; u < r; u++)
54
+ t[u - 1] = arguments[u];
55
+ Fe("error", e, t);
56
+ }
57
+ }
58
+ function Fe(e, r, t) {
59
+ {
60
+ var u = I.ReactDebugCurrentFrame, d = u.getStackAddendum();
61
+ d !== "" && (r += "%s", t = t.concat([d]));
62
+ var g = t.map(function(f) {
63
+ return String(f);
64
+ });
65
+ g.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, g);
66
+ }
67
+ }
68
+ var Ae = !1, $e = !1, Me = !1, Ne = !1, We = !1, ae;
69
+ ae = Symbol.for("react.module.reference");
70
+ function Le(e) {
71
+ return !!(typeof e == "string" || typeof e == "function" || e === s || e === l || We || e === i || e === x || e === m || Ne || e === O || Ae || $e || Me || typeof e == "object" && e !== null && (e.$$typeof === _ || e.$$typeof === E || e.$$typeof === R || e.$$typeof === v || e.$$typeof === h || // This needs to include all possible module reference object
72
+ // types supported by any Flight configuration anywhere since
73
+ // we don't know which Flight build this will end up being used
74
+ // with.
75
+ e.$$typeof === ae || e.getModuleId !== void 0));
76
+ }
77
+ function Ve(e, r, t) {
78
+ var u = e.displayName;
79
+ if (u)
80
+ return u;
81
+ var d = r.displayName || r.name || "";
82
+ return d !== "" ? t + "(" + d + ")" : t;
83
+ }
84
+ function oe(e) {
85
+ return e.displayName || "Context";
86
+ }
87
+ function C(e) {
88
+ if (e == null)
89
+ return null;
90
+ if (typeof e.tag == "number" && j("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
91
+ return e.displayName || e.name || null;
92
+ if (typeof e == "string")
93
+ return e;
94
+ switch (e) {
95
+ case s:
96
+ return "Fragment";
97
+ case n:
98
+ return "Portal";
99
+ case l:
100
+ return "Profiler";
101
+ case i:
102
+ return "StrictMode";
103
+ case x:
104
+ return "Suspense";
105
+ case m:
106
+ return "SuspenseList";
107
+ }
108
+ if (typeof e == "object")
109
+ switch (e.$$typeof) {
110
+ case v:
111
+ var r = e;
112
+ return oe(r) + ".Consumer";
113
+ case R:
114
+ var t = e;
115
+ return oe(t._context) + ".Provider";
116
+ case h:
117
+ return Ve(e, e.render, "ForwardRef");
118
+ case E:
119
+ var u = e.displayName || null;
120
+ return u !== null ? u : C(e.type) || "Memo";
121
+ case _: {
122
+ var d = e, g = d._payload, f = d._init;
123
+ try {
124
+ return C(f(g));
125
+ } catch {
126
+ return null;
127
+ }
128
+ }
129
+ }
130
+ return null;
131
+ }
132
+ var k = Object.assign, $ = 0, ie, se, ue, le, ce, fe, de;
133
+ function pe() {
134
+ }
135
+ pe.__reactDisabledLog = !0;
136
+ function Ye() {
137
+ {
138
+ if ($ === 0) {
139
+ ie = console.log, se = console.info, ue = console.warn, le = console.error, ce = console.group, fe = console.groupCollapsed, de = console.groupEnd;
140
+ var e = {
141
+ configurable: !0,
142
+ enumerable: !0,
143
+ value: pe,
144
+ writable: !0
145
+ };
146
+ Object.defineProperties(console, {
147
+ info: e,
148
+ log: e,
149
+ warn: e,
150
+ error: e,
151
+ group: e,
152
+ groupCollapsed: e,
153
+ groupEnd: e
154
+ });
155
+ }
156
+ $++;
157
+ }
158
+ }
159
+ function ze() {
160
+ {
161
+ if ($--, $ === 0) {
162
+ var e = {
163
+ configurable: !0,
164
+ enumerable: !0,
165
+ writable: !0
166
+ };
167
+ Object.defineProperties(console, {
168
+ log: k({}, e, {
169
+ value: ie
170
+ }),
171
+ info: k({}, e, {
172
+ value: se
173
+ }),
174
+ warn: k({}, e, {
175
+ value: ue
176
+ }),
177
+ error: k({}, e, {
178
+ value: le
179
+ }),
180
+ group: k({}, e, {
181
+ value: ce
182
+ }),
183
+ groupCollapsed: k({}, e, {
184
+ value: fe
185
+ }),
186
+ groupEnd: k({}, e, {
187
+ value: de
188
+ })
189
+ });
190
+ }
191
+ $ < 0 && j("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
192
+ }
193
+ }
194
+ var U = I.ReactCurrentDispatcher, G;
195
+ function V(e, r, t) {
196
+ {
197
+ if (G === void 0)
198
+ try {
199
+ throw Error();
200
+ } catch (d) {
201
+ var u = d.stack.trim().match(/\n( *(at )?)/);
202
+ G = u && u[1] || "";
203
+ }
204
+ return `
205
+ ` + G + e;
206
+ }
207
+ }
208
+ var J = !1, Y;
209
+ {
210
+ var Be = typeof WeakMap == "function" ? WeakMap : Map;
211
+ Y = new Be();
212
+ }
213
+ function ve(e, r) {
214
+ if (!e || J)
215
+ return "";
216
+ {
217
+ var t = Y.get(e);
218
+ if (t !== void 0)
219
+ return t;
220
+ }
221
+ var u;
222
+ J = !0;
223
+ var d = Error.prepareStackTrace;
224
+ Error.prepareStackTrace = void 0;
225
+ var g;
226
+ g = U.current, U.current = null, Ye();
227
+ try {
228
+ if (r) {
229
+ var f = function() {
230
+ throw Error();
231
+ };
232
+ if (Object.defineProperty(f.prototype, "props", {
233
+ set: function() {
234
+ throw Error();
235
+ }
236
+ }), typeof Reflect == "object" && Reflect.construct) {
237
+ try {
238
+ Reflect.construct(f, []);
239
+ } catch (S) {
240
+ u = S;
241
+ }
242
+ Reflect.construct(e, [], f);
243
+ } else {
244
+ try {
245
+ f.call();
246
+ } catch (S) {
247
+ u = S;
248
+ }
249
+ e.call(f.prototype);
250
+ }
251
+ } else {
252
+ try {
253
+ throw Error();
254
+ } catch (S) {
255
+ u = S;
256
+ }
257
+ e();
258
+ }
259
+ } catch (S) {
260
+ if (S && u && typeof S.stack == "string") {
261
+ for (var c = S.stack.split(`
262
+ `), w = u.stack.split(`
263
+ `), b = c.length - 1, y = w.length - 1; b >= 1 && y >= 0 && c[b] !== w[y]; )
264
+ y--;
265
+ for (; b >= 1 && y >= 0; b--, y--)
266
+ if (c[b] !== w[y]) {
267
+ if (b !== 1 || y !== 1)
268
+ do
269
+ if (b--, y--, y < 0 || c[b] !== w[y]) {
270
+ var T = `
271
+ ` + c[b].replace(" at new ", " at ");
272
+ return e.displayName && T.includes("<anonymous>") && (T = T.replace("<anonymous>", e.displayName)), typeof e == "function" && Y.set(e, T), T;
273
+ }
274
+ while (b >= 1 && y >= 0);
275
+ break;
276
+ }
277
+ }
278
+ } finally {
279
+ J = !1, U.current = g, ze(), Error.prepareStackTrace = d;
280
+ }
281
+ var A = e ? e.displayName || e.name : "", D = A ? V(A) : "";
282
+ return typeof e == "function" && Y.set(e, D), D;
283
+ }
284
+ function Ue(e, r, t) {
285
+ return ve(e, !1);
286
+ }
287
+ function Ge(e) {
288
+ var r = e.prototype;
289
+ return !!(r && r.isReactComponent);
290
+ }
291
+ function z(e, r, t) {
292
+ if (e == null)
293
+ return "";
294
+ if (typeof e == "function")
295
+ return ve(e, Ge(e));
296
+ if (typeof e == "string")
297
+ return V(e);
298
+ switch (e) {
299
+ case x:
300
+ return V("Suspense");
301
+ case m:
302
+ return V("SuspenseList");
303
+ }
304
+ if (typeof e == "object")
305
+ switch (e.$$typeof) {
306
+ case h:
307
+ return Ue(e.render);
308
+ case E:
309
+ return z(e.type, r, t);
310
+ case _: {
311
+ var u = e, d = u._payload, g = u._init;
312
+ try {
313
+ return z(g(d), r, t);
314
+ } catch {
315
+ }
316
+ }
317
+ }
318
+ return "";
319
+ }
320
+ var M = Object.prototype.hasOwnProperty, ge = {}, he = I.ReactDebugCurrentFrame;
321
+ function B(e) {
322
+ if (e) {
323
+ var r = e._owner, t = z(e.type, e._source, r ? r.type : null);
324
+ he.setExtraStackFrame(t);
325
+ } else
326
+ he.setExtraStackFrame(null);
327
+ }
328
+ function Je(e, r, t, u, d) {
329
+ {
330
+ var g = Function.call.bind(M);
331
+ for (var f in e)
332
+ if (g(e, f)) {
333
+ var c = void 0;
334
+ try {
335
+ if (typeof e[f] != "function") {
336
+ var w = Error((u || "React class") + ": " + t + " type `" + f + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[f] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
337
+ throw w.name = "Invariant Violation", w;
338
+ }
339
+ c = e[f](r, f, u, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
340
+ } catch (b) {
341
+ c = b;
342
+ }
343
+ c && !(c instanceof Error) && (B(d), j("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", u || "React class", t, f, typeof c), B(null)), c instanceof Error && !(c.message in ge) && (ge[c.message] = !0, B(d), j("Failed %s type: %s", t, c.message), B(null));
344
+ }
345
+ }
346
+ }
347
+ var qe = Array.isArray;
348
+ function q(e) {
349
+ return qe(e);
350
+ }
351
+ function Ke(e) {
352
+ {
353
+ var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
354
+ return t;
355
+ }
356
+ }
357
+ function He(e) {
358
+ try {
359
+ return me(e), !1;
360
+ } catch {
361
+ return !0;
362
+ }
363
+ }
364
+ function me(e) {
365
+ return "" + e;
366
+ }
367
+ function be(e) {
368
+ if (He(e))
369
+ return j("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ke(e)), me(e);
370
+ }
371
+ var N = I.ReactCurrentOwner, Xe = {
372
+ key: !0,
373
+ ref: !0,
374
+ __self: !0,
375
+ __source: !0
376
+ }, ye, Re, K;
377
+ K = {};
378
+ function Ze(e) {
379
+ if (M.call(e, "ref")) {
380
+ var r = Object.getOwnPropertyDescriptor(e, "ref").get;
381
+ if (r && r.isReactWarning)
382
+ return !1;
383
+ }
384
+ return e.ref !== void 0;
385
+ }
386
+ function Qe(e) {
387
+ if (M.call(e, "key")) {
388
+ var r = Object.getOwnPropertyDescriptor(e, "key").get;
389
+ if (r && r.isReactWarning)
390
+ return !1;
391
+ }
392
+ return e.key !== void 0;
393
+ }
394
+ function er(e, r) {
395
+ if (typeof e.ref == "string" && N.current && r && N.current.stateNode !== r) {
396
+ var t = C(N.current.type);
397
+ K[t] || (j('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', C(N.current.type), e.ref), K[t] = !0);
398
+ }
399
+ }
400
+ function rr(e, r) {
401
+ {
402
+ var t = function() {
403
+ ye || (ye = !0, j("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
404
+ };
405
+ t.isReactWarning = !0, Object.defineProperty(e, "key", {
406
+ get: t,
407
+ configurable: !0
408
+ });
409
+ }
410
+ }
411
+ function tr(e, r) {
412
+ {
413
+ var t = function() {
414
+ Re || (Re = !0, j("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
415
+ };
416
+ t.isReactWarning = !0, Object.defineProperty(e, "ref", {
417
+ get: t,
418
+ configurable: !0
419
+ });
420
+ }
421
+ }
422
+ var nr = function(e, r, t, u, d, g, f) {
423
+ var c = {
424
+ // This tag allows us to uniquely identify this as a React Element
425
+ $$typeof: o,
426
+ // Built-in properties that belong on the element
427
+ type: e,
428
+ key: r,
429
+ ref: t,
430
+ props: f,
431
+ // Record the component responsible for creating this element.
432
+ _owner: g
433
+ };
434
+ return c._store = {}, Object.defineProperty(c._store, "validated", {
435
+ configurable: !1,
436
+ enumerable: !1,
437
+ writable: !0,
438
+ value: !1
439
+ }), Object.defineProperty(c, "_self", {
440
+ configurable: !1,
441
+ enumerable: !1,
442
+ writable: !1,
443
+ value: u
444
+ }), Object.defineProperty(c, "_source", {
445
+ configurable: !1,
446
+ enumerable: !1,
447
+ writable: !1,
448
+ value: d
449
+ }), Object.freeze && (Object.freeze(c.props), Object.freeze(c)), c;
450
+ };
451
+ function ar(e, r, t, u, d) {
452
+ {
453
+ var g, f = {}, c = null, w = null;
454
+ t !== void 0 && (be(t), c = "" + t), Qe(r) && (be(r.key), c = "" + r.key), Ze(r) && (w = r.ref, er(r, d));
455
+ for (g in r)
456
+ M.call(r, g) && !Xe.hasOwnProperty(g) && (f[g] = r[g]);
457
+ if (e && e.defaultProps) {
458
+ var b = e.defaultProps;
459
+ for (g in b)
460
+ f[g] === void 0 && (f[g] = b[g]);
461
+ }
462
+ if (c || w) {
463
+ var y = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
464
+ c && rr(f, y), w && tr(f, y);
465
+ }
466
+ return nr(e, c, w, d, u, N.current, f);
467
+ }
468
+ }
469
+ var H = I.ReactCurrentOwner, xe = I.ReactDebugCurrentFrame;
470
+ function F(e) {
471
+ if (e) {
472
+ var r = e._owner, t = z(e.type, e._source, r ? r.type : null);
473
+ xe.setExtraStackFrame(t);
474
+ } else
475
+ xe.setExtraStackFrame(null);
476
+ }
477
+ var X;
478
+ X = !1;
479
+ function Z(e) {
480
+ return typeof e == "object" && e !== null && e.$$typeof === o;
481
+ }
482
+ function Ee() {
483
+ {
484
+ if (H.current) {
485
+ var e = C(H.current.type);
486
+ if (e)
487
+ return `
488
+
489
+ Check the render method of \`` + e + "`.";
490
+ }
491
+ return "";
492
+ }
493
+ }
494
+ function or(e) {
495
+ {
496
+ if (e !== void 0) {
497
+ var r = e.fileName.replace(/^.*[\\\/]/, ""), t = e.lineNumber;
498
+ return `
499
+
500
+ Check your code at ` + r + ":" + t + ".";
501
+ }
502
+ return "";
503
+ }
504
+ }
505
+ var _e = {};
506
+ function ir(e) {
507
+ {
508
+ var r = Ee();
509
+ if (!r) {
510
+ var t = typeof e == "string" ? e : e.displayName || e.name;
511
+ t && (r = `
512
+
513
+ Check the top-level render call using <` + t + ">.");
514
+ }
515
+ return r;
516
+ }
517
+ }
518
+ function je(e, r) {
519
+ {
520
+ if (!e._store || e._store.validated || e.key != null)
521
+ return;
522
+ e._store.validated = !0;
523
+ var t = ir(r);
524
+ if (_e[t])
525
+ return;
526
+ _e[t] = !0;
527
+ var u = "";
528
+ e && e._owner && e._owner !== H.current && (u = " It was passed a child from " + C(e._owner.type) + "."), F(e), j('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, u), F(null);
529
+ }
530
+ }
531
+ function we(e, r) {
532
+ {
533
+ if (typeof e != "object")
534
+ return;
535
+ if (q(e))
536
+ for (var t = 0; t < e.length; t++) {
537
+ var u = e[t];
538
+ Z(u) && je(u, r);
539
+ }
540
+ else if (Z(e))
541
+ e._store && (e._store.validated = !0);
542
+ else if (e) {
543
+ var d = Ie(e);
544
+ if (typeof d == "function" && d !== e.entries)
545
+ for (var g = d.call(e), f; !(f = g.next()).done; )
546
+ Z(f.value) && je(f.value, r);
547
+ }
548
+ }
549
+ }
550
+ function sr(e) {
551
+ {
552
+ var r = e.type;
553
+ if (r == null || typeof r == "string")
554
+ return;
555
+ var t;
556
+ if (typeof r == "function")
557
+ t = r.propTypes;
558
+ else if (typeof r == "object" && (r.$$typeof === h || // Note: Memo only checks outer props here.
559
+ // Inner props are checked in the reconciler.
560
+ r.$$typeof === E))
561
+ t = r.propTypes;
562
+ else
563
+ return;
564
+ if (t) {
565
+ var u = C(r);
566
+ Je(t, e.props, "prop", u, e);
567
+ } else if (r.PropTypes !== void 0 && !X) {
568
+ X = !0;
569
+ var d = C(r);
570
+ j("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", d || "Unknown");
571
+ }
572
+ typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && j("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
573
+ }
574
+ }
575
+ function ur(e) {
576
+ {
577
+ for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
578
+ var u = r[t];
579
+ if (u !== "children" && u !== "key") {
580
+ F(e), j("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", u), F(null);
581
+ break;
582
+ }
583
+ }
584
+ e.ref !== null && (F(e), j("Invalid attribute `ref` supplied to `React.Fragment`."), F(null));
585
+ }
586
+ }
587
+ var Se = {};
588
+ function Te(e, r, t, u, d, g) {
589
+ {
590
+ var f = Le(e);
591
+ if (!f) {
592
+ var c = "";
593
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (c += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
594
+ var w = or(d);
595
+ w ? c += w : c += Ee();
596
+ var b;
597
+ e === null ? b = "null" : q(e) ? b = "array" : e !== void 0 && e.$$typeof === o ? (b = "<" + (C(e.type) || "Unknown") + " />", c = " Did you accidentally export a JSX literal instead of a component?") : b = typeof e, j("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", b, c);
598
+ }
599
+ var y = ar(e, r, t, d, g);
600
+ if (y == null)
601
+ return y;
602
+ if (f) {
603
+ var T = r.children;
604
+ if (T !== void 0)
605
+ if (u)
606
+ if (q(T)) {
607
+ for (var A = 0; A < T.length; A++)
608
+ we(T[A], e);
609
+ Object.freeze && Object.freeze(T);
610
+ } else
611
+ j("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
612
+ else
613
+ we(T, e);
614
+ }
615
+ if (M.call(r, "key")) {
616
+ var D = C(e), S = Object.keys(r).filter(function(vr) {
617
+ return vr !== "key";
618
+ }), Q = S.length > 0 ? "{key: someKey, " + S.join(": ..., ") + ": ...}" : "{key: someKey}";
619
+ if (!Se[D + Q]) {
620
+ var pr = S.length > 0 ? "{" + S.join(": ..., ") + ": ...}" : "{}";
621
+ j(`A props object containing a "key" prop is being spread into JSX:
622
+ let props = %s;
623
+ <%s {...props} />
624
+ React keys must be passed directly to JSX without using spread:
625
+ let props = %s;
626
+ <%s key={someKey} {...props} />`, Q, D, pr, D), Se[D + Q] = !0;
627
+ }
628
+ }
629
+ return e === s ? ur(y) : sr(y), y;
630
+ }
631
+ }
632
+ function lr(e, r, t) {
633
+ return Te(e, r, t, !0);
634
+ }
635
+ function cr(e, r, t) {
636
+ return Te(e, r, t, !1);
637
+ }
638
+ var fr = cr, dr = lr;
639
+ L.Fragment = s, L.jsx = fr, L.jsxs = dr;
640
+ }()), L;
641
+ }
642
+ process.env.NODE_ENV === "production" ? re.exports = gr() : re.exports = hr();
643
+ var p = re.exports;
644
+ const mr = ({ title: a, onTitleChange: o, readOnly: n }) => {
645
+ const s = ee(null), i = te(() => {
646
+ const l = s.current;
647
+ l && (l.style.height = "auto", l.style.height = `${l.scrollHeight}px`);
648
+ }, []);
649
+ return ke(() => {
650
+ i();
651
+ }, [a, i]), /* @__PURE__ */ p.jsx(
652
+ "textarea",
653
+ {
654
+ ref: s,
655
+ value: a,
656
+ onChange: (l) => {
657
+ o == null || o(l.target.value), i();
658
+ },
659
+ placeholder: "Enter blog title...",
660
+ className: "w-full text-2xl font-bold outline-none resize-none",
661
+ readOnly: n,
662
+ rows: 1,
663
+ "data-testid": "title-textarea"
664
+ }
665
+ );
666
+ }, br = ({
667
+ diffPairs: a,
668
+ overlayHoleRect: o,
669
+ onPairHover: n,
670
+ onPairClick: s
671
+ }) => a.length === 0 ? null : /* @__PURE__ */ p.jsxs(
672
+ "div",
673
+ {
674
+ className: "fixed inset-0 pointer-events-none",
675
+ "data-testid": "diff-overlay",
676
+ style: { zIndex: 40 },
677
+ children: [
678
+ a.map((i, l) => /* @__PURE__ */ p.jsx(
679
+ "div",
680
+ {
681
+ className: "absolute border-2 border-green-400",
682
+ style: {
683
+ top: `${i.rect.top}px`,
684
+ left: `${i.rect.left}px`,
685
+ width: `${i.rect.width}px`,
686
+ height: `${i.rect.bottom - i.rect.top}px`
687
+ },
688
+ onMouseEnter: () => n == null ? void 0 : n(l),
689
+ onClick: () => s == null ? void 0 : s(l),
690
+ "data-testid": `diff-pair-${l}`
691
+ },
692
+ l
693
+ )),
694
+ o && /* @__PURE__ */ p.jsx(
695
+ "div",
696
+ {
697
+ className: "absolute pointer-events-auto",
698
+ style: {
699
+ top: `${o.top}px`,
700
+ bottom: `${o.bottom}px`,
701
+ left: 0,
702
+ right: 0,
703
+ zIndex: 50
704
+ },
705
+ "data-testid": "overlay-hole"
706
+ }
707
+ )
708
+ ]
709
+ }
710
+ ), yr = () => /* @__PURE__ */ p.jsxs("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", children: [
711
+ /* @__PURE__ */ p.jsx("path", { d: "M9 15.75C5.27175 15.75 2.25 12.7282 2.25 9C2.25 5.27175 5.27175 2.25 9 2.25C12.7282 2.25 15.75 5.27175 15.75 9C15.75 12.7282 12.7282 15.75 9 15.75Z", stroke: "white", strokeWidth: "1.5" }),
712
+ /* @__PURE__ */ p.jsx("path", { d: "M12 7.5L8.25 11.25L6 9", stroke: "white", strokeWidth: "1.5" })
713
+ ] }), Rr = () => /* @__PURE__ */ p.jsx("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", children: /* @__PURE__ */ p.jsx("path", { d: "M2.25 15.75V2.25H12.5325L15.75 5.4675V15.75H2.25ZM5.99625 2.25V5.99625M5.99625 2.25H11.9962M11.9962 2.25V5.99625M5.25 15.75V9H12.75V15.75", stroke: "#AFB0B6", strokeWidth: "1.5" }) }), xr = ({ onAccept: a, onReject: o, position: n }) => /* @__PURE__ */ p.jsxs(
714
+ "div",
715
+ {
716
+ className: "fixed flex gap-2 z-50",
717
+ style: { top: `${n.top}px`, left: `${n.left}px` },
718
+ "data-testid": "review-buttons",
719
+ children: [
720
+ /* @__PURE__ */ p.jsx(
721
+ "button",
722
+ {
723
+ onClick: a,
724
+ className: "p-2 bg-green-500 rounded hover:bg-green-600",
725
+ title: "Accept changes",
726
+ "data-testid": "accept-button",
727
+ children: /* @__PURE__ */ p.jsx(yr, {})
728
+ }
729
+ ),
730
+ /* @__PURE__ */ p.jsx(
731
+ "button",
732
+ {
733
+ onClick: o,
734
+ className: "p-2 bg-red-500 rounded hover:bg-red-600",
735
+ title: "Reject changes",
736
+ "data-testid": "reject-button",
737
+ children: /* @__PURE__ */ p.jsx(Rr, {})
738
+ }
739
+ )
740
+ ]
741
+ }
742
+ ), Er = (a, o) => {
743
+ const [n, s] = P([]), [i, l] = P(-1), [R, v] = P(-1), [h, x] = P(null), m = ee(!1), E = ee(0), _ = te(() => {
744
+ if (!(m.current || Date.now() - E.current < 500))
745
+ try {
746
+ m.current = !0, s([]);
747
+ } finally {
748
+ m.current = !1, E.current = Date.now();
749
+ }
750
+ }, []);
751
+ return ke(() => {
752
+ _();
753
+ }, [_]), {
754
+ diffPairs: n,
755
+ setDiffPairs: s,
756
+ activePairIndex: i,
757
+ setActivePairIndex: l,
758
+ hoverPairIndex: R,
759
+ setHoverPairIndex: v,
760
+ overlayHoleRect: h,
761
+ setOverlayHoleRect: x,
762
+ updateDiffRanges: _
763
+ };
764
+ }, _r = ({
765
+ content: a,
766
+ title: o,
767
+ onChange: n,
768
+ onTitleChange: s,
769
+ isLoading: i,
770
+ showDiffs: l,
771
+ focusMode: R,
772
+ readOnly: v,
773
+ editorRef: h
774
+ }) => {
775
+ const [x] = P({ top: 0, left: 0 }), { diffPairs: m, overlayHoleRect: E, setActivePairIndex: _ } = Er();
776
+ return /* @__PURE__ */ p.jsxs(
777
+ "div",
778
+ {
779
+ className: `rayo-blog-editor ${R ? "focus-mode" : ""}`,
780
+ "data-testid": "blog-editor",
781
+ children: [
782
+ /* @__PURE__ */ p.jsx("div", { className: "mb-6", "data-testid": "title-section", children: /* @__PURE__ */ p.jsx(
783
+ mr,
784
+ {
785
+ title: o,
786
+ onTitleChange: s,
787
+ readOnly: v
788
+ }
789
+ ) }),
790
+ /* @__PURE__ */ p.jsxs("div", { className: "relative", "data-testid": "content-section", children: [
791
+ /* @__PURE__ */ p.jsx(
792
+ "textarea",
793
+ {
794
+ value: a,
795
+ onChange: (O) => n(O.target.value),
796
+ className: "w-full min-h-96 p-4 border rounded font-mono text-sm",
797
+ placeholder: "Blog content...",
798
+ readOnly: v,
799
+ "data-testid": "content-textarea"
800
+ }
801
+ ),
802
+ l && m.length > 0 && /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
803
+ /* @__PURE__ */ p.jsx(
804
+ br,
805
+ {
806
+ diffPairs: m,
807
+ overlayHoleRect: E,
808
+ onPairClick: _
809
+ }
810
+ ),
811
+ /* @__PURE__ */ p.jsx(
812
+ xr,
813
+ {
814
+ onAccept: () => n(a),
815
+ onReject: () => n(a),
816
+ position: x
817
+ }
818
+ )
819
+ ] })
820
+ ] }),
821
+ i && /* @__PURE__ */ p.jsx("div", { className: "mt-4 p-4 bg-gray-100 rounded", "data-testid": "loading-state", children: "Loading..." })
822
+ ]
823
+ }
824
+ );
825
+ }, Sr = (a) => /* @__PURE__ */ p.jsx("div", { className: "rayo-editor", "data-testid": "rayo-editor", children: /* @__PURE__ */ p.jsx(_r, { ...a }) }), Tr = ({ isLoading: a }) => a ? /* @__PURE__ */ p.jsxs("div", { className: "flex items-center justify-center p-4", "data-testid": "image-loader", children: [
826
+ /* @__PURE__ */ p.jsx("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500" }),
827
+ /* @__PURE__ */ p.jsx("span", { className: "ml-2", children: "Generating image..." })
828
+ ] }) : null, Cr = (a = "") => {
829
+ const [o, n] = P(a), [s, i] = P(!1), [l, R] = P(null), v = te((h) => {
830
+ try {
831
+ i(!0), R(null), n(h);
832
+ } catch (x) {
833
+ R(x instanceof Error ? x : new Error("Unknown error"));
834
+ } finally {
835
+ i(!1);
836
+ }
837
+ }, []);
838
+ return {
839
+ content: o,
840
+ setContent: n,
841
+ isProcessing: s,
842
+ error: l,
843
+ processContent: v
844
+ };
845
+ }, Pr = (a) => {
846
+ try {
847
+ const o = /<(ins|del)\b/i.test(a) || /data-color="#c7f0d6ff"/i.test(a) || /data-color="#fecaca"/i.test(a) || /data-pending-delete="true"/i.test(a) || /data-pending-insert="true"/i.test(a), n = [];
848
+ if (!o)
849
+ return { hasDiffs: !1, markers: [] };
850
+ const s = /<ins\b[^>]*>([\s\S]*?)<\/ins>/gi;
851
+ let i;
852
+ for (; (i = s.exec(a)) !== null; )
853
+ n.push({
854
+ type: "insertion",
855
+ from: i.index,
856
+ to: i.index + i[0].length
857
+ });
858
+ const l = /<del\b[^>]*>([\s\S]*?)<\/del>/gi;
859
+ for (; (i = l.exec(a)) !== null; )
860
+ n.push({
861
+ type: "deletion",
862
+ from: i.index,
863
+ to: i.index + i[0].length
864
+ });
865
+ return /data-color="#c7f0d6ff"/i.test(a) && n.push({
866
+ type: "highlight",
867
+ color: "#c7f0d6ff"
868
+ }), /data-color="#fecaca"/i.test(a) && n.push({
869
+ type: "highlight",
870
+ color: "#fecaca"
871
+ }), { hasDiffs: !0, markers: n };
872
+ } catch (o) {
873
+ return console.warn("Diff detection failed:", o), { hasDiffs: !1, markers: [] };
874
+ }
875
+ }, Or = (a) => {
876
+ try {
877
+ return a.normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[\u2010-\u2015\u2212\uFE58\uFE63\uFF0D]/g, "-").replace(/[\u00A0\u2000-\u200B\u202F\u205F\u3000]/g, " ").replace(/[\u2018\u2019\u201A\u201B]/g, "'").replace(/[\u201C\u201D\u201E\u201F]/g, '"').replace(/[\u200B-\u200D\uFEFF]/g, "").replace(/\s+/g, " ").trim();
878
+ } catch (o) {
879
+ return console.warn("Text normalization failed:", o), a;
880
+ }
881
+ }, kr = (a) => [];
882
+ function jr(a) {
883
+ if (a.length === 0)
884
+ return [];
885
+ const o = [...a].sort((i, l) => i.from - l.from), n = [];
886
+ let s = o[0];
887
+ for (let i = 1; i < o.length; i++) {
888
+ const l = o[i];
889
+ l.from <= s.to ? s = {
890
+ from: s.from,
891
+ to: Math.max(s.to, l.to)
892
+ } : (n.push(s), s = l);
893
+ }
894
+ return n.push(s), n;
895
+ }
896
+ function Dr(a, o) {
897
+ return a.substring(o.from, o.to);
898
+ }
899
+ function Ir(a) {
900
+ const o = a.filter((n) => n.from < n.to);
901
+ return jr(o);
902
+ }
903
+ const Fr = (a) => {
904
+ if (a.length === 0)
905
+ return [];
906
+ const o = [];
907
+ let n = [];
908
+ for (const s of a)
909
+ if (n.length === 0)
910
+ n.push(s);
911
+ else {
912
+ const i = n[n.length - 1];
913
+ s.pos === i.pos + i.nodeSize ? n.push(s) : (o.push(n), n = [s]);
914
+ }
915
+ return n.length > 0 && o.push(n), o;
916
+ }, Ar = (a, o) => {
917
+ const n = [], s = /* @__PURE__ */ new Set();
918
+ for (const i of a) {
919
+ const l = [];
920
+ let R = i.pos + i.nodeSize;
921
+ for (let v = 0; v < o.length; v++)
922
+ s.has(v) || o[v].pos === R && (l.push(o[v]), s.add(v), R = o[v].pos + o[v].nodeSize);
923
+ l.length > 0 ? n.push({
924
+ redRange: { from: i.pos, to: i.pos + i.nodeSize },
925
+ greenRange: {
926
+ from: l[0].pos,
927
+ to: l[l.length - 1].pos + l[l.length - 1].nodeSize
928
+ },
929
+ rect: i.rect,
930
+ lastGreenRect: l[l.length - 1].rect,
931
+ isImageReplacement: !0,
932
+ newImagesCount: l.length
933
+ }) : n.push({
934
+ redRange: { from: i.pos, to: i.pos + i.nodeSize },
935
+ greenRange: void 0,
936
+ rect: i.rect,
937
+ lastGreenRect: i.rect,
938
+ isImageDeletion: !0
939
+ });
940
+ }
941
+ return n;
942
+ }, $r = (a, o) => {
943
+ const n = Math.abs(a.from - o.to), s = Math.abs(o.from - a.to);
944
+ return Math.min(n, s);
945
+ }, Mr = (a, o, n) => {
946
+ var l, R, v, h;
947
+ if (n.length <= 1)
948
+ return n[0] || null;
949
+ let s = null, i = 1 / 0;
950
+ for (const x of n) {
951
+ const m = Math.min(((l = x.redRange) == null ? void 0 : l.from) ?? 1 / 0, ((R = x.greenRange) == null ? void 0 : R.from) ?? 1 / 0), E = Math.max(((v = x.redRange) == null ? void 0 : v.to) ?? 0, ((h = x.greenRange) == null ? void 0 : h.to) ?? 0), _ = Math.min(
952
+ Math.abs(a - m),
953
+ Math.abs(a - E)
954
+ );
955
+ _ < i && (i = _, s = x);
956
+ }
957
+ return s;
958
+ }, Nr = (a) => {
959
+ if (a.length === 0)
960
+ return [];
961
+ const o = [];
962
+ let n = [];
963
+ for (const s of a)
964
+ if (n.length === 0)
965
+ n.push(s);
966
+ else {
967
+ const i = n[n.length - 1];
968
+ s.pos === i.pos + i.nodeSize ? n.push(s) : (o.push(n), n = [s]);
969
+ }
970
+ return n.length > 0 && o.push(n), o;
971
+ };
972
+ class Wr extends Error {
973
+ /**
974
+ * Create a new DiffProcessingError
975
+ * @param message - Error message
976
+ * @param context - Additional context object for debugging
977
+ */
978
+ constructor(o, n) {
979
+ super(o), this.context = n, this.name = "DiffProcessingError";
980
+ }
981
+ }
982
+ const Lr = (a, o) => {
983
+ try {
984
+ return a();
985
+ } catch (n) {
986
+ return console.warn("Error in diff processing:", n), o;
987
+ }
988
+ };
989
+ export {
990
+ _r as BlogEditor,
991
+ br as DiffOverlay,
992
+ Wr as DiffProcessingError,
993
+ Tr as ImageGenerationLoader,
994
+ Sr as RayoEditor,
995
+ xr as ReviewButtons,
996
+ mr as TitleTextarea,
997
+ $r as calculateProximity,
998
+ Pr as detectDiffMarkers,
999
+ kr as extractDiffRanges,
1000
+ Dr as extractTextContent,
1001
+ Mr as findOwnerTextPair,
1002
+ Fr as groupConsecutiveImages,
1003
+ Nr as groupConsecutiveItems,
1004
+ Ar as matchImageReplacements,
1005
+ jr as mergeConsecutiveRanges,
1006
+ Or as normalizeDiffText,
1007
+ Ir as optimizeRanges,
1008
+ Lr as safeExecute,
1009
+ Cr as useContentProcessing,
1010
+ Er as useEditorDiff
1011
+ };