@fkn/lib 0.9.36 → 0.9.38
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/{api-CaFuvyyV.d.ts → api-DF4nHz2Q.d.ts} +7 -7
- package/api.d.ts +2 -2
- package/attach-policy.cjs +1 -1
- package/attach-policy.js +1 -1
- package/cloud/dns.d.ts +1 -1
- package/cloud/fetch.d.ts +1 -1
- package/cloud/net.d.ts +1 -1
- package/cloud-Beg4iCRU.cjs +1 -0
- package/{cloud-Cqdq7Ujd.d.ts → cloud-Bfc6rkF2.d.ts} +3 -3
- package/cloud-EfyYfgVT.js +476 -0
- package/cloud.cjs +1 -1
- package/cloud.d.ts +3 -3
- package/cloud.js +1 -1
- package/{contract-BIHGp6cz.d.ts → contract-InuLU8bI.d.ts} +85 -7
- package/contract.cjs +1 -1
- package/contract.d.ts +2 -2
- package/contract.js +6 -6
- package/dgram.d.ts +2 -2
- package/dns.d.ts +1 -1
- package/extension-B7jDaJVp.cjs +1 -0
- package/{extension-C9BRlqEY.d.ts → extension-Bm5x5R4R.d.ts} +2 -2
- package/extension-sNRjVbET.js +89 -0
- package/extension.cjs +1 -1
- package/extension.d.ts +3 -3
- package/extension.js +3 -3
- package/hosts-9dYv63ud.cjs +1 -0
- package/{hosts-77UAJbm1.js → hosts-BzbzOhG8.js} +31 -19
- package/http.d.ts +1 -1
- package/{index-BWJSnpRB.d.ts → index-DiOxvYoa.d.ts} +170 -1
- package/index.cjs +1 -1
- package/index.d.ts +5 -5
- package/index.js +12 -12
- package/lib-DYKLnpWs.cjs +53 -0
- package/{lib-hd9k5xOX.js → lib-FD1Ssqjt.js} +461 -332
- package/{net-BWFTx3k_.d.ts → net-DnXxFGm8.d.ts} +2 -2
- package/net.d.ts +1 -1
- package/package.json +1 -1
- package/packages.d.ts +1 -1
- package/{proxy-DaljzPSa.d.ts → proxy-BkaVTZAf.d.ts} +2 -2
- package/rooms.cjs +1 -1
- package/rooms.d.ts +26 -8
- package/rooms.js +9 -1
- package/cloud-CDRoRstb.js +0 -428
- package/cloud-DG_-Rt-L.cjs +0 -1
- package/extension-DisWHU7m.cjs +0 -1
- package/extension-jDvl0U_P.js +0 -89
- package/hosts-COiOMjp-.cjs +0 -1
- package/lib-DCPdYk-N.cjs +0 -53
package/extension-jDvl0U_P.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { A as t, B as n, D as r, E as i, F as a, G as o, H as s, I as ee, J as c, K as l, L as te, M as ne, N as u, O as d, P as f, Q as p, R as m, S as h, U as g, V as _, W as v, Y as y, Z as b, _ as x, a as S, at as C, b as w, d as T, et as E, f as D, g as O, h as k, i as A, it as j, j as M, k as N, m as re, n as P, nt as F, ot as I, p as L, q as R, r as z, rt as B, t as V, tt as H, v as U, w as W, y as G, z as K } from "./lib-hd9k5xOX.js";
|
|
3
|
-
import { a as q, d as J } from "./api-CtiKFcK3.js";
|
|
4
|
-
import { t as Y } from "./proxy-DDwY3AVG.js";
|
|
5
|
-
import { available as X, fetch as ie } from "./desktop.js";
|
|
6
|
-
//#region src/extension-prompt.ts
|
|
7
|
-
var Z = async (e) => {
|
|
8
|
-
if (typeof window > "u") return !1;
|
|
9
|
-
if (l()) return !0;
|
|
10
|
-
let t = await q, n = null, r = new Promise((e) => {
|
|
11
|
-
n = () => {
|
|
12
|
-
l() && e(!0);
|
|
13
|
-
}, o.addEventListener("statuschange", n);
|
|
14
|
-
}), i = t.installPrompt.show(e).then(() => !1), a = await Promise.race([r, i]);
|
|
15
|
-
return n && o.removeEventListener("statuschange", n), await t.installPrompt.hide().catch(() => {}), a;
|
|
16
|
-
}, Q = null;
|
|
17
|
-
c(() => (Q ||= Z().then(() => void 0).finally(() => {
|
|
18
|
-
Q = null;
|
|
19
|
-
}), Q));
|
|
20
|
-
//#endregion
|
|
21
|
-
//#region src/auto.ts
|
|
22
|
-
var $ = () => typeof document < "u" && l(), ae = async (e, t) => {
|
|
23
|
-
if (J(e), t?.credentials === "include") {
|
|
24
|
-
if (typeof document > "u") throw Error("fetch with credentials needs the FKN extension, which only exists in window realms");
|
|
25
|
-
return a(e, t);
|
|
26
|
-
}
|
|
27
|
-
return $() ? a(e, {
|
|
28
|
-
...t,
|
|
29
|
-
credentials: "omit"
|
|
30
|
-
}) : X() ? ie(e, t) : Y(e, t);
|
|
31
|
-
}, oe = /* @__PURE__ */ e({
|
|
32
|
-
ATTACH_FRAME_EVENT_KEY: () => A,
|
|
33
|
-
CATEGORIES: () => d,
|
|
34
|
-
EXTENSION_ABI: () => 3,
|
|
35
|
-
ExtensionOperationUnsupportedError: () => b,
|
|
36
|
-
ExtensionOutdatedError: () => p,
|
|
37
|
-
FORGEABLE_HEADERS: () => _,
|
|
38
|
-
FrameWindowBlockedError: () => T,
|
|
39
|
-
FrameWindowRefusedError: () => D,
|
|
40
|
-
LOCATOR_DENIED: () => W,
|
|
41
|
-
LOCATOR_ERROR: () => r,
|
|
42
|
-
LOCATOR_UNSUPPORTED: () => w,
|
|
43
|
-
PERMISSION_DENIED: () => V,
|
|
44
|
-
REQUIRED_EXTENSION_ABI: () => 0,
|
|
45
|
-
assertAttachableFrameUrl: () => O,
|
|
46
|
-
assertFetchableUrl: () => f,
|
|
47
|
-
assertForgeableHeaders: () => s,
|
|
48
|
-
assertLockdownApplicable: () => x,
|
|
49
|
-
assertOneCookieIdentity: () => g,
|
|
50
|
-
attachFrame: () => S,
|
|
51
|
-
attachFramePermission: () => L,
|
|
52
|
-
available: () => $,
|
|
53
|
-
box: () => F,
|
|
54
|
-
cookies: () => ne,
|
|
55
|
-
createFrame: () => re,
|
|
56
|
-
createVideoElementHandle: () => B,
|
|
57
|
-
events: () => o,
|
|
58
|
-
extension: () => o,
|
|
59
|
-
fetch: () => a,
|
|
60
|
-
fetchCredentialedPermission: () => ee,
|
|
61
|
-
fetchLocalPermission: () => te,
|
|
62
|
-
fetchPermission: () => m,
|
|
63
|
-
gotoPermission: () => k,
|
|
64
|
-
handleRevivableModules: () => H,
|
|
65
|
-
hasForgedCookie: () => v,
|
|
66
|
-
isBlockedFetchUrl: () => K,
|
|
67
|
-
isBlockedFrameUrl: () => U,
|
|
68
|
-
isExtensionExposed: () => l,
|
|
69
|
-
isLocalNetworkUrl: () => n,
|
|
70
|
-
isLocatorDenied: () => G,
|
|
71
|
-
isLocatorUnsupported: () => h,
|
|
72
|
-
isPermissionDenied: () => P,
|
|
73
|
-
isTerminalError: () => i,
|
|
74
|
-
isType: () => j,
|
|
75
|
-
modifyRequestHeadersPermission: () => N,
|
|
76
|
-
permissions: () => z,
|
|
77
|
-
promptInstall: () => Z,
|
|
78
|
-
readCookiePermission: () => u,
|
|
79
|
-
readExtensionHandshake: () => R,
|
|
80
|
-
removeRequestHeaderRule: () => t,
|
|
81
|
-
revive: () => C,
|
|
82
|
-
setMissingExtensionHandler: () => c,
|
|
83
|
-
setRequestHeaderRule: () => M,
|
|
84
|
-
supportsOperation: () => E,
|
|
85
|
-
type: () => I,
|
|
86
|
-
waitForExtensionExposure: () => y
|
|
87
|
-
});
|
|
88
|
-
//#endregion
|
|
89
|
-
export { Z as i, ae as n, $ as r, oe as t };
|
package/hosts-COiOMjp-.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e={scope:`read.text`,category:`storage`,severity:1,chip:`read text`,title:`Read text from the page`,description:`Lets the app see the text shown on this page.`},t={scope:`read.info`,category:`storage`,severity:1,chip:`read details`,title:`Read info from the page`,description:`Lets the app read a detail of a part of the page.`},n={scope:`read.visible`,category:`storage`,severity:0,title:`See what’s visible on the page`,description:`Lets the app check which elements are currently on screen.`},r={scope:`read.check`,category:`storage`,severity:0,title:`Check if something is on the page`,description:`Lets the app test whether a specific element exists.`},i={scope:`read.count`,category:`storage`,severity:0,title:`Count items on the page`,description:`Lets the app count how many matching elements are present.`},a={scope:`act.click`,category:`interaction`,severity:3,chip:`click`,title:`Click on the page`,description:`Lets the app press buttons or links for you.`},o={scope:`act.type`,category:`interaction`,severity:1,chip:`type`,title:`Type into a text field`,description:`Lets the app fill in form fields on your behalf.`},s={scope:`act.hover`,category:`interaction`,severity:1,chip:`hover`,title:`Hover over the page`,description:`Lets the app point at things to reveal menus or tooltips.`},c={scope:`media.video`,category:`interaction`,severity:0,title:`Control video playback`,description:`Lets the app play, pause, seek, and read the video on the page.`},l={scope:`media.appear`,category:`interaction`,severity:0,title:`Change page appearance`,description:`Lets the app restyle parts of the page (safely filtered).`},u={scope:`media.appearU`,category:`evaluation`,severity:2,chip:`unfiltered styles`,unsafe:!0,title:`Change page appearance (unsafe)`,description:`Lets the app restyle the page WITHOUT safety filtering. Could be used to leak data over the network.`},d={scope:`frame.evaluate`,category:`evaluation`,severity:3,chip:`run code`,unsafe:!0,title:`Run the app’s code on this site`,description:`Lets the app run its own script inside this site, with full access to the page and the data it shows.`},f=e=>e?.noSanitize?u:l,p={scope:`frame.fetchRead`,category:`network`,severity:3,chip:`load`,unsafe:!0,title:`Read your account data on this site`,description:`Lets the app read pages and data from this site as you, using the session in the frame.`},m={scope:`frame.fetchWrite`,category:`network`,severity:3,chip:`send`,unsafe:!0,title:`Change your account data on this site`,description:`Lets the app send changes to this site as you, using the session in the frame.`},h=new Set([`GET`,`HEAD`,`OPTIONS`]),g=(e,t)=>h.has((t?.method??`GET`).toUpperCase())?p:m,_={click:a,fill:o,hover:s,textContent:e,getAttribute:t,isVisible:n,count:i,exists:r,videoElement:c,addStyleTag:f,fetch:g,evaluate:d};[e,t,n,r,i,a,o,s,c,l,u,p,m,d].map(e=>e.scope);var v=_,y=(e,t)=>{let n=v[e];return n?(typeof n==`function`?n(...t):n).scope:null},b=(e,t)=>{try{return new URL(e,t)}catch{return}},x=e=>{let t=b(e,`https://s.invalid/`),n=b(e,`http://s.invalid/`);if(!t||!n)return{kind:`invalid`};let r=b(e);return!r||r.href!==t.href||r.href!==n.href?{kind:`relative`}:r.protocol!==`https:`&&r.protocol!==`http:`?{kind:`unsupported`,protocol:r.protocol}:{kind:`absolute`,host:r.hostname,protocol:r.protocol}},S=/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/,C=/^\[[0-9a-f:.]+\]$/,w=e=>{try{return new URL(`http://${e}/`).hostname}catch{return}},T=(e,{ipv6:t=!1}={})=>{let n=[];for(let r of e){let e=r.trim().toLowerCase();if(!e||e.length>253)continue;let i=S.test(e)?e:t&&C.test(e)?w(e):void 0;i&&!n.includes(i)&&n.push(i)}return n};Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return n}});
|
package/lib-DCPdYk-N.cjs
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./hosts-COiOMjp-.cjs");let n=require("osra");var r=(e,t)=>{let n=new EventTarget,r=new Map,i=EventTarget.prototype.addEventListener.bind(n),a=EventTarget.prototype.removeEventListener.bind(n);return Object.defineProperty(n,"addEventListener",{configurable:!0,value:(a,o,s)=>{if(o!==null){if(!r.has(a)){let i=r=>{n.dispatchEvent(new CustomEvent(a,{detail:t(r,e),bubbles:r.bubbles,cancelable:r.cancelable,composed:r.composed}))};e.addEventListener(a,i),r.set(a,i)}i(a,o,s)}}}),Object.defineProperty(n,"removeEventListener",{configurable:!0,value:(t,n,i)=>{if(n===null)return;a(t,n,i);let o=r.get(t);o&&(e.removeEventListener(t,o),r.delete(t))}}),n},i=e=>typeof e==`boolean`?+!!e:+!!e?.capture,a=e=>{let t=new WeakMap;return{addEventListener:(n,r,a)=>{if(r===null)return;let o=`${n}|${i(a)}`,s=t.get(r);if(s||(s=new Map,t.set(r,s)),s.has(o))return;let c=typeof a==`object`&&!!a&&!!a.once,l=t=>{c&&s.delete(o);let i=e.unenrich(t,n);typeof r==`function`?r.call(e.target,i):r.handleEvent(i)};s.set(o,l),e.remoteEvents.addEventListener(n,l,a)},removeEventListener:(n,r,a)=>{if(r===null)return;let o=`${n}|${i(a)}`,s=t.get(r),c=s?.get(o);c&&(e.remoteEvents.removeEventListener(n,c,a),s.delete(o))},dispatchEvent:t=>e.remoteEvents.dispatchEvent(t)}},o=e.t({box:()=>S,createVideoElementHandle:()=>b,isType:()=>x,revive:()=>C,type:()=>s}),s=`videoElement`,c=[`currentTime`,`volume`,`muted`,`playbackRate`,`src`,`loop`,`autoplay`,`preload`,`poster`,`disableRemotePlayback`],l=[`duration`,`paused`,`ended`,`seeking`,`readyState`,`currentSrc`],u=[`buffered`,`seekable`],d=Symbol.for(`fkn.remoteVideoElement`),f=Symbol.for(`fkn.remoteVideoElement.state`),p=Symbol.for(`fkn.remoteVideoElement.controller`),m=e=>e?Array.from({length:e.length},(t,n)=>[e.start(n),e.end(n)]):[],h=e=>{let t={};for(let n of[...c,...l])t[n]=e[n];for(let n of u)t[n]=m(e[n]);return t.error=e.error?{code:e.error.code,message:e.error.message}:null,t},g=e=>{let t=t=>{if(!Number.isInteger(t)||t<0||t>=e.length)throw new DOMException(`Index or size is negative or greater than the allowed amount`,`IndexSizeError`)};return{get length(){return e.length},start(n){return t(n),e[n][0]},end(n){return t(n),e[n][1]}}},ee=e=>e?{code:e.code,message:e.message,MEDIA_ERR_ABORTED:1,MEDIA_ERR_NETWORK:2,MEDIA_ERR_DECODE:3,MEDIA_ERR_SRC_NOT_SUPPORTED:4}:null,_=e=>r(e,(e,t)=>({originalDetail:e instanceof CustomEvent?e.detail:null,snapshot:h(t)})),v=async(e,t)=>{switch(t){case`play`:return await e.play(),null;case`pause`:return e.pause(),null;case`load`:return e.load(),null;case`requestPictureInPicture`:if(typeof e.requestPictureInPicture!=`function`)throw Error(`requestPictureInPicture is not supported in this environment`);return await e.requestPictureInPicture(),null;case`exitPictureInPicture`:{let t=e.ownerDocument;if(typeof t?.exitPictureInPicture!=`function`)throw Error(`exitPictureInPicture is not supported in this environment`);return await t.exitPictureInPicture(),null}default:throw Error(`videoElement: unknown method "${t}"`)}},te=e=>({call:async t=>v(e,t),set:async(t,n)=>{try{e[t]=n}catch{}return h(e)},events:_(e)}),y=(e,t)=>{let n=new EventTarget;Object.defineProperty(n,d,{value:!0}),Object.defineProperty(n,f,{value:e}),Object.defineProperty(n,p,{value:t});let r=a({target:n,remoteEvents:t.events,unenrich:(t,n)=>{if(!(t instanceof CustomEvent))return t;let r=t.detail;if(!r||!(`snapshot`in r))return t;Object.assign(e,r.snapshot);let i={bubbles:t.bubbles,cancelable:t.cancelable,composed:t.composed};return r.originalDetail===null?new Event(n,i):new CustomEvent(n,{...i,detail:r.originalDetail})}}),i={addEventListener:{configurable:!0,value:r.addEventListener},removeEventListener:{configurable:!0,value:r.removeEventListener},dispatchEvent:{configurable:!0,value:r.dispatchEvent},error:{configurable:!0,enumerable:!0,get(){return ee(e.error)}},play:{configurable:!0,value:()=>t.call(`play`,[])},pause:{configurable:!0,value:()=>{t.call(`pause`,[]).catch(()=>{})}},load:{configurable:!0,value:()=>{t.call(`load`,[]).catch(()=>{})}},requestPictureInPicture:{configurable:!0,value:()=>t.call(`requestPictureInPicture`,[])},exitPictureInPicture:{configurable:!0,value:()=>t.call(`exitPictureInPicture`,[])},HAVE_FUTURE_DATA:{enumerable:!0,value:3},HAVE_ENOUGH_DATA:{enumerable:!0,value:4}};for(let n of c)i[n]={configurable:!0,enumerable:!0,get(){return e[n]},set(r){e[n]=r,t.set(n,r).then(t=>{Object.assign(e,t)},()=>{})}};for(let t of l)i[t]={configurable:!0,enumerable:!0,get(){return e[t]}};for(let t of u)i[t]={configurable:!0,enumerable:!0,get(){return g(e[t])}};return Object.defineProperties(n,i),n},b=e=>y(h(e),te(e)),x=e=>typeof e==`object`&&!!e&&e[d]===!0,S=(e,t)=>{let r=e;return{...n.BoxBase,type:s,initialState:r[f],controller:(0,n.recursiveBox)(r[p],t)}},C=(e,t)=>{let r=(0,n.recursiveRevive)(e.controller,t);return y({...e.initialState},r)},w=e=>[o,...e],ne=3,re=0,ie=`fknExtension`,ae=`fknExtensionAbi`,oe=`fknExtensionOps`,se=[`data-fkn-extension`,`data-fkn-extension-abi`,`data-fkn-extension-ops`],ce=e=>{if(e===void 0)return 0;let t=Number(e);return Number.isInteger(t)&&t>=0?t:0},le=e=>e===void 0?null:e.split(`,`).map(e=>e.trim()).filter(Boolean),ue=(e,t=0)=>{if(e.fknExtension!==`true`)return{status:`absent`};let n=ce(e[ae]),r=le(e[oe]);return n<t?{status:`outdated`,abi:n,required:t,operations:r}:{status:`ok`,abi:n,operations:r}},de=(e,t)=>e.status===`ok`?e.operations===null||e.operations.includes(t):!1,fe=(e,t)=>e.status===`ok`&&e.operations!==null&&e.operations.includes(t),T=class extends Error{abi;required;name=`ExtensionOutdatedError`;constructor(e,t){super(`The FKN WebExtension is installed but too old for this page: it speaks ABI ${e} and this page needs at least ${t}. Updating the extension fixes this.`),this.abi=e,this.required=t}},E=class extends Error{operation;abi;name=`ExtensionOperationUnsupportedError`;constructor(e,t,n){super(n??`The FKN WebExtension does not support "${e}" (ABI ${t}). Updating the extension may add it.`),this.operation=e,this.abi=t}},pe=`FKN_WEB_EXTENSION_MAIN_WORLD_CONTENT_SCRIPT_ENABLED_EVENT_KEY`,me=ie,he=(0,n.createTypedEventTarget)();typeof document<`u`&&document.addEventListener(pe,()=>{he.dispatchEvent(new CustomEvent(`statuschange`,{detail:{enabled:ge()}}))});var ge=()=>typeof document>`u`?!1:document.documentElement.dataset[me]===`true`,D=()=>typeof document>`u`?{status:`absent`}:ue(document.documentElement.dataset),O=null,_e=e=>{O=e},ve=150,k=(e=1e3)=>new Promise((t,n)=>{let r=()=>D().status===`ok`;if(r())return t();let i,a=e=>{clearTimeout(i),c.disconnect(),document.removeEventListener(`readystatechange`,l),e()},o=()=>a(async()=>{let e=D();if(e.status===`outdated`)return n(new T(e.abi,e.required));if(O){if(await O().catch(()=>{}),r())return t();let e=D();if(e.status===`outdated`)return n(new T(e.abi,e.required))}n(Error(`The FKN WebExtension is not installed, enabled or not exposed on this page.`))}),s=()=>{clearTimeout(i),i=setTimeout(()=>r()?a(t):o(),ve)},c=new MutationObserver(()=>{r()&&a(t)}),l=()=>{document.readyState===`complete`&&!r()&&s()};if(i=setTimeout(o,e),c.observe(document.documentElement,{attributes:!0,attributeFilter:[...se]}),document.addEventListener(`readystatechange`,l),document.readyState===`complete`)return s();r()&&a(t)}),ye,A=new Proxy({},{get:(e,t)=>async(...e)=>{await k(),ye??=(0,n.expose)({},{transport:window,revivableModules:w});let r=(await ye)[t];return r(...e)}}),j=[`origin`,`referer`,`cookie`],be=(e,t)=>(e??[]).some(([e,n])=>e.trim().toLowerCase()===t&&n!==``),xe=e=>be(e,`cookie`),Se=(e,t)=>{if(t===`include`&&xe(e))throw Error(`fetch: a forged Cookie header and credentials:'include' are different identities - send one or the other`)},Ce=e=>{let t=[...new Set((e??[]).map(([e])=>e.trim().toLowerCase()).filter(e=>!j.includes(e)))];if(t.length)throw Error(`fetch: refusing to forge request header(s): ${t.join(`, `)}`)},we=[`fkn.app`,`fkn.dev`,`sdbx.app`],Te=e=>e.replace(/\.+$/,``),Ee=e=>{let t=Te(e);return we.some(e=>t===e||t.endsWith(`.${e}`))},De={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.`},Oe={scope:`network.fetchCredentialed`,category:`network`,severity:3,chip:`load as you`,unsafe:!0,title:`Fetch from other sites, signed in as you`,description:`Lets the app fetch other sites using your logged-in session cookies, so it can read data only you should see.`},ke={scope:`network.fetchLocal`,category:`network`,severity:3,chip:`local network`,unsafe:!0,title:`Access devices on your local network`,description:`Lets the app reach devices and services on your home or work network, which websites normally cannot touch.`},Ae=e=>{let t=e.match(/^(\d+)\.(\d+)\.\d+\.\d+$/);if(!t)return!1;let[n,r]=[Number(t[1]),Number(t[2])];return n===10||n===127||n===0||n===169&&r===254||n===172&&r>=16&&r<=31||n===192&&r===168},je=e=>{let t;try{t=new URL(e)}catch{return!1}let n=t.hostname.replace(/^\[|\]$/g,``).toLowerCase().replace(/\.$/,``);return n===`localhost`||n.endsWith(`.localhost`)||n.endsWith(`.local`)||n.endsWith(`.internal`)||n.endsWith(`.home.arpa`)?!0:n.includes(`:`)?n===`::`||n===`::1`||n.startsWith(`fc`)||n.startsWith(`fd`)||/^fe[89ab]/.test(n)||n.startsWith(`::ffff:`):Ae(n)},Me=e=>{let t;try{t=new URL(e)}catch{return!1}return t.protocol===`chrome-extension:`||t.protocol===`moz-extension:`||Ee(t.hostname)},Ne=e=>{if(Me(e))throw Error(`fetch: refusing to target the extension's own pages or FKN platform domains`)},Pe=e=>{if(!e?.headers)return;let t=new Headers(e.headers),n=j.map(e=>{let n=t.get(e);return n===null||n===``?void 0:[e,n]}).filter(e=>e!==void 0);return n.length?n:void 0},Fe=async(e,t)=>{let n=new Request(e,t);Ne(n.url);let r=n.body?await n.arrayBuffer():null;return A.proxyFetch({url:n.url,method:n.method,headers:[...n.headers],body:r,credentials:t?.credentials===`include`?`include`:`omit`,redirect:n.redirect,unsafeHeaders:Pe(t),reason:t?.reason,signal:t?.signal??void 0})},Ie={scope:`network.readCookie`,category:`network`,severity:3,chip:`read cookie`,unsafe:!0,title:`Read a site’s cookie`,description:`Lets the app read a named cookie from another site, which can include the login token only that site should see.`},Le={get:e=>A.getCookie(e)},Re={scope:`network.modifyRequestHeaders`,category:`network`,severity:2,chip:`rewrite headers`,unsafe:!0,title:`Rewrite request headers to other sites`,description:`Lets the app set or remove headers (like Origin and Referer) on this page’s own requests to the listed sites.`},ze=e=>A.setRequestHeaderRule(e),Be=e=>A.removeRequestHeaderRule({ruleId:e}),Ve=()=>{let e=D();return e.status===`ok`&&e.abi>=2},He=async()=>{await k();let e=D();if(e.status===`ok`&&e.abi<2)throw new T(e.abi,2)},Ue=e=>`Read the text, links and details ${e} shows.`,We=e=>`Inject unfiltered styles or code into ${e}. This can pass page details along to other sites.`,Ge=[{id:`interaction`,heading:`Interaction`,summary:`Allow the app to interact with the website (clicks, type in text, etc.)`,title:e=>`Interact with ${e}`,description:(e,t)=>t?`Click, type and hover on ${e} for you. If you are signed in there, this happens as you.`:`Click, type and hover on ${e} for you, in a signed-out view.`,cloudTitle:e=>`Click and type on ${e}`,cloudDescription:e=>`Clicks, types and scrolls on ${e} for you.`},{id:`storage`,heading:`Site data`,summary:`Can read the website's data`,title:e=>`Read data from ${e}`,description:Ue,cloudTitle:e=>`Read what's on ${e}`,cloudDescription:Ue},{id:`network`,heading:`Network`,summary:`Make requests on behalf of the website (using your cookies, etc.)`,title:e=>`Make requests to ${e} as you`,description:e=>`Load pages and data from ${e} and send changes there with your signed-in session.`,cloudTitle:e=>`Load and send data on ${e}`,cloudDescription:e=>`Loads pages and data from ${e} and sends changes there.`},{id:`evaluation`,heading:`Evaluation`,summary:`Can execute arbitrary code on the website`,title:e=>`Run code on ${e}`,description:We,cloudTitle:e=>`Run its own code on ${e}`,cloudDescription:We}],Ke=class extends Error{reason;filename;line;column;source;constructor(e,t,n,r,i){super(`${e}:${n}:${r}: ${t}`),this.reason=t,this.filename=e,this.line=n,this.column=r,this.source=i}},qe=class{start;end;source;constructor(e,t,n){this.start=e,this.end=t,this.source=n}},M;(function(e){e.stylesheet=`stylesheet`,e.rule=`rule`,e.declaration=`declaration`,e.comment=`comment`,e.atRule=`at-rule`,e.container=`container`,e.charset=`charset`,e.counterStyle=`counter-style`,e.document=`document`,e.customMedia=`custom-media`,e.fontFace=`font-face`,e.fontFeatureValues=`font-feature-values`,e.host=`host`,e.import=`import`,e.keyframes=`keyframes`,e.keyframe=`keyframe`,e.layer=`layer`,e.media=`media`,e.namespace=`namespace`,e.page=`page`,e.pageMarginBox=`page-margin-box`,e.positionTry=`position-try`,e.property=`property`,e.scope=`scope`,e.startingStyle=`starting-style`,e.supports=`supports`,e.viewTransition=`view-transition`})(M||={});var Je=(e,t,n)=>{let r=n,i=1e4;do{let n=t.map(t=>e.indexOf(t,r));n.push(e.indexOf(`\\`,r));let a=n.filter(e=>e!==-1);if(a.length===0)return-1;let o=Math.min(...a);if(e[o]!==`\\`)return o;r=o+2,i--}while(i>0);throw Error(`Too many escaping`)},N=(e,t,n)=>{let r=n,i=1e4;do{let n=t.map(t=>e.indexOf(t,r));n.push(e.indexOf(`(`,r)),n.push(e.indexOf(`"`,r)),n.push(e.indexOf(`'`,r)),n.push(e.indexOf(`\\`,r));let a=n.filter(e=>e!==-1);if(a.length===0)return-1;let o=Math.min(...a);switch(e[o]){case`\\`:r=o+2;break;case`(`:{let t=N(e,[`)`],o+1);if(t===-1)return-1;r=t+1}break;case`"`:{let t=Je(e,[`"`],o+1);if(t===-1)return-1;r=t+1}break;case`'`:{let t=Je(e,[`'`],o+1);if(t===-1)return-1;r=t+1}break;default:return o}i--}while(i>0);throw Error(`Too many escaping`)},P=/\/\*[^]*?(?:\*\/|$)/g;function F(e){return e?e.trim():``}function I(e,t){let n=e&&typeof e.type==`string`,r=n?e:t;for(let t in e){let n=e[t];Array.isArray(n)?n.forEach(e=>{I(e,r)}):n&&typeof n==`object`&&I(n,r)}return n&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var Ye=class{level=0;indentation=` `;compress=!1;constructor(e){typeof e?.indent==`string`&&(this.indentation=e?.indent),e?.compress&&(this.compress=!0)}emit(e,t){return e}indent(e){return this.level=this.level||1,e?(this.level+=e,``):Array(this.level).join(this.indentation)}visit(e){switch(e.type){case M.stylesheet:return this.stylesheet(e);case M.rule:return this.rule(e);case M.declaration:return this.declaration(e);case M.comment:return this.comment(e);case M.container:return this.container(e);case M.charset:return this.charset(e);case M.counterStyle:return this.counterStyle(e);case M.document:return this.document(e);case M.customMedia:return this.customMedia(e);case M.fontFace:return this.fontFace(e);case M.fontFeatureValues:return this.fontFeatureValues(e);case M.host:return this.host(e);case M.import:return this.import(e);case M.keyframes:return this.keyframes(e);case M.keyframe:return this.keyframe(e);case M.layer:return this.layer(e);case M.media:return this.media(e);case M.namespace:return this.namespace(e);case M.page:return this.page(e);case M.pageMarginBox:return this.pageMarginBox(e);case M.positionTry:return this.positionTry(e);case M.property:return this.property(e);case M.scope:return this.scope(e);case M.startingStyle:return this.startingStyle(e);case M.supports:return this.supports(e);case M.viewTransition:return this.viewTransition(e);case M.atRule:return this.genericAtRule(e)}}mapVisit(e,t){let n=``;t||=``;for(let r=0,i=e.length;r<i;r++)n+=this.visit(e[r]),t&&r<i-1&&(n+=this.emit(t));return n}compile(e){return this.compress?e.stylesheet.rules.map(this.visit,this).join(``):this.stylesheet(e)}stylesheet(e){return this.mapVisit(e.stylesheet.rules,`
|
|
2
|
-
|
|
3
|
-
`)}comment(e){return this.compress?this.emit(``,e.position):this.emit(`${this.indent()}/*${e.comment}*/`,e.position)}container(e){return this.compress?this.emit(`@container ${e.container}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@container ${e.container}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
4
|
-
|
|
5
|
-
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}layer(e){return this.compress?this.emit(`@layer ${e.layer}`,e.position)+(e.rules?this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):`;`):this.emit(`${this.indent()}@layer ${e.layer}`,e.position)+(e.rules?this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
6
|
-
|
|
7
|
-
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`):`;`)}import(e){return this.emit(`@import ${e.import};`,e.position)}media(e){return this.compress?this.emit(`@media ${e.media}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@media ${e.media}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
8
|
-
|
|
9
|
-
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}document(e){let t=`@${e.vendor||``}document ${e.document}`;return this.compress?this.emit(t,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(t,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
10
|
-
|
|
11
|
-
`)+this.emit(`${this.indent(-1)}\n}`)}charset(e){return this.emit(`@charset ${e.charset};`,e.position)}namespace(e){return this.emit(`@namespace ${e.namespace};`,e.position)}startingStyle(e){return this.compress?this.emit(`@starting-style`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@starting-style`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
12
|
-
|
|
13
|
-
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}supports(e){return this.compress?this.emit(`@supports ${e.supports}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@supports ${e.supports}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
14
|
-
|
|
15
|
-
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}keyframes(e){return this.compress?this.emit(`@${e.vendor||``}keyframes ${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.keyframes)+this.emit(`}`):this.emit(`@${e.vendor||``}keyframes ${e.name}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.keyframes,`
|
|
16
|
-
`)+this.emit(`${this.indent(-1)}}`)}keyframe(e){let t=e.declarations;return this.compress?this.emit(e.values.join(`,`),e.position)+this.emit(`{`)+this.mapVisit(t)+this.emit(`}`):this.emit(this.indent())+this.emit(e.values.join(`, `),e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(t,`
|
|
17
|
-
`)+this.emit(`${this.indent(-1)}\n${this.indent()}}\n`)}page(e){if(this.compress){let t=e.selectors.length?e.selectors.join(`, `):``;return this.emit(`@page ${t}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`)}let t=e.selectors.length?`${e.selectors.join(`, `)} `:``;return this.emit(`@page ${t}`,e.position)+this.emit(`{
|
|
18
|
-
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
19
|
-
`)+this.emit(this.indent(-1))+this.emit(`
|
|
20
|
-
}`)}pageMarginBox(e){return this.compress?this.emit(`@${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`${this.indent()}@${e.name} `,e.position)+this.emit(`{
|
|
21
|
-
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
22
|
-
`)+this.emit(this.indent(-1))+this.emit(`\n${this.indent()}}`)}fontFace(e){return this.compress?this.emit(`@font-face`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@font-face `,e.position)+this.emit(`{
|
|
23
|
-
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
24
|
-
`)+this.emit(this.indent(-1))+this.emit(`
|
|
25
|
-
}`)}host(e){return this.compress?this.emit(`@host`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`@host`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
26
|
-
|
|
27
|
-
`)+this.emit(`${this.indent(-1)}\n}`)}customMedia(e){return this.emit(`@custom-media ${e.name} ${e.media};`,e.position)}property(e){return this.compress?this.emit(`@property ${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@property ${e.name} `,e.position)+this.emit(`{
|
|
28
|
-
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
29
|
-
`)+this.emit(this.indent(-1))+this.emit(`
|
|
30
|
-
}`)}counterStyle(e){return this.compress?this.emit(`@counter-style ${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@counter-style ${e.name} `,e.position)+this.emit(`{
|
|
31
|
-
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
32
|
-
`)+this.emit(this.indent(-1))+this.emit(`
|
|
33
|
-
}`)}fontFeatureValues(e){return this.compress?this.emit(`@font-feature-values ${e.fontFamily}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@font-feature-values ${e.fontFamily}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
34
|
-
|
|
35
|
-
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}scope(e){let t=e.scope?` ${e.scope}`:``;return this.compress?this.emit(`@scope${t}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@scope${t}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
|
|
36
|
-
|
|
37
|
-
`)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}viewTransition(e){return this.compress?this.emit(`@view-transition`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@view-transition `,e.position)+this.emit(`{
|
|
38
|
-
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
39
|
-
`)+this.emit(this.indent(-1))+this.emit(`
|
|
40
|
-
}`)}positionTry(e){return this.compress?this.emit(`@position-try ${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@position-try ${e.name} `,e.position)+this.emit(`{
|
|
41
|
-
`)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
|
|
42
|
-
`)+this.emit(this.indent(-1))+this.emit(`
|
|
43
|
-
}`)}genericAtRule(e){let t=e.prelude?` ${e.prelude}`:``;if(this.compress)return this.emit(`@${e.name}${t}`,e.position)+(e.rules?this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):`;`);if(!e.rules)return this.emit(`${this.indent()}@${e.name}${t};`,e.position);let n=e.rules.some(e=>e.type!==M.declaration&&e.type!==M.comment),r=n?`
|
|
44
|
-
|
|
45
|
-
`:`
|
|
46
|
-
`;return this.emit(`${this.indent()}@${e.name}${t}`,e.position)+this.emit(n?` {\n${this.indent(1)}`:` {
|
|
47
|
-
`)+this.emit(n?``:this.indent(1))+this.mapVisit(e.rules,r)+this.emit(n?`\n${this.indent(-1)}${this.indent()}}`:`${this.indent(-1)}\n${this.indent()}}`)}rule(e){let t=e.declarations;if(!t.length)return``;if(this.compress)return this.emit(e.selectors.join(`,`),e.position)+this.emit(`{`)+this.mapVisit(t)+this.emit(`}`);let n=this.indent();return this.emit(e.selectors.map(e=>n+e).join(`,
|
|
48
|
-
`),e.position)+this.emit(` {
|
|
49
|
-
`)+this.emit(this.indent(1))+this.mapVisit(t,`
|
|
50
|
-
`)+this.emit(this.indent(-1))+this.emit(`\n${this.indent()}}`)}declaration(e){return this.compress?this.emit(`${e.property}:${e.value}`,e.position)+this.emit(`;`):e.property===`grid-template-areas`?this.emit(this.indent())+this.emit(e.property+`: `+e.value.split(`
|
|
51
|
-
`).join(`
|
|
52
|
-
`.padEnd(22)+this.indent()),e.position)+this.emit(`;`):this.emit(this.indent())+this.emit(`${e.property}: ${e.value}`,e.position)+this.emit(`;`)}},Xe=(e,t)=>{t||={};let n=1,r=1;function i(){let e={line:n,column:r};return i=>(i.position=new qe(e,{line:n,column:r},t?.source||``),u(),i)}let a=[];function o(i){let o=new Ke(t?.source||``,i,n,r,e);if(!t?.silent)throw o;a.push(o)}function s(){let t=/^{\s*/.exec(e);return!!t&&(l(t),!0)}function c(){let t=/^}/.exec(e);return!!t&&(l(t),!0)}function l(t){let i=t[0];return function(e){let t=e.match(/\n/g);t&&(n+=t.length);let i=e.lastIndexOf(`
|
|
53
|
-
`);r=~i?e.length-i:r+e.length}(i),e=e.slice(i.length),t}function u(){let t=/^\s*/.exec(e);t&&l(t)}function d(e){e||=[];let t=f();for(;t;)e.push(t),t=f();return e}function f(){let t=i();if(e.charAt(0)!==`/`||e.charAt(1)!==`*`)return;let n=/^\/\*[^]*?\*\//.exec(e);return n?(l(n),t({type:M.comment,comment:n[0].slice(2,-2)})):o(`End of comment missing`)}function p(){let t=N(e,[`{`]);if(t===-1||t===0)return;let n=e.substring(0,t);return l([n]),((e,t)=>{let n=[],r=0;for(;r<e.length;){let i=N(e,t,r);if(i===-1)return n.push(e.substring(r)),n;n.push(e.substring(r,i)),r=i+1}return n})(F(n).replace(P,``),[`,`]).map(e=>F(e))}function m(){let t=i(),n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/.exec(e);if(!n)return;l(n);let r=F(n[0]),a=/^:\s*/.exec(e);if(!a)return o(`property missing ':'`);l(a);let s=``,c=N(e,[`;`,`}`]);c!==-1&&(s=e.substring(0,c),l([s]),s=F(s).replace(P,``));let u=t({type:M.declaration,property:r.replace(P,``),value:s}),d=/^[;\s]*/.exec(e);return d&&l(d),u}function h(){let n=[];if(!s())return o(`missing '{'`);d(n);let r=m();for(;r;)n.push(r),d(n),r=m();for(;t?.silent&&e.length&&e.charAt(0)!==`}`;){let t=e.indexOf(`;`),i=e.indexOf(`}`);if(t===-1||!(i===-1||t<i))break;for(l([e.substring(0,t+1)]),u(),d(n),r=m();r;)n.push(r),d(n),r=m()}return c()?n:o(`missing '}'`)}function g(){let t=N(e,[`{`]);if(t===-1)return!1;let n=N(e,[`;`]),r=N(e,[`}`]);return!(n!==-1&&n<t)&&!(r!==-1&&r<t)}function ee(){let n=[];if(!s())return o(`missing '{'`);for(d(n);e.length&&e.charAt(0)!==`}`;){if(e.charAt(0)===`@`){let e=C();if(e){n.push(e),d(n);continue}}if(g()){let e=w();if(e){n.push(e),d(n);continue}}let r=m();if(!r){if(t?.silent){let t=e.indexOf(`;`),r=e.indexOf(`}`);if(t!==-1&&(r===-1||t<r)){l([e.substring(0,t+1)]),u(),d(n);continue}}break}n.push(r),d(n)}return c()?n:o(`missing '}'`)}function _(){let n=[];for(u(),d(n);e.length&&e.charAt(0)!==`}`;){if(e.charAt(0)===`@`){let e=C();if(e){n.push(e),d(n);continue}}if(g()){let e=w();if(e){n.push(e),d(n);continue}}let r=m();if(!r){if(t?.silent){let t=e.indexOf(`;`),r=e.indexOf(`}`);if(t!==-1&&(r===-1||t<r)){l([e.substring(0,t+1)]),u(),d(n);continue}}break}n.push(r),d(n)}return n}function v(){let t=[],n=i(),r=/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/.exec(e);for(;r;){let n=l(r);t.push(n[1]);let i=/^,\s*/.exec(e);i&&l(i),r=/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/.exec(e)}if(t.length)return n({type:M.keyframe,values:t,declarations:h()||[]})}let te=RegExp(`^@(${[`top-left-corner`,`top-left`,`top-center`,`top-right`,`top-right-corner`,`bottom-left-corner`,`bottom-left`,`bottom-center`,`bottom-right`,`bottom-right-corner`,`left-top`,`left-middle`,`left-bottom`,`right-top`,`right-middle`,`right-bottom`].join(`|`)})(?![\\w-])\\s*`),y=S(`import`),b=S(`charset`),x=S(`namespace`);function S(t){let n=RegExp(`^@`+t+`\\s*((?::?[^;'"]|"(?:\\\\"|[^"])*?"|'(?:\\\\'|[^'])*?')+)(?:;|$)`);return()=>{let r=i(),a=n.exec(e);if(!a)return;let o=l(a),s={type:t};return s[t]=o[1].trim(),r(s)}}function C(){if(e[0]===`@`)return function(){let t=i(),n=/^@([-\w]+)?keyframes\s*/.exec(e);if(!n)return;let r=l(n)[1],a=/^([-\w]+)\s*/.exec(e);if(!a)return o(`@keyframes missing name`);let u=l(a)[1];if(!s())return o(`@keyframes missing '{'`);let f=d(),p=v();for(;p;)f.push(p),f=f.concat(d()),p=v();return c()?t({type:M.keyframes,name:u,vendor:r,keyframes:f}):o(`@keyframes missing '}'`)}()||function(){let t=i(),n=/^@media *([^{]+)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s())return o(`@media missing '{'`);let a=_();return c()?t({type:M.media,media:r,rules:a}):o(`@media missing '}'`)}()||function(){let t=i(),n=/^@custom-media\s+(--\S+)\s+([^{;\s][^{;]*);/.exec(e);if(!n)return;let r=l(n);return t({type:M.customMedia,name:F(r[1]),media:F(r[2])})}()||function(){let t=i(),n=/^@supports *([^{]+)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s())return o(`@supports missing '{'`);let a=_();return c()?t({type:M.supports,supports:r,rules:a}):o(`@supports missing '}'`)}()||y()||b()||x()||function(){let t=i(),n=/^@([-\w]+)?document *([^{]+)/.exec(e);if(!n)return;let r=l(n),a=F(r[1]),u=F(r[2]);if(!s())return o(`@document missing '{'`);let d=_();return c()?t({type:M.document,document:u,vendor:a,rules:d}):o(`@document missing '}'`)}()||function(){let t=i(),n=/^@page */.exec(e);if(!n)return;l(n);let r=p()||[];if(!s())return o(`@page missing '{'`);let a=[];for(d(a);e.length&&e.charAt(0)!==`}`;){if(e.charAt(0)===`@`){let e=C();if(e){a.push(e),d(a);continue}}let t=m();if(!t)break;a.push(t),d(a)}return c()?t({type:M.page,selectors:r,declarations:a}):o(`@page missing '}'`)}()||function(){let t=i(),n=/^@host\s*/.exec(e);if(!n)return;if(l(n),!s())return o(`@host missing '{'`);let r=_();return c()?t({type:M.host,rules:r}):o(`@host missing '}'`)}()||function(){let t=i(),n=/^@font-face\s*/.exec(e);if(!n)return;if(l(n),!s())return o(`@font-face missing '{'`);let r=d(),a=m();for(;a;)r.push(a),r=r.concat(d()),a=m();return c()?t({type:M.fontFace,declarations:r}):o(`@font-face missing '}'`)}()||function(){let t=i(),n=/^@font-feature-values\s+([^{]+)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s())return o(`@font-feature-values missing '{'`);let a=_();return c()?t({type:M.fontFeatureValues,fontFamily:r,rules:a}):o(`@font-feature-values missing '}'`)}()||function(){let t=i(),n=/^@container *([^{]+)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s())return o(`@container missing '{'`);let a=_();return c()?t({type:M.container,container:r,rules:a}):o(`@container missing '}'`)}()||function(){let t=i(),n=/^@starting-style\s*/.exec(e);if(!n)return;if(l(n),!s())return o(`@starting-style missing '{'`);let r=_();return c()?t({type:M.startingStyle,rules:r}):o(`@starting-style missing '}'`)}()||function(){let t=i(),n=/^@layer *([^{;@]+)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s()){let n=/^[;\s]*/.exec(e);return n&&l(n),t({type:M.layer,layer:r})}let a=_();return c()?t({type:M.layer,layer:r,rules:a}):o(`@layer missing '}'`)}()||function(){let t=i(),n=/^@property\s+(--[-\w]+)\s*/.exec(e);if(!n)return;let r=l(n)[1];if(!s())return o(`@property missing '{'`);let a=d(),u=m();for(;u;)a.push(u),a=a.concat(d()),u=m();return c()?t({type:M.property,name:r,declarations:a}):o(`@property missing '}'`)}()||function(){let t=i(),n=/^@counter-style\s+([-\w]+)\s*/.exec(e);if(!n)return;let r=l(n)[1];if(!s())return o(`@counter-style missing '{'`);let a=d(),u=m();for(;u;)a.push(u),a=a.concat(d()),u=m();return c()?t({type:M.counterStyle,name:r,declarations:a}):o(`@counter-style missing '}'`)}()||function(){let t=i(),n=/^@scope\s*([^{]*)/.exec(e);if(!n)return;let r=F(l(n)[1]);if(!s())return o(`@scope missing '{'`);let a=_();return c()?t({type:M.scope,scope:r,rules:a}):o(`@scope missing '}'`)}()||function(){let t=i(),n=/^@view-transition\s*/.exec(e);if(!n)return;if(l(n),!s())return o(`@view-transition missing '{'`);let r=d(),a=m();for(;a;)r.push(a),r=r.concat(d()),a=m();return c()?t({type:M.viewTransition,declarations:r}):o(`@view-transition missing '}'`)}()||function(){let t=i(),n=/^@position-try\s+(--[-\w]+)\s*/.exec(e);if(!n)return;let r=l(n)[1];if(!s())return o(`@position-try missing '{'`);let a=d(),u=m();for(;u;)a.push(u),a=a.concat(d()),u=m();return c()?t({type:M.positionTry,name:r,declarations:a}):o(`@position-try missing '}'`)}()||function(){let t=i(),n=te.exec(e);if(!n)return;let r=l(n)[1];if(!s())return o(`@${r} missing '{'`);let a=d(),u=m();for(;u;)a.push(u),a=a.concat(d()),u=m();return c()?t({type:M.pageMarginBox,name:r,declarations:a}):o(`@${r} missing '}'`)}()||function(){let t=i(),n=/^@([-\w]+)\s*/.exec(e);if(!n)return;let r=l(n)[1],a=``,u=N(e,[`{`,`;`]);if(u!==-1&&u>0&&(a=F(e.substring(0,u)),l([e.substring(0,u)])),s()){let e=_();return c()?t({type:M.atRule,name:r,prelude:a,rules:e}):o(`@${r} missing '}'`)}let d=/^[;\s]*/.exec(e);return d&&l(d),t({type:M.atRule,name:r,prelude:a})}()}function w(){let e=i(),t=p();return t?(d(),e({type:M.rule,selectors:t,declarations:ee()||[]})):o(`selector missing`)}return I(function(){let n=function(){let n,r=[];for(u(),d(r);e.length;){if(e.charAt(0)===`}`){if(t?.silent){o(`extra '}'`),l([`}`]),u(),d(r);continue}break}if(n=C()||w(),!n){if(t?.silent){l([e.charAt(0)]),u(),d(r);continue}break}r.push(n),d(r)}return r}();return{type:M.stylesheet,stylesheet:{source:t?.source,rules:n,parsingErrors:a}}}())},Ze=(e,t)=>new Ye(t||{}).compile(e),Qe=Object.defineProperty,$e=(e,t)=>{let n={};for(var r in e)Qe(n,r,{get:e[r],enumerable:!0});return t||Qe(n,Symbol.toStringTag,{value:`Module`}),n},et=`LocatorError`,L=`LocatorUnsupportedError`,R=`LocatorDeniedError`,tt=`LocatorInvalidError`,z=e=>typeof e==`object`&&e?e.name:void 0,B=e=>Object.assign(Error(e),{name:et}),nt=(e,t=``,n)=>Object.assign(Error(e),{name:L,operation:t,backend:n}),rt=(e,t)=>nt(`Locator operation not supported${t?` on the ${t} backend`:``}: ${e}`,e,t),it=(e,t)=>Object.assign(Error(e),{name:R,operation:t}),V=(e,t)=>Object.assign(Error(e),{name:tt,operation:t}),at=e=>z(e)===L,ot=e=>z(e)===R,st=e=>z(e)===tt,ct=e=>ot(e)||at(e)||st(e),H=e=>{let t=(e.ownerDocument??e).defaultView;if(!t)throw B(`the resolved element belongs to a document with no window`);return t},lt=(e,t)=>{let n=e?.[t];return typeof n==`function`?n:null},U=(e,t)=>{if(typeof e!=`object`||!e)return null;let n=(()=>{try{return lt(H(e),t)}catch{return null}})();if(n&&e instanceof n)return n;let r=lt(globalThis,t);return r&&e instanceof r?r:null},W=(e,t)=>U(e,t)!==null,G=e=>{if(e.length===0)throw B(`No elements found`);if(e.length>1)throw B(`Strict mode violation: locator resolved to ${e.length} elements`);return e[0]},ut=(e,t)=>{if(!W(e,t))throw B(`Strict mode violation: expected ${t}, got <${e.tagName.toLowerCase()}>`);return e},dt=e=>e.tagName.toLowerCase(),ft=new Set,pt=e=>{ft.add(e)},mt=/(?:^|[^\w-])(?:url|image|image-set|cross-fade|paint|element|expression)\s*\(/i,ht=e=>e.replace(/\\([0-9a-fA-F]{1,6})\s?/g,(e,t)=>String.fromCodePoint(Number.parseInt(t,16))).replace(/\\(.)/g,`$1`),gt=e=>!mt.test(ht(e.value)),_t=new Set([M.import,M.fontFace,M.namespace,M.charset,M.document,M.comment]),vt=e=>{if(_t.has(e.type))return null;if(e.type===M.declaration)return gt(e)?e:null;let t=e,n={...t};for(let e of[`declarations`,`rules`,`keyframes`]){let r=t[e];Array.isArray(r)&&(n[e]=yt(r))}return n},yt=e=>e.map(e=>vt(e)).filter(e=>e!==null),bt=e=>{let t;try{t=Xe(e,{silent:!0})}catch{return``}return t.stylesheet.rules=yt(t.stylesheet.rules),Ze(t)},xt=(e,t)=>{let n=()=>{t.parentNode||(e.head??e.documentElement).appendChild(t)};if(n(),e.readyState===`complete`)return;let r=new MutationObserver(e=>{for(let r of e)for(let e of r.removedNodes)if(e===t||e.contains?.(t)){n();return}});r.observe(e.documentElement,{childList:!0,subtree:!0});let i=()=>r.disconnect(),a=e.defaultView;a?a.addEventListener(`load`,i,{once:!0}):setTimeout(i,3e4)},St={resolve:(e,t)=>{let n=e.document.createElement(`style`);n.textContent=t.noSanitize?t.content:bt(t.content);try{xt(e.document,n)}catch(e){console.error(e)}pt(n)}},Ct=e=>{let t=[];return e.forEach((e,n)=>{t.push([n,e])}),t},K={kind:`frame`,ensureArgs:e=>[void 0,e],resolve:async(e,t,n={})=>{if(typeof t!=`string`)throw V(`fetch: url must be a string`,`fetch`);let r=H(e.document),i;try{i=new r.URL(t,e.document.baseURI).href}catch{throw V(`fetch: not a valid url: ${t}`,`fetch`)}let a=await r.fetch(i,{method:n.method??`GET`,headers:n.headers,body:n.body??null,redirect:n.redirect??`follow`,credentials:n.credentials??`include`});return{status:a.status,statusText:a.statusText,ok:a.ok,url:a.url,redirected:a.redirected,type:a.type,headers:Ct(a.headers),body:await a.arrayBuffer()}}},q=$e({click:()=>Tt,count:()=>Nt,exists:()=>Pt,fill:()=>kt,getAttribute:()=>jt,hover:()=>Et,isVisible:()=>Mt,textContent:()=>At}),wt=(e,t)=>{let n=e.getBoundingClientRect();return{clientX:n.left+n.width*(t?.x??.5),clientY:n.top+n.height*(t?.y??.5)}},Tt={resolve:(e,t={})=>{let n=G(e.elements),r=H(n),i={bubbles:!0,cancelable:!0,composed:!0,...wt(n,t.position),button:0},a={...i,pointerType:`mouse`,pointerId:1,isPrimary:!0};n.dispatchEvent(new r.PointerEvent(`pointerdown`,{...a,buttons:1})),n.dispatchEvent(new r.MouseEvent(`mousedown`,{...i,buttons:1})),n.dispatchEvent(new r.PointerEvent(`pointerup`,{...a,buttons:0})),n.dispatchEvent(new r.MouseEvent(`mouseup`,{...i,buttons:0})),n.dispatchEvent(new r.MouseEvent(`click`,{...i,buttons:0}))}},Et={resolve:(e,t={})=>{let n=G(e.elements),r=H(n),i={bubbles:!0,cancelable:!0,composed:!0,...wt(n,t.position)},a={...i,pointerType:`mouse`,pointerId:1,isPrimary:!0};n.dispatchEvent(new r.PointerEvent(`pointerover`,a)),n.dispatchEvent(new r.PointerEvent(`pointerenter`,{...a,bubbles:!1})),n.dispatchEvent(new r.MouseEvent(`mouseenter`,{...i,bubbles:!1})),n.dispatchEvent(new r.MouseEvent(`mouseover`,i)),n.dispatchEvent(new r.PointerEvent(`pointermove`,a)),n.dispatchEvent(new r.MouseEvent(`mousemove`,i))}},Dt=(e,t)=>{e._valueTracker?.setValue(``);let n=(U(e,`HTMLTextAreaElement`)??U(e,`HTMLInputElement`))?.prototype,r=n&&Object.getOwnPropertyDescriptor(n,`value`)?.set;r?r.call(e,t):e.value=t},Ot=(e,t)=>{if(e.type!==`range`)return null;let n=Number(e.min||0),r=Number(e.max||100);if(!Number.isFinite(n)||!Number.isFinite(r)||r<=n)return null;let i=Number(t);if(!Number.isFinite(i))return null;let a=Math.max(0,Math.min(1,(i-n)/(r-n))),o=e.getBoundingClientRect(),s={bubbles:!0,cancelable:!0,composed:!0,clientX:o.left+o.width*a,clientY:o.top+o.height/2,button:0},c={...s,pointerType:`mouse`,pointerId:1,isPrimary:!0};return{pointerDown:{...c,buttons:1},pointerUp:{...c,buttons:0},mouseDown:{...s,buttons:1},mouseUp:{...s,buttons:0}}},kt={resolve:(e,t,n={})=>{let r=G(e.elements),i=H(r),a=W(r,`HTMLInputElement`);if(a||W(r,`HTMLTextAreaElement`)){let e=r,n=a?Ot(e,t):null;n&&(r.dispatchEvent(new i.PointerEvent(`pointerdown`,n.pointerDown)),r.dispatchEvent(new i.MouseEvent(`mousedown`,n.mouseDown))),Dt(e,t),r.dispatchEvent(new i.Event(`input`,{bubbles:!0})),n&&(r.dispatchEvent(new i.PointerEvent(`pointerup`,n.pointerUp)),r.dispatchEvent(new i.MouseEvent(`mouseup`,n.mouseUp))),r.dispatchEvent(new i.Event(`change`,{bubbles:!0}));return}if(W(r,`HTMLElement`)&&r.isContentEditable){r.textContent=t,r.dispatchEvent(new i.Event(`input`,{bubbles:!0}));return}throw Error(`fill: element <${dt(r)}> is not fillable`)}},At={resolve:(e,t={})=>G(e.elements).textContent},jt={resolve:(e,t,n={})=>G(e.elements).getAttribute(t)},Mt={resolve:(e,t={})=>{let n=G(e.elements);if(!W(n,`HTMLElement`))return!0;let r=H(n).getComputedStyle(n);if(r?.display===`none`||r?.visibility===`hidden`)return!1;let i=n.getBoundingClientRect();return i.width>0&&i.height>0}},Nt={resolve:(e,t={})=>e.elements.length},Pt={resolve:(e,t={})=>e.elements.length>0},J=(e,t)=>e.elements.flatMap(e=>[...e.querySelectorAll(t)]),Y=e=>e.replaceAll(`"`,`\\"`),Ft={to:`element`,css:!0,resolve:(e,t)=>J(e,t),render:e=>({fragment:typeof e==`string`?e:`?`,separator:`descend`})},It={to:`frame`,css:!0,barrier:`down`,resolve:(e,t)=>J(e,t),render:e=>({fragment:typeof e==`string`?e:`?`,separator:`down`})},Lt={element:{selectors:{locator:Ft,frameLocator:It,getByRole:{to:`element`,resolve:(e,t)=>J(e,`[role="${CSS.escape(t)}"]`),render:e=>({fragment:typeof e==`string`?`[role="${Y(e)}"]`:`[role]`})},getByText:{to:`element`,resolve:(e,t)=>e.elements.flatMap(e=>[e,...e.querySelectorAll(`*`)]).filter(e=>e.textContent?.includes(t)),render:e=>({fragment:typeof e==`string`?`:has-text("${Y(e)}")`:`:has-text(...)`})},getByTestId:{to:`element`,resolve:(e,t)=>J(e,`[data-testid="${CSS.escape(t)}"]`),render:e=>({fragment:typeof e==`string`?`[data-testid="${Y(e)}"]`:`[data-testid]`})},first:{to:`element`,resolve:e=>e.elements.slice(0,1),render:()=>({fragment:`:first`})},nth:{to:`element`,resolve:(e,t)=>{let n=e.elements.at(t);return n?[n]:[]},render:e=>({fragment:typeof e==`number`?`:nth(${e})`:`:nth(?)`})}},operations:{click:Tt,fill:kt,hover:Et,textContent:At,getAttribute:jt,isVisible:Mt,count:Nt,exists:Pt}},frame:{selectors:{locator:Ft,frameLocator:It,owner:{to:`frame`,barrier:`up`,resolve:e=>{throw Error(`owner: must be processed by the executor as an upward pivot`)},render:()=>({fragment:``,separator:`up`})}},operations:{addStyleTag:St,fetch:K}}},Rt=(e,t=Lt)=>({element:{selectors:{...t.element.selectors,...e.element?.selectors},operations:{...t.element.operations,...e.element?.operations}},frame:{selectors:{...t.frame.selectors,...e.frame?.selectors},operations:{...t.frame.operations,...e.frame?.operations}}}),zt=3e4,Bt=50,Vt=e=>{let t=e[e.length-1];return typeof t==`object`&&t?t:void 0},Ht=e=>{let t=Vt(e)?.timeout;return typeof t==`number`?t:zt},Ut=({executor:e,parts:t})=>({highlight:n=>e.highlight(t,n).then(()=>{},()=>{})}),Wt=async e=>{let t={parts:e.parts,operation:e.operation,args:e.args,phase:`ensure`};await e.gate?.(t,Ut(e))},Gt=async e=>{let{executor:t,gate:n,parts:r,operation:i,args:a}=e;n&&await n({parts:r,operation:i,args:a,phase:`execute`},Ut(e));let o=Ht(a),s=Date.now()+o,c=Error(`Locator timeout (${o}ms): ${i}`),{promise:l,reject:u}=Promise.withResolvers();l.catch(()=>{});let d=setTimeout(()=>u(c),o),f=c;try{for(;Date.now()<s;)try{return await Promise.race([t.execute(r,i,a),l])}catch(e){if(e===c)break;if(ct(e))throw e;f=e;let t=s-Date.now();if(t<=0)break;await new Promise(e=>setTimeout(e,Math.min(Bt,t)))}}finally{clearTimeout(d)}throw f},Kt=(e,t,n,r)=>{let i={};for(let[a,o]of Object.entries(t[n].selectors))i[a]=(...i)=>Kt(e,t,o.to,[...r,{kind:n,name:a,args:i}]);for(let a of Object.keys(t[n].operations))i[a]=(...t)=>Gt({...e,parts:r,operation:a,args:t});return i.ensure=(i,a={})=>{let o=t[n].operations[i]?.ensureArgs;return Wt({...e,parts:r,operation:i,args:o?.(a)??[a]})},i},qt=e=>Kt(e,e.modules??Lt,`frame`,[]),Jt=Rt({element:{operations:{click:{resolve:(e,t={})=>q.click.resolve(e,t)},hover:{resolve:(e,t={})=>q.hover.resolve(e,t)},fill:{resolve:(e,t,n={})=>q.fill.resolve(e,t,n)},textContent:{resolve:(e,t={})=>q.textContent.resolve(e)},getAttribute:{resolve:(e,t,n={})=>q.getAttribute.resolve(e,t)},isVisible:{resolve:(e,t={})=>q.isVisible.resolve(e)},count:{resolve:(e,t={})=>q.count.resolve(e)},exists:{resolve:(e,t={})=>q.exists.resolve(e)},videoElement:{resolve:(e,t={})=>b(ut(G(e.elements),`HTMLVideoElement`))}}},frame:{operations:{addStyleTag:{resolve:(e,t)=>St.resolve(e,t)},fetch:{resolve:(e,t,n={})=>K.resolve(e,t,n),kind:K.kind,ensureArgs:K.ensureArgs},evaluate:{kind:`frame`,resolve:(e,t,n)=>{throw rt(`evaluate`,`this realm`)}}}}}),Yt=e=>{if(!e||e===`about:blank`)return!1;let t;try{t=new URL(e,location.href)}catch{return!1}return t.protocol===`chrome-extension:`||t.protocol===`moz-extension:`||t.protocol!==`about:`&&Ee(t.hostname)},X=e=>{if(Yt(e))throw Error(`attachFrame: refusing to target the extension's own pages or an FKN platform origin`)},Xt=({src:e,domains:t,lockdown:n})=>{if(n&&!t.length&&e&&e!==`about:blank`)throw Error(`attachFrame: lockdown needs domains when the frame already has a src; pass domains or load it via goto`)},Zt={scope:`embed.iframe`,category:`interaction`,severity:0,title:`Load another website inside this app`,description:`Lets the app embed external pages directly inside its own view.`},Qt={scope:`embed.open`,category:`interaction`,severity:0,title:`Open a website inside this app`,description:`Lets the app navigate to another site without leaving its window.`},$t=class extends Error{name=`FrameWindowBlockedError`;constructor(){super(`attachFrame: the browser did not open the window. Call attachFrame directly in a click or key handler, and allow popups for this page`)}},en=new Set([`jar-unreachable`,`bad-url`,`opaque-opener`]),tn=class extends Error{name=`FrameWindowRefusedError`;reason;constructor(e){let t=en.has(e)?e:`unknown`;super(t===`opaque-opener`?`attachFrame: this page has an opaque origin, which a window can never answer, so no window was opened`:`attachFrame: the window refused to attach (${t}), and loaded nothing`),this.reason=t}},nn=e=>{let t=qt({executor:e.executor,modules:Jt,gate:e.gate}),n=(t,n={})=>(X(t),e.goto(t,n)),r=()=>e.url(),i=async t=>{let n=e.request;if(!n)throw Error(`frame.request: this backend cannot ask for permission categories`);return n(t)},a=async(t,n)=>{let r=e.evaluate;if(!r)throw Error(`frame.evaluate: this backend cannot run code in the attached frame`);let i=typeof t==`function`?t.toString():t;if(typeof i!=`string`)throw TypeError(`frame.evaluate: pass a function or a source string`);return r(i,n)};return{...t,goto:n,url:r,request:i,evaluate:a}},rn=[t._,t.g,t.v,t.m,t.h,t.n,t.i,t.r,t.f,t.a,t.o,t.s,Zt,Qt,t.u,t.d,De,Oe,ke,Ie,Re],an=Ge.map(e=>e.id),on={interaction:`act.click`,storage:`read.text`,network:`network.fetchCredentialed`,evaluation:`media.appearU`},Z=e=>e===0?`auto`:e===4?`critical`:`bundled`,Q=rn,$=new Map,sn={};(()=>{$=new Map(Q.map(e=>[e.scope,e])),sn=Object.fromEntries($),Q.filter(e=>e.severity===4).map(e=>e.scope);let e=e=>Q.filter(t=>t.category===e&&Z(t.severity)===`bundled`);Object.fromEntries(an.map(t=>[t,Math.max(0,...e(t).map(e=>e.severity))])),Object.fromEntries(an.map(t=>[t,e(t).some(e=>e.unsafe===!0)]))})();var cn=e=>$.get(e)?.category,ln=e=>{let t=$.get(e);return t&&Z(t.severity)},un=e=>{let t=$.get(e);if(t)return Z(t.severity)===`critical`?t.scope:t.category},dn=e=>on[e],fn=({category:e,key:t})=>{let n=t??(e&&dn(e));return n!==void 0&&cn(n)!==void 0?n:void 0},pn=(e,t)=>{for(let{category:n,key:r}of t)if(fn({category:n,key:r})===void 0)throw TypeError(r===void 0?n===void 0?`${e}: name a category or a permission key`:`${e}: unknown permission category "${n}"`:`${e}: unknown permission key "${r}"`)},mn=(e,t={})=>{let n=[],r=e.map(e=>{let r=fn(e),i=[];if(r!==void 0)for(let a of e.hosts)i.push(n.length),n.push({...t,key:r,scope:``,site:a,hosts:e.hosts,reason:e.reason});return{key:r!==void 0&&ln(r)===`critical`?r:void 0,category:e.category??(r===void 0?`interaction`:sn[r].category),hosts:e.hosts,indexes:i}});return{items:n,answer:e=>r.map(({key:t,category:n,hosts:r,indexes:i})=>({category:n,...t===void 0?{}:{key:t},hosts:r,allow:i.length>0&&i.every(t=>e[t]?.allow===!0)}))}},hn=e=>{let t=e;if(t.window===void 0)return`iframe`;if(t.iframe!==void 0)throw TypeError(`attachFrame: pass either iframe or window, not both`);if(t.lockdown)throw TypeError(`attachFrame: lockdown applies to an iframe, never to a window`);if(typeof t.window!=`object`||t.window===null)throw TypeError(`attachFrame: window must be an object`);return`window`},gn=(e,t,n)=>{if(e===void 0)return t;if(typeof e!=`number`||!Number.isFinite(e)||e<=0)throw TypeError(`attachFrame: window.${n} must be a positive number of CSS pixels`);return Math.round(e)},_n=({url:e,width:t,height:n})=>{let r=(()=>{if(e===void 0||e===``||e===`about:blank`)return``;if(typeof e!=`string`)throw TypeError(`attachFrame: window.url must be a string`);let t=(()=>{try{return new URL(e,location.href)}catch{throw TypeError(`attachFrame: window.url is not a valid URL: ${e}`)}})();if(t.protocol!==`http:`&&t.protocol!==`https:`)throw TypeError(`attachFrame: window.url must be an http or https address`);return t.href})();return r&&X(r),{url:r,width:gn(t,500,`width`),height:gn(n,700,`height`)}},vn=`FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY`,yn=!1,bn=()=>{yn||(yn=!0,console.warn(`[fkn-frame] the installed FKN WebExtension is too old to ask for permission categories upfront, so each capability will be asked for as it is first used. Updating the extension fixes this.`))},xn=async({iframe:e,domains:t=[],syncCookies:n=!0,lockdown:r=!1,permissions:i})=>{let a=crypto.randomUUID();if(X(e.src),Xt({src:e.src,domains:t,lockdown:r}),await k(),!e.isConnected)throw Error(`attachFrame: the iframe must be connected to the document before attaching`);e.dispatchEvent(new CustomEvent(vn,{detail:a}));let{executeLocator:o,highlightLocator:s,ensureLocatorPermission:c,requestCategories:l,evaluateFrame:u,goto:d}=await A.attachFrame({marker:a,domains:t,syncCookies:n,lockdown:r}),f=nn({executor:{execute:o,highlight:s},gate:e=>c(e.parts,e.operation,e.args),request:async e=>(pn(`frame.request`,e),await He(),l(e)),evaluate:async(e,t)=>{if(!fe(D(),`evaluate`)){let e=D();throw new E(`evaluate`,e.status===`ok`?e.abi:0)}return u({source:e,arg:t})},goto:(e,t={})=>d({url:e,...t}),url:()=>e.src});return i?.length&&(Ve()?await f.request(i):bn()),f},Sn=`attachFrame: window mode is served by the cloud backend for now, whatever extension is installed. Use cloud.attachFrame({ window })`,Cn=async e=>{if(_n(e.window),e.syncCookies===!1)throw TypeError(`attachFrame: syncCookies false does not apply to an extension window, which is the site's own first-party tab`);let t=D();throw new E(`attachWindow`,t.status===`absent`?0:t.abi,Sn)},wn=(async e=>hn(e)===`window`?Cn(e):xn(e)),Tn=`permissions.request: pass hosts, the sites the grant applies to`,En={request:async e=>{let n=e.map(e=>{let{category:n,key:r,scope:i,reason:a,hosts:o}=e;if(!(`hosts`in e)&&!(`category`in e))return{legacy:{key:r,scope:i??``,reason:a}};let s=t.t(o??[],{ipv6:!0});if(!s.length)throw TypeError(Tn);return{ask:{category:n,key:r,reason:a,hosts:s}}}),r=n.flatMap(e=>`ask`in e?[e.ask]:[]);pn(`permissions.request`,r),r.length&&await He();let{items:i,answer:a}=mn(r),o=n.flatMap(e=>`legacy`in e?[e.legacy]:[]),s=[...i,...o],c=s.length?await A.requestPermissions(s):[],l=a(c.slice(0,i.length)),u=c.slice(i.length),d=0,f=0;return n.map(e=>`ask`in e?l[d++]:u[f++])}},Dn=e=>typeof e==`object`&&!!e,On=`PermissionDeniedError`,kn=e=>e instanceof Error?e.name===On:Dn(e)&&e.name===`PermissionDeniedError`;Object.defineProperty(exports,"$",{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return et}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return he}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(exports,"J",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,"Q",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return at}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return it}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(exports,"X",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"Y",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"Z",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return Xt}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return wn}}),Object.defineProperty(exports,"at",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return cn}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return $t}}),Object.defineProperty(exports,"et",{enumerable:!0,get:function(){return de}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return tn}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return Qt}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return vn}}),Object.defineProperty(exports,"it",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return un}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return nn}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return kn}}),Object.defineProperty(exports,"nt",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return hn}}),Object.defineProperty(exports,"ot",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return Zt}}),Object.defineProperty(exports,"q",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return En}}),Object.defineProperty(exports,"rt",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return _n}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return On}}),Object.defineProperty(exports,"tt",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return ln}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return Yt}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return Me}});
|