@fkn/lib 0.9.14 → 0.9.15

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.
@@ -0,0 +1,53 @@
1
+ const e=require("./rolldown-runtime-BIInC43l.cjs");let t=require("osra");var n=(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},r=e=>typeof e==`boolean`?+!!e:+!!e?.capture,i=e=>{let t=new WeakMap;return{addEventListener:(n,i,a)=>{if(i===null)return;let o=`${n}|${r(a)}`,s=t.get(i);if(s||(s=new Map,t.set(i,s)),s.has(o))return;let c=typeof a==`object`&&!!a&&!!a.once,l=t=>{c&&s.delete(o);let r=e.unenrich(t,n);typeof i==`function`?i.call(e.target,r):i.handleEvent(r)};s.set(o,l),e.remoteEvents.addEventListener(n,l,a)},removeEventListener:(n,i,a)=>{if(i===null)return;let o=`${n}|${r(a)}`,s=t.get(i),c=s?.get(o);c&&(e.remoteEvents.removeEventListener(n,c,a),s.delete(o))},dispatchEvent:t=>e.remoteEvents.dispatchEvent(t)}},a=e.t({box:()=>S,createVideoElementHandle:()=>b,isType:()=>x,revive:()=>C,type:()=>o}),o=`videoElement`,s=[`currentTime`,`volume`,`muted`,`playbackRate`,`src`,`loop`,`autoplay`,`preload`,`poster`,`disableRemotePlayback`],c=[`duration`,`paused`,`ended`,`seeking`,`readyState`,`currentSrc`],l=[`buffered`,`seekable`],u=Symbol.for(`fkn.remoteVideoElement`),d=Symbol.for(`fkn.remoteVideoElement.state`),f=Symbol.for(`fkn.remoteVideoElement.controller`),p=e=>e?Array.from({length:e.length},(t,n)=>[e.start(n),e.end(n)]):[],m=e=>{let t={};for(let n of[...s,...c])t[n]=e[n];for(let n of l)t[n]=p(e[n]);return t.error=e.error?{code:e.error.code,message:e.error.message}:null,t},ee=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]}}},h=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,g=e=>n(e,(e,t)=>({originalDetail:e instanceof CustomEvent?e.detail:null,snapshot:m(t)})),_=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}"`)}},v=e=>({call:async t=>_(e,t),set:async(t,n)=>{try{e[t]=n}catch{}return m(e)},events:g(e)}),y=(e,t)=>{let n=new EventTarget;Object.defineProperty(n,u,{value:!0}),Object.defineProperty(n,d,{value:e}),Object.defineProperty(n,f,{value:t});let r=i({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})}}),a={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 h(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 s)a[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 c)a[t]={configurable:!0,enumerable:!0,get(){return e[t]}};for(let t of l)a[t]={configurable:!0,enumerable:!0,get(){return ee(e[t])}};return Object.defineProperties(n,a),n},b=e=>y(m(e),v(e)),x=e=>typeof e==`object`&&!!e&&e[u]===!0,S=(e,n)=>{let r=e;return{...t.BoxBase,type:o,initialState:r[d],controller:(0,t.recursiveBox)(r[f],n)}},C=(e,n)=>{let r=(0,t.recursiveRevive)(e.controller,n);return y({...e.initialState},r)},w=e=>[a,...e],T=`FKN_WEB_EXTENSION_MAIN_WORLD_CONTENT_SCRIPT_ENABLED_EVENT_KEY`,te=`fknExtension`,E=(0,t.createTypedEventTarget)();typeof document<`u`&&document.addEventListener(T,()=>{E.dispatchEvent(new CustomEvent(`statuschange`,{detail:{enabled:D()}}))});var D=()=>typeof document>`u`?!1:document.documentElement.dataset[te]===`true`,O=null,ne=e=>{O=e},re=150,k=(e=1e3)=>new Promise((t,n)=>{if(D())return t();let r,i=e=>{clearTimeout(r),s.disconnect(),document.removeEventListener(`readystatechange`,c),e()},a=()=>i(async()=>{if(O&&(await O().catch(()=>{}),D()))return t();n(Error(`The FKN WebExtension is not installed, enabled or not exposed on this page.`))}),o=()=>{clearTimeout(r),r=setTimeout(()=>D()?i(t):a(),re)},s=new MutationObserver(()=>{D()&&i(t)}),c=()=>{document.readyState===`complete`&&!D()&&o()};if(r=setTimeout(a,e),s.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-fkn-extension`]}),document.addEventListener(`readystatechange`,c),document.readyState===`complete`)return o();D()&&i(t)}),A,j=new Proxy({},{get:(e,n)=>async(...e)=>{await k(),A??=(0,t.expose)({},{transport:window,revivableModules:w});let r=(await A)[n];return r(...e)}}),M=[`origin`,`referer`,`cookie`],ie=(e,t)=>(e??[]).some(([e,n])=>e.trim().toLowerCase()===t&&n!==``),ae=e=>ie(e,`cookie`),oe=(e,t)=>{if(t===`include`&&ae(e))throw Error(`fetch: a forged Cookie header and credentials:'include' are different identities - send one or the other`)},se=e=>{let t=[...new Set((e??[]).map(([e])=>e.trim().toLowerCase()).filter(e=>!M.includes(e)))];if(t.length)throw Error(`fetch: refusing to forge request header(s): ${t.join(`, `)}`)},ce={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.`},le={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.`},ue={scope:`network.fetchLocal`,category:`network`,severity:3,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.`},de=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},fe=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:`):de(n)},pe=[`fkn.app`,`fkn.dev`],me=e=>{let t;try{t=new URL(e)}catch{return!1}if(t.protocol===`chrome-extension:`||t.protocol===`moz-extension:`)return!0;let n=t.hostname;return pe.some(e=>n===e||n.endsWith(`.${e}`))},he=e=>{if(me(e))throw Error(`fetch: refusing to target the extension's own pages or FKN platform domains`)},ge=e=>{if(!e?.headers)return;let t=new Headers(e.headers),n=M.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},_e=async(e,t)=>{let n=new Request(e,t);he(n.url);let r=n.body?await n.arrayBuffer():null;return j.proxyFetch({url:n.url,method:n.method,headers:[...n.headers],body:r,credentials:t?.credentials===`include`?`include`:`omit`,redirect:n.redirect,unsafeHeaders:ge(t),reason:t?.reason,signal:t?.signal??void 0})},ve={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.`},ye={get:e=>j.getCookie(e)},be={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.`},xe=e=>j.setRequestHeaderRule(e),Se=e=>j.removeRequestHeaderRule({ruleId:e}),Ce=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}},we=class{start;end;source;constructor(e,t,n){this.start=e,this.end=t,this.source=n}},N;(function(e){e.stylesheet=`stylesheet`,e.rule=`rule`,e.declaration=`declaration`,e.comment=`comment`,e.atRule=`at-rule`,e.container=`container`,e.charset=`charset`,e.counterStyle=`counter-style`,e.document=`document`,e.customMedia=`custom-media`,e.fontFace=`font-face`,e.fontFeatureValues=`font-feature-values`,e.host=`host`,e.import=`import`,e.keyframes=`keyframes`,e.keyframe=`keyframe`,e.layer=`layer`,e.media=`media`,e.namespace=`namespace`,e.page=`page`,e.pageMarginBox=`page-margin-box`,e.positionTry=`position-try`,e.property=`property`,e.scope=`scope`,e.startingStyle=`starting-style`,e.supports=`supports`,e.viewTransition=`view-transition`})(N||={});var P=(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`)},F=(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=F(e,[`)`],o+1);if(t===-1)return-1;r=t+1}break;case`"`:{let t=P(e,[`"`],o+1);if(t===-1)return-1;r=t+1}break;case`'`:{let t=P(e,[`'`],o+1);if(t===-1)return-1;r=t+1}break;default:return o}i--}while(i>0);throw Error(`Too many escaping`)},I=/\/\*[^]*?(?:\*\/|$)/g;function L(e){return e?e.trim():``}function R(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=>{R(e,r)}):n&&typeof n==`object`&&R(n,r)}return n&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var Te=class{level=0;indentation=` `;compress=!1;constructor(e){typeof e?.indent==`string`&&(this.indentation=e?.indent),e?.compress&&(this.compress=!0)}emit(e,t){return e}indent(e){return this.level=this.level||1,e?(this.level+=e,``):Array(this.level).join(this.indentation)}visit(e){switch(e.type){case N.stylesheet:return this.stylesheet(e);case N.rule:return this.rule(e);case N.declaration:return this.declaration(e);case N.comment:return this.comment(e);case N.container:return this.container(e);case N.charset:return this.charset(e);case N.counterStyle:return this.counterStyle(e);case N.document:return this.document(e);case N.customMedia:return this.customMedia(e);case N.fontFace:return this.fontFace(e);case N.fontFeatureValues:return this.fontFeatureValues(e);case N.host:return this.host(e);case N.import:return this.import(e);case N.keyframes:return this.keyframes(e);case N.keyframe:return this.keyframe(e);case N.layer:return this.layer(e);case N.media:return this.media(e);case N.namespace:return this.namespace(e);case N.page:return this.page(e);case N.pageMarginBox:return this.pageMarginBox(e);case N.positionTry:return this.positionTry(e);case N.property:return this.property(e);case N.scope:return this.scope(e);case N.startingStyle:return this.startingStyle(e);case N.supports:return this.supports(e);case N.viewTransition:return this.viewTransition(e);case N.atRule:return this.genericAtRule(e)}}mapVisit(e,t){let n=``;t||=``;for(let r=0,i=e.length;r<i;r++)n+=this.visit(e[r]),t&&r<i-1&&(n+=this.emit(t));return n}compile(e){return this.compress?e.stylesheet.rules.map(this.visit,this).join(``):this.stylesheet(e)}stylesheet(e){return this.mapVisit(e.stylesheet.rules,`
2
+
3
+ `)}comment(e){return this.compress?this.emit(``,e.position):this.emit(`${this.indent()}/*${e.comment}*/`,e.position)}container(e){return this.compress?this.emit(`@container ${e.container}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@container ${e.container}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
4
+
5
+ `)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}layer(e){return this.compress?this.emit(`@layer ${e.layer}`,e.position)+(e.rules?this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):`;`):this.emit(`${this.indent()}@layer ${e.layer}`,e.position)+(e.rules?this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
6
+
7
+ `)+this.emit(`\n${this.indent(-1)}${this.indent()}}`):`;`)}import(e){return this.emit(`@import ${e.import};`,e.position)}media(e){return this.compress?this.emit(`@media ${e.media}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@media ${e.media}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
8
+
9
+ `)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}document(e){let t=`@${e.vendor||``}document ${e.document}`;return this.compress?this.emit(t,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(t,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
10
+
11
+ `)+this.emit(`${this.indent(-1)}\n}`)}charset(e){return this.emit(`@charset ${e.charset};`,e.position)}namespace(e){return this.emit(`@namespace ${e.namespace};`,e.position)}startingStyle(e){return this.compress?this.emit(`@starting-style`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@starting-style`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
12
+
13
+ `)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}supports(e){return this.compress?this.emit(`@supports ${e.supports}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@supports ${e.supports}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
14
+
15
+ `)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}keyframes(e){return this.compress?this.emit(`@${e.vendor||``}keyframes ${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.keyframes)+this.emit(`}`):this.emit(`@${e.vendor||``}keyframes ${e.name}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.keyframes,`
16
+ `)+this.emit(`${this.indent(-1)}}`)}keyframe(e){let t=e.declarations;return this.compress?this.emit(e.values.join(`,`),e.position)+this.emit(`{`)+this.mapVisit(t)+this.emit(`}`):this.emit(this.indent())+this.emit(e.values.join(`, `),e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(t,`
17
+ `)+this.emit(`${this.indent(-1)}\n${this.indent()}}\n`)}page(e){if(this.compress){let t=e.selectors.length?e.selectors.join(`, `):``;return this.emit(`@page ${t}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`)}let t=e.selectors.length?`${e.selectors.join(`, `)} `:``;return this.emit(`@page ${t}`,e.position)+this.emit(`{
18
+ `)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
19
+ `)+this.emit(this.indent(-1))+this.emit(`
20
+ }`)}pageMarginBox(e){return this.compress?this.emit(`@${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`${this.indent()}@${e.name} `,e.position)+this.emit(`{
21
+ `)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
22
+ `)+this.emit(this.indent(-1))+this.emit(`\n${this.indent()}}`)}fontFace(e){return this.compress?this.emit(`@font-face`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@font-face `,e.position)+this.emit(`{
23
+ `)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
24
+ `)+this.emit(this.indent(-1))+this.emit(`
25
+ }`)}host(e){return this.compress?this.emit(`@host`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`@host`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
26
+
27
+ `)+this.emit(`${this.indent(-1)}\n}`)}customMedia(e){return this.emit(`@custom-media ${e.name} ${e.media};`,e.position)}property(e){return this.compress?this.emit(`@property ${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@property ${e.name} `,e.position)+this.emit(`{
28
+ `)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
29
+ `)+this.emit(this.indent(-1))+this.emit(`
30
+ }`)}counterStyle(e){return this.compress?this.emit(`@counter-style ${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@counter-style ${e.name} `,e.position)+this.emit(`{
31
+ `)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
32
+ `)+this.emit(this.indent(-1))+this.emit(`
33
+ }`)}fontFeatureValues(e){return this.compress?this.emit(`@font-feature-values ${e.fontFamily}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@font-feature-values ${e.fontFamily}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
34
+
35
+ `)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}scope(e){let t=e.scope?` ${e.scope}`:``;return this.compress?this.emit(`@scope${t}`,e.position)+this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):this.emit(`${this.indent()}@scope${t}`,e.position)+this.emit(` {\n${this.indent(1)}`)+this.mapVisit(e.rules,`
36
+
37
+ `)+this.emit(`\n${this.indent(-1)}${this.indent()}}`)}viewTransition(e){return this.compress?this.emit(`@view-transition`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@view-transition `,e.position)+this.emit(`{
38
+ `)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
39
+ `)+this.emit(this.indent(-1))+this.emit(`
40
+ }`)}positionTry(e){return this.compress?this.emit(`@position-try ${e.name}`,e.position)+this.emit(`{`)+this.mapVisit(e.declarations)+this.emit(`}`):this.emit(`@position-try ${e.name} `,e.position)+this.emit(`{
41
+ `)+this.emit(this.indent(1))+this.mapVisit(e.declarations,`
42
+ `)+this.emit(this.indent(-1))+this.emit(`
43
+ }`)}genericAtRule(e){let t=e.prelude?` ${e.prelude}`:``;if(this.compress)return this.emit(`@${e.name}${t}`,e.position)+(e.rules?this.emit(`{`)+this.mapVisit(e.rules)+this.emit(`}`):`;`);if(!e.rules)return this.emit(`${this.indent()}@${e.name}${t};`,e.position);let n=e.rules.some(e=>e.type!==N.declaration&&e.type!==N.comment),r=n?`
44
+
45
+ `:`
46
+ `;return this.emit(`${this.indent()}@${e.name}${t}`,e.position)+this.emit(n?` {\n${this.indent(1)}`:` {
47
+ `)+this.emit(n?``:this.indent(1))+this.mapVisit(e.rules,r)+this.emit(n?`\n${this.indent(-1)}${this.indent()}}`:`${this.indent(-1)}\n${this.indent()}}`)}rule(e){let t=e.declarations;if(!t.length)return``;if(this.compress)return this.emit(e.selectors.join(`,`),e.position)+this.emit(`{`)+this.mapVisit(t)+this.emit(`}`);let n=this.indent();return this.emit(e.selectors.map(e=>n+e).join(`,
48
+ `),e.position)+this.emit(` {
49
+ `)+this.emit(this.indent(1))+this.mapVisit(t,`
50
+ `)+this.emit(this.indent(-1))+this.emit(`\n${this.indent()}}`)}declaration(e){return this.compress?this.emit(`${e.property}:${e.value}`,e.position)+this.emit(`;`):e.property===`grid-template-areas`?this.emit(this.indent())+this.emit(e.property+`: `+e.value.split(`
51
+ `).join(`
52
+ `.padEnd(22)+this.indent()),e.position)+this.emit(`;`):this.emit(this.indent())+this.emit(`${e.property}: ${e.value}`,e.position)+this.emit(`;`)}},Ee=(e,t)=>{t||={};let n=1,r=1;function i(){let e={line:n,column:r};return i=>(i.position=new we(e,{line:n,column:r},t?.source||``),u(),i)}let a=[];function o(i){let o=new Ce(t?.source||``,i,n,r,e);if(!t?.silent)throw o;a.push(o)}function s(){let t=/^{\s*/.exec(e);return!!t&&(l(t),!0)}function c(){let t=/^}/.exec(e);return!!t&&(l(t),!0)}function l(t){let i=t[0];return function(e){let t=e.match(/\n/g);t&&(n+=t.length);let i=e.lastIndexOf(`
53
+ `);r=~i?e.length-i:r+e.length}(i),e=e.slice(i.length),t}function u(){let t=/^\s*/.exec(e);t&&l(t)}function d(e){e||=[];let t=f();for(;t;)e.push(t),t=f();return e}function f(){let t=i();if(e.charAt(0)!==`/`||e.charAt(1)!==`*`)return;let n=/^\/\*[^]*?\*\//.exec(e);return n?(l(n),t({type:N.comment,comment:n[0].slice(2,-2)})):o(`End of comment missing`)}function p(){let t=F(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=F(e,t,r);if(i===-1)return n.push(e.substring(r)),n;n.push(e.substring(r,i)),r=i+1}return n})(L(n).replace(I,``),[`,`]).map(e=>L(e))}function m(){let t=i(),n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/.exec(e);if(!n)return;l(n);let r=L(n[0]),a=/^:\s*/.exec(e);if(!a)return o(`property missing ':'`);l(a);let s=``,c=F(e,[`;`,`}`]);c!==-1&&(s=e.substring(0,c),l([s]),s=L(s).replace(I,``));let u=t({type:N.declaration,property:r.replace(I,``),value:s}),d=/^[;\s]*/.exec(e);return d&&l(d),u}function ee(){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 h(){let t=F(e,[`{`]);if(t===-1)return!1;let n=F(e,[`;`]),r=F(e,[`}`]);return!(n!==-1&&n<t)&&!(r!==-1&&r<t)}function g(){let n=[];if(!s())return o(`missing '{'`);for(d(n);e.length&&e.charAt(0)!==`}`;){if(e.charAt(0)===`@`){let e=w();if(e){n.push(e),d(n);continue}}if(h()){let e=T();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=w();if(e){n.push(e),d(n);continue}}if(h()){let e=T();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:N.keyframe,values:t,declarations:ee()||[]})}let y=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*`),b=C(`import`),x=C(`charset`),S=C(`namespace`);function C(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 w(){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:N.keyframes,name:u,vendor:r,keyframes:f}):o(`@keyframes missing '}'`)}()||function(){let t=i(),n=/^@media *([^{]+)/.exec(e);if(!n)return;let r=L(l(n)[1]);if(!s())return o(`@media missing '{'`);let a=_();return c()?t({type:N.media,media:r,rules:a}):o(`@media missing '}'`)}()||function(){let t=i(),n=/^@custom-media\s+(--\S+)\s+([^{;\s][^{;]*);/.exec(e);if(!n)return;let r=l(n);return t({type:N.customMedia,name:L(r[1]),media:L(r[2])})}()||function(){let t=i(),n=/^@supports *([^{]+)/.exec(e);if(!n)return;let r=L(l(n)[1]);if(!s())return o(`@supports missing '{'`);let a=_();return c()?t({type:N.supports,supports:r,rules:a}):o(`@supports missing '}'`)}()||b()||x()||S()||function(){let t=i(),n=/^@([-\w]+)?document *([^{]+)/.exec(e);if(!n)return;let r=l(n),a=L(r[1]),u=L(r[2]);if(!s())return o(`@document missing '{'`);let d=_();return c()?t({type:N.document,document:u,vendor:a,rules:d}):o(`@document missing '}'`)}()||function(){let t=i(),n=/^@page */.exec(e);if(!n)return;l(n);let r=p()||[];if(!s())return o(`@page missing '{'`);let a=[];for(d(a);e.length&&e.charAt(0)!==`}`;){if(e.charAt(0)===`@`){let e=w();if(e){a.push(e),d(a);continue}}let t=m();if(!t)break;a.push(t),d(a)}return c()?t({type:N.page,selectors:r,declarations:a}):o(`@page missing '}'`)}()||function(){let t=i(),n=/^@host\s*/.exec(e);if(!n)return;if(l(n),!s())return o(`@host missing '{'`);let r=_();return c()?t({type:N.host,rules:r}):o(`@host missing '}'`)}()||function(){let t=i(),n=/^@font-face\s*/.exec(e);if(!n)return;if(l(n),!s())return o(`@font-face missing '{'`);let r=d(),a=m();for(;a;)r.push(a),r=r.concat(d()),a=m();return c()?t({type:N.fontFace,declarations:r}):o(`@font-face missing '}'`)}()||function(){let t=i(),n=/^@font-feature-values\s+([^{]+)/.exec(e);if(!n)return;let r=L(l(n)[1]);if(!s())return o(`@font-feature-values missing '{'`);let a=_();return c()?t({type:N.fontFeatureValues,fontFamily:r,rules:a}):o(`@font-feature-values missing '}'`)}()||function(){let t=i(),n=/^@container *([^{]+)/.exec(e);if(!n)return;let r=L(l(n)[1]);if(!s())return o(`@container missing '{'`);let a=_();return c()?t({type:N.container,container:r,rules:a}):o(`@container missing '}'`)}()||function(){let t=i(),n=/^@starting-style\s*/.exec(e);if(!n)return;if(l(n),!s())return o(`@starting-style missing '{'`);let r=_();return c()?t({type:N.startingStyle,rules:r}):o(`@starting-style missing '}'`)}()||function(){let t=i(),n=/^@layer *([^{;@]+)/.exec(e);if(!n)return;let r=L(l(n)[1]);if(!s()){let n=/^[;\s]*/.exec(e);return n&&l(n),t({type:N.layer,layer:r})}let a=_();return c()?t({type:N.layer,layer:r,rules:a}):o(`@layer missing '}'`)}()||function(){let t=i(),n=/^@property\s+(--[-\w]+)\s*/.exec(e);if(!n)return;let r=l(n)[1];if(!s())return o(`@property missing '{'`);let a=d(),u=m();for(;u;)a.push(u),a=a.concat(d()),u=m();return c()?t({type:N.property,name:r,declarations:a}):o(`@property missing '}'`)}()||function(){let t=i(),n=/^@counter-style\s+([-\w]+)\s*/.exec(e);if(!n)return;let r=l(n)[1];if(!s())return o(`@counter-style missing '{'`);let a=d(),u=m();for(;u;)a.push(u),a=a.concat(d()),u=m();return c()?t({type:N.counterStyle,name:r,declarations:a}):o(`@counter-style missing '}'`)}()||function(){let t=i(),n=/^@scope\s*([^{]*)/.exec(e);if(!n)return;let r=L(l(n)[1]);if(!s())return o(`@scope missing '{'`);let a=_();return c()?t({type:N.scope,scope:r,rules:a}):o(`@scope missing '}'`)}()||function(){let t=i(),n=/^@view-transition\s*/.exec(e);if(!n)return;if(l(n),!s())return o(`@view-transition missing '{'`);let r=d(),a=m();for(;a;)r.push(a),r=r.concat(d()),a=m();return c()?t({type:N.viewTransition,declarations:r}):o(`@view-transition missing '}'`)}()||function(){let t=i(),n=/^@position-try\s+(--[-\w]+)\s*/.exec(e);if(!n)return;let r=l(n)[1];if(!s())return o(`@position-try missing '{'`);let a=d(),u=m();for(;u;)a.push(u),a=a.concat(d()),u=m();return c()?t({type:N.positionTry,name:r,declarations:a}):o(`@position-try missing '}'`)}()||function(){let t=i(),n=y.exec(e);if(!n)return;let r=l(n)[1];if(!s())return o(`@${r} missing '{'`);let a=d(),u=m();for(;u;)a.push(u),a=a.concat(d()),u=m();return c()?t({type:N.pageMarginBox,name:r,declarations:a}):o(`@${r} missing '}'`)}()||function(){let t=i(),n=/^@([-\w]+)\s*/.exec(e);if(!n)return;let r=l(n)[1],a=``,u=F(e,[`{`,`;`]);if(u!==-1&&u>0&&(a=L(e.substring(0,u)),l([e.substring(0,u)])),s()){let e=_();return c()?t({type:N.atRule,name:r,prelude:a,rules:e}):o(`@${r} missing '}'`)}let d=/^[;\s]*/.exec(e);return d&&l(d),t({type:N.atRule,name:r,prelude:a})}()}function T(){let e=i(),t=p();return t?(d(),e({type:N.rule,selectors:t,declarations:g()||[]})):o(`selector missing`)}return R(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=w()||T(),!n){if(t?.silent){l([e.charAt(0)]),u(),d(r);continue}break}r.push(n),d(r)}return r}();return{type:N.stylesheet,stylesheet:{source:t?.source,rules:n,parsingErrors:a}}}())},De=(e,t)=>new Te(t||{}).compile(e),Oe=`LocatorError`,z=`LocatorUnsupportedError`,ke=`LocatorDeniedError`,Ae=e=>typeof e==`object`&&e?e.name:void 0,B=e=>Object.assign(Error(e),{name:Oe}),je=(e,t=``,n)=>Object.assign(Error(e),{name:z,operation:t,backend:n}),Me=(e,t)=>je(`Locator operation not supported${t?` on the ${t} backend`:``}: ${e}`,e,t),V=e=>Ae(e)===z,H=e=>Ae(e)===ke,U=e=>H(e)||V(e),W=e=>{let t=(e.ownerDocument??e).defaultView;if(!t)throw B(`the resolved element belongs to a document with no window`);return t},G=(e,t)=>{let n=e?.[t];return typeof n==`function`?n:null},K=(e,t)=>{if(typeof e!=`object`||!e)return null;let n=(()=>{try{return G(W(e),t)}catch{return null}})();if(n&&e instanceof n)return n;let r=G(globalThis,t);return r&&e instanceof r?r:null},q=(e,t)=>K(e,t)!==null,J=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]},Ne=(e,t)=>{if(!q(e,t))throw B(`Strict mode violation: expected ${t}, got <${e.tagName.toLowerCase()}>`);return e},Pe=e=>e.tagName.toLowerCase(),Fe=new Set,Ie=e=>{Fe.add(e)},Le=/(?:^|[^\w-])(?:url|image|image-set|cross-fade|paint|element|expression)\s*\(/i,Re=e=>e.replace(/\\([0-9a-fA-F]{1,6})\s?/g,(e,t)=>String.fromCodePoint(Number.parseInt(t,16))).replace(/\\(.)/g,`$1`),ze=e=>!Le.test(Re(e.value)),Be=new Set([N.import,N.fontFace,N.namespace,N.charset,N.document,N.comment]),Ve=e=>{if(Be.has(e.type))return null;if(e.type===N.declaration)return ze(e)?e:null;let t=e,n={...t};for(let e of[`declarations`,`rules`,`keyframes`]){let r=t[e];Array.isArray(r)&&(n[e]=He(r))}return n},He=e=>e.map(e=>Ve(e)).filter(e=>e!==null),Ue=e=>{let t;try{t=Ee(e,{silent:!0})}catch{return``}return t.stylesheet.rules=He(t.stylesheet.rules),De(t)},We=(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)},Ge={resolve:(e,t)=>{let n=e.document.createElement(`style`);n.textContent=t.noSanitize?t.content:Ue(t.content);try{We(e.document,n)}catch(e){console.error(e)}Ie(n)}},Ke=(e,t)=>{let n=e.getBoundingClientRect();return{clientX:n.left+n.width*(t?.x??.5),clientY:n.top+n.height*(t?.y??.5)}},qe={resolve:(e,t={})=>{let n=J(e.elements),r=W(n),i={bubbles:!0,cancelable:!0,composed:!0,...Ke(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}))}},Je={resolve:(e,t={})=>{let n=J(e.elements),r=W(n),i={bubbles:!0,cancelable:!0,composed:!0,...Ke(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))}},Ye=(e,t)=>{e._valueTracker?.setValue(``);let n=(K(e,`HTMLTextAreaElement`)??K(e,`HTMLInputElement`))?.prototype,r=n&&Object.getOwnPropertyDescriptor(n,`value`)?.set;r?r.call(e,t):e.value=t},Xe=(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}}},Ze={resolve:(e,t,n={})=>{let r=J(e.elements),i=W(r),a=q(r,`HTMLInputElement`);if(a||q(r,`HTMLTextAreaElement`)){let e=r,n=a?Xe(e,t):null;n&&(r.dispatchEvent(new i.PointerEvent(`pointerdown`,n.pointerDown)),r.dispatchEvent(new i.MouseEvent(`mousedown`,n.mouseDown))),Ye(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(q(r,`HTMLElement`)&&r.isContentEditable){r.textContent=t,r.dispatchEvent(new i.Event(`input`,{bubbles:!0}));return}throw Error(`fill: element <${Pe(r)}> is not fillable`)}},Qe={resolve:(e,t={})=>J(e.elements).textContent},$e={resolve:(e,t,n={})=>J(e.elements).getAttribute(t)},et={resolve:(e,t={})=>{let n=J(e.elements);if(!q(n,`HTMLElement`))return!0;let r=W(n).getComputedStyle(n);if(r?.display===`none`||r?.visibility===`hidden`)return!1;let i=n.getBoundingClientRect();return i.width>0&&i.height>0}},tt={resolve:(e,t={})=>e.elements.length},nt={resolve:(e,t={})=>e.elements.length>0},Y=Object.freeze(Object.defineProperty({__proto__:null,click:qe,count:tt,exists:nt,fill:Ze,getAttribute:$e,hover:Je,isVisible:et,textContent:Qe},Symbol.toStringTag,{value:`Module`})),X=(e,t)=>e.elements.flatMap(e=>[...e.querySelectorAll(t)]),Z=e=>e.replaceAll(`"`,`\\"`),rt={to:`element`,css:!0,resolve:(e,t)=>X(e,t),render:e=>({fragment:typeof e==`string`?e:`?`,separator:`descend`})},it={to:`frame`,css:!0,barrier:`down`,resolve:(e,t)=>X(e,t),render:e=>({fragment:typeof e==`string`?e:`?`,separator:`down`})},at={element:{selectors:{locator:rt,frameLocator:it,getByRole:{to:`element`,resolve:(e,t)=>X(e,`[role="${CSS.escape(t)}"]`),render:e=>({fragment:typeof e==`string`?`[role="${Z(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("${Z(e)}")`:`:has-text(...)`})},getByTestId:{to:`element`,resolve:(e,t)=>X(e,`[data-testid="${CSS.escape(t)}"]`),render:e=>({fragment:typeof e==`string`?`[data-testid="${Z(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:qe,fill:Ze,hover:Je,textContent:Qe,getAttribute:$e,isVisible:et,count:tt,exists:nt}},frame:{selectors:{locator:rt,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:Ge}}},ot=(e,t=at)=>({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}}}),st=3e4,ct=50,lt=e=>{let t=e[e.length-1];return typeof t==`object`&&t?t:void 0},ut=e=>{let t=lt(e)?.timeout;return typeof t==`number`?t:st},dt=({executor:e,parts:t})=>({highlight:n=>e.highlight(t,n).then(()=>{},()=>{})}),ft=async e=>{let t={parts:e.parts,operation:e.operation,args:e.args,phase:`ensure`};await e.gate?.(t,dt(e))},pt=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`},dt(e));let o=ut(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(U(e))throw e;f=e;let t=s-Date.now();if(t<=0)break;await new Promise(e=>setTimeout(e,Math.min(ct,t)))}}finally{clearTimeout(d)}throw f},mt=(e,t,n,r)=>{let i={};for(let[a,o]of Object.entries(t[n].selectors))i[a]=(...i)=>mt(e,t,o.to,[...r,{kind:n,name:a,args:i}]);for(let a of Object.keys(t[n].operations))i[a]=(...t)=>pt({...e,parts:r,operation:a,args:t});return i.ensure=(t,n={})=>ft({...e,parts:r,operation:t,args:[n]}),i},ht=e=>mt(e,e.modules??at,`frame`,[]),gt=ot({element:{operations:{click:{resolve:(e,t={})=>Y.click.resolve(e,t)},hover:{resolve:(e,t={})=>Y.hover.resolve(e,t)},fill:{resolve:(e,t,n={})=>Y.fill.resolve(e,t,n)},textContent:{resolve:(e,t={})=>Y.textContent.resolve(e)},getAttribute:{resolve:(e,t,n={})=>Y.getAttribute.resolve(e,t)},isVisible:{resolve:(e,t={})=>Y.isVisible.resolve(e)},count:{resolve:(e,t={})=>Y.count.resolve(e)},exists:{resolve:(e,t={})=>Y.exists.resolve(e)},videoElement:{resolve:(e,t={})=>b(Ne(J(e.elements),`HTMLVideoElement`))}}},frame:{operations:{addStyleTag:{resolve:(e,t)=>Ge.resolve(e,t)}}}}),Q=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,r=e=>n===e||n.endsWith(`.${e}`);return r(`fkn.app`)||r(`fkn.dev`)||r(`sdbx.app`)},$=e=>{if(Q(e))throw Error(`attachFrame: refusing to target the extension's own pages or an FKN platform origin`)},_t=({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`)},vt={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.`},yt={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.`},bt=e=>{let t=ht({executor:e.executor,modules:gt,gate:e.gate}),n=(t,n={})=>($(t),e.goto(t,n)),r=()=>e.url();return{...t,goto:n,url:r}},xt=`FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY`,St=async({iframe:e,domains:t=[],syncCookies:n=!0,lockdown:r=!1})=>{let i=crypto.randomUUID();if($(e.src),_t({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(xt,{detail:i}));let{executeLocator:a,highlightLocator:o,ensureLocatorPermission:s,goto:c}=await j.attachFrame({marker:i,domains:t,syncCookies:n,lockdown:r});return bt({executor:{execute:a,highlight:o},gate:e=>s(e.parts,e.operation,e.args),goto:(e,t={})=>c({url:e,...t}),url:()=>e.src})},Ct={request:e=>j.requestPermissions(e.map(e=>({key:e.key,scope:e.scope??``,reason:e.reason})))};Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return se}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return me}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return he}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return be}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return _t}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return vt}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return xt}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return yt}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return St}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Ct}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return le}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return b}});
@@ -23,8 +23,16 @@ var c = /* @__PURE__ */ e({
23
23
  if (e?.fd !== void 0) throw Error("FKN WebVPN does not support file descriptors");
24
24
  super(e), e?.connection && this.__webvpn_tcp_socket_init__(e.connection);
25
25
  }
26
- __webvpn_tcp_socket_init__(e) {
27
- if (this._webVPNTcpSocketPromise = e.then((e) => {
26
+ __webvpn_tcp_socket_init__(e, t) {
27
+ if (t && (this._localAddress = {
28
+ address: t.localAddress,
29
+ family: t.localFamily,
30
+ port: t.localPort
31
+ }, this._remoteAddress = {
32
+ address: t.remoteAddress,
33
+ family: t.remoteFamily,
34
+ port: t.remotePort
35
+ }), this._webVPNTcpSocketPromise = e.then((e) => {
28
36
  let t = e.dataReadableStream.getReader(), n = e.dataWritableStream.getWriter();
29
37
  return this._localAddress = {
30
38
  address: e.localAddress,
@@ -232,8 +240,8 @@ var c = /* @__PURE__ */ e({
232
240
  let n = r(...e);
233
241
  this._closeEmitted = !1;
234
242
  let i = (e) => {
235
- let t = new l({ connection: Promise.resolve(e) });
236
- this.emit("connection", t);
243
+ let t = new l();
244
+ t.__webvpn_tcp_socket_init__(Promise.resolve(e), e), this.emit("connection", t);
237
245
  }, a = (e) => {
238
246
  this._localAddress = void 0;
239
247
  try {
@@ -31,7 +31,20 @@ declare class Socket$2 extends Stream.Duplex implements Socket {
31
31
  constructor(options?: SocketConstructorOpts & DuplexOptions & {
32
32
  connection?: ReturnType<WebVpnTcpSocket>;
33
33
  });
34
- __webvpn_tcp_socket_init__(connection: ReturnType<WebVpnTcpSocket>): Promise<(LocalTcpSocket & {
34
+ /**
35
+ * `endpoints` publishes the four addresses SYNCHRONOUSLY, for a socket whose connection is
36
+ * already in hand.
37
+ *
38
+ * Node fills an accepted socket's endpoints in before it emits 'connection', and consumers read
39
+ * them right there in the handler. Without this the values only land in the `.then()` below, one
40
+ * microtask after the emit, and until then every address getter on this class THROWS
41
+ * `Socket is not connected` rather than answering undefined, so a caller reading them the way
42
+ * Node allows gets an exception and, if it wrapped all four in one try block, loses every one of
43
+ * them. libtorrent-wasm's socket shim does exactly that on accept, and libtorrent drops a peer it
44
+ * cannot name with no alert and no reply, which reads from outside as the relay never delivering
45
+ * the connection at all.
46
+ */
47
+ __webvpn_tcp_socket_init__(connection: ReturnType<WebVpnTcpSocket>, endpoints?: Awaited<ReturnType<WebVpnTcpSocket>>): Promise<(LocalTcpSocket & {
35
48
  reader: ReadableStreamDefaultReader<Uint8Array>;
36
49
  writer: WritableStreamDefaultWriter<Uint8Array>;
37
50
  }) | undefined>;
@@ -0,0 +1 @@
1
+ const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./api-D5ioM3pa.cjs"),n=require("./utils-QfNXtEhb.cjs");let r=require("stream"),i=require("events");var a=e.t({Server:()=>s,Socket:()=>o,_default:()=>d,connect:()=>c,createConnection:()=>l,createServer:()=>u,default:()=>d,isIP:()=>n.r,isIPv4:()=>n.i,isIPv6:()=>n.a}),o=class extends r.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,t){if(t&&(this._localAddress={address:t.localAddress,family:t.localFamily,port:t.localPort},this._remoteAddress={address:t.remoteAddress,family:t.remoteFamily,port:t.remotePort}),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 r=n.c(...e),i=this.__webvpn_tcp_socket_init__(t.t.then(e=>e.cloud.webvpn.tcpSocket({remoteAddress:r.host??`localhost`,remotePort:r.port})));return r.callback&&i.then(e=>{e&&r.callback.call(this)}),this}_final(e){if(!this._webVPNTcpSocketPromise){e();return}this._webVPNTcpSocketPromise.then(async e=>{e&&await e.writer.close()}).then(()=>e(),t=>e(t))}_destroy(e,t){if(this._timeoutTimer&&clearTimeout(this._timeoutTimer),!this._webVPNTcpSocketPromise){t(e);return}this._webVPNTcpSocketPromise.then(async e=>{e&&await(this._resetRequested?e.resetAndDestroy():e.destroy())}).then(()=>t(e),()=>t(e))}destroySoon(){if(this.writableFinished){this.destroy();return}this.once(`finish`,()=>this.destroy()),this.end()}_resetRequested=!1;resetAndDestroy(){return this._resetRequested=!0,this.destroy(),this}_timeoutMs;_timeoutTimer;_restartTimeoutTimer(){this._timeoutTimer&&clearTimeout(this._timeoutTimer),this._timeoutMs&&(this._timeoutTimer=setTimeout(()=>this.emit(`timeout`),this._timeoutMs))}setTimeout(e,t){return t&&this.on(`timeout`,t),this._timeoutMs=e,this._restartTimeoutTimer(),this}setNoDelay(e){let t=e??!0;return this._setTcpOption({type:0,value:t}),this}setKeepAlive(e,t){let n=e??!1,r=t!==void 0&&t>0?Math.max(1,Math.round(t/1e3)):0;return this._setTcpOption({type:2,enabled:n,initialDelaySeconds:r}),this}setSendBufferSize(e){return this._setTcpOption({type:3,value:e}),this}setRecvBufferSize(e){return this._setTcpOption({type:4,value:e}),this}_typeOfService;getTypeOfService(){return this._typeOfService??0}setTypeOfService(e){return this._typeOfService=e,this}_setTcpOption(e){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},s=class extends i.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 r=n.c(...e);this._closeEmitted=!1;let i=e=>{let t=new o;t.__webvpn_tcp_socket_init__(Promise.resolve(e),e),this.emit(`connection`,t)},a=e=>{this._localAddress=void 0;try{e&&this.listenerCount(`error`)>0&&this.emit(`error`,e)}finally{this._emitClose()}},s=e=>t.t.then(t=>t.cloud.webvpn.tcpSocketListener({localAddress:e,localPort:r.port,onConnection:i,onClose:a})),c=r.host?s(r.host):s(`::`).catch(()=>s(`0.0.0.0`)),l=this.__webvpn_tcp_socket_listener_init__(c);return r.callback&&l.then(e=>{e&&r.callback.call(this)}),this}_closeEmitted=!1;_emitClose(){this._closeEmitted||(this._closeEmitted=!0,this.emit(`close`))}close(e){return this._webVPNTcpSocketListenerPromise&&this._webVPNTcpSocketListenerPromise.then(async t=>{if(t)try{await t.close(),this._localAddress=void 0,this._emitClose(),e&&e()}catch(t){this._localAddress=void 0,this._emitClose(),e&&e(t)}}),this}address(){return this._localAddress??null}getConnections(e){throw Error(`Method not implemented.`)}ref(){return this}unref(){return this}maxConnections;connections;listening;async[Symbol.asyncDispose](){}},c=(e,t)=>new o().connect(e,t),l=(e,t)=>new o().connect(e,t),u=(e,t)=>{typeof e==`function`&&(t=e,e=void 0);let n=new s(e);return t&&n.on(`connection`,t),n},d={Socket:o,Server:s,connect:c,createConnection:l,createServer:u,isIP:n.r,isIPv4:n.i,isIPv6:n.a};Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
package/net.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./utils-QfNXtEhb.cjs"),t=require("./net-D3A-Z8RL.cjs");exports.Server=t.t,exports.Socket=t.n,exports._default=t.r,exports.default=t.r,exports.connect=t.i,exports.createConnection=t.a,exports.createServer=t.o,exports.isIP=e.r,exports.isIPv4=e.i,exports.isIPv6=e.a;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./utils-QfNXtEhb.cjs"),t=require("./net-kma1sFhK.cjs");exports.Server=t.t,exports.Socket=t.n,exports._default=t.r,exports.default=t.r,exports.connect=t.i,exports.createConnection=t.a,exports.createServer=t.o,exports.isIP=e.r,exports.isIPv4=e.i,exports.isIPv6=e.a;
package/net.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as createConnection, c as isIP, i as connect, l as isIPv4, n as Socket, o as createServer, r as _default, t as Server, u as isIPv6 } from "./net-1AjTrb23.js";
1
+ import { a as createConnection, c as isIP, i as connect, l as isIPv4, n as Socket, o as createServer, r as _default, t as Server, u as isIPv6 } from "./net-BnGcJpUb.js";
2
2
  export { Server, Socket, _default, _default as default, connect, createConnection, createServer, isIP, isIPv4, isIPv6 };
package/net.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import { a as e, i as t, r as n } from "./utils-DVlbuXmW.js";
2
- import { a as r, i, n as a, o, r as s, t as c } from "./net-CR3V3Q5W.js";
2
+ import { a as r, i, n as a, o, r as s, t as c } from "./net-BDAN5Mvc.js";
3
3
  export { c as Server, a as Socket, s as _default, s as default, i as connect, r as createConnection, o as createServer, n as isIP, t as isIPv4, e as isIPv6 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fkn/lib",
3
- "version": "0.9.14",
3
+ "version": "0.9.15",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "type": "module",
@@ -1 +0,0 @@
1
- const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-CQqdCndr.cjs"),n=require("./api-D5ioM3pa.cjs"),r=require("./proxy-BsimoT14.cjs"),i=require("./dns.cjs"),a=require("./cloud/fs.cjs"),o=require("./net-D3A-Z8RL.cjs"),s=require("./dgram-C1E6TUWN.cjs"),c=require("./http.cjs");let l=require("osra");var u;(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`})(u||={});var d=(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`)},f=(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=f(e,[`)`],o+1);if(t===-1)return-1;r=t+1}break;case`"`:{let t=d(e,[`"`],o+1);if(t===-1)return-1;r=t+1}break;case`'`:{let t=d(e,[`'`],o+1);if(t===-1)return-1;r=t+1}break;default:return o}i--}while(i>0);throw Error(`Too many escaping`)};function p(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=>{p(e,r)}):n&&typeof n==`object`&&p(n,r)}return n&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var m=`LocatorUnsupportedError`,h=`LocatorDeniedError`,g=e=>typeof e==`object`&&e?e.name:void 0,_=(e,t=``,n)=>Object.assign(Error(e),{name:m,operation:t,backend:n}),v=(e,t)=>_(`Locator operation not supported${t?` on the ${t} backend`:``}: ${e}`,e,t),y=e=>g(e)===m,b=e=>g(e)===h,x=e=>b(e)||y(e),ee=/(?:^|[^\w-])(?:url|image|image-set|cross-fade|paint|element|expression)\s*\(/i,te=e=>e.replace(/\\([0-9a-fA-F]{1,6})\s?/g,(e,t)=>String.fromCodePoint(Number.parseInt(t,16))).replace(/\\(.)/g,`$1`),S=e=>!ee.test(te(e.value)),C=new Set([u.import,u.fontFace,u.namespace,u.charset,u.document,u.comment]),w=e=>{if(C.has(e.type))return null;if(e.type===u.declaration)return S(e)?e:null;let t=e,n={...t};for(let e of[`declarations`,`rules`,`keyframes`]){let r=t[e];Array.isArray(r)&&(n[e]=T(r))}return n},T=e=>e.map(e=>w(e)).filter(e=>e!==null),E=3e4,D=50,O=e=>{let t=e[e.length-1];return typeof t==`object`&&t?t:void 0},k=e=>{let t=O(e)?.timeout;return typeof t==`number`?t:E},A=({executor:e,parts:t})=>({highlight:n=>e.highlight(t,n).then(()=>{},()=>{})}),j=async e=>{let t={parts:e.parts,operation:e.operation,args:e.args,phase:`ensure`};await e.gate?.(t,A(e))},M=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`},A(e));let o=k(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(x(e))throw e;f=e;let t=s-Date.now();if(t<=0)break;await new Promise(e=>setTimeout(e,Math.min(D,t)))}}finally{clearTimeout(d)}throw f},N=(e,t,n,r)=>{let i={};for(let[a,o]of Object.entries(t[n].selectors))i[a]=(...i)=>N(e,t,o.to,[...r,{kind:n,name:a,args:i}]);for(let a of Object.keys(t[n].operations))i[a]=(...t)=>M({...e,parts:r,operation:a,args:t});return i.ensure=(t,n={})=>j({...e,parts:r,operation:t,args:[n]}),i},P=e=>e,F=`autoplay; fullscreen; encrypted-media; picture-in-picture; clipboard-read; clipboard-write`,I=2e4,L=65e3,ne=3e4,R=5e3,z=new Set,B=()=>`https://fkn.app`,V=e=>!e||e===`about:blank`,H=e=>e?``:`incognito-${crypto.randomUUID()}`,U=({target:e,session:t})=>{let n=new URL(`/attach-frame`,B());return e&&n.searchParams.set(`url`,e),t&&n.searchParams.set(`session`,t),n.href},W=(e,t,n)=>{let r,i=new Promise((e,i)=>{r=setTimeout(()=>i(Error(n)),t)});return Promise.race([e,i]).finally(()=>clearTimeout(r))},G=(e,t)=>{let n=()=>{a(),t()},r=e.parentNode,i=new MutationObserver(()=>{(!e.isConnected||e.parentNode!==r)&&(a(),t())}),a=()=>{window.removeEventListener(`pagehide`,n),i.disconnect()};window.addEventListener(`pagehide`,n,{once:!0}),r&&i.observe(r,{childList:!0}),e.isConnected||(a(),t())},K=()=>Object.assign(Error(`cloud.attachFrame: the attached iframe left the document or was reloaded; attach a fresh iframe`),{name:m}),q=(e,t)=>{let n=[...e.split(`;`),...t.split(`;`)].map(e=>e.trim()).filter(Boolean);return[...new Set(n)].join(`; `)},J=[300,1200,4e3],Y=e=>{let t=()=>{if(!e.isConnected)return;let t=e.style.height,n=e.getBoundingClientRect();n.height&&(e.style.height=`${n.height-1}px`,setTimeout(()=>{e.style.height=t},50))};t();for(let e of J)setTimeout(t,e)},X=e=>{let t=e.getAttribute(`sandbox`);if(t===null)return;let n=new Set(t.toLowerCase().split(/\s+/).filter(Boolean)),r=[`allow-scripts`,`allow-same-origin`].filter(e=>!n.has(e));if(r.length)throw Error(`cloud.attachFrame: the iframe's sandbox attribute must include ${r.join(` and `)} for the render proxy to load`)},Z=async({iframe:e,domains:n=[],syncCookies:r=!0,lockdown:i=!1})=>{if(typeof window>`u`)throw Error(`cloud.attachFrame needs a window realm`);if(i)throw Error(`cloud.attachFrame does not support lockdown; use the extension backend for a sealed frame`);if(!e.isConnected)throw Error(`cloud.attachFrame: the iframe must be connected to the document before attaching`);X(e);let a=e.getAttribute(`src`)??``,o=(()=>{if(V(a))return null;try{return new URL(e.src||a,location.href)}catch{throw Error(`cloud.attachFrame: the iframe src is not a valid URL: ${a}`)}})();if(o){let e=new URL(`/attach-frame`,B());if(o.origin===e.origin&&o.pathname===e.pathname)throw Error(`cloud.attachFrame: this iframe is already attached; navigate with the Frame returned by that attach or use a fresh iframe`)}let s=o?.href??``;s&&t.s(s);let c=s,u=H(r),d=new AbortController,f=e.referrerPolicy,p=e.allow;if(e.referrerPolicy=`origin`,e.allow=q(F,e.allow),e.src=U({target:s,session:u}),!e.contentWindow)throw Error(`cloud.attachFrame: the iframe window is not available`);try{let n=await W((0,l.expose)({},{key:`fkn-attach-frame`,origin:B(),transport:{receive:window,emit:e.contentWindow},unregisterSignal:d.signal,revivableModules:P(t.I)}),I,`cloud.attachFrame: timed out connecting to the render proxy page`);await W(n.ready(),L,`cloud.attachFrame: the render proxy never became ready`),s&&Y(e),G(e,()=>d.abort());let r=e.contentWindow,i=()=>{if(!(!d.signal.aborted&&e.isConnected&&e.contentWindow===r))throw d.abort(),K()};return t.a({executor:{execute:(e,t,r)=>z.has(t)?Promise.reject(v(t,`cloud`)):(i(),n.executeLocator(e,t,r)),highlight:async()=>{}},goto:async(t,r={})=>{let a=new URL(t,location.href).href;i();let{timeoutMs:o}=r;await W(n.goto(a,r),(o??ne)+R,`cloud.attachFrame: the render proxy did not answer goto; the frame may have been detached or its page reloaded`),c=a,Y(e)},url:()=>c})}catch(t){throw d.abort(),e.referrerPolicy=f,e.allow=p,e.src=s||`about:blank`,t}},re=()=>typeof window<`u`&&!0,Q=async()=>{let e=await n.t.then(e=>e.cloud.quota());return{premium:e.premium,overQuota:e.overQuota,throttled:e.overQuota&&!e.premium,usedBytes:e.usedBytes,limitBytes:e.limitBytes,remainingBytes:e.remaining,bytesPerSecond:e.bytesPerSecond,bitsPerSecond:e.bytesPerSecond*8}},ie=e.t({attachFrame:()=>Z,available:()=>$,dgram:()=>s.i,dns:()=>i.t,fetch:()=>r.t,fs:()=>a.t,http:()=>c.t,net:()=>o.s,quota:()=>Q}),$=()=>n.r;Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return $}});
package/cloud-y88zoTpE.js DELETED
@@ -1,283 +0,0 @@
1
- import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { I as t, a as n, s as r } from "./lib-BcEnB4iV.js";
3
- import { r as i, t as a } from "./api-DAQQBty8.js";
4
- import { t as o } from "./proxy-BthoIRuv.js";
5
- import { t as s } from "./dns.js";
6
- import { t as c } from "./cloud/fs.js";
7
- import { s as l } from "./net-CR3V3Q5W.js";
8
- import { i as u } from "./dgram-BDXvc69t.js";
9
- import { t as d } from "./http.js";
10
- import { expose as f } from "osra";
11
- //#region node_modules/@adobe/css-tools/dist/esm/adobe-css-tools.mjs
12
- var p;
13
- (function(e) {
14
- 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";
15
- })(p ||= {});
16
- var m = (e, t, n) => {
17
- let r = n, i = 1e4;
18
- do {
19
- let n = t.map((t) => e.indexOf(t, r));
20
- n.push(e.indexOf("\\", r));
21
- let a = n.filter((e) => e !== -1);
22
- if (a.length === 0) return -1;
23
- let o = Math.min(...a);
24
- if (e[o] !== "\\") return o;
25
- r = o + 2, i--;
26
- } while (i > 0);
27
- throw Error("Too many escaping");
28
- }, h = (e, t, n) => {
29
- let r = n, i = 1e4;
30
- do {
31
- let n = t.map((t) => e.indexOf(t, r));
32
- n.push(e.indexOf("(", r)), n.push(e.indexOf("\"", r)), n.push(e.indexOf("'", r)), n.push(e.indexOf("\\", r));
33
- let a = n.filter((e) => e !== -1);
34
- if (a.length === 0) return -1;
35
- let o = Math.min(...a);
36
- switch (e[o]) {
37
- case "\\":
38
- r = o + 2;
39
- break;
40
- case "(":
41
- {
42
- let t = h(e, [")"], o + 1);
43
- if (t === -1) return -1;
44
- r = t + 1;
45
- }
46
- break;
47
- case "\"":
48
- {
49
- let t = m(e, ["\""], o + 1);
50
- if (t === -1) return -1;
51
- r = t + 1;
52
- }
53
- break;
54
- case "'":
55
- {
56
- let t = m(e, ["'"], o + 1);
57
- if (t === -1) return -1;
58
- r = t + 1;
59
- }
60
- break;
61
- default: return o;
62
- }
63
- i--;
64
- } while (i > 0);
65
- throw Error("Too many escaping");
66
- };
67
- function g(e, t) {
68
- let n = e && typeof e.type == "string", r = n ? e : t;
69
- for (let t in e) {
70
- let n = e[t];
71
- Array.isArray(n) ? n.forEach((e) => {
72
- g(e, r);
73
- }) : n && typeof n == "object" && g(n, r);
74
- }
75
- return n && Object.defineProperty(e, "parent", {
76
- configurable: !0,
77
- writable: !0,
78
- enumerable: !1,
79
- value: t || null
80
- }), e;
81
- }
82
- var _ = "LocatorUnsupportedError", v = "LocatorDeniedError", y = (e) => typeof e == "object" && e ? e.name : void 0, b = (e, t = "", n) => Object.assign(Error(e), {
83
- name: _,
84
- operation: t,
85
- backend: n
86
- }), x = (e, t) => b(`Locator operation not supported${t ? ` on the ${t} backend` : ""}: ${e}`, e, t), S = (e) => y(e) === _, ee = (e) => y(e) === v, te = (e) => ee(e) || S(e), ne = /(?:^|[^\w-])(?:url|image|image-set|cross-fade|paint|element|expression)\s*\(/i, re = (e) => e.replace(/\\([0-9a-fA-F]{1,6})\s?/g, (e, t) => String.fromCodePoint(Number.parseInt(t, 16))).replace(/\\(.)/g, "$1"), C = (e) => !ne.test(re(e.value)), w = /* @__PURE__ */ new Set([
87
- p.import,
88
- p.fontFace,
89
- p.namespace,
90
- p.charset,
91
- p.document,
92
- p.comment
93
- ]), T = (e) => {
94
- if (w.has(e.type)) return null;
95
- if (e.type === p.declaration) return C(e) ? e : null;
96
- let t = e, n = { ...t };
97
- for (let e of [
98
- "declarations",
99
- "rules",
100
- "keyframes"
101
- ]) {
102
- let r = t[e];
103
- Array.isArray(r) && (n[e] = E(r));
104
- }
105
- return n;
106
- }, E = (e) => e.map((e) => T(e)).filter((e) => e !== null), D = 3e4, O = 50, k = (e) => {
107
- let t = e[e.length - 1];
108
- return typeof t == "object" && t ? t : void 0;
109
- }, A = (e) => {
110
- let t = k(e)?.timeout;
111
- return typeof t == "number" ? t : D;
112
- }, j = ({ executor: e, parts: t }) => ({ highlight: (n) => e.highlight(t, n).then(() => {}, () => {}) }), M = async (e) => {
113
- let t = {
114
- parts: e.parts,
115
- operation: e.operation,
116
- args: e.args,
117
- phase: "ensure"
118
- };
119
- await e.gate?.(t, j(e));
120
- }, N = async (e) => {
121
- let { executor: t, gate: n, parts: r, operation: i, args: a } = e;
122
- n && await n({
123
- parts: r,
124
- operation: i,
125
- args: a,
126
- phase: "execute"
127
- }, j(e));
128
- let o = A(a), s = Date.now() + o, c = /* @__PURE__ */ Error(`Locator timeout (${o}ms): ${i}`), { promise: l, reject: u } = Promise.withResolvers();
129
- l.catch(() => {});
130
- let d = setTimeout(() => u(c), o), f = c;
131
- try {
132
- for (; Date.now() < s;) try {
133
- return await Promise.race([t.execute(r, i, a), l]);
134
- } catch (e) {
135
- if (e === c) break;
136
- if (te(e)) throw e;
137
- f = e;
138
- let t = s - Date.now();
139
- if (t <= 0) break;
140
- await new Promise((e) => setTimeout(e, Math.min(O, t)));
141
- }
142
- } finally {
143
- clearTimeout(d);
144
- }
145
- throw f;
146
- }, P = (e, t, n, r) => {
147
- let i = {};
148
- for (let [a, o] of Object.entries(t[n].selectors)) i[a] = (...i) => P(e, t, o.to, [...r, {
149
- kind: n,
150
- name: a,
151
- args: i
152
- }]);
153
- for (let a of Object.keys(t[n].operations)) i[a] = (...t) => N({
154
- ...e,
155
- parts: r,
156
- operation: a,
157
- args: t
158
- });
159
- return i.ensure = (t, n = {}) => M({
160
- ...e,
161
- parts: r,
162
- operation: t,
163
- args: [n]
164
- }), i;
165
- }, F = (e) => e, I = "autoplay; fullscreen; encrypted-media; picture-in-picture; clipboard-read; clipboard-write", L = 2e4, R = 65e3, ie = 3e4, z = 5e3, B = /* @__PURE__ */ new Set(), V = () => "https://fkn.app", H = (e) => !e || e === "about:blank", U = (e) => e ? "" : `incognito-${crypto.randomUUID()}`, W = ({ target: e, session: t }) => {
166
- let n = new URL("/attach-frame", V());
167
- return e && n.searchParams.set("url", e), t && n.searchParams.set("session", t), n.href;
168
- }, G = (e, t, n) => {
169
- let r, i = new Promise((e, i) => {
170
- r = setTimeout(() => i(Error(n)), t);
171
- });
172
- return Promise.race([e, i]).finally(() => clearTimeout(r));
173
- }, K = (e, t) => {
174
- let n = () => {
175
- a(), t();
176
- }, r = e.parentNode, i = new MutationObserver(() => {
177
- (!e.isConnected || e.parentNode !== r) && (a(), t());
178
- }), a = () => {
179
- window.removeEventListener("pagehide", n), i.disconnect();
180
- };
181
- window.addEventListener("pagehide", n, { once: !0 }), r && i.observe(r, { childList: !0 }), e.isConnected || (a(), t());
182
- }, q = () => Object.assign(/* @__PURE__ */ Error("cloud.attachFrame: the attached iframe left the document or was reloaded; attach a fresh iframe"), { name: _ }), J = (e, t) => {
183
- let n = [...e.split(";"), ...t.split(";")].map((e) => e.trim()).filter(Boolean);
184
- return [...new Set(n)].join("; ");
185
- }, Y = [
186
- 300,
187
- 1200,
188
- 4e3
189
- ], X = (e) => {
190
- let t = () => {
191
- if (!e.isConnected) return;
192
- let t = e.style.height, n = e.getBoundingClientRect();
193
- n.height && (e.style.height = `${n.height - 1}px`, setTimeout(() => {
194
- e.style.height = t;
195
- }, 50));
196
- };
197
- t();
198
- for (let e of Y) setTimeout(t, e);
199
- }, ae = (e) => {
200
- let t = e.getAttribute("sandbox");
201
- if (t === null) return;
202
- let n = new Set(t.toLowerCase().split(/\s+/).filter(Boolean)), r = ["allow-scripts", "allow-same-origin"].filter((e) => !n.has(e));
203
- if (r.length) throw Error(`cloud.attachFrame: the iframe's sandbox attribute must include ${r.join(" and ")} for the render proxy to load`);
204
- }, Z = async ({ iframe: e, domains: i = [], syncCookies: a = !0, lockdown: o = !1 }) => {
205
- if (typeof window > "u") throw Error("cloud.attachFrame needs a window realm");
206
- if (o) throw Error("cloud.attachFrame does not support lockdown; use the extension backend for a sealed frame");
207
- if (!e.isConnected) throw Error("cloud.attachFrame: the iframe must be connected to the document before attaching");
208
- ae(e);
209
- let s = e.getAttribute("src") ?? "", c = (() => {
210
- if (H(s)) return null;
211
- try {
212
- return new URL(e.src || s, location.href);
213
- } catch {
214
- throw Error(`cloud.attachFrame: the iframe src is not a valid URL: ${s}`);
215
- }
216
- })();
217
- if (c) {
218
- let e = new URL("/attach-frame", V());
219
- if (c.origin === e.origin && c.pathname === e.pathname) throw Error("cloud.attachFrame: this iframe is already attached; navigate with the Frame returned by that attach or use a fresh iframe");
220
- }
221
- let l = c?.href ?? "";
222
- l && r(l);
223
- let u = l, d = U(a), p = new AbortController(), m = e.referrerPolicy, h = e.allow;
224
- if (e.referrerPolicy = "origin", e.allow = J(I, e.allow), e.src = W({
225
- target: l,
226
- session: d
227
- }), !e.contentWindow) throw Error("cloud.attachFrame: the iframe window is not available");
228
- try {
229
- let r = await G(f({}, {
230
- key: "fkn-attach-frame",
231
- origin: V(),
232
- transport: {
233
- receive: window,
234
- emit: e.contentWindow
235
- },
236
- unregisterSignal: p.signal,
237
- revivableModules: F(t)
238
- }), L, "cloud.attachFrame: timed out connecting to the render proxy page");
239
- await G(r.ready(), R, "cloud.attachFrame: the render proxy never became ready"), l && X(e), K(e, () => p.abort());
240
- let i = e.contentWindow, a = () => {
241
- if (!(!p.signal.aborted && e.isConnected && e.contentWindow === i)) throw p.abort(), q();
242
- };
243
- return n({
244
- executor: {
245
- execute: (e, t, n) => B.has(t) ? Promise.reject(x(t, "cloud")) : (a(), r.executeLocator(e, t, n)),
246
- highlight: async () => {}
247
- },
248
- goto: async (t, n = {}) => {
249
- let i = new URL(t, location.href).href;
250
- a();
251
- let { timeoutMs: o } = n;
252
- await G(r.goto(i, n), (o ?? ie) + z, "cloud.attachFrame: the render proxy did not answer goto; the frame may have been detached or its page reloaded"), u = i, X(e);
253
- },
254
- url: () => u
255
- });
256
- } catch (t) {
257
- throw p.abort(), e.referrerPolicy = m, e.allow = h, e.src = l || "about:blank", t;
258
- }
259
- }, oe = () => typeof window < "u" && !0, Q = async () => {
260
- let e = await a.then((e) => e.cloud.quota());
261
- return {
262
- premium: e.premium,
263
- overQuota: e.overQuota,
264
- throttled: e.overQuota && !e.premium,
265
- usedBytes: e.usedBytes,
266
- limitBytes: e.limitBytes,
267
- remainingBytes: e.remaining,
268
- bytesPerSecond: e.bytesPerSecond,
269
- bitsPerSecond: e.bytesPerSecond * 8
270
- };
271
- }, se = /* @__PURE__ */ e({
272
- attachFrame: () => Z,
273
- available: () => $,
274
- dgram: () => u,
275
- dns: () => s,
276
- fetch: () => o,
277
- fs: () => c,
278
- http: () => d,
279
- net: () => l,
280
- quota: () => Q
281
- }), $ = () => i;
282
- //#endregion
283
- export { oe as a, Z as i, se as n, Q as r, $ as t };
@@ -1 +0,0 @@
1
- const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./lib-CQqdCndr.cjs"),n=require("./api-D5ioM3pa.cjs"),r=require("./proxy-BsimoT14.cjs"),i=require("./desktop.cjs");var a=async e=>{if(typeof window>`u`)return!1;if(t.N())return!0;let r=await n.t,i=null,a=new Promise(e=>{i=()=>{t.N()&&e(!0)},t.M.addEventListener(`statuschange`,i)}),o=r.installPrompt.show(e).then(()=>!1),s=await Promise.race([a,o]);return i&&t.M.removeEventListener(`statuschange`,i),await r.installPrompt.hide().catch(()=>{}),s},o=null;t.P(()=>(o||=a().then(()=>void 0).finally(()=>{o=null}),o));var s=()=>typeof document<`u`&&t.N(),c=async(e,n)=>{if(r.n(e),n?.credentials===`include`){if(typeof document>`u`)throw Error(`fetch with credentials needs the FKN extension, which only exists in window realms`);return t.S(e,n)}return s()?t.S(e,{...n,credentials:`omit`}):i.available()?i.fetch(e,n):r.t(e,n)},l=e.t({ATTACH_FRAME_EVENT_KEY:()=>t.n,FORGEABLE_HEADERS:()=>t.O,LOCATOR_DENIED:()=>t.h,LOCATOR_ERROR:()=>t.u,LOCATOR_UNSUPPORTED:()=>t.m,assertAttachableFrameUrl:()=>t.s,assertFetchableUrl:()=>t.x,assertForgeableHeaders:()=>t.k,assertLockdownApplicable:()=>t.c,assertOneCookieIdentity:()=>t.A,attachFrame:()=>t.r,attachFramePermission:()=>t.i,available:()=>s,box:()=>t.L,cookies:()=>t.y,createFrame:()=>t.a,createVideoElementHandle:()=>t.R,events:()=>t.M,extension:()=>t.M,fetch:()=>t.S,fetchCredentialedPermission:()=>t.C,fetchLocalPermission:()=>t.w,fetchPermission:()=>t.T,gotoPermission:()=>t.o,handleRevivableModules:()=>t.I,hasForgedCookie:()=>t.j,isBlockedFetchUrl:()=>t.E,isBlockedFrameUrl:()=>t.l,isExtensionExposed:()=>t.N,isLocalNetworkUrl:()=>t.D,isLocatorDenied:()=>t.d,isLocatorUnsupported:()=>t.p,isTerminalError:()=>t.f,isType:()=>t.z,modifyRequestHeadersPermission:()=>t.g,permissions:()=>t.t,promptInstall:()=>a,readCookiePermission:()=>t.b,removeRequestHeaderRule:()=>t._,revive:()=>t.B,setMissingExtensionHandler:()=>t.P,setRequestHeaderRule:()=>t.v,type:()=>t.V,waitForExtensionExposure:()=>t.F});Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return l}});
@@ -1,78 +0,0 @@
1
- import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { A as t, B as n, C as r, D as i, E as a, F as o, I as s, L as c, M as l, N as u, O as d, P as f, R as p, S as m, T as h, V as g, _, a as v, b as y, c as b, d as x, f as S, g as C, h as w, i as T, j as E, k as D, l as O, m as k, n as A, o as j, p as M, r as N, s as P, t as F, u as I, v as L, w as R, x as z, y as B, z as V } from "./lib-BcEnB4iV.js";
3
- import { t as H } from "./api-DAQQBty8.js";
4
- import { n as U, t as W } from "./proxy-BthoIRuv.js";
5
- import { available as G, fetch as K } from "./desktop.js";
6
- //#region src/lib/extension-prompt.ts
7
- var q = async (e) => {
8
- if (typeof window > "u") return !1;
9
- if (u()) return !0;
10
- let t = await H, n = null, r = new Promise((e) => {
11
- n = () => {
12
- u() && e(!0);
13
- }, l.addEventListener("statuschange", n);
14
- }), i = t.installPrompt.show(e).then(() => !1), a = await Promise.race([r, i]);
15
- return n && l.removeEventListener("statuschange", n), await t.installPrompt.hide().catch(() => {}), a;
16
- }, J = null;
17
- f(() => (J ||= q().then(() => void 0).finally(() => {
18
- J = null;
19
- }), J));
20
- //#endregion
21
- //#region src/lib/auto.ts
22
- var Y = () => typeof document < "u" && u(), X = async (e, t) => {
23
- if (U(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 m(e, t);
26
- }
27
- return Y() ? m(e, {
28
- ...t,
29
- credentials: "omit"
30
- }) : G() ? K(e, t) : W(e, t);
31
- }, Z = /* @__PURE__ */ e({
32
- ATTACH_FRAME_EVENT_KEY: () => A,
33
- FORGEABLE_HEADERS: () => d,
34
- LOCATOR_DENIED: () => w,
35
- LOCATOR_ERROR: () => I,
36
- LOCATOR_UNSUPPORTED: () => k,
37
- assertAttachableFrameUrl: () => P,
38
- assertFetchableUrl: () => z,
39
- assertForgeableHeaders: () => D,
40
- assertLockdownApplicable: () => b,
41
- assertOneCookieIdentity: () => t,
42
- attachFrame: () => N,
43
- attachFramePermission: () => T,
44
- available: () => Y,
45
- box: () => c,
46
- cookies: () => B,
47
- createFrame: () => v,
48
- createVideoElementHandle: () => p,
49
- events: () => l,
50
- extension: () => l,
51
- fetch: () => m,
52
- fetchCredentialedPermission: () => r,
53
- fetchLocalPermission: () => R,
54
- fetchPermission: () => h,
55
- gotoPermission: () => j,
56
- handleRevivableModules: () => s,
57
- hasForgedCookie: () => E,
58
- isBlockedFetchUrl: () => a,
59
- isBlockedFrameUrl: () => O,
60
- isExtensionExposed: () => u,
61
- isLocalNetworkUrl: () => i,
62
- isLocatorDenied: () => x,
63
- isLocatorUnsupported: () => M,
64
- isTerminalError: () => S,
65
- isType: () => V,
66
- modifyRequestHeadersPermission: () => C,
67
- permissions: () => F,
68
- promptInstall: () => q,
69
- readCookiePermission: () => y,
70
- removeRequestHeaderRule: () => _,
71
- revive: () => n,
72
- setMissingExtensionHandler: () => f,
73
- setRequestHeaderRule: () => L,
74
- type: () => g,
75
- waitForExtensionExposure: () => o
76
- });
77
- //#endregion
78
- export { q as i, X as n, Y as r, Z as t };