@fkn/lib 0.9.73 → 0.9.74
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-URj9bMMj.js → account-CTOhAc2x.js} +2 -2
- package/{account-BdwCDacQ.cjs → account-DO7KokEs.cjs} +1 -1
- package/{account-generation--7m_60Fl.cjs → account-generation-6F54U_B3.cjs} +1 -1
- package/{account-generation-DgK9YHiL.js → account-generation-Cq_xRcUr.js} +1 -1
- package/{account-C9w41S0_.d.ts → account-kRplShh-.d.ts} +1 -1
- package/{account-storage-CcdeHbnj.js → account-storage-DQryXWDZ.js} +2 -2
- package/{account-storage-CQ8k71N3.cjs → account-storage-f0HN_zgo.cjs} +1 -1
- package/account.cjs +1 -1
- package/account.d.ts +2 -2
- package/account.js +1 -1
- package/{api-iKK1u-V0.d.ts → api-CXvE64Jr.d.ts} +2 -2
- package/{api-De7vAubY.js → api-DR6y3Q0Y.js} +152 -135
- package/api-RuHgAkxf.cjs +3 -0
- package/api.cjs +1 -1
- package/api.d.ts +2 -2
- package/api.js +1 -1
- package/cloud/dgram.cjs +1 -1
- package/cloud/dgram.d.ts +1 -1
- package/cloud/dgram.js +1 -1
- package/cloud/dns.cjs +1 -1
- package/cloud/dns.d.ts +2 -2
- package/cloud/dns.js +1 -1
- package/cloud/fetch.cjs +1 -1
- package/cloud/fetch.d.ts +1 -1
- package/cloud/fetch.js +1 -1
- package/cloud/fs/promises.cjs +1 -1
- package/cloud/fs/promises.js +1 -1
- package/cloud/fs.cjs +1 -1
- package/cloud/fs.js +2 -2
- package/cloud/http.cjs +1 -1
- package/cloud/http.d.ts +1 -1
- package/cloud/http.js +1 -1
- package/cloud/net.cjs +1 -1
- package/cloud/net.d.ts +1 -1
- package/cloud/net.js +1 -1
- package/{cloud-BDTtnMtj.d.ts → cloud-C9alQ9TA.d.ts} +5 -5
- package/{cloud-Bv_GUwcG.js → cloud-Cn27x6RK.js} +8 -8
- package/{cloud-Buku7KQJ.cjs → cloud-CrKxBmgy.cjs} +1 -1
- package/cloud.cjs +1 -1
- package/cloud.d.ts +6 -6
- package/cloud.js +7 -7
- package/{contract-Cqq1vOqF.d.ts → contract-B-iUk1mJ.d.ts} +1 -1
- package/contract.d.ts +2 -2
- package/{dgram-CYegbMMa.js → dgram-Cj1vkCE9.js} +1 -1
- package/{dgram-BgWDRjw-.cjs → dgram-D7I5nP9w.cjs} +1 -1
- package/{dgram-BggVwnRp.d.ts → dgram-D9DiXmhU.d.ts} +4 -4
- package/dgram.cjs +1 -1
- package/dgram.d.ts +1 -1
- package/dgram.js +1 -1
- package/{dns-DTbLD2s6.js → dns-43gybmwY.js} +1 -1
- package/{dns-DeuTGd8C.d.ts → dns-CfUsfETG.d.ts} +1 -1
- package/{dns-CtxN7cCj.cjs → dns-D8cfGYaF.cjs} +1 -1
- package/dns.cjs +1 -1
- package/dns.d.ts +2 -2
- package/dns.js +1 -1
- package/{extension-DHx7sHE4.cjs → extension-D8Kj6rRT.cjs} +1 -1
- package/{extension-0RxQ4Bor.js → extension-DFeaP0Ou.js} +3 -3
- package/extension.cjs +1 -1
- package/extension.js +2 -2
- package/fs/promises.cjs +1 -1
- package/fs/promises.js +1 -1
- package/{fs-BJdr72O6.js → fs-BnCWJ-jg.js} +1 -1
- package/{fs-BPfRlX_R.cjs → fs-COtIapGm.cjs} +1 -1
- package/{fs-C0RZ54fk.js → fs-DXz_TgC8.js} +3 -3
- package/{fs-1Q6VCx3d.cjs → fs-Dp_8uaZe.cjs} +1 -1
- package/fs.cjs +1 -1
- package/fs.js +2 -2
- package/{http-DkvhaPVT.cjs → http-B72t08kn.cjs} +2 -2
- package/{http-LhyEQ2D8.d.ts → http-D1qvoYf6.d.ts} +1 -1
- package/{http-D-rs8b6m.js → http-DLMUTBb4.js} +2 -2
- package/http.cjs +1 -1
- package/http.d.ts +1 -1
- package/http.js +1 -1
- package/index.cjs +1 -1
- package/index.d.ts +13 -14
- package/index.js +32 -38
- package/{lib-B4Th0aXQ.js → lib-DIxvhbhf.js} +1 -1
- package/{lib-By2YAF1s.cjs → lib-uND2BvAa.cjs} +1 -1
- package/{net-CK_1P9_C.d.ts → net-B0N6hTWu.d.ts} +4 -4
- package/net-D7oBrZbA.cjs +1 -0
- package/{net-C_R3PDi7.js → net-wirsgKVa.js} +26 -25
- package/net.cjs +1 -1
- package/net.d.ts +1 -1
- package/net.js +1 -1
- package/package.json +1 -1
- package/{packages-CNXf-8A8.js → packages-BAc5K4BQ.js} +1 -1
- package/{packages-FCSR6WEw.d.ts → packages-DTs-fy67.d.ts} +1 -1
- package/{packages-BwD1QMOz.cjs → packages-DkKru6li.cjs} +1 -1
- package/packages.cjs +1 -1
- package/packages.d.ts +2 -2
- package/packages.js +1 -1
- package/{proxy-Xe45WiQU.d.ts → proxy-1E6vjFKx.d.ts} +2 -2
- package/{proxy-OrF-WHyi.js → proxy-BmptuWKa.js} +1 -1
- package/{proxy-CgISk6T6.cjs → proxy-CLsTNt40.cjs} +1 -1
- package/{relay-choice-BhdjlopH.d.ts → relay-choice-BeNCw3ba.d.ts} +1 -1
- package/{rooms-lJGFgMXH.d.ts → rooms-APVrHbvL.d.ts} +1 -1
- package/{rooms-B_sM_Z93.cjs → rooms-BJ5MQq-S.cjs} +1 -1
- package/{rooms-Dz13jhtS.js → rooms-a1_jHEhL.js} +1 -1
- package/rooms.cjs +1 -1
- package/rooms.d.ts +2 -2
- package/rooms.js +1 -1
- package/{storage-Dd3miXPI.js → storage-ChE9vSDe.js} +3 -3
- package/{storage-B49NeC-h.cjs → storage-D9_L4Coi.cjs} +1 -1
- package/{storage-ngeijVxI.d.ts → storage-YQNVOwp8.d.ts} +1 -1
- package/storage.cjs +1 -1
- package/storage.d.ts +2 -2
- package/storage.js +1 -1
- package/websocket.cjs +1 -1
- package/websocket.js +1 -1
- package/{wire-DhmLnYEU.d.ts → wire-Cddfpu2U.d.ts} +12 -1
- package/wire.cjs +1 -1
- package/wire.d.ts +2 -2
- package/wire.js +6 -2
- package/api-BORAfb8e.cjs +0 -3
- package/net-B3SziNT3.cjs +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-CGnMp29N.js";
|
|
2
|
-
import { l as t, o as n } from "./api-
|
|
3
|
-
import { i as r } from "./account-generation-
|
|
2
|
+
import { l as t, o as n } from "./api-DR6y3Q0Y.js";
|
|
3
|
+
import { i as r } from "./account-generation-Cq_xRcUr.js";
|
|
4
4
|
// src/account.ts
|
|
5
5
|
var i = /* @__PURE__ */ e({
|
|
6
6
|
info: () => s,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-
|
|
1
|
+
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-RuHgAkxf.cjs"),n=require("./account-generation-6F54U_B3.cjs");var r=e.t({info:()=>o,login:()=>i,logout:()=>a,onChange:()=>s}),i=async()=>typeof window>`u`?!1:(await t.o).account.login(location.origin).catch(()=>!1),a=async()=>{typeof window<`u`&&await(await t.o).account.logout().catch(()=>{})},o=async()=>{if(typeof window>`u`)return null;let e=await t.o.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},s=async e=>t.l?n.i(e):()=>{};Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./api-
|
|
1
|
+
const e=require("./api-RuHgAkxf.cjs");var t=0,n=new Set,r=2e3,i=null,a=e=>{let r=e?.switched!==!1;r&&(t+=1,i&&=(clearTimeout(i.timer),null));for(let e of[...n])try{e({switched:r})}catch{}},o=!1,s=0,c=()=>{let t=e.c();t&&s!==t.epoch&&(s=t.epoch,Promise.resolve(t.remote.account.onChange(a)).catch(()=>{s===t.epoch&&(s=0)}))},l=()=>{!o&&e.l&&(o=!0,e.u(c))},u=()=>t,d=e=>(n.add(e),l(),()=>{n.delete(e)}),f=e=>{if(e!==t||i?.generation===e)return;let n=setTimeout(()=>{i?.timer===n&&(i=null,t===e&&a({switched:!0}))},r);i={generation:e,timer:n}};Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return u}});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-CGnMp29N.js";
|
|
2
|
-
import { o as t } from "./api-
|
|
2
|
+
import { o as t } from "./api-DR6y3Q0Y.js";
|
|
3
3
|
import { STORAGE_ACCOUNT_CHANGED as n, STORAGE_ACCOUNT_PIN_UNSUPPORTED as r, STORAGE_NOT_FOUND as i } from "./messages.js";
|
|
4
|
-
import { n as a, r as o, t as s } from "./account-generation-
|
|
4
|
+
import { n as a, r as o, t as s } from "./account-generation-Cq_xRcUr.js";
|
|
5
5
|
// src/account-storage.ts
|
|
6
6
|
var c = /* @__PURE__ */ e({
|
|
7
7
|
StorageAccountChangedError: () => f,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-
|
|
1
|
+
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-RuHgAkxf.cjs"),n=require("./messages.cjs"),r=require("./account-generation-6F54U_B3.cjs");var i=e.t({StorageAccountChangedError:()=>c,StorageAccountPinUnsupportedError:()=>l,StorageLockedError:()=>a,StorageNotFoundError:()=>o,availability:()=>k,available:()=>w,captureAccount:()=>p,encryption:()=>L,isAccountChanged:()=>u,isInvalidPin:()=>d,isNotFound:()=>s,knownPin:()=>y,list:()=>A,pinFor:()=>b,quota:()=>j,readFile:()=>M,readFileSealed:()=>P,remove:()=>I,unlock:()=>R,writeFile:()=>F}),a=class extends Error{code=`FKN_E2E_LOCKED`;constructor(){super(`storage locked: connect the app again to open encrypted data`)}},o=class extends Error{code=n.STORAGE_NOT_FOUND;constructor(e=`storage: no object at that path`){super(e)}},s=e=>e?.code===n.STORAGE_NOT_FOUND,c=class extends Error{code=n.STORAGE_ACCOUNT_CHANGED;constructor(e=`storage: the signed-in account changed, so this call was not made`){super(e)}},l=class extends Error{code=n.STORAGE_ACCOUNT_PIN_UNSUPPORTED;constructor(e=`storage: the FKN broker cannot pin calls to an account yet, so nothing was sent`){super(e)}},u=e=>e?.code===`FKN_ACCOUNT_CHANGED`||e instanceof Error&&e.message.startsWith(`fkn:account-changed`),d=e=>e instanceof Error&&e.message.startsWith(`fkn:account-pin-invalid`),f=e=>{throw e instanceof Error&&e.message.startsWith(`fkn:e2e-locked`)?new a:s(e)?new o(e.message):u(e)?new c:e instanceof Error&&e.message.startsWith(`fkn:account-pin-unsupported`)?new l:e instanceof Error&&(/^not found$/i.test(e.message)||/\(404\)$/.test(e.message))?new o(e.message):e},p=()=>(r.n(),{generation:r.t()}),m=new Map,h=null,g=e=>typeof e?.accountPin==`function`,_=(e,t)=>{let n=Promise.resolve(t.accountPin()).then(t=>{if(typeof t!=`string`||!t)throw Error(`storage: the broker answered no account pin`);return r.t()===e&&m.set(e,t),t});return h={generation:e,pin:n},n.catch(()=>{h?.pin===n&&(h=null)}),n},v=async(e,t)=>{let n=m.get(e.generation);if(n!==void 0)return n;if(e.generation!==r.t())throw new c;let i=await(h?.generation===e.generation?h.pin:_(e.generation,t)).catch(f);if(e.generation!==r.t())throw new c;return i},y=e=>m.get(e.generation),b=async e=>{let n=(await t.o).cloud.fs;if(!g(n))throw new l;return v(e,n)},x=e=>{for(let[t,n]of m)if(n===e)return t},S=e=>e?.pin??p(),C=async(e,n)=>{let i=(await t.o).cloud.fs;if(!g(i))throw new l;let a=`pin`in e?e.pin:await v(e,i);if(!g(i))throw new l;return n(i,{accountPin:a}).catch(t=>{if(u(t)){let t=`generation`in e?e.generation:x(a);t!==void 0&&r.r(t)}return f(t)})},w=()=>t.o.then(e=>e.cloud.fs.available()).catch(()=>!1),T=8e3,E=1e3,D=!1,O=async()=>{let e=(await t.o).cloud.fs;return typeof e.availability==`function`?e.availability():await e.available()?`connected`:`disconnected`},k=async()=>{let e=D?E:T,t=await new Promise(t=>{let n=setTimeout(()=>t(`timeout`),e);O().then(e=>{clearTimeout(n),t(e)},()=>{clearTimeout(n),t(`unknown`)})});return t===`timeout`?(D=!0,`unknown`):(D=!1,t)},A=e=>C(S(e),(e,t)=>e.list(t)),j=()=>t.o.then(e=>e.cloud.fs.quota()),M=async(e,t)=>{let n=await C(S(t),(t,n)=>t.readFile(e,n));return new Blob([n])},N=e=>{if(e===null||!Number.isFinite(e))return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t.toISOString()},P=async(e,t)=>C(S(t),async(t,n)=>{let r=t;if(typeof r.readFileSealed!=`function`)return{data:await t.readFile(e,n),sealedAt:null};let i=await r.readFileSealed(e,n);return{data:i.bytes,sealedAt:N(i.sealedAt)}}),F=async(e,t,n)=>{let r=S(n),i=t instanceof Blob?new Uint8Array(await t.arrayBuffer()):t;await C(r,(t,r)=>t.writeFile(e,i,n?.contentType??null,r))},I=async(e,t)=>{await C(S(t),(t,n)=>t.remove(e,n))},L=()=>t.o.then(e=>e.cloud.fs.encryption()),R=()=>t.o.then(e=>e.cloud.fs.unlock());Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return R}});
|
package/account.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./account-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./account-DO7KokEs.cjs");exports.info=e.n,exports.login=e.r,exports.logout=e.i,exports.onChange=e.a;
|
package/account.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as AccountChange } from "./contract-
|
|
2
|
-
import { a as logout, i as login, o as onChange, r as info, t as AccountInfo } from "./account-
|
|
1
|
+
import { a as AccountChange } from "./contract-B-iUk1mJ.js";
|
|
2
|
+
import { a as logout, i as login, o as onChange, r as info, t as AccountInfo } from "./account-kRplShh-.js";
|
|
3
3
|
export { type AccountChange, AccountInfo, info, login, logout, onChange };
|
package/account.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { n as info, r as login, i as logout, a as onChange } from "./account-
|
|
1
|
+
export { n as info, r as login, i as logout, a as onChange } from "./account-CTOhAc2x.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { D as RelayChoice } from "./index-HMfzm6dF.js";
|
|
2
|
-
import { B as PickOptions, D as IpFamily, Ft as StoragePutWire, Gt as UdpDatagram, I as PackageQuery, Kt as UdpSocketOptions, N as OverlayState, Q as Resolvers, Qt as WebSocketOptions, R as PackagesErrorCode, T as InstallOptions, U as ProxyFetchInit, Ut as TcpSocketOptions, V as Placement, Vt as TcpSocketListenerOptions, W as ProxyFetchInput, _t as RoomsErrorCode, a as AccountChange, at as RoomEvent, b as FrameConsentAnswer, c as AdoptRequest, d as ConflictRequest, et as RoomClaimOptions, ft as RoomOpenOptions, gt as RoomType, jt as StorageErrorCode, l as AdoptState, lt as RoomMailbox, m as ConnectOptions, o as AccountPinOptions, p as ConnectAvailability, pt as RoomPermission, st as RoomJoinOptions, tn as WriteData, u as ConflictChoice, x as FrameConsentRequest } from "./contract-
|
|
3
|
-
import {
|
|
2
|
+
import { B as PickOptions, D as IpFamily, Ft as StoragePutWire, Gt as UdpDatagram, I as PackageQuery, Kt as UdpSocketOptions, N as OverlayState, Q as Resolvers, Qt as WebSocketOptions, R as PackagesErrorCode, T as InstallOptions, U as ProxyFetchInit, Ut as TcpSocketOptions, V as Placement, Vt as TcpSocketListenerOptions, W as ProxyFetchInput, _t as RoomsErrorCode, a as AccountChange, at as RoomEvent, b as FrameConsentAnswer, c as AdoptRequest, d as ConflictRequest, et as RoomClaimOptions, ft as RoomOpenOptions, gt as RoomType, jt as StorageErrorCode, l as AdoptState, lt as RoomMailbox, m as ConnectOptions, o as AccountPinOptions, p as ConnectAvailability, pt as RoomPermission, st as RoomJoinOptions, tn as WriteData, u as ConflictChoice, x as FrameConsentRequest } from "./contract-B-iUk1mJ.js";
|
|
3
|
+
import { S as UdpSocketOption, s as TcpSocketOption } from "./wire-Cddfpu2U.js";
|
|
4
4
|
import { Remote } from "osra";
|
|
5
5
|
type EpochListener<T> = (remote: T, epoch: number) => void;
|
|
6
6
|
declare const hasTransport: boolean;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { a as e, n as t } from "./broker-frame-AQDD3D9E.js";
|
|
2
|
-
import {
|
|
3
|
-
// src/
|
|
4
|
-
var i =
|
|
2
|
+
import { expose as n, registerOsraMessageListener as r } from "osra";
|
|
3
|
+
// src/keep-listening.ts
|
|
4
|
+
var i = (e, t, n, r) => {
|
|
5
|
+
let i = () => e.addEventListener(t, n, r);
|
|
6
|
+
i();
|
|
7
|
+
let a = new MutationObserver(i);
|
|
8
|
+
return a.observe(e.document, { childList: !0 }), () => {
|
|
9
|
+
a.disconnect(), e.removeEventListener(t, n, r);
|
|
10
|
+
};
|
|
11
|
+
}, a = 1e4, o = 16, s = (e) => {
|
|
5
12
|
let t;
|
|
6
13
|
try {
|
|
7
14
|
t = e.contentWindow;
|
|
@@ -15,58 +22,66 @@ var i = 1e4, a = 16, o = (e) => {
|
|
|
15
22
|
} catch {
|
|
16
23
|
return !0;
|
|
17
24
|
}
|
|
18
|
-
},
|
|
19
|
-
if (
|
|
25
|
+
}, c = (e, t = a) => new Promise((n) => {
|
|
26
|
+
if (s(e)) return n();
|
|
20
27
|
let r = () => {
|
|
21
|
-
clearInterval(i), clearTimeout(
|
|
28
|
+
clearInterval(i), clearTimeout(a), e.removeEventListener("load", r), n();
|
|
22
29
|
}, i = setInterval(() => {
|
|
23
|
-
|
|
24
|
-
},
|
|
30
|
+
s(e) && r();
|
|
31
|
+
}, o), a = setTimeout(r, t);
|
|
25
32
|
e.addEventListener("load", r);
|
|
26
|
-
}),
|
|
27
|
-
let r = 1,
|
|
28
|
-
clearTimeout(
|
|
29
|
-
},
|
|
33
|
+
}), l = 5e3, u = 9e4, d = (e, t, n) => {
|
|
34
|
+
let r = 1, o, c = e.ownerDocument.defaultView, d = () => {
|
|
35
|
+
clearTimeout(o), h?.(), e.removeEventListener("load", m);
|
|
36
|
+
}, f = () => {
|
|
30
37
|
if (e.isConnected) {
|
|
31
|
-
if (r >= 4) return
|
|
32
|
-
r += 1, e.contentWindow?.location.replace(t),
|
|
38
|
+
if (r >= 4) return d(), console.error(`FKN @fkn/lib: ${t} did not load in ${r} tries; reload the page`);
|
|
39
|
+
r += 1, e.contentWindow?.location.replace(t), p(u);
|
|
33
40
|
}
|
|
34
|
-
},
|
|
35
|
-
clearTimeout(
|
|
36
|
-
},
|
|
37
|
-
t.source === e.contentWindow && t.origin === n &&
|
|
38
|
-
};
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
},
|
|
41
|
+
}, p = (e) => {
|
|
42
|
+
clearTimeout(o), o = setTimeout(f, e);
|
|
43
|
+
}, m = () => p(l), h = c ? i(c, "message", (t) => {
|
|
44
|
+
t.source === e.contentWindow && t.origin === n && d();
|
|
45
|
+
}) : void 0;
|
|
46
|
+
if (e.addEventListener("load", m), s(e)) return p(l);
|
|
47
|
+
o = setTimeout(() => s(e) ? p(8e4) : f(), a);
|
|
48
|
+
}, f = (e, t) => ({
|
|
49
|
+
receive: (n) => i(e.ownerDocument.defaultView, "message", (e) => {
|
|
50
|
+
e.origin === t && n(e.data, {
|
|
51
|
+
source: e.source,
|
|
52
|
+
origin: t
|
|
53
|
+
});
|
|
54
|
+
}),
|
|
55
|
+
emit: (n, r) => e.contentWindow?.postMessage(n, t, r)
|
|
56
|
+
}), p = 32, m = 8, h = 120, g = typeof CSS < "u" && CSS.supports("clip-path", "path('M0 0H1V1H0Z')"), ee = typeof CSS < "u" && CSS.supports("clip-path", "polygon(nonzero, 0px 0px, 1px 0px, 1px 1px)"), te = "light dark", ne = (e) => {
|
|
42
57
|
let t = e.style;
|
|
43
|
-
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",
|
|
44
|
-
},
|
|
58
|
+
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", te), t.setProperty("z-index", "2147483647"), e.setAttribute("title", "FKN");
|
|
59
|
+
}, re = ({ x: e, y: t, width: n, height: r, radius: i }) => {
|
|
45
60
|
if (!i) return `M${e} ${t}h${n}v${r}h${-n}Z`;
|
|
46
61
|
let a = Math.min(n, r) / 2, [o, s, c, l] = i.map((e) => Math.max(0, Math.min(e, a)));
|
|
47
62
|
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`;
|
|
48
|
-
},
|
|
63
|
+
}, ie = () => g && ee, _ = ({ x: e, y: t, width: n, height: r }) => [
|
|
49
64
|
[e, t],
|
|
50
65
|
[e + n, t],
|
|
51
66
|
[e + n, t + r],
|
|
52
67
|
[e, t + r],
|
|
53
68
|
[e, t]
|
|
54
|
-
],
|
|
69
|
+
], ae = (e) => {
|
|
55
70
|
let t = e[0];
|
|
56
71
|
if (!t) return [];
|
|
57
72
|
let n = _(t)[0], r = [];
|
|
58
73
|
return e.forEach((t, i) => {
|
|
59
74
|
r.push(..._(t)), i > 0 && i < e.length - 1 && r.push(n);
|
|
60
75
|
}), r;
|
|
61
|
-
},
|
|
76
|
+
}, oe = (e) => `polygon(nonzero, ${ae(e).map(([e, t]) => `${e}px ${t}px`).join(", ")})`, se = ({ x: e, y: t, width: n, height: r, radius: i }, a) => {
|
|
62
77
|
let o = `${t}px ${a.width - e - n}px ${a.height - t - r}px ${e}px`;
|
|
63
78
|
return i ? `inset(${o} round ${i.map((e) => `${e}px`).join(" ")})` : `inset(${o})`;
|
|
64
|
-
},
|
|
79
|
+
}, ce = (e, t, n) => {
|
|
65
80
|
if (t) return "none";
|
|
66
81
|
if (e.length === 0) return "inset(100%)";
|
|
67
82
|
let r = e.length === 1 ? e[0] : void 0;
|
|
68
|
-
return r ?
|
|
69
|
-
},
|
|
83
|
+
return r ? se(r, n) : ee && e.length <= 5 && !e.some((e) => e.radius) ? oe(e) : `path('${e.map(re).join("")}')`;
|
|
84
|
+
}, le = (e) => {
|
|
70
85
|
if (e.length < 2) return null;
|
|
71
86
|
let t = Math.min(...e.map((e) => e.x)), n = Math.min(...e.map((e) => e.y));
|
|
72
87
|
return {
|
|
@@ -75,14 +90,14 @@ var i = 1e4, a = 16, o = (e) => {
|
|
|
75
90
|
width: Math.max(...e.map((e) => e.x + e.width)) - t,
|
|
76
91
|
height: Math.max(...e.map((e) => e.y + e.height)) - n
|
|
77
92
|
};
|
|
78
|
-
},
|
|
93
|
+
}, ue = (e, t, n) => t >= e.x && t < e.x + e.width && n >= e.y && n < e.y + e.height, de = 16, v = (e, t, n) => t === 1 ? e * de : t === 2 ? e * n : e, y = (e, t, n, r, i) => {
|
|
79
94
|
let a = t ? r : 0, o = n ? i : 0;
|
|
80
95
|
return a || o ? {
|
|
81
96
|
target: e,
|
|
82
97
|
left: a,
|
|
83
98
|
top: o
|
|
84
99
|
} : null;
|
|
85
|
-
},
|
|
100
|
+
}, fe = (e, t, n) => {
|
|
86
101
|
let r = document.documentElement, i = getComputedStyle(r), a = i.overflowX === "visible" && i.overflowY === "visible" && document.body ? document.body : r;
|
|
87
102
|
for (let r = e; r && r !== a; r = r.parentElement) {
|
|
88
103
|
let e = getComputedStyle(r), i = /auto|scroll/.test(e.overflowX) && r.scrollWidth > r.clientWidth, a = /auto|scroll/.test(e.overflowY) && r.scrollHeight > r.clientHeight, o = y(r, i, a, t, n);
|
|
@@ -93,48 +108,48 @@ var i = 1e4, a = 16, o = (e) => {
|
|
|
93
108
|
}, b = null, x = null, S = (e) => ({
|
|
94
109
|
width: e.offsetWidth || window.innerWidth,
|
|
95
110
|
height: e.offsetHeight || window.innerHeight
|
|
96
|
-
}),
|
|
97
|
-
if (!x || !b || !
|
|
111
|
+
}), pe = (e) => {
|
|
112
|
+
if (!x || !b || !ue(x, e.clientX, e.clientY)) return;
|
|
98
113
|
let t = document.fullscreenElement;
|
|
99
114
|
if (t && !t.contains(b)) return;
|
|
100
115
|
let n = document.elementFromPoint(e.clientX, e.clientY);
|
|
101
116
|
if (!n || n === b) return;
|
|
102
117
|
let r = n.closest(":is(:modal, :popover-open)");
|
|
103
118
|
if (r && !r.contains(b)) return;
|
|
104
|
-
let i =
|
|
119
|
+
let i = fe(n, v(e.deltaX, e.deltaMode, window.innerWidth), v(e.deltaY, e.deltaMode, window.innerHeight));
|
|
105
120
|
i && (i.target.scrollBy({
|
|
106
121
|
left: i.left,
|
|
107
122
|
top: i.top,
|
|
108
123
|
behavior: "instant"
|
|
109
124
|
}), e.cancelable && e.preventDefault());
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
x = e, t !== (e !== null) && (e ? window.addEventListener("wheel", C, {
|
|
125
|
+
}, C, me = (e) => {
|
|
126
|
+
x = e, e ? C ??= i(window, "wheel", pe, {
|
|
113
127
|
capture: !0,
|
|
114
128
|
passive: !1
|
|
115
|
-
}) :
|
|
116
|
-
}, w = 0,
|
|
117
|
-
|
|
118
|
-
w
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
129
|
+
}) : (C?.(), C = void 0);
|
|
130
|
+
}, w = 0, T = null, he = (e) => {
|
|
131
|
+
let t = document.documentElement;
|
|
132
|
+
if (!t || e === w && (e === 0 || t === T)) return;
|
|
133
|
+
w = e, T = t;
|
|
134
|
+
let n = t.style;
|
|
135
|
+
e > 0 ? (n.setProperty("margin-top", `${e}px`, "important"), n.setProperty("--fkn-inset-top", `${e}px`)) : (n.removeProperty("margin-top"), n.removeProperty("--fkn-inset-top"));
|
|
136
|
+
}, E = (e, t) => {
|
|
122
137
|
t ? (e.removeAttribute("tabindex"), e.removeAttribute("aria-hidden")) : (e.setAttribute("tabindex", "-1"), e.setAttribute("aria-hidden", "true"));
|
|
123
|
-
},
|
|
124
|
-
if (
|
|
138
|
+
}, D = (e, { modal: t, rects: n, inset: r }, i) => {
|
|
139
|
+
if (he(r), !g) {
|
|
125
140
|
let r = t || n.length > 0;
|
|
126
|
-
|
|
141
|
+
E(e, r), e.style.setProperty("pointer-events", r ? "auto" : "none", "important"), e.style.setProperty("visibility", r ? "visible" : "hidden", "important");
|
|
127
142
|
return;
|
|
128
143
|
}
|
|
129
|
-
let a =
|
|
130
|
-
e.style.setProperty("clip-path", o, "important"),
|
|
131
|
-
},
|
|
144
|
+
let a = ce(n, t, i), o = a === "none" || CSS.supports("clip-path", a) ? a : "inset(100%)";
|
|
145
|
+
e.style.setProperty("clip-path", o, "important"), E(e, o !== "inset(100%)"), me(t || o !== a ? null : le(n));
|
|
146
|
+
}, ge = (e) => {
|
|
132
147
|
if (typeof e != "object" || !e) return 0;
|
|
133
148
|
let { top: t } = e;
|
|
134
|
-
return typeof t != "number" || !Number.isFinite(t) || t <= 0 ? 0 : Math.min(Math.round(t),
|
|
135
|
-
},
|
|
149
|
+
return typeof t != "number" || !Number.isFinite(t) || t <= 0 ? 0 : Math.min(Math.round(t), h);
|
|
150
|
+
}, _e = (e) => {
|
|
136
151
|
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;
|
|
137
|
-
},
|
|
152
|
+
}, ve = (e, t) => {
|
|
138
153
|
if (typeof e != "object" || !e) return null;
|
|
139
154
|
let { x: n, y: r, width: i, height: a } = e;
|
|
140
155
|
if (![
|
|
@@ -143,7 +158,7 @@ var i = 1e4, a = 16, o = (e) => {
|
|
|
143
158
|
i,
|
|
144
159
|
a
|
|
145
160
|
].every((e) => typeof e == "number" && Number.isFinite(e))) return null;
|
|
146
|
-
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 =
|
|
161
|
+
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 = _e(e.radius);
|
|
147
162
|
return {
|
|
148
163
|
x: c,
|
|
149
164
|
y: l,
|
|
@@ -151,49 +166,49 @@ var i = 1e4, a = 16, o = (e) => {
|
|
|
151
166
|
height: d - l,
|
|
152
167
|
...f ? { radius: f } : {}
|
|
153
168
|
};
|
|
154
|
-
},
|
|
169
|
+
}, O = {
|
|
155
170
|
"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",
|
|
156
171
|
clipped: "it is clipped away or positioned outside the viewport",
|
|
157
172
|
"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"
|
|
158
|
-
},
|
|
173
|
+
}, ye = (e) => Array.isArray(e) ? e.slice(0, m).flatMap((e) => {
|
|
159
174
|
if (typeof e != "object" || !e) return [];
|
|
160
175
|
let { kind: t, cause: n, level: r } = e;
|
|
161
|
-
return typeof t != "string" || t.length > 40 || typeof n != "string" || !(n in
|
|
176
|
+
return typeof t != "string" || t.length > 40 || typeof n != "string" || !(n in O) || r !== "full" && r !== "liveness" ? [] : [{
|
|
162
177
|
kind: t,
|
|
163
178
|
cause: n,
|
|
164
179
|
level: r
|
|
165
180
|
}];
|
|
166
|
-
}) : [],
|
|
167
|
-
for (let { kind: t, cause: n, level: r } of e)
|
|
181
|
+
}) : [], k = /* @__PURE__ */ new Set(), be = (e) => {
|
|
182
|
+
for (let { kind: t, cause: n, level: r } of e) k.has(t) || (k.add(t), console.error(`[FKN] The FKN ${JSON.stringify(t)} is not visible on this page: ${O[n]}. Nobody using this page can see or answer it.
|
|
168
183
|
@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." : "")));
|
|
169
|
-
},
|
|
184
|
+
}, A = (e, t) => {
|
|
170
185
|
if (typeof e != "object" || !e) return null;
|
|
171
|
-
let n = e, r = (Array.isArray(n.rects) ? n.rects.slice(0,
|
|
186
|
+
let n = e, r = (Array.isArray(n.rects) ? n.rects.slice(0, p) : []).map((e) => ve(e, t)).filter((e) => e !== null && e.width > 0 && e.height > 0);
|
|
172
187
|
return {
|
|
173
188
|
modal: n.modal === !0,
|
|
174
189
|
rects: r,
|
|
175
|
-
hidden:
|
|
176
|
-
inset:
|
|
190
|
+
hidden: ye(n.hidden),
|
|
191
|
+
inset: ge(n.inset)
|
|
177
192
|
};
|
|
178
|
-
},
|
|
179
|
-
if (!b ||
|
|
180
|
-
let e = S(b), t =
|
|
181
|
-
t &&
|
|
182
|
-
},
|
|
183
|
-
typeof ResizeObserver < "u" && (
|
|
184
|
-
},
|
|
185
|
-
|
|
193
|
+
}, xe = () => b !== null, j = null, M = null, Se = () => {
|
|
194
|
+
if (!b || j === null) return;
|
|
195
|
+
let e = S(b), t = A(j, e);
|
|
196
|
+
t && D(b, t, e);
|
|
197
|
+
}, Ce = (e) => {
|
|
198
|
+
typeof ResizeObserver < "u" && (M ??= new ResizeObserver(Se), M.disconnect(), M.observe(e));
|
|
199
|
+
}, we = (e) => {
|
|
200
|
+
ne(e), D(e, {
|
|
186
201
|
modal: !1,
|
|
187
202
|
rects: [],
|
|
188
203
|
hidden: [],
|
|
189
204
|
inset: 0
|
|
190
|
-
}, S(e)), b = e,
|
|
191
|
-
},
|
|
205
|
+
}, S(e)), b = e, Ce(e);
|
|
206
|
+
}, Te = (e) => {
|
|
192
207
|
if (!b) return;
|
|
193
|
-
let t = S(b), n =
|
|
194
|
-
n && (
|
|
195
|
-
},
|
|
196
|
-
if (!
|
|
208
|
+
let t = S(b), n = A(e, t);
|
|
209
|
+
n && (j = e, D(b, n, t), be(n.hidden));
|
|
210
|
+
}, N = "https://fkn.app", P = typeof globalThis < "u" && globalThis.document ? globalThis.document : void 0, F = typeof globalThis < "u" && globalThis.crossOriginIsolated === !0, I = t(F), Ee = "fkn-api-port", De = "fkn-api-port-ack", Oe = 2e3, ke = () => {
|
|
211
|
+
if (!P || typeof window > "u" || window.parent === window) return Promise.resolve(void 0);
|
|
197
212
|
let e;
|
|
198
213
|
try {
|
|
199
214
|
e = window.parent;
|
|
@@ -208,37 +223,34 @@ var i = 1e4, a = 16, o = (e) => {
|
|
|
208
223
|
} catch {}
|
|
209
224
|
n(e);
|
|
210
225
|
}, i = (e) => {
|
|
211
|
-
e.data?.type ===
|
|
212
|
-
}, a = setTimeout(() => r(void 0),
|
|
226
|
+
e.data?.type === De && r(t.port1);
|
|
227
|
+
}, a = setTimeout(() => r(void 0), Oe);
|
|
213
228
|
t.port1.addEventListener("message", i), t.port1.start();
|
|
214
229
|
try {
|
|
215
|
-
e.postMessage({ type:
|
|
230
|
+
e.postMessage({ type: Ee }, N, [t.port2]);
|
|
216
231
|
} catch {
|
|
217
232
|
r(void 0);
|
|
218
233
|
}
|
|
219
234
|
});
|
|
220
|
-
},
|
|
221
|
-
if (
|
|
222
|
-
let t =
|
|
223
|
-
if (t)
|
|
235
|
+
}, L, Ae = () => {
|
|
236
|
+
if (L || !P) return L;
|
|
237
|
+
let t = P.querySelector(`iframe[src="${I}"]`);
|
|
238
|
+
if (t) L = t;
|
|
224
239
|
else {
|
|
225
|
-
let t =
|
|
226
|
-
t.setAttribute("allow", e(
|
|
240
|
+
let t = P.createElement("iframe");
|
|
241
|
+
t.setAttribute("allow", e(F)), t.src = I, P.body.appendChild(t), L = t;
|
|
227
242
|
}
|
|
228
|
-
return
|
|
229
|
-
},
|
|
230
|
-
if (!
|
|
231
|
-
let e = await
|
|
243
|
+
return d(L, I, N), we(L), L;
|
|
244
|
+
}, R = (async () => {
|
|
245
|
+
if (!P) return;
|
|
246
|
+
let e = await ke();
|
|
232
247
|
if (e) return {
|
|
233
248
|
receive: e,
|
|
234
249
|
emit: e
|
|
235
250
|
};
|
|
236
|
-
let t =
|
|
237
|
-
if (t
|
|
238
|
-
|
|
239
|
-
emit: (e, n) => t.contentWindow?.postMessage(e, M, n)
|
|
240
|
-
};
|
|
241
|
-
})(), Oe = (e, { boundRetired: t = (e) => e } = {}) => {
|
|
251
|
+
let t = Ae();
|
|
252
|
+
if (t) return await c(t), t.contentWindow ? f(t, N) : void 0;
|
|
253
|
+
})(), je = (e, { boundRetired: t = (e) => e } = {}) => {
|
|
242
254
|
let n, r = 0, i = !1, a = () => {}, o = () => new Promise((e) => {
|
|
243
255
|
a = e;
|
|
244
256
|
}), s = o(), c = s, l = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), d = 0, f = 0, p = () => {
|
|
@@ -314,52 +326,57 @@ var i = 1e4, a = 16, o = (e) => {
|
|
|
314
326
|
i = !0, n = void 0, p();
|
|
315
327
|
}
|
|
316
328
|
};
|
|
317
|
-
},
|
|
318
|
-
if (!
|
|
319
|
-
|
|
320
|
-
for (let e of [...
|
|
329
|
+
}, z = !1, B = /* @__PURE__ */ new Set(), V = () => z, Me = () => {
|
|
330
|
+
if (!z) {
|
|
331
|
+
z = !0;
|
|
332
|
+
for (let e of [...B]) try {
|
|
321
333
|
e();
|
|
322
334
|
} catch {}
|
|
323
|
-
|
|
335
|
+
B.clear();
|
|
324
336
|
}
|
|
325
|
-
},
|
|
326
|
-
|
|
327
|
-
},
|
|
328
|
-
if (typeof window < "u") return
|
|
337
|
+
}, H = (e) => {
|
|
338
|
+
z ? e() : B.add(e);
|
|
339
|
+
}, Ne = typeof window < "u" || typeof self < "u", U = async () => {
|
|
340
|
+
if (typeof window < "u") return R;
|
|
329
341
|
if (typeof self < "u") return {
|
|
330
342
|
receive: self,
|
|
331
343
|
emit: self
|
|
332
344
|
};
|
|
333
|
-
},
|
|
334
|
-
let e = await
|
|
345
|
+
}, W = "fkn-api", Pe = "fkn-api-window", Fe = { async *[Symbol.asyncIterator]() {
|
|
346
|
+
let e = await U();
|
|
335
347
|
if (!e) await new Promise(() => {});
|
|
336
348
|
else {
|
|
337
|
-
if (!
|
|
349
|
+
if (!V()) {
|
|
338
350
|
let t = new AbortController();
|
|
339
|
-
|
|
340
|
-
for await (let
|
|
341
|
-
key:
|
|
351
|
+
H(() => t.abort());
|
|
352
|
+
for await (let r of n({}, {
|
|
353
|
+
key: W,
|
|
342
354
|
transport: e,
|
|
343
355
|
unregisterSignal: t.signal
|
|
344
356
|
})) {
|
|
345
357
|
if (t.signal.aborted) break;
|
|
346
|
-
yield
|
|
358
|
+
yield r;
|
|
347
359
|
}
|
|
348
360
|
}
|
|
349
|
-
yield*
|
|
350
|
-
key:
|
|
361
|
+
yield* n({}, {
|
|
362
|
+
key: Pe,
|
|
351
363
|
transport: e
|
|
352
364
|
});
|
|
353
365
|
}
|
|
354
|
-
} },
|
|
366
|
+
} }, G = !1, K = U().then((e) => new Promise((t) => {
|
|
355
367
|
if (!e) return;
|
|
356
|
-
let
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
368
|
+
let n = new AbortController();
|
|
369
|
+
r({
|
|
370
|
+
transport: e,
|
|
371
|
+
key: W,
|
|
372
|
+
unregisterSignal: n.signal,
|
|
373
|
+
listener: () => {
|
|
374
|
+
n.abort(), G = !0, t();
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
})), q = je(Fe, { boundRetired: (e) => Promise.race([e, K.then(() => Q(e, () => new Z()))]) });
|
|
378
|
+
H(() => q.retire());
|
|
379
|
+
var J = Promise.race([q.first, new Promise((e) => H(e))]).then(() => q.facade), Y = 8e3, Ie = 1e3, Le = !1, X = class extends Error {
|
|
363
380
|
constructor(e, t) {
|
|
364
381
|
super(`@fkn/lib: no broker connection within ${t}ms, so ${e} could not be requested`), this.name = "BrokerUnreachableError";
|
|
365
382
|
}
|
|
@@ -368,22 +385,22 @@ var q = Promise.race([K.first, new Promise((e) => V(e))]).then(() => K.facade),
|
|
|
368
385
|
super("FKN @fkn/lib: this page relays its FKN channel to a worker, and the FKN page it reached predates a channel of the page's own; reload"), this.name = "OwnChannelUnavailableError";
|
|
369
386
|
}
|
|
370
387
|
}, Q = (e, t) => {
|
|
371
|
-
let n =
|
|
388
|
+
let n = Le ? Ie : Y;
|
|
372
389
|
return Promise.race([e, new Promise((e, r) => setTimeout(() => {
|
|
373
|
-
|
|
390
|
+
Le = !0, r(t(n));
|
|
374
391
|
}, n))]);
|
|
375
|
-
},
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
let e = setTimeout(() => console.error(new Z()),
|
|
379
|
-
|
|
392
|
+
}, Re = (e) => V() ? Q(q.routable().then(() => q.facade), (t) => G ? new Z() : new X(e, t)) : Q(J, (t) => new X(e, t));
|
|
393
|
+
H(() => {
|
|
394
|
+
K.then(() => {
|
|
395
|
+
let e = setTimeout(() => console.error(new Z()), Y);
|
|
396
|
+
q.routable().then(() => clearTimeout(e));
|
|
380
397
|
});
|
|
381
398
|
});
|
|
382
|
-
var $ =
|
|
399
|
+
var $ = q.onEpoch, ze = q.current, Be = q.lastCall, Ve = q.inFlight;
|
|
383
400
|
$((e) => {
|
|
384
|
-
|
|
385
|
-
exactClips:
|
|
386
|
-
colorScheme:
|
|
401
|
+
xe() && e.overlay.setHost(Te, {
|
|
402
|
+
exactClips: ie(),
|
|
403
|
+
colorScheme: te
|
|
387
404
|
}).catch(() => {});
|
|
388
405
|
});
|
|
389
|
-
export {
|
|
406
|
+
export { Be as a, ze as c, Me as d, R as f, Ve as i, Ne as l, X as n, J as o, Z as r, Re as s, Y as t, $ as u };
|
package/api-RuHgAkxf.cjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const e=require("./broker-frame-cVEhez7A.cjs");let t=require("osra");var n=(e,t,n,r)=>{let i=()=>e.addEventListener(t,n,r);i();let a=new MutationObserver(i);return a.observe(e.document,{childList:!0}),()=>{a.disconnect(),e.removeEventListener(t,n,r)}},r=1e4,i=16,a=e=>{let t;try{t=e.contentWindow}catch{return!0}if(!t)return!0;try{let e=t.location.href;return e!==``&&e!==`about:blank`}catch{return!0}},o=(e,t=r)=>new Promise(n=>{if(a(e))return n();let r=()=>{clearInterval(o),clearTimeout(s),e.removeEventListener(`load`,r),n()},o=setInterval(()=>{a(e)&&r()},i),s=setTimeout(r,t);e.addEventListener(`load`,r)}),s=5e3,c=9e4,l=(e,t,i)=>{let o=1,l,u=e.ownerDocument.defaultView,d=()=>{clearTimeout(l),h?.(),e.removeEventListener(`load`,m)},f=()=>{if(e.isConnected){if(o>=4)return d(),console.error(`FKN @fkn/lib: ${t} did not load in ${o} tries; reload the page`);o+=1,e.contentWindow?.location.replace(t),p(c)}},p=e=>{clearTimeout(l),l=setTimeout(f,e)},m=()=>p(s),h=u?n(u,`message`,t=>{t.source===e.contentWindow&&t.origin===i&&d()}):void 0;if(e.addEventListener(`load`,m),a(e))return p(s);l=setTimeout(()=>a(e)?p(8e4):f(),r)},u=(e,t)=>({receive:r=>n(e.ownerDocument.defaultView,`message`,e=>{e.origin===t&&r(e.data,{source:e.source,origin:t})}),emit:(n,r)=>e.contentWindow?.postMessage(n,t,r)}),d=32,f=8,p=120,m=typeof CSS<`u`&&CSS.supports(`clip-path`,`path('M0 0H1V1H0Z')`),h=typeof CSS<`u`&&CSS.supports(`clip-path`,`polygon(nonzero, 0px 0px, 1px 0px, 1px 1px)`),g=`light dark`,ee=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(`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`,g),t.setProperty(`z-index`,`2147483647`),e.setAttribute(`title`,`FKN`)},te=({x:e,y:t,width:n,height:r,radius:i})=>{if(!i)return`M${e} ${t}h${n}v${r}h${-n}Z`;let a=Math.min(n,r)/2,[o,s,c,l]=i.map(e=>Math.max(0,Math.min(e,a)));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`},ne=()=>m&&h,_=({x:e,y:t,width:n,height:r})=>[[e,t],[e+n,t],[e+n,t+r],[e,t+r],[e,t]],re=e=>{let t=e[0];if(!t)return[];let n=_(t)[0],r=[];return e.forEach((t,i)=>{r.push(..._(t)),i>0&&i<e.length-1&&r.push(n)}),r},ie=e=>`polygon(nonzero, ${re(e).map(([e,t])=>`${e}px ${t}px`).join(`, `)})`,ae=({x:e,y:t,width:n,height:r,radius:i},a)=>{let o=`${t}px ${a.width-e-n}px ${a.height-t-r}px ${e}px`;return i?`inset(${o} round ${i.map(e=>`${e}px`).join(` `)})`:`inset(${o})`},oe=(e,t,n)=>{if(t)return`none`;if(e.length===0)return`inset(100%)`;let r=e.length===1?e[0]:void 0;return r?ae(r,n):h&&e.length<=5&&!e.some(e=>e.radius)?ie(e):`path('${e.map(te).join(``)}')`},se=e=>{if(e.length<2)return null;let t=Math.min(...e.map(e=>e.x)),n=Math.min(...e.map(e=>e.y));return{x:t,y:n,width:Math.max(...e.map(e=>e.x+e.width))-t,height:Math.max(...e.map(e=>e.y+e.height))-n}},ce=(e,t,n)=>t>=e.x&&t<e.x+e.width&&n>=e.y&&n<e.y+e.height,le=16,v=(e,t,n)=>t===1?e*le:t===2?e*n:e,y=(e,t,n,r,i)=>{let a=t?r:0,o=n?i:0;return a||o?{target:e,left:a,top:o}:null},ue=(e,t,n)=>{let r=document.documentElement,i=getComputedStyle(r),a=i.overflowX===`visible`&&i.overflowY===`visible`&&document.body?document.body:r;for(let r=e;r&&r!==a;r=r.parentElement){let e=getComputedStyle(r),i=/auto|scroll/.test(e.overflowX)&&r.scrollWidth>r.clientWidth,a=/auto|scroll/.test(e.overflowY)&&r.scrollHeight>r.clientHeight,o=y(r,i,a,t,n);if(o)return o}let o=document.scrollingElement,s=a===r?i:getComputedStyle(a);return o&&y(o,!/hidden|clip/.test(s.overflowX),!/hidden|clip/.test(s.overflowY),t,n)},b=null,x=null,S=e=>({width:e.offsetWidth||window.innerWidth,height:e.offsetHeight||window.innerHeight}),de=e=>{if(!x||!b||!ce(x,e.clientX,e.clientY))return;let t=document.fullscreenElement;if(t&&!t.contains(b))return;let n=document.elementFromPoint(e.clientX,e.clientY);if(!n||n===b)return;let r=n.closest(`:is(:modal, :popover-open)`);if(r&&!r.contains(b))return;let i=ue(n,v(e.deltaX,e.deltaMode,window.innerWidth),v(e.deltaY,e.deltaMode,window.innerHeight));i&&(i.target.scrollBy({left:i.left,top:i.top,behavior:`instant`}),e.cancelable&&e.preventDefault())},C,fe=e=>{x=e,e?C??=n(window,`wheel`,de,{capture:!0,passive:!1}):(C?.(),C=void 0)},w=0,T=null,pe=e=>{let t=document.documentElement;if(!t||e===w&&(e===0||t===T))return;w=e,T=t;let n=t.style;e>0?(n.setProperty(`margin-top`,`${e}px`,`important`),n.setProperty(`--fkn-inset-top`,`${e}px`)):(n.removeProperty(`margin-top`),n.removeProperty(`--fkn-inset-top`))},E=(e,t)=>{t?(e.removeAttribute(`tabindex`),e.removeAttribute(`aria-hidden`)):(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`aria-hidden`,`true`))},D=(e,{modal:t,rects:n,inset:r},i)=>{if(pe(r),!m){let r=t||n.length>0;E(e,r),e.style.setProperty(`pointer-events`,r?`auto`:`none`,`important`),e.style.setProperty(`visibility`,r?`visible`:`hidden`,`important`);return}let a=oe(n,t,i),o=a===`none`||CSS.supports(`clip-path`,a)?a:`inset(100%)`;e.style.setProperty(`clip-path`,o,`important`),E(e,o!==`inset(100%)`),fe(t||o!==a?null:se(n))},me=e=>{if(typeof e!=`object`||!e)return 0;let{top:t}=e;return typeof t!=`number`||!Number.isFinite(t)||t<=0?0:Math.min(Math.round(t),p)},he=e=>{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},ge=(e,t)=>{if(typeof e!=`object`||!e)return null;let{x:n,y:r,width:i,height:a}=e;if(![n,r,i,a].every(e=>typeof e==`number`&&Number.isFinite(e)))return null;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=he(e.radius);return{x:c,y:l,width:u-c,height:d-l,...f?{radius:f}:{}}},O={"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`,clipped:`it is clipped away or positioned outside the viewport`,"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`},_e=e=>Array.isArray(e)?e.slice(0,f).flatMap(e=>{if(typeof e!=`object`||!e)return[];let{kind:t,cause:n,level:r}=e;return typeof t!=`string`||t.length>40||typeof n!=`string`||!(n in O)||r!==`full`&&r!==`liveness`?[]:[{kind:t,cause:n,level:r}]}):[],k=new Set,ve=e=>{for(let{kind:t,cause:n,level:r}of e)k.has(t)||(k.add(t),console.error(`[FKN] The FKN ${JSON.stringify(t)} is not visible on this page: ${O[n]}. Nobody using this page can see or answer it.
|
|
2
|
+
@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`?`
|
|
3
|
+
This browser reports limited detail, so the cause above is a best guess.`:``)))},A=(e,t)=>{if(typeof e!=`object`||!e)return null;let n=e,r=(Array.isArray(n.rects)?n.rects.slice(0,d):[]).map(e=>ge(e,t)).filter(e=>e!==null&&e.width>0&&e.height>0);return{modal:n.modal===!0,rects:r,hidden:_e(n.hidden),inset:me(n.inset)}},ye=()=>b!==null,j=null,M=null,be=()=>{if(!b||j===null)return;let e=S(b),t=A(j,e);t&&D(b,t,e)},xe=e=>{typeof ResizeObserver<`u`&&(M??=new ResizeObserver(be),M.disconnect(),M.observe(e))},Se=e=>{ee(e),D(e,{modal:!1,rects:[],hidden:[],inset:0},S(e)),b=e,xe(e)},Ce=e=>{if(!b)return;let t=S(b),n=A(e,t);n&&(j=e,D(b,n,t),ve(n.hidden))},N=`https://fkn.app`,P=typeof globalThis<`u`&&globalThis.document?globalThis.document:void 0,F=typeof globalThis<`u`&&globalThis.crossOriginIsolated===!0,I=e.n(F),we=`fkn-api-port`,Te=`fkn-api-port-ack`,Ee=2e3,De=()=>{if(!P||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===Te&&r(t.port1)},a=setTimeout(()=>r(void 0),Ee);t.port1.addEventListener(`message`,i),t.port1.start();try{e.postMessage({type:we},N,[t.port2])}catch{r(void 0)}})},L,Oe=()=>{if(L||!P)return L;let t=P.querySelector(`iframe[src="${I}"]`);if(t)L=t;else{let t=P.createElement(`iframe`);t.setAttribute(`allow`,e.a(F)),t.src=I,P.body.appendChild(t),L=t}return l(L,I,N),Se(L),L},R=(async()=>{if(!P)return;let e=await De();if(e)return{receive:e,emit:e};let t=Oe();if(t)return await o(t),t.contentWindow?u(t,N):void 0})(),ke=(e,{boundRetired:t=e=>e}={})=>{let n,r=0,i=!1,a=()=>{},o=()=>new Promise(e=>{a=e}),s=o(),c=s,l=new Set,u=new Set,d=0,f=0,p=()=>{let e=[...u];u.clear();let t=Error(`FKN: the broker was replaced while this call was pending; retry it`);for(let n of e)try{n(t)}catch{}};(async()=>{for await(let t of e){let e=++r;n={remote:t,epoch:e};let i=a;s=o(),i(t),p();for(let n of[...l])try{n(t,e)}catch{}}})().catch(()=>{});let m=async(e,r)=>{let a=n?.remote??await(i?t(s):s);for(let t of e.slice(0,-1))a=a[t];let o=a[e[e.length-1]??``];d=Date.now(),f+=1;let c=()=>{},l=new Promise((e,t)=>{c=t});u.add(c);try{return await Promise.race([Promise.resolve(o.apply(a,r)),l])}finally{--f,u.delete(c),d=Date.now()}},h=new Map,g=e=>{let t=e.join(`\0`),r=h.get(t);if(r)return r;let i=new Proxy(function(){},{get:(t,r)=>{if(typeof r!=`string`||r===`then`)return;let i=n;if(i){let t=i.remote;for(let n of e)t=t?.[n];if(t?.[r]===void 0)return}return g([...e,r])},apply:(t,n,r)=>m(e,r)});return h.set(t,i),i};return{facade:g([]),first:c.then(()=>{}),current:()=>n,onEpoch:e=>{if(l.add(e),n)try{e(n.remote,n.epoch)}catch{}return()=>{l.delete(e)}},lastCall:()=>d,inFlight:()=>f,routable:()=>n?Promise.resolve():s.then(()=>{}),retire:()=>{i=!0,n=void 0,p()}}},z=!1,B=new Set,V=()=>z,Ae=()=>{if(!z){z=!0;for(let e of[...B])try{e()}catch{}B.clear()}},H=e=>{z?e():B.add(e)},je=typeof window<`u`||typeof self<`u`,U=async()=>{if(typeof window<`u`)return R;if(typeof self<`u`)return{receive:self,emit:self}},W=`fkn-api`,Me=`fkn-api-window`,Ne={async*[Symbol.asyncIterator](){let e=await U();if(!e)await new Promise(()=>{});else{if(!V()){let n=new AbortController;H(()=>n.abort());for await(let r of(0,t.expose)({},{key:W,transport:e,unregisterSignal:n.signal})){if(n.signal.aborted)break;yield r}}yield*(0,t.expose)({},{key:Me,transport:e})}}},G=!1,K=U().then(e=>new Promise(n=>{if(!e)return;let r=new AbortController;(0,t.registerOsraMessageListener)({transport:e,key:W,unregisterSignal:r.signal,listener:()=>{r.abort(),G=!0,n()}})})),q=ke(Ne,{boundRetired:e=>Promise.race([e,K.then(()=>$(e,()=>new Q))])});H(()=>q.retire());var J=Promise.race([q.first,new Promise(e=>H(e))]).then(()=>q.facade),Y=8e3,Pe=1e3,X=!1,Z=class extends Error{constructor(e,t){super(`@fkn/lib: no broker connection within ${t}ms, so ${e} could not be requested`),this.name=`BrokerUnreachableError`}},Q=class extends Error{constructor(){super(`FKN @fkn/lib: this page relays its FKN channel to a worker, and the FKN page it reached predates a channel of the page's own; reload`),this.name=`OwnChannelUnavailableError`}},$=(e,t)=>{let n=X?Pe:Y;return Promise.race([e,new Promise((e,r)=>setTimeout(()=>{X=!0,r(t(n))},n))])},Fe=e=>V()?$(q.routable().then(()=>q.facade),t=>G?new Q:new Z(e,t)):$(J,t=>new Z(e,t));H(()=>{K.then(()=>{let e=setTimeout(()=>console.error(new Q),Y);q.routable().then(()=>clearTimeout(e))})});var Ie=q.onEpoch,Le=q.current,Re=q.lastCall,ze=q.inFlight;Ie(e=>{ye()&&e.overlay.setHost(Ce,{exactClips:ne(),colorScheme:g}).catch(()=>{})}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return Ie}});
|
package/api.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./api-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./api-RuHgAkxf.cjs");exports.API_DEADLINE_MS=e.t,exports.BrokerUnreachableError=e.n,exports.OwnChannelUnavailableError=e.r,exports.apiInFlight=e.i,exports.apiLastCall=e.a,exports.apiPromise=e.o,exports.apiWithin=e.s,exports.currentApiEpoch=e.c,exports.hasTransport=e.l,exports.onApiEpoch=e.u;
|
package/api.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Q as Resolvers } from "./contract-
|
|
2
|
-
import { a as apiLastCall, c as currentApiEpoch, i as apiInFlight, l as hasTransport, n as BrokerUnreachableError, o as apiPromise, r as OwnChannelUnavailableError, s as apiWithin, t as API_DEADLINE_MS, u as onApiEpoch } from "./api-
|
|
1
|
+
import { Q as Resolvers } from "./contract-B-iUk1mJ.js";
|
|
2
|
+
import { a as apiLastCall, c as currentApiEpoch, i as apiInFlight, l as hasTransport, n as BrokerUnreachableError, o as apiPromise, r as OwnChannelUnavailableError, s as apiWithin, t as API_DEADLINE_MS, u as onApiEpoch } from "./api-CXvE64Jr.js";
|
|
3
3
|
export { API_DEADLINE_MS, BrokerUnreachableError, OwnChannelUnavailableError, type Resolvers, apiInFlight, apiLastCall, apiPromise, apiWithin, currentApiEpoch, hasTransport, onApiEpoch };
|