@hiai-gg/docsmint 0.3.6 → 0.3.7
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/backend/index.js +1 -1
- package/dist/frontend/CategoryDialog--rIE7FrH.js +580 -0
- package/dist/frontend/ConfirmDialog-Cpzyb55f.js +212 -0
- package/dist/frontend/CreateSnapshotDialog-CmkV-n2A.js +216 -0
- package/dist/frontend/DatePicker-Byynca7V.js +257 -0
- package/dist/frontend/DeleteDialog-ap6nOywZ.js +174 -0
- package/dist/frontend/FolderDialog-DmN_trV0.js +247 -0
- package/dist/frontend/FolderNode-C4B8a2fd.js +317 -0
- package/dist/frontend/FolderTreeSelector-D6ijiZTA.js +100 -0
- package/dist/frontend/Icon-DtNo0N1U.js +64 -0
- package/dist/frontend/SettingsDialog-2kTaTXAs.js +992 -0
- package/dist/frontend/ShareDialog-BBDGNF5n.js +165 -0
- package/dist/frontend/TagCreateDialog-DiLZnJo4.js +258 -0
- package/dist/frontend/api/attachments.d.ts +6 -0
- package/dist/frontend/api/attachments.js +2 -0
- package/dist/frontend/api/categories.js +1 -1
- package/dist/frontend/api/documents.js +1 -1
- package/dist/frontend/api/folders.js +1 -1
- package/dist/frontend/api/settings.js +1 -1
- package/dist/frontend/api/share.d.ts +5 -0
- package/dist/frontend/api/share.js +2 -0
- package/dist/frontend/api/tags.js +1 -1
- package/dist/frontend/api-keys-CpkrA8rD.js +35 -0
- package/dist/frontend/attachments-BuILSs56.js +50 -0
- package/dist/frontend/{settings-PCrOtied.js → auth-client-Cygmp1I2.js} +205 -265
- package/dist/frontend/awareness-snQ3RD9f.js +3714 -0
- package/dist/frontend/bundle-mjs-CP6Owz-8.js +1723 -0
- package/dist/frontend/camera-B7dAOd4s.js +28 -0
- package/dist/frontend/{categories-BE6ZpZl8.js → categories-izQovv2w.js} +1 -1
- package/dist/frontend/check-CDwRlG9T.js +24 -0
- package/dist/frontend/chevron-down-B7ZrjUmT.js +24 -0
- package/dist/frontend/circle-check-CDqeMB2d.js +28 -0
- package/dist/frontend/{client-C6QQGb0e.js → client-Bc5Fzx40.js} +833 -814
- package/dist/frontend/{client-B9hzI0W8.js → client-GbtOH90i.js} +1 -1
- package/dist/frontend/clipboard-Cgzxc0_R.js +16 -0
- package/dist/frontend/clock-Ck5Sn-Zl.js +28 -0
- package/dist/frontend/clsx-nmtDPO_P.js +16 -0
- package/dist/frontend/collaboration.d.ts +6 -0
- package/dist/frontend/collaboration.js +182 -0
- package/dist/frontend/components/category-dialog.d.ts +2 -0
- package/dist/frontend/components/category-dialog.js +2 -0
- package/dist/frontend/components/create-snapshot-dialog.d.ts +2 -0
- package/dist/frontend/components/create-snapshot-dialog.js +2 -0
- package/dist/frontend/components/delete-dialog.d.ts +2 -0
- package/dist/frontend/components/delete-dialog.js +2 -0
- package/dist/frontend/components/editor/document-editor.d.ts +3 -0
- package/dist/frontend/components/editor/document-editor.js +3021 -0
- package/dist/frontend/components/editor/document-title.d.ts +2 -0
- package/dist/frontend/components/editor/document-title.js +31 -0
- package/dist/frontend/components/editor/docx-serializer.d.ts +2 -0
- package/dist/frontend/components/editor/docx-serializer.js +14600 -0
- package/dist/frontend/components/editor/extensions.d.ts +2 -0
- package/dist/frontend/components/editor/extensions.js +2 -0
- package/dist/frontend/components/editor/markdown-toggle.d.ts +2 -0
- package/dist/frontend/components/editor/markdown-toggle.js +72 -0
- package/dist/frontend/components/editor/markdown.d.ts +1 -0
- package/dist/frontend/components/editor/markdown.js +2 -0
- package/dist/frontend/components/folder-node.d.ts +3 -0
- package/dist/frontend/components/folder-node.js +2 -0
- package/dist/frontend/components/folder-tree-selector.d.ts +2 -0
- package/dist/frontend/components/folder-tree-selector.js +2 -0
- package/dist/frontend/components/save-as-dialog.d.ts +2 -0
- package/dist/frontend/components/save-as-dialog.js +254 -0
- package/dist/frontend/components/settings.js +1 -1
- package/dist/frontend/components/share-dialog.d.ts +2 -0
- package/dist/frontend/components/share-dialog.js +2 -0
- package/dist/frontend/components/sidebar.js +1206 -3762
- package/dist/frontend/components/tag-create-dialog.d.ts +2 -0
- package/dist/frontend/components/tag-create-dialog.js +2 -0
- package/dist/frontend/components/version-history.d.ts +2 -0
- package/dist/frontend/components/version-history.js +293 -0
- package/dist/frontend/{context-DbnW5yib.js → context-BMD6XTPe.js} +0 -3
- package/dist/frontend/copy-CMAA6GP0.js +31 -0
- package/dist/frontend/dashboard.js +1148 -1224
- package/dist/frontend/{SettingsDialog-D4pgFD0D.js → db-ByrlYfaI.js} +923 -2002
- package/dist/frontend/dialog-BDkiG42a.js +213 -0
- package/dist/frontend/disclose-version-5I57E3LD.js +3 -0
- package/dist/frontend/dndzone-BzsOINtP.js +1199 -0
- package/dist/frontend/doc-tabs.d.ts +7 -0
- package/dist/frontend/doc-tabs.js +14 -0
- package/dist/frontend/document-drop-coordinator-C4xHMjwC.js +68 -0
- package/dist/frontend/document-drop-coordinator.d.ts +2 -0
- package/dist/frontend/document-drop-coordinator.js +2 -0
- package/dist/frontend/{documents-DFVS9SsL.js → documents-BsDkvzCm.js} +1 -1
- package/dist/frontend/editorExtensions-BMHvUbdk.js +27021 -0
- package/dist/frontend/ellipsis-vertical-BBuPldbW.js +519 -0
- package/dist/frontend/extension.js +6 -5
- package/dist/frontend/floating-layer-anchor-C51M4l6v.js +4513 -0
- package/dist/frontend/folder-TQjKY4yn.js +44 -0
- package/dist/frontend/folder-refresh.d.ts +8 -0
- package/dist/frontend/folder-refresh.js +2 -0
- package/dist/frontend/{folders-CGe9diAG.js → folders-CTuV_JtU.js} +1 -1
- package/dist/frontend/frontend.css +1 -1
- package/dist/frontend/i18n.js +1 -1
- package/dist/frontend/identity-DyWeNzu_.js +69 -0
- package/dist/frontend/index-client-jobkrWVL.js +86 -0
- package/dist/frontend/input-CBI6p4Xl.js +23 -0
- package/dist/frontend/keyboard.d.ts +14 -0
- package/dist/frontend/keyboard.js +2 -0
- package/dist/frontend/keyboard.svelte-D7H8DihC.js +133 -0
- package/dist/frontend/label-C-GkhEp4.js +30 -0
- package/dist/frontend/loader-circle-Bk-WFz9g.js +267 -0
- package/dist/frontend/markdown-BwnyjITU.js +11 -0
- package/dist/frontend/messages-BpYaLbzE.js +1091 -0
- package/dist/frontend/offline/identity.d.ts +6 -0
- package/dist/frontend/offline/identity.js +2 -0
- package/dist/frontend/resolve-BG4HgzpN.js +19 -0
- package/dist/frontend/rolldown-runtime-CWhphoD1.js +23 -0
- package/dist/frontend/rotate-ccw-CleZtJ5D.js +24 -0
- package/dist/frontend/search.js +637 -628
- package/dist/frontend/select-value-CvrWRkXW.js +1436 -0
- package/dist/frontend/settings-blyobazp.js +62 -0
- package/dist/frontend/share-Cu7SSJuJ.js +28 -0
- package/dist/frontend/shared-document.js +41 -40
- package/dist/frontend/subfolders-refresh-store.svelte-BsheoQma.js +65 -0
- package/dist/frontend/{tag-C5xrg-bb.js → tag-Dx3SmucJ.js} +7 -7
- package/dist/frontend/tag-store.svelte-CIaF4sdZ.js +29 -0
- package/dist/frontend/{tags-DVXTut0p.js → tags-CtCV0Djo.js} +1 -1
- package/dist/frontend/textarea-Dfp78XlL.js +23 -0
- package/dist/frontend/theme.js +1 -1
- package/dist/frontend/{theme.svelte-ei0QxXa8.js → theme.svelte-CROg1Hi5.js} +7 -7
- package/dist/frontend/types.d.ts +6 -0
- package/dist/frontend/types.js +0 -0
- package/dist/frontend/utils/clipboard.d.ts +1 -0
- package/dist/frontend/utils/clipboard.js +2 -0
- package/dist/frontend/utils/dndzone.d.ts +4 -0
- package/dist/frontend/utils/dndzone.js +2 -0
- package/dist/frontend/utils-C0OW2678.js +20 -0
- package/dist/frontend/utils-D8kmM3ub.js +8 -0
- package/dist/frontend/utils.d.ts +4 -0
- package/dist/frontend/utils.js +2 -0
- package/dist/frontend/x-DaTdeDXv.js +24 -0
- package/package.json +109 -1
- package/packages/cli/src/index.ts +1 -1
- package/packages/mcp-server/src/index.ts +1 -1
- package/dist/frontend/DatePicker-BcMD49PV.js +0 -275
- package/dist/frontend/ShareDialog-Dzh7rV7J.js +0 -1317
- package/dist/frontend/input-ieWIt8I7.js +0 -257
- package/dist/frontend/messages-CTGAsqFu.js +0 -1106
- package/dist/frontend/resolve-Bl6xmJl_.js +0 -2068
- package/dist/frontend/tag-store.svelte-B3839FYq.js +0 -6152
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/lib/utils/clipboard.ts
|
|
2
|
+
async function e(e) {
|
|
3
|
+
if (navigator.clipboard?.writeText) try {
|
|
4
|
+
return await navigator.clipboard.writeText(e), !0;
|
|
5
|
+
} catch {}
|
|
6
|
+
try {
|
|
7
|
+
let t = document.createElement("textarea");
|
|
8
|
+
t.value = e, t.style.cssText = "position:fixed;left:-9999px;top:-9999px;opacity:0;", document.body.appendChild(t), t.select();
|
|
9
|
+
let n = document.execCommand("copy");
|
|
10
|
+
return document.body.removeChild(t), n;
|
|
11
|
+
} catch {
|
|
12
|
+
return !1;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { e as t };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import "./disclose-version-5I57E3LD.js";
|
|
2
|
+
import { $ as e, A as t, S as n, i as r, j as i, t as a } from "./client-Bc5Fzx40.js";
|
|
3
|
+
import { t as o } from "./Icon-DtNo0N1U.js";
|
|
4
|
+
//#region ../node_modules/.bun/lucide-svelte@1.0.1+ff5f301bb2db9a0d/node_modules/lucide-svelte/dist/icons/clock.svelte
|
|
5
|
+
function s(s, c) {
|
|
6
|
+
let l = a(c, [
|
|
7
|
+
"children",
|
|
8
|
+
"$$slots",
|
|
9
|
+
"$$events",
|
|
10
|
+
"$$legacy"
|
|
11
|
+
]), u = [["circle", {
|
|
12
|
+
cx: "12",
|
|
13
|
+
cy: "12",
|
|
14
|
+
r: "10"
|
|
15
|
+
}], ["path", { d: "M12 6v6l4 2" }]];
|
|
16
|
+
o(s, r({ name: "clock" }, () => l, {
|
|
17
|
+
get iconNode() {
|
|
18
|
+
return u;
|
|
19
|
+
},
|
|
20
|
+
children: (r, a) => {
|
|
21
|
+
var o = i();
|
|
22
|
+
n(e(o), c, "default", {}, null), t(r, o);
|
|
23
|
+
},
|
|
24
|
+
$$slots: { default: !0 }
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { s as t };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region ../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
2
|
+
function e(t) {
|
|
3
|
+
var n, r, i = "";
|
|
4
|
+
if (typeof t == "string" || typeof t == "number") i += t;
|
|
5
|
+
else if (typeof t == "object") if (Array.isArray(t)) {
|
|
6
|
+
var a = t.length;
|
|
7
|
+
for (n = 0; n < a; n++) t[n] && (r = e(t[n])) && (i && (i += " "), i += r);
|
|
8
|
+
} else for (r in t) t[r] && (i && (i += " "), i += r);
|
|
9
|
+
return i;
|
|
10
|
+
}
|
|
11
|
+
function t() {
|
|
12
|
+
for (var t, n, r = 0, i = "", a = arguments.length; r < a; r++) (t = arguments[r]) && (n = e(t)) && (i && (i += " "), i += n);
|
|
13
|
+
return i;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { t };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { WebsocketProvider } from "y-websocket";
|
|
2
|
+
import type * as Y from "yjs";
|
|
3
|
+
export interface CollaborationSession { provider: WebsocketProvider; doc: Y.Doc; destroy(): void; }
|
|
4
|
+
export declare function startCollaboration(documentId: string, accessToken: string, onUpdate?: (update: Uint8Array) => void): CollaborationSession;
|
|
5
|
+
export declare function stopCollaboration(): void;
|
|
6
|
+
export declare function getActiveSession(): CollaborationSession | null;
|
|
@@ -0,0 +1,182 @@
|
|
|
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 ee, n as x, nt as S, ot as C, q as w, r as T, rt as E, t as D, ut as O, z as k } from "./awareness-snQ3RD9f.js";
|
|
2
|
+
//#region ../node_modules/.bun/lib0@0.2.117/node_modules/lib0/broadcastchannel.js
|
|
3
|
+
var A = /* @__PURE__ */ new Map(), j = class {
|
|
4
|
+
constructor(e) {
|
|
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
|
+
}
|
|
7
|
+
postMessage(e) {
|
|
8
|
+
w.setItem(this.room, k(r(e)));
|
|
9
|
+
}
|
|
10
|
+
close() {
|
|
11
|
+
n(this._onChange);
|
|
12
|
+
}
|
|
13
|
+
}, te = typeof BroadcastChannel > "u" ? j : BroadcastChannel, M = (e) => ee(A, e, () => {
|
|
14
|
+
let t = g(), n = new te(e);
|
|
15
|
+
return n.onmessage = (e) => t.forEach((t) => t(e.data, "broadcastchannel")), {
|
|
16
|
+
bc: n,
|
|
17
|
+
subs: t
|
|
18
|
+
};
|
|
19
|
+
}), N = (e, t) => (M(e).subs.add(t), t), P = (e, t) => {
|
|
20
|
+
let n = M(e), r = n.subs.delete(t);
|
|
21
|
+
return r && n.subs.size === 0 && (n.bc.close(), A.delete(e)), r;
|
|
22
|
+
}, F = (e, t, n = null) => {
|
|
23
|
+
let r = M(e);
|
|
24
|
+
r.bc.postMessage(t), r.subs.forEach((e) => e(t, n));
|
|
25
|
+
}, I = (e, n) => {
|
|
26
|
+
p(e, 0), C(e, t(n));
|
|
27
|
+
}, L = (e, t, n) => {
|
|
28
|
+
p(e, 1), C(e, c(t, n));
|
|
29
|
+
}, R = (t, n, r) => L(n, r, e(t)), z = (t, n, r, i) => {
|
|
30
|
+
try {
|
|
31
|
+
_(n, e(t), r);
|
|
32
|
+
} catch (e) {
|
|
33
|
+
i?.(e), console.error("Caught error while handling a Yjs update", e);
|
|
34
|
+
}
|
|
35
|
+
}, B = (e, t) => {
|
|
36
|
+
p(e, 2), C(e, t);
|
|
37
|
+
}, V = z, H = (e, t, n, r, i) => {
|
|
38
|
+
let a = o(e);
|
|
39
|
+
switch (a) {
|
|
40
|
+
case 0:
|
|
41
|
+
R(e, t, n);
|
|
42
|
+
break;
|
|
43
|
+
case 1:
|
|
44
|
+
z(e, n, r, i);
|
|
45
|
+
break;
|
|
46
|
+
case 2:
|
|
47
|
+
V(e, n, r, i);
|
|
48
|
+
break;
|
|
49
|
+
default: throw Error("Unknown message type");
|
|
50
|
+
}
|
|
51
|
+
return a;
|
|
52
|
+
}, U = (e, t, n) => {
|
|
53
|
+
switch (o(e)) {
|
|
54
|
+
case 0: n(t, f(e));
|
|
55
|
+
}
|
|
56
|
+
}, W = (e) => u(e, (e, t) => `${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&"), G = [];
|
|
57
|
+
G[0] = (e, t, n, r, i) => {
|
|
58
|
+
p(e, 0);
|
|
59
|
+
let a = H(t, e, n.doc, n);
|
|
60
|
+
r && a === 1 && !n.synced && (n.synced = !0);
|
|
61
|
+
}, G[3] = (e, t, n, r, i) => {
|
|
62
|
+
p(e, 1), C(e, T(n.awareness, Array.from(n.awareness.getStates().keys())));
|
|
63
|
+
}, G[1] = (t, n, r, i, a) => {
|
|
64
|
+
x(r.awareness, e(n), r);
|
|
65
|
+
}, G[2] = (e, t, n, r, i) => {
|
|
66
|
+
U(t, n.doc, (e, t) => q(n, t));
|
|
67
|
+
};
|
|
68
|
+
var K = 3e4, q = (e, t) => console.warn(`Permission denied to access ${e.url}.\n${t}`), J = (e, t, n) => {
|
|
69
|
+
let r = d(t), i = S(), a = o(r), s = e.messageHandlers[a];
|
|
70
|
+
return s ? s(i, r, e, n, a) : console.error("Unable to compute message"), i;
|
|
71
|
+
}, Y = (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(X, b(O(2, e.wsUnsuccessfulReconnects) * 100, e.maxBackoffTime), e));
|
|
73
|
+
}, X = (e) => {
|
|
74
|
+
if (e.shouldConnect && e.ws === null) {
|
|
75
|
+
let t = new e._WS(e.url, e.protocols);
|
|
76
|
+
t.binaryType = "arraybuffer", e.ws = t, e.wsconnecting = !0, e.wsconnected = !1, e.synced = !1, t.onmessage = (n) => {
|
|
77
|
+
e.wsLastMessageReceived = i();
|
|
78
|
+
let r = J(e, new Uint8Array(n.data), !0);
|
|
79
|
+
E(r) > 1 && t.send(y(r));
|
|
80
|
+
}, t.onerror = (t) => {
|
|
81
|
+
e.emit("connection-error", [t, e]);
|
|
82
|
+
}, t.onclose = (n) => {
|
|
83
|
+
Y(e, t, n);
|
|
84
|
+
}, t.onopen = () => {
|
|
85
|
+
e.wsLastMessageReceived = i(), e.wsconnecting = !1, e.wsconnected = !0, e.wsUnsuccessfulReconnects = 0, e.emit("status", [{ status: "connected" }]);
|
|
86
|
+
let n = S();
|
|
87
|
+
if (p(n, 0), I(n, e.doc), t.send(y(n)), e.awareness.getLocalState() !== null) {
|
|
88
|
+
let n = S();
|
|
89
|
+
p(n, 1), C(n, T(e.awareness, [e.doc.clientID])), t.send(y(n));
|
|
90
|
+
}
|
|
91
|
+
}, e.emit("status", [{ status: "connecting" }]);
|
|
92
|
+
}
|
|
93
|
+
}, Z = (e, t) => {
|
|
94
|
+
let n = e.ws;
|
|
95
|
+
e.wsconnected && n && n.readyState === n.OPEN && n.send(t), e.bcconnected && F(e.bcChannel, t, e);
|
|
96
|
+
}, ne = class extends h {
|
|
97
|
+
constructor(e, t, n, { connect: r = !0, awareness: a = new D(n), params: o = {}, protocols: s = [], WebSocketPolyfill: c = WebSocket, resyncInterval: u = -1, maxBackoffTime: d = 2500, disableBc: f = !1 } = {}) {
|
|
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 = G.slice(), this._synced = !1, this.ws = null, this.wsLastMessageReceived = 0, this.shouldConnect = r, this._resyncInterval = 0, u > 0 && (this._resyncInterval = setInterval(() => {
|
|
100
|
+
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
|
101
|
+
let e = S();
|
|
102
|
+
p(e, 0), I(e, n), this.ws.send(y(e));
|
|
103
|
+
}
|
|
104
|
+
}, u)), this._bcSubscriber = (e, t) => {
|
|
105
|
+
if (t !== this) {
|
|
106
|
+
let t = J(this, new Uint8Array(e), !1);
|
|
107
|
+
E(t) > 1 && F(this.bcChannel, y(t), this);
|
|
108
|
+
}
|
|
109
|
+
}, this._updateHandler = (e, t) => {
|
|
110
|
+
if (t !== this) {
|
|
111
|
+
let t = S();
|
|
112
|
+
p(t, 0), B(t, e), Z(this, y(t));
|
|
113
|
+
}
|
|
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 = S();
|
|
116
|
+
p(o, 1), C(o, T(a, i)), Z(this, y(o));
|
|
117
|
+
}, this._exitHandler = () => {
|
|
118
|
+
v(this.awareness, [n.clientID], "app closed");
|
|
119
|
+
}, l && typeof process < "u" && process.on("exit", this._exitHandler), a.on("update", this._awarenessUpdateHandler), this._checkInterval = setInterval(() => {
|
|
120
|
+
this.wsconnected && K < i() - this.wsLastMessageReceived && Y(this, this.ws, null);
|
|
121
|
+
}, K / 10), r && this.connect();
|
|
122
|
+
}
|
|
123
|
+
get url() {
|
|
124
|
+
let e = W(this.params);
|
|
125
|
+
return this.serverUrl + "/" + this.roomname + (e.length === 0 ? "" : "?" + e);
|
|
126
|
+
}
|
|
127
|
+
get synced() {
|
|
128
|
+
return this._synced;
|
|
129
|
+
}
|
|
130
|
+
set synced(e) {
|
|
131
|
+
this._synced !== e && (this._synced = e, this.emit("synced", [e]), this.emit("sync", [e]));
|
|
132
|
+
}
|
|
133
|
+
destroy() {
|
|
134
|
+
this._resyncInterval !== 0 && clearInterval(this._resyncInterval), clearInterval(this._checkInterval), this.disconnect(), l && typeof process < "u" && process.off("exit", this._exitHandler), this.awareness.off("update", this._awarenessUpdateHandler), this.doc.off("update", this._updateHandler), super.destroy();
|
|
135
|
+
}
|
|
136
|
+
connectBc() {
|
|
137
|
+
if (this.disableBc) return;
|
|
138
|
+
this.bcconnected ||= (N(this.bcChannel, this._bcSubscriber), !0);
|
|
139
|
+
let e = S();
|
|
140
|
+
p(e, 0), I(e, this.doc), F(this.bcChannel, y(e), this);
|
|
141
|
+
let t = S();
|
|
142
|
+
p(t, 0), L(t, this.doc), F(this.bcChannel, y(t), this);
|
|
143
|
+
let n = S();
|
|
144
|
+
p(n, 3), F(this.bcChannel, y(n), this);
|
|
145
|
+
let r = S();
|
|
146
|
+
p(r, 1), C(r, T(this.awareness, [this.doc.clientID])), F(this.bcChannel, y(r), this);
|
|
147
|
+
}
|
|
148
|
+
disconnectBc() {
|
|
149
|
+
let e = S();
|
|
150
|
+
p(e, 1), C(e, T(this.awareness, [this.doc.clientID], /* @__PURE__ */ new Map())), Z(this, y(e)), this.bcconnected &&= (P(this.bcChannel, this._bcSubscriber), !1);
|
|
151
|
+
}
|
|
152
|
+
disconnect() {
|
|
153
|
+
this.shouldConnect = !1, this.disconnectBc(), this.ws !== null && Y(this, this.ws, null);
|
|
154
|
+
}
|
|
155
|
+
connect() {
|
|
156
|
+
this.shouldConnect = !0, !this.wsconnected && this.ws === null && (X(this), this.connectBc());
|
|
157
|
+
}
|
|
158
|
+
}, Q = null;
|
|
159
|
+
function re(e, t, n) {
|
|
160
|
+
$();
|
|
161
|
+
let r = new m(), i = new ne(`${window.location.protocol === "https:" ? "wss:" : "ws:"}//${window.location.hostname}${window.location.port ? `:${window.location.port}` : ""}/api/ws/collab/${e}?token=${encodeURIComponent(t)}`, e, r, {
|
|
162
|
+
connect: !0,
|
|
163
|
+
params: { token: t }
|
|
164
|
+
});
|
|
165
|
+
i.on("sync", (e) => {}), i.on("status", (e) => {}), i.on("connection-close", () => {});
|
|
166
|
+
let a = n;
|
|
167
|
+
return a && r.on("update", a), Q = {
|
|
168
|
+
provider: i,
|
|
169
|
+
doc: r,
|
|
170
|
+
destroy: () => {
|
|
171
|
+
a && r.off("update", a), i.disconnect(), i.destroy(), r.destroy();
|
|
172
|
+
}
|
|
173
|
+
}, Q;
|
|
174
|
+
}
|
|
175
|
+
function $() {
|
|
176
|
+
Q &&= (Q.destroy(), null);
|
|
177
|
+
}
|
|
178
|
+
function ie() {
|
|
179
|
+
return Q;
|
|
180
|
+
}
|
|
181
|
+
//#endregion
|
|
182
|
+
export { ie as getActiveSession, re as startCollaboration, $ as stopCollaboration };
|