@fest-lib/fl-ui 0.1.3 → 0.1.6
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/assets/{OPFS.uniform.worker-Ddx6J_37.js → OPFS.uniform.worker-CDqHwWLq.js} +147 -144
- package/dist/fl-ui.js +2437 -2336
- package/dist/index.js +16117 -0
- package/package.json +4 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
(function() {
|
|
2
|
-
var ee = Object.defineProperty,
|
|
2
|
+
var ee = Object.defineProperty, De = (e, t, n) => () => {
|
|
3
3
|
if (n) throw n[0];
|
|
4
4
|
try {
|
|
5
5
|
return e && (t = e(e = 0)), t;
|
|
6
6
|
} catch (s) {
|
|
7
7
|
throw n = [s], s;
|
|
8
8
|
}
|
|
9
|
-
},
|
|
9
|
+
}, Ne = (e, t) => {
|
|
10
10
|
let n = {};
|
|
11
11
|
for (var s in e) ee(n, s, {
|
|
12
12
|
get: e[s],
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
let h = (function(e) {
|
|
18
18
|
return e.GET = "get", e.SET = "set", e.CALL = "call", e.APPLY = "apply", e.CONSTRUCT = "construct", e.DELETE = "delete", e.DELETE_PROPERTY = "deleteProperty", e.HAS = "has", e.OWN_KEYS = "ownKeys", e.GET_OWN_PROPERTY_DESCRIPTOR = "getOwnPropertyDescriptor", e.GET_PROPERTY_DESCRIPTOR = "getPropertyDescriptor", e.GET_PROTOTYPE_OF = "getPrototypeOf", e.SET_PROTOTYPE_OF = "setPrototypeOf", e.IS_EXTENSIBLE = "isExtensible", e.PREVENT_EXTENSIONS = "preventExtensions", e.TRANSFER = "transfer", e.IMPORT = "import", e.DISPOSE = "dispose", e;
|
|
19
19
|
})({});
|
|
20
|
-
const
|
|
20
|
+
const Le = {
|
|
21
21
|
ws: "websocket",
|
|
22
22
|
socket: "websocket",
|
|
23
23
|
socketio: "socket-io",
|
|
@@ -27,22 +27,25 @@
|
|
|
27
27
|
"service-worker-host": "service-worker",
|
|
28
28
|
"ring-buffer": "atomics"
|
|
29
29
|
};
|
|
30
|
-
function
|
|
30
|
+
function Be(e) {
|
|
31
31
|
const t = String(e ?? "").trim().toLowerCase();
|
|
32
|
-
return t ?
|
|
32
|
+
return t ? Le[t] ?? t : "internal";
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
return typeof e == "string" ?
|
|
34
|
+
function qe(e) {
|
|
35
|
+
return typeof e == "string" ? Be(e) : typeof Worker < "u" && e instanceof Worker ? "worker" : typeof SharedWorker < "u" && e instanceof SharedWorker ? "shared-worker" : typeof MessagePort < "u" && e instanceof MessagePort ? "message-port" : typeof BroadcastChannel < "u" && e instanceof BroadcastChannel ? "broadcast" : typeof WebSocket < "u" && e instanceof WebSocket ? "websocket" : typeof RTCDataChannel < "u" && e instanceof RTCDataChannel ? "rtc-data" : typeof chrome < "u" && e && typeof e == "object" && typeof e.postMessage == "function" && e.onMessage?.addListener ? "chrome-port" : "internal";
|
|
36
36
|
}
|
|
37
|
-
const te = Symbol.for("@fix"), C = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" || typeof e > "u" || e == null,
|
|
37
|
+
const te = Symbol.for("@fix"), C = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" || typeof e > "u" || e == null, Fe = (e, t) => C(e) ? t == "number" ? Number(e) || 0 : t == "string" ? String(e) || "" : t == "boolean" ? !!e : e : null, p = (e, t) => e?.[te] ?? e ?? t ?? t, He = (e) => {
|
|
38
38
|
if (typeof e == "function" || e == null) return e;
|
|
39
39
|
const t = function() {};
|
|
40
40
|
return t[te] = e, t;
|
|
41
|
-
},
|
|
41
|
+
}, Ge = (e) => crypto?.getRandomValues ? crypto?.getRandomValues?.(e) : (() => {
|
|
42
42
|
const t = new Uint8Array(e.length);
|
|
43
43
|
for (let n = 0; n < e.length; n++) t[n] = Math.floor(Math.random() * 256);
|
|
44
44
|
return t;
|
|
45
|
-
})(), d = () => crypto?.randomUUID ? crypto?.randomUUID?.() : "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (e) => (+e ^
|
|
45
|
+
})(), d = () => crypto?.randomUUID ? crypto?.randomUUID?.() : "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (e) => (+e ^ Ge?.(/* @__PURE__ */ new Uint8Array(1))?.[0] & 15 >> +e / 4).toString(16)), ne = (e) => Array.isArray(e) ? e?.flatMap?.((t) => Array.isArray(t) ? ne(t) : t) : e, $ = (e) => ne(e)?.every?.(x), x = (e) => C(e) || typeof SharedArrayBuffer == "function" && e instanceof SharedArrayBuffer || Ue(e) || Array.isArray(e) && $(e), Ue = (e) => ArrayBuffer.isView(e) && !(e instanceof DataView), z = (e) => C(e) || typeof ArrayBuffer == "function" && e instanceof ArrayBuffer || typeof MessagePort == "function" && e instanceof MessagePort || typeof ReadableStream == "function" && e instanceof ReadableStream || typeof WritableStream == "function" && e instanceof WritableStream || typeof TransformStream == "function" && e instanceof TransformStream || typeof ImageBitmap == "function" && e instanceof ImageBitmap || typeof VideoFrame == "function" && e instanceof VideoFrame || typeof OffscreenCanvas == "function" && e instanceof OffscreenCanvas || typeof RTCDataChannel == "function" && e instanceof RTCDataChannel || typeof AudioData == "function" && e instanceof AudioData || typeof WebTransportReceiveStream == "function" && e instanceof WebTransportReceiveStream || typeof WebTransportSendStream == "function" && e instanceof WebTransportSendStream || typeof WebTransportReceiveStream == "function" && e instanceof WebTransportReceiveStream, se = Symbol.for("object.boundCtx");
|
|
46
|
+
globalThis[se] ??= /* @__PURE__ */ new WeakMap();
|
|
47
|
+
globalThis[se];
|
|
48
|
+
const k = (e, t, n) => {
|
|
46
49
|
if (Array.isArray(e)) return e.every(x) ? e.map(t) : e.map((s, r) => k(s, t, [e, r]));
|
|
47
50
|
if (e instanceof Map) {
|
|
48
51
|
const s = Array.from(e.entries());
|
|
@@ -57,11 +60,11 @@
|
|
|
57
60
|
return s.map(([r, i]) => i).every(x) ? Object.fromEntries(s.map(([r, i]) => [r, t(i, r, e)])) : Object.fromEntries(s.map(([r, i]) => [r, k(i, t, [e, r])]));
|
|
58
61
|
}
|
|
59
62
|
return t(e, n?.[1] ?? "", n?.[0] ?? null);
|
|
60
|
-
}, S = /* @__PURE__ */ new WeakMap(),
|
|
63
|
+
}, S = /* @__PURE__ */ new WeakMap(), re = /* @__PURE__ */ new WeakMap(), g = (e, t) => e instanceof Promise || typeof e?.then == "function" ? S?.has?.(e) ? t(S?.get?.(e)) : Promise.try?.(async () => {
|
|
61
64
|
const n = await e;
|
|
62
65
|
return S?.set?.(e, n), n;
|
|
63
66
|
})?.then?.(t) : t(e);
|
|
64
|
-
var
|
|
67
|
+
var We = class {
|
|
65
68
|
#e;
|
|
66
69
|
#t;
|
|
67
70
|
constructor(e, t) {
|
|
@@ -116,7 +119,7 @@
|
|
|
116
119
|
}
|
|
117
120
|
}
|
|
118
121
|
let s;
|
|
119
|
-
return S?.has?.(e) && (s = S?.get?.(e))?.[t] != null ? s = S?.get?.(e)?.[t] : s =
|
|
122
|
+
return S?.has?.(e) && (s = S?.get?.(e))?.[t] != null ? s = S?.get?.(e)?.[t] : s = oe(g(e, async (r) => {
|
|
120
123
|
if (p(r) instanceof Promise) return Reflect.get(r, t, n);
|
|
121
124
|
if (C(r)) return t == Symbol.toPrimitive || t == Symbol.toStringTag ? r : void 0;
|
|
122
125
|
let i;
|
|
@@ -127,7 +130,7 @@
|
|
|
127
130
|
}
|
|
128
131
|
return typeof i == "function" ? i?.bind?.(r) : i;
|
|
129
132
|
})), t == Symbol.toStringTag ? C(s) ? String(s ?? "") || "" : s?.[Symbol.toStringTag]?.() || String(s ?? "") || "" : t == Symbol.toPrimitive ? (r) => {
|
|
130
|
-
if (C(s)) return
|
|
133
|
+
if (C(s)) return Fe(s, r);
|
|
131
134
|
} : s;
|
|
132
135
|
}
|
|
133
136
|
set(e, t, n) {
|
|
@@ -143,10 +146,10 @@
|
|
|
143
146
|
});
|
|
144
147
|
}
|
|
145
148
|
};
|
|
146
|
-
function
|
|
147
|
-
return e instanceof Promise || typeof e?.then == "function" ? S?.has?.(e) ? S?.get?.(e) : (
|
|
149
|
+
function oe(e, t, n) {
|
|
150
|
+
return e instanceof Promise || typeof e?.then == "function" ? S?.has?.(e) ? S?.get?.(e) : (re?.has?.(e) || e?.then?.((s) => S?.set?.(e, s)), re?.getOrInsertComputed?.(e, () => new Proxy(He(e), new We(t, n)))) : e;
|
|
148
151
|
}
|
|
149
|
-
var
|
|
152
|
+
var ie = class {
|
|
150
153
|
_unsubscribe;
|
|
151
154
|
_closed = !1;
|
|
152
155
|
constructor(e) {
|
|
@@ -158,7 +161,7 @@
|
|
|
158
161
|
unsubscribe() {
|
|
159
162
|
this._closed || (this._closed = !0, this._unsubscribe());
|
|
160
163
|
}
|
|
161
|
-
},
|
|
164
|
+
}, $e = class {
|
|
162
165
|
_producer;
|
|
163
166
|
constructor(e) {
|
|
164
167
|
this._producer = e;
|
|
@@ -187,7 +190,7 @@
|
|
|
187
190
|
} catch (c) {
|
|
188
191
|
a.error(c);
|
|
189
192
|
}
|
|
190
|
-
return new
|
|
193
|
+
return new ie(o);
|
|
191
194
|
}
|
|
192
195
|
pipe(...e) {
|
|
193
196
|
return e.reduce((t, n) => n(t), this);
|
|
@@ -222,7 +225,7 @@
|
|
|
222
225
|
} catch (s) {
|
|
223
226
|
t.error?.(s);
|
|
224
227
|
}
|
|
225
|
-
return new
|
|
228
|
+
return new ie(() => {
|
|
226
229
|
this._subs.delete(t);
|
|
227
230
|
});
|
|
228
231
|
}
|
|
@@ -236,7 +239,7 @@
|
|
|
236
239
|
return this._subs.size;
|
|
237
240
|
}
|
|
238
241
|
};
|
|
239
|
-
const
|
|
242
|
+
const ze = (e) => (t) => new $e((n) => {
|
|
240
243
|
const s = t.subscribe({
|
|
241
244
|
next: (r) => e(r) && n.next(r),
|
|
242
245
|
error: (r) => n.error(r),
|
|
@@ -244,7 +247,7 @@
|
|
|
244
247
|
});
|
|
245
248
|
return () => s.unsubscribe();
|
|
246
249
|
});
|
|
247
|
-
function
|
|
250
|
+
function ae() {
|
|
248
251
|
if (typeof globalThis.Deno < "u") return "deno";
|
|
249
252
|
if (typeof globalThis.process < "u" && globalThis.process?.versions?.node) return "node";
|
|
250
253
|
const e = globalThis.ServiceWorkerGlobalScope, t = globalThis.SharedWorkerGlobalScope, n = globalThis.DedicatedWorkerGlobalScope;
|
|
@@ -259,18 +262,18 @@
|
|
|
259
262
|
}
|
|
260
263
|
return typeof globalThis < "u" && typeof document < "u" ? "window" : "unknown";
|
|
261
264
|
}
|
|
262
|
-
function
|
|
265
|
+
function ce(e) {
|
|
263
266
|
if (typeof RTCDataChannel < "u" && e instanceof RTCDataChannel) return "rtc-data";
|
|
264
|
-
const t =
|
|
267
|
+
const t = qe(e);
|
|
265
268
|
return t && t !== "internal" ? t : e === self || e === globalThis || e === "self" ? "self" : "internal";
|
|
266
269
|
}
|
|
267
|
-
function
|
|
270
|
+
function Ye(e) {
|
|
268
271
|
if (!e) return "unknown";
|
|
269
272
|
if (e.contextType) return e.contextType;
|
|
270
273
|
const t = e.sender ?? "";
|
|
271
274
|
return t.includes("worker") ? "worker" : t.includes("sw") || t.includes("service") ? "service-worker" : t.includes("chrome") || t.includes("crx") ? "chrome-content" : t.includes("background") ? "chrome-background" : "unknown";
|
|
272
275
|
}
|
|
273
|
-
const
|
|
276
|
+
const Ke = {
|
|
274
277
|
get: (e, t) => Reflect.get(e, t),
|
|
275
278
|
set: (e, t, n) => Reflect.set(e, t, n),
|
|
276
279
|
has: (e, t) => Reflect.has(e, t),
|
|
@@ -283,8 +286,8 @@
|
|
|
283
286
|
setPrototypeOf: (e, t) => Reflect.setPrototypeOf(e, t),
|
|
284
287
|
isExtensible: (e) => Reflect.isExtensible(e),
|
|
285
288
|
preventExtensions: (e) => Reflect.preventExtensions(e)
|
|
286
|
-
},
|
|
287
|
-
var
|
|
289
|
+
}, Ve = Symbol.for("uniform.proxy"), Xe = Symbol.for("uniform.proxy.internals");
|
|
290
|
+
var je = class {
|
|
288
291
|
_invoker;
|
|
289
292
|
_config;
|
|
290
293
|
_childCache = /* @__PURE__ */ new Map();
|
|
@@ -299,9 +302,9 @@
|
|
|
299
302
|
}
|
|
300
303
|
get(e, t, n) {
|
|
301
304
|
const s = String(t);
|
|
302
|
-
if (t ===
|
|
303
|
-
if (t ===
|
|
304
|
-
if (t ===
|
|
305
|
+
if (t === Ve) return !0;
|
|
306
|
+
if (t === Xe) return this._config;
|
|
307
|
+
if (t === at) return !0;
|
|
305
308
|
if (t === D) return this._getDescriptor();
|
|
306
309
|
if (t === "then" || t === "catch" || t === "finally" || typeof t == "symbol") return;
|
|
307
310
|
if (t === "$path") return this._config.basePath;
|
|
@@ -362,21 +365,21 @@
|
|
|
362
365
|
}
|
|
363
366
|
};
|
|
364
367
|
function H(e, t) {
|
|
365
|
-
const n = function() {}, s = new
|
|
368
|
+
const n = function() {}, s = new je(e, t);
|
|
366
369
|
return new Proxy(n, s);
|
|
367
370
|
}
|
|
368
|
-
function
|
|
371
|
+
function le(e, t, n) {
|
|
369
372
|
if (!e || typeof e != "object" || e.primitive) return e;
|
|
370
|
-
const s =
|
|
373
|
+
const s = ye.get(e);
|
|
371
374
|
if (s) return s;
|
|
372
375
|
const r = H(t, {
|
|
373
376
|
channel: n ?? e.channel ?? "unknown",
|
|
374
377
|
basePath: e.path ?? []
|
|
375
378
|
});
|
|
376
|
-
return
|
|
379
|
+
return ye.set(e, r), V.set(r, e), r;
|
|
377
380
|
}
|
|
378
|
-
const
|
|
379
|
-
function
|
|
381
|
+
const Ze = le;
|
|
382
|
+
function et(e) {
|
|
380
383
|
return [
|
|
381
384
|
e.localChannel,
|
|
382
385
|
e.remoteChannel,
|
|
@@ -385,11 +388,11 @@
|
|
|
385
388
|
e.direction
|
|
386
389
|
].join("::");
|
|
387
390
|
}
|
|
388
|
-
function
|
|
391
|
+
function tt(e, t = {}) {
|
|
389
392
|
const n = t.includeClosed ?? !1, s = t.status ?? (n ? void 0 : "active");
|
|
390
393
|
return [...e].filter((r) => !(s && r.status !== s || t.channel && r.localChannel !== t.channel && r.remoteChannel !== t.channel || t.localChannel && r.localChannel !== t.localChannel || t.remoteChannel && r.remoteChannel !== t.remoteChannel || t.sender && r.sender !== t.sender || t.transportType && r.transportType !== t.transportType || t.direction && r.direction !== t.direction)).sort((r, i) => i.updatedAt - r.updatedAt);
|
|
391
394
|
}
|
|
392
|
-
var
|
|
395
|
+
var ue = class {
|
|
393
396
|
_createId;
|
|
394
397
|
_emitEvent;
|
|
395
398
|
_connections = /* @__PURE__ */ new Map();
|
|
@@ -397,7 +400,7 @@
|
|
|
397
400
|
this._createId = e, this._emitEvent = t;
|
|
398
401
|
}
|
|
399
402
|
register(e) {
|
|
400
|
-
const t =
|
|
403
|
+
const t = et(e), n = Date.now(), s = this._connections.get(t);
|
|
401
404
|
if (s) return s.updatedAt = n, s.status = "active", s.metadata = {
|
|
402
405
|
...s.metadata,
|
|
403
406
|
...e.metadata
|
|
@@ -446,7 +449,7 @@
|
|
|
446
449
|
}));
|
|
447
450
|
}
|
|
448
451
|
query(e = {}) {
|
|
449
|
-
return
|
|
452
|
+
return tt(this._connections.values(), e);
|
|
450
453
|
}
|
|
451
454
|
values() {
|
|
452
455
|
return [...this._connections.values()];
|
|
@@ -454,14 +457,14 @@
|
|
|
454
457
|
clear() {
|
|
455
458
|
this._connections.clear();
|
|
456
459
|
}
|
|
457
|
-
},
|
|
460
|
+
}, he = class {
|
|
458
461
|
_name;
|
|
459
462
|
_contextType;
|
|
460
463
|
_config;
|
|
461
464
|
_transports = /* @__PURE__ */ new Map();
|
|
462
465
|
_defaultTransport = null;
|
|
463
466
|
_connectionEvents = new y({ bufferSize: 200 });
|
|
464
|
-
_connectionRegistry = new
|
|
467
|
+
_connectionRegistry = new ue(() => d(), (e) => this._connectionEvents.next(e));
|
|
465
468
|
_pending = /* @__PURE__ */ new Map();
|
|
466
469
|
_subscriptions = [];
|
|
467
470
|
_inbound = new y({ bufferSize: 100 });
|
|
@@ -478,17 +481,17 @@
|
|
|
478
481
|
}
|
|
479
482
|
constructor(e) {
|
|
480
483
|
const t = typeof e == "string" ? { name: e } : e;
|
|
481
|
-
this._name = t.name, this._contextType = t.autoDetect !== !1 ?
|
|
484
|
+
this._name = t.name, this._contextType = t.autoDetect !== !1 ? ae() : "unknown", this._config = {
|
|
482
485
|
name: t.name,
|
|
483
486
|
autoDetect: t.autoDetect ?? !0,
|
|
484
487
|
timeout: t.timeout ?? 3e4,
|
|
485
|
-
reflect: t.reflect ??
|
|
488
|
+
reflect: t.reflect ?? Ke,
|
|
486
489
|
bufferSize: t.bufferSize ?? 100,
|
|
487
490
|
autoListen: t.autoListen ?? !0
|
|
488
491
|
}, this._config.autoListen && this._isWorkerContext() && this.listen(self);
|
|
489
492
|
}
|
|
490
493
|
connect(e, t = {}) {
|
|
491
|
-
const n =
|
|
494
|
+
const n = ce(e), s = t.targetChannel ?? this._inferTargetChannel(e, n), r = this._createTransportBinding(e, n, s, t);
|
|
492
495
|
this._transports.set(s, r), this._defaultTransport || (this._defaultTransport = r);
|
|
493
496
|
const i = this._registerConnection({
|
|
494
497
|
localChannel: this._name,
|
|
@@ -505,7 +508,7 @@
|
|
|
505
508
|
}), this;
|
|
506
509
|
}
|
|
507
510
|
listen(e, t = {}) {
|
|
508
|
-
const n =
|
|
511
|
+
const n = ce(e), s = t.targetChannel ?? this._inferTargetChannel(e, n), r = (o) => this._handleIncoming(o), i = this._registerConnection({
|
|
509
512
|
localChannel: this._name,
|
|
510
513
|
remoteChannel: s,
|
|
511
514
|
sender: s,
|
|
@@ -612,7 +615,7 @@
|
|
|
612
615
|
return this.proxy(t, [e]);
|
|
613
616
|
}
|
|
614
617
|
wrapDescriptor(e, t) {
|
|
615
|
-
return
|
|
618
|
+
return le(e, (s, r, i) => {
|
|
616
619
|
const o = t ?? e?.channel ?? this._getDefaultTarget();
|
|
617
620
|
return this.invoke(o, s, r, i);
|
|
618
621
|
}, t ?? e?.channel ?? this._getDefaultTarget());
|
|
@@ -755,13 +758,13 @@
|
|
|
755
758
|
path: s,
|
|
756
759
|
args: r ?? [],
|
|
757
760
|
timestamp: Date.now(),
|
|
758
|
-
contextType:
|
|
761
|
+
contextType: Ye(e)
|
|
759
762
|
});
|
|
760
763
|
const { result: a, toTransfer: c, newPath: l } = await this._executeAction(n, s, r ?? [], i);
|
|
761
764
|
await this._sendResponse(o, n, i, l, a, c);
|
|
762
765
|
}
|
|
763
766
|
async _executeAction(e, t, n, s) {
|
|
764
|
-
const { result: r, toTransfer: i, path: o } =
|
|
767
|
+
const { result: r, toTransfer: i, path: o } = we(e, t, n, {
|
|
765
768
|
channel: this._name,
|
|
766
769
|
sender: s,
|
|
767
770
|
reflect: this._config.reflect
|
|
@@ -773,7 +776,7 @@
|
|
|
773
776
|
};
|
|
774
777
|
}
|
|
775
778
|
async _sendResponse(e, t, n, s, r, i) {
|
|
776
|
-
const { response: o, transfer: a } = await
|
|
779
|
+
const { response: o, transfer: a } = await be(e, t, this._name, n, s, r, i), c = {
|
|
777
780
|
id: e,
|
|
778
781
|
...o,
|
|
779
782
|
timestamp: Date.now(),
|
|
@@ -984,12 +987,12 @@
|
|
|
984
987
|
}
|
|
985
988
|
};
|
|
986
989
|
function Y(e) {
|
|
987
|
-
return new
|
|
990
|
+
return new he(e);
|
|
988
991
|
}
|
|
989
992
|
let G = null;
|
|
990
|
-
function
|
|
993
|
+
function nt() {
|
|
991
994
|
if (!G) {
|
|
992
|
-
const e =
|
|
995
|
+
const e = ae();
|
|
993
996
|
[
|
|
994
997
|
"worker",
|
|
995
998
|
"shared-worker",
|
|
@@ -1029,7 +1032,7 @@
|
|
|
1029
1032
|
typeof OffscreenCanvas != m.udf ? OffscreenCanvas : null,
|
|
1030
1033
|
typeof RTCDataChannel != m.udf ? RTCDataChannel : null
|
|
1031
1034
|
].filter((e) => e != null);
|
|
1032
|
-
function
|
|
1035
|
+
function de() {
|
|
1033
1036
|
try {
|
|
1034
1037
|
const e = globalThis.location?.href;
|
|
1035
1038
|
if (typeof e == "string" && e.length > 0) return e;
|
|
@@ -1039,8 +1042,8 @@
|
|
|
1039
1042
|
} catch {}
|
|
1040
1043
|
return "";
|
|
1041
1044
|
}
|
|
1042
|
-
function
|
|
1043
|
-
const t =
|
|
1045
|
+
function fe(e) {
|
|
1046
|
+
const t = de();
|
|
1044
1047
|
if (!t.length) throw new TypeError("[uniform] No base URL for worker resolution (missing location / document.baseURI)");
|
|
1045
1048
|
const n = e.startsWith("/") ? e.replace(/^\//, "./") : e;
|
|
1046
1049
|
return new URL(n, t).href;
|
|
@@ -1048,21 +1051,21 @@
|
|
|
1048
1051
|
const w = {
|
|
1049
1052
|
name: "unknown",
|
|
1050
1053
|
instance: null
|
|
1051
|
-
}, K = /* @__PURE__ */ new Map(),
|
|
1052
|
-
var
|
|
1054
|
+
}, K = /* @__PURE__ */ new Map(), pe = (e) => [...Object.values(h)].includes(e);
|
|
1055
|
+
var st = class {
|
|
1053
1056
|
channelName;
|
|
1054
1057
|
options;
|
|
1055
1058
|
_channel;
|
|
1056
1059
|
constructor(e, t = {}) {
|
|
1057
|
-
this.channelName = e, this.options = t, this._channel =
|
|
1060
|
+
this.channelName = e, this.options = t, this._channel = nt();
|
|
1058
1061
|
}
|
|
1059
1062
|
request(e, t, n, s = {}) {
|
|
1060
|
-
return typeof e == "string" && (e = [e]), Array.isArray(t) &&
|
|
1063
|
+
return typeof e == "string" && (e = [e]), Array.isArray(t) && pe(e) && (s = n, n = t, t = e, e = []), this._channel.invoke(this.channelName, t, e, n);
|
|
1061
1064
|
}
|
|
1062
1065
|
doImportModule(e, t) {
|
|
1063
1066
|
return this._channel.import(e, this.channelName);
|
|
1064
1067
|
}
|
|
1065
|
-
},
|
|
1068
|
+
}, rt = class {
|
|
1066
1069
|
channel;
|
|
1067
1070
|
options;
|
|
1068
1071
|
_unified;
|
|
@@ -1074,31 +1077,31 @@
|
|
|
1074
1077
|
}), w.name = e, w.instance = this;
|
|
1075
1078
|
}
|
|
1076
1079
|
createRemoteChannel(e, t = {}, n) {
|
|
1077
|
-
return n && (this._unified.attach(n, { targetChannel: e }), this.broadcasts[e] = n), Promise.resolve(new
|
|
1080
|
+
return n && (this._unified.attach(n, { targetChannel: e }), this.broadcasts[e] = n), Promise.resolve(new st(e, t));
|
|
1078
1081
|
}
|
|
1079
1082
|
getChannel() {
|
|
1080
1083
|
return this.channel;
|
|
1081
1084
|
}
|
|
1082
1085
|
request(e, t, n, s = {}, r = "worker") {
|
|
1083
|
-
return typeof e == "string" && (e = [e]), Array.isArray(t) &&
|
|
1086
|
+
return typeof e == "string" && (e = [e]), Array.isArray(t) && pe(e) && (r = s, s = n, n = t, t = e, e = []), this._unified.invoke(r, t, e, n);
|
|
1084
1087
|
}
|
|
1085
1088
|
resolveResponse(e, t) {
|
|
1086
1089
|
return Promise.resolve(t);
|
|
1087
1090
|
}
|
|
1088
1091
|
async handleAndResponse(e, t, n) {
|
|
1089
|
-
const s = await
|
|
1092
|
+
const s = await ut(e, t, this.channel);
|
|
1090
1093
|
s && n?.(s.response, s.transfer);
|
|
1091
1094
|
}
|
|
1092
1095
|
close() {
|
|
1093
1096
|
this._unified.close();
|
|
1094
1097
|
}
|
|
1095
1098
|
};
|
|
1096
|
-
const
|
|
1099
|
+
const ot = (e = "$host$") => {
|
|
1097
1100
|
if (w?.instance && e === "$host$") return w.instance;
|
|
1098
1101
|
if (K.has(e)) return K.get(e) ?? null;
|
|
1099
|
-
const t = new
|
|
1102
|
+
const t = new rt(e);
|
|
1100
1103
|
return e === "$host$" && (w.name = e, w.instance = t), K.set(e, t), t;
|
|
1101
|
-
},
|
|
1104
|
+
}, _e = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap(), ye = /* @__PURE__ */ new WeakMap(), it = (e, t = w?.name, n) => typeof e == "object" && e != null || typeof e == "function" && e != null ? V.has(e) ? V.get(e) : _e.has(e) ? _e.get(e) : $(e) || n?.includes?.(e) || t == w?.name ? e : {
|
|
1102
1105
|
$isDescriptor: !0,
|
|
1103
1106
|
path: E.get(e) ?? (() => {
|
|
1104
1107
|
const s = [d()];
|
|
@@ -1111,7 +1114,7 @@
|
|
|
1111
1114
|
enumerable: !0,
|
|
1112
1115
|
configurable: !0,
|
|
1113
1116
|
argumentCount: e instanceof Function ? e.length : -1
|
|
1114
|
-
} : x(e) ? e : null,
|
|
1117
|
+
} : x(e) ? e : null, at = Symbol.for("@requestHandler"), D = Symbol.for("@descriptor"), X = (e) => x(e) || e?.[D] ? e : e?.$isDescriptor ? Ze(e, async () => {}) : $(e) ? e : null, L = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new WeakMap(), j = (e, t) => {
|
|
1115
1118
|
if (t != null && !Array.isArray(t) && (t = [t]), t == null || t?.length < 1) return e;
|
|
1116
1119
|
const n = e?.[D] ?? (e?.$isDescriptor ? e : null);
|
|
1117
1120
|
if (n && n?.owner == w?.name && (e = R(n?.path) ?? e), C(e)) return e;
|
|
@@ -1126,18 +1129,18 @@
|
|
|
1126
1129
|
if (n && n?.owner == w?.name && (t = R(n?.path) ?? t), e != null && !Array.isArray(e) && (e = [e]), e == null || e?.length < 1) return null;
|
|
1127
1130
|
const s = L?.get?.(e?.[0]) ?? null;
|
|
1128
1131
|
return e?.length > 1 ? j(s, e?.slice?.(1, -1))[e?.[e?.length - 1]] = t : L?.set?.(e?.[0], t), (typeof t == "object" || typeof t == "function") && E?.set?.(t, e), t;
|
|
1129
|
-
},
|
|
1132
|
+
}, ge = (e) => {
|
|
1130
1133
|
if (e != null && !Array.isArray(e) && (e = [e]), e == null || e?.length < 1) return !1;
|
|
1131
1134
|
return !(L?.get?.(e?.[0]) ?? null) && e?.length <= 1 ? (L?.delete?.(e?.[0]), !0) : !1;
|
|
1132
|
-
},
|
|
1135
|
+
}, ct = (e) => {
|
|
1133
1136
|
const t = e?.[D] ?? (e?.$isDescriptor ? e : null);
|
|
1134
1137
|
t && t?.owner == w?.name && (e = R(t?.path) ?? e);
|
|
1135
1138
|
const n = E?.get?.(e) ?? t?.path;
|
|
1136
|
-
return n == null || n?.length < 1 ? !1 : (
|
|
1137
|
-
},
|
|
1139
|
+
return n == null || n?.length < 1 ? !1 : (ge(n), (typeof e == "object" || typeof e == "function") && E?.delete?.(e), !0);
|
|
1140
|
+
}, lt = (e) => {
|
|
1138
1141
|
const t = e?.[D] ?? (e?.$isDescriptor ? e : null);
|
|
1139
1142
|
return (E?.get?.(e) ?? t?.path) == null;
|
|
1140
|
-
}, P = (e) => (typeof e == "object" || typeof e == "function") && e != null,
|
|
1143
|
+
}, P = (e) => (typeof e == "object" || typeof e == "function") && e != null, me = {
|
|
1141
1144
|
get: (e, t) => e?.[t],
|
|
1142
1145
|
set: (e, t, n) => (e[t] = n, !0),
|
|
1143
1146
|
has: (e, t) => t in e,
|
|
@@ -1151,8 +1154,8 @@
|
|
|
1151
1154
|
isExtensible: (e) => Object.isExtensible(e),
|
|
1152
1155
|
preventExtensions: (e) => Object.preventExtensions(e)
|
|
1153
1156
|
};
|
|
1154
|
-
function
|
|
1155
|
-
const { channel: r = "", sender: i = "", reflect: o =
|
|
1157
|
+
function we(e, t, n, s = {}) {
|
|
1158
|
+
const { channel: r = "", sender: i = "", reflect: o = me } = s, a = s.target ?? R(t), c = [];
|
|
1156
1159
|
let l = null, _ = t;
|
|
1157
1160
|
switch (String(e).toLowerCase()) {
|
|
1158
1161
|
case "import":
|
|
@@ -1200,7 +1203,7 @@
|
|
|
1200
1203
|
if (s.target) {
|
|
1201
1204
|
const f = t[t.length - 1];
|
|
1202
1205
|
l = o.deleteProperty?.(a, f) ?? delete a[f];
|
|
1203
|
-
} else l = t?.length > 0 ?
|
|
1206
|
+
} else l = t?.length > 0 ? ge(t) : ct(a), l && (_ = E.get(a) ?? []);
|
|
1204
1207
|
break;
|
|
1205
1208
|
case "has":
|
|
1206
1209
|
case h.HAS:
|
|
@@ -1239,11 +1242,11 @@
|
|
|
1239
1242
|
path: _
|
|
1240
1243
|
};
|
|
1241
1244
|
}
|
|
1242
|
-
async function
|
|
1245
|
+
async function be(e, t, n, s, r, i, o) {
|
|
1243
1246
|
const a = await i, c = z(a) && o.includes(a) || x(a);
|
|
1244
1247
|
let l = r;
|
|
1245
|
-
!c && t !== "get" && t !== h.GET && (typeof a == "object" || typeof a == "function") && (
|
|
1246
|
-
const _ = R(l), f = t === "get" || t === h.GET ? l?.at(-1) : void 0, b = R(r), N = k(a, (
|
|
1248
|
+
!c && t !== "get" && t !== h.GET && (typeof a == "object" || typeof a == "function") && (lt(a) ? (l = [d()], U(l, a)) : l = E.get(a) ?? []);
|
|
1249
|
+
const _ = R(l), f = t === "get" || t === h.GET ? l?.at(-1) : void 0, b = R(r), N = k(a, (Ot) => it(Ot, n, o)) ?? a;
|
|
1247
1250
|
return {
|
|
1248
1251
|
response: {
|
|
1249
1252
|
channel: s,
|
|
@@ -1273,17 +1276,17 @@
|
|
|
1273
1276
|
transfer: o
|
|
1274
1277
|
};
|
|
1275
1278
|
}
|
|
1276
|
-
async function
|
|
1279
|
+
async function ut(e, t, n, s) {
|
|
1277
1280
|
const { channel: r, sender: i, path: o, action: a, args: c } = e;
|
|
1278
1281
|
if (r !== n) return null;
|
|
1279
|
-
const { result: l, toTransfer: _, path: f } =
|
|
1282
|
+
const { result: l, toTransfer: _, path: f } = we(a, o, c, {
|
|
1280
1283
|
channel: r,
|
|
1281
1284
|
sender: i,
|
|
1282
1285
|
...s
|
|
1283
1286
|
});
|
|
1284
|
-
return
|
|
1287
|
+
return be(t, a, n, i, f, l, _);
|
|
1285
1288
|
}
|
|
1286
|
-
var
|
|
1289
|
+
var dt = class {
|
|
1287
1290
|
_name;
|
|
1288
1291
|
_transportType;
|
|
1289
1292
|
_id = d();
|
|
@@ -1318,7 +1321,7 @@
|
|
|
1318
1321
|
}, this._setupSubscriptions();
|
|
1319
1322
|
}
|
|
1320
1323
|
subscribe(e, t) {
|
|
1321
|
-
return (t ?
|
|
1324
|
+
return (t ? ze((n) => n.sender === t)(this._inbound) : this._inbound).subscribe(typeof e == "function" ? { next: e } : e);
|
|
1322
1325
|
}
|
|
1323
1326
|
next(e) {
|
|
1324
1327
|
if (this._state !== "connected") {
|
|
@@ -1448,14 +1451,14 @@
|
|
|
1448
1451
|
connectedChannels: new Set(this._connectedPeers.keys())
|
|
1449
1452
|
};
|
|
1450
1453
|
}
|
|
1451
|
-
},
|
|
1454
|
+
}, ft = class F {
|
|
1452
1455
|
_connections = /* @__PURE__ */ new Map();
|
|
1453
1456
|
static _instance = null;
|
|
1454
1457
|
static getInstance() {
|
|
1455
1458
|
return F._instance || (F._instance = new F()), F._instance;
|
|
1456
1459
|
}
|
|
1457
1460
|
getOrCreate(t, n = "internal", s = {}) {
|
|
1458
|
-
return this._connections.has(t) || this._connections.set(t, new
|
|
1461
|
+
return this._connections.has(t) || this._connections.set(t, new dt(t, n, s)), this._connections.get(t);
|
|
1459
1462
|
}
|
|
1460
1463
|
get(t) {
|
|
1461
1464
|
return this._connections.get(t);
|
|
@@ -1476,14 +1479,14 @@
|
|
|
1476
1479
|
return [...this._connections.keys()];
|
|
1477
1480
|
}
|
|
1478
1481
|
};
|
|
1479
|
-
const
|
|
1482
|
+
const Ce = () => ft.getInstance(), pt = (e, t, n) => Ce().getOrCreate(e, t, n), _t = "uniform_channels", yt = 1, u = {
|
|
1480
1483
|
MESSAGES: "messages",
|
|
1481
1484
|
MAILBOX: "mailbox",
|
|
1482
1485
|
PENDING: "pending",
|
|
1483
1486
|
EXCHANGE: "exchange",
|
|
1484
1487
|
TRANSACTIONS: "transactions"
|
|
1485
1488
|
};
|
|
1486
|
-
var
|
|
1489
|
+
var gt = class {
|
|
1487
1490
|
_db = null;
|
|
1488
1491
|
_isOpen = !1;
|
|
1489
1492
|
_openPromise = null;
|
|
@@ -1495,7 +1498,7 @@
|
|
|
1495
1498
|
}
|
|
1496
1499
|
async open() {
|
|
1497
1500
|
return this._db && this._isOpen ? this._db : this._openPromise ? this._openPromise : (this._openPromise = new Promise((e, t) => {
|
|
1498
|
-
const n = indexedDB.open(
|
|
1501
|
+
const n = indexedDB.open(_t, yt);
|
|
1499
1502
|
n.onerror = () => {
|
|
1500
1503
|
this._openPromise = null, t(/* @__PURE__ */ new Error("Failed to open IndexedDB"));
|
|
1501
1504
|
}, n.onsuccess = () => {
|
|
@@ -1775,7 +1778,7 @@
|
|
|
1775
1778
|
return e.owner === this._channelName || e.sharedWith.includes("*") ? !0 : e.sharedWith.includes(this._channelName);
|
|
1776
1779
|
}
|
|
1777
1780
|
async beginTransaction() {
|
|
1778
|
-
return new
|
|
1781
|
+
return new mt(this);
|
|
1779
1782
|
}
|
|
1780
1783
|
async executeTransaction(e) {
|
|
1781
1784
|
const t = await this.open(), n = new Set(e.map((s) => s.store));
|
|
@@ -1835,7 +1838,7 @@
|
|
|
1835
1838
|
}, r.oncomplete = () => n(a), r.onerror = () => s(/* @__PURE__ */ new Error("Failed to cleanup expired"));
|
|
1836
1839
|
});
|
|
1837
1840
|
}
|
|
1838
|
-
},
|
|
1841
|
+
}, mt = class {
|
|
1839
1842
|
_storage;
|
|
1840
1843
|
_operations = [];
|
|
1841
1844
|
_isCommitted = !1;
|
|
@@ -1890,22 +1893,22 @@
|
|
|
1890
1893
|
}
|
|
1891
1894
|
};
|
|
1892
1895
|
const J = /* @__PURE__ */ new Map();
|
|
1893
|
-
function
|
|
1894
|
-
return J.has(e) || J.set(e, new
|
|
1896
|
+
function wt(e) {
|
|
1897
|
+
return J.has(e) || J.set(e, new gt(e)), J.get(e);
|
|
1895
1898
|
}
|
|
1896
|
-
const
|
|
1897
|
-
var
|
|
1899
|
+
const Se = de(), bt = Se.length > 0 ? new URL("../transport/Worker.ts", Se) : "";
|
|
1900
|
+
var xe = class {
|
|
1898
1901
|
_channel;
|
|
1899
1902
|
_context;
|
|
1900
1903
|
_options;
|
|
1901
1904
|
_connection;
|
|
1902
1905
|
_storage;
|
|
1903
1906
|
constructor(e, t, n = {}) {
|
|
1904
|
-
this._channel = e, this._context = t, this._options = n, this._connection =
|
|
1907
|
+
this._channel = e, this._context = t, this._options = n, this._connection = pt(e), this._storage = wt(e);
|
|
1905
1908
|
}
|
|
1906
1909
|
async request(e, t, n, s = {}) {
|
|
1907
1910
|
let r = typeof e == "string" ? [e] : e, i = t, o = n;
|
|
1908
|
-
return Array.isArray(t) &&
|
|
1911
|
+
return Array.isArray(t) && ke(e) && (s = n, o = t, i = e, r = []), this._context.getHost()?.request(r, i, o, s, this._channel);
|
|
1909
1912
|
}
|
|
1910
1913
|
async doImportModule(e, t = {}) {
|
|
1911
1914
|
return this.request([], h.IMPORT, [e], t);
|
|
@@ -1946,14 +1949,14 @@
|
|
|
1946
1949
|
return this._unified.__getPrivate("_transports");
|
|
1947
1950
|
}
|
|
1948
1951
|
constructor(e, t, n = {}) {
|
|
1949
|
-
this._channel = e, this._context = t, this._options = n, this._connection =
|
|
1952
|
+
this._channel = e, this._context = t, this._options = n, this._connection = Ce().getOrCreate(e, "internal", n), this._unified = new he({
|
|
1950
1953
|
name: e,
|
|
1951
1954
|
autoListen: !1,
|
|
1952
1955
|
timeout: n?.timeout
|
|
1953
1956
|
});
|
|
1954
1957
|
}
|
|
1955
1958
|
createRemoteChannel(e, t = {}, n) {
|
|
1956
|
-
const s =
|
|
1959
|
+
const s = St(n ?? this._context.$createOrUseExistingRemote(e, t, n ?? null)?.messageChannel?.port1), r = Pe(s?.target ?? s);
|
|
1957
1960
|
return this._unified.listen(s?.target, { targetChannel: e }), s && (this._broadcasts?.set?.(e, s), r === "self" && typeof postMessage > "u" || this._unified.connect(s, { targetChannel: e }), this._context.$registerConnection({
|
|
1958
1961
|
localChannel: this._channel,
|
|
1959
1962
|
remoteChannel: e,
|
|
@@ -1963,7 +1966,7 @@
|
|
|
1963
1966
|
}), this.notifyChannel(e, {
|
|
1964
1967
|
contextId: this._context.id,
|
|
1965
1968
|
contextName: this._context.hostName
|
|
1966
|
-
}, "connect")), new
|
|
1969
|
+
}, "connect")), new xe(e, this._context, t);
|
|
1967
1970
|
}
|
|
1968
1971
|
getChannel() {
|
|
1969
1972
|
return this._channel;
|
|
@@ -1973,7 +1976,7 @@
|
|
|
1973
1976
|
}
|
|
1974
1977
|
request(e, t, n, s = {}, r = "worker") {
|
|
1975
1978
|
let i = typeof e == "string" ? [e] : e, o = n;
|
|
1976
|
-
return Array.isArray(t) &&
|
|
1979
|
+
return Array.isArray(t) && ke(e) && (r = s, s = n, o = t, t = e, i = []), this._unified.invoke(r, t, i ?? [], Array.isArray(o) ? o : [o]);
|
|
1977
1980
|
}
|
|
1978
1981
|
resolveResponse(e, t) {
|
|
1979
1982
|
this._forResolves.get(e)?.resolve?.(t);
|
|
@@ -1997,7 +2000,7 @@
|
|
|
1997
2000
|
get unified() {
|
|
1998
2001
|
return this._unified;
|
|
1999
2002
|
}
|
|
2000
|
-
},
|
|
2003
|
+
}, Ct = class {
|
|
2001
2004
|
_options;
|
|
2002
2005
|
_id = d();
|
|
2003
2006
|
_hostName;
|
|
@@ -2008,7 +2011,7 @@
|
|
|
2008
2011
|
_remoteChannels = /* @__PURE__ */ new Map();
|
|
2009
2012
|
_deferredChannels = /* @__PURE__ */ new Map();
|
|
2010
2013
|
_connectionEvents = new y({ bufferSize: 200 });
|
|
2011
|
-
_connectionRegistry = new
|
|
2014
|
+
_connectionRegistry = new ue(() => d(), (e) => this._emitConnectionEvent(e));
|
|
2012
2015
|
_closed = !1;
|
|
2013
2016
|
_globalSelf = null;
|
|
2014
2017
|
constructor(e = {}) {
|
|
@@ -2117,7 +2120,7 @@
|
|
|
2117
2120
|
return this._endpoints.has(e) ? this._endpoints.get(e) : this._deferredChannels.has(e) ? this.initDeferred(e) : null;
|
|
2118
2121
|
}
|
|
2119
2122
|
async addWorker(e, t, n = {}) {
|
|
2120
|
-
const s =
|
|
2123
|
+
const s = ve(t);
|
|
2121
2124
|
if (!s) throw new Error(`Failed to create worker for channel: ${e}`);
|
|
2122
2125
|
const r = new v(e, this, {
|
|
2123
2126
|
...this._options.defaultOptions,
|
|
@@ -2258,10 +2261,10 @@
|
|
|
2258
2261
|
$createOrUseExistingRemote(e, t = {}, n) {
|
|
2259
2262
|
if (e == null || n) return null;
|
|
2260
2263
|
if (this._remoteChannels.has(e)) return this._remoteChannels.get(e);
|
|
2261
|
-
const s = new MessageChannel(), r =
|
|
2262
|
-
const a =
|
|
2264
|
+
const s = new MessageChannel(), r = oe(new Promise((o) => {
|
|
2265
|
+
const a = ve(bt);
|
|
2263
2266
|
a?.addEventListener?.("message", (c) => {
|
|
2264
|
-
c.data.type === "channelCreated" && (s.port1?.start?.(), o(new
|
|
2267
|
+
c.data.type === "channelCreated" && (s.port1?.start?.(), o(new xe(c.data.channel, this, t)));
|
|
2265
2268
|
}), a?.postMessage?.({
|
|
2266
2269
|
type: "createChannel",
|
|
2267
2270
|
channel: e,
|
|
@@ -2346,13 +2349,13 @@
|
|
|
2346
2349
|
});
|
|
2347
2350
|
}
|
|
2348
2351
|
};
|
|
2349
|
-
function
|
|
2352
|
+
function ke(e) {
|
|
2350
2353
|
return [...Object.values(h)].includes(e);
|
|
2351
2354
|
}
|
|
2352
|
-
function
|
|
2355
|
+
function St(e) {
|
|
2353
2356
|
if (!e) return null;
|
|
2354
|
-
if (
|
|
2355
|
-
const t = e, n =
|
|
2357
|
+
if (Ee(e)) return e;
|
|
2358
|
+
const t = e, n = Pe(t);
|
|
2356
2359
|
return {
|
|
2357
2360
|
target: t,
|
|
2358
2361
|
targetChannel: "unknown",
|
|
@@ -2373,14 +2376,14 @@
|
|
|
2373
2376
|
close: t.close?.bind(t)
|
|
2374
2377
|
};
|
|
2375
2378
|
}
|
|
2376
|
-
function
|
|
2379
|
+
function Ee(e) {
|
|
2377
2380
|
return !!e && typeof e == "object" && "target" in e && typeof e.postMessage == "function";
|
|
2378
2381
|
}
|
|
2379
|
-
function
|
|
2380
|
-
const t =
|
|
2382
|
+
function Pe(e) {
|
|
2383
|
+
const t = Ee(e) ? e.target : e;
|
|
2381
2384
|
return t ? t === "chrome-runtime" ? "chrome-runtime" : t === "chrome-tabs" ? "chrome-tabs" : t === "chrome-port" ? "chrome-port" : t === "chrome-external" ? "chrome-external" : typeof MessagePort < "u" && t instanceof MessagePort ? "message-port" : typeof BroadcastChannel < "u" && t instanceof BroadcastChannel ? "broadcast" : typeof Worker < "u" && t instanceof Worker ? "worker" : typeof WebSocket < "u" && t instanceof WebSocket ? "websocket" : typeof chrome < "u" && typeof t == "object" && t && typeof t.postMessage == "function" && t.onMessage?.addListener ? "chrome-port" : typeof self < "u" && t === self ? "self" : "internal" : "internal";
|
|
2382
2385
|
}
|
|
2383
|
-
function
|
|
2386
|
+
function ve(e) {
|
|
2384
2387
|
if (e instanceof Worker) return e;
|
|
2385
2388
|
if (e instanceof URL) return new Worker(e.href, { type: "module" });
|
|
2386
2389
|
if (typeof e == "function") try {
|
|
@@ -2388,14 +2391,14 @@
|
|
|
2388
2391
|
} catch {
|
|
2389
2392
|
return e({ type: "module" });
|
|
2390
2393
|
}
|
|
2391
|
-
return typeof e == "string" ? e.startsWith("/") ? new Worker(
|
|
2394
|
+
return typeof e == "string" ? e.startsWith("/") ? new Worker(fe(e.replace(/^\//, "./")), { type: "module" }) : URL.canParse(e) || e.startsWith("./") ? new Worker(fe(e), { type: "module" }) : new Worker(URL.createObjectURL(new Blob([e], { type: "application/javascript" })), { type: "module" }) : e instanceof Blob || e instanceof File ? new Worker(URL.createObjectURL(e), { type: "module" }) : e ?? (typeof self < "u" ? self : null);
|
|
2392
2395
|
}
|
|
2393
|
-
const
|
|
2394
|
-
function
|
|
2395
|
-
const t = new
|
|
2396
|
-
return e.name &&
|
|
2396
|
+
const xt = /* @__PURE__ */ new Map();
|
|
2397
|
+
function kt(e = {}) {
|
|
2398
|
+
const t = new Ct(e);
|
|
2399
|
+
return e.name && xt.set(e.name, t), t;
|
|
2397
2400
|
}
|
|
2398
|
-
var
|
|
2401
|
+
var Et = class {
|
|
2399
2402
|
_context;
|
|
2400
2403
|
_config;
|
|
2401
2404
|
_subscriptions = [];
|
|
@@ -2414,7 +2417,7 @@
|
|
|
2414
2417
|
defaultOptions: e.defaultOptions ?? {},
|
|
2415
2418
|
isolatedStorage: e.isolatedStorage ?? !1,
|
|
2416
2419
|
...e
|
|
2417
|
-
}, this._context =
|
|
2420
|
+
}, this._context = kt({
|
|
2418
2421
|
name: this._config.name,
|
|
2419
2422
|
useGlobalSelf: !0,
|
|
2420
2423
|
defaultOptions: e.defaultOptions
|
|
@@ -2584,10 +2587,10 @@
|
|
|
2584
2587
|
}
|
|
2585
2588
|
};
|
|
2586
2589
|
let Q = null;
|
|
2587
|
-
function
|
|
2588
|
-
return Q || (Q = new
|
|
2590
|
+
function Pt(e) {
|
|
2591
|
+
return Q || (Q = new Et(e)), Q;
|
|
2589
2592
|
}
|
|
2590
|
-
|
|
2593
|
+
Pt({ name: "worker" });
|
|
2591
2594
|
var W = class {
|
|
2592
2595
|
_channelName;
|
|
2593
2596
|
_config;
|
|
@@ -2715,7 +2718,7 @@
|
|
|
2715
2718
|
transfer: () => n.port2
|
|
2716
2719
|
};
|
|
2717
2720
|
}
|
|
2718
|
-
var
|
|
2721
|
+
var Te = class {
|
|
2719
2722
|
_target;
|
|
2720
2723
|
_channelName;
|
|
2721
2724
|
_config;
|
|
@@ -2768,21 +2771,21 @@
|
|
|
2768
2771
|
return this._transport;
|
|
2769
2772
|
}
|
|
2770
2773
|
};
|
|
2771
|
-
|
|
2772
|
-
const
|
|
2773
|
-
const n =
|
|
2774
|
+
Te.listen;
|
|
2775
|
+
const Re = (e, t = "worker") => {
|
|
2776
|
+
const n = ot(t ?? "worker");
|
|
2774
2777
|
return Object.keys(e).forEach((s) => {
|
|
2775
2778
|
e[s];
|
|
2776
2779
|
}), n;
|
|
2777
2780
|
};
|
|
2778
|
-
var
|
|
2781
|
+
var At = Ne({
|
|
2779
2782
|
getDirHandle: () => O,
|
|
2780
2783
|
getFileSystemRoot: () => A,
|
|
2781
2784
|
handlers: () => T,
|
|
2782
2785
|
normalizePath: () => I,
|
|
2783
|
-
resolveFileSystemHandle: () =>
|
|
2784
|
-
}), B, q, A, I,
|
|
2785
|
-
B = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map(), A = async (e = "") => e && B.has(e) ? B.get(e) : await navigator.storage.getDirectory(), I = (e) => e?.trim?.()?.replace(/\/+/g, "/") || "/",
|
|
2786
|
+
resolveFileSystemHandle: () => Ae
|
|
2787
|
+
}), B, q, A, I, Ae, O, T, Ie, M, Oe = De((() => {
|
|
2788
|
+
B = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map(), A = async (e = "") => e && B.has(e) ? B.get(e) : await navigator.storage.getDirectory(), I = (e) => e?.trim?.()?.replace(/\/+/g, "/") || "/", Ae = async (e, t, n = !1) => {
|
|
2786
2789
|
const s = I(t).split("/").filter((i) => i && i !== ".");
|
|
2787
2790
|
let r = e;
|
|
2788
2791
|
for (let i = 0; i < s.length; i++) {
|
|
@@ -2894,9 +2897,9 @@
|
|
|
2894
2897
|
return console.warn("Worker copy error:", n), !1;
|
|
2895
2898
|
}
|
|
2896
2899
|
}
|
|
2897
|
-
},
|
|
2900
|
+
}, Ie = "opfs-sw-bridge-v1", M = null;
|
|
2898
2901
|
try {
|
|
2899
|
-
typeof BroadcastChannel < "u" && (M = new BroadcastChannel(
|
|
2902
|
+
typeof BroadcastChannel < "u" && (M = new BroadcastChannel(Ie), M.onmessage = async (e) => {
|
|
2900
2903
|
const t = e?.data || {};
|
|
2901
2904
|
if (!t || typeof t != "object" || t?.type !== "opfs-sw-request") return;
|
|
2902
2905
|
const n = String(t?.requestId || ""), s = String(t?.action || ""), r = t?.payload;
|
|
@@ -2952,29 +2955,29 @@
|
|
|
2952
2955
|
});
|
|
2953
2956
|
});
|
|
2954
2957
|
}));
|
|
2955
|
-
|
|
2956
|
-
const
|
|
2958
|
+
Oe(), T && Re(T);
|
|
2959
|
+
const It = async (e) => {
|
|
2957
2960
|
try {
|
|
2958
2961
|
if (e.type === "batch") {
|
|
2959
2962
|
const t = [];
|
|
2960
2963
|
for (const n of e.payload) {
|
|
2961
|
-
const s = await
|
|
2964
|
+
const s = await Me(n);
|
|
2962
2965
|
t.push(s);
|
|
2963
2966
|
}
|
|
2964
2967
|
return t;
|
|
2965
|
-
} else return await
|
|
2968
|
+
} else return await Me(e);
|
|
2966
2969
|
} catch (t) {
|
|
2967
2970
|
throw console.error("[OPFS Worker] Message processing error:", t), t;
|
|
2968
2971
|
}
|
|
2969
|
-
},
|
|
2972
|
+
}, Me = async (e) => {
|
|
2970
2973
|
const t = T[e.type];
|
|
2971
2974
|
if (!t) throw new Error(`Unknown message type: ${e.type}`);
|
|
2972
2975
|
return await t(e.payload);
|
|
2973
2976
|
};
|
|
2974
|
-
globalThis.processMessage =
|
|
2977
|
+
globalThis.processMessage = It, (async () => {
|
|
2975
2978
|
try {
|
|
2976
|
-
const e = (await Promise.resolve().then(() => (
|
|
2977
|
-
e &&
|
|
2979
|
+
const e = (await Promise.resolve().then(() => (Oe(), At))).handlers;
|
|
2980
|
+
e && Re(e), console.log("[OPFS Worker] Initialized with handlers:", Object.keys(e || {}));
|
|
2978
2981
|
} catch (e) {
|
|
2979
2982
|
console.error("[OPFS Worker] Failed to initialize:", e);
|
|
2980
2983
|
}
|