@fkn/lib 0.9.61 → 0.9.62
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.d.ts +1 -1
- package/{api-_LPVMHpt.d.ts → api-xh6lzApn.d.ts} +1 -1
- package/api.d.ts +2 -2
- package/cloud/dns.d.ts +1 -1
- package/cloud/fetch.d.ts +1 -1
- package/cloud/net.d.ts +1 -1
- package/{cloud-EdApZuYQ.cjs → cloud-B8v_yMtd.cjs} +1 -1
- package/{cloud-BBQOLP4h.d.ts → cloud-CI7FFRMC.d.ts} +2 -2
- package/{cloud-DCPXtbOK.js → cloud-CjQfUhhD.js} +1 -1
- package/cloud.cjs +1 -1
- package/cloud.d.ts +3 -3
- package/cloud.js +1 -1
- package/{contract-m0ztKGCd.d.ts → contract-BGMJVvTg.d.ts} +1 -1
- package/contract.d.ts +1 -1
- package/dgram.d.ts +3 -3
- package/dns.d.ts +1 -1
- package/{extension-C_eOfEjv.d.ts → extension-C1bcizcn.d.ts} +10 -0
- package/{extension-B2YksUWv.cjs → extension-C1oub0Dw.cjs} +1 -1
- package/{extension-CvgbgNZX.js → extension-Ct5qQkQF.js} +1 -1
- package/extension.cjs +1 -1
- package/extension.d.ts +1 -1
- package/extension.js +2 -2
- package/http.d.ts +1 -1
- package/index.cjs +1 -1
- package/index.d.ts +9 -9
- package/index.js +29 -44
- package/{lib-BGAmzIcU.js → lib-BrsqpUkv.js} +405 -410
- package/lib-C_X3WR4G.cjs +53 -0
- package/{net-dxm4WUEH.d.ts → net-BpyIeQ8r.d.ts} +3 -3
- package/net.d.ts +1 -1
- package/package.json +1 -1
- package/packages.d.ts +1 -1
- package/{proxy-CzciyJH2.d.ts → proxy-Dz60YyYy.d.ts} +2 -2
- package/{relay-choice-ka0GQUF2.d.ts → relay-choice-5yUPI-tJ.d.ts} +1 -1
- package/rooms.d.ts +16 -2
- package/storage.d.ts +1 -1
- package/lib-BiQ6cOZ7.cjs +0 -53
package/account.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { D as RelayChoice } from "./index-C5DdoMGo.js";
|
|
2
|
-
import { D as IpFamily, H as ProxyFetchInput, I as PackagesErrorCode, N as OverlayState, Nt as StoragePutWire, P as PackageQuery, Q as RoomClaimOptions, R as PickOptions, T as InstallOptions, Ut as UdpDatagram, V as ProxyFetchInit, Vt as TcpSocketOptions, Wt as UdpSocketOptions, X as Resolvers, Xt as WriteData, a as AccountChange, at as RoomJoinOptions, b as FrameConsentAnswer, c as AdoptRequest, d as ConflictRequest, dt as RoomPermission, ht as RoomsErrorCode, kt as StorageErrorCode, l as AdoptState, m as ConnectOptions, mt as RoomType, o as AccountPinOptions, p as ConnectAvailability, rt as RoomEvent, st as RoomMailbox, u as ConflictChoice, ut as RoomOpenOptions, x as FrameConsentRequest, z as Placement, zt as TcpSocketListenerOptions } from "./contract-
|
|
2
|
+
import { D as IpFamily, H as ProxyFetchInput, I as PackagesErrorCode, N as OverlayState, Nt as StoragePutWire, P as PackageQuery, Q as RoomClaimOptions, R as PickOptions, T as InstallOptions, Ut as UdpDatagram, V as ProxyFetchInit, Vt as TcpSocketOptions, Wt as UdpSocketOptions, X as Resolvers, Xt as WriteData, a as AccountChange, at as RoomJoinOptions, b as FrameConsentAnswer, c as AdoptRequest, d as ConflictRequest, dt as RoomPermission, ht as RoomsErrorCode, kt as StorageErrorCode, l as AdoptState, m as ConnectOptions, mt as RoomType, o as AccountPinOptions, p as ConnectAvailability, rt as RoomEvent, st as RoomMailbox, u as ConflictChoice, ut as RoomOpenOptions, x as FrameConsentRequest, z as Placement, zt as TcpSocketListenerOptions } from "./contract-BGMJVvTg.js";
|
|
3
3
|
import { o as TcpSocketOption, x as UdpSocketOption } from "./wire-Fk5pJaoy.js";
|
|
4
4
|
import { Remote } from "osra";
|
|
5
5
|
//#region src/api-epochs.d.ts
|
package/api.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { X 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 { X as Resolvers } from "./contract-BGMJVvTg.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-xh6lzApn.js";
|
|
3
3
|
export { API_DEADLINE_MS, BrokerUnreachableError, OwnChannelUnavailableError, type Resolvers, apiInFlight, apiLastCall, apiPromise, apiWithin, currentApiEpoch, hasTransport, onApiEpoch };
|
package/cloud/dns.d.ts
CHANGED
package/cloud/fetch.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as cloudFetch } from "../proxy-
|
|
1
|
+
import { t as cloudFetch } from "../proxy-Dz60YyYy.js";
|
|
2
2
|
export { cloudFetch as fetch };
|
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-BpyIeQ8r.js";
|
|
2
2
|
export { Server, Socket, _default, _default as default, connect, createConnection, createServer, isIP, isIPv4, isIPv6 };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-BiQ6cOZ7.cjs"),n=require("./hosts-GNBhZO3-.cjs"),r=require("./api-D7Sbm8Oj.cjs"),i=require("./busy-BXbVH595.cjs"),a=require("./contract.cjs"),o=require("./relay-choice-JC_JJY_M.cjs"),s=require("./proxy-CiIj4vA1.cjs"),c=require("./attach-policy.cjs"),l=require("./dns.cjs"),u=require("./cloud/fs.cjs"),d=require("./net.cjs"),f=require("./dgram.cjs"),p=require("./http.cjs");let m=require("osra");var h=async()=>{let e=()=>r.s(`frame consent`);try{let t=await e();return{request:typeof t.frameConsent.request==`function`?t.frameConsent.request:void 0,ensure:t.frameConsent.ensure}}catch(t){if(!(t instanceof r.n))throw t;return{request:void 0,ensure:t=>e().then(e=>e.frameConsent.ensure(t))}}},g=`frame: this frame no longer holds the document the app attached it to`,_=!1,v=()=>{_||(_=!0,console.warn(`[fkn-frame] this FKN broker is too old to ask for permission categories, so nothing was asked for upfront and each capability is asked for as it is first used. Reloading the page picks up the current broker.`))},y=e=>[...e].flatMap(e=>{try{return[new URL(e).hostname]}catch{return[]}}),b=e=>typeof e?.reason==`string`?{reason:e.reason}:{},x=(e,t,n)=>n===null?`frame.${e}: the user did not grant ${t} here`:`frame.${e}: the user did not grant ${t} on ${n}`,S=e=>{let{assertLive:r,attach:i,consent:a,current:o,declaredHosts:s,documentHost:l,freshBlank:u,session:d,approvedOrigins:f}=e,p=new Set,m=()=>{try{return new URL(o()).hostname}catch{return``}},h=async()=>l?await l():m(),_=()=>n.t([...s,...y(f)]),S=async(e,t)=>(await e([t]))[0]??!1;return{gate:async({operation:e,args:o,phase:l})=>{r();let v=n.m(e,o);if(v===null)return;let y=t.h(v);if(y===void 0||y===`auto`)return;if(e===`fetch`){let e=c.frameFetchVerdict({session:d,declaredHosts:s,approvedOrigins:f},l===`ensure`?void 0:o[0],{classifier:`fetchTarget`});if(l===`ensure`&&!d)throw t.k(e.kind===`refuse`?e.reason:``,`fetch`);if(l!==`ensure`&&e.kind===`refuse`)throw t.k(e.reason,`fetch`);let{request:r,ensure:i}=await a();if(!r){if(e.kind===`refuse`)throw t.k(e.reason,`fetch`);if(!await i({scope:n.c(o[0],o[1]).scope,hosts:e.promptHosts}))throw t.k(`frame.fetch: the user did not grant this`,`fetch`);return}let u=e.kind===`consent`?e.targetHost:await h(),p=n.t([u,...s]);if(!p.length)throw t.k(`frame: navigate the frame before fetch`,`fetch`);if(await S(r,{category:`network`,hosts:p,...b(t.T(o))})===!1)throw t.k(x(`fetch`,`network`,u||null),`fetch`);return}let C=await h();if(!C)throw t.k(`frame: navigate the frame before ${e}`,e);if(!_().includes(C))throw t.k(g,e);let w=t.m(v);if(w===void 0||w===`evaluation`&&C===m()&&await u?.()||y===`critical`&&p.has(`${v} ${C}`))return;let{request:T}=await a();if(!T)return;let E=n.t([C,...s]),D=b(t.T(o)),O=y===`critical`?{key:v,hosts:E,attach:i,...D}:{category:w,hosts:E,...D},k=await S(T,O);if(k===!1)throw t.k(x(e,w,null),e);if(k===`once`&&l!==`ensure`)for(let e of E)p.add(`${v} ${e}`)},requestCategories:async e=>{r(),t.f(`frame.requestPermissions`,e);let o=await h(),c=n.t(o?[o,...s]:s);if(!c.length)throw TypeError(`frame.requestPermissions: navigate the frame or declare domains first`);let l=e.map(e=>{let n=e.key;return n===void 0?{named:void 0,critical:!1,category:e.category}:{named:n,critical:t.h(n)===`critical`,category:t.p(n)}}),u=({named:e,critical:t,category:n},r)=>({category:n,...t?{key:e}:{},hosts:c,allow:r}),{request:d}=await a();if(!d)return v(),l.map(e=>u(e,!1));let f=await d(l.map(({named:t,critical:n,category:r},a)=>{let o=b(e[a]);return n?{key:t,hosts:c,attach:i,...o}:{category:r,hosts:c,...o}}));return l.map((e,t)=>u(e,f[t]!==void 0&&f[t]!==!1))},boundary:_}},C=e=>e,w=5e3,T=new Set([]),E=()=>`https://fkn.app`,D=e=>e===`persistent`?``:`incognito-${crypto.randomUUID()}`,O=(e,n,r)=>{let i,a=new Promise((e,a)=>{i=setTimeout(()=>a(typeof r==`string`?new t.E(r):r()),n)});return Promise.race([e,a]).finally(()=>clearTimeout(i))},k=e=>Object.assign(Error(e),{name:t.D}),A=`frame.postMessage: this FKN page predates frame messaging; reload the app to load the current one`,j=`frame.addScriptTag: this render proxy predates addScriptTag; reload the app`,M=`frame.addScriptTag: no answer within ${t.l}ms; the script may or may not have run`,N=`frame.clearCookies: this FKN page predates clearCookies; reload the app to load the current one`,P=`frame.clearCookies: this attachment reaches no site yet; attach a url, goto one, or declare it in domains`,F=3e4,I=`attachFrame: this FKN page predates storageState; reload the app to load the current one`,L=2e4,R=async(e,n)=>{if(typeof e.seed!=`function`)throw t.N(I,`storageState`,`cloud`);try{await O(e.seed(n),L,`attachFrame: the render proxy did not take the storageState seed`)}catch(e){throw t.O(e)?t.N(I,`storageState`,`cloud`):e}},z=`frame.clearCookies: the render proxy did not answer within ${F}ms; the cookies may or may not be gone, and calling it again is safe`,B=e=>t.O(e)&&e.message===t.j(`addScriptTag`).message,V=!1,ee=()=>{V||(V=!0,console.warn(`[fkn-frame] this FKN page predates frame messaging, so the page's messages and documents are never reported. Reloading the app loads the current one.`))},te=({from:e,origin:t,attach:n,signal:r})=>i=>{let a=r=>{if(r.source===null||r.source!==e()||r.origin!==t)return;let a=r.data;typeof a==`object`&&a&&a.type===`fkn-frame-message`&&a.attach===n&&typeof a.origin==`string`&&(a.kind===`message`?i({type:`message`,data:a.data,origin:a.origin,ports:r.ports}):a.kind===`document`&&i({type:`document`,origin:a.origin}))};return window.addEventListener(`message`,a,{signal:r}),()=>window.removeEventListener(`message`,a)},ne=e=>{if(typeof e!=`function`)return()=>Promise.resolve(e);let t=null;return()=>t??=e().catch(e=>{throw t=null,e})},H=({control:e,target:n,blank:r=!1,session:i,declaredHosts:a,approvedOrigins:o,attach:s,assertLive:c,guard:l,consent:u,onNavigated:d,relay:f})=>{let p=n,m=r&&i!==``,h=async()=>{if(!m)return!1;let t=typeof e.blank==`function`?await l(()=>e.blank()):``;return(typeof t!=`string`||t.split(`#`)[0]!==n.split(`#`)[0])&&(m=!1),m},_=Promise.resolve(),{gate:v,requestCategories:y,boundary:b}=S({session:i,declaredHosts:a,approvedOrigins:o,attach:s,assertLive:c,documentHost:typeof e.documentHost==`function`?()=>l(()=>e.documentHost()):void 0,current:()=>p,consent:ne(u),freshBlank:h});return t.y({backend:`cloud`,executor:{execute:(n,r,i)=>T.has(r)?Promise.reject(t.j(r,`cloud`)):(c(),l(()=>e.executeLocator(n,r,i))),highlight:async()=>{}},gate:v,requestPermissions:y,evaluate:async(n,r)=>(c(),await v({parts:[],operation:`evaluate`,args:[n],phase:`execute`}),O(l(()=>e.executeLocator([],`evaluate`,[n,r])),t.l,t.u)),addScriptTag:async(n,r)=>{c();let i=[n,r];await v({parts:[],operation:`addScriptTag`,args:i,phase:`execute`});try{await O(l(()=>e.executeLocator([],`addScriptTag`,i)),t.l,M)}catch(e){throw B(e)?t.N(j,`addScriptTag`,`cloud`):e}},clearCookies:async n=>{if(c(),typeof e.clearCookies!=`function`)throw t.N(N,`clearCookies`,`cloud`);if(b().length===0)throw t.k(P,`clearCookies`);await O(l(()=>e.clearCookies(n)),F,z)},postMessage:(n,r,i)=>{if(c(),typeof e.messaging!=`function`)throw t.N(A,`postMessage`,`cloud`);if(r!==`*`&&!b().includes(new URL(r).hostname))throw t.k(g,`postMessage`);let{port1:a,port2:o}=new MessageChannel;a.postMessage({data:n,transfer:i},i);let s=[o,r],u=_.then(async()=>(await v({parts:[],operation:`postMessage`,args:s,phase:`execute`}),{answer:l(()=>e.executeLocator([],`postMessage`,s))}));return _=u.catch(()=>{}),u.then(async({answer:e})=>{await e})},listen:t=>(typeof e.messaging!=`function`&&ee(),f(t)),goto:async(n,{timeout:r,...i}={})=>{let a=new URL(n,location.href).href;c(),m=!1;let s=(()=>{try{return new URL(a).origin}catch{return``}})(),u=s!==``&&!o.has(s);u&&o.add(s);try{await O(l(()=>e.goto(a,r===void 0?i:{...i,timeoutMs:r})),(r??3e4)+w,`cloud.attachFrame: the render proxy did not answer goto; the frame may have been detached or its page reloaded`)}catch(e){throw u&&o.delete(s),t.c(e)}p=a,d()},url:()=>p})},U=async e=>{if(e===void 0){let e=await r.s(`a relay`).catch(()=>void 0);if(typeof e?.relay?.resolve!=`function`)return;let t=await e.relay.resolve().catch(()=>void 0);return t&&`id`in t?t.id:void 0}let t=await r.s(`a relay choice`);o.t(t,`attachFrame`);let n=await t.relay.resolve(e);if(`refused`in n)throw o.i(`attachFrame: ${n.refused}`);return n.id},W=async(e,t)=>{if((typeof e.relay==`function`?await e.relay():``)!==t)throw o.i(`attachFrame: ${a.RELAY_CHOICE_UNSUPPORTED}`)},re=250,ie=500,G=65e3,ae=2e3,oe=2e3,se=2,ce=2e3,le=2e3,ue=({origin:e,target:t,session:n,domains:r,attach:i})=>{let a=new URL(`/attach-window`,e);return a.searchParams.set(`attach`,i),t&&a.searchParams.set(`url`,t),n&&a.searchParams.set(`session`,n),r.length&&a.searchParams.set(`domains`,r.join(`,`)),a.href},de=(e,t)=>{let n=document.createElement(`iframe`),r=new URL(`/attach-jar`,e);return r.searchParams.set(`attach`,t),n.src=r.href,n.tabIndex=-1,n.setAttribute(`aria-hidden`,`true`),n.setAttribute(`style`,`display:none`),(document.body??document.documentElement).appendChild(n),n},fe=(e,t)=>{let n=new MutationObserver(()=>{e.isConnected||t.aborted||(n.disconnect(),console.warn(`cloud.attachFrame: the window's jar anchor was removed from this page, so a sign-in in the window no longer reaches this app's cookie jar`))});e.parentNode&&n.observe(e.parentNode,{childList:!0}),n.observe(document.documentElement,{childList:!0}),t.addEventListener(`abort`,()=>n.disconnect(),{once:!0})},K=()=>k(`cloud.attachFrame: the attached window closed, reloaded or left the page FKN attached; attach a fresh window`),q=()=>k(`cloud.attachFrame: the attached window stopped answering; attach a fresh window`),pe=()=>k(`cloud.attachFrame: the window went away before it connected; attach a fresh window`),me=()=>k(`cloud.attachFrame: the window closed before it connected. Either the user closed it, or this page's Cross-Origin-Opener-Policy cut its link to the window`),he=async(e,r,s)=>{if(typeof window>`u`)throw Error(`cloud.attachFrame needs a window realm`);let{domains:c=[],permissions:l,relay:u}=e,{url:d,width:f,height:p}=t.s(e.window);if(window.origin===`null`)throw new t._(`opaque-opener`);let h=E(),g=crypto.randomUUID(),_=D(r),v=n.t(c),y=new Set;d&&y.add(new URL(d).origin);let b=r===`persistent`?de(h,g):null,x=window.open(ue({origin:h,target:s===void 0?d:``,session:_,domains:v,attach:g}),`_blank`,`popup,width=${f},height=${p}`);if(!x)throw b?.remove(),new t.g;let S=new AbortController,w=!1,T=null,k=(e,t=!1)=>{if(T===null){T=e,S.abort(t?q():K());try{x.closed||x.postMessage({type:a.ATTACH_WINDOW_MESSAGE.detach,attach:g,...t?{unanswered:t}:{}},h)}catch{}b&&setTimeout(()=>b.remove(),le)}};b&&fe(b,S.signal);let A=new Promise((e,t)=>{S.signal.addEventListener(`abort`,()=>t(S.signal.reason),{once:!0})});A.catch(()=>{});let j=A.then(()=>{},()=>{}),M=()=>{if(S.signal.aborted)throw S.signal.reason},N=e=>S.signal.aborted?Promise.reject(S.signal.reason):Promise.race([e(),A]),P=e=>e.source===x&&e.origin===h;window.addEventListener(`message`,e=>{let n=e.source===null&&e.origin===h;if(!P(e)&&!n)return;let r=e.data;typeof r==`object`&&r&&r.attach===g&&(r.type===a.ATTACH_WINDOW_MESSAGE.gone?k(w?K():pe()):r.type===a.ATTACH_WINDOW_MESSAGE.refused&&!n&&k(new t._(r.reason)))},{signal:S.signal}),window.addEventListener(`pagehide`,()=>k(K()),{signal:S.signal});let F=U(u),I,L,z=()=>{let e=()=>{try{x.postMessage({type:a.ATTACH_WINDOW_MESSAGE.hello,attach:g,...I?{relay:I}:{}},h)}catch{}};e(),L=setInterval(e,re)};u===void 0&&z();let B=setInterval(()=>{x.closed&&k(w?K():me())},ie);S.signal.addEventListener(`abort`,()=>{clearInterval(L),clearInterval(B)},{once:!0});let V=async e=>{try{return await Promise.race([e,A])}catch(e){throw T??e}};try{u!==void 0&&(I=await V(F),z());let e=await V(O((0,m.expose)({},{key:a.ATTACH_WINDOW_KEY,transport:{emit:(e,t)=>x.postMessage(e,h,t??[]),receive:e=>{let t=t=>{P(t)&&e(t.data,{source:t.source,origin:t.origin})};return window.addEventListener(`message`,t),()=>window.removeEventListener(`message`,t)}},unregisterSignal:S.signal,revivableModules:C(t.ft)}),a.WINDOW_HANDSHAKE_TIMEOUT_MS,`cloud.attachFrame: timed out connecting to the window`));w=!0,clearInterval(L);let n=0,r=setInterval(()=>{O(N(()=>e.ping()),oe,`ping`).then(()=>{n=0},()=>{S.signal.aborted||(document.visibilityState===`hidden`?n=0:++n>=se&&k(q(),!0))})},ae);S.signal.addEventListener(`abort`,()=>clearInterval(r),{once:!0}),I&&await V(O(W(e,I),G,`cloud.attachFrame: the window never became ready`)),await V(O(e.ready(),G,`cloud.attachFrame: the window never became ready`)),s!==void 0&&await V(R(e,s)),i.r(`attached frame`,S.signal);let c=H({control:e,target:d,session:_,declaredHosts:v,approvedOrigins:y,attach:g,assertLive:M,guard:N,consent:{request:t=>N(()=>e.requestConsent(t)),ensure:t=>N(()=>e.requestConsent([t])).then(([e])=>e!==void 0&&e!==!1)},onNavigated:()=>{},relay:te({from:()=>x,origin:h,attach:g,signal:S.signal})}),f=null,p=Object.assign(c,{close:()=>f??=(async()=>{S.signal.aborted||await O(Promise.allSettled([N(()=>e.flushCookies()),N(()=>e.sweepStorage())]),ce,`close`).catch(()=>{});try{x.close()}catch{}k(K())})(),closed:j});return I?o.a(p,I):F.then(e=>o.a(p,e)),s!==void 0&&d&&await V(p.goto(d)),l?.length&&await V(p.requestPermissions(l)),p}catch(e){let n=T??e;if(!(n instanceof t._))try{x.close()}catch{}throw k(n),n}},ge=2e4,J=65e3,Y=e=>!e||e===`about:blank`,_e=`cloud.attachFrame: this FKN page predates blank pages; reload the app to load the current one`,ve=`cloud.attachFrame: cookies: 'native' needs the FKN browser extension; the cloud render proxy has no browser cookies`,X=e=>e.split(`#`)[0]??``,Z=({iframe:e,lockdown:n,cookies:r,blank:i})=>{if(i===void 0)return``;if(typeof i!=`object`||!i)throw TypeError(`attachFrame: blank must be an object { url }`);let a=Object.keys(i).find(e=>e!==`url`);if(a!==void 0)throw TypeError(`attachFrame: blank takes { url }, not "${a}"`);let{url:o}=i,s=(()=>{try{return typeof o==`string`?new URL(o):null}catch{return null}})();if(!s||s.protocol!==`http:`&&s.protocol!==`https:`)throw TypeError(`attachFrame: blank.url must be an absolute http or https url, not "${String(o)}"`);let c=e.getAttribute(`src`)??``;if(!Y(c))throw TypeError(`attachFrame: blank needs an iframe with no src; this one has "${c}"`);if(n)throw TypeError(`attachFrame: blank does not combine with lockdown`);if(r===`native`)throw TypeError(`attachFrame: blank runs on the cloud render proxy, which has no browser cookies; pass cookies: 'persistent' or 'ephemeral'`);if(t.x(s.href),!Oe())throw Error(`attachFrame: a blank page is served by the cloud render proxy, which this build does not configure`);return s.href},ye=({target:e,blank:t,session:n,domains:r,attach:i,relay:a})=>{let o=new URL(`/attach-frame`,E());return t?o.searchParams.set(`blank`,t):e&&o.searchParams.set(`url`,e),n&&o.searchParams.set(`session`,n),r.length&&o.searchParams.set(`domains`,r.join(`,`)),o.searchParams.set(`attach`,i),a&&o.searchParams.set(`relay`,a),o.href},be=(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())},xe=()=>k(`cloud.attachFrame: the attached iframe left the document or was reloaded; attach a fresh iframe`),Se=(e,t)=>{let n=[...e.split(`;`),...t.split(`;`)].map(e=>e.trim()).filter(Boolean);return[...new Set(n)].join(`; `)},Ce=[300,1200,4e3],Q=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 Ce)setTimeout(t,e)},we=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`)},Te=async(e,n)=>{let r=typeof e.blank==`function`?await O(e.blank(),J,`cloud.attachFrame: the render proxy never became ready`):``;if(typeof r!=`string`||X(r)!==X(n))throw t.N(_e,`blank`,`cloud`)},Ee=async(e,s,c)=>{let l=Z(e),{iframe:u,domains:d=[],permissions:f,relay:p}=e;if(typeof window>`u`)throw Error(`cloud.attachFrame needs a window realm`);if(!u.isConnected)throw Error(`cloud.attachFrame: the iframe must be connected to the document before attaching`);we(u);let g=u.getAttribute(`src`)??``,_=(()=>{if(Y(g))return null;try{return new URL(u.src||g,location.href)}catch{throw Error(`cloud.attachFrame: the iframe src is not a valid URL: ${g}`)}})();if(_){let e=new URL(`/attach-frame`,E());if(_.origin===e.origin&&_.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 v=_?.href??``;v&&t.x(v);let y=c===void 0?v:``,b=D(s),x=n.t(d),S=new Set;try{S.add(new URL(l||v).origin)}catch{}let w=U(p),T=p===void 0?void 0:await w,k=new AbortController,A=u.referrerPolicy,j=u.allow,M=crypto.randomUUID();if(u.referrerPolicy=`origin`,u.allow=Se(r.m(),u.allow),u.src=ye({target:y,blank:l,session:b,domains:x,attach:M,relay:T}),!u.contentWindow)throw Error(`cloud.attachFrame: the iframe window is not available`);try{let e=await O((0,m.expose)({},{key:a.ATTACH_FRAME_KEY,origin:E(),transport:{receive:window,emit:u.contentWindow},unregisterSignal:k.signal,revivableModules:C(t.ft)}),ge,`cloud.attachFrame: timed out connecting to the render proxy page`);T&&await O(W(e,T),J,`cloud.attachFrame: the render proxy never became ready`),await O(e.ready(),J,`cloud.attachFrame: the render proxy never became ready`),l&&await Te(e,l),c!==void 0&&await R(e,c),(v||l)&&Q(u),be(u,()=>k.abort()),i.r(`attached frame`,k.signal);let n=u.contentWindow,r=H({control:e,target:l||v,blank:l!==``,session:b,declaredHosts:x,approvedOrigins:S,attach:M,assertLive:()=>{if(k.signal.aborted||!u.isConnected||u.contentWindow!==n)throw k.abort(),xe()},guard:e=>e(),consent:h,onNavigated:()=>Q(u),relay:te({from:()=>n,origin:E(),attach:M,signal:k.signal})});return T?o.a(r,T):w.then(e=>o.a(r,e)),c!==void 0&&v&&await r.goto(v),f?.length&&await r.requestPermissions(f),r}catch(e){throw k.abort(),u.referrerPolicy=A,u.allow=j,u.src=y||`about:blank`,e}},De=(async e=>{let{kind:n,cookies:r,storageState:i}=t.o(e);if(r===`native`)throw TypeError(ve);return n===`window`?he(e,r,i):Ee(e,r,i)}),Oe=()=>typeof window<`u`&&!0,ke=async()=>{let e=await r.o.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}},Ae=e.t({attachFrame:()=>De,available:()=>$,dgram:()=>f.t,dns:()=>l.t,fetch:()=>s.t,fs:()=>u.t,http:()=>p.t,net:()=>d.t,quota:()=>ke}),$=()=>r.l;Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return $}});
|
|
1
|
+
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-C_X3WR4G.cjs"),n=require("./hosts-GNBhZO3-.cjs"),r=require("./api-D7Sbm8Oj.cjs"),i=require("./busy-BXbVH595.cjs"),a=require("./contract.cjs"),o=require("./relay-choice-JC_JJY_M.cjs"),s=require("./proxy-CiIj4vA1.cjs"),c=require("./attach-policy.cjs"),l=require("./dns.cjs"),u=require("./cloud/fs.cjs"),d=require("./net.cjs"),f=require("./dgram.cjs"),p=require("./http.cjs");let m=require("osra");var h=async()=>{let e=()=>r.s(`frame consent`);try{let t=await e();return{request:typeof t.frameConsent.request==`function`?t.frameConsent.request:void 0,ensure:t.frameConsent.ensure}}catch(t){if(!(t instanceof r.n))throw t;return{request:void 0,ensure:t=>e().then(e=>e.frameConsent.ensure(t))}}},g=`frame: this frame no longer holds the document the app attached it to`,_=!1,v=()=>{_||(_=!0,console.warn(`[fkn-frame] this FKN broker is too old to ask for permission categories, so nothing was asked for upfront and each capability is asked for as it is first used. Reloading the page picks up the current broker.`))},y=e=>[...e].flatMap(e=>{try{return[new URL(e).hostname]}catch{return[]}}),b=e=>typeof e?.reason==`string`?{reason:e.reason}:{},x=(e,t,n)=>n===null?`frame.${e}: the user did not grant ${t} here`:`frame.${e}: the user did not grant ${t} on ${n}`,S=e=>{let{assertLive:r,attach:i,consent:a,current:o,declaredHosts:s,documentHost:l,freshBlank:u,session:d,approvedOrigins:f}=e,p=new Set,m=()=>{try{return new URL(o()).hostname}catch{return``}},h=async()=>l?await l():m(),_=()=>n.t([...s,...y(f)]),S=async(e,t)=>(await e([t]))[0]??!1;return{gate:async({operation:e,args:o,phase:l})=>{r();let v=n.m(e,o);if(v===null)return;let y=t.h(v);if(y===void 0||y===`auto`)return;if(e===`fetch`){let e=c.frameFetchVerdict({session:d,declaredHosts:s,approvedOrigins:f},l===`ensure`?void 0:o[0],{classifier:`fetchTarget`});if(l===`ensure`&&!d)throw t.k(e.kind===`refuse`?e.reason:``,`fetch`);if(l!==`ensure`&&e.kind===`refuse`)throw t.k(e.reason,`fetch`);let{request:r,ensure:i}=await a();if(!r){if(e.kind===`refuse`)throw t.k(e.reason,`fetch`);if(!await i({scope:n.c(o[0],o[1]).scope,hosts:e.promptHosts}))throw t.k(`frame.fetch: the user did not grant this`,`fetch`);return}let u=e.kind===`consent`?e.targetHost:await h(),p=n.t([u,...s]);if(!p.length)throw t.k(`frame: navigate the frame before fetch`,`fetch`);if(await S(r,{category:`network`,hosts:p,...b(t.T(o))})===!1)throw t.k(x(`fetch`,`network`,u||null),`fetch`);return}let C=await h();if(!C)throw t.k(`frame: navigate the frame before ${e}`,e);if(!_().includes(C))throw t.k(g,e);let w=t.m(v);if(w===void 0||w===`evaluation`&&C===m()&&await u?.()||y===`critical`&&p.has(`${v} ${C}`))return;let{request:T}=await a();if(!T)return;let E=n.t([C,...s]),D=b(t.T(o)),O=y===`critical`?{key:v,hosts:E,attach:i,...D}:{category:w,hosts:E,...D},k=await S(T,O);if(k===!1)throw t.k(x(e,w,null),e);if(k===`once`&&l!==`ensure`)for(let e of E)p.add(`${v} ${e}`)},requestCategories:async e=>{r(),t.f(`frame.requestPermissions`,e);let o=await h(),c=n.t(o?[o,...s]:s);if(!c.length)throw TypeError(`frame.requestPermissions: navigate the frame or declare domains first`);let l=e.map(e=>{let n=e.key;return n===void 0?{named:void 0,critical:!1,category:e.category}:{named:n,critical:t.h(n)===`critical`,category:t.p(n)}}),u=({named:e,critical:t,category:n},r)=>({category:n,...t?{key:e}:{},hosts:c,allow:r}),{request:d}=await a();if(!d)return v(),l.map(e=>u(e,!1));let f=await d(l.map(({named:t,critical:n,category:r},a)=>{let o=b(e[a]);return n?{key:t,hosts:c,attach:i,...o}:{category:r,hosts:c,...o}}));return l.map((e,t)=>u(e,f[t]!==void 0&&f[t]!==!1))},boundary:_}},C=e=>e,w=5e3,T=new Set([]),E=()=>`https://fkn.app`,D=e=>e===`persistent`?``:`incognito-${crypto.randomUUID()}`,O=(e,n,r)=>{let i,a=new Promise((e,a)=>{i=setTimeout(()=>a(typeof r==`string`?new t.E(r):r()),n)});return Promise.race([e,a]).finally(()=>clearTimeout(i))},k=e=>Object.assign(Error(e),{name:t.D}),A=`frame.postMessage: this FKN page predates frame messaging; reload the app to load the current one`,j=`frame.addScriptTag: this render proxy predates addScriptTag; reload the app`,M=`frame.addScriptTag: no answer within ${t.l}ms; the script may or may not have run`,N=`frame.clearCookies: this FKN page predates clearCookies; reload the app to load the current one`,P=`frame.clearCookies: this attachment reaches no site yet; attach a url, goto one, or declare it in domains`,F=3e4,I=`attachFrame: this FKN page predates storageState; reload the app to load the current one`,L=2e4,R=async(e,n)=>{if(typeof e.seed!=`function`)throw t.N(I,`storageState`,`cloud`);try{await O(e.seed(n),L,`attachFrame: the render proxy did not take the storageState seed`)}catch(e){throw t.O(e)?t.N(I,`storageState`,`cloud`):e}},z=`frame.clearCookies: the render proxy did not answer within ${F}ms; the cookies may or may not be gone, and calling it again is safe`,B=e=>t.O(e)&&e.message===t.j(`addScriptTag`).message,V=!1,ee=()=>{V||(V=!0,console.warn(`[fkn-frame] this FKN page predates frame messaging, so the page's messages and documents are never reported. Reloading the app loads the current one.`))},te=({from:e,origin:t,attach:n,signal:r})=>i=>{let a=r=>{if(r.source===null||r.source!==e()||r.origin!==t)return;let a=r.data;typeof a==`object`&&a&&a.type===`fkn-frame-message`&&a.attach===n&&typeof a.origin==`string`&&(a.kind===`message`?i({type:`message`,data:a.data,origin:a.origin,ports:r.ports}):a.kind===`document`&&i({type:`document`,origin:a.origin}))};return window.addEventListener(`message`,a,{signal:r}),()=>window.removeEventListener(`message`,a)},ne=e=>{if(typeof e!=`function`)return()=>Promise.resolve(e);let t=null;return()=>t??=e().catch(e=>{throw t=null,e})},H=({control:e,target:n,blank:r=!1,session:i,declaredHosts:a,approvedOrigins:o,attach:s,assertLive:c,guard:l,consent:u,onNavigated:d,relay:f})=>{let p=n,m=r&&i!==``,h=async()=>{if(!m)return!1;let t=typeof e.blank==`function`?await l(()=>e.blank()):``;return(typeof t!=`string`||t.split(`#`)[0]!==n.split(`#`)[0])&&(m=!1),m},_=Promise.resolve(),{gate:v,requestCategories:y,boundary:b}=S({session:i,declaredHosts:a,approvedOrigins:o,attach:s,assertLive:c,documentHost:typeof e.documentHost==`function`?()=>l(()=>e.documentHost()):void 0,current:()=>p,consent:ne(u),freshBlank:h});return t.y({backend:`cloud`,executor:{execute:(n,r,i)=>T.has(r)?Promise.reject(t.j(r,`cloud`)):(c(),l(()=>e.executeLocator(n,r,i))),highlight:async()=>{}},gate:v,requestPermissions:y,evaluate:async(n,r)=>(c(),await v({parts:[],operation:`evaluate`,args:[n],phase:`execute`}),O(l(()=>e.executeLocator([],`evaluate`,[n,r])),t.l,t.u)),addScriptTag:async(n,r)=>{c();let i=[n,r];await v({parts:[],operation:`addScriptTag`,args:i,phase:`execute`});try{await O(l(()=>e.executeLocator([],`addScriptTag`,i)),t.l,M)}catch(e){throw B(e)?t.N(j,`addScriptTag`,`cloud`):e}},clearCookies:async n=>{if(c(),typeof e.clearCookies!=`function`)throw t.N(N,`clearCookies`,`cloud`);if(b().length===0)throw t.k(P,`clearCookies`);await O(l(()=>e.clearCookies(n)),F,z)},postMessage:(n,r,i)=>{if(c(),typeof e.messaging!=`function`)throw t.N(A,`postMessage`,`cloud`);if(r!==`*`&&!b().includes(new URL(r).hostname))throw t.k(g,`postMessage`);let{port1:a,port2:o}=new MessageChannel;a.postMessage({data:n,transfer:i},i);let s=[o,r],u=_.then(async()=>(await v({parts:[],operation:`postMessage`,args:s,phase:`execute`}),{answer:l(()=>e.executeLocator([],`postMessage`,s))}));return _=u.catch(()=>{}),u.then(async({answer:e})=>{await e})},listen:t=>(typeof e.messaging!=`function`&&ee(),f(t)),goto:async(n,{timeout:r,...i}={})=>{let a=new URL(n,location.href).href;c(),m=!1;let s=(()=>{try{return new URL(a).origin}catch{return``}})(),u=s!==``&&!o.has(s);u&&o.add(s);try{await O(l(()=>e.goto(a,r===void 0?i:{...i,timeoutMs:r})),(r??3e4)+w,`cloud.attachFrame: the render proxy did not answer goto; the frame may have been detached or its page reloaded`)}catch(e){throw u&&o.delete(s),t.c(e)}p=a,d()},url:()=>p})},U=async e=>{if(e===void 0){let e=await r.s(`a relay`).catch(()=>void 0);if(typeof e?.relay?.resolve!=`function`)return;let t=await e.relay.resolve().catch(()=>void 0);return t&&`id`in t?t.id:void 0}let t=await r.s(`a relay choice`);o.t(t,`attachFrame`);let n=await t.relay.resolve(e);if(`refused`in n)throw o.i(`attachFrame: ${n.refused}`);return n.id},W=async(e,t)=>{if((typeof e.relay==`function`?await e.relay():``)!==t)throw o.i(`attachFrame: ${a.RELAY_CHOICE_UNSUPPORTED}`)},re=250,ie=500,G=65e3,ae=2e3,oe=2e3,se=2,ce=2e3,le=2e3,ue=({origin:e,target:t,session:n,domains:r,attach:i})=>{let a=new URL(`/attach-window`,e);return a.searchParams.set(`attach`,i),t&&a.searchParams.set(`url`,t),n&&a.searchParams.set(`session`,n),r.length&&a.searchParams.set(`domains`,r.join(`,`)),a.href},de=(e,t)=>{let n=document.createElement(`iframe`),r=new URL(`/attach-jar`,e);return r.searchParams.set(`attach`,t),n.src=r.href,n.tabIndex=-1,n.setAttribute(`aria-hidden`,`true`),n.setAttribute(`style`,`display:none`),(document.body??document.documentElement).appendChild(n),n},fe=(e,t)=>{let n=new MutationObserver(()=>{e.isConnected||t.aborted||(n.disconnect(),console.warn(`cloud.attachFrame: the window's jar anchor was removed from this page, so a sign-in in the window no longer reaches this app's cookie jar`))});e.parentNode&&n.observe(e.parentNode,{childList:!0}),n.observe(document.documentElement,{childList:!0}),t.addEventListener(`abort`,()=>n.disconnect(),{once:!0})},K=()=>k(`cloud.attachFrame: the attached window closed, reloaded or left the page FKN attached; attach a fresh window`),q=()=>k(`cloud.attachFrame: the attached window stopped answering; attach a fresh window`),pe=()=>k(`cloud.attachFrame: the window went away before it connected; attach a fresh window`),me=()=>k(`cloud.attachFrame: the window closed before it connected. Either the user closed it, or this page's Cross-Origin-Opener-Policy cut its link to the window`),he=async(e,r,s)=>{if(typeof window>`u`)throw Error(`cloud.attachFrame needs a window realm`);let{domains:c=[],permissions:l,relay:u}=e,{url:d,width:f,height:p}=t.s(e.window);if(window.origin===`null`)throw new t._(`opaque-opener`);let h=E(),g=crypto.randomUUID(),_=D(r),v=n.t(c),y=new Set;d&&y.add(new URL(d).origin);let b=r===`persistent`?de(h,g):null,x=window.open(ue({origin:h,target:s===void 0?d:``,session:_,domains:v,attach:g}),`_blank`,`popup,width=${f},height=${p}`);if(!x)throw b?.remove(),new t.g;let S=new AbortController,w=!1,T=null,k=(e,t=!1)=>{if(T===null){T=e,S.abort(t?q():K());try{x.closed||x.postMessage({type:a.ATTACH_WINDOW_MESSAGE.detach,attach:g,...t?{unanswered:t}:{}},h)}catch{}b&&setTimeout(()=>b.remove(),le)}};b&&fe(b,S.signal);let A=new Promise((e,t)=>{S.signal.addEventListener(`abort`,()=>t(S.signal.reason),{once:!0})});A.catch(()=>{});let j=A.then(()=>{},()=>{}),M=()=>{if(S.signal.aborted)throw S.signal.reason},N=e=>S.signal.aborted?Promise.reject(S.signal.reason):Promise.race([e(),A]),P=e=>e.source===x&&e.origin===h;window.addEventListener(`message`,e=>{let n=e.source===null&&e.origin===h;if(!P(e)&&!n)return;let r=e.data;typeof r==`object`&&r&&r.attach===g&&(r.type===a.ATTACH_WINDOW_MESSAGE.gone?k(w?K():pe()):r.type===a.ATTACH_WINDOW_MESSAGE.refused&&!n&&k(new t._(r.reason)))},{signal:S.signal}),window.addEventListener(`pagehide`,()=>k(K()),{signal:S.signal});let F=U(u),I,L,z=()=>{let e=()=>{try{x.postMessage({type:a.ATTACH_WINDOW_MESSAGE.hello,attach:g,...I?{relay:I}:{}},h)}catch{}};e(),L=setInterval(e,re)};u===void 0&&z();let B=setInterval(()=>{x.closed&&k(w?K():me())},ie);S.signal.addEventListener(`abort`,()=>{clearInterval(L),clearInterval(B)},{once:!0});let V=async e=>{try{return await Promise.race([e,A])}catch(e){throw T??e}};try{u!==void 0&&(I=await V(F),z());let e=await V(O((0,m.expose)({},{key:a.ATTACH_WINDOW_KEY,transport:{emit:(e,t)=>x.postMessage(e,h,t??[]),receive:e=>{let t=t=>{P(t)&&e(t.data,{source:t.source,origin:t.origin})};return window.addEventListener(`message`,t),()=>window.removeEventListener(`message`,t)}},unregisterSignal:S.signal,revivableModules:C(t.ft)}),a.WINDOW_HANDSHAKE_TIMEOUT_MS,`cloud.attachFrame: timed out connecting to the window`));w=!0,clearInterval(L);let n=0,r=setInterval(()=>{O(N(()=>e.ping()),oe,`ping`).then(()=>{n=0},()=>{S.signal.aborted||(document.visibilityState===`hidden`?n=0:++n>=se&&k(q(),!0))})},ae);S.signal.addEventListener(`abort`,()=>clearInterval(r),{once:!0}),I&&await V(O(W(e,I),G,`cloud.attachFrame: the window never became ready`)),await V(O(e.ready(),G,`cloud.attachFrame: the window never became ready`)),s!==void 0&&await V(R(e,s)),i.r(`attached frame`,S.signal);let c=H({control:e,target:d,session:_,declaredHosts:v,approvedOrigins:y,attach:g,assertLive:M,guard:N,consent:{request:t=>N(()=>e.requestConsent(t)),ensure:t=>N(()=>e.requestConsent([t])).then(([e])=>e!==void 0&&e!==!1)},onNavigated:()=>{},relay:te({from:()=>x,origin:h,attach:g,signal:S.signal})}),f=null,p=Object.assign(c,{close:()=>f??=(async()=>{S.signal.aborted||await O(Promise.allSettled([N(()=>e.flushCookies()),N(()=>e.sweepStorage())]),ce,`close`).catch(()=>{});try{x.close()}catch{}k(K())})(),closed:j});return I?o.a(p,I):F.then(e=>o.a(p,e)),s!==void 0&&d&&await V(p.goto(d)),l?.length&&await V(p.requestPermissions(l)),p}catch(e){let n=T??e;if(!(n instanceof t._))try{x.close()}catch{}throw k(n),n}},ge=2e4,J=65e3,Y=e=>!e||e===`about:blank`,_e=`cloud.attachFrame: this FKN page predates blank pages; reload the app to load the current one`,ve=`cloud.attachFrame: cookies: 'native' needs the FKN browser extension; the cloud render proxy has no browser cookies`,X=e=>e.split(`#`)[0]??``,Z=({iframe:e,lockdown:n,cookies:r,blank:i})=>{if(i===void 0)return``;if(typeof i!=`object`||!i)throw TypeError(`attachFrame: blank must be an object { url }`);let a=Object.keys(i).find(e=>e!==`url`);if(a!==void 0)throw TypeError(`attachFrame: blank takes { url }, not "${a}"`);let{url:o}=i,s=(()=>{try{return typeof o==`string`?new URL(o):null}catch{return null}})();if(!s||s.protocol!==`http:`&&s.protocol!==`https:`)throw TypeError(`attachFrame: blank.url must be an absolute http or https url, not "${String(o)}"`);let c=e.getAttribute(`src`)??``;if(!Y(c))throw TypeError(`attachFrame: blank needs an iframe with no src; this one has "${c}"`);if(n)throw TypeError(`attachFrame: blank does not combine with lockdown`);if(r===`native`)throw TypeError(`attachFrame: blank runs on the cloud render proxy, which has no browser cookies; pass cookies: 'persistent' or 'ephemeral'`);if(t.x(s.href),!Oe())throw Error(`attachFrame: a blank page is served by the cloud render proxy, which this build does not configure`);return s.href},ye=({target:e,blank:t,session:n,domains:r,attach:i,relay:a})=>{let o=new URL(`/attach-frame`,E());return t?o.searchParams.set(`blank`,t):e&&o.searchParams.set(`url`,e),n&&o.searchParams.set(`session`,n),r.length&&o.searchParams.set(`domains`,r.join(`,`)),o.searchParams.set(`attach`,i),a&&o.searchParams.set(`relay`,a),o.href},be=(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())},xe=()=>k(`cloud.attachFrame: the attached iframe left the document or was reloaded; attach a fresh iframe`),Se=(e,t)=>{let n=[...e.split(`;`),...t.split(`;`)].map(e=>e.trim()).filter(Boolean);return[...new Set(n)].join(`; `)},Ce=[300,1200,4e3],Q=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 Ce)setTimeout(t,e)},we=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`)},Te=async(e,n)=>{let r=typeof e.blank==`function`?await O(e.blank(),J,`cloud.attachFrame: the render proxy never became ready`):``;if(typeof r!=`string`||X(r)!==X(n))throw t.N(_e,`blank`,`cloud`)},Ee=async(e,s,c)=>{let l=Z(e),{iframe:u,domains:d=[],permissions:f,relay:p}=e;if(typeof window>`u`)throw Error(`cloud.attachFrame needs a window realm`);if(!u.isConnected)throw Error(`cloud.attachFrame: the iframe must be connected to the document before attaching`);we(u);let g=u.getAttribute(`src`)??``,_=(()=>{if(Y(g))return null;try{return new URL(u.src||g,location.href)}catch{throw Error(`cloud.attachFrame: the iframe src is not a valid URL: ${g}`)}})();if(_){let e=new URL(`/attach-frame`,E());if(_.origin===e.origin&&_.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 v=_?.href??``;v&&t.x(v);let y=c===void 0?v:``,b=D(s),x=n.t(d),S=new Set;try{S.add(new URL(l||v).origin)}catch{}let w=U(p),T=p===void 0?void 0:await w,k=new AbortController,A=u.referrerPolicy,j=u.allow,M=crypto.randomUUID();if(u.referrerPolicy=`origin`,u.allow=Se(r.m(),u.allow),u.src=ye({target:y,blank:l,session:b,domains:x,attach:M,relay:T}),!u.contentWindow)throw Error(`cloud.attachFrame: the iframe window is not available`);try{let e=await O((0,m.expose)({},{key:a.ATTACH_FRAME_KEY,origin:E(),transport:{receive:window,emit:u.contentWindow},unregisterSignal:k.signal,revivableModules:C(t.ft)}),ge,`cloud.attachFrame: timed out connecting to the render proxy page`);T&&await O(W(e,T),J,`cloud.attachFrame: the render proxy never became ready`),await O(e.ready(),J,`cloud.attachFrame: the render proxy never became ready`),l&&await Te(e,l),c!==void 0&&await R(e,c),(v||l)&&Q(u),be(u,()=>k.abort()),i.r(`attached frame`,k.signal);let n=u.contentWindow,r=H({control:e,target:l||v,blank:l!==``,session:b,declaredHosts:x,approvedOrigins:S,attach:M,assertLive:()=>{if(k.signal.aborted||!u.isConnected||u.contentWindow!==n)throw k.abort(),xe()},guard:e=>e(),consent:h,onNavigated:()=>Q(u),relay:te({from:()=>n,origin:E(),attach:M,signal:k.signal})});return T?o.a(r,T):w.then(e=>o.a(r,e)),c!==void 0&&v&&await r.goto(v),f?.length&&await r.requestPermissions(f),r}catch(e){throw k.abort(),u.referrerPolicy=A,u.allow=j,u.src=y||`about:blank`,e}},De=(async e=>{let{kind:n,cookies:r,storageState:i}=t.o(e);if(r===`native`)throw TypeError(ve);return n===`window`?he(e,r,i):Ee(e,r,i)}),Oe=()=>typeof window<`u`&&!0,ke=async()=>{let e=await r.o.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}},Ae=e.t({attachFrame:()=>De,available:()=>$,dgram:()=>f.t,dns:()=>l.t,fetch:()=>s.t,fs:()=>u.t,http:()=>p.t,net:()=>d.t,quota:()=>ke}),$=()=>r.l;Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return $}});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as AttachFrameFunction } from "./index-C5DdoMGo.js";
|
|
2
|
-
import { t as cloudFetch } from "./proxy-
|
|
2
|
+
import { t as cloudFetch } from "./proxy-Dz60YyYy.js";
|
|
3
3
|
import { t as dns_d_exports } from "./dns.js";
|
|
4
4
|
import { n as fs_d_exports } from "./fs-DCJAYoYy.js";
|
|
5
|
-
import { s as net_d_exports } from "./net-
|
|
5
|
+
import { s as net_d_exports } from "./net-BpyIeQ8r.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
|
//#region src/cloud/frame.d.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { D as t, E as n, N as r, O as i, T as a, _ as o, c as s, f as c, ft as l, g as u, h as d, j as f, k as p, l as m, m as h, o as g, p as _, s as v, u as y, x as b, y as x } from "./lib-
|
|
2
|
+
import { D as t, E as n, N as r, O as i, T as a, _ as o, c as s, f as c, ft as l, g as u, h as d, j as f, k as p, l as m, m as h, o as g, p as _, s as v, u as y, x as b, y as x } from "./lib-BrsqpUkv.js";
|
|
3
3
|
import { c as S, m as C, t as w } from "./hosts-t7CKGTRz.js";
|
|
4
4
|
import { l as T, m as E, n as D, o as O, s as k } from "./api-C1lxKsM1.js";
|
|
5
5
|
import { r as A } from "./busy-DsMWrSzc.js";
|
package/cloud.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./proxy-CiIj4vA1.cjs"),t=require("./cloud-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./proxy-CiIj4vA1.cjs"),t=require("./cloud-B8v_yMtd.cjs"),n=require("./dns.cjs"),r=require("./cloud/fs.cjs"),i=require("./net.cjs"),a=require("./dgram.cjs"),o=require("./http.cjs");exports.attachFrame=t.i,exports.available=t.t,Object.defineProperty(exports,"dgram",{enumerable:!0,get:function(){return a.t}}),Object.defineProperty(exports,"dns",{enumerable:!0,get:function(){return n.t}}),exports.fetch=e.t,Object.defineProperty(exports,"fs",{enumerable:!0,get:function(){return r.t}}),Object.defineProperty(exports,"http",{enumerable:!0,get:function(){return o.t}}),Object.defineProperty(exports,"net",{enumerable:!0,get:function(){return i.t}}),exports.quota=t.r;
|
package/cloud.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as cloudFetch } from "./proxy-
|
|
2
|
-
import { a as attachFrame, i as quota, r as QuotaStatus, t as available } from "./cloud-
|
|
1
|
+
import { t as cloudFetch } from "./proxy-Dz60YyYy.js";
|
|
2
|
+
import { a as attachFrame, i as quota, r as QuotaStatus, t as available } from "./cloud-CI7FFRMC.js";
|
|
3
3
|
import { t as dns_d_exports } from "./dns.js";
|
|
4
4
|
import { n as fs_d_exports } from "./fs-DCJAYoYy.js";
|
|
5
|
-
import { s as net_d_exports } from "./net-
|
|
5
|
+
import { s as net_d_exports } from "./net-BpyIeQ8r.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
|
export { type QuotaStatus, attachFrame, available, dgram_d_exports as dgram, dns_d_exports as dns, cloudFetch as fetch, fs_d_exports as fs, http_d_exports as http, net_d_exports as net, quota };
|
package/cloud.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "./proxy-BJ1hSZgi.js";
|
|
2
|
-
import { i as t, r as n, t as r } from "./cloud-
|
|
2
|
+
import { i as t, r as n, t as r } from "./cloud-CjQfUhhD.js";
|
|
3
3
|
import { t as i } from "./dns.js";
|
|
4
4
|
import { t as a } from "./cloud/fs.js";
|
|
5
5
|
import { t as o } from "./net.js";
|
|
@@ -913,7 +913,7 @@ type RoomHandle = {
|
|
|
913
913
|
delete: (from: number, to?: number) => Promise<RoomsFail | {
|
|
914
914
|
ok: true;
|
|
915
915
|
}>;
|
|
916
|
-
/** replays stored messages above `after` as `message` events
|
|
916
|
+
/** replays stored messages above `after` as `message` events, `replayed` for those that predate this connection, one page at a time, and answers once every one of them has been emitted, in seq order */
|
|
917
917
|
backlog: (after: number, limit?: number) => Promise<RoomsFail | RoomBacklog>;
|
|
918
918
|
/**
|
|
919
919
|
* the room default for `send` or `receive`, from the owner only (`denied`, `rooms: not the room
|
package/contract.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { D as RelayChoice, d as CookieMatchWire, u as ClearCookiesWire } from "./index-C5DdoMGo.js";
|
|
2
|
-
import { $ as RoomCreateOptions, A as MiddleGotoOptions, At as StorageFail, B as ProxyFetch, Bt as TcpSocketListenerResult, C as FrameMessageRelay, Ct as SetOverlayHost, D as IpFamily, Dt as ShellJarUnreachable, E as InstalledPackage, Et as ShellGotoOptions, F as PackageResult, Ft as StoredHandle, G as RELAY_HEADER, Gt as UdpSocketResult, H as ProxyFetchInput, Ht as TcpSocketResult, I as PackagesErrorCode, It as StoredObject, J as Radii, Jt as WINDOW_JAR_MODE_TIMEOUT_MS, K as RELAY_UNAVAILABLE, Kt as WINDOW_HANDSHAKE_TIMEOUT_MS, L as PackagesFail, Lt as StoredPage, M as OverlayRect, Mt as StoragePutOptions, N as OverlayState, Nt as StoragePutWire, O as JAR_ANCHOR_MESSAGE, Ot as StorageEntry, P as PackageQuery, Pt as StorageQuota, Q as RoomClaimOptions, Qt as JarSeedCookie, R as PickOptions, Rt as SurfaceRect, S as FrameFetchScope, St as STORAGE_REFUSALS, T as InstallOptions, Tt as ShellFrameMessage, U as Quota, Ut as UdpDatagram, V as ProxyFetchInit, Vt as TcpSocketOptions, W as RELAY_CHOICE_UNSUPPORTED, Wt as UdpSocketOptions, X as Resolvers, Xt as WriteData, Y as RelayResolution, Yt as WindowMiddleControl, Z as RoomBacklog, Zt as JarSeed, _ as DnsLookup, _t as SHELL_ATTACH_ERROR, a as AccountChange, at as RoomJoinOptions, b as FrameConsentAnswer, bt as SHELL_JAR_MESSAGE, c as AdoptRequest, ct as RoomMember, d as ConflictRequest, dt as RoomPermission, et as RoomDefaults, f as ConflictSide, ft as RoomPermissions, g as DisplayLevel, gt as RoomsFail, h as DisplayCause, ht as RoomsErrorCode, i as Account, it as RoomHandle, j as MountDescriptor, jt as StorageProgress, k as MiddleControl, kt as StorageErrorCode, l as AdoptState, lt as RoomMessage, m as ConnectOptions, mt as RoomType, n as ATTACH_WINDOW_KEY, nt as RoomEnvelope, o as AccountPinOptions, ot as RoomJson, p as ConnectAvailability, pt as RoomSchema, q as ROOM_TEMPORARY_MS, qt as WINDOW_HELLO_TIMEOUT_MS, r as ATTACH_WINDOW_MESSAGE, rt as RoomEvent, s as AddressLookupResult, st as RoomMailbox, t as ATTACH_FRAME_KEY, tt as RoomEnd, u as ConflictChoice, ut as RoomOpenOptions, v as EncryptionState, vt as SHELL_CONTROL_KEY, w as HiddenSurface, wt as ShellControl, x as FrameConsentRequest, xt as SHELL_JAR_UNREACHABLE, y as FRAME_MESSAGE, yt as SHELL_FRAME_MESSAGE, z as Placement, zt as TcpSocketListenerOptions } from "./contract-
|
|
2
|
+
import { $ as RoomCreateOptions, A as MiddleGotoOptions, At as StorageFail, B as ProxyFetch, Bt as TcpSocketListenerResult, C as FrameMessageRelay, Ct as SetOverlayHost, D as IpFamily, Dt as ShellJarUnreachable, E as InstalledPackage, Et as ShellGotoOptions, F as PackageResult, Ft as StoredHandle, G as RELAY_HEADER, Gt as UdpSocketResult, H as ProxyFetchInput, Ht as TcpSocketResult, I as PackagesErrorCode, It as StoredObject, J as Radii, Jt as WINDOW_JAR_MODE_TIMEOUT_MS, K as RELAY_UNAVAILABLE, Kt as WINDOW_HANDSHAKE_TIMEOUT_MS, L as PackagesFail, Lt as StoredPage, M as OverlayRect, Mt as StoragePutOptions, N as OverlayState, Nt as StoragePutWire, O as JAR_ANCHOR_MESSAGE, Ot as StorageEntry, P as PackageQuery, Pt as StorageQuota, Q as RoomClaimOptions, Qt as JarSeedCookie, R as PickOptions, Rt as SurfaceRect, S as FrameFetchScope, St as STORAGE_REFUSALS, T as InstallOptions, Tt as ShellFrameMessage, U as Quota, Ut as UdpDatagram, V as ProxyFetchInit, Vt as TcpSocketOptions, W as RELAY_CHOICE_UNSUPPORTED, Wt as UdpSocketOptions, X as Resolvers, Xt as WriteData, Y as RelayResolution, Yt as WindowMiddleControl, Z as RoomBacklog, Zt as JarSeed, _ as DnsLookup, _t as SHELL_ATTACH_ERROR, a as AccountChange, at as RoomJoinOptions, b as FrameConsentAnswer, bt as SHELL_JAR_MESSAGE, c as AdoptRequest, ct as RoomMember, d as ConflictRequest, dt as RoomPermission, et as RoomDefaults, f as ConflictSide, ft as RoomPermissions, g as DisplayLevel, gt as RoomsFail, h as DisplayCause, ht as RoomsErrorCode, i as Account, it as RoomHandle, j as MountDescriptor, jt as StorageProgress, k as MiddleControl, kt as StorageErrorCode, l as AdoptState, lt as RoomMessage, m as ConnectOptions, mt as RoomType, n as ATTACH_WINDOW_KEY, nt as RoomEnvelope, o as AccountPinOptions, ot as RoomJson, p as ConnectAvailability, pt as RoomSchema, q as ROOM_TEMPORARY_MS, qt as WINDOW_HELLO_TIMEOUT_MS, r as ATTACH_WINDOW_MESSAGE, rt as RoomEvent, s as AddressLookupResult, st as RoomMailbox, t as ATTACH_FRAME_KEY, tt as RoomEnd, u as ConflictChoice, ut as RoomOpenOptions, v as EncryptionState, vt as SHELL_CONTROL_KEY, w as HiddenSurface, wt as ShellControl, x as FrameConsentRequest, xt as SHELL_JAR_UNREACHABLE, y as FRAME_MESSAGE, yt as SHELL_FRAME_MESSAGE, z as Placement, zt as TcpSocketListenerOptions } from "./contract-BGMJVvTg.js";
|
|
3
3
|
import { o as TcpSocketOption, x as UdpSocketOption } from "./wire-Fk5pJaoy.js";
|
|
4
4
|
export { ATTACH_FRAME_KEY, ATTACH_WINDOW_KEY, ATTACH_WINDOW_MESSAGE, Account, AccountChange, AccountPinOptions, AddressLookupResult, AdoptRequest, AdoptState, type ClearCookiesWire, ConflictChoice, ConflictRequest, ConflictSide, ConnectAvailability, ConnectOptions, type CookieMatchWire, DisplayCause, DisplayLevel, DnsLookup, EncryptionState, FRAME_MESSAGE, FrameConsentAnswer, FrameConsentRequest, FrameFetchScope, FrameMessageRelay, HiddenSurface, InstallOptions, InstalledPackage, IpFamily, JAR_ANCHOR_MESSAGE, type JarSeed, type JarSeedCookie, MiddleControl, MiddleGotoOptions, MountDescriptor, OverlayRect, OverlayState, PackageQuery, PackageResult, PackagesErrorCode, PackagesFail, PickOptions, Placement, ProxyFetch, ProxyFetchInit, ProxyFetchInput, Quota, RELAY_CHOICE_UNSUPPORTED, RELAY_HEADER, RELAY_UNAVAILABLE, ROOM_TEMPORARY_MS, Radii, type RelayChoice, RelayResolution, Resolvers, RoomBacklog, RoomClaimOptions, RoomCreateOptions, RoomDefaults, RoomEnd, RoomEnvelope, RoomEvent, RoomHandle, RoomJoinOptions, RoomJson, RoomMailbox, RoomMember, RoomMessage, RoomOpenOptions, RoomPermission, RoomPermissions, RoomSchema, RoomType, RoomsErrorCode, RoomsFail, SHELL_ATTACH_ERROR, SHELL_CONTROL_KEY, SHELL_FRAME_MESSAGE, SHELL_JAR_MESSAGE, SHELL_JAR_UNREACHABLE, STORAGE_REFUSALS, SetOverlayHost, ShellControl, ShellFrameMessage, ShellGotoOptions, ShellJarUnreachable, StorageEntry, StorageErrorCode, StorageFail, StorageProgress, StoragePutOptions, StoragePutWire, StorageQuota, StoredHandle, StoredObject, StoredPage, SurfaceRect, TcpSocketListenerOptions, TcpSocketListenerResult, type TcpSocketOption, TcpSocketOptions, TcpSocketResult, UdpDatagram, type UdpSocketOption, UdpSocketOptions, UdpSocketResult, WINDOW_HANDSHAKE_TIMEOUT_MS, WINDOW_HELLO_TIMEOUT_MS, WINDOW_JAR_MODE_TIMEOUT_MS, WindowMiddleControl, WriteData };
|
package/dgram.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { D as RelayChoice } from "./index-C5DdoMGo.js";
|
|
2
|
-
import { Gt as UdpSocketResult, X as Resolvers } from "./contract-
|
|
2
|
+
import { Gt as UdpSocketResult, X as Resolvers } from "./contract-BGMJVvTg.js";
|
|
3
3
|
import { x as UdpSocketOption } from "./wire-Fk5pJaoy.js";
|
|
4
|
-
import "./api-
|
|
5
|
-
import { t as RelayOption } from "./relay-choice-
|
|
4
|
+
import "./api-xh6lzApn.js";
|
|
5
|
+
import { t as RelayOption } from "./relay-choice-5yUPI-tJ.js";
|
|
6
6
|
import { Buffer } from "buffer";
|
|
7
7
|
import { AddressInfo } from "net";
|
|
8
8
|
import { BindOptions, RemoteInfo, Socket as Socket$2, SocketOptions, SocketType } from "dgram";
|
package/dns.d.ts
CHANGED
|
@@ -273,6 +273,16 @@ declare const isExtensionExposed: () => boolean;
|
|
|
273
273
|
declare const readExtensionHandshake: () => ExtensionHandshake;
|
|
274
274
|
type MissingExtensionHandler = () => Promise<void>;
|
|
275
275
|
declare const setMissingExtensionHandler: (handler: MissingExtensionHandler | null) => void;
|
|
276
|
+
/**
|
|
277
|
+
* Resolves once the FKN WebExtension on this page has announced a handshake it can use
|
|
278
|
+
* (`readExtensionHandshake()` reads `'ok'`): at once when it already has, else as soon as its
|
|
279
|
+
* content script announces one, however long after the page's load that is. With none `timeout` ms
|
|
280
|
+
* after the call (2000 by default) it stops waiting: an extension that announced an ABI below the
|
|
281
|
+
* one required rejects with `ExtensionOutdatedError`; otherwise the missing-extension handler runs
|
|
282
|
+
* (`@fkn/lib`'s install prompt, which waits on the person), and the call resolves if that left a
|
|
283
|
+
* usable extension, else rejects with "The FKN WebExtension is not installed, enabled or not exposed
|
|
284
|
+
* on this page."
|
|
285
|
+
*/
|
|
276
286
|
declare const waitForExtensionExposure: (timeout?: number) => Promise<void>;
|
|
277
287
|
//#endregion
|
|
278
288
|
//#region src/extension-prompt.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-
|
|
1
|
+
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-C_X3WR4G.cjs"),n=require("./api-D7Sbm8Oj.cjs"),r=require("./contract.cjs"),i=require("./proxy-CiIj4vA1.cjs"),a=require("./desktop.cjs");var o=`BackgroundStoppedError`,s=e=>t.d(e)&&e.name===`BackgroundStoppedError`,c=async e=>{if(t.Z(`promptInstall`,e),typeof window>`u`)return!1;if(t.rt())return!0;let r=await n.o,i=null,a=new Promise(e=>{i=()=>{t.rt()&&e(!0)},t.nt.addEventListener(`statuschange`,i)}),o=r.installPrompt.show(e).then(()=>!1),s=await Promise.race([a,o]);return i&&t.nt.removeEventListener(`statuschange`,i),await r.installPrompt.hide().catch(()=>{}),s},l=null;t.at(()=>(l||=c().then(()=>void 0).finally(()=>{l=null}),l));var u=e=>{try{e.headers.delete(r.RELAY_HEADER)}catch{}return e},d=()=>typeof document<`u`&&t.rt(),f=async(e,r)=>{if(n.p(e),t.Z(`fetch`,r?.reason),r?.credentials===`include`){if(typeof document>`u`)throw Error(`fetch with credentials needs the FKN extension, which only exists in window realms`);return t.W(e,r).then(u)}return d()?t.W(e,{...r,credentials:`omit`}).then(u):a.available()?a.fetch(e,r):i.t(e,r)},p=e.t({ATTACH_FRAME_EVENT_KEY:()=>t.i,BACKGROUND_STOPPED:()=>o,CATEGORIES:()=>t.w,EXTENSION_ABI:()=>5,ExtensionOperationUnsupportedError:()=>t.ct,ExtensionOutdatedError:()=>t.lt,FORGEABLE_HEADERS:()=>t.Q,FrameWindowBlockedError:()=>t.g,FrameWindowRefusedError:()=>t._,LOCATOR_DENIED:()=>t.A,LOCATOR_ERROR:()=>t.F,LOCATOR_INVALID:()=>t.L,LOCATOR_UNSUPPORTED:()=>t.D,MAX_REASON_LENGTH:()=>100,PERMISSION_DENIED:()=>t.t,REQUIRED_EXTENSION_ABI:()=>0,TimeoutError:()=>t.E,assertAttachableFrameUrl:()=>t.x,assertFetchableUrl:()=>t.U,assertForgeableHeaders:()=>t.$,assertLockdownApplicable:()=>t.S,assertOneCookieIdentity:()=>t.et,attachFrame:()=>t.a,attachFramePermission:()=>t.v,available:()=>d,box:()=>t.pt,cookies:()=>t.V,createFrame:()=>t.y,createVideoElementHandle:()=>t.mt,events:()=>t.nt,extension:()=>t.nt,fetch:()=>t.W,fetchCredentialedPermission:()=>t.G,fetchLocalPermission:()=>t.K,fetchPermission:()=>t.q,gotoPermission:()=>t.b,handleRevivableModules:()=>t.ft,hasForgedCookie:()=>t.tt,isBackgroundStopped:()=>s,isBlockedFetchUrl:()=>t.J,isBlockedFrameUrl:()=>t.C,isExtensionExposed:()=>t.rt,isLocalNetworkUrl:()=>t.Y,isLocatorDenied:()=>t.I,isLocatorInvalid:()=>t.M,isLocatorUnsupported:()=>t.O,isPermissionDenied:()=>t.n,isTerminalError:()=>t.P,isType:()=>t.ht,modifyRequestHeadersPermission:()=>t.R,permissions:()=>t.r,promptInstall:()=>c,readCookiePermission:()=>t.H,readExtensionHandshake:()=>t.it,removeRequestHeaderRule:()=>t.z,revive:()=>t.gt,setMissingExtensionHandler:()=>t.at,setRequestHeaderRule:()=>t.B,supportsOperation:()=>t.dt,type:()=>t._t,waitForExtensionExposure:()=>t.ot});Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return p}});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { $ as t, A as n, B as r, C as i, D as a, E as o, F as s, G as c, H as l, I as u, J as ee, K as te, L as ne, M as re, O as ie, P as ae, Q as oe, R as d, S as f, U as p, V as m, W as h, Y as g, Z as _, _ as v, _t as y, a as b, at as x, b as S, ct as C, d as w, dt as T, et as E, ft as D, g as O, gt as k, ht as A, i as j, it as M, lt as N, mt as P, n as se, nt as F, ot as I, pt as L, q as R, r as z, rt as B, t as V, tt as H, v as U, w as W, x as G, y as K, z as ce } from "./lib-
|
|
2
|
+
import { $ as t, A as n, B as r, C as i, D as a, E as o, F as s, G as c, H as l, I as u, J as ee, K as te, L as ne, M as re, O as ie, P as ae, Q as oe, R as d, S as f, U as p, V as m, W as h, Y as g, Z as _, _ as v, _t as y, a as b, at as x, b as S, ct as C, d as w, dt as T, et as E, ft as D, g as O, gt as k, ht as A, i as j, it as M, lt as N, mt as P, n as se, nt as F, ot as I, pt as L, q as R, r as z, rt as B, t as V, tt as H, v as U, w as W, x as G, y as K, z as ce } from "./lib-BrsqpUkv.js";
|
|
3
3
|
import { o as le, p as ue } from "./api-C1lxKsM1.js";
|
|
4
4
|
import { RELAY_HEADER as de } from "./contract.js";
|
|
5
5
|
import { t as fe } from "./proxy-BJ1hSZgi.js";
|
package/extension.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./lib-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./lib-C_X3WR4G.cjs"),t=require("./extension-C1oub0Dw.cjs");exports.ATTACH_FRAME_EVENT_KEY=e.i,exports.BACKGROUND_STOPPED=t.a,exports.CATEGORIES=e.w,exports.EXTENSION_ABI=e.st,exports.ExtensionOperationUnsupportedError=e.ct,exports.ExtensionOutdatedError=e.lt,exports.FORGEABLE_HEADERS=e.Q,exports.FrameWindowBlockedError=e.g,exports.FrameWindowRefusedError=e._,exports.LOCATOR_DENIED=e.A,exports.LOCATOR_ERROR=e.F,exports.LOCATOR_INVALID=e.L,exports.LOCATOR_UNSUPPORTED=e.D,exports.MAX_REASON_LENGTH=e.X,exports.PERMISSION_DENIED=e.t,exports.REQUIRED_EXTENSION_ABI=e.ut,exports.TimeoutError=e.E,exports.assertAttachableFrameUrl=e.x,exports.assertFetchableUrl=e.U,exports.assertForgeableHeaders=e.$,exports.assertLockdownApplicable=e.S,exports.assertOneCookieIdentity=e.et,exports.attachFrame=e.a,exports.attachFramePermission=e.v,exports.available=t.r,exports.box=e.pt,exports.cookies=e.V,exports.createFrame=e.y,exports.createVideoElementHandle=e.mt,exports.events=e.nt,exports.extension=e.nt,exports.fetch=e.W,exports.fetchCredentialedPermission=e.G,exports.fetchLocalPermission=e.K,exports.fetchPermission=e.q,exports.gotoPermission=e.b,exports.handleRevivableModules=e.ft,exports.hasForgedCookie=e.tt,exports.isBackgroundStopped=t.o,exports.isBlockedFetchUrl=e.J,exports.isBlockedFrameUrl=e.C,exports.isExtensionExposed=e.rt,exports.isLocalNetworkUrl=e.Y,exports.isLocatorDenied=e.I,exports.isLocatorInvalid=e.M,exports.isLocatorUnsupported=e.O,exports.isPermissionDenied=e.n,exports.isTerminalError=e.P,exports.isType=e.ht,exports.modifyRequestHeadersPermission=e.R,exports.permissions=e.r,exports.promptInstall=t.i,exports.readCookiePermission=e.H,exports.readExtensionHandshake=e.it,exports.removeRequestHeaderRule=e.z,exports.revive=e.gt,exports.setMissingExtensionHandler=e.at,exports.setRequestHeaderRule=e.B,exports.supportsOperation=e.dt,exports.type=e._t,exports.waitForExtensionExposure=e.ot;
|
package/extension.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { $ as Gate, A as WindowFrame, B as CATEGORIES, C as FrameWindowRefusal, D as RelayChoice, E as Locator, F as CategoryRequest, G as RemoteVideoElement, H as PermissionCategory, I as LegacyPermissionRequest, J as createVideoElementHandle, K as VideoElementState, L as PermissionGrant, M as createFrame, N as gotoPermission, O as StorageState, P as CategoryGrant, Q as Executor, R as PermissionRequest, S as FrameWindowOptions, T as GotoOptions, U as handleRevivableModules, V as CategoryMeta, W as BoxedVideoElement, X as revive, Y as isType, Z as type, _ as FrameEventMap, a as AttachCookies, b as FramePostMessageOptions, c as BlankPage, d as CookieMatchWire, et as GateTools, f as Frame, g as FrameEventListener, h as FrameDocumentEvent, i as AddScriptTagOptions, j as attachFramePermission, k as StorageStateCookie, l as ClearCookiesOptions, m as FrameBackendEvent, n as attachFrame, nt as SelectorPart, o as AttachFrameOptions, p as FrameBackend, q as box, s as AttachWindowOptions, t as ATTACH_FRAME_EVENT_KEY, tt as OperationRequest, u as ClearCookiesWire, v as FrameLocator, w as FrameWindowRefusedError, x as FrameWindowBlockedError, y as FrameMessageEvent, z as permissions } from "./index-C5DdoMGo.js";
|
|
2
|
-
import { $ as isLocatorDenied, A as setRequestHeaderRule, B as fetchLocalPermission, C as assertAttachableFrameUrl, D as RequestHeaderRule, E as HeaderOperation, F as FetchInit, G as assertForgeableHeaders, H as isBlockedFetchUrl, I as ProxyFetchRequest, J as LOCATOR_DENIED, K as assertOneCookieIdentity, L as assertFetchableUrl, M as SiteCookie, N as cookies, O as modifyRequestHeadersPermission, P as readCookiePermission, Q as TimeoutError, R as fetch, S as MAX_REASON_LENGTH, T as isBlockedFrameUrl, U as isLocalNetworkUrl, V as fetchPermission, W as FORGEABLE_HEADERS, X as LOCATOR_INVALID, Y as LOCATOR_ERROR, Z as LOCATOR_UNSUPPORTED, _ as BackgroundStoppedError, a as extension, b as PermissionDeniedError, c as setMissingExtensionHandler, d as ExtensionHandshake, et as isLocatorInvalid, f as ExtensionOperationUnsupportedError, g as BACKGROUND_STOPPED, h as supportsOperation, i as promptInstall, j as CookieDetails, k as removeRequestHeaderRule, l as waitForExtensionExposure, m as REQUIRED_EXTENSION_ABI, nt as isTerminalError, o as isExtensionExposed, p as ExtensionOutdatedError, q as hasForgedCookie, r as isExtensionAvailable, s as readExtensionHandshake, tt as isLocatorUnsupported, u as EXTENSION_ABI, v as isBackgroundStopped, w as assertLockdownApplicable, x as isPermissionDenied, y as PERMISSION_DENIED, z as fetchCredentialedPermission } from "./extension-
|
|
2
|
+
import { $ as isLocatorDenied, A as setRequestHeaderRule, B as fetchLocalPermission, C as assertAttachableFrameUrl, D as RequestHeaderRule, E as HeaderOperation, F as FetchInit, G as assertForgeableHeaders, H as isBlockedFetchUrl, I as ProxyFetchRequest, J as LOCATOR_DENIED, K as assertOneCookieIdentity, L as assertFetchableUrl, M as SiteCookie, N as cookies, O as modifyRequestHeadersPermission, P as readCookiePermission, Q as TimeoutError, R as fetch, S as MAX_REASON_LENGTH, T as isBlockedFrameUrl, U as isLocalNetworkUrl, V as fetchPermission, W as FORGEABLE_HEADERS, X as LOCATOR_INVALID, Y as LOCATOR_ERROR, Z as LOCATOR_UNSUPPORTED, _ as BackgroundStoppedError, a as extension, b as PermissionDeniedError, c as setMissingExtensionHandler, d as ExtensionHandshake, et as isLocatorInvalid, f as ExtensionOperationUnsupportedError, g as BACKGROUND_STOPPED, h as supportsOperation, i as promptInstall, j as CookieDetails, k as removeRequestHeaderRule, l as waitForExtensionExposure, m as REQUIRED_EXTENSION_ABI, nt as isTerminalError, o as isExtensionExposed, p as ExtensionOutdatedError, q as hasForgedCookie, r as isExtensionAvailable, s as readExtensionHandshake, tt as isLocatorUnsupported, u as EXTENSION_ABI, v as isBackgroundStopped, w as assertLockdownApplicable, x as isPermissionDenied, y as PERMISSION_DENIED, z as fetchCredentialedPermission } from "./extension-C1bcizcn.js";
|
|
3
3
|
export { ATTACH_FRAME_EVENT_KEY, AddScriptTagOptions, AttachCookies, AttachFrameOptions, AttachWindowOptions, BACKGROUND_STOPPED, type BackgroundStoppedError, BlankPage, BoxedVideoElement, CATEGORIES, CategoryGrant, type CategoryMeta, CategoryRequest, ClearCookiesOptions, ClearCookiesWire, CookieDetails, CookieMatchWire, EXTENSION_ABI, type Executor, type ExtensionHandshake, ExtensionOperationUnsupportedError, ExtensionOutdatedError, FORGEABLE_HEADERS, FetchInit, Frame, FrameBackend, FrameBackendEvent, FrameDocumentEvent, FrameEventListener, FrameEventMap, FrameLocator, FrameMessageEvent, FramePostMessageOptions, FrameWindowBlockedError, FrameWindowOptions, FrameWindowRefusal, FrameWindowRefusedError, type Gate, type GateTools, GotoOptions, HeaderOperation, LOCATOR_DENIED, LOCATOR_ERROR, LOCATOR_INVALID, LOCATOR_UNSUPPORTED, LegacyPermissionRequest, Locator, MAX_REASON_LENGTH, type OperationRequest, PERMISSION_DENIED, type PermissionCategory, type PermissionDeniedError, PermissionGrant, PermissionRequest, ProxyFetchRequest, REQUIRED_EXTENSION_ABI, RelayChoice, RemoteVideoElement, RequestHeaderRule, type SelectorPart, SiteCookie, StorageState, StorageStateCookie, TimeoutError, VideoElementState, WindowFrame, assertAttachableFrameUrl, assertFetchableUrl, assertForgeableHeaders, assertLockdownApplicable, assertOneCookieIdentity, attachFrame, attachFramePermission, isExtensionAvailable as available, box, cookies, createFrame, createVideoElementHandle, extension as events, extension, fetch, fetchCredentialedPermission, fetchLocalPermission, fetchPermission, gotoPermission, handleRevivableModules, hasForgedCookie, isBackgroundStopped, isBlockedFetchUrl, isBlockedFrameUrl, isExtensionExposed, isLocalNetworkUrl, isLocatorDenied, isLocatorInvalid, isLocatorUnsupported, isPermissionDenied, isTerminalError, isType, modifyRequestHeadersPermission, permissions, promptInstall, readCookiePermission, readExtensionHandshake, removeRequestHeaderRule, revive, setMissingExtensionHandler, setRequestHeaderRule, supportsOperation, type, waitForExtensionExposure };
|
package/extension.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as u, K as d, L as f, M as p, O as m, P as h, Q as g, R as _, S as v, U as y, V as b, W as x, X as S, Y as C, _ as w, _t as T, a as E, at as D, b as O, ct as k, dt as ee, et as A, ft as j, g as M, gt as N, ht as P, i as F, it as I, lt as L, mt as R, n as z, nt as B, ot as V, pt as H, q as U, r as W, rt as G, st as K, t as q, tt as J, ut as Y, v as X, w as Z, x as Q, y as $, z as te } from "./lib-
|
|
2
|
-
import { a as ne, i as re, o as ie, r as ae } from "./extension-
|
|
1
|
+
import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as u, K as d, L as f, M as p, O as m, P as h, Q as g, R as _, S as v, U as y, V as b, W as x, X as S, Y as C, _ as w, _t as T, a as E, at as D, b as O, ct as k, dt as ee, et as A, ft as j, g as M, gt as N, ht as P, i as F, it as I, lt as L, mt as R, n as z, nt as B, ot as V, pt as H, q as U, r as W, rt as G, st as K, t as q, tt as J, ut as Y, v as X, w as Z, x as Q, y as $, z as te } from "./lib-BrsqpUkv.js";
|
|
2
|
+
import { a as ne, i as re, o as ie, r as ae } from "./extension-Ct5qQkQF.js";
|
|
3
3
|
export { F as ATTACH_FRAME_EVENT_KEY, ne as BACKGROUND_STOPPED, Z as CATEGORIES, K as EXTENSION_ABI, k as ExtensionOperationUnsupportedError, L as ExtensionOutdatedError, g as FORGEABLE_HEADERS, M as FrameWindowBlockedError, w as FrameWindowRefusedError, t as LOCATOR_DENIED, o as LOCATOR_ERROR, f as LOCATOR_INVALID, i as LOCATOR_UNSUPPORTED, S as MAX_REASON_LENGTH, q as PERMISSION_DENIED, Y as REQUIRED_EXTENSION_ABI, a as TimeoutError, Q as assertAttachableFrameUrl, y as assertFetchableUrl, e as assertForgeableHeaders, v as assertLockdownApplicable, A as assertOneCookieIdentity, E as attachFrame, X as attachFramePermission, ae as available, H as box, b as cookies, $ as createFrame, R as createVideoElementHandle, B as events, B as extension, x as fetch, s as fetchCredentialedPermission, d as fetchLocalPermission, U as fetchPermission, O as gotoPermission, j as handleRevivableModules, J as hasForgedCookie, ie as isBackgroundStopped, u as isBlockedFetchUrl, r as isBlockedFrameUrl, G as isExtensionExposed, C as isLocalNetworkUrl, l as isLocatorDenied, p as isLocatorInvalid, m as isLocatorUnsupported, z as isPermissionDenied, h as isTerminalError, P as isType, _ as modifyRequestHeadersPermission, W as permissions, re as promptInstall, c as readCookiePermission, I as readExtensionHandshake, te as removeRequestHeaderRule, N as revive, D as setMissingExtensionHandler, n as setRequestHeaderRule, ee as supportsOperation, T as type, V as waitForExtensionExposure };
|
package/http.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { D as RelayChoice } from "./index-C5DdoMGo.js";
|
|
2
|
-
import { n as Socket, t as Server$1 } from "./net-
|
|
2
|
+
import { n as Socket, t as Server$1 } from "./net-BpyIeQ8r.js";
|
|
3
3
|
import { Buffer } from "buffer";
|
|
4
4
|
import { Stream } from "stream";
|
|
5
5
|
import { IncomingHttpHeaders, OutgoingHttpHeaders, RequestOptions } from "http";
|
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-C_X3WR4G.cjs"),n=require("./extension-C1oub0Dw.cjs"),r=require("./api-D7Sbm8Oj.cjs"),i=require("./busy-BXbVH595.cjs"),a=require("./contract.cjs"),o=require("./relay-choice-JC_JJY_M.cjs"),s=require("./cloud-B8v_yMtd.cjs"),c=require("./dns.cjs"),l=require("./net.cjs"),u=require("./dgram.cjs"),d=require("./http.cjs"),f=require("./desktop.cjs"),p=require("./account.cjs"),m=require("./fs-B8V-40ft.cjs"),h=require("./opfs.cjs"),g=require("./packages.cjs"),_=require("./rooms.cjs"),v=require("./storage.cjs"),y=require("./connect-button-BpXDs7tw.cjs");let b=require("osra");var x=(async e=>{let{kind:n,cookies:r}=t.o(e);if(n===`window`){let n=e;return r===`native`?t.a(n):s.i(n)}let i=e;return r===`native`?S(i):s.i(i)}),S=e=>(s.a(e),t.a(e)),C=`https://fkn.app`,w=async(e,t)=>{if(typeof window>`u`)throw Error(`FKN @fkn/lib: relayWorker must be called from the main thread`);let n=await r.f;if(!n)throw Error(`FKN @fkn/lib: relayWorker found no FKN transport in this realm`);r.d(),i.r(`relayed worker`,t?.unregisterSignal);let a=n.emit instanceof MessagePort?{}:{originA:t?.originA??C,originB:t?.originB??`*`};(0,b.relay)(n,e,{key:`fkn-api`,...a,unregisterSignal:t?.unregisterSignal})},T=async()=>typeof window>`u`?!1:(await r.o).connect.prompt(location.origin).catch(()=>!1),E=async()=>typeof window>`u`?null:(await r.o).relay.prompt().catch(()=>null),D=new Set,O=e=>(D.add(e),()=>{D.delete(e)}),k=()=>{if(D.size===0)return!1;for(let e of[...D])try{e()}catch{}return!0},A=(e,t)=>{if(typeof e?.onUpdateTaken==`function`)return Promise.resolve(e.onUpdateTaken(t))},j=e.t({applyUpdate:()=>W,busyReasons:()=>U,onUpdate:()=>R,onUpdateTaken:()=>z,updateReady:()=>M}),M=async()=>typeof window>`u`?!1:r.o.then(e=>e.shell?.updateReady()).then(e=>e===!0).catch(()=>!1),N=new Set,P=!1,F=()=>{P=!0;for(let e of[...N])try{e()}catch{}},I=0,L=()=>{let e=r.c();e&&N.size!==0&&I!==e.epoch&&(I=e.epoch,P=!1,Promise.resolve(e.remote.shell?.onUpdate(F)).catch(()=>{I===e.epoch&&(I=0)}))};typeof window<`u`&&r.u(L);var R=async e=>{if(typeof window>`u`)return()=>{};if(N.add(e),P)try{e()}catch{}return L(),()=>{N.delete(e)}},z=e=>typeof window>`u`?()=>{}:O(e),B=0,V=!1,H=()=>{if(!k()&&!V){V=!0;try{location.reload()}catch{}}};typeof window<`u`&&r.u(()=>{let e=r.c();if(!e||B===e.epoch)return;B=e.epoch;let t=A(e.remote.shell,H);if(!t){B=0;return}t.catch(()=>{B===e.epoch&&(B=0)})});var U=()=>i.n(),W=async()=>typeof window>`u`?!1:r.o.then(e=>e.shell?.applyUpdate()).then(e=>e===!0).catch(()=>!1);exports.ATTACH_FRAME_EVENT_KEY=t.i,exports.BACKGROUND_STOPPED=n.a,exports.CATEGORIES=t.w,exports.EXTENSION_ABI=t.st,exports.ExtensionOperationUnsupportedError=t.ct,exports.ExtensionOutdatedError=t.lt,exports.FORGEABLE_HEADERS=t.Q,exports.FrameWindowBlockedError=t.g,exports.FrameWindowRefusedError=t._,exports.LOCATOR_DENIED=t.A,exports.LOCATOR_ERROR=t.F,exports.LOCATOR_INVALID=t.L,exports.LOCATOR_UNSUPPORTED=t.D,exports.MAX_REASON_LENGTH=t.X,exports.PERMISSION_DENIED=t.t,exports.RELAY_UNAVAILABLE=a.RELAY_UNAVAILABLE,exports.REQUIRED_EXTENSION_ABI=t.ut,exports.TimeoutError=t.E,Object.defineProperty(exports,"account",{enumerable:!0,get:function(){return p.t}}),exports.assertAttachableFrameUrl=t.x,exports.assertFetchableUrl=t.U,exports.assertForgeableHeaders=t.$,exports.assertLockdownApplicable=t.S,exports.assertOneCookieIdentity=t.et,exports.attachFrame=x,exports.attachFramePermission=t.v,exports.box=t.pt,Object.defineProperty(exports,"cloud",{enumerable:!0,get:function(){return s.n}}),exports.connect=T,exports.connectButtonUrl=y.t,exports.cookies=t.V,exports.createFrame=t.y,exports.createVideoElementHandle=t.mt,Object.defineProperty(exports,"desktop",{enumerable:!0,get:function(){return f.t}}),Object.defineProperty(exports,"dgram",{enumerable:!0,get:function(){return u.t}}),Object.defineProperty(exports,"dns",{enumerable:!0,get:function(){return c.t}}),Object.defineProperty(exports,"extension",{enumerable:!0,get:function(){return n.t}}),exports.fetch=n.n,exports.fetchCredentialedPermission=t.G,exports.fetchLocalPermission=t.K,exports.fetchPermission=t.q,Object.defineProperty(exports,"fs",{enumerable:!0,get:function(){return m.u}}),exports.gotoPermission=t.b,exports.handleRevivableModules=t.ft,exports.hasForgedCookie=t.tt,Object.defineProperty(exports,"http",{enumerable:!0,get:function(){return d.t}}),exports.isBackgroundStopped=n.o,exports.isBlockedFetchUrl=t.J,exports.isBlockedFrameUrl=t.C,exports.isExtensionExposed=t.rt,exports.isLocalNetworkUrl=t.Y,exports.isLocatorDenied=t.I,exports.isLocatorInvalid=t.M,exports.isLocatorUnsupported=t.O,exports.isPermissionDenied=t.n,exports.isRelayUnavailable=o.n,exports.isTerminalError=t.P,exports.isType=t.ht,exports.modifyRequestHeadersPermission=t.R,Object.defineProperty(exports,"net",{enumerable:!0,get:function(){return l.t}}),Object.defineProperty(exports,"opfs",{enumerable:!0,get:function(){return h.t}}),Object.defineProperty(exports,"packages",{enumerable:!0,get:function(){return g.t}}),exports.permissions=t.r,exports.promptInstall=n.i,exports.promptRelay=E,exports.readCookiePermission=t.H,exports.readExtensionHandshake=t.it,exports.relayOf=o.r,exports.relayWorker=w,exports.removeRequestHeaderRule=t.z,exports.revive=t.gt,Object.defineProperty(exports,"rooms",{enumerable:!0,get:function(){return _.t}}),exports.setMissingExtensionHandler=t.at,exports.setRequestHeaderRule=t.B,Object.defineProperty(exports,"shell",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"storage",{enumerable:!0,get:function(){return v.t}}),exports.supportsOperation=t.dt,exports.type=t._t,exports.waitForExtensionExposure=t.ot;
|
package/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { $ as Gate, A as WindowFrame, B as CATEGORIES, C as FrameWindowRefusal, D as RelayChoice, E as Locator, F as CategoryRequest, G as RemoteVideoElement, H as PermissionCategory, I as LegacyPermissionRequest, J as createVideoElementHandle, K as VideoElementState, L as PermissionGrant, M as createFrame, N as gotoPermission, O as StorageState, P as CategoryGrant, Q as Executor, R as PermissionRequest, S as FrameWindowOptions, T as GotoOptions, U as handleRevivableModules, V as CategoryMeta, W as BoxedVideoElement, X as revive, Y as isType, Z as type, _ as FrameEventMap, a as AttachCookies, b as FramePostMessageOptions, c as BlankPage, d as CookieMatchWire, et as GateTools, f as Frame, g as FrameEventListener, h as FrameDocumentEvent, i as AddScriptTagOptions, j as attachFramePermission, k as StorageStateCookie, l as ClearCookiesOptions, m as FrameBackendEvent, nt as SelectorPart, o as AttachFrameOptions, p as FrameBackend, q as box, r as AttachFrameFunction, s as AttachWindowOptions, t as ATTACH_FRAME_EVENT_KEY, tt as OperationRequest, u as ClearCookiesWire, v as FrameLocator, w as FrameWindowRefusedError, x as FrameWindowBlockedError, y as FrameMessageEvent, z as permissions } from "./index-C5DdoMGo.js";
|
|
2
|
-
import { $ as isLocatorDenied, A as setRequestHeaderRule, B as fetchLocalPermission, C as assertAttachableFrameUrl, D as RequestHeaderRule, E as HeaderOperation, F as FetchInit, G as assertForgeableHeaders, H as isBlockedFetchUrl, I as ProxyFetchRequest, J as LOCATOR_DENIED, K as assertOneCookieIdentity, L as assertFetchableUrl, M as SiteCookie, N as cookies, O as modifyRequestHeadersPermission, P as readCookiePermission, Q as TimeoutError, S as MAX_REASON_LENGTH, T as isBlockedFrameUrl, U as isLocalNetworkUrl, V as fetchPermission, W as FORGEABLE_HEADERS, X as LOCATOR_INVALID, Y as LOCATOR_ERROR, Z as LOCATOR_UNSUPPORTED, _ as BackgroundStoppedError, b as PermissionDeniedError, c as setMissingExtensionHandler, d as ExtensionHandshake, et as isLocatorInvalid, f as ExtensionOperationUnsupportedError, g as BACKGROUND_STOPPED, h as supportsOperation, i as promptInstall, j as CookieDetails, k as removeRequestHeaderRule, l as waitForExtensionExposure, m as REQUIRED_EXTENSION_ABI, n as fetch, nt as isTerminalError, o as isExtensionExposed, p as ExtensionOutdatedError, q as hasForgedCookie, s as readExtensionHandshake, t as extension_d_exports, tt as isLocatorUnsupported, u as EXTENSION_ABI, v as isBackgroundStopped, w as assertLockdownApplicable, x as isPermissionDenied, y as PERMISSION_DENIED, z as fetchCredentialedPermission } from "./extension-
|
|
3
|
-
import { K as RELAY_UNAVAILABLE } from "./contract-
|
|
2
|
+
import { $ as isLocatorDenied, A as setRequestHeaderRule, B as fetchLocalPermission, C as assertAttachableFrameUrl, D as RequestHeaderRule, E as HeaderOperation, F as FetchInit, G as assertForgeableHeaders, H as isBlockedFetchUrl, I as ProxyFetchRequest, J as LOCATOR_DENIED, K as assertOneCookieIdentity, L as assertFetchableUrl, M as SiteCookie, N as cookies, O as modifyRequestHeadersPermission, P as readCookiePermission, Q as TimeoutError, S as MAX_REASON_LENGTH, T as isBlockedFrameUrl, U as isLocalNetworkUrl, V as fetchPermission, W as FORGEABLE_HEADERS, X as LOCATOR_INVALID, Y as LOCATOR_ERROR, Z as LOCATOR_UNSUPPORTED, _ as BackgroundStoppedError, b as PermissionDeniedError, c as setMissingExtensionHandler, d as ExtensionHandshake, et as isLocatorInvalid, f as ExtensionOperationUnsupportedError, g as BACKGROUND_STOPPED, h as supportsOperation, i as promptInstall, j as CookieDetails, k as removeRequestHeaderRule, l as waitForExtensionExposure, m as REQUIRED_EXTENSION_ABI, n as fetch, nt as isTerminalError, o as isExtensionExposed, p as ExtensionOutdatedError, q as hasForgedCookie, s as readExtensionHandshake, t as extension_d_exports, tt as isLocatorUnsupported, u as EXTENSION_ABI, v as isBackgroundStopped, w as assertLockdownApplicable, x as isPermissionDenied, y as PERMISSION_DENIED, z as fetchCredentialedPermission } from "./extension-C1bcizcn.js";
|
|
3
|
+
import { K as RELAY_UNAVAILABLE } from "./contract-BGMJVvTg.js";
|
|
4
4
|
import { t as account_d_exports } from "./account.js";
|
|
5
|
-
import { n as cloud_d_exports } from "./cloud-
|
|
5
|
+
import { n as cloud_d_exports } from "./cloud-CI7FFRMC.js";
|
|
6
6
|
import { t as dns_d_exports } from "./dns.js";
|
|
7
|
-
import { i as relayOf, n as RelayUnavailableError, r as isRelayUnavailable } from "./relay-choice-
|
|
8
|
-
import { s as net_d_exports } from "./net-
|
|
7
|
+
import { i as relayOf, n as RelayUnavailableError, r as isRelayUnavailable } from "./relay-choice-5yUPI-tJ.js";
|
|
8
|
+
import { s as net_d_exports } from "./net-BpyIeQ8r.js";
|
|
9
9
|
import { t as dgram_d_exports } from "./dgram.js";
|
|
10
10
|
import { t as http_d_exports } from "./http.js";
|
|
11
11
|
import { t as desktop_d_exports } from "./desktop.js";
|
|
@@ -20,10 +20,10 @@ import { t as connectButtonUrl } from "./connect-button-Cp0NS95-.js";
|
|
|
20
20
|
* Attaches FKN to an iframe the app mounted, or with `{ window }` opens the attachment in a window
|
|
21
21
|
* of its own. `cookies` picks the jar and with it the backend (`AttachCookies`): `'persistent'`, the
|
|
22
22
|
* default, and `'ephemeral'` run on the cloud render proxy whatever is installed, and never wait for
|
|
23
|
-
* the extension; `'native'` runs on the extension, waiting
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* backend serves an attachment.
|
|
23
|
+
* the extension; `'native'` runs on the extension, waiting up to 2000 ms from the call for it to
|
|
24
|
+
* announce itself, however long after the page's load that is (`waitForExtensionExposure`), and
|
|
25
|
+
* showing the install prompt when it does not. A `blank` attach is the cloud render proxy's alone, so
|
|
26
|
+
* beside `'native'` it is a TypeError. `frame.backend()` says which backend serves an attachment.
|
|
27
27
|
*
|
|
28
28
|
* A window opens before the first await, so call this directly in the click or key handler whose
|
|
29
29
|
* activation opens it. On `'persistent'` or `'ephemeral'` it opens on the cloud, extension or not. On
|
package/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { $ as t, A as n, B as r, C as i, D as
|
|
3
|
-
import { a as
|
|
4
|
-
import { c as
|
|
2
|
+
import { $ as t, A as n, B as r, C as i, D as ee, E as te, F as ne, G as re, H as ie, I as ae, J as oe, K as se, L as ce, M as le, O as ue, P as de, Q as fe, R as a, S as o, U as s, V as c, X as l, Y as u, _ as d, _t as f, a as p, at as m, b as h, ct as g, dt as _, et as v, ft as y, g as b, gt as x, ht as S, i as C, it as w, lt as T, mt as E, n as D, o as O, ot as k, pt as A, q as j, r as M, rt as N, st as P, t as F, tt as I, ut as L, v as R, w as z, x as B, y as V, z as pe } from "./lib-BrsqpUkv.js";
|
|
3
|
+
import { a as H, i as me, n as he, o as ge, t as _e } from "./extension-Ct5qQkQF.js";
|
|
4
|
+
import { c as U, d as ve, f as ye, o as W, u as G } from "./api-C1lxKsM1.js";
|
|
5
5
|
import { n as be, r as xe } from "./busy-DsMWrSzc.js";
|
|
6
6
|
import { RELAY_UNAVAILABLE as Se } from "./contract.js";
|
|
7
7
|
import { n as Ce, r as we } from "./relay-choice-BGwXRC5d.js";
|
|
8
|
-
import { a as Te, i as K, n as Ee } from "./cloud-
|
|
8
|
+
import { a as Te, i as K, n as Ee } from "./cloud-CjQfUhhD.js";
|
|
9
9
|
import { t as De } from "./dns.js";
|
|
10
10
|
import { t as Oe } from "./net.js";
|
|
11
11
|
import { t as ke } from "./dgram.js";
|
|
@@ -20,36 +20,21 @@ import { t as Le } from "./storage.js";
|
|
|
20
20
|
import { t as Re } from "./connect-button-DtsN3X1J.js";
|
|
21
21
|
import { relay as ze } from "osra";
|
|
22
22
|
//#region src/frame.ts
|
|
23
|
-
var Be =
|
|
24
|
-
if (N()) return e(!0);
|
|
25
|
-
let t, n = setTimeout(() => r(N()), Be), r = (r) => {
|
|
26
|
-
clearTimeout(t), clearTimeout(n), a.disconnect(), document.removeEventListener("readystatechange", o), e(r);
|
|
27
|
-
}, i = () => {
|
|
28
|
-
clearTimeout(t), t = setTimeout(() => r(N()), Ve);
|
|
29
|
-
}, a = new MutationObserver(() => {
|
|
30
|
-
N() && r(!0);
|
|
31
|
-
}), o = () => {
|
|
32
|
-
document.readyState === "complete" && !N() && i();
|
|
33
|
-
};
|
|
34
|
-
a.observe(document.documentElement, {
|
|
35
|
-
attributes: !0,
|
|
36
|
-
attributeFilter: ["data-fkn-extension"]
|
|
37
|
-
}), document.addEventListener("readystatechange", o), document.readyState === "complete" && i();
|
|
38
|
-
}), Ue = (async (e) => {
|
|
23
|
+
var Be = (async (e) => {
|
|
39
24
|
let { kind: t, cookies: n } = O(e);
|
|
40
25
|
if (t === "window") {
|
|
41
26
|
let t = e;
|
|
42
27
|
return n === "native" ? p(t) : K(t);
|
|
43
28
|
}
|
|
44
29
|
let r = e;
|
|
45
|
-
return n === "native" ?
|
|
46
|
-
}),
|
|
30
|
+
return n === "native" ? Ve(r) : K(r);
|
|
31
|
+
}), Ve = (e) => (Te(e), p(e)), He = "https://fkn.app", Ue = async (e, t) => {
|
|
47
32
|
if (typeof window > "u") throw Error("FKN @fkn/lib: relayWorker must be called from the main thread");
|
|
48
|
-
let n = await
|
|
33
|
+
let n = await ye;
|
|
49
34
|
if (!n) throw Error("FKN @fkn/lib: relayWorker found no FKN transport in this realm");
|
|
50
|
-
|
|
35
|
+
ve(), xe("relayed worker", t?.unregisterSignal);
|
|
51
36
|
let r = n.emit instanceof MessagePort ? {} : {
|
|
52
|
-
originA: t?.originA ??
|
|
37
|
+
originA: t?.originA ?? He,
|
|
53
38
|
originB: t?.originB ?? "*"
|
|
54
39
|
};
|
|
55
40
|
ze(n, e, {
|
|
@@ -57,35 +42,35 @@ var Be = 1e4, Ve = 150, He = () => new Promise((e) => {
|
|
|
57
42
|
...r,
|
|
58
43
|
unregisterSignal: t?.unregisterSignal
|
|
59
44
|
});
|
|
60
|
-
},
|
|
45
|
+
}, We = async () => typeof window > "u" ? !1 : (await W).connect.prompt(location.origin).catch(() => !1), Ge = async () => typeof window > "u" ? null : (await W).relay.prompt().catch(() => null), q = /* @__PURE__ */ new Set(), Ke = (e) => (q.add(e), () => {
|
|
61
46
|
q.delete(e);
|
|
62
|
-
}),
|
|
47
|
+
}), qe = () => {
|
|
63
48
|
if (q.size === 0) return !1;
|
|
64
49
|
for (let e of [...q]) try {
|
|
65
50
|
e();
|
|
66
51
|
} catch {}
|
|
67
52
|
return !0;
|
|
68
|
-
},
|
|
53
|
+
}, Je = (e, t) => {
|
|
69
54
|
if (typeof e?.onUpdateTaken == "function") return Promise.resolve(e.onUpdateTaken(t));
|
|
70
|
-
},
|
|
71
|
-
applyUpdate: () =>
|
|
72
|
-
busyReasons: () =>
|
|
73
|
-
onUpdate: () =>
|
|
74
|
-
onUpdateTaken: () =>
|
|
75
|
-
updateReady: () =>
|
|
76
|
-
}),
|
|
55
|
+
}, Ye = /* @__PURE__ */ e({
|
|
56
|
+
applyUpdate: () => nt,
|
|
57
|
+
busyReasons: () => tt,
|
|
58
|
+
onUpdate: () => Qe,
|
|
59
|
+
onUpdateTaken: () => $e,
|
|
60
|
+
updateReady: () => Xe
|
|
61
|
+
}), Xe = async () => typeof window > "u" ? !1 : W.then((e) => e.shell?.updateReady()).then((e) => e === !0).catch(() => !1), J = /* @__PURE__ */ new Set(), Y = !1, Ze = () => {
|
|
77
62
|
Y = !0;
|
|
78
63
|
for (let e of [...J]) try {
|
|
79
64
|
e();
|
|
80
65
|
} catch {}
|
|
81
66
|
}, X = 0, Z = () => {
|
|
82
|
-
let e =
|
|
83
|
-
e && J.size !== 0 && X !== e.epoch && (X = e.epoch, Y = !1, Promise.resolve(e.remote.shell?.onUpdate(
|
|
67
|
+
let e = U();
|
|
68
|
+
e && J.size !== 0 && X !== e.epoch && (X = e.epoch, Y = !1, Promise.resolve(e.remote.shell?.onUpdate(Ze)).catch(() => {
|
|
84
69
|
X === e.epoch && (X = 0);
|
|
85
70
|
}));
|
|
86
71
|
};
|
|
87
72
|
typeof window < "u" && G(Z);
|
|
88
|
-
var
|
|
73
|
+
var Qe = async (e) => {
|
|
89
74
|
if (typeof window > "u") return () => {};
|
|
90
75
|
if (J.add(e), Y) try {
|
|
91
76
|
e();
|
|
@@ -93,8 +78,8 @@ var tt = async (e) => {
|
|
|
93
78
|
return Z(), () => {
|
|
94
79
|
J.delete(e);
|
|
95
80
|
};
|
|
96
|
-
},
|
|
97
|
-
if (!
|
|
81
|
+
}, $e = (e) => typeof window > "u" ? () => {} : Ke(e), Q = 0, $ = !1, et = () => {
|
|
82
|
+
if (!qe() && !$) {
|
|
98
83
|
$ = !0;
|
|
99
84
|
try {
|
|
100
85
|
location.reload();
|
|
@@ -102,10 +87,10 @@ var tt = async (e) => {
|
|
|
102
87
|
}
|
|
103
88
|
};
|
|
104
89
|
typeof window < "u" && G(() => {
|
|
105
|
-
let e =
|
|
90
|
+
let e = U();
|
|
106
91
|
if (!e || Q === e.epoch) return;
|
|
107
92
|
Q = e.epoch;
|
|
108
|
-
let t =
|
|
93
|
+
let t = Je(e.remote.shell, et);
|
|
109
94
|
if (!t) {
|
|
110
95
|
Q = 0;
|
|
111
96
|
return;
|
|
@@ -114,6 +99,6 @@ typeof window < "u" && G(() => {
|
|
|
114
99
|
Q === e.epoch && (Q = 0);
|
|
115
100
|
});
|
|
116
101
|
});
|
|
117
|
-
var
|
|
102
|
+
var tt = () => be(), nt = async () => typeof window > "u" ? !1 : W.then((e) => e.shell?.applyUpdate()).then((e) => e === !0).catch(() => !1);
|
|
118
103
|
//#endregion
|
|
119
|
-
export { C as ATTACH_FRAME_EVENT_KEY,
|
|
104
|
+
export { C as ATTACH_FRAME_EVENT_KEY, H as BACKGROUND_STOPPED, z as CATEGORIES, P as EXTENSION_ABI, g as ExtensionOperationUnsupportedError, T as ExtensionOutdatedError, fe as FORGEABLE_HEADERS, b as FrameWindowBlockedError, d as FrameWindowRefusedError, n as LOCATOR_DENIED, ne as LOCATOR_ERROR, ce as LOCATOR_INVALID, ee as LOCATOR_UNSUPPORTED, l as MAX_REASON_LENGTH, F as PERMISSION_DENIED, Se as RELAY_UNAVAILABLE, L as REQUIRED_EXTENSION_ABI, te as TimeoutError, Me as account, B as assertAttachableFrameUrl, s as assertFetchableUrl, t as assertForgeableHeaders, o as assertLockdownApplicable, v as assertOneCookieIdentity, Be as attachFrame, R as attachFramePermission, A as box, Ee as cloud, We as connect, Re as connectButtonUrl, c as cookies, V as createFrame, E as createVideoElementHandle, je as desktop, ke as dgram, De as dns, _e as extension, he as fetch, re as fetchCredentialedPermission, se as fetchLocalPermission, j as fetchPermission, Ne as fs, h as gotoPermission, y as handleRevivableModules, I as hasForgedCookie, Ae as http, ge as isBackgroundStopped, oe as isBlockedFetchUrl, i as isBlockedFrameUrl, N as isExtensionExposed, u as isLocalNetworkUrl, ae as isLocatorDenied, le as isLocatorInvalid, ue as isLocatorUnsupported, D as isPermissionDenied, Ce as isRelayUnavailable, de as isTerminalError, S as isType, a as modifyRequestHeadersPermission, Oe as net, Pe as opfs, Fe as packages, M as permissions, me as promptInstall, Ge as promptRelay, ie as readCookiePermission, w as readExtensionHandshake, we as relayOf, Ue as relayWorker, pe as removeRequestHeaderRule, x as revive, Ie as rooms, m as setMissingExtensionHandler, r as setRequestHeaderRule, Ye as shell, Le as storage, _ as supportsOperation, f as type, k as waitForExtensionExposure };
|