@cobaltcore-dev/aurora 2.1.0 → 2.1.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 (54) hide show
  1. package/dist/client/DeleteFlavorModal-C4nAi7gY.mjs +724 -0
  2. package/dist/client/DeleteFlavorModal-C4nAi7gY.mjs.map +1 -0
  3. package/dist/client/_flavorId-BPvssEzn.mjs +277 -0
  4. package/dist/client/_flavorId-BPvssEzn.mjs.map +1 -0
  5. package/dist/client/{_flavorId-CgueqKTs.mjs → _flavorId-CFUBcU-l.mjs} +3 -3
  6. package/dist/client/{_flavorId-CgueqKTs.mjs.map → _flavorId-CFUBcU-l.mjs.map} +1 -1
  7. package/dist/client/{_flavorId-B7fp6Nk8.mjs → _flavorId-CZcIp0Ih.mjs} +2 -2
  8. package/dist/client/{_flavorId-B7fp6Nk8.mjs.map → _flavorId-CZcIp0Ih.mjs.map} +1 -1
  9. package/dist/client/_imageId-BAezmV0Y.mjs +526 -0
  10. package/dist/client/_imageId-BAezmV0Y.mjs.map +1 -0
  11. package/dist/client/{_imageId-Ccv8PedW.mjs → _imageId-D-jqz3e3.mjs} +3 -3
  12. package/dist/client/_imageId-D-jqz3e3.mjs.map +1 -0
  13. package/dist/client/{_imageId-D9LR-02T.mjs → _imageId-gMdrdnVt.mjs} +2 -2
  14. package/dist/client/_imageId-gMdrdnVt.mjs.map +1 -0
  15. package/dist/client/{_projectId-BDARsteX.mjs → _projectId-BYccdAtX.mjs} +3 -3
  16. package/dist/client/{_projectId-BDARsteX.mjs.map → _projectId-BYccdAtX.mjs.map} +1 -1
  17. package/dist/client/{_projectId-ZBk6vka0.mjs → _projectId-CBjZC1tv.mjs} +5 -5
  18. package/dist/client/{_projectId-ZBk6vka0.mjs.map → _projectId-CBjZC1tv.mjs.map} +1 -1
  19. package/dist/client/{_projectId-CtyAHqhH.mjs → _projectId-CLEa1zgw.mjs} +2 -2
  20. package/dist/client/{_projectId-CtyAHqhH.mjs.map → _projectId-CLEa1zgw.mjs.map} +1 -1
  21. package/dist/client/{flavors-Ce3J-cFa.mjs → flavors-CJVSNz6R.mjs} +2 -2
  22. package/dist/client/{flavors-Ce3J-cFa.mjs.map → flavors-CJVSNz6R.mjs.map} +1 -1
  23. package/dist/client/{flavors-D5ThLaXO.mjs → flavors-CflJDIEH.mjs} +25 -24
  24. package/dist/client/{flavors-D5ThLaXO.mjs.map → flavors-CflJDIEH.mjs.map} +1 -1
  25. package/dist/client/imageHelpers-DBhL2ebL.mjs +1272 -0
  26. package/dist/client/imageHelpers-DBhL2ebL.mjs.map +1 -0
  27. package/dist/client/{images-C8M3ysWR.mjs → images-BsylWUiH.mjs} +836 -848
  28. package/dist/client/images-BsylWUiH.mjs.map +1 -0
  29. package/dist/client/{images-Cf5R28NR.mjs → images-zQq1nSVv.mjs} +2 -2
  30. package/dist/client/{images-Cf5R28NR.mjs.map → images-zQq1nSVv.mjs.map} +1 -1
  31. package/dist/client/index.js +10 -9
  32. package/dist/client/index.js.map +1 -1
  33. package/dist/client/{securitygroups-DXrfyuVF.mjs → securitygroups-CSmsBzUb.mjs} +104 -103
  34. package/dist/client/securitygroups-CSmsBzUb.mjs.map +1 -0
  35. package/dist/client/{securitygroups-67fFxiwt.mjs → securitygroups-T7kaNFEp.mjs} +2 -2
  36. package/dist/client/{securitygroups-67fFxiwt.mjs.map → securitygroups-T7kaNFEp.mjs.map} +1 -1
  37. package/dist/client/trpcClient.d.ts +0 -1
  38. package/dist/client/useErrorTranslation-Dc0eE8Zt.mjs +83 -0
  39. package/dist/client/useErrorTranslation-Dc0eE8Zt.mjs.map +1 -0
  40. package/dist/server/index.d.ts +0 -1
  41. package/dist/server/index.js +786 -534
  42. package/package.json +2 -2
  43. package/dist/client/DeleteFlavorModal-Be2GFiB_.mjs +0 -802
  44. package/dist/client/DeleteFlavorModal-Be2GFiB_.mjs.map +0 -1
  45. package/dist/client/ImageToastNotifications-BWfzOUMc.mjs +0 -1135
  46. package/dist/client/ImageToastNotifications-BWfzOUMc.mjs.map +0 -1
  47. package/dist/client/_flavorId-0PioWpEp.mjs +0 -276
  48. package/dist/client/_flavorId-0PioWpEp.mjs.map +0 -1
  49. package/dist/client/_imageId-Ccv8PedW.mjs.map +0 -1
  50. package/dist/client/_imageId-CiqEQB_J.mjs +0 -558
  51. package/dist/client/_imageId-CiqEQB_J.mjs.map +0 -1
  52. package/dist/client/_imageId-D9LR-02T.mjs.map +0 -1
  53. package/dist/client/images-C8M3ysWR.mjs.map +0 -1
  54. package/dist/client/securitygroups-DXrfyuVF.mjs.map +0 -1
@@ -0,0 +1,1272 @@
1
+ import { E as e, K as t, L as n, M as r, Q as i, R as a, S as o, T as s, U as c, X as l, ft as u, h as d, i as f, it as p, m, n as h, o as g, ot as _, p as v, rt as y, s as b, st as x, t as S } from "./build-WuxXRAqf.mjs";
2
+ import { a as C } from "./trpcClient-D7gpR7YG.mjs";
3
+ import { t as w } from "./useProjectId-DBc5lpoU.mjs";
4
+ import { n as T } from "./formatBytes-CZv_XyCY.mjs";
5
+ import { t as E } from "./useModalTracking-BYd37pXm.mjs";
6
+ import "./hooks-D0yKIumu.mjs";
7
+ import { t as D } from "./useErrorTranslation-Dc0eE8Zt.mjs";
8
+ import { Fragment as O, jsx as k, jsxs as A } from "react/jsx-runtime";
9
+ import j, { useEffect as M, useMemo as N, useState as P } from "react";
10
+ import { Trans as F, useLingui as I } from "@lingui/react";
11
+ import { z as L } from "zod";
12
+ import { useForm as R, useStore as z } from "@tanstack/react-form";
13
+ //#region src/client/routes/_auth/projects/$projectId/compute/images/-components/SizeDisplay.tsx
14
+ function B({ size: e }) {
15
+ return e === void 0 ? /*#__PURE__*/ k("span", { children: "N/A" }) : /*#__PURE__*/ k("span", { children: T(e) });
16
+ }
17
+ //#endregion
18
+ //#region src/client/routes/_auth/projects/$projectId/compute/-constants/filters.ts
19
+ var V = {
20
+ PENDING: "pending",
21
+ ACCEPTED: "accepted",
22
+ REJECTED: "rejected",
23
+ ALL: "all"
24
+ }, H = {
25
+ QUEUED: "queued",
26
+ SAVING: "saving",
27
+ ACTIVE: "active",
28
+ DEACTIVATED: "deactivated",
29
+ KILLED: "killed",
30
+ DELETED: "deleted",
31
+ PENDING_DELETE: "pending_delete"
32
+ }, U = {
33
+ PUBLIC: "public",
34
+ PRIVATE: "private",
35
+ SHARED: "shared",
36
+ COMMUNITY: "community",
37
+ ALL: "all"
38
+ }, W = {
39
+ AMI: "ami",
40
+ ARI: "ari",
41
+ AKI: "aki",
42
+ VHD: "vhd",
43
+ VHDX: "vhdx",
44
+ VMDK: "vmdk",
45
+ RAW: "raw",
46
+ QCOW2: "qcow2",
47
+ VDI: "vdi",
48
+ ISO: "iso",
49
+ PLOOP: "ploop"
50
+ }, G = {
51
+ AMI: "ami",
52
+ ARI: "ari",
53
+ AKI: "aki",
54
+ BARE: "bare",
55
+ OVF: "ovf",
56
+ OVA: "ova",
57
+ DOCKER: "docker"
58
+ }, K = ({ image: e, isOpen: t, isLoading: n = !1, onClose: r, onSave: o }) => {
59
+ let { i18n: s, _: h } = I(), [g, _] = P({
60
+ name: e.name || "",
61
+ tags: e.tags || [],
62
+ visibility: e.visibility || U.PRIVATE,
63
+ protected: e.protected || !1,
64
+ min_disk: e.min_disk || 0,
65
+ min_ram: e.min_ram || 0
66
+ }), [b, S] = P(""), [C, w] = P({}), T = (e, t) => {
67
+ if (e.length !== t.length) return !1;
68
+ let n = [...e].sort(), r = [...t].sort();
69
+ return n.every((e, t) => e === r[t]);
70
+ }, E = e.name === g.name && T(e.tags || [], g.tags) && e.visibility === g.visibility && e.protected === g.protected && e.min_disk === g.min_disk && e.min_ram === g.min_ram, D = (e) => {
71
+ let { name: t, value: n, type: r, checked: i } = e.target;
72
+ _((e) => ({
73
+ ...e,
74
+ [t]: r === "checkbox" ? i : n
75
+ })), C[t] && w((e) => {
76
+ let n = { ...e };
77
+ return delete n[t], n;
78
+ });
79
+ }, O = (e, t) => {
80
+ _((n) => ({
81
+ ...n,
82
+ [e]: t
83
+ })), C[e] && w((t) => {
84
+ let n = { ...t };
85
+ return delete n[e], n;
86
+ });
87
+ }, j = (e, t) => {
88
+ let n = t === "" ? 0 : parseInt(t, 10);
89
+ isNaN(n) || (_((t) => ({
90
+ ...t,
91
+ [e]: n
92
+ })), C[e] && w((t) => {
93
+ let n = { ...t };
94
+ return delete n[e], n;
95
+ }));
96
+ }, M = (e) => {
97
+ S(e.target.value);
98
+ }, N = () => {
99
+ let e = b.trim();
100
+ if (e !== "") {
101
+ if (g.tags.includes(e)) {
102
+ S("");
103
+ return;
104
+ }
105
+ _((t) => ({
106
+ ...t,
107
+ tags: [...t.tags, e]
108
+ })), S("");
109
+ }
110
+ }, L = (e) => {
111
+ e.key === "Enter" && (e.preventDefault(), N());
112
+ }, R = (e) => {
113
+ _((t) => ({
114
+ ...t,
115
+ tags: t.tags.filter((t) => t !== e)
116
+ }));
117
+ }, z = () => {
118
+ let e = {};
119
+ return (!g.name || g.name.trim() === "") && (e.name = s._({ id: "wyIOMP" })), g.min_disk < 0 && (e.min_disk = s._({ id: "K3bUTE" })), g.min_ram < 0 && (e.min_ram = s._({ id: "PEGvy+" })), w(e), Object.keys(e).length === 0;
120
+ };
121
+ return /*#__PURE__*/ k(l, {
122
+ open: t,
123
+ onCancel: () => {
124
+ w({}), r();
125
+ },
126
+ size: "large",
127
+ title: s._({ id: "M5Epeo" }),
128
+ onConfirm: async (t) => {
129
+ t.preventDefault(), z() && await o({
130
+ ...e.name === g.name.trim() ? {} : { name: g.name.trim() },
131
+ ...T(e.tags || [], g.tags) ? {} : { tags: g.tags },
132
+ ...e.visibility === g.visibility ? {} : { visibility: g.visibility },
133
+ ...e.protected === g.protected ? {} : { protected: g.protected },
134
+ ...e.min_disk === g.min_disk ? {} : { min_disk: g.min_disk },
135
+ ...e.min_ram === g.min_ram ? {} : { min_ram: g.min_ram }
136
+ });
137
+ },
138
+ confirmButtonLabel: s._({ id: "IUwGEM" }),
139
+ cancelButtonLabel: s._({ id: "dEgA5A" }),
140
+ disableConfirmButton: n || E,
141
+ children: n ? /*#__PURE__*/ k(y, {
142
+ status: "progress",
143
+ title: s._({ id: "lsiOhA" }),
144
+ className: "mt-0"
145
+ }) : /*#__PURE__*/ A(u, { children: [/*#__PURE__*/ A(v, {
146
+ className: "mb-6",
147
+ children: [
148
+ /*#__PURE__*/ k(d, {
149
+ className: "mb-4",
150
+ children: /*#__PURE__*/ k(m, {
151
+ id: "name",
152
+ name: "name",
153
+ label: s._({ id: "ExLULX" }),
154
+ value: g.name,
155
+ onChange: D,
156
+ required: !0,
157
+ errortext: C.name
158
+ })
159
+ }),
160
+ /*#__PURE__*/ k(d, {
161
+ className: "my-6",
162
+ children: /*#__PURE__*/ A("div", {
163
+ className: "w-full",
164
+ children: [/*#__PURE__*/ A(i, {
165
+ gap: "2",
166
+ direction: "horizontal",
167
+ alignment: "start",
168
+ children: [/*#__PURE__*/ k("div", {
169
+ className: "flex-1",
170
+ children: /*#__PURE__*/ k(m, {
171
+ id: "tags",
172
+ name: "tags",
173
+ label: s._({ id: "OYHzN1" }),
174
+ value: b,
175
+ onChange: M,
176
+ onKeyDown: L,
177
+ helptext: s._({ id: "MOug+V" })
178
+ })
179
+ }), /*#__PURE__*/ k(f, {
180
+ onClick: N,
181
+ disabled: n || b.trim() === "",
182
+ children: /*#__PURE__*/ k(F, { id: "m16xKo" })
183
+ })]
184
+ }), g.tags.length > 0 && /*#__PURE__*/ k(i, {
185
+ gap: "2",
186
+ wrap: !0,
187
+ alignment: "center",
188
+ className: "mt-3",
189
+ children: g.tags.map((e) => /*#__PURE__*/ k(c, {
190
+ closeable: !0,
191
+ pillKey: "",
192
+ pillValue: e,
193
+ onClose: () => R(e)
194
+ }, e))
195
+ })]
196
+ })
197
+ }),
198
+ /*#__PURE__*/ k(d, {
199
+ className: "mb-4",
200
+ children: /*#__PURE__*/ A(p, {
201
+ id: "visibility",
202
+ name: "visibility",
203
+ label: s._({ id: "2q/Q7x" }),
204
+ value: g.visibility,
205
+ onChange: (e) => O("visibility", e),
206
+ children: [
207
+ /*#__PURE__*/ k(a, {
208
+ value: U.PUBLIC,
209
+ label: s._({ id: "7d1a0d" })
210
+ }),
211
+ /*#__PURE__*/ k(a, {
212
+ value: U.PRIVATE,
213
+ label: s._({ id: "zwBp5t" })
214
+ }),
215
+ /*#__PURE__*/ k(a, {
216
+ value: U.SHARED,
217
+ label: s._({ id: "0Gd0NU" })
218
+ }),
219
+ /*#__PURE__*/ k(a, {
220
+ value: U.COMMUNITY,
221
+ label: s._({ id: "chL5IG" })
222
+ })
223
+ ]
224
+ })
225
+ }),
226
+ /*#__PURE__*/ k(d, { children: /*#__PURE__*/ k(x, {
227
+ id: "protected",
228
+ name: "protected",
229
+ label: s._({ id: "644xgx" }),
230
+ checked: g.protected,
231
+ onChange: D,
232
+ helptext: s._({ id: "lAsm87" })
233
+ }) })
234
+ ]
235
+ }), /*#__PURE__*/ A(v, {
236
+ className: "mb-6",
237
+ children: [/*#__PURE__*/ k(d, {
238
+ className: "mb-4",
239
+ children: /*#__PURE__*/ k(m, {
240
+ id: "min_disk",
241
+ name: "min_disk",
242
+ label: s._({ id: "tbwGSx" }),
243
+ type: "number",
244
+ value: String(g.min_disk),
245
+ onChange: (e) => j("min_disk", e.target.value),
246
+ helptext: s._({ id: "RFDYCD" }),
247
+ errortext: C.min_disk
248
+ })
249
+ }), /*#__PURE__*/ k(d, { children: /*#__PURE__*/ k(m, {
250
+ id: "min_ram",
251
+ name: "min_ram",
252
+ label: s._({ id: "UYSopm" }),
253
+ type: "number",
254
+ value: String(g.min_ram),
255
+ onChange: (e) => j("min_ram", e.target.value),
256
+ helptext: s._({ id: "WErCZy" }),
257
+ errortext: C.min_ram
258
+ }) })]
259
+ })] })
260
+ });
261
+ }, q = (e) => ({
262
+ message: /*#__PURE__*/ k(F, { id: "bM1O3m" }),
263
+ description: /*#__PURE__*/ k(F, {
264
+ id: "hHL/wm",
265
+ values: { imageName: e }
266
+ })
267
+ }), J = (e, t) => ({
268
+ message: /*#__PURE__*/ k(F, { id: "9iz2XW" }),
269
+ description: /*#__PURE__*/ k(F, {
270
+ id: "wODCcl",
271
+ values: {
272
+ imageName: e,
273
+ errorMessage: t
274
+ }
275
+ })
276
+ }), Y = (e) => ({
277
+ message: /*#__PURE__*/ k(F, { id: "bM1O3m" }),
278
+ description: /*#__PURE__*/ k(F, {
279
+ id: "8AriEH",
280
+ values: { imageName: e }
281
+ })
282
+ }), ee = (e, t) => ({
283
+ message: /*#__PURE__*/ k(F, { id: "lWTy+Y" }),
284
+ description: /*#__PURE__*/ k(F, {
285
+ id: "lYC3YX",
286
+ values: {
287
+ imageName: e,
288
+ errorMessage: t
289
+ }
290
+ })
291
+ }), te = (e, t) => ({
292
+ message: /*#__PURE__*/ k(F, { id: "AGXLLY" }),
293
+ description: /*#__PURE__*/ k(F, {
294
+ id: "Vf3tzc",
295
+ values: {
296
+ fileName: e,
297
+ errorMessage: t
298
+ }
299
+ })
300
+ }), X = () => ({
301
+ message: /*#__PURE__*/ k(F, { id: "nZbdB+" }),
302
+ description: /*#__PURE__*/ k(F, { id: "+hApBX" })
303
+ }), Z = () => ({
304
+ message: /*#__PURE__*/ k(F, { id: "OhoNl2" }),
305
+ description: /*#__PURE__*/ k(F, { id: "De+cs2" })
306
+ }), Q = () => ({
307
+ message: /*#__PURE__*/ k(F, { id: "6/z5tA" }),
308
+ description: /*#__PURE__*/ k(F, { id: "qXyZuV" })
309
+ }), ne = () => ({
310
+ message: /*#__PURE__*/ k(F, { id: "Sjuoog" }),
311
+ description: /*#__PURE__*/ k(F, { id: "6Ur0UX" })
312
+ }), re = (e) => ({
313
+ message: /*#__PURE__*/ k(F, { id: "bM1O3m" }),
314
+ description: /*#__PURE__*/ k(F, {
315
+ id: "S1iTXO",
316
+ values: { imageName: e }
317
+ })
318
+ }), ie = (e, t) => ({
319
+ message: /*#__PURE__*/ k(F, { id: "o/VDOG" }),
320
+ description: /*#__PURE__*/ k(F, {
321
+ id: "lIlLtp",
322
+ values: {
323
+ imageId: e,
324
+ errorMessage: t
325
+ }
326
+ })
327
+ }), ae = (e) => ({
328
+ message: /*#__PURE__*/ k(F, { id: "bM1O3m" }),
329
+ description: /*#__PURE__*/ k(F, {
330
+ id: "cj17eo",
331
+ values: { imageName: e }
332
+ })
333
+ }), oe = (e) => ({
334
+ message: /*#__PURE__*/ k(F, { id: "bM1O3m" }),
335
+ description: /*#__PURE__*/ k(F, {
336
+ id: "ZcWMT1",
337
+ values: { imageName: e }
338
+ })
339
+ }), se = (e, t) => ({
340
+ message: /*#__PURE__*/ k(F, { id: "tiflqy" }),
341
+ description: /*#__PURE__*/ k(F, {
342
+ id: "G/045D",
343
+ values: {
344
+ imageId: e,
345
+ errorMessage: t
346
+ }
347
+ })
348
+ }), ce = (e, t) => ({
349
+ message: /*#__PURE__*/ k(F, { id: "BYH/2L" }),
350
+ description: /*#__PURE__*/ k(F, {
351
+ id: "KYFkcz",
352
+ values: {
353
+ imageId: e,
354
+ errorMessage: t
355
+ }
356
+ })
357
+ }), le = (e, t) => ({
358
+ message: /*#__PURE__*/ k(F, { id: "CFMxC8" }),
359
+ description: /*#__PURE__*/ k(F, {
360
+ id: "T7mgdd",
361
+ values: {
362
+ successCount: e,
363
+ totalCount: t
364
+ }
365
+ })
366
+ }), ue = (e, t) => ({
367
+ message: /*#__PURE__*/ k(F, { id: "fIvd7X" }),
368
+ description: /*#__PURE__*/ k(F, {
369
+ id: "xNZKYy",
370
+ values: {
371
+ failedCount: e,
372
+ totalCount: t
373
+ }
374
+ })
375
+ }), de = (e, t) => ({
376
+ message: /*#__PURE__*/ k(F, { id: "Z5r9vC" }),
377
+ description: /*#__PURE__*/ k(F, {
378
+ id: "plnnns",
379
+ values: {
380
+ successCount: e,
381
+ failedCount: t
382
+ }
383
+ })
384
+ }), fe = (e, t) => ({
385
+ message: /*#__PURE__*/ k(F, { id: "ryf/ee" }),
386
+ description: /*#__PURE__*/ k(F, {
387
+ id: "J9QcnV",
388
+ values: {
389
+ successCount: e,
390
+ totalCount: t
391
+ }
392
+ })
393
+ }), pe = (e, t) => ({
394
+ message: /*#__PURE__*/ k(F, { id: "9njIiV" }),
395
+ description: /*#__PURE__*/ k(F, {
396
+ id: "R6u5CR",
397
+ values: {
398
+ failedCount: e,
399
+ totalCount: t
400
+ }
401
+ })
402
+ }), me = (e, t) => ({
403
+ message: /*#__PURE__*/ k(F, { id: "YZmsaT" }),
404
+ description: /*#__PURE__*/ k(F, {
405
+ id: "GbKqnI",
406
+ values: {
407
+ successCount: e,
408
+ failedCount: t
409
+ }
410
+ })
411
+ }), he = (e, t) => ({
412
+ message: /*#__PURE__*/ k(F, { id: "h8h6oz" }),
413
+ description: /*#__PURE__*/ k(F, {
414
+ id: "ZAy0zp",
415
+ values: {
416
+ successCount: e,
417
+ totalCount: t
418
+ }
419
+ })
420
+ }), ge = (e, t) => ({
421
+ message: /*#__PURE__*/ k(F, { id: "fJpv9x" }),
422
+ description: /*#__PURE__*/ k(F, {
423
+ id: "quU9wK",
424
+ values: {
425
+ failedCount: e,
426
+ totalCount: t
427
+ }
428
+ })
429
+ }), _e = (e, t) => ({
430
+ message: /*#__PURE__*/ k(F, { id: "JfWCsP" }),
431
+ description: /*#__PURE__*/ k(F, {
432
+ id: "8t1+HU",
433
+ values: {
434
+ successCount: e,
435
+ failedCount: t
436
+ }
437
+ })
438
+ }), ve = (e) => ({
439
+ message: /*#__PURE__*/ k(F, { id: "V66Jih" }),
440
+ description: /*#__PURE__*/ k(F, {
441
+ id: "Vmojta",
442
+ values: { newStatus: e }
443
+ })
444
+ }), ye = (e) => ({
445
+ message: /*#__PURE__*/ k(F, { id: "V66Jih" }),
446
+ description: e || /*#__PURE__*/ k(F, { id: "QYiqYb" })
447
+ }), be = (e, t) => ({
448
+ message: /*#__PURE__*/ k(F, { id: "OSlLnz" }),
449
+ description: /*#__PURE__*/ k(F, {
450
+ id: "CA8ZeT",
451
+ values: {
452
+ imageName: e,
453
+ visibility: t
454
+ }
455
+ })
456
+ }), xe = (e, t) => ({
457
+ message: /*#__PURE__*/ k(F, { id: "aqagJH" }),
458
+ description: /*#__PURE__*/ k(F, {
459
+ id: "FEfQAu",
460
+ values: {
461
+ imageName: e,
462
+ errorMessage: t
463
+ }
464
+ })
465
+ });
466
+ //#endregion
467
+ //#region src/client/routes/_auth/projects/$projectId/compute/images/-components/EditImageMetadataModal.tsx
468
+ function Se(e) {
469
+ return e == null ? "" : typeof e == "object" ? JSON.stringify(e) : String(e);
470
+ }
471
+ function Ce(e, t) {
472
+ return Object.entries(e).filter(([e]) => !t.has(e.toLowerCase())).map(([e, t]) => {
473
+ let n = Se(t);
474
+ return {
475
+ key: e,
476
+ value: n,
477
+ isNew: !1,
478
+ isEditing: !1,
479
+ originalKey: e,
480
+ originalValue: n
481
+ };
482
+ }).sort((e, t) => e.key.localeCompare(t.key));
483
+ }
484
+ function we({ client: t, onClose: r, initialMetadata: a, excludedProperties: o, canEdit: s = !0, projectId: c, imageId: u }) {
485
+ let { i18n: d, _: p } = I(), { translateError: g } = D(), [v, y] = P(a), [x, S] = P({}), [C, w] = P(!1), [T, E] = P(""), [M, N] = P(""), [F, L] = P(!1), [R, z] = P(null), B = F || C || v.some((e) => e.isEditing), V = (e, t, n) => {
486
+ let r = e?.trim().toLowerCase();
487
+ return r ? o.has(r) ? d._({ id: "n3eQzA" }) : v.some((e, i) => e.key.trim().toLowerCase() === r && i !== n && e.originalKey !== t) ? d._({ id: "i6/ygf" }) : null : d._({ id: "QV1ZPO" });
488
+ }, H = async () => {
489
+ let e = V(T, void 0, v.length);
490
+ if (e) {
491
+ S({ newKey: "error" }), z(e);
492
+ return;
493
+ }
494
+ if (!M.trim()) {
495
+ S({ newValue: "error" }), z(d._({ id: "hXUWyd" }));
496
+ return;
497
+ }
498
+ L(!0);
499
+ try {
500
+ await t.compute.updateImage.mutate({
501
+ project_id: c,
502
+ imageId: u,
503
+ operations: [{
504
+ op: "add",
505
+ path: `/${T.trim()}`,
506
+ value: M.trim()
507
+ }]
508
+ }), y((e) => [{
509
+ key: T.trim(),
510
+ value: M.trim(),
511
+ isNew: !1,
512
+ isEditing: !1,
513
+ originalKey: T.trim(),
514
+ originalValue: M.trim()
515
+ }, ...e]), E(""), N(""), w(!1), S({}), z(null);
516
+ let { message: e, ...n } = Z();
517
+ _.success(e, n);
518
+ } catch (e) {
519
+ let t = g(e instanceof Error ? e.message : "Failed to create property");
520
+ z(t);
521
+ } finally {
522
+ L(!1);
523
+ }
524
+ }, U = () => {
525
+ E(""), N(""), w(!1), S({}), z(null);
526
+ }, W = (e) => {
527
+ y((t) => t.map((t, n) => n === e ? {
528
+ ...t,
529
+ isEditing: !0,
530
+ editingValue: t.value
531
+ } : {
532
+ ...t,
533
+ isEditing: !1
534
+ })), w(!1);
535
+ }, G = async (e) => {
536
+ let n = v[e], r = V(n.key, n.originalKey, e);
537
+ if (r) {
538
+ S({ [`edit-${e}`]: "error" }), z(r);
539
+ return;
540
+ }
541
+ if (!n.value.trim()) {
542
+ S({ [`edit-${e}`]: "error" }), z(d._({ id: "hXUWyd" }));
543
+ return;
544
+ }
545
+ L(!0);
546
+ try {
547
+ let r = n.value.trim(), i = n.key.trim(), a = n.originalKey !== void 0 && n.originalKey !== i ? [{
548
+ op: "add",
549
+ path: `/${i}`,
550
+ value: r
551
+ }, {
552
+ op: "remove",
553
+ path: `/${n.originalKey}`
554
+ }] : [{
555
+ op: "replace",
556
+ path: `/${i}`,
557
+ value: r
558
+ }];
559
+ await t.compute.updateImage.mutate({
560
+ project_id: c,
561
+ imageId: u,
562
+ operations: a
563
+ }), y((t) => t.map((t, i) => i === e ? {
564
+ key: n.key.trim(),
565
+ value: r,
566
+ isEditing: !1,
567
+ originalKey: n.key.trim(),
568
+ originalValue: r
569
+ } : t)), S({}), z(null);
570
+ let { message: o, ...s } = Q();
571
+ _.success(o, s);
572
+ } catch (e) {
573
+ let t = g(e instanceof Error ? e.message : "Failed to update property");
574
+ z(t);
575
+ } finally {
576
+ L(!1);
577
+ }
578
+ }, K = (e) => {
579
+ y((t) => t.map((t, n) => n === e ? {
580
+ ...t,
581
+ isEditing: !1,
582
+ key: t.originalKey ?? t.key,
583
+ value: t.editingValue ?? t.value
584
+ } : t)), S({}), z(null);
585
+ }, q = async (e) => {
586
+ let n = v[e];
587
+ L(!0);
588
+ try {
589
+ await t.compute.updateImage.mutate({
590
+ project_id: c,
591
+ imageId: u,
592
+ operations: [{
593
+ op: "remove",
594
+ path: `/${n.key}`
595
+ }]
596
+ }), y((t) => t.filter((t, n) => n !== e)), S({}), z(null);
597
+ let { message: r, ...i } = ne();
598
+ _.success(r, i);
599
+ } catch (e) {
600
+ let t = g(e instanceof Error ? e.message : "Failed to delete property");
601
+ z(t);
602
+ } finally {
603
+ L(!1);
604
+ }
605
+ }, J = (e, t) => {
606
+ y((n) => n.map((n, r) => r === e ? {
607
+ ...n,
608
+ key: t
609
+ } : n)), x[`edit-${e}`] && (S((t) => {
610
+ let n = { ...t };
611
+ return delete n[`edit-${e}`], n;
612
+ }), z(null));
613
+ }, Y = (e, t) => {
614
+ y((n) => n.map((n, r) => r === e ? {
615
+ ...n,
616
+ value: t
617
+ } : n)), x[`edit-${e}`] && (S((t) => {
618
+ let n = { ...t };
619
+ return delete n[`edit-${e}`], n;
620
+ }), z(null));
621
+ };
622
+ return /*#__PURE__*/ k(l, {
623
+ open: !0,
624
+ onCancel: () => {
625
+ F || (w(!1), E(""), N(""), S({}), z(null), r());
626
+ },
627
+ size: "xl",
628
+ title: s ? d._({ id: "SIfYq6" }) : d._({ id: "0K+QVi" }),
629
+ cancelButtonLabel: d._({ id: "yz7wBu" }),
630
+ disableCancelButton: F,
631
+ children: /*#__PURE__*/ A("div", { children: [
632
+ R && /*#__PURE__*/ k(n, {
633
+ variant: "error",
634
+ text: R,
635
+ className: "mb-4"
636
+ }),
637
+ s && /*#__PURE__*/ k(i, {
638
+ direction: "horizontal",
639
+ className: "mb-4 justify-end p-2",
640
+ children: /*#__PURE__*/ k(f, {
641
+ label: d._({ id: "sWBLli" }),
642
+ onClick: () => w(!0),
643
+ disabled: B
644
+ })
645
+ }),
646
+ v.length === 0 && !C ? /*#__PURE__*/ k("p", {
647
+ className: "jn:text-theme-light py-8 text-center",
648
+ children: s ? d._({ id: "t1POAD" }) : d._({ id: "FqjOoy" })
649
+ }) : /*#__PURE__*/ A(b, {
650
+ className: "mb-6",
651
+ alignTerms: "left",
652
+ children: [/*#__PURE__*/ k(O, { children: C && /*#__PURE__*/ A(O, { children: [/*#__PURE__*/ k(h, { children: /*#__PURE__*/ k(m, {
653
+ value: T,
654
+ onChange: (e) => {
655
+ E(e.target.value), x.newKey && (S((e) => {
656
+ let t = { ...e };
657
+ return delete t.newKey, t;
658
+ }), z(null));
659
+ },
660
+ invalid: !!x.newKey,
661
+ autoFocus: !0,
662
+ disabled: F
663
+ }) }), /*#__PURE__*/ k(e, { children: /*#__PURE__*/ A(i, {
664
+ direction: "horizontal",
665
+ gap: "2",
666
+ alignment: "center",
667
+ className: "justify-between",
668
+ children: [/*#__PURE__*/ k("div", {
669
+ className: "flex-1",
670
+ children: /*#__PURE__*/ k(m, {
671
+ value: M,
672
+ onChange: (e) => {
673
+ N(e.target.value), x.newValue && (S((e) => {
674
+ let t = { ...e };
675
+ return delete t.newValue, t;
676
+ }), z(null));
677
+ },
678
+ invalid: !!x.newValue,
679
+ disabled: F
680
+ })
681
+ }), /*#__PURE__*/ A(i, {
682
+ direction: "horizontal",
683
+ gap: "2",
684
+ className: "shrink-0",
685
+ children: [/*#__PURE__*/ k(f, {
686
+ size: "small",
687
+ variant: "primary",
688
+ onClick: () => {
689
+ console.log("Save button clicked"), H();
690
+ },
691
+ icon: "check",
692
+ title: d._({ id: "tfDRzk" }),
693
+ disabled: !T.trim() || F
694
+ }), /*#__PURE__*/ k(f, {
695
+ size: "small",
696
+ variant: "subdued",
697
+ onClick: U,
698
+ icon: "close",
699
+ title: d._({ id: "bzSI52" }),
700
+ disabled: F
701
+ })]
702
+ })]
703
+ }) })] }) }), /*#__PURE__*/ k(O, { children: v.map((t, n) => /*#__PURE__*/ A(j.Fragment, { children: [/*#__PURE__*/ k(h, { children: t.isEditing ? /*#__PURE__*/ k(m, {
704
+ value: t.key,
705
+ onChange: (e) => J(n, e.target.value),
706
+ invalid: !!x[`edit-${n}`],
707
+ disabled: F
708
+ }) : /*#__PURE__*/ k("span", {
709
+ className: "jn:text-theme-high block max-w-xs truncate",
710
+ title: t.key,
711
+ children: t.key
712
+ }) }), /*#__PURE__*/ k(e, {
713
+ className: "flex items-center justify-between gap-2",
714
+ children: t.isEditing ? /*#__PURE__*/ A(O, { children: [/*#__PURE__*/ k("div", {
715
+ className: "flex-1",
716
+ children: /*#__PURE__*/ k(m, {
717
+ value: t.value,
718
+ onChange: (e) => Y(n, e.target.value),
719
+ invalid: !!x[`edit-${n}`],
720
+ disabled: F
721
+ })
722
+ }), /*#__PURE__*/ A(i, {
723
+ direction: "horizontal",
724
+ gap: "2",
725
+ className: "shrink-0",
726
+ children: [/*#__PURE__*/ k(f, {
727
+ size: "small",
728
+ variant: "primary",
729
+ onClick: () => G(n),
730
+ icon: "check",
731
+ title: d._({ id: "tfDRzk" }),
732
+ disabled: F
733
+ }), /*#__PURE__*/ k(f, {
734
+ size: "small",
735
+ variant: "subdued",
736
+ onClick: () => K(n),
737
+ icon: "close",
738
+ title: d._({ id: "bzSI52" }),
739
+ disabled: F
740
+ })]
741
+ })] }) : /*#__PURE__*/ A(O, { children: [/*#__PURE__*/ k("span", {
742
+ className: "jn:text-theme-default block max-w-md truncate",
743
+ title: t.value,
744
+ children: t.value
745
+ }), s && /*#__PURE__*/ A(i, {
746
+ direction: "horizontal",
747
+ gap: "2",
748
+ children: [/*#__PURE__*/ k(f, {
749
+ size: "small",
750
+ variant: "subdued",
751
+ onClick: () => W(n),
752
+ icon: "edit",
753
+ "data-testid": `edit-${t.key}`,
754
+ title: d._({ id: "ePK91l" }),
755
+ disabled: B
756
+ }), /*#__PURE__*/ k(f, {
757
+ size: "small",
758
+ onClick: () => q(n),
759
+ icon: "deleteForever",
760
+ "aria-label": d._({ id: "cnGeoo" }),
761
+ "data-testid": `delete-${t.key}`,
762
+ title: d._({ id: "cnGeoo" }),
763
+ disabled: B
764
+ })]
765
+ })] })
766
+ })] }, `${t.originalKey}-${n}`)) })]
767
+ })
768
+ ] })
769
+ });
770
+ }
771
+ var Te = ({ client: e, image: t, isOpen: n, canEdit: r = !0, onClose: i, projectId: a }) => {
772
+ let { i18n: o, _: s } = I(), { translateError: c } = D(), [u, d] = P(null), [f, p] = P(!1), [m, h] = P(null);
773
+ M(() => {
774
+ if (!n || !a) {
775
+ d(null), h(null);
776
+ return;
777
+ }
778
+ let t = !1;
779
+ return p(!0), h(null), (async () => {
780
+ try {
781
+ let n = await e.compute.getImageMetadataExcludedProperties.query({ project_id: a });
782
+ if (t) return;
783
+ d(n);
784
+ } catch (e) {
785
+ if (t) return;
786
+ h(e instanceof Error ? e.message : "Failed to Load Metadata Configuration");
787
+ } finally {
788
+ t || p(!1);
789
+ }
790
+ })(), () => {
791
+ t = !0;
792
+ };
793
+ }, [n, a]);
794
+ let g = N(() => new Set((u ?? []).map((e) => e.toLowerCase())), [u]), _ = N(() => Ce(t, g), [
795
+ t.id,
796
+ t.updated_at,
797
+ g
798
+ ]);
799
+ return n ? f ? /*#__PURE__*/ k(l, {
800
+ open: !0,
801
+ onCancel: i,
802
+ size: "xl",
803
+ title: r ? o._({ id: "SIfYq6" }) : o._({ id: "0K+QVi" }),
804
+ children: /*#__PURE__*/ k(y, {
805
+ status: "progress",
806
+ title: o._({ id: "5flpDm" }),
807
+ className: "mt-0"
808
+ })
809
+ }) : m ? /*#__PURE__*/ k(l, {
810
+ open: !0,
811
+ onCancel: i,
812
+ size: "xl",
813
+ title: r ? o._({ id: "SIfYq6" }) : o._({ id: "0K+QVi" }),
814
+ children: /*#__PURE__*/ k(y, {
815
+ status: "error",
816
+ title: o._({ id: "0BBnkg" }),
817
+ body: c(m),
818
+ className: "mt-0"
819
+ })
820
+ }) : /*#__PURE__*/ k(we, {
821
+ client: e,
822
+ onClose: i,
823
+ initialMetadata: _,
824
+ excludedProperties: g,
825
+ canEdit: r,
826
+ projectId: a,
827
+ imageId: t.id
828
+ }) : null;
829
+ }, $ = ({ image: t, isOpen: n, isLoading: r, isDisabled: a, onClose: o, onDelete: s }) => {
830
+ if (!t) return null;
831
+ let { i18n: c, _: d } = I(), { trackClose: f, markSubmitted: p, resetTracking: g } = E({
832
+ isOpen: n,
833
+ actionPrefix: "compute.image.delete"
834
+ }), _ = L.object({ confirm: L.string().refine((e) => e === "delete", { message: c._({ id: "QytzQr" }) }) }), y = R({
835
+ defaultValues: { confirm: "" },
836
+ validators: { onSubmit: _ },
837
+ onSubmit: async () => {
838
+ r || a || (p(), s(t), S());
839
+ }
840
+ }), x = z(y.store, (e) => e.isSubmitting || e.values.confirm !== "delete"), S = () => {
841
+ f(), y.reset(), g(), o();
842
+ }, C = r ? c._({ id: "EF2EU9" }) : c._({ id: "KWa0gi" }), w = t?.name || t?.id;
843
+ return /*#__PURE__*/ k(l, {
844
+ open: n,
845
+ onCancel: S,
846
+ size: "small",
847
+ title: c._({
848
+ id: "XbeFW9",
849
+ values: { imageName: w }
850
+ }),
851
+ confirmButtonLabel: C,
852
+ confirmButtonVariant: "primary-danger",
853
+ onConfirm: y.handleSubmit,
854
+ cancelButtonLabel: c._({ id: "dEgA5A" }),
855
+ disableConfirmButton: x || r || a,
856
+ disableCancelButton: r,
857
+ disableCloseButton: r,
858
+ children: /*#__PURE__*/ A(i, {
859
+ direction: "vertical",
860
+ gap: "4",
861
+ children: [
862
+ /*#__PURE__*/ k("p", {
863
+ className: "text-theme-default",
864
+ children: /*#__PURE__*/ k(F, { id: "2zceEg" })
865
+ }),
866
+ t && /*#__PURE__*/ A(b, { children: [
867
+ /*#__PURE__*/ k(h, { children: c._({ id: "6YtxFj" }) }),
868
+ /*#__PURE__*/ k(e, { children: t.name || c._({ id: "MEIAzV" }) }),
869
+ /*#__PURE__*/ k(h, { children: c._({ id: "dFb5Nt" }) }),
870
+ /*#__PURE__*/ k(e, { children: t.id }),
871
+ /*#__PURE__*/ k(h, { children: c._({ id: "uAQUqI" }) }),
872
+ /*#__PURE__*/ k(e, { children: t.status }),
873
+ /*#__PURE__*/ k(h, { children: c._({ id: "2q/Q7x" }) }),
874
+ /*#__PURE__*/ k(e, { children: t.visibility }),
875
+ /*#__PURE__*/ k(h, { children: c._({ id: "Cj2Gtd" }) }),
876
+ /*#__PURE__*/ k(e, { children: /*#__PURE__*/ k(B, { size: t.size }) }),
877
+ /*#__PURE__*/ k(h, { children: c._({ id: "NopYGU" }) }),
878
+ /*#__PURE__*/ k(e, { children: t.disk_format || c._({ id: "fj5byd" }) }),
879
+ /*#__PURE__*/ k(h, { children: c._({ id: "d+F6q9" }) }),
880
+ /*#__PURE__*/ k(e, { children: t.created_at ? new Date(t.created_at).toLocaleDateString() : c._({ id: "fj5byd" }) })
881
+ ] }),
882
+ /*#__PURE__*/ k(u, {
883
+ className: "mb-0",
884
+ id: "delete-image-form",
885
+ onSubmit: (e) => {
886
+ e.preventDefault(), y.handleSubmit();
887
+ },
888
+ children: /*#__PURE__*/ k(v, { children: /*#__PURE__*/ k(y.Field, {
889
+ name: "confirm",
890
+ children: (e) => /*#__PURE__*/ k(m, {
891
+ id: e.name,
892
+ name: e.name,
893
+ label: c._({ id: "QytzQr" }),
894
+ value: e.state.value,
895
+ onChange: (t) => e.handleChange(t.target.value),
896
+ autoFocus: !0,
897
+ disabled: r,
898
+ required: !0
899
+ })
900
+ }) })
901
+ })
902
+ ]
903
+ })
904
+ });
905
+ }, Ee = ({ image: t, isOpen: n, isLoading: r, onClose: i, onActivate: a }) => {
906
+ if (!t) return null;
907
+ let { i18n: o, _: s } = I();
908
+ return /*#__PURE__*/ k(l, {
909
+ onCancel: i,
910
+ size: "small",
911
+ title: o._({ id: "RSFkXF" }),
912
+ open: n,
913
+ onConfirm: (e) => {
914
+ e.preventDefault(), a(t);
915
+ },
916
+ confirmButtonLabel: o._({ id: "FQBaXG" }),
917
+ cancelButtonLabel: o._({ id: "dEgA5A" }),
918
+ disableConfirmButton: r,
919
+ disableCancelButton: r,
920
+ disableCloseButton: r,
921
+ children: r ? /*#__PURE__*/ k(y, {
922
+ status: "progress",
923
+ title: o._({ id: "1zdNju" }),
924
+ className: "mt-0"
925
+ }) : /*#__PURE__*/ A(O, { children: [/*#__PURE__*/ k("p", {
926
+ className: "mb-4",
927
+ children: o._({ id: "+NwLgN" })
928
+ }), /*#__PURE__*/ A(b, { children: [
929
+ /*#__PURE__*/ k(h, { children: o._({ id: "6YtxFj" }) }),
930
+ /*#__PURE__*/ k(e, { children: t.name || o._({ id: "MEIAzV" }) }),
931
+ /*#__PURE__*/ k(h, { children: o._({ id: "dFb5Nt" }) }),
932
+ /*#__PURE__*/ k(e, { children: t.id }),
933
+ /*#__PURE__*/ k(h, { children: o._({ id: "uAQUqI" }) }),
934
+ /*#__PURE__*/ k(e, { children: t.status }),
935
+ /*#__PURE__*/ k(h, { children: o._({ id: "2q/Q7x" }) }),
936
+ /*#__PURE__*/ k(e, { children: t.visibility }),
937
+ /*#__PURE__*/ k(h, { children: o._({ id: "Cj2Gtd" }) }),
938
+ /*#__PURE__*/ k(e, { children: /*#__PURE__*/ k(B, { size: t.size }) }),
939
+ /*#__PURE__*/ k(h, { children: o._({ id: "NopYGU" }) }),
940
+ /*#__PURE__*/ k(e, { children: t.disk_format || o._({ id: "fj5byd" }) }),
941
+ /*#__PURE__*/ k(h, { children: o._({ id: "d+F6q9" }) }),
942
+ /*#__PURE__*/ k(e, { children: (() => {
943
+ let e = new Date(t.created_at ?? "");
944
+ return isNaN(e.getTime()) ? o._({ id: "fj5byd" }) : e.toLocaleDateString();
945
+ })() })
946
+ ] })] })
947
+ });
948
+ }, De = ({ image: t, isOpen: n, isLoading: r, onClose: i, onDeactivate: a }) => {
949
+ if (!t) return null;
950
+ let { i18n: o, _: s } = I();
951
+ return /*#__PURE__*/ k(l, {
952
+ onCancel: i,
953
+ size: "small",
954
+ title: o._({ id: "hQr1Cr" }),
955
+ open: n,
956
+ onConfirm: (e) => {
957
+ e.preventDefault(), a(t);
958
+ },
959
+ confirmButtonLabel: o._({ id: "5y3O+A" }),
960
+ cancelButtonLabel: o._({ id: "dEgA5A" }),
961
+ disableConfirmButton: r,
962
+ disableCancelButton: r,
963
+ disableCloseButton: r,
964
+ children: r ? /*#__PURE__*/ k(y, {
965
+ status: "progress",
966
+ title: o._({ id: "jhCG7a" }),
967
+ className: "mt-0"
968
+ }) : /*#__PURE__*/ A(O, { children: [/*#__PURE__*/ k("p", {
969
+ className: "mb-4",
970
+ children: o._({ id: "8TSI9h" })
971
+ }), /*#__PURE__*/ A(b, { children: [
972
+ /*#__PURE__*/ k(h, { children: o._({ id: "6YtxFj" }) }),
973
+ /*#__PURE__*/ k(e, { children: t.name || o._({ id: "MEIAzV" }) }),
974
+ /*#__PURE__*/ k(h, { children: o._({ id: "dFb5Nt" }) }),
975
+ /*#__PURE__*/ k(e, { children: t.id }),
976
+ /*#__PURE__*/ k(h, { children: o._({ id: "uAQUqI" }) }),
977
+ /*#__PURE__*/ k(e, { children: t.status }),
978
+ /*#__PURE__*/ k(h, { children: o._({ id: "2q/Q7x" }) }),
979
+ /*#__PURE__*/ k(e, { children: t.visibility }),
980
+ /*#__PURE__*/ k(h, { children: o._({ id: "Cj2Gtd" }) }),
981
+ /*#__PURE__*/ k(e, { children: /*#__PURE__*/ k(B, { size: t.size }) }),
982
+ /*#__PURE__*/ k(h, { children: o._({ id: "NopYGU" }) }),
983
+ /*#__PURE__*/ k(e, { children: t.disk_format || o._({ id: "fj5byd" }) }),
984
+ /*#__PURE__*/ k(h, { children: o._({ id: "d+F6q9" }) }),
985
+ /*#__PURE__*/ k(e, { children: (() => {
986
+ let e = new Date(t.created_at ?? "");
987
+ return isNaN(e.getTime()) ? o._({ id: "fj5byd" }) : e.toLocaleDateString();
988
+ })() })
989
+ ] })] })
990
+ });
991
+ }, Oe = ({ memberId: e, imageId: t, errors: n, isLoading: i, onMemberIdChange: a, onSave: o, onCancel: c }) => {
992
+ let { i18n: l, _: u } = I();
993
+ return /*#__PURE__*/ A(s, { children: [
994
+ /*#__PURE__*/ k(S, {}),
995
+ /*#__PURE__*/ k(S, {
996
+ className: "pl-0",
997
+ children: /*#__PURE__*/ k(m, {
998
+ label: l._({ id: "mSfwLL" }),
999
+ value: e,
1000
+ onChange: (e) => a(e.target.value),
1001
+ errortext: n.memberId,
1002
+ required: !0
1003
+ })
1004
+ }),
1005
+ /*#__PURE__*/ k(S, {
1006
+ className: "break-all",
1007
+ children: t
1008
+ }),
1009
+ /*#__PURE__*/ k(S, { children: /*#__PURE__*/ A(r, { children: [/*#__PURE__*/ k(f, {
1010
+ icon: "check",
1011
+ onClick: o,
1012
+ variant: "primary",
1013
+ title: l._({ id: "3Qn0me" }),
1014
+ disabled: i
1015
+ }), /*#__PURE__*/ k(f, {
1016
+ icon: "cancel",
1017
+ onClick: c,
1018
+ title: l._({ id: "dEgA5A" }),
1019
+ disabled: i
1020
+ })] }) })
1021
+ ] });
1022
+ }, ke = ({ member: e, isDeleting: n, onDelete: r, canDelete: a }) => {
1023
+ let { i18n: o, _: c } = I();
1024
+ return /*#__PURE__*/ A(s, { children: [
1025
+ /*#__PURE__*/ k(S, {
1026
+ className: "break-all",
1027
+ children: ((e) => {
1028
+ switch (e) {
1029
+ case V.PENDING: return o._({ id: "UbRKMZ" });
1030
+ case V.ACCEPTED: return o._({ id: "bzMKg7" });
1031
+ case V.REJECTED: return o._({ id: "ekCRTP" });
1032
+ default: return e;
1033
+ }
1034
+ })(e.status)
1035
+ }),
1036
+ /*#__PURE__*/ k(S, {
1037
+ className: "break-all",
1038
+ children: e.member_id
1039
+ }),
1040
+ /*#__PURE__*/ k(S, {
1041
+ className: "break-all",
1042
+ children: e.image_id
1043
+ }),
1044
+ /*#__PURE__*/ k(S, { children: n ? /*#__PURE__*/ k(i, {
1045
+ distribution: "center",
1046
+ alignment: "center",
1047
+ children: /*#__PURE__*/ k(t, { variant: "primary" })
1048
+ }) : /*#__PURE__*/ k(i, {
1049
+ distribution: "end",
1050
+ alignment: "end",
1051
+ children: (() => {
1052
+ if (!a) return /*#__PURE__*/ k(O, {});
1053
+ let t = e.member_id;
1054
+ return /*#__PURE__*/ k(f, {
1055
+ icon: "deleteForever",
1056
+ onClick: r,
1057
+ title: o._({
1058
+ id: "pebLmQ",
1059
+ values: { memberIdDisplay: t }
1060
+ }),
1061
+ "aria-label": o._({
1062
+ id: "pebLmQ",
1063
+ values: { memberIdDisplay: t }
1064
+ }),
1065
+ "data-testid": `remove-${t}`,
1066
+ disabled: n
1067
+ });
1068
+ })()
1069
+ }) })
1070
+ ] });
1071
+ }, Ae = ({ image: e, imageMembers: t, isMembersLoading: r, canAdd: a, canRemove: c, isAddingMember: l, setIsAddingMember: u, setMessage: d, projectId: p }) => {
1072
+ let { i18n: m, _: h } = I(), _ = C.useUtils(), [v, b] = P(""), [x, w] = P({}), [T, E] = P(/* @__PURE__ */ new Set()), D = C.compute.createImageMember.useMutation({ onSuccess: () => {
1073
+ _.compute.listImageMembers.invalidate({
1074
+ project_id: p,
1075
+ imageId: e.id
1076
+ });
1077
+ } }), j = C.compute.deleteImageMember.useMutation({ onSuccess: () => {
1078
+ _.compute.listImageMembers.invalidate({
1079
+ project_id: p,
1080
+ imageId: e.id
1081
+ });
1082
+ } }), M = e.visibility === "public", N = !t || t.length === 0, F = D.isPending || j.isPending, L = t ? [...t].sort((e, t) => {
1083
+ let n = {
1084
+ pending: 0,
1085
+ accepted: 1,
1086
+ rejected: 2
1087
+ }, r = n[e.status] ?? 3, i = n[t.status] ?? 3;
1088
+ return r === i ? e.member_id.localeCompare(t.member_id) : r - i;
1089
+ }) : [], R = () => {
1090
+ let e = v.trim(), n = {};
1091
+ return e ? t?.some((t) => t.member_id === e) && (n.memberId = m._({ id: "jyqLKs" })) : n.memberId = m._({ id: "QFPSXA" }), w(n), Object.keys(n).length === 0;
1092
+ }, z = () => {
1093
+ b(""), w({});
1094
+ }, B = async () => {
1095
+ if (!R()) {
1096
+ d({
1097
+ text: m._({ id: "CBFSfX" }),
1098
+ type: "error"
1099
+ });
1100
+ return;
1101
+ }
1102
+ let t = v.trim();
1103
+ try {
1104
+ await D.mutateAsync({
1105
+ project_id: p,
1106
+ imageId: e.id,
1107
+ member: t
1108
+ }), d({
1109
+ text: m._({
1110
+ id: "Sgz1vJ",
1111
+ values: { trimmedMemberId: t }
1112
+ }),
1113
+ type: "info"
1114
+ }), z(), u(!1);
1115
+ } catch (e) {
1116
+ d({
1117
+ text: e?.message || m._({ id: "9doWrf" }),
1118
+ type: "error"
1119
+ });
1120
+ }
1121
+ }, V = async (t) => {
1122
+ E((e) => new Set(e).add(t));
1123
+ try {
1124
+ await j.mutateAsync({
1125
+ project_id: p,
1126
+ imageId: e.id,
1127
+ memberId: t
1128
+ }), d({
1129
+ text: m._({
1130
+ id: "4O2AH3",
1131
+ values: { memberIdToRemove: t }
1132
+ }),
1133
+ type: "info"
1134
+ });
1135
+ } catch (e) {
1136
+ d({
1137
+ text: e?.message || m._({ id: "n46oLW" }) || m._({
1138
+ id: "7T1fHv",
1139
+ values: { memberIdToRemove: t }
1140
+ }),
1141
+ type: "error"
1142
+ });
1143
+ } finally {
1144
+ E((e) => {
1145
+ let n = new Set(e);
1146
+ return n.delete(t), n;
1147
+ });
1148
+ }
1149
+ };
1150
+ return r ? /*#__PURE__*/ A(g, {
1151
+ columns: 4,
1152
+ children: [/*#__PURE__*/ A(s, { children: [
1153
+ /*#__PURE__*/ k(o, { children: m._({ id: "uAQUqI" }) }),
1154
+ /*#__PURE__*/ k(o, { children: m._({ id: "mSfwLL" }) }),
1155
+ /*#__PURE__*/ k(o, { children: m._({ id: "vrPCbw" }) }),
1156
+ /*#__PURE__*/ k(o, {})
1157
+ ] }), /*#__PURE__*/ k(s, { children: /*#__PURE__*/ k(S, {
1158
+ colSpan: 4,
1159
+ children: /*#__PURE__*/ k(y, {
1160
+ status: "progress",
1161
+ title: m._({ id: "Z3FXyt" })
1162
+ })
1163
+ }) })]
1164
+ }) : M ? /*#__PURE__*/ k(n, {
1165
+ text: m._({ id: "6H/Lg1" }),
1166
+ variant: "info"
1167
+ }) : /*#__PURE__*/ A(O, { children: [a && /*#__PURE__*/ k(i, {
1168
+ direction: "horizontal",
1169
+ className: "bg-theme-background-lvl-1 justify-end p-2",
1170
+ children: /*#__PURE__*/ k(f, {
1171
+ label: m._({ id: "VCM3KS" }),
1172
+ "data-testid": "addMemberButton",
1173
+ onClick: () => u(!0),
1174
+ disabled: l
1175
+ })
1176
+ }), /*#__PURE__*/ A(g, {
1177
+ columns: 4,
1178
+ children: [
1179
+ /*#__PURE__*/ A(s, { children: [
1180
+ /*#__PURE__*/ k(o, { children: m._({ id: "uAQUqI" }) }),
1181
+ /*#__PURE__*/ k(o, { children: m._({ id: "mSfwLL" }) }),
1182
+ /*#__PURE__*/ k(o, { children: m._({ id: "vrPCbw" }) }),
1183
+ /*#__PURE__*/ k(o, {})
1184
+ ] }),
1185
+ l && /*#__PURE__*/ k(Oe, {
1186
+ memberId: v,
1187
+ imageId: e.id,
1188
+ errors: x,
1189
+ isLoading: F,
1190
+ onMemberIdChange: (e) => {
1191
+ b(e), x.memberId && w((e) => ({
1192
+ ...e,
1193
+ memberId: void 0
1194
+ }));
1195
+ },
1196
+ onSave: B,
1197
+ onCancel: () => {
1198
+ z(), u(!1), d(null);
1199
+ }
1200
+ }),
1201
+ L.map((e, t) => /*#__PURE__*/ k(ke, {
1202
+ member: e,
1203
+ isDeleting: T.has(e.member_id),
1204
+ onDelete: () => V(e.member_id),
1205
+ canDelete: c
1206
+ }, `${e.member_id}-${t}`)),
1207
+ N && !l && /*#__PURE__*/ k(s, { children: /*#__PURE__*/ k(S, {
1208
+ colSpan: 4,
1209
+ className: "text-theme-default py-4 text-center",
1210
+ children: m._({ id: "H7u085" })
1211
+ }) })
1212
+ ]
1213
+ })] });
1214
+ }, je = ({ isOpen: e, onClose: t, image: r, permissions: { canCreateMember: i, canDeleteMember: a } }) => {
1215
+ let { i18n: o, _: s } = I(), c = w(), [u, d] = P(null), [f, p] = P(!1), { data: m, isLoading: h } = C.compute.listImageMembers.useQuery({
1216
+ project_id: c,
1217
+ imageId: r?.id || ""
1218
+ }, { enabled: e && !!r?.id }), g = () => {
1219
+ d(null), p(!1), t();
1220
+ };
1221
+ if (!e || !r) return null;
1222
+ let _ = r.name || r.id;
1223
+ return /*#__PURE__*/ k(l, {
1224
+ onCancel: g,
1225
+ title: o._({
1226
+ id: "UQ7Wyv",
1227
+ values: { imageName: _ }
1228
+ }),
1229
+ open: e,
1230
+ size: "xl",
1231
+ children: /*#__PURE__*/ A("div", { children: [u && /*#__PURE__*/ k(n, {
1232
+ onDismiss: () => d(null),
1233
+ text: u.text,
1234
+ variant: u.type,
1235
+ className: "mb-4"
1236
+ }), /*#__PURE__*/ k(Ae, {
1237
+ projectId: c,
1238
+ image: r,
1239
+ imageMembers: m,
1240
+ isMembersLoading: h,
1241
+ canAdd: i,
1242
+ canRemove: a,
1243
+ isAddingMember: f,
1244
+ setIsAddingMember: p,
1245
+ setMessage: d
1246
+ })] })
1247
+ });
1248
+ };
1249
+ //#endregion
1250
+ //#region src/client/routes/_auth/projects/$projectId/compute/images/-utils/imageHelpers.ts
1251
+ function Me(e, t) {
1252
+ let n = [];
1253
+ return Object.entries(e).forEach(([e, r]) => {
1254
+ let i = `/${e}`;
1255
+ r == null ? e in t && n.push({
1256
+ op: "remove",
1257
+ path: i
1258
+ }) : e in t ? n.push({
1259
+ op: "replace",
1260
+ path: i,
1261
+ value: r
1262
+ }) : n.push({
1263
+ op: "add",
1264
+ path: i,
1265
+ value: r
1266
+ });
1267
+ }), n;
1268
+ }
1269
+ //#endregion
1270
+ export { xe as A, ce as C, J as D, te as E, H as F, U as I, V as L, K as M, G as N, q as O, W as P, B as R, oe as S, re as T, ve as _, $ as a, ee as b, me as c, _e as d, he as f, ye as g, le as h, Ee as i, be as j, X as k, fe as l, de as m, je as n, Te as o, ue as p, De as r, pe as s, Me as t, ge as u, ae as v, ie as w, Y as x, se as y };
1271
+
1272
+ //# sourceMappingURL=imageHelpers-DBhL2ebL.mjs.map