@epam/ai-dial-chat-hooks 1.1.0-dev.373 → 1.1.0-dev.375
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
|
@@ -16238,13 +16238,7 @@ var Nu = (e) => Au.sanitize(e, ju), Pu = (e) => Au.sanitize(e, Mu), Fu = (e) =>
|
|
|
16238
16238
|
}, [v]),
|
|
16239
16239
|
armAnchor: m
|
|
16240
16240
|
};
|
|
16241
|
-
}, nm = (e) => {
|
|
16242
|
-
let t = e.custom_content;
|
|
16243
|
-
return !!e.content || e.responseId != null || !!t?.attachments?.length || !!t?.stages?.length || !!t?.annotations?.length || !!t?.form_schema || t?.state != null;
|
|
16244
|
-
}, rm = (e) => {
|
|
16245
|
-
let t = e.messages[e.messages.length - 1];
|
|
16246
|
-
return !!t && t.role === C.Assistant && !nm(t) && t.streamErrorMessage == null && !t.wasStoppedByUser;
|
|
16247
|
-
}, im = (e, t) => {
|
|
16241
|
+
}, nm = (e, t) => {
|
|
16248
16242
|
let n = [...e];
|
|
16249
16243
|
for (let e of t) {
|
|
16250
16244
|
let t = n.findIndex((t) => t.index === e.index);
|
|
@@ -16263,7 +16257,7 @@ var Nu = (e) => Au.sanitize(e, ju), Pu = (e) => Au.sanitize(e, Mu), Fu = (e) =>
|
|
|
16263
16257
|
} else n.push(e);
|
|
16264
16258
|
}
|
|
16265
16259
|
return n;
|
|
16266
|
-
},
|
|
16260
|
+
}, rm = (e, t) => {
|
|
16267
16261
|
let n = [...e];
|
|
16268
16262
|
for (let e of t) {
|
|
16269
16263
|
let t = e.index == null ? -1 : n.findIndex((t) => t.index === e.index);
|
|
@@ -16275,7 +16269,7 @@ var Nu = (e) => Au.sanitize(e, ju), Pu = (e) => Au.sanitize(e, Mu), Fu = (e) =>
|
|
|
16275
16269
|
} : n.push(e);
|
|
16276
16270
|
}
|
|
16277
16271
|
return n;
|
|
16278
|
-
},
|
|
16272
|
+
}, im = (e, t) => {
|
|
16279
16273
|
let n = [...e];
|
|
16280
16274
|
for (let e of t) {
|
|
16281
16275
|
let t = n.findIndex((t) => t.index === e.index);
|
|
@@ -16284,14 +16278,14 @@ var Nu = (e) => Au.sanitize(e, ju), Pu = (e) => Au.sanitize(e, Mu), Fu = (e) =>
|
|
|
16284
16278
|
...e,
|
|
16285
16279
|
name: (n[t].name ?? "") + (e.name ?? ""),
|
|
16286
16280
|
content: (n[t].content ?? "") + (e.content ?? "") || void 0,
|
|
16287
|
-
attachments: e.attachments?.length ?
|
|
16281
|
+
attachments: e.attachments?.length ? rm(n[t].attachments ?? [], e.attachments) : n[t].attachments
|
|
16288
16282
|
} : n.push({
|
|
16289
16283
|
...e,
|
|
16290
16284
|
name: e.name ?? ""
|
|
16291
16285
|
});
|
|
16292
16286
|
}
|
|
16293
16287
|
return n;
|
|
16294
|
-
},
|
|
16288
|
+
}, am = (e, t, n) => {
|
|
16295
16289
|
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);
|
|
16296
16290
|
return !d && !f ? null : e.map((e, n) => {
|
|
16297
16291
|
if (n !== t) return e;
|
|
@@ -16304,27 +16298,144 @@ var Nu = (e) => Au.sanitize(e, ju), Pu = (e) => Au.sanitize(e, Mu), Fu = (e) =>
|
|
|
16304
16298
|
...e.custom_content,
|
|
16305
16299
|
...a && { form_schema: a },
|
|
16306
16300
|
...o?.length && { attachments: r },
|
|
16307
|
-
...s?.length && { stages:
|
|
16308
|
-
...p.length && { annotations:
|
|
16301
|
+
...s?.length && { stages: im(e.custom_content?.stages ?? [], s) },
|
|
16302
|
+
...p.length && { annotations: nm(e.custom_content?.annotations ?? [], p) },
|
|
16309
16303
|
...u && { state: u }
|
|
16310
16304
|
} }
|
|
16311
16305
|
};
|
|
16312
16306
|
});
|
|
16313
|
-
},
|
|
16307
|
+
}, om = (e, t) => ({
|
|
16314
16308
|
...e,
|
|
16315
16309
|
...t,
|
|
16316
16310
|
...(e.custom_content || t.custom_content) && { custom_content: {
|
|
16317
16311
|
...e.custom_content,
|
|
16318
16312
|
...t.custom_content
|
|
16319
16313
|
} }
|
|
16320
|
-
}),
|
|
16314
|
+
}), sm = (e, t) => {
|
|
16321
16315
|
if (t.messageIndex > e.messages.length) return e;
|
|
16322
16316
|
let n = [...e.messages];
|
|
16323
|
-
return t.messageIndex === n.length ? n.push(t.message) : n[t.messageIndex] =
|
|
16317
|
+
return t.messageIndex === n.length ? n.push(t.message) : n[t.messageIndex] = om(n[t.messageIndex], t.message), {
|
|
16324
16318
|
...e,
|
|
16325
16319
|
messages: n
|
|
16326
16320
|
};
|
|
16327
|
-
},
|
|
16321
|
+
}, cm = (e) => {
|
|
16322
|
+
let t = e.custom_content;
|
|
16323
|
+
return !!e.content || e.responseId != null || !!t?.attachments?.length || !!t?.stages?.length || !!t?.annotations?.length || !!t?.form_schema || t?.state != null;
|
|
16324
|
+
}, lm = (e) => {
|
|
16325
|
+
let t = e.messages[e.messages.length - 1];
|
|
16326
|
+
return !!t && t.role === C.Assistant && !cm(t) && t.streamErrorMessage == null && !t.wasStoppedByUser;
|
|
16327
|
+
}, um = 300 * 1e3, dm = "awaiting-resume", fm = async (e, t) => {
|
|
16328
|
+
let n = e.getReader(), r = new TextDecoder(), i = "";
|
|
16329
|
+
try {
|
|
16330
|
+
for (;;) {
|
|
16331
|
+
let { done: e, value: a } = await n.read();
|
|
16332
|
+
if (e) break;
|
|
16333
|
+
i += r.decode(a, { stream: !0 });
|
|
16334
|
+
let o = i.split("\n");
|
|
16335
|
+
i = o.pop() ?? "";
|
|
16336
|
+
let s = !1;
|
|
16337
|
+
for (let e of o) {
|
|
16338
|
+
let n = e.trim();
|
|
16339
|
+
if (!n.startsWith("data:")) continue;
|
|
16340
|
+
let r = n.slice(5).trim(), i;
|
|
16341
|
+
try {
|
|
16342
|
+
i = JSON.parse(r);
|
|
16343
|
+
} catch {
|
|
16344
|
+
continue;
|
|
16345
|
+
}
|
|
16346
|
+
if (await t(i)) {
|
|
16347
|
+
s = !0;
|
|
16348
|
+
break;
|
|
16349
|
+
}
|
|
16350
|
+
}
|
|
16351
|
+
if (s) break;
|
|
16352
|
+
}
|
|
16353
|
+
} catch {} finally {
|
|
16354
|
+
n.releaseLock();
|
|
16355
|
+
}
|
|
16356
|
+
}, pm = ({ transport: e, setConversation: t, conversationRef: n, resumingPathsRef: r, bufferedGenerationsRef: i, addStreamingPath: a, removeStreamingPath: o, isPathDisplayed: s }) => (c, l) => {
|
|
16357
|
+
if (!lm(l)) return;
|
|
16358
|
+
let u = Pp(c);
|
|
16359
|
+
if (r.current.has(u)) return;
|
|
16360
|
+
r.current.add(u), a(u);
|
|
16361
|
+
let d = l.messages.length - 1, f = (e) => {
|
|
16362
|
+
r.current.delete(u), o(u), i.current.delete(u), e && s(u) && (t(e), n.current = e);
|
|
16363
|
+
}, p = async () => {
|
|
16364
|
+
try {
|
|
16365
|
+
f(await e.getConversation(H(c)));
|
|
16366
|
+
} catch {
|
|
16367
|
+
f();
|
|
16368
|
+
}
|
|
16369
|
+
}, m = (e) => {
|
|
16370
|
+
let r = {
|
|
16371
|
+
generationId: dm,
|
|
16372
|
+
messageIndex: d,
|
|
16373
|
+
message: e
|
|
16374
|
+
};
|
|
16375
|
+
i.current.set(u, r), s(u) && t((e) => {
|
|
16376
|
+
if (!e) return e;
|
|
16377
|
+
let t = sm(e, r);
|
|
16378
|
+
return n.current = t, t;
|
|
16379
|
+
});
|
|
16380
|
+
}, h = (e) => {
|
|
16381
|
+
let r = i.current.get(u);
|
|
16382
|
+
if (r?.generationId === dm) {
|
|
16383
|
+
let t = am([r.message], 0, e);
|
|
16384
|
+
t && (r.message = t[0]);
|
|
16385
|
+
}
|
|
16386
|
+
s(u) && t((e) => {
|
|
16387
|
+
if (!e) return e;
|
|
16388
|
+
let t = i.current.get(u);
|
|
16389
|
+
if (t?.generationId !== dm) return e;
|
|
16390
|
+
let r = sm(e, t);
|
|
16391
|
+
return n.current = r, r;
|
|
16392
|
+
});
|
|
16393
|
+
}, g = async () => {
|
|
16394
|
+
let t = new AbortController(), n;
|
|
16395
|
+
try {
|
|
16396
|
+
n = await e.watchConversation(u, t.signal);
|
|
16397
|
+
} catch {
|
|
16398
|
+
await p();
|
|
16399
|
+
return;
|
|
16400
|
+
}
|
|
16401
|
+
let r = !1, i = window.setTimeout(() => {
|
|
16402
|
+
t.abort();
|
|
16403
|
+
}, um);
|
|
16404
|
+
try {
|
|
16405
|
+
await fm(n, async (t) => {
|
|
16406
|
+
if (t?.action !== "UPDATE") return !1;
|
|
16407
|
+
try {
|
|
16408
|
+
let t = await e.getConversation(H(c));
|
|
16409
|
+
if (!lm(t)) return f(t), r = !0, !0;
|
|
16410
|
+
} catch {}
|
|
16411
|
+
return !1;
|
|
16412
|
+
});
|
|
16413
|
+
} finally {
|
|
16414
|
+
clearTimeout(i);
|
|
16415
|
+
}
|
|
16416
|
+
r || await p();
|
|
16417
|
+
}, _ = async () => {
|
|
16418
|
+
let t = new AbortController(), n;
|
|
16419
|
+
try {
|
|
16420
|
+
n = await e.attachToGeneration(u, t.signal);
|
|
16421
|
+
} catch {
|
|
16422
|
+
return !1;
|
|
16423
|
+
}
|
|
16424
|
+
let r = !1;
|
|
16425
|
+
return await fm(n, (e) => {
|
|
16426
|
+
switch (e.type) {
|
|
16427
|
+
case "snapshot": return m(e.message), !1;
|
|
16428
|
+
case "chunk": return h(e.chunk), !1;
|
|
16429
|
+
case "done":
|
|
16430
|
+
case "error":
|
|
16431
|
+
case "stopped": return r = !0, !0;
|
|
16432
|
+
}
|
|
16433
|
+
}), r ? (await p(), !0) : !1;
|
|
16434
|
+
};
|
|
16435
|
+
(async () => {
|
|
16436
|
+
await _() || await g();
|
|
16437
|
+
})();
|
|
16438
|
+
}, mm = 2e4, hm = ({ conversationId: e, state: { setConversation: t, conversationRef: n }, transport: r, generation: { startGeneration: i, completeGeneration: a }, channel: o, overlay: s, onStopError: c }) => {
|
|
16328
16439
|
let [l, u] = R(() => /* @__PURE__ */ new Set()), [d, f] = R(null), p = L(null), m = L(null), h = L(/* @__PURE__ */ new Set()), g = L(/* @__PURE__ */ new Map()), _ = L(/* @__PURE__ */ new Set()), v = L(e);
|
|
16329
16440
|
F(() => {
|
|
16330
16441
|
v.current = e;
|
|
@@ -16358,15 +16469,15 @@ var Nu = (e) => Au.sanitize(e, ju), Pu = (e) => Au.sanitize(e, Mu), Fu = (e) =>
|
|
|
16358
16469
|
if (p.current !== S) return;
|
|
16359
16470
|
let r = g.current.get(C);
|
|
16360
16471
|
if (r?.generationId === S) {
|
|
16361
|
-
let t =
|
|
16472
|
+
let t = am([r.message], 0, e);
|
|
16362
16473
|
t && (r.message = t[0]);
|
|
16363
16474
|
}
|
|
16364
16475
|
y(C) && t((t) => {
|
|
16365
16476
|
if (!t) return t;
|
|
16366
16477
|
let r = g.current.get(C), i;
|
|
16367
|
-
if (r?.generationId === S) i =
|
|
16478
|
+
if (r?.generationId === S) i = sm(t, r);
|
|
16368
16479
|
else {
|
|
16369
|
-
let n =
|
|
16480
|
+
let n = am(t.messages, l, e);
|
|
16370
16481
|
if (!n) return t;
|
|
16371
16482
|
i = {
|
|
16372
16483
|
...t,
|
|
@@ -16387,7 +16498,7 @@ var Nu = (e) => Au.sanitize(e, ju), Pu = (e) => Au.sanitize(e, Mu), Fu = (e) =>
|
|
|
16387
16498
|
let r = g.current.get(C), i = r?.generationId === S ? r : void 0;
|
|
16388
16499
|
i && g.current.delete(C), x(C), p.current === S && (p.current = null, m.current = null, f(null)), y(C) && t((t) => {
|
|
16389
16500
|
if (!t) return t;
|
|
16390
|
-
let r = i?.generationId === S ?
|
|
16501
|
+
let r = i?.generationId === S ? sm(t, i) : t, a = {
|
|
16391
16502
|
...r,
|
|
16392
16503
|
messages: r.messages.map((t, n) => n === l ? {
|
|
16393
16504
|
...t,
|
|
@@ -16400,7 +16511,7 @@ var Nu = (e) => Au.sanitize(e, ju), Pu = (e) => Au.sanitize(e, Mu), Fu = (e) =>
|
|
|
16400
16511
|
};
|
|
16401
16512
|
(async () => {
|
|
16402
16513
|
try {
|
|
16403
|
-
let e = o?.channelId ?? await o?.waitForChannel(
|
|
16514
|
+
let e = o?.channelId ?? await o?.waitForChannel(mm) ?? void 0;
|
|
16404
16515
|
r.streamCompletion(C, c, u, D, d, S, v, w, e);
|
|
16405
16516
|
} catch (e) {
|
|
16406
16517
|
D.onError(e instanceof Error ? e : Error(String(e)));
|
|
@@ -16419,7 +16530,7 @@ var Nu = (e) => Au.sanitize(e, ju), Pu = (e) => Au.sanitize(e, Mu), Fu = (e) =>
|
|
|
16419
16530
|
r
|
|
16420
16531
|
]), C = P((e, t) => {
|
|
16421
16532
|
let n = Pp(e), r = g.current.get(n);
|
|
16422
|
-
return r ?
|
|
16533
|
+
return r ? sm(t, r) : t;
|
|
16423
16534
|
}, []), w = P(() => {
|
|
16424
16535
|
let t = p.current;
|
|
16425
16536
|
if (!t || !e) return;
|
|
@@ -16436,62 +16547,16 @@ var Nu = (e) => Au.sanitize(e, ju), Pu = (e) => Au.sanitize(e, Mu), Fu = (e) =>
|
|
|
16436
16547
|
c,
|
|
16437
16548
|
s,
|
|
16438
16549
|
r
|
|
16439
|
-
]), T =
|
|
16440
|
-
|
|
16441
|
-
|
|
16442
|
-
|
|
16443
|
-
h
|
|
16444
|
-
|
|
16445
|
-
|
|
16446
|
-
|
|
16447
|
-
|
|
16448
|
-
|
|
16449
|
-
} catch {
|
|
16450
|
-
s();
|
|
16451
|
-
}
|
|
16452
|
-
};
|
|
16453
|
-
(async () => {
|
|
16454
|
-
let t;
|
|
16455
|
-
try {
|
|
16456
|
-
t = await r.watchConversation(a, o.signal);
|
|
16457
|
-
} catch {
|
|
16458
|
-
await c();
|
|
16459
|
-
return;
|
|
16460
|
-
}
|
|
16461
|
-
let n = t.getReader(), i = new TextDecoder(), l = "", u = window.setTimeout(() => {
|
|
16462
|
-
o.abort();
|
|
16463
|
-
}, cm);
|
|
16464
|
-
try {
|
|
16465
|
-
for (;;) {
|
|
16466
|
-
let { done: t, value: a } = await n.read();
|
|
16467
|
-
if (t) break;
|
|
16468
|
-
l += i.decode(a, { stream: !0 });
|
|
16469
|
-
let o = l.split("\n");
|
|
16470
|
-
l = o.pop() ?? "";
|
|
16471
|
-
for (let t of o) {
|
|
16472
|
-
let n = t.trim();
|
|
16473
|
-
if (!n.startsWith("data:")) continue;
|
|
16474
|
-
let i = n.slice(5).trim(), a = null;
|
|
16475
|
-
try {
|
|
16476
|
-
a = JSON.parse(i);
|
|
16477
|
-
} catch {
|
|
16478
|
-
continue;
|
|
16479
|
-
}
|
|
16480
|
-
if (a?.action === "UPDATE") try {
|
|
16481
|
-
let t = await r.getConversation(H(e));
|
|
16482
|
-
if (!rm(t)) {
|
|
16483
|
-
s(t);
|
|
16484
|
-
return;
|
|
16485
|
-
}
|
|
16486
|
-
} catch {}
|
|
16487
|
-
}
|
|
16488
|
-
}
|
|
16489
|
-
} catch {} finally {
|
|
16490
|
-
clearTimeout(u), n.releaseLock();
|
|
16491
|
-
}
|
|
16492
|
-
await c();
|
|
16493
|
-
})();
|
|
16494
|
-
}, [
|
|
16550
|
+
]), T = I(() => pm({
|
|
16551
|
+
transport: r,
|
|
16552
|
+
setConversation: t,
|
|
16553
|
+
conversationRef: n,
|
|
16554
|
+
resumingPathsRef: h,
|
|
16555
|
+
bufferedGenerationsRef: g,
|
|
16556
|
+
addStreamingPath: b,
|
|
16557
|
+
removeStreamingPath: x,
|
|
16558
|
+
isPathDisplayed: y
|
|
16559
|
+
}), [
|
|
16495
16560
|
b,
|
|
16496
16561
|
x,
|
|
16497
16562
|
y,
|
|
@@ -16505,7 +16570,7 @@ var Nu = (e) => Au.sanitize(e, ju), Pu = (e) => Au.sanitize(e, Mu), Fu = (e) =>
|
|
|
16505
16570
|
isStreaming: E,
|
|
16506
16571
|
canStopStreaming: D != null && d === D
|
|
16507
16572
|
};
|
|
16508
|
-
},
|
|
16573
|
+
}, gm = {}, _m = (e, t = gm) => I(() => {
|
|
16509
16574
|
let n = [], r = [], i = [], a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
|
|
16510
16575
|
for (let c of e) {
|
|
16511
16576
|
let e = c.custom_content?.attachments;
|
|
@@ -16545,70 +16610,70 @@ var Nu = (e) => Au.sanitize(e, ju), Pu = (e) => Au.sanitize(e, Mu), Fu = (e) =>
|
|
|
16545
16610
|
generated: r,
|
|
16546
16611
|
sources: i
|
|
16547
16612
|
};
|
|
16548
|
-
}, [e, t]),
|
|
16613
|
+
}, [e, t]), vm = /* @__PURE__ */ function(e) {
|
|
16549
16614
|
return e.Overwrite = "overwrite", e.CreateOnly = "create-only", e;
|
|
16550
16615
|
}({}), $ = /* @__PURE__ */ function(e) {
|
|
16551
16616
|
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;
|
|
16552
|
-
}({}),
|
|
16617
|
+
}({}), ym = /* @__PURE__ */ function(e) {
|
|
16553
16618
|
return e.Empty = "empty", e.ForbiddenSymbols = "forbiddenSymbols", e.ReservedName = "reservedName", e.TooLong = "tooLong", e.DuplicateName = "duplicateName", e.LeadingDot = "leadingDot", e;
|
|
16554
|
-
}({}),
|
|
16619
|
+
}({}), bm = /* @__PURE__ */ function(e) {
|
|
16555
16620
|
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;
|
|
16556
|
-
}({}),
|
|
16621
|
+
}({}), xm = 3, Sm = x, Cm = /[/\\]/, wm = {
|
|
16557
16622
|
year: "numeric",
|
|
16558
16623
|
month: "short",
|
|
16559
16624
|
day: "2-digit"
|
|
16560
|
-
},
|
|
16625
|
+
}, Tm = [
|
|
16561
16626
|
$e.Name,
|
|
16562
16627
|
$e.UpdatedAt,
|
|
16563
16628
|
$e.Size,
|
|
16564
16629
|
$e.Actions
|
|
16565
|
-
],
|
|
16630
|
+
], Em = [
|
|
16566
16631
|
$e.Name,
|
|
16567
16632
|
$e.UpdatedAt,
|
|
16568
16633
|
$e.Size,
|
|
16569
16634
|
$e.Author,
|
|
16570
16635
|
$e.Actions
|
|
16571
|
-
],
|
|
16636
|
+
], Dm = {
|
|
16572
16637
|
READ: Qe.READ,
|
|
16573
16638
|
WRITE: Qe.WRITE,
|
|
16574
16639
|
SHARE: Qe.SHARE
|
|
16575
|
-
},
|
|
16640
|
+
}, Om = (e) => {
|
|
16576
16641
|
switch (e) {
|
|
16577
16642
|
case _.Attach: return g.Attach;
|
|
16578
16643
|
case _.Standalone: return g.Browse;
|
|
16579
16644
|
case _.FolderPicker: return g.Full;
|
|
16580
16645
|
}
|
|
16581
|
-
},
|
|
16582
|
-
if (
|
|
16646
|
+
}, km = (e, t) => {
|
|
16647
|
+
if (Cm.test(e)) return !0;
|
|
16583
16648
|
if (t == null) return !1;
|
|
16584
16649
|
t.lastIndex = 0;
|
|
16585
16650
|
let n = t.test(e);
|
|
16586
16651
|
return t.lastIndex = 0, n;
|
|
16587
|
-
},
|
|
16652
|
+
}, Am = (e) => e.replace(/\/+$/, "") || "/", jm = (e, t) => {
|
|
16588
16653
|
let n = e.split("/").filter(Boolean);
|
|
16589
16654
|
return H(n[n.length - 1] ?? t);
|
|
16590
|
-
},
|
|
16591
|
-
let n =
|
|
16655
|
+
}, Mm = (e, t) => Am(e || `/${t}`).replace(/^\/+/, "") || t, Nm = (e, t) => {
|
|
16656
|
+
let n = Am(t);
|
|
16592
16657
|
for (let r of e) {
|
|
16593
16658
|
if (r.nodeType !== Ze.FOLDER) continue;
|
|
16594
|
-
if (
|
|
16595
|
-
let e =
|
|
16659
|
+
if (Am(r.path) === n) return r;
|
|
16660
|
+
let e = Nm(r.items ?? [], t);
|
|
16596
16661
|
if (e) return e;
|
|
16597
16662
|
}
|
|
16598
|
-
},
|
|
16663
|
+
}, Pm = (e) => e?.permissions?.includes(Qe.WRITE) ?? !1, Fm = (e, t) => {
|
|
16599
16664
|
for (let n of e) {
|
|
16600
16665
|
if (n.path === t || n.id === t) return n;
|
|
16601
|
-
let e =
|
|
16666
|
+
let e = Fm(n.items ?? [], t);
|
|
16602
16667
|
if (e) return e;
|
|
16603
16668
|
}
|
|
16604
|
-
},
|
|
16669
|
+
}, Im = (e) => {
|
|
16605
16670
|
switch (e) {
|
|
16606
16671
|
case g.Attach: return !1;
|
|
16607
16672
|
case g.Browse:
|
|
16608
16673
|
case g.Full: return !0;
|
|
16609
16674
|
default: throw Error(`Unhandled actionProfile: ${String(e)}`);
|
|
16610
16675
|
}
|
|
16611
|
-
},
|
|
16676
|
+
}, Lm = (e) => e === g.Full, Rm = (e, t) => {
|
|
16612
16677
|
let n = e.replace(/\/$/, ""), r = n.lastIndexOf("/");
|
|
16613
16678
|
if (r <= 0) {
|
|
16614
16679
|
let e = r === 0 ? n.slice(1) : n;
|
|
@@ -16621,13 +16686,13 @@ var Nu = (e) => Au.sanitize(e, ju), Pu = (e) => Au.sanitize(e, Mu), Fu = (e) =>
|
|
|
16621
16686
|
parentVirtualPath: n.slice(0, r),
|
|
16622
16687
|
name: n.slice(r + 1)
|
|
16623
16688
|
};
|
|
16624
|
-
},
|
|
16689
|
+
}, zm = (e, t) => {
|
|
16625
16690
|
let n = `files/${t}/`;
|
|
16626
16691
|
return e.startsWith(n) ? e.slice(n.length) : e;
|
|
16627
|
-
},
|
|
16692
|
+
}, Bm = (e, t, n) => {
|
|
16628
16693
|
let r = e.replace(/\/+$/, "").split("/").filter(Boolean).map(H).join("/"), i = r ? `/${t}/${r}` : `/${t}`;
|
|
16629
16694
|
return n ? `${i}/` : i;
|
|
16630
|
-
},
|
|
16695
|
+
}, Vm = (e, t, n) => {
|
|
16631
16696
|
if (!e) return {
|
|
16632
16697
|
bucket: n,
|
|
16633
16698
|
path: e
|
|
@@ -16637,15 +16702,15 @@ var Nu = (e) => Au.sanitize(e, ju), Pu = (e) => Au.sanitize(e, Mu), Fu = (e) =>
|
|
|
16637
16702
|
bucket: n,
|
|
16638
16703
|
path: e
|
|
16639
16704
|
};
|
|
16640
|
-
let o =
|
|
16705
|
+
let o = zm(a.dialCorePath, a.bucket), s = r === -1 ? "" : e.slice(r + 1);
|
|
16641
16706
|
return {
|
|
16642
16707
|
bucket: a.bucket,
|
|
16643
16708
|
path: o + s
|
|
16644
16709
|
};
|
|
16645
|
-
},
|
|
16710
|
+
}, Hm = (e) => e.startsWith("files/"), Um = (e, t) => {
|
|
16646
16711
|
let n = `files/${t}/`;
|
|
16647
16712
|
if (e.startsWith(n)) return H(e.slice(n.length));
|
|
16648
|
-
if (
|
|
16713
|
+
if (Hm(e)) {
|
|
16649
16714
|
let n = e.slice(6), r = n.indexOf("/");
|
|
16650
16715
|
if (r >= 0) {
|
|
16651
16716
|
let e = n.slice(0, r), i = n.slice(r + 1);
|
|
@@ -16653,7 +16718,7 @@ var Nu = (e) => Au.sanitize(e, ju), Pu = (e) => Au.sanitize(e, Mu), Fu = (e) =>
|
|
|
16653
16718
|
}
|
|
16654
16719
|
}
|
|
16655
16720
|
return e;
|
|
16656
|
-
},
|
|
16721
|
+
}, Wm = (e, t) => {
|
|
16657
16722
|
let n = `/${t}`, r = `/${t}/`, i = `${t}/`;
|
|
16658
16723
|
if (e === n || e === `${t}` || e === r || e === i) return "";
|
|
16659
16724
|
let a;
|
|
@@ -16665,13 +16730,13 @@ var Nu = (e) => Au.sanitize(e, ju), Pu = (e) => Au.sanitize(e, Mu), Fu = (e) =>
|
|
|
16665
16730
|
}
|
|
16666
16731
|
let o = a.replace(/\/{2,}/g, "/");
|
|
16667
16732
|
return o && !o.endsWith("/") ? `${o}/` : o;
|
|
16668
|
-
},
|
|
16669
|
-
let r = e.nodeType === Ze.FOLDER, i = e.id ?
|
|
16733
|
+
}, Gm = (e, t) => e.startsWith("/") || e === t || e.startsWith(`${t}/`), Km = (e, t, n) => {
|
|
16734
|
+
let r = e.nodeType === Ze.FOLDER, i = e.id ? Um(e.id, t) : null, a = i != null && !Gm(i, n) ? i : Wm(e.path, n);
|
|
16670
16735
|
return r ? a.endsWith("/") ? a : `${a}/` : a.replace(/\/$/, "");
|
|
16671
|
-
},
|
|
16672
|
-
let r = e.nodeType === Ze.FOLDER, i =
|
|
16736
|
+
}, qm = (e, t, n) => e.map((e) => {
|
|
16737
|
+
let r = e.nodeType === Ze.FOLDER, i = Wm(e.sourceUrl, n), a = Wm(e.destinationUrl, n), o = jm(e.sourceUrl, i);
|
|
16673
16738
|
return {
|
|
16674
|
-
destinationName:
|
|
16739
|
+
destinationName: jm(e.destinationUrl, a),
|
|
16675
16740
|
dto: {
|
|
16676
16741
|
bucket: t,
|
|
16677
16742
|
sourcePath: r ? i.endsWith("/") ? i : `${i}/` : i.replace(/\/$/, ""),
|
|
@@ -16681,9 +16746,9 @@ var Nu = (e) => Au.sanitize(e, ju), Pu = (e) => Au.sanitize(e, Mu), Fu = (e) =>
|
|
|
16681
16746
|
name: o
|
|
16682
16747
|
}
|
|
16683
16748
|
};
|
|
16684
|
-
}),
|
|
16749
|
+
}), Jm = (e, t, n) => {
|
|
16685
16750
|
let r = e.map((e) => {
|
|
16686
|
-
let t = e.nodeType === Ze.FOLDER, r =
|
|
16751
|
+
let t = e.nodeType === Ze.FOLDER, r = Wm(e.sourceUrl, n), i = Wm(e.destinationUrl, n), a = jm(e.sourceUrl, r), o = jm(e.destinationUrl, i), s = t ? r.endsWith("/") ? r : `${r}/` : r.replace(/\/$/, ""), c = t ? i.endsWith("/") ? i : `${i}/` : i.replace(/\/$/, "");
|
|
16687
16752
|
return {
|
|
16688
16753
|
isFolder: t,
|
|
16689
16754
|
name: a,
|
|
@@ -16715,14 +16780,14 @@ var Nu = (e) => Au.sanitize(e, ju), Pu = (e) => Au.sanitize(e, Mu), Fu = (e) =>
|
|
|
16715
16780
|
}
|
|
16716
16781
|
}))
|
|
16717
16782
|
};
|
|
16718
|
-
},
|
|
16783
|
+
}, Ym = (e) => {
|
|
16719
16784
|
if (!e?.length) return;
|
|
16720
|
-
let t = e.map((e) =>
|
|
16785
|
+
let t = e.map((e) => Dm[e.toUpperCase()]).filter((e) => e != null);
|
|
16721
16786
|
return t.length > 0 ? t : void 0;
|
|
16722
|
-
},
|
|
16787
|
+
}, Xm = (e, t) => {
|
|
16723
16788
|
let n = t.find((e) => e.success);
|
|
16724
16789
|
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];
|
|
16725
|
-
},
|
|
16790
|
+
}, Zm = (e, t, n, r, i) => {
|
|
16726
16791
|
let a = e.get(n);
|
|
16727
16792
|
if (a == null) return [];
|
|
16728
16793
|
let o = r.replace(/\/$/, "");
|
|
@@ -16744,11 +16809,11 @@ var Nu = (e) => Au.sanitize(e, ju), Pu = (e) => Au.sanitize(e, Mu), Fu = (e) =>
|
|
|
16744
16809
|
};
|
|
16745
16810
|
if (s) {
|
|
16746
16811
|
let r = `${n}${c}/`;
|
|
16747
|
-
u.permissions =
|
|
16812
|
+
u.permissions = Ym(a.permissions) ?? Ym(t.get(r)), u.items = Zm(e, t, r, l, a.path);
|
|
16748
16813
|
}
|
|
16749
16814
|
return u;
|
|
16750
16815
|
});
|
|
16751
|
-
},
|
|
16816
|
+
}, Qm = (e, t, n, r) => {
|
|
16752
16817
|
let i = new Map(e), a = [...i.get(t) ?? []], o = {
|
|
16753
16818
|
name: n.name,
|
|
16754
16819
|
path: n.path,
|
|
@@ -16760,7 +16825,7 @@ var Nu = (e) => Au.sanitize(e, ju), Pu = (e) => Au.sanitize(e, Mu), Fu = (e) =>
|
|
|
16760
16825
|
permissions: r
|
|
16761
16826
|
};
|
|
16762
16827
|
return a.some((e) => e.name.toLowerCase() === n.name.toLowerCase()) || a.push(o), i.set(t, a), i;
|
|
16763
|
-
},
|
|
16828
|
+
}, $m = (e, t, n) => {
|
|
16764
16829
|
if (!e) return e;
|
|
16765
16830
|
let r = typeof n == "string" ? { status: n } : n, i = e.files.map((e, n) => n === t ? {
|
|
16766
16831
|
...e,
|
|
@@ -16770,12 +16835,12 @@ var Nu = (e) => Au.sanitize(e, ju), Pu = (e) => Au.sanitize(e, Mu), Fu = (e) =>
|
|
|
16770
16835
|
...e,
|
|
16771
16836
|
files: i
|
|
16772
16837
|
};
|
|
16773
|
-
},
|
|
16838
|
+
}, eh = (e, t, n, r, i) => {
|
|
16774
16839
|
if (t === B.Shared) {
|
|
16775
16840
|
if (r === "") return e.listSharedFiles({ path: void 0 }).then((e) => ({ items: e.items }));
|
|
16776
16841
|
let t = r.indexOf("/"), n = t === -1 ? r : r.slice(0, t), a = i.get(n);
|
|
16777
16842
|
if (a) {
|
|
16778
|
-
let n =
|
|
16843
|
+
let n = zm(a.dialCorePath, a.bucket) + (t === -1 ? "" : r.slice(t + 1));
|
|
16779
16844
|
return e.listFiles({
|
|
16780
16845
|
bucket: a.bucket,
|
|
16781
16846
|
path: n,
|
|
@@ -16795,11 +16860,11 @@ var Nu = (e) => Au.sanitize(e, ju), Pu = (e) => Au.sanitize(e, Mu), Fu = (e) =>
|
|
|
16795
16860
|
items: e.items,
|
|
16796
16861
|
permissions: e.permissions
|
|
16797
16862
|
}));
|
|
16798
|
-
},
|
|
16863
|
+
}, th = async (e, t, n, r, i) => {
|
|
16799
16864
|
if (t === B.Shared) {
|
|
16800
16865
|
let t = r.indexOf("/"), n = t === -1 ? r : r.slice(0, t), a = i.get(n);
|
|
16801
16866
|
if (!a) return { items: [] };
|
|
16802
|
-
let o =
|
|
16867
|
+
let o = zm(a.dialCorePath, a.bucket) + (t === -1 ? "" : r.slice(t + 1)), { items: s } = await e.listFiles({
|
|
16803
16868
|
bucket: a.bucket,
|
|
16804
16869
|
path: o,
|
|
16805
16870
|
permissions: !0,
|
|
@@ -16821,8 +16886,8 @@ var Nu = (e) => Au.sanitize(e, ju), Pu = (e) => Au.sanitize(e, Mu), Fu = (e) =>
|
|
|
16821
16886
|
recursive: !0
|
|
16822
16887
|
});
|
|
16823
16888
|
return { items: a };
|
|
16824
|
-
},
|
|
16825
|
-
let r = e.nodeType === ke.Folder, i = H(e.name), a = e.bucket ?? t, o =
|
|
16889
|
+
}, nh = (e, t, n) => {
|
|
16890
|
+
let r = e.nodeType === ke.Folder, i = H(e.name), a = e.bucket ?? t, o = zm(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}`;
|
|
16826
16891
|
return {
|
|
16827
16892
|
id: e.path,
|
|
16828
16893
|
name: i,
|
|
@@ -16837,22 +16902,22 @@ var Nu = (e) => Au.sanitize(e, ju), Pu = (e) => Au.sanitize(e, Mu), Fu = (e) =>
|
|
|
16837
16902
|
contentType: e.contentType,
|
|
16838
16903
|
updatedAt: e.updatedAt ? new Date(e.updatedAt).toISOString() : void 0
|
|
16839
16904
|
};
|
|
16840
|
-
},
|
|
16905
|
+
}, rh = (e, t) => ({
|
|
16841
16906
|
...t,
|
|
16842
16907
|
bucket: e.bucket ?? t.bucket,
|
|
16843
16908
|
author: e.author,
|
|
16844
16909
|
contentLength: e.contentLength,
|
|
16845
16910
|
contentType: e.contentType,
|
|
16846
16911
|
resourceType: e.resourceType ?? t.resourceType,
|
|
16847
|
-
permissions:
|
|
16912
|
+
permissions: Ym(e.permissions) ?? t.permissions,
|
|
16848
16913
|
updatedAt: e.updatedAt ? new Date(e.updatedAt).toISOString() : t.updatedAt,
|
|
16849
16914
|
createdAt: e.createdAt ? new Date(e.createdAt).toISOString() : t.createdAt
|
|
16850
|
-
}),
|
|
16915
|
+
}), ih = (e) => e instanceof AbortSignal ? { signal: e } : e ?? {}, ah = (e, t) => ({
|
|
16851
16916
|
listPublicFiles: (t) => e.listPublicFiles(t),
|
|
16852
16917
|
listSharedFiles: (t) => e.listSharedFiles(t),
|
|
16853
16918
|
listFiles: (t, n) => e.listFiles(t, n ? { signal: n } : void 0),
|
|
16854
16919
|
uploadFile: (n, r, i, a) => {
|
|
16855
|
-
let { signal: o, onProgress: s, uploadMode: c } =
|
|
16920
|
+
let { signal: o, onProgress: s, uploadMode: c } = ih(a);
|
|
16856
16921
|
return s == null ? e.uploadFile({
|
|
16857
16922
|
bucket: n,
|
|
16858
16923
|
path: r,
|
|
@@ -16883,7 +16948,7 @@ var Nu = (e) => Au.sanitize(e, ju), Pu = (e) => Au.sanitize(e, Mu), Fu = (e) =>
|
|
|
16883
16948
|
revokeAccess: (t) => e.revokeAccess({ revokeAccessDto: { items: t } }),
|
|
16884
16949
|
discardShared: (t) => e.discardShared({ discardSharedDto: { items: t } }),
|
|
16885
16950
|
listSharedByMe: (t) => e.listSharedByMe({ bucket: t })
|
|
16886
|
-
}),
|
|
16951
|
+
}), oh = (e) => {
|
|
16887
16952
|
let { uploadUrl: t, xhrFactory: n = () => new XMLHttpRequest() } = e;
|
|
16888
16953
|
return (r, i, a, { signal: o, onProgress: s, uploadMode: c } = {}) => new Promise((l, u) => {
|
|
16889
16954
|
let d = n();
|
|
@@ -16921,7 +16986,7 @@ var Nu = (e) => Au.sanitize(e, ju), Pu = (e) => Au.sanitize(e, Mu), Fu = (e) =>
|
|
|
16921
16986
|
}
|
|
16922
16987
|
d.send(p);
|
|
16923
16988
|
});
|
|
16924
|
-
},
|
|
16989
|
+
}, sh = (e, t) => {
|
|
16925
16990
|
let { url: n } = e;
|
|
16926
16991
|
if (n == null) return;
|
|
16927
16992
|
let r = n.split("#")[0];
|
|
@@ -16930,12 +16995,12 @@ var Nu = (e) => Au.sanitize(e, ju), Pu = (e) => Au.sanitize(e, Mu), Fu = (e) =>
|
|
|
16930
16995
|
if (n == null) return;
|
|
16931
16996
|
ue(n, e.title ?? r.split("/").pop() ?? "");
|
|
16932
16997
|
} else window.open(n, "_blank", "noopener,noreferrer");
|
|
16933
|
-
},
|
|
16934
|
-
typeof
|
|
16935
|
-
},
|
|
16998
|
+
}, ch = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date, lh = /* @__PURE__ */ new Set(), uh = typeof process == "object" && process ? process : {}, dh = (e, t, n, r) => {
|
|
16999
|
+
typeof uh.emitWarning == "function" ? uh.emitWarning(e, t, n, r) : console.error(`[${n}] ${t}: ${e}`);
|
|
17000
|
+
}, fh = globalThis.AbortController, ph = globalThis.AbortSignal;
|
|
16936
17001
|
/* c8 ignore start */
|
|
16937
|
-
if (
|
|
16938
|
-
|
|
17002
|
+
if (fh === void 0) {
|
|
17003
|
+
ph = class {
|
|
16939
17004
|
onabort;
|
|
16940
17005
|
_onabort = [];
|
|
16941
17006
|
reason;
|
|
@@ -16943,11 +17008,11 @@ if (lh === void 0) {
|
|
|
16943
17008
|
addEventListener(e, t) {
|
|
16944
17009
|
this._onabort.push(t);
|
|
16945
17010
|
}
|
|
16946
|
-
},
|
|
17011
|
+
}, fh = class {
|
|
16947
17012
|
constructor() {
|
|
16948
17013
|
t();
|
|
16949
17014
|
}
|
|
16950
|
-
signal = new
|
|
17015
|
+
signal = new ph();
|
|
16951
17016
|
abort(e) {
|
|
16952
17017
|
if (!this.signal.aborted) {
|
|
16953
17018
|
this.signal.reason = e, this.signal.aborted = !0;
|
|
@@ -16956,21 +17021,21 @@ if (lh === void 0) {
|
|
|
16956
17021
|
}
|
|
16957
17022
|
}
|
|
16958
17023
|
};
|
|
16959
|
-
let e =
|
|
16960
|
-
e && (e = !1,
|
|
17024
|
+
let e = uh.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1", t = () => {
|
|
17025
|
+
e && (e = !1, dh("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));
|
|
16961
17026
|
};
|
|
16962
17027
|
}
|
|
16963
17028
|
/* c8 ignore stop */
|
|
16964
|
-
var
|
|
17029
|
+
var mh = (e) => !lh.has(e), hh = (e) => e && e === Math.floor(e) && e > 0 && isFinite(e), gh = (e) => hh(e) ? e <= 2 ** 8 ? Uint8Array : e <= 2 ** 16 ? Uint16Array : e <= 2 ** 32 ? Uint32Array : e <= 2 ** 53 - 1 ? _h : null : null, _h = class extends Array {
|
|
16965
17030
|
constructor(e) {
|
|
16966
17031
|
super(e), this.fill(0);
|
|
16967
17032
|
}
|
|
16968
|
-
},
|
|
17033
|
+
}, vh = class e {
|
|
16969
17034
|
heap;
|
|
16970
17035
|
length;
|
|
16971
17036
|
static #e = !1;
|
|
16972
17037
|
static create(t) {
|
|
16973
|
-
let n =
|
|
17038
|
+
let n = gh(t);
|
|
16974
17039
|
if (!n) return [];
|
|
16975
17040
|
e.#e = !0;
|
|
16976
17041
|
let r = new e(t, n);
|
|
@@ -16987,7 +17052,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
16987
17052
|
pop() {
|
|
16988
17053
|
return this.heap[--this.length];
|
|
16989
17054
|
}
|
|
16990
|
-
},
|
|
17055
|
+
}, yh = class e {
|
|
16991
17056
|
#e;
|
|
16992
17057
|
#t;
|
|
16993
17058
|
#n;
|
|
@@ -17077,8 +17142,8 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17077
17142
|
}
|
|
17078
17143
|
constructor(t) {
|
|
17079
17144
|
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;
|
|
17080
|
-
if (n !== 0 && !
|
|
17081
|
-
let C = n ?
|
|
17145
|
+
if (n !== 0 && !hh(n)) throw TypeError("max option must be a nonnegative integer");
|
|
17146
|
+
let C = n ? gh(n) : Array;
|
|
17082
17147
|
if (!C) throw Error("invalid max value: " + n);
|
|
17083
17148
|
if (this.#e = n, this.#t = p, this.maxEntrySize = m || this.#t, this.sizeCalculation = h, this.sizeCalculation) {
|
|
17084
17149
|
if (!this.#t && !this.maxEntrySize) throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
@@ -17086,27 +17151,27 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17086
17151
|
}
|
|
17087
17152
|
if (_ !== void 0 && typeof _ != "function") throw TypeError("memoMethod must be a function if defined");
|
|
17088
17153
|
if (this.#a = _, g !== void 0 && typeof g != "function") throw TypeError("fetchMethod must be a function if specified");
|
|
17089
|
-
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 =
|
|
17090
|
-
if (this.#t !== 0 && !
|
|
17091
|
-
if (!
|
|
17154
|
+
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 = vh.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) {
|
|
17155
|
+
if (this.#t !== 0 && !hh(this.#t)) throw TypeError("maxSize must be a positive integer if specified");
|
|
17156
|
+
if (!hh(this.maxEntrySize)) throw TypeError("maxEntrySize must be a positive integer if specified");
|
|
17092
17157
|
this.#O();
|
|
17093
17158
|
}
|
|
17094
|
-
if (this.allowStale = !!c, this.noDeleteOnStaleGet = !!y, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!s, this.ttlResolution =
|
|
17095
|
-
if (!
|
|
17159
|
+
if (this.allowStale = !!c, this.noDeleteOnStaleGet = !!y, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!s, this.ttlResolution = hh(i) || i === 0 ? i : 1, this.ttlAutopurge = !!a, this.ttl = r || 0, this.ttl) {
|
|
17160
|
+
if (!hh(this.ttl)) throw TypeError("ttl must be a positive integer if specified");
|
|
17096
17161
|
this.#C();
|
|
17097
17162
|
}
|
|
17098
17163
|
if (this.#e === 0 && this.ttl === 0 && this.#t === 0) throw TypeError("At least one of max, maxSize, or ttl is required");
|
|
17099
17164
|
if (!this.ttlAutopurge && !this.#e && !this.#t) {
|
|
17100
17165
|
let t = "LRU_CACHE_UNBOUNDED";
|
|
17101
|
-
|
|
17166
|
+
mh(t) && (lh.add(t), dh("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", t, e));
|
|
17102
17167
|
}
|
|
17103
17168
|
}
|
|
17104
17169
|
getRemainingTTL(e) {
|
|
17105
17170
|
return this.#c.has(e) ? Infinity : 0;
|
|
17106
17171
|
}
|
|
17107
17172
|
#C() {
|
|
17108
|
-
let e = new
|
|
17109
|
-
this.#y = e, this.#v = t, this.#E = (n, r, i =
|
|
17173
|
+
let e = new _h(this.#e), t = new _h(this.#e);
|
|
17174
|
+
this.#y = e, this.#v = t, this.#E = (n, r, i = ch.now()) => {
|
|
17110
17175
|
if (t[n] = r === 0 ? 0 : i, e[n] = r, r !== 0 && this.ttlAutopurge) {
|
|
17111
17176
|
let e = setTimeout(() => {
|
|
17112
17177
|
this.#D(n) && this.#B(this.#l[n], "expire");
|
|
@@ -17115,7 +17180,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17115
17180
|
e.unref && e.unref();
|
|
17116
17181
|
}
|
|
17117
17182
|
}, this.#w = (n) => {
|
|
17118
|
-
t[n] = e[n] === 0 ? 0 :
|
|
17183
|
+
t[n] = e[n] === 0 ? 0 : ch.now();
|
|
17119
17184
|
}, this.#T = (i, a) => {
|
|
17120
17185
|
if (e[a]) {
|
|
17121
17186
|
let o = e[a], s = t[a];
|
|
@@ -17125,7 +17190,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17125
17190
|
}
|
|
17126
17191
|
};
|
|
17127
17192
|
let n = 0, r = () => {
|
|
17128
|
-
let e =
|
|
17193
|
+
let e = ch.now();
|
|
17129
17194
|
if (this.ttlResolution > 0) {
|
|
17130
17195
|
n = e;
|
|
17131
17196
|
let t = setTimeout(() => n = 0, this.ttlResolution);
|
|
@@ -17150,14 +17215,14 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17150
17215
|
/* c8 ignore stop */
|
|
17151
17216
|
#D = () => !1;
|
|
17152
17217
|
#O() {
|
|
17153
|
-
let e = new
|
|
17218
|
+
let e = new _h(this.#e);
|
|
17154
17219
|
this.#s = 0, this.#_ = e, this.#k = (t) => {
|
|
17155
17220
|
this.#s -= e[t], e[t] = 0;
|
|
17156
17221
|
}, this.#j = (e, t, n, r) => {
|
|
17157
17222
|
if (this.#L(t)) return 0;
|
|
17158
|
-
if (!
|
|
17223
|
+
if (!hh(n)) if (r) {
|
|
17159
17224
|
if (typeof r != "function") throw TypeError("sizeCalculation must be a function");
|
|
17160
|
-
if (n = r(t, e), !
|
|
17225
|
+
if (n = r(t, e), !hh(n)) throw TypeError("sizeCalculation return invalid (expect positive integer)");
|
|
17161
17226
|
} else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
|
|
17162
17227
|
return n;
|
|
17163
17228
|
}, this.#A = (t, n, r) => {
|
|
@@ -17242,7 +17307,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17242
17307
|
let i = { value: r };
|
|
17243
17308
|
if (this.#y && this.#v) {
|
|
17244
17309
|
let e = this.#y[t], n = this.#v[t];
|
|
17245
|
-
e && n && (i.ttl = e - (
|
|
17310
|
+
e && n && (i.ttl = e - (ch.now() - n), i.start = Date.now());
|
|
17246
17311
|
}
|
|
17247
17312
|
return this.#_ && (i.size = this.#_[t]), i;
|
|
17248
17313
|
}
|
|
@@ -17254,7 +17319,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17254
17319
|
let a = { value: i };
|
|
17255
17320
|
if (this.#y && this.#v) {
|
|
17256
17321
|
a.ttl = this.#y[t];
|
|
17257
|
-
let e =
|
|
17322
|
+
let e = ch.now() - this.#v[t];
|
|
17258
17323
|
a.start = Math.floor(Date.now() - e);
|
|
17259
17324
|
}
|
|
17260
17325
|
this.#_ && (a.size = this.#_[t]), e.unshift([n, a]);
|
|
@@ -17266,7 +17331,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17266
17331
|
for (let [t, n] of e) {
|
|
17267
17332
|
if (n.start) {
|
|
17268
17333
|
let e = Date.now() - n.start;
|
|
17269
|
-
n.start =
|
|
17334
|
+
n.start = ch.now() - e;
|
|
17270
17335
|
}
|
|
17271
17336
|
this.set(t, n.value, n);
|
|
17272
17337
|
}
|
|
@@ -17349,7 +17414,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17349
17414
|
#I(e, t, n, r) {
|
|
17350
17415
|
let i = t === void 0 ? void 0 : this.#u[t];
|
|
17351
17416
|
if (this.#L(i)) return i;
|
|
17352
|
-
let a = new
|
|
17417
|
+
let a = new fh(), { signal: o } = n;
|
|
17353
17418
|
o?.addEventListener("abort", () => a.abort(o.reason), { signal: a.signal });
|
|
17354
17419
|
let s = {
|
|
17355
17420
|
signal: a.signal,
|
|
@@ -17384,7 +17449,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17384
17449
|
#L(e) {
|
|
17385
17450
|
if (!this.#x) return !1;
|
|
17386
17451
|
let t = e;
|
|
17387
|
-
return !!t && t instanceof Promise && t.hasOwnProperty("__staleWhileFetching") && t.__abortController instanceof
|
|
17452
|
+
return !!t && t instanceof Promise && t.hasOwnProperty("__staleWhileFetching") && t.__abortController instanceof fh;
|
|
17388
17453
|
}
|
|
17389
17454
|
async fetch(e, t = {}) {
|
|
17390
17455
|
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;
|
|
@@ -17508,18 +17573,18 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17508
17573
|
for (; t = e?.shift();) this.#r?.(...t);
|
|
17509
17574
|
}
|
|
17510
17575
|
}
|
|
17511
|
-
},
|
|
17576
|
+
}, bh = (e, t) => URL.createObjectURL(D(e, t)), xh = (e) => {
|
|
17512
17577
|
let t = pe(e);
|
|
17513
17578
|
return t == null ? e : new TextDecoder().decode(t);
|
|
17514
|
-
},
|
|
17579
|
+
}, Sh = (n, r) => ({
|
|
17515
17580
|
type: e.Error,
|
|
17516
17581
|
errorType: n === 403 ? t.Forbidden : t.LoadFailed,
|
|
17517
17582
|
url: r
|
|
17518
|
-
}),
|
|
17583
|
+
}), Ch = (n) => ({
|
|
17519
17584
|
type: e.Error,
|
|
17520
17585
|
errorType: t.LoadFailed,
|
|
17521
17586
|
url: n
|
|
17522
|
-
}),
|
|
17587
|
+
}), wh = (e) => {
|
|
17523
17588
|
let t;
|
|
17524
17589
|
try {
|
|
17525
17590
|
t = new URL(e).pathname;
|
|
@@ -17532,55 +17597,55 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17532
17597
|
} catch {
|
|
17533
17598
|
return n;
|
|
17534
17599
|
}
|
|
17535
|
-
},
|
|
17536
|
-
if (
|
|
17537
|
-
let r =
|
|
17600
|
+
}, Th = (e) => e.startsWith("image/") || e.startsWith("audio/") || e === S.PDF || i("", e), Eh = (e, t) => {
|
|
17601
|
+
if (Th(e)) return e;
|
|
17602
|
+
let r = wh(t), i = r.lastIndexOf(".");
|
|
17538
17603
|
return (i === -1 ? "" : r.slice(i + 1).toLowerCase()) === v.PDF ? S.PDF : n(r) ?? e;
|
|
17539
|
-
},
|
|
17540
|
-
if (
|
|
17541
|
-
let n =
|
|
17604
|
+
}, Dh = (e, t) => {
|
|
17605
|
+
if (Th(Eh(e, t))) return !0;
|
|
17606
|
+
let n = wh(t);
|
|
17542
17607
|
return a(n) || r(n);
|
|
17543
|
-
},
|
|
17544
|
-
|
|
17545
|
-
},
|
|
17546
|
-
let t =
|
|
17608
|
+
}, Oh = new yh({ max: 10 }), kh = new yh({ max: 50 }), Ah = () => {
|
|
17609
|
+
Oh.clear(), kh.clear();
|
|
17610
|
+
}, jh = (e) => {
|
|
17611
|
+
let t = Oh.get(e);
|
|
17547
17612
|
return t ?? (t = fetch(e).then((e) => {
|
|
17548
17613
|
if (!e.ok) throw Object.assign(/* @__PURE__ */ Error(`HTTP ${e.status}`), { status: e.status });
|
|
17549
17614
|
return e.blob();
|
|
17550
17615
|
}).catch((t) => {
|
|
17551
|
-
throw
|
|
17552
|
-
}),
|
|
17553
|
-
},
|
|
17554
|
-
let t =
|
|
17616
|
+
throw Oh.delete(e), t;
|
|
17617
|
+
}), Oh.set(e, t)), t;
|
|
17618
|
+
}, Mh = (e) => {
|
|
17619
|
+
let t = kh.get(e);
|
|
17555
17620
|
return t ?? (t = fetch(e).then((e) => {
|
|
17556
17621
|
if (!e.ok) throw Object.assign(/* @__PURE__ */ Error(`HTTP ${e.status}`), { status: e.status });
|
|
17557
17622
|
return e.text();
|
|
17558
17623
|
}).catch((t) => {
|
|
17559
|
-
throw
|
|
17560
|
-
}),
|
|
17561
|
-
},
|
|
17624
|
+
throw kh.delete(e), t;
|
|
17625
|
+
}), kh.set(e, t)), t;
|
|
17626
|
+
}, Nh = async (e, t) => {
|
|
17562
17627
|
if ("file" in e) return URL.createObjectURL(e.file);
|
|
17563
17628
|
let n = t.resolveDialUrl(e);
|
|
17564
17629
|
if (n != null) try {
|
|
17565
|
-
let e = await
|
|
17630
|
+
let e = await jh(n);
|
|
17566
17631
|
return URL.createObjectURL(e);
|
|
17567
17632
|
} catch (e) {
|
|
17568
17633
|
let t = e.status;
|
|
17569
|
-
return t == null ?
|
|
17634
|
+
return t == null ? Ch(n) : Sh(t, n);
|
|
17570
17635
|
}
|
|
17571
17636
|
if (e.previewUrl != null) return e.previewUrl;
|
|
17572
|
-
if (e.data != null) return
|
|
17573
|
-
},
|
|
17574
|
-
if (e.data != null) return
|
|
17637
|
+
if (e.data != null) return bh(e.data, e.contentType);
|
|
17638
|
+
}, Ph = async (e, t) => {
|
|
17639
|
+
if (e.data != null) return xh(e.data);
|
|
17575
17640
|
let n = t.resolveDialUrl(e);
|
|
17576
17641
|
if (n != null) try {
|
|
17577
|
-
return await
|
|
17642
|
+
return await Mh(n);
|
|
17578
17643
|
} catch (e) {
|
|
17579
17644
|
let t = e.status;
|
|
17580
|
-
return t == null ?
|
|
17645
|
+
return t == null ? Ch(n) : Sh(t, n);
|
|
17581
17646
|
}
|
|
17582
17647
|
if ("file" in e) return e.file.text();
|
|
17583
|
-
},
|
|
17648
|
+
}, Fh = (e, t) => e.data != null || t.resolveDialUrl(e) != null || "file" in e, Ih = (t, n) => {
|
|
17584
17649
|
if ("file" in t) return {
|
|
17585
17650
|
type: e.Image,
|
|
17586
17651
|
url: URL.createObjectURL(t.file)
|
|
@@ -17588,7 +17653,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17588
17653
|
let r = n.resolveDialUrl(t);
|
|
17589
17654
|
return r == null ? t.previewUrl == null ? t.data == null ? null : {
|
|
17590
17655
|
type: e.Image,
|
|
17591
|
-
url:
|
|
17656
|
+
url: bh(t.data, t.contentType)
|
|
17592
17657
|
} : {
|
|
17593
17658
|
type: e.Image,
|
|
17594
17659
|
url: t.previewUrl
|
|
@@ -17596,37 +17661,37 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17596
17661
|
type: e.Image,
|
|
17597
17662
|
url: r
|
|
17598
17663
|
};
|
|
17599
|
-
},
|
|
17600
|
-
let r = await
|
|
17664
|
+
}, Lh = async (t, n) => {
|
|
17665
|
+
let r = await Ph(t, n);
|
|
17601
17666
|
return r == null ? null : typeof r == "string" ? {
|
|
17602
17667
|
type: e.PlainText,
|
|
17603
17668
|
text: r
|
|
17604
17669
|
} : r;
|
|
17605
|
-
},
|
|
17606
|
-
let r = await
|
|
17670
|
+
}, Rh = async (t, n) => {
|
|
17671
|
+
let r = await Ph(t, n);
|
|
17607
17672
|
return r == null ? null : typeof r == "string" ? {
|
|
17608
17673
|
type: e.Markdown,
|
|
17609
17674
|
text: r
|
|
17610
17675
|
} : r;
|
|
17611
|
-
},
|
|
17612
|
-
let i = await
|
|
17676
|
+
}, zh = 1048576, Bh = async (t, n, r) => {
|
|
17677
|
+
let i = await Ph(t, n);
|
|
17613
17678
|
return i == null ? null : typeof i == "string" ? {
|
|
17614
17679
|
type: e.Code,
|
|
17615
17680
|
text: i,
|
|
17616
17681
|
language: r
|
|
17617
17682
|
} : i;
|
|
17618
|
-
},
|
|
17619
|
-
let r = await
|
|
17683
|
+
}, Vh = async (t, n) => {
|
|
17684
|
+
let r = await Ph(t, n);
|
|
17620
17685
|
if (r == null) return null;
|
|
17621
17686
|
if (typeof r != "string") return r;
|
|
17622
|
-
if (r.length >
|
|
17687
|
+
if (r.length > zh) return null;
|
|
17623
17688
|
let i = n.resolveDialUrl(t) ?? void 0;
|
|
17624
17689
|
return {
|
|
17625
17690
|
type: e.Html,
|
|
17626
17691
|
srcdoc: r,
|
|
17627
17692
|
url: i
|
|
17628
17693
|
};
|
|
17629
|
-
},
|
|
17694
|
+
}, Hh = (t, n, r) => {
|
|
17630
17695
|
let i = t.body?.source?.attachment;
|
|
17631
17696
|
if (i?.type !== S.PDF) return null;
|
|
17632
17697
|
let a = kt(i.url) ? r.resolveDialFileDownloadUrl(i.url) : i.url;
|
|
@@ -17638,7 +17703,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17638
17703
|
highlights: j(s),
|
|
17639
17704
|
selectedHighlightId: he(t, c)
|
|
17640
17705
|
};
|
|
17641
|
-
},
|
|
17706
|
+
}, Uh = (t, n) => {
|
|
17642
17707
|
let r = _e(t.url);
|
|
17643
17708
|
if (r == null) return null;
|
|
17644
17709
|
let i = kt(r.baseUrl) ? n.resolveDialFileDownloadUrl(r.baseUrl) : r.baseUrl;
|
|
@@ -17667,39 +17732,39 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17667
17732
|
}],
|
|
17668
17733
|
selectedHighlightId: a
|
|
17669
17734
|
};
|
|
17670
|
-
},
|
|
17735
|
+
}, Wh = (e) => {
|
|
17671
17736
|
try {
|
|
17672
17737
|
let t = new URL(e).protocol;
|
|
17673
17738
|
return t === "http:" || t === "https:" || t === "blob:";
|
|
17674
17739
|
} catch {
|
|
17675
17740
|
return !1;
|
|
17676
17741
|
}
|
|
17677
|
-
},
|
|
17678
|
-
let r = await
|
|
17742
|
+
}, Gh = (e) => e.url != null && !kt(e.url) && Wh(e.url) ? e.url : void 0, Kh = async (t, n) => {
|
|
17743
|
+
let r = await Nh(t, n);
|
|
17679
17744
|
if (r != null) return typeof r == "string" ? {
|
|
17680
17745
|
type: e.Pdf,
|
|
17681
17746
|
url: r
|
|
17682
17747
|
} : r;
|
|
17683
|
-
let i =
|
|
17748
|
+
let i = Gh(t);
|
|
17684
17749
|
return i == null ? null : {
|
|
17685
17750
|
type: e.Pdf,
|
|
17686
17751
|
url: i
|
|
17687
17752
|
};
|
|
17688
|
-
},
|
|
17689
|
-
let i = await
|
|
17753
|
+
}, qh = async (t, n, r) => {
|
|
17754
|
+
let i = await Nh(t, n);
|
|
17690
17755
|
if (i != null) return typeof i == "string" ? {
|
|
17691
17756
|
type: e.Ooxml,
|
|
17692
17757
|
url: i,
|
|
17693
17758
|
format: r
|
|
17694
17759
|
} : i;
|
|
17695
|
-
let a =
|
|
17760
|
+
let a = Gh(t);
|
|
17696
17761
|
return a == null ? null : {
|
|
17697
17762
|
type: e.Ooxml,
|
|
17698
17763
|
url: a,
|
|
17699
17764
|
format: r
|
|
17700
17765
|
};
|
|
17701
|
-
},
|
|
17702
|
-
let r = await
|
|
17766
|
+
}, Jh = async (t, n) => {
|
|
17767
|
+
let r = await Ph(t, n);
|
|
17703
17768
|
if (r == null) return null;
|
|
17704
17769
|
if (typeof r != "string") return r;
|
|
17705
17770
|
try {
|
|
@@ -17714,8 +17779,8 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17714
17779
|
text: r
|
|
17715
17780
|
};
|
|
17716
17781
|
}
|
|
17717
|
-
},
|
|
17718
|
-
let a = await
|
|
17782
|
+
}, Yh = async (t, n, r, i) => {
|
|
17783
|
+
let a = await Ph(t, n);
|
|
17719
17784
|
if (a == null || typeof a != "string") return null;
|
|
17720
17785
|
let o = {};
|
|
17721
17786
|
try {
|
|
@@ -17736,7 +17801,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17736
17801
|
visualizerName: r.title,
|
|
17737
17802
|
requestTimeout: r.requestTimeout
|
|
17738
17803
|
};
|
|
17739
|
-
},
|
|
17804
|
+
}, Xh = (e, t) => le(e, t), Zh = (e) => {
|
|
17740
17805
|
let t = e.body?.source?.attachment;
|
|
17741
17806
|
return t == null ? null : {
|
|
17742
17807
|
id: t.url,
|
|
@@ -17746,12 +17811,12 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17746
17811
|
status: w.Idle,
|
|
17747
17812
|
url: t.url
|
|
17748
17813
|
};
|
|
17749
|
-
},
|
|
17814
|
+
}, Qh = (e, t) => e?.map((e) => Xh(e, t)) ?? [], $h = (e, t) => {
|
|
17750
17815
|
let n = e.url ?? e.id;
|
|
17751
17816
|
if (n) return kt(n) || n.startsWith("http://") || n.startsWith("https://") ? n : `files/${t}/${n.replace(/^\/+/, "")}`;
|
|
17752
|
-
},
|
|
17817
|
+
}, eg = (e, t, n) => {
|
|
17753
17818
|
if (e.nodeType !== qe.ITEM) return null;
|
|
17754
|
-
let r =
|
|
17819
|
+
let r = $h(e, t);
|
|
17755
17820
|
if (!r) return null;
|
|
17756
17821
|
let i = e.contentType ?? "application/octet-stream", a = i.startsWith("image/"), o = a ? n?.resolvePreviewUrl?.(r) : void 0;
|
|
17757
17822
|
return {
|
|
@@ -17764,7 +17829,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17764
17829
|
file: new File([], e.name, { type: i }),
|
|
17765
17830
|
...o == null ? {} : { previewUrl: o }
|
|
17766
17831
|
};
|
|
17767
|
-
},
|
|
17832
|
+
}, tg = (e, t, n) => e.map((e) => eg(e, t, n)).filter((e) => e != null), ng = (e) => {
|
|
17768
17833
|
let t = H(e.replace(/\/$/, "").split("/").filter(Boolean).pop() ?? "");
|
|
17769
17834
|
return {
|
|
17770
17835
|
id: e,
|
|
@@ -17775,11 +17840,11 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17775
17840
|
url: e,
|
|
17776
17841
|
file: new File([], t)
|
|
17777
17842
|
};
|
|
17778
|
-
},
|
|
17843
|
+
}, rg = /* @__PURE__ */ function(e) {
|
|
17779
17844
|
return e.Blob = "blob", e.Stream = "stream", e.Cancelled = "cancelled", e;
|
|
17780
|
-
}({}),
|
|
17845
|
+
}({}), ig = async (e, t = "application/octet-stream") => {
|
|
17781
17846
|
let n = window.showSaveFilePicker;
|
|
17782
|
-
if (n == null) return { type:
|
|
17847
|
+
if (n == null) return { type: rg.Blob };
|
|
17783
17848
|
try {
|
|
17784
17849
|
let r = e.lastIndexOf("."), i = r >= 0 ? e.slice(r) : void 0, a = await n.call(window, {
|
|
17785
17850
|
suggestedName: e,
|
|
@@ -17789,27 +17854,27 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17789
17854
|
}]
|
|
17790
17855
|
});
|
|
17791
17856
|
return {
|
|
17792
|
-
type:
|
|
17857
|
+
type: rg.Stream,
|
|
17793
17858
|
writable: await a.createWritable()
|
|
17794
17859
|
};
|
|
17795
17860
|
} catch (e) {
|
|
17796
|
-
if (e instanceof DOMException && e.name === "AbortError") return { type:
|
|
17861
|
+
if (e instanceof DOMException && e.name === "AbortError") return { type: rg.Cancelled };
|
|
17797
17862
|
throw e;
|
|
17798
17863
|
}
|
|
17799
|
-
},
|
|
17864
|
+
}, ag = (e) => {
|
|
17800
17865
|
let t = e.lastIndexOf("."), n = t > 0;
|
|
17801
17866
|
return {
|
|
17802
17867
|
base: n ? e.slice(0, t) : e,
|
|
17803
17868
|
extension: n ? e.slice(t) : ""
|
|
17804
17869
|
};
|
|
17805
|
-
},
|
|
17870
|
+
}, og = (e, t = 255) => {
|
|
17806
17871
|
if (A(e) <= t) return e;
|
|
17807
|
-
let { base: n, extension: r } =
|
|
17872
|
+
let { base: n, extension: r } = ag(e), i = t - A(r);
|
|
17808
17873
|
return i <= 0 ? fe(e, t) : `${fe(n, i)}${r}`;
|
|
17809
|
-
},
|
|
17810
|
-
let { base: t, extension: n } =
|
|
17811
|
-
return r === "" ? e :
|
|
17812
|
-
},
|
|
17874
|
+
}, sg = (e) => {
|
|
17875
|
+
let { base: t, extension: n } = ag(e), r = t.replace(new RegExp(Ye.source, "g"), "_").replace(/[.\s]+$/, "");
|
|
17876
|
+
return r === "" ? e : og(`${r}${n}`);
|
|
17877
|
+
}, cg = ({ filesApi: e, bucket: t, rootLabel: n, activeTab: r, onNotification: i }) => {
|
|
17813
17878
|
let [a, o] = R(""), [s, c] = R(() => /* @__PURE__ */ new Map()), l = L(s);
|
|
17814
17879
|
F(() => {
|
|
17815
17880
|
l.current = s;
|
|
@@ -17821,11 +17886,11 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17821
17886
|
D.current != null && clearTimeout(D.current), O.current?.();
|
|
17822
17887
|
}, []), F(() => {
|
|
17823
17888
|
let i = !1;
|
|
17824
|
-
return p(!0), h(null),
|
|
17889
|
+
return p(!0), h(null), eh(e, r, t, a, S.current).then(({ items: e, permissions: t }) => {
|
|
17825
17890
|
i || (c((t) => {
|
|
17826
17891
|
let n = new Map(t);
|
|
17827
17892
|
return n.set(a, e), n;
|
|
17828
|
-
}), d((e) => new Map(e).set(a, t)), r === B.Shared && a === "" && (y(e.map((e) =>
|
|
17893
|
+
}), d((e) => new Map(e).set(a, t)), r === B.Shared && a === "" && (y(e.map((e) => Bm(zm(e.path, e.bucket ?? ""), n, e.nodeType === ke.Folder))), S.current = new Map(e.map((e) => [H(e.name), {
|
|
17829
17894
|
bucket: e.bucket ?? "",
|
|
17830
17895
|
dialCorePath: e.path
|
|
17831
17896
|
}]))));
|
|
@@ -17856,7 +17921,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17856
17921
|
}
|
|
17857
17922
|
let i = !1;
|
|
17858
17923
|
return e.listSharedByMe(t).then((e) => {
|
|
17859
|
-
i || x(new Set(e.items.map((e) =>
|
|
17924
|
+
i || x(new Set(e.items.map((e) => Bm(zm(e.path, t), n, e.nodeType === ke.Folder))));
|
|
17860
17925
|
}).catch(() => {
|
|
17861
17926
|
i || x(/* @__PURE__ */ new Set());
|
|
17862
17927
|
}), () => {
|
|
@@ -17876,8 +17941,8 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17876
17941
|
parentPath: "",
|
|
17877
17942
|
nodeType: Ze.FOLDER,
|
|
17878
17943
|
folderId: t,
|
|
17879
|
-
permissions:
|
|
17880
|
-
items:
|
|
17944
|
+
permissions: Ym(u.get("")),
|
|
17945
|
+
items: Zm(s, u, "", `/${n}`, t)
|
|
17881
17946
|
}], [
|
|
17882
17947
|
s,
|
|
17883
17948
|
u,
|
|
@@ -17905,7 +17970,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17905
17970
|
_((e) => e + 1);
|
|
17906
17971
|
}, []), de = ue, fe = P((o) => {
|
|
17907
17972
|
if (o.length === 0) return;
|
|
17908
|
-
let s = new Set([...ne].map((e) =>
|
|
17973
|
+
let s = new Set([...ne].map((e) => Wm(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);
|
|
17909
17974
|
u.length > 0 && (c((e) => {
|
|
17910
17975
|
let t = new Map(e);
|
|
17911
17976
|
return u.forEach((e) => t.delete(e)), t;
|
|
@@ -17915,7 +17980,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17915
17980
|
})), f.forEach((n) => {
|
|
17916
17981
|
(async () => {
|
|
17917
17982
|
try {
|
|
17918
|
-
let { items: i, permissions: a } = await
|
|
17983
|
+
let { items: i, permissions: a } = await eh(e, r, t, n, S.current);
|
|
17919
17984
|
c((e) => new Map(e).set(n, i)), a != null && d((e) => new Map(e).set(n, a));
|
|
17920
17985
|
} catch {
|
|
17921
17986
|
i?.({
|
|
@@ -17934,9 +17999,9 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17934
17999
|
n,
|
|
17935
18000
|
i
|
|
17936
18001
|
]), pe = P((e, t, n) => {
|
|
17937
|
-
c((r) =>
|
|
18002
|
+
c((r) => Qm(r, e, t, n));
|
|
17938
18003
|
}, []), me = P((a) => {
|
|
17939
|
-
let o = a == null ? "" :
|
|
18004
|
+
let o = a == null ? "" : Wm(a, n), s = a ?? `/${n}`;
|
|
17940
18005
|
if (A((e) => {
|
|
17941
18006
|
if (e.has(s)) return e;
|
|
17942
18007
|
let t = new Set(e);
|
|
@@ -17954,7 +18019,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17954
18019
|
return t.add(s), t;
|
|
17955
18020
|
}), (async () => {
|
|
17956
18021
|
try {
|
|
17957
|
-
let { items: n, permissions: i } = await
|
|
18022
|
+
let { items: n, permissions: i } = await eh(e, r, t, o, S.current);
|
|
17958
18023
|
c((e) => new Map(e).set(o, n)), i != null && d((e) => new Map(e).set(o, i)), te.current.delete(o);
|
|
17959
18024
|
} catch {
|
|
17960
18025
|
i?.({
|
|
@@ -17978,7 +18043,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17978
18043
|
]), he = I(() => {
|
|
17979
18044
|
let e = /* @__PURE__ */ new Set(), t = new Set([...ne, ...ae]);
|
|
17980
18045
|
for (let r of t) {
|
|
17981
|
-
let t =
|
|
18046
|
+
let t = Wm(r, n);
|
|
17982
18047
|
s.has(t) && e.add(r);
|
|
17983
18048
|
}
|
|
17984
18049
|
return e;
|
|
@@ -17989,15 +18054,15 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
17989
18054
|
n
|
|
17990
18055
|
]), j = P((a) => {
|
|
17991
18056
|
ne.forEach((e) => {
|
|
17992
|
-
a.has(e) || te.current.delete(
|
|
18057
|
+
a.has(e) || te.current.delete(Wm(e, n));
|
|
17993
18058
|
}), re(a), [...a].filter((e) => {
|
|
17994
|
-
let t =
|
|
18059
|
+
let t = Wm(e, n);
|
|
17995
18060
|
return !l.current.has(t) && !ee.current.has(t) && !te.current.has(t);
|
|
17996
18061
|
}).forEach((a) => {
|
|
17997
|
-
let o =
|
|
18062
|
+
let o = Wm(a, n);
|
|
17998
18063
|
ee.current.add(o), (async () => {
|
|
17999
18064
|
try {
|
|
18000
|
-
let { items: n, permissions: i } = await
|
|
18065
|
+
let { items: n, permissions: i } = await eh(e, r, t, o, S.current);
|
|
18001
18066
|
c((e) => new Map(e).set(o, n)), i != null && d((e) => new Map(e).set(o, i));
|
|
18002
18067
|
} catch {
|
|
18003
18068
|
te.current.add(o), i?.({
|
|
@@ -18030,7 +18095,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18030
18095
|
D.current = null;
|
|
18031
18096
|
let i = o.toLowerCase();
|
|
18032
18097
|
if (r === B.Shared && a === "") {
|
|
18033
|
-
O.current?.(), O.current = null, w(!0), E((s.get("") ?? []).filter((e) => H(e.name).toLowerCase().includes(i)).map((e) =>
|
|
18098
|
+
O.current?.(), O.current = null, w(!0), E((s.get("") ?? []).filter((e) => H(e.name).toLowerCase().includes(i)).map((e) => nh(e, e.bucket ?? t, n))), w(!1);
|
|
18034
18099
|
return;
|
|
18035
18100
|
}
|
|
18036
18101
|
let c = !1;
|
|
@@ -18038,9 +18103,9 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18038
18103
|
c = !0;
|
|
18039
18104
|
}, w(!0), (async () => {
|
|
18040
18105
|
try {
|
|
18041
|
-
let { items: o } = await
|
|
18106
|
+
let { items: o } = await th(e, r, t, a, S.current);
|
|
18042
18107
|
if (c) return;
|
|
18043
|
-
E(o.filter((e) => H(e.name).toLowerCase().includes(i)).map((e) =>
|
|
18108
|
+
E(o.filter((e) => H(e.name).toLowerCase().includes(i)).map((e) => nh(e, e.bucket ?? t, n)));
|
|
18044
18109
|
} catch {
|
|
18045
18110
|
c || E([]);
|
|
18046
18111
|
} finally {
|
|
@@ -18057,7 +18122,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18057
18122
|
n
|
|
18058
18123
|
]), _e = a ? `/${n}/${a}` : `/${n}`, N = I(() => {
|
|
18059
18124
|
let e = ce[0];
|
|
18060
|
-
if (e) return
|
|
18125
|
+
if (e) return Am(_e) === Am(`/${n}`) ? e : Nm(e.items ?? [], _e);
|
|
18061
18126
|
}, [
|
|
18062
18127
|
ce,
|
|
18063
18128
|
_e,
|
|
@@ -18091,7 +18156,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18091
18156
|
mergeCreatedFolder: pe,
|
|
18092
18157
|
bumpRetry: de
|
|
18093
18158
|
};
|
|
18094
|
-
},
|
|
18159
|
+
}, lg = ({ filesApi: e, bucket: t, rootLabel: n, onNotification: r }) => {
|
|
18095
18160
|
let [i, a] = R(void 0), [o, s] = R(!1);
|
|
18096
18161
|
return {
|
|
18097
18162
|
fileMetadata: i,
|
|
@@ -18100,8 +18165,8 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18100
18165
|
(async () => {
|
|
18101
18166
|
s(!0);
|
|
18102
18167
|
try {
|
|
18103
|
-
let r = i.bucket ?? t, o =
|
|
18104
|
-
a(
|
|
18168
|
+
let r = i.bucket ?? t, o = Km(i, r, n);
|
|
18169
|
+
a(rh(await e.getFileMetadata({
|
|
18105
18170
|
bucket: r,
|
|
18106
18171
|
path: o
|
|
18107
18172
|
}), i));
|
|
@@ -18124,30 +18189,30 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18124
18189
|
a(void 0), s(!1);
|
|
18125
18190
|
}, [])
|
|
18126
18191
|
};
|
|
18127
|
-
},
|
|
18192
|
+
}, ug = ({ 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 }) => {
|
|
18128
18193
|
let [g, _] = R(!1), [v, y] = R(!1), [b, x] = R(!1), [S, C] = R(!1), [w, T] = R(!1), [E, D] = R(!1), O = L(null), ee = L(null), te = P((e, t) => {
|
|
18129
18194
|
let n = null;
|
|
18130
|
-
if (!e || e.trim() === "") n = { reason:
|
|
18131
|
-
else if (
|
|
18132
|
-
reason:
|
|
18195
|
+
if (!e || e.trim() === "") n = { reason: ym.Empty };
|
|
18196
|
+
else if (km(e, h)) n = {
|
|
18197
|
+
reason: ym.ForbiddenSymbols,
|
|
18133
18198
|
symbols: Je
|
|
18134
18199
|
};
|
|
18135
|
-
else if (e.startsWith(".")) n = { reason:
|
|
18136
|
-
else if (e ===
|
|
18200
|
+
else if (e.startsWith(".")) n = { reason: ym.LeadingDot };
|
|
18201
|
+
else if (e === Sm) n = { reason: ym.ReservedName };
|
|
18137
18202
|
else if (e.length > 255) n = {
|
|
18138
|
-
reason:
|
|
18203
|
+
reason: ym.TooLong,
|
|
18139
18204
|
maxLength: 255
|
|
18140
18205
|
};
|
|
18141
18206
|
else {
|
|
18142
18207
|
let r = t.items ?? [], i = e.toLowerCase(), a = r.find((e) => e.name.toLowerCase() === i);
|
|
18143
18208
|
a && (n = {
|
|
18144
|
-
reason:
|
|
18209
|
+
reason: ym.DuplicateName,
|
|
18145
18210
|
existingName: a.name
|
|
18146
18211
|
});
|
|
18147
18212
|
}
|
|
18148
18213
|
return ee.current = n, n;
|
|
18149
18214
|
}, [h]), ne = P(async (c, d, m) => {
|
|
18150
|
-
let { parentVirtualPath: h, name: g } =
|
|
18215
|
+
let { parentVirtualPath: h, name: g } = Rm(d, n), v = Wm(h, n), y = a && i === v ? a : {
|
|
18151
18216
|
id: v,
|
|
18152
18217
|
path: v,
|
|
18153
18218
|
name: h.split("/").filter(Boolean).pop() ?? "",
|
|
@@ -18157,7 +18222,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18157
18222
|
}, b = ee.current;
|
|
18158
18223
|
if (ee.current = null, te(g, y) || b) return;
|
|
18159
18224
|
_(!0);
|
|
18160
|
-
let { bucket: x, path: S } = r === B.Shared ?
|
|
18225
|
+
let { bucket: x, path: S } = r === B.Shared ? Vm(v, o.current, t) : {
|
|
18161
18226
|
bucket: t,
|
|
18162
18227
|
path: v
|
|
18163
18228
|
};
|
|
@@ -18167,7 +18232,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18167
18232
|
parentPath: S || void 0,
|
|
18168
18233
|
name: g
|
|
18169
18234
|
}), s.get(v)), l(), p?.({
|
|
18170
|
-
kind:
|
|
18235
|
+
kind: bm.FolderCreated,
|
|
18171
18236
|
name: g
|
|
18172
18237
|
});
|
|
18173
18238
|
} catch {
|
|
@@ -18197,32 +18262,32 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18197
18262
|
y(!0);
|
|
18198
18263
|
try {
|
|
18199
18264
|
let i = r.length === 1 ? r[0].nodeType === Ze.ITEM ? r[0].name : `${r[0].name}.zip` : "files.zip", a = await m.resolveDestination(i, r.length === 1 && r[0].nodeType === Ze.ITEM ? r[0].contentType ?? "application/octet-stream" : "application/zip");
|
|
18200
|
-
if (a.type ===
|
|
18265
|
+
if (a.type === rg.Cancelled) return;
|
|
18201
18266
|
if (r.length === 1 && r[0].nodeType === Ze.ITEM) {
|
|
18202
18267
|
let t = r[0];
|
|
18203
18268
|
if (!t.bucket) throw Error("File is missing bucket");
|
|
18204
|
-
let i =
|
|
18269
|
+
let i = Km(t, t.bucket, n), o = await e.downloadFile(t.bucket, i);
|
|
18205
18270
|
if (!o.ok) throw Error(`Download failed with status ${o.status}`);
|
|
18206
18271
|
let s = await m.triggerDownload(o, t.name, a);
|
|
18207
18272
|
p?.({
|
|
18208
|
-
kind:
|
|
18273
|
+
kind: bm.FileDownloaded,
|
|
18209
18274
|
name: s,
|
|
18210
18275
|
count: 1
|
|
18211
18276
|
});
|
|
18212
18277
|
} else {
|
|
18213
18278
|
let o = r.map((e) => ({
|
|
18214
18279
|
bucket: e.bucket ?? t,
|
|
18215
|
-
path:
|
|
18280
|
+
path: Km(e, e.bucket ?? t, n),
|
|
18216
18281
|
name: e.name,
|
|
18217
18282
|
nodeType: e.nodeType === Ze.FOLDER ? Ee.Folder : Ee.Item
|
|
18218
18283
|
})), s = await e.downloadArchive(o);
|
|
18219
18284
|
if (!s.ok) throw Error(`Download failed with status ${s.status}`);
|
|
18220
18285
|
let c = await m.triggerDownload(s, i, a);
|
|
18221
18286
|
r.length === 1 ? p?.({
|
|
18222
|
-
kind:
|
|
18287
|
+
kind: bm.FileDownloaded,
|
|
18223
18288
|
name: c
|
|
18224
18289
|
}) : p?.({
|
|
18225
|
-
kind:
|
|
18290
|
+
kind: bm.FilesDownloaded,
|
|
18226
18291
|
count: r.length
|
|
18227
18292
|
});
|
|
18228
18293
|
}
|
|
@@ -18246,7 +18311,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18246
18311
|
a.length !== 0 && (async () => {
|
|
18247
18312
|
x(!0);
|
|
18248
18313
|
let u = a.map((e) => {
|
|
18249
|
-
let i = e.nodeType === Ze.FOLDER, a =
|
|
18314
|
+
let i = e.nodeType === Ze.FOLDER, a = Wm(e.sourceUrl, n), s = i ? a : a.replace(/\/$/, ""), c = jm(e.sourceUrl, s), { bucket: l, path: u } = r === B.Shared ? Vm(s, o.current, t) : {
|
|
18250
18315
|
bucket: t,
|
|
18251
18316
|
path: s
|
|
18252
18317
|
};
|
|
@@ -18299,19 +18364,19 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18299
18364
|
l,
|
|
18300
18365
|
d
|
|
18301
18366
|
]), k = P((e, t) => {
|
|
18302
|
-
if (!e || e.trim() === "") return { reason:
|
|
18303
|
-
if (e ===
|
|
18304
|
-
if (
|
|
18305
|
-
reason:
|
|
18367
|
+
if (!e || e.trim() === "") return { reason: ym.Empty };
|
|
18368
|
+
if (e === Sm) return { reason: ym.ReservedName };
|
|
18369
|
+
if (km(e, h)) return {
|
|
18370
|
+
reason: ym.ForbiddenSymbols,
|
|
18306
18371
|
symbols: Je
|
|
18307
18372
|
};
|
|
18308
18373
|
if (e.length > 255) return {
|
|
18309
|
-
reason:
|
|
18374
|
+
reason: ym.TooLong,
|
|
18310
18375
|
maxLength: 255
|
|
18311
18376
|
};
|
|
18312
18377
|
let n = a?.items ?? [], r = e.toLowerCase(), i = n.find((e) => e.path !== t.path && e.name.toLowerCase() === r);
|
|
18313
18378
|
return i ? {
|
|
18314
|
-
reason:
|
|
18379
|
+
reason: ym.DuplicateName,
|
|
18315
18380
|
existingName: i.name
|
|
18316
18381
|
} : null;
|
|
18317
18382
|
}, [h, a]), ae = P((r, i) => {
|
|
@@ -18319,16 +18384,16 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18319
18384
|
let a = new AbortController();
|
|
18320
18385
|
O.current = a, (async () => {
|
|
18321
18386
|
T(!0);
|
|
18322
|
-
let o =
|
|
18387
|
+
let o = qm(r, t, n), s = o.map(({ dto: e }) => e);
|
|
18323
18388
|
try {
|
|
18324
18389
|
let { results: t } = await e.copyFiles(s, a.signal), r = t.filter((e) => !e.success).length, c = t.length - r;
|
|
18325
18390
|
if (c > 0) {
|
|
18326
|
-
let e =
|
|
18391
|
+
let e = Xm(o, t);
|
|
18327
18392
|
p?.({
|
|
18328
|
-
kind: c === 1 ?
|
|
18393
|
+
kind: c === 1 ? bm.FileCopied : bm.FilesCopied,
|
|
18329
18394
|
name: e?.destinationName,
|
|
18330
18395
|
count: c,
|
|
18331
|
-
destinationFolderName:
|
|
18396
|
+
destinationFolderName: Mm(i, n)
|
|
18332
18397
|
});
|
|
18333
18398
|
}
|
|
18334
18399
|
r > 0 && r < t.length ? f?.({
|
|
@@ -18375,7 +18440,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18375
18440
|
onRenameValidate: k,
|
|
18376
18441
|
onMoveToFiles: P((r, a, o) => {
|
|
18377
18442
|
if (r.length === 0 || w || E || S) return;
|
|
18378
|
-
let { renameDtos: s, preparedMoveItems: u } =
|
|
18443
|
+
let { renameDtos: s, preparedMoveItems: u } = Jm(r, t, n), m = u.map(({ dto: e }) => e), h = new AbortController();
|
|
18379
18444
|
m.length > 0 && (O.current = h), (async () => {
|
|
18380
18445
|
s.length > 0 && C(!0), m.length > 0 && D(!0);
|
|
18381
18446
|
let [t, r] = await Promise.all([(async () => {
|
|
@@ -18417,19 +18482,19 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18417
18482
|
}
|
|
18418
18483
|
})()]), 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;
|
|
18419
18484
|
if (y > 0) {
|
|
18420
|
-
let e =
|
|
18485
|
+
let e = Xm(u, r.results);
|
|
18421
18486
|
p?.({
|
|
18422
|
-
kind: y === 1 ?
|
|
18487
|
+
kind: y === 1 ? bm.FileMoved : bm.FilesMoved,
|
|
18423
18488
|
name: e?.destinationName,
|
|
18424
18489
|
count: y,
|
|
18425
|
-
destinationFolderName:
|
|
18490
|
+
destinationFolderName: Mm(o, n)
|
|
18426
18491
|
});
|
|
18427
18492
|
}
|
|
18428
18493
|
if (s.length === 1 && a === 0) {
|
|
18429
18494
|
let [e] = s;
|
|
18430
18495
|
p?.({
|
|
18431
|
-
kind:
|
|
18432
|
-
name:
|
|
18496
|
+
kind: bm.FileRenamed,
|
|
18497
|
+
name: jm(e.destinationPath, e.destinationPath),
|
|
18433
18498
|
isFolder: e.nodeType === je.Folder
|
|
18434
18499
|
});
|
|
18435
18500
|
}
|
|
@@ -18468,7 +18533,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18468
18533
|
onCopyFiles: ae,
|
|
18469
18534
|
cancelCopyMove: A
|
|
18470
18535
|
};
|
|
18471
|
-
},
|
|
18536
|
+
}, dg = ({ filesApi: e, bucket: t, rootLabel: n, bumpRetry: r, onNotification: i }) => {
|
|
18472
18537
|
let [a, o] = R(!1), [s, c] = R(!1);
|
|
18473
18538
|
return {
|
|
18474
18539
|
isUnsharing: a,
|
|
@@ -18480,7 +18545,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18480
18545
|
let r = e.bucket ?? t;
|
|
18481
18546
|
return {
|
|
18482
18547
|
bucket: r,
|
|
18483
|
-
path:
|
|
18548
|
+
path: Km(e, r, n)
|
|
18484
18549
|
};
|
|
18485
18550
|
});
|
|
18486
18551
|
try {
|
|
@@ -18508,7 +18573,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18508
18573
|
let r = e.bucket ?? t;
|
|
18509
18574
|
return {
|
|
18510
18575
|
bucket: r,
|
|
18511
|
-
path:
|
|
18576
|
+
path: Km(e, r, n)
|
|
18512
18577
|
};
|
|
18513
18578
|
});
|
|
18514
18579
|
try {
|
|
@@ -18530,18 +18595,18 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18530
18595
|
r
|
|
18531
18596
|
])
|
|
18532
18597
|
};
|
|
18533
|
-
},
|
|
18534
|
-
let t = e.slice(0,
|
|
18598
|
+
}, fg = 5, pg = (e) => e.error ? `${e.path} (${e.error})` : e.path, mg = (e) => {
|
|
18599
|
+
let t = e.slice(0, fg);
|
|
18535
18600
|
return {
|
|
18536
|
-
names: t.map(
|
|
18601
|
+
names: t.map(pg),
|
|
18537
18602
|
restCount: e.length - t.length
|
|
18538
18603
|
};
|
|
18539
|
-
},
|
|
18604
|
+
}, hg = (e, t) => `${e}${t}/`, gg = (e) => /\.zip$/i.test(e), _g = (e) => {
|
|
18540
18605
|
let [t] = e;
|
|
18541
|
-
if (!(e.length !== 1 || t == null)) return
|
|
18542
|
-
},
|
|
18606
|
+
if (!(e.length !== 1 || t == null)) return gg(t.fileContent.name) && !gg(t.name) ? t : void 0;
|
|
18607
|
+
}, vg = ({ filesApi: e, bucket: t, rootLabel: n, activeTab: r, cache: i, sharedRootMetaRef: a, invalidateFolders: o, bumpRetry: s, onNotification: c }) => {
|
|
18543
18608
|
let [l, u] = R(null), d = L(null), f = P((r, i, a) => {
|
|
18544
|
-
let l =
|
|
18609
|
+
let l = Wm(a, n);
|
|
18545
18610
|
u({
|
|
18546
18611
|
files: [{
|
|
18547
18612
|
id: `${Date.now()}-archive`,
|
|
@@ -18551,7 +18616,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18551
18616
|
isOpen: !0
|
|
18552
18617
|
}), (async () => {
|
|
18553
18618
|
try {
|
|
18554
|
-
let { results: n } = await e.uploadArchive(r, t,
|
|
18619
|
+
let { results: n } = await e.uploadArchive(r, t, hg(l, i)), a = n.filter((e) => e.success).length, o = n.filter((e) => !e.success), s = o.length, { names: u, restCount: d } = mg(o);
|
|
18555
18620
|
n.length > 0 && a === 0 ? c?.({
|
|
18556
18621
|
variant: z.Error,
|
|
18557
18622
|
reason: $.UploadArchiveFailed,
|
|
@@ -18584,7 +18649,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18584
18649
|
return {
|
|
18585
18650
|
onUploadFiles: P((l, p) => {
|
|
18586
18651
|
if (l.length === 0) return;
|
|
18587
|
-
let m =
|
|
18652
|
+
let m = _g(l);
|
|
18588
18653
|
if (m != null) {
|
|
18589
18654
|
f(m.fileContent, m.name, p);
|
|
18590
18655
|
return;
|
|
@@ -18598,7 +18663,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18598
18663
|
})),
|
|
18599
18664
|
isOpen: !0
|
|
18600
18665
|
});
|
|
18601
|
-
let g =
|
|
18666
|
+
let g = Wm(p, n), { bucket: _, path: v } = r === B.Shared ? Vm(g, a.current, t) : {
|
|
18602
18667
|
bucket: t,
|
|
18603
18668
|
path: g
|
|
18604
18669
|
}, b = new Set((i.get(g) ?? []).map((e) => e.name.toLowerCase()));
|
|
@@ -18607,31 +18672,31 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18607
18672
|
for (; t < l.length;) {
|
|
18608
18673
|
let n = t++, a = l[n];
|
|
18609
18674
|
if (h.signal.aborted) {
|
|
18610
|
-
u((e) =>
|
|
18675
|
+
u((e) => $m(e, n, y.Cancelled));
|
|
18611
18676
|
continue;
|
|
18612
18677
|
}
|
|
18613
|
-
u((e) =>
|
|
18678
|
+
u((e) => $m(e, n, {
|
|
18614
18679
|
status: y.Uploading,
|
|
18615
18680
|
percent: 0
|
|
18616
18681
|
}));
|
|
18617
|
-
let o = b.has(a.name.toLowerCase()) ?
|
|
18682
|
+
let o = b.has(a.name.toLowerCase()) ? vm.Overwrite : vm.CreateOnly;
|
|
18618
18683
|
try {
|
|
18619
18684
|
await e.uploadFile(_, `${v}${a.name}`, a.fileContent, {
|
|
18620
18685
|
signal: h.signal,
|
|
18621
18686
|
uploadMode: o,
|
|
18622
18687
|
onProgress: (e) => {
|
|
18623
|
-
u((t) =>
|
|
18688
|
+
u((t) => $m(t, n, {
|
|
18624
18689
|
status: y.Uploading,
|
|
18625
18690
|
percent: e
|
|
18626
18691
|
}));
|
|
18627
18692
|
}
|
|
18628
|
-
}), u((e) =>
|
|
18693
|
+
}), u((e) => $m(e, n, {
|
|
18629
18694
|
status: y.Completed,
|
|
18630
18695
|
percent: 100
|
|
18631
18696
|
})), r += 1;
|
|
18632
18697
|
} catch {
|
|
18633
18698
|
let e = h.signal.aborted ? y.Cancelled : y.Failed;
|
|
18634
|
-
e === y.Failed && (i += 1), u((t) =>
|
|
18699
|
+
e === y.Failed && (i += 1), u((t) => $m(t, n, e));
|
|
18635
18700
|
}
|
|
18636
18701
|
}
|
|
18637
18702
|
};
|
|
@@ -18660,7 +18725,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18660
18725
|
f(e, t, n);
|
|
18661
18726
|
}, [f]),
|
|
18662
18727
|
onValidateUpload: P(async (e, t, n) => {
|
|
18663
|
-
for (let t of e) t.name =
|
|
18728
|
+
for (let t of e) t.name = sg(t.name);
|
|
18664
18729
|
return { valid: !0 };
|
|
18665
18730
|
}, []),
|
|
18666
18731
|
uploadBatchState: l,
|
|
@@ -18671,14 +18736,14 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18671
18736
|
u(null);
|
|
18672
18737
|
}, [])
|
|
18673
18738
|
};
|
|
18674
|
-
},
|
|
18675
|
-
let m = c ??
|
|
18739
|
+
}, yg = ({ filesApi: e, bucket: t, rootLabel: n = "My files", activeTab: r = B.MyFiles, onNotification: i, onOperationSuccess: a, forbiddenSymbolsRegExp: o, variant: s = _.Attach, actionProfile: c, labels: l, locale: u, disabledNewButtonTooltip: d, downloadDestination: f, buildValidationErrorMessage: p }) => {
|
|
18740
|
+
let m = c ?? Om(s), h = cg({
|
|
18676
18741
|
filesApi: e,
|
|
18677
18742
|
bucket: t,
|
|
18678
18743
|
rootLabel: n,
|
|
18679
18744
|
activeTab: r,
|
|
18680
18745
|
onNotification: i
|
|
18681
|
-
}), v =
|
|
18746
|
+
}), v = vg({
|
|
18682
18747
|
filesApi: e,
|
|
18683
18748
|
bucket: t,
|
|
18684
18749
|
rootLabel: n,
|
|
@@ -18688,7 +18753,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18688
18753
|
invalidateFolders: h.invalidateFolders,
|
|
18689
18754
|
bumpRetry: h.bumpRetry,
|
|
18690
18755
|
onNotification: i
|
|
18691
|
-
}), y =
|
|
18756
|
+
}), y = ug({
|
|
18692
18757
|
filesApi: e,
|
|
18693
18758
|
bucket: t,
|
|
18694
18759
|
rootLabel: n,
|
|
@@ -18705,27 +18770,27 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18705
18770
|
onOperationSuccess: a,
|
|
18706
18771
|
downloadDestination: f,
|
|
18707
18772
|
forbiddenSymbolsRegExp: o
|
|
18708
|
-
}), b =
|
|
18773
|
+
}), b = dg({
|
|
18709
18774
|
filesApi: e,
|
|
18710
18775
|
bucket: t,
|
|
18711
18776
|
rootLabel: n,
|
|
18712
18777
|
bumpRetry: h.bumpRetry,
|
|
18713
18778
|
onNotification: i
|
|
18714
|
-
}), x =
|
|
18779
|
+
}), x = lg({
|
|
18715
18780
|
filesApi: e,
|
|
18716
18781
|
bucket: t,
|
|
18717
18782
|
rootLabel: n,
|
|
18718
18783
|
onNotification: i
|
|
18719
|
-
}), S =
|
|
18784
|
+
}), S = Pm(h.currentFolder), C = I(() => r === B.Organization || r === B.Shared && h.folderPath === "" ? !1 : S, [
|
|
18720
18785
|
r,
|
|
18721
18786
|
h.folderPath,
|
|
18722
18787
|
S
|
|
18723
|
-
]), w = I(() => r === B.Shared ?
|
|
18788
|
+
]), w = I(() => r === B.Shared ? Em : Tm, [r]), T = I(() => {
|
|
18724
18789
|
let e = {}, t = (t) => {
|
|
18725
18790
|
let n = l[t];
|
|
18726
18791
|
n != null && (e[t] = n);
|
|
18727
18792
|
};
|
|
18728
|
-
return t(Xe.Download), r === B.MyFiles ? (t(Xe.Delete), C && (t(Xe.Rename),
|
|
18793
|
+
return t(Xe.Download), r === B.MyFiles ? (t(Xe.Delete), C && (t(Xe.Rename), Im(m) && (t(Xe.Copy), t(Xe.Move), t(Xe.Duplicate))), Lm(m) && t(Xe.RemoveAccess)) : r === B.Shared && Lm(m) && t(Xe.Unshare), m === g.Full && t(Xe.Info), e;
|
|
18729
18794
|
}, [
|
|
18730
18795
|
r,
|
|
18731
18796
|
C,
|
|
@@ -18789,7 +18854,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18789
18854
|
disabledNewButtonTooltip: d,
|
|
18790
18855
|
visibleColumns: w,
|
|
18791
18856
|
dateLocale: u,
|
|
18792
|
-
dateOptions:
|
|
18857
|
+
dateOptions: wm,
|
|
18793
18858
|
actionLabels: T,
|
|
18794
18859
|
sharedWithMeIds: h.sharedWithMeIds,
|
|
18795
18860
|
sharedByMePaths: h.sharedByMePaths,
|
|
@@ -18803,30 +18868,30 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18803
18868
|
clearMetadata: x.clearMetadata,
|
|
18804
18869
|
isAnyOperationInProgress: E
|
|
18805
18870
|
};
|
|
18806
|
-
},
|
|
18871
|
+
}, bg = [
|
|
18807
18872
|
B.MyFiles,
|
|
18808
18873
|
B.Shared,
|
|
18809
18874
|
B.Organization
|
|
18810
|
-
],
|
|
18875
|
+
], xg = (e, t, n, r) => {
|
|
18811
18876
|
let i = P((e) => r == null || r.includes(e), [r]), a = I(() => n?.filter((e) => i(e.id)).flatMap(({ id: e, label: t, disabled: n }) => typeof t == "string" ? [{
|
|
18812
18877
|
id: e,
|
|
18813
18878
|
label: t,
|
|
18814
18879
|
disabled: n
|
|
18815
18880
|
}] : []), [n, i]);
|
|
18816
18881
|
return F(() => {
|
|
18817
|
-
i(e) || t(
|
|
18882
|
+
i(e) || t(bg.find((e) => i(e)) ?? B.MyFiles);
|
|
18818
18883
|
}, [
|
|
18819
18884
|
i,
|
|
18820
18885
|
e,
|
|
18821
18886
|
t
|
|
18822
18887
|
]), { tabs: a };
|
|
18823
|
-
},
|
|
18888
|
+
}, Sg = "custom_app", Cg = (e) => !!e && e.id === Sg, wg = (e) => !!e && (!!e.id?.endsWith("quickapps2") || e.displayName === "Quick app 2.0"), Tg = () => {
|
|
18824
18889
|
try {
|
|
18825
18890
|
return Intl.DateTimeFormat().resolvedOptions().timeZone || void 0;
|
|
18826
18891
|
} catch {
|
|
18827
18892
|
return;
|
|
18828
18893
|
}
|
|
18829
|
-
},
|
|
18894
|
+
}, Eg = (e) => {
|
|
18830
18895
|
let t = e.trim();
|
|
18831
18896
|
if (!t || !/^https?:\/\//.test(t)) return !1;
|
|
18832
18897
|
try {
|
|
@@ -18834,39 +18899,39 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18834
18899
|
} catch {
|
|
18835
18900
|
return !1;
|
|
18836
18901
|
}
|
|
18837
|
-
},
|
|
18902
|
+
}, Dg = (e) => {
|
|
18838
18903
|
let t = e.trim();
|
|
18839
18904
|
if (t) try {
|
|
18840
18905
|
return JSON.parse(t);
|
|
18841
18906
|
} catch {
|
|
18842
18907
|
return;
|
|
18843
18908
|
}
|
|
18844
|
-
},
|
|
18909
|
+
}, Og = ["rate_endpoint", "configuration_endpoint"], kg = (e) => {
|
|
18845
18910
|
let t = e.trim();
|
|
18846
18911
|
if (!t) return !0;
|
|
18847
18912
|
try {
|
|
18848
18913
|
let e = JSON.parse(t);
|
|
18849
18914
|
if (typeof e != "object" || !e || Array.isArray(e)) return !1;
|
|
18850
18915
|
let n = Object.keys(e);
|
|
18851
|
-
return n.length > 0 && n.every((e) =>
|
|
18916
|
+
return n.length > 0 && n.every((e) => Og.includes(e));
|
|
18852
18917
|
} catch {
|
|
18853
18918
|
return !1;
|
|
18854
18919
|
}
|
|
18855
|
-
},
|
|
18856
|
-
let t = e.indexOf(
|
|
18920
|
+
}, Ag = "/external_services/", jg = (e) => {
|
|
18921
|
+
let t = e.indexOf(Ag);
|
|
18857
18922
|
if (t === -1) return null;
|
|
18858
18923
|
let n = e.slice(0, t), r = e.slice(t + 19);
|
|
18859
18924
|
return !n || !r ? null : {
|
|
18860
18925
|
appId: n,
|
|
18861
18926
|
serviceName: r
|
|
18862
18927
|
};
|
|
18863
|
-
},
|
|
18928
|
+
}, Mg = (e, t) => `${e}${Ag}${t}`, Ng = (e) => {
|
|
18864
18929
|
try {
|
|
18865
18930
|
return decodeURIComponent(e);
|
|
18866
18931
|
} catch {
|
|
18867
18932
|
return e;
|
|
18868
18933
|
}
|
|
18869
|
-
},
|
|
18934
|
+
}, Pg = {
|
|
18870
18935
|
settings: "Settings",
|
|
18871
18936
|
savedNotification: "Chat settings have been saved",
|
|
18872
18937
|
responseFormatLabel: "Response format",
|
|
@@ -18882,11 +18947,11 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18882
18947
|
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.",
|
|
18883
18948
|
saveLabel: "Apply changes",
|
|
18884
18949
|
saveDisabledTooltip: "Please select a response format"
|
|
18885
|
-
},
|
|
18950
|
+
}, Fg = (e) => (e ?? "").toLowerCase().replace(/[^a-z]/g, "") === "plaintext" ? T.PlainText : T.Markdown, Ig = (e) => {
|
|
18886
18951
|
let t = I(() => ({
|
|
18887
|
-
...
|
|
18952
|
+
...Pg,
|
|
18888
18953
|
...e.labels
|
|
18889
|
-
}), [e.labels]), { onSaved: n } = e, r = e.mode === "local" ? e.values.responseFormat :
|
|
18954
|
+
}), [e.labels]), { onSaved: n } = e, r = e.mode === "local" ? e.values.responseFormat : Fg(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 = P((t) => {
|
|
18890
18955
|
e.mode === "local" ? e.onValuesChange({
|
|
18891
18956
|
responseFormat: t.responseFormat ?? e.values.responseFormat,
|
|
18892
18957
|
systemPrompt: t.systemPrompt ?? e.values.systemPrompt,
|
|
@@ -18934,7 +18999,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18934
18999
|
i,
|
|
18935
19000
|
a
|
|
18936
19001
|
]);
|
|
18937
|
-
},
|
|
19002
|
+
}, Lg = (e = !0, t = !0) => {
|
|
18938
19003
|
let [n, r] = R(!1), [i, a] = R([]), o = L(0), s = L(e), c = L(t);
|
|
18939
19004
|
ve(() => {
|
|
18940
19005
|
s.current = e, c.current = t, t || (o.current = 0, r(!1));
|
|
@@ -18963,20 +19028,20 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18963
19028
|
pendingFiles: i,
|
|
18964
19029
|
onFilesConsumed: l
|
|
18965
19030
|
};
|
|
18966
|
-
},
|
|
18967
|
-
let [e, t] = R(
|
|
19031
|
+
}, Rg = () => typeof window < "u" ? window.innerWidth : 1024, zg = () => {
|
|
19032
|
+
let [e, t] = R(Rg);
|
|
18968
19033
|
return F(() => {
|
|
18969
19034
|
if (typeof window > "u") return;
|
|
18970
19035
|
let e = () => t(window.innerWidth);
|
|
18971
19036
|
return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
18972
19037
|
}, []), e;
|
|
18973
|
-
},
|
|
18974
|
-
let t =
|
|
19038
|
+
}, Bg = (e) => {
|
|
19039
|
+
let t = zg();
|
|
18975
19040
|
return Math.max(0, t - e);
|
|
18976
|
-
},
|
|
19041
|
+
}, Vg = (e) => e.map((e) => e === Pe.Edit ? V.Edit : V.View), Hg = (e, t) => {
|
|
18977
19042
|
let n = new URL(e, t);
|
|
18978
19043
|
return `${t}${n.pathname}${n.search}${n.hash}`;
|
|
18979
|
-
},
|
|
19044
|
+
}, Ug = (e, t, n = window.location.origin) => {
|
|
18980
19045
|
let [r, i] = R(), [a, o] = R(!0), [s, c] = R(null), l = L(0), u = P(async (r = [V.View]) => {
|
|
18981
19046
|
let a = ++l.current;
|
|
18982
19047
|
o(!0), c(null);
|
|
@@ -18986,9 +19051,9 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
18986
19051
|
access: r
|
|
18987
19052
|
} });
|
|
18988
19053
|
l.current === a && i({
|
|
18989
|
-
url:
|
|
19054
|
+
url: Hg(o.url, n),
|
|
18990
19055
|
expiresInDays: o.expiresInDays,
|
|
18991
|
-
access:
|
|
19056
|
+
access: Vg(o.access)
|
|
18992
19057
|
});
|
|
18993
19058
|
} catch (e) {
|
|
18994
19059
|
l.current === a && c(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to create share link"));
|
|
@@ -19010,18 +19075,18 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
19010
19075
|
u(e);
|
|
19011
19076
|
}, [u])
|
|
19012
19077
|
};
|
|
19013
|
-
},
|
|
19078
|
+
}, Wg = (e) => e.type === "boolean" || e.type == null && typeof e.default == "boolean", Gg = (e) => {
|
|
19014
19079
|
let t = e.replace(/[_-]+/g, " ").trim();
|
|
19015
19080
|
return t.length === 0 ? e : t.charAt(0).toUpperCase() + t.slice(1);
|
|
19016
|
-
},
|
|
19081
|
+
}, Kg = (e) => {
|
|
19017
19082
|
let t = e?.properties;
|
|
19018
|
-
return t == null ? [] : Object.entries(t).filter(([, e]) =>
|
|
19083
|
+
return t == null ? [] : Object.entries(t).filter(([, e]) => Wg(e)).map(([e, t]) => ({
|
|
19019
19084
|
id: e,
|
|
19020
|
-
label: typeof t.title == "string" && t.title.length > 0 ? t.title :
|
|
19085
|
+
label: typeof t.title == "string" && t.title.length > 0 ? t.title : Gg(e),
|
|
19021
19086
|
defaultValue: t.default === !0
|
|
19022
19087
|
}));
|
|
19023
|
-
},
|
|
19024
|
-
let { selectedItemId: t, selectedDeploymentConfiguration: n, toolIcon: r } = e, i = I(() =>
|
|
19088
|
+
}, qg = (e) => {
|
|
19089
|
+
let { selectedItemId: t, selectedDeploymentConfiguration: n, toolIcon: r } = e, i = I(() => Kg(n), [n]), a = I(() => Object.fromEntries(i.map(({ id: e, defaultValue: t }) => [e, t])), [i]), [o, s] = R(a), c = JSON.stringify(a), l = L(a);
|
|
19025
19090
|
l.current = a, F(() => {
|
|
19026
19091
|
s(l.current);
|
|
19027
19092
|
}, [t, c]);
|
|
@@ -19055,7 +19120,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
19055
19120
|
toolConfigurationValue: I(() => Object.fromEntries(i.map(({ id: e }) => [e, o[e] ?? !1])), [i, o]),
|
|
19056
19121
|
restoreToolConfiguration: d
|
|
19057
19122
|
};
|
|
19058
|
-
},
|
|
19123
|
+
}, Jg = (e) => e instanceof Error ? e : Error(String(e)), Yg = (e, t = !0) => {
|
|
19059
19124
|
let [n, r] = R(), [i, a] = R(t), [o, s] = R();
|
|
19060
19125
|
return F(() => {
|
|
19061
19126
|
if (!t) {
|
|
@@ -19070,7 +19135,7 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
19070
19135
|
r(t);
|
|
19071
19136
|
} catch (e) {
|
|
19072
19137
|
if (n) return;
|
|
19073
|
-
s(
|
|
19138
|
+
s(Jg(e));
|
|
19074
19139
|
} finally {
|
|
19075
19140
|
n || a(!1);
|
|
19076
19141
|
}
|
|
@@ -19084,4 +19149,4 @@ var dh = (e) => !oh.has(e), fh = (e) => e && e === Math.floor(e) && e > 0 && isF
|
|
|
19084
19149
|
};
|
|
19085
19150
|
};
|
|
19086
19151
|
//#endregion
|
|
19087
|
-
export { Xt as AttachmentValidationErrorReason, In as AuthenticationType,
|
|
19152
|
+
export { Xt as AttachmentValidationErrorReason, In as AuthenticationType, Tm as COLUMNS_WITHOUT_AUTHOR, Em as COLUMNS_WITH_AUTHOR, Dm as CORE_PERMISSION_MAP, Xc as CatalogPrimaryActionType, en as ConversationExportMode, u as ConversationTransferErrorCode, h as ConversationTransferWarningCode, wm as DATE_OPTIONS, hp as DEFAULT_MAX_ARCHIVE_BYTES, g as DialFileManagerActionProfile, _ as DialFileManagerVariant, vm as DialFilesApiUploadMode, rg as DownloadDestinationType, nn as EXPORT_APP_NAME, tn as ExportFileNameKind, ol as FavoriteEntityType, $ as FileManagerNotificationReason, ym as FileNameValidationErrorReason, bm as FileOperationKind, Mc as McpResourceKind, xd as OAuthResourceKind, Cm as PATH_SEPARATOR_REGEXP, of as PROMPT_CONTENT_MAX_LENGTH, sf as PROMPT_COUNTER_ANNOUNCE_THRESHOLD, af as PROMPT_DESCRIPTION_MAX_LENGTH, rf as PROMPT_NAME_MAX_LENGTH, dc as PUBLIC_SKILL_BUCKET, tf as PromptFieldError, Yr as PromptSource, Sm as RESERVED_MARKER_NAME, Vf as RecipientsCountStatus, Ks as SKILL_FILE_UPLOAD_MAX_BYTES, hc as SKILL_LISTING_MAX_PAGES, mc as SKILL_LISTING_PAGE_SIZE, Gs as SKILL_MANIFEST_FILE, pc as SKILL_MANIFEST_MAX_BYTES, Js as SKILL_UPLOAD_MAX_FILES, qs as SKILL_UPLOAD_MAX_TOTAL_BYTES, kf as SkillEditorLoadState, Rf as SkillPreviewErrorKind, uc as SkillSource, Ed as TOOLSET_REDIRECT_STATE_KEY, vd as ToolsetAuthStatus, _d as ToolsetAuthTypes, yd as ToolsetCredentialsLevel, Jd as ToolsetLoginOutcomeType, Td as ToolsetOAuthCallbackQuery, wd as ToolsetOAuthChannelControlType, Cd as ToolsetOAuthFailureReason, Sd as ToolsetOAuthInitiationResultType, Q as ToolsetOAuthResultType, xm as UPLOAD_CONCURRENCY, mf as UnsupportedTriggerReason, bd as WithLogin, Zh as annotationToDisplayAttachment, Hh as annotationToPdfCanvasContent, hf as apSchedulerDayToJsDay, or as appendLocaleCode, Xh as attachmentDtoToDisplayAttachment, Qh as attachmentDtosToDisplayAttachments, Dp as attachmentToDto, Op as attachmentsToDtos, lr as buildAdditionalLocaleOptions, Ru as buildAnnouncementSignature, Lc as buildApplicationMcpUrl, jn as buildChatCompletionsUrl, Bc as buildConnectApi, Nn as buildDeploymentConnectApi, Mg as buildExternalServiceScopeId, Zm as buildFromCache, Zd as buildPromptExportEnvelope, ef as buildPromptExportFileName, ei as buildPromptOverview, ff as buildPromptPath, Mn as buildResponsesUrl, Bm as buildSharedItemVirtualPath, kc as buildSkillContentTree, lc as buildSkillFilesPayload, tc as buildSkillManifest, cc as buildSkillManifestForSubmit, nc as buildSkillManifestFromFrontmatter, Ec as buildSkillOverview, gd as buildToolsetAuthorizeUrl, Ic as buildToolsetMcpUrl, Ah as clearAttachmentCache, sr as composeLocalePayload, Vu as createChatStreamApi, xt as createCsrfMiddleware, td as createDeploymentChangedMessage, ah as createFilesApiClient, kp as createMessagePair, Dn as createPublishApiClient, Tt as createUnauthorizedMiddleware, oh as createUploadFileWithProgress, nr as decodeToolsetId, cr as decomposeLocalizedFields, Om as deriveActionProfile, Jc as deriveAvailableTabIds, Wf as deriveConversationRowActionState, qc as deriveFavoriteItems, zm as dialCorePathToRelative, eg as dialFileToAttachment, tg as dialFilesToAttachments, ng as dialFolderPathToAttachment, Nt as downloadAttachment, Kd as emitToolsetLoginSuccess, Pn as encodeDeploymentId, tr as encodeToolsetId, eh as fetchByTab, th as fetchForSearch, Gc as filterCatalogItemsBySelector, Kc as filterHiddenOwnedItems, Fn as findDeploymentByIdOrReference, Fm as findDialFileByPath, Xm as findFirstSuccessfulCopyMoveItem, Nm as findFolderByVirtualPath, Gu as formatAppVersion, dr as formatCalendarDate, $t as formatDateYM, Qt as formatDateYMD, Mm as formatOperationFolderName, Sn as formatQuotedNameList, bt as getApiErrorDetails, yt as getApiErrorMessage, vt as getApiErrorStatus, Tg as getBrowserTimezone, Pp as getConversationPath, Jf as getConversationSource, Ng as getExternalServiceFallbackName, rd as getLastDeploymentId, ad as getLastUserMessageToolConfiguration, $u as getModelIdFromConversationId, oe as getParentFolderPath, ud as getQuickAppConversationStarters, df as getRemainingCharacters, Mp as getStarterConversationText, dd as getStarterPopulateText, Np as getStarterSubmitText, fd as getStartersFromSchema, ed as getTimeOfDayGreeting, Od as getToolsetOAuthChannelName, pd as getToolsetRedirectUri, wh as getUrlFileName, jm as getVirtualPathName, Ap as hasActiveToolConfig, Lu as hasAnnouncementContent, Fh as hasAttachmentTextSource, Pm as hasDialFileWritePermission, km as hasForbiddenNameSymbols, Iu as hasStructuredAnnouncement, Et as includesIgnoreCase, Ld as initiateOAuthLogin, lm as isAwaitingGenerationResume, _t as isConversationNotFoundError, Im as isCopyMoveDuplicateAllowed, Cg as isCustomAppSchema, Gt as isDialFileAcceptType, kt as isDialFileId, Mt as isDownloadableAttachment, Dh as isExternalSourcePreviewable, jp as isMessageChanged, nd as isMessageStreaming, ti as isOrganisationPromptItem, rr as isPublicToolsetId, wg as isQuickAppSchema, Lm as isShareActionsAllowed, Eg as isValidAbsoluteUrl, kg as isValidFeaturesData, $s as isValidSkillRelativePath, gf as jsDayToApSchedulerDay, Ym as mapCorePermissions, Ir as mapDeploymentDetailsDtoToEntityDetails, Zn as mapDeploymentLimitsDtoToCatalogLimits, Qn as mapDeploymentLimitsToInput, qr as mapDeploymentToCatalogItem, zr as mapDeploymentToolsetCredentials, Or as mapEntityDetailsToCatalogDetails, rh as mapFileMetadataToDialFile, xf as mapFormValuesToCreateBody, Sf as mapFormValuesToUpdateBody, ni as mapPromptToCatalogItem, Wc as mapPublishConversationResultDto, Uc as mapPublishHistoryEntryDto, Ef as mapScheduledTaskDtoToFormValues, nh as mapSearchItem, yc as mapSkillToCatalogItem, Tr as mapToolsetCredentials, Jr as mapToolsetToCatalogItem, Qm as mergeCreatedFolderIntoCache, id as messageHasStages, Jt as mimeTypesToAttachmentExtensionLabels, Kt as mimeTypesToDialFileAcceptTypes, qt as mimeTypesToFileAccept, oc as nameFromPath, Id as navigateToolsetOAuthPopup, od as normalizeResponseFormat, ec as normalizeSkillName, Am as normalizeVirtualPath, sh as openAnnotationAttachment, Fd as openToolsetOAuthPopup, ur as padTwoDigits, jg as parseExternalServiceUrl, Dg as parseFeaturesData, Rm as parseNewFolderVirtualPath, Zr as parsePromptResourceUrl, ic as parseSkillManifest, rl as parseSkillManifestDocument, gc as parseSkillResourceUrl, qm as prepareCopyItems, ig as prepareDownloadDestination, Jm as prepareMoveRenameItems, Ac as readSkillFileBytes, jc as readSkillManifest, Yc as reconcileFilterTopics, Uh as referenceAttachmentToPdfCanvasContent, Zc as resolveCatalogPrimaryAction, Bh as resolveCodeCanvasContent, Gr as resolveDeploymentFolder, Km as resolveDialFileApiPath, jt as resolveDialFileBucketAndPath, Eh as resolveExternalSourceContentType, Vh as resolveHtmlCanvasContent, Ih as resolveImageCanvasContent, Jh as resolveJsonCanvasContent, ar as resolveLocalizedText, Rh as resolveMarkdownCanvasContent, zc as resolveMcpResourceKind, qh as resolveOoxmlCanvasContent, Vm as resolveOwnerCoords, Kh as resolvePdfCanvasContent, At as resolveRelativeDialFilePath, Tc as resolveSkillFileDownloadPath, Cc as resolveSkillManifestFileId, Lh as resolveTextCanvasContent, Yh as resolveVisualizerCanvasContent, H as safeDecodeURI, Dt as safeDecodeURIComponent, Nu as sanitizeAnnouncementHtml, Pu as sanitizeAnnouncementMessageHtml, sg as sanitizeFileName, Wu as sanitizeFooterHtml, Qd as serializePromptExport, Hu as shouldWatchForDisplayNameUpdate, sc as skillFileBytesToBlob, Of as skillFileToAttachment, ag as splitFileNameExtension, Ot as stripSurroundingSlashes, qd as subscribeToolsetLoginSuccess, ir as toBaseLocale, sd as toOverlayMessages, Hc as toPublishEntityType, En as toPublishRuleDto, og as trimFileNameToByteLimit, ac as unpackSkillArchive, $m as updateEntry, Gf as useActiveConversationSync, Kf as useAsyncConfirmDialog, It as useAttachmentAction, ep as useAttachmentUpload, Zt as useAttachmentValidation, al as useCatalogItemDetails, Ig as useChatSettingsFormConfig, Ep as useConversationExport, Fp as useConversationHandlers, Qp as useConversationImport, qf as useConversationLookupMaps, Yf as useConversationPanelItems, tm as useConversationScroll, _m as useConversationSources, hm as useConversationStream, cg as useDialFileListing, yg as useDialFileManager, xg as useDialFileManagerTabConfig, lg as useDialFileMetadata, ug as useDialFileMutations, dg as useDialFileSharing, vg as useDialFileUploadBatch, sl as useFavoriteEntitiesState, me as useGridEditingScroll, Xf as useImportFilePicker, Ud as useOAuthCallbackCompletion, Lg as usePageFileDrag, Bg as usePanelMaxWidth, pf as usePromptsState, dl as usePublishFolders, Ug as useShareLink, Uf as useShareRecipientsCount, Pf as useSkillEditorLoad, If as useSkillEditorSubmit, Lf as useSkillFileActions, zf as useSkillFilePreview, Bf as useSkillsState, qg as useToolsMenu, Yd as useToolsetLogin, Yg as useUsageData, zg as useViewportWidth, uf as validatePromptContent, lf as validatePromptDescription, cf as validatePromptName, Df as validateSkillFileBatch, Wm as virtualPathToApiPath, Nd as waitForToolsetOAuthResult };
|