@loomcycle/explorer 0.18.0 → 0.19.0
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/dist/components/DownloadMenu.d.ts +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +507 -480
- package/dist/index.js.map +1 -1
- package/dist/lib/download.d.ts +1 -1
- package/dist/lib/remarkBareBreak.d.ts +7 -0
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -89,7 +89,10 @@ function D(e) {
|
|
|
89
89
|
var O = 240, k = 2e3, A = [
|
|
90
90
|
"branch",
|
|
91
91
|
"document",
|
|
92
|
-
"path"
|
|
92
|
+
"path",
|
|
93
|
+
"scheme",
|
|
94
|
+
"concept",
|
|
95
|
+
"class"
|
|
93
96
|
];
|
|
94
97
|
function j(e) {
|
|
95
98
|
return typeof e == "string" && A.includes(e);
|
|
@@ -132,40 +135,40 @@ function I(e) {
|
|
|
132
135
|
return Number.isNaN(t) ? e : new Date(t).toLocaleString();
|
|
133
136
|
}
|
|
134
137
|
// src/lib/download.ts
|
|
135
|
-
function
|
|
138
|
+
function L(e) {
|
|
136
139
|
if (!e) return;
|
|
137
140
|
let t = /filename\*\s*=\s*([^']*)'[^']*'([^;]+)/i.exec(e);
|
|
138
141
|
if (t && /^utf-8$/i.test(t[1].trim())) try {
|
|
139
|
-
let e =
|
|
142
|
+
let e = re(decodeURIComponent(t[2].trim()));
|
|
140
143
|
if (e) return e;
|
|
141
144
|
} catch {}
|
|
142
145
|
let n = /(?:^|;)\s*filename\s*=\s*"((?:[^"\\]|\\.)*)"/i.exec(e);
|
|
143
|
-
if (n) return
|
|
146
|
+
if (n) return re(n[1].replace(/\\(.)/g, "$1")) || void 0;
|
|
144
147
|
let r = /(?:^|;)\s*filename\s*=\s*([^;\s"]+)/i.exec(e);
|
|
145
|
-
if (r) return
|
|
148
|
+
if (r) return re(r[1]) || void 0;
|
|
146
149
|
}
|
|
147
|
-
function
|
|
150
|
+
function re(e) {
|
|
148
151
|
return e.slice(Math.max(e.lastIndexOf("/"), e.lastIndexOf("\\")) + 1).trim();
|
|
149
152
|
}
|
|
150
|
-
function
|
|
153
|
+
function R(e, t, n = "") {
|
|
151
154
|
try {
|
|
152
155
|
let t = JSON.parse(e);
|
|
153
156
|
if (typeof t.error == "string" && t.error) return t.error;
|
|
154
157
|
} catch {}
|
|
155
158
|
return `${t} ${n}`.trim();
|
|
156
159
|
}
|
|
157
|
-
function
|
|
160
|
+
function z(e) {
|
|
158
161
|
return (e || "document").replace(/[^\w.-]+/g, "_");
|
|
159
162
|
}
|
|
160
|
-
function
|
|
163
|
+
function B(e, t) {
|
|
161
164
|
let n = URL.createObjectURL(e), r = document.createElement("a");
|
|
162
165
|
r.href = n, r.download = t, r.click(), setTimeout(() => URL.revokeObjectURL(n), 0);
|
|
163
166
|
}
|
|
164
167
|
// src/lib/dataLayer.tsx
|
|
165
|
-
var
|
|
166
|
-
function
|
|
168
|
+
var V = 4, H = 5e3;
|
|
169
|
+
function U(e, t, n) {
|
|
167
170
|
return {
|
|
168
|
-
...
|
|
171
|
+
...ae(e, n),
|
|
169
172
|
pathLs: (t, n, r, i, a) => e.path({
|
|
170
173
|
op: "ls",
|
|
171
174
|
path: t,
|
|
@@ -184,14 +187,14 @@ function H(e, t, n) {
|
|
|
184
187
|
}),
|
|
185
188
|
documentPath: async (t, n, r) => {
|
|
186
189
|
let i;
|
|
187
|
-
for (let a = 0; a <
|
|
190
|
+
for (let a = 0; a < V; a++) {
|
|
188
191
|
let a = await e.path({
|
|
189
192
|
op: "ls",
|
|
190
193
|
path: "/",
|
|
191
194
|
scope: n,
|
|
192
195
|
recursive: !0,
|
|
193
196
|
kind_filter: "document",
|
|
194
|
-
limit:
|
|
197
|
+
limit: H,
|
|
195
198
|
...i ? { cursor: i } : {}
|
|
196
199
|
}, r), o = (a.entries ?? []).find((e) => e.resource_ref?.document_id === t);
|
|
197
200
|
if (o) return o.full_path;
|
|
@@ -392,24 +395,24 @@ function H(e, t, n) {
|
|
|
392
395
|
return URL.createObjectURL(o);
|
|
393
396
|
},
|
|
394
397
|
documentExportFile: async (e, n, r, i, a) => {
|
|
395
|
-
let o = await t(
|
|
396
|
-
if (!o.ok) throw Error(
|
|
398
|
+
let o = await t(ie(e, n, r, i, a));
|
|
399
|
+
if (!o.ok) throw Error(R(await o.text(), o.status, o.statusText));
|
|
397
400
|
return {
|
|
398
401
|
blob: await o.blob(),
|
|
399
|
-
filename:
|
|
402
|
+
filename: L(o.headers.get("Content-Disposition")) ?? ""
|
|
400
403
|
};
|
|
401
404
|
}
|
|
402
405
|
} : {}
|
|
403
406
|
};
|
|
404
407
|
}
|
|
405
|
-
function
|
|
408
|
+
function ie(e, t, n, r, i) {
|
|
406
409
|
let a = new URLSearchParams({
|
|
407
410
|
format: n,
|
|
408
411
|
scope: t
|
|
409
412
|
});
|
|
410
413
|
return r?.scopeId && a.set("scope_id", r.scopeId), r?.tenant && a.set("tenant", r.tenant), i?.chunk && a.set("chunk", i.chunk), i?.toc && a.set("toc", "true"), i?.titlePage && a.set("title_page", "true"), i?.pageSize && a.set("page_size", i.pageSize), i?.language && a.set("language", i.language), i?.provenance === !1 && a.set("provenance", "false"), `/v1/_document/export/${encodeURIComponent(e)}?${a.toString()}`;
|
|
411
414
|
}
|
|
412
|
-
function
|
|
415
|
+
function ae(e, t) {
|
|
413
416
|
let n = e, r = (e) => e?.tenant ? `?tenant=${encodeURIComponent(e.tenant)}` : "", i = {};
|
|
414
417
|
typeof n.ruleStatements == "function" ? i.documentRuleStatements = (e, t) => n.ruleStatements(e.action, e.ids ? { ids: e.ids } : { filter: e.filter }, {
|
|
415
418
|
reason: e.reason,
|
|
@@ -434,35 +437,35 @@ function oe(e, t) {
|
|
|
434
437
|
});
|
|
435
438
|
}), i;
|
|
436
439
|
}
|
|
437
|
-
var
|
|
438
|
-
function
|
|
439
|
-
return /* @__PURE__ */ u(
|
|
440
|
+
var W = e(null);
|
|
441
|
+
function oe({ value: e, children: t }) {
|
|
442
|
+
return /* @__PURE__ */ u(W.Provider, {
|
|
440
443
|
value: e,
|
|
441
444
|
children: t
|
|
442
445
|
});
|
|
443
446
|
}
|
|
444
|
-
function
|
|
445
|
-
let e = n(
|
|
447
|
+
function se() {
|
|
448
|
+
let e = n(W);
|
|
446
449
|
if (!e) throw Error("useExplorerData must be used within <PathExplorer> or <DocumentViewer> (no ExplorerDataLayer in context)");
|
|
447
450
|
return e;
|
|
448
451
|
}
|
|
449
|
-
var
|
|
450
|
-
function
|
|
452
|
+
var G = 5e3;
|
|
453
|
+
function ce(e) {
|
|
451
454
|
return e === "" ? "/" : e;
|
|
452
455
|
}
|
|
453
|
-
function
|
|
456
|
+
function le(e) {
|
|
454
457
|
let t = e.lastIndexOf("/");
|
|
455
458
|
return t <= 0 ? "" : e.slice(0, t);
|
|
456
459
|
}
|
|
457
|
-
function
|
|
460
|
+
function ue(e) {
|
|
458
461
|
let t = [""], n = e.split("/").filter(Boolean), r = "";
|
|
459
462
|
for (let e = 0; e < n.length - 1; e++) r = `${r}/${n[e]}`, t.push(r);
|
|
460
463
|
return t;
|
|
461
464
|
}
|
|
462
|
-
function
|
|
465
|
+
function de(e) {
|
|
463
466
|
return e instanceof Error ? e.message : String(e);
|
|
464
467
|
}
|
|
465
|
-
function
|
|
468
|
+
function fe(e, t) {
|
|
466
469
|
return {
|
|
467
470
|
entries: [...t, ...e.entries ?? []],
|
|
468
471
|
nextCursor: e.next_cursor || void 0,
|
|
@@ -470,7 +473,7 @@ function pe(e, t) {
|
|
|
470
473
|
loading: !1
|
|
471
474
|
};
|
|
472
475
|
}
|
|
473
|
-
var
|
|
476
|
+
var pe = class {
|
|
474
477
|
data;
|
|
475
478
|
scope;
|
|
476
479
|
browse;
|
|
@@ -504,7 +507,7 @@ var me = class {
|
|
|
504
507
|
}
|
|
505
508
|
reload(e) {
|
|
506
509
|
let t = this.dirs.get(e), n = t?.entries.length ?? 0, r = t?.loaded && !t.nextCursor ? n + this.pageLimit : n;
|
|
507
|
-
return this.fetchFirst(e, Math.min(
|
|
510
|
+
return this.fetchFirst(e, Math.min(G, Math.max(this.pageLimit, r)));
|
|
508
511
|
}
|
|
509
512
|
fetchFirst(e, t) {
|
|
510
513
|
let n = (this.epoch.get(e) ?? 0) + 1;
|
|
@@ -516,15 +519,15 @@ var me = class {
|
|
|
516
519
|
loaded: r?.loaded ?? !1,
|
|
517
520
|
loading: !0
|
|
518
521
|
});
|
|
519
|
-
let i = this.data.pathLs(
|
|
520
|
-
this.epoch.get(e) === n && this.set(e,
|
|
522
|
+
let i = this.data.pathLs(ce(e), this.scope, !1, this.browse, { limit: t }).then((t) => {
|
|
523
|
+
this.epoch.get(e) === n && this.set(e, fe(t, []));
|
|
521
524
|
}, (t) => {
|
|
522
525
|
throw this.epoch.get(e) === n && this.set(e, {
|
|
523
526
|
entries: r?.entries ?? [],
|
|
524
527
|
nextCursor: r?.nextCursor,
|
|
525
528
|
loaded: r?.loaded ?? !1,
|
|
526
529
|
loading: !1,
|
|
527
|
-
error:
|
|
530
|
+
error: de(t)
|
|
528
531
|
}), t;
|
|
529
532
|
});
|
|
530
533
|
return this.track(e, i);
|
|
@@ -540,16 +543,16 @@ var me = class {
|
|
|
540
543
|
loading: !0,
|
|
541
544
|
error: void 0
|
|
542
545
|
});
|
|
543
|
-
let i = this.data.pathLs(
|
|
546
|
+
let i = this.data.pathLs(ce(e), this.scope, !1, this.browse, {
|
|
544
547
|
limit: this.pageLimit,
|
|
545
548
|
cursor: n.nextCursor
|
|
546
549
|
}).then((t) => {
|
|
547
|
-
this.epoch.get(e) === r && this.set(e,
|
|
550
|
+
this.epoch.get(e) === r && this.set(e, fe(t, n.entries));
|
|
548
551
|
}, (t) => {
|
|
549
552
|
throw this.epoch.get(e) === r && this.set(e, {
|
|
550
553
|
...n,
|
|
551
554
|
loading: !1,
|
|
552
|
-
error:
|
|
555
|
+
error: de(t)
|
|
553
556
|
}), t;
|
|
554
557
|
});
|
|
555
558
|
return this.track(e, i);
|
|
@@ -575,7 +578,7 @@ var me = class {
|
|
|
575
578
|
for (let t of [...this.dirs.keys()]) (t === e || t.startsWith(`${e}/`)) && (this.dirs.delete(t), this.epoch.set(t, (this.epoch.get(t) ?? 0) + 1), this.inflight.delete(t));
|
|
576
579
|
this.publish();
|
|
577
580
|
}
|
|
578
|
-
let n =
|
|
581
|
+
let n = ue(e).filter((e) => this.dirs.has(e));
|
|
579
582
|
await Promise.all(n.map((e) => this.reload(e)));
|
|
580
583
|
}
|
|
581
584
|
async refresh(e) {
|
|
@@ -587,11 +590,11 @@ var me = class {
|
|
|
587
590
|
await Promise.all(n.map((e) => this.reload(e)));
|
|
588
591
|
}
|
|
589
592
|
};
|
|
590
|
-
async function
|
|
593
|
+
async function me(e, t, n, r) {
|
|
591
594
|
let i = [], a;
|
|
592
595
|
for (;;) {
|
|
593
|
-
let o = await e.pathLs(
|
|
594
|
-
limit:
|
|
596
|
+
let o = await e.pathLs(ce(t), n, !0, r, {
|
|
597
|
+
limit: G,
|
|
595
598
|
cursor: a
|
|
596
599
|
});
|
|
597
600
|
i.push(...o.entries ?? []);
|
|
@@ -600,7 +603,7 @@ async function he(e, t, n, r) {
|
|
|
600
603
|
a = s;
|
|
601
604
|
}
|
|
602
605
|
}
|
|
603
|
-
function
|
|
606
|
+
function he(e) {
|
|
604
607
|
let t = [];
|
|
605
608
|
for (let n of e) {
|
|
606
609
|
if (n.kind !== "document") continue;
|
|
@@ -610,7 +613,7 @@ function ge(e) {
|
|
|
610
613
|
return t;
|
|
611
614
|
}
|
|
612
615
|
// src/lib/createClient.ts
|
|
613
|
-
function
|
|
616
|
+
function ge(e) {
|
|
614
617
|
let t = e.fetch;
|
|
615
618
|
return new f({
|
|
616
619
|
baseUrl: e.baseUrl,
|
|
@@ -618,21 +621,21 @@ function _e(e) {
|
|
|
618
621
|
fetch: (e, n) => t ? t(e, n) : fetch(e, n)
|
|
619
622
|
});
|
|
620
623
|
}
|
|
621
|
-
function
|
|
624
|
+
function _e(e) {
|
|
622
625
|
let t = e.fetch, n = (e, n) => t ? t(e, n) : fetch(e, n);
|
|
623
626
|
return (t) => {
|
|
624
627
|
let r = {};
|
|
625
628
|
return e.token && (r.Authorization = `Bearer ${e.token}`), n(e.baseUrl + t, { headers: r });
|
|
626
629
|
};
|
|
627
630
|
}
|
|
628
|
-
var
|
|
631
|
+
var K = class extends Error {
|
|
629
632
|
status;
|
|
630
633
|
code;
|
|
631
634
|
constructor(e, t, n) {
|
|
632
635
|
super(e), this.name = "RequestError", this.status = t, this.code = n;
|
|
633
636
|
}
|
|
634
637
|
};
|
|
635
|
-
function
|
|
638
|
+
function ve(e) {
|
|
636
639
|
let t = e.fetch, n = (e, n) => t ? t(e, n) : fetch(e, n);
|
|
637
640
|
return async (t, r) => {
|
|
638
641
|
let i = {
|
|
@@ -650,15 +653,15 @@ function ye(e) {
|
|
|
650
653
|
} catch {}
|
|
651
654
|
if (!a.ok) {
|
|
652
655
|
let e = s && typeof s == "object" ? s : {};
|
|
653
|
-
throw new
|
|
656
|
+
throw new K(typeof e.error == "string" && e.error ? e.error : `${a.status} ${a.statusText}`.trim(), a.status, typeof e.code == "string" ? e.code : void 0);
|
|
654
657
|
}
|
|
655
658
|
return s;
|
|
656
659
|
};
|
|
657
660
|
}
|
|
658
661
|
// src/components/ExplorerRoot.tsx
|
|
659
|
-
function
|
|
662
|
+
function q(e) {
|
|
660
663
|
let { dataLayer: t, client: n, connection: r } = e;
|
|
661
|
-
return a(() => t || (n ?
|
|
664
|
+
return a(() => t || (n ? U(n) : r ? U(ge(r), _e(r), ve(r)) : null), [
|
|
662
665
|
t,
|
|
663
666
|
n,
|
|
664
667
|
r?.baseUrl,
|
|
@@ -666,12 +669,12 @@ function K(e) {
|
|
|
666
669
|
r?.fetch
|
|
667
670
|
]);
|
|
668
671
|
}
|
|
669
|
-
function
|
|
672
|
+
function ye({ theme: e, dataLayer: t, children: n }) {
|
|
670
673
|
let r = e ? { "data-theme": e } : {};
|
|
671
674
|
return t ? /* @__PURE__ */ u("div", {
|
|
672
675
|
className: "loomcycle-explorer",
|
|
673
676
|
...r,
|
|
674
|
-
children: /* @__PURE__ */ u(
|
|
677
|
+
children: /* @__PURE__ */ u(oe, {
|
|
675
678
|
value: t,
|
|
676
679
|
children: n
|
|
677
680
|
})
|
|
@@ -694,32 +697,32 @@ function be({ theme: e, dataLayer: t, children: n }) {
|
|
|
694
697
|
});
|
|
695
698
|
}
|
|
696
699
|
// src/lib/docTrail.ts
|
|
697
|
-
function
|
|
700
|
+
function be(e, t, n) {
|
|
698
701
|
let r = e[e.length - 1];
|
|
699
702
|
return [...r && r.documentId === t.documentId ? [...e.slice(0, -1), {
|
|
700
703
|
...r,
|
|
701
|
-
...
|
|
704
|
+
...Ce(t)
|
|
702
705
|
}] : [...e, t], n];
|
|
703
706
|
}
|
|
704
|
-
function
|
|
707
|
+
function xe(e, t) {
|
|
705
708
|
return t < 0 || t >= e.length - 1 ? e : e.slice(0, t + 1);
|
|
706
709
|
}
|
|
707
|
-
function
|
|
710
|
+
function Se(e, t, n) {
|
|
708
711
|
let r = e[e.length - 1];
|
|
709
712
|
if (!r || r.documentId !== t) return e;
|
|
710
713
|
let i = {
|
|
711
714
|
...r,
|
|
712
|
-
...
|
|
715
|
+
...Ce(n)
|
|
713
716
|
};
|
|
714
717
|
return i.title === r.title && i.path === r.path ? e : [...e.slice(0, -1), i];
|
|
715
718
|
}
|
|
716
|
-
function
|
|
719
|
+
function Ce(e) {
|
|
717
720
|
return Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0));
|
|
718
721
|
}
|
|
719
|
-
function
|
|
722
|
+
function we(e) {
|
|
720
723
|
return e.title ? e.title : e.path ? e.path.slice(e.path.lastIndexOf("/") + 1) || e.path : e.documentId.slice(0, 8);
|
|
721
724
|
}
|
|
722
|
-
function
|
|
725
|
+
function Te(e, t = 4) {
|
|
723
726
|
let n = Array.from({ length: e }, (e, t) => ({
|
|
724
727
|
kind: "crumb",
|
|
725
728
|
index: t
|
|
@@ -735,23 +738,23 @@ function Ee(e, t = 4) {
|
|
|
735
738
|
...n.slice(e - r)
|
|
736
739
|
];
|
|
737
740
|
}
|
|
738
|
-
function
|
|
741
|
+
function Ee(e, t) {
|
|
739
742
|
for (let n of e.values()) {
|
|
740
|
-
let e = n.entries.find((e) =>
|
|
743
|
+
let e = n.entries.find((e) => De(e) === t);
|
|
741
744
|
if (e) return e.full_path;
|
|
742
745
|
}
|
|
743
746
|
}
|
|
744
|
-
function
|
|
747
|
+
function De(e) {
|
|
745
748
|
if (e.kind === "document") return e.resource_ref?.document_id || void 0;
|
|
746
749
|
}
|
|
747
|
-
function
|
|
750
|
+
function Oe(e, t) {
|
|
748
751
|
return t && e.some((e) => e.id === t) ? t : e.find((e) => !e.parent_id)?.id;
|
|
749
752
|
}
|
|
750
753
|
// src/components/DocTrail.tsx
|
|
751
|
-
function
|
|
754
|
+
function ke({ trail: e, onJump: t }) {
|
|
752
755
|
let [n, r] = s(!1);
|
|
753
756
|
if (e.length < 2) return null;
|
|
754
|
-
let i = e.length - 1, a = e[i - 1], o =
|
|
757
|
+
let i = e.length - 1, a = e[i - 1], o = Te(e.length, n ? e.length : void 0);
|
|
755
758
|
return /* @__PURE__ */ d("nav", {
|
|
756
759
|
className: "doc-trail",
|
|
757
760
|
"aria-label": "Documents you came through",
|
|
@@ -759,7 +762,7 @@ function Ae({ trail: e, onJump: t }) {
|
|
|
759
762
|
type: "button",
|
|
760
763
|
className: "doc-trail-back",
|
|
761
764
|
onClick: () => t(i - 1),
|
|
762
|
-
title: `Back to ${
|
|
765
|
+
title: `Back to ${we(a)}`,
|
|
763
766
|
children: "← Back"
|
|
764
767
|
}), /* @__PURE__ */ u("ol", {
|
|
765
768
|
className: "doc-trail-list",
|
|
@@ -769,7 +772,7 @@ function Ae({ trail: e, onJump: t }) {
|
|
|
769
772
|
type: "button",
|
|
770
773
|
className: "doc-trail-gap",
|
|
771
774
|
onClick: () => r(!0),
|
|
772
|
-
title: `Show ${n.hidden.length} more: ${n.hidden.map((t) =>
|
|
775
|
+
title: `Show ${n.hidden.length} more: ${n.hidden.map((t) => we(e[t])).join(" › ")}`,
|
|
773
776
|
"aria-label": `Show ${n.hidden.length} hidden documents`,
|
|
774
777
|
children: "…"
|
|
775
778
|
})
|
|
@@ -778,8 +781,8 @@ function Ae({ trail: e, onJump: t }) {
|
|
|
778
781
|
children: /* @__PURE__ */ u("span", {
|
|
779
782
|
className: "doc-trail-current",
|
|
780
783
|
"aria-current": "page",
|
|
781
|
-
title:
|
|
782
|
-
children:
|
|
784
|
+
title: we(e[i]),
|
|
785
|
+
children: we(e[i])
|
|
783
786
|
})
|
|
784
787
|
}, n.index) : /* @__PURE__ */ u("li", {
|
|
785
788
|
className: "doc-trail-item",
|
|
@@ -787,15 +790,15 @@ function Ae({ trail: e, onJump: t }) {
|
|
|
787
790
|
type: "button",
|
|
788
791
|
className: "doc-trail-crumb",
|
|
789
792
|
onClick: () => t(n.index),
|
|
790
|
-
title:
|
|
791
|
-
children:
|
|
793
|
+
title: we(e[n.index]),
|
|
794
|
+
children: we(e[n.index])
|
|
792
795
|
})
|
|
793
796
|
}, n.index))
|
|
794
797
|
})]
|
|
795
798
|
});
|
|
796
799
|
}
|
|
797
800
|
// src/components/TransferModal.tsx
|
|
798
|
-
function
|
|
801
|
+
function Ae({ data: e, scope: t, browse: n, documentId: r, underPath: i, fromPath: o, onClose: c, onDone: l }) {
|
|
799
802
|
let [f, p] = s("copy"), [m, h] = s(t === "tenant" ? "user" : "tenant"), [g, _] = s(o), [v, y] = s(!1), [b, T] = s(null), [E, D] = s(null), [O, k] = s(!1), [A, j] = s(null), M = a(() => ({
|
|
800
803
|
op: f,
|
|
801
804
|
scope: t,
|
|
@@ -838,7 +841,7 @@ function je({ data: e, scope: t, browse: n, documentId: r, underPath: i, fromPat
|
|
|
838
841
|
k(!1);
|
|
839
842
|
}
|
|
840
843
|
}
|
|
841
|
-
}, I = E ? "close" : O ? "working…" : P ? `${f} ${ne} document${ne === 1 ? "" : "s"}` : "check",
|
|
844
|
+
}, I = E ? "close" : O ? "working…" : P ? `${f} ${ne} document${ne === 1 ? "" : "s"}` : "check", L = E ?? P;
|
|
842
845
|
return /* @__PURE__ */ u("div", {
|
|
843
846
|
className: "modal-overlay",
|
|
844
847
|
onClick: O ? void 0 : c,
|
|
@@ -938,10 +941,10 @@ function je({ data: e, scope: t, browse: n, documentId: r, underPath: i, fromPat
|
|
|
938
941
|
className: "modal-err",
|
|
939
942
|
children: ee
|
|
940
943
|
}),
|
|
941
|
-
|
|
944
|
+
L && /* @__PURE__ */ u("div", {
|
|
942
945
|
className: "modal-context",
|
|
943
946
|
"aria-live": "polite",
|
|
944
|
-
children: C(f,
|
|
947
|
+
children: C(f, L).map((e, t) => e.startsWith(" ") ? /* @__PURE__ */ u("div", { children: /* @__PURE__ */ u("code", { children: e.trim() }) }, t) : /* @__PURE__ */ u("div", { children: e }, t))
|
|
945
948
|
}),
|
|
946
949
|
A && /* @__PURE__ */ u("div", {
|
|
947
950
|
className: "modal-err",
|
|
@@ -952,8 +955,8 @@ function je({ data: e, scope: t, browse: n, documentId: r, underPath: i, fromPat
|
|
|
952
955
|
});
|
|
953
956
|
}
|
|
954
957
|
// src/components/Splitter.tsx
|
|
955
|
-
var
|
|
956
|
-
function
|
|
958
|
+
var J = 6;
|
|
959
|
+
function je({ children: e, defaultLeftWidth: n = 380, minLeftWidth: i = 180, minRightWidth: a = 240, storageKey: c, className: l, hideRight: f = !1 }) {
|
|
957
960
|
let p = () => {
|
|
958
961
|
if (c) {
|
|
959
962
|
let e = localStorage.getItem(c), t = e ? parseInt(e, 10) : NaN;
|
|
@@ -975,7 +978,7 @@ function Me({ children: e, defaultLeftWidth: n = 380, minLeftWidth: i = 180, min
|
|
|
975
978
|
e.preventDefault(), b(!0), e.target.setPointerCapture(e.pointerId);
|
|
976
979
|
}, []), S = t((e) => {
|
|
977
980
|
if (!y || !v.current) return;
|
|
978
|
-
let t = v.current.getBoundingClientRect(), n = e.clientX - t.left, r = t.width - a -
|
|
981
|
+
let t = v.current.getBoundingClientRect(), n = e.clientX - t.left, r = t.width - a - J;
|
|
979
982
|
h(Math.max(i, Math.min(n, r)));
|
|
980
983
|
}, [
|
|
981
984
|
y,
|
|
@@ -990,7 +993,7 @@ function Me({ children: e, defaultLeftWidth: n = 380, minLeftWidth: i = 180, min
|
|
|
990
993
|
return /* @__PURE__ */ d("div", {
|
|
991
994
|
ref: v,
|
|
992
995
|
className: `splitter ${l ?? ""} ${y ? "dragging" : ""}`,
|
|
993
|
-
style: { gridTemplateColumns: f ? "1fr 0 0" : `min(${m}px, calc(100% - ${a +
|
|
996
|
+
style: { gridTemplateColumns: f ? "1fr 0 0" : `min(${m}px, calc(100% - ${a + J}px)) ${J}px 1fr` },
|
|
994
997
|
children: [
|
|
995
998
|
/* @__PURE__ */ u("div", {
|
|
996
999
|
className: "splitter-pane splitter-left",
|
|
@@ -1016,18 +1019,18 @@ function Me({ children: e, defaultLeftWidth: n = 380, minLeftWidth: i = 180, min
|
|
|
1016
1019
|
});
|
|
1017
1020
|
}
|
|
1018
1021
|
// src/lib/imageUpload.ts
|
|
1019
|
-
var
|
|
1022
|
+
var Me = [
|
|
1020
1023
|
"image/png",
|
|
1021
1024
|
"image/jpeg",
|
|
1022
1025
|
"image/gif",
|
|
1023
1026
|
"image/webp"
|
|
1024
1027
|
];
|
|
1025
|
-
function
|
|
1026
|
-
return
|
|
1028
|
+
function Ne(e) {
|
|
1029
|
+
return Me.includes(e);
|
|
1027
1030
|
}
|
|
1028
|
-
function
|
|
1031
|
+
function Pe(e) {
|
|
1029
1032
|
return new Promise((t, n) => {
|
|
1030
|
-
if (!
|
|
1033
|
+
if (!Ne(e.type)) {
|
|
1031
1034
|
n(/* @__PURE__ */ Error(`unsupported image type "${e.type || "unknown"}" (png, jpeg, gif, webp only)`));
|
|
1032
1035
|
return;
|
|
1033
1036
|
}
|
|
@@ -1041,11 +1044,11 @@ function Fe(e) {
|
|
|
1041
1044
|
}, r.readAsDataURL(e);
|
|
1042
1045
|
});
|
|
1043
1046
|
}
|
|
1044
|
-
function
|
|
1047
|
+
function Fe(e) {
|
|
1045
1048
|
if (!e) return null;
|
|
1046
1049
|
for (let t = 0; t < e.length; t++) {
|
|
1047
1050
|
let n = e[t];
|
|
1048
|
-
if (n.kind === "file" &&
|
|
1051
|
+
if (n.kind === "file" && Ne(n.type)) {
|
|
1049
1052
|
let e = n.getAsFile();
|
|
1050
1053
|
if (e) return e;
|
|
1051
1054
|
}
|
|
@@ -1053,8 +1056,8 @@ function Ie(e) {
|
|
|
1053
1056
|
return null;
|
|
1054
1057
|
}
|
|
1055
1058
|
// src/lib/edgePages.ts
|
|
1056
|
-
var
|
|
1057
|
-
async function
|
|
1059
|
+
var Ie = 20;
|
|
1060
|
+
async function Le(e, t, n, r, i = 20) {
|
|
1058
1061
|
let a = [], o;
|
|
1059
1062
|
for (let s = 0; s < i; s++) {
|
|
1060
1063
|
let i = await e.documentGetEdges(t, n, r, o ? { after: o } : void 0);
|
|
@@ -1078,7 +1081,7 @@ async function Re(e, t, n, r, i = 20) {
|
|
|
1078
1081
|
};
|
|
1079
1082
|
}
|
|
1080
1083
|
// src/lib/chunkAncestry.ts
|
|
1081
|
-
function
|
|
1084
|
+
function Y(e, t) {
|
|
1082
1085
|
if (!t) return [];
|
|
1083
1086
|
let n = new Map(e.map((e) => [e.id, e])), r = /* @__PURE__ */ new Set([t]), i = [], a = n.get(t)?.parent_id;
|
|
1084
1087
|
for (; a && !r.has(a);) {
|
|
@@ -1089,28 +1092,28 @@ function J(e, t) {
|
|
|
1089
1092
|
return i.reverse();
|
|
1090
1093
|
}
|
|
1091
1094
|
// src/lib/statement.ts
|
|
1092
|
-
var
|
|
1093
|
-
function
|
|
1095
|
+
var Re = /* @__PURE__ */ new Set(["manual", "wikilink"]), ze = 280;
|
|
1096
|
+
function X(e) {
|
|
1094
1097
|
return e.status && e.status !== "asserted" ? e.status : void 0;
|
|
1095
1098
|
}
|
|
1096
|
-
function
|
|
1097
|
-
return e.method && !
|
|
1099
|
+
function Be(e) {
|
|
1100
|
+
return e.method && !Re.has(e.method) ? e.method : void 0;
|
|
1098
1101
|
}
|
|
1099
|
-
function
|
|
1102
|
+
function Ve(e) {
|
|
1100
1103
|
return e.status === "proposed" && !!e.id;
|
|
1101
1104
|
}
|
|
1102
|
-
function
|
|
1105
|
+
function He(e) {
|
|
1103
1106
|
return new Date(Math.floor(e / 1e6)).toISOString().slice(0, 10);
|
|
1104
1107
|
}
|
|
1105
1108
|
function Z(e) {
|
|
1106
|
-
let t = e.valid_at == null ? void 0 :
|
|
1109
|
+
let t = e.valid_at == null ? void 0 : He(e.valid_at), n = e.invalid_at == null ? void 0 : He(e.invalid_at);
|
|
1107
1110
|
if (t && n) return `valid ${t} → ${n}`;
|
|
1108
1111
|
if (t) return `valid from ${t}`;
|
|
1109
1112
|
if (n) return `valid until ${n}`;
|
|
1110
1113
|
}
|
|
1111
1114
|
function Ue(e) {
|
|
1112
1115
|
if (e.judged_at == null) return;
|
|
1113
|
-
let t = `judged by ${e.judged_by || "a judge"} on ${
|
|
1116
|
+
let t = `judged by ${e.judged_by || "a judge"} on ${He(e.judged_at)}`;
|
|
1114
1117
|
return e.judge_reason ? `${t}: ${e.judge_reason}` : t;
|
|
1115
1118
|
}
|
|
1116
1119
|
function We(e, t = 3) {
|
|
@@ -1120,7 +1123,7 @@ function We(e, t = 3) {
|
|
|
1120
1123
|
more: Math.max(0, r - n.length)
|
|
1121
1124
|
};
|
|
1122
1125
|
}
|
|
1123
|
-
function Q(e, t =
|
|
1126
|
+
function Q(e, t = ze) {
|
|
1124
1127
|
let n = e.replace(/\s+/g, " ").trim();
|
|
1125
1128
|
return n.length > t ? n.slice(0, t - 1) + "…" : n;
|
|
1126
1129
|
}
|
|
@@ -1220,7 +1223,7 @@ function Qe(e, t) {
|
|
|
1220
1223
|
return e.documentRuleStatements ? Ze(t) : void 0;
|
|
1221
1224
|
}
|
|
1222
1225
|
function $e(e, t) {
|
|
1223
|
-
return e.filter((e) =>
|
|
1226
|
+
return e.filter((e) => Ve(e) && !!e.id && e.from_document_id === t);
|
|
1224
1227
|
}
|
|
1225
1228
|
function et(e, t, n, r) {
|
|
1226
1229
|
return e ? {
|
|
@@ -1751,7 +1754,7 @@ function Ot({ code: e, onNodeClick: t }) {
|
|
|
1751
1754
|
}
|
|
1752
1755
|
// src/components/ChunkEditorModal.tsx
|
|
1753
1756
|
function kt({ chunk: e, scope: t, browse: n, onClose: i, onSaved: a }) {
|
|
1754
|
-
let o =
|
|
1757
|
+
let o = se(), [c, l] = s(e.title), [f, p] = s(e.type ?? ""), [m, h] = s(e.status ?? ""), [g, _] = s(e.body ?? ""), [v, y] = s(e.fields ? JSON.stringify(e.fields, null, 2) : ""), [b, x] = s((e.tags ?? []).join(", ")), [S, C] = s(!1), [w, T] = s(null), [E, D] = s(!1), O = f === "mermaid", k = f === "image" || !!e.asset, [A, j] = s(g);
|
|
1755
1758
|
r(() => {
|
|
1756
1759
|
if (!O) return;
|
|
1757
1760
|
let e = setTimeout(() => j(g), 400);
|
|
@@ -1760,7 +1763,7 @@ function kt({ chunk: e, scope: t, browse: n, onClose: i, onSaved: a }) {
|
|
|
1760
1763
|
let M = async (r) => {
|
|
1761
1764
|
T(null), C(!0);
|
|
1762
1765
|
try {
|
|
1763
|
-
let { mediaType: s, data: c } = await
|
|
1766
|
+
let { mediaType: s, data: c } = await Pe(r);
|
|
1764
1767
|
a(await o.documentSetAsset(e.id, s, c, r.name, t, n)), i();
|
|
1765
1768
|
} catch (e) {
|
|
1766
1769
|
T(e instanceof Error ? e.message : String(e)), C(!1);
|
|
@@ -1901,7 +1904,7 @@ function kt({ chunk: e, scope: t, browse: n, onClose: i, onSaved: a }) {
|
|
|
1901
1904
|
}
|
|
1902
1905
|
// src/components/SubjectTypeModal.tsx
|
|
1903
1906
|
function At({ chunk: e, scope: t, browse: n, onClose: i, onSaved: a }) {
|
|
1904
|
-
let o =
|
|
1907
|
+
let o = se(), [c, l] = s(null), [f, p] = s(e.type ?? ""), [m, h] = s(!1), [g, _] = s(null), [v, y] = s(null);
|
|
1905
1908
|
r(() => {
|
|
1906
1909
|
let e = !1;
|
|
1907
1910
|
return o.documentEntityTypes?.(t, n).then((t) => {
|
|
@@ -2080,7 +2083,7 @@ function Ut(e) {
|
|
|
2080
2083
|
}
|
|
2081
2084
|
// src/components/Classification.tsx
|
|
2082
2085
|
function Wt({ documentId: e, scope: t, browse: n, rootFields: i, requestKey: o, onClose: c, onChanged: l }) {
|
|
2083
|
-
let f =
|
|
2086
|
+
let f = se(), [p, m] = s(null), [h, g] = s(!1), [_, v] = s(null), [y, b] = s(!1), [x, S] = s(null), [C, w] = s(null), T = a(() => f.documentAcceptClassification ? Nt(i) : void 0, [f, i]);
|
|
2084
2087
|
r(() => {
|
|
2085
2088
|
if (o === 0 || !f.documentClassify) return;
|
|
2086
2089
|
let r = !1;
|
|
@@ -2342,7 +2345,7 @@ function Kt(e) {
|
|
|
2342
2345
|
return n.length === 3 && (n = n[0] + n[0] + n[1] + n[1] + n[2] + n[2]), "#" + n.toLowerCase();
|
|
2343
2346
|
}
|
|
2344
2347
|
function qt({ documentId: e, rootChunkId: t, docType: n, docStatus: i, chunkStatuses: o, scope: c, browse: f, onClose: p, onSaved: m }) {
|
|
2345
|
-
let h =
|
|
2348
|
+
let h = se(), [g, _] = s(null), [v, y] = s(!1), [b, x] = s({}), [S, C] = s(!1), [w, T] = s(null), [E, D] = s(null), O = a(() => {
|
|
2346
2349
|
let e = new Set(Object.keys(rt));
|
|
2347
2350
|
n && e.add(`doc.${n}.${i || "draft"}`);
|
|
2348
2351
|
for (let t of o) t && e.add(`chunk.${t}`);
|
|
@@ -2533,7 +2536,7 @@ function Yt({ id: e, title: t, targetDocumentId: n, documentId: r, onSelectChunk
|
|
|
2533
2536
|
}
|
|
2534
2537
|
// src/components/Statement.tsx
|
|
2535
2538
|
function Xt({ statement: e }) {
|
|
2536
|
-
let t =
|
|
2539
|
+
let t = X(e), n = Be(e), r = Ue(e), i = Z(e), { rows: a, more: o } = We(e);
|
|
2537
2540
|
return /* @__PURE__ */ d(l, { children: [
|
|
2538
2541
|
t && /* @__PURE__ */ u("span", {
|
|
2539
2542
|
className: `doc-stmt-status ${t}`,
|
|
@@ -2640,7 +2643,7 @@ function Zt({ id: e, onRule: t }) {
|
|
|
2640
2643
|
// src/components/ProposalReview.tsx
|
|
2641
2644
|
var Qt = 3;
|
|
2642
2645
|
function $t({ documentId: e, proposals: t, incomplete: n, scope: r, browse: i, onChanged: a, onSelectChunk: c, onOpenDocument: l }) {
|
|
2643
|
-
let f =
|
|
2646
|
+
let f = se(), [p, m] = s(/* @__PURE__ */ new Set()), [h, g] = s({ kind: "idle" }), [_, v] = s(""), [y, b] = s(null), [x, S] = s(null), C = o(null), w = new Set(t.map((e) => e.id)), T = [...p].filter((e) => w.has(e)), E = h.kind !== "idle" && h.kind !== "reason", D = (e, t) => {
|
|
2644
2647
|
b(null), S(null), e === "reject" ? g({
|
|
2645
2648
|
kind: "reason",
|
|
2646
2649
|
action: e,
|
|
@@ -2920,7 +2923,7 @@ function rn(e) {
|
|
|
2920
2923
|
return /embedder|embedding|vector|semantic|not configured/i.test(e);
|
|
2921
2924
|
}
|
|
2922
2925
|
function an({ documentId: e, selectedId: t, scope: n, browse: i, onSelectChunk: a, onOpenDocument: o, refreshKey: c, review: f }) {
|
|
2923
|
-
let p =
|
|
2926
|
+
let p = se(), [m, h] = s(!1), [g, _] = s(!1), [v, y] = s(void 0), [b, x] = s([]), [S, C] = s([]), [w, T] = s(null), [E, D] = s([]), [O, k] = s(!1);
|
|
2924
2927
|
r(() => {
|
|
2925
2928
|
if (!m || !t) return;
|
|
2926
2929
|
let e = t, r = !1;
|
|
@@ -3133,7 +3136,7 @@ function cn({ edge: e, selectedId: t, documentId: n, onSelectChunk: r, onOpenDoc
|
|
|
3133
3136
|
onOpenDocument: i
|
|
3134
3137
|
}),
|
|
3135
3138
|
/* @__PURE__ */ u(Xt, { statement: e }),
|
|
3136
|
-
a &&
|
|
3139
|
+
a && Ve(e) && /* @__PURE__ */ u(Zt, {
|
|
3137
3140
|
id: e.id,
|
|
3138
3141
|
onRule: a
|
|
3139
3142
|
})
|
|
@@ -3271,6 +3274,18 @@ var _n = [
|
|
|
3271
3274
|
title: "Render the whole document as a Word document",
|
|
3272
3275
|
rendered: !0
|
|
3273
3276
|
},
|
|
3277
|
+
{
|
|
3278
|
+
kind: "odt",
|
|
3279
|
+
label: "OpenDocument (.odt)",
|
|
3280
|
+
title: "Render the whole document as an OpenDocument text file",
|
|
3281
|
+
rendered: !0
|
|
3282
|
+
},
|
|
3283
|
+
{
|
|
3284
|
+
kind: "epub",
|
|
3285
|
+
label: "E-book (.epub)",
|
|
3286
|
+
title: "Render the whole document as an EPUB e-book",
|
|
3287
|
+
rendered: !0
|
|
3288
|
+
},
|
|
3274
3289
|
{
|
|
3275
3290
|
kind: "html",
|
|
3276
3291
|
label: "HTML",
|
|
@@ -3293,23 +3308,23 @@ var _n = [
|
|
|
3293
3308
|
function vn(e) {
|
|
3294
3309
|
return _n.filter((t) => !t.rendered || !!e.documentExportFile);
|
|
3295
3310
|
}
|
|
3296
|
-
async function yn(e, t, n, r, i, a, o =
|
|
3311
|
+
async function yn(e, t, n, r, i, a, o = B) {
|
|
3297
3312
|
if (t === "md") {
|
|
3298
3313
|
let t = await e.documentExportMd(n, r, !0, i);
|
|
3299
|
-
o(new Blob([t.markdown], { type: "text/markdown" }),
|
|
3314
|
+
o(new Blob([t.markdown], { type: "text/markdown" }), z(t.title) + ".md");
|
|
3300
3315
|
return;
|
|
3301
3316
|
}
|
|
3302
3317
|
if (t === "canvas") {
|
|
3303
3318
|
let t = await e.documentExportCanvas(n, r, i);
|
|
3304
|
-
o(new Blob([JSON.stringify(t.canvas, null, 2)], { type: "application/json" }),
|
|
3319
|
+
o(new Blob([JSON.stringify(t.canvas, null, 2)], { type: "application/json" }), z(a) + ".canvas");
|
|
3305
3320
|
return;
|
|
3306
3321
|
}
|
|
3307
3322
|
if (!e.documentExportFile) throw Error("this connection cannot download rendered files");
|
|
3308
3323
|
let s = t, c = await e.documentExportFile(n, r, s, i);
|
|
3309
|
-
o(c.blob, c.filename ||
|
|
3324
|
+
o(c.blob, c.filename || z(a) + "." + s);
|
|
3310
3325
|
}
|
|
3311
3326
|
function bn({ documentId: e, scope: n, browse: a, title: c, onError: l }) {
|
|
3312
|
-
let f =
|
|
3327
|
+
let f = se(), p = vn(f), [m, h] = s(null), g = m !== null, [_, v] = s(null), y = o(null), b = o(null), x = o([]), S = i();
|
|
3313
3328
|
r(() => {
|
|
3314
3329
|
m !== null && x.current[m]?.focus();
|
|
3315
3330
|
}, [m]), r(() => {
|
|
@@ -3400,7 +3415,7 @@ function xn(e) {
|
|
|
3400
3415
|
return !Number.isFinite(t) || t <= 0 ? String(e ?? "") : new Date(t).toLocaleString();
|
|
3401
3416
|
}
|
|
3402
3417
|
function Sn({ chunkId: e, chunkTitle: t, scope: n, browse: i, onClose: a }) {
|
|
3403
|
-
let o =
|
|
3418
|
+
let o = se(), [c, f] = s([]), [p, m] = s(!0), [h, g] = s(null), [_, v] = s("none"), [y, b] = s(null), [x, S] = s(""), [C, w] = s(!1), [T, E] = s(null), [D, O] = s(null), [k, A] = s("");
|
|
3404
3419
|
r(() => {
|
|
3405
3420
|
let t = !1;
|
|
3406
3421
|
return m(!0), g(null), o.documentHistory(e, n, i).then((e) => {
|
|
@@ -3562,18 +3577,30 @@ function Cn({ text: e }) {
|
|
|
3562
3577
|
})
|
|
3563
3578
|
});
|
|
3564
3579
|
}
|
|
3580
|
+
// src/lib/remarkBareBreak.ts
|
|
3581
|
+
var wn = /^<br\s*\/?>$/i;
|
|
3582
|
+
function Tn(e) {
|
|
3583
|
+
let t = e.children;
|
|
3584
|
+
if (t) for (let e = 0; e < t.length; e++) {
|
|
3585
|
+
let n = t[e];
|
|
3586
|
+
n.type === "html" && wn.test(n.value ?? "") ? t[e] = { type: "break" } : Tn(n);
|
|
3587
|
+
}
|
|
3588
|
+
}
|
|
3589
|
+
function En() {
|
|
3590
|
+
return (e) => Tn(e);
|
|
3591
|
+
}
|
|
3565
3592
|
// src/components/Markdown.tsx
|
|
3566
|
-
function
|
|
3593
|
+
function Dn({ source: e }) {
|
|
3567
3594
|
return /* @__PURE__ */ u("div", {
|
|
3568
3595
|
className: "md",
|
|
3569
3596
|
children: /* @__PURE__ */ u(p, {
|
|
3570
|
-
remarkPlugins: [m],
|
|
3571
|
-
components:
|
|
3597
|
+
remarkPlugins: [m, En],
|
|
3598
|
+
components: On,
|
|
3572
3599
|
children: e
|
|
3573
3600
|
})
|
|
3574
3601
|
});
|
|
3575
3602
|
}
|
|
3576
|
-
var
|
|
3603
|
+
var On = {
|
|
3577
3604
|
a({ href: e, children: t }) {
|
|
3578
3605
|
let n = e ?? "", r = /^https?:\/\//i.test(n);
|
|
3579
3606
|
return /* @__PURE__ */ u("a", {
|
|
@@ -3598,70 +3625,70 @@ var Tn = {
|
|
|
3598
3625
|
}
|
|
3599
3626
|
};
|
|
3600
3627
|
// src/components/DocumentViewerBody.tsx
|
|
3601
|
-
function
|
|
3628
|
+
function kn(e) {
|
|
3602
3629
|
let t = e.fields ?? {};
|
|
3603
3630
|
return typeof t.alt == "string" && t.alt.trim() !== "" ? t.alt : e.title || "image";
|
|
3604
3631
|
}
|
|
3605
|
-
function
|
|
3606
|
-
let C =
|
|
3632
|
+
function An({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, renderAssistant: p, initialChunkId: m, onOpenDocument: h, onTitle: g, onChunkSelect: _, focusChunk: y, onRegenerateAnnotation: b, canEditAnnotations: x, onAnnotationChanged: S }) {
|
|
3633
|
+
let C = se(), w = a(() => c && (c.scopeId || c.tenant) ? {
|
|
3607
3634
|
scopeId: c.scopeId,
|
|
3608
3635
|
tenant: c.tenant
|
|
3609
|
-
} : void 0, [c?.scopeId, c?.tenant]), [T, E] = s([]), [O, k] = s(void 0), [A, j] = s(null), [M, P] = s("chunks"), [te, ne] = s(null), [F, I] = s(null), [
|
|
3610
|
-
|
|
3611
|
-
let
|
|
3612
|
-
|
|
3613
|
-
let
|
|
3636
|
+
} : void 0, [c?.scopeId, c?.tenant]), [T, E] = s([]), [O, k] = s(void 0), [A, j] = s(null), [M, P] = s("chunks"), [te, ne] = s(null), [F, I] = s(null), [L, re] = s(null), R = o(null), [z, B] = s(null), [V, H] = s(null), [U, ie] = s(!1), [ae, W] = s(!1), [oe, G] = s(null), [ce, le] = s(!1), [ue, de] = s(void 0), [fe, pe] = s(null), [me, he] = s(0), [ge, _e] = s(!1), [K, ve] = s(null), [q, ye] = s(!1), [be, xe] = s([]), [Se, Ce] = s(!1), [we, Te] = s(0), [Ee, De] = s(0), [ke, Ae] = s(void 0), [J, Me] = s([]), [Ne, Ie] = s([]), [Re, ze] = s(0), X = t(() => he((e) => e + 1), []), Be = o(m);
|
|
3637
|
+
Be.current = m;
|
|
3638
|
+
let Ve = o(g);
|
|
3639
|
+
Ve.current = g;
|
|
3640
|
+
let He = a(() => gt(T), [T]), Z = a(() => T.find((e) => !e.parent_id)?.title || i || "document", [T, i]), Ue = a(() => !!A && !A.parent_id, [A]), We = a(() => Y(T, A?.id), [T, A]), Q = a(() => K?.root_chunk_id ?? T.find((e) => !e.parent_id)?.id, [K, T]), Ge = o(_);
|
|
3614
3641
|
Ge.current = _, r(() => {
|
|
3615
3642
|
O && Ge.current?.(O === Q ? void 0 : O);
|
|
3616
3643
|
}, [O, Q]);
|
|
3617
|
-
let Ke = a(() => [...new Set(T.map((e) => e.status).filter((e) => !!e))], [T]), qe = !!
|
|
3644
|
+
let Ke = a(() => [...new Set(T.map((e) => e.status).filter((e) => !!e))], [T]), qe = !!K?.color_enabled, Je = a(() => {
|
|
3618
3645
|
let e = /* @__PURE__ */ new Set();
|
|
3619
|
-
for (let t of
|
|
3646
|
+
for (let t of be) e.add(t.from_id), e.add(t.to_id);
|
|
3620
3647
|
return e;
|
|
3621
|
-
}, [
|
|
3648
|
+
}, [be]), Ye = a(() => qe ? st(K?.type, K?.status, at(K?.color_scheme)) : void 0, [
|
|
3622
3649
|
qe,
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3650
|
+
K?.type,
|
|
3651
|
+
K?.status,
|
|
3652
|
+
K?.color_scheme
|
|
3626
3653
|
]), $ = a(() => dt(Ye), [Ye]);
|
|
3627
3654
|
r(() => {
|
|
3628
3655
|
let t = !1;
|
|
3629
|
-
return
|
|
3656
|
+
return le(!0), G(null), pe(null), C.documentQueryChunks(e, n, w).then((r) => {
|
|
3630
3657
|
if (t) return;
|
|
3631
3658
|
let i = r.chunks ?? [];
|
|
3632
|
-
E(i),
|
|
3659
|
+
E(i), de(`${n}:${e}`), k((e) => e ?? Oe(i, Be.current));
|
|
3633
3660
|
}).catch((e) => {
|
|
3634
|
-
t || (E([]),
|
|
3635
|
-
}).finally(() => !t &&
|
|
3661
|
+
t || (E([]), pe(e instanceof Error ? e.message : String(e)));
|
|
3662
|
+
}).finally(() => !t && le(!1)), () => {
|
|
3636
3663
|
t = !0;
|
|
3637
3664
|
};
|
|
3638
3665
|
}, [
|
|
3639
3666
|
C,
|
|
3640
3667
|
e,
|
|
3641
3668
|
n,
|
|
3642
|
-
|
|
3669
|
+
me,
|
|
3643
3670
|
w
|
|
3644
3671
|
]);
|
|
3645
|
-
let Xe = !
|
|
3672
|
+
let Xe = !ce && (fe !== null || ue === `${n}:${e}` && T.length === 0), Ze = a(() => T.find((t) => !t.parent_id && t.document_id === e)?.title, [T, e]);
|
|
3646
3673
|
r(() => {
|
|
3647
|
-
Ze &&
|
|
3674
|
+
Ze && Ve.current?.(e, Ze);
|
|
3648
3675
|
}, [e, Ze]), r(() => {
|
|
3649
3676
|
let t = !1;
|
|
3650
|
-
return C.documentGet(e, n, w).then((e) => !t &&
|
|
3677
|
+
return C.documentGet(e, n, w).then((e) => !t && ve(e)).catch(() => !t && ve(null)), () => {
|
|
3651
3678
|
t = !0;
|
|
3652
3679
|
};
|
|
3653
3680
|
}, [
|
|
3654
3681
|
C,
|
|
3655
3682
|
e,
|
|
3656
3683
|
n,
|
|
3657
|
-
|
|
3684
|
+
me,
|
|
3658
3685
|
w
|
|
3659
3686
|
]), r(() => {
|
|
3660
3687
|
let t = !1;
|
|
3661
|
-
return
|
|
3662
|
-
t || (
|
|
3688
|
+
return Le(C, e, n, w).then((e) => {
|
|
3689
|
+
t || (xe(e.edges), Ce(e.incomplete));
|
|
3663
3690
|
}).catch(() => {
|
|
3664
|
-
t || (
|
|
3691
|
+
t || (xe([]), Ce(!1));
|
|
3665
3692
|
}), () => {
|
|
3666
3693
|
t = !0;
|
|
3667
3694
|
};
|
|
@@ -3669,16 +3696,16 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
3669
3696
|
C,
|
|
3670
3697
|
e,
|
|
3671
3698
|
n,
|
|
3672
|
-
|
|
3699
|
+
me,
|
|
3673
3700
|
w,
|
|
3674
|
-
|
|
3701
|
+
we
|
|
3675
3702
|
]), r(() => {
|
|
3676
3703
|
if (!Q || !C.documentAcceptClassification) {
|
|
3677
|
-
|
|
3704
|
+
Ae(void 0);
|
|
3678
3705
|
return;
|
|
3679
3706
|
}
|
|
3680
3707
|
let t = !1;
|
|
3681
|
-
return C.documentGetChunk(Q, n, w).then((n) => !t &&
|
|
3708
|
+
return C.documentGetChunk(Q, n, w).then((n) => !t && Ae(n.document_id === e ? n.fields : void 0)).catch(() => !t && Ae(void 0)), () => {
|
|
3682
3709
|
t = !0;
|
|
3683
3710
|
};
|
|
3684
3711
|
}, [
|
|
@@ -3686,31 +3713,31 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
3686
3713
|
e,
|
|
3687
3714
|
Q,
|
|
3688
3715
|
n,
|
|
3689
|
-
|
|
3716
|
+
me,
|
|
3690
3717
|
w
|
|
3691
3718
|
]), r(() => {
|
|
3692
3719
|
if (!Q || !D(n)) {
|
|
3693
|
-
|
|
3720
|
+
Me([]);
|
|
3694
3721
|
return;
|
|
3695
3722
|
}
|
|
3696
3723
|
let e = !1;
|
|
3697
|
-
return N(C, Q, n, w).then((t) => !e &&
|
|
3724
|
+
return N(C, Q, n, w).then((t) => !e && Me(t)).catch(() => !e && Me([])), () => {
|
|
3698
3725
|
e = !0;
|
|
3699
3726
|
};
|
|
3700
3727
|
}, [
|
|
3701
3728
|
C,
|
|
3702
3729
|
Q,
|
|
3703
3730
|
n,
|
|
3704
|
-
|
|
3731
|
+
me,
|
|
3705
3732
|
w,
|
|
3706
|
-
|
|
3733
|
+
Re
|
|
3707
3734
|
]), r(() => {
|
|
3708
3735
|
if (!O || O === Q || !D(n)) {
|
|
3709
|
-
|
|
3736
|
+
Ie([]);
|
|
3710
3737
|
return;
|
|
3711
3738
|
}
|
|
3712
3739
|
let e = !1;
|
|
3713
|
-
return
|
|
3740
|
+
return Ie([]), N(C, O, n, w).then((t) => !e && Ie(t)).catch(() => !e && Ie([])), () => {
|
|
3714
3741
|
e = !0;
|
|
3715
3742
|
};
|
|
3716
3743
|
}, [
|
|
@@ -3718,9 +3745,9 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
3718
3745
|
O,
|
|
3719
3746
|
Q,
|
|
3720
3747
|
n,
|
|
3721
|
-
|
|
3748
|
+
me,
|
|
3722
3749
|
w,
|
|
3723
|
-
|
|
3750
|
+
Re
|
|
3724
3751
|
]);
|
|
3725
3752
|
let tt = a(() => {
|
|
3726
3753
|
if (x && C.documentSetAnnotation && D(n)) return (e) => async (t, r, i) => {
|
|
@@ -3729,7 +3756,7 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
3729
3756
|
level: t,
|
|
3730
3757
|
brief: r,
|
|
3731
3758
|
abstract: i
|
|
3732
|
-
}, n, w),
|
|
3759
|
+
}, n, w), ze((e) => e + 1), S?.();
|
|
3733
3760
|
};
|
|
3734
3761
|
}, [
|
|
3735
3762
|
C,
|
|
@@ -3739,7 +3766,7 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
3739
3766
|
S
|
|
3740
3767
|
]), nt = a(() => {
|
|
3741
3768
|
if (b && D(n)) return (t) => async (r) => {
|
|
3742
|
-
let i = [...
|
|
3769
|
+
let i = [...J, ...Ne].find((e) => e.chunk_id === t && e.level === r)?.folder;
|
|
3743
3770
|
try {
|
|
3744
3771
|
await b({
|
|
3745
3772
|
documentId: e,
|
|
@@ -3749,28 +3776,28 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
3749
3776
|
...i ? { folder: i } : {}
|
|
3750
3777
|
});
|
|
3751
3778
|
} finally {
|
|
3752
|
-
|
|
3779
|
+
ze((e) => e + 1), S?.();
|
|
3753
3780
|
}
|
|
3754
3781
|
};
|
|
3755
3782
|
}, [
|
|
3756
3783
|
b,
|
|
3757
3784
|
e,
|
|
3758
3785
|
n,
|
|
3759
|
-
|
|
3760
|
-
|
|
3786
|
+
J,
|
|
3787
|
+
Ne,
|
|
3761
3788
|
S
|
|
3762
|
-
]), rt =
|
|
3789
|
+
]), rt = J.find((e) => e.level === "document") ?? J.find((e) => e.level === "path"), it = a(() => Ne.filter((e) => e.chunk_id === A?.id), [Ne, A?.id]), ot = a(() => {
|
|
3763
3790
|
if (C.documentAcceptStatement && C.documentRejectStatement) return async (e, t, r) => {
|
|
3764
|
-
t ? await C.documentAcceptStatement(e, n, w, r) : await C.documentRejectStatement(e, r ?? "", n, w),
|
|
3791
|
+
t ? await C.documentAcceptStatement(e, n, w, r) : await C.documentRejectStatement(e, r ?? "", n, w), Te((e) => e + 1);
|
|
3765
3792
|
};
|
|
3766
3793
|
}, [
|
|
3767
3794
|
C,
|
|
3768
3795
|
n,
|
|
3769
3796
|
w
|
|
3770
|
-
]), ct = a(() => Qe(C, n), [C, n]), lt = a(() => $e(
|
|
3797
|
+
]), ct = a(() => Qe(C, n), [C, n]), lt = a(() => $e(be, e), [be, e]), ut = t(() => Te((e) => e + 1), []), ft = a(() => et(ct, lt, Se, ut), [
|
|
3771
3798
|
ct,
|
|
3772
3799
|
lt,
|
|
3773
|
-
|
|
3800
|
+
Se,
|
|
3774
3801
|
ut
|
|
3775
3802
|
]), pt = y?.seq, mt = o(y);
|
|
3776
3803
|
mt.current = y;
|
|
@@ -3779,35 +3806,35 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
3779
3806
|
let bt = o(T);
|
|
3780
3807
|
bt.current = T, r(() => {
|
|
3781
3808
|
if (pt === void 0) return;
|
|
3782
|
-
let e = mt.current?.chunkId, t = bt.current.length > 0 ?
|
|
3809
|
+
let e = mt.current?.chunkId, t = bt.current.length > 0 ? Oe(bt.current, e) : e ?? _t.current;
|
|
3783
3810
|
t && k(t);
|
|
3784
3811
|
}, [pt]), r(() => {
|
|
3785
|
-
k(void 0), j(null), ne(null), P("chunks"),
|
|
3812
|
+
k(void 0), j(null), ne(null), P("chunks"), ve(null), xe([]), Ce(!1), De(0), Ae(void 0), Me([]), Ie([]);
|
|
3786
3813
|
}, [e, n]), r(() => {
|
|
3787
3814
|
if (!O) {
|
|
3788
3815
|
j(null);
|
|
3789
3816
|
return;
|
|
3790
3817
|
}
|
|
3791
3818
|
let e = !1;
|
|
3792
|
-
return C.documentGetChunk(O, n, w).then((t) => !e && j(t)).catch((t) => !e &&
|
|
3819
|
+
return C.documentGetChunk(O, n, w).then((t) => !e && j(t)).catch((t) => !e && G(t instanceof Error ? t.message : String(t))), () => {
|
|
3793
3820
|
e = !0;
|
|
3794
3821
|
};
|
|
3795
3822
|
}, [
|
|
3796
3823
|
C,
|
|
3797
3824
|
O,
|
|
3798
3825
|
n,
|
|
3799
|
-
|
|
3826
|
+
me,
|
|
3800
3827
|
w
|
|
3801
3828
|
]), r(() => {
|
|
3802
3829
|
let e = A?.type === "image" || !!A?.asset;
|
|
3803
3830
|
if (!A || !e || !C.documentAssetObjectUrl) {
|
|
3804
|
-
I(null),
|
|
3831
|
+
I(null), re(null);
|
|
3805
3832
|
return;
|
|
3806
3833
|
}
|
|
3807
3834
|
let t = !1, r = null;
|
|
3808
|
-
return
|
|
3835
|
+
return re(null), C.documentAssetObjectUrl(A.id, n, w).then((e) => {
|
|
3809
3836
|
t ? URL.revokeObjectURL(e) : (r = e, I(e));
|
|
3810
|
-
}).catch((e) => !t &&
|
|
3837
|
+
}).catch((e) => !t && re(e instanceof Error ? e.message : String(e))), () => {
|
|
3811
3838
|
t = !0, r && URL.revokeObjectURL(r);
|
|
3812
3839
|
};
|
|
3813
3840
|
}, [
|
|
@@ -3820,7 +3847,7 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
3820
3847
|
ne(null);
|
|
3821
3848
|
return;
|
|
3822
3849
|
}
|
|
3823
|
-
let e = vt(
|
|
3850
|
+
let e = vt(He, O);
|
|
3824
3851
|
if (!e) return;
|
|
3825
3852
|
let t = !1, r = [], i = (e, t) => {
|
|
3826
3853
|
r.push({
|
|
@@ -3840,16 +3867,16 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
3840
3867
|
return a + (i.body ? "\n\n" + i.body : "") + "\n";
|
|
3841
3868
|
}).join("\n");
|
|
3842
3869
|
ne(n);
|
|
3843
|
-
}).catch((e) => !t &&
|
|
3870
|
+
}).catch((e) => !t && G(e instanceof Error ? e.message : String(e))), () => {
|
|
3844
3871
|
t = !0;
|
|
3845
3872
|
};
|
|
3846
3873
|
}, [
|
|
3847
3874
|
C,
|
|
3848
3875
|
M,
|
|
3849
3876
|
O,
|
|
3850
|
-
|
|
3877
|
+
He,
|
|
3851
3878
|
n,
|
|
3852
|
-
|
|
3879
|
+
me,
|
|
3853
3880
|
w
|
|
3854
3881
|
]);
|
|
3855
3882
|
let xt = t((e) => k(e.row.id), []), Ct = t((t, n, r) => h?.({
|
|
@@ -3869,15 +3896,15 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
3869
3896
|
if (!C.documentCreateChunk || !C.documentSetAsset) return;
|
|
3870
3897
|
let r = O || Q;
|
|
3871
3898
|
if (r) {
|
|
3872
|
-
|
|
3899
|
+
G(null);
|
|
3873
3900
|
try {
|
|
3874
|
-
let { mediaType: i, data: a } = await
|
|
3901
|
+
let { mediaType: i, data: a } = await Pe(t), o = await C.documentCreateChunk(e, r, {
|
|
3875
3902
|
title: t.name || "image",
|
|
3876
3903
|
type: "image"
|
|
3877
3904
|
}, n, w);
|
|
3878
|
-
await C.documentSetAsset(o.id, i, a, t.name, n, w),
|
|
3905
|
+
await C.documentSetAsset(o.id, i, a, t.name, n, w), X(), k(o.id);
|
|
3879
3906
|
} catch (e) {
|
|
3880
|
-
|
|
3907
|
+
G(e instanceof Error ? e.message : String(e));
|
|
3881
3908
|
}
|
|
3882
3909
|
}
|
|
3883
3910
|
}, [
|
|
@@ -3887,21 +3914,21 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
3887
3914
|
w,
|
|
3888
3915
|
O,
|
|
3889
3916
|
Q,
|
|
3890
|
-
|
|
3917
|
+
X
|
|
3891
3918
|
]), Dt = t(async () => {
|
|
3892
3919
|
if (!C.documentCreateChunk) return;
|
|
3893
3920
|
let t = O || Q;
|
|
3894
3921
|
if (t) {
|
|
3895
|
-
|
|
3922
|
+
G(null);
|
|
3896
3923
|
try {
|
|
3897
3924
|
let r = await C.documentCreateChunk(e, t, {
|
|
3898
3925
|
title: "Diagram",
|
|
3899
3926
|
type: "mermaid",
|
|
3900
3927
|
body: "graph TD\n A[Start] --> B[End]"
|
|
3901
3928
|
}, n, w);
|
|
3902
|
-
|
|
3929
|
+
X(), k(r.id), B(r);
|
|
3903
3930
|
} catch (e) {
|
|
3904
|
-
|
|
3931
|
+
G(e instanceof Error ? e.message : String(e));
|
|
3905
3932
|
}
|
|
3906
3933
|
}
|
|
3907
3934
|
}, [
|
|
@@ -3911,20 +3938,20 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
3911
3938
|
w,
|
|
3912
3939
|
O,
|
|
3913
3940
|
Q,
|
|
3914
|
-
|
|
3941
|
+
X
|
|
3915
3942
|
]), jt = t(async () => {
|
|
3916
3943
|
if (!C.documentCreateChunk) return;
|
|
3917
3944
|
let t = O && !Ue ? O : void 0, r = O || Q;
|
|
3918
3945
|
if (r) {
|
|
3919
|
-
|
|
3946
|
+
G(null);
|
|
3920
3947
|
try {
|
|
3921
3948
|
let i = await C.documentCreateChunk(e, t ? "" : r, {
|
|
3922
3949
|
title: "Text",
|
|
3923
3950
|
body: ""
|
|
3924
3951
|
}, n, w, t);
|
|
3925
|
-
|
|
3952
|
+
X(), k(i.id), B(i);
|
|
3926
3953
|
} catch (e) {
|
|
3927
|
-
|
|
3954
|
+
G(e instanceof Error ? e.message : String(e));
|
|
3928
3955
|
}
|
|
3929
3956
|
}
|
|
3930
3957
|
}, [
|
|
@@ -3935,18 +3962,18 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
3935
3962
|
O,
|
|
3936
3963
|
Ue,
|
|
3937
3964
|
Q,
|
|
3938
|
-
|
|
3965
|
+
X
|
|
3939
3966
|
]), Mt = t(async () => {
|
|
3940
3967
|
if (C.documentCreateChunk && O) {
|
|
3941
|
-
|
|
3968
|
+
G(null);
|
|
3942
3969
|
try {
|
|
3943
3970
|
let t = await C.documentCreateChunk(e, O, {
|
|
3944
3971
|
title: "Text",
|
|
3945
3972
|
body: ""
|
|
3946
3973
|
}, n, w);
|
|
3947
|
-
|
|
3974
|
+
X(), k(t.id), B(t);
|
|
3948
3975
|
} catch (e) {
|
|
3949
|
-
|
|
3976
|
+
G(e instanceof Error ? e.message : String(e));
|
|
3950
3977
|
}
|
|
3951
3978
|
}
|
|
3952
3979
|
}, [
|
|
@@ -3955,7 +3982,7 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
3955
3982
|
n,
|
|
3956
3983
|
w,
|
|
3957
3984
|
O,
|
|
3958
|
-
|
|
3985
|
+
X
|
|
3959
3986
|
]), Nt = a(() => {
|
|
3960
3987
|
if (!A || Ue) return {
|
|
3961
3988
|
canUp: !1,
|
|
@@ -3972,11 +3999,11 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
3972
3999
|
Ue
|
|
3973
4000
|
]), Pt = t(async (e) => {
|
|
3974
4001
|
if (C.documentReorderChunk && O) {
|
|
3975
|
-
|
|
4002
|
+
G(null);
|
|
3976
4003
|
try {
|
|
3977
|
-
await C.documentReorderChunk(O, e, n, w),
|
|
4004
|
+
await C.documentReorderChunk(O, e, n, w), X();
|
|
3978
4005
|
} catch (e) {
|
|
3979
|
-
|
|
4006
|
+
G(e instanceof Error ? e.message : String(e));
|
|
3980
4007
|
}
|
|
3981
4008
|
}
|
|
3982
4009
|
}, [
|
|
@@ -3984,15 +4011,15 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
3984
4011
|
O,
|
|
3985
4012
|
n,
|
|
3986
4013
|
w,
|
|
3987
|
-
|
|
4014
|
+
X
|
|
3988
4015
|
]), Ft = t(async () => {
|
|
3989
4016
|
if (!C.documentDeleteChunk || !A) return;
|
|
3990
|
-
|
|
4017
|
+
G(null);
|
|
3991
4018
|
let e = A.parent_id;
|
|
3992
4019
|
try {
|
|
3993
|
-
await C.documentDeleteChunk(A.id, n, w),
|
|
4020
|
+
await C.documentDeleteChunk(A.id, n, w), W(!1), k(e || Q), X();
|
|
3994
4021
|
} catch (e) {
|
|
3995
|
-
|
|
4022
|
+
G(e instanceof Error ? e.message : String(e)), W(!1);
|
|
3996
4023
|
}
|
|
3997
4024
|
}, [
|
|
3998
4025
|
C,
|
|
@@ -4000,28 +4027,28 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
4000
4027
|
n,
|
|
4001
4028
|
w,
|
|
4002
4029
|
Q,
|
|
4003
|
-
|
|
4030
|
+
X
|
|
4004
4031
|
]);
|
|
4005
4032
|
return r(() => {
|
|
4006
4033
|
if (!Tt) return;
|
|
4007
4034
|
let e = (e) => {
|
|
4008
|
-
if (
|
|
4035
|
+
if (z || q) return;
|
|
4009
4036
|
let t = document.activeElement, n = t?.tagName;
|
|
4010
4037
|
if (n === "INPUT" || n === "TEXTAREA" || t?.isContentEditable) return;
|
|
4011
|
-
let r =
|
|
4038
|
+
let r = Fe(e.clipboardData?.items);
|
|
4012
4039
|
r && (e.preventDefault(), Et(r));
|
|
4013
4040
|
};
|
|
4014
4041
|
return window.addEventListener("paste", e), () => window.removeEventListener("paste", e);
|
|
4015
4042
|
}, [
|
|
4016
4043
|
Tt,
|
|
4017
|
-
|
|
4018
|
-
|
|
4044
|
+
z,
|
|
4045
|
+
q,
|
|
4019
4046
|
Et
|
|
4020
4047
|
]), /* @__PURE__ */ d("div", {
|
|
4021
4048
|
className: "doc-viewer",
|
|
4022
4049
|
children: [
|
|
4023
4050
|
/* @__PURE__ */ u("input", {
|
|
4024
|
-
ref:
|
|
4051
|
+
ref: R,
|
|
4025
4052
|
type: "file",
|
|
4026
4053
|
accept: "image/png,image/jpeg,image/gif,image/webp",
|
|
4027
4054
|
style: { display: "none" },
|
|
@@ -4062,7 +4089,7 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
4062
4089
|
}),
|
|
4063
4090
|
/* @__PURE__ */ u("button", {
|
|
4064
4091
|
type: "button",
|
|
4065
|
-
onClick: () =>
|
|
4092
|
+
onClick: () => R.current?.click(),
|
|
4066
4093
|
title: "Add an image chunk (upload — or paste a screenshot into the view)",
|
|
4067
4094
|
children: "+ image"
|
|
4068
4095
|
}),
|
|
@@ -4076,15 +4103,15 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
4076
4103
|
/* @__PURE__ */ u("button", {
|
|
4077
4104
|
type: "button",
|
|
4078
4105
|
className: qe ? "active" : "",
|
|
4079
|
-
onClick: () =>
|
|
4106
|
+
onClick: () => ye(!0),
|
|
4080
4107
|
disabled: !Q,
|
|
4081
4108
|
title: "Colors — tint chunk tiles + the Path tree by type/status",
|
|
4082
4109
|
children: "colors"
|
|
4083
4110
|
}),
|
|
4084
4111
|
C.documentClassify && /* @__PURE__ */ u("button", {
|
|
4085
4112
|
type: "button",
|
|
4086
|
-
className:
|
|
4087
|
-
onClick: () =>
|
|
4113
|
+
className: Ee > 0 ? "active" : "",
|
|
4114
|
+
onClick: () => De((e) => e > 0 ? 0 : 1),
|
|
4088
4115
|
title: "Classify — what this document is, by the confirmed ontology (a report first; nothing is written until Apply)",
|
|
4089
4116
|
children: "classify"
|
|
4090
4117
|
}),
|
|
@@ -4093,18 +4120,18 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
4093
4120
|
scope: n,
|
|
4094
4121
|
browse: w,
|
|
4095
4122
|
title: Z,
|
|
4096
|
-
onError:
|
|
4123
|
+
onError: G
|
|
4097
4124
|
}),
|
|
4098
4125
|
p && /* @__PURE__ */ u("button", {
|
|
4099
4126
|
type: "button",
|
|
4100
|
-
className:
|
|
4101
|
-
onClick: () =>
|
|
4127
|
+
className: ge ? "active" : "",
|
|
4128
|
+
onClick: () => _e((e) => !e),
|
|
4102
4129
|
title: "Document Assistant — instruct an agent to restructure/import/link chunks",
|
|
4103
4130
|
children: "assistant"
|
|
4104
4131
|
}),
|
|
4105
4132
|
/* @__PURE__ */ u("button", {
|
|
4106
4133
|
type: "button",
|
|
4107
|
-
onClick:
|
|
4134
|
+
onClick: X,
|
|
4108
4135
|
title: "Reload",
|
|
4109
4136
|
children: "↻"
|
|
4110
4137
|
})
|
|
@@ -4112,33 +4139,33 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
4112
4139
|
})
|
|
4113
4140
|
]
|
|
4114
4141
|
}),
|
|
4115
|
-
!Xe && Q && (
|
|
4142
|
+
!Xe && Q && (J.length > 0 || tt || nt) && /* @__PURE__ */ d("div", {
|
|
4116
4143
|
className: "doc-annotation",
|
|
4117
4144
|
children: [/* @__PURE__ */ u(St, { record: rt }), /* @__PURE__ */ u(wt, {
|
|
4118
|
-
records:
|
|
4145
|
+
records: J,
|
|
4119
4146
|
newLevel: ee(!0),
|
|
4120
4147
|
onSave: tt?.(Q),
|
|
4121
4148
|
onRegenerate: nt?.(Q)
|
|
4122
4149
|
}, Q)]
|
|
4123
4150
|
}),
|
|
4124
|
-
|
|
4151
|
+
oe && /* @__PURE__ */ u("div", {
|
|
4125
4152
|
className: "paths-err",
|
|
4126
|
-
children:
|
|
4153
|
+
children: oe
|
|
4127
4154
|
}),
|
|
4128
4155
|
!Xe && /* @__PURE__ */ u(Wt, {
|
|
4129
4156
|
documentId: e,
|
|
4130
4157
|
scope: n,
|
|
4131
4158
|
browse: w,
|
|
4132
|
-
rootFields:
|
|
4133
|
-
requestKey:
|
|
4134
|
-
onClose: () =>
|
|
4135
|
-
onChanged:
|
|
4159
|
+
rootFields: ke,
|
|
4160
|
+
requestKey: Ee,
|
|
4161
|
+
onClose: () => De(0),
|
|
4162
|
+
onChanged: X
|
|
4136
4163
|
}, `${n}:${e}`),
|
|
4137
4164
|
Xe ? /* @__PURE__ */ u(gn, {
|
|
4138
4165
|
documentId: e,
|
|
4139
4166
|
scope: n,
|
|
4140
|
-
detail:
|
|
4141
|
-
}) : /* @__PURE__ */ d(
|
|
4167
|
+
detail: fe ?? void 0
|
|
4168
|
+
}) : /* @__PURE__ */ d(je, {
|
|
4142
4169
|
className: "doc-split",
|
|
4143
4170
|
defaultLeftWidth: 320,
|
|
4144
4171
|
minLeftWidth: 160,
|
|
@@ -4146,15 +4173,15 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
4146
4173
|
storageKey: "loomcycle.explorer.split.doc",
|
|
4147
4174
|
children: [/* @__PURE__ */ u("div", {
|
|
4148
4175
|
className: "doc-chunktree",
|
|
4149
|
-
children:
|
|
4176
|
+
children: ce && T.length === 0 ? /* @__PURE__ */ u("div", {
|
|
4150
4177
|
className: "empty",
|
|
4151
4178
|
children: /* @__PURE__ */ u("p", { children: "Loading…" })
|
|
4152
4179
|
}) : /* @__PURE__ */ u(yt, {
|
|
4153
|
-
tree:
|
|
4180
|
+
tree: He,
|
|
4154
4181
|
selectedId: O,
|
|
4155
4182
|
onSelect: xt,
|
|
4156
4183
|
colorEnabled: qe,
|
|
4157
|
-
scheme:
|
|
4184
|
+
scheme: K?.color_scheme,
|
|
4158
4185
|
documentColor: Ye,
|
|
4159
4186
|
linkedIds: Je
|
|
4160
4187
|
})
|
|
@@ -4249,18 +4276,18 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
4249
4276
|
/* @__PURE__ */ u("button", {
|
|
4250
4277
|
type: "button",
|
|
4251
4278
|
className: "chunk-edit",
|
|
4252
|
-
onClick: () =>
|
|
4279
|
+
onClick: () => B(A),
|
|
4253
4280
|
children: "edit"
|
|
4254
4281
|
}),
|
|
4255
4282
|
C.documentEntityTypes && v(A) && /* @__PURE__ */ u("button", {
|
|
4256
4283
|
type: "button",
|
|
4257
|
-
onClick: () =>
|
|
4284
|
+
onClick: () => H(A),
|
|
4258
4285
|
title: "Change this subject's type to another type in force",
|
|
4259
4286
|
children: "change type"
|
|
4260
4287
|
}),
|
|
4261
4288
|
/* @__PURE__ */ u("button", {
|
|
4262
4289
|
type: "button",
|
|
4263
|
-
onClick: () =>
|
|
4290
|
+
onClick: () => ie(!0),
|
|
4264
4291
|
title: "View this chunk's edit history + diffs",
|
|
4265
4292
|
children: "history"
|
|
4266
4293
|
}),
|
|
@@ -4280,7 +4307,7 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
4280
4307
|
!Ue && /* @__PURE__ */ u("button", {
|
|
4281
4308
|
type: "button",
|
|
4282
4309
|
className: "danger",
|
|
4283
|
-
onClick: () =>
|
|
4310
|
+
onClick: () => W(!0),
|
|
4284
4311
|
title: "Delete this chunk and its sub-chunks",
|
|
4285
4312
|
children: "delete"
|
|
4286
4313
|
})
|
|
@@ -4298,14 +4325,14 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
4298
4325
|
})] }) : /* @__PURE__ */ u("p", {
|
|
4299
4326
|
className: "doc-empty-body",
|
|
4300
4327
|
children: "(empty diagram)"
|
|
4301
|
-
}) : A.type === "image" || A.asset ?
|
|
4328
|
+
}) : A.type === "image" || A.asset ? L ? /* @__PURE__ */ d("p", {
|
|
4302
4329
|
className: "doc-empty-body",
|
|
4303
|
-
children: ["Image failed to load: ",
|
|
4330
|
+
children: ["Image failed to load: ", L]
|
|
4304
4331
|
}) : F ? /* @__PURE__ */ d("figure", {
|
|
4305
4332
|
className: "doc-image",
|
|
4306
4333
|
children: [/* @__PURE__ */ u("img", {
|
|
4307
4334
|
src: F,
|
|
4308
|
-
alt:
|
|
4335
|
+
alt: kn(A)
|
|
4309
4336
|
}), A.body && /* @__PURE__ */ u("figcaption", { children: A.body })]
|
|
4310
4337
|
}) : /* @__PURE__ */ u("p", {
|
|
4311
4338
|
className: "doc-empty-body",
|
|
@@ -4313,15 +4340,15 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
4313
4340
|
}) : M === "markdown" ? te === null ? /* @__PURE__ */ u("p", {
|
|
4314
4341
|
className: "doc-empty-body",
|
|
4315
4342
|
children: "Assembling Markdown…"
|
|
4316
|
-
}) : /* @__PURE__ */ u(
|
|
4343
|
+
}) : /* @__PURE__ */ u(Dn, { source: te }) : A.body ? /* @__PURE__ */ u(Dn, { source: A.body }) : /* @__PURE__ */ u("p", {
|
|
4317
4344
|
className: "doc-empty-body",
|
|
4318
4345
|
children: "(empty chunk)"
|
|
4319
4346
|
})
|
|
4320
4347
|
}), /* @__PURE__ */ d("div", {
|
|
4321
4348
|
className: "doc-links-pane",
|
|
4322
4349
|
children: [/* @__PURE__ */ u(sn, {
|
|
4323
|
-
edges:
|
|
4324
|
-
incomplete:
|
|
4350
|
+
edges: be,
|
|
4351
|
+
incomplete: Se,
|
|
4325
4352
|
documentId: e,
|
|
4326
4353
|
selectedId: O,
|
|
4327
4354
|
onSelectChunk: k,
|
|
@@ -4334,7 +4361,7 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
4334
4361
|
browse: w,
|
|
4335
4362
|
onSelectChunk: k,
|
|
4336
4363
|
onOpenDocument: h ? Ct : void 0,
|
|
4337
|
-
refreshKey:
|
|
4364
|
+
refreshKey: we,
|
|
4338
4365
|
review: ft
|
|
4339
4366
|
})]
|
|
4340
4367
|
})]
|
|
@@ -4344,50 +4371,50 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
4344
4371
|
})
|
|
4345
4372
|
})]
|
|
4346
4373
|
}),
|
|
4347
|
-
|
|
4374
|
+
ge && p && /* @__PURE__ */ u("div", {
|
|
4348
4375
|
className: "doc-assistant",
|
|
4349
4376
|
children: p({
|
|
4350
4377
|
documentId: e,
|
|
4351
4378
|
scope: n,
|
|
4352
4379
|
subject: f?.subject,
|
|
4353
|
-
onChanged:
|
|
4380
|
+
onChanged: X
|
|
4354
4381
|
})
|
|
4355
4382
|
}),
|
|
4356
|
-
|
|
4357
|
-
chunk:
|
|
4383
|
+
z && /* @__PURE__ */ u(kt, {
|
|
4384
|
+
chunk: z,
|
|
4358
4385
|
scope: n,
|
|
4359
4386
|
browse: w,
|
|
4360
|
-
onClose: () =>
|
|
4361
|
-
onSaved:
|
|
4387
|
+
onClose: () => B(null),
|
|
4388
|
+
onSaved: X
|
|
4362
4389
|
}),
|
|
4363
|
-
|
|
4364
|
-
chunk:
|
|
4390
|
+
V && /* @__PURE__ */ u(At, {
|
|
4391
|
+
chunk: V,
|
|
4365
4392
|
scope: n,
|
|
4366
4393
|
browse: w,
|
|
4367
|
-
onClose: () =>
|
|
4368
|
-
onSaved:
|
|
4394
|
+
onClose: () => H(null),
|
|
4395
|
+
onSaved: X
|
|
4369
4396
|
}),
|
|
4370
|
-
|
|
4397
|
+
U && A && /* @__PURE__ */ u(Sn, {
|
|
4371
4398
|
chunkId: A.id,
|
|
4372
4399
|
chunkTitle: A.title,
|
|
4373
4400
|
scope: n,
|
|
4374
4401
|
browse: w,
|
|
4375
|
-
onClose: () =>
|
|
4402
|
+
onClose: () => ie(!1)
|
|
4376
4403
|
}),
|
|
4377
|
-
|
|
4404
|
+
q && Q && /* @__PURE__ */ u(qt, {
|
|
4378
4405
|
documentId: e,
|
|
4379
4406
|
rootChunkId: Q,
|
|
4380
|
-
docType:
|
|
4381
|
-
docStatus:
|
|
4407
|
+
docType: K?.type,
|
|
4408
|
+
docStatus: K?.status,
|
|
4382
4409
|
chunkStatuses: Ke,
|
|
4383
4410
|
scope: n,
|
|
4384
4411
|
browse: w,
|
|
4385
|
-
onClose: () =>
|
|
4386
|
-
onSaved:
|
|
4412
|
+
onClose: () => ye(!1),
|
|
4413
|
+
onSaved: X
|
|
4387
4414
|
}),
|
|
4388
|
-
|
|
4415
|
+
ae && A && /* @__PURE__ */ u("div", {
|
|
4389
4416
|
className: "modal-overlay",
|
|
4390
|
-
onClick: () =>
|
|
4417
|
+
onClick: () => W(!1),
|
|
4391
4418
|
children: /* @__PURE__ */ d("div", {
|
|
4392
4419
|
className: "modal chunk-delete-confirm",
|
|
4393
4420
|
onClick: (e) => e.stopPropagation(),
|
|
@@ -4405,7 +4432,7 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
4405
4432
|
className: "modal-buttons",
|
|
4406
4433
|
children: [/* @__PURE__ */ u("button", {
|
|
4407
4434
|
type: "button",
|
|
4408
|
-
onClick: () =>
|
|
4435
|
+
onClick: () => W(!1),
|
|
4409
4436
|
children: "cancel"
|
|
4410
4437
|
}), /* @__PURE__ */ u("button", {
|
|
4411
4438
|
type: "button",
|
|
@@ -4421,7 +4448,7 @@ function Dn({ documentId: e, scope: n, titleHint: i, browse: c, principal: f, re
|
|
|
4421
4448
|
});
|
|
4422
4449
|
}
|
|
4423
4450
|
// src/components/PathTree.tsx
|
|
4424
|
-
function
|
|
4451
|
+
function jn(e, t = "") {
|
|
4425
4452
|
let n = e.get(t);
|
|
4426
4453
|
if (!n) return [];
|
|
4427
4454
|
let r = n.entries.map((n) => {
|
|
@@ -4433,7 +4460,7 @@ function On(e, t = "") {
|
|
|
4433
4460
|
resourceRef: n.resource_ref,
|
|
4434
4461
|
...r ? { hasChildren: r } : {},
|
|
4435
4462
|
listing: i ? e.get(n.full_path) : void 0,
|
|
4436
|
-
children: i ?
|
|
4463
|
+
children: i ? jn(e, n.full_path) : []
|
|
4437
4464
|
};
|
|
4438
4465
|
});
|
|
4439
4466
|
return r.sort((e, t) => {
|
|
@@ -4441,23 +4468,23 @@ function On(e, t = "") {
|
|
|
4441
4468
|
return n === (t.kind === "directory") ? e.name.localeCompare(t.name) : n ? -1 : 1;
|
|
4442
4469
|
}), r;
|
|
4443
4470
|
}
|
|
4444
|
-
var
|
|
4471
|
+
var Mn = {
|
|
4445
4472
|
directory: "📁",
|
|
4446
4473
|
document: "📄",
|
|
4447
4474
|
volume_mount: "💾",
|
|
4448
4475
|
memory_entry: "🧠"
|
|
4449
|
-
},
|
|
4450
|
-
function
|
|
4476
|
+
}, Nn = "📝";
|
|
4477
|
+
function Pn(e) {
|
|
4451
4478
|
return e.kind === "document" && e.name === "_annotation";
|
|
4452
4479
|
}
|
|
4453
|
-
function
|
|
4480
|
+
function Fn(e, t) {
|
|
4454
4481
|
if (e.kind === "directory") {
|
|
4455
|
-
let n = e.children.find(
|
|
4456
|
-
return n &&
|
|
4482
|
+
let n = e.children.find(Pn);
|
|
4483
|
+
return n && Rn(n, t)?.brief || void 0;
|
|
4457
4484
|
}
|
|
4458
|
-
if (!
|
|
4485
|
+
if (!Pn(e)) return Rn(e, t)?.brief || void 0;
|
|
4459
4486
|
}
|
|
4460
|
-
function
|
|
4487
|
+
function In(e) {
|
|
4461
4488
|
let { tree: t, root: n } = e;
|
|
4462
4489
|
return !n || !n.loaded && n.loading ? /* @__PURE__ */ u("div", {
|
|
4463
4490
|
className: "empty",
|
|
@@ -4467,17 +4494,17 @@ function Nn(e) {
|
|
|
4467
4494
|
children: /* @__PURE__ */ u("p", { children: "This tree is empty. Create a folder or document to begin." })
|
|
4468
4495
|
}) : /* @__PURE__ */ d("ul", {
|
|
4469
4496
|
className: "tree path-tree",
|
|
4470
|
-
children: [t.map((t) => /* @__PURE__ */ u(
|
|
4497
|
+
children: [t.map((t) => /* @__PURE__ */ u(zn, {
|
|
4471
4498
|
node: t,
|
|
4472
4499
|
...e
|
|
4473
|
-
}, t.fullPath)), /* @__PURE__ */ u(
|
|
4500
|
+
}, t.fullPath)), /* @__PURE__ */ u(Ln, {
|
|
4474
4501
|
dir: "",
|
|
4475
4502
|
listing: n,
|
|
4476
4503
|
...e
|
|
4477
4504
|
})]
|
|
4478
4505
|
});
|
|
4479
4506
|
}
|
|
4480
|
-
function
|
|
4507
|
+
function Ln({ dir: e, listing: t, onLoadMore: n, onRetry: r }) {
|
|
4481
4508
|
let i = [];
|
|
4482
4509
|
return !t || t.loading && t.entries.length === 0 ? i.push(/* @__PURE__ */ u("li", {
|
|
4483
4510
|
className: "node path-status",
|
|
@@ -4517,13 +4544,13 @@ function Pn({ dir: e, listing: t, onLoadMore: n, onRetry: r }) {
|
|
|
4517
4544
|
})
|
|
4518
4545
|
}, "more")), /* @__PURE__ */ u(l, { children: i });
|
|
4519
4546
|
}
|
|
4520
|
-
function
|
|
4547
|
+
function Rn(e, t) {
|
|
4521
4548
|
if (e.kind !== "document" || !t) return;
|
|
4522
4549
|
let n = e.resourceRef;
|
|
4523
4550
|
return n?.document_id ? t.get(n.document_id) : void 0;
|
|
4524
4551
|
}
|
|
4525
|
-
function
|
|
4526
|
-
let { node: t, expanded: n, onToggle: r, selectedPath: i, onSelect: a, summaries: o } = e, s = t.kind === "directory" || t.hasChildren === !0, c = s && n.has(t.fullPath), l = i === t.fullPath, f =
|
|
4552
|
+
function zn(e) {
|
|
4553
|
+
let { node: t, expanded: n, onToggle: r, selectedPath: i, onSelect: a, summaries: o } = e, s = t.kind === "directory" || t.hasChildren === !0, c = s && n.has(t.fullPath), l = i === t.fullPath, f = Rn(t, o), p = Fn(t, o), m = f && f.color_enabled ? dt(st(f.type, f.status, at(f.color_scheme))) : void 0;
|
|
4527
4554
|
return /* @__PURE__ */ d("li", {
|
|
4528
4555
|
className: `node path-node kind-${t.kind} ${l ? "selected" : ""}`,
|
|
4529
4556
|
children: [/* @__PURE__ */ d("div", {
|
|
@@ -4550,7 +4577,7 @@ function In(e) {
|
|
|
4550
4577
|
/* @__PURE__ */ u("span", {
|
|
4551
4578
|
className: "path-kind-icon",
|
|
4552
4579
|
"aria-hidden": !0,
|
|
4553
|
-
children:
|
|
4580
|
+
children: Pn(t) ? Nn : Mn[t.kind] ?? "•"
|
|
4554
4581
|
}),
|
|
4555
4582
|
/* @__PURE__ */ u("span", {
|
|
4556
4583
|
className: "path-name",
|
|
@@ -4573,10 +4600,10 @@ function In(e) {
|
|
|
4573
4600
|
]
|
|
4574
4601
|
}), c && /* @__PURE__ */ d("ul", {
|
|
4575
4602
|
className: "children path-children",
|
|
4576
|
-
children: [t.children.map((t) => /* @__PURE__ */ u(
|
|
4603
|
+
children: [t.children.map((t) => /* @__PURE__ */ u(zn, {
|
|
4577
4604
|
...e,
|
|
4578
4605
|
node: t
|
|
4579
|
-
}, t.fullPath)), /* @__PURE__ */ u(
|
|
4606
|
+
}, t.fullPath)), /* @__PURE__ */ u(Ln, {
|
|
4580
4607
|
...e,
|
|
4581
4608
|
dir: t.fullPath,
|
|
4582
4609
|
listing: t.listing
|
|
@@ -4585,23 +4612,23 @@ function In(e) {
|
|
|
4585
4612
|
});
|
|
4586
4613
|
}
|
|
4587
4614
|
// src/PathExplorer.tsx
|
|
4588
|
-
var
|
|
4589
|
-
function
|
|
4615
|
+
var Bn = /^[A-Za-z0-9._-]+$/;
|
|
4616
|
+
function Vn(e, t) {
|
|
4590
4617
|
return `${e}/${t}`;
|
|
4591
4618
|
}
|
|
4592
|
-
function
|
|
4619
|
+
function Hn(e, t) {
|
|
4593
4620
|
for (let n of e) {
|
|
4594
4621
|
if (n.fullPath === t) return n;
|
|
4595
|
-
let e =
|
|
4622
|
+
let e = Hn(n.children, t);
|
|
4596
4623
|
if (e) return e;
|
|
4597
4624
|
}
|
|
4598
4625
|
}
|
|
4599
|
-
function
|
|
4600
|
-
let { theme: t, defaultScope: n, path: r, onPathChange: i, browse: a, principal: o, renderAssistant: s, renderNavigator: c, navigator: l, onError: d, onRegenerateAnnotation: f, canEditAnnotations: p } = e, m =
|
|
4601
|
-
return /* @__PURE__ */ u(
|
|
4626
|
+
function Un(e) {
|
|
4627
|
+
let { theme: t, defaultScope: n, path: r, onPathChange: i, browse: a, principal: o, renderAssistant: s, renderNavigator: c, navigator: l, onError: d, onRegenerateAnnotation: f, canEditAnnotations: p } = e, m = q(e);
|
|
4628
|
+
return /* @__PURE__ */ u(ye, {
|
|
4602
4629
|
theme: t,
|
|
4603
4630
|
dataLayer: m,
|
|
4604
|
-
children: /* @__PURE__ */ u(
|
|
4631
|
+
children: /* @__PURE__ */ u(Wn, {
|
|
4605
4632
|
defaultScope: n,
|
|
4606
4633
|
path: r,
|
|
4607
4634
|
onPathChange: i,
|
|
@@ -4616,8 +4643,8 @@ function Bn(e) {
|
|
|
4616
4643
|
})
|
|
4617
4644
|
});
|
|
4618
4645
|
}
|
|
4619
|
-
function
|
|
4620
|
-
let S =
|
|
4646
|
+
function Wn({ defaultScope: e, path: n, onPathChange: i, browse: f, principal: p, renderAssistant: m, renderNavigator: h, navigator: v, onError: y, onRegenerateAnnotation: b, canEditAnnotations: x }) {
|
|
4647
|
+
let S = se(), [C, w] = s(e ?? "user"), [T, E] = s(void 0), [D, O] = s(null), [k, A] = s(null), [j, M] = s(null), [N, ee] = s(() => /* @__PURE__ */ new Set()), P = n === void 0 ? T : n, te = o(i);
|
|
4621
4648
|
r(() => {
|
|
4622
4649
|
te.current = i;
|
|
4623
4650
|
}, [i]);
|
|
@@ -4625,67 +4652,67 @@ function Vn({ defaultScope: e, path: n, onPathChange: i, browse: f, principal: p
|
|
|
4625
4652
|
r(() => {
|
|
4626
4653
|
ne.current = y;
|
|
4627
4654
|
}, [y]);
|
|
4628
|
-
let [F, I] = s([]),
|
|
4629
|
-
|
|
4630
|
-
}, []),
|
|
4631
|
-
|
|
4632
|
-
}, [
|
|
4655
|
+
let [F, I] = s([]), L = o(0), re = o(void 0), R = t((e) => {
|
|
4656
|
+
re.current = e, te.current?.(e), E(e);
|
|
4657
|
+
}, []), z = t((e) => {
|
|
4658
|
+
L.current++, I((e) => e.length > 0 ? [] : e), R(e);
|
|
4659
|
+
}, [R]);
|
|
4633
4660
|
r(() => {
|
|
4634
|
-
n !== void 0 && n !==
|
|
4661
|
+
n !== void 0 && n !== re.current && (L.current++, I((e) => e.length > 0 ? [] : e));
|
|
4635
4662
|
}, [n]);
|
|
4636
|
-
let
|
|
4663
|
+
let B = a(() => f && (f.scopeId || f.tenant) ? {
|
|
4637
4664
|
scopeId: f.scopeId,
|
|
4638
4665
|
tenant: f.tenant
|
|
4639
|
-
} : void 0, [f?.scopeId, f?.tenant]),
|
|
4666
|
+
} : void 0, [f?.scopeId, f?.tenant]), V = a(() => new pe(S, C, B), [
|
|
4640
4667
|
S,
|
|
4641
4668
|
C,
|
|
4642
|
-
|
|
4643
|
-
]),
|
|
4669
|
+
B
|
|
4670
|
+
]), H = c(V.subscribe, V.getSnapshot), U = t((e) => {
|
|
4644
4671
|
ne.current?.(e);
|
|
4645
|
-
}, []), [
|
|
4646
|
-
|
|
4647
|
-
}, []), [
|
|
4672
|
+
}, []), [ie, ae] = s(() => h ? g(globalThis.localStorage) : "tree"), W = !!h && ie === "stars", oe = t((e) => {
|
|
4673
|
+
ae(e), _(globalThis.localStorage, e), e === "tree" && ce(!1);
|
|
4674
|
+
}, []), [G, ce] = s(!1), [de, fe] = s(0);
|
|
4648
4675
|
r(() => {
|
|
4649
|
-
h && v &&
|
|
4676
|
+
h && v && oe(v);
|
|
4650
4677
|
}, [v]);
|
|
4651
|
-
let [
|
|
4652
|
-
|
|
4653
|
-
}, []),
|
|
4678
|
+
let [ge, _e] = s(), [K, ve] = s(), q = t((e, t) => (fe((e) => e + 1), V.invalidate(e, t)), [V]), [ye, Ce] = s(() => /* @__PURE__ */ new Map()), Te = o(/* @__PURE__ */ new Set()), De = o(0), Oe = t(() => {
|
|
4679
|
+
De.current++, Te.current = /* @__PURE__ */ new Set(), Ce(/* @__PURE__ */ new Map());
|
|
4680
|
+
}, []), J = o(!0);
|
|
4654
4681
|
r(() => {
|
|
4655
|
-
|
|
4682
|
+
J.current ? J.current = !1 : (z(void 0), O(null), ee(/* @__PURE__ */ new Set()), Oe()), V.loadDir("").catch(U);
|
|
4656
4683
|
}, [
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4684
|
+
V,
|
|
4685
|
+
z,
|
|
4686
|
+
Oe,
|
|
4687
|
+
U
|
|
4661
4688
|
]), r(() => {
|
|
4662
|
-
for (let e of N)
|
|
4689
|
+
for (let e of N) H.has(e) || V.loadDir(e).catch(U);
|
|
4663
4690
|
}, [
|
|
4664
|
-
B,
|
|
4665
|
-
N,
|
|
4666
4691
|
V,
|
|
4667
|
-
|
|
4692
|
+
N,
|
|
4693
|
+
H,
|
|
4694
|
+
U
|
|
4668
4695
|
]);
|
|
4669
|
-
let
|
|
4696
|
+
let Me = o(null);
|
|
4670
4697
|
r(() => {
|
|
4671
|
-
let e =
|
|
4672
|
-
if (
|
|
4673
|
-
let t =
|
|
4698
|
+
let e = Me.current !== null && Me.current !== V;
|
|
4699
|
+
if (Me.current = V, !P || e) return;
|
|
4700
|
+
let t = ue(P).filter((e) => e !== "");
|
|
4674
4701
|
ee((e) => {
|
|
4675
4702
|
if (t.every((t) => e.has(t))) return e;
|
|
4676
4703
|
let n = new Set(e);
|
|
4677
4704
|
return t.forEach((e) => n.add(e)), n;
|
|
4678
|
-
}),
|
|
4705
|
+
}), V.reveal(P).catch(U);
|
|
4679
4706
|
}, [
|
|
4680
|
-
|
|
4707
|
+
V,
|
|
4681
4708
|
P,
|
|
4682
|
-
|
|
4709
|
+
U
|
|
4683
4710
|
]), r(() => {
|
|
4684
4711
|
let e = [];
|
|
4685
|
-
for (let t of
|
|
4686
|
-
let t =
|
|
4687
|
-
for (let n = 0; n < e.length; n += 500) S.documentsSummary({ documentIds: e.slice(n, n + 500) }, C,
|
|
4688
|
-
|
|
4712
|
+
for (let t of H.values()) for (let n of he(t.entries)) Te.current.has(n) || (Te.current.add(n), e.push(n));
|
|
4713
|
+
let t = De.current;
|
|
4714
|
+
for (let n = 0; n < e.length; n += 500) S.documentsSummary({ documentIds: e.slice(n, n + 500) }, C, B).then((e) => {
|
|
4715
|
+
De.current === t && Ce((t) => {
|
|
4689
4716
|
let n = new Map(t);
|
|
4690
4717
|
for (let t of e.documents ?? []) n.set(t.document_id, t);
|
|
4691
4718
|
return n;
|
|
@@ -4693,32 +4720,32 @@ function Vn({ defaultScope: e, path: n, onPathChange: i, browse: f, principal: p
|
|
|
4693
4720
|
}).catch(() => {});
|
|
4694
4721
|
}, [
|
|
4695
4722
|
S,
|
|
4696
|
-
|
|
4723
|
+
H,
|
|
4697
4724
|
C,
|
|
4698
|
-
|
|
4725
|
+
B
|
|
4699
4726
|
]);
|
|
4700
|
-
let
|
|
4701
|
-
O(null),
|
|
4727
|
+
let Ne = a(() => jn(H), [H]), Pe = t(async () => {
|
|
4728
|
+
O(null), Oe(), fe((e) => e + 1), await V.refresh(N).catch(U), P && await V.reveal(P).catch(U);
|
|
4702
4729
|
}, [
|
|
4703
|
-
|
|
4730
|
+
V,
|
|
4704
4731
|
N,
|
|
4705
4732
|
P,
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
]),
|
|
4733
|
+
Oe,
|
|
4734
|
+
U
|
|
4735
|
+
]), Fe = t((e) => {
|
|
4709
4736
|
ee((t) => {
|
|
4710
4737
|
let n = new Set(t);
|
|
4711
4738
|
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
4712
4739
|
});
|
|
4713
|
-
}, []),
|
|
4714
|
-
(
|
|
4715
|
-
}, [
|
|
4740
|
+
}, []), Ie = t((e) => V.loadMore(e).catch(U), [V, U]), Le = t((e) => {
|
|
4741
|
+
(V.getSnapshot().get(e)?.loaded ? V.loadMore(e) : V.loadDir(e)).catch(U);
|
|
4742
|
+
}, [V, U]), Y = a(() => P ? Hn(Ne, P) : void 0, [Ne, P]), Re = H.get("")?.error, ze = Y?.kind === "directory" ? Y.fullPath : void 0, [X, Be] = s(null);
|
|
4716
4743
|
r(() => {
|
|
4717
|
-
if (!
|
|
4744
|
+
if (!ze || !S.pathIsStored) return;
|
|
4718
4745
|
let e = !1;
|
|
4719
|
-
return S.pathIsStored(
|
|
4720
|
-
e ||
|
|
4721
|
-
path:
|
|
4746
|
+
return S.pathIsStored(ze, C, B).then((t) => {
|
|
4747
|
+
e || Be({
|
|
4748
|
+
path: ze,
|
|
4722
4749
|
explicit: t
|
|
4723
4750
|
});
|
|
4724
4751
|
}, () => {}), () => {
|
|
@@ -4726,11 +4753,11 @@ function Vn({ defaultScope: e, path: n, onPathChange: i, browse: f, principal: p
|
|
|
4726
4753
|
};
|
|
4727
4754
|
}, [
|
|
4728
4755
|
S,
|
|
4729
|
-
|
|
4756
|
+
ze,
|
|
4730
4757
|
C,
|
|
4731
|
-
|
|
4758
|
+
B
|
|
4732
4759
|
]);
|
|
4733
|
-
let
|
|
4760
|
+
let Ve = Y ? Y.kind === "directory" ? X?.path === Y.fullPath ? X.explicit ? "yes" : "implicit (no entry)" : void 0 : "yes" : void 0, He = a(() => Y ? Y.kind === "directory" ? Y.fullPath : le(Y.fullPath) : "", [Y]), Z = He || "/", Ue = t(() => {
|
|
4734
4761
|
A({
|
|
4735
4762
|
title: `New folder in ${Z}`,
|
|
4736
4763
|
fields: [{
|
|
@@ -4741,20 +4768,20 @@ function Vn({ defaultScope: e, path: n, onPathChange: i, browse: f, principal: p
|
|
|
4741
4768
|
submitLabel: "Create",
|
|
4742
4769
|
onSubmit: async (e) => {
|
|
4743
4770
|
let t = e.name.trim();
|
|
4744
|
-
if (!
|
|
4745
|
-
let n =
|
|
4746
|
-
await S.pathMkdir(n, C,
|
|
4771
|
+
if (!Bn.test(t)) throw Error("name may contain only [A-Za-z0-9._-]");
|
|
4772
|
+
let n = Vn(He, t);
|
|
4773
|
+
await S.pathMkdir(n, C, B), await q(n).catch(U), z(n);
|
|
4747
4774
|
}
|
|
4748
4775
|
});
|
|
4749
4776
|
}, [
|
|
4750
4777
|
S,
|
|
4751
|
-
|
|
4752
|
-
|
|
4778
|
+
V,
|
|
4779
|
+
He,
|
|
4753
4780
|
Z,
|
|
4754
4781
|
C,
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4782
|
+
B,
|
|
4783
|
+
U,
|
|
4784
|
+
z
|
|
4758
4785
|
]), We = t(() => {
|
|
4759
4786
|
A({
|
|
4760
4787
|
title: `New document in ${Z}`,
|
|
@@ -4770,70 +4797,70 @@ function Vn({ defaultScope: e, path: n, onPathChange: i, browse: f, principal: p
|
|
|
4770
4797
|
submitLabel: "Create",
|
|
4771
4798
|
onSubmit: async (e) => {
|
|
4772
4799
|
let t = e.name.trim();
|
|
4773
|
-
if (!
|
|
4774
|
-
let n = e.title.trim() || t, r =
|
|
4775
|
-
await S.documentCreate(n, r, C,
|
|
4800
|
+
if (!Bn.test(t)) throw Error("name may contain only [A-Za-z0-9._-]");
|
|
4801
|
+
let n = e.title.trim() || t, r = Vn(He, t);
|
|
4802
|
+
await S.documentCreate(n, r, C, B), await q(r).catch(U), z(r);
|
|
4776
4803
|
}
|
|
4777
4804
|
});
|
|
4778
4805
|
}, [
|
|
4779
4806
|
S,
|
|
4780
|
-
|
|
4781
|
-
|
|
4807
|
+
V,
|
|
4808
|
+
He,
|
|
4782
4809
|
Z,
|
|
4783
4810
|
C,
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4811
|
+
B,
|
|
4812
|
+
U,
|
|
4813
|
+
z
|
|
4787
4814
|
]), Q = t(() => {
|
|
4788
|
-
|
|
4789
|
-
title: `Rename / move ${
|
|
4815
|
+
Y && A({
|
|
4816
|
+
title: `Rename / move ${Y.fullPath}`,
|
|
4790
4817
|
fields: [{
|
|
4791
4818
|
key: "to",
|
|
4792
4819
|
label: "New path",
|
|
4793
|
-
value:
|
|
4820
|
+
value: Y.fullPath
|
|
4794
4821
|
}],
|
|
4795
4822
|
submitLabel: "Move",
|
|
4796
4823
|
onSubmit: async (e) => {
|
|
4797
4824
|
let t = e.to.trim();
|
|
4798
4825
|
if (!t.startsWith("/")) throw Error("path must start with /");
|
|
4799
|
-
await S.pathMv(
|
|
4826
|
+
await S.pathMv(Y.fullPath, t, C, B), await Promise.all([q(Y.fullPath, { dropSubtree: !0 }), q(t)]).catch(U), z(t);
|
|
4800
4827
|
}
|
|
4801
4828
|
});
|
|
4802
4829
|
}, [
|
|
4803
4830
|
S,
|
|
4804
|
-
|
|
4805
|
-
|
|
4831
|
+
V,
|
|
4832
|
+
Y,
|
|
4806
4833
|
C,
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4834
|
+
B,
|
|
4835
|
+
U,
|
|
4836
|
+
z
|
|
4810
4837
|
]), Ge = t(() => {
|
|
4811
|
-
if (!
|
|
4812
|
-
if (
|
|
4813
|
-
let e =
|
|
4838
|
+
if (!Y) return;
|
|
4839
|
+
if (Y.kind === "document") {
|
|
4840
|
+
let e = Y.resourceRef?.document_id;
|
|
4814
4841
|
A({
|
|
4815
|
-
title: `Delete document ${
|
|
4842
|
+
title: `Delete document ${Y.fullPath}`,
|
|
4816
4843
|
message: "This deletes the document, all its chunks, and its path entry. This cannot be undone.",
|
|
4817
4844
|
fields: [],
|
|
4818
4845
|
submitLabel: "Delete",
|
|
4819
4846
|
danger: !0,
|
|
4820
4847
|
onSubmit: async () => {
|
|
4821
4848
|
if (!e) throw Error("this document dirent has no document_id");
|
|
4822
|
-
await S.documentDelete(e, C,
|
|
4849
|
+
await S.documentDelete(e, C, B), await q(Y.fullPath).catch(U), z(void 0);
|
|
4823
4850
|
}
|
|
4824
4851
|
});
|
|
4825
4852
|
return;
|
|
4826
4853
|
}
|
|
4827
|
-
let e =
|
|
4854
|
+
let e = Y;
|
|
4828
4855
|
O(null), (async () => {
|
|
4829
4856
|
let t;
|
|
4830
4857
|
try {
|
|
4831
|
-
t = await
|
|
4858
|
+
t = await me(S, e.fullPath, C, B);
|
|
4832
4859
|
} catch (t) {
|
|
4833
4860
|
O(`could not list ${e.fullPath} for delete: ${t instanceof Error ? t.message : String(t)}`);
|
|
4834
4861
|
return;
|
|
4835
4862
|
}
|
|
4836
|
-
let n =
|
|
4863
|
+
let n = he(t);
|
|
4837
4864
|
A({
|
|
4838
4865
|
title: `Delete branch ${e.fullPath}`,
|
|
4839
4866
|
message: t.length === 0 ? "This removes the (empty) folder." : "This removes the folder and everything under it" + (n.length > 0 ? ` — including ${n.length} document(s), whose chunks are deleted.` : "."),
|
|
@@ -4841,117 +4868,117 @@ function Vn({ defaultScope: e, path: n, onPathChange: i, browse: f, principal: p
|
|
|
4841
4868
|
submitLabel: "Delete",
|
|
4842
4869
|
danger: !0,
|
|
4843
4870
|
onSubmit: async () => {
|
|
4844
|
-
for (let e of n) await S.documentDelete(e, C,
|
|
4845
|
-
await S.pathRm(e.fullPath, C, !0,
|
|
4871
|
+
for (let e of n) await S.documentDelete(e, C, B);
|
|
4872
|
+
await S.pathRm(e.fullPath, C, !0, B), await q(e.fullPath, { dropSubtree: !0 }).catch(U), z(void 0);
|
|
4846
4873
|
}
|
|
4847
4874
|
});
|
|
4848
4875
|
})();
|
|
4849
4876
|
}, [
|
|
4850
4877
|
S,
|
|
4851
|
-
|
|
4852
|
-
|
|
4878
|
+
V,
|
|
4879
|
+
Y,
|
|
4853
4880
|
C,
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
]), Ke =
|
|
4858
|
-
if (
|
|
4859
|
-
if (
|
|
4860
|
-
let e =
|
|
4881
|
+
B,
|
|
4882
|
+
U,
|
|
4883
|
+
z
|
|
4884
|
+
]), Ke = Y && (Y.kind === "directory" || Y.kind === "document"), qe = !!S.documentsTransfer && !!Ke, Je = t(() => {
|
|
4885
|
+
if (Y) {
|
|
4886
|
+
if (Y.kind === "document") {
|
|
4887
|
+
let e = Y.resourceRef?.document_id;
|
|
4861
4888
|
if (!e) {
|
|
4862
4889
|
O("this document entry has no document_id");
|
|
4863
4890
|
return;
|
|
4864
4891
|
}
|
|
4865
4892
|
M({
|
|
4866
4893
|
documentId: e,
|
|
4867
|
-
fromPath:
|
|
4894
|
+
fromPath: Y.fullPath
|
|
4868
4895
|
});
|
|
4869
4896
|
} else M({
|
|
4870
|
-
underPath:
|
|
4871
|
-
fromPath:
|
|
4897
|
+
underPath: Y.fullPath,
|
|
4898
|
+
fromPath: Y.fullPath
|
|
4872
4899
|
});
|
|
4873
4900
|
}
|
|
4874
|
-
}, [
|
|
4875
|
-
e.op === "move" ? (
|
|
4901
|
+
}, [Y]), Ye = t((e) => {
|
|
4902
|
+
e.op === "move" ? (q(e.from, { dropSubtree: !0 }).catch(U), I([]), z(void 0)) : e.toScope === C && q(e.to).catch(U);
|
|
4876
4903
|
}, [
|
|
4877
|
-
|
|
4878
|
-
|
|
4904
|
+
q,
|
|
4905
|
+
U,
|
|
4879
4906
|
C,
|
|
4880
|
-
|
|
4907
|
+
z
|
|
4881
4908
|
]), $ = a(() => {
|
|
4882
4909
|
if (F.length > 0) return F[F.length - 1];
|
|
4883
|
-
if (
|
|
4884
|
-
documentId:
|
|
4885
|
-
path:
|
|
4886
|
-
title:
|
|
4910
|
+
if (Y?.kind === "document") return {
|
|
4911
|
+
documentId: Y.resourceRef?.document_id ?? "",
|
|
4912
|
+
path: Y.fullPath,
|
|
4913
|
+
title: Y.name
|
|
4887
4914
|
};
|
|
4888
|
-
}, [F,
|
|
4889
|
-
let n = ++
|
|
4890
|
-
I(
|
|
4915
|
+
}, [F, Y]), Xe = t((e, t) => {
|
|
4916
|
+
let n = ++L.current, r = Ee(V.getSnapshot(), e.documentId);
|
|
4917
|
+
I(be(F, {
|
|
4891
4918
|
...t,
|
|
4892
4919
|
path: $?.path
|
|
4893
4920
|
}, {
|
|
4894
4921
|
...e,
|
|
4895
4922
|
path: r
|
|
4896
|
-
})),
|
|
4897
|
-
t &&
|
|
4923
|
+
})), R(r), !r && S.documentPath && S.documentPath(e.documentId, C, B).then((t) => {
|
|
4924
|
+
t && L.current === n && (I((n) => Se(n, e.documentId, { path: t })), R(t));
|
|
4898
4925
|
}, () => {});
|
|
4899
4926
|
}, [
|
|
4900
4927
|
S,
|
|
4901
|
-
|
|
4928
|
+
V,
|
|
4902
4929
|
F,
|
|
4903
4930
|
$?.path,
|
|
4904
4931
|
C,
|
|
4905
|
-
|
|
4906
|
-
|
|
4932
|
+
B,
|
|
4933
|
+
R
|
|
4907
4934
|
]), Ze = t((e) => {
|
|
4908
|
-
let t =
|
|
4909
|
-
t !== F && (
|
|
4910
|
-
}, [F,
|
|
4911
|
-
|
|
4935
|
+
let t = xe(F, e);
|
|
4936
|
+
t !== F && (L.current++, I(t), R(t[t.length - 1].path));
|
|
4937
|
+
}, [F, R]), Qe = t((e, t) => I((n) => Se(n, e, { title: t })), []), $e = t((e) => {
|
|
4938
|
+
ve((t) => ({
|
|
4912
4939
|
documentId: e.documentId,
|
|
4913
4940
|
chunkId: e.chunkId,
|
|
4914
4941
|
seq: (t?.seq ?? 0) + 1
|
|
4915
|
-
})), $?.documentId !== e.documentId && (e.path ?
|
|
4942
|
+
})), $?.documentId !== e.documentId && (e.path ? z(e.path) : (L.current++, I([{
|
|
4916
4943
|
documentId: e.documentId,
|
|
4917
4944
|
chunkId: e.chunkId
|
|
4918
|
-
}]),
|
|
4945
|
+
}]), R(void 0)));
|
|
4919
4946
|
}, [
|
|
4920
4947
|
$?.documentId,
|
|
4921
|
-
|
|
4922
|
-
|
|
4948
|
+
z,
|
|
4949
|
+
R
|
|
4923
4950
|
]), et = a(() => ({
|
|
4924
4951
|
scope: C,
|
|
4925
|
-
browse:
|
|
4952
|
+
browse: B,
|
|
4926
4953
|
selection: {
|
|
4927
4954
|
documentId: $?.documentId,
|
|
4928
|
-
chunkId:
|
|
4955
|
+
chunkId: ge && ge.documentId === $?.documentId ? ge.chunkId : void 0,
|
|
4929
4956
|
path: $?.path
|
|
4930
4957
|
},
|
|
4931
4958
|
onSelect: $e,
|
|
4932
|
-
reloadToken:
|
|
4933
|
-
maximized:
|
|
4934
|
-
onToggleMaximize: () =>
|
|
4959
|
+
reloadToken: de,
|
|
4960
|
+
maximized: G,
|
|
4961
|
+
onToggleMaximize: () => ce((e) => !e),
|
|
4935
4962
|
subject: p?.subject
|
|
4936
4963
|
}), [
|
|
4937
4964
|
C,
|
|
4938
|
-
|
|
4965
|
+
B,
|
|
4939
4966
|
$?.documentId,
|
|
4940
4967
|
$?.path,
|
|
4941
|
-
|
|
4968
|
+
ge,
|
|
4942
4969
|
$e,
|
|
4943
|
-
|
|
4944
|
-
|
|
4970
|
+
de,
|
|
4971
|
+
G,
|
|
4945
4972
|
p?.subject
|
|
4946
|
-
]), tt =
|
|
4973
|
+
]), tt = K && $ && K.documentId === $.documentId ? K : void 0, nt = !!$?.path && Y?.kind === "document" && Y.fullPath === $.path;
|
|
4947
4974
|
return /* @__PURE__ */ d(l, { children: [
|
|
4948
|
-
/* @__PURE__ */ d(
|
|
4949
|
-
className:
|
|
4950
|
-
defaultLeftWidth:
|
|
4975
|
+
/* @__PURE__ */ d(je, {
|
|
4976
|
+
className: W ? "paths-view paths-view--stars" : "paths-view",
|
|
4977
|
+
defaultLeftWidth: W ? 720 : 420,
|
|
4951
4978
|
minLeftWidth: 280,
|
|
4952
4979
|
minRightWidth: 300,
|
|
4953
|
-
storageKey:
|
|
4954
|
-
hideRight:
|
|
4980
|
+
storageKey: W ? "loomcycle.explorer.split.stars" : "loomcycle.explorer.split.paths",
|
|
4981
|
+
hideRight: W && G,
|
|
4955
4982
|
children: [/* @__PURE__ */ d("div", {
|
|
4956
4983
|
className: "left",
|
|
4957
4984
|
children: [
|
|
@@ -4985,23 +5012,23 @@ function Vn({ defaultScope: e, path: n, onPathChange: i, browse: f, principal: p
|
|
|
4985
5012
|
"aria-label": "Navigator",
|
|
4986
5013
|
children: [/* @__PURE__ */ u("button", {
|
|
4987
5014
|
type: "button",
|
|
4988
|
-
"aria-pressed": !
|
|
4989
|
-
className:
|
|
4990
|
-
onClick: () =>
|
|
5015
|
+
"aria-pressed": !W,
|
|
5016
|
+
className: W ? void 0 : "active",
|
|
5017
|
+
onClick: () => oe("tree"),
|
|
4991
5018
|
title: "Browse the Path tree",
|
|
4992
5019
|
children: "tree"
|
|
4993
5020
|
}), /* @__PURE__ */ u("button", {
|
|
4994
5021
|
type: "button",
|
|
4995
|
-
"aria-pressed":
|
|
4996
|
-
className:
|
|
4997
|
-
onClick: () =>
|
|
5022
|
+
"aria-pressed": W,
|
|
5023
|
+
className: W ? "active" : void 0,
|
|
5024
|
+
onClick: () => oe("stars"),
|
|
4998
5025
|
title: "Browse the scope as a 3D star map",
|
|
4999
5026
|
children: "stars"
|
|
5000
5027
|
})]
|
|
5001
5028
|
}),
|
|
5002
5029
|
/* @__PURE__ */ d("div", {
|
|
5003
5030
|
className: "paths-toolbar-actions",
|
|
5004
|
-
children: [!
|
|
5031
|
+
children: [!W && /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("button", {
|
|
5005
5032
|
type: "button",
|
|
5006
5033
|
onClick: Ue,
|
|
5007
5034
|
title: `New folder in ${Z}`,
|
|
@@ -5013,47 +5040,47 @@ function Vn({ defaultScope: e, path: n, onPathChange: i, browse: f, principal: p
|
|
|
5013
5040
|
children: "+ document"
|
|
5014
5041
|
})] }), /* @__PURE__ */ u("button", {
|
|
5015
5042
|
type: "button",
|
|
5016
|
-
onClick: () => void
|
|
5043
|
+
onClick: () => void Pe(),
|
|
5017
5044
|
title: "Reload the tree",
|
|
5018
5045
|
children: "↻"
|
|
5019
5046
|
})]
|
|
5020
5047
|
})
|
|
5021
5048
|
]
|
|
5022
5049
|
}),
|
|
5023
|
-
!
|
|
5050
|
+
!W && /* @__PURE__ */ d("p", {
|
|
5024
5051
|
className: "paths-context",
|
|
5025
5052
|
children: [
|
|
5026
5053
|
"new items → ",
|
|
5027
5054
|
/* @__PURE__ */ u("code", { children: Z }),
|
|
5028
|
-
|
|
5055
|
+
B?.scopeId && /* @__PURE__ */ d(l, { children: [
|
|
5029
5056
|
" · ",
|
|
5030
5057
|
"subject ",
|
|
5031
|
-
/* @__PURE__ */ u("code", { children:
|
|
5058
|
+
/* @__PURE__ */ u("code", { children: B.scopeId })
|
|
5032
5059
|
] }),
|
|
5033
|
-
|
|
5060
|
+
B?.tenant && /* @__PURE__ */ d(l, { children: [
|
|
5034
5061
|
" · ",
|
|
5035
5062
|
"tenant ",
|
|
5036
|
-
/* @__PURE__ */ u("code", { children:
|
|
5063
|
+
/* @__PURE__ */ u("code", { children: B.tenant })
|
|
5037
5064
|
] })
|
|
5038
5065
|
]
|
|
5039
5066
|
}),
|
|
5040
|
-
(D ||
|
|
5067
|
+
(D || Re) && /* @__PURE__ */ u("div", {
|
|
5041
5068
|
className: "paths-err",
|
|
5042
|
-
children: D ||
|
|
5069
|
+
children: D || Re
|
|
5043
5070
|
}),
|
|
5044
|
-
|
|
5071
|
+
W && h ? /* @__PURE__ */ u("div", {
|
|
5045
5072
|
className: "paths-navigator",
|
|
5046
5073
|
children: h(et)
|
|
5047
|
-
}) : /* @__PURE__ */ u(
|
|
5048
|
-
tree:
|
|
5049
|
-
root:
|
|
5074
|
+
}) : /* @__PURE__ */ u(In, {
|
|
5075
|
+
tree: Ne,
|
|
5076
|
+
root: H.get(""),
|
|
5050
5077
|
expanded: N,
|
|
5051
|
-
onToggle:
|
|
5052
|
-
onLoadMore:
|
|
5053
|
-
onRetry:
|
|
5078
|
+
onToggle: Fe,
|
|
5079
|
+
onLoadMore: Ie,
|
|
5080
|
+
onRetry: Le,
|
|
5054
5081
|
selectedPath: P,
|
|
5055
|
-
onSelect: (e) =>
|
|
5056
|
-
summaries:
|
|
5082
|
+
onSelect: (e) => z(e.fullPath),
|
|
5083
|
+
summaries: ye
|
|
5057
5084
|
})
|
|
5058
5085
|
]
|
|
5059
5086
|
}), /* @__PURE__ */ u("div", {
|
|
@@ -5061,7 +5088,7 @@ function Vn({ defaultScope: e, path: n, onPathChange: i, browse: f, principal: p
|
|
|
5061
5088
|
children: $ ? /* @__PURE__ */ d("div", {
|
|
5062
5089
|
className: "paths-doc",
|
|
5063
5090
|
children: [
|
|
5064
|
-
/* @__PURE__ */ u(
|
|
5091
|
+
/* @__PURE__ */ u(ke, {
|
|
5065
5092
|
trail: F,
|
|
5066
5093
|
onJump: Ze
|
|
5067
5094
|
}),
|
|
@@ -5074,7 +5101,7 @@ function Vn({ defaultScope: e, path: n, onPathChange: i, browse: f, principal: p
|
|
|
5074
5101
|
className: "paths-doc-path paths-doc-unfiled",
|
|
5075
5102
|
title: "Opened by id — no entry for this document was found in the Path tree",
|
|
5076
5103
|
children: [
|
|
5077
|
-
|
|
5104
|
+
we($),
|
|
5078
5105
|
" ",
|
|
5079
5106
|
/* @__PURE__ */ u("em", { children: "· opened by id, not in the tree" })
|
|
5080
5107
|
]
|
|
@@ -5101,39 +5128,39 @@ function Vn({ defaultScope: e, path: n, onPathChange: i, browse: f, principal: p
|
|
|
5101
5128
|
]
|
|
5102
5129
|
})]
|
|
5103
5130
|
}),
|
|
5104
|
-
/* @__PURE__ */ u(
|
|
5131
|
+
/* @__PURE__ */ u(An, {
|
|
5105
5132
|
documentId: $.documentId,
|
|
5106
5133
|
scope: C,
|
|
5107
5134
|
titleHint: $.title,
|
|
5108
|
-
browse:
|
|
5135
|
+
browse: B,
|
|
5109
5136
|
principal: p,
|
|
5110
5137
|
renderAssistant: m,
|
|
5111
5138
|
initialChunkId: $.chunkId ?? tt?.chunkId,
|
|
5112
5139
|
onOpenDocument: Xe,
|
|
5113
5140
|
onTitle: Qe,
|
|
5114
|
-
onChunkSelect: (e) =>
|
|
5141
|
+
onChunkSelect: (e) => _e({
|
|
5115
5142
|
documentId: $.documentId,
|
|
5116
5143
|
chunkId: e
|
|
5117
5144
|
}),
|
|
5118
5145
|
focusChunk: tt,
|
|
5119
5146
|
onRegenerateAnnotation: b,
|
|
5120
5147
|
canEditAnnotations: x,
|
|
5121
|
-
onAnnotationChanged: () => void
|
|
5148
|
+
onAnnotationChanged: () => void Pe()
|
|
5122
5149
|
}, F.length)
|
|
5123
5150
|
]
|
|
5124
|
-
}) :
|
|
5151
|
+
}) : Y ? /* @__PURE__ */ d("div", {
|
|
5125
5152
|
className: "paths-detail",
|
|
5126
5153
|
children: [
|
|
5127
5154
|
/* @__PURE__ */ d("h2", { children: [/* @__PURE__ */ u("span", {
|
|
5128
5155
|
className: "paths-detail-kind",
|
|
5129
|
-
children:
|
|
5130
|
-
}), /* @__PURE__ */ u("code", { children:
|
|
5156
|
+
children: Y.kind
|
|
5157
|
+
}), /* @__PURE__ */ u("code", { children: Y.fullPath })] }),
|
|
5131
5158
|
/* @__PURE__ */ d("dl", {
|
|
5132
5159
|
className: "paths-detail-meta",
|
|
5133
5160
|
children: [
|
|
5134
5161
|
/* @__PURE__ */ u("dt", { children: "scope" }),
|
|
5135
5162
|
/* @__PURE__ */ u("dd", { children: C }),
|
|
5136
|
-
|
|
5163
|
+
Ve && /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("dt", { children: "stored" }), /* @__PURE__ */ u("dd", { children: Ve })] })
|
|
5137
5164
|
]
|
|
5138
5165
|
}),
|
|
5139
5166
|
Ke ? /* @__PURE__ */ d("div", {
|
|
@@ -5161,7 +5188,7 @@ function Vn({ defaultScope: e, path: n, onPathChange: i, browse: f, principal: p
|
|
|
5161
5188
|
className: "paths-readonly",
|
|
5162
5189
|
children: [
|
|
5163
5190
|
"Read-only — ",
|
|
5164
|
-
|
|
5191
|
+
Y.kind,
|
|
5165
5192
|
" entries are managed by their own tool."
|
|
5166
5193
|
]
|
|
5167
5194
|
})
|
|
@@ -5172,14 +5199,14 @@ function Vn({ defaultScope: e, path: n, onPathChange: i, browse: f, principal: p
|
|
|
5172
5199
|
})
|
|
5173
5200
|
})]
|
|
5174
5201
|
}),
|
|
5175
|
-
k && /* @__PURE__ */ u(
|
|
5202
|
+
k && /* @__PURE__ */ u(Gn, {
|
|
5176
5203
|
state: k,
|
|
5177
5204
|
onClose: () => A(null)
|
|
5178
5205
|
}),
|
|
5179
|
-
j && /* @__PURE__ */ u(
|
|
5206
|
+
j && /* @__PURE__ */ u(Ae, {
|
|
5180
5207
|
data: S,
|
|
5181
5208
|
scope: C,
|
|
5182
|
-
browse:
|
|
5209
|
+
browse: B,
|
|
5183
5210
|
documentId: j.documentId,
|
|
5184
5211
|
underPath: j.underPath,
|
|
5185
5212
|
fromPath: j.fromPath,
|
|
@@ -5188,7 +5215,7 @@ function Vn({ defaultScope: e, path: n, onPathChange: i, browse: f, principal: p
|
|
|
5188
5215
|
})
|
|
5189
5216
|
] });
|
|
5190
5217
|
}
|
|
5191
|
-
function
|
|
5218
|
+
function Gn({ state: e, onClose: t }) {
|
|
5192
5219
|
let [n, r] = s(() => Object.fromEntries(e.fields.map((e) => [e.key, e.value ?? ""]))), [i, a] = s(!1), [o, c] = s(null);
|
|
5193
5220
|
return /* @__PURE__ */ u("div", {
|
|
5194
5221
|
className: "modal-overlay",
|
|
@@ -5248,15 +5275,15 @@ function Hn({ state: e, onClose: t }) {
|
|
|
5248
5275
|
});
|
|
5249
5276
|
}
|
|
5250
5277
|
// src/DocumentViewer.tsx
|
|
5251
|
-
function
|
|
5252
|
-
let { documentId: t, scope: n, browse: r, theme: i } = e, a =
|
|
5253
|
-
return /* @__PURE__ */ u(
|
|
5278
|
+
function Kn(e) {
|
|
5279
|
+
let { documentId: t, scope: n, browse: r, theme: i } = e, a = q(e);
|
|
5280
|
+
return /* @__PURE__ */ u(ye, {
|
|
5254
5281
|
theme: i,
|
|
5255
5282
|
dataLayer: a,
|
|
5256
|
-
children: /* @__PURE__ */ u(
|
|
5283
|
+
children: /* @__PURE__ */ u(qn, { ...e }, `${n}:${t}:${r?.scopeId ?? ""}:${r?.tenant ?? ""}`)
|
|
5257
5284
|
});
|
|
5258
5285
|
}
|
|
5259
|
-
function
|
|
5286
|
+
function qn({ documentId: e, chunkId: n, scope: i, titleHint: a, browse: c, principal: f, renderAssistant: p, onOpenDocument: m, onRegenerateAnnotation: h, canEditAnnotations: g }) {
|
|
5260
5287
|
let [_, v] = s([]), y = _[_.length - 1], [b, x] = s(), S = o(n);
|
|
5261
5288
|
r(() => {
|
|
5262
5289
|
n !== S.current && (S.current = n, _.length > 0 ? (x(void 0), v([])) : x((e) => ({
|
|
@@ -5265,12 +5292,12 @@ function Wn({ documentId: e, chunkId: n, scope: i, titleHint: a, browse: c, prin
|
|
|
5265
5292
|
})));
|
|
5266
5293
|
}, [n]);
|
|
5267
5294
|
let C = t((e, t) => {
|
|
5268
|
-
m ? m(e, t) : v((n) =>
|
|
5269
|
-
}, [m]), w = t((e) => v((t) =>
|
|
5270
|
-
return /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u(
|
|
5295
|
+
m ? m(e, t) : v((n) => be(n, t, e));
|
|
5296
|
+
}, [m]), w = t((e) => v((t) => xe(t, e)), []), T = t((e, t) => v((n) => Se(n, e, { title: t })), []);
|
|
5297
|
+
return /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u(ke, {
|
|
5271
5298
|
trail: _,
|
|
5272
5299
|
onJump: w
|
|
5273
|
-
}), /* @__PURE__ */ u(
|
|
5300
|
+
}), /* @__PURE__ */ u(An, {
|
|
5274
5301
|
documentId: y?.documentId ?? e,
|
|
5275
5302
|
scope: i,
|
|
5276
5303
|
titleHint: y ? y.title : a,
|
|
@@ -5285,6 +5312,6 @@ function Wn({ documentId: e, chunkId: n, scope: i, titleHint: a, browse: c, prin
|
|
|
5285
5312
|
canEditAnnotations: g
|
|
5286
5313
|
}, _.length)] });
|
|
5287
5314
|
}
|
|
5288
|
-
export { k as ABSTRACT_MAX_CHARS, O as BRIEF_MAX_CHARS, rt as DEFAULT_SCHEME,
|
|
5315
|
+
export { k as ABSTRACT_MAX_CHARS, O as BRIEF_MAX_CHARS, rt as DEFAULT_SCHEME, Kn as DocumentViewer, Ie as EDGE_PAGE_CAP, Un as PathExplorer, Ke as QUEUE_CHANGED_RETRIES, Ge as RULING_CHUNK, K as RequestError, D as annotationsApply, _e as assetFetchFromConnection, ct as chunkColor, Xe as chunkCount, lt as chunkInheritsDocColor, pt as chunkRowStyle, ge as createLoomcycleClient, U as dataLayerFromClient, st as docColor, at as effectiveScheme, ut as hexToTint, Je as isQueueChanged, ve as jsonPostFromConnection, Le as loadDocumentEdges, Ye as runRuling, ne as setAnnotationInput, dt as tintStyle, x as transferInput, $ as undoRulings, ft as washStyle };
|
|
5289
5316
|
|
|
5290
5317
|
//# sourceMappingURL=index.js.map
|