@hiai-gg/docsmint 0.4.9 → 0.5.1
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/backend/src/lib/api-key-facade.ts +1 -0
- package/dist/backend/index.js +38379 -18500
- package/dist/backend-api-key-facade.js +23 -0
- package/dist/client.js +2 -7
- package/dist/frontend/{CategoryDialog-CxVyaBV5.js → CategoryDialog-DmlX0Z97.js} +109 -108
- package/dist/frontend/ConfirmDialog-DgMTQBq4.js +134 -0
- package/dist/frontend/{CreateSnapshotDialog-BDgFTeFn.js → CreateSnapshotDialog-CXW4sCuf.js} +29 -29
- package/dist/frontend/DatePicker-D6E-EEtZ.js +340 -0
- package/dist/frontend/{DeleteDialog-CvAr2WPu.js → DeleteDialog-8k6JYWCx.js} +3 -3
- package/dist/frontend/{FolderNode--l1g8bcL.js → FolderNode-D3rN3yLV.js} +8 -8
- package/dist/frontend/{FolderTreeSelector-CyB8y2Sm.js → FolderTreeSelector-BMB1MS9N.js} +3 -3
- package/dist/frontend/{Icon-CooFj4Ee.js → Icon-Db-o32_E.js} +1 -1
- package/dist/frontend/{SettingsDialog-BB7h7GWw.js → SettingsDialog-DEx1eEZm.js} +290 -290
- package/dist/frontend/ShareDialog-uEf8Ks02.js +166 -0
- package/dist/frontend/Sidebar-BthP-jOS.js +2043 -0
- package/dist/frontend/TagCreateDialog-Bb0-Vtzh.js +261 -0
- package/dist/frontend/api/attachments.js +1 -1
- package/dist/frontend/api/categories.d.ts +3 -3
- package/dist/frontend/api/categories.js +1 -1
- package/dist/frontend/api/documents.js +1 -1
- package/dist/frontend/api/share.js +1 -1
- package/dist/frontend/api/tags.js +1 -1
- package/dist/frontend/{api-keys-CpkrA8rD.js → api-keys-DIwAdYkg.js} +10 -10
- package/dist/frontend/app-shell.d.ts +5 -1
- package/dist/frontend/app-shell.js +83 -72
- package/dist/frontend/{attachments-BuILSs56.js → attachments-C2DBzU-r.js} +13 -13
- package/dist/frontend/{camera-iKXDOOWT.js → camera-CzCxBOpc.js} +2 -2
- package/dist/frontend/{categories-Drnns7N6.js → categories-X7gK8azc.js} +0 -2
- package/dist/frontend/{check-D-UuvBuh.js → check-BIi-Ghti.js} +2 -2
- package/dist/frontend/{chevron-down-CiPtYyFh.js → chevron-down-C2ft7XUV.js} +2 -2
- package/dist/frontend/{circle-check-tSPE1V6t.js → circle-check-BrqfiQH1.js} +2 -2
- package/dist/frontend/{clock-DJHbHZb8.js → clock-Dz86E4Kz.js} +2 -2
- package/dist/frontend/collaboration.d.ts +4 -2
- package/dist/frontend/collaboration.js +114 -89
- package/dist/frontend/components/category-dialog.js +1 -1
- package/dist/frontend/components/create-snapshot-dialog.js +1 -1
- package/dist/frontend/components/delete-dialog.js +1 -1
- package/dist/frontend/components/editor/document-editor.js +1203 -1190
- package/dist/frontend/components/editor/document-title.js +2 -2
- package/dist/frontend/components/editor/markdown-toggle.js +4 -4
- package/dist/frontend/components/folder-node.js +1 -1
- package/dist/frontend/components/folder-tree-selector.js +1 -1
- package/dist/frontend/components/save-as-dialog.js +145 -144
- package/dist/frontend/components/settings.js +1 -1
- package/dist/frontend/components/share-dialog.js +1 -1
- package/dist/frontend/components/sidebar.js +1 -1
- package/dist/frontend/components/tag-create-dialog.js +1 -1
- package/dist/frontend/components/version-history.js +34 -34
- package/dist/frontend/{confirm-dialog-C4jTRbiS.js → confirm-dialog-CzmoZw3a.js} +20 -20
- package/dist/frontend/{copy-GppwRMjX.js → copy-CvCh4ZVt.js} +2 -2
- package/dist/frontend/dashboard.js +1133 -1087
- package/dist/frontend/{dialog-Bevp9mmM.js → dialog-Ce79C9fd.js} +1 -1
- package/dist/frontend/{dist-C3857Spp.js → dist-DQa_OHOa.js} +2 -2
- package/dist/frontend/{documents-Bc7b_MSZ.js → documents-CwCs1rA7.js} +52 -12
- package/dist/frontend/{dropdown-menu-CRSby3e9.js → dropdown-menu-CJ_7V3N0.js} +45 -45
- package/dist/frontend/{floating-layer-anchor-BDs7vO-M.js → floating-layer-anchor-S5RSefGN.js} +1 -1
- package/dist/frontend/{folder-DeWhnD7O.js → folder-Cx60MRpi.js} +3 -3
- package/dist/frontend/i18n.js +3 -3
- package/dist/frontend/{messages-C5Q890i2.js → messages-DIovIZrK.js} +46 -44
- package/dist/frontend/{rotate-ccw-B4Q7brmV.js → rotate-ccw-ta4NosZ0.js} +2 -2
- package/dist/frontend/{route-context-BqQQ5c4i.js → route-context-DYQlUfzL.js} +14 -11
- package/dist/frontend/search.js +431 -415
- package/dist/frontend/{select-value-GXwx90Pr.js → select-value-JCAp2PmU.js} +466 -466
- package/dist/frontend/{share-Cu7SSJuJ.js → share-D7JtkC85.js} +2 -2
- package/dist/frontend/{tag-HxRazVN_.js → tag-DhVFHMcV.js} +3 -3
- package/dist/frontend/{tag-store.svelte-CG7RrlDT.js → tag-store.svelte-ogVCMCbv.js} +1 -1
- package/dist/frontend/{tags-CtCV0Djo.js → tags-BdCaMGfj.js} +18 -18
- package/dist/frontend/{x-CzBsnJ2x.js → x-cfdlccjs.js} +2 -2
- package/dist/frontend-ssr/api/attachments.js +1 -1
- package/dist/frontend-ssr/api/categories.js +1 -1
- package/dist/frontend-ssr/api/documents.js +1 -1
- package/dist/frontend-ssr/api/share.js +1 -1
- package/dist/frontend-ssr/api/tags.js +1 -1
- package/dist/frontend-ssr/app-shell.js +30 -26
- package/dist/frontend-ssr/assets/{CategoryDialog-BcGW8-Kf.js → CategoryDialog-DDu37Oub.js} +13 -11
- package/dist/frontend-ssr/assets/ConfirmDialog-BhAelejz.js +131 -0
- package/dist/frontend-ssr/assets/{CreateSnapshotDialog-1bROJ-Rn.js → CreateSnapshotDialog-DNAjd4eD.js} +2 -2
- package/dist/frontend-ssr/assets/{DatePicker-B1ML8OVz.js → DatePicker-Cp6Qmgdb.js} +17 -29
- package/dist/frontend-ssr/assets/{DeleteDialog-tBYaP0L3.js → DeleteDialog-DG9Lm38J.js} +2 -2
- package/dist/frontend-ssr/assets/{FolderNode-CpHrpOED.js → FolderNode-CrLWqHJH.js} +5 -5
- package/dist/frontend-ssr/assets/{FolderTreeSelector-DZNZ2oI6.js → FolderTreeSelector-Bxi8EqMm.js} +8 -12
- package/dist/frontend-ssr/assets/{Icon-B0Zqppjo.js → Icon-QwirKi9Y.js} +16 -28
- package/dist/frontend-ssr/assets/{SettingsDialog-C2SMWJL8.js → SettingsDialog-BymUxBgg.js} +20 -27
- package/dist/frontend-ssr/assets/{ShareDialog-vMvJLRfn.js → ShareDialog-B82t8oJi.js} +4 -2
- package/dist/frontend-ssr/assets/{Sidebar-DKqmwreh.js → Sidebar-CI8YKbrY.js} +55 -57
- package/dist/frontend-ssr/assets/{TagCreateDialog-B0DPEfmQ.js → TagCreateDialog-B7wDbVqG.js} +7 -5
- package/dist/frontend-ssr/assets/{api-keys-DFqX39MT.js → api-keys-DIbclwj5.js} +10 -10
- package/dist/frontend-ssr/assets/{attachments-CWBxE3Vz.js → attachments-CXgatN0B.js} +9 -9
- package/dist/frontend-ssr/assets/{camera-CdxscTw-.js → camera-D6s20LDi.js} +6 -10
- package/dist/frontend-ssr/assets/{categories-CTCtdv7V.js → categories-av9xjeg5.js} +0 -2
- package/dist/frontend-ssr/assets/{chevron-down-CSSNGNh_.js → chevron-down-CvqKATjM.js} +6 -10
- package/dist/frontend-ssr/assets/{chevron-right-B4p7Sk6X.js → chevron-right-DKD7WXjz.js} +6 -10
- package/dist/frontend-ssr/assets/{circle-check-CI1v4vYh.js → circle-check-CPS9dKEo.js} +6 -10
- package/dist/frontend-ssr/assets/{clock-IL-eX2di.js → clock-CzsE58TH.js} +6 -10
- package/dist/frontend-ssr/assets/{confirm-dialog-BCthVwUY.js → confirm-dialog-B3C0WeMn.js} +20 -32
- package/dist/frontend-ssr/assets/{copy-CjV57nGQ.js → copy-DkkCPkBL.js} +6 -10
- package/dist/frontend-ssr/assets/{documents-PObdTOiT.js → documents-CZ-wQohy.js} +58 -12
- package/dist/frontend-ssr/assets/{dropdown-menu-Bj5rbqbB.js → dropdown-menu-Dn_vQq9b.js} +7 -11
- package/dist/frontend-ssr/assets/{floating-layer-anchor-CYIE8Oj6.js → floating-layer-anchor-BIAu-252.js} +1 -1
- package/dist/frontend-ssr/assets/{folder-DChhG7qN.js → folder-DYIE-XPP.js} +6 -10
- package/dist/frontend-ssr/assets/{loader-circle-DZsrZ-er.js → loader-circle-CIEWGyfP.js} +6 -10
- package/dist/frontend-ssr/assets/{messages-CvqpZNJe.js → messages-D-auzk9H.js} +23 -1
- package/dist/frontend-ssr/assets/{rotate-ccw-BlgWwaiq.js → rotate-ccw-dJSqPyTd.js} +6 -10
- package/dist/frontend-ssr/assets/{route-context-uca_b2Px.js → route-context-BPRerEtZ.js} +11 -8
- package/dist/frontend-ssr/assets/{select-value-6Lk0ToYd.js → select-value-DBhbkNcc.js} +1 -1
- package/dist/frontend-ssr/assets/{share-BTBJelxA.js → share-qTqvd6Lu.js} +2 -2
- package/dist/frontend-ssr/assets/{tag-GZEuGWk1.js → tag-BmiVU_Ej.js} +11 -19
- package/dist/frontend-ssr/assets/{tag-store.svelte-DvgUduhd.js → tag-store.svelte-BM1lUI_P.js} +1 -1
- package/dist/frontend-ssr/assets/{tags-BId2wdYd.js → tags-BQsI_6OW.js} +12 -12
- package/dist/frontend-ssr/collaboration.js +37 -12
- package/dist/frontend-ssr/components/category-dialog.js +1 -1
- package/dist/frontend-ssr/components/create-snapshot-dialog.js +1 -1
- package/dist/frontend-ssr/components/delete-dialog.js +1 -1
- package/dist/frontend-ssr/components/editor/document-editor.js +143 -207
- package/dist/frontend-ssr/components/editor/document-title.js +1 -1
- package/dist/frontend-ssr/components/editor/markdown-toggle.js +2 -2
- package/dist/frontend-ssr/components/folder-node.js +1 -1
- package/dist/frontend-ssr/components/folder-tree-selector.js +1 -1
- package/dist/frontend-ssr/components/save-as-dialog.js +8 -6
- package/dist/frontend-ssr/components/settings.js +1 -1
- package/dist/frontend-ssr/components/share-dialog.js +1 -1
- package/dist/frontend-ssr/components/sidebar.js +1 -1
- package/dist/frontend-ssr/components/tag-create-dialog.js +1 -1
- package/dist/frontend-ssr/components/version-history.js +19 -27
- package/dist/frontend-ssr/dashboard.js +344 -185
- package/dist/frontend-ssr/i18n.js +1 -1
- package/dist/frontend-ssr/search.js +16 -20
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/types.d.ts +1 -3
- package/dist/workspace.d.ts +0 -2
- package/dist/workspace.js +0 -2
- package/package.json +1 -1
- package/packages/cli/src/index.ts +1 -1
- package/packages/db/src/with-tenant.ts +2 -0
- package/packages/mcp-server/src/index.ts +1 -1
- package/dist/frontend/ConfirmDialog-NFGXRa3E.js +0 -214
- package/dist/frontend/DatePicker-BZRBluzF.js +0 -256
- package/dist/frontend/ShareDialog-BUOkYSlw.js +0 -165
- package/dist/frontend/Sidebar-fbtYC3qs.js +0 -2037
- package/dist/frontend/TagCreateDialog-B9YZBNHi.js +0 -260
- package/dist/frontend-ssr/assets/ConfirmDialog-DjMFKc0V.js +0 -420
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as e } from "./client-GbtOH90i.js";
|
|
2
2
|
//#region src/lib/api/attachments.ts
|
|
3
3
|
var t = 25 * 1024 * 1024;
|
|
4
|
-
function n(t, n) {
|
|
4
|
+
function n(t, n, r) {
|
|
5
5
|
return e(`/api/documents/${t}/attachments/presign`, {
|
|
6
6
|
method: "POST",
|
|
7
7
|
body: {
|
|
@@ -9,9 +9,9 @@ function n(t, n) {
|
|
|
9
9
|
contentType: n.type,
|
|
10
10
|
size: n.size
|
|
11
11
|
}
|
|
12
|
-
});
|
|
12
|
+
}, r);
|
|
13
13
|
}
|
|
14
|
-
function r(t, n, r) {
|
|
14
|
+
function r(t, n, r, i) {
|
|
15
15
|
return e(`/api/documents/${t}/attachments/confirm`, {
|
|
16
16
|
method: "POST",
|
|
17
17
|
body: {
|
|
@@ -20,25 +20,25 @@ function r(t, n, r) {
|
|
|
20
20
|
contentType: r.type,
|
|
21
21
|
size: r.size
|
|
22
22
|
}
|
|
23
|
-
});
|
|
23
|
+
}, i);
|
|
24
24
|
}
|
|
25
|
-
async function i(e, t) {
|
|
26
|
-
let
|
|
25
|
+
async function i(e, t, i) {
|
|
26
|
+
let a = await n(e, t, i), o = new AbortController(), s = setTimeout(() => o.abort(), 5 * 6e4), c;
|
|
27
27
|
try {
|
|
28
|
-
|
|
28
|
+
c = await fetch(a.url, {
|
|
29
29
|
method: "PUT",
|
|
30
30
|
body: t,
|
|
31
31
|
headers: { "Content-Type": t.type },
|
|
32
|
-
signal:
|
|
32
|
+
signal: o.signal
|
|
33
33
|
});
|
|
34
34
|
} finally {
|
|
35
|
-
clearTimeout(
|
|
35
|
+
clearTimeout(s);
|
|
36
36
|
}
|
|
37
|
-
if (!
|
|
38
|
-
return r(e,
|
|
37
|
+
if (!c.ok) throw Error(`Storage upload failed: ${c.status} ${c.statusText}`);
|
|
38
|
+
return r(e, a.key, t, i);
|
|
39
39
|
}
|
|
40
|
-
function a(t) {
|
|
41
|
-
return e(`/api/documents/${t}/attachments
|
|
40
|
+
function a(t, n) {
|
|
41
|
+
return e(`/api/documents/${t}/attachments`, {}, n);
|
|
42
42
|
}
|
|
43
43
|
function o(e) {
|
|
44
44
|
return e.type.startsWith("image/");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as e } from "./Icon-
|
|
1
|
+
import { t as e } from "./Icon-Db-o32_E.js";
|
|
2
2
|
import "svelte/internal/disclose-version";
|
|
3
3
|
import * as t from "svelte/internal/client";
|
|
4
4
|
import "svelte/internal/flags/legacy";
|
|
5
|
-
//#region ../node_modules/.bun/lucide-svelte@
|
|
5
|
+
//#region ../node_modules/.bun/lucide-svelte@0.577.0+ff5f301bb2db9a0d/node_modules/lucide-svelte/dist/icons/camera.svelte
|
|
6
6
|
function n(n, r) {
|
|
7
7
|
let i = t.legacy_rest_props(r, [
|
|
8
8
|
"children",
|
|
@@ -6,7 +6,6 @@ var o = n({
|
|
|
6
6
|
apiMode: a([
|
|
7
7
|
"unavailable",
|
|
8
8
|
"global",
|
|
9
|
-
"general",
|
|
10
9
|
"category"
|
|
11
10
|
]).optional(),
|
|
12
11
|
apiPermissionRead: r().optional(),
|
|
@@ -18,7 +17,6 @@ var o = n({
|
|
|
18
17
|
apiMode: a([
|
|
19
18
|
"unavailable",
|
|
20
19
|
"global",
|
|
21
|
-
"general",
|
|
22
20
|
"category"
|
|
23
21
|
]).optional(),
|
|
24
22
|
apiPermissionRead: r().optional(),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as e } from "./Icon-
|
|
1
|
+
import { t as e } from "./Icon-Db-o32_E.js";
|
|
2
2
|
import "svelte/internal/disclose-version";
|
|
3
3
|
import * as t from "svelte/internal/client";
|
|
4
4
|
import "svelte/internal/flags/legacy";
|
|
5
|
-
//#region ../node_modules/.bun/lucide-svelte@
|
|
5
|
+
//#region ../node_modules/.bun/lucide-svelte@0.577.0+ff5f301bb2db9a0d/node_modules/lucide-svelte/dist/icons/check.svelte
|
|
6
6
|
function n(n, r) {
|
|
7
7
|
let i = t.legacy_rest_props(r, [
|
|
8
8
|
"children",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as e } from "./Icon-
|
|
1
|
+
import { t as e } from "./Icon-Db-o32_E.js";
|
|
2
2
|
import "svelte/internal/disclose-version";
|
|
3
3
|
import * as t from "svelte/internal/client";
|
|
4
4
|
import "svelte/internal/flags/legacy";
|
|
5
|
-
//#region ../node_modules/.bun/lucide-svelte@
|
|
5
|
+
//#region ../node_modules/.bun/lucide-svelte@0.577.0+ff5f301bb2db9a0d/node_modules/lucide-svelte/dist/icons/chevron-down.svelte
|
|
6
6
|
function n(n, r) {
|
|
7
7
|
let i = t.legacy_rest_props(r, [
|
|
8
8
|
"children",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as e } from "./Icon-
|
|
1
|
+
import { t as e } from "./Icon-Db-o32_E.js";
|
|
2
2
|
import "svelte/internal/disclose-version";
|
|
3
3
|
import * as t from "svelte/internal/client";
|
|
4
4
|
import "svelte/internal/flags/legacy";
|
|
5
|
-
//#region ../node_modules/.bun/lucide-svelte@
|
|
5
|
+
//#region ../node_modules/.bun/lucide-svelte@0.577.0+ff5f301bb2db9a0d/node_modules/lucide-svelte/dist/icons/circle-check.svelte
|
|
6
6
|
function n(n, r) {
|
|
7
7
|
let i = t.legacy_rest_props(r, [
|
|
8
8
|
"children",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as e } from "./Icon-
|
|
1
|
+
import { t as e } from "./Icon-Db-o32_E.js";
|
|
2
2
|
import "svelte/internal/disclose-version";
|
|
3
3
|
import * as t from "svelte/internal/client";
|
|
4
4
|
import "svelte/internal/flags/legacy";
|
|
5
|
-
//#region ../node_modules/.bun/lucide-svelte@
|
|
5
|
+
//#region ../node_modules/.bun/lucide-svelte@0.577.0+ff5f301bb2db9a0d/node_modules/lucide-svelte/dist/icons/clock.svelte
|
|
6
6
|
function n(n, r) {
|
|
7
7
|
let i = t.legacy_rest_props(r, [
|
|
8
8
|
"children",
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { WebsocketProvider } from "y-websocket";
|
|
2
2
|
import type * as Y from "yjs";
|
|
3
3
|
export interface CollaborationSession { provider: WebsocketProvider; doc: Y.Doc; destroy(): void; }
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export interface DocsmintRealtimeConnection { serverUrl: string; roomName: string; params?: Record<string, string>; }
|
|
5
|
+
export interface DocsmintRealtimeAdapter { resolveRealtimeConnection(input: { documentId: string; accessToken?: string }): DocsmintRealtimeConnection; }
|
|
6
|
+
export declare function startCollaboration(documentId: string, accessToken?: string, onUpdate?: (update: Uint8Array) => void, realtime?: DocsmintRealtimeAdapter): CollaborationSession;
|
|
7
|
+
export declare function stopCollaboration(session?: CollaborationSession): void;
|
|
6
8
|
export declare function getActiveSession(): CollaborationSession | null;
|
|
@@ -1,127 +1,127 @@
|
|
|
1
|
-
import { $ as e, E as t, G as n, I as r, J as i, K as a, Q as o, R as s, T as c, V as l, W as u, X as d, Z as f, at as p, c as m, dt as h, ft as g, g as _, i as v, it as y, lt as b, mt as
|
|
1
|
+
import { $ as e, E as t, G as n, I as r, J as i, K as a, Q as o, R as s, T as c, V as l, W as u, X as d, Z as f, at as p, c as m, dt as h, ft as g, g as _, i as v, it as y, lt as b, mt as x, n as S, nt as C, ot as w, q as T, r as E, rt as D, t as O, ut as k, z as A } from "./awareness-snQ3RD9f.js";
|
|
2
2
|
//#region ../node_modules/.bun/lib0@0.2.117/node_modules/lib0/broadcastchannel.js
|
|
3
|
-
var
|
|
3
|
+
var j = /* @__PURE__ */ new Map(), M = class {
|
|
4
4
|
constructor(e) {
|
|
5
5
|
this.room = e, this.onmessage = null, this._onChange = (t) => t.key === e && this.onmessage !== null && this.onmessage({ data: s(t.newValue || "") }), a(this._onChange);
|
|
6
6
|
}
|
|
7
7
|
postMessage(e) {
|
|
8
|
-
|
|
8
|
+
T.setItem(this.room, A(r(e)));
|
|
9
9
|
}
|
|
10
10
|
close() {
|
|
11
11
|
n(this._onChange);
|
|
12
12
|
}
|
|
13
|
-
},
|
|
14
|
-
let t = g(), n = new
|
|
13
|
+
}, ee = typeof BroadcastChannel > "u" ? M : BroadcastChannel, N = (e) => x(j, e, () => {
|
|
14
|
+
let t = g(), n = new ee(e);
|
|
15
15
|
return n.onmessage = (e) => t.forEach((t) => t(e.data, "broadcastchannel")), {
|
|
16
16
|
bc: n,
|
|
17
17
|
subs: t
|
|
18
18
|
};
|
|
19
|
-
}),
|
|
20
|
-
let n =
|
|
21
|
-
return r && n.subs.size === 0 && (n.bc.close(),
|
|
22
|
-
},
|
|
23
|
-
let r =
|
|
19
|
+
}), P = (e, t) => (N(e).subs.add(t), t), F = (e, t) => {
|
|
20
|
+
let n = N(e), r = n.subs.delete(t);
|
|
21
|
+
return r && n.subs.size === 0 && (n.bc.close(), j.delete(e)), r;
|
|
22
|
+
}, I = (e, t, n = null) => {
|
|
23
|
+
let r = N(e);
|
|
24
24
|
r.bc.postMessage(t), r.subs.forEach((e) => e(t, n));
|
|
25
|
-
},
|
|
26
|
-
p(e, 0),
|
|
27
|
-
},
|
|
28
|
-
p(e, 1),
|
|
29
|
-
},
|
|
25
|
+
}, L = (e, n) => {
|
|
26
|
+
p(e, 0), w(e, t(n));
|
|
27
|
+
}, R = (e, t, n) => {
|
|
28
|
+
p(e, 1), w(e, c(t, n));
|
|
29
|
+
}, z = (t, n, r) => R(n, r, e(t)), B = (t, n, r, i) => {
|
|
30
30
|
try {
|
|
31
31
|
_(n, e(t), r);
|
|
32
32
|
} catch (e) {
|
|
33
33
|
i?.(e), console.error("Caught error while handling a Yjs update", e);
|
|
34
34
|
}
|
|
35
|
-
},
|
|
36
|
-
p(e, 2),
|
|
37
|
-
},
|
|
35
|
+
}, V = (e, t) => {
|
|
36
|
+
p(e, 2), w(e, t);
|
|
37
|
+
}, H = B, U = (e, t, n, r, i) => {
|
|
38
38
|
let a = o(e);
|
|
39
39
|
switch (a) {
|
|
40
40
|
case 0:
|
|
41
|
-
|
|
41
|
+
z(e, t, n);
|
|
42
42
|
break;
|
|
43
43
|
case 1:
|
|
44
|
-
|
|
44
|
+
B(e, n, r, i);
|
|
45
45
|
break;
|
|
46
46
|
case 2:
|
|
47
|
-
|
|
47
|
+
H(e, n, r, i);
|
|
48
48
|
break;
|
|
49
49
|
default: throw Error("Unknown message type");
|
|
50
50
|
}
|
|
51
51
|
return a;
|
|
52
|
-
},
|
|
52
|
+
}, W = (e, t, n) => {
|
|
53
53
|
switch (o(e)) {
|
|
54
54
|
case 0: n(t, f(e));
|
|
55
55
|
}
|
|
56
|
-
},
|
|
57
|
-
|
|
56
|
+
}, G = (e) => u(e, (e, t) => `${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&"), K = [];
|
|
57
|
+
K[0] = (e, t, n, r, i) => {
|
|
58
58
|
p(e, 0);
|
|
59
|
-
let a =
|
|
59
|
+
let a = U(t, e, n.doc, n);
|
|
60
60
|
r && a === 1 && !n.synced && (n.synced = !0);
|
|
61
|
-
},
|
|
62
|
-
p(e, 1),
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
},
|
|
66
|
-
|
|
61
|
+
}, K[3] = (e, t, n, r, i) => {
|
|
62
|
+
p(e, 1), w(e, E(n.awareness, Array.from(n.awareness.getStates().keys())));
|
|
63
|
+
}, K[1] = (t, n, r, i, a) => {
|
|
64
|
+
S(r.awareness, e(n), r);
|
|
65
|
+
}, K[2] = (e, t, n, r, i) => {
|
|
66
|
+
W(t, n.doc, (e, t) => J(n, t));
|
|
67
67
|
};
|
|
68
|
-
var
|
|
69
|
-
let r = d(t), i =
|
|
68
|
+
var q = 3e4, J = (e, t) => console.warn(`Permission denied to access ${e.url}.\n${t}`), Y = (e, t, n) => {
|
|
69
|
+
let r = d(t), i = C(), a = o(r), s = e.messageHandlers[a];
|
|
70
70
|
return s ? s(i, r, e, n, a) : console.error("Unable to compute message"), i;
|
|
71
|
-
},
|
|
72
|
-
t === e.ws && (e.emit("connection-close", [n, e]), e.ws = null, t.close(), e.wsconnecting = !1, e.wsconnected ? (e.wsconnected = !1, e.synced = !1, v(e.awareness, Array.from(e.awareness.getStates().keys()).filter((t) => t !== e.doc.clientID), e), e.emit("status", [{ status: "disconnected" }])) : e.wsUnsuccessfulReconnects++, setTimeout(
|
|
73
|
-
},
|
|
71
|
+
}, X = (e, t, n) => {
|
|
72
|
+
t === e.ws && (e.emit("connection-close", [n, e]), e.ws = null, t.close(), e.wsconnecting = !1, e.wsconnected ? (e.wsconnected = !1, e.synced = !1, v(e.awareness, Array.from(e.awareness.getStates().keys()).filter((t) => t !== e.doc.clientID), e), e.emit("status", [{ status: "disconnected" }])) : e.wsUnsuccessfulReconnects++, setTimeout(Z, b(k(2, e.wsUnsuccessfulReconnects) * 100, e.maxBackoffTime), e));
|
|
73
|
+
}, Z = (e) => {
|
|
74
74
|
if (e.shouldConnect && e.ws === null) {
|
|
75
75
|
let t = new e._WS(e.url, e.protocols);
|
|
76
76
|
t.binaryType = "arraybuffer", e.ws = t, e.wsconnecting = !0, e.wsconnected = !1, e.synced = !1, t.onmessage = (n) => {
|
|
77
77
|
e.wsLastMessageReceived = i();
|
|
78
|
-
let r =
|
|
79
|
-
|
|
78
|
+
let r = Y(e, new Uint8Array(n.data), !0);
|
|
79
|
+
D(r) > 1 && t.send(y(r));
|
|
80
80
|
}, t.onerror = (t) => {
|
|
81
81
|
e.emit("connection-error", [t, e]);
|
|
82
82
|
}, t.onclose = (n) => {
|
|
83
|
-
|
|
83
|
+
X(e, t, n);
|
|
84
84
|
}, t.onopen = () => {
|
|
85
85
|
e.wsLastMessageReceived = i(), e.wsconnecting = !1, e.wsconnected = !0, e.wsUnsuccessfulReconnects = 0, e.emit("status", [{ status: "connected" }]);
|
|
86
|
-
let n =
|
|
87
|
-
if (p(n, 0),
|
|
88
|
-
let n =
|
|
89
|
-
p(n, 1),
|
|
86
|
+
let n = C();
|
|
87
|
+
if (p(n, 0), L(n, e.doc), t.send(y(n)), e.awareness.getLocalState() !== null) {
|
|
88
|
+
let n = C();
|
|
89
|
+
p(n, 1), w(n, E(e.awareness, [e.doc.clientID])), t.send(y(n));
|
|
90
90
|
}
|
|
91
91
|
}, e.emit("status", [{ status: "connecting" }]);
|
|
92
92
|
}
|
|
93
|
-
},
|
|
93
|
+
}, Q = (e, t) => {
|
|
94
94
|
let n = e.ws;
|
|
95
|
-
e.wsconnected && n && n.readyState === n.OPEN && n.send(t), e.bcconnected &&
|
|
96
|
-
},
|
|
97
|
-
constructor(e, t, n, { connect: r = !0, awareness: a = new
|
|
95
|
+
e.wsconnected && n && n.readyState === n.OPEN && n.send(t), e.bcconnected && I(e.bcChannel, t, e);
|
|
96
|
+
}, te = class extends h {
|
|
97
|
+
constructor(e, t, n, { connect: r = !0, awareness: a = new O(n), params: o = {}, protocols: s = [], WebSocketPolyfill: c = WebSocket, resyncInterval: u = -1, maxBackoffTime: d = 2500, disableBc: f = !1 } = {}) {
|
|
98
98
|
for (super(); e[e.length - 1] === "/";) e = e.slice(0, e.length - 1);
|
|
99
|
-
this.serverUrl = e, this.bcChannel = e + "/" + t, this.maxBackoffTime = d, this.params = o, this.protocols = s, this.roomname = t, this.doc = n, this._WS = c, this.awareness = a, this.wsconnected = !1, this.wsconnecting = !1, this.bcconnected = !1, this.disableBc = f, this.wsUnsuccessfulReconnects = 0, this.messageHandlers =
|
|
99
|
+
this.serverUrl = e, this.bcChannel = e + "/" + t, this.maxBackoffTime = d, this.params = o, this.protocols = s, this.roomname = t, this.doc = n, this._WS = c, this.awareness = a, this.wsconnected = !1, this.wsconnecting = !1, this.bcconnected = !1, this.disableBc = f, this.wsUnsuccessfulReconnects = 0, this.messageHandlers = K.slice(), this._synced = !1, this.ws = null, this.wsLastMessageReceived = 0, this.shouldConnect = r, this._resyncInterval = 0, u > 0 && (this._resyncInterval = setInterval(() => {
|
|
100
100
|
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
|
101
|
-
let e =
|
|
102
|
-
p(e, 0),
|
|
101
|
+
let e = C();
|
|
102
|
+
p(e, 0), L(e, n), this.ws.send(y(e));
|
|
103
103
|
}
|
|
104
104
|
}, u)), this._bcSubscriber = (e, t) => {
|
|
105
105
|
if (t !== this) {
|
|
106
|
-
let t =
|
|
107
|
-
|
|
106
|
+
let t = Y(this, new Uint8Array(e), !1);
|
|
107
|
+
D(t) > 1 && I(this.bcChannel, y(t), this);
|
|
108
108
|
}
|
|
109
109
|
}, this._updateHandler = (e, t) => {
|
|
110
110
|
if (t !== this) {
|
|
111
|
-
let t =
|
|
112
|
-
p(t, 0),
|
|
111
|
+
let t = C();
|
|
112
|
+
p(t, 0), V(t, e), Q(this, y(t));
|
|
113
113
|
}
|
|
114
114
|
}, this.doc.on("update", this._updateHandler), this._awarenessUpdateHandler = ({ added: e, updated: t, removed: n }, r) => {
|
|
115
|
-
let i = e.concat(t).concat(n), o =
|
|
116
|
-
p(o, 1),
|
|
115
|
+
let i = e.concat(t).concat(n), o = C();
|
|
116
|
+
p(o, 1), w(o, E(a, i)), Q(this, y(o));
|
|
117
117
|
}, this._exitHandler = () => {
|
|
118
118
|
v(this.awareness, [n.clientID], "app closed");
|
|
119
119
|
}, l && typeof process < "u" && process.on("exit", this._exitHandler), a.on("update", this._awarenessUpdateHandler), this._checkInterval = setInterval(() => {
|
|
120
|
-
this.wsconnected &&
|
|
121
|
-
},
|
|
120
|
+
this.wsconnected && q < i() - this.wsLastMessageReceived && X(this, this.ws, null);
|
|
121
|
+
}, q / 10), r && this.connect();
|
|
122
122
|
}
|
|
123
123
|
get url() {
|
|
124
|
-
let e =
|
|
124
|
+
let e = G(this.params);
|
|
125
125
|
return this.serverUrl + "/" + this.roomname + (e.length === 0 ? "" : "?" + e);
|
|
126
126
|
}
|
|
127
127
|
get synced() {
|
|
@@ -135,48 +135,73 @@ var K = 3e4, q = (e, t) => console.warn(`Permission denied to access ${e.url}.\n
|
|
|
135
135
|
}
|
|
136
136
|
connectBc() {
|
|
137
137
|
if (this.disableBc) return;
|
|
138
|
-
this.bcconnected ||= (
|
|
139
|
-
let e =
|
|
140
|
-
p(e, 0),
|
|
141
|
-
let t =
|
|
142
|
-
p(t, 0),
|
|
143
|
-
let n =
|
|
144
|
-
p(n, 3),
|
|
145
|
-
let r =
|
|
146
|
-
p(r, 1),
|
|
138
|
+
this.bcconnected ||= (P(this.bcChannel, this._bcSubscriber), !0);
|
|
139
|
+
let e = C();
|
|
140
|
+
p(e, 0), L(e, this.doc), I(this.bcChannel, y(e), this);
|
|
141
|
+
let t = C();
|
|
142
|
+
p(t, 0), R(t, this.doc), I(this.bcChannel, y(t), this);
|
|
143
|
+
let n = C();
|
|
144
|
+
p(n, 3), I(this.bcChannel, y(n), this);
|
|
145
|
+
let r = C();
|
|
146
|
+
p(r, 1), w(r, E(this.awareness, [this.doc.clientID])), I(this.bcChannel, y(r), this);
|
|
147
147
|
}
|
|
148
148
|
disconnectBc() {
|
|
149
|
-
let e =
|
|
150
|
-
p(e, 1),
|
|
149
|
+
let e = C();
|
|
150
|
+
p(e, 1), w(e, E(this.awareness, [this.doc.clientID], /* @__PURE__ */ new Map())), Q(this, y(e)), this.bcconnected &&= (F(this.bcChannel, this._bcSubscriber), !1);
|
|
151
151
|
}
|
|
152
152
|
disconnect() {
|
|
153
|
-
this.shouldConnect = !1, this.disconnectBc(), this.ws !== null &&
|
|
153
|
+
this.shouldConnect = !1, this.disconnectBc(), this.ws !== null && X(this, this.ws, null);
|
|
154
154
|
}
|
|
155
155
|
connect() {
|
|
156
|
-
this.shouldConnect = !0, !this.wsconnected && this.ws === null && (
|
|
156
|
+
this.shouldConnect = !0, !this.wsconnected && this.ws === null && (Z(this), this.connectBc());
|
|
157
157
|
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
158
|
+
};
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region src/lib/realtime.ts
|
|
161
|
+
function ne(e, t, n, r) {
|
|
162
|
+
return {
|
|
163
|
+
serverUrl: `${n === "https:" ? "wss:" : "ws:"}//${r}/api/ws/collab`,
|
|
164
|
+
roomName: e,
|
|
165
|
+
params: t ? { token: t } : void 0
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
function re(e, t, n, r, i) {
|
|
169
|
+
return i?.resolveRealtimeConnection({
|
|
170
|
+
documentId: e,
|
|
171
|
+
accessToken: t
|
|
172
|
+
}) ?? ne(e, t, n, r);
|
|
173
|
+
}
|
|
174
|
+
//#endregion
|
|
175
|
+
//#region src/lib/collaboration.ts
|
|
176
|
+
var $ = /* @__PURE__ */ new Set();
|
|
177
|
+
function ie(e, t, n, r) {
|
|
178
|
+
let i = new m(), a = re(e, t, window.location.protocol, window.location.host, r), o = new te(a.serverUrl, a.roomName, i, {
|
|
162
179
|
connect: !0,
|
|
163
|
-
params:
|
|
180
|
+
params: a.params
|
|
164
181
|
});
|
|
165
|
-
|
|
166
|
-
let
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
182
|
+
o.on("sync", (e) => {}), o.on("status", (e) => {}), o.on("connection-close", () => {});
|
|
183
|
+
let s = n;
|
|
184
|
+
s && i.on("update", s);
|
|
185
|
+
let c = {
|
|
186
|
+
provider: o,
|
|
187
|
+
doc: i,
|
|
170
188
|
destroy: () => {
|
|
171
|
-
|
|
189
|
+
s && i.off("update", s), o.disconnect(), o.destroy(), i.destroy();
|
|
172
190
|
}
|
|
173
|
-
},
|
|
191
|
+
}, l = c.destroy;
|
|
192
|
+
return c.destroy = () => {
|
|
193
|
+
$.delete(c) && l();
|
|
194
|
+
}, $.add(c), c;
|
|
174
195
|
}
|
|
175
|
-
function
|
|
176
|
-
|
|
196
|
+
function ae(e) {
|
|
197
|
+
if (e) {
|
|
198
|
+
e.destroy();
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
for (let e of [...$]) e.destroy();
|
|
177
202
|
}
|
|
178
|
-
function
|
|
179
|
-
return
|
|
203
|
+
function oe() {
|
|
204
|
+
return [...$].at(-1) ?? null;
|
|
180
205
|
}
|
|
181
206
|
//#endregion
|
|
182
|
-
export {
|
|
207
|
+
export { oe as getActiveSession, ie as startCollaboration, ae as stopCollaboration };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../CategoryDialog-
|
|
1
|
+
import { t as e } from "../CategoryDialog-DmlX0Z97.js";
|
|
2
2
|
export { e as CategoryDialog };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../CreateSnapshotDialog-
|
|
1
|
+
import { t as e } from "../CreateSnapshotDialog-CXW4sCuf.js";
|
|
2
2
|
export { e as CreateSnapshotDialog };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../DeleteDialog-
|
|
1
|
+
import { t as e } from "../DeleteDialog-8k6JYWCx.js";
|
|
2
2
|
export { e as DeleteDialog };
|