@fkn/lib 0.9.5 → 0.9.8
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/account.cjs +1 -1
- package/account.js +1 -1
- package/{api-Bhz3iB9m.js → api-BU8zNmQI.js} +54 -17
- package/{api-BFqrrvzI.d.ts → api-BdGpFv2D.d.ts} +161 -77
- package/{api-C75xqLFy.cjs → api-C9Mh5v0z.cjs} +1 -1
- package/cloud/dgram.cjs +1 -1
- package/cloud/dgram.js +1 -1
- package/cloud/fetch.cjs +1 -0
- package/cloud/fetch.d.ts +2 -0
- package/cloud/fetch.js +2 -0
- package/cloud/fs.cjs +1 -1
- package/cloud/fs.js +1 -1
- package/cloud/net.cjs +1 -1
- package/cloud/net.d.ts +1 -1
- package/cloud/net.js +1 -1
- package/{cloud-Bzjnrblb.d.ts → cloud-C002L8iN.d.ts} +4 -9
- package/cloud-DZzkfeQi.cjs +1 -0
- package/cloud-OAvwgd_r.js +283 -0
- package/cloud.cjs +1 -1
- package/cloud.d.ts +3 -2
- package/cloud.js +4 -4
- package/{dgram-D4JF_XW7.js → dgram-DNbgOMoK.js} +1 -1
- package/{dgram-C2LmoO0A.cjs → dgram-ocGNUMpo.cjs} +1 -1
- package/dgram.cjs +1 -1
- package/dgram.d.ts +1 -1
- package/dgram.js +1 -1
- package/dns.cjs +1 -1
- package/dns.js +1 -1
- package/{extension-XC1EtYP6.d.ts → extension-B0qU5XuR.d.ts} +2 -2
- package/extension-DQZmGSuX.js +78 -0
- package/extension-DmKxv-br.cjs +1 -0
- package/extension.cjs +1 -1
- package/extension.d.ts +3 -3
- package/extension.js +3 -3
- package/fs/promises.cjs +1 -1
- package/fs/promises.js +1 -1
- package/{fs-Bghx-1Hy.js → fs-BYMGoFir.js} +2 -2
- package/{fs-BXcz3BjJ.cjs → fs-D-pDr8fW.cjs} +1 -1
- package/fs.cjs +1 -1
- package/fs.js +1 -1
- package/http.cjs +1 -1
- package/http.d.ts +2 -1
- package/http.js +1 -1
- package/{index-BQdGI3d3.d.ts → index-DQfP-Uhy.d.ts} +24 -38
- package/index.cjs +1 -1
- package/index.d.ts +6 -6
- package/index.js +26 -25
- package/{proxy-DGVOk4Q8.js → lib-BcEnB4iV.js} +332 -639
- package/lib-CQqdCndr.cjs +31 -0
- package/{net-MbSFrO35.d.ts → net-BVC0ImHf.d.ts} +1 -3
- package/{net-BgQYnATG.js → net-Bi82weSE.js} +1 -1
- package/{net-zOx2OVGc.cjs → net-uN5eXX3L.cjs} +1 -1
- package/net.cjs +1 -1
- package/net.d.ts +1 -1
- package/net.js +1 -1
- package/package.json +7 -2
- package/{packages-CErlrrLB.d.ts → packages-DU1D-pr4.d.ts} +58 -8
- package/packages.cjs +1 -1
- package/packages.d.ts +2 -2
- package/packages.js +88 -24
- package/proxy-CMtPeuvd.js +43 -0
- package/proxy-CsFzuq-x.d.ts +8 -0
- package/proxy-DbcJMUcm.cjs +1 -0
- package/{storage-D01O3zky.js → storage-BVWaXq8X.js} +1 -1
- package/{storage-a3OhXFv2.cjs → storage-DG1Ac1FK.cjs} +1 -1
- package/cloud-CbNYpNK8.js +0 -129
- package/cloud-mWhpmEwZ.cjs +0 -1
- package/extension-C6xmQRHj.js +0 -78
- package/extension-dmTtpkT5.cjs +0 -1
- package/proxy-C67lCEBx.cjs +0 -53
package/account.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-C9Mh5v0z.cjs");var n=e.t({info:()=>a,login:()=>r,logout:()=>i,onChange:()=>o}),r=async()=>typeof window>`u`?!1:(await t.t).account.login(location.origin).catch(()=>!1),i=async()=>{typeof window>`u`||await(await t.t).account.logout().catch(()=>{})},a=async()=>{if(typeof window>`u`)return null;let e=await t.t.then(e=>e.account.info()).catch(()=>null);return e?{name:e.name,image:e.image,premium:e.premium,premiumUntil:e.premiumUntil?Date.parse(e.premiumUntil):null}:null},o=async e=>{if(typeof window>`u`)return()=>{};let n=await t.t.catch(()=>null);if(!n)return()=>{};let r=await n.account.onChange(e).catch(()=>null);return typeof r==`function`?r:()=>{}};exports.info=a,exports.login=r,exports.logout=i,exports.onChange=o,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return n}});
|
package/account.js
CHANGED
|
@@ -44,30 +44,67 @@ var n = 32, r = typeof CSS < "u" && CSS.supports("clip-path", "path('M0 0H1V1H0Z
|
|
|
44
44
|
if (!l) return;
|
|
45
45
|
let t = c(e);
|
|
46
46
|
t && o(l, t);
|
|
47
|
-
}, p = "https://fkn.app", m = typeof globalThis < "u" && globalThis.document ? globalThis.document : void 0, h = typeof globalThis < "u" && globalThis.crossOriginIsolated === !0, g = `${p}/api${h ? "?coi=1" : ""}`, _ =
|
|
48
|
-
!
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
47
|
+
}, p = "https://fkn.app", m = typeof globalThis < "u" && globalThis.document ? globalThis.document : void 0, h = typeof globalThis < "u" && globalThis.crossOriginIsolated === !0, g = `${p}/api${h ? "?coi=1" : ""}`, _ = "fkn-api-port", v = "fkn-api-port-ack", y = 2e3, b = () => {
|
|
48
|
+
if (!m || typeof window > "u" || window.parent === window) return Promise.resolve(void 0);
|
|
49
|
+
let e;
|
|
50
|
+
try {
|
|
51
|
+
e = window.parent;
|
|
52
|
+
} catch {
|
|
53
|
+
return Promise.resolve(void 0);
|
|
54
|
+
}
|
|
55
|
+
let t = new MessageChannel();
|
|
56
|
+
return new Promise((n) => {
|
|
57
|
+
let r = (e) => {
|
|
58
|
+
if (clearTimeout(a), t.port1.removeEventListener("message", i), !e) try {
|
|
59
|
+
t.port1.close();
|
|
60
|
+
} catch {}
|
|
61
|
+
n(e);
|
|
62
|
+
}, i = (e) => {
|
|
63
|
+
e.data?.type === v && r(t.port1);
|
|
64
|
+
}, a = setTimeout(() => r(void 0), y);
|
|
65
|
+
t.port1.addEventListener("message", i), t.port1.start();
|
|
66
|
+
try {
|
|
67
|
+
e.postMessage({ type: _ }, p, [t.port2]);
|
|
68
|
+
} catch {
|
|
69
|
+
r(void 0);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}, x, S = () => {
|
|
73
|
+
if (x || !m) return x;
|
|
74
|
+
let e = m.querySelector(`iframe[src="${g}"]`);
|
|
75
|
+
if (e) x = e;
|
|
76
|
+
else {
|
|
77
|
+
let e = m.createElement("iframe");
|
|
78
|
+
h && e.setAttribute("allow", "cross-origin-isolated"), e.src = g, m.body.appendChild(e), x = e;
|
|
79
|
+
}
|
|
80
|
+
return d(x), x;
|
|
81
|
+
}, C = (async () => {
|
|
82
|
+
if (!m) return;
|
|
83
|
+
let e = await b();
|
|
84
|
+
if (e) return {
|
|
85
|
+
receive: e,
|
|
86
|
+
emit: e
|
|
87
|
+
};
|
|
88
|
+
let t = S()?.contentWindow;
|
|
89
|
+
return t ? {
|
|
58
90
|
receive: window,
|
|
59
|
-
emit:
|
|
91
|
+
emit: t
|
|
60
92
|
} : void 0;
|
|
93
|
+
})(), w = () => x, T = /* @__PURE__ */ e({
|
|
94
|
+
apiPromise: () => D,
|
|
95
|
+
hasTransport: () => E
|
|
96
|
+
}), E = typeof window < "u" || typeof self < "u", D = (async () => {
|
|
97
|
+
if (typeof window < "u") return C;
|
|
61
98
|
if (typeof self < "u") return {
|
|
62
99
|
receive: self,
|
|
63
100
|
emit: self
|
|
64
101
|
};
|
|
65
|
-
})()
|
|
102
|
+
})().then((e) => e ? t({}, {
|
|
66
103
|
key: "fkn-api",
|
|
67
|
-
transport:
|
|
68
|
-
}) : new Promise(() => {});
|
|
69
|
-
|
|
104
|
+
transport: e
|
|
105
|
+
}) : new Promise(() => {}));
|
|
106
|
+
D.then((e) => {
|
|
70
107
|
u() && e.overlay.setHost(f);
|
|
71
108
|
}, () => {});
|
|
72
109
|
//#endregion
|
|
73
|
-
export {
|
|
110
|
+
export { w as i, T as n, E as r, D as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D as InstalledPackage, E as InstallOptions, M as PickOptions, N as SurfaceRect, O as PackageQuery, T as ConnectOptions, j as PackagesFail, k as PackageResult, w as Caller } from "./packages-DU1D-pr4.js";
|
|
2
2
|
import { t as AddressLookupResult } from "./lookup-BtwWaCZJ.js";
|
|
3
3
|
//#region src/api/storage.d.ts
|
|
4
4
|
type StorageEntry = {
|
|
@@ -16,6 +16,15 @@ type StorageQuota = {
|
|
|
16
16
|
maxObjects: number;
|
|
17
17
|
};
|
|
18
18
|
type WriteData = ArrayBuffer | Uint8Array | string;
|
|
19
|
+
type StorageReadResult = {
|
|
20
|
+
bytes: Uint8Array;
|
|
21
|
+
encryption: string | null;
|
|
22
|
+
appOrigin: string;
|
|
23
|
+
};
|
|
24
|
+
type KeyState = {
|
|
25
|
+
keyEpoch: number | null;
|
|
26
|
+
keyFingerprint: string | null;
|
|
27
|
+
};
|
|
19
28
|
//#endregion
|
|
20
29
|
//#region src/api/storage-prompt.d.ts
|
|
21
30
|
type AdoptRequest = {
|
|
@@ -412,38 +421,57 @@ type Account = {
|
|
|
412
421
|
premiumUntil: string | null;
|
|
413
422
|
};
|
|
414
423
|
//#endregion
|
|
415
|
-
//#region src/api/
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
424
|
+
//#region src/api/usage-meter.d.ts
|
|
425
|
+
type UsageMetric = 'webvpnUp' | 'webvpnDown' | 'proxyDown' | 'proxyRequests' | 'storageUp' | 'storageDown';
|
|
426
|
+
type UsageAdd = {
|
|
427
|
+
metric: UsageMetric;
|
|
428
|
+
amount: number;
|
|
429
|
+
};
|
|
430
|
+
type UsageBucket = {
|
|
431
|
+
key: string;
|
|
432
|
+
metrics: Partial<Record<UsageMetric, number>>;
|
|
433
|
+
};
|
|
434
|
+
type UsageSnapshot = {
|
|
435
|
+
epoch: string;
|
|
436
|
+
minutes: UsageBucket[];
|
|
437
|
+
hours: UsageBucket[];
|
|
438
|
+
days: UsageBucket[];
|
|
439
|
+
};
|
|
440
|
+
//#endregion
|
|
441
|
+
//#region src/api/data-plane.d.ts
|
|
442
|
+
declare const dataPlane: {
|
|
443
|
+
usage: {
|
|
444
|
+
report: (scopeKey: string, adds: UsageAdd[]) => Promise<void>;
|
|
445
|
+
read: (scopeKey: string) => Promise<UsageSnapshot>;
|
|
446
|
+
scopes: () => Promise<string[]>;
|
|
447
|
+
rates: () => Promise<{
|
|
448
|
+
up: number;
|
|
449
|
+
down: number;
|
|
450
|
+
}>;
|
|
451
|
+
suppress: (scopeKey: string) => Promise<void>;
|
|
452
|
+
};
|
|
453
|
+
cloud: {
|
|
454
|
+
fetch: (input: string | Request | URL, init?: (RequestInit | undefined) & {
|
|
419
455
|
render?: boolean;
|
|
420
456
|
}) => Promise<Response>;
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
457
|
+
quota: () => Promise<Quota>;
|
|
458
|
+
dns: {
|
|
459
|
+
lookup: <T extends boolean = false>(hostname: string, options?: {
|
|
424
460
|
all?: T;
|
|
425
461
|
family?: 0 | 4 | 6;
|
|
426
462
|
}) => Promise<T extends true ? AddressLookupResult[] : AddressLookupResult | undefined>;
|
|
427
463
|
};
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
unlocked: boolean;
|
|
437
|
-
enrolled: boolean;
|
|
438
|
-
keyEpoch: number | null;
|
|
439
|
-
}>;
|
|
440
|
-
readonly unlock: () => Promise<boolean>;
|
|
441
|
-
readonly promptAdopt: (request: AdoptRequest) => Promise<boolean>;
|
|
442
|
-
readonly promptConflict: (request: ConflictRequest) => Promise<ConflictChoice>;
|
|
443
|
-
readonly setAdoptSource: (next: AdoptState | null, run: (() => Promise<void>) | null) => void;
|
|
464
|
+
fs: {
|
|
465
|
+
available: () => Promise<boolean>;
|
|
466
|
+
list: (scope?: string) => Promise<StorageEntry[]>;
|
|
467
|
+
quota: () => Promise<StorageQuota>;
|
|
468
|
+
readFile: (path: string, scope?: string) => Promise<StorageReadResult>;
|
|
469
|
+
writeFile: (path: string, data: WriteData, contentType: string | null, encryption: string, scope?: string) => Promise<void>;
|
|
470
|
+
remove: (path: string, scope?: string) => Promise<void>;
|
|
471
|
+
keyState: () => Promise<KeyState>;
|
|
444
472
|
};
|
|
445
|
-
|
|
446
|
-
|
|
473
|
+
webvpn: {
|
|
474
|
+
tcpSocket: ({
|
|
447
475
|
remoteAddress: _remoteAddress,
|
|
448
476
|
remotePort,
|
|
449
477
|
usageTag
|
|
@@ -452,7 +480,7 @@ declare const resolvers: {
|
|
|
452
480
|
remotePort: number;
|
|
453
481
|
usageTag?: string;
|
|
454
482
|
}) => Promise<LocalTcpSocket>;
|
|
455
|
-
|
|
483
|
+
tcpSocketListener: ({
|
|
456
484
|
localAddress: _localAddress,
|
|
457
485
|
localPort,
|
|
458
486
|
onConnection,
|
|
@@ -470,7 +498,7 @@ declare const resolvers: {
|
|
|
470
498
|
localPort: number;
|
|
471
499
|
close: () => Promise<void>;
|
|
472
500
|
}>;
|
|
473
|
-
|
|
501
|
+
udpSocket: ({
|
|
474
502
|
type,
|
|
475
503
|
port,
|
|
476
504
|
address,
|
|
@@ -526,6 +554,90 @@ declare const resolvers: {
|
|
|
526
554
|
}>;
|
|
527
555
|
};
|
|
528
556
|
};
|
|
557
|
+
};
|
|
558
|
+
type DataPlane = typeof dataPlane;
|
|
559
|
+
//#endregion
|
|
560
|
+
//#region src/api/index.d.ts
|
|
561
|
+
type Cloud = DataPlane['cloud'];
|
|
562
|
+
declare const makeResolvers: (callerOf: () => Caller | undefined) => {
|
|
563
|
+
readonly cloud: {
|
|
564
|
+
readonly fetch: (input: Parameters<Cloud['fetch']>[0], init: Parameters<Cloud['fetch']>[1]) => Promise<Response>;
|
|
565
|
+
readonly quota: () => Promise<Quota>;
|
|
566
|
+
readonly dns: {
|
|
567
|
+
readonly lookup: <T extends boolean = false>(hostname: string, options?: {
|
|
568
|
+
all?: T;
|
|
569
|
+
family?: 0 | 4 | 6;
|
|
570
|
+
}) => Promise<T extends true ? AddressLookupResult[] : AddressLookupResult | undefined>;
|
|
571
|
+
};
|
|
572
|
+
readonly fs: {
|
|
573
|
+
readonly available: () => Promise<boolean>;
|
|
574
|
+
readonly list: () => Promise<StorageEntry[]>;
|
|
575
|
+
readonly quota: () => Promise<StorageQuota>;
|
|
576
|
+
readonly readFile: (path: string) => Promise<Uint8Array<ArrayBufferLike>>;
|
|
577
|
+
readonly writeFile: (path: string, data: WriteData, contentType: string | null) => Promise<void>;
|
|
578
|
+
readonly remove: (path: string) => Promise<void>;
|
|
579
|
+
readonly encryption: () => Promise<{
|
|
580
|
+
unlocked: boolean;
|
|
581
|
+
enrolled: boolean;
|
|
582
|
+
keyEpoch: number | null;
|
|
583
|
+
}>;
|
|
584
|
+
readonly unlock: () => Promise<boolean>;
|
|
585
|
+
readonly promptAdopt: (request: AdoptRequest) => Promise<boolean>;
|
|
586
|
+
readonly promptConflict: (request: ConflictRequest) => Promise<ConflictChoice>;
|
|
587
|
+
readonly setAdoptSource: (next: AdoptState | null, run: (() => Promise<void>) | null) => void;
|
|
588
|
+
};
|
|
589
|
+
readonly webvpn: {
|
|
590
|
+
readonly tcpSocket: (options: Parameters<Cloud['webvpn']['tcpSocket']>[0]) => Promise<LocalTcpSocket>;
|
|
591
|
+
readonly tcpSocketListener: (options: Parameters<Cloud['webvpn']['tcpSocketListener']>[0]) => Promise<{
|
|
592
|
+
localAddress: string;
|
|
593
|
+
localFamily: "IPv4" | "IPv6";
|
|
594
|
+
localPort: number;
|
|
595
|
+
close: () => Promise<void>;
|
|
596
|
+
}>;
|
|
597
|
+
readonly udpSocket: (options: Parameters<Cloud['webvpn']['udpSocket']>[0]) => Promise<{
|
|
598
|
+
socketId: number;
|
|
599
|
+
dataPort: MessagePort | undefined;
|
|
600
|
+
dataPortAcks: true | undefined;
|
|
601
|
+
closed: Promise<{
|
|
602
|
+
reason: string;
|
|
603
|
+
}>;
|
|
604
|
+
localAddress: string;
|
|
605
|
+
localFamily: "IPv4" | "IPv6";
|
|
606
|
+
localPort: number;
|
|
607
|
+
dataReadableStream: ReadableStream<{
|
|
608
|
+
data: ArrayBuffer;
|
|
609
|
+
size: number;
|
|
610
|
+
family: 'IPv4' | 'IPv6';
|
|
611
|
+
address: string;
|
|
612
|
+
port: number;
|
|
613
|
+
}>;
|
|
614
|
+
connect: ({
|
|
615
|
+
remoteAddress: _remoteAddress,
|
|
616
|
+
remotePort
|
|
617
|
+
}: {
|
|
618
|
+
remoteAddress: string;
|
|
619
|
+
remotePort: number;
|
|
620
|
+
}) => Promise<{
|
|
621
|
+
local: boolean;
|
|
622
|
+
address: string;
|
|
623
|
+
family: "IPv4" | "IPv6";
|
|
624
|
+
port: number;
|
|
625
|
+
}>;
|
|
626
|
+
disconnect: () => Promise<void>;
|
|
627
|
+
send: ({
|
|
628
|
+
message,
|
|
629
|
+
address: _remoteAddress,
|
|
630
|
+
port: remotePort
|
|
631
|
+
}: {
|
|
632
|
+
message: ArrayBuffer;
|
|
633
|
+
address?: string;
|
|
634
|
+
port?: number;
|
|
635
|
+
}) => Promise<void>;
|
|
636
|
+
close: () => Promise<void>;
|
|
637
|
+
setOption: (option: UdpSocketOption) => Promise<void>;
|
|
638
|
+
}>;
|
|
639
|
+
};
|
|
640
|
+
};
|
|
529
641
|
readonly overlay: {
|
|
530
642
|
readonly setHost: (push: (state: {
|
|
531
643
|
modal: boolean;
|
|
@@ -548,30 +660,36 @@ declare const resolvers: {
|
|
|
548
660
|
readonly prompt: () => Promise<string>;
|
|
549
661
|
};
|
|
550
662
|
readonly packages: {
|
|
551
|
-
search: (query: PackageQuery) => Promise<{
|
|
663
|
+
search: (query: PackageQuery) => Promise<PackagesFail | {
|
|
552
664
|
results: PackageResult[];
|
|
553
|
-
}
|
|
554
|
-
pick: (query: PackageQuery, options?: PickOptions) => Promise<{
|
|
665
|
+
}>;
|
|
666
|
+
pick: (query: PackageQuery, options?: PickOptions) => Promise<PackagesFail | {
|
|
555
667
|
results: PackageResult[];
|
|
556
668
|
failed: string[];
|
|
557
669
|
} | {
|
|
558
670
|
declined: true;
|
|
559
|
-
}
|
|
560
|
-
install: (uri: string, options?: InstallOptions) => Promise<{
|
|
671
|
+
}>;
|
|
672
|
+
install: (uri: string, options?: InstallOptions) => Promise<PackagesFail | {
|
|
561
673
|
installed: InstalledPackage;
|
|
562
674
|
} | {
|
|
563
675
|
declined: true;
|
|
564
|
-
}
|
|
676
|
+
}>;
|
|
565
677
|
list: () => Promise<{
|
|
566
678
|
results: InstalledPackage[];
|
|
567
679
|
}>;
|
|
568
|
-
uninstall: (uri: string) => Promise<{
|
|
680
|
+
uninstall: (uri: string) => Promise<PackagesFail | {
|
|
569
681
|
ok: true;
|
|
570
|
-
}
|
|
571
|
-
connect: (uri: string, options?: ConnectOptions) => Promise<{
|
|
682
|
+
}>;
|
|
683
|
+
connect: (uri: string, options?: ConnectOptions) => Promise<PackagesFail | {
|
|
572
684
|
port: MessagePort;
|
|
573
685
|
closed: Promise<void>;
|
|
574
|
-
}
|
|
686
|
+
}>;
|
|
687
|
+
show: (uri: string, rect: SurfaceRect) => Promise<PackagesFail | {
|
|
688
|
+
ok: true;
|
|
689
|
+
}>;
|
|
690
|
+
hide: (uri: string) => Promise<PackagesFail | {
|
|
691
|
+
ok: true;
|
|
692
|
+
}>;
|
|
575
693
|
};
|
|
576
694
|
readonly account: {
|
|
577
695
|
readonly info: () => Promise<Account | null>;
|
|
@@ -579,49 +697,15 @@ declare const resolvers: {
|
|
|
579
697
|
readonly logout: () => void;
|
|
580
698
|
readonly onChange: (listener: () => void) => (() => void);
|
|
581
699
|
};
|
|
582
|
-
readonly proxyFetch: (input:
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
readonly webVpnTcpSocket: ({
|
|
586
|
-
remoteAddress: _remoteAddress,
|
|
587
|
-
remotePort,
|
|
588
|
-
usageTag
|
|
589
|
-
}: {
|
|
590
|
-
remoteAddress: string;
|
|
591
|
-
remotePort: number;
|
|
592
|
-
usageTag?: string;
|
|
593
|
-
}) => Promise<LocalTcpSocket>;
|
|
594
|
-
readonly webVpnTcpSocketListener: ({
|
|
595
|
-
localAddress: _localAddress,
|
|
596
|
-
localPort,
|
|
597
|
-
onConnection,
|
|
598
|
-
onClose,
|
|
599
|
-
usageTag
|
|
600
|
-
}: {
|
|
601
|
-
localAddress: string;
|
|
602
|
-
localPort: number;
|
|
603
|
-
onConnection: (connection: TcpSocketResult) => void | Promise<void>;
|
|
604
|
-
onClose?: (error?: Error) => void | Promise<void>;
|
|
605
|
-
usageTag?: string;
|
|
606
|
-
}) => Promise<{
|
|
700
|
+
readonly proxyFetch: (input: Parameters<Cloud['fetch']>[0], init: Parameters<Cloud['fetch']>[1]) => Promise<Response>;
|
|
701
|
+
readonly webVpnTcpSocket: (options: Parameters<Cloud['webvpn']['tcpSocket']>[0]) => Promise<LocalTcpSocket>;
|
|
702
|
+
readonly webVpnTcpSocketListener: (options: Parameters<Cloud['webvpn']['tcpSocketListener']>[0]) => Promise<{
|
|
607
703
|
localAddress: string;
|
|
608
704
|
localFamily: "IPv4" | "IPv6";
|
|
609
705
|
localPort: number;
|
|
610
706
|
close: () => Promise<void>;
|
|
611
707
|
}>;
|
|
612
|
-
readonly webVpnUdpSocket: ({
|
|
613
|
-
type,
|
|
614
|
-
port,
|
|
615
|
-
address,
|
|
616
|
-
dataPort,
|
|
617
|
-
usageTag
|
|
618
|
-
}: {
|
|
619
|
-
type: 'udp4' | 'udp6';
|
|
620
|
-
port: number;
|
|
621
|
-
address: string;
|
|
622
|
-
dataPort?: boolean;
|
|
623
|
-
usageTag?: string;
|
|
624
|
-
}) => Promise<{
|
|
708
|
+
readonly webVpnUdpSocket: (options: Parameters<Cloud['webvpn']['udpSocket']>[0]) => Promise<{
|
|
625
709
|
socketId: number;
|
|
626
710
|
dataPort: MessagePort | undefined;
|
|
627
711
|
dataPortAcks: true | undefined;
|
|
@@ -679,6 +763,6 @@ declare const resolvers: {
|
|
|
679
763
|
readonly showInstallPrompt: (reason?: string) => Promise<void>;
|
|
680
764
|
readonly hideInstallPrompt: () => void;
|
|
681
765
|
};
|
|
682
|
-
type Resolvers = typeof
|
|
766
|
+
type Resolvers = ReturnType<typeof makeResolvers>;
|
|
683
767
|
//#endregion
|
|
684
768
|
export { TcpSocketOption as i, UdpSocketOption as n, LocalTcpSocket as r, Resolvers as t };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-BIInC43l.cjs");let t=require("osra");var n=32,r=typeof CSS<`u`&&CSS.supports(`clip-path`,`path('M0 0H1V1H0Z')`),i=e=>{let t=e.style;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(`clip-path`,`inset(100%)`,`important`),t.setProperty(`background`,`transparent`),t.setProperty(`color-scheme`,`normal`),t.setProperty(`z-index`,`2147483647`),e.setAttribute(`title`,`FKN`)},a=({x:e,y:t,width:n,height:r})=>`M${e} ${t}h${n}v${r}h${-n}Z`,o=(e,{modal:t,rects:n})=>{if(!r){let r=t||n.length>0;e.style.setProperty(`pointer-events`,r?`auto`:`none`,`important`),e.style.setProperty(`visibility`,r?`visible`:`hidden`,`important`);return}let i=t?`none`:n.length===0?`inset(100%)`:`path('${n.map(a).join(``)}')`,o=i===`none`||CSS.supports(`clip-path`,i)?i:`inset(100%)`;e.style.setProperty(`clip-path`,o,`important`)},s=e=>{if(typeof e!=`object`||!e)return null;let{x:t,y:n,width:r,height:i}=e;if(![t,n,r,i].every(e=>typeof e==`number`&&Number.isFinite(e)))return null;let a=window.innerWidth,o=window.innerHeight,s=Math.max(0,Math.min(Math.round(t),a)),c=Math.max(0,Math.min(Math.round(n),o)),l=Math.max(s,Math.min(Math.round(t+r),a)),u=Math.max(c,Math.min(Math.round(n+i),o));return{x:s,y:c,width:l-s,height:u-c}},c=e=>{if(typeof e!=`object`||!e)return null;let t=e,r=(Array.isArray(t.rects)?t.rects.slice(0,n):[]).map(s).filter(e=>e!==null&&e.width>0&&e.height>0);return{modal:t.modal===!0,rects:r}},l=null,u=()=>l!==null,d=e=>{i(e),o(e,{modal:!1,rects:[]}),l=e},f=e=>{if(!l)return;let t=c(e);t&&o(l,t)},p=`https://fkn.app`,m=typeof globalThis<`u`&&globalThis.document?globalThis.document:void 0,h=typeof globalThis<`u`&&globalThis.crossOriginIsolated===!0,g=`${p}/api${h?`?coi=1`:``}`,_=m?.querySelector(`iframe[src="${g}"]`)
|
|
1
|
+
const e=require("./rolldown-runtime-BIInC43l.cjs");let t=require("osra");var n=32,r=typeof CSS<`u`&&CSS.supports(`clip-path`,`path('M0 0H1V1H0Z')`),i=e=>{let t=e.style;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(`clip-path`,`inset(100%)`,`important`),t.setProperty(`background`,`transparent`),t.setProperty(`color-scheme`,`normal`),t.setProperty(`z-index`,`2147483647`),e.setAttribute(`title`,`FKN`)},a=({x:e,y:t,width:n,height:r})=>`M${e} ${t}h${n}v${r}h${-n}Z`,o=(e,{modal:t,rects:n})=>{if(!r){let r=t||n.length>0;e.style.setProperty(`pointer-events`,r?`auto`:`none`,`important`),e.style.setProperty(`visibility`,r?`visible`:`hidden`,`important`);return}let i=t?`none`:n.length===0?`inset(100%)`:`path('${n.map(a).join(``)}')`,o=i===`none`||CSS.supports(`clip-path`,i)?i:`inset(100%)`;e.style.setProperty(`clip-path`,o,`important`)},s=e=>{if(typeof e!=`object`||!e)return null;let{x:t,y:n,width:r,height:i}=e;if(![t,n,r,i].every(e=>typeof e==`number`&&Number.isFinite(e)))return null;let a=window.innerWidth,o=window.innerHeight,s=Math.max(0,Math.min(Math.round(t),a)),c=Math.max(0,Math.min(Math.round(n),o)),l=Math.max(s,Math.min(Math.round(t+r),a)),u=Math.max(c,Math.min(Math.round(n+i),o));return{x:s,y:c,width:l-s,height:u-c}},c=e=>{if(typeof e!=`object`||!e)return null;let t=e,r=(Array.isArray(t.rects)?t.rects.slice(0,n):[]).map(s).filter(e=>e!==null&&e.width>0&&e.height>0);return{modal:t.modal===!0,rects:r}},l=null,u=()=>l!==null,d=e=>{i(e),o(e,{modal:!1,rects:[]}),l=e},f=e=>{if(!l)return;let t=c(e);t&&o(l,t)},p=`https://fkn.app`,m=typeof globalThis<`u`&&globalThis.document?globalThis.document:void 0,h=typeof globalThis<`u`&&globalThis.crossOriginIsolated===!0,g=`${p}/api${h?`?coi=1`:``}`,_=`fkn-api-port`,v=`fkn-api-port-ack`,y=2e3,b=()=>{if(!m||typeof window>`u`||window.parent===window)return Promise.resolve(void 0);let e;try{e=window.parent}catch{return Promise.resolve(void 0)}let t=new MessageChannel;return new Promise(n=>{let r=e=>{if(clearTimeout(a),t.port1.removeEventListener(`message`,i),!e)try{t.port1.close()}catch{}n(e)},i=e=>{e.data?.type===v&&r(t.port1)},a=setTimeout(()=>r(void 0),y);t.port1.addEventListener(`message`,i),t.port1.start();try{e.postMessage({type:_},p,[t.port2])}catch{r(void 0)}})},x,S=()=>{if(x||!m)return x;let e=m.querySelector(`iframe[src="${g}"]`);if(e)x=e;else{let e=m.createElement(`iframe`);h&&e.setAttribute(`allow`,`cross-origin-isolated`),e.src=g,m.body.appendChild(e),x=e}return d(x),x},C=(async()=>{if(!m)return;let e=await b();if(e)return{receive:e,emit:e};let t=S()?.contentWindow;return t?{receive:window,emit:t}:void 0})(),w=()=>x,T=e.t({apiPromise:()=>D,hasTransport:()=>E}),E=typeof window<`u`||typeof self<`u`,D=(async()=>{if(typeof window<`u`)return C;if(typeof self<`u`)return{receive:self,emit:self}})().then(e=>e?(0,t.expose)({},{key:`fkn-api`,transport:e}):new Promise(()=>{}));D.then(e=>{u()&&e.overlay.setHost(f)},()=>{}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return D}});
|
package/cloud/dgram.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../dgram-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../dgram-ocGNUMpo.cjs");exports.Socket=e.t,exports.createSocket=e.n,exports.default=e.r;
|
package/cloud/dgram.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, r as t, t as n } from "../dgram-
|
|
1
|
+
import { n as e, r as t, t as n } from "../dgram-DNbgOMoK.js";
|
|
2
2
|
export { n as Socket, e as createSocket, t as default };
|
package/cloud/fetch.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../proxy-DbcJMUcm.cjs");exports.fetch=e.t;
|
package/cloud/fetch.d.ts
ADDED
package/cloud/fetch.js
ADDED
package/cloud/fs.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../rolldown-runtime-BIInC43l.cjs"),t=require("../node-fs-BMR2yCEt.cjs"),n=require("../storage-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../rolldown-runtime-BIInC43l.cjs"),t=require("../node-fs-BMR2yCEt.cjs"),n=require("../storage-DG1Ac1FK.cjs");var r=e.t({StorageLockedError:()=>n.t,available:()=>i,encryption:()=>n.r,mkdir:()=>u,promises:()=>p,quota:()=>n.a,readFile:()=>a,readdir:()=>l,rename:()=>c,rm:()=>d,stat:()=>f,unlink:()=>s,unlock:()=>n.l,writeFile:()=>o}),{available:i,readFile:a,writeFile:o,unlink:s,rename:c,readdir:l,mkdir:u,rm:d,stat:f,promises:p}=t.t(n.c,{memfs:!1});exports.StorageLockedError=n.t,exports.available=i,exports.encryption=n.r,exports.mkdir=u,exports.promises=p,exports.quota=n.a,exports.readFile=a,exports.readdir=l,exports.rename=c,exports.rm=d,exports.stat=f,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}}),exports.unlink=s,exports.unlock=n.l,exports.writeFile=o;
|
package/cloud/fs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as e } from "../rolldown-runtime-Dy4uBu1J.js";
|
|
2
2
|
import { t } from "../node-fs-DKfokOlh.js";
|
|
3
|
-
import { a as n, c as r, l as i, r as a, t as o } from "../storage-
|
|
3
|
+
import { a as n, c as r, l as i, r as a, t as o } from "../storage-BVWaXq8X.js";
|
|
4
4
|
//#region src/lib/cloud/fs.ts
|
|
5
5
|
var s = /* @__PURE__ */ e({
|
|
6
6
|
StorageLockedError: () => o,
|
package/cloud/net.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../utils-QfNXtEhb.cjs"),t=require("../net-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../utils-QfNXtEhb.cjs"),t=require("../net-uN5eXX3L.cjs");exports.Server=t.t,exports.Socket=t.n,exports._default=t.r,exports.default=t.r,exports.connect=t.i,exports.createConnection=t.a,exports.createServer=t.o,exports.isIP=e.r,exports.isIPv4=e.i,exports.isIPv6=e.a;
|
package/cloud/net.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as createConnection, c as isIP, i as connect, l as isIPv4, n as Socket, o as createServer, r as _default, t as Server, u as isIPv6 } from "../net-
|
|
1
|
+
import { a as createConnection, c as isIP, i as connect, l as isIPv4, n as Socket, o as createServer, r as _default, t as Server, u as isIPv6 } from "../net-BVC0ImHf.js";
|
|
2
2
|
export { Server, Socket, _default, _default as default, connect, createConnection, createServer, isIP, isIPv4, isIPv6 };
|
package/cloud/net.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { a as e, i as t, r as n } from "../utils-DVlbuXmW.js";
|
|
2
|
-
import { a as r, i, n as a, o, r as s, t as c } from "../net-
|
|
2
|
+
import { a as r, i, n as a, o, r as s, t as c } from "../net-Bi82weSE.js";
|
|
3
3
|
export { c as Server, a as Socket, s as _default, s as default, i as connect, r as createConnection, o as createServer, n as isIP, t as isIPv4, e as isIPv6 };
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { d as Frame, u as AttachFrameOptions } from "./index-
|
|
1
|
+
import { t as cloudFetch } from "./proxy-CsFzuq-x.js";
|
|
2
|
+
import { d as Frame, u as AttachFrameOptions } from "./index-DQfP-Uhy.js";
|
|
3
3
|
import { t as dns_d_exports } from "./dns.js";
|
|
4
4
|
import { n as fs_d_exports } from "./fs-DTmSCXwa.js";
|
|
5
|
-
import { s as net_d_exports } from "./net-
|
|
5
|
+
import { s as net_d_exports } from "./net-BVC0ImHf.js";
|
|
6
6
|
import { t as dgram_d_exports } from "./dgram.js";
|
|
7
7
|
import { t as http_d_exports } from "./http.js";
|
|
8
8
|
|
|
9
|
-
//#region src/lib/proxy.d.ts
|
|
10
|
-
type ProxyFetch = Resolvers['cloud']['fetch'];
|
|
11
|
-
type FetchParameters = Parameters<ProxyFetch>;
|
|
12
|
-
declare const cloudFetch: (input: FetchParameters[0], init?: FetchParameters[1]) => Promise<Response>;
|
|
13
|
-
//#endregion
|
|
14
9
|
//#region src/lib/cloud/frame.d.ts
|
|
15
10
|
declare const attachFrame: ({
|
|
16
11
|
iframe,
|
|
@@ -38,4 +33,4 @@ declare namespace cloud_d_exports {
|
|
|
38
33
|
}
|
|
39
34
|
declare const available: () => boolean;
|
|
40
35
|
//#endregion
|
|
41
|
-
export { attachFrame as a, quota as i, cloud_d_exports as n,
|
|
36
|
+
export { attachFrame as a, quota as i, cloud_d_exports as n, QuotaStatus as r, available as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-CQqdCndr.cjs"),n=require("./api-C9Mh5v0z.cjs"),r=require("./proxy-DbcJMUcm.cjs"),i=require("./dns.cjs"),a=require("./cloud/fs.cjs"),o=require("./net-uN5eXX3L.cjs"),s=require("./dgram-ocGNUMpo.cjs"),c=require("./http.cjs");let l=require("osra");var u;(function(e){e.stylesheet=`stylesheet`,e.rule=`rule`,e.declaration=`declaration`,e.comment=`comment`,e.atRule=`at-rule`,e.container=`container`,e.charset=`charset`,e.counterStyle=`counter-style`,e.document=`document`,e.customMedia=`custom-media`,e.fontFace=`font-face`,e.fontFeatureValues=`font-feature-values`,e.host=`host`,e.import=`import`,e.keyframes=`keyframes`,e.keyframe=`keyframe`,e.layer=`layer`,e.media=`media`,e.namespace=`namespace`,e.page=`page`,e.pageMarginBox=`page-margin-box`,e.positionTry=`position-try`,e.property=`property`,e.scope=`scope`,e.startingStyle=`starting-style`,e.supports=`supports`,e.viewTransition=`view-transition`})(u||={});var d=(e,t,n)=>{let r=n,i=1e4;do{let n=t.map(t=>e.indexOf(t,r));n.push(e.indexOf(`\\`,r));let a=n.filter(e=>e!==-1);if(a.length===0)return-1;let o=Math.min(...a);if(e[o]!==`\\`)return o;r=o+2,i--}while(i>0);throw Error(`Too many escaping`)},f=(e,t,n)=>{let r=n,i=1e4;do{let n=t.map(t=>e.indexOf(t,r));n.push(e.indexOf(`(`,r)),n.push(e.indexOf(`"`,r)),n.push(e.indexOf(`'`,r)),n.push(e.indexOf(`\\`,r));let a=n.filter(e=>e!==-1);if(a.length===0)return-1;let o=Math.min(...a);switch(e[o]){case`\\`:r=o+2;break;case`(`:{let t=f(e,[`)`],o+1);if(t===-1)return-1;r=t+1}break;case`"`:{let t=d(e,[`"`],o+1);if(t===-1)return-1;r=t+1}break;case`'`:{let t=d(e,[`'`],o+1);if(t===-1)return-1;r=t+1}break;default:return o}i--}while(i>0);throw Error(`Too many escaping`)};function p(e,t){let n=e&&typeof e.type==`string`,r=n?e:t;for(let t in e){let n=e[t];Array.isArray(n)?n.forEach(e=>{p(e,r)}):n&&typeof n==`object`&&p(n,r)}return n&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var m=`LocatorUnsupportedError`,h=`LocatorDeniedError`,g=e=>typeof e==`object`&&e?e.name:void 0,_=(e,t=``,n)=>Object.assign(Error(e),{name:m,operation:t,backend:n}),v=(e,t)=>_(`Locator operation not supported${t?` on the ${t} backend`:``}: ${e}`,e,t),y=e=>g(e)===m,b=e=>g(e)===h,x=e=>b(e)||y(e),ee=/(?:^|[^\w-])(?:url|image|image-set|cross-fade|paint|element|expression)\s*\(/i,te=e=>e.replace(/\\([0-9a-fA-F]{1,6})\s?/g,(e,t)=>String.fromCodePoint(Number.parseInt(t,16))).replace(/\\(.)/g,`$1`),S=e=>!ee.test(te(e.value)),C=new Set([u.import,u.fontFace,u.namespace,u.charset,u.document,u.comment]),w=e=>{if(C.has(e.type))return null;if(e.type===u.declaration)return S(e)?e:null;let t=e,n={...t};for(let e of[`declarations`,`rules`,`keyframes`]){let r=t[e];Array.isArray(r)&&(n[e]=T(r))}return n},T=e=>e.map(e=>w(e)).filter(e=>e!==null),E=3e4,D=50,O=e=>{let t=e[e.length-1];return typeof t==`object`&&t?t:void 0},k=e=>{let t=O(e)?.timeout;return typeof t==`number`?t:E},A=({executor:e,parts:t})=>({highlight:n=>e.highlight(t,n).then(()=>{},()=>{})}),j=async e=>{let t={parts:e.parts,operation:e.operation,args:e.args,phase:`ensure`};await e.gate?.(t,A(e))},M=async e=>{let{executor:t,gate:n,parts:r,operation:i,args:a}=e;n&&await n({parts:r,operation:i,args:a,phase:`execute`},A(e));let o=k(a),s=Date.now()+o,c=Error(`Locator timeout (${o}ms): ${i}`),{promise:l,reject:u}=Promise.withResolvers();l.catch(()=>{});let d=setTimeout(()=>u(c),o),f=c;try{for(;Date.now()<s;)try{return await Promise.race([t.execute(r,i,a),l])}catch(e){if(e===c)break;if(x(e))throw e;f=e;let t=s-Date.now();if(t<=0)break;await new Promise(e=>setTimeout(e,Math.min(D,t)))}}finally{clearTimeout(d)}throw f},N=(e,t,n,r)=>{let i={};for(let[a,o]of Object.entries(t[n].selectors))i[a]=(...i)=>N(e,t,o.to,[...r,{kind:n,name:a,args:i}]);for(let a of Object.keys(t[n].operations))i[a]=(...t)=>M({...e,parts:r,operation:a,args:t});return i.ensure=(t,n={})=>j({...e,parts:r,operation:t,args:[n]}),i},P=e=>e,F=`autoplay; fullscreen; encrypted-media; picture-in-picture; clipboard-read; clipboard-write`,I=2e4,L=65e3,ne=3e4,R=5e3,z=new Set,B=()=>`https://fkn.app`,V=e=>!e||e===`about:blank`,H=e=>e?``:`incognito-${crypto.randomUUID()}`,U=({target:e,session:t})=>{let n=new URL(`/attach-frame`,B());return e&&n.searchParams.set(`url`,e),t&&n.searchParams.set(`session`,t),n.href},W=(e,t,n)=>{let r,i=new Promise((e,i)=>{r=setTimeout(()=>i(Error(n)),t)});return Promise.race([e,i]).finally(()=>clearTimeout(r))},G=(e,t)=>{let n=()=>{a(),t()},r=e.parentNode,i=new MutationObserver(()=>{(!e.isConnected||e.parentNode!==r)&&(a(),t())}),a=()=>{window.removeEventListener(`pagehide`,n),i.disconnect()};window.addEventListener(`pagehide`,n,{once:!0}),r&&i.observe(r,{childList:!0}),e.isConnected||(a(),t())},K=()=>Object.assign(Error(`cloud.attachFrame: the attached iframe left the document or was reloaded; attach a fresh iframe`),{name:m}),q=(e,t)=>{let n=[...e.split(`;`),...t.split(`;`)].map(e=>e.trim()).filter(Boolean);return[...new Set(n)].join(`; `)},J=[300,1200,4e3],Y=e=>{let t=()=>{if(!e.isConnected)return;let t=e.style.height,n=e.getBoundingClientRect();n.height&&(e.style.height=`${n.height-1}px`,setTimeout(()=>{e.style.height=t},50))};t();for(let e of J)setTimeout(t,e)},X=e=>{let t=e.getAttribute(`sandbox`);if(t===null)return;let n=new Set(t.toLowerCase().split(/\s+/).filter(Boolean)),r=[`allow-scripts`,`allow-same-origin`].filter(e=>!n.has(e));if(r.length)throw Error(`cloud.attachFrame: the iframe's sandbox attribute must include ${r.join(` and `)} for the render proxy to load`)},Z=async({iframe:e,domains:n=[],syncCookies:r=!0,lockdown:i=!1})=>{if(typeof window>`u`)throw Error(`cloud.attachFrame needs a window realm`);if(i)throw Error(`cloud.attachFrame does not support lockdown; use the extension backend for a sealed frame`);if(!e.isConnected)throw Error(`cloud.attachFrame: the iframe must be connected to the document before attaching`);X(e);let a=e.getAttribute(`src`)??``,o=(()=>{if(V(a))return null;try{return new URL(e.src||a,location.href)}catch{throw Error(`cloud.attachFrame: the iframe src is not a valid URL: ${a}`)}})();if(o){let e=new URL(`/attach-frame`,B());if(o.origin===e.origin&&o.pathname===e.pathname)throw Error(`cloud.attachFrame: this iframe is already attached; navigate with the Frame returned by that attach or use a fresh iframe`)}let s=o?.href??``;s&&t.s(s);let c=s,u=H(r),d=new AbortController,f=e.referrerPolicy,p=e.allow;if(e.referrerPolicy=`origin`,e.allow=q(F,e.allow),e.src=U({target:s,session:u}),!e.contentWindow)throw Error(`cloud.attachFrame: the iframe window is not available`);try{let n=await W((0,l.expose)({},{key:`fkn-attach-frame`,origin:B(),transport:{receive:window,emit:e.contentWindow},unregisterSignal:d.signal,revivableModules:P(t.I)}),I,`cloud.attachFrame: timed out connecting to the render proxy page`);await W(n.ready(),L,`cloud.attachFrame: the render proxy never became ready`),s&&Y(e),G(e,()=>d.abort());let r=e.contentWindow,i=()=>{if(!(!d.signal.aborted&&e.isConnected&&e.contentWindow===r))throw d.abort(),K()};return t.a({executor:{execute:(e,t,r)=>z.has(t)?Promise.reject(v(t,`cloud`)):(i(),n.executeLocator(e,t,r)),highlight:async()=>{}},goto:async(t,r={})=>{let a=new URL(t,location.href).href;i();let{timeoutMs:o}=r;await W(n.goto(a,r),(o??ne)+R,`cloud.attachFrame: the render proxy did not answer goto; the frame may have been detached or its page reloaded`),c=a,Y(e)},url:()=>c})}catch(t){throw d.abort(),e.referrerPolicy=f,e.allow=p,e.src=s||`about:blank`,t}},re=()=>typeof window<`u`&&!0,Q=async()=>{let e=await n.t.then(e=>e.cloud.quota());return{premium:e.premium,overQuota:e.overQuota,throttled:e.overQuota&&!e.premium,usedBytes:e.usedBytes,limitBytes:e.limitBytes,remainingBytes:e.remaining,bytesPerSecond:e.bytesPerSecond,bitsPerSecond:e.bytesPerSecond*8}},ie=e.t({attachFrame:()=>Z,available:()=>$,dgram:()=>s.i,dns:()=>i.t,fetch:()=>r.t,fs:()=>a.t,http:()=>c.t,net:()=>o.s,quota:()=>Q}),$=()=>n.r;Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return $}});
|