pptx-svelte-viewer 2.20.3 → 2.20.5
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/CHANGELOG.md +12 -0
- package/dist/{AiChatPanel-BSSU_rdb.js → AiChatPanel-gUaCLYgo.js} +471 -467
- package/dist/{GLTFLoader-CAjQhVgN.js → GLTFLoader-9vQ_XShd.js} +43 -44
- package/dist/{OrbitControls-B2ezETBF.js → OrbitControls-DRqFov_0.js} +5 -9
- package/dist/{awareness-CkFlr7xx.js → awareness-CrSnuSE_.js} +1 -1
- package/dist/{export-Cg11dsXy.js → export-BJ59Rfa6.js} +20375 -20292
- package/dist/index.js +1 -1
- package/dist/{smartart-3d-BLqXYusO.js → smartart-3d-CX2GnyTe.js} +2 -2
- package/dist/{three.module-BLwnGxzY.js → three.module-BAfeCwYa.js} +890 -868
- package/dist/viewer/collab/collaboration-remote-sync.d.ts +2 -2
- package/dist/viewer/collab/collaboration-remote-sync.d.ts.map +1 -1
- package/dist/viewer/collab/collaboration.svelte.d.ts +2 -2
- package/dist/viewer/collab/collaboration.svelte.d.ts.map +1 -1
- package/dist/viewer/index.d.ts +41 -2
- package/dist/viewer/index.js +1 -1
- package/dist/viewer/state/presentation-loader.svelte.d.ts +8 -2
- package/dist/viewer/state/presentation-loader.svelte.d.ts.map +1 -1
- package/dist/viewer/state/viewer-effects.svelte.d.ts.map +1 -1
- package/dist/{y-webrtc-Cph8DzuM.js → y-webrtc-Ctru8jg8.js} +37 -38
- package/dist/y-websocket-BgHVdw-O.js +125 -0
- package/dist/{yjs-CE9F053g.js → yjs-DbU20bpp.js} +383 -385
- package/package.json +6 -6
- package/dist/y-websocket-C6aE1Dkp.js +0 -115
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PptxSlide } from 'pptx-viewer-core';
|
|
2
|
-
import { CollaborationConfig, YDocLike, YjsFactories } from 'pptx-viewer-shared';
|
|
2
|
+
import { CollabLoadOrigin, CollaborationConfig, YDocLike, YjsFactories } from 'pptx-viewer-shared';
|
|
3
3
|
export interface ObserveRemoteDeps {
|
|
4
4
|
isApplyingRemote: () => boolean;
|
|
5
5
|
setApplyingRemote: (value: boolean) => void;
|
|
@@ -19,7 +19,7 @@ export type AdoptDocSlidesDeps = Pick<ObserveRemoteDeps, 'setApplyingRemote' | '
|
|
|
19
19
|
* win; an empty room means this client is the seeder and its loaded deck
|
|
20
20
|
* stands (written into the doc by the normal gated publish path).
|
|
21
21
|
*/
|
|
22
|
-
export declare function adoptDocSlidesAfterLoad(ydoc: YDocLike, deps: AdoptDocSlidesDeps): void;
|
|
22
|
+
export declare function adoptDocSlidesAfterLoad(ydoc: YDocLike, deps: AdoptDocSlidesDeps, origin?: CollabLoadOrigin): void;
|
|
23
23
|
/** Register the remote-slide observer; returns the unobserve function. */
|
|
24
24
|
export declare function observeRemoteSlides(ydoc: YDocLike, config: CollaborationConfig, deps: ObserveRemoteDeps): () => void;
|
|
25
25
|
/** Everything `publishLocalSlides` needs from the controller's private state. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collaboration-remote-sync.d.ts","sourceRoot":"","sources":["../../../src/viewer/collab/collaboration-remote-sync.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"collaboration-remote-sync.d.ts","sourceRoot":"","sources":["../../../src/viewer/collab/collaboration-remote-sync.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EACX,gBAAgB,EAChB,mBAAmB,EACnB,QAAQ,EACR,YAAY,EACZ,MAAM,oBAAoB,CAAC;AAS5B,MAAM,WAAW,iBAAiB;IACjC,gBAAgB,EAAE,MAAM,OAAO,CAAC;IAChC,iBAAiB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,iBAAiB,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,IAAI,CAAC;IACjD,iBAAiB,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAC;CACzD;AAED,yFAAyF;AACzF,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACpC,iBAAiB,EACjB,mBAAmB,GAAG,eAAe,GAAG,mBAAmB,CAC3D,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CACtC,IAAI,EAAE,QAAQ,EACd,IAAI,EAAE,kBAAkB,EACxB,MAAM,GAAE,gBAAyB,GAC/B,IAAI,CAeN;AAED,0EAA0E;AAC1E,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,mBAAmB,EAC3B,IAAI,EAAE,iBAAiB,GACrB,MAAM,IAAI,CAgBZ;AAED,iFAAiF;AACjF,MAAM,WAAW,uBAAuB;IACvC,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,YAAY,GAAG,IAAI,CAAC;IAC/B,6EAA6E;IAC7E,cAAc,EAAE,OAAO,CAAC;IACxB,IAAI,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAClC,8DAA8D;IAC9D,UAAU,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,GAAG,MAAM,GAAG,IAAI,CAehF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CollaborationConfig, CollaborationLivePatcher, ConnectionStatus, RemoteCursor, SanitizedPresence } from 'pptx-viewer-shared';
|
|
1
|
+
import { CollaborationConfig, CollabLoadOrigin, CollaborationLivePatcher, ConnectionStatus, RemoteCursor, SanitizedPresence } from 'pptx-viewer-shared';
|
|
2
2
|
import { CollaborationDeps } from './collaboration-deps';
|
|
3
3
|
/**
|
|
4
4
|
* The collaboration controller. Construct it once during component setup: it
|
|
@@ -37,7 +37,7 @@ export declare class CollaborationController {
|
|
|
37
37
|
* publish effect can flush the freshly loaded slides into the doc, so a
|
|
38
38
|
* late joiner's bootstrap deck never clobbers the room's synced content.
|
|
39
39
|
*/
|
|
40
|
-
adoptDocAfterLoad(): void;
|
|
40
|
+
adoptDocAfterLoad(origin?: CollabLoadOrigin): void;
|
|
41
41
|
/** Start (or restart) a session with the given config (dialog-driven). */
|
|
42
42
|
start(config: CollaborationConfig): Promise<void>;
|
|
43
43
|
stop(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collaboration.svelte.d.ts","sourceRoot":"","sources":["../../../src/viewer/collab/collaboration.svelte.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACX,mBAAmB,EACnB,wBAAwB,EACxB,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EAGjB,MAAM,oBAAoB,CAAC;AAW5B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAc9D;;;;GAIG;AACH,qBAAa,uBAAuB;;IACnC,yCAAyC;IACzC,MAAM,mBAA4C;IAClD,8EAA8E;IAC9E,QAAQ,CAAC,WAAW,EAAE,wBAAwB,CAAoC;gBA0BtE,IAAI,EAAE,iBAAiB;IAuBnC,4CAA4C;IAC5C,IAAI,MAAM,IAAI,OAAO,CAEpB;IACD,+FAA+F;IAC/F,IAAI,QAAQ,IAAI,OAAO,CAEtB;IACD,sDAAsD;IACtD,IAAI,OAAO,IAAI,YAAY,EAAE,CAE5B;IACD,sDAAsD;IACtD,IAAI,eAAe,IAAI,iBAAiB,EAAE,CAEzC;IACD,+DAA+D;IAC/D,IAAI,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAEpC;IAED,+EAA+E;IAC/E,SAAS,CAAC,CAAC,EAAE,MAAM,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IACpE,YAAY,CAAC,iBAAiB,EAAE,MAAM,GAAG,SAAS,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI;IAGpF,uEAAuE;IACvE,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAGnC,yEAAyE;IACzE,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAIzC;;;;;;OAMG;IACH,iBAAiB,CAAC,MAAM,GAAE,gBAAyB,GAAG,IAAI;IA8C1D,0EAA0E;IACpE,KAAK,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAsFvD,IAAI,IAAI,IAAI;CAoBZ"}
|
package/dist/viewer/index.d.ts
CHANGED
|
@@ -9488,6 +9488,39 @@ interface CollaborationLivePatcher {
|
|
|
9488
9488
|
dispose: () => void;
|
|
9489
9489
|
}
|
|
9490
9490
|
//#endregion
|
|
9491
|
+
//#region src/render/collaboration-load-origin.d.ts
|
|
9492
|
+
/**
|
|
9493
|
+
* Who asked for the deck that just finished loading, and what that means for a
|
|
9494
|
+
* room that already holds slides.
|
|
9495
|
+
*
|
|
9496
|
+
* Every binding brackets its content-load with an adoption check: when a load
|
|
9497
|
+
* lands while a collaboration session is up and the shared doc already has
|
|
9498
|
+
* slides, the ROOM wins and the freshly parsed deck is thrown away. That rule
|
|
9499
|
+
* exists for one case only - a late joiner whose bootstrap deck (the blank or
|
|
9500
|
+
* sample deck the host mounted the viewer with) finishes parsing after the
|
|
9501
|
+
* room's real slides arrived, which would otherwise clobber them with nothing
|
|
9502
|
+
* left to repair it, since the doc itself never changed.
|
|
9503
|
+
*
|
|
9504
|
+
* Applied to EVERY load it also swallows the deck a user deliberately opens
|
|
9505
|
+
* during a session. Joining a room and then opening a file left the viewer on
|
|
9506
|
+
* the room's blank starter deck: the file parsed, was committed, and was
|
|
9507
|
+
* immediately overwritten (reproduced in the vanilla demo - a 7-slide deck
|
|
9508
|
+
* opened in a room settled back to the room's 1 slide, and the bigger the file
|
|
9509
|
+
* the longer the window). Opening a file is an act of authorship, so it is
|
|
9510
|
+
* published to the room instead.
|
|
9511
|
+
*
|
|
9512
|
+
* @module render/collaboration-load-origin
|
|
9513
|
+
*/
|
|
9514
|
+
/**
|
|
9515
|
+
* Why a content load ran.
|
|
9516
|
+
*
|
|
9517
|
+
* - `bootstrap`: the deck the host handed the viewer at mount (`source`), or a
|
|
9518
|
+
* session restore. Nobody chose it during the session.
|
|
9519
|
+
* - `user`: opened during the session - File > Open, a recent file, a dropped
|
|
9520
|
+
* file, or a host calling the load API.
|
|
9521
|
+
*/
|
|
9522
|
+
type CollabLoadOrigin = 'bootstrap' | 'user';
|
|
9523
|
+
//#endregion
|
|
9491
9524
|
//#region src/render/slide-compare.d.ts
|
|
9492
9525
|
type SlideDiffStatus = 'added' | 'removed' | 'changed' | 'unchanged';
|
|
9493
9526
|
type ElementChangeKind = 'added' | 'removed' | 'moved' | 'resized' | 'textChanged';
|
|
@@ -12352,8 +12385,14 @@ declare class PresentationLoader {
|
|
|
12352
12385
|
handler: PptxHandler | null;
|
|
12353
12386
|
/** Incremented after each successful load (drives `load` callbacks). */
|
|
12354
12387
|
loadCount: number;
|
|
12388
|
+
/**
|
|
12389
|
+
* Why the deck now loaded was loaded. A collaboration room may replace the
|
|
12390
|
+
* host's own `source` (a late joiner's bootstrap) but never a file the user
|
|
12391
|
+
* opened during the session (`shouldRoomSlidesReplaceLoad`).
|
|
12392
|
+
*/
|
|
12393
|
+
loadOrigin: CollabLoadOrigin;
|
|
12355
12394
|
/** Parse a `.pptx` buffer into reactive viewer state. */
|
|
12356
|
-
load(raw: Uint8Array | ArrayBuffer): Promise<void>;
|
|
12395
|
+
load(raw: Uint8Array | ArrayBuffer, origin?: CollabLoadOrigin): Promise<void>;
|
|
12357
12396
|
/** Cancel in-flight loads, revoke Blob URLs, dispose the handler. */
|
|
12358
12397
|
dispose(): void;
|
|
12359
12398
|
}
|
|
@@ -12495,7 +12534,7 @@ declare class CollaborationController {
|
|
|
12495
12534
|
* publish effect can flush the freshly loaded slides into the doc, so a
|
|
12496
12535
|
* late joiner's bootstrap deck never clobbers the room's synced content.
|
|
12497
12536
|
*/
|
|
12498
|
-
adoptDocAfterLoad(): void;
|
|
12537
|
+
adoptDocAfterLoad(origin?: CollabLoadOrigin): void;
|
|
12499
12538
|
/** Start (or restart) a session with the given config (dialog-driven). */
|
|
12500
12539
|
start(config: CollaborationConfig): Promise<void>;
|
|
12501
12540
|
stop(): void;
|
package/dist/viewer/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as e, M as a, _ as s, c as t, d as i, f as l, gt as S, ht as n, i as v, j as o, l as d, n as p, o as b, p as g, r as c, s as x, t as w, u as T } from "../export-
|
|
1
|
+
import { A as e, M as a, _ as s, c as t, d as i, f as l, gt as S, ht as n, i as v, j as o, l as d, n as p, o as b, p as g, r as c, s as x, t as w, u as T } from "../export-BJ59Rfa6.js";
|
|
2
2
|
var m = a, A = o, P = e;
|
|
3
3
|
export {
|
|
4
4
|
w as PowerPointViewer,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ParsedTableStyleMap, PptxAppProperties, PptxCoreProperties, PptxCustomProperty, PptxEmbeddedFont, PptxHandoutMaster, PptxHeaderFooter, PptxNotesMaster, PptxPresentationProperties, PptxCustomShow, PptxSection, PptxSlide, PptxSlideMaster, PptxTagCollection, PptxThemeColorScheme, PptxTheme, PptxThemeOption, PptxHandler } from 'pptx-viewer-core';
|
|
2
|
-
import { CanvasSize, SlideSizeEmu } from 'pptx-viewer-shared';
|
|
2
|
+
import { CanvasSize, CollabLoadOrigin, SlideSizeEmu } from 'pptx-viewer-shared';
|
|
3
3
|
/**
|
|
4
4
|
* Reactive load pipeline for the Svelte viewer: the runes port of the Vue
|
|
5
5
|
* `useLoadContent` composable's viewer subset.
|
|
@@ -65,8 +65,14 @@ export declare class PresentationLoader {
|
|
|
65
65
|
handler: PptxHandler | null;
|
|
66
66
|
/** Incremented after each successful load (drives `load` callbacks). */
|
|
67
67
|
loadCount: number;
|
|
68
|
+
/**
|
|
69
|
+
* Why the deck now loaded was loaded. A collaboration room may replace the
|
|
70
|
+
* host's own `source` (a late joiner's bootstrap) but never a file the user
|
|
71
|
+
* opened during the session (`shouldRoomSlidesReplaceLoad`).
|
|
72
|
+
*/
|
|
73
|
+
loadOrigin: CollabLoadOrigin;
|
|
68
74
|
/** Parse a `.pptx` buffer into reactive viewer state. */
|
|
69
|
-
load(raw: Uint8Array | ArrayBuffer): Promise<void>;
|
|
75
|
+
load(raw: Uint8Array | ArrayBuffer, origin?: CollabLoadOrigin): Promise<void>;
|
|
70
76
|
/** Cancel in-flight loads, revoke Blob URLs, dispose the handler. */
|
|
71
77
|
dispose(): void;
|
|
72
78
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentation-loader.svelte.d.ts","sourceRoot":"","sources":["../../../src/viewer/state/presentation-loader.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,0BAA0B,EAC1B,cAAc,EACd,WAAW,EACX,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,SAAS,EACT,eAAe,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAsB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"presentation-loader.svelte.d.ts","sourceRoot":"","sources":["../../../src/viewer/state/presentation-loader.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,e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AAgB,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI,CA+F9D"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { A as Re, B as
|
|
3
|
-
var
|
|
1
|
+
import { a as ct, c as ut, d as ht, i as Ve, l as lt, n as ft, o as Ke, r as Oe, s as dt, t as pt, u as gt } from "./awareness-CrSnuSE_.js";
|
|
2
|
+
import { A as Re, B as yt, C as re, D as $e, E as bt, F as Me, I as mt, L as _t, M as vt, N as wt, O as Ue, P as Je, R as Et, S as Pe, T as ie, U as De, V as Ct, _ as Fe, a as Xe, b as Qe, i as ue, j as Ye, k as se, l as Rt, n as qe, o as Te, r as St, s as Ze, t as Tt, u as At, v as kt, x as Ot, y as Lt } from "./yjs-DbU20bpp.js";
|
|
3
|
+
var xt = Object.create, et = Object.defineProperty, Nt = Object.getOwnPropertyDescriptor, It = Object.getOwnPropertyNames, Mt = Object.getPrototypeOf, tt = Object.prototype.hasOwnProperty, Pt = (v, x) => () => (x || (v((x = { exports: {} }).exports, x), v = null), x.exports), Dt = (v, x, j, U) => {
|
|
4
4
|
if (x && typeof x == "object" || typeof x == "function")
|
|
5
|
-
for (var F =
|
|
6
|
-
m = F[R], !
|
|
5
|
+
for (var F = It(x), R = 0, M = F.length, m; R < M; R++)
|
|
6
|
+
m = F[R], !tt.call(v, m) && m !== j && et(v, m, {
|
|
7
7
|
get: ((c) => x[c]).bind(null, m),
|
|
8
|
-
enumerable: !(U =
|
|
8
|
+
enumerable: !(U = Nt(x, m)) || U.enumerable
|
|
9
9
|
});
|
|
10
10
|
return v;
|
|
11
|
-
}, jt = (v, x, j) => (j = v != null ?
|
|
11
|
+
}, jt = (v, x, j) => (j = v != null ? xt(Mt(v)) : {}, Dt(x || !v || !v.__esModule || !tt.call(v, "default") ? et(j, "default", {
|
|
12
12
|
value: v,
|
|
13
13
|
enumerable: !0
|
|
14
14
|
}) : j, v)), ke = /* @__PURE__ */ ((v) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(v, { get: (x, j) => (typeof require < "u" ? require : x)[j] }) : v)(function(v) {
|
|
@@ -27,7 +27,7 @@ var Lt = Object.create, et = Object.defineProperty, xt = Object.getOwnPropertyDe
|
|
|
27
27
|
v.ws !== null && (v.ws = null, v.connecting = !1, v.connected ? (v.connected = !1, v.emit("disconnect", [{
|
|
28
28
|
type: "disconnect",
|
|
29
29
|
error: M
|
|
30
|
-
}, v])) : v.unsuccessfulReconnects++, setTimeout(je,
|
|
30
|
+
}, v])) : v.unsuccessfulReconnects++, setTimeout(je, Et(_t(v.unsuccessfulReconnects + 1) * Bt, Ut), v)), clearTimeout(U);
|
|
31
31
|
}, R = () => {
|
|
32
32
|
v.ws === x && v.send({ type: "ping" });
|
|
33
33
|
};
|
|
@@ -35,7 +35,7 @@ var Lt = Object.create, et = Object.defineProperty, xt = Object.getOwnPropertyDe
|
|
|
35
35
|
v.lastMessageReceived = Me(), v.connecting = !1, v.connected = !0, v.unsuccessfulReconnects = 0, v.emit("connect", [{ type: "connect" }, v]), U = setTimeout(R, Le / 2);
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
}, Ft = class extends
|
|
38
|
+
}, Ft = class extends yt {
|
|
39
39
|
constructor(v, { binaryType: x } = {}) {
|
|
40
40
|
super(), this.url = v, this.ws = null, this.binaryType = x || null, this.connected = !1, this.connecting = !1, this.unsuccessfulReconnects = 0, this.lastMessageReceived = 0, this.shouldConnect = !0, this._checkInterval = setInterval(() => {
|
|
41
41
|
this.connected && Le < Me() - this.lastMessageReceived && this.ws.close();
|
|
@@ -3093,7 +3093,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
3093
3093
|
name: "AES-GCM",
|
|
3094
3094
|
length: 256
|
|
3095
3095
|
}, !0, ["encrypt", "decrypt"]));
|
|
3096
|
-
},
|
|
3096
|
+
}, rt = (v, x) => {
|
|
3097
3097
|
if (!x) return qe(v);
|
|
3098
3098
|
const j = crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(12));
|
|
3099
3099
|
return crypto.subtle.encrypt({
|
|
@@ -3105,41 +3105,41 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
3105
3105
|
});
|
|
3106
3106
|
}, Yt = (v, x) => {
|
|
3107
3107
|
const j = re();
|
|
3108
|
-
return
|
|
3109
|
-
},
|
|
3108
|
+
return bt(j, v), rt(ie(j), x);
|
|
3109
|
+
}, nt = (v, x) => {
|
|
3110
3110
|
if (!x) return qe(v);
|
|
3111
3111
|
const j = Fe(v);
|
|
3112
|
-
Qe(j) !== "AES-GCM" &&
|
|
3112
|
+
Qe(j) !== "AES-GCM" && Tt(Je("Unknown encryption algorithm"));
|
|
3113
3113
|
const U = Pe(j), F = Pe(j);
|
|
3114
3114
|
return crypto.subtle.decrypt({
|
|
3115
3115
|
name: "AES-GCM",
|
|
3116
3116
|
iv: U
|
|
3117
3117
|
}, x, F).then((R) => new Uint8Array(R));
|
|
3118
|
-
}, zt = (v, x) =>
|
|
3118
|
+
}, zt = (v, x) => nt(v, x).then((j) => kt(Fe(new Uint8Array(j)))), ne = St("y-webrtc"), Ce = 0, it = 3, Ae = 1, We = 4, xe = /* @__PURE__ */ new Map(), we = /* @__PURE__ */ new Map(), st = (v) => {
|
|
3119
3119
|
let x = !0;
|
|
3120
3120
|
v.webrtcConns.forEach((j) => {
|
|
3121
3121
|
j.synced || (x = !1);
|
|
3122
3122
|
}), (!x && v.synced || x && !v.synced) && (v.synced = x, v.provider.emit("synced", [{ synced: x }]), ne("synced ", ue, v.name, Te, " with all peers"));
|
|
3123
|
-
},
|
|
3124
|
-
const U = Fe(x), F = re(), R =
|
|
3123
|
+
}, ot = (v, x, j) => {
|
|
3124
|
+
const U = Fe(x), F = re(), R = Ot(U);
|
|
3125
3125
|
if (v === void 0) return null;
|
|
3126
3126
|
const M = v.awareness, m = v.doc;
|
|
3127
3127
|
let c = !1;
|
|
3128
3128
|
switch (R) {
|
|
3129
3129
|
case Ce: {
|
|
3130
3130
|
se(F, Ce);
|
|
3131
|
-
const S =
|
|
3131
|
+
const S = ct(U, F, m, v);
|
|
3132
3132
|
S === 1 && !v.synced && j(), S === 0 && (c = !0);
|
|
3133
3133
|
break;
|
|
3134
3134
|
}
|
|
3135
|
-
case
|
|
3135
|
+
case it:
|
|
3136
3136
|
se(F, Ae), Re(F, Oe(M, Array.from(M.getStates().keys()))), c = !0;
|
|
3137
3137
|
break;
|
|
3138
3138
|
case Ae:
|
|
3139
|
-
|
|
3139
|
+
ft(M, Pe(U), v);
|
|
3140
3140
|
break;
|
|
3141
3141
|
case We: {
|
|
3142
|
-
const S =
|
|
3142
|
+
const S = Lt(U) === 1, O = Qe(U);
|
|
3143
3143
|
if (O !== v.peerId && (v.bcConns.has(O) && !S || !v.bcConns.has(O) && S)) {
|
|
3144
3144
|
const i = [], h = [];
|
|
3145
3145
|
S ? (v.bcConns.add(O), h.push(O)) : (v.bcConns.delete(O), i.push(O)), v.provider.emit("peers", [{
|
|
@@ -3147,7 +3147,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
3147
3147
|
removed: i,
|
|
3148
3148
|
webrtcPeers: Array.from(v.webrtcConns.keys()),
|
|
3149
3149
|
bcPeers: Array.from(v.bcConns)
|
|
3150
|
-
}]),
|
|
3150
|
+
}]), at(v);
|
|
3151
3151
|
}
|
|
3152
3152
|
break;
|
|
3153
3153
|
}
|
|
@@ -3157,8 +3157,8 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
3157
3157
|
return c ? F : null;
|
|
3158
3158
|
}, Gt = (v, x) => {
|
|
3159
3159
|
const j = v.room;
|
|
3160
|
-
return ne("received message from ", ue, v.remotePeerId, Xe, " (", j.name, ")", Te, Ze),
|
|
3161
|
-
v.synced = !0, ne("synced ", ue, j.name, Te, " with ", ue, v.remotePeerId),
|
|
3160
|
+
return ne("received message from ", ue, v.remotePeerId, Xe, " (", j.name, ")", Te, Ze), ot(j, x, () => {
|
|
3161
|
+
v.synced = !0, ne("synced ", ue, j.name, Te, " with ", ue, v.remotePeerId), st(j);
|
|
3162
3162
|
});
|
|
3163
3163
|
}, Ne = (v, x) => {
|
|
3164
3164
|
ne("send message to ", ue, v.remotePeerId, Te, Xe, " (", v.room.name, ")", Ze);
|
|
@@ -3201,7 +3201,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
3201
3201
|
added: [],
|
|
3202
3202
|
webrtcPeers: Array.from(U.webrtcConns.keys()),
|
|
3203
3203
|
bcPeers: Array.from(U.bcConns)
|
|
3204
|
-
}])),
|
|
3204
|
+
}])), st(U), this.peer.destroy(), ne("closed connection to ", ue, j), Be(U);
|
|
3205
3205
|
}), this.peer.on("error", (F) => {
|
|
3206
3206
|
ne("Error in connection to ", ue, j, ": ", F), Be(U);
|
|
3207
3207
|
}), this.peer.on("data", (F) => {
|
|
@@ -3212,7 +3212,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
3212
3212
|
destroy() {
|
|
3213
3213
|
this.peer.destroy();
|
|
3214
3214
|
}
|
|
3215
|
-
}, be = (v, x) =>
|
|
3215
|
+
}, be = (v, x) => rt(x, v.key).then((j) => v.mux(() => lt(v.name, j))), Ge = (v, x) => {
|
|
3216
3216
|
v.bcconnected && be(v, x), Kt(v, x);
|
|
3217
3217
|
}, Be = (v) => {
|
|
3218
3218
|
xe.forEach((x) => {
|
|
@@ -3224,20 +3224,20 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
3224
3224
|
from: v.peerId
|
|
3225
3225
|
}));
|
|
3226
3226
|
});
|
|
3227
|
-
},
|
|
3227
|
+
}, at = (v) => {
|
|
3228
3228
|
if (v.provider.filterBcConns) {
|
|
3229
3229
|
const x = re();
|
|
3230
3230
|
se(x, We), $e(x, 1), Ue(x, v.peerId), be(v, ie(x));
|
|
3231
3231
|
}
|
|
3232
3232
|
}, $t = class {
|
|
3233
3233
|
constructor(v, x, j, U) {
|
|
3234
|
-
this.peerId =
|
|
3235
|
-
const M =
|
|
3234
|
+
this.peerId = wt(), this.doc = v, this.awareness = x.awareness, this.provider = x, this.synced = !1, this.name = j, this.key = U, this.webrtcConns = /* @__PURE__ */ new Map(), this.bcConns = /* @__PURE__ */ new Set(), this.mux = qt(), this.bcconnected = !1, this._bcSubscriber = (F) => nt(new Uint8Array(F), U).then((R) => this.mux(() => {
|
|
3235
|
+
const M = ot(this, R, () => {
|
|
3236
3236
|
});
|
|
3237
3237
|
M && be(this, ie(M));
|
|
3238
3238
|
})), this._docUpdateHandler = (F, R) => {
|
|
3239
3239
|
const M = re();
|
|
3240
|
-
se(M, Ce),
|
|
3240
|
+
se(M, Ce), ut(M, F), Ge(this, ie(M));
|
|
3241
3241
|
}, this._awarenessUpdateHandler = ({ added: F, updated: R, removed: M }, m) => {
|
|
3242
3242
|
const c = F.concat(R).concat(M), S = re();
|
|
3243
3243
|
se(S, Ae), Re(S, Oe(this.awareness, c)), Ge(this, ie(S));
|
|
@@ -3250,13 +3250,13 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
3250
3250
|
connect() {
|
|
3251
3251
|
this.doc.on("update", this._docUpdateHandler), this.awareness.on("update", this._awarenessUpdateHandler), Be(this);
|
|
3252
3252
|
const v = this.name;
|
|
3253
|
-
|
|
3253
|
+
gt(v, this._bcSubscriber), this.bcconnected = !0, at(this);
|
|
3254
3254
|
const x = re();
|
|
3255
3255
|
se(x, Ce), Ke(x, this.doc), be(this, ie(x));
|
|
3256
3256
|
const j = re();
|
|
3257
|
-
se(j, Ce),
|
|
3257
|
+
se(j, Ce), dt(j, this.doc), be(this, ie(j));
|
|
3258
3258
|
const U = re();
|
|
3259
|
-
se(U,
|
|
3259
|
+
se(U, it), be(this, ie(U));
|
|
3260
3260
|
const F = re();
|
|
3261
3261
|
se(F, Ae), Re(F, Oe(this.awareness, [this.doc.clientID])), be(this, ie(F));
|
|
3262
3262
|
}
|
|
@@ -3268,7 +3268,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
3268
3268
|
});
|
|
3269
3269
|
}), Ve(this.awareness, [this.doc.clientID], "disconnect");
|
|
3270
3270
|
const v = re();
|
|
3271
|
-
se(v, We), $e(v, 0), Ue(v, this.peerId), be(this, ie(v)),
|
|
3271
|
+
se(v, We), $e(v, 0), Ue(v, this.peerId), be(this, ie(v)), ht(this.name, this._bcSubscriber), this.bcconnected = !1, this.doc.off("update", this._docUpdateHandler), this.awareness.off("update", this._awarenessUpdateHandler), this.webrtcConns.forEach((x) => x.destroy());
|
|
3272
3272
|
}
|
|
3273
3273
|
destroy() {
|
|
3274
3274
|
this.disconnect(), typeof window < "u" ? window.removeEventListener("beforeunload", this._beforeUnloadHandler) : typeof process < "u" && process.off("exit", this._beforeUnloadHandler);
|
|
@@ -3282,7 +3282,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
3282
3282
|
v.send({
|
|
3283
3283
|
type: "publish",
|
|
3284
3284
|
topic: x.name,
|
|
3285
|
-
data:
|
|
3285
|
+
data: At(U)
|
|
3286
3286
|
});
|
|
3287
3287
|
}) : v.send({
|
|
3288
3288
|
type: "publish",
|
|
@@ -3338,18 +3338,17 @@ Use Chrome, Firefox or Internet Explorer 11`);
|
|
|
3338
3338
|
S.glareToken = void 0;
|
|
3339
3339
|
}
|
|
3340
3340
|
R.to === m && (De(M, R.from, () => new ze(this, !1, R.from, U)).peer.signal(R.signal), c());
|
|
3341
|
-
break;
|
|
3342
3341
|
}
|
|
3343
3342
|
};
|
|
3344
|
-
U.key ? typeof x.data == "string" && zt(
|
|
3343
|
+
U.key ? typeof x.data == "string" && zt(Rt(x.data), U.key).then(F) : F(x.data);
|
|
3345
3344
|
}
|
|
3346
3345
|
}
|
|
3347
3346
|
}), this.on("disconnect", () => ne(`disconnect (${v})`));
|
|
3348
3347
|
}
|
|
3349
3348
|
}, Ie = (v) => {
|
|
3350
3349
|
v.emit("status", [{ connected: v.connected }]);
|
|
3351
|
-
}, er = class extends
|
|
3352
|
-
constructor(v, x, { signaling: j = ["wss://y-webrtc-eu.fly.dev"], password: U = null, awareness: F = new
|
|
3350
|
+
}, er = class extends Ct {
|
|
3351
|
+
constructor(v, x, { signaling: j = ["wss://y-webrtc-eu.fly.dev"], password: U = null, awareness: F = new pt(x), maxConns: R = 20 + mt(vt() * 15), filterBcConns: M = !0, peerOpts: m = {} } = {}) {
|
|
3353
3352
|
super(), this.roomName = v, this.doc = x, this.filterBcConns = M, this.awareness = F, this.shouldConnect = !1, this.signalingUrls = j, this.signalingConns = [], this.maxConns = R, this.peerOpts = m, this.key = U ? Vt(U, v) : qe(null), this.room = null, this.key.then((c) => {
|
|
3354
3353
|
this.room = Jt(x, this, v, c), this.shouldConnect ? this.room.connect() : this.room.disconnect(), Ie(this);
|
|
3355
3354
|
}), this.connect(), this.destroy = this.destroy.bind(this), x.on("destroy", this.destroy);
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { a as W, c as L, d as $, i as R, l as r, n as E, o as _, r as w, s as N, t as O, u as Q } from "./awareness-CrSnuSE_.js";
|
|
2
|
+
import { A as m, C as o, F as S, R as j, S as z, T as a, V as F, _ as q, b as G, d as U, k as i, p as J, w as H, x as T, z as K } from "./yjs-DbU20bpp.js";
|
|
3
|
+
var X = (s, n, e) => {
|
|
4
|
+
T(s) === 0 && e(n, G(s));
|
|
5
|
+
}, Y = (s) => J(s, (n, e) => `${encodeURIComponent(e)}=${encodeURIComponent(n)}`).join("&");
|
|
6
|
+
var y = [];
|
|
7
|
+
y[0] = (s, n, e, t, c) => {
|
|
8
|
+
i(s, 0);
|
|
9
|
+
const d = W(n, s, e.doc, e);
|
|
10
|
+
t && d === 1 && !e.synced && (e.synced = !0);
|
|
11
|
+
};
|
|
12
|
+
y[3] = (s, n, e, t, c) => {
|
|
13
|
+
i(s, 1), m(s, w(e.awareness, Array.from(e.awareness.getStates().keys())));
|
|
14
|
+
};
|
|
15
|
+
y[1] = (s, n, e, t, c) => {
|
|
16
|
+
E(e.awareness, z(n), e);
|
|
17
|
+
};
|
|
18
|
+
y[2] = (s, n, e, t, c) => {
|
|
19
|
+
X(n, e.doc, (d, u) => Z(e, u));
|
|
20
|
+
};
|
|
21
|
+
var I = 3e4, Z = (s, n) => console.warn(`Permission denied to access ${s.url}.
|
|
22
|
+
${n}`), k = (s, n, e) => {
|
|
23
|
+
const t = q(n), c = o(), d = T(t), u = s.messageHandlers[d];
|
|
24
|
+
return u ? u(c, t, s, e, d) : console.error("Unable to compute message"), c;
|
|
25
|
+
}, p = (s) => !(s.code >= 4400 && s.code < 4500), C = (s, n, e) => {
|
|
26
|
+
if (n !== null && n === s.ws) {
|
|
27
|
+
s.emit("connection-close", [e, s]), s.ws = null, n.onmessage = null, n.onopen = null, n.onclose = null, n.onerror = () => {
|
|
28
|
+
}, n.close(), s.wsconnecting = !1, s.wsconnected && (s.wsconnected = !1, s.synced = !1, R(s.awareness, Array.from(s.awareness.getStates().keys()).filter((c) => c !== s.doc.clientID), s), s.emit("status", [{ status: "disconnected" }])), s.wsUnsuccessfulReconnects++;
|
|
29
|
+
let t = null;
|
|
30
|
+
e != null && !s.shouldReconnect(e, s) && (s.shouldConnect = !1, t = {
|
|
31
|
+
code: e.code,
|
|
32
|
+
reason: e.reason
|
|
33
|
+
}), setTimeout(x, j(K(2, s.wsUnsuccessfulReconnects) * 100, s.maxBackoffTime), s), t !== null && s.emit("closed", [t, s]);
|
|
34
|
+
}
|
|
35
|
+
}, x = (s) => {
|
|
36
|
+
if (s.shouldConnect && s.ws === null) {
|
|
37
|
+
const n = new s._WS(s.url, s.protocols);
|
|
38
|
+
n.binaryType = "arraybuffer", s.ws = n, s.wsconnecting = !0, s.wsconnected = !1, s.synced = !1, n.onmessage = (e) => {
|
|
39
|
+
if (s.ws !== n) return;
|
|
40
|
+
s.wsLastMessageReceived = S();
|
|
41
|
+
const t = k(s, new Uint8Array(e.data), !0);
|
|
42
|
+
H(t) > 1 && n.send(a(t));
|
|
43
|
+
}, n.onerror = (e) => {
|
|
44
|
+
s.ws === n && s.emit("connection-error", [e, s]);
|
|
45
|
+
}, n.onclose = (e) => {
|
|
46
|
+
C(s, n, e);
|
|
47
|
+
}, n.onopen = () => {
|
|
48
|
+
if (s.ws !== n) return;
|
|
49
|
+
s.wsLastMessageReceived = S(), s.wsconnecting = !1, s.wsconnected = !0, s.emit("status", [{ status: "connected" }]);
|
|
50
|
+
const e = o();
|
|
51
|
+
if (i(e, 0), _(e, s.doc), n.send(a(e)), s.awareness.getLocalState() !== null) {
|
|
52
|
+
const t = o();
|
|
53
|
+
i(t, 1), m(t, w(s.awareness, [s.doc.clientID])), n.send(a(t));
|
|
54
|
+
}
|
|
55
|
+
}, s.emit("status", [{ status: "connecting" }]);
|
|
56
|
+
}
|
|
57
|
+
}, b = (s, n) => {
|
|
58
|
+
const e = s.ws;
|
|
59
|
+
s.wsconnected && e && e.readyState === e.OPEN && e.send(n), s.bcconnected && r(s.bcChannel, n, s);
|
|
60
|
+
}, ns = class extends F {
|
|
61
|
+
constructor(s, n, e, { connect: t = !0, awareness: c = new O(e), params: d = {}, protocols: u = [], WebSocketPolyfill: M = WebSocket, resyncInterval: A = -1, maxBackoffTime: B = 2500, disableBc: D = !1, shouldReconnect: P = p } = {}) {
|
|
62
|
+
for (super(); s[s.length - 1] === "/"; ) s = s.slice(0, s.length - 1);
|
|
63
|
+
this.serverUrl = s, this.bcChannel = s + "/" + n, this.maxBackoffTime = B, this.shouldReconnect = P, this.params = d, this.protocols = u, this.roomname = n, this.doc = e, this._WS = M, this.awareness = c, this.wsconnected = !1, this.wsconnecting = !1, this.bcconnected = !1, this.disableBc = D, this.wsUnsuccessfulReconnects = 0, this.messageHandlers = y.slice(), this._synced = !1, this.ws = null, this.wsLastMessageReceived = 0, this.shouldConnect = t, this._resyncInterval = 0, A > 0 && (this._resyncInterval = setInterval(() => {
|
|
64
|
+
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
|
65
|
+
const l = o();
|
|
66
|
+
i(l, 0), _(l, e), this.ws.send(a(l));
|
|
67
|
+
}
|
|
68
|
+
}, A)), this._bcSubscriber = (l, f) => {
|
|
69
|
+
if (f !== this) {
|
|
70
|
+
const h = k(this, new Uint8Array(l), !1);
|
|
71
|
+
H(h) > 1 && r(this.bcChannel, a(h), this);
|
|
72
|
+
}
|
|
73
|
+
}, this._updateHandler = (l, f) => {
|
|
74
|
+
if (f !== this) {
|
|
75
|
+
const h = o();
|
|
76
|
+
i(h, 0), L(h, l), b(this, a(h));
|
|
77
|
+
}
|
|
78
|
+
}, this.doc.on("update", this._updateHandler), this._awarenessUpdateHandler = ({ added: l, updated: f, removed: h }, v) => {
|
|
79
|
+
const V = l.concat(f).concat(h), g = o();
|
|
80
|
+
i(g, 1), m(g, w(c, V)), b(this, a(g));
|
|
81
|
+
}, this._exitHandler = () => {
|
|
82
|
+
R(this.awareness, [e.clientID], "app closed");
|
|
83
|
+
}, U && typeof process < "u" && process.on("exit", this._exitHandler), c.on("update", this._awarenessUpdateHandler), this._checkInterval = setInterval(() => {
|
|
84
|
+
this.wsconnected && I < S() - this.wsLastMessageReceived && C(this, this.ws, null);
|
|
85
|
+
}, I / 10), t && this.connect();
|
|
86
|
+
}
|
|
87
|
+
get url() {
|
|
88
|
+
const s = Y(this.params);
|
|
89
|
+
return this.serverUrl + "/" + this.roomname + (s.length === 0 ? "" : "?" + s);
|
|
90
|
+
}
|
|
91
|
+
get synced() {
|
|
92
|
+
return this._synced;
|
|
93
|
+
}
|
|
94
|
+
set synced(s) {
|
|
95
|
+
this._synced !== s && (this._synced = s, s && (this.wsUnsuccessfulReconnects = 0), this.emit("synced", [s]), this.emit("sync", [s]));
|
|
96
|
+
}
|
|
97
|
+
destroy() {
|
|
98
|
+
this._resyncInterval !== 0 && clearInterval(this._resyncInterval), clearInterval(this._checkInterval), this.disconnect(), U && typeof process < "u" && process.off("exit", this._exitHandler), this.awareness.off("update", this._awarenessUpdateHandler), this.doc.off("update", this._updateHandler), super.destroy();
|
|
99
|
+
}
|
|
100
|
+
connectBc() {
|
|
101
|
+
if (this.disableBc) return;
|
|
102
|
+
this.bcconnected || (Q(this.bcChannel, this._bcSubscriber), this.bcconnected = !0);
|
|
103
|
+
const s = o();
|
|
104
|
+
i(s, 0), _(s, this.doc), r(this.bcChannel, a(s), this);
|
|
105
|
+
const n = o();
|
|
106
|
+
i(n, 0), N(n, this.doc), r(this.bcChannel, a(n), this);
|
|
107
|
+
const e = o();
|
|
108
|
+
i(e, 3), r(this.bcChannel, a(e), this);
|
|
109
|
+
const t = o();
|
|
110
|
+
i(t, 1), m(t, w(this.awareness, [this.doc.clientID])), r(this.bcChannel, a(t), this);
|
|
111
|
+
}
|
|
112
|
+
disconnectBc() {
|
|
113
|
+
const s = o();
|
|
114
|
+
i(s, 1), m(s, w(this.awareness, [this.doc.clientID], /* @__PURE__ */ new Map())), b(this, a(s)), this.bcconnected && ($(this.bcChannel, this._bcSubscriber), this.bcconnected = !1);
|
|
115
|
+
}
|
|
116
|
+
disconnect() {
|
|
117
|
+
this.shouldConnect = !1, this.disconnectBc(), this.ws !== null && C(this, this.ws, null);
|
|
118
|
+
}
|
|
119
|
+
connect() {
|
|
120
|
+
this.shouldConnect = !0, !this.wsconnected && this.ws === null && (x(this), this.connectBc());
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
export {
|
|
124
|
+
ns as WebsocketProvider
|
|
125
|
+
};
|