@fkn/lib 0.3.8 → 0.3.9
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-DWzRqH12.cjs → background-D-gZyvaP.cjs} +1 -1
- package/{background-_3_Cnyol.js → background-DCdL9DVK.js} +2 -2
- package/index.cjs +6 -8
- package/index.d.ts +27 -30
- package/index.js +266 -1748
- package/locator-Bz_60Zup.cjs +53 -0
- package/{locator-1wWrCOyE.js → locator-fXEVniGP.js} +358 -92
- package/package.json +3 -4
- package/_redirects +0 -5
- package/locator-DHsqhrFb.cjs +0 -31
- package/logo.png +0 -0
- package/logo.svg +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./locator-DHsqhrFb.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-Bz_60Zup.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,7 +1,7 @@
|
|
|
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-fXEVniGP.js";
|
|
2
2
|
import { checkOsraMessageKey as l, expose as u } from "osra";
|
|
3
3
|
//#endregion
|
|
4
|
-
//#region
|
|
4
|
+
//#region node_modules/@mfkn/web-extension/lib/background/constants.js
|
|
5
5
|
var d = (/* @__PURE__ */ n(((e, t) => {
|
|
6
6
|
(function(n, r) {
|
|
7
7
|
if (typeof define == "function" && define.amd) define("webextension-polyfill", ["module"], r);
|
package/index.cjs
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./locator-DHsqhrFb.cjs`);let t=require(`osra`),n=require(`preact`),r=require(`@cloudflare/blindrsa-ts`),i=require(`stream`),a=require(`events`),o=require(`ip-address`),s=require(`buffer`);var c=`https://fkn.app`,l=typeof globalThis<`u`&&globalThis.document?globalThis.document:void 0,u=l?.querySelector(`iframe[src="${c}/api"]`)??null,d=l?.createElement(`iframe`)??null;!u&&d&&l&&(d.src=`${c}/api`,d.style.display=`none`,l.body.appendChild(d));var f=u??d,p=f?.contentWindow??null,m=f?.style.cssText??``,h=e=>{f&&Object.assign(f.style,e)},g=()=>{f&&(f.style.cssText=m)},_=typeof window<`u`&&f?{changeIframeStyle:h,resetIframeStyle:g}:{},v=()=>{if(typeof window<`u`)return p?{receive:window,emit:p}:void 0;if(typeof self<`u`)return{receive:self,emit:self}},y=e=>new Promise((n,r)=>{let i=v();if(!i)return;let a=new AbortController,o=setTimeout(()=>{a.abort(),r(Error(`Timeout waiting for api to be exposed`))},e);(0,t.expose)(_,{key:`fkn-api`,unregisterSignal:a.signal,transport:i}).then(e=>{clearTimeout(o),n(e)}).catch(e=>{clearTimeout(o),r(e)})}),b=(e=50)=>y(e).then(e=>e).catch(t=>{if(t.message===`Timeout waiting for api to be exposed`)return b(Math.min(e*2,500));throw t}),x=b(),ee=(e,t)=>x.then(n=>n.proxyFetch(e,t)),te=`https://fkn.app`,ne=(e,n)=>{if(typeof window>`u`)throw Error(`FKN @fkn/lib: relayWorker must be called from the main thread`);if(!f?.contentWindow)throw Error(`FKN @fkn/lib: relayWorker called before the FKN iframe was injected`);(0,t.relay)({receive:window,emit:f.contentWindow},e,{key:`fkn-api`,originA:n?.originA??te,originB:n?.originB??`*`,unregisterSignal:n?.unregisterSignal})},re=`FKN_WEB_EXTENSION_MAIN_WORLD_CONTENT_SCRIPT_ENABLED_EVENT_KEY`,ie=`fknExtension`,S=(0,t.createTypedEventTarget)();typeof document<`u`&&document.addEventListener(re,e=>{S.dispatchEvent(new CustomEvent(`statuschange`,{detail:{enabled:e.detail.enabled}}))});var C=()=>document.documentElement.dataset[ie]===`true`,ae=null,oe=e=>{ae=e},se=(e=1e3)=>new Promise((t,n)=>{if(C())return t();let r=e=>{clearTimeout(s),a.disconnect(),document.removeEventListener(`readystatechange`,o),e()},i=()=>r(async()=>{if(ae&&(await ae().catch(()=>{}),C()))return t();n(Error(`The FKN WebExtension is not installed, enabled or not exposed on this page.`))}),a=new MutationObserver(()=>{C()&&r(t)}),o=()=>{document.readyState===`complete`&&!C()&&i()},s=setTimeout(i,e);if(document.readyState===`complete`)return i();a.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-fkn-extension`]}),document.addEventListener(`readystatechange`,o),C()&&r(t)}),ce,w=new Proxy({},{get:(n,r)=>async(...n)=>{await se(),ce??=(0,t.expose)({},{transport:window,revivableModules:e.l});let i=(await ce)[r];return i(...n)}}),le={scope:`network.fetch`,category:`network`,severity:0,title:`Fetch data from other sites`,description:`Lets the app download public data from other websites directly, past the usual cross-origin limits.`},ue={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.`},de=[`origin`,`referer`],fe=e=>{if(!e?.headers)return;let t=new Headers(e.headers),n=de.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},pe=async(e,t)=>{let n=new Request(e,t),r=n.body?await n.arrayBuffer():null;return w.proxyFetch({url:n.url,method:n.method,headers:[...n.headers],body:r,credentials:t?.credentials===`include`?`include`:`omit`,redirect:n.redirect,unsafeHeaders:fe(t),reason:t?.reason,signal:t?.signal??void 0})},me={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.`},he={get:e=>w.getCookie(e)},ge={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.`},_e=e=>w.setRequestHeaderRule(e),ve=e=>w.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 ye=`FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY`,be={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.`},xe={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.`},Se=async({iframe:t,domains:n=[]})=>{let r=crypto.randomUUID();if(await se(),!t.isConnected)throw Error(`attachFrame: the iframe must be connected to the document before attaching`);t.dispatchEvent(new CustomEvent(ye,{detail:r}));let{executeLocator:i,ensureLocatorPermission:a,goto:o}=await w.attachFrame({marker:r,domains:n}),s=e.r(i,a),c=(e,t={})=>o({url:e,...t}),l=()=>t.src;return{...s,goto:c,url:l}},Ce={request:e=>w.requestPermissions(e.map(e=>({key:e.key,scope:e.scope??``,reason:e.reason})))},we=async e=>{if(typeof window>`u`)return!1;if(C())return!0;let t=await x,n=null,r=new Promise(e=>{n=()=>{C()&&e(!0)},S.addEventListener(`statuschange`,n)}),i=t.showInstallPrompt(e).then(()=>!1),a=await Promise.race([r,i]);return n&&S.removeEventListener(`statuschange`,n),await t.hideInstallPrompt().catch(()=>{}),a},Te=null;oe(()=>(Te||=we().then(()=>void 0).finally(()=>{Te=null}),Te));var T,Ee,De,Oe=[],E=n.options,ke=E.__b,Ae=E.__r,je=E.diffed,Me=E.__c,Ne=E.unmount,Pe=E.__;function Fe(){for(var e;e=Oe.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(D),e.__H.__h.forEach(Re),e.__H.__h=[]}catch(t){e.__H.__h=[],E.__e(t,e.__v)}}E.__b=function(e){T=null,ke&&ke(e)},E.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Pe&&Pe(e,t)},E.__r=function(e){Ae&&Ae(e);var t=(T=e.__c).__H;t&&(Ee===T?(t.__h=[],T.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(D),t.__h.forEach(Re),t.__h=[])),Ee=T},E.diffed=function(e){je&&je(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Oe.push(t)!==1&&De===E.requestAnimationFrame||((De=E.requestAnimationFrame)||Le)(Fe)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),Ee=T=null},E.__c=function(e,t){t.some(function(e){try{e.__h.forEach(D),e.__h=e.__h.filter(function(e){return!e.__||Re(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],E.__e(n,e.__v)}}),Me&&Me(e,t)},E.unmount=function(e){Ne&&Ne(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{D(e)}catch(e){t=e}}),n.__H=void 0,t&&E.__e(t,n.__v))};var Ie=typeof requestAnimationFrame==`function`;function Le(e){var t,n=function(){clearTimeout(r),Ie&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Ie&&(t=requestAnimationFrame(n))}function D(e){var t=T,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),T=t}function Re(e){var t=T;e.__c=e.__(),T=t}function ze(e,t){for(var n in t)e[n]=t[n];return e}function Be(e,t){for(var n in e)if(n!==`__source`&&!(n in t))return!0;for(var r in t)if(r!==`__source`&&e[r]!==t[r])return!0;return!1}function Ve(e,t){this.props=e,this.context=t}(Ve.prototype=new n.Component).isPureReactComponent=!0,Ve.prototype.shouldComponentUpdate=function(e,t){return Be(this.props,e)||Be(this.state,t)};var He=n.options.__b;n.options.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),He&&He(e)},typeof Symbol<`u`&&Symbol.for,n.toChildArray;var Ue=n.options.__e;n.options.__e=function(e,t,n,r){if(e.then){for(var i,a=t;a=a.__;)if((i=a.__c)&&i.__c)return t.__e??(t.__e=n.__e,t.__k=n.__k),i.__c(e,t)}Ue(e,t,n,r)};var We=n.options.unmount;function Ge(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){typeof e.__c==`function`&&e.__c()}),e.__c.__H=null),(e=ze({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return Ge(e,t,n)})),e}function Ke(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return Ke(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function qe(){this.__u=0,this.o=null,this.__b=null}function Je(e){if(!e.__)return null;var t=e.__.__c;return t&&t.__a&&t.__a(e)}function O(){this.i=null,this.l=null}n.options.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),We&&We(e)},(qe.prototype=new n.Component).__c=function(e,t){var n=t.__c,r=this;r.o??=[],r.o.push(n);var i=Je(r.__v),a=!1,o=function(){a||r.__z||(a=!0,n.__R=null,i?i(c):c())};n.__R=o;var s=n.__P;n.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=Ke(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.__P=s,t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(o,o)},qe.prototype.componentWillUnmount=function(){this.o=[]},qe.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var r=document.createElement(`div`),i=this.__v.__k[0].__c;this.__v.__k[0]=Ge(this.__b,r,i.__O=i.__P)}this.__b=null}var a=t.__a&&(0,n.createElement)(n.Fragment,null,e.fallback);return a&&(a.__u&=-33),[(0,n.createElement)(n.Fragment,null,t.__a?null:e.children),a]};var Ye=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!==`t`||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(O.prototype=new n.Component).__a=function(e){var t=this,n=Je(t.__v),r=t.l.get(e);return r[0]++,function(i){var a=function(){t.props.revealOrder?(r.push(i),Ye(t,e,r)):i()};n?n(a):a()}},O.prototype.render=function(e){this.i=null,this.l=new Map;var t=(0,n.toChildArray)(e.children);e.revealOrder&&e.revealOrder[0]===`b`&&t.reverse();for(var r=t.length;r--;)this.l.set(t[r],this.i=[1,0,this.i]);return e.children},O.prototype.componentDidUpdate=O.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Ye(e,n,t)})};var Xe=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.element`)||60103,Ze=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Qe=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,$e=/[A-Z0-9]/g,et=typeof document<`u`,tt=function(e){return(typeof Symbol<`u`&&typeof Symbol()==`symbol`?/fil|che|rad/:/fil|che|ra/).test(e)};n.Component.prototype.isReactComponent={},[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(n.Component.prototype,e,{configurable:!0,get:function(){return this[`UNSAFE_`+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var nt=n.options.event;function rt(){}function it(){return this.cancelBubble}function at(){return this.defaultPrevented}n.options.event=function(e){return nt&&(e=nt(e)),e.persist=rt,e.isPropagationStopped=it,e.isDefaultPrevented=at,e.nativeEvent=e};var ot={enumerable:!1,configurable:!0,get:function(){return this.class}},st=n.options.vnode;n.options.vnode=function(e){typeof e.type==`string`&&function(e){var t=e.props,r=e.type,i={},a=r.indexOf(`-`)===-1;for(var o in t){var s=t[o];if(!(o===`value`&&`defaultValue`in t&&s==null||et&&o===`children`&&r===`noscript`||o===`class`||o===`className`)){var c=o.toLowerCase();o===`defaultValue`&&`value`in t&&t.value==null?o=`value`:o===`download`&&!0===s?s=``:c===`translate`&&s===`no`?s=!1:c[0]===`o`&&c[1]===`n`?c===`ondoubleclick`?o=`ondblclick`:c!==`onchange`||r!==`input`&&r!==`textarea`||tt(t.type)?c===`onfocus`?o=`onfocusin`:c===`onblur`?o=`onfocusout`:Qe.test(o)&&(o=c):c=o=`oninput`:a&&Ze.test(o)?o=o.replace($e,`-$&`).toLowerCase():s===null&&(s=void 0),c===`oninput`&&i[o=c]&&(o=`oninputCapture`),i[o]=s}}r==`select`&&i.multiple&&Array.isArray(i.value)&&(i.value=(0,n.toChildArray)(t.children).forEach(function(e){e.props.selected=i.value.indexOf(e.props.value)!=-1})),r==`select`&&i.defaultValue!=null&&(i.value=(0,n.toChildArray)(t.children).forEach(function(e){e.props.selected=i.multiple?i.defaultValue.indexOf(e.props.value)!=-1:i.defaultValue==e.props.value})),t.class&&!t.className?(i.class=t.class,Object.defineProperty(i,`className`,ot)):(t.className&&!t.class||t.class&&t.className)&&(i.class=i.className=t.className),e.props=i}(e),e.$$typeof=Xe,st&&st(e)};var ct=n.options.__r;n.options.__r=function(e){ct&&ct(e),e.__c};var lt=n.options.diffed;n.options.diffed=function(e){lt&<(e);var t=e.props,n=e.__e;n!=null&&e.type===`textarea`&&`value`in t&&t.value!==n.value&&(n.value=t.value==null?``:t.value)};var ut=Symbol.for(`better-auth:broadcast-channel`),dt=()=>Math.floor(Date.now()/1e3),ft=class{listeners=new Set;name;constructor(e=`better-auth.message`){this.name=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}post(e){if(!(typeof window>`u`))try{localStorage.setItem(this.name,JSON.stringify({...e,timestamp:dt()}))}catch{}}setup(){if(typeof window>`u`||window.addEventListener===void 0)return()=>{};let e=e=>{if(e.key!==this.name)return;let t=JSON.parse(e.newValue??`{}`);t?.event!==`session`||!t?.data||this.listeners.forEach(e=>e(t))};return window.addEventListener(`storage`,e),()=>{window.removeEventListener(`storage`,e)}}};function pt(e=`better-auth.message`){return globalThis[ut]||(globalThis[ut]=new ft(e)),globalThis[ut]}var mt=Symbol.for(`better-auth:focus-manager`),ht=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setFocused(e){this.listeners.forEach(t=>t(e))}setup(){if(typeof window>`u`||typeof document>`u`||window.addEventListener===void 0)return()=>{};let e=()=>{document.visibilityState===`visible`&&this.setFocused(!0)};return document.addEventListener(`visibilitychange`,e,!1),()=>{document.removeEventListener(`visibilitychange`,e,!1)}}};function gt(){return globalThis[mt]||(globalThis[mt]=new ht),globalThis[mt]}var _t=Symbol.for(`better-auth:online-manager`),vt=class{listeners=new Set;isOnline=typeof navigator<`u`?navigator.onLine:!0;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOnline(e){this.isOnline=e,this.listeners.forEach(t=>t(e))}setup(){if(typeof window>`u`||window.addEventListener===void 0)return()=>{};let e=()=>this.setOnline(!0),t=()=>this.setOnline(!1);return window.addEventListener(`online`,e,!1),window.addEventListener(`offline`,t,!1),()=>{window.removeEventListener(`online`,e,!1),window.removeEventListener(`offline`,t,!1)}}};function yt(){return globalThis[_t]||(globalThis[_t]=new vt),globalThis[_t]}var bt={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},xt=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,St={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:1/0,"-infinity":-1/0},Ct=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function wt(e){return e instanceof Date&&!isNaN(e.getTime())}function Tt(e){let t=Ct.exec(e);if(!t)return null;let[,n,r,i,a,o,s,c,l,u,d]=t,f=new Date(Date.UTC(parseInt(n,10),parseInt(r,10)-1,parseInt(i,10),parseInt(a,10),parseInt(o,10),parseInt(s,10),c?parseInt(c.padEnd(3,`0`),10):0));if(l){let e=(parseInt(u,10)*60+parseInt(d,10))*(l===`+`?-1:1);f.setUTCMinutes(f.getUTCMinutes()+e)}return wt(f)?f:null}function Et(e,t={}){let{strict:n=!1,warnings:r=!1,reviver:i,parseDates:a=!0}=t;if(typeof e!=`string`)return e;let o=e.trim(),s=o.toLowerCase();if(s.length<=9&&s in St)return St[s];if(!xt.test(o)){if(n)throw SyntaxError(`[better-json] Invalid JSON`);return e}if(Object.entries(bt).some(([e,t])=>{let n=t.test(o);return n&&r&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${e} pattern`),n})&&n)throw Error(`[better-json] Potential prototype pollution attempt detected`);try{return JSON.parse(o,(e,t)=>{if(e===`__proto__`||e===`constructor`&&t&&typeof t==`object`&&`prototype`in t){r&&console.warn(`[better-json] Dropping "${e}" key to prevent prototype pollution`);return}if(a&&typeof t==`string`){let e=Tt(t);if(e)return e}return i?i(e,t):t})}catch(t){if(n)throw t;return e}}function Dt(e,t={strict:!0}){return Et(e,t)}var k=[],A=0,j=4,Ot=globalThis.nanostoresGlobal||={epoch:0},kt=e=>{let t=[],n={get(){return n.lc||n.listen(()=>{})(),n.value},init:e,lc:0,listen(e){return n.lc=t.push(e),()=>{for(let t=A+j;t<k.length;)k[t]===e?k.splice(t,j):t+=j;let r=t.indexOf(e);~r&&(t.splice(r,1),--n.lc||n.off())}},notify(e,r){Ot.epoch++;let i=!k.length;for(let i of t)k.push(i,n.value,e,r);if(i){for(A=0;A<k.length;A+=j)k[A](k[A+1],k[A+2],k[A+3]);k.length=0}},off(){},set(e){let t=n.value;t!==e&&(n.value=e,n.notify(t))},subscribe(e){let t=n.listen(e);return e(n.value),t},value:e};return n},At=5,M=6,N=10,jt=(e,t,n,r)=>(e.events=e.events||{},e.events[n+N]||(e.events[n+N]=r(t=>{e.events[n].reduceRight((e,t)=>(t(e),e),{shared:{},...t})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let r=e.events[n],i=r.indexOf(t);r.splice(i,1),r.length||(delete e.events[n],e.events[n+N](),delete e.events[n+N])}),Mt=1e3,Nt=(e,t)=>jt(e,n=>{let r=t(n);r&&e.events[M].push(r)},At,t=>{let n=e.listen;e.listen=(...r)=>(!e.lc&&!e.active&&(e.active=!0,t()),n(...r));let r=e.off;return e.events[M]=[],e.off=()=>{r(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let t of e.events[M])t();e.events[M]=[]}},Mt)},()=>{e.listen=n,e.off=r}}),Pt=()=>typeof window>`u`,Ft=(e,t,n,r)=>{let i=kt({data:null,error:null,isPending:!0,isRefetching:!1,refetch:e=>a(e)}),a=async e=>new Promise(a=>{let o=typeof r==`function`?r({data:i.get().data,error:i.get().error,isPending:i.get().isPending}):r;n(t,{...o,query:{...o?.query,...e?.query},async onSuccess(e){i.set({data:e.data,error:null,isPending:!1,isRefetching:!1,refetch:i.value.refetch}),await o?.onSuccess?.(e)},async onError(e){let{request:t}=e,n=typeof t.retry==`number`?t.retry:t.retry?.attempts,r=t.retryAttempt||0;if(n&&r<n)return;let a=e.error.status===401;i.set({error:e.error,data:a?null:i.get().data,isPending:!1,isRefetching:!1,refetch:i.value.refetch}),await o?.onError?.(e)},async onRequest(e){let t=i.get();i.set({isPending:t.data===null,data:t.data,error:null,isRefetching:!0,refetch:i.value.refetch}),await o?.onRequest?.(e)}}).catch(e=>{i.set({error:e,data:i.get().data,isPending:!1,isRefetching:!1,refetch:i.value.refetch})}).finally(()=>{a(void 0)})});e=Array.isArray(e)?e:[e];let o=!1;for(let t of e)t.subscribe(async()=>{Pt()||(o?await a():Nt(i,()=>{let e=setTimeout(async()=>{o||(o=!0,await a())},0);return()=>{i.off(),t.off(),clearTimeout(e)}}))});return i},P=()=>Math.floor(Date.now()/1e3);function It(e){return typeof e==`object`&&e&&`data`in e&&`error`in e?e:{data:e,error:null}}var Lt=5;function Rt(e){let{sessionAtom:t,sessionSignal:n,$fetch:r,options:i={}}=e,a=i.sessionOptions?.refetchInterval??0,o=i.sessionOptions?.refetchOnWindowFocus??!0,s=i.sessionOptions?.refetchWhenOffline??!1,c={lastSync:0,lastSessionRequest:0,cachedSession:void 0},l=()=>s||yt().isOnline,u=e=>{if(!l())return;if(e?.event===`storage`){c.lastSync=P(),n.set(!n.get());return}let i=t.get(),a=()=>{c.lastSessionRequest=P(),r(`/get-session`).then(async e=>{let{data:a,error:o}=It(e);if(a?.needsRefresh)try{let e=await r(`/get-session`,{method:`POST`});({data:a,error:o}=It(e))}catch{}let s=a?.session&&a?.user?a:null;t.set({...i,data:s,error:o}),c.lastSync=P(),n.set(!n.get())}).catch(()=>{})};if(e?.event===`poll`){a();return}if(e?.event===`visibilitychange`){if(P()-c.lastSessionRequest<Lt)return;c.lastSessionRequest=P()}if(e?.event===`visibilitychange`){a();return}(i?.data===null||i?.data===void 0)&&(c.lastSync=P(),n.set(!n.get()))},d=e=>{pt().post({event:`session`,data:{trigger:e},clientId:Math.random().toString(36).substring(7)})},f=()=>{a&&a>0&&(c.pollInterval=setInterval(()=>{t.get()?.data&&u({event:`poll`})},a*1e3))},p=()=>{c.unsubscribeBroadcast=pt().subscribe(()=>{u({event:`storage`})})},m=()=>{o&&(c.unsubscribeFocus=gt().subscribe(()=>{u({event:`visibilitychange`})}))},h=()=>{c.unsubscribeOnline=yt().subscribe(e=>{e&&u({event:`visibilitychange`})})};return{init:()=>{f(),p(),m(),h(),pt().setup(),gt().setup(),yt().setup()},cleanup:()=>{c.pollInterval&&=(clearInterval(c.pollInterval),void 0),c.unsubscribeBroadcast&&=(c.unsubscribeBroadcast(),void 0),c.unsubscribeFocus&&=(c.unsubscribeFocus(),void 0),c.unsubscribeOnline&&=(c.unsubscribeOnline(),void 0),c.lastSync=0,c.lastSessionRequest=0,c.cachedSession=void 0},triggerRefetch:u,broadcastSessionUpdate:d}}var F=Object.create(null),I=e=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?F:globalThis),L=new Proxy(F,{get(e,t){return I()[t]??F[t]},has(e,t){return t in I()||t in F},set(e,t,n){let r=I(!0);return r[t]=n,!0},deleteProperty(e,t){if(!t)return!1;let n=I(!0);return delete n[t],!0},ownKeys(){let e=I(!0);return Object.keys(e)}});typeof process<`u`&&process.env;function R(e,t){return typeof process<`u`&&process.env?process.env[e]??t:typeof Deno<`u`?Deno.env.get(e)??t:typeof Bun<`u`?Bun.env[e]??t:t}Object.freeze({get BETTER_AUTH_SECRET(){return R(`BETTER_AUTH_SECRET`)},get AUTH_SECRET(){return R(`AUTH_SECRET`)},get BETTER_AUTH_TELEMETRY(){return R(`BETTER_AUTH_TELEMETRY`)},get BETTER_AUTH_TELEMETRY_ID(){return R(`BETTER_AUTH_TELEMETRY_ID`)},get NODE_ENV(){return R(`NODE_ENV`,`development`)},get PACKAGE_VERSION(){return R(`PACKAGE_VERSION`,`0.0.0`)},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return R(`BETTER_AUTH_TELEMETRY_ENDPOINT`,``)}});function zt(){let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):Object.prototype.hasOwnProperty.call(e,`writable`)?e.writable:e.set!==void 0}function Bt(e){let t=e.split(`
|
|
2
|
-
|
|
3
|
-
at `))}function Vt(e,t){class n extends e{#e;constructor(...e){if(zt()){let t=Error.stackTraceLimit;Error.stackTraceLimit=0,super(...e),Error.stackTraceLimit=t}else super(...e);let t=Error().stack;t&&(this.#e=Bt(t.replace(/^Error/,this.name)))}get errorStack(){return this.#e}}return Object.defineProperty(n.prototype,`constructor`,{get(){return t},enumerable:!1,configurable:!0}),n}var Ht={OK:200,CREATED:201,ACCEPTED:202,NO_CONTENT:204,MULTIPLE_CHOICES:300,MOVED_PERMANENTLY:301,FOUND:302,SEE_OTHER:303,NOT_MODIFIED:304,TEMPORARY_REDIRECT:307,BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_ALLOWED:405,NOT_ACCEPTABLE:406,PROXY_AUTHENTICATION_REQUIRED:407,REQUEST_TIMEOUT:408,CONFLICT:409,GONE:410,LENGTH_REQUIRED:411,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,URI_TOO_LONG:414,UNSUPPORTED_MEDIA_TYPE:415,RANGE_NOT_SATISFIABLE:416,EXPECTATION_FAILED:417,"I'M_A_TEAPOT":418,MISDIRECTED_REQUEST:421,UNPROCESSABLE_ENTITY:422,LOCKED:423,FAILED_DEPENDENCY:424,TOO_EARLY:425,UPGRADE_REQUIRED:426,PRECONDITION_REQUIRED:428,TOO_MANY_REQUESTS:429,REQUEST_HEADER_FIELDS_TOO_LARGE:431,UNAVAILABLE_FOR_LEGAL_REASONS:451,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,HTTP_VERSION_NOT_SUPPORTED:505,VARIANT_ALSO_NEGOTIATES:506,INSUFFICIENT_STORAGE:507,LOOP_DETECTED:508,NOT_EXTENDED:510,NETWORK_AUTHENTICATION_REQUIRED:511};Vt(class extends Error{constructor(e=`INTERNAL_SERVER_ERROR`,t=void 0,n={},r=typeof e==`number`?e:Ht[e]){super(t?.message,t?.cause?{cause:t.cause}:void 0),this.status=e,this.body=t,this.headers=n,this.statusCode=r,this.name=`APIError`,this.status=e,this.headers=n,this.statusCode=r,this.body=t}},Error);var z=class extends Error{constructor(e,t){super(e,t),this.name=`BetterAuthError`,this.message=e,this.stack=``}},Ut=47;function Wt(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===Ut;)t--;return t===e.length?e:e.slice(0,t)}function Gt(e){try{return(Wt(new URL(e).pathname)||`/`)!==`/`}catch{throw new z(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function Kt(e){try{let t=new URL(e);if(t.protocol!==`http:`&&t.protocol!==`https:`)throw new z(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){throw t instanceof z?t:new z(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}}function B(e,t=`/api/auth`){if(Kt(e),Gt(e))return e;let n=Wt(e);return!t||t===`/`?n:(t=t.startsWith(`/`)?t:`/${t}`,`${n}${t}`)}function qt(e,t){return!e||e.trim()===``?!1:t===`proto`?e===`http`||e===`https`:t===`host`?[/\.\./,/\0/,/[\s]/,/^[.]/,/[<>'"]/,/javascript:/i,/file:/i,/data:/i].some(t=>t.test(e))?!1:/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*(:[0-9]{1,5})?$/.test(e)||/^(\d{1,3}\.){3}\d{1,3}(:[0-9]{1,5})?$/.test(e)||/^\[[0-9a-fA-F:]+\](:[0-9]{1,5})?$/.test(e)||/^localhost(:[0-9]{1,5})?$/i.test(e):!1}function Jt(e,t,n,r,i){if(e)return B(e,t);if(r!==!1){let e=L.BETTER_AUTH_URL||L.NEXT_PUBLIC_BETTER_AUTH_URL||L.PUBLIC_BETTER_AUTH_URL||L.NUXT_PUBLIC_BETTER_AUTH_URL||L.NUXT_PUBLIC_AUTH_URL||(L.BASE_URL===`/`?void 0:L.BASE_URL);if(e)return B(e,t)}let a=n?.headers.get(`x-forwarded-host`),o=n?.headers.get(`x-forwarded-proto`);if(a&&o&&i&&qt(o,`proto`)&&qt(a,`host`))try{return B(`${o}://${a}`,t)}catch{}if(n){let e=Yt(n.url);if(!e)throw new z(`Could not get origin from request. Please provide a valid base URL.`);return B(e,t)}if(typeof window<`u`&&window.location)return B(window.location.origin,t)}function Yt(e){try{let t=new URL(e);return t.origin===`null`?null:t.origin}catch{return null}}var Xt=[`javascript:`,`data:`,`vbscript:`];function Zt(e){let t;try{t=new URL(e)}catch{return!0}return!Xt.includes(t.protocol)}var Qt={id:`redirect`,name:`Redirect`,hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&Zt(e.data.url)&&typeof window<`u`&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}};function $t(e,t){let n=kt(!1),r=Ft(n,`/get-session`,e,{method:`GET`}),i=()=>{};return Nt(r,()=>{let a=Rt({sessionAtom:r,sessionSignal:n,$fetch:e,options:t});return a.init(),i=a.broadcastSessionUpdate,()=>{a.cleanup()}}),{session:r,$sessionSignal:n,broadcastSessionUpdate:e=>i(e)}}function en(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)===`[object Module]`:!0}function tn(e,t,n=`.`,r){if(!en(t))return tn(e,{},n,r);let i={...t};for(let t of Object.keys(e)){if(t===`__proto__`||t===`constructor`)continue;let a=e[t];a!=null&&(r&&r(i,t,a,n)||(Array.isArray(a)&&Array.isArray(i[t])?i[t]=[...a,...i[t]]:en(a)&&en(i[t])?i[t]=tn(a,i[t],(n?`${n}.`:``)+t.toString(),r):i[t]=a))}return i}function nn(e){return(...t)=>t.reduce((t,n)=>tn(t,n,``,e),{})}var rn=nn(),an=Object.defineProperty,on=Object.defineProperties,sn=Object.getOwnPropertyDescriptors,cn=Object.getOwnPropertySymbols,ln=Object.prototype.hasOwnProperty,un=Object.prototype.propertyIsEnumerable,dn=(e,t,n)=>t in e?an(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,V=(e,t)=>{for(var n in t||={})ln.call(t,n)&&dn(e,n,t[n]);if(cn)for(var n of cn(t))un.call(t,n)&&dn(e,n,t[n]);return e},H=(e,t)=>on(e,sn(t)),fn=class extends Error{constructor(e,t,n){super(t||e.toString(),{cause:n}),this.status=e,this.statusText=t,this.error=n,Error.captureStackTrace(this,this.constructor)}},pn=async(e,t)=>{let n=t||{},r={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:n,hooks:r};for(let i of t?.plugins||[]){if(i.init){let r=await i.init?.call(i,e.toString(),t);n=r.options||n,e=r.url}r.onRequest.push(i.hooks?.onRequest),r.onResponse.push(i.hooks?.onResponse),r.onSuccess.push(i.hooks?.onSuccess),r.onError.push(i.hooks?.onError),r.onRetry.push(i.hooks?.onRetry)}return{url:e,options:n,hooks:r}},mn=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},hn=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}};function gn(e){if(typeof e==`number`)return new mn({type:`linear`,attempts:e,delay:1e3});switch(e.type){case`linear`:return new mn(e);case`exponential`:return new hn(e);default:throw Error(`Invalid retry strategy`)}}var _n=async e=>{let t={},n=async e=>typeof e==`function`?await e():e;if(e?.auth){if(e.auth.type===`Bearer`){let r=await n(e.auth.token);if(!r)return t;t.authorization=`Bearer ${r}`}else if(e.auth.type===`Basic`){let[r,i]=await Promise.all([n(e.auth.username),n(e.auth.password)]);if(!r||!i)return t;t.authorization=`Basic ${btoa(`${r}:${i}`)}`}else if(e.auth.type===`Custom`){let[r,i]=await Promise.all([n(e.auth.prefix),n(e.auth.value)]);if(!i)return t;t.authorization=`${r??``} ${i}`}}return t},vn=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function yn(e){let t=e.headers.get(`content-type`),n=new Set([`image/svg`,`application/xml`,`application/xhtml`,`application/html`]);if(!t)return`json`;let r=t.split(`;`).shift()||``;return vn.test(r)?`json`:n.has(r)||r.startsWith(`text/`)?`text`:`blob`}function bn(e){try{return JSON.parse(e),!0}catch{return!1}}function xn(e){if(e===void 0)return!1;let t=typeof e;return t===`string`||t===`number`||t===`boolean`||t===null?!0:t===`object`?Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name===`Object`||typeof e.toJSON==`function`:!1}function Sn(e){try{return JSON.parse(e)}catch{return e}}function Cn(e){return typeof e==`function`}function wn(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<`u`&&Cn(globalThis.fetch))return globalThis.fetch;if(typeof window<`u`&&Cn(window.fetch))return window.fetch;throw Error(`No fetch implementation found`)}async function Tn(e){let t=new Headers(e?.headers),n=await _n(e);for(let[e,r]of Object.entries(n||{}))t.set(e,r);if(!t.has(`content-type`)){let n=En(e?.body);n&&t.set(`content-type`,n)}return t}function En(e){return xn(e)?`application/json`:null}function Dn(e){if(!e?.body)return null;let t=new Headers(e?.headers);if(xn(e.body)&&!t.has(`content-type`)){for(let[t,n]of Object.entries(e?.body))n instanceof Date&&(e.body[t]=n.toISOString());return JSON.stringify(e.body)}return t.has(`content-type`)&&t.get(`content-type`)===`application/x-www-form-urlencoded`&&xn(e.body)?new URLSearchParams(e.body).toString():e.body}function On(e,t){if(t?.method)return t.method.toUpperCase();if(e.startsWith(`@`)){let n=e.split(`@`)[1]?.split(`/`)[0];return jn.includes(n)?n.toUpperCase():t?.body?`POST`:`GET`}return t?.body?`POST`:`GET`}function kn(e,t){let n;return!e?.signal&&e?.timeout&&(n=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:n,clearTimeout:()=>{n&&clearTimeout(n)}}}var An=class e extends Error{constructor(t,n){super(n||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,e.prototype)}};async function U(e,t){let n=await e[`~standard`].validate(t);if(n.issues)throw new An(n.issues);return n.value}var jn=[`get`,`post`,`put`,`patch`,`delete`],Mn=e=>({id:`apply-schema`,name:`Apply Schema`,version:`1.0.0`,async init(t,n){let r=e.plugins?.find(e=>e.schema?.config?t.startsWith(e.schema.config.baseURL||``)||t.startsWith(e.schema.config.prefix||``):!1)?.schema||e.schema;if(r){let e=t;r.config?.prefix&&e.startsWith(r.config.prefix)&&(e=e.replace(r.config.prefix,``),r.config.baseURL&&(t=t.replace(r.config.prefix,r.config.baseURL))),r.config?.baseURL&&e.startsWith(r.config.baseURL)&&(e=e.replace(r.config.baseURL,``));let i=r.schema[e];if(i){let e=H(V({},n),{method:i.method,output:i.output});return n?.disableValidation||(e=H(V({},e),{body:i.input?await U(i.input,n?.body):n?.body,params:i.params?await U(i.params,n?.params):n?.params,query:i.query?await U(i.query,n?.query):n?.query})),{url:t,options:e}}}return{url:t,options:n}}}),Nn=e=>{async function t(t,n){let r=H(V(V({},e),n),{plugins:[...e?.plugins||[],Mn(e||{}),...n?.plugins||[]]});if(e?.catchAllError)try{return await Fn(t,r)}catch(e){return{data:null,error:{status:500,statusText:`Fetch Error`,message:`Fetch related error. Captured by catchAllError option. See error property for more details.`,error:e}}}return await Fn(t,r)}return t};function Pn(e,t){let{baseURL:n,params:r,query:i}=t||{query:{},params:{},baseURL:``},a=e.startsWith(`http`)?e.split(`/`).slice(0,3).join(`/`):n||``;if(e.startsWith(`@`)){let t=e.toString().split(`@`)[1].split(`/`)[0];jn.includes(t)&&(e=e.replace(`@${t}/`,`/`))}a.endsWith(`/`)||(a+=`/`);let[o,s]=e.replace(a,``).split(`?`),c=new URLSearchParams(s);for(let[e,t]of Object.entries(i||{})){if(t==null)continue;let n;if(typeof t==`string`)n=t;else if(Array.isArray(t)){for(let n of t)c.append(e,n);continue}else n=JSON.stringify(t);c.set(e,n)}if(r)if(Array.isArray(r)){let e=o.split(`/`).filter(e=>e.startsWith(`:`));for(let[t,n]of e.entries()){let e=r[t];o=o.replace(n,e)}}else for(let[e,t]of Object.entries(r))o=o.replace(`:${e}`,String(t));o=o.split(`/`).map(encodeURIComponent).join(`/`),o.startsWith(`/`)&&(o=o.slice(1));let l=c.toString();return l=l.length>0?`?${l}`.replace(/\+/g,`%20`):``,a.startsWith(`http`)?new URL(`${o}${l}`,a):`${a}${o}${l}`}var Fn=async(e,t)=>{let{hooks:n,url:r,options:i}=await pn(e,t),a=wn(i),o=new AbortController,s=i.signal??o.signal,c=Pn(r,i),l=Dn(i),u=await Tn(i),d=On(r,i),f=H(V({},i),{url:c,headers:u,body:l,method:d,signal:s});for(let e of n.onRequest)if(e){let t=await e(f);typeof t==`object`&&t&&(f=t)}(`pipeTo`in f&&typeof f.pipeTo==`function`||typeof t?.body?.pipe==`function`)&&(`duplex`in f||(f.duplex=`half`));let{clearTimeout:p}=kn(i,o),m=await a(f.url,f);p();let h={response:m,request:f};for(let e of n.onResponse)if(e){let n=await e(H(V({},h),{response:t?.hookOptions?.cloneResponse?m.clone():m}));n instanceof Response?m=n:typeof n==`object`&&n&&(m=n.response)}if(m.ok){if(f.method===`HEAD`)return{data:``,error:null};let e=yn(m),r={data:null,response:m,request:f};if(e===`json`||e===`text`){let e=await m.text();r.data=await(f.jsonParser??Sn)(e)}else r.data=await m[e]();f?.output&&f.output&&!f.disableValidation&&(r.data=await U(f.output,r.data));for(let e of n.onSuccess)e&&await e(H(V({},r),{response:t?.hookOptions?.cloneResponse?m.clone():m}));return t?.throw?r.data:{data:r.data,error:null}}let g=t?.jsonParser??Sn,_=await m.text(),v=bn(_),y=v?await g(_):null,b={response:m,responseText:_,request:f,error:H(V({},y),{status:m.status,statusText:m.statusText})};for(let e of n.onError)e&&await e(H(V({},b),{response:t?.hookOptions?.cloneResponse?m.clone():m}));if(t?.retry){let r=gn(t.retry),i=t.retryAttempt??0;if(await r.shouldAttemptRetry(i,m)){for(let e of n.onRetry)e&&await e(h);let a=r.getDelay(i);return await new Promise(e=>setTimeout(e,a)),await Fn(e,H(V({},t),{retryAttempt:i+1}))}}if(t?.throw)throw new fn(m.status,m.statusText,v?y:_);return{data:null,error:H(V({},y),{status:m.status,statusText:m.statusText})}},In=e=>{if(typeof process>`u`)return;let t=e??`/api/auth`;if(process.env.NEXT_PUBLIC_AUTH_URL)return process.env.NEXT_PUBLIC_AUTH_URL;if(typeof window>`u`){if(process.env.NEXTAUTH_URL)try{return process.env.NEXTAUTH_URL}catch{}if(process.env.VERCEL_URL)try{let e=process.env.VERCEL_URL.startsWith(`http`)?``:`https://`;return`${new URL(`${e}${process.env.VERCEL_URL}`).origin}${t}`}catch{}}},Ln=(e,t)=>{let n=`credentials`in Request.prototype,r=Jt(e?.baseURL,e?.basePath,void 0,t)??In(e?.basePath)??`/api/auth`,i=e?.plugins?.flatMap(e=>e.fetchPlugins).filter(e=>e!==void 0)||[],a={id:`lifecycle-hooks`,name:`lifecycle-hooks`,hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:o,onError:s,onRequest:c,onResponse:l,...u}=e?.fetchOptions||{},d=Nn({baseURL:r,...n?{credentials:`include`}:{},method:`GET`,jsonParser(e){return e?Dt(e,{strict:!1}):null},customFetchImpl:fetch,...u,plugins:[a,...u.plugins||[],...e?.disableDefaultFetchPlugins?[]:[Qt],...i]}),{$sessionSignal:f,session:p,broadcastSessionUpdate:m}=$t(d,e),h=e?.plugins||[],g={},_={$sessionSignal:f,session:p},v={"/sign-out":`POST`,"/revoke-sessions":`POST`,"/revoke-other-sessions":`POST`,"/delete-user":`POST`},y=[{signal:`$sessionSignal`,matcher(e){return e===`/sign-out`||e===`/update-user`||e===`/update-session`||e===`/sign-up/email`||e===`/sign-in/email`||e===`/delete-user`||e===`/verify-email`||e===`/revoke-sessions`||e===`/revoke-session`||e===`/revoke-other-sessions`||e===`/change-email`||e===`/change-password`},callback(e){e===`/sign-out`?m(`signout`):(e===`/update-user`||e===`/update-session`)&&m(`updateUser`)}}];for(let e of h)e.getAtoms&&Object.assign(_,e.getAtoms?.(d)),e.pathMethods&&Object.assign(v,e.pathMethods),e.atomListeners&&y.push(...e.atomListeners);let b={notify:e=>{_[e].set(!_[e].get())},listen:(e,t)=>{_[e].subscribe(t)},atoms:_};for(let t of h)t.getActions&&(g=rn(t.getActions?.(d,b,e)??{},g));return{get baseURL(){return r},pluginsActions:g,pluginsAtoms:_,pluginPathMethods:v,atomListeners:y,$fetch:d,$store:b}};function Rn(e){return typeof e==`object`&&!!e&&`get`in e&&typeof e.get==`function`&&`lc`in e&&typeof e.lc==`number`}function zn(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Bn=/[\p{Ll}\d]+|\p{Lu}+(?!\p{Ll})|\p{Lu}[\p{Ll}\d]+|\p{Lo}+/gu,Vn=/['\u2019]/g;function Hn(e){return e.replace(Vn,``).match(Bn)??[]}function Un(e){return Hn(e).map(e=>e.toLowerCase()).join(`-`)}function Wn(e,t,n){let r=t[e],{fetchOptions:i,query:a,...o}=n||{};return r||(i?.method?i.method:o&&Object.keys(o).length>0?`POST`:`GET`)}function Gn(e,t,n,r,i){function a(o=[]){return new Proxy(function(){},{get(t,n){if(typeof n!=`string`||n===`then`||n===`catch`||n===`finally`)return;let r=[...o,n],i=e;for(let e of r)if(i&&typeof i==`object`&&e in i)i=i[e];else{i=void 0;break}return typeof i==`function`||Rn(i)?i:a(r)},apply:async(e,a,s)=>{let c=`/`+o.map(Un).join(`/`),l=s[0]||{},u=s[1]||{},{query:d,fetchOptions:f,...p}=l,m={...u,...f},h=Wn(c,n,l);return await t(c,{...m,body:h===`GET`?void 0:{...p,...m?.body||{}},query:d||m?.query,method:h,async onSuccess(e){if(await m?.onSuccess?.(e),!i||m.disableSignal)return;let t=i.filter(e=>e.matcher(c));if(!t.length)return;let n=new Set;for(let e of t){let t=r[e.signal];if(!t)return;if(n.has(e.signal))continue;n.add(e.signal);let i=t.get();setTimeout(()=>{t.set(!i)},10),e.callback?.(c)}}})}})}return a()}function Kn(e){let{pluginPathMethods:t,pluginsActions:n,pluginsAtoms:r,$fetch:i,atomListeners:a,$store:o}=Ln(e),s={};for(let[e,t]of Object.entries(r))s[`use${zn(e)}`]=t;return Gn({...n,...s,$fetch:i,$store:o},i,t,r,a)}var qn=`https://api.fkn.app`,Jn=qn,{signIn:Yn,signUp:Xn,signOut:Zn}=Kn({baseURL:qn}),Qn=e=>{let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)},$n=e=>{let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=atob(t),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r},er=`fkn-e2e`,tr=`keys`,nr=`dek`,rr=()=>new Promise((e,t)=>{let n=indexedDB.open(er,1);n.onupgradeneeded=()=>{n.result.createObjectStore(tr)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)}),ir=async(e,t)=>{let n=await rr();return new Promise((r,i)=>{let a=n.transaction(tr,e),o=t(a.objectStore(tr));o.onsuccess=()=>r(o.result),o.onerror=()=>i(o.error),a.oncomplete=()=>n.close()})},ar=()=>ir(`readonly`,e=>e.get(nr)),or=async(e,t)=>{let n=await ar();if(!n)throw Error(`no_dek`);let r=crypto.getRandomValues(new Uint8Array(12)),i={name:`AES-GCM`,iv:r};t&&(i.additionalData=t);let a=new Uint8Array(await crypto.subtle.encrypt(i,n,e)),o=new Uint8Array(r.length+a.length);return o.set(r),o.set(a,r.length),o},sr=async(e,t)=>{let n=await ar();if(!n)throw Error(`no_dek`);let r=e.slice(0,12),i=e.slice(12),a={name:`AES-GCM`,iv:r};return t&&(a.additionalData=t),new Uint8Array(await crypto.subtle.decrypt(a,n,i))},cr=`${Jn}/api/v1/storage`,lr=new TextEncoder,ur=(e,t)=>lr.encode(`${e}\0${t}`),W=async()=>{if(!await ar())throw Error(`no_dek`)},G=(e,t)=>fetch(`${cr}${e}`,{credentials:`include`,...t}),K=async e=>{let t=await e.json().catch(()=>null);if(!e.ok||!t)throw Error(t?.error??`storage_request_failed_${e.status}`);return t},dr={set:async(e,t,n)=>{await W();let r=await or(n,ur(e,t));await K(await G(`/set`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({namespace:e,key:t,value:Qn(r)})}))},get:async(e,t)=>{await W();let n=await G(`/get?namespace=${encodeURIComponent(e)}&key=${encodeURIComponent(t)}`,{method:`GET`});if(n.status===404)return null;let{value:r}=await K(n);return sr($n(r),ur(e,t))},list:async(e,t)=>(await W(),K(await G(`/list`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({namespace:e,limit:t?.limit,cursor:t?.cursor})}))),remove:async(e,t)=>{await W(),await K(await G(`/delete`,{method:`DELETE`,headers:{"content-type":`application/json`},body:JSON.stringify({namespace:e,key:t})}))}},fr=`fkn-premium`,q=`premium-tokens`,pr=()=>new Promise((e,t)=>{let n=indexedDB.open(fr,1);n.onupgradeneeded=()=>{n.result.createObjectStore(q,{autoIncrement:!0})},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)}),mr=async(e,t)=>{let n=await pr();return new Promise((r,i)=>{let a=n.transaction(q,e),o=t(a.objectStore(q));o.onsuccess=()=>r(o.result),o.onerror=()=>i(o.error),a.oncomplete=()=>n.close()})},hr=async e=>{let t=await pr();await new Promise((n,r)=>{let i=t.transaction(q,`readwrite`),a=i.objectStore(q);for(let t of e)a.add(t);i.oncomplete=()=>{t.close(),n()},i.onerror=()=>r(i.error)})},gr=()=>mr(`readonly`,e=>e.count()),_r=()=>mr(`readwrite`,e=>e.clear()),vr=new r.BlindRSA({name:`RSABSSA-SHA256-PSS-Deterministic`,hash:`SHA-256`,saltLength:32,prepareType:0,supportsRSARAW:!1}),yr=10,br=3,xr=`${Jn}/api/v1/tokens`,Sr=e=>$n(e.replace(`-----BEGIN PUBLIC KEY-----`,``).replace(`-----END PUBLIC KEY-----`,``).replace(/\s+/g,``).replace(/\+/g,`-`).replace(/\//g,`_`)),Cr=async e=>crypto.subtle.importKey(`spki`,Sr(e),{name:`RSA-PSS`,hash:`SHA-256`},!0,[`verify`]),wr=async()=>{let e=await fetch(`${xr}/pubkey`,{credentials:`include`}),t=await e.json().catch(()=>null);if(!e.ok||!t?.publicKey)throw Error(t?.error??`pubkey_failed_${e.status}`);return Cr(t.publicKey)},Tr=async e=>{let t=Array.from({length:yr},()=>({message:vr.prepare(crypto.getRandomValues(new Uint8Array(32)))})),n=await Promise.all(t.map(({message:t})=>vr.blind(e,t))),r=await fetch(xr,{method:`POST`,credentials:`include`,headers:{"content-type":`application/json`},body:JSON.stringify({blinded:n.map(({blindedMsg:e})=>Qn(e))})}),i=await r.json().catch(()=>null);if(!r.ok||!i?.signatures)throw Error(i?.error??`issue_failed_${r.status}`);let a=i.signatures;return Promise.all(t.map(async({message:t},r)=>{let i=$n(a[r]??``);return{message:t,signature:await vr.finalize(e,t,i,n[r].inv)}}))},Er=async()=>{await gr()>=br||await hr(await Tr(await wr()))},Dr=new TextEncoder;new TextDecoder;var Or=e=>o.Address4.isValid(e),kr=e=>o.Address6.isValid(e),Ar=e=>Or(e)?4:kr(e)?6:0,jr=(...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}},Mr=(...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}},Nr=(...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 Pr=e.g({Server:()=>Y,Socket:()=>J,_default:()=>Rr,connect:()=>Fr,createConnection:()=>Ir,createServer:()=>Lr,default:()=>Rr,isIP:()=>Ar,isIPv4:()=>Or,isIPv6:()=>kr}),J=class extends i.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=jr(...e),n=this.__webvpn_tcp_socket_init__(x.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}_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},Y=class extends a.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=jr(...e),n=e=>{let t=new J({connection:Promise.resolve(e)});this.emit(`connection`,t)},r=e=>x.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](){}},Fr=(e,t)=>new J().connect(e,t),Ir=(e,t)=>new J().connect(e,t),Lr=(e,t)=>{typeof e==`function`&&(t=e,e=void 0);let n=new Y(e);return t&&n.on(`connection`,t),n},Rr={Socket:J,Server:Y,connect:Fr,createConnection:Ir,createServer:Lr,isIP:Ar,isIPv4:Or,isIPv6:kr},zr=e.g({Socket:()=>Br,createSocket:()=>Hr}),Br=class extends a.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(o.Address4.isValid(e)){let n=X(e),r=t&&o.Address4.isValid(t)?X(t):new Uint8Array([0,0,0,0]);this._setUdpOption({type:5,group:n,interface:r})}else if(o.Address6.isValid(e)){let t=Vr(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=Mr(...e),n=this._type===`udp6`?`::`:`0.0.0.0`;return this._webVPNUdpSocketPromise=x.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`,s.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(o.Address4.isValid(e)){let n=X(e),r=t&&o.Address4.isValid(t)?X(t):new Uint8Array([0,0,0,0]);this._setUdpOption({type:6,group:n,interface:r})}else if(o.Address6.isValid(e)){let t=Vr(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=Nr(...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`?Dr.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)})}},X=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)},Vr=e=>{let t=new o.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)))},Hr=(e,t)=>{let n=new Br(typeof e==`string`?{type:e}:e);return t&&n.on(`message`,t),n},Ur=e.g({Agent:()=>oi,ClientRequest:()=>$,HTTPParser:()=>ei,IncomingMessage:()=>Q,METHODS:()=>Gr,STATUS_CODES:()=>Kr,Server:()=>ai,ServerResponse:()=>ri,_default:()=>di,createServer:()=>ui,default:()=>di,get:()=>li,globalAgent:()=>si,request:()=>ci}),Wr=new TextDecoder(`latin1`),Gr=`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(`.`),Kr={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`},qr=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`]),Jr=13,Yr=10,Xr=/^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/,Z=(e,t)=>(e.code=t,e),Zr=(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},Qr=(e,t)=>{for(let n=t;n+1<e.length;n++)if(e[n]===Jr&&e[n+1]===Yr)return n;return-1},$r=e=>{for(let t=0;t+3<e.length;t++)if(e[t]===Jr&&e[t+1]===Yr&&e[t+2]===Jr&&e[t+3]===Yr)return t;return-1},ei=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=Zr(this.buf,e);let t=!0;for(;t;)if(t=!1,this.state===`HEAD`){let e=$r(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=Wr.decode(e).split(`\r
|
|
4
|
-
`),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:qr.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=Qr(this.buf,0);if(e===-1)return!1;let t=Wr.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=Qr(this.buf,0);if(e===-1)return!1;let t=e===0;if(this.buf=this.buf.subarray(e+2),t)return!0}}},ti=(e,t)=>s.Buffer.isBuffer(e)?e:typeof e==`string`?s.Buffer.from(e,t??`utf8`):e instanceof Uint8Array?s.Buffer.from(e):e instanceof ArrayBuffer?s.Buffer.from(new Uint8Array(e)):s.Buffer.from(String(e)),Q=class extends i.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}},ni=class extends i.Stream.Writable{_headerStore=new Map;headersSent=!1;chunkedEncoding=!1;finished=!1;_bodyWritten=!1;setHeader(e,t){if(this.headersSent)throw Z(Error(`Cannot set headers after they are sent to the client`),`ERR_HTTP_HEADERS_SENT`);if(typeof e!=`string`||!Xr.test(e))throw Z(TypeError(`Header name must be a valid HTTP token [${JSON.stringify(String(e))}]`),`ERR_INVALID_HTTP_TOKEN`);if(t===void 0)throw Z(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
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./locator-Bz_60Zup.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(`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},x=(e=1e3)=>new Promise((t,n)=>{if(y())return t();let r=e=>{clearTimeout(s),a.disconnect(),document.removeEventListener(`readystatechange`,o),e()},i=()=>r(async()=>{if(b&&(await b().catch(()=>{}),y()))return t();n(Error(`The FKN WebExtension is not installed, enabled or not exposed on this page.`))}),a=new MutationObserver(()=>{y()&&r(t)}),o=()=>{document.readyState===`complete`&&!y()&&i()},s=setTimeout(i,e);if(document.readyState===`complete`)return i();a.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-fkn-extension`]}),document.addEventListener(`readystatechange`,o),y()&&r(t)}),pe,S=new Proxy({},{get:(n,r)=>async(...n)=>{await x(),pe??=(0,t.expose)({},{transport:window,revivableModules:e.l});let i=(await pe)[r];return i(...n)}}),me={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.`},he={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.`},ge=[`origin`,`referer`],_e=e=>{if(!e?.headers)return;let t=new Headers(e.headers),n=ge.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},ve=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:_e(t),reason:t?.reason,signal:t?.signal??void 0})},ye={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.`},be={get:e=>S.getCookie(e)},xe={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.`},Se=e=>S.setRequestHeaderRule(e),Ce=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`)},we={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.`},Te={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.`},Ee=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}},De={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 Oe=new TextEncoder;new TextDecoder;var O=e=>i.Address4.isValid(e),k=e=>i.Address6.isValid(e),A=e=>O(e)?4:k(e)?6:0,j=(...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}},ke=(...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}},Ae=(...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 je=e.g({Server:()=>N,Socket:()=>M,_default:()=>Me,connect:()=>P,createConnection:()=>F,createServer:()=>I,default:()=>Me,isIP:()=>A,isIPv4:()=>O,isIPv6:()=>k}),M=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=j(...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},N=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=j(...e),n=e=>{let t=new M({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](){}},P=(e,t)=>new M().connect(e,t),F=(e,t)=>new M().connect(e,t),I=(e,t)=>{typeof e==`function`&&(t=e,e=void 0);let n=new N(e);return t&&n.on(`connection`,t),n},Me={Socket:M,Server:N,connect:P,createConnection:F,createServer:I,isIP:A,isIPv4:O,isIPv6:k},Ne=e.g({Socket:()=>L,createSocket:()=>Pe}),L=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=R(e),r=t&&i.Address4.isValid(t)?R(t):new Uint8Array([0,0,0,0]);this._setUdpOption({type:5,group:n,interface:r})}else if(i.Address6.isValid(e)){let t=z(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=ke(...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=R(e),r=t&&i.Address4.isValid(t)?R(t):new Uint8Array([0,0,0,0]);this._setUdpOption({type:6,group:n,interface:r})}else if(i.Address6.isValid(e)){let t=z(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=Ae(...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`?Oe.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)})}},R=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)},z=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)))},Pe=(e,t)=>{let n=new L(typeof e==`string`?{type:e}:e);return t&&n.on(`message`,t),n},Fe=e.g({Agent:()=>Z,ClientRequest:()=>Y,HTTPParser:()=>W,IncomingMessage:()=>K,METHODS:()=>Le,STATUS_CODES:()=>B,Server:()=>X,ServerResponse:()=>J,_default:()=>$,createServer:()=>Ke,default:()=>$,get:()=>Ge,globalAgent:()=>We,request:()=>Q}),Ie=new TextDecoder(`latin1`),Le=`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`},Re=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,ze=/^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/,U=(e,t)=>(e.code=t,e),Be=(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},Ve=(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},W=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=Be(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=Ie.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:Re.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=Ve(this.buf,0);if(e===-1)return!1;let t=Ie.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=Ve(this.buf,0);if(e===-1)return!1;let t=e===0;if(this.buf=this.buf.subarray(e+2),t)return!0}}},G=(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`||!ze.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
|
|
5
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
|
|
6
|
-
`,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=
|
|
7
|
-
`,`latin1`))):i.push(r),i.length===0){n();return}this._writeToSocket(
|
|
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=G(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
|
+
`,`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
|
|
8
6
|
\r
|
|
9
|
-
`,`latin1`)),this.finished=!0,t.length===0){e();return}this._writeToSocket(
|
|
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`,G(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
|
|
10
8
|
\r
|
|
11
|
-
`,`latin1`),()=>{})}setTimeout(e,t){return this.socket?.setTimeout(e,t),this}},
|
|
9
|
+
`,`latin1`),()=>{})}setTimeout(e,t){return this.socket?.setTimeout(e,t),this}},Ue=(...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 M,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 W(`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 N{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 W(`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(){}},We=new Z,Q=(...e)=>{let{options:t,callback:n}=Ue(...e);return new Y(t,n)},Ge=(...e)=>{let t=Q(...e);return t.end(),t},Ke=(e,t)=>new X(e,t),$={METHODS:Le,STATUS_CODES:B,Agent:Z,globalAgent:We,Server:X,ServerResponse:J,IncomingMessage:K,ClientRequest:Y,OutgoingMessage:q,createServer:Ke,request:Q,get:Ge};exports.ATTACH_FRAME_EVENT_KEY=C,exports.assertAttachableFrameUrl=T,exports.attachFrame=Ee,exports.attachFramePermission=we,exports.box=e.u,exports.cookies=be,exports.createVideoElementHandle=e.d,Object.defineProperty(exports,`dgram`,{enumerable:!0,get:function(){return Ne}}),exports.extension=v,exports.fetch=ve,exports.fetchCredentialedPermission=he,exports.fetchPermission=me,exports.gotoPermission=Te,exports.handleRevivableModules=e.l,Object.defineProperty(exports,`http`,{enumerable:!0,get:function(){return Fe}}),exports.isBlockedFrameUrl=w,exports.isExtensionExposed=y,exports.isType=e.f,exports.modifyRequestHeadersPermission=xe,Object.defineProperty(exports,`net`,{enumerable:!0,get:function(){return je}}),exports.permissions=De,exports.promptInstall=E,exports.readCookiePermission=ye,exports.relayWorker=le,exports.removeRequestHeaderRule=Ce,exports.revive=e.p,exports.serverProxyFetch=se,exports.setMissingExtensionHandler=fe,exports.setRequestHeaderRule=Se,exports.type=e.m,exports.waitForExtensionExposure=x;
|
package/index.d.ts
CHANGED
|
@@ -267,8 +267,17 @@ type AddressLookupResult = {
|
|
|
267
267
|
};
|
|
268
268
|
|
|
269
269
|
declare const resolvers: {
|
|
270
|
+
readonly setOverlayHost: (push: (state: {
|
|
271
|
+
modal: boolean;
|
|
272
|
+
rects: {
|
|
273
|
+
x: number;
|
|
274
|
+
y: number;
|
|
275
|
+
width: number;
|
|
276
|
+
height: number;
|
|
277
|
+
}[];
|
|
278
|
+
}) => unknown) => void;
|
|
270
279
|
readonly showInstallPrompt: (reason?: string) => Promise<void>;
|
|
271
|
-
readonly hideInstallPrompt: () =>
|
|
280
|
+
readonly hideInstallPrompt: () => void;
|
|
272
281
|
readonly dnsLookup: <T extends boolean = false>(hostname: string, options?: {
|
|
273
282
|
all?: T;
|
|
274
283
|
family: 0 | 4 | 6;
|
|
@@ -346,33 +355,6 @@ declare const relayWorker: (worker: Worker, options?: {
|
|
|
346
355
|
|
|
347
356
|
declare const promptInstall: (reason?: string) => Promise<boolean>;
|
|
348
357
|
|
|
349
|
-
declare const changeIframeStyle: (style: Record<string, string>) => void;
|
|
350
|
-
declare const resetIframeStyle: () => void;
|
|
351
|
-
|
|
352
|
-
type StorageListItem = {
|
|
353
|
-
key: string;
|
|
354
|
-
updatedAt: string;
|
|
355
|
-
};
|
|
356
|
-
type StorageListResult = {
|
|
357
|
-
items: StorageListItem[];
|
|
358
|
-
nextCursor: string | null;
|
|
359
|
-
};
|
|
360
|
-
type StorageListOptions = {
|
|
361
|
-
limit?: number;
|
|
362
|
-
cursor?: string;
|
|
363
|
-
};
|
|
364
|
-
declare const storage: {
|
|
365
|
-
set: (namespace: string, key: string, value: Uint8Array) => Promise<void>;
|
|
366
|
-
get: (namespace: string, key: string) => Promise<Uint8Array | null>;
|
|
367
|
-
list: (namespace: string, opts?: StorageListOptions) => Promise<StorageListResult>;
|
|
368
|
-
remove: (namespace: string, key: string) => Promise<void>;
|
|
369
|
-
};
|
|
370
|
-
|
|
371
|
-
declare const refillPremiumTokens: () => Promise<void>;
|
|
372
|
-
|
|
373
|
-
declare const countTokens: () => Promise<number>;
|
|
374
|
-
declare const clearTokens: () => Promise<void>;
|
|
375
|
-
|
|
376
358
|
declare const isIPv4: (input: string) => boolean;
|
|
377
359
|
declare const isIPv6: (input: string) => boolean;
|
|
378
360
|
declare const isIP: (input: string) => 0 | 4 | 6;
|
|
@@ -435,6 +417,9 @@ declare class Socket$1 extends Stream.Duplex implements Socket$2 {
|
|
|
435
417
|
setKeepAlive(enable?: boolean | undefined, initialDelay?: number | undefined): this;
|
|
436
418
|
setSendBufferSize(size: number): this;
|
|
437
419
|
setRecvBufferSize(size: number): this;
|
|
420
|
+
_typeOfService?: number;
|
|
421
|
+
getTypeOfService(): number;
|
|
422
|
+
setTypeOfService(tos: number): this;
|
|
438
423
|
_setTcpOption(option: TcpSocketOption): void;
|
|
439
424
|
write(buffer: Uint8Array | string, cb?: (err?: Error) => void): boolean;
|
|
440
425
|
write(str: Uint8Array | string, encoding?: BufferEncoding, cb?: (err?: Error) => void): boolean;
|
|
@@ -1020,7 +1005,12 @@ declare const permission$7: {
|
|
|
1020
1005
|
readonly title: "Hover over the page";
|
|
1021
1006
|
readonly description: "Lets the app point at things to reveal menus or tooltips.";
|
|
1022
1007
|
};
|
|
1023
|
-
declare const resolve$9: (context: LocatorContext,
|
|
1008
|
+
declare const resolve$9: (context: LocatorContext, options?: OperationTimeoutOptions & {
|
|
1009
|
+
position?: {
|
|
1010
|
+
x?: number | undefined;
|
|
1011
|
+
y?: number | undefined;
|
|
1012
|
+
} | undefined;
|
|
1013
|
+
}) => void;
|
|
1024
1014
|
|
|
1025
1015
|
declare namespace hover {
|
|
1026
1016
|
export {
|
|
@@ -1312,9 +1302,16 @@ type LocatorChain<L extends LocatorKindModule, Self> = {
|
|
|
1312
1302
|
] extends [never] ? (...args: ExtractResolverArgs<M>) => Self : (...args: ExtractResolverArgs<M>) => NextLocator<M>;
|
|
1313
1303
|
} & {
|
|
1314
1304
|
[M in L['operationModules'][number] as ExtractType<M>]: (...args: ExtractOperationArgs<M>) => Promise<Awaited<ExtractResolverReturn<M>>>;
|
|
1305
|
+
} & {
|
|
1306
|
+
ensure: (operation: ExtractType<L['operationModules'][number]>, options?: {
|
|
1307
|
+
reason?: string;
|
|
1308
|
+
timeout?: number;
|
|
1309
|
+
} & Record<string, unknown>) => Promise<void>;
|
|
1315
1310
|
};
|
|
1316
1311
|
|
|
1317
1312
|
declare const ATTACH_FRAME_EVENT_KEY = "FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY";
|
|
1313
|
+
declare const isBlockedFrameUrl: (raw: string) => boolean;
|
|
1314
|
+
declare const assertAttachableFrameUrl: (raw: string) => void;
|
|
1318
1315
|
declare const attachFramePermission: {
|
|
1319
1316
|
readonly scope: "embed.iframe";
|
|
1320
1317
|
readonly category: "embed";
|
|
@@ -1591,5 +1588,5 @@ type MissingExtensionHandler = () => Promise<void>;
|
|
|
1591
1588
|
declare const setMissingExtensionHandler: (handler: MissingExtensionHandler | null) => void;
|
|
1592
1589
|
declare const waitForExtensionExposure: (timeout?: number) => Promise<void>;
|
|
1593
1590
|
|
|
1594
|
-
export { ATTACH_FRAME_EVENT_KEY, attachFrame, attachFramePermission, box,
|
|
1591
|
+
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 };
|
|
1595
1592
|
export type { AttachFrameOptions, BoxedVideoElement, CookieDetails, FetchInit, Frame, GotoOptions, HeaderOperation, PermissionGrant, PermissionRequest, ProxyFetchRequest, RemoteVideoElement, RequestHeaderRule, SiteCookie, VideoElementState };
|