@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.
- package/LICENSE +56 -0
- package/README.md +3 -3
- package/dist/{AccessibilityPanel-CvQGLdu6.js → AccessibilityPanel-EmQ19wiS.js} +37 -37
- package/dist/{AiChatSidebar-B3SJIKG_.js → AiChatSidebar-DeB0w_32.js} +67 -81
- package/dist/{AiFeatureMenu-BLLKoOos.js → AiFeatureMenu-DoLD5Cde.js} +22 -22
- package/dist/{BlockA11yBadge-CXDLqkcJ.js → BlockA11yBadge-DkNbDvJA.js} +12 -12
- package/dist/CloudEditor-zo9PjjvY.js +1214 -0
- package/dist/{CollaboratorBar-DuPYW5iF.js → CollaboratorBar-BsXMY-8e.js} +21 -21
- package/dist/CommentsSidebar-DIWIa4rS.js +436 -0
- package/dist/CountdownBlock-BCi7-DAM.js +92 -0
- package/dist/CountdownToolbar-BuS8p5ju.js +210 -0
- package/dist/{DesignReferenceSidebar-B8V_F2yF.js → DesignReferenceSidebar-RDlnhL-6.js} +58 -58
- package/dist/{LoadingTrack-B0CWFHXQ.js → LoadingTrack-BJ59h9ok.js} +2 -2
- package/dist/ModuleBrowserModal-b7HbpByz.js +206 -0
- package/dist/ModulePreviewCanvas-D__YlOLS.js +108 -0
- package/dist/{NumberWithSuffix-DkXUez9t.js → NumberWithSuffix-Ca3vNY84.js} +87 -87
- package/dist/{ParagraphEditor-D75wl3BX.js → ParagraphEditor-B1aYPO-6.js} +182 -182
- package/dist/{RichTextEditorContent-DYkIauIk.js → RichTextEditorContent-BmEVMrkJ.js} +38 -38
- package/dist/{SaveModuleDialog-FZ9lxY7_.js → SaveModuleDialog-ClovqI6h.js} +28 -28
- package/dist/{SnapshotHistory-BR3eV120.js → SnapshotHistory-DoqtH0cw.js} +45 -50
- package/dist/{TemplateScoringPanel-4GTNHej5.js → TemplateScoringPanel-DQv2ZAiL.js} +75 -75
- package/dist/{TestEmailModal--ue5w9fT.js → TestEmailModal-iIeYJYsj.js} +28 -28
- package/dist/{TitleEditor-fStSADI-.js → TitleEditor-CTDIwRF_.js} +68 -68
- package/dist/{TplModal-BwSfxIHf.js → TplModal-CBq1J1pG.js} +14 -14
- package/dist/{accessibility-e8JYu_zd.js → accessibility-BU09xZrQ.js} +1 -1
- package/dist/{blockTypeIcons-BcTrDjmH.js → blockTypeIcons-QkC6f5UE.js} +19 -5
- package/dist/bundle-stats.json +7 -7
- package/dist/cdn/chunks/{AccessibilityPanel-B6DOjojm.js → AccessibilityPanel-BeU8nz7A.js} +28 -28
- package/dist/cdn/chunks/{AccessibilityPanel-B6DOjojm.js.map → AccessibilityPanel-BeU8nz7A.js.map} +1 -1
- package/dist/cdn/chunks/{AiFeatureMenu-qEdB2fZJ.js → AiFeatureMenu-B2mhscyP.js} +21 -21
- package/dist/cdn/chunks/AiFeatureMenu-B2mhscyP.js.map +1 -0
- package/dist/cdn/chunks/{BlockA11yBadge-DcEZftf6.js → BlockA11yBadge-C4g77gF0.js} +11 -11
- package/dist/cdn/chunks/{BlockA11yBadge-DcEZftf6.js.map → BlockA11yBadge-C4g77gF0.js.map} +1 -1
- package/dist/{CloudEditor-BCz1ZTYC.js → cdn/chunks/CloudEditor-Btyr0b0_.js} +486 -475
- package/dist/cdn/chunks/CloudEditor-Btyr0b0_.js.map +1 -0
- package/dist/cdn/chunks/{CollaboratorBar--nO7TX6b.js → CollaboratorBar-YBiIjiRh.js} +15 -15
- package/dist/cdn/chunks/CollaboratorBar-YBiIjiRh.js.map +1 -0
- package/dist/cdn/chunks/CountdownBlock-B06UZoWe.js +93 -0
- package/dist/cdn/chunks/CountdownBlock-B06UZoWe.js.map +1 -0
- package/dist/cdn/chunks/CountdownToolbar-C9XZr33O.js +212 -0
- package/dist/cdn/chunks/CountdownToolbar-C9XZr33O.js.map +1 -0
- package/dist/{ModuleBrowserModal-DrUFMTDx.js → cdn/chunks/ModuleBrowserModal-C2CDWKW6.js} +51 -62
- package/dist/cdn/chunks/ModuleBrowserModal-C2CDWKW6.js.map +1 -0
- package/dist/cdn/chunks/ModulePreviewCanvas-Drt8Evai.js +109 -0
- package/dist/cdn/chunks/ModulePreviewCanvas-Drt8Evai.js.map +1 -0
- package/dist/cdn/chunks/{NumberWithSuffix-CE3NrZhH.js → NumberWithSuffix-Ty1bp9vB.js} +64 -64
- package/dist/cdn/chunks/{NumberWithSuffix-CE3NrZhH.js.map → NumberWithSuffix-Ty1bp9vB.js.map} +1 -1
- package/dist/cdn/chunks/{ParagraphEditor-B6Ygu-Mq.js → ParagraphEditor-BA1WbHI7.js} +188 -188
- package/dist/cdn/chunks/{ParagraphEditor-B6Ygu-Mq.js.map → ParagraphEditor-BA1WbHI7.js.map} +1 -1
- package/dist/cdn/chunks/{RichTextEditorContent-DL_y2SrR.js → RichTextEditorContent-BtWCA_Oc.js} +30 -30
- package/dist/cdn/chunks/{RichTextEditorContent-DL_y2SrR.js.map → RichTextEditorContent-BtWCA_Oc.js.map} +1 -1
- package/dist/cdn/chunks/{SaveModuleDialog-B0TnO_o9.js → SaveModuleDialog-AwL0tkCV.js} +21 -21
- package/dist/cdn/chunks/SaveModuleDialog-AwL0tkCV.js.map +1 -0
- package/dist/cdn/chunks/{TitleEditor-BHpfxvwy.js → TitleEditor-DbSyeixS.js} +65 -65
- package/dist/cdn/chunks/TitleEditor-DbSyeixS.js.map +1 -0
- package/dist/cdn/chunks/blockTypeIcons-pQIkxJzc.js +23 -0
- package/dist/cdn/chunks/blockTypeIcons-pQIkxJzc.js.map +1 -0
- package/dist/cdn/chunks/{de-D8CnZxV9.js → de-_tooy3Q8.js} +250 -2
- package/dist/cdn/chunks/de-_tooy3Q8.js.map +1 -0
- package/dist/cdn/chunks/{draggable-Bcb86AsV.js → draggable-C-1_gch3.js} +2 -2
- package/dist/cdn/chunks/{draggable-Bcb86AsV.js.map → draggable-C-1_gch3.js.map} +1 -1
- package/dist/cdn/chunks/{en-8FHaQv4V.js → en-CNqLoIm9.js} +250 -2
- package/dist/cdn/chunks/en-CNqLoIm9.js.map +1 -0
- package/dist/cdn/chunks/{extensions-DIxF31tA.js → extensions-BVKQw_sp.js} +107 -107
- package/dist/cdn/chunks/extensions-BVKQw_sp.js.map +1 -0
- package/dist/cdn/chunks/{features-DEMb13KS.js → features-DIBEo4xl.js} +3388 -2289
- package/dist/cdn/chunks/features-DIBEo4xl.js.map +1 -0
- package/dist/cdn/chunks/{icons-CsLTcirh.js → icons-C1Gg-ov-.js} +346 -54
- package/dist/cdn/chunks/icons-C1Gg-ov-.js.map +1 -0
- package/dist/cdn/chunks/{media-library-CVaNvhpM.js → media-library-BTF_Ko70.js} +985 -985
- package/dist/cdn/chunks/media-library-BTF_Ko70.js.map +1 -0
- package/dist/cdn/chunks/{quality-BaBfc54_.js → quality-C5AmotmP.js} +312 -312
- package/dist/cdn/chunks/quality-C5AmotmP.js.map +1 -0
- package/dist/cdn/chunks/{renderer-CUxvx7ro.js → renderer-D0L44Vlp.js} +236 -142
- package/dist/cdn/chunks/renderer-D0L44Vlp.js.map +1 -0
- package/dist/cdn/chunks/{src-CRaqN-p8.js → src-RKexlYjA.js} +161 -161
- package/dist/cdn/chunks/src-RKexlYjA.js.map +1 -0
- package/dist/cdn/chunks/styleConstants-PgmvNBzQ.js +57 -0
- package/dist/cdn/chunks/styleConstants-PgmvNBzQ.js.map +1 -0
- package/dist/cdn/chunks/styles-CQR6ed13.js +4976 -0
- package/dist/cdn/chunks/styles-CQR6ed13.js.map +1 -0
- package/dist/cdn/chunks/{tiptap-ZhwKyFp7.js → tiptap-CDzAbF2j.js} +43 -43
- package/dist/cdn/chunks/{tiptap-ZhwKyFp7.js.map → tiptap-CDzAbF2j.js.map} +1 -1
- package/dist/cdn/editor.css +1 -1
- package/dist/cdn/editor.js +211 -123
- package/dist/cdn/editor.js.map +1 -1
- package/dist/{check-Da05j8yl.js → check-DJrpDKO_.js} +1 -1
- package/dist/{chevron-down-R2uY34iD.js → chevron-down-C5oBUhT8.js} +1 -1
- package/dist/chevron-right-BqCptpdp.js +10 -0
- package/dist/{circle-alert-DZuGWPX-.js → circle-alert-ZQQc98HC.js} +1 -1
- package/dist/{clock-CRp2sIub.js → clock-ik2pRJKG.js} +1 -1
- package/dist/{cloud-DEk_b4CR.js → cloud-DJG4tb4_.js} +485 -427
- package/dist/{createLucideIcon-C3pa2siy.js → createLucideIcon-ClREiSx3.js} +6 -6
- package/dist/{de-Brqvgr43.js → de-2LEvILeZ.js} +249 -1
- package/dist/{dist-Cp0zXPAD.js → dist-BHAeXaUY.js} +1 -1
- package/dist/{dist-BaQIYPsn.js → dist-BSJvAvH3.js} +1 -1
- package/dist/{dist-wzMIGj-D.js → dist-BeFnymxK.js} +1 -1
- package/dist/dist-Bmir0gYb.js +1167 -0
- package/dist/{dist-DDJIWTRY.js → dist-BvPgo-UK.js} +1 -1
- package/dist/{dist-BFawx6IS.js → dist-CPVBKMmd.js} +51 -51
- package/dist/dist-CivF9P8b.js +382 -0
- package/dist/{dist-D6uC2xhi.js → dist-Df4ie7vZ.js} +1 -1
- package/dist/{dist-us-RpCWN.js → dist-DxOoemkW.js} +1 -1
- package/dist/{dist-KoBJjK1G.js → dist-HEQ52gTJ.js} +1 -1
- package/dist/{dist-DjviJBCi.js → dist-b-XUqAoF.js} +1 -1
- package/dist/{dist-D90y8dvT.js → dist-kZfaVUpW.js} +3 -3
- package/dist/{dist-aRzjfSRN.js → dist-wfAedlzi.js} +1 -1
- package/dist/{en-WDVp87TE.js → en-D2RU2Poj.js} +249 -1
- package/dist/{extensions-CUcl9Ok4.js → extensions-BQ1xXx3d.js} +103 -103
- package/dist/{image-up-MBZKKg9p.js → image-up-DT7gcJLN.js} +1 -1
- package/dist/index.d.ts +102 -14
- package/dist/{info-CJEC7piy.js → info-BSPGcsSM.js} +1 -1
- package/dist/keys-CvX8D-8C.js +10 -0
- package/dist/{loader-circle-DsY5Yg33.js → loader-circle-Balo8p3d.js} +1 -1
- package/dist/{message-circle-yElBbR2C.js → message-circle-B39qAHxs.js} +1 -1
- package/dist/pencil-BZJPNYWR.js +10 -0
- package/dist/{refresh-cw-CE_AGtn8.js → refresh-cw-DwDqGUM0.js} +1 -1
- package/dist/{scan-line-D0vcUekt.js → scan-line-DlghmhNf.js} +1 -1
- package/dist/{send-DH4oDQqC.js → send-DDdhIRj8.js} +1 -1
- package/dist/{shield-check-CfJgs2Hd.js → shield-check-OSQ-JVTX.js} +1 -1
- package/dist/{sparkles-CvRXGqFs.js → sparkles-BN4a-CoF.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/styleConstants-wWRbcuEK.js +55 -0
- package/dist/styles-CavWjvol.js +5487 -0
- package/dist/templatical-editor.js +211 -119
- package/dist/{text-align-start-BT9VUDxK.js → text-align-start-D1weisjS.js} +1 -1
- package/dist/{trash-2-DbP2Y6t2.js → trash-2-CMWvQ5KX.js} +1 -1
- package/dist/{triangle-alert-aOXceTSe.js → triangle-alert-DyidRNX_.js} +1 -1
- package/dist/undo-2-Cg8I7obC.js +16 -0
- package/dist/{useCloudI18n-BuIwR6OE.js → useCloudI18n-BTTNBk5i.js} +2 -2
- package/dist/{useEditorCore-C6ost42Q.js → useEditorCore-BGnzcT7p.js} +2424 -2249
- package/dist/{useI18n-lb2DHDiu.js → useI18n-C2xQZ6K9.js} +2 -2
- package/dist/{useMergeTag-CBwKnnNB.js → useMergeTag-CfuZq2fF.js} +4 -4
- package/dist/{vue.runtime.esm-bundler-DpvJL-nX.js → vue.runtime.esm-bundler-CjauPXjj.js} +1 -1
- package/dist/{x-u2oVmjN_.js → x-CgIhNcT9.js} +1 -1
- package/package.json +15 -15
- package/dist/CommentsSidebar-B1pvJdqF.js +0 -441
- package/dist/CountdownBlock-BNSj1jvJ.js +0 -92
- package/dist/CountdownToolbar-ClJr2GzL.js +0 -210
- package/dist/ModulePreviewCanvas-CHdOwV_4.js +0 -106
- package/dist/cdn/chunks/AiFeatureMenu-qEdB2fZJ.js.map +0 -1
- package/dist/cdn/chunks/CloudEditor-D2GsEC_n.js +0 -1143
- package/dist/cdn/chunks/CloudEditor-D2GsEC_n.js.map +0 -1
- package/dist/cdn/chunks/CollaboratorBar--nO7TX6b.js.map +0 -1
- package/dist/cdn/chunks/CountdownBlock-5YdT1uUu.js +0 -93
- package/dist/cdn/chunks/CountdownBlock-5YdT1uUu.js.map +0 -1
- package/dist/cdn/chunks/CountdownToolbar-DXPXrbAA.js +0 -212
- package/dist/cdn/chunks/CountdownToolbar-DXPXrbAA.js.map +0 -1
- package/dist/cdn/chunks/ModuleBrowserModal-DxoPp81s.js +0 -195
- package/dist/cdn/chunks/ModuleBrowserModal-DxoPp81s.js.map +0 -1
- package/dist/cdn/chunks/ModulePreviewCanvas-CoLdb4ar.js +0 -107
- package/dist/cdn/chunks/ModulePreviewCanvas-CoLdb4ar.js.map +0 -1
- package/dist/cdn/chunks/SaveModuleDialog-B0TnO_o9.js.map +0 -1
- package/dist/cdn/chunks/TitleEditor-BHpfxvwy.js.map +0 -1
- package/dist/cdn/chunks/blockTypeIcons-BzzY9_kA.js +0 -22
- package/dist/cdn/chunks/blockTypeIcons-BzzY9_kA.js.map +0 -1
- package/dist/cdn/chunks/de-D8CnZxV9.js.map +0 -1
- package/dist/cdn/chunks/en-8FHaQv4V.js.map +0 -1
- package/dist/cdn/chunks/extensions-DIxF31tA.js.map +0 -1
- package/dist/cdn/chunks/features-DEMb13KS.js.map +0 -1
- package/dist/cdn/chunks/icons-CsLTcirh.js.map +0 -1
- package/dist/cdn/chunks/media-library-CVaNvhpM.js.map +0 -1
- package/dist/cdn/chunks/quality-BaBfc54_.js.map +0 -1
- package/dist/cdn/chunks/renderer-CUxvx7ro.js.map +0 -1
- package/dist/cdn/chunks/src-CRaqN-p8.js.map +0 -1
- package/dist/cdn/chunks/styleConstants-DP1VOca8.js +0 -57
- package/dist/cdn/chunks/styleConstants-DP1VOca8.js.map +0 -1
- package/dist/cdn/chunks/styles-BHJULjNR.js +0 -2947
- package/dist/cdn/chunks/styles-BHJULjNR.js.map +0 -1
- package/dist/dist-B1IR0bpH.js +0 -326
- package/dist/dist-DJmnUmW9.js +0 -362
- package/dist/keys-ciNfSSGj.js +0 -10
- package/dist/styleConstants-fWzlIIwN.js +0 -55
- package/dist/styles-DEXEkBvg.js +0 -3176
- /package/dist/{_plugin-vue_export-helper-B0hnzhyu.js → _plugin-vue_export-helper-Bwh4ceeO.js} +0 -0
- /package/dist/{de-DCaaCE5s.js → de-D2npYjrZ.js} +0 -0
- /package/dist/{dist-iLBdeBDR.js → dist-DvHLtWVP.js} +0 -0
- /package/dist/{emojiData-PQyVa4bU.js → emojiData-DvQBBzmO.js} +0 -0
- /package/dist/{en-DXCyK4-X.js → en-ib-4h3_o.js} +0 -0
- /package/dist/{formatRelativeTime-BOEf47hq.js → formatRelativeTime-CFDZnEIs.js} +0 -0
- /package/dist/{liquid.browser-CdMv1BTn.js → liquid.browser-7Rv0QDiO.js} +0 -0
- /package/dist/{readableTextColor-CY3SiRnt.js → readableTextColor-C_9OpzBw.js} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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
|
|
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
|
|
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
|
|
105
|
+
function u(e, t) {
|
|
106
106
|
return e.replace(/\{(\w+)\}/g, (e, n) => encodeURIComponent(t[n] ?? ""));
|
|
107
107
|
}
|
|
108
|
-
var
|
|
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": `${
|
|
111
|
-
"broadcasting.auth": `${
|
|
112
|
-
"templates.store": `${
|
|
113
|
-
"templates.show": `${
|
|
114
|
-
"templates.update": `${
|
|
115
|
-
"templates.destroy": `${
|
|
116
|
-
"templates.export": `${
|
|
117
|
-
"templates.importFromBeefree": `${
|
|
118
|
-
"templates.sendTestEmail": `${
|
|
119
|
-
"snapshots.index": `${
|
|
120
|
-
"snapshots.store": `${
|
|
121
|
-
"snapshots.show": `${
|
|
122
|
-
"snapshots.restore": `${
|
|
123
|
-
"comments.index": `${
|
|
124
|
-
"comments.store": `${
|
|
125
|
-
"comments.update": `${
|
|
126
|
-
"comments.destroy": `${
|
|
127
|
-
"comments.resolve": `${
|
|
128
|
-
"ai.generate": `${
|
|
129
|
-
"ai.conversationMessages": `${
|
|
130
|
-
"ai.suggestions": `${
|
|
131
|
-
"ai.rewriteText": `${
|
|
132
|
-
"ai.score": `${
|
|
133
|
-
"ai.fixFinding": `${
|
|
134
|
-
"ai.generateFromDesign": `${
|
|
135
|
-
"media.upload": `${
|
|
136
|
-
"media.browse": `${
|
|
137
|
-
"media.delete": `${
|
|
138
|
-
"media.move": `${
|
|
139
|
-
"media.update": `${
|
|
140
|
-
"media.replace": `${
|
|
141
|
-
"media.checkUsage": `${
|
|
142
|
-
"media.frequentlyUsed": `${
|
|
143
|
-
"media.importFromUrl": `${
|
|
144
|
-
"folders.index": `${
|
|
145
|
-
"folders.store": `${
|
|
146
|
-
"folders.update": `${
|
|
147
|
-
"folders.destroy": `${
|
|
148
|
-
"savedModules.index": `${
|
|
149
|
-
"savedModules.store": `${
|
|
150
|
-
"savedModules.update": `${
|
|
151
|
-
"savedModules.destroy": `${
|
|
152
|
-
},
|
|
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
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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 ?
|
|
263
|
+
return t ? u(_["comments.update"], {
|
|
264
264
|
...this.baseParams,
|
|
265
265
|
template: e,
|
|
266
266
|
comment: t
|
|
267
|
-
}) :
|
|
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(
|
|
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(
|
|
308
|
+
return this.request(u(_["projects.config"], this.baseParams));
|
|
309
309
|
}
|
|
310
310
|
async listModules(e) {
|
|
311
|
-
let t =
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
|
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
|
|
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(
|
|
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
|
|
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
|
|
435
|
-
let
|
|
434
|
+
function S(n) {
|
|
435
|
+
let r = new v(n.authManager), i = t({
|
|
436
436
|
template: null,
|
|
437
|
-
content:
|
|
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
|
-
}),
|
|
447
|
-
get: () =>
|
|
446
|
+
}), l = a({
|
|
447
|
+
get: () => i.content,
|
|
448
448
|
set: (e) => {
|
|
449
|
-
|
|
449
|
+
i.content = o(e), i.isDirty = !0;
|
|
450
450
|
}
|
|
451
|
-
}),
|
|
452
|
-
let e = /* @__PURE__ */ new Set(), t =
|
|
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
|
|
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 =
|
|
461
|
+
let n = f(e, t);
|
|
462
462
|
if (n) return n;
|
|
463
463
|
}
|
|
464
464
|
}
|
|
465
465
|
return null;
|
|
466
466
|
}
|
|
467
|
-
function
|
|
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 =
|
|
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
|
|
483
|
-
return
|
|
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
|
-
|
|
485
|
+
function h(e, t = !0) {
|
|
486
|
+
i.content = o(e), t && (i.isDirty = !0);
|
|
490
487
|
}
|
|
491
488
|
function g(e) {
|
|
492
|
-
|
|
489
|
+
e && m(e) || (i.selectedBlockId = e);
|
|
493
490
|
}
|
|
494
|
-
function
|
|
495
|
-
|
|
491
|
+
function _(e) {
|
|
492
|
+
i.viewport = e;
|
|
496
493
|
}
|
|
497
494
|
function y(e) {
|
|
498
|
-
|
|
495
|
+
i.darkMode = e;
|
|
499
496
|
}
|
|
500
497
|
function b(e) {
|
|
501
|
-
|
|
498
|
+
i.uiTheme = e;
|
|
499
|
+
}
|
|
500
|
+
function x(e) {
|
|
501
|
+
i.previewMode = e, e && (i.selectedBlockId = null);
|
|
502
502
|
}
|
|
503
|
-
function
|
|
504
|
-
if (
|
|
505
|
-
let n =
|
|
506
|
-
n && (Object.assign(n, t),
|
|
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
|
|
509
|
-
|
|
510
|
-
...
|
|
508
|
+
function C(e) {
|
|
509
|
+
i.content.settings = {
|
|
510
|
+
...i.content.settings,
|
|
511
511
|
...e
|
|
512
|
-
},
|
|
512
|
+
}, i.isDirty = !0;
|
|
513
513
|
}
|
|
514
|
-
function
|
|
514
|
+
function w(e, t, n = 0, r) {
|
|
515
515
|
if (t) {
|
|
516
|
-
let
|
|
517
|
-
if (
|
|
518
|
-
|
|
519
|
-
let t =
|
|
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 <
|
|
523
|
-
|
|
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
|
|
526
|
-
if (
|
|
527
|
-
let t =
|
|
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),
|
|
530
|
+
n !== -1 && (t.blocks.splice(n, 1), i.selectedBlockId === e && (i.selectedBlockId = null), i.isDirty = !0);
|
|
531
531
|
}
|
|
532
532
|
}
|
|
533
|
-
function
|
|
534
|
-
let
|
|
535
|
-
if (!
|
|
536
|
-
let o =
|
|
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] =
|
|
538
|
+
let [s] = a.blocks.splice(o, 1);
|
|
539
539
|
if (n) {
|
|
540
|
-
let e =
|
|
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
|
|
543
|
-
|
|
542
|
+
} else i.content.blocks.splice(t, 0, s);
|
|
543
|
+
i.isDirty = !0;
|
|
544
544
|
}
|
|
545
|
-
async function
|
|
546
|
-
|
|
545
|
+
async function D(e) {
|
|
546
|
+
i.isLoading = !0;
|
|
547
547
|
try {
|
|
548
|
-
|
|
549
|
-
let
|
|
550
|
-
return
|
|
551
|
-
} catch (
|
|
552
|
-
throw
|
|
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
|
-
|
|
554
|
+
i.isLoading = !1;
|
|
555
555
|
}
|
|
556
556
|
}
|
|
557
|
-
async function
|
|
558
|
-
|
|
557
|
+
async function O(e) {
|
|
558
|
+
i.isLoading = !0;
|
|
559
559
|
try {
|
|
560
|
-
let
|
|
561
|
-
return
|
|
562
|
-
} catch (
|
|
563
|
-
throw
|
|
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
|
-
|
|
565
|
+
i.isLoading = !1;
|
|
566
566
|
}
|
|
567
567
|
}
|
|
568
|
-
async function
|
|
569
|
-
if (!
|
|
570
|
-
|
|
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
|
|
573
|
-
return
|
|
574
|
-
} catch (
|
|
575
|
-
throw
|
|
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
|
-
|
|
577
|
+
i.isSaving = !1;
|
|
578
578
|
}
|
|
579
579
|
}
|
|
580
|
-
async function
|
|
581
|
-
if (
|
|
582
|
-
await
|
|
583
|
-
} catch (
|
|
584
|
-
throw
|
|
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
|
-
|
|
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:
|
|
595
|
-
content:
|
|
596
|
-
selectedBlock:
|
|
597
|
-
savedBlockIds:
|
|
598
|
-
isBlockLocked:
|
|
599
|
-
setContent:
|
|
600
|
-
selectBlock:
|
|
601
|
-
setViewport:
|
|
602
|
-
setDarkMode:
|
|
603
|
-
setUiTheme:
|
|
604
|
-
setPreviewMode:
|
|
605
|
-
updateBlock:
|
|
606
|
-
updateSettings:
|
|
607
|
-
addBlock:
|
|
608
|
-
removeBlock:
|
|
609
|
-
moveBlock:
|
|
610
|
-
create:
|
|
611
|
-
load:
|
|
612
|
-
save:
|
|
613
|
-
createSnapshot:
|
|
614
|
-
hasTemplate:
|
|
615
|
-
markDirty:
|
|
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
|
|
619
|
-
function
|
|
620
|
-
return `msg_${Date.now()}_${++
|
|
676
|
+
var C = 0;
|
|
677
|
+
function w() {
|
|
678
|
+
return `msg_${Date.now()}_${++C}`;
|
|
621
679
|
}
|
|
622
|
-
function
|
|
623
|
-
let { authManager:
|
|
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 =
|
|
696
|
+
let e = n();
|
|
639
697
|
if (e) {
|
|
640
698
|
c.value = !0;
|
|
641
699
|
try {
|
|
642
|
-
let
|
|
643
|
-
project:
|
|
644
|
-
tenant:
|
|
700
|
+
let n = u(_["ai.conversationMessages"], {
|
|
701
|
+
project: t.projectId,
|
|
702
|
+
tenant: t.tenantSlug,
|
|
645
703
|
template: e
|
|
646
|
-
}), r = await
|
|
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,
|
|
664
|
-
let i =
|
|
721
|
+
async function S(e, r) {
|
|
722
|
+
let i = n();
|
|
665
723
|
if (i) {
|
|
666
724
|
y.value = !0;
|
|
667
725
|
try {
|
|
668
|
-
let
|
|
669
|
-
project:
|
|
670
|
-
tenant:
|
|
726
|
+
let n = u(_["ai.suggestions"], {
|
|
727
|
+
project: t.projectId,
|
|
728
|
+
tenant: t.tenantSlug,
|
|
671
729
|
template: i
|
|
672
|
-
}), a = await
|
|
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:
|
|
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
|
|
713
|
-
let y =
|
|
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,
|
|
716
|
-
let x =
|
|
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 =
|
|
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
|
|
732
|
-
project:
|
|
733
|
-
tenant:
|
|
789
|
+
let n = u(_["ai.generate"], {
|
|
790
|
+
project: t.projectId,
|
|
791
|
+
tenant: t.tenantSlug,
|
|
734
792
|
template: y
|
|
735
|
-
}), a = await
|
|
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:
|
|
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:
|
|
818
|
+
let { done: e, value: t } = await s.read();
|
|
761
819
|
if (e) break;
|
|
762
|
-
v += d.decode(
|
|
763
|
-
let
|
|
764
|
-
v =
|
|
765
|
-
for (let e of
|
|
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
|
|
825
|
+
let t = e.slice(6), n;
|
|
768
826
|
try {
|
|
769
|
-
|
|
827
|
+
n = JSON.parse(t);
|
|
770
828
|
} catch {
|
|
771
829
|
continue;
|
|
772
830
|
}
|
|
773
|
-
if (
|
|
774
|
-
else if (
|
|
775
|
-
else
|
|
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
|
|
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
|
-
|
|
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,
|
|
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:
|
|
859
|
+
error: l,
|
|
802
860
|
failedPrompt: d,
|
|
803
861
|
suggestions: v,
|
|
804
862
|
isLoadingSuggestions: y,
|
|
805
|
-
sendPrompt:
|
|
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
|
|
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:
|
|
876
|
+
hasAnyMenuFeature: a(() => t("chat") || t("scoring") || t("designToTemplate"))
|
|
819
877
|
};
|
|
820
878
|
}
|
|
821
|
-
function
|
|
822
|
-
let { authManager:
|
|
823
|
-
async function d(e,
|
|
824
|
-
let s =
|
|
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
|
-
|
|
884
|
+
r.value = !0, o.value = null, a.value = null;
|
|
827
885
|
try {
|
|
828
|
-
let
|
|
829
|
-
project:
|
|
830
|
-
tenant:
|
|
886
|
+
let n = u(_["ai.score"], {
|
|
887
|
+
project: t.projectId,
|
|
888
|
+
tenant: t.tenantSlug,
|
|
831
889
|
template: s
|
|
832
|
-
}),
|
|
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:
|
|
898
|
+
merge_tags: i.map((e) => ({
|
|
841
899
|
label: e.label,
|
|
842
900
|
value: e.value
|
|
843
901
|
}))
|
|
844
902
|
})
|
|
845
903
|
});
|
|
846
|
-
if (!
|
|
847
|
-
if (
|
|
848
|
-
let e = await
|
|
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 =
|
|
909
|
+
let o = r.body?.getReader();
|
|
852
910
|
if (!o) throw Error("Failed to read stream");
|
|
853
|
-
let c = new TextDecoder(),
|
|
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
|
-
|
|
858
|
-
let n =
|
|
859
|
-
|
|
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
|
-
|
|
935
|
+
r.value = !1;
|
|
878
936
|
}
|
|
879
937
|
}
|
|
880
|
-
async function f(e,
|
|
881
|
-
let a =
|
|
938
|
+
async function f(e, r, i) {
|
|
939
|
+
let a = n();
|
|
882
940
|
if (!a) return null;
|
|
883
|
-
s.value =
|
|
941
|
+
s.value = r.id, c.value = "", l.value = null;
|
|
884
942
|
try {
|
|
885
|
-
let
|
|
886
|
-
project:
|
|
887
|
-
tenant:
|
|
943
|
+
let n = u(_["ai.fixFinding"], {
|
|
944
|
+
project: t.projectId,
|
|
945
|
+
tenant: t.tenantSlug,
|
|
888
946
|
template: a
|
|
889
|
-
}), o = await
|
|
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:
|
|
899
|
-
message:
|
|
900
|
-
suggestion:
|
|
901
|
-
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
|
|
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 +=
|
|
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
|
|
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
|
-
|
|
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:
|
|
1010
|
+
isScoring: r,
|
|
953
1011
|
scoringResult: a,
|
|
954
1012
|
error: o,
|
|
955
1013
|
fixingFindingId: s,
|
|
956
1014
|
fixStreamingText: c,
|
|
957
|
-
fixError:
|
|
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
|
|
965
|
-
let { authManager:
|
|
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
|
|
968
|
-
if (!
|
|
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
|
|
972
|
-
e.prompt &&
|
|
973
|
-
let a =
|
|
974
|
-
project:
|
|
975
|
-
tenant:
|
|
976
|
-
template:
|
|
977
|
-
}), o = await
|
|
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:
|
|
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(),
|
|
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
|
-
|
|
993
|
-
let n =
|
|
994
|
-
|
|
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 &&
|
|
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
|
|
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:
|
|
1080
|
+
reset: l
|
|
1023
1081
|
};
|
|
1024
1082
|
}
|
|
1025
|
-
function
|
|
1026
|
-
let { authManager:
|
|
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 =
|
|
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
|
|
1036
|
-
let e =
|
|
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 =
|
|
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 =
|
|
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,
|
|
1076
|
-
let i =
|
|
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
|
|
1138
|
+
let n = await l.createComment(i, {
|
|
1081
1139
|
body: e,
|
|
1082
1140
|
block_id: t,
|
|
1083
|
-
parent_id:
|
|
1084
|
-
...
|
|
1141
|
+
parent_id: r,
|
|
1142
|
+
..._()
|
|
1085
1143
|
}, y());
|
|
1086
|
-
if (
|
|
1087
|
-
let e = x(
|
|
1088
|
-
e && (e.replies = [...e.replies ?? [],
|
|
1089
|
-
} else u.value = [...u.value,
|
|
1090
|
-
return b("created",
|
|
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
|
|
1100
|
-
if (!
|
|
1157
|
+
let r = n();
|
|
1158
|
+
if (!r) return null;
|
|
1101
1159
|
f.value = !0;
|
|
1102
1160
|
try {
|
|
1103
|
-
let
|
|
1161
|
+
let n = await l.updateComment(r, e, {
|
|
1104
1162
|
body: t,
|
|
1105
|
-
...
|
|
1163
|
+
..._()
|
|
1106
1164
|
}, y());
|
|
1107
|
-
return A(e,
|
|
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 =
|
|
1174
|
+
let t = n();
|
|
1117
1175
|
if (!t) return !1;
|
|
1118
|
-
let
|
|
1119
|
-
if (!
|
|
1176
|
+
let r = x(e);
|
|
1177
|
+
if (!r) return !1;
|
|
1120
1178
|
let i = {
|
|
1121
|
-
...
|
|
1122
|
-
replies: [...
|
|
1179
|
+
...r,
|
|
1180
|
+
replies: [...r.replies ?? []]
|
|
1123
1181
|
};
|
|
1124
1182
|
f.value = !0;
|
|
1125
1183
|
try {
|
|
1126
|
-
if (await l.deleteComment(t, e,
|
|
1127
|
-
let t = x(
|
|
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 =
|
|
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,
|
|
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
|
|
1224
|
-
let { comments: t, channel:
|
|
1225
|
-
|
|
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
|
-
|
|
1285
|
+
j(t, e);
|
|
1228
1286
|
});
|
|
1229
|
-
}),
|
|
1230
|
-
|
|
1287
|
+
}), r(() => {
|
|
1288
|
+
i.value?.unbind("comment-broadcast");
|
|
1231
1289
|
});
|
|
1232
1290
|
}
|
|
1233
|
-
function
|
|
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
|
|
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
|
|
1259
|
-
for (let t of
|
|
1316
|
+
function N(e) {
|
|
1317
|
+
for (let t of M) e.unbind(t);
|
|
1260
1318
|
}
|
|
1261
|
-
var
|
|
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
|
|
1274
|
-
let { authManager:
|
|
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 =
|
|
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
|
-
|
|
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
|
|
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
|
|
1336
|
-
d || (t && S(t), e &&
|
|
1337
|
-
}),
|
|
1338
|
-
if (n &&
|
|
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 =
|
|
1400
|
+
let r = t.members;
|
|
1343
1401
|
r && r.each((e) => {
|
|
1344
1402
|
m(e.info);
|
|
1345
|
-
}),
|
|
1346
|
-
let n = m(
|
|
1347
|
-
n &&
|
|
1348
|
-
}),
|
|
1349
|
-
let n = c.value.find((
|
|
1350
|
-
h(
|
|
1351
|
-
}),
|
|
1352
|
-
g(
|
|
1353
|
-
let n = c.value.find((
|
|
1354
|
-
n &&
|
|
1355
|
-
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
|
-
}),
|
|
1359
|
-
let n = l.value.get(
|
|
1360
|
-
_(
|
|
1361
|
-
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
|
-
}),
|
|
1422
|
+
}), t.bind("client-operation", (e) => {
|
|
1365
1423
|
v(e);
|
|
1366
|
-
}),
|
|
1424
|
+
}), t.bind("mcp-operation", (e) => {
|
|
1367
1425
|
v(e);
|
|
1368
1426
|
});
|
|
1369
|
-
}),
|
|
1370
|
-
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
|
|
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
|
|
1431
|
-
let { authManager:
|
|
1432
|
-
async function c(e,
|
|
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
|
|
1435
|
-
authManager:
|
|
1436
|
-
config:
|
|
1437
|
-
onError:
|
|
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,
|
|
1499
|
+
a.value = !0, r.value = c;
|
|
1442
1500
|
}), c.bind("pusher:subscription_error", (e) => {
|
|
1443
|
-
a.value = !1,
|
|
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,
|
|
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:
|
|
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
|
|
1461
|
-
let
|
|
1462
|
-
async function a(
|
|
1463
|
-
|
|
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
|
-
|
|
1466
|
-
} catch (
|
|
1467
|
-
throw
|
|
1523
|
+
n.value = await t.listModules(i);
|
|
1524
|
+
} catch (t) {
|
|
1525
|
+
throw e.onError?.(t), t;
|
|
1468
1526
|
} finally {
|
|
1469
|
-
|
|
1527
|
+
r.value = !1;
|
|
1470
1528
|
}
|
|
1471
1529
|
}
|
|
1472
|
-
async function o(
|
|
1530
|
+
async function o(r, i) {
|
|
1473
1531
|
try {
|
|
1474
|
-
let
|
|
1475
|
-
name:
|
|
1532
|
+
let e = await t.createModule({
|
|
1533
|
+
name: r,
|
|
1476
1534
|
content: i
|
|
1477
1535
|
});
|
|
1478
|
-
return
|
|
1479
|
-
} catch (
|
|
1480
|
-
throw
|
|
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(
|
|
1541
|
+
async function s(r, i) {
|
|
1484
1542
|
try {
|
|
1485
|
-
let
|
|
1486
|
-
return
|
|
1487
|
-
} catch (
|
|
1488
|
-
throw
|
|
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(
|
|
1549
|
+
async function c(r) {
|
|
1492
1550
|
try {
|
|
1493
|
-
await
|
|
1494
|
-
} catch (
|
|
1495
|
-
throw
|
|
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:
|
|
1500
|
-
isLoading:
|
|
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
|
|
1508
|
-
let
|
|
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
|
-
|
|
1568
|
+
r.value = !0;
|
|
1511
1569
|
try {
|
|
1512
|
-
|
|
1513
|
-
} catch (
|
|
1514
|
-
throw
|
|
1570
|
+
n.value = await t.getSnapshots(e.templateId);
|
|
1571
|
+
} catch (t) {
|
|
1572
|
+
throw e.onError?.(t), t;
|
|
1515
1573
|
} finally {
|
|
1516
|
-
|
|
1574
|
+
r.value = !1;
|
|
1517
1575
|
}
|
|
1518
1576
|
}
|
|
1519
|
-
async function s(
|
|
1577
|
+
async function s(n) {
|
|
1520
1578
|
a.value = !0;
|
|
1521
1579
|
try {
|
|
1522
|
-
let r = await
|
|
1523
|
-
return
|
|
1524
|
-
} catch (
|
|
1525
|
-
throw
|
|
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:
|
|
1532
|
-
isLoading:
|
|
1589
|
+
snapshots: n,
|
|
1590
|
+
isLoading: r,
|
|
1533
1591
|
isRestoring: a,
|
|
1534
1592
|
loadSnapshots: o,
|
|
1535
1593
|
restoreSnapshot: s
|
|
1536
1594
|
};
|
|
1537
1595
|
}
|
|
1538
|
-
function
|
|
1539
|
-
let { authManager:
|
|
1540
|
-
l &&
|
|
1541
|
-
e && (m.value =
|
|
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 =
|
|
1544
|
-
async function
|
|
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:
|
|
1628
|
+
sendTestEmail: _
|
|
1571
1629
|
};
|
|
1572
1630
|
}
|
|
1573
|
-
function
|
|
1574
|
-
let { authManager: t, getFontsConfig: n, canUseCustomFonts: r } = e, i = new
|
|
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
|
|
1599
|
-
let { authManager:
|
|
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
|
|
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
|
-
|
|
1665
|
+
r.value = await s.fetchConfig();
|
|
1608
1666
|
} catch (e) {
|
|
1609
|
-
|
|
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:
|
|
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
|
|
1624
|
-
function
|
|
1625
|
-
return e.authManager ? e.authManager.resolveUrl(
|
|
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
|
|
1685
|
+
async function G(e, t) {
|
|
1628
1686
|
let n = performance.now();
|
|
1629
1687
|
try {
|
|
1630
|
-
let r = t ? await t.authenticatedFetch(
|
|
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
|
|
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
|
-
},
|
|
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
|
|
1716
|
-
let t = await W(
|
|
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
|
|
1725
|
-
let { editor: t, channel:
|
|
1726
|
-
|
|
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
|
-
|
|
1786
|
+
x(t, e), i?.(e);
|
|
1729
1787
|
});
|
|
1730
1788
|
});
|
|
1731
1789
|
}
|
|
1732
1790
|
//#endregion
|
|
1733
|
-
export {
|
|
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 };
|