@aswin.dev/editor 0.7.0 → 0.7.2

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 (182) hide show
  1. package/LICENSE +56 -0
  2. package/README.md +3 -3
  3. package/dist/{AccessibilityPanel-CvQGLdu6.js → AccessibilityPanel-EmQ19wiS.js} +37 -37
  4. package/dist/{AiChatSidebar-B3SJIKG_.js → AiChatSidebar-DeB0w_32.js} +67 -81
  5. package/dist/{AiFeatureMenu-BLLKoOos.js → AiFeatureMenu-DoLD5Cde.js} +22 -22
  6. package/dist/{BlockA11yBadge-CXDLqkcJ.js → BlockA11yBadge-DkNbDvJA.js} +12 -12
  7. package/dist/CloudEditor-zo9PjjvY.js +1214 -0
  8. package/dist/{CollaboratorBar-DuPYW5iF.js → CollaboratorBar-BsXMY-8e.js} +21 -21
  9. package/dist/CommentsSidebar-DIWIa4rS.js +436 -0
  10. package/dist/CountdownBlock-BCi7-DAM.js +92 -0
  11. package/dist/CountdownToolbar-BuS8p5ju.js +210 -0
  12. package/dist/{DesignReferenceSidebar-B8V_F2yF.js → DesignReferenceSidebar-RDlnhL-6.js} +58 -58
  13. package/dist/{LoadingTrack-B0CWFHXQ.js → LoadingTrack-BJ59h9ok.js} +2 -2
  14. package/dist/ModuleBrowserModal-b7HbpByz.js +206 -0
  15. package/dist/ModulePreviewCanvas-D__YlOLS.js +108 -0
  16. package/dist/{NumberWithSuffix-DkXUez9t.js → NumberWithSuffix-Ca3vNY84.js} +87 -87
  17. package/dist/{ParagraphEditor-D75wl3BX.js → ParagraphEditor-B1aYPO-6.js} +182 -182
  18. package/dist/{RichTextEditorContent-DYkIauIk.js → RichTextEditorContent-BmEVMrkJ.js} +38 -38
  19. package/dist/{SaveModuleDialog-FZ9lxY7_.js → SaveModuleDialog-ClovqI6h.js} +28 -28
  20. package/dist/{SnapshotHistory-BR3eV120.js → SnapshotHistory-DoqtH0cw.js} +45 -50
  21. package/dist/{TemplateScoringPanel-4GTNHej5.js → TemplateScoringPanel-DQv2ZAiL.js} +75 -75
  22. package/dist/{TestEmailModal--ue5w9fT.js → TestEmailModal-iIeYJYsj.js} +28 -28
  23. package/dist/{TitleEditor-fStSADI-.js → TitleEditor-CTDIwRF_.js} +68 -68
  24. package/dist/{TplModal-BwSfxIHf.js → TplModal-CBq1J1pG.js} +14 -14
  25. package/dist/{accessibility-e8JYu_zd.js → accessibility-BU09xZrQ.js} +1 -1
  26. package/dist/{blockTypeIcons-BcTrDjmH.js → blockTypeIcons-QkC6f5UE.js} +19 -5
  27. package/dist/bundle-stats.json +7 -7
  28. package/dist/cdn/chunks/{AccessibilityPanel-B6DOjojm.js → AccessibilityPanel-BeU8nz7A.js} +28 -28
  29. package/dist/cdn/chunks/{AccessibilityPanel-B6DOjojm.js.map → AccessibilityPanel-BeU8nz7A.js.map} +1 -1
  30. package/dist/cdn/chunks/{AiFeatureMenu-qEdB2fZJ.js → AiFeatureMenu-B2mhscyP.js} +21 -21
  31. package/dist/cdn/chunks/AiFeatureMenu-B2mhscyP.js.map +1 -0
  32. package/dist/cdn/chunks/{BlockA11yBadge-DcEZftf6.js → BlockA11yBadge-C4g77gF0.js} +11 -11
  33. package/dist/cdn/chunks/{BlockA11yBadge-DcEZftf6.js.map → BlockA11yBadge-C4g77gF0.js.map} +1 -1
  34. package/dist/{CloudEditor-BCz1ZTYC.js → cdn/chunks/CloudEditor-Btyr0b0_.js} +486 -475
  35. package/dist/cdn/chunks/CloudEditor-Btyr0b0_.js.map +1 -0
  36. package/dist/cdn/chunks/{CollaboratorBar--nO7TX6b.js → CollaboratorBar-YBiIjiRh.js} +15 -15
  37. package/dist/cdn/chunks/CollaboratorBar-YBiIjiRh.js.map +1 -0
  38. package/dist/cdn/chunks/CountdownBlock-B06UZoWe.js +93 -0
  39. package/dist/cdn/chunks/CountdownBlock-B06UZoWe.js.map +1 -0
  40. package/dist/cdn/chunks/CountdownToolbar-C9XZr33O.js +212 -0
  41. package/dist/cdn/chunks/CountdownToolbar-C9XZr33O.js.map +1 -0
  42. package/dist/{ModuleBrowserModal-DrUFMTDx.js → cdn/chunks/ModuleBrowserModal-C2CDWKW6.js} +51 -62
  43. package/dist/cdn/chunks/ModuleBrowserModal-C2CDWKW6.js.map +1 -0
  44. package/dist/cdn/chunks/ModulePreviewCanvas-Drt8Evai.js +109 -0
  45. package/dist/cdn/chunks/ModulePreviewCanvas-Drt8Evai.js.map +1 -0
  46. package/dist/cdn/chunks/{NumberWithSuffix-CE3NrZhH.js → NumberWithSuffix-Ty1bp9vB.js} +64 -64
  47. package/dist/cdn/chunks/{NumberWithSuffix-CE3NrZhH.js.map → NumberWithSuffix-Ty1bp9vB.js.map} +1 -1
  48. package/dist/cdn/chunks/{ParagraphEditor-B6Ygu-Mq.js → ParagraphEditor-BA1WbHI7.js} +188 -188
  49. package/dist/cdn/chunks/{ParagraphEditor-B6Ygu-Mq.js.map → ParagraphEditor-BA1WbHI7.js.map} +1 -1
  50. package/dist/cdn/chunks/{RichTextEditorContent-DL_y2SrR.js → RichTextEditorContent-BtWCA_Oc.js} +30 -30
  51. package/dist/cdn/chunks/{RichTextEditorContent-DL_y2SrR.js.map → RichTextEditorContent-BtWCA_Oc.js.map} +1 -1
  52. package/dist/cdn/chunks/{SaveModuleDialog-B0TnO_o9.js → SaveModuleDialog-AwL0tkCV.js} +21 -21
  53. package/dist/cdn/chunks/SaveModuleDialog-AwL0tkCV.js.map +1 -0
  54. package/dist/cdn/chunks/{TitleEditor-BHpfxvwy.js → TitleEditor-DbSyeixS.js} +65 -65
  55. package/dist/cdn/chunks/TitleEditor-DbSyeixS.js.map +1 -0
  56. package/dist/cdn/chunks/blockTypeIcons-pQIkxJzc.js +23 -0
  57. package/dist/cdn/chunks/blockTypeIcons-pQIkxJzc.js.map +1 -0
  58. package/dist/cdn/chunks/{de-D8CnZxV9.js → de-_tooy3Q8.js} +250 -2
  59. package/dist/cdn/chunks/de-_tooy3Q8.js.map +1 -0
  60. package/dist/cdn/chunks/{draggable-Bcb86AsV.js → draggable-C-1_gch3.js} +2 -2
  61. package/dist/cdn/chunks/{draggable-Bcb86AsV.js.map → draggable-C-1_gch3.js.map} +1 -1
  62. package/dist/cdn/chunks/{en-8FHaQv4V.js → en-CNqLoIm9.js} +250 -2
  63. package/dist/cdn/chunks/en-CNqLoIm9.js.map +1 -0
  64. package/dist/cdn/chunks/{extensions-DIxF31tA.js → extensions-BVKQw_sp.js} +107 -107
  65. package/dist/cdn/chunks/extensions-BVKQw_sp.js.map +1 -0
  66. package/dist/cdn/chunks/{features-DEMb13KS.js → features-DIBEo4xl.js} +3388 -2289
  67. package/dist/cdn/chunks/features-DIBEo4xl.js.map +1 -0
  68. package/dist/cdn/chunks/{icons-CsLTcirh.js → icons-C1Gg-ov-.js} +346 -54
  69. package/dist/cdn/chunks/icons-C1Gg-ov-.js.map +1 -0
  70. package/dist/cdn/chunks/{media-library-CVaNvhpM.js → media-library-BTF_Ko70.js} +985 -985
  71. package/dist/cdn/chunks/media-library-BTF_Ko70.js.map +1 -0
  72. package/dist/cdn/chunks/{quality-BaBfc54_.js → quality-C5AmotmP.js} +312 -312
  73. package/dist/cdn/chunks/quality-C5AmotmP.js.map +1 -0
  74. package/dist/cdn/chunks/{renderer-CUxvx7ro.js → renderer-D0L44Vlp.js} +236 -142
  75. package/dist/cdn/chunks/renderer-D0L44Vlp.js.map +1 -0
  76. package/dist/cdn/chunks/{src-CRaqN-p8.js → src-RKexlYjA.js} +161 -161
  77. package/dist/cdn/chunks/src-RKexlYjA.js.map +1 -0
  78. package/dist/cdn/chunks/styleConstants-PgmvNBzQ.js +57 -0
  79. package/dist/cdn/chunks/styleConstants-PgmvNBzQ.js.map +1 -0
  80. package/dist/cdn/chunks/styles-CQR6ed13.js +4976 -0
  81. package/dist/cdn/chunks/styles-CQR6ed13.js.map +1 -0
  82. package/dist/cdn/chunks/{tiptap-ZhwKyFp7.js → tiptap-CDzAbF2j.js} +43 -43
  83. package/dist/cdn/chunks/{tiptap-ZhwKyFp7.js.map → tiptap-CDzAbF2j.js.map} +1 -1
  84. package/dist/cdn/editor.css +1 -1
  85. package/dist/cdn/editor.js +211 -123
  86. package/dist/cdn/editor.js.map +1 -1
  87. package/dist/{check-Da05j8yl.js → check-DJrpDKO_.js} +1 -1
  88. package/dist/{chevron-down-R2uY34iD.js → chevron-down-C5oBUhT8.js} +1 -1
  89. package/dist/chevron-right-BqCptpdp.js +10 -0
  90. package/dist/{circle-alert-DZuGWPX-.js → circle-alert-ZQQc98HC.js} +1 -1
  91. package/dist/{clock-CRp2sIub.js → clock-ik2pRJKG.js} +1 -1
  92. package/dist/{cloud-DEk_b4CR.js → cloud-DJG4tb4_.js} +485 -427
  93. package/dist/{createLucideIcon-C3pa2siy.js → createLucideIcon-ClREiSx3.js} +6 -6
  94. package/dist/{de-Brqvgr43.js → de-2LEvILeZ.js} +249 -1
  95. package/dist/{dist-Cp0zXPAD.js → dist-BHAeXaUY.js} +1 -1
  96. package/dist/{dist-BaQIYPsn.js → dist-BSJvAvH3.js} +1 -1
  97. package/dist/{dist-wzMIGj-D.js → dist-BeFnymxK.js} +1 -1
  98. package/dist/dist-Bmir0gYb.js +1167 -0
  99. package/dist/{dist-DDJIWTRY.js → dist-BvPgo-UK.js} +1 -1
  100. package/dist/{dist-BFawx6IS.js → dist-CPVBKMmd.js} +51 -51
  101. package/dist/dist-CivF9P8b.js +382 -0
  102. package/dist/{dist-D6uC2xhi.js → dist-Df4ie7vZ.js} +1 -1
  103. package/dist/{dist-us-RpCWN.js → dist-DxOoemkW.js} +1 -1
  104. package/dist/{dist-KoBJjK1G.js → dist-HEQ52gTJ.js} +1 -1
  105. package/dist/{dist-DjviJBCi.js → dist-b-XUqAoF.js} +1 -1
  106. package/dist/{dist-D90y8dvT.js → dist-kZfaVUpW.js} +3 -3
  107. package/dist/{dist-aRzjfSRN.js → dist-wfAedlzi.js} +1 -1
  108. package/dist/{en-WDVp87TE.js → en-D2RU2Poj.js} +249 -1
  109. package/dist/{extensions-CUcl9Ok4.js → extensions-BQ1xXx3d.js} +103 -103
  110. package/dist/{image-up-MBZKKg9p.js → image-up-DT7gcJLN.js} +1 -1
  111. package/dist/index.d.ts +102 -14
  112. package/dist/{info-CJEC7piy.js → info-BSPGcsSM.js} +1 -1
  113. package/dist/keys-CvX8D-8C.js +10 -0
  114. package/dist/{loader-circle-DsY5Yg33.js → loader-circle-Balo8p3d.js} +1 -1
  115. package/dist/{message-circle-yElBbR2C.js → message-circle-B39qAHxs.js} +1 -1
  116. package/dist/pencil-BZJPNYWR.js +10 -0
  117. package/dist/{refresh-cw-CE_AGtn8.js → refresh-cw-DwDqGUM0.js} +1 -1
  118. package/dist/{scan-line-D0vcUekt.js → scan-line-DlghmhNf.js} +1 -1
  119. package/dist/{send-DH4oDQqC.js → send-DDdhIRj8.js} +1 -1
  120. package/dist/{shield-check-CfJgs2Hd.js → shield-check-OSQ-JVTX.js} +1 -1
  121. package/dist/{sparkles-CvRXGqFs.js → sparkles-BN4a-CoF.js} +1 -1
  122. package/dist/style.css +1 -1
  123. package/dist/styleConstants-wWRbcuEK.js +55 -0
  124. package/dist/styles-CavWjvol.js +5487 -0
  125. package/dist/templatical-editor.js +211 -119
  126. package/dist/{text-align-start-BT9VUDxK.js → text-align-start-D1weisjS.js} +1 -1
  127. package/dist/{trash-2-DbP2Y6t2.js → trash-2-CMWvQ5KX.js} +1 -1
  128. package/dist/{triangle-alert-aOXceTSe.js → triangle-alert-DyidRNX_.js} +1 -1
  129. package/dist/undo-2-Cg8I7obC.js +16 -0
  130. package/dist/{useCloudI18n-BuIwR6OE.js → useCloudI18n-BTTNBk5i.js} +2 -2
  131. package/dist/{useEditorCore-C6ost42Q.js → useEditorCore-BGnzcT7p.js} +2424 -2249
  132. package/dist/{useI18n-lb2DHDiu.js → useI18n-C2xQZ6K9.js} +2 -2
  133. package/dist/{useMergeTag-CBwKnnNB.js → useMergeTag-CfuZq2fF.js} +4 -4
  134. package/dist/{vue.runtime.esm-bundler-DpvJL-nX.js → vue.runtime.esm-bundler-CjauPXjj.js} +1 -1
  135. package/dist/{x-u2oVmjN_.js → x-CgIhNcT9.js} +1 -1
  136. package/package.json +15 -15
  137. package/dist/CommentsSidebar-B1pvJdqF.js +0 -441
  138. package/dist/CountdownBlock-BNSj1jvJ.js +0 -92
  139. package/dist/CountdownToolbar-ClJr2GzL.js +0 -210
  140. package/dist/ModulePreviewCanvas-CHdOwV_4.js +0 -106
  141. package/dist/cdn/chunks/AiFeatureMenu-qEdB2fZJ.js.map +0 -1
  142. package/dist/cdn/chunks/CloudEditor-D2GsEC_n.js +0 -1143
  143. package/dist/cdn/chunks/CloudEditor-D2GsEC_n.js.map +0 -1
  144. package/dist/cdn/chunks/CollaboratorBar--nO7TX6b.js.map +0 -1
  145. package/dist/cdn/chunks/CountdownBlock-5YdT1uUu.js +0 -93
  146. package/dist/cdn/chunks/CountdownBlock-5YdT1uUu.js.map +0 -1
  147. package/dist/cdn/chunks/CountdownToolbar-DXPXrbAA.js +0 -212
  148. package/dist/cdn/chunks/CountdownToolbar-DXPXrbAA.js.map +0 -1
  149. package/dist/cdn/chunks/ModuleBrowserModal-DxoPp81s.js +0 -195
  150. package/dist/cdn/chunks/ModuleBrowserModal-DxoPp81s.js.map +0 -1
  151. package/dist/cdn/chunks/ModulePreviewCanvas-CoLdb4ar.js +0 -107
  152. package/dist/cdn/chunks/ModulePreviewCanvas-CoLdb4ar.js.map +0 -1
  153. package/dist/cdn/chunks/SaveModuleDialog-B0TnO_o9.js.map +0 -1
  154. package/dist/cdn/chunks/TitleEditor-BHpfxvwy.js.map +0 -1
  155. package/dist/cdn/chunks/blockTypeIcons-BzzY9_kA.js +0 -22
  156. package/dist/cdn/chunks/blockTypeIcons-BzzY9_kA.js.map +0 -1
  157. package/dist/cdn/chunks/de-D8CnZxV9.js.map +0 -1
  158. package/dist/cdn/chunks/en-8FHaQv4V.js.map +0 -1
  159. package/dist/cdn/chunks/extensions-DIxF31tA.js.map +0 -1
  160. package/dist/cdn/chunks/features-DEMb13KS.js.map +0 -1
  161. package/dist/cdn/chunks/icons-CsLTcirh.js.map +0 -1
  162. package/dist/cdn/chunks/media-library-CVaNvhpM.js.map +0 -1
  163. package/dist/cdn/chunks/quality-BaBfc54_.js.map +0 -1
  164. package/dist/cdn/chunks/renderer-CUxvx7ro.js.map +0 -1
  165. package/dist/cdn/chunks/src-CRaqN-p8.js.map +0 -1
  166. package/dist/cdn/chunks/styleConstants-DP1VOca8.js +0 -57
  167. package/dist/cdn/chunks/styleConstants-DP1VOca8.js.map +0 -1
  168. package/dist/cdn/chunks/styles-BHJULjNR.js +0 -2947
  169. package/dist/cdn/chunks/styles-BHJULjNR.js.map +0 -1
  170. package/dist/dist-B1IR0bpH.js +0 -326
  171. package/dist/dist-DJmnUmW9.js +0 -362
  172. package/dist/keys-ciNfSSGj.js +0 -10
  173. package/dist/styleConstants-fWzlIIwN.js +0 -55
  174. package/dist/styles-DEXEkBvg.js +0 -3176
  175. /package/dist/{_plugin-vue_export-helper-B0hnzhyu.js → _plugin-vue_export-helper-Bwh4ceeO.js} +0 -0
  176. /package/dist/{de-DCaaCE5s.js → de-D2npYjrZ.js} +0 -0
  177. /package/dist/{dist-iLBdeBDR.js → dist-DvHLtWVP.js} +0 -0
  178. /package/dist/{emojiData-PQyVa4bU.js → emojiData-DvQBBzmO.js} +0 -0
  179. /package/dist/{en-DXCyK4-X.js → en-ib-4h3_o.js} +0 -0
  180. /package/dist/{formatRelativeTime-BOEf47hq.js → formatRelativeTime-CFDZnEIs.js} +0 -0
  181. /package/dist/{liquid.browser-CdMv1BTn.js → liquid.browser-7Rv0QDiO.js} +0 -0
  182. /package/dist/{readableTextColor-CY3SiRnt.js → readableTextColor-C_9OpzBw.js} +0 -0
@@ -1,7 +1,7 @@
1
- import { Q as e, X as t, Y as n, Z as r, p as i, z as a } from "./vue.runtime.esm-bundler-DpvJL-nX.js";
2
- import { r as o, u as s } from "./dist-DJmnUmW9.js";
1
+ import { $ as e, Q as t, V as n, Z as r, et as i, m as a } from "./vue.runtime.esm-bundler-CjauPXjj.js";
2
+ import { F as o, a as s, p as c } from "./dist-Bmir0gYb.js";
3
3
  //#region ../core/dist/cloud/index.js
4
- var c = class e {
4
+ var l = class e {
5
5
  static DEFAULT_BASE_URL = "https://templatical.com";
6
6
  accessToken = null;
7
7
  expiresAt = null;
@@ -75,7 +75,7 @@ var c = class e {
75
75
  };
76
76
  e === "POST" && this.requestOptions.body && (t["Content-Type"] = "application/json", n.body = JSON.stringify(this.requestOptions.body));
77
77
  let r = await fetch(this.url, n);
78
- if (!r.ok) throw new o(`Token refresh failed: ${r.status}`, r.status);
78
+ if (!r.ok) throw new s(`Token refresh failed: ${r.status}`, r.status);
79
79
  let i = await r.json();
80
80
  if (!i.token || !i.expires_at || !i.project_id || !i.tenant) throw Error("Invalid token response: missing token, expires_at, project_id, or tenant");
81
81
  return this.accessToken = i.token, this.expiresAt = /* @__PURE__ */ new Date(i.expires_at * 1e3), this._projectId = i.project_id, this._tenantSlug = i.tenant, i.test_email?.allowed_emails && i.test_email?.signature ? this._testEmailConfig = {
@@ -102,54 +102,54 @@ var c = class e {
102
102
  return a.status === 401 && (a = await i(await this.refreshToken())), a;
103
103
  }
104
104
  };
105
- function l(e, t) {
105
+ function u(e, t) {
106
106
  return e.replace(/\{(\w+)\}/g, (e, n) => encodeURIComponent(t[n] ?? ""));
107
107
  }
108
- var u = "/api/v1/projects/{project}/tenants/{tenant}", d = `${u}/templates/{template}`, f = `${d}/ai`, p = `${u}/media`, m = `${p}/folders`, h = `${u}/saved-modules`, g = {
108
+ var d = "/api/v1/projects/{project}/tenants/{tenant}", f = `${d}/templates/{template}`, p = `${f}/ai`, m = `${d}/media`, h = `${m}/folders`, g = `${d}/saved-modules`, _ = {
109
109
  health: "/api/v1/health",
110
- "projects.config": `${u}/config`,
111
- "broadcasting.auth": `${u}/broadcasting/auth`,
112
- "templates.store": `${u}/templates`,
113
- "templates.show": `${d}`,
114
- "templates.update": `${d}`,
115
- "templates.destroy": `${d}`,
116
- "templates.export": `${d}/export`,
117
- "templates.importFromBeefree": `${u}/templates/import/from-beefree`,
118
- "templates.sendTestEmail": `${d}/send-test-email`,
119
- "snapshots.index": `${d}/snapshots`,
120
- "snapshots.store": `${d}/snapshots`,
121
- "snapshots.show": `${d}/snapshots/{snapshot}`,
122
- "snapshots.restore": `${d}/snapshots/{snapshot}/restore`,
123
- "comments.index": `${d}/comments`,
124
- "comments.store": `${d}/comments`,
125
- "comments.update": `${d}/comments/{comment}`,
126
- "comments.destroy": `${d}/comments/{comment}`,
127
- "comments.resolve": `${d}/comments/{comment}/resolve`,
128
- "ai.generate": `${f}/generate`,
129
- "ai.conversationMessages": `${f}/conversation-messages`,
130
- "ai.suggestions": `${f}/suggestions`,
131
- "ai.rewriteText": `${f}/rewrite-text`,
132
- "ai.score": `${f}/score`,
133
- "ai.fixFinding": `${f}/fix-finding`,
134
- "ai.generateFromDesign": `${f}/generate-from-design`,
135
- "media.upload": `${p}/upload`,
136
- "media.browse": `${p}/browse`,
137
- "media.delete": `${p}/delete`,
138
- "media.move": `${p}/move`,
139
- "media.update": `${p}/{media}`,
140
- "media.replace": `${p}/{media}/replace`,
141
- "media.checkUsage": `${p}/check-usage`,
142
- "media.frequentlyUsed": `${p}/frequently-used`,
143
- "media.importFromUrl": `${p}/import-from-url`,
144
- "folders.index": `${m}`,
145
- "folders.store": `${m}`,
146
- "folders.update": `${m}/{mediaFolder}`,
147
- "folders.destroy": `${m}/{mediaFolder}`,
148
- "savedModules.index": `${h}`,
149
- "savedModules.store": `${h}`,
150
- "savedModules.update": `${h}/{savedModule}`,
151
- "savedModules.destroy": `${h}/{savedModule}`
152
- }, _ = class {
110
+ "projects.config": `${d}/config`,
111
+ "broadcasting.auth": `${d}/broadcasting/auth`,
112
+ "templates.store": `${d}/templates`,
113
+ "templates.show": `${f}`,
114
+ "templates.update": `${f}`,
115
+ "templates.destroy": `${f}`,
116
+ "templates.export": `${f}/export`,
117
+ "templates.importFromBeefree": `${d}/templates/import/from-beefree`,
118
+ "templates.sendTestEmail": `${f}/send-test-email`,
119
+ "snapshots.index": `${f}/snapshots`,
120
+ "snapshots.store": `${f}/snapshots`,
121
+ "snapshots.show": `${f}/snapshots/{snapshot}`,
122
+ "snapshots.restore": `${f}/snapshots/{snapshot}/restore`,
123
+ "comments.index": `${f}/comments`,
124
+ "comments.store": `${f}/comments`,
125
+ "comments.update": `${f}/comments/{comment}`,
126
+ "comments.destroy": `${f}/comments/{comment}`,
127
+ "comments.resolve": `${f}/comments/{comment}/resolve`,
128
+ "ai.generate": `${p}/generate`,
129
+ "ai.conversationMessages": `${p}/conversation-messages`,
130
+ "ai.suggestions": `${p}/suggestions`,
131
+ "ai.rewriteText": `${p}/rewrite-text`,
132
+ "ai.score": `${p}/score`,
133
+ "ai.fixFinding": `${p}/fix-finding`,
134
+ "ai.generateFromDesign": `${p}/generate-from-design`,
135
+ "media.upload": `${m}/upload`,
136
+ "media.browse": `${m}/browse`,
137
+ "media.delete": `${m}/delete`,
138
+ "media.move": `${m}/move`,
139
+ "media.update": `${m}/{media}`,
140
+ "media.replace": `${m}/{media}/replace`,
141
+ "media.checkUsage": `${m}/check-usage`,
142
+ "media.frequentlyUsed": `${m}/frequently-used`,
143
+ "media.importFromUrl": `${m}/import-from-url`,
144
+ "folders.index": `${h}`,
145
+ "folders.store": `${h}`,
146
+ "folders.update": `${h}/{mediaFolder}`,
147
+ "folders.destroy": `${h}/{mediaFolder}`,
148
+ "savedModules.index": `${g}`,
149
+ "savedModules.store": `${g}`,
150
+ "savedModules.update": `${g}/{savedModule}`,
151
+ "savedModules.destroy": `${g}/{savedModule}`
152
+ }, v = class {
153
153
  constructor(e) {
154
154
  this.authManager = e;
155
155
  }
@@ -177,7 +177,7 @@ var u = "/api/v1/projects/{project}/tenants/{tenant}", d = `${u}/templates/{temp
177
177
  });
178
178
  if (!n.ok) {
179
179
  let e = await n.json().catch(() => ({ message: `HTTP error ${n.status}` }));
180
- throw new o(this.extractFirstValidationError(e), n.status);
180
+ throw new s(this.extractFirstValidationError(e), n.status);
181
181
  }
182
182
  if (n.status !== 204) return (await n.json()).data;
183
183
  }
@@ -189,19 +189,19 @@ var u = "/api/v1/projects/{project}/tenants/{tenant}", d = `${u}/templates/{temp
189
189
  return e.message;
190
190
  }
191
191
  async createTemplate(e) {
192
- return this.request(l(g["templates.store"], this.baseParams), {
192
+ return this.request(u(_["templates.store"], this.baseParams), {
193
193
  method: "POST",
194
194
  body: JSON.stringify({ content: e })
195
195
  });
196
196
  }
197
197
  async getTemplate(e) {
198
- return this.request(l(g["templates.show"], {
198
+ return this.request(u(_["templates.show"], {
199
199
  ...this.baseParams,
200
200
  template: e
201
201
  }));
202
202
  }
203
203
  async updateTemplate(e, t) {
204
- return this.request(l(g["templates.update"], {
204
+ return this.request(u(_["templates.update"], {
205
205
  ...this.baseParams,
206
206
  template: e
207
207
  }), {
@@ -210,7 +210,7 @@ var u = "/api/v1/projects/{project}/tenants/{tenant}", d = `${u}/templates/{temp
210
210
  });
211
211
  }
212
212
  async createSnapshot(e, t) {
213
- return this.request(l(g["snapshots.store"], {
213
+ return this.request(u(_["snapshots.store"], {
214
214
  ...this.baseParams,
215
215
  template: e
216
216
  }), {
@@ -219,19 +219,19 @@ var u = "/api/v1/projects/{project}/tenants/{tenant}", d = `${u}/templates/{temp
219
219
  });
220
220
  }
221
221
  async deleteTemplate(e) {
222
- return this.request(l(g["templates.destroy"], {
222
+ return this.request(u(_["templates.destroy"], {
223
223
  ...this.baseParams,
224
224
  template: e
225
225
  }), { method: "DELETE" });
226
226
  }
227
227
  async getSnapshots(e) {
228
- return this.request(l(g["snapshots.index"], {
228
+ return this.request(u(_["snapshots.index"], {
229
229
  ...this.baseParams,
230
230
  template: e
231
231
  }));
232
232
  }
233
233
  async restoreSnapshot(e, t) {
234
- return this.request(l(g["snapshots.restore"], {
234
+ return this.request(u(_["snapshots.restore"], {
235
235
  ...this.baseParams,
236
236
  template: e,
237
237
  snapshot: t
@@ -242,7 +242,7 @@ var u = "/api/v1/projects/{project}/tenants/{tenant}", d = `${u}/templates/{temp
242
242
  custom_fonts: t.customFonts,
243
243
  default_fallback: t.defaultFallback
244
244
  }) : void 0;
245
- return this.request(l(g["templates.export"], {
245
+ return this.request(u(_["templates.export"], {
246
246
  ...this.baseParams,
247
247
  template: e
248
248
  }), {
@@ -251,7 +251,7 @@ var u = "/api/v1/projects/{project}/tenants/{tenant}", d = `${u}/templates/{temp
251
251
  });
252
252
  }
253
253
  async sendTestEmail(e, t) {
254
- await this.request(l(g["templates.sendTestEmail"], {
254
+ await this.request(u(_["templates.sendTestEmail"], {
255
255
  ...this.baseParams,
256
256
  template: e
257
257
  }), {
@@ -260,11 +260,11 @@ var u = "/api/v1/projects/{project}/tenants/{tenant}", d = `${u}/templates/{temp
260
260
  });
261
261
  }
262
262
  commentsUrl(e, t) {
263
- return t ? l(g["comments.update"], {
263
+ return t ? u(_["comments.update"], {
264
264
  ...this.baseParams,
265
265
  template: e,
266
266
  comment: t
267
- }) : l(g["comments.index"], {
267
+ }) : u(_["comments.index"], {
268
268
  ...this.baseParams,
269
269
  template: e
270
270
  });
@@ -294,7 +294,7 @@ var u = "/api/v1/projects/{project}/tenants/{tenant}", d = `${u}/templates/{temp
294
294
  });
295
295
  }
296
296
  async resolveComment(e, t, n, r) {
297
- return this.request(l(g["comments.resolve"], {
297
+ return this.request(u(_["comments.resolve"], {
298
298
  ...this.baseParams,
299
299
  template: e,
300
300
  comment: t
@@ -305,20 +305,20 @@ var u = "/api/v1/projects/{project}/tenants/{tenant}", d = `${u}/templates/{temp
305
305
  });
306
306
  }
307
307
  async fetchConfig() {
308
- return this.request(l(g["projects.config"], this.baseParams));
308
+ return this.request(u(_["projects.config"], this.baseParams));
309
309
  }
310
310
  async listModules(e) {
311
- let t = l(g["savedModules.index"], this.baseParams), n = e ? `?search=${encodeURIComponent(e)}` : "";
311
+ let t = u(_["savedModules.index"], this.baseParams), n = e ? `?search=${encodeURIComponent(e)}` : "";
312
312
  return this.request(`${t}${n}`);
313
313
  }
314
314
  async createModule(e) {
315
- return this.request(l(g["savedModules.store"], this.baseParams), {
315
+ return this.request(u(_["savedModules.store"], this.baseParams), {
316
316
  method: "POST",
317
317
  body: JSON.stringify(e)
318
318
  });
319
319
  }
320
320
  async updateModule(e, t) {
321
- return this.request(l(g["savedModules.update"], {
321
+ return this.request(u(_["savedModules.update"], {
322
322
  ...this.baseParams,
323
323
  savedModule: e
324
324
  }), {
@@ -327,20 +327,20 @@ var u = "/api/v1/projects/{project}/tenants/{tenant}", d = `${u}/templates/{temp
327
327
  });
328
328
  }
329
329
  async deleteModule(e) {
330
- return this.request(l(g["savedModules.destroy"], {
330
+ return this.request(u(_["savedModules.destroy"], {
331
331
  ...this.baseParams,
332
332
  savedModule: e
333
333
  }), { method: "DELETE" });
334
334
  }
335
335
  };
336
- function v(e) {
336
+ function y(e) {
337
337
  return {
338
338
  host: e.host,
339
339
  port: e.port,
340
340
  appKey: e.app_key
341
341
  };
342
342
  }
343
- var y = class {
343
+ var b = class {
344
344
  pusher = null;
345
345
  authManager;
346
346
  config;
@@ -356,7 +356,7 @@ var y = class {
356
356
  } catch {
357
357
  throw Error("Cloud features require the optional peer dependency 'pusher-js'. Install it with: npm install pusher-js");
358
358
  }
359
- let { host: t, port: n, appKey: r } = this.config, i = this.authManager.resolveUrl(l(g["broadcasting.auth"], {
359
+ let { host: t, port: n, appKey: r } = this.config, i = this.authManager.resolveUrl(u(_["broadcasting.auth"], {
360
360
  project: this.authManager.projectId,
361
361
  tenant: this.authManager.tenantSlug
362
362
  }));
@@ -405,7 +405,7 @@ var y = class {
405
405
  return this.pusher?.connection.state === "connected";
406
406
  }
407
407
  };
408
- function b(e, t) {
408
+ function x(e, t) {
409
409
  let { operation: n, data: r } = t;
410
410
  switch (n) {
411
411
  case "add_block":
@@ -431,10 +431,10 @@ function b(e, t) {
431
431
  break;
432
432
  }
433
433
  }
434
- function x(e) {
435
- let n = new _(e.authManager), a = t({
434
+ function S(n) {
435
+ let r = new v(n.authManager), i = t({
436
436
  template: null,
437
- content: s(e.defaultFontFamily, e.templateDefaults),
437
+ content: o(c(n.defaultFontFamily, n.templateDefaults)),
438
438
  selectedBlockId: null,
439
439
  viewport: "desktop",
440
440
  darkMode: !1,
@@ -443,33 +443,33 @@ function x(e) {
443
443
  isSaving: !1,
444
444
  isLoading: !1,
445
445
  uiTheme: "auto"
446
- }), c = i({
447
- get: () => a.content,
446
+ }), l = a({
447
+ get: () => i.content,
448
448
  set: (e) => {
449
- a.content = e, a.isDirty = !0;
449
+ i.content = o(e), i.isDirty = !0;
450
450
  }
451
- }), l = i(() => a.selectedBlockId ? d(a.content.blocks, a.selectedBlockId) : null), u = i(() => {
452
- let e = /* @__PURE__ */ new Set(), t = a.template?.content?.blocks;
451
+ }), u = a(() => i.selectedBlockId ? f(i.content.blocks, i.selectedBlockId) : null), d = a(() => {
452
+ let e = /* @__PURE__ */ new Set(), t = i.template?.content?.blocks;
453
453
  if (!t) return e;
454
454
  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);
455
455
  return e;
456
456
  });
457
- function d(e, t) {
457
+ function f(e, t) {
458
458
  for (let n of e) {
459
459
  if (n.id === t) return n;
460
460
  if (n.type === "section") for (let e of n.children) {
461
- let n = d(e, t);
461
+ let n = f(e, t);
462
462
  if (n) return n;
463
463
  }
464
464
  }
465
465
  return null;
466
466
  }
467
- function f(e, t, n = { blocks: e }) {
467
+ function p(e, t, n = { blocks: e }) {
468
468
  for (let r = 0; r < e.length; r++) {
469
469
  let i = e[r];
470
470
  if (i.id === t) return n;
471
471
  if (i.type === "section") for (let e = 0; e < i.children.length; e++) {
472
- let n = f(i.children[e], t, {
472
+ let n = p(i.children[e], t, {
473
473
  blocks: i.children[e],
474
474
  sectionId: i.id,
475
475
  columnIndex: e
@@ -479,148 +479,206 @@ function x(e) {
479
479
  }
480
480
  return null;
481
481
  }
482
- function p(t) {
483
- return e.lockedBlocks?.value.has(t) ?? !1;
484
- }
485
- function m(e, t = !0) {
486
- a.content = e, t && (a.isDirty = !0);
482
+ function m(e) {
483
+ return n.lockedBlocks?.value.has(e) ?? !1;
487
484
  }
488
- function h(e) {
489
- e && p(e) || (a.selectedBlockId = e);
485
+ function h(e, t = !0) {
486
+ i.content = o(e), t && (i.isDirty = !0);
490
487
  }
491
488
  function g(e) {
492
- a.viewport = e;
489
+ e && m(e) || (i.selectedBlockId = e);
493
490
  }
494
- function v(e) {
495
- a.darkMode = e;
491
+ function _(e) {
492
+ i.viewport = e;
496
493
  }
497
494
  function y(e) {
498
- a.uiTheme = e;
495
+ i.darkMode = e;
499
496
  }
500
497
  function b(e) {
501
- a.previewMode = e, e && (a.selectedBlockId = null);
498
+ i.uiTheme = e;
499
+ }
500
+ function x(e) {
501
+ i.previewMode = e, e && (i.selectedBlockId = null);
502
502
  }
503
- function x(e, t) {
504
- if (p(e)) return;
505
- let n = d(a.content.blocks, e);
506
- n && (Object.assign(n, t), a.isDirty = !0);
503
+ function S(e, t) {
504
+ if (m(e)) return;
505
+ let n = f(i.content.blocks, e);
506
+ n && (Object.assign(n, t), i.isDirty = !0);
507
507
  }
508
- function S(e) {
509
- a.content.settings = {
510
- ...a.content.settings,
508
+ function C(e) {
509
+ i.content.settings = {
510
+ ...i.content.settings,
511
511
  ...e
512
- }, a.isDirty = !0;
512
+ }, i.isDirty = !0;
513
513
  }
514
- function C(e, t, n = 0, r) {
514
+ function w(e, t, n = 0, r) {
515
515
  if (t) {
516
- let i = d(a.content.blocks, t);
517
- if (i && i.type === "section") {
518
- i.children[n] = i.children[n] || [];
519
- let t = i.children[n];
516
+ let a = f(i.content.blocks, t);
517
+ if (a && a.type === "section") {
518
+ a.children[n] = a.children[n] || [];
519
+ let t = a.children[n];
520
520
  r !== void 0 && r < t.length ? t.splice(r, 0, e) : t.push(e);
521
521
  }
522
- } else r !== void 0 && r < a.content.blocks.length ? a.content.blocks.splice(r, 0, e) : a.content.blocks.push(e);
523
- a.isDirty = !0;
522
+ } else r !== void 0 && r < i.content.blocks.length ? i.content.blocks.splice(r, 0, e) : i.content.blocks.push(e);
523
+ i.isDirty = !0;
524
524
  }
525
- function w(e) {
526
- if (p(e)) return;
527
- let t = f(a.content.blocks, e);
525
+ function T(e) {
526
+ if (m(e)) return;
527
+ let t = p(i.content.blocks, e);
528
528
  if (t) {
529
529
  let n = t.blocks.findIndex((t) => t.id === e);
530
- n !== -1 && (t.blocks.splice(n, 1), a.selectedBlockId === e && (a.selectedBlockId = null), a.isDirty = !0);
530
+ n !== -1 && (t.blocks.splice(n, 1), i.selectedBlockId === e && (i.selectedBlockId = null), i.isDirty = !0);
531
531
  }
532
532
  }
533
- function T(e, t, n, r = 0) {
534
- let i = f(a.content.blocks, e);
535
- if (!i) return;
536
- let o = i.blocks.findIndex((t) => t.id === e);
533
+ function E(e, t, n, r = 0) {
534
+ let a = p(i.content.blocks, e);
535
+ if (!a) return;
536
+ let o = a.blocks.findIndex((t) => t.id === e);
537
537
  if (o === -1) return;
538
- let [s] = i.blocks.splice(o, 1);
538
+ let [s] = a.blocks.splice(o, 1);
539
539
  if (n) {
540
- let e = d(a.content.blocks, n);
540
+ let e = f(i.content.blocks, n);
541
541
  e && e.type === "section" && (e.children[r] = e.children[r] || [], e.children[r].splice(t, 0, s));
542
- } else a.content.blocks.splice(t, 0, s);
543
- a.isDirty = !0;
542
+ } else i.content.blocks.splice(t, 0, s);
543
+ i.isDirty = !0;
544
544
  }
545
- async function E(t) {
546
- a.isLoading = !0;
545
+ async function D(e) {
546
+ i.isLoading = !0;
547
547
  try {
548
- t && (a.content = t);
549
- let e = await n.createTemplate(a.content);
550
- return a.template = e, a.isDirty = !1, e;
551
- } catch (t) {
552
- throw e.onError?.(t), t;
548
+ e && (i.content = o(e));
549
+ let t = await r.createTemplate(i.content);
550
+ return i.template = t, i.isDirty = !1, t;
551
+ } catch (e) {
552
+ throw n.onError?.(e), e;
553
553
  } finally {
554
- a.isLoading = !1;
554
+ i.isLoading = !1;
555
555
  }
556
556
  }
557
- async function D(t) {
558
- a.isLoading = !0;
557
+ async function O(e) {
558
+ i.isLoading = !0;
559
559
  try {
560
- let e = await n.getTemplate(t);
561
- return a.template = e, a.content = e.content, a.isDirty = !1, e;
562
- } catch (t) {
563
- throw e.onError?.(t), t;
560
+ let t = await r.getTemplate(e);
561
+ return i.template = t, i.content = o(t.content), i.isDirty = !1, t;
562
+ } catch (e) {
563
+ throw n.onError?.(e), e;
564
564
  } finally {
565
- a.isLoading = !1;
565
+ i.isLoading = !1;
566
566
  }
567
567
  }
568
- async function O() {
569
- if (!a.template?.id) throw new o("No template loaded. Call create() or load() before saving.");
570
- a.isSaving = !0;
568
+ async function k() {
569
+ if (!i.template?.id) throw new s("No template loaded. Call create() or load() before saving.");
570
+ i.isSaving = !0;
571
571
  try {
572
- let e = await n.updateTemplate(a.template.id, a.content);
573
- return a.template = e, a.isDirty = !1, e;
574
- } catch (t) {
575
- throw e.onError?.(t), t;
572
+ let e = await r.updateTemplate(i.template.id, i.content);
573
+ return i.template = e, i.isDirty = !1, e;
574
+ } catch (e) {
575
+ throw n.onError?.(e), e;
576
576
  } finally {
577
- a.isSaving = !1;
577
+ i.isSaving = !1;
578
578
  }
579
579
  }
580
- async function k() {
581
- if (a.template?.id) try {
582
- await n.createSnapshot(a.template.id, a.content);
583
- } catch (t) {
584
- throw e.onError?.(t), t;
580
+ async function A() {
581
+ if (i.template?.id) try {
582
+ await r.createSnapshot(i.template.id, i.content);
583
+ } catch (e) {
584
+ throw n.onError?.(e), e;
585
585
  }
586
586
  }
587
- function A() {
588
- return a.template?.id !== void 0;
589
- }
590
587
  function j() {
591
- a.isDirty = !0;
588
+ return i.template?.id !== void 0;
589
+ }
590
+ function M() {
591
+ i.isDirty = !0;
592
+ }
593
+ function N() {
594
+ if (i.content.canvasPages?.length) return;
595
+ let e = crypto.randomUUID(), t = i.content.blocks;
596
+ i.content.canvasPages = [{
597
+ id: e,
598
+ title: "Step 1",
599
+ blocks: t
600
+ }], i.content.activeCanvasPageId = e, i.content.blocks = t, i.isDirty = !0;
601
+ }
602
+ function P(e) {
603
+ let t = i.content.canvasPages;
604
+ if (!t?.length) return;
605
+ let n = t.find((t) => t.id === e);
606
+ n && (i.selectedBlockId = null, i.content.blocks = n.blocks, i.content.activeCanvasPageId = e, i.isDirty = !0);
607
+ }
608
+ function F() {
609
+ N();
610
+ let e = i.content.canvasPages, t = crypto.randomUUID(), n = `Step ${e.length + 1}`;
611
+ e.push({
612
+ id: t,
613
+ title: n,
614
+ blocks: []
615
+ }), P(t);
616
+ }
617
+ function I(e) {
618
+ let t = i.content.canvasPages;
619
+ if (!t || t.length <= 1) return;
620
+ let n = t.findIndex((t) => t.id === e);
621
+ if (n !== -1) if (t.splice(n, 1), i.content.activeCanvasPageId === e) {
622
+ let e = t[Math.min(n, t.length - 1)];
623
+ P(e.id);
624
+ } else i.content.canvasPages = [...t], i.isDirty = !0;
625
+ }
626
+ function L(e, t) {
627
+ let n = i.content.canvasPages;
628
+ if (!n) return;
629
+ let r = n.find((t) => t.id === e);
630
+ r && (r.title = t.trim() || r.title, i.isDirty = !0);
631
+ }
632
+ function R() {
633
+ let e = i.content.canvasPages;
634
+ if (!e?.length) return !1;
635
+ let t = i.content.activeCanvasPageId, n = e.findIndex((e) => e.id === t);
636
+ return n === -1 || n >= e.length - 1 ? !1 : (P(e[n + 1].id), !0);
637
+ }
638
+ function z() {
639
+ let e = i.content.canvasPages;
640
+ if (!e?.length) return !1;
641
+ let t = i.content.activeCanvasPageId, n = e.findIndex((e) => e.id === t);
642
+ return n <= 0 ? !1 : (P(e[n - 1].id), !0);
592
643
  }
593
644
  return {
594
- state: r(a),
595
- content: c,
596
- selectedBlock: l,
597
- savedBlockIds: u,
598
- isBlockLocked: p,
599
- setContent: m,
600
- selectBlock: h,
601
- setViewport: g,
602
- setDarkMode: v,
603
- setUiTheme: y,
604
- setPreviewMode: b,
605
- updateBlock: x,
606
- updateSettings: S,
607
- addBlock: C,
608
- removeBlock: w,
609
- moveBlock: T,
610
- create: E,
611
- load: D,
612
- save: O,
613
- createSnapshot: k,
614
- hasTemplate: A,
615
- markDirty: j
645
+ state: e(i),
646
+ content: l,
647
+ selectedBlock: u,
648
+ savedBlockIds: d,
649
+ isBlockLocked: m,
650
+ setContent: h,
651
+ selectBlock: g,
652
+ setViewport: _,
653
+ setDarkMode: y,
654
+ setUiTheme: b,
655
+ setPreviewMode: x,
656
+ updateBlock: S,
657
+ updateSettings: C,
658
+ addBlock: w,
659
+ removeBlock: T,
660
+ moveBlock: E,
661
+ create: D,
662
+ load: O,
663
+ save: k,
664
+ createSnapshot: A,
665
+ hasTemplate: j,
666
+ markDirty: M,
667
+ ensureCanvasPages: N,
668
+ switchCanvasPage: P,
669
+ addCanvasPage: F,
670
+ removeCanvasPage: I,
671
+ renameCanvasPage: L,
672
+ switchToNextCanvasPage: R,
673
+ switchToPreviousCanvasPage: z
616
674
  };
617
675
  }
618
- var S = 0;
619
- function C() {
620
- return `msg_${Date.now()}_${++S}`;
676
+ var C = 0;
677
+ function w() {
678
+ return `msg_${Date.now()}_${++C}`;
621
679
  }
622
- function w(t) {
623
- let { authManager: n, getTemplateId: r, onApply: i, onError: a } = t, o = e([]), s = e(!1), c = e(!1), u = e(null), d = e(null), f = e(null), p = e(null), m = e(null), h = e(null), _ = e(!1), v = e([]), y = e(!1);
680
+ function T(e) {
681
+ let { authManager: t, getTemplateId: n, onApply: r, onError: a } = e, o = i([]), s = i(!1), c = i(!1), l = i(null), d = i(null), f = i(null), p = i(null), m = i(null), h = i(null), g = i(!1), v = i([]), y = i(!1);
624
682
  function b(e, t) {
625
683
  let n = o.value.findIndex((t) => t.id === e);
626
684
  if (n === -1) return;
@@ -635,15 +693,15 @@ function w(t) {
635
693
  ];
636
694
  }
637
695
  async function x() {
638
- let e = r();
696
+ let e = n();
639
697
  if (e) {
640
698
  c.value = !0;
641
699
  try {
642
- let t = l(g["ai.conversationMessages"], {
643
- project: n.projectId,
644
- tenant: n.tenantSlug,
700
+ let n = u(_["ai.conversationMessages"], {
701
+ project: t.projectId,
702
+ tenant: t.tenantSlug,
645
703
  template: e
646
- }), r = await n.authenticatedFetch(t, {
704
+ }), r = await t.authenticatedFetch(n, {
647
705
  method: "GET",
648
706
  headers: { Accept: "application/json" }
649
707
  });
@@ -660,16 +718,16 @@ function w(t) {
660
718
  }
661
719
  }
662
720
  }
663
- async function S(e, t) {
664
- let i = r();
721
+ async function S(e, r) {
722
+ let i = n();
665
723
  if (i) {
666
724
  y.value = !0;
667
725
  try {
668
- let r = l(g["ai.suggestions"], {
669
- project: n.projectId,
670
- tenant: n.tenantSlug,
726
+ let n = u(_["ai.suggestions"], {
727
+ project: t.projectId,
728
+ tenant: t.tenantSlug,
671
729
  template: i
672
- }), a = await n.authenticatedFetch(r, {
730
+ }), a = await t.authenticatedFetch(n, {
673
731
  method: "POST",
674
732
  headers: {
675
733
  "Content-Type": "application/json",
@@ -677,7 +735,7 @@ function w(t) {
677
735
  },
678
736
  body: JSON.stringify({
679
737
  current_content: e,
680
- merge_tags: t.map((e) => ({
738
+ merge_tags: r.map((e) => ({
681
739
  label: e.label,
682
740
  value: e.value
683
741
  }))
@@ -709,18 +767,18 @@ function w(t) {
709
767
  }
710
768
  }
711
769
  }
712
- async function w(e, t, c) {
713
- let y = r();
770
+ async function C(e, i, c) {
771
+ let y = n();
714
772
  if (!y) throw Error("Template must be saved before using AI generation");
715
- s.value = !0, u.value = null, d.value = null, v.value = [];
716
- let x = C();
773
+ s.value = !0, l.value = null, d.value = null, v.value = [];
774
+ let x = w();
717
775
  o.value = [...o.value, {
718
776
  id: x,
719
777
  role: "user",
720
778
  content: e,
721
779
  timestamp: Date.now()
722
780
  }];
723
- let S = C();
781
+ let S = w();
724
782
  o.value = [...o.value, {
725
783
  id: S,
726
784
  role: "assistant",
@@ -728,11 +786,11 @@ function w(t) {
728
786
  timestamp: Date.now()
729
787
  }];
730
788
  try {
731
- let r = l(g["ai.generate"], {
732
- project: n.projectId,
733
- tenant: n.tenantSlug,
789
+ let n = u(_["ai.generate"], {
790
+ project: t.projectId,
791
+ tenant: t.tenantSlug,
734
792
  template: y
735
- }), a = await n.authenticatedFetch(r, {
793
+ }), a = await t.authenticatedFetch(n, {
736
794
  method: "POST",
737
795
  headers: {
738
796
  "Content-Type": "application/json",
@@ -740,7 +798,7 @@ function w(t) {
740
798
  },
741
799
  body: JSON.stringify({
742
800
  prompt: e,
743
- current_content: t,
801
+ current_content: i,
744
802
  merge_tags: c.map((e) => ({
745
803
  label: e.label,
746
804
  value: e.value
@@ -757,22 +815,22 @@ function w(t) {
757
815
  let d = new TextDecoder(), v = "", x = null;
758
816
  try {
759
817
  for (;;) {
760
- let { done: e, value: n } = await s.read();
818
+ let { done: e, value: t } = await s.read();
761
819
  if (e) break;
762
- v += d.decode(n, { stream: !0 });
763
- let r = v.split("\n");
764
- v = r.pop() ?? "";
765
- for (let e of r) {
820
+ v += d.decode(t, { stream: !0 });
821
+ let n = v.split("\n");
822
+ v = n.pop() ?? "";
823
+ for (let e of n) {
766
824
  if (!e.startsWith("data: ")) continue;
767
- let n = e.slice(6), r;
825
+ let t = e.slice(6), n;
768
826
  try {
769
- r = JSON.parse(n);
827
+ n = JSON.parse(t);
770
828
  } catch {
771
829
  continue;
772
830
  }
773
- if (r.type === "text") b(S, { content: (o.value.find((e) => e.id === S)?.content ?? "") + r.text });
774
- else if (r.type === "error") throw Error(r.message || "Failed to generate template");
775
- else r.type === "done" && (r.conversation_id && (f.value = r.conversation_id), b(S, { content: r.text }), x = r.content ?? null, x ? (m.value = t, h.value = x, p.value = S, _.value = !1, i?.(x)) : u.value = "ai_apply_failed");
831
+ if (n.type === "text") b(S, { content: (o.value.find((e) => e.id === S)?.content ?? "") + n.text });
832
+ else if (n.type === "error") throw Error(n.message || "Failed to generate template");
833
+ else n.type === "done" && (n.conversation_id && (f.value = n.conversation_id), b(S, { content: n.text }), x = n.content ?? null, x ? (m.value = i, h.value = x, p.value = S, g.value = !1, r?.(x)) : l.value = "ai_apply_failed");
776
834
  }
777
835
  }
778
836
  } finally {
@@ -781,55 +839,55 @@ function w(t) {
781
839
  return x;
782
840
  } catch (t) {
783
841
  let n = t instanceof Error ? t : Error("Failed to generate template", { cause: t });
784
- return u.value = n.message, d.value = e, a?.(n), o.value = o.value.filter((e) => e.id !== x && e.id !== S), null;
842
+ return l.value = n.message, d.value = e, a?.(n), o.value = o.value.filter((e) => e.id !== x && e.id !== S), null;
785
843
  } finally {
786
844
  s.value = !1;
787
845
  }
788
846
  }
789
847
  function T() {
790
- _.value ? (h.value && i?.(h.value), _.value = !1) : (m.value && i?.(m.value), _.value = !0);
848
+ g.value ? (h.value && r?.(h.value), g.value = !1) : (m.value && r?.(m.value), g.value = !0);
791
849
  }
792
850
  function E() {
793
- o.value = [], f.value = null, u.value = null, p.value = null, m.value = null, h.value = null, _.value = !1;
851
+ o.value = [], f.value = null, l.value = null, p.value = null, m.value = null, h.value = null, g.value = !1;
794
852
  }
795
853
  return {
796
854
  messages: o,
797
855
  isGenerating: s,
798
856
  isLoadingHistory: c,
799
- isLastChangeReverted: _,
857
+ isLastChangeReverted: g,
800
858
  lastApplyMessageId: p,
801
- error: u,
859
+ error: l,
802
860
  failedPrompt: d,
803
861
  suggestions: v,
804
862
  isLoadingSuggestions: y,
805
- sendPrompt: w,
863
+ sendPrompt: C,
806
864
  toggleLastRevert: T,
807
865
  loadConversation: x,
808
866
  loadSuggestions: S,
809
867
  clearChat: E
810
868
  };
811
869
  }
812
- function T(e) {
870
+ function E(e) {
813
871
  function t(t) {
814
872
  return e === !1 ? !1 : e?.[t] !== !1;
815
873
  }
816
874
  return {
817
875
  isFeatureEnabled: t,
818
- hasAnyMenuFeature: i(() => t("chat") || t("scoring") || t("designToTemplate"))
876
+ hasAnyMenuFeature: a(() => t("chat") || t("scoring") || t("designToTemplate"))
819
877
  };
820
878
  }
821
- function E(t) {
822
- let { authManager: n, getTemplateId: r } = t, i = e(!1), a = e(null), o = e(null), s = e(null), c = e(""), u = e(null);
823
- async function d(e, t) {
824
- let s = r();
879
+ function D(e) {
880
+ let { authManager: t, getTemplateId: n } = e, r = i(!1), a = i(null), o = i(null), s = i(null), c = i(""), l = i(null);
881
+ async function d(e, i) {
882
+ let s = n();
825
883
  if (!s) return null;
826
- i.value = !0, o.value = null, a.value = null;
884
+ r.value = !0, o.value = null, a.value = null;
827
885
  try {
828
- let r = l(g["ai.score"], {
829
- project: n.projectId,
830
- tenant: n.tenantSlug,
886
+ let n = u(_["ai.score"], {
887
+ project: t.projectId,
888
+ tenant: t.tenantSlug,
831
889
  template: s
832
- }), i = await n.authenticatedFetch(r, {
890
+ }), r = await t.authenticatedFetch(n, {
833
891
  method: "POST",
834
892
  headers: {
835
893
  "Content-Type": "application/json",
@@ -837,26 +895,26 @@ function E(t) {
837
895
  },
838
896
  body: JSON.stringify({
839
897
  current_content: e,
840
- merge_tags: t.map((e) => ({
898
+ merge_tags: i.map((e) => ({
841
899
  label: e.label,
842
900
  value: e.value
843
901
  }))
844
902
  })
845
903
  });
846
- if (!i.ok) {
847
- if (i.status === 403) throw Error("ai_generation_not_available");
848
- let e = await i.json().catch(() => null);
904
+ if (!r.ok) {
905
+ if (r.status === 403) throw Error("ai_generation_not_available");
906
+ let e = await r.json().catch(() => null);
849
907
  throw Error(e?.message || "Failed to score template");
850
908
  }
851
- let o = i.body?.getReader();
909
+ let o = r.body?.getReader();
852
910
  if (!o) throw Error("Failed to read stream");
853
- let c = new TextDecoder(), u = "", d = null;
911
+ let c = new TextDecoder(), l = "", d = null;
854
912
  for (;;) {
855
913
  let { done: e, value: t } = await o.read();
856
914
  if (e) break;
857
- u += c.decode(t, { stream: !0 });
858
- let n = u.split("\n");
859
- u = n.pop() ?? "";
915
+ l += c.decode(t, { stream: !0 });
916
+ let n = l.split("\n");
917
+ l = n.pop() ?? "";
860
918
  for (let e of n) {
861
919
  if (!e.startsWith("data: ")) continue;
862
920
  let t;
@@ -874,19 +932,19 @@ function E(t) {
874
932
  } catch (e) {
875
933
  return o.value = e instanceof Error ? e.message : "Failed to score template", null;
876
934
  } finally {
877
- i.value = !1;
935
+ r.value = !1;
878
936
  }
879
937
  }
880
- async function f(e, t, i) {
881
- let a = r();
938
+ async function f(e, r, i) {
939
+ let a = n();
882
940
  if (!a) return null;
883
- s.value = t.id, c.value = "", u.value = null;
941
+ s.value = r.id, c.value = "", l.value = null;
884
942
  try {
885
- let r = l(g["ai.fixFinding"], {
886
- project: n.projectId,
887
- tenant: n.tenantSlug,
943
+ let n = u(_["ai.fixFinding"], {
944
+ project: t.projectId,
945
+ tenant: t.tenantSlug,
888
946
  template: a
889
- }), o = await n.authenticatedFetch(r, {
947
+ }), o = await t.authenticatedFetch(n, {
890
948
  method: "POST",
891
949
  headers: {
892
950
  "Content-Type": "application/json",
@@ -895,10 +953,10 @@ function E(t) {
895
953
  body: JSON.stringify({
896
954
  content: e,
897
955
  finding: {
898
- id: t.id,
899
- message: t.message,
900
- suggestion: t.suggestion,
901
- category: t.category
956
+ id: r.id,
957
+ message: r.message,
958
+ suggestion: r.suggestion,
959
+ category: r.category
902
960
  },
903
961
  merge_tags: i.map((e) => ({
904
962
  label: e.label,
@@ -913,11 +971,11 @@ function E(t) {
913
971
  }
914
972
  let s = o.body?.getReader();
915
973
  if (!s) throw Error("Failed to read stream");
916
- let u = new TextDecoder(), d = "", f = null;
974
+ let l = new TextDecoder(), d = "", f = null;
917
975
  for (;;) {
918
976
  let { done: e, value: t } = await s.read();
919
977
  if (e) break;
920
- d += u.decode(t, { stream: !0 });
978
+ d += l.decode(t, { stream: !0 });
921
979
  let n = d.split("\n");
922
980
  d = n.pop() ?? "";
923
981
  for (let e of n) {
@@ -935,7 +993,7 @@ function E(t) {
935
993
  }
936
994
  return f;
937
995
  } catch (e) {
938
- return u.value = e instanceof Error ? e.message : "Failed to fix finding", null;
996
+ return l.value = e instanceof Error ? e.message : "Failed to fix finding", null;
939
997
  } finally {
940
998
  s.value = null;
941
999
  }
@@ -946,38 +1004,38 @@ function E(t) {
946
1004
  n && (n.findings = n.findings.filter((e) => e.id !== t));
947
1005
  }
948
1006
  function m() {
949
- i.value = !1, a.value = null, o.value = null, s.value = null, c.value = "", u.value = null;
1007
+ r.value = !1, a.value = null, o.value = null, s.value = null, c.value = "", l.value = null;
950
1008
  }
951
1009
  return {
952
- isScoring: i,
1010
+ isScoring: r,
953
1011
  scoringResult: a,
954
1012
  error: o,
955
1013
  fixingFindingId: s,
956
1014
  fixStreamingText: c,
957
- fixError: u,
1015
+ fixError: l,
958
1016
  score: d,
959
1017
  fixFinding: f,
960
1018
  removeFinding: p,
961
1019
  reset: m
962
1020
  };
963
1021
  }
964
- function D(t) {
965
- let { authManager: n, getTemplateId: r, onApply: i, onError: a } = t, o = e(!1), s = e(null);
1022
+ function O(e) {
1023
+ let { authManager: t, getTemplateId: n, onApply: r, onError: a } = e, o = i(!1), s = i(null);
966
1024
  async function c(e) {
967
- let t = r();
968
- if (!t) throw Error("Template must be saved before using design reference");
1025
+ let i = n();
1026
+ if (!i) throw Error("Template must be saved before using design reference");
969
1027
  o.value = !0, s.value = null;
970
1028
  try {
971
- let r = new FormData();
972
- e.prompt && r.append("prompt", e.prompt), e.imageUpload && r.append("image_upload", e.imageUpload), e.pdfUpload && r.append("pdf_upload", e.pdfUpload);
973
- let a = l(g["ai.generateFromDesign"], {
974
- project: n.projectId,
975
- tenant: n.tenantSlug,
976
- template: t
977
- }), o = await n.authenticatedFetch(a, {
1029
+ let n = new FormData();
1030
+ e.prompt && n.append("prompt", e.prompt), e.imageUpload && n.append("image_upload", e.imageUpload), e.pdfUpload && n.append("pdf_upload", e.pdfUpload);
1031
+ let a = u(_["ai.generateFromDesign"], {
1032
+ project: t.projectId,
1033
+ tenant: t.tenantSlug,
1034
+ template: i
1035
+ }), o = await t.authenticatedFetch(a, {
978
1036
  method: "POST",
979
1037
  headers: { Accept: "text/event-stream" },
980
- body: r
1038
+ body: n
981
1039
  });
982
1040
  if (!o.ok) {
983
1041
  let e = await o.json().catch(() => null);
@@ -985,13 +1043,13 @@ function D(t) {
985
1043
  }
986
1044
  let s = o.body?.getReader();
987
1045
  if (!s) throw Error("Failed to read stream");
988
- let c = new TextDecoder(), u = "", d = null;
1046
+ let c = new TextDecoder(), l = "", d = null;
989
1047
  for (;;) {
990
1048
  let { done: e, value: t } = await s.read();
991
1049
  if (e) break;
992
- u += c.decode(t, { stream: !0 });
993
- let n = u.split("\n");
994
- u = n.pop() ?? "";
1050
+ l += c.decode(t, { stream: !0 });
1051
+ let n = l.split("\n");
1052
+ l = n.pop() ?? "";
995
1053
  for (let e of n) {
996
1054
  if (!e.startsWith("data: ")) continue;
997
1055
  let t = e.slice(6), n;
@@ -1001,7 +1059,7 @@ function D(t) {
1001
1059
  continue;
1002
1060
  }
1003
1061
  if (n.type === "error") throw Error(n.message || "Failed to generate template from design");
1004
- n.type === "done" && (d = n.content ?? null, d && i?.(d));
1062
+ n.type === "done" && (d = n.content ?? null, d && r?.(d));
1005
1063
  }
1006
1064
  }
1007
1065
  return d;
@@ -1012,28 +1070,28 @@ function D(t) {
1012
1070
  o.value = !1;
1013
1071
  }
1014
1072
  }
1015
- function u() {
1073
+ function l() {
1016
1074
  o.value = !1, s.value = null;
1017
1075
  }
1018
1076
  return {
1019
1077
  isGenerating: o,
1020
1078
  error: s,
1021
1079
  generate: c,
1022
- reset: u
1080
+ reset: l
1023
1081
  };
1024
1082
  }
1025
- function O(t) {
1026
- let { authManager: n, getTemplateId: r, getSocketId: a, onComment: o, onError: s, hasCommentingFeature: c } = t, l = new _(n), u = e([]), d = e(!1), f = e(!1), p = i(() => (c?.() ?? !1) && n.userConfig !== null), m = i(() => {
1083
+ function k(e) {
1084
+ let { authManager: t, getTemplateId: n, getSocketId: r, onComment: o, onError: s, hasCommentingFeature: c } = e, l = new v(t), u = i([]), d = i(!1), f = i(!1), p = a(() => (c?.() ?? !1) && t.userConfig !== null), m = a(() => {
1027
1085
  let e = 0;
1028
1086
  for (let t of u.value) e += 1 + (t.replies?.length ?? 0);
1029
1087
  return e;
1030
- }), h = i(() => u.value.filter((e) => !e.resolved_at).length), g = i(() => {
1088
+ }), h = a(() => u.value.filter((e) => !e.resolved_at).length), g = a(() => {
1031
1089
  let e = /* @__PURE__ */ new Map();
1032
1090
  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));
1033
1091
  return e;
1034
1092
  });
1035
- function v() {
1036
- let e = n.userConfig;
1093
+ function _() {
1094
+ let e = t.userConfig;
1037
1095
  if (!e) throw Error("User config not available");
1038
1096
  return {
1039
1097
  user_id: e.id,
@@ -1042,7 +1100,7 @@ function O(t) {
1042
1100
  };
1043
1101
  }
1044
1102
  function y() {
1045
- let e = a?.();
1103
+ let e = r?.();
1046
1104
  if (e) return { "X-Socket-ID": e };
1047
1105
  }
1048
1106
  function b(e, t) {
@@ -1059,7 +1117,7 @@ function O(t) {
1059
1117
  return null;
1060
1118
  }
1061
1119
  async function S() {
1062
- let e = r();
1120
+ let e = n();
1063
1121
  if (e) {
1064
1122
  d.value = !0;
1065
1123
  try {
@@ -1072,22 +1130,22 @@ function O(t) {
1072
1130
  }
1073
1131
  }
1074
1132
  }
1075
- async function C(e, t, n) {
1076
- let i = r();
1133
+ async function C(e, t, r) {
1134
+ let i = n();
1077
1135
  if (!i) return null;
1078
1136
  f.value = !0;
1079
1137
  try {
1080
- let r = await l.createComment(i, {
1138
+ let n = await l.createComment(i, {
1081
1139
  body: e,
1082
1140
  block_id: t,
1083
- parent_id: n,
1084
- ...v()
1141
+ parent_id: r,
1142
+ ..._()
1085
1143
  }, y());
1086
- if (n) {
1087
- let e = x(n);
1088
- e && (e.replies = [...e.replies ?? [], r]);
1089
- } else u.value = [...u.value, r];
1090
- return b("created", r), r;
1144
+ if (r) {
1145
+ let e = x(r);
1146
+ e && (e.replies = [...e.replies ?? [], n]);
1147
+ } else u.value = [...u.value, n];
1148
+ return b("created", n), n;
1091
1149
  } catch (e) {
1092
1150
  let t = e instanceof Error ? e : Error("Failed to create comment", { cause: e });
1093
1151
  return s?.(t), null;
@@ -1096,15 +1154,15 @@ function O(t) {
1096
1154
  }
1097
1155
  }
1098
1156
  async function w(e, t) {
1099
- let n = r();
1100
- if (!n) return null;
1157
+ let r = n();
1158
+ if (!r) return null;
1101
1159
  f.value = !0;
1102
1160
  try {
1103
- let r = await l.updateComment(n, e, {
1161
+ let n = await l.updateComment(r, e, {
1104
1162
  body: t,
1105
- ...v()
1163
+ ..._()
1106
1164
  }, y());
1107
- return A(e, r), b("updated", r), r;
1165
+ return A(e, n), b("updated", n), n;
1108
1166
  } catch (e) {
1109
1167
  let t = e instanceof Error ? e : Error("Failed to update comment", { cause: e });
1110
1168
  return s?.(t), null;
@@ -1113,18 +1171,18 @@ function O(t) {
1113
1171
  }
1114
1172
  }
1115
1173
  async function T(e) {
1116
- let t = r();
1174
+ let t = n();
1117
1175
  if (!t) return !1;
1118
- let n = x(e);
1119
- if (!n) return !1;
1176
+ let r = x(e);
1177
+ if (!r) return !1;
1120
1178
  let i = {
1121
- ...n,
1122
- replies: [...n.replies ?? []]
1179
+ ...r,
1180
+ replies: [...r.replies ?? []]
1123
1181
  };
1124
1182
  f.value = !0;
1125
1183
  try {
1126
- if (await l.deleteComment(t, e, v(), y()), n.parent_id) {
1127
- let t = x(n.parent_id);
1184
+ if (await l.deleteComment(t, e, _(), y()), r.parent_id) {
1185
+ let t = x(r.parent_id);
1128
1186
  t && (t.replies = (t.replies ?? []).filter((t) => t.id !== e));
1129
1187
  } else u.value = u.value.filter((t) => t.id !== e);
1130
1188
  return b("deleted", i), !0;
@@ -1136,11 +1194,11 @@ function O(t) {
1136
1194
  }
1137
1195
  }
1138
1196
  async function E(e) {
1139
- let t = r();
1197
+ let t = n();
1140
1198
  if (!t) return null;
1141
1199
  f.value = !0;
1142
1200
  try {
1143
- let n = await l.resolveComment(t, e, v(), y());
1201
+ let n = await l.resolveComment(t, e, _(), y());
1144
1202
  return A(e, n), b(n.resolved_at ? "resolved" : "unresolved", n), n;
1145
1203
  } catch (e) {
1146
1204
  let t = e instanceof Error ? e : Error("Failed to toggle comment resolution", { cause: e });
@@ -1220,17 +1278,17 @@ function O(t) {
1220
1278
  applyRemoteDelete: k
1221
1279
  };
1222
1280
  }
1223
- function k(e) {
1224
- let { comments: t, channel: r } = e;
1225
- a(r, (e, n) => {
1281
+ function A(e) {
1282
+ let { comments: t, channel: i } = e;
1283
+ n(i, (e, n) => {
1226
1284
  n && n.unbind("comment-broadcast"), e && e.bind("comment-broadcast", (e) => {
1227
- A(t, e);
1285
+ j(t, e);
1228
1286
  });
1229
- }), n(() => {
1230
- r.value?.unbind("comment-broadcast");
1287
+ }), r(() => {
1288
+ i.value?.unbind("comment-broadcast");
1231
1289
  });
1232
1290
  }
1233
- function A(e, t) {
1291
+ function j(e, t) {
1234
1292
  switch (t.action) {
1235
1293
  case "comment_created":
1236
1294
  e.applyRemoteCreate(t.comment);
@@ -1247,7 +1305,7 @@ function A(e, t) {
1247
1305
  break;
1248
1306
  }
1249
1307
  }
1250
- var j = [
1308
+ var M = [
1251
1309
  "pusher:member_added",
1252
1310
  "pusher:member_removed",
1253
1311
  "client-block_locked",
@@ -1255,10 +1313,10 @@ var j = [
1255
1313
  "client-operation",
1256
1314
  "mcp-operation"
1257
1315
  ];
1258
- function M(e) {
1259
- for (let t of j) e.unbind(t);
1316
+ function N(e) {
1317
+ for (let t of M) e.unbind(t);
1260
1318
  }
1261
- var N = [
1319
+ var P = [
1262
1320
  "#3b82f6",
1263
1321
  "#ef4444",
1264
1322
  "#10b981",
@@ -1270,10 +1328,10 @@ var N = [
1270
1328
  "#6366f1",
1271
1329
  "#14b8a6"
1272
1330
  ];
1273
- function P(t) {
1274
- let { authManager: r, editor: o, channel: s } = t, c = e([]), l = e(/* @__PURE__ */ new Map()), u = 0, d = !1, f = i(() => r.userConfig?.id ?? "");
1331
+ function F(e) {
1332
+ let { authManager: t, editor: o, channel: s } = e, c = i([]), l = i(/* @__PURE__ */ new Map()), u = 0, d = !1, f = a(() => t.userConfig?.id ?? "");
1275
1333
  function p() {
1276
- let e = N[u % N.length];
1334
+ let e = P[u % P.length];
1277
1335
  return u++, e;
1278
1336
  }
1279
1337
  function m(e) {
@@ -1315,7 +1373,7 @@ function P(t) {
1315
1373
  function v(e) {
1316
1374
  d = !0;
1317
1375
  try {
1318
- b(o, e);
1376
+ x(o, e);
1319
1377
  } finally {
1320
1378
  d = !1;
1321
1379
  }
@@ -1323,7 +1381,7 @@ function P(t) {
1323
1381
  function y(e) {
1324
1382
  !s.value || d || s.value.trigger("client-operation", e);
1325
1383
  }
1326
- function x(e) {
1384
+ function b(e) {
1327
1385
  s.value && s.value.trigger("client-block_locked", {
1328
1386
  blockId: e,
1329
1387
  userId: f.value
@@ -1332,42 +1390,42 @@ function P(t) {
1332
1390
  function S(e) {
1333
1391
  s.value && s.value.trigger("client-block_unlocked", { blockId: e });
1334
1392
  }
1335
- return a(() => o.state.selectedBlockId, (e, t) => {
1336
- d || (t && S(t), e && x(e));
1337
- }), a(s, (e, n) => {
1338
- if (n && M(n), !e) {
1393
+ return n(() => o.state.selectedBlockId, (e, t) => {
1394
+ d || (t && S(t), e && b(e));
1395
+ }), n(s, (t, n) => {
1396
+ if (n && N(n), !t) {
1339
1397
  c.value = [], l.value = /* @__PURE__ */ new Map(), u = 0;
1340
1398
  return;
1341
1399
  }
1342
- let r = e.members;
1400
+ let r = t.members;
1343
1401
  r && r.each((e) => {
1344
1402
  m(e.info);
1345
- }), e.bind("pusher:member_added", (e) => {
1346
- let n = m(e.info);
1347
- n && t.onCollaboratorJoined?.(n);
1348
- }), e.bind("pusher:member_removed", (e) => {
1349
- let n = c.value.find((t) => t.id === e.id);
1350
- h(e.id), n && t.onCollaboratorLeft?.(n);
1351
- }), e.bind("client-block_locked", (e) => {
1352
- g(e);
1353
- let n = c.value.find((t) => t.id === e.userId);
1354
- n && t.onBlockLocked?.({
1355
- blockId: e.blockId,
1403
+ }), t.bind("pusher:member_added", (t) => {
1404
+ let n = m(t.info);
1405
+ n && e.onCollaboratorJoined?.(n);
1406
+ }), t.bind("pusher:member_removed", (t) => {
1407
+ let n = c.value.find((e) => e.id === t.id);
1408
+ h(t.id), n && e.onCollaboratorLeft?.(n);
1409
+ }), t.bind("client-block_locked", (t) => {
1410
+ g(t);
1411
+ let n = c.value.find((e) => e.id === t.userId);
1412
+ n && e.onBlockLocked?.({
1413
+ blockId: t.blockId,
1356
1414
  collaborator: n
1357
1415
  });
1358
- }), e.bind("client-block_unlocked", (e) => {
1359
- let n = l.value.get(e.blockId);
1360
- _(e), n && t.onBlockUnlocked?.({
1361
- blockId: e.blockId,
1416
+ }), t.bind("client-block_unlocked", (t) => {
1417
+ let n = l.value.get(t.blockId);
1418
+ _(t), n && e.onBlockUnlocked?.({
1419
+ blockId: t.blockId,
1362
1420
  collaborator: n
1363
1421
  });
1364
- }), e.bind("client-operation", (e) => {
1422
+ }), t.bind("client-operation", (e) => {
1365
1423
  v(e);
1366
- }), e.bind("mcp-operation", (e) => {
1424
+ }), t.bind("mcp-operation", (e) => {
1367
1425
  v(e);
1368
1426
  });
1369
- }), n(() => {
1370
- s.value && M(s.value);
1427
+ }), r(() => {
1428
+ s.value && N(s.value);
1371
1429
  }), {
1372
1430
  collaborators: c,
1373
1431
  lockedBlocks: l,
@@ -1375,7 +1433,7 @@ function P(t) {
1375
1433
  _isProcessingRemoteOperation: () => d
1376
1434
  };
1377
1435
  }
1378
- function F(e, t) {
1436
+ function I(e, t) {
1379
1437
  let n = e.addBlock, r = e.updateBlock, i = e.removeBlock, a = e.moveBlock, o = e.updateSettings, s = e.setContent;
1380
1438
  e.addBlock = (e, r, i) => {
1381
1439
  n(e, r, i), t._broadcastOperation({
@@ -1427,121 +1485,121 @@ function F(e, t) {
1427
1485
  });
1428
1486
  };
1429
1487
  }
1430
- function I(t) {
1431
- let { authManager: n, onError: r } = t, i = e(null), a = e(!1), o = null, s = null;
1432
- async function c(e, t) {
1488
+ function L(e) {
1489
+ let { authManager: t, onError: n } = e, r = i(null), a = i(!1), o = null, s = null;
1490
+ async function c(e, i) {
1433
1491
  if (o) return;
1434
- o = new y({
1435
- authManager: n,
1436
- config: t,
1437
- onError: r
1492
+ o = new b({
1493
+ authManager: t,
1494
+ config: i,
1495
+ onError: n
1438
1496
  }), await o.connect(), s = `presence-template.${e}`;
1439
1497
  let c = o.subscribePresence(s);
1440
1498
  c.bind("pusher:subscription_succeeded", () => {
1441
- a.value = !0, i.value = c;
1499
+ a.value = !0, r.value = c;
1442
1500
  }), c.bind("pusher:subscription_error", (e) => {
1443
- a.value = !1, i.value = null, r?.(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to subscribe to template channel"));
1501
+ a.value = !1, r.value = null, n?.(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to subscribe to template channel"));
1444
1502
  });
1445
1503
  }
1446
1504
  function l() {
1447
- s && o && o.unsubscribe(s), o?.disconnect(), o = null, s = null, i.value = null, a.value = !1;
1505
+ s && o && o.unsubscribe(s), o?.disconnect(), o = null, s = null, r.value = null, a.value = !1;
1448
1506
  }
1449
1507
  function u() {
1450
1508
  return o?.getSocketId() ?? null;
1451
1509
  }
1452
1510
  return {
1453
- channel: i,
1511
+ channel: r,
1454
1512
  isConnected: a,
1455
1513
  connect: c,
1456
1514
  disconnect: l,
1457
1515
  getSocketId: u
1458
1516
  };
1459
1517
  }
1460
- function L(t) {
1461
- let n = new _(t.authManager), r = e([]), i = e(!1);
1462
- async function a(e) {
1463
- i.value = !0;
1518
+ function R(e) {
1519
+ let t = new v(e.authManager), n = i([]), r = i(!1);
1520
+ async function a(i) {
1521
+ r.value = !0;
1464
1522
  try {
1465
- r.value = await n.listModules(e);
1466
- } catch (e) {
1467
- throw t.onError?.(e), e;
1523
+ n.value = await t.listModules(i);
1524
+ } catch (t) {
1525
+ throw e.onError?.(t), t;
1468
1526
  } finally {
1469
- i.value = !1;
1527
+ r.value = !1;
1470
1528
  }
1471
1529
  }
1472
- async function o(e, i) {
1530
+ async function o(r, i) {
1473
1531
  try {
1474
- let t = await n.createModule({
1475
- name: e,
1532
+ let e = await t.createModule({
1533
+ name: r,
1476
1534
  content: i
1477
1535
  });
1478
- return r.value = [t, ...r.value], t;
1479
- } catch (e) {
1480
- throw t.onError?.(e), e;
1536
+ return n.value = [e, ...n.value], e;
1537
+ } catch (t) {
1538
+ throw e.onError?.(t), t;
1481
1539
  }
1482
1540
  }
1483
- async function s(e, i) {
1541
+ async function s(r, i) {
1484
1542
  try {
1485
- let t = await n.updateModule(e, i);
1486
- return r.value = r.value.map((n) => n.id === e ? t : n), t;
1487
- } catch (e) {
1488
- throw t.onError?.(e), e;
1543
+ let e = await t.updateModule(r, i);
1544
+ return n.value = n.value.map((t) => t.id === r ? e : t), e;
1545
+ } catch (t) {
1546
+ throw e.onError?.(t), t;
1489
1547
  }
1490
1548
  }
1491
- async function c(e) {
1549
+ async function c(r) {
1492
1550
  try {
1493
- await n.deleteModule(e), r.value = r.value.filter((t) => t.id !== e);
1494
- } catch (e) {
1495
- throw t.onError?.(e), e;
1551
+ await t.deleteModule(r), n.value = n.value.filter((e) => e.id !== r);
1552
+ } catch (t) {
1553
+ throw e.onError?.(t), t;
1496
1554
  }
1497
1555
  }
1498
1556
  return {
1499
- modules: r,
1500
- isLoading: i,
1557
+ modules: n,
1558
+ isLoading: r,
1501
1559
  loadModules: a,
1502
1560
  createModule: o,
1503
1561
  updateModule: s,
1504
1562
  deleteModule: c
1505
1563
  };
1506
1564
  }
1507
- function R(t) {
1508
- let n = new _(t.authManager), r = e([]), i = e(!1), a = e(!1);
1565
+ function z(e) {
1566
+ let t = new v(e.authManager), n = i([]), r = i(!1), a = i(!1);
1509
1567
  async function o() {
1510
- i.value = !0;
1568
+ r.value = !0;
1511
1569
  try {
1512
- r.value = await n.getSnapshots(t.templateId);
1513
- } catch (e) {
1514
- throw t.onError?.(e), e;
1570
+ n.value = await t.getSnapshots(e.templateId);
1571
+ } catch (t) {
1572
+ throw e.onError?.(t), t;
1515
1573
  } finally {
1516
- i.value = !1;
1574
+ r.value = !1;
1517
1575
  }
1518
1576
  }
1519
- async function s(e) {
1577
+ async function s(n) {
1520
1578
  a.value = !0;
1521
1579
  try {
1522
- let r = await n.restoreSnapshot(t.templateId, e);
1523
- return t.onRestore?.(r), r;
1524
- } catch (e) {
1525
- throw t.onError?.(e), e;
1580
+ let r = await t.restoreSnapshot(e.templateId, n);
1581
+ return e.onRestore?.(r), r;
1582
+ } catch (t) {
1583
+ throw e.onError?.(t), t;
1526
1584
  } finally {
1527
1585
  a.value = !1;
1528
1586
  }
1529
1587
  }
1530
1588
  return {
1531
- snapshots: r,
1532
- isLoading: i,
1589
+ snapshots: n,
1590
+ isLoading: r,
1533
1591
  isRestoring: a,
1534
1592
  loadSnapshots: o,
1535
1593
  restoreSnapshot: s
1536
1594
  };
1537
1595
  }
1538
- function z(t) {
1539
- let { authManager: n, getTemplateId: r, save: o, exportHtml: s, onError: c, isAuthReady: l, onBeforeTestEmail: u } = t, d = new _(n), f = e(!1), p = e(null), m = e(null);
1540
- l && a(l, (e) => {
1541
- e && (m.value = n.testEmailConfig);
1596
+ function B(e) {
1597
+ let { authManager: t, getTemplateId: r, save: o, exportHtml: s, onError: c, isAuthReady: l, onBeforeTestEmail: u } = e, d = new v(t), f = i(!1), p = i(null), m = i(null);
1598
+ l && n(l, (e) => {
1599
+ e && (m.value = t.testEmailConfig);
1542
1600
  }, { immediate: !0 });
1543
- let h = i(() => m.value !== null), g = i(() => m.value?.allowedEmails ?? []);
1544
- async function v(e) {
1601
+ let h = a(() => m.value !== null), g = a(() => m.value?.allowedEmails ?? []);
1602
+ async function _(e) {
1545
1603
  if (!m.value) throw Error("Test email is not enabled for this project");
1546
1604
  let t = r();
1547
1605
  if (!t) throw Error("Template must be saved before sending a test email");
@@ -1567,11 +1625,11 @@ function z(t) {
1567
1625
  allowedEmails: g,
1568
1626
  isSending: f,
1569
1627
  error: p,
1570
- sendTestEmail: v
1628
+ sendTestEmail: _
1571
1629
  };
1572
1630
  }
1573
- function B(e) {
1574
- let { authManager: t, getFontsConfig: n, canUseCustomFonts: r } = e, i = new _(t);
1631
+ function V(e) {
1632
+ let { authManager: t, getFontsConfig: n, canUseCustomFonts: r } = e, i = new v(t);
1575
1633
  function a() {
1576
1634
  let e = n?.();
1577
1635
  return {
@@ -1595,39 +1653,39 @@ function B(e) {
1595
1653
  getMjmlSource: s
1596
1654
  };
1597
1655
  }
1598
- function V(t) {
1599
- let { authManager: n, onError: r } = t, a = e(null), o = e(!1), s = new _(n), c = i(() => a.value?.features ?? null);
1656
+ function H(e) {
1657
+ let { authManager: t, onError: n } = e, r = i(null), o = i(!1), s = new v(t), c = a(() => r.value?.features ?? null);
1600
1658
  function l(e) {
1601
- return a.value?.features[e] ?? !1;
1659
+ return r.value?.features[e] ?? !1;
1602
1660
  }
1603
1661
  async function u() {
1604
1662
  if (!o.value) {
1605
1663
  o.value = !0;
1606
1664
  try {
1607
- a.value = await s.fetchConfig();
1665
+ r.value = await s.fetchConfig();
1608
1666
  } catch (e) {
1609
- r?.(e instanceof Error ? e : Error("Failed to fetch config", { cause: e }));
1667
+ n?.(e instanceof Error ? e : Error("Failed to fetch config", { cause: e }));
1610
1668
  } finally {
1611
1669
  o.value = !1;
1612
1670
  }
1613
1671
  }
1614
1672
  }
1615
1673
  return {
1616
- config: a,
1674
+ config: r,
1617
1675
  isLoading: o,
1618
1676
  hasFeature: l,
1619
1677
  features: c,
1620
1678
  fetchConfig: u
1621
1679
  };
1622
1680
  }
1623
- var H = 5e3;
1624
- function U(e) {
1625
- return e.authManager ? e.authManager.resolveUrl(g.health) : `${(e.baseUrl ?? "https://templatical.com").replace(/\/$/, "")}${g.health}`;
1681
+ var U = 5e3;
1682
+ function W(e) {
1683
+ return e.authManager ? e.authManager.resolveUrl(_.health) : `${(e.baseUrl ?? "https://templatical.com").replace(/\/$/, "")}${_.health}`;
1626
1684
  }
1627
- async function W(e, t) {
1685
+ async function G(e, t) {
1628
1686
  let n = performance.now();
1629
1687
  try {
1630
- let r = t ? await t.authenticatedFetch(g.health, {
1688
+ let r = t ? await t.authenticatedFetch(_.health, {
1631
1689
  method: "GET",
1632
1690
  headers: { Accept: "application/json" }
1633
1691
  }) : await fetch(e, {
@@ -1676,7 +1734,7 @@ async function W(e, t) {
1676
1734
  };
1677
1735
  }
1678
1736
  }
1679
- async function G(e) {
1737
+ async function K(e) {
1680
1738
  if (!e?.host || !e?.app_key) return {
1681
1739
  ok: !1,
1682
1740
  error: "WebSocket configuration not available"
@@ -1692,7 +1750,7 @@ async function G(e) {
1692
1750
  ok: !1,
1693
1751
  error: "WebSocket connection timed out"
1694
1752
  });
1695
- }, H);
1753
+ }, U);
1696
1754
  try {
1697
1755
  n = new WebSocket(t);
1698
1756
  } catch (t) {
@@ -1712,8 +1770,8 @@ async function G(e) {
1712
1770
  };
1713
1771
  });
1714
1772
  }
1715
- async function K(e = {}) {
1716
- let t = await W(U(e), e.authManager), n = await G(t.wsConfig);
1773
+ async function q(e = {}) {
1774
+ let t = await G(W(e), e.authManager), n = await K(t.wsConfig);
1717
1775
  return {
1718
1776
  api: t.api,
1719
1777
  websocket: n,
@@ -1721,13 +1779,13 @@ async function K(e = {}) {
1721
1779
  overall: t.api.ok && t.auth.ok
1722
1780
  };
1723
1781
  }
1724
- function q(e) {
1725
- let { editor: t, channel: n, onOperation: r } = e;
1726
- a(n, (e, n) => {
1782
+ function J(e) {
1783
+ let { editor: t, channel: r, onOperation: i } = e;
1784
+ n(r, (e, n) => {
1727
1785
  n && n.unbind("mcp-operation"), e && e.bind("mcp-operation", (e) => {
1728
- b(t, e), r?.(e);
1786
+ x(t, e), i?.(e);
1729
1787
  });
1730
1788
  });
1731
1789
  }
1732
1790
  //#endregion
1733
- export { E as _, T as a, k as c, x as d, B as f, R as g, L as h, w as i, O as l, V as m, K as n, P as o, q as p, v as r, F as s, c as t, D as u, z as v, I as y };
1791
+ export { D as _, E as a, A as c, S as d, V as f, z as g, R as h, T as i, k as l, H as m, q as n, F as o, J as p, y as r, I as s, l as t, O as u, B as v, L as y };