osra 0.2.1 → 0.2.3
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/build/index.d.ts +384 -8
- package/build/index.js +473 -336
- package/build/index.js.map +1 -1
- package/package.json +5 -3
- package/build/extension/background.js +0 -2
- package/build/extension/background.js.map +0 -1
- package/build/extension/chunks/index.js +0 -2
- package/build/extension/chunks/index.js.map +0 -1
- package/build/extension/content.js +0 -2
- package/build/extension/content.js.map +0 -1
- package/build/extension/manifest.json +0 -21
- package/build/extension/popup.html +0 -120
- package/build/extension/popup.js +0 -2
- package/build/extension/popup.js.map +0 -1
- package/build/extension-test/background.js +0 -753
- package/build/extension-test/background.js.map +0 -1
- package/build/extension-test/content.js +0 -4585
- package/build/extension-test/content.js.map +0 -1
- package/build/extension-test/manifest.json +0 -22
- package/build/extension-test/popup.html +0 -106
- package/build/extension-test/popup.js +0 -4610
- package/build/extension-test/popup.js.map +0 -1
- package/build/extension-test-firefox/background.js +0 -5464
- package/build/extension-test-firefox/background.js.map +0 -1
- package/build/extension-test-firefox/content.js +0 -5286
- package/build/extension-test-firefox/content.js.map +0 -1
- package/build/extension-test-firefox/manifest.json +0 -27
- package/build/extension-test-firefox/popup.html +0 -106
- package/build/extension-test-firefox/popup.js +0 -5213
- package/build/extension-test-firefox/popup.js.map +0 -1
- package/build/test.js +0 -24987
- package/build/test.js.map +0 -1
package/build/index.js
CHANGED
|
@@ -1,453 +1,590 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
1
|
+
const P = "__OSRA_KEY__", ye = "__OSRA_DEFAULT_KEY__", B = "__OSRA_BOX__", u = {
|
|
2
|
+
[B]: "revivable",
|
|
3
|
+
type: ""
|
|
4
|
+
}, fe = (e, t) => e && typeof e == "object" && B in e && e[B] === "revivable", de = () => {
|
|
5
|
+
const e = /* @__PURE__ */ new Map(), t = {
|
|
3
6
|
getUniqueUuid: () => {
|
|
4
|
-
let
|
|
5
|
-
for (; e.has(
|
|
6
|
-
|
|
7
|
-
return
|
|
7
|
+
let r = globalThis.crypto.randomUUID();
|
|
8
|
+
for (; e.has(r); )
|
|
9
|
+
r = globalThis.crypto.randomUUID();
|
|
10
|
+
return r;
|
|
8
11
|
},
|
|
9
|
-
set: (
|
|
10
|
-
e.set(
|
|
12
|
+
set: (r, n) => {
|
|
13
|
+
e.set(r, { uuid: r, ...n });
|
|
11
14
|
},
|
|
12
|
-
alloc: (
|
|
13
|
-
if (n)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
alloc: (r = t.getUniqueUuid(), n) => {
|
|
16
|
+
if (n) {
|
|
17
|
+
const o = { uuid: r, ...n };
|
|
18
|
+
return e.set(r, o), o;
|
|
19
|
+
}
|
|
20
|
+
const a = new MessageChannel(), s = {
|
|
21
|
+
uuid: r,
|
|
22
|
+
port1: a.port1,
|
|
23
|
+
port2: a.port2
|
|
19
24
|
};
|
|
20
|
-
return e.set(
|
|
25
|
+
return e.set(r, s), s;
|
|
21
26
|
},
|
|
22
|
-
has: (
|
|
23
|
-
get: (
|
|
24
|
-
free: (
|
|
25
|
-
getOrAlloc: (
|
|
26
|
-
const
|
|
27
|
-
return
|
|
27
|
+
has: (r) => e.has(r),
|
|
28
|
+
get: (r) => e.get(r),
|
|
29
|
+
free: (r) => e.delete(r),
|
|
30
|
+
getOrAlloc: (r = t.getUniqueUuid(), n) => {
|
|
31
|
+
const a = t.get(r);
|
|
32
|
+
return a || t.alloc(r, n);
|
|
28
33
|
}
|
|
29
34
|
};
|
|
30
|
-
return
|
|
31
|
-
},
|
|
32
|
-
const s = (
|
|
33
|
-
if (typeof
|
|
34
|
-
|
|
35
|
-
else if (
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
|
|
35
|
+
return t;
|
|
36
|
+
}, q = (e, t) => ge(e) && e[P] === t, pe = ({ listener: e, transport: t, remoteName: r, key: n = P, unregisterSignal: a }) => {
|
|
37
|
+
const s = (o) => {
|
|
38
|
+
if (typeof o == "function")
|
|
39
|
+
o(e);
|
|
40
|
+
else if (O(o) || R(o) || $(o)) {
|
|
41
|
+
const i = (c, y) => {
|
|
42
|
+
const p = (l, f) => {
|
|
43
|
+
q(l, n) && (r && l.name !== r || e(l, { port: y, sender: f }));
|
|
39
44
|
};
|
|
40
|
-
|
|
45
|
+
c.addListener(p), a && a.addEventListener(
|
|
41
46
|
"abort",
|
|
42
|
-
() =>
|
|
47
|
+
() => c.removeListener(p)
|
|
43
48
|
);
|
|
44
49
|
};
|
|
45
|
-
if (
|
|
46
|
-
const
|
|
47
|
-
|
|
50
|
+
if (R(o)) {
|
|
51
|
+
const c = (y) => {
|
|
52
|
+
i(y.onMessage, y);
|
|
48
53
|
};
|
|
49
|
-
|
|
54
|
+
o.addListener(c), a && a.addEventListener(
|
|
50
55
|
"abort",
|
|
51
|
-
() =>
|
|
56
|
+
() => o.removeListener(c)
|
|
52
57
|
);
|
|
53
|
-
} else
|
|
58
|
+
} else $(o) ? i(o) : i(o.onMessage);
|
|
54
59
|
} else {
|
|
55
|
-
const
|
|
56
|
-
|
|
60
|
+
const i = (c) => {
|
|
61
|
+
q(c.data, n) && (r && c.data.name !== r || e(c.data, { receiveTransport: o, source: c.source }));
|
|
57
62
|
};
|
|
58
|
-
|
|
63
|
+
o.addEventListener("message", i), a && a.addEventListener(
|
|
59
64
|
"abort",
|
|
60
|
-
() =>
|
|
65
|
+
() => o.removeEventListener("message", i)
|
|
61
66
|
);
|
|
62
67
|
}
|
|
63
68
|
};
|
|
64
|
-
|
|
65
|
-
},
|
|
66
|
-
const
|
|
67
|
-
typeof s == "function" ? s(
|
|
69
|
+
J(t) ? s(t.receive) : s(t);
|
|
70
|
+
}, le = (e, t, r = "*", n = []) => {
|
|
71
|
+
const a = (s) => {
|
|
72
|
+
typeof s == "function" ? s(t, n) : O(s) ? s.postMessage(t) : z(s) ? s.postMessage(t, r, n) : W(s) ? s.send(JSON.stringify(t)) : D(s) ? s.port.postMessage(t, n) : s.postMessage(t, n);
|
|
68
73
|
};
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
Int8Array,
|
|
72
|
-
Uint8Array,
|
|
73
|
-
Uint8ClampedArray,
|
|
74
|
-
Int16Array,
|
|
75
|
-
Uint16Array,
|
|
76
|
-
Int32Array,
|
|
77
|
-
Uint32Array,
|
|
78
|
-
Float16Array,
|
|
79
|
-
Float32Array,
|
|
80
|
-
Float64Array,
|
|
81
|
-
BigInt64Array,
|
|
82
|
-
BigUint64Array
|
|
83
|
-
];
|
|
74
|
+
J(e) ? a(e.emit) : a(e);
|
|
75
|
+
};
|
|
84
76
|
new Int8Array(), new Uint8Array(), new Uint8ClampedArray(), new Int16Array(), new Uint16Array(), new Int32Array(), new Uint32Array(), new Float16Array(), new Float32Array(), new Float64Array(), new BigInt64Array(), new BigUint64Array();
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (r === void 0) throw new Error("Unknown typed array type");
|
|
92
|
-
return r;
|
|
93
|
-
}, j = (e) => ye.some((r) => e instanceof r), k = (e) => e instanceof WebSocket, H = (e) => globalThis.ServiceWorkerContainer && e instanceof ServiceWorkerContainer, Q = (e) => globalThis.Worker && e instanceof Worker, Z = (e) => globalThis.DedicatedWorkerGlobalScope && e instanceof DedicatedWorkerGlobalScope, W = (e) => globalThis.SharedWorker && e instanceof SharedWorker, C = (e) => e instanceof MessagePort, D = (e) => e instanceof Promise, _ = (e) => typeof e == "function", T = (e) => e instanceof ArrayBuffer, B = (e) => e instanceof ReadableStream, V = (e) => e instanceof Date, J = (e) => e instanceof Error, pe = (e) => _(e) || D(e) || j(e) || V(e) || J(e), le = (e) => !!(e && typeof e == "object" && e[M]), ge = (e) => !!(globalThis.SharedArrayBuffer && e instanceof globalThis.SharedArrayBuffer), N = (e) => globalThis.ArrayBuffer && e instanceof globalThis.ArrayBuffer || globalThis.MessagePort && e instanceof globalThis.MessagePort || globalThis.ReadableStream && e instanceof globalThis.ReadableStream || globalThis.WritableStream && e instanceof globalThis.WritableStream || globalThis.TransformStream && e instanceof globalThis.TransformStream ? !0 : !!(globalThis.ImageBitmap && e instanceof globalThis.ImageBitmap), I = (e, r = !1) => !!(e && typeof e == "object" && e.name && e.disconnect && e.postMessage && (!r || e.sender && e.onMessage && e.onDisconnect)), O = (e) => !!(e && typeof e == "object" && e.addListener && e.hasListener && e.removeListener), L = (e) => !!(e && typeof e == "object" && e.addListener && e.hasListener && e.removeListener), q = (e) => !!(e && typeof e == "object" && e.document && e.location && e.navigator && e.screen && e.history), x = (e) => k(e) || I(e), v = (e) => k(e) || I(e) || O(e) || L(e), Ae = (e) => x(e) || v(e), P = (e) => x(e) || q(e) || H(e) || Q(e) || Z(e) || W(e) || C(e) || ee(e), F = (e) => v(e) || q(e) || H(e) || Q(e) || Z(e) || W(e) || C(e) || re(e), ee = (e) => !!(e && typeof e == "object" && "emit" in e && (P(e.emit) || typeof e.emit == "function")), re = (e) => !!(e && typeof e == "object" && "receive" in e && (F(e.receive) || typeof e.receive == "function")), K = (e) => ee(e) || re(e), te = (e) => C(e) || _(e) || D(e) || j(e) || T(e) || B(e) || V(e) || J(e), p = (e) => e && typeof e == "object" && E in e && e[E] === "revivable", me = (e) => p(e) && e.type === "messagePort", Y = (e) => p(e) && e.type === "promise", be = (e) => p(e) && e.type === "function", he = (e) => p(e) && e.type === "typedArray", ue = (e) => p(e) && e.type === "arrayBuffer", we = (e) => p(e) && e.type === "readableStream", Ue = (e) => p(e) && e.type === "error", Be = (e) => p(e) && e.type === "date", u = (e) => {
|
|
94
|
-
const r = [], t = (n) => ge(n) ? void 0 : N(n) ? r.push(n) : Array.isArray(n) ? n.map(t) : n && typeof n == "object" ? Object.values(n).map(t) : void 0;
|
|
95
|
-
return t(e), r;
|
|
96
|
-
}, S = (e, r = !1) => {
|
|
97
|
-
const { port1: t, port2: n } = new MessageChannel(), o = new Promise(
|
|
98
|
-
(s) => t.addEventListener(
|
|
77
|
+
const W = (e) => e instanceof WebSocket, K = (e) => globalThis.ServiceWorkerContainer && e instanceof ServiceWorkerContainer, Y = (e) => globalThis.Worker && e instanceof Worker, G = (e) => globalThis.DedicatedWorkerGlobalScope && e instanceof DedicatedWorkerGlobalScope, D = (e) => globalThis.SharedWorker && e instanceof SharedWorker, X = (e) => e instanceof MessagePort, ge = (e) => !!(e && typeof e == "object" && e[P]), me = (e) => !!(globalThis.SharedArrayBuffer && e instanceof globalThis.SharedArrayBuffer), be = (e) => globalThis.ArrayBuffer && e instanceof globalThis.ArrayBuffer || globalThis.MessagePort && e instanceof globalThis.MessagePort || globalThis.ReadableStream && e instanceof globalThis.ReadableStream || globalThis.WritableStream && e instanceof globalThis.WritableStream || globalThis.TransformStream && e instanceof globalThis.TransformStream ? !0 : !!(globalThis.ImageBitmap && e instanceof globalThis.ImageBitmap), O = (e, t = !1) => !!(e && typeof e == "object" && "name" in e && "disconnect" in e && "postMessage" in e && (!t || "sender" in e && "onMessage" in e && "onDisconnect" in e)), R = (e) => !!(e && typeof e == "object" && e.addListener && e.hasListener && e.removeListener), $ = (e) => !!(e && typeof e == "object" && e.addListener && e.hasListener && e.removeListener), z = (e) => !!(e && typeof e == "object" && e.document && e.location && e.navigator && e.screen && e.history), H = (e) => W(e) || O(e), Q = (e) => W(e) || O(e) || R(e) || $(e), S = (e) => "isJson" in e && e.isJson === !0 || H(e) || Q(e), _ = (e) => H(e) || z(e) || K(e) || Y(e) || G(e) || D(e) || X(e) || Z(e), F = (e) => Q(e) || z(e) || K(e) || Y(e) || G(e) || D(e) || X(e) || v(e), Z = (e) => !!(e && typeof e == "object" && "emit" in e && (_(e.emit) || typeof e.emit == "function")), v = (e) => !!(e && typeof e == "object" && "receive" in e && (F(e.receive) || typeof e.receive == "function")), J = (e) => Z(e) || v(e), U = (e) => {
|
|
78
|
+
const t = [], r = (n) => me(n) ? void 0 : be(n) ? t.push(n) : Array.isArray(n) ? n.map(r) : n && typeof n == "object" ? Object.values(n).map(r) : void 0;
|
|
79
|
+
return r(e), t;
|
|
80
|
+
}, I = (e, t = !1) => {
|
|
81
|
+
const { port1: r, port2: n } = new MessageChannel(), a = new Promise(
|
|
82
|
+
(s) => r.addEventListener(
|
|
99
83
|
"message",
|
|
100
|
-
(
|
|
84
|
+
(o) => s(o.data)
|
|
101
85
|
)
|
|
102
86
|
);
|
|
103
|
-
return
|
|
104
|
-
},
|
|
87
|
+
return r.start(), n.postMessage(e, t ? U(e) : []), a;
|
|
88
|
+
}, ue = async () => {
|
|
105
89
|
const { port1: e } = new MessageChannel();
|
|
106
|
-
return await
|
|
107
|
-
},
|
|
90
|
+
return await I(e, !0) instanceof MessagePort;
|
|
91
|
+
}, Ae = async () => {
|
|
108
92
|
const e = new ArrayBuffer(1);
|
|
109
|
-
return await
|
|
110
|
-
},
|
|
93
|
+
return await I(e) instanceof ArrayBuffer;
|
|
94
|
+
}, he = async () => {
|
|
111
95
|
const e = new ArrayBuffer(1);
|
|
112
|
-
return await
|
|
113
|
-
},
|
|
96
|
+
return await I(e, !0) instanceof ArrayBuffer;
|
|
97
|
+
}, Ue = async () => {
|
|
114
98
|
const e = new ReadableStream({
|
|
115
|
-
start(
|
|
116
|
-
|
|
99
|
+
start(r) {
|
|
100
|
+
r.enqueue(new Uint8Array(1)), r.close();
|
|
117
101
|
}
|
|
118
102
|
});
|
|
119
|
-
return await
|
|
120
|
-
},
|
|
103
|
+
return await I(e, !0) instanceof ReadableStream;
|
|
104
|
+
}, we = async () => {
|
|
121
105
|
const [
|
|
122
106
|
e,
|
|
123
|
-
r,
|
|
124
107
|
t,
|
|
108
|
+
r,
|
|
125
109
|
n
|
|
126
110
|
] = await Promise.all([
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
111
|
+
ue().catch(() => !1),
|
|
112
|
+
Ae().catch(() => !1),
|
|
113
|
+
he().catch(() => !1),
|
|
114
|
+
Ue().catch(() => !1)
|
|
131
115
|
]);
|
|
132
116
|
return {
|
|
133
|
-
jsonOnly: !e && !
|
|
117
|
+
jsonOnly: !e && !t && !r && !n,
|
|
134
118
|
messagePort: e,
|
|
135
|
-
arrayBuffer:
|
|
136
|
-
transferable:
|
|
119
|
+
arrayBuffer: t,
|
|
120
|
+
transferable: r,
|
|
137
121
|
transferableStream: n
|
|
138
122
|
};
|
|
139
|
-
},
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
123
|
+
}, N = "arrayBuffer", Me = (e) => e instanceof ArrayBuffer, Be = (e, t) => ({
|
|
124
|
+
...u,
|
|
125
|
+
type: N,
|
|
126
|
+
...S(t.transport) ? { base64Buffer: new Uint8Array(e).toBase64() } : { arrayBuffer: e }
|
|
127
|
+
}), Te = (e, t) => "arrayBuffer" in e ? e.arrayBuffer : Uint8Array.fromBase64(e.base64Buffer).buffer, _e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
128
|
+
__proto__: null,
|
|
129
|
+
box: Be,
|
|
130
|
+
isType: Me,
|
|
131
|
+
revive: Te,
|
|
132
|
+
type: N
|
|
133
|
+
}, Symbol.toStringTag, { value: "Module" })), x = "date", Ce = (e) => e instanceof Date, Pe = (e, t) => ({
|
|
134
|
+
...u,
|
|
135
|
+
type: x,
|
|
136
|
+
ISOString: e.toISOString()
|
|
137
|
+
}), Oe = (e, t) => new Date(e.ISOString), Se = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
138
|
+
__proto__: null,
|
|
139
|
+
box: Pe,
|
|
140
|
+
isType: Ce,
|
|
141
|
+
revive: Oe,
|
|
142
|
+
type: x
|
|
143
|
+
}, Symbol.toStringTag, { value: "Module" })), ee = "error", Ie = (e) => e instanceof Error, Ee = (e, t) => ({
|
|
144
|
+
...u,
|
|
145
|
+
type: ee,
|
|
146
|
+
message: e.message,
|
|
147
|
+
stack: e.stack || e.toString()
|
|
148
|
+
}), Le = (e, t) => new Error(e.message, { cause: e.stack }), je = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
149
|
+
__proto__: null,
|
|
150
|
+
box: Ee,
|
|
151
|
+
isType: Ie,
|
|
152
|
+
revive: Le,
|
|
153
|
+
type: ee
|
|
154
|
+
}, Symbol.toStringTag, { value: "Module" })), te = "typedArray", Re = [
|
|
155
|
+
Int8Array,
|
|
156
|
+
Uint8Array,
|
|
157
|
+
Uint8ClampedArray,
|
|
158
|
+
Int16Array,
|
|
159
|
+
Uint16Array,
|
|
160
|
+
Int32Array,
|
|
161
|
+
Uint32Array,
|
|
162
|
+
Float16Array,
|
|
163
|
+
Float32Array,
|
|
164
|
+
Float64Array,
|
|
165
|
+
BigInt64Array,
|
|
166
|
+
BigUint64Array
|
|
167
|
+
];
|
|
168
|
+
new Int8Array(), new Uint8Array(), new Uint8ClampedArray(), new Int16Array(), new Uint16Array(), new Int32Array(), new Uint32Array(), new Float16Array(), new Float32Array(), new Float64Array(), new BigInt64Array(), new BigUint64Array();
|
|
169
|
+
const re = (e) => {
|
|
170
|
+
const t = e instanceof Int8Array ? "Int8Array" : e instanceof Uint8Array ? "Uint8Array" : e instanceof Uint8ClampedArray ? "Uint8ClampedArray" : e instanceof Int16Array ? "Int16Array" : e instanceof Uint16Array ? "Uint16Array" : e instanceof Int32Array ? "Int32Array" : e instanceof Uint32Array ? "Uint32Array" : e instanceof Float16Array ? "Float16Array" : e instanceof Float32Array ? "Float32Array" : e instanceof Float64Array ? "Float64Array" : e instanceof BigInt64Array ? "BigInt64Array" : e instanceof BigUint64Array ? "BigUint64Array" : void 0;
|
|
171
|
+
if (t === void 0) throw new Error("Unknown typed array type");
|
|
172
|
+
return t;
|
|
173
|
+
}, ne = (e) => {
|
|
174
|
+
const t = e === "Int8Array" ? Int8Array : e === "Uint8Array" ? Uint8Array : e === "Uint8ClampedArray" ? Uint8ClampedArray : e === "Int16Array" ? Int16Array : e === "Uint16Array" ? Uint16Array : e === "Int32Array" ? Int32Array : e === "Uint32Array" ? Uint32Array : e === "Float16Array" ? Float16Array : e === "Float32Array" ? Float32Array : e === "Float64Array" ? Float64Array : e === "BigInt64Array" ? BigInt64Array : e === "BigUint64Array" ? BigUint64Array : void 0;
|
|
175
|
+
if (t === void 0) throw new Error("Unknown typed array type");
|
|
176
|
+
return t;
|
|
177
|
+
}, $e = (e) => Re.some((t) => e instanceof t), Fe = (e, t) => ({
|
|
178
|
+
...u,
|
|
179
|
+
type: te,
|
|
180
|
+
typedArrayType: re(e),
|
|
181
|
+
...S(t.transport) ? { base64Buffer: new Uint8Array(e.buffer).toBase64() } : { arrayBuffer: e.buffer }
|
|
182
|
+
}), ke = (e, t) => {
|
|
183
|
+
const r = ne(e.typedArrayType), n = "arrayBuffer" in e ? e.arrayBuffer : Uint8Array.fromBase64(e.base64Buffer).buffer;
|
|
184
|
+
return new r(n);
|
|
185
|
+
}, We = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
186
|
+
__proto__: null,
|
|
187
|
+
box: Fe,
|
|
188
|
+
isType: $e,
|
|
189
|
+
revive: ke,
|
|
190
|
+
type: te,
|
|
191
|
+
typedArrayToType: re,
|
|
192
|
+
typedArrayTypeToTypedArrayConstructor: ne
|
|
193
|
+
}, Symbol.toStringTag, { value: "Module" })), C = new FinalizationRegistry((e) => {
|
|
194
|
+
console.log("cleanup", e.portId), e.sendMessage({
|
|
195
|
+
type: "message-port-close",
|
|
196
|
+
remoteUuid: e.remoteUuid,
|
|
197
|
+
portId: e.portId
|
|
198
|
+
}), e.cleanup();
|
|
199
|
+
}), k = "messagePort", De = (e) => e instanceof MessagePort, se = (e) => e !== null && typeof e == "object" && B in e && e[B] === "revivable", E = (e, t) => {
|
|
200
|
+
if (S(t.transport)) {
|
|
201
|
+
let n = function({ data: y }) {
|
|
202
|
+
t.sendMessage({
|
|
203
|
+
type: "message",
|
|
204
|
+
remoteUuid: t.remoteUuid,
|
|
205
|
+
data: se(y) ? y : m(y, t),
|
|
206
|
+
portId: s
|
|
207
|
+
});
|
|
208
|
+
};
|
|
209
|
+
const a = e, s = t.messageChannels.getUniqueUuid(), o = new WeakRef(a), i = ({ detail: y }) => {
|
|
210
|
+
if (y.type === "message-port-close") {
|
|
211
|
+
if (y.portId !== s) return;
|
|
212
|
+
t.messageChannels.free(s), console.log("free", s);
|
|
213
|
+
const l = o.deref();
|
|
214
|
+
l && (C.unregister(l), l.close()), t.eventTarget.removeEventListener("message", i);
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
if (y.type !== "message" || y.portId !== s) return;
|
|
218
|
+
const p = o.deref();
|
|
219
|
+
if (!p) {
|
|
220
|
+
t.eventTarget.removeEventListener("message", i);
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
p.postMessage(y.data, U(y.data));
|
|
224
|
+
};
|
|
225
|
+
return C.register(o.deref(), {
|
|
226
|
+
sendMessage: t.sendMessage,
|
|
227
|
+
remoteUuid: t.remoteUuid,
|
|
228
|
+
portId: s,
|
|
229
|
+
cleanup: () => {
|
|
230
|
+
t.messageChannels.free(s), console.log("free", s), t.eventTarget.removeEventListener("message", i), o.deref()?.removeEventListener("message", n), o.deref()?.close();
|
|
231
|
+
}
|
|
232
|
+
}, o.deref()), o.deref()?.addEventListener("message", n), o.deref()?.start(), t.eventTarget.addEventListener("message", i), {
|
|
233
|
+
...u,
|
|
234
|
+
type: k,
|
|
235
|
+
portId: s
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
return {
|
|
239
|
+
...u,
|
|
240
|
+
type: k,
|
|
241
|
+
port: e
|
|
158
242
|
};
|
|
159
|
-
},
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
return;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
243
|
+
}, L = (e, t) => {
|
|
244
|
+
if ("portId" in e) {
|
|
245
|
+
let r = function({ data: f }) {
|
|
246
|
+
t.sendMessage({
|
|
247
|
+
type: "message",
|
|
248
|
+
remoteUuid: t.remoteUuid,
|
|
249
|
+
data: se(f) ? f : m(f, t),
|
|
250
|
+
portId: n
|
|
251
|
+
});
|
|
252
|
+
};
|
|
253
|
+
const { portId: n } = e, { port1: a, port2: s } = new MessageChannel(), o = t.messageChannels.get(e.portId), { port1: i } = o || t.messageChannels.alloc(e.portId), c = new WeakRef(a), y = ({ detail: f }) => {
|
|
254
|
+
if (f.type !== "message-port-close" || f.portId !== n) return;
|
|
255
|
+
const h = c.deref();
|
|
256
|
+
h && C.unregister(h), l();
|
|
257
|
+
}, p = ({ data: f }) => {
|
|
258
|
+
if (f.type !== "message" || f.portId !== n) return;
|
|
259
|
+
const h = c.deref();
|
|
260
|
+
if (!h) {
|
|
261
|
+
l();
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
if (t.messagePorts.has(h))
|
|
265
|
+
s.postMessage(f.data);
|
|
179
266
|
else {
|
|
180
|
-
const
|
|
181
|
-
|
|
267
|
+
const T = A(f.data, t);
|
|
268
|
+
s.postMessage(T, U(T));
|
|
182
269
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
270
|
+
}, l = () => {
|
|
271
|
+
t.eventTarget.removeEventListener("message", y), i.removeEventListener("message", p), s.removeEventListener("message", r), s.close();
|
|
272
|
+
const f = t.messageChannels.get(n);
|
|
273
|
+
f && (f.port1.close(), f.port2 && f.port2.close()), console.log("free", n), t.messageChannels.free(n);
|
|
274
|
+
};
|
|
275
|
+
return C.register(a, {
|
|
276
|
+
sendMessage: t.sendMessage,
|
|
277
|
+
remoteUuid: t.remoteUuid,
|
|
278
|
+
portId: n,
|
|
279
|
+
cleanup: l
|
|
280
|
+
}, a), s.addEventListener("message", r), s.start(), t.eventTarget.addEventListener("message", y), i.addEventListener("message", p), i.start(), a;
|
|
281
|
+
}
|
|
282
|
+
return e.port;
|
|
283
|
+
}, ze = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
284
|
+
__proto__: null,
|
|
285
|
+
box: E,
|
|
286
|
+
isType: De,
|
|
287
|
+
revive: L,
|
|
288
|
+
type: k
|
|
289
|
+
}, Symbol.toStringTag, { value: "Module" })), oe = "promise", Je = (e) => e instanceof Promise, Ve = (e, t) => {
|
|
290
|
+
const r = e, { port1: n, port2: a } = new MessageChannel();
|
|
291
|
+
t.messagePorts.add(a);
|
|
292
|
+
const s = (o) => {
|
|
293
|
+
const i = m(o, t);
|
|
294
|
+
n.postMessage(i, U(i)), n.close(), t.messagePorts.delete(a);
|
|
190
295
|
};
|
|
191
|
-
return
|
|
192
|
-
|
|
193
|
-
|
|
296
|
+
return r.then((o) => s({ type: "resolve", data: o })).catch((o) => s({ type: "reject", error: o?.stack ?? String(o) })), {
|
|
297
|
+
...u,
|
|
298
|
+
type: oe,
|
|
299
|
+
port: E(a, t)
|
|
194
300
|
};
|
|
195
|
-
},
|
|
196
|
-
e.port
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
301
|
+
}, qe = (e, t) => {
|
|
302
|
+
const r = L(e.port, t);
|
|
303
|
+
return t.messagePorts.add(r), new Promise((n, a) => {
|
|
304
|
+
r.addEventListener("message", (s) => {
|
|
305
|
+
const o = s.data, i = A(o, t);
|
|
306
|
+
i.type === "resolve" ? n(i.data) : a(i.error), t.messagePorts.delete(r), r.close();
|
|
307
|
+
}, { once: !0 }), r.start();
|
|
308
|
+
});
|
|
309
|
+
}, Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
310
|
+
__proto__: null,
|
|
311
|
+
box: Ve,
|
|
312
|
+
isType: Je,
|
|
313
|
+
revive: qe,
|
|
314
|
+
type: oe
|
|
315
|
+
}, Symbol.toStringTag, { value: "Module" })), ae = "function", Ye = new FinalizationRegistry((e) => {
|
|
316
|
+
try {
|
|
317
|
+
e.port.postMessage({ __osra_close__: !0 });
|
|
318
|
+
} catch {
|
|
319
|
+
}
|
|
320
|
+
try {
|
|
321
|
+
e.port.close();
|
|
322
|
+
} catch {
|
|
323
|
+
}
|
|
324
|
+
}), Ge = (e) => typeof e == "function", Xe = (e, t) => {
|
|
325
|
+
const { port1: r, port2: n } = new MessageChannel();
|
|
326
|
+
t.messagePorts.add(n);
|
|
327
|
+
const a = () => {
|
|
328
|
+
t.messagePorts.delete(n), r.close();
|
|
208
329
|
};
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}),
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
330
|
+
return r.addEventListener("message", ({ data: s }) => {
|
|
331
|
+
if (s && typeof s == "object" && "__osra_close__" in s) {
|
|
332
|
+
a();
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
const [o, i] = A(s, t), c = (async () => e(...i))(), y = m(c, t);
|
|
336
|
+
o.postMessage(y, U(y));
|
|
337
|
+
}), r.start(), {
|
|
338
|
+
...u,
|
|
339
|
+
type: ae,
|
|
340
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
341
|
+
port: E(n, t)
|
|
342
|
+
};
|
|
343
|
+
}, He = (e, t) => {
|
|
344
|
+
const r = L(e.port, t), n = (...a) => new Promise((s, o) => {
|
|
345
|
+
const { port1: i, port2: c } = new MessageChannel();
|
|
346
|
+
t.messagePorts.add(c);
|
|
347
|
+
const y = m([c, a], t);
|
|
348
|
+
r.postMessage(y, U(y)), t.messagePorts.delete(c), i.addEventListener("message", ({ data: p }) => {
|
|
349
|
+
A(p, t).then(s).catch(o).finally(() => {
|
|
350
|
+
i.close();
|
|
351
|
+
});
|
|
352
|
+
}, { once: !0 }), i.start();
|
|
353
|
+
});
|
|
354
|
+
return Ye.register(n, { port: r }, n), n;
|
|
355
|
+
}, Qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
356
|
+
__proto__: null,
|
|
357
|
+
box: Xe,
|
|
358
|
+
isType: Ge,
|
|
359
|
+
revive: He,
|
|
360
|
+
type: ae
|
|
361
|
+
}, Symbol.toStringTag, { value: "Module" })), ie = "readableStream", Ze = (e) => e instanceof ReadableStream, ve = (e, t) => {
|
|
362
|
+
const { port1: r, port2: n } = new MessageChannel();
|
|
363
|
+
t.messagePorts.add(n);
|
|
364
|
+
const a = e.getReader();
|
|
365
|
+
return r.addEventListener("message", async ({ data: s }) => {
|
|
366
|
+
const { type: o } = A(s, t);
|
|
367
|
+
if (o === "pull") {
|
|
368
|
+
const i = a.read(), c = m(i, t);
|
|
369
|
+
r.postMessage(c, U(c));
|
|
240
370
|
} else
|
|
241
|
-
|
|
242
|
-
}),
|
|
243
|
-
|
|
244
|
-
|
|
371
|
+
a.cancel(), r.close();
|
|
372
|
+
}), r.start(), {
|
|
373
|
+
...u,
|
|
374
|
+
type: ie,
|
|
375
|
+
port: E(n, t)
|
|
245
376
|
};
|
|
246
|
-
},
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
377
|
+
}, Ne = (e, t) => {
|
|
378
|
+
const r = L(e.port, t);
|
|
379
|
+
return t.messagePorts.add(r), r.start(), new ReadableStream({
|
|
380
|
+
start(n) {
|
|
381
|
+
},
|
|
382
|
+
pull(n) {
|
|
383
|
+
return new Promise((a, s) => {
|
|
384
|
+
r.addEventListener("message", async ({ data: o }) => {
|
|
385
|
+
A(o, t).then((c) => {
|
|
386
|
+
c.done ? n.close() : n.enqueue(c.value), a();
|
|
387
|
+
}).catch(s);
|
|
388
|
+
}, { once: !0 }), r.postMessage(m({ type: "pull" }, t));
|
|
389
|
+
});
|
|
390
|
+
},
|
|
391
|
+
cancel() {
|
|
392
|
+
r.postMessage(m({ type: "cancel" }, t)), r.close();
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
}, xe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
396
|
+
__proto__: null,
|
|
397
|
+
box: ve,
|
|
398
|
+
isType: Ze,
|
|
399
|
+
revive: Ne,
|
|
400
|
+
type: ie
|
|
401
|
+
}, Symbol.toStringTag, { value: "Module" })), et = [
|
|
402
|
+
_e,
|
|
403
|
+
Se,
|
|
404
|
+
je,
|
|
405
|
+
We,
|
|
406
|
+
Ke,
|
|
407
|
+
Qe,
|
|
408
|
+
ze,
|
|
409
|
+
xe
|
|
410
|
+
], m = (e, t) => {
|
|
411
|
+
const r = t.revivableModules.find((n) => n.isType(e));
|
|
412
|
+
return r?.isType(e) ? r.box(e, t) : Array.isArray(e) ? e.map((n) => m(n, t)) : e && typeof e == "object" && Object.getPrototypeOf(e) === Object.prototype ? Object.fromEntries(
|
|
413
|
+
Object.entries(e).map(([n, a]) => [
|
|
278
414
|
n,
|
|
279
|
-
|
|
415
|
+
m(a, t)
|
|
280
416
|
])
|
|
281
|
-
) :
|
|
282
|
-
},
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
417
|
+
) : e;
|
|
418
|
+
}, A = (e, t) => {
|
|
419
|
+
if (fe(e)) {
|
|
420
|
+
const r = t.revivableModules.find((n) => n.type === e.type);
|
|
421
|
+
if (r)
|
|
422
|
+
return r.revive(e, t);
|
|
423
|
+
}
|
|
424
|
+
return Array.isArray(e) ? e.map((r) => A(r, t)) : e && typeof e == "object" && Object.getPrototypeOf(e) === Object.prototype ? Object.fromEntries(
|
|
425
|
+
Object.entries(e).map(([r, n]) => [
|
|
426
|
+
r,
|
|
427
|
+
A(n, t)
|
|
287
428
|
])
|
|
288
429
|
) : e;
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
platformCapabilities: o,
|
|
430
|
+
}, tt = ({ transport: e, value: t, uuid: r, remoteUuid: n, platformCapabilities: a, eventTarget: s, send: o, close: i }) => {
|
|
431
|
+
const c = {
|
|
432
|
+
platformCapabilities: a,
|
|
293
433
|
transport: e,
|
|
294
434
|
remoteUuid: n,
|
|
295
435
|
messagePorts: /* @__PURE__ */ new Set(),
|
|
296
|
-
messageChannels:
|
|
297
|
-
sendMessage:
|
|
298
|
-
eventTarget: s
|
|
436
|
+
messageChannels: de(),
|
|
437
|
+
sendMessage: o,
|
|
438
|
+
eventTarget: s,
|
|
439
|
+
revivableModules: et
|
|
299
440
|
};
|
|
300
|
-
let
|
|
301
|
-
const
|
|
302
|
-
|
|
441
|
+
let y;
|
|
442
|
+
const p = new Promise((l, f) => {
|
|
443
|
+
y = l;
|
|
303
444
|
});
|
|
304
|
-
return s.addEventListener("message", ({ detail:
|
|
305
|
-
if (
|
|
306
|
-
l
|
|
445
|
+
return s.addEventListener("message", ({ detail: l }) => {
|
|
446
|
+
if (l.type === "init") {
|
|
447
|
+
y(l);
|
|
307
448
|
return;
|
|
308
|
-
} else
|
|
309
|
-
}),
|
|
449
|
+
} else l.type === "message" && c.messageChannels.getOrAlloc(l.portId).port2?.postMessage(l);
|
|
450
|
+
}), o({
|
|
310
451
|
type: "init",
|
|
311
452
|
remoteUuid: n,
|
|
312
|
-
data: m(
|
|
453
|
+
data: m(t, c)
|
|
313
454
|
}), {
|
|
314
|
-
revivableContext:
|
|
455
|
+
revivableContext: c,
|
|
315
456
|
close: () => {
|
|
316
457
|
},
|
|
317
|
-
remoteValue:
|
|
458
|
+
remoteValue: p.then((l) => A(l.data, c))
|
|
318
459
|
};
|
|
319
|
-
},
|
|
460
|
+
}, rt = ({ value: e, uuid: t, platformCapabilities: r, send: n, close: a }) => ({
|
|
320
461
|
close: () => {
|
|
321
462
|
},
|
|
322
463
|
remoteValueProxy: new Proxy(
|
|
323
464
|
new Function(),
|
|
324
465
|
{
|
|
325
|
-
apply: (s,
|
|
466
|
+
apply: (s, o, i) => {
|
|
326
467
|
},
|
|
327
|
-
get: (s,
|
|
468
|
+
get: (s, o) => {
|
|
328
469
|
}
|
|
329
470
|
}
|
|
330
471
|
)
|
|
331
472
|
});
|
|
332
|
-
var
|
|
333
|
-
dispatchTypedEvent(e,
|
|
334
|
-
return super.dispatchEvent(
|
|
473
|
+
var nt = class extends EventTarget {
|
|
474
|
+
dispatchTypedEvent(e, t) {
|
|
475
|
+
return super.dispatchEvent(t);
|
|
335
476
|
}
|
|
336
477
|
};
|
|
337
|
-
const
|
|
338
|
-
transport:
|
|
339
|
-
name:
|
|
478
|
+
const st = async (e, {
|
|
479
|
+
transport: t,
|
|
480
|
+
name: r,
|
|
340
481
|
remoteName: n,
|
|
341
|
-
key:
|
|
482
|
+
key: a = ye,
|
|
342
483
|
origin: s = "*",
|
|
343
|
-
unregisterSignal:
|
|
344
|
-
platformCapabilities:
|
|
345
|
-
transferAll:
|
|
346
|
-
logger:
|
|
484
|
+
unregisterSignal: o,
|
|
485
|
+
platformCapabilities: i,
|
|
486
|
+
transferAll: c,
|
|
487
|
+
logger: y
|
|
347
488
|
}) => {
|
|
348
|
-
const
|
|
349
|
-
isJson: "isJson" in
|
|
350
|
-
...
|
|
351
|
-
emit:
|
|
352
|
-
receive:
|
|
489
|
+
const p = {
|
|
490
|
+
isJson: "isJson" in t && t.isJson !== void 0 ? t.isJson : S(t),
|
|
491
|
+
...J(t) ? t : {
|
|
492
|
+
emit: t,
|
|
493
|
+
receive: t
|
|
353
494
|
}
|
|
354
|
-
},
|
|
355
|
-
let
|
|
356
|
-
const
|
|
357
|
-
|
|
495
|
+
}, l = i ?? await we(), f = /* @__PURE__ */ new Map();
|
|
496
|
+
let h;
|
|
497
|
+
const T = new Promise((d) => {
|
|
498
|
+
h = d;
|
|
358
499
|
});
|
|
359
500
|
let b = globalThis.crypto.randomUUID();
|
|
360
|
-
const w = (
|
|
361
|
-
const
|
|
362
|
-
|
|
363
|
-
|
|
501
|
+
const w = (d, M) => {
|
|
502
|
+
const g = U(M);
|
|
503
|
+
le(
|
|
504
|
+
d,
|
|
364
505
|
{
|
|
365
|
-
[
|
|
366
|
-
name:
|
|
506
|
+
[P]: a,
|
|
507
|
+
name: r,
|
|
367
508
|
uuid: b,
|
|
368
|
-
...
|
|
509
|
+
...M
|
|
369
510
|
},
|
|
370
511
|
s,
|
|
371
|
-
|
|
512
|
+
g
|
|
372
513
|
);
|
|
373
|
-
},
|
|
374
|
-
if (
|
|
375
|
-
if (!
|
|
514
|
+
}, ce = async (d, M) => {
|
|
515
|
+
if (d.uuid !== b) {
|
|
516
|
+
if (!_(p))
|
|
376
517
|
throw new Error("Unidirectional receiving mode not implemented");
|
|
377
|
-
if (
|
|
378
|
-
if (!
|
|
379
|
-
w(
|
|
518
|
+
if (d.type === "announce") {
|
|
519
|
+
if (!d.remoteUuid) {
|
|
520
|
+
w(p, { type: "announce", remoteUuid: d.uuid });
|
|
380
521
|
return;
|
|
381
522
|
}
|
|
382
|
-
if (
|
|
383
|
-
if (g.has(y.uuid)) {
|
|
384
|
-
w(
|
|
385
|
-
f,
|
|
386
|
-
{ type: "reject-uuid-taken", remoteUuid: y.uuid }
|
|
387
|
-
);
|
|
523
|
+
if (d.remoteUuid !== b || f.has(d.uuid))
|
|
388
524
|
return;
|
|
389
|
-
}
|
|
390
|
-
const
|
|
525
|
+
w(p, { type: "announce", remoteUuid: d.uuid });
|
|
526
|
+
const g = new nt(), V = {
|
|
391
527
|
type: "bidirectional",
|
|
392
|
-
eventTarget:
|
|
393
|
-
connection:
|
|
394
|
-
transport:
|
|
528
|
+
eventTarget: g,
|
|
529
|
+
connection: tt({
|
|
530
|
+
transport: p,
|
|
395
531
|
value: e,
|
|
396
532
|
uuid: b,
|
|
397
|
-
remoteUuid:
|
|
398
|
-
platformCapabilities:
|
|
399
|
-
eventTarget:
|
|
400
|
-
send: (
|
|
401
|
-
close: () => void
|
|
533
|
+
remoteUuid: d.uuid,
|
|
534
|
+
platformCapabilities: l,
|
|
535
|
+
eventTarget: g,
|
|
536
|
+
send: (j) => w(p, j),
|
|
537
|
+
close: () => void f.delete(d.uuid)
|
|
402
538
|
})
|
|
403
539
|
};
|
|
404
|
-
|
|
405
|
-
(
|
|
540
|
+
f.set(d.uuid, V), V.connection.remoteValue.then(
|
|
541
|
+
(j) => h(j)
|
|
406
542
|
);
|
|
407
|
-
} else if (
|
|
408
|
-
if (
|
|
409
|
-
b = globalThis.crypto.randomUUID(), w(
|
|
410
|
-
} else if (
|
|
411
|
-
if (
|
|
412
|
-
const
|
|
413
|
-
if (!
|
|
414
|
-
console.warn(`Connection not found for remoteUuid: ${
|
|
543
|
+
} else if (d.type === "reject-uuid-taken") {
|
|
544
|
+
if (d.remoteUuid !== b) return;
|
|
545
|
+
b = globalThis.crypto.randomUUID(), w(p, { type: "announce" });
|
|
546
|
+
} else if (d.type === "close") {
|
|
547
|
+
if (d.remoteUuid !== b) return;
|
|
548
|
+
const g = f.get(d.uuid);
|
|
549
|
+
if (!g) {
|
|
550
|
+
console.warn(`Connection not found for remoteUuid: ${d.uuid}`);
|
|
415
551
|
return;
|
|
416
552
|
}
|
|
417
|
-
|
|
553
|
+
g.connection.close(), f.delete(d.uuid);
|
|
418
554
|
} else {
|
|
419
|
-
if (
|
|
420
|
-
const
|
|
421
|
-
if (!
|
|
422
|
-
console.warn(`Connection not found for remoteUuid: ${
|
|
555
|
+
if (d.remoteUuid !== b) return;
|
|
556
|
+
const g = f.get(d.uuid);
|
|
557
|
+
if (!g) {
|
|
558
|
+
console.warn(`Connection not found for remoteUuid: ${d.uuid}`);
|
|
423
559
|
return;
|
|
424
560
|
}
|
|
425
|
-
|
|
561
|
+
g.type !== "unidirectional-emitting" && g.eventTarget.dispatchTypedEvent(
|
|
426
562
|
"message",
|
|
427
|
-
new CustomEvent("message", { detail:
|
|
563
|
+
new CustomEvent("message", { detail: d })
|
|
428
564
|
);
|
|
429
565
|
}
|
|
430
566
|
}
|
|
431
567
|
};
|
|
432
|
-
if (F(
|
|
433
|
-
listener:
|
|
434
|
-
transport:
|
|
568
|
+
if (F(p) && pe({
|
|
569
|
+
listener: ce,
|
|
570
|
+
transport: p,
|
|
435
571
|
remoteName: n,
|
|
436
|
-
key:
|
|
437
|
-
unregisterSignal:
|
|
438
|
-
}),
|
|
439
|
-
const { remoteValueProxy:
|
|
572
|
+
key: a,
|
|
573
|
+
unregisterSignal: o
|
|
574
|
+
}), _(p) && w(p, { type: "announce" }), _(p) && !F(p)) {
|
|
575
|
+
const { remoteValueProxy: d } = rt({
|
|
440
576
|
value: e,
|
|
441
577
|
uuid: b,
|
|
442
|
-
platformCapabilities:
|
|
443
|
-
send: (
|
|
444
|
-
close: () =>
|
|
578
|
+
platformCapabilities: l,
|
|
579
|
+
send: (M) => w(p, M),
|
|
580
|
+
close: () => f.delete(b)
|
|
445
581
|
});
|
|
446
|
-
return
|
|
582
|
+
return d;
|
|
447
583
|
}
|
|
448
|
-
return
|
|
584
|
+
return T;
|
|
449
585
|
};
|
|
450
586
|
export {
|
|
451
|
-
|
|
587
|
+
u as BoxBase,
|
|
588
|
+
st as expose
|
|
452
589
|
};
|
|
453
590
|
//# sourceMappingURL=index.js.map
|