camox 0.72.0 → 0.74.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/features/preview/components/PageInfo.js +121 -98
  2. package/dist/features/preview/components/SelectionEditor.js +1 -1
  3. package/dist/features/routes/pageRuntime.js +15 -4
  4. package/dist/features/runtime/ClaimCard.js +192 -0
  5. package/dist/features/runtime/pageApp.js +4 -3
  6. package/dist/features/runtime/runtime.js +26 -5
  7. package/dist/features/runtime/worker.js +2 -2
  8. package/dist/features/runtime/workerRequest.d.ts +6 -0
  9. package/dist/features/runtime/workerRequest.js +13 -1
  10. package/dist/features/runtime/workerRuntime.d.ts +2 -2
  11. package/dist/features/runtime/workerRuntime.js +2 -2
  12. package/dist/features/studio/components/AgentSidebar.js +7 -7
  13. package/dist/features/studio/components/ChatWidget.js +142 -106
  14. package/dist/features/studio/components/ContentFindings.js +127 -230
  15. package/dist/features/studio/components/DeleteDraftDialog.js +112 -0
  16. package/dist/features/studio/components/DraftBar.js +98 -53
  17. package/dist/features/studio/components/DraftsControl.js +203 -190
  18. package/dist/features/studio/components/ReviewDraftDialog.js +670 -0
  19. package/dist/features/studio/components/{Patrol.js → Specialists.js} +291 -330
  20. package/dist/features/studio/components/Squareling.js +5 -5
  21. package/dist/features/studio/components/ThreadComposer.js +106 -127
  22. package/dist/features/studio/components/ThreadMessages.js +94 -69
  23. package/dist/features/studio/findingSentence.js +14 -12
  24. package/dist/features/studio/fixMessage.js +23 -0
  25. package/dist/features/studio/reportSentence.js +1 -1
  26. package/dist/features/studio/{patrollerBio.js → specialistBio.js} +8 -5
  27. package/dist/features/studio/studioStore.js +29 -15
  28. package/dist/features/studio/workingSentence.js +1 -1
  29. package/dist/lib/api-client.js +5 -1
  30. package/dist/lib/queries.js +5 -5
  31. package/dist/lib/studio-reads.d.ts +1 -1
  32. package/dist/lib/studio-reads.js +5 -5
  33. package/dist/package.js +1 -1
  34. package/dist/studio.css +1 -1
  35. package/package.json +4 -4
  36. package/dist/features/studio/components/ReviewDraftSheet.js +0 -1587
@@ -1,11 +1,9 @@
1
- import { useCurrentDraftId } from "../../../lib/draft-scope.js";
2
1
  import { useViewLocale } from "../../../lib/view-locale-context.js";
3
2
  import { AuthContext } from "../../../lib/auth.js";
4
3
  import { reads, useReadQuery } from "../../../lib/studio-reads.js";
5
- import { patrolMutations } from "../../../lib/queries.js";
4
+ import { specialistMutations } from "../../../lib/queries.js";
6
5
  import { studioStore } from "../studioStore.js";
7
- import { askAgentMessage, dismissLabel, findingSentenceInPlace, fixLabel } from "../findingSentence.js";
8
- import { useShowInCanvas } from "../showInCanvas.js";
6
+ import { dismissLabel, findingSentenceInPlace, fixWithAgentMessage } from "../findingSentence.js";
9
7
  import { c } from "react/compiler-runtime";
10
8
  import * as React from "react";
11
9
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -16,9 +14,9 @@ import { toast } from "@camox/ui/toaster";
16
14
  import { Alert, AlertDescription, AlertTitle } from "@camox/ui/alert";
17
15
 
18
16
  //#region src/features/studio/components/ContentFindings.tsx
19
- /** The open findings of the Patrol viewed in a subject, in the locale viewed. */
17
+ /** The open findings of the Specialists viewed in a subject, in the locale viewed. */
20
18
  function useContentFindings(subject) {
21
- const $ = c(22);
19
+ const $ = c(21);
22
20
  const { projectUuid } = React.useContext(AuthContext);
23
21
  let t0;
24
22
  if ($[0] !== projectUuid) {
@@ -29,7 +27,7 @@ function useContentFindings(subject) {
29
27
  const { data: project } = useReadQuery(t0);
30
28
  let t1;
31
29
  if ($[2] !== project?.id) {
32
- t1 = reads.patrol({ projectId: project?.id ?? 0 });
30
+ t1 = reads.specialists({ projectId: project?.id ?? 0 });
33
31
  $[2] = project?.id;
34
32
  $[3] = t1;
35
33
  } else t1 = $[3];
@@ -66,32 +64,29 @@ function useContentFindings(subject) {
66
64
  } else t7 = $[13];
67
65
  const tag = t7;
68
66
  let t8;
69
- if ($[14] !== subject || $[15] !== tag || $[16] !== view?.patrollers) {
70
- t8 = subject === null ? [] : (view?.patrollers ?? []).flatMap((patroller) => patroller.findings.filter((finding) => finding.subject.entity === subject.entity && finding.subject.id === subject.id && finding.locale === tag).map((finding_0) => ({
67
+ if ($[14] !== subject || $[15] !== tag || $[16] !== view?.specialists) {
68
+ t8 = subject === null ? [] : (view?.specialists ?? []).flatMap((specialist) => specialist.findings.filter((finding) => finding.subject.entity === subject.entity && finding.subject.id === subject.id && finding.locale === tag).map((finding_0) => ({
71
69
  ...finding_0,
72
- role: patroller.role
70
+ role: specialist.role
73
71
  })));
74
72
  $[14] = subject;
75
73
  $[15] = tag;
76
- $[16] = view?.patrollers;
74
+ $[16] = view?.specialists;
77
75
  $[17] = t8;
78
76
  } else t8 = $[17];
79
77
  const findings = t8;
80
78
  const t9 = project?.id;
81
- const t10 = view?.patrolDraft ?? null;
82
- let t11;
83
- if ($[18] !== findings || $[19] !== t10 || $[20] !== t9) {
84
- t11 = {
79
+ let t10;
80
+ if ($[18] !== findings || $[19] !== t9) {
81
+ t10 = {
85
82
  projectId: t9,
86
- patrolDraft: t10,
87
83
  findings
88
84
  };
89
85
  $[18] = findings;
90
- $[19] = t10;
91
- $[20] = t9;
92
- $[21] = t11;
93
- } else t11 = $[21];
94
- return t11;
86
+ $[19] = t9;
87
+ $[20] = t10;
88
+ } else t10 = $[20];
89
+ return t10;
95
90
  }
96
91
  function _temp(locale) {
97
92
  return locale.isDefault;
@@ -107,23 +102,23 @@ function findingsHint(view, field) {
107
102
  * editor. Without `field`, those in none of `fields`: about the subject as a whole.
108
103
  */
109
104
  function ContentFindings(t0) {
110
- const $ = c(20);
105
+ const $ = c(18);
111
106
  const { view, field, fields, className } = t0;
112
- const { projectId, patrolDraft, findings } = view;
107
+ const { projectId, findings } = view;
113
108
  let t1;
114
109
  let t2;
115
110
  let t3;
116
111
  let t4;
117
- if ($[0] !== className || $[1] !== field || $[2] !== fields || $[3] !== findings || $[4] !== patrolDraft || $[5] !== projectId) {
112
+ if ($[0] !== className || $[1] !== field || $[2] !== fields || $[3] !== findings || $[4] !== projectId) {
118
113
  t4 = Symbol.for("react.early_return_sentinel");
119
114
  bb0: {
120
115
  let t5;
121
- if ($[10] !== field || $[11] !== fields) {
116
+ if ($[9] !== field || $[10] !== fields) {
122
117
  t5 = (finding) => field === void 0 ? !fields.includes(finding.field) : finding.field === field;
123
- $[10] = field;
124
- $[11] = fields;
125
- $[12] = t5;
126
- } else t5 = $[12];
118
+ $[9] = field;
119
+ $[10] = fields;
120
+ $[11] = t5;
121
+ } else t5 = $[11];
127
122
  const shown = findings.filter(t5);
128
123
  if (projectId === void 0 || shown.length === 0) {
129
124
  t4 = null;
@@ -132,265 +127,167 @@ function ContentFindings(t0) {
132
127
  t1 = true;
133
128
  t2 = className ?? "space-y-2 px-2 pb-4";
134
129
  let t6;
135
- if ($[13] !== patrolDraft || $[14] !== projectId) {
130
+ if ($[12] !== projectId) {
136
131
  t6 = (finding_0) => /* @__PURE__ */ jsx(FindingAlert, {
137
132
  projectId,
138
- finding: finding_0,
139
- patrolDraft
133
+ finding: finding_0
140
134
  }, finding_0.id);
141
- $[13] = patrolDraft;
142
- $[14] = projectId;
143
- $[15] = t6;
144
- } else t6 = $[15];
135
+ $[12] = projectId;
136
+ $[13] = t6;
137
+ } else t6 = $[13];
145
138
  t3 = shown.map(t6);
146
139
  }
147
140
  $[0] = className;
148
141
  $[1] = field;
149
142
  $[2] = fields;
150
143
  $[3] = findings;
151
- $[4] = patrolDraft;
152
- $[5] = projectId;
153
- $[6] = t1;
154
- $[7] = t2;
155
- $[8] = t3;
156
- $[9] = t4;
144
+ $[4] = projectId;
145
+ $[5] = t1;
146
+ $[6] = t2;
147
+ $[7] = t3;
148
+ $[8] = t4;
157
149
  } else {
158
- t1 = $[6];
159
- t2 = $[7];
160
- t3 = $[8];
161
- t4 = $[9];
150
+ t1 = $[5];
151
+ t2 = $[6];
152
+ t3 = $[7];
153
+ t4 = $[8];
162
154
  }
163
155
  if (t4 !== Symbol.for("react.early_return_sentinel")) return t4;
164
156
  let t5;
165
- if ($[16] !== t1 || $[17] !== t2 || $[18] !== t3) {
157
+ if ($[14] !== t1 || $[15] !== t2 || $[16] !== t3) {
166
158
  t5 = /* @__PURE__ */ jsx("div", {
167
159
  "data-content-findings": t1,
168
160
  className: t2,
169
161
  children: t3
170
162
  });
171
- $[16] = t1;
172
- $[17] = t2;
173
- $[18] = t3;
174
- $[19] = t5;
175
- } else t5 = $[19];
163
+ $[14] = t1;
164
+ $[15] = t2;
165
+ $[16] = t3;
166
+ $[17] = t5;
167
+ } else t5 = $[17];
176
168
  return t5;
177
169
  }
178
170
  function FindingAlert(t0) {
179
- const $ = c(44);
180
- const { projectId, finding, patrolDraft } = t0;
181
- const draftId = useCurrentDraftId();
171
+ const $ = c(29);
172
+ const { projectId, finding } = t0;
182
173
  let t1;
183
174
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
184
175
  t1 = {
185
- ...patrolMutations.applyFix(),
186
- onSuccess: _temp2,
187
- onError: _temp3
176
+ ...specialistMutations.dismissFinding(),
177
+ onError: _temp2
188
178
  };
189
179
  $[0] = t1;
190
180
  } else t1 = $[0];
191
- const applyFix = useMutation(t1);
181
+ const dismiss = useMutation(t1);
192
182
  let t2;
193
183
  if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
194
- t2 = {
195
- ...patrolMutations.dismissFinding(),
196
- onError: _temp4
197
- };
184
+ t2 = /* @__PURE__ */ jsx(CircleAlert, {});
198
185
  $[1] = t2;
199
186
  } else t2 = $[1];
200
- const dismiss = useMutation(t2);
201
- const busy = applyFix.isPending || dismiss.isPending;
202
- const fixesHere = draftId !== null && (!finding.live || draftId === patrolDraft?.id);
203
187
  let t3;
204
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
205
- t3 = /* @__PURE__ */ jsx(CircleAlert, {});
206
- $[2] = t3;
207
- } else t3 = $[2];
188
+ if ($[2] !== finding) {
189
+ t3 = findingSentenceInPlace(finding);
190
+ $[2] = finding;
191
+ $[3] = t3;
192
+ } else t3 = $[3];
208
193
  let t4;
209
- if ($[3] !== finding) {
210
- t4 = findingSentenceInPlace(finding);
211
- $[3] = finding;
212
- $[4] = t4;
213
- } else t4 = $[4];
214
- let t5;
215
- if ($[5] !== t4) {
216
- t5 = /* @__PURE__ */ jsx(AlertTitle, {
194
+ if ($[4] !== t3) {
195
+ t4 = /* @__PURE__ */ jsx(AlertTitle, {
217
196
  className: "text-xs font-normal",
218
- children: t4
197
+ children: t3
219
198
  });
199
+ $[4] = t3;
220
200
  $[5] = t4;
221
- $[6] = t5;
222
- } else t5 = $[6];
201
+ } else t4 = $[5];
202
+ let t5;
203
+ if ($[6] !== finding.role) {
204
+ t5 = /* @__PURE__ */ jsx("p", { children: finding.role });
205
+ $[6] = finding.role;
206
+ $[7] = t5;
207
+ } else t5 = $[7];
223
208
  let t6;
224
- if ($[7] !== finding.role) {
225
- t6 = /* @__PURE__ */ jsx("p", { children: finding.role });
226
- $[7] = finding.role;
227
- $[8] = t6;
228
- } else t6 = $[8];
229
- let t7;
230
- if ($[9] !== applyFix || $[10] !== busy || $[11] !== finding.fix || $[12] !== finding.id || $[13] !== fixesHere || $[14] !== projectId) {
231
- t7 = fixesHere && finding.fix && /* @__PURE__ */ jsx(Button, {
209
+ if ($[8] !== finding) {
210
+ t6 = /* @__PURE__ */ jsx(Button, {
232
211
  variant: "outline",
233
212
  size: "xs",
234
- disabled: busy,
235
- onClick: () => applyFix.mutate({
236
- projectId,
237
- findingId: finding.id
238
- }),
239
- children: fixLabel(finding.fix)
213
+ onClick: () => studioStore.trigger.sendToAgent({ text: fixWithAgentMessage(finding, finding.role) }),
214
+ children: "Fix with agent"
240
215
  });
241
- $[9] = applyFix;
242
- $[10] = busy;
243
- $[11] = finding.fix;
244
- $[12] = finding.id;
245
- $[13] = fixesHere;
246
- $[14] = projectId;
247
- $[15] = t7;
248
- } else t7 = $[15];
216
+ $[8] = finding;
217
+ $[9] = t6;
218
+ } else t6 = $[9];
219
+ const t7 = dismiss.isPending;
249
220
  let t8;
250
- if ($[16] !== finding || $[17] !== fixesHere) {
251
- t8 = fixesHere && /* @__PURE__ */ jsx(Button, {
252
- variant: "outline",
253
- size: "xs",
254
- onClick: () => studioStore.trigger.askAgent({ text: askAgentMessage(finding, finding.role) }),
255
- children: "Ask the agent"
256
- });
257
- $[16] = finding;
258
- $[17] = fixesHere;
259
- $[18] = t8;
260
- } else t8 = $[18];
261
- let t9;
262
- if ($[19] !== draftId || $[20] !== finding || $[21] !== patrolDraft) {
263
- t9 = draftId === null && patrolDraft && /* @__PURE__ */ jsx(OpenInPatrolDraft, {
264
- finding,
265
- patrolDraft
266
- });
267
- $[19] = draftId;
268
- $[20] = finding;
269
- $[21] = patrolDraft;
270
- $[22] = t9;
271
- } else t9 = $[22];
272
- let t10;
273
- if ($[23] !== dismiss || $[24] !== finding.id || $[25] !== projectId) {
274
- t10 = () => dismiss.mutate({
221
+ if ($[10] !== dismiss || $[11] !== finding.id || $[12] !== projectId) {
222
+ t8 = () => dismiss.mutate({
275
223
  projectId,
276
224
  findingId: finding.id
277
225
  });
278
- $[23] = dismiss;
279
- $[24] = finding.id;
280
- $[25] = projectId;
281
- $[26] = t10;
282
- } else t10 = $[26];
283
- let t11;
284
- if ($[27] !== finding.about) {
285
- t11 = dismissLabel(finding.about);
286
- $[27] = finding.about;
287
- $[28] = t11;
288
- } else t11 = $[28];
289
- let t12;
290
- if ($[29] !== busy || $[30] !== t10 || $[31] !== t11) {
291
- t12 = /* @__PURE__ */ jsx(Button, {
226
+ $[10] = dismiss;
227
+ $[11] = finding.id;
228
+ $[12] = projectId;
229
+ $[13] = t8;
230
+ } else t8 = $[13];
231
+ let t9;
232
+ if ($[14] !== finding.about) {
233
+ t9 = dismissLabel(finding.about);
234
+ $[14] = finding.about;
235
+ $[15] = t9;
236
+ } else t9 = $[15];
237
+ let t10;
238
+ if ($[16] !== dismiss.isPending || $[17] !== t8 || $[18] !== t9) {
239
+ t10 = /* @__PURE__ */ jsx(Button, {
292
240
  variant: "ghost",
293
241
  size: "xs",
294
- disabled: busy,
295
- onClick: t10,
296
- children: t11
242
+ disabled: t7,
243
+ onClick: t8,
244
+ children: t9
297
245
  });
298
- $[29] = busy;
299
- $[30] = t10;
300
- $[31] = t11;
301
- $[32] = t12;
302
- } else t12 = $[32];
303
- let t13;
304
- if ($[33] !== t12 || $[34] !== t7 || $[35] !== t8 || $[36] !== t9) {
305
- t13 = /* @__PURE__ */ jsxs("span", {
246
+ $[16] = dismiss.isPending;
247
+ $[17] = t8;
248
+ $[18] = t9;
249
+ $[19] = t10;
250
+ } else t10 = $[19];
251
+ let t11;
252
+ if ($[20] !== t10 || $[21] !== t6) {
253
+ t11 = /* @__PURE__ */ jsxs("span", {
306
254
  className: "mt-1.5 flex flex-wrap gap-1",
307
- children: [
308
- t7,
309
- t8,
310
- t9,
311
- t12
312
- ]
255
+ children: [t6, t10]
313
256
  });
314
- $[33] = t12;
315
- $[34] = t7;
316
- $[35] = t8;
317
- $[36] = t9;
318
- $[37] = t13;
319
- } else t13 = $[37];
320
- let t14;
321
- if ($[38] !== t13 || $[39] !== t6) {
322
- t14 = /* @__PURE__ */ jsxs(AlertDescription, {
257
+ $[20] = t10;
258
+ $[21] = t6;
259
+ $[22] = t11;
260
+ } else t11 = $[22];
261
+ let t12;
262
+ if ($[23] !== t11 || $[24] !== t5) {
263
+ t12 = /* @__PURE__ */ jsxs(AlertDescription, {
323
264
  className: "text-xs",
324
- children: [t6, t13]
265
+ children: [t5, t11]
325
266
  });
326
- $[38] = t13;
327
- $[39] = t6;
328
- $[40] = t14;
329
- } else t14 = $[40];
330
- let t15;
331
- if ($[41] !== t14 || $[42] !== t5) {
332
- t15 = /* @__PURE__ */ jsxs(Alert, {
267
+ $[23] = t11;
268
+ $[24] = t5;
269
+ $[25] = t12;
270
+ } else t12 = $[25];
271
+ let t13;
272
+ if ($[26] !== t12 || $[27] !== t4) {
273
+ t13 = /* @__PURE__ */ jsxs(Alert, {
333
274
  "data-content-finding": true,
334
275
  variant: "warning",
335
276
  className: "px-3 py-2",
336
277
  children: [
337
- t3,
338
- t5,
339
- t14
278
+ t2,
279
+ t4,
280
+ t12
340
281
  ]
341
282
  });
342
- $[41] = t14;
343
- $[42] = t5;
344
- $[43] = t15;
345
- } else t15 = $[43];
346
- return t15;
347
- }
348
- function _temp4(error_0) {
349
- return toast.error(error_0.message || "Could not dismiss it");
350
- }
351
- function _temp3(error) {
352
- return toast.error(error.message || "Could not apply the fix");
353
- }
354
- function _temp2(t0) {
355
- const { applied } = t0;
356
- if (!applied) toast.info("The link changed since it was checked, so it's being checked again.");
283
+ $[26] = t12;
284
+ $[27] = t4;
285
+ $[28] = t13;
286
+ } else t13 = $[28];
287
+ return t13;
357
288
  }
358
- /** Opens the Patrol Draft on a Live finding's field, as the Canvas shows it there. */
359
- function OpenInPatrolDraft(t0) {
360
- const $ = c(9);
361
- const { finding, patrolDraft } = t0;
362
- const showInCanvas = useShowInCanvas();
363
- const { place } = finding;
364
- if (place?.kind !== "page") return null;
365
- let t1;
366
- if ($[0] !== finding.field || $[1] !== finding.fieldKind || $[2] !== finding.locale || $[3] !== patrolDraft.id || $[4] !== place.blockId || $[5] !== place.itemId || $[6] !== place.pageId || $[7] !== showInCanvas) {
367
- t1 = /* @__PURE__ */ jsx(Button, {
368
- variant: "outline",
369
- size: "xs",
370
- onClick: () => void showInCanvas({
371
- pageId: place.pageId,
372
- locale: finding.locale,
373
- blockId: place.blockId,
374
- itemId: place.itemId,
375
- field: {
376
- name: finding.field,
377
- kind: finding.fieldKind
378
- },
379
- draft: patrolDraft.id
380
- }),
381
- children: "Open the Patrol Draft"
382
- });
383
- $[0] = finding.field;
384
- $[1] = finding.fieldKind;
385
- $[2] = finding.locale;
386
- $[3] = patrolDraft.id;
387
- $[4] = place.blockId;
388
- $[5] = place.itemId;
389
- $[6] = place.pageId;
390
- $[7] = showInCanvas;
391
- $[8] = t1;
392
- } else t1 = $[8];
393
- return t1;
289
+ function _temp2(error) {
290
+ return toast.error(error.message || "Could not dismiss it");
394
291
  }
395
292
 
396
293
  //#endregion
@@ -0,0 +1,112 @@
1
+ import { draftMutations } from "../../../lib/queries.js";
2
+ import { c } from "react/compiler-runtime";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { useMutation } from "@tanstack/react-query";
5
+ import { toast } from "@camox/ui/toaster";
6
+ import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@camox/ui/alert-dialog";
7
+ import { Spinner } from "@camox/ui/spinner";
8
+
9
+ //#region src/features/studio/components/DeleteDraftDialog.tsx
10
+ /** Asks before deleting the draft the studio is in, then deletes it. */
11
+ function DeleteDraftDialog(t0) {
12
+ const $ = c(26);
13
+ const { projectId, open, onOpenChange, onDeleted } = t0;
14
+ let t1;
15
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
16
+ t1 = draftMutations.delete();
17
+ $[0] = t1;
18
+ } else t1 = $[0];
19
+ let t2;
20
+ if ($[1] !== onDeleted || $[2] !== onOpenChange) {
21
+ t2 = {
22
+ ...t1,
23
+ onSuccess: (t3) => {
24
+ const { ended } = t3;
25
+ onOpenChange(false);
26
+ onDeleted(ended);
27
+ },
28
+ onError: _temp
29
+ };
30
+ $[1] = onDeleted;
31
+ $[2] = onOpenChange;
32
+ $[3] = t2;
33
+ } else t2 = $[3];
34
+ const deleteDraft = useMutation(t2);
35
+ let t3;
36
+ if ($[4] !== deleteDraft.isPending || $[5] !== onOpenChange) {
37
+ t3 = (next) => {
38
+ if (!deleteDraft.isPending) onOpenChange(next);
39
+ };
40
+ $[4] = deleteDraft.isPending;
41
+ $[5] = onOpenChange;
42
+ $[6] = t3;
43
+ } else t3 = $[6];
44
+ let t4;
45
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
46
+ t4 = /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [/* @__PURE__ */ jsx(AlertDialogTitle, { children: "Delete this draft?" }), /* @__PURE__ */ jsx(AlertDialogDescription, { children: "Every change in this draft is deleted for everyone. Live stays as it is. This can't be undone." })] });
47
+ $[7] = t4;
48
+ } else t4 = $[7];
49
+ let t5;
50
+ if ($[8] !== deleteDraft.isPending) {
51
+ t5 = /* @__PURE__ */ jsx(AlertDialogCancel, {
52
+ variant: "outline",
53
+ size: "default",
54
+ disabled: deleteDraft.isPending,
55
+ children: "Cancel"
56
+ });
57
+ $[8] = deleteDraft.isPending;
58
+ $[9] = t5;
59
+ } else t5 = $[9];
60
+ let t6;
61
+ if ($[10] !== deleteDraft || $[11] !== projectId) {
62
+ t6 = () => deleteDraft.mutate({ projectId });
63
+ $[10] = deleteDraft;
64
+ $[11] = projectId;
65
+ $[12] = t6;
66
+ } else t6 = $[12];
67
+ let t7;
68
+ if ($[13] !== deleteDraft.isPending) {
69
+ t7 = deleteDraft.isPending ? /* @__PURE__ */ jsx(Spinner, {}) : null;
70
+ $[13] = deleteDraft.isPending;
71
+ $[14] = t7;
72
+ } else t7 = $[14];
73
+ let t8;
74
+ if ($[15] !== deleteDraft.isPending || $[16] !== t6 || $[17] !== t7) {
75
+ t8 = /* @__PURE__ */ jsxs(AlertDialogAction, {
76
+ variant: "destructive",
77
+ disabled: deleteDraft.isPending,
78
+ onClick: t6,
79
+ children: [t7, "Delete draft"]
80
+ });
81
+ $[15] = deleteDraft.isPending;
82
+ $[16] = t6;
83
+ $[17] = t7;
84
+ $[18] = t8;
85
+ } else t8 = $[18];
86
+ let t9;
87
+ if ($[19] !== t5 || $[20] !== t8) {
88
+ t9 = /* @__PURE__ */ jsxs(AlertDialogContent, { children: [t4, /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [t5, t8] })] });
89
+ $[19] = t5;
90
+ $[20] = t8;
91
+ $[21] = t9;
92
+ } else t9 = $[21];
93
+ let t10;
94
+ if ($[22] !== open || $[23] !== t3 || $[24] !== t9) {
95
+ t10 = /* @__PURE__ */ jsx(AlertDialog, {
96
+ open,
97
+ onOpenChange: t3,
98
+ children: t9
99
+ });
100
+ $[22] = open;
101
+ $[23] = t3;
102
+ $[24] = t9;
103
+ $[25] = t10;
104
+ } else t10 = $[25];
105
+ return t10;
106
+ }
107
+ function _temp(error) {
108
+ return toast.error(error.message || "Could not delete the draft");
109
+ }
110
+
111
+ //#endregion
112
+ export { DeleteDraftDialog };