useblocks 1.1.46 → 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 (82) hide show
  1. package/iframe/js/amp.BP7EklKo.js +1 -0
  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/monacoeditorwork/css.worker.bundle.js +40524 -40442
  6. package/monacoeditorwork/editor.worker.bundle.js +9740 -9697
  7. package/monacoeditorwork/html.worker.bundle.js +50513 -50431
  8. package/monacoeditorwork/json.worker.bundle.js +14570 -14527
  9. package/monacoeditorwork/ts.worker.bundle.js +119593 -119455
  10. package/npm-publish.manifest.json +7 -7
  11. package/package.json +1 -1
  12. package/runtime/@ant-design/cssinjs/index.js +1 -1
  13. package/runtime/@ant-design/icons/index.js +2 -2
  14. package/runtime/README.md +1 -1
  15. package/runtime/THIRD_PARTY_LICENSES.txt +71 -43
  16. package/runtime/antd/index.js +1 -1
  17. package/runtime/react/index.js +3 -3
  18. package/runtime/react/jsx-runtime/index.js +1 -1
  19. package/runtime/react-dom/client/index.js +4 -4
  20. package/runtime/react-dom/index.js +3 -3
  21. package/runtime/react-router-dom/index.js +2 -2
  22. package/singlepage_headless_plugin.html +1 -1
  23. package/static/core/{6b8432a3.js → 139e4380.js} +3 -3
  24. package/static/core/{90ec6d2b2.js → 1995fb0a2.js} +182 -153
  25. package/static/core/{6df04323.js → 1f5e1fc9.js} +573 -554
  26. package/static/core/31e98e6e.js +2095 -0
  27. package/static/core/5318562c.js +924 -0
  28. package/static/core/{6e2d88d5.js → 75737a9d.js} +6209 -6155
  29. package/static/core/{cc8f145d.js → 9929a348.js} +64 -64
  30. package/static/core/b408f33a.js +655 -0
  31. package/static/core/{526b23c2.js → bc7e3d2b.js} +7 -7
  32. package/static/core/{4eb628d3.js → c3058168.js} +3958 -3702
  33. package/static/core/ce0410b1.js +467 -0
  34. package/static/core/{b9529b8a.js → d1eb3c68.js} +17060 -16835
  35. package/static/core/{b8b730b2.js → dc1f9e4f.js} +17 -17
  36. package/static/core/{4a2af478.js → e1d239ab.js} +41 -41
  37. package/static/core/{9c1c1b89.js → e5e07f1d.js} +856 -755
  38. package/static/core/{350eac23.js → ebd852b6.js} +1756 -1702
  39. package/static/core/{cefd6620.js → ee0ddb51.js} +7782 -6601
  40. package/static/core/{a321a57d.js → f3cff4c9.js} +159 -159
  41. package/static/esm/{dab4cdfd.js → 448d4bb0.js} +70 -70
  42. package/static/esm/{7c5227f0.js → d180c108.js} +50 -47
  43. package/static/runtime/{DownloadOutlined-CgJ8OpH_.js → DownloadOutlined-Dg_G2xO7.js} +4 -4
  44. package/static/runtime/client-CfXgU5Vo.js +7580 -0
  45. package/static/runtime/{defineProperty-B-FyVNQF.js → defineProperty-C_9hhJHt.js} +1 -1
  46. package/static/runtime/dom-export-CHgQ7Ws9.js +8069 -0
  47. package/static/runtime/{es-DnZp8dh1.js → es-BPfImJ0x.js} +5 -5
  48. package/static/runtime/{es-B2DS-PLP.js → es-DcH6fwd6.js} +2 -2
  49. package/static/runtime/{es-deqzngIL.js → es-_OY-D9g1.js} +2 -2
  50. package/static/runtime/{jsx-dev-runtime-Wj1_6O79.js → jsx-dev-runtime-DDukXY54.js} +2 -2
  51. package/static/runtime/jsx-runtime-BodCQYDg.js +22 -0
  52. package/static/runtime/react-BHNx_xzv.js +290 -0
  53. package/static/runtime/react-dom-CyByzibb.js +127 -0
  54. package/two_step_headless_plugin.html +1 -1
  55. package/ui-kit/index.js +49 -47
  56. package/{useblocks-core.2116f1b9.js → useblocks-core.2a5dade1.js} +82 -76
  57. package/useblocks-esm.js +628 -3198
  58. package/useblocks.d.ts +184 -52
  59. package/useblocks.js +818 -12588
  60. package/vite/index.cjs +46 -21
  61. package/vite/index.d.ts +0 -1
  62. package/vite/index.js +46 -21
  63. package/vite/pluginDev/index.d.ts +0 -1
  64. package/webpack/index.cjs +46 -21
  65. package/webpack/index.d.ts +0 -1
  66. package/webpack/index.js +46 -21
  67. package/webpack/pluginDev/index.d.ts +0 -1
  68. package/iframe/js/amp.CVC2Iq48.js +0 -1
  69. package/static/core/35e13192.js +0 -463
  70. package/static/core/9421a704.js +0 -869
  71. package/static/core/9c79239d.js +0 -2063
  72. package/static/core/df0652cc.js +0 -1119
  73. package/static/esm/2fb07398.js +0 -3480
  74. package/static/esm/352121c5.js +0 -55
  75. package/static/esm/64966e1c.js +0 -18
  76. package/static/runtime/client-CM3WFcip.js +0 -7
  77. package/static/runtime/dist-DUS42Hru.js +0 -3421
  78. package/static/runtime/jsx-runtime-DmPQfqtr.js +0 -28
  79. package/static/runtime/react-DIf5CLST.js +0 -258
  80. package/static/runtime/react-dom-Cc3IcUkg.js +0 -5604
  81. /package/iframe/{iframe-eblock.2116f1b9.html → iframe-eblock.2a5dade1.html} +0 -0
  82. /package/iframe/{iframe.2116f1b9.html → iframe.2a5dade1.html} +0 -0
@@ -0,0 +1,655 @@
1
+ __useblocks__.define("static/core/b408f33a.js", [
2
+ "require",
3
+ "exports",
4
+ "module",
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
+ var _;
14
+ (function(l) {
15
+ function e(s, a, n = (i, o) => i === o) {
16
+ if (s === a) return !0;
17
+ if (s.length !== a.length) return !1;
18
+ for (let i = 0; i < s.length; i++) if (!n(s[i], a[i])) return !1;
19
+ return !0;
20
+ }
21
+ l.isEqual = e;
22
+ function t(s, a = (n) => n) {
23
+ const n = new Set();
24
+ return s.filter((i) => {
25
+ const o = a(i);
26
+ return n.has(o) ? !1 : (n.add(o), !0);
27
+ });
28
+ }
29
+ l.unique = t;
30
+ function r(s = [], a = [], n = (i, o) => i === o) {
31
+ const i = [], o = [], p = [];
32
+ for (const d of s) {
33
+ const u = a.find((I) => n(d, I));
34
+ u ? p.push({
35
+ prev: d,
36
+ next: u
37
+ }) : o.push(d);
38
+ }
39
+ for (const d of a) s.find((u) => n(d, u)) || i.push(d);
40
+ return {
41
+ added: i,
42
+ removed: o,
43
+ exists: p
44
+ };
45
+ }
46
+ l.diff = r;
47
+ })(_ || (_ = {}));
48
+ var c = class E extends Error {
49
+ code;
50
+ status;
51
+ details;
52
+ get httpStatus() {
53
+ return this.status;
54
+ }
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
+ }
58
+ };
59
+ function y(l) {
60
+ return l.replace(/\/+$/, "");
61
+ }
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
+ }
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
+ }
72
+ function A(l, e = {}) {
73
+ return h.unwrapResourceProxyUrl(l, e.appConfig, e.isStandalone);
74
+ }
75
+ var w = 2e3, b = 30, k = w * b;
76
+ function M(l) {
77
+ return typeof l?.watchThumbnail == "function";
78
+ }
79
+ var j = 200, T = {
80
+ validation_error: "ValidationError",
81
+ unauthorized: "AuthenticationFailed",
82
+ forbidden: "AuthorizationFailed",
83
+ not_found: "FileNotFound",
84
+ conflict: "FolderAlreadyExists",
85
+ payload_too_large: "PayloadTooLarge",
86
+ unsupported_media_type: "FileTypeNotAllowed",
87
+ too_many_requests: "RateLimitExceeded",
88
+ service_unavailable: "ServiceUnavailable",
89
+ internal_error: "BackendError"
90
+ }, O = {
91
+ file: {
92
+ not_found: "FileNotFound",
93
+ conflict: "FileAlreadyExists"
94
+ },
95
+ folder: {
96
+ not_found: "FolderNotFound",
97
+ conflict: "FolderAlreadyExists"
98
+ }
99
+ };
100
+ function v(l) {
101
+ switch (l) {
102
+ case 400: return "ValidationError";
103
+ case 401: return "AuthenticationFailed";
104
+ case 403: return "AuthorizationFailed";
105
+ case 404: return "FileNotFound";
106
+ case 409: return "FolderAlreadyExists";
107
+ case 413: return "PayloadTooLarge";
108
+ case 415: return "FileTypeNotAllowed";
109
+ case 429: return "RateLimitExceeded";
110
+ case 503: return "ServiceUnavailable";
111
+ case 504: return "Timeout";
112
+ default: return "BackendError";
113
+ }
114
+ }
115
+ var x = class m {
116
+ pathMode = !1;
117
+ rootId = "";
118
+ trashPath = f.Us;
119
+ useSoftDelete = !1;
120
+ api;
121
+ projectId;
122
+ i18n;
123
+ appConfig;
124
+ isStandalone;
125
+ onIndexingStateChange;
126
+ pendingThumbnails = new Map();
127
+ thumbWatchers = new Map();
128
+ resolveSystemFolderByPath;
129
+ constructor(e) {
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
+ folderId: this.rootId
133
+ } });
134
+ }
135
+ async getItems(e) {
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
+ return {
140
+ items: [...s, ...a.items],
141
+ pagination: a.pagination
142
+ };
143
+ }
144
+ async listFolders(e, t, r) {
145
+ const s = await this.api.folders.foldersList({
146
+ project_id: this.projectId,
147
+ parent_id: t ? void 0 : this.normalizeFolderId(e),
148
+ trashed: t || void 0
149
+ });
150
+ try {
151
+ this.assertOk(s, "folder");
152
+ } catch (n) {
153
+ if (m.isNotFound(n)) return [];
154
+ throw n;
155
+ }
156
+ let a = (s.data.items ?? []).map((n) => this.mapFolder(n, e));
157
+ if (r) {
158
+ const n = r.toLowerCase();
159
+ a = a.filter((i) => i.name.toLowerCase().includes(n));
160
+ }
161
+ return a;
162
+ }
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
+ project_id: this.projectId,
166
+ folder_id: t ? void 0 : this.normalizeFolderId(e.folderId),
167
+ search: e.search || void 0,
168
+ sort_by: e.sortBy,
169
+ sort_order: e.sortOrder,
170
+ limit: r,
171
+ offset: (s - 1) * r,
172
+ trashed: t || void 0
173
+ });
174
+ try {
175
+ this.assertOk(a, "folder");
176
+ } catch (i) {
177
+ if (m.isNotFound(i)) return {
178
+ items: [],
179
+ pagination: {
180
+ page: 1,
181
+ limit: r,
182
+ total: 0,
183
+ totalPages: 0,
184
+ hasNext: !1,
185
+ hasPrev: !1
186
+ }
187
+ };
188
+ throw i;
189
+ }
190
+ this.onIndexingStateChange?.(!!a.data.indexing);
191
+ const n = t ? f.Us : this.normalizeFolderId(e.folderId) ?? this.rootId;
192
+ return {
193
+ items: (a.data.data ?? []).map((i) => this.mapFile(i, n)),
194
+ pagination: this.mapPagination(a.data.page, r)
195
+ };
196
+ }
197
+ async createFolder(e, t) {
198
+ const r = await this.api.folders.foldersCreate({
199
+ project_id: this.projectId,
200
+ name: e,
201
+ parent_id: this.normalizeFolderId(t)
202
+ });
203
+ return this.assertOk(r), this.mapFolder(r.data.folder ?? {}, t);
204
+ }
205
+ async uploadFileByUrl(e, t) {
206
+ const r = await this.api.files.uploadByUrlCreate({
207
+ project_id: this.projectId,
208
+ url: e,
209
+ folder_id: this.normalizeFolderId(t)
210
+ });
211
+ return this.assertOk(r), this.mapFile(r.data.file ?? {}, this.normalizeFolderId(t) ?? this.rootId);
212
+ }
213
+ async uploadFiles(e) {
214
+ if (e.items.length === 0) return {
215
+ success: !0,
216
+ detailed: []
217
+ };
218
+ const t = new Map();
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 = t.get(i) ?? [];
221
+ p.push({
222
+ item: a,
223
+ requestId: o
224
+ }), t.set(i, p);
225
+ });
226
+ const r = [];
227
+ for (const [a, n] of t) {
228
+ const i = new FormData();
229
+ i.append("project_id", this.projectId), a !== this.rootId && i.append("folder_id", a);
230
+ for (const { item: d, requestId: u } of n) i.append("request_id", u), i.append("file", d.data, d.name);
231
+ let o;
232
+ try {
233
+ o = await this.api.request({
234
+ path: "/files",
235
+ method: "POST",
236
+ body: i,
237
+ type: h.ContentType.FormData,
238
+ format: "json",
239
+ secure: !0
240
+ }), this.assertOk(o, "file");
241
+ } catch (d) {
242
+ for (const { requestId: u } of n) r.push({
243
+ requestId: u,
244
+ success: !1,
245
+ error: m.toErrorInfo(d)
246
+ });
247
+ continue;
248
+ }
249
+ const p = new Map((o.data.items ?? []).map((d) => [d.request_id, d]));
250
+ n.forEach(({ requestId: d }, u) => {
251
+ const I = p.get(d) ?? o.data.items?.[u];
252
+ I?.file ? r.push({
253
+ requestId: d,
254
+ success: !0,
255
+ data: this.mapFile(I.file, a)
256
+ }) : r.push({
257
+ requestId: d,
258
+ success: !1,
259
+ error: this.mapItemFail(I?.error)
260
+ });
261
+ });
262
+ }
263
+ const s = r.filter((a) => !a.success);
264
+ return {
265
+ success: s.length === 0,
266
+ error: s[0]?.error,
267
+ detailed: r
268
+ };
269
+ }
270
+ async uploadFile(e) {
271
+ const t = (await this.uploadFiles({ items: [{
272
+ name: e.name,
273
+ size: e.size,
274
+ type: e.type,
275
+ folderId: e.folderId,
276
+ data: e.data
277
+ }] })).detailed?.[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
+ }
282
+ return t.data;
283
+ }
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
+ a.append("project_id", this.projectId), a.append("file", s, e.name);
289
+ const n = await this.api.request({
290
+ path: `/files/${e.id}/content`,
291
+ method: "PUT",
292
+ body: a,
293
+ type: h.ContentType.FormData,
294
+ format: "json",
295
+ secure: !0
296
+ });
297
+ this.assertOk(n, "file");
298
+ const i = n.data.file ?? {};
299
+ r = {
300
+ ...r,
301
+ size: i.size,
302
+ type: i.mime,
303
+ url: i.url,
304
+ thumbnail: i.thumbnail_url,
305
+ thumbnailUrl: i.thumbnail_url,
306
+ lastEdited: i.updated_at
307
+ };
308
+ }
309
+ if (t.name && t.name !== e.name) {
310
+ const s = await this.renameItem(e, t.name);
311
+ r = {
312
+ ...r,
313
+ ...s
314
+ };
315
+ }
316
+ return r;
317
+ }
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
+ const s = await h.fetchWithResourceProxy(e.url, {
322
+ config: this.appConfig,
323
+ standalone: this.isStandalone,
324
+ resourceType: h.isCdnUrl(e.url, this.appConfig) ? "cdn" : "generic",
325
+ intent: "downloadBlob",
326
+ init: t?.forceReload ? { cache: "no-store" } : void 0
327
+ });
328
+ if (s.ok) return s.blob();
329
+ throw new c(await s.text() || r("Failed to get file: %s").replace("%s", s.statusText), v(s.status), s.status);
330
+ };
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
+ for (let n = 0; n < s.length; n += 1) a[n] = s.charCodeAt(n);
334
+ return new Blob([a], t ? { type: t } : void 0);
335
+ }
336
+ mapItemFail(e) {
337
+ const { __: t } = this.i18n;
338
+ return {
339
+ message: e?.message || t("Unknown error"),
340
+ code: (e?.code ? T[e.code] : void 0) ?? "FileWriteError"
341
+ };
342
+ }
343
+ async renameItem(e, t) {
344
+ if (e.isFolder) {
345
+ const a = await this.api.folders.foldersPartialUpdate({ id: e.id }, {
346
+ project_id: this.projectId,
347
+ name: t
348
+ });
349
+ this.assertOk(a, "folder");
350
+ const n = a.data.folder ?? {};
351
+ return {
352
+ id: e.id,
353
+ name: n.name ?? t,
354
+ folderId: n.parent_id ?? e.folderId,
355
+ isFolder: !0,
356
+ lastEdited: n.updated_at
357
+ };
358
+ }
359
+ const r = await this.api.files.filesPartialUpdate({ id: e.id }, {
360
+ project_id: this.projectId,
361
+ name: t,
362
+ mode: "replace"
363
+ });
364
+ this.assertOk(r, "file");
365
+ const s = r.data.file ?? {};
366
+ return {
367
+ id: e.id,
368
+ name: s.name ?? t,
369
+ folderId: s.folder_id ?? e.folderId,
370
+ isFolder: !1,
371
+ url: s.url,
372
+ thumbnail: s.thumbnail_url,
373
+ thumbnailUrl: s.thumbnail_url,
374
+ extension: s.ext,
375
+ type: s.mime,
376
+ lastEdited: s.updated_at
377
+ };
378
+ }
379
+ async deleteItem(e, t) {
380
+ try {
381
+ if (e.isFolder) {
382
+ const r = await this.api.folders.foldersDelete({
383
+ id: e.id,
384
+ project_id: this.projectId,
385
+ permanent: t.permanent || void 0
386
+ });
387
+ this.assertOk(r, "folder");
388
+ } else {
389
+ const r = await this.api.files.filesDelete({
390
+ id: e.id,
391
+ project_id: this.projectId,
392
+ permanent: t.permanent || void 0
393
+ });
394
+ this.assertOk(r, "file");
395
+ }
396
+ } catch (r) {
397
+ if (!m.isNotFound(r)) throw r;
398
+ }
399
+ }
400
+ async deleteItems(e, t) {
401
+ if (e.length === 0) return { success: !0 };
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
+ for (const i of e) {
404
+ if (s.has(i)) {
405
+ a.push({
406
+ requestId: i.id,
407
+ success: !0
408
+ });
409
+ continue;
410
+ }
411
+ try {
412
+ await this.deleteItem(i, t), a.push({
413
+ requestId: i.id,
414
+ success: !0
415
+ });
416
+ } catch (o) {
417
+ a.push({
418
+ requestId: i.id,
419
+ success: !1,
420
+ error: m.toErrorInfo(o)
421
+ });
422
+ }
423
+ }
424
+ const n = a.filter((i) => !i.success);
425
+ return {
426
+ success: n.length === 0,
427
+ error: n[0]?.error,
428
+ detailed: a
429
+ };
430
+ }
431
+ async moveItems(e, t) {
432
+ if (e.length === 0) return {
433
+ success: !0,
434
+ detailed: []
435
+ };
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
+ const i = await this.api.trash.restoreCreate({
439
+ project_id: this.projectId,
440
+ ids: r.map((o) => o.id),
441
+ target_folder_id: this.normalizeFolderId(t),
442
+ on_conflict: "keep_both"
443
+ });
444
+ this.assertOk(i), a.push(...this.mapTransferResults(i.data.items, r));
445
+ }
446
+ if (s.length > 0) {
447
+ const i = await this.api.items.moveCreate({
448
+ project_id: this.projectId,
449
+ ids: s.map((o) => o.id),
450
+ target_folder_id: this.normalizeFolderId(t)
451
+ });
452
+ this.assertOk(i), a.push(...this.mapTransferResults(i.data.items, s));
453
+ }
454
+ const n = a.filter((i) => !i.success);
455
+ return {
456
+ success: n.length === 0,
457
+ error: n[0]?.error,
458
+ detailed: a
459
+ };
460
+ }
461
+ async moveItem(e, t) {
462
+ return this.unwrapSingleTransfer(await this.moveItems([e], t), e);
463
+ }
464
+ async copyItems(e, t) {
465
+ if (e.length === 0) return {
466
+ success: !0,
467
+ detailed: []
468
+ };
469
+ const r = await this.api.items.copyCreate({
470
+ project_id: this.projectId,
471
+ ids: e.map((n) => n.id),
472
+ target_folder_id: this.normalizeFolderId(t)
473
+ });
474
+ this.assertOk(r);
475
+ const s = this.mapTransferResults(r.data.items, e), a = s.filter((n) => !n.success);
476
+ return {
477
+ success: a.length === 0,
478
+ error: a[0]?.error,
479
+ detailed: s
480
+ };
481
+ }
482
+ async copyItem(e, t) {
483
+ return this.unwrapSingleTransfer(await this.copyItems([e], t), e);
484
+ }
485
+ async cleanTrash() {
486
+ const e = await this.api.trash.emptyCreate({ project_id: this.projectId });
487
+ return this.assertOk(e), {
488
+ success: !0,
489
+ deletedCount: (e.data.deleted_files ?? 0) + (e.data.deleted_folders ?? 0)
490
+ };
491
+ }
492
+ async clearCache(e) {}
493
+ findItemByPath(e) {
494
+ return this.resolveSystemFolderByPath(e);
495
+ }
496
+ async findFileByUrl(e, t) {
497
+ const r = {
498
+ appConfig: this.appConfig,
499
+ isStandalone: this.isStandalone,
500
+ projectId: this.projectId
501
+ };
502
+ if (!U(e, r)) return;
503
+ const s = A(e, r), a = S.decodeFileNameFromUrl(s);
504
+ if (!a) return;
505
+ const { items: n } = await this.listFiles({
506
+ folderId: t,
507
+ search: a
508
+ }, !1);
509
+ return n.find((i) => i.url === e || i.url === s);
510
+ }
511
+ mapTransferResults(e, t) {
512
+ const r = new Map(t.map((s) => [s.id, s]));
513
+ return (e ?? []).map((s, a) => {
514
+ const n = s.id ?? t[a]?.id, i = n ? r.get(n) : t[a];
515
+ return s.error ? {
516
+ requestId: n,
517
+ success: !1,
518
+ error: this.mapItemFail(s.error)
519
+ } : {
520
+ requestId: n,
521
+ success: !0,
522
+ data: s.file ? this.mapFile(s.file, s.file.folder_id ?? this.rootId) : s.folder ? this.mapFolder(s.folder) : i ? { id: i.id } : { id: n ?? "" }
523
+ };
524
+ });
525
+ }
526
+ unwrapSingleTransfer(e, t) {
527
+ const r = e.detailed?.[0];
528
+ if (!r?.success) {
529
+ const s = r?.error ?? e.error;
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
+ }
532
+ return r.data ?? { id: t.id };
533
+ }
534
+ mapFile(e, t) {
535
+ return this.trackThumbnailReadiness(e), {
536
+ id: e.id ?? "",
537
+ name: e.name ?? "",
538
+ folderId: e.folder_id ?? t,
539
+ isFolder: !1,
540
+ size: e.size,
541
+ date: e.created_at,
542
+ lastEdited: e.updated_at,
543
+ type: e.mime,
544
+ extension: e.ext,
545
+ url: e.url,
546
+ thumbnail: e.thumbnail_url,
547
+ thumbnailUrl: e.thumbnail_url,
548
+ dimensions: e.width && e.height ? `${e.width}x${e.height}` : void 0,
549
+ aspectRatio: e.width && e.height ? String(e.width / e.height) : void 0,
550
+ selected: !1
551
+ };
552
+ }
553
+ trackThumbnailReadiness(e) {
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);
567
+ const a = {
568
+ listeners: new Set([t]),
569
+ cancelled: !1
570
+ };
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));
573
+ };
574
+ }
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;
578
+ let a;
579
+ try {
580
+ const n = await this.api.files.filesDetail({
581
+ id: e,
582
+ project_id: this.projectId
583
+ });
584
+ n.ok && !n.error && (a = n.data.file?.thumbnail_url);
585
+ } catch {}
586
+ if (r.cancelled) return;
587
+ if (a) {
588
+ this.pendingThumbnails.delete(t), this.thumbWatchers.delete(e), r.listeners.forEach((n) => n(a));
589
+ return;
590
+ }
591
+ }
592
+ this.thumbWatchers.delete(e), this.pendingThumbnails.delete(t);
593
+ }
594
+ mapFolder(e, t) {
595
+ return {
596
+ id: e.id ?? "",
597
+ name: e.name ?? "",
598
+ folderId: e.parent_id ?? this.normalizeFolderId(t) ?? this.rootId,
599
+ isFolder: !0,
600
+ date: e.created_at,
601
+ lastEdited: e.updated_at,
602
+ selected: !1
603
+ };
604
+ }
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;
607
+ return {
608
+ page: n,
609
+ limit: r,
610
+ total: a,
611
+ totalPages: i,
612
+ hasNext: n < i,
613
+ hasPrev: n > 1
614
+ };
615
+ }
616
+ normalizeFolderId(e) {
617
+ if (!(!e || e === this.rootId)) return e;
618
+ }
619
+ assertOk(e, t) {
620
+ if (e.ok && !e.error) return;
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);
623
+ }
624
+ static isNotFound(e) {
625
+ return e instanceof c && (e.code === "FileNotFound" || e.code === "FolderNotFound");
626
+ }
627
+ static toErrorInfo(e) {
628
+ return e instanceof c || e instanceof Error ? e : {
629
+ message: String(e),
630
+ raw: e
631
+ };
632
+ }
633
+ };
634
+ Object.defineProperty(F, "FileManagerApiError", {
635
+ enumerable: !0,
636
+ get: function() {
637
+ return c;
638
+ }
639
+ }), Object.defineProperty(F, "FileManagerRestApiProviderV2", {
640
+ enumerable: !0,
641
+ get: function() {
642
+ return x;
643
+ }
644
+ }), Object.defineProperty(F, "arrays", {
645
+ enumerable: !0,
646
+ get: function() {
647
+ return _;
648
+ }
649
+ }), Object.defineProperty(F, "hasThumbnailWatcher", {
650
+ enumerable: !0,
651
+ get: function() {
652
+ return M;
653
+ }
654
+ });
655
+ });
@@ -1,22 +1,22 @@
1
1
  (function(){try{if(typeof document<"u"){var o=document.createElement("style");o.setAttribute("data-useblocks","true"),o.appendChild(document.createTextNode('.monaco-editor{width:100%;height:100%}.monaco-editor .monaco-hover{border-radius:6px}.monaco-editor .monaco-editor .scroll-decoration{box-shadow:none}.monaco-editor,.monaco-editor *,.monaco-editor .view-lines,.monaco-editor .view-lines *,.monaco-editor .view-lines .view-line,.monaco-editor .view-lines .monaco-mouse-cursor-text,.monaco-editor .view-line,.monaco-editor .monaco-mouse-cursor-text{font-family:var(--monaco-editor-font-family,"Source Code Pro", Consolas, "Courier New", monospace)!important}.monaco-editor .view-line,.monaco-editor .view-line span,.monaco-editor .view-line span.inline-selected-text{font-variant-ligatures:none;font-feature-settings:"liga" 0, "calt" 0;font-kerning:none;white-space:pre;font-family:var(--monaco-monospace-font,var(--monaco-editor-font-family,"Source Code Pro", Consolas, "Courier New", monospace))!important;font-size:var(--monaco-editor-font-size,14px)!important;font-weight:400!important}.monaco-editor .standalone-colorpicker-body{max-width:460px!important}.monaco-editor .standalone-colorpicker-body .colorpicker-body .saturation-wrap{flex:0 auto;max-width:280px}.blocks-app .colorpicker-body .saturation-box,.blocks-app .colorpicker-body .strip{border-radius:4px}.blocks-app .scrollbar.vertical{width:5px!important}.blocks-app .scrollbar.vertical .slider{border-radius:5px!important;width:5px!important}.blocks-app .user-cursor{z-index:10;border-left:2px solid #ff00e1;width:2px;height:20px;position:absolute}.blocks-app .cursor-hover{color:#fff;text-wrap-mode:nowrap;z-index:10000;border-radius:7px 7px 7px 0;margin-left:-2px;padding:0 5px;font-size:12px;position:absolute;top:-17px}.blocks-app .user-selection-decoration{background-color:#8080eb4d}.monaco-editor__spin{z-index:1000;align-items:center;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}')),document.head.appendChild(o)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
- __useblocks__.define("static/core/526b23c2.js", [
2
+ __useblocks__.define("static/core/bc7e3d2b.js", [
3
3
  "require",
4
4
  "exports",
5
5
  "module",
6
6
  "static/core/bd36b180.js",
7
- "static/core/cefd6620.js",
7
+ "static/core/ee0ddb51.js",
8
8
  "static/core/ec11f92f.js",
9
- "static/core/6b8432a3.js",
10
- "static/core/350eac23.js",
9
+ "static/core/139e4380.js",
10
+ "static/core/ebd852b6.js",
11
11
  "static/core/b9f47840.js",
12
12
  "static/core/dc408d7c2.js",
13
- "static/core/9c1c1b89.js",
13
+ "static/core/e5e07f1d.js",
14
14
  "react",
15
15
  "react/jsx-runtime"
16
16
  ], function($e, bc, Gy) {
17
- const g = $e("./bd36b180.js"), y = $e("./cefd6620.js"), ue = $e("./ec11f92f.js"), ot = $e("./6b8432a3.js"), sr = $e("./350eac23.js");
17
+ const g = $e("./bd36b180.js"), y = $e("./ee0ddb51.js"), ue = $e("./ec11f92f.js"), ot = $e("./139e4380.js"), sr = $e("./ebd852b6.js");
18
18
  $e("./b9f47840.js");
19
- const Ae = $e("./dc408d7c2.js"), ge = $e("./9c1c1b89.js");
19
+ const Ae = $e("./dc408d7c2.js"), ge = $e("./e5e07f1d.js");
20
20
  let S = $e("react"), $ = g.__toESM(S, 1);
21
21
  S = g.__toESM(S);
22
22
  let Dt = $e("react/jsx-runtime");