useblocks 1.1.49 → 1.1.53

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 (34) hide show
  1. package/iframe/js/amp.BP7EklKo.js +1 -1
  2. package/iframe/js/iframe-eblock.js +1 -1
  3. package/iframe/js/iframe.js +1 -1
  4. package/iframe/js/rules.4N5s3OV-.js +1 -1
  5. package/npm-publish.manifest.json +7 -7
  6. package/package.json +1 -1
  7. package/runtime/THIRD_PARTY_LICENSES.txt +1 -1
  8. package/singlepage_headless_plugin.html +1 -1
  9. package/static/core/{8c81db36.js → 139e4380.js} +3 -3
  10. package/static/core/{1ca5f3772.js → 1995fb0a2.js} +10 -10
  11. package/static/core/{3b4845f7.js → 1f5e1fc9.js} +321 -321
  12. package/static/core/{59023866.js → 31e98e6e.js} +616 -611
  13. package/static/core/{13f581cc.js → 5318562c.js} +3 -3
  14. package/static/core/{386cf7b3.js → 75737a9d.js} +5156 -5116
  15. package/static/core/{11296a18.js → 9929a348.js} +107 -107
  16. package/static/core/{e7c24fe9.js → b408f33a.js} +179 -173
  17. package/static/core/{3dea3b87.js → bc7e3d2b.js} +7 -7
  18. package/static/core/{de79e0c5.js → c3058168.js} +524 -510
  19. package/static/core/ce0410b1.js +467 -0
  20. package/static/core/{339377b8.js → d1eb3c68.js} +13244 -13200
  21. package/static/core/{8e110c69.js → dc1f9e4f.js} +31 -31
  22. package/static/core/{7a229b90.js → e1d239ab.js} +41 -41
  23. package/static/core/{aacf134d.js → e5e07f1d.js} +514 -494
  24. package/static/core/{acb049cb.js → ebd852b6.js} +1267 -1265
  25. package/static/core/{c59f9731.js → ee0ddb51.js} +4036 -3900
  26. package/static/core/{13d197af.js → f3cff4c9.js} +169 -169
  27. package/two_step_headless_plugin.html +1 -1
  28. package/ui-kit/index.js +49 -47
  29. package/{useblocks-core.15a9129c.js → useblocks-core.2a5dade1.js} +6 -6
  30. package/useblocks-esm.js +3 -3
  31. package/useblocks.js +3 -3
  32. package/static/core/a11c28c2.js +0 -467
  33. /package/iframe/{iframe-eblock.15a9129c.html → iframe-eblock.2a5dade1.html} +0 -0
  34. /package/iframe/{iframe.15a9129c.html → iframe.2a5dade1.html} +0 -0
@@ -1,15 +1,15 @@
1
- __useblocks__.define("static/core/e7c24fe9.js", [
1
+ __useblocks__.define("static/core/b408f33a.js", [
2
2
  "require",
3
3
  "exports",
4
4
  "module",
5
- "static/core/c59f9731.js",
6
- "static/core/13f581cc.js",
7
- "static/core/acb049cb.js",
8
- "static/core/386cf7b3.js",
9
- "static/core/1ca5f3772.js"
10
- ], function(g, F, M) {
11
- const h = g("./c59f9731.js"), v = g("./13f581cc.js"), E = g("./acb049cb.js"), f = g("./386cf7b3.js");
12
- g("./1ca5f3772.js");
5
+ "static/core/ee0ddb51.js",
6
+ "static/core/5318562c.js",
7
+ "static/core/ebd852b6.js",
8
+ "static/core/75737a9d.js",
9
+ "static/core/1995fb0a2.js"
10
+ ], function(g, F, B) {
11
+ const h = g("./ee0ddb51.js"), S = g("./5318562c.js"), P = g("./ebd852b6.js"), f = g("./75737a9d.js");
12
+ g("./1995fb0a2.js");
13
13
  var _;
14
14
  (function(l) {
15
15
  function e(s, a, n = (i, o) => i === o) {
@@ -19,15 +19,15 @@ __useblocks__.define("static/core/e7c24fe9.js", [
19
19
  return !0;
20
20
  }
21
21
  l.isEqual = e;
22
- function r(s, a = (n) => n) {
22
+ function t(s, a = (n) => n) {
23
23
  const n = new Set();
24
24
  return s.filter((i) => {
25
25
  const o = a(i);
26
26
  return n.has(o) ? !1 : (n.add(o), !0);
27
27
  });
28
28
  }
29
- l.unique = r;
30
- function t(s = [], a = [], n = (i, o) => i === o) {
29
+ l.unique = t;
30
+ function r(s = [], a = [], n = (i, o) => i === o) {
31
31
  const i = [], o = [], p = [];
32
32
  for (const d of s) {
33
33
  const u = a.find((I) => n(d, I));
@@ -43,40 +43,40 @@ __useblocks__.define("static/core/e7c24fe9.js", [
43
43
  exists: p
44
44
  };
45
45
  }
46
- l.diff = t;
46
+ l.diff = r;
47
47
  })(_ || (_ = {}));
48
- var c = class j extends Error {
48
+ var c = class E extends Error {
49
49
  code;
50
50
  status;
51
51
  details;
52
52
  get httpStatus() {
53
53
  return this.status;
54
54
  }
55
- constructor(e, r, t, s) {
56
- super(e), this.name = "FileManagerApiError", this.code = r, this.status = t, this.details = s, Error.captureStackTrace && Error.captureStackTrace(this, j);
55
+ constructor(e, t, r, s) {
56
+ super(e), this.name = "FileManagerApiError", this.code = t, this.status = r, this.details = s, Error.captureStackTrace && Error.captureStackTrace(this, E);
57
57
  }
58
58
  };
59
59
  function y(l) {
60
60
  return l.replace(/\/+$/, "");
61
61
  }
62
- function S(l, e) {
63
- const r = y(h.buildCdnFileUrl(e ?? {}, [])), t = y(l);
64
- if (!(!r || !t.startsWith(`${r}/`))) return t.slice(r.length + 1).split("/").filter(Boolean)[0];
62
+ function C(l, e) {
63
+ const t = y(h.buildCdnFileUrl(e ?? {}, [])), r = y(l);
64
+ if (!(!t || !r.startsWith(`${t}/`))) return r.slice(t.length + 1).split("/").filter(Boolean)[0];
65
65
  }
66
- function P(l, e = {}) {
67
- const r = e.projectId?.trim();
68
- if (!r) return !1;
69
- const t = h.unwrapResourceProxyUrl(l, e.appConfig, e.isStandalone);
70
- return h.isCdnUrl(t, e.appConfig) ? S(t, e.appConfig) === r : !1;
66
+ function U(l, e = {}) {
67
+ const t = e.projectId?.trim();
68
+ if (!t) return !1;
69
+ const r = h.unwrapResourceProxyUrl(l, e.appConfig, e.isStandalone);
70
+ return h.isCdnUrl(r, e.appConfig) ? C(r, e.appConfig) === t : !1;
71
71
  }
72
- function C(l, e = {}) {
72
+ function A(l, e = {}) {
73
73
  return h.unwrapResourceProxyUrl(l, e.appConfig, e.isStandalone);
74
74
  }
75
- var O = 2e3, k = 30;
76
- function U(l) {
75
+ var w = 2e3, b = 30, k = w * b;
76
+ function M(l) {
77
77
  return typeof l?.watchThumbnail == "function";
78
78
  }
79
- var w = 200, b = {
79
+ var j = 200, T = {
80
80
  validation_error: "ValidationError",
81
81
  unauthorized: "AuthenticationFailed",
82
82
  forbidden: "AuthorizationFailed",
@@ -87,7 +87,7 @@ __useblocks__.define("static/core/e7c24fe9.js", [
87
87
  too_many_requests: "RateLimitExceeded",
88
88
  service_unavailable: "ServiceUnavailable",
89
89
  internal_error: "BackendError"
90
- }, x = {
90
+ }, O = {
91
91
  file: {
92
92
  not_found: "FileNotFound",
93
93
  conflict: "FileAlreadyExists"
@@ -97,7 +97,7 @@ __useblocks__.define("static/core/e7c24fe9.js", [
97
97
  conflict: "FolderAlreadyExists"
98
98
  }
99
99
  };
100
- function T(l) {
100
+ function v(l) {
101
101
  switch (l) {
102
102
  case 400: return "ValidationError";
103
103
  case 401: return "AuthenticationFailed";
@@ -112,10 +112,10 @@ __useblocks__.define("static/core/e7c24fe9.js", [
112
112
  default: return "BackendError";
113
113
  }
114
114
  }
115
- var A = class m {
115
+ var x = class m {
116
116
  pathMode = !1;
117
117
  rootId = "";
118
- trashPath = f.Ts;
118
+ trashPath = f.Us;
119
119
  useSoftDelete = !1;
120
120
  api;
121
121
  projectId;
@@ -127,25 +127,25 @@ __useblocks__.define("static/core/e7c24fe9.js", [
127
127
  thumbWatchers = new Map();
128
128
  resolveSystemFolderByPath;
129
129
  constructor(e) {
130
- this.api = e.restApi, this.projectId = e.projectId, this.i18n = e.i18n ?? E.defaultI18nContext, this.appConfig = e.appConfig, this.isStandalone = e.isStandalone, this.onIndexingStateChange = e.onIndexingStateChange, this.resolveSystemFolderByPath = f.Us({ Trash: {
131
- id: f.Ts,
130
+ this.api = e.restApi, this.projectId = e.projectId, this.i18n = e.i18n ?? P.defaultI18nContext, this.appConfig = e.appConfig, this.isStandalone = e.isStandalone, this.onIndexingStateChange = e.onIndexingStateChange, this.resolveSystemFolderByPath = f.Bs({ Trash: {
131
+ id: f.Us,
132
132
  folderId: this.rootId
133
133
  } });
134
134
  }
135
135
  async getItems(e) {
136
- const r = e.folderId === f.Ts;
137
- if (e.itemType === "folder") return { items: await this.listFolders(e.folderId, r) };
138
- const t = e.itemType === "all" && (e.page ?? 1) <= 1, [s, a] = await Promise.all([t ? this.listFolders(e.folderId, r, e.search) : [], this.listFiles(e, r)]);
136
+ const t = e.folderId === f.Us;
137
+ if (e.itemType === "folder") return { items: await this.listFolders(e.folderId, t) };
138
+ const r = e.itemType === "all" && (e.page ?? 1) <= 1, [s, a] = await Promise.all([r ? this.listFolders(e.folderId, t, e.search) : [], this.listFiles(e, t)]);
139
139
  return {
140
140
  items: [...s, ...a.items],
141
141
  pagination: a.pagination
142
142
  };
143
143
  }
144
- async listFolders(e, r, t) {
144
+ async listFolders(e, t, r) {
145
145
  const s = await this.api.folders.foldersList({
146
146
  project_id: this.projectId,
147
- parent_id: r ? void 0 : this.normalizeFolderId(e),
148
- trashed: r || void 0
147
+ parent_id: t ? void 0 : this.normalizeFolderId(e),
148
+ trashed: t || void 0
149
149
  });
150
150
  try {
151
151
  this.assertOk(s, "folder");
@@ -154,22 +154,22 @@ __useblocks__.define("static/core/e7c24fe9.js", [
154
154
  throw n;
155
155
  }
156
156
  let a = (s.data.items ?? []).map((n) => this.mapFolder(n, e));
157
- if (t) {
158
- const n = t.toLowerCase();
157
+ if (r) {
158
+ const n = r.toLowerCase();
159
159
  a = a.filter((i) => i.name.toLowerCase().includes(n));
160
160
  }
161
161
  return a;
162
162
  }
163
- async listFiles(e, r) {
164
- const t = Math.min(e.limit ?? w, w), s = Math.max(e.page ?? 1, 1), a = await this.api.files.filesList({
163
+ async listFiles(e, t) {
164
+ const r = Math.min(e.limit ?? j, j), s = Math.max(e.page ?? 1, 1), a = await this.api.files.filesList({
165
165
  project_id: this.projectId,
166
- folder_id: r ? void 0 : this.normalizeFolderId(e.folderId),
166
+ folder_id: t ? void 0 : this.normalizeFolderId(e.folderId),
167
167
  search: e.search || void 0,
168
168
  sort_by: e.sortBy,
169
169
  sort_order: e.sortOrder,
170
- limit: t,
171
- offset: (s - 1) * t,
172
- trashed: r || void 0
170
+ limit: r,
171
+ offset: (s - 1) * r,
172
+ trashed: t || void 0
173
173
  });
174
174
  try {
175
175
  this.assertOk(a, "folder");
@@ -178,7 +178,7 @@ __useblocks__.define("static/core/e7c24fe9.js", [
178
178
  items: [],
179
179
  pagination: {
180
180
  page: 1,
181
- limit: t,
181
+ limit: r,
182
182
  total: 0,
183
183
  totalPages: 0,
184
184
  hasNext: !1,
@@ -188,43 +188,43 @@ __useblocks__.define("static/core/e7c24fe9.js", [
188
188
  throw i;
189
189
  }
190
190
  this.onIndexingStateChange?.(!!a.data.indexing);
191
- const n = r ? f.Ts : this.normalizeFolderId(e.folderId) ?? this.rootId;
191
+ const n = t ? f.Us : this.normalizeFolderId(e.folderId) ?? this.rootId;
192
192
  return {
193
193
  items: (a.data.data ?? []).map((i) => this.mapFile(i, n)),
194
- pagination: this.mapPagination(a.data.page, t)
194
+ pagination: this.mapPagination(a.data.page, r)
195
195
  };
196
196
  }
197
- async createFolder(e, r) {
198
- const t = await this.api.folders.foldersCreate({
197
+ async createFolder(e, t) {
198
+ const r = await this.api.folders.foldersCreate({
199
199
  project_id: this.projectId,
200
200
  name: e,
201
- parent_id: this.normalizeFolderId(r)
201
+ parent_id: this.normalizeFolderId(t)
202
202
  });
203
- return this.assertOk(t), this.mapFolder(t.data.folder ?? {}, r);
203
+ return this.assertOk(r), this.mapFolder(r.data.folder ?? {}, t);
204
204
  }
205
- async uploadFileByUrl(e, r) {
206
- const t = await this.api.files.uploadByUrlCreate({
205
+ async uploadFileByUrl(e, t) {
206
+ const r = await this.api.files.uploadByUrlCreate({
207
207
  project_id: this.projectId,
208
208
  url: e,
209
- folder_id: this.normalizeFolderId(r)
209
+ folder_id: this.normalizeFolderId(t)
210
210
  });
211
- return this.assertOk(t), this.mapFile(t.data.file ?? {}, this.normalizeFolderId(r) ?? this.rootId);
211
+ return this.assertOk(r), this.mapFile(r.data.file ?? {}, this.normalizeFolderId(t) ?? this.rootId);
212
212
  }
213
213
  async uploadFiles(e) {
214
214
  if (e.items.length === 0) return {
215
215
  success: !0,
216
216
  detailed: []
217
217
  };
218
- const r = new Map();
218
+ const t = new Map();
219
219
  e.items.forEach((a, n) => {
220
- const i = this.normalizeFolderId(a.folderId ?? e.folderId ?? void 0) ?? this.rootId, o = a.requestId ?? `item-${n}`, p = r.get(i) ?? [];
220
+ const i = this.normalizeFolderId(a.folderId ?? e.folderId ?? void 0) ?? this.rootId, o = a.requestId ?? `item-${n}`, p = t.get(i) ?? [];
221
221
  p.push({
222
222
  item: a,
223
223
  requestId: o
224
- }), r.set(i, p);
224
+ }), t.set(i, p);
225
225
  });
226
- const t = [];
227
- for (const [a, n] of r) {
226
+ const r = [];
227
+ for (const [a, n] of t) {
228
228
  const i = new FormData();
229
229
  i.append("project_id", this.projectId), a !== this.rootId && i.append("folder_id", a);
230
230
  for (const { item: d, requestId: u } of n) i.append("request_id", u), i.append("file", d.data, d.name);
@@ -239,7 +239,7 @@ __useblocks__.define("static/core/e7c24fe9.js", [
239
239
  secure: !0
240
240
  }), this.assertOk(o, "file");
241
241
  } catch (d) {
242
- for (const { requestId: u } of n) t.push({
242
+ for (const { requestId: u } of n) r.push({
243
243
  requestId: u,
244
244
  success: !1,
245
245
  error: m.toErrorInfo(d)
@@ -249,42 +249,42 @@ __useblocks__.define("static/core/e7c24fe9.js", [
249
249
  const p = new Map((o.data.items ?? []).map((d) => [d.request_id, d]));
250
250
  n.forEach(({ requestId: d }, u) => {
251
251
  const I = p.get(d) ?? o.data.items?.[u];
252
- I?.file ? t.push({
252
+ I?.file ? r.push({
253
253
  requestId: d,
254
254
  success: !0,
255
255
  data: this.mapFile(I.file, a)
256
- }) : t.push({
256
+ }) : r.push({
257
257
  requestId: d,
258
258
  success: !1,
259
259
  error: this.mapItemFail(I?.error)
260
260
  });
261
261
  });
262
262
  }
263
- const s = t.filter((a) => !a.success);
263
+ const s = r.filter((a) => !a.success);
264
264
  return {
265
265
  success: s.length === 0,
266
266
  error: s[0]?.error,
267
- detailed: t
267
+ detailed: r
268
268
  };
269
269
  }
270
270
  async uploadFile(e) {
271
- const r = (await this.uploadFiles({ items: [{
271
+ const t = (await this.uploadFiles({ items: [{
272
272
  name: e.name,
273
273
  size: e.size,
274
274
  type: e.type,
275
275
  folderId: e.folderId,
276
276
  data: e.data
277
277
  }] })).detailed?.[0];
278
- if (!r?.success || !r.data) {
279
- const t = r?.error;
280
- throw t instanceof c ? t : new c(String(t?.message ?? this.i18n.__("Unknown error")), t?.code || "FileWriteError", typeof t?.status == "number" ? t.status : void 0);
278
+ if (!t?.success || !t.data) {
279
+ const r = t?.error;
280
+ throw r instanceof c ? r : new c(String(r?.message ?? this.i18n.__("Unknown error")), r?.code || "FileWriteError", typeof r?.status == "number" ? r.status : void 0);
281
281
  }
282
- return r.data;
282
+ return t.data;
283
283
  }
284
- async updateFile(e, r) {
285
- let t = { id: e.id };
286
- if (r.data !== void 0) {
287
- const s = typeof r.data == "string" ? m.base64ToBlob(r.data, e.type) : r.data, a = new FormData();
284
+ async updateFile(e, t) {
285
+ let r = { id: e.id };
286
+ if (t.data !== void 0) {
287
+ const s = typeof t.data == "string" ? m.base64ToBlob(t.data, e.type) : t.data, a = new FormData();
288
288
  a.append("project_id", this.projectId), a.append("file", s, e.name);
289
289
  const n = await this.api.request({
290
290
  path: `/files/${e.id}/content`,
@@ -296,8 +296,8 @@ __useblocks__.define("static/core/e7c24fe9.js", [
296
296
  });
297
297
  this.assertOk(n, "file");
298
298
  const i = n.data.file ?? {};
299
- t = {
300
- ...t,
299
+ r = {
300
+ ...r,
301
301
  size: i.size,
302
302
  type: i.mime,
303
303
  url: i.url,
@@ -306,66 +306,66 @@ __useblocks__.define("static/core/e7c24fe9.js", [
306
306
  lastEdited: i.updated_at
307
307
  };
308
308
  }
309
- if (r.name && r.name !== e.name) {
310
- const s = await this.renameItem(e, r.name);
311
- t = {
312
- ...t,
309
+ if (t.name && t.name !== e.name) {
310
+ const s = await this.renameItem(e, t.name);
311
+ r = {
312
+ ...r,
313
313
  ...s
314
314
  };
315
315
  }
316
- return t;
316
+ return r;
317
317
  }
318
- getFileData = async (e, r) => {
319
- const { __: t } = this.i18n;
320
- if (!e.url) throw new c(t("Failed to get file: %s").replace("%s", e.name), "FileReadError");
318
+ getFileData = async (e, t) => {
319
+ const { __: r } = this.i18n;
320
+ if (!e.url) throw new c(r("Failed to get file: %s").replace("%s", e.name), "FileReadError");
321
321
  const s = await h.fetchWithResourceProxy(e.url, {
322
322
  config: this.appConfig,
323
323
  standalone: this.isStandalone,
324
324
  resourceType: h.isCdnUrl(e.url, this.appConfig) ? "cdn" : "generic",
325
325
  intent: "downloadBlob",
326
- init: r?.forceReload ? { cache: "no-store" } : void 0
326
+ init: t?.forceReload ? { cache: "no-store" } : void 0
327
327
  });
328
328
  if (s.ok) return s.blob();
329
- throw new c(await s.text() || t("Failed to get file: %s").replace("%s", s.statusText), T(s.status), s.status);
329
+ throw new c(await s.text() || r("Failed to get file: %s").replace("%s", s.statusText), v(s.status), s.status);
330
330
  };
331
- static base64ToBlob(e, r) {
332
- const t = e.includes(",") ? e.slice(e.indexOf(",") + 1) : e, s = atob(t), a = new Uint8Array(s.length);
331
+ static base64ToBlob(e, t) {
332
+ const r = e.includes(",") ? e.slice(e.indexOf(",") + 1) : e, s = atob(r), a = new Uint8Array(s.length);
333
333
  for (let n = 0; n < s.length; n += 1) a[n] = s.charCodeAt(n);
334
- return new Blob([a], r ? { type: r } : void 0);
334
+ return new Blob([a], t ? { type: t } : void 0);
335
335
  }
336
336
  mapItemFail(e) {
337
- const { __: r } = this.i18n;
337
+ const { __: t } = this.i18n;
338
338
  return {
339
- message: e?.message || r("Unknown error"),
340
- code: (e?.code ? b[e.code] : void 0) ?? "FileWriteError"
339
+ message: e?.message || t("Unknown error"),
340
+ code: (e?.code ? T[e.code] : void 0) ?? "FileWriteError"
341
341
  };
342
342
  }
343
- async renameItem(e, r) {
343
+ async renameItem(e, t) {
344
344
  if (e.isFolder) {
345
345
  const a = await this.api.folders.foldersPartialUpdate({ id: e.id }, {
346
346
  project_id: this.projectId,
347
- name: r
347
+ name: t
348
348
  });
349
349
  this.assertOk(a, "folder");
350
350
  const n = a.data.folder ?? {};
351
351
  return {
352
352
  id: e.id,
353
- name: n.name ?? r,
353
+ name: n.name ?? t,
354
354
  folderId: n.parent_id ?? e.folderId,
355
355
  isFolder: !0,
356
356
  lastEdited: n.updated_at
357
357
  };
358
358
  }
359
- const t = await this.api.files.filesPartialUpdate({ id: e.id }, {
359
+ const r = await this.api.files.filesPartialUpdate({ id: e.id }, {
360
360
  project_id: this.projectId,
361
- name: r,
361
+ name: t,
362
362
  mode: "replace"
363
363
  });
364
- this.assertOk(t, "file");
365
- const s = t.data.file ?? {};
364
+ this.assertOk(r, "file");
365
+ const s = r.data.file ?? {};
366
366
  return {
367
367
  id: e.id,
368
- name: s.name ?? r,
368
+ name: s.name ?? t,
369
369
  folderId: s.folder_id ?? e.folderId,
370
370
  isFolder: !1,
371
371
  url: s.url,
@@ -376,30 +376,30 @@ __useblocks__.define("static/core/e7c24fe9.js", [
376
376
  lastEdited: s.updated_at
377
377
  };
378
378
  }
379
- async deleteItem(e, r) {
379
+ async deleteItem(e, t) {
380
380
  try {
381
381
  if (e.isFolder) {
382
- const t = await this.api.folders.foldersDelete({
382
+ const r = await this.api.folders.foldersDelete({
383
383
  id: e.id,
384
384
  project_id: this.projectId,
385
- permanent: r.permanent || void 0
385
+ permanent: t.permanent || void 0
386
386
  });
387
- this.assertOk(t, "folder");
387
+ this.assertOk(r, "folder");
388
388
  } else {
389
- const t = await this.api.files.filesDelete({
389
+ const r = await this.api.files.filesDelete({
390
390
  id: e.id,
391
391
  project_id: this.projectId,
392
- permanent: r.permanent || void 0
392
+ permanent: t.permanent || void 0
393
393
  });
394
- this.assertOk(t, "file");
394
+ this.assertOk(r, "file");
395
395
  }
396
- } catch (t) {
397
- if (!m.isNotFound(t)) throw t;
396
+ } catch (r) {
397
+ if (!m.isNotFound(r)) throw r;
398
398
  }
399
399
  }
400
- async deleteItems(e, r) {
400
+ async deleteItems(e, t) {
401
401
  if (e.length === 0) return { success: !0 };
402
- const t = new Set(e.filter((i) => i.isFolder).map((i) => i.id)), s = new Set(e.filter((i) => t.has(i.folderId))), a = [];
402
+ const r = new Set(e.filter((i) => i.isFolder).map((i) => i.id)), s = new Set(e.filter((i) => r.has(i.folderId))), a = [];
403
403
  for (const i of e) {
404
404
  if (s.has(i)) {
405
405
  a.push({
@@ -409,7 +409,7 @@ __useblocks__.define("static/core/e7c24fe9.js", [
409
409
  continue;
410
410
  }
411
411
  try {
412
- await this.deleteItem(i, r), a.push({
412
+ await this.deleteItem(i, t), a.push({
413
413
  requestId: i.id,
414
414
  success: !0
415
415
  });
@@ -428,26 +428,26 @@ __useblocks__.define("static/core/e7c24fe9.js", [
428
428
  detailed: a
429
429
  };
430
430
  }
431
- async moveItems(e, r) {
431
+ async moveItems(e, t) {
432
432
  if (e.length === 0) return {
433
433
  success: !0,
434
434
  detailed: []
435
435
  };
436
- const t = e.filter((i) => i.folderId === f.Ts), s = e.filter((i) => i.folderId !== f.Ts), a = [];
437
- if (t.length > 0) {
436
+ const r = e.filter((i) => i.folderId === f.Us), s = e.filter((i) => i.folderId !== f.Us), a = [];
437
+ if (r.length > 0) {
438
438
  const i = await this.api.trash.restoreCreate({
439
439
  project_id: this.projectId,
440
- ids: t.map((o) => o.id),
441
- target_folder_id: this.normalizeFolderId(r),
440
+ ids: r.map((o) => o.id),
441
+ target_folder_id: this.normalizeFolderId(t),
442
442
  on_conflict: "keep_both"
443
443
  });
444
- this.assertOk(i), a.push(...this.mapTransferResults(i.data.items, t));
444
+ this.assertOk(i), a.push(...this.mapTransferResults(i.data.items, r));
445
445
  }
446
446
  if (s.length > 0) {
447
447
  const i = await this.api.items.moveCreate({
448
448
  project_id: this.projectId,
449
449
  ids: s.map((o) => o.id),
450
- target_folder_id: this.normalizeFolderId(r)
450
+ target_folder_id: this.normalizeFolderId(t)
451
451
  });
452
452
  this.assertOk(i), a.push(...this.mapTransferResults(i.data.items, s));
453
453
  }
@@ -458,29 +458,29 @@ __useblocks__.define("static/core/e7c24fe9.js", [
458
458
  detailed: a
459
459
  };
460
460
  }
461
- async moveItem(e, r) {
462
- return this.unwrapSingleTransfer(await this.moveItems([e], r), e);
461
+ async moveItem(e, t) {
462
+ return this.unwrapSingleTransfer(await this.moveItems([e], t), e);
463
463
  }
464
- async copyItems(e, r) {
464
+ async copyItems(e, t) {
465
465
  if (e.length === 0) return {
466
466
  success: !0,
467
467
  detailed: []
468
468
  };
469
- const t = await this.api.items.copyCreate({
469
+ const r = await this.api.items.copyCreate({
470
470
  project_id: this.projectId,
471
471
  ids: e.map((n) => n.id),
472
- target_folder_id: this.normalizeFolderId(r)
472
+ target_folder_id: this.normalizeFolderId(t)
473
473
  });
474
- this.assertOk(t);
475
- const s = this.mapTransferResults(t.data.items, e), a = s.filter((n) => !n.success);
474
+ this.assertOk(r);
475
+ const s = this.mapTransferResults(r.data.items, e), a = s.filter((n) => !n.success);
476
476
  return {
477
477
  success: a.length === 0,
478
478
  error: a[0]?.error,
479
479
  detailed: s
480
480
  };
481
481
  }
482
- async copyItem(e, r) {
483
- return this.unwrapSingleTransfer(await this.copyItems([e], r), e);
482
+ async copyItem(e, t) {
483
+ return this.unwrapSingleTransfer(await this.copyItems([e], t), e);
484
484
  }
485
485
  async cleanTrash() {
486
486
  const e = await this.api.trash.emptyCreate({ project_id: this.projectId });
@@ -493,25 +493,25 @@ __useblocks__.define("static/core/e7c24fe9.js", [
493
493
  findItemByPath(e) {
494
494
  return this.resolveSystemFolderByPath(e);
495
495
  }
496
- async findFileByUrl(e, r) {
497
- const t = {
496
+ async findFileByUrl(e, t) {
497
+ const r = {
498
498
  appConfig: this.appConfig,
499
499
  isStandalone: this.isStandalone,
500
500
  projectId: this.projectId
501
501
  };
502
- if (!P(e, t)) return;
503
- const s = C(e, t), a = v.decodeFileNameFromUrl(s);
502
+ if (!U(e, r)) return;
503
+ const s = A(e, r), a = S.decodeFileNameFromUrl(s);
504
504
  if (!a) return;
505
505
  const { items: n } = await this.listFiles({
506
- folderId: r,
506
+ folderId: t,
507
507
  search: a
508
508
  }, !1);
509
509
  return n.find((i) => i.url === e || i.url === s);
510
510
  }
511
- mapTransferResults(e, r) {
512
- const t = new Map(r.map((s) => [s.id, s]));
511
+ mapTransferResults(e, t) {
512
+ const r = new Map(t.map((s) => [s.id, s]));
513
513
  return (e ?? []).map((s, a) => {
514
- const n = s.id ?? r[a]?.id, i = n ? t.get(n) : r[a];
514
+ const n = s.id ?? t[a]?.id, i = n ? r.get(n) : t[a];
515
515
  return s.error ? {
516
516
  requestId: n,
517
517
  success: !1,
@@ -523,19 +523,19 @@ __useblocks__.define("static/core/e7c24fe9.js", [
523
523
  };
524
524
  });
525
525
  }
526
- unwrapSingleTransfer(e, r) {
527
- const t = e.detailed?.[0];
528
- if (!t?.success) {
529
- const s = t?.error ?? e.error;
526
+ unwrapSingleTransfer(e, t) {
527
+ const r = e.detailed?.[0];
528
+ if (!r?.success) {
529
+ const s = r?.error ?? e.error;
530
530
  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);
531
531
  }
532
- return t.data ?? { id: r.id };
532
+ return r.data ?? { id: t.id };
533
533
  }
534
- mapFile(e, r) {
534
+ mapFile(e, t) {
535
535
  return this.trackThumbnailReadiness(e), {
536
536
  id: e.id ?? "",
537
537
  name: e.name ?? "",
538
- folderId: e.folder_id ?? r,
538
+ folderId: e.folder_id ?? t,
539
539
  isFolder: !1,
540
540
  size: e.size,
541
541
  date: e.created_at,
@@ -551,24 +551,30 @@ __useblocks__.define("static/core/e7c24fe9.js", [
551
551
  };
552
552
  }
553
553
  trackThumbnailReadiness(e) {
554
- !e.id || !e.url || !e.mime?.startsWith("image/") || (e.thumbnail_url ? this.pendingThumbnails.delete(e.url) : this.pendingThumbnails.set(e.url, e.id));
555
- }
556
- watchThumbnail(e, r) {
557
- const t = this.pendingThumbnails.get(e);
558
- if (!t) return () => {};
559
- const s = this.thumbWatchers.get(t);
560
- if (s) return s.listeners.add(r), () => s.listeners.delete(r);
554
+ if (!e.id || !e.url || !e.mime?.startsWith("image/")) return;
555
+ if (e.thumbnail_url) {
556
+ this.pendingThumbnails.delete(e.url);
557
+ return;
558
+ }
559
+ const t = e.created_at ? new Date(e.created_at).getTime() : NaN;
560
+ Number.isFinite(t) && Date.now() - t < k ? this.pendingThumbnails.set(e.url, e.id) : this.pendingThumbnails.delete(e.url);
561
+ }
562
+ watchThumbnail(e, t) {
563
+ const r = this.pendingThumbnails.get(e);
564
+ if (!r) return () => {};
565
+ const s = this.thumbWatchers.get(r);
566
+ if (s) return s.listeners.add(t), () => s.listeners.delete(t);
561
567
  const a = {
562
- listeners: new Set([r]),
568
+ listeners: new Set([t]),
563
569
  cancelled: !1
564
570
  };
565
- return this.thumbWatchers.set(t, a), this.pollThumbnail(t, e, a), () => {
566
- a.listeners.delete(r), a.listeners.size === 0 && (a.cancelled = !0, this.thumbWatchers.delete(t));
571
+ return this.thumbWatchers.set(r, a), this.pollThumbnail(r, e, a), () => {
572
+ a.listeners.delete(t), a.listeners.size === 0 && (a.cancelled = !0, this.thumbWatchers.delete(r));
567
573
  };
568
574
  }
569
- async pollThumbnail(e, r, t) {
570
- for (let s = 0; s < k; s += 1) {
571
- if (await new Promise((n) => setTimeout(n, O)), t.cancelled) return;
575
+ async pollThumbnail(e, t, r) {
576
+ for (let s = 0; s < b; s += 1) {
577
+ if (await new Promise((n) => setTimeout(n, w)), r.cancelled) return;
572
578
  let a;
573
579
  try {
574
580
  const n = await this.api.files.filesDetail({
@@ -577,30 +583,30 @@ __useblocks__.define("static/core/e7c24fe9.js", [
577
583
  });
578
584
  n.ok && !n.error && (a = n.data.file?.thumbnail_url);
579
585
  } catch {}
580
- if (t.cancelled) return;
586
+ if (r.cancelled) return;
581
587
  if (a) {
582
- this.pendingThumbnails.delete(r), this.thumbWatchers.delete(e), t.listeners.forEach((n) => n(a));
588
+ this.pendingThumbnails.delete(t), this.thumbWatchers.delete(e), r.listeners.forEach((n) => n(a));
583
589
  return;
584
590
  }
585
591
  }
586
- this.thumbWatchers.delete(e);
592
+ this.thumbWatchers.delete(e), this.pendingThumbnails.delete(t);
587
593
  }
588
- mapFolder(e, r) {
594
+ mapFolder(e, t) {
589
595
  return {
590
596
  id: e.id ?? "",
591
597
  name: e.name ?? "",
592
- folderId: e.parent_id ?? this.normalizeFolderId(r) ?? this.rootId,
598
+ folderId: e.parent_id ?? this.normalizeFolderId(t) ?? this.rootId,
593
599
  isFolder: !0,
594
600
  date: e.created_at,
595
601
  lastEdited: e.updated_at,
596
602
  selected: !1
597
603
  };
598
604
  }
599
- mapPagination(e, r) {
600
- const t = e?.limit ?? r, s = e?.offset ?? 0, a = e?.total ?? 0, n = t > 0 ? Math.floor(s / t) + 1 : 1, i = t > 0 ? Math.ceil(a / t) : 0;
605
+ mapPagination(e, t) {
606
+ const r = e?.limit ?? t, s = e?.offset ?? 0, a = e?.total ?? 0, n = r > 0 ? Math.floor(s / r) + 1 : 1, i = r > 0 ? Math.ceil(a / r) : 0;
601
607
  return {
602
608
  page: n,
603
- limit: t,
609
+ limit: r,
604
610
  total: a,
605
611
  totalPages: i,
606
612
  hasNext: n < i,
@@ -610,10 +616,10 @@ __useblocks__.define("static/core/e7c24fe9.js", [
610
616
  normalizeFolderId(e) {
611
617
  if (!(!e || e === this.rootId)) return e;
612
618
  }
613
- assertOk(e, r) {
619
+ assertOk(e, t) {
614
620
  if (e.ok && !e.error) return;
615
- const { __: t } = this.i18n, s = e.error?.error, a = (s?.code && r ? x[r][s.code] : void 0) ?? (s?.code ? b[s.code] : void 0) ?? T(e.status);
616
- throw new c(s?.message || t("Unknown error"), a, e.status);
621
+ const { __: r } = this.i18n, s = e.error?.error, a = (s?.code && t ? O[t][s.code] : void 0) ?? (s?.code ? T[s.code] : void 0) ?? v(e.status);
622
+ throw new c(s?.message || r("Unknown error"), a, e.status);
617
623
  }
618
624
  static isNotFound(e) {
619
625
  return e instanceof c && (e.code === "FileNotFound" || e.code === "FolderNotFound");
@@ -633,7 +639,7 @@ __useblocks__.define("static/core/e7c24fe9.js", [
633
639
  }), Object.defineProperty(F, "FileManagerRestApiProviderV2", {
634
640
  enumerable: !0,
635
641
  get: function() {
636
- return A;
642
+ return x;
637
643
  }
638
644
  }), Object.defineProperty(F, "arrays", {
639
645
  enumerable: !0,
@@ -643,7 +649,7 @@ __useblocks__.define("static/core/e7c24fe9.js", [
643
649
  }), Object.defineProperty(F, "hasThumbnailWatcher", {
644
650
  enumerable: !0,
645
651
  get: function() {
646
- return U;
652
+ return M;
647
653
  }
648
654
  });
649
655
  });