mx-ui-components-pkg 0.0.717-alpha.135 → 0.0.717-alpha.137

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.
@@ -1,4 +1,4 @@
1
- import { m as et } from "./index-BaQNsaYT.js";
1
+ import { m as et } from "./index-DE85gHyd.js";
2
2
  /*!-----------------------------------------------------------------------------
3
3
  * Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
@@ -1,4 +1,4 @@
1
- import { m as f } from "./index-BaQNsaYT.js";
1
+ import { m as f } from "./index-DE85gHyd.js";
2
2
  /*!-----------------------------------------------------------------------------
3
3
  * Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
@@ -1,4 +1,4 @@
1
- import { m as l } from "./index-BaQNsaYT.js";
1
+ import { m as l } from "./index-DE85gHyd.js";
2
2
  /*!-----------------------------------------------------------------------------
3
3
  * Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
@@ -1,4 +1,4 @@
1
- import { m as s } from "./index-BaQNsaYT.js";
1
+ import { m as s } from "./index-DE85gHyd.js";
2
2
  /*!-----------------------------------------------------------------------------
3
3
  * Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
@@ -1,4 +1,4 @@
1
- import { m as lt } from "./index-BaQNsaYT.js";
1
+ import { m as lt } from "./index-DE85gHyd.js";
2
2
  /*!-----------------------------------------------------------------------------
3
3
  * Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
@@ -25909,7 +25909,7 @@ function(i) {
25909
25909
  */
25910
25910
  function(i) {
25911
25911
  function e() {
25912
- return (to.canvg ? Promise.resolve(to.canvg) : import("./index.es-Dq07xInJ.js")).catch(function(t) {
25912
+ return (to.canvg ? Promise.resolve(to.canvg) : import("./index.es-BmUYsNRN.js")).catch(function(t) {
25913
25913
  return Promise.reject(new Error("Could not load canvg: " + t));
25914
25914
  }).then(function(t) {
25915
25915
  return t.default ? t.default : t;
@@ -142312,57 +142312,58 @@ class Rgn extends oi {
142312
142312
  re(this, "variablesList", [""]);
142313
142313
  re(this, "searchTerm", "");
142314
142314
  re(this, "highlightedNodes", []);
142315
+ re(this, "isEditableMode", !0);
142315
142316
  re(this, "undoChanges", () => {
142316
142317
  var t;
142317
- (t = this.$ditaEditor) == null || t.chain().focus().undo().run();
142318
+ this.isEditableMode && ((t = this.$ditaEditor) == null || t.chain().focus().undo().run());
142318
142319
  });
142319
142320
  re(this, "redoChanges", () => {
142320
142321
  var t;
142321
- (t = this.$ditaEditor) == null || t.chain().focus().redo().run();
142322
+ this.isEditableMode && ((t = this.$ditaEditor) == null || t.chain().focus().redo().run());
142322
142323
  });
142323
142324
  re(this, "toggleBold", () => {
142324
142325
  var t;
142325
- (t = this.$ditaEditor) == null || t.chain().focus().toggleBold().run();
142326
+ this.isEditableMode && ((t = this.$ditaEditor) == null || t.chain().focus().toggleBold().run());
142326
142327
  });
142327
142328
  re(this, "toggleItalic", () => {
142328
142329
  var t;
142329
- (t = this.$ditaEditor) == null || t.chain().focus().toggleItalic().run();
142330
+ this.isEditableMode && ((t = this.$ditaEditor) == null || t.chain().focus().toggleItalic().run());
142330
142331
  });
142331
142332
  re(this, "togglUnderline", () => {
142332
142333
  var t;
142333
- (t = this.$ditaEditor) == null || t.chain().focus().toggleUnderline().run();
142334
+ this.isEditableMode && ((t = this.$ditaEditor) == null || t.chain().focus().toggleUnderline().run());
142334
142335
  });
142335
142336
  re(this, "toggleStrike", () => {
142336
142337
  var t;
142337
- (t = this.$ditaEditor) == null || t.chain().focus().toggleStrike().run();
142338
+ this.isEditableMode && ((t = this.$ditaEditor) == null || t.chain().focus().toggleStrike().run());
142338
142339
  });
142339
142340
  re(this, "toggleBulletList", () => {
142340
142341
  var t;
142341
- (t = this.$ditaEditor) == null || t.chain().focus().toggleBulletList().run();
142342
+ this.isEditableMode && ((t = this.$ditaEditor) == null || t.chain().focus().toggleBulletList().run());
142342
142343
  });
142343
142344
  re(this, "addColumnAfter", () => {
142344
142345
  var t;
142345
- (t = this.$ditaEditor) == null || t.chain().focus().addColumnAfter().run();
142346
+ this.isEditableMode && ((t = this.$ditaEditor) == null || t.chain().focus().addColumnAfter().run());
142346
142347
  });
142347
142348
  re(this, "deleteColumn", () => {
142348
142349
  var t;
142349
- (t = this.$ditaEditor) == null || t.chain().focus().deleteColumn().run();
142350
+ this.isEditableMode && ((t = this.$ditaEditor) == null || t.chain().focus().deleteColumn().run());
142350
142351
  });
142351
142352
  re(this, "addRowAfter", () => {
142352
142353
  var t;
142353
- (t = this.$ditaEditor) == null || t.chain().focus().addRowAfter().run();
142354
+ this.isEditableMode && ((t = this.$ditaEditor) == null || t.chain().focus().addRowAfter().run());
142354
142355
  });
142355
142356
  re(this, "deleteRow", () => {
142356
142357
  var t;
142357
- (t = this.$ditaEditor) == null || t.chain().focus().deleteRow().run();
142358
+ this.isEditableMode && ((t = this.$ditaEditor) == null || t.chain().focus().deleteRow().run());
142358
142359
  });
142359
142360
  re(this, "setFontSize", (t) => {
142360
142361
  var n;
142361
- (n = this.$ditaEditor) == null || n.chain().focus().setFontSize(t + "px").run();
142362
+ this.isEditableMode && ((n = this.$ditaEditor) == null || n.chain().focus().setFontSize(t + "px").run());
142362
142363
  });
142363
142364
  re(this, "onFontChange", (t) => {
142364
142365
  var n;
142365
- (n = this.$ditaEditor) == null || n.chain().focus().setFontFamily(t).run(), console.log("changdoiasbxlajcdsnlkdja ---- ", t);
142366
+ this.isEditableMode && ((n = this.$ditaEditor) == null || n.chain().focus().setFontFamily(t).run(), console.log("changdoiasbxlajcdsnlkdja ---- ", t));
142366
142367
  });
142367
142368
  re(this, "checkSpelling", () => {
142368
142369
  let t = document.getElementById("dita-builder-container");
@@ -142370,7 +142371,7 @@ class Rgn extends oi {
142370
142371
  });
142371
142372
  re(this, "addLinkToContent", () => {
142372
142373
  var t, n;
142373
- (n = (t = this.$ditaEditor) == null ? void 0 : t.commands) == null || n.openCustomLinkModal(), console.log("yet to write code");
142374
+ this.isEditableMode && ((n = (t = this.$ditaEditor) == null ? void 0 : t.commands) == null || n.openCustomLinkModal(), console.log("yet to write code"));
142374
142375
  });
142375
142376
  re(this, "isActive", (t, n = {}) => {
142376
142377
  var r;
@@ -142491,6 +142492,7 @@ class Rgn extends oi {
142491
142492
  });
142492
142493
  re(this, "onContentUpdate", this.debounce(async (t) => {
142493
142494
  var f, p, g, m, v, A, _, y, w, C, b;
142495
+ if (!this.isEditableMode) return;
142494
142496
  const n = t.editor;
142495
142497
  if ((p = (f = this.store) == null ? void 0 : f._signals.topicAccordianLoader) != null && p.value)
142496
142498
  return;
@@ -142603,12 +142605,13 @@ class Rgn extends oi {
142603
142605
  this.meta.props,
142604
142606
  this
142605
142607
  ) || "edit", n = String(t).toLowerCase().trim();
142606
- this.$ditaEditor.setOptions({
142607
- editable: n === "edit"
142608
+ this.isEditableMode = n === "edit", this.$ditaEditor.setOptions({
142609
+ editable: this.isEditableMode
142608
142610
  });
142609
142611
  }
142610
142612
  addContentBlockType(t, n) {
142611
142613
  var s, o;
142614
+ if (!this.isEditableMode) return;
142612
142615
  const r = t;
142613
142616
  this.contentBlock = t, console.log("this is the content type ", t), this.$ditaEditor && (this.$ditaEditor.state.selection.from, r === "text" ? this.$ditaEditor.commands.insertContent("<p></p>") : r === "section" ? this.$ditaEditor.commands.insertSection() : r === "table" ? (this.$ditaEditor.chain().focus().insertTable({
142614
142617
  rows: 2,
@@ -142646,19 +142649,25 @@ class Rgn extends oi {
142646
142649
  }
142647
142650
  createToolbarAction(t, n, r, s) {
142648
142651
  const o = document.createElement("button");
142649
- o.type = "button", o.setAttribute("aria-label", t), o.className = "rounded p-1 hover:bg-black hover:text-white", this.isActive && this.isActive(t) && o.classList.add("bg-black", "text-white"), o.onclick = n, s !== void 0 && s && (o.disabled = !0);
142650
- const a = document.createElement("img");
142651
- return a.src = r, a.alt = t, o.appendChild(a), o;
142652
+ o.type = "button", o.setAttribute("aria-label", t);
142653
+ const a = !this.isEditableMode || !!s;
142654
+ o.disabled = a, o.tabIndex = a ? -1 : 0, o.className = `
142655
+ rounded p-1
142656
+ ${a ? "opacity-40 cursor-not-allowed" : "hover:bg-black hover:text-white"}
142657
+ `, a || (o.onclick = n);
142658
+ const l = document.createElement("img");
142659
+ return l.src = r, l.alt = t, o.appendChild(l), o;
142652
142660
  }
142653
142661
  createFontSizeView(t) {
142654
142662
  let n = document.createElement("div");
142655
142663
  const r = () => {
142664
+ if (!this.isEditableMode) return;
142656
142665
  let d = document.getElementById("font-size");
142657
142666
  d && (d.textContent = this.fontSize + ""), t(this.fontSize);
142658
142667
  }, s = () => {
142659
- this.fontSize--, r();
142668
+ this.isEditableMode && (this.fontSize--, r());
142660
142669
  }, o = () => {
142661
- this.fontSize++, r();
142670
+ this.isEditableMode && (this.fontSize++, r());
142662
142671
  };
142663
142672
  let a = document.createElement("div");
142664
142673
  a.className = "flex flex-row items-center gap-0.5";
@@ -270382,37 +270391,37 @@ Gi({
270382
270391
  id: "freemarker2",
270383
270392
  extensions: [".ftl", ".ftlh", ".ftlx"],
270384
270393
  aliases: ["FreeMarker2", "Apache FreeMarker2"],
270385
- loader: () => import("./freemarker2-DHkpJggp.js").then((i) => i.TagAutoInterpolationDollar)
270394
+ loader: () => import("./freemarker2-Bt2xmuQ2.js").then((i) => i.TagAutoInterpolationDollar)
270386
270395
  });
270387
270396
  Gi({
270388
270397
  id: "freemarker2.tag-angle.interpolation-dollar",
270389
270398
  aliases: ["FreeMarker2 (Angle/Dollar)", "Apache FreeMarker2 (Angle/Dollar)"],
270390
- loader: () => import("./freemarker2-DHkpJggp.js").then((i) => i.TagAngleInterpolationDollar)
270399
+ loader: () => import("./freemarker2-Bt2xmuQ2.js").then((i) => i.TagAngleInterpolationDollar)
270391
270400
  });
270392
270401
  Gi({
270393
270402
  id: "freemarker2.tag-bracket.interpolation-dollar",
270394
270403
  aliases: ["FreeMarker2 (Bracket/Dollar)", "Apache FreeMarker2 (Bracket/Dollar)"],
270395
- loader: () => import("./freemarker2-DHkpJggp.js").then((i) => i.TagBracketInterpolationDollar)
270404
+ loader: () => import("./freemarker2-Bt2xmuQ2.js").then((i) => i.TagBracketInterpolationDollar)
270396
270405
  });
270397
270406
  Gi({
270398
270407
  id: "freemarker2.tag-angle.interpolation-bracket",
270399
270408
  aliases: ["FreeMarker2 (Angle/Bracket)", "Apache FreeMarker2 (Angle/Bracket)"],
270400
- loader: () => import("./freemarker2-DHkpJggp.js").then((i) => i.TagAngleInterpolationBracket)
270409
+ loader: () => import("./freemarker2-Bt2xmuQ2.js").then((i) => i.TagAngleInterpolationBracket)
270401
270410
  });
270402
270411
  Gi({
270403
270412
  id: "freemarker2.tag-bracket.interpolation-bracket",
270404
270413
  aliases: ["FreeMarker2 (Bracket/Bracket)", "Apache FreeMarker2 (Bracket/Bracket)"],
270405
- loader: () => import("./freemarker2-DHkpJggp.js").then((i) => i.TagBracketInterpolationBracket)
270414
+ loader: () => import("./freemarker2-Bt2xmuQ2.js").then((i) => i.TagBracketInterpolationBracket)
270406
270415
  });
270407
270416
  Gi({
270408
270417
  id: "freemarker2.tag-auto.interpolation-dollar",
270409
270418
  aliases: ["FreeMarker2 (Auto/Dollar)", "Apache FreeMarker2 (Auto/Dollar)"],
270410
- loader: () => import("./freemarker2-DHkpJggp.js").then((i) => i.TagAutoInterpolationDollar)
270419
+ loader: () => import("./freemarker2-Bt2xmuQ2.js").then((i) => i.TagAutoInterpolationDollar)
270411
270420
  });
270412
270421
  Gi({
270413
270422
  id: "freemarker2.tag-auto.interpolation-bracket",
270414
270423
  aliases: ["FreeMarker2 (Auto/Bracket)", "Apache FreeMarker2 (Auto/Bracket)"],
270415
- loader: () => import("./freemarker2-DHkpJggp.js").then((i) => i.TagAutoInterpolationBracket)
270424
+ loader: () => import("./freemarker2-Bt2xmuQ2.js").then((i) => i.TagAutoInterpolationBracket)
270416
270425
  });
270417
270426
  /*!-----------------------------------------------------------------------------
270418
270427
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -270450,7 +270459,7 @@ Gi({
270450
270459
  extensions: [".handlebars", ".hbs"],
270451
270460
  aliases: ["Handlebars", "handlebars", "hbs"],
270452
270461
  mimetypes: ["text/x-handlebars-template"],
270453
- loader: () => import("./handlebars-DoFq7Cy7.js")
270462
+ loader: () => import("./handlebars-C7T2GKYk.js")
270454
270463
  });
270455
270464
  /*!-----------------------------------------------------------------------------
270456
270465
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -270475,7 +270484,7 @@ Gi({
270475
270484
  extensions: [".html", ".htm", ".shtml", ".xhtml", ".mdoc", ".jsp", ".asp", ".aspx", ".jshtm"],
270476
270485
  aliases: ["HTML", "htm", "html", "xhtml"],
270477
270486
  mimetypes: ["text/html", "text/x-jshtm", "text/template", "text/ng-template"],
270478
- loader: () => import("./html-B-pgD6OM.js")
270487
+ loader: () => import("./html-CcCA2Puf.js")
270479
270488
  });
270480
270489
  /*!-----------------------------------------------------------------------------
270481
270490
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -270516,7 +270525,7 @@ Gi({
270516
270525
  filenames: ["jakefile"],
270517
270526
  aliases: ["JavaScript", "javascript", "js"],
270518
270527
  mimetypes: ["text/javascript"],
270519
- loader: () => import("./javascript-Bjs24nGI.js")
270528
+ loader: () => import("./javascript-Cj8-CT9q.js")
270520
270529
  });
270521
270530
  /*!-----------------------------------------------------------------------------
270522
270531
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -270591,7 +270600,7 @@ Gi({
270591
270600
  extensions: [".liquid", ".html.liquid"],
270592
270601
  aliases: ["Liquid", "liquid"],
270593
270602
  mimetypes: ["application/liquid"],
270594
- loader: () => import("./liquid-DnQB46zW.js")
270603
+ loader: () => import("./liquid-CU5dogMz.js")
270595
270604
  });
270596
270605
  /*!-----------------------------------------------------------------------------
270597
270606
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -270627,7 +270636,7 @@ Gi({
270627
270636
  id: "mdx",
270628
270637
  extensions: [".mdx"],
270629
270638
  aliases: ["MDX", "mdx"],
270630
- loader: () => import("./mdx-BcI4ERaY.js")
270639
+ loader: () => import("./mdx-DDZimwEQ.js")
270631
270640
  });
270632
270641
  /*!-----------------------------------------------------------------------------
270633
270642
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -270822,7 +270831,7 @@ Gi({
270822
270831
  extensions: [".py", ".rpy", ".pyw", ".cpy", ".gyp", ".gypi"],
270823
270832
  aliases: ["Python", "py"],
270824
270833
  firstLine: "^#!/.*\\bpython[0-9.-]*\\b",
270825
- loader: () => import("./python-DBStDmJn.js")
270834
+ loader: () => import("./python-78DyBjCW.js")
270826
270835
  });
270827
270836
  /*!-----------------------------------------------------------------------------
270828
270837
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -270859,7 +270868,7 @@ Gi({
270859
270868
  extensions: [".cshtml"],
270860
270869
  aliases: ["Razor", "razor"],
270861
270870
  mimetypes: ["text/x-cshtml"],
270862
- loader: () => import("./razor-CZxv2Dib.js")
270871
+ loader: () => import("./razor-y9HSJBS5.js")
270863
270872
  });
270864
270873
  /*!-----------------------------------------------------------------------------
270865
270874
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -271111,7 +271120,7 @@ Gi({
271111
271120
  extensions: [".ts", ".tsx", ".cts", ".mts"],
271112
271121
  aliases: ["TypeScript", "ts", "typescript"],
271113
271122
  mimetypes: ["text/typescript"],
271114
- loader: () => import("./typescript-O1n2LB4L.js")
271123
+ loader: () => import("./typescript-BuE9MCvM.js")
271115
271124
  });
271116
271125
  /*!-----------------------------------------------------------------------------
271117
271126
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -271179,7 +271188,7 @@ Gi({
271179
271188
  firstLine: "(\\<\\?xml.*)|(\\<svg)|(\\<\\!doctype\\s+svg)",
271180
271189
  aliases: ["XML", "xml"],
271181
271190
  mimetypes: ["text/xml", "application/xml", "application/xaml+xml", "application/xml-dtd"],
271182
- loader: () => import("./xml-CA_Z_OE1.js")
271191
+ loader: () => import("./xml-BwRJ0G6J.js")
271183
271192
  });
271184
271193
  /*!-----------------------------------------------------------------------------
271185
271194
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -271192,7 +271201,7 @@ Gi({
271192
271201
  extensions: [".yaml", ".yml"],
271193
271202
  aliases: ["YAML", "yaml", "YML", "yml"],
271194
271203
  mimetypes: ["application/x-yaml", "text/x-yaml"],
271195
- loader: () => import("./yaml-DCcyUvmp.js")
271204
+ loader: () => import("./yaml-DV3m_XZ-.js")
271196
271205
  });
271197
271206
  /*!-----------------------------------------------------------------------------
271198
271207
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -271295,7 +271304,7 @@ var wFe = class {
271295
271304
  );
271296
271305
  F8.languages.css = { cssDefaults: QIt, lessDefaults: YIt, scssDefaults: $It };
271297
271306
  function EFe() {
271298
- return import("./cssMode-Yr-TzBfy.js");
271307
+ return import("./cssMode-DtPgM6j3.js");
271299
271308
  }
271300
271309
  F8.languages.onLanguage("less", () => {
271301
271310
  EFe().then((i) => i.setupMode(YIt));
@@ -271401,7 +271410,7 @@ _de.languages.html = {
271401
271410
  registerHTMLLanguageService: wde
271402
271411
  };
271403
271412
  function ZZn() {
271404
- return import("./htmlMode-wTgGH9fu.js");
271413
+ return import("./htmlMode-B1z8b0ht.js");
271405
271414
  }
271406
271415
  function wde(i, e = yde, t = bde(i)) {
271407
271416
  const n = new YZn(i, e, t);
@@ -271478,7 +271487,7 @@ var oei = class {
271478
271487
  ), cei = () => ZIt().then((i) => i.getWorker());
271479
271488
  d$.languages.json = { jsonDefaults: JIt, getWorker: cei };
271480
271489
  function ZIt() {
271481
- return import("./jsonMode-CJnyxLd4.js");
271490
+ return import("./jsonMode-CRmU0gcf.js");
271482
271491
  }
271483
271492
  d$.languages.register({
271484
271493
  id: "json",
@@ -271642,7 +271651,7 @@ f6.languages.typescript = {
271642
271651
  getJavaScriptWorker: _ei
271643
271652
  };
271644
271653
  function Cde() {
271645
- return import("./tsMode-yroW2mHm.js");
271654
+ return import("./tsMode-CvApHDXm.js");
271646
271655
  }
271647
271656
  f6.languages.onLanguage("typescript", () => Cde().then((i) => i.setupTypeScript(aLt)));
271648
271657
  f6.languages.onLanguage("javascript", () => Cde().then((i) => i.setupJavaScript(lLt)));
@@ -1,4 +1,4 @@
1
- import { c as Qe, _ as za, g as Io } from "./index-BaQNsaYT.js";
1
+ import { c as Qe, _ as za, g as Io } from "./index-DE85gHyd.js";
2
2
  var ht = function(a) {
3
3
  return a && a.Math === Math && a;
4
4
  }, _ = (
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ag as o, aV as e, N as t, aq as i, bl as r, bI as b, au as n, p as u, q as d, bj as C, B as M, Q as m, j as p, l, aa as c, be as g, K as h, bh as D, x as A, a6 as B, bA as T, aZ as y, a_ as I, bZ as S, b9 as w, aW as P, aX as F, bB as R, b5 as k, aC as x, b7 as L, aG as H, aE as f, aF as v, bb as E, ba as G, bc as N, bC as V, bE as W, bX as O, C as U, bL as q, V as z, bn as J, ar as K, b3 as X, bR as j, aS as Q, bS as Y, E as Z, ac as $, aT as _, F as aa, bs as sa, bG as oa, b2 as ea, X as ta, Y as ia, Z as ra, $ as ba, a0 as na, a1 as ua, bt as da, a2 as Ca, b8 as Ma, as as ma, I as pa, a4 as la, ai as ca, a3 as ga, bv as ha, af as Da, bi as Aa, ah as Ba, ad as Ta, r as ya, av as Ia, aN as Sa, aQ as wa, aO as Pa, aP as Fa, bd as Ra, n as ka, bH as xa, aU as La, b1 as Ha, ab as fa, bU as va, y as Ea, u as Ga, s as Na, e as Va, bf as Wa, bV as Oa, a$ as Ua, o as qa, az as za, bP as Ja, aK as Ka, aI as Xa, aJ as ja, bN as Qa, bY as Ya, b$ as Za, bQ as $a, bO as _a, b as as, bD as ss, k as os, d as es, v as ts, b_ as is, aY as rs, b0 as bs, bF as ns, bW as us, M as ds, h as Cs, bw as Ms, i as ms, bz as ps, by as ls, bx as cs, a9 as gs, br as hs, G as Ds, aw as As, ay as Bs, ax as Ts, A as ys, aD as Is, bJ as Ss, bK as ws, bM as Ps, O as Fs, P as Rs, bm as ks, aj as xs, ak as Ls, D as Hs, f as fs, a7 as vs, am as Es, aH as Gs, a8 as Ns, bq as Vs, L as Ws, R as Os, bk as Us, a5 as qs, z as zs, at as Js, bu as Ks, bp as Xs, bo as js, an as Qs, J as Ys, S as Zs, U as $s, H as _s, T as ao, w as so, ao as oo, ap as eo, b4 as to, aA as io, bT as ro, al as bo, ae as no, b6 as uo, a9 as Co, W as Mo, aR as mo, bg as po, aB as lo, aM as co, a as go, aL as ho } from "./index-BaQNsaYT.js";
1
+ import { ag as o, aV as e, N as t, aq as i, bl as r, bI as b, au as n, p as u, q as d, bj as C, B as M, Q as m, j as p, l, aa as c, be as g, K as h, bh as D, x as A, a6 as B, bA as T, aZ as y, a_ as I, bZ as S, b9 as w, aW as P, aX as F, bB as R, b5 as k, aC as x, b7 as L, aG as H, aE as f, aF as v, bb as E, ba as G, bc as N, bC as V, bE as W, bX as O, C as U, bL as q, V as z, bn as J, ar as K, b3 as X, bR as j, aS as Q, bS as Y, E as Z, ac as $, aT as _, F as aa, bs as sa, bG as oa, b2 as ea, X as ta, Y as ia, Z as ra, $ as ba, a0 as na, a1 as ua, bt as da, a2 as Ca, b8 as Ma, as as ma, I as pa, a4 as la, ai as ca, a3 as ga, bv as ha, af as Da, bi as Aa, ah as Ba, ad as Ta, r as ya, av as Ia, aN as Sa, aQ as wa, aO as Pa, aP as Fa, bd as Ra, n as ka, bH as xa, aU as La, b1 as Ha, ab as fa, bU as va, y as Ea, u as Ga, s as Na, e as Va, bf as Wa, bV as Oa, a$ as Ua, o as qa, az as za, bP as Ja, aK as Ka, aI as Xa, aJ as ja, bN as Qa, bY as Ya, b$ as Za, bQ as $a, bO as _a, b as as, bD as ss, k as os, d as es, v as ts, b_ as is, aY as rs, b0 as bs, bF as ns, bW as us, M as ds, h as Cs, bw as Ms, i as ms, bz as ps, by as ls, bx as cs, a9 as gs, br as hs, G as Ds, aw as As, ay as Bs, ax as Ts, A as ys, aD as Is, bJ as Ss, bK as ws, bM as Ps, O as Fs, P as Rs, bm as ks, aj as xs, ak as Ls, D as Hs, f as fs, a7 as vs, am as Es, aH as Gs, a8 as Ns, bq as Vs, L as Ws, R as Os, bk as Us, a5 as qs, z as zs, at as Js, bu as Ks, bp as Xs, bo as js, an as Qs, J as Ys, S as Zs, U as $s, H as _s, T as ao, w as so, ao as oo, ap as eo, b4 as to, aA as io, bT as ro, al as bo, ae as no, b6 as uo, a9 as Co, W as Mo, aR as mo, bg as po, aB as lo, aM as co, a as go, aL as ho } from "./index-DE85gHyd.js";
2
2
  export {
3
3
  o as A,
4
4
  e as Action,
@@ -2592,7 +2592,7 @@ img.ProseMirror-separator {
2592
2592
  `}),_e+=`</row>
2593
2593
  `)}),_e+=`</tbody>
2594
2594
  </tgroup>
2595
- </table>`,_e}function jsonToDita(Ce,_e){var De,ke;let Ae=!1,Se="<title></title>";function Ee(Oe){var Pe,Be,Fe;let Me="";for(const $e of Oe){if((Pe=$e.attrs)!=null&&Pe.id&&`${$e.attrs.id}`,$e.type==="title"&&!Ae){const Ue=((Be=$e.content)==null?void 0:Be.map(xe).join(""))||"";Se=`<title ${(Fe=$e.attrs)!=null&&Fe.id?`id="${$e.attrs.id}"`:""}>${Ue}</title>`,Ae=!0;continue}if($e.type==="topic"){const Ue=Ee($e.content||[]);Me+=Ue;continue}Me+=xe($e)}return Me}function xe(Oe){var Pe,Be,Fe,$e,Ue,He,Ve,We,ze,qe,Ke,Ge,Ye,Qe,St,Xe,Je,rn;const Me=(Pe=Oe.attrs)!=null&&Pe.id?`id="${Oe.attrs.id}"`:"";if(Oe.type==="paragraph"){const sn=((Be=Oe.content)==null?void 0:Be.map(xe).join(""))||"";return`<p ${Me}>${sn}</p>`}else if(Oe.type==="text"){if(((Fe=Oe.marks)==null?void 0:Fe.length)>0){const sn=Oe.marks[0];if(sn.type==="link"){const{href:pn,target:mn,rel:yn}=sn.attrs;return`<a href="${pn}" target="${mn}" rel="${yn}">${Oe.text}</a>`}if(sn.type==="bold")return`<b>${Oe.text}</b>`;if(sn.type==="italic")return`<i>${Oe.text}</i>`;if(sn.type==="underline")return`<u>${Oe.text}</u>`}return Oe.text||""}else{if(Oe.type==="mention")return($e=Oe.attrs)!=null&&$e.label?`{${Oe.attrs.label}}`:"";if(Oe.type==="table"){const sn=Oe.content||"";return convertTiptapToDita(sn)}else if(Oe.type==="image"){const sn=(He=extractAssetDetails(((Ue=Oe.attrs)==null?void 0:Ue.src)||""))==null?void 0:He.assetNameWithExt;return`<image style="${(Ve=Oe==null?void 0:Oe.attrs)==null?void 0:Ve.style}" href="/home/cloud-user/dita/${_e}/${sn}" alt="${sn}" />`}else if(Oe.type==="video"){const sn=(ze=extractAssetDetails(((We=Oe.attrs)==null?void 0:We.src)||""))==null?void 0:ze.assetNameWithExt;return`<object type="video/${(Ke=extractAssetDetails(((qe=Oe.attrs)==null?void 0:qe.src)||""))==null?void 0:Ke.fileExtension}" data="/home/cloud-user/dita/${_e}/${sn}"> <param name="autoplay" value="false"/> <param name="controls" value="true"/> <desc>Video Uploaded from CMS</desc> </object>`}else if(Oe.type==="codeBlock"){const sn=(Ge=Oe.attrs)==null?void 0:Ge.language,pn=((Ye=Oe.content)==null?void 0:Ye.map(xe).join(""))||"";return`<codeblock outputclass="language-${sn}">${pn}</codeblock>`}else if(Oe.type==="section"){const sn=(Qe=Oe.content)==null?void 0:Qe.find(xn=>xn.type==="title"),pn=sn?`<title>${(St=sn.content)==null?void 0:St.map(xe).join("")}</title>`:"",yn=(((Xe=Oe.content)==null?void 0:Xe.filter(xn=>xn.type!=="title"))||[]).map(xe).join("");return`<section ${Me}>${pn}${yn}</section>`}else{if(Oe.type==="bulletList")return`<ul>${((Je=Oe.content)==null?void 0:Je.map(xe).join(""))||""}</ul>`;if(Oe.type==="listItem")return`<li>${((rn=Oe.content)==null?void 0:rn.map(xe).join(""))||""}</li>`}}return""}const Te=Ee(Ce.content||[]);return`<topic id="${((ke=(De=Ce==null?void 0:Ce.content)==null?void 0:De[0].attrs)==null?void 0:ke.id)||"root"}">${Se}<body>${Te}</body></topic>`}function dropdownJSON(Ce){return{id:"q",type:"my-dropdown",name:"font",styles:"w-full flex flex-col",props:{name:"font",show:!1,multiSelect:!1,layout:"list",partitions:3,type:"button",rounded:!0},bindings:{state:Ce||""},children:[{id:"qwjhg",type:"mobius-dropdown-input",name:"mobius div",styles:"flex border border-gray-300 w-[12vw] rounded-md color-gray-400 text-sm px-2 py-1",props:{value:"Font Family",icon:"/src/assets/dropdownIcon.svg",multiSelect:!1,selectType:!0},bindings:{state:Ce||"",actions:{click:["dropdownToggle"]}},children:[]},{id:"qw",type:"mb-dropdown-menu",name:"mobius dropdown menu",styles:"overflow-y-scroll gap-1 p-0 w-full h-[15vw] z-50 bg-white flex flex-col !top-[2vw] absolute border rounded-md px-3 py-2",props:{multiSelect:!1},bindings:{state:Ce||"",actions:{loadDropdownData:["getDropdownData"]}},children:[{id:"qwer76hyut",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Arial",disabled:!1,type:"text",key:"Arial"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw42r3ferer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Arial",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Arial"}],value:""},{id:"q=-0okwer",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Arial Black",disabled:!1,type:"text",key:"Arial Black"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw2qwer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Arial Black",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Arial Black"}],value:""},{id:"q=-0okwer",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Arial Unicode MS",disabled:!1,type:"text",key:"Arial Unicode MS"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw2qwer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Arial Unicode MS",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Arial Unicode MS"}],value:""},{id:"q=-0okwer",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Book Antiqua",disabled:!1,type:"text",key:"Book Antiqua"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw2qwer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Book Antiqua",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Book Antiqua"}],value:""},{id:"q=-0okwer",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Comic Sans MS",disabled:!1,type:"text",key:"Comic Sans MS"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw2qwer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Comic Sans MS",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Comic Sans MS"}],value:""},{id:"q=-0okwer",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Courier New",disabled:!1,type:"text",key:"Courier New"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw2qwer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Courier New",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Courier New"}],value:""},{id:"q=-0okwer",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Gadget",disabled:!1,type:"text",key:"Gadget"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw2qwer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Gadget",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Gadget"}],value:""},{id:"q=-0okwer",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Geneva",disabled:!1,type:"text",key:"Geneva"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw2qwer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Geneva",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Geneva"}],value:""},{id:"q=-0okwer",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Georgia",disabled:!1,type:"text",key:"Georgia"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw2qwer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Georgia",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Georgia"}],value:""},{id:"q=-0okwer",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Helvetica",disabled:!1,type:"text",key:"Helvetica"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw2qwer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Helvetica",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Helvetica"}],value:""},{id:"q=-0okwer",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Impact",disabled:!1,type:"text",key:"Impact"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw2qwer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Impact",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Impact"}],value:""},{id:"q=-0okwer",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Lucida Console",disabled:!1,type:"text",key:"Lucida Console"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw2qwer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Lucida Console",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Lucida Console"}],value:""},{id:"q=-0okwer",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Lucida Grande",disabled:!1,type:"text",key:"Lucida Grande"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw2qwer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Lucida Grande",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Lucida Grande"}],value:""},{id:"q=-0okwer",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Lucida Sans Unicode",disabled:!1,type:"text",key:"Lucida Sans Unicode"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw2qwer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Lucida Sans Unicode",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Lucida Sans Unicode"}],value:""},{id:"q=-0okwer",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Monaco",disabled:!1,type:"text",key:"Monaco"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw2qwer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Monaco",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Monaco"}],value:""},{id:"qwer76hyut",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"MS Serif",disabled:!1,type:"text",key:"MS Serif"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw42r3ferer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"MS Serif",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"MS Serif"}],value:""},{id:"qwe846531r",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"New York",disabled:!1,type:"text",key:"New York"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"q8653wer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"New York",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"New York"}],value:""},{id:"qwe846531r",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Palatino",disabled:!1,type:"text",key:"Palatino"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"q8653wer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Palatino",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Palatino"}],value:""},{id:"qwe846531r",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Palatino Linotype",disabled:!1,type:"text",key:"Palatino Linotype"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"q8653wer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Palatino Linotype",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Palatino Linotype"}],value:""},{id:"qwe846531r",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Symboll",disabled:!1,type:"text",key:"Symboll"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"q8653wer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Symboll",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Symboll"}],value:""},{id:"qwe846531r",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Tahoma",disabled:!1,type:"text",key:"Tahoma"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"q8653wer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Tahoma",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Tahoma"}],value:""},{id:"qwe846531r",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Times",disabled:!1,type:"text",key:"Times"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"q8653wer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Times",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Times"}],value:""},{id:"qwe846531r",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Times New Roman",disabled:!1,type:"text",key:"Times New Roman"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"q8653wer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Times New Roman",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Times New Roman"}],value:""},{id:"qwe846531r",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Trebuchet MS",disabled:!1,type:"text",key:"Trebuchet MS"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"q8653wer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Trebuchet MS",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Trebuchet MS"}],value:""},{id:"qwe846531r",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Verdana",disabled:!1,type:"text",key:"Verdana"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"q8653wer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Verdana",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Verdana"}],value:""},{id:"qwe846531r",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Webdings",disabled:!1,type:"text",key:"Webdings"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"q8653wer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Webdings",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:""}],value:""}]}]}}class WysiwygEditor extends BaseComponent{constructor(){super();In(this,"ditaValue","");In(this,"contentBlock","");In(this,"$ditaEditor",null);In(this,"fontSize",24);In(this,"isResizingTable",!1);In(this,"cleanupScheduled",!1);In(this,"props",{id:"dita_editor"});In(this,"bindings");In(this,"variablesList",[""]);In(this,"searchTerm","");In(this,"highlightedNodes",[]);In(this,"undoChanges",()=>{var Ae;(Ae=this.$ditaEditor)==null||Ae.chain().focus().undo().run()});In(this,"redoChanges",()=>{var Ae;(Ae=this.$ditaEditor)==null||Ae.chain().focus().redo().run()});In(this,"toggleBold",()=>{var Ae;(Ae=this.$ditaEditor)==null||Ae.chain().focus().toggleBold().run()});In(this,"toggleItalic",()=>{var Ae;(Ae=this.$ditaEditor)==null||Ae.chain().focus().toggleItalic().run()});In(this,"togglUnderline",()=>{var Ae;(Ae=this.$ditaEditor)==null||Ae.chain().focus().toggleUnderline().run()});In(this,"toggleStrike",()=>{var Ae;(Ae=this.$ditaEditor)==null||Ae.chain().focus().toggleStrike().run()});In(this,"toggleBulletList",()=>{var Ae;(Ae=this.$ditaEditor)==null||Ae.chain().focus().toggleBulletList().run()});In(this,"addColumnAfter",()=>{var Ae;(Ae=this.$ditaEditor)==null||Ae.chain().focus().addColumnAfter().run()});In(this,"deleteColumn",()=>{var Ae;(Ae=this.$ditaEditor)==null||Ae.chain().focus().deleteColumn().run()});In(this,"addRowAfter",()=>{var Ae;(Ae=this.$ditaEditor)==null||Ae.chain().focus().addRowAfter().run()});In(this,"deleteRow",()=>{var Ae;(Ae=this.$ditaEditor)==null||Ae.chain().focus().deleteRow().run()});In(this,"setFontSize",Ae=>{var Se;(Se=this.$ditaEditor)==null||Se.chain().focus().setFontSize(Ae+"px").run()});In(this,"onFontChange",Ae=>{var Se;(Se=this.$ditaEditor)==null||Se.chain().focus().setFontFamily(Ae).run(),console.log("changdoiasbxlajcdsnlkdja ---- ",Ae)});In(this,"checkSpelling",()=>{let Ae=document.getElementById("dita-builder-container");Ae&&(Ae.spellcheck=!Ae.spellcheck)});In(this,"addLinkToContent",()=>{var Ae,Se;(Se=(Ae=this.$ditaEditor)==null?void 0:Ae.commands)==null||Se.openCustomLinkModal(),console.log("yet to write code")});In(this,"isActive",(Ae,Se={})=>{var Ee;return(Ee=this.$ditaEditor)==null?void 0:Ee.isActive(Ae,Se)});In(this,"isActiveByAttr",Ae=>{var Se;return(Se=this.$ditaEditor)==null?void 0:Se.isActive(Ae)});In(this,"ditaActions",[{name:"undo",command:this.undoChanges,icon:UndoIcon,isDisabled:!1},{name:"redo",command:this.redoChanges,icon:RedoIcon,isDisabled:!1},{name:"fontFamily",command:this.onFontChange,icon:"",isDisabled:!1},{name:"line",command:"",icon:"",isDisabled:!1},{name:"fontSize",command:this.setFontSize,icon:StrikeIcon,isDisabled:!1},{name:"line",command:"",icon:"",isDisabled:!1},{name:"bold",command:this.toggleBold,icon:BoldIcon,isDisabled:!1},{name:"italic",command:this.toggleItalic,icon:ItalicIcon,isDisabled:!1},{name:"underline",command:this.togglUnderline,icon:UnderlineIcon,isDisabled:!1},{name:"strike",command:this.toggleStrike,icon:StrikeIcon,isDisabled:!1},{name:"spell-check",command:this.checkSpelling,icon:SpellCheckIcon,isDisabled:!1},{name:"line",command:"",icon:"",isDisabled:!1},{name:"bulletList",command:this.toggleBulletList,icon:UnorderedListIcon,isDisabled:!1},{name:"line",command:"",icon:"",isDisabled:!1},{name:"link",command:this.addLinkToContent,icon:LinkIcon,isDisabled:!1},{name:"line",command:"",icon:"",isDisabled:!1}]);In(this,"addTimeStamp",()=>{const Ae={day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1};return new Date().toLocaleString("en-GB",Ae).replace(",","")});In(this,"onContentUpdate",this.debounce(async Ae=>{var Be,Fe,$e,Ue,He,Ve,We,ze,qe,Ke,Ge;const Se=Ae.editor;if((Fe=(Be=this.store)==null?void 0:Be._signals.topicAccordianLoader)!=null&&Fe.value)return;if(this.isResizingTable){console.log("Skipping update - table resize in progress");return}const Ee=replaceCurlyBraces(($e=this.meta.props)==null?void 0:$e.projectId,"state",{},this.meta.props,this)===""?"f1cc49c2-d456-49a3-99bc-8a4285503370":replaceCurlyBraces((Ue=this.meta.props)==null?void 0:Ue.projectId,"state",{},this.meta.props,this),xe=jsonToDita(Se.getJSON(),Ee),Te=get$6(((Ve=(He=this.store)==null?void 0:He._signals.ditaContent)==null?void 0:Ve.value)??{},"data","");if(!this.isInsideTable(Se)&&this.contentBlock!=="video"&&this.contentBlock!=="image"){const Ye=await xmlToDita(xe);this.updateStateByName({...Te,dita:Ye},"ditaContent")}let De={id:`${(We=this==null?void 0:this.ditaValue)==null?void 0:We.id}`,content:xe,updatedAt:this.addTimeStamp(),version:((+((ze=this==null?void 0:this.ditaValue)==null?void 0:ze.version)||0)+1).toString()};De={...this.ditaValue,...De},De&&"transactionId"in De&&delete De.transactionId,De&&"dita"in De&&delete De.dita;const ke={dbType:"TIDB",data:[De]},Oe=(qe=this==null?void 0:this.props)==null?void 0:qe.source,Me=((Ke=this==null?void 0:this.props)==null?void 0:Ke.apiMethod)||"POST",Pe=(Ge=this==null?void 0:this.props)==null?void 0:Ge.token;console.log(Oe,Me,ke),fetch(Oe,{method:Me,headers:{"Content-Type":"application/json",Authorization:`Bearer ${Pe}`},body:JSON.stringify(ke)}).then(Ye=>{if(!Ye.ok)throw new Error("Network response was not ok");return Ye.json()}).then(Ye=>{console.log("Auto-save successful:",Ye)}).catch(Ye=>{console.error("Auto-save failed:",Ye)})},1e3));In(this,"bindSearchEvents",()=>{const Ae=document.querySelector(".highlight-search-input[contenteditable]");if(Ae){let Se=null;Ae.addEventListener("input",Ee=>{Se&&clearTimeout(Se),Se=setTimeout(()=>{const xe=Ee.target;this.searchAndHighlight((xe==null?void 0:xe.textContent)||"")},500)})}else setTimeout(()=>{this.bindSearchEvents()},1e3)});In(this,"tableFixTimeout",null);In(this,"tableObserver",null)}createSimpleTableToolbar(){const Ae=document.createElement("div");Ae.id="simple-table-toolbar",Ae.style.cssText=`
2595
+ </table>`,_e}function jsonToDita(Ce,_e){var De,ke;let Ae=!1,Se="<title></title>";function Ee(Oe){var Pe,Be,Fe;let Me="";for(const $e of Oe){if((Pe=$e.attrs)!=null&&Pe.id&&`${$e.attrs.id}`,$e.type==="title"&&!Ae){const Ue=((Be=$e.content)==null?void 0:Be.map(xe).join(""))||"";Se=`<title ${(Fe=$e.attrs)!=null&&Fe.id?`id="${$e.attrs.id}"`:""}>${Ue}</title>`,Ae=!0;continue}if($e.type==="topic"){const Ue=Ee($e.content||[]);Me+=Ue;continue}Me+=xe($e)}return Me}function xe(Oe){var Pe,Be,Fe,$e,Ue,He,Ve,We,ze,qe,Ke,Ge,Ye,Qe,St,Xe,Je,rn;const Me=(Pe=Oe.attrs)!=null&&Pe.id?`id="${Oe.attrs.id}"`:"";if(Oe.type==="paragraph"){const sn=((Be=Oe.content)==null?void 0:Be.map(xe).join(""))||"";return`<p ${Me}>${sn}</p>`}else if(Oe.type==="text"){if(((Fe=Oe.marks)==null?void 0:Fe.length)>0){const sn=Oe.marks[0];if(sn.type==="link"){const{href:pn,target:mn,rel:yn}=sn.attrs;return`<a href="${pn}" target="${mn}" rel="${yn}">${Oe.text}</a>`}if(sn.type==="bold")return`<b>${Oe.text}</b>`;if(sn.type==="italic")return`<i>${Oe.text}</i>`;if(sn.type==="underline")return`<u>${Oe.text}</u>`}return Oe.text||""}else{if(Oe.type==="mention")return($e=Oe.attrs)!=null&&$e.label?`{${Oe.attrs.label}}`:"";if(Oe.type==="table"){const sn=Oe.content||"";return convertTiptapToDita(sn)}else if(Oe.type==="image"){const sn=(He=extractAssetDetails(((Ue=Oe.attrs)==null?void 0:Ue.src)||""))==null?void 0:He.assetNameWithExt;return`<image style="${(Ve=Oe==null?void 0:Oe.attrs)==null?void 0:Ve.style}" href="/home/cloud-user/dita/${_e}/${sn}" alt="${sn}" />`}else if(Oe.type==="video"){const sn=(ze=extractAssetDetails(((We=Oe.attrs)==null?void 0:We.src)||""))==null?void 0:ze.assetNameWithExt;return`<object type="video/${(Ke=extractAssetDetails(((qe=Oe.attrs)==null?void 0:qe.src)||""))==null?void 0:Ke.fileExtension}" data="/home/cloud-user/dita/${_e}/${sn}"> <param name="autoplay" value="false"/> <param name="controls" value="true"/> <desc>Video Uploaded from CMS</desc> </object>`}else if(Oe.type==="codeBlock"){const sn=(Ge=Oe.attrs)==null?void 0:Ge.language,pn=((Ye=Oe.content)==null?void 0:Ye.map(xe).join(""))||"";return`<codeblock outputclass="language-${sn}">${pn}</codeblock>`}else if(Oe.type==="section"){const sn=(Qe=Oe.content)==null?void 0:Qe.find(xn=>xn.type==="title"),pn=sn?`<title>${(St=sn.content)==null?void 0:St.map(xe).join("")}</title>`:"",yn=(((Xe=Oe.content)==null?void 0:Xe.filter(xn=>xn.type!=="title"))||[]).map(xe).join("");return`<section ${Me}>${pn}${yn}</section>`}else{if(Oe.type==="bulletList")return`<ul>${((Je=Oe.content)==null?void 0:Je.map(xe).join(""))||""}</ul>`;if(Oe.type==="listItem")return`<li>${((rn=Oe.content)==null?void 0:rn.map(xe).join(""))||""}</li>`}}return""}const Te=Ee(Ce.content||[]);return`<topic id="${((ke=(De=Ce==null?void 0:Ce.content)==null?void 0:De[0].attrs)==null?void 0:ke.id)||"root"}">${Se}<body>${Te}</body></topic>`}function dropdownJSON(Ce){return{id:"q",type:"my-dropdown",name:"font",styles:"w-full flex flex-col",props:{name:"font",show:!1,multiSelect:!1,layout:"list",partitions:3,type:"button",rounded:!0},bindings:{state:Ce||""},children:[{id:"qwjhg",type:"mobius-dropdown-input",name:"mobius div",styles:"flex border border-gray-300 w-[12vw] rounded-md color-gray-400 text-sm px-2 py-1",props:{value:"Font Family",icon:"/src/assets/dropdownIcon.svg",multiSelect:!1,selectType:!0},bindings:{state:Ce||"",actions:{click:["dropdownToggle"]}},children:[]},{id:"qw",type:"mb-dropdown-menu",name:"mobius dropdown menu",styles:"overflow-y-scroll gap-1 p-0 w-full h-[15vw] z-50 bg-white flex flex-col !top-[2vw] absolute border rounded-md px-3 py-2",props:{multiSelect:!1},bindings:{state:Ce||"",actions:{loadDropdownData:["getDropdownData"]}},children:[{id:"qwer76hyut",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Arial",disabled:!1,type:"text",key:"Arial"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw42r3ferer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Arial",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Arial"}],value:""},{id:"q=-0okwer",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Arial Black",disabled:!1,type:"text",key:"Arial Black"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw2qwer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Arial Black",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Arial Black"}],value:""},{id:"q=-0okwer",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Arial Unicode MS",disabled:!1,type:"text",key:"Arial Unicode MS"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw2qwer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Arial Unicode MS",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Arial Unicode MS"}],value:""},{id:"q=-0okwer",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Book Antiqua",disabled:!1,type:"text",key:"Book Antiqua"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw2qwer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Book Antiqua",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Book Antiqua"}],value:""},{id:"q=-0okwer",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Comic Sans MS",disabled:!1,type:"text",key:"Comic Sans MS"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw2qwer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Comic Sans MS",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Comic Sans MS"}],value:""},{id:"q=-0okwer",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Courier New",disabled:!1,type:"text",key:"Courier New"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw2qwer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Courier New",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Courier New"}],value:""},{id:"q=-0okwer",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Gadget",disabled:!1,type:"text",key:"Gadget"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw2qwer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Gadget",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Gadget"}],value:""},{id:"q=-0okwer",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Geneva",disabled:!1,type:"text",key:"Geneva"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw2qwer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Geneva",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Geneva"}],value:""},{id:"q=-0okwer",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Georgia",disabled:!1,type:"text",key:"Georgia"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw2qwer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Georgia",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Georgia"}],value:""},{id:"q=-0okwer",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Helvetica",disabled:!1,type:"text",key:"Helvetica"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw2qwer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Helvetica",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Helvetica"}],value:""},{id:"q=-0okwer",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Impact",disabled:!1,type:"text",key:"Impact"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw2qwer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Impact",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Impact"}],value:""},{id:"q=-0okwer",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Lucida Console",disabled:!1,type:"text",key:"Lucida Console"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw2qwer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Lucida Console",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Lucida Console"}],value:""},{id:"q=-0okwer",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Lucida Grande",disabled:!1,type:"text",key:"Lucida Grande"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw2qwer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Lucida Grande",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Lucida Grande"}],value:""},{id:"q=-0okwer",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Lucida Sans Unicode",disabled:!1,type:"text",key:"Lucida Sans Unicode"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw2qwer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Lucida Sans Unicode",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Lucida Sans Unicode"}],value:""},{id:"q=-0okwer",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Monaco",disabled:!1,type:"text",key:"Monaco"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw2qwer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Monaco",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Monaco"}],value:""},{id:"qwer76hyut",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"MS Serif",disabled:!1,type:"text",key:"MS Serif"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"qw42r3ferer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"MS Serif",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"MS Serif"}],value:""},{id:"qwe846531r",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"New York",disabled:!1,type:"text",key:"New York"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"q8653wer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"New York",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"New York"}],value:""},{id:"qwe846531r",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Palatino",disabled:!1,type:"text",key:"Palatino"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"q8653wer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Palatino",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Palatino"}],value:""},{id:"qwe846531r",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Palatino Linotype",disabled:!1,type:"text",key:"Palatino Linotype"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"q8653wer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Palatino Linotype",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Palatino Linotype"}],value:""},{id:"qwe846531r",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Symboll",disabled:!1,type:"text",key:"Symboll"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"q8653wer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Symboll",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Symboll"}],value:""},{id:"qwe846531r",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Tahoma",disabled:!1,type:"text",key:"Tahoma"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"q8653wer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Tahoma",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Tahoma"}],value:""},{id:"qwe846531r",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Times",disabled:!1,type:"text",key:"Times"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"q8653wer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Times",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Times"}],value:""},{id:"qwe846531r",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Times New Roman",disabled:!1,type:"text",key:"Times New Roman"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"q8653wer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Times New Roman",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Times New Roman"}],value:""},{id:"qwe846531r",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Trebuchet MS",disabled:!1,type:"text",key:"Trebuchet MS"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"q8653wer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Trebuchet MS",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Trebuchet MS"}],value:""},{id:"qwe846531r",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Verdana",disabled:!1,type:"text",key:"Verdana"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"q8653wer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Verdana",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:"Verdana"}],value:""},{id:"qwe846531r",type:"my-dropdown-item",styles:"hover:bg-blue-50 cursor-pointer",props:{value:"Webdings",disabled:!1,type:"text",key:"Webdings"},bindings:{state:Ce||"",actions:{click:["toggleMultiSelect"]}},children:[{id:"q8653wer",type:"mobius-list-item",name:"mobius dropdown list item text",styles:"",props:{value:"Webdings",disabled:!1,type:"text",checked:!1},bindings:{state:Ce||""},children:[],value:""}],value:""}]}]}}class WysiwygEditor extends BaseComponent{constructor(){super();In(this,"ditaValue","");In(this,"contentBlock","");In(this,"$ditaEditor",null);In(this,"fontSize",24);In(this,"isResizingTable",!1);In(this,"cleanupScheduled",!1);In(this,"props",{id:"dita_editor"});In(this,"bindings");In(this,"variablesList",[""]);In(this,"searchTerm","");In(this,"highlightedNodes",[]);In(this,"isEditableMode",!0);In(this,"undoChanges",()=>{var Ae;this.isEditableMode&&((Ae=this.$ditaEditor)==null||Ae.chain().focus().undo().run())});In(this,"redoChanges",()=>{var Ae;this.isEditableMode&&((Ae=this.$ditaEditor)==null||Ae.chain().focus().redo().run())});In(this,"toggleBold",()=>{var Ae;this.isEditableMode&&((Ae=this.$ditaEditor)==null||Ae.chain().focus().toggleBold().run())});In(this,"toggleItalic",()=>{var Ae;this.isEditableMode&&((Ae=this.$ditaEditor)==null||Ae.chain().focus().toggleItalic().run())});In(this,"togglUnderline",()=>{var Ae;this.isEditableMode&&((Ae=this.$ditaEditor)==null||Ae.chain().focus().toggleUnderline().run())});In(this,"toggleStrike",()=>{var Ae;this.isEditableMode&&((Ae=this.$ditaEditor)==null||Ae.chain().focus().toggleStrike().run())});In(this,"toggleBulletList",()=>{var Ae;this.isEditableMode&&((Ae=this.$ditaEditor)==null||Ae.chain().focus().toggleBulletList().run())});In(this,"addColumnAfter",()=>{var Ae;this.isEditableMode&&((Ae=this.$ditaEditor)==null||Ae.chain().focus().addColumnAfter().run())});In(this,"deleteColumn",()=>{var Ae;this.isEditableMode&&((Ae=this.$ditaEditor)==null||Ae.chain().focus().deleteColumn().run())});In(this,"addRowAfter",()=>{var Ae;this.isEditableMode&&((Ae=this.$ditaEditor)==null||Ae.chain().focus().addRowAfter().run())});In(this,"deleteRow",()=>{var Ae;this.isEditableMode&&((Ae=this.$ditaEditor)==null||Ae.chain().focus().deleteRow().run())});In(this,"setFontSize",Ae=>{var Se;this.isEditableMode&&((Se=this.$ditaEditor)==null||Se.chain().focus().setFontSize(Ae+"px").run())});In(this,"onFontChange",Ae=>{var Se;this.isEditableMode&&((Se=this.$ditaEditor)==null||Se.chain().focus().setFontFamily(Ae).run(),console.log("changdoiasbxlajcdsnlkdja ---- ",Ae))});In(this,"checkSpelling",()=>{let Ae=document.getElementById("dita-builder-container");Ae&&(Ae.spellcheck=!Ae.spellcheck)});In(this,"addLinkToContent",()=>{var Ae,Se;this.isEditableMode&&((Se=(Ae=this.$ditaEditor)==null?void 0:Ae.commands)==null||Se.openCustomLinkModal(),console.log("yet to write code"))});In(this,"isActive",(Ae,Se={})=>{var Ee;return(Ee=this.$ditaEditor)==null?void 0:Ee.isActive(Ae,Se)});In(this,"isActiveByAttr",Ae=>{var Se;return(Se=this.$ditaEditor)==null?void 0:Se.isActive(Ae)});In(this,"ditaActions",[{name:"undo",command:this.undoChanges,icon:UndoIcon,isDisabled:!1},{name:"redo",command:this.redoChanges,icon:RedoIcon,isDisabled:!1},{name:"fontFamily",command:this.onFontChange,icon:"",isDisabled:!1},{name:"line",command:"",icon:"",isDisabled:!1},{name:"fontSize",command:this.setFontSize,icon:StrikeIcon,isDisabled:!1},{name:"line",command:"",icon:"",isDisabled:!1},{name:"bold",command:this.toggleBold,icon:BoldIcon,isDisabled:!1},{name:"italic",command:this.toggleItalic,icon:ItalicIcon,isDisabled:!1},{name:"underline",command:this.togglUnderline,icon:UnderlineIcon,isDisabled:!1},{name:"strike",command:this.toggleStrike,icon:StrikeIcon,isDisabled:!1},{name:"spell-check",command:this.checkSpelling,icon:SpellCheckIcon,isDisabled:!1},{name:"line",command:"",icon:"",isDisabled:!1},{name:"bulletList",command:this.toggleBulletList,icon:UnorderedListIcon,isDisabled:!1},{name:"line",command:"",icon:"",isDisabled:!1},{name:"link",command:this.addLinkToContent,icon:LinkIcon,isDisabled:!1},{name:"line",command:"",icon:"",isDisabled:!1}]);In(this,"addTimeStamp",()=>{const Ae={day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1};return new Date().toLocaleString("en-GB",Ae).replace(",","")});In(this,"onContentUpdate",this.debounce(async Ae=>{var Be,Fe,$e,Ue,He,Ve,We,ze,qe,Ke,Ge;if(!this.isEditableMode)return;const Se=Ae.editor;if((Fe=(Be=this.store)==null?void 0:Be._signals.topicAccordianLoader)!=null&&Fe.value)return;if(this.isResizingTable){console.log("Skipping update - table resize in progress");return}const Ee=replaceCurlyBraces(($e=this.meta.props)==null?void 0:$e.projectId,"state",{},this.meta.props,this)===""?"f1cc49c2-d456-49a3-99bc-8a4285503370":replaceCurlyBraces((Ue=this.meta.props)==null?void 0:Ue.projectId,"state",{},this.meta.props,this),xe=jsonToDita(Se.getJSON(),Ee),Te=get$6(((Ve=(He=this.store)==null?void 0:He._signals.ditaContent)==null?void 0:Ve.value)??{},"data","");if(!this.isInsideTable(Se)&&this.contentBlock!=="video"&&this.contentBlock!=="image"){const Ye=await xmlToDita(xe);this.updateStateByName({...Te,dita:Ye},"ditaContent")}let De={id:`${(We=this==null?void 0:this.ditaValue)==null?void 0:We.id}`,content:xe,updatedAt:this.addTimeStamp(),version:((+((ze=this==null?void 0:this.ditaValue)==null?void 0:ze.version)||0)+1).toString()};De={...this.ditaValue,...De},De&&"transactionId"in De&&delete De.transactionId,De&&"dita"in De&&delete De.dita;const ke={dbType:"TIDB",data:[De]},Oe=(qe=this==null?void 0:this.props)==null?void 0:qe.source,Me=((Ke=this==null?void 0:this.props)==null?void 0:Ke.apiMethod)||"POST",Pe=(Ge=this==null?void 0:this.props)==null?void 0:Ge.token;console.log(Oe,Me,ke),fetch(Oe,{method:Me,headers:{"Content-Type":"application/json",Authorization:`Bearer ${Pe}`},body:JSON.stringify(ke)}).then(Ye=>{if(!Ye.ok)throw new Error("Network response was not ok");return Ye.json()}).then(Ye=>{console.log("Auto-save successful:",Ye)}).catch(Ye=>{console.error("Auto-save failed:",Ye)})},1e3));In(this,"bindSearchEvents",()=>{const Ae=document.querySelector(".highlight-search-input[contenteditable]");if(Ae){let Se=null;Ae.addEventListener("input",Ee=>{Se&&clearTimeout(Se),Se=setTimeout(()=>{const xe=Ee.target;this.searchAndHighlight((xe==null?void 0:xe.textContent)||"")},500)})}else setTimeout(()=>{this.bindSearchEvents()},1e3)});In(this,"tableFixTimeout",null);In(this,"tableObserver",null)}createSimpleTableToolbar(){const Ae=document.createElement("div");Ae.id="simple-table-toolbar",Ae.style.cssText=`
2596
2596
  display: flex;
2597
2597
  gap: 8px;
2598
2598
  padding: 6px 10px;
@@ -2606,7 +2606,10 @@ img.ProseMirror-separator {
2606
2606
  background: white;
2607
2607
  cursor: pointer;
2608
2608
  border-radius: 4px;
2609
- `,Te.onclick=xe,Te};return Ae.append(Se("+ Col",this.addColumnAfter),Se("− Col",this.deleteColumn),Se("+ Row",this.addRowAfter),Se("− Row",this.deleteRow)),Ae}static get observedAttributes(){return["props","bindings"]}async editorDitaContent(Ae){var Se;if(console.log("In WYSIWYG Editor component...",Ae),this.$ditaEditor){const Ee=this.$ditaEditor.state.selection.from;if(this.$ditaEditor.commands.clearContent(),!((Se=Ae==null?void 0:Ae.data)!=null&&Se.dita))return;let xe="";this.ditaValue=Ae==null?void 0:Ae.data,await(async()=>{var De,ke;const Ie=(De=Ae==null?void 0:Ae.data)==null?void 0:De.dita;return Ie instanceof Promise?xe=await Ie:xe=Ie,(ke=this.$ditaEditor)==null||ke.commands.setContent(xe),setTimeout(()=>this.fixTableStyling(),100),xe})(),Ee&&this.$ditaEditor.chain().focus().setTextSelection(Ee).run()}}editorViewType(){var Ee;if(!this.$ditaEditor)return;const Ae=replaceCurlyBraces((Ee=this.props)==null?void 0:Ee.accessMode,"state",{},this.meta.props,this)||"edit",Se=String(Ae).toLowerCase().trim();this.$ditaEditor.setOptions({editable:Se==="edit"})}addContentBlockType(Ae,Se){var xe,Te;const Ee=Ae;this.contentBlock=Ae,console.log("this is the content type ",Ae),this.$ditaEditor&&(this.$ditaEditor.state.selection.from,Ee==="text"?this.$ditaEditor.commands.insertContent("<p></p>"):Ee==="section"?this.$ditaEditor.commands.insertSection():Ee==="table"?(this.$ditaEditor.chain().focus().insertTable({rows:2,cols:4,withHeaderRow:!0}).run(),setTimeout(()=>this.fixTableStyling(),200),setTimeout(()=>this.fixTableStyling(),500)):Ee==="image"?(localStorage.setItem("selectedTopicId",(Te=(xe=this.getState())==null?void 0:xe.ditaContent)==null?void 0:Te.id),this.$ditaEditor.commands.insertContent({type:"imagePlaceholder"})):Ee==="video"?this.$ditaEditor.commands.insertContent({type:"videoPlaceholder"}):Ee==="codeBlock"?this.$ditaEditor.commands.insertContent({type:"codeBlock",attrs:{language:"javascript"}}):Ee==="hyperLink"&&this.$ditaEditor.commands.openCustomLinkModal())}attributeChangedCallback(Ae,Se,Ee){var xe;if(!(Se===Ee&&Ae!=="props"))if(Ae==="props")try{this.props={...this.props,...JSON.parse(Ee||"{}")},this.editorViewType()}catch(Te){console.error("Error parsing props:",Te)}else Ae==="bindings"&&(this.bindings=JSON.parse(Ee||"{}"),(xe=this.getState().ditaContent)==null||xe.data,this.setBindings(this.bindings,Te=>{var Ie;this.variablesList=replaceCurlyBraces((Ie=this.meta.props)==null?void 0:Ie.variableList,"state",{},this.meta.props,this),this.editorViewType(),console.log(this.variablesList,"this is the varibale list ")}))}connectedCallback(){this.render()}updatePopupPosition(Ae,Se){Se&&(Ae.style.left=`${Se.left+window.scrollX}px`,Ae.style.top=`${Se.bottom+window.scrollY}px`,Ae.style.position="absolute",Ae.style.zIndex="9999")}createToolbarAction(Ae,Se,Ee,xe){const Te=document.createElement("button");Te.type="button",Te.setAttribute("aria-label",Ae),Te.className="rounded p-1 hover:bg-black hover:text-white",this.isActive&&this.isActive(Ae)&&Te.classList.add("bg-black","text-white"),Te.onclick=Se,xe!==void 0&&xe&&(Te.disabled=!0);const Ie=document.createElement("img");return Ie.src=Ee,Ie.alt=Ae,Te.appendChild(Ie),Te}createFontSizeView(Ae){let Se=document.createElement("div");const Ee=()=>{let Me=document.getElementById("font-size");Me&&(Me.textContent=this.fontSize+""),Ae(this.fontSize)},xe=()=>{this.fontSize--,Ee()},Te=()=>{this.fontSize++,Ee()};let Ie=document.createElement("div");Ie.className="flex flex-row items-center gap-0.5";let De=document.createElement("button");De.className="p-1 size-8 rounded hover:bg-gray-200 transition",De.textContent="-",De.addEventListener("click",()=>xe()),Ie.appendChild(De);let ke=document.createElement("div");ke.id="font-size",ke.className="bg-gray-50 rounded py-1 px-3 gap-2 text-lg",ke.textContent=this.fontSize+"",Ie.appendChild(ke);let Oe=document.createElement("button");return Oe.className="p-1 size-8 rounded hover:bg-gray-200 transition",Oe.textContent="+",Oe.addEventListener("click",()=>Te()),Ie.appendChild(Oe),Se.appendChild(Ie),Se}addDividerLineView(){let Ae=document.createElement("div");return Ae.id="divider-line",Ae.className+="h-7 bg-gray-100 items-center border-[1.5px]",Ae}getDropDownJson(){return dropdownJSON(this.bindings.state)}createDitaToolbarView(){let Ae=document.createElement("div");Ae.className="flex items-center justify-between w-full p-2 ",this.ditaActions.forEach(Se=>{if(Se.name==="line")Ae.appendChild(this.addDividerLineView());else if(Se.name==="fontSize"){const Ee=this.createFontSizeView(Se.command);Ae.appendChild(Ee)}else if(Se.name==="fontFamily"){let Ee=document.createElement("mobius-div");Ee.appendChild(mountComponents([this.getDropDownJson()],this)),Ae.appendChild(Ee)}else{const Ee=this.createToolbarAction(Se.name,Se.command,Se.icon,Se.isDisabled);Ae.appendChild(Ee)}}),this.appendChild(Ae)}debounce(Ae,Se){let Ee;return(...xe)=>{clearTimeout(Ee),Ee=setTimeout(()=>Ae(...xe),Se)}}isInsideTable(Ae){const{$from:Se}=Ae.state.selection;for(let Ee=Se.depth;Ee>0;Ee--)if(Se.node(Ee).type.name==="table")return!0;return!1}getFocusedNode(){if(!this.$ditaEditor)return;const Ae=this.isInsideTable(this.$ditaEditor),Se=document.getElementById("simple-table-toolbar");if(Ae&&!Se){const Ee=this.createSimpleTableToolbar(),xe=document.getElementById("dita-builder-container");xe==null||xe.prepend(Ee)}!Ae&&Se&&Se.remove()}searchAndHighlight(Ae){var Te;if(this.searchTerm=Ae.trim(),this.clearHighlights(),!this.searchTerm||!this.searchTerm.length)return;const Se=(Te=this.$ditaEditor)==null?void 0:Te.getText(),Ee=new RegExp(this.escapeRegExp(this.searchTerm),"gi");Se!=null&&Se.match(Ee)&&this.highlightMatches(this.searchTerm)}highlightMatches(Ae){var Ie;if(!this.$ditaEditor)return;const{state:Se}=this.$ditaEditor,{doc:Ee}=Se;let xe=Se.tr;const Te=[];Ee.descendants((De,ke)=>{if(De.isText){const Oe=De.text,Me=new RegExp(this.escapeRegExp(Ae),"gi");let Pe;for(;(Pe=Me.exec(Oe))!==null;){const Be=ke+Pe.index,Fe=Be+Pe[0].length;Te.push({from:Be,to:Fe})}}}),Te.reverse().forEach(({from:De,to:ke})=>{var Me;const Oe=(Me=this.$ditaEditor)==null?void 0:Me.schema.marks.highlight.create({color:"#ffeb3b"});Oe&&(xe=xe.addMark(De,ke,Oe))}),Te.length>0&&((Ie=this.$ditaEditor)==null||Ie.view.dispatch(xe))}clearHighlights(){var xe;if(!this.$ditaEditor)return;const{state:Ae}=this.$ditaEditor,{doc:Se}=Ae;let Ee=Ae.tr;Se.descendants((Te,Ie)=>{Te.marks&&Te.marks.forEach(De=>{De.type.name==="highlight"&&(Ee=Ee.removeMark(Ie,Ie+Te.nodeSize,De))})}),(xe=this.$ditaEditor)==null||xe.view.dispatch(Ee)}escapeRegExp(Ae){return Ae.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}createDitaBuilderView(Ae){let Se=document.createElement("div");return Se.id="dita-builder-container",Se.spellcheck=!1,Se.className="w-full min-h-full bg-white",this.$ditaEditor=new Editor({element:Se,content:(Ae==null?void 0:Ae.dita)||"",onCreate:Ee=>{const{editor:xe}=Ee;window.ditaEditorInstance=xe,this.editorViewType(),setTimeout(()=>this.fixTableStyling(),100)},onUpdate:this.onContentUpdate.bind(this),onSelectionUpdate:({editor:Ee})=>this.getFocusedNode(),extensions:[StarterKit.configure({link:!1,gapcursor:!1,dropcursor:!1}),Underline,TitleNode,TopicNode,src_default,TextStyle.configure({mergeNestedSpanStyles:!0}),SectionNode,CustomLink.configure({openOnClick:!0}),Highlight.configure({multicolor:!0}),ImagePlaceholderNode,VideoPlaceholderNode,Image$1,ImageResize.configure({inline:!1,allowBase64:!0,HTMLAttributes:{class:"resizable-image"}}),VideoNode,SectionTitleNode,TableRow,TableCell,TableHeader,Table$1.configure({resizable:!0,allowTableNodeSelection:!1,lastColumnResizable:!1,HTMLAttributes:{class:"custom-table"},handleWidth:5,cellMinWidth:50}),FocusClasses.configure({className:"has-focus",mode:"deepest"}),PaginationPlus.configure({pageHeight:842,pageGap:40,pageBreakBackground:"#dbeafe",pageHeaderHeight:50,footerLeft:""}),u$1.configure({attributeName:"id",types:["title","topic","div","section","heading","orderedList","bulletList","listItem"],createId:()=>window.crypto.randomUUID()}),Placeholder$1.configure({includeChildren:!0,showOnlyCurrent:!1,placeholder:({node:Ee})=>Ee.type.name==="heading"?"Whats the title?":Ee.type.name==="paragraph"?"Paragraph":Ee.type.name==="title"?"Topic title":Ee.type.name==="sectiontitle"?"Section title":""}),TextAlign.configure({types:["heading","paragraph","title"]}),Mention.configure({HTMLAttributes:{class:"mention"},suggestion:{char:"@",allowSpaces:!0,items:({query:Ee})=>{var xe,Te;return Ee===""?(xe=this.variablesList)==null?void 0:xe.map(Ie=>({label:Ie==null?void 0:Ie.name,id:Ie==null?void 0:Ie.name})):(Te=this.variablesList)==null?void 0:Te.filter(Ie=>Ie==null?void 0:Ie.name.toLowerCase().includes(Ee.toLowerCase())).map(Ie=>({label:Ie==null?void 0:Ie.name,id:Ie==null?void 0:Ie.name}))},command:({editor:Ee,range:xe,props:Te})=>{Ee.chain().focus().insertContentAt(xe,[{type:"mention",attrs:{id:Te.id,label:Te.label}},{type:"text",text:" "}]).run()},render:()=>{let Ee,xe;const Te=Ie=>{if(xe.innerHTML="",!Ie.items.length){xe.innerHTML='<div class="mention-item p-2 text-gray-400">No matches</div>';return}Ie.items.forEach(De=>{const ke=document.createElement("div");ke.classList.add("mention-item","p-2","cursor-pointer","hover:bg-gray-200","rounded"),ke.textContent=De.label,ke.addEventListener("click",()=>Ie.command(De)),xe.appendChild(ke)})};return{onStart:Ie=>{var ke;const De=(ke=Ie.clientRect)==null?void 0:ke.call(Ie);De&&(Ee=document.createElement("div"),Ee.classList.add("mention-popup","absolute","bg-white","shadow-md","border","rounded","p-2","z-50"),xe=document.createElement("div"),xe.className="mention-items flex flex-col",Ee.appendChild(xe),document.body.appendChild(Ee),Te(Ie),this.updatePopupPosition(Ee,De))},onUpdate:Ie=>{var ke;Te(Ie);const De=(ke=Ie.clientRect)==null?void 0:ke.call(Ie);De&&this.updatePopupPosition(Ee,De)},onKeyDown:({event:Ie})=>Ie.key==="Escape"?(Ee.remove(),!0):!1,onExit:()=>Ee.remove()}}}})],editorProps:{attributes:{class:"border-black rounded-b-md px-10 outline-none"},handleDOMEvents:{mousedown:(Ee,xe)=>{const Te=xe.target;return(Te.classList.contains("column-resize-handle")||Te.closest(".column-resize-handle"))&&(console.log("Resize started"),this.isResizingTable=!0),!1},mousemove:(Ee,xe)=>(this.isResizingTable,!1),mouseup:(Ee,xe)=>(this.isResizingTable&&(console.log("Resize ended"),setTimeout(()=>{this.isResizingTable=!1,setTimeout(()=>{this.preventExtraParagraphs(),this.fixTableStyling()},150)},100)),!1),mouseleave:(Ee,xe)=>(this.isResizingTable&&setTimeout(()=>{this.isResizingTable=!1},100),!1)}}}),Se}fixTableStyling(){document.querySelectorAll(".tableWrapper table, .ProseMirror table").forEach(Se=>{var De;const Ee=Se;let xe=Ee.closest(".tableWrapper");if(!xe){const ke=document.createElement("div");ke.className="tableWrapper",(De=Ee.parentNode)==null||De.insertBefore(ke,Ee),ke.appendChild(Ee),xe=ke}if(xe.style.cssText=`
2609
+ `,Te.onclick=xe,Te};return Ae.append(Se("+ Col",this.addColumnAfter),Se("− Col",this.deleteColumn),Se("+ Row",this.addRowAfter),Se("− Row",this.deleteRow)),Ae}static get observedAttributes(){return["props","bindings"]}async editorDitaContent(Ae){var Se;if(console.log("In WYSIWYG Editor component...",Ae),this.$ditaEditor){const Ee=this.$ditaEditor.state.selection.from;if(this.$ditaEditor.commands.clearContent(),!((Se=Ae==null?void 0:Ae.data)!=null&&Se.dita))return;let xe="";this.ditaValue=Ae==null?void 0:Ae.data,await(async()=>{var De,ke;const Ie=(De=Ae==null?void 0:Ae.data)==null?void 0:De.dita;return Ie instanceof Promise?xe=await Ie:xe=Ie,(ke=this.$ditaEditor)==null||ke.commands.setContent(xe),setTimeout(()=>this.fixTableStyling(),100),xe})(),Ee&&this.$ditaEditor.chain().focus().setTextSelection(Ee).run()}}editorViewType(){var Ee;if(!this.$ditaEditor)return;const Ae=replaceCurlyBraces((Ee=this.props)==null?void 0:Ee.accessMode,"state",{},this.meta.props,this)||"edit",Se=String(Ae).toLowerCase().trim();this.isEditableMode=Se==="edit",this.$ditaEditor.setOptions({editable:this.isEditableMode})}addContentBlockType(Ae,Se){var xe,Te;if(!this.isEditableMode)return;const Ee=Ae;this.contentBlock=Ae,console.log("this is the content type ",Ae),this.$ditaEditor&&(this.$ditaEditor.state.selection.from,Ee==="text"?this.$ditaEditor.commands.insertContent("<p></p>"):Ee==="section"?this.$ditaEditor.commands.insertSection():Ee==="table"?(this.$ditaEditor.chain().focus().insertTable({rows:2,cols:4,withHeaderRow:!0}).run(),setTimeout(()=>this.fixTableStyling(),200),setTimeout(()=>this.fixTableStyling(),500)):Ee==="image"?(localStorage.setItem("selectedTopicId",(Te=(xe=this.getState())==null?void 0:xe.ditaContent)==null?void 0:Te.id),this.$ditaEditor.commands.insertContent({type:"imagePlaceholder"})):Ee==="video"?this.$ditaEditor.commands.insertContent({type:"videoPlaceholder"}):Ee==="codeBlock"?this.$ditaEditor.commands.insertContent({type:"codeBlock",attrs:{language:"javascript"}}):Ee==="hyperLink"&&this.$ditaEditor.commands.openCustomLinkModal())}attributeChangedCallback(Ae,Se,Ee){var xe;if(!(Se===Ee&&Ae!=="props"))if(Ae==="props")try{this.props={...this.props,...JSON.parse(Ee||"{}")},this.editorViewType()}catch(Te){console.error("Error parsing props:",Te)}else Ae==="bindings"&&(this.bindings=JSON.parse(Ee||"{}"),(xe=this.getState().ditaContent)==null||xe.data,this.setBindings(this.bindings,Te=>{var Ie;this.variablesList=replaceCurlyBraces((Ie=this.meta.props)==null?void 0:Ie.variableList,"state",{},this.meta.props,this),this.editorViewType(),console.log(this.variablesList,"this is the varibale list ")}))}connectedCallback(){this.render()}updatePopupPosition(Ae,Se){Se&&(Ae.style.left=`${Se.left+window.scrollX}px`,Ae.style.top=`${Se.bottom+window.scrollY}px`,Ae.style.position="absolute",Ae.style.zIndex="9999")}createToolbarAction(Ae,Se,Ee,xe){const Te=document.createElement("button");Te.type="button",Te.setAttribute("aria-label",Ae);const Ie=!this.isEditableMode||!!xe;Te.disabled=Ie,Te.tabIndex=Ie?-1:0,Te.className=`
2610
+ rounded p-1
2611
+ ${Ie?"opacity-40 cursor-not-allowed":"hover:bg-black hover:text-white"}
2612
+ `,Ie||(Te.onclick=Se);const De=document.createElement("img");return De.src=Ee,De.alt=Ae,Te.appendChild(De),Te}createFontSizeView(Ae){let Se=document.createElement("div");const Ee=()=>{if(!this.isEditableMode)return;let Me=document.getElementById("font-size");Me&&(Me.textContent=this.fontSize+""),Ae(this.fontSize)},xe=()=>{this.isEditableMode&&(this.fontSize--,Ee())},Te=()=>{this.isEditableMode&&(this.fontSize++,Ee())};let Ie=document.createElement("div");Ie.className="flex flex-row items-center gap-0.5";let De=document.createElement("button");De.className="p-1 size-8 rounded hover:bg-gray-200 transition",De.textContent="-",De.addEventListener("click",()=>xe()),Ie.appendChild(De);let ke=document.createElement("div");ke.id="font-size",ke.className="bg-gray-50 rounded py-1 px-3 gap-2 text-lg",ke.textContent=this.fontSize+"",Ie.appendChild(ke);let Oe=document.createElement("button");return Oe.className="p-1 size-8 rounded hover:bg-gray-200 transition",Oe.textContent="+",Oe.addEventListener("click",()=>Te()),Ie.appendChild(Oe),Se.appendChild(Ie),Se}addDividerLineView(){let Ae=document.createElement("div");return Ae.id="divider-line",Ae.className+="h-7 bg-gray-100 items-center border-[1.5px]",Ae}getDropDownJson(){return dropdownJSON(this.bindings.state)}createDitaToolbarView(){let Ae=document.createElement("div");Ae.className="flex items-center justify-between w-full p-2 ",this.ditaActions.forEach(Se=>{if(Se.name==="line")Ae.appendChild(this.addDividerLineView());else if(Se.name==="fontSize"){const Ee=this.createFontSizeView(Se.command);Ae.appendChild(Ee)}else if(Se.name==="fontFamily"){let Ee=document.createElement("mobius-div");Ee.appendChild(mountComponents([this.getDropDownJson()],this)),Ae.appendChild(Ee)}else{const Ee=this.createToolbarAction(Se.name,Se.command,Se.icon,Se.isDisabled);Ae.appendChild(Ee)}}),this.appendChild(Ae)}debounce(Ae,Se){let Ee;return(...xe)=>{clearTimeout(Ee),Ee=setTimeout(()=>Ae(...xe),Se)}}isInsideTable(Ae){const{$from:Se}=Ae.state.selection;for(let Ee=Se.depth;Ee>0;Ee--)if(Se.node(Ee).type.name==="table")return!0;return!1}getFocusedNode(){if(!this.$ditaEditor)return;const Ae=this.isInsideTable(this.$ditaEditor),Se=document.getElementById("simple-table-toolbar");if(Ae&&!Se){const Ee=this.createSimpleTableToolbar(),xe=document.getElementById("dita-builder-container");xe==null||xe.prepend(Ee)}!Ae&&Se&&Se.remove()}searchAndHighlight(Ae){var Te;if(this.searchTerm=Ae.trim(),this.clearHighlights(),!this.searchTerm||!this.searchTerm.length)return;const Se=(Te=this.$ditaEditor)==null?void 0:Te.getText(),Ee=new RegExp(this.escapeRegExp(this.searchTerm),"gi");Se!=null&&Se.match(Ee)&&this.highlightMatches(this.searchTerm)}highlightMatches(Ae){var Ie;if(!this.$ditaEditor)return;const{state:Se}=this.$ditaEditor,{doc:Ee}=Se;let xe=Se.tr;const Te=[];Ee.descendants((De,ke)=>{if(De.isText){const Oe=De.text,Me=new RegExp(this.escapeRegExp(Ae),"gi");let Pe;for(;(Pe=Me.exec(Oe))!==null;){const Be=ke+Pe.index,Fe=Be+Pe[0].length;Te.push({from:Be,to:Fe})}}}),Te.reverse().forEach(({from:De,to:ke})=>{var Me;const Oe=(Me=this.$ditaEditor)==null?void 0:Me.schema.marks.highlight.create({color:"#ffeb3b"});Oe&&(xe=xe.addMark(De,ke,Oe))}),Te.length>0&&((Ie=this.$ditaEditor)==null||Ie.view.dispatch(xe))}clearHighlights(){var xe;if(!this.$ditaEditor)return;const{state:Ae}=this.$ditaEditor,{doc:Se}=Ae;let Ee=Ae.tr;Se.descendants((Te,Ie)=>{Te.marks&&Te.marks.forEach(De=>{De.type.name==="highlight"&&(Ee=Ee.removeMark(Ie,Ie+Te.nodeSize,De))})}),(xe=this.$ditaEditor)==null||xe.view.dispatch(Ee)}escapeRegExp(Ae){return Ae.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}createDitaBuilderView(Ae){let Se=document.createElement("div");return Se.id="dita-builder-container",Se.spellcheck=!1,Se.className="w-full min-h-full bg-white",this.$ditaEditor=new Editor({element:Se,content:(Ae==null?void 0:Ae.dita)||"",onCreate:Ee=>{const{editor:xe}=Ee;window.ditaEditorInstance=xe,this.editorViewType(),setTimeout(()=>this.fixTableStyling(),100)},onUpdate:this.onContentUpdate.bind(this),onSelectionUpdate:({editor:Ee})=>this.getFocusedNode(),extensions:[StarterKit.configure({link:!1,gapcursor:!1,dropcursor:!1}),Underline,TitleNode,TopicNode,src_default,TextStyle.configure({mergeNestedSpanStyles:!0}),SectionNode,CustomLink.configure({openOnClick:!0}),Highlight.configure({multicolor:!0}),ImagePlaceholderNode,VideoPlaceholderNode,Image$1,ImageResize.configure({inline:!1,allowBase64:!0,HTMLAttributes:{class:"resizable-image"}}),VideoNode,SectionTitleNode,TableRow,TableCell,TableHeader,Table$1.configure({resizable:!0,allowTableNodeSelection:!1,lastColumnResizable:!1,HTMLAttributes:{class:"custom-table"},handleWidth:5,cellMinWidth:50}),FocusClasses.configure({className:"has-focus",mode:"deepest"}),PaginationPlus.configure({pageHeight:842,pageGap:40,pageBreakBackground:"#dbeafe",pageHeaderHeight:50,footerLeft:""}),u$1.configure({attributeName:"id",types:["title","topic","div","section","heading","orderedList","bulletList","listItem"],createId:()=>window.crypto.randomUUID()}),Placeholder$1.configure({includeChildren:!0,showOnlyCurrent:!1,placeholder:({node:Ee})=>Ee.type.name==="heading"?"Whats the title?":Ee.type.name==="paragraph"?"Paragraph":Ee.type.name==="title"?"Topic title":Ee.type.name==="sectiontitle"?"Section title":""}),TextAlign.configure({types:["heading","paragraph","title"]}),Mention.configure({HTMLAttributes:{class:"mention"},suggestion:{char:"@",allowSpaces:!0,items:({query:Ee})=>{var xe,Te;return Ee===""?(xe=this.variablesList)==null?void 0:xe.map(Ie=>({label:Ie==null?void 0:Ie.name,id:Ie==null?void 0:Ie.name})):(Te=this.variablesList)==null?void 0:Te.filter(Ie=>Ie==null?void 0:Ie.name.toLowerCase().includes(Ee.toLowerCase())).map(Ie=>({label:Ie==null?void 0:Ie.name,id:Ie==null?void 0:Ie.name}))},command:({editor:Ee,range:xe,props:Te})=>{Ee.chain().focus().insertContentAt(xe,[{type:"mention",attrs:{id:Te.id,label:Te.label}},{type:"text",text:" "}]).run()},render:()=>{let Ee,xe;const Te=Ie=>{if(xe.innerHTML="",!Ie.items.length){xe.innerHTML='<div class="mention-item p-2 text-gray-400">No matches</div>';return}Ie.items.forEach(De=>{const ke=document.createElement("div");ke.classList.add("mention-item","p-2","cursor-pointer","hover:bg-gray-200","rounded"),ke.textContent=De.label,ke.addEventListener("click",()=>Ie.command(De)),xe.appendChild(ke)})};return{onStart:Ie=>{var ke;const De=(ke=Ie.clientRect)==null?void 0:ke.call(Ie);De&&(Ee=document.createElement("div"),Ee.classList.add("mention-popup","absolute","bg-white","shadow-md","border","rounded","p-2","z-50"),xe=document.createElement("div"),xe.className="mention-items flex flex-col",Ee.appendChild(xe),document.body.appendChild(Ee),Te(Ie),this.updatePopupPosition(Ee,De))},onUpdate:Ie=>{var ke;Te(Ie);const De=(ke=Ie.clientRect)==null?void 0:ke.call(Ie);De&&this.updatePopupPosition(Ee,De)},onKeyDown:({event:Ie})=>Ie.key==="Escape"?(Ee.remove(),!0):!1,onExit:()=>Ee.remove()}}}})],editorProps:{attributes:{class:"border-black rounded-b-md px-10 outline-none"},handleDOMEvents:{mousedown:(Ee,xe)=>{const Te=xe.target;return(Te.classList.contains("column-resize-handle")||Te.closest(".column-resize-handle"))&&(console.log("Resize started"),this.isResizingTable=!0),!1},mousemove:(Ee,xe)=>(this.isResizingTable,!1),mouseup:(Ee,xe)=>(this.isResizingTable&&(console.log("Resize ended"),setTimeout(()=>{this.isResizingTable=!1,setTimeout(()=>{this.preventExtraParagraphs(),this.fixTableStyling()},150)},100)),!1),mouseleave:(Ee,xe)=>(this.isResizingTable&&setTimeout(()=>{this.isResizingTable=!1},100),!1)}}}),Se}fixTableStyling(){document.querySelectorAll(".tableWrapper table, .ProseMirror table").forEach(Se=>{var De;const Ee=Se;let xe=Ee.closest(".tableWrapper");if(!xe){const ke=document.createElement("div");ke.className="tableWrapper",(De=Ee.parentNode)==null||De.insertBefore(ke,Ee),ke.appendChild(Ee),xe=ke}if(xe.style.cssText=`
2610
2613
  width: 100% !important;
2611
2614
  max-width: 100% !important;
2612
2615
  overflow-x: auto !important;
@@ -1,4 +1,4 @@
1
- import { conf as t, language as e } from "./typescript-O1n2LB4L.js";
1
+ import { conf as t, language as e } from "./typescript-BuE9MCvM.js";
2
2
  /*!-----------------------------------------------------------------------------
3
3
  * Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
@@ -1,4 +1,4 @@
1
- import { m as Et } from "./index-BaQNsaYT.js";
1
+ import { m as Et } from "./index-DE85gHyd.js";
2
2
  /*!-----------------------------------------------------------------------------
3
3
  * Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
@@ -1,4 +1,4 @@
1
- import { m as l } from "./index-BaQNsaYT.js";
1
+ import { m as l } from "./index-DE85gHyd.js";
2
2
  /*!-----------------------------------------------------------------------------
3
3
  * Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
@@ -1,4 +1,4 @@
1
- import { m as s } from "./index-BaQNsaYT.js";
1
+ import { m as s } from "./index-DE85gHyd.js";
2
2
  /*!-----------------------------------------------------------------------------
3
3
  * Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
@@ -1,4 +1,4 @@
1
- import { m as o } from "./index-BaQNsaYT.js";
1
+ import { m as o } from "./index-DE85gHyd.js";
2
2
  /*!-----------------------------------------------------------------------------
3
3
  * Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
@@ -1,4 +1,4 @@
1
- import { m } from "./index-BaQNsaYT.js";
1
+ import { m } from "./index-DE85gHyd.js";
2
2
  /*!-----------------------------------------------------------------------------
3
3
  * Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)