@epam/ai-dial-chat-hooks 1.0.12 → 1.0.13
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.
- package/conversation/useConversationStream/buffered-generation.d.ts +15 -0
- package/conversation/useConversationStream/buffered-generation.d.ts.map +1 -0
- package/conversation/useConversationStream/generation-resume.d.ts +29 -0
- package/conversation/useConversationStream/generation-resume.d.ts.map +1 -1
- package/conversation/useConversationStream/useConversationStream.d.ts +9 -0
- package/conversation/useConversationStream/useConversationStream.d.ts.map +1 -1
- package/index.js +418 -353
- package/package.json +14 -14
package/index.js
CHANGED
|
@@ -16229,13 +16229,7 @@ var Mu = (e) => ku.sanitize(e, Au), Nu = (e) => ku.sanitize(e, ju), Pu = (e) =>
|
|
|
16229
16229
|
}, [v]),
|
|
16230
16230
|
armAnchor: m
|
|
16231
16231
|
};
|
|
16232
|
-
}, tm = (e) => {
|
|
16233
|
-
let t = e.custom_content;
|
|
16234
|
-
return !!e.content || e.responseId != null || !!t?.attachments?.length || !!t?.stages?.length || !!t?.annotations?.length || !!t?.form_schema || t?.state != null;
|
|
16235
|
-
}, nm = (e) => {
|
|
16236
|
-
let t = e.messages[e.messages.length - 1];
|
|
16237
|
-
return !!t && t.role === C.Assistant && !tm(t) && t.streamErrorMessage == null && !t.wasStoppedByUser;
|
|
16238
|
-
}, rm = (e, t) => {
|
|
16232
|
+
}, tm = (e, t) => {
|
|
16239
16233
|
let n = [...e];
|
|
16240
16234
|
for (let e of t) {
|
|
16241
16235
|
let t = n.findIndex((t) => t.index === e.index);
|
|
@@ -16254,7 +16248,7 @@ var Mu = (e) => ku.sanitize(e, Au), Nu = (e) => ku.sanitize(e, ju), Pu = (e) =>
|
|
|
16254
16248
|
} else n.push(e);
|
|
16255
16249
|
}
|
|
16256
16250
|
return n;
|
|
16257
|
-
},
|
|
16251
|
+
}, nm = (e, t) => {
|
|
16258
16252
|
let n = [...e];
|
|
16259
16253
|
for (let e of t) {
|
|
16260
16254
|
let t = e.index == null ? -1 : n.findIndex((t) => t.index === e.index);
|
|
@@ -16266,7 +16260,7 @@ var Mu = (e) => ku.sanitize(e, Au), Nu = (e) => ku.sanitize(e, ju), Pu = (e) =>
|
|
|
16266
16260
|
} : n.push(e);
|
|
16267
16261
|
}
|
|
16268
16262
|
return n;
|
|
16269
|
-
},
|
|
16263
|
+
}, rm = (e, t) => {
|
|
16270
16264
|
let n = [...e];
|
|
16271
16265
|
for (let e of t) {
|
|
16272
16266
|
let t = n.findIndex((t) => t.index === e.index);
|
|
@@ -16275,14 +16269,14 @@ var Mu = (e) => ku.sanitize(e, Au), Nu = (e) => ku.sanitize(e, ju), Pu = (e) =>
|
|
|
16275
16269
|
...e,
|
|
16276
16270
|
name: (n[t].name ?? "") + (e.name ?? ""),
|
|
16277
16271
|
content: (n[t].content ?? "") + (e.content ?? "") || void 0,
|
|
16278
|
-
attachments: e.attachments?.length ?
|
|
16272
|
+
attachments: e.attachments?.length ? nm(n[t].attachments ?? [], e.attachments) : n[t].attachments
|
|
16279
16273
|
} : n.push({
|
|
16280
16274
|
...e,
|
|
16281
16275
|
name: e.name ?? ""
|
|
16282
16276
|
});
|
|
16283
16277
|
}
|
|
16284
16278
|
return n;
|
|
16285
|
-
},
|
|
16279
|
+
}, im = (e, t, n) => {
|
|
16286
16280
|
let r = n.choices[0]?.delta, i = r?.content ?? "", a = r?.custom_content?.form_schema, o = r?.custom_content?.attachments, s = r?.custom_content?.stages, c = r?.custom_content?.annotations, l = r?.custom_fields?.annotations, u = r?.custom_content?.state, d = !!i || !!a || !!o?.length || !!s?.length || !!c?.length || !!l?.length || !!u, f = r?.responseId ?? (d ? n.id : void 0);
|
|
16287
16281
|
return !d && !f ? null : e.map((e, n) => {
|
|
16288
16282
|
if (n !== t) return e;
|
|
@@ -16295,27 +16289,144 @@ var Mu = (e) => ku.sanitize(e, Au), Nu = (e) => ku.sanitize(e, ju), Pu = (e) =>
|
|
|
16295
16289
|
...e.custom_content,
|
|
16296
16290
|
...a && { form_schema: a },
|
|
16297
16291
|
...o?.length && { attachments: r },
|
|
16298
|
-
...s?.length && { stages:
|
|
16299
|
-
...p.length && { annotations:
|
|
16292
|
+
...s?.length && { stages: rm(e.custom_content?.stages ?? [], s) },
|
|
16293
|
+
...p.length && { annotations: tm(e.custom_content?.annotations ?? [], p) },
|
|
16300
16294
|
...u && { state: u }
|
|
16301
16295
|
} }
|
|
16302
16296
|
};
|
|
16303
16297
|
});
|
|
16304
|
-
},
|
|
16298
|
+
}, am = (e, t) => ({
|
|
16305
16299
|
...e,
|
|
16306
16300
|
...t,
|
|
16307
16301
|
...(e.custom_content || t.custom_content) && { custom_content: {
|
|
16308
16302
|
...e.custom_content,
|
|
16309
16303
|
...t.custom_content
|
|
16310
16304
|
} }
|
|
16311
|
-
}),
|
|
16305
|
+
}), om = (e, t) => {
|
|
16312
16306
|
if (t.messageIndex > e.messages.length) return e;
|
|
16313
16307
|
let n = [...e.messages];
|
|
16314
|
-
return t.messageIndex === n.length ? n.push(t.message) : n[t.messageIndex] =
|
|
16308
|
+
return t.messageIndex === n.length ? n.push(t.message) : n[t.messageIndex] = am(n[t.messageIndex], t.message), {
|
|
16315
16309
|
...e,
|
|
16316
16310
|
messages: n
|
|
16317
16311
|
};
|
|
16318
|
-
},
|
|
16312
|
+
}, sm = (e) => {
|
|
16313
|
+
let t = e.custom_content;
|
|
16314
|
+
return !!e.content || e.responseId != null || !!t?.attachments?.length || !!t?.stages?.length || !!t?.annotations?.length || !!t?.form_schema || t?.state != null;
|
|
16315
|
+
}, cm = (e) => {
|
|
16316
|
+
let t = e.messages[e.messages.length - 1];
|
|
16317
|
+
return !!t && t.role === C.Assistant && !sm(t) && t.streamErrorMessage == null && !t.wasStoppedByUser;
|
|
16318
|
+
}, lm = 300 * 1e3, um = "awaiting-resume", dm = async (e, t) => {
|
|
16319
|
+
let n = e.getReader(), r = new TextDecoder(), i = "";
|
|
16320
|
+
try {
|
|
16321
|
+
for (;;) {
|
|
16322
|
+
let { done: e, value: a } = await n.read();
|
|
16323
|
+
if (e) break;
|
|
16324
|
+
i += r.decode(a, { stream: !0 });
|
|
16325
|
+
let o = i.split("\n");
|
|
16326
|
+
i = o.pop() ?? "";
|
|
16327
|
+
let s = !1;
|
|
16328
|
+
for (let e of o) {
|
|
16329
|
+
let n = e.trim();
|
|
16330
|
+
if (!n.startsWith("data:")) continue;
|
|
16331
|
+
let r = n.slice(5).trim(), i;
|
|
16332
|
+
try {
|
|
16333
|
+
i = JSON.parse(r);
|
|
16334
|
+
} catch {
|
|
16335
|
+
continue;
|
|
16336
|
+
}
|
|
16337
|
+
if (await t(i)) {
|
|
16338
|
+
s = !0;
|
|
16339
|
+
break;
|
|
16340
|
+
}
|
|
16341
|
+
}
|
|
16342
|
+
if (s) break;
|
|
16343
|
+
}
|
|
16344
|
+
} catch {} finally {
|
|
16345
|
+
n.releaseLock();
|
|
16346
|
+
}
|
|
16347
|
+
}, fm = ({ transport: e, setConversation: t, conversationRef: n, resumingPathsRef: r, bufferedGenerationsRef: i, addStreamingPath: a, removeStreamingPath: o, isPathDisplayed: s }) => (c, l) => {
|
|
16348
|
+
if (!cm(l)) return;
|
|
16349
|
+
let u = Np(c);
|
|
16350
|
+
if (r.current.has(u)) return;
|
|
16351
|
+
r.current.add(u), a(u);
|
|
16352
|
+
let d = l.messages.length - 1, f = (e) => {
|
|
16353
|
+
r.current.delete(u), o(u), i.current.delete(u), e && s(u) && (t(e), n.current = e);
|
|
16354
|
+
}, p = async () => {
|
|
16355
|
+
try {
|
|
16356
|
+
f(await e.getConversation(H(c)));
|
|
16357
|
+
} catch {
|
|
16358
|
+
f();
|
|
16359
|
+
}
|
|
16360
|
+
}, m = (e) => {
|
|
16361
|
+
let r = {
|
|
16362
|
+
generationId: um,
|
|
16363
|
+
messageIndex: d,
|
|
16364
|
+
message: e
|
|
16365
|
+
};
|
|
16366
|
+
i.current.set(u, r), s(u) && t((e) => {
|
|
16367
|
+
if (!e) return e;
|
|
16368
|
+
let t = om(e, r);
|
|
16369
|
+
return n.current = t, t;
|
|
16370
|
+
});
|
|
16371
|
+
}, h = (e) => {
|
|
16372
|
+
let r = i.current.get(u);
|
|
16373
|
+
if (r?.generationId === um) {
|
|
16374
|
+
let t = im([r.message], 0, e);
|
|
16375
|
+
t && (r.message = t[0]);
|
|
16376
|
+
}
|
|
16377
|
+
s(u) && t((e) => {
|
|
16378
|
+
if (!e) return e;
|
|
16379
|
+
let t = i.current.get(u);
|
|
16380
|
+
if (t?.generationId !== um) return e;
|
|
16381
|
+
let r = om(e, t);
|
|
16382
|
+
return n.current = r, r;
|
|
16383
|
+
});
|
|
16384
|
+
}, g = async () => {
|
|
16385
|
+
let t = new AbortController(), n;
|
|
16386
|
+
try {
|
|
16387
|
+
n = await e.watchConversation(u, t.signal);
|
|
16388
|
+
} catch {
|
|
16389
|
+
await p();
|
|
16390
|
+
return;
|
|
16391
|
+
}
|
|
16392
|
+
let r = !1, i = window.setTimeout(() => {
|
|
16393
|
+
t.abort();
|
|
16394
|
+
}, lm);
|
|
16395
|
+
try {
|
|
16396
|
+
await dm(n, async (t) => {
|
|
16397
|
+
if (t?.action !== "UPDATE") return !1;
|
|
16398
|
+
try {
|
|
16399
|
+
let t = await e.getConversation(H(c));
|
|
16400
|
+
if (!cm(t)) return f(t), r = !0, !0;
|
|
16401
|
+
} catch {}
|
|
16402
|
+
return !1;
|
|
16403
|
+
});
|
|
16404
|
+
} finally {
|
|
16405
|
+
clearTimeout(i);
|
|
16406
|
+
}
|
|
16407
|
+
r || await p();
|
|
16408
|
+
}, _ = async () => {
|
|
16409
|
+
let t = new AbortController(), n;
|
|
16410
|
+
try {
|
|
16411
|
+
n = await e.attachToGeneration(u, t.signal);
|
|
16412
|
+
} catch {
|
|
16413
|
+
return !1;
|
|
16414
|
+
}
|
|
16415
|
+
let r = !1;
|
|
16416
|
+
return await dm(n, (e) => {
|
|
16417
|
+
switch (e.type) {
|
|
16418
|
+
case "snapshot": return m(e.message), !1;
|
|
16419
|
+
case "chunk": return h(e.chunk), !1;
|
|
16420
|
+
case "done":
|
|
16421
|
+
case "error":
|
|
16422
|
+
case "stopped": return r = !0, !0;
|
|
16423
|
+
}
|
|
16424
|
+
}), r ? (await p(), !0) : !1;
|
|
16425
|
+
};
|
|
16426
|
+
(async () => {
|
|
16427
|
+
await _() || await g();
|
|
16428
|
+
})();
|
|
16429
|
+
}, pm = 2e4, mm = ({ conversationId: e, state: { setConversation: t, conversationRef: n }, transport: r, generation: { startGeneration: i, completeGeneration: a }, channel: o, overlay: s, onStopError: c }) => {
|
|
16319
16430
|
let [l, u] = L(() => /* @__PURE__ */ new Set()), [d, f] = L(null), p = I(null), m = I(null), h = I(/* @__PURE__ */ new Set()), g = I(/* @__PURE__ */ new Map()), _ = I(/* @__PURE__ */ new Set()), v = I(e);
|
|
16320
16431
|
P(() => {
|
|
16321
16432
|
v.current = e;
|
|
@@ -16349,15 +16460,15 @@ var Mu = (e) => ku.sanitize(e, Au), Nu = (e) => ku.sanitize(e, ju), Pu = (e) =>
|
|
|
16349
16460
|
if (p.current !== S) return;
|
|
16350
16461
|
let r = g.current.get(C);
|
|
16351
16462
|
if (r?.generationId === S) {
|
|
16352
|
-
let t =
|
|
16463
|
+
let t = im([r.message], 0, e);
|
|
16353
16464
|
t && (r.message = t[0]);
|
|
16354
16465
|
}
|
|
16355
16466
|
y(C) && t((t) => {
|
|
16356
16467
|
if (!t) return t;
|
|
16357
16468
|
let r = g.current.get(C), i;
|
|
16358
|
-
if (r?.generationId === S) i =
|
|
16469
|
+
if (r?.generationId === S) i = om(t, r);
|
|
16359
16470
|
else {
|
|
16360
|
-
let n =
|
|
16471
|
+
let n = im(t.messages, l, e);
|
|
16361
16472
|
if (!n) return t;
|
|
16362
16473
|
i = {
|
|
16363
16474
|
...t,
|
|
@@ -16378,7 +16489,7 @@ var Mu = (e) => ku.sanitize(e, Au), Nu = (e) => ku.sanitize(e, ju), Pu = (e) =>
|
|
|
16378
16489
|
let r = g.current.get(C), i = r?.generationId === S ? r : void 0;
|
|
16379
16490
|
i && g.current.delete(C), x(C), p.current === S && (p.current = null, m.current = null, f(null)), y(C) && t((t) => {
|
|
16380
16491
|
if (!t) return t;
|
|
16381
|
-
let r = i?.generationId === S ?
|
|
16492
|
+
let r = i?.generationId === S ? om(t, i) : t, a = {
|
|
16382
16493
|
...r,
|
|
16383
16494
|
messages: r.messages.map((t, n) => n === l ? {
|
|
16384
16495
|
...t,
|
|
@@ -16391,7 +16502,7 @@ var Mu = (e) => ku.sanitize(e, Au), Nu = (e) => ku.sanitize(e, ju), Pu = (e) =>
|
|
|
16391
16502
|
};
|
|
16392
16503
|
(async () => {
|
|
16393
16504
|
try {
|
|
16394
|
-
let e = o?.channelId ?? await o?.waitForChannel(
|
|
16505
|
+
let e = o?.channelId ?? await o?.waitForChannel(pm) ?? void 0;
|
|
16395
16506
|
r.streamCompletion(C, c, u, D, d, S, v, w, e);
|
|
16396
16507
|
} catch (e) {
|
|
16397
16508
|
D.onError(e instanceof Error ? e : Error(String(e)));
|
|
@@ -16410,7 +16521,7 @@ var Mu = (e) => ku.sanitize(e, Au), Nu = (e) => ku.sanitize(e, ju), Pu = (e) =>
|
|
|
16410
16521
|
r
|
|
16411
16522
|
]), C = N((e, t) => {
|
|
16412
16523
|
let n = Np(e), r = g.current.get(n);
|
|
16413
|
-
return r ?
|
|
16524
|
+
return r ? om(t, r) : t;
|
|
16414
16525
|
}, []), w = N(() => {
|
|
16415
16526
|
let t = p.current;
|
|
16416
16527
|
if (!t || !e) return;
|
|
@@ -16427,62 +16538,16 @@ var Mu = (e) => ku.sanitize(e, Au), Nu = (e) => ku.sanitize(e, ju), Pu = (e) =>
|
|
|
16427
16538
|
c,
|
|
16428
16539
|
s,
|
|
16429
16540
|
r
|
|
16430
|
-
]), T =
|
|
16431
|
-
|
|
16432
|
-
|
|
16433
|
-
|
|
16434
|
-
h
|
|
16435
|
-
|
|
16436
|
-
|
|
16437
|
-
|
|
16438
|
-
|
|
16439
|
-
|
|
16440
|
-
} catch {
|
|
16441
|
-
s();
|
|
16442
|
-
}
|
|
16443
|
-
};
|
|
16444
|
-
(async () => {
|
|
16445
|
-
let t;
|
|
16446
|
-
try {
|
|
16447
|
-
t = await r.watchConversation(a, o.signal);
|
|
16448
|
-
} catch {
|
|
16449
|
-
await c();
|
|
16450
|
-
return;
|
|
16451
|
-
}
|
|
16452
|
-
let n = t.getReader(), i = new TextDecoder(), l = "", u = window.setTimeout(() => {
|
|
16453
|
-
o.abort();
|
|
16454
|
-
}, sm);
|
|
16455
|
-
try {
|
|
16456
|
-
for (;;) {
|
|
16457
|
-
let { done: t, value: a } = await n.read();
|
|
16458
|
-
if (t) break;
|
|
16459
|
-
l += i.decode(a, { stream: !0 });
|
|
16460
|
-
let o = l.split("\n");
|
|
16461
|
-
l = o.pop() ?? "";
|
|
16462
|
-
for (let t of o) {
|
|
16463
|
-
let n = t.trim();
|
|
16464
|
-
if (!n.startsWith("data:")) continue;
|
|
16465
|
-
let i = n.slice(5).trim(), a = null;
|
|
16466
|
-
try {
|
|
16467
|
-
a = JSON.parse(i);
|
|
16468
|
-
} catch {
|
|
16469
|
-
continue;
|
|
16470
|
-
}
|
|
16471
|
-
if (a?.action === "UPDATE") try {
|
|
16472
|
-
let t = await r.getConversation(H(e));
|
|
16473
|
-
if (!nm(t)) {
|
|
16474
|
-
s(t);
|
|
16475
|
-
return;
|
|
16476
|
-
}
|
|
16477
|
-
} catch {}
|
|
16478
|
-
}
|
|
16479
|
-
}
|
|
16480
|
-
} catch {} finally {
|
|
16481
|
-
clearTimeout(u), n.releaseLock();
|
|
16482
|
-
}
|
|
16483
|
-
await c();
|
|
16484
|
-
})();
|
|
16485
|
-
}, [
|
|
16541
|
+
]), T = F(() => fm({
|
|
16542
|
+
transport: r,
|
|
16543
|
+
setConversation: t,
|
|
16544
|
+
conversationRef: n,
|
|
16545
|
+
resumingPathsRef: h,
|
|
16546
|
+
bufferedGenerationsRef: g,
|
|
16547
|
+
addStreamingPath: b,
|
|
16548
|
+
removeStreamingPath: x,
|
|
16549
|
+
isPathDisplayed: y
|
|
16550
|
+
}), [
|
|
16486
16551
|
b,
|
|
16487
16552
|
x,
|
|
16488
16553
|
y,
|
|
@@ -16496,7 +16561,7 @@ var Mu = (e) => ku.sanitize(e, Au), Nu = (e) => ku.sanitize(e, ju), Pu = (e) =>
|
|
|
16496
16561
|
isStreaming: E,
|
|
16497
16562
|
canStopStreaming: D != null && d === D
|
|
16498
16563
|
};
|
|
16499
|
-
},
|
|
16564
|
+
}, hm = {}, gm = (e, t = hm) => F(() => {
|
|
16500
16565
|
let n = [], r = [], i = [], a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
|
|
16501
16566
|
for (let c of e) {
|
|
16502
16567
|
let e = c.custom_content?.attachments;
|
|
@@ -16536,70 +16601,70 @@ var Mu = (e) => ku.sanitize(e, Au), Nu = (e) => ku.sanitize(e, ju), Pu = (e) =>
|
|
|
16536
16601
|
generated: r,
|
|
16537
16602
|
sources: i
|
|
16538
16603
|
};
|
|
16539
|
-
}, [e, t]),
|
|
16604
|
+
}, [e, t]), _m = /* @__PURE__ */ function(e) {
|
|
16540
16605
|
return e.Overwrite = "overwrite", e.CreateOnly = "create-only", e;
|
|
16541
16606
|
}({}), $ = /* @__PURE__ */ function(e) {
|
|
16542
16607
|
return e.FolderLoadFailed = "folderLoadFailed", e.MetadataLoadFailed = "metadataLoadFailed", e.FolderCreateFailed = "folderCreateFailed", e.DownloadFileFailed = "downloadFileFailed", e.DownloadFilesFailed = "downloadFilesFailed", e.FilesDeleted = "filesDeleted", e.FilesDeletePartiallyFailed = "filesDeletePartiallyFailed", e.DeleteFailed = "deleteFailed", e.RenameFailed = "renameFailed", e.RenamePartiallyFailed = "renamePartiallyFailed", e.MoveFailed = "moveFailed", e.MovePartiallyFailed = "movePartiallyFailed", e.CopyFailed = "copyFailed", e.CopyPartiallyFailed = "copyPartiallyFailed", e.UnshareFailed = "unshareFailed", e.RemoveAccessFailed = "removeAccessFailed", e.UploadFailed = "uploadFailed", e.UploadCompleted = "uploadCompleted", e.UploadArchiveFailed = "uploadArchiveFailed", e.UploadArchivePartiallyFailed = "uploadArchivePartiallyFailed", e.UploadArchiveRequestFailed = "uploadArchiveRequestFailed", e;
|
|
16543
|
-
}({}),
|
|
16608
|
+
}({}), vm = /* @__PURE__ */ function(e) {
|
|
16544
16609
|
return e.Empty = "empty", e.ForbiddenSymbols = "forbiddenSymbols", e.ReservedName = "reservedName", e.TooLong = "tooLong", e.DuplicateName = "duplicateName", e.LeadingDot = "leadingDot", e;
|
|
16545
|
-
}({}),
|
|
16610
|
+
}({}), ym = /* @__PURE__ */ function(e) {
|
|
16546
16611
|
return e.FolderCreated = "folderCreated", e.FileRenamed = "fileRenamed", e.FileDownloaded = "fileDownloaded", e.FilesDownloaded = "filesDownloaded", e.FileCopied = "fileCopied", e.FilesCopied = "filesCopied", e.FileMoved = "fileMoved", e.FilesMoved = "filesMoved", e;
|
|
16547
|
-
}({}),
|
|
16612
|
+
}({}), bm = 3, xm = x, Sm = /[/\\]/, Cm = {
|
|
16548
16613
|
year: "numeric",
|
|
16549
16614
|
month: "short",
|
|
16550
16615
|
day: "2-digit"
|
|
16551
|
-
},
|
|
16616
|
+
}, wm = [
|
|
16552
16617
|
Qe.Name,
|
|
16553
16618
|
Qe.UpdatedAt,
|
|
16554
16619
|
Qe.Size,
|
|
16555
16620
|
Qe.Actions
|
|
16556
|
-
],
|
|
16621
|
+
], Tm = [
|
|
16557
16622
|
Qe.Name,
|
|
16558
16623
|
Qe.UpdatedAt,
|
|
16559
16624
|
Qe.Size,
|
|
16560
16625
|
Qe.Author,
|
|
16561
16626
|
Qe.Actions
|
|
16562
|
-
],
|
|
16627
|
+
], Em = {
|
|
16563
16628
|
READ: Ze.READ,
|
|
16564
16629
|
WRITE: Ze.WRITE,
|
|
16565
16630
|
SHARE: Ze.SHARE
|
|
16566
|
-
},
|
|
16631
|
+
}, Dm = (e) => {
|
|
16567
16632
|
switch (e) {
|
|
16568
16633
|
case _.Attach: return g.Attach;
|
|
16569
16634
|
case _.Standalone: return g.Browse;
|
|
16570
16635
|
case _.FolderPicker: return g.Full;
|
|
16571
16636
|
}
|
|
16572
|
-
},
|
|
16573
|
-
if (
|
|
16637
|
+
}, Om = (e, t) => {
|
|
16638
|
+
if (Sm.test(e)) return !0;
|
|
16574
16639
|
if (t == null) return !1;
|
|
16575
16640
|
t.lastIndex = 0;
|
|
16576
16641
|
let n = t.test(e);
|
|
16577
16642
|
return t.lastIndex = 0, n;
|
|
16578
|
-
},
|
|
16643
|
+
}, km = (e) => e.replace(/\/+$/, "") || "/", Am = (e, t) => {
|
|
16579
16644
|
let n = e.split("/").filter(Boolean);
|
|
16580
16645
|
return H(n[n.length - 1] ?? t);
|
|
16581
|
-
},
|
|
16582
|
-
let n =
|
|
16646
|
+
}, jm = (e, t) => km(e || `/${t}`).replace(/^\/+/, "") || t, Mm = (e, t) => {
|
|
16647
|
+
let n = km(t);
|
|
16583
16648
|
for (let r of e) {
|
|
16584
16649
|
if (r.nodeType !== B.FOLDER) continue;
|
|
16585
|
-
if (
|
|
16586
|
-
let e =
|
|
16650
|
+
if (km(r.path) === n) return r;
|
|
16651
|
+
let e = Mm(r.items ?? [], t);
|
|
16587
16652
|
if (e) return e;
|
|
16588
16653
|
}
|
|
16589
|
-
},
|
|
16654
|
+
}, Nm = (e) => e?.permissions?.includes(Ze.WRITE) ?? !1, Pm = (e, t) => {
|
|
16590
16655
|
for (let n of e) {
|
|
16591
16656
|
if (n.path === t || n.id === t) return n;
|
|
16592
|
-
let e =
|
|
16657
|
+
let e = Pm(n.items ?? [], t);
|
|
16593
16658
|
if (e) return e;
|
|
16594
16659
|
}
|
|
16595
|
-
},
|
|
16660
|
+
}, Fm = (e) => {
|
|
16596
16661
|
switch (e) {
|
|
16597
16662
|
case g.Attach: return !1;
|
|
16598
16663
|
case g.Browse:
|
|
16599
16664
|
case g.Full: return !0;
|
|
16600
16665
|
default: throw Error(`Unhandled actionProfile: ${String(e)}`);
|
|
16601
16666
|
}
|
|
16602
|
-
},
|
|
16667
|
+
}, Im = (e) => e === g.Full, Lm = (e, t) => {
|
|
16603
16668
|
let n = e.replace(/\/$/, ""), r = n.lastIndexOf("/");
|
|
16604
16669
|
if (r <= 0) {
|
|
16605
16670
|
let e = r === 0 ? n.slice(1) : n;
|
|
@@ -16612,13 +16677,13 @@ var Mu = (e) => ku.sanitize(e, Au), Nu = (e) => ku.sanitize(e, ju), Pu = (e) =>
|
|
|
16612
16677
|
parentVirtualPath: n.slice(0, r),
|
|
16613
16678
|
name: n.slice(r + 1)
|
|
16614
16679
|
};
|
|
16615
|
-
},
|
|
16680
|
+
}, Rm = (e, t) => {
|
|
16616
16681
|
let n = `files/${t}/`;
|
|
16617
16682
|
return e.startsWith(n) ? e.slice(n.length) : e;
|
|
16618
|
-
},
|
|
16683
|
+
}, zm = (e, t, n) => {
|
|
16619
16684
|
let r = e.replace(/\/+$/, "").split("/").filter(Boolean).map(H).join("/"), i = r ? `/${t}/${r}` : `/${t}`;
|
|
16620
16685
|
return n ? `${i}/` : i;
|
|
16621
|
-
},
|
|
16686
|
+
}, Bm = (e, t, n) => {
|
|
16622
16687
|
if (!e) return {
|
|
16623
16688
|
bucket: n,
|
|
16624
16689
|
path: e
|
|
@@ -16628,15 +16693,15 @@ var Mu = (e) => ku.sanitize(e, Au), Nu = (e) => ku.sanitize(e, ju), Pu = (e) =>
|
|
|
16628
16693
|
bucket: n,
|
|
16629
16694
|
path: e
|
|
16630
16695
|
};
|
|
16631
|
-
let o =
|
|
16696
|
+
let o = Rm(a.dialCorePath, a.bucket), s = r === -1 ? "" : e.slice(r + 1);
|
|
16632
16697
|
return {
|
|
16633
16698
|
bucket: a.bucket,
|
|
16634
16699
|
path: o + s
|
|
16635
16700
|
};
|
|
16636
|
-
},
|
|
16701
|
+
}, Vm = (e) => e.startsWith("files/"), Hm = (e, t) => {
|
|
16637
16702
|
let n = `files/${t}/`;
|
|
16638
16703
|
if (e.startsWith(n)) return H(e.slice(n.length));
|
|
16639
|
-
if (
|
|
16704
|
+
if (Vm(e)) {
|
|
16640
16705
|
let n = e.slice(6), r = n.indexOf("/");
|
|
16641
16706
|
if (r >= 0) {
|
|
16642
16707
|
let e = n.slice(0, r), i = n.slice(r + 1);
|
|
@@ -16644,7 +16709,7 @@ var Mu = (e) => ku.sanitize(e, Au), Nu = (e) => ku.sanitize(e, ju), Pu = (e) =>
|
|
|
16644
16709
|
}
|
|
16645
16710
|
}
|
|
16646
16711
|
return e;
|
|
16647
|
-
},
|
|
16712
|
+
}, Um = (e, t) => {
|
|
16648
16713
|
let n = `/${t}`, r = `/${t}/`, i = `${t}/`;
|
|
16649
16714
|
if (e === n || e === `${t}` || e === r || e === i) return "";
|
|
16650
16715
|
let a;
|
|
@@ -16656,13 +16721,13 @@ var Mu = (e) => ku.sanitize(e, Au), Nu = (e) => ku.sanitize(e, ju), Pu = (e) =>
|
|
|
16656
16721
|
}
|
|
16657
16722
|
let o = a.replace(/\/{2,}/g, "/");
|
|
16658
16723
|
return o && !o.endsWith("/") ? `${o}/` : o;
|
|
16659
|
-
},
|
|
16660
|
-
let r = e.nodeType === B.FOLDER, i = e.id ?
|
|
16724
|
+
}, Wm = (e, t) => e.startsWith("/") || e === t || e.startsWith(`${t}/`), Gm = (e, t, n) => {
|
|
16725
|
+
let r = e.nodeType === B.FOLDER, i = e.id ? Hm(e.id, t) : null, a = i != null && !Wm(i, n) ? i : Um(e.path, n);
|
|
16661
16726
|
return r ? a.endsWith("/") ? a : `${a}/` : a.replace(/\/$/, "");
|
|
16662
|
-
},
|
|
16663
|
-
let r = e.nodeType === B.FOLDER, i =
|
|
16727
|
+
}, Km = (e, t, n) => e.map((e) => {
|
|
16728
|
+
let r = e.nodeType === B.FOLDER, i = Um(e.sourceUrl, n), a = Um(e.destinationUrl, n), o = Am(e.sourceUrl, i);
|
|
16664
16729
|
return {
|
|
16665
|
-
destinationName:
|
|
16730
|
+
destinationName: Am(e.destinationUrl, a),
|
|
16666
16731
|
dto: {
|
|
16667
16732
|
bucket: t,
|
|
16668
16733
|
sourcePath: r ? i.endsWith("/") ? i : `${i}/` : i.replace(/\/$/, ""),
|
|
@@ -16672,9 +16737,9 @@ var Mu = (e) => ku.sanitize(e, Au), Nu = (e) => ku.sanitize(e, ju), Pu = (e) =>
|
|
|
16672
16737
|
name: o
|
|
16673
16738
|
}
|
|
16674
16739
|
};
|
|
16675
|
-
}),
|
|
16740
|
+
}), qm = (e, t, n) => {
|
|
16676
16741
|
let r = e.map((e) => {
|
|
16677
|
-
let t = e.nodeType === B.FOLDER, r =
|
|
16742
|
+
let t = e.nodeType === B.FOLDER, r = Um(e.sourceUrl, n), i = Um(e.destinationUrl, n), a = Am(e.sourceUrl, r), o = Am(e.destinationUrl, i), s = t ? r.endsWith("/") ? r : `${r}/` : r.replace(/\/$/, ""), c = t ? i.endsWith("/") ? i : `${i}/` : i.replace(/\/$/, "");
|
|
16678
16743
|
return {
|
|
16679
16744
|
isFolder: t,
|
|
16680
16745
|
name: a,
|
|
@@ -16706,14 +16771,14 @@ var Mu = (e) => ku.sanitize(e, Au), Nu = (e) => ku.sanitize(e, ju), Pu = (e) =>
|
|
|
16706
16771
|
}
|
|
16707
16772
|
}))
|
|
16708
16773
|
};
|
|
16709
|
-
},
|
|
16774
|
+
}, Jm = (e) => {
|
|
16710
16775
|
if (!e?.length) return;
|
|
16711
|
-
let t = e.map((e) =>
|
|
16776
|
+
let t = e.map((e) => Em[e.toUpperCase()]).filter((e) => e != null);
|
|
16712
16777
|
return t.length > 0 ? t : void 0;
|
|
16713
|
-
},
|
|
16778
|
+
}, Ym = (e, t) => {
|
|
16714
16779
|
let n = t.find((e) => e.success);
|
|
16715
16780
|
if (n != null) return e.find(({ dto: e }) => e.sourcePath === n.sourcePath && e.destinationPath === n.destinationPath) ?? e.find(({ dto: e }) => e.destinationPath === n.destinationPath) ?? e[0];
|
|
16716
|
-
},
|
|
16781
|
+
}, Xm = (e, t, n, r, i) => {
|
|
16717
16782
|
let a = e.get(n);
|
|
16718
16783
|
if (a == null) return [];
|
|
16719
16784
|
let o = r.replace(/\/$/, "");
|
|
@@ -16735,11 +16800,11 @@ var Mu = (e) => ku.sanitize(e, Au), Nu = (e) => ku.sanitize(e, ju), Pu = (e) =>
|
|
|
16735
16800
|
};
|
|
16736
16801
|
if (s) {
|
|
16737
16802
|
let r = `${n}${c}/`;
|
|
16738
|
-
u.permissions =
|
|
16803
|
+
u.permissions = Jm(a.permissions) ?? Jm(t.get(r)), u.items = Xm(e, t, r, l, a.path);
|
|
16739
16804
|
}
|
|
16740
16805
|
return u;
|
|
16741
16806
|
});
|
|
16742
|
-
},
|
|
16807
|
+
}, Zm = (e, t, n, r) => {
|
|
16743
16808
|
let i = new Map(e), a = [...i.get(t) ?? []], o = {
|
|
16744
16809
|
name: n.name,
|
|
16745
16810
|
path: n.path,
|
|
@@ -16751,7 +16816,7 @@ var Mu = (e) => ku.sanitize(e, Au), Nu = (e) => ku.sanitize(e, ju), Pu = (e) =>
|
|
|
16751
16816
|
permissions: r
|
|
16752
16817
|
};
|
|
16753
16818
|
return a.some((e) => e.name.toLowerCase() === n.name.toLowerCase()) || a.push(o), i.set(t, a), i;
|
|
16754
|
-
},
|
|
16819
|
+
}, Qm = (e, t, n) => {
|
|
16755
16820
|
if (!e) return e;
|
|
16756
16821
|
let r = typeof n == "string" ? { status: n } : n, i = e.files.map((e, n) => n === t ? {
|
|
16757
16822
|
...e,
|
|
@@ -16761,12 +16826,12 @@ var Mu = (e) => ku.sanitize(e, Au), Nu = (e) => ku.sanitize(e, ju), Pu = (e) =>
|
|
|
16761
16826
|
...e,
|
|
16762
16827
|
files: i
|
|
16763
16828
|
};
|
|
16764
|
-
},
|
|
16829
|
+
}, $m = (e, t, n, r, i) => {
|
|
16765
16830
|
if (t === z.Shared) {
|
|
16766
16831
|
if (r === "") return e.listSharedFiles({ path: void 0 }).then((e) => ({ items: e.items }));
|
|
16767
16832
|
let t = r.indexOf("/"), n = t === -1 ? r : r.slice(0, t), a = i.get(n);
|
|
16768
16833
|
if (a) {
|
|
16769
|
-
let n =
|
|
16834
|
+
let n = Rm(a.dialCorePath, a.bucket) + (t === -1 ? "" : r.slice(t + 1));
|
|
16770
16835
|
return e.listFiles({
|
|
16771
16836
|
bucket: a.bucket,
|
|
16772
16837
|
path: n,
|
|
@@ -16786,11 +16851,11 @@ var Mu = (e) => ku.sanitize(e, Au), Nu = (e) => ku.sanitize(e, ju), Pu = (e) =>
|
|
|
16786
16851
|
items: e.items,
|
|
16787
16852
|
permissions: e.permissions
|
|
16788
16853
|
}));
|
|
16789
|
-
},
|
|
16854
|
+
}, eh = async (e, t, n, r, i) => {
|
|
16790
16855
|
if (t === z.Shared) {
|
|
16791
16856
|
let t = r.indexOf("/"), n = t === -1 ? r : r.slice(0, t), a = i.get(n);
|
|
16792
16857
|
if (!a) return { items: [] };
|
|
16793
|
-
let o =
|
|
16858
|
+
let o = Rm(a.dialCorePath, a.bucket) + (t === -1 ? "" : r.slice(t + 1)), { items: s } = await e.listFiles({
|
|
16794
16859
|
bucket: a.bucket,
|
|
16795
16860
|
path: o,
|
|
16796
16861
|
permissions: !0,
|
|
@@ -16812,8 +16877,8 @@ var Mu = (e) => ku.sanitize(e, Au), Nu = (e) => ku.sanitize(e, ju), Pu = (e) =>
|
|
|
16812
16877
|
recursive: !0
|
|
16813
16878
|
});
|
|
16814
16879
|
return { items: a };
|
|
16815
|
-
},
|
|
16816
|
-
let r = e.nodeType === ke.Folder, i = H(e.name), a = e.bucket ?? t, o =
|
|
16880
|
+
}, th = (e, t, n) => {
|
|
16881
|
+
let r = e.nodeType === ke.Folder, i = H(e.name), a = e.bucket ?? t, o = Rm(e.url ?? e.path ?? "", a).replace(/\/$/, ""), s = o.lastIndexOf("/"), c = s > 0 ? o.slice(0, s) : "", l = c ? `/${n}/${c}` : `/${n}`, u = r ? `${l}/${i}/` : `${l}/${i}`;
|
|
16817
16882
|
return {
|
|
16818
16883
|
id: e.path,
|
|
16819
16884
|
name: i,
|
|
@@ -16828,22 +16893,22 @@ var Mu = (e) => ku.sanitize(e, Au), Nu = (e) => ku.sanitize(e, ju), Pu = (e) =>
|
|
|
16828
16893
|
contentType: e.contentType,
|
|
16829
16894
|
updatedAt: e.updatedAt ? new Date(e.updatedAt).toISOString() : void 0
|
|
16830
16895
|
};
|
|
16831
|
-
},
|
|
16896
|
+
}, nh = (e, t) => ({
|
|
16832
16897
|
...t,
|
|
16833
16898
|
bucket: e.bucket ?? t.bucket,
|
|
16834
16899
|
author: e.author,
|
|
16835
16900
|
contentLength: e.contentLength,
|
|
16836
16901
|
contentType: e.contentType,
|
|
16837
16902
|
resourceType: e.resourceType ?? t.resourceType,
|
|
16838
|
-
permissions:
|
|
16903
|
+
permissions: Jm(e.permissions) ?? t.permissions,
|
|
16839
16904
|
updatedAt: e.updatedAt ? new Date(e.updatedAt).toISOString() : t.updatedAt,
|
|
16840
16905
|
createdAt: e.createdAt ? new Date(e.createdAt).toISOString() : t.createdAt
|
|
16841
|
-
}),
|
|
16906
|
+
}), rh = (e) => e instanceof AbortSignal ? { signal: e } : e ?? {}, ih = (e, t) => ({
|
|
16842
16907
|
listPublicFiles: (t) => e.listPublicFiles(t),
|
|
16843
16908
|
listSharedFiles: (t) => e.listSharedFiles(t),
|
|
16844
16909
|
listFiles: (t, n) => e.listFiles(t, n ? { signal: n } : void 0),
|
|
16845
16910
|
uploadFile: (n, r, i, a) => {
|
|
16846
|
-
let { signal: o, onProgress: s, uploadMode: c } =
|
|
16911
|
+
let { signal: o, onProgress: s, uploadMode: c } = rh(a);
|
|
16847
16912
|
return s == null ? e.uploadFile({
|
|
16848
16913
|
bucket: n,
|
|
16849
16914
|
path: r,
|
|
@@ -16874,7 +16939,7 @@ var Mu = (e) => ku.sanitize(e, Au), Nu = (e) => ku.sanitize(e, ju), Pu = (e) =>
|
|
|
16874
16939
|
revokeAccess: (t) => e.revokeAccess({ revokeAccessDto: { items: t } }),
|
|
16875
16940
|
discardShared: (t) => e.discardShared({ discardSharedDto: { items: t } }),
|
|
16876
16941
|
listSharedByMe: (t) => e.listSharedByMe({ bucket: t })
|
|
16877
|
-
}),
|
|
16942
|
+
}), ah = (e) => {
|
|
16878
16943
|
let { uploadUrl: t, xhrFactory: n = () => new XMLHttpRequest() } = e;
|
|
16879
16944
|
return (r, i, a, { signal: o, onProgress: s, uploadMode: c } = {}) => new Promise((l, u) => {
|
|
16880
16945
|
let d = n();
|
|
@@ -16912,7 +16977,7 @@ var Mu = (e) => ku.sanitize(e, Au), Nu = (e) => ku.sanitize(e, ju), Pu = (e) =>
|
|
|
16912
16977
|
}
|
|
16913
16978
|
d.send(p);
|
|
16914
16979
|
});
|
|
16915
|
-
},
|
|
16980
|
+
}, oh = (e, t) => {
|
|
16916
16981
|
let { url: n } = e;
|
|
16917
16982
|
if (n == null) return;
|
|
16918
16983
|
let r = n.split("#")[0];
|
|
@@ -16921,12 +16986,12 @@ var Mu = (e) => ku.sanitize(e, Au), Nu = (e) => ku.sanitize(e, ju), Pu = (e) =>
|
|
|
16921
16986
|
if (n == null) return;
|
|
16922
16987
|
ue(n, e.title ?? r.split("/").pop() ?? "");
|
|
16923
16988
|
} else window.open(n, "_blank", "noopener,noreferrer");
|
|
16924
|
-
},
|
|
16925
|
-
typeof
|
|
16926
|
-
},
|
|
16989
|
+
}, sh = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date, ch = /* @__PURE__ */ new Set(), lh = typeof process == "object" && process ? process : {}, uh = (e, t, n, r) => {
|
|
16990
|
+
typeof lh.emitWarning == "function" ? lh.emitWarning(e, t, n, r) : console.error(`[${n}] ${t}: ${e}`);
|
|
16991
|
+
}, dh = globalThis.AbortController, fh = globalThis.AbortSignal;
|
|
16927
16992
|
/* c8 ignore start */
|
|
16928
|
-
if (
|
|
16929
|
-
|
|
16993
|
+
if (dh === void 0) {
|
|
16994
|
+
fh = class {
|
|
16930
16995
|
onabort;
|
|
16931
16996
|
_onabort = [];
|
|
16932
16997
|
reason;
|
|
@@ -16934,11 +16999,11 @@ if (ch === void 0) {
|
|
|
16934
16999
|
addEventListener(e, t) {
|
|
16935
17000
|
this._onabort.push(t);
|
|
16936
17001
|
}
|
|
16937
|
-
},
|
|
17002
|
+
}, dh = class {
|
|
16938
17003
|
constructor() {
|
|
16939
17004
|
t();
|
|
16940
17005
|
}
|
|
16941
|
-
signal = new
|
|
17006
|
+
signal = new fh();
|
|
16942
17007
|
abort(e) {
|
|
16943
17008
|
if (!this.signal.aborted) {
|
|
16944
17009
|
this.signal.reason = e, this.signal.aborted = !0;
|
|
@@ -16947,21 +17012,21 @@ if (ch === void 0) {
|
|
|
16947
17012
|
}
|
|
16948
17013
|
}
|
|
16949
17014
|
};
|
|
16950
|
-
let e =
|
|
16951
|
-
e && (e = !1,
|
|
17015
|
+
let e = lh.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1", t = () => {
|
|
17016
|
+
e && (e = !1, uh("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", t));
|
|
16952
17017
|
};
|
|
16953
17018
|
}
|
|
16954
17019
|
/* c8 ignore stop */
|
|
16955
|
-
var
|
|
17020
|
+
var ph = (e) => !ch.has(e), mh = (e) => e && e === Math.floor(e) && e > 0 && isFinite(e), hh = (e) => mh(e) ? e <= 2 ** 8 ? Uint8Array : e <= 2 ** 16 ? Uint16Array : e <= 2 ** 32 ? Uint32Array : e <= 2 ** 53 - 1 ? gh : null : null, gh = class extends Array {
|
|
16956
17021
|
constructor(e) {
|
|
16957
17022
|
super(e), this.fill(0);
|
|
16958
17023
|
}
|
|
16959
|
-
},
|
|
17024
|
+
}, _h = class e {
|
|
16960
17025
|
heap;
|
|
16961
17026
|
length;
|
|
16962
17027
|
static #e = !1;
|
|
16963
17028
|
static create(t) {
|
|
16964
|
-
let n =
|
|
17029
|
+
let n = hh(t);
|
|
16965
17030
|
if (!n) return [];
|
|
16966
17031
|
e.#e = !0;
|
|
16967
17032
|
let r = new e(t, n);
|
|
@@ -16978,7 +17043,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
16978
17043
|
pop() {
|
|
16979
17044
|
return this.heap[--this.length];
|
|
16980
17045
|
}
|
|
16981
|
-
},
|
|
17046
|
+
}, vh = class e {
|
|
16982
17047
|
#e;
|
|
16983
17048
|
#t;
|
|
16984
17049
|
#n;
|
|
@@ -17068,8 +17133,8 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17068
17133
|
}
|
|
17069
17134
|
constructor(t) {
|
|
17070
17135
|
let { max: n = 0, ttl: r, ttlResolution: i = 1, ttlAutopurge: a, updateAgeOnGet: o, updateAgeOnHas: s, allowStale: c, dispose: l, disposeAfter: u, noDisposeOnSet: d, noUpdateTTL: f, maxSize: p = 0, maxEntrySize: m = 0, sizeCalculation: h, fetchMethod: g, memoMethod: _, noDeleteOnFetchRejection: v, noDeleteOnStaleGet: y, allowStaleOnFetchRejection: b, allowStaleOnFetchAbort: x, ignoreFetchAbort: S } = t;
|
|
17071
|
-
if (n !== 0 && !
|
|
17072
|
-
let C = n ?
|
|
17136
|
+
if (n !== 0 && !mh(n)) throw TypeError("max option must be a nonnegative integer");
|
|
17137
|
+
let C = n ? hh(n) : Array;
|
|
17073
17138
|
if (!C) throw Error("invalid max value: " + n);
|
|
17074
17139
|
if (this.#e = n, this.#t = p, this.maxEntrySize = m || this.#t, this.sizeCalculation = h, this.sizeCalculation) {
|
|
17075
17140
|
if (!this.#t && !this.maxEntrySize) throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
@@ -17077,27 +17142,27 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17077
17142
|
}
|
|
17078
17143
|
if (_ !== void 0 && typeof _ != "function") throw TypeError("memoMethod must be a function if defined");
|
|
17079
17144
|
if (this.#a = _, g !== void 0 && typeof g != "function") throw TypeError("fetchMethod must be a function if specified");
|
|
17080
|
-
if (this.#i = g, this.#x = !!g, this.#c = /* @__PURE__ */ new Map(), this.#l = Array(n).fill(void 0), this.#u = Array(n).fill(void 0), this.#d = new C(n), this.#f = new C(n), this.#p = 0, this.#m = 0, this.#h =
|
|
17081
|
-
if (this.#t !== 0 && !
|
|
17082
|
-
if (!
|
|
17145
|
+
if (this.#i = g, this.#x = !!g, this.#c = /* @__PURE__ */ new Map(), this.#l = Array(n).fill(void 0), this.#u = Array(n).fill(void 0), this.#d = new C(n), this.#f = new C(n), this.#p = 0, this.#m = 0, this.#h = _h.create(n), this.#o = 0, this.#s = 0, typeof l == "function" && (this.#n = l), typeof u == "function" ? (this.#r = u, this.#g = []) : (this.#r = void 0, this.#g = void 0), this.#b = !!this.#n, this.#S = !!this.#r, this.noDisposeOnSet = !!d, this.noUpdateTTL = !!f, this.noDeleteOnFetchRejection = !!v, this.allowStaleOnFetchRejection = !!b, this.allowStaleOnFetchAbort = !!x, this.ignoreFetchAbort = !!S, this.maxEntrySize !== 0) {
|
|
17146
|
+
if (this.#t !== 0 && !mh(this.#t)) throw TypeError("maxSize must be a positive integer if specified");
|
|
17147
|
+
if (!mh(this.maxEntrySize)) throw TypeError("maxEntrySize must be a positive integer if specified");
|
|
17083
17148
|
this.#O();
|
|
17084
17149
|
}
|
|
17085
|
-
if (this.allowStale = !!c, this.noDeleteOnStaleGet = !!y, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!s, this.ttlResolution =
|
|
17086
|
-
if (!
|
|
17150
|
+
if (this.allowStale = !!c, this.noDeleteOnStaleGet = !!y, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!s, this.ttlResolution = mh(i) || i === 0 ? i : 1, this.ttlAutopurge = !!a, this.ttl = r || 0, this.ttl) {
|
|
17151
|
+
if (!mh(this.ttl)) throw TypeError("ttl must be a positive integer if specified");
|
|
17087
17152
|
this.#C();
|
|
17088
17153
|
}
|
|
17089
17154
|
if (this.#e === 0 && this.ttl === 0 && this.#t === 0) throw TypeError("At least one of max, maxSize, or ttl is required");
|
|
17090
17155
|
if (!this.ttlAutopurge && !this.#e && !this.#t) {
|
|
17091
17156
|
let t = "LRU_CACHE_UNBOUNDED";
|
|
17092
|
-
|
|
17157
|
+
ph(t) && (ch.add(t), uh("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", t, e));
|
|
17093
17158
|
}
|
|
17094
17159
|
}
|
|
17095
17160
|
getRemainingTTL(e) {
|
|
17096
17161
|
return this.#c.has(e) ? Infinity : 0;
|
|
17097
17162
|
}
|
|
17098
17163
|
#C() {
|
|
17099
|
-
let e = new
|
|
17100
|
-
this.#y = e, this.#v = t, this.#E = (n, r, i =
|
|
17164
|
+
let e = new gh(this.#e), t = new gh(this.#e);
|
|
17165
|
+
this.#y = e, this.#v = t, this.#E = (n, r, i = sh.now()) => {
|
|
17101
17166
|
if (t[n] = r === 0 ? 0 : i, e[n] = r, r !== 0 && this.ttlAutopurge) {
|
|
17102
17167
|
let e = setTimeout(() => {
|
|
17103
17168
|
this.#D(n) && this.#B(this.#l[n], "expire");
|
|
@@ -17106,7 +17171,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17106
17171
|
e.unref && e.unref();
|
|
17107
17172
|
}
|
|
17108
17173
|
}, this.#w = (n) => {
|
|
17109
|
-
t[n] = e[n] === 0 ? 0 :
|
|
17174
|
+
t[n] = e[n] === 0 ? 0 : sh.now();
|
|
17110
17175
|
}, this.#T = (i, a) => {
|
|
17111
17176
|
if (e[a]) {
|
|
17112
17177
|
let o = e[a], s = t[a];
|
|
@@ -17116,7 +17181,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17116
17181
|
}
|
|
17117
17182
|
};
|
|
17118
17183
|
let n = 0, r = () => {
|
|
17119
|
-
let e =
|
|
17184
|
+
let e = sh.now();
|
|
17120
17185
|
if (this.ttlResolution > 0) {
|
|
17121
17186
|
n = e;
|
|
17122
17187
|
let t = setTimeout(() => n = 0, this.ttlResolution);
|
|
@@ -17141,14 +17206,14 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17141
17206
|
/* c8 ignore stop */
|
|
17142
17207
|
#D = () => !1;
|
|
17143
17208
|
#O() {
|
|
17144
|
-
let e = new
|
|
17209
|
+
let e = new gh(this.#e);
|
|
17145
17210
|
this.#s = 0, this.#_ = e, this.#k = (t) => {
|
|
17146
17211
|
this.#s -= e[t], e[t] = 0;
|
|
17147
17212
|
}, this.#j = (e, t, n, r) => {
|
|
17148
17213
|
if (this.#L(t)) return 0;
|
|
17149
|
-
if (!
|
|
17214
|
+
if (!mh(n)) if (r) {
|
|
17150
17215
|
if (typeof r != "function") throw TypeError("sizeCalculation must be a function");
|
|
17151
|
-
if (n = r(t, e), !
|
|
17216
|
+
if (n = r(t, e), !mh(n)) throw TypeError("sizeCalculation return invalid (expect positive integer)");
|
|
17152
17217
|
} else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
|
|
17153
17218
|
return n;
|
|
17154
17219
|
}, this.#A = (t, n, r) => {
|
|
@@ -17233,7 +17298,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17233
17298
|
let i = { value: r };
|
|
17234
17299
|
if (this.#y && this.#v) {
|
|
17235
17300
|
let e = this.#y[t], n = this.#v[t];
|
|
17236
|
-
e && n && (i.ttl = e - (
|
|
17301
|
+
e && n && (i.ttl = e - (sh.now() - n), i.start = Date.now());
|
|
17237
17302
|
}
|
|
17238
17303
|
return this.#_ && (i.size = this.#_[t]), i;
|
|
17239
17304
|
}
|
|
@@ -17245,7 +17310,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17245
17310
|
let a = { value: i };
|
|
17246
17311
|
if (this.#y && this.#v) {
|
|
17247
17312
|
a.ttl = this.#y[t];
|
|
17248
|
-
let e =
|
|
17313
|
+
let e = sh.now() - this.#v[t];
|
|
17249
17314
|
a.start = Math.floor(Date.now() - e);
|
|
17250
17315
|
}
|
|
17251
17316
|
this.#_ && (a.size = this.#_[t]), e.unshift([n, a]);
|
|
@@ -17257,7 +17322,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17257
17322
|
for (let [t, n] of e) {
|
|
17258
17323
|
if (n.start) {
|
|
17259
17324
|
let e = Date.now() - n.start;
|
|
17260
|
-
n.start =
|
|
17325
|
+
n.start = sh.now() - e;
|
|
17261
17326
|
}
|
|
17262
17327
|
this.set(t, n.value, n);
|
|
17263
17328
|
}
|
|
@@ -17340,7 +17405,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17340
17405
|
#I(e, t, n, r) {
|
|
17341
17406
|
let i = t === void 0 ? void 0 : this.#u[t];
|
|
17342
17407
|
if (this.#L(i)) return i;
|
|
17343
|
-
let a = new
|
|
17408
|
+
let a = new dh(), { signal: o } = n;
|
|
17344
17409
|
o?.addEventListener("abort", () => a.abort(o.reason), { signal: a.signal });
|
|
17345
17410
|
let s = {
|
|
17346
17411
|
signal: a.signal,
|
|
@@ -17375,7 +17440,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17375
17440
|
#L(e) {
|
|
17376
17441
|
if (!this.#x) return !1;
|
|
17377
17442
|
let t = e;
|
|
17378
|
-
return !!t && t instanceof Promise && t.hasOwnProperty("__staleWhileFetching") && t.__abortController instanceof
|
|
17443
|
+
return !!t && t instanceof Promise && t.hasOwnProperty("__staleWhileFetching") && t.__abortController instanceof dh;
|
|
17379
17444
|
}
|
|
17380
17445
|
async fetch(e, t = {}) {
|
|
17381
17446
|
let { allowStale: n = this.allowStale, updateAgeOnGet: r = this.updateAgeOnGet, noDeleteOnStaleGet: i = this.noDeleteOnStaleGet, ttl: a = this.ttl, noDisposeOnSet: o = this.noDisposeOnSet, size: s = 0, sizeCalculation: c = this.sizeCalculation, noUpdateTTL: l = this.noUpdateTTL, noDeleteOnFetchRejection: u = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: d = this.allowStaleOnFetchRejection, ignoreFetchAbort: f = this.ignoreFetchAbort, allowStaleOnFetchAbort: p = this.allowStaleOnFetchAbort, context: m, forceRefresh: h = !1, status: g, signal: _ } = t;
|
|
@@ -17499,18 +17564,18 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17499
17564
|
for (; t = e?.shift();) this.#r?.(...t);
|
|
17500
17565
|
}
|
|
17501
17566
|
}
|
|
17502
|
-
},
|
|
17567
|
+
}, yh = (e, t) => URL.createObjectURL(D(e, t)), bh = (e) => {
|
|
17503
17568
|
let t = pe(e);
|
|
17504
17569
|
return t == null ? e : new TextDecoder().decode(t);
|
|
17505
|
-
},
|
|
17570
|
+
}, xh = (n, r) => ({
|
|
17506
17571
|
type: e.Error,
|
|
17507
17572
|
errorType: n === 403 ? t.Forbidden : t.LoadFailed,
|
|
17508
17573
|
url: r
|
|
17509
|
-
}),
|
|
17574
|
+
}), Sh = (n) => ({
|
|
17510
17575
|
type: e.Error,
|
|
17511
17576
|
errorType: t.LoadFailed,
|
|
17512
17577
|
url: n
|
|
17513
|
-
}),
|
|
17578
|
+
}), Ch = (e) => {
|
|
17514
17579
|
let t;
|
|
17515
17580
|
try {
|
|
17516
17581
|
t = new URL(e).pathname;
|
|
@@ -17523,55 +17588,55 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17523
17588
|
} catch {
|
|
17524
17589
|
return n;
|
|
17525
17590
|
}
|
|
17526
|
-
},
|
|
17527
|
-
if (
|
|
17528
|
-
let r =
|
|
17591
|
+
}, wh = (e) => e.startsWith("image/") || e.startsWith("audio/") || e === S.PDF || i("", e), Th = (e, t) => {
|
|
17592
|
+
if (wh(e)) return e;
|
|
17593
|
+
let r = Ch(t), i = r.lastIndexOf(".");
|
|
17529
17594
|
return (i === -1 ? "" : r.slice(i + 1).toLowerCase()) === v.PDF ? S.PDF : n(r) ?? e;
|
|
17530
|
-
},
|
|
17531
|
-
if (
|
|
17532
|
-
let n =
|
|
17595
|
+
}, Eh = (e, t) => {
|
|
17596
|
+
if (wh(Th(e, t))) return !0;
|
|
17597
|
+
let n = Ch(t);
|
|
17533
17598
|
return a(n) || r(n);
|
|
17534
|
-
},
|
|
17535
|
-
|
|
17536
|
-
},
|
|
17537
|
-
let t =
|
|
17599
|
+
}, Dh = new vh({ max: 10 }), Oh = new vh({ max: 50 }), kh = () => {
|
|
17600
|
+
Dh.clear(), Oh.clear();
|
|
17601
|
+
}, Ah = (e) => {
|
|
17602
|
+
let t = Dh.get(e);
|
|
17538
17603
|
return t ?? (t = fetch(e).then((e) => {
|
|
17539
17604
|
if (!e.ok) throw Object.assign(/* @__PURE__ */ Error(`HTTP ${e.status}`), { status: e.status });
|
|
17540
17605
|
return e.blob();
|
|
17541
17606
|
}).catch((t) => {
|
|
17542
|
-
throw
|
|
17543
|
-
}),
|
|
17544
|
-
},
|
|
17545
|
-
let t =
|
|
17607
|
+
throw Dh.delete(e), t;
|
|
17608
|
+
}), Dh.set(e, t)), t;
|
|
17609
|
+
}, jh = (e) => {
|
|
17610
|
+
let t = Oh.get(e);
|
|
17546
17611
|
return t ?? (t = fetch(e).then((e) => {
|
|
17547
17612
|
if (!e.ok) throw Object.assign(/* @__PURE__ */ Error(`HTTP ${e.status}`), { status: e.status });
|
|
17548
17613
|
return e.text();
|
|
17549
17614
|
}).catch((t) => {
|
|
17550
|
-
throw
|
|
17551
|
-
}),
|
|
17552
|
-
},
|
|
17615
|
+
throw Oh.delete(e), t;
|
|
17616
|
+
}), Oh.set(e, t)), t;
|
|
17617
|
+
}, Mh = async (e, t) => {
|
|
17553
17618
|
if ("file" in e) return URL.createObjectURL(e.file);
|
|
17554
17619
|
let n = t.resolveDialUrl(e);
|
|
17555
17620
|
if (n != null) try {
|
|
17556
|
-
let e = await
|
|
17621
|
+
let e = await Ah(n);
|
|
17557
17622
|
return URL.createObjectURL(e);
|
|
17558
17623
|
} catch (e) {
|
|
17559
17624
|
let t = e.status;
|
|
17560
|
-
return t == null ?
|
|
17625
|
+
return t == null ? Sh(n) : xh(t, n);
|
|
17561
17626
|
}
|
|
17562
17627
|
if (e.previewUrl != null) return e.previewUrl;
|
|
17563
|
-
if (e.data != null) return
|
|
17564
|
-
},
|
|
17565
|
-
if (e.data != null) return
|
|
17628
|
+
if (e.data != null) return yh(e.data, e.contentType);
|
|
17629
|
+
}, Nh = async (e, t) => {
|
|
17630
|
+
if (e.data != null) return bh(e.data);
|
|
17566
17631
|
let n = t.resolveDialUrl(e);
|
|
17567
17632
|
if (n != null) try {
|
|
17568
|
-
return await
|
|
17633
|
+
return await jh(n);
|
|
17569
17634
|
} catch (e) {
|
|
17570
17635
|
let t = e.status;
|
|
17571
|
-
return t == null ?
|
|
17636
|
+
return t == null ? Sh(n) : xh(t, n);
|
|
17572
17637
|
}
|
|
17573
17638
|
if ("file" in e) return e.file.text();
|
|
17574
|
-
},
|
|
17639
|
+
}, Ph = (e, t) => e.data != null || t.resolveDialUrl(e) != null || "file" in e, Fh = (t, n) => {
|
|
17575
17640
|
if ("file" in t) return {
|
|
17576
17641
|
type: e.Image,
|
|
17577
17642
|
url: URL.createObjectURL(t.file)
|
|
@@ -17579,7 +17644,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17579
17644
|
let r = n.resolveDialUrl(t);
|
|
17580
17645
|
return r == null ? t.previewUrl == null ? t.data == null ? null : {
|
|
17581
17646
|
type: e.Image,
|
|
17582
|
-
url:
|
|
17647
|
+
url: yh(t.data, t.contentType)
|
|
17583
17648
|
} : {
|
|
17584
17649
|
type: e.Image,
|
|
17585
17650
|
url: t.previewUrl
|
|
@@ -17587,37 +17652,37 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17587
17652
|
type: e.Image,
|
|
17588
17653
|
url: r
|
|
17589
17654
|
};
|
|
17590
|
-
},
|
|
17591
|
-
let r = await
|
|
17655
|
+
}, Ih = async (t, n) => {
|
|
17656
|
+
let r = await Nh(t, n);
|
|
17592
17657
|
return r == null ? null : typeof r == "string" ? {
|
|
17593
17658
|
type: e.PlainText,
|
|
17594
17659
|
text: r
|
|
17595
17660
|
} : r;
|
|
17596
|
-
},
|
|
17597
|
-
let r = await
|
|
17661
|
+
}, Lh = async (t, n) => {
|
|
17662
|
+
let r = await Nh(t, n);
|
|
17598
17663
|
return r == null ? null : typeof r == "string" ? {
|
|
17599
17664
|
type: e.Markdown,
|
|
17600
17665
|
text: r
|
|
17601
17666
|
} : r;
|
|
17602
|
-
},
|
|
17603
|
-
let i = await
|
|
17667
|
+
}, Rh = 1048576, zh = async (t, n, r) => {
|
|
17668
|
+
let i = await Nh(t, n);
|
|
17604
17669
|
return i == null ? null : typeof i == "string" ? {
|
|
17605
17670
|
type: e.Code,
|
|
17606
17671
|
text: i,
|
|
17607
17672
|
language: r
|
|
17608
17673
|
} : i;
|
|
17609
|
-
},
|
|
17610
|
-
let r = await
|
|
17674
|
+
}, Bh = async (t, n) => {
|
|
17675
|
+
let r = await Nh(t, n);
|
|
17611
17676
|
if (r == null) return null;
|
|
17612
17677
|
if (typeof r != "string") return r;
|
|
17613
|
-
if (r.length >
|
|
17678
|
+
if (r.length > Rh) return null;
|
|
17614
17679
|
let i = n.resolveDialUrl(t) ?? void 0;
|
|
17615
17680
|
return {
|
|
17616
17681
|
type: e.Html,
|
|
17617
17682
|
srcdoc: r,
|
|
17618
17683
|
url: i
|
|
17619
17684
|
};
|
|
17620
|
-
},
|
|
17685
|
+
}, Vh = (t, n, r) => {
|
|
17621
17686
|
let i = t.body?.source?.attachment;
|
|
17622
17687
|
if (i?.type !== S.PDF) return null;
|
|
17623
17688
|
let a = Ot(i.url) ? r.resolveDialFileDownloadUrl(i.url) : i.url;
|
|
@@ -17629,7 +17694,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17629
17694
|
highlights: he(s),
|
|
17630
17695
|
selectedHighlightId: me(t, c)
|
|
17631
17696
|
};
|
|
17632
|
-
},
|
|
17697
|
+
}, Hh = (t, n) => {
|
|
17633
17698
|
let r = M(t.url);
|
|
17634
17699
|
if (r == null) return null;
|
|
17635
17700
|
let i = Ot(r.baseUrl) ? n.resolveDialFileDownloadUrl(r.baseUrl) : r.baseUrl;
|
|
@@ -17658,39 +17723,39 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17658
17723
|
}],
|
|
17659
17724
|
selectedHighlightId: a
|
|
17660
17725
|
};
|
|
17661
|
-
},
|
|
17726
|
+
}, Uh = (e) => {
|
|
17662
17727
|
try {
|
|
17663
17728
|
let t = new URL(e).protocol;
|
|
17664
17729
|
return t === "http:" || t === "https:" || t === "blob:";
|
|
17665
17730
|
} catch {
|
|
17666
17731
|
return !1;
|
|
17667
17732
|
}
|
|
17668
|
-
},
|
|
17669
|
-
let r = await
|
|
17733
|
+
}, Wh = (e) => e.url != null && !Ot(e.url) && Uh(e.url) ? e.url : void 0, Gh = async (t, n) => {
|
|
17734
|
+
let r = await Mh(t, n);
|
|
17670
17735
|
if (r != null) return typeof r == "string" ? {
|
|
17671
17736
|
type: e.Pdf,
|
|
17672
17737
|
url: r
|
|
17673
17738
|
} : r;
|
|
17674
|
-
let i =
|
|
17739
|
+
let i = Wh(t);
|
|
17675
17740
|
return i == null ? null : {
|
|
17676
17741
|
type: e.Pdf,
|
|
17677
17742
|
url: i
|
|
17678
17743
|
};
|
|
17679
|
-
},
|
|
17680
|
-
let i = await
|
|
17744
|
+
}, Kh = async (t, n, r) => {
|
|
17745
|
+
let i = await Mh(t, n);
|
|
17681
17746
|
if (i != null) return typeof i == "string" ? {
|
|
17682
17747
|
type: e.Ooxml,
|
|
17683
17748
|
url: i,
|
|
17684
17749
|
format: r
|
|
17685
17750
|
} : i;
|
|
17686
|
-
let a =
|
|
17751
|
+
let a = Wh(t);
|
|
17687
17752
|
return a == null ? null : {
|
|
17688
17753
|
type: e.Ooxml,
|
|
17689
17754
|
url: a,
|
|
17690
17755
|
format: r
|
|
17691
17756
|
};
|
|
17692
|
-
},
|
|
17693
|
-
let r = await
|
|
17757
|
+
}, qh = async (t, n) => {
|
|
17758
|
+
let r = await Nh(t, n);
|
|
17694
17759
|
if (r == null) return null;
|
|
17695
17760
|
if (typeof r != "string") return r;
|
|
17696
17761
|
try {
|
|
@@ -17705,8 +17770,8 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17705
17770
|
text: r
|
|
17706
17771
|
};
|
|
17707
17772
|
}
|
|
17708
|
-
},
|
|
17709
|
-
let a = await
|
|
17773
|
+
}, Jh = async (t, n, r, i) => {
|
|
17774
|
+
let a = await Nh(t, n);
|
|
17710
17775
|
if (a == null || typeof a != "string") return null;
|
|
17711
17776
|
let o = {};
|
|
17712
17777
|
try {
|
|
@@ -17727,7 +17792,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17727
17792
|
visualizerName: r.title,
|
|
17728
17793
|
requestTimeout: r.requestTimeout
|
|
17729
17794
|
};
|
|
17730
|
-
},
|
|
17795
|
+
}, Yh = (e, t) => le(e, t), Xh = (e) => {
|
|
17731
17796
|
let t = e.body?.source?.attachment;
|
|
17732
17797
|
return t == null ? null : {
|
|
17733
17798
|
id: t.url,
|
|
@@ -17737,12 +17802,12 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17737
17802
|
status: w.Idle,
|
|
17738
17803
|
url: t.url
|
|
17739
17804
|
};
|
|
17740
|
-
},
|
|
17805
|
+
}, Zh = (e, t) => e?.map((e) => Yh(e, t)) ?? [], Qh = (e, t) => {
|
|
17741
17806
|
let n = e.url ?? e.id;
|
|
17742
17807
|
if (n) return Ot(n) || n.startsWith("http://") || n.startsWith("https://") ? n : `files/${t}/${n.replace(/^\/+/, "")}`;
|
|
17743
|
-
},
|
|
17808
|
+
}, $h = (e, t, n) => {
|
|
17744
17809
|
if (e.nodeType !== qe.ITEM) return null;
|
|
17745
|
-
let r =
|
|
17810
|
+
let r = Qh(e, t);
|
|
17746
17811
|
if (!r) return null;
|
|
17747
17812
|
let i = e.contentType ?? "application/octet-stream", a = i.startsWith("image/"), o = a ? n?.resolvePreviewUrl?.(r) : void 0;
|
|
17748
17813
|
return {
|
|
@@ -17755,7 +17820,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17755
17820
|
file: new File([], e.name, { type: i }),
|
|
17756
17821
|
...o == null ? {} : { previewUrl: o }
|
|
17757
17822
|
};
|
|
17758
|
-
},
|
|
17823
|
+
}, eg = (e, t, n) => e.map((e) => $h(e, t, n)).filter((e) => e != null), tg = (e) => {
|
|
17759
17824
|
let t = H(e.replace(/\/$/, "").split("/").filter(Boolean).pop() ?? "");
|
|
17760
17825
|
return {
|
|
17761
17826
|
id: e,
|
|
@@ -17766,11 +17831,11 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17766
17831
|
url: e,
|
|
17767
17832
|
file: new File([], t)
|
|
17768
17833
|
};
|
|
17769
|
-
},
|
|
17834
|
+
}, ng = /* @__PURE__ */ function(e) {
|
|
17770
17835
|
return e.Blob = "blob", e.Stream = "stream", e.Cancelled = "cancelled", e;
|
|
17771
|
-
}({}),
|
|
17836
|
+
}({}), rg = async (e, t = "application/octet-stream") => {
|
|
17772
17837
|
let n = window.showSaveFilePicker;
|
|
17773
|
-
if (n == null) return { type:
|
|
17838
|
+
if (n == null) return { type: ng.Blob };
|
|
17774
17839
|
try {
|
|
17775
17840
|
let r = e.lastIndexOf("."), i = r >= 0 ? e.slice(r) : void 0, a = await n.call(window, {
|
|
17776
17841
|
suggestedName: e,
|
|
@@ -17780,27 +17845,27 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17780
17845
|
}]
|
|
17781
17846
|
});
|
|
17782
17847
|
return {
|
|
17783
|
-
type:
|
|
17848
|
+
type: ng.Stream,
|
|
17784
17849
|
writable: await a.createWritable()
|
|
17785
17850
|
};
|
|
17786
17851
|
} catch (e) {
|
|
17787
|
-
if (e instanceof DOMException && e.name === "AbortError") return { type:
|
|
17852
|
+
if (e instanceof DOMException && e.name === "AbortError") return { type: ng.Cancelled };
|
|
17788
17853
|
throw e;
|
|
17789
17854
|
}
|
|
17790
|
-
},
|
|
17855
|
+
}, ig = (e) => {
|
|
17791
17856
|
let t = e.lastIndexOf("."), n = t > 0;
|
|
17792
17857
|
return {
|
|
17793
17858
|
base: n ? e.slice(0, t) : e,
|
|
17794
17859
|
extension: n ? e.slice(t) : ""
|
|
17795
17860
|
};
|
|
17796
|
-
},
|
|
17861
|
+
}, ag = (e, t = 255) => {
|
|
17797
17862
|
if (A(e) <= t) return e;
|
|
17798
|
-
let { base: n, extension: r } =
|
|
17863
|
+
let { base: n, extension: r } = ig(e), i = t - A(r);
|
|
17799
17864
|
return i <= 0 ? fe(e, t) : `${fe(n, i)}${r}`;
|
|
17800
|
-
},
|
|
17801
|
-
let { base: t, extension: n } =
|
|
17802
|
-
return r === "" ? e :
|
|
17803
|
-
},
|
|
17865
|
+
}, og = (e) => {
|
|
17866
|
+
let { base: t, extension: n } = ig(e), r = t.replace(new RegExp(Ye.source, "g"), "_").replace(/[.\s]+$/, "");
|
|
17867
|
+
return r === "" ? e : ag(`${r}${n}`);
|
|
17868
|
+
}, sg = ({ filesApi: e, bucket: t, rootLabel: n, activeTab: r, onNotification: i }) => {
|
|
17804
17869
|
let [a, o] = L(""), [s, c] = L(() => /* @__PURE__ */ new Map()), l = I(s);
|
|
17805
17870
|
P(() => {
|
|
17806
17871
|
l.current = s;
|
|
@@ -17812,11 +17877,11 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17812
17877
|
D.current != null && clearTimeout(D.current), O.current?.();
|
|
17813
17878
|
}, []), P(() => {
|
|
17814
17879
|
let i = !1;
|
|
17815
|
-
return p(!0), h(null),
|
|
17880
|
+
return p(!0), h(null), $m(e, r, t, a, S.current).then(({ items: e, permissions: t }) => {
|
|
17816
17881
|
i || (c((t) => {
|
|
17817
17882
|
let n = new Map(t);
|
|
17818
17883
|
return n.set(a, e), n;
|
|
17819
|
-
}), d((e) => new Map(e).set(a, t)), r === z.Shared && a === "" && (y(e.map((e) =>
|
|
17884
|
+
}), d((e) => new Map(e).set(a, t)), r === z.Shared && a === "" && (y(e.map((e) => zm(Rm(e.path, e.bucket ?? ""), n, e.nodeType === ke.Folder))), S.current = new Map(e.map((e) => [H(e.name), {
|
|
17820
17885
|
bucket: e.bucket ?? "",
|
|
17821
17886
|
dialCorePath: e.path
|
|
17822
17887
|
}]))));
|
|
@@ -17847,7 +17912,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17847
17912
|
}
|
|
17848
17913
|
let i = !1;
|
|
17849
17914
|
return e.listSharedByMe(t).then((e) => {
|
|
17850
|
-
i || x(new Set(e.items.map((e) =>
|
|
17915
|
+
i || x(new Set(e.items.map((e) => zm(Rm(e.path, t), n, e.nodeType === ke.Folder))));
|
|
17851
17916
|
}).catch(() => {
|
|
17852
17917
|
i || x(/* @__PURE__ */ new Set());
|
|
17853
17918
|
}), () => {
|
|
@@ -17867,8 +17932,8 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17867
17932
|
parentPath: "",
|
|
17868
17933
|
nodeType: B.FOLDER,
|
|
17869
17934
|
folderId: t,
|
|
17870
|
-
permissions:
|
|
17871
|
-
items:
|
|
17935
|
+
permissions: Jm(u.get("")),
|
|
17936
|
+
items: Xm(s, u, "", `/${n}`, t)
|
|
17872
17937
|
}], [
|
|
17873
17938
|
s,
|
|
17874
17939
|
u,
|
|
@@ -17896,7 +17961,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17896
17961
|
_((e) => e + 1);
|
|
17897
17962
|
}, []), de = ue, fe = N((o) => {
|
|
17898
17963
|
if (o.length === 0) return;
|
|
17899
|
-
let s = new Set([...ne].map((e) =>
|
|
17964
|
+
let s = new Set([...ne].map((e) => Um(e, n))), l = (e) => e === a || a.startsWith(e) || s.has(e), u = o.filter((e) => !l(e)), f = o.filter((e) => l(e) && e !== a);
|
|
17900
17965
|
u.length > 0 && (c((e) => {
|
|
17901
17966
|
let t = new Map(e);
|
|
17902
17967
|
return u.forEach((e) => t.delete(e)), t;
|
|
@@ -17906,7 +17971,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17906
17971
|
})), f.forEach((n) => {
|
|
17907
17972
|
(async () => {
|
|
17908
17973
|
try {
|
|
17909
|
-
let { items: i, permissions: a } = await
|
|
17974
|
+
let { items: i, permissions: a } = await $m(e, r, t, n, S.current);
|
|
17910
17975
|
c((e) => new Map(e).set(n, i)), a != null && d((e) => new Map(e).set(n, a));
|
|
17911
17976
|
} catch {
|
|
17912
17977
|
i?.({
|
|
@@ -17925,9 +17990,9 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17925
17990
|
n,
|
|
17926
17991
|
i
|
|
17927
17992
|
]), pe = N((e, t, n) => {
|
|
17928
|
-
c((r) =>
|
|
17993
|
+
c((r) => Zm(r, e, t, n));
|
|
17929
17994
|
}, []), me = N((a) => {
|
|
17930
|
-
let o = a == null ? "" :
|
|
17995
|
+
let o = a == null ? "" : Um(a, n), s = a ?? `/${n}`;
|
|
17931
17996
|
if (A((e) => {
|
|
17932
17997
|
if (e.has(s)) return e;
|
|
17933
17998
|
let t = new Set(e);
|
|
@@ -17945,7 +18010,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17945
18010
|
return t.add(s), t;
|
|
17946
18011
|
}), (async () => {
|
|
17947
18012
|
try {
|
|
17948
|
-
let { items: n, permissions: i } = await
|
|
18013
|
+
let { items: n, permissions: i } = await $m(e, r, t, o, S.current);
|
|
17949
18014
|
c((e) => new Map(e).set(o, n)), i != null && d((e) => new Map(e).set(o, i)), te.current.delete(o);
|
|
17950
18015
|
} catch {
|
|
17951
18016
|
i?.({
|
|
@@ -17969,7 +18034,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17969
18034
|
]), he = F(() => {
|
|
17970
18035
|
let e = /* @__PURE__ */ new Set(), t = new Set([...ne, ...ae]);
|
|
17971
18036
|
for (let r of t) {
|
|
17972
|
-
let t =
|
|
18037
|
+
let t = Um(r, n);
|
|
17973
18038
|
s.has(t) && e.add(r);
|
|
17974
18039
|
}
|
|
17975
18040
|
return e;
|
|
@@ -17980,15 +18045,15 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17980
18045
|
n
|
|
17981
18046
|
]), j = N((a) => {
|
|
17982
18047
|
ne.forEach((e) => {
|
|
17983
|
-
a.has(e) || te.current.delete(
|
|
18048
|
+
a.has(e) || te.current.delete(Um(e, n));
|
|
17984
18049
|
}), re(a), [...a].filter((e) => {
|
|
17985
|
-
let t =
|
|
18050
|
+
let t = Um(e, n);
|
|
17986
18051
|
return !l.current.has(t) && !ee.current.has(t) && !te.current.has(t);
|
|
17987
18052
|
}).forEach((a) => {
|
|
17988
|
-
let o =
|
|
18053
|
+
let o = Um(a, n);
|
|
17989
18054
|
ee.current.add(o), (async () => {
|
|
17990
18055
|
try {
|
|
17991
|
-
let { items: n, permissions: i } = await
|
|
18056
|
+
let { items: n, permissions: i } = await $m(e, r, t, o, S.current);
|
|
17992
18057
|
c((e) => new Map(e).set(o, n)), i != null && d((e) => new Map(e).set(o, i));
|
|
17993
18058
|
} catch {
|
|
17994
18059
|
te.current.add(o), i?.({
|
|
@@ -18021,7 +18086,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18021
18086
|
D.current = null;
|
|
18022
18087
|
let i = o.toLowerCase();
|
|
18023
18088
|
if (r === z.Shared && a === "") {
|
|
18024
|
-
O.current?.(), O.current = null, w(!0), E((s.get("") ?? []).filter((e) => H(e.name).toLowerCase().includes(i)).map((e) =>
|
|
18089
|
+
O.current?.(), O.current = null, w(!0), E((s.get("") ?? []).filter((e) => H(e.name).toLowerCase().includes(i)).map((e) => th(e, e.bucket ?? t, n))), w(!1);
|
|
18025
18090
|
return;
|
|
18026
18091
|
}
|
|
18027
18092
|
let c = !1;
|
|
@@ -18029,9 +18094,9 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18029
18094
|
c = !0;
|
|
18030
18095
|
}, w(!0), (async () => {
|
|
18031
18096
|
try {
|
|
18032
|
-
let { items: o } = await
|
|
18097
|
+
let { items: o } = await eh(e, r, t, a, S.current);
|
|
18033
18098
|
if (c) return;
|
|
18034
|
-
E(o.filter((e) => H(e.name).toLowerCase().includes(i)).map((e) =>
|
|
18099
|
+
E(o.filter((e) => H(e.name).toLowerCase().includes(i)).map((e) => th(e, e.bucket ?? t, n)));
|
|
18035
18100
|
} catch {
|
|
18036
18101
|
c || E([]);
|
|
18037
18102
|
} finally {
|
|
@@ -18048,7 +18113,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18048
18113
|
n
|
|
18049
18114
|
]), _e = a ? `/${n}/${a}` : `/${n}`, ve = F(() => {
|
|
18050
18115
|
let e = ce[0];
|
|
18051
|
-
if (e) return
|
|
18116
|
+
if (e) return km(_e) === km(`/${n}`) ? e : Mm(e.items ?? [], _e);
|
|
18052
18117
|
}, [
|
|
18053
18118
|
ce,
|
|
18054
18119
|
_e,
|
|
@@ -18082,7 +18147,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18082
18147
|
mergeCreatedFolder: pe,
|
|
18083
18148
|
bumpRetry: de
|
|
18084
18149
|
};
|
|
18085
|
-
},
|
|
18150
|
+
}, cg = ({ filesApi: e, bucket: t, rootLabel: n, onNotification: r }) => {
|
|
18086
18151
|
let [i, a] = L(void 0), [o, s] = L(!1);
|
|
18087
18152
|
return {
|
|
18088
18153
|
fileMetadata: i,
|
|
@@ -18091,8 +18156,8 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18091
18156
|
(async () => {
|
|
18092
18157
|
s(!0);
|
|
18093
18158
|
try {
|
|
18094
|
-
let r = i.bucket ?? t, o =
|
|
18095
|
-
a(
|
|
18159
|
+
let r = i.bucket ?? t, o = Gm(i, r, n);
|
|
18160
|
+
a(nh(await e.getFileMetadata({
|
|
18096
18161
|
bucket: r,
|
|
18097
18162
|
path: o
|
|
18098
18163
|
}), i));
|
|
@@ -18115,30 +18180,30 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18115
18180
|
a(void 0), s(!1);
|
|
18116
18181
|
}, [])
|
|
18117
18182
|
};
|
|
18118
|
-
},
|
|
18183
|
+
}, lg = ({ filesApi: e, bucket: t, rootLabel: n, activeTab: r, folderPath: i, currentFolder: a, sharedRootMetaRef: o, listingPermissionsCache: s, invalidateFolders: c, bumpRetry: l, mergeCreatedFolder: u, setFolderPath: d, onNotification: f, onOperationSuccess: p, downloadDestination: m, forbiddenSymbolsRegExp: h }) => {
|
|
18119
18184
|
let [g, _] = L(!1), [v, y] = L(!1), [b, x] = L(!1), [S, C] = L(!1), [w, T] = L(!1), [E, D] = L(!1), O = I(null), ee = I(null), te = N((e, t) => {
|
|
18120
18185
|
let n = null;
|
|
18121
|
-
if (!e || e.trim() === "") n = { reason:
|
|
18122
|
-
else if (
|
|
18123
|
-
reason:
|
|
18186
|
+
if (!e || e.trim() === "") n = { reason: vm.Empty };
|
|
18187
|
+
else if (Om(e, h)) n = {
|
|
18188
|
+
reason: vm.ForbiddenSymbols,
|
|
18124
18189
|
symbols: Je
|
|
18125
18190
|
};
|
|
18126
|
-
else if (e.startsWith(".")) n = { reason:
|
|
18127
|
-
else if (e ===
|
|
18191
|
+
else if (e.startsWith(".")) n = { reason: vm.LeadingDot };
|
|
18192
|
+
else if (e === xm) n = { reason: vm.ReservedName };
|
|
18128
18193
|
else if (e.length > 255) n = {
|
|
18129
|
-
reason:
|
|
18194
|
+
reason: vm.TooLong,
|
|
18130
18195
|
maxLength: 255
|
|
18131
18196
|
};
|
|
18132
18197
|
else {
|
|
18133
18198
|
let r = t.items ?? [], i = e.toLowerCase(), a = r.find((e) => e.name.toLowerCase() === i);
|
|
18134
18199
|
a && (n = {
|
|
18135
|
-
reason:
|
|
18200
|
+
reason: vm.DuplicateName,
|
|
18136
18201
|
existingName: a.name
|
|
18137
18202
|
});
|
|
18138
18203
|
}
|
|
18139
18204
|
return ee.current = n, n;
|
|
18140
18205
|
}, [h]), ne = N(async (c, d, m) => {
|
|
18141
|
-
let { parentVirtualPath: h, name: g } =
|
|
18206
|
+
let { parentVirtualPath: h, name: g } = Lm(d, n), v = Um(h, n), y = a && i === v ? a : {
|
|
18142
18207
|
id: v,
|
|
18143
18208
|
path: v,
|
|
18144
18209
|
name: h.split("/").filter(Boolean).pop() ?? "",
|
|
@@ -18148,7 +18213,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18148
18213
|
}, b = ee.current;
|
|
18149
18214
|
if (ee.current = null, te(g, y) || b) return;
|
|
18150
18215
|
_(!0);
|
|
18151
|
-
let { bucket: x, path: S } = r === z.Shared ?
|
|
18216
|
+
let { bucket: x, path: S } = r === z.Shared ? Bm(v, o.current, t) : {
|
|
18152
18217
|
bucket: t,
|
|
18153
18218
|
path: v
|
|
18154
18219
|
};
|
|
@@ -18158,7 +18223,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18158
18223
|
parentPath: S || void 0,
|
|
18159
18224
|
name: g
|
|
18160
18225
|
}), s.get(v)), l(), p?.({
|
|
18161
|
-
kind:
|
|
18226
|
+
kind: ym.FolderCreated,
|
|
18162
18227
|
name: g
|
|
18163
18228
|
});
|
|
18164
18229
|
} catch {
|
|
@@ -18188,32 +18253,32 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18188
18253
|
y(!0);
|
|
18189
18254
|
try {
|
|
18190
18255
|
let i = r.length === 1 ? r[0].nodeType === B.ITEM ? r[0].name : `${r[0].name}.zip` : "files.zip", a = await m.resolveDestination(i, r.length === 1 && r[0].nodeType === B.ITEM ? r[0].contentType ?? "application/octet-stream" : "application/zip");
|
|
18191
|
-
if (a.type ===
|
|
18256
|
+
if (a.type === ng.Cancelled) return;
|
|
18192
18257
|
if (r.length === 1 && r[0].nodeType === B.ITEM) {
|
|
18193
18258
|
let t = r[0];
|
|
18194
18259
|
if (!t.bucket) throw Error("File is missing bucket");
|
|
18195
|
-
let i =
|
|
18260
|
+
let i = Gm(t, t.bucket, n), o = await e.downloadFile(t.bucket, i);
|
|
18196
18261
|
if (!o.ok) throw Error(`Download failed with status ${o.status}`);
|
|
18197
18262
|
let s = await m.triggerDownload(o, t.name, a);
|
|
18198
18263
|
p?.({
|
|
18199
|
-
kind:
|
|
18264
|
+
kind: ym.FileDownloaded,
|
|
18200
18265
|
name: s,
|
|
18201
18266
|
count: 1
|
|
18202
18267
|
});
|
|
18203
18268
|
} else {
|
|
18204
18269
|
let o = r.map((e) => ({
|
|
18205
18270
|
bucket: e.bucket ?? t,
|
|
18206
|
-
path:
|
|
18271
|
+
path: Gm(e, e.bucket ?? t, n),
|
|
18207
18272
|
name: e.name,
|
|
18208
18273
|
nodeType: e.nodeType === B.FOLDER ? Ee.Folder : Ee.Item
|
|
18209
18274
|
})), s = await e.downloadArchive(o);
|
|
18210
18275
|
if (!s.ok) throw Error(`Download failed with status ${s.status}`);
|
|
18211
18276
|
let c = await m.triggerDownload(s, i, a);
|
|
18212
18277
|
r.length === 1 ? p?.({
|
|
18213
|
-
kind:
|
|
18278
|
+
kind: ym.FileDownloaded,
|
|
18214
18279
|
name: c
|
|
18215
18280
|
}) : p?.({
|
|
18216
|
-
kind:
|
|
18281
|
+
kind: ym.FilesDownloaded,
|
|
18217
18282
|
count: r.length
|
|
18218
18283
|
});
|
|
18219
18284
|
}
|
|
@@ -18237,7 +18302,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18237
18302
|
a.length !== 0 && (async () => {
|
|
18238
18303
|
x(!0);
|
|
18239
18304
|
let u = a.map((e) => {
|
|
18240
|
-
let i = e.nodeType === B.FOLDER, a =
|
|
18305
|
+
let i = e.nodeType === B.FOLDER, a = Um(e.sourceUrl, n), s = i ? a : a.replace(/\/$/, ""), c = Am(e.sourceUrl, s), { bucket: l, path: u } = r === z.Shared ? Bm(s, o.current, t) : {
|
|
18241
18306
|
bucket: t,
|
|
18242
18307
|
path: s
|
|
18243
18308
|
};
|
|
@@ -18290,19 +18355,19 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18290
18355
|
l,
|
|
18291
18356
|
d
|
|
18292
18357
|
]), k = N((e, t) => {
|
|
18293
|
-
if (!e || e.trim() === "") return { reason:
|
|
18294
|
-
if (e ===
|
|
18295
|
-
if (
|
|
18296
|
-
reason:
|
|
18358
|
+
if (!e || e.trim() === "") return { reason: vm.Empty };
|
|
18359
|
+
if (e === xm) return { reason: vm.ReservedName };
|
|
18360
|
+
if (Om(e, h)) return {
|
|
18361
|
+
reason: vm.ForbiddenSymbols,
|
|
18297
18362
|
symbols: Je
|
|
18298
18363
|
};
|
|
18299
18364
|
if (e.length > 255) return {
|
|
18300
|
-
reason:
|
|
18365
|
+
reason: vm.TooLong,
|
|
18301
18366
|
maxLength: 255
|
|
18302
18367
|
};
|
|
18303
18368
|
let n = a?.items ?? [], r = e.toLowerCase(), i = n.find((e) => e.path !== t.path && e.name.toLowerCase() === r);
|
|
18304
18369
|
return i ? {
|
|
18305
|
-
reason:
|
|
18370
|
+
reason: vm.DuplicateName,
|
|
18306
18371
|
existingName: i.name
|
|
18307
18372
|
} : null;
|
|
18308
18373
|
}, [h, a]), ae = N((r, i) => {
|
|
@@ -18310,16 +18375,16 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18310
18375
|
let a = new AbortController();
|
|
18311
18376
|
O.current = a, (async () => {
|
|
18312
18377
|
T(!0);
|
|
18313
|
-
let o =
|
|
18378
|
+
let o = Km(r, t, n), s = o.map(({ dto: e }) => e);
|
|
18314
18379
|
try {
|
|
18315
18380
|
let { results: t } = await e.copyFiles(s, a.signal), r = t.filter((e) => !e.success).length, c = t.length - r;
|
|
18316
18381
|
if (c > 0) {
|
|
18317
|
-
let e =
|
|
18382
|
+
let e = Ym(o, t);
|
|
18318
18383
|
p?.({
|
|
18319
|
-
kind: c === 1 ?
|
|
18384
|
+
kind: c === 1 ? ym.FileCopied : ym.FilesCopied,
|
|
18320
18385
|
name: e?.destinationName,
|
|
18321
18386
|
count: c,
|
|
18322
|
-
destinationFolderName:
|
|
18387
|
+
destinationFolderName: jm(i, n)
|
|
18323
18388
|
});
|
|
18324
18389
|
}
|
|
18325
18390
|
r > 0 && r < t.length ? f?.({
|
|
@@ -18366,7 +18431,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18366
18431
|
onRenameValidate: k,
|
|
18367
18432
|
onMoveToFiles: N((r, a, o) => {
|
|
18368
18433
|
if (r.length === 0 || w || E || S) return;
|
|
18369
|
-
let { renameDtos: s, preparedMoveItems: u } =
|
|
18434
|
+
let { renameDtos: s, preparedMoveItems: u } = qm(r, t, n), m = u.map(({ dto: e }) => e), h = new AbortController();
|
|
18370
18435
|
m.length > 0 && (O.current = h), (async () => {
|
|
18371
18436
|
s.length > 0 && C(!0), m.length > 0 && D(!0);
|
|
18372
18437
|
let [t, r] = await Promise.all([(async () => {
|
|
@@ -18408,19 +18473,19 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18408
18473
|
}
|
|
18409
18474
|
})()]), a = t.threw ? s.length : t.results.filter((e) => !e.success).length, g = r.threw && r.aborted, _ = g ? 0 : m.length, v = g ? 0 : r.threw ? m.length : r.results.filter((e) => !e.success).length, y = r.threw ? 0 : r.results.filter((e) => e.success).length, b = s.length + _, x = a + v, S = v > 0;
|
|
18410
18475
|
if (y > 0) {
|
|
18411
|
-
let e =
|
|
18476
|
+
let e = Ym(u, r.results);
|
|
18412
18477
|
p?.({
|
|
18413
|
-
kind: y === 1 ?
|
|
18478
|
+
kind: y === 1 ? ym.FileMoved : ym.FilesMoved,
|
|
18414
18479
|
name: e?.destinationName,
|
|
18415
18480
|
count: y,
|
|
18416
|
-
destinationFolderName:
|
|
18481
|
+
destinationFolderName: jm(o, n)
|
|
18417
18482
|
});
|
|
18418
18483
|
}
|
|
18419
18484
|
if (s.length === 1 && a === 0) {
|
|
18420
18485
|
let [e] = s;
|
|
18421
18486
|
p?.({
|
|
18422
|
-
kind:
|
|
18423
|
-
name:
|
|
18487
|
+
kind: ym.FileRenamed,
|
|
18488
|
+
name: Am(e.destinationPath, e.destinationPath),
|
|
18424
18489
|
isFolder: e.nodeType === je.Folder
|
|
18425
18490
|
});
|
|
18426
18491
|
}
|
|
@@ -18459,7 +18524,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18459
18524
|
onCopyFiles: ae,
|
|
18460
18525
|
cancelCopyMove: A
|
|
18461
18526
|
};
|
|
18462
|
-
},
|
|
18527
|
+
}, ug = ({ filesApi: e, bucket: t, rootLabel: n, bumpRetry: r, onNotification: i }) => {
|
|
18463
18528
|
let [a, o] = L(!1), [s, c] = L(!1);
|
|
18464
18529
|
return {
|
|
18465
18530
|
isUnsharing: a,
|
|
@@ -18471,7 +18536,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18471
18536
|
let r = e.bucket ?? t;
|
|
18472
18537
|
return {
|
|
18473
18538
|
bucket: r,
|
|
18474
|
-
path:
|
|
18539
|
+
path: Gm(e, r, n)
|
|
18475
18540
|
};
|
|
18476
18541
|
});
|
|
18477
18542
|
try {
|
|
@@ -18499,7 +18564,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18499
18564
|
let r = e.bucket ?? t;
|
|
18500
18565
|
return {
|
|
18501
18566
|
bucket: r,
|
|
18502
|
-
path:
|
|
18567
|
+
path: Gm(e, r, n)
|
|
18503
18568
|
};
|
|
18504
18569
|
});
|
|
18505
18570
|
try {
|
|
@@ -18521,18 +18586,18 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18521
18586
|
r
|
|
18522
18587
|
])
|
|
18523
18588
|
};
|
|
18524
|
-
},
|
|
18525
|
-
let t = e.slice(0,
|
|
18589
|
+
}, dg = 5, fg = (e) => e.error ? `${e.path} (${e.error})` : e.path, pg = (e) => {
|
|
18590
|
+
let t = e.slice(0, dg);
|
|
18526
18591
|
return {
|
|
18527
|
-
names: t.map(
|
|
18592
|
+
names: t.map(fg),
|
|
18528
18593
|
restCount: e.length - t.length
|
|
18529
18594
|
};
|
|
18530
|
-
},
|
|
18595
|
+
}, mg = (e, t) => `${e}${t}/`, hg = (e) => /\.zip$/i.test(e), gg = (e) => {
|
|
18531
18596
|
let [t] = e;
|
|
18532
|
-
if (!(e.length !== 1 || t == null)) return
|
|
18533
|
-
},
|
|
18597
|
+
if (!(e.length !== 1 || t == null)) return hg(t.fileContent.name) && !hg(t.name) ? t : void 0;
|
|
18598
|
+
}, _g = ({ filesApi: e, bucket: t, rootLabel: n, activeTab: r, cache: i, sharedRootMetaRef: a, invalidateFolders: o, bumpRetry: s, onNotification: c }) => {
|
|
18534
18599
|
let [l, u] = L(null), d = I(null), f = N((r, i, a) => {
|
|
18535
|
-
let l =
|
|
18600
|
+
let l = Um(a, n);
|
|
18536
18601
|
u({
|
|
18537
18602
|
files: [{
|
|
18538
18603
|
id: `${Date.now()}-archive`,
|
|
@@ -18542,7 +18607,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18542
18607
|
isOpen: !0
|
|
18543
18608
|
}), (async () => {
|
|
18544
18609
|
try {
|
|
18545
|
-
let { results: n } = await e.uploadArchive(r, t,
|
|
18610
|
+
let { results: n } = await e.uploadArchive(r, t, mg(l, i)), a = n.filter((e) => e.success).length, o = n.filter((e) => !e.success), s = o.length, { names: u, restCount: d } = pg(o);
|
|
18546
18611
|
n.length > 0 && a === 0 ? c?.({
|
|
18547
18612
|
variant: R.Error,
|
|
18548
18613
|
reason: $.UploadArchiveFailed,
|
|
@@ -18575,7 +18640,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18575
18640
|
return {
|
|
18576
18641
|
onUploadFiles: N((l, p) => {
|
|
18577
18642
|
if (l.length === 0) return;
|
|
18578
|
-
let m =
|
|
18643
|
+
let m = gg(l);
|
|
18579
18644
|
if (m != null) {
|
|
18580
18645
|
f(m.fileContent, m.name, p);
|
|
18581
18646
|
return;
|
|
@@ -18589,7 +18654,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18589
18654
|
})),
|
|
18590
18655
|
isOpen: !0
|
|
18591
18656
|
});
|
|
18592
|
-
let g =
|
|
18657
|
+
let g = Um(p, n), { bucket: _, path: v } = r === z.Shared ? Bm(g, a.current, t) : {
|
|
18593
18658
|
bucket: t,
|
|
18594
18659
|
path: g
|
|
18595
18660
|
}, b = new Set((i.get(g) ?? []).map((e) => e.name.toLowerCase()));
|
|
@@ -18598,31 +18663,31 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18598
18663
|
for (; t < l.length;) {
|
|
18599
18664
|
let n = t++, a = l[n];
|
|
18600
18665
|
if (h.signal.aborted) {
|
|
18601
|
-
u((e) =>
|
|
18666
|
+
u((e) => Qm(e, n, y.Cancelled));
|
|
18602
18667
|
continue;
|
|
18603
18668
|
}
|
|
18604
|
-
u((e) =>
|
|
18669
|
+
u((e) => Qm(e, n, {
|
|
18605
18670
|
status: y.Uploading,
|
|
18606
18671
|
percent: 0
|
|
18607
18672
|
}));
|
|
18608
|
-
let o = b.has(a.name.toLowerCase()) ?
|
|
18673
|
+
let o = b.has(a.name.toLowerCase()) ? _m.Overwrite : _m.CreateOnly;
|
|
18609
18674
|
try {
|
|
18610
18675
|
await e.uploadFile(_, `${v}${a.name}`, a.fileContent, {
|
|
18611
18676
|
signal: h.signal,
|
|
18612
18677
|
uploadMode: o,
|
|
18613
18678
|
onProgress: (e) => {
|
|
18614
|
-
u((t) =>
|
|
18679
|
+
u((t) => Qm(t, n, {
|
|
18615
18680
|
status: y.Uploading,
|
|
18616
18681
|
percent: e
|
|
18617
18682
|
}));
|
|
18618
18683
|
}
|
|
18619
|
-
}), u((e) =>
|
|
18684
|
+
}), u((e) => Qm(e, n, {
|
|
18620
18685
|
status: y.Completed,
|
|
18621
18686
|
percent: 100
|
|
18622
18687
|
})), r += 1;
|
|
18623
18688
|
} catch {
|
|
18624
18689
|
let e = h.signal.aborted ? y.Cancelled : y.Failed;
|
|
18625
|
-
e === y.Failed && (i += 1), u((t) =>
|
|
18690
|
+
e === y.Failed && (i += 1), u((t) => Qm(t, n, e));
|
|
18626
18691
|
}
|
|
18627
18692
|
}
|
|
18628
18693
|
};
|
|
@@ -18651,7 +18716,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18651
18716
|
f(e, t, n);
|
|
18652
18717
|
}, [f]),
|
|
18653
18718
|
onValidateUpload: N(async (e, t, n) => {
|
|
18654
|
-
for (let t of e) t.name =
|
|
18719
|
+
for (let t of e) t.name = og(t.name);
|
|
18655
18720
|
return { valid: !0 };
|
|
18656
18721
|
}, []),
|
|
18657
18722
|
uploadBatchState: l,
|
|
@@ -18662,14 +18727,14 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18662
18727
|
u(null);
|
|
18663
18728
|
}, [])
|
|
18664
18729
|
};
|
|
18665
|
-
},
|
|
18666
|
-
let m = c ??
|
|
18730
|
+
}, vg = ({ filesApi: e, bucket: t, rootLabel: n = "My files", activeTab: r = z.MyFiles, onNotification: i, onOperationSuccess: a, forbiddenSymbolsRegExp: o, variant: s = _.Attach, actionProfile: c, labels: l, locale: u, disabledNewButtonTooltip: d, downloadDestination: f, buildValidationErrorMessage: p }) => {
|
|
18731
|
+
let m = c ?? Dm(s), h = sg({
|
|
18667
18732
|
filesApi: e,
|
|
18668
18733
|
bucket: t,
|
|
18669
18734
|
rootLabel: n,
|
|
18670
18735
|
activeTab: r,
|
|
18671
18736
|
onNotification: i
|
|
18672
|
-
}), v =
|
|
18737
|
+
}), v = _g({
|
|
18673
18738
|
filesApi: e,
|
|
18674
18739
|
bucket: t,
|
|
18675
18740
|
rootLabel: n,
|
|
@@ -18679,7 +18744,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18679
18744
|
invalidateFolders: h.invalidateFolders,
|
|
18680
18745
|
bumpRetry: h.bumpRetry,
|
|
18681
18746
|
onNotification: i
|
|
18682
|
-
}), y =
|
|
18747
|
+
}), y = lg({
|
|
18683
18748
|
filesApi: e,
|
|
18684
18749
|
bucket: t,
|
|
18685
18750
|
rootLabel: n,
|
|
@@ -18696,27 +18761,27 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18696
18761
|
onOperationSuccess: a,
|
|
18697
18762
|
downloadDestination: f,
|
|
18698
18763
|
forbiddenSymbolsRegExp: o
|
|
18699
|
-
}), b =
|
|
18764
|
+
}), b = ug({
|
|
18700
18765
|
filesApi: e,
|
|
18701
18766
|
bucket: t,
|
|
18702
18767
|
rootLabel: n,
|
|
18703
18768
|
bumpRetry: h.bumpRetry,
|
|
18704
18769
|
onNotification: i
|
|
18705
|
-
}), x =
|
|
18770
|
+
}), x = cg({
|
|
18706
18771
|
filesApi: e,
|
|
18707
18772
|
bucket: t,
|
|
18708
18773
|
rootLabel: n,
|
|
18709
18774
|
onNotification: i
|
|
18710
|
-
}), S =
|
|
18775
|
+
}), S = Nm(h.currentFolder), C = F(() => r === z.Organization || r === z.Shared && h.folderPath === "" ? !1 : S, [
|
|
18711
18776
|
r,
|
|
18712
18777
|
h.folderPath,
|
|
18713
18778
|
S
|
|
18714
|
-
]), w = F(() => r === z.Shared ?
|
|
18779
|
+
]), w = F(() => r === z.Shared ? Tm : wm, [r]), T = F(() => {
|
|
18715
18780
|
let e = {}, t = (t) => {
|
|
18716
18781
|
let n = l[t];
|
|
18717
18782
|
n != null && (e[t] = n);
|
|
18718
18783
|
};
|
|
18719
|
-
return t(Xe.Download), r === z.MyFiles ? (t(Xe.Delete), C && (t(Xe.Rename),
|
|
18784
|
+
return t(Xe.Download), r === z.MyFiles ? (t(Xe.Delete), C && (t(Xe.Rename), Fm(m) && (t(Xe.Copy), t(Xe.Move), t(Xe.Duplicate))), Im(m) && t(Xe.RemoveAccess)) : r === z.Shared && Im(m) && t(Xe.Unshare), m === g.Full && t(Xe.Info), e;
|
|
18720
18785
|
}, [
|
|
18721
18786
|
r,
|
|
18722
18787
|
C,
|
|
@@ -18780,7 +18845,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18780
18845
|
disabledNewButtonTooltip: d,
|
|
18781
18846
|
visibleColumns: w,
|
|
18782
18847
|
dateLocale: u,
|
|
18783
|
-
dateOptions:
|
|
18848
|
+
dateOptions: Cm,
|
|
18784
18849
|
actionLabels: T,
|
|
18785
18850
|
sharedWithMeIds: h.sharedWithMeIds,
|
|
18786
18851
|
sharedByMePaths: h.sharedByMePaths,
|
|
@@ -18794,30 +18859,30 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18794
18859
|
clearMetadata: x.clearMetadata,
|
|
18795
18860
|
isAnyOperationInProgress: E
|
|
18796
18861
|
};
|
|
18797
|
-
},
|
|
18862
|
+
}, yg = [
|
|
18798
18863
|
z.MyFiles,
|
|
18799
18864
|
z.Shared,
|
|
18800
18865
|
z.Organization
|
|
18801
|
-
],
|
|
18866
|
+
], bg = (e, t, n, r) => {
|
|
18802
18867
|
let i = N((e) => r == null || r.includes(e), [r]), a = F(() => n?.filter((e) => i(e.id)).flatMap(({ id: e, label: t, disabled: n }) => typeof t == "string" ? [{
|
|
18803
18868
|
id: e,
|
|
18804
18869
|
label: t,
|
|
18805
18870
|
disabled: n
|
|
18806
18871
|
}] : []), [n, i]);
|
|
18807
18872
|
return P(() => {
|
|
18808
|
-
i(e) || t(
|
|
18873
|
+
i(e) || t(yg.find((e) => i(e)) ?? z.MyFiles);
|
|
18809
18874
|
}, [
|
|
18810
18875
|
i,
|
|
18811
18876
|
e,
|
|
18812
18877
|
t
|
|
18813
18878
|
]), { tabs: a };
|
|
18814
|
-
},
|
|
18879
|
+
}, xg = "custom_app", Sg = (e) => !!e && e.id === xg, Cg = (e) => !!e && (!!e.id?.endsWith("quickapps2") || e.displayName === "Quick app 2.0"), wg = () => {
|
|
18815
18880
|
try {
|
|
18816
18881
|
return Intl.DateTimeFormat().resolvedOptions().timeZone || void 0;
|
|
18817
18882
|
} catch {
|
|
18818
18883
|
return;
|
|
18819
18884
|
}
|
|
18820
|
-
},
|
|
18885
|
+
}, Tg = (e) => {
|
|
18821
18886
|
let t = e.trim();
|
|
18822
18887
|
if (!t || !/^https?:\/\//.test(t)) return !1;
|
|
18823
18888
|
try {
|
|
@@ -18825,39 +18890,39 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18825
18890
|
} catch {
|
|
18826
18891
|
return !1;
|
|
18827
18892
|
}
|
|
18828
|
-
},
|
|
18893
|
+
}, Eg = (e) => {
|
|
18829
18894
|
let t = e.trim();
|
|
18830
18895
|
if (t) try {
|
|
18831
18896
|
return JSON.parse(t);
|
|
18832
18897
|
} catch {
|
|
18833
18898
|
return;
|
|
18834
18899
|
}
|
|
18835
|
-
},
|
|
18900
|
+
}, Dg = ["rate_endpoint", "configuration_endpoint"], Og = (e) => {
|
|
18836
18901
|
let t = e.trim();
|
|
18837
18902
|
if (!t) return !0;
|
|
18838
18903
|
try {
|
|
18839
18904
|
let e = JSON.parse(t);
|
|
18840
18905
|
if (typeof e != "object" || !e || Array.isArray(e)) return !1;
|
|
18841
18906
|
let n = Object.keys(e);
|
|
18842
|
-
return n.length > 0 && n.every((e) =>
|
|
18907
|
+
return n.length > 0 && n.every((e) => Dg.includes(e));
|
|
18843
18908
|
} catch {
|
|
18844
18909
|
return !1;
|
|
18845
18910
|
}
|
|
18846
|
-
},
|
|
18847
|
-
let t = e.indexOf(
|
|
18911
|
+
}, kg = "/external_services/", Ag = (e) => {
|
|
18912
|
+
let t = e.indexOf(kg);
|
|
18848
18913
|
if (t === -1) return null;
|
|
18849
18914
|
let n = e.slice(0, t), r = e.slice(t + 19);
|
|
18850
18915
|
return !n || !r ? null : {
|
|
18851
18916
|
appId: n,
|
|
18852
18917
|
serviceName: r
|
|
18853
18918
|
};
|
|
18854
|
-
},
|
|
18919
|
+
}, jg = (e, t) => `${e}${kg}${t}`, Mg = (e) => {
|
|
18855
18920
|
try {
|
|
18856
18921
|
return decodeURIComponent(e);
|
|
18857
18922
|
} catch {
|
|
18858
18923
|
return e;
|
|
18859
18924
|
}
|
|
18860
|
-
},
|
|
18925
|
+
}, Ng = {
|
|
18861
18926
|
settings: "Settings",
|
|
18862
18927
|
savedNotification: "Chat settings have been saved",
|
|
18863
18928
|
responseFormatLabel: "Response format",
|
|
@@ -18873,11 +18938,11 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18873
18938
|
temperatureHint: "Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.",
|
|
18874
18939
|
saveLabel: "Apply changes",
|
|
18875
18940
|
saveDisabledTooltip: "Please select a response format"
|
|
18876
|
-
},
|
|
18941
|
+
}, Pg = (e) => (e ?? "").toLowerCase().replace(/[^a-z]/g, "") === "plaintext" ? T.PlainText : T.Markdown, Fg = (e) => {
|
|
18877
18942
|
let t = F(() => ({
|
|
18878
|
-
...
|
|
18943
|
+
...Ng,
|
|
18879
18944
|
...e.labels
|
|
18880
|
-
}), [e.labels]), { onSaved: n } = e, r = e.mode === "local" ? e.values.responseFormat :
|
|
18945
|
+
}), [e.labels]), { onSaved: n } = e, r = e.mode === "local" ? e.values.responseFormat : Pg(e.conversation.responseFormat), i = e.mode === "local" ? e.values.systemPrompt : e.conversation.prompt ?? "", a = e.mode === "local" ? e.values.temperature : e.conversation.temperature ?? .5, o = N((t) => {
|
|
18881
18946
|
e.mode === "local" ? e.onValuesChange({
|
|
18882
18947
|
responseFormat: t.responseFormat ?? e.values.responseFormat,
|
|
18883
18948
|
systemPrompt: t.systemPrompt ?? e.values.systemPrompt,
|
|
@@ -18925,7 +18990,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18925
18990
|
i,
|
|
18926
18991
|
a
|
|
18927
18992
|
]);
|
|
18928
|
-
},
|
|
18993
|
+
}, Ig = (e = !0, t = !0) => {
|
|
18929
18994
|
let [n, r] = L(!1), [i, a] = L([]), o = I(0), s = I(e), c = I(t);
|
|
18930
18995
|
ve(() => {
|
|
18931
18996
|
s.current = e, c.current = t, t || (o.current = 0, r(!1));
|
|
@@ -18954,20 +19019,20 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18954
19019
|
pendingFiles: i,
|
|
18955
19020
|
onFilesConsumed: l
|
|
18956
19021
|
};
|
|
18957
|
-
},
|
|
18958
|
-
let [e, t] = L(
|
|
19022
|
+
}, Lg = () => typeof window < "u" ? window.innerWidth : 1024, Rg = () => {
|
|
19023
|
+
let [e, t] = L(Lg);
|
|
18959
19024
|
return P(() => {
|
|
18960
19025
|
if (typeof window > "u") return;
|
|
18961
19026
|
let e = () => t(window.innerWidth);
|
|
18962
19027
|
return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
18963
19028
|
}, []), e;
|
|
18964
|
-
},
|
|
18965
|
-
let t =
|
|
19029
|
+
}, zg = (e) => {
|
|
19030
|
+
let t = Rg();
|
|
18966
19031
|
return Math.max(0, t - e);
|
|
18967
|
-
},
|
|
19032
|
+
}, Bg = (e) => e.map((e) => e === Pe.Edit ? $e.Edit : $e.View), Vg = (e, t) => {
|
|
18968
19033
|
let n = new URL(e, t);
|
|
18969
19034
|
return `${t}${n.pathname}${n.search}${n.hash}`;
|
|
18970
|
-
},
|
|
19035
|
+
}, Hg = (e, t, n = window.location.origin) => {
|
|
18971
19036
|
let [r, i] = L(), [a, o] = L(!0), [s, c] = L(null), l = I(0), u = N(async (r = [$e.View]) => {
|
|
18972
19037
|
let a = ++l.current;
|
|
18973
19038
|
o(!0), c(null);
|
|
@@ -18977,9 +19042,9 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18977
19042
|
access: r
|
|
18978
19043
|
} });
|
|
18979
19044
|
l.current === a && i({
|
|
18980
|
-
url:
|
|
19045
|
+
url: Vg(o.url, n),
|
|
18981
19046
|
expiresInDays: o.expiresInDays,
|
|
18982
|
-
access:
|
|
19047
|
+
access: Bg(o.access)
|
|
18983
19048
|
});
|
|
18984
19049
|
} catch (e) {
|
|
18985
19050
|
l.current === a && c(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to create share link"));
|
|
@@ -19001,18 +19066,18 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
19001
19066
|
u(e);
|
|
19002
19067
|
}, [u])
|
|
19003
19068
|
};
|
|
19004
|
-
},
|
|
19069
|
+
}, Ug = (e) => e.type === "boolean" || e.type == null && typeof e.default == "boolean", Wg = (e) => {
|
|
19005
19070
|
let t = e.replace(/[_-]+/g, " ").trim();
|
|
19006
19071
|
return t.length === 0 ? e : t.charAt(0).toUpperCase() + t.slice(1);
|
|
19007
|
-
},
|
|
19072
|
+
}, Gg = (e) => {
|
|
19008
19073
|
let t = e?.properties;
|
|
19009
|
-
return t == null ? [] : Object.entries(t).filter(([, e]) =>
|
|
19074
|
+
return t == null ? [] : Object.entries(t).filter(([, e]) => Ug(e)).map(([e, t]) => ({
|
|
19010
19075
|
id: e,
|
|
19011
|
-
label: typeof t.title == "string" && t.title.length > 0 ? t.title :
|
|
19076
|
+
label: typeof t.title == "string" && t.title.length > 0 ? t.title : Wg(e),
|
|
19012
19077
|
defaultValue: t.default === !0
|
|
19013
19078
|
}));
|
|
19014
|
-
},
|
|
19015
|
-
let { selectedItemId: t, selectedDeploymentConfiguration: n, toolIcon: r } = e, i = F(() =>
|
|
19079
|
+
}, Kg = (e) => {
|
|
19080
|
+
let { selectedItemId: t, selectedDeploymentConfiguration: n, toolIcon: r } = e, i = F(() => Gg(n), [n]), a = F(() => Object.fromEntries(i.map(({ id: e, defaultValue: t }) => [e, t])), [i]), [o, s] = L(a), c = JSON.stringify(a), l = I(a);
|
|
19016
19081
|
l.current = a, P(() => {
|
|
19017
19082
|
s(l.current);
|
|
19018
19083
|
}, [t, c]);
|
|
@@ -19046,7 +19111,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
19046
19111
|
toolConfigurationValue: F(() => Object.fromEntries(i.map(({ id: e }) => [e, o[e] ?? !1])), [i, o]),
|
|
19047
19112
|
restoreToolConfiguration: d
|
|
19048
19113
|
};
|
|
19049
|
-
},
|
|
19114
|
+
}, qg = (e) => e instanceof Error ? e : Error(String(e)), Jg = (e, t = !0) => {
|
|
19050
19115
|
let [n, r] = L(), [i, a] = L(t), [o, s] = L();
|
|
19051
19116
|
return P(() => {
|
|
19052
19117
|
if (!t) {
|
|
@@ -19061,7 +19126,7 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
19061
19126
|
r(t);
|
|
19062
19127
|
} catch (e) {
|
|
19063
19128
|
if (n) return;
|
|
19064
|
-
s(
|
|
19129
|
+
s(qg(e));
|
|
19065
19130
|
} finally {
|
|
19066
19131
|
n || a(!1);
|
|
19067
19132
|
}
|
|
@@ -19075,4 +19140,4 @@ var uh = (e) => !ah.has(e), dh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
19075
19140
|
};
|
|
19076
19141
|
};
|
|
19077
19142
|
//#endregion
|
|
19078
|
-
export { Yt as AttachmentValidationErrorReason, Fn as AuthenticationType,
|
|
19143
|
+
export { Yt as AttachmentValidationErrorReason, Fn as AuthenticationType, wm as COLUMNS_WITHOUT_AUTHOR, Tm as COLUMNS_WITH_AUTHOR, Em as CORE_PERMISSION_MAP, Yc as CatalogPrimaryActionType, $t as ConversationExportMode, u as ConversationTransferErrorCode, h as ConversationTransferWarningCode, Cm as DATE_OPTIONS, mp as DEFAULT_MAX_ARCHIVE_BYTES, g as DialFileManagerActionProfile, _ as DialFileManagerVariant, _m as DialFilesApiUploadMode, ng as DownloadDestinationType, tn as EXPORT_APP_NAME, en as ExportFileNameKind, al as FavoriteEntityType, $ as FileManagerNotificationReason, vm as FileNameValidationErrorReason, ym as FileOperationKind, jc as McpResourceKind, bd as OAuthResourceKind, Sm as PATH_SEPARATOR_REGEXP, af as PROMPT_CONTENT_MAX_LENGTH, of as PROMPT_COUNTER_ANNOUNCE_THRESHOLD, rf as PROMPT_DESCRIPTION_MAX_LENGTH, nf as PROMPT_NAME_MAX_LENGTH, uc as PUBLIC_SKILL_BUCKET, ef as PromptFieldError, Jr as PromptSource, xm as RESERVED_MARKER_NAME, Bf as RecipientsCountStatus, Gs as SKILL_FILE_UPLOAD_MAX_BYTES, mc as SKILL_LISTING_MAX_PAGES, pc as SKILL_LISTING_PAGE_SIZE, Ws as SKILL_MANIFEST_FILE, fc as SKILL_MANIFEST_MAX_BYTES, qs as SKILL_UPLOAD_MAX_FILES, Ks as SKILL_UPLOAD_MAX_TOTAL_BYTES, Of as SkillEditorLoadState, Lf as SkillPreviewErrorKind, lc as SkillSource, Td as TOOLSET_REDIRECT_STATE_KEY, _d as ToolsetAuthStatus, gd as ToolsetAuthTypes, vd as ToolsetCredentialsLevel, qd as ToolsetLoginOutcomeType, wd as ToolsetOAuthCallbackQuery, Cd as ToolsetOAuthChannelControlType, Sd as ToolsetOAuthFailureReason, xd as ToolsetOAuthInitiationResultType, Q as ToolsetOAuthResultType, bm as UPLOAD_CONCURRENCY, pf as UnsupportedTriggerReason, yd as WithLogin, Xh as annotationToDisplayAttachment, Vh as annotationToPdfCanvasContent, mf as apSchedulerDayToJsDay, ar as appendLocaleCode, Yh as attachmentDtoToDisplayAttachment, Zh as attachmentDtosToDisplayAttachments, Ep as attachmentToDto, Dp as attachmentsToDtos, cr as buildAdditionalLocaleOptions, Lu as buildAnnouncementSignature, Ic as buildApplicationMcpUrl, An as buildChatCompletionsUrl, zc as buildConnectApi, Mn as buildDeploymentConnectApi, jg as buildExternalServiceScopeId, Xm as buildFromCache, Xd as buildPromptExportEnvelope, $d as buildPromptExportFileName, $r as buildPromptOverview, df as buildPromptPath, jn as buildResponsesUrl, zm as buildSharedItemVirtualPath, Oc as buildSkillContentTree, cc as buildSkillFilesPayload, ec as buildSkillManifest, sc as buildSkillManifestForSubmit, tc as buildSkillManifestFromFrontmatter, Tc as buildSkillOverview, hd as buildToolsetAuthorizeUrl, Fc as buildToolsetMcpUrl, kh as clearAttachmentCache, or as composeLocalePayload, Bu as createChatStreamApi, bt as createCsrfMiddleware, ed as createDeploymentChangedMessage, ih as createFilesApiClient, Op as createMessagePair, En as createPublishApiClient, wt as createUnauthorizedMiddleware, ah as createUploadFileWithProgress, tr as decodeToolsetId, sr as decomposeLocalizedFields, Dm as deriveActionProfile, qc as deriveAvailableTabIds, Uf as deriveConversationRowActionState, Kc as deriveFavoriteItems, Rm as dialCorePathToRelative, $h as dialFileToAttachment, eg as dialFilesToAttachments, tg as dialFolderPathToAttachment, Mt as downloadAttachment, Gd as emitToolsetLoginSuccess, Nn as encodeDeploymentId, er as encodeToolsetId, $m as fetchByTab, eh as fetchForSearch, Wc as filterCatalogItemsBySelector, Gc as filterHiddenOwnedItems, Pn as findDeploymentByIdOrReference, Pm as findDialFileByPath, Ym as findFirstSuccessfulCopyMoveItem, Mm as findFolderByVirtualPath, Wu as formatAppVersion, ur as formatCalendarDate, Qt as formatDateYM, Zt as formatDateYMD, jm as formatOperationFolderName, xn as formatQuotedNameList, yt as getApiErrorDetails, vt as getApiErrorMessage, _t as getApiErrorStatus, wg as getBrowserTimezone, Np as getConversationPath, qf as getConversationSource, Mg as getExternalServiceFallbackName, nd as getLastDeploymentId, id as getLastUserMessageToolConfiguration, Qu as getModelIdFromConversationId, oe as getParentFolderPath, ld as getQuickAppConversationStarters, uf as getRemainingCharacters, jp as getStarterConversationText, ud as getStarterPopulateText, Mp as getStarterSubmitText, dd as getStartersFromSchema, $u as getTimeOfDayGreeting, Dd as getToolsetOAuthChannelName, fd as getToolsetRedirectUri, Ch as getUrlFileName, Am as getVirtualPathName, kp as hasActiveToolConfig, Iu as hasAnnouncementContent, Ph as hasAttachmentTextSource, Nm as hasDialFileWritePermission, Om as hasForbiddenNameSymbols, Fu as hasStructuredAnnouncement, Tt as includesIgnoreCase, Id as initiateOAuthLogin, cm as isAwaitingGenerationResume, gt as isConversationNotFoundError, Fm as isCopyMoveDuplicateAllowed, Sg as isCustomAppSchema, Wt as isDialFileAcceptType, Ot as isDialFileId, jt as isDownloadableAttachment, Eh as isExternalSourcePreviewable, Ap as isMessageChanged, td as isMessageStreaming, ei as isOrganisationPromptItem, nr as isPublicToolsetId, Cg as isQuickAppSchema, Im as isShareActionsAllowed, Tg as isValidAbsoluteUrl, Og as isValidFeaturesData, Qs as isValidSkillRelativePath, hf as jsDayToApSchedulerDay, Jm as mapCorePermissions, Fr as mapDeploymentDetailsDtoToEntityDetails, Xn as mapDeploymentLimitsDtoToCatalogLimits, Zn as mapDeploymentLimitsToInput, Kr as mapDeploymentToCatalogItem, Rr as mapDeploymentToolsetCredentials, Dr as mapEntityDetailsToCatalogDetails, nh as mapFileMetadataToDialFile, bf as mapFormValuesToCreateBody, xf as mapFormValuesToUpdateBody, ti as mapPromptToCatalogItem, Uc as mapPublishConversationResultDto, Hc as mapPublishHistoryEntryDto, Tf as mapScheduledTaskDtoToFormValues, th as mapSearchItem, vc as mapSkillToCatalogItem, wr as mapToolsetCredentials, qr as mapToolsetToCatalogItem, Zm as mergeCreatedFolderIntoCache, rd as messageHasStages, qt as mimeTypesToAttachmentExtensionLabels, Gt as mimeTypesToDialFileAcceptTypes, Kt as mimeTypesToFileAccept, ac as nameFromPath, Fd as navigateToolsetOAuthPopup, ad as normalizeResponseFormat, $s as normalizeSkillName, km as normalizeVirtualPath, oh as openAnnotationAttachment, Pd as openToolsetOAuthPopup, lr as padTwoDigits, Ag as parseExternalServiceUrl, Eg as parseFeaturesData, Lm as parseNewFolderVirtualPath, Xr as parsePromptResourceUrl, rc as parseSkillManifest, nl as parseSkillManifestDocument, hc as parseSkillResourceUrl, Km as prepareCopyItems, rg as prepareDownloadDestination, qm as prepareMoveRenameItems, kc as readSkillFileBytes, Ac as readSkillManifest, Jc as reconcileFilterTopics, Hh as referenceAttachmentToPdfCanvasContent, Xc as resolveCatalogPrimaryAction, zh as resolveCodeCanvasContent, Wr as resolveDeploymentFolder, Gm as resolveDialFileApiPath, At as resolveDialFileBucketAndPath, Th as resolveExternalSourceContentType, Bh as resolveHtmlCanvasContent, Fh as resolveImageCanvasContent, qh as resolveJsonCanvasContent, ir as resolveLocalizedText, Lh as resolveMarkdownCanvasContent, Rc as resolveMcpResourceKind, Kh as resolveOoxmlCanvasContent, Bm as resolveOwnerCoords, Gh as resolvePdfCanvasContent, kt as resolveRelativeDialFilePath, wc as resolveSkillFileDownloadPath, Sc as resolveSkillManifestFileId, Ih as resolveTextCanvasContent, Jh as resolveVisualizerCanvasContent, H as safeDecodeURI, Et as safeDecodeURIComponent, Mu as sanitizeAnnouncementHtml, Nu as sanitizeAnnouncementMessageHtml, og as sanitizeFileName, Uu as sanitizeFooterHtml, Zd as serializePromptExport, Vu as shouldWatchForDisplayNameUpdate, oc as skillFileBytesToBlob, Df as skillFileToAttachment, ig as splitFileNameExtension, Dt as stripSurroundingSlashes, Kd as subscribeToolsetLoginSuccess, rr as toBaseLocale, od as toOverlayMessages, Vc as toPublishEntityType, Tn as toPublishRuleDto, ag as trimFileNameToByteLimit, ic as unpackSkillArchive, Qm as updateEntry, Wf as useActiveConversationSync, Gf as useAsyncConfirmDialog, Ft as useAttachmentAction, $f as useAttachmentUpload, Xt as useAttachmentValidation, il as useCatalogItemDetails, Fg as useChatSettingsFormConfig, Tp as useConversationExport, Pp as useConversationHandlers, Zp as useConversationImport, Kf as useConversationLookupMaps, Jf as useConversationPanelItems, em as useConversationScroll, gm as useConversationSources, mm as useConversationStream, sg as useDialFileListing, vg as useDialFileManager, bg as useDialFileManagerTabConfig, cg as useDialFileMetadata, lg as useDialFileMutations, ug as useDialFileSharing, _g as useDialFileUploadBatch, ol as useFavoriteEntitiesState, Yf as useImportFilePicker, Hd as useOAuthCallbackCompletion, Ig as usePageFileDrag, zg as usePanelMaxWidth, ff as usePromptsState, ul as usePublishFolders, Hg as useShareLink, Hf as useShareRecipientsCount, Nf as useSkillEditorLoad, Ff as useSkillEditorSubmit, If as useSkillFileActions, Rf as useSkillFilePreview, zf as useSkillsState, Kg as useToolsMenu, Jd as useToolsetLogin, Jg as useUsageData, Rg as useViewportWidth, lf as validatePromptContent, cf as validatePromptDescription, sf as validatePromptName, Ef as validateSkillFileBatch, Um as virtualPathToApiPath, Md as waitForToolsetOAuthResult };
|