useblocks 1.1.62 → 1.1.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,48 +1,48 @@
1
- __useblocks__.define("static/core/d2fd1146.js", [
1
+ __useblocks__.define("static/core/7735c90f.js", [
2
2
  "require",
3
3
  "exports",
4
4
  "module",
5
- "static/core/3500cc9c.js",
6
- "static/core/585cff60.js",
7
- "static/core/8d78b13f.js",
8
- "static/core/40952073.js"
9
- ], function(I, F, z) {
10
- const h = I("./3500cc9c.js"), P = I("./585cff60.js"), S = I("./8d78b13f.js"), f = I("./40952073.js");
11
- var _;
12
- (function(l) {
13
- function e(s, i, n = (a, o) => a === o) {
14
- if (s === i) return !0;
15
- if (s.length !== i.length) return !1;
16
- for (let a = 0; a < s.length; a++) if (!n(s[a], i[a])) return !1;
5
+ "static/core/bcee99d6.js",
6
+ "static/core/6c0b4555.js",
7
+ "static/core/411c06d9.js",
8
+ "static/core/40f1c391.js"
9
+ ], function(_, I, z) {
10
+ const h = _("./bcee99d6.js"), P = _("./6c0b4555.js"), S = _("./411c06d9.js"), f = _("./40f1c391.js");
11
+ var F;
12
+ (function(d) {
13
+ function e(a, i, n = (s, o) => s === o) {
14
+ if (a === i) return !0;
15
+ if (a.length !== i.length) return !1;
16
+ for (let s = 0; s < a.length; s++) if (!n(a[s], i[s])) return !1;
17
17
  return !0;
18
18
  }
19
- l.isEqual = e;
20
- function t(s, i = (n) => n) {
19
+ d.isEqual = e;
20
+ function t(a, i = (n) => n) {
21
21
  const n = new Set();
22
- return s.filter((a) => {
23
- const o = i(a);
22
+ return a.filter((s) => {
23
+ const o = i(s);
24
24
  return n.has(o) ? !1 : (n.add(o), !0);
25
25
  });
26
26
  }
27
- l.unique = t;
28
- function r(s = [], i = [], n = (a, o) => a === o) {
29
- const a = [], o = [], p = [];
30
- for (const d of s) {
31
- const u = i.find((g) => n(d, g));
27
+ d.unique = t;
28
+ function r(a = [], i = [], n = (s, o) => s === o) {
29
+ const s = [], o = [], p = [];
30
+ for (const l of a) {
31
+ const u = i.find((g) => n(l, g));
32
32
  u ? p.push({
33
- prev: d,
33
+ prev: l,
34
34
  next: u
35
- }) : o.push(d);
35
+ }) : o.push(l);
36
36
  }
37
- for (const d of i) s.find((u) => n(d, u)) || a.push(d);
37
+ for (const l of i) a.find((u) => n(l, u)) || s.push(l);
38
38
  return {
39
- added: a,
39
+ added: s,
40
40
  removed: o,
41
41
  exists: p
42
42
  };
43
43
  }
44
- l.diff = r;
45
- })(_ || (_ = {}));
44
+ d.diff = r;
45
+ })(F || (F = {}));
46
46
  var c = class E extends Error {
47
47
  code;
48
48
  status;
@@ -50,53 +50,66 @@ __useblocks__.define("static/core/d2fd1146.js", [
50
50
  get httpStatus() {
51
51
  return this.status;
52
52
  }
53
- constructor(e, t, r, s) {
54
- super(e), this.name = "FileManagerApiError", this.code = t, this.status = r, this.details = s, Error.captureStackTrace && Error.captureStackTrace(this, E);
53
+ constructor(e, t, r, a) {
54
+ super(e), this.name = "FileManagerApiError", this.code = t, this.status = r, this.details = a, Error.captureStackTrace && Error.captureStackTrace(this, E);
55
55
  }
56
56
  };
57
- function y(l) {
58
- return l.replace(/\/+$/, "");
57
+ function y(d) {
58
+ return d.replace(/\/+$/, "");
59
59
  }
60
- function C(l, e) {
61
- const t = y(h.buildCdnFileUrl(e ?? {}, [])), r = y(l);
60
+ function C(d, e) {
61
+ const t = y(h.buildCdnFileUrl(e ?? {}, [])), r = y(d);
62
62
  if (!(!t || !r.startsWith(`${t}/`))) return r.slice(t.length + 1).split("/").filter(Boolean)[0];
63
63
  }
64
- function k(l, e = {}) {
64
+ function U(d, e = {}) {
65
65
  const t = e.projectId?.trim();
66
66
  if (!t) return !1;
67
- const r = h.unwrapResourceProxyUrl(l, e.appConfig, e.isStandalone);
67
+ const r = h.unwrapResourceProxyUrl(d, e.appConfig, e.isStandalone);
68
68
  return h.isCdnUrl(r, e.appConfig) ? C(r, e.appConfig) === t : !1;
69
69
  }
70
- function A(l, e = {}) {
71
- return h.unwrapResourceProxyUrl(l, e.appConfig, e.isStandalone);
70
+ function k(d, e = {}) {
71
+ return h.unwrapResourceProxyUrl(d, e.appConfig, e.isStandalone);
72
72
  }
73
- var w = 2e3, b = 30, M = w * b;
74
- function O(l) {
75
- return typeof l?.watchThumbnail == "function";
76
- }
77
- var T = 200, j = {
78
- validation_error: "ValidationError",
79
- unauthorized: "AuthenticationFailed",
80
- forbidden: "AuthorizationFailed",
81
- not_found: "FileNotFound",
82
- conflict: "FolderAlreadyExists",
83
- payload_too_large: "PayloadTooLarge",
84
- unsupported_media_type: "FileTypeNotAllowed",
85
- too_many_requests: "RateLimitExceeded",
86
- service_unavailable: "ServiceUnavailable",
87
- internal_error: "BackendError"
88
- }, U = {
89
- file: {
90
- not_found: "FileNotFound",
91
- conflict: "FileAlreadyExists"
92
- },
93
- folder: {
94
- not_found: "FolderNotFound",
95
- conflict: "FolderAlreadyExists"
96
- }
73
+ var b = {
74
+ "platform.validation": "ValidationError",
75
+ "platform.malformed_body": "ValidationError",
76
+ "platform.invalid_uuid": "ValidationError",
77
+ "platform.invalid_field_value": "ValidationError",
78
+ "platform.unauthorized": "AuthenticationFailed",
79
+ "platform.forbidden": "AuthorizationFailed",
80
+ "platform.not_found": "FileNotFound",
81
+ "platform.conflict": "FolderAlreadyExists",
82
+ "platform.payload_too_large": "PayloadTooLarge",
83
+ "platform.unsupported_media_type": "FileTypeNotAllowed",
84
+ "platform.too_many_requests": "RateLimitExceeded",
85
+ "platform.unavailable": "ServiceUnavailable",
86
+ "platform.internal": "BackendError",
87
+ "filemanager.file_not_found": "FileNotFound",
88
+ "filemanager.folder_not_found": "FolderNotFound",
89
+ "filemanager.file_exists": "FileAlreadyExists",
90
+ "filemanager.folder_exists": "FolderAlreadyExists",
91
+ "filemanager.invalid_file_name": "FileInvalidName",
92
+ "filemanager.invalid_folder_name": "FolderInvalidName",
93
+ "filemanager.item_not_found": "FileNotFound",
94
+ "filemanager.no_project_access": "AuthorizationFailed",
95
+ "filemanager.project_required": "ValidationError",
96
+ "filemanager.invalid_project_id": "ValidationError",
97
+ "filemanager.file_too_large": "FileTooLarge",
98
+ "filemanager.upload_too_large": "PayloadTooLarge",
99
+ "filemanager.no_files": "ValidationError",
100
+ "filemanager.batch_limit_exceeded": "BatchItemLimitExceeded",
101
+ "filemanager.too_many_items": "BatchItemLimitExceeded",
102
+ "filemanager.items_required": "ValidationError",
103
+ "filemanager.unsupported_file_type": "FileTypeNotAllowed",
104
+ "filemanager.upload_url_rejected": "UploadUrlInvalid",
105
+ "filemanager.transfer_into_descendant": "MoveIntoDescendant",
106
+ "filemanager.legacy_file_unsupported": "UnsupportedOperation",
107
+ "filemanager.backfill_unsupported": "UnsupportedOperation",
108
+ "filemanager.backfill_already_done": "UnsupportedOperation",
109
+ "filemanager.storage_unavailable": "ServiceUnavailable"
97
110
  };
98
- function v(l) {
99
- switch (l) {
111
+ function w(d) {
112
+ switch (d) {
100
113
  case 400: return "ValidationError";
101
114
  case 401: return "AuthenticationFailed";
102
115
  case 403: return "AuthorizationFailed";
@@ -110,7 +123,17 @@ __useblocks__.define("static/core/d2fd1146.js", [
110
123
  default: return "BackendError";
111
124
  }
112
125
  }
113
- var x = class m {
126
+ function x(d, e) {
127
+ return (d ? b[d] : void 0) ?? w(e);
128
+ }
129
+ function A(d) {
130
+ return (d ? b[d] : void 0) ?? "FileWriteError";
131
+ }
132
+ var v = 2e3, j = 30, M = v * j;
133
+ function O(d) {
134
+ return typeof d?.watchThumbnail == "function";
135
+ }
136
+ var T = 200, N = class m {
114
137
  pathMode = !1;
115
138
  rootId = "";
116
139
  trashPath = f.Xi;
@@ -133,46 +156,46 @@ __useblocks__.define("static/core/d2fd1146.js", [
133
156
  async getItems(e) {
134
157
  const t = e.folderId === f.Xi;
135
158
  if (e.itemType === "folder") return { items: await this.listFolders(e.folderId, t) };
136
- const r = e.itemType === "all" && (e.page ?? 1) <= 1, [s, i] = await Promise.all([r ? this.listFolders(e.folderId, t, e.search) : [], this.listFiles(e, t)]);
159
+ const r = e.itemType === "all" && (e.page ?? 1) <= 1, [a, i] = await Promise.all([r ? this.listFolders(e.folderId, t, e.search) : [], this.listFiles(e, t)]);
137
160
  return {
138
- items: [...s, ...i.items],
161
+ items: [...a, ...i.items],
139
162
  pagination: i.pagination
140
163
  };
141
164
  }
142
165
  async listFolders(e, t, r) {
143
- const s = await this.api.folders.foldersList({
166
+ const a = await this.api.folders.foldersList({
144
167
  project_id: this.projectId,
145
168
  parent_id: t ? void 0 : this.normalizeFolderId(e),
146
169
  trashed: t || void 0
147
170
  });
148
171
  try {
149
- this.assertOk(s, "folder");
172
+ this.assertOk(a);
150
173
  } catch (n) {
151
174
  if (m.isNotFound(n)) return [];
152
175
  throw n;
153
176
  }
154
- let i = (s.data.items ?? []).map((n) => this.mapFolder(n, e));
177
+ let i = (a.data.items ?? []).map((n) => this.mapFolder(n, e));
155
178
  if (r) {
156
179
  const n = r.toLowerCase();
157
- i = i.filter((a) => a.name.toLowerCase().includes(n));
180
+ i = i.filter((s) => s.name.toLowerCase().includes(n));
158
181
  }
159
182
  return i;
160
183
  }
161
184
  async listFiles(e, t) {
162
- const r = Math.min(e.limit ?? T, T), s = Math.max(e.page ?? 1, 1), i = await this.api.files.filesList({
185
+ const r = Math.min(e.limit ?? T, T), a = Math.max(e.page ?? 1, 1), i = await this.api.files.filesList({
163
186
  project_id: this.projectId,
164
187
  folder_id: t ? void 0 : this.normalizeFolderId(e.folderId),
165
188
  search: e.search || void 0,
166
189
  sort_by: e.sortBy,
167
190
  sort_order: e.sortOrder,
168
191
  limit: r,
169
- offset: (s - 1) * r,
192
+ offset: (a - 1) * r,
170
193
  trashed: t || void 0
171
194
  });
172
195
  try {
173
- this.assertOk(i, "folder");
174
- } catch (a) {
175
- if (m.isNotFound(a)) return {
196
+ this.assertOk(i);
197
+ } catch (s) {
198
+ if (m.isNotFound(s)) return {
176
199
  items: [],
177
200
  pagination: {
178
201
  page: 1,
@@ -183,12 +206,12 @@ __useblocks__.define("static/core/d2fd1146.js", [
183
206
  hasPrev: !1
184
207
  }
185
208
  };
186
- throw a;
209
+ throw s;
187
210
  }
188
211
  this.onIndexingStateChange?.(!!i.data.indexing);
189
212
  const n = t ? f.Xi : this.normalizeFolderId(e.folderId) ?? this.rootId;
190
213
  return {
191
- items: (i.data.data ?? []).map((a) => this.mapFile(a, n)),
214
+ items: (i.data.data ?? []).map((s) => this.mapFile(s, n)),
192
215
  pagination: this.mapPagination(i.data.page, r)
193
216
  };
194
217
  }
@@ -215,53 +238,53 @@ __useblocks__.define("static/core/d2fd1146.js", [
215
238
  };
216
239
  const t = new Map();
217
240
  e.items.forEach((i, n) => {
218
- const a = this.normalizeFolderId(i.folderId ?? e.folderId ?? void 0) ?? this.rootId, o = i.requestId ?? `item-${n}`, p = t.get(a) ?? [];
241
+ const s = this.normalizeFolderId(i.folderId ?? e.folderId ?? void 0) ?? this.rootId, o = i.requestId ?? `item-${n}`, p = t.get(s) ?? [];
219
242
  p.push({
220
243
  item: i,
221
244
  requestId: o
222
- }), t.set(a, p);
245
+ }), t.set(s, p);
223
246
  });
224
247
  const r = [];
225
248
  for (const [i, n] of t) {
226
- const a = new FormData();
227
- a.append("project_id", this.projectId), i !== this.rootId && a.append("folder_id", i);
228
- for (const { item: d, requestId: u } of n) a.append("request_id", u), a.append("file", d.data, d.name);
249
+ const s = new FormData();
250
+ s.append("project_id", this.projectId), i !== this.rootId && s.append("folder_id", i);
251
+ for (const { item: l, requestId: u } of n) s.append("request_id", u), s.append("file", l.data, l.name);
229
252
  let o;
230
253
  try {
231
254
  o = await this.api.request({
232
255
  path: "/files",
233
256
  method: "POST",
234
- body: a,
257
+ body: s,
235
258
  type: h.ContentType.FormData,
236
259
  format: "json",
237
260
  secure: !0
238
- }), this.assertOk(o, "file");
239
- } catch (d) {
261
+ }), this.assertOk(o);
262
+ } catch (l) {
240
263
  for (const { requestId: u } of n) r.push({
241
264
  requestId: u,
242
265
  success: !1,
243
- error: m.toErrorInfo(d)
266
+ error: m.toErrorInfo(l)
244
267
  });
245
268
  continue;
246
269
  }
247
- const p = new Map((o.data.items ?? []).map((d) => [d.request_id, d]));
248
- n.forEach(({ requestId: d }, u) => {
249
- const g = p.get(d) ?? o.data.items?.[u];
270
+ const p = new Map((o.data.items ?? []).map((l) => [l.request_id, l]));
271
+ n.forEach(({ requestId: l }, u) => {
272
+ const g = p.get(l) ?? o.data.items?.[u];
250
273
  g?.file ? r.push({
251
- requestId: d,
274
+ requestId: l,
252
275
  success: !0,
253
276
  data: this.mapFile(g.file, i)
254
277
  }) : r.push({
255
- requestId: d,
278
+ requestId: l,
256
279
  success: !1,
257
280
  error: this.mapItemFail(g?.error)
258
281
  });
259
282
  });
260
283
  }
261
- const s = r.filter((i) => !i.success);
284
+ const a = r.filter((i) => !i.success);
262
285
  return {
263
- success: s.length === 0,
264
- error: s[0]?.error,
286
+ success: a.length === 0,
287
+ error: a[0]?.error,
265
288
  detailed: r
266
289
  };
267
290
  }
@@ -282,8 +305,8 @@ __useblocks__.define("static/core/d2fd1146.js", [
282
305
  async updateFile(e, t) {
283
306
  let r = { id: e.id };
284
307
  if (t.data !== void 0) {
285
- const s = typeof t.data == "string" ? m.base64ToBlob(t.data, e.type) : t.data, i = new FormData();
286
- i.append("project_id", this.projectId), i.append("file", s, e.name);
308
+ const a = typeof t.data == "string" ? m.base64ToBlob(t.data, e.type) : t.data, i = new FormData();
309
+ i.append("project_id", this.projectId), i.append("file", a, e.name);
287
310
  const n = await this.api.request({
288
311
  path: `/files/${e.id}/content`,
289
312
  method: "PUT",
@@ -292,23 +315,23 @@ __useblocks__.define("static/core/d2fd1146.js", [
292
315
  format: "json",
293
316
  secure: !0
294
317
  });
295
- this.assertOk(n, "file");
296
- const a = n.data.file ?? {};
318
+ this.assertOk(n);
319
+ const s = n.data.file ?? {};
297
320
  r = {
298
321
  ...r,
299
- size: a.size,
300
- type: a.mime,
301
- url: a.url,
302
- thumbnail: a.thumbnail_url,
303
- thumbnailUrl: a.thumbnail_url,
304
- lastEdited: a.updated_at
322
+ size: s.size,
323
+ type: s.mime,
324
+ url: s.url,
325
+ thumbnail: s.thumbnail_url,
326
+ thumbnailUrl: s.thumbnail_url,
327
+ lastEdited: s.updated_at
305
328
  };
306
329
  }
307
330
  if (t.name && t.name !== e.name) {
308
- const s = await this.renameItem(e, t.name);
331
+ const a = await this.renameItem(e, t.name);
309
332
  r = {
310
333
  ...r,
311
- ...s
334
+ ...a
312
335
  };
313
336
  }
314
337
  return r;
@@ -316,26 +339,26 @@ __useblocks__.define("static/core/d2fd1146.js", [
316
339
  getFileData = async (e, t) => {
317
340
  const { __: r } = this.i18n;
318
341
  if (!e.url) throw new c(r("Failed to get file: %s").replace("%s", e.name), "FileReadError");
319
- const s = await h.fetchWithResourceProxy(e.url, {
342
+ const a = await h.fetchWithResourceProxy(e.url, {
320
343
  config: this.appConfig,
321
344
  standalone: this.isStandalone,
322
345
  resourceType: h.isCdnUrl(e.url, this.appConfig) ? "cdn" : "generic",
323
346
  intent: "downloadBlob",
324
347
  init: t?.forceReload ? { cache: "no-store" } : void 0
325
348
  });
326
- if (s.ok) return s.blob();
327
- throw new c(await s.text() || r("Failed to get file: %s").replace("%s", s.statusText), v(s.status), s.status);
349
+ if (a.ok) return a.blob();
350
+ throw new c(await a.text() || r("Failed to get file: %s").replace("%s", a.statusText), w(a.status), a.status);
328
351
  };
329
352
  static base64ToBlob(e, t) {
330
- const r = e.includes(",") ? e.slice(e.indexOf(",") + 1) : e, s = atob(r), i = new Uint8Array(s.length);
331
- for (let n = 0; n < s.length; n += 1) i[n] = s.charCodeAt(n);
353
+ const r = e.includes(",") ? e.slice(e.indexOf(",") + 1) : e, a = atob(r), i = new Uint8Array(a.length);
354
+ for (let n = 0; n < a.length; n += 1) i[n] = a.charCodeAt(n);
332
355
  return new Blob([i], t ? { type: t } : void 0);
333
356
  }
334
357
  mapItemFail(e) {
335
358
  const { __: t } = this.i18n;
336
359
  return {
337
360
  message: e?.message || t("Unknown error"),
338
- code: (e?.code ? j[e.code] : void 0) ?? "FileWriteError"
361
+ code: A(e?.code)
339
362
  };
340
363
  }
341
364
  async renameItem(e, t) {
@@ -344,7 +367,7 @@ __useblocks__.define("static/core/d2fd1146.js", [
344
367
  project_id: this.projectId,
345
368
  name: t
346
369
  });
347
- this.assertOk(i, "folder");
370
+ this.assertOk(i);
348
371
  const n = i.data.folder ?? {};
349
372
  return {
350
373
  id: e.id,
@@ -359,19 +382,19 @@ __useblocks__.define("static/core/d2fd1146.js", [
359
382
  name: t,
360
383
  mode: "replace"
361
384
  });
362
- this.assertOk(r, "file");
363
- const s = r.data.file ?? {};
385
+ this.assertOk(r);
386
+ const a = r.data.file ?? {};
364
387
  return {
365
388
  id: e.id,
366
- name: s.name ?? t,
367
- folderId: s.folder_id ?? e.folderId,
389
+ name: a.name ?? t,
390
+ folderId: a.folder_id ?? e.folderId,
368
391
  isFolder: !1,
369
- url: s.url,
370
- thumbnail: s.thumbnail_url,
371
- thumbnailUrl: s.thumbnail_url,
372
- extension: s.ext,
373
- type: s.mime,
374
- lastEdited: s.updated_at
392
+ url: a.url,
393
+ thumbnail: a.thumbnail_url,
394
+ thumbnailUrl: a.thumbnail_url,
395
+ extension: a.ext,
396
+ type: a.mime,
397
+ lastEdited: a.updated_at
375
398
  };
376
399
  }
377
400
  async deleteItem(e, t) {
@@ -382,14 +405,14 @@ __useblocks__.define("static/core/d2fd1146.js", [
382
405
  project_id: this.projectId,
383
406
  permanent: t.permanent || void 0
384
407
  });
385
- this.assertOk(r, "folder");
408
+ this.assertOk(r);
386
409
  } else {
387
410
  const r = await this.api.files.filesDelete({
388
411
  id: e.id,
389
412
  project_id: this.projectId,
390
413
  permanent: t.permanent || void 0
391
414
  });
392
- this.assertOk(r, "file");
415
+ this.assertOk(r);
393
416
  }
394
417
  } catch (r) {
395
418
  if (!m.isNotFound(r)) throw r;
@@ -397,29 +420,29 @@ __useblocks__.define("static/core/d2fd1146.js", [
397
420
  }
398
421
  async deleteItems(e, t) {
399
422
  if (e.length === 0) return { success: !0 };
400
- const r = new Set(e.filter((a) => a.isFolder).map((a) => a.id)), s = new Set(e.filter((a) => r.has(a.folderId))), i = [];
401
- for (const a of e) {
402
- if (s.has(a)) {
423
+ const r = new Set(e.filter((s) => s.isFolder).map((s) => s.id)), a = new Set(e.filter((s) => r.has(s.folderId))), i = [];
424
+ for (const s of e) {
425
+ if (a.has(s)) {
403
426
  i.push({
404
- requestId: a.id,
427
+ requestId: s.id,
405
428
  success: !0
406
429
  });
407
430
  continue;
408
431
  }
409
432
  try {
410
- await this.deleteItem(a, t), i.push({
411
- requestId: a.id,
433
+ await this.deleteItem(s, t), i.push({
434
+ requestId: s.id,
412
435
  success: !0
413
436
  });
414
437
  } catch (o) {
415
438
  i.push({
416
- requestId: a.id,
439
+ requestId: s.id,
417
440
  success: !1,
418
441
  error: m.toErrorInfo(o)
419
442
  });
420
443
  }
421
444
  }
422
- const n = i.filter((a) => !a.success);
445
+ const n = i.filter((s) => !s.success);
423
446
  return {
424
447
  success: n.length === 0,
425
448
  error: n[0]?.error,
@@ -431,25 +454,25 @@ __useblocks__.define("static/core/d2fd1146.js", [
431
454
  success: !0,
432
455
  detailed: []
433
456
  };
434
- const r = e.filter((a) => a.folderId === f.Xi), s = e.filter((a) => a.folderId !== f.Xi), i = [];
457
+ const r = e.filter((s) => s.folderId === f.Xi), a = e.filter((s) => s.folderId !== f.Xi), i = [];
435
458
  if (r.length > 0) {
436
- const a = await this.api.trash.restoreCreate({
459
+ const s = await this.api.trash.restoreCreate({
437
460
  project_id: this.projectId,
438
461
  ids: r.map((o) => o.id),
439
462
  target_folder_id: this.normalizeFolderId(t),
440
463
  on_conflict: "keep_both"
441
464
  });
442
- this.assertOk(a), i.push(...this.mapTransferResults(a.data.items, r));
465
+ this.assertOk(s), i.push(...this.mapTransferResults(s.data.items, r));
443
466
  }
444
- if (s.length > 0) {
445
- const a = await this.api.items.moveCreate({
467
+ if (a.length > 0) {
468
+ const s = await this.api.items.moveCreate({
446
469
  project_id: this.projectId,
447
- ids: s.map((o) => o.id),
470
+ ids: a.map((o) => o.id),
448
471
  target_folder_id: this.normalizeFolderId(t)
449
472
  });
450
- this.assertOk(a), i.push(...this.mapTransferResults(a.data.items, s));
473
+ this.assertOk(s), i.push(...this.mapTransferResults(s.data.items, a));
451
474
  }
452
- const n = i.filter((a) => !a.success);
475
+ const n = i.filter((s) => !s.success);
453
476
  return {
454
477
  success: n.length === 0,
455
478
  error: n[0]?.error,
@@ -470,11 +493,11 @@ __useblocks__.define("static/core/d2fd1146.js", [
470
493
  target_folder_id: this.normalizeFolderId(t)
471
494
  });
472
495
  this.assertOk(r);
473
- const s = this.mapTransferResults(r.data.items, e), i = s.filter((n) => !n.success);
496
+ const a = this.mapTransferResults(r.data.items, e), i = a.filter((n) => !n.success);
474
497
  return {
475
498
  success: i.length === 0,
476
499
  error: i[0]?.error,
477
- detailed: s
500
+ detailed: a
478
501
  };
479
502
  }
480
503
  async copyItem(e, t) {
@@ -497,35 +520,35 @@ __useblocks__.define("static/core/d2fd1146.js", [
497
520
  isStandalone: this.isStandalone,
498
521
  projectId: this.projectId
499
522
  };
500
- if (!k(e, r)) return;
501
- const s = A(e, r), i = P.decodeFileNameFromUrl(s);
523
+ if (!U(e, r)) return;
524
+ const a = k(e, r), i = P.decodeFileNameFromUrl(a);
502
525
  if (!i) return;
503
526
  const { items: n } = await this.listFiles({
504
527
  folderId: t,
505
528
  search: i
506
529
  }, !1);
507
- return n.find((a) => a.url === e || a.url === s);
530
+ return n.find((s) => s.url === e || s.url === a);
508
531
  }
509
532
  mapTransferResults(e, t) {
510
- const r = new Map(t.map((s) => [s.id, s]));
511
- return (e ?? []).map((s, i) => {
512
- const n = s.id ?? t[i]?.id, a = n ? r.get(n) : t[i];
513
- return s.error ? {
533
+ const r = new Map(t.map((a) => [a.id, a]));
534
+ return (e ?? []).map((a, i) => {
535
+ const n = a.id ?? t[i]?.id, s = n ? r.get(n) : t[i];
536
+ return a.error ? {
514
537
  requestId: n,
515
538
  success: !1,
516
- error: this.mapItemFail(s.error)
539
+ error: this.mapItemFail(a.error)
517
540
  } : {
518
541
  requestId: n,
519
542
  success: !0,
520
- data: s.file ? this.mapFile(s.file, s.file.folder_id ?? this.rootId) : s.folder ? this.mapFolder(s.folder) : a ? { id: a.id } : { id: n ?? "" }
543
+ data: a.file ? this.mapFile(a.file, a.file.folder_id ?? this.rootId) : a.folder ? this.mapFolder(a.folder) : s ? { id: s.id } : { id: n ?? "" }
521
544
  };
522
545
  });
523
546
  }
524
547
  unwrapSingleTransfer(e, t) {
525
548
  const r = e.detailed?.[0];
526
549
  if (!r?.success) {
527
- const s = r?.error ?? e.error;
528
- throw s instanceof c ? s : new c(String(s?.message ?? this.i18n.__("Unknown error")), s?.code || "BackendError", typeof s?.status == "number" ? s.status : void 0);
550
+ const a = r?.error ?? e.error;
551
+ throw a instanceof c ? a : new c(String(a?.message ?? this.i18n.__("Unknown error")), a?.code || "BackendError", typeof a?.status == "number" ? a.status : void 0);
529
552
  }
530
553
  return r.data ?? { id: t.id };
531
554
  }
@@ -560,8 +583,8 @@ __useblocks__.define("static/core/d2fd1146.js", [
560
583
  watchThumbnail(e, t) {
561
584
  const r = this.pendingThumbnails.get(e);
562
585
  if (!r) return () => {};
563
- const s = this.thumbWatchers.get(r);
564
- if (s) return s.listeners.add(t), () => s.listeners.delete(t);
586
+ const a = this.thumbWatchers.get(r);
587
+ if (a) return a.listeners.add(t), () => a.listeners.delete(t);
565
588
  const i = {
566
589
  listeners: new Set([t]),
567
590
  cancelled: !1
@@ -571,8 +594,8 @@ __useblocks__.define("static/core/d2fd1146.js", [
571
594
  };
572
595
  }
573
596
  async pollThumbnail(e, t, r) {
574
- for (let s = 0; s < b; s += 1) {
575
- if (await new Promise((n) => setTimeout(n, w)), r.cancelled) return;
597
+ for (let a = 0; a < j; a += 1) {
598
+ if (await new Promise((n) => setTimeout(n, v)), r.cancelled) return;
576
599
  let i;
577
600
  try {
578
601
  const n = await this.api.files.filesDetail({
@@ -601,23 +624,23 @@ __useblocks__.define("static/core/d2fd1146.js", [
601
624
  };
602
625
  }
603
626
  mapPagination(e, t) {
604
- const r = e?.limit ?? t, s = e?.offset ?? 0, i = e?.total ?? 0, n = r > 0 ? Math.floor(s / r) + 1 : 1, a = r > 0 ? Math.ceil(i / r) : 0;
627
+ const r = e?.limit ?? t, a = e?.offset ?? 0, i = e?.total ?? 0, n = r > 0 ? Math.floor(a / r) + 1 : 1, s = r > 0 ? Math.ceil(i / r) : 0;
605
628
  return {
606
629
  page: n,
607
630
  limit: r,
608
631
  total: i,
609
- totalPages: a,
610
- hasNext: n < a,
632
+ totalPages: s,
633
+ hasNext: n < s,
611
634
  hasPrev: n > 1
612
635
  };
613
636
  }
614
637
  normalizeFolderId(e) {
615
638
  if (!(!e || e === this.rootId)) return e;
616
639
  }
617
- assertOk(e, t) {
640
+ assertOk(e) {
618
641
  if (e.ok && !e.error) return;
619
- const { __: r } = this.i18n, s = e.error?.error, i = (s?.code && t ? U[t][s.code] : void 0) ?? (s?.code ? j[s.code] : void 0) ?? v(e.status);
620
- throw new c(s?.message || r("Unknown error"), i, e.status);
642
+ const { __: t } = this.i18n, r = e.error?.error, a = x(r?.code, e.status);
643
+ throw new c(r?.message || t("Unknown error"), a, e.status);
621
644
  }
622
645
  static isNotFound(e) {
623
646
  return e instanceof c && (e.code === "FileNotFound" || e.code === "FolderNotFound");
@@ -629,22 +652,22 @@ __useblocks__.define("static/core/d2fd1146.js", [
629
652
  };
630
653
  }
631
654
  };
632
- Object.defineProperty(F, "FileManagerApiError", {
655
+ Object.defineProperty(I, "FileManagerApiError", {
633
656
  enumerable: !0,
634
657
  get: function() {
635
658
  return c;
636
659
  }
637
- }), Object.defineProperty(F, "FileManagerRestApiProviderV2", {
660
+ }), Object.defineProperty(I, "FileManagerRestApiProviderV2", {
638
661
  enumerable: !0,
639
662
  get: function() {
640
- return x;
663
+ return N;
641
664
  }
642
- }), Object.defineProperty(F, "arrays", {
665
+ }), Object.defineProperty(I, "arrays", {
643
666
  enumerable: !0,
644
667
  get: function() {
645
- return _;
668
+ return F;
646
669
  }
647
- }), Object.defineProperty(F, "hasThumbnailWatcher", {
670
+ }), Object.defineProperty(I, "hasThumbnailWatcher", {
648
671
  enumerable: !0,
649
672
  get: function() {
650
673
  return O;