@dialpad/dialtone 9.177.0 → 9.177.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/dist/tokens/doc.json +103383 -103383
- package/dist/vue3/{attachment_carousel-DMKCJe7S.cjs → attachment_carousel-BWzRsDBY.cjs} +1 -1
- package/dist/vue3/{attachment_carousel-DMKCJe7S.cjs.map → attachment_carousel-BWzRsDBY.cjs.map} +1 -1
- package/dist/vue3/{attachment_carousel-gV6IHYgP.js → attachment_carousel-Xub5CrN3.js} +1 -1
- package/dist/vue3/{attachment_carousel-gV6IHYgP.js.map → attachment_carousel-Xub5CrN3.js.map} +1 -1
- package/dist/vue3/dialtone-vue.cjs +1 -1
- package/dist/vue3/dialtone-vue.js +6 -5
- package/dist/vue3/lib/attachment-carousel/attachment-carousel.cjs +1 -1
- package/dist/vue3/lib/attachment-carousel/attachment-carousel.js +1 -1
- package/dist/vue3/lib/attachment-carousel/index.cjs +1 -1
- package/dist/vue3/lib/attachment-carousel/index.js +1 -1
- package/dist/vue3/lib/editor/editor.cjs +1 -1
- package/dist/vue3/lib/editor/editor.cjs.map +1 -1
- package/dist/vue3/lib/editor/editor.js +2 -1
- package/dist/vue3/lib/editor/editor.js.map +1 -1
- package/dist/vue3/lib/editor/index.cjs +1 -1
- package/dist/vue3/lib/editor/index.js +1 -0
- package/dist/vue3/lib/message-input/index.cjs +1 -1
- package/dist/vue3/lib/message-input/index.js +2 -1
- package/dist/vue3/lib/message-input/message-input.cjs +1 -1
- package/dist/vue3/lib/message-input/message-input.js +2 -1
- package/dist/vue3/lib/rich-text-editor/index.cjs +1 -1
- package/dist/vue3/lib/rich-text-editor/index.js +2 -1
- package/dist/vue3/lib/rich-text-editor/markdownRenderer.cjs +1 -7
- package/dist/vue3/lib/rich-text-editor/markdownRenderer.js +2 -62
- package/dist/vue3/lib/rich-text-editor/rich-text-editor.cjs +1 -1
- package/dist/vue3/lib/rich-text-editor/rich-text-editor.js +2 -1
- package/dist/vue3/lib/scroller/index.cjs +1 -1
- package/dist/vue3/lib/scroller/index.js +1 -1
- package/dist/vue3/lib/scroller/scroller.cjs +1 -1
- package/dist/vue3/lib/scroller/scroller.js +1 -1
- package/dist/vue3/lib/toast/index.cjs +1 -1
- package/dist/vue3/lib/toast/index.js +1 -1
- package/dist/vue3/lib/toast/toast.cjs +1 -1
- package/dist/vue3/lib/toast/toast.js +1 -1
- package/dist/vue3/markdownRenderer-D14GhUiu.js +322 -0
- package/dist/vue3/markdownRenderer-D14GhUiu.js.map +1 -0
- package/dist/vue3/markdownRenderer-PRpHJ151.cjs +31 -0
- package/dist/vue3/markdownRenderer-PRpHJ151.cjs.map +1 -0
- package/dist/vue3/{message_input-VmltTreF.cjs → message_input-Bs-fg95i.cjs} +2 -2
- package/dist/vue3/{message_input-VmltTreF.cjs.map → message_input-Bs-fg95i.cjs.map} +1 -1
- package/dist/vue3/{message_input-tVB6JYJm.js → message_input-DfcdjT6O.js} +2 -2
- package/dist/vue3/{message_input-tVB6JYJm.js.map → message_input-DfcdjT6O.js.map} +1 -1
- package/dist/vue3/{rich_text_editor-CtCGNkSD.js → rich_text_editor-Cu0E6GWr.js} +2 -2
- package/dist/vue3/{rich_text_editor-CtCGNkSD.js.map → rich_text_editor-Cu0E6GWr.js.map} +1 -1
- package/dist/vue3/rich_text_editor-D5_gdzNn.cjs +10 -0
- package/dist/vue3/{rich_text_editor-CEwKDuzw.cjs.map → rich_text_editor-D5_gdzNn.cjs.map} +1 -1
- package/dist/vue3/{scroller-06ayn-64.cjs → scroller-CuYuo1vd.cjs} +1 -1
- package/dist/vue3/{scroller-06ayn-64.cjs.map → scroller-CuYuo1vd.cjs.map} +1 -1
- package/dist/vue3/{scroller-Ckquh-PU.js → scroller-axSKchCc.js} +1 -1
- package/dist/vue3/{scroller-Ckquh-PU.js.map → scroller-axSKchCc.js.map} +1 -1
- package/dist/vue3/{toast-0QfP90_3.cjs → toast-BZ8qQHML.cjs} +1 -1
- package/dist/vue3/{toast-0QfP90_3.cjs.map → toast-BZ8qQHML.cjs.map} +1 -1
- package/dist/vue3/{toast-B1zeUPtg.js → toast-jpudprAC.js} +1 -1
- package/dist/vue3/{toast-B1zeUPtg.js.map → toast-jpudprAC.js.map} +1 -1
- package/package.json +5 -5
- package/dist/vue3/lib/rich-text-editor/markdownRenderer.cjs.map +0 -1
- package/dist/vue3/lib/rich-text-editor/markdownRenderer.js.map +0 -1
- package/dist/vue3/rich_text_editor-CEwKDuzw.cjs +0 -10
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import { getAttributesFromExtensions as e, getExtensionField as t, getSchemaByResolvedExtensions as n, mergeAttributes as r, resolveExtensions as i, splitExtensions as a } from "@tiptap/core";
|
|
2
|
+
import { Node as o } from "@tiptap/pm/model";
|
|
3
|
+
//#region ../../node_modules/.pnpm/@tiptap+static-renderer@3.19.0_@tiptap+core@3.19.0_@tiptap+pm@3.19.0__@tiptap+pm@3.19.0_react_4n7lapq7bmfej5hsrzhdkukr6e/node_modules/@tiptap/static-renderer/dist/pm/markdown/index.js
|
|
4
|
+
function s(e, t, n) {
|
|
5
|
+
let i = e.attrs;
|
|
6
|
+
return i ? t.filter((t) => t.type === (typeof e.type == "string" ? e.type : e.type.name) ? n ? t.attribute.rendered : !0 : !1).map((e) => e.attribute.renderHTML && e.attribute.renderHTML(i) || { [e.name]: e.name in i ? i[e.name] : e.attribute.default }).reduce((e, t) => r(e, t), {}) : {};
|
|
7
|
+
}
|
|
8
|
+
function c(e, t) {
|
|
9
|
+
return s(e, t, !0);
|
|
10
|
+
}
|
|
11
|
+
function l(e, n, r, i) {
|
|
12
|
+
let a = t(n, "renderHTML", {
|
|
13
|
+
name: n.name,
|
|
14
|
+
options: n.options,
|
|
15
|
+
storage: n.storage,
|
|
16
|
+
parent: n.parent
|
|
17
|
+
});
|
|
18
|
+
return a ? [n.name, ({ node: t, children: i }) => {
|
|
19
|
+
try {
|
|
20
|
+
return e(a({
|
|
21
|
+
node: t,
|
|
22
|
+
HTMLAttributes: c(t, r)
|
|
23
|
+
}))(i);
|
|
24
|
+
} catch (e) {
|
|
25
|
+
throw Error(`[tiptap error]: Node ${n.name} cannot be rendered, it's "renderToHTML" method threw an error: ${e.message}`, { cause: e });
|
|
26
|
+
}
|
|
27
|
+
}] : i?.unhandledNode ? [n.name, i.unhandledNode] : [n.name, () => {
|
|
28
|
+
throw Error(`[tiptap error]: Node ${n.name} cannot be rendered, it is missing a "renderToHTML" method, please implement it or override the corresponding "nodeMapping" method to have a custom rendering`);
|
|
29
|
+
}];
|
|
30
|
+
}
|
|
31
|
+
function u(e, n, r, i) {
|
|
32
|
+
let a = t(n, "renderHTML", {
|
|
33
|
+
name: n.name,
|
|
34
|
+
options: n.options,
|
|
35
|
+
storage: n.storage,
|
|
36
|
+
parent: n.parent
|
|
37
|
+
});
|
|
38
|
+
return a ? [n.name, ({ mark: t, children: i }) => {
|
|
39
|
+
try {
|
|
40
|
+
return e(a({
|
|
41
|
+
mark: t,
|
|
42
|
+
HTMLAttributes: c(t, r)
|
|
43
|
+
}))(i);
|
|
44
|
+
} catch (e) {
|
|
45
|
+
throw Error(`[tiptap error]: Mark ${n.name} cannot be rendered, it's "renderToHTML" method threw an error: ${e.message}`, { cause: e });
|
|
46
|
+
}
|
|
47
|
+
}] : i?.unhandledMark ? [n.name, i.unhandledMark] : [n.name, () => {
|
|
48
|
+
throw Error(`Node ${n.name} cannot be rendered, it is missing a "renderToHTML" method`);
|
|
49
|
+
}];
|
|
50
|
+
}
|
|
51
|
+
function d({ renderer: t, domOutputSpecToElement: r, mapDefinedTypes: s, content: c, extensions: d, options: f }) {
|
|
52
|
+
d = i(d);
|
|
53
|
+
let p = e(d), { nodeExtensions: m, markExtensions: h } = a(d);
|
|
54
|
+
return c instanceof o || (c = o.fromJSON(n(d), c)), t({
|
|
55
|
+
...f,
|
|
56
|
+
nodeMapping: {
|
|
57
|
+
...Object.fromEntries(m.filter((e) => e.name in s ? !1 : f?.nodeMapping ? !(e.name in f.nodeMapping) : !0).map((e) => l(r, e, p, f))),
|
|
58
|
+
...s,
|
|
59
|
+
...f?.nodeMapping
|
|
60
|
+
},
|
|
61
|
+
markMapping: {
|
|
62
|
+
...Object.fromEntries(h.filter((e) => f?.markMapping ? !(e.name in f.markMapping) : !0).map((e) => u(r, e, p, f))),
|
|
63
|
+
...f?.markMapping
|
|
64
|
+
}
|
|
65
|
+
})({ content: c });
|
|
66
|
+
}
|
|
67
|
+
function f(e, { nodeMapping: t, markMapping: n, unhandledNode: r, unhandledMark: i }) {
|
|
68
|
+
return function a({ content: o, parent: s }) {
|
|
69
|
+
let c = typeof o.type == "string" ? o.type : o.type.name, l = t[c] ?? r;
|
|
70
|
+
if (!l) throw Error(`missing handler for node type ${c}`);
|
|
71
|
+
let u = e({
|
|
72
|
+
component: l,
|
|
73
|
+
props: {
|
|
74
|
+
node: o,
|
|
75
|
+
parent: s,
|
|
76
|
+
renderElement: a,
|
|
77
|
+
get children() {
|
|
78
|
+
let e = [];
|
|
79
|
+
return o.content && o.content.forEach((t) => {
|
|
80
|
+
e.push(a({
|
|
81
|
+
content: t,
|
|
82
|
+
parent: o
|
|
83
|
+
}));
|
|
84
|
+
}), e;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
return o.marks ? o.marks.reduce((t, r) => {
|
|
89
|
+
let a = typeof r.type == "string" ? r.type : r.type.name, c = n[a] ?? i;
|
|
90
|
+
if (!c) throw Error(`missing handler for mark type ${a}`);
|
|
91
|
+
return e({
|
|
92
|
+
component: c,
|
|
93
|
+
props: {
|
|
94
|
+
mark: r,
|
|
95
|
+
parent: s,
|
|
96
|
+
node: o,
|
|
97
|
+
children: t
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}, u) : u;
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function p(e) {
|
|
104
|
+
return f((e) => e.component(e.props), e);
|
|
105
|
+
}
|
|
106
|
+
function m(e) {
|
|
107
|
+
let t = Object.entries(e || {}).map(([e, t]) => `${e.split(" ").at(-1)}=${JSON.stringify(t)}`).join(" ");
|
|
108
|
+
return t ? ` ${t}` : "";
|
|
109
|
+
}
|
|
110
|
+
function h(e) {
|
|
111
|
+
return [].concat(e || "").filter(Boolean).join("");
|
|
112
|
+
}
|
|
113
|
+
var g = /* @__PURE__ */ new Set([
|
|
114
|
+
"iframe",
|
|
115
|
+
"script",
|
|
116
|
+
"style",
|
|
117
|
+
"title",
|
|
118
|
+
"textarea",
|
|
119
|
+
"div",
|
|
120
|
+
"span",
|
|
121
|
+
"a",
|
|
122
|
+
"button"
|
|
123
|
+
]);
|
|
124
|
+
function _(e) {
|
|
125
|
+
if (typeof e == "string") return () => e;
|
|
126
|
+
if (typeof e == "object" && "length" in e) {
|
|
127
|
+
let [t, n, r, ...i] = e, a = t, o = a.split(" ");
|
|
128
|
+
if (o.length > 1 && (a = `${o[1]} xmlns="${o[0]}"`), n === void 0) return () => `<${a}/>`;
|
|
129
|
+
if (n === 0) return (e) => `<${a}>${h(e)}</${a}>`;
|
|
130
|
+
if (typeof n == "object") return Array.isArray(n) ? r === void 0 || r === 0 ? (e) => `<${a}>${_(n)(e)}</${a}>` : (e) => `<${a}>${_(n)(e)}${[r].concat(i).map((t) => _(t)(e))}</${a}>` : r === void 0 ? g.has(a) ? () => `<${a}${m(n)}></${a}>` : () => `<${a}${m(n)}/>` : r === 0 ? (e) => `<${a}${m(n)}>${h(e)}</${a}>` : (e) => `<${a}${m(n)}>${[r].concat(i).map((t) => _(t)(e)).join("")}</${a}>`;
|
|
131
|
+
}
|
|
132
|
+
throw Error("[tiptap error]: Unsupported DomOutputSpec type, check the `renderHTML` method output or implement a node mapping", { cause: e });
|
|
133
|
+
}
|
|
134
|
+
function v({ content: e, extensions: t, options: n }) {
|
|
135
|
+
return d({
|
|
136
|
+
renderer: p,
|
|
137
|
+
domOutputSpecToElement: _,
|
|
138
|
+
mapDefinedTypes: {
|
|
139
|
+
doc: ({ children: e }) => h(e),
|
|
140
|
+
text: ({ node: e }) => e.text ?? ""
|
|
141
|
+
},
|
|
142
|
+
content: e,
|
|
143
|
+
extensions: t,
|
|
144
|
+
options: n
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function y({ content: e, extensions: t, options: n }) {
|
|
148
|
+
return v({
|
|
149
|
+
content: e,
|
|
150
|
+
extensions: t,
|
|
151
|
+
options: {
|
|
152
|
+
...n,
|
|
153
|
+
nodeMapping: {
|
|
154
|
+
bulletList({ children: e }) {
|
|
155
|
+
return `
|
|
156
|
+
${h(e)}`;
|
|
157
|
+
},
|
|
158
|
+
orderedList({ children: e }) {
|
|
159
|
+
return `
|
|
160
|
+
${h(e)}`;
|
|
161
|
+
},
|
|
162
|
+
listItem({ node: e, children: t, parent: n }) {
|
|
163
|
+
if (n?.type.name === "bulletList") return `- ${h(t).trim()}
|
|
164
|
+
`;
|
|
165
|
+
if (n?.type.name === "orderedList") {
|
|
166
|
+
let r = n.attrs.start || 1;
|
|
167
|
+
return n.forEach((t, n, i) => {
|
|
168
|
+
e === t && (r = i + 1);
|
|
169
|
+
}), `${r}. ${h(t).trim()}
|
|
170
|
+
`;
|
|
171
|
+
}
|
|
172
|
+
return h(t);
|
|
173
|
+
},
|
|
174
|
+
paragraph({ children: e }) {
|
|
175
|
+
return `
|
|
176
|
+
${h(e)}
|
|
177
|
+
`;
|
|
178
|
+
},
|
|
179
|
+
heading({ node: e, children: t }) {
|
|
180
|
+
let n = e.attrs.level;
|
|
181
|
+
return `${Array(n).fill("#").join("")} ${t}
|
|
182
|
+
`;
|
|
183
|
+
},
|
|
184
|
+
codeBlock({ node: e, children: t }) {
|
|
185
|
+
return `
|
|
186
|
+
\`\`\`${e.attrs.language}
|
|
187
|
+
${h(t)}
|
|
188
|
+
\`\`\`
|
|
189
|
+
`;
|
|
190
|
+
},
|
|
191
|
+
blockquote({ children: e }) {
|
|
192
|
+
return `
|
|
193
|
+
${h(e).trim().split("\n").map((e) => `> ${e}`).join("\n")}`;
|
|
194
|
+
},
|
|
195
|
+
image({ node: e }) {
|
|
196
|
+
return ``;
|
|
197
|
+
},
|
|
198
|
+
hardBreak() {
|
|
199
|
+
return "\n";
|
|
200
|
+
},
|
|
201
|
+
horizontalRule() {
|
|
202
|
+
return "\n---\n";
|
|
203
|
+
},
|
|
204
|
+
table({ children: e, node: t }) {
|
|
205
|
+
if (!Array.isArray(e)) return `
|
|
206
|
+
${h(e)}
|
|
207
|
+
`;
|
|
208
|
+
let n = t.children[0].childCount;
|
|
209
|
+
return `
|
|
210
|
+
${h(e[0])}| ${Array(n).fill("---").join(" | ")} |
|
|
211
|
+
${h(e.slice(1))}
|
|
212
|
+
`;
|
|
213
|
+
},
|
|
214
|
+
tableRow({ children: e }) {
|
|
215
|
+
return Array.isArray(e) ? `| ${e.join(" | ")} |
|
|
216
|
+
` : `${h(e)}
|
|
217
|
+
`;
|
|
218
|
+
},
|
|
219
|
+
tableHeader({ children: e }) {
|
|
220
|
+
return h(e).trim();
|
|
221
|
+
},
|
|
222
|
+
tableCell({ children: e }) {
|
|
223
|
+
return h(e).trim();
|
|
224
|
+
},
|
|
225
|
+
...n?.nodeMapping
|
|
226
|
+
},
|
|
227
|
+
markMapping: {
|
|
228
|
+
bold({ children: e }) {
|
|
229
|
+
return `**${h(e)}**`;
|
|
230
|
+
},
|
|
231
|
+
italic({ children: e, node: t }) {
|
|
232
|
+
let n = !1;
|
|
233
|
+
return t?.marks.some((e) => e.type.name === "bold") && (n = !0), n ? `*${h(e)}*` : `_${h(e)}_`;
|
|
234
|
+
},
|
|
235
|
+
code({ children: e }) {
|
|
236
|
+
return `\`${h(e)}\``;
|
|
237
|
+
},
|
|
238
|
+
strike({ children: e }) {
|
|
239
|
+
return `~~${h(e)}~~`;
|
|
240
|
+
},
|
|
241
|
+
underline({ children: e }) {
|
|
242
|
+
return `<u>${h(e)}</u>`;
|
|
243
|
+
},
|
|
244
|
+
subscript({ children: e }) {
|
|
245
|
+
return `<sub>${h(e)}</sub>`;
|
|
246
|
+
},
|
|
247
|
+
superscript({ children: e }) {
|
|
248
|
+
return `<sup>${h(e)}</sup>`;
|
|
249
|
+
},
|
|
250
|
+
link({ mark: e, children: t }) {
|
|
251
|
+
return `[${h(t)}](${e.attrs.href})`;
|
|
252
|
+
},
|
|
253
|
+
highlight({ children: e }) {
|
|
254
|
+
return `==${h(e)}==`;
|
|
255
|
+
},
|
|
256
|
+
...n?.markMapping
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
//#endregion
|
|
262
|
+
//#region components/rich_text_editor/markdownRenderer.js
|
|
263
|
+
var b = (e) => Array.isArray(e) ? e.join("") : e || "", x = (e, t, n) => {
|
|
264
|
+
let r = e.trim();
|
|
265
|
+
return r ? `${e.slice(0, e.length - e.trimStart().length)}${t}${r}${n}${e.slice(e.trimEnd().length)}` : e;
|
|
266
|
+
};
|
|
267
|
+
function S(e, t) {
|
|
268
|
+
return y({
|
|
269
|
+
extensions: t,
|
|
270
|
+
content: e,
|
|
271
|
+
options: {
|
|
272
|
+
nodeMapping: {
|
|
273
|
+
blockquote({ children: e }) {
|
|
274
|
+
return b(e).trim().split("\n").map((e) => e ? `> ${e}` : ">").join("\n") + "\n";
|
|
275
|
+
},
|
|
276
|
+
codeBlock({ node: e, children: t }) {
|
|
277
|
+
return `\`\`\`${e.attrs?.language || ""}\n${b(t)}\n\`\`\`\n`;
|
|
278
|
+
},
|
|
279
|
+
mention({ node: e }) {
|
|
280
|
+
return `<!-- @mention: {"id": "${e.attrs?.id || ""}", "contactKey": "${e.attrs?.contactKey || ""}", "name": "${e.attrs?.name || ""}"} -->`;
|
|
281
|
+
},
|
|
282
|
+
channel({ node: e }) {
|
|
283
|
+
return `<!-- @channel: {"id": "${e.attrs?.id || ""}", "channelKey": "${e.attrs?.channelKey || ""}", "name": "${e.attrs?.name || ""}", "locked": "${String(e.attrs?.locked ?? "")}"} -->`;
|
|
284
|
+
},
|
|
285
|
+
"slash-commands"({ node: e }) {
|
|
286
|
+
return `/${e.attrs?.command || ""}`;
|
|
287
|
+
},
|
|
288
|
+
emoji({ node: e }) {
|
|
289
|
+
return e.attrs?.code || "";
|
|
290
|
+
},
|
|
291
|
+
variable({ node: e }) {
|
|
292
|
+
return `{{${e.attrs?.id || ""}=${e.attrs?.altText || ""}}}`;
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
markMapping: {
|
|
296
|
+
bold({ children: e }) {
|
|
297
|
+
return x(b(e), "**", "**");
|
|
298
|
+
},
|
|
299
|
+
italic({ children: e }) {
|
|
300
|
+
return x(b(e), "*", "*");
|
|
301
|
+
},
|
|
302
|
+
strike({ children: e }) {
|
|
303
|
+
return x(b(e), "~~", "~~");
|
|
304
|
+
},
|
|
305
|
+
code({ children: e }) {
|
|
306
|
+
return x(b(e), "`", "`");
|
|
307
|
+
},
|
|
308
|
+
link({ mark: e, children: t }) {
|
|
309
|
+
let n = b(t), r = e.attrs?.href || "", i = n.trim();
|
|
310
|
+
return `${n.slice(0, n.length - n.trimStart().length)}[${i}](${r})${n.slice(n.trimEnd().length)}`;
|
|
311
|
+
},
|
|
312
|
+
underline({ children: e }) {
|
|
313
|
+
return b(e);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}).replace(/\n{3,}/g, "\n\n").replace(/^\n+|\n+$/g, "");
|
|
318
|
+
}
|
|
319
|
+
//#endregion
|
|
320
|
+
export { S as t };
|
|
321
|
+
|
|
322
|
+
//# sourceMappingURL=markdownRenderer-D14GhUiu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdownRenderer-D14GhUiu.js","names":["Node"],"sources":["../../../node_modules/.pnpm/@tiptap+static-renderer@3.19.0_@tiptap+core@3.19.0_@tiptap+pm@3.19.0__@tiptap+pm@3.19.0_react_4n7lapq7bmfej5hsrzhdkukr6e/node_modules/@tiptap/static-renderer/dist/pm/markdown/index.js","../components/rich_text_editor/markdownRenderer.js"],"sourcesContent":["// src/pm/extensionRenderer.ts\nimport {\n getAttributesFromExtensions,\n getExtensionField,\n getSchemaByResolvedExtensions,\n resolveExtensions,\n splitExtensions\n} from \"@tiptap/core\";\nimport { Node } from \"@tiptap/pm/model\";\n\n// src/helpers.ts\nimport { mergeAttributes } from \"@tiptap/core\";\nfunction getAttributes(nodeOrMark, extensionAttributes, onlyRenderedAttributes) {\n const nodeOrMarkAttributes = nodeOrMark.attrs;\n if (!nodeOrMarkAttributes) {\n return {};\n }\n return extensionAttributes.filter((item) => {\n if (item.type !== (typeof nodeOrMark.type === \"string\" ? nodeOrMark.type : nodeOrMark.type.name)) {\n return false;\n }\n if (onlyRenderedAttributes) {\n return item.attribute.rendered;\n }\n return true;\n }).map((item) => {\n if (!item.attribute.renderHTML) {\n return {\n [item.name]: item.name in nodeOrMarkAttributes ? nodeOrMarkAttributes[item.name] : item.attribute.default\n };\n }\n return item.attribute.renderHTML(nodeOrMarkAttributes) || {\n [item.name]: item.name in nodeOrMarkAttributes ? nodeOrMarkAttributes[item.name] : item.attribute.default\n };\n }).reduce((attributes, attribute) => mergeAttributes(attributes, attribute), {});\n}\nfunction getHTMLAttributes(nodeOrMark, extensionAttributes) {\n return getAttributes(nodeOrMark, extensionAttributes, true);\n}\n\n// src/pm/extensionRenderer.ts\nfunction mapNodeExtensionToReactNode(domOutputSpecToElement, extension, extensionAttributes, options) {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n parent: extension.parent\n };\n const renderToHTML = getExtensionField(extension, \"renderHTML\", context);\n if (!renderToHTML) {\n if (options == null ? void 0 : options.unhandledNode) {\n return [extension.name, options.unhandledNode];\n }\n return [\n extension.name,\n () => {\n throw new Error(\n `[tiptap error]: Node ${extension.name} cannot be rendered, it is missing a \"renderToHTML\" method, please implement it or override the corresponding \"nodeMapping\" method to have a custom rendering`\n );\n }\n ];\n }\n return [\n extension.name,\n ({ node, children }) => {\n try {\n return domOutputSpecToElement(\n renderToHTML({\n node,\n HTMLAttributes: getHTMLAttributes(node, extensionAttributes)\n })\n )(children);\n } catch (e) {\n throw new Error(\n `[tiptap error]: Node ${extension.name} cannot be rendered, it's \"renderToHTML\" method threw an error: ${e.message}`,\n { cause: e }\n );\n }\n }\n ];\n}\nfunction mapMarkExtensionToReactNode(domOutputSpecToElement, extension, extensionAttributes, options) {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n parent: extension.parent\n };\n const renderToHTML = getExtensionField(extension, \"renderHTML\", context);\n if (!renderToHTML) {\n if (options == null ? void 0 : options.unhandledMark) {\n return [extension.name, options.unhandledMark];\n }\n return [\n extension.name,\n () => {\n throw new Error(`Node ${extension.name} cannot be rendered, it is missing a \"renderToHTML\" method`);\n }\n ];\n }\n return [\n extension.name,\n ({ mark, children }) => {\n try {\n return domOutputSpecToElement(\n renderToHTML({\n mark,\n HTMLAttributes: getHTMLAttributes(mark, extensionAttributes)\n })\n )(children);\n } catch (e) {\n throw new Error(\n `[tiptap error]: Mark ${extension.name} cannot be rendered, it's \"renderToHTML\" method threw an error: ${e.message}`,\n { cause: e }\n );\n }\n }\n ];\n}\nfunction renderToElement({\n renderer,\n domOutputSpecToElement,\n mapDefinedTypes,\n content,\n extensions,\n options\n}) {\n extensions = resolveExtensions(extensions);\n const extensionAttributes = getAttributesFromExtensions(extensions);\n const { nodeExtensions, markExtensions } = splitExtensions(extensions);\n if (!(content instanceof Node)) {\n content = Node.fromJSON(getSchemaByResolvedExtensions(extensions), content);\n }\n return renderer({\n ...options,\n nodeMapping: {\n ...Object.fromEntries(\n nodeExtensions.filter((e) => {\n if (e.name in mapDefinedTypes) {\n return false;\n }\n if (options == null ? void 0 : options.nodeMapping) {\n return !(e.name in options.nodeMapping);\n }\n return true;\n }).map(\n (nodeExtension) => mapNodeExtensionToReactNode(domOutputSpecToElement, nodeExtension, extensionAttributes, options)\n )\n ),\n ...mapDefinedTypes,\n ...options == null ? void 0 : options.nodeMapping\n },\n markMapping: {\n ...Object.fromEntries(\n markExtensions.filter((e) => {\n if (options == null ? void 0 : options.markMapping) {\n return !(e.name in options.markMapping);\n }\n return true;\n }).map((mark) => mapMarkExtensionToReactNode(domOutputSpecToElement, mark, extensionAttributes, options))\n ),\n ...options == null ? void 0 : options.markMapping\n }\n })({ content });\n}\n\n// src/json/renderer.ts\nfunction TiptapStaticRenderer(renderComponent, {\n nodeMapping,\n markMapping,\n unhandledNode,\n unhandledMark\n}) {\n return function renderContent({\n content,\n parent\n }) {\n var _a;\n const nodeType = typeof content.type === \"string\" ? content.type : content.type.name;\n const NodeHandler = (_a = nodeMapping[nodeType]) != null ? _a : unhandledNode;\n if (!NodeHandler) {\n throw new Error(`missing handler for node type ${nodeType}`);\n }\n const nodeContent = renderComponent({\n component: NodeHandler,\n props: {\n node: content,\n parent,\n renderElement: renderContent,\n // Lazily compute the children to avoid unnecessary recursion\n get children() {\n const children = [];\n if (content.content) {\n content.content.forEach((child) => {\n children.push(\n renderContent({\n content: child,\n parent: content\n })\n );\n });\n }\n return children;\n }\n }\n });\n const markedContent = content.marks ? content.marks.reduce((acc, mark) => {\n var _a2;\n const markType = typeof mark.type === \"string\" ? mark.type : mark.type.name;\n const MarkHandler = (_a2 = markMapping[markType]) != null ? _a2 : unhandledMark;\n if (!MarkHandler) {\n throw new Error(`missing handler for mark type ${markType}`);\n }\n return renderComponent({\n component: MarkHandler,\n props: {\n mark,\n parent,\n node: content,\n children: acc\n }\n });\n }, nodeContent) : nodeContent;\n return markedContent;\n };\n}\n\n// src/json/html-string/string.ts\nfunction renderJSONContentToString(options) {\n return TiptapStaticRenderer((ctx) => {\n return ctx.component(ctx.props);\n }, options);\n}\nfunction serializeAttrsToHTMLString(attrs) {\n const output = Object.entries(attrs || {}).map(([key, value]) => `${key.split(\" \").at(-1)}=${JSON.stringify(value)}`).join(\" \");\n return output ? ` ${output}` : \"\";\n}\nfunction serializeChildrenToHTMLString(children) {\n return [].concat(children || \"\").filter(Boolean).join(\"\");\n}\n\n// src/pm/html-string/html-string.ts\nvar NON_SELF_CLOSING_TAGS = /* @__PURE__ */ new Set([\"iframe\", \"script\", \"style\", \"title\", \"textarea\", \"div\", \"span\", \"a\", \"button\"]);\nfunction domOutputSpecToHTMLString(content) {\n if (typeof content === \"string\") {\n return () => content;\n }\n if (typeof content === \"object\" && \"length\" in content) {\n const [_tag, attrs, children, ...rest] = content;\n let tag = _tag;\n const parts = tag.split(\" \");\n if (parts.length > 1) {\n tag = `${parts[1]} xmlns=\"${parts[0]}\"`;\n }\n if (attrs === void 0) {\n return () => `<${tag}/>`;\n }\n if (attrs === 0) {\n return (child) => `<${tag}>${serializeChildrenToHTMLString(child)}</${tag}>`;\n }\n if (typeof attrs === \"object\") {\n if (Array.isArray(attrs)) {\n if (children === void 0) {\n return (child) => `<${tag}>${domOutputSpecToHTMLString(attrs)(child)}</${tag}>`;\n }\n if (children === 0) {\n return (child) => `<${tag}>${domOutputSpecToHTMLString(attrs)(child)}</${tag}>`;\n }\n return (child) => `<${tag}>${domOutputSpecToHTMLString(attrs)(child)}${[children].concat(rest).map((a) => domOutputSpecToHTMLString(a)(child))}</${tag}>`;\n }\n if (children === void 0) {\n if (NON_SELF_CLOSING_TAGS.has(tag)) {\n return () => `<${tag}${serializeAttrsToHTMLString(attrs)}></${tag}>`;\n }\n return () => `<${tag}${serializeAttrsToHTMLString(attrs)}/>`;\n }\n if (children === 0) {\n return (child) => `<${tag}${serializeAttrsToHTMLString(attrs)}>${serializeChildrenToHTMLString(child)}</${tag}>`;\n }\n return (child) => `<${tag}${serializeAttrsToHTMLString(attrs)}>${[children].concat(rest).map((a) => domOutputSpecToHTMLString(a)(child)).join(\"\")}</${tag}>`;\n }\n }\n throw new Error(\n \"[tiptap error]: Unsupported DomOutputSpec type, check the `renderHTML` method output or implement a node mapping\",\n {\n cause: content\n }\n );\n}\nfunction renderToHTMLString({\n content,\n extensions,\n options\n}) {\n return renderToElement({\n renderer: renderJSONContentToString,\n domOutputSpecToElement: domOutputSpecToHTMLString,\n mapDefinedTypes: {\n // Map a doc node to concatenated children\n doc: ({ children }) => serializeChildrenToHTMLString(children),\n // Map a text node to its text content\n text: ({ node }) => {\n var _a;\n return (_a = node.text) != null ? _a : \"\";\n }\n },\n content,\n extensions,\n options\n });\n}\n\n// src/pm/markdown/markdown.ts\nfunction renderToMarkdown({\n content,\n extensions,\n options\n}) {\n return renderToHTMLString({\n content,\n extensions,\n options: {\n ...options,\n nodeMapping: {\n bulletList({ children }) {\n return `\n${serializeChildrenToHTMLString(children)}`;\n },\n orderedList({ children }) {\n return `\n${serializeChildrenToHTMLString(children)}`;\n },\n listItem({ node, children, parent }) {\n if ((parent == null ? void 0 : parent.type.name) === \"bulletList\") {\n return `- ${serializeChildrenToHTMLString(children).trim()}\n`;\n }\n if ((parent == null ? void 0 : parent.type.name) === \"orderedList\") {\n let number = parent.attrs.start || 1;\n parent.forEach((parentChild, _offset, index) => {\n if (node === parentChild) {\n number = index + 1;\n }\n });\n return `${number}. ${serializeChildrenToHTMLString(children).trim()}\n`;\n }\n return serializeChildrenToHTMLString(children);\n },\n paragraph({ children }) {\n return `\n${serializeChildrenToHTMLString(children)}\n`;\n },\n heading({ node, children }) {\n const level = node.attrs.level;\n return `${new Array(level).fill(\"#\").join(\"\")} ${children}\n`;\n },\n codeBlock({ node, children }) {\n return `\n\\`\\`\\`${node.attrs.language}\n${serializeChildrenToHTMLString(children)}\n\\`\\`\\`\n`;\n },\n blockquote({ children }) {\n return `\n${serializeChildrenToHTMLString(children).trim().split(\"\\n\").map((a) => `> ${a}`).join(\"\\n\")}`;\n },\n image({ node }) {\n return ``;\n },\n hardBreak() {\n return \"\\n\";\n },\n horizontalRule() {\n return \"\\n---\\n\";\n },\n table({ children, node }) {\n if (!Array.isArray(children)) {\n return `\n${serializeChildrenToHTMLString(children)}\n`;\n }\n const columnCount = node.children[0].childCount;\n return `\n${serializeChildrenToHTMLString(children[0])}| ${new Array(columnCount).fill(\"---\").join(\" | \")} |\n${serializeChildrenToHTMLString(children.slice(1))}\n`;\n },\n tableRow({ children }) {\n if (Array.isArray(children)) {\n return `| ${children.join(\" | \")} |\n`;\n }\n return `${serializeChildrenToHTMLString(children)}\n`;\n },\n tableHeader({ children }) {\n return serializeChildrenToHTMLString(children).trim();\n },\n tableCell({ children }) {\n return serializeChildrenToHTMLString(children).trim();\n },\n ...options == null ? void 0 : options.nodeMapping\n },\n markMapping: {\n bold({ children }) {\n return `**${serializeChildrenToHTMLString(children)}**`;\n },\n italic({ children, node }) {\n let isBoldToo = false;\n if (node == null ? void 0 : node.marks.some((m) => m.type.name === \"bold\")) {\n isBoldToo = true;\n }\n if (isBoldToo) {\n return `*${serializeChildrenToHTMLString(children)}*`;\n }\n return `_${serializeChildrenToHTMLString(children)}_`;\n },\n code({ children }) {\n return `\\`${serializeChildrenToHTMLString(children)}\\``;\n },\n strike({ children }) {\n return `~~${serializeChildrenToHTMLString(children)}~~`;\n },\n underline({ children }) {\n return `<u>${serializeChildrenToHTMLString(children)}</u>`;\n },\n subscript({ children }) {\n return `<sub>${serializeChildrenToHTMLString(children)}</sub>`;\n },\n superscript({ children }) {\n return `<sup>${serializeChildrenToHTMLString(children)}</sup>`;\n },\n link({ mark, children }) {\n return `[${serializeChildrenToHTMLString(children)}](${mark.attrs.href})`;\n },\n highlight({ children }) {\n return `==${serializeChildrenToHTMLString(children)}==`;\n },\n ...options == null ? void 0 : options.markMapping\n }\n }\n });\n}\nexport {\n mapMarkExtensionToReactNode,\n mapNodeExtensionToReactNode,\n renderToElement,\n renderToMarkdown\n};\n//# sourceMappingURL=index.js.map","import { renderToMarkdown } from '@tiptap/static-renderer/pm/markdown';\n\n// The pm/markdown renderer passes children as string[] (one entry per child node),\n// not as a pre-joined string. Normalize to a string before processing.\nconst joinChildren = (children) => Array.isArray(children) ? children.join('') : (children || '');\n\n// Move leading/trailing spaces outside mark delimiters so parsers like CommonMark\n// don't reject them (e.g. \"** bold **\" → \" **bold** \").\nconst wrapMark = (text, open, close) => {\n const trimmed = text.trim();\n if (!trimmed) return text;\n const leading = text.slice(0, text.length - text.trimStart().length);\n const trailing = text.slice(text.trimEnd().length);\n return `${leading}${open}${trimmed}${close}${trailing}`;\n};\n\n/**\n * Renders a TipTap/ProseMirror JSON document to a markdown string.\n *\n * Uses @tiptap/static-renderer with custom mappings to preserve the output\n * format of the legacy jsonToMarkdownConverter, including Dialtone-specific\n * node types (mention, channel, emoji, variable, slash-commands).\n *\n * @param {import('@tiptap/core').JSONContent} jsonContent - TipTap JSON document\n * @param {import('@tiptap/core').Extensions} extensions - Active editor extensions\n * @returns {string}\n */\nexport function renderEditorToMarkdown (jsonContent, extensions) {\n const output = renderToMarkdown({\n extensions,\n content: jsonContent,\n options: {\n nodeMapping: {\n // Override blockquote: built-in omits trailing newline (causes lazy continuation).\n // Since we replace the built-in entirely, we must add the '> ' prefix ourselves.\n blockquote ({ children }) {\n const text = joinChildren(children).trim();\n const quoted = text\n .split('\\n')\n .map(line => line ? `> ${line}` : '>')\n .join('\\n');\n return quoted + '\\n';\n },\n\n // Override codeBlock: built-in passes null language through literally\n codeBlock ({ node, children }) {\n const lang = node.attrs?.language || '';\n return `\\`\\`\\`${lang}\\n${joinChildren(children)}\\n\\`\\`\\`\\n`;\n },\n\n // Custom Dialtone node types\n mention ({ node }) {\n const id = node.attrs?.id || '';\n const contactKey = node.attrs?.contactKey || '';\n const name = node.attrs?.name || '';\n return `<!-- @mention: {\"id\": \"${id}\", \"contactKey\": \"${contactKey}\", \"name\": \"${name}\"} -->`;\n },\n\n channel ({ node }) {\n const id = node.attrs?.id || '';\n const channelKey = node.attrs?.channelKey || '';\n const name = node.attrs?.name || '';\n const locked = String(node.attrs?.locked ?? '');\n return `<!-- @channel: {\"id\": \"${id}\", \"channelKey\": \"${channelKey}\", \"name\": \"${name}\", \"locked\": \"${locked}\"} -->`;\n },\n\n 'slash-commands' ({ node }) {\n return `/${node.attrs?.command || ''}`;\n },\n\n emoji ({ node }) {\n return node.attrs?.code || '';\n },\n\n variable ({ node }) {\n const id = node.attrs?.id || '';\n const altText = node.attrs?.altText || '';\n return `{{${id}=${altText}}}`;\n },\n },\n\n markMapping: {\n bold ({ children }) {\n return wrapMark(joinChildren(children), '**', '**');\n },\n\n // Override italic: use * instead of built-in _ and fix boundary spaces\n italic ({ children }) {\n return wrapMark(joinChildren(children), '*', '*');\n },\n\n strike ({ children }) {\n return wrapMark(joinChildren(children), '~~', '~~');\n },\n\n code ({ children }) {\n return wrapMark(joinChildren(children), '`', '`');\n },\n\n link ({ mark, children }) {\n const text = joinChildren(children);\n const href = mark.attrs?.href || '';\n const trimmed = text.trim();\n const leading = text.slice(0, text.length - text.trimStart().length);\n const trailing = text.slice(text.trimEnd().length);\n return `${leading}[${trimmed}](${href})${trailing}`;\n },\n\n // Override underline: pass-through (no markdown equivalent, matches legacy no-op)\n underline ({ children }) {\n return joinChildren(children);\n },\n },\n },\n });\n // Collapse 3+ consecutive newlines to 2 (CommonMark ignores extra blank\n // lines between blocks), and strip the leading newline that the built-in\n // paragraph renderer always prepends to the first node.\n return output.replace(/\\n{3,}/g, '\\n\\n').replace(/^\\n+|\\n+$/g, '');\n}\n"],"x_google_ignoreList":[0],"mappings":";;;AAYA,SAAS,EAAc,GAAY,GAAqB,GAAwB;CAC9E,IAAM,IAAuB,EAAW;AAIxC,QAHK,IAGE,EAAoB,QAAQ,MAC7B,EAAK,UAAU,OAAO,EAAW,QAAS,WAAW,EAAW,OAAO,EAAW,KAAK,QAGvF,IACK,EAAK,UAAU,WAEjB,KALE,GAMT,CAAC,KAAK,MACD,EAAK,UAAU,cAKb,EAAK,UAAU,WAAW,EAAqB,IAJ7C,GACJ,EAAK,OAAO,EAAK,QAAQ,IAAuB,EAAqB,EAAK,QAAQ,EAAK,UAAU,SACnG,CAKH,CAAC,QAAQ,GAAY,MAAc,EAAgB,GAAY,EAAU,EAAE,EAAE,CAAC,GAnBvE,EAAE;;AAqBb,SAAS,EAAkB,GAAY,GAAqB;AAC1D,QAAO,EAAc,GAAY,GAAqB,GAA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AM,IAAO,EAAa,EAAS,EAC7B,IAAO,EAAK,OAAO,QAAQ,IAC3B,IAAU,EAAK,MAAM;AAG3B,YAAO,GAFS,EAAK,MAAM,GAAG,EAAK,SAAS,EAAK,WAAW,CAAC,OAAO,CAElD,GAAG,EAAQ,IAAI,EAAK,GADrB,EAAK,MAAM,EAAK,SAAS,CAAC,OAAO;;IAKpD,UAAW,EAAE,eAAY;AACvB,YAAO,EAAa,EAAS;;IAEhC;GACF;EACF,CAAC,CAIY,QAAQ,WAAW,OAAO,CAAC,QAAQ,cAAc,GAAG"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require(`./chunk-Bmb41Sf3.cjs`);let e=require(`@tiptap/core`),t=require(`@tiptap/pm/model`);function n(t,n,r){let i=t.attrs;return i?n.filter(e=>e.type===(typeof t.type==`string`?t.type:t.type.name)?r?e.attribute.rendered:!0:!1).map(e=>e.attribute.renderHTML&&e.attribute.renderHTML(i)||{[e.name]:e.name in i?i[e.name]:e.attribute.default}).reduce((t,n)=>(0,e.mergeAttributes)(t,n),{}):{}}function r(e,t){return n(e,t,!0)}function i(t,n,i,a){let o=(0,e.getExtensionField)(n,`renderHTML`,{name:n.name,options:n.options,storage:n.storage,parent:n.parent});return o?[n.name,({node:e,children:a})=>{try{return t(o({node:e,HTMLAttributes:r(e,i)}))(a)}catch(e){throw Error(`[tiptap error]: Node ${n.name} cannot be rendered, it's "renderToHTML" method threw an error: ${e.message}`,{cause:e})}}]:a?.unhandledNode?[n.name,a.unhandledNode]:[n.name,()=>{throw Error(`[tiptap error]: Node ${n.name} cannot be rendered, it is missing a "renderToHTML" method, please implement it or override the corresponding "nodeMapping" method to have a custom rendering`)}]}function a(t,n,i,a){let o=(0,e.getExtensionField)(n,`renderHTML`,{name:n.name,options:n.options,storage:n.storage,parent:n.parent});return o?[n.name,({mark:e,children:a})=>{try{return t(o({mark:e,HTMLAttributes:r(e,i)}))(a)}catch(e){throw Error(`[tiptap error]: Mark ${n.name} cannot be rendered, it's "renderToHTML" method threw an error: ${e.message}`,{cause:e})}}]:a?.unhandledMark?[n.name,a.unhandledMark]:[n.name,()=>{throw Error(`Node ${n.name} cannot be rendered, it is missing a "renderToHTML" method`)}]}function o({renderer:n,domOutputSpecToElement:r,mapDefinedTypes:o,content:s,extensions:c,options:l}){c=(0,e.resolveExtensions)(c);let u=(0,e.getAttributesFromExtensions)(c),{nodeExtensions:d,markExtensions:f}=(0,e.splitExtensions)(c);return s instanceof t.Node||(s=t.Node.fromJSON((0,e.getSchemaByResolvedExtensions)(c),s)),n({...l,nodeMapping:{...Object.fromEntries(d.filter(e=>e.name in o?!1:l?.nodeMapping?!(e.name in l.nodeMapping):!0).map(e=>i(r,e,u,l))),...o,...l?.nodeMapping},markMapping:{...Object.fromEntries(f.filter(e=>l?.markMapping?!(e.name in l.markMapping):!0).map(e=>a(r,e,u,l))),...l?.markMapping}})({content:s})}function s(e,{nodeMapping:t,markMapping:n,unhandledNode:r,unhandledMark:i}){return function a({content:o,parent:s}){let c=typeof o.type==`string`?o.type:o.type.name,l=t[c]??r;if(!l)throw Error(`missing handler for node type ${c}`);let u=e({component:l,props:{node:o,parent:s,renderElement:a,get children(){let e=[];return o.content&&o.content.forEach(t=>{e.push(a({content:t,parent:o}))}),e}}});return o.marks?o.marks.reduce((t,r)=>{let a=typeof r.type==`string`?r.type:r.type.name,c=n[a]??i;if(!c)throw Error(`missing handler for mark type ${a}`);return e({component:c,props:{mark:r,parent:s,node:o,children:t}})},u):u}}function c(e){return s(e=>e.component(e.props),e)}function l(e){let t=Object.entries(e||{}).map(([e,t])=>`${e.split(` `).at(-1)}=${JSON.stringify(t)}`).join(` `);return t?` ${t}`:``}function u(e){return[].concat(e||``).filter(Boolean).join(``)}var d=new Set([`iframe`,`script`,`style`,`title`,`textarea`,`div`,`span`,`a`,`button`]);function f(e){if(typeof e==`string`)return()=>e;if(typeof e==`object`&&`length`in e){let[t,n,r,...i]=e,a=t,o=a.split(` `);if(o.length>1&&(a=`${o[1]} xmlns="${o[0]}"`),n===void 0)return()=>`<${a}/>`;if(n===0)return e=>`<${a}>${u(e)}</${a}>`;if(typeof n==`object`)return Array.isArray(n)?r===void 0||r===0?e=>`<${a}>${f(n)(e)}</${a}>`:e=>`<${a}>${f(n)(e)}${[r].concat(i).map(t=>f(t)(e))}</${a}>`:r===void 0?d.has(a)?()=>`<${a}${l(n)}></${a}>`:()=>`<${a}${l(n)}/>`:r===0?e=>`<${a}${l(n)}>${u(e)}</${a}>`:e=>`<${a}${l(n)}>${[r].concat(i).map(t=>f(t)(e)).join(``)}</${a}>`}throw Error("[tiptap error]: Unsupported DomOutputSpec type, check the `renderHTML` method output or implement a node mapping",{cause:e})}function p({content:e,extensions:t,options:n}){return o({renderer:c,domOutputSpecToElement:f,mapDefinedTypes:{doc:({children:e})=>u(e),text:({node:e})=>e.text??``},content:e,extensions:t,options:n})}function m({content:e,extensions:t,options:n}){return p({content:e,extensions:t,options:{...n,nodeMapping:{bulletList({children:e}){return`
|
|
2
|
+
${u(e)}`},orderedList({children:e}){return`
|
|
3
|
+
${u(e)}`},listItem({node:e,children:t,parent:n}){if(n?.type.name===`bulletList`)return`- ${u(t).trim()}
|
|
4
|
+
`;if(n?.type.name===`orderedList`){let r=n.attrs.start||1;return n.forEach((t,n,i)=>{e===t&&(r=i+1)}),`${r}. ${u(t).trim()}
|
|
5
|
+
`}return u(t)},paragraph({children:e}){return`
|
|
6
|
+
${u(e)}
|
|
7
|
+
`},heading({node:e,children:t}){let n=e.attrs.level;return`${Array(n).fill(`#`).join(``)} ${t}
|
|
8
|
+
`},codeBlock({node:e,children:t}){return`
|
|
9
|
+
\`\`\`${e.attrs.language}
|
|
10
|
+
${u(t)}
|
|
11
|
+
\`\`\`
|
|
12
|
+
`},blockquote({children:e}){return`
|
|
13
|
+
${u(e).trim().split(`
|
|
14
|
+
`).map(e=>`> ${e}`).join(`
|
|
15
|
+
`)}`},image({node:e}){return``},hardBreak(){return`
|
|
16
|
+
`},horizontalRule(){return`
|
|
17
|
+
---
|
|
18
|
+
`},table({children:e,node:t}){if(!Array.isArray(e))return`
|
|
19
|
+
${u(e)}
|
|
20
|
+
`;let n=t.children[0].childCount;return`
|
|
21
|
+
${u(e[0])}| ${Array(n).fill(`---`).join(` | `)} |
|
|
22
|
+
${u(e.slice(1))}
|
|
23
|
+
`},tableRow({children:e}){return Array.isArray(e)?`| ${e.join(` | `)} |
|
|
24
|
+
`:`${u(e)}
|
|
25
|
+
`},tableHeader({children:e}){return u(e).trim()},tableCell({children:e}){return u(e).trim()},...n?.nodeMapping},markMapping:{bold({children:e}){return`**${u(e)}**`},italic({children:e,node:t}){let n=!1;return t?.marks.some(e=>e.type.name===`bold`)&&(n=!0),n?`*${u(e)}*`:`_${u(e)}_`},code({children:e}){return`\`${u(e)}\``},strike({children:e}){return`~~${u(e)}~~`},underline({children:e}){return`<u>${u(e)}</u>`},subscript({children:e}){return`<sub>${u(e)}</sub>`},superscript({children:e}){return`<sup>${u(e)}</sup>`},link({mark:e,children:t}){return`[${u(t)}](${e.attrs.href})`},highlight({children:e}){return`==${u(e)}==`},...n?.markMapping}}})}var h=e=>Array.isArray(e)?e.join(``):e||``,g=(e,t,n)=>{let r=e.trim();return r?`${e.slice(0,e.length-e.trimStart().length)}${t}${r}${n}${e.slice(e.trimEnd().length)}`:e};function _(e,t){return m({extensions:t,content:e,options:{nodeMapping:{blockquote({children:e}){return h(e).trim().split(`
|
|
26
|
+
`).map(e=>e?`> ${e}`:`>`).join(`
|
|
27
|
+
`)+`
|
|
28
|
+
`},codeBlock({node:e,children:t}){return`\`\`\`${e.attrs?.language||``}\n${h(t)}\n\`\`\`\n`},mention({node:e}){return`<!-- @mention: {"id": "${e.attrs?.id||``}", "contactKey": "${e.attrs?.contactKey||``}", "name": "${e.attrs?.name||``}"} -->`},channel({node:e}){return`<!-- @channel: {"id": "${e.attrs?.id||``}", "channelKey": "${e.attrs?.channelKey||``}", "name": "${e.attrs?.name||``}", "locked": "${String(e.attrs?.locked??``)}"} -->`},"slash-commands"({node:e}){return`/${e.attrs?.command||``}`},emoji({node:e}){return e.attrs?.code||``},variable({node:e}){return`{{${e.attrs?.id||``}=${e.attrs?.altText||``}}}`}},markMapping:{bold({children:e}){return g(h(e),`**`,`**`)},italic({children:e}){return g(h(e),`*`,`*`)},strike({children:e}){return g(h(e),`~~`,`~~`)},code({children:e}){return g(h(e),"`","`")},link({mark:e,children:t}){let n=h(t),r=e.attrs?.href||``,i=n.trim();return`${n.slice(0,n.length-n.trimStart().length)}[${i}](${r})${n.slice(n.trimEnd().length)}`},underline({children:e}){return h(e)}}}}).replace(/\n{3,}/g,`
|
|
29
|
+
|
|
30
|
+
`).replace(/^\n+|\n+$/g,``)}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return _}});
|
|
31
|
+
//# sourceMappingURL=markdownRenderer-PRpHJ151.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdownRenderer-PRpHJ151.cjs","names":["Node"],"sources":["../../../node_modules/.pnpm/@tiptap+static-renderer@3.19.0_@tiptap+core@3.19.0_@tiptap+pm@3.19.0__@tiptap+pm@3.19.0_react_4n7lapq7bmfej5hsrzhdkukr6e/node_modules/@tiptap/static-renderer/dist/pm/markdown/index.js","../components/rich_text_editor/markdownRenderer.js"],"sourcesContent":["// src/pm/extensionRenderer.ts\nimport {\n getAttributesFromExtensions,\n getExtensionField,\n getSchemaByResolvedExtensions,\n resolveExtensions,\n splitExtensions\n} from \"@tiptap/core\";\nimport { Node } from \"@tiptap/pm/model\";\n\n// src/helpers.ts\nimport { mergeAttributes } from \"@tiptap/core\";\nfunction getAttributes(nodeOrMark, extensionAttributes, onlyRenderedAttributes) {\n const nodeOrMarkAttributes = nodeOrMark.attrs;\n if (!nodeOrMarkAttributes) {\n return {};\n }\n return extensionAttributes.filter((item) => {\n if (item.type !== (typeof nodeOrMark.type === \"string\" ? nodeOrMark.type : nodeOrMark.type.name)) {\n return false;\n }\n if (onlyRenderedAttributes) {\n return item.attribute.rendered;\n }\n return true;\n }).map((item) => {\n if (!item.attribute.renderHTML) {\n return {\n [item.name]: item.name in nodeOrMarkAttributes ? nodeOrMarkAttributes[item.name] : item.attribute.default\n };\n }\n return item.attribute.renderHTML(nodeOrMarkAttributes) || {\n [item.name]: item.name in nodeOrMarkAttributes ? nodeOrMarkAttributes[item.name] : item.attribute.default\n };\n }).reduce((attributes, attribute) => mergeAttributes(attributes, attribute), {});\n}\nfunction getHTMLAttributes(nodeOrMark, extensionAttributes) {\n return getAttributes(nodeOrMark, extensionAttributes, true);\n}\n\n// src/pm/extensionRenderer.ts\nfunction mapNodeExtensionToReactNode(domOutputSpecToElement, extension, extensionAttributes, options) {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n parent: extension.parent\n };\n const renderToHTML = getExtensionField(extension, \"renderHTML\", context);\n if (!renderToHTML) {\n if (options == null ? void 0 : options.unhandledNode) {\n return [extension.name, options.unhandledNode];\n }\n return [\n extension.name,\n () => {\n throw new Error(\n `[tiptap error]: Node ${extension.name} cannot be rendered, it is missing a \"renderToHTML\" method, please implement it or override the corresponding \"nodeMapping\" method to have a custom rendering`\n );\n }\n ];\n }\n return [\n extension.name,\n ({ node, children }) => {\n try {\n return domOutputSpecToElement(\n renderToHTML({\n node,\n HTMLAttributes: getHTMLAttributes(node, extensionAttributes)\n })\n )(children);\n } catch (e) {\n throw new Error(\n `[tiptap error]: Node ${extension.name} cannot be rendered, it's \"renderToHTML\" method threw an error: ${e.message}`,\n { cause: e }\n );\n }\n }\n ];\n}\nfunction mapMarkExtensionToReactNode(domOutputSpecToElement, extension, extensionAttributes, options) {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n parent: extension.parent\n };\n const renderToHTML = getExtensionField(extension, \"renderHTML\", context);\n if (!renderToHTML) {\n if (options == null ? void 0 : options.unhandledMark) {\n return [extension.name, options.unhandledMark];\n }\n return [\n extension.name,\n () => {\n throw new Error(`Node ${extension.name} cannot be rendered, it is missing a \"renderToHTML\" method`);\n }\n ];\n }\n return [\n extension.name,\n ({ mark, children }) => {\n try {\n return domOutputSpecToElement(\n renderToHTML({\n mark,\n HTMLAttributes: getHTMLAttributes(mark, extensionAttributes)\n })\n )(children);\n } catch (e) {\n throw new Error(\n `[tiptap error]: Mark ${extension.name} cannot be rendered, it's \"renderToHTML\" method threw an error: ${e.message}`,\n { cause: e }\n );\n }\n }\n ];\n}\nfunction renderToElement({\n renderer,\n domOutputSpecToElement,\n mapDefinedTypes,\n content,\n extensions,\n options\n}) {\n extensions = resolveExtensions(extensions);\n const extensionAttributes = getAttributesFromExtensions(extensions);\n const { nodeExtensions, markExtensions } = splitExtensions(extensions);\n if (!(content instanceof Node)) {\n content = Node.fromJSON(getSchemaByResolvedExtensions(extensions), content);\n }\n return renderer({\n ...options,\n nodeMapping: {\n ...Object.fromEntries(\n nodeExtensions.filter((e) => {\n if (e.name in mapDefinedTypes) {\n return false;\n }\n if (options == null ? void 0 : options.nodeMapping) {\n return !(e.name in options.nodeMapping);\n }\n return true;\n }).map(\n (nodeExtension) => mapNodeExtensionToReactNode(domOutputSpecToElement, nodeExtension, extensionAttributes, options)\n )\n ),\n ...mapDefinedTypes,\n ...options == null ? void 0 : options.nodeMapping\n },\n markMapping: {\n ...Object.fromEntries(\n markExtensions.filter((e) => {\n if (options == null ? void 0 : options.markMapping) {\n return !(e.name in options.markMapping);\n }\n return true;\n }).map((mark) => mapMarkExtensionToReactNode(domOutputSpecToElement, mark, extensionAttributes, options))\n ),\n ...options == null ? void 0 : options.markMapping\n }\n })({ content });\n}\n\n// src/json/renderer.ts\nfunction TiptapStaticRenderer(renderComponent, {\n nodeMapping,\n markMapping,\n unhandledNode,\n unhandledMark\n}) {\n return function renderContent({\n content,\n parent\n }) {\n var _a;\n const nodeType = typeof content.type === \"string\" ? content.type : content.type.name;\n const NodeHandler = (_a = nodeMapping[nodeType]) != null ? _a : unhandledNode;\n if (!NodeHandler) {\n throw new Error(`missing handler for node type ${nodeType}`);\n }\n const nodeContent = renderComponent({\n component: NodeHandler,\n props: {\n node: content,\n parent,\n renderElement: renderContent,\n // Lazily compute the children to avoid unnecessary recursion\n get children() {\n const children = [];\n if (content.content) {\n content.content.forEach((child) => {\n children.push(\n renderContent({\n content: child,\n parent: content\n })\n );\n });\n }\n return children;\n }\n }\n });\n const markedContent = content.marks ? content.marks.reduce((acc, mark) => {\n var _a2;\n const markType = typeof mark.type === \"string\" ? mark.type : mark.type.name;\n const MarkHandler = (_a2 = markMapping[markType]) != null ? _a2 : unhandledMark;\n if (!MarkHandler) {\n throw new Error(`missing handler for mark type ${markType}`);\n }\n return renderComponent({\n component: MarkHandler,\n props: {\n mark,\n parent,\n node: content,\n children: acc\n }\n });\n }, nodeContent) : nodeContent;\n return markedContent;\n };\n}\n\n// src/json/html-string/string.ts\nfunction renderJSONContentToString(options) {\n return TiptapStaticRenderer((ctx) => {\n return ctx.component(ctx.props);\n }, options);\n}\nfunction serializeAttrsToHTMLString(attrs) {\n const output = Object.entries(attrs || {}).map(([key, value]) => `${key.split(\" \").at(-1)}=${JSON.stringify(value)}`).join(\" \");\n return output ? ` ${output}` : \"\";\n}\nfunction serializeChildrenToHTMLString(children) {\n return [].concat(children || \"\").filter(Boolean).join(\"\");\n}\n\n// src/pm/html-string/html-string.ts\nvar NON_SELF_CLOSING_TAGS = /* @__PURE__ */ new Set([\"iframe\", \"script\", \"style\", \"title\", \"textarea\", \"div\", \"span\", \"a\", \"button\"]);\nfunction domOutputSpecToHTMLString(content) {\n if (typeof content === \"string\") {\n return () => content;\n }\n if (typeof content === \"object\" && \"length\" in content) {\n const [_tag, attrs, children, ...rest] = content;\n let tag = _tag;\n const parts = tag.split(\" \");\n if (parts.length > 1) {\n tag = `${parts[1]} xmlns=\"${parts[0]}\"`;\n }\n if (attrs === void 0) {\n return () => `<${tag}/>`;\n }\n if (attrs === 0) {\n return (child) => `<${tag}>${serializeChildrenToHTMLString(child)}</${tag}>`;\n }\n if (typeof attrs === \"object\") {\n if (Array.isArray(attrs)) {\n if (children === void 0) {\n return (child) => `<${tag}>${domOutputSpecToHTMLString(attrs)(child)}</${tag}>`;\n }\n if (children === 0) {\n return (child) => `<${tag}>${domOutputSpecToHTMLString(attrs)(child)}</${tag}>`;\n }\n return (child) => `<${tag}>${domOutputSpecToHTMLString(attrs)(child)}${[children].concat(rest).map((a) => domOutputSpecToHTMLString(a)(child))}</${tag}>`;\n }\n if (children === void 0) {\n if (NON_SELF_CLOSING_TAGS.has(tag)) {\n return () => `<${tag}${serializeAttrsToHTMLString(attrs)}></${tag}>`;\n }\n return () => `<${tag}${serializeAttrsToHTMLString(attrs)}/>`;\n }\n if (children === 0) {\n return (child) => `<${tag}${serializeAttrsToHTMLString(attrs)}>${serializeChildrenToHTMLString(child)}</${tag}>`;\n }\n return (child) => `<${tag}${serializeAttrsToHTMLString(attrs)}>${[children].concat(rest).map((a) => domOutputSpecToHTMLString(a)(child)).join(\"\")}</${tag}>`;\n }\n }\n throw new Error(\n \"[tiptap error]: Unsupported DomOutputSpec type, check the `renderHTML` method output or implement a node mapping\",\n {\n cause: content\n }\n );\n}\nfunction renderToHTMLString({\n content,\n extensions,\n options\n}) {\n return renderToElement({\n renderer: renderJSONContentToString,\n domOutputSpecToElement: domOutputSpecToHTMLString,\n mapDefinedTypes: {\n // Map a doc node to concatenated children\n doc: ({ children }) => serializeChildrenToHTMLString(children),\n // Map a text node to its text content\n text: ({ node }) => {\n var _a;\n return (_a = node.text) != null ? _a : \"\";\n }\n },\n content,\n extensions,\n options\n });\n}\n\n// src/pm/markdown/markdown.ts\nfunction renderToMarkdown({\n content,\n extensions,\n options\n}) {\n return renderToHTMLString({\n content,\n extensions,\n options: {\n ...options,\n nodeMapping: {\n bulletList({ children }) {\n return `\n${serializeChildrenToHTMLString(children)}`;\n },\n orderedList({ children }) {\n return `\n${serializeChildrenToHTMLString(children)}`;\n },\n listItem({ node, children, parent }) {\n if ((parent == null ? void 0 : parent.type.name) === \"bulletList\") {\n return `- ${serializeChildrenToHTMLString(children).trim()}\n`;\n }\n if ((parent == null ? void 0 : parent.type.name) === \"orderedList\") {\n let number = parent.attrs.start || 1;\n parent.forEach((parentChild, _offset, index) => {\n if (node === parentChild) {\n number = index + 1;\n }\n });\n return `${number}. ${serializeChildrenToHTMLString(children).trim()}\n`;\n }\n return serializeChildrenToHTMLString(children);\n },\n paragraph({ children }) {\n return `\n${serializeChildrenToHTMLString(children)}\n`;\n },\n heading({ node, children }) {\n const level = node.attrs.level;\n return `${new Array(level).fill(\"#\").join(\"\")} ${children}\n`;\n },\n codeBlock({ node, children }) {\n return `\n\\`\\`\\`${node.attrs.language}\n${serializeChildrenToHTMLString(children)}\n\\`\\`\\`\n`;\n },\n blockquote({ children }) {\n return `\n${serializeChildrenToHTMLString(children).trim().split(\"\\n\").map((a) => `> ${a}`).join(\"\\n\")}`;\n },\n image({ node }) {\n return ``;\n },\n hardBreak() {\n return \"\\n\";\n },\n horizontalRule() {\n return \"\\n---\\n\";\n },\n table({ children, node }) {\n if (!Array.isArray(children)) {\n return `\n${serializeChildrenToHTMLString(children)}\n`;\n }\n const columnCount = node.children[0].childCount;\n return `\n${serializeChildrenToHTMLString(children[0])}| ${new Array(columnCount).fill(\"---\").join(\" | \")} |\n${serializeChildrenToHTMLString(children.slice(1))}\n`;\n },\n tableRow({ children }) {\n if (Array.isArray(children)) {\n return `| ${children.join(\" | \")} |\n`;\n }\n return `${serializeChildrenToHTMLString(children)}\n`;\n },\n tableHeader({ children }) {\n return serializeChildrenToHTMLString(children).trim();\n },\n tableCell({ children }) {\n return serializeChildrenToHTMLString(children).trim();\n },\n ...options == null ? void 0 : options.nodeMapping\n },\n markMapping: {\n bold({ children }) {\n return `**${serializeChildrenToHTMLString(children)}**`;\n },\n italic({ children, node }) {\n let isBoldToo = false;\n if (node == null ? void 0 : node.marks.some((m) => m.type.name === \"bold\")) {\n isBoldToo = true;\n }\n if (isBoldToo) {\n return `*${serializeChildrenToHTMLString(children)}*`;\n }\n return `_${serializeChildrenToHTMLString(children)}_`;\n },\n code({ children }) {\n return `\\`${serializeChildrenToHTMLString(children)}\\``;\n },\n strike({ children }) {\n return `~~${serializeChildrenToHTMLString(children)}~~`;\n },\n underline({ children }) {\n return `<u>${serializeChildrenToHTMLString(children)}</u>`;\n },\n subscript({ children }) {\n return `<sub>${serializeChildrenToHTMLString(children)}</sub>`;\n },\n superscript({ children }) {\n return `<sup>${serializeChildrenToHTMLString(children)}</sup>`;\n },\n link({ mark, children }) {\n return `[${serializeChildrenToHTMLString(children)}](${mark.attrs.href})`;\n },\n highlight({ children }) {\n return `==${serializeChildrenToHTMLString(children)}==`;\n },\n ...options == null ? void 0 : options.markMapping\n }\n }\n });\n}\nexport {\n mapMarkExtensionToReactNode,\n mapNodeExtensionToReactNode,\n renderToElement,\n renderToMarkdown\n};\n//# sourceMappingURL=index.js.map","import { renderToMarkdown } from '@tiptap/static-renderer/pm/markdown';\n\n// The pm/markdown renderer passes children as string[] (one entry per child node),\n// not as a pre-joined string. Normalize to a string before processing.\nconst joinChildren = (children) => Array.isArray(children) ? children.join('') : (children || '');\n\n// Move leading/trailing spaces outside mark delimiters so parsers like CommonMark\n// don't reject them (e.g. \"** bold **\" → \" **bold** \").\nconst wrapMark = (text, open, close) => {\n const trimmed = text.trim();\n if (!trimmed) return text;\n const leading = text.slice(0, text.length - text.trimStart().length);\n const trailing = text.slice(text.trimEnd().length);\n return `${leading}${open}${trimmed}${close}${trailing}`;\n};\n\n/**\n * Renders a TipTap/ProseMirror JSON document to a markdown string.\n *\n * Uses @tiptap/static-renderer with custom mappings to preserve the output\n * format of the legacy jsonToMarkdownConverter, including Dialtone-specific\n * node types (mention, channel, emoji, variable, slash-commands).\n *\n * @param {import('@tiptap/core').JSONContent} jsonContent - TipTap JSON document\n * @param {import('@tiptap/core').Extensions} extensions - Active editor extensions\n * @returns {string}\n */\nexport function renderEditorToMarkdown (jsonContent, extensions) {\n const output = renderToMarkdown({\n extensions,\n content: jsonContent,\n options: {\n nodeMapping: {\n // Override blockquote: built-in omits trailing newline (causes lazy continuation).\n // Since we replace the built-in entirely, we must add the '> ' prefix ourselves.\n blockquote ({ children }) {\n const text = joinChildren(children).trim();\n const quoted = text\n .split('\\n')\n .map(line => line ? `> ${line}` : '>')\n .join('\\n');\n return quoted + '\\n';\n },\n\n // Override codeBlock: built-in passes null language through literally\n codeBlock ({ node, children }) {\n const lang = node.attrs?.language || '';\n return `\\`\\`\\`${lang}\\n${joinChildren(children)}\\n\\`\\`\\`\\n`;\n },\n\n // Custom Dialtone node types\n mention ({ node }) {\n const id = node.attrs?.id || '';\n const contactKey = node.attrs?.contactKey || '';\n const name = node.attrs?.name || '';\n return `<!-- @mention: {\"id\": \"${id}\", \"contactKey\": \"${contactKey}\", \"name\": \"${name}\"} -->`;\n },\n\n channel ({ node }) {\n const id = node.attrs?.id || '';\n const channelKey = node.attrs?.channelKey || '';\n const name = node.attrs?.name || '';\n const locked = String(node.attrs?.locked ?? '');\n return `<!-- @channel: {\"id\": \"${id}\", \"channelKey\": \"${channelKey}\", \"name\": \"${name}\", \"locked\": \"${locked}\"} -->`;\n },\n\n 'slash-commands' ({ node }) {\n return `/${node.attrs?.command || ''}`;\n },\n\n emoji ({ node }) {\n return node.attrs?.code || '';\n },\n\n variable ({ node }) {\n const id = node.attrs?.id || '';\n const altText = node.attrs?.altText || '';\n return `{{${id}=${altText}}}`;\n },\n },\n\n markMapping: {\n bold ({ children }) {\n return wrapMark(joinChildren(children), '**', '**');\n },\n\n // Override italic: use * instead of built-in _ and fix boundary spaces\n italic ({ children }) {\n return wrapMark(joinChildren(children), '*', '*');\n },\n\n strike ({ children }) {\n return wrapMark(joinChildren(children), '~~', '~~');\n },\n\n code ({ children }) {\n return wrapMark(joinChildren(children), '`', '`');\n },\n\n link ({ mark, children }) {\n const text = joinChildren(children);\n const href = mark.attrs?.href || '';\n const trimmed = text.trim();\n const leading = text.slice(0, text.length - text.trimStart().length);\n const trailing = text.slice(text.trimEnd().length);\n return `${leading}[${trimmed}](${href})${trailing}`;\n },\n\n // Override underline: pass-through (no markdown equivalent, matches legacy no-op)\n underline ({ children }) {\n return joinChildren(children);\n },\n },\n },\n });\n // Collapse 3+ consecutive newlines to 2 (CommonMark ignores extra blank\n // lines between blocks), and strip the leading newline that the built-in\n // paragraph renderer always prepends to the first node.\n return output.replace(/\\n{3,}/g, '\\n\\n').replace(/^\\n+|\\n+$/g, '');\n}\n"],"x_google_ignoreList":[0],"mappings":"4FAYA,SAAS,EAAc,EAAY,EAAqB,EAAwB,CAC9E,IAAM,EAAuB,EAAW,MAIxC,OAHK,EAGE,EAAoB,OAAQ,GAC7B,EAAK,QAAU,OAAO,EAAW,MAAS,SAAW,EAAW,KAAO,EAAW,KAAK,MAGvF,EACK,EAAK,UAAU,SAEjB,GALE,GAMT,CAAC,IAAK,GACD,EAAK,UAAU,YAKb,EAAK,UAAU,WAAW,EAAqB,EAJ7C,EACJ,EAAK,MAAO,EAAK,QAAQ,EAAuB,EAAqB,EAAK,MAAQ,EAAK,UAAU,QACnG,CAKH,CAAC,QAAQ,EAAY,KAAA,EAAA,EAAA,iBAA8B,EAAY,EAAU,CAAE,EAAE,CAAC,CAnBvE,EAAE,CAqBb,SAAS,EAAkB,EAAY,EAAqB,CAC1D,OAAO,EAAc,EAAY,EAAqB,GAAK,CAI7D,SAAS,EAA4B,EAAwB,EAAW,EAAqB,EAAS,CAOpG,IAAM,GAAA,EAAA,EAAA,mBAAiC,EAAW,aANlC,CACd,KAAM,EAAU,KAChB,QAAS,EAAU,QACnB,QAAS,EAAU,QACnB,OAAQ,EAAU,OACnB,CACuE,CAcxE,OAbK,EAaE,CACL,EAAU,MACT,CAAE,OAAM,cAAe,CACtB,GAAI,CACF,OAAO,EACL,EAAa,CACX,OACA,eAAgB,EAAkB,EAAM,EAAoB,CAC7D,CAAC,CACH,CAAC,EAAS,OACJ,EAAG,CACV,MAAU,MACR,wBAAwB,EAAU,KAAK,kEAAkE,EAAE,UAC3G,CAAE,MAAO,EA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(`./common/utils/index.cjs`),t=require(`./_plugin-vue_export-helper-D8jCH6HB.cjs`),n=require(`./localization/index.cjs`),r=require(`./lib/button/button.cjs`),i=require(`./lib/item-layout/item-layout.cjs`),a=require(`./lib/stack/stack.cjs`),o=require(`./lib/tooltip/tooltip.cjs`),s=require(`./lib/popover/popover.cjs`),c=require(`./lib/input/input.cjs`),l=require(`./emoji_picker-Cl-T4BXK.cjs`),u=require(`./node_modules/@tiptap/vue-3.cjs`),d=require(`./rich_text_editor-CEwKDuzw.cjs`),f=require(`./lib/rich-text-editor/rich-text-editor-constants.cjs`),p=require(`./lib/editor/editor-constants.cjs`),m=require(`./lib/message-input/last-active-nodes.cjs`),h=require(`./lib/message-input/message-input-topbar.cjs`),g=require(`./lib/message-input/message-input-link.cjs`);let _=require(`vue`),v=require(`@dialpad/dialtone-icons/vue3`),y=require(`@tiptap/core`);var b={name:`MeetingPill`,components:{NodeViewWrapper:u.NodeViewWrapper,DtItemLayout:i.default,DtIconClose:v.DtIconClose,DtButton:r.default,DtIconVideo:v.DtIconVideo},props:u.nodeViewProps,emits:[`meeting-pill-close`],data(){return{i18n:new n.DialtoneLocalization}},computed:{closeButtonTitle(){return this.i18n.$t(`DIALTONE_CLOSE_BUTTON`)}},methods:{close(e){let t=this.editor?.storage?.meetingPill?.onClose;t&&typeof t==`function`&&t(e)}}},x={class:`d-recipe-message-input-meeting-pill__icon`},S={class:`d-recipe-message-input-meeting-pill__close`};function C(e,t,n,r,i,a){let o=(0,_.resolveComponent)(`dt-icon-video`),s=(0,_.resolveComponent)(`dt-icon-close`),c=(0,_.resolveComponent)(`dt-button`),l=(0,_.resolveComponent)(`dt-item-layout`),u=(0,_.resolveComponent)(`node-view-wrapper`);return(0,_.openBlock)(),(0,_.createBlock)(u,{class:`d-recipe-message-input-meeting-pill`},{default:(0,_.withCtx)(()=>[(0,_.createVNode)(l,{class:`d-recipe-message-input-meeting-pill__layout`,unstyled:``},{left:(0,_.withCtx)(()=>[(0,_.createElementVNode)(`div`,x,[(0,_.createVNode)(o,{size:`400`})])]),right:(0,_.withCtx)(()=>[(0,_.createElementVNode)(`div`,S,[(0,_.createVNode)(c,{circle:``,importance:`clear`,size:`xs`,"aria-label":a.closeButtonTitle,title:a.closeButtonTitle,onClick:a.close},{icon:(0,_.withCtx)(()=>[(0,_.createVNode)(s,{size:`300`})]),_:1},8,[`aria-label`,`title`,`onClick`])])]),default:(0,_.withCtx)(()=>[(0,_.createTextVNode)(` `+(0,_.toDisplayString)(e.node.attrs.text)+` `,1)]),_:1})]),_:1})}var w=t.t(b,[[`render`,C]]),T=y.Node.create({name:`meetingPill`,atom:!0,group:`inline`,inline:!0,addOptions(){return{onClose:()=>{}}},addStorage(){return{onClose:this.options.onClose}},addNodeView(){return u.VueNodeViewRenderer(w)},addAttributes(){return{text:{default:`Please pass in "text" attribute`}}},parseHTML(){return[{tag:`meeting-pill`}]},renderText(){return`/dpm`},renderHTML({HTMLAttributes:e}){return[`meeting-pill`,(0,y.mergeAttributes)(e)]}}),E={compatConfig:{MODE:3},name:`DtRecipeMessageInput`,components:{DtButton:r.default,DtEmojiPicker:l.t,DtInput:c.default,DtPopover:s.default,DtRecipeMessageInputTopbar:h.default,DtRecipeMessageInputLink:g.default,DtRichTextEditor:d.t,DtTooltip:o.default,DtStack:a.default,DtIconImage:v.DtIconImage,DtIconVerySatisfied:v.DtIconVerySatisfied,DtIconSatisfied:v.DtIconSatisfied,DtIconSend:v.DtIconSend},inheritAttrs:!1,props:{richText:{type:Boolean,default:!0},modelValue:{type:[Object,String],default:``},editable:{type:Boolean,default:!0},inputAriaLabel:{type:String,required:!0,default:``},preventTyping:{type:Boolean,default:!1},inputClass:{type:String,default:``},autoFocus:{type:[Boolean,String,Number],default:!1,validator(e){return typeof e==`string`?f.RICH_TEXT_EDITOR_AUTOFOCUS_TYPES.includes(e):!0}},outputFormat:{type:String,default:`json`,validator(e){return f.RICH_TEXT_EDITOR_OUTPUT_FORMATS.includes(e)}},placeholder:{type:String,default:``},disableSend:{type:Boolean,default:!1},maxHeight:{type:String,default:`unset`},showEmojiPicker:{type:Boolean,default:!0},emojiPickerProps:{type:Object,default:()=>({})},showCharacterLimit:{type:[Boolean,Object],default:()=>({count:1500,warning:500,message:``})},showImagePicker:{type:[Boolean,Object],default:()=>({})},showSend:{type:[Boolean,Object],default:()=>({})},showCancel:{type:[Boolean,Object],default:()=>({})},mentionSuggestion:{type:Object,default:null},channelSuggestion:{type:Object,default:null},slashCommandSuggestion:{type:Object,default:null},boldButtonOptions:{type:Object,default:()=>({keyboardShortcutText:`Mod + B`})},italicButtonOptions:{type:Object,default:()=>({keyboardShortcutText:`Mod + I`})},strikeButtonOptions:{type:Object,default:()=>({keyboardShortcutText:`Mod + Shift + S`})},linkButtonOptions:{type:Object,default:()=>({keyboardShortcutText:`Mod + K`,linkPlaceholder:`e.g. https://www.dialpad.com`})},bulletListButtonOptions:{type:Object,default:()=>({keyboardShortcutText:`Mod + Shift + 8`})},orderedListButtonOptions:{type:Object,default:()=>({keyboardShortcutText:`Mod + Shift + 7`})},blockQuoteButtonOptions:{type:Object,default:()=>({keyboardShortcutText:`Mod + Shift + B`})},codeButtonOptions:{type:Object,default:()=>({keyboardShortcutText:`Mod + E`})},codeBlockButtonOptions:{type:Object,default:()=>({keyboardShortcutText:`Mod + Alt + C`})}},emits:[`submit`,`select-media`,`add-media`,`paste-media`,`cancel`,`skin-tone`,`selected-emoji`,`selected-command`,`meeting-pill-close`,`update:modelValue`,`text-input`,`markdown-input`,`add-emoji`,`emoji-scroll-bottom-reached`],data(){return{lastActiveNodes:m.default,additionalExtensions:[T.configure({onClose:e=>{this.$emit(`meeting-pill-close`,e)}})],internalInputValue:this.modelValue,imagePickerFocus:!1,emojiPickerFocus:!1,emojiPickerOpened:!1,isFocused:!1,linkOptions:{class:`d-link d-c-text d-d-inline-block`},linkDialogOpen:!1,selectedText:``,text:``,hideLinkBubbleMenu:!1,i18n:new n.DialtoneLocalization}},computed:{showSendIcon(){return!this.showSend.text},inputLength(){return this.text.length},displayCharacterLimitWarning(){return!!this.showCharacterLimit&&this.showCharacterLimit.count-this.inputLength<=this.showCharacterLimit.warning},characterLimitTooltipEnabled(){return this.showCharacterLimit.message&&this.showCharacterLimit.count-this.inputLength<0},isSelectionActive(){return this.selectedText,e=>[`bulletList`,`orderedList`].includes(e)?this.richText?this.lastActiveNodes(this.$refs.richTextEditor?.editor?.state,[{type:`bulletList`},{type:`orderedList`}]).includes(e)&&this.isFocused:!1:this.$refs.richTextEditor?.editor?.isActive(e)&&this.isFocused},isSendDisabled(){return this.disableSend||this.showCharacterLimit&&this.inputLength>this.showCharacterLimit.count},emojiPickerHovered(){return this.emojiPickerFocus||this.emojiPickerOpened},sendIconSize(){return`300`},sendButtonLabel(){return this.i18n.$t(`DIALTONE_MESSAGE_INPUT_SEND_BUTTON_ARIA_LABEL`)},imagePickerButtonLabel(){return this.i18n.$t(`DIALTONE_MESSAGE_INPUT_IMAGE_PICKER_BUTTON_ARIA_LABEL`)},emojiPickerButtonLabel(){return this.i18n.$t(`DIALTONE_MESSAGE_INPUT_EMOJI_PICKER_BUTTON_ARIA_LABEL`)},cancelButtonLabel(){return this.i18n.$t(`DIALTONE_MESSAGE_INPUT_CANCEL_BUTTON_ARIA_LABEL`)}},watch:{modelValue(e){this.internalInputValue=e},emojiPickerOpened(e){e||this.$refs.richTextEditor?.focusEditor()}},created(){this.modelValue&&this.outputFormat===`text`?this.internalInputValue=this.modelValue.replace(/\n/g,`<br>`):this.internalInputValue=this.modelValue},methods:{removeClassStyleAttrs:e.removeClassStyleAttrs,addClassStyleAttrs:e.addClassStyleAttrs,linkDialogOpened(e){this.linkDialogOpen=e,e===!0?this.initLinkDialog():(this.hideLinkBubbleMenu=!1,this.$refs.richTextEditor?.focusEditor())},handleTopbarClick(e){let t=this.$refs.richTextEditor?.editor,n={bold:()=>t?.chain().focus().toggleBold().run(),italic:()=>t?.chain().focus().toggleItalic().run(),strike:()=>t?.chain().focus().toggleStrike().run(),bulletList:()=>t?.chain().focus().toggleBulletList().run(),orderedList:()=>t?.chain().focus().toggleOrderedList().run(),blockquote:()=>t?.chain().focus().toggleBlockquote().run(),code:()=>t?.chain().focus().toggleCode().run(),codeBlock:()=>t?.chain().focus().toggleCodeBlock().run()};t&&n[e]&&n[e]()},initLinkDialog(){this.$refs.link.setInitialValues(this.selectedText,this.$refs.richTextEditor?.editor?.getAttributes(`link`)?.href),this.hideLinkBubbleMenu=!0,this.linkDialogOpen=!0},removeLink(){this.$refs.richTextEditor?.removeLink(),this.linkDialogOpen=!1},setLink(e,t){this.$refs.richTextEditor.setLink(t,e,this.linkOptions,p.EDITOR_SUPPORTED_LINK_PROTOCOLS,p.EDITOR_DEFAULT_LINK_PREFIX),this.linkDialogOpen=!1},onMousedown(t){e.returnFirstEl(this.$refs.richTextEditor.$el).querySelector(`.tiptap`).contains(t.target)||(t.preventDefault(),this.$refs.richTextEditor.focusEditor())},onDrop(e){let t=e.dataTransfer,n=Array.from(t.files);this.$emit(`add-media`,n)},onPaste(e){if(e.clipboardData.files.length){e.stopPropagation(),e.preventDefault();let t=[...e.clipboardData.files];this.$emit(`paste-media`,t)}},onSkinTone(e){this.$emit(`skin-tone`,e)},onSelectEmoji(e,t){e&&(e.shift_key||t(),this.$refs.richTextEditor.editor.commands.insertContent({type:`emoji`,attrs:{code:e.shortname,image:e.image,name:e.name}}),this.$emit(`selected-emoji`,e))},onSelectImage(){this.$refs.messageInputImageUpload.$refs.input.click()},onImageUpload(){this.$emit(`select-media`,this.$refs.messageInputImageUpload.$refs.input.files)},toggleEmojiPicker(){this.emojiPickerOpened=!this.emojiPickerOpened},onSend(){this.isSendDisabled||this.$emit(`submit`,this.internalInputValue)},onCancel(){this.$emit(`cancel`)},onInput(e){this.$emit(`update:modelValue`,e)},onTextInput(e){this.text=e,this.$emit(`text-input`,e)},onMarkdownInput(e){this.$emit(`markdown-input`,e)}}},D={class:`d-recipe-message-input__bottom-section`},O={class:`d-recipe-message-input__bottom-section-left`},k={class:`d-recipe-message-input__bottom-section-right`},A={class:`d-recipe-message-input__schedule-message`},j={class:`d-recipe-message-input__sms-count`},M={key:0};function N(e,t,n,r,i,a){let o=(0,_.resolveComponent)(`dt-recipe-message-input-link`),s=(0,_.resolveComponent)(`dt-recipe-message-input-topbar`),c=(0,_.resolveComponent)(`dt-rich-text-editor`),l=(0,_.resolveComponent)(`dt-icon-image`),u=(0,_.resolveComponent)(`dt-button`),d=(0,_.resolveComponent)(`dt-input`),f=(0,_.resolveComponent)(`dt-icon-very-satisfied`),p=(0,_.resolveComponent)(`dt-icon-satisfied`),m=(0,_.resolveComponent)(`dt-emoji-picker`),h=(0,_.resolveComponent)(`dt-popover`),g=(0,_.resolveComponent)(`dt-stack`),v=(0,_.resolveComponent)(`dt-tooltip`),y=(0,_.resolveComponent)(`dt-icon-send`),b=(0,_.resolveDirective)(`dt-scrollbar`),x=(0,_.resolveDirective)(`dt-tooltip`);return(0,_.openBlock)(),(0,_.createElementBlock)(`div`,(0,_.mergeProps)({"data-qa":`dt-recipe-message-input`,role:`presentation`,class:`d-recipe-message-input`},a.addClassStyleAttrs(e.$attrs),{onDragover:t[16]||(t[16]=(0,_.withModifiers)(()=>{},[`prevent`])),onDrop:t[17]||(t[17]=(0,_.withModifiers)((...e)=>a.onDrop&&a.onDrop(...e),[`prevent`])),onPaste:t[18]||(t[18]=(...e)=>a.onPaste&&a.onPaste(...e)),onMousedown:t[19]||(t[19]=(...e)=>a.onMousedown&&a.onMousedown(...e))}),[(0,_.renderSlot)(e.$slots,`top`),n.richText?((0,_.openBlock)(),(0,_.createBlock)(s,{key:0,"bold-button-options":n.boldButtonOptions,"italic-button-options":n.italicButtonOptions,"strike-button-options":n.strikeButtonOptions,"bullet-list-button-options":n.bulletListButtonOptions,"ordered-list-button-options":n.orderedListButtonOptions,"block-quote-button-options":n.blockQuoteButtonOptions,"code-button-options":n.codeButtonOptions,"code-block-button-options":n.codeBlockButtonOptions,"is-selection-active":a.isSelectionActive,onClick:a.handleTopbarClick},{link:(0,_.withCtx)(()=>[(0,_.createVNode)(o,{ref:`link`,open:i.linkDialogOpen,"link-button-options":n.linkButtonOptions,"is-selection-active":a.isSelectionActive,onOpened:a.linkDialogOpened,onSetLink:a.setLink,onRemoveLink:a.removeLink},null,8,[`open`,`link-button-options`,`is-selection-active`,`onOpened`,`onSetLink`,`onRemoveLink`])]),_:1},8,[`bold-button-options`,`italic-button-options`,`strike-button-options`,`bullet-list-button-options`,`ordered-list-button-options`,`block-quote-button-options`,`code-button-options`,`code-block-button-options`,`is-selection-active`,`onClick`])):(0,_.createCommentVNode)(``,!0),(0,_.withDirectives)(((0,_.openBlock)(),(0,_.createElementBlock)(`div`,{class:`d-recipe-message-input__editor-wrapper`,style:(0,_.normalizeStyle)({"max-height":n.maxHeight})},[(0,_.createVNode)(c,(0,_.mergeProps)({ref:`richTextEditor`,modelValue:i.internalInputValue,"onUpdate:modelValue":t[0]||(t[0]=e=>i.internalInputValue=e),"allow-blockquote":n.richText,"allow-bold":n.richText,"allow-bullet-list":n.richText,"allow-code":n.richText,"allow-codeblock":n.richText,"allow-italic":n.richText,"allow-strike":n.richText,"allow-underline":n.richText,"paste-rich-text":n.richText,editable:n.editable,"input-aria-label":n.inputAriaLabel,"input-class":n.inputClass,"output-format":n.outputFormat,"auto-focus":n.autoFocus,link:n.richText,placeholder:n.placeholder,"prevent-typing":n.preventTyping,"mention-suggestion":n.mentionSuggestion,"channel-suggestion":n.channelSuggestion,"slash-command-suggestion":n.slashCommandSuggestion,"additional-extensions":i.additionalExtensions,"hide-link-bubble-menu":i.hideLinkBubbleMenu},a.removeClassStyleAttrs(e.$attrs),{onInput:a.onInput,onTextInput:a.onTextInput,onMarkdownInput:a.onMarkdownInput,onEnter:a.onSend,onSelected:t[1]||(t[1]=e=>i.selectedText=e),onSelectedCommand:t[2]||(t[2]=t=>e.$emit(`selected-command`,t)),onEditLink:a.initLinkDialog,onFocus:t[3]||(t[3]=e=>i.isFocused=!0),onBlur:t[4]||(t[4]=e=>i.isFocused=!1)}),null,16,`modelValue.allow-blockquote.allow-bold.allow-bullet-list.allow-code.allow-codeblock.allow-italic.allow-strike.allow-underline.paste-rich-text.editable.input-aria-label.input-class.output-format.auto-focus.link.placeholder.prevent-typing.mention-suggestion.channel-suggestion.slash-command-suggestion.additional-extensions.hide-link-bubble-menu.onInput.onTextInput.onMarkdownInput.onEnter.onEditLink`.split(`.`))],4)),[[b]]),(0,_.renderSlot)(e.$slots,`middle`),(0,_.createElementVNode)(`section`,D,[(0,_.createElementVNode)(`div`,O,[(0,_.createVNode)(g,{gap:`200`,direction:`row`,class:`d-recipe-message-input__bottom-section-left-stack`},{default:(0,_.withCtx)(()=>[n.showImagePicker?(0,_.withDirectives)(((0,_.openBlock)(),(0,_.createBlock)(u,{key:0,"data-qa":`dt-recipe-message-input-image-btn`,size:`sm`,class:`d-recipe-message-input__button`,kind:`muted`,importance:`clear`,"aria-label":a.imagePickerButtonLabel,onClick:a.onSelectImage,onMouseenter:t[5]||(t[5]=e=>i.imagePickerFocus=!0),onMouseleave:t[6]||(t[6]=e=>i.imagePickerFocus=!1),onFocus:t[7]||(t[7]=e=>i.imagePickerFocus=!0),onBlur:t[8]||(t[8]=e=>i.imagePickerFocus=!1)},{icon:(0,_.withCtx)(()=>[(0,_.createVNode)(l,{size:`300`})]),_:1},8,[`aria-label`,`onClick`])),[[x,a.imagePickerButtonLabel,`top-start`]]):(0,_.createCommentVNode)(``,!0),(0,_.createVNode)(d,{ref:`messageInputImageUpload`,"data-qa":`dt-recipe-message-input-image-input`,accept:`image/*, video/*`,type:`file`,class:`d-recipe-message-input__image-input`,multiple:``,hidden:``,onInput:a.onImageUpload},null,8,[`onInput`]),n.showEmojiPicker?((0,_.openBlock)(),(0,_.createBlock)(h,{key:1,open:i.emojiPickerOpened,"onUpdate:open":t[15]||(t[15]=e=>i.emojiPickerOpened=e),"data-qa":`dt-recipe-message-input-emoji-picker-popover`,"initial-focus-element":`#searchInput`,padding:`none`},{anchor:(0,_.withCtx)(({attrs:e})=>[(0,_.withDirectives)(((0,_.openBlock)(),(0,_.createBlock)(u,(0,_.mergeProps)(e,{"data-qa":`dt-recipe-message-input-emoji-picker-btn`,size:`sm`,class:`d-recipe-message-input__button`,kind:`muted`,importance:`clear`,"aria-label":a.emojiPickerButtonLabel,onClick:a.toggleEmojiPicker,onMouseenter:t[9]||(t[9]=e=>i.emojiPickerFocus=!0),onMouseleave:t[10]||(t[10]=e=>i.emojiPickerFocus=!1),onFocus:t[11]||(t[11]=e=>i.emojiPickerFocus=!0),onBlur:t[12]||(t[12]=e=>i.emojiPickerFocus=!1)}),{icon:(0,_.withCtx)(()=>[a.emojiPickerHovered?((0,_.openBlock)(),(0,_.createBlock)(f,{key:0,size:`300`})):((0,_.openBlock)(),(0,_.createBlock)(p,{key:1,size:`300`}))]),_:1},16,[`aria-label`,`onClick`])),[[x,a.emojiPickerButtonLabel]])]),content:(0,_.withCtx)(({close:r})=>[(0,_.createVNode)(m,(0,_.mergeProps)(n.emojiPickerProps,{onAddEmoji:t[13]||(t[13]=t=>e.$emit(`add-emoji`)),onSkinTone:a.onSkinTone,onSelectedEmoji:e=>a.onSelectEmoji(e,r),onScrollBottomReached:t[14]||(t[14]=t=>e.$emit(`emoji-scroll-bottom-reached`))}),null,16,[`onSkinTone`,`onSelectedEmoji`])]),_:1},8,[`open`])):(0,_.createCommentVNode)(``,!0),(0,_.renderSlot)(e.$slots,`emojiGiphyPicker`),(0,_.renderSlot)(e.$slots,`customActionIcons`),(0,_.renderSlot)(e.$slots,`messagePolish`)]),_:3})]),(0,_.createElementVNode)(`div`,k,[(0,_.createVNode)(g,{direction:`row`,gap:`300`},{default:(0,_.withCtx)(()=>[(0,_.createElementVNode)(`div`,A,[(0,_.renderSlot)(e.$slots,`scheduleMessage`)]),(0,_.createElementVNode)(`div`,j,[(0,_.renderSlot)(e.$slots,`smsCount`)]),n.showCharacterLimit?((0,_.openBlock)(),(0,_.createBlock)(v,{key:0,class:`d-recipe-message-input__remaining-char-tooltip`,placement:`top-end`,enabled:a.characterLimitTooltipEnabled,message:n.showCharacterLimit.message,offset:[10,8]},{anchor:(0,_.withCtx)(()=>[(0,_.withDirectives)((0,_.createElementVNode)(`p`,{class:`d-recipe-message-input__remaining-char`,"data-qa":`dt-recipe-message-input-character-limit`},(0,_.toDisplayString)(n.showCharacterLimit.count-a.inputLength),513),[[_.vShow,a.displayCharacterLimitWarning]])]),_:1},8,[`enabled`,`message`])):(0,_.createCommentVNode)(``,!0),n.showCancel?(0,_.withDirectives)(((0,_.openBlock)(),(0,_.createBlock)(u,{key:1,"data-qa":`dt-recipe-message-input-cancel-button`,class:`d-recipe-message-input__button d-recipe-message-input__cancel-button`,size:`sm`,kind:`muted`,importance:`clear`,"aria-label":a.cancelButtonLabel,onClick:a.onCancel},{default:(0,_.withCtx)(()=>[(0,_.createElementVNode)(`p`,null,(0,_.toDisplayString)(a.cancelButtonLabel),1)]),_:1},8,[`aria-label`,`onClick`])),[[x,a.cancelButtonLabel]]):(0,_.createCommentVNode)(``,!0),(0,_.renderSlot)(e.$slots,`sendButton`,{},()=>[n.showSend?(0,_.withDirectives)(((0,_.openBlock)(),(0,_.createBlock)(u,{key:0,"data-qa":`dt-recipe-message-input-send-btn`,size:`sm`,kind:`default`,importance:`primary`,class:(0,_.normalizeClass)([`d-recipe-message-input__button d-recipe-message-input__send-button`,{"d-recipe-message-input__send-button--disabled":a.isSendDisabled,"d-btn--icon-only":a.showSendIcon}]),"aria-label":a.sendButtonLabel,"aria-disabled":a.isSendDisabled,onClick:a.onSend},(0,_.createSlots)({default:(0,_.withCtx)(()=>[n.showSend.text?((0,_.openBlock)(),(0,_.createElementBlock)(`p`,M,(0,_.toDisplayString)(n.showSend.text),1)):(0,_.createCommentVNode)(``,!0)]),_:2},[a.showSendIcon?{name:`icon`,fn:(0,_.withCtx)(()=>[(0,_.renderSlot)(e.$slots,`sendIcon`,{iconSize:a.sendIconSize},()=>[(0,_.createVNode)(y,{size:a.sendIconSize},null,8,[`size`])])]),key:`0`}:void 0]),1032,[`class`,`aria-label`,`aria-disabled`,`onClick`])),[[x,a.sendButtonLabel,`top-end`]]):(0,_.createCommentVNode)(``,!0)])]),_:3})])])],16)}var P=t.t(E,[[`render`,N]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return P}});
|
|
2
|
-
//# sourceMappingURL=message_input-
|
|
1
|
+
require(`./chunk-Bmb41Sf3.cjs`);const e=require(`./common/utils/index.cjs`),t=require(`./_plugin-vue_export-helper-D8jCH6HB.cjs`),n=require(`./localization/index.cjs`),r=require(`./lib/button/button.cjs`),i=require(`./lib/item-layout/item-layout.cjs`),a=require(`./lib/stack/stack.cjs`),o=require(`./lib/tooltip/tooltip.cjs`),s=require(`./lib/popover/popover.cjs`),c=require(`./lib/input/input.cjs`),l=require(`./emoji_picker-Cl-T4BXK.cjs`),u=require(`./node_modules/@tiptap/vue-3.cjs`),d=require(`./rich_text_editor-D5_gdzNn.cjs`),f=require(`./lib/rich-text-editor/rich-text-editor-constants.cjs`),p=require(`./lib/editor/editor-constants.cjs`),m=require(`./lib/message-input/last-active-nodes.cjs`),h=require(`./lib/message-input/message-input-topbar.cjs`),g=require(`./lib/message-input/message-input-link.cjs`);let _=require(`vue`),v=require(`@dialpad/dialtone-icons/vue3`),y=require(`@tiptap/core`);var b={name:`MeetingPill`,components:{NodeViewWrapper:u.NodeViewWrapper,DtItemLayout:i.default,DtIconClose:v.DtIconClose,DtButton:r.default,DtIconVideo:v.DtIconVideo},props:u.nodeViewProps,emits:[`meeting-pill-close`],data(){return{i18n:new n.DialtoneLocalization}},computed:{closeButtonTitle(){return this.i18n.$t(`DIALTONE_CLOSE_BUTTON`)}},methods:{close(e){let t=this.editor?.storage?.meetingPill?.onClose;t&&typeof t==`function`&&t(e)}}},x={class:`d-recipe-message-input-meeting-pill__icon`},S={class:`d-recipe-message-input-meeting-pill__close`};function C(e,t,n,r,i,a){let o=(0,_.resolveComponent)(`dt-icon-video`),s=(0,_.resolveComponent)(`dt-icon-close`),c=(0,_.resolveComponent)(`dt-button`),l=(0,_.resolveComponent)(`dt-item-layout`),u=(0,_.resolveComponent)(`node-view-wrapper`);return(0,_.openBlock)(),(0,_.createBlock)(u,{class:`d-recipe-message-input-meeting-pill`},{default:(0,_.withCtx)(()=>[(0,_.createVNode)(l,{class:`d-recipe-message-input-meeting-pill__layout`,unstyled:``},{left:(0,_.withCtx)(()=>[(0,_.createElementVNode)(`div`,x,[(0,_.createVNode)(o,{size:`400`})])]),right:(0,_.withCtx)(()=>[(0,_.createElementVNode)(`div`,S,[(0,_.createVNode)(c,{circle:``,importance:`clear`,size:`xs`,"aria-label":a.closeButtonTitle,title:a.closeButtonTitle,onClick:a.close},{icon:(0,_.withCtx)(()=>[(0,_.createVNode)(s,{size:`300`})]),_:1},8,[`aria-label`,`title`,`onClick`])])]),default:(0,_.withCtx)(()=>[(0,_.createTextVNode)(` `+(0,_.toDisplayString)(e.node.attrs.text)+` `,1)]),_:1})]),_:1})}var w=t.t(b,[[`render`,C]]),T=y.Node.create({name:`meetingPill`,atom:!0,group:`inline`,inline:!0,addOptions(){return{onClose:()=>{}}},addStorage(){return{onClose:this.options.onClose}},addNodeView(){return u.VueNodeViewRenderer(w)},addAttributes(){return{text:{default:`Please pass in "text" attribute`}}},parseHTML(){return[{tag:`meeting-pill`}]},renderText(){return`/dpm`},renderHTML({HTMLAttributes:e}){return[`meeting-pill`,(0,y.mergeAttributes)(e)]}}),E={compatConfig:{MODE:3},name:`DtRecipeMessageInput`,components:{DtButton:r.default,DtEmojiPicker:l.t,DtInput:c.default,DtPopover:s.default,DtRecipeMessageInputTopbar:h.default,DtRecipeMessageInputLink:g.default,DtRichTextEditor:d.t,DtTooltip:o.default,DtStack:a.default,DtIconImage:v.DtIconImage,DtIconVerySatisfied:v.DtIconVerySatisfied,DtIconSatisfied:v.DtIconSatisfied,DtIconSend:v.DtIconSend},inheritAttrs:!1,props:{richText:{type:Boolean,default:!0},modelValue:{type:[Object,String],default:``},editable:{type:Boolean,default:!0},inputAriaLabel:{type:String,required:!0,default:``},preventTyping:{type:Boolean,default:!1},inputClass:{type:String,default:``},autoFocus:{type:[Boolean,String,Number],default:!1,validator(e){return typeof e==`string`?f.RICH_TEXT_EDITOR_AUTOFOCUS_TYPES.includes(e):!0}},outputFormat:{type:String,default:`json`,validator(e){return f.RICH_TEXT_EDITOR_OUTPUT_FORMATS.includes(e)}},placeholder:{type:String,default:``},disableSend:{type:Boolean,default:!1},maxHeight:{type:String,default:`unset`},showEmojiPicker:{type:Boolean,default:!0},emojiPickerProps:{type:Object,default:()=>({})},showCharacterLimit:{type:[Boolean,Object],default:()=>({count:1500,warning:500,message:``})},showImagePicker:{type:[Boolean,Object],default:()=>({})},showSend:{type:[Boolean,Object],default:()=>({})},showCancel:{type:[Boolean,Object],default:()=>({})},mentionSuggestion:{type:Object,default:null},channelSuggestion:{type:Object,default:null},slashCommandSuggestion:{type:Object,default:null},boldButtonOptions:{type:Object,default:()=>({keyboardShortcutText:`Mod + B`})},italicButtonOptions:{type:Object,default:()=>({keyboardShortcutText:`Mod + I`})},strikeButtonOptions:{type:Object,default:()=>({keyboardShortcutText:`Mod + Shift + S`})},linkButtonOptions:{type:Object,default:()=>({keyboardShortcutText:`Mod + K`,linkPlaceholder:`e.g. https://www.dialpad.com`})},bulletListButtonOptions:{type:Object,default:()=>({keyboardShortcutText:`Mod + Shift + 8`})},orderedListButtonOptions:{type:Object,default:()=>({keyboardShortcutText:`Mod + Shift + 7`})},blockQuoteButtonOptions:{type:Object,default:()=>({keyboardShortcutText:`Mod + Shift + B`})},codeButtonOptions:{type:Object,default:()=>({keyboardShortcutText:`Mod + E`})},codeBlockButtonOptions:{type:Object,default:()=>({keyboardShortcutText:`Mod + Alt + C`})}},emits:[`submit`,`select-media`,`add-media`,`paste-media`,`cancel`,`skin-tone`,`selected-emoji`,`selected-command`,`meeting-pill-close`,`update:modelValue`,`text-input`,`markdown-input`,`add-emoji`,`emoji-scroll-bottom-reached`],data(){return{lastActiveNodes:m.default,additionalExtensions:[T.configure({onClose:e=>{this.$emit(`meeting-pill-close`,e)}})],internalInputValue:this.modelValue,imagePickerFocus:!1,emojiPickerFocus:!1,emojiPickerOpened:!1,isFocused:!1,linkOptions:{class:`d-link d-c-text d-d-inline-block`},linkDialogOpen:!1,selectedText:``,text:``,hideLinkBubbleMenu:!1,i18n:new n.DialtoneLocalization}},computed:{showSendIcon(){return!this.showSend.text},inputLength(){return this.text.length},displayCharacterLimitWarning(){return!!this.showCharacterLimit&&this.showCharacterLimit.count-this.inputLength<=this.showCharacterLimit.warning},characterLimitTooltipEnabled(){return this.showCharacterLimit.message&&this.showCharacterLimit.count-this.inputLength<0},isSelectionActive(){return this.selectedText,e=>[`bulletList`,`orderedList`].includes(e)?this.richText?this.lastActiveNodes(this.$refs.richTextEditor?.editor?.state,[{type:`bulletList`},{type:`orderedList`}]).includes(e)&&this.isFocused:!1:this.$refs.richTextEditor?.editor?.isActive(e)&&this.isFocused},isSendDisabled(){return this.disableSend||this.showCharacterLimit&&this.inputLength>this.showCharacterLimit.count},emojiPickerHovered(){return this.emojiPickerFocus||this.emojiPickerOpened},sendIconSize(){return`300`},sendButtonLabel(){return this.i18n.$t(`DIALTONE_MESSAGE_INPUT_SEND_BUTTON_ARIA_LABEL`)},imagePickerButtonLabel(){return this.i18n.$t(`DIALTONE_MESSAGE_INPUT_IMAGE_PICKER_BUTTON_ARIA_LABEL`)},emojiPickerButtonLabel(){return this.i18n.$t(`DIALTONE_MESSAGE_INPUT_EMOJI_PICKER_BUTTON_ARIA_LABEL`)},cancelButtonLabel(){return this.i18n.$t(`DIALTONE_MESSAGE_INPUT_CANCEL_BUTTON_ARIA_LABEL`)}},watch:{modelValue(e){this.internalInputValue=e},emojiPickerOpened(e){e||this.$refs.richTextEditor?.focusEditor()}},created(){this.modelValue&&this.outputFormat===`text`?this.internalInputValue=this.modelValue.replace(/\n/g,`<br>`):this.internalInputValue=this.modelValue},methods:{removeClassStyleAttrs:e.removeClassStyleAttrs,addClassStyleAttrs:e.addClassStyleAttrs,linkDialogOpened(e){this.linkDialogOpen=e,e===!0?this.initLinkDialog():(this.hideLinkBubbleMenu=!1,this.$refs.richTextEditor?.focusEditor())},handleTopbarClick(e){let t=this.$refs.richTextEditor?.editor,n={bold:()=>t?.chain().focus().toggleBold().run(),italic:()=>t?.chain().focus().toggleItalic().run(),strike:()=>t?.chain().focus().toggleStrike().run(),bulletList:()=>t?.chain().focus().toggleBulletList().run(),orderedList:()=>t?.chain().focus().toggleOrderedList().run(),blockquote:()=>t?.chain().focus().toggleBlockquote().run(),code:()=>t?.chain().focus().toggleCode().run(),codeBlock:()=>t?.chain().focus().toggleCodeBlock().run()};t&&n[e]&&n[e]()},initLinkDialog(){this.$refs.link.setInitialValues(this.selectedText,this.$refs.richTextEditor?.editor?.getAttributes(`link`)?.href),this.hideLinkBubbleMenu=!0,this.linkDialogOpen=!0},removeLink(){this.$refs.richTextEditor?.removeLink(),this.linkDialogOpen=!1},setLink(e,t){this.$refs.richTextEditor.setLink(t,e,this.linkOptions,p.EDITOR_SUPPORTED_LINK_PROTOCOLS,p.EDITOR_DEFAULT_LINK_PREFIX),this.linkDialogOpen=!1},onMousedown(t){e.returnFirstEl(this.$refs.richTextEditor.$el).querySelector(`.tiptap`).contains(t.target)||(t.preventDefault(),this.$refs.richTextEditor.focusEditor())},onDrop(e){let t=e.dataTransfer,n=Array.from(t.files);this.$emit(`add-media`,n)},onPaste(e){if(e.clipboardData.files.length){e.stopPropagation(),e.preventDefault();let t=[...e.clipboardData.files];this.$emit(`paste-media`,t)}},onSkinTone(e){this.$emit(`skin-tone`,e)},onSelectEmoji(e,t){e&&(e.shift_key||t(),this.$refs.richTextEditor.editor.commands.insertContent({type:`emoji`,attrs:{code:e.shortname,image:e.image,name:e.name}}),this.$emit(`selected-emoji`,e))},onSelectImage(){this.$refs.messageInputImageUpload.$refs.input.click()},onImageUpload(){this.$emit(`select-media`,this.$refs.messageInputImageUpload.$refs.input.files)},toggleEmojiPicker(){this.emojiPickerOpened=!this.emojiPickerOpened},onSend(){this.isSendDisabled||this.$emit(`submit`,this.internalInputValue)},onCancel(){this.$emit(`cancel`)},onInput(e){this.$emit(`update:modelValue`,e)},onTextInput(e){this.text=e,this.$emit(`text-input`,e)},onMarkdownInput(e){this.$emit(`markdown-input`,e)}}},D={class:`d-recipe-message-input__bottom-section`},O={class:`d-recipe-message-input__bottom-section-left`},k={class:`d-recipe-message-input__bottom-section-right`},A={class:`d-recipe-message-input__schedule-message`},j={class:`d-recipe-message-input__sms-count`},M={key:0};function N(e,t,n,r,i,a){let o=(0,_.resolveComponent)(`dt-recipe-message-input-link`),s=(0,_.resolveComponent)(`dt-recipe-message-input-topbar`),c=(0,_.resolveComponent)(`dt-rich-text-editor`),l=(0,_.resolveComponent)(`dt-icon-image`),u=(0,_.resolveComponent)(`dt-button`),d=(0,_.resolveComponent)(`dt-input`),f=(0,_.resolveComponent)(`dt-icon-very-satisfied`),p=(0,_.resolveComponent)(`dt-icon-satisfied`),m=(0,_.resolveComponent)(`dt-emoji-picker`),h=(0,_.resolveComponent)(`dt-popover`),g=(0,_.resolveComponent)(`dt-stack`),v=(0,_.resolveComponent)(`dt-tooltip`),y=(0,_.resolveComponent)(`dt-icon-send`),b=(0,_.resolveDirective)(`dt-scrollbar`),x=(0,_.resolveDirective)(`dt-tooltip`);return(0,_.openBlock)(),(0,_.createElementBlock)(`div`,(0,_.mergeProps)({"data-qa":`dt-recipe-message-input`,role:`presentation`,class:`d-recipe-message-input`},a.addClassStyleAttrs(e.$attrs),{onDragover:t[16]||(t[16]=(0,_.withModifiers)(()=>{},[`prevent`])),onDrop:t[17]||(t[17]=(0,_.withModifiers)((...e)=>a.onDrop&&a.onDrop(...e),[`prevent`])),onPaste:t[18]||(t[18]=(...e)=>a.onPaste&&a.onPaste(...e)),onMousedown:t[19]||(t[19]=(...e)=>a.onMousedown&&a.onMousedown(...e))}),[(0,_.renderSlot)(e.$slots,`top`),n.richText?((0,_.openBlock)(),(0,_.createBlock)(s,{key:0,"bold-button-options":n.boldButtonOptions,"italic-button-options":n.italicButtonOptions,"strike-button-options":n.strikeButtonOptions,"bullet-list-button-options":n.bulletListButtonOptions,"ordered-list-button-options":n.orderedListButtonOptions,"block-quote-button-options":n.blockQuoteButtonOptions,"code-button-options":n.codeButtonOptions,"code-block-button-options":n.codeBlockButtonOptions,"is-selection-active":a.isSelectionActive,onClick:a.handleTopbarClick},{link:(0,_.withCtx)(()=>[(0,_.createVNode)(o,{ref:`link`,open:i.linkDialogOpen,"link-button-options":n.linkButtonOptions,"is-selection-active":a.isSelectionActive,onOpened:a.linkDialogOpened,onSetLink:a.setLink,onRemoveLink:a.removeLink},null,8,[`open`,`link-button-options`,`is-selection-active`,`onOpened`,`onSetLink`,`onRemoveLink`])]),_:1},8,[`bold-button-options`,`italic-button-options`,`strike-button-options`,`bullet-list-button-options`,`ordered-list-button-options`,`block-quote-button-options`,`code-button-options`,`code-block-button-options`,`is-selection-active`,`onClick`])):(0,_.createCommentVNode)(``,!0),(0,_.withDirectives)(((0,_.openBlock)(),(0,_.createElementBlock)(`div`,{class:`d-recipe-message-input__editor-wrapper`,style:(0,_.normalizeStyle)({"max-height":n.maxHeight})},[(0,_.createVNode)(c,(0,_.mergeProps)({ref:`richTextEditor`,modelValue:i.internalInputValue,"onUpdate:modelValue":t[0]||(t[0]=e=>i.internalInputValue=e),"allow-blockquote":n.richText,"allow-bold":n.richText,"allow-bullet-list":n.richText,"allow-code":n.richText,"allow-codeblock":n.richText,"allow-italic":n.richText,"allow-strike":n.richText,"allow-underline":n.richText,"paste-rich-text":n.richText,editable:n.editable,"input-aria-label":n.inputAriaLabel,"input-class":n.inputClass,"output-format":n.outputFormat,"auto-focus":n.autoFocus,link:n.richText,placeholder:n.placeholder,"prevent-typing":n.preventTyping,"mention-suggestion":n.mentionSuggestion,"channel-suggestion":n.channelSuggestion,"slash-command-suggestion":n.slashCommandSuggestion,"additional-extensions":i.additionalExtensions,"hide-link-bubble-menu":i.hideLinkBubbleMenu},a.removeClassStyleAttrs(e.$attrs),{onInput:a.onInput,onTextInput:a.onTextInput,onMarkdownInput:a.onMarkdownInput,onEnter:a.onSend,onSelected:t[1]||(t[1]=e=>i.selectedText=e),onSelectedCommand:t[2]||(t[2]=t=>e.$emit(`selected-command`,t)),onEditLink:a.initLinkDialog,onFocus:t[3]||(t[3]=e=>i.isFocused=!0),onBlur:t[4]||(t[4]=e=>i.isFocused=!1)}),null,16,`modelValue.allow-blockquote.allow-bold.allow-bullet-list.allow-code.allow-codeblock.allow-italic.allow-strike.allow-underline.paste-rich-text.editable.input-aria-label.input-class.output-format.auto-focus.link.placeholder.prevent-typing.mention-suggestion.channel-suggestion.slash-command-suggestion.additional-extensions.hide-link-bubble-menu.onInput.onTextInput.onMarkdownInput.onEnter.onEditLink`.split(`.`))],4)),[[b]]),(0,_.renderSlot)(e.$slots,`middle`),(0,_.createElementVNode)(`section`,D,[(0,_.createElementVNode)(`div`,O,[(0,_.createVNode)(g,{gap:`200`,direction:`row`,class:`d-recipe-message-input__bottom-section-left-stack`},{default:(0,_.withCtx)(()=>[n.showImagePicker?(0,_.withDirectives)(((0,_.openBlock)(),(0,_.createBlock)(u,{key:0,"data-qa":`dt-recipe-message-input-image-btn`,size:`sm`,class:`d-recipe-message-input__button`,kind:`muted`,importance:`clear`,"aria-label":a.imagePickerButtonLabel,onClick:a.onSelectImage,onMouseenter:t[5]||(t[5]=e=>i.imagePickerFocus=!0),onMouseleave:t[6]||(t[6]=e=>i.imagePickerFocus=!1),onFocus:t[7]||(t[7]=e=>i.imagePickerFocus=!0),onBlur:t[8]||(t[8]=e=>i.imagePickerFocus=!1)},{icon:(0,_.withCtx)(()=>[(0,_.createVNode)(l,{size:`300`})]),_:1},8,[`aria-label`,`onClick`])),[[x,a.imagePickerButtonLabel,`top-start`]]):(0,_.createCommentVNode)(``,!0),(0,_.createVNode)(d,{ref:`messageInputImageUpload`,"data-qa":`dt-recipe-message-input-image-input`,accept:`image/*, video/*`,type:`file`,class:`d-recipe-message-input__image-input`,multiple:``,hidden:``,onInput:a.onImageUpload},null,8,[`onInput`]),n.showEmojiPicker?((0,_.openBlock)(),(0,_.createBlock)(h,{key:1,open:i.emojiPickerOpened,"onUpdate:open":t[15]||(t[15]=e=>i.emojiPickerOpened=e),"data-qa":`dt-recipe-message-input-emoji-picker-popover`,"initial-focus-element":`#searchInput`,padding:`none`},{anchor:(0,_.withCtx)(({attrs:e})=>[(0,_.withDirectives)(((0,_.openBlock)(),(0,_.createBlock)(u,(0,_.mergeProps)(e,{"data-qa":`dt-recipe-message-input-emoji-picker-btn`,size:`sm`,class:`d-recipe-message-input__button`,kind:`muted`,importance:`clear`,"aria-label":a.emojiPickerButtonLabel,onClick:a.toggleEmojiPicker,onMouseenter:t[9]||(t[9]=e=>i.emojiPickerFocus=!0),onMouseleave:t[10]||(t[10]=e=>i.emojiPickerFocus=!1),onFocus:t[11]||(t[11]=e=>i.emojiPickerFocus=!0),onBlur:t[12]||(t[12]=e=>i.emojiPickerFocus=!1)}),{icon:(0,_.withCtx)(()=>[a.emojiPickerHovered?((0,_.openBlock)(),(0,_.createBlock)(f,{key:0,size:`300`})):((0,_.openBlock)(),(0,_.createBlock)(p,{key:1,size:`300`}))]),_:1},16,[`aria-label`,`onClick`])),[[x,a.emojiPickerButtonLabel]])]),content:(0,_.withCtx)(({close:r})=>[(0,_.createVNode)(m,(0,_.mergeProps)(n.emojiPickerProps,{onAddEmoji:t[13]||(t[13]=t=>e.$emit(`add-emoji`)),onSkinTone:a.onSkinTone,onSelectedEmoji:e=>a.onSelectEmoji(e,r),onScrollBottomReached:t[14]||(t[14]=t=>e.$emit(`emoji-scroll-bottom-reached`))}),null,16,[`onSkinTone`,`onSelectedEmoji`])]),_:1},8,[`open`])):(0,_.createCommentVNode)(``,!0),(0,_.renderSlot)(e.$slots,`emojiGiphyPicker`),(0,_.renderSlot)(e.$slots,`customActionIcons`),(0,_.renderSlot)(e.$slots,`messagePolish`)]),_:3})]),(0,_.createElementVNode)(`div`,k,[(0,_.createVNode)(g,{direction:`row`,gap:`300`},{default:(0,_.withCtx)(()=>[(0,_.createElementVNode)(`div`,A,[(0,_.renderSlot)(e.$slots,`scheduleMessage`)]),(0,_.createElementVNode)(`div`,j,[(0,_.renderSlot)(e.$slots,`smsCount`)]),n.showCharacterLimit?((0,_.openBlock)(),(0,_.createBlock)(v,{key:0,class:`d-recipe-message-input__remaining-char-tooltip`,placement:`top-end`,enabled:a.characterLimitTooltipEnabled,message:n.showCharacterLimit.message,offset:[10,8]},{anchor:(0,_.withCtx)(()=>[(0,_.withDirectives)((0,_.createElementVNode)(`p`,{class:`d-recipe-message-input__remaining-char`,"data-qa":`dt-recipe-message-input-character-limit`},(0,_.toDisplayString)(n.showCharacterLimit.count-a.inputLength),513),[[_.vShow,a.displayCharacterLimitWarning]])]),_:1},8,[`enabled`,`message`])):(0,_.createCommentVNode)(``,!0),n.showCancel?(0,_.withDirectives)(((0,_.openBlock)(),(0,_.createBlock)(u,{key:1,"data-qa":`dt-recipe-message-input-cancel-button`,class:`d-recipe-message-input__button d-recipe-message-input__cancel-button`,size:`sm`,kind:`muted`,importance:`clear`,"aria-label":a.cancelButtonLabel,onClick:a.onCancel},{default:(0,_.withCtx)(()=>[(0,_.createElementVNode)(`p`,null,(0,_.toDisplayString)(a.cancelButtonLabel),1)]),_:1},8,[`aria-label`,`onClick`])),[[x,a.cancelButtonLabel]]):(0,_.createCommentVNode)(``,!0),(0,_.renderSlot)(e.$slots,`sendButton`,{},()=>[n.showSend?(0,_.withDirectives)(((0,_.openBlock)(),(0,_.createBlock)(u,{key:0,"data-qa":`dt-recipe-message-input-send-btn`,size:`sm`,kind:`default`,importance:`primary`,class:(0,_.normalizeClass)([`d-recipe-message-input__button d-recipe-message-input__send-button`,{"d-recipe-message-input__send-button--disabled":a.isSendDisabled,"d-btn--icon-only":a.showSendIcon}]),"aria-label":a.sendButtonLabel,"aria-disabled":a.isSendDisabled,onClick:a.onSend},(0,_.createSlots)({default:(0,_.withCtx)(()=>[n.showSend.text?((0,_.openBlock)(),(0,_.createElementBlock)(`p`,M,(0,_.toDisplayString)(n.showSend.text),1)):(0,_.createCommentVNode)(``,!0)]),_:2},[a.showSendIcon?{name:`icon`,fn:(0,_.withCtx)(()=>[(0,_.renderSlot)(e.$slots,`sendIcon`,{iconSize:a.sendIconSize},()=>[(0,_.createVNode)(y,{size:a.sendIconSize},null,8,[`size`])])]),key:`0`}:void 0]),1032,[`class`,`aria-label`,`aria-disabled`,`onClick`])),[[x,a.sendButtonLabel,`top-end`]]):(0,_.createCommentVNode)(``,!0)])]),_:3})])])],16)}var P=t.t(E,[[`render`,N]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return P}});
|
|
2
|
+
//# sourceMappingURL=message_input-Bs-fg95i.cjs.map
|