@alfadocs/ui-kit-debug 1.41.0 → 1.42.0
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/_chunks/{calendar-workspace-UllCER2k.js → calendar-workspace-qlxrxCqm.js} +1980 -1967
- package/dist/_chunks/calendar-workspace-qlxrxCqm.js.map +1 -0
- package/dist/_chunks/{help-me-write-templates-GB70jnV9.js → help-me-write-templates-B-m7zgJa.js} +242 -231
- package/dist/_chunks/help-me-write-templates-B-m7zgJa.js.map +1 -0
- package/dist/_chunks/{notes-panel-_diLt8Cj.js → notes-panel-CRAovkjx.js} +84 -68
- package/dist/_chunks/notes-panel-CRAovkjx.js.map +1 -0
- package/dist/_chunks/{rich-text-editor-D7AKKAQ2.js → rich-text-editor-DUMeifwc.js} +1195 -1138
- package/dist/_chunks/rich-text-editor-DUMeifwc.js.map +1 -0
- package/dist/agent-catalog.json +1 -1
- package/dist/components/notes-panel/index.js +1 -1
- package/dist/components/notes-panel/notes-panel.d.ts +32 -0
- package/dist/components/notes-panel/notes-panel.d.ts.map +1 -1
- package/dist/components/rich-text-editor/index.js +1 -1
- package/dist/components/rich-text-editor/rich-text-editor.d.ts.map +1 -1
- package/dist/i18n/locales/ar.d.ts +1 -0
- package/dist/i18n/locales/ar.d.ts.map +1 -1
- package/dist/i18n/locales/ar.js +2 -1
- package/dist/i18n/locales/ar.js.map +1 -1
- package/dist/i18n/locales/de.d.ts +1 -0
- package/dist/i18n/locales/de.d.ts.map +1 -1
- package/dist/i18n/locales/de.js +2 -1
- package/dist/i18n/locales/de.js.map +1 -1
- package/dist/i18n/locales/el.d.ts +1 -0
- package/dist/i18n/locales/el.d.ts.map +1 -1
- package/dist/i18n/locales/el.js +2 -1
- package/dist/i18n/locales/el.js.map +1 -1
- package/dist/i18n/locales/en.d.ts +1 -0
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/en.js +2 -1
- package/dist/i18n/locales/en.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +1 -0
- package/dist/i18n/locales/es.d.ts.map +1 -1
- package/dist/i18n/locales/es.js +2 -1
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +1 -0
- package/dist/i18n/locales/fr.d.ts.map +1 -1
- package/dist/i18n/locales/fr.js +2 -1
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hi.d.ts +1 -0
- package/dist/i18n/locales/hi.d.ts.map +1 -1
- package/dist/i18n/locales/hi.js +2 -1
- package/dist/i18n/locales/hi.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +1 -0
- package/dist/i18n/locales/it.d.ts.map +1 -1
- package/dist/i18n/locales/it.js +2 -1
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/ja.d.ts +1 -0
- package/dist/i18n/locales/ja.d.ts.map +1 -1
- package/dist/i18n/locales/ja.js +2 -1
- package/dist/i18n/locales/ja.js.map +1 -1
- package/dist/i18n/locales/nl.d.ts +1 -0
- package/dist/i18n/locales/nl.d.ts.map +1 -1
- package/dist/i18n/locales/nl.js +2 -1
- package/dist/i18n/locales/nl.js.map +1 -1
- package/dist/i18n/locales/pl.d.ts +1 -0
- package/dist/i18n/locales/pl.d.ts.map +1 -1
- package/dist/i18n/locales/pl.js +2 -1
- package/dist/i18n/locales/pl.js.map +1 -1
- package/dist/i18n/locales/pt.d.ts +1 -0
- package/dist/i18n/locales/pt.d.ts.map +1 -1
- package/dist/i18n/locales/pt.js +2 -1
- package/dist/i18n/locales/pt.js.map +1 -1
- package/dist/i18n/locales/ro.d.ts +1 -0
- package/dist/i18n/locales/ro.d.ts.map +1 -1
- package/dist/i18n/locales/ro.js +2 -1
- package/dist/i18n/locales/ro.js.map +1 -1
- package/dist/i18n/locales/ru.d.ts +1 -0
- package/dist/i18n/locales/ru.d.ts.map +1 -1
- package/dist/i18n/locales/ru.js +2 -1
- package/dist/i18n/locales/ru.js.map +1 -1
- package/dist/i18n/locales/sq.d.ts +1 -0
- package/dist/i18n/locales/sq.d.ts.map +1 -1
- package/dist/i18n/locales/sq.js +2 -1
- package/dist/i18n/locales/sq.js.map +1 -1
- package/dist/i18n/locales/sv.d.ts +1 -0
- package/dist/i18n/locales/sv.d.ts.map +1 -1
- package/dist/i18n/locales/sv.js +2 -1
- package/dist/i18n/locales/sv.js.map +1 -1
- package/dist/i18n/locales/tr.d.ts +1 -0
- package/dist/i18n/locales/tr.d.ts.map +1 -1
- package/dist/i18n/locales/tr.js +2 -1
- package/dist/i18n/locales/tr.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +1 -0
- package/dist/i18n/locales/zh.d.ts.map +1 -1
- package/dist/i18n/locales/zh.js +2 -1
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/index.js +4 -4
- package/dist/locales/ar.json +2 -1
- package/dist/locales/de.json +2 -1
- package/dist/locales/el.json +2 -1
- package/dist/locales/en.json +2 -1
- package/dist/locales/es.json +2 -1
- package/dist/locales/fr.json +2 -1
- package/dist/locales/hi.json +2 -1
- package/dist/locales/it.json +2 -1
- package/dist/locales/ja.json +2 -1
- package/dist/locales/nl.json +2 -1
- package/dist/locales/pl.json +2 -1
- package/dist/locales/pt.json +2 -1
- package/dist/locales/ro.json +2 -1
- package/dist/locales/ru.json +2 -1
- package/dist/locales/sq.json +2 -1
- package/dist/locales/sv.json +2 -1
- package/dist/locales/tr.json +2 -1
- package/dist/locales/zh.json +2 -1
- package/dist/patterns/calendar/calendar.journey.d.ts +11 -0
- package/dist/patterns/calendar/calendar.journey.d.ts.map +1 -1
- package/dist/patterns/calendar/calendar.sheets.d.ts +20 -0
- package/dist/patterns/calendar/calendar.sheets.d.ts.map +1 -1
- package/dist/patterns/calendar/index.js +1 -1
- package/dist/patterns/help-me-write-templates/help-me-write-templates.d.ts.map +1 -1
- package/dist/patterns/help-me-write-templates/index.js +1 -1
- package/package.json +1 -1
- package/dist/_chunks/calendar-workspace-UllCER2k.js.map +0 -1
- package/dist/_chunks/help-me-write-templates-GB70jnV9.js.map +0 -1
- package/dist/_chunks/notes-panel-_diLt8Cj.js.map +0 -1
- package/dist/_chunks/rich-text-editor-D7AKKAQ2.js.map +0 -1
package/dist/_chunks/{help-me-write-templates-GB70jnV9.js → help-me-write-templates-B-m7zgJa.js}
RENAMED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { jsxs as i, jsx as e, Fragment as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useTranslation as
|
|
4
|
-
import { A as
|
|
5
|
-
import { B as
|
|
6
|
-
import { B as
|
|
7
|
-
import { I as
|
|
8
|
-
import { D as
|
|
9
|
-
import { D as
|
|
1
|
+
import { jsxs as i, jsx as e, Fragment as E } from "react/jsx-runtime";
|
|
2
|
+
import { useState as h, useEffect as U, useId as ie, useRef as te, useCallback as O, useMemo as Ne } from "react";
|
|
3
|
+
import { useTranslation as V } from "react-i18next";
|
|
4
|
+
import { A as R } from "./alert-CiQ5Pa3Q.js";
|
|
5
|
+
import { B as fe } from "./badge-BudgzTe_.js";
|
|
6
|
+
import { B as g } from "./button-CaUe1uyd.js";
|
|
7
|
+
import { I as H } from "./icon-button-CehAeZoP.js";
|
|
8
|
+
import { D as f } from "./dialog-BJiLqhx6.js";
|
|
9
|
+
import { D as z } from "./dropdown-menu-DU-Hrf33.js";
|
|
10
10
|
import { E as we } from "./editor-overlay-DwNKaI22.js";
|
|
11
11
|
import { E as ke } from "./empty-state-BUN_UAWf.js";
|
|
12
|
-
import { F as
|
|
13
|
-
import { P as
|
|
14
|
-
import { S as
|
|
15
|
-
import { S as
|
|
16
|
-
import { T as
|
|
17
|
-
import { T as
|
|
12
|
+
import { F as Q } from "./form-field-CahJzTxp.js";
|
|
13
|
+
import { P as De } from "./progress-CK8otcQ-.js";
|
|
14
|
+
import { S as le } from "./spinner-hbwuKwMf.js";
|
|
15
|
+
import { S as Ie } from "./switch-OILsBLWo.js";
|
|
16
|
+
import { T as ge } from "./text-area-Bt3p7Pt0.js";
|
|
17
|
+
import { T as oe } from "./text-input-CUvCb6ST.js";
|
|
18
18
|
import { SafeHtml as Se } from "../safe-html/index.js";
|
|
19
19
|
import { T as ze } from "./trending-up-C_luYBzS.js";
|
|
20
|
-
import { A as
|
|
21
|
-
import { A as
|
|
20
|
+
import { A as Ee } from "./astroid-BN4f5VXU.js";
|
|
21
|
+
import { A as Re } from "./arrow-left-BfaGqVam.js";
|
|
22
22
|
import { P as $e } from "./pencil-B1sKKyuT.js";
|
|
23
23
|
import { T as Ae } from "./trash-2-uumy3fy1.js";
|
|
24
|
-
import { P as
|
|
25
|
-
import { X as
|
|
24
|
+
import { P as be } from "./plus-DzMQ_c6b.js";
|
|
25
|
+
import { X as de } from "./x-B5YnXwCz.js";
|
|
26
26
|
import { R as Be } from "./rotate-ccw-BBQnIVTr.js";
|
|
27
27
|
import { S as Oe } from "./square-DASBRZ0U.js";
|
|
28
|
-
import { M as
|
|
29
|
-
import { C as
|
|
30
|
-
import { W as
|
|
28
|
+
import { M as Fe } from "./mic-CUklMZGF.js";
|
|
29
|
+
import { C as Le } from "./chevron-down-DWE7GSq9.js";
|
|
30
|
+
import { W as ce } from "./wand-sparkles-DAjKyhz7.js";
|
|
31
31
|
import { S as _e } from "./settings-d25ju_6L.js";
|
|
32
32
|
import { S as He } from "./send-C5kDJ-Mz.js";
|
|
33
|
-
class
|
|
33
|
+
class me extends Error {
|
|
34
34
|
constructor(c = "AI credits exhausted") {
|
|
35
35
|
super(c), this.name = "AiCreditsExhaustedError";
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
const
|
|
38
|
+
const q = "ds:!size-[var(--min-target-size)]", Pe = "ds:!h-[var(--min-target-size)] ds:shrink-0", je = `${q} ds:bg-[image:var(--gradient-brand)] ds:rounded-full`, qe = "ds:aria-pressed:!bg-[var(--destructive)] ds:aria-pressed:!text-[var(--destructive-foreground)]", G = "ds:m-0 ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", pe = "type-eyebrow ds:m-0 ds:text-[color:var(--muted-foreground)]", ee = [
|
|
39
39
|
"ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
|
|
40
40
|
"ds:bg-[color-mix(in_srgb,var(--background)_70%,transparent)]",
|
|
41
41
|
"ds:p-[var(--spacing-sm)] ds:[max-block-size:14rem] ds:overflow-y-auto",
|
|
@@ -44,13 +44,13 @@ const j = "ds:!size-[var(--min-target-size)]", Pe = "ds:!h-[var(--min-target-siz
|
|
|
44
44
|
"ds:[&_h3]:font-medium ds:[&_h3]:[margin-block-start:var(--spacing-xs)]",
|
|
45
45
|
"ds:[&_p]:[margin-block-end:var(--spacing-xs)]",
|
|
46
46
|
"ds:[&>:first-child]:[margin-block-start:0]"
|
|
47
|
-
].join(" "),
|
|
48
|
-
function
|
|
47
|
+
].join(" "), ue = "ds:[block-size:14rem]";
|
|
48
|
+
function ve(r) {
|
|
49
49
|
return [...r].sort(
|
|
50
50
|
(c, o) => Number(o.isDefault) - Number(c.isDefault)
|
|
51
51
|
);
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function he(r, c) {
|
|
54
54
|
return c ? r ? /\s$/.test(r) ? `${r}${c}` : `${r} ${c}` : c : r;
|
|
55
55
|
}
|
|
56
56
|
function Ue(r) {
|
|
@@ -60,7 +60,7 @@ function Ge({
|
|
|
60
60
|
credits: r,
|
|
61
61
|
onBack: c
|
|
62
62
|
}) {
|
|
63
|
-
const { t: o, i18n: p } =
|
|
63
|
+
const { t: o, i18n: p } = V(), u = r == null ? void 0 : r.limit, b = (r == null ? void 0 : r.remaining) ?? 0, t = u !== void 0 ? o("helpMeWriteTemplates.credits.remaining", { remaining: b, limit: u }) : void 0, n = r != null && r.resetsOn ? new Intl.DateTimeFormat(p.language, {
|
|
64
64
|
day: "numeric",
|
|
65
65
|
month: "long"
|
|
66
66
|
}).format(r.resetsOn) : void 0;
|
|
@@ -70,9 +70,9 @@ function Ge({
|
|
|
70
70
|
className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
|
|
71
71
|
"data-component": "ai-credits-exhausted-notice",
|
|
72
72
|
children: [
|
|
73
|
-
/* @__PURE__ */ i(
|
|
74
|
-
/* @__PURE__ */ e(
|
|
75
|
-
/* @__PURE__ */ e(
|
|
73
|
+
/* @__PURE__ */ i(R, { variant: "promo", icon: /* @__PURE__ */ e(Ee, { "aria-hidden": "true" }), children: [
|
|
74
|
+
/* @__PURE__ */ e(R.Title, { as: "h2", children: o("helpMeWriteTemplates.credits.title") }),
|
|
75
|
+
/* @__PURE__ */ e(R.Description, { children: r != null && r.onBuyCredits ? n ? o("helpMeWriteTemplates.credits.bodyResets", { date: n }) : o("helpMeWriteTemplates.credits.body") : n ? o("helpMeWriteTemplates.credits.bodyWaitResets", {
|
|
76
76
|
date: n
|
|
77
77
|
}) : o("helpMeWriteTemplates.credits.bodyWait") }),
|
|
78
78
|
u !== void 0 && t ? /* @__PURE__ */ i("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)] ds:[margin-block-start:var(--spacing-sm)]", children: [
|
|
@@ -81,9 +81,9 @@ function Ge({
|
|
|
81
81
|
/* @__PURE__ */ e("span", { className: "type-label ds:ms-auto ds:tabular-nums", children: t })
|
|
82
82
|
] }),
|
|
83
83
|
/* @__PURE__ */ e(
|
|
84
|
-
|
|
84
|
+
De,
|
|
85
85
|
{
|
|
86
|
-
value: Math.max(0, u -
|
|
86
|
+
value: Math.max(0, u - b),
|
|
87
87
|
max: u,
|
|
88
88
|
size: "sm",
|
|
89
89
|
ariaLabel: o("helpMeWriteTemplates.credits.meterLabel"),
|
|
@@ -91,9 +91,9 @@ function Ge({
|
|
|
91
91
|
}
|
|
92
92
|
)
|
|
93
93
|
] }) : null,
|
|
94
|
-
r != null && r.onBuyCredits || r != null && r.onSeeCosts ? /* @__PURE__ */ i(
|
|
94
|
+
r != null && r.onBuyCredits || r != null && r.onSeeCosts ? /* @__PURE__ */ i(R.Action, { children: [
|
|
95
95
|
r.onBuyCredits ? /* @__PURE__ */ e(
|
|
96
|
-
|
|
96
|
+
g,
|
|
97
97
|
{
|
|
98
98
|
intent: "tonal",
|
|
99
99
|
size: "sm",
|
|
@@ -102,12 +102,12 @@ function Ge({
|
|
|
102
102
|
children: o("helpMeWriteTemplates.credits.cta")
|
|
103
103
|
}
|
|
104
104
|
) : null,
|
|
105
|
-
r.onSeeCosts ? /* @__PURE__ */ e(
|
|
105
|
+
r.onSeeCosts ? /* @__PURE__ */ e(g, { intent: "link", size: "sm", onClick: r.onSeeCosts, children: o("helpMeWriteTemplates.credits.secondary") }) : null
|
|
106
106
|
] }) : null
|
|
107
107
|
] }),
|
|
108
108
|
/* @__PURE__ */ i("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]", children: [
|
|
109
|
-
c ? /* @__PURE__ */ e(
|
|
110
|
-
/* @__PURE__ */ e("p", { className:
|
|
109
|
+
c ? /* @__PURE__ */ e(g, { intent: "ghost", startIcon: /* @__PURE__ */ e(Re, {}), onClick: c, children: o("helpMeWriteTemplates.credits.back") }) : null,
|
|
110
|
+
/* @__PURE__ */ e("p", { className: G, children: o("helpMeWriteTemplates.credits.kept") })
|
|
111
111
|
] })
|
|
112
112
|
]
|
|
113
113
|
}
|
|
@@ -119,104 +119,104 @@ function Ve({
|
|
|
119
119
|
onGenerate: o,
|
|
120
120
|
onManageTemplates: p,
|
|
121
121
|
onApplied: u,
|
|
122
|
-
credits:
|
|
122
|
+
credits: b,
|
|
123
123
|
enableDictation: t = !0,
|
|
124
124
|
suspendClose: n = !1
|
|
125
125
|
}) {
|
|
126
|
-
const { t: a } =
|
|
126
|
+
const { t: a } = V(), { open: N } = r, M = ie(), S = ie(), [C, x] = h(""), [I, v] = h(null), [y, F] = h(!1), [L, $] = h(!1), [w, _] = h(null), [k, X] = h({
|
|
127
127
|
kind: "document",
|
|
128
128
|
words: 0,
|
|
129
129
|
text: ""
|
|
130
|
-
}),
|
|
130
|
+
}), A = te(null), s = I !== null, D = t ? r.onDictate : void 0, [T, se] = h(!1), [Te, Y] = h(""), [Me, Z] = h(""), B = te(null), P = O(() => {
|
|
131
131
|
var l;
|
|
132
|
-
return (l =
|
|
133
|
-
}, []), We =
|
|
134
|
-
if (
|
|
135
|
-
|
|
132
|
+
return (l = B.current) == null ? void 0 : l.abort();
|
|
133
|
+
}, []), We = O(() => {
|
|
134
|
+
if (T) {
|
|
135
|
+
P();
|
|
136
136
|
return;
|
|
137
137
|
}
|
|
138
|
-
if (!
|
|
138
|
+
if (!D) return;
|
|
139
139
|
const l = new AbortController();
|
|
140
|
-
|
|
140
|
+
B.current = l, se(!0), Z(a("helpMeWriteTemplates.bar.listening")), D({
|
|
141
141
|
signal: l.signal,
|
|
142
142
|
onPartialTranscript: (d) => {
|
|
143
|
-
l.signal.aborted ||
|
|
143
|
+
l.signal.aborted || Y(d);
|
|
144
144
|
},
|
|
145
145
|
onFinalTranscript: (d) => {
|
|
146
146
|
if (l.signal.aborted) return;
|
|
147
|
-
|
|
147
|
+
Y("");
|
|
148
148
|
const W = d.trim();
|
|
149
|
-
W && (x((m) =>
|
|
149
|
+
W && (x((m) => he(m, W)), Z(W));
|
|
150
150
|
}
|
|
151
151
|
}).catch((d) => {
|
|
152
|
-
d instanceof
|
|
152
|
+
d instanceof me && $(!0);
|
|
153
153
|
}).finally(() => {
|
|
154
|
-
|
|
154
|
+
Y(""), B.current === l && (B.current = null, se(!1), Z(""));
|
|
155
155
|
});
|
|
156
|
-
}, [
|
|
157
|
-
|
|
156
|
+
}, [T, D, P, a]);
|
|
157
|
+
U(() => {
|
|
158
158
|
var l, d;
|
|
159
159
|
if (N) {
|
|
160
|
-
x(""),
|
|
160
|
+
x(""), v(null), F(!1), $(r.creditsExhausted), _(null);
|
|
161
161
|
const W = r.selectionText.trim(), m = W || r.getText();
|
|
162
|
-
|
|
162
|
+
X({
|
|
163
163
|
kind: W ? "selection" : "document",
|
|
164
164
|
words: m.split(/\s+/).filter(Boolean).length,
|
|
165
165
|
text: m
|
|
166
166
|
});
|
|
167
167
|
} else
|
|
168
|
-
(l =
|
|
169
|
-
}, [N]),
|
|
168
|
+
(l = A.current) == null || l.abort(), (d = B.current) == null || d.abort();
|
|
169
|
+
}, [N]), U(
|
|
170
170
|
() => () => {
|
|
171
171
|
var l, d;
|
|
172
|
-
(l =
|
|
172
|
+
(l = A.current) == null || l.abort(), (d = B.current) == null || d.abort();
|
|
173
173
|
},
|
|
174
174
|
[]
|
|
175
175
|
);
|
|
176
|
-
const
|
|
176
|
+
const J = O(
|
|
177
177
|
(l) => {
|
|
178
178
|
var W;
|
|
179
|
-
if (
|
|
180
|
-
|
|
179
|
+
if (s || (l ? k.words === 0 : !C.trim())) return;
|
|
180
|
+
P(), (W = A.current) == null || W.abort();
|
|
181
181
|
const d = new AbortController();
|
|
182
|
-
|
|
182
|
+
A.current = d, F(!1), v(l), o({
|
|
183
183
|
template: l,
|
|
184
184
|
prompt: C.trim(),
|
|
185
|
-
sourceText: l ?
|
|
185
|
+
sourceText: l ? k.text : "",
|
|
186
186
|
signal: d.signal
|
|
187
187
|
}).then((m) => {
|
|
188
|
-
d.signal.aborted || (
|
|
188
|
+
d.signal.aborted || (_({ draft: m, template: l }), v(null));
|
|
189
189
|
}).catch((m) => {
|
|
190
|
-
d.signal.aborted || Ue(m) || (m instanceof
|
|
190
|
+
d.signal.aborted || Ue(m) || (m instanceof me ? $(!0) : F(!0), v(null));
|
|
191
191
|
});
|
|
192
192
|
},
|
|
193
|
-
[
|
|
194
|
-
), { onClose:
|
|
195
|
-
n ||
|
|
196
|
-
}, [n,
|
|
197
|
-
if (!
|
|
198
|
-
const { draft: d, template: W } =
|
|
199
|
-
l === "insert" ? r.insertAtSelection(d) : l === "replace" ?
|
|
200
|
-
const { setContent:
|
|
193
|
+
[s, k, C, o, P]
|
|
194
|
+
), { onClose: ae } = r, Ce = O(() => {
|
|
195
|
+
n || ae();
|
|
196
|
+
}, [n, ae]), K = (l) => {
|
|
197
|
+
if (!w) return;
|
|
198
|
+
const { draft: d, template: W } = w, m = r.getHTML(), ne = k.kind === "selection";
|
|
199
|
+
l === "insert" ? r.insertAtSelection(d) : l === "replace" ? ne ? r.insertAtSelection(d) : r.setContent(d) : ne ? r.insertAfterSelection(d) : r.setContent(`${m}${d}`), r.onClose();
|
|
200
|
+
const { setContent: ye } = r;
|
|
201
201
|
u == null || u({
|
|
202
202
|
mode: l,
|
|
203
203
|
template: W,
|
|
204
204
|
previousHtml: m,
|
|
205
|
-
undo: () =>
|
|
205
|
+
undo: () => ye(m)
|
|
206
206
|
});
|
|
207
|
-
}, xe =
|
|
208
|
-
let
|
|
209
|
-
if (
|
|
210
|
-
|
|
207
|
+
}, xe = k.words === 0 ? a("helpMeWriteTemplates.bar.sourceEmpty") : k.kind === "selection" ? a("helpMeWriteTemplates.bar.sourceSelection") : a("helpMeWriteTemplates.bar.sourceDocument");
|
|
208
|
+
let j;
|
|
209
|
+
if (L)
|
|
210
|
+
j = /* @__PURE__ */ e(
|
|
211
211
|
Ge,
|
|
212
212
|
{
|
|
213
|
-
credits:
|
|
214
|
-
onBack: () =>
|
|
213
|
+
credits: b,
|
|
214
|
+
onBack: () => $(!1)
|
|
215
215
|
}
|
|
216
216
|
);
|
|
217
|
-
else if (
|
|
218
|
-
const l = !!
|
|
219
|
-
|
|
217
|
+
else if (w) {
|
|
218
|
+
const l = !!w.template;
|
|
219
|
+
j = /* @__PURE__ */ i(E, { children: [
|
|
220
220
|
/* @__PURE__ */ i(
|
|
221
221
|
"div",
|
|
222
222
|
{
|
|
@@ -225,16 +225,16 @@ function Ve({
|
|
|
225
225
|
l ? /* @__PURE__ */ i(
|
|
226
226
|
"section",
|
|
227
227
|
{
|
|
228
|
-
"aria-labelledby": `${
|
|
228
|
+
"aria-labelledby": `${M}-before`,
|
|
229
229
|
className: "ds:flex ds:min-w-0 ds:flex-col ds:gap-[var(--spacing-2xs)]",
|
|
230
230
|
children: [
|
|
231
|
-
/* @__PURE__ */ e("h2", { id: `${
|
|
231
|
+
/* @__PURE__ */ e("h2", { id: `${M}-before`, className: pe, children: k.kind === "selection" ? a("helpMeWriteTemplates.bar.beforeSelection") : a("helpMeWriteTemplates.bar.beforeDocument") }),
|
|
232
232
|
/* @__PURE__ */ e(
|
|
233
233
|
"p",
|
|
234
234
|
{
|
|
235
|
-
className: `${
|
|
235
|
+
className: `${ee} ${ue} ds:text-[color:var(--muted-foreground)]`,
|
|
236
236
|
tabIndex: 0,
|
|
237
|
-
children:
|
|
237
|
+
children: k.text
|
|
238
238
|
}
|
|
239
239
|
)
|
|
240
240
|
]
|
|
@@ -243,16 +243,16 @@ function Ve({
|
|
|
243
243
|
/* @__PURE__ */ i(
|
|
244
244
|
"section",
|
|
245
245
|
{
|
|
246
|
-
"aria-labelledby": `${
|
|
246
|
+
"aria-labelledby": `${M}-after`,
|
|
247
247
|
className: "ds:flex ds:min-w-0 ds:flex-col ds:gap-[var(--spacing-2xs)]",
|
|
248
248
|
children: [
|
|
249
|
-
/* @__PURE__ */ e("h2", { id: `${
|
|
249
|
+
/* @__PURE__ */ e("h2", { id: `${M}-after`, className: pe, children: w.template ? `${a("helpMeWriteTemplates.bar.after")} · ${w.template.name}` : a("helpMeWriteTemplates.bar.after") }),
|
|
250
250
|
/* @__PURE__ */ e(
|
|
251
251
|
Se,
|
|
252
252
|
{
|
|
253
|
-
html:
|
|
253
|
+
html: w.draft,
|
|
254
254
|
profile: "rich-text",
|
|
255
|
-
className: l ? `${
|
|
255
|
+
className: l ? `${ee} ${ue}` : ee,
|
|
256
256
|
tabIndex: 0
|
|
257
257
|
}
|
|
258
258
|
)
|
|
@@ -263,42 +263,42 @@ function Ve({
|
|
|
263
263
|
}
|
|
264
264
|
),
|
|
265
265
|
/* @__PURE__ */ i("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]", children: [
|
|
266
|
-
/* @__PURE__ */ e(
|
|
266
|
+
/* @__PURE__ */ e(g, { intent: "ghost", startIcon: /* @__PURE__ */ e(de, {}), onClick: r.onClose, children: a("helpMeWriteTemplates.bar.discard") }),
|
|
267
267
|
/* @__PURE__ */ e(
|
|
268
|
-
|
|
268
|
+
g,
|
|
269
269
|
{
|
|
270
270
|
intent: "ghost",
|
|
271
271
|
startIcon: /* @__PURE__ */ e(Be, {}),
|
|
272
272
|
onClick: () => {
|
|
273
|
-
|
|
273
|
+
_(null), J(w.template);
|
|
274
274
|
},
|
|
275
275
|
children: a("helpMeWriteTemplates.bar.retry")
|
|
276
276
|
}
|
|
277
277
|
),
|
|
278
278
|
/* @__PURE__ */ e("span", { className: "ds:flex-1", "aria-hidden": "true" }),
|
|
279
|
-
l ? /* @__PURE__ */ i(
|
|
280
|
-
/* @__PURE__ */ e(
|
|
281
|
-
/* @__PURE__ */ e(
|
|
282
|
-
] }) : /* @__PURE__ */ e(
|
|
279
|
+
l ? /* @__PURE__ */ i(E, { children: [
|
|
280
|
+
/* @__PURE__ */ e(g, { intent: "outline", onClick: () => K("below"), children: a("helpMeWriteTemplates.bar.insertBelow") }),
|
|
281
|
+
/* @__PURE__ */ e(g, { intent: "primary", onClick: () => K("replace"), children: a("helpMeWriteTemplates.bar.replace") })
|
|
282
|
+
] }) : /* @__PURE__ */ e(g, { intent: "primary", onClick: () => K("insert"), children: a("helpMeWriteTemplates.bar.insert") })
|
|
283
283
|
] })
|
|
284
284
|
] });
|
|
285
285
|
} else {
|
|
286
|
-
const l =
|
|
287
|
-
|
|
286
|
+
const l = ve(c), d = T ? he(C, Te) : C, W = c.length > 0 || p;
|
|
287
|
+
j = /* @__PURE__ */ i(E, { children: [
|
|
288
288
|
/* @__PURE__ */ i("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
|
|
289
289
|
/* @__PURE__ */ e(
|
|
290
|
-
|
|
290
|
+
H,
|
|
291
291
|
{
|
|
292
292
|
size: "md",
|
|
293
293
|
intent: "outline",
|
|
294
|
-
className:
|
|
295
|
-
icon: /* @__PURE__ */ e(
|
|
294
|
+
className: q,
|
|
295
|
+
icon: /* @__PURE__ */ e(de, {}),
|
|
296
296
|
"aria-label": a("helpMeWriteTemplates.bar.close"),
|
|
297
297
|
onClick: r.onClose
|
|
298
298
|
}
|
|
299
299
|
),
|
|
300
300
|
/* @__PURE__ */ e("div", { className: "ds:min-w-0 ds:flex-1", children: /* @__PURE__ */ e(
|
|
301
|
-
|
|
301
|
+
ge,
|
|
302
302
|
{
|
|
303
303
|
size: "md",
|
|
304
304
|
value: d,
|
|
@@ -308,68 +308,68 @@ function Ve({
|
|
|
308
308
|
autoResize: !0,
|
|
309
309
|
minRows: 1,
|
|
310
310
|
maxRows: 3,
|
|
311
|
-
readOnly:
|
|
311
|
+
readOnly: s || T,
|
|
312
312
|
tone: y ? "error" : "default",
|
|
313
|
-
"aria-describedby": y ?
|
|
313
|
+
"aria-describedby": y ? S : void 0
|
|
314
314
|
}
|
|
315
315
|
) }),
|
|
316
|
-
|
|
317
|
-
|
|
316
|
+
D ? /* @__PURE__ */ e(
|
|
317
|
+
H,
|
|
318
318
|
{
|
|
319
319
|
size: "md",
|
|
320
320
|
intent: "outline",
|
|
321
|
-
className:
|
|
322
|
-
icon:
|
|
323
|
-
"aria-pressed":
|
|
324
|
-
"aria-label": a(
|
|
325
|
-
disabled:
|
|
321
|
+
className: T ? `${q} ${qe}` : q,
|
|
322
|
+
icon: T ? /* @__PURE__ */ e(Oe, { className: "ds:fill-current" }) : /* @__PURE__ */ e(Fe, {}),
|
|
323
|
+
"aria-pressed": T,
|
|
324
|
+
"aria-label": a(T ? "helpMeWriteTemplates.bar.dictateStop" : "helpMeWriteTemplates.bar.dictateStart"),
|
|
325
|
+
disabled: s,
|
|
326
326
|
onClick: We
|
|
327
327
|
}
|
|
328
328
|
) : null,
|
|
329
|
-
W ? /* @__PURE__ */ i(
|
|
330
|
-
/* @__PURE__ */ e(
|
|
331
|
-
|
|
329
|
+
W ? /* @__PURE__ */ i(z.Root, { children: [
|
|
330
|
+
/* @__PURE__ */ e(z.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
|
|
331
|
+
g,
|
|
332
332
|
{
|
|
333
333
|
intent: "outline",
|
|
334
334
|
size: "md",
|
|
335
335
|
className: Pe,
|
|
336
|
-
startIcon:
|
|
337
|
-
endIcon: /* @__PURE__ */ e(
|
|
336
|
+
startIcon: I ? /* @__PURE__ */ e(le, { size: "sm", variant: "pulse" }) : /* @__PURE__ */ e(ce, { "aria-hidden": "true" }),
|
|
337
|
+
endIcon: /* @__PURE__ */ e(Le, { "aria-hidden": "true" }),
|
|
338
338
|
"aria-haspopup": "menu",
|
|
339
|
-
"aria-busy":
|
|
340
|
-
disabled:
|
|
341
|
-
"aria-describedby":
|
|
339
|
+
"aria-busy": I ? !0 : void 0,
|
|
340
|
+
disabled: s,
|
|
341
|
+
"aria-describedby": M,
|
|
342
342
|
children: a("helpMeWriteTemplates.bar.templatesMenu")
|
|
343
343
|
}
|
|
344
344
|
) }),
|
|
345
|
-
/* @__PURE__ */ i(
|
|
346
|
-
/* @__PURE__ */ e(
|
|
345
|
+
/* @__PURE__ */ i(z.Content, { side: "top", align: "end", sideOffset: 8, children: [
|
|
346
|
+
/* @__PURE__ */ e(z.Label, { children: a("helpMeWriteTemplates.bar.templatesGroup") }),
|
|
347
347
|
l.map((m) => /* @__PURE__ */ e(
|
|
348
|
-
|
|
348
|
+
z.Item,
|
|
349
349
|
{
|
|
350
|
-
startIcon: /* @__PURE__ */ e(
|
|
350
|
+
startIcon: /* @__PURE__ */ e(ce, {}),
|
|
351
351
|
description: m.description || void 0,
|
|
352
|
-
disabled:
|
|
353
|
-
onSelect: () =>
|
|
352
|
+
disabled: s || k.words === 0,
|
|
353
|
+
onSelect: () => J(m),
|
|
354
354
|
children: /* @__PURE__ */ i("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
|
|
355
355
|
m.name,
|
|
356
|
-
m.isDefault ? /* @__PURE__ */ e(
|
|
356
|
+
m.isDefault ? /* @__PURE__ */ e(fe, { variant: "brand", size: "sm", children: a("helpMeWriteTemplates.bar.defaultBadge") }) : null
|
|
357
357
|
] })
|
|
358
358
|
},
|
|
359
359
|
m.id
|
|
360
360
|
)),
|
|
361
361
|
p && c.length === 0 ? /* @__PURE__ */ e(
|
|
362
|
-
|
|
362
|
+
z.Item,
|
|
363
363
|
{
|
|
364
|
-
startIcon: /* @__PURE__ */ e(
|
|
364
|
+
startIcon: /* @__PURE__ */ e(be, {}),
|
|
365
365
|
onSelect: () => p("create"),
|
|
366
366
|
children: a("helpMeWriteTemplates.bar.createFirst")
|
|
367
367
|
}
|
|
368
368
|
) : null,
|
|
369
|
-
p && c.length > 0 ? /* @__PURE__ */ i(
|
|
370
|
-
/* @__PURE__ */ e(
|
|
369
|
+
p && c.length > 0 ? /* @__PURE__ */ i(E, { children: [
|
|
370
|
+
/* @__PURE__ */ e(z.Separator, {}),
|
|
371
371
|
/* @__PURE__ */ e(
|
|
372
|
-
|
|
372
|
+
z.Item,
|
|
373
373
|
{
|
|
374
374
|
startIcon: /* @__PURE__ */ e(_e, {}),
|
|
375
375
|
onSelect: () => p("list"),
|
|
@@ -380,22 +380,22 @@ function Ve({
|
|
|
380
380
|
] })
|
|
381
381
|
] }) : null,
|
|
382
382
|
/* @__PURE__ */ e(
|
|
383
|
-
|
|
383
|
+
H,
|
|
384
384
|
{
|
|
385
385
|
size: "md",
|
|
386
386
|
intent: "primary",
|
|
387
387
|
className: je,
|
|
388
|
-
icon:
|
|
389
|
-
disabled:
|
|
390
|
-
"aria-busy":
|
|
388
|
+
icon: I === void 0 ? /* @__PURE__ */ e(le, { size: "sm", variant: "pulse" }) : /* @__PURE__ */ e(He, {}),
|
|
389
|
+
disabled: s || !C.trim(),
|
|
390
|
+
"aria-busy": I === void 0 || void 0,
|
|
391
391
|
"aria-label": a("helpMeWriteTemplates.bar.write"),
|
|
392
|
-
onClick: () =>
|
|
392
|
+
onClick: () => J(void 0)
|
|
393
393
|
}
|
|
394
394
|
)
|
|
395
395
|
] }),
|
|
396
|
-
|
|
397
|
-
y ? /* @__PURE__ */ e("p", { id:
|
|
398
|
-
/* @__PURE__ */ i("p", { id:
|
|
396
|
+
D ? /* @__PURE__ */ e("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: Me }) : null,
|
|
397
|
+
y ? /* @__PURE__ */ e("p", { id: S, role: "alert", className: G, children: a("helpMeWriteTemplates.bar.error") }) : null,
|
|
398
|
+
/* @__PURE__ */ i("p", { id: M, className: G, children: [
|
|
399
399
|
xe,
|
|
400
400
|
" ",
|
|
401
401
|
r.privacyNotice
|
|
@@ -408,11 +408,11 @@ function Ve({
|
|
|
408
408
|
open: N,
|
|
409
409
|
onClose: Ce,
|
|
410
410
|
ariaLabel: a("editor.ai.helpMeWrite"),
|
|
411
|
-
children: /* @__PURE__ */ e("div", { className: "ds:contents", "data-component": "help-me-write-templates-bar", children:
|
|
411
|
+
children: /* @__PURE__ */ e("div", { className: "ds:contents", "data-component": "help-me-write-templates-bar", children: j })
|
|
412
412
|
}
|
|
413
413
|
);
|
|
414
414
|
}
|
|
415
|
-
const
|
|
415
|
+
const re = {
|
|
416
416
|
name: "",
|
|
417
417
|
description: "",
|
|
418
418
|
prompt: "",
|
|
@@ -425,58 +425,69 @@ function Xe({
|
|
|
425
425
|
initialMode: o = "list",
|
|
426
426
|
templates: p,
|
|
427
427
|
onSaveTemplate: u,
|
|
428
|
-
onDeleteTemplate:
|
|
428
|
+
onDeleteTemplate: b
|
|
429
429
|
}) {
|
|
430
|
-
const { t } =
|
|
431
|
-
|
|
430
|
+
const { t } = V(), [n, a] = h(null), [N, M] = h(!1), [S, C] = h(!1), [x, I] = h(null), [v, y] = h(!1), [F, L] = h(!1), $ = async () => {
|
|
431
|
+
if (!(!x || v)) {
|
|
432
|
+
y(!0), L(!1);
|
|
433
|
+
try {
|
|
434
|
+
await (b == null ? void 0 : b(x.id)), I(null);
|
|
435
|
+
} catch {
|
|
436
|
+
L(!0);
|
|
437
|
+
} finally {
|
|
438
|
+
y(!1);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
U(() => {
|
|
432
443
|
r && (C(!1), a(
|
|
433
|
-
o === "create" ? { ...
|
|
444
|
+
o === "create" ? { ...re, isDefault: p.length === 0 } : null
|
|
434
445
|
));
|
|
435
446
|
}, [r]);
|
|
436
|
-
const
|
|
437
|
-
(
|
|
438
|
-
),
|
|
447
|
+
const w = (s, D) => p.some(
|
|
448
|
+
(T) => T.id !== D && T.name.toLowerCase() === s.toLowerCase()
|
|
449
|
+
), _ = (() => {
|
|
439
450
|
if (!(n != null && n.submitted)) return;
|
|
440
451
|
const s = n.name.trim();
|
|
441
|
-
return s ?
|
|
442
|
-
})(),
|
|
452
|
+
return s ? w(s, n.id) ? t("helpMeWriteTemplates.manager.nameTaken") : void 0 : t("helpMeWriteTemplates.manager.nameRequired");
|
|
453
|
+
})(), k = n != null && n.submitted && !n.prompt.trim() ? t("helpMeWriteTemplates.manager.promptRequired") : void 0, X = async () => {
|
|
443
454
|
if (!n || N) return;
|
|
444
455
|
const s = { ...n, submitted: !0 };
|
|
445
456
|
a(s);
|
|
446
|
-
const
|
|
447
|
-
if (!(!
|
|
448
|
-
|
|
457
|
+
const D = s.name.trim(), T = s.prompt.trim();
|
|
458
|
+
if (!(!D || !T || w(D, s.id))) {
|
|
459
|
+
M(!0), C(!1);
|
|
449
460
|
try {
|
|
450
461
|
await u({
|
|
451
462
|
id: s.id,
|
|
452
|
-
name:
|
|
463
|
+
name: D,
|
|
453
464
|
description: s.description.trim() || void 0,
|
|
454
|
-
prompt:
|
|
465
|
+
prompt: T,
|
|
455
466
|
isDefault: s.isDefault
|
|
456
467
|
}), a(null);
|
|
457
468
|
} catch {
|
|
458
469
|
C(!0);
|
|
459
470
|
} finally {
|
|
460
|
-
|
|
471
|
+
M(!1);
|
|
461
472
|
}
|
|
462
473
|
}
|
|
463
|
-
},
|
|
464
|
-
return /* @__PURE__ */ i(
|
|
465
|
-
/* @__PURE__ */ e(
|
|
466
|
-
/* @__PURE__ */ i(
|
|
467
|
-
/* @__PURE__ */ e(
|
|
468
|
-
/* @__PURE__ */ e(
|
|
474
|
+
}, A = n ? n.id ? t("helpMeWriteTemplates.manager.formEdit") : t("helpMeWriteTemplates.manager.formNew") : t("helpMeWriteTemplates.manager.title");
|
|
475
|
+
return /* @__PURE__ */ i(E, { children: [
|
|
476
|
+
/* @__PURE__ */ e(f, { open: r, onOpenChange: c, children: /* @__PURE__ */ e(f.Content, { size: "lg", children: /* @__PURE__ */ i("div", { className: "ds:contents", "data-component": "ai-template-manager", children: [
|
|
477
|
+
/* @__PURE__ */ i(f.Header, { children: [
|
|
478
|
+
/* @__PURE__ */ e(f.Title, { children: A }),
|
|
479
|
+
/* @__PURE__ */ e(f.Description, { children: t("helpMeWriteTemplates.manager.description") })
|
|
469
480
|
] }),
|
|
470
|
-
/* @__PURE__ */ e(
|
|
471
|
-
|
|
481
|
+
/* @__PURE__ */ e(f.Body, { children: n ? /* @__PURE__ */ i("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
|
|
482
|
+
S ? /* @__PURE__ */ e(R, { variant: "error", children: t("helpMeWriteTemplates.manager.saveError") }) : null,
|
|
472
483
|
/* @__PURE__ */ e(
|
|
473
|
-
|
|
484
|
+
Q,
|
|
474
485
|
{
|
|
475
486
|
label: t("helpMeWriteTemplates.manager.name"),
|
|
476
|
-
error:
|
|
487
|
+
error: _,
|
|
477
488
|
required: !0,
|
|
478
489
|
children: /* @__PURE__ */ e(
|
|
479
|
-
|
|
490
|
+
oe,
|
|
480
491
|
{
|
|
481
492
|
value: n.name,
|
|
482
493
|
maxLength: 100,
|
|
@@ -489,13 +500,13 @@ function Xe({
|
|
|
489
500
|
}
|
|
490
501
|
),
|
|
491
502
|
/* @__PURE__ */ e(
|
|
492
|
-
|
|
503
|
+
Q,
|
|
493
504
|
{
|
|
494
505
|
label: t("helpMeWriteTemplates.manager.descLabel"),
|
|
495
506
|
description: t("helpMeWriteTemplates.manager.descHint"),
|
|
496
507
|
optional: !0,
|
|
497
508
|
children: /* @__PURE__ */ e(
|
|
498
|
-
|
|
509
|
+
oe,
|
|
499
510
|
{
|
|
500
511
|
value: n.description,
|
|
501
512
|
maxLength: 120,
|
|
@@ -505,16 +516,16 @@ function Xe({
|
|
|
505
516
|
}
|
|
506
517
|
),
|
|
507
518
|
/* @__PURE__ */ e(
|
|
508
|
-
|
|
519
|
+
Q,
|
|
509
520
|
{
|
|
510
521
|
label: t("helpMeWriteTemplates.manager.prompt"),
|
|
511
522
|
description: t(
|
|
512
523
|
"helpMeWriteTemplates.manager.promptDescription"
|
|
513
524
|
),
|
|
514
|
-
error:
|
|
525
|
+
error: k,
|
|
515
526
|
required: !0,
|
|
516
527
|
children: /* @__PURE__ */ e(
|
|
517
|
-
|
|
528
|
+
ge,
|
|
518
529
|
{
|
|
519
530
|
value: n.prompt,
|
|
520
531
|
maxLength: 4e3,
|
|
@@ -527,7 +538,7 @@ function Xe({
|
|
|
527
538
|
}
|
|
528
539
|
),
|
|
529
540
|
/* @__PURE__ */ e(
|
|
530
|
-
|
|
541
|
+
Ie,
|
|
531
542
|
{
|
|
532
543
|
label: t("helpMeWriteTemplates.manager.isDefault"),
|
|
533
544
|
checked: n.isDefault,
|
|
@@ -545,7 +556,7 @@ function Xe({
|
|
|
545
556
|
),
|
|
546
557
|
primaryAction: {
|
|
547
558
|
label: t("helpMeWriteTemplates.manager.new"),
|
|
548
|
-
onClick: () => a({ ...
|
|
559
|
+
onClick: () => a({ ...re, isDefault: !0 })
|
|
549
560
|
}
|
|
550
561
|
}
|
|
551
562
|
) : /* @__PURE__ */ e(
|
|
@@ -553,7 +564,7 @@ function Xe({
|
|
|
553
564
|
{
|
|
554
565
|
"aria-label": t("helpMeWriteTemplates.manager.listLabel"),
|
|
555
566
|
className: "ds:m-0 ds:flex ds:list-none ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-0",
|
|
556
|
-
children:
|
|
567
|
+
children: ve(p).map((s) => /* @__PURE__ */ i(
|
|
557
568
|
"li",
|
|
558
569
|
{
|
|
559
570
|
className: "ds:flex ds:items-start ds:gap-[var(--spacing-sm)] ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)] ds:p-[var(--spacing-sm)]",
|
|
@@ -561,12 +572,12 @@ function Xe({
|
|
|
561
572
|
/* @__PURE__ */ i("div", { className: "ds:flex ds:min-w-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-2xs)]", children: [
|
|
562
573
|
/* @__PURE__ */ i("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]", children: [
|
|
563
574
|
/* @__PURE__ */ e("span", { className: "type-title-item ds:text-[color:var(--foreground)]", children: s.name }),
|
|
564
|
-
s.isDefault ? /* @__PURE__ */ e(
|
|
575
|
+
s.isDefault ? /* @__PURE__ */ e(fe, { variant: "brand", size: "sm", children: t("helpMeWriteTemplates.bar.defaultBadge") }) : null
|
|
565
576
|
] }),
|
|
566
|
-
/* @__PURE__ */ e("p", { className: `${
|
|
577
|
+
/* @__PURE__ */ e("p", { className: `${G} ds:line-clamp-2`, children: s.description || s.prompt })
|
|
567
578
|
] }),
|
|
568
579
|
/* @__PURE__ */ e(
|
|
569
|
-
|
|
580
|
+
H,
|
|
570
581
|
{
|
|
571
582
|
size: "sm",
|
|
572
583
|
intent: "ghost",
|
|
@@ -584,8 +595,8 @@ function Xe({
|
|
|
584
595
|
})
|
|
585
596
|
}
|
|
586
597
|
),
|
|
587
|
-
|
|
588
|
-
|
|
598
|
+
b ? /* @__PURE__ */ e(
|
|
599
|
+
H,
|
|
589
600
|
{
|
|
590
601
|
size: "sm",
|
|
591
602
|
intent: "ghost",
|
|
@@ -593,7 +604,7 @@ function Xe({
|
|
|
593
604
|
"aria-label": t("helpMeWriteTemplates.manager.delete", {
|
|
594
605
|
name: s.name
|
|
595
606
|
}),
|
|
596
|
-
onClick: () =>
|
|
607
|
+
onClick: () => I(s)
|
|
597
608
|
}
|
|
598
609
|
) : null
|
|
599
610
|
]
|
|
@@ -602,53 +613,53 @@ function Xe({
|
|
|
602
613
|
))
|
|
603
614
|
}
|
|
604
615
|
) }),
|
|
605
|
-
/* @__PURE__ */ e(
|
|
606
|
-
/* @__PURE__ */ e(
|
|
616
|
+
/* @__PURE__ */ e(f.Footer, { children: n ? /* @__PURE__ */ i(E, { children: [
|
|
617
|
+
/* @__PURE__ */ e(g, { intent: "secondary", onClick: () => a(null), children: t("helpMeWriteTemplates.manager.cancel") }),
|
|
607
618
|
/* @__PURE__ */ e(
|
|
608
|
-
|
|
619
|
+
g,
|
|
609
620
|
{
|
|
610
621
|
intent: "primary",
|
|
611
622
|
loading: N,
|
|
612
|
-
onClick: () => void
|
|
623
|
+
onClick: () => void X(),
|
|
613
624
|
children: t("helpMeWriteTemplates.manager.save")
|
|
614
625
|
}
|
|
615
626
|
)
|
|
616
|
-
] }) : /* @__PURE__ */ i(
|
|
627
|
+
] }) : /* @__PURE__ */ i(E, { children: [
|
|
617
628
|
p.length > 0 ? /* @__PURE__ */ e(
|
|
618
|
-
|
|
629
|
+
g,
|
|
619
630
|
{
|
|
620
631
|
intent: "outline",
|
|
621
|
-
startIcon: /* @__PURE__ */ e(
|
|
622
|
-
onClick: () => a({ ...
|
|
632
|
+
startIcon: /* @__PURE__ */ e(be, {}),
|
|
633
|
+
onClick: () => a({ ...re }),
|
|
623
634
|
children: t("helpMeWriteTemplates.manager.new")
|
|
624
635
|
}
|
|
625
636
|
) : null,
|
|
626
|
-
/* @__PURE__ */ e(
|
|
637
|
+
/* @__PURE__ */ e(f.Close, { asChild: !0, children: /* @__PURE__ */ e(g, { intent: "primary", children: t("helpMeWriteTemplates.manager.done") }) })
|
|
627
638
|
] }) })
|
|
628
639
|
] }) }) }),
|
|
629
640
|
/* @__PURE__ */ e(
|
|
630
|
-
|
|
641
|
+
f,
|
|
631
642
|
{
|
|
632
643
|
open: x != null,
|
|
633
644
|
onOpenChange: (s) => {
|
|
634
|
-
s
|
|
645
|
+
!s && !v && (I(null), L(!1));
|
|
635
646
|
},
|
|
636
|
-
children: /* @__PURE__ */ i(
|
|
637
|
-
/* @__PURE__ */ i(
|
|
638
|
-
/* @__PURE__ */ e(
|
|
647
|
+
children: /* @__PURE__ */ i(f.Content, { size: "sm", variant: "alert", children: [
|
|
648
|
+
/* @__PURE__ */ i(f.Header, { children: [
|
|
649
|
+
/* @__PURE__ */ e(f.Title, { children: t("helpMeWriteTemplates.manager.deleteTitle", {
|
|
639
650
|
name: (x == null ? void 0 : x.name) ?? ""
|
|
640
651
|
}) }),
|
|
641
|
-
/* @__PURE__ */ e(
|
|
652
|
+
/* @__PURE__ */ e(f.Description, { children: t("helpMeWriteTemplates.manager.deleteDescription") })
|
|
642
653
|
] }),
|
|
643
|
-
/* @__PURE__ */
|
|
644
|
-
|
|
654
|
+
F ? /* @__PURE__ */ e(f.Body, { children: /* @__PURE__ */ e(R, { variant: "error", children: t("helpMeWriteTemplates.manager.deleteError") }) }) : null,
|
|
655
|
+
/* @__PURE__ */ i(f.Footer, { children: [
|
|
656
|
+
/* @__PURE__ */ e(f.Close, { asChild: !0, children: /* @__PURE__ */ e(g, { intent: "secondary", disabled: v, children: t("helpMeWriteTemplates.manager.cancel") }) }),
|
|
645
657
|
/* @__PURE__ */ e(
|
|
646
|
-
|
|
658
|
+
g,
|
|
647
659
|
{
|
|
648
660
|
intent: "destructive",
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
},
|
|
661
|
+
loading: v,
|
|
662
|
+
onClick: () => void $(),
|
|
652
663
|
children: t("helpMeWriteTemplates.manager.deleteConfirm")
|
|
653
664
|
}
|
|
654
665
|
)
|
|
@@ -663,14 +674,14 @@ function Ye({
|
|
|
663
674
|
onUndo: c,
|
|
664
675
|
onDismiss: o
|
|
665
676
|
}) {
|
|
666
|
-
const { t: p } =
|
|
667
|
-
if (
|
|
677
|
+
const { t: p } = V(), u = te(null);
|
|
678
|
+
if (U(() => {
|
|
668
679
|
var t;
|
|
669
680
|
r && ((t = u.current) == null || t.focus());
|
|
670
681
|
}, [r]), !(r != null && r.template)) return null;
|
|
671
|
-
const
|
|
682
|
+
const b = r.template.name;
|
|
672
683
|
return /* @__PURE__ */ e(
|
|
673
|
-
|
|
684
|
+
R,
|
|
674
685
|
{
|
|
675
686
|
variant: "success",
|
|
676
687
|
dismissible: !0,
|
|
@@ -679,37 +690,37 @@ function Ye({
|
|
|
679
690
|
},
|
|
680
691
|
"data-component": "help-me-write-undo-notice",
|
|
681
692
|
children: /* @__PURE__ */ i("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]", children: [
|
|
682
|
-
/* @__PURE__ */ e("span", { children: r.mode === "below" ? p("helpMeWriteTemplates.undo.addedBelow", { name:
|
|
683
|
-
/* @__PURE__ */ e(
|
|
693
|
+
/* @__PURE__ */ e("span", { children: r.mode === "below" ? p("helpMeWriteTemplates.undo.addedBelow", { name: b }) : p("helpMeWriteTemplates.undo.replaced", { name: b }) }),
|
|
694
|
+
/* @__PURE__ */ e(g, { ref: u, intent: "outline", size: "sm", onClick: c, children: p("helpMeWriteTemplates.undo.undo") })
|
|
684
695
|
] })
|
|
685
696
|
}
|
|
686
697
|
);
|
|
687
698
|
}
|
|
688
|
-
function
|
|
699
|
+
function Dr({
|
|
689
700
|
templates: r,
|
|
690
701
|
onGenerate: c,
|
|
691
702
|
onSaveTemplate: o,
|
|
692
703
|
onDeleteTemplate: p,
|
|
693
704
|
credits: u,
|
|
694
|
-
enableDictation:
|
|
705
|
+
enableDictation: b,
|
|
695
706
|
onApplied: t
|
|
696
707
|
}) {
|
|
697
|
-
const [n, a] =
|
|
698
|
-
(
|
|
708
|
+
const [n, a] = h({ open: !1, mode: "list" }), [N, M] = h(null), S = O(
|
|
709
|
+
(v = "list") => a({ open: !0, mode: v }),
|
|
699
710
|
[]
|
|
700
|
-
), C =
|
|
701
|
-
(
|
|
711
|
+
), C = O(
|
|
712
|
+
(v) => /* @__PURE__ */ e(
|
|
702
713
|
Ve,
|
|
703
714
|
{
|
|
704
|
-
context:
|
|
715
|
+
context: v,
|
|
705
716
|
templates: r,
|
|
706
717
|
onGenerate: c,
|
|
707
|
-
onManageTemplates: o ?
|
|
718
|
+
onManageTemplates: o ? S : void 0,
|
|
708
719
|
credits: u,
|
|
709
|
-
enableDictation:
|
|
720
|
+
enableDictation: b,
|
|
710
721
|
suspendClose: n.open,
|
|
711
722
|
onApplied: (y) => {
|
|
712
|
-
|
|
723
|
+
M(y.template ? y : null), t == null || t(y);
|
|
713
724
|
}
|
|
714
725
|
}
|
|
715
726
|
),
|
|
@@ -717,19 +728,19 @@ function Ir({
|
|
|
717
728
|
r,
|
|
718
729
|
c,
|
|
719
730
|
o,
|
|
720
|
-
|
|
731
|
+
S,
|
|
721
732
|
u,
|
|
722
|
-
|
|
733
|
+
b,
|
|
723
734
|
n.open,
|
|
724
735
|
t
|
|
725
736
|
]
|
|
726
|
-
), x =
|
|
737
|
+
), x = Ne(
|
|
727
738
|
() => o ? /* @__PURE__ */ e(
|
|
728
739
|
Xe,
|
|
729
740
|
{
|
|
730
741
|
open: n.open,
|
|
731
742
|
initialMode: n.mode,
|
|
732
|
-
onOpenChange: (
|
|
743
|
+
onOpenChange: (v) => a((y) => ({ ...y, open: v })),
|
|
733
744
|
templates: r,
|
|
734
745
|
onSaveTemplate: o,
|
|
735
746
|
onDeleteTemplate: p
|
|
@@ -745,20 +756,20 @@ function Ir({
|
|
|
745
756
|
{
|
|
746
757
|
applied: N,
|
|
747
758
|
onUndo: () => {
|
|
748
|
-
N == null || N.undo(),
|
|
759
|
+
N == null || N.undo(), M(null);
|
|
749
760
|
},
|
|
750
|
-
onDismiss: () =>
|
|
761
|
+
onDismiss: () => M(null)
|
|
751
762
|
}
|
|
752
763
|
),
|
|
753
|
-
openManager:
|
|
764
|
+
openManager: S
|
|
754
765
|
};
|
|
755
766
|
}
|
|
756
767
|
export {
|
|
757
|
-
|
|
768
|
+
me as A,
|
|
758
769
|
Ve as H,
|
|
759
770
|
Ge as a,
|
|
760
771
|
Xe as b,
|
|
761
772
|
Ye as c,
|
|
762
|
-
|
|
773
|
+
Dr as u
|
|
763
774
|
};
|
|
764
|
-
//# sourceMappingURL=help-me-write-templates-
|
|
775
|
+
//# sourceMappingURL=help-me-write-templates-B-m7zgJa.js.map
|