@editora/core 1.0.3 → 1.0.4

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 (131) hide show
  1. package/README.md +34 -0
  2. package/dist/{A11yCheckerPlugin.native-CZKpi3uF.mjs → A11yCheckerPlugin.native-BRdGYMju.mjs} +225 -173
  3. package/dist/AnchorPlugin.native-C1Rw5m04.mjs +404 -0
  4. package/dist/BackgroundColorPlugin.native-BE-p9DRd.mjs +489 -0
  5. package/dist/ChecklistPlugin.native-nuSSEFNI.mjs +309 -0
  6. package/dist/ClearFormattingPlugin.native-Bq_XcTh2.mjs +140 -0
  7. package/dist/{CodePlugin.native-CK9d8rmt.mjs → CodePlugin.native-0Zari_zp.mjs} +329 -310
  8. package/dist/CodeSamplePlugin.native-B-KS1pOl.mjs +384 -0
  9. package/dist/CommentsPlugin.native-tMnWn8a2.mjs +723 -0
  10. package/dist/DirectionPlugin.native-CDnbdNyl.mjs +130 -0
  11. package/dist/{EmbedIframePlugin.native-ifr9KLdN.mjs → EmbedIframePlugin.native-CSWIB1jm.mjs} +154 -50
  12. package/dist/{EmojisPlugin.native-D6mJSnSR.mjs → EmojisPlugin.native-DxTm_DL-.mjs} +156 -103
  13. package/dist/FontFamilyPlugin.native-j8hMTbg4.mjs +158 -0
  14. package/dist/FontSizePlugin.native-B_jCh7dY.mjs +286 -0
  15. package/dist/FootnotePlugin.native-D730OGRm.mjs +425 -0
  16. package/dist/HistoryPlugin.native-DCrPdeSW.mjs +257 -0
  17. package/dist/IndentPlugin.native-BHixp8sP.mjs +150 -0
  18. package/dist/LineHeightPlugin.native-CM7iXdQj.mjs +151 -0
  19. package/dist/{LinkPlugin.native-BdAOV-iu.mjs → LinkPlugin.native-CS2g-G18.mjs} +128 -53
  20. package/dist/{ListPlugin.native-CLFU5AUQ.mjs → ListPlugin.native-V7EZC1lM.mjs} +59 -12
  21. package/dist/MathPlugin.native-KUxz0o8C.mjs +251 -0
  22. package/dist/MediaManagerPlugin.native-CgP5iInD.mjs +970 -0
  23. package/dist/MergeTagPlugin.native-CU9LtsfD.mjs +416 -0
  24. package/dist/PageBreakPlugin.native-CGiQxXqR.mjs +297 -0
  25. package/dist/{PrintPlugin.native-BUpm52VJ.mjs → PrintPlugin.native-7qt5v7L5.mjs} +10 -10
  26. package/dist/{SpecialCharactersPlugin.native-x7a2SWXc.mjs → SpecialCharactersPlugin.native-DANrbExJ.mjs} +143 -97
  27. package/dist/SpellCheckPlugin.native-C8bPvRHy.mjs +1019 -0
  28. package/dist/StrikethroughPlugin.native-0Be7j49s.mjs +73 -0
  29. package/dist/{TablePlugin.native-EEWXn1-s.mjs → TablePlugin.native-DrHX-efe.mjs} +149 -145
  30. package/dist/TemplatePlugin.native-4lKEm-WY.mjs +578 -0
  31. package/dist/TextAlignmentPlugin.native-sM_1s00t.mjs +108 -0
  32. package/dist/{TextColorPlugin.native-D6SmTglm.mjs → TextColorPlugin.native-Clgtb50j.mjs} +173 -92
  33. package/dist/colorSelectionApply-CK1My9N2.mjs +67 -0
  34. package/dist/core.css +1 -1
  35. package/dist/editora.min.js +31 -29
  36. package/dist/editora.umd.js +31 -29
  37. package/dist/index-CqWQFb3D.js +10 -0
  38. package/dist/index-OwnkG39N.mjs +2227 -0
  39. package/dist/index.cjs.js +14 -18
  40. package/dist/index.esm.js +204 -521
  41. package/dist/plugin-loader.js +26 -26
  42. package/dist/webcomponent-core.js +1286 -295
  43. package/dist/webcomponent-core.min.css +1 -1
  44. package/dist/webcomponent-core.min.js +100 -75
  45. package/dist/webcomponent.cjs.js +1 -1
  46. package/dist/webcomponent.esm.js +1 -1
  47. package/dist/webcomponent.js +1252 -261
  48. package/dist/webcomponent.min.css +1 -1
  49. package/dist/webcomponent.min.js +3616 -2109
  50. package/index.d.ts +355 -0
  51. package/package.json +19 -17
  52. package/dist/A11yCheckerPlugin.native-CZKpi3uF.mjs.map +0 -1
  53. package/dist/AnchorPlugin.native-7es9PVZ9.mjs +0 -340
  54. package/dist/AnchorPlugin.native-7es9PVZ9.mjs.map +0 -1
  55. package/dist/BackgroundColorPlugin.native-Dip5uqTg.mjs +0 -449
  56. package/dist/BackgroundColorPlugin.native-Dip5uqTg.mjs.map +0 -1
  57. package/dist/BlockquotePlugin.native-JFmOLsxN.mjs.map +0 -1
  58. package/dist/BoldPlugin.native-BAzzoqU5.mjs.map +0 -1
  59. package/dist/CapitalizationPlugin.native-DOMsh5R7.mjs.map +0 -1
  60. package/dist/ChecklistPlugin.native-Dccs3nLe.mjs +0 -153
  61. package/dist/ChecklistPlugin.native-Dccs3nLe.mjs.map +0 -1
  62. package/dist/ClearFormattingPlugin.native-BZPDHswo.mjs +0 -27
  63. package/dist/ClearFormattingPlugin.native-BZPDHswo.mjs.map +0 -1
  64. package/dist/CodePlugin.native-CK9d8rmt.mjs.map +0 -1
  65. package/dist/CodeSamplePlugin.native-DMbEdO9j.mjs +0 -326
  66. package/dist/CodeSamplePlugin.native-DMbEdO9j.mjs.map +0 -1
  67. package/dist/CommentsPlugin.native-2zQV8Ia4.mjs +0 -473
  68. package/dist/CommentsPlugin.native-2zQV8Ia4.mjs.map +0 -1
  69. package/dist/DirectionPlugin.native-Be7wCzkI.mjs +0 -59
  70. package/dist/DirectionPlugin.native-Be7wCzkI.mjs.map +0 -1
  71. package/dist/DocumentManagerPlugin.native-BvZL5CSG.mjs.map +0 -1
  72. package/dist/EmbedIframePlugin.native-ifr9KLdN.mjs.map +0 -1
  73. package/dist/EmojisPlugin.native-D6mJSnSR.mjs.map +0 -1
  74. package/dist/FontFamilyPlugin.native-BzS_9qbM.mjs +0 -106
  75. package/dist/FontFamilyPlugin.native-BzS_9qbM.mjs.map +0 -1
  76. package/dist/FontSizePlugin.native-DkLMLPue.mjs +0 -186
  77. package/dist/FontSizePlugin.native-DkLMLPue.mjs.map +0 -1
  78. package/dist/FootnotePlugin.native-BciVc9W6.mjs +0 -128
  79. package/dist/FootnotePlugin.native-BciVc9W6.mjs.map +0 -1
  80. package/dist/FullscreenPlugin.native-ChXyxeNw.mjs.map +0 -1
  81. package/dist/HeadingPlugin.native-DrLYwQnQ.mjs.map +0 -1
  82. package/dist/HistoryPlugin.native-DoDRifCf.mjs +0 -89
  83. package/dist/HistoryPlugin.native-DoDRifCf.mjs.map +0 -1
  84. package/dist/IndentPlugin.native-CbFugPoi.mjs +0 -133
  85. package/dist/IndentPlugin.native-CbFugPoi.mjs.map +0 -1
  86. package/dist/ItalicPlugin.native-CQjjDyUL.mjs.map +0 -1
  87. package/dist/LineHeightPlugin.native-CWQT2FIa.mjs +0 -73
  88. package/dist/LineHeightPlugin.native-CWQT2FIa.mjs.map +0 -1
  89. package/dist/LinkPlugin.native-BdAOV-iu.mjs.map +0 -1
  90. package/dist/ListPlugin.native-CLFU5AUQ.mjs.map +0 -1
  91. package/dist/MathPlugin.native-DE_ii-LA.mjs +0 -182
  92. package/dist/MathPlugin.native-DE_ii-LA.mjs.map +0 -1
  93. package/dist/MediaManagerPlugin.native-DaYFDzNM.mjs +0 -533
  94. package/dist/MediaManagerPlugin.native-DaYFDzNM.mjs.map +0 -1
  95. package/dist/MergeTagPlugin.native-CrxyThyn.mjs +0 -178
  96. package/dist/MergeTagPlugin.native-CrxyThyn.mjs.map +0 -1
  97. package/dist/PageBreakPlugin.native-DDjcDyRW.mjs +0 -172
  98. package/dist/PageBreakPlugin.native-DDjcDyRW.mjs.map +0 -1
  99. package/dist/PreviewPlugin.native-DBvfpmIv.mjs.map +0 -1
  100. package/dist/PrintPlugin.native-BUpm52VJ.mjs.map +0 -1
  101. package/dist/SpecialCharactersPlugin.native-x7a2SWXc.mjs.map +0 -1
  102. package/dist/SpellCheckPlugin.native-B7yTh0iE.mjs +0 -465
  103. package/dist/SpellCheckPlugin.native-B7yTh0iE.mjs.map +0 -1
  104. package/dist/StrikethroughPlugin.native-ChaZLaXw.mjs +0 -43
  105. package/dist/StrikethroughPlugin.native-ChaZLaXw.mjs.map +0 -1
  106. package/dist/TablePlugin.native-EEWXn1-s.mjs.map +0 -1
  107. package/dist/TemplatePlugin.native-BlSn1c9h.mjs +0 -564
  108. package/dist/TemplatePlugin.native-BlSn1c9h.mjs.map +0 -1
  109. package/dist/TextAlignmentPlugin.native-CQIs1m7R.mjs +0 -97
  110. package/dist/TextAlignmentPlugin.native-CQIs1m7R.mjs.map +0 -1
  111. package/dist/TextColorPlugin.native-D6SmTglm.mjs.map +0 -1
  112. package/dist/UnderlinePlugin.native-QpIcK4L2.mjs.map +0 -1
  113. package/dist/documentManager-irzj9n3V.mjs.map +0 -1
  114. package/dist/editorContainerHelpers-C7kdWnS0.mjs.map +0 -1
  115. package/dist/editora.min.js.map +0 -1
  116. package/dist/editora.umd.js.map +0 -1
  117. package/dist/index-BF5RBhL9.js +0 -4
  118. package/dist/index-BF5RBhL9.js.map +0 -1
  119. package/dist/index-BPsf460l.mjs +0 -1243
  120. package/dist/index-BPsf460l.mjs.map +0 -1
  121. package/dist/index.cjs.js.map +0 -1
  122. package/dist/index.es-CuicffkQ.mjs.map +0 -1
  123. package/dist/index.esm.js.map +0 -1
  124. package/dist/plugin-loader.js.map +0 -1
  125. package/dist/purify.es-CKpwg8Tk.mjs.map +0 -1
  126. package/dist/webcomponent-core.js.map +0 -1
  127. package/dist/webcomponent-core.min.js.map +0 -1
  128. package/dist/webcomponent.cjs.js.map +0 -1
  129. package/dist/webcomponent.esm.js.map +0 -1
  130. package/dist/webcomponent.js.map +0 -1
  131. package/dist/webcomponent.min.js.map +0 -1
@@ -1,4 +1,4 @@
1
- class P {
1
+ class R {
2
2
  constructor(e = "") {
3
3
  this._lines = [], this._version = 0, this.setText(e);
4
4
  }
@@ -42,9 +42,9 @@ class P {
42
42
  const i = this.getLine(e.start.line), r = i.substring(0, e.start.column) + t + i.substring(e.end.column);
43
43
  this._lines[e.start.line] = r;
44
44
  } else {
45
- const i = this.getLine(e.start.line), r = this.getLine(e.end.line), n = i.substring(0, e.start.column) + t, o = r.substring(e.end.column), a = t.split(`
45
+ const i = this.getLine(e.start.line), r = this.getLine(e.end.line), o = i.substring(0, e.start.column) + t, n = r.substring(e.end.column), l = t.split(`
46
46
  `);
47
- a[0] = n + a[0], a[a.length - 1] = a[a.length - 1] + o, this._lines.splice(e.start.line, e.end.line - e.start.line + 1, ...a);
47
+ l[0] = o + l[0], l[l.length - 1] = l[l.length - 1] + n, this._lines.splice(e.start.line, e.end.line - e.start.line + 1, ...l);
48
48
  }
49
49
  return this._version++, { range: e, text: t, oldText: s };
50
50
  }
@@ -92,11 +92,11 @@ class P {
92
92
  }
93
93
  // Clone the model
94
94
  clone() {
95
- const e = new P();
95
+ const e = new R();
96
96
  return e._lines = [...this._lines], e._version = this._version, e;
97
97
  }
98
98
  }
99
- class B {
99
+ class A {
100
100
  constructor(e) {
101
101
  this.gutterWidth = 50, this.lineHeight = 21, this.container = e, this.createDOM();
102
102
  }
@@ -195,32 +195,32 @@ class B {
195
195
  }
196
196
  // Set cursor position
197
197
  setCursorPosition(e) {
198
- var g, d;
198
+ var g, h;
199
199
  const t = this.getText().split(`
200
200
  `), s = Math.min(e.line, t.length - 1), i = Math.min(e.column, ((g = t[s]) == null ? void 0 : g.length) || 0);
201
201
  let r = 0;
202
202
  for (let f = 0; f < s; f++)
203
203
  r += t[f].length + 1;
204
204
  r += i;
205
- const n = document.createRange(), o = window.getSelection();
206
- let a = 0, c = null, l = 0;
207
- const h = document.createTreeWalker(
205
+ const o = document.createRange(), n = window.getSelection();
206
+ let l = 0, c = null, a = 0;
207
+ const u = document.createTreeWalker(
208
208
  this.contentElement,
209
209
  NodeFilter.SHOW_TEXT,
210
210
  null
211
211
  );
212
- let u;
213
- for (; u = h.nextNode(); ) {
214
- const f = ((d = u.textContent) == null ? void 0 : d.length) || 0;
215
- if (a + f >= r) {
216
- c = u, l = r - a;
212
+ let d;
213
+ for (; d = u.nextNode(); ) {
214
+ const f = ((h = d.textContent) == null ? void 0 : h.length) || 0;
215
+ if (l + f >= r) {
216
+ c = d, a = r - l;
217
217
  break;
218
218
  }
219
- a += f;
219
+ l += f;
220
220
  }
221
221
  if (c)
222
222
  try {
223
- n.setStart(c, l), n.setEnd(c, l), o == null || o.removeAllRanges(), o == null || o.addRange(n);
223
+ o.setStart(c, a), o.setEnd(c, a), n == null || n.removeAllRanges(), n == null || n.addRange(o);
224
224
  } catch (f) {
225
225
  console.warn("Could not set cursor position:", f);
226
226
  }
@@ -235,7 +235,7 @@ class B {
235
235
  const i = s.toString().split(`
236
236
  `), r = t.cloneRange();
237
237
  r.selectNodeContents(this.contentElement), r.setEnd(t.endContainer, t.endOffset);
238
- const n = r.toString().split(`
238
+ const o = r.toString().split(`
239
239
  `);
240
240
  return {
241
241
  start: {
@@ -243,8 +243,8 @@ class B {
243
243
  column: i[i.length - 1].length
244
244
  },
245
245
  end: {
246
- line: n.length - 1,
247
- column: n[n.length - 1].length
246
+ line: o.length - 1,
247
+ column: o[o.length - 1].length
248
248
  }
249
249
  };
250
250
  }
@@ -288,7 +288,7 @@ class B {
288
288
  this.container && this.container.parentNode && this.container.parentNode.removeChild(this.container), this._rafId && (cancelAnimationFrame(this._rafId), this._rafId = void 0);
289
289
  }
290
290
  }
291
- class K {
291
+ class V {
292
292
  constructor(e, t = {}) {
293
293
  this.extensions = /* @__PURE__ */ new Map(), this.commands = /* @__PURE__ */ new Map(), this.eventListeners = /* @__PURE__ */ new Map(), this.folds = [], this.currentTheme = "default", this.isDestroyed = !1, this.undoStack = [], this.redoStack = [], this.suppressHistory = !1, this.expectingProgrammaticCursor = !1, this.config = {
294
294
  value: "",
@@ -298,7 +298,7 @@ class K {
298
298
  lineWrapping: !1,
299
299
  lineNumbers: !0,
300
300
  ...t
301
- }, this.textModel = new P(this.config.value), this.view = new B(e), this.setupEventHandlers(), this.config.extensions && this.config.extensions.forEach((s) => this.addExtension(s)), this.setTheme(this.config.theme), this.view.setReadOnly(this.config.readOnly || !1), this.renderTextWithHighlight(this.textModel.getText()), this.registerBuiltInCommands();
301
+ }, this.textModel = new R(this.config.value), this.view = new A(e), this.setupEventHandlers(), this.config.extensions && this.config.extensions.forEach((s) => this.addExtension(s)), this.setTheme(this.config.theme), this.view.setReadOnly(this.config.readOnly || !1), this.renderTextWithHighlight(this.textModel.getText()), this.registerBuiltInCommands();
302
302
  }
303
303
  // Public accessors for extensions
304
304
  getTextModel() {
@@ -327,9 +327,9 @@ class K {
327
327
  const t = this.view.getText(), s = this.textModel.getText();
328
328
  if (t !== s) {
329
329
  if (!this.suppressHistory) {
330
- const i = this.getCursor().position, r = this.textModel.positionToOffset(i), n = this.getSelection();
331
- let o, a;
332
- n && (o = this.textModel.positionToOffset(n.start), a = this.textModel.positionToOffset(n.end)), this.undoStack.push({ text: s, cursorOffset: r, anchorOffset: o, focusOffset: a }), this.undoStack.length > 100 && this.undoStack.shift(), this.redoStack.length = 0;
330
+ const i = this.getCursor().position, r = this.textModel.positionToOffset(i), o = this.getSelection();
331
+ let n, l;
332
+ o && (n = this.textModel.positionToOffset(o.start), l = this.textModel.positionToOffset(o.end)), this.undoStack.push({ text: s, cursorOffset: r, anchorOffset: n, focusOffset: l }), this.undoStack.length > 100 && this.undoStack.shift(), this.redoStack.length = 0;
333
333
  }
334
334
  this.textModel.setText(t), this.highlightTimeout && clearTimeout(this.highlightTimeout), this.highlightTimeout = setTimeout(() => {
335
335
  this.renderTextWithHighlight(this.textModel.getText(), !1), this.highlightTimeout = null;
@@ -347,26 +347,26 @@ class K {
347
347
  if (!this.config.readOnly) {
348
348
  const s = window.getSelection();
349
349
  if (s && s.rangeCount > 0) {
350
- const i = this.getCursor().position, r = this.textModel.positionToOffset(i), n = this.getSelection();
351
- let o, a;
352
- n && (o = this.textModel.positionToOffset(n.start), a = this.textModel.positionToOffset(n.end)), this.suppressHistory || (this.undoStack.push({ text: this.textModel.getText(), cursorOffset: r, anchorOffset: o, focusOffset: a }), this.undoStack.length > 100 && this.undoStack.shift(), this.redoStack.length = 0);
350
+ const i = this.getCursor().position, r = this.textModel.positionToOffset(i), o = this.getSelection();
351
+ let n, l;
352
+ o && (n = this.textModel.positionToOffset(o.start), l = this.textModel.positionToOffset(o.end)), this.suppressHistory || (this.undoStack.push({ text: this.textModel.getText(), cursorOffset: r, anchorOffset: n, focusOffset: l }), this.undoStack.length > 100 && this.undoStack.shift(), this.redoStack.length = 0);
353
353
  const c = s.getRangeAt(0);
354
354
  c.deleteContents();
355
- const l = document.createTextNode(`
355
+ const a = document.createTextNode(`
356
356
  `);
357
- c.insertNode(l), c.setStartAfter(l), c.collapse(!0), s.removeAllRanges(), s.addRange(c);
358
- const h = this.getCursor().position, u = this.textModel.positionToOffset(h), g = this.getSelection();
359
- let d, f;
360
- g && (d = this.textModel.positionToOffset(g.start), f = this.textModel.positionToOffset(g.end));
357
+ c.insertNode(a), c.setStartAfter(a), c.collapse(!0), s.removeAllRanges(), s.addRange(c);
358
+ const u = this.getCursor().position, d = this.textModel.positionToOffset(u), g = this.getSelection();
359
+ let h, f;
360
+ g && (h = this.textModel.positionToOffset(g.start), f = this.textModel.positionToOffset(g.end));
361
361
  const p = this.view.getText();
362
362
  this.textModel.setText(p), this.highlightTimeout && clearTimeout(this.highlightTimeout), this.highlightTimeout = setTimeout(() => {
363
363
  this.renderTextWithHighlight(this.textModel.getText(), !1), requestAnimationFrame(() => {
364
364
  try {
365
- if (g && (d !== void 0 || f !== void 0)) {
366
- const x = d !== void 0 ? d : u, y = f !== void 0 ? f : u, v = Math.min(x, y), C = Math.max(x, y), L = this.textModel.offsetToPosition(v), T = this.textModel.offsetToPosition(C);
367
- this.setSelection({ start: L, end: T });
365
+ if (g && (h !== void 0 || f !== void 0)) {
366
+ const x = h !== void 0 ? h : d, b = f !== void 0 ? f : d, y = Math.min(x, b), C = Math.max(x, b), L = this.textModel.offsetToPosition(y), w = this.textModel.offsetToPosition(C);
367
+ this.setSelection({ start: L, end: w });
368
368
  } else {
369
- const x = this.textModel.offsetToPosition(u);
369
+ const x = this.textModel.offsetToPosition(d);
370
370
  this.setCursor(x);
371
371
  }
372
372
  } catch (x) {
@@ -500,25 +500,25 @@ class K {
500
500
  }, i = [], r = this.getValue();
501
501
  r.split(`
502
502
  `);
503
- let n = s.caseSensitive ? r : r.toLowerCase(), o = s.caseSensitive ? e : e.toLowerCase();
503
+ let o = s.caseSensitive ? r : r.toLowerCase(), n = s.caseSensitive ? e : e.toLowerCase();
504
504
  if (s.regex) {
505
- const a = new RegExp(o, s.caseSensitive ? "g" : "gi");
505
+ const l = new RegExp(n, s.caseSensitive ? "g" : "gi");
506
506
  let c;
507
- for (; (c = a.exec(n)) !== null; ) {
508
- const l = this.textModel.offsetToPosition(c.index), h = this.textModel.offsetToPosition(c.index + c[0].length);
507
+ for (; (c = l.exec(o)) !== null; ) {
508
+ const a = this.textModel.offsetToPosition(c.index), u = this.textModel.offsetToPosition(c.index + c[0].length);
509
509
  i.push({
510
- range: { start: l, end: h },
510
+ range: { start: a, end: u },
511
511
  match: c[0]
512
512
  });
513
513
  }
514
514
  } else {
515
- let a = 0, c = n.indexOf(o, a);
515
+ let l = 0, c = o.indexOf(n, l);
516
516
  for (; c !== -1; ) {
517
- const l = c + e.length, h = this.textModel.offsetToPosition(c), u = this.textModel.offsetToPosition(l);
517
+ const a = c + e.length, u = this.textModel.offsetToPosition(c), d = this.textModel.offsetToPosition(a);
518
518
  i.push({
519
- range: { start: h, end: u },
520
- match: r.substring(c, l)
521
- }), a = l, c = n.indexOf(o, a);
519
+ range: { start: u, end: d },
520
+ match: r.substring(c, a)
521
+ }), l = a, c = o.indexOf(n, l);
522
522
  }
523
523
  }
524
524
  return i;
@@ -526,9 +526,9 @@ class K {
526
526
  replace(e, t) {
527
527
  const s = this.getValue();
528
528
  if (!this.suppressHistory) {
529
- const r = this.getCursor().position, n = this.textModel.positionToOffset(r), o = this.getSelection();
530
- let a, c;
531
- o && (a = this.textModel.positionToOffset(o.start), c = this.textModel.positionToOffset(o.end)), this.undoStack.push({ text: s, cursorOffset: n, anchorOffset: a, focusOffset: c }), this.undoStack.length > 100 && this.undoStack.shift(), this.redoStack.length = 0;
529
+ const r = this.getCursor().position, o = this.textModel.positionToOffset(r), n = this.getSelection();
530
+ let l, c;
531
+ n && (l = this.textModel.positionToOffset(n.start), c = this.textModel.positionToOffset(n.end)), this.undoStack.push({ text: s, cursorOffset: o, anchorOffset: l, focusOffset: c }), this.undoStack.length > 100 && this.undoStack.shift(), this.redoStack.length = 0;
532
532
  }
533
533
  const i = this.textModel.replaceRange(e, t);
534
534
  this.renderTextWithHighlight(this.getValue(), !1), this.emit("change", [i]);
@@ -536,8 +536,8 @@ class K {
536
536
  replaceAll(e, t, s = {}) {
537
537
  const i = this.search(e, s);
538
538
  let r = 0;
539
- for (let n = i.length - 1; n >= 0; n--)
540
- this.replace(i[n].range, t), r++;
539
+ for (let o = i.length - 1; o >= 0; o--)
540
+ this.replace(i[o].range, t), r++;
541
541
  return r;
542
542
  }
543
543
  // Folding (basic implementation)
@@ -574,23 +574,23 @@ class K {
574
574
  if (s && typeof s.highlightHTML == "function")
575
575
  try {
576
576
  const i = !t && !this.expectingProgrammaticCursor;
577
- let r, n, o, a;
577
+ let r, o, n, l;
578
578
  if (t || i) {
579
579
  r = this.getSelection();
580
- const l = this.getCursor().position;
581
- n = this.textModel.positionToOffset(l), r && (o = this.textModel.positionToOffset(r.start), a = this.textModel.positionToOffset(r.end));
580
+ const a = this.getCursor().position;
581
+ o = this.textModel.positionToOffset(a), r && (n = this.textModel.positionToOffset(r.start), l = this.textModel.positionToOffset(r.end));
582
582
  }
583
583
  const c = s.highlightHTML(e);
584
584
  typeof this.view.setHighlightHTML == "function" ? this.view.setHighlightHTML(c) : this.view.setHTML(c), (t || i) && requestAnimationFrame(() => {
585
585
  try {
586
- if (r && (o !== void 0 || a !== void 0)) {
587
- const l = o !== void 0 ? o : n, h = a !== void 0 ? a : n, u = Math.min(l, h), g = Math.max(l, h), d = this.textModel.offsetToPosition(u), f = this.textModel.offsetToPosition(g);
588
- this.view.setSelectionRange({ start: d, end: f });
589
- } else if (n !== void 0) {
590
- const l = this.textModel.offsetToPosition(n);
591
- this.view.setCursorPosition(l);
586
+ if (r && (n !== void 0 || l !== void 0)) {
587
+ const a = n !== void 0 ? n : o, u = l !== void 0 ? l : o, d = Math.min(a, u), g = Math.max(a, u), h = this.textModel.offsetToPosition(d), f = this.textModel.offsetToPosition(g);
588
+ this.view.setSelectionRange({ start: h, end: f });
589
+ } else if (o !== void 0) {
590
+ const a = this.textModel.offsetToPosition(o);
591
+ this.view.setCursorPosition(a);
592
592
  }
593
- } catch (l) {
593
+ } catch (a) {
594
594
  }
595
595
  });
596
596
  return;
@@ -619,8 +619,8 @@ class K {
619
619
  try {
620
620
  if (i != null)
621
621
  if (typeof e != "string" && (e.anchorOffset !== void 0 || e.focusOffset !== void 0)) {
622
- const r = e.anchorOffset !== void 0 ? e.anchorOffset : i, n = e.focusOffset !== void 0 ? e.focusOffset : i, o = Math.min(r, n), a = Math.max(r, n), c = this.textModel.offsetToPosition(o), l = this.textModel.offsetToPosition(a);
623
- this.setSelection({ start: c, end: l });
622
+ const r = e.anchorOffset !== void 0 ? e.anchorOffset : i, o = e.focusOffset !== void 0 ? e.focusOffset : i, n = Math.min(r, o), l = Math.max(r, o), c = this.textModel.offsetToPosition(n), a = this.textModel.offsetToPosition(l);
623
+ this.setSelection({ start: c, end: a });
624
624
  } else {
625
625
  const r = this.textModel.offsetToPosition(i);
626
626
  this.setCursor(r);
@@ -645,8 +645,8 @@ class K {
645
645
  try {
646
646
  if (i != null)
647
647
  if (typeof e != "string" && (e.anchorOffset !== void 0 || e.focusOffset !== void 0)) {
648
- const r = e.anchorOffset !== void 0 ? e.anchorOffset : i, n = e.focusOffset !== void 0 ? e.focusOffset : i, o = Math.min(r, n), a = Math.max(r, n), c = this.textModel.offsetToPosition(o), l = this.textModel.offsetToPosition(a);
649
- this.setSelection({ start: c, end: l });
648
+ const r = e.anchorOffset !== void 0 ? e.anchorOffset : i, o = e.focusOffset !== void 0 ? e.focusOffset : i, n = Math.min(r, o), l = Math.max(r, o), c = this.textModel.offsetToPosition(n), a = this.textModel.offsetToPosition(l);
649
+ this.setSelection({ start: c, end: a });
650
650
  } else {
651
651
  const r = this.textModel.offsetToPosition(i);
652
652
  this.setCursor(r);
@@ -665,9 +665,9 @@ class K {
665
665
  if (this.config.readOnly) return;
666
666
  const e = this.getCursor().position, t = this.textModel.positionToOffset(e), s = " ".repeat(this.config.tabSize || 2), i = this.textModel.insertText(e, s), r = this.textModel.offsetToPosition(this.textModel.positionToOffset(e) + s.length);
667
667
  if (!this.suppressHistory) {
668
- const n = this.getSelection();
669
- let o, a;
670
- n && (o = this.textModel.positionToOffset(n.start), a = this.textModel.positionToOffset(n.end)), this.undoStack.push({ text: this.getValue(), cursorOffset: t, anchorOffset: o, focusOffset: a }), this.redoStack.length = 0;
668
+ const o = this.getSelection();
669
+ let n, l;
670
+ o && (n = this.textModel.positionToOffset(o.start), l = this.textModel.positionToOffset(o.end)), this.undoStack.push({ text: this.getValue(), cursorOffset: t, anchorOffset: n, focusOffset: l }), this.redoStack.length = 0;
671
671
  }
672
672
  this.expectingProgrammaticCursor = !0, this.renderTextWithHighlight(this.getValue(), !1), this.setCursor(r), setTimeout(() => {
673
673
  this.expectingProgrammaticCursor = !1;
@@ -680,8 +680,8 @@ class K {
680
680
  `), i = this.textModel.offsetToPosition(this.textModel.positionToOffset(e) + 1);
681
681
  if (!this.suppressHistory) {
682
682
  const r = this.getSelection();
683
- let n, o;
684
- r && (n = this.textModel.positionToOffset(r.start), o = this.textModel.positionToOffset(r.end)), this.undoStack.push({ text: this.getValue(), cursorOffset: t, anchorOffset: n, focusOffset: o }), this.redoStack.length = 0;
683
+ let o, n;
684
+ r && (o = this.textModel.positionToOffset(r.start), n = this.textModel.positionToOffset(r.end)), this.undoStack.push({ text: this.getValue(), cursorOffset: t, anchorOffset: o, focusOffset: n }), this.redoStack.length = 0;
685
685
  }
686
686
  this.expectingProgrammaticCursor = !0, this.renderTextWithHighlight(this.getValue(), !1), this.setCursor(i), setTimeout(() => {
687
687
  this.expectingProgrammaticCursor = !1;
@@ -701,7 +701,7 @@ class K {
701
701
  s.length = 0;
702
702
  }
703
703
  }
704
- class V {
704
+ class U {
705
705
  constructor(e) {
706
706
  this.name = "keymap", this.editor = null, this.keymap = {}, this.isMac = navigator.platform.toUpperCase().indexOf("MAC") >= 0, this.keymap = e || this.getDefaultKeymap();
707
707
  }
@@ -715,11 +715,11 @@ class V {
715
715
  return this.editor.executeCommand(t.command), e.preventDefault(), e.stopPropagation(), !1;
716
716
  }
717
717
  findMatchingBinding(e) {
718
- const { key: t, ctrlKey: s, altKey: i, shiftKey: r, metaKey: n } = e, o = String(t).toLowerCase(), a = this.keymap[o];
719
- if (!a) return null;
720
- for (const c of a) {
721
- const l = c.ctrlKey === void 0 || c.ctrlKey === s, h = c.altKey === void 0 || c.altKey === i, u = c.shiftKey === void 0 || c.shiftKey === r, g = c.metaKey === void 0 || c.metaKey === n;
722
- if (l && h && u && g)
718
+ const { key: t, ctrlKey: s, altKey: i, shiftKey: r, metaKey: o } = e, n = String(t).toLowerCase(), l = this.keymap[n];
719
+ if (!l) return null;
720
+ for (const c of l) {
721
+ const a = c.ctrlKey === void 0 || c.ctrlKey === s, u = c.altKey === void 0 || c.altKey === i, d = c.shiftKey === void 0 || c.shiftKey === r, g = c.metaKey === void 0 || c.metaKey === o;
722
+ if (a && u && d && g)
723
723
  return c;
724
724
  }
725
725
  return null;
@@ -775,7 +775,7 @@ class V {
775
775
  this.keymap = {}, this.editor = null;
776
776
  }
777
777
  }
778
- class A {
778
+ class z {
779
779
  constructor() {
780
780
  this.name = "transaction", this.transactions = [];
781
781
  }
@@ -797,7 +797,7 @@ class A {
797
797
  this.transactions = [];
798
798
  }
799
799
  }
800
- class U {
800
+ class q {
801
801
  constructor() {
802
802
  this.name = "line-numbers", this.editor = null, this.lineNumbersElement = null, this.isEnabled = !0;
803
803
  }
@@ -828,7 +828,7 @@ class U {
828
828
  this.lineNumbersElement = null, this.editor = null;
829
829
  }
830
830
  }
831
- class z {
831
+ class _ {
832
832
  constructor() {
833
833
  this.name = "theme", this.editor = null, this.currentTheme = "dark";
834
834
  }
@@ -853,7 +853,7 @@ class z {
853
853
  this.editor = null;
854
854
  }
855
855
  }
856
- class q {
856
+ class F {
857
857
  constructor() {
858
858
  this.name = "read-only", this.editor = null, this.isReadOnly = !1;
859
859
  }
@@ -880,7 +880,7 @@ class q {
880
880
  this.editor = null;
881
881
  }
882
882
  }
883
- class F {
883
+ class D {
884
884
  constructor() {
885
885
  this.name = "search", this.editor = null, this.searchUI = null, this.isVisible = !1, this.currentResults = [], this.currentIndex = -1;
886
886
  }
@@ -989,14 +989,14 @@ class F {
989
989
  margin-top: 4px;
990
990
  " />
991
991
  `;
992
- const t = this.searchUI.querySelector("input"), s = this.searchUI.querySelector(".search-replace-input"), i = this.searchUI.querySelector(".search-prev"), r = this.searchUI.querySelector(".search-next"), n = this.searchUI.querySelector(".search-close");
992
+ const t = this.searchUI.querySelector("input"), s = this.searchUI.querySelector(".search-replace-input"), i = this.searchUI.querySelector(".search-prev"), r = this.searchUI.querySelector(".search-next"), o = this.searchUI.querySelector(".search-close");
993
993
  t.addEventListener("input", () => {
994
994
  this.performSearch(t.value);
995
- }), t.addEventListener("keydown", (o) => {
996
- o.key === "Enter" && (o.preventDefault(), o.shiftKey ? this.findPrev() : this.findNext());
997
- }), s.addEventListener("keydown", (o) => {
998
- o.key === "Enter" && (o.preventDefault(), o.shiftKey ? this.replaceAll(t.value, s.value) : this.replaceCurrent(t.value, s.value));
999
- }), i.addEventListener("click", () => this.findPrev()), r.addEventListener("click", () => this.findNext()), n.addEventListener("click", () => this.hideSearch()), e.appendChild(this.searchUI);
995
+ }), t.addEventListener("keydown", (n) => {
996
+ n.key === "Enter" && (n.preventDefault(), n.shiftKey ? this.findPrev() : this.findNext());
997
+ }), s.addEventListener("keydown", (n) => {
998
+ n.key === "Enter" && (n.preventDefault(), n.shiftKey ? this.replaceAll(t.value, s.value) : this.replaceCurrent(t.value, s.value));
999
+ }), i.addEventListener("click", () => this.findPrev()), r.addEventListener("click", () => this.findNext()), o.addEventListener("click", () => this.hideSearch()), e.appendChild(this.searchUI);
1000
1000
  }
1001
1001
  performSearch(e) {
1002
1002
  if (!this.editor || !e.trim()) {
@@ -1006,9 +1006,9 @@ class F {
1006
1006
  const t = this.editor.getValue(), s = [];
1007
1007
  let i = t.toLowerCase().indexOf(e.toLowerCase());
1008
1008
  for (; i !== -1; ) {
1009
- const r = this.getPositionFromOffset(t, i), n = this.getPositionFromOffset(t, i + e.length);
1009
+ const r = this.getPositionFromOffset(t, i), o = this.getPositionFromOffset(t, i + e.length);
1010
1010
  s.push({
1011
- range: { start: r, end: n },
1011
+ range: { start: r, end: o },
1012
1012
  match: t.substring(i, i + e.length)
1013
1013
  }), i = t.toLowerCase().indexOf(e.toLowerCase(), i + 1);
1014
1014
  }
@@ -1029,8 +1029,8 @@ class F {
1029
1029
  if (!this.editor || !e.trim() || this.currentIndex === -1) return;
1030
1030
  const s = this.currentResults[this.currentIndex];
1031
1031
  if (!s) return;
1032
- const i = this.editor.getValue(), r = this.getOffsetFromPosition(i, s.range.start), n = i.substring(0, r), o = i.substring(r + e.length), a = n + t + o;
1033
- this.editor.setValue(a), this.performSearch(e), this.updateStatus("Replaced current occurrence");
1032
+ const i = this.editor.getValue(), r = this.getOffsetFromPosition(i, s.range.start), o = i.substring(0, r), n = i.substring(r + e.length), l = o + t + n;
1033
+ this.editor.setValue(l), this.performSearch(e), this.updateStatus("Replaced current occurrence");
1034
1034
  }
1035
1035
  replaceAll(e, t) {
1036
1036
  if (!this.editor || !e.trim()) return;
@@ -1061,7 +1061,7 @@ class F {
1061
1061
  this.searchUI && this.searchUI.parentNode && this.searchUI.parentNode.removeChild(this.searchUI), this.searchUI = null, this.editor = null;
1062
1062
  }
1063
1063
  }
1064
- class _ {
1064
+ class W {
1065
1065
  constructor() {
1066
1066
  this.name = "bracket-matching", this.editor = null, this.bracketPairs = {
1067
1067
  "(": ")",
@@ -1102,22 +1102,22 @@ class _ {
1102
1102
  }
1103
1103
  findMatchingBracket(e, t) {
1104
1104
  const s = e.split(`
1105
- `), i = t.position.line, r = t.position.column, n = t.char;
1106
- return this.bracketPairs[n] ? this.findClosingBracket(e, s, i, r, n) : this.reverseBracketPairs[n] ? this.findOpeningBracket(e, s, i, r, n) : null;
1105
+ `), i = t.position.line, r = t.position.column, o = t.char;
1106
+ return this.bracketPairs[o] ? this.findClosingBracket(e, s, i, r, o) : this.reverseBracketPairs[o] ? this.findOpeningBracket(e, s, i, r, o) : null;
1107
1107
  }
1108
1108
  findClosingBracket(e, t, s, i, r) {
1109
- const n = this.bracketPairs[r];
1110
- let o = 0;
1111
- for (let a = s; a < t.length; a++) {
1112
- const c = t[a], l = a === s ? i : 0;
1113
- for (let h = l; h < c.length; h++) {
1114
- const u = c[h];
1115
- if (u === r)
1116
- o++;
1117
- else if (u === n && (o--, o === 0))
1109
+ const o = this.bracketPairs[r];
1110
+ let n = 0;
1111
+ for (let l = s; l < t.length; l++) {
1112
+ const c = t[l], a = l === s ? i : 0;
1113
+ for (let u = a; u < c.length; u++) {
1114
+ const d = c[u];
1115
+ if (d === r)
1116
+ n++;
1117
+ else if (d === o && (n--, n === 0))
1118
1118
  return {
1119
1119
  open: { start: { line: s, column: i }, end: { line: s, column: i + 1 } },
1120
- close: { start: { line: a, column: h }, end: { line: a, column: h + 1 } },
1120
+ close: { start: { line: l, column: u }, end: { line: l, column: u + 1 } },
1121
1121
  type: r
1122
1122
  };
1123
1123
  }
@@ -1125,19 +1125,19 @@ class _ {
1125
1125
  return null;
1126
1126
  }
1127
1127
  findOpeningBracket(e, t, s, i, r) {
1128
- const n = this.reverseBracketPairs[r];
1129
- let o = 0;
1130
- for (let a = s; a >= 0; a--) {
1131
- const c = t[a], l = a === s ? i : c.length - 1;
1132
- for (let h = l; h >= 0; h--) {
1133
- const u = c[h];
1134
- if (u === r)
1135
- o++;
1136
- else if (u === n && (o--, o === 0))
1128
+ const o = this.reverseBracketPairs[r];
1129
+ let n = 0;
1130
+ for (let l = s; l >= 0; l--) {
1131
+ const c = t[l], a = l === s ? i : c.length - 1;
1132
+ for (let u = a; u >= 0; u--) {
1133
+ const d = c[u];
1134
+ if (d === r)
1135
+ n++;
1136
+ else if (d === o && (n--, n === 0))
1137
1137
  return {
1138
- open: { start: { line: a, column: h }, end: { line: a, column: h + 1 } },
1138
+ open: { start: { line: l, column: u }, end: { line: l, column: u + 1 } },
1139
1139
  close: { start: { line: s, column: i }, end: { line: s, column: i + 1 } },
1140
- type: n
1140
+ type: o
1141
1141
  };
1142
1142
  }
1143
1143
  }
@@ -1155,7 +1155,7 @@ class _ {
1155
1155
  this.clearBracketHighlighting(), this.editor = null;
1156
1156
  }
1157
1157
  }
1158
- class D {
1158
+ class j {
1159
1159
  constructor() {
1160
1160
  this.name = "code-folding", this.editor = null, this.foldIndicators = [], this.foldingUI = null;
1161
1161
  }
@@ -1234,7 +1234,7 @@ class D {
1234
1234
  this.foldingUI && this.foldingUI.parentNode && this.foldingUI.parentNode.removeChild(this.foldingUI), this.foldingUI = null, this.foldIndicators = [], this.editor = null;
1235
1235
  }
1236
1236
  }
1237
- class W {
1237
+ class Z {
1238
1238
  constructor() {
1239
1239
  this.name = "syntax-highlighting", this.editor = null, this.currentTheme = "dark", this.currentLanguage = null, this.modes = /* @__PURE__ */ new Map();
1240
1240
  }
@@ -1322,111 +1322,111 @@ class W {
1322
1322
  _highlightHTML(e, t) {
1323
1323
  const s = t, i = (c) => this.escapeHTML(c);
1324
1324
  let r = i(e);
1325
- const n = (c) => {
1326
- let l = c.replace(/&quot;/g, '"').replace(/&#39;/g, "'");
1327
- return l = l.replace(/(\/\*[\s\S]*?\*\/)/g, `<span style="color: ${s.comment};">$1</span>`), l = l.replace(/([a-zA-Z-]+)(\s*:\s*)([^;{]+)(;?)/g, (h, u, g, d, f) => {
1328
- const p = String(d).trim(), x = i(p);
1329
- return `<span style="color: ${s.styleProp};">${u}</span>${g}<span style="color: ${s.styleVal};">${x}</span>${f}`;
1330
- }), l;
1331
- }, o = [];
1325
+ const o = (c) => {
1326
+ let a = c.replace(/&quot;/g, '"').replace(/&#39;/g, "'");
1327
+ return a = a.replace(/(\/\*[\s\S]*?\*\/)/g, `<span style="color: ${s.comment};">$1</span>`), a = a.replace(/([a-zA-Z-]+)(\s*:\s*)([^;{]+)(;?)/g, (u, d, g, h, f) => {
1328
+ const p = String(h).trim(), x = i(p);
1329
+ return `<span style="color: ${s.styleProp};">${d}</span>${g}<span style="color: ${s.styleVal};">${x}</span>${f}`;
1330
+ }), a;
1331
+ }, n = [];
1332
1332
  try {
1333
- e.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi, (c, l, h) => (o.push({ attrs: String(l || ""), inner: String(h || "") }), c));
1333
+ e.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi, (c, a, u) => (n.push({ attrs: String(a || ""), inner: String(u || "") }), c));
1334
1334
  } catch (c) {
1335
1335
  }
1336
- let a = 0;
1337
- return r = r.replace(/(&lt;script\b([^&>]*)&gt;)([\s\S]*?)(&lt;\/script&gt;)/gi, (c, l, h, u, g) => {
1338
- var p, x, y;
1339
- const d = (x = (p = o[a++]) == null ? void 0 : p.inner) != null ? x : this.unescapeEntitiesRepeated(u || "");
1340
- (((y = o[a - 1]) == null ? void 0 : y.attrs) || h || "").toLowerCase();
1341
- const f = this._highlightJS(d, s);
1342
- return `${l}${f}${g}`;
1343
- }), r = r.replace(/(&lt;style\b[^&]*&gt;)([\s\S]*?)(&lt;\/style&gt;)/gi, (c, l, h, u) => {
1344
- const g = n(h);
1345
- return `${l}${g}${u}`;
1346
- }), r = r.replace(/(&lt;!--[\s\S]*?--&gt;)/g, `<span style="color: ${s.comment};">$1</span>`), r = r.replace(/(&lt;!DOCTYPE[\s\S]*?&gt;)/i, `<span style="color: ${s.doctype};">$1</span>`), r = r.replace(/(&lt;\/?\s*)([^\s&>\/]+)([\s\S]*?)(\/?&gt;)/g, (c, l, h, u, g) => {
1347
- const d = `<span style="color: ${s.tag};">${h}</span>`;
1348
- let f = u;
1349
- return f = f.replace(/([\w:-]+)(\s*=\s*)((&quot;[\s\S]*?&quot;|&#39;[\s\S]*?&#39;|[^\s&>]+))/g, (p, x, y, v) => {
1336
+ let l = 0;
1337
+ return r = r.replace(/(&lt;script\b([^&>]*)&gt;)([\s\S]*?)(&lt;\/script&gt;)/gi, (c, a, u, d, g) => {
1338
+ var p, x, b;
1339
+ const h = (x = (p = n[l++]) == null ? void 0 : p.inner) != null ? x : this.unescapeEntitiesRepeated(d || "");
1340
+ (((b = n[l - 1]) == null ? void 0 : b.attrs) || u || "").toLowerCase();
1341
+ const f = this._highlightJS(h, s);
1342
+ return `${a}${f}${g}`;
1343
+ }), r = r.replace(/(&lt;style\b[^&]*&gt;)([\s\S]*?)(&lt;\/style&gt;)/gi, (c, a, u, d) => {
1344
+ const g = o(u);
1345
+ return `${a}${g}${d}`;
1346
+ }), r = r.replace(/(&lt;!--[\s\S]*?--&gt;)/g, `<span style="color: ${s.comment};">$1</span>`), r = r.replace(/(&lt;!DOCTYPE[\s\S]*?&gt;)/i, `<span style="color: ${s.doctype};">$1</span>`), r = r.replace(/(&lt;\/?\s*)([^\s&>\/]+)([\s\S]*?)(\/?&gt;)/g, (c, a, u, d, g) => {
1347
+ const h = `<span style="color: ${s.tag};">${u}</span>`;
1348
+ let f = d;
1349
+ return f = f.replace(/([\w:-]+)(\s*=\s*)((&quot;[\s\S]*?&quot;|&#39;[\s\S]*?&#39;|[^\s&>]+))/g, (p, x, b, y) => {
1350
1350
  const C = String(x).toLowerCase(), L = `<span style="color: ${s.attrName};">${x}</span>`;
1351
- let T = v, k = "";
1352
- v.startsWith("&quot;") && v.endsWith("&quot;") ? (T = v.slice(6, -6), k = "&quot;") : v.startsWith("&#39;") && v.endsWith("&#39;") && (T = v.slice(5, -5), k = "&#39;");
1353
- let w = v;
1351
+ let w = y, v = "";
1352
+ y.startsWith("&quot;") && y.endsWith("&quot;") ? (w = y.slice(6, -6), v = "&quot;") : y.startsWith("&#39;") && y.endsWith("&#39;") && (w = y.slice(5, -5), v = "&#39;");
1353
+ let T = y;
1354
1354
  if (C === "style") {
1355
- const S = T.replace(/([\w-]+)\s*:\s*([^;]+)(;?)/g, ($, E, O, H) => `<span style="color: ${s.styleProp};">${E}</span>:<span style="color: ${s.styleVal};">${O.trim()}</span>${H}`);
1356
- k ? w = `${k}${S}${k}` : w = S, w = `<span style="color: ${s.attrValue};">${w}</span>`;
1355
+ const S = w.replace(/([\w-]+)\s*:\s*([^;]+)(;?)/g, ($, E, O, H) => `<span style="color: ${s.styleProp};">${E}</span>:<span style="color: ${s.styleVal};">${O.trim()}</span>${H}`);
1356
+ v ? T = `${v}${S}${v}` : T = S, T = `<span style="color: ${s.attrValue};">${T}</span>`;
1357
1357
  } else
1358
- k && (w = `${k}${T}${k}`), w = `<span style="color: ${s.attrValue};">${w}</span>`;
1359
- return `${L}${y}${w}`;
1360
- }), `${l}${d}${f}${g}`;
1358
+ v && (T = `${v}${w}${v}`), T = `<span style="color: ${s.attrValue};">${T}</span>`;
1359
+ return `${L}${b}${T}`;
1360
+ }), `${a}${h}${f}${g}`;
1361
1361
  }), r;
1362
1362
  }
1363
1363
  _highlightJS(e, t) {
1364
1364
  const s = this.unescapeEntitiesRepeated(e);
1365
1365
  this.escapeHTML(s);
1366
- const i = [], r = (u) => {
1367
- let g = "", d = u;
1366
+ const i = [], r = (d) => {
1367
+ let g = "", h = d;
1368
1368
  do
1369
- g = String.fromCharCode(97 + d % 26) + g, d = Math.floor(d / 26) - 1;
1370
- while (d >= 0);
1369
+ g = String.fromCharCode(97 + h % 26) + g, h = Math.floor(h / 26) - 1;
1370
+ while (h >= 0);
1371
1371
  return g || "a";
1372
- }, n = (u) => `\0${r(u)}\0`, o = (u) => {
1372
+ }, o = (d) => `\0${r(d)}\0`, n = (d) => {
1373
1373
  const g = i.length;
1374
- return i.push(u), n(g);
1374
+ return i.push(d), o(g);
1375
1375
  };
1376
- let a;
1376
+ let l;
1377
1377
  const c = /(\/\*[\s\S]*?\*\/)|(\/\/[^\n\r]*)|("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|`(?:\\.|[^`\\])*`)/g;
1378
- let l = 0, h = "";
1379
- for (; a = c.exec(s); ) {
1380
- const u = a.index;
1381
- l < u && (h += this.escapeHTML(s.slice(l, u)));
1382
- const g = a[0];
1383
- /^\/\*/.test(g) || /^\/\//.test(g) ? h += o(`<span style="color: ${t.comment};">${this.escapeHTML(g)}</span>`) : h += o(`<span style="color: ${t.string};">${this.escapeHTML(g)}</span>`), l = c.lastIndex;
1378
+ let a = 0, u = "";
1379
+ for (; l = c.exec(s); ) {
1380
+ const d = l.index;
1381
+ a < d && (u += this.escapeHTML(s.slice(a, d)));
1382
+ const g = l[0];
1383
+ /^\/\*/.test(g) || /^\/\//.test(g) ? u += n(`<span style="color: ${t.comment};">${this.escapeHTML(g)}</span>`) : u += n(`<span style="color: ${t.string};">${this.escapeHTML(g)}</span>`), a = c.lastIndex;
1384
1384
  }
1385
- return l < s.length && (h += this.escapeHTML(s.slice(l))), h = h.replace(/\b(0x[0-9a-fA-F]+|\d+\.?\d*|\d*\.\d+)\b/g, (u, g, d) => {
1386
- const f = h[d - 1] || "", p = h[d + u.length] || "";
1387
- return f === "&" || f === "#" || p === ";" || p === "#" ? u : `<span style="color: ${t.number};">${u}</span>`;
1388
- }), h = h.replace(/\b(const|let|var|function|class|if|else|return|for|while|switch|case|break|import|from|export|extends|new|try|catch|finally|throw|await|async|interface|type)\b/g, `<span style="color: ${t.keyword};">$1</span>`), h.replace(/\u0000([a-z]+)\u0000/g, (u, g) => {
1389
- let d = 0;
1385
+ return a < s.length && (u += this.escapeHTML(s.slice(a))), u = u.replace(/\b(0x[0-9a-fA-F]+|\d+\.?\d*|\d*\.\d+)\b/g, (d, g, h) => {
1386
+ const f = u[h - 1] || "", p = u[h + d.length] || "";
1387
+ return f === "&" || f === "#" || p === ";" || p === "#" ? d : `<span style="color: ${t.number};">${d}</span>`;
1388
+ }), u = u.replace(/\b(const|let|var|function|class|if|else|return|for|while|switch|case|break|import|from|export|extends|new|try|catch|finally|throw|await|async|interface|type)\b/g, `<span style="color: ${t.keyword};">$1</span>`), u.replace(/\u0000([a-z]+)\u0000/g, (d, g) => {
1389
+ let h = 0;
1390
1390
  for (let f = 0; f < g.length; f++)
1391
- d = d * 26 + (g.charCodeAt(f) - 97 + 1);
1392
- return d = d - 1, i[d] || "";
1391
+ h = h * 26 + (g.charCodeAt(f) - 97 + 1);
1392
+ return h = h - 1, i[h] || "";
1393
1393
  });
1394
1394
  }
1395
1395
  _highlightPHP(e, t) {
1396
1396
  const s = this.unescapeEntitiesRepeated(e);
1397
1397
  let i = this.escapeHTML(s);
1398
- const r = [], n = (d) => {
1399
- let f = "", p = d;
1398
+ const r = [], o = (h) => {
1399
+ let f = "", p = h;
1400
1400
  do
1401
1401
  f = String.fromCharCode(97 + p % 26) + f, p = Math.floor(p / 26) - 1;
1402
1402
  while (p >= 0);
1403
1403
  return f || "a";
1404
- }, o = (d) => {
1404
+ }, n = (h) => {
1405
1405
  const f = r.length;
1406
- return r.push(d), `\0${n(f)}\0`;
1407
- }, a = (d, f) => {
1408
- const p = i.indexOf(d);
1409
- return p === -1 ? !1 : (i = i.slice(0, p) + f + i.slice(p + d.length), !0);
1406
+ return r.push(h), `\0${o(f)}\0`;
1407
+ }, l = (h, f) => {
1408
+ const p = i.indexOf(h);
1409
+ return p === -1 ? !1 : (i = i.slice(0, p) + f + i.slice(p + h.length), !0);
1410
1410
  };
1411
1411
  let c;
1412
- const l = /\/\*[\s\S]*?\*\//g, h = /\/\/[^\n\r]*/g, u = /\#([^\n\r]*)/g, g = /("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')/g;
1413
- for (; c = l.exec(s); ) {
1414
- const d = c[0];
1415
- a(this.escapeHTML(d), o(`<span style="color: ${t.comment};">${this.escapeHTML(d)}</span>`));
1416
- }
1417
- for (; c = h.exec(s); ) {
1418
- const d = c[0];
1419
- a(this.escapeHTML(d), o(`<span style="color: ${t.comment};">${this.escapeHTML(d)}</span>`));
1412
+ const a = /\/\*[\s\S]*?\*\//g, u = /\/\/[^\n\r]*/g, d = /\#([^\n\r]*)/g, g = /("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')/g;
1413
+ for (; c = a.exec(s); ) {
1414
+ const h = c[0];
1415
+ l(this.escapeHTML(h), n(`<span style="color: ${t.comment};">${this.escapeHTML(h)}</span>`));
1420
1416
  }
1421
1417
  for (; c = u.exec(s); ) {
1422
- const d = c[0];
1423
- a(this.escapeHTML(d), o(`<span style="color: ${t.comment};">${this.escapeHTML(d)}</span>`));
1418
+ const h = c[0];
1419
+ l(this.escapeHTML(h), n(`<span style="color: ${t.comment};">${this.escapeHTML(h)}</span>`));
1420
+ }
1421
+ for (; c = d.exec(s); ) {
1422
+ const h = c[0];
1423
+ l(this.escapeHTML(h), n(`<span style="color: ${t.comment};">${this.escapeHTML(h)}</span>`));
1424
1424
  }
1425
1425
  for (; c = g.exec(s); ) {
1426
- const d = c[0];
1427
- a(this.escapeHTML(d), o(`<span style="color: ${t.string};">${this.escapeHTML(d)}</span>`));
1426
+ const h = c[0];
1427
+ l(this.escapeHTML(h), n(`<span style="color: ${t.string};">${this.escapeHTML(h)}</span>`));
1428
1428
  }
1429
- return i = i.replace(/(\$[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*)/g, `<span style="color: ${t.variable};">$1</span>`), i = i.replace(/\b(echo|print|function|class|if|else|elseif|foreach|as|return|namespace|use|new|extends|public|protected|private|static)\b/g, `<span style="color: ${t.keyword};">$1</span>`), i = i.replace(/\u0000([a-z]+)\u0000/g, (d, f) => {
1429
+ return i = i.replace(/(\$[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*)/g, `<span style="color: ${t.variable};">$1</span>`), i = i.replace(/\b(echo|print|function|class|if|else|elseif|foreach|as|return|namespace|use|new|extends|public|protected|private|static)\b/g, `<span style="color: ${t.keyword};">$1</span>`), i = i.replace(/\u0000([a-z]+)\u0000/g, (h, f) => {
1430
1430
  let p = 0;
1431
1431
  for (let x = 0; x < f.length; x++)
1432
1432
  p = p * 26 + (f.charCodeAt(x) - 97 + 1);
@@ -1441,11 +1441,11 @@ class W {
1441
1441
  this.editor = null, this.modes.clear();
1442
1442
  }
1443
1443
  }
1444
- function j(b, e) {
1444
+ function J(k, e) {
1445
1445
  const t = { ...e };
1446
- return t.extensions || (t.extensions = []), t.extensions.some((s) => s.name === "keymap") || t.extensions.unshift(new V(t.keymap)), t.extensions.some((s) => s.name === "transaction") || t.extensions.unshift(new A()), new K(b, t);
1446
+ return t.extensions || (t.extensions = []), t.extensions.some((s) => s.name === "keymap") || t.extensions.unshift(new U(t.keymap)), t.extensions.some((s) => s.name === "transaction") || t.extensions.unshift(new z()), new V(k, t);
1447
1447
  }
1448
- const Z = `/* Source Editor Dialog Styles */
1448
+ const P = '[data-theme="dark"], .dark, .editora-theme-dark', Y = `/* Source Editor Dialog Styles */
1449
1449
  .rte-source-editor-overlay {
1450
1450
  position: fixed !important;
1451
1451
  top: 0 !important;
@@ -1714,64 +1714,83 @@ const Z = `/* Source Editor Dialog Styles */
1714
1714
  background: #0056b3;
1715
1715
  }
1716
1716
 
1717
- /* Dark theme support */
1718
- @media (prefers-color-scheme: dark) {
1719
- .rte-source-editor-modal {
1720
- background: #1e1e1e;
1721
- color: #f8f9fa;
1722
- }
1717
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-modal {
1718
+ background: #1e1e1e;
1719
+ color: #f8f9fa;
1720
+ border: 1px solid #434d5f;
1721
+ }
1723
1722
 
1724
- .rte-source-editor-header {
1725
- background: #2d2d2d;
1726
- border-color: #404040;
1727
- }
1723
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-header,
1724
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-footer {
1725
+ background: #2a3442;
1726
+ border-color: #434d5f;
1727
+ }
1728
1728
 
1729
- .rte-source-editor-header h2 {
1730
- color: #f8f9fa;
1731
- }
1729
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-header h2 {
1730
+ color: #f8f9fa;
1731
+ }
1732
1732
 
1733
- .rte-source-editor-fullscreen-btn,
1734
- .rte-source-editor-close-btn {
1735
- color: #ccc;
1736
- }
1733
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-toolbar-btn,
1734
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-fullscreen-btn,
1735
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-close-btn {
1736
+ color: #c1cede;
1737
+ }
1737
1738
 
1738
- .rte-source-editor-fullscreen-btn:hover,
1739
- .rte-source-editor-close-btn:hover {
1740
- background: #404040;
1741
- color: #f8f9fa;
1742
- }
1739
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-toolbar-btn:hover:not(:disabled),
1740
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-fullscreen-btn:hover,
1741
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-close-btn:hover {
1742
+ background: #404a5a;
1743
+ color: #f8fafc;
1744
+ }
1743
1745
 
1744
- .rte-source-editor-error {
1745
- background: #2d1b1b;
1746
- color: #fca5a5;
1747
- border-color: #dc2626;
1748
- }
1746
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-toolbar-btn.active {
1747
+ background: #3b82f6;
1748
+ color: #ffffff;
1749
+ }
1749
1750
 
1750
- .rte-source-editor-warning {
1751
- background: #2d2a1b;
1752
- color: #fcd34d;
1753
- border-color: #d97706;
1754
- }
1751
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-toolbar-btn.active:hover {
1752
+ background: #2563eb;
1753
+ }
1755
1754
 
1756
- .rte-source-editor-footer {
1757
- background: #2d2d2d;
1758
- border-color: #404040;
1759
- }
1755
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-loading,
1756
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-footer-info {
1757
+ color: #cbd5e1;
1758
+ }
1760
1759
 
1761
- .rte-source-editor-footer-info {
1762
- color: #ccc;
1763
- }
1760
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-spinner {
1761
+ border-color: #3f4b60;
1762
+ border-top-color: #58a6ff;
1763
+ }
1764
1764
 
1765
- .rte-source-editor-btn-cancel {
1766
- background: #374151;
1767
- border-color: #4b5563;
1768
- color: #f9fafb;
1769
- }
1765
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-error {
1766
+ background: #3f2124;
1767
+ color: #fecaca;
1768
+ border-color: #ef4444;
1769
+ }
1770
1770
 
1771
- .rte-source-editor-btn-cancel:hover:not(:disabled) {
1772
- background: #4b5563;
1773
- border-color: #6b7280;
1774
- }
1771
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-warning {
1772
+ background: #3b3220;
1773
+ color: #fde68a;
1774
+ border-color: #f59e0b;
1775
+ }
1776
+
1777
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-btn-cancel {
1778
+ background: #334155;
1779
+ border-color: #475569;
1780
+ color: #f1f5f9;
1781
+ }
1782
+
1783
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-btn-cancel:hover:not(:disabled) {
1784
+ background: #475569;
1785
+ border-color: #64748b;
1786
+ }
1787
+
1788
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-btn-save {
1789
+ background: #3b82f6;
1790
+ }
1791
+
1792
+ .rte-source-editor-overlay.rte-theme-dark .rte-source-editor-btn-save:hover:not(:disabled) {
1793
+ background: #2563eb;
1775
1794
  }
1776
1795
 
1777
1796
  /* Responsive design */
@@ -1803,7 +1822,7 @@ const Z = `/* Source Editor Dialog Styles */
1803
1822
  flex: 1;
1804
1823
  text-align: center;
1805
1824
  }
1806
- }`, Y = () => ({
1825
+ }`, G = () => ({
1807
1826
  name: "code",
1808
1827
  // Toolbar button configuration
1809
1828
  toolbar: [
@@ -1823,56 +1842,56 @@ const Z = `/* Source Editor Dialog Styles */
1823
1842
  */
1824
1843
  toggleSourceView: () => {
1825
1844
  const e = (() => {
1826
- var o, a, c;
1845
+ var n, l, c;
1827
1846
  const r = window.getSelection();
1828
1847
  if (r && r.anchorNode) {
1829
- let l = r.anchorNode instanceof HTMLElement ? r.anchorNode : r.anchorNode.parentElement;
1830
- for (; l; ) {
1831
- if ((o = l.classList) != null && o.contains("rte-content"))
1832
- return l;
1833
- l = l.parentElement;
1848
+ let a = r.anchorNode instanceof HTMLElement ? r.anchorNode : r.anchorNode.parentElement;
1849
+ for (; a; ) {
1850
+ if ((n = a.classList) != null && n.contains("rte-content"))
1851
+ return a;
1852
+ a = a.parentElement;
1834
1853
  }
1835
1854
  }
1836
1855
  if (document.activeElement) {
1837
- let l = document.activeElement;
1838
- if ((a = l.classList) != null && a.contains("rte-content"))
1839
- return l;
1840
- for (; l && l !== document.body; ) {
1841
- if ((c = l.classList) != null && c.contains("rte-content"))
1842
- return l;
1843
- const h = l.querySelector(".rte-content");
1844
- if (h) return h;
1845
- l = l.parentElement;
1856
+ let a = document.activeElement;
1857
+ if ((l = a.classList) != null && l.contains("rte-content"))
1858
+ return a;
1859
+ for (; a && a !== document.body; ) {
1860
+ if ((c = a.classList) != null && c.contains("rte-content"))
1861
+ return a;
1862
+ const u = a.querySelector(".rte-content");
1863
+ if (u) return u;
1864
+ a = a.parentElement;
1846
1865
  }
1847
1866
  }
1848
- const n = document.querySelector("[data-editora-editor]");
1849
- if (n) {
1850
- const l = n.querySelector(".rte-content");
1851
- if (l) return l;
1867
+ const o = document.querySelector("[data-editora-editor]");
1868
+ if (o) {
1869
+ const a = o.querySelector(".rte-content");
1870
+ if (a) return a;
1852
1871
  }
1853
1872
  return document.querySelector(".rte-content");
1854
1873
  })();
1855
1874
  if (!e)
1856
1875
  return console.error("[CodePlugin] Editor content area not found"), alert("Editor content area not found. Please click inside the editor first."), !1;
1857
1876
  const t = e.innerHTML, s = (r) => {
1858
- let n = "", o = 0;
1859
- const a = 2, c = r.split(/(<\/?[a-zA-Z][^>]*>)/);
1860
- for (const l of c)
1861
- l.trim() && (l.match(/^<\/[a-zA-Z]/) ? (o = Math.max(0, o - 1), n += `
1862
- ` + " ".repeat(o * a) + l) : l.match(/^<[a-zA-Z]/) && !l.match(/\/>$/) ? (n += `
1863
- ` + " ".repeat(o * a) + l, o++) : l.match(/^<[a-zA-Z].*\/>$/) ? n += `
1864
- ` + " ".repeat(o * a) + l : n += l.trim());
1865
- return n.trim();
1877
+ let o = "", n = 0;
1878
+ const l = 2, c = r.split(/(<\/?[a-zA-Z][^>]*>)/);
1879
+ for (const a of c)
1880
+ a.trim() && (a.match(/^<\/[a-zA-Z]/) ? (n = Math.max(0, n - 1), o += `
1881
+ ` + " ".repeat(n * l) + a) : a.match(/^<[a-zA-Z]/) && !a.match(/\/>$/) ? (o += `
1882
+ ` + " ".repeat(n * l) + a, n++) : a.match(/^<[a-zA-Z].*\/>$/) ? o += `
1883
+ ` + " ".repeat(n * l) + a : o += a.trim());
1884
+ return o.trim();
1866
1885
  };
1867
1886
  return (() => {
1868
- var $, E, O, H, R, N;
1869
- let r = null, n = "dark", o = !1, a = !1, c = !1;
1870
- const l = t, h = document.createElement("div");
1871
- h.className = "rte-source-editor-overlay";
1872
- const u = document.createElement("div");
1873
- u.className = "rte-source-editor-modal", u.setAttribute("role", "dialog"), u.setAttribute("aria-modal", "true"), u.setAttribute("aria-labelledby", "source-editor-title");
1887
+ var E, O, H, N, I, B;
1888
+ let r = null, o = "dark", n = !1, l = !1, c = !1;
1889
+ const a = t, u = !!e.closest(P) || document.body.matches(P) || document.documentElement.matches(P), d = document.createElement("div");
1890
+ d.className = "rte-source-editor-overlay", u && d.classList.add("rte-theme-dark");
1874
1891
  const g = document.createElement("div");
1875
- g.className = "rte-source-editor-header", g.innerHTML = `
1892
+ g.className = "rte-source-editor-modal", g.setAttribute("role", "dialog"), g.setAttribute("aria-modal", "true"), g.setAttribute("aria-labelledby", "source-editor-title");
1893
+ const h = document.createElement("div");
1894
+ h.className = "rte-source-editor-header", h.innerHTML = `
1876
1895
  <h2 id="source-editor-title">Source Editor</h2>
1877
1896
  <div class="rte-source-editor-header-toolbar">
1878
1897
  <button class="rte-source-editor-toolbar-btn theme-toggle-btn" title="Switch theme">
@@ -1909,14 +1928,14 @@ const Z = `/* Source Editor Dialog Styles */
1909
1928
  </button>
1910
1929
  </div>
1911
1930
  `;
1912
- const d = document.createElement("div");
1913
- d.className = "rte-source-editor-body";
1914
1931
  const f = document.createElement("div");
1915
- f.className = "rte-source-editor-content";
1932
+ f.className = "rte-source-editor-body";
1916
1933
  const p = document.createElement("div");
1917
- p.className = "rte-source-editor-warning", p.textContent = "⚠️ Advanced users only. Invalid HTML may break the editor.";
1934
+ p.className = "rte-source-editor-content";
1918
1935
  const x = document.createElement("div");
1919
- x.className = "rte-source-editor-light-editor", x.style.height = "400px", f.appendChild(p), f.appendChild(x), d.appendChild(f);
1936
+ x.className = "rte-source-editor-warning", x.textContent = "⚠️ Advanced users only. Invalid HTML may break the editor.";
1937
+ const b = document.createElement("div");
1938
+ b.className = "rte-source-editor-light-editor", b.style.height = "400px", p.appendChild(x), p.appendChild(b), f.appendChild(p);
1920
1939
  const y = document.createElement("div");
1921
1940
  if (y.className = "rte-source-editor-footer", y.innerHTML = `
1922
1941
  <div class="rte-source-editor-footer-info">
@@ -1926,45 +1945,45 @@ const Z = `/* Source Editor Dialog Styles */
1926
1945
  <button class="rte-source-editor-btn rte-source-editor-btn-cancel">Cancel</button>
1927
1946
  <button class="rte-source-editor-btn rte-source-editor-btn-save">Save</button>
1928
1947
  </div>
1929
- `, u.appendChild(g), u.appendChild(d), u.appendChild(y), h.appendChild(u), !document.getElementById("rte-source-editor-styles")) {
1948
+ `, g.appendChild(h), g.appendChild(f), g.appendChild(y), d.appendChild(g), !document.getElementById("rte-source-editor-styles")) {
1930
1949
  const m = document.createElement("style");
1931
- m.id = "rte-source-editor-styles", m.textContent = Z, document.head.appendChild(m);
1950
+ m.id = "rte-source-editor-styles", m.textContent = Y, document.head.appendChild(m);
1932
1951
  }
1933
- document.body.appendChild(h);
1952
+ document.body.appendChild(d);
1934
1953
  try {
1935
- r = j(x, {
1954
+ r = J(b, {
1936
1955
  value: s(t),
1937
1956
  theme: "dark",
1938
1957
  readOnly: !1,
1939
1958
  extensions: [
1940
- new U(),
1941
- new z(),
1942
1959
  new q(),
1943
1960
  new _(),
1944
1961
  new F(),
1962
+ new W(),
1945
1963
  new D(),
1946
- new W()
1964
+ new j(),
1965
+ new Z()
1947
1966
  ]
1948
1967
  }), r.on("change", () => {
1949
- c = ((r == null ? void 0 : r.getValue()) || "") !== s(l);
1968
+ c = ((r == null ? void 0 : r.getValue()) || "") !== s(a);
1950
1969
  const M = y.querySelector(".unsaved-changes");
1951
1970
  M && (M.style.display = c ? "inline" : "none");
1952
1971
  }), setTimeout(() => r == null ? void 0 : r.focus(), 100);
1953
1972
  } catch (m) {
1954
1973
  console.error("Failed to initialize code editor:", m);
1955
1974
  }
1956
- const v = () => {
1957
- n = n === "dark" ? "light" : "dark", r == null || r.setTheme(n);
1958
- const m = g.querySelector(".theme-toggle-btn");
1959
- m && n === "light" && (m.innerHTML = `
1975
+ const C = () => {
1976
+ o = o === "dark" ? "light" : "dark", r == null || r.setTheme(o);
1977
+ const m = h.querySelector(".theme-toggle-btn");
1978
+ m && o === "light" && (m.innerHTML = `
1960
1979
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
1961
1980
  <path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/>
1962
1981
  </svg>
1963
1982
  `);
1964
- }, C = () => {
1965
- o = !o, r == null || r.setReadOnly(o);
1966
- const m = g.querySelector(".readonly-toggle-btn");
1967
- m && (o ? (m.classList.add("active"), m.innerHTML = `
1983
+ }, L = () => {
1984
+ n = !n, r == null || r.setReadOnly(n);
1985
+ const m = h.querySelector(".readonly-toggle-btn");
1986
+ m && (n ? (m.classList.add("active"), m.innerHTML = `
1968
1987
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
1969
1988
  <rect x="3" y="11" width="18" height="11" rx="2" ry="2"/>
1970
1989
  <circle cx="12" cy="16" r="1"/>
@@ -1976,10 +1995,10 @@ const Z = `/* Source Editor Dialog Styles */
1976
1995
  <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
1977
1996
  </svg>
1978
1997
  `));
1979
- }, L = () => {
1980
- a = !a, a ? (h.classList.add("fullscreen"), x.style.height = "calc(100vh - 200px)") : (h.classList.remove("fullscreen"), x.style.height = "400px");
1981
- const m = g.querySelector(".rte-source-editor-fullscreen-btn");
1982
- m && (m.innerHTML = a ? `
1998
+ }, w = () => {
1999
+ l = !l, l ? (d.classList.add("fullscreen"), b.style.height = "calc(100vh - 200px)") : (d.classList.remove("fullscreen"), b.style.height = "400px");
2000
+ const m = h.querySelector(".rte-source-editor-fullscreen-btn");
2001
+ m && (m.innerHTML = l ? `
1983
2002
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
1984
2003
  <path d="M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 0 2-2h3M3 16h3a2 2 0 0 0 2 2v3"/>
1985
2004
  </svg>
@@ -1988,25 +2007,25 @@ const Z = `/* Source Editor Dialog Styles */
1988
2007
  <path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"/>
1989
2008
  </svg>
1990
2009
  `);
2010
+ }, v = () => {
2011
+ r && (r.destroy(), r = null), document.body.removeChild(d);
1991
2012
  }, T = () => {
1992
- r && (r.destroy(), r = null), document.body.removeChild(h);
1993
- }, k = () => {
1994
- c && !confirm("You have unsaved changes. Are you sure you want to cancel?") || T();
1995
- }, w = () => {
2013
+ c && !confirm("You have unsaved changes. Are you sure you want to cancel?") || v();
2014
+ }, S = () => {
1996
2015
  try {
1997
2016
  const m = (r == null ? void 0 : r.getValue()) || "", M = document.createElement("div");
1998
- M.innerHTML = m, M.querySelectorAll('script, iframe[src^="javascript:"], object, embed').forEach((I) => I.remove()), e.innerHTML = M.innerHTML, c = !1, T();
2017
+ M.innerHTML = m, M.querySelectorAll('script, iframe[src^="javascript:"], object, embed').forEach((K) => K.remove()), e.innerHTML = M.innerHTML, c = !1, v();
1999
2018
  } catch (m) {
2000
2019
  alert("Failed to update HTML. Please check your syntax."), console.error("HTML update error:", m);
2001
2020
  }
2002
2021
  };
2003
- ($ = g.querySelector(".theme-toggle-btn")) == null || $.addEventListener("click", v), (E = g.querySelector(".readonly-toggle-btn")) == null || E.addEventListener("click", C), (O = g.querySelector(".rte-source-editor-fullscreen-btn")) == null || O.addEventListener("click", L), (H = g.querySelector(".rte-source-editor-close-btn")) == null || H.addEventListener("click", T), (R = y.querySelector(".rte-source-editor-btn-cancel")) == null || R.addEventListener("click", k), (N = y.querySelector(".rte-source-editor-btn-save")) == null || N.addEventListener("click", w), h.addEventListener("click", (m) => {
2004
- m.target === h && T();
2022
+ (E = h.querySelector(".theme-toggle-btn")) == null || E.addEventListener("click", C), (O = h.querySelector(".readonly-toggle-btn")) == null || O.addEventListener("click", L), (H = h.querySelector(".rte-source-editor-fullscreen-btn")) == null || H.addEventListener("click", w), (N = h.querySelector(".rte-source-editor-close-btn")) == null || N.addEventListener("click", v), (I = y.querySelector(".rte-source-editor-btn-cancel")) == null || I.addEventListener("click", T), (B = y.querySelector(".rte-source-editor-btn-save")) == null || B.addEventListener("click", S), d.addEventListener("click", (m) => {
2023
+ m.target === d && v();
2005
2024
  });
2006
- const S = (m) => {
2007
- m.key === "Escape" && (T(), document.removeEventListener("keydown", S));
2025
+ const $ = (m) => {
2026
+ m.key === "Escape" && (v(), document.removeEventListener("keydown", $));
2008
2027
  };
2009
- document.addEventListener("keydown", S);
2028
+ document.addEventListener("keydown", $);
2010
2029
  })(), !0;
2011
2030
  }
2012
2031
  },
@@ -2017,6 +2036,6 @@ const Z = `/* Source Editor Dialog Styles */
2017
2036
  }
2018
2037
  });
2019
2038
  export {
2020
- Y as CodePlugin
2039
+ G as CodePlugin
2021
2040
  };
2022
- //# sourceMappingURL=CodePlugin.native-CK9d8rmt.mjs.map
2041
+ //# sourceMappingURL=CodePlugin.native-0Zari_zp.mjs.map