@templatical/editor 0.14.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/dist/{AiChatSidebar-J8iO_sX7.js → AiChatSidebar-BIKvYREk.js} +57 -56
  2. package/dist/{AiFeatureMenu-F2diEDgV.js → AiFeatureMenu-CU6kTMTf.js} +20 -20
  3. package/dist/{BlockIssueBadge-a-qlByxF.js → BlockIssueBadge-B3xVgMTh.js} +11 -11
  4. package/dist/{CloudEditor-CDjtwb4i.js → CloudEditor-DRPxvUEj.js} +470 -468
  5. package/dist/{CollaboratorBar-B_EnJLtW.js → CollaboratorBar-DMSjd3HZ.js} +20 -20
  6. package/dist/{CommentsSidebar-DaP9BA_r.js → CommentsSidebar-D_tSGvTX.js} +154 -153
  7. package/dist/CountdownBlock-apiYUhkQ.js +92 -0
  8. package/dist/CountdownToolbar-CS0axcjz.js +210 -0
  9. package/dist/{DesignReferenceSidebar-BHRlTqlT.js → DesignReferenceSidebar-DWYK9nTk.js} +58 -57
  10. package/dist/{IssuesPanel-u7ee3Wrl.js → IssuesPanel-CR1MPaDE.js} +40 -40
  11. package/dist/{LoadingTrack-CV3ID80N.js → LoadingTrack-DsecR8Rw.js} +1 -1
  12. package/dist/MergeTagSuggestion-CH2SUxBo.js +1327 -0
  13. package/dist/{ModuleBrowserModal-DOsdaS6s.js → ModuleBrowserModal-BOzleijA.js} +60 -59
  14. package/dist/{ModulePreviewCanvas-Cx4MOJ0X.js → ModulePreviewCanvas-Cg99Pbde.js} +29 -29
  15. package/dist/{NumberWithSuffix-D2mW_DhT.js → NumberWithSuffix-CrA6quxx.js} +143 -142
  16. package/dist/{ParagraphEditor-DMzkVnST.js → ParagraphEditor-8jnzoL0A.js} +250 -247
  17. package/dist/{RichTextEditorContent-CRCxCwKf.js → RichTextEditorContent-BqLHIZY7.js} +45 -44
  18. package/dist/{SaveModuleDialog-DuEKgumL.js → SaveModuleDialog-Cy2XyjYT.js} +38 -37
  19. package/dist/{SnapshotHistory-CVgiNJtE.js → SnapshotHistory-cfxmOsJu.js} +34 -33
  20. package/dist/{TemplateScoringPanel-lm0_9nYi.js → TemplateScoringPanel-CZ62rGHz.js} +83 -82
  21. package/dist/{TestEmailModal-WBMdiW5S.js → TestEmailModal-sr1MaMVX.js} +22 -21
  22. package/dist/{TitleEditor-eyT0h-Sa.js → TitleEditor-CvGTprIg.js} +46 -45
  23. package/dist/{TplModal-tjQ7OB0g.js → TplModal-BtKB-0Bx.js} +14 -13
  24. package/dist/{blockTypeIcons-DdB3uTKD.js → blockTypeIcons-BxEbbev5.js} +2 -2
  25. package/dist/bundle-stats.json +8 -8
  26. package/dist/cdn/chunks/{AiFeatureMenu-D7rB2SBs.js → AiFeatureMenu-fDUpv_-s.js} +5 -5
  27. package/dist/cdn/chunks/{AiFeatureMenu-D7rB2SBs.js.map → AiFeatureMenu-fDUpv_-s.js.map} +1 -1
  28. package/dist/cdn/chunks/{BlockIssueBadge-DHOe0pgx.js → BlockIssueBadge-Byce0j0W.js} +3 -3
  29. package/dist/cdn/chunks/{BlockIssueBadge-DHOe0pgx.js.map → BlockIssueBadge-Byce0j0W.js.map} +1 -1
  30. package/dist/cdn/chunks/{CloudEditor-DNed_Ym0.js → CloudEditor-B4m8ldiE.js} +89 -89
  31. package/dist/cdn/chunks/{CloudEditor-DNed_Ym0.js.map → CloudEditor-B4m8ldiE.js.map} +1 -1
  32. package/dist/cdn/chunks/{CollaboratorBar-sj_9Lee3.js → CollaboratorBar-LnLmjxw_.js} +4 -4
  33. package/dist/cdn/chunks/{CollaboratorBar-sj_9Lee3.js.map → CollaboratorBar-LnLmjxw_.js.map} +1 -1
  34. package/dist/cdn/chunks/{CountdownBlock-C1Ikjpn4.js → CountdownBlock-DxTuMRBM.js} +3 -3
  35. package/dist/cdn/chunks/{CountdownBlock-C1Ikjpn4.js.map → CountdownBlock-DxTuMRBM.js.map} +1 -1
  36. package/dist/cdn/chunks/{CountdownToolbar-j1G_X8rB.js → CountdownToolbar-DUrVfQZH.js} +4 -4
  37. package/dist/cdn/chunks/{CountdownToolbar-j1G_X8rB.js.map → CountdownToolbar-DUrVfQZH.js.map} +1 -1
  38. package/dist/cdn/chunks/{IssuesPanel-CTOf3PsH.js → IssuesPanel-CHl90k4h.js} +4 -4
  39. package/dist/cdn/chunks/{IssuesPanel-CTOf3PsH.js.map → IssuesPanel-CHl90k4h.js.map} +1 -1
  40. package/dist/cdn/chunks/MergeTagSuggestion-BsCAo4Co.js +213 -0
  41. package/dist/cdn/chunks/MergeTagSuggestion-BsCAo4Co.js.map +1 -0
  42. package/dist/cdn/chunks/{ModuleBrowserModal-DCh88-rr.js → ModuleBrowserModal-DW0iQW0J.js} +6 -6
  43. package/dist/cdn/chunks/{ModuleBrowserModal-DCh88-rr.js.map → ModuleBrowserModal-DW0iQW0J.js.map} +1 -1
  44. package/dist/cdn/chunks/{ModulePreviewCanvas-DJqvTKmg.js → ModulePreviewCanvas-Cxo8v8t1.js} +3 -3
  45. package/dist/cdn/chunks/{ModulePreviewCanvas-DJqvTKmg.js.map → ModulePreviewCanvas-Cxo8v8t1.js.map} +1 -1
  46. package/dist/cdn/chunks/{NumberWithSuffix-Bu45XWSl.js → NumberWithSuffix-CnSRmUMK.js} +6 -6
  47. package/dist/cdn/chunks/{NumberWithSuffix-Bu45XWSl.js.map → NumberWithSuffix-CnSRmUMK.js.map} +1 -1
  48. package/dist/cdn/chunks/{ParagraphEditor-DwZqLJp2.js → ParagraphEditor-iG5cDjH0.js} +25 -23
  49. package/dist/cdn/chunks/{ParagraphEditor-DwZqLJp2.js.map → ParagraphEditor-iG5cDjH0.js.map} +1 -1
  50. package/dist/cdn/chunks/{RichTextEditorContent-CIuZ-2DV.js → RichTextEditorContent-DQpgeGMj.js} +4 -4
  51. package/dist/cdn/chunks/{RichTextEditorContent-CIuZ-2DV.js.map → RichTextEditorContent-DQpgeGMj.js.map} +1 -1
  52. package/dist/cdn/chunks/{SaveModuleDialog-Bep0X2s_.js → SaveModuleDialog-sJQXg2Mh.js} +3 -3
  53. package/dist/cdn/chunks/{SaveModuleDialog-Bep0X2s_.js.map → SaveModuleDialog-sJQXg2Mh.js.map} +1 -1
  54. package/dist/cdn/chunks/{TitleEditor-DO1-h3RY.js → TitleEditor-C8qIn9Oi.js} +12 -11
  55. package/dist/cdn/chunks/TitleEditor-C8qIn9Oi.js.map +1 -0
  56. package/dist/cdn/chunks/{blockTypeIcons-8o24HVJu.js → blockTypeIcons-DySnOpPo.js} +3 -3
  57. package/dist/cdn/chunks/{blockTypeIcons-8o24HVJu.js.map → blockTypeIcons-DySnOpPo.js.map} +1 -1
  58. package/dist/cdn/chunks/{draggable-kPCz_3zM.js → draggable-kG-D5Xsm.js} +6 -6
  59. package/dist/cdn/chunks/draggable-kG-D5Xsm.js.map +1 -0
  60. package/dist/cdn/chunks/extensions-C2pTX899.js +421 -0
  61. package/dist/cdn/chunks/extensions-C2pTX899.js.map +1 -0
  62. package/dist/cdn/chunks/{features-CkTMVylx.js → features-CHE3YjQE.js} +886 -837
  63. package/dist/cdn/chunks/features-CHE3YjQE.js.map +1 -0
  64. package/dist/cdn/chunks/{icons-9zjCuoJx.js → icons-M4uqBV-_.js} +26 -26
  65. package/dist/cdn/chunks/{icons-9zjCuoJx.js.map → icons-M4uqBV-_.js.map} +1 -1
  66. package/dist/cdn/chunks/{liquid.browser-DKKBzRQu.js → liquid.browser-BJOEu6Cg.js} +693 -678
  67. package/dist/cdn/chunks/liquid.browser-BJOEu6Cg.js.map +1 -0
  68. package/dist/cdn/chunks/{media-library-DMRIPx4g.js → media-library-Bqr15VN2.js} +33 -33
  69. package/dist/cdn/chunks/{media-library-DMRIPx4g.js.map → media-library-Bqr15VN2.js.map} +1 -1
  70. package/dist/cdn/chunks/{pusher-CdEqyLwF.js → pusher-CIwiKF8H.js} +4 -4
  71. package/dist/cdn/chunks/{pusher-CdEqyLwF.js.map → pusher-CIwiKF8H.js.map} +1 -1
  72. package/dist/cdn/chunks/{quality-CyeUgs_c.js → quality-DJZ_fqc2.js} +112 -112
  73. package/dist/cdn/chunks/{quality-CyeUgs_c.js.map → quality-DJZ_fqc2.js.map} +1 -1
  74. package/dist/cdn/chunks/{renderer-BIKUEKDD.js → renderer-CyzTR1Vq.js} +20 -20
  75. package/dist/cdn/chunks/renderer-CyzTR1Vq.js.map +1 -0
  76. package/dist/cdn/chunks/{src-pDy_imWG.js → src-q-SBgWx7.js} +5 -5
  77. package/dist/cdn/chunks/{src-pDy_imWG.js.map → src-q-SBgWx7.js.map} +1 -1
  78. package/dist/cdn/chunks/{styles-D4Bd3SCx.js → styles-PWISdaws.js} +1484 -1344
  79. package/dist/cdn/chunks/styles-PWISdaws.js.map +1 -0
  80. package/dist/cdn/chunks/{tiptap-BlLFFU3M.js → tiptap-DF9PEiqH.js} +6859 -6823
  81. package/dist/cdn/chunks/tiptap-DF9PEiqH.js.map +1 -0
  82. package/dist/cdn/editor.css +1 -1
  83. package/dist/cdn/editor.js +35 -35
  84. package/dist/cdn/editor.js.map +1 -1
  85. package/dist/{check-CYJwFmjy.js → check-rl7ok6uJ.js} +1 -1
  86. package/dist/{chevron-down-C5l-DzAA.js → chevron-down-BKe__NOD.js} +1 -1
  87. package/dist/{circle-alert-wf5HUFZY.js → circle-alert-C8xmpMsK.js} +1 -1
  88. package/dist/{clock-Bj0bQw-K.js → clock-BW4JuDCN.js} +1 -1
  89. package/dist/{cloud-CoFDm9YA.js → cloud-BQusL53H.js} +208 -208
  90. package/dist/createLucideIcon-Dx-EjR9r.js +43 -0
  91. package/dist/{dist-CLpPNKy9.js → dist-B5Sov3sS.js} +7 -7
  92. package/dist/dist-BEWiuOMi.js +251 -0
  93. package/dist/{dist-CrQZ_af9.js → dist-BFmE-7hB.js} +2 -2
  94. package/dist/{dist-U5vfDdYI.js → dist-BMoa33wT.js} +2 -2
  95. package/dist/{dist-BctFrpeA.js → dist-BibU4HNl.js} +74 -65
  96. package/dist/{dist-Dd3ibRZm.js → dist-BsCGIDSt.js} +103 -102
  97. package/dist/dist-CNLKj9wa.js +5 -0
  98. package/dist/{dist-BX3gGwL8.js → dist-CNXDNYQn.js} +728 -694
  99. package/dist/{dist-Bn703mnA.js → dist-COG3IdPK.js} +3 -3
  100. package/dist/{dist-B7w6xTU6.js → dist-CQZxDvFw.js} +3 -3
  101. package/dist/{dist-34OcyoK1.js → dist-CRsjOQM-.js} +2 -2
  102. package/dist/dist-CTT6WYJ6.js +134 -0
  103. package/dist/dist-Cqa6aeAJ.js +5 -0
  104. package/dist/{dist-ChMninLH.js → dist-SXJJ2v41.js} +2 -2
  105. package/dist/{dist-CyjyYg52.js → dist-itdjZraK.js} +28 -23
  106. package/dist/extensions-DwaZAqm6.js +423 -0
  107. package/dist/{image-up-x8-WXfsx.js → image-up-BwBCmQ4P.js} +1 -1
  108. package/dist/{info-RS_fGcGi.js → info-TCn7uWR5.js} +1 -1
  109. package/dist/{keys-DgYXDafq.js → keys-Cv8-8GsD.js} +1 -1
  110. package/dist/{liquid.browser-CVjP5Mex.js → liquid.browser-DZLtv26k.js} +692 -677
  111. package/dist/{list-checks-Bf7XdDyv.js → list-checks-CSrOWNgq.js} +1 -1
  112. package/dist/{loader-circle-CLZ0_FvW.js → loader-circle-BLmicnPG.js} +1 -1
  113. package/dist/{message-circle-B-1bN9ab.js → message-circle-C9hHMQCI.js} +1 -1
  114. package/dist/{refresh-cw-CWKWqJYG.js → refresh-cw-D1JQ1LNa.js} +1 -1
  115. package/dist/runtime-dom.esm-bundler-BzuoCyNp.js +523 -0
  116. package/dist/{scan-line-BtK5dEai.js → scan-line-DgijVq9y.js} +1 -1
  117. package/dist/{send-Cn1IUdzh.js → send-DjPdq69F.js} +1 -1
  118. package/dist/{shield-check-CrvMk4Ea.js → shield-check-Bqluu8FS.js} +1 -1
  119. package/dist/{sparkles-CgfjwvnG.js → sparkles-M4azPVSP.js} +1 -1
  120. package/dist/style.css +1 -1
  121. package/dist/styles-B2OrgEnn.js +4164 -0
  122. package/dist/templatical-editor.js +127 -126
  123. package/dist/{text-align-start-C3r_Rnvy.js → text-align-start-CMya5pCQ.js} +11 -11
  124. package/dist/{trash-2-CjERg4x9.js → trash-2-C-81rkLS.js} +1 -1
  125. package/dist/{triangle-alert-Chkny574.js → triangle-alert-BuRWnynk.js} +1 -1
  126. package/dist/{upload-e5kDRkPb.js → upload-CWBIoLd4.js} +1 -1
  127. package/dist/{useAliveFlag-cUQj9rmB.js → useAliveFlag-CECL_OUb.js} +1 -1
  128. package/dist/{useCloudI18n-CYJKqXtI.js → useCloudI18n-AKCy98qD.js} +2 -2
  129. package/dist/{useEditorCore-8JxXDOA4.js → useEditorCore-DJeOXVxQ.js} +1407 -1365
  130. package/dist/{useI18n-BWqM8i78.js → useI18n-C-TDeJBt.js} +2 -2
  131. package/dist/{useMergeTag-NHC4ylza.js → useMergeTag-DSrBY0-2.js} +5 -5
  132. package/dist/usePopoverRoot-DKUDnr55.js +8 -0
  133. package/dist/{vue.runtime.esm-bundler-BPa483TZ.js → vue.runtime.esm-bundler-l0XAqiyv.js} +626 -1147
  134. package/dist/{x-DiPIbccg.js → x-CQSvXnGR.js} +1 -1
  135. package/package.json +26 -26
  136. package/dist/CountdownBlock-DtAokAVw.js +0 -92
  137. package/dist/CountdownToolbar-Dtqgwy0g.js +0 -210
  138. package/dist/cdn/chunks/TitleEditor-DO1-h3RY.js.map +0 -1
  139. package/dist/cdn/chunks/draggable-kPCz_3zM.js.map +0 -1
  140. package/dist/cdn/chunks/extensions-iwBXnEwq.js +0 -605
  141. package/dist/cdn/chunks/extensions-iwBXnEwq.js.map +0 -1
  142. package/dist/cdn/chunks/features-CkTMVylx.js.map +0 -1
  143. package/dist/cdn/chunks/liquid.browser-DKKBzRQu.js.map +0 -1
  144. package/dist/cdn/chunks/renderer-BIKUEKDD.js.map +0 -1
  145. package/dist/cdn/chunks/styles-D4Bd3SCx.js.map +0 -1
  146. package/dist/cdn/chunks/tiptap-BlLFFU3M.js.map +0 -1
  147. package/dist/createLucideIcon-Bad2kKE0.js +0 -43
  148. package/dist/dist-CADDCv0o.js +0 -5
  149. package/dist/dist-CGvz7vkq.js +0 -5
  150. package/dist/dist-DuCzdgDA.js +0 -382
  151. package/dist/extensions-J439b7y7.js +0 -1720
  152. package/dist/styles-BUwDOWd3.js +0 -4022
  153. package/dist/usePopoverRoot-B1sdY4es.js +0 -8
@@ -1,5 +1,5 @@
1
- import { J as e, L as t, X as n, Y as r, d as i, q as a } from "./vue.runtime.esm-bundler-BPa483TZ.js";
2
- import { d as o, i as s } from "./dist-BctFrpeA.js";
1
+ import { I as e, J as t, K as n, Y as r, q as i, s as a } from "./vue.runtime.esm-bundler-l0XAqiyv.js";
2
+ import { d as o, i as s } from "./dist-BibU4HNl.js";
3
3
  //#region ../core/dist/cloud/index.js
4
4
  var c = class e {
5
5
  static DEFAULT_BASE_URL = "https://templatical.com";
@@ -52,7 +52,7 @@ var c = class e {
52
52
  return this.accessToken && !this.isTokenExpiringSoon() ? this.accessToken : this.refreshToken();
53
53
  }
54
54
  isTokenExpiringSoon() {
55
- return this.expiresAt ? this.expiresAt.getTime() - Date.now() < e.REFRESH_THRESHOLD_MS : !0;
55
+ return !this.expiresAt || this.expiresAt.getTime() - Date.now() < e.REFRESH_THRESHOLD_MS;
56
56
  }
57
57
  async refreshToken() {
58
58
  if (this.refreshPromise) return this.refreshPromise;
@@ -434,10 +434,10 @@ function b(e, t) {
434
434
  function x(e) {
435
435
  return e === "1" ? 1 : e === "3" ? 3 : 2;
436
436
  }
437
- function S(t) {
438
- let n = new _(t.authManager), a = e({
437
+ function S(e) {
438
+ let n = new _(e.authManager), r = i({
439
439
  template: null,
440
- content: o(t.defaultFontFamily, t.templateDefaults),
440
+ content: o(e.defaultFontFamily, e.templateDefaults),
441
441
  selectedBlockId: null,
442
442
  viewport: "desktop",
443
443
  darkMode: !1,
@@ -446,13 +446,13 @@ function S(t) {
446
446
  isSaving: !1,
447
447
  isLoading: !1,
448
448
  uiTheme: "auto"
449
- }), c = i({
450
- get: () => a.content,
449
+ }), c = a({
450
+ get: () => r.content,
451
451
  set: (e) => {
452
- a.content = e, a.isDirty = !0;
452
+ r.content = e, r.isDirty = !0;
453
453
  }
454
- }), l = i(() => a.selectedBlockId ? d(a.content.blocks, a.selectedBlockId) : null), u = i(() => {
455
- let e = /* @__PURE__ */ new Set(), t = a.template?.content?.blocks;
454
+ }), l = a(() => r.selectedBlockId ? d(r.content.blocks, r.selectedBlockId) : null), u = a(() => {
455
+ let e = /* @__PURE__ */ new Set(), t = r.template?.content?.blocks;
456
456
  if (!t) return e;
457
457
  for (let n of t) if (e.add(n.id), n.type === "section") for (let t of n.children) for (let n of t) e.add(n.id);
458
458
  return e;
@@ -482,121 +482,121 @@ function S(t) {
482
482
  }
483
483
  return null;
484
484
  }
485
- function p(e) {
486
- return t.lockedBlocks?.value.has(e) ?? !1;
485
+ function p(t) {
486
+ return e.lockedBlocks?.value.has(t) ?? !1;
487
487
  }
488
488
  function m(e, t = !0) {
489
- a.content = e, t && (a.isDirty = !0);
489
+ r.content = e, t && (r.isDirty = !0);
490
490
  }
491
491
  function h(e) {
492
- e && p(e) || (a.selectedBlockId = e);
492
+ e && p(e) || (r.selectedBlockId = e);
493
493
  }
494
494
  function g(e) {
495
- a.viewport = e;
495
+ r.viewport = e;
496
496
  }
497
497
  function v(e) {
498
- a.darkMode = e;
498
+ r.darkMode = e;
499
499
  }
500
500
  function y(e) {
501
- a.uiTheme = e;
501
+ r.uiTheme = e;
502
502
  }
503
503
  function b(e) {
504
- a.previewMode = e, e && (a.selectedBlockId = null);
504
+ r.previewMode = e, e && (r.selectedBlockId = null);
505
505
  }
506
506
  function S(e, t) {
507
507
  if (p(e)) return;
508
- let n = d(a.content.blocks, e);
509
- n && (Object.assign(n, t), a.isDirty = !0);
508
+ let n = d(r.content.blocks, e);
509
+ n && (Object.assign(n, t), r.isDirty = !0);
510
510
  }
511
511
  function C(e) {
512
- a.content.settings = {
513
- ...a.content.settings,
512
+ r.content.settings = {
513
+ ...r.content.settings,
514
514
  ...e
515
- }, a.isDirty = !0;
515
+ }, r.isDirty = !0;
516
516
  }
517
- function w(e, t, n = 0, r) {
517
+ function w(e, t, n = 0, i) {
518
518
  if (t) {
519
- let i = d(a.content.blocks, t);
520
- if (i && i.type === "section") {
521
- i.children[n] = i.children[n] || [];
522
- let t = i.children[n];
523
- r !== void 0 && r < t.length ? t.splice(r, 0, e) : t.push(e);
519
+ let a = d(r.content.blocks, t);
520
+ if (a && a.type === "section") {
521
+ a.children[n] = a.children[n] || [];
522
+ let t = a.children[n];
523
+ i !== void 0 && i < t.length ? t.splice(i, 0, e) : t.push(e);
524
524
  }
525
- } else r !== void 0 && r < a.content.blocks.length ? a.content.blocks.splice(r, 0, e) : a.content.blocks.push(e);
526
- a.isDirty = !0;
525
+ } else i !== void 0 && i < r.content.blocks.length ? r.content.blocks.splice(i, 0, e) : r.content.blocks.push(e);
526
+ r.isDirty = !0;
527
527
  }
528
528
  function T(e) {
529
529
  if (p(e)) return;
530
- let t = f(a.content.blocks, e);
530
+ let t = f(r.content.blocks, e);
531
531
  if (t) {
532
532
  let n = t.blocks.findIndex((t) => t.id === e);
533
- n !== -1 && (t.blocks.splice(n, 1), a.selectedBlockId === e && (a.selectedBlockId = null), a.isDirty = !0);
533
+ n !== -1 && (t.blocks.splice(n, 1), r.selectedBlockId === e && (r.selectedBlockId = null), r.isDirty = !0);
534
534
  }
535
535
  }
536
- function E(e, t, n, r = 0) {
537
- let i = f(a.content.blocks, e);
538
- if (!i) return;
539
- let o = i.blocks.findIndex((t) => t.id === e);
536
+ function E(e, t, n, i = 0) {
537
+ let a = f(r.content.blocks, e);
538
+ if (!a) return;
539
+ let o = a.blocks.findIndex((t) => t.id === e);
540
540
  if (o === -1) return;
541
541
  let s;
542
542
  if (n) {
543
- let e = d(a.content.blocks, n);
544
- if (!e || e.type !== "section" || r < 0 || r >= x(e.columns)) return;
545
- e.children[r] = e.children[r] || [], s = e.children[r];
546
- } else s = a.content.blocks;
547
- let [c] = i.blocks.splice(o, 1);
548
- s.splice(t, 0, c), a.isDirty = !0;
549
- }
550
- async function D(e) {
551
- a.isLoading = !0;
543
+ let e = d(r.content.blocks, n);
544
+ if (!e || e.type !== "section" || i < 0 || i >= x(e.columns)) return;
545
+ e.children[i] = e.children[i] || [], s = e.children[i];
546
+ } else s = r.content.blocks;
547
+ let [c] = a.blocks.splice(o, 1);
548
+ s.splice(t, 0, c), r.isDirty = !0;
549
+ }
550
+ async function D(t) {
551
+ r.isLoading = !0;
552
552
  try {
553
- e && (a.content = e);
554
- let t = await n.createTemplate(a.content);
555
- return a.template = t, a.isDirty = !1, t;
556
- } catch (e) {
557
- throw t.onError?.(e), e;
553
+ t && (r.content = t);
554
+ let e = await n.createTemplate(r.content);
555
+ return r.template = e, r.isDirty = !1, e;
556
+ } catch (t) {
557
+ throw e.onError?.(t), t;
558
558
  } finally {
559
- a.isLoading = !1;
559
+ r.isLoading = !1;
560
560
  }
561
561
  }
562
- async function O(e) {
563
- a.isLoading = !0;
562
+ async function O(t) {
563
+ r.isLoading = !0;
564
564
  try {
565
- let t = await n.getTemplate(e);
566
- return a.template = t, a.content = t.content, a.isDirty = !1, t;
567
- } catch (e) {
568
- throw t.onError?.(e), e;
565
+ let e = await n.getTemplate(t);
566
+ return r.template = e, r.content = e.content, r.isDirty = !1, e;
567
+ } catch (t) {
568
+ throw e.onError?.(t), t;
569
569
  } finally {
570
- a.isLoading = !1;
570
+ r.isLoading = !1;
571
571
  }
572
572
  }
573
573
  async function k() {
574
- if (!a.template?.id) throw new s("No template loaded. Call create() or load() before saving.");
575
- a.isSaving = !0;
574
+ if (!r.template?.id) throw new s("No template loaded. Call create() or load() before saving.");
575
+ r.isSaving = !0;
576
576
  try {
577
- let e = await n.updateTemplate(a.template.id, a.content);
578
- return a.template = e, a.isDirty = !1, e;
579
- } catch (e) {
580
- throw t.onError?.(e), e;
577
+ let e = await n.updateTemplate(r.template.id, r.content);
578
+ return r.template = e, r.isDirty = !1, e;
579
+ } catch (t) {
580
+ throw e.onError?.(t), t;
581
581
  } finally {
582
- a.isSaving = !1;
582
+ r.isSaving = !1;
583
583
  }
584
584
  }
585
585
  async function A() {
586
- if (a.template?.id) try {
587
- await n.createSnapshot(a.template.id, a.content);
588
- } catch (e) {
589
- throw t.onError?.(e), e;
586
+ if (r.template?.id) try {
587
+ await n.createSnapshot(r.template.id, r.content);
588
+ } catch (t) {
589
+ throw e.onError?.(t), t;
590
590
  }
591
591
  }
592
592
  function j() {
593
- return a.template?.id !== void 0;
593
+ return r.template?.id !== void 0;
594
594
  }
595
595
  function M() {
596
- a.isDirty = !0;
596
+ r.isDirty = !0;
597
597
  }
598
598
  function N(e) {
599
- let t = f(a.content.blocks, e);
599
+ let t = f(r.content.blocks, e);
600
600
  if (!t) return null;
601
601
  let n = t.blocks.findIndex((t) => t.id === e);
602
602
  return n === -1 ? null : {
@@ -606,7 +606,7 @@ function S(t) {
606
606
  };
607
607
  }
608
608
  return {
609
- state: r(a),
609
+ state: t(r),
610
610
  content: c,
611
611
  selectedBlock: l,
612
612
  savedBlockIds: u,
@@ -636,7 +636,7 @@ function w() {
636
636
  return `msg_${Date.now()}_${++C}`;
637
637
  }
638
638
  function T(e) {
639
- let { authManager: t, getTemplateId: r, onApply: i, onError: a } = e, o = n([]), s = n(!1), c = n(!1), u = n(null), d = n(null), f = n(null), p = n(null), m = n(null), h = n(null), _ = n(!1), v = n([]), y = n(!1);
639
+ let { authManager: t, getTemplateId: n, onApply: i, onError: a } = e, o = r([]), s = r(!1), c = r(!1), u = r(null), d = r(null), f = r(null), p = r(null), m = r(null), h = r(null), _ = r(!1), v = r([]), y = r(!1);
640
640
  function b(e, t) {
641
641
  let n = o.value.findIndex((t) => t.id === e);
642
642
  if (n === -1) return;
@@ -651,7 +651,7 @@ function T(e) {
651
651
  ];
652
652
  }
653
653
  async function x() {
654
- let e = r();
654
+ let e = n();
655
655
  if (e) {
656
656
  c.value = !0;
657
657
  try {
@@ -676,16 +676,16 @@ function T(e) {
676
676
  }
677
677
  }
678
678
  }
679
- async function S(e, n) {
680
- let i = r();
679
+ async function S(e, r) {
680
+ let i = n();
681
681
  if (i) {
682
682
  y.value = !0;
683
683
  try {
684
- let r = l(g["ai.suggestions"], {
684
+ let n = l(g["ai.suggestions"], {
685
685
  project: t.projectId,
686
686
  tenant: t.tenantSlug,
687
687
  template: i
688
- }), a = await t.authenticatedFetch(r, {
688
+ }), a = await t.authenticatedFetch(n, {
689
689
  method: "POST",
690
690
  headers: {
691
691
  "Content-Type": "application/json",
@@ -693,7 +693,7 @@ function T(e) {
693
693
  },
694
694
  body: JSON.stringify({
695
695
  current_content: e,
696
- merge_tags: n.map((e) => ({
696
+ merge_tags: r.map((e) => ({
697
697
  label: e.label,
698
698
  value: e.value
699
699
  }))
@@ -725,8 +725,8 @@ function T(e) {
725
725
  }
726
726
  }
727
727
  }
728
- async function C(e, n, c) {
729
- let y = r();
728
+ async function C(e, r, c) {
729
+ let y = n();
730
730
  if (!y) throw Error("Template must be saved before using AI generation");
731
731
  s.value = !0, u.value = null, d.value = null, v.value = [];
732
732
  let x = w();
@@ -744,11 +744,11 @@ function T(e) {
744
744
  timestamp: Date.now()
745
745
  }];
746
746
  try {
747
- let r = l(g["ai.generate"], {
747
+ let n = l(g["ai.generate"], {
748
748
  project: t.projectId,
749
749
  tenant: t.tenantSlug,
750
750
  template: y
751
- }), a = await t.authenticatedFetch(r, {
751
+ }), a = await t.authenticatedFetch(n, {
752
752
  method: "POST",
753
753
  headers: {
754
754
  "Content-Type": "application/json",
@@ -756,7 +756,7 @@ function T(e) {
756
756
  },
757
757
  body: JSON.stringify({
758
758
  prompt: e,
759
- current_content: n,
759
+ current_content: r,
760
760
  merge_tags: c.map((e) => ({
761
761
  label: e.label,
762
762
  value: e.value
@@ -776,19 +776,19 @@ function T(e) {
776
776
  let { done: e, value: t } = await s.read();
777
777
  if (e) break;
778
778
  v += d.decode(t, { stream: !0 });
779
- let r = v.split("\n");
780
- v = r.pop() ?? "";
781
- for (let e of r) {
779
+ let n = v.split("\n");
780
+ v = n.pop() ?? "";
781
+ for (let e of n) {
782
782
  if (!e.startsWith("data: ")) continue;
783
- let t = e.slice(6), r;
783
+ let t = e.slice(6), n;
784
784
  try {
785
- r = JSON.parse(t);
785
+ n = JSON.parse(t);
786
786
  } catch {
787
787
  continue;
788
788
  }
789
- if (r.type === "text") b(S, { content: (o.value.find((e) => e.id === S)?.content ?? "") + r.text });
790
- else if (r.type === "error") throw Error(r.message || "Failed to generate template");
791
- else r.type === "done" && (r.conversation_id && (f.value = r.conversation_id), b(S, { content: r.text }), x = r.content ?? null, x ? (m.value = n, h.value = x, p.value = S, _.value = !1, i?.(x)) : u.value = "ai_apply_failed");
789
+ if (n.type === "text") b(S, { content: (o.value.find((e) => e.id === S)?.content ?? "") + n.text });
790
+ else if (n.type === "error") throw Error(n.message || "Failed to generate template");
791
+ else n.type === "done" && (n.conversation_id && (f.value = n.conversation_id), b(S, { content: n.text }), x = n.content ?? null, x ? (m.value = r, h.value = x, p.value = S, _.value = !1, i?.(x)) : u.value = "ai_apply_failed");
792
792
  }
793
793
  }
794
794
  } finally {
@@ -827,25 +827,25 @@ function T(e) {
827
827
  }
828
828
  function E(e) {
829
829
  function t(t) {
830
- return e === !1 ? !1 : e?.[t] !== !1;
830
+ return e !== !1 && e?.[t] !== !1;
831
831
  }
832
832
  return {
833
833
  isFeatureEnabled: t,
834
- hasAnyMenuFeature: i(() => t("chat") || t("scoring") || t("designToTemplate"))
834
+ hasAnyMenuFeature: a(() => t("chat") || t("scoring") || t("designToTemplate"))
835
835
  };
836
836
  }
837
837
  function D(e) {
838
- let { authManager: t, getTemplateId: r } = e, i = n(!1), a = n(null), o = n(null), s = n(null), c = n(""), u = n(null);
839
- async function d(e, n) {
840
- let s = r();
838
+ let { authManager: t, getTemplateId: n } = e, i = r(!1), a = r(null), o = r(null), s = r(null), c = r(""), u = r(null);
839
+ async function d(e, r) {
840
+ let s = n();
841
841
  if (!s) return null;
842
842
  i.value = !0, o.value = null, a.value = null;
843
843
  try {
844
- let r = l(g["ai.score"], {
844
+ let n = l(g["ai.score"], {
845
845
  project: t.projectId,
846
846
  tenant: t.tenantSlug,
847
847
  template: s
848
- }), i = await t.authenticatedFetch(r, {
848
+ }), i = await t.authenticatedFetch(n, {
849
849
  method: "POST",
850
850
  headers: {
851
851
  "Content-Type": "application/json",
@@ -853,7 +853,7 @@ function D(e) {
853
853
  },
854
854
  body: JSON.stringify({
855
855
  current_content: e,
856
- merge_tags: n.map((e) => ({
856
+ merge_tags: r.map((e) => ({
857
857
  label: e.label,
858
858
  value: e.value
859
859
  }))
@@ -893,16 +893,16 @@ function D(e) {
893
893
  i.value = !1;
894
894
  }
895
895
  }
896
- async function f(e, n, i) {
897
- let a = r();
896
+ async function f(e, r, i) {
897
+ let a = n();
898
898
  if (!a) return null;
899
- s.value = n.id, c.value = "", u.value = null;
899
+ s.value = r.id, c.value = "", u.value = null;
900
900
  try {
901
- let r = l(g["ai.fixFinding"], {
901
+ let n = l(g["ai.fixFinding"], {
902
902
  project: t.projectId,
903
903
  tenant: t.tenantSlug,
904
904
  template: a
905
- }), o = await t.authenticatedFetch(r, {
905
+ }), o = await t.authenticatedFetch(n, {
906
906
  method: "POST",
907
907
  headers: {
908
908
  "Content-Type": "application/json",
@@ -911,10 +911,10 @@ function D(e) {
911
911
  body: JSON.stringify({
912
912
  content: e,
913
913
  finding: {
914
- id: n.id,
915
- message: n.message,
916
- suggestion: n.suggestion,
917
- category: n.category
914
+ id: r.id,
915
+ message: r.message,
916
+ suggestion: r.suggestion,
917
+ category: r.category
918
918
  },
919
919
  merge_tags: i.map((e) => ({
920
920
  label: e.label,
@@ -978,22 +978,22 @@ function D(e) {
978
978
  };
979
979
  }
980
980
  function O(e) {
981
- let { authManager: t, getTemplateId: r, onApply: i, onError: a } = e, o = n(!1), s = n(null);
981
+ let { authManager: t, getTemplateId: n, onApply: i, onError: a } = e, o = r(!1), s = r(null);
982
982
  async function c(e) {
983
- let n = r();
984
- if (!n) throw Error("Template must be saved before using design reference");
983
+ let r = n();
984
+ if (!r) throw Error("Template must be saved before using design reference");
985
985
  o.value = !0, s.value = null;
986
986
  try {
987
- let r = new FormData();
988
- e.prompt && r.append("prompt", e.prompt), e.imageUpload && r.append("image_upload", e.imageUpload), e.pdfUpload && r.append("pdf_upload", e.pdfUpload);
987
+ let n = new FormData();
988
+ e.prompt && n.append("prompt", e.prompt), e.imageUpload && n.append("image_upload", e.imageUpload), e.pdfUpload && n.append("pdf_upload", e.pdfUpload);
989
989
  let a = l(g["ai.generateFromDesign"], {
990
990
  project: t.projectId,
991
991
  tenant: t.tenantSlug,
992
- template: n
992
+ template: r
993
993
  }), o = await t.authenticatedFetch(a, {
994
994
  method: "POST",
995
995
  headers: { Accept: "text/event-stream" },
996
- body: r
996
+ body: n
997
997
  });
998
998
  if (!o.ok) {
999
999
  let e = await o.json().catch(() => null);
@@ -1039,11 +1039,11 @@ function O(e) {
1039
1039
  };
1040
1040
  }
1041
1041
  function k(e) {
1042
- let { authManager: t, getTemplateId: r, getSocketId: a, onComment: o, onError: s, hasCommentingFeature: c } = e, l = new _(t), u = n([]), d = n(!1), f = n(!1), p = i(() => (c?.() ?? !1) && t.userConfig !== null), m = i(() => {
1042
+ let { authManager: t, getTemplateId: n, getSocketId: i, onComment: o, onError: s, hasCommentingFeature: c } = e, l = new _(t), u = r([]), d = r(!1), f = r(!1), p = a(() => (c?.() ?? !1) && t.userConfig !== null), m = a(() => {
1043
1043
  let e = 0;
1044
1044
  for (let t of u.value) e += 1 + (t.replies?.length ?? 0);
1045
1045
  return e;
1046
- }), h = i(() => u.value.filter((e) => !e.resolved_at).length), g = i(() => {
1046
+ }), h = a(() => u.value.filter((e) => !e.resolved_at).length), g = a(() => {
1047
1047
  let e = /* @__PURE__ */ new Map();
1048
1048
  for (let t of u.value) t.block_id && e.set(t.block_id, (e.get(t.block_id) ?? 0) + 1 + (t.replies?.length ?? 0));
1049
1049
  return e;
@@ -1058,7 +1058,7 @@ function k(e) {
1058
1058
  };
1059
1059
  }
1060
1060
  function y() {
1061
- let e = a?.();
1061
+ let e = i?.();
1062
1062
  if (e) return { "X-Socket-ID": e };
1063
1063
  }
1064
1064
  function b(e, t) {
@@ -1075,7 +1075,7 @@ function k(e) {
1075
1075
  return null;
1076
1076
  }
1077
1077
  async function S() {
1078
- let e = r();
1078
+ let e = n();
1079
1079
  if (e) {
1080
1080
  d.value = !0;
1081
1081
  try {
@@ -1088,22 +1088,22 @@ function k(e) {
1088
1088
  }
1089
1089
  }
1090
1090
  }
1091
- async function C(e, t, n) {
1092
- let i = r();
1091
+ async function C(e, t, r) {
1092
+ let i = n();
1093
1093
  if (!i) return null;
1094
1094
  f.value = !0;
1095
1095
  try {
1096
- let r = await l.createComment(i, {
1096
+ let n = await l.createComment(i, {
1097
1097
  body: e,
1098
1098
  block_id: t,
1099
- parent_id: n,
1099
+ parent_id: r,
1100
1100
  ...v()
1101
1101
  }, y());
1102
- if (n) {
1103
- let e = x(n);
1104
- e && (e.replies = [...e.replies ?? [], r]);
1105
- } else u.value = [...u.value, r];
1106
- return b("created", r), r;
1102
+ if (r) {
1103
+ let e = x(r);
1104
+ e && (e.replies = [...e.replies ?? [], n]);
1105
+ } else u.value = [...u.value, n];
1106
+ return b("created", n), n;
1107
1107
  } catch (e) {
1108
1108
  let t = e instanceof Error ? e : Error("Failed to create comment", { cause: e });
1109
1109
  return s?.(t), null;
@@ -1112,15 +1112,15 @@ function k(e) {
1112
1112
  }
1113
1113
  }
1114
1114
  async function w(e, t) {
1115
- let n = r();
1116
- if (!n) return null;
1115
+ let r = n();
1116
+ if (!r) return null;
1117
1117
  f.value = !0;
1118
1118
  try {
1119
- let r = await l.updateComment(n, e, {
1119
+ let n = await l.updateComment(r, e, {
1120
1120
  body: t,
1121
1121
  ...v()
1122
1122
  }, y());
1123
- return A(e, r), b("updated", r), r;
1123
+ return A(e, n), b("updated", n), n;
1124
1124
  } catch (e) {
1125
1125
  let t = e instanceof Error ? e : Error("Failed to update comment", { cause: e });
1126
1126
  return s?.(t), null;
@@ -1129,18 +1129,18 @@ function k(e) {
1129
1129
  }
1130
1130
  }
1131
1131
  async function T(e) {
1132
- let t = r();
1132
+ let t = n();
1133
1133
  if (!t) return !1;
1134
- let n = x(e);
1135
- if (!n) return !1;
1134
+ let r = x(e);
1135
+ if (!r) return !1;
1136
1136
  let i = {
1137
- ...n,
1138
- replies: [...n.replies ?? []]
1137
+ ...r,
1138
+ replies: [...r.replies ?? []]
1139
1139
  };
1140
1140
  f.value = !0;
1141
1141
  try {
1142
- if (await l.deleteComment(t, e, v(), y()), n.parent_id) {
1143
- let t = x(n.parent_id);
1142
+ if (await l.deleteComment(t, e, v(), y()), r.parent_id) {
1143
+ let t = x(r.parent_id);
1144
1144
  t && (t.replies = (t.replies ?? []).filter((t) => t.id !== e));
1145
1145
  } else u.value = u.value.filter((t) => t.id !== e);
1146
1146
  return b("deleted", i), !0;
@@ -1152,7 +1152,7 @@ function k(e) {
1152
1152
  }
1153
1153
  }
1154
1154
  async function E(e) {
1155
- let t = r();
1155
+ let t = n();
1156
1156
  if (!t) return null;
1157
1157
  f.value = !0;
1158
1158
  try {
@@ -1236,14 +1236,14 @@ function k(e) {
1236
1236
  applyRemoteDelete: k
1237
1237
  };
1238
1238
  }
1239
- function A(e) {
1240
- let { comments: n, channel: r } = e;
1241
- t(r, (e, t) => {
1239
+ function A(t) {
1240
+ let { comments: r, channel: i } = t;
1241
+ e(i, (e, t) => {
1242
1242
  t && t.unbind("comment-broadcast"), e && e.bind("comment-broadcast", (e) => {
1243
- j(n, e);
1243
+ j(r, e);
1244
1244
  });
1245
- }), a(() => {
1246
- r.value?.unbind("comment-broadcast");
1245
+ }), n(() => {
1246
+ i.value?.unbind("comment-broadcast");
1247
1247
  });
1248
1248
  }
1249
1249
  function j(e, t) {
@@ -1286,8 +1286,8 @@ var P = [
1286
1286
  "#6366f1",
1287
1287
  "#14b8a6"
1288
1288
  ];
1289
- function F(e) {
1290
- let { authManager: r, editor: o, channel: s } = e, c = n([]), l = n(/* @__PURE__ */ new Map()), u = 0, d = !1, f = i(() => r.userConfig?.id ?? "");
1289
+ function F(t) {
1290
+ let { authManager: i, editor: o, channel: s } = t, c = r([]), l = r(/* @__PURE__ */ new Map()), u = 0, d = !1, f = a(() => i.userConfig?.id ?? "");
1291
1291
  function p() {
1292
1292
  let e = P[u % P.length];
1293
1293
  return u++, e;
@@ -1348,41 +1348,41 @@ function F(e) {
1348
1348
  function S(e) {
1349
1349
  s.value && s.value.trigger("client-block_unlocked", { blockId: e });
1350
1350
  }
1351
- return t(() => o.state.selectedBlockId, (e, t) => {
1351
+ return e(() => o.state.selectedBlockId, (e, t) => {
1352
1352
  d || (t && S(t), e && x(e));
1353
- }), t(s, (t, n) => {
1354
- if (n && N(n), !t) {
1353
+ }), e(s, (e, n) => {
1354
+ if (n && N(n), !e) {
1355
1355
  c.value = [], l.value = /* @__PURE__ */ new Map(), u = 0;
1356
1356
  return;
1357
1357
  }
1358
- let r = t.members;
1358
+ let r = e.members;
1359
1359
  r && r.each((e) => {
1360
1360
  m(e.info);
1361
- }), t.bind("pusher:member_added", (t) => {
1362
- let n = m(t.info);
1363
- n && e.onCollaboratorJoined?.(n);
1364
- }), t.bind("pusher:member_removed", (t) => {
1365
- let n = c.value.find((e) => e.id === t.id);
1366
- h(t.id), n && e.onCollaboratorLeft?.(n);
1367
- }), t.bind("client-block_locked", (t) => {
1368
- g(t);
1369
- let n = c.value.find((e) => e.id === t.userId);
1370
- n && e.onBlockLocked?.({
1371
- blockId: t.blockId,
1361
+ }), e.bind("pusher:member_added", (e) => {
1362
+ let n = m(e.info);
1363
+ n && t.onCollaboratorJoined?.(n);
1364
+ }), e.bind("pusher:member_removed", (e) => {
1365
+ let n = c.value.find((t) => t.id === e.id);
1366
+ h(e.id), n && t.onCollaboratorLeft?.(n);
1367
+ }), e.bind("client-block_locked", (e) => {
1368
+ g(e);
1369
+ let n = c.value.find((t) => t.id === e.userId);
1370
+ n && t.onBlockLocked?.({
1371
+ blockId: e.blockId,
1372
1372
  collaborator: n
1373
1373
  });
1374
- }), t.bind("client-block_unlocked", (t) => {
1375
- let n = l.value.get(t.blockId);
1376
- _(t), n && e.onBlockUnlocked?.({
1377
- blockId: t.blockId,
1374
+ }), e.bind("client-block_unlocked", (e) => {
1375
+ let n = l.value.get(e.blockId);
1376
+ _(e), n && t.onBlockUnlocked?.({
1377
+ blockId: e.blockId,
1378
1378
  collaborator: n
1379
1379
  });
1380
- }), t.bind("client-operation", (e) => {
1380
+ }), e.bind("client-operation", (e) => {
1381
1381
  v(e);
1382
- }), t.bind("mcp-operation", (e) => {
1382
+ }), e.bind("mcp-operation", (e) => {
1383
1383
  v(e);
1384
1384
  });
1385
- }), a(() => {
1385
+ }), n(() => {
1386
1386
  s.value && N(s.value);
1387
1387
  }), {
1388
1388
  collaborators: c,
@@ -1445,19 +1445,19 @@ function I(e, t) {
1445
1445
  };
1446
1446
  }
1447
1447
  function L(e) {
1448
- let { authManager: t, onError: r } = e, i = n(null), a = n(!1), o = null, s = null;
1449
- async function c(e, n) {
1448
+ let { authManager: t, onError: n } = e, i = r(null), a = r(!1), o = null, s = null;
1449
+ async function c(e, r) {
1450
1450
  if (o) return;
1451
1451
  o = new y({
1452
1452
  authManager: t,
1453
- config: n,
1454
- onError: r
1453
+ config: r,
1454
+ onError: n
1455
1455
  }), await o.connect(), s = `presence-template.${e}`;
1456
1456
  let c = o.subscribePresence(s);
1457
1457
  c.bind("pusher:subscription_succeeded", () => {
1458
1458
  a.value = !0, i.value = c;
1459
1459
  }), c.bind("pusher:subscription_error", (e) => {
1460
- a.value = !1, i.value = null, r?.(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to subscribe to template channel"));
1460
+ a.value = !1, i.value = null, n?.(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to subscribe to template channel"));
1461
1461
  });
1462
1462
  }
1463
1463
  function l() {
@@ -1475,45 +1475,45 @@ function L(e) {
1475
1475
  };
1476
1476
  }
1477
1477
  function R(e) {
1478
- let t = new _(e.authManager), r = n([]), i = n(!1);
1479
- async function a(n) {
1478
+ let t = new _(e.authManager), n = r([]), i = r(!1);
1479
+ async function a(r) {
1480
1480
  i.value = !0;
1481
1481
  try {
1482
- r.value = await t.listModules(n);
1482
+ n.value = await t.listModules(r);
1483
1483
  } catch (t) {
1484
1484
  throw e.onError?.(t), t;
1485
1485
  } finally {
1486
1486
  i.value = !1;
1487
1487
  }
1488
1488
  }
1489
- async function o(n, i) {
1489
+ async function o(r, i) {
1490
1490
  try {
1491
1491
  let e = await t.createModule({
1492
- name: n,
1492
+ name: r,
1493
1493
  content: i
1494
1494
  });
1495
- return r.value = [e, ...r.value], e;
1495
+ return n.value = [e, ...n.value], e;
1496
1496
  } catch (t) {
1497
1497
  throw e.onError?.(t), t;
1498
1498
  }
1499
1499
  }
1500
- async function s(n, i) {
1500
+ async function s(r, i) {
1501
1501
  try {
1502
- let e = await t.updateModule(n, i);
1503
- return r.value = r.value.map((t) => t.id === n ? e : t), e;
1502
+ let e = await t.updateModule(r, i);
1503
+ return n.value = n.value.map((t) => t.id === r ? e : t), e;
1504
1504
  } catch (t) {
1505
1505
  throw e.onError?.(t), t;
1506
1506
  }
1507
1507
  }
1508
- async function c(n) {
1508
+ async function c(r) {
1509
1509
  try {
1510
- await t.deleteModule(n), r.value = r.value.filter((e) => e.id !== n);
1510
+ await t.deleteModule(r), n.value = n.value.filter((e) => e.id !== r);
1511
1511
  } catch (t) {
1512
1512
  throw e.onError?.(t), t;
1513
1513
  }
1514
1514
  }
1515
1515
  return {
1516
- modules: r,
1516
+ modules: n,
1517
1517
  isLoading: i,
1518
1518
  loadModules: a,
1519
1519
  createModule: o,
@@ -1522,11 +1522,11 @@ function R(e) {
1522
1522
  };
1523
1523
  }
1524
1524
  function z(e) {
1525
- let t = new _(e.authManager), r = n([]), i = n(!1), a = n(!1);
1525
+ let t = new _(e.authManager), n = r([]), i = r(!1), a = r(!1);
1526
1526
  async function o() {
1527
1527
  i.value = !0;
1528
1528
  try {
1529
- r.value = await t.getSnapshots(e.templateId);
1529
+ n.value = await t.getSnapshots(e.templateId);
1530
1530
  } catch (t) {
1531
1531
  throw e.onError?.(t), t;
1532
1532
  } finally {
@@ -1545,22 +1545,22 @@ function z(e) {
1545
1545
  }
1546
1546
  }
1547
1547
  return {
1548
- snapshots: r,
1548
+ snapshots: n,
1549
1549
  isLoading: i,
1550
1550
  isRestoring: a,
1551
1551
  loadSnapshots: o,
1552
1552
  restoreSnapshot: s
1553
1553
  };
1554
1554
  }
1555
- function B(e) {
1556
- let { authManager: r, getTemplateId: a, save: o, exportHtml: s, onError: c, isAuthReady: l, onBeforeTestEmail: u } = e, d = new _(r), f = n(!1), p = n(null), m = n(null);
1557
- l && t(l, (e) => {
1558
- e && (m.value = r.testEmailConfig);
1555
+ function B(t) {
1556
+ let { authManager: n, getTemplateId: i, save: o, exportHtml: s, onError: c, isAuthReady: l, onBeforeTestEmail: u } = t, d = new _(n), f = r(!1), p = r(null), m = r(null);
1557
+ l && e(l, (e) => {
1558
+ e && (m.value = n.testEmailConfig);
1559
1559
  }, { immediate: !0 });
1560
- let h = i(() => m.value !== null), g = i(() => m.value?.allowedEmails ?? []);
1560
+ let h = a(() => m.value !== null), g = a(() => m.value?.allowedEmails ?? []);
1561
1561
  async function v(e) {
1562
1562
  if (!m.value) throw Error("Test email is not enabled for this project");
1563
- let t = a();
1563
+ let t = i();
1564
1564
  if (!t) throw Error("Template must be saved before sending a test email");
1565
1565
  f.value = !0, p.value = null;
1566
1566
  try {
@@ -1613,24 +1613,24 @@ function V(e) {
1613
1613
  };
1614
1614
  }
1615
1615
  function H(e) {
1616
- let { authManager: t, onError: r } = e, a = n(null), o = n(!1), s = new _(t), c = i(() => a.value?.features ?? null);
1616
+ let { authManager: t, onError: n } = e, i = r(null), o = r(!1), s = new _(t), c = a(() => i.value?.features ?? null);
1617
1617
  function l(e) {
1618
- return a.value?.features[e] ?? !1;
1618
+ return i.value?.features[e] ?? !1;
1619
1619
  }
1620
1620
  async function u() {
1621
1621
  if (!o.value) {
1622
1622
  o.value = !0;
1623
1623
  try {
1624
- a.value = await s.fetchConfig();
1624
+ i.value = await s.fetchConfig();
1625
1625
  } catch (e) {
1626
- r?.(e instanceof Error ? e : Error("Failed to fetch config", { cause: e }));
1626
+ n?.(e instanceof Error ? e : Error("Failed to fetch config", { cause: e }));
1627
1627
  } finally {
1628
1628
  o.value = !1;
1629
1629
  }
1630
1630
  }
1631
1631
  }
1632
1632
  return {
1633
- config: a,
1633
+ config: i,
1634
1634
  isLoading: o,
1635
1635
  hasFeature: l,
1636
1636
  features: c,
@@ -1738,9 +1738,9 @@ async function q(e = {}) {
1738
1738
  overall: t.api.ok && t.auth.ok
1739
1739
  };
1740
1740
  }
1741
- function J(e) {
1742
- let { editor: n, channel: r, onOperation: i } = e;
1743
- t(r, (e, t) => {
1741
+ function J(t) {
1742
+ let { editor: n, channel: r, onOperation: i } = t;
1743
+ e(r, (e, t) => {
1744
1744
  t && t.unbind("mcp-operation"), e && e.bind("mcp-operation", (e) => {
1745
1745
  b(n, e), i?.(e);
1746
1746
  });