@fkn/lib 0.9.64 → 0.9.66
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/README.md +1 -2
- package/account-Bm7uIcQo.d.ts +39 -0
- package/account-Uh0-1Cbp.js +22 -0
- package/{account-generation-BiZxPztj.cjs → account-generation-ACCBzaI-.cjs} +1 -1
- package/{account-generation-DvRuJDa2.js → account-generation-BKHNe-jL.js} +2 -3
- package/account-m2iCmNui.cjs +1 -0
- package/{account-storage-D8CBG1cv.js → account-storage-BmCVutNL.js} +4 -5
- package/{account-storage-Co9IvkPr.d.ts → account-storage-UmSfF63A.d.ts} +1 -66
- package/{account-storage-DpHBgeX5.cjs → account-storage-dYWDpqsr.cjs} +1 -1
- package/account.cjs +1 -1
- package/account.d.ts +3 -40
- package/account.js +1 -23
- package/{api-xh6lzApn.d.ts → api-0Yp9uZcV.d.ts} +3 -7
- package/{api-BvJu2X1L.js → api-DRglK7ft.js} +19 -21
- package/{api-CrUO33y-.cjs → api-DrvhPN56.cjs} +1 -1
- package/api.cjs +1 -1
- package/api.d.ts +2 -2
- package/api.js +1 -2
- package/attach-policy.d.ts +0 -4
- package/attach-policy.js +2 -3
- package/{broker-frame-B31OXcnH.js → broker-frame-vjSpBa8d.js} +1 -2
- package/broker-frame.d.ts +1 -3
- package/broker-frame.js +1 -2
- package/{busy-DsMWrSzc.js → busy-C1JPjoZ_.js} +1 -2
- package/cloud/dgram.cjs +1 -1
- package/cloud/dgram.d.ts +1 -1
- package/cloud/dgram.js +1 -2
- package/cloud/dns.cjs +1 -1
- package/cloud/dns.d.ts +2 -2
- package/cloud/dns.js +1 -2
- package/cloud/fetch.cjs +1 -1
- package/cloud/fetch.d.ts +1 -1
- package/cloud/fetch.js +1 -2
- package/cloud/fs/promises.cjs +1 -1
- package/cloud/fs/promises.d.ts +3 -5
- package/cloud/fs/promises.js +2 -3
- package/cloud/fs.cjs +1 -1
- package/cloud/fs.d.ts +4 -4
- package/cloud/fs.js +4 -34
- package/cloud/http.cjs +1 -1
- package/cloud/http.d.ts +1 -1
- package/cloud/http.js +1 -2
- package/cloud/net.cjs +1 -1
- package/cloud/net.d.ts +1 -1
- package/cloud/net.js +3 -3
- package/{cloud-CI7FFRMC.d.ts → cloud-BoH54gaM.d.ts} +7 -11
- package/{cloud-FW59_g8F.js → cloud-C7StNncS.js} +15 -16
- package/cloud-TN0eDUy3.cjs +1 -0
- package/cloud.cjs +1 -1
- package/cloud.d.ts +7 -7
- package/cloud.js +7 -7
- package/connect-button-2FmOM8ai.d.ts +2 -0
- package/{connect-button-DtsN3X1J.js → connect-button-C1wKkIhh.js} +1 -2
- package/{contract-BGMJVvTg.d.ts → contract-0rua6Wsh.d.ts} +11 -6
- package/contract.d.ts +3 -3
- package/contract.js +1 -2
- package/desktop-DOubT4ES.d.ts +57 -0
- package/desktop-vXKU4wEK.cjs +1 -0
- package/desktop-xTT7ciGX.js +50 -0
- package/desktop.cjs +1 -1
- package/desktop.d.ts +2 -58
- package/desktop.js +1 -51
- package/dgram-BBbLokVF.js +397 -0
- package/dgram-BYk-QDHW.d.ts +118 -0
- package/dgram-D9ljiUFh.cjs +1 -0
- package/dgram.cjs +1 -1
- package/dgram.d.ts +2 -119
- package/dgram.js +1 -410
- package/dns-2v96zoEh.cjs +1 -0
- package/dns-DyB4K2oE.d.ts +9 -0
- package/dns-o8DLFjP1.js +5 -0
- package/dns.cjs +1 -1
- package/dns.d.ts +3 -10
- package/dns.js +1 -6
- package/extension-BXBjpypy.cjs +1 -0
- package/{extension-Chmpunqf.js → extension-D5UMnEmQ.js} +9 -11
- package/{extension-C1bcizcn.d.ts → extension-D98KM8W7.d.ts} +1 -27
- package/extension.cjs +1 -1
- package/extension.d.ts +2 -2
- package/extension.js +2 -2
- package/fs/promises.cjs +1 -1
- package/fs/promises.d.ts +2 -4
- package/fs/promises.js +2 -3
- package/fs--MLHvMW-.cjs +1 -0
- package/fs-BX_ghRy0.cjs +1 -0
- package/fs-BnWXGRik.js +33 -0
- package/{fs-DCJAYoYy.d.ts → fs-ChOYC6VD.d.ts} +3 -4
- package/{fs-Djuaj5pQ.js → fs-Cw7CcUhx.js} +17 -41
- package/fs.cjs +1 -1
- package/fs.d.ts +4 -4
- package/fs.js +2 -2
- package/{hosts-t7CKGTRz.js → hosts-HUfgMimI.js} +1 -2
- package/http-BE3UBktN.cjs +9 -0
- package/http-CDhG4bUc.d.ts +187 -0
- package/http-DIDjdm08.js +523 -0
- package/http.cjs +1 -9
- package/http.d.ts +2 -188
- package/http.js +1 -542
- package/index-CUWTpQKP.d.ts +87 -0
- package/{index-BQgZVQl7.d.ts → index-CcVwh9yz.d.ts} +0 -2
- package/{index-C5DdoMGo.d.ts → index-Cu5EcdK0.d.ts} +0 -59
- package/{index-57lTXnoe.d.ts → index-D6GPJ4Ow.d.ts} +29 -26
- package/index.cjs +1 -1
- package/index.d.ts +17 -25
- package/index.js +22 -27
- package/lib-Bs-g5jyp.cjs +53 -0
- package/{lib-BrsqpUkv.js → lib-CtJaID_y.js} +7 -31
- package/{messages-AdPfdoLV.d.ts → messages-B9dOXntM.d.ts} +0 -2
- package/messages.d.ts +1 -1
- package/messages.js +1 -2
- package/net-COkJw8lV.js +286 -0
- package/net-Dk2kqtgE.cjs +1 -0
- package/{net-BpyIeQ8r.d.ts → net-mVAYXs8e.d.ts} +5 -7
- package/net.cjs +1 -1
- package/net.d.ts +1 -1
- package/net.js +3 -323
- package/{node-fs-DY2fO5zd.js → node-fs-B4pY08Kc.js} +3 -10
- package/node-fs-DN0ejGTL.cjs +1 -0
- package/opfs/promises.cjs +1 -1
- package/opfs/promises.d.ts +2 -4
- package/opfs/promises.js +2 -3
- package/{opfs-D0goLAQW.js → opfs-CzCfVam3.js} +2 -3
- package/opfs-D3pYzYRc.js +35 -0
- package/opfs-DuXvTgIl.cjs +1 -0
- package/opfs.cjs +1 -1
- package/opfs.d.ts +3 -88
- package/opfs.js +1 -36
- package/package.json +1 -1
- package/packages-BEadIy_h.d.ts +155 -0
- package/packages-Cws_rcgf.js +346 -0
- package/packages-DT8vPB5_.cjs +1 -0
- package/packages.cjs +1 -1
- package/packages.d.ts +3 -156
- package/packages.js +1 -347
- package/{proxy-C4sYkxB5.js → proxy-BBAQxJmP.js} +5 -6
- package/{proxy-Dz60YyYy.d.ts → proxy-BP40IXYD.d.ts} +2 -4
- package/{proxy-jdE5tCwz.cjs → proxy-DVgGp6A8.cjs} +1 -1
- package/react.cjs +1 -1
- package/react.d.ts +16 -4
- package/react.js +96 -7
- package/{relay-choice-BGwXRC5d.js → relay-choice-Bb3oP2gw.js} +1 -2
- package/{relay-choice-5yUPI-tJ.d.ts → relay-choice-DOUttUnL.d.ts} +2 -4
- package/{rolldown-runtime-Dy4uBu1J.js → rolldown-runtime-CGnMp29N.js} +1 -2
- package/rooms-C6mbannC.d.ts +227 -0
- package/rooms-DHFS9cwA.cjs +1 -0
- package/rooms-DP5stTEr.js +300 -0
- package/rooms.cjs +1 -1
- package/rooms.d.ts +3 -228
- package/rooms.js +1 -301
- package/storage-BCjYihUO.cjs +1 -0
- package/storage-BhfImh_2.js +136 -0
- package/storage-DpCLksAa.d.ts +68 -0
- package/storage.cjs +1 -1
- package/storage.d.ts +3 -69
- package/storage.js +1 -137
- package/{utils-Cyq8uJiy.js → utils-DtWP-E9x.js} +1 -2
- package/{wire-Fk5pJaoy.d.ts → wire-DhmLnYEU.d.ts} +0 -2
- package/wire.d.ts +1 -1
- package/wire.js +1 -2
- package/cloud-DcgY8Xfp.cjs +0 -1
- package/connect-button-Cp0NS95-.d.ts +0 -4
- package/extension-I2Ziv2pk.cjs +0 -1
- package/fs-DeyJwJ3w.cjs +0 -1
- package/lib-C_X3WR4G.cjs +0 -53
- package/node-fs-vsWuoMGa.cjs +0 -1
package/lib-Bs-g5jyp.cjs
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./hosts-GNBhZO3-.cjs");let n=require("osra");var r=(e,t)=>{let n=new EventTarget,r=new Map,i=EventTarget.prototype.addEventListener.bind(n),a=EventTarget.prototype.removeEventListener.bind(n);return Object.defineProperty(n,"addEventListener",{configurable:!0,value:(a,o,s)=>{if(o===null)return;let c=r.get(a);if(c===void 0){let i=r=>{n.dispatchEvent(new CustomEvent(a,{detail:t(r,e),bubbles:r.bubbles,cancelable:r.cancelable,composed:r.composed}))};e.addEventListener(a,i),c={forward:i,listeners:new Set},r.set(a,c)}c.listeners.add(o),i(a,o,s)}}),Object.defineProperty(n,"removeEventListener",{configurable:!0,value:(t,n,i)=>{if(n===null)return;a(t,n,i);let o=r.get(t);o!==void 0&&(o.listeners.delete(n),!(o.listeners.size>0)&&(e.removeEventListener(t,o.forward),r.delete(t)))}}),n},i=e=>typeof e==`boolean`?+!!e:+!!e?.capture,a=e=>{let t=new WeakMap;return{addEventListener:(n,r,a)=>{if(r===null)return;let o=`${n}|${i(a)}`,s=t.get(r);if(s||(s=new Map,t.set(r,s)),s.has(o))return;let c=typeof a==`object`&&!!a&&!!a.once,l=t=>{c&&s.delete(o);let i=e.unenrich(t,n);typeof r==`function`?r.call(e.target,i):r.handleEvent(i)};s.set(o,l),e.remoteEvents.addEventListener(n,l,a)},removeEventListener:(n,r,a)=>{if(r===null)return;let o=`${n}|${i(a)}`,s=t.get(r),c=s?.get(o);c&&(e.remoteEvents.removeEventListener(n,c,a),s.delete(o))},dispatchEvent:t=>e.remoteEvents.dispatchEvent(t)}},o=e.t({box:()=>x,createVideoElementHandle:()=>y,isType:()=>b,revive:()=>S,type:()=>s}),s=`videoElement`,c=[`currentTime`,`volume`,`muted`,`playbackRate`,`src`,`loop`,`autoplay`,`preload`,`poster`,`disableRemotePlayback`],l=[`duration`,`paused`,`ended`,`seeking`,`readyState`,`currentSrc`],u=[`buffered`,`seekable`],d=Symbol.for(`fkn.remoteVideoElement`),f=Symbol.for(`fkn.remoteVideoElement.state`),p=Symbol.for(`fkn.remoteVideoElement.controller`),m=e=>e?Array.from({length:e.length},(t,n)=>[e.start(n),e.end(n)]):[],h=e=>{let t={};for(let n of[...c,...l])t[n]=e[n];for(let n of u)t[n]=m(e[n]);return t.error=e.error?{code:e.error.code,message:e.error.message}:null,t},g=e=>{let t=t=>{if(!Number.isInteger(t)||t<0||t>=e.length)throw new DOMException(`Index or size is negative or greater than the allowed amount`,`IndexSizeError`)};return{get length(){return e.length},start(n){return t(n),e[n][0]},end(n){return t(n),e[n][1]}}},_=e=>e?{code:e.code,message:e.message,MEDIA_ERR_ABORTED:1,MEDIA_ERR_NETWORK:2,MEDIA_ERR_DECODE:3,MEDIA_ERR_SRC_NOT_SUPPORTED:4}:null,v=e=>r(e,(e,t)=>({originalDetail:e instanceof CustomEvent?e.detail:null,snapshot:h(t)})),ee=async(e,t)=>{switch(t){case`play`:return await e.play(),null;case`pause`:return e.pause(),null;case`load`:return e.load(),null;case`requestPictureInPicture`:if(typeof e.requestPictureInPicture!=`function`)throw Error(`requestPictureInPicture is not supported in this environment`);return await e.requestPictureInPicture(),null;case`exitPictureInPicture`:{let t=e.ownerDocument;if(typeof t?.exitPictureInPicture!=`function`)throw Error(`exitPictureInPicture is not supported in this environment`);return await t.exitPictureInPicture(),null}default:throw Error(`videoElement: unknown method "${t}"`)}},te=e=>({call:async t=>ee(e,t),set:async(t,n)=>{try{e[t]=n}catch{}return h(e)},events:v(e)}),ne=(e,t)=>{let n=new EventTarget;Object.defineProperty(n,d,{value:!0}),Object.defineProperty(n,f,{value:e}),Object.defineProperty(n,p,{value:t});let r=a({target:n,remoteEvents:t.events,unenrich:(t,n)=>{if(!(t instanceof CustomEvent))return t;let r=t.detail;if(!r||!(`snapshot`in r))return t;Object.assign(e,r.snapshot);let i={bubbles:t.bubbles,cancelable:t.cancelable,composed:t.composed};return r.originalDetail===null?new Event(n,i):new CustomEvent(n,{...i,detail:r.originalDetail})}}),i={addEventListener:{configurable:!0,value:r.addEventListener},removeEventListener:{configurable:!0,value:r.removeEventListener},dispatchEvent:{configurable:!0,value:r.dispatchEvent},error:{configurable:!0,enumerable:!0,get(){return _(e.error)}},play:{configurable:!0,value:()=>t.call(`play`,[])},pause:{configurable:!0,value:()=>{t.call(`pause`,[]).catch(()=>{})}},load:{configurable:!0,value:()=>{t.call(`load`,[]).catch(()=>{})}},requestPictureInPicture:{configurable:!0,value:()=>t.call(`requestPictureInPicture`,[])},exitPictureInPicture:{configurable:!0,value:()=>t.call(`exitPictureInPicture`,[])},HAVE_FUTURE_DATA:{enumerable:!0,value:3},HAVE_ENOUGH_DATA:{enumerable:!0,value:4}};for(let n of c)i[n]={configurable:!0,enumerable:!0,get(){return e[n]},set(r){e[n]=r,t.set(n,r).then(t=>{Object.assign(e,t)},()=>{})}};for(let t of l)i[t]={configurable:!0,enumerable:!0,get(){return e[t]}};for(let t of u)i[t]={configurable:!0,enumerable:!0,get(){return g(e[t])}};return Object.defineProperties(n,i),n},y=e=>ne(h(e),te(e)),b=e=>typeof e==`object`&&!!e&&e[d]===!0,x=(e,t)=>{let r=e;return{...n.BoxBase,type:s,initialState:r[f],controller:(0,n.recursiveBox)(r[p],t)}},S=(e,t)=>{let r=(0,n.recursiveRevive)(e.controller,t);return ne({...e.initialState},r)},C=e=>{let t=[];return e.forEach((e,n)=>{t.push([n,e])}),t},re=`headers`,ie={type:re,isType:e=>e instanceof Headers,box:e=>({...n.BoxBase,type:re,entries:C(e)}),revive:e=>new Headers(e.entries)},ae=`response`,oe=new Set([101,204,205,304]),se={type:ae,isType:e=>e instanceof Response,box:(e,t)=>({...n.BoxBase,type:ae,status:e.status,statusText:e.statusText,headers:ie.box(e.headers),body:e.body?(0,n.recursiveBox)(e.body,t):null,url:e.url,redirected:e.redirected}),revive:(e,t)=>{if(e.status===0)return Response.error();let r=ie.revive(e.headers),i=e.body?(0,n.recursiveRevive)(e.body,t):null,a=oe.has(e.status);i&&a&&i.cancel().catch(()=>{});let o=new Response(a?null:i,{status:e.status,statusText:e.statusText,headers:r});return e.url&&Object.defineProperty(o,"url",{value:e.url,configurable:!0}),e.redirected&&Object.defineProperty(o,"redirected",{value:!0,configurable:!0}),o}},ce=e=>[o,ie,se,...e],le=5,ue=0,de=`fknExtension`,fe=`fknExtensionAbi`,pe=`fknExtensionOps`,me=[`data-fkn-extension`,`data-fkn-extension-abi`,`data-fkn-extension-ops`],he=e=>{if(e===void 0)return 0;let t=Number(e);return Number.isInteger(t)&&t>=0?t:0},ge=e=>e===void 0?null:e.split(`,`).map(e=>e.trim()).filter(Boolean),_e=(e,t=0)=>{if(e.fknExtension!==`true`)return{status:`absent`};let n=he(e[fe]),r=ge(e[pe]);return n<t?{status:`outdated`,abi:n,required:t,operations:r}:{status:`ok`,abi:n,operations:r}},ve=(e,t)=>e.status===`ok`?e.operations===null||e.operations.includes(t):!1,ye=(e,t)=>e.status===`ok`&&e.operations!==null&&e.operations.includes(t),w=class extends Error{abi;required;name=`ExtensionOutdatedError`;constructor(e,t){super(`The FKN WebExtension is installed but too old for this page: it speaks ABI ${e} and this page needs at least ${t}. Updating the extension fixes this.`),this.abi=e,this.required=t}},T=class extends Error{operation;abi;name=`ExtensionOperationUnsupportedError`;constructor(e,t,n){super(n??`The FKN WebExtension does not support "${e}" (ABI ${t}). Updating the extension may add it.`),this.operation=e,this.abi=t}},be=`FKN_WEB_EXTENSION_MAIN_WORLD_CONTENT_SCRIPT_ENABLED_EVENT_KEY`,xe=(0,n.createTypedEventTarget)();typeof document<`u`&&document.addEventListener(be,()=>{xe.dispatchEvent(new CustomEvent(`statuschange`,{detail:{enabled:Se()}}))});var Se=()=>typeof document>`u`?!1:document.documentElement.dataset[de]===`true`,E=()=>typeof document>`u`?{status:`absent`}:_e(document.documentElement.dataset),Ce=null,we=e=>{Ce=e},D=(e=2e3)=>new Promise((t,n)=>{let r=()=>E().status===`ok`;if(r())return t();let i=e=>{clearTimeout(s),o.disconnect(),e()},a=()=>i(async()=>{let e=E();if(e.status===`outdated`)return n(new w(e.abi,e.required));if(Ce){if(await Ce().catch(()=>{}),r())return t();let e=E();if(e.status===`outdated`)return n(new w(e.abi,e.required))}n(Error(`The FKN WebExtension is not installed, enabled or not exposed on this page.`))}),o=new MutationObserver(()=>{r()&&i(t)}),s=setTimeout(a,e);o.observe(document.documentElement,{attributes:!0,attributeFilter:[...me]})}),Te,O=new Proxy({},{get:(e,t)=>async(...e)=>{await D(),Te??=(0,n.expose)({},{transport:window,revivableModules:ce});let r=(await Te)[t];return r(...e)}}),k=[`origin`,`referer`,`cookie`],Ee=(e,t)=>(e??[]).some(([e,n])=>e.trim().toLowerCase()===t&&n!==``),De=e=>Ee(e,`cookie`),Oe=(e,t)=>{if(t===`include`&&De(e))throw Error(`fetch: a forged Cookie header and credentials:'include' are different identities - send one or the other`)},ke=(e,t)=>{if(!Array.isArray(t))throw Error(`${e}: requestHeaders must be an array of header operations`);let n=[...new Set(t.map(e=>{let t=e?.header;return typeof t==`string`?t.trim().toLowerCase():String(t)}).filter(e=>!k.includes(e)))];if(n.length)throw Error(`${e}: refusing to rewrite request header(s): ${n.join(`, `)}`)},Ae=e=>{let t=[...new Set((e??[]).map(([e])=>e.trim().toLowerCase()).filter(e=>!k.includes(e)))];if(t.length)throw Error(`fetch: refusing to forge request header(s): ${t.join(`, `)}`)},je=`fkn.app,fkn.dev,sdbx.app,horionsoftware.com,webvpn.dev,fknmail.app,clairv.app,fkn.cloudflareaccess.com,me-62e.workers.dev,62e9d4fbf21d90ebd4342e54b4babbd3.r2.cloudflarestorage.com,62e9d4fbf21d90ebd4342e54b4babbd3.eu.r2.cloudflarestorage.com,62e9d4fbf21d90ebd4342e54b4babbd3.fedramp.r2.cloudflarestorage.com,pub-8a3dc68041874c7e9c9a54bde972605a.r2.dev,pub-3d97d79220b94243812e60b0e742f2c5.r2.dev,pub-f8bd4876cc3c4b4a951715da5958e49c.r2.dev,web-b3z.pages.dev,fkn-console.pages.dev,dev-dms.pages.dev,fkn-www.pages.dev,fkn-homepage.pages.dev,fkn-sandbox.pages.dev,internal-3ar.pages.dev,stub-ben.pages.dev,ripple-3t3.pages.dev,media-player-e3s.pages.dev,youtube-3c4.pages.dev,horionsoftware.pages.dev,container-ckf.pages.dev,stub-plugin.pages.dev,social-3n2.pages.dev,plugins.banou.dev`.split(`,`),Me=e=>e.toLowerCase().replace(/\.+$/,``),Ne=[`79.127.204.69`,`152.233.49.59`],Pe=e=>{let t;try{t=new URL(`http://${e.includes(`:`)&&!e.startsWith(`[`)?`[${e}]`:e}/`).hostname}catch{return}let n=/^\[(?:::ffff:|64:ff9b::)([0-9a-f]{1,4}):([0-9a-f]{1,4})\]$/.exec(t);if(n){let e=parseInt(n[1],16),t=parseInt(n[2],16);return[e>>8,e&255,t>>8,t&255].join(`.`)}return/^\d+\.\d+\.\d+\.\d+$/.test(t)?t:void 0},A=e=>{let t=Me(e);if(je.some(e=>t===e||t.endsWith(`.${e}`)))return!0;let n=Pe(t);return n!==void 0&&Ne.includes(n)},Fe=100,Ie=e=>[...e.trim()],j=(e,t)=>{if(typeof t!=`string`)return;let n=Ie(t).length;if(n>100)throw TypeError(`${e}: reason must be at most 100 characters, not ${n}`)},Le={scope:`network.fetch`,category:`network`,severity:0,title:`Fetch data from other sites`,description:`Lets the app download public data from other websites directly, past the usual cross-origin limits.`},Re={scope:`network.fetchCredentialed`,category:`network`,severity:3,chip:`load as you`,unsafe:!0,title:`Fetch from other sites, signed in as you`,description:`Lets the app fetch other sites using your logged-in session cookies, so it can read data only you should see.`},ze={scope:`network.fetchLocal`,category:`network`,severity:3,chip:`local network`,unsafe:!0,title:`Access devices on your local network`,description:`Lets the app reach devices and services on your home or work network, which websites normally cannot touch.`},Be=e=>{let t=e.match(/^(\d+)\.(\d+)\.\d+\.\d+$/);if(!t)return!1;let[n,r]=[Number(t[1]),Number(t[2])];return n===10||n===127||n===0||n===169&&r===254||n===172&&r>=16&&r<=31||n===192&&r===168},Ve=e=>{let t;try{t=new URL(e)}catch{return!1}let n=t.hostname.replace(/^\[|\]$/g,``).toLowerCase().replace(/\.$/,``);return n===`localhost`||n.endsWith(`.localhost`)||n.endsWith(`.local`)||n.endsWith(`.internal`)||n.endsWith(`.home.arpa`)?!0:n.includes(`:`)?n===`::`||n===`::1`||n.startsWith(`fc`)||n.startsWith(`fd`)||/^fe[89ab]/.test(n)||n.startsWith(`::ffff:`):Be(n)},He=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`chrome-extension:`||t.protocol===`moz-extension:`||A(t.hostname)},Ue=e=>{if(He(e))throw Error(`fetch: refusing to target the extension's own pages or FKN platform domains`)},We=e=>{if(!e?.headers)return;let t=new Headers(e.headers),n=k.map(e=>{let n=t.get(e);return n===null||n===``?void 0:[e,n]}).filter(e=>e!==void 0);return n.length?n:void 0},Ge=async(e,t)=>{j(`fetch`,t?.reason);let n=new Request(e,t);Ue(n.url);let r=n.body?await n.arrayBuffer():null;return O.proxyFetch({url:n.url,method:n.method,headers:[...n.headers],body:r,credentials:t?.credentials===`include`?`include`:`omit`,redirect:n.redirect,unsafeHeaders:We(t),reason:t?.reason,signal:t?.signal??void 0})},Ke=e=>{for(let t of e)if(typeof t==`string`&&A(t.trim().toLowerCase()))return t},qe=e=>{let t=e.trim().toLowerCase().replace(/^\.+|\.+$/g,``);return t!==``&&(A(t)||[...je,...Ne].some(e=>e.endsWith(`.${t}`)))},Je=e=>{for(let t of e)if(typeof t==`string`&&qe(t))return t},Ye=e=>`${e}: refusing to target FKN platform domains`,Xe=(e,t)=>{if(Ke(t)!==void 0)throw Error(Ye(e))},Ze=e=>{try{return new URL(String(e)).hostname}catch{return``}},M=(e,t)=>{if(Je(t)!==void 0)throw Error(Ye(e))},Qe={scope:`network.readCookie`,category:`network`,severity:3,chip:`read cookie`,unsafe:!0,title:`Read a site’s cookie`,description:`Lets the app read a named cookie from another site, which can include the login token only that site should see.`},$e={get:async e=>(Xe(`cookies.get`,[Ze(e.url)]),O.getCookie(e))},et={scope:`network.modifyRequestHeaders`,category:`network`,severity:2,chip:`rewrite headers`,unsafe:!0,title:`Rewrite request headers to other sites`,description:`Lets the app set or remove headers (like Origin and Referer) on this page’s own requests to the listed sites.`},tt=async e=>(M(`setRequestHeaderRule`,e.domains),ke(`setRequestHeaderRule`,e.requestHeaders),j(`setRequestHeaderRule`,e.reason),O.setRequestHeaderRule(e)),nt=e=>O.removeRequestHeaderRule({ruleId:e}),rt=class extends Error{reason;filename;line;column;source;constructor(e,t,n,r,i){super(`${e}:${n}:${r}: ${t}`),this.reason=t,this.filename=e,this.line=n,this.column=r,this.source=i}},it=class{start;end;source;constructor(e,t,n){this.start=e,this.end=t,this.source=n}},N;(function(e){e.stylesheet=`stylesheet`,e.rule=`rule`,e.declaration=`declaration`,e.comment=`comment`,e.atRule=`at-rule`,e.container=`container`,e.charset=`charset`,e.counterStyle=`counter-style`,e.document=`document`,e.customMedia=`custom-media`,e.fontFace=`font-face`,e.fontFeatureValues=`font-feature-values`,e.host=`host`,e.import=`import`,e.keyframes=`keyframes`,e.keyframe=`keyframe`,e.layer=`layer`,e.media=`media`,e.namespace=`namespace`,e.page=`page`,e.pageMarginBox=`page-margin-box`,e.positionTry=`position-try`,e.property=`property`,e.scope=`scope`,e.startingStyle=`starting-style`,e.supports=`supports`,e.viewTransition=`view-transition`})(N||={});var at=(e,t,n)=>{let r=n,i=1e4;do{let n=t.map(t=>e.indexOf(t,r));n.push(e.indexOf(`\\`,r));let a=n.filter(e=>e!==-1);if(a.length===0)return-1;let o=Math.min(...a);if(e[o]!==`\\`)return o;r=o+2,i--}while(i>0);throw Error(`Too many escaping`)},P=(e,t,n)=>{let r=n,i=1e4;do{let n=t.map(t=>e.indexOf(t,r));n.push(e.indexOf(`(`,r)),n.push(e.indexOf(`"`,r)),n.push(e.indexOf(`'`,r)),n.push(e.indexOf(`\\`,r));let a=n.filter(e=>e!==-1);if(a.length===0)return-1;let o=Math.min(...a);switch(e[o]){case`\\`:r=o+2;break;case`(`:{let t=P(e,[`)`],o+1);if(t===-1)return-1;r=t+1}break;case`"`:{let t=at(e,[`"`],o+1);if(t===-1)return-1;r=t+1}break;case`'`:{let t=at(e,[`'`],o+1);if(t===-1)return-1;r=t+1}break;default:return o}i--}while(i>0);throw Error(`Too many escaping`)},ot=/\/\*[^]*?(?:\*\/|$)/g;function F(e){return e?e.trim():``}function st(e,t){let n=e&&typeof e.type==`string`,r=n?e:t;for(let t in e){let n=e[t];Array.isArray(n)?n.forEach(e=>{st(e,r)}):n&&typeof n==`object`&&st(n,r)}return n&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var ct=class{level=0;indentation=` `;compress=!1;constructor(e){typeof e?.indent==`string`&&(this.indentation=e?.indent),e?.compress&&(this.compress=!0)}emit(e,t){return e}indent(e){return this.level=this.level||1,e?(this.level+=e,``):Array(this.level).join(this.indentation)}visit(e){switch(e.type){case N.stylesheet:return this.stylesheet(e);case N.rule:return this.rule(e);case N.declaration:return this.declaration(e);case N.comment:return this.comment(e);case N.container:return this.container(e);case N.charset:return this.charset(e);case N.counterStyle:return this.counterStyle(e);case N.document:return this.document(e);case N.customMedia:return this.customMedia(e);case N.fontFace:return this.fontFace(e);case N.fontFeatureValues:return this.fontFeatureValues(e);case N.host:return this.host(e);case N.import:return this.import(e);case N.keyframes:return this.keyframes(e);case N.keyframe:return this.keyframe(e);case N.layer:return this.layer(e);case N.media:return this.media(e);case N.namespace:return this.namespace(e);case N.page:return this.page(e);case N.pageMarginBox:return this.pageMarginBox(e);case N.positionTry:return this.positionTry(e);case N.property:return this.property(e);case N.scope:return this.scope(e);case N.startingStyle:return this.startingStyle(e);case N.supports:return this.supports(e);case N.viewTransition:return this.viewTransition(e);case N.atRule:return this.genericAtRule(e)}}mapVisit(e,t){let n=``;t||=``;for(let r=0,i=e.length;r<i;r++)n+=this.visit(e[r]),t&&r<i-1&&(n+=this.emit(t));return n}compile(e){return this.compress?e.stylesheet.rules.map(this.visit,this).join(``):this.stylesheet(e)}stylesheet(e){return this.mapVisit(e.stylesheet.rules,`
|
|
2
|
+
|
|
3
|
+
`)}comment(e){return this.compress?this.emit(``,e.position):this.emit(`${this.indent()}/*${e.comment}*/`,e.position)}container(e){return this.compress?this.emit(`@container ${e.container}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@container ${e.container}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
4
|
+
|
|
5
|
+
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}layer(e){return this.compress?this.emit(`@layer ${e.layer}`,e.position)+(e.rules?this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):`;`):this.emit(`${this.indent()}@layer ${e.layer}`,e.position)+(e.rules?this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
6
|
+
|
|
7
|
+
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`):`;`)}import(e){return this.emit(`@import ${e.import};`,e.position)}media(e){return this.compress?this.emit(`@media ${e.media}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@media ${e.media}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
8
|
+
|
|
9
|
+
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}document(e){let t=`@${e.vendor||``}document ${e.document}`;return this.compress?this.emit(t,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(t,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
10
|
+
|
|
11
|
+
`)+this.emit(`${this.indent(-1)}\n}`)}charset(e){return this.emit(`@charset ${e.charset};`,e.position)}namespace(e){return this.emit(`@namespace ${e.namespace};`,e.position)}startingStyle(e){return this.compress?this.emit(`@starting-style`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@starting-style`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
12
|
+
|
|
13
|
+
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}supports(e){return this.compress?this.emit(`@supports ${e.supports}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@supports ${e.supports}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
14
|
+
|
|
15
|
+
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}keyframes(e){return this.compress?this.emit(`@${e.vendor||``}keyframes ${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.keyframes)+this.emit(`}`):this.emit(`@${e.vendor||``}keyframes ${e.name}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.keyframes,`
|
|
16
|
+
`)+this.emit(`${this.indent(-1)}}`)}keyframe(e){let t=e.declarations;return this.compress?this.emit(e.values.join(`,`),e.position)+this.emit(`{`)+this.mapVisit(t)+this.emit(`}`):this.emit(this.indent())+this.emit(e.values.join(`, `),e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(t,`
|
|
17
|
+
`)+this.emit(`${this.indent(-1)}\n${this.indent()}}\n`)}page(e){if(this.compress){let t=e.selectors.length?e.selectors.join(`, `):``;return this.emit(`@page ${t}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`)}let t=e.selectors.length?`${e.selectors.join(`, `)} `:``;return this.emit(`@page ${t}`,e.position)+this.emit(`{
|
|
18
|
+
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
19
|
+
`)+this.emit(this.indent(-1))+this.emit(`
|
|
20
|
+
}`)}pageMarginBox(e){return this.compress?this.emit(`@${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`${this.indent()}@${e.name} `,e.position)+this.emit(`{
|
|
21
|
+
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
22
|
+
`)+this.emit(this.indent(-1))+this.emit(`\n${this.indent()}}`)}fontFace(e){return this.compress?this.emit(`@font-face`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@font-face `,e.position)+this.emit(`{
|
|
23
|
+
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
24
|
+
`)+this.emit(this.indent(-1))+this.emit(`
|
|
25
|
+
}`)}host(e){return this.compress?this.emit(`@host`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`@host`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
26
|
+
|
|
27
|
+
`)+this.emit(`${this.indent(-1)}\n}`)}customMedia(e){return this.emit(`@custom-media ${e.name} ${e.media};`,e.position)}property(e){return this.compress?this.emit(`@property ${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@property ${e.name} `,e.position)+this.emit(`{
|
|
28
|
+
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
29
|
+
`)+this.emit(this.indent(-1))+this.emit(`
|
|
30
|
+
}`)}counterStyle(e){return this.compress?this.emit(`@counter-style ${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@counter-style ${e.name} `,e.position)+this.emit(`{
|
|
31
|
+
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
32
|
+
`)+this.emit(this.indent(-1))+this.emit(`
|
|
33
|
+
}`)}fontFeatureValues(e){return this.compress?this.emit(`@font-feature-values ${e.fontFamily}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@font-feature-values ${e.fontFamily}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
34
|
+
|
|
35
|
+
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}scope(e){let t=e.scope?` ${e.scope}`:``;return this.compress?this.emit(`@scope${t}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@scope${t}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
36
|
+
|
|
37
|
+
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}viewTransition(e){return this.compress?this.emit(`@view-transition`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@view-transition `,e.position)+this.emit(`{
|
|
38
|
+
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
39
|
+
`)+this.emit(this.indent(-1))+this.emit(`
|
|
40
|
+
}`)}positionTry(e){return this.compress?this.emit(`@position-try ${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@position-try ${e.name} `,e.position)+this.emit(`{
|
|
41
|
+
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
42
|
+
`)+this.emit(this.indent(-1))+this.emit(`
|
|
43
|
+
}`)}genericAtRule(e){let t=e.prelude?` ${e.prelude}`:``;if(this.compress)return this.emit(`@${e.name}${t}`,e.position)+(e.rules?this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):`;`);if(!e.rules)return this.emit(`${this.indent()}@${e.name}${t};`,e.position);let n=e.rules.some(e=>e.type!==N.declaration&&e.type!==N.comment),r=n?`
|
|
44
|
+
|
|
45
|
+
`:`
|
|
46
|
+
`;return this.emit(`${this.indent()}@${e.name}${t}`,e.position)+this.emit(n?` {\n${this.indent(1)}`:` {
|
|
47
|
+
`)+this.emit(n?``:this.indent(1))+this.mapVisit(e.rules,r)+this.emit(n?`\n${this.indent(-1)}${this.indent()}}`:`${this.indent(-1)}\n${this.indent()}}`)}rule(e){let t=e.declarations;if(!t.length)return``;if(this.compress)return this.emit(e.selectors.join(`,`),e.position)+this.emit(`{`)+this.mapVisit(t)+this.emit(`}`);let n=this.indent();return this.emit(e.selectors.map(e=>n+e).join(`,
|
|
48
|
+
`),e.position)+this.emit(` {
|
|
49
|
+
`)+this.emit(this.indent(1))+this.mapVisit(t,`
|
|
50
|
+
`)+this.emit(this.indent(-1))+this.emit(`\n${this.indent()}}`)}declaration(e){return this.compress?this.emit(`${e.property}:${e.value}`,e.position)+this.emit(`;`):e.property===`grid-template-areas`?this.emit(this.indent())+this.emit(e.property+`: `+e.value.split(`
|
|
51
|
+
`).join(`
|
|
52
|
+
`.padEnd(22)+this.indent()),e.position)+this.emit(`;`):this.emit(this.indent())+this.emit(`${e.property}: ${e.value}`,e.position)+this.emit(`;`)}},lt=(e,t)=>{t||={};let n=1,r=1;function i(){let e={line:n,column:r};return i=>(i.position=new it(e,{line:n,column:r},t?.source||``),u(),i)}let a=[];function o(i){let o=new rt(t?.source||``,i,n,r,e);if(!t?.silent)throw o;a.push(o)}function s(){let t=/^{\s*/.exec(e);return!!t&&(l(t),!0)}function c(){let t=/^}/.exec(e);return!!t&&(l(t),!0)}function l(t){let i=t[0];return function(e){let t=e.match(/\n/g);t&&(n+=t.length);let i=e.lastIndexOf(`
|
|
53
|
+
`);r=~i?e.length-i:r+e.length}(i),e=e.slice(i.length),t}function u(){let t=/^\s*/.exec(e);t&&l(t)}function d(e){e||=[];let t=f();for(;t;)e.push(t),t=f();return e}function f(){let t=i();if(e.charAt(0)!==`/`||e.charAt(1)!==`*`)return;let n=/^\/\*[^]*?\*\//.exec(e);return n?(l(n),t({type:N.comment,comment:n[0].slice(2,-2)})):o(`End of comment missing`)}function p(){let t=P(e,[`{`]);if(t===-1||t===0)return;let n=e.substring(0,t);return l([n]),((e,t)=>{let n=[],r=0;for(;r<e.length;){let i=P(e,t,r);if(i===-1)return n.push(e.substring(r)),n;n.push(e.substring(r,i)),r=i+1}return n})(F(n).replace(ot,``),[`,`]).map(e=>F(e))}function m(){let t=i(),n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/.exec(e);if(!n)return;l(n);let r=F(n[0]),a=/^:\s*/.exec(e);if(!a)return o(`property missing ':'`);l(a);let s=``,c=P(e,[`;`,`}`]);c!==-1&&(s=e.substring(0,c),l([s]),s=F(s).replace(ot,``));let u=t({type:N.declaration,property:r.replace(ot,``),value:s}),d=/^[;\s]*/.exec(e);return d&&l(d),u}function h(){let n=[];if(!s())return o(`missing '{'`);d(n);let r=m();for(;r;)n.push(r),d(n),r=m();for(;t?.silent&&e.length&&e.charAt(0)!==`}`;){let t=e.indexOf(`;`),i=e.indexOf(`}`);if(t===-1||!(i===-1||t<i))break;for(l([e.substring(0,t+1)]),u(),d(n),r=m();r;)n.push(r),d(n),r=m()}return c()?n:o(`missing '}'`)}function g(){let t=P(e,[`{`]);if(t===-1)return!1;let n=P(e,[`;`]),r=P(e,[`}`]);return!(n!==-1&&n<t)&&!(r!==-1&&r<t)}function _(){let n=[];if(!s())return o(`missing '{'`);for(d(n);e.length&&e.charAt(0)!==`}`;){if(e.charAt(0)===`@`){let e=S();if(e){n.push(e),d(n);continue}}if(g()){let e=C();if(e){n.push(e),d(n);continue}}let r=m();if(!r){if(t?.silent){let t=e.indexOf(`;`),r=e.indexOf(`}`);if(t!==-1&&(r===-1||t<r)){l([e.substring(0,t+1)]),u(),d(n);continue}}break}n.push(r),d(n)}return c()?n:o(`missing '}'`)}function v(){let n=[];for(u(),d(n);e.length&&e.charAt(0)!==`}`;){if(e.charAt(0)===`@`){let e=S();if(e){n.push(e),d(n);continue}}if(g()){let e=C();if(e){n.push(e),d(n);continue}}let r=m();if(!r){if(t?.silent){let t=e.indexOf(`;`),r=e.indexOf(`}`);if(t!==-1&&(r===-1||t<r)){l([e.substring(0,t+1)]),u(),d(n);continue}}break}n.push(r),d(n)}return n}function ee(){let t=[],n=i(),r=/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/.exec(e);for(;r;){let n=l(r);t.push(n[1]);let i=/^,\s*/.exec(e);i&&l(i),r=/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/.exec(e)}if(t.length)return n({type:N.keyframe,values:t,declarations:h()||[]})}let te=RegExp(`^@(top-left-corner|top-left|top-center|top-right|top-right-corner|bottom-left-corner|bottom-left|bottom-center|bottom-right|bottom-right-corner|left-top|left-middle|left-bottom|right-top|right-middle|right-bottom)(?![\\w-])\\s*`),ne=x(`import`),y=x(`charset`),b=x(`namespace`);function x(t){let n=RegExp(`^@`+t+`\\s*((?::?[^;'"]|"(?:\\\\"|[^"])*?"|'(?:\\\\'|[^'])*?')+)(?:;|$)`);return()=>{let r=i(),a=n.exec(e);if(!a)return;let o=l(a),s={type:t};return s[t]=o[1].trim(),r(s)}}function S(){if(e[0]===`@`)return function(){let t=i(),n=/^@([-\w]+)?keyframes\s*/.exec(e);if(!n)return;let r=l(n)[1],a=/^([-\w]+)\s*/.exec(e);if(!a)return o(`@keyframes missing name`);let u=l(a)[1];if(!s())return o(`@keyframes missing '{'`);let f=d(),p=ee();for(;p;)f.push(p),f=f.concat(d()),p=ee();return c()?t({type:N.keyframes,name:u,vendor:r,keyframes:f}):o(`@keyframes missing '}'`)}()||function(){let t=i(),n=/^@media *([^{]+)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s())return o(`@media missing '{'`);let a=v();return c()?t({type:N.media,media:r,rules:a}):o(`@media missing '}'`)}()||function(){let t=i(),n=/^@custom-media\s+(--\S+)\s+([^{;\s][^{;]*);/.exec(e);if(!n)return;let r=l(n);return t({type:N.customMedia,name:F(r[1]),media:F(r[2])})}()||function(){let t=i(),n=/^@supports *([^{]+)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s())return o(`@supports missing '{'`);let a=v();return c()?t({type:N.supports,supports:r,rules:a}):o(`@supports missing '}'`)}()||ne()||y()||b()||function(){let t=i(),n=/^@([-\w]+)?document *([^{]+)/.exec(e);if(!n)return;let r=l(n),a=F(r[1]),u=F(r[2]);if(!s())return o(`@document missing '{'`);let d=v();return c()?t({type:N.document,document:u,vendor:a,rules:d}):o(`@document missing '}'`)}()||function(){let t=i(),n=/^@page */.exec(e);if(!n)return;l(n);let r=p()||[];if(!s())return o(`@page missing '{'`);let a=[];for(d(a);e.length&&e.charAt(0)!==`}`;){if(e.charAt(0)===`@`){let e=S();if(e){a.push(e),d(a);continue}}let t=m();if(!t)break;a.push(t),d(a)}return c()?t({type:N.page,selectors:r,declarations:a}):o(`@page missing '}'`)}()||function(){let t=i(),n=/^@host\s*/.exec(e);if(!n)return;if(l(n),!s())return o(`@host missing '{'`);let r=v();return c()?t({type:N.host,rules:r}):o(`@host missing '}'`)}()||function(){let t=i(),n=/^@font-face\s*/.exec(e);if(!n)return;if(l(n),!s())return o(`@font-face missing '{'`);let r=d(),a=m();for(;a;)r.push(a),r=r.concat(d()),a=m();return c()?t({type:N.fontFace,declarations:r}):o(`@font-face missing '}'`)}()||function(){let t=i(),n=/^@font-feature-values\s+([^{]+)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s())return o(`@font-feature-values missing '{'`);let a=v();return c()?t({type:N.fontFeatureValues,fontFamily:r,rules:a}):o(`@font-feature-values missing '}'`)}()||function(){let t=i(),n=/^@container *([^{]+)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s())return o(`@container missing '{'`);let a=v();return c()?t({type:N.container,container:r,rules:a}):o(`@container missing '}'`)}()||function(){let t=i(),n=/^@starting-style\s*/.exec(e);if(!n)return;if(l(n),!s())return o(`@starting-style missing '{'`);let r=v();return c()?t({type:N.startingStyle,rules:r}):o(`@starting-style missing '}'`)}()||function(){let t=i(),n=/^@layer *([^{;@]+)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s()){let n=/^[;\s]*/.exec(e);return n&&l(n),t({type:N.layer,layer:r})}let a=v();return c()?t({type:N.layer,layer:r,rules:a}):o(`@layer missing '}'`)}()||function(){let t=i(),n=/^@property\s+(--[-\w]+)\s*/.exec(e);if(!n)return;let r=l(n)[1];if(!s())return o(`@property missing '{'`);let a=d(),u=m();for(;u;)a.push(u),a=a.concat(d()),u=m();return c()?t({type:N.property,name:r,declarations:a}):o(`@property missing '}'`)}()||function(){let t=i(),n=/^@counter-style\s+([-\w]+)\s*/.exec(e);if(!n)return;let r=l(n)[1];if(!s())return o(`@counter-style missing '{'`);let a=d(),u=m();for(;u;)a.push(u),a=a.concat(d()),u=m();return c()?t({type:N.counterStyle,name:r,declarations:a}):o(`@counter-style missing '}'`)}()||function(){let t=i(),n=/^@scope\s*([^{]*)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s())return o(`@scope missing '{'`);let a=v();return c()?t({type:N.scope,scope:r,rules:a}):o(`@scope missing '}'`)}()||function(){let t=i(),n=/^@view-transition\s*/.exec(e);if(!n)return;if(l(n),!s())return o(`@view-transition missing '{'`);let r=d(),a=m();for(;a;)r.push(a),r=r.concat(d()),a=m();return c()?t({type:N.viewTransition,declarations:r}):o(`@view-transition missing '}'`)}()||function(){let t=i(),n=/^@position-try\s+(--[-\w]+)\s*/.exec(e);if(!n)return;let r=l(n)[1];if(!s())return o(`@position-try missing '{'`);let a=d(),u=m();for(;u;)a.push(u),a=a.concat(d()),u=m();return c()?t({type:N.positionTry,name:r,declarations:a}):o(`@position-try missing '}'`)}()||function(){let t=i(),n=te.exec(e);if(!n)return;let r=l(n)[1];if(!s())return o(`@${r} missing '{'`);let a=d(),u=m();for(;u;)a.push(u),a=a.concat(d()),u=m();return c()?t({type:N.pageMarginBox,name:r,declarations:a}):o(`@${r} missing '}'`)}()||function(){let t=i(),n=/^@([-\w]+)\s*/.exec(e);if(!n)return;let r=l(n)[1],a=``,u=P(e,[`{`,`;`]);if(u!==-1&&u>0&&(a=F(e.substring(0,u)),l([e.substring(0,u)])),s()){let e=v();return c()?t({type:N.atRule,name:r,prelude:a,rules:e}):o(`@${r} missing '}'`)}let d=/^[;\s]*/.exec(e);return d&&l(d),t({type:N.atRule,name:r,prelude:a})}()}function C(){let e=i(),t=p();return t?(d(),e({type:N.rule,selectors:t,declarations:_()||[]})):o(`selector missing`)}return st(function(){let n=function(){let n,r=[];for(u(),d(r);e.length;){if(e.charAt(0)===`}`){if(t?.silent){o(`extra '}'`),l([`}`]),u(),d(r);continue}break}if(n=S()||C(),!n){if(t?.silent){l([e.charAt(0)]),u(),d(r);continue}break}r.push(n),d(r)}return r}();return{type:N.stylesheet,stylesheet:{source:t?.source,rules:n,parsingErrors:a}}}())},ut=(e,t)=>new ct(t||{}).compile(e),dt=Object.defineProperty,ft=(e,t)=>{let n={};for(var r in e)dt(n,r,{get:e[r],enumerable:!0});return t||dt(n,Symbol.toStringTag,{value:`Module`}),n},pt=`LocatorError`,mt=`LocatorUnsupportedError`,ht=`LocatorDeniedError`,gt=`LocatorInvalidError`,_t=e=>typeof e==`object`&&e?e.name:void 0,I=e=>Object.assign(Error(e),{name:pt}),L=(e,t=``,n)=>Object.assign(Error(e),{name:mt,operation:t,backend:n}),vt=(e,t)=>L(`Locator operation not supported${t?` on the ${t} backend`:``}: ${e}`,e,t),R=(e,t)=>Object.assign(Error(e),{name:ht,operation:t}),yt=(e,t)=>Object.assign(Error(e),{name:gt,operation:t}),z=class extends Error{name=`TimeoutError`;constructor(e,t){super(e,t?.cause===void 0?void 0:{cause:t.cause})}},bt=e=>_t(e)===mt,xt=e=>_t(e)===ht,St=e=>_t(e)===gt,Ct=e=>xt(e)||bt(e)||St(e),B=e=>{let t=(e.ownerDocument??e).defaultView;if(!t)throw I(`the resolved element belongs to a document with no window`);return t},wt=(e,t)=>{let n=e?.[t];return typeof n==`function`?n:null},Tt=(e,t)=>{if(typeof e!=`object`||!e)return null;let n=(()=>{try{return wt(B(e),t)}catch{return null}})();if(n&&e instanceof n)return n;let r=wt(globalThis,t);return r&&e instanceof r?r:null},V=(e,t)=>Tt(e,t)!==null,H=e=>{if(e.length===0)throw I(`No elements found`);if(e.length>1)throw I(`Strict mode violation: locator resolved to ${e.length} elements`);return e[0]},Et=(e,t)=>{if(!V(e,t))throw I(`Strict mode violation: expected ${t}, got <${e.tagName.toLowerCase()}>`);return e},Dt=e=>e.tagName.toLowerCase(),Ot=new Set,kt=e=>{Ot.add(e)},At=/(?:^|[^\w-])(?:url|image|image-set|cross-fade|paint|element|expression)\s*\(/i,jt=e=>e.replace(/\\([0-9a-fA-F]{1,6})\s?/g,(e,t)=>String.fromCodePoint(Number.parseInt(t,16))).replace(/\\(.)/g,`$1`),Mt=e=>!At.test(jt(e.value)),Nt=new Set([N.import,N.fontFace,N.namespace,N.charset,N.document,N.comment]),Pt=e=>{if(Nt.has(e.type))return null;if(e.type===N.declaration)return Mt(e)?e:null;let t=e,n={...t};for(let e of[`declarations`,`rules`,`keyframes`]){let r=t[e];Array.isArray(r)&&(n[e]=Ft(r))}return n},Ft=e=>e.map(e=>Pt(e)).filter(e=>e!==null),It=e=>{let t;try{t=lt(e,{silent:!0})}catch{return``}return t.stylesheet.rules=Ft(t.stylesheet.rules),ut(t)},Lt=(e,t)=>{let n=()=>{t.parentNode||(e.head??e.documentElement).appendChild(t)};if(n(),e.readyState===`complete`)return;let r=new MutationObserver(e=>{for(let r of e)for(let e of r.removedNodes)if(e===t||e.contains?.(t)){n();return}});r.observe(e.documentElement,{childList:!0,subtree:!0});let i=()=>r.disconnect(),a=e.defaultView;a?a.addEventListener(`load`,i,{once:!0}):setTimeout(i,3e4)},Rt={resolve:(e,t)=>{let n=e.document.createElement(`style`);n.textContent=t.noSanitize?t.content:It(t.content);try{Lt(e.document,n)}catch(e){console.error(e)}kt(n)}},zt=e=>{let t=[];return e.forEach((e,n)=>{t.push([n,e])}),t},U={kind:`frame`,ensureArgs:e=>[void 0,e],resolve:async(e,t,n={})=>{if(typeof t!=`string`)throw yt(`fetch: url must be a string`,`fetch`);let r=B(e.document),i;try{i=new r.URL(t,e.document.baseURI).href}catch{throw yt(`fetch: not a valid url: ${t}`,`fetch`)}let a=await r.fetch(i,{method:n.method??`GET`,headers:n.headers,body:n.body??null,redirect:n.redirect??`follow`,credentials:n.credentials??`include`});return{status:a.status,statusText:a.statusText,ok:a.ok,url:a.url,redirected:a.redirected,type:a.type,headers:zt(a.headers),body:await a.arrayBuffer()}}},W=ft({click:()=>Vt,count:()=>Yt,exists:()=>Xt,fill:()=>Gt,getAttribute:()=>qt,hover:()=>Ht,isVisible:()=>Jt,textContent:()=>Kt}),Bt=(e,t)=>{let n=e.getBoundingClientRect();return{clientX:n.left+n.width*(t?.x??.5),clientY:n.top+n.height*(t?.y??.5)}},Vt={resolve:(e,t={})=>{let n=H(e.elements),r=B(n),i={bubbles:!0,cancelable:!0,composed:!0,...Bt(n,t.position),button:0},a={...i,pointerType:`mouse`,pointerId:1,isPrimary:!0};n.dispatchEvent(new r.PointerEvent(`pointerdown`,{...a,buttons:1})),n.dispatchEvent(new r.MouseEvent(`mousedown`,{...i,buttons:1})),n.dispatchEvent(new r.PointerEvent(`pointerup`,{...a,buttons:0})),n.dispatchEvent(new r.MouseEvent(`mouseup`,{...i,buttons:0})),n.dispatchEvent(new r.MouseEvent(`click`,{...i,buttons:0}))}},Ht={resolve:(e,t={})=>{let n=H(e.elements),r=B(n),i={bubbles:!0,cancelable:!0,composed:!0,...Bt(n,t.position)},a={...i,pointerType:`mouse`,pointerId:1,isPrimary:!0};n.dispatchEvent(new r.PointerEvent(`pointerover`,a)),n.dispatchEvent(new r.PointerEvent(`pointerenter`,{...a,bubbles:!1})),n.dispatchEvent(new r.MouseEvent(`mouseenter`,{...i,bubbles:!1})),n.dispatchEvent(new r.MouseEvent(`mouseover`,i)),n.dispatchEvent(new r.PointerEvent(`pointermove`,a)),n.dispatchEvent(new r.MouseEvent(`mousemove`,i))}},Ut=(e,t)=>{e._valueTracker?.setValue(``);let n=(Tt(e,`HTMLTextAreaElement`)??Tt(e,`HTMLInputElement`))?.prototype,r=n&&Object.getOwnPropertyDescriptor(n,`value`)?.set;r?r.call(e,t):e.value=t},Wt=(e,t)=>{if(e.type!==`range`)return null;let n=Number(e.min||0),r=Number(e.max||100);if(!Number.isFinite(n)||!Number.isFinite(r)||r<=n)return null;let i=Number(t);if(!Number.isFinite(i))return null;let a=Math.max(0,Math.min(1,(i-n)/(r-n))),o=e.getBoundingClientRect(),s={bubbles:!0,cancelable:!0,composed:!0,clientX:o.left+o.width*a,clientY:o.top+o.height/2,button:0},c={...s,pointerType:`mouse`,pointerId:1,isPrimary:!0};return{pointerDown:{...c,buttons:1},pointerUp:{...c,buttons:0},mouseDown:{...s,buttons:1},mouseUp:{...s,buttons:0}}},Gt={resolve:(e,t,n={})=>{let r=H(e.elements),i=B(r),a=V(r,`HTMLInputElement`);if(a||V(r,`HTMLTextAreaElement`)){let e=r,n=a?Wt(e,t):null;n&&(r.dispatchEvent(new i.PointerEvent(`pointerdown`,n.pointerDown)),r.dispatchEvent(new i.MouseEvent(`mousedown`,n.mouseDown))),Ut(e,t),r.dispatchEvent(new i.Event(`input`,{bubbles:!0})),n&&(r.dispatchEvent(new i.PointerEvent(`pointerup`,n.pointerUp)),r.dispatchEvent(new i.MouseEvent(`mouseup`,n.mouseUp))),r.dispatchEvent(new i.Event(`change`,{bubbles:!0}))}else if(V(r,`HTMLElement`)&&r.isContentEditable)r.textContent=t,r.dispatchEvent(new i.Event(`input`,{bubbles:!0}));else throw Error(`fill: element <${Dt(r)}> is not fillable`)}},Kt={resolve:(e,t={})=>H(e.elements).textContent},qt={resolve:(e,t,n={})=>H(e.elements).getAttribute(t)},Jt={resolve:(e,t={})=>{let n=H(e.elements);if(!V(n,`HTMLElement`))return!0;let r=B(n).getComputedStyle(n);if(r?.display===`none`||r?.visibility===`hidden`)return!1;let i=n.getBoundingClientRect();return i.width>0&&i.height>0}},Yt={resolve:(e,t={})=>e.elements.length},Xt={resolve:(e,t={})=>e.elements.length>0},G=(e,t)=>(e.topLevel?[e.document]:e.elements).flatMap(e=>[...e.querySelectorAll(t)]),Zt=e=>e.replaceAll(`"`,`\\"`),Qt={to:`element`,css:!0,resolve:(e,t)=>G(e,t),render:e=>({fragment:typeof e==`string`?e:`?`,separator:`descend`})},$t={to:`frame`,css:!0,barrier:`down`,resolve:(e,t)=>G(e,t),render:e=>({fragment:typeof e==`string`?e:`?`,separator:`down`})},en={element:{selectors:{locator:Qt,frameLocator:$t,getByRole:{to:`element`,resolve:(e,t)=>G(e,`[role="${CSS.escape(t)}"]`),render:e=>({fragment:typeof e==`string`?`[role="${Zt(e)}"]`:`[role]`})},getByText:{to:`element`,resolve:(e,t)=>e.elements.flatMap(e=>[e,...e.querySelectorAll(`*`)]).filter(e=>e.textContent?.includes(t)),render:e=>({fragment:typeof e==`string`?`:has-text("${Zt(e)}")`:`:has-text(...)`})},getByTestId:{to:`element`,resolve:(e,t)=>G(e,`[data-testid="${CSS.escape(t)}"]`),render:e=>({fragment:typeof e==`string`?`[data-testid="${Zt(e)}"]`:`[data-testid]`})},first:{to:`element`,resolve:e=>e.elements.slice(0,1),render:()=>({fragment:`:first`})},nth:{to:`element`,resolve:(e,t)=>{let n=e.elements.at(t);return n?[n]:[]},render:e=>({fragment:typeof e==`number`?`:nth(${e})`:`:nth(?)`})}},operations:{click:Vt,fill:Gt,hover:Ht,textContent:Kt,getAttribute:qt,isVisible:Jt,count:Yt,exists:Xt}},frame:{selectors:{locator:Qt,frameLocator:$t,owner:{to:`frame`,barrier:`up`,resolve:e=>{throw Error(`owner: must be processed by the executor as an upward pivot`)},render:()=>({fragment:``,separator:`up`})}},operations:{addStyleTag:Rt,fetch:U}}},tn=(e,t=en)=>({element:{selectors:{...t.element.selectors,...e.element?.selectors},operations:{...t.element.operations,...e.element?.operations}},frame:{selectors:{...t.frame.selectors,...e.frame?.selectors},operations:{...t.frame.operations,...e.frame?.operations}}}),nn=3e4,rn=50,K=e=>{let t=e[e.length-1];return typeof t==`object`&&t?t:void 0},an=e=>{let t=K(e)?.timeout;return typeof t==`number`?t:nn},on=({executor:e,parts:t})=>({highlight:n=>e.highlight(t,n).then(()=>{},()=>{})}),sn=async e=>{let t={parts:e.parts,operation:e.operation,args:e.args,phase:`ensure`};await e.gate?.(t,on(e))},cn=(e,t)=>{if(t!==void 0&&typeof t==`number`&&!(Number.isFinite(t)&&t>0))throw TypeError(`${e}: timeout must be a positive number of milliseconds, not ${t}; every call ends at its deadline, so 0 does not turn it off`)},ln=e=>typeof e==`object`&&e&&typeof e.message==`string`?e.message:String(e),un=async e=>{let{executor:t,gate:n,parts:r,operation:i,args:a}=e;cn(i,K(a)?.timeout),n&&await n({parts:r,operation:i,args:a,phase:`execute`},on(e));let o=an(a),s=Date.now()+o,c=Error(`Locator timeout (${o}ms): ${i}`),{promise:l,reject:u}=Promise.withResolvers();l.catch(()=>{});let d=setTimeout(()=>u(c),o),f=c;try{do try{return await Promise.race([t.execute(r,i,a),l])}catch(e){if(e===c)break;if(Ct(e))throw e;f=e;let t=s-Date.now();if(t<=0)break;await new Promise(e=>setTimeout(e,Math.min(rn,t)))}while(Date.now()<s)}finally{clearTimeout(d)}throw f===c?new z(c.message):new z(ln(f),{cause:f})},dn=(e,t,n,r,i)=>{let a={};for(let[o,s]of Object.entries(t[r].selectors))a[o]=(...a)=>dn(e,t,n,s.to,[...i,{kind:r,name:o,args:a}]);for(let[n,o]of Object.entries(t[r].operations))a[n]=async(...t)=>un({...e,parts:i,operation:n,args:o.send?o.send(...t):t});for(let[o,{to:s,rewrite:c}]of Object.entries(n[r]??{}))a[o]=(...r)=>dn(e,t,n,s,c(i,...r));return a.ensure=(n,a={})=>{let o=t[r].operations[n]?.ensureArgs;return sn({...e,parts:i,operation:n,args:o?.(a)??[a]})},a},fn=e=>dn(e,e.modules??en,e.rewrites??{},`frame`,[]),pn=()=>{let e=E();return e.status===`ok`&&e.abi>=2},mn=async()=>{await D();let e=E();if(e.status===`ok`&&e.abi<2)throw new w(e.abi,2)},hn=e=>`Read the text, links and details ${e} shows.`,gn=e=>`Inject unfiltered styles or code into ${e}. This can pass page details along to other sites.`,_n=[{id:`interaction`,heading:`Interaction`,summary:`Allow the app to interact with the website (clicks, type in text, etc.)`,title:e=>`Interact with ${e}`,description:(e,t)=>t?`Click, type and hover on ${e} for you. If you are signed in there, this happens as you.`:`Click, type and hover on ${e} for you, in a signed-out view.`,cloudTitle:e=>`Click and type on ${e}`,cloudDescription:e=>`Clicks, types and scrolls on ${e} for you.`},{id:`storage`,heading:`Site data`,summary:`Can read the website's data`,title:e=>`Read data from ${e}`,description:hn,cloudTitle:e=>`Read what's on ${e}`,cloudDescription:hn},{id:`network`,heading:`Network`,summary:`Make requests on behalf of the website (using your cookies, etc.)`,title:e=>`Make requests to ${e} as you`,description:e=>`Load pages and data from ${e} and send changes there with your signed-in session.`,cloudTitle:e=>`Load and send data on ${e}`,cloudDescription:e=>`Loads pages and data from ${e} and sends changes there.`},{id:`evaluation`,heading:`Evaluation`,summary:`Can execute arbitrary code on the website`,title:e=>`Run code on ${e}`,description:gn,cloudTitle:e=>`Run its own code on ${e}`,cloudDescription:gn}],vn=e=>t=>{if(typeof t!=`object`||!t)return t===void 0?[]:[t];if(t.position!==void 0)throw TypeError(`${e}: position is Playwright's offset in pixels, which no backend serves yet; pass relativePosition, a 0..1 fraction of the box`);let{relativePosition:n,...r}=t;return[n===void 0?r:{...r,position:n}]},yn=async(e,t,n)=>{try{return await U.resolve(e,t,n)}catch(e){throw Ct(e)?e:R(`frame.fetch: ${e instanceof Error?`${e.name}: ${e.message}`:String(e)}; not retried, since the request may already have been sent`,`fetch`)}},bn=tn({element:{operations:{click:{resolve:(e,t={})=>W.click.resolve(e,t),send:vn(`click`)},hover:{resolve:(e,t={})=>W.hover.resolve(e,t),send:vn(`hover`)},fill:{resolve:(e,t,n={})=>W.fill.resolve(e,t,n)},textContent:{resolve:(e,t={})=>W.textContent.resolve(e)},getAttribute:{resolve:(e,t,n={})=>W.getAttribute.resolve(e,t)},isVisible:{resolve:(e,t={})=>W.isVisible.resolve(e)},count:{resolve:(e,t={})=>W.count.resolve(e)},exists:{resolve:(e,t={})=>W.exists.resolve(e)},videoElement:{resolve:(e,t={})=>y(Et(H(e.elements),`HTMLVideoElement`))}}},frame:{operations:{addStyleTag:{resolve:(e,t)=>Rt.resolve(e,t)},fetch:{resolve:(e,t,n={})=>yn(e,t,n),kind:U.kind,ensureArgs:U.ensureArgs},evaluate:{kind:`frame`,typed:!1,resolve:(e,t,n)=>{throw vt(`evaluate`,`this realm`)}}}}}),xn=e=>e[e.length-1],Sn={element:{last:{to:`element`,rewrite:e=>[...e,{kind:`element`,name:`nth`,args:[-1]}]},contentFrame:{to:`frame`,rewrite:e=>{let t=xn(e);if(t?.name!==`locator`)throw TypeError(`locator.contentFrame: only a locator that ends in locator(selector) can enter its frame; use frameLocator(selector)`);return[...e.slice(0,-1),{...t,name:`frameLocator`}]}}},frame:{owner:{to:`element`,rewrite:e=>{let t=xn(e);if(t?.name!==`frameLocator`)throw TypeError(`frameLocator.owner: this frame was not entered through frameLocator(selector)`);return[...e.slice(0,-1),{...t,name:`locator`}]}},getByTestId:{to:`element`,rewrite:(e,t)=>[...e,{kind:`element`,name:`getByTestId`,args:[t]}]}}},Cn=e=>{if(!e||e===`about:blank`)return!1;let t;try{t=new URL(e,location.href)}catch{return!1}return t.protocol===`chrome-extension:`||t.protocol===`moz-extension:`||t.protocol!==`about:`&&A(t.hostname)},q=e=>{if(Cn(e))throw Error(`attachFrame: refusing to target the extension's own pages or an FKN platform origin`)},wn=({src:e,domains:t,lockdown:n})=>{if(n&&!t.length&&e&&e!==`about:blank`)throw Error(`attachFrame: lockdown needs domains when the frame already has a src; pass domains or load it via goto`)},Tn={scope:`embed.iframe`,category:`interaction`,severity:0,title:`Load another website inside this app`,description:`Lets the app embed external pages directly inside its own view.`},En={scope:`embed.open`,category:`interaction`,severity:0,title:`Open a website inside this app`,description:`Lets the app navigate to another site without leaving its window.`},Dn=[`load`,`commit`],On=e=>{if(`timeoutMs`in e)throw TypeError(`frame.goto: pass timeout, in milliseconds; timeoutMs is not an option`);let{waitUntil:t,timeout:n}=e;if(t!==void 0&&!Dn.includes(t))throw TypeError(`frame.goto: waitUntil must be 'load' or 'commit', not ${JSON.stringify(t)}`);if(n!==void 0&&typeof n!=`number`)throw TypeError(`frame.goto: timeout must be a number of milliseconds`);cn(`frame.goto`,n)},kn=class extends Error{name=`FrameWindowBlockedError`;constructor(){super(`attachFrame: the browser did not open the window. Call attachFrame directly in a click or key handler, and allow popups for this page`)}},An=new Set([`jar-unreachable`,`bad-url`,`opaque-opener`]),jn=class extends Error{name=`FrameWindowRefusedError`;reason;constructor(e){let t=An.has(e)?e:`unknown`;super(t===`opaque-opener`?`attachFrame: this page has an opaque origin, which a window can never answer, so no window was opened`:`attachFrame: the window refused to attach (${t}), and loaded nothing`),this.reason=t}},Mn=[`message`,`document`],Nn=e=>{if(e===`*`)return`*`;let t=()=>TypeError(`frame.postMessage: targetOrigin must be '*' or an origin, not ${JSON.stringify(e)}`);if(typeof e!=`string`)throw t();let n;try{n=new URL(e).origin}catch{throw t()}if(n===`null`)throw t();return n},Pn=(e,t)=>{let n=typeof e==`object`&&!!e;if(n&&t!==void 0)throw TypeError(`frame.postMessage: pass transfer inside the options object, not after it`);let r=n?e.targetOrigin??`*`:e??`*`,i=n?e.transfer:t;if(i!==void 0&&!Array.isArray(i))throw TypeError(`frame.postMessage: transfer must be an array`);return{targetOrigin:Nn(r),transfer:i===void 0?[]:[...i]}},Fn=[`url`,`path`,`type`],In=[`content`,`sourceUrl`],Ln=/[\n\r\u2028\u2029]/,Rn=e=>{if(typeof e!=`object`||!e||Array.isArray(e))throw TypeError(`frame.addScriptTag: options must be an object { content }`);let t=Object.keys(e),n=t.find(e=>Fn.includes(e));if(n!==void 0)throw TypeError(`frame.addScriptTag: "${n}" is not served; it runs content as a classic inline script`);let r=t.find(e=>!In.includes(e));if(r!==void 0)throw TypeError(`frame.addScriptTag: unknown option "${r}"`);let{content:i,sourceUrl:a}=e;if(typeof i!=`string`)throw TypeError(`frame.addScriptTag: content must be a string`);if(a!==void 0&&(typeof a!=`string`||a===``||Ln.test(a)))throw TypeError(`frame.addScriptTag: sourceUrl must be a non-empty string with no line break`);return a===void 0?{content:i}:{content:i,sourceUrl:a}},zn=[`name`,`domain`,`path`],Bn=e=>e instanceof RegExp||Object.prototype.toString.call(e)===`[object RegExp]`,Vn=e=>{if(e===void 0)return{};if(Object.prototype.toString.call(e)!==`[object Object]`)throw TypeError(`frame.clearCookies: options must be an object`);let t=e,n=Object.keys(t).find(e=>!zn.includes(e));if(n!==void 0)throw TypeError(`frame.clearCookies: unknown option "${n}"`);let r=zn.flatMap(e=>{let n=t[e];return n===void 0?[]:[{key:e,value:n}]}),i=r.find(({value:e})=>Bn(e));if(i!==void 0)throw TypeError(`frame.clearCookies: ${i.key} is a RegExp, and clearCookies takes strings for name, domain and path for now`);let a=r.find(({value:e})=>typeof e!=`string`);if(a!==void 0)throw TypeError(`frame.clearCookies: ${a.key} must be a string`);let o=r.find(({value:e})=>e===``);if(o!==void 0)throw TypeError(`frame.clearCookies: ${o.key} must not be empty; leave it out to match every ${o.key}`);let s={};for(let{key:e,value:t}of r)s[e]={equals:t};return s},Hn=e=>{typeof globalThis.reportError==`function`?globalThis.reportError(e):console.error(e)},Un=e=>{let{owner:t,...n}=fn({executor:e.executor,modules:bn,rewrites:Sn,gate:async(t,n)=>{j(t.operation,K(t.args)?.reason),await e.gate?.(t,n)}}),r=async(t,n={})=>(q(t),On(n),e.goto(t,n)),i=()=>e.url(),a=async t=>{for(let e of t)j(`frame.requestPermissions`,e?.reason);let n=e.requestPermissions;if(!n)throw Error(`frame.requestPermissions: this backend cannot ask for permission categories`);return n(t)},o=async(t,n)=>{let r=e.evaluate;if(!r)throw Error(`frame.evaluate: this backend cannot run code in the attached frame`);let i=typeof t==`function`?t.toString():t;if(typeof i!=`string`)throw TypeError(`frame.evaluate: pass a function or a source string`);return r(i,structuredClone(n))},s=async t=>{let{content:n,...r}=Rn(t),i=e.addScriptTag;if(!i)throw Error(`frame.addScriptTag: this backend cannot run scripts in the attached frame`);await i(n,r)},c=async t=>{let n=Vn(t),r=e.clearCookies;if(!r)throw Error(`frame.clearCookies: this backend cannot clear cookies`);await r(n)},l=((t,n,r)=>{try{let i=e.postMessage;if(!i)throw Error(`frame.postMessage: this backend cannot message the attached frame`);let a=Pn(n,r);return i(t,a.targetOrigin,a.transfer)}catch(e){return Promise.reject(e)}}),u={message:new Set,document:new Set},d=null,f=(e,t)=>{if(!Mn.includes(e))throw TypeError(`frame.${t}: the event type must be ${Mn.map(e=>`'${e}'`).join(` or `)}, not ${JSON.stringify(e)}`);return u[e]},p=e=>{let t=e.type===`message`?Object.freeze({type:`message`,data:e.data,origin:e.origin,ports:Object.freeze([...e.ports]),source:_}):Object.freeze({type:`document`,origin:e.origin});for(let n of[...u[e.type]])try{n(t)}catch(e){Hn(e)}},m=(e,t)=>{if(f(e,`off`).delete(t),d!==null&&!u.message.size&&!u.document.size){let e=d;d=null,e()}},h=(t,n,r={})=>{let i=f(t,`on`);if(typeof n!=`function`)throw TypeError(`frame.on: the listener must be a function`);let{signal:a}=r;if(!(a?.aborted||i.has(n))){if(d===null){let t=e.listen;if(!t)throw Error(`frame.on: this backend cannot relay the page's messages`);d=t(p)}i.add(n),a?.addEventListener(`abort`,()=>m(t,n),{once:!0})}},g=()=>e.backend,_={...n,goto:r,url:i,backend:g,requestPermissions:a,evaluate:o,addScriptTag:s,clearCookies:c,postMessage:l,on:h,off:m};return _},Wn=[t.v,t._,t.y,t.h,t.g,t.n,t.i,t.r,t.f,t.a,t.o,t.s,t.p,Tn,En,t.u,t.d,Le,Re,ze,Qe,et],Gn=_n.map(e=>e.id),Kn={interaction:`act.click`,storage:`read.text`,network:`network.fetchCredentialed`,evaluation:`media.appearU`},qn=e=>e===0?`auto`:e===4?`critical`:`bundled`,Jn=Wn,J=new Map,Yn={};(()=>{J=new Map(Jn.map(e=>[e.scope,e])),Yn=Object.fromEntries(J),Jn.filter(e=>e.severity===4).map(e=>e.scope);let e=e=>Jn.filter(t=>t.category===e&&qn(t.severity)===`bundled`);Object.fromEntries(Gn.map(t=>[t,Math.max(0,...e(t).map(e=>e.severity))])),Object.fromEntries(Gn.map(t=>[t,e(t).some(e=>e.unsafe===!0)]))})();var Xn=e=>J.get(e)?.category,Zn=e=>{let t=J.get(e);return t&&qn(t.severity)},Qn=e=>{let t=J.get(e);if(t)return qn(t.severity)===`critical`?t.scope:t.category},$n=e=>Kn[e],er=({category:e,key:t})=>{let n=t??(e&&$n(e));return n!==void 0&&Xn(n)!==void 0?n:void 0},tr=(e,t)=>{for(let{category:n,key:r}of t)if(er({category:n,key:r})===void 0)throw TypeError(r===void 0?n===void 0?`${e}: name a category or a permission key`:`${e}: unknown permission category "${n}"`:`${e}: unknown permission key "${r}"`)},nr=(e,t={})=>{let n=[],r=e.map(e=>{let r=er(e),i=[];if(r!==void 0)for(let a of e.hosts)i.push(n.length),n.push({...t,key:r,scope:``,site:a,hosts:e.hosts,reason:e.reason});return{key:r!==void 0&&Zn(r)===`critical`?r:void 0,category:r===void 0?e.category??`interaction`:Yn[r].category,hosts:e.hosts,indexes:i}});return{items:n,answer:e=>r.map(({key:t,category:n,hosts:r,indexes:i})=>({category:n,...t===void 0?{}:{key:t},hosts:r,allow:i.length>0&&i.every(t=>e[t]?.allow===!0)}))}},Y=e=>typeof e==`object`&&!!e,rr=typeof chrome<`u`&&!!chrome.runtime?.id,ir=e=>Y(e)&&e.FKN_WEB_EXTENSION_FRAME_ANNOUNCE_KEY===!0&&typeof e.frameId==`string`&&typeof e.document==`string`,ar=new WeakMap,or=new WeakMap,sr=new WeakMap,cr=new Set;typeof window<`u`&&rr&&window.addEventListener(`message`,e=>{if(!ir(e.data))return;e.stopImmediatePropagation();let t=e.source;if(!t||typeof t!=`object`)return;let n=t,r=ar.get(n),i=e.data.frameId,a=e.data.document;if(ar.set(n,i),or.set(n,a),r)for(let e of cr)e(r);let o=sr.get(n);if(o){for(let e of[...o])(e.notDocument===void 0||e.notDocument!==a)&&(o.delete(e),e.resolve(i));o.size||sr.delete(n)}},{capture:!0});var lr=3e4,ur=`frame.evaluate: the code did not settle within ${lr}ms`,dr=()=>new z(ur),fr=e=>St(e)&&e.message===ur?dr():e,pr=[/^frame load timed out after \d+ms for /,/^frame goto: documentstart timed out$/,/^navigation to .+ did not commit a document within \d+ms$/s],mr=e=>{if(e instanceof z)return e;let t=typeof e?.message==`string`?e.message:``;return pr.some(e=>e.test(t))?new z(t):e},hr=e=>{let t=e;if(t.window===void 0)return`iframe`;if(t.iframe!==void 0)throw TypeError(`attachFrame: pass either iframe or window, not both`);if(t.lockdown)throw TypeError(`attachFrame: lockdown applies to an iframe, never to a window`);if(t.blank!==void 0)throw TypeError(`attachFrame: blank does not apply to a window`);if(typeof t.window!=`object`||t.window===null)throw TypeError(`attachFrame: window must be an object`);return`window`},gr=(e,t,n)=>{if(e===void 0)return t;if(typeof e!=`number`||!Number.isFinite(e)||e<=0)throw TypeError(`attachFrame: window.${n} must be a positive number of CSS pixels`);return Math.round(e)},_r=({url:e,width:t,height:n})=>{let r=(()=>{if(e===void 0||e===``||e===`about:blank`)return``;if(typeof e!=`string`)throw TypeError(`attachFrame: window.url must be a string`);let t=(()=>{try{return new URL(e,location.href)}catch{throw TypeError(`attachFrame: window.url is not a valid URL: ${e}`)}})();if(t.protocol!==`http:`&&t.protocol!==`https:`)throw TypeError(`attachFrame: window.url must be an http or https address`);return t.href})();return r&&q(r),{url:r,width:gr(t,500,`width`),height:gr(n,700,`height`)}},vr=`attachFrame: storageState seeds a fresh jar, so it needs cookies: 'ephemeral'`,yr=1e11,br=[`name`,`value`,`domain`,`path`,`expires`,`httpOnly`,`secure`,`sameSite`],xr=[`Strict`,`Lax`,`None`],Sr=/[;\x00-\x1f\x7f]/,X=(e,t)=>TypeError(`attachFrame: storageState${e} ${t}`),Z=e=>Object.prototype.toString.call(e)===`[object Object]`,Cr=e=>{let t=e.startsWith(`.`)?e.slice(1):e;if(t===``)return null;try{return new URL(`http://${t}/`).hostname===t.toLowerCase()?t.toLowerCase():null}catch{return null}},wr=(e,t)=>{if(!Z(e))throw X(t,`must be an object`);let n=Object.keys(e).find(e=>!br.includes(e));if(n!==void 0)throw X(`${t}.${n}`,`is not a cookie field`);let{name:r,value:i,domain:a,path:o,expires:s,httpOnly:c,secure:l,sameSite:u}=e;if(typeof r!=`string`||r===``||r.includes(`=`)||Sr.test(r))throw X(`${t}.name`,`must be a non-empty string with no "=", ";" or control character`);if(typeof i!=`string`||Sr.test(i))throw X(`${t}.value`,`must be a string with no ";" or control character`);if(typeof a!=`string`||Cr(a)===null)throw X(`${t}.domain`,`must be a host: ".youtube.com" for a cookie its subdomains also receive, "www.youtube.com" for a host-only one`);if(o!==void 0&&(typeof o!=`string`||!o.startsWith(`/`)||Sr.test(o)))throw X(`${t}.path`,`must be a string starting with "/"`);if(s!==void 0&&(typeof s!=`number`||!Number.isFinite(s)||s<=0&&s!==-1))throw X(`${t}.expires`,`must be -1 for a session cookie, or milliseconds since the epoch`);if(c!==void 0&&typeof c!=`boolean`)throw X(`${t}.httpOnly`,`must be a boolean`);if(l!==void 0&&typeof l!=`boolean`)throw X(`${t}.secure`,`must be a boolean`);if(u!==void 0&&!xr.includes(u))throw X(`${t}.sameSite`,`must be 'Strict', 'Lax' or 'None', not ${JSON.stringify(u)}`);let d=r.toLowerCase();if(u===`None`&&l!==!0)throw X(t,`is SameSite=None, which needs secure: true`);if(d.startsWith(`__secure-`)&&l!==!0)throw X(t,`is a __Secure- cookie, which needs secure: true`);if(d.startsWith(`__host-`)&&(l!==!0||a.startsWith(`.`)||(o??`/`)!==`/`))throw X(t,`is a __Host- cookie, which needs secure: true, a host-only domain and path "/"`);let f={name:r,value:i,domain:a};return o!==void 0&&(f.path=o),s!==void 0&&(f.expires=s),c!==void 0&&(f.httpOnly=c),l!==void 0&&(f.secure=l),u!==void 0&&(f.sameSite=u),f},Tr=(e,t)=>{if(!Z(e))throw X(t,`must be an object { origin, localStorage }`);let n=Object.keys(e).find(e=>e!==`origin`&&e!==`localStorage`);if(n!==void 0)throw X(`${t}.${n}`,`is not an origin field`);let{origin:r,localStorage:i}=e,a=(()=>{try{return typeof r==`string`?new URL(r):null}catch{return null}})();if(a===null||a.protocol!==`http:`&&a.protocol!==`https:`||a.origin!==r)throw X(`${t}.origin`,`must be an absolute http or https origin, not ${JSON.stringify(r)}`);if(!Array.isArray(i))throw X(`${t}.localStorage`,`must be an array`);return{origin:r,localStorage:i.map((e,n)=>{let{name:r,value:i}=Z(e)&&Object.keys(e).every(e=>e===`name`||e===`value`)?e:{};if(typeof r!=`string`||typeof i!=`string`)throw X(`${t}.localStorage[${n}]`,`must be { name, value } strings`);return{name:r,value:i}})}},Er=e=>{if(!Z(e))throw X(``,`must be an object { cookies?, origins? }`);let t=Object.keys(e).find(e=>e!==`cookies`&&e!==`origins`);if(t!==void 0)throw X(`.${t}`,`is not a storageState key; it takes cookies and origins`);let{cookies:n=[],origins:r=[]}=e;if(!Array.isArray(n))throw X(`.cookies`,`must be an array`);if(!Array.isArray(r))throw X(`.origins`,`must be an array`);let i=n.map((e,t)=>wr(e,`.cookies[${t}]`)),a=r.map((e,t)=>Tr(e,`.origins[${t}]`));return i.forEach(({expires:e},t)=>{if(e!==void 0&&e>0&&e<yr)throw X(`.cookies[${t}].expires`,`is milliseconds since the epoch, and ${e} reads as a date before 1974; a Playwright storageState gives seconds, so multiply it by 1000`)}),{cookies:i,origins:a}},Dr=[`persistent`,`ephemeral`,`native`],Or=`attachFrame: syncCookies was replaced by cookies. true is cookies: 'persistent', or 'native' for the person's own browser cookies on the extension; false is cookies: 'ephemeral'`,kr=e=>{if(`syncCookies`in e)throw TypeError(Or);let{cookies:t=`persistent`}=e;if(!Dr.includes(t))throw TypeError(`attachFrame: cookies must be 'persistent', 'ephemeral' or 'native', not ${JSON.stringify(t)}`);if(e.storageState!==void 0&&t!==`ephemeral`)throw TypeError(vr);let n=e.storageState===void 0?void 0:Er(e.storageState),r=hr(e);if(r===`iframe`&&e.lockdown&&t!==`native`)throw TypeError(`attachFrame: lockdown runs on the extension, which serves only cookies: 'native'`);if(Array.isArray(e.permissions))for(let t of e.permissions)j(`attachFrame`,t?.reason);return n===void 0?{kind:r,cookies:t}:{kind:r,cookies:t,storageState:n}},Ar=`FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY`,jr=!1,Mr=()=>{jr||(jr=!0,console.warn(`[fkn-frame] the installed FKN WebExtension is too old to ask for permission categories upfront, so each capability will be asked for as it is first used. Updating the extension fixes this.`))},Nr=`frame: this frame no longer holds the document the app attached it to`,Pr=`frame.postMessage: '*' is not served on the extension yet, since this extension does not report the frame's origin; pass the page's origin as targetOrigin`,Fr=()=>{let e=E();if(e.status===`ok`&&e.abi>=1)return;let t=e.status===`absent`?0:e.abi;throw new T(`lockdown`,t,`attachFrame: the installed FKN WebExtension (ABI ${t}) may predate lockdown, and one that does attaches the frame with its CSP removed rather than locked down. Updating the extension fixes this.`)},Q=e=>{try{return new URL(e,location.href).hostname}catch{return``}},$=()=>{let e=E();return e.status===`absent`?0:e.abi},Ir=`attachFrame: a blank page is served by the cloud render proxy only; call cloud.attachFrame`,Lr=`frame.addScriptTag: an extension frame does not run scripts through mirage yet; attach with cloud.attachFrame`,Rr=`frame.clearCookies: an extension frame runs on the browser's own cookies (cookies: 'native'), which FKN does not clear; attach with cookies: 'persistent' to clear the app's jar`,zr=({executeLocator:e,highlightLocator:n,ensureLocatorPermission:r,requestCategories:i,evaluateFrame:a,goto:o},{hosts:s,url:c,page:l,unreachable:u,documents:d,navigated:f})=>{let p=new Set(t.t(s,{ipv6:!0})),m=e=>p.has(t.t([Ze(e)],{ipv6:!0})[0]??``);return Un({backend:`extension`,executor:{execute:e,highlight:n},gate:e=>r(e.parts,e.operation,e.args),requestPermissions:async e=>(tr(`frame.requestPermissions`,e),await mn(),i(e)),evaluate:async(e,t)=>{if(!ye(E(),`evaluate`)){let e=E();throw new T(`evaluate`,e.status===`ok`?e.abi:0)}return a({source:e,arg:t}).catch(e=>{throw fr(e)})},addScriptTag:async()=>{throw new T(`addScriptTag`,$(),Lr)},clearCookies:async()=>{throw new T(`clearCookies`,$(),Rr)},postMessage:(e,t,n)=>{if(t===`*`)throw L(Pr,`postMessage`,`extension`);if(!m(t))throw R(Nr,`postMessage`);let r=u();if(r)throw r;return l().postMessage(e,t,n),Promise.resolve()},listen:e=>{let t=t=>{t.source!==null&&t.source===l()&&!ir(t.data)&&m(t.origin)&&e({type:`message`,data:t.data,origin:t.origin,ports:t.ports})};window.addEventListener(`message`,t);let n=d(()=>e({type:`document`,origin:``}));return()=>{window.removeEventListener(`message`,t),n()}},goto:(e,{waitUntil:n,timeout:r,...i}={})=>{M(`frame.goto`,[Q(e),...i.domains??[]]);for(let n of t.t([Q(e)],{ipv6:!0}))p.add(n);return f?.(e),o({url:e,...i,...n===void 0?{}:{waitUntil:n===`commit`?`documentstart`:n},...r===void 0?{}:{timeoutMs:r}}).catch(e=>{throw mr(e)})},url:c})},Br=async({iframe:e,domains:t=[],lockdown:n=!1,permissions:r,blank:i})=>{if(i!==void 0)throw new T(`blank`,$(),Ir);let a=crypto.randomUUID();if(q(e.src),wn({src:e.src,domains:t,lockdown:n}),M(`attachFrame`,t),await D(),n&&Fr(),!e.isConnected)throw Error(`attachFrame: the iframe must be connected to the document before attaching`);e.dispatchEvent(new CustomEvent(Ar,{detail:a}));let o=zr(await O.attachFrame({marker:a,domains:t,syncCookies:!0,lockdown:n}),{hosts:[...t,Q(e.src)],url:()=>e.src,page:()=>e.contentWindow,unreachable:()=>e.contentWindow===null?R(`frame: navigate the frame before postMessage`,`postMessage`):void 0,documents:t=>(e.addEventListener(`load`,t),()=>e.removeEventListener(`load`,t))});return r?.length&&(pn()?await o.requestPermissions(r):Mr()),o},Vr=`attachFrame: a window on cookies: 'native' needs the FKN WebExtension, which is not on this page`,Hr=`frame.postMessage: this window's page no longer keeps a link to the app's page, so a message cannot reach it`,Ur=`extension.attachFrame: the attached window closed; attach a fresh window`,Wr=e=>`attachFrame: cookies: '${e}' runs on the cloud render proxy; call cloud.attachFrame or the top-level attachFrame`,Gr=async e=>{let{domains:t=[],permissions:n}=e,{url:r,width:i,height:a}=_r(e.window);M(`attachFrame`,t);let o=E();if(!ye(o,`attachWindow`))throw o.status===`absent`?new T(`attachWindow`,0,Vr):new T(`attachWindow`,o.abi);let s=window.open(r||`about:blank`,`_blank`,`popup,width=${i},height=${a}`);if(!s)throw new kn;let c;try{c=await O.attachWindow({url:r,domains:t})}catch(e){try{s.close()}catch{}throw e}let l=new Promise(e=>window.addEventListener(`pagehide`,()=>e(),{once:!0})),u=!1,d=Promise.race([c.closed,l]).then(()=>{u=!0},()=>{u=!0}),f=r,p=zr(c,{hosts:r?[...t,Q(r)]:t,url:()=>f,page:()=>s,unreachable:()=>u?L(Ur,`postMessage`,`extension`):s.closed?R(Hr,`postMessage`):void 0,documents:e=>{let t=!0;return(async()=>{let n=await c.documentsAfter(-1);for(;t;){let r=await c.documentsAfter(n);for(;t&&n<r;n++)e()}})().catch(()=>{}),()=>{t=!1}},navigated:e=>{try{f=new URL(e,location.href).href}catch{}}}),m,h=()=>m??=c.close().then(()=>d,()=>{}).then(()=>{u=!0;try{s.close()}catch{}}),g=Object.assign(p,{close:h,closed:d});try{n?.length&&await g.requestPermissions(n)}catch(e){throw await h(),e}return g},Kr=(async e=>{let{kind:t,cookies:n}=kr(e);if(n!==`native`)throw new T(`cookies`,$(),Wr(n));return t===`window`?Gr(e):Br(e)}),qr=`permissions.request: pass hosts, the sites the grant applies to`,Jr={request:async e=>{let n=e.map(e=>{let{category:n,key:r,scope:i,reason:a,hosts:o}=e;if(j(`permissions.request`,a),!(`hosts`in e)&&!(`category`in e))return{legacy:{key:r,scope:i??``,reason:a}};let s=t.t(o??[],{ipv6:!0});if(!s.length)throw TypeError(qr);return Xe(`permissions.request`,s),{ask:{category:n,key:r,reason:a,hosts:s}}}),r=n.flatMap(e=>`ask`in e?[e.ask]:[]);tr(`permissions.request`,r),r.length&&await mn();let{items:i,answer:a}=nr(r),o=n.flatMap(e=>`legacy`in e?[e.legacy]:[]),s=[...i,...o],c=s.length?await O.requestPermissions(s):[],l=a(c.slice(0,i.length)),u=c.slice(i.length),d=0,f=0;return n.map(e=>`ask`in e?l[d++]:u[f++])}},Yr=`PermissionDeniedError`,Xr=e=>e instanceof Error?e.name===Yr:Y(e)&&e.name===`PermissionDeniedError`;Object.defineProperty(exports,"$",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return ht}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return Cn}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return mt}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return pt}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return Qe}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return xt}}),Object.defineProperty(exports,"J",{enumerable:!0,get:function(){return He}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return gt}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return St}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return Ct}}),Object.defineProperty(exports,"Q",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return et}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return wn}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return Ue}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(exports,"X",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(exports,"Y",{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(exports,"Z",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return jn}}),Object.defineProperty(exports,"_t",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Kr}}),Object.defineProperty(exports,"at",{enumerable:!0,get:function(){return we}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return En}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return mr}}),Object.defineProperty(exports,"ct",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"dt",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(exports,"et",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return tr}}),Object.defineProperty(exports,"ft",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return kn}}),Object.defineProperty(exports,"gt",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return Zn}}),Object.defineProperty(exports,"ht",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return Ar}}),Object.defineProperty(exports,"it",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return vt}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return lr}}),Object.defineProperty(exports,"lt",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return Qn}}),Object.defineProperty(exports,"mt",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Xr}}),Object.defineProperty(exports,"nt",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return kr}}),Object.defineProperty(exports,"ot",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return Xn}}),Object.defineProperty(exports,"pt",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"q",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Jr}}),Object.defineProperty(exports,"rt",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return _r}}),Object.defineProperty(exports,"st",{enumerable:!0,get:function(){return le}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Yr}}),Object.defineProperty(exports,"tt",{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return dr}}),Object.defineProperty(exports,"ut",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return Tn}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return _n}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return Un}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return nt}});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as e } from "./rolldown-runtime-
|
|
2
|
-
import { _ as t, a as n, d as r, f as i, g as a, h as o, i as s, n as c, o as l, p as u, r as d, s as f, t as p, u as m, v as h, y as g } from "./hosts-
|
|
1
|
+
import { t as e } from "./rolldown-runtime-CGnMp29N.js";
|
|
2
|
+
import { _ as t, a as n, d as r, f as i, g as a, h as o, i as s, n as c, o as l, p as u, r as d, s as f, t as p, u as m, v as h, y as g } from "./hosts-HUfgMimI.js";
|
|
3
3
|
import { BoxBase as _, createTypedEventTarget as v, expose as ee, recursiveBox as te, recursiveRevive as ne } from "osra";
|
|
4
|
-
|
|
4
|
+
// ../web-extension/lib/lib/revivables/event-proxy.js
|
|
5
5
|
var re = (e, t) => {
|
|
6
6
|
let n = new EventTarget(), r = /* @__PURE__ */ new Map(), i = EventTarget.prototype.addEventListener.bind(n), a = EventTarget.prototype.removeEventListener.bind(n);
|
|
7
7
|
return Object.defineProperty(n, "addEventListener", {
|
|
@@ -938,24 +938,7 @@ var Dt = class {
|
|
|
938
938
|
declarations: h() || []
|
|
939
939
|
});
|
|
940
940
|
}
|
|
941
|
-
let te = RegExp(
|
|
942
|
-
"top-left-corner",
|
|
943
|
-
"top-left",
|
|
944
|
-
"top-center",
|
|
945
|
-
"top-right",
|
|
946
|
-
"top-right-corner",
|
|
947
|
-
"bottom-left-corner",
|
|
948
|
-
"bottom-left",
|
|
949
|
-
"bottom-center",
|
|
950
|
-
"bottom-right",
|
|
951
|
-
"bottom-right-corner",
|
|
952
|
-
"left-top",
|
|
953
|
-
"left-middle",
|
|
954
|
-
"left-bottom",
|
|
955
|
-
"right-top",
|
|
956
|
-
"right-middle",
|
|
957
|
-
"right-bottom"
|
|
958
|
-
].join("|")})(?![\\w-])\\s*`), ne = y("import"), re = y("charset"), ie = y("namespace");
|
|
941
|
+
let te = /* @__PURE__ */ RegExp("^@(top-left-corner|top-left|top-center|top-right|top-right-corner|bottom-left-corner|bottom-left|bottom-center|bottom-right|bottom-right-corner|left-top|left-middle|left-bottom|right-top|right-middle|right-bottom)(?![\\w-])\\s*"), ne = y("import"), re = y("charset"), ie = y("namespace");
|
|
959
942
|
function y(t) {
|
|
960
943
|
let n = RegExp("^@" + t + "\\s*((?::?[^;'\"]|\"(?:\\\\\"|[^\"])*?\"|'(?:\\\\'|[^'])*?')+)(?:;|$)");
|
|
961
944
|
return () => {
|
|
@@ -1491,13 +1474,8 @@ var Dt = class {
|
|
|
1491
1474
|
if (a || H(r, "HTMLTextAreaElement")) {
|
|
1492
1475
|
let e = r, n = a ? ln(e, t) : null;
|
|
1493
1476
|
n && (r.dispatchEvent(new i.PointerEvent("pointerdown", n.pointerDown)), r.dispatchEvent(new i.MouseEvent("mousedown", n.mouseDown))), cn(e, t), r.dispatchEvent(new i.Event("input", { bubbles: !0 })), n && (r.dispatchEvent(new i.PointerEvent("pointerup", n.pointerUp)), r.dispatchEvent(new i.MouseEvent("mouseup", n.mouseUp))), r.dispatchEvent(new i.Event("change", { bubbles: !0 }));
|
|
1494
|
-
|
|
1495
|
-
}
|
|
1496
|
-
if (H(r, "HTMLElement") && r.isContentEditable) {
|
|
1497
|
-
r.textContent = t, r.dispatchEvent(new i.Event("input", { bubbles: !0 }));
|
|
1498
|
-
return;
|
|
1499
|
-
}
|
|
1500
|
-
throw Error(`fill: element <${Gt(r)}> is not fillable`);
|
|
1477
|
+
} else if (H(r, "HTMLElement") && r.isContentEditable) r.textContent = t, r.dispatchEvent(new i.Event("input", { bubbles: !0 }));
|
|
1478
|
+
else throw Error(`fill: element <${Gt(r)}> is not fillable`);
|
|
1501
1479
|
} }, dn = { resolve: (e, t = {}) => U(e.elements).textContent }, fn = { resolve: (e, t, n = {}) => U(e.elements).getAttribute(t) }, pn = { resolve: (e, t = {}) => {
|
|
1502
1480
|
let n = U(e.elements);
|
|
1503
1481
|
if (!H(n, "HTMLElement")) return !0;
|
|
@@ -2099,8 +2077,7 @@ typeof window < "u" && Sr && window.addEventListener("message", (e) => {
|
|
|
2099
2077
|
o.size || Er.delete(n);
|
|
2100
2078
|
}
|
|
2101
2079
|
}, { capture: !0 });
|
|
2102
|
-
|
|
2103
|
-
//#region ../web-extension/lib/lib/evaluate-deadline.js
|
|
2080
|
+
// ../web-extension/lib/lib/evaluate-deadline.js
|
|
2104
2081
|
var Or = 3e4, kr = `frame.evaluate: the code did not settle within ${Or}ms`, Ar = () => new B(kr), jr = (e) => Bt(e) && e.message === kr ? Ar() : e, Mr = [
|
|
2105
2082
|
/^frame load timed out after \d+ms for /,
|
|
2106
2083
|
/^frame goto: documentstart timed out$/,
|
|
@@ -2432,5 +2409,4 @@ var Or = 3e4, kr = `frame.evaluate: the code did not settle within ${Or}ms`, Ar
|
|
|
2432
2409
|
let { items: r, answer: i } = br(n), a = t.flatMap((e) => "legacy" in e ? [e.legacy] : []), o = [...r, ...a], s = o.length ? await D.requestPermissions(o) : [], c = i(s.slice(0, r.length)), l = s.slice(r.length), u = 0, d = 0;
|
|
2433
2410
|
return t.map((e) => "ask" in e ? c[u++] : l[d++]);
|
|
2434
2411
|
} }, mi = "PermissionDeniedError", hi = (e) => e instanceof Error ? e.name === mi : xr(e) && e.name === "PermissionDeniedError";
|
|
2435
|
-
//#endregion
|
|
2436
2412
|
export { Xe as $, Nt as A, xt as B, Vn as C, I as D, B as E, Mt as F, it as G, vt as H, zt as I, ct as J, at as K, Pt as L, Bt as M, R as N, Rt as O, Vt as P, O as Q, bt as R, Hn as S, q as T, lt as U, yt as V, dt as W, tt as X, st as Y, A as Z, Yn as _, x as _t, di as a, We as at, Wn as b, Nr as c, w as ct, xr as d, Re as dt, Je as et, yr as f, Oe as ft, qn as g, xe as gt, hr as h, ye as ht, Yr as i, T as it, It as j, z as k, Or as l, C as lt, gr as m, S as mt, hi as n, Ve as nt, Jr as o, E as ot, mr as p, be as pt, rt as q, pi as r, He as rt, Ir as s, ke as st, mi as t, qe as tt, Ar as u, Ae as ut, Un as v, Fn as w, J as x, sr as y, St as z };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/messages.d.ts
|
|
2
1
|
declare const E2E_LOCKED_MESSAGE = "fkn:e2e-locked";
|
|
3
2
|
declare const E2E_STALE_EPOCH_MESSAGE = "fkn:e2e-stale-epoch: this file is encrypted under a previous key you reset";
|
|
4
3
|
declare const E2E_INTEGRITY_MESSAGE = "fkn:e2e-integrity: stored data failed its integrity check";
|
|
@@ -30,5 +29,4 @@ declare const ACCOUNT_PIN_UNSUPPORTED_MESSAGE = "fkn:account-pin-unsupported";
|
|
|
30
29
|
declare const STORAGE_ACCOUNT_CHANGED = "FKN_ACCOUNT_CHANGED";
|
|
31
30
|
/** The code of `StorageAccountPinUnsupportedError`: the broker cannot pin calls, so none was sent. */
|
|
32
31
|
declare const STORAGE_ACCOUNT_PIN_UNSUPPORTED = "FKN_ACCOUNT_PIN_UNSUPPORTED";
|
|
33
|
-
//#endregion
|
|
34
32
|
export { E2E_LOCKED_MESSAGE as a, STORAGE_ACCOUNT_CHANGED as c, STORAGE_UNREACHABLE as d, E2E_INTEGRITY_MESSAGE as i, STORAGE_ACCOUNT_PIN_UNSUPPORTED as l, ACCOUNT_PIN_INVALID_MESSAGE as n, E2E_RETIRED_FORMAT_MESSAGE as o, ACCOUNT_PIN_UNSUPPORTED_MESSAGE as r, E2E_STALE_EPOCH_MESSAGE as s, ACCOUNT_CHANGED_MESSAGE as t, STORAGE_NOT_FOUND as u };
|
package/messages.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as E2E_LOCKED_MESSAGE, c as STORAGE_ACCOUNT_CHANGED, d as STORAGE_UNREACHABLE, i as E2E_INTEGRITY_MESSAGE, l as STORAGE_ACCOUNT_PIN_UNSUPPORTED, n as ACCOUNT_PIN_INVALID_MESSAGE, o as E2E_RETIRED_FORMAT_MESSAGE, r as ACCOUNT_PIN_UNSUPPORTED_MESSAGE, s as E2E_STALE_EPOCH_MESSAGE, t as ACCOUNT_CHANGED_MESSAGE, u as STORAGE_NOT_FOUND } from "./messages-
|
|
1
|
+
import { a as E2E_LOCKED_MESSAGE, c as STORAGE_ACCOUNT_CHANGED, d as STORAGE_UNREACHABLE, i as E2E_INTEGRITY_MESSAGE, l as STORAGE_ACCOUNT_PIN_UNSUPPORTED, n as ACCOUNT_PIN_INVALID_MESSAGE, o as E2E_RETIRED_FORMAT_MESSAGE, r as ACCOUNT_PIN_UNSUPPORTED_MESSAGE, s as E2E_STALE_EPOCH_MESSAGE, t as ACCOUNT_CHANGED_MESSAGE, u as STORAGE_NOT_FOUND } from "./messages-B9dOXntM.js";
|
|
2
2
|
export { ACCOUNT_CHANGED_MESSAGE, ACCOUNT_PIN_INVALID_MESSAGE, ACCOUNT_PIN_UNSUPPORTED_MESSAGE, E2E_INTEGRITY_MESSAGE, E2E_LOCKED_MESSAGE, E2E_RETIRED_FORMAT_MESSAGE, E2E_STALE_EPOCH_MESSAGE, STORAGE_ACCOUNT_CHANGED, STORAGE_ACCOUNT_PIN_UNSUPPORTED, STORAGE_NOT_FOUND, STORAGE_UNREACHABLE };
|
package/messages.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
// src/messages.ts
|
|
2
2
|
var e = "fkn:e2e-locked", t = "fkn:e2e-stale-epoch: this file is encrypted under a previous key you reset", n = "fkn:e2e-integrity: stored data failed its integrity check", r = "fkn:e2e-retired-format: stored data is in a format this version no longer opens", i = "FKN_STORAGE_NOT_FOUND", a = "FKN_API_UNREACHABLE", o = "fkn:account-changed", s = "fkn:account-pin-invalid", c = "fkn:account-pin-unsupported", l = "FKN_ACCOUNT_CHANGED", u = "FKN_ACCOUNT_PIN_UNSUPPORTED";
|
|
3
|
-
//#endregion
|
|
4
3
|
export { o as ACCOUNT_CHANGED_MESSAGE, s as ACCOUNT_PIN_INVALID_MESSAGE, c as ACCOUNT_PIN_UNSUPPORTED_MESSAGE, n as E2E_INTEGRITY_MESSAGE, e as E2E_LOCKED_MESSAGE, r as E2E_RETIRED_FORMAT_MESSAGE, t as E2E_STALE_EPOCH_MESSAGE, l as STORAGE_ACCOUNT_CHANGED, u as STORAGE_ACCOUNT_PIN_UNSUPPORTED, i as STORAGE_NOT_FOUND, a as STORAGE_UNREACHABLE };
|
package/net-COkJw8lV.js
ADDED
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { t as e } from "./rolldown-runtime-CGnMp29N.js";
|
|
2
|
+
import { s as t } from "./api-DRglK7ft.js";
|
|
3
|
+
import { t as n } from "./busy-C1JPjoZ_.js";
|
|
4
|
+
import { t as r } from "./relay-choice-Bb3oP2gw.js";
|
|
5
|
+
import { n as i, o as a, r as o, t as s } from "./utils-DtWP-E9x.js";
|
|
6
|
+
import "./wire.js";
|
|
7
|
+
import { Stream as c } from "stream";
|
|
8
|
+
import { EventEmitter as l } from "events";
|
|
9
|
+
// src/webvpn/net.ts
|
|
10
|
+
var u = /* @__PURE__ */ e({
|
|
11
|
+
Server: () => f,
|
|
12
|
+
Socket: () => d,
|
|
13
|
+
_default: () => g,
|
|
14
|
+
connect: () => p,
|
|
15
|
+
createConnection: () => m,
|
|
16
|
+
createServer: () => h,
|
|
17
|
+
default: () => g,
|
|
18
|
+
isIP: () => s,
|
|
19
|
+
isIPv4: () => i,
|
|
20
|
+
isIPv6: () => o
|
|
21
|
+
}), d = class extends c.Duplex {
|
|
22
|
+
_localAddress;
|
|
23
|
+
_remoteAddress;
|
|
24
|
+
_webVPNTcpSocketPromise;
|
|
25
|
+
_relay;
|
|
26
|
+
constructor(e) {
|
|
27
|
+
if (e?.fd !== void 0) throw Error("FKN WebVPN does not support file descriptors");
|
|
28
|
+
super(e), e?.connection && this.__webvpn_tcp_socket_init__(e.connection);
|
|
29
|
+
}
|
|
30
|
+
_busyRelease;
|
|
31
|
+
__webvpn_tcp_socket_init__(e, t) {
|
|
32
|
+
return this._busyRelease ??= n("tcp socket"), t && (this._localAddress = {
|
|
33
|
+
address: t.localAddress,
|
|
34
|
+
family: t.localFamily,
|
|
35
|
+
port: t.localPort
|
|
36
|
+
}, this._remoteAddress = {
|
|
37
|
+
address: t.remoteAddress,
|
|
38
|
+
family: t.remoteFamily,
|
|
39
|
+
port: t.remotePort
|
|
40
|
+
}, this._relay = t.relay), this._webVPNTcpSocketPromise = e.then((e) => {
|
|
41
|
+
let t = e.dataReadableStream.getReader(), n = e.dataWritableStream.getWriter();
|
|
42
|
+
return this._localAddress = {
|
|
43
|
+
address: e.localAddress,
|
|
44
|
+
family: e.localFamily,
|
|
45
|
+
port: e.localPort
|
|
46
|
+
}, this._remoteAddress = {
|
|
47
|
+
address: e.remoteAddress,
|
|
48
|
+
family: e.remoteFamily,
|
|
49
|
+
port: e.remotePort
|
|
50
|
+
}, this._relay = e.relay, {
|
|
51
|
+
...e,
|
|
52
|
+
reader: t,
|
|
53
|
+
writer: n
|
|
54
|
+
};
|
|
55
|
+
}).catch((e) => {
|
|
56
|
+
this.emit("error", e);
|
|
57
|
+
}), this._webVPNTcpSocketPromise.then((e) => {
|
|
58
|
+
e ? this.emit("connect") : this._busyRelease?.();
|
|
59
|
+
}), this._webVPNTcpSocketPromise;
|
|
60
|
+
}
|
|
61
|
+
_read(e) {
|
|
62
|
+
if (!this._webVPNTcpSocketPromise) throw Error("Socket not connected");
|
|
63
|
+
this._webVPNTcpSocketPromise.then((e) => {
|
|
64
|
+
e ? e.reader.read().then(({ value: e, done: t }) => {
|
|
65
|
+
t ? this.push(null) : (this._restartTimeoutTimer(), this.push(e));
|
|
66
|
+
}).catch((e) => {
|
|
67
|
+
this.destroy(e);
|
|
68
|
+
}) : this.push(null);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
_write(e, t, n) {
|
|
72
|
+
this._webVPNTcpSocketPromise ? this._webVPNTcpSocketPromise.then(async (t) => {
|
|
73
|
+
if (!t) throw Error("Socket not connected");
|
|
74
|
+
await t.writer.ready, await t.writer.write(e), this._restartTimeoutTimer(), n();
|
|
75
|
+
}).catch(n) : n(/* @__PURE__ */ Error("Socket not connected"));
|
|
76
|
+
}
|
|
77
|
+
connect(...e) {
|
|
78
|
+
let n = a(...e), { relay: i } = n, o = this.__webvpn_tcp_socket_init__(t("an outbound tcp socket").then((e) => (i !== void 0 && r(e, "net.connect"), e.cloud.webvpn.tcpSocket({
|
|
79
|
+
remoteAddress: n.host ?? "localhost",
|
|
80
|
+
remotePort: n.port,
|
|
81
|
+
relay: i
|
|
82
|
+
}))));
|
|
83
|
+
return n.callback && o.then((e) => {
|
|
84
|
+
e && n.callback.call(this);
|
|
85
|
+
}), this;
|
|
86
|
+
}
|
|
87
|
+
_final(e) {
|
|
88
|
+
this._webVPNTcpSocketPromise ? this._webVPNTcpSocketPromise.then(async (e) => {
|
|
89
|
+
e && await e.writer.close();
|
|
90
|
+
}).then(() => e(), (t) => e(t)) : e();
|
|
91
|
+
}
|
|
92
|
+
_destroy(e, t) {
|
|
93
|
+
this._timeoutTimer && clearTimeout(this._timeoutTimer), this._busyRelease?.(), this._webVPNTcpSocketPromise ? this._webVPNTcpSocketPromise.then(async (e) => {
|
|
94
|
+
e && await (this._resetRequested ? e.resetAndDestroy() : e.destroy());
|
|
95
|
+
}).then(() => t(e), () => t(e)) : t(e);
|
|
96
|
+
}
|
|
97
|
+
destroySoon() {
|
|
98
|
+
this.writableFinished ? this.destroy() : (this.once("finish", () => this.destroy()), this.end());
|
|
99
|
+
}
|
|
100
|
+
_resetRequested = !1;
|
|
101
|
+
resetAndDestroy() {
|
|
102
|
+
return this._resetRequested = !0, this.destroy(), this;
|
|
103
|
+
}
|
|
104
|
+
_timeoutMs;
|
|
105
|
+
_timeoutTimer;
|
|
106
|
+
_restartTimeoutTimer() {
|
|
107
|
+
this._timeoutTimer && clearTimeout(this._timeoutTimer), this._timeoutMs && (this._timeoutTimer = setTimeout(() => this.emit("timeout"), this._timeoutMs));
|
|
108
|
+
}
|
|
109
|
+
setTimeout(e, t) {
|
|
110
|
+
return t && this.on("timeout", t), this._timeoutMs = e, this._restartTimeoutTimer(), this;
|
|
111
|
+
}
|
|
112
|
+
setNoDelay(e) {
|
|
113
|
+
let t = e ?? !0;
|
|
114
|
+
return this._setTcpOption({
|
|
115
|
+
type: 0,
|
|
116
|
+
value: t
|
|
117
|
+
}), this;
|
|
118
|
+
}
|
|
119
|
+
setKeepAlive(e, t) {
|
|
120
|
+
let n = e ?? !1, r = t !== void 0 && t > 0 ? Math.max(1, Math.round(t / 1e3)) : 0;
|
|
121
|
+
return this._setTcpOption({
|
|
122
|
+
type: 2,
|
|
123
|
+
enabled: n,
|
|
124
|
+
initialDelaySeconds: r
|
|
125
|
+
}), this;
|
|
126
|
+
}
|
|
127
|
+
setSendBufferSize(e) {
|
|
128
|
+
return this._setTcpOption({
|
|
129
|
+
type: 3,
|
|
130
|
+
value: e
|
|
131
|
+
}), this;
|
|
132
|
+
}
|
|
133
|
+
setRecvBufferSize(e) {
|
|
134
|
+
return this._setTcpOption({
|
|
135
|
+
type: 4,
|
|
136
|
+
value: e
|
|
137
|
+
}), this;
|
|
138
|
+
}
|
|
139
|
+
_typeOfService;
|
|
140
|
+
getTypeOfService() {
|
|
141
|
+
return this._typeOfService ?? 0;
|
|
142
|
+
}
|
|
143
|
+
setTypeOfService(e) {
|
|
144
|
+
return this._typeOfService = e, this;
|
|
145
|
+
}
|
|
146
|
+
_setTcpOption(e) {
|
|
147
|
+
this._webVPNTcpSocketPromise ? this._webVPNTcpSocketPromise.then(async (t) => {
|
|
148
|
+
if (t) try {
|
|
149
|
+
await t.setOption(e);
|
|
150
|
+
} catch (e) {
|
|
151
|
+
this.emit("error", e);
|
|
152
|
+
}
|
|
153
|
+
}) : this.emit("error", /* @__PURE__ */ Error("Cannot set socket option before connect"));
|
|
154
|
+
}
|
|
155
|
+
write(e, t, ...n) {
|
|
156
|
+
return super.write(e, t, ...n);
|
|
157
|
+
}
|
|
158
|
+
address() {
|
|
159
|
+
return this._localAddress ?? {};
|
|
160
|
+
}
|
|
161
|
+
unref() {
|
|
162
|
+
return this;
|
|
163
|
+
}
|
|
164
|
+
ref() {
|
|
165
|
+
return this;
|
|
166
|
+
}
|
|
167
|
+
autoSelectFamilyAttemptedAddresses;
|
|
168
|
+
bufferSize;
|
|
169
|
+
bytesRead;
|
|
170
|
+
bytesWritten;
|
|
171
|
+
connecting;
|
|
172
|
+
pending;
|
|
173
|
+
get localAddress() {
|
|
174
|
+
if (!this._localAddress) throw Error("Socket is not connected");
|
|
175
|
+
return this._localAddress.address;
|
|
176
|
+
}
|
|
177
|
+
get localPort() {
|
|
178
|
+
if (!this._localAddress) throw Error("Socket is not connected");
|
|
179
|
+
return this._localAddress.port;
|
|
180
|
+
}
|
|
181
|
+
get localFamily() {
|
|
182
|
+
if (!this._localAddress) throw Error("Socket is not connected");
|
|
183
|
+
return this._localAddress.family;
|
|
184
|
+
}
|
|
185
|
+
readyState;
|
|
186
|
+
get remoteAddress() {
|
|
187
|
+
if (!this._remoteAddress) throw Error("Socket is not connected");
|
|
188
|
+
return this._remoteAddress.address;
|
|
189
|
+
}
|
|
190
|
+
get remotePort() {
|
|
191
|
+
if (!this._remoteAddress) throw Error("Socket is not connected");
|
|
192
|
+
return this._remoteAddress.port;
|
|
193
|
+
}
|
|
194
|
+
get remoteFamily() {
|
|
195
|
+
if (!this._remoteAddress) throw Error("Socket is not connected");
|
|
196
|
+
return this._remoteAddress.family;
|
|
197
|
+
}
|
|
198
|
+
timeout;
|
|
199
|
+
}, f = class extends l {
|
|
200
|
+
_localAddress;
|
|
201
|
+
_webVPNTcpSocketListenerPromise;
|
|
202
|
+
_relayChoice;
|
|
203
|
+
_relay;
|
|
204
|
+
constructor(e, t) {
|
|
205
|
+
super(e), this._relayChoice = e?.relay, t && this.on("connection", t), e?.connection && this.__webvpn_tcp_socket_listener_init__(e.connection);
|
|
206
|
+
}
|
|
207
|
+
_busyRelease;
|
|
208
|
+
__webvpn_tcp_socket_listener_init__(e) {
|
|
209
|
+
return this._busyRelease ??= n("tcp server"), this._webVPNTcpSocketListenerPromise = e.then((e) => (this._localAddress = {
|
|
210
|
+
address: e.localAddress,
|
|
211
|
+
family: e.localFamily,
|
|
212
|
+
port: e.localPort
|
|
213
|
+
}, this._relay = e.relay, e)).catch((e) => {
|
|
214
|
+
this.emit("error", e);
|
|
215
|
+
}), this._webVPNTcpSocketListenerPromise.then((e) => {
|
|
216
|
+
e ? this.emit("listening") : this._busyRelease?.();
|
|
217
|
+
}), this._webVPNTcpSocketListenerPromise;
|
|
218
|
+
}
|
|
219
|
+
listen(...e) {
|
|
220
|
+
let n = a(...e);
|
|
221
|
+
this._closeEmitted = !1;
|
|
222
|
+
let i = (e) => {
|
|
223
|
+
let t = new d();
|
|
224
|
+
t.__webvpn_tcp_socket_init__(Promise.resolve(e), e), this.emit("connection", t);
|
|
225
|
+
}, o = (e) => {
|
|
226
|
+
this._localAddress = void 0;
|
|
227
|
+
try {
|
|
228
|
+
e && this.listenerCount("error") > 0 && this.emit("error", e);
|
|
229
|
+
} finally {
|
|
230
|
+
this._emitClose();
|
|
231
|
+
}
|
|
232
|
+
}, s = this._relayChoice, c = (e) => t("a tcp listener").then((t) => (s !== void 0 && r(t, "net.createServer"), t.cloud.webvpn.tcpSocketListener({
|
|
233
|
+
localAddress: e,
|
|
234
|
+
localPort: n.port,
|
|
235
|
+
onConnection: i,
|
|
236
|
+
onClose: o,
|
|
237
|
+
relay: s
|
|
238
|
+
}))), l = n.host ? c(n.host) : c("::").catch(() => c("0.0.0.0")), u = this.__webvpn_tcp_socket_listener_init__(l);
|
|
239
|
+
return n.callback && u.then((e) => {
|
|
240
|
+
e && n.callback.call(this);
|
|
241
|
+
}), this;
|
|
242
|
+
}
|
|
243
|
+
_closeEmitted = !1;
|
|
244
|
+
_emitClose() {
|
|
245
|
+
this._closeEmitted || (this._closeEmitted = !0, this._busyRelease?.(), this.emit("close"));
|
|
246
|
+
}
|
|
247
|
+
close(e) {
|
|
248
|
+
return this._webVPNTcpSocketListenerPromise && this._webVPNTcpSocketListenerPromise.then(async (t) => {
|
|
249
|
+
if (t) try {
|
|
250
|
+
await t.close(), this._localAddress = void 0, this._emitClose(), e && e();
|
|
251
|
+
} catch (t) {
|
|
252
|
+
this._localAddress = void 0, this._emitClose(), e && e(t);
|
|
253
|
+
}
|
|
254
|
+
}), this;
|
|
255
|
+
}
|
|
256
|
+
address() {
|
|
257
|
+
return this._localAddress ?? null;
|
|
258
|
+
}
|
|
259
|
+
getConnections(e) {
|
|
260
|
+
throw Error("Method not implemented.");
|
|
261
|
+
}
|
|
262
|
+
ref() {
|
|
263
|
+
return this;
|
|
264
|
+
}
|
|
265
|
+
unref() {
|
|
266
|
+
return this;
|
|
267
|
+
}
|
|
268
|
+
maxConnections;
|
|
269
|
+
connections;
|
|
270
|
+
listening;
|
|
271
|
+
async [Symbol.asyncDispose]() {}
|
|
272
|
+
}, p = (e, t) => new d().connect(e, t), m = p, h = (e, t) => {
|
|
273
|
+
typeof e == "function" && (t = e, e = void 0);
|
|
274
|
+
let n = new f(e);
|
|
275
|
+
return t && n.on("connection", t), n;
|
|
276
|
+
}, g = {
|
|
277
|
+
Socket: d,
|
|
278
|
+
Server: f,
|
|
279
|
+
connect: p,
|
|
280
|
+
createConnection: m,
|
|
281
|
+
createServer: h,
|
|
282
|
+
isIP: s,
|
|
283
|
+
isIPv4: i,
|
|
284
|
+
isIPv6: o
|
|
285
|
+
};
|
|
286
|
+
export { m as a, p as i, d as n, h as o, g as r, u as s, f as t };
|
package/net-Dk2kqtgE.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-DrvhPN56.cjs"),n=require("./busy-BXbVH595.cjs"),r=require("./relay-choice-JC_JJY_M.cjs"),i=require("./utils-BpHmMkIR.cjs");require("./wire.cjs");let a=require("stream"),o=require("events");var s=e.t({Server:()=>l,Socket:()=>c,_default:()=>p,connect:()=>u,createConnection:()=>d,createServer:()=>f,default:()=>p,isIP:()=>i.t,isIPv4:()=>i.n,isIPv6:()=>i.r}),c=class extends a.Stream.Duplex{_localAddress;_remoteAddress;_webVPNTcpSocketPromise;_relay;constructor(e){if(e?.fd!==void 0)throw Error(`FKN WebVPN does not support file descriptors`);super(e),e?.connection&&this.__webvpn_tcp_socket_init__(e.connection)}_busyRelease;__webvpn_tcp_socket_init__(e,t){return this._busyRelease??=n.t(`tcp socket`),t&&(this._localAddress={address:t.localAddress,family:t.localFamily,port:t.localPort},this._remoteAddress={address:t.remoteAddress,family:t.remoteFamily,port:t.remotePort},this._relay=t.relay),this._webVPNTcpSocketPromise=e.then(e=>{let t=e.dataReadableStream.getReader(),n=e.dataWritableStream.getWriter();return this._localAddress={address:e.localAddress,family:e.localFamily,port:e.localPort},this._remoteAddress={address:e.remoteAddress,family:e.remoteFamily,port:e.remotePort},this._relay=e.relay,{...e,reader:t,writer:n}}).catch(e=>{this.emit(`error`,e)}),this._webVPNTcpSocketPromise.then(e=>{e?this.emit(`connect`):this._busyRelease?.()}),this._webVPNTcpSocketPromise}_read(e){if(!this._webVPNTcpSocketPromise)throw Error(`Socket not connected`);this._webVPNTcpSocketPromise.then(e=>{e?e.reader.read().then(({value:e,done:t})=>{t?this.push(null):(this._restartTimeoutTimer(),this.push(e))}).catch(e=>{this.destroy(e)}):this.push(null)})}_write(e,t,n){this._webVPNTcpSocketPromise?this._webVPNTcpSocketPromise.then(async t=>{if(!t)throw Error(`Socket not connected`);await t.writer.ready,await t.writer.write(e),this._restartTimeoutTimer(),n()}).catch(n):n(Error(`Socket not connected`))}connect(...e){let n=i.o(...e),{relay:a}=n,o=this.__webvpn_tcp_socket_init__(t.s(`an outbound tcp socket`).then(e=>(a!==void 0&&r.t(e,`net.connect`),e.cloud.webvpn.tcpSocket({remoteAddress:n.host??`localhost`,remotePort:n.port,relay:a}))));return n.callback&&o.then(e=>{e&&n.callback.call(this)}),this}_final(e){this._webVPNTcpSocketPromise?this._webVPNTcpSocketPromise.then(async e=>{e&&await e.writer.close()}).then(()=>e(),t=>e(t)):e()}_destroy(e,t){this._timeoutTimer&&clearTimeout(this._timeoutTimer),this._busyRelease?.(),this._webVPNTcpSocketPromise?this._webVPNTcpSocketPromise.then(async e=>{e&&await(this._resetRequested?e.resetAndDestroy():e.destroy())}).then(()=>t(e),()=>t(e)):t(e)}destroySoon(){this.writableFinished?this.destroy():(this.once(`finish`,()=>this.destroy()),this.end())}_resetRequested=!1;resetAndDestroy(){return this._resetRequested=!0,this.destroy(),this}_timeoutMs;_timeoutTimer;_restartTimeoutTimer(){this._timeoutTimer&&clearTimeout(this._timeoutTimer),this._timeoutMs&&(this._timeoutTimer=setTimeout(()=>this.emit(`timeout`),this._timeoutMs))}setTimeout(e,t){return t&&this.on(`timeout`,t),this._timeoutMs=e,this._restartTimeoutTimer(),this}setNoDelay(e){let t=e??!0;return this._setTcpOption({type:0,value:t}),this}setKeepAlive(e,t){let n=e??!1,r=t!==void 0&&t>0?Math.max(1,Math.round(t/1e3)):0;return this._setTcpOption({type:2,enabled:n,initialDelaySeconds:r}),this}setSendBufferSize(e){return this._setTcpOption({type:3,value:e}),this}setRecvBufferSize(e){return this._setTcpOption({type:4,value:e}),this}_typeOfService;getTypeOfService(){return this._typeOfService??0}setTypeOfService(e){return this._typeOfService=e,this}_setTcpOption(e){this._webVPNTcpSocketPromise?this._webVPNTcpSocketPromise.then(async t=>{if(t)try{await t.setOption(e)}catch(e){this.emit(`error`,e)}}):this.emit(`error`,Error(`Cannot set socket option before connect`))}write(e,t,...n){return super.write(e,t,...n)}address(){return this._localAddress??{}}unref(){return this}ref(){return this}autoSelectFamilyAttemptedAddresses;bufferSize;bytesRead;bytesWritten;connecting;pending;get localAddress(){if(!this._localAddress)throw Error(`Socket is not connected`);return this._localAddress.address}get localPort(){if(!this._localAddress)throw Error(`Socket is not connected`);return this._localAddress.port}get localFamily(){if(!this._localAddress)throw Error(`Socket is not connected`);return this._localAddress.family}readyState;get remoteAddress(){if(!this._remoteAddress)throw Error(`Socket is not connected`);return this._remoteAddress.address}get remotePort(){if(!this._remoteAddress)throw Error(`Socket is not connected`);return this._remoteAddress.port}get remoteFamily(){if(!this._remoteAddress)throw Error(`Socket is not connected`);return this._remoteAddress.family}timeout},l=class extends o.EventEmitter{_localAddress;_webVPNTcpSocketListenerPromise;_relayChoice;_relay;constructor(e,t){super(e),this._relayChoice=e?.relay,t&&this.on(`connection`,t),e?.connection&&this.__webvpn_tcp_socket_listener_init__(e.connection)}_busyRelease;__webvpn_tcp_socket_listener_init__(e){return this._busyRelease??=n.t(`tcp server`),this._webVPNTcpSocketListenerPromise=e.then(e=>(this._localAddress={address:e.localAddress,family:e.localFamily,port:e.localPort},this._relay=e.relay,e)).catch(e=>{this.emit(`error`,e)}),this._webVPNTcpSocketListenerPromise.then(e=>{e?this.emit(`listening`):this._busyRelease?.()}),this._webVPNTcpSocketListenerPromise}listen(...e){let n=i.o(...e);this._closeEmitted=!1;let a=e=>{let t=new c;t.__webvpn_tcp_socket_init__(Promise.resolve(e),e),this.emit(`connection`,t)},o=e=>{this._localAddress=void 0;try{e&&this.listenerCount(`error`)>0&&this.emit(`error`,e)}finally{this._emitClose()}},s=this._relayChoice,l=e=>t.s(`a tcp listener`).then(t=>(s!==void 0&&r.t(t,`net.createServer`),t.cloud.webvpn.tcpSocketListener({localAddress:e,localPort:n.port,onConnection:a,onClose:o,relay:s}))),u=n.host?l(n.host):l(`::`).catch(()=>l(`0.0.0.0`)),d=this.__webvpn_tcp_socket_listener_init__(u);return n.callback&&d.then(e=>{e&&n.callback.call(this)}),this}_closeEmitted=!1;_emitClose(){this._closeEmitted||(this._closeEmitted=!0,this._busyRelease?.(),this.emit(`close`))}close(e){return this._webVPNTcpSocketListenerPromise&&this._webVPNTcpSocketListenerPromise.then(async t=>{if(t)try{await t.close(),this._localAddress=void 0,this._emitClose(),e&&e()}catch(t){this._localAddress=void 0,this._emitClose(),e&&e(t)}}),this}address(){return this._localAddress??null}getConnections(e){throw Error(`Method not implemented.`)}ref(){return this}unref(){return this}maxConnections;connections;listening;async[Symbol.asyncDispose](){}},u=(e,t)=>new c().connect(e,t),d=u,f=(e,t)=>{typeof e==`function`&&(t=e,e=void 0);let n=new l(e);return t&&n.on(`connection`,t),n},p={Socket:c,Server:l,connect:u,createConnection:d,createServer:f,isIP:i.t,isIPv4:i.n,isIPv6:i.r};Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return l}});
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { D as RelayChoice } from "./index-
|
|
2
|
-
import { Bt as TcpSocketListenerResult, Ht as TcpSocketResult, X as Resolvers } from "./contract-
|
|
3
|
-
import { o as TcpSocketOption } from "./wire-
|
|
4
|
-
import "./api-
|
|
5
|
-
import { t as RelayOption } from "./relay-choice-
|
|
1
|
+
import { D as RelayChoice } from "./index-Cu5EcdK0.js";
|
|
2
|
+
import { Bt as TcpSocketListenerResult, Ht as TcpSocketResult, X as Resolvers } from "./contract-0rua6Wsh.js";
|
|
3
|
+
import { o as TcpSocketOption } from "./wire-DhmLnYEU.js";
|
|
4
|
+
import "./api-0Yp9uZcV.js";
|
|
5
|
+
import { t as RelayOption } from "./relay-choice-DOUttUnL.js";
|
|
6
6
|
import { AddressInfo, ListenOptions, Server, ServerOpts, Socket, SocketConnectOpts, SocketConstructorOpts } from "net";
|
|
7
7
|
import { BindOptions } from "dgram";
|
|
8
8
|
import { DuplexOptions, Stream } from "stream";
|
|
9
9
|
import { EventEmitter } from "events";
|
|
10
|
-
//#region src/webvpn/utils.d.ts
|
|
11
10
|
declare const isIPv4: (input: string) => boolean;
|
|
12
11
|
declare const isIPv6: (input: string) => boolean;
|
|
13
12
|
declare const isIP: (input: string) => 0 | 4 | 6;
|
|
@@ -145,5 +144,4 @@ declare const _default: {
|
|
|
145
144
|
isIPv4: typeof isIPv4;
|
|
146
145
|
isIPv6: typeof isIPv6;
|
|
147
146
|
};
|
|
148
|
-
//#endregion
|
|
149
147
|
export { createConnection as a, isIP as c, connect as i, isIPv4 as l, Socket$2 as n, createServer as o, _default as r, net_d_exports as s, Server$1 as t, isIPv6 as u };
|