@synopackageland/sdk 0.0.0-stage → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +34 -2
  3. package/dist/i18n/authorization/de.json +37 -0
  4. package/dist/i18n/authorization/en.json +37 -0
  5. package/dist/i18n/authorization/es.json +37 -0
  6. package/dist/i18n/authorization/fr.json +37 -0
  7. package/dist/i18n/authorization/it.json +37 -0
  8. package/dist/i18n/authorization/ja.json +37 -0
  9. package/dist/i18n/authorization/ko.json +37 -0
  10. package/dist/i18n/authorization/zh-CN.json +37 -0
  11. package/dist/i18n/authorization/zh-TW.json +37 -0
  12. package/dist/i18n/background/de.json +75 -0
  13. package/dist/i18n/background/en.json +75 -0
  14. package/dist/i18n/background/es.json +75 -0
  15. package/dist/i18n/background/fr.json +75 -0
  16. package/dist/i18n/background/it.json +75 -0
  17. package/dist/i18n/background/ja.json +75 -0
  18. package/dist/i18n/background/ko.json +75 -0
  19. package/dist/i18n/background/zh-CN.json +75 -0
  20. package/dist/i18n/background/zh-TW.json +75 -0
  21. package/dist/i18n/delegate/de.json +48 -0
  22. package/dist/i18n/delegate/en.json +48 -0
  23. package/dist/i18n/delegate/es.json +48 -0
  24. package/dist/i18n/delegate/fr.json +48 -0
  25. package/dist/i18n/delegate/it.json +48 -0
  26. package/dist/i18n/delegate/ja.json +48 -0
  27. package/dist/i18n/delegate/ko.json +48 -0
  28. package/dist/i18n/delegate/zh-CN.json +48 -0
  29. package/dist/i18n/delegate/zh-TW.json +48 -0
  30. package/dist/i18n/files/de.json +41 -0
  31. package/dist/i18n/files/en.json +41 -0
  32. package/dist/i18n/files/es.json +41 -0
  33. package/dist/i18n/files/fr.json +41 -0
  34. package/dist/i18n/files/it.json +41 -0
  35. package/dist/i18n/files/ja.json +41 -0
  36. package/dist/i18n/files/ko.json +41 -0
  37. package/dist/i18n/files/zh-CN.json +41 -0
  38. package/dist/i18n/files/zh-TW.json +41 -0
  39. package/dist/i18n/identity/de.json +27 -0
  40. package/dist/i18n/identity/en.json +27 -0
  41. package/dist/i18n/identity/es.json +27 -0
  42. package/dist/i18n/identity/fr.json +27 -0
  43. package/dist/i18n/identity/it.json +27 -0
  44. package/dist/i18n/identity/ja.json +27 -0
  45. package/dist/i18n/identity/ko.json +27 -0
  46. package/dist/i18n/identity/zh-CN.json +27 -0
  47. package/dist/i18n/identity/zh-TW.json +27 -0
  48. package/dist/i18n/save/de.json +42 -0
  49. package/dist/i18n/save/en.json +42 -0
  50. package/dist/i18n/save/es.json +42 -0
  51. package/dist/i18n/save/fr.json +42 -0
  52. package/dist/i18n/save/it.json +42 -0
  53. package/dist/i18n/save/ja.json +42 -0
  54. package/dist/i18n/save/ko.json +42 -0
  55. package/dist/i18n/save/zh-CN.json +42 -0
  56. package/dist/i18n/save/zh-TW.json +42 -0
  57. package/dist/i18n/shell/de.json +4 -0
  58. package/dist/i18n/shell/en.json +4 -0
  59. package/dist/i18n/shell/es.json +4 -0
  60. package/dist/i18n/shell/fr.json +4 -0
  61. package/dist/i18n/shell/it.json +4 -0
  62. package/dist/i18n/shell/ja.json +4 -0
  63. package/dist/i18n/shell/ko.json +4 -0
  64. package/dist/i18n/shell/zh-CN.json +4 -0
  65. package/dist/i18n/shell/zh-TW.json +4 -0
  66. package/dist/index.js +2619 -0
  67. package/dist/src/authorization/AuthorizationGate.vue.d.ts +22 -0
  68. package/dist/src/authorization/i18n.d.ts +3 -0
  69. package/dist/src/background/BackgroundPanel.vue.d.ts +7 -0
  70. package/dist/src/background/i18n.d.ts +79 -0
  71. package/dist/src/background/picker-provider.d.ts +3 -0
  72. package/dist/src/background/request-key.d.ts +1 -0
  73. package/dist/src/context.d.ts +114 -0
  74. package/dist/src/delegate/BackgroundSavePanel.vue.d.ts +18 -0
  75. package/dist/src/delegate/DelegatePanel.vue.d.ts +7 -0
  76. package/dist/src/delegate/ExecutorSettings.vue.d.ts +13 -0
  77. package/dist/src/delegate/copy.d.ts +99 -0
  78. package/dist/src/delegate/executor-setup.d.ts +16 -0
  79. package/dist/src/delegate/facade.d.ts +8 -0
  80. package/dist/src/delegate/long-running.d.ts +74 -0
  81. package/dist/src/delegate/save-copy.d.ts +126 -0
  82. package/dist/src/delegate/scoped-picker.d.ts +3 -0
  83. package/dist/src/delegate/use-executor-setup.d.ts +4 -0
  84. package/dist/src/files/FileBrowser.vue.d.ts +17 -0
  85. package/dist/src/files/FilesPage.vue.d.ts +7 -0
  86. package/dist/src/files/transfers.d.ts +9 -0
  87. package/dist/src/i18n.d.ts +6 -0
  88. package/dist/src/identity/LoginPage.vue.d.ts +8 -0
  89. package/dist/src/identity/i18n.d.ts +31 -0
  90. package/dist/src/identity/session.d.ts +20 -0
  91. package/dist/src/index.d.ts +24 -0
  92. package/dist/src/nas/NasPicker.vue.d.ts +22 -0
  93. package/dist/src/nas/contract.d.ts +27 -0
  94. package/dist/src/nas/i18n.d.ts +2 -0
  95. package/dist/src/nas/locale.d.ts +45 -0
  96. package/dist/src/nas/provider.d.ts +3 -0
  97. package/dist/src/nas/use-request.d.ts +6 -0
  98. package/dist/src/portal/PortalSettings.vue.d.ts +7 -0
  99. package/dist/src/protocol/codec.d.ts +17 -0
  100. package/dist/src/protocol/v1.d.ts +524 -0
  101. package/dist/src/shell/AppShell.vue.d.ts +26 -0
  102. package/dist/src/shell/i18n.d.ts +7 -0
  103. package/dist/src/shell/pages.d.ts +7 -0
  104. package/dist/src/vue.d.ts +15 -0
  105. package/dist/style.css +1 -0
  106. package/dist/vue.js +2324 -0
  107. package/package.json +64 -4
  108. package/spec/protocol/v1/README.md +112 -0
  109. package/spec/protocol/v1/errors.json +462 -0
  110. package/spec/protocol/v1/schema/delegate.audit.json +11 -0
  111. package/spec/protocol/v1/schema/delegate.create.json +49 -0
  112. package/spec/protocol/v1/schema/delegate.disable.json +11 -0
  113. package/spec/protocol/v1/schema/delegate.enable.json +11 -0
  114. package/spec/protocol/v1/schema/delegate.list.json +11 -0
  115. package/spec/protocol/v1/schema/delegate.revoke.json +23 -0
  116. package/spec/protocol/v1/schema/files.cancelOperation.json +24 -0
  117. package/spec/protocol/v1/schema/files.checkPermission.json +30 -0
  118. package/spec/protocol/v1/schema/files.copy.json +42 -0
  119. package/spec/protocol/v1/schema/files.createFolder.json +38 -0
  120. package/spec/protocol/v1/schema/files.delete.json +36 -0
  121. package/spec/protocol/v1/schema/files.info.json +30 -0
  122. package/spec/protocol/v1/schema/files.list.json +30 -0
  123. package/spec/protocol/v1/schema/files.move.json +42 -0
  124. package/spec/protocol/v1/schema/files.moveFromStaging.json +47 -0
  125. package/spec/protocol/v1/schema/files.operationStatus.json +24 -0
  126. package/spec/protocol/v1/schema/files.read.json +35 -0
  127. package/spec/protocol/v1/schema/files.rename.json +35 -0
  128. package/spec/protocol/v1/schema/files.taskCancel.json +29 -0
  129. package/spec/protocol/v1/schema/files.taskStatus.json +29 -0
  130. package/spec/protocol/v1/schema/files.write.json +46 -0
  131. package/spec/protocol/v1/schema/root.run.json +19 -0
  132. package/spec/protocol/v1/schema/status.json +11 -0
  133. package/spec/protocol/v1/vectors/delegate.jsonl +16 -0
  134. package/spec/protocol/v1/vectors/envelope.jsonl +11 -0
  135. package/spec/protocol/v1/vectors/files.jsonl +10 -0
  136. package/spec/protocol/v1/vectors/status.jsonl +2 -0
package/dist/vue.js ADDED
@@ -0,0 +1,2324 @@
1
+ import { shellCopy as Oe, nasCopy as oe, nasErrorCopy as we, format as ve, saveCopy as Ce, saveError as be, createNasProvider as $e, identityCopy as qe, backgroundCopy as Re, createBackgroundPickerProvider as Le, backgroundErrorCopy as Be, requestKey as _e, delegateCopy as xe, errorCopy as Fe, scopedPicker as Ne, authorizationCopy as Me } from "./index.js";
2
+ import { activePage as yt, authorizationCatalogs as mt, backgroundCatalogs as bt, catalogs as kt, createBackgroundSaveFacade as _t, createFileTransfers as gt, decodeResponse as ht, delegateCatalogs as wt, encodeRequest as Ct, identityCatalogs as $t, nasCatalogs as xt, protocolCodes as St, protocolOps as zt, protocolSchemas as Vt, saveCatalogs as Ut, shellCatalogs as Pt, shellPages as Dt, uiLocale as At, uiLocales as Et } from "./index.js";
3
+ import { inject as He, ref as c, onBeforeUnmount as se, defineComponent as ae, computed as N, openBlock as t, createBlock as h, unref as e, withCtx as s, createVNode as b, renderSlot as ke, createElementVNode as g, onMounted as ie, createElementBlock as C, toDisplayString as l, createTextVNode as p, createCommentVNode as y, Fragment as j, renderList as te, watch as Se, withModifiers as ce, onUnmounted as ze, nextTick as Ke, resolveDynamicComponent as Je } from "vue";
4
+ import { AppLayout as Xe, PageContent as Ge, PageHeader as Qe, AppSidebar as We, Button as z, FilePicker as Ye, Callout as Q, TreeView as Ze, DataGrid as je, Dialog as Ve, SettingsSection as de, Link as Ue, Form as pe, FormItem as ne, Input as re, FormActions as fe, Select as Pe, Checkbox as ea, Surface as aa } from "@synopackageland/ui";
5
+ import { Timer as la, Info as ta, Folder as ge, File as na, TriangleAlert as sa, ShieldCheck as he } from "@lucide/vue";
6
+ const ua = /* @__PURE__ */ Symbol("executor-setup");
7
+ function ia() {
8
+ return He(ua, {
9
+ async status() {
10
+ return { state: "blocked", reason: "setup-unavailable" };
11
+ },
12
+ async authorize() {
13
+ throw { code: "setup-unavailable" };
14
+ },
15
+ async control() {
16
+ throw { code: "setup-unavailable" };
17
+ }
18
+ });
19
+ }
20
+ function tt(f) {
21
+ const P = c(!1), a = c(!1), $ = c(), u = c("");
22
+ let r = !1, n = 0, i, o;
23
+ function w() {
24
+ clearTimeout(i), clearTimeout(o);
25
+ }
26
+ function d(V = "") {
27
+ n++, w(), $.value = void 0, u.value = V;
28
+ }
29
+ function k(V) {
30
+ if (r) return;
31
+ const R = Date.parse(V.expiresAt) - Date.now();
32
+ if (!Number.isFinite(R) || R <= 0) {
33
+ d("expired");
34
+ return;
35
+ }
36
+ w(), $.value = V, u.value = "", i = setTimeout(() => d("expired"), R);
37
+ const W = n;
38
+ o = setTimeout(async () => {
39
+ try {
40
+ const X = await f.call("identity.session");
41
+ !r && n === W && k(X);
42
+ } catch {
43
+ !r && n === W && d("expired");
44
+ }
45
+ }, Math.min(6e4, R));
46
+ }
47
+ async function E() {
48
+ try {
49
+ const V = await f.call("identity.status");
50
+ if (r) return;
51
+ if (P.value = V.enabled === !0, P.value)
52
+ try {
53
+ k(await f.call("identity.session", { bootstrap: !0 }));
54
+ } catch {
55
+ r || d();
56
+ }
57
+ } catch (V) {
58
+ const R = V?.code;
59
+ P.value = !["unknown_method", "admin_required", "app_privilege_denied", "session_required"].includes(R || ""), P.value && (u.value = "unavailable");
60
+ } finally {
61
+ r || (a.value = !0);
62
+ }
63
+ }
64
+ async function m(V, R) {
65
+ const W = n;
66
+ try {
67
+ const X = await f.call(V, R);
68
+ if (r || P.value && W !== n) throw { code: "session_required" };
69
+ return X;
70
+ } catch (X) {
71
+ const F = X?.code;
72
+ throw !r && W === n && P.value && ["session_required", "session_revalidation_required"].includes(F || "") && d(F === "session_revalidation_required" ? "revalidate" : "expired"), X;
73
+ }
74
+ }
75
+ async function U(V, R, W) {
76
+ const X = await f.call("identity.login", { account: V, password: R, otp: W });
77
+ r || (n++, k(X));
78
+ }
79
+ async function S() {
80
+ const V = await f.call("identity.session", { bootstrap: !0 });
81
+ r || (n++, k(V));
82
+ }
83
+ async function A() {
84
+ await f.call("identity.logout"), r || d();
85
+ }
86
+ function H() {
87
+ r = !0, d();
88
+ }
89
+ return { enabled: P, ready: a, subject: $, notice: u, start: E, call: m, login: U, bootstrap: S, logout: A, dispose: H };
90
+ }
91
+ function oa() {
92
+ const f = c(!1), P = c();
93
+ let a = !1, $ = 0, u;
94
+ function r() {
95
+ $++, u?.abort(), u = void 0, f.value = !1, P.value = void 0;
96
+ }
97
+ async function n(i) {
98
+ if (a || f.value) return;
99
+ const o = ++$, w = new AbortController();
100
+ u = w, f.value = !0, P.value = void 0;
101
+ try {
102
+ const d = await i(w.signal);
103
+ return !a && o === $ ? d : void 0;
104
+ } catch (d) {
105
+ !a && o === $ && (P.value = d);
106
+ return;
107
+ } finally {
108
+ !a && o === $ && (f.value = !1, u = void 0);
109
+ }
110
+ }
111
+ return se(() => {
112
+ a = !0, r();
113
+ }), { busy: f, error: P, run: n, cancel: r };
114
+ }
115
+ const ra = { class: "app-page-content" }, da = /* @__PURE__ */ ae({
116
+ __name: "AppShell",
117
+ props: {
118
+ locale: {},
119
+ modelValue: {},
120
+ pages: {},
121
+ description: {}
122
+ },
123
+ emits: ["update:modelValue"],
124
+ setup(f, { emit: P }) {
125
+ const a = f, $ = P, u = N(() => Oe(a.locale)), r = { status: ta, background: la }, n = N(() => [{
126
+ items: a.pages.map((o) => ({ key: o, label: u.value[o], icon: r[o] }))
127
+ }]), i = N(() => u.value[a.modelValue] ?? u.value.status);
128
+ return (o, w) => (t(), h(e(Xe), {
129
+ class: "app-shell",
130
+ "min-height": "0",
131
+ "wide-layout": "window"
132
+ }, {
133
+ sidebar: s(() => [
134
+ b(e(We), {
135
+ "model-value": f.modelValue,
136
+ groups: n.value,
137
+ "onUpdate:modelValue": w[0] || (w[0] = (d) => $("update:modelValue", d))
138
+ }, null, 8, ["model-value", "groups"])
139
+ ]),
140
+ default: s(() => [
141
+ b(e(Ge), { class: "app-page" }, {
142
+ default: s(() => [
143
+ b(e(Qe), {
144
+ title: i.value,
145
+ description: f.description
146
+ }, {
147
+ actions: s(() => [
148
+ ke(o.$slots, "actions", {}, void 0, !0)
149
+ ]),
150
+ _: 3
151
+ }, 8, ["title", "description"]),
152
+ g("div", ra, [
153
+ ke(o.$slots, "default", {}, void 0, !0)
154
+ ])
155
+ ]),
156
+ _: 3
157
+ })
158
+ ]),
159
+ _: 3
160
+ }));
161
+ }
162
+ }), ue = (f, P) => {
163
+ const a = f.__vccOpts || f;
164
+ for (const [$, u] of P)
165
+ a[$] = u;
166
+ return a;
167
+ }, nt = /* @__PURE__ */ ue(da, [["__scopeId", "data-v-05f63ca5"]]), va = ["aria-busy", "aria-label"], ca = ["aria-label"], pa = {
168
+ key: 0,
169
+ class: "file-toolbar"
170
+ }, fa = {
171
+ key: 1,
172
+ role: "status"
173
+ }, ya = { role: "alert" }, ma = {
174
+ key: 4,
175
+ role: "status"
176
+ }, ba = { class: "file-columns" }, ka = ["aria-label"], _a = { class: "file-content" }, ga = {
177
+ key: 1,
178
+ class: "file-name"
179
+ }, ha = { class: "file-bytes" }, wa = {
180
+ key: 5,
181
+ class: "file-selection",
182
+ role: "status"
183
+ }, Ca = /* @__PURE__ */ ae({
184
+ __name: "FileBrowser",
185
+ props: {
186
+ provider: {},
187
+ locale: {},
188
+ mode: { default: "file" },
189
+ transfers: { type: Boolean, default: !1 }
190
+ },
191
+ emits: ["selected"],
192
+ setup(f, { emit: P }) {
193
+ const a = f, $ = P, u = N(() => oe(a.locale)), r = oa(), { busy: n, error: i } = r, o = c([]), w = c([]), d = c([]), k = c(), E = c(), m = c([]), U = c(), S = c({ key: "name", direction: "asc" }), A = c(0), H = c([]), V = c(!1);
194
+ let R = new AbortController();
195
+ async function W() {
196
+ const v = k.value;
197
+ !v || v.isDir || !a.provider.download || await r.run(async (_) => (await a.provider.info(v.path, _), a.provider.download(v.path), !0));
198
+ }
199
+ async function X() {
200
+ const v = d.value.at(-1)?.path, _ = H.value[0];
201
+ if (!v || !_ || !a.provider.upload) return;
202
+ V.value = !1, await r.run(async (G) => (await a.provider.upload(v, _, G), !0)) && (H.value = [], await q(d.value), V.value = !0);
203
+ }
204
+ const F = N(() => [
205
+ { key: "name", label: u.value.nameColumn, sortable: !0 },
206
+ { key: "kind", label: u.value.kindColumn },
207
+ { key: "bytes", label: u.value.sizeColumn, align: "right", sortable: !0 },
208
+ { key: "selection", label: u.value.selectAction }
209
+ ]);
210
+ function L(v) {
211
+ return { id: v.path, label: v.name, icon: ge, data: v };
212
+ }
213
+ function J(v) {
214
+ k.value = v, $("selected", v?.path);
215
+ }
216
+ function K(v, _, x = []) {
217
+ for (const G of v) {
218
+ const Z = [...x, G.data];
219
+ if (G.id === _) return Z;
220
+ const ee = K(G.children ?? [], _, Z);
221
+ if (ee) return ee;
222
+ }
223
+ }
224
+ async function Y(v) {
225
+ const _ = A.value, x = R.signal;
226
+ try {
227
+ const G = [];
228
+ let Z = 0;
229
+ for (; Z !== void 0; ) {
230
+ const ee = await a.provider.list(v.id, { offset: Z, sortBy: "name", sortDirection: "ASC" }, x);
231
+ if (x.aborted || _ !== A.value) return;
232
+ G.push(...ee.entries.filter((me) => me.isDir).map(L)), Z = ee.nextOffset;
233
+ }
234
+ return G;
235
+ } catch (G) {
236
+ !x.aborted && _ === A.value && (i.value = G, J());
237
+ return;
238
+ }
239
+ }
240
+ async function q(v, _ = !1) {
241
+ if (n.value) return;
242
+ J(), o.value = _ ? o.value : [], E.value = _ ? E.value : void 0;
243
+ const x = _ ? E.value ?? 0 : 0, G = v.at(-1)?.path;
244
+ d.value = v;
245
+ const Z = await r.run((ee) => G ? a.provider.list(G, { offset: x, sortBy: S.value.key, sortDirection: S.value.direction === "asc" ? "ASC" : "DESC" }, ee) : a.provider.shares(x, ee));
246
+ Z && (o.value = _ ? [...o.value, ...Z.entries] : Z.entries, E.value = Z.nextOffset, G || (w.value = o.value.filter((ee) => ee.isDir).map(L)));
247
+ }
248
+ function O(v) {
249
+ q([...d.value, v]);
250
+ }
251
+ function T(v) {
252
+ S.value = { key: v?.key === "bytes" ? "size" : "name", direction: v?.direction ?? "asc" }, q(d.value);
253
+ }
254
+ function M() {
255
+ n.value || (A.value++, R.abort(), R = new AbortController(), w.value = [], m.value = [], U.value = void 0, q([]));
256
+ }
257
+ return ie(() => {
258
+ q([]);
259
+ }), se(() => {
260
+ A.value++, R.abort();
261
+ }), (v, _) => (t(), C("section", {
262
+ class: "file-browser",
263
+ "aria-busy": e(n),
264
+ "aria-label": u.value.title
265
+ }, [
266
+ g("p", null, l(u.value.ownPermissions), 1),
267
+ g("nav", {
268
+ class: "file-toolbar",
269
+ "aria-label": u.value.directoryKind
270
+ }, [
271
+ b(e(z), {
272
+ variant: "secondary",
273
+ disabled: e(n),
274
+ onClick: M
275
+ }, {
276
+ default: s(() => [
277
+ p(l(u.value.refresh), 1)
278
+ ]),
279
+ _: 1
280
+ }, 8, ["disabled"]),
281
+ d.value.length ? (t(), h(e(z), {
282
+ key: 0,
283
+ variant: "secondary",
284
+ disabled: e(n),
285
+ onClick: _[0] || (_[0] = (x) => q(d.value.slice(0, -1)))
286
+ }, {
287
+ default: s(() => [
288
+ p(l(u.value.back), 1)
289
+ ]),
290
+ _: 1
291
+ }, 8, ["disabled"])) : y("", !0),
292
+ b(e(z), {
293
+ variant: "secondary",
294
+ disabled: e(n),
295
+ onClick: _[1] || (_[1] = (x) => q([]))
296
+ }, {
297
+ default: s(() => [
298
+ p(l(u.value.roots), 1)
299
+ ]),
300
+ _: 1
301
+ }, 8, ["disabled"]),
302
+ (t(!0), C(j, null, te(d.value, (x, G) => (t(), h(e(z), {
303
+ key: x.path,
304
+ variant: "secondary",
305
+ disabled: e(n),
306
+ onClick: (Z) => q(d.value.slice(0, G + 1))
307
+ }, {
308
+ default: s(() => [
309
+ p(l(x.name), 1)
310
+ ]),
311
+ _: 2
312
+ }, 1032, ["disabled", "onClick"]))), 128))
313
+ ], 8, ca),
314
+ f.transfers && f.provider.upload && d.value.length ? (t(), C("div", pa, [
315
+ b(e(Ye), {
316
+ modelValue: H.value,
317
+ "onUpdate:modelValue": _[2] || (_[2] = (x) => H.value = x),
318
+ variant: "compact",
319
+ disabled: e(n),
320
+ "max-files": 1,
321
+ "max-size": 16 * 1024 ** 3,
322
+ title: u.value.upload,
323
+ onRejected: _[3] || (_[3] = (x) => i.value = { code: "upload_size_required" })
324
+ }, null, 8, ["modelValue", "disabled", "title"]),
325
+ b(e(z), {
326
+ variant: "primary",
327
+ disabled: e(n) || !H.value.length,
328
+ onClick: X
329
+ }, {
330
+ default: s(() => [
331
+ p(l(u.value.upload), 1)
332
+ ]),
333
+ _: 1
334
+ }, 8, ["disabled"])
335
+ ])) : y("", !0),
336
+ V.value ? (t(), C("p", fa, l(u.value.uploaded), 1)) : y("", !0),
337
+ f.transfers && f.provider.download && k.value && !k.value.isDir && !e(i) ? (t(), h(e(z), {
338
+ key: 2,
339
+ variant: "secondary",
340
+ disabled: e(n),
341
+ onClick: W
342
+ }, {
343
+ default: s(() => [
344
+ p(l(u.value.download), 1)
345
+ ]),
346
+ _: 1
347
+ }, 8, ["disabled"])) : y("", !0),
348
+ e(i) ? (t(), h(e(Q), {
349
+ key: 3,
350
+ tone: "danger"
351
+ }, {
352
+ default: s(() => [
353
+ g("span", ya, l(e(we)(e(i), u.value)), 1)
354
+ ]),
355
+ _: 1
356
+ })) : y("", !0),
357
+ e(n) ? (t(), C("p", ma, l(u.value.loading), 1)) : y("", !0),
358
+ g("div", ba, [
359
+ g("aside", {
360
+ class: "file-tree",
361
+ "aria-label": u.value.roots
362
+ }, [
363
+ w.value.length ? (t(), h(e(Ze), {
364
+ key: A.value,
365
+ modelValue: U.value,
366
+ "onUpdate:modelValue": _[4] || (_[4] = (x) => U.value = x),
367
+ nodes: w.value,
368
+ "onUpdate:nodes": _[5] || (_[5] = (x) => w.value = x),
369
+ expanded: m.value,
370
+ "onUpdate:expanded": _[6] || (_[6] = (x) => m.value = x),
371
+ "load-children": Y,
372
+ "expand-label": (x, G) => e(ve)(G ? u.value.collapse : u.value.expand, x.label),
373
+ onSelect: _[7] || (_[7] = (x) => q(K(w.value, x.id) ?? [x.data]))
374
+ }, null, 8, ["modelValue", "nodes", "expanded", "expand-label"])) : y("", !0)
375
+ ], 8, ka),
376
+ g("div", _a, [
377
+ e(i) ? y("", !0) : (t(), h(e(je), {
378
+ key: 0,
379
+ columns: F.value,
380
+ rows: o.value.map((x) => ({ ...x, kind: x.isDir ? u.value.directoryKind : u.value.fileKind })),
381
+ "row-key": "path",
382
+ footer: !1,
383
+ resizable: !1,
384
+ "local-sort": !1,
385
+ "local-pagination": !1,
386
+ loading: e(n),
387
+ "loading-text": u.value.loading,
388
+ sort: { key: S.value.key === "size" ? "bytes" : S.value.key, direction: S.value.direction },
389
+ labels: { empty: u.value.emptyFolder },
390
+ "onUpdate:sort": T
391
+ }, {
392
+ "cell-name": s(({ row: x }) => [
393
+ x.isDir ? (t(), h(e(z), {
394
+ key: 0,
395
+ variant: "secondary",
396
+ disabled: e(n),
397
+ "aria-label": e(ve)(u.value.open, String(x.name)),
398
+ onClick: (G) => O(o.value.find((Z) => Z.path === x.path))
399
+ }, {
400
+ default: s(() => [
401
+ b(e(ge), {
402
+ size: 16,
403
+ "aria-hidden": "true"
404
+ }),
405
+ p(l(x.name), 1)
406
+ ]),
407
+ _: 2
408
+ }, 1032, ["disabled", "aria-label", "onClick"])) : (t(), C("span", ga, [
409
+ b(e(na), {
410
+ size: 16,
411
+ "aria-hidden": "true"
412
+ }),
413
+ p(l(x.name), 1)
414
+ ]))
415
+ ]),
416
+ "cell-bytes": s(({ row: x }) => [
417
+ g("span", ha, l(x.isDir ? "—" : x.bytes ?? "—"), 1)
418
+ ]),
419
+ "cell-selection": s(({ row: x }) => [
420
+ (f.mode === "folder" ? x.isDir : !x.isDir) ? (t(), h(e(z), {
421
+ key: 0,
422
+ variant: "secondary",
423
+ disabled: e(n),
424
+ "aria-pressed": k.value?.path === x.path,
425
+ "aria-label": e(ve)(u.value.select, String(x.name)),
426
+ onClick: (G) => J(o.value.find((Z) => Z.path === x.path))
427
+ }, {
428
+ default: s(() => [
429
+ p(l(u.value.selectAction), 1)
430
+ ]),
431
+ _: 1
432
+ }, 8, ["disabled", "aria-pressed", "aria-label", "onClick"])) : y("", !0)
433
+ ]),
434
+ _: 1
435
+ }, 8, ["columns", "rows", "loading", "loading-text", "sort", "labels"])),
436
+ E.value !== void 0 && !e(i) ? (t(), h(e(z), {
437
+ key: 1,
438
+ variant: "secondary",
439
+ disabled: e(n),
440
+ onClick: _[8] || (_[8] = (x) => q(d.value, !0))
441
+ }, {
442
+ default: s(() => [
443
+ p(l(u.value.loadMore), 1)
444
+ ]),
445
+ _: 1
446
+ }, 8, ["disabled"])) : y("", !0),
447
+ f.mode === "folder" && d.value.length && !e(i) ? (t(), h(e(z), {
448
+ key: 2,
449
+ variant: "secondary",
450
+ disabled: e(n),
451
+ onClick: _[9] || (_[9] = (x) => J(d.value.at(-1)))
452
+ }, {
453
+ default: s(() => [
454
+ p(l(e(ve)(u.value.select, d.value.at(-1).name)), 1)
455
+ ]),
456
+ _: 1
457
+ }, 8, ["disabled"])) : y("", !0)
458
+ ])
459
+ ]),
460
+ k.value && !e(i) ? (t(), C("p", wa, l(e(ve)(u.value.selected, k.value.path)), 1)) : y("", !0)
461
+ ], 8, va));
462
+ }
463
+ }), De = /* @__PURE__ */ ue(Ca, [["__scopeId", "data-v-f1aee828"]]), $a = {
464
+ key: 0,
465
+ class: "save-consent"
466
+ }, xa = ["aria-busy", "inert"], Sa = /* @__PURE__ */ ae({
467
+ __name: "NasPicker",
468
+ props: {
469
+ open: { type: Boolean },
470
+ locale: {},
471
+ provider: {},
472
+ mode: {},
473
+ title: {},
474
+ description: {},
475
+ destination: {}
476
+ },
477
+ emits: ["update:open", "selected", "authorized"],
478
+ setup(f, { emit: P }) {
479
+ const a = f, $ = P, u = c(), r = N(() => oe(a.locale)), n = N(() => Ce(a.locale)), i = c(!1), o = c();
480
+ let w = 0, d = !1;
481
+ Se(() => a.open, () => {
482
+ w++, u.value = void 0, o.value = void 0;
483
+ }), se(() => {
484
+ d = !0, w++;
485
+ });
486
+ function k() {
487
+ i.value || (u.value = void 0, $("update:open", !1));
488
+ }
489
+ async function E() {
490
+ const m = u.value, U = a.destination, S = w;
491
+ if (!(!m || i.value || !a.open || d || U && a.mode !== "folder")) {
492
+ if (!U) {
493
+ $("selected", m), k();
494
+ return;
495
+ }
496
+ i.value = !0, o.value = void 0;
497
+ try {
498
+ const A = await U.selectDestination({ key: U.key, path: m });
499
+ if (d || S !== w) return;
500
+ if (!A || typeof A.id != "string" || !A.id || typeof A.username != "string" || !A.username || A.path !== m || A.key !== U.key || A.lifetime !== "until-revoked") throw { code: "commit-uncertain" };
501
+ $("authorized", A), i.value = !1, k();
502
+ } catch (A) {
503
+ !d && S === w && (o.value = A);
504
+ } finally {
505
+ d || (i.value = !1);
506
+ }
507
+ }
508
+ }
509
+ return (m, U) => (t(), h(e(Ve), {
510
+ open: f.open,
511
+ title: f.title ?? (f.mode === "folder" ? r.value.choose : r.value.chooseFile),
512
+ description: f.description ?? r.value.ownPermissions,
513
+ "close-label": r.value.close,
514
+ "show-close": !i.value,
515
+ width: "800px",
516
+ onEscapeKeyDown: U[1] || (U[1] = (S) => {
517
+ i.value && S.preventDefault();
518
+ }),
519
+ onInteractOutside: U[2] || (U[2] = (S) => {
520
+ i.value && S.preventDefault();
521
+ }),
522
+ "onUpdate:open": U[3] || (U[3] = (S) => {
523
+ S || k();
524
+ })
525
+ }, {
526
+ footer: s(() => [
527
+ b(e(z), {
528
+ variant: "secondary",
529
+ disabled: i.value,
530
+ onClick: k
531
+ }, {
532
+ default: s(() => [
533
+ p(l(r.value.cancel), 1)
534
+ ]),
535
+ _: 1
536
+ }, 8, ["disabled"]),
537
+ b(e(z), {
538
+ variant: "primary",
539
+ disabled: !u.value || i.value || !!f.destination && f.mode !== "folder",
540
+ onClick: E
541
+ }, {
542
+ default: s(() => [
543
+ p(l(r.value.confirm), 1)
544
+ ]),
545
+ _: 1
546
+ }, 8, ["disabled"])
547
+ ]),
548
+ default: s(() => [
549
+ f.destination ? (t(), C("p", $a, l(n.value.selection), 1)) : y("", !0),
550
+ o.value ? (t(), h(e(Q), {
551
+ key: 1,
552
+ tone: "danger",
553
+ role: "alert",
554
+ class: "save-message"
555
+ }, {
556
+ default: s(() => [
557
+ p(l(e(be)(o.value, n.value)), 1)
558
+ ]),
559
+ _: 1
560
+ })) : y("", !0),
561
+ g("div", {
562
+ class: "nas-picker-content",
563
+ "aria-busy": i.value,
564
+ inert: i.value
565
+ }, [
566
+ f.open ? (t(), h(De, {
567
+ key: 0,
568
+ provider: f.provider,
569
+ locale: f.locale,
570
+ mode: f.mode,
571
+ onSelected: U[0] || (U[0] = (S) => u.value = S)
572
+ }, null, 8, ["provider", "locale", "mode"])) : y("", !0)
573
+ ], 8, xa)
574
+ ]),
575
+ _: 1
576
+ }, 8, ["open", "title", "description", "close-label", "show-close"]));
577
+ }
578
+ }), ye = /* @__PURE__ */ ue(Sa, [["__scopeId", "data-v-535a0e54"]]), za = { role: "alert" }, Va = { class: "files-actions" }, Ua = {
579
+ key: 0,
580
+ class: "files-path",
581
+ role: "status"
582
+ }, Pa = /* @__PURE__ */ ae({
583
+ __name: "FilesPage",
584
+ props: {
585
+ ctx: {}
586
+ },
587
+ setup(f) {
588
+ const P = f, a = c(), $ = c(!1), u = c("folder"), r = c(!1), n = c(""), i = c(0), o = $e(P.ctx);
589
+ let w = !1, d;
590
+ async function k() {
591
+ if (!w) {
592
+ a.value = void 0, $.value = !1, n.value = "", r.value = !1, i.value++;
593
+ try {
594
+ await P.ctx.call("nas.session.status"), w || ($.value = !0);
595
+ } catch (E) {
596
+ !w && E?.code !== "unknown_method" && (a.value = E);
597
+ }
598
+ }
599
+ }
600
+ return ie(() => {
601
+ d = P.ctx.reopen(() => {
602
+ k();
603
+ }), k();
604
+ }), se(() => {
605
+ w = !0, d?.(), o.dispose();
606
+ }), (E, m) => (t(), C(j, null, [
607
+ a.value ? (t(), h(e(Q), {
608
+ key: 0,
609
+ tone: "danger"
610
+ }, {
611
+ default: s(() => [
612
+ g("span", za, l(e(we)(a.value, e(oe)(f.ctx.locale))), 1),
613
+ b(e(z), {
614
+ variant: "secondary",
615
+ onClick: k
616
+ }, {
617
+ default: s(() => [
618
+ p(l(e(oe)(f.ctx.locale).refresh), 1)
619
+ ]),
620
+ _: 1
621
+ })
622
+ ]),
623
+ _: 1
624
+ })) : y("", !0),
625
+ $.value ? (t(), h(e(de), {
626
+ key: 1,
627
+ title: e(oe)(f.ctx.locale).title,
628
+ collapsible: !1
629
+ }, {
630
+ default: s(() => [
631
+ g("div", Va, [
632
+ b(e(z), {
633
+ variant: "secondary",
634
+ onClick: m[0] || (m[0] = (U) => {
635
+ u.value = "folder", r.value = !0;
636
+ })
637
+ }, {
638
+ default: s(() => [
639
+ p(l(e(oe)(f.ctx.locale).choose), 1)
640
+ ]),
641
+ _: 1
642
+ }),
643
+ b(e(z), {
644
+ variant: "secondary",
645
+ onClick: m[1] || (m[1] = (U) => {
646
+ u.value = "file", r.value = !0;
647
+ })
648
+ }, {
649
+ default: s(() => [
650
+ p(l(e(oe)(f.ctx.locale).chooseFile), 1)
651
+ ]),
652
+ _: 1
653
+ })
654
+ ]),
655
+ n.value ? (t(), C("p", Ua, l(n.value), 1)) : y("", !0),
656
+ (t(), h(De, {
657
+ key: i.value,
658
+ provider: e(o),
659
+ locale: f.ctx.locale,
660
+ transfers: ""
661
+ }, null, 8, ["provider", "locale"])),
662
+ b(ye, {
663
+ provider: e(o),
664
+ locale: f.ctx.locale,
665
+ mode: u.value,
666
+ open: r.value,
667
+ "onUpdate:open": m[2] || (m[2] = (U) => r.value = U),
668
+ onSelected: m[3] || (m[3] = (U) => n.value = U)
669
+ }, null, 8, ["provider", "locale", "mode", "open"])
670
+ ]),
671
+ _: 1
672
+ }, 8, ["title"])) : y("", !0)
673
+ ], 64));
674
+ }
675
+ }), st = /* @__PURE__ */ ue(Pa, [["__scopeId", "data-v-97bc5d15"]]), Da = { key: 0 }, Aa = { key: 0 }, Ea = { key: 3 }, Ta = { role: "alert" }, ut = /* @__PURE__ */ ae({
676
+ __name: "PortalSettings",
677
+ props: {
678
+ portal: {}
679
+ },
680
+ setup(f) {
681
+ const P = f, a = P.portal.messages, $ = c(), u = c(""), r = c(!1), n = c("");
682
+ let i = !1;
683
+ function o(d) {
684
+ i || ($.value = d, u.value = d.alias || d.defaultAlias);
685
+ }
686
+ async function w(d) {
687
+ if (!r.value) {
688
+ r.value = !0, n.value = "";
689
+ try {
690
+ o(await d());
691
+ } catch (k) {
692
+ i || (n.value = a[k?.code || ""] || a.portal_unavailable);
693
+ } finally {
694
+ i || (r.value = !1);
695
+ }
696
+ }
697
+ }
698
+ return ie(() => {
699
+ P.portal.status().then(o);
700
+ }), se(() => {
701
+ i = !0;
702
+ }), (d, k) => $.value ? (t(), h(e(de), {
703
+ key: 0,
704
+ title: e(a).title,
705
+ collapsible: !1,
706
+ "aria-busy": r.value
707
+ }, {
708
+ default: s(() => [
709
+ $.value.state === "active" ? (t(), C("p", Da, [
710
+ p(l(e(a).link) + " ", 1),
711
+ b(e(Ue), {
712
+ href: $.value.url,
713
+ external: ""
714
+ }, {
715
+ default: s(() => [
716
+ p(l($.value.url), 1)
717
+ ]),
718
+ _: 1
719
+ }, 8, ["href"])
720
+ ])) : y("", !0),
721
+ $.value.canManage ? (t(), C(j, { key: 1 }, [
722
+ $.value.state !== "active" ? (t(), C("p", Aa, l(e(a).inactive), 1)) : y("", !0),
723
+ b(e(pe), {
724
+ onSubmit: k[2] || (k[2] = ce((E) => w(() => f.portal.apply(u.value)), ["prevent"]))
725
+ }, {
726
+ default: s(() => [
727
+ b(e(ne), {
728
+ label: e(a).alias,
729
+ "label-for": "portal-alias"
730
+ }, {
731
+ default: s(() => [
732
+ b(e(re), {
733
+ id: "portal-alias",
734
+ modelValue: u.value,
735
+ "onUpdate:modelValue": k[0] || (k[0] = (E) => u.value = E),
736
+ maxlength: "64",
737
+ autocomplete: "off",
738
+ disabled: r.value
739
+ }, null, 8, ["modelValue", "disabled"])
740
+ ]),
741
+ _: 1
742
+ }, 8, ["label"]),
743
+ b(e(fe), null, {
744
+ default: s(() => [
745
+ b(e(z), {
746
+ type: "submit",
747
+ variant: "primary",
748
+ disabled: r.value
749
+ }, {
750
+ default: s(() => [
751
+ p(l(e(a).apply), 1)
752
+ ]),
753
+ _: 1
754
+ }, 8, ["disabled"]),
755
+ $.value.state === "active" ? (t(), h(e(z), {
756
+ key: 0,
757
+ variant: "secondary",
758
+ disabled: r.value,
759
+ onClick: k[1] || (k[1] = (E) => w(() => f.portal.disable()))
760
+ }, {
761
+ default: s(() => [
762
+ p(l(e(a).disable), 1)
763
+ ]),
764
+ _: 1
765
+ }, 8, ["disabled"])) : y("", !0)
766
+ ]),
767
+ _: 1
768
+ })
769
+ ]),
770
+ _: 1
771
+ }),
772
+ b(e(z), {
773
+ variant: "secondary",
774
+ onClick: k[3] || (k[3] = (E) => f.portal.openControlPanel())
775
+ }, {
776
+ default: s(() => [
777
+ p(l(e(a).advanced), 1)
778
+ ]),
779
+ _: 1
780
+ })
781
+ ], 64)) : $.value.controlPanel ? (t(), h(e(z), {
782
+ key: 2,
783
+ variant: "secondary",
784
+ onClick: k[4] || (k[4] = (E) => f.portal.openControlPanel())
785
+ }, {
786
+ default: s(() => [
787
+ p(l(e(a).controlPanel), 1)
788
+ ]),
789
+ _: 1
790
+ })) : $.value.state !== "active" ? (t(), C("p", Ea, l(e(a).askAdmin), 1)) : y("", !0),
791
+ n.value ? (t(), h(e(Q), {
792
+ key: 4,
793
+ tone: "danger"
794
+ }, {
795
+ default: s(() => [
796
+ g("span", Ta, l(n.value), 1)
797
+ ]),
798
+ _: 1
799
+ })) : y("", !0)
800
+ ]),
801
+ _: 1
802
+ }, 8, ["title", "aria-busy"])) : y("", !0);
803
+ }
804
+ }), Ia = ["aria-busy"], Oa = {
805
+ key: 1,
806
+ role: "status"
807
+ }, qa = { role: "alert" }, Ra = { role: "status" }, La = /* @__PURE__ */ ae({
808
+ __name: "LoginPage",
809
+ props: {
810
+ session: {},
811
+ locale: {}
812
+ },
813
+ setup(f) {
814
+ const P = f, a = N(() => qe(P.locale)), $ = c(""), u = c(""), r = c(""), n = c(!1), i = c(!1), o = c(""), w = c(), d = N(() => window.location.protocol === "https:");
815
+ let k = !1;
816
+ function E(A) {
817
+ const H = A?.code;
818
+ return a.value.errors[H || ""] || a.value.errors.failed;
819
+ }
820
+ async function m() {
821
+ if (!(i.value || !d.value || !$.value || !u.value || n.value && !r.value)) {
822
+ i.value = !0, o.value = "";
823
+ try {
824
+ await P.session.login($.value, u.value, r.value), u.value = "", r.value = "";
825
+ } catch (A) {
826
+ if (k) return;
827
+ r.value = "", A?.code === "otp_required" ? n.value = !0 : (o.value = E(A), u.value = "", n.value = !1);
828
+ } finally {
829
+ k || (i.value = !1, n.value && (await Ke(), k || w.value?.querySelector("input")?.focus()));
830
+ }
831
+ }
832
+ }
833
+ async function U() {
834
+ if (!i.value) {
835
+ i.value = !0, o.value = "";
836
+ try {
837
+ await P.session.bootstrap();
838
+ } catch (A) {
839
+ k || (o.value = E(A));
840
+ } finally {
841
+ k || (i.value = !1);
842
+ }
843
+ }
844
+ }
845
+ function S() {
846
+ u.value = "", r.value = "", n.value = !1, o.value = "";
847
+ }
848
+ return ze(() => {
849
+ k = !0, u.value = "", r.value = "";
850
+ }), (A, H) => (t(), C("main", {
851
+ class: "identity-login",
852
+ "aria-busy": i.value
853
+ }, [
854
+ b(e(de), {
855
+ title: a.value.title,
856
+ collapsible: !1
857
+ }, {
858
+ default: s(() => [
859
+ g("p", null, l(a.value.intro), 1),
860
+ d.value ? y("", !0) : (t(), h(e(Q), {
861
+ key: 0,
862
+ tone: "warning",
863
+ title: a.value.httpsTitle
864
+ }, {
865
+ default: s(() => [
866
+ p(l(a.value.errors.https_required), 1)
867
+ ]),
868
+ _: 1
869
+ }, 8, ["title"])),
870
+ f.session.notice.value ? (t(), C("p", Oa, l(a.value.notices[f.session.notice.value]), 1)) : y("", !0),
871
+ o.value ? (t(), h(e(Q), {
872
+ key: 2,
873
+ tone: "danger",
874
+ title: a.value.failedTitle
875
+ }, {
876
+ default: s(() => [
877
+ g("span", qa, l(o.value), 1)
878
+ ]),
879
+ _: 1
880
+ }, 8, ["title"])) : y("", !0),
881
+ b(e(pe), {
882
+ onSubmit: ce(m, ["prevent"])
883
+ }, {
884
+ default: s(() => [
885
+ b(e(ne), {
886
+ label: a.value.account
887
+ }, {
888
+ default: s(() => [
889
+ b(e(re), {
890
+ modelValue: $.value,
891
+ "onUpdate:modelValue": H[0] || (H[0] = (V) => $.value = V),
892
+ autocomplete: "username",
893
+ disabled: i.value || n.value || !d.value
894
+ }, null, 8, ["modelValue", "disabled"])
895
+ ]),
896
+ _: 1
897
+ }, 8, ["label"]),
898
+ n.value ? (t(), C(j, { key: 1 }, [
899
+ g("p", Ra, l(a.value.otpPrompt), 1),
900
+ g("div", {
901
+ ref_key: "otpField",
902
+ ref: w
903
+ }, [
904
+ b(e(ne), {
905
+ label: a.value.otp
906
+ }, {
907
+ default: s(() => [
908
+ b(e(re), {
909
+ modelValue: r.value,
910
+ "onUpdate:modelValue": H[2] || (H[2] = (V) => r.value = V),
911
+ inputmode: "numeric",
912
+ autocomplete: "one-time-code",
913
+ disabled: i.value
914
+ }, null, 8, ["modelValue", "disabled"])
915
+ ]),
916
+ _: 1
917
+ }, 8, ["label"])
918
+ ], 512)
919
+ ], 64)) : (t(), h(e(ne), {
920
+ key: 0,
921
+ label: a.value.password
922
+ }, {
923
+ default: s(() => [
924
+ b(e(re), {
925
+ modelValue: u.value,
926
+ "onUpdate:modelValue": H[1] || (H[1] = (V) => u.value = V),
927
+ type: "password",
928
+ autocomplete: "current-password",
929
+ disabled: i.value || !d.value
930
+ }, null, 8, ["modelValue", "disabled"])
931
+ ]),
932
+ _: 1
933
+ }, 8, ["label"])),
934
+ b(e(fe), null, {
935
+ default: s(() => [
936
+ b(e(z), {
937
+ type: "submit",
938
+ variant: "primary",
939
+ disabled: i.value || !d.value || !$.value || !u.value || n.value && !r.value
940
+ }, {
941
+ default: s(() => [
942
+ p(l(i.value ? a.value.signingIn : n.value ? a.value.verify : a.value.signIn), 1)
943
+ ]),
944
+ _: 1
945
+ }, 8, ["disabled"]),
946
+ n.value ? (t(), h(e(z), {
947
+ key: 0,
948
+ variant: "secondary",
949
+ disabled: i.value,
950
+ onClick: S
951
+ }, {
952
+ default: s(() => [
953
+ p(l(a.value.otherAccount), 1)
954
+ ]),
955
+ _: 1
956
+ }, 8, ["disabled"])) : (t(), h(e(z), {
957
+ key: 1,
958
+ variant: "secondary",
959
+ disabled: i.value || !d.value,
960
+ onClick: U
961
+ }, {
962
+ default: s(() => [
963
+ p(l(a.value.continueDSM), 1)
964
+ ]),
965
+ _: 1
966
+ }, 8, ["disabled"]))
967
+ ]),
968
+ _: 1
969
+ })
970
+ ]),
971
+ _: 1
972
+ })
973
+ ]),
974
+ _: 1
975
+ }, 8, ["title"])
976
+ ], 8, Ia));
977
+ }
978
+ }), it = /* @__PURE__ */ ue(La, [["__scopeId", "data-v-f7afcf5e"]]), Ba = { class: "integration-help" }, Fa = { role: "status" }, Na = { class: "integration-help" }, Ma = { class: "integration-help" }, Ha = { class: "integration-help" }, Ka = { class: "integration-actions" }, Ja = { class: "integration-actions" }, Xa = {
979
+ key: 0,
980
+ role: "status",
981
+ "data-bg-picked": ""
982
+ }, Ga = { class: "integration-actions" }, Qa = { key: 1 }, Wa = {
983
+ key: 2,
984
+ class: "integration-jobs"
985
+ }, Ya = ["data-job-state", "data-job-id"], Za = { class: "nas-folder-name" }, ja = {
986
+ key: 0,
987
+ class: "integration-help"
988
+ }, el = {
989
+ key: 4,
990
+ class: "integration-help"
991
+ }, al = ["aria-label"], ll = { class: "integration-help" }, tl = { key: 1 }, nl = {
992
+ key: 2,
993
+ class: "integration-jobs"
994
+ }, sl = ["data-schedule-id"], ul = { class: "nas-folder-name" }, il = {
995
+ key: 0,
996
+ class: "integration-help"
997
+ }, ol = {
998
+ key: 1,
999
+ class: "integration-help"
1000
+ }, rl = { class: "integration-help" }, dl = { class: "integration-actions" }, vl = { class: "integration-actions" }, cl = { class: "integration-actions" }, pl = /* @__PURE__ */ ae({
1001
+ __name: "BackgroundPanel",
1002
+ props: {
1003
+ ctx: {}
1004
+ },
1005
+ setup(f) {
1006
+ const P = f, a = N(() => Re(P.ctx.locale)), $ = (I, B) => I.replace(/\{(\w+)\}/g, (D, le) => String(B[le] ?? "")), u = c(), r = c([]), n = c(), i = c(!1), o = c(!1), w = c([]), d = c(), k = c(!1), E = c("3600"), m = c(), U = c(), S = c(), A = c(!1), H = c(!1), V = c(), R = c(""), W = c(""), X = Le(P.ctx);
1007
+ let F, L = !1;
1008
+ const J = (I) => !["queued", "running"].includes(I.state);
1009
+ async function K(I, B) {
1010
+ try {
1011
+ return await P.ctx.call(I, B);
1012
+ } catch (D) {
1013
+ if (L) return;
1014
+ D?.code === "unsupported" ? (i.value = !0, r.value = [], w.value = [], d.value = void 0, m.value = void 0, U.value = void 0, u.value = void 0, S.value = void 0, V.value = void 0, R.value && URL.revokeObjectURL(R.value), R.value = "") : L || (n.value = D);
1015
+ return;
1016
+ }
1017
+ }
1018
+ async function Y() {
1019
+ if (!(L || A.value)) {
1020
+ A.value = !0;
1021
+ try {
1022
+ const I = await K("bg.status");
1023
+ if (!I || L) return;
1024
+ if (!I.limits || typeof I.admin != "boolean") {
1025
+ n.value = { code: "unavailable" };
1026
+ return;
1027
+ }
1028
+ i.value = !1, u.value = I;
1029
+ const B = await K("bg.jobs.list");
1030
+ B && !L && (r.value = B.jobs ?? []);
1031
+ const D = await K("bg.schedules.list");
1032
+ D && !L && (w.value = D.schedules ?? []), !L && r.value.every(J) && w.value.every((le) => !le.enabled) && F && (clearInterval(F), F = void 0);
1033
+ } finally {
1034
+ A.value = !1;
1035
+ }
1036
+ }
1037
+ }
1038
+ function q() {
1039
+ F || (F = setInterval(() => {
1040
+ Y();
1041
+ }, 3e3));
1042
+ }
1043
+ async function O(I) {
1044
+ if (!o.value) {
1045
+ o.value = !0, n.value = void 0;
1046
+ try {
1047
+ await I(), await Y(), (w.value.some((B) => B.enabled) || r.value.some((B) => !J(B))) && q();
1048
+ } finally {
1049
+ L || (o.value = !1);
1050
+ }
1051
+ }
1052
+ }
1053
+ const T = () => O(async () => {
1054
+ if (!S.value) return;
1055
+ await K("bg.jobs.purge", { owner: S.value }) && (S.value = void 0);
1056
+ }), M = N(() => [{ value: "3600", label: a.value.hourly }, { value: "86400", label: a.value.daily }, { value: "604800", label: a.value.weekly }]), v = (I) => {
1057
+ d.value = I, k.value = !1, E.value = "3600";
1058
+ }, _ = () => O(async () => {
1059
+ if (!d.value || !k.value) return;
1060
+ await K("bg.schedules.create", { key: _e(), jobId: d.value.id, intervalSeconds: Number(E.value), consent: !0 }) && (d.value = void 0);
1061
+ }), x = (I) => O(() => K("bg.schedules.disable", { id: I })), G = () => O(async () => {
1062
+ if (!m.value) return;
1063
+ await K("bg.schedules.delete", { id: m.value.id }) && (m.value = void 0);
1064
+ }), Z = () => O(async () => {
1065
+ if (!U.value) return;
1066
+ await K("bg.schedules.enable", { id: U.value.id, consent: !0 }) && (U.value = void 0);
1067
+ }), ee = (I) => {
1068
+ const B = new Date(I);
1069
+ return Number.isFinite(B.getTime()) ? B.toLocaleString() : a.value.unknownTime;
1070
+ }, me = (I) => I.copyRetained && I.state === "succeeded" && !I.scheduleId && I.submitter?.user === u.value?.owner?.user && I.submitter?.uid === u.value?.owner?.uid, Ae = (I) => O(() => K("bg.jobs.cancel", { id: I })), Ee = (I) => {
1071
+ const B = I.lastIndexOf("/");
1072
+ V.value = { folder: I.slice(0, B), relative: I.slice(B + 1) };
1073
+ }, Te = () => O(async () => {
1074
+ if (!V.value) return;
1075
+ await K("bg.jobs.submit", { key: _e(), ...V.value }) && (V.value = void 0);
1076
+ });
1077
+ async function Ie(I) {
1078
+ const B = await K("bg.jobs.result", { id: I.id });
1079
+ !B || L || (R.value && URL.revokeObjectURL(R.value), R.value = URL.createObjectURL(new Blob([JSON.stringify(B.result, null, 2)], { type: "application/json" })), W.value = `${I.name || I.id}.sha256.json`);
1080
+ }
1081
+ return ie(() => {
1082
+ Y().then(() => {
1083
+ (w.value.some((I) => I.enabled) || r.value.some((I) => !J(I))) && q();
1084
+ });
1085
+ }), se(() => {
1086
+ L = !0, X.dispose(), F && clearInterval(F), R.value && URL.revokeObjectURL(R.value);
1087
+ }), (I, B) => (t(), h(e(de), {
1088
+ "aria-busy": o.value || A.value,
1089
+ title: a.value.title,
1090
+ collapsible: !1,
1091
+ "data-background-panel": ""
1092
+ }, {
1093
+ default: s(() => [
1094
+ i.value ? (t(), h(e(Q), {
1095
+ key: 0,
1096
+ tone: "warning"
1097
+ }, {
1098
+ default: s(() => [
1099
+ p(l(a.value.unsupported), 1)
1100
+ ]),
1101
+ _: 1
1102
+ })) : (t(), C(j, { key: 1 }, [
1103
+ g("p", Ba, l(a.value.help), 1),
1104
+ n.value ? (t(), h(e(Q), {
1105
+ key: 0,
1106
+ tone: "danger",
1107
+ role: "alert"
1108
+ }, {
1109
+ default: s(() => [
1110
+ p(l(e(Be)(n.value, a.value)), 1)
1111
+ ]),
1112
+ _: 1
1113
+ })) : y("", !0),
1114
+ u.value ? (t(), C(j, { key: 1 }, [
1115
+ g("p", Fa, l(u.value.worker?.alive ? $(a.value.workerRunning, { user: u.value.worker.username }) : a.value.workerStopped), 1),
1116
+ g("p", Na, l($(a.value.limits, { size: u.value.limits.maxInputBytes / 1024, queue: u.value.limits.maxQueued, seconds: u.value.limits.jobTimeoutSeconds })), 1),
1117
+ g("p", Ma, l(u.value.admin ? a.value.adminScope : a.value.ownerScope), 1),
1118
+ g("p", Ha, l($(a.value.ownerLimits, { jobs: u.value.limits.maxOwnerPending, size: u.value.limits.maxOwnerBytes / 1024 })), 1),
1119
+ g("div", Ka, [
1120
+ b(e(z), {
1121
+ variant: "secondary",
1122
+ disabled: o.value,
1123
+ onClick: Y
1124
+ }, {
1125
+ default: s(() => [
1126
+ p(l(a.value.refresh), 1)
1127
+ ]),
1128
+ _: 1
1129
+ }, 8, ["disabled"])
1130
+ ]),
1131
+ g("template", null, [
1132
+ g("div", Ja, [
1133
+ b(e(z), {
1134
+ variant: "secondary",
1135
+ disabled: o.value,
1136
+ onClick: B[0] || (B[0] = (D) => H.value = !0)
1137
+ }, {
1138
+ default: s(() => [
1139
+ p(l(a.value.chooseFile), 1)
1140
+ ]),
1141
+ _: 1
1142
+ }, 8, ["disabled"]),
1143
+ b(e(z), {
1144
+ variant: "primary",
1145
+ disabled: o.value || !V.value,
1146
+ onClick: Te
1147
+ }, {
1148
+ default: s(() => [
1149
+ p(l(a.value.submit), 1)
1150
+ ]),
1151
+ _: 1
1152
+ }, 8, ["disabled"])
1153
+ ]),
1154
+ V.value ? (t(), C("p", Xa, l($(a.value.chosen, { path: `${V.value.folder}/${V.value.relative}` })), 1)) : y("", !0),
1155
+ b(ye, {
1156
+ open: H.value,
1157
+ "onUpdate:open": B[1] || (B[1] = (D) => H.value = D),
1158
+ locale: f.ctx.locale,
1159
+ provider: e(X),
1160
+ mode: "file",
1161
+ title: a.value.pickerTitle,
1162
+ description: a.value.pickerConsent,
1163
+ onSelected: Ee
1164
+ }, null, 8, ["open", "locale", "provider", "title", "description"])
1165
+ ]),
1166
+ S.value && u.value.admin ? (t(), h(e(Q), {
1167
+ key: 0,
1168
+ tone: "warning"
1169
+ }, {
1170
+ default: s(() => [
1171
+ g("p", null, l($(a.value.purgeConfirm, { user: S.value.user, uid: S.value.uid })), 1),
1172
+ g("div", Ga, [
1173
+ b(e(z), {
1174
+ variant: "secondary",
1175
+ disabled: o.value,
1176
+ onClick: T
1177
+ }, {
1178
+ default: s(() => [
1179
+ p(l(a.value.confirmPurge), 1)
1180
+ ]),
1181
+ _: 1
1182
+ }, 8, ["disabled"]),
1183
+ b(e(z), {
1184
+ variant: "secondary",
1185
+ disabled: o.value,
1186
+ onClick: B[2] || (B[2] = (D) => S.value = void 0)
1187
+ }, {
1188
+ default: s(() => [
1189
+ p(l(a.value.keepJobs), 1)
1190
+ ]),
1191
+ _: 1
1192
+ }, 8, ["disabled"])
1193
+ ])
1194
+ ]),
1195
+ _: 1
1196
+ })) : y("", !0),
1197
+ r.value.length ? (t(), C("ul", Wa, [
1198
+ (t(!0), C(j, null, te(r.value, (D) => (t(), C("li", {
1199
+ key: D.id,
1200
+ "data-job-state": D.state,
1201
+ "data-job-id": D.id
1202
+ }, [
1203
+ g("span", Za, l(D.name) + " — " + l(a.value[`state_${D.state}`]), 1),
1204
+ u.value.admin && D.submitter ? (t(), C("span", ja, l($(a.value.owner, { user: D.submitter.user, uid: D.submitter.uid })), 1)) : y("", !0),
1205
+ u.value.admin && D.submitter ? (t(), h(e(z), {
1206
+ key: 1,
1207
+ variant: "secondary",
1208
+ disabled: o.value,
1209
+ onClick: (le) => S.value = D.submitter
1210
+ }, {
1211
+ default: s(() => [
1212
+ p(l(a.value.purgeOwner), 1)
1213
+ ]),
1214
+ _: 1
1215
+ }, 8, ["disabled", "onClick"])) : y("", !0),
1216
+ J(D) ? y("", !0) : (t(), h(e(z), {
1217
+ key: 2,
1218
+ variant: "secondary",
1219
+ disabled: o.value,
1220
+ onClick: (le) => Ae(D.id)
1221
+ }, {
1222
+ default: s(() => [
1223
+ p(l(a.value.cancel), 1)
1224
+ ]),
1225
+ _: 1
1226
+ }, 8, ["disabled", "onClick"])),
1227
+ me(D) ? (t(), h(e(z), {
1228
+ key: 3,
1229
+ variant: "secondary",
1230
+ disabled: o.value,
1231
+ onClick: (le) => v(D)
1232
+ }, {
1233
+ default: s(() => [
1234
+ p(l(a.value.scheduleCopy), 1)
1235
+ ]),
1236
+ _: 1
1237
+ }, 8, ["disabled", "onClick"])) : y("", !0),
1238
+ D.scheduleId ? (t(), C("span", el, l(a.value.scheduledJob), 1)) : y("", !0),
1239
+ D.state === "succeeded" ? (t(), h(e(z), {
1240
+ key: 5,
1241
+ variant: "secondary",
1242
+ disabled: o.value,
1243
+ onClick: (le) => Ie(D)
1244
+ }, {
1245
+ default: s(() => [
1246
+ p(l(a.value.result), 1)
1247
+ ]),
1248
+ _: 1
1249
+ }, 8, ["disabled", "onClick"])) : y("", !0)
1250
+ ], 8, Ya))), 128))
1251
+ ])) : (t(), C("p", Qa, l(a.value.noJobs), 1)),
1252
+ g("section", {
1253
+ "data-bg-schedules": "",
1254
+ class: "bg-schedules",
1255
+ "aria-label": a.value.schedulesTitle
1256
+ }, [
1257
+ g("h3", null, l(a.value.schedulesTitle), 1),
1258
+ g("p", ll, l(a.value.scheduleHelp), 1),
1259
+ d.value ? (t(), h(e(pe), {
1260
+ key: 0,
1261
+ class: "bg-schedule-form",
1262
+ onSubmit: ce(_, ["prevent"])
1263
+ }, {
1264
+ default: s(() => [
1265
+ g("p", null, l($(a.value.scheduleSource, { name: d.value.name })), 1),
1266
+ b(e(ne), {
1267
+ label: a.value.interval
1268
+ }, {
1269
+ default: s(() => [
1270
+ b(e(Pe), {
1271
+ modelValue: E.value,
1272
+ "onUpdate:modelValue": B[3] || (B[3] = (D) => E.value = D),
1273
+ "data-schedule-interval": "",
1274
+ options: M.value,
1275
+ disabled: o.value
1276
+ }, null, 8, ["modelValue", "options", "disabled"])
1277
+ ]),
1278
+ _: 1
1279
+ }, 8, ["label"]),
1280
+ b(e(ea), {
1281
+ modelValue: k.value,
1282
+ "onUpdate:modelValue": B[4] || (B[4] = (D) => k.value = D),
1283
+ "data-schedule-consent": "",
1284
+ disabled: o.value,
1285
+ label: a.value.scheduleConsent
1286
+ }, null, 8, ["modelValue", "disabled", "label"]),
1287
+ b(e(fe), null, {
1288
+ default: s(() => [
1289
+ b(e(z), {
1290
+ type: "submit",
1291
+ variant: "primary",
1292
+ disabled: o.value || !k.value
1293
+ }, {
1294
+ default: s(() => [
1295
+ p(l(a.value.createSchedule), 1)
1296
+ ]),
1297
+ _: 1
1298
+ }, 8, ["disabled"]),
1299
+ b(e(z), {
1300
+ type: "button",
1301
+ variant: "secondary",
1302
+ disabled: o.value,
1303
+ onClick: B[5] || (B[5] = (D) => d.value = void 0)
1304
+ }, {
1305
+ default: s(() => [
1306
+ p(l(a.value.cancel), 1)
1307
+ ]),
1308
+ _: 1
1309
+ }, 8, ["disabled"])
1310
+ ]),
1311
+ _: 1
1312
+ })
1313
+ ]),
1314
+ _: 1
1315
+ })) : y("", !0),
1316
+ w.value.length ? (t(), C("ul", nl, [
1317
+ (t(!0), C(j, null, te(w.value, (D) => (t(), C("li", {
1318
+ key: D.id,
1319
+ "data-schedule-id": D.id
1320
+ }, [
1321
+ g("span", ul, l(D.name) + " — " + l(D.enabled ? a.value.scheduleOn : a.value.scheduleOff), 1),
1322
+ u.value.admin ? (t(), C("span", il, l($(a.value.owner, { user: D.owner.user, uid: D.owner.uid })), 1)) : y("", !0),
1323
+ D.enabled ? (t(), C("span", ol, l($(a.value.nextRun, { time: ee(D.nextAt) })), 1)) : y("", !0),
1324
+ g("span", rl, l($(a.value.missedRuns, { count: D.missed })), 1),
1325
+ D.reason === "worker-changed" ? (t(), h(e(Q), {
1326
+ key: 2,
1327
+ tone: "warning"
1328
+ }, {
1329
+ default: s(() => [
1330
+ p(l(a.value.revisionChanged), 1)
1331
+ ]),
1332
+ _: 1
1333
+ })) : D.reason === "input-unavailable" ? (t(), h(e(Q), {
1334
+ key: 3,
1335
+ tone: "warning"
1336
+ }, {
1337
+ default: s(() => [
1338
+ p(l(a.value.errors["input-unavailable"]), 1)
1339
+ ]),
1340
+ _: 1
1341
+ })) : y("", !0),
1342
+ g("div", dl, [
1343
+ D.enabled ? (t(), h(e(z), {
1344
+ key: 0,
1345
+ variant: "secondary",
1346
+ disabled: o.value,
1347
+ onClick: (le) => x(D.id)
1348
+ }, {
1349
+ default: s(() => [
1350
+ p(l(a.value.disableSchedule), 1)
1351
+ ]),
1352
+ _: 1
1353
+ }, 8, ["disabled", "onClick"])) : u.value.admin ? (t(), h(e(z), {
1354
+ key: 1,
1355
+ variant: "secondary",
1356
+ disabled: o.value,
1357
+ onClick: (le) => U.value = D
1358
+ }, {
1359
+ default: s(() => [
1360
+ p(l(a.value.enableSchedule), 1)
1361
+ ]),
1362
+ _: 1
1363
+ }, 8, ["disabled", "onClick"])) : y("", !0),
1364
+ b(e(z), {
1365
+ variant: "secondary",
1366
+ disabled: o.value,
1367
+ onClick: (le) => m.value = D
1368
+ }, {
1369
+ default: s(() => [
1370
+ p(l(a.value.deleteSchedule), 1)
1371
+ ]),
1372
+ _: 1
1373
+ }, 8, ["disabled", "onClick"])
1374
+ ])
1375
+ ], 8, sl))), 128))
1376
+ ])) : (t(), C("p", tl, l(a.value.noSchedules), 1)),
1377
+ m.value ? (t(), h(e(Q), {
1378
+ key: 3,
1379
+ tone: "warning"
1380
+ }, {
1381
+ default: s(() => [
1382
+ g("p", null, l($(a.value.deleteScheduleConsent, { name: m.value.name })), 1),
1383
+ g("div", vl, [
1384
+ b(e(z), {
1385
+ variant: "danger",
1386
+ disabled: o.value,
1387
+ onClick: G
1388
+ }, {
1389
+ default: s(() => [
1390
+ p(l(a.value.confirmDeleteSchedule), 1)
1391
+ ]),
1392
+ _: 1
1393
+ }, 8, ["disabled"]),
1394
+ b(e(z), {
1395
+ variant: "secondary",
1396
+ disabled: o.value,
1397
+ onClick: B[6] || (B[6] = (D) => m.value = void 0)
1398
+ }, {
1399
+ default: s(() => [
1400
+ p(l(a.value.cancel), 1)
1401
+ ]),
1402
+ _: 1
1403
+ }, 8, ["disabled"])
1404
+ ])
1405
+ ]),
1406
+ _: 1
1407
+ })) : y("", !0),
1408
+ U.value ? (t(), h(e(Q), {
1409
+ key: 4,
1410
+ tone: "warning"
1411
+ }, {
1412
+ default: s(() => [
1413
+ g("p", null, l($(a.value.enableScheduleConsent, { name: U.value.name })), 1),
1414
+ g("div", cl, [
1415
+ b(e(z), {
1416
+ variant: "primary",
1417
+ disabled: o.value,
1418
+ onClick: Z
1419
+ }, {
1420
+ default: s(() => [
1421
+ p(l(a.value.confirmEnableSchedule), 1)
1422
+ ]),
1423
+ _: 1
1424
+ }, 8, ["disabled"]),
1425
+ b(e(z), {
1426
+ variant: "secondary",
1427
+ disabled: o.value,
1428
+ onClick: B[7] || (B[7] = (D) => U.value = void 0)
1429
+ }, {
1430
+ default: s(() => [
1431
+ p(l(a.value.cancel), 1)
1432
+ ]),
1433
+ _: 1
1434
+ }, 8, ["disabled"])
1435
+ ])
1436
+ ]),
1437
+ _: 1
1438
+ })) : y("", !0)
1439
+ ], 8, al),
1440
+ R.value ? (t(), h(e(Ue), {
1441
+ key: 3,
1442
+ href: R.value,
1443
+ download: W.value
1444
+ }, {
1445
+ default: s(() => [
1446
+ p(l(a.value.download), 1)
1447
+ ]),
1448
+ _: 1
1449
+ }, 8, ["href", "download"])) : y("", !0)
1450
+ ], 64)) : y("", !0)
1451
+ ], 64))
1452
+ ]),
1453
+ _: 1
1454
+ }, 8, ["aria-busy", "title"]));
1455
+ }
1456
+ }), ot = /* @__PURE__ */ ue(pl, [["__scopeId", "data-v-7954713f"]]), fl = { role: "status" }, yl = { key: 1 }, ml = { key: 2 }, rt = /* @__PURE__ */ ae({
1457
+ __name: "ExecutorSettings",
1458
+ props: {
1459
+ admin: { type: Boolean },
1460
+ locale: {},
1461
+ ctx: {}
1462
+ },
1463
+ emits: ["confirmed"],
1464
+ setup(f, { emit: P }) {
1465
+ const a = f, $ = P, u = ia(), r = N(() => xe(a.locale)), n = c(), i = c(""), o = c(!1), w = c(!1), d = c(), k = c(""), E = c([]), m = N(() => d.value?.scope_mode === "install-selected"), U = N(() => [{ label: r.value.homeScope, value: "home" }, ...E.value]), S = N(() => !m.value || !!k.value && U.value.some((F) => F.value === k.value)), A = N(() => m.value && !d.value?.selection), H = N(() => k.value !== d.value?.selection?.scope);
1466
+ let V = !1;
1467
+ async function R(F) {
1468
+ const L = F ?? await u.status();
1469
+ if (V || (n.value = L, !a.ctx)) return;
1470
+ const J = await a.ctx.call("delegate.status");
1471
+ if (V || (d.value = J, J.scope_mode !== "install-selected")) return;
1472
+ const K = [];
1473
+ let Y = 0;
1474
+ for (let q = 0; q < 128; q++) {
1475
+ const O = await a.ctx.call("bg.browse", { offset: Y });
1476
+ if (V) return;
1477
+ if (!Array.isArray(O.shares) || !Number.isSafeInteger(O.total) || O.total < 0 || !O.shares.length && Y < O.total) throw { code: "EXECUTOR_PROTOCOL" };
1478
+ for (const T of O.shares)
1479
+ T.isdir && T.path === "/" + T.name && !["home", "homes"].includes(T.name.toLowerCase()) && K.push({ label: T.name, value: "shared:" + T.name });
1480
+ if (Y += O.shares.length, Y >= O.total) break;
1481
+ if (q === 127) throw { code: "EXECUTOR_PROTOCOL" };
1482
+ }
1483
+ E.value = K, k.value = J.selection?.scope ?? J.preselection ?? "";
1484
+ }
1485
+ async function W() {
1486
+ if (!(!a.admin || o.value)) {
1487
+ o.value = !0, w.value = !1;
1488
+ try {
1489
+ await R();
1490
+ } catch {
1491
+ V || (w.value = !0);
1492
+ } finally {
1493
+ V || (o.value = !1);
1494
+ }
1495
+ }
1496
+ }
1497
+ async function X() {
1498
+ if (!a.admin || o.value || !i.value || !S.value || w.value) return;
1499
+ o.value = !0, w.value = !1;
1500
+ const F = i.value;
1501
+ i.value = "";
1502
+ try {
1503
+ const L = m.value ? await u.authorize(F, k.value) : await u.authorize(F);
1504
+ await R(L), V || $("confirmed");
1505
+ } catch {
1506
+ V || (w.value = !0);
1507
+ } finally {
1508
+ V || (o.value = !1);
1509
+ }
1510
+ }
1511
+ return ie(() => {
1512
+ u.subscribe?.((F) => {
1513
+ V || (n.value = F);
1514
+ }), W();
1515
+ }), se(() => {
1516
+ V = !0, i.value = "";
1517
+ }), (F, L) => f.admin ? (t(), h(e(de), {
1518
+ key: 0,
1519
+ title: r.value.setupTitle,
1520
+ collapsible: !1,
1521
+ "aria-busy": o.value
1522
+ }, {
1523
+ default: s(() => [
1524
+ g("p", null, l(r.value.setupHelp), 1),
1525
+ w.value ? (t(), h(e(Q), {
1526
+ key: 0,
1527
+ tone: "danger",
1528
+ role: "alert"
1529
+ }, {
1530
+ default: s(() => [
1531
+ p(l(r.value.setupError), 1)
1532
+ ]),
1533
+ _: 1
1534
+ })) : y("", !0),
1535
+ g("p", fl, l(n.value?.state === "ready" ? A.value ? r.value.scopeNeeds : r.value.ready : n.value?.state === "needs-admin-approval" ? r.value.needs : r.value.blocked), 1),
1536
+ n.value?.reason && (n.value.state === "blocked" || n.value.state === "unsupported") ? (t(), C("p", yl, l(r.value.details) + ": " + l(n.value.reason), 1)) : y("", !0),
1537
+ d.value?.selection ? (t(), C("p", ml, l(r.value.protectedScope) + ": " + l(d.value.selection.root), 1)) : y("", !0),
1538
+ d.value?.mismatch ? (t(), h(e(Q), {
1539
+ key: 3,
1540
+ tone: "warning"
1541
+ }, {
1542
+ default: s(() => [
1543
+ p(l(r.value.scopeMismatch) + " " + l(r.value.preselection) + ": " + l(d.value.preselection) + " · " + l(r.value.protectedScope) + ": " + l(d.value.selection?.root), 1)
1544
+ ]),
1545
+ _: 1
1546
+ })) : y("", !0),
1547
+ n.value?.state === "needs-admin-approval" || n.value?.retry || m.value && n.value?.state === "ready" ? (t(), h(e(pe), {
1548
+ key: 4,
1549
+ onSubmit: ce(X, ["prevent"])
1550
+ }, {
1551
+ default: s(() => [
1552
+ m.value ? (t(), C(j, { key: 0 }, [
1553
+ g("p", null, l(d.value?.selection ? r.value.scopeChangeHelp : r.value.preselectionHelp), 1),
1554
+ b(e(ne), {
1555
+ label: r.value.scopeLabel,
1556
+ "label-for": "delegate-scope"
1557
+ }, {
1558
+ default: s(() => [
1559
+ b(e(Pe), {
1560
+ id: "delegate-scope",
1561
+ modelValue: k.value,
1562
+ "onUpdate:modelValue": L[0] || (L[0] = (J) => k.value = J),
1563
+ options: U.value,
1564
+ disabled: o.value || w.value
1565
+ }, null, 8, ["modelValue", "options", "disabled"])
1566
+ ]),
1567
+ _: 1
1568
+ }, 8, ["label"])
1569
+ ], 64)) : y("", !0),
1570
+ b(e(ne), {
1571
+ label: r.value.password,
1572
+ "label-for": "delegate-password"
1573
+ }, {
1574
+ default: s(() => [
1575
+ b(e(re), {
1576
+ id: "delegate-password",
1577
+ modelValue: i.value,
1578
+ "onUpdate:modelValue": L[1] || (L[1] = (J) => i.value = J),
1579
+ type: "password",
1580
+ autocomplete: "current-password",
1581
+ disabled: o.value || w.value
1582
+ }, null, 8, ["modelValue", "disabled"])
1583
+ ]),
1584
+ _: 1
1585
+ }, 8, ["label"]),
1586
+ b(e(fe), null, {
1587
+ default: s(() => [
1588
+ b(e(z), {
1589
+ type: "submit",
1590
+ variant: "primary",
1591
+ disabled: o.value || w.value || !i.value || !S.value || m.value && !!d.value?.selection && !H.value
1592
+ }, {
1593
+ default: s(() => [
1594
+ p(l(m.value ? d.value?.selection ? r.value.confirmScope : r.value.confirmShare : r.value.authorize), 1)
1595
+ ]),
1596
+ _: 1
1597
+ }, 8, ["disabled"])
1598
+ ]),
1599
+ _: 1
1600
+ })
1601
+ ]),
1602
+ _: 1
1603
+ })) : y("", !0),
1604
+ b(e(z), {
1605
+ variant: "secondary",
1606
+ disabled: o.value,
1607
+ onClick: W
1608
+ }, {
1609
+ default: s(() => [
1610
+ p(l(r.value.refresh), 1)
1611
+ ]),
1612
+ _: 1
1613
+ }, 8, ["disabled"])
1614
+ ]),
1615
+ _: 1
1616
+ }, 8, ["title", "aria-busy"])) : y("", !0);
1617
+ }
1618
+ }), bl = {
1619
+ key: 1,
1620
+ role: "status"
1621
+ }, kl = {
1622
+ key: 2,
1623
+ role: "status"
1624
+ }, _l = {
1625
+ key: 0,
1626
+ role: "status",
1627
+ class: "destination"
1628
+ }, gl = { class: "section-heading" }, hl = { key: 3 }, wl = {
1629
+ key: 4,
1630
+ class: "records"
1631
+ }, Cl = ["data-job-state"], $l = ["role"], xl = { key: 5 }, Sl = {
1632
+ key: 6,
1633
+ class: "records"
1634
+ }, zl = /* @__PURE__ */ ae({
1635
+ __name: "DelegatePanel",
1636
+ props: {
1637
+ ctx: {}
1638
+ },
1639
+ setup(f) {
1640
+ const P = f, a = N(() => xe(P.ctx.locale)), $ = $e(P.ctx), u = c(), r = c([]), n = c([]), i = c(!1), o = c(), w = c(""), d = c(!1), k = c(""), E = c(""), m = c("");
1641
+ let U = !1, S, A;
1642
+ Se([E, k, m], () => {
1643
+ A = void 0;
1644
+ }, { flush: "sync" });
1645
+ const H = (M) => ["queued", "running", "waiting_executor"].includes(M.state), V = N(() => n.value.some((M) => M.state === "waiting_executor")), R = ["EXECUTOR_UNAVAILABLE", "EXECUTOR_TIMEOUT"], W = N(() => V.value && R.includes(o.value?.code ?? "")), X = N(() => u.value && u.value.state !== "ready" && !(V.value && u.value.state === "needs-admin-approval" && R.includes(u.value.reason ?? "")));
1646
+ async function F() {
1647
+ if (U) return;
1648
+ const [M, v, _] = await Promise.allSettled([P.ctx.call("delegate.status"), P.ctx.call("delegate.list"), P.ctx.call("delegate.jobs.list")]);
1649
+ if (!U) {
1650
+ M.status === "fulfilled" && (u.value = M.value), v.status === "fulfilled" && (r.value = (v.value.delegations ?? []).filter((x) => !x.revoked)), _.status === "fulfilled" && (n.value = _.value.jobs ?? []);
1651
+ for (const x of [M, v, _]) if (x.status === "rejected") throw x.reason;
1652
+ }
1653
+ }
1654
+ async function L(M) {
1655
+ if (!(i.value || U)) {
1656
+ i.value = !0, o.value = void 0;
1657
+ try {
1658
+ await M();
1659
+ } catch (v) {
1660
+ U || (o.value = v);
1661
+ } finally {
1662
+ U || (i.value = !1);
1663
+ }
1664
+ }
1665
+ }
1666
+ const J = () => L(F), K = (M) => L(async () => {
1667
+ await P.ctx.call("delegate.revoke", { delegation_id: M }), await F();
1668
+ }), Y = (M) => L(async () => {
1669
+ const v = await P.ctx.call("delegate.jobs.cancel", { id: M });
1670
+ U || (w.value = v.revocation_pending ? a.value.pending : ""), await F();
1671
+ }), q = N(() => u.value?.state === "ready" && !!k.value && !!E.value && !!m.value), O = () => L(async () => {
1672
+ q.value && (await P.ctx.call("delegate.jobs.submit", { key: A ?? (A = crypto.randomUUID()), url: E.value, dest: k.value, name: m.value }), U || (E.value = "", m.value = "", k.value = ""), await F());
1673
+ }), T = (M) => {
1674
+ const v = new Date(M);
1675
+ return Number.isNaN(v.getTime()) ? "—" : v.toLocaleString(P.ctx.locale);
1676
+ };
1677
+ return ie(() => {
1678
+ J(), S = setInterval(() => {
1679
+ n.value.some(H) && J();
1680
+ }, 3e3);
1681
+ }), se(() => {
1682
+ U = !0, S && clearInterval(S), $.dispose();
1683
+ }), (M, v) => (t(), h(e(de), {
1684
+ title: a.value.title,
1685
+ collapsible: !1,
1686
+ "aria-busy": i.value,
1687
+ class: "delegate-panel"
1688
+ }, {
1689
+ default: s(() => [
1690
+ g("p", null, l(a.value.help), 1),
1691
+ o.value && !W.value ? (t(), h(e(Q), {
1692
+ key: 0,
1693
+ tone: "danger",
1694
+ role: "alert"
1695
+ }, {
1696
+ default: s(() => [
1697
+ p(l(e(Fe)(o.value, a.value)), 1)
1698
+ ]),
1699
+ _: 1
1700
+ })) : y("", !0),
1701
+ w.value ? (t(), C("p", bl, l(w.value), 1)) : y("", !0),
1702
+ X.value ? (t(), C("p", kl, l(u.value?.state === "needs-admin-approval" ? a.value.needs : a.value.blocked), 1)) : y("", !0),
1703
+ b(e(pe), {
1704
+ onSubmit: ce(O, ["prevent"])
1705
+ }, {
1706
+ default: s(() => [
1707
+ b(e(ne), {
1708
+ label: a.value.url,
1709
+ "label-for": "delegate-url"
1710
+ }, {
1711
+ default: s(() => [
1712
+ b(e(re), {
1713
+ id: "delegate-url",
1714
+ modelValue: E.value,
1715
+ "onUpdate:modelValue": v[0] || (v[0] = (_) => E.value = _),
1716
+ type: "url",
1717
+ disabled: i.value || u.value?.state !== "ready"
1718
+ }, null, 8, ["modelValue", "disabled"])
1719
+ ]),
1720
+ _: 1
1721
+ }, 8, ["label"]),
1722
+ b(e(ne), {
1723
+ label: a.value.name,
1724
+ "label-for": "delegate-name"
1725
+ }, {
1726
+ default: s(() => [
1727
+ b(e(re), {
1728
+ id: "delegate-name",
1729
+ modelValue: m.value,
1730
+ "onUpdate:modelValue": v[1] || (v[1] = (_) => m.value = _),
1731
+ "data-file-name": "",
1732
+ disabled: i.value || u.value?.state !== "ready"
1733
+ }, null, 8, ["modelValue", "disabled"])
1734
+ ]),
1735
+ _: 1
1736
+ }, 8, ["label"]),
1737
+ g("p", null, l(a.value.size), 1),
1738
+ k.value ? (t(), C("p", _l, l(a.value.destination) + ": " + l(k.value), 1)) : y("", !0),
1739
+ b(e(fe), null, {
1740
+ default: s(() => [
1741
+ b(e(z), {
1742
+ type: "button",
1743
+ variant: "secondary",
1744
+ disabled: i.value || u.value?.state !== "ready",
1745
+ onClick: v[2] || (v[2] = (_) => d.value = !0)
1746
+ }, {
1747
+ default: s(() => [
1748
+ p(l(a.value.choose), 1)
1749
+ ]),
1750
+ _: 1
1751
+ }, 8, ["disabled"]),
1752
+ b(e(z), {
1753
+ type: "submit",
1754
+ variant: "primary",
1755
+ disabled: i.value || !q.value
1756
+ }, {
1757
+ default: s(() => [
1758
+ p(l(a.value.submit), 1)
1759
+ ]),
1760
+ _: 1
1761
+ }, 8, ["disabled"])
1762
+ ]),
1763
+ _: 1
1764
+ })
1765
+ ]),
1766
+ _: 1
1767
+ }),
1768
+ b(ye, {
1769
+ open: d.value,
1770
+ "onUpdate:open": v[3] || (v[3] = (_) => d.value = _),
1771
+ locale: f.ctx.locale,
1772
+ provider: e($),
1773
+ mode: "folder",
1774
+ onSelected: v[4] || (v[4] = (_) => k.value = _)
1775
+ }, null, 8, ["open", "locale", "provider"]),
1776
+ g("div", gl, [
1777
+ g("h3", null, l(a.value.downloads), 1),
1778
+ b(e(z), {
1779
+ variant: "secondary",
1780
+ disabled: i.value,
1781
+ onClick: J
1782
+ }, {
1783
+ default: s(() => [
1784
+ p(l(a.value.refresh), 1)
1785
+ ]),
1786
+ _: 1
1787
+ }, 8, ["disabled"])
1788
+ ]),
1789
+ !n.value.length && !o.value ? (t(), C("p", hl, l(a.value.noJobs), 1)) : (t(), C("ul", wl, [
1790
+ (t(!0), C(j, null, te(n.value, (_) => (t(), C("li", {
1791
+ key: _.id,
1792
+ "data-job-state": _.state
1793
+ }, [
1794
+ g("span", {
1795
+ role: _.state === "waiting_executor" ? "status" : void 0
1796
+ }, l(_.name) + " · " + l(a.value[_.state]), 9, $l),
1797
+ H(_) ? (t(), h(e(z), {
1798
+ key: 0,
1799
+ variant: "secondary",
1800
+ disabled: i.value,
1801
+ onClick: (x) => Y(_.id)
1802
+ }, {
1803
+ default: s(() => [
1804
+ p(l(a.value.cancel), 1)
1805
+ ]),
1806
+ _: 1
1807
+ }, 8, ["disabled", "onClick"])) : y("", !0)
1808
+ ], 8, Cl))), 128))
1809
+ ])),
1810
+ g("h3", null, l(a.value.delegations), 1),
1811
+ !r.value.length && !o.value ? (t(), C("p", xl, l(a.value.noDelegations), 1)) : (t(), C("ul", Sl, [
1812
+ (t(!0), C(j, null, te(r.value, (_) => (t(), C("li", {
1813
+ key: _.delegation_id
1814
+ }, [
1815
+ g("div", null, [
1816
+ g("strong", null, l(_.path), 1),
1817
+ g("p", null, l(a.value.expires) + ": " + l(T(_.expires_at)), 1)
1818
+ ]),
1819
+ b(e(z), {
1820
+ variant: "secondary",
1821
+ disabled: i.value,
1822
+ onClick: (x) => K(_.delegation_id)
1823
+ }, {
1824
+ default: s(() => [
1825
+ p(l(a.value.revoke), 1)
1826
+ ]),
1827
+ _: 1
1828
+ }, 8, ["disabled", "onClick"])
1829
+ ]))), 128))
1830
+ ]))
1831
+ ]),
1832
+ _: 1
1833
+ }, 8, ["title", "aria-busy"]));
1834
+ }
1835
+ }), dt = /* @__PURE__ */ ue(zl, [["__scopeId", "data-v-d79ee942"]]), Vl = {
1836
+ key: 1,
1837
+ role: "status"
1838
+ }, Ul = {
1839
+ key: 2,
1840
+ role: "status"
1841
+ }, Pl = { key: 3 }, Dl = {
1842
+ key: 7,
1843
+ role: "status"
1844
+ }, Al = { class: "save-actions" }, El = { key: 8 }, Tl = {
1845
+ key: 10,
1846
+ class: "save-actions"
1847
+ }, Il = { key: 12 }, Ol = { class: "save-records" }, ql = { class: "save-actions" }, Rl = { key: 14 }, Ll = { class: "save-records" }, Bl = ["data-job-id", "data-save-state"], Fl = { key: 0 }, Nl = { key: 3 }, Ml = /* @__PURE__ */ ae({
1848
+ __name: "BackgroundSavePanel",
1849
+ props: {
1850
+ sdk: {},
1851
+ admin: { type: Boolean },
1852
+ locale: {},
1853
+ picker: {}
1854
+ },
1855
+ emits: ["authorized"],
1856
+ setup(f, { emit: P }) {
1857
+ const a = f, $ = P, u = c(!1), r = c(""), n = N(() => Ce(a.locale)), i = c(), o = c([]), w = c([]), d = c(!1), k = c(), E = c(""), m = c([]), U = N(() => a.picker && (i.value?.selection ? Ne(a.picker.provider, i.value.selection.root) : i.value?.scopeMode === "install-selected" ? void 0 : a.picker.provider));
1858
+ let S = !1, A;
1859
+ const H = (T) => T.state === "copying" && T.code === "CANCEL_REQUESTED", V = (T) => H(T) ? "canceling" : T.state === "committed" && !T.receipt?.path ? "uncertain" : T.state, R = (T) => ["queued", "copying"].includes(T.state) && !H(T);
1860
+ function W() {
1861
+ i.value = void 0, o.value = [], w.value = [], m.value = [], u.value = !1;
1862
+ }
1863
+ async function X() {
1864
+ const [T, M, v, _] = await Promise.all([a.sdk.status(), a.sdk.list(), a.sdk.operations(), Promise.all((a.picker?.keys ?? []).map((x) => a.sdk.destination(x)))]);
1865
+ if (!S) {
1866
+ if (!T || typeof T.disabled != "boolean" || !Array.isArray(M) || !Array.isArray(v)) throw { code: "unavailable" };
1867
+ (i.value?.selection?.generation !== T.selection?.generation || i.value?.selection?.scope !== T.selection?.scope) && (u.value = !1), i.value = T, o.value = _.length ? M.filter((x) => _.some((G) => G.status === "active" && G.destination?.id === x.id)) : M, w.value = v, m.value = _;
1868
+ }
1869
+ }
1870
+ async function F(T) {
1871
+ if (!(S || d.value)) {
1872
+ d.value = !0, k.value = void 0, E.value = "";
1873
+ try {
1874
+ await T();
1875
+ } catch (M) {
1876
+ S || (W(), k.value = M);
1877
+ } finally {
1878
+ S || (d.value = !1);
1879
+ }
1880
+ }
1881
+ }
1882
+ const L = () => F(X);
1883
+ function J(T) {
1884
+ $("authorized", T), L();
1885
+ }
1886
+ const K = (T) => F(async () => {
1887
+ if ((await a.sdk.revoke({ delegation_id: T }))?.revoked !== !0) throw { code: "commit-uncertain" };
1888
+ await X(), S || (E.value = n.value.revoked);
1889
+ }), Y = (T) => F(async () => {
1890
+ await a.sdk.cancel({ delegation_id: T.delegation_id, job_id: T.job_id }), await X();
1891
+ }), q = () => F(async () => {
1892
+ if (!a.admin || !i.value) return;
1893
+ const T = i.value.disabled;
1894
+ if ((T ? await a.sdk.enable() : await a.sdk.disable())?.disabled !== !T) throw { code: "commit-uncertain" };
1895
+ await X();
1896
+ }), O = (T) => F(async () => {
1897
+ const M = "example-" + Array.from(crypto.getRandomValues(new Uint8Array(16)), (v) => v.toString(16).padStart(2, "0")).join("");
1898
+ await a.sdk.exportExample({ key: T, job_id: M }), await X();
1899
+ });
1900
+ return ie(() => {
1901
+ L(), A = setInterval(() => {
1902
+ w.value.some(R) && L();
1903
+ }, 3e3);
1904
+ }), se(() => {
1905
+ S = !0, A && clearInterval(A);
1906
+ }), (T, M) => (t(), h(e(de), {
1907
+ title: n.value.title,
1908
+ collapsible: !1,
1909
+ "aria-busy": d.value,
1910
+ class: "background-save-panel"
1911
+ }, {
1912
+ default: s(() => [
1913
+ g("p", null, l(n.value.help), 1),
1914
+ k.value ? (t(), h(e(Q), {
1915
+ key: 0,
1916
+ tone: "danger",
1917
+ role: "alert",
1918
+ class: "save-message"
1919
+ }, {
1920
+ default: s(() => [
1921
+ p(l(e(be)(k.value, n.value)), 1)
1922
+ ]),
1923
+ _: 1
1924
+ })) : y("", !0),
1925
+ d.value && !i.value ? (t(), C("p", Vl, l(n.value.loading), 1)) : y("", !0),
1926
+ E.value ? (t(), C("p", Ul, l(E.value), 1)) : y("", !0),
1927
+ i.value?.selection ? (t(), C("p", Pl, [
1928
+ g("strong", null, l(n.value.scope), 1),
1929
+ p(": " + l(i.value.selection.root), 1)
1930
+ ])) : y("", !0),
1931
+ i.value?.mismatch ? (t(), h(e(Q), {
1932
+ key: 4,
1933
+ tone: "warning"
1934
+ }, {
1935
+ default: s(() => [
1936
+ p(l(n.value.scopeMismatch) + " " + l(i.value.preselection) + " → " + l(i.value.selection?.root), 1)
1937
+ ]),
1938
+ _: 1
1939
+ })) : y("", !0),
1940
+ i.value?.scopeMode === "install-selected" && !i.value.selection ? (t(), h(e(Q), {
1941
+ key: 5,
1942
+ tone: "warning"
1943
+ }, {
1944
+ default: s(() => [
1945
+ p(l(n.value.scopeNeeds), 1)
1946
+ ]),
1947
+ _: 1
1948
+ })) : y("", !0),
1949
+ i.value?.disabled ? (t(), h(e(Q), {
1950
+ key: 6,
1951
+ tone: "warning",
1952
+ role: "status",
1953
+ class: "save-message"
1954
+ }, {
1955
+ default: s(() => [
1956
+ p(l(n.value.disabled), 1)
1957
+ ]),
1958
+ _: 1
1959
+ })) : i.value ? (t(), C("p", Dl, l(n.value.enabled), 1)) : y("", !0),
1960
+ g("div", Al, [
1961
+ b(e(z), {
1962
+ variant: "secondary",
1963
+ disabled: d.value,
1964
+ onClick: L
1965
+ }, {
1966
+ default: s(() => [
1967
+ p(l(n.value.refresh), 1)
1968
+ ]),
1969
+ _: 1
1970
+ }, 8, ["disabled"]),
1971
+ f.admin && i.value ? (t(), h(e(z), {
1972
+ key: 0,
1973
+ variant: i.value.disabled ? "secondary" : "danger",
1974
+ disabled: d.value,
1975
+ onClick: q
1976
+ }, {
1977
+ default: s(() => [
1978
+ p(l(i.value.disabled ? n.value.enable : n.value.disable), 1)
1979
+ ]),
1980
+ _: 1
1981
+ }, 8, ["variant", "disabled"])) : y("", !0)
1982
+ ]),
1983
+ f.admin && i.value ? (t(), C("p", El, l(n.value.disableHelp), 1)) : y("", !0),
1984
+ g("h3", null, l(n.value.delegations), 1),
1985
+ m.value.some((v) => v.status === "reselection-required") ? (t(), h(e(Q), {
1986
+ key: 9,
1987
+ tone: "warning"
1988
+ }, {
1989
+ default: s(() => [
1990
+ p(l(n.value.reselect), 1)
1991
+ ]),
1992
+ _: 1
1993
+ })) : y("", !0),
1994
+ f.picker ? (t(), C("div", Tl, [
1995
+ (t(!0), C(j, null, te(f.picker.keys, (v) => (t(), h(e(z), {
1996
+ key: v,
1997
+ variant: "secondary",
1998
+ disabled: d.value || !i.value || i.value.disabled || !U.value,
1999
+ onClick: (_) => {
2000
+ r.value = v, u.value = !0;
2001
+ }
2002
+ }, {
2003
+ default: s(() => [
2004
+ p(l(n.value.choose) + " (" + l(v) + ")", 1)
2005
+ ]),
2006
+ _: 2
2007
+ }, 1032, ["disabled", "onClick"]))), 128))
2008
+ ])) : y("", !0),
2009
+ U.value ? (t(), h(ye, {
2010
+ key: i.value?.selection?.scope,
2011
+ open: u.value,
2012
+ "onUpdate:open": M[0] || (M[0] = (v) => u.value = v),
2013
+ provider: U.value,
2014
+ locale: f.locale,
2015
+ mode: "folder",
2016
+ destination: { key: r.value, selectDestination: f.sdk.selectDestination },
2017
+ onAuthorized: J
2018
+ }, null, 8, ["open", "provider", "locale", "destination"])) : y("", !0),
2019
+ i.value && !o.value.length ? (t(), C("p", Il, l(n.value.empty), 1)) : y("", !0),
2020
+ g("ul", Ol, [
2021
+ (t(!0), C(j, null, te(o.value, (v) => (t(), C("li", {
2022
+ key: v.id
2023
+ }, [
2024
+ g("div", null, [
2025
+ g("strong", null, l(v.path), 1),
2026
+ g("p", null, l(n.value.untilRevoked), 1)
2027
+ ]),
2028
+ b(e(z), {
2029
+ variant: "secondary",
2030
+ disabled: d.value,
2031
+ onClick: (_) => K(v.id)
2032
+ }, {
2033
+ default: s(() => [
2034
+ p(l(n.value.revoke), 1)
2035
+ ]),
2036
+ _: 1
2037
+ }, 8, ["disabled", "onClick"])
2038
+ ]))), 128))
2039
+ ]),
2040
+ m.value.some((v) => v.status === "active") ? (t(), C(j, { key: 13 }, [
2041
+ g("p", null, l(n.value.exampleHelp), 1),
2042
+ g("div", ql, [
2043
+ (t(!0), C(j, null, te(m.value.filter((v) => v.status === "active"), (v) => (t(), h(e(z), {
2044
+ key: v.key,
2045
+ variant: "secondary",
2046
+ disabled: d.value || i.value?.disabled,
2047
+ onClick: (_) => O(v.key)
2048
+ }, {
2049
+ default: s(() => [
2050
+ p(l(n.value.example) + " (" + l(v.key) + ")", 1)
2051
+ ]),
2052
+ _: 2
2053
+ }, 1032, ["disabled", "onClick"]))), 128))
2054
+ ])
2055
+ ], 64)) : y("", !0),
2056
+ g("h3", null, l(n.value.operations), 1),
2057
+ i.value && !w.value.length ? (t(), C("p", Rl, l(n.value.noOperations), 1)) : y("", !0),
2058
+ g("ul", Ll, [
2059
+ (t(!0), C(j, null, te(w.value, (v) => (t(), C("li", {
2060
+ key: v.job_id,
2061
+ "data-job-id": v.job_id,
2062
+ "data-save-state": V(v)
2063
+ }, [
2064
+ g("div", null, [
2065
+ g("strong", null, l(v.name), 1),
2066
+ g("p", null, l(n.value[V(v)]) + " · " + l(v.job_id), 1),
2067
+ V(v) === "committed" ? (t(), C("p", Fl, l(v.receipt?.path), 1)) : y("", !0),
2068
+ V(v) === "uncertain" ? (t(), h(e(Q), {
2069
+ key: 1,
2070
+ tone: "warning",
2071
+ class: "save-message"
2072
+ }, {
2073
+ default: s(() => [
2074
+ p(l(n.value.uncertainHelp), 1)
2075
+ ]),
2076
+ _: 1
2077
+ })) : V(v) === "interrupted" ? (t(), h(e(Q), {
2078
+ key: 2,
2079
+ tone: "warning",
2080
+ class: "save-message"
2081
+ }, {
2082
+ default: s(() => [
2083
+ p(l(n.value.interruptedHelp), 1)
2084
+ ]),
2085
+ _: 1
2086
+ })) : y("", !0),
2087
+ v.code && !H(v) ? (t(), C("p", Nl, l(e(be)({ code: v.code }, n.value)), 1)) : y("", !0)
2088
+ ]),
2089
+ R(v) ? (t(), h(e(z), {
2090
+ key: 0,
2091
+ variant: "secondary",
2092
+ disabled: d.value,
2093
+ onClick: (_) => Y(v)
2094
+ }, {
2095
+ default: s(() => [
2096
+ p(l(n.value.cancel), 1)
2097
+ ]),
2098
+ _: 1
2099
+ }, 8, ["disabled", "onClick"])) : y("", !0)
2100
+ ], 8, Bl))), 128))
2101
+ ])
2102
+ ]),
2103
+ _: 1
2104
+ }, 8, ["title", "aria-busy"]));
2105
+ }
2106
+ }), vt = /* @__PURE__ */ ue(Ml, [["__scopeId", "data-v-c4022c90"]]), Hl = {
2107
+ class: "authorization-announcement",
2108
+ role: "status",
2109
+ "aria-live": "polite",
2110
+ "aria-atomic": "true"
2111
+ }, Kl = ["aria-busy", "data-authorization-state"], Jl = {
2112
+ class: "authorization-icon",
2113
+ "aria-hidden": "true"
2114
+ }, Xl = { class: "authorization-title" }, Gl = { class: "authorization-body" }, Ql = { class: "authorization-actions" }, Wl = {
2115
+ key: 1,
2116
+ class: "authorization-authorized"
2117
+ }, Yl = { class: "authorization-ready" }, Zl = /* @__PURE__ */ ae({
2118
+ __name: "AuthorizationGate",
2119
+ props: {
2120
+ ctx: {},
2121
+ name: {}
2122
+ },
2123
+ emits: ["ready"],
2124
+ setup(f, { emit: P }) {
2125
+ const a = f, $ = P, u = c(), r = c(), n = c(!1), i = c(!1), o = c(!1);
2126
+ let w = !1, d = 0, k = !1, E;
2127
+ const m = N(() => Me(a.ctx.locale, a.name ?? a.ctx.displayName ?? "")), U = N(() => u.value?.state === "ready"), S = N(() => u.value || r.value), A = N(() => S.value?.state === "authorization_required"), H = N(() => ["helper_untrusted", "cli_untrusted"].includes(S.value?.reason || "")), V = N(() => A.value && !H.value), R = N(() => S.value?.reason === "credential_not_ready" ? "credential" : "unavailable"), W = N(() => S.value ? A.value ? m.value("title") : S.value.state === "ready" ? m.value("ready") : S.value.state === "not_admin" ? m.value("not_admin.title") : S.value.state === "session_expired" ? m.value("session_expired.title") : m.value(R.value + ".title") : m.value("checking")), X = N(() => A.value ? m.value("purpose") : S.value?.state === "not_admin" ? m.value("not_admin.body") : S.value?.state === "session_expired" ? m.value("session_expired.body") : S.value?.state === "unavailable" ? m.value(R.value + ".body") : m.value("purpose")), F = ["grant_missing", "upgrade_reapproval", "helper_untrusted", "cli_untrusted", "grant_incompatible", "package_identity_changed", "maintenance_task_missing", "maintenance_task_mismatch", "helper_health_rejected", "capability_missing"], L = N(() => F.includes(S.value?.reason || "") ? S.value.reason : "unknown"), J = N(() => H.value ? "next.reinstall" : L.value === "grant_missing" ? "next.install" : L.value === "upgrade_reapproval" || L.value === "grant_incompatible" ? "next.update" : "next.repair");
2128
+ async function K(Y) {
2129
+ if (n.value || w) return;
2130
+ const q = ++d;
2131
+ r.value = Y === "request" && u.value?.state === "authorization_required" ? u.value : void 0, n.value = !0, i.value = !1, u.value = void 0;
2132
+ try {
2133
+ const O = await a.ctx.authorization?.[Y]();
2134
+ if (w || q !== d) return;
2135
+ if (!O || O.command !== "authorization" || O.schema_version !== 1 || !["ready", "authorization_required", "not_admin", "session_expired", "unavailable"].includes(O.state) || O.reason === "upgrade_reapproval" && O.state !== "authorization_required") throw Error("invalid status");
2136
+ u.value = O, O.state === "ready" && $("ready");
2137
+ } catch (O) {
2138
+ !w && q === d && (u.value = O.code === "session_required" ? { command: "authorization", schema_version: 1, state: "session_expired", reason: "session_expired" } : r.value || { command: "authorization", schema_version: 1, state: "unavailable", reason: "service_unavailable" }, i.value = !0);
2139
+ } finally {
2140
+ !w && q === d && (n.value = !1, r.value = void 0, k && (k = !1, K("status")));
2141
+ }
2142
+ }
2143
+ return ie(() => {
2144
+ E = a.ctx.reopen(() => {
2145
+ n.value ? k = !0 : K("status");
2146
+ }), K("status");
2147
+ }), ze(() => {
2148
+ w = !0, d++, typeof E == "function" && E();
2149
+ }), (Y, q) => (t(), C(j, null, [
2150
+ g("p", Hl, l(n.value ? m.value("authorizing") : W.value), 1),
2151
+ U.value ? (t(), C("div", Wl, [
2152
+ g("div", Yl, [
2153
+ b(e(he), {
2154
+ size: 16,
2155
+ "aria-hidden": "true"
2156
+ }),
2157
+ g("span", null, l(m.value("ready")), 1),
2158
+ f.ctx.authorization?.canManage?.() ? (t(), h(e(z), {
2159
+ key: 0,
2160
+ variant: "secondary",
2161
+ disabled: n.value,
2162
+ onClick: q[2] || (q[2] = (O) => o.value = !0)
2163
+ }, {
2164
+ default: s(() => [
2165
+ p(l(m.value("revoke")), 1)
2166
+ ]),
2167
+ _: 1
2168
+ }, 8, ["disabled"])) : y("", !0)
2169
+ ]),
2170
+ ke(Y.$slots, "default", {}, void 0, !0)
2171
+ ])) : (t(), C("div", {
2172
+ key: 0,
2173
+ class: "authorization-view",
2174
+ "aria-busy": n.value,
2175
+ "data-authorization-state": u.value?.state || "checking"
2176
+ }, [
2177
+ b(e(aa), {
2178
+ class: "authorization-card",
2179
+ padding: "lg",
2180
+ raised: "",
2181
+ "aria-label": W.value
2182
+ }, {
2183
+ default: s(() => [
2184
+ g("span", Jl, [
2185
+ (t(), h(Je(S.value?.state === "unavailable" || S.value?.state === "session_expired" ? e(sa) : e(he)), { class: "authorization-icon-glyph" }))
2186
+ ]),
2187
+ g("h1", Xl, l(W.value), 1),
2188
+ g("p", Gl, l(X.value), 1),
2189
+ A.value ? (t(), h(e(Q), {
2190
+ key: 0,
2191
+ class: "authorization-status",
2192
+ tone: ["grant_missing", "upgrade_reapproval"].includes(L.value) ? "info" : "warning",
2193
+ title: m.value("reason." + L.value)
2194
+ }, {
2195
+ default: s(() => [
2196
+ p(l(m.value(J.value)), 1)
2197
+ ]),
2198
+ _: 1
2199
+ }, 8, ["tone", "title"])) : y("", !0),
2200
+ i.value ? (t(), h(e(Q), {
2201
+ key: 1,
2202
+ class: "authorization-failed",
2203
+ tone: "warning"
2204
+ }, {
2205
+ default: s(() => [
2206
+ p(l(m.value("failed")), 1)
2207
+ ]),
2208
+ _: 1
2209
+ })) : y("", !0),
2210
+ g("div", Ql, [
2211
+ V.value ? (t(), h(e(z), {
2212
+ key: 0,
2213
+ variant: "primary",
2214
+ loading: n.value,
2215
+ disabled: n.value,
2216
+ onClick: q[0] || (q[0] = (O) => K("request"))
2217
+ }, {
2218
+ default: s(() => [
2219
+ p(l(n.value ? m.value("authorizing") : m.value("authorize")), 1)
2220
+ ]),
2221
+ _: 1
2222
+ }, 8, ["loading", "disabled"])) : (t(), h(e(z), {
2223
+ key: 1,
2224
+ variant: "primary",
2225
+ loading: n.value,
2226
+ disabled: n.value,
2227
+ onClick: q[1] || (q[1] = (O) => K("status"))
2228
+ }, {
2229
+ default: s(() => [
2230
+ p(l(n.value ? m.value("checking") : m.value("retry")), 1)
2231
+ ]),
2232
+ _: 1
2233
+ }, 8, ["loading", "disabled"]))
2234
+ ])
2235
+ ]),
2236
+ _: 1
2237
+ }, 8, ["aria-label"])
2238
+ ], 8, Kl)),
2239
+ b(e(Ve), {
2240
+ open: o.value,
2241
+ "onUpdate:open": q[5] || (q[5] = (O) => o.value = O),
2242
+ title: m.value("revoke.title"),
2243
+ description: m.value("revoke.body")
2244
+ }, {
2245
+ footer: s(() => [
2246
+ b(e(z), {
2247
+ variant: "secondary",
2248
+ onClick: q[3] || (q[3] = (O) => o.value = !1)
2249
+ }, {
2250
+ default: s(() => [
2251
+ p(l(m.value("cancel")), 1)
2252
+ ]),
2253
+ _: 1
2254
+ }),
2255
+ b(e(z), {
2256
+ variant: "danger",
2257
+ disabled: n.value,
2258
+ onClick: q[4] || (q[4] = (O) => {
2259
+ o.value = !1, K("revoke");
2260
+ })
2261
+ }, {
2262
+ default: s(() => [
2263
+ p(l(m.value("revoke")), 1)
2264
+ ]),
2265
+ _: 1
2266
+ }, 8, ["disabled"])
2267
+ ]),
2268
+ _: 1
2269
+ }, 8, ["open", "title", "description"])
2270
+ ], 64));
2271
+ }
2272
+ }), ct = /* @__PURE__ */ ue(Zl, [["__scopeId", "data-v-c8a34087"]]);
2273
+ export {
2274
+ nt as AppShell,
2275
+ ct as AuthorizationGate,
2276
+ ot as BackgroundPanel,
2277
+ vt as BackgroundSavePanel,
2278
+ dt as DelegatePanel,
2279
+ rt as ExecutorSettings,
2280
+ ua as ExecutorSetupKey,
2281
+ De as FileBrowser,
2282
+ st as FilesPage,
2283
+ it as LoginPage,
2284
+ ye as NasPicker,
2285
+ ut as PortalSettings,
2286
+ yt as activePage,
2287
+ mt as authorizationCatalogs,
2288
+ Me as authorizationCopy,
2289
+ bt as backgroundCatalogs,
2290
+ Re as backgroundCopy,
2291
+ Be as backgroundErrorCopy,
2292
+ kt as catalogs,
2293
+ Le as createBackgroundPickerProvider,
2294
+ _t as createBackgroundSaveFacade,
2295
+ gt as createFileTransfers,
2296
+ $e as createNasProvider,
2297
+ tt as createSession,
2298
+ ht as decodeResponse,
2299
+ wt as delegateCatalogs,
2300
+ xe as delegateCopy,
2301
+ Ct as encodeRequest,
2302
+ Fe as errorCopy,
2303
+ ve as format,
2304
+ $t as identityCatalogs,
2305
+ qe as identityCopy,
2306
+ xt as nasCatalogs,
2307
+ oe as nasCopy,
2308
+ we as nasErrorCopy,
2309
+ St as protocolCodes,
2310
+ zt as protocolOps,
2311
+ Vt as protocolSchemas,
2312
+ _e as requestKey,
2313
+ Ut as saveCatalogs,
2314
+ Ce as saveCopy,
2315
+ be as saveError,
2316
+ Ne as scopedPicker,
2317
+ Pt as shellCatalogs,
2318
+ Oe as shellCopy,
2319
+ Dt as shellPages,
2320
+ At as uiLocale,
2321
+ Et as uiLocales,
2322
+ ia as useExecutorSetup,
2323
+ oa as useNasRequest
2324
+ };