@banou/ripple 0.0.14 → 0.0.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@banou/ripple",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,7 +12,8 @@
12
12
  ],
13
13
  "fkn": {
14
14
  "app": "fkn:app:1c7clnsv53zt7dr7q7rcbt455hxauykaxl4gibkuoao24dfmk2eqq",
15
- "signed": true
15
+ "signed": true,
16
+ "url": "https://torrent.fkn.app/"
16
17
  },
17
18
  "main": "index.js"
18
19
  }
package/sw.js CHANGED
@@ -8,8 +8,8 @@ const live = new Map()
8
8
  /* Stamped at build time. These are the dev defaults and must never reach production: a worker whose
9
9
  BUILD never changes is never reinstalled, so the update this feature announces would never fire. */
10
10
  const MODE = "cache" // @stamp:mode
11
- const BUILD = "f01b884a11dea6ef" // @stamp:build
12
- const MANIFEST = [["/api-Jq4OSTp1-BGG3ivUc.js","d303b2d405b3fa8c"],["/assets/empty-BvRk9kiK.js","e3b0c44298fc1c14"],["/assets/libtorrent-CnjRmD5O.js","ab4f7006e069c0dc"],["/assets/worker-cT83ESx9.js","df1a05bb0e5abd0c"],["/build-JdIfVZn7.js","68868ae23db91aa0"],["/remote-U0iHKFtw.js","1d57209b4c2f6a6f"]] // @stamp:manifest
11
+ const BUILD = "0ca8dcf665286c04" // @stamp:build
12
+ const MANIFEST = [["/api-DIgTslNb-BSzu7eku.js","073ef0eb99057485"],["/api-d5i206BT.js","591582894701a02e"],["/assets/empty-BvRk9kiK.js","e3b0c44298fc1c14"],["/assets/libtorrent-CnjRmD5O.js","ab4f7006e069c0dc"],["/assets/worker-1qEVNJrZ.js","477458982f6cbe54"],["/build-JdIfVZn7.js","68868ae23db91aa0"],["/remote-U0iHKFtw.js","1d57209b4c2f6a6f"]] // @stamp:manifest
13
13
 
14
14
  const CACHE = 'ripple-assets-' + BUILD
15
15
 
@@ -1,338 +0,0 @@
1
- import { a as e } from "./build-JdIfVZn7.js";
2
- //#region \0rolldown/runtime.js
3
- var t = Object.create, n = Object.defineProperty, r = Object.getOwnPropertyDescriptor, i = Object.getOwnPropertyNames, a = Object.getPrototypeOf, o = Object.prototype.hasOwnProperty, s = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), c = (e, t) => {
4
- let r = {};
5
- for (var i in e) n(r, i, {
6
- get: e[i],
7
- enumerable: !0
8
- });
9
- return t || n(r, Symbol.toStringTag, { value: "Module" }), r;
10
- }, l = (e, t, a, s) => {
11
- if (t && typeof t == "object" || typeof t == "function") for (var c = i(t), l = 0, u = c.length, d; l < u; l++) d = c[l], !o.call(e, d) && d !== a && n(e, d, {
12
- get: ((e) => t[e]).bind(null, d),
13
- enumerable: !(s = r(t, d)) || s.enumerable
14
- });
15
- return e;
16
- }, u = (e, r, i) => (i = e == null ? {} : t(a(e)), l(r || !e || !e.__esModule || !o.call(e, "default") ? n(i, "default", {
17
- value: e,
18
- enumerable: !0
19
- }) : i, e)), d = Object.defineProperty, f = (e, t) => {
20
- let n = {};
21
- for (var r in e) d(n, r, {
22
- get: e[r],
23
- enumerable: !0
24
- });
25
- return t || d(n, Symbol.toStringTag, { value: "Module" }), n;
26
- }, ee = /* @__PURE__ */ c({
27
- a: () => Q,
28
- i: () => Y,
29
- n: () => Ce,
30
- o: () => J,
31
- r: () => $,
32
- t: () => Z
33
- }), te = 1e4, ne = 16, p = (e) => {
34
- let t;
35
- try {
36
- t = e.contentWindow;
37
- } catch {
38
- return !0;
39
- }
40
- if (!t) return !0;
41
- try {
42
- let e = t.location.href;
43
- return e !== "" && e !== "about:blank";
44
- } catch {
45
- return !0;
46
- }
47
- }, m = (e, t = te) => new Promise((n) => {
48
- if (p(e)) return n();
49
- let r = () => {
50
- clearInterval(i), clearTimeout(a), e.removeEventListener("load", r), n();
51
- }, i = setInterval(() => {
52
- p(e) && r();
53
- }, ne), a = setTimeout(r, t);
54
- e.addEventListener("load", r);
55
- }), re = 32, ie = 8, ae = 120, h = typeof CSS < "u" && CSS.supports("clip-path", "path('M0 0H1V1H0Z')"), g = typeof CSS < "u" && CSS.supports("clip-path", "polygon(nonzero, 0px 0px, 1px 0px, 1px 1px)"), oe = (e) => {
56
- let t = e.style;
57
- t.setProperty("display", "block", "important"), t.setProperty("position", "fixed", "important"), t.setProperty("top", "0", "important"), t.setProperty("left", "0", "important"), t.setProperty("width", "100%", "important"), t.setProperty("height", "100%", "important"), t.setProperty("border", "none", "important"), t.setProperty("padding", "0", "important"), t.setProperty("box-sizing", "border-box", "important"), t.setProperty("clip-path", "inset(100%)", "important"), t.setProperty("background", "transparent"), t.setProperty("color-scheme", "normal"), t.setProperty("z-index", "2147483647"), e.setAttribute("title", "FKN");
58
- }, se = ({ x: e, y: t, width: n, height: r, radius: i }) => {
59
- if (!i) return `M${e} ${t}h${n}v${r}h${-n}Z`;
60
- let a = Math.min(n, r) / 2, [o, s, c, l] = i.map((e) => Math.max(0, Math.min(e, a)));
61
- return `M${e + o} ${t}h${n - o - s}a${s} ${s} 0 0 1 ${s} ${s}v${r - s - c}a${c} ${c} 0 0 1 ${-c} ${c}h${-(n - c - l)}a${l} ${l} 0 0 1 ${-l} ${-l}v${-(r - l - o)}a${o} ${o} 0 0 1 ${o} ${-o}Z`;
62
- }, ce = () => h && g, _ = ({ x: e, y: t, width: n, height: r }) => [
63
- [e, t],
64
- [e + n, t],
65
- [e + n, t + r],
66
- [e, t + r],
67
- [e, t]
68
- ], le = (e) => {
69
- let t = e[0];
70
- if (!t) return [];
71
- let n = _(t)[0], r = [];
72
- return e.forEach((t, i) => {
73
- r.push(..._(t)), i > 0 && i < e.length - 1 && r.push(n);
74
- }), r;
75
- }, v = (e) => `polygon(nonzero, ${le(e).map(([e, t]) => `${e}px ${t}px`).join(", ")})`, ue = ({ x: e, y: t, width: n, height: r, radius: i }, a) => {
76
- let o = `${t}px ${a.width - e - n}px ${a.height - t - r}px ${e}px`;
77
- return i ? `inset(${o} round ${i.map((e) => `${e}px`).join(" ")})` : `inset(${o})`;
78
- }, y = (e, t, n) => {
79
- if (t) return "none";
80
- if (e.length === 0) return "inset(100%)";
81
- let r = e.length === 1 ? e[0] : void 0;
82
- return r ? ue(r, n) : g && e.length <= 5 && !e.some((e) => e.radius) ? v(e) : `path('${e.map(se).join("")}')`;
83
- }, de = (e) => {
84
- if (e.length < 2) return null;
85
- let t = Math.min(...e.map((e) => e.x)), n = Math.min(...e.map((e) => e.y));
86
- return {
87
- x: t,
88
- y: n,
89
- width: Math.max(...e.map((e) => e.x + e.width)) - t,
90
- height: Math.max(...e.map((e) => e.y + e.height)) - n
91
- };
92
- }, b = (e, t, n) => t >= e.x && t < e.x + e.width && n >= e.y && n < e.y + e.height, x = 16, S = (e, t, n) => t === 1 ? e * x : t === 2 ? e * n : e, C = (e, t, n) => {
93
- let r = getComputedStyle(e);
94
- return n !== 0 && /auto|scroll/.test(r.overflowY) && e.scrollHeight > e.clientHeight ? !0 : t !== 0 && /auto|scroll/.test(r.overflowX) && e.scrollWidth > e.clientWidth;
95
- }, fe = (e, t, n) => {
96
- for (let r = e; r; r = r.parentElement) if (C(r, t, n)) return r;
97
- return document.scrollingElement;
98
- }, w = null, T = null, E = (e) => ({
99
- width: e.offsetWidth || window.innerWidth,
100
- height: e.offsetHeight || window.innerHeight
101
- }), D = (e) => {
102
- if (!T || !w || !b(T, e.clientX, e.clientY)) return;
103
- let t = document.elementFromPoint(e.clientX, e.clientY);
104
- if (!t || t === w) return;
105
- let n = S(e.deltaX, e.deltaMode, window.innerWidth), r = S(e.deltaY, e.deltaMode, window.innerHeight), i = fe(t, n, r);
106
- i && (i.scrollBy({
107
- left: n,
108
- top: r,
109
- behavior: "instant"
110
- }), e.cancelable && e.preventDefault());
111
- }, pe = (e) => {
112
- let t = T !== null;
113
- T = e, t !== (e !== null) && (e ? window.addEventListener("wheel", D, {
114
- capture: !0,
115
- passive: !1
116
- }) : window.removeEventListener("wheel", D, { capture: !0 }));
117
- }, O = 0, k = (e) => {
118
- if (e === O) return;
119
- O = e;
120
- let t = document.documentElement.style;
121
- e > 0 ? (t.setProperty("margin-top", `${e}px`, "important"), t.setProperty("--fkn-inset-top", `${e}px`)) : (t.removeProperty("margin-top"), t.removeProperty("--fkn-inset-top"));
122
- }, A = (e, { modal: t, rects: n, inset: r }, i) => {
123
- if (k(r), !h) {
124
- let r = t || n.length > 0;
125
- e.style.setProperty("pointer-events", r ? "auto" : "none", "important"), e.style.setProperty("visibility", r ? "visible" : "hidden", "important");
126
- return;
127
- }
128
- let a = y(n, t, i), o = a === "none" || CSS.supports("clip-path", a) ? a : "inset(100%)";
129
- e.style.setProperty("clip-path", o, "important"), pe(t || o !== a ? null : de(n));
130
- }, j = (e) => {
131
- if (typeof e != "object" || !e) return 0;
132
- let { top: t } = e;
133
- return typeof t != "number" || !Number.isFinite(t) || t <= 0 ? 0 : Math.min(Math.round(t), ae);
134
- }, M = (e) => {
135
- if (Array.isArray(e) && e.length === 4 && e.every((e) => typeof e == "number" && Number.isFinite(e) && e >= 0)) return e.some((e) => e > 0) ? e : void 0;
136
- }, N = (e, t) => {
137
- if (typeof e != "object" || !e) return null;
138
- let { x: n, y: r, width: i, height: a } = e;
139
- if (![
140
- n,
141
- r,
142
- i,
143
- a
144
- ].every((e) => typeof e == "number" && Number.isFinite(e))) return null;
145
- let o = t.width, s = t.height, c = Math.max(0, Math.min(Math.round(n), o)), l = Math.max(0, Math.min(Math.round(r), s)), u = Math.max(c, Math.min(Math.round(n + i), o)), d = Math.max(l, Math.min(Math.round(r + a), s)), f = M(e.radius);
146
- return {
147
- x: c,
148
- y: l,
149
- width: u - c,
150
- height: d - l,
151
- ...f ? { radius: f } : {}
152
- };
153
- }, P = {
154
- "not-rendered": "this page is not painting it at all, so it or an ancestor is display:none, or the frame was moved out of the layout",
155
- clipped: "it is clipped away or positioned outside the viewport",
156
- "not-shown": "it is rendered but would not be seen, so either something is drawn over it, or it or an ancestor has opacity below 1, visibility:hidden, or a filter"
157
- }, F = (e) => Array.isArray(e) ? e.slice(0, ie).flatMap((e) => {
158
- if (typeof e != "object" || !e) return [];
159
- let { kind: t, cause: n, level: r } = e;
160
- return typeof t != "string" || t.length > 40 || typeof n != "string" || !(n in P) || r !== "full" && r !== "liveness" ? [] : [{
161
- kind: t,
162
- cause: n,
163
- level: r
164
- }];
165
- }) : [], I = /* @__PURE__ */ new Set(), L = (e) => {
166
- for (let { kind: t, cause: n, level: r } of e) I.has(t) || (I.add(t), console.error(`[FKN] The FKN ${JSON.stringify(t)} is not visible on this page: ${P[n]}. Nobody using this page can see or answer it.
167
- @fkn/lib draws its UI inside <iframe title="FKN"> and sets display, position, top, left, width, height, border, padding, box-sizing, clip-path and z-index on that element. Leave those as they are, then check for an ancestor with opacity, visibility, display or a clipping transform, and for an element stacked above it.` + (r === "liveness" ? "\nThis browser reports limited detail, so the cause above is a best guess." : "")));
168
- }, R = (e, t) => {
169
- if (typeof e != "object" || !e) return null;
170
- let n = e, r = (Array.isArray(n.rects) ? n.rects.slice(0, re) : []).map((e) => N(e, t)).filter((e) => e !== null && e.width > 0 && e.height > 0);
171
- return {
172
- modal: n.modal === !0,
173
- rects: r,
174
- hidden: F(n.hidden),
175
- inset: j(n.inset)
176
- };
177
- }, z = () => w !== null, B = null, V = null, H = () => {
178
- if (!w || B === null) return;
179
- let e = E(w), t = R(B, e);
180
- t && A(w, t, e);
181
- }, me = (e) => {
182
- typeof ResizeObserver > "u" || (V ??= new ResizeObserver(H), V.disconnect(), V.observe(e));
183
- }, he = (e) => {
184
- oe(e), A(e, {
185
- modal: !1,
186
- rects: [],
187
- hidden: [],
188
- inset: 0
189
- }, E(e)), w = e, me(e);
190
- }, ge = (e) => {
191
- if (!w) return;
192
- let t = E(w), n = R(e, t);
193
- n && (B = e, A(w, n, t), L(n.hidden));
194
- }, U = "https://fkn.app", W = typeof globalThis < "u" && globalThis.document ? globalThis.document : void 0, G = typeof globalThis < "u" && globalThis.crossOriginIsolated === !0, K = `${U}/api${G ? "?coi=1" : ""}`, _e = "fkn-api-port", ve = "fkn-api-port-ack", ye = 2e3, be = () => {
195
- if (!W || typeof window > "u" || window.parent === window) return Promise.resolve(void 0);
196
- let e;
197
- try {
198
- e = window.parent;
199
- } catch {
200
- return Promise.resolve(void 0);
201
- }
202
- let t = new MessageChannel();
203
- return new Promise((n) => {
204
- let r = (e) => {
205
- if (clearTimeout(a), t.port1.removeEventListener("message", i), !e) try {
206
- t.port1.close();
207
- } catch {}
208
- n(e);
209
- }, i = (e) => {
210
- e.data?.type === ve && r(t.port1);
211
- }, a = setTimeout(() => r(void 0), ye);
212
- t.port1.addEventListener("message", i), t.port1.start();
213
- try {
214
- e.postMessage({ type: _e }, U, [t.port2]);
215
- } catch {
216
- r(void 0);
217
- }
218
- });
219
- }, q, xe = () => {
220
- if (q || !W) return q;
221
- let e = W.querySelector(`iframe[src="${K}"]`);
222
- if (e) q = e;
223
- else {
224
- let e = W.createElement("iframe");
225
- G && e.setAttribute("allow", "cross-origin-isolated"), e.src = K, W.body.appendChild(e), q = e;
226
- }
227
- return he(q), q;
228
- }, J = (async () => {
229
- if (!W) return;
230
- let e = await be();
231
- if (e) return {
232
- receive: e,
233
- emit: e
234
- };
235
- let t = xe();
236
- if (!t) return;
237
- await m(t);
238
- let n = t.contentWindow;
239
- return n ? {
240
- receive: window,
241
- emit: n
242
- } : void 0;
243
- })(), Se = (e) => {
244
- let t, n = () => {}, r = new Promise((e) => {
245
- n = e;
246
- }), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), o = 0, s = 0;
247
- (async () => {
248
- for await (let r of e) {
249
- let e = (t?.epoch ?? 0) + 1;
250
- t = {
251
- remote: r,
252
- epoch: e
253
- }, e === 1 && n(r);
254
- let o = [...a];
255
- a.clear();
256
- let s = /* @__PURE__ */ Error("FKN: the broker was replaced while this call was pending; retry it");
257
- for (let e of o) try {
258
- e(s);
259
- } catch {}
260
- for (let t of [...i]) try {
261
- t(r, e);
262
- } catch {}
263
- }
264
- })().catch(() => {});
265
- let c = async (e, n) => {
266
- let i = t?.remote ?? await r;
267
- for (let t of e.slice(0, -1)) i = i[t];
268
- let c = i[e[e.length - 1] ?? ""];
269
- o = Date.now(), s += 1;
270
- let l = () => {}, u = new Promise((e, t) => {
271
- l = t;
272
- });
273
- a.add(l);
274
- try {
275
- return await Promise.race([Promise.resolve(c.apply(i, n)), u]);
276
- } finally {
277
- --s, a.delete(l), o = Date.now();
278
- }
279
- }, l = /* @__PURE__ */ new Map(), u = (e) => {
280
- let n = e.join("\0"), r = l.get(n);
281
- if (r) return r;
282
- let i = new Proxy(function() {}, {
283
- get: (n, r) => {
284
- if (typeof r != "string" || r === "then") return;
285
- let i = t;
286
- if (i) {
287
- let t = i.remote;
288
- for (let n of e) t = t?.[n];
289
- if (t?.[r] === void 0) return;
290
- }
291
- return u([...e, r]);
292
- },
293
- apply: (t, n, r) => c(e, r)
294
- });
295
- return l.set(n, i), i;
296
- };
297
- return {
298
- facade: u([]),
299
- first: r.then(() => {}),
300
- current: () => t,
301
- onEpoch: (e) => {
302
- if (i.add(e), t) try {
303
- e(t.remote, t.epoch);
304
- } catch {}
305
- return () => {
306
- i.delete(e);
307
- };
308
- },
309
- lastCall: () => o,
310
- inFlight: () => s
311
- };
312
- }, Ce = /* @__PURE__ */ f({
313
- apiPromise: () => Z,
314
- currentApiEpoch: () => $,
315
- hasTransport: () => Y,
316
- onApiEpoch: () => Q
317
- }), Y = typeof window < "u" || typeof self < "u", we = async () => {
318
- if (typeof window < "u") return J;
319
- if (typeof self < "u") return {
320
- receive: self,
321
- emit: self
322
- };
323
- }, X = Se({ async *[Symbol.asyncIterator]() {
324
- let t = await we();
325
- if (!t) {
326
- await new Promise(() => {});
327
- return;
328
- }
329
- yield* e({}, {
330
- key: "fkn-api",
331
- transport: t
332
- });
333
- } }), Z = X.first.then(() => X.facade), Q = X.onEpoch, $ = X.current;
334
- X.lastCall, X.inFlight, Q((e) => {
335
- z() && e.overlay.setHost(ge, { exactClips: ce() }).catch(() => {});
336
- });
337
- //#endregion
338
- export { Z as a, s as c, Y as i, c as l, J as n, ee as o, Q as r, f as s, $ as t, u };