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