@cobaltcore-dev/aurora 0.2.2 → 0.3.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 (130) hide show
  1. package/dist/client/AuroraApp.d.ts +10 -0
  2. package/dist/client/{ContentHeader-DtBiIwRY.mjs → ContentHeader-BXZoN3B9.mjs} +15 -15
  3. package/dist/client/{ContentHeader-DtBiIwRY.mjs.map → ContentHeader-BXZoN3B9.mjs.map} +1 -1
  4. package/dist/client/{DeleteFlavorModal-rmuYIafD.mjs → DeleteFlavorModal-BusYn32r.mjs} +148 -148
  5. package/dist/client/{DeleteFlavorModal-rmuYIafD.mjs.map → DeleteFlavorModal-BusYn32r.mjs.map} +1 -1
  6. package/dist/client/{EditSecurityGroupModal-B7Sz9puM.mjs → EditSecurityGroupModal-Dl6m7wUe.mjs} +16 -16
  7. package/dist/client/{EditSecurityGroupModal-B7Sz9puM.mjs.map → EditSecurityGroupModal-Dl6m7wUe.mjs.map} +1 -1
  8. package/dist/client/FiltersInput-BgNaHFBt.mjs +81 -0
  9. package/dist/client/FiltersInput-BgNaHFBt.mjs.map +1 -0
  10. package/dist/client/{FloatingIpActionModals-CfRJiZqD.mjs → FloatingIpActionModals-By2hXR9m.mjs} +51 -51
  11. package/dist/client/{FloatingIpActionModals-CfRJiZqD.mjs.map → FloatingIpActionModals-By2hXR9m.mjs.map} +1 -1
  12. package/dist/client/{ImageToastNotifications-Cw30RXsw.mjs → ImageToastNotifications-fHI8jB2j.mjs} +369 -369
  13. package/dist/client/{ImageToastNotifications-Cw30RXsw.mjs.map → ImageToastNotifications-fHI8jB2j.mjs.map} +1 -1
  14. package/dist/client/ListToolbar-BvtCo8dk.mjs +129 -0
  15. package/dist/client/ListToolbar-BvtCo8dk.mjs.map +1 -0
  16. package/dist/client/{RouteError-Cyto623-.mjs → RouteError-pDEWC_k7.mjs} +2 -2
  17. package/dist/client/{RouteError-Cyto623-.mjs.map → RouteError-pDEWC_k7.mjs.map} +1 -1
  18. package/dist/client/SortInput-DXWSqSny.mjs +34 -0
  19. package/dist/client/SortInput-DXWSqSny.mjs.map +1 -0
  20. package/dist/client/{_flavorId-B-1fYadl.mjs → _flavorId-BRonXvCo.mjs} +46 -46
  21. package/dist/client/_flavorId-BRonXvCo.mjs.map +1 -0
  22. package/dist/client/{_flavorId-BYfIHIV_.mjs → _flavorId-BoNcxYmF.mjs} +10 -10
  23. package/dist/client/_flavorId-BoNcxYmF.mjs.map +1 -0
  24. package/dist/client/_floatingIpId-BpUfL8Im2.mjs +228 -0
  25. package/dist/client/_floatingIpId-BpUfL8Im2.mjs.map +1 -0
  26. package/dist/client/{_floatingIpId-IrnN-ozB.mjs → _floatingIpId-CwHiXazi.mjs} +2 -2
  27. package/dist/client/{_floatingIpId-IrnN-ozB.mjs.map → _floatingIpId-CwHiXazi.mjs.map} +1 -1
  28. package/dist/client/{_imageId-Tx_9bqEc.mjs → _imageId-CdOOJjw0.mjs} +158 -158
  29. package/dist/client/_imageId-CdOOJjw0.mjs.map +1 -0
  30. package/dist/client/{_pcaId-CFuKY82d.mjs → _pcaId-CwlH1Kvl.mjs} +132 -132
  31. package/dist/client/{_pcaId-CFuKY82d.mjs.map → _pcaId-CwlH1Kvl.mjs.map} +1 -1
  32. package/dist/client/{_pcaId-Bck7S7gJ.mjs → _pcaId-D1ZEaCdp.mjs} +2 -2
  33. package/dist/client/{_pcaId-Bck7S7gJ.mjs.map → _pcaId-D1ZEaCdp.mjs.map} +1 -1
  34. package/dist/client/_projectId-D1gGribM.mjs +316 -0
  35. package/dist/client/_projectId-D1gGribM.mjs.map +1 -0
  36. package/dist/client/{_projectId-PSpuCKO7.mjs → _projectId-DhLpIalx.mjs} +9 -9
  37. package/dist/client/{_projectId-PSpuCKO7.mjs.map → _projectId-DhLpIalx.mjs.map} +1 -1
  38. package/dist/client/{_projectId-B1VjDd0Z.mjs → _projectId-Dj_InfSc.mjs} +3 -3
  39. package/dist/client/{_projectId-B1VjDd0Z.mjs.map → _projectId-Dj_InfSc.mjs.map} +1 -1
  40. package/dist/client/{_projectId-Pxp-RXK4.mjs → _projectId-OW2xkK43.mjs} +2 -2
  41. package/dist/client/{_projectId-Pxp-RXK4.mjs.map → _projectId-OW2xkK43.mjs.map} +1 -1
  42. package/dist/client/{_securityGroupId-VV2lUcGQ.mjs → _securityGroupId-B0llWH9A.mjs} +2 -2
  43. package/dist/client/{_securityGroupId-VV2lUcGQ.mjs.map → _securityGroupId-B0llWH9A.mjs.map} +1 -1
  44. package/dist/client/{_securityGroupId-Dqi6ddw4.mjs → _securityGroupId-gbUnd5Wv.mjs} +363 -363
  45. package/dist/client/{_securityGroupId-Dqi6ddw4.mjs.map → _securityGroupId-gbUnd5Wv.mjs.map} +1 -1
  46. package/dist/client/{about-B2AzqxFI.mjs → about-DCe6LsKz.mjs} +8 -8
  47. package/dist/client/{about-B2AzqxFI.mjs.map → about-DCe6LsKz.mjs.map} +1 -1
  48. package/dist/client/{build-Cf7iWbpH.mjs → build-BJDfnAyi.mjs} +1573 -1564
  49. package/dist/client/{build-Cf7iWbpH.mjs.map → build-BJDfnAyi.mjs.map} +1 -1
  50. package/dist/client/{buildFilterParams-ngVK3ybs.mjs → buildFilterParams-By33pG59.mjs} +1 -1
  51. package/dist/client/{buildFilterParams-ngVK3ybs.mjs.map → buildFilterParams-By33pG59.mjs.map} +1 -1
  52. package/dist/client/{constants-CCgR6fKI.mjs → constants-CAjjRTo_.mjs} +9 -9
  53. package/dist/client/{constants-CCgR6fKI.mjs.map → constants-CAjjRTo_.mjs.map} +1 -1
  54. package/dist/client/{containers-BWERuY0O.mjs → containers-BuXUVb1N.mjs} +811 -811
  55. package/dist/client/{containers-BWERuY0O.mjs.map → containers-BuXUVb1N.mjs.map} +1 -1
  56. package/dist/client/{containers-Cs5vOeR2.mjs → containers-Ca5V1EBS.mjs} +1 -1
  57. package/dist/client/containers-Ca5V1EBS.mjs.map +1 -0
  58. package/dist/client/{containers-DovytjVP.mjs → containers-NW7RnHTI.mjs} +6 -6
  59. package/dist/client/containers-NW7RnHTI.mjs.map +1 -0
  60. package/dist/client/flavors-BXPYAFyQ.mjs.map +1 -1
  61. package/dist/client/{flavors-CUiALHcB.mjs → flavors-D8oElC2K.mjs} +2 -2
  62. package/dist/client/{flavors-CUiALHcB.mjs.map → flavors-D8oElC2K.mjs.map} +1 -1
  63. package/dist/client/flavors-qvgPSI7J.mjs +613 -0
  64. package/dist/client/flavors-qvgPSI7J.mjs.map +1 -0
  65. package/dist/client/{floatingips-BrjDiY2t.mjs → floatingips-Be3zLoaD.mjs} +126 -126
  66. package/dist/client/{floatingips-BrjDiY2t.mjs.map → floatingips-Be3zLoaD.mjs.map} +1 -1
  67. package/dist/client/{images-BZP3pBqj.mjs → images-BiEBENaj.mjs} +2 -2
  68. package/dist/client/{images-BZP3pBqj.mjs.map → images-BiEBENaj.mjs.map} +1 -1
  69. package/dist/client/images-CCYBAphP2.mjs +1900 -0
  70. package/dist/client/images-CCYBAphP2.mjs.map +1 -0
  71. package/dist/client/images-DM9I8G0p.mjs.map +1 -1
  72. package/dist/client/index.d.ts +2 -1
  73. package/dist/client/index.js +410 -412
  74. package/dist/client/index.js.map +1 -1
  75. package/dist/client/{network-SCVadZsv.mjs → network-nbSbl0X0.mjs} +1 -1
  76. package/dist/client/{network-SCVadZsv.mjs.map → network-nbSbl0X0.mjs.map} +1 -1
  77. package/dist/client/{objects-D4zBka5e.mjs → objects-CU5ws07o.mjs} +6 -6
  78. package/dist/client/objects-CU5ws07o.mjs.map +1 -0
  79. package/dist/client/objects-FXN0VWLI.mjs +4760 -0
  80. package/dist/client/{objects-Cw4Vu01M.mjs.map → objects-FXN0VWLI.mjs.map} +1 -1
  81. package/dist/client/{objects-B4yrYf_a.mjs → objects-GmuIOaHd.mjs} +1 -1
  82. package/dist/client/objects-GmuIOaHd.mjs.map +1 -0
  83. package/dist/client/{overview-BtIXpYBo.mjs → overview-B3gdnWTG.mjs} +2 -2
  84. package/dist/client/{overview-BtIXpYBo.mjs.map → overview-B3gdnWTG.mjs.map} +1 -1
  85. package/dist/client/{overview-2J54-loz.mjs → overview-DzYBiNfD.mjs} +2 -2
  86. package/dist/client/{overview-2J54-loz.mjs.map → overview-DzYBiNfD.mjs.map} +1 -1
  87. package/dist/client/{overview-D0AAvsmL.mjs → overview-EhfPY8Je.mjs} +2 -2
  88. package/dist/client/{overview-D0AAvsmL.mjs.map → overview-EhfPY8Je.mjs.map} +1 -1
  89. package/dist/client/{overview-BnmukbFh.mjs → overview-XueZI4LQ.mjs} +7 -7
  90. package/dist/client/{overview-BnmukbFh.mjs.map → overview-XueZI4LQ.mjs.map} +1 -1
  91. package/dist/client/{pca-BqZycwCu.mjs → pca-DSM71LhW.mjs} +2 -2
  92. package/dist/client/{pca-BqZycwCu.mjs.map → pca-DSM71LhW.mjs.map} +1 -1
  93. package/dist/client/{pca-V2aaOxZA.mjs → pca-x9if8xU-.mjs} +59 -59
  94. package/dist/client/{pca-V2aaOxZA.mjs.map → pca-x9if8xU-.mjs.map} +1 -1
  95. package/dist/client/{projects-jyIHL6DE.mjs → projects-B6BPo2Ar.mjs} +2 -2
  96. package/dist/client/projects-B6BPo2Ar.mjs.map +1 -0
  97. package/dist/client/{projects-BsN4bvU2.mjs → projects-BilrmHLu.mjs} +1 -1
  98. package/dist/client/projects-BilrmHLu.mjs.map +1 -0
  99. package/dist/client/{projects-0feOw_b6.mjs → projects-Bt0XptpG.mjs} +2 -2
  100. package/dist/client/projects-Bt0XptpG.mjs.map +1 -0
  101. package/dist/client/projects-CnmZIB2Q.mjs +95 -0
  102. package/dist/client/projects-CnmZIB2Q.mjs.map +1 -0
  103. package/dist/client/{securitygroups-B4MkSBtI.mjs → securitygroups-BdzieS7Z.mjs} +121 -121
  104. package/dist/client/{securitygroups-B4MkSBtI.mjs.map → securitygroups-BdzieS7Z.mjs.map} +1 -1
  105. package/dist/client/{useListWithFiltering-CEDh1LO-.mjs → useListWithFiltering-CqQbAjEe.mjs} +1 -1
  106. package/dist/client/{useListWithFiltering-CEDh1LO-.mjs.map → useListWithFiltering-CqQbAjEe.mjs.map} +1 -1
  107. package/package.json +2 -2
  108. package/dist/client/ListToolbar-DuazvsAu.mjs +0 -223
  109. package/dist/client/ListToolbar-DuazvsAu.mjs.map +0 -1
  110. package/dist/client/_flavorId-B-1fYadl.mjs.map +0 -1
  111. package/dist/client/_flavorId-BYfIHIV_.mjs.map +0 -1
  112. package/dist/client/_floatingIpId-FQ5P2qMV.mjs +0 -228
  113. package/dist/client/_floatingIpId-FQ5P2qMV.mjs.map +0 -1
  114. package/dist/client/_imageId-Tx_9bqEc.mjs.map +0 -1
  115. package/dist/client/_projectId-Bs4W9hos.mjs +0 -283
  116. package/dist/client/_projectId-Bs4W9hos.mjs.map +0 -1
  117. package/dist/client/containers-Cs5vOeR2.mjs.map +0 -1
  118. package/dist/client/containers-DovytjVP.mjs.map +0 -1
  119. package/dist/client/flavors-Bovz-I2U.mjs +0 -565
  120. package/dist/client/flavors-Bovz-I2U.mjs.map +0 -1
  121. package/dist/client/images-DaaCUXMI.mjs +0 -1797
  122. package/dist/client/images-DaaCUXMI.mjs.map +0 -1
  123. package/dist/client/objects-B4yrYf_a.mjs.map +0 -1
  124. package/dist/client/objects-Cw4Vu01M.mjs +0 -4760
  125. package/dist/client/objects-D4zBka5e.mjs.map +0 -1
  126. package/dist/client/projects-0feOw_b6.mjs.map +0 -1
  127. package/dist/client/projects-BsN4bvU2.mjs.map +0 -1
  128. package/dist/client/projects-C1IYOvFQ.mjs +0 -144
  129. package/dist/client/projects-C1IYOvFQ.mjs.map +0 -1
  130. package/dist/client/projects-jyIHL6DE.mjs.map +0 -1
@@ -1,4760 +0,0 @@
1
- import { $ as e, A as t, C as n, E as r, G as i, K as a, N as o, T as s, U as c, V as l, W as u, X as d, Y as f, a as p, f as m, i as h, it as g, l as _, m as v, o as y, w as b, z as x } from "./build-Cf7iWbpH.mjs";
2
- import { n as S, r as C } from "./trpcClient-BxguzNYF.mjs";
3
- import { t as w } from "./cn-C3laVXMm.mjs";
4
- import { a as T, d as E, f as D, h as O, l as k, m as A, o as j, r as M, t as N, u as P } from "./md-BivyCkGC.mjs";
5
- import { t as F } from "./objects-D4zBka5e.mjs";
6
- import { t as I } from "./ListToolbar-DuazvsAu.mjs";
7
- import { t as L } from "./formatBytes-D6oa0wU9.mjs";
8
- import { t as ee } from "./useProjectId-CgOTejka.mjs";
9
- import { Fragment as R, jsx as z, jsxs as B } from "react/jsx-runtime";
10
- import { startTransition as V, useCallback as H, useEffect as U, useRef as W, useState as G } from "react";
11
- import { useNavigate as K, useParams as q } from "@tanstack/react-router";
12
- import { Trans as J, useLingui as te } from "@lingui/react";
13
- import { ErrorBoundary as Y } from "react-error-boundary";
14
- import { useVirtualizer as ne } from "@tanstack/react-virtual";
15
- //#region src/client/routes/_auth/projects/$projectId/storage/-components/Swift/Objects/DeleteFolderModal.tsx
16
- var re = ({ isOpen: t, folder: n, onClose: r, onSuccess: i, onError: o }) => {
17
- let { i18n: s, _: c } = te(), l = ee(), { containerName: u } = q({ from: "/_auth/projects/$projectId/storage/$provider/containers/$containerName/objects/" }), d = C.useUtils(), f = W(""), p = C.storage.swift.deleteFolder.useMutation({
18
- onSuccess: (e) => {
19
- d.storage.swift.listObjects.invalidate({
20
- project_id: l,
21
- container: u
22
- }), i?.(f.current, e);
23
- },
24
- onError: (e) => {
25
- o?.(f.current, e.message);
26
- },
27
- onSettled: () => {
28
- m();
29
- }
30
- });
31
- U(() => {
32
- t || p.reset();
33
- }, [t]);
34
- let m = () => {
35
- p.reset(), r();
36
- }, h = () => {
37
- n && (f.current = n.displayName, p.mutate({
38
- project_id: l,
39
- container: u,
40
- folderPath: n.name,
41
- recursive: !0
42
- }));
43
- };
44
- if (!t || !n) return null;
45
- let _ = n.displayName;
46
- return /* @__PURE__ */ z(g, {
47
- title: /* @__PURE__ */ B("span", {
48
- className: "flex max-w-[400px] items-center gap-1",
49
- children: [/* @__PURE__ */ z("span", {
50
- className: "shrink-0",
51
- children: /* @__PURE__ */ z(J, { id: "js24f6" })
52
- }), /* @__PURE__ */ z("span", {
53
- className: "truncate font-mono",
54
- title: _,
55
- children: _
56
- })]
57
- }),
58
- open: t,
59
- onCancel: m,
60
- confirmButtonLabel: p.isPending ? s._({ id: "EF2EU9" }) : s._({ id: "cnGeoo" }),
61
- confirmButtonVariant: "primary-danger",
62
- onConfirm: h,
63
- cancelButtonLabel: s._({ id: "dEgA5A" }),
64
- size: "small",
65
- disableConfirmButton: p.isPending,
66
- children: p.isPending ? /* @__PURE__ */ B(e, {
67
- direction: "horizontal",
68
- alignment: "center",
69
- gap: "2",
70
- className: "py-4",
71
- children: [/* @__PURE__ */ z(a, { size: "small" }), /* @__PURE__ */ z(J, { id: "ao/ZJi" })]
72
- }) : /* @__PURE__ */ B(e, {
73
- direction: "vertical",
74
- gap: "4",
75
- children: [/* @__PURE__ */ z("p", {
76
- className: "text-theme-default",
77
- children: /* @__PURE__ */ z(J, {
78
- id: "hueclm",
79
- values: { folderDisplayName: _ },
80
- components: { 0: /* @__PURE__ */ z("span", { className: "font-mono font-semibold" }) }
81
- })
82
- }), /* @__PURE__ */ z("p", {
83
- className: "text-theme-default",
84
- children: /* @__PURE__ */ z(J, {
85
- id: "riR9oD",
86
- components: { 0: /* @__PURE__ */ z("strong", {}) }
87
- })
88
- })]
89
- })
90
- });
91
- }, ie = ({ isOpen: t, object: r, onClose: i, onSuccess: o, onError: s }) => {
92
- let { i18n: c, _: l } = te(), u = ee(), { containerName: d } = q({ from: "/_auth/projects/$projectId/storage/$provider/containers/$containerName/objects/" }), f = C.useUtils(), [p, m] = G(!1), h = W(""), { data: _, isLoading: v, error: y } = C.storage.swift.getObjectMetadata.useQuery({
93
- project_id: u,
94
- container: d,
95
- object: r?.name ?? ""
96
- }, { enabled: t && r !== null }), b = _?.staticLargeObject === !0, x = !!_?.objectManifest, S = C.storage.swift.deleteObject.useMutation({
97
- onSuccess: () => {
98
- f.storage.swift.listObjects.invalidate({
99
- project_id: u,
100
- container: d
101
- }), o?.(h.current);
102
- },
103
- onError: (e) => {
104
- s?.(h.current, e.message);
105
- },
106
- onSettled: () => {
107
- w();
108
- }
109
- });
110
- U(() => {
111
- t || (S.reset(), m(!1));
112
- }, [t]);
113
- let w = () => {
114
- S.reset(), i();
115
- }, T = () => {
116
- r && (h.current = r.displayName, S.mutate({
117
- project_id: u,
118
- container: d,
119
- object: r.name,
120
- ...b && !p ? { multipartManifest: "delete" } : {}
121
- }));
122
- };
123
- if (!t || !r) return null;
124
- let E = r.displayName, D = v, O = S.isPending, k = y?.message ?? "";
125
- return /* @__PURE__ */ B(g, {
126
- title: /* @__PURE__ */ B("span", {
127
- className: "flex max-w-[400px] items-center gap-1",
128
- children: [/* @__PURE__ */ z("span", {
129
- className: "shrink-0",
130
- children: /* @__PURE__ */ z(J, { id: "uAI0yI" })
131
- }), /* @__PURE__ */ z("span", {
132
- className: "truncate font-mono",
133
- title: E,
134
- children: E
135
- })]
136
- }),
137
- open: t,
138
- onCancel: w,
139
- confirmButtonLabel: O ? c._({ id: "EF2EU9" }) : c._({ id: "cnGeoo" }),
140
- confirmButtonVariant: "primary-danger",
141
- onConfirm: T,
142
- cancelButtonLabel: c._({ id: "dEgA5A" }),
143
- size: "small",
144
- disableConfirmButton: D || O || !!y,
145
- children: [y && /* @__PURE__ */ z("p", {
146
- className: "text-theme-error mb-4",
147
- children: /* @__PURE__ */ z(J, {
148
- id: "+p6nHr",
149
- values: { metadataErrorMessage: k }
150
- })
151
- }), O ? /* @__PURE__ */ B(e, {
152
- direction: "horizontal",
153
- alignment: "center",
154
- gap: "2",
155
- className: "py-4",
156
- children: [/* @__PURE__ */ z(a, { size: "small" }), /* @__PURE__ */ z(J, { id: "EF2EU9" })]
157
- }) : D ? /* @__PURE__ */ B(e, {
158
- direction: "horizontal",
159
- alignment: "center",
160
- gap: "2",
161
- className: "py-4",
162
- children: [/* @__PURE__ */ z(a, { size: "small" }), /* @__PURE__ */ z(J, { id: "lq/mBZ" })]
163
- }) : y ? null : /* @__PURE__ */ B(e, {
164
- direction: "vertical",
165
- gap: "4",
166
- children: [
167
- /* @__PURE__ */ z("p", {
168
- className: "text-theme-default",
169
- children: /* @__PURE__ */ z(J, {
170
- id: "FgWsFY",
171
- values: { displayName: E },
172
- components: { 0: /* @__PURE__ */ z("span", { className: "font-mono font-semibold" }) }
173
- })
174
- }),
175
- b && /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z("p", {
176
- className: "text-theme-default",
177
- children: /* @__PURE__ */ z(J, {
178
- id: "bQBMTH",
179
- components: { 0: /* @__PURE__ */ z("strong", {}) }
180
- })
181
- }), /* @__PURE__ */ z(n, {
182
- label: c._({ id: "01/uUD" }),
183
- checked: p,
184
- onChange: (e) => m(e.target.checked)
185
- })] }),
186
- x && /* @__PURE__ */ z("p", {
187
- className: "text-theme-default",
188
- children: /* @__PURE__ */ z(J, {
189
- id: "qEDO1j",
190
- components: {
191
- 0: /* @__PURE__ */ z("strong", {}),
192
- 1: /* @__PURE__ */ z("strong", {})
193
- }
194
- })
195
- })
196
- ]
197
- })]
198
- });
199
- }, ae = 50, oe = ({ isOpen: t, object: n, onClose: r, onSuccess: i, onError: o }) => {
200
- let { i18n: s, _: c } = te(), l = ee(), { containerName: u } = q({ from: "/_auth/projects/$projectId/storage/$provider/containers/$containerName/objects/" }), d = C.useUtils(), f = W(""), [p, m] = G(u), [h, x] = G(""), [S, w] = G({}), [E, D] = G(""), [O, A] = G(null), [M, P] = G(!1), [F, I] = G(!0), [L, R] = G(""), [V, K] = G(""), Y = W(null), re = W(null);
201
- U(() => () => {
202
- Y.current && clearTimeout(Y.current);
203
- }, []), U(() => {
204
- t && (x(""), w((e) => {
205
- let t = { ...e };
206
- return delete t[p], t;
207
- }), D(""), A(null), P(!1), R(""), K(""));
208
- }, [t, p]), U(() => {
209
- t || (m(u), x(""), w({}), D(""), A(null), P(!1), R(""), K(""));
210
- }, [t, u]);
211
- let { data: ie, isLoading: oe } = C.storage.swift.listContainers.useQuery({ project_id: l }, { enabled: t }), { data: se, isLoading: ce } = C.storage.swift.listObjects.useQuery({
212
- project_id: l,
213
- container: p,
214
- format: "json",
215
- prefix: h || void 0
216
- }, { enabled: t && !!p }), X = qe(se ?? [], h), Z = (S[p] ?? []).filter((e) => {
217
- let t = e.startsWith(h) ? e.slice(h.length) : null;
218
- return t ? t.split("/").filter(Boolean).length === 1 : !1;
219
- }).filter((e) => !X.some((t) => t.name === e)).map((e) => ({
220
- kind: "folder",
221
- name: e,
222
- displayName: e.slice(h.length).replace(/\/$/, "")
223
- })), Q = [
224
- ...X.filter((e) => e.kind === "folder"),
225
- ...Z,
226
- ...X.filter((e) => e.kind === "object")
227
- ], le = V.trim().length > 0 ? (ie ?? []).filter((e) => e.name.toLowerCase().includes(V.toLowerCase())) : [], ue = le.slice(0, ae), de = le.length - ue.length, fe = C.storage.swift.copyObject.useMutation({
228
- onSuccess: () => {
229
- d.storage.swift.listObjects.invalidate({
230
- project_id: l,
231
- container: p
232
- }), i?.(f.current, p, h), pe();
233
- },
234
- onError: (e) => {
235
- o?.(f.current, e.message);
236
- }
237
- }), pe = () => {
238
- fe.reset(), r();
239
- }, me = H((e) => {
240
- let t = e.target.value;
241
- R(t), Y.current && clearTimeout(Y.current), Y.current = setTimeout(() => K(t), 300);
242
- }, []), he = (e) => {
243
- let t = Array.isArray(e) ? e[0] : typeof e == "number" ? String(e) : e;
244
- t && (m(t), x(""));
245
- }, ge = (e) => {
246
- x(e), P(!1), D(""), A(null);
247
- }, _e = () => {
248
- if (!h) return;
249
- let e = h.replace(/\/$/, "").split("/");
250
- e.pop(), x(e.length > 0 ? e.join("/") + "/" : ""), P(!1), D(""), A(null);
251
- }, ve = H((e) => {
252
- let t = e.trim();
253
- if (!t) return A(s._({ id: "Fzrzfe" })), !1;
254
- if (t.includes("/")) return A(s._({ id: "Vl4XTj" })), !1;
255
- if (t !== e) return A(s._({ id: "gFKJBP" })), !1;
256
- let n = `${h}${t}/`;
257
- return Q.some((e) => e.name === n) ? (A(s._({ id: "/Qox3b" })), !1) : (A(null), !0);
258
- }, [
259
- Q,
260
- h,
261
- c
262
- ]), ye = () => {
263
- if (!ve(E)) return;
264
- let e = `${h}${E.trim()}/`;
265
- w((t) => ({
266
- ...t,
267
- [p]: [...t[p] ?? [], e]
268
- })), D(""), P(!1), A(null), x(e);
269
- }, be = (e) => {
270
- e.key === "Enter" && ye(), e.key === "Escape" && (P(!1), D(""), A(null));
271
- }, xe = () => {
272
- if (!n) return;
273
- f.current = n.displayName;
274
- let e = `/${p}/${h}${n.displayName}`;
275
- fe.mutate({
276
- project_id: l,
277
- container: u,
278
- object: n.name,
279
- destination: e,
280
- freshMetadata: !F
281
- });
282
- }, Se = Q.filter((e) => e.kind === "folder"), Ce = Q.filter((e) => e.kind === "object"), we = [...Se, ...Ce], Te = ne({
283
- count: we.length,
284
- getScrollElement: () => re.current,
285
- estimateSize: () => 32,
286
- overscan: 5
287
- });
288
- if (!t || !n) return null;
289
- let $ = n.displayName, Ee = fe.isPending, De = ce, Oe = `/${p}/${h}${$}`, ke = n.name.endsWith(n.displayName) ? n.name.slice(0, n.name.length - n.displayName.length) : "", Ae = p === u && h === ke;
290
- return /* @__PURE__ */ z(g, {
291
- title: /* @__PURE__ */ B("span", {
292
- className: "flex max-w-[500px] items-center gap-1",
293
- children: [/* @__PURE__ */ z("span", {
294
- className: "shrink-0",
295
- children: /* @__PURE__ */ z(J, { id: "V7fN5X" })
296
- }), /* @__PURE__ */ z("span", {
297
- className: "truncate font-mono",
298
- title: $,
299
- children: $
300
- })]
301
- }),
302
- open: t,
303
- onCancel: pe,
304
- confirmButtonLabel: Ee ? s._({ id: "OvEjsP" }) : s._({ id: "he3ygx" }),
305
- onConfirm: xe,
306
- cancelButtonLabel: s._({ id: "dEgA5A" }),
307
- size: "large",
308
- disableConfirmButton: Ee || oe || Ae,
309
- children: Ee ? /* @__PURE__ */ B(e, {
310
- direction: "horizontal",
311
- alignment: "center",
312
- gap: "2",
313
- className: "py-8",
314
- children: [/* @__PURE__ */ z(a, { size: "small" }), /* @__PURE__ */ z(J, { id: "QEtDlS" })]
315
- }) : /* @__PURE__ */ B(e, {
316
- direction: "vertical",
317
- gap: "4",
318
- children: [
319
- fe.isError && (() => {
320
- let e = fe.error.message;
321
- return /* @__PURE__ */ z("p", {
322
- className: "text-theme-error text-sm",
323
- children: /* @__PURE__ */ z(J, {
324
- id: "IOkHLC",
325
- values: { errorMessage: e }
326
- })
327
- });
328
- })(),
329
- /* @__PURE__ */ z(y, {
330
- label: s._({ id: "QvqBQa" }),
331
- value: p,
332
- onChange: he,
333
- onInputChange: me,
334
- placeholder: s._({ id: "a13wDR" }),
335
- helptext: (() => {
336
- if (oe) return s._({ id: "rhaNn7" });
337
- if (L.trim().length === 0) return s._({ id: "c+fUtV" });
338
- if (de > 0) {
339
- let e = ae, t = le.length;
340
- return s._({
341
- id: "qzhUb9",
342
- values: {
343
- maxOptions: e,
344
- totalCount: t
345
- }
346
- });
347
- }
348
- })(),
349
- disabled: oe || Ee,
350
- required: !0,
351
- children: ue.map((e) => /* @__PURE__ */ z(v, {
352
- value: e.name,
353
- children: e.name
354
- }, e.name))
355
- }),
356
- /* @__PURE__ */ B("div", { children: [
357
- /* @__PURE__ */ B("div", {
358
- className: "mb-1 flex items-center justify-between",
359
- children: [/* @__PURE__ */ z("span", {
360
- className: "text-sm font-medium",
361
- children: /* @__PURE__ */ z(J, { id: "Afh/Lb" })
362
- }), /* @__PURE__ */ z(_, {
363
- size: "small",
364
- variant: "subdued",
365
- icon: "addCircle",
366
- onClick: () => {
367
- P(!0), D(""), A(null);
368
- },
369
- disabled: Ee,
370
- title: s._({ id: "mxPfpY" }),
371
- children: /* @__PURE__ */ z(J, { id: "tX5yOZ" })
372
- })]
373
- }),
374
- /* @__PURE__ */ B("div", {
375
- className: "border-theme-background-lvl-2 bg-theme-background-lvl-1 flex items-center gap-2 border-b px-3 py-2 text-sm",
376
- children: [h ? /* @__PURE__ */ B("button", {
377
- type: "button",
378
- onClick: _e,
379
- className: "text-theme-link hover:text-theme-default flex items-center gap-1",
380
- children: [/* @__PURE__ */ z(N, { size: 16 }), /* @__PURE__ */ z(J, { id: "iH8pgl" })]
381
- }) : /* @__PURE__ */ z("span", {
382
- className: "text-theme-light",
383
- children: /* @__PURE__ */ z(J, { id: "eyRsaH" })
384
- }), h && /* @__PURE__ */ B("span", {
385
- className: "text-theme-light truncate font-mono text-xs",
386
- children: ["/ ", h]
387
- })]
388
- }),
389
- /* @__PURE__ */ B("div", {
390
- ref: re,
391
- className: "border-theme-background-lvl-2 max-h-56 overflow-y-auto rounded-b border",
392
- children: [De ? /* @__PURE__ */ B(e, {
393
- direction: "horizontal",
394
- alignment: "center",
395
- gap: "2",
396
- className: "py-6",
397
- children: [/* @__PURE__ */ z(a, { size: "small" }), /* @__PURE__ */ z(J, { id: "Z3FXyt" })]
398
- }) : we.length === 0 && !M ? /* @__PURE__ */ z("div", {
399
- className: "text-theme-light px-4 py-6 text-center text-sm",
400
- children: /* @__PURE__ */ z(J, { id: "vcQSZh" })
401
- }) : /* @__PURE__ */ z("div", {
402
- style: {
403
- height: `${Te.getTotalSize()}px`,
404
- position: "relative"
405
- },
406
- children: Te.getVirtualItems().map((e) => {
407
- let t = we[e.index], n = t.kind === "folder";
408
- return /* @__PURE__ */ z("div", {
409
- "data-index": e.index,
410
- ref: Te.measureElement,
411
- style: {
412
- position: "absolute",
413
- top: 0,
414
- left: 0,
415
- width: "100%",
416
- transform: `translateY(${e.start}px)`
417
- },
418
- children: n ? /* @__PURE__ */ B("button", {
419
- type: "button",
420
- className: "hover:bg-theme-background-lvl-2 focus-visible:outline-theme-focus flex w-full items-center gap-2 px-4 py-2 text-left text-sm focus-visible:outline focus-visible:outline-2",
421
- onClick: () => ge(t.name),
422
- children: [/* @__PURE__ */ z(k, {
423
- size: 16,
424
- className: "text-theme-light shrink-0"
425
- }), /* @__PURE__ */ z("span", {
426
- className: "truncate",
427
- children: t.displayName
428
- })]
429
- }) : /* @__PURE__ */ B("span", {
430
- className: "text-theme-light flex items-center gap-2 px-4 py-2 text-sm",
431
- children: [/* @__PURE__ */ z(j, {
432
- size: 16,
433
- className: "shrink-0"
434
- }), /* @__PURE__ */ z("span", {
435
- className: "truncate",
436
- children: t.displayName
437
- })]
438
- })
439
- }, t.name);
440
- })
441
- }), M && /* @__PURE__ */ z("div", {
442
- className: "border-theme-background-lvl-2 border-t px-4 py-3",
443
- children: /* @__PURE__ */ z(e, {
444
- direction: "vertical",
445
- gap: "2",
446
- children: /* @__PURE__ */ B(e, {
447
- direction: "horizontal",
448
- gap: "2",
449
- alignment: "center",
450
- children: [
451
- /* @__PURE__ */ z(T, {
452
- size: 16,
453
- className: "text-theme-light shrink-0"
454
- }),
455
- /* @__PURE__ */ z(b, {
456
- value: E,
457
- onChange: (e) => {
458
- D(e.target.value), O && A(null);
459
- },
460
- onKeyDown: be,
461
- placeholder: s._({ id: "KzUd7m" }),
462
- invalid: !!O,
463
- errortext: O ?? void 0,
464
- autoFocus: !0,
465
- className: "flex-1"
466
- }),
467
- /* @__PURE__ */ z(_, {
468
- size: "small",
469
- variant: "primary",
470
- onClick: ye,
471
- disabled: !E.trim(),
472
- children: /* @__PURE__ */ z(J, { id: "hYgDIe" })
473
- }),
474
- /* @__PURE__ */ z(_, {
475
- size: "small",
476
- variant: "subdued",
477
- onClick: () => {
478
- P(!1), D(""), A(null);
479
- },
480
- children: /* @__PURE__ */ z(J, { id: "dEgA5A" })
481
- })
482
- ]
483
- })
484
- })
485
- })]
486
- })
487
- ] }),
488
- /* @__PURE__ */ B("div", { children: [/* @__PURE__ */ z("p", {
489
- className: "text-theme-light mb-1",
490
- children: /* @__PURE__ */ z(J, { id: "Z/eWPC" })
491
- }), /* @__PURE__ */ z(b, {
492
- label: s._({ id: "Vh/Uj5" }),
493
- value: Oe,
494
- readOnly: !0,
495
- className: "font-mono"
496
- })] }),
497
- /* @__PURE__ */ B("label", {
498
- className: "flex cursor-pointer items-center gap-2",
499
- children: [/* @__PURE__ */ z("input", {
500
- type: "checkbox",
501
- checked: F,
502
- onChange: (e) => I(e.target.checked),
503
- className: "h-4 w-4"
504
- }), /* @__PURE__ */ z("span", {
505
- className: "text-sm",
506
- children: /* @__PURE__ */ z(J, { id: "mqljvE" })
507
- })]
508
- })
509
- ]
510
- })
511
- });
512
- }, se = 50, ce = ({ isOpen: t, object: n, onClose: r, onSuccess: i, onError: o }) => {
513
- let { i18n: s, _: c } = te(), l = ee(), { containerName: u } = q({ from: "/_auth/projects/$projectId/storage/$provider/containers/$containerName/objects/" }), d = C.useUtils(), f = W(""), [p, m] = G(u), [h, x] = G(""), [S, w] = G(""), [E, D] = G(null), [O, A] = G({}), [M, P] = G(""), [F, I] = G(null), [L, R] = G(!1), [V, K] = G(""), [Y, re] = G(""), ie = W(null), ae = W(null);
514
- U(() => () => {
515
- ie.current && clearTimeout(ie.current);
516
- }, []), U(() => {
517
- t && (x(""), A((e) => {
518
- let t = { ...e };
519
- return delete t[p], t;
520
- }), P(""), I(null), R(!1), K(""), re(""), D(null));
521
- }, [t, p]), U(() => {
522
- t && n && w(n.displayName);
523
- }, [t, n]), U(() => {
524
- t || (m(u), x(""), A({}), P(""), I(null), R(!1), K(""), re(""), w(""), D(null));
525
- }, [t, u]);
526
- let { data: oe, isLoading: ce } = C.storage.swift.listContainers.useQuery({ project_id: l }, { enabled: t }), { data: X, isLoading: Z } = C.storage.swift.listObjects.useQuery({
527
- project_id: l,
528
- container: p,
529
- format: "json",
530
- prefix: h || void 0
531
- }, { enabled: t && !!p }), Q = qe(X ?? [], h), le = (O[p] ?? []).filter((e) => {
532
- let t = e.startsWith(h) ? e.slice(h.length) : null;
533
- return t ? t.split("/").filter(Boolean).length === 1 : !1;
534
- }).filter((e) => !Q.some((t) => t.name === e)).map((e) => ({
535
- kind: "folder",
536
- name: e,
537
- displayName: e.slice(h.length).replace(/\/$/, "")
538
- })), ue = [
539
- ...Q.filter((e) => e.kind === "folder"),
540
- ...le,
541
- ...Q.filter((e) => e.kind === "object")
542
- ], de = Y.trim().length > 0 ? (oe ?? []).filter((e) => e.name.toLowerCase().includes(Y.toLowerCase())) : [], fe = de.slice(0, se), pe = de.length - fe.length, me = C.storage.swift.deleteObject.useMutation({
543
- onSuccess: () => {
544
- [...new Set([u, p])].forEach((e) => d.storage.swift.listObjects.invalidate({
545
- project_id: l,
546
- container: e
547
- })), i?.(f.current, p, h);
548
- },
549
- onError: (e) => {
550
- o?.(f.current, e.message);
551
- },
552
- onSettled: () => {
553
- ge();
554
- }
555
- }), he = C.storage.swift.copyObject.useMutation({
556
- onSuccess: () => {
557
- n && me.mutate({
558
- project_id: l,
559
- container: u,
560
- object: n.name
561
- });
562
- },
563
- onError: (e) => {
564
- o?.(f.current, e.message), ge();
565
- }
566
- }), ge = () => {
567
- he.reset(), me.reset(), r();
568
- }, _e = H((e) => {
569
- let t = e.target.value;
570
- K(t), ie.current && clearTimeout(ie.current), ie.current = setTimeout(() => re(t), 300);
571
- }, []), ve = (e) => {
572
- let t = Array.isArray(e) ? e[0] : typeof e == "number" ? String(e) : e;
573
- t && (m(t), x(""));
574
- }, ye = (e) => {
575
- x(e), R(!1), P(""), I(null);
576
- }, be = () => {
577
- if (!h) return;
578
- let e = h.replace(/\/$/, "").split("/");
579
- e.pop(), x(e.length > 0 ? e.join("/") + "/" : ""), R(!1), P(""), I(null);
580
- }, xe = H((e) => {
581
- let t = e.trim();
582
- if (!t) return I(s._({ id: "Fzrzfe" })), !1;
583
- if (t.includes("/")) return I(s._({ id: "Vl4XTj" })), !1;
584
- if (t !== e) return I(s._({ id: "gFKJBP" })), !1;
585
- let n = `${h}${t}/`;
586
- return ue.some((e) => e.name === n) ? (I(s._({ id: "/Qox3b" })), !1) : (I(null), !0);
587
- }, [
588
- ue,
589
- h,
590
- c
591
- ]), Se = H((e) => {
592
- let t = e.trim();
593
- return t ? t.includes("/") ? (D(s._({ id: "NZJhro" })), !1) : t === e ? (D(null), !0) : (D(s._({ id: "Erlvqg" })), !1) : (D(s._({ id: "MtzSbv" })), !1);
594
- }, [c]), Ce = () => {
595
- if (!xe(M)) return;
596
- let e = `${h}${M.trim()}/`;
597
- A((t) => ({
598
- ...t,
599
- [p]: [...t[p] ?? [], e]
600
- })), P(""), R(!1), I(null), x(e);
601
- }, we = (e) => {
602
- e.key === "Enter" && Ce(), e.key === "Escape" && (R(!1), P(""), I(null));
603
- }, Te = () => {
604
- if (!n || !Se(S)) return;
605
- let e = S.trim();
606
- f.current = e;
607
- let t = `/${p}/${h}${e}`;
608
- he.mutate({
609
- project_id: l,
610
- container: u,
611
- object: n.name,
612
- destination: t,
613
- freshMetadata: !1
614
- });
615
- }, $ = ue.filter((e) => e.kind === "folder"), Ee = ue.filter((e) => e.kind === "object"), De = [...$, ...Ee], Oe = ne({
616
- count: De.length,
617
- getScrollElement: () => ae.current,
618
- estimateSize: () => 32,
619
- overscan: 5
620
- });
621
- if (!t || !n) return null;
622
- let ke = he.isPending || me.isPending, Ae = Z, je = `/${p}/${h}${S.trim() || n.displayName}`, Me = n.name.endsWith(n.displayName) ? n.name.slice(0, n.name.length - n.displayName.length) : "", Ne = p === u && h === Me && S.trim() === n.displayName;
623
- return /* @__PURE__ */ z(g, {
624
- title: /* @__PURE__ */ B("span", {
625
- className: "flex max-w-[500px] items-center gap-1",
626
- children: [/* @__PURE__ */ z("span", {
627
- className: "shrink-0",
628
- children: /* @__PURE__ */ z(J, { id: "J6EOll" })
629
- }), /* @__PURE__ */ z("span", {
630
- className: "truncate font-mono",
631
- title: n.displayName,
632
- children: n.displayName
633
- })]
634
- }),
635
- open: t,
636
- onCancel: ge,
637
- confirmButtonLabel: ke ? s._({ id: "K8Qnlj" }) : s._({ id: "QWdKwH" }),
638
- onConfirm: Te,
639
- cancelButtonLabel: s._({ id: "dEgA5A" }),
640
- size: "large",
641
- disableConfirmButton: ke || ce || Ne,
642
- children: ke ? /* @__PURE__ */ B(e, {
643
- direction: "horizontal",
644
- alignment: "center",
645
- gap: "2",
646
- className: "py-8",
647
- children: [/* @__PURE__ */ z(a, { size: "small" }), /* @__PURE__ */ z(J, { id: "1H2g6v" })]
648
- }) : /* @__PURE__ */ B(e, {
649
- direction: "vertical",
650
- gap: "4",
651
- children: [
652
- (he.isError || me.isError) && (() => {
653
- let e = he.error?.message ?? "", t = me.error?.message ?? "";
654
- return /* @__PURE__ */ z("p", {
655
- className: "text-theme-error",
656
- children: he.isError ? /* @__PURE__ */ z(J, {
657
- id: "i5MEDc",
658
- values: { copyErrorMessage: e }
659
- }) : /* @__PURE__ */ z(J, {
660
- id: "VoxR3s",
661
- values: { deleteErrorMessage: t }
662
- })
663
- });
664
- })(),
665
- /* @__PURE__ */ B("div", { children: [/* @__PURE__ */ z("p", {
666
- className: "text-theme-light mb-1",
667
- children: /* @__PURE__ */ z(J, { id: "rAtQcX" })
668
- }), /* @__PURE__ */ z(b, {
669
- label: s._({ id: "f+Uq1E" }),
670
- value: S,
671
- onChange: (e) => {
672
- w(e.target.value), E && D(null);
673
- },
674
- invalid: !!E,
675
- errortext: E ?? void 0,
676
- required: !0
677
- })] }),
678
- /* @__PURE__ */ z(y, {
679
- label: s._({ id: "QvqBQa" }),
680
- value: p,
681
- onChange: ve,
682
- onInputChange: _e,
683
- placeholder: s._({ id: "a13wDR" }),
684
- helptext: (() => {
685
- if (ce) return s._({ id: "rhaNn7" });
686
- if (V.trim().length === 0) return s._({ id: "c+fUtV" });
687
- if (pe > 0) {
688
- let e = se, t = de.length;
689
- return s._({
690
- id: "qzhUb9",
691
- values: {
692
- maxOptions: e,
693
- totalCount: t
694
- }
695
- });
696
- }
697
- })(),
698
- disabled: ce || ke,
699
- required: !0,
700
- children: fe.map((e) => /* @__PURE__ */ z(v, {
701
- value: e.name,
702
- children: e.name
703
- }, e.name))
704
- }),
705
- /* @__PURE__ */ B("div", { children: [
706
- /* @__PURE__ */ B("div", {
707
- className: "mb-1 flex items-center justify-between",
708
- children: [/* @__PURE__ */ z("span", {
709
- className: "text-sm font-medium",
710
- children: /* @__PURE__ */ z(J, { id: "Afh/Lb" })
711
- }), /* @__PURE__ */ z(_, {
712
- size: "small",
713
- variant: "subdued",
714
- icon: "addCircle",
715
- onClick: () => {
716
- R(!0), P(""), I(null);
717
- },
718
- disabled: ke,
719
- title: s._({ id: "mxPfpY" }),
720
- children: /* @__PURE__ */ z(J, { id: "tX5yOZ" })
721
- })]
722
- }),
723
- /* @__PURE__ */ B("div", {
724
- className: "border-theme-background-lvl-2 bg-theme-background-lvl-1 flex items-center gap-2 border-b px-3 py-2 text-sm",
725
- children: [h ? /* @__PURE__ */ B("button", {
726
- type: "button",
727
- onClick: be,
728
- className: "text-theme-link hover:text-theme-default flex items-center gap-1",
729
- children: [/* @__PURE__ */ z(N, { size: 16 }), /* @__PURE__ */ z(J, { id: "iH8pgl" })]
730
- }) : /* @__PURE__ */ z("span", {
731
- className: "text-theme-light",
732
- children: /* @__PURE__ */ z(J, { id: "eyRsaH" })
733
- }), h && /* @__PURE__ */ B("span", {
734
- className: "text-theme-light truncate font-mono text-xs",
735
- children: ["/ ", h]
736
- })]
737
- }),
738
- /* @__PURE__ */ B("div", {
739
- ref: ae,
740
- className: "border-theme-background-lvl-2 max-h-56 overflow-y-auto rounded-b border",
741
- children: [Ae ? /* @__PURE__ */ B(e, {
742
- direction: "horizontal",
743
- alignment: "center",
744
- gap: "2",
745
- className: "py-6",
746
- children: [/* @__PURE__ */ z(a, { size: "small" }), /* @__PURE__ */ z(J, { id: "Z3FXyt" })]
747
- }) : De.length === 0 && !L ? /* @__PURE__ */ z("div", {
748
- className: "text-theme-light px-4 py-6 text-center text-sm",
749
- children: /* @__PURE__ */ z(J, { id: "vcQSZh" })
750
- }) : /* @__PURE__ */ z("div", {
751
- style: {
752
- height: `${Oe.getTotalSize()}px`,
753
- position: "relative"
754
- },
755
- children: Oe.getVirtualItems().map((e) => {
756
- let t = De[e.index], n = t.kind === "folder";
757
- return /* @__PURE__ */ z("div", {
758
- "data-index": e.index,
759
- ref: Oe.measureElement,
760
- style: {
761
- position: "absolute",
762
- top: 0,
763
- left: 0,
764
- width: "100%",
765
- transform: `translateY(${e.start}px)`
766
- },
767
- children: n ? /* @__PURE__ */ B("button", {
768
- type: "button",
769
- className: "hover:bg-theme-background-lvl-2 focus-visible:outline-theme-focus flex w-full items-center gap-2 px-4 py-2 text-left text-sm focus-visible:outline focus-visible:outline-2",
770
- onClick: () => ye(t.name),
771
- children: [/* @__PURE__ */ z(k, {
772
- size: 16,
773
- className: "text-theme-light shrink-0"
774
- }), /* @__PURE__ */ z("span", {
775
- className: "truncate",
776
- children: t.displayName
777
- })]
778
- }) : /* @__PURE__ */ B("span", {
779
- className: "text-theme-light flex items-center gap-2 px-4 py-2 text-sm",
780
- children: [/* @__PURE__ */ z(j, {
781
- size: 16,
782
- className: "shrink-0"
783
- }), /* @__PURE__ */ z("span", {
784
- className: "truncate",
785
- children: t.displayName
786
- })]
787
- })
788
- }, t.name);
789
- })
790
- }), L && /* @__PURE__ */ z("div", {
791
- className: "border-theme-background-lvl-2 border-t px-4 py-3",
792
- children: /* @__PURE__ */ z(e, {
793
- direction: "vertical",
794
- gap: "2",
795
- children: /* @__PURE__ */ B(e, {
796
- direction: "horizontal",
797
- gap: "2",
798
- alignment: "center",
799
- children: [
800
- /* @__PURE__ */ z(T, {
801
- size: 16,
802
- className: "text-theme-light shrink-0"
803
- }),
804
- /* @__PURE__ */ z(b, {
805
- value: M,
806
- onChange: (e) => {
807
- P(e.target.value), F && I(null);
808
- },
809
- onKeyDown: we,
810
- placeholder: s._({ id: "KzUd7m" }),
811
- invalid: !!F,
812
- errortext: F ?? void 0,
813
- autoFocus: !0,
814
- className: "flex-1"
815
- }),
816
- /* @__PURE__ */ z(_, {
817
- size: "small",
818
- variant: "primary",
819
- onClick: Ce,
820
- disabled: !M.trim(),
821
- children: /* @__PURE__ */ z(J, { id: "hYgDIe" })
822
- }),
823
- /* @__PURE__ */ z(_, {
824
- size: "small",
825
- variant: "subdued",
826
- onClick: () => {
827
- R(!1), P(""), I(null);
828
- },
829
- children: /* @__PURE__ */ z(J, { id: "dEgA5A" })
830
- })
831
- ]
832
- })
833
- })
834
- })]
835
- })
836
- ] }),
837
- /* @__PURE__ */ B("div", { children: [/* @__PURE__ */ z("p", {
838
- className: "text-theme-light mb-1",
839
- children: /* @__PURE__ */ z(J, { id: "rlgAtt" })
840
- }), /* @__PURE__ */ z(b, {
841
- label: s._({ id: "Vh/Uj5" }),
842
- value: je,
843
- readOnly: !0,
844
- className: "font-mono"
845
- })] })
846
- ]
847
- })
848
- });
849
- }, X = "custom", Z = ({ isOpen: t, object: n, account: r, onClose: i, onCopySuccess: o }) => {
850
- let { i18n: s, _: c } = te(), l = ee(), { containerName: u } = q({ from: "/_auth/projects/$projectId/storage/$provider/containers/$containerName/objects/" }), d = [
851
- {
852
- labelKey: s._({ id: "vp5vfW" }),
853
- seconds: 3600
854
- },
855
- {
856
- labelKey: s._({ id: "VaA9mu" }),
857
- seconds: 86400
858
- },
859
- {
860
- labelKey: s._({ id: "rJe6vw" }),
861
- seconds: 604800
862
- }
863
- ], [f, _] = G(String(d[1].seconds)), [v, y] = G(""), [x, S] = G(null), [w, T] = G(!1), [E, D] = G(null), [O, k] = G(null), [A, j] = G(!1), [M, N] = G(null), [P, F] = G(null), I = W(""), L = W(null), R = W(0), V = (e) => {
864
- D(e.url), k(e.expiresAt), j(!1), N(null);
865
- }, H = (e) => {
866
- e.message.includes("Temp URL key not configured") ? (j(!0), N(null)) : (N(e.message), j(!1));
867
- }, K = C.storage.swift.generateTempUrl.useMutation();
868
- U(() => (t || (R.current += 1, L.current &&= (clearTimeout(L.current), null), K.reset(), D(null), k(null), _(String(d[1].seconds)), y(""), S(null), T(!1), j(!1), N(null), F(null)), () => {
869
- L.current && clearTimeout(L.current);
870
- }), [t]);
871
- let Y = () => {
872
- if (!v.trim()) return null;
873
- let e = Number(v);
874
- return Number.isInteger(e) && e > 0 ? e : null;
875
- }, ne = () => {
876
- if (f === X) {
877
- let e = Y();
878
- return e === null ? null : e * 60;
879
- }
880
- return parseInt(f, 10);
881
- }, re = () => {
882
- if (!n) return;
883
- if (f === X) {
884
- if (Y() === null) {
885
- S(s._({ id: "jSG7wx" }));
886
- return;
887
- }
888
- S(null);
889
- }
890
- let e = ne();
891
- if (e === null) return;
892
- I.current = n.displayName, D(null), k(null), T(!1);
893
- let t = ++R.current;
894
- K.mutate({
895
- project_id: l,
896
- container: u,
897
- object: n.name,
898
- method: "GET",
899
- expiresIn: e,
900
- ...r ? { account: r } : {}
901
- }, {
902
- onSuccess: (e) => {
903
- t === R.current && V(e);
904
- },
905
- onError: (e) => {
906
- t === R.current && H(e);
907
- }
908
- });
909
- }, ie = () => {
910
- E && (F(null), navigator.clipboard.writeText(E).then(() => {
911
- T(!0), o?.(I.current), L.current && clearTimeout(L.current), L.current = setTimeout(() => {
912
- L.current = null, T(!1);
913
- }, 2e3);
914
- }).catch(() => {
915
- F(s._({ id: "go0J2x" }));
916
- }));
917
- }, ae = (e) => {
918
- let t = String(d[1].seconds), n = typeof e == "string" ? e : typeof e == "number" ? String(e) : Array.isArray(e) && typeof e[0] == "string" ? e[0] : "", r = new Set([...d.map((e) => String(e.seconds)), X]), i = n && r.has(n) ? n : t;
919
- _(i), i !== X && (y(""), S(null)), D(null), k(null), T(!1), N(null), F(null), j(!1);
920
- }, oe = (e) => {
921
- y(e.target.value), x && S(null), D(null), k(null), T(!1), N(null), F(null), j(!1);
922
- };
923
- if (!t || !n) return null;
924
- let se = n.displayName, ce = K.isPending, Z = f === X, Q = O ? (/* @__PURE__ */ new Date(O * 1e3)).toLocaleString() : null, le = f === X ? v ? Y() === 1 ? s._({ id: "4mbrAq" }) : s._({
925
- id: "wbqM4L",
926
- values: { customMinutes: v }
927
- }) : null : d.find((e) => String(e.seconds) === f)?.labelKey ?? null;
928
- return /* @__PURE__ */ z(g, {
929
- title: /* @__PURE__ */ B("span", {
930
- className: "flex max-w-[400px] items-center gap-1",
931
- children: [/* @__PURE__ */ z("span", {
932
- className: "shrink-0",
933
- children: /* @__PURE__ */ z(J, { id: "NRP2uq" })
934
- }), /* @__PURE__ */ z("span", {
935
- className: "truncate font-mono",
936
- title: se,
937
- children: se
938
- })]
939
- }),
940
- open: t,
941
- onCancel: i,
942
- confirmButtonLabel: ce ? s._({ id: "NOdFZR" }) : s._({ id: "vpt8cE" }),
943
- onConfirm: re,
944
- cancelButtonLabel: s._({ id: "yz7wBu" }),
945
- size: "small",
946
- disableConfirmButton: ce || Z && (!v.trim() || !!x),
947
- children: /* @__PURE__ */ B(e, {
948
- direction: "vertical",
949
- gap: "4",
950
- children: [
951
- /* @__PURE__ */ z("p", {
952
- className: "text-theme-default",
953
- children: /* @__PURE__ */ z(J, { id: "n2IuBI" })
954
- }),
955
- A && /* @__PURE__ */ z("p", {
956
- className: "text-theme-default",
957
- children: /* @__PURE__ */ z(J, {
958
- id: "q5sTNZ",
959
- components: {
960
- 0: /* @__PURE__ */ z("strong", {}),
961
- 1: /* @__PURE__ */ z("code", {}),
962
- 2: /* @__PURE__ */ z("code", {})
963
- }
964
- })
965
- }),
966
- M && /* @__PURE__ */ z("p", {
967
- className: "text-theme-error",
968
- role: "alert",
969
- "aria-live": "assertive",
970
- children: /* @__PURE__ */ z(J, {
971
- id: "fxnDd7",
972
- values: { generalError: M }
973
- })
974
- }),
975
- P && /* @__PURE__ */ z("p", {
976
- className: "text-theme-error",
977
- role: "alert",
978
- "aria-live": "assertive",
979
- children: P
980
- }),
981
- /* @__PURE__ */ B(h, {
982
- label: s._({ id: "i9qiyR" }),
983
- value: f,
984
- onChange: ae,
985
- disabled: ce,
986
- children: [d.map((e) => /* @__PURE__ */ z(m, {
987
- value: String(e.seconds),
988
- label: e.labelKey
989
- }, e.seconds)), /* @__PURE__ */ z(m, {
990
- value: X,
991
- label: s._({ id: "8Tg/JR" })
992
- })]
993
- }),
994
- Z && /* @__PURE__ */ z(b, {
995
- label: s._({ id: "3n+vCm" }),
996
- value: v,
997
- onChange: oe,
998
- invalid: !!x,
999
- errortext: x || void 0,
1000
- disabled: ce,
1001
- placeholder: "60",
1002
- type: "number"
1003
- }),
1004
- ce && /* @__PURE__ */ B(e, {
1005
- direction: "horizontal",
1006
- alignment: "center",
1007
- gap: "2",
1008
- className: "py-2",
1009
- children: [/* @__PURE__ */ z(a, { size: "small" }), /* @__PURE__ */ z(J, { id: "UK2mpr" })]
1010
- }),
1011
- E && /* @__PURE__ */ B(e, {
1012
- direction: "vertical",
1013
- gap: "2",
1014
- children: [/* @__PURE__ */ B("div", {
1015
- className: "relative",
1016
- children: [/* @__PURE__ */ z(b, {
1017
- label: s._({ id: "GSIPwA" }),
1018
- value: E,
1019
- readOnly: !0,
1020
- className: "pr-10 font-mono text-xs"
1021
- }), /* @__PURE__ */ z("button", {
1022
- type: "button",
1023
- onClick: ie,
1024
- title: w ? s._({ id: "PiH3UR" }) : s._({ id: "E6nRW7" }),
1025
- "aria-label": w ? s._({ id: "PiH3UR" }) : s._({ id: "E6nRW7" }),
1026
- className: "text-theme-light hover:text-theme-default absolute top-1/2 right-2 inline-flex items-center transition-colors",
1027
- style: { transform: "translateY(-50%)" },
1028
- children: /* @__PURE__ */ z(p, {
1029
- icon: w ? "checkCircle" : "contentCopy",
1030
- size: "18"
1031
- })
1032
- })]
1033
- }), Q && le && /* @__PURE__ */ z("p", {
1034
- className: "text-theme-light text-xs",
1035
- children: /* @__PURE__ */ z(J, {
1036
- id: "dOevLB",
1037
- values: {
1038
- selectedPresetLabel: le,
1039
- expiresAtFormatted: Q
1040
- }
1041
- })
1042
- })]
1043
- })
1044
- ]
1045
- })
1046
- });
1047
- }, Q = /^[a-zA-Z0-9!#$%&'*+\-.^_`|~]+$/, le = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/, ue = (e) => {
1048
- if (!le.test(e)) return !1;
1049
- let t = /* @__PURE__ */ new Date(e.replace(" ", "T") + "Z");
1050
- if (isNaN(t.getTime())) return !1;
1051
- let [n, r] = e.split(" "), [i, a, o] = n.split("-").map(Number), [s, c, l] = r.split(":").map(Number);
1052
- return t.getUTCFullYear() === i && t.getUTCMonth() + 1 === a && t.getUTCDate() === o && t.getUTCHours() === s && t.getUTCMinutes() === c && t.getUTCSeconds() === l;
1053
- }, de = (e) => e.trim() ? Q.test(e) ? /[a-zA-Z0-9]/.test(e) ? null : "no-alnum" : "invalid-chars" : "required", fe = (e) => {
1054
- let t = new Date(e);
1055
- return isNaN(t.getTime()) ? "—" : t.toLocaleString(void 0, {
1056
- year: "numeric",
1057
- month: "short",
1058
- day: "2-digit",
1059
- hour: "2-digit",
1060
- minute: "2-digit",
1061
- timeZone: "UTC"
1062
- });
1063
- }, pe = (e) => {
1064
- let t = /* @__PURE__ */ new Date(e * 1e3), n = (e) => String(e).padStart(2, "0");
1065
- return `${t.getUTCFullYear()}-${n(t.getUTCMonth() + 1)}-${n(t.getUTCDate())} ${n(t.getUTCHours())}:${n(t.getUTCMinutes())}:${n(t.getUTCSeconds())}`;
1066
- }, me = ({ isOpen: n, object: r, onClose: i, onSuccess: s, onError: c }) => {
1067
- let { i18n: u, _: d } = te(), f = ee(), { containerName: p } = q({ from: "/_auth/projects/$projectId/storage/$provider/containers/$containerName/objects/" }), m = C.useUtils(), { data: h, isLoading: v, isError: y, error: S } = C.storage.swift.getObjectMetadata.useQuery({
1068
- project_id: f,
1069
- container: p,
1070
- object: r?.name ?? ""
1071
- }, {
1072
- enabled: n && r !== null,
1073
- refetchOnWindowFocus: !1
1074
- }), w = W(0), T = () => ++w.current, [E, D] = G(""), [O, k] = G(null), [A, j] = G([]), [M, N] = G({}), [P, F] = G(!1), [I, R] = G(""), [V, H] = G(""), [K, Y] = G(null), ne = W(""), re = W([]), ie = W(""), ae = W(""), oe = W(null);
1075
- U(() => {
1076
- if (!h) return;
1077
- let e = h.deleteAt == null ? "" : pe(h.deleteAt);
1078
- D(e), ne.current = e;
1079
- let t = Object.entries(h.customMetadata ?? {}).map(([e, t]) => ({
1080
- uid: T(),
1081
- key: e,
1082
- value: t,
1083
- isEditing: !1,
1084
- originalKey: e,
1085
- originalValue: t
1086
- }));
1087
- j(t), re.current = t.map((e) => ({ ...e }));
1088
- }, [h]), U(() => {
1089
- n || se();
1090
- }, [n]);
1091
- let se = () => {
1092
- oe.current && clearTimeout(oe.current), D(""), k(null), j([]), N({}), F(!1), R(""), H(""), Y(null), Z.reset();
1093
- }, ce = (() => {
1094
- if (E !== ne.current || A.length !== re.current.length) return !0;
1095
- let e = new Map(re.current.map((e) => [e.key, e.value]));
1096
- return A.some((t) => e.get(t.key) !== t.value);
1097
- })(), X = A.some((e) => e.isEditing), Z = C.storage.swift.updateObjectMetadata.useMutation({
1098
- onSuccess: () => {
1099
- m.storage.swift.getObjectMetadata.invalidate({
1100
- project_id: f,
1101
- container: p,
1102
- object: ae.current
1103
- }), m.storage.swift.listObjects.invalidate({
1104
- project_id: f,
1105
- container: p
1106
- }), s?.(ie.current), Q();
1107
- },
1108
- onError: (e) => {
1109
- c?.(ie.current, e.message);
1110
- }
1111
- }), Q = () => {
1112
- se(), i();
1113
- }, le = () => {
1114
- if (!r) return;
1115
- if (E.trim() && !ue(E.trim())) {
1116
- k("invalid");
1117
- return;
1118
- }
1119
- k(null), ie.current = r.displayName, ae.current = r.name;
1120
- let e = {};
1121
- for (let t of A) e[t.key] = t.value;
1122
- Z.mutate({
1123
- project_id: f,
1124
- container: p,
1125
- object: r.name,
1126
- metadata: e,
1127
- ...E.trim() ? { deleteAt: Math.floor((/* @__PURE__ */ new Date(E.trim().replace(" ", "T") + "Z")).getTime() / 1e3) } : {}
1128
- });
1129
- }, me = (e) => {
1130
- j((t) => t.map((t, n) => n === e ? {
1131
- ...t,
1132
- isEditing: !0
1133
- } : t));
1134
- }, he = (e, t) => {
1135
- j((n) => n.map((n, r) => r === e ? {
1136
- ...n,
1137
- key: t
1138
- } : n)), M[`edit-${e}`] && N((t) => {
1139
- let n = { ...t };
1140
- return delete n[`edit-${e}`], n;
1141
- });
1142
- }, ge = (e, t) => {
1143
- j((n) => n.map((n, r) => r === e ? {
1144
- ...n,
1145
- value: t
1146
- } : n));
1147
- }, _e = (e) => {
1148
- let t = A[e], n = de(t.key);
1149
- if (n) {
1150
- let t = n === "required" ? u._({ id: "QV1ZPO" }) : n === "invalid-chars" ? u._({ id: "XYZLy9" }) : u._({ id: "dTNzBI" });
1151
- N((n) => ({
1152
- ...n,
1153
- [`edit-${e}`]: t
1154
- }));
1155
- return;
1156
- }
1157
- if (A.some((n, r) => r !== e && n.key.toLowerCase() === t.key.toLowerCase())) {
1158
- N((t) => ({
1159
- ...t,
1160
- [`edit-${e}`]: u._({ id: "q6K46F" })
1161
- }));
1162
- return;
1163
- }
1164
- j((t) => t.map((t, n) => n === e ? {
1165
- ...t,
1166
- isEditing: !1
1167
- } : t)), N((t) => {
1168
- let n = { ...t };
1169
- return delete n[`edit-${e}`], n;
1170
- });
1171
- }, ve = (e) => {
1172
- let t = re.current[e];
1173
- j(t ? (n) => n.map((n, r) => r === e ? {
1174
- ...t,
1175
- isEditing: !1
1176
- } : n) : (t) => t.filter((t, n) => n !== e)), N((t) => {
1177
- let n = { ...t };
1178
- return delete n[`edit-${e}`], n;
1179
- });
1180
- }, ye = (e) => {
1181
- j((t) => t.filter((t, n) => n !== e));
1182
- }, be = () => {
1183
- let e = de(I);
1184
- if (e) {
1185
- Y(e === "required" ? u._({ id: "QV1ZPO" }) : e === "invalid-chars" ? u._({ id: "XYZLy9" }) : u._({ id: "dTNzBI" }));
1186
- return;
1187
- }
1188
- if (A.some((e) => e.key.toLowerCase() === I.trim().toLowerCase())) {
1189
- Y(u._({ id: "q6K46F" }));
1190
- return;
1191
- }
1192
- j((e) => [...e, {
1193
- uid: T(),
1194
- key: I.trim(),
1195
- value: V,
1196
- isEditing: !1
1197
- }]), R(""), H(""), Y(null), F(!1);
1198
- }, xe = () => {
1199
- R(""), H(""), Y(null), F(!1);
1200
- };
1201
- if (!n || !r) return null;
1202
- let Se = r.displayName, Ce = Z.isPending, we = Ce || v, Te = h?.staticLargeObject === !0, $ = !!h?.objectManifest, Ee = S?.message ?? "", De = Z.error?.message ?? "";
1203
- return /* @__PURE__ */ z(g, {
1204
- title: /* @__PURE__ */ z("span", {
1205
- className: "flex max-w-[400px] items-center gap-1",
1206
- children: /* @__PURE__ */ z(J, {
1207
- id: "bt0uXd",
1208
- values: { displayName: Se },
1209
- components: {
1210
- 0: /* @__PURE__ */ z("span", { className: "shrink-0" }),
1211
- 1: /* @__PURE__ */ z("span", {
1212
- className: "truncate font-mono",
1213
- title: Se
1214
- })
1215
- }
1216
- })
1217
- }),
1218
- open: n,
1219
- onCancel: Q,
1220
- confirmButtonLabel: Ce ? u._({ id: "XvjC4F" }) : u._({ id: "V/SINY" }),
1221
- onConfirm: le,
1222
- cancelButtonLabel: u._({ id: "dEgA5A" }),
1223
- size: P ? "xl" : "large",
1224
- disableConfirmButton: we || !ce || X || P,
1225
- children: v ? /* @__PURE__ */ B(e, {
1226
- direction: "horizontal",
1227
- alignment: "center",
1228
- gap: "2",
1229
- className: "py-8",
1230
- children: [/* @__PURE__ */ z(a, { size: "small" }), /* @__PURE__ */ z(J, { id: "O80bQY" })]
1231
- }) : y ? /* @__PURE__ */ z("p", {
1232
- className: "text-theme-error",
1233
- children: /* @__PURE__ */ z(J, {
1234
- id: "+p6nHr",
1235
- values: { metadataErrorMessage: Ee }
1236
- })
1237
- }) : /* @__PURE__ */ B(e, {
1238
- direction: "vertical",
1239
- gap: "6",
1240
- children: [
1241
- Z.isError && /* @__PURE__ */ z("p", {
1242
- className: "text-theme-error",
1243
- children: /* @__PURE__ */ z(J, {
1244
- id: "7ZnTL8",
1245
- values: { mutationErrorMessage: De }
1246
- })
1247
- }),
1248
- Te && /* @__PURE__ */ z("p", {
1249
- className: "text-theme-default",
1250
- children: /* @__PURE__ */ z(J, {
1251
- id: "WCKEqI",
1252
- components: { 0: /* @__PURE__ */ z("strong", {}) }
1253
- })
1254
- }),
1255
- $ && /* @__PURE__ */ z("p", {
1256
- className: "text-theme-default",
1257
- children: /* @__PURE__ */ z(J, {
1258
- id: "Cu6xuZ",
1259
- components: { 0: /* @__PURE__ */ z("strong", {}) }
1260
- })
1261
- }),
1262
- /* @__PURE__ */ B("div", { children: [/* @__PURE__ */ z("p", {
1263
- className: "text-theme-default mb-3 text-sm font-semibold",
1264
- children: /* @__PURE__ */ z(J, { id: "f0cwjH" })
1265
- }), /* @__PURE__ */ B("div", {
1266
- className: "grid grid-cols-[max-content_1fr] gap-x-6 gap-y-2 text-sm",
1267
- children: [
1268
- /* @__PURE__ */ z("span", {
1269
- className: "text-theme-light text-right",
1270
- children: /* @__PURE__ */ z(J, { id: "IbYr/u" })
1271
- }),
1272
- /* @__PURE__ */ z("span", {
1273
- className: "font-mono",
1274
- children: h?.contentType ?? "—"
1275
- }),
1276
- /* @__PURE__ */ z("span", {
1277
- className: "text-theme-light text-right",
1278
- children: /* @__PURE__ */ z(J, { id: "BoPocW" })
1279
- }),
1280
- /* @__PURE__ */ z("span", {
1281
- className: "font-mono break-all",
1282
- children: h?.etag ?? "—"
1283
- }),
1284
- /* @__PURE__ */ z("span", {
1285
- className: "text-theme-light text-right",
1286
- children: /* @__PURE__ */ z(J, { id: "Cj2Gtd" })
1287
- }),
1288
- /* @__PURE__ */ z("span", { children: h?.contentLength == null ? "—" : L(h.contentLength) }),
1289
- /* @__PURE__ */ z("span", {
1290
- className: "text-theme-light text-right",
1291
- children: /* @__PURE__ */ z(J, { id: "TfC9O+" })
1292
- }),
1293
- /* @__PURE__ */ z("span", { children: h?.lastModified ? fe(h.lastModified) : r.last_modified ? fe(r.last_modified) : "—" })
1294
- ]
1295
- })] }),
1296
- /* @__PURE__ */ B("div", { children: [/* @__PURE__ */ z("p", {
1297
- className: "text-theme-light mb-1",
1298
- children: /* @__PURE__ */ z(J, { id: "8Pcsi8" })
1299
- }), /* @__PURE__ */ z(b, {
1300
- label: u._({ id: "eu70nA" }),
1301
- value: E,
1302
- onChange: (e) => {
1303
- let t = e.target.value;
1304
- D(t), oe.current && clearTimeout(oe.current), oe.current = setTimeout(() => {
1305
- t.trim() && !ue(t.trim()) ? k("invalid") : k(null);
1306
- }, 600);
1307
- },
1308
- invalid: !!O,
1309
- errortext: O ? u._({ id: "48QXFO" }) : void 0,
1310
- placeholder: u._({ id: "Mj5iQ0" }),
1311
- disabled: we
1312
- })] }),
1313
- /* @__PURE__ */ B("div", { children: [
1314
- /* @__PURE__ */ B(e, {
1315
- direction: "horizontal",
1316
- alignment: "center",
1317
- distribution: "between",
1318
- children: [/* @__PURE__ */ z("p", {
1319
- className: "text-theme-default text-sm font-semibold",
1320
- children: /* @__PURE__ */ z(J, { id: "6GBt0m" })
1321
- }), /* @__PURE__ */ z("p", {
1322
- className: "text-theme-light text-xs",
1323
- children: /* @__PURE__ */ z(J, { id: "2TtIL2" })
1324
- })]
1325
- }),
1326
- /* @__PURE__ */ z(e, {
1327
- direction: "horizontal",
1328
- className: "jn:bg-theme-background-lvl-1 mb-3 justify-end p-2",
1329
- children: /* @__PURE__ */ z(_, {
1330
- label: u._({ id: "sWBLli" }),
1331
- onClick: () => F(!0),
1332
- variant: "primary",
1333
- size: "small",
1334
- icon: "addCircle",
1335
- disabled: P || X || we
1336
- })
1337
- }),
1338
- /* @__PURE__ */ B(x, {
1339
- columns: 3,
1340
- children: [
1341
- /* @__PURE__ */ B(o, { children: [
1342
- /* @__PURE__ */ z(l, { children: /* @__PURE__ */ z(J, { id: "7sMeHQ" }) }),
1343
- /* @__PURE__ */ z(l, { children: /* @__PURE__ */ z(J, { id: "wMHvYH" }) }),
1344
- /* @__PURE__ */ z(l, { children: /* @__PURE__ */ z(J, { id: "7L01XJ" }) })
1345
- ] }),
1346
- P && /* @__PURE__ */ B(o, { children: [
1347
- /* @__PURE__ */ z(t, { children: /* @__PURE__ */ z(b, {
1348
- value: I,
1349
- onChange: (e) => {
1350
- R(e.target.value), K && Y(null);
1351
- },
1352
- placeholder: u._({ id: "x9AdZ8" }),
1353
- errortext: K ?? void 0,
1354
- invalid: !!K,
1355
- autoFocus: !0
1356
- }) }),
1357
- /* @__PURE__ */ z(t, { children: /* @__PURE__ */ z(b, {
1358
- value: V,
1359
- onChange: (e) => H(e.target.value),
1360
- placeholder: u._({ id: "wMHvYH" })
1361
- }) }),
1362
- /* @__PURE__ */ z(t, { children: /* @__PURE__ */ B(e, {
1363
- direction: "horizontal",
1364
- gap: "2",
1365
- children: [/* @__PURE__ */ z(_, {
1366
- size: "small",
1367
- variant: "primary",
1368
- onClick: be,
1369
- icon: "check",
1370
- title: u._({ id: "tfDRzk" })
1371
- }), /* @__PURE__ */ z(_, {
1372
- size: "small",
1373
- variant: "subdued",
1374
- onClick: xe,
1375
- icon: "close",
1376
- title: u._({ id: "bzSI52" })
1377
- })]
1378
- }) })
1379
- ] }),
1380
- A.map((n, r) => /* @__PURE__ */ B(o, { children: [
1381
- /* @__PURE__ */ z(t, { children: n.isEditing ? /* @__PURE__ */ z(b, {
1382
- value: n.key,
1383
- onChange: (e) => he(r, e.target.value),
1384
- errortext: M[`edit-${r}`],
1385
- invalid: !!M[`edit-${r}`]
1386
- }) : /* @__PURE__ */ z("span", {
1387
- className: "block max-w-xs truncate font-mono text-sm",
1388
- title: n.key,
1389
- children: n.key
1390
- }) }),
1391
- /* @__PURE__ */ z(t, { children: n.isEditing ? /* @__PURE__ */ z(b, {
1392
- value: n.value,
1393
- onChange: (e) => ge(r, e.target.value)
1394
- }) : /* @__PURE__ */ z("span", {
1395
- className: "block max-w-md truncate text-sm",
1396
- title: n.value,
1397
- children: n.value
1398
- }) }),
1399
- /* @__PURE__ */ z(t, { children: n.isEditing ? /* @__PURE__ */ B(e, {
1400
- direction: "horizontal",
1401
- gap: "2",
1402
- children: [/* @__PURE__ */ z(_, {
1403
- size: "small",
1404
- variant: "primary",
1405
- onClick: () => _e(r),
1406
- icon: "check",
1407
- title: u._({ id: "tfDRzk" })
1408
- }), /* @__PURE__ */ z(_, {
1409
- size: "small",
1410
- variant: "subdued",
1411
- onClick: () => ve(r),
1412
- icon: "close",
1413
- title: u._({ id: "bzSI52" })
1414
- })]
1415
- }) : /* @__PURE__ */ B(e, {
1416
- direction: "horizontal",
1417
- gap: "2",
1418
- children: [/* @__PURE__ */ z(_, {
1419
- size: "small",
1420
- variant: "subdued",
1421
- onClick: () => me(r),
1422
- icon: "edit",
1423
- title: u._({ id: "ePK91l" }),
1424
- disabled: P || X || we
1425
- }), /* @__PURE__ */ z(_, {
1426
- size: "small",
1427
- variant: "default",
1428
- onClick: () => ye(r),
1429
- icon: "deleteForever",
1430
- title: u._({ id: "cnGeoo" }),
1431
- disabled: P || X || we
1432
- })]
1433
- }) })
1434
- ] }, n.uid)),
1435
- A.length === 0 && !P && /* @__PURE__ */ z(o, { children: /* @__PURE__ */ z(t, {
1436
- colSpan: 3,
1437
- className: "py-6 text-center",
1438
- children: /* @__PURE__ */ z(e, {
1439
- alignment: "center",
1440
- children: /* @__PURE__ */ z("span", {
1441
- className: "text-theme-light text-sm",
1442
- children: /* @__PURE__ */ z(J, { id: "F02e8I" })
1443
- })
1444
- })
1445
- }) })
1446
- ]
1447
- })
1448
- ] })
1449
- ]
1450
- })
1451
- });
1452
- }, he = new Set([
1453
- "image/png",
1454
- "image/jpeg",
1455
- "image/gif",
1456
- "image/webp",
1457
- "image/avif",
1458
- "image/bmp",
1459
- "image/x-icon",
1460
- "image/vnd.microsoft.icon",
1461
- "video/mp4",
1462
- "video/webm",
1463
- "video/ogg",
1464
- "audio/mpeg",
1465
- "audio/mp3",
1466
- "audio/ogg",
1467
- "audio/wav",
1468
- "audio/webm",
1469
- "audio/flac",
1470
- "application/pdf",
1471
- "text/plain"
1472
- ]), ge = (e) => {
1473
- if (!e) return !1;
1474
- let t = e.split(";")[0].trim().toLowerCase();
1475
- return he.has(t) ? !0 : t === "image/svg+xml" ? !1 : !!(t.startsWith("image/") || t.startsWith("video/") || t.startsWith("audio/"));
1476
- }, _e = "40px minmax(200px, 3fr) minmax(180px, 2fr) minmax(100px, 1fr) 60px", ve = ({ rows: e, searchTerm: r, container: i, account: c, onFolderClick: d, onDeleteFolderSuccess: p, onDeleteFolderError: m, onDownloadError: h, onDeleteObjectSuccess: g, onDeleteObjectError: _, onCopyObjectSuccess: v, onCopyObjectError: y, onMoveObjectSuccess: b, onMoveObjectError: w, onTempUrlCopySuccess: T, onEditMetadataSuccess: E, onEditMetadataError: D, selectedObjects: O, setSelectedObjects: A }) => {
1477
- let { i18n: M, _: N } = te(), P = ee(), F = W(null), I = W(!0);
1478
- U(() => (I.current = !0, () => {
1479
- I.current = !1;
1480
- }), []);
1481
- let [V, H] = G(0), [K, q] = G(null), [Y, ae] = G(null), [se, X] = G(null), [Q, le] = G(null), [ue, de] = G(null), [fe, pe] = G(null), [he, ve] = G(null), [ye, be] = G(null), [xe, Se] = G(null), { data: Ce } = C.storage.swift.watchDownloadProgress.useSubscription({ downloadId: ye ?? "" }, { enabled: !!ye && he !== null }), we = async (e, t) => {
1482
- let n = e.content_type ?? "application/octet-stream", r = e.displayName, a = await S.storage.swift.downloadObject.mutate({
1483
- project_id: P,
1484
- container: i,
1485
- object: e.name,
1486
- filename: e.displayName,
1487
- downloadId: t,
1488
- ...c ? { account: c } : {}
1489
- }), o = [];
1490
- for await (let { chunk: e, contentType: t, filename: i } of a) t && (n = t), i && (r = i), o.push(Uint8Array.from(atob(e), (e) => e.charCodeAt(0)));
1491
- return {
1492
- blob: new Blob(o, { type: n }),
1493
- filename: r
1494
- };
1495
- }, Te = (e, t) => {
1496
- let n = document.createElement("a");
1497
- n.href = e, n.download = t, document.body.appendChild(n), n.click(), document.body.removeChild(n), setTimeout(() => URL.revokeObjectURL(e), 1e4);
1498
- }, $ = async (e) => {
1499
- let t = `${i}:${e.name}:${crypto.randomUUID()}`;
1500
- ve(e), be(t);
1501
- try {
1502
- let { blob: n, filename: r } = await we(e, t);
1503
- Te(URL.createObjectURL(n), r);
1504
- } catch (t) {
1505
- h(e.displayName, t instanceof Error ? t.message : String(t));
1506
- } finally {
1507
- I.current && (ve(null), be(null));
1508
- }
1509
- }, Ee = async (e) => {
1510
- let t = `${i}:${e.name}:${crypto.randomUUID()}`, n = ge(e.content_type);
1511
- n ? Se(e) : (ve(e), be(t));
1512
- let r = n ? window.open("", "_blank") : null;
1513
- r && (r.opener = null);
1514
- try {
1515
- let { blob: i, filename: a } = await we(e, t), o = URL.createObjectURL(i);
1516
- n ? (r && (r.location.href = o), setTimeout(() => URL.revokeObjectURL(o), 1e4)) : Te(o, a);
1517
- } catch (t) {
1518
- r?.close(), h(e.displayName, t instanceof Error ? t.message : String(t));
1519
- } finally {
1520
- I.current && (Se(null), ve(null), be(null));
1521
- }
1522
- };
1523
- U(() => {
1524
- F.current && H(F.current.offsetWidth - F.current.clientWidth);
1525
- }, [e.length]);
1526
- let De = ne({
1527
- count: e.length,
1528
- getScrollElement: () => F.current,
1529
- estimateSize: () => 48,
1530
- overscan: 10
1531
- }), Oe = (e) => {
1532
- let t = new Date(e);
1533
- return Number.isNaN(t.getTime()) ? M._({ id: "fj5byd" }) : t.toLocaleString();
1534
- }, ke = e.filter((e) => e.kind === "object"), Ae = new Set(O), je = ke.length > 0 && ke.every((e) => Ae.has(e.name)), Me = () => {
1535
- A(je ? [] : ke.map((e) => e.name));
1536
- }, Ne = (e) => {
1537
- O.includes(e) ? A(O.filter((t) => t !== e)) : A([...O, e]);
1538
- };
1539
- if (e.length === 0) return /* @__PURE__ */ z(x, {
1540
- columns: 5,
1541
- className: "objects",
1542
- "data-testid": "no-objects",
1543
- children: /* @__PURE__ */ z(o, { children: /* @__PURE__ */ z(t, {
1544
- colSpan: 5,
1545
- children: /* @__PURE__ */ B("div", {
1546
- className: "py-8 text-center",
1547
- children: [/* @__PURE__ */ z("h3", {
1548
- className: "text-lg font-semibold",
1549
- children: /* @__PURE__ */ z(J, { id: "arel2K" })
1550
- }), /* @__PURE__ */ z("p", {
1551
- className: "text-theme-light mt-2",
1552
- children: r ? /* @__PURE__ */ z(J, { id: "H4Qwmp" }) : /* @__PURE__ */ z(J, { id: "Pkw7J9" })
1553
- })]
1554
- })
1555
- }) })
1556
- });
1557
- let Pe = e.length, Fe = he !== null || xe !== null;
1558
- return /* @__PURE__ */ B(R, { children: [
1559
- /* @__PURE__ */ B("div", {
1560
- className: "relative",
1561
- children: [
1562
- /* @__PURE__ */ z("div", {
1563
- style: { paddingRight: `${V}px` },
1564
- children: /* @__PURE__ */ z(x, {
1565
- columns: 5,
1566
- gridColumnTemplate: _e,
1567
- className: "objects",
1568
- "data-testid": "objects-table-header",
1569
- children: /* @__PURE__ */ B(o, { children: [
1570
- /* @__PURE__ */ z(l, { children: /* @__PURE__ */ z(n, {
1571
- checked: je,
1572
- onChange: Me,
1573
- "data-testid": "select-all-objects"
1574
- }) }),
1575
- /* @__PURE__ */ z(l, { children: /* @__PURE__ */ z(J, { id: "wrXcuy" }) }),
1576
- /* @__PURE__ */ z(l, { children: /* @__PURE__ */ z(J, { id: "sjMCOP" }) }),
1577
- /* @__PURE__ */ z(l, { children: /* @__PURE__ */ z(J, { id: "Cj2Gtd" }) }),
1578
- /* @__PURE__ */ z(l, { style: { marginRight: `-${V}px` } })
1579
- ] })
1580
- })
1581
- }),
1582
- /* @__PURE__ */ z("div", {
1583
- ref: F,
1584
- className: "overflow-auto",
1585
- style: { height: "calc(100vh - 550px)" },
1586
- "data-testid": "objects-table-body",
1587
- children: /* @__PURE__ */ z("div", {
1588
- style: {
1589
- height: `${De.getTotalSize()}px`,
1590
- width: "100%",
1591
- position: "relative"
1592
- },
1593
- children: De.getVirtualItems().map((r) => {
1594
- let i = e[r.index], o = i.kind === "folder", c = !o && he?.name === i.name, l = i.displayName, p = !o && O.includes(i.name);
1595
- return /* @__PURE__ */ B("div", {
1596
- "data-index": r.index,
1597
- ref: De.measureElement,
1598
- className: "juno-datagrid",
1599
- style: {
1600
- position: "absolute",
1601
- top: 0,
1602
- left: 0,
1603
- width: "100%",
1604
- transform: `translateY(${r.start}px)`,
1605
- display: "grid",
1606
- gridTemplateColumns: _e,
1607
- alignItems: "stretch"
1608
- },
1609
- "data-testid": `object-row-${i.name}`,
1610
- children: [
1611
- /* @__PURE__ */ z(t, {
1612
- onClick: (e) => e.stopPropagation(),
1613
- children: !o && /* @__PURE__ */ z(n, {
1614
- checked: p,
1615
- onChange: () => Ne(i.name),
1616
- "data-testid": `select-object-${i.name}`
1617
- })
1618
- }),
1619
- /* @__PURE__ */ z(t, {
1620
- className: "min-w-0 overflow-hidden",
1621
- children: o ? /* @__PURE__ */ B("button", {
1622
- type: "button",
1623
- className: "focus-visible:outline-theme-focus flex min-w-0 items-center gap-2 rounded text-left hover:underline focus-visible:outline focus-visible:outline-2",
1624
- onClick: () => d(i.name),
1625
- "data-testid": `folder-${i.name}`,
1626
- title: i.displayName,
1627
- children: [/* @__PURE__ */ z(k, {
1628
- size: 18,
1629
- className: "text-theme-light shrink-0"
1630
- }), /* @__PURE__ */ z("span", {
1631
- className: "truncate",
1632
- children: i.displayName
1633
- })]
1634
- }) : /* @__PURE__ */ B("button", {
1635
- type: "button",
1636
- className: "focus-visible:outline-theme-focus flex min-w-0 items-center gap-2 rounded text-left hover:underline focus-visible:outline focus-visible:outline-2 disabled:cursor-wait disabled:opacity-60",
1637
- onClick: () => Ee(i),
1638
- disabled: Fe,
1639
- "data-testid": `preview-${i.name}`,
1640
- title: ge(i.content_type) ? M._({
1641
- id: "k7ENJG",
1642
- values: { rowDisplayName: l }
1643
- }) : M._({
1644
- id: "LI8Z2I",
1645
- values: { rowDisplayName: l }
1646
- }),
1647
- children: [xe?.name === i.name ? /* @__PURE__ */ z(a, {
1648
- size: "small",
1649
- className: "shrink-0"
1650
- }) : /* @__PURE__ */ z(j, {
1651
- size: 18,
1652
- className: "text-theme-light shrink-0"
1653
- }), /* @__PURE__ */ z("span", {
1654
- className: "truncate",
1655
- children: i.displayName
1656
- })]
1657
- })
1658
- }),
1659
- /* @__PURE__ */ z(t, { children: c ? /* @__PURE__ */ z("span", {
1660
- className: "flex min-w-0 flex-col gap-1",
1661
- children: (() => {
1662
- let e = Ce?.percent ?? null;
1663
- return /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ B("span", {
1664
- className: "text-theme-light flex items-center gap-2 text-sm",
1665
- children: [/* @__PURE__ */ z(a, { size: "small" }), e === null ? /* @__PURE__ */ z(J, { id: "cCfxH1" }) : /* @__PURE__ */ z(J, {
1666
- id: "Flugry",
1667
- values: { progressPct: e }
1668
- })]
1669
- }), e !== null && /* @__PURE__ */ z("div", {
1670
- className: "bg-theme-background-lvl-2 h-1 w-full overflow-hidden rounded-full",
1671
- children: /* @__PURE__ */ z("div", {
1672
- className: "bg-theme-accent h-1 rounded-full transition-all duration-150",
1673
- style: { width: `${e}%` }
1674
- })
1675
- })] });
1676
- })()
1677
- }) : !o && i.last_modified ? Oe(i.last_modified) : "—" }),
1678
- /* @__PURE__ */ z(t, { children: o ? "—" : L(i.bytes) }),
1679
- /* @__PURE__ */ z(t, {
1680
- onClick: (e) => e.stopPropagation(),
1681
- children: /* @__PURE__ */ z(f, {
1682
- disabled: Fe,
1683
- children: /* @__PURE__ */ z(s, { children: o ? /* @__PURE__ */ z(u, {
1684
- label: M._({ id: "9vSW3U" }),
1685
- onClick: () => q(i),
1686
- "data-testid": `delete-recursively-action-${i.name}`
1687
- }) : /* @__PURE__ */ B(R, { children: [
1688
- /* @__PURE__ */ z(u, {
1689
- label: c ? M._({ id: "cCfxH1" }) : M._({ id: "mzI/c+" }),
1690
- disabled: c,
1691
- onClick: () => $(i),
1692
- "data-testid": `download-action-${i.name}`
1693
- }),
1694
- /* @__PURE__ */ z(u, {
1695
- label: M._({ id: "SIfYq6" }),
1696
- onClick: () => pe(i),
1697
- "data-testid": `edit-metadata-action-${i.name}`
1698
- }),
1699
- /* @__PURE__ */ z(u, {
1700
- label: M._({ id: "he3ygx" }),
1701
- onClick: () => X(i),
1702
- "data-testid": `copy-action-${i.name}`
1703
- }),
1704
- /* @__PURE__ */ z(u, {
1705
- label: M._({ id: "v3djpU" }),
1706
- onClick: () => le(i),
1707
- "data-testid": `move-rename-action-${i.name}`
1708
- }),
1709
- /* @__PURE__ */ z(u, {
1710
- label: M._({ id: "WrUky8" }),
1711
- onClick: () => de(i),
1712
- "data-testid": `temp-url-action-${i.name}`
1713
- }),
1714
- /* @__PURE__ */ z(u, {
1715
- label: M._({ id: "cnGeoo" }),
1716
- onClick: () => ae(i),
1717
- "data-testid": `delete-action-${i.name}`
1718
- })
1719
- ] }) })
1720
- })
1721
- })
1722
- ]
1723
- }, i.name);
1724
- })
1725
- })
1726
- }),
1727
- /* @__PURE__ */ z("div", {
1728
- className: "text-theme-light border-theme-background-lvl-2 border-t px-4 py-2 text-sm",
1729
- children: /* @__PURE__ */ z(J, {
1730
- id: "vg84cD",
1731
- values: { allCount: Pe }
1732
- })
1733
- })
1734
- ]
1735
- }),
1736
- /* @__PURE__ */ z(re, {
1737
- isOpen: K !== null,
1738
- folder: K,
1739
- onClose: () => q(null),
1740
- onSuccess: p,
1741
- onError: m
1742
- }),
1743
- /* @__PURE__ */ z(ie, {
1744
- isOpen: Y !== null,
1745
- object: Y,
1746
- onClose: () => ae(null),
1747
- onSuccess: g,
1748
- onError: _
1749
- }),
1750
- /* @__PURE__ */ z(oe, {
1751
- isOpen: se !== null,
1752
- object: se,
1753
- onClose: () => X(null),
1754
- onSuccess: v,
1755
- onError: y
1756
- }),
1757
- /* @__PURE__ */ z(ce, {
1758
- isOpen: Q !== null,
1759
- object: Q,
1760
- onClose: () => le(null),
1761
- onSuccess: b,
1762
- onError: w
1763
- }),
1764
- /* @__PURE__ */ z(Z, {
1765
- isOpen: ue !== null,
1766
- object: ue,
1767
- account: c,
1768
- onClose: () => de(null),
1769
- onCopySuccess: T
1770
- }),
1771
- /* @__PURE__ */ z(me, {
1772
- isOpen: fe !== null,
1773
- object: fe,
1774
- onClose: () => pe(null),
1775
- onSuccess: E,
1776
- onError: D
1777
- })
1778
- ] });
1779
- };
1780
- //#endregion
1781
- //#region src/client/routes/_auth/projects/$projectId/storage/-components/Swift/Objects/ObjectsFileNavigation.tsx
1782
- function ye(e) {
1783
- if (!e) return [];
1784
- let t = e.replace(/\/$/, "").split("/").filter(Boolean);
1785
- return t.map((e, n) => ({
1786
- label: e,
1787
- prefix: t.slice(0, n + 1).join("/") + "/"
1788
- }));
1789
- }
1790
- var be = "bg-theme-background-lvl-4 rounded px-2 py-0.5", xe = ({ containerName: e, currentPrefix: t, onContainersClick: n, onPrefixClick: a }) => {
1791
- let { i18n: o, _: s } = te(), c = ye(t), l = c.length === 0;
1792
- return /* @__PURE__ */ z("div", {
1793
- className: "mb-2 px-2 pt-2",
1794
- children: /* @__PURE__ */ B(i, { children: [
1795
- /* @__PURE__ */ z(r, {
1796
- onClick: n,
1797
- label: /* @__PURE__ */ B("span", {
1798
- className: "flex items-center gap-1",
1799
- children: [/* @__PURE__ */ z(A, {
1800
- size: 15,
1801
- className: "shrink-0"
1802
- }), o._({ id: "PLwzWR" })]
1803
- })
1804
- }),
1805
- /* @__PURE__ */ z(r, {
1806
- onClick: l ? void 0 : () => a(""),
1807
- active: l,
1808
- label: /* @__PURE__ */ B("span", {
1809
- className: `flex items-center gap-1 ${l ? be : ""}`,
1810
- children: [z(l ? D : E, {
1811
- size: 15,
1812
- className: "shrink-0"
1813
- }), e]
1814
- })
1815
- }),
1816
- c.map((e, t) => {
1817
- let n = t === c.length - 1;
1818
- return /* @__PURE__ */ z(r, {
1819
- onClick: n ? void 0 : () => a(e.prefix),
1820
- active: n,
1821
- label: /* @__PURE__ */ B("span", {
1822
- className: `flex items-center gap-1 ${n ? be : ""}`,
1823
- children: [z(n ? P : k, {
1824
- size: 15,
1825
- className: "shrink-0"
1826
- }), e.label]
1827
- })
1828
- }, e.prefix);
1829
- })
1830
- ] })
1831
- });
1832
- }, Se = ({ isOpen: t, currentPrefix: n, onClose: r, onSuccess: i, onError: a }) => {
1833
- let { i18n: o, _: s } = te(), c = ee(), { containerName: l } = q({ from: "/_auth/projects/$projectId/storage/$provider/containers/$containerName/objects/" }), [u, d] = G(""), [f, p] = G(null), m = C.useUtils(), h = W(""), _ = C.storage.swift.createFolder.useMutation({
1834
- onSuccess: () => {
1835
- m.storage.swift.listObjects.invalidate(), i?.(h.current);
1836
- },
1837
- onError: (e) => {
1838
- a?.(h.current, e.message);
1839
- },
1840
- onSettled: () => {
1841
- v();
1842
- }
1843
- }), v = () => {
1844
- d(""), p(null), _.reset(), r();
1845
- }, y = (e) => {
1846
- let t = e.trim();
1847
- return t ? t.includes("/") ? (p(o._({ id: "Vl4XTj" })), !1) : t === e ? (p(null), !0) : (p(o._({ id: "gFKJBP" })), !1) : (p(o._({ id: "Fzrzfe" })), !1);
1848
- }, x = (e) => {
1849
- let t = e.target.value;
1850
- d(t), f && y(t);
1851
- }, S = () => {
1852
- if (!y(u)) return;
1853
- h.current = u.trim();
1854
- let e = `${n}${h.current}/`;
1855
- _.mutate({
1856
- project_id: c,
1857
- container: l,
1858
- folderPath: e
1859
- });
1860
- }, w = (e) => {
1861
- e.key === "Enter" && S();
1862
- }, T = n || "/";
1863
- return t ? /* @__PURE__ */ z(g, {
1864
- title: /* @__PURE__ */ B("span", {
1865
- className: "flex max-w-[400px] items-center gap-1",
1866
- children: [/* @__PURE__ */ z("span", {
1867
- className: "shrink-0",
1868
- children: /* @__PURE__ */ z(J, { id: "/Z5n1b" })
1869
- }), /* @__PURE__ */ z("span", {
1870
- className: "truncate font-mono",
1871
- title: T,
1872
- children: T
1873
- })]
1874
- }),
1875
- open: t,
1876
- onCancel: v,
1877
- confirmButtonLabel: o._({ id: "boJ+Y1" }),
1878
- onConfirm: S,
1879
- cancelButtonLabel: o._({ id: "dEgA5A" }),
1880
- size: "small",
1881
- disableConfirmButton: _.isPending || !u.trim(),
1882
- children: /* @__PURE__ */ B(e, {
1883
- direction: "vertical",
1884
- gap: "6",
1885
- children: [/* @__PURE__ */ z("p", {
1886
- className: "text-theme-default",
1887
- children: /* @__PURE__ */ z(J, { id: "Z42tfY" })
1888
- }), /* @__PURE__ */ z(b, {
1889
- label: o._({ id: "cqQyPB" }),
1890
- required: !0,
1891
- value: u,
1892
- onChange: x,
1893
- onKeyDown: w,
1894
- invalid: !!f,
1895
- errortext: f || void 0,
1896
- disabled: _.isPending,
1897
- autoFocus: !0,
1898
- placeholder: o._({ id: "Zw49f9" })
1899
- })]
1900
- })
1901
- }) : null;
1902
- }, Ce = ({ isOpen: t, currentPrefix: n, container: r, projectId: i, account: o, onClose: s, onSuccess: c, onError: l, onCancelled: u }) => {
1903
- let { i18n: d, _: f } = te(), [p, m] = G(null), [h, _] = G(null), [v, y] = G(!1), [b, x] = G(null), [T, E] = G(null), [D, O] = G(!1), k = W(""), A = W(null), j = W(null), N = C.useUtils(), P = () => {
1904
- j.current?.abort();
1905
- }, { data: F } = C.storage.swift.watchUploadProgress.useSubscription({ uploadId: b ?? "" }, { enabled: !!b && D }), I = () => {
1906
- D || ee();
1907
- }, ee = () => {
1908
- m(null), _(null), y(!1), x(null), E(null), A.current && (A.current.value = ""), s();
1909
- }, V = (e) => {
1910
- let t = e.target.files?.[0];
1911
- t && (_(null), E(null), m(t));
1912
- }, H = (e) => {
1913
- e.preventDefault(), e.stopPropagation(), !D && y(!0);
1914
- }, U = (e) => {
1915
- e.preventDefault(), e.stopPropagation(), !D && y(!1);
1916
- }, K = (e) => {
1917
- if (e.preventDefault(), e.stopPropagation(), y(!1), D) return;
1918
- let t = e.dataTransfer.files?.[0];
1919
- t && (_(null), E(null), m(t));
1920
- }, q = async () => {
1921
- if (!p) {
1922
- _(d._({ id: "AB4Tnl" }));
1923
- return;
1924
- }
1925
- let e = `${n}${p.name}`, t = `${r}:${e}:${crypto.randomUUID()}`;
1926
- k.current = p.name, E(null);
1927
- let a = new AbortController();
1928
- j.current = a, x(t), O(!0);
1929
- try {
1930
- let n = { headers: {
1931
- "x-upload-project-id": i,
1932
- "x-upload-container": r,
1933
- "x-upload-object": e,
1934
- "x-upload-type": p.type || "application/octet-stream",
1935
- "x-upload-size": String(p.size),
1936
- "x-upload-id": t,
1937
- ...o ? { "x-upload-account": o } : {}
1938
- } };
1939
- await S.storage.swift.uploadObject.mutate(p, {
1940
- context: n,
1941
- signal: a.signal
1942
- }), N.storage.swift.listObjects.invalidate({ container: r }), c?.(k.current), ee();
1943
- } catch (e) {
1944
- if (e instanceof Error && (e.name === "AbortError" || e.message === "Request canceled" || e.message.includes("signal is aborted") || e.message.includes("aborted"))) {
1945
- u?.(k.current), ee();
1946
- return;
1947
- }
1948
- let t = e instanceof Error ? e.message : String(e);
1949
- E(t), l?.(k.current, t);
1950
- } finally {
1951
- O(!1), x(null), j.current = null;
1952
- }
1953
- }, Y = F?.percent ?? null;
1954
- if (!t) return null;
1955
- let ne = n || "/", re = p ? `${n}${p.name}` : "";
1956
- return /* @__PURE__ */ z(g, {
1957
- title: /* @__PURE__ */ B("span", {
1958
- className: "flex max-w-[400px] items-center gap-1",
1959
- children: [/* @__PURE__ */ z("span", {
1960
- className: "shrink-0",
1961
- children: /* @__PURE__ */ z(J, { id: "SU0uxT" })
1962
- }), /* @__PURE__ */ z("span", {
1963
- className: "truncate font-mono",
1964
- title: ne,
1965
- children: ne
1966
- })]
1967
- }),
1968
- open: t,
1969
- onCancel: D ? P : I,
1970
- confirmButtonLabel: D ? d._({ id: "GxkJXS" }) : d._({ id: "ONWvwQ" }),
1971
- onConfirm: q,
1972
- cancelButtonLabel: D ? d._({ id: "k99j0U" }) : d._({ id: "dEgA5A" }),
1973
- size: "small",
1974
- disableConfirmButton: D || !p,
1975
- disableCloseButton: D,
1976
- children: /* @__PURE__ */ B(e, {
1977
- direction: "vertical",
1978
- gap: "4",
1979
- children: [
1980
- T && /* @__PURE__ */ z("p", {
1981
- className: "text-theme-error",
1982
- children: /* @__PURE__ */ z(J, {
1983
- id: "QetsXP",
1984
- values: { uploadError: T }
1985
- })
1986
- }),
1987
- p && !D && /* @__PURE__ */ z("p", {
1988
- className: "text-theme-default",
1989
- children: /* @__PURE__ */ z(J, {
1990
- id: "4fvcmm",
1991
- values: { selectedObjectName: re },
1992
- components: { 0: /* @__PURE__ */ z("span", { className: "font-mono font-semibold" }) }
1993
- })
1994
- }),
1995
- /* @__PURE__ */ B("div", { children: [
1996
- /* @__PURE__ */ B("label", {
1997
- htmlFor: "upload-object-file",
1998
- className: w("flex flex-col items-center justify-center rounded-lg border-2 border-dashed px-6 py-8 text-center transition-colors", v ? "border-theme-accent bg-theme-background-lvl-2" : D ? "border-theme-background-lvl-4 pointer-events-none cursor-not-allowed opacity-60" : "border-theme-background-lvl-4 hover:border-theme-accent hover:bg-theme-background-lvl-1 cursor-pointer"),
1999
- onDragOver: H,
2000
- onDragLeave: U,
2001
- onDrop: K,
2002
- children: [
2003
- /* @__PURE__ */ z(M, {
2004
- className: "text-theme-light mb-2",
2005
- size: 40
2006
- }),
2007
- /* @__PURE__ */ z("p", {
2008
- className: "text-theme-default text-sm font-medium",
2009
- children: v ? /* @__PURE__ */ z("span", { children: d._({ id: "DvB4XF" }) }) : /* @__PURE__ */ B(R, { children: [
2010
- /* @__PURE__ */ z("span", {
2011
- className: "font-semibold",
2012
- children: d._({ id: "gYe+hC" })
2013
- }),
2014
- " ",
2015
- d._({ id: "Np28ib" })
2016
- ] })
2017
- }),
2018
- /* @__PURE__ */ z("p", {
2019
- className: "text-theme-light mt-1 text-xs",
2020
- children: d._({ id: "x/XQrD" })
2021
- }),
2022
- /* @__PURE__ */ z("input", {
2023
- ref: A,
2024
- id: "upload-object-file",
2025
- type: "file",
2026
- className: "hidden",
2027
- onChange: V,
2028
- disabled: D
2029
- })
2030
- ]
2031
- }),
2032
- p && /* @__PURE__ */ B("div", {
2033
- className: "mt-2 flex items-center justify-between rounded-lg border border-green-200 bg-green-50 p-2 text-xs",
2034
- children: [/* @__PURE__ */ B("div", {
2035
- className: "flex min-w-0 items-center gap-2",
2036
- children: [
2037
- /* @__PURE__ */ z("svg", {
2038
- className: "h-4 w-4 shrink-0 text-green-600",
2039
- fill: "currentColor",
2040
- viewBox: "0 0 20 20",
2041
- children: /* @__PURE__ */ z("path", {
2042
- fillRule: "evenodd",
2043
- d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",
2044
- clipRule: "evenodd"
2045
- })
2046
- }),
2047
- /* @__PURE__ */ z("span", {
2048
- className: "truncate text-gray-700",
2049
- children: p.name
2050
- }),
2051
- /* @__PURE__ */ B("span", {
2052
- className: "shrink-0 text-gray-400",
2053
- children: [
2054
- "(",
2055
- L(p.size),
2056
- ")"
2057
- ]
2058
- })
2059
- ]
2060
- }), !D && /* @__PURE__ */ z("button", {
2061
- type: "button",
2062
- onClick: () => {
2063
- m(null), _(null), E(null), A.current && (A.current.value = "");
2064
- },
2065
- className: "ml-2 shrink-0 font-medium text-red-600 hover:text-red-800",
2066
- children: d._({ id: "t/YqKh" })
2067
- })]
2068
- }),
2069
- h && /* @__PURE__ */ z("p", {
2070
- className: "mt-1 text-xs text-red-600",
2071
- children: h
2072
- })
2073
- ] }),
2074
- D && /* @__PURE__ */ B("div", {
2075
- className: "flex flex-col gap-2",
2076
- children: [/* @__PURE__ */ B("span", {
2077
- className: "text-theme-light flex items-center gap-2 text-sm",
2078
- children: [/* @__PURE__ */ z(a, { size: "small" }), Y === null ? /* @__PURE__ */ z(J, { id: "GxkJXS" }) : /* @__PURE__ */ z(J, {
2079
- id: "oEGiW3",
2080
- values: { progressPct: Y }
2081
- })]
2082
- }), Y !== null && /* @__PURE__ */ z("div", {
2083
- className: "bg-theme-background-lvl-2 h-1.5 w-full overflow-hidden rounded-full",
2084
- children: /* @__PURE__ */ z("div", {
2085
- className: "bg-theme-accent h-1.5 rounded-full transition-all duration-150",
2086
- style: { width: `${Y}%` }
2087
- })
2088
- })]
2089
- })
2090
- ]
2091
- })
2092
- });
2093
- }, we = 20, Te = ({ isOpen: t, objectNames: n, objectKeys: r, container: i, account: o, onClose: s, onSuccess: c, onError: l }) => {
2094
- let { i18n: u, _: d } = te(), f = ee(), p = C.useUtils(), m = C.storage.swift.bulkDelete.useMutation({
2095
- onSuccess: (e) => {
2096
- if (p.storage.swift.listObjects.invalidate({ container: i }), e.errors.length > 0) {
2097
- let t = e.errors.map((e) => `${e.path}: ${e.error}`).join("\n"), n = new Set(e.errors.map((e) => e.path)), a = r.filter((e) => !n.has(`/${encodeURIComponent(i)}/${encodeURIComponent(e)}`)), { numberDeleted: o } = e, s = o > 0 ? `${u._({
2098
- id: "Q9f2QF",
2099
- values: { numberDeleted: o }
2100
- })}\n${t}` : t;
2101
- l?.(s, a);
2102
- } else c?.(e.numberDeleted);
2103
- },
2104
- onError: (e) => {
2105
- l?.(e.message, []);
2106
- },
2107
- onSettled: () => {
2108
- h();
2109
- }
2110
- }), h = () => {
2111
- m.reset(), s();
2112
- }, _ = () => {
2113
- let e = r.map((e) => `/${encodeURIComponent(i)}/${encodeURIComponent(e)}`);
2114
- m.mutate({
2115
- project_id: f,
2116
- objects: e,
2117
- ...o ? { account: o } : {}
2118
- });
2119
- };
2120
- if (!t || r.length === 0) return null;
2121
- let v = r.length, y = n.slice(0, we), b = v - y.length, x = m.isPending;
2122
- return /* @__PURE__ */ z(g, {
2123
- title: u._({ id: "p6CSHM" }),
2124
- open: t,
2125
- onCancel: h,
2126
- confirmButtonLabel: x ? u._({ id: "EF2EU9" }) : u._({ id: "cnGeoo" }),
2127
- confirmButtonVariant: "primary-danger",
2128
- cancelButtonLabel: u._({ id: "dEgA5A" }),
2129
- onConfirm: _,
2130
- disableConfirmButton: x,
2131
- disableCancelButton: x,
2132
- disableCloseButton: x,
2133
- size: "small",
2134
- children: x ? /* @__PURE__ */ z(e, {
2135
- distribution: "center",
2136
- alignment: "center",
2137
- className: "py-4",
2138
- children: /* @__PURE__ */ z(a, { variant: "primary" })
2139
- }) : /* @__PURE__ */ B("div", {
2140
- className: "my-6",
2141
- children: [/* @__PURE__ */ z("p", {
2142
- className: "text-theme-default mb-6",
2143
- children: /* @__PURE__ */ z(J, { id: "xYrGVV" })
2144
- }), /* @__PURE__ */ B("div", {
2145
- className: "mb-6",
2146
- children: [/* @__PURE__ */ z("h3", {
2147
- className: "jn:text-theme-high mb-3 font-semibold",
2148
- children: /* @__PURE__ */ z(J, {
2149
- id: "B2i9cQ",
2150
- values: { totalCount: v }
2151
- })
2152
- }), /* @__PURE__ */ B("div", {
2153
- className: "jn:bg-theme-background-lvl-1 max-h-48 overflow-y-auto rounded p-4",
2154
- children: [/* @__PURE__ */ z("ul", {
2155
- className: "space-y-1",
2156
- children: y.map((e) => /* @__PURE__ */ z("li", {
2157
- className: "jn:text-theme-default font-mono text-sm",
2158
- children: e
2159
- }, e))
2160
- }), b > 0 && /* @__PURE__ */ z("p", {
2161
- className: "text-theme-light mt-2 text-xs",
2162
- children: /* @__PURE__ */ z(J, {
2163
- id: "yqPflB",
2164
- values: { hiddenCount: b }
2165
- })
2166
- })]
2167
- })]
2168
- })]
2169
- })
2170
- });
2171
- };
2172
- //#endregion
2173
- //#region src/client/routes/_auth/projects/$projectId/storage/-components/Swift/Objects/ObjectToastNotifications.tsx
2174
- function $({ title: t, description: n }) {
2175
- return /* @__PURE__ */ B(e, {
2176
- direction: "vertical",
2177
- gap: "1.5",
2178
- children: [/* @__PURE__ */ z("span", { children: t }), /* @__PURE__ */ z("span", {
2179
- className: "text-theme-light",
2180
- children: n
2181
- })]
2182
- });
2183
- }
2184
- var Ee = (e, t) => ({
2185
- variant: "success",
2186
- autoDismiss: !0,
2187
- autoDismissTimeout: t.autoDismissTimeout ?? 5e3,
2188
- onDismiss: t.onDismiss,
2189
- children: /* @__PURE__ */ z($, {
2190
- title: /* @__PURE__ */ z(J, { id: "6KRclz" }),
2191
- description: /* @__PURE__ */ z(J, {
2192
- id: "KsnZ3m",
2193
- values: { folderName: e }
2194
- })
2195
- })
2196
- }), De = (e, t, n) => ({
2197
- variant: "error",
2198
- autoDismiss: !0,
2199
- autoDismissTimeout: n.autoDismissTimeout ?? 5e3,
2200
- onDismiss: n.onDismiss,
2201
- children: /* @__PURE__ */ z($, {
2202
- title: /* @__PURE__ */ z(J, { id: "q88/6A" }),
2203
- description: /* @__PURE__ */ z(J, {
2204
- id: "NW4PIb",
2205
- values: {
2206
- folderName: e,
2207
- errorMessage: t
2208
- }
2209
- })
2210
- })
2211
- }), Oe = (e, t, n) => ({
2212
- variant: "success",
2213
- autoDismiss: !0,
2214
- autoDismissTimeout: n.autoDismissTimeout ?? 5e3,
2215
- onDismiss: n.onDismiss,
2216
- children: /* @__PURE__ */ z($, {
2217
- title: /* @__PURE__ */ z(J, { id: "J7+bZb" }),
2218
- description: t === 0 ? /* @__PURE__ */ z(J, {
2219
- id: "qUlxA+",
2220
- values: { folderName: e }
2221
- }) : t === 1 ? /* @__PURE__ */ z(J, {
2222
- id: "LQQCas",
2223
- values: {
2224
- folderName: e,
2225
- deletedCount: t
2226
- }
2227
- }) : /* @__PURE__ */ z(J, {
2228
- id: "jK6wqe",
2229
- values: {
2230
- folderName: e,
2231
- deletedCount: t
2232
- }
2233
- })
2234
- })
2235
- }), ke = (e, t, n) => ({
2236
- variant: "error",
2237
- autoDismiss: !0,
2238
- autoDismissTimeout: n.autoDismissTimeout ?? 5e3,
2239
- onDismiss: n.onDismiss,
2240
- children: /* @__PURE__ */ z($, {
2241
- title: /* @__PURE__ */ z(J, { id: "Uj+n/2" }),
2242
- description: /* @__PURE__ */ z(J, {
2243
- id: "2dnZwV",
2244
- values: {
2245
- folderName: e,
2246
- errorMessage: t
2247
- }
2248
- })
2249
- })
2250
- }), Ae = (e, t, n) => ({
2251
- variant: "error",
2252
- autoDismiss: !0,
2253
- autoDismissTimeout: n.autoDismissTimeout ?? 5e3,
2254
- onDismiss: n.onDismiss,
2255
- children: /* @__PURE__ */ z($, {
2256
- title: /* @__PURE__ */ z(J, { id: "hPz54a" }),
2257
- description: /* @__PURE__ */ z(J, {
2258
- id: "/1MfrG",
2259
- values: {
2260
- objectName: e,
2261
- errorMessage: t
2262
- }
2263
- })
2264
- })
2265
- }), je = (e, t) => ({
2266
- variant: "success",
2267
- autoDismiss: !0,
2268
- autoDismissTimeout: t.autoDismissTimeout ?? 5e3,
2269
- onDismiss: t.onDismiss,
2270
- children: /* @__PURE__ */ z($, {
2271
- title: /* @__PURE__ */ z(J, { id: "z9NAjZ" }),
2272
- description: /* @__PURE__ */ z(J, {
2273
- id: "HlwgQN",
2274
- values: { objectName: e }
2275
- })
2276
- })
2277
- }), Me = (e, t, n) => ({
2278
- variant: "error",
2279
- autoDismiss: !0,
2280
- autoDismissTimeout: n.autoDismissTimeout ?? 5e3,
2281
- onDismiss: n.onDismiss,
2282
- children: /* @__PURE__ */ z($, {
2283
- title: /* @__PURE__ */ z(J, { id: "RSg/pq" }),
2284
- description: /* @__PURE__ */ z(J, {
2285
- id: "/LqWNN",
2286
- values: {
2287
- objectName: e,
2288
- errorMessage: t
2289
- }
2290
- })
2291
- })
2292
- }), Ne = (e, t, n, r) => {
2293
- let i = n ? `${t}/${n}` : t;
2294
- return {
2295
- variant: "success",
2296
- autoDismiss: !0,
2297
- autoDismissTimeout: r.autoDismissTimeout ?? 5e3,
2298
- onDismiss: r.onDismiss,
2299
- children: /* @__PURE__ */ z($, {
2300
- title: /* @__PURE__ */ z(J, { id: "Lylr9Z" }),
2301
- description: /* @__PURE__ */ z(J, {
2302
- id: "5aNQ3F",
2303
- values: {
2304
- objectName: e,
2305
- destination: i
2306
- }
2307
- })
2308
- })
2309
- };
2310
- }, Pe = (e, t, n) => ({
2311
- variant: "error",
2312
- autoDismiss: !0,
2313
- autoDismissTimeout: n.autoDismissTimeout ?? 5e3,
2314
- onDismiss: n.onDismiss,
2315
- children: /* @__PURE__ */ z($, {
2316
- title: /* @__PURE__ */ z(J, { id: "tOkmLM" }),
2317
- description: /* @__PURE__ */ z(J, {
2318
- id: "tlfxPP",
2319
- values: {
2320
- objectName: e,
2321
- errorMessage: t
2322
- }
2323
- })
2324
- })
2325
- }), Fe = (e, t, n, r) => {
2326
- let i = n ? `${t}/${n}` : t;
2327
- return {
2328
- variant: "success",
2329
- autoDismiss: !0,
2330
- autoDismissTimeout: r.autoDismissTimeout ?? 5e3,
2331
- onDismiss: r.onDismiss,
2332
- children: /* @__PURE__ */ z($, {
2333
- title: /* @__PURE__ */ z(J, { id: "6luZQA" }),
2334
- description: /* @__PURE__ */ z(J, {
2335
- id: "6X/9Di",
2336
- values: {
2337
- objectName: e,
2338
- destination: i
2339
- }
2340
- })
2341
- })
2342
- };
2343
- }, Ie = (e, t, n) => ({
2344
- variant: "error",
2345
- autoDismiss: !0,
2346
- autoDismissTimeout: n.autoDismissTimeout ?? 5e3,
2347
- onDismiss: n.onDismiss,
2348
- children: /* @__PURE__ */ z($, {
2349
- title: /* @__PURE__ */ z(J, { id: "SCY5an" }),
2350
- description: /* @__PURE__ */ z(J, {
2351
- id: "y1GYnY",
2352
- values: {
2353
- objectName: e,
2354
- errorMessage: t
2355
- }
2356
- })
2357
- })
2358
- }), Le = (e, t) => ({
2359
- variant: "success",
2360
- autoDismiss: !0,
2361
- autoDismissTimeout: t.autoDismissTimeout ?? 4e3,
2362
- onDismiss: t.onDismiss,
2363
- children: /* @__PURE__ */ z($, {
2364
- title: /* @__PURE__ */ z(J, { id: "U/oahm" }),
2365
- description: /* @__PURE__ */ z(J, {
2366
- id: "g8Yxlg",
2367
- values: { objectName: e }
2368
- })
2369
- })
2370
- }), Re = (e, t) => ({
2371
- variant: "success",
2372
- autoDismiss: !0,
2373
- autoDismissTimeout: t.autoDismissTimeout ?? 5e3,
2374
- onDismiss: t.onDismiss,
2375
- children: /* @__PURE__ */ z($, {
2376
- title: /* @__PURE__ */ z(J, { id: "YRexkb" }),
2377
- description: /* @__PURE__ */ z(J, {
2378
- id: "sXd+qS",
2379
- values: { objectName: e }
2380
- })
2381
- })
2382
- }), ze = (e, t, n) => ({
2383
- variant: "error",
2384
- autoDismiss: !0,
2385
- autoDismissTimeout: n.autoDismissTimeout ?? 5e3,
2386
- onDismiss: n.onDismiss,
2387
- children: /* @__PURE__ */ z($, {
2388
- title: /* @__PURE__ */ z(J, { id: "4t33sh" }),
2389
- description: /* @__PURE__ */ z(J, {
2390
- id: "HQH8HM",
2391
- values: {
2392
- objectName: e,
2393
- errorMessage: t
2394
- }
2395
- })
2396
- })
2397
- }), Be = (e, t) => ({
2398
- variant: "success",
2399
- autoDismiss: !0,
2400
- autoDismissTimeout: t.autoDismissTimeout ?? 5e3,
2401
- onDismiss: t.onDismiss,
2402
- children: /* @__PURE__ */ z($, {
2403
- title: /* @__PURE__ */ z(J, { id: "xqhyRT" }),
2404
- description: /* @__PURE__ */ z(J, {
2405
- id: "4h3Eyf",
2406
- values: { objectName: e }
2407
- })
2408
- })
2409
- }), Ve = (e, t) => ({
2410
- variant: "warning",
2411
- autoDismiss: !0,
2412
- autoDismissTimeout: t.autoDismissTimeout ?? 4e3,
2413
- onDismiss: t.onDismiss,
2414
- children: /* @__PURE__ */ z($, {
2415
- title: /* @__PURE__ */ z(J, { id: "nZbdB+" }),
2416
- description: /* @__PURE__ */ z(J, {
2417
- id: "pU25+T",
2418
- values: { objectName: e }
2419
- })
2420
- })
2421
- }), He = (e, t, n) => ({
2422
- variant: "error",
2423
- autoDismiss: !0,
2424
- autoDismissTimeout: n.autoDismissTimeout ?? 5e3,
2425
- onDismiss: n.onDismiss,
2426
- children: /* @__PURE__ */ z($, {
2427
- title: /* @__PURE__ */ z(J, { id: "VakxP/" }),
2428
- description: /* @__PURE__ */ z(J, {
2429
- id: "tfAKBU",
2430
- values: {
2431
- objectName: e,
2432
- errorMessage: t
2433
- }
2434
- })
2435
- })
2436
- }), Ue = (e, t) => ({
2437
- variant: "success",
2438
- autoDismiss: !0,
2439
- autoDismissTimeout: t.autoDismissTimeout ?? 5e3,
2440
- onDismiss: t.onDismiss,
2441
- children: /* @__PURE__ */ z($, {
2442
- title: /* @__PURE__ */ z(J, { id: "W9PZE0" }),
2443
- description: e === 1 ? /* @__PURE__ */ z(J, {
2444
- id: "8ZOb7O",
2445
- values: { numberDeleted: e }
2446
- }) : /* @__PURE__ */ z(J, {
2447
- id: "X70LXS",
2448
- values: { numberDeleted: e }
2449
- })
2450
- })
2451
- }), We = (e, t) => ({
2452
- variant: "error",
2453
- autoDismiss: !0,
2454
- autoDismissTimeout: t.autoDismissTimeout ?? 5e3,
2455
- onDismiss: t.onDismiss,
2456
- children: /* @__PURE__ */ z($, {
2457
- title: /* @__PURE__ */ z(J, { id: "bYRFNi" }),
2458
- description: /* @__PURE__ */ B("span", { children: [/* @__PURE__ */ z(J, { id: "fCPhho" }), /* @__PURE__ */ z("span", {
2459
- className: "mt-1 block text-xs whitespace-pre-wrap",
2460
- children: e
2461
- })] })
2462
- })
2463
- }), Ge = (e) => {
2464
- let t = new TextEncoder().encode(e), n = Array.from(t, (e) => String.fromCodePoint(e)).join("");
2465
- return btoa(n);
2466
- }, Ke = (e) => {
2467
- if (!e) return "";
2468
- try {
2469
- let t = atob(e), n = Uint8Array.from(t, (e) => e.codePointAt(0));
2470
- return new TextDecoder().decode(n);
2471
- } catch {
2472
- return "";
2473
- }
2474
- };
2475
- function qe(e, t) {
2476
- let n = [], r = [], i = /* @__PURE__ */ new Set();
2477
- for (let a of e) {
2478
- let e = a.name.startsWith(t) ? a.name.slice(t.length) : a.name;
2479
- if (e === "" || e === "/") continue;
2480
- let o = e.indexOf("/");
2481
- if (o > 0) {
2482
- let r = t + e.slice(0, o + 1);
2483
- i.has(r) || (i.add(r), n.push({
2484
- kind: "folder",
2485
- name: r,
2486
- displayName: e.slice(0, o)
2487
- }));
2488
- continue;
2489
- }
2490
- if ((a.content_type === "application/directory" || a.name.endsWith("/")) && (o === -1 || o === e.length - 1)) {
2491
- let t = a.name.endsWith("/") ? a.name : a.name + "/";
2492
- i.has(t) || (i.add(t), n.push({
2493
- kind: "folder",
2494
- name: t,
2495
- displayName: e.replace(/\/$/, "")
2496
- }));
2497
- continue;
2498
- }
2499
- r.push({
2500
- kind: "object",
2501
- name: a.name,
2502
- displayName: e,
2503
- bytes: a.bytes,
2504
- last_modified: a.last_modified,
2505
- content_type: a.content_type
2506
- });
2507
- }
2508
- return [...n, ...r];
2509
- }
2510
- var Je = [
2511
- "name",
2512
- "last_modified",
2513
- "bytes"
2514
- ], Ye = (e) => {
2515
- if (typeof e == "string") return Je.includes(e) ? e : void 0;
2516
- if (typeof e == "number") return Je[e];
2517
- if (Array.isArray(e)) {
2518
- let t = e[0];
2519
- return typeof t == "string" && Je.includes(t) ? t : void 0;
2520
- }
2521
- }, Xe = () => {
2522
- let { i18n: t, _: n } = te(), r = ee(), i = K({ from: F.fullPath }), { provider: o, containerName: s } = q({ from: "/_auth/projects/$projectId/storage/$provider/containers/$containerName/objects/" }), { prefix: c, sortBy: l, sortDirection: u, search: f = "" } = F.useSearch(), p = Ke(c), [m, h] = G(!1), [g, v] = G(!1), [y, b] = G(!1), [x, S] = G([]);
2523
- U(() => {
2524
- S([]);
2525
- }, [p]);
2526
- let [w, T] = G(null), E = () => T(null), D = (e) => T(Ee(e, { onDismiss: E })), O = (e, t) => T(De(e, t, { onDismiss: E })), k = (e) => T(Be(e, { onDismiss: E })), A = (e) => T(Ve(e, { onDismiss: E })), j = (e, t) => T(He(e, t, { onDismiss: E })), M = (e, t) => {
2527
- T(Oe(e, Math.max(0, t - 1), { onDismiss: E }));
2528
- }, N = (e, t) => T(ke(e, t, { onDismiss: E })), P = (e, t) => T(Ae(e, t, { onDismiss: E })), L = (e) => {
2529
- S((t) => t.filter((t) => t !== e)), T(je(e, { onDismiss: E }));
2530
- }, R = (e, t) => T(Me(e, t, { onDismiss: E })), H = (e, t, n) => T(Ne(e, t, n, { onDismiss: E })), W = (e, t) => T(Pe(e, t, { onDismiss: E })), Y = (e, t, n) => {
2531
- S((t) => t.filter((t) => t !== e)), T(Fe(e, t, n, { onDismiss: E }));
2532
- }, ne = (e, t) => T(Ie(e, t, { onDismiss: E })), re = (e) => T(Le(e, { onDismiss: E })), ie = (e) => T(Re(e, { onDismiss: E })), ae = (e, t) => T(ze(e, t, { onDismiss: E })), oe = (e) => {
2533
- S([]), T(Ue(e, { onDismiss: E }));
2534
- }, se = (e, t) => {
2535
- t.length > 0 && S((e) => e.filter((e) => !t.includes(e))), T(We(e, { onDismiss: E }));
2536
- }, ce = {
2537
- options: [
2538
- {
2539
- label: t._({ id: "6YtxFj" }),
2540
- value: "name"
2541
- },
2542
- {
2543
- label: t._({ id: "sjMCOP" }),
2544
- value: "last_modified"
2545
- },
2546
- {
2547
- label: t._({ id: "Cj2Gtd" }),
2548
- value: "bytes"
2549
- }
2550
- ],
2551
- sortBy: l ?? void 0,
2552
- sortDirection: u ?? "asc"
2553
- }, { data: X, isLoading: Z, error: Q } = C.storage.swift.listObjects.useQuery({
2554
- project_id: r,
2555
- container: s,
2556
- format: "json",
2557
- prefix: p || void 0
2558
- }), le = () => {
2559
- i({
2560
- to: "/projects/$projectId/storage/$provider/containers",
2561
- params: {
2562
- projectId: r,
2563
- provider: o
2564
- }
2565
- });
2566
- }, ue = (e) => {
2567
- S([]), i({ search: (t) => ({
2568
- ...t,
2569
- prefix: Ge(e)
2570
- }) });
2571
- }, de = qe(X ?? [], p).filter((e) => e.displayName.toLowerCase().includes(f.toLowerCase().trim())), fe = l ? [...de].sort((e, t) => {
2572
- let n = 0;
2573
- switch (l) {
2574
- case "name":
2575
- n = e.displayName.localeCompare(t.displayName);
2576
- break;
2577
- case "last_modified": {
2578
- let r = e.kind === "object" ? e.last_modified : void 0, i = t.kind === "object" ? t.last_modified : void 0;
2579
- if (!r || !i) break;
2580
- n = new Date(r).getTime() - new Date(i).getTime();
2581
- break;
2582
- }
2583
- case "bytes":
2584
- n = (e.kind === "object" ? e.bytes : 0) - (t.kind === "object" ? t.bytes : 0);
2585
- break;
2586
- }
2587
- return (u ?? "asc") === "desc" ? -n : n;
2588
- }) : de, pe = (e) => {
2589
- let t = typeof e == "string" ? e : "";
2590
- V(() => {
2591
- i({ search: (e) => ({
2592
- ...e,
2593
- search: t || void 0
2594
- }) });
2595
- });
2596
- }, me = (e) => {
2597
- let t = Ye(e.sortBy), n = e.sortDirection || "asc";
2598
- V(() => {
2599
- i({ search: (e) => ({
2600
- ...e,
2601
- sortBy: t,
2602
- sortDirection: t ? n : void 0
2603
- }) });
2604
- });
2605
- };
2606
- if (Z) return /* @__PURE__ */ B(e, {
2607
- className: "fixed inset-0",
2608
- distribution: "center",
2609
- alignment: "center",
2610
- direction: "vertical",
2611
- children: [/* @__PURE__ */ z(a, {
2612
- variant: "primary",
2613
- size: "large",
2614
- className: "mb-2"
2615
- }), /* @__PURE__ */ z(J, { id: "GEgjm+" })]
2616
- });
2617
- if (Q) {
2618
- let t = Q.message;
2619
- return /* @__PURE__ */ z(e, {
2620
- className: "fixed inset-0",
2621
- distribution: "center",
2622
- alignment: "center",
2623
- direction: "vertical",
2624
- children: /* @__PURE__ */ z(J, {
2625
- id: "BP4Fwj",
2626
- values: { errorMessage: t }
2627
- })
2628
- });
2629
- }
2630
- let he = x.length > 0, ge = x.length, _e = x.map((e) => fe.find((t) => t.name === e)?.displayName ?? e);
2631
- return /* @__PURE__ */ B("div", {
2632
- className: "relative",
2633
- children: [
2634
- /* @__PURE__ */ z(xe, {
2635
- containerName: s,
2636
- currentPrefix: p,
2637
- onContainersClick: le,
2638
- onPrefixClick: ue
2639
- }),
2640
- /* @__PURE__ */ z(I, {
2641
- sortSettings: ce,
2642
- searchTerm: f,
2643
- onSort: me,
2644
- onSearch: pe,
2645
- actions: /* @__PURE__ */ B(e, {
2646
- direction: "horizontal",
2647
- gap: "2",
2648
- children: [
2649
- /* @__PURE__ */ z(_, {
2650
- variant: "primary",
2651
- onClick: () => h(!0),
2652
- children: /* @__PURE__ */ z(J, { id: "boJ+Y1" })
2653
- }),
2654
- /* @__PURE__ */ z(_, {
2655
- onClick: () => v(!0),
2656
- children: /* @__PURE__ */ z(J, { id: "MXoA/6" })
2657
- }),
2658
- /* @__PURE__ */ z(_, {
2659
- variant: "primary-danger",
2660
- onClick: () => b(!0),
2661
- disabled: !he,
2662
- children: he ? /* @__PURE__ */ z(J, {
2663
- id: "3AUpb4",
2664
- values: { selectedCount: ge }
2665
- }) : /* @__PURE__ */ z(J, { id: "KZN4Lc" })
2666
- })
2667
- ]
2668
- })
2669
- }),
2670
- /* @__PURE__ */ z(ve, {
2671
- rows: fe,
2672
- searchTerm: f,
2673
- container: s,
2674
- onFolderClick: ue,
2675
- onDeleteFolderSuccess: M,
2676
- onDeleteFolderError: N,
2677
- onDownloadError: P,
2678
- onDeleteObjectSuccess: L,
2679
- onDeleteObjectError: R,
2680
- onCopyObjectSuccess: H,
2681
- onCopyObjectError: W,
2682
- onMoveObjectSuccess: Y,
2683
- onMoveObjectError: ne,
2684
- onTempUrlCopySuccess: re,
2685
- onEditMetadataSuccess: ie,
2686
- onEditMetadataError: ae,
2687
- selectedObjects: x,
2688
- setSelectedObjects: S
2689
- }),
2690
- /* @__PURE__ */ z(Te, {
2691
- isOpen: y,
2692
- objectNames: _e,
2693
- objectKeys: x,
2694
- container: s,
2695
- onClose: () => b(!1),
2696
- onSuccess: oe,
2697
- onError: se
2698
- }),
2699
- /* @__PURE__ */ z(Se, {
2700
- isOpen: m,
2701
- currentPrefix: p,
2702
- onClose: () => h(!1),
2703
- onSuccess: D,
2704
- onError: O
2705
- }),
2706
- /* @__PURE__ */ z(Ce, {
2707
- projectId: r,
2708
- isOpen: g,
2709
- currentPrefix: p,
2710
- container: s,
2711
- onClose: () => v(!1),
2712
- onSuccess: k,
2713
- onCancelled: A,
2714
- onError: j
2715
- }),
2716
- w && /* @__PURE__ */ z(d, {
2717
- ...w,
2718
- className: "border-theme-light fixed top-5 right-5 z-50 rounded-lg border shadow-lg"
2719
- })
2720
- ]
2721
- });
2722
- };
2723
- //#endregion
2724
- //#region src/client/routes/_auth/projects/$projectId/storage/-components/Ceph/Objects/DeleteObjectModal.tsx
2725
- function Ze({ bucketName: t, objectKey: n, objectSize: r, lastModified: i, isOpen: a, onClose: o, onSuccess: s, onError: c }) {
2726
- let { i18n: l, _: u } = te(), d = ee(), [f, p] = G(""), m = C.useUtils(), h = C.storage.ceph.objects.delete.useMutation({
2727
- onSuccess: () => {
2728
- m.storage.ceph.objects.list.invalidate(), s(n), v();
2729
- },
2730
- onError: (e) => {
2731
- c(n, e.message);
2732
- }
2733
- }), v = () => {
2734
- p(""), h.reset(), o();
2735
- }, y = () => {
2736
- d && h.mutate({
2737
- project_id: d,
2738
- containerName: t,
2739
- objectKey: n
2740
- });
2741
- }, x = n.endsWith("/"), S = n.split("/").filter(Boolean).pop() || n, w = f === "DELETE";
2742
- return /* @__PURE__ */ B(g, {
2743
- open: a,
2744
- onCancel: v,
2745
- title: x ? /* @__PURE__ */ z(J, { id: "97QUV6" }) : /* @__PURE__ */ z(J, { id: "JT+lLV" }),
2746
- size: "large",
2747
- children: [/* @__PURE__ */ B(e, {
2748
- direction: "vertical",
2749
- gap: "4",
2750
- children: [
2751
- /* @__PURE__ */ z("p", { children: x ? /* @__PURE__ */ z(J, { id: "gJKQwG" }) : /* @__PURE__ */ z(J, { id: "uFQALo" }) }),
2752
- /* @__PURE__ */ z("div", {
2753
- className: "bg-theme-background-lvl-2 rounded p-4",
2754
- children: /* @__PURE__ */ B(e, {
2755
- direction: "vertical",
2756
- gap: "2",
2757
- children: [
2758
- /* @__PURE__ */ B("div", { children: [/* @__PURE__ */ z("span", {
2759
- className: "text-juno-grey-light-1 text-sm",
2760
- children: /* @__PURE__ */ z(J, { id: "M8er/5" })
2761
- }), /* @__PURE__ */ z("div", {
2762
- className: "mt-1 font-mono text-sm",
2763
- children: S
2764
- })] }),
2765
- !x && r !== void 0 && /* @__PURE__ */ B("div", { children: [/* @__PURE__ */ z("span", {
2766
- className: "text-juno-grey-light-1 text-sm",
2767
- children: /* @__PURE__ */ z(J, { id: "QdGvPV" })
2768
- }), /* @__PURE__ */ z("div", {
2769
- className: "mt-1 font-mono text-sm",
2770
- children: L(r)
2771
- })] }),
2772
- !x && i && /* @__PURE__ */ B("div", { children: [/* @__PURE__ */ z("span", {
2773
- className: "text-juno-grey-light-1 text-sm",
2774
- children: /* @__PURE__ */ z(J, { id: "8BjKi0" })
2775
- }), /* @__PURE__ */ z("div", {
2776
- className: "mt-1 font-mono text-sm",
2777
- children: new Date(i).toLocaleString()
2778
- })] }),
2779
- /* @__PURE__ */ B("div", { children: [/* @__PURE__ */ z("span", {
2780
- className: "text-juno-grey-light-1 text-sm",
2781
- children: /* @__PURE__ */ z(J, { id: "t/cZdQ" })
2782
- }), /* @__PURE__ */ z("div", {
2783
- className: "mt-1 font-mono text-sm break-all",
2784
- children: n
2785
- })] })
2786
- ]
2787
- })
2788
- }),
2789
- /* @__PURE__ */ B("div", { children: [/* @__PURE__ */ z("p", {
2790
- className: "text-juno-red mb-2 text-sm",
2791
- children: /* @__PURE__ */ z(J, { id: "2xOCJW" })
2792
- }), /* @__PURE__ */ z(b, {
2793
- label: l._({ id: "sCPiLi" }),
2794
- value: f,
2795
- onChange: (e) => p(e.target.value),
2796
- placeholder: "DELETE",
2797
- autoFocus: !0
2798
- })] }),
2799
- h.error && /* @__PURE__ */ B("p", {
2800
- className: "text-juno-red text-sm",
2801
- children: [
2802
- /* @__PURE__ */ z(J, { id: "4BITzH" }),
2803
- " ",
2804
- h.error.message
2805
- ]
2806
- })
2807
- ]
2808
- }), /* @__PURE__ */ B("div", {
2809
- className: "mt-6 flex justify-end gap-2",
2810
- children: [/* @__PURE__ */ z(_, {
2811
- variant: "subdued",
2812
- onClick: v,
2813
- disabled: h.isPending,
2814
- children: /* @__PURE__ */ z(J, { id: "dEgA5A" })
2815
- }), /* @__PURE__ */ z(_, {
2816
- variant: "primary-danger",
2817
- onClick: y,
2818
- disabled: !w || h.isPending,
2819
- children: h.isPending ? /* @__PURE__ */ z(J, { id: "EF2EU9" }) : /* @__PURE__ */ z(J, { id: "cnGeoo" })
2820
- })]
2821
- })]
2822
- });
2823
- }
2824
- //#endregion
2825
- //#region src/client/routes/_auth/projects/$projectId/storage/-components/Ceph/Objects/utils/objectValidation.ts
2826
- var Qe = (e, t, n = "") => {
2827
- let r = e.trim();
2828
- if (!r) return {
2829
- type: "required",
2830
- message: { id: "Fzrzfe" }
2831
- };
2832
- if (r.includes("/")) return {
2833
- type: "slashes",
2834
- message: { id: "Vl4XTj" }
2835
- };
2836
- if (r !== e) return {
2837
- type: "whitespace",
2838
- message: { id: "gFKJBP" }
2839
- };
2840
- if (r.length > 255) return {
2841
- type: "too-long",
2842
- message: { id: "4bLttB" }
2843
- };
2844
- let i = `${n}${r}/`;
2845
- return t.includes(i) ? {
2846
- type: "duplicate",
2847
- message: { id: "/Qox3b" }
2848
- } : null;
2849
- }, $e = (e) => {
2850
- let t = e.trim();
2851
- return t ? t.includes("/") ? {
2852
- type: "slashes",
2853
- message: { id: "NZJhro" }
2854
- } : t === e ? null : {
2855
- type: "whitespace",
2856
- message: { id: "Erlvqg" }
2857
- } : {
2858
- type: "required",
2859
- message: { id: "MtzSbv" }
2860
- };
2861
- }, et = (e) => e.trim() ? /^[a-zA-Z0-9_-]+$/.test(e) ? /[a-zA-Z0-9]/.test(e) ? null : {
2862
- type: "invalid-chars",
2863
- message: { id: "dTNzBI" }
2864
- } : {
2865
- type: "invalid-chars",
2866
- message: { id: "BGsuZN" }
2867
- } : {
2868
- type: "required",
2869
- message: { id: "QV1ZPO" }
2870
- }, tt = (e, t) => {
2871
- let { i18n: n, _: r } = te(), [i, a] = G(""), [o, s] = G(""), [c, l] = G(null), [u, d] = G(!1), f = H((e) => {
2872
- a(e), d(!1), s(""), l(null);
2873
- }, []);
2874
- return {
2875
- currentPrefix: i,
2876
- newFolderName: o,
2877
- newFolderError: c,
2878
- showNewFolderInput: u,
2879
- navigateToPrefix: f,
2880
- navigateUp: H(() => {
2881
- if (!i) return;
2882
- let e = i.replace(/\/$/, "").split("/");
2883
- e.pop(), f(e.length > 0 ? e.join("/") + "/" : "");
2884
- }, [i, f]),
2885
- startCreateFolder: H(() => {
2886
- d(!0), s(""), l(null);
2887
- }, []),
2888
- cancelCreateFolder: H(() => {
2889
- d(!1), s(""), l(null);
2890
- }, []),
2891
- setNewFolderName: H((e) => {
2892
- s(e), c && l(null);
2893
- }, [c]),
2894
- createFolder: H(() => {
2895
- let r = Qe(o, e.map((e) => e.name), i);
2896
- if (r) return l(n._(r.message)), null;
2897
- let c = `${i}${o.trim()}/`;
2898
- return t?.(c), s(""), d(!1), l(null), a(c), c;
2899
- }, [
2900
- o,
2901
- e,
2902
- i,
2903
- t,
2904
- r
2905
- ]),
2906
- reset: H(() => {
2907
- a(""), s(""), l(null), d(!1);
2908
- }, [])
2909
- };
2910
- }, nt = 50, rt = (e) => {
2911
- let [t, n] = G(""), [r, i] = G(""), a = W(null);
2912
- U(() => () => {
2913
- a.current && clearTimeout(a.current);
2914
- }, []);
2915
- let o = H((e) => {
2916
- let t = e.target.value;
2917
- n(t), a.current && clearTimeout(a.current), a.current = setTimeout(() => i(t), 300);
2918
- }, []), s = H(() => {
2919
- n(""), i(""), a.current && clearTimeout(a.current);
2920
- }, []), c = r.trim().length > 0 ? (e ?? []).filter((e) => e.name.toLowerCase().includes(r.toLowerCase())) : [], l = c.slice(0, nt);
2921
- return {
2922
- searchTerm: t,
2923
- debouncedSearch: r,
2924
- visibleBuckets: l,
2925
- hiddenCount: c.length - l.length,
2926
- handleSearchChange: o,
2927
- reset: s
2928
- };
2929
- }, it = () => {
2930
- let [e, t] = G({});
2931
- return {
2932
- localFolders: e,
2933
- addFolder: H((e, n) => {
2934
- t((t) => ({
2935
- ...t,
2936
- [e]: [...t[e] ?? [], n]
2937
- }));
2938
- }, []),
2939
- clearForBucket: H((e) => {
2940
- t((t) => {
2941
- let n = { ...t };
2942
- return delete n[e], n;
2943
- });
2944
- }, []),
2945
- reset: H(() => {
2946
- t({});
2947
- }, [])
2948
- };
2949
- }, at = ({ initialBucket: e, allBuckets: t, existingRows: n }) => {
2950
- let r = it(), i = tt(n, (e) => {
2951
- r.addFolder(o, e);
2952
- }), a = rt(t), [o, s] = G(e), c = H((e) => {
2953
- s(e), i.reset(), r.clearForBucket(e);
2954
- }, [i, r]), l = H(() => {
2955
- s(e), i.reset(), a.reset(), r.reset();
2956
- }, [
2957
- e,
2958
- i,
2959
- a,
2960
- r
2961
- ]);
2962
- return {
2963
- targetBucket: o,
2964
- setTargetBucket: c,
2965
- ...i,
2966
- ...a,
2967
- ...r,
2968
- resetAll: l
2969
- };
2970
- }, ot = 50, st = ({ isOpen: t, bucketName: n, objectKey: r, objectSize: i, onClose: o, onSuccess: s, onError: l }) => {
2971
- let { i18n: u, _: d } = te(), f = ee(), p = C.useUtils(), m = W(""), [h, x] = G(!0), [S, w] = G(!1), [E, D] = G(!1), O = W(null), { data: A, isLoading: M } = C.storage.ceph.containers.list.useQuery({
2972
- project_id: f ?? "",
2973
- includeMetadata: !1
2974
- }, { enabled: t && !!f }), P = at({
2975
- initialBucket: n,
2976
- allBuckets: A ?? [],
2977
- existingRows: []
2978
- }), { data: F, isLoading: I } = C.storage.ceph.objects.list.useQuery({
2979
- project_id: f ?? "",
2980
- containerName: P.targetBucket,
2981
- prefix: P.currentPrefix || void 0,
2982
- delimiter: "/",
2983
- maxKeys: 1e3
2984
- }, { enabled: t && !!P.targetBucket && !!f });
2985
- U(() => {
2986
- t && P.resetAll();
2987
- }, [t]);
2988
- let L = (() => {
2989
- if (!F) return [];
2990
- let e = F.folders.map((e) => ({
2991
- kind: "folder",
2992
- name: e.prefix,
2993
- displayName: P.currentPrefix ? e.prefix.replace(P.currentPrefix, "").replace(/\/$/, "") : e.prefix.replace(/\/$/, "")
2994
- })), t = F.objects.filter((e) => {
2995
- let t = P.currentPrefix ? e.key.replace(P.currentPrefix, "") : e.key;
2996
- return t !== "" && t !== "/";
2997
- }).map((e) => ({
2998
- kind: "object",
2999
- name: e.key,
3000
- displayName: P.currentPrefix ? e.key.replace(P.currentPrefix, "") : e.key
3001
- }));
3002
- return [...e, ...t];
3003
- })(), R = (P.localFolders[P.targetBucket] ?? []).filter((e) => {
3004
- let t = e.startsWith(P.currentPrefix) ? e.slice(P.currentPrefix.length) : null;
3005
- return t ? t.split("/").filter(Boolean).length === 1 : !1;
3006
- }).filter((e) => !L.some((t) => t.name === e)).map((e) => ({
3007
- kind: "folder",
3008
- name: e,
3009
- displayName: e.slice(P.currentPrefix.length).replace(/\/$/, "")
3010
- })), V = [
3011
- ...L.filter((e) => e.kind === "folder"),
3012
- ...R,
3013
- ...L.filter((e) => e.kind === "object")
3014
- ], K = C.storage.ceph.objects.copy.useMutation({
3015
- onSuccess: () => {
3016
- p.storage.ceph.objects.list.invalidate();
3017
- let e = `${P.currentPrefix}${q}`;
3018
- s?.(m.current, P.targetBucket, e, S), re();
3019
- },
3020
- onError: (e) => {
3021
- l?.(m.current, e.message);
3022
- }
3023
- }), q = r.split("/").filter(Boolean).pop() ?? r, Y = H(async () => {
3024
- if (!f || !P.targetBucket) return;
3025
- let e = `${P.currentPrefix}${q}`;
3026
- if (P.targetBucket === n && e === r) {
3027
- w(!1);
3028
- return;
3029
- }
3030
- D(!0);
3031
- try {
3032
- await p.storage.ceph.objects.getDetails.fetch({
3033
- project_id: f,
3034
- containerName: P.targetBucket,
3035
- objectKey: e
3036
- }), w(!0);
3037
- } catch {
3038
- w(!1);
3039
- } finally {
3040
- D(!1);
3041
- }
3042
- }, [
3043
- f,
3044
- P.targetBucket,
3045
- P.currentPrefix,
3046
- q,
3047
- n,
3048
- r,
3049
- p
3050
- ]);
3051
- U(() => {
3052
- t && Y();
3053
- }, [t, Y]);
3054
- let re = () => {
3055
- K.reset(), o();
3056
- }, ie = (e) => {
3057
- let t = Array.isArray(e) ? e[0] : typeof e == "number" ? String(e) : e;
3058
- t && P.setTargetBucket(t);
3059
- }, ae = (e) => {
3060
- e.key === "Enter" && P.createFolder(), e.key === "Escape" && P.cancelCreateFolder();
3061
- }, oe = () => {
3062
- if (!f) return;
3063
- m.current = r;
3064
- let e = `${P.currentPrefix}${q}`;
3065
- K.mutate({
3066
- project_id: f,
3067
- sourceBucket: n,
3068
- sourceKey: r,
3069
- destinationBucket: P.targetBucket,
3070
- destinationKey: e,
3071
- copyMetadata: h
3072
- });
3073
- }, se = V.filter((e) => e.kind === "folder"), ce = V.filter((e) => e.kind === "object"), X = [...se, ...ce], Z = ne({
3074
- count: X.length,
3075
- getScrollElement: () => O.current,
3076
- estimateSize: () => 32,
3077
- overscan: 5
3078
- });
3079
- if (!t) return null;
3080
- let Q = K.isPending, le = I, ue = `${P.targetBucket}/${P.currentPrefix}${q}`, de = r.endsWith(q) ? r.slice(0, r.length - q.length) : "", fe = P.targetBucket === n && P.currentPrefix === de;
3081
- return /* @__PURE__ */ z(g, {
3082
- title: /* @__PURE__ */ B("span", {
3083
- className: "flex max-w-[500px] items-center gap-1",
3084
- children: [/* @__PURE__ */ z("span", {
3085
- className: "shrink-0",
3086
- children: /* @__PURE__ */ z(J, { id: "V7fN5X" })
3087
- }), /* @__PURE__ */ z("span", {
3088
- className: "truncate font-mono",
3089
- title: q,
3090
- children: q
3091
- })]
3092
- }),
3093
- open: t,
3094
- onCancel: re,
3095
- confirmButtonLabel: Q ? u._({ id: "OvEjsP" }) : u._({ id: "he3ygx" }),
3096
- onConfirm: oe,
3097
- cancelButtonLabel: u._({ id: "dEgA5A" }),
3098
- size: "large",
3099
- disableConfirmButton: Q || M || fe,
3100
- children: Q ? /* @__PURE__ */ B(e, {
3101
- direction: "horizontal",
3102
- alignment: "center",
3103
- gap: "2",
3104
- className: "py-8",
3105
- children: [/* @__PURE__ */ z(a, { size: "small" }), /* @__PURE__ */ z(J, { id: "QEtDlS" })]
3106
- }) : /* @__PURE__ */ B(e, {
3107
- direction: "vertical",
3108
- gap: "4",
3109
- children: [
3110
- /* @__PURE__ */ B("div", {
3111
- className: "bg-theme-background-lvl-2 rounded p-3",
3112
- children: [
3113
- /* @__PURE__ */ z("div", {
3114
- className: "text-theme-light text-sm",
3115
- children: /* @__PURE__ */ z(J, { id: "dpGL2Q" })
3116
- }),
3117
- /* @__PURE__ */ z("div", {
3118
- className: "mt-1 font-mono text-sm",
3119
- children: `${n}/${r}`
3120
- }),
3121
- i !== void 0 && /* @__PURE__ */ B("div", {
3122
- className: "text-theme-light mt-1 text-xs",
3123
- children: [(i / 1024).toFixed(2), " KB"]
3124
- })
3125
- ]
3126
- }),
3127
- /* @__PURE__ */ z(y, {
3128
- label: u._({ id: "6EcekU" }),
3129
- value: P.targetBucket,
3130
- onChange: ie,
3131
- onInputChange: P.handleSearchChange,
3132
- placeholder: u._({ id: "0XLPG9" }),
3133
- helptext: (() => {
3134
- if (M) return u._({ id: "WV/4x1" });
3135
- if (P.searchTerm.trim().length === 0) return u._({ id: "WzsMfv" });
3136
- if (P.hiddenCount > 0) {
3137
- let e = P.visibleBuckets.length + P.hiddenCount;
3138
- return u._({
3139
- id: "vIxhHW",
3140
- values: {
3141
- MAX_COMBO_OPTIONS: ot,
3142
- totalBuckets: e
3143
- }
3144
- });
3145
- }
3146
- })(),
3147
- disabled: M || Q,
3148
- required: !0,
3149
- children: P.visibleBuckets.map((e) => /* @__PURE__ */ z(v, {
3150
- value: e.name,
3151
- children: e.name
3152
- }, e.name))
3153
- }),
3154
- /* @__PURE__ */ B("div", { children: [
3155
- /* @__PURE__ */ B("div", {
3156
- className: "mb-1 flex items-center justify-between",
3157
- children: [/* @__PURE__ */ z("span", {
3158
- className: "text-sm font-medium",
3159
- children: /* @__PURE__ */ z(J, { id: "Afh/Lb" })
3160
- }), /* @__PURE__ */ z(_, {
3161
- size: "small",
3162
- variant: "subdued",
3163
- icon: "addCircle",
3164
- onClick: P.startCreateFolder,
3165
- disabled: Q,
3166
- title: u._({ id: "mxPfpY" }),
3167
- children: /* @__PURE__ */ z(J, { id: "tX5yOZ" })
3168
- })]
3169
- }),
3170
- /* @__PURE__ */ B("div", {
3171
- className: "border-theme-background-lvl-2 bg-theme-background-lvl-1 flex items-center gap-2 border-b px-3 py-2 text-sm",
3172
- children: [P.currentPrefix ? /* @__PURE__ */ B("button", {
3173
- type: "button",
3174
- onClick: P.navigateUp,
3175
- className: "text-theme-link hover:text-theme-default flex items-center gap-1",
3176
- children: [/* @__PURE__ */ z(N, { size: 16 }), /* @__PURE__ */ z(J, { id: "iH8pgl" })]
3177
- }) : /* @__PURE__ */ z("span", {
3178
- className: "text-theme-light",
3179
- children: /* @__PURE__ */ z(J, { id: "eyRsaH" })
3180
- }), P.currentPrefix && /* @__PURE__ */ B("span", {
3181
- className: "text-theme-light truncate font-mono text-xs",
3182
- children: ["/ ", P.currentPrefix]
3183
- })]
3184
- }),
3185
- /* @__PURE__ */ B("div", {
3186
- ref: O,
3187
- className: "border-theme-background-lvl-2 max-h-56 overflow-y-auto rounded-b border",
3188
- children: [le ? /* @__PURE__ */ B(e, {
3189
- direction: "horizontal",
3190
- alignment: "center",
3191
- gap: "2",
3192
- className: "py-6",
3193
- children: [/* @__PURE__ */ z(a, { size: "small" }), /* @__PURE__ */ z(J, { id: "Z3FXyt" })]
3194
- }) : X.length === 0 && !P.showNewFolderInput ? /* @__PURE__ */ z("div", {
3195
- className: "text-theme-light px-4 py-6 text-center text-sm",
3196
- children: /* @__PURE__ */ z(J, { id: "vcQSZh" })
3197
- }) : /* @__PURE__ */ z("div", {
3198
- style: {
3199
- height: `${Z.getTotalSize()}px`,
3200
- position: "relative"
3201
- },
3202
- children: Z.getVirtualItems().map((e) => {
3203
- let t = X[e.index], n = t.kind === "folder";
3204
- return /* @__PURE__ */ z("div", {
3205
- "data-index": e.index,
3206
- ref: Z.measureElement,
3207
- style: {
3208
- position: "absolute",
3209
- top: 0,
3210
- left: 0,
3211
- width: "100%",
3212
- transform: `translateY(${e.start}px)`
3213
- },
3214
- children: n ? /* @__PURE__ */ B("button", {
3215
- type: "button",
3216
- className: "hover:bg-theme-background-lvl-2 focus-visible:outline-theme-focus flex w-full items-center gap-2 px-4 py-2 text-left text-sm focus-visible:outline focus-visible:outline-2",
3217
- onClick: () => P.navigateToPrefix(t.name),
3218
- children: [/* @__PURE__ */ z(k, {
3219
- size: 16,
3220
- className: "text-theme-light shrink-0"
3221
- }), /* @__PURE__ */ z("span", {
3222
- className: "truncate",
3223
- children: t.displayName
3224
- })]
3225
- }) : /* @__PURE__ */ B("span", {
3226
- className: "text-theme-light flex items-center gap-2 px-4 py-2 text-sm",
3227
- children: [/* @__PURE__ */ z(j, {
3228
- size: 16,
3229
- className: "shrink-0"
3230
- }), /* @__PURE__ */ z("span", {
3231
- className: "truncate",
3232
- children: t.displayName
3233
- })]
3234
- })
3235
- }, t.name);
3236
- })
3237
- }), P.showNewFolderInput && /* @__PURE__ */ z("div", {
3238
- className: "border-theme-background-lvl-2 border-t px-4 py-3",
3239
- children: /* @__PURE__ */ z(e, {
3240
- direction: "vertical",
3241
- gap: "2",
3242
- children: /* @__PURE__ */ B(e, {
3243
- direction: "horizontal",
3244
- gap: "2",
3245
- alignment: "center",
3246
- children: [
3247
- /* @__PURE__ */ z(T, {
3248
- size: 16,
3249
- className: "text-theme-light shrink-0"
3250
- }),
3251
- /* @__PURE__ */ z(b, {
3252
- value: P.newFolderName,
3253
- onChange: (e) => P.setNewFolderName(e.target.value),
3254
- onKeyDown: ae,
3255
- placeholder: u._({ id: "KzUd7m" }),
3256
- invalid: !!P.newFolderError,
3257
- errortext: P.newFolderError ?? void 0,
3258
- autoFocus: !0,
3259
- className: "flex-1"
3260
- }),
3261
- /* @__PURE__ */ z(_, {
3262
- size: "small",
3263
- variant: "primary",
3264
- onClick: P.createFolder,
3265
- disabled: !P.newFolderName.trim(),
3266
- children: /* @__PURE__ */ z(J, { id: "hYgDIe" })
3267
- }),
3268
- /* @__PURE__ */ z(_, {
3269
- size: "small",
3270
- variant: "subdued",
3271
- onClick: P.cancelCreateFolder,
3272
- children: /* @__PURE__ */ z(J, { id: "dEgA5A" })
3273
- })
3274
- ]
3275
- })
3276
- })
3277
- })]
3278
- })
3279
- ] }),
3280
- /* @__PURE__ */ z(b, {
3281
- label: u._({ id: "Vh/Uj5" }),
3282
- value: ue,
3283
- readOnly: !0,
3284
- className: "font-mono",
3285
- helptext: u._({ id: "Z/eWPC" })
3286
- }),
3287
- E ? /* @__PURE__ */ z(c, {
3288
- variant: "info",
3289
- children: /* @__PURE__ */ B(e, {
3290
- direction: "horizontal",
3291
- alignment: "center",
3292
- gap: "2",
3293
- children: [/* @__PURE__ */ z(a, { size: "small" }), /* @__PURE__ */ z(J, { id: "WIJz7N" })]
3294
- })
3295
- }) : S ? /* @__PURE__ */ z(c, {
3296
- variant: "warning",
3297
- children: /* @__PURE__ */ z(J, { id: "G3pRO8" })
3298
- }) : null,
3299
- /* @__PURE__ */ B("label", {
3300
- className: "flex cursor-pointer items-center gap-2",
3301
- children: [/* @__PURE__ */ z("input", {
3302
- type: "checkbox",
3303
- checked: h,
3304
- onChange: (e) => x(e.target.checked),
3305
- className: "h-4 w-4"
3306
- }), /* @__PURE__ */ z("span", {
3307
- className: "text-sm",
3308
- children: /* @__PURE__ */ z(J, { id: "mqljvE" })
3309
- })]
3310
- }),
3311
- K.isError && (() => {
3312
- let e = K.error.message;
3313
- return /* @__PURE__ */ z(c, {
3314
- variant: "danger",
3315
- children: /* @__PURE__ */ z(J, {
3316
- id: "IOkHLC",
3317
- values: { errorMessage: e }
3318
- })
3319
- });
3320
- })()
3321
- ]
3322
- })
3323
- });
3324
- }, ct = 50, lt = ({ isOpen: t, bucketName: n, objectKey: r, objectSize: i, onClose: o, onSuccess: s, onError: l }) => {
3325
- let { i18n: u, _: d } = te(), f = ee(), p = C.useUtils(), m = W(""), h = W(""), x = W(""), [S, w] = G(""), [E, D] = G(null), A = W(null), { data: M, isLoading: P } = C.storage.ceph.containers.list.useQuery({
3326
- project_id: f ?? "",
3327
- includeMetadata: !1
3328
- }, { enabled: t && !!f }), F = at({
3329
- initialBucket: n,
3330
- allBuckets: M ?? [],
3331
- existingRows: []
3332
- }), { data: I, isLoading: L } = C.storage.ceph.objects.list.useQuery({
3333
- project_id: f ?? "",
3334
- containerName: F.targetBucket,
3335
- prefix: F.currentPrefix || void 0,
3336
- delimiter: "/",
3337
- maxKeys: 1e3
3338
- }, { enabled: t && !!F.targetBucket && !!f });
3339
- U(() => {
3340
- t && r && (w(r.split("/").filter(Boolean).pop() ?? r), F.resetAll());
3341
- }, [t, r]), U(() => {
3342
- t || (w(""), D(null));
3343
- }, [t]);
3344
- let R = (() => {
3345
- if (!I) return [];
3346
- let e = I.folders.map((e) => ({
3347
- kind: "folder",
3348
- name: e.prefix,
3349
- displayName: F.currentPrefix ? e.prefix.replace(F.currentPrefix, "").replace(/\/$/, "") : e.prefix.replace(/\/$/, "")
3350
- })), t = I.objects.filter((e) => {
3351
- let t = F.currentPrefix ? e.key.replace(F.currentPrefix, "") : e.key;
3352
- return t !== "" && t !== "/";
3353
- }).map((e) => ({
3354
- kind: "object",
3355
- name: e.key,
3356
- displayName: F.currentPrefix ? e.key.replace(F.currentPrefix, "") : e.key
3357
- }));
3358
- return [...e, ...t];
3359
- })(), V = (F.localFolders[F.targetBucket] ?? []).filter((e) => {
3360
- let t = e.startsWith(F.currentPrefix) ? e.slice(F.currentPrefix.length) : null;
3361
- return t ? t.split("/").filter(Boolean).length === 1 : !1;
3362
- }).filter((e) => !R.some((t) => t.name === e)).map((e) => ({
3363
- kind: "folder",
3364
- name: e,
3365
- displayName: e.slice(F.currentPrefix.length).replace(/\/$/, "")
3366
- })), H = [
3367
- ...R.filter((e) => e.kind === "folder"),
3368
- ...V,
3369
- ...R.filter((e) => e.kind === "object")
3370
- ], K = C.storage.ceph.objects.delete.useMutation({
3371
- onSuccess: () => {
3372
- p.storage.ceph.objects.list.invalidate(), s?.(m.current, x.current, h.current);
3373
- },
3374
- onError: (e) => {
3375
- l?.(m.current, e.message);
3376
- },
3377
- onSettled: () => {
3378
- Y();
3379
- }
3380
- }), q = C.storage.ceph.objects.copy.useMutation({
3381
- onSuccess: () => {
3382
- K.mutate({
3383
- project_id: f ?? "",
3384
- containerName: n,
3385
- objectKey: r
3386
- });
3387
- },
3388
- onError: (e) => {
3389
- l?.(m.current, e.message), Y();
3390
- }
3391
- }), Y = () => {
3392
- q.reset(), K.reset(), o();
3393
- }, re = (e) => {
3394
- let t = Array.isArray(e) ? e[0] : typeof e == "number" ? String(e) : e;
3395
- t && F.setTargetBucket(t);
3396
- }, ie = (e) => {
3397
- e.key === "Enter" && F.createFolder(), e.key === "Escape" && F.cancelCreateFolder();
3398
- }, ae = () => {
3399
- if (!f) return;
3400
- let e = $e(S);
3401
- if (e) {
3402
- D(u._(e.message));
3403
- return;
3404
- }
3405
- let t = S.trim(), i = `${F.currentPrefix}${t}`;
3406
- m.current = r, h.current = i, x.current = F.targetBucket, q.mutate({
3407
- project_id: f,
3408
- sourceBucket: n,
3409
- sourceKey: r,
3410
- destinationBucket: F.targetBucket,
3411
- destinationKey: i,
3412
- copyMetadata: !0
3413
- });
3414
- }, oe = H.filter((e) => e.kind === "folder"), se = H.filter((e) => e.kind === "object"), ce = [...oe, ...se], X = ne({
3415
- count: ce.length,
3416
- getScrollElement: () => A.current,
3417
- estimateSize: () => 32,
3418
- overscan: 5
3419
- });
3420
- if (!t) return null;
3421
- let Z = r.split("/").filter(Boolean).pop() ?? r, Q = q.isPending || K.isPending, le = L, ue = `${F.targetBucket}/${F.currentPrefix}${S.trim() || Z}`, de = r.endsWith(Z) ? r.slice(0, r.length - Z.length) : "", fe = F.targetBucket === n && F.currentPrefix === de && S.trim() === Z;
3422
- return /* @__PURE__ */ z(g, {
3423
- title: /* @__PURE__ */ B("span", {
3424
- className: "flex max-w-[500px] items-center gap-1",
3425
- children: [/* @__PURE__ */ z("span", {
3426
- className: "shrink-0",
3427
- children: /* @__PURE__ */ z(J, { id: "J6EOll" })
3428
- }), /* @__PURE__ */ z("span", {
3429
- className: "truncate font-mono",
3430
- title: Z,
3431
- children: Z
3432
- })]
3433
- }),
3434
- open: t,
3435
- onCancel: Y,
3436
- confirmButtonLabel: Q ? u._({ id: "K8Qnlj" }) : u._({ id: "QWdKwH" }),
3437
- onConfirm: ae,
3438
- cancelButtonLabel: u._({ id: "dEgA5A" }),
3439
- size: "large",
3440
- disableConfirmButton: Q || P || fe,
3441
- children: Q ? /* @__PURE__ */ B(e, {
3442
- direction: "horizontal",
3443
- alignment: "center",
3444
- gap: "2",
3445
- className: "py-8",
3446
- children: [/* @__PURE__ */ z(a, { size: "small" }), /* @__PURE__ */ z(J, { id: "1H2g6v" })]
3447
- }) : /* @__PURE__ */ B(e, {
3448
- direction: "vertical",
3449
- gap: "4",
3450
- children: [
3451
- /* @__PURE__ */ z(b, {
3452
- label: u._({ id: "f+Uq1E" }),
3453
- value: S,
3454
- onChange: (e) => {
3455
- w(e.target.value), E && D(null);
3456
- },
3457
- invalid: !!E,
3458
- errortext: E ?? void 0,
3459
- helptext: u._({ id: "rAtQcX" }),
3460
- required: !0
3461
- }),
3462
- /* @__PURE__ */ z(c, {
3463
- variant: "warning",
3464
- children: /* @__PURE__ */ B("div", {
3465
- className: "flex items-start gap-2",
3466
- children: [/* @__PURE__ */ z(O, {
3467
- size: 20,
3468
- className: "shrink-0"
3469
- }), /* @__PURE__ */ B("div", { children: [
3470
- /* @__PURE__ */ z("strong", { children: /* @__PURE__ */ z(J, { id: "5TzHG8" }) }),
3471
- " ",
3472
- /* @__PURE__ */ z(J, { id: "Z8poQH" })
3473
- ] })]
3474
- })
3475
- }),
3476
- /* @__PURE__ */ B("div", {
3477
- className: "bg-theme-background-lvl-2 rounded p-3",
3478
- children: [
3479
- /* @__PURE__ */ z("div", {
3480
- className: "text-theme-light text-sm",
3481
- children: /* @__PURE__ */ z(J, { id: "dpGL2Q" })
3482
- }),
3483
- /* @__PURE__ */ z("div", {
3484
- className: "mt-1 font-mono text-sm",
3485
- children: `${n}/${r}`
3486
- }),
3487
- i !== void 0 && /* @__PURE__ */ B("div", {
3488
- className: "text-theme-light mt-1 text-xs",
3489
- children: [(i / 1024).toFixed(2), " KB"]
3490
- })
3491
- ]
3492
- }),
3493
- /* @__PURE__ */ z(y, {
3494
- label: u._({ id: "6EcekU" }),
3495
- value: F.targetBucket,
3496
- onChange: re,
3497
- onInputChange: F.handleSearchChange,
3498
- placeholder: u._({ id: "0XLPG9" }),
3499
- helptext: (() => {
3500
- if (P) return u._({ id: "WV/4x1" });
3501
- if (F.searchTerm.trim().length === 0) return u._({ id: "WzsMfv" });
3502
- if (F.hiddenCount > 0) {
3503
- let e = F.visibleBuckets.length + F.hiddenCount;
3504
- return u._({
3505
- id: "vIxhHW",
3506
- values: {
3507
- MAX_COMBO_OPTIONS: ct,
3508
- totalBuckets: e
3509
- }
3510
- });
3511
- }
3512
- })(),
3513
- disabled: P || Q,
3514
- required: !0,
3515
- children: F.visibleBuckets.map((e) => /* @__PURE__ */ z(v, {
3516
- value: e.name,
3517
- children: e.name
3518
- }, e.name))
3519
- }),
3520
- /* @__PURE__ */ B("div", { children: [
3521
- /* @__PURE__ */ B("div", {
3522
- className: "mb-1 flex items-center justify-between",
3523
- children: [/* @__PURE__ */ z("span", {
3524
- className: "text-sm font-medium",
3525
- children: /* @__PURE__ */ z(J, { id: "Afh/Lb" })
3526
- }), /* @__PURE__ */ z(_, {
3527
- size: "small",
3528
- variant: "subdued",
3529
- icon: "addCircle",
3530
- onClick: F.startCreateFolder,
3531
- disabled: Q,
3532
- title: u._({ id: "mxPfpY" }),
3533
- children: /* @__PURE__ */ z(J, { id: "tX5yOZ" })
3534
- })]
3535
- }),
3536
- /* @__PURE__ */ B("div", {
3537
- className: "border-theme-background-lvl-2 bg-theme-background-lvl-1 flex items-center gap-2 border-b px-3 py-2 text-sm",
3538
- children: [F.currentPrefix ? /* @__PURE__ */ B("button", {
3539
- type: "button",
3540
- onClick: F.navigateUp,
3541
- className: "text-theme-link hover:text-theme-default flex items-center gap-1",
3542
- children: [/* @__PURE__ */ z(N, { size: 16 }), /* @__PURE__ */ z(J, { id: "iH8pgl" })]
3543
- }) : /* @__PURE__ */ z("span", {
3544
- className: "text-theme-light",
3545
- children: /* @__PURE__ */ z(J, { id: "eyRsaH" })
3546
- }), F.currentPrefix && /* @__PURE__ */ B("span", {
3547
- className: "text-theme-light truncate font-mono text-xs",
3548
- children: ["/ ", F.currentPrefix]
3549
- })]
3550
- }),
3551
- /* @__PURE__ */ B("div", {
3552
- ref: A,
3553
- className: "border-theme-background-lvl-2 max-h-56 overflow-y-auto rounded-b border",
3554
- children: [le ? /* @__PURE__ */ B(e, {
3555
- direction: "horizontal",
3556
- alignment: "center",
3557
- gap: "2",
3558
- className: "py-6",
3559
- children: [/* @__PURE__ */ z(a, { size: "small" }), /* @__PURE__ */ z(J, { id: "Z3FXyt" })]
3560
- }) : ce.length === 0 && !F.showNewFolderInput ? /* @__PURE__ */ z("div", {
3561
- className: "text-theme-light px-4 py-6 text-center text-sm",
3562
- children: /* @__PURE__ */ z(J, { id: "vcQSZh" })
3563
- }) : /* @__PURE__ */ z("div", {
3564
- style: {
3565
- height: `${X.getTotalSize()}px`,
3566
- position: "relative"
3567
- },
3568
- children: X.getVirtualItems().map((e) => {
3569
- let t = ce[e.index], n = t.kind === "folder";
3570
- return /* @__PURE__ */ z("div", {
3571
- "data-index": e.index,
3572
- ref: X.measureElement,
3573
- style: {
3574
- position: "absolute",
3575
- top: 0,
3576
- left: 0,
3577
- width: "100%",
3578
- transform: `translateY(${e.start}px)`
3579
- },
3580
- children: n ? /* @__PURE__ */ B("button", {
3581
- type: "button",
3582
- className: "hover:bg-theme-background-lvl-2 focus-visible:outline-theme-focus flex w-full items-center gap-2 px-4 py-2 text-left text-sm focus-visible:outline focus-visible:outline-2",
3583
- onClick: () => F.navigateToPrefix(t.name),
3584
- children: [/* @__PURE__ */ z(k, {
3585
- size: 16,
3586
- className: "text-theme-light shrink-0"
3587
- }), /* @__PURE__ */ z("span", {
3588
- className: "truncate",
3589
- children: t.displayName
3590
- })]
3591
- }) : /* @__PURE__ */ B("span", {
3592
- className: "text-theme-light flex items-center gap-2 px-4 py-2 text-sm",
3593
- children: [/* @__PURE__ */ z(j, {
3594
- size: 16,
3595
- className: "shrink-0"
3596
- }), /* @__PURE__ */ z("span", {
3597
- className: "truncate",
3598
- children: t.displayName
3599
- })]
3600
- })
3601
- }, t.name);
3602
- })
3603
- }), F.showNewFolderInput && /* @__PURE__ */ z("div", {
3604
- className: "border-theme-background-lvl-2 border-t px-4 py-3",
3605
- children: /* @__PURE__ */ z(e, {
3606
- direction: "vertical",
3607
- gap: "2",
3608
- children: /* @__PURE__ */ B(e, {
3609
- direction: "horizontal",
3610
- gap: "2",
3611
- alignment: "center",
3612
- children: [
3613
- /* @__PURE__ */ z(T, {
3614
- size: 16,
3615
- className: "text-theme-light shrink-0"
3616
- }),
3617
- /* @__PURE__ */ z(b, {
3618
- value: F.newFolderName,
3619
- onChange: (e) => F.setNewFolderName(e.target.value),
3620
- onKeyDown: ie,
3621
- placeholder: u._({ id: "KzUd7m" }),
3622
- invalid: !!F.newFolderError,
3623
- errortext: F.newFolderError ?? void 0,
3624
- autoFocus: !0,
3625
- className: "flex-1"
3626
- }),
3627
- /* @__PURE__ */ z(_, {
3628
- size: "small",
3629
- variant: "primary",
3630
- onClick: F.createFolder,
3631
- disabled: !F.newFolderName.trim(),
3632
- children: /* @__PURE__ */ z(J, { id: "hYgDIe" })
3633
- }),
3634
- /* @__PURE__ */ z(_, {
3635
- size: "small",
3636
- variant: "subdued",
3637
- onClick: F.cancelCreateFolder,
3638
- children: /* @__PURE__ */ z(J, { id: "dEgA5A" })
3639
- })
3640
- ]
3641
- })
3642
- })
3643
- })]
3644
- })
3645
- ] }),
3646
- /* @__PURE__ */ z(b, {
3647
- label: u._({ id: "Vh/Uj5" }),
3648
- value: ue,
3649
- readOnly: !0,
3650
- className: "font-mono",
3651
- helptext: fe ? u._({ id: "ZKb0D4" }) : u._({ id: "rlgAtt" }),
3652
- invalid: fe
3653
- }),
3654
- /* @__PURE__ */ z(c, {
3655
- variant: "info",
3656
- children: /* @__PURE__ */ z(J, { id: "TVsqbi" })
3657
- }),
3658
- (q.isError || K.isError) && (() => {
3659
- let e = q.error?.message ?? "", t = K.error?.message ?? "";
3660
- return /* @__PURE__ */ z(c, {
3661
- variant: "danger",
3662
- children: q.isError ? /* @__PURE__ */ z(J, {
3663
- id: "i5MEDc",
3664
- values: { copyErrorMessage: e }
3665
- }) : /* @__PURE__ */ z(J, {
3666
- id: "VoxR3s",
3667
- values: { deleteErrorMessage: t }
3668
- })
3669
- });
3670
- })()
3671
- ]
3672
- })
3673
- });
3674
- }, ut = (e) => {
3675
- let t = new Date(e);
3676
- return isNaN(t.getTime()) ? "—" : t.toLocaleString(void 0, {
3677
- year: "numeric",
3678
- month: "short",
3679
- day: "2-digit",
3680
- hour: "2-digit",
3681
- minute: "2-digit"
3682
- });
3683
- }, dt = (e) => {
3684
- let t = 0;
3685
- for (let n of e) t += 11 + n.key.length + 2 + n.value.length + 2;
3686
- return t;
3687
- }, ft = 2048, pt = ({ isOpen: n, bucketName: r, objectKey: i, onClose: s, onSuccess: u, onError: d }) => {
3688
- let { i18n: f, _: p } = te(), m = ee(), h = C.useUtils(), { data: v, isLoading: y, isError: S, error: w } = C.storage.ceph.objects.getDetails.useQuery({
3689
- project_id: m ?? "",
3690
- containerName: r,
3691
- objectKey: i
3692
- }, {
3693
- enabled: n && !!m,
3694
- refetchOnWindowFocus: !1
3695
- }), T = W(0), E = () => ++T.current, [D, O] = G([]), [k, A] = G({}), [j, M] = G(!1), [N, P] = G(""), [F, I] = G(""), [R, V] = G(null), H = W([]), K = W("");
3696
- U(() => {
3697
- if (!v?.metadata) return;
3698
- let e = Object.entries(v.metadata).map(([e, t]) => ({
3699
- uid: E(),
3700
- key: e,
3701
- value: t,
3702
- isEditing: !1,
3703
- originalKey: e,
3704
- originalValue: t
3705
- }));
3706
- O(e), H.current = e.map((e) => ({ ...e }));
3707
- }, [v]), U(() => {
3708
- n || q();
3709
- }, [n]);
3710
- let q = () => {
3711
- O([]), A({}), M(!1), P(""), I(""), V(null), ae.reset();
3712
- }, Y = (() => {
3713
- if (D.length !== H.current.length) return !0;
3714
- let e = new Map(H.current.map((e) => [e.key, e.value]));
3715
- return D.some((t) => e.get(t.key) !== t.value);
3716
- })(), ne = D.some((e) => e.isEditing), re = dt(D), ie = re > ft, ae = C.storage.ceph.objects.updateMetadata.useMutation({
3717
- onSuccess: () => {
3718
- h.storage.ceph.objects.getDetails.invalidate({
3719
- project_id: m ?? "",
3720
- containerName: r,
3721
- objectKey: K.current
3722
- }), h.storage.ceph.objects.list.invalidate(), u?.(K.current), oe();
3723
- },
3724
- onError: (e) => {
3725
- d?.(K.current, e.message);
3726
- }
3727
- }), oe = () => {
3728
- q(), s();
3729
- }, se = () => {
3730
- if (!m || ie) return;
3731
- K.current = i;
3732
- let e = {};
3733
- for (let t of D) e[t.key] = t.value;
3734
- ae.mutate({
3735
- project_id: m,
3736
- containerName: r,
3737
- objectKey: i,
3738
- metadata: e
3739
- });
3740
- }, ce = (e) => {
3741
- O((t) => t.map((t, n) => n === e ? {
3742
- ...t,
3743
- isEditing: !0
3744
- } : t));
3745
- }, X = (e, t) => {
3746
- O((n) => n.map((n, r) => r === e ? {
3747
- ...n,
3748
- key: t
3749
- } : n)), k[`edit-${e}`] && A((t) => {
3750
- let n = { ...t };
3751
- return delete n[`edit-${e}`], n;
3752
- });
3753
- }, Z = (e, t) => {
3754
- O((n) => n.map((n, r) => r === e ? {
3755
- ...n,
3756
- value: t
3757
- } : n));
3758
- }, Q = (e) => {
3759
- let t = D[e], n = et(t.key);
3760
- if (n) {
3761
- A((t) => ({
3762
- ...t,
3763
- [`edit-${e}`]: f._(n.message)
3764
- }));
3765
- return;
3766
- }
3767
- if (D.some((n, r) => r !== e && n.key.toLowerCase() === t.key.toLowerCase())) {
3768
- A((t) => ({
3769
- ...t,
3770
- [`edit-${e}`]: f._({ id: "q6K46F" })
3771
- }));
3772
- return;
3773
- }
3774
- O((t) => t.map((t, n) => n === e ? {
3775
- ...t,
3776
- isEditing: !1
3777
- } : t)), A((t) => {
3778
- let n = { ...t };
3779
- return delete n[`edit-${e}`], n;
3780
- });
3781
- }, le = (e) => {
3782
- let t = D[e], n = H.current.find((e) => e.uid === t.uid);
3783
- O(n ? (t) => t.map((t, r) => r === e ? {
3784
- ...n,
3785
- isEditing: !1
3786
- } : t) : (t) => t.filter((t, n) => n !== e)), A((t) => {
3787
- let n = { ...t };
3788
- return delete n[`edit-${e}`], n;
3789
- });
3790
- }, ue = (e) => {
3791
- O((t) => t.filter((t, n) => n !== e));
3792
- }, de = () => {
3793
- let e = et(N);
3794
- if (e) {
3795
- V(f._(e.message));
3796
- return;
3797
- }
3798
- if (D.some((e) => e.key.toLowerCase() === N.trim().toLowerCase())) {
3799
- V(f._({ id: "q6K46F" }));
3800
- return;
3801
- }
3802
- O((e) => [...e, {
3803
- uid: E(),
3804
- key: N.trim(),
3805
- value: F,
3806
- isEditing: !1
3807
- }]), P(""), I(""), V(null), M(!1);
3808
- }, fe = () => {
3809
- P(""), I(""), V(null), M(!1);
3810
- };
3811
- if (!n) return null;
3812
- let pe = i.split("/").filter(Boolean).pop() ?? i, me = ae.isPending, he = me || y, ge = w?.message ?? "", _e = ae.error?.message ?? "";
3813
- return /* @__PURE__ */ z(g, {
3814
- title: /* @__PURE__ */ z("span", {
3815
- className: "flex max-w-[400px] items-center gap-1",
3816
- children: /* @__PURE__ */ z(J, {
3817
- id: "2lq0gq",
3818
- values: { displayName: pe },
3819
- components: {
3820
- 0: /* @__PURE__ */ z("span", { className: "shrink-0" }),
3821
- 1: /* @__PURE__ */ z("span", {
3822
- className: "truncate font-mono",
3823
- title: pe
3824
- })
3825
- }
3826
- })
3827
- }),
3828
- open: n,
3829
- onCancel: oe,
3830
- confirmButtonLabel: me ? f._({ id: "XvjC4F" }) : f._({ id: "V/SINY" }),
3831
- onConfirm: se,
3832
- cancelButtonLabel: f._({ id: "dEgA5A" }),
3833
- size: "large",
3834
- disableConfirmButton: he || !Y || ne || j || ie,
3835
- children: y ? /* @__PURE__ */ B(e, {
3836
- direction: "horizontal",
3837
- alignment: "center",
3838
- gap: "2",
3839
- className: "py-8",
3840
- children: [/* @__PURE__ */ z(a, { size: "small" }), /* @__PURE__ */ z(J, { id: "O80bQY" })]
3841
- }) : S ? /* @__PURE__ */ z(c, {
3842
- variant: "danger",
3843
- children: /* @__PURE__ */ z(J, {
3844
- id: "+p6nHr",
3845
- values: { metadataErrorMessage: ge }
3846
- })
3847
- }) : /* @__PURE__ */ B(e, {
3848
- direction: "vertical",
3849
- gap: "6",
3850
- children: [
3851
- /* @__PURE__ */ B("div", { children: [/* @__PURE__ */ z("p", {
3852
- className: "text-theme-default mb-3 text-sm font-semibold",
3853
- children: /* @__PURE__ */ z(J, { id: "f0cwjH" })
3854
- }), /* @__PURE__ */ B("div", {
3855
- className: "grid grid-cols-[max-content_1fr] gap-x-6 gap-y-2 text-sm",
3856
- children: [
3857
- /* @__PURE__ */ z("span", {
3858
- className: "text-theme-light text-right",
3859
- children: /* @__PURE__ */ z(J, { id: "IbYr/u" })
3860
- }),
3861
- /* @__PURE__ */ z("span", {
3862
- className: "font-mono",
3863
- children: v?.contentType ?? "—"
3864
- }),
3865
- /* @__PURE__ */ z("span", {
3866
- className: "text-theme-light text-right",
3867
- children: /* @__PURE__ */ z(J, { id: "lRoPjj" })
3868
- }),
3869
- /* @__PURE__ */ z("span", {
3870
- className: "font-mono break-all",
3871
- children: v?.etag ?? "—"
3872
- }),
3873
- /* @__PURE__ */ z("span", {
3874
- className: "text-theme-light text-right",
3875
- children: /* @__PURE__ */ z(J, { id: "Cj2Gtd" })
3876
- }),
3877
- /* @__PURE__ */ z("span", { children: v?.size == null ? "—" : L(v.size) }),
3878
- /* @__PURE__ */ z("span", {
3879
- className: "text-theme-light text-right",
3880
- children: /* @__PURE__ */ z(J, { id: "x5DnMs" })
3881
- }),
3882
- /* @__PURE__ */ z("span", { children: v?.lastModified ? ut(v.lastModified) : "—" })
3883
- ]
3884
- })] }),
3885
- /* @__PURE__ */ B("div", { children: [
3886
- /* @__PURE__ */ B(e, {
3887
- direction: "horizontal",
3888
- alignment: "center",
3889
- distribution: "between",
3890
- className: "mb-3",
3891
- children: [/* @__PURE__ */ z("p", {
3892
- className: "text-theme-default text-sm font-semibold",
3893
- children: /* @__PURE__ */ z(J, { id: "6GBt0m" })
3894
- }), /* @__PURE__ */ B("div", {
3895
- className: "flex items-center gap-4",
3896
- children: [/* @__PURE__ */ z("p", {
3897
- className: "text-theme-light text-xs",
3898
- children: /* @__PURE__ */ z(J, { id: "6E98zF" })
3899
- }), /* @__PURE__ */ B("p", {
3900
- className: `font-mono text-xs ${ie ? "text-theme-danger font-semibold" : "text-theme-light"}`,
3901
- children: [
3902
- re,
3903
- " / ",
3904
- ft,
3905
- " bytes"
3906
- ]
3907
- })]
3908
- })]
3909
- }),
3910
- ie && /* @__PURE__ */ z(c, {
3911
- variant: "warning",
3912
- className: "mb-3",
3913
- children: /* @__PURE__ */ z(J, { id: "tkRT08" })
3914
- }),
3915
- /* @__PURE__ */ z(e, {
3916
- direction: "horizontal",
3917
- className: "jn:bg-theme-background-lvl-1 mb-3 justify-end p-2",
3918
- children: /* @__PURE__ */ z(_, {
3919
- label: f._({ id: "sWBLli" }),
3920
- onClick: () => M(!0),
3921
- variant: "primary",
3922
- icon: "addCircle",
3923
- disabled: j || ne || he
3924
- })
3925
- }),
3926
- /* @__PURE__ */ B(x, {
3927
- columns: 3,
3928
- children: [
3929
- /* @__PURE__ */ B(o, { children: [
3930
- /* @__PURE__ */ z(l, { children: /* @__PURE__ */ z(J, { id: "7sMeHQ" }) }),
3931
- /* @__PURE__ */ z(l, { children: /* @__PURE__ */ z(J, { id: "wMHvYH" }) }),
3932
- /* @__PURE__ */ z(l, { children: /* @__PURE__ */ z(J, { id: "7L01XJ" }) })
3933
- ] }),
3934
- j && /* @__PURE__ */ B(o, { children: [
3935
- /* @__PURE__ */ z(t, { children: /* @__PURE__ */ z(b, {
3936
- value: N,
3937
- onChange: (e) => {
3938
- P(e.target.value), R && V(null);
3939
- },
3940
- placeholder: f._({ id: "TSclU4" }),
3941
- errortext: R ?? void 0,
3942
- invalid: !!R,
3943
- autoFocus: !0
3944
- }) }),
3945
- /* @__PURE__ */ z(t, { children: /* @__PURE__ */ z(b, {
3946
- value: F,
3947
- onChange: (e) => I(e.target.value),
3948
- placeholder: f._({ id: "wMHvYH" })
3949
- }) }),
3950
- /* @__PURE__ */ z(t, { children: /* @__PURE__ */ B(e, {
3951
- direction: "horizontal",
3952
- gap: "2",
3953
- children: [/* @__PURE__ */ z(_, {
3954
- size: "small",
3955
- variant: "primary",
3956
- onClick: de,
3957
- icon: "check",
3958
- title: f._({ id: "tfDRzk" })
3959
- }), /* @__PURE__ */ z(_, {
3960
- size: "small",
3961
- variant: "subdued",
3962
- onClick: fe,
3963
- icon: "close",
3964
- title: f._({ id: "bzSI52" })
3965
- })]
3966
- }) })
3967
- ] }),
3968
- D.map((n, r) => /* @__PURE__ */ B(o, { children: [
3969
- /* @__PURE__ */ z(t, { children: n.isEditing ? /* @__PURE__ */ z(b, {
3970
- value: n.key,
3971
- onChange: (e) => X(r, e.target.value),
3972
- errortext: k[`edit-${r}`],
3973
- invalid: !!k[`edit-${r}`]
3974
- }) : /* @__PURE__ */ z("span", {
3975
- className: "block max-w-xs truncate font-mono text-sm",
3976
- title: n.key,
3977
- children: n.key
3978
- }) }),
3979
- /* @__PURE__ */ z(t, { children: n.isEditing ? /* @__PURE__ */ z(b, {
3980
- value: n.value,
3981
- onChange: (e) => Z(r, e.target.value)
3982
- }) : /* @__PURE__ */ z("span", {
3983
- className: "block max-w-md truncate text-sm",
3984
- title: n.value,
3985
- children: n.value
3986
- }) }),
3987
- /* @__PURE__ */ z(t, { children: n.isEditing ? /* @__PURE__ */ B(e, {
3988
- direction: "horizontal",
3989
- gap: "2",
3990
- children: [/* @__PURE__ */ z(_, {
3991
- size: "small",
3992
- variant: "primary",
3993
- onClick: () => Q(r),
3994
- icon: "check",
3995
- title: f._({ id: "tfDRzk" })
3996
- }), /* @__PURE__ */ z(_, {
3997
- size: "small",
3998
- variant: "subdued",
3999
- onClick: () => le(r),
4000
- icon: "close",
4001
- title: f._({ id: "bzSI52" })
4002
- })]
4003
- }) : /* @__PURE__ */ B(e, {
4004
- direction: "horizontal",
4005
- gap: "2",
4006
- children: [/* @__PURE__ */ z(_, {
4007
- size: "small",
4008
- variant: "subdued",
4009
- onClick: () => ce(r),
4010
- icon: "edit",
4011
- title: f._({ id: "ePK91l" }),
4012
- disabled: j || ne || he
4013
- }), /* @__PURE__ */ z(_, {
4014
- size: "small",
4015
- variant: "primary-danger",
4016
- onClick: () => ue(r),
4017
- icon: "deleteForever",
4018
- title: f._({ id: "cnGeoo" }),
4019
- disabled: j || ne || he
4020
- })]
4021
- }) })
4022
- ] }, n.uid)),
4023
- D.length === 0 && !j && /* @__PURE__ */ z(o, { children: /* @__PURE__ */ z(t, {
4024
- colSpan: 3,
4025
- className: "py-6 text-center",
4026
- children: /* @__PURE__ */ z(e, {
4027
- alignment: "center",
4028
- children: /* @__PURE__ */ z("span", {
4029
- className: "text-theme-light text-sm",
4030
- children: /* @__PURE__ */ z(J, { id: "F02e8I" })
4031
- })
4032
- })
4033
- }) })
4034
- ]
4035
- })
4036
- ] }),
4037
- ae.isError && /* @__PURE__ */ z(c, {
4038
- variant: "danger",
4039
- children: /* @__PURE__ */ z(J, {
4040
- id: "7ZnTL8",
4041
- values: { mutationErrorMessage: _e }
4042
- })
4043
- })
4044
- ]
4045
- })
4046
- });
4047
- };
4048
- //#endregion
4049
- //#region src/client/routes/_auth/projects/$projectId/storage/-components/Ceph/Objects/ObjectsTableView.tsx
4050
- function mt({ bucketName: e, objects: n, folders: r, currentPrefix: i, onFolderClick: a, onDeleteObjectSuccess: c, onDeleteObjectError: d, onCopyObjectSuccess: p, onCopyObjectError: m, onMoveObjectSuccess: h, onMoveObjectError: g, onEditMetadataSuccess: _, onEditMetadataError: v }) {
4051
- let { i18n: y, _: b } = te(), [S, C] = G(null), [w, T] = G(null), [E, D] = G(null), [O, A] = G(null), M = (e) => i ? e.replace(i, "") : e;
4052
- return r.length === 0 && n.length === 0 ? /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ B(x, {
4053
- columns: 4,
4054
- children: [/* @__PURE__ */ B(o, { children: [
4055
- /* @__PURE__ */ z(l, { children: /* @__PURE__ */ z(J, { id: "6YtxFj" }) }),
4056
- /* @__PURE__ */ z(l, { children: /* @__PURE__ */ z(J, { id: "Cj2Gtd" }) }),
4057
- /* @__PURE__ */ z(l, { children: /* @__PURE__ */ z(J, { id: "sjMCOP" }) }),
4058
- /* @__PURE__ */ z(l, {})
4059
- ] }), /* @__PURE__ */ z(o, { children: /* @__PURE__ */ z(t, {
4060
- colSpan: 4,
4061
- children: /* @__PURE__ */ z("div", {
4062
- className: "py-8 text-center",
4063
- children: /* @__PURE__ */ z("p", {
4064
- className: "text-theme-light",
4065
- children: /* @__PURE__ */ z(J, { id: "0o0OhW" })
4066
- })
4067
- })
4068
- }) })]
4069
- }), /* @__PURE__ */ z(Ze, {
4070
- bucketName: e,
4071
- objectKey: S?.key ?? "",
4072
- objectSize: S?.size,
4073
- lastModified: S?.lastModified,
4074
- isOpen: S !== null,
4075
- onClose: () => C(null),
4076
- onSuccess: c,
4077
- onError: d
4078
- })] }) : /* @__PURE__ */ B(R, { children: [
4079
- /* @__PURE__ */ B(x, {
4080
- columns: 4,
4081
- children: [
4082
- /* @__PURE__ */ B(o, { children: [
4083
- /* @__PURE__ */ z(l, { children: /* @__PURE__ */ z(J, { id: "6YtxFj" }) }),
4084
- /* @__PURE__ */ z(l, { children: /* @__PURE__ */ z(J, { id: "Cj2Gtd" }) }),
4085
- /* @__PURE__ */ z(l, { children: /* @__PURE__ */ z(J, { id: "sjMCOP" }) }),
4086
- /* @__PURE__ */ z(l, {})
4087
- ] }),
4088
- r.map((e) => {
4089
- let n = M(e.prefix).replace(/\/$/, "");
4090
- return /* @__PURE__ */ B(o, { children: [
4091
- /* @__PURE__ */ z(t, { children: /* @__PURE__ */ B("button", {
4092
- type: "button",
4093
- className: "flex min-w-0 items-center gap-2 rounded text-left hover:underline focus-visible:outline focus-visible:outline-2",
4094
- onClick: () => a(e.prefix),
4095
- title: e.prefix,
4096
- children: [/* @__PURE__ */ z(k, {
4097
- size: 18,
4098
- className: "text-theme-light shrink-0"
4099
- }), /* @__PURE__ */ z("span", {
4100
- className: "truncate font-mono text-sm",
4101
- children: n
4102
- })]
4103
- }) }),
4104
- /* @__PURE__ */ z(t, { children: "—" }),
4105
- /* @__PURE__ */ z(t, { children: "—" }),
4106
- /* @__PURE__ */ z(t, {
4107
- onClick: (e) => e.stopPropagation(),
4108
- children: /* @__PURE__ */ z("div", {
4109
- className: "flex justify-end",
4110
- children: /* @__PURE__ */ z(f, { children: /* @__PURE__ */ z(s, { children: /* @__PURE__ */ z(u, {
4111
- label: y._({ id: "cnGeoo" }),
4112
- onClick: () => C({ key: e.prefix })
4113
- }) }) })
4114
- })
4115
- })
4116
- ] }, e.prefix);
4117
- }),
4118
- n.map((e) => {
4119
- let n = M(e.key);
4120
- return /* @__PURE__ */ B(o, { children: [
4121
- /* @__PURE__ */ z(t, { children: /* @__PURE__ */ B("div", {
4122
- className: "flex items-center gap-2",
4123
- children: [/* @__PURE__ */ z(j, {
4124
- size: 18,
4125
- className: "text-theme-light shrink-0"
4126
- }), /* @__PURE__ */ z("span", {
4127
- className: "truncate font-mono text-sm",
4128
- children: n
4129
- })]
4130
- }) }),
4131
- /* @__PURE__ */ z(t, { children: /* @__PURE__ */ z("span", {
4132
- className: "text-juno-grey-light-1 text-sm",
4133
- children: L(e.size)
4134
- }) }),
4135
- /* @__PURE__ */ z(t, { children: /* @__PURE__ */ z("span", {
4136
- className: "text-juno-grey-light-1 text-sm",
4137
- children: e.lastModified ? new Date(e.lastModified).toLocaleString() : "—"
4138
- }) }),
4139
- /* @__PURE__ */ z(t, {
4140
- onClick: (e) => e.stopPropagation(),
4141
- children: /* @__PURE__ */ z("div", {
4142
- className: "flex justify-end",
4143
- children: /* @__PURE__ */ z(f, { children: /* @__PURE__ */ B(s, { children: [
4144
- /* @__PURE__ */ z(u, {
4145
- label: y._({ id: "he3ygx" }),
4146
- onClick: () => T({
4147
- key: e.key,
4148
- size: e.size
4149
- })
4150
- }),
4151
- /* @__PURE__ */ z(u, {
4152
- label: y._({ id: "QWdKwH" }),
4153
- onClick: () => D({
4154
- key: e.key,
4155
- size: e.size
4156
- })
4157
- }),
4158
- /* @__PURE__ */ z(u, {
4159
- label: y._({ id: "SIfYq6" }),
4160
- onClick: () => A(e.key)
4161
- }),
4162
- /* @__PURE__ */ z(u, {
4163
- label: y._({ id: "cnGeoo" }),
4164
- onClick: () => C({
4165
- key: e.key,
4166
- size: e.size,
4167
- lastModified: e.lastModified
4168
- })
4169
- })
4170
- ] }) })
4171
- })
4172
- })
4173
- ] }, e.key);
4174
- })
4175
- ]
4176
- }),
4177
- /* @__PURE__ */ z(Ze, {
4178
- bucketName: e,
4179
- objectKey: S?.key ?? "",
4180
- objectSize: S?.size,
4181
- lastModified: S?.lastModified,
4182
- isOpen: S !== null,
4183
- onClose: () => C(null),
4184
- onSuccess: c,
4185
- onError: d
4186
- }),
4187
- /* @__PURE__ */ z(st, {
4188
- bucketName: e,
4189
- objectKey: w?.key ?? "",
4190
- objectSize: w?.size,
4191
- isOpen: w !== null,
4192
- onClose: () => T(null),
4193
- onSuccess: p,
4194
- onError: m
4195
- }),
4196
- /* @__PURE__ */ z(lt, {
4197
- bucketName: e,
4198
- objectKey: E?.key ?? "",
4199
- objectSize: E?.size,
4200
- isOpen: E !== null,
4201
- onClose: () => D(null),
4202
- onSuccess: h,
4203
- onError: g
4204
- }),
4205
- /* @__PURE__ */ z(pt, {
4206
- bucketName: e,
4207
- objectKey: O ?? "",
4208
- isOpen: O !== null,
4209
- onClose: () => A(null),
4210
- onSuccess: _,
4211
- onError: v
4212
- })
4213
- ] });
4214
- }
4215
- //#endregion
4216
- //#region src/client/routes/_auth/projects/$projectId/storage/-components/Ceph/Objects/ObjectsFileNavigation.tsx
4217
- function ht(e) {
4218
- if (!e) return [];
4219
- let t = e.replace(/\/$/, "").split("/").filter(Boolean);
4220
- return t.map((e, n) => ({
4221
- label: e,
4222
- prefix: t.slice(0, n + 1).join("/") + "/"
4223
- }));
4224
- }
4225
- var gt = "bg-theme-background-lvl-4 rounded px-2 py-0.5";
4226
- function _t({ bucketName: e, prefix: t, onPrefixClick: n }) {
4227
- let a = ht(t), o = a.length === 0;
4228
- return /* @__PURE__ */ z("div", {
4229
- className: "mb-2 px-2 pt-2",
4230
- children: /* @__PURE__ */ B(i, { children: [/* @__PURE__ */ z(r, {
4231
- onClick: o ? void 0 : () => n(""),
4232
- active: o,
4233
- label: /* @__PURE__ */ B("span", {
4234
- className: `flex items-center gap-1 ${o ? gt : ""}`,
4235
- children: [z(o ? D : E, {
4236
- size: 15,
4237
- className: "shrink-0"
4238
- }), e]
4239
- })
4240
- }), a.map((e, t) => {
4241
- let i = t === a.length - 1;
4242
- return /* @__PURE__ */ z(r, {
4243
- onClick: i ? void 0 : () => n(e.prefix),
4244
- active: i,
4245
- label: /* @__PURE__ */ B("span", {
4246
- className: `flex items-center gap-1 ${i ? gt : ""}`,
4247
- children: [z(i ? P : k, {
4248
- size: 15,
4249
- className: "shrink-0"
4250
- }), e.label]
4251
- })
4252
- }, e.prefix);
4253
- })] })
4254
- });
4255
- }
4256
- //#endregion
4257
- //#region src/client/routes/_auth/projects/$projectId/storage/-components/Ceph/Objects/CreateFolderModal.tsx
4258
- function vt({ bucketName: t, currentPrefix: n, isOpen: r, onClose: i, onSuccess: a }) {
4259
- let { i18n: o, _: s } = te(), c = ee(), [l, u] = G(""), [d, f] = G(null), p = C.useUtils(), { data: m } = C.storage.ceph.objects.list.useQuery({
4260
- project_id: c ?? "",
4261
- containerName: t,
4262
- prefix: n || void 0,
4263
- delimiter: "/",
4264
- maxKeys: 1e3
4265
- }, { enabled: r && !!c && !!t }), h = C.storage.ceph.objects.createFolder.useMutation({ onSuccess: (e, t) => {
4266
- p.storage.ceph.objects.list.invalidate(), a(t.folderPath.endsWith("/") ? t.folderPath : `${t.folderPath}/`), v();
4267
- } }), v = () => {
4268
- u(""), f(null), h.reset(), i();
4269
- }, y = (e) => {
4270
- u(e);
4271
- let t = Qe(e, m?.folders.map((e) => e.prefix) ?? [], n);
4272
- f(t ? o._(t.message) : null);
4273
- }, x = () => {
4274
- if (!c) return;
4275
- let e = Qe(l, m?.folders.map((e) => e.prefix) ?? [], n);
4276
- if (e) {
4277
- f(o._(e.message));
4278
- return;
4279
- }
4280
- let r = n + l.trim();
4281
- h.mutate({
4282
- project_id: c,
4283
- containerName: t,
4284
- folderPath: r
4285
- });
4286
- }, S = !d && l.trim().length > 0;
4287
- return /* @__PURE__ */ B(g, {
4288
- open: r,
4289
- onCancel: v,
4290
- title: /* @__PURE__ */ z(J, { id: "sYJvnu" }),
4291
- size: "large",
4292
- children: [/* @__PURE__ */ B(e, {
4293
- direction: "vertical",
4294
- gap: "4",
4295
- children: [
4296
- /* @__PURE__ */ z("p", { children: /* @__PURE__ */ z(J, { id: "2G+7C1" }) }),
4297
- n && /* @__PURE__ */ B("div", {
4298
- className: "bg-theme-background-lvl-2 rounded p-3",
4299
- children: [/* @__PURE__ */ z("span", {
4300
- className: "text-juno-grey-light-1 text-sm",
4301
- children: /* @__PURE__ */ z(J, { id: "Z30x/C" })
4302
- }), /* @__PURE__ */ z("div", {
4303
- className: "mt-1 font-mono text-sm",
4304
- children: n
4305
- })]
4306
- }),
4307
- /* @__PURE__ */ z(b, {
4308
- label: o._({ id: "XXRutf" }),
4309
- value: l,
4310
- onChange: (e) => y(e.target.value),
4311
- placeholder: "my-folder",
4312
- autoFocus: !0,
4313
- invalid: !!d,
4314
- errortext: d || void 0,
4315
- onKeyDown: (e) => {
4316
- e.key === "Enter" && S && !h.isPending && x();
4317
- }
4318
- }),
4319
- /* @__PURE__ */ B("div", {
4320
- className: "bg-theme-background-lvl-1 rounded p-3",
4321
- children: [/* @__PURE__ */ z("span", {
4322
- className: "text-juno-grey-light-1 text-sm",
4323
- children: /* @__PURE__ */ z(J, { id: "oAMLhA" })
4324
- }), /* @__PURE__ */ z("div", {
4325
- className: "mt-1 font-mono text-sm break-all",
4326
- children: n + l.trim() + "/"
4327
- })]
4328
- }),
4329
- h.error && /* @__PURE__ */ B("p", {
4330
- className: "text-juno-red text-sm",
4331
- children: [
4332
- /* @__PURE__ */ z(J, { id: "4BITzH" }),
4333
- " ",
4334
- h.error.message
4335
- ]
4336
- })
4337
- ]
4338
- }), /* @__PURE__ */ B("div", {
4339
- className: "mt-6 flex justify-end gap-2",
4340
- children: [/* @__PURE__ */ z(_, {
4341
- variant: "subdued",
4342
- onClick: v,
4343
- disabled: h.isPending,
4344
- children: /* @__PURE__ */ z(J, { id: "dEgA5A" })
4345
- }), /* @__PURE__ */ z(_, {
4346
- variant: "primary",
4347
- onClick: x,
4348
- disabled: !S || h.isPending,
4349
- children: h.isPending ? /* @__PURE__ */ z(J, { id: "HM56Bx" }) : /* @__PURE__ */ z(J, { id: "boJ+Y1" })
4350
- })]
4351
- })]
4352
- });
4353
- }
4354
- //#endregion
4355
- //#region src/client/routes/_auth/projects/$projectId/storage/-components/Ceph/Objects/ObjectToastNotifications.tsx
4356
- function yt({ title: t, description: n }) {
4357
- return /* @__PURE__ */ B(e, {
4358
- direction: "vertical",
4359
- gap: "1.5",
4360
- children: [/* @__PURE__ */ z("span", { children: t }), /* @__PURE__ */ z("span", {
4361
- className: "text-theme-light",
4362
- children: n
4363
- })]
4364
- });
4365
- }
4366
- var bt = (e, t) => ({
4367
- variant: "success",
4368
- autoDismiss: !0,
4369
- autoDismissTimeout: t.autoDismissTimeout ?? 5e3,
4370
- onDismiss: t.onDismiss,
4371
- children: /* @__PURE__ */ z(yt, {
4372
- title: /* @__PURE__ */ z(J, { id: "6KRclz" }),
4373
- description: /* @__PURE__ */ z(J, {
4374
- id: "7hLLUk",
4375
- values: { folderPath: e }
4376
- })
4377
- })
4378
- }), xt = (e, t) => {
4379
- let n = e.split("/").filter(Boolean).pop() ?? e;
4380
- return {
4381
- variant: "success",
4382
- autoDismiss: !0,
4383
- autoDismissTimeout: t.autoDismissTimeout ?? 5e3,
4384
- onDismiss: t.onDismiss,
4385
- children: /* @__PURE__ */ z(yt, {
4386
- title: /* @__PURE__ */ z(J, { id: "z9NAjZ" }),
4387
- description: /* @__PURE__ */ z(J, {
4388
- id: "LASqRM",
4389
- values: { displayName: n }
4390
- })
4391
- })
4392
- };
4393
- }, St = (e, t, n) => {
4394
- let r = e.split("/").filter(Boolean).pop() ?? e;
4395
- return {
4396
- variant: "error",
4397
- autoDismiss: !0,
4398
- autoDismissTimeout: n.autoDismissTimeout ?? 5e3,
4399
- onDismiss: n.onDismiss,
4400
- children: /* @__PURE__ */ z(yt, {
4401
- title: /* @__PURE__ */ z(J, { id: "RSg/pq" }),
4402
- description: /* @__PURE__ */ z(J, {
4403
- id: "oJVmWq",
4404
- values: {
4405
- displayName: r,
4406
- errorMessage: t
4407
- }
4408
- })
4409
- })
4410
- };
4411
- }, Ct = (e, t, n, r, i) => {
4412
- let a = e.split("/").filter(Boolean).pop() ?? e, o = `${t}/${n}`;
4413
- return {
4414
- variant: "success",
4415
- autoDismiss: !0,
4416
- autoDismissTimeout: r.autoDismissTimeout ?? 5e3,
4417
- onDismiss: r.onDismiss,
4418
- children: /* @__PURE__ */ z(yt, {
4419
- title: /* @__PURE__ */ z(J, { id: "Lylr9Z" }),
4420
- description: i ? /* @__PURE__ */ z(J, {
4421
- id: "La2LYh",
4422
- values: {
4423
- displayName: a,
4424
- destination: o
4425
- }
4426
- }) : /* @__PURE__ */ z(J, {
4427
- id: "Af8YL/",
4428
- values: {
4429
- displayName: a,
4430
- destination: o
4431
- }
4432
- })
4433
- })
4434
- };
4435
- }, wt = (e, t, n) => {
4436
- let r = e.split("/").filter(Boolean).pop() ?? e;
4437
- return {
4438
- variant: "error",
4439
- autoDismiss: !0,
4440
- autoDismissTimeout: n.autoDismissTimeout ?? 5e3,
4441
- onDismiss: n.onDismiss,
4442
- children: /* @__PURE__ */ z(yt, {
4443
- title: /* @__PURE__ */ z(J, { id: "tOkmLM" }),
4444
- description: /* @__PURE__ */ z(J, {
4445
- id: "tIc6vY",
4446
- values: {
4447
- displayName: r,
4448
- errorMessage: t
4449
- }
4450
- })
4451
- })
4452
- };
4453
- }, Tt = (e, t, n, r) => {
4454
- let i = e.split("/").filter(Boolean).pop() ?? e, a = `${t}/${n}`;
4455
- return {
4456
- variant: "success",
4457
- autoDismiss: !0,
4458
- autoDismissTimeout: r.autoDismissTimeout ?? 5e3,
4459
- onDismiss: r.onDismiss,
4460
- children: /* @__PURE__ */ z(yt, {
4461
- title: /* @__PURE__ */ z(J, { id: "6luZQA" }),
4462
- description: /* @__PURE__ */ z(J, {
4463
- id: "nYab6d",
4464
- values: {
4465
- displayName: i,
4466
- destination: a
4467
- }
4468
- })
4469
- })
4470
- };
4471
- }, Et = (e, t, n) => {
4472
- let r = e.split("/").filter(Boolean).pop() ?? e;
4473
- return {
4474
- variant: "error",
4475
- autoDismiss: !0,
4476
- autoDismissTimeout: n.autoDismissTimeout ?? 5e3,
4477
- onDismiss: n.onDismiss,
4478
- children: /* @__PURE__ */ z(yt, {
4479
- title: /* @__PURE__ */ z(J, { id: "SCY5an" }),
4480
- description: /* @__PURE__ */ z(J, {
4481
- id: "TTX3nV",
4482
- values: {
4483
- displayName: r,
4484
- errorMessage: t
4485
- }
4486
- })
4487
- })
4488
- };
4489
- }, Dt = (e, t) => {
4490
- let n = e.split("/").filter(Boolean).pop() ?? e;
4491
- return {
4492
- variant: "success",
4493
- autoDismiss: !0,
4494
- autoDismissTimeout: t.autoDismissTimeout ?? 5e3,
4495
- onDismiss: t.onDismiss,
4496
- children: /* @__PURE__ */ z(yt, {
4497
- title: /* @__PURE__ */ z(J, { id: "YRexkb" }),
4498
- description: /* @__PURE__ */ z(J, {
4499
- id: "/LXXlY",
4500
- values: { displayName: n }
4501
- })
4502
- })
4503
- };
4504
- }, Ot = (e, t, n) => {
4505
- let r = e.split("/").filter(Boolean).pop() ?? e;
4506
- return {
4507
- variant: "error",
4508
- autoDismiss: !0,
4509
- autoDismissTimeout: n.autoDismissTimeout ?? 5e3,
4510
- onDismiss: n.onDismiss,
4511
- children: /* @__PURE__ */ z(yt, {
4512
- title: /* @__PURE__ */ z(J, { id: "4t33sh" }),
4513
- description: /* @__PURE__ */ z(J, {
4514
- id: "2xbYVD",
4515
- values: {
4516
- displayName: r,
4517
- errorMessage: t
4518
- }
4519
- })
4520
- })
4521
- };
4522
- }, kt = (e) => {
4523
- let t = new TextEncoder().encode(e), n = Array.from(t, (e) => String.fromCodePoint(e)).join("");
4524
- return btoa(n);
4525
- }, At = (e) => {
4526
- if (!e) return "";
4527
- try {
4528
- let t = atob(e), n = Uint8Array.from(t, (e) => e.codePointAt(0));
4529
- return new TextDecoder().decode(n);
4530
- } catch {
4531
- return "";
4532
- }
4533
- };
4534
- function jt({ bucketName: t }) {
4535
- let { i18n: n, _: r } = te(), i = ee(), o = K({ from: F.fullPath }), { prefix: s, sortBy: c, sortDirection: l, search: u = "" } = F.useSearch(), f = At(s), [p, m] = G(void 0), [h, g] = G([]), [v, y] = G([]), [b, x] = G(!1), [S, w] = G(!1), [T, E] = G(null), D = () => E(null), { data: O, isLoading: k, error: A } = C.storage.ceph.objects.list.useQuery({
4536
- project_id: i ?? "",
4537
- containerName: t,
4538
- prefix: f || void 0,
4539
- delimiter: "/",
4540
- maxKeys: 1e3,
4541
- continuationToken: p
4542
- }, { enabled: !!i });
4543
- U(() => {
4544
- if (O) {
4545
- let e = O.objects.filter((e) => {
4546
- let t = f ? e.key.replace(f, "") : e.key;
4547
- return t !== "" && t !== "/";
4548
- });
4549
- p ? (g((t) => [...t, ...e]), y((e) => [...e, ...O.folders])) : (g(e), y(O.folders)), x(O.isTruncated ?? !1);
4550
- }
4551
- }, [
4552
- O,
4553
- p,
4554
- f
4555
- ]);
4556
- let j = (e) => {
4557
- m(void 0), g([]), y([]), x(!1), o({ search: (t) => ({
4558
- ...t,
4559
- prefix: e ? kt(e) : void 0
4560
- }) });
4561
- }, M = () => {
4562
- O?.nextContinuationToken && m(O.nextContinuationToken);
4563
- }, N = (e) => f ? e.replace(f, "") : e, P = h.filter((e) => N(e.key).toLowerCase().includes(u.toLowerCase().trim())), L = v.filter((e) => N(e.prefix).toLowerCase().includes(u.toLowerCase().trim())), R = c ? [...P].sort((e, t) => {
4564
- let n = 0;
4565
- switch (c) {
4566
- case "name":
4567
- n = N(e.key).localeCompare(N(t.key));
4568
- break;
4569
- case "lastModified":
4570
- case "last_modified": {
4571
- let r = e.lastModified, i = t.lastModified;
4572
- if (!r || !i) break;
4573
- n = new Date(r).getTime() - new Date(i).getTime();
4574
- break;
4575
- }
4576
- case "size":
4577
- case "bytes":
4578
- n = e.size - t.size;
4579
- break;
4580
- }
4581
- return l === "desc" ? -n : n;
4582
- }) : P, H = c ? [...L].sort((e, t) => c === "name" ? l === "desc" ? N(t.prefix).localeCompare(N(e.prefix)) : N(e.prefix).localeCompare(N(t.prefix)) : 0) : L, W = {
4583
- options: [
4584
- {
4585
- label: n._({ id: "6YtxFj" }),
4586
- value: "name"
4587
- },
4588
- {
4589
- label: n._({ id: "sjMCOP" }),
4590
- value: "lastModified"
4591
- },
4592
- {
4593
- label: n._({ id: "Cj2Gtd" }),
4594
- value: "size"
4595
- }
4596
- ],
4597
- sortBy: c ?? void 0,
4598
- sortDirection: l ?? "asc"
4599
- }, q = (e) => {
4600
- let t = typeof e == "string" ? e : "";
4601
- V(() => {
4602
- o({ search: (e) => ({
4603
- ...e,
4604
- search: t || void 0
4605
- }) });
4606
- });
4607
- }, Y = (e) => {
4608
- let t = e.sortBy, n = e.sortDirection || "asc";
4609
- V(() => {
4610
- o({ search: (e) => ({
4611
- ...e,
4612
- sortBy: t,
4613
- sortDirection: t ? n : void 0
4614
- }) });
4615
- });
4616
- };
4617
- if (k && !p) return /* @__PURE__ */ B(e, {
4618
- direction: "horizontal",
4619
- gap: "2",
4620
- alignment: "center",
4621
- className: "mt-8",
4622
- children: [/* @__PURE__ */ z(a, {}), /* @__PURE__ */ z("span", {
4623
- className: "text-juno-grey-light-1 text-sm",
4624
- children: /* @__PURE__ */ z(J, { id: "ujK/QN" })
4625
- })]
4626
- });
4627
- if (A) {
4628
- let e = A.message;
4629
- return /* @__PURE__ */ z("p", {
4630
- className: "text-juno-red mt-4 text-sm",
4631
- children: /* @__PURE__ */ z(J, {
4632
- id: "MuKU9V",
4633
- values: { errorMessage: e }
4634
- })
4635
- });
4636
- }
4637
- return /* @__PURE__ */ B("div", {
4638
- className: "relative",
4639
- children: [
4640
- /* @__PURE__ */ z(_t, {
4641
- bucketName: t,
4642
- prefix: f,
4643
- onPrefixClick: j
4644
- }),
4645
- /* @__PURE__ */ z(I, {
4646
- sortSettings: W,
4647
- searchTerm: u,
4648
- onSort: Y,
4649
- onSearch: q,
4650
- actions: /* @__PURE__ */ z(e, {
4651
- direction: "horizontal",
4652
- gap: "2",
4653
- children: /* @__PURE__ */ z(_, {
4654
- variant: "primary",
4655
- onClick: () => w(!0),
4656
- children: /* @__PURE__ */ z(J, { id: "boJ+Y1" })
4657
- })
4658
- })
4659
- }),
4660
- /* @__PURE__ */ z(mt, {
4661
- bucketName: t,
4662
- objects: R,
4663
- folders: H,
4664
- currentPrefix: f,
4665
- onFolderClick: j,
4666
- onDeleteObjectSuccess: (e) => {
4667
- E(xt(e, { onDismiss: D }));
4668
- },
4669
- onDeleteObjectError: (e, t) => {
4670
- E(St(e, t, { onDismiss: D }));
4671
- },
4672
- onCopyObjectSuccess: (e, t, n, r) => {
4673
- E(Ct(e, t, n, { onDismiss: D }, r));
4674
- },
4675
- onCopyObjectError: (e, t) => {
4676
- E(wt(e, t, { onDismiss: D }));
4677
- },
4678
- onMoveObjectSuccess: (e, t, n) => {
4679
- E(Tt(e, t, n, { onDismiss: D }));
4680
- },
4681
- onMoveObjectError: (e, t) => {
4682
- E(Et(e, t, { onDismiss: D }));
4683
- },
4684
- onEditMetadataSuccess: (e) => {
4685
- E(Dt(e, { onDismiss: D }));
4686
- },
4687
- onEditMetadataError: (e, t) => {
4688
- E(Ot(e, t, { onDismiss: D }));
4689
- }
4690
- }),
4691
- b && /* @__PURE__ */ z("div", {
4692
- className: "mt-4 flex justify-center",
4693
- children: /* @__PURE__ */ z(_, {
4694
- onClick: M,
4695
- disabled: k,
4696
- variant: "subdued",
4697
- children: k ? /* @__PURE__ */ z(J, { id: "tVSmFT" }) : /* @__PURE__ */ z(J, { id: "a4N/Bg" })
4698
- })
4699
- }),
4700
- /* @__PURE__ */ z(vt, {
4701
- bucketName: t,
4702
- currentPrefix: f,
4703
- isOpen: S,
4704
- onClose: () => w(!1),
4705
- onSuccess: (e) => {
4706
- w(!1), E(bt(e, { onDismiss: D })), j(e);
4707
- }
4708
- }),
4709
- T && /* @__PURE__ */ z(d, { ...T })
4710
- ]
4711
- });
4712
- }
4713
- //#endregion
4714
- //#region src/client/routes/_auth/projects/$projectId/storage/$provider/containers/$containerName/objects/index.tsx?tsr-split=component
4715
- function Mt() {
4716
- let { project: e, provider: t, containerName: n } = q({
4717
- from: "/_auth/projects/$projectId/storage/$provider/containers/$containerName/objects/",
4718
- select: (e) => ({
4719
- project: e.projectId,
4720
- provider: e.provider,
4721
- containerName: e.containerName
4722
- })
4723
- }), { prefix: r, sortBy: i, sortDirection: a, search: o } = F.useSearch();
4724
- return /* @__PURE__ */ z("div", { children: e ? /* @__PURE__ */ z(Y, {
4725
- resetKeys: [
4726
- e,
4727
- t,
4728
- n,
4729
- r,
4730
- i,
4731
- a,
4732
- o
4733
- ],
4734
- fallback: /* @__PURE__ */ z("div", {
4735
- className: "p-4 text-center",
4736
- children: /* @__PURE__ */ z(J, { id: "diFNkW" })
4737
- }),
4738
- children: (() => {
4739
- switch (t) {
4740
- case "swift": return /* @__PURE__ */ z(Xe, {});
4741
- case "ceph": return /* @__PURE__ */ z(jt, { bucketName: n });
4742
- default: return /* @__PURE__ */ z("div", {
4743
- className: "p-4",
4744
- children: /* @__PURE__ */ z(J, {
4745
- id: "BSaBkZ",
4746
- values: { containerName: n }
4747
- })
4748
- });
4749
- }
4750
- })()
4751
- }) : /* @__PURE__ */ z("div", {
4752
- className: "p-4 text-center",
4753
- children: /* @__PURE__ */ z(J, { id: "Z2fZGD" })
4754
- }) });
4755
- }
4756
- var Nt = () => /* @__PURE__ */ z(Mt, {});
4757
- //#endregion
4758
- export { Nt as component };
4759
-
4760
- //# sourceMappingURL=objects-Cw4Vu01M.mjs.map