@burdenoff/microfe-botmanor 2026.1031.1 → 2026.1101.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.
@@ -1,23 +1,24 @@
1
1
  import { useBotlit as e } from "../providers/BotlitProvider.js";
2
- import { formatRelativeTime as t } from "../utils/formatters.js";
3
- import { BOTMANOR_PERMISSIONS as n } from "../permissions/botmanorPermissions.js";
4
- import { BotmanorPermissionGate as r } from "../permissions/useBotmanorPermissions.js";
5
- import { PageLayout as i } from "../components/PageLayout.js";
6
- import { Button as a } from "../components/Button.js";
2
+ import { graphqlErrorMessage as t } from "../utils/errors.js";
3
+ import { formatRelativeTime as n } from "../utils/formatters.js";
4
+ import { BOTMANOR_PERMISSIONS as r } from "../permissions/botmanorPermissions.js";
5
+ import { BotmanorPermissionGate as i } from "../permissions/useBotmanorPermissions.js";
6
+ import { PageLayout as a } from "../components/PageLayout.js";
7
+ import { Button as o } from "../components/Button.js";
7
8
  import "../permissions/index.js";
8
- import { Card as o, CardContent as s, CardDescription as c, CardHeader as l, CardTitle as u } from "../components/Card.js";
9
- import { Badge as d, StatusBadge as ee } from "../components/Badge.js";
10
- import { isNative as f, nativeCopyText as te, nativeImpact as ne, nativeNotify as p, nativeToast as re } from "../../utils/nativeBridge.js";
9
+ import { Card as s, CardContent as c, CardDescription as l, CardHeader as u, CardTitle as d } from "../components/Card.js";
10
+ import { Badge as f, StatusBadge as ee } from "../components/Badge.js";
11
+ import { isNative as p, nativeCopyText as te, nativeImpact as ne, nativeNotify as m, nativeToast as re } from "../../utils/nativeBridge.js";
11
12
  import { EmptyState as ie } from "../components/EmptyState.js";
12
- import { FormField as m, Input as h, Textarea as g } from "../components/Input.js";
13
- import { toUnion as _ } from "../utils/unions.js";
14
- import { promptTemplateExamples as v, promptTemplateVariables as ae, useCreatePromptTemplate as oe, useDeletePromptTemplate as se, usePromptTemplate as ce, useRenderPromptTemplate as le, useUpdatePromptTemplate as ue } from "../hooks/usePromptTemplates.js";
13
+ import { FormField as h, Input as g, Textarea as _ } from "../components/Input.js";
14
+ import { toUnion as v } from "../utils/unions.js";
15
+ import { promptTemplateExamples as ae, promptTemplateVariables as oe, useCreatePromptTemplate as se, useDeletePromptTemplate as ce, usePromptTemplate as le, useRenderPromptTemplate as ue, useUpdatePromptTemplate as de } from "../hooks/usePromptTemplates.js";
15
16
  import "../hooks/index.js";
16
- import { useMemo as de, useState as y } from "react";
17
- import { PagePurpose as fe } from "@burdenoff/fe-libs/ui";
17
+ import { useMemo as fe, useState as y } from "react";
18
+ import { PagePurpose as pe } from "@burdenoff/fe-libs/ui";
18
19
  import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
19
- import { useParams as pe } from "react-router";
20
- import { ArrowLeft as me, Check as he, Code as C, Copy as ge, Edit3 as _e, Eye as w, FileText as T, Play as E, Save as D, Settings as ve, Trash2 as O, Variable as k } from "lucide-react";
20
+ import { useParams as me } from "react-router";
21
+ import { ArrowLeft as he, Check as ge, Code as C, Copy as _e, Edit3 as ve, Eye as w, FileText as T, Play as E, Save as D, Settings as ye, Trash2 as O, Variable as k } from "lucide-react";
21
22
  import { toast as A } from "sonner";
22
23
  //#region src/botlit/pages/PromptTemplateDetailPage.tsx
23
24
  var j = [
@@ -26,12 +27,12 @@ var j = [
26
27
  "boolean",
27
28
  "array",
28
29
  "object"
29
- ], ye = [
30
+ ], be = [
30
31
  "PRIVATE",
31
32
  "WORKSPACE",
32
33
  "PUBLIC"
33
34
  ], M = ({ isNew: M }) => {
34
- let { templateId: be } = pe(), { navigateTo: N } = e(), { data: P, loading: xe } = ce(M ? void 0 : be), { create: Se, loading: Ce } = oe(), { update: we, loading: Te } = ue(), { remove: Ee, loading: De } = se(), { render: Oe, loading: ke } = le(), [F, I] = y("edit"), [L, R] = y(!1), [z, Ae] = y({}), [B, V] = y(null), [H, U] = y(null), [W, G] = y(!1), [je, K] = y(!1), [q, J] = y({
35
+ let { templateId: xe } = me(), { navigateTo: N } = e(), { data: P, loading: Se } = le(M ? void 0 : xe), { create: Ce, loading: we } = se(), { update: Te, loading: Ee } = de(), { remove: De, loading: Oe } = ce(), { render: ke, loading: Ae } = ue(), [F, I] = y("edit"), [L, R] = y(!1), [z, je] = y({}), [B, V] = y(null), [H, U] = y(null), [W, G] = y(!1), [Me, K] = y(!1), [q, J] = y({
35
36
  name: "",
36
37
  slug: "",
37
38
  description: "",
@@ -39,7 +40,7 @@ var j = [
39
40
  templateText: "",
40
41
  variables: [],
41
42
  exampleInputs: [{}]
42
- }), Y = de(() => {
43
+ }), Y = fe(() => {
43
44
  let e = M ? q.templateText : P?.templateText || "", t = /\{\{(\w+)\}\}/g, n = /* @__PURE__ */ new Set(), r;
44
45
  for (; (r = t.exec(e)) !== null;) n.add(r[1]);
45
46
  return Array.from(n);
@@ -47,10 +48,10 @@ var j = [
47
48
  M,
48
49
  q.templateText,
49
50
  P?.templateText
50
- ]), Me = async () => {
51
+ ]), Ne = async () => {
51
52
  if (!(!q.name || !q.slug)) {
52
53
  try {
53
- await Se({
54
+ await Ce({
54
55
  name: q.name,
55
56
  slug: q.slug,
56
57
  description: q.description,
@@ -65,7 +66,7 @@ var j = [
65
66
  }
66
67
  A.success(`Template "${q.name}" created`), N("prompt-templates");
67
68
  }
68
- }, Ne = () => {
69
+ }, Pe = () => {
69
70
  J({
70
71
  ...q,
71
72
  variables: [...q.variables, {
@@ -84,40 +85,40 @@ var j = [
84
85
  ...q,
85
86
  variables: n
86
87
  });
87
- }, Pe = (e) => {
88
+ }, Fe = (e) => {
88
89
  J({
89
90
  ...q,
90
91
  variables: q.variables.filter((t, n) => n !== e)
91
92
  });
92
- }, Fe = async () => {
93
+ }, Ie = async () => {
93
94
  if (P) {
94
95
  U(null);
95
96
  try {
96
- V(await Oe({
97
+ V(await ke({
97
98
  templateId: P.id,
98
99
  variables: z
99
100
  }));
100
101
  } catch (e) {
101
- let t = e instanceof Error ? e.message : "Failed to render prompt template";
102
- V(null), U(t), A.error(t);
102
+ let n = t(e, "Failed to render prompt template");
103
+ V(null), U(n), A.error(n);
103
104
  }
104
105
  }
105
- }, Ie = async () => {
106
- await te(P?.templateText || q.templateText), R(!0), f() && re("Copied"), setTimeout(() => R(!1), 2e3);
107
- }, Le = () => {
106
+ }, Le = async () => {
107
+ await te(P?.templateText || q.templateText), R(!0), p() && re("Copied"), setTimeout(() => R(!1), 2e3);
108
+ }, Re = () => {
108
109
  P && (J({
109
110
  name: P.name,
110
111
  slug: P.slug,
111
112
  description: P.description || "",
112
- visibility: _(P.visibility, ye, "PRIVATE"),
113
+ visibility: v(P.visibility, be, "PRIVATE"),
113
114
  templateText: P.templateText,
114
- variables: ae(P),
115
- exampleInputs: v(P)
115
+ variables: oe(P),
116
+ exampleInputs: ae(P)
116
117
  }), G(!0));
117
- }, Re = async () => {
118
+ }, ze = async () => {
118
119
  if (!(!P || !q.name || !q.slug)) {
119
120
  try {
120
- await we({
121
+ await Te({
121
122
  templateId: P.id,
122
123
  input: {
123
124
  name: q.name,
@@ -135,26 +136,26 @@ var j = [
135
136
  }
136
137
  A.success("Template updated"), G(!1);
137
138
  }
138
- }, ze = async () => {
139
+ }, Be = async () => {
139
140
  if (P) try {
140
- await Ee(P.id), f() && p("success"), N("prompt-templates");
141
+ await De(P.id), p() && m("success"), N("prompt-templates");
141
142
  } catch (e) {
142
- throw f() && p("error"), e;
143
+ throw p() && m("error"), e;
143
144
  }
144
145
  }, Z = (e) => e.replace(/\{\{(\w+)\}\}/g, "<span class=\"bg-action-primary-bg/20 text-primary px-1 rounded font-mono\">{{$1}}</span>");
145
- if (M) return /* @__PURE__ */ x(i, {
146
+ if (M) return /* @__PURE__ */ x(a, {
146
147
  title: "Create Prompt Template",
147
148
  description: "Define a reusable prompt template with variables",
148
149
  actions: /* @__PURE__ */ S("div", {
149
150
  className: "flex gap-2",
150
- children: [/* @__PURE__ */ x(a, {
151
+ children: [/* @__PURE__ */ x(o, {
151
152
  variant: "outline",
152
153
  onClick: () => N("prompt-templates"),
153
154
  children: "Cancel"
154
- }), /* @__PURE__ */ x(a, {
155
+ }), /* @__PURE__ */ x(o, {
155
156
  leftIcon: /* @__PURE__ */ x(D, { size: 16 }),
156
- onClick: Me,
157
- isLoading: Ce,
157
+ onClick: Ne,
158
+ isLoading: we,
158
159
  disabled: !q.name || !q.slug,
159
160
  children: "Create Template"
160
161
  })]
@@ -164,15 +165,15 @@ var j = [
164
165
  children: [/* @__PURE__ */ S("div", {
165
166
  className: "lg:col-span-2 space-y-6",
166
167
  children: [
167
- /* @__PURE__ */ S(o, { children: [/* @__PURE__ */ x(l, { children: /* @__PURE__ */ x(u, { children: "Basic Information" }) }), /* @__PURE__ */ S(s, {
168
+ /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ x(u, { children: /* @__PURE__ */ x(d, { children: "Basic Information" }) }), /* @__PURE__ */ S(c, {
168
169
  className: "space-y-4",
169
170
  children: [
170
171
  /* @__PURE__ */ S("div", {
171
172
  className: "grid grid-cols-2 gap-4",
172
- children: [/* @__PURE__ */ x(m, {
173
+ children: [/* @__PURE__ */ x(h, {
173
174
  label: "Template Name",
174
175
  required: !0,
175
- children: /* @__PURE__ */ x(h, {
176
+ children: /* @__PURE__ */ x(g, {
176
177
  placeholder: "e.g., Technical Support Template",
177
178
  value: q.name,
178
179
  onChange: (e) => J({
@@ -180,11 +181,11 @@ var j = [
180
181
  name: e.target.value
181
182
  })
182
183
  })
183
- }), /* @__PURE__ */ x(m, {
184
+ }), /* @__PURE__ */ x(h, {
184
185
  label: "Slug",
185
186
  required: !0,
186
187
  description: "Unique identifier (lowercase, dashes)",
187
- children: /* @__PURE__ */ x(h, {
188
+ children: /* @__PURE__ */ x(g, {
188
189
  placeholder: "e.g., technical-support",
189
190
  value: q.slug,
190
191
  onChange: (e) => J({
@@ -194,9 +195,9 @@ var j = [
194
195
  })
195
196
  })]
196
197
  }),
197
- /* @__PURE__ */ x(m, {
198
+ /* @__PURE__ */ x(h, {
198
199
  label: "Description",
199
- children: /* @__PURE__ */ x(g, {
200
+ children: /* @__PURE__ */ x(_, {
200
201
  placeholder: "What is this template used for?",
201
202
  value: q.description,
202
203
  onChange: (e) => J({
@@ -206,7 +207,7 @@ var j = [
206
207
  rows: 2
207
208
  })
208
209
  }),
209
- /* @__PURE__ */ x(m, {
210
+ /* @__PURE__ */ x(h, {
210
211
  label: "Visibility",
211
212
  children: /* @__PURE__ */ S("select", {
212
213
  className: "flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm",
@@ -233,14 +234,14 @@ var j = [
233
234
  })
234
235
  ]
235
236
  })] }),
236
- /* @__PURE__ */ S(o, { children: [/* @__PURE__ */ S(l, { children: [/* @__PURE__ */ S(u, {
237
+ /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ S(u, { children: [/* @__PURE__ */ S(d, {
237
238
  className: "flex items-center gap-2",
238
239
  children: [/* @__PURE__ */ x(C, { size: 18 }), "Template Content"]
239
- }), /* @__PURE__ */ S(c, { children: [
240
+ }), /* @__PURE__ */ S(l, { children: [
240
241
  "Use ",
241
242
  "{{variable_name}}",
242
243
  " syntax for variables"
243
- ] })] }), /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ x(g, {
244
+ ] })] }), /* @__PURE__ */ S(c, { children: [/* @__PURE__ */ x(_, {
244
245
  className: "font-mono text-sm min-h-[300px]",
245
246
  placeholder: "You are a helpful assistant for {{company_name}}.\n\nYour role is to help users with {{task_type}}.\n\nGuidelines:\n- Be helpful and friendly\n- Provide accurate information\n- Reference: {{docs_url}}",
246
247
  value: q.templateText,
@@ -253,54 +254,54 @@ var j = [
253
254
  children: [/* @__PURE__ */ x("span", {
254
255
  className: "text-sm text-text-secondary",
255
256
  children: "Detected variables:"
256
- }), Y.map((e) => /* @__PURE__ */ x(d, {
257
+ }), Y.map((e) => /* @__PURE__ */ x(f, {
257
258
  variant: "secondary",
258
259
  className: "font-mono",
259
260
  children: e
260
261
  }, e))]
261
262
  })] })] }),
262
- /* @__PURE__ */ S(o, { children: [/* @__PURE__ */ S(l, { children: [/* @__PURE__ */ S(u, {
263
+ /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ S(u, { children: [/* @__PURE__ */ S(d, {
263
264
  className: "flex items-center justify-between",
264
265
  children: [/* @__PURE__ */ S("span", {
265
266
  className: "flex items-center gap-2",
266
267
  children: [/* @__PURE__ */ x(k, { size: 18 }), "Variables"]
267
- }), /* @__PURE__ */ x(a, {
268
+ }), /* @__PURE__ */ x(o, {
268
269
  variant: "outline",
269
270
  size: "sm",
270
- onClick: Ne,
271
+ onClick: Pe,
271
272
  children: "Add Variable"
272
273
  })]
273
- }), /* @__PURE__ */ x(c, { children: "Define the variables used in your template" })] }), /* @__PURE__ */ x(s, { children: q.variables.length > 0 ? /* @__PURE__ */ x("div", {
274
+ }), /* @__PURE__ */ x(l, { children: "Define the variables used in your template" })] }), /* @__PURE__ */ x(c, { children: q.variables.length > 0 ? /* @__PURE__ */ x("div", {
274
275
  className: "space-y-4",
275
276
  children: q.variables.map((e, t) => /* @__PURE__ */ S("div", {
276
277
  className: "p-4 border rounded-lg bg-bg-sunken/30 space-y-3",
277
278
  children: [/* @__PURE__ */ S("div", {
278
279
  className: "grid grid-cols-4 gap-3",
279
280
  children: [
280
- /* @__PURE__ */ x(m, {
281
+ /* @__PURE__ */ x(h, {
281
282
  label: "Name",
282
- children: /* @__PURE__ */ x(h, {
283
+ children: /* @__PURE__ */ x(g, {
283
284
  className: "font-mono",
284
285
  placeholder: "variable_name",
285
286
  value: e.name,
286
287
  onChange: (e) => X(t, { name: e.target.value })
287
288
  })
288
289
  }),
289
- /* @__PURE__ */ x(m, {
290
+ /* @__PURE__ */ x(h, {
290
291
  label: "Type",
291
292
  children: /* @__PURE__ */ x("select", {
292
293
  className: "flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm",
293
294
  value: e.type,
294
- onChange: (e) => X(t, { type: _(e.target.value, j, "string") }),
295
+ onChange: (e) => X(t, { type: v(e.target.value, j, "string") }),
295
296
  children: j.map((e) => /* @__PURE__ */ x("option", {
296
297
  value: e,
297
298
  children: e
298
299
  }, e))
299
300
  })
300
301
  }),
301
- /* @__PURE__ */ x(m, {
302
+ /* @__PURE__ */ x(h, {
302
303
  label: "Default Value",
303
- children: /* @__PURE__ */ x(h, {
304
+ children: /* @__PURE__ */ x(g, {
304
305
  placeholder: "Optional",
305
306
  value: String(e.defaultValue || ""),
306
307
  onChange: (e) => X(t, { defaultValue: e.target.value || void 0 })
@@ -319,18 +320,18 @@ var j = [
319
320
  className: "text-sm",
320
321
  children: "Required"
321
322
  })]
322
- }), /* @__PURE__ */ x(a, {
323
+ }), /* @__PURE__ */ x(o, {
323
324
  variant: "ghost",
324
325
  size: "sm",
325
326
  className: "text-status-error-text",
326
- onClick: () => Pe(t),
327
+ onClick: () => Fe(t),
327
328
  children: "Remove"
328
329
  })]
329
330
  })
330
331
  ]
331
- }), /* @__PURE__ */ x(m, {
332
+ }), /* @__PURE__ */ x(h, {
332
333
  label: "Description",
333
- children: /* @__PURE__ */ x(h, {
334
+ children: /* @__PURE__ */ x(g, {
334
335
  placeholder: "What is this variable for?",
335
336
  value: e.description || "",
336
337
  onChange: (e) => X(t, { description: e.target.value })
@@ -355,13 +356,13 @@ var j = [
355
356
  ]
356
357
  }), /* @__PURE__ */ S("div", {
357
358
  className: "space-y-6",
358
- children: [/* @__PURE__ */ S(o, { children: [/* @__PURE__ */ x(l, { children: /* @__PURE__ */ S(u, {
359
+ children: [/* @__PURE__ */ S(s, { children: [/* @__PURE__ */ x(u, { children: /* @__PURE__ */ S(d, {
359
360
  className: "flex items-center gap-2",
360
361
  children: [/* @__PURE__ */ x(w, { size: 18 }), "Preview"]
361
- }) }), /* @__PURE__ */ x(s, { children: /* @__PURE__ */ x("div", {
362
+ }) }), /* @__PURE__ */ x(c, { children: /* @__PURE__ */ x("div", {
362
363
  className: "p-4 bg-bg-sunken rounded-lg text-sm whitespace-pre-wrap font-mono",
363
364
  dangerouslySetInnerHTML: { __html: Z(q.templateText || "Enter template text...") }
364
- }) })] }), /* @__PURE__ */ S(o, { children: [/* @__PURE__ */ x(l, { children: /* @__PURE__ */ x(u, { children: "Quick Tips" }) }), /* @__PURE__ */ S(s, {
365
+ }) })] }), /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ x(u, { children: /* @__PURE__ */ x(d, { children: "Quick Tips" }) }), /* @__PURE__ */ S(c, {
365
366
  className: "text-sm space-y-2",
366
367
  children: [
367
368
  /* @__PURE__ */ S("p", { children: [
@@ -385,32 +386,32 @@ var j = [
385
386
  })]
386
387
  })
387
388
  });
388
- if (xe) return /* @__PURE__ */ x(i, {
389
+ if (Se) return /* @__PURE__ */ x(a, {
389
390
  title: "Loading...",
390
391
  children: /* @__PURE__ */ x("div", { className: "h-96 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg" })
391
392
  });
392
- if (!P) return /* @__PURE__ */ x(i, {
393
+ if (!P) return /* @__PURE__ */ x(a, {
393
394
  title: "Template Not Found",
394
395
  children: /* @__PURE__ */ x(ie, {
395
396
  illustration: "empty-files",
396
397
  title: "Template Not Found",
397
398
  description: "This prompt template doesn't exist.",
398
- action: /* @__PURE__ */ x(a, {
399
+ action: /* @__PURE__ */ x(o, {
399
400
  onClick: () => N("prompt-templates"),
400
401
  children: "Back to Templates"
401
402
  })
402
403
  })
403
404
  });
404
- let Q = ae(P), $ = v(P);
405
- return /* @__PURE__ */ x(i, {
405
+ let Q = oe(P), $ = ae(P);
406
+ return /* @__PURE__ */ x(a, {
406
407
  title: /* @__PURE__ */ S("div", {
407
408
  className: "flex items-center gap-3",
408
409
  children: [
409
- /* @__PURE__ */ x(a, {
410
+ /* @__PURE__ */ x(o, {
410
411
  variant: "ghost",
411
412
  size: "icon",
412
413
  onClick: () => N("prompt-templates"),
413
- children: /* @__PURE__ */ x(me, { size: 20 })
414
+ children: /* @__PURE__ */ x(he, { size: 20 })
414
415
  }),
415
416
  /* @__PURE__ */ x("div", {
416
417
  className: "p-2 rounded-lg bg-action-primary-bg/10",
@@ -421,7 +422,7 @@ var j = [
421
422
  children: [
422
423
  /* @__PURE__ */ x("span", { children: P.name }),
423
424
  /* @__PURE__ */ x(ee, { status: P.status }),
424
- /* @__PURE__ */ S(d, {
425
+ /* @__PURE__ */ S(f, {
425
426
  variant: "secondary",
426
427
  className: "font-mono",
427
428
  children: ["v", P.version]
@@ -439,44 +440,44 @@ var j = [
439
440
  }),
440
441
  actions: /* @__PURE__ */ S("div", {
441
442
  className: "flex gap-2",
442
- children: [/* @__PURE__ */ x(a, {
443
+ children: [/* @__PURE__ */ x(o, {
443
444
  variant: "outline",
444
- leftIcon: x(L ? he : ge, { size: 16 }),
445
- onClick: Ie,
445
+ leftIcon: x(L ? ge : _e, { size: 16 }),
446
+ onClick: Le,
446
447
  children: L ? "Copied!" : "Copy"
447
- }), W ? /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(a, {
448
+ }), W ? /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(o, {
448
449
  variant: "outline",
449
450
  onClick: () => G(!1),
450
451
  children: "Cancel"
451
- }), /* @__PURE__ */ x(a, {
452
+ }), /* @__PURE__ */ x(o, {
452
453
  leftIcon: /* @__PURE__ */ x(D, { size: 16 }),
453
- onClick: Re,
454
- isLoading: Te,
454
+ onClick: ze,
455
+ isLoading: Ee,
455
456
  disabled: !q.name || !q.slug,
456
457
  children: "Save Changes"
457
- })] }) : je ? /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(a, {
458
+ })] }) : Me ? /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(o, {
458
459
  variant: "outline",
459
460
  onClick: () => K(!1),
460
461
  children: "Cancel"
461
- }), /* @__PURE__ */ x(a, {
462
+ }), /* @__PURE__ */ x(o, {
462
463
  variant: "destructive",
463
464
  leftIcon: /* @__PURE__ */ x(O, { size: 16 }),
464
465
  onClick: () => {
465
- ne("medium"), ze();
466
+ ne("medium"), Be();
466
467
  },
467
- isLoading: De,
468
+ isLoading: Oe,
468
469
  children: "Confirm Delete"
469
- })] }) : /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(r, {
470
- permission: n.PROMPT_TEMPLATE_UPDATE,
471
- children: /* @__PURE__ */ x(a, {
470
+ })] }) : /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(i, {
471
+ permission: r.PROMPT_TEMPLATE_UPDATE,
472
+ children: /* @__PURE__ */ x(o, {
472
473
  variant: "outline",
473
- leftIcon: /* @__PURE__ */ x(_e, { size: 16 }),
474
- onClick: Le,
474
+ leftIcon: /* @__PURE__ */ x(ve, { size: 16 }),
475
+ onClick: Re,
475
476
  children: "Edit Template"
476
477
  })
477
- }), /* @__PURE__ */ x(r, {
478
- permission: n.PROMPT_TEMPLATE_DELETE,
479
- children: /* @__PURE__ */ x(a, {
478
+ }), /* @__PURE__ */ x(i, {
479
+ permission: r.PROMPT_TEMPLATE_DELETE,
480
+ children: /* @__PURE__ */ x(o, {
480
481
  variant: "outline",
481
482
  leftIcon: /* @__PURE__ */ x(O, { size: 16 }),
482
483
  onClick: () => K(!0),
@@ -487,7 +488,7 @@ var j = [
487
488
  children: /* @__PURE__ */ S("div", {
488
489
  className: "space-y-6",
489
490
  children: [
490
- /* @__PURE__ */ S(fe, {
491
+ /* @__PURE__ */ S(pe, {
491
492
  icon: /* @__PURE__ */ x(T, { size: 18 }),
492
493
  children: [
493
494
  "This is a single reusable prompt template — its content with",
@@ -496,15 +497,15 @@ var j = [
496
497
  ", its declared variables and example inputs, and its version history. Edit and preview it here to perfect the instructions, then reuse it across agents so they share consistent, version-controlled behaviour."
497
498
  ]
498
499
  }),
499
- W && /* @__PURE__ */ S(o, { children: [/* @__PURE__ */ S(l, { children: [/* @__PURE__ */ x(u, { children: "Edit Template" }), /* @__PURE__ */ x(c, { children: "Update template details and content" })] }), /* @__PURE__ */ S(s, {
500
+ W && /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ S(u, { children: [/* @__PURE__ */ x(d, { children: "Edit Template" }), /* @__PURE__ */ x(l, { children: "Update template details and content" })] }), /* @__PURE__ */ S(c, {
500
501
  className: "space-y-4",
501
502
  children: [
502
503
  /* @__PURE__ */ S("div", {
503
504
  className: "grid grid-cols-2 gap-4",
504
- children: [/* @__PURE__ */ x(m, {
505
+ children: [/* @__PURE__ */ x(h, {
505
506
  label: "Template Name",
506
507
  required: !0,
507
- children: /* @__PURE__ */ x(h, {
508
+ children: /* @__PURE__ */ x(g, {
508
509
  placeholder: "e.g., Technical Support Template",
509
510
  value: q.name,
510
511
  onChange: (e) => J({
@@ -512,11 +513,11 @@ var j = [
512
513
  name: e.target.value
513
514
  })
514
515
  })
515
- }), /* @__PURE__ */ x(m, {
516
+ }), /* @__PURE__ */ x(h, {
516
517
  label: "Slug",
517
518
  required: !0,
518
519
  description: "Unique identifier (lowercase, dashes)",
519
- children: /* @__PURE__ */ x(h, {
520
+ children: /* @__PURE__ */ x(g, {
520
521
  placeholder: "e.g., technical-support",
521
522
  value: q.slug,
522
523
  onChange: (e) => J({
@@ -526,9 +527,9 @@ var j = [
526
527
  })
527
528
  })]
528
529
  }),
529
- /* @__PURE__ */ x(m, {
530
+ /* @__PURE__ */ x(h, {
530
531
  label: "Description",
531
- children: /* @__PURE__ */ x(g, {
532
+ children: /* @__PURE__ */ x(_, {
532
533
  placeholder: "What is this template used for?",
533
534
  value: q.description,
534
535
  onChange: (e) => J({
@@ -538,7 +539,7 @@ var j = [
538
539
  rows: 2
539
540
  })
540
541
  }),
541
- /* @__PURE__ */ x(m, {
542
+ /* @__PURE__ */ x(h, {
542
543
  label: "Visibility",
543
544
  children: /* @__PURE__ */ S("select", {
544
545
  className: "flex h-10 w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm",
@@ -563,10 +564,10 @@ var j = [
563
564
  ]
564
565
  })
565
566
  }),
566
- /* @__PURE__ */ x(m, {
567
+ /* @__PURE__ */ x(h, {
567
568
  label: "Template Content",
568
569
  description: "Use {{variable_name}} syntax for variables",
569
- children: /* @__PURE__ */ x(g, {
570
+ children: /* @__PURE__ */ x(_, {
570
571
  className: "font-mono text-sm min-h-[200px]",
571
572
  value: q.templateText,
572
573
  onChange: (e) => J({
@@ -580,7 +581,7 @@ var j = [
580
581
  children: [/* @__PURE__ */ x("span", {
581
582
  className: "text-sm text-text-secondary",
582
583
  children: "Detected variables:"
583
- }), Y.map((e) => /* @__PURE__ */ x(d, {
584
+ }), Y.map((e) => /* @__PURE__ */ x(f, {
584
585
  variant: "secondary",
585
586
  className: "font-mono",
586
587
  children: e
@@ -591,10 +592,10 @@ var j = [
591
592
  /* @__PURE__ */ S("div", {
592
593
  className: "grid grid-cols-2 md:grid-cols-4 gap-4",
593
594
  children: [
594
- /* @__PURE__ */ x(o, {
595
+ /* @__PURE__ */ x(s, {
595
596
  treatment: "glass",
596
597
  glow: !0,
597
- children: /* @__PURE__ */ S(s, {
598
+ children: /* @__PURE__ */ S(c, {
598
599
  className: "pt-6 text-center",
599
600
  children: [/* @__PURE__ */ x("p", {
600
601
  className: "text-3xl font-bold text-text-primary",
@@ -605,7 +606,7 @@ var j = [
605
606
  })]
606
607
  })
607
608
  }),
608
- /* @__PURE__ */ x(o, { children: /* @__PURE__ */ S(s, {
609
+ /* @__PURE__ */ x(s, { children: /* @__PURE__ */ S(c, {
609
610
  className: "pt-6 text-center",
610
611
  children: [/* @__PURE__ */ x("p", {
611
612
  className: "text-3xl font-bold text-text-primary",
@@ -615,7 +616,7 @@ var j = [
615
616
  children: "Examples"
616
617
  })]
617
618
  }) }),
618
- /* @__PURE__ */ x(o, { children: /* @__PURE__ */ S(s, {
619
+ /* @__PURE__ */ x(s, { children: /* @__PURE__ */ S(c, {
619
620
  className: "pt-6 text-center",
620
621
  children: [/* @__PURE__ */ x("p", {
621
622
  className: "text-3xl font-bold text-text-primary",
@@ -625,7 +626,7 @@ var j = [
625
626
  children: "Revision"
626
627
  })]
627
628
  }) }),
628
- /* @__PURE__ */ x(o, { children: /* @__PURE__ */ S(s, {
629
+ /* @__PURE__ */ x(s, { children: /* @__PURE__ */ S(c, {
629
630
  className: "pt-6 text-center",
630
631
  children: [/* @__PURE__ */ x("p", {
631
632
  className: "text-lg font-bold text-text-primary capitalize",
@@ -640,17 +641,17 @@ var j = [
640
641
  /* @__PURE__ */ S("div", {
641
642
  className: "flex gap-2 border-b",
642
643
  children: [
643
- /* @__PURE__ */ S(a, {
644
+ /* @__PURE__ */ S(o, {
644
645
  variant: F === "edit" ? "default" : "ghost",
645
646
  onClick: () => I("edit"),
646
647
  children: [/* @__PURE__ */ x(C, { className: "h-4 w-4 mr-2" }), "Template"]
647
648
  }),
648
- /* @__PURE__ */ S(a, {
649
+ /* @__PURE__ */ S(o, {
649
650
  variant: F === "preview" ? "default" : "ghost",
650
651
  onClick: () => I("preview"),
651
652
  children: [/* @__PURE__ */ x(w, { className: "h-4 w-4 mr-2" }), "Preview"]
652
653
  }),
653
- /* @__PURE__ */ S(a, {
654
+ /* @__PURE__ */ S(o, {
654
655
  variant: F === "test" ? "default" : "ghost",
655
656
  onClick: () => I("test"),
656
657
  children: [/* @__PURE__ */ x(E, { className: "h-4 w-4 mr-2" }), "Test"]
@@ -661,11 +662,11 @@ var j = [
661
662
  className: "grid grid-cols-1 lg:grid-cols-3 gap-6",
662
663
  children: [/* @__PURE__ */ x("div", {
663
664
  className: "lg:col-span-2",
664
- children: /* @__PURE__ */ S(o, { children: [/* @__PURE__ */ x(l, { children: /* @__PURE__ */ x(u, { children: "Template Content" }) }), /* @__PURE__ */ x(s, { children: /* @__PURE__ */ x("div", {
665
+ children: /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ x(u, { children: /* @__PURE__ */ x(d, { children: "Template Content" }) }), /* @__PURE__ */ x(c, { children: /* @__PURE__ */ x("div", {
665
666
  className: "p-4 bg-bg-sunken rounded-lg font-mono text-sm whitespace-pre-wrap",
666
667
  children: /* @__PURE__ */ x("div", { dangerouslySetInnerHTML: { __html: Z(P.templateText) } })
667
668
  }) })] })
668
- }), /* @__PURE__ */ x("div", { children: /* @__PURE__ */ S(o, { children: [/* @__PURE__ */ x(l, { children: /* @__PURE__ */ S(u, {
669
+ }), /* @__PURE__ */ x("div", { children: /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ x(u, { children: /* @__PURE__ */ S(d, {
669
670
  className: "flex items-center gap-2",
670
671
  children: [
671
672
  /* @__PURE__ */ x(k, { size: 18 }),
@@ -673,7 +674,7 @@ var j = [
673
674
  Q.length,
674
675
  ")"
675
676
  ]
676
- }) }), /* @__PURE__ */ x(s, { children: Q.length > 0 ? /* @__PURE__ */ x("div", {
677
+ }) }), /* @__PURE__ */ x(c, { children: Q.length > 0 ? /* @__PURE__ */ x("div", {
677
678
  className: "space-y-3",
678
679
  children: Q.map((e, t) => /* @__PURE__ */ S("div", {
679
680
  className: "p-3 border rounded-lg",
@@ -685,11 +686,11 @@ var j = [
685
686
  children: e.name
686
687
  }), /* @__PURE__ */ S("div", {
687
688
  className: "flex gap-1",
688
- children: [/* @__PURE__ */ x(d, {
689
+ children: [/* @__PURE__ */ x(f, {
689
690
  variant: "outline",
690
691
  className: "text-xs",
691
692
  children: e.type
692
- }), e.required && /* @__PURE__ */ x(d, {
693
+ }), e.required && /* @__PURE__ */ x(f, {
693
694
  variant: "destructive",
694
695
  className: "text-xs",
695
696
  children: "required"
@@ -718,7 +719,7 @@ var j = [
718
719
  children: "No variables defined"
719
720
  }) })] }) })]
720
721
  }),
721
- F === "preview" && /* @__PURE__ */ S(o, { children: [/* @__PURE__ */ S(l, { children: [/* @__PURE__ */ x(u, { children: "Rendered Preview" }), /* @__PURE__ */ x(c, { children: "Preview with example inputs (first example set)" })] }), /* @__PURE__ */ x(s, { children: /* @__PURE__ */ x("div", {
722
+ F === "preview" && /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ S(u, { children: [/* @__PURE__ */ x(d, { children: "Rendered Preview" }), /* @__PURE__ */ x(l, { children: "Preview with example inputs (first example set)" })] }), /* @__PURE__ */ x(c, { children: /* @__PURE__ */ x("div", {
722
723
  className: "p-4 bg-bg-sunken rounded-lg font-mono text-sm whitespace-pre-wrap",
723
724
  children: $[0] ? P.templateText.replace(/\{\{(\w+)\}\}/g, (e, t) => {
724
725
  let n = $[0][t];
@@ -730,15 +731,15 @@ var j = [
730
731
  }) })] }),
731
732
  F === "test" && /* @__PURE__ */ S("div", {
732
733
  className: "grid grid-cols-1 lg:grid-cols-2 gap-6",
733
- children: [/* @__PURE__ */ S(o, { children: [/* @__PURE__ */ S(l, { children: [/* @__PURE__ */ x(u, { children: "Test Inputs" }), /* @__PURE__ */ x(c, { children: "Enter values to test the template" })] }), /* @__PURE__ */ S(s, {
734
+ children: [/* @__PURE__ */ S(s, { children: [/* @__PURE__ */ S(u, { children: [/* @__PURE__ */ x(d, { children: "Test Inputs" }), /* @__PURE__ */ x(l, { children: "Enter values to test the template" })] }), /* @__PURE__ */ S(c, {
734
735
  className: "space-y-4",
735
- children: [Q.map((e) => /* @__PURE__ */ S(m, {
736
+ children: [Q.map((e) => /* @__PURE__ */ S(h, {
736
737
  label: e.name,
737
738
  required: e.required,
738
- children: [/* @__PURE__ */ x(h, {
739
+ children: [/* @__PURE__ */ x(g, {
739
740
  placeholder: e.defaultValue ? String(e.defaultValue) : `Enter ${e.name}`,
740
741
  value: z[e.name] || "",
741
- onChange: (t) => Ae({
742
+ onChange: (t) => je({
742
743
  ...z,
743
744
  [e.name]: t.target.value
744
745
  })
@@ -746,17 +747,17 @@ var j = [
746
747
  className: "text-xs text-text-secondary mt-1",
747
748
  children: e.description
748
749
  })]
749
- }, e.name)), /* @__PURE__ */ x(r, {
750
- permission: n.PROMPT_TEMPLATE_EXECUTE,
751
- children: /* @__PURE__ */ x(a, {
750
+ }, e.name)), /* @__PURE__ */ x(i, {
751
+ permission: r.PROMPT_TEMPLATE_EXECUTE,
752
+ children: /* @__PURE__ */ x(o, {
752
753
  className: "w-full",
753
754
  leftIcon: /* @__PURE__ */ x(E, { size: 16 }),
754
- onClick: Fe,
755
- isLoading: ke,
755
+ onClick: Ie,
756
+ isLoading: Ae,
756
757
  children: "Render Template"
757
758
  })
758
759
  })]
759
- })] }), /* @__PURE__ */ S(o, { children: [/* @__PURE__ */ x(l, { children: /* @__PURE__ */ x(u, { children: "Output" }) }), /* @__PURE__ */ x(s, { children: H ? /* @__PURE__ */ x("div", {
760
+ })] }), /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ x(u, { children: /* @__PURE__ */ x(d, { children: "Output" }) }), /* @__PURE__ */ x(c, { children: H ? /* @__PURE__ */ x("div", {
760
761
  role: "alert",
761
762
  className: "flex items-start gap-2 rounded-lg border border-status-error-border/40 bg-status-error-bg/10 px-3 py-2 text-sm text-status-error-text",
762
763
  children: /* @__PURE__ */ x("p", { children: H })
@@ -768,7 +769,7 @@ var j = [
768
769
  children: [/* @__PURE__ */ x(E, { className: "h-8 w-8 mx-auto mb-2 opacity-50" }), /* @__PURE__ */ x("p", { children: "Enter inputs and click \"Render Template\" to see output" })]
769
770
  }) })] })]
770
771
  }),
771
- $.length > 0 && F === "edit" && /* @__PURE__ */ S(o, { children: [/* @__PURE__ */ S(l, { children: [/* @__PURE__ */ x(u, { children: "Example Inputs" }), /* @__PURE__ */ x(c, { children: "Pre-defined inputs for testing and documentation" })] }), /* @__PURE__ */ x(s, { children: /* @__PURE__ */ x("div", {
772
+ $.length > 0 && F === "edit" && /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ S(u, { children: [/* @__PURE__ */ x(d, { children: "Example Inputs" }), /* @__PURE__ */ x(l, { children: "Pre-defined inputs for testing and documentation" })] }), /* @__PURE__ */ x(c, { children: /* @__PURE__ */ x("div", {
772
773
  className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",
773
774
  children: $.map((e, t) => /* @__PURE__ */ S("div", {
774
775
  className: "p-4 border rounded-lg bg-bg-sunken/30",
@@ -790,10 +791,10 @@ var j = [
790
791
  })]
791
792
  }, t))
792
793
  }) })] }),
793
- /* @__PURE__ */ S(o, { children: [/* @__PURE__ */ x(l, { children: /* @__PURE__ */ S(u, {
794
+ /* @__PURE__ */ S(s, { children: [/* @__PURE__ */ x(u, { children: /* @__PURE__ */ S(d, {
794
795
  className: "flex items-center gap-2",
795
- children: [/* @__PURE__ */ x(ve, { size: 18 }), "Metadata"]
796
- }) }), /* @__PURE__ */ x(s, { children: /* @__PURE__ */ S("div", {
796
+ children: [/* @__PURE__ */ x(ye, { size: 18 }), "Metadata"]
797
+ }) }), /* @__PURE__ */ x(c, { children: /* @__PURE__ */ S("div", {
797
798
  className: "grid grid-cols-2 md:grid-cols-4 gap-6 text-sm",
798
799
  children: [
799
800
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
@@ -801,21 +802,21 @@ var j = [
801
802
  children: "Created"
802
803
  }), /* @__PURE__ */ x("p", {
803
804
  className: "font-medium",
804
- children: t(P.createdAt)
805
+ children: n(P.createdAt)
805
806
  })] }),
806
807
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
807
808
  className: "text-text-secondary",
808
809
  children: "Updated"
809
810
  }), /* @__PURE__ */ x("p", {
810
811
  className: "font-medium",
811
- children: t(P.updatedAt)
812
+ children: n(P.updatedAt)
812
813
  })] }),
813
814
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
814
815
  className: "text-text-secondary",
815
816
  children: "Tags"
816
817
  }), /* @__PURE__ */ x("div", {
817
818
  className: "flex gap-1",
818
- children: P.tags.length > 0 ? P.tags.map((e) => /* @__PURE__ */ x(d, {
819
+ children: P.tags.length > 0 ? P.tags.map((e) => /* @__PURE__ */ x(f, {
819
820
  variant: "secondary",
820
821
  className: "text-xs",
821
822
  children: e