@fkn/lib 0.3.11 → 0.3.12
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/{background-BLtG2SKm.js → background-C5D7dhf2.js} +1 -1
- package/{background-DsN_xRAy.cjs → background-DdXHHDsS.cjs} +1 -1
- package/index.cjs +5 -5
- package/index.d.ts +32 -9
- package/index.js +185 -164
- package/{locator-DhCNXAk2.js → locator-DUbu14FW.js} +3 -3
- package/{locator-B2frkQPZ.cjs → locator-jHaMLjtv.cjs} +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, c as t, h as n, i as r, l as i, n as a, o, s, t as c } from "./locator-
|
|
1
|
+
import { a as e, c as t, h as n, i as r, l as i, n as a, o, s, t as c } from "./locator-DUbu14FW.js";
|
|
2
2
|
import { checkOsraMessageKey as l, expose as u } from "osra";
|
|
3
3
|
//#endregion
|
|
4
4
|
//#region node_modules/@mfkn/web-extension/lib/background/constants.js
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./locator-B2frkQPZ.cjs`);let t=require(`osra`);var n=e.h(((e,t)=>{(function(n,r){if(typeof define==`function`&&define.amd)define(`webextension-polyfill`,[`module`],r);else if(e!==void 0)r(t);else{var i={exports:{}};r(i),n.browser=i.exports}})(typeof globalThis<`u`?globalThis:typeof self<`u`?self:e,function(e){"use strict";if(!(globalThis.chrome&&globalThis.chrome.runtime&&globalThis.chrome.runtime.id))throw Error(`This script should only be loaded in a browser extension.`);globalThis.browser&&globalThis.browser.runtime&&globalThis.browser.runtime.id?e.exports=globalThis.browser:e.exports=(e=>{let t={alarms:{clear:{minArgs:0,maxArgs:1},clearAll:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getAll:{minArgs:0,maxArgs:0}},bookmarks:{create:{minArgs:1,maxArgs:1},get:{minArgs:1,maxArgs:1},getChildren:{minArgs:1,maxArgs:1},getRecent:{minArgs:1,maxArgs:1},getSubTree:{minArgs:1,maxArgs:1},getTree:{minArgs:0,maxArgs:0},move:{minArgs:2,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeTree:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}},browserAction:{disable:{minArgs:0,maxArgs:1,fallbackToNoCallback:!0},enable:{minArgs:0,maxArgs:1,fallbackToNoCallback:!0},getBadgeBackgroundColor:{minArgs:1,maxArgs:1},getBadgeText:{minArgs:1,maxArgs:1},getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},openPopup:{minArgs:0,maxArgs:0},setBadgeBackgroundColor:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setBadgeText:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setIcon:{minArgs:1,maxArgs:1},setPopup:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setTitle:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},browsingData:{remove:{minArgs:2,maxArgs:2},removeCache:{minArgs:1,maxArgs:1},removeCookies:{minArgs:1,maxArgs:1},removeDownloads:{minArgs:1,maxArgs:1},removeFormData:{minArgs:1,maxArgs:1},removeHistory:{minArgs:1,maxArgs:1},removeLocalStorage:{minArgs:1,maxArgs:1},removePasswords:{minArgs:1,maxArgs:1},removePluginData:{minArgs:1,maxArgs:1},settings:{minArgs:0,maxArgs:0}},commands:{getAll:{minArgs:0,maxArgs:0}},contextMenus:{remove:{minArgs:1,maxArgs:1},removeAll:{minArgs:0,maxArgs:0},update:{minArgs:2,maxArgs:2}},cookies:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:1,maxArgs:1},getAllCookieStores:{minArgs:0,maxArgs:0},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},devtools:{inspectedWindow:{eval:{minArgs:1,maxArgs:2,singleCallbackArg:!1}},panels:{create:{minArgs:3,maxArgs:3,singleCallbackArg:!0},elements:{createSidebarPane:{minArgs:1,maxArgs:1}}}},downloads:{cancel:{minArgs:1,maxArgs:1},download:{minArgs:1,maxArgs:1},erase:{minArgs:1,maxArgs:1},getFileIcon:{minArgs:1,maxArgs:2},open:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},pause:{minArgs:1,maxArgs:1},removeFile:{minArgs:1,maxArgs:1},resume:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},show:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},extension:{isAllowedFileSchemeAccess:{minArgs:0,maxArgs:0},isAllowedIncognitoAccess:{minArgs:0,maxArgs:0}},history:{addUrl:{minArgs:1,maxArgs:1},deleteAll:{minArgs:0,maxArgs:0},deleteRange:{minArgs:1,maxArgs:1},deleteUrl:{minArgs:1,maxArgs:1},getVisits:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1}},i18n:{detectLanguage:{minArgs:1,maxArgs:1},getAcceptLanguages:{minArgs:0,maxArgs:0}},identity:{launchWebAuthFlow:{minArgs:1,maxArgs:1}},idle:{queryState:{minArgs:1,maxArgs:1}},management:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:0,maxArgs:0},getSelf:{minArgs:0,maxArgs:0},setEnabled:{minArgs:2,maxArgs:2},uninstallSelf:{minArgs:0,maxArgs:1}},notifications:{clear:{minArgs:1,maxArgs:1},create:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:0},getPermissionLevel:{minArgs:0,maxArgs:0},update:{minArgs:2,maxArgs:2}},pageAction:{getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},hide:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setIcon:{minArgs:1,maxArgs:1},setPopup:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setTitle:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},show:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},permissions:{contains:{minArgs:1,maxArgs:1},getAll:{minArgs:0,maxArgs:0},remove:{minArgs:1,maxArgs:1},request:{minArgs:1,maxArgs:1}},runtime:{getBackgroundPage:{minArgs:0,maxArgs:0},getPlatformInfo:{minArgs:0,maxArgs:0},openOptionsPage:{minArgs:0,maxArgs:0},requestUpdateCheck:{minArgs:0,maxArgs:0},sendMessage:{minArgs:1,maxArgs:3},sendNativeMessage:{minArgs:2,maxArgs:2},setUninstallURL:{minArgs:1,maxArgs:1}},sessions:{getDevices:{minArgs:0,maxArgs:1},getRecentlyClosed:{minArgs:0,maxArgs:1},restore:{minArgs:0,maxArgs:1}},storage:{local:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},managed:{get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1}},sync:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}}},tabs:{captureVisibleTab:{minArgs:0,maxArgs:2},create:{minArgs:1,maxArgs:1},detectLanguage:{minArgs:0,maxArgs:1},discard:{minArgs:0,maxArgs:1},duplicate:{minArgs:1,maxArgs:1},executeScript:{minArgs:1,maxArgs:2},get:{minArgs:1,maxArgs:1},getCurrent:{minArgs:0,maxArgs:0},getZoom:{minArgs:0,maxArgs:1},getZoomSettings:{minArgs:0,maxArgs:1},goBack:{minArgs:0,maxArgs:1},goForward:{minArgs:0,maxArgs:1},highlight:{minArgs:1,maxArgs:1},insertCSS:{minArgs:1,maxArgs:2},move:{minArgs:2,maxArgs:2},query:{minArgs:1,maxArgs:1},reload:{minArgs:0,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeCSS:{minArgs:1,maxArgs:2},sendMessage:{minArgs:2,maxArgs:3},setZoom:{minArgs:1,maxArgs:2},setZoomSettings:{minArgs:1,maxArgs:2},update:{minArgs:1,maxArgs:2}},topSites:{get:{minArgs:0,maxArgs:0}},webNavigation:{getAllFrames:{minArgs:1,maxArgs:1},getFrame:{minArgs:1,maxArgs:1}},webRequest:{handlerBehaviorChanged:{minArgs:0,maxArgs:0}},windows:{create:{minArgs:0,maxArgs:1},get:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:1},getCurrent:{minArgs:0,maxArgs:1},getLastFocused:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}}};if(Object.keys(t).length===0)throw Error(`api-metadata.json has not been included in browser-polyfill`);class n extends WeakMap{constructor(e,t=void 0){super(t),this.createItem=e}get(e){return this.has(e)||this.set(e,this.createItem(e)),super.get(e)}}let r=e=>e&&typeof e==`object`&&typeof e.then==`function`,i=(t,n)=>(...r)=>{e.runtime.lastError?t.reject(Error(e.runtime.lastError.message)):n.singleCallbackArg||r.length<=1&&n.singleCallbackArg!==!1?t.resolve(r[0]):t.resolve(r)},a=e=>e==1?`argument`:`arguments`,o=(e,t)=>function(n,...r){if(r.length<t.minArgs)throw Error(`Expected at least ${t.minArgs} ${a(t.minArgs)} for ${e}(), got ${r.length}`);if(r.length>t.maxArgs)throw Error(`Expected at most ${t.maxArgs} ${a(t.maxArgs)} for ${e}(), got ${r.length}`);return new Promise((a,o)=>{if(t.fallbackToNoCallback)try{n[e](...r,i({resolve:a,reject:o},t))}catch(i){console.warn(`${e} API method doesn't seem to support the callback parameter, falling back to call it without a callback: `,i),n[e](...r),t.fallbackToNoCallback=!1,t.noCallback=!0,a()}else t.noCallback?(n[e](...r),a()):n[e](...r,i({resolve:a,reject:o},t))})},s=(e,t,n)=>new Proxy(t,{apply(t,r,i){return n.call(r,e,...i)}}),c=Function.call.bind(Object.prototype.hasOwnProperty),l=(e,t={},n={})=>{let r=Object.create(null);return new Proxy(Object.create(e),{has(t,n){return n in e||n in r},get(i,a,u){if(a in r)return r[a];if(!(a in e))return;let d=e[a];if(typeof d==`function`)if(typeof t[a]==`function`)d=s(e,e[a],t[a]);else if(c(n,a)){let t=o(a,n[a]);d=s(e,e[a],t)}else d=d.bind(e);else if(typeof d==`object`&&d&&(c(t,a)||c(n,a)))d=l(d,t[a],n[a]);else if(c(n,`*`))d=l(d,t[a],n[`*`]);else return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get(){return e[a]},set(t){e[a]=t}}),d;return r[a]=d,d},set(t,n,i,a){return n in r?r[n]=i:e[n]=i,!0},defineProperty(e,t,n){return Reflect.defineProperty(r,t,n)},deleteProperty(e,t){return Reflect.deleteProperty(r,t)}})},u=e=>({addListener(t,n,...r){t.addListener(e.get(n),...r)},hasListener(t,n){return t.hasListener(e.get(n))},removeListener(t,n){t.removeListener(e.get(n))}}),d=new n(e=>typeof e==`function`?function(t){e(l(t,{},{getContent:{minArgs:0,maxArgs:0}}))}:e),f=new n(e=>typeof e==`function`?function(t,n,i){let a=!1,o,s=new Promise(e=>{o=function(t){a=!0,e(t)}}),c;try{c=e(t,n,o)}catch(e){c=Promise.reject(e)}let l=c!==!0&&r(c);return c!==!0&&!l&&!a?!1:((e=>{e.then(e=>{i(e)},e=>{let t;t=e&&(e instanceof Error||typeof e.message==`string`)?e.message:`An unexpected error occurred`,i({__mozWebExtensionPolyfillReject__:!0,message:t})}).catch(e=>{console.error(`Failed to send onMessage rejected reply`,e)})})(l?c:s),!0)}:e),p=({reject:t,resolve:n},r)=>{e.runtime.lastError?e.runtime.lastError.message===`The message port closed before a response was received.`?n():t(Error(e.runtime.lastError.message)):r&&r.__mozWebExtensionPolyfillReject__?t(Error(r.message)):n(r)},m=(e,t,n,...r)=>{if(r.length<t.minArgs)throw Error(`Expected at least ${t.minArgs} ${a(t.minArgs)} for ${e}(), got ${r.length}`);if(r.length>t.maxArgs)throw Error(`Expected at most ${t.maxArgs} ${a(t.maxArgs)} for ${e}(), got ${r.length}`);return new Promise((e,t)=>{let i=p.bind(null,{resolve:e,reject:t});r.push(i),n.sendMessage(...r)})},h={devtools:{network:{onRequestFinished:u(d)}},runtime:{onMessage:u(f),onMessageExternal:u(f),sendMessage:m.bind(null,`sendMessage`,{minArgs:1,maxArgs:3})},tabs:{sendMessage:m.bind(null,`sendMessage`,{minArgs:2,maxArgs:3})}},g={clear:{minArgs:1,maxArgs:1},get:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}};return t.privacy={network:{"*":g},services:{"*":g},websites:{"*":g}},l(e,h,t)})(chrome)})}))(),r=`FKN_WEB_EXTENSION_BACKGROUND_COMMUNICATION_OSRA_KEY`,i=`FKN_WEB_EXTENSION_CONTENT_SCRIPT_PEER_OSRA_KEY`,a=`FKN_WEB_EXTENSION_CONTENT_SCRIPT_RELAY_ENVELOPE_KEY`,o=t=>e.c(t)&&t.FKN_WEB_EXTENSION_CONTENT_SCRIPT_RELAY_ENVELOPE_KEY===!0&&typeof t.from==`string`&&e.c(t.message),s=new Map,c=r=>{let o=s.get(r);if(o)return o;let{promise:c,resolve:l}=Promise.withResolvers(),{promise:u,resolve:d}=Promise.withResolvers(),f={resolvers:(0,t.expose)(D,{key:i,revivableModules:e.l,transport:{isJson:!0,receive:e=>l(e),emit:e=>{n.runtime.sendMessage({[a]:!0,target:r,message:e}).catch(()=>{})}}}),listener:c,stale:u,markStale:d};return s.set(r,f),f};n.runtime.onMessage.addListener((e,n)=>{o(e)&&(0,t.checkOsraMessageKey)(e.message,`FKN_WEB_EXTENSION_CONTENT_SCRIPT_PEER_OSRA_KEY`)&&c(e.from).listener.then(t=>t(e.message,{sender:n}))}),e.s(e=>{let t=s.get(e);t&&(t.markStale(),s.delete(e))});var l=async e=>{let t=c(e);return{resolvers:await Promise.race([t.resolvers,t.stale.then(()=>{throw Error(`peer ${e} became stale before connect completed`)})]),stale:t.stale}},u=[`position: fixed`,`border: 2px solid oklch(63% 0.24 25)`,`border-radius: 4px`,`background: oklch(63% 0.24 25 / 0.12)`,`box-shadow: 0 0 0 2px oklch(63% 0.24 25 / 0.5), 0 0 0 100vmax oklch(0% 0 0 / 0.5)`,`z-index: 2147483647`,`pointer-events: none`,`box-sizing: border-box`],d=(e,t)=>{let n=t.getBoundingClientRect();e.setAttribute(`style`,[...u,`left: ${n.left}px`,`top: ${n.top}px`,`width: ${n.width}px`,`height: ${n.height}px`].map(e=>`${e} !important`).join(`; `))},f=e=>{let t=e.getBoundingClientRect();return{clientX:t.left+t.width/2,clientY:t.top+t.height/2}},p=0,m=e=>{p^=1;let{clientX:t,clientY:n}=f(e),r={bubbles:!0,cancelable:!0,composed:!0,clientX:t+p,clientY:n};e.dispatchEvent(new PointerEvent(`pointermove`,{...r,pointerType:`mouse`,pointerId:1,isPrimary:!0})),e.dispatchEvent(new MouseEvent(`mousemove`,r))},h=[[PointerEvent,`pointerover`,!0],[PointerEvent,`pointerenter`,!1],[MouseEvent,`mouseover`,!0],[MouseEvent,`mouseenter`,!1]],g=[[PointerEvent,`pointerout`,!0],[PointerEvent,`pointerleave`,!1],[MouseEvent,`mouseout`,!0],[MouseEvent,`mouseleave`,!1]],_=(e,t)=>t.forEach(([t,n,r])=>e.dispatchEvent(new t(n,{bubbles:r,cancelable:!0,composed:!0,...f(e)}))),v=e=>{_(e,h),m(e)},y=e=>_(e,g),b=null,x=e=>{S();try{e.scrollIntoView({block:`center`,inline:`center`})}catch{}let t=document.createElement(`div`);(document.body??document.documentElement).appendChild(t),v(e);let n=requestAnimationFrame(function r(){d(t,e),n=requestAnimationFrame(r)}),r=window.setInterval(()=>m(e),300);b={stop:()=>{cancelAnimationFrame(n),clearInterval(r),y(e),t.remove()}}},S=()=>{b?.stop(),b=null},C={[e.n]:e.t,[e.a]:e.i},w=e=>{let t=C[e.locatorType];if(!t)throw Error(`Unknown locator kind: "${e.locatorType}"`);let n=t.selectorModules.find(t=>t.type===e.type);if(!n)throw Error(`Unknown selector: "${e.locatorType}.${e.type}"`);return n},T=e=>e.reduce((e,t)=>w(t).resolve({elements:e},...t.args),[document.documentElement]),E=e=>{for(let t=0;t<e.length;t++){let n=w(e[t]);if(n.resolvePeer)return{module:n,index:t}}return null},D={contentScriptDummy:()=>{},executeLocator:async(t,n,r)=>{let i=E(t);if(i){let e=await i.module.resolvePeer({parts:t,selfIndex:i.index,resolveLocal:T}),{resolvers:a,stale:o}=await l(e),s=t.slice(i.index+1);return Promise.race([a.executeLocator(s,n,r),o.then(()=>{throw Error(`peer ${e} became stale during call, retrying`)})])}if(n===`__fkn_highlight`){if(r[0]?.on){let n=T(t)[0];n&&(e.o(!0),x(n))}else S(),e.o(!1);return}let a=[...e.t.operationModules,...e.i.operationModules].find(e=>e.type===n);if(!a)throw Error(`Unknown operation: "${n}"`);return a.resolve({elements:T(t)},...r)}},O=(0,t.expose)(D,{key:r,transport:{isJson:!0,receive:n.runtime.onMessage,emit:n.runtime}});exports.backgroundResolvers=O;
|
|
1
|
+
const e=require(`./locator-jHaMLjtv.cjs`);let t=require(`osra`);var n=e.h(((e,t)=>{(function(n,r){if(typeof define==`function`&&define.amd)define(`webextension-polyfill`,[`module`],r);else if(e!==void 0)r(t);else{var i={exports:{}};r(i),n.browser=i.exports}})(typeof globalThis<`u`?globalThis:typeof self<`u`?self:e,function(e){"use strict";if(!(globalThis.chrome&&globalThis.chrome.runtime&&globalThis.chrome.runtime.id))throw Error(`This script should only be loaded in a browser extension.`);globalThis.browser&&globalThis.browser.runtime&&globalThis.browser.runtime.id?e.exports=globalThis.browser:e.exports=(e=>{let t={alarms:{clear:{minArgs:0,maxArgs:1},clearAll:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getAll:{minArgs:0,maxArgs:0}},bookmarks:{create:{minArgs:1,maxArgs:1},get:{minArgs:1,maxArgs:1},getChildren:{minArgs:1,maxArgs:1},getRecent:{minArgs:1,maxArgs:1},getSubTree:{minArgs:1,maxArgs:1},getTree:{minArgs:0,maxArgs:0},move:{minArgs:2,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeTree:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}},browserAction:{disable:{minArgs:0,maxArgs:1,fallbackToNoCallback:!0},enable:{minArgs:0,maxArgs:1,fallbackToNoCallback:!0},getBadgeBackgroundColor:{minArgs:1,maxArgs:1},getBadgeText:{minArgs:1,maxArgs:1},getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},openPopup:{minArgs:0,maxArgs:0},setBadgeBackgroundColor:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setBadgeText:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setIcon:{minArgs:1,maxArgs:1},setPopup:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setTitle:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},browsingData:{remove:{minArgs:2,maxArgs:2},removeCache:{minArgs:1,maxArgs:1},removeCookies:{minArgs:1,maxArgs:1},removeDownloads:{minArgs:1,maxArgs:1},removeFormData:{minArgs:1,maxArgs:1},removeHistory:{minArgs:1,maxArgs:1},removeLocalStorage:{minArgs:1,maxArgs:1},removePasswords:{minArgs:1,maxArgs:1},removePluginData:{minArgs:1,maxArgs:1},settings:{minArgs:0,maxArgs:0}},commands:{getAll:{minArgs:0,maxArgs:0}},contextMenus:{remove:{minArgs:1,maxArgs:1},removeAll:{minArgs:0,maxArgs:0},update:{minArgs:2,maxArgs:2}},cookies:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:1,maxArgs:1},getAllCookieStores:{minArgs:0,maxArgs:0},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},devtools:{inspectedWindow:{eval:{minArgs:1,maxArgs:2,singleCallbackArg:!1}},panels:{create:{minArgs:3,maxArgs:3,singleCallbackArg:!0},elements:{createSidebarPane:{minArgs:1,maxArgs:1}}}},downloads:{cancel:{minArgs:1,maxArgs:1},download:{minArgs:1,maxArgs:1},erase:{minArgs:1,maxArgs:1},getFileIcon:{minArgs:1,maxArgs:2},open:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},pause:{minArgs:1,maxArgs:1},removeFile:{minArgs:1,maxArgs:1},resume:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},show:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},extension:{isAllowedFileSchemeAccess:{minArgs:0,maxArgs:0},isAllowedIncognitoAccess:{minArgs:0,maxArgs:0}},history:{addUrl:{minArgs:1,maxArgs:1},deleteAll:{minArgs:0,maxArgs:0},deleteRange:{minArgs:1,maxArgs:1},deleteUrl:{minArgs:1,maxArgs:1},getVisits:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1}},i18n:{detectLanguage:{minArgs:1,maxArgs:1},getAcceptLanguages:{minArgs:0,maxArgs:0}},identity:{launchWebAuthFlow:{minArgs:1,maxArgs:1}},idle:{queryState:{minArgs:1,maxArgs:1}},management:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:0,maxArgs:0},getSelf:{minArgs:0,maxArgs:0},setEnabled:{minArgs:2,maxArgs:2},uninstallSelf:{minArgs:0,maxArgs:1}},notifications:{clear:{minArgs:1,maxArgs:1},create:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:0},getPermissionLevel:{minArgs:0,maxArgs:0},update:{minArgs:2,maxArgs:2}},pageAction:{getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},hide:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setIcon:{minArgs:1,maxArgs:1},setPopup:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setTitle:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},show:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},permissions:{contains:{minArgs:1,maxArgs:1},getAll:{minArgs:0,maxArgs:0},remove:{minArgs:1,maxArgs:1},request:{minArgs:1,maxArgs:1}},runtime:{getBackgroundPage:{minArgs:0,maxArgs:0},getPlatformInfo:{minArgs:0,maxArgs:0},openOptionsPage:{minArgs:0,maxArgs:0},requestUpdateCheck:{minArgs:0,maxArgs:0},sendMessage:{minArgs:1,maxArgs:3},sendNativeMessage:{minArgs:2,maxArgs:2},setUninstallURL:{minArgs:1,maxArgs:1}},sessions:{getDevices:{minArgs:0,maxArgs:1},getRecentlyClosed:{minArgs:0,maxArgs:1},restore:{minArgs:0,maxArgs:1}},storage:{local:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},managed:{get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1}},sync:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}}},tabs:{captureVisibleTab:{minArgs:0,maxArgs:2},create:{minArgs:1,maxArgs:1},detectLanguage:{minArgs:0,maxArgs:1},discard:{minArgs:0,maxArgs:1},duplicate:{minArgs:1,maxArgs:1},executeScript:{minArgs:1,maxArgs:2},get:{minArgs:1,maxArgs:1},getCurrent:{minArgs:0,maxArgs:0},getZoom:{minArgs:0,maxArgs:1},getZoomSettings:{minArgs:0,maxArgs:1},goBack:{minArgs:0,maxArgs:1},goForward:{minArgs:0,maxArgs:1},highlight:{minArgs:1,maxArgs:1},insertCSS:{minArgs:1,maxArgs:2},move:{minArgs:2,maxArgs:2},query:{minArgs:1,maxArgs:1},reload:{minArgs:0,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeCSS:{minArgs:1,maxArgs:2},sendMessage:{minArgs:2,maxArgs:3},setZoom:{minArgs:1,maxArgs:2},setZoomSettings:{minArgs:1,maxArgs:2},update:{minArgs:1,maxArgs:2}},topSites:{get:{minArgs:0,maxArgs:0}},webNavigation:{getAllFrames:{minArgs:1,maxArgs:1},getFrame:{minArgs:1,maxArgs:1}},webRequest:{handlerBehaviorChanged:{minArgs:0,maxArgs:0}},windows:{create:{minArgs:0,maxArgs:1},get:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:1},getCurrent:{minArgs:0,maxArgs:1},getLastFocused:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}}};if(Object.keys(t).length===0)throw Error(`api-metadata.json has not been included in browser-polyfill`);class n extends WeakMap{constructor(e,t=void 0){super(t),this.createItem=e}get(e){return this.has(e)||this.set(e,this.createItem(e)),super.get(e)}}let r=e=>e&&typeof e==`object`&&typeof e.then==`function`,i=(t,n)=>(...r)=>{e.runtime.lastError?t.reject(Error(e.runtime.lastError.message)):n.singleCallbackArg||r.length<=1&&n.singleCallbackArg!==!1?t.resolve(r[0]):t.resolve(r)},a=e=>e==1?`argument`:`arguments`,o=(e,t)=>function(n,...r){if(r.length<t.minArgs)throw Error(`Expected at least ${t.minArgs} ${a(t.minArgs)} for ${e}(), got ${r.length}`);if(r.length>t.maxArgs)throw Error(`Expected at most ${t.maxArgs} ${a(t.maxArgs)} for ${e}(), got ${r.length}`);return new Promise((a,o)=>{if(t.fallbackToNoCallback)try{n[e](...r,i({resolve:a,reject:o},t))}catch(i){console.warn(`${e} API method doesn't seem to support the callback parameter, falling back to call it without a callback: `,i),n[e](...r),t.fallbackToNoCallback=!1,t.noCallback=!0,a()}else t.noCallback?(n[e](...r),a()):n[e](...r,i({resolve:a,reject:o},t))})},s=(e,t,n)=>new Proxy(t,{apply(t,r,i){return n.call(r,e,...i)}}),c=Function.call.bind(Object.prototype.hasOwnProperty),l=(e,t={},n={})=>{let r=Object.create(null);return new Proxy(Object.create(e),{has(t,n){return n in e||n in r},get(i,a,u){if(a in r)return r[a];if(!(a in e))return;let d=e[a];if(typeof d==`function`)if(typeof t[a]==`function`)d=s(e,e[a],t[a]);else if(c(n,a)){let t=o(a,n[a]);d=s(e,e[a],t)}else d=d.bind(e);else if(typeof d==`object`&&d&&(c(t,a)||c(n,a)))d=l(d,t[a],n[a]);else if(c(n,`*`))d=l(d,t[a],n[`*`]);else return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get(){return e[a]},set(t){e[a]=t}}),d;return r[a]=d,d},set(t,n,i,a){return n in r?r[n]=i:e[n]=i,!0},defineProperty(e,t,n){return Reflect.defineProperty(r,t,n)},deleteProperty(e,t){return Reflect.deleteProperty(r,t)}})},u=e=>({addListener(t,n,...r){t.addListener(e.get(n),...r)},hasListener(t,n){return t.hasListener(e.get(n))},removeListener(t,n){t.removeListener(e.get(n))}}),d=new n(e=>typeof e==`function`?function(t){e(l(t,{},{getContent:{minArgs:0,maxArgs:0}}))}:e),f=new n(e=>typeof e==`function`?function(t,n,i){let a=!1,o,s=new Promise(e=>{o=function(t){a=!0,e(t)}}),c;try{c=e(t,n,o)}catch(e){c=Promise.reject(e)}let l=c!==!0&&r(c);return c!==!0&&!l&&!a?!1:((e=>{e.then(e=>{i(e)},e=>{let t;t=e&&(e instanceof Error||typeof e.message==`string`)?e.message:`An unexpected error occurred`,i({__mozWebExtensionPolyfillReject__:!0,message:t})}).catch(e=>{console.error(`Failed to send onMessage rejected reply`,e)})})(l?c:s),!0)}:e),p=({reject:t,resolve:n},r)=>{e.runtime.lastError?e.runtime.lastError.message===`The message port closed before a response was received.`?n():t(Error(e.runtime.lastError.message)):r&&r.__mozWebExtensionPolyfillReject__?t(Error(r.message)):n(r)},m=(e,t,n,...r)=>{if(r.length<t.minArgs)throw Error(`Expected at least ${t.minArgs} ${a(t.minArgs)} for ${e}(), got ${r.length}`);if(r.length>t.maxArgs)throw Error(`Expected at most ${t.maxArgs} ${a(t.maxArgs)} for ${e}(), got ${r.length}`);return new Promise((e,t)=>{let i=p.bind(null,{resolve:e,reject:t});r.push(i),n.sendMessage(...r)})},h={devtools:{network:{onRequestFinished:u(d)}},runtime:{onMessage:u(f),onMessageExternal:u(f),sendMessage:m.bind(null,`sendMessage`,{minArgs:1,maxArgs:3})},tabs:{sendMessage:m.bind(null,`sendMessage`,{minArgs:2,maxArgs:3})}},g={clear:{minArgs:1,maxArgs:1},get:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}};return t.privacy={network:{"*":g},services:{"*":g},websites:{"*":g}},l(e,h,t)})(chrome)})}))(),r=`FKN_WEB_EXTENSION_BACKGROUND_COMMUNICATION_OSRA_KEY`,i=`FKN_WEB_EXTENSION_CONTENT_SCRIPT_PEER_OSRA_KEY`,a=`FKN_WEB_EXTENSION_CONTENT_SCRIPT_RELAY_ENVELOPE_KEY`,o=t=>e.c(t)&&t.FKN_WEB_EXTENSION_CONTENT_SCRIPT_RELAY_ENVELOPE_KEY===!0&&typeof t.from==`string`&&e.c(t.message),s=new Map,c=r=>{let o=s.get(r);if(o)return o;let{promise:c,resolve:l}=Promise.withResolvers(),{promise:u,resolve:d}=Promise.withResolvers(),f={resolvers:(0,t.expose)(D,{key:i,revivableModules:e.l,transport:{isJson:!0,receive:e=>l(e),emit:e=>{n.runtime.sendMessage({[a]:!0,target:r,message:e}).catch(()=>{})}}}),listener:c,stale:u,markStale:d};return s.set(r,f),f};n.runtime.onMessage.addListener((e,n)=>{o(e)&&(0,t.checkOsraMessageKey)(e.message,`FKN_WEB_EXTENSION_CONTENT_SCRIPT_PEER_OSRA_KEY`)&&c(e.from).listener.then(t=>t(e.message,{sender:n}))}),e.s(e=>{let t=s.get(e);t&&(t.markStale(),s.delete(e))});var l=async e=>{let t=c(e);return{resolvers:await Promise.race([t.resolvers,t.stale.then(()=>{throw Error(`peer ${e} became stale before connect completed`)})]),stale:t.stale}},u=[`position: fixed`,`border: 2px solid oklch(63% 0.24 25)`,`border-radius: 4px`,`background: oklch(63% 0.24 25 / 0.12)`,`box-shadow: 0 0 0 2px oklch(63% 0.24 25 / 0.5), 0 0 0 100vmax oklch(0% 0 0 / 0.5)`,`z-index: 2147483647`,`pointer-events: none`,`box-sizing: border-box`],d=(e,t)=>{let n=t.getBoundingClientRect();e.setAttribute(`style`,[...u,`left: ${n.left}px`,`top: ${n.top}px`,`width: ${n.width}px`,`height: ${n.height}px`].map(e=>`${e} !important`).join(`; `))},f=e=>{let t=e.getBoundingClientRect();return{clientX:t.left+t.width/2,clientY:t.top+t.height/2}},p=0,m=e=>{p^=1;let{clientX:t,clientY:n}=f(e),r={bubbles:!0,cancelable:!0,composed:!0,clientX:t+p,clientY:n};e.dispatchEvent(new PointerEvent(`pointermove`,{...r,pointerType:`mouse`,pointerId:1,isPrimary:!0})),e.dispatchEvent(new MouseEvent(`mousemove`,r))},h=[[PointerEvent,`pointerover`,!0],[PointerEvent,`pointerenter`,!1],[MouseEvent,`mouseover`,!0],[MouseEvent,`mouseenter`,!1]],g=[[PointerEvent,`pointerout`,!0],[PointerEvent,`pointerleave`,!1],[MouseEvent,`mouseout`,!0],[MouseEvent,`mouseleave`,!1]],_=(e,t)=>t.forEach(([t,n,r])=>e.dispatchEvent(new t(n,{bubbles:r,cancelable:!0,composed:!0,...f(e)}))),v=e=>{_(e,h),m(e)},y=e=>_(e,g),b=null,x=e=>{S();try{e.scrollIntoView({block:`center`,inline:`center`})}catch{}let t=document.createElement(`div`);(document.body??document.documentElement).appendChild(t),v(e);let n=requestAnimationFrame(function r(){d(t,e),n=requestAnimationFrame(r)}),r=window.setInterval(()=>m(e),300);b={stop:()=>{cancelAnimationFrame(n),clearInterval(r),y(e),t.remove()}}},S=()=>{b?.stop(),b=null},C={[e.n]:e.t,[e.a]:e.i},w=e=>{let t=C[e.locatorType];if(!t)throw Error(`Unknown locator kind: "${e.locatorType}"`);let n=t.selectorModules.find(t=>t.type===e.type);if(!n)throw Error(`Unknown selector: "${e.locatorType}.${e.type}"`);return n},T=e=>e.reduce((e,t)=>w(t).resolve({elements:e},...t.args),[document.documentElement]),E=e=>{for(let t=0;t<e.length;t++){let n=w(e[t]);if(n.resolvePeer)return{module:n,index:t}}return null},D={contentScriptDummy:()=>{},executeLocator:async(t,n,r)=>{let i=E(t);if(i){let e=await i.module.resolvePeer({parts:t,selfIndex:i.index,resolveLocal:T}),{resolvers:a,stale:o}=await l(e),s=t.slice(i.index+1);return Promise.race([a.executeLocator(s,n,r),o.then(()=>{throw Error(`peer ${e} became stale during call, retrying`)})])}if(n===`__fkn_highlight`){if(r[0]?.on){let n=T(t)[0];n&&(e.o(!0),x(n))}else S(),e.o(!1);return}let a=[...e.t.operationModules,...e.i.operationModules].find(e=>e.type===n);if(!a)throw Error(`Unknown operation: "${n}"`);return a.resolve({elements:T(t)},...r)}},O=(0,t.expose)(D,{key:r,transport:{isJson:!0,receive:n.runtime.onMessage,emit:n.runtime}});exports.backgroundResolvers=O;
|
package/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./locator-B2frkQPZ.cjs`);let t=require(`osra`),n=require(`stream`),r=require(`events`),i=require(`ip-address`),a=require(`buffer`);var o=32,s=typeof CSS<`u`&&CSS.supports(`clip-path`,`path('M0 0H1V1H0Z')`),c=e=>{let t=e.style;t.setProperty(`display`,`block`,`important`),t.setProperty(`position`,`fixed`,`important`),t.setProperty(`top`,`0`,`important`),t.setProperty(`left`,`0`,`important`),t.setProperty(`width`,`100%`,`important`),t.setProperty(`height`,`100%`,`important`),t.setProperty(`border`,`none`,`important`),t.setProperty(`clip-path`,`inset(100%)`,`important`),t.setProperty(`background`,`transparent`),t.setProperty(`color-scheme`,`normal`),t.setProperty(`z-index`,`2147483647`),e.setAttribute(`title`,`FKN`)},l=({x:e,y:t,width:n,height:r})=>`M${e} ${t}h${n}v${r}h${-n}Z`,u=(e,{modal:t,rects:n})=>{if(!s){let r=t||n.length>0;e.style.setProperty(`pointer-events`,r?`auto`:`none`,`important`),e.style.setProperty(`visibility`,r?`visible`:`hidden`,`important`);return}let r=t?`none`:n.length===0?`inset(100%)`:`path('${n.map(l).join(``)}')`,i=r===`none`||CSS.supports(`clip-path`,r)?r:`inset(100%)`;e.style.setProperty(`clip-path`,i,`important`)},ee=e=>{if(typeof e!=`object`||!e)return null;let{x:t,y:n,width:r,height:i}=e;if(![t,n,r,i].every(e=>typeof e==`number`&&Number.isFinite(e)))return null;let a=window.innerWidth,o=window.innerHeight,s=Math.max(0,Math.min(Math.round(t),a)),c=Math.max(0,Math.min(Math.round(n),o)),l=Math.max(s,Math.min(Math.round(t+r),a)),u=Math.max(c,Math.min(Math.round(n+i),o));return{x:s,y:c,width:l-s,height:u-c}},te=e=>{if(typeof e!=`object`||!e)return null;let t=e,n=(Array.isArray(t.rects)?t.rects.slice(0,o):[]).map(ee).filter(e=>e!==null&&e.width>0&&e.height>0);return{modal:t.modal===!0,rects:n}},d=null,ne=()=>d!==null,re=e=>{c(e),u(e,{modal:!1,rects:[]}),d=e},ie=e=>{if(!d)return;let t=te(e);t&&u(d,t)},ae=`https://fkn.app`,f=typeof globalThis<`u`&&globalThis.document?globalThis.document:void 0,p=f?.querySelector(`iframe[src="${ae}/api"]`)??null,m=f?.createElement(`iframe`)??null;!p&&m&&f&&(m.src=`${ae}/api`,f.body.appendChild(m));var h=p??m,oe=h?.contentWindow??null;h&&f&&re(h);var se=(()=>{if(typeof window<`u`)return oe?{receive:window,emit:oe}:void 0;if(typeof self<`u`)return{receive:self,emit:self}})(),g=se?(0,t.expose)({},{key:`fkn-api`,transport:se}):new Promise(()=>{});g.then(e=>{ne()&&e.setOverlayHost(ie)},()=>{});var ce=(e,t)=>g.then(n=>n.proxyFetch(e,t)),le=`https://fkn.app`,ue=(e,n)=>{if(typeof window>`u`)throw Error(`FKN @fkn/lib: relayWorker must be called from the main thread`);if(!h?.contentWindow)throw Error(`FKN @fkn/lib: relayWorker called before the FKN iframe was injected`);(0,t.relay)({receive:window,emit:h.contentWindow},e,{key:`fkn-api`,originA:n?.originA??le,originB:n?.originB??`*`,unregisterSignal:n?.unregisterSignal})},de=`FKN_WEB_EXTENSION_MAIN_WORLD_CONTENT_SCRIPT_ENABLED_EVENT_KEY`,fe=`fknExtension`,_=(0,t.createTypedEventTarget)();typeof document<`u`&&document.addEventListener(de,e=>{_.dispatchEvent(new CustomEvent(`statuschange`,{detail:{enabled:e.detail.enabled}}))});var v=()=>document.documentElement.dataset[fe]===`true`,y=null,pe=e=>{y=e},me=150,b=(e=1e3)=>new Promise((t,n)=>{if(v())return t();let r,i=e=>{clearTimeout(r),s.disconnect(),document.removeEventListener(`readystatechange`,c),e()},a=()=>i(async()=>{if(y&&(await y().catch(()=>{}),v()))return t();n(Error(`The FKN WebExtension is not installed, enabled or not exposed on this page.`))}),o=()=>{clearTimeout(r),r=setTimeout(()=>v()?i(t):a(),me)},s=new MutationObserver(()=>{v()&&i(t)}),c=()=>{document.readyState===`complete`&&!v()&&o()};if(r=setTimeout(a,e),s.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-fkn-extension`]}),document.addEventListener(`readystatechange`,c),document.readyState===`complete`)return o();v()&&i(t)}),x,S=new Proxy({},{get:(n,r)=>async(...n)=>{await b(),x??=(0,t.expose)({},{transport:window,revivableModules:e.l});let i=(await x)[r];return i(...n)}}),he={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.`},ge={scope:`network.fetchCredentialed`,category:`network`,severity:3,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.`},_e=[`origin`,`referer`],ve=e=>{if(!e?.headers)return;let t=new Headers(e.headers),n=_e.map(e=>{let n=t.get(e);return n===null?void 0:[e,n]}).filter(e=>e!==void 0);return n.length?n:void 0},ye=async(e,t)=>{let n=new Request(e,t),r=n.body?await n.arrayBuffer():null;return S.proxyFetch({url:n.url,method:n.method,headers:[...n.headers],body:r,credentials:t?.credentials===`include`?`include`:`omit`,redirect:n.redirect,unsafeHeaders:ve(t),reason:t?.reason,signal:t?.signal??void 0})},be={scope:`network.readCookie`,category:`network`,severity:3,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.`},xe={get:e=>S.getCookie(e)},Se={scope:`network.modifyRequestHeaders`,category:`network`,severity:2,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.`},Ce=e=>S.setRequestHeaderRule(e),we=e=>S.removeRequestHeaderRule({ruleId:e});(()=>{let t={},n=[...e.t.selectorModules,...e.i.selectorModules];for(let e of n)e.render&&!(e.type in t)&&(t[e.type]=e.render);return t})();var C=`FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY`,w=e=>{if(!e||e===`about:blank`)return!1;let t;try{t=new URL(e,location.href)}catch{return!1}if(t.protocol===`chrome-extension:`||t.protocol===`moz-extension:`)return!0;if(t.protocol===`about:`)return!1;let n=t.hostname;return n===`fkn.app`||n.endsWith(`.fkn.app`)},T=e=>{if(w(e))throw Error(`attachFrame: refusing to target the extension's own pages or fkn.app`)},Te={scope:`embed.iframe`,category:`embed`,severity:0,title:`Load another website inside this app`,description:`Lets the app embed external pages directly inside its own view.`},Ee={scope:`embed.open`,category:`embed`,severity:0,title:`Open a website inside this app`,description:`Lets the app navigate to another site without leaving its window.`},De=async({iframe:t,domains:n=[]})=>{let r=crypto.randomUUID();if(T(t.src),await b(),!t.isConnected)throw Error(`attachFrame: the iframe must be connected to the document before attaching`);t.dispatchEvent(new CustomEvent(C,{detail:r}));let{executeLocator:i,ensureLocatorPermission:a,goto:o}=await S.attachFrame({marker:r,domains:n}),s=e.r(i,a),c=(e,t={})=>(T(e),o({url:e,...t})),l=()=>t.src;return{...s,goto:c,url:l}},Oe={request:e=>S.requestPermissions(e.map(e=>({key:e.key,scope:e.scope??``,reason:e.reason})))},E=async e=>{if(typeof window>`u`)return!1;if(v())return!0;let t=await g,n=null,r=new Promise(e=>{n=()=>{v()&&e(!0)},_.addEventListener(`statuschange`,n)}),i=t.showInstallPrompt(e).then(()=>!1),a=await Promise.race([r,i]);return n&&_.removeEventListener(`statuschange`,n),await t.hideInstallPrompt().catch(()=>{}),a},D=null;pe(()=>(D||=E().then(()=>void 0).finally(()=>{D=null}),D));var ke=new TextEncoder;new TextDecoder;var O=e=>i.Address4.isValid(e),k=e=>i.Address6.isValid(e),Ae=e=>O(e)?4:k(e)?6:0,je=(...e)=>{if(typeof e[0]==`string`)throw Error(`FKN WebVPN does not support IPC connections`);let t=typeof e.at(-1)==`function`?e.at(-1):void 0;return e[0]&&typeof e[0]==`object`?{...e[0],callback:t}:{port:e[0]??0,host:typeof e[1]==`string`?e[1]:void 0,callback:t}},Me=(...e)=>{let t=typeof e.at(-1)==`function`?e.at(-1):void 0,n=e[0]??0,r=typeof e[1]==`string`?e[1]:void 0;return typeof e[0]==`object`?{...e[0],address:e[0].address??r,port:e[0].port??n,callback:t}:{address:r,port:n,callback:t}},Ne=(...e)=>{let t=typeof e.at(-1)==`function`?e.at(-1):void 0,n=e[0];if(typeof e[2]==`number`)return{message:n,offset:e[1],length:e[2],port:typeof e[3]==`number`?e[3]:0,address:typeof e[4]==`string`?e[4]:void 0,callback:t};{let r=typeof e[1]==`number`?e[1]:0,i=typeof e[2]==`string`?e[2]:void 0;return{message:n,offset:0,length:n.length,port:r,address:i,callback:t}}};new TextEncoder,new TextDecoder;var Pe=e.g({Server:()=>j,Socket:()=>A,_default:()=>P,connect:()=>Fe,createConnection:()=>M,createServer:()=>N,default:()=>P,isIP:()=>Ae,isIPv4:()=>O,isIPv6:()=>k}),A=class extends n.Stream.Duplex{_localAddress;_remoteAddress;_webVPNTcpSocketPromise;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)}__webvpn_tcp_socket_init__(e){if(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},{...e,reader:t,writer:n}}).catch(e=>{this.emit(`error`,e)}),!this._webVPNTcpSocketPromise)throw Error(`Socket not connected`);return this._webVPNTcpSocketPromise.then(e=>{e&&this.emit(`connect`)}),this._webVPNTcpSocketPromise}_read(e){if(!this._webVPNTcpSocketPromise)throw Error(`Socket not connected`);this._webVPNTcpSocketPromise.then(e=>{if(!e){this.push(null);return}e.reader.read().then(({value:e,done:t})=>{if(t){this.push(null);return}this._restartTimeoutTimer(),this.push(e)}).catch(e=>{this.destroy(e)})})}_write(e,t,n){if(!this._webVPNTcpSocketPromise){n(Error(`Socket not connected`));return}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)}connect(...e){let t=je(...e),n=this.__webvpn_tcp_socket_init__(g.then(e=>e.webVpnTcpSocket({remoteAddress:t.host??`localhost`,remotePort:t.port})));return t.callback&&n.then(e=>{e&&t.callback.call(this)}),this}_end(...e){return this._webVPNTcpSocketPromise?(e.length!==0&&this.write(e[0],e[1],e[2]),this._webVPNTcpSocketPromise.then(async e=>{e&&await e.end()}),this):this}_destroy(e){return this._timeoutTimer&&clearTimeout(this._timeoutTimer),this._webVPNTcpSocketPromise&&this._webVPNTcpSocketPromise.then(async e=>{e&&await e.destroy()}),this}destroySoon(){this._webVPNTcpSocketPromise&&this._webVPNTcpSocketPromise.then(async e=>{e&&await e.destroySoon()})}resetAndDestroy(){return this._webVPNTcpSocketPromise&&this._webVPNTcpSocketPromise.then(async e=>{e&&await e.resetAndDestroy()}),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){if(!this._webVPNTcpSocketPromise){this.emit(`error`,Error(`Cannot set socket option before connect`));return}this._webVPNTcpSocketPromise.then(async t=>{if(t)try{await t.setOption(e)}catch(e){this.emit(`error`,e)}})}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},j=class extends r.EventEmitter{_localAddress;_webVPNTcpSocketListenerPromise;constructor(e,t){super(e),t&&this.on(`connection`,t),e?.connection&&this.__webvpn_tcp_socket_listener_init__(e.connection)}__webvpn_tcp_socket_listener_init__(e){return this._webVPNTcpSocketListenerPromise=e.then(e=>(this._localAddress={address:e.localAddress,family:e.localFamily,port:e.localPort},e)).catch(e=>{this.emit(`error`,e)}),this._webVPNTcpSocketListenerPromise.then(e=>{e&&this.emit(`listening`)}),this._webVPNTcpSocketListenerPromise}listen(...e){let t=je(...e),n=e=>{let t=new A({connection:Promise.resolve(e)});this.emit(`connection`,t)},r=e=>g.then(r=>r.webVpnTcpSocketListener({localAddress:e,localPort:t.port,onConnection:n})),i=t.host?r(t.host):r(`::`).catch(()=>r(`0.0.0.0`)),a=this.__webvpn_tcp_socket_listener_init__(i);return t.callback&&a.then(e=>{e&&t.callback.call(this)}),this}close(e){return this._webVPNTcpSocketListenerPromise&&this._webVPNTcpSocketListenerPromise.then(async t=>{if(t)try{await t.close(),this._localAddress=void 0,this.emit(`close`),e&&e()}catch(t){this._localAddress=void 0,this.emit(`close`),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](){}},Fe=(e,t)=>new A().connect(e,t),M=(e,t)=>new A().connect(e,t),N=(e,t)=>{typeof e==`function`&&(t=e,e=void 0);let n=new j(e);return t&&n.on(`connection`,t),n},P={Socket:A,Server:j,connect:Fe,createConnection:M,createServer:N,isIP:Ae,isIPv4:O,isIPv6:k},Ie=e.g({Socket:()=>F,createSocket:()=>Le}),F=class extends r.EventEmitter{_type;_localAddress;_remoteAddress;_webVPNUdpSocketPromise;constructor(e){if(super(e),!e)throw Error(`Missing options`);this._type=e.type}_lastRecvBufferSize=0;_lastSendBufferSize=0;_lastTtl=64;_lastMulticastTtl=1;_lastMulticastLoopback=!0;_setUdpOption(e){if(!this._webVPNUdpSocketPromise){this.emit(`error`,Error(`Cannot set socket option before bind`));return}this._webVPNUdpSocketPromise.then(async t=>{if(t)try{await t.setOption(e)}catch(e){this.emit(`error`,e)}})}addMembership(e,t){if(i.Address4.isValid(e)){let n=I(e),r=t&&i.Address4.isValid(t)?I(t):new Uint8Array([0,0,0,0]);this._setUdpOption({type:5,group:n,interface:r})}else if(i.Address6.isValid(e)){let t=L(e);this._setUdpOption({type:7,group:t,ifIndex:0})}else this.emit(`error`,Error(`Invalid multicast address: ${e}`))}address(){if(!this._localAddress)throw Error(`EBADF`);return this._localAddress}bind(...e){let t=Me(...e),n=this._type===`udp6`?`::`:`0.0.0.0`;return this._webVPNUdpSocketPromise=g.then(e=>e.webVpnUdpSocket({type:this._type,address:t.address??n,port:t.port})).then(e=>{let t=e.dataReadableStream.getReader(),n=async()=>{let{value:e,done:r}=await t.read();r||(this.emit(`message`,a.Buffer.from(e.data),{address:e.address,family:e.family,port:e.port,size:e.size}),n())};return n(),this._localAddress={address:e.localAddress,family:e.localFamily,port:e.localPort},e}).catch(e=>{this.emit(`error`,e)}),this._webVPNUdpSocketPromise.then(e=>{e&&this.emit(`listening`)}),t.callback&&this._webVPNUdpSocketPromise.then(e=>{e&&t.callback()}),this}close(e){if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);return this._webVPNUdpSocketPromise.then(async t=>{if(!t)throw Error(`Socket not bound`);await t.close(),e&&e(),this.emit(`close`)}),this}connect(...e){if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);this._webVPNUdpSocketPromise.then(async t=>{if(!t)throw Error(`Socket not bound`);let n=e[0],r=this._type===`udp6`?`::1`:`127.0.0.1`,i=typeof e[1]==`string`?e[1]:r,a=typeof e.at(-1)==`function`?e.at(-1):void 0;await t.connect({remotePort:n,remoteAddress:i}),this._remoteAddress={address:i,family:this._type===`udp6`?`IPv6`:`IPv4`,port:n},a&&a()})}disconnect(){if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);this._webVPNUdpSocketPromise.then(async e=>{if(!e)throw Error(`Socket not bound`);await e.connect({remotePort:0,remoteAddress:this._type===`udp4`?`0.0.0.0`:`::`})})}dropMembership(e,t){if(i.Address4.isValid(e)){let n=I(e),r=t&&i.Address4.isValid(t)?I(t):new Uint8Array([0,0,0,0]);this._setUdpOption({type:6,group:n,interface:r})}else if(i.Address6.isValid(e)){let t=L(e);this._setUdpOption({type:8,group:t,ifIndex:0})}else this.emit(`error`,Error(`Invalid multicast address: ${e}`))}getRecvBufferSize(){return this._lastRecvBufferSize}getSendBufferSize(){return this._lastSendBufferSize}getSendQueueSize(){return 0}getSendQueueCount(){return 0}ref(){return this}remoteAddress(){if(!this._remoteAddress)throw Error(`ERR_SOCKET_DGRAM_NOT_CONNECTED`);return{address:this._remoteAddress.address,family:this._remoteAddress.family,port:this._remoteAddress.port}}send(...e){this._webVPNUdpSocketPromise||this.bind();let t=Ne(...e),n=this._type===`udp6`?`::1`:`127.0.0.1`;if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);this._webVPNUdpSocketPromise.then(e=>{if(!e)throw Error(`Socket not bound`);let r=typeof t.message==`string`?ke.encode(t.message):t.message;e.send({...t,address:t.address??n,message:r.buffer})})}setBroadcast(e){this._setUdpOption({type:0,value:e})}setMulticastInterface(e){}setMulticastLoopback(e){return this._setUdpOption({type:3,value:e}),this._setUdpOption({type:4,value:e}),this._lastMulticastLoopback=e,e}setMulticastTTL(e){return this._setUdpOption({type:2,value:e}),this._lastMulticastTtl=e,e}setRecvBufferSize(e){this._setUdpOption({type:10,value:e}),this._lastRecvBufferSize=e}setSendBufferSize(e){this._setUdpOption({type:9,value:e}),this._lastSendBufferSize=e}setTTL(e){return this._setUdpOption({type:1,value:e}),this._lastTtl=e,e}unref(){return this}addSourceSpecificMembership(e,t,n){}dropSourceSpecificMembership(e,t,n){}async[Symbol.asyncDispose](){await new Promise(e=>{this.close(e)})}},I=e=>{let t=e.split(`.`).map(e=>parseInt(e,10));if(t.length!==4||t.some(e=>Number.isNaN(e)||e<0||e>255))throw Error(`Invalid IPv4 address: ${e}`);return new Uint8Array(t)},L=e=>{let t=new i.Address6(e).getBitsBase16(0,128).match(/.{2}/g);if(!t||t.length!==16)throw Error(`Invalid IPv6 address: ${e}`);return new Uint8Array(t.map(e=>parseInt(e,16)))},Le=(e,t)=>{let n=new F(typeof e==`string`?{type:e}:e);return t&&n.on(`message`,t),n},Re=e.g({Agent:()=>Q,ClientRequest:()=>X,HTTPParser:()=>G,IncomingMessage:()=>q,METHODS:()=>z,STATUS_CODES:()=>B,Server:()=>Z,ServerResponse:()=>Y,_default:()=>qe,createServer:()=>Ke,default:()=>qe,get:()=>Ge,globalAgent:()=>We,request:()=>$}),R=new TextDecoder(`latin1`),z=`ACL.BIND.CHECKOUT.CONNECT.COPY.DELETE.GET.HEAD.LINK.LOCK.M-SEARCH.MERGE.MKACTIVITY.MKCALENDAR.MKCOL.MOVE.NOTIFY.OPTIONS.PATCH.POST.PROPFIND.PROPPATCH.PURGE.PUT.REBIND.REPORT.SEARCH.SOURCE.SUBSCRIBE.TRACE.UNBIND.UNLINK.UNLOCK.UNSUBSCRIBE`.split(`.`),B={100:`Continue`,101:`Switching Protocols`,102:`Processing`,103:`Early Hints`,200:`OK`,201:`Created`,202:`Accepted`,203:`Non-Authoritative Information`,204:`No Content`,205:`Reset Content`,206:`Partial Content`,207:`Multi-Status`,208:`Already Reported`,226:`IM Used`,300:`Multiple Choices`,301:`Moved Permanently`,302:`Found`,303:`See Other`,304:`Not Modified`,305:`Use Proxy`,307:`Temporary Redirect`,308:`Permanent Redirect`,400:`Bad Request`,401:`Unauthorized`,402:`Payment Required`,403:`Forbidden`,404:`Not Found`,405:`Method Not Allowed`,406:`Not Acceptable`,407:`Proxy Authentication Required`,408:`Request Timeout`,409:`Conflict`,410:`Gone`,411:`Length Required`,412:`Precondition Failed`,413:`Payload Too Large`,414:`URI Too Long`,415:`Unsupported Media Type`,416:`Range Not Satisfiable`,417:`Expectation Failed`,418:`I'm a Teapot`,421:`Misdirected Request`,422:`Unprocessable Entity`,423:`Locked`,424:`Failed Dependency`,425:`Too Early`,426:`Upgrade Required`,428:`Precondition Required`,429:`Too Many Requests`,431:`Request Header Fields Too Large`,451:`Unavailable For Legal Reasons`,500:`Internal Server Error`,501:`Not Implemented`,502:`Bad Gateway`,503:`Service Unavailable`,504:`Gateway Timeout`,505:`HTTP Version Not Supported`,506:`Variant Also Negotiates`,507:`Insufficient Storage`,508:`Loop Detected`,509:`Bandwidth Limit Exceeded`,510:`Not Extended`,511:`Network Authentication Required`},ze=new Set([`content-type`,`content-length`,`user-agent`,`referer`,`host`,`authorization`,`proxy-authorization`,`if-modified-since`,`if-unmodified-since`,`from`,`location`,`max-forwards`,`retry-after`,`etag`,`last-modified`,`server`,`age`,`expires`]),V=13,H=10,Be=/^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/,U=(e,t)=>(e.code=t,e),Ve=(e,t)=>{if(e.length===0)return t;if(t.length===0)return e;let n=new Uint8Array(e.length+t.length);return n.set(e,0),n.set(t,e.length),n},W=(e,t)=>{for(let n=t;n+1<e.length;n++)if(e[n]===V&&e[n+1]===H)return n;return-1},He=e=>{for(let t=0;t+3<e.length;t++)if(e[t]===V&&e[t+1]===H&&e[t+2]===V&&e[t+3]===H)return t;return-1},G=class{buf=new Uint8Array;state=`HEAD`;framing=`none`;bodyRemaining=0;chunkState=`size`;skipBody=!1;constructor(e,t){this.mode=e,this.handlers=t}execute(e){this.buf=Ve(this.buf,e);let t=!0;for(;t;)if(t=!1,this.state===`HEAD`){let e=He(this.buf);if(e===-1)return;let n=this.buf.subarray(0,e);this.buf=this.buf.subarray(e+4);let r=this.parseHead(n);this.handlers.onHeaders(r),this.setupBody(r),this.framing===`none`?(this.handlers.onComplete(),this.reset(),t=this.buf.length>0):(this.state=`BODY`,t=!0)}else this.consumeBody()&&(this.handlers.onComplete(),this.reset(),t=this.buf.length>0)}finish(){this.state===`BODY`&&this.framing===`eof`&&(this.handlers.onComplete(),this.reset())}reset(){this.state=`HEAD`,this.framing=`none`,this.bodyRemaining=0,this.chunkState=`size`,this.skipBody=!1}parseHead(e){let t=R.decode(e).split(`\r
|
|
2
|
-
`),n=t.shift()??``,r=[];for(let e of t)(e.startsWith(` `)||e.startsWith(` `))&&r.length>0?r[r.length-1]+=` `+e.trim():r.push(e);let i=[],a={};for(let e of r){if(!e)continue;let t=e.indexOf(`:`);if(t===-1)continue;let n=e.slice(0,t).trim(),r=e.slice(t+1).trim();i.push(n,r),this.addHeader(a,n,r)}let o={httpVersionMajor:1,httpVersionMinor:1,httpVersion:`1.1`,headers:a,rawHeaders:i};if(this.mode===`request`){let[e,t,r]=n.split(` `);o.method=(e??`GET`).toUpperCase(),o.url=t??`/`,this.applyVersion(o,r)}else{let e=n.indexOf(` `),t=n.slice(0,e),r=n.slice(e+1),i=r.indexOf(` `),a=i===-1?r:r.slice(0,i);o.statusCode=parseInt(a,10)||0,o.statusMessage=i===-1?``:r.slice(i+1),this.applyVersion(o,t)}return o}applyVersion(e,t){let n=/HTTP\/(\d)\.(\d)/i.exec(t??``);n&&(e.httpVersionMajor=parseInt(n[1],10),e.httpVersionMinor=parseInt(n[2],10),e.httpVersion=`${e.httpVersionMajor}.${e.httpVersionMinor}`)}addHeader(e,t,n){let r=t.toLowerCase();if(r===`set-cookie`){let t=e[`set-cookie`];Array.isArray(t)?t.push(n):e[`set-cookie`]=[n];return}let i=e[r];i===void 0?e[r]=n:
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./locator-jHaMLjtv.cjs`);let t=require(`osra`),n=require(`stream`),r=require(`events`),i=require(`ip-address`),a=require(`buffer`);var o=32,s=typeof CSS<`u`&&CSS.supports(`clip-path`,`path('M0 0H1V1H0Z')`),c=e=>{let t=e.style;t.setProperty(`display`,`block`,`important`),t.setProperty(`position`,`fixed`,`important`),t.setProperty(`top`,`0`,`important`),t.setProperty(`left`,`0`,`important`),t.setProperty(`width`,`100%`,`important`),t.setProperty(`height`,`100%`,`important`),t.setProperty(`border`,`none`,`important`),t.setProperty(`clip-path`,`inset(100%)`,`important`),t.setProperty(`background`,`transparent`),t.setProperty(`color-scheme`,`normal`),t.setProperty(`z-index`,`2147483647`),e.setAttribute(`title`,`FKN`)},l=({x:e,y:t,width:n,height:r})=>`M${e} ${t}h${n}v${r}h${-n}Z`,u=(e,{modal:t,rects:n})=>{if(!s){let r=t||n.length>0;e.style.setProperty(`pointer-events`,r?`auto`:`none`,`important`),e.style.setProperty(`visibility`,r?`visible`:`hidden`,`important`);return}let r=t?`none`:n.length===0?`inset(100%)`:`path('${n.map(l).join(``)}')`,i=r===`none`||CSS.supports(`clip-path`,r)?r:`inset(100%)`;e.style.setProperty(`clip-path`,i,`important`)},ee=e=>{if(typeof e!=`object`||!e)return null;let{x:t,y:n,width:r,height:i}=e;if(![t,n,r,i].every(e=>typeof e==`number`&&Number.isFinite(e)))return null;let a=window.innerWidth,o=window.innerHeight,s=Math.max(0,Math.min(Math.round(t),a)),c=Math.max(0,Math.min(Math.round(n),o)),l=Math.max(s,Math.min(Math.round(t+r),a)),u=Math.max(c,Math.min(Math.round(n+i),o));return{x:s,y:c,width:l-s,height:u-c}},te=e=>{if(typeof e!=`object`||!e)return null;let t=e,n=(Array.isArray(t.rects)?t.rects.slice(0,o):[]).map(ee).filter(e=>e!==null&&e.width>0&&e.height>0);return{modal:t.modal===!0,rects:n}},d=null,ne=()=>d!==null,re=e=>{c(e),u(e,{modal:!1,rects:[]}),d=e},ie=e=>{if(!d)return;let t=te(e);t&&u(d,t)},ae=`https://fkn.app`,f=typeof globalThis<`u`&&globalThis.document?globalThis.document:void 0,oe=f?.querySelector(`iframe[src="${ae}/api"]`)??null,p=f?.createElement(`iframe`)??null;!oe&&p&&f&&(p.src=`${ae}/api`,f.body.appendChild(p));var m=oe??p,h=m?.contentWindow??null;m&&f&&re(m);var g=(()=>{if(typeof window<`u`)return h?{receive:window,emit:h}:void 0;if(typeof self<`u`)return{receive:self,emit:self}})(),_=g?(0,t.expose)({},{key:`fkn-api`,transport:g}):new Promise(()=>{});_.then(e=>{ne()&&e.setOverlayHost(ie)},()=>{});var se=(e,t)=>_.then(n=>n.proxyFetch(e,t)),ce=`https://fkn.app`,le=(e,n)=>{if(typeof window>`u`)throw Error(`FKN @fkn/lib: relayWorker must be called from the main thread`);if(!m?.contentWindow)throw Error(`FKN @fkn/lib: relayWorker called before the FKN iframe was injected`);(0,t.relay)({receive:window,emit:m.contentWindow},e,{key:`fkn-api`,originA:n?.originA??ce,originB:n?.originB??`*`,unregisterSignal:n?.unregisterSignal})},ue=`FKN_WEB_EXTENSION_MAIN_WORLD_CONTENT_SCRIPT_ENABLED_EVENT_KEY`,de=`fknExtension`,v=(0,t.createTypedEventTarget)();typeof document<`u`&&document.addEventListener(ue,e=>{v.dispatchEvent(new CustomEvent(`statuschange`,{detail:{enabled:e.detail.enabled}}))});var y=()=>document.documentElement.dataset[de]===`true`,b=null,fe=e=>{b=e},pe=150,x=(e=1e3)=>new Promise((t,n)=>{if(y())return t();let r,i=e=>{clearTimeout(r),s.disconnect(),document.removeEventListener(`readystatechange`,c),e()},a=()=>i(async()=>{if(b&&(await b().catch(()=>{}),y()))return t();n(Error(`The FKN WebExtension is not installed, enabled or not exposed on this page.`))}),o=()=>{clearTimeout(r),r=setTimeout(()=>y()?i(t):a(),pe)},s=new MutationObserver(()=>{y()&&i(t)}),c=()=>{document.readyState===`complete`&&!y()&&o()};if(r=setTimeout(a,e),s.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-fkn-extension`]}),document.addEventListener(`readystatechange`,c),document.readyState===`complete`)return o();y()&&i(t)}),me,S=new Proxy({},{get:(n,r)=>async(...n)=>{await x(),me??=(0,t.expose)({},{transport:window,revivableModules:e.l});let i=(await me)[r];return i(...n)}}),he={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.`},ge={scope:`network.fetchCredentialed`,category:`network`,severity:3,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.`},_e=[`origin`,`referer`],ve=e=>{if(!e?.headers)return;let t=new Headers(e.headers),n=_e.map(e=>{let n=t.get(e);return n===null?void 0:[e,n]}).filter(e=>e!==void 0);return n.length?n:void 0},ye=async(e,t)=>{let n=new Request(e,t),r=n.body?await n.arrayBuffer():null;return S.proxyFetch({url:n.url,method:n.method,headers:[...n.headers],body:r,credentials:t?.credentials===`include`?`include`:`omit`,redirect:n.redirect,unsafeHeaders:ve(t),reason:t?.reason,signal:t?.signal??void 0})},be={scope:`network.readCookie`,category:`network`,severity:3,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.`},xe={get:e=>S.getCookie(e)},Se={scope:`network.modifyRequestHeaders`,category:`network`,severity:2,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.`},Ce=e=>S.setRequestHeaderRule(e),we=e=>S.removeRequestHeaderRule({ruleId:e});(()=>{let t={},n=[...e.t.selectorModules,...e.i.selectorModules];for(let e of n)e.render&&!(e.type in t)&&(t[e.type]=e.render);return t})();var C=`FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY`,w=e=>{if(!e||e===`about:blank`)return!1;let t;try{t=new URL(e,location.href)}catch{return!1}if(t.protocol===`chrome-extension:`||t.protocol===`moz-extension:`)return!0;if(t.protocol===`about:`)return!1;let n=t.hostname;return n===`fkn.app`||n.endsWith(`.fkn.app`)},T=e=>{if(w(e))throw Error(`attachFrame: refusing to target the extension's own pages or fkn.app`)},Te={scope:`embed.iframe`,category:`embed`,severity:0,title:`Load another website inside this app`,description:`Lets the app embed external pages directly inside its own view.`},Ee={scope:`embed.open`,category:`embed`,severity:0,title:`Open a website inside this app`,description:`Lets the app navigate to another site without leaving its window.`},De=async({iframe:t,domains:n=[]})=>{let r=crypto.randomUUID();if(T(t.src),await x(),!t.isConnected)throw Error(`attachFrame: the iframe must be connected to the document before attaching`);t.dispatchEvent(new CustomEvent(C,{detail:r}));let{executeLocator:i,ensureLocatorPermission:a,goto:o}=await S.attachFrame({marker:r,domains:n}),s=e.r(i,a),c=(e,t={})=>(T(e),o({url:e,...t})),l=()=>t.src;return{...s,goto:c,url:l}},Oe={request:e=>S.requestPermissions(e.map(e=>({key:e.key,scope:e.scope??``,reason:e.reason})))},E=async e=>{if(typeof window>`u`)return!1;if(y())return!0;let t=await _,n=null,r=new Promise(e=>{n=()=>{y()&&e(!0)},v.addEventListener(`statuschange`,n)}),i=t.showInstallPrompt(e).then(()=>!1),a=await Promise.race([r,i]);return n&&v.removeEventListener(`statuschange`,n),await t.hideInstallPrompt().catch(()=>{}),a},D=null;fe(()=>(D||=E().then(()=>void 0).finally(()=>{D=null}),D));var ke=e.g({ensureDirectoryPermission:()=>je,isLocalDirectorySupported:()=>O,pickLocalDirectory:()=>Ae,queryDirectoryPermission:()=>k}),O=()=>typeof window<`u`&&`showDirectoryPicker`in window,Ae=async(e={})=>{if(!O())return;let t=window.showDirectoryPicker;return t({mode:`readwrite`,...e}).catch(e=>{if(e?.name!==`AbortError`)throw e})},k=async(e,t=`readwrite`)=>{let{queryPermission:n}=e;return await n?.call(e,{mode:t})??`granted`},je=async(e,t=`readwrite`)=>{if(await k(e,t)===`granted`)return!0;let{requestPermission:n}=e;return await n?.call(e,{mode:t})===`granted`},Me=new TextEncoder;new TextDecoder;var A=e=>i.Address4.isValid(e),j=e=>i.Address6.isValid(e),M=e=>A(e)?4:j(e)?6:0,N=(...e)=>{if(typeof e[0]==`string`)throw Error(`FKN WebVPN does not support IPC connections`);let t=typeof e.at(-1)==`function`?e.at(-1):void 0;return e[0]&&typeof e[0]==`object`?{...e[0],callback:t}:{port:e[0]??0,host:typeof e[1]==`string`?e[1]:void 0,callback:t}},Ne=(...e)=>{let t=typeof e.at(-1)==`function`?e.at(-1):void 0,n=e[0]??0,r=typeof e[1]==`string`?e[1]:void 0;return typeof e[0]==`object`?{...e[0],address:e[0].address??r,port:e[0].port??n,callback:t}:{address:r,port:n,callback:t}},Pe=(...e)=>{let t=typeof e.at(-1)==`function`?e.at(-1):void 0,n=e[0];if(typeof e[2]==`number`)return{message:n,offset:e[1],length:e[2],port:typeof e[3]==`number`?e[3]:0,address:typeof e[4]==`string`?e[4]:void 0,callback:t};{let r=typeof e[1]==`number`?e[1]:0,i=typeof e[2]==`string`?e[2]:void 0;return{message:n,offset:0,length:n.length,port:r,address:i,callback:t}}};new TextEncoder,new TextDecoder;var Fe=e.g({Server:()=>F,Socket:()=>P,_default:()=>R,connect:()=>I,createConnection:()=>Ie,createServer:()=>L,default:()=>R,isIP:()=>M,isIPv4:()=>A,isIPv6:()=>j}),P=class extends n.Stream.Duplex{_localAddress;_remoteAddress;_webVPNTcpSocketPromise;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)}__webvpn_tcp_socket_init__(e){if(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},{...e,reader:t,writer:n}}).catch(e=>{this.emit(`error`,e)}),!this._webVPNTcpSocketPromise)throw Error(`Socket not connected`);return this._webVPNTcpSocketPromise.then(e=>{e&&this.emit(`connect`)}),this._webVPNTcpSocketPromise}_read(e){if(!this._webVPNTcpSocketPromise)throw Error(`Socket not connected`);this._webVPNTcpSocketPromise.then(e=>{if(!e){this.push(null);return}e.reader.read().then(({value:e,done:t})=>{if(t){this.push(null);return}this._restartTimeoutTimer(),this.push(e)}).catch(e=>{this.destroy(e)})})}_write(e,t,n){if(!this._webVPNTcpSocketPromise){n(Error(`Socket not connected`));return}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)}connect(...e){let t=N(...e),n=this.__webvpn_tcp_socket_init__(_.then(e=>e.webVpnTcpSocket({remoteAddress:t.host??`localhost`,remotePort:t.port})));return t.callback&&n.then(e=>{e&&t.callback.call(this)}),this}_end(...e){return this._webVPNTcpSocketPromise?(e.length!==0&&this.write(e[0],e[1],e[2]),this._webVPNTcpSocketPromise.then(async e=>{e&&await e.end()}),this):this}_destroy(e){return this._timeoutTimer&&clearTimeout(this._timeoutTimer),this._webVPNTcpSocketPromise&&this._webVPNTcpSocketPromise.then(async e=>{e&&await e.destroy()}),this}destroySoon(){this._webVPNTcpSocketPromise&&this._webVPNTcpSocketPromise.then(async e=>{e&&await e.destroySoon()})}resetAndDestroy(){return this._webVPNTcpSocketPromise&&this._webVPNTcpSocketPromise.then(async e=>{e&&await e.resetAndDestroy()}),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){if(!this._webVPNTcpSocketPromise){this.emit(`error`,Error(`Cannot set socket option before connect`));return}this._webVPNTcpSocketPromise.then(async t=>{if(t)try{await t.setOption(e)}catch(e){this.emit(`error`,e)}})}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},F=class extends r.EventEmitter{_localAddress;_webVPNTcpSocketListenerPromise;constructor(e,t){super(e),t&&this.on(`connection`,t),e?.connection&&this.__webvpn_tcp_socket_listener_init__(e.connection)}__webvpn_tcp_socket_listener_init__(e){return this._webVPNTcpSocketListenerPromise=e.then(e=>(this._localAddress={address:e.localAddress,family:e.localFamily,port:e.localPort},e)).catch(e=>{this.emit(`error`,e)}),this._webVPNTcpSocketListenerPromise.then(e=>{e&&this.emit(`listening`)}),this._webVPNTcpSocketListenerPromise}listen(...e){let t=N(...e),n=e=>{let t=new P({connection:Promise.resolve(e)});this.emit(`connection`,t)},r=e=>_.then(r=>r.webVpnTcpSocketListener({localAddress:e,localPort:t.port,onConnection:n})),i=t.host?r(t.host):r(`::`).catch(()=>r(`0.0.0.0`)),a=this.__webvpn_tcp_socket_listener_init__(i);return t.callback&&a.then(e=>{e&&t.callback.call(this)}),this}close(e){return this._webVPNTcpSocketListenerPromise&&this._webVPNTcpSocketListenerPromise.then(async t=>{if(t)try{await t.close(),this._localAddress=void 0,this.emit(`close`),e&&e()}catch(t){this._localAddress=void 0,this.emit(`close`),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](){}},I=(e,t)=>new P().connect(e,t),Ie=(e,t)=>new P().connect(e,t),L=(e,t)=>{typeof e==`function`&&(t=e,e=void 0);let n=new F(e);return t&&n.on(`connection`,t),n},R={Socket:P,Server:F,connect:I,createConnection:Ie,createServer:L,isIP:M,isIPv4:A,isIPv6:j},Le=e.g({Socket:()=>Re,createSocket:()=>Be}),Re=class extends r.EventEmitter{_type;_localAddress;_remoteAddress;_webVPNUdpSocketPromise;constructor(e){if(super(e),!e)throw Error(`Missing options`);this._type=e.type}_lastRecvBufferSize=0;_lastSendBufferSize=0;_lastTtl=64;_lastMulticastTtl=1;_lastMulticastLoopback=!0;_setUdpOption(e){if(!this._webVPNUdpSocketPromise){this.emit(`error`,Error(`Cannot set socket option before bind`));return}this._webVPNUdpSocketPromise.then(async t=>{if(t)try{await t.setOption(e)}catch(e){this.emit(`error`,e)}})}addMembership(e,t){if(i.Address4.isValid(e)){let n=z(e),r=t&&i.Address4.isValid(t)?z(t):new Uint8Array([0,0,0,0]);this._setUdpOption({type:5,group:n,interface:r})}else if(i.Address6.isValid(e)){let t=ze(e);this._setUdpOption({type:7,group:t,ifIndex:0})}else this.emit(`error`,Error(`Invalid multicast address: ${e}`))}address(){if(!this._localAddress)throw Error(`EBADF`);return this._localAddress}bind(...e){let t=Ne(...e),n=this._type===`udp6`?`::`:`0.0.0.0`;return this._webVPNUdpSocketPromise=_.then(e=>e.webVpnUdpSocket({type:this._type,address:t.address??n,port:t.port})).then(e=>{let t=e.dataReadableStream.getReader(),n=async()=>{let{value:e,done:r}=await t.read();r||(this.emit(`message`,a.Buffer.from(e.data),{address:e.address,family:e.family,port:e.port,size:e.size}),n())};return n(),this._localAddress={address:e.localAddress,family:e.localFamily,port:e.localPort},e}).catch(e=>{this.emit(`error`,e)}),this._webVPNUdpSocketPromise.then(e=>{e&&this.emit(`listening`)}),t.callback&&this._webVPNUdpSocketPromise.then(e=>{e&&t.callback()}),this}close(e){if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);return this._webVPNUdpSocketPromise.then(async t=>{if(!t)throw Error(`Socket not bound`);await t.close(),e&&e(),this.emit(`close`)}),this}connect(...e){if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);this._webVPNUdpSocketPromise.then(async t=>{if(!t)throw Error(`Socket not bound`);let n=e[0],r=this._type===`udp6`?`::1`:`127.0.0.1`,i=typeof e[1]==`string`?e[1]:r,a=typeof e.at(-1)==`function`?e.at(-1):void 0;await t.connect({remotePort:n,remoteAddress:i}),this._remoteAddress={address:i,family:this._type===`udp6`?`IPv6`:`IPv4`,port:n},a&&a()})}disconnect(){if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);this._webVPNUdpSocketPromise.then(async e=>{if(!e)throw Error(`Socket not bound`);await e.connect({remotePort:0,remoteAddress:this._type===`udp4`?`0.0.0.0`:`::`})})}dropMembership(e,t){if(i.Address4.isValid(e)){let n=z(e),r=t&&i.Address4.isValid(t)?z(t):new Uint8Array([0,0,0,0]);this._setUdpOption({type:6,group:n,interface:r})}else if(i.Address6.isValid(e)){let t=ze(e);this._setUdpOption({type:8,group:t,ifIndex:0})}else this.emit(`error`,Error(`Invalid multicast address: ${e}`))}getRecvBufferSize(){return this._lastRecvBufferSize}getSendBufferSize(){return this._lastSendBufferSize}getSendQueueSize(){return 0}getSendQueueCount(){return 0}ref(){return this}remoteAddress(){if(!this._remoteAddress)throw Error(`ERR_SOCKET_DGRAM_NOT_CONNECTED`);return{address:this._remoteAddress.address,family:this._remoteAddress.family,port:this._remoteAddress.port}}send(...e){this._webVPNUdpSocketPromise||this.bind();let t=Pe(...e),n=this._type===`udp6`?`::1`:`127.0.0.1`;if(!this._webVPNUdpSocketPromise)throw Error(`Socket not bound`);this._webVPNUdpSocketPromise.then(e=>{if(!e)throw Error(`Socket not bound`);let r=typeof t.message==`string`?Me.encode(t.message):t.message;e.send({...t,address:t.address??n,message:r.buffer})})}setBroadcast(e){this._setUdpOption({type:0,value:e})}setMulticastInterface(e){}setMulticastLoopback(e){return this._setUdpOption({type:3,value:e}),this._setUdpOption({type:4,value:e}),this._lastMulticastLoopback=e,e}setMulticastTTL(e){return this._setUdpOption({type:2,value:e}),this._lastMulticastTtl=e,e}setRecvBufferSize(e){this._setUdpOption({type:10,value:e}),this._lastRecvBufferSize=e}setSendBufferSize(e){this._setUdpOption({type:9,value:e}),this._lastSendBufferSize=e}setTTL(e){return this._setUdpOption({type:1,value:e}),this._lastTtl=e,e}unref(){return this}addSourceSpecificMembership(e,t,n){}dropSourceSpecificMembership(e,t,n){}async[Symbol.asyncDispose](){await new Promise(e=>{this.close(e)})}},z=e=>{let t=e.split(`.`).map(e=>parseInt(e,10));if(t.length!==4||t.some(e=>Number.isNaN(e)||e<0||e>255))throw Error(`Invalid IPv4 address: ${e}`);return new Uint8Array(t)},ze=e=>{let t=new i.Address6(e).getBitsBase16(0,128).match(/.{2}/g);if(!t||t.length!==16)throw Error(`Invalid IPv6 address: ${e}`);return new Uint8Array(t.map(e=>parseInt(e,16)))},Be=(e,t)=>{let n=new Re(typeof e==`string`?{type:e}:e);return t&&n.on(`message`,t),n},Ve=e.g({Agent:()=>Z,ClientRequest:()=>Y,HTTPParser:()=>G,IncomingMessage:()=>K,METHODS:()=>Ue,STATUS_CODES:()=>B,Server:()=>X,ServerResponse:()=>J,_default:()=>$,createServer:()=>Qe,default:()=>$,get:()=>Ze,globalAgent:()=>Xe,request:()=>Q}),He=new TextDecoder(`latin1`),Ue=`ACL.BIND.CHECKOUT.CONNECT.COPY.DELETE.GET.HEAD.LINK.LOCK.M-SEARCH.MERGE.MKACTIVITY.MKCALENDAR.MKCOL.MOVE.NOTIFY.OPTIONS.PATCH.POST.PROPFIND.PROPPATCH.PURGE.PUT.REBIND.REPORT.SEARCH.SOURCE.SUBSCRIBE.TRACE.UNBIND.UNLINK.UNLOCK.UNSUBSCRIBE`.split(`.`),B={100:`Continue`,101:`Switching Protocols`,102:`Processing`,103:`Early Hints`,200:`OK`,201:`Created`,202:`Accepted`,203:`Non-Authoritative Information`,204:`No Content`,205:`Reset Content`,206:`Partial Content`,207:`Multi-Status`,208:`Already Reported`,226:`IM Used`,300:`Multiple Choices`,301:`Moved Permanently`,302:`Found`,303:`See Other`,304:`Not Modified`,305:`Use Proxy`,307:`Temporary Redirect`,308:`Permanent Redirect`,400:`Bad Request`,401:`Unauthorized`,402:`Payment Required`,403:`Forbidden`,404:`Not Found`,405:`Method Not Allowed`,406:`Not Acceptable`,407:`Proxy Authentication Required`,408:`Request Timeout`,409:`Conflict`,410:`Gone`,411:`Length Required`,412:`Precondition Failed`,413:`Payload Too Large`,414:`URI Too Long`,415:`Unsupported Media Type`,416:`Range Not Satisfiable`,417:`Expectation Failed`,418:`I'm a Teapot`,421:`Misdirected Request`,422:`Unprocessable Entity`,423:`Locked`,424:`Failed Dependency`,425:`Too Early`,426:`Upgrade Required`,428:`Precondition Required`,429:`Too Many Requests`,431:`Request Header Fields Too Large`,451:`Unavailable For Legal Reasons`,500:`Internal Server Error`,501:`Not Implemented`,502:`Bad Gateway`,503:`Service Unavailable`,504:`Gateway Timeout`,505:`HTTP Version Not Supported`,506:`Variant Also Negotiates`,507:`Insufficient Storage`,508:`Loop Detected`,509:`Bandwidth Limit Exceeded`,510:`Not Extended`,511:`Network Authentication Required`},We=new Set([`content-type`,`content-length`,`user-agent`,`referer`,`host`,`authorization`,`proxy-authorization`,`if-modified-since`,`if-unmodified-since`,`from`,`location`,`max-forwards`,`retry-after`,`etag`,`last-modified`,`server`,`age`,`expires`]),V=13,H=10,Ge=/^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/,U=(e,t)=>(e.code=t,e),Ke=(e,t)=>{if(e.length===0)return t;if(t.length===0)return e;let n=new Uint8Array(e.length+t.length);return n.set(e,0),n.set(t,e.length),n},W=(e,t)=>{for(let n=t;n+1<e.length;n++)if(e[n]===V&&e[n+1]===H)return n;return-1},qe=e=>{for(let t=0;t+3<e.length;t++)if(e[t]===V&&e[t+1]===H&&e[t+2]===V&&e[t+3]===H)return t;return-1},G=class{buf=new Uint8Array;state=`HEAD`;framing=`none`;bodyRemaining=0;chunkState=`size`;skipBody=!1;constructor(e,t){this.mode=e,this.handlers=t}execute(e){this.buf=Ke(this.buf,e);let t=!0;for(;t;)if(t=!1,this.state===`HEAD`){let e=qe(this.buf);if(e===-1)return;let n=this.buf.subarray(0,e);this.buf=this.buf.subarray(e+4);let r=this.parseHead(n);this.handlers.onHeaders(r),this.setupBody(r),this.framing===`none`?(this.handlers.onComplete(),this.reset(),t=this.buf.length>0):(this.state=`BODY`,t=!0)}else this.consumeBody()&&(this.handlers.onComplete(),this.reset(),t=this.buf.length>0)}finish(){this.state===`BODY`&&this.framing===`eof`&&(this.handlers.onComplete(),this.reset())}reset(){this.state=`HEAD`,this.framing=`none`,this.bodyRemaining=0,this.chunkState=`size`,this.skipBody=!1}parseHead(e){let t=He.decode(e).split(`\r
|
|
2
|
+
`),n=t.shift()??``,r=[];for(let e of t)(e.startsWith(` `)||e.startsWith(` `))&&r.length>0?r[r.length-1]+=` `+e.trim():r.push(e);let i=[],a={};for(let e of r){if(!e)continue;let t=e.indexOf(`:`);if(t===-1)continue;let n=e.slice(0,t).trim(),r=e.slice(t+1).trim();i.push(n,r),this.addHeader(a,n,r)}let o={httpVersionMajor:1,httpVersionMinor:1,httpVersion:`1.1`,headers:a,rawHeaders:i};if(this.mode===`request`){let[e,t,r]=n.split(` `);o.method=(e??`GET`).toUpperCase(),o.url=t??`/`,this.applyVersion(o,r)}else{let e=n.indexOf(` `),t=n.slice(0,e),r=n.slice(e+1),i=r.indexOf(` `),a=i===-1?r:r.slice(0,i);o.statusCode=parseInt(a,10)||0,o.statusMessage=i===-1?``:r.slice(i+1),this.applyVersion(o,t)}return o}applyVersion(e,t){let n=/HTTP\/(\d)\.(\d)/i.exec(t??``);n&&(e.httpVersionMajor=parseInt(n[1],10),e.httpVersionMinor=parseInt(n[2],10),e.httpVersion=`${e.httpVersionMajor}.${e.httpVersionMinor}`)}addHeader(e,t,n){let r=t.toLowerCase();if(r===`set-cookie`){let t=e[`set-cookie`];Array.isArray(t)?t.push(n):e[`set-cookie`]=[n];return}let i=e[r];i===void 0?e[r]=n:We.has(r)||(e[r]=`${i}, ${n}`)}setupBody(e){if(this.skipBody){this.framing=`none`;return}let t=e.headers[`transfer-encoding`];if(typeof t==`string`&&t.toLowerCase().includes(`chunked`)){this.framing=`chunked`,this.chunkState=`size`;return}let n=e.headers[`content-length`];if(typeof n==`string`&&n!==``){let e=parseInt(n,10);e>0?(this.framing=`length`,this.bodyRemaining=e):this.framing=`none`;return}if(this.mode===`response`){let t=e.statusCode??0;t>=100&&t<200||t===204||t===304?this.framing=`none`:this.framing=`eof`}else this.framing=`none`}consumeBody(){if(this.framing===`length`){if(this.buf.length===0)return!1;let e=Math.min(this.bodyRemaining,this.buf.length);return this.handlers.onBody(this.buf.subarray(0,e)),this.buf=this.buf.subarray(e),this.bodyRemaining-=e,this.bodyRemaining===0}return this.framing===`eof`?(this.buf.length>0&&(this.handlers.onBody(this.buf),this.buf=new Uint8Array),!1):this.framing===`chunked`?this.consumeChunked():!0}consumeChunked(){for(;;)if(this.chunkState===`size`){let e=W(this.buf,0);if(e===-1)return!1;let t=He.decode(this.buf.subarray(0,e)),n=parseInt(t.split(`;`)[0].trim(),16);if(this.buf=this.buf.subarray(e+2),Number.isNaN(n))return!0;n===0?this.chunkState=`trailer`:(this.bodyRemaining=n,this.chunkState=`data`)}else if(this.chunkState===`data`){if(this.buf.length===0)return!1;let e=Math.min(this.bodyRemaining,this.buf.length);this.handlers.onBody(this.buf.subarray(0,e)),this.buf=this.buf.subarray(e),this.bodyRemaining-=e,this.bodyRemaining===0&&(this.chunkState=`dataCRLF`)}else if(this.chunkState===`dataCRLF`){if(this.buf.length<2)return!1;this.buf=this.buf.subarray(2),this.chunkState=`size`}else{let e=W(this.buf,0);if(e===-1)return!1;let t=e===0;if(this.buf=this.buf.subarray(e+2),t)return!0}}},Je=(e,t)=>a.Buffer.isBuffer(e)?e:typeof e==`string`?a.Buffer.from(e,t??`utf8`):e instanceof Uint8Array?a.Buffer.from(e):e instanceof ArrayBuffer?a.Buffer.from(new Uint8Array(e)):a.Buffer.from(String(e)),K=class extends n.Stream.Readable{httpVersion=`1.1`;httpVersionMajor=1;httpVersionMinor=1;headers={};rawHeaders=[];trailers={};rawTrailers=[];method;url;statusCode;statusMessage;complete=!1;socket;constructor(e){super(),this.socket=e}get connection(){return this.socket}_applyHead(e){this.httpVersion=e.httpVersion,this.httpVersionMajor=e.httpVersionMajor,this.httpVersionMinor=e.httpVersionMinor,this.headers=e.headers,this.rawHeaders=e.rawHeaders,this.method=e.method,this.url=e.url,this.statusCode=e.statusCode,this.statusMessage=e.statusMessage}_read(){}setTimeout(e,t){return this.socket.setTimeout(e,t),this}},q=class extends n.Stream.Writable{_headerStore=new Map;headersSent=!1;chunkedEncoding=!1;finished=!1;_bodyWritten=!1;setHeader(e,t){if(this.headersSent)throw U(Error(`Cannot set headers after they are sent to the client`),`ERR_HTTP_HEADERS_SENT`);if(typeof e!=`string`||!Ge.test(e))throw U(TypeError(`Header name must be a valid HTTP token [${JSON.stringify(String(e))}]`),`ERR_INVALID_HTTP_TOKEN`);if(t===void 0)throw U(TypeError(`Invalid value "undefined" for header "${e}"`),`ERR_HTTP_INVALID_HEADER_VALUE`);return this._headerStore.set(e.toLowerCase(),[e,Array.isArray(t)?[...t]:t]),this}getHeader(e){return this._headerStore.get(e.toLowerCase())?.[1]}getHeaderNames(){return[...this._headerStore.values()].map(([e])=>e)}getHeaders(){let e={};for(let[t,n]of this._headerStore.values())e[t]=n;return e}hasHeader(e){return this._headerStore.has(e.toLowerCase())}removeHeader(e){if(this.headersSent)throw Error(`Cannot remove headers after they are sent to the client`);this._headerStore.delete(e.toLowerCase())}_storeHeader(e){let t=this.hasHeader(`content-length`),n=this.getHeader(`transfer-encoding`);typeof n==`string`&&n.toLowerCase().includes(`chunked`)?this.chunkedEncoding=!0:!t&&this._shouldSendBody()&&(this.chunkedEncoding=!0,this.setHeader(`Transfer-Encoding`,`chunked`));let r=e+`\r
|
|
3
3
|
`;for(let[e,t]of this._headerStore.values())if(Array.isArray(t))for(let n of t)r+=`${e}: ${n}\r\n`;else r+=`${e}: ${t}\r\n`;return r+=`\r
|
|
4
|
-
`,r}_writeToSocket(e,t){if(!this.socket){t(Error(`Socket is not available`));return}this.socket.write(e,t)}write(e,t,n){return this._bodyWritten=!0,super.write(e,t,n)}_write(e,t,n){let r=
|
|
4
|
+
`,r}_writeToSocket(e,t){if(!this.socket){t(Error(`Socket is not available`));return}this.socket.write(e,t)}write(e,t,n){return this._bodyWritten=!0,super.write(e,t,n)}_write(e,t,n){let r=Je(e),i=[];if(this.headersSent||=(this._implicitHeader(),i.push(a.Buffer.from(this._headBlock,`latin1`)),!0),this.chunkedEncoding?r.length>0&&(i.push(a.Buffer.from(`${r.length.toString(16)}\r\n`,`latin1`)),i.push(r),i.push(a.Buffer.from(`\r
|
|
5
5
|
`,`latin1`))):i.push(r),i.length===0){n();return}this._writeToSocket(a.Buffer.concat(i),n)}_final(e){let t=[];if(this.headersSent||=(!this.chunkedEncoding&&!this.hasHeader(`content-length`)&&this.setHeader(`Content-Length`,0),this._implicitHeader(),t.push(a.Buffer.from(this._headBlock,`latin1`)),!0),this.chunkedEncoding&&t.push(a.Buffer.from(`0\r
|
|
6
6
|
\r
|
|
7
|
-
`,`latin1`)),this.finished=!0,t.length===0){e();return}this._writeToSocket(a.Buffer.concat(t),e)}end(e,t,n){if(e!=null&&typeof e!=`function`&&!this._bodyWritten&&!this.headersSent&&!this.chunkedEncoding&&!this.hasHeader(`content-length`)){let n=typeof t==`string`?t:void 0;this.setHeader(`Content-Length`,
|
|
7
|
+
`,`latin1`)),this.finished=!0,t.length===0){e();return}this._writeToSocket(a.Buffer.concat(t),e)}end(e,t,n){if(e!=null&&typeof e!=`function`&&!this._bodyWritten&&!this.headersSent&&!this.chunkedEncoding&&!this.hasHeader(`content-length`)){let n=typeof t==`string`?t:void 0;this.setHeader(`Content-Length`,Je(e,n).length)}return super.end(e,t,n)}_headBlock},J=class extends q{statusCode=200;statusMessage;_writeHeadCalled=!1;sendDate=!0;req;socket;_keepAlive=!0;constructor(e){super(),this.req=e,this.socket=e.socket}_shouldSendBody(){if(this.req.method===`HEAD`)return!1;let e=this.statusCode;return!(e>=100&&e<200||e===204||e===304)}writeHead(e,t,n){if(this._writeHeadCalled||this.headersSent)throw U(Error(`Cannot render headers after they are sent to the client`),`ERR_HTTP_HEADERS_SENT`);this._writeHeadCalled=!0,this.statusCode=e;let r=n;if(typeof t==`string`?this.statusMessage=t:t!=null&&(r=t),Array.isArray(r)){let e=Array.isArray(r[0])?r:Array.from({length:Math.floor(r.length/2)},(e,t)=>[r[t*2],r[t*2+1]]);for(let[t,n]of e)n!==void 0&&this._appendHeader(t,n)}else if(r)for(let[e,t]of Object.entries(r))t!==void 0&&this.setHeader(e,t);return this}_appendHeader(e,t){let n=this.getHeader(e);if(n===void 0)this.setHeader(e,t);else{let r=[...Array.isArray(n)?n:[n],...Array.isArray(t)?t:[t]].map(String);this.setHeader(e,r)}}_implicitHeader(){let e=this.statusMessage??B[this.statusCode]??`unknown`;this.sendDate&&!this.hasHeader(`date`)&&this.setHeader(`Date`,new Date().toUTCString()),this.hasHeader(`connection`)||this.setHeader(`Connection`,this._keepAlive?`keep-alive`:`close`),this._headBlock=this._storeHeader(`HTTP/1.1 ${this.statusCode} ${e}`)}writeContinue(){this._writeToSocket(a.Buffer.from(`HTTP/1.1 100 Continue\r
|
|
8
8
|
\r
|
|
9
|
-
`,`latin1`),()=>{})}setTimeout(e,t){return this.socket?.setTimeout(e,t),this}},
|
|
9
|
+
`,`latin1`),()=>{})}setTimeout(e,t){return this.socket?.setTimeout(e,t),this}},Ye=(...e)=>{let t={},n={},r,i=[...e],a=i.shift();if(typeof a==`string`||a instanceof URL){let e=typeof a==`string`?new URL(a):a;t={protocol:e.protocol,hostname:e.hostname,host:e.hostname,port:e.port,path:`${e.pathname}${e.search}`,auth:e.username?`${e.username}:${e.password}`:void 0};let o=i.shift();typeof o==`function`?r=o:o&&typeof o==`object`&&(n=o,r=i.shift())}else a&&typeof a==`object`&&(n=a,r=i.shift());return{options:{...t,...n},callback:r}},Y=class extends q{method;path;host;protocol;socket;get connection(){return this.socket}res=null;aborted=!1;_aborted=!1;constructor(e,t){super(),this.method=(e.method??`GET`).toUpperCase(),this.path=e.path??`/`,this.protocol=e.protocol??`http:`;let n=e.hostname??e.host??`localhost`;this.host=n;let r=Number(e.port??(this.protocol===`https:`?443:80));if(t&&this.once(`response`,t),e.headers)for(let[t,n]of Object.entries(e.headers))n!==void 0&&this.setHeader(t,n);if(!this.hasHeader(`host`)){let e=this.protocol===`https:`&&r===443||this.protocol!==`https:`&&r===80;this.setHeader(`Host`,e?n:`${n}:${r}`)}e.auth&&!this.hasHeader(`authorization`)&&this.setHeader(`Authorization`,`Basic ${a.Buffer.from(e.auth).toString(`base64`)}`),this.socket=new P,this.emit(`socket`,this.socket),this.socket.on(`error`,e=>{this._aborted||this.emit(`error`,e)}),this._attachResponseParser(),this.socket.connect({host:n,port:r},()=>{this.emit(`connect`)})}_shouldSendBody(){return this.method!==`GET`&&this.method!==`HEAD`&&this.method!==`DELETE`}_implicitHeader(){this._headBlock=this._storeHeader(`${this.method} ${this.path} HTTP/1.1`)}_attachResponseParser(){let e=new K(this.socket),t=new G(`response`,{onHeaders:n=>{e._applyHead(n),this.method===`HEAD`&&(t.skipBody=!0),this.res=e,this.emit(`response`,e)},onBody:t=>{e.push(a.Buffer.from(t))},onComplete:()=>{e.complete=!0,e.push(null)}});this.socket.on(`data`,e=>{this._aborted||t.execute(e)}),this.socket.on(`end`,()=>{t.finish()}),this.socket.on(`close`,()=>{this.emit(`close`)})}abort(){this._aborted||(this._aborted=!0,this.aborted=!0,this.emit(`abort`),this.socket.destroy())}destroy(e){return this._aborted?this:(this._aborted=!0,this.socket.destroy(e),super.destroy(e),this)}end(e,t,n){return this._aborted?this:super.end(e,t,n)}_writeToSocket(e,t){if(this._aborted){t();return}super._writeToSocket(e,t)}setTimeout(e,t){return this.socket.setTimeout(e,t),this}setNoDelay(e){this.socket.setNoDelay(e)}setSocketKeepAlive(e,t){this.socket.setKeepAlive(e,t)}},X=new Proxy(class extends F{constructor(e,t){let n={},r=t;typeof e==`function`?r=e:e&&(n=e),super(n),r&&this.on(`request`,r),this.on(`connection`,e=>this._handleConnection(e))}_handleConnection(e){let t=null,n=new G(`request`,{onHeaders:r=>{t=new K(e),t._applyHead(r),r.method===`HEAD`&&(n.skipBody=!0);let i=new J(t),a=String(r.headers.connection??``).toLowerCase();i._keepAlive=r.httpVersionMinor>=1?a!==`close`:a===`keep-alive`,i.on(`finish`,()=>{i._keepAlive||e.end()}),this.emit(`request`,t,i)},onBody:e=>{t?.push(a.Buffer.from(e))},onComplete:()=>{t&&(t.complete=!0,t.push(null)),t=null}});e.on(`data`,e=>n.execute(e)),e.on(`end`,()=>{n.finish(),t&&t.push(null)}),e.on(`error`,t=>this.emit(`clientError`,t,e))}},{apply:(e,t,n)=>new e(...n)}),Z=class{maxSockets;maxFreeSockets;keepAlive;options;constructor(e={}){this.options=e,this.keepAlive=!!e.keepAlive,this.maxSockets=e.maxSockets??1/0,this.maxFreeSockets=e.maxFreeSockets??256}getName(e={}){return`${e.host??`localhost`}:${e.port??``}:${e.localAddress??``}`}destroy(){}},Xe=new Z,Q=(...e)=>{let{options:t,callback:n}=Ye(...e);return new Y(t,n)},Ze=(...e)=>{let t=Q(...e);return t.end(),t},Qe=(e,t)=>new X(e,t),$={METHODS:Ue,STATUS_CODES:B,Agent:Z,globalAgent:Xe,Server:X,ServerResponse:J,IncomingMessage:K,ClientRequest:Y,OutgoingMessage:q,createServer:Qe,request:Q,get:Ze};exports.ATTACH_FRAME_EVENT_KEY=C,exports.assertAttachableFrameUrl=T,exports.attachFrame=De,exports.attachFramePermission=Te,exports.box=e.u,exports.cookies=xe,exports.createVideoElementHandle=e.d,Object.defineProperty(exports,`dgram`,{enumerable:!0,get:function(){return Le}}),exports.extension=v,exports.fetch=ye,exports.fetchCredentialedPermission=ge,exports.fetchPermission=he,Object.defineProperty(exports,`fs`,{enumerable:!0,get:function(){return ke}}),exports.gotoPermission=Ee,exports.handleRevivableModules=e.l,Object.defineProperty(exports,`http`,{enumerable:!0,get:function(){return Ve}}),exports.isBlockedFrameUrl=w,exports.isExtensionExposed=y,exports.isType=e.f,exports.modifyRequestHeadersPermission=Se,Object.defineProperty(exports,`net`,{enumerable:!0,get:function(){return Fe}}),exports.permissions=Oe,exports.promptInstall=E,exports.readCookiePermission=be,exports.relayWorker=le,exports.removeRequestHeaderRule=we,exports.revive=e.p,exports.serverProxyFetch=se,exports.setMissingExtensionHandler=fe,exports.setRequestHeaderRule=Ce,exports.type=e.m,exports.waitForExtensionExposure=x;
|
package/index.d.ts
CHANGED
|
@@ -213,6 +213,7 @@ type BidirectionalStreams = {
|
|
|
213
213
|
};
|
|
214
214
|
declare const makeWebVPNWebTransport: () => Promise<{
|
|
215
215
|
webtransport: WebTransport;
|
|
216
|
+
isClosed: () => boolean;
|
|
216
217
|
getNewPacketId: () => number;
|
|
217
218
|
getTcpDataReadableStreamForSocketId: (socketId: number, options?: {
|
|
218
219
|
signal?: AbortSignal;
|
|
@@ -355,6 +356,28 @@ declare const relayWorker: (worker: Worker, options?: {
|
|
|
355
356
|
|
|
356
357
|
declare const promptInstall: (reason?: string) => Promise<boolean>;
|
|
357
358
|
|
|
359
|
+
type DirectoryPermissionMode = 'read' | 'readwrite';
|
|
360
|
+
type PickLocalDirectoryOptions = {
|
|
361
|
+
id?: string;
|
|
362
|
+
mode?: DirectoryPermissionMode;
|
|
363
|
+
startIn?: 'desktop' | 'documents' | 'downloads' | 'music' | 'pictures' | 'videos';
|
|
364
|
+
};
|
|
365
|
+
declare const isLocalDirectorySupported: () => boolean;
|
|
366
|
+
declare const pickLocalDirectory: (options?: PickLocalDirectoryOptions) => Promise<FileSystemDirectoryHandle | undefined>;
|
|
367
|
+
declare const queryDirectoryPermission: (handle: FileSystemDirectoryHandle, mode?: DirectoryPermissionMode) => Promise<PermissionState>;
|
|
368
|
+
declare const ensureDirectoryPermission: (handle: FileSystemDirectoryHandle, mode?: DirectoryPermissionMode) => Promise<boolean>;
|
|
369
|
+
|
|
370
|
+
type fs_DirectoryPermissionMode = DirectoryPermissionMode;
|
|
371
|
+
type fs_PickLocalDirectoryOptions = PickLocalDirectoryOptions;
|
|
372
|
+
declare const fs_ensureDirectoryPermission: typeof ensureDirectoryPermission;
|
|
373
|
+
declare const fs_isLocalDirectorySupported: typeof isLocalDirectorySupported;
|
|
374
|
+
declare const fs_pickLocalDirectory: typeof pickLocalDirectory;
|
|
375
|
+
declare const fs_queryDirectoryPermission: typeof queryDirectoryPermission;
|
|
376
|
+
declare namespace fs {
|
|
377
|
+
export { fs_ensureDirectoryPermission as ensureDirectoryPermission, fs_isLocalDirectorySupported as isLocalDirectorySupported, fs_pickLocalDirectory as pickLocalDirectory, fs_queryDirectoryPermission as queryDirectoryPermission };
|
|
378
|
+
export type { fs_DirectoryPermissionMode as DirectoryPermissionMode, fs_PickLocalDirectoryOptions as PickLocalDirectoryOptions };
|
|
379
|
+
}
|
|
380
|
+
|
|
358
381
|
declare const isIPv4: (input: string) => boolean;
|
|
359
382
|
declare const isIPv6: (input: string) => boolean;
|
|
360
383
|
declare const isIP: (input: string) => 0 | 4 | 6;
|
|
@@ -809,7 +832,7 @@ declare const fetchCredentialedPermission: {
|
|
|
809
832
|
readonly category: "network";
|
|
810
833
|
readonly severity: 3;
|
|
811
834
|
readonly unsafe: true;
|
|
812
|
-
readonly title: "Fetch from other sites
|
|
835
|
+
readonly title: "Fetch from other sites, signed in as you";
|
|
813
836
|
readonly description: "Lets the app fetch other sites using your logged-in session cookies, so it can read data only you should see.";
|
|
814
837
|
};
|
|
815
838
|
type ProxyFetchRequest = {
|
|
@@ -1183,7 +1206,7 @@ declare const appearPermission: {
|
|
|
1183
1206
|
readonly category: "media";
|
|
1184
1207
|
readonly severity: 0;
|
|
1185
1208
|
readonly title: "Change page appearance";
|
|
1186
|
-
readonly description: "Lets the app restyle parts of the page
|
|
1209
|
+
readonly description: "Lets the app restyle parts of the page (safely filtered).";
|
|
1187
1210
|
};
|
|
1188
1211
|
declare const appearUnsafePermission: {
|
|
1189
1212
|
readonly scope: "media.appearU";
|
|
@@ -1191,21 +1214,21 @@ declare const appearUnsafePermission: {
|
|
|
1191
1214
|
readonly severity: 2;
|
|
1192
1215
|
readonly unsafe: true;
|
|
1193
1216
|
readonly title: "Change page appearance (unsafe)";
|
|
1194
|
-
readonly description: "Lets the app restyle the page WITHOUT safety filtering
|
|
1217
|
+
readonly description: "Lets the app restyle the page WITHOUT safety filtering. Could be used to leak data over the network.";
|
|
1195
1218
|
};
|
|
1196
1219
|
declare const permission: (options?: AddStyleTagOptions | undefined) => {
|
|
1197
1220
|
readonly scope: "media.appear";
|
|
1198
1221
|
readonly category: "media";
|
|
1199
1222
|
readonly severity: 0;
|
|
1200
1223
|
readonly title: "Change page appearance";
|
|
1201
|
-
readonly description: "Lets the app restyle parts of the page
|
|
1224
|
+
readonly description: "Lets the app restyle parts of the page (safely filtered).";
|
|
1202
1225
|
} | {
|
|
1203
1226
|
readonly scope: "media.appearU";
|
|
1204
1227
|
readonly category: "media";
|
|
1205
1228
|
readonly severity: 2;
|
|
1206
1229
|
readonly unsafe: true;
|
|
1207
1230
|
readonly title: "Change page appearance (unsafe)";
|
|
1208
|
-
readonly description: "Lets the app restyle the page WITHOUT safety filtering
|
|
1231
|
+
readonly description: "Lets the app restyle the page WITHOUT safety filtering. Could be used to leak data over the network.";
|
|
1209
1232
|
};
|
|
1210
1233
|
declare const setInjectedStylesDisabled: (disabled: boolean) => void;
|
|
1211
1234
|
declare const resolve: (_context: LocatorContext, options: AddStyleTagOptions) => Promise<void>;
|
|
@@ -1400,14 +1423,14 @@ declare const PERMISSIONS: readonly [{
|
|
|
1400
1423
|
readonly category: "media";
|
|
1401
1424
|
readonly severity: 0;
|
|
1402
1425
|
readonly title: "Change page appearance";
|
|
1403
|
-
readonly description: "Lets the app restyle parts of the page
|
|
1426
|
+
readonly description: "Lets the app restyle parts of the page (safely filtered).";
|
|
1404
1427
|
}, {
|
|
1405
1428
|
readonly scope: "media.appearU";
|
|
1406
1429
|
readonly category: "media";
|
|
1407
1430
|
readonly severity: 2;
|
|
1408
1431
|
readonly unsafe: true;
|
|
1409
1432
|
readonly title: "Change page appearance (unsafe)";
|
|
1410
|
-
readonly description: "Lets the app restyle the page WITHOUT safety filtering
|
|
1433
|
+
readonly description: "Lets the app restyle the page WITHOUT safety filtering. Could be used to leak data over the network.";
|
|
1411
1434
|
}, {
|
|
1412
1435
|
readonly scope: "embed.iframe";
|
|
1413
1436
|
readonly category: "embed";
|
|
@@ -1431,7 +1454,7 @@ declare const PERMISSIONS: readonly [{
|
|
|
1431
1454
|
readonly category: "network";
|
|
1432
1455
|
readonly severity: 3;
|
|
1433
1456
|
readonly unsafe: true;
|
|
1434
|
-
readonly title: "Fetch from other sites
|
|
1457
|
+
readonly title: "Fetch from other sites, signed in as you";
|
|
1435
1458
|
readonly description: "Lets the app fetch other sites using your logged-in session cookies, so it can read data only you should see.";
|
|
1436
1459
|
}, {
|
|
1437
1460
|
readonly scope: "network.readCookie";
|
|
@@ -1589,5 +1612,5 @@ type MissingExtensionHandler = () => Promise<void>;
|
|
|
1589
1612
|
declare const setMissingExtensionHandler: (handler: MissingExtensionHandler | null) => void;
|
|
1590
1613
|
declare const waitForExtensionExposure: (timeout?: number) => Promise<void>;
|
|
1591
1614
|
|
|
1592
|
-
export { ATTACH_FRAME_EVENT_KEY, assertAttachableFrameUrl, attachFrame, attachFramePermission, box, cookies, createVideoElementHandle, dgram, extension, fetch, fetchCredentialedPermission, fetchPermission, gotoPermission, handleRevivableModules, http, isBlockedFrameUrl, isExtensionExposed, isType, modifyRequestHeadersPermission, net, permissions, promptInstall, readCookiePermission, relayWorker, removeRequestHeaderRule, revive, serverProxyFetch, setMissingExtensionHandler, setRequestHeaderRule, type, waitForExtensionExposure };
|
|
1615
|
+
export { ATTACH_FRAME_EVENT_KEY, assertAttachableFrameUrl, attachFrame, attachFramePermission, box, cookies, createVideoElementHandle, dgram, extension, fetch, fetchCredentialedPermission, fetchPermission, fs, gotoPermission, handleRevivableModules, http, isBlockedFrameUrl, isExtensionExposed, isType, modifyRequestHeadersPermission, net, permissions, promptInstall, readCookiePermission, relayWorker, removeRequestHeaderRule, revive, serverProxyFetch, setMissingExtensionHandler, setRequestHeaderRule, type, waitForExtensionExposure };
|
|
1593
1616
|
export type { AttachFrameOptions, BoxedVideoElement, CookieDetails, FetchInit, Frame, GotoOptions, HeaderOperation, PermissionGrant, PermissionRequest, ProxyFetchRequest, RemoteVideoElement, RequestHeaderRule, SiteCookie, VideoElementState };
|