@fkn/lib 0.9.24 → 0.9.25

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.
Files changed (121) hide show
  1. package/account.cjs +1 -1
  2. package/account.d.ts +7 -3
  3. package/account.js +7 -7
  4. package/api-BCJO3EWi.cjs +3 -0
  5. package/api-CesI0aMl.d.ts +677 -0
  6. package/{api-Jq4OSTp1.js → api-DLvscoll.js} +99 -96
  7. package/api.cjs +1 -0
  8. package/api.d.ts +3 -0
  9. package/api.js +2 -0
  10. package/attach-policy.cjs +1 -0
  11. package/attach-policy.d.ts +35 -0
  12. package/attach-policy.js +43 -0
  13. package/{busy-Bp1E3JPT.js → busy-B189uX--.js} +1 -1
  14. package/cloud/dgram.cjs +1 -1
  15. package/cloud/dgram.js +2 -2
  16. package/cloud/dns.d.ts +1 -1
  17. package/cloud/fetch.cjs +1 -1
  18. package/cloud/fetch.d.ts +1 -1
  19. package/cloud/fetch.js +1 -1
  20. package/cloud/fs/promises.d.ts +7 -6
  21. package/cloud/fs/promises.js +1 -1
  22. package/cloud/fs.cjs +1 -1
  23. package/cloud/fs.d.ts +3 -3
  24. package/cloud/fs.js +10 -9
  25. package/cloud/net.cjs +1 -1
  26. package/cloud/net.d.ts +1 -1
  27. package/cloud/net.js +3 -3
  28. package/cloud-B2ZG-0MF.cjs +1 -0
  29. package/cloud-B7pI3pp1.d.ts +37 -0
  30. package/{cloud-7rfQ2BRH.js → cloud-DolBoNvR.js} +59 -97
  31. package/cloud.cjs +1 -1
  32. package/cloud.d.ts +4 -4
  33. package/cloud.js +4 -4
  34. package/{connect-button-Ds9KpXHe.js → connect-button-CN4ZJwT6.js} +1 -1
  35. package/{connect-button-D8KXSL6s.d.ts → connect-button-DdoEikEd.d.ts} +1 -1
  36. package/contract-D6ksmIm6.d.ts +394 -0
  37. package/contract.cjs +0 -0
  38. package/contract.d.ts +3 -0
  39. package/contract.js +0 -0
  40. package/desktop.js +1 -1
  41. package/dgram.cjs +1 -1
  42. package/dgram.d.ts +6 -47
  43. package/dgram.js +406 -2
  44. package/dns.cjs +1 -1
  45. package/dns.d.ts +1 -3
  46. package/dns.js +2 -2
  47. package/extension-CJUeVRXf.d.ts +361 -0
  48. package/extension-DBazc3ff.cjs +1 -0
  49. package/extension-Dw9gzvei.js +84 -0
  50. package/extension.cjs +1 -1
  51. package/extension.d.ts +3 -3
  52. package/extension.js +3 -3
  53. package/fs/promises.cjs +1 -1
  54. package/fs/promises.d.ts +8 -9
  55. package/fs/promises.js +2 -2
  56. package/fs-DYP7utdw.cjs +1 -0
  57. package/{fs-CUmugp10.d.ts → fs-DlGE0ZNu.d.ts} +20 -21
  58. package/{fs-pOQSZfuf.js → fs-d2ANVBkm.js} +8 -8
  59. package/fs.cjs +1 -1
  60. package/fs.d.ts +2 -2
  61. package/fs.js +1 -1
  62. package/http.cjs +3 -3
  63. package/http.d.ts +4 -6
  64. package/http.js +8 -8
  65. package/{index-CJ0vHTcS.d.ts → index-BQgZVQl7.d.ts} +4 -7
  66. package/{index-DY8WjklJ.d.ts → index-BhO-wymH.d.ts} +15 -293
  67. package/{index-BIZeEsNu.d.ts → index-CGJTVju4.d.ts} +52 -46
  68. package/index.cjs +1 -1
  69. package/index.d.ts +12 -13
  70. package/index.js +61 -59
  71. package/lib-DLM2M3_i.cjs +53 -0
  72. package/{lib-k3lstfa4.js → lib-duLPF_WZ.js} +328 -277
  73. package/messages-DvpKMTsY.d.ts +28 -0
  74. package/messages.cjs +1 -0
  75. package/messages.d.ts +2 -0
  76. package/messages.js +4 -0
  77. package/{net-DaWv81tQ.d.ts → net-DAOcF3Eb.d.ts} +12 -16
  78. package/net.cjs +1 -1
  79. package/net.d.ts +1 -1
  80. package/net.js +318 -3
  81. package/{node-fs-BZCQUmeE.js → node-fs-C9ECR_9H.js} +2 -2
  82. package/opfs/promises.d.ts +7 -8
  83. package/opfs/promises.js +1 -1
  84. package/{opfs-BibrNGF0.js → opfs-D0goLAQW.js} +1 -1
  85. package/opfs.d.ts +24 -26
  86. package/opfs.js +3 -3
  87. package/package.json +27 -2
  88. package/packages.cjs +1 -1
  89. package/packages.d.ts +143 -2
  90. package/packages.js +15 -15
  91. package/{proxy-DmMu2_1z.d.ts → proxy-BubvP9sg.d.ts} +3 -3
  92. package/{proxy-BNdvRifw.cjs → proxy-CefKCs-i.cjs} +1 -1
  93. package/{proxy-CRbkWS4E.js → proxy-KUfE4cEQ.js} +3 -3
  94. package/react.d.ts +3 -7
  95. package/react.js +2 -2
  96. package/{storage-BNjLc1FV.js → storage-BjGr_vC4.js} +5 -5
  97. package/storage-DLB4ciMf.cjs +1 -0
  98. package/utils-BvgGdrgN.cjs +1 -0
  99. package/{utils-DVlbuXmW.js → utils-C-cAd4r4.js} +2 -3
  100. package/wire-Gbo-D74t.d.ts +91 -0
  101. package/wire.cjs +1 -0
  102. package/wire.d.ts +2 -0
  103. package/wire.js +4 -0
  104. package/api-BGYSJVvR.d.ts +0 -789
  105. package/api-C-TpWHAU.cjs +0 -3
  106. package/cloud-BqjwL5KM.cjs +0 -1
  107. package/cloud-DMTkzfcf.d.ts +0 -36
  108. package/dgram-BLN-mfgq.cjs +0 -1
  109. package/dgram-DHQcHefn.js +0 -405
  110. package/extension-B8Y0sUwC.js +0 -78
  111. package/extension-CMPZjuaV.d.ts +0 -16
  112. package/extension-CgSGjcSl.cjs +0 -1
  113. package/fs-BNnozBMU.cjs +0 -1
  114. package/lib-DbiVHPXE.cjs +0 -53
  115. package/lookup-BtwWaCZJ.d.ts +0 -7
  116. package/net-B6RHtWwe.cjs +0 -1
  117. package/net-yBkobZqK.js +0 -317
  118. package/packages-Cn8S-Hkn.d.ts +0 -217
  119. package/storage-qxXFLgTM.d.ts +0 -44
  120. package/storage-xAeRQQiz.cjs +0 -1
  121. package/utils-QfNXtEhb.cjs +0 -1
@@ -1,9 +1,9 @@
1
1
  import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { r as t } from "./busy-Bp1E3JPT.js";
3
- import { t as n } from "./node-fs-BZCQUmeE.js";
4
- import { c as r, f as i, l as a, o, r as s } from "./storage-BNjLc1FV.js";
5
- import { a as c, i as l, n as u, o as d, t as ee } from "./opfs-BibrNGF0.js";
6
- //#region src/lib/fs/hybrid.ts
2
+ import { r as t } from "./busy-B189uX--.js";
3
+ import { t as n } from "./node-fs-C9ECR_9H.js";
4
+ import { c as r, f as i, l as a, o, r as s } from "./storage-BjGr_vC4.js";
5
+ import { a as c, i as l, n as u, o as d, t as ee } from "./opfs-D0goLAQW.js";
6
+ //#region src/fs/hybrid.ts
7
7
  var f = /* @__PURE__ */ e({
8
8
  adopt: () => H,
9
9
  adoptable: () => U,
@@ -44,7 +44,7 @@ var f = /* @__PURE__ */ e({
44
44
  e in t && (delete t[e], C(v, t), M() || (P = N));
45
45
  }, k = () => Object.keys(w()), A = () => Object.keys(D()), re = () => b, j = null;
46
46
  t("storage replication", () => j !== null || W !== null);
47
- var M = () => Object.keys(w()).length > 0 || Object.keys(D()).length > 0, N = 6e4, ie = 10 * 6e4, P = N, F = null, I = () => {
47
+ var M = () => Object.keys(w()).length > 0 || Object.keys(D()).length > 0, N = 6e4, ie = 6e5, P = N, F = null, I = () => {
48
48
  F || typeof window > "u" || !M() || (F = setTimeout(() => {
49
49
  F = null, L();
50
50
  }, P), P = Math.min(P * 2, ie));
@@ -60,7 +60,7 @@ var M = () => Object.keys(w()).length > 0 || Object.keys(D()).length > 0, N = 6e
60
60
  }).finally(() => {
61
61
  j = null;
62
62
  }));
63
- }, ae = null, R = () => ae ??= import("./api-Jq4OSTp1.js").then((e) => e.n).then((e) => e.apiPromise), oe = async () => {
63
+ }, ae = null, R = () => ae ??= import("./api.js").then((e) => e.apiPromise), oe = async () => {
64
64
  G();
65
65
  let e = await h(), t = e === "connected", [n, r] = await Promise.all([m().then((e) => e ? u() : []).catch(() => []), t ? o().then((e) => ({
66
66
  ok: !0,
@@ -288,7 +288,7 @@ var M = () => Object.keys(w()).length > 0 || Object.keys(D()).length > 0, N = 6e
288
288
  };
289
289
  ge = () => {
290
290
  i.cloud.fs.setAdoptSource(o, a).catch(() => {});
291
- }, _e || (_e = !0, import("./api-Jq4OSTp1.js").then((e) => e.n).then((e) => e.onApiEpoch((e, t) => {
291
+ }, _e || (_e = !0, import("./api.js").then((e) => e.onApiEpoch((e, t) => {
292
292
  t > 1 && ge?.();
293
293
  })).catch(() => {})), await i.cloud.fs.setAdoptSource(o, a);
294
294
  }, ye = !1, G = () => {
package/fs.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./fs-BNnozBMU.cjs");exports.adopt=e.t,exports.adoptable=e.n,exports.appendFile=e.r,exports.appendFileSync=e.i,exports.available=e.a,exports.default=e.l,exports.exists=e.o,exports.existsSync=e.s,exports.flush=e.c,exports.lstatSync=e.d,exports.mkdir=e.f,exports.mkdirSync=e.p,exports.mount=e.m,exports.onConflict=e.h,exports.pending=e.g,exports.pendingDeletes=e._,exports.promises=e.v,exports.pull=e.y,exports.readFile=e.b,exports.readFileSync=e.x,exports.readdir=e.S,exports.readdirSync=e.C,exports.remount=e.w,exports.rename=e.T,exports.renameSync=e.E,exports.replicating=e.D,exports.rm=e.O,exports.rmSync=e.k,exports.rmdirSync=e.A,exports.stat=e.j,exports.statSync=e.M,exports.unlink=e.N,exports.unlinkSync=e.P,exports.writeFile=e.F,exports.writeFileSync=e.I;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./fs-DYP7utdw.cjs");exports.adopt=e.t,exports.adoptable=e.n,exports.appendFile=e.r,exports.appendFileSync=e.i,exports.available=e.a,exports.default=e.l,exports.exists=e.o,exports.existsSync=e.s,exports.flush=e.c,exports.lstatSync=e.d,exports.mkdir=e.f,exports.mkdirSync=e.p,exports.mount=e.m,exports.onConflict=e.h,exports.pending=e.g,exports.pendingDeletes=e._,exports.promises=e.v,exports.pull=e.y,exports.readFile=e.b,exports.readFileSync=e.x,exports.readdir=e.S,exports.readdirSync=e.C,exports.remount=e.w,exports.rename=e.T,exports.renameSync=e.E,exports.replicating=e.D,exports.rm=e.O,exports.rmSync=e.k,exports.rmdirSync=e.A,exports.stat=e.j,exports.statSync=e.M,exports.unlink=e.N,exports.unlinkSync=e.P,exports.writeFile=e.F,exports.writeFileSync=e.I;
package/fs.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { a as Stats } from "./index-CJ0vHTcS.js";
2
- import { A as rmdirSync, B as ConflictSide, C as readdirSync, D as replicating, E as renameSync, F as writeFile, I as writeFileSync, L as AdoptSummary, M as statSync, N as unlink, O as rm, P as unlinkSync, R as ConflictChoice, S as readdir, T as rename, V as FileConflict, _ as pendingDeletes, a as appendFileSync, b as readFile, c as existsSync, d as lstatSync, f as mkdir, g as pending, h as onConflict, i as appendFile, j as stat, k as rmSync, l as flush, m as mount, n as adopt, o as available, p as mkdirSync, r as adoptable, s as exists, t as _default, v as promises, w as remount, x as readFileSync, y as pull, z as ConflictResolver } from "./index-BIZeEsNu.js";
1
+ import { i as Stats } from "./index-BQgZVQl7.js";
2
+ import { A as rmdirSync, B as ConflictSide, C as readdirSync, D as replicating, E as renameSync, F as writeFile, I as writeFileSync, L as AdoptSummary, M as statSync, N as unlink, O as rm, P as unlinkSync, R as ConflictChoice, S as readdir, T as rename, V as FileConflict, _ as pendingDeletes, a as appendFileSync, b as readFile, c as existsSync, d as lstatSync, f as mkdir, g as pending, h as onConflict, i as appendFile, j as stat, k as rmSync, l as flush, m as mount, n as adopt, o as available, p as mkdirSync, r as adoptable, s as exists, t as _default, v as promises, w as remount, x as readFileSync, y as pull, z as ConflictResolver } from "./index-CGJTVju4.js";
3
3
  export { type AdoptSummary, type ConflictChoice, type ConflictResolver, type ConflictSide, type FileConflict, type Stats, adopt, adoptable, appendFile, appendFileSync, available, _default as default, exists, existsSync, flush, lstatSync, mkdir, mkdirSync, mount, onConflict, pending, pendingDeletes, promises, pull, readFile, readFileSync, readdir, readdirSync, remount, rename, renameSync, replicating, rm, rmSync, rmdirSync, stat, statSync, unlink, unlinkSync, writeFile, writeFileSync };
package/fs.js CHANGED
@@ -1,2 +1,2 @@
1
- import { A as e, C as t, D as n, E as r, F as i, I as a, M as o, N as s, O as c, P as l, S as u, T as d, _ as f, a as p, b as m, c as h, d as g, f as _, g as v, h as y, i as b, j as x, k as S, l as C, m as w, n as T, o as E, p as D, r as O, s as k, t as A, v as j, w as M, x as N, y as P } from "./fs-pOQSZfuf.js";
1
+ import { A as e, C as t, D as n, E as r, F as i, I as a, M as o, N as s, O as c, P as l, S as u, T as d, _ as f, a as p, b as m, c as h, d as g, f as _, g as v, h as y, i as b, j as x, k as S, l as C, m as w, n as T, o as E, p as D, r as O, s as k, t as A, v as j, w as M, x as N, y as P } from "./fs-d2ANVBkm.js";
2
2
  export { A as adopt, T as adoptable, O as appendFile, b as appendFileSync, p as available, C as default, E as exists, k as existsSync, h as flush, g as lstatSync, _ as mkdir, D as mkdirSync, w as mount, y as onConflict, v as pending, f as pendingDeletes, j as promises, P as pull, m as readFile, N as readFileSync, u as readdir, t as readdirSync, M as remount, d as rename, r as renameSync, n as replicating, c as rm, S as rmSync, e as rmdirSync, x as stat, o as statSync, s as unlink, l as unlinkSync, i as writeFile, a as writeFileSync };
package/http.cjs CHANGED
@@ -1,9 +1,9 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./net-B6RHtWwe.cjs");let n=require("buffer"),r=require("stream");var i=e.t({Agent:()=>T,ClientRequest:()=>S,HTTPParser:()=>g,IncomingMessage:()=>v,METHODS:()=>o,STATUS_CODES:()=>s,Server:()=>w,ServerResponse:()=>b,_default:()=>A,createServer:()=>k,default:()=>A,get:()=>O,globalAgent:()=>E,request:()=>D}),a=new TextDecoder(`latin1`),o=`ACL.BIND.CHECKOUT.CONNECT.COPY.DELETE.GET.HEAD.LINK.LOCK.M-SEARCH.MERGE.MKACTIVITY.MKCALENDAR.MKCOL.MOVE.NOTIFY.OPTIONS.PATCH.POST.PROPFIND.PROPPATCH.PURGE.PUT.REBIND.REPORT.SEARCH.SOURCE.SUBSCRIBE.TRACE.UNBIND.UNLINK.UNLOCK.UNSUBSCRIBE`.split(`.`),s={100:`Continue`,101:`Switching Protocols`,102:`Processing`,103:`Early Hints`,200:`OK`,201:`Created`,202:`Accepted`,203:`Non-Authoritative Information`,204:`No Content`,205:`Reset Content`,206:`Partial Content`,207:`Multi-Status`,208:`Already Reported`,226:`IM Used`,300:`Multiple Choices`,301:`Moved Permanently`,302:`Found`,303:`See Other`,304:`Not Modified`,305:`Use Proxy`,307:`Temporary Redirect`,308:`Permanent Redirect`,400:`Bad Request`,401:`Unauthorized`,402:`Payment Required`,403:`Forbidden`,404:`Not Found`,405:`Method Not Allowed`,406:`Not Acceptable`,407:`Proxy Authentication Required`,408:`Request Timeout`,409:`Conflict`,410:`Gone`,411:`Length Required`,412:`Precondition Failed`,413:`Payload Too Large`,414:`URI Too Long`,415:`Unsupported Media Type`,416:`Range Not Satisfiable`,417:`Expectation Failed`,418:`I'm a Teapot`,421:`Misdirected Request`,422:`Unprocessable Entity`,423:`Locked`,424:`Failed Dependency`,425:`Too Early`,426:`Upgrade Required`,428:`Precondition Required`,429:`Too Many Requests`,431:`Request Header Fields Too Large`,451:`Unavailable For Legal Reasons`,500:`Internal Server Error`,501:`Not Implemented`,502:`Bad Gateway`,503:`Service Unavailable`,504:`Gateway Timeout`,505:`HTTP Version Not Supported`,506:`Variant Also Negotiates`,507:`Insufficient Storage`,508:`Loop Detected`,509:`Bandwidth Limit Exceeded`,510:`Not Extended`,511:`Network Authentication Required`},c=new Set([`content-type`,`content-length`,`user-agent`,`referer`,`host`,`authorization`,`proxy-authorization`,`if-modified-since`,`if-unmodified-since`,`from`,`location`,`max-forwards`,`retry-after`,`etag`,`last-modified`,`server`,`age`,`expires`]),l=13,u=10,d=/^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/,f=(e,t)=>(e.code=t,e),p=(e,t)=>{if(e.length===0)return t;if(t.length===0)return e;let n=new Uint8Array(e.length+t.length);return n.set(e,0),n.set(t,e.length),n},m=(e,t)=>{for(let n=t;n+1<e.length;n++)if(e[n]===l&&e[n+1]===u)return n;return-1},h=e=>{for(let t=0;t+3<e.length;t++)if(e[t]===l&&e[t+1]===u&&e[t+2]===l&&e[t+3]===u)return t;return-1},g=class{mode;handlers;buf=new Uint8Array;state=`HEAD`;framing=`none`;bodyRemaining=0;chunkState=`size`;skipBody=!1;constructor(e,t){this.mode=e,this.handlers=t}execute(e){this.buf=p(this.buf,e);let t=!0;for(;t;)if(t=!1,this.state===`HEAD`){let e=h(this.buf);if(e===-1)return;let n=this.buf.subarray(0,e);this.buf=this.buf.subarray(e+4);let r=this.parseHead(n);this.handlers.onHeaders(r),this.setupBody(r),this.framing===`none`?(this.handlers.onComplete(),this.reset(),t=this.buf.length>0):(this.state=`BODY`,t=!0)}else this.consumeBody()&&(this.handlers.onComplete(),this.reset(),t=this.buf.length>0)}finish(){this.state===`BODY`&&this.framing===`eof`&&(this.handlers.onComplete(),this.reset())}reset(){this.state=`HEAD`,this.framing=`none`,this.bodyRemaining=0,this.chunkState=`size`,this.skipBody=!1}parseHead(e){let t=a.decode(e).split(`\r
2
- `),n=t.shift()??``,r=[];for(let e of t)(e.startsWith(` `)||e.startsWith(` `))&&r.length>0?r[r.length-1]+=` `+e.trim():r.push(e);let i=[],o={};for(let e of r){if(!e)continue;let t=e.indexOf(`:`);if(t===-1)continue;let n=e.slice(0,t).trim(),r=e.slice(t+1).trim();i.push(n,r),this.addHeader(o,n,r)}let s={httpVersionMajor:1,httpVersionMinor:1,httpVersion:`1.1`,headers:o,rawHeaders:i};if(this.mode===`request`){let[e,t,r]=n.split(` `);s.method=(e??`GET`).toUpperCase(),s.url=t??`/`,this.applyVersion(s,r)}else{let e=n.indexOf(` `),t=n.slice(0,e),r=n.slice(e+1),i=r.indexOf(` `),a=i===-1?r:r.slice(0,i);s.statusCode=parseInt(a,10)||0,s.statusMessage=i===-1?``:r.slice(i+1),this.applyVersion(s,t)}return s}applyVersion(e,t){let n=/HTTP\/(\d)\.(\d)/i.exec(t??``);n&&(e.httpVersionMajor=parseInt(n[1],10),e.httpVersionMinor=parseInt(n[2],10),e.httpVersion=`${e.httpVersionMajor}.${e.httpVersionMinor}`)}addHeader(e,t,n){let r=t.toLowerCase();if(r===`set-cookie`){let t=e[`set-cookie`];Array.isArray(t)?t.push(n):e[`set-cookie`]=[n];return}let i=e[r];i===void 0?e[r]=n:c.has(r)||(e[r]=`${i}, ${n}`)}setupBody(e){if(this.skipBody){this.framing=`none`;return}let t=e.headers[`transfer-encoding`];if(typeof t==`string`&&t.toLowerCase().includes(`chunked`)){this.framing=`chunked`,this.chunkState=`size`;return}let n=e.headers[`content-length`];if(typeof n==`string`&&n!==``){let e=parseInt(n,10);e>0?(this.framing=`length`,this.bodyRemaining=e):this.framing=`none`;return}if(this.mode===`response`){let t=e.statusCode??0;t>=100&&t<200||t===204||t===304?this.framing=`none`:this.framing=`eof`}else this.framing=`none`}consumeBody(){if(this.framing===`length`){if(this.buf.length===0)return!1;let e=Math.min(this.bodyRemaining,this.buf.length);return this.handlers.onBody(this.buf.subarray(0,e)),this.buf=this.buf.subarray(e),this.bodyRemaining-=e,this.bodyRemaining===0}return this.framing===`eof`?(this.buf.length>0&&(this.handlers.onBody(this.buf),this.buf=new Uint8Array),!1):this.framing===`chunked`?this.consumeChunked():!0}consumeChunked(){for(;;)if(this.chunkState===`size`){let e=m(this.buf,0);if(e===-1)return!1;let t=a.decode(this.buf.subarray(0,e)),n=parseInt(t.split(`;`)[0].trim(),16);if(this.buf=this.buf.subarray(e+2),Number.isNaN(n))return!0;n===0?this.chunkState=`trailer`:(this.bodyRemaining=n,this.chunkState=`data`)}else if(this.chunkState===`data`){if(this.buf.length===0)return!1;let e=Math.min(this.bodyRemaining,this.buf.length);this.handlers.onBody(this.buf.subarray(0,e)),this.buf=this.buf.subarray(e),this.bodyRemaining-=e,this.bodyRemaining===0&&(this.chunkState=`dataCRLF`)}else if(this.chunkState===`dataCRLF`){if(this.buf.length<2)return!1;this.buf=this.buf.subarray(2),this.chunkState=`size`}else{let e=m(this.buf,0);if(e===-1)return!1;let t=e===0;if(this.buf=this.buf.subarray(e+2),t)return!0}}},_=(e,t)=>n.Buffer.isBuffer(e)?e:typeof e==`string`?n.Buffer.from(e,t??`utf8`):e instanceof Uint8Array?n.Buffer.from(e):e instanceof ArrayBuffer?n.Buffer.from(new Uint8Array(e)):n.Buffer.from(String(e)),v=class extends r.Stream.Readable{httpVersion=`1.1`;httpVersionMajor=1;httpVersionMinor=1;headers={};rawHeaders=[];trailers={};rawTrailers=[];method;url;statusCode;statusMessage;complete=!1;socket;constructor(e){super(),this.socket=e}get connection(){return this.socket}_applyHead(e){this.httpVersion=e.httpVersion,this.httpVersionMajor=e.httpVersionMajor,this.httpVersionMinor=e.httpVersionMinor,this.headers=e.headers,this.rawHeaders=e.rawHeaders,this.method=e.method,this.url=e.url,this.statusCode=e.statusCode,this.statusMessage=e.statusMessage}_read(){}setTimeout(e,t){return this.socket.setTimeout(e,t),this}},y=class extends r.Stream.Writable{_headerStore=new Map;headersSent=!1;chunkedEncoding=!1;finished=!1;_bodyWritten=!1;setHeader(e,t){if(this.headersSent)throw f(Error(`Cannot set headers after they are sent to the client`),`ERR_HTTP_HEADERS_SENT`);if(typeof e!=`string`||!d.test(e))throw f(TypeError(`Header name must be a valid HTTP token [${JSON.stringify(String(e))}]`),`ERR_INVALID_HTTP_TOKEN`);if(t===void 0)throw f(TypeError(`Invalid value "undefined" for header "${e}"`),`ERR_HTTP_INVALID_HEADER_VALUE`);return this._headerStore.set(e.toLowerCase(),[e,Array.isArray(t)?[...t]:t]),this}getHeader(e){return this._headerStore.get(e.toLowerCase())?.[1]}getHeaderNames(){return[...this._headerStore.values()].map(([e])=>e)}getHeaders(){let e={};for(let[t,n]of this._headerStore.values())e[t]=n;return e}hasHeader(e){return this._headerStore.has(e.toLowerCase())}removeHeader(e){if(this.headersSent)throw Error(`Cannot remove headers after they are sent to the client`);this._headerStore.delete(e.toLowerCase())}_storeHeader(e){let t=this.hasHeader(`content-length`),n=this.getHeader(`transfer-encoding`);typeof n==`string`&&n.toLowerCase().includes(`chunked`)?this.chunkedEncoding=!0:!t&&this._shouldSendBody()&&(this.chunkedEncoding=!0,this.setHeader(`Transfer-Encoding`,`chunked`));let r=e+`\r
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./rolldown-runtime-BIInC43l.cjs"),t=require("./net.cjs");let n=require("buffer"),r=require("stream");var i=e.t({Agent:()=>T,ClientRequest:()=>S,HTTPParser:()=>g,IncomingMessage:()=>v,METHODS:()=>o,STATUS_CODES:()=>s,Server:()=>w,ServerResponse:()=>b,_default:()=>A,createServer:()=>k,default:()=>A,get:()=>O,globalAgent:()=>E,request:()=>D}),a=new TextDecoder(`latin1`),o=`ACL.BIND.CHECKOUT.CONNECT.COPY.DELETE.GET.HEAD.LINK.LOCK.M-SEARCH.MERGE.MKACTIVITY.MKCALENDAR.MKCOL.MOVE.NOTIFY.OPTIONS.PATCH.POST.PROPFIND.PROPPATCH.PURGE.PUT.REBIND.REPORT.SEARCH.SOURCE.SUBSCRIBE.TRACE.UNBIND.UNLINK.UNLOCK.UNSUBSCRIBE`.split(`.`),s={100:`Continue`,101:`Switching Protocols`,102:`Processing`,103:`Early Hints`,200:`OK`,201:`Created`,202:`Accepted`,203:`Non-Authoritative Information`,204:`No Content`,205:`Reset Content`,206:`Partial Content`,207:`Multi-Status`,208:`Already Reported`,226:`IM Used`,300:`Multiple Choices`,301:`Moved Permanently`,302:`Found`,303:`See Other`,304:`Not Modified`,305:`Use Proxy`,307:`Temporary Redirect`,308:`Permanent Redirect`,400:`Bad Request`,401:`Unauthorized`,402:`Payment Required`,403:`Forbidden`,404:`Not Found`,405:`Method Not Allowed`,406:`Not Acceptable`,407:`Proxy Authentication Required`,408:`Request Timeout`,409:`Conflict`,410:`Gone`,411:`Length Required`,412:`Precondition Failed`,413:`Payload Too Large`,414:`URI Too Long`,415:`Unsupported Media Type`,416:`Range Not Satisfiable`,417:`Expectation Failed`,418:`I'm a Teapot`,421:`Misdirected Request`,422:`Unprocessable Entity`,423:`Locked`,424:`Failed Dependency`,425:`Too Early`,426:`Upgrade Required`,428:`Precondition Required`,429:`Too Many Requests`,431:`Request Header Fields Too Large`,451:`Unavailable For Legal Reasons`,500:`Internal Server Error`,501:`Not Implemented`,502:`Bad Gateway`,503:`Service Unavailable`,504:`Gateway Timeout`,505:`HTTP Version Not Supported`,506:`Variant Also Negotiates`,507:`Insufficient Storage`,508:`Loop Detected`,509:`Bandwidth Limit Exceeded`,510:`Not Extended`,511:`Network Authentication Required`},c=new Set([`content-type`,`content-length`,`user-agent`,`referer`,`host`,`authorization`,`proxy-authorization`,`if-modified-since`,`if-unmodified-since`,`from`,`location`,`max-forwards`,`retry-after`,`etag`,`last-modified`,`server`,`age`,`expires`]),l=13,u=10,d=/^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/,f=(e,t)=>(e.code=t,e),p=(e,t)=>{if(e.length===0)return t;if(t.length===0)return e;let n=new Uint8Array(e.length+t.length);return n.set(e,0),n.set(t,e.length),n},m=(e,t)=>{for(let n=t;n+1<e.length;n++)if(e[n]===l&&e[n+1]===u)return n;return-1},h=e=>{for(let t=0;t+3<e.length;t++)if(e[t]===l&&e[t+1]===u&&e[t+2]===l&&e[t+3]===u)return t;return-1},g=class{mode;handlers;buf=new Uint8Array;state=`HEAD`;framing=`none`;bodyRemaining=0;chunkState=`size`;skipBody=!1;constructor(e,t){this.mode=e,this.handlers=t}execute(e){this.buf=p(this.buf,e);let t=!0;for(;t;)if(t=!1,this.state===`HEAD`){let e=h(this.buf);if(e===-1)return;let n=this.buf.subarray(0,e);this.buf=this.buf.subarray(e+4);let r=this.parseHead(n);this.handlers.onHeaders(r),this.setupBody(r),this.framing===`none`?(this.handlers.onComplete(),this.reset(),t=this.buf.length>0):(this.state=`BODY`,t=!0)}else this.consumeBody()&&(this.handlers.onComplete(),this.reset(),t=this.buf.length>0)}finish(){this.state===`BODY`&&this.framing===`eof`&&(this.handlers.onComplete(),this.reset())}reset(){this.state=`HEAD`,this.framing=`none`,this.bodyRemaining=0,this.chunkState=`size`,this.skipBody=!1}parseHead(e){let t=a.decode(e).split(`\r
2
+ `),n=t.shift()??``,r=[];for(let e of t)(e.startsWith(` `)||e.startsWith(` `))&&r.length>0?r[r.length-1]+=` `+e.trim():r.push(e);let i=[],o={};for(let e of r){if(!e)continue;let t=e.indexOf(`:`);if(t===-1)continue;let n=e.slice(0,t).trim(),r=e.slice(t+1).trim();i.push(n,r),this.addHeader(o,n,r)}let s={httpVersionMajor:1,httpVersionMinor:1,httpVersion:`1.1`,headers:o,rawHeaders:i};if(this.mode===`request`){let[e,t,r]=n.split(` `);s.method=(e??`GET`).toUpperCase(),s.url=t??`/`,this.applyVersion(s,r)}else{let e=n.indexOf(` `),t=n.slice(0,e),r=n.slice(e+1),i=r.indexOf(` `),a=i===-1?r:r.slice(0,i);s.statusCode=parseInt(a,10)||0,s.statusMessage=i===-1?``:r.slice(i+1),this.applyVersion(s,t)}return s}applyVersion(e,t){let n=/HTTP\/(\d)\.(\d)/i.exec(t??``);n&&(e.httpVersionMajor=parseInt(n[1],10),e.httpVersionMinor=parseInt(n[2],10),e.httpVersion=`${e.httpVersionMajor}.${e.httpVersionMinor}`)}addHeader(e,t,n){let r=t.toLowerCase();if(r===`set-cookie`){let t=e[`set-cookie`];Array.isArray(t)?t.push(n):e[`set-cookie`]=[n];return}let i=e[r];i===void 0?e[r]=n:c.has(r)||(e[r]=`${i}, ${n}`)}setupBody(e){if(this.skipBody){this.framing=`none`;return}let t=e.headers[`transfer-encoding`];if(typeof t==`string`&&t.toLowerCase().includes(`chunked`)){this.framing=`chunked`,this.chunkState=`size`;return}let n=e.headers[`content-length`];if(typeof n==`string`&&n!==``){let e=parseInt(n,10);e>0?(this.framing=`length`,this.bodyRemaining=e):this.framing=`none`;return}if(this.mode===`response`){let t=e.statusCode??0;this.framing=t>=100&&t<200||t===204||t===304?`none`:`eof`}else this.framing=`none`}consumeBody(){if(this.framing===`length`){if(this.buf.length===0)return!1;let e=Math.min(this.bodyRemaining,this.buf.length);return this.handlers.onBody(this.buf.subarray(0,e)),this.buf=this.buf.subarray(e),this.bodyRemaining-=e,this.bodyRemaining===0}return this.framing===`eof`?(this.buf.length>0&&(this.handlers.onBody(this.buf),this.buf=new Uint8Array),!1):this.framing!==`chunked`||this.consumeChunked()}consumeChunked(){for(;;)if(this.chunkState===`size`){let e=m(this.buf,0);if(e===-1)return!1;let t=a.decode(this.buf.subarray(0,e)),n=parseInt(t.split(`;`)[0].trim(),16);if(this.buf=this.buf.subarray(e+2),Number.isNaN(n))return!0;n===0?this.chunkState=`trailer`:(this.bodyRemaining=n,this.chunkState=`data`)}else if(this.chunkState===`data`){if(this.buf.length===0)return!1;let e=Math.min(this.bodyRemaining,this.buf.length);this.handlers.onBody(this.buf.subarray(0,e)),this.buf=this.buf.subarray(e),this.bodyRemaining-=e,this.bodyRemaining===0&&(this.chunkState=`dataCRLF`)}else if(this.chunkState===`dataCRLF`){if(this.buf.length<2)return!1;this.buf=this.buf.subarray(2),this.chunkState=`size`}else{let e=m(this.buf,0);if(e===-1)return!1;let t=e===0;if(this.buf=this.buf.subarray(e+2),t)return!0}}},_=(e,t)=>n.Buffer.isBuffer(e)?e:typeof e==`string`?n.Buffer.from(e,t??`utf8`):e instanceof Uint8Array?n.Buffer.from(e):e instanceof ArrayBuffer?n.Buffer.from(new Uint8Array(e)):n.Buffer.from(String(e)),v=class extends r.Stream.Readable{httpVersion=`1.1`;httpVersionMajor=1;httpVersionMinor=1;headers={};rawHeaders=[];trailers={};rawTrailers=[];method;url;statusCode;statusMessage;complete=!1;socket;constructor(e){super(),this.socket=e}get connection(){return this.socket}_applyHead(e){this.httpVersion=e.httpVersion,this.httpVersionMajor=e.httpVersionMajor,this.httpVersionMinor=e.httpVersionMinor,this.headers=e.headers,this.rawHeaders=e.rawHeaders,this.method=e.method,this.url=e.url,this.statusCode=e.statusCode,this.statusMessage=e.statusMessage}_read(){}setTimeout(e,t){return this.socket.setTimeout(e,t),this}},y=class extends r.Stream.Writable{_headerStore=new Map;headersSent=!1;chunkedEncoding=!1;finished=!1;_bodyWritten=!1;setHeader(e,t){if(this.headersSent)throw f(Error(`Cannot set headers after they are sent to the client`),`ERR_HTTP_HEADERS_SENT`);if(typeof e!=`string`||!d.test(e))throw f(TypeError(`Header name must be a valid HTTP token [${JSON.stringify(String(e))}]`),`ERR_INVALID_HTTP_TOKEN`);if(t===void 0)throw f(TypeError(`Invalid value "undefined" for header "${e}"`),`ERR_HTTP_INVALID_HEADER_VALUE`);return this._headerStore.set(e.toLowerCase(),[e,Array.isArray(t)?[...t]:t]),this}getHeader(e){return this._headerStore.get(e.toLowerCase())?.[1]}getHeaderNames(){return[...this._headerStore.values()].map(([e])=>e)}getHeaders(){let e={};for(let[t,n]of this._headerStore.values())e[t]=n;return e}hasHeader(e){return this._headerStore.has(e.toLowerCase())}removeHeader(e){if(this.headersSent)throw Error(`Cannot remove headers after they are sent to the client`);this._headerStore.delete(e.toLowerCase())}_storeHeader(e){let t=this.hasHeader(`content-length`),n=this.getHeader(`transfer-encoding`);typeof n==`string`&&n.toLowerCase().includes(`chunked`)?this.chunkedEncoding=!0:!t&&this._shouldSendBody()&&(this.chunkedEncoding=!0,this.setHeader(`Transfer-Encoding`,`chunked`));let r=e+`\r
3
3
  `;for(let[e,t]of this._headerStore.values())if(Array.isArray(t))for(let n of t)r+=`${e}: ${n}\r\n`;else r+=`${e}: ${t}\r\n`;return r+=`\r
4
4
  `,r}_writeToSocket(e,t){if(!this.socket){t(Error(`Socket is not available`));return}this.socket.write(e,t)}write(e,t,n){return this._bodyWritten=!0,super.write(e,t,n)}_write(e,t,r){let i=_(e),a=[];if(this.headersSent||=(this._implicitHeader(),a.push(n.Buffer.from(this._headBlock,`latin1`)),!0),this.chunkedEncoding?i.length>0&&(a.push(n.Buffer.from(`${i.length.toString(16)}\r\n`,`latin1`)),a.push(i),a.push(n.Buffer.from(`\r
5
5
  `,`latin1`))):a.push(i),a.length===0){r();return}this._writeToSocket(n.Buffer.concat(a),r)}_final(e){let t=[];if(this.headersSent||=(!this.chunkedEncoding&&!this.hasHeader(`content-length`)&&this.setHeader(`Content-Length`,0),this._implicitHeader(),t.push(n.Buffer.from(this._headBlock,`latin1`)),!0),this.chunkedEncoding&&t.push(n.Buffer.from(`0\r
6
6
  \r
7
7
  `,`latin1`)),this.finished=!0,t.length===0){e();return}this._writeToSocket(n.Buffer.concat(t),e)}end(e,t,n){if(e!=null&&typeof e!=`function`&&!this._bodyWritten&&!this.headersSent&&!this.chunkedEncoding&&!this.hasHeader(`content-length`)){let n=typeof t==`string`?t:void 0;this.setHeader(`Content-Length`,_(e,n).length)}return super.end(e,t,n)}_headBlock},b=class extends y{statusCode=200;statusMessage;_writeHeadCalled=!1;sendDate=!0;req;socket;_keepAlive=!0;constructor(e){super(),this.req=e,this.socket=e.socket}_shouldSendBody(){if(this.req.method===`HEAD`)return!1;let e=this.statusCode;return!(e>=100&&e<200||e===204||e===304)}writeHead(e,t,n){if(this._writeHeadCalled||this.headersSent)throw f(Error(`Cannot render headers after they are sent to the client`),`ERR_HTTP_HEADERS_SENT`);this._writeHeadCalled=!0,this.statusCode=e;let r=n;if(typeof t==`string`?this.statusMessage=t:t!=null&&(r=t),Array.isArray(r)){let e=Array.isArray(r[0])?r:Array.from({length:Math.floor(r.length/2)},(e,t)=>[r[t*2],r[t*2+1]]);for(let[t,n]of e)n!==void 0&&this._appendHeader(t,n)}else if(r)for(let[e,t]of Object.entries(r))t!==void 0&&this.setHeader(e,t);return this}_appendHeader(e,t){let n=this.getHeader(e);if(n===void 0)this.setHeader(e,t);else{let r=[...Array.isArray(n)?n:[n],...Array.isArray(t)?t:[t]].map(String);this.setHeader(e,r)}}_implicitHeader(){let e=this.statusMessage??s[this.statusCode]??`unknown`;this.sendDate&&!this.hasHeader(`date`)&&this.setHeader(`Date`,new Date().toUTCString()),this.hasHeader(`connection`)||this.setHeader(`Connection`,this._keepAlive?`keep-alive`:`close`),this._headBlock=this._storeHeader(`HTTP/1.1 ${this.statusCode} ${e}`)}writeContinue(){this._writeToSocket(n.Buffer.from(`HTTP/1.1 100 Continue\r
8
8
  \r
9
- `,`latin1`),()=>{})}setTimeout(e,t){return this.socket?.setTimeout(e,t),this}},x=(...e)=>{let t={},n={},r,i=[...e],a=i.shift();if(typeof a==`string`||a instanceof URL){let e=typeof a==`string`?new URL(a):a;t={protocol:e.protocol,hostname:e.hostname,host:e.hostname,port:e.port,path:`${e.pathname}${e.search}`,auth:e.username?`${e.username}:${e.password}`:void 0};let o=i.shift();typeof o==`function`?r=o:o&&typeof o==`object`&&(n=o,r=i.shift())}else a&&typeof a==`object`&&(n=a,r=i.shift());return{options:{...t,...n},callback:r}},S=class extends y{method;path;host;protocol;socket;get connection(){return this.socket}res=null;aborted=!1;_aborted=!1;constructor(e,r){super(),this.method=(e.method??`GET`).toUpperCase(),this.path=e.path??`/`,this.protocol=e.protocol??`http:`;let i=e.hostname??e.host??`localhost`;this.host=i;let a=Number(e.port??(this.protocol===`https:`?443:80));if(r&&this.once(`response`,r),e.headers)for(let[t,n]of Object.entries(e.headers))n!==void 0&&this.setHeader(t,n);if(!this.hasHeader(`host`)){let e=this.protocol===`https:`&&a===443||this.protocol!==`https:`&&a===80;this.setHeader(`Host`,e?i:`${i}:${a}`)}e.auth&&!this.hasHeader(`authorization`)&&this.setHeader(`Authorization`,`Basic ${n.Buffer.from(e.auth).toString(`base64`)}`),this.socket=new t.n,this.emit(`socket`,this.socket),this.socket.on(`error`,e=>{this._aborted||this.emit(`error`,e)}),this._attachResponseParser(),this.socket.connect({host:i,port:a},()=>{this.emit(`connect`)})}_shouldSendBody(){return this.method!==`GET`&&this.method!==`HEAD`&&this.method!==`DELETE`}_implicitHeader(){this._headBlock=this._storeHeader(`${this.method} ${this.path} HTTP/1.1`)}_attachResponseParser(){let e=new v(this.socket),t=new g(`response`,{onHeaders:n=>{e._applyHead(n),this.method===`HEAD`&&(t.skipBody=!0),this.res=e,this.emit(`response`,e)},onBody:t=>{e.push(n.Buffer.from(t))},onComplete:()=>{e.complete=!0,e.push(null)}});this.socket.on(`data`,e=>{this._aborted||t.execute(e)}),this.socket.on(`end`,()=>{t.finish()}),this.socket.on(`close`,()=>{this.emit(`close`)})}abort(){this._aborted||(this._aborted=!0,this.aborted=!0,this.emit(`abort`),this.socket.destroy())}destroy(e){return this._aborted?this:(this._aborted=!0,this.socket.destroy(e),super.destroy(e),this)}end(e,t,n){return this._aborted?this:super.end(e,t,n)}_writeToSocket(e,t){if(this._aborted){t();return}super._writeToSocket(e,t)}setTimeout(e,t){return this.socket.setTimeout(e,t),this}setNoDelay(e){this.socket.setNoDelay(e)}setSocketKeepAlive(e,t){this.socket.setKeepAlive(e,t)}},C=class extends t.t{constructor(e,t){let n={},r=t;typeof e==`function`?r=e:e&&(n=e),super(n),r&&this.on(`request`,r),this.on(`connection`,e=>this._handleConnection(e))}_handleConnection(e){let t=null,r=new g(`request`,{onHeaders:n=>{t=new v(e),t._applyHead(n),n.method===`HEAD`&&(r.skipBody=!0);let i=new b(t),a=String(n.headers.connection??``).toLowerCase();i._keepAlive=n.httpVersionMinor>=1?a!==`close`:a===`keep-alive`,i.on(`finish`,()=>{i._keepAlive||e.end()}),this.emit(`request`,t,i)},onBody:e=>{t?.push(n.Buffer.from(e))},onComplete:()=>{t&&(t.complete=!0,t.push(null)),t=null}});e.on(`data`,e=>r.execute(e)),e.on(`end`,()=>{r.finish(),t&&t.push(null)}),e.on(`error`,t=>this.emit(`clientError`,t,e))}},w=new Proxy(C,{apply:(e,t,n)=>new e(...n)}),T=class{maxSockets;maxFreeSockets;keepAlive;options;constructor(e={}){this.options=e,this.keepAlive=!!e.keepAlive,this.maxSockets=e.maxSockets??1/0,this.maxFreeSockets=e.maxFreeSockets??256}getName(e={}){return`${e.host??`localhost`}:${e.port??``}:${e.localAddress??``}`}destroy(){}},E=new T,D=(...e)=>{let{options:t,callback:n}=x(...e);return new S(t,n)},O=(...e)=>{let t=D(...e);return t.end(),t},k=(e,t)=>new w(e,t),A={METHODS:o,STATUS_CODES:s,Agent:T,globalAgent:E,Server:w,ServerResponse:b,IncomingMessage:v,ClientRequest:S,OutgoingMessage:y,createServer:k,request:D,get:O};exports.Agent=T,exports.ClientRequest=S,exports.HTTPParser=g,exports.IncomingMessage=v,exports.METHODS=o,exports.STATUS_CODES=s,exports.Server=w,exports.ServerResponse=b,exports._default=A,exports.default=A,exports.createServer=k,exports.get=O,exports.globalAgent=E,exports.request=D,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}});
9
+ `,`latin1`),()=>{})}setTimeout(e,t){return this.socket?.setTimeout(e,t),this}},x=(...e)=>{let t={},n={},r,i=[...e],a=i.shift();if(typeof a==`string`||a instanceof URL){let e=typeof a==`string`?new URL(a):a;t={protocol:e.protocol,hostname:e.hostname,host:e.hostname,port:e.port,path:`${e.pathname}${e.search}`,auth:e.username?`${e.username}:${e.password}`:void 0};let o=i.shift();typeof o==`function`?r=o:o&&typeof o==`object`&&(n=o,r=i.shift())}else a&&typeof a==`object`&&(n=a,r=i.shift());return{options:{...t,...n},callback:r}},S=class extends y{method;path;host;protocol;socket;get connection(){return this.socket}res=null;aborted=!1;_aborted=!1;constructor(e,r){super(),this.method=(e.method??`GET`).toUpperCase(),this.path=e.path??`/`,this.protocol=e.protocol??`http:`;let i=e.hostname??e.host??`localhost`;this.host=i;let a=Number(e.port??(this.protocol===`https:`?443:80));if(r&&this.once(`response`,r),e.headers)for(let[t,n]of Object.entries(e.headers))n!==void 0&&this.setHeader(t,n);if(!this.hasHeader(`host`)){let e=this.protocol===`https:`&&a===443||this.protocol!==`https:`&&a===80;this.setHeader(`Host`,e?i:`${i}:${a}`)}e.auth&&!this.hasHeader(`authorization`)&&this.setHeader(`Authorization`,`Basic ${n.Buffer.from(e.auth).toString(`base64`)}`),this.socket=new t.Socket,this.emit(`socket`,this.socket),this.socket.on(`error`,e=>{this._aborted||this.emit(`error`,e)}),this._attachResponseParser(),this.socket.connect({host:i,port:a},()=>{this.emit(`connect`)})}_shouldSendBody(){return this.method!==`GET`&&this.method!==`HEAD`&&this.method!==`DELETE`}_implicitHeader(){this._headBlock=this._storeHeader(`${this.method} ${this.path} HTTP/1.1`)}_attachResponseParser(){let e=new v(this.socket),t=new g(`response`,{onHeaders:n=>{e._applyHead(n),this.method===`HEAD`&&(t.skipBody=!0),this.res=e,this.emit(`response`,e)},onBody:t=>{e.push(n.Buffer.from(t))},onComplete:()=>{e.complete=!0,e.push(null)}});this.socket.on(`data`,e=>{this._aborted||t.execute(e)}),this.socket.on(`end`,()=>{t.finish()}),this.socket.on(`close`,()=>{this.emit(`close`)})}abort(){this._aborted||(this._aborted=!0,this.aborted=!0,this.emit(`abort`),this.socket.destroy())}destroy(e){return this._aborted?this:(this._aborted=!0,this.socket.destroy(e),super.destroy(e),this)}end(e,t,n){return this._aborted?this:super.end(e,t,n)}_writeToSocket(e,t){if(this._aborted){t();return}super._writeToSocket(e,t)}setTimeout(e,t){return this.socket.setTimeout(e,t),this}setNoDelay(e){this.socket.setNoDelay(e)}setSocketKeepAlive(e,t){this.socket.setKeepAlive(e,t)}},C=class extends t.Server{constructor(e,t){let n={},r=t;typeof e==`function`?r=e:e&&(n=e),super(n),r&&this.on(`request`,r),this.on(`connection`,e=>this._handleConnection(e))}_handleConnection(e){let t=null,r=new g(`request`,{onHeaders:n=>{t=new v(e),t._applyHead(n),n.method===`HEAD`&&(r.skipBody=!0);let i=new b(t),a=String(n.headers.connection??``).toLowerCase();i._keepAlive=n.httpVersionMinor>=1?a!==`close`:a===`keep-alive`,i.on(`finish`,()=>{i._keepAlive||e.end()}),this.emit(`request`,t,i)},onBody:e=>{t?.push(n.Buffer.from(e))},onComplete:()=>{t&&(t.complete=!0,t.push(null)),t=null}});e.on(`data`,e=>r.execute(e)),e.on(`end`,()=>{r.finish(),t&&t.push(null)}),e.on(`error`,t=>this.emit(`clientError`,t,e))}},w=new Proxy(C,{apply:(e,t,n)=>new e(...n)}),T=class{maxSockets;maxFreeSockets;keepAlive;options;constructor(e={}){this.options=e,this.keepAlive=!!e.keepAlive,this.maxSockets=e.maxSockets??1/0,this.maxFreeSockets=e.maxFreeSockets??256}getName(e={}){return`${e.host??`localhost`}:${e.port??``}:${e.localAddress??``}`}destroy(){}},E=new T,D=(...e)=>{let{options:t,callback:n}=x(...e);return new S(t,n)},O=(...e)=>{let t=D(...e);return t.end(),t},k=(e,t)=>new w(e,t),A={METHODS:o,STATUS_CODES:s,Agent:T,globalAgent:E,Server:w,ServerResponse:b,IncomingMessage:v,ClientRequest:S,OutgoingMessage:y,createServer:k,request:D,get:O};exports.Agent=T,exports.ClientRequest=S,exports.HTTPParser=g,exports.IncomingMessage=v,exports.METHODS=o,exports.STATUS_CODES=s,exports.Server=w,exports.ServerResponse=b,exports._default=A,exports.default=A,exports.createServer=k,exports.get=O,exports.globalAgent=E,exports.request=D,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}});
package/http.d.ts CHANGED
@@ -1,9 +1,7 @@
1
- import { n as Socket, t as Server$1 } from "./net-DaWv81tQ.js";
1
+ import { n as Socket, t as Server$1 } from "./net-DAOcF3Eb.js";
2
2
  import { Buffer } from "buffer";
3
3
  import { Stream } from "stream";
4
4
  import { IncomingHttpHeaders, OutgoingHttpHeaders, RequestOptions } from "http";
5
-
6
- //#region src/lib/webvpn/http.d.ts
7
5
  declare namespace http_d_exports {
8
6
  export { Agent, ClientRequest, ClientRequestArgs, HTTPParser, IncomingMessage, METHODS, ParsedHead, RequestListener, STATUS_CODES, Server, ServerResponse, ServerResponseOptions, _default, createServer, _default as default, get, globalAgent, request };
9
7
  }
@@ -179,9 +177,9 @@ declare const _default: {
179
177
  IncomingMessage: typeof IncomingMessage;
180
178
  ClientRequest: typeof ClientRequest;
181
179
  OutgoingMessage: typeof OutgoingMessage;
182
- createServer: (options?: object | RequestListener, requestListener?: RequestListener) => Server;
183
- request: (...args: [options: string | URL | ClientRequestArgs, callback?: (res: IncomingMessage) => void] | [url: string | URL, options: ClientRequestArgs, callback?: (res: IncomingMessage) => void]) => ClientRequest;
184
- get: (...args: [options: string | URL | ClientRequestArgs, callback?: (res: IncomingMessage) => void] | [url: string | URL, options: ClientRequestArgs, callback?: (res: IncomingMessage) => void]) => ClientRequest;
180
+ createServer: typeof createServer;
181
+ request: typeof request;
182
+ get: typeof get;
185
183
  };
186
184
  //#endregion
187
185
  export { Agent, ClientRequest, ClientRequestArgs, HTTPParser, IncomingMessage, METHODS, ParsedHead, RequestListener, STATUS_CODES, Server, ServerResponse, ServerResponseOptions, _default, _default as default, createServer, get, globalAgent, request, http_d_exports as t };
package/http.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { n as t, t as n } from "./net-yBkobZqK.js";
2
+ import { Server as t, Socket as n } from "./net.js";
3
3
  import { Buffer as r } from "buffer";
4
4
  import { Stream as i } from "stream";
5
- //#region src/lib/webvpn/http.ts
5
+ //#region src/webvpn/http.ts
6
6
  var a = /* @__PURE__ */ e({
7
7
  Agent: () => T,
8
8
  ClientRequest: () => C,
@@ -201,7 +201,7 @@ var a = /* @__PURE__ */ e({
201
201
  }
202
202
  if (this.mode === "response") {
203
203
  let t = e.statusCode ?? 0;
204
- t >= 100 && t < 200 || t === 204 || t === 304 ? this.framing = "none" : this.framing = "eof";
204
+ this.framing = t >= 100 && t < 200 || t === 204 || t === 304 ? "none" : "eof";
205
205
  } else this.framing = "none";
206
206
  }
207
207
  consumeBody() {
@@ -210,7 +210,7 @@ var a = /* @__PURE__ */ e({
210
210
  let e = Math.min(this.bodyRemaining, this.buf.length);
211
211
  return this.handlers.onBody(this.buf.subarray(0, e)), this.buf = this.buf.subarray(e), this.bodyRemaining -= e, this.bodyRemaining === 0;
212
212
  }
213
- return this.framing === "eof" ? (this.buf.length > 0 && (this.handlers.onBody(this.buf), this.buf = /* @__PURE__ */ new Uint8Array()), !1) : this.framing === "chunked" ? this.consumeChunked() : !0;
213
+ return this.framing === "eof" ? (this.buf.length > 0 && (this.handlers.onBody(this.buf), this.buf = /* @__PURE__ */ new Uint8Array()), !1) : this.framing !== "chunked" || this.consumeChunked();
214
214
  }
215
215
  consumeChunked() {
216
216
  for (;;) if (this.chunkState === "size") {
@@ -410,17 +410,17 @@ var a = /* @__PURE__ */ e({
410
410
  res = null;
411
411
  aborted = !1;
412
412
  _aborted = !1;
413
- constructor(e, n) {
413
+ constructor(e, t) {
414
414
  super(), this.method = (e.method ?? "GET").toUpperCase(), this.path = e.path ?? "/", this.protocol = e.protocol ?? "http:";
415
415
  let i = e.hostname ?? e.host ?? "localhost";
416
416
  this.host = i;
417
417
  let a = Number(e.port ?? (this.protocol === "https:" ? 443 : 80));
418
- if (n && this.once("response", n), e.headers) for (let [t, n] of Object.entries(e.headers)) n !== void 0 && this.setHeader(t, n);
418
+ if (t && this.once("response", t), e.headers) for (let [t, n] of Object.entries(e.headers)) n !== void 0 && this.setHeader(t, n);
419
419
  if (!this.hasHeader("host")) {
420
420
  let e = this.protocol === "https:" && a === 443 || this.protocol !== "https:" && a === 80;
421
421
  this.setHeader("Host", e ? i : `${i}:${a}`);
422
422
  }
423
- e.auth && !this.hasHeader("authorization") && this.setHeader("Authorization", `Basic ${r.from(e.auth).toString("base64")}`), this.socket = new t(), this.emit("socket", this.socket), this.socket.on("error", (e) => {
423
+ e.auth && !this.hasHeader("authorization") && this.setHeader("Authorization", `Basic ${r.from(e.auth).toString("base64")}`), this.socket = new n(), this.emit("socket", this.socket), this.socket.on("error", (e) => {
424
424
  this._aborted || this.emit("error", e);
425
425
  }), this._attachResponseParser(), this.socket.connect({
426
426
  host: i,
@@ -480,7 +480,7 @@ var a = /* @__PURE__ */ e({
480
480
  setSocketKeepAlive(e, t) {
481
481
  this.socket.setKeepAlive(e, t);
482
482
  }
483
- }, w = new Proxy(class extends n {
483
+ }, w = new Proxy(class extends t {
484
484
  constructor(e, t) {
485
485
  let n = {}, r = t;
486
486
  typeof e == "function" ? r = e : e && (n = e), super(n), r && this.on("request", r), this.on("connection", (e) => this._handleConnection(e));
@@ -1,6 +1,6 @@
1
+ import "fs";
1
2
  import { Buffer as Buffer$1 } from "buffer";
2
-
3
- //#region src/lib/node-fs/shared.d.ts
3
+ //#region src/node-fs/shared.d.ts
4
4
  type ReadOptions = BufferEncoding | {
5
5
  encoding?: BufferEncoding | null;
6
6
  flag?: string;
@@ -11,7 +11,7 @@ type WriteOptions = BufferEncoding | {
11
11
  flag?: string;
12
12
  contentType?: string;
13
13
  } | null | undefined;
14
- type WriteData$1 = string | Uint8Array | ArrayBuffer | DataView;
14
+ type WriteData = string | Uint8Array | ArrayBuffer | DataView;
15
15
  type MakeOptions = {
16
16
  recursive?: boolean;
17
17
  } | number | null | undefined;
@@ -28,7 +28,4 @@ type Stats = {
28
28
  isSymbolicLink: () => boolean;
29
29
  };
30
30
  //#endregion
31
- //#region src/lib/fs/types.d.ts
32
- type WriteData = Blob | ArrayBuffer | Uint8Array | string;
33
- //#endregion
34
- export { Stats as a, ReadOptions as i, Callback as n, WriteData$1 as o, MakeOptions as r, WriteOptions as s, WriteData as t };
31
+ export { WriteData as a, Stats as i, MakeOptions as n, WriteOptions as o, ReadOptions as r, Callback as t };
@@ -1,100 +1,5 @@
1
1
  import { BoxBase, Capable, DefaultRevivableModules, RevivableContext, UnderlyingType } from "osra";
2
-
3
- //#region node_modules/@mfkn/web-extension/lib/lib/forgeable-headers.d.ts
4
- declare const FORGEABLE_HEADERS: string[];
5
- declare const hasForgedCookie: (unsafeHeaders: [string, string][] | undefined) => boolean;
6
- declare const assertOneCookieIdentity: (unsafeHeaders: [string, string][] | undefined, credentials: 'include' | 'omit') => void;
7
- declare const assertForgeableHeaders: (unsafeHeaders: [string, string][] | undefined) => void;
8
- //#endregion
9
- //#region node_modules/@mfkn/web-extension/lib/lib/fetch.d.ts
10
- declare const fetchPermission: {
11
- readonly scope: 'network.fetch';
12
- readonly category: 'network';
13
- readonly severity: 0;
14
- readonly title: 'Fetch data from other sites';
15
- readonly description: 'Lets the app download public data from other websites directly, past the usual cross-origin limits.';
16
- };
17
- declare const fetchCredentialedPermission: {
18
- readonly scope: 'network.fetchCredentialed';
19
- readonly category: 'network';
20
- readonly severity: 3;
21
- readonly unsafe: true;
22
- readonly title: 'Fetch from other sites, signed in as you';
23
- readonly description: 'Lets the app fetch other sites using your logged-in session cookies, so it can read data only you should see.';
24
- };
25
- declare const fetchLocalPermission: {
26
- readonly scope: 'network.fetchLocal';
27
- readonly category: 'network';
28
- readonly severity: 3;
29
- readonly unsafe: true;
30
- readonly title: 'Access devices on your local network';
31
- readonly description: 'Lets the app reach devices and services on your home or work network, which websites normally cannot touch.';
32
- };
33
- declare const isLocalNetworkUrl: (raw: string) => boolean;
34
- type ProxyFetchRequest = {
35
- url: string;
36
- method: string;
37
- headers: [string, string][];
38
- body: ArrayBuffer | null;
39
- credentials: 'include' | 'omit';
40
- redirect: RequestRedirect;
41
- unsafeHeaders?: [string, string][];
42
- reason?: string;
43
- signal?: AbortSignal;
44
- };
45
- type FetchInit = RequestInit & {
46
- reason?: string;
47
- };
48
- declare const isBlockedFetchUrl: (raw: string) => boolean;
49
- declare const assertFetchableUrl: (raw: string) => void;
50
- declare const fetch: (input: RequestInfo | URL, init?: FetchInit) => Promise<Response>;
51
- //#endregion
52
- //#region node_modules/@mfkn/web-extension/lib/lib/cookies.d.ts
53
- declare const readCookiePermission: {
54
- readonly scope: 'network.readCookie';
55
- readonly category: 'network';
56
- readonly severity: 3;
57
- readonly unsafe: true;
58
- readonly title: 'Read a site’s cookie';
59
- readonly description: 'Lets the app read a named cookie from another site, which can include the login token only that site should see.';
60
- };
61
- type CookieDetails = {
62
- url: string;
63
- name: string;
64
- };
65
- type SiteCookie = {
66
- name: string;
67
- value: string;
68
- };
69
- declare const cookies: {
70
- get: (details: CookieDetails) => Promise<SiteCookie | null>;
71
- };
72
- //#endregion
73
- //#region node_modules/@mfkn/web-extension/lib/lib/request-rules.d.ts
74
- declare const modifyRequestHeadersPermission: {
75
- readonly scope: 'network.modifyRequestHeaders';
76
- readonly category: 'network';
77
- readonly severity: 2;
78
- readonly unsafe: true;
79
- readonly title: 'Rewrite request headers to other sites';
80
- readonly description: 'Lets the app set or remove headers (like Origin and Referer) on this page’s own requests to the listed sites.';
81
- };
82
- type HeaderOperation = {
83
- header: string;
84
- operation: 'set' | 'remove';
85
- value?: string;
86
- };
87
- type RequestHeaderRule = {
88
- domains: string[];
89
- requestHeaders: HeaderOperation[];
90
- reason?: string;
91
- };
92
- declare const setRequestHeaderRule: (rule: RequestHeaderRule) => Promise<{
93
- ruleId: number;
94
- }>;
95
- declare const removeRequestHeaderRule: (ruleId: number) => Promise<void>;
96
- //#endregion
97
- //#region node_modules/@mfkn/frame-locator/lib/types.d.ts
2
+ //#region ../frame-locator/lib/types.d.ts
98
3
  type ChainKind = 'element' | 'frame';
99
4
  type SelectorPart = {
100
5
  kind: ChainKind;
@@ -161,21 +66,13 @@ type Executor = {
161
66
  stale?: Promise<void>;
162
67
  };
163
68
  //#endregion
164
- //#region node_modules/@mfkn/frame-locator/lib/errors.d.ts
165
- declare const LOCATOR_ERROR = "LocatorError";
166
- declare const LOCATOR_UNSUPPORTED = "LocatorUnsupportedError";
167
- declare const LOCATOR_DENIED = "LocatorDeniedError";
168
- declare const isLocatorUnsupported: (error: unknown) => boolean;
169
- declare const isLocatorDenied: (error: unknown) => boolean;
170
- declare const isTerminalError: (error: unknown) => boolean;
171
- //#endregion
172
- //#region node_modules/@mfkn/frame-locator/lib/add-style-tag.d.ts
69
+ //#region ../frame-locator/lib/add-style-tag.d.ts
173
70
  type AddStyleTagOptions$1 = OperationOptions & {
174
71
  content: string;
175
72
  noSanitize?: boolean;
176
73
  };
177
74
  //#endregion
178
- //#region node_modules/@mfkn/frame-locator/lib/fetch.d.ts
75
+ //#region ../frame-locator/lib/fetch.d.ts
179
76
  /**
180
77
  * A request issued from the realm the chain LANDS in, so the browser supplies that document's own
181
78
  * identity: its cookie jar (partitioned, on the extension path), its `Origin`, its `Referer` and its
@@ -207,7 +104,8 @@ type FrameFetchInit = OperationOptions & {
207
104
  type FrameFetchResult = {
208
105
  status: number;
209
106
  statusText: string;
210
- ok: boolean; /** Where the response came from AFTER redirects, which is the only honest answer to "who replied". */
107
+ ok: boolean;
108
+ /** Where the response came from AFTER redirects, which is the only honest answer to "who replied". */
211
109
  url: string;
212
110
  redirected: boolean;
213
111
  type: ResponseType;
@@ -215,7 +113,7 @@ type FrameFetchResult = {
215
113
  body: ArrayBuffer;
216
114
  };
217
115
  //#endregion
218
- //#region node_modules/@mfkn/frame-locator/lib/operations.d.ts
116
+ //#region ../frame-locator/lib/operations.d.ts
219
117
  type PositionOptions$1 = OperationOptions & {
220
118
  position?: {
221
119
  x?: number;
@@ -223,7 +121,7 @@ type PositionOptions$1 = OperationOptions & {
223
121
  };
224
122
  };
225
123
  //#endregion
226
- //#region node_modules/@mfkn/frame-locator/lib/modules.d.ts
124
+ //#region ../frame-locator/lib/modules.d.ts
227
125
  declare const defaultModules: {
228
126
  readonly element: {
229
127
  readonly selectors: {
@@ -374,7 +272,7 @@ type Extended<B extends Modules, S extends ModulesSpec> = {
374
272
  frame: MergeKind<B['frame'], S['frame']>;
375
273
  };
376
274
  //#endregion
377
- //#region node_modules/@mfkn/frame-locator/lib/chain.d.ts
275
+ //#region ../frame-locator/lib/chain.d.ts
378
276
  type ArgsOf<M> = M extends {
379
277
  resolve: (context: never, ...args: infer A) => unknown;
380
278
  } ? A : never;
@@ -386,7 +284,7 @@ type ToOf<M> = M extends {
386
284
  } ? K : 'element';
387
285
  type ChainOf<M extends Modules, K extends ChainKind> = K extends 'frame' ? FrameLocator<M> : Locator$1<M>;
388
286
  type EnsureOptions = OperationOptions & Record<string, unknown>;
389
- type Chain<M extends Modules, K extends ChainKind> = { [N in keyof M[K]['selectors']]: (...args: ArgsOf<M[K]['selectors'][N]>) => ChainOf<M, ToOf<M[K]['selectors'][N]>> } & { [N in keyof M[K]['operations']]: (...args: ArgsOf<M[K]['operations'][N]>) => Promise<ResultOf<M[K]['operations'][N]>> } & {
287
+ type Chain<M extends Modules, K extends ChainKind> = { [N in keyof M[K]['selectors']]: (...args: ArgsOf<M[K]['selectors'][N]>) => ChainOf<M, ToOf<M[K]['selectors'][N]>>; } & { [N in keyof M[K]['operations']]: (...args: ArgsOf<M[K]['operations'][N]>) => Promise<ResultOf<M[K]['operations'][N]>>; } & {
390
288
  ensure: (operation: Extract<keyof M[K]['operations'], string>, options?: EnsureOptions) => Promise<void>;
391
289
  };
392
290
  type Locator$1<M extends Modules = DefaultModules> = Chain<M, 'element'>;
@@ -459,7 +357,7 @@ declare const isType: (value: unknown) => value is RemoteVideoElement;
459
357
  declare const box: <T extends RemoteVideoElement, T2 extends RevivableContext>(value: T, context: T2) => BoxedVideoElement;
460
358
  declare const revive: <T extends BoxedVideoElement, T2 extends RevivableContext>(value: T, context: T2) => T[UnderlyingType];
461
359
  //#endregion
462
- //#region node_modules/@mfkn/web-extension/lib/lib/revivables/index.d.ts
360
+ //#region ../web-extension/lib/lib/revivables/index.d.ts
463
361
  declare const handleRevivableModules: (defaults: DefaultRevivableModules) => readonly [typeof video_d_exports, typeof import("osra/build/revivables/transfer"), typeof import("osra/build/revivables/identity"), typeof import("osra/build/revivables/array-buffer"), typeof import("osra/build/revivables/date"), typeof import("osra/build/revivables/headers"), typeof import("osra/build/revivables/error"), typeof import("osra/build/revivables/typed-array"), typeof import("osra/build/revivables/promise"), typeof import("osra/build/revivables/function"), typeof import("osra/build/revivables/message-port"), typeof import("osra/build/revivables/readable-stream"), typeof import("osra/build/revivables/writable-stream"), typeof import("osra/build/revivables/abort-signal"), typeof import("osra/build/revivables/response"), typeof import("osra/build/revivables/request"), typeof import("osra/build/revivables/map"), typeof import("osra/build/revivables/set"), typeof import("osra/build/revivables/bigint"), typeof import("osra/build/revivables/symbol"), typeof import("osra/build/revivables/event"), typeof import("osra/build/revivables/async-iterator"), {
464
362
  readonly type: 'nonFiniteNumber';
465
363
  readonly isType: (value: unknown) => value is number;
@@ -495,7 +393,7 @@ declare const handleRevivableModules: (defaults: DefaultRevivableModules) => rea
495
393
  readonly revive: (_value: import("osra/build/revivables/fallbacks").BoxedUnclonable, _context: import("osra").RevivableContext<any>) => Record<string, never>;
496
394
  }];
497
395
  //#endregion
498
- //#region node_modules/@mfkn/web-extension/lib/lib/locator-modules.d.ts
396
+ //#region ../web-extension/lib/lib/locator-modules.d.ts
499
397
  type LocatorOptions = OperationOptions & {
500
398
  reason?: string;
501
399
  };
@@ -682,20 +580,7 @@ declare const locatorModules: Extended<{
682
580
  }>;
683
581
  type LocatorModules = typeof locatorModules;
684
582
  //#endregion
685
- //#region node_modules/@mfkn/web-extension/lib/lib/frame-url.d.ts
686
- declare const isBlockedFrameUrl: (raw: string) => boolean;
687
- declare const assertAttachableFrameUrl: (raw: string) => void;
688
- declare const assertLockdownApplicable: ({
689
- src,
690
- domains,
691
- lockdown
692
- }: {
693
- src: string;
694
- domains: string[];
695
- lockdown: boolean;
696
- }) => void;
697
- //#endregion
698
- //#region node_modules/@mfkn/web-extension/lib/lib/frame-core.d.ts
583
+ //#region ../web-extension/lib/lib/frame-core.d.ts
699
584
  type Locator = Locator$1<LocatorModules>;
700
585
  declare const attachFramePermission: {
701
586
  readonly scope: 'embed.iframe';
@@ -733,171 +618,8 @@ type FrameBackend = {
733
618
  };
734
619
  declare const createFrame: (backend: FrameBackend) => Frame;
735
620
  //#endregion
736
- //#region node_modules/@mfkn/web-extension/lib/lib/frame.d.ts
621
+ //#region ../web-extension/lib/lib/frame.d.ts
737
622
  declare const ATTACH_FRAME_EVENT_KEY = "FKN_WEB_EXTENSION_ATTACH_FRAME_EVENT_KEY";
738
- declare const attachFrame: ({
739
- iframe,
740
- domains,
741
- syncCookies,
742
- lockdown
743
- }: AttachFrameOptions) => Promise<Frame>;
744
- //#endregion
745
- //#region node_modules/@mfkn/web-extension/lib/permission/shared/registry.d.ts
746
- declare const PERMISSIONS: readonly [{
747
- readonly scope: 'read.text';
748
- readonly category: 'read';
749
- readonly severity: 1;
750
- readonly title: 'Read text from the page';
751
- readonly description: 'Lets the app see the text shown on this page.';
752
- }, {
753
- readonly scope: 'read.info';
754
- readonly category: 'read';
755
- readonly severity: 1;
756
- readonly title: 'Read info from the page';
757
- readonly description: 'Lets the app read the href value from a part of the page.';
758
- }, {
759
- readonly scope: 'read.visible';
760
- readonly category: 'read';
761
- readonly severity: 0;
762
- readonly title: 'See what’s visible on the page';
763
- readonly description: 'Lets the app check which elements are currently on screen.';
764
- }, {
765
- readonly scope: 'read.check';
766
- readonly category: 'read';
767
- readonly severity: 0;
768
- readonly title: 'Check if something is on the page';
769
- readonly description: 'Lets the app test whether a specific element exists.';
770
- }, {
771
- readonly scope: 'read.count';
772
- readonly category: 'read';
773
- readonly severity: 0;
774
- readonly title: 'Count items on the page';
775
- readonly description: 'Lets the app count how many matching elements are present.';
776
- }, {
777
- readonly scope: 'act.click';
778
- readonly category: 'act';
779
- readonly severity: 3;
780
- readonly title: 'Click on the page';
781
- readonly description: 'Lets the app press buttons or links for you.';
782
- }, {
783
- readonly scope: 'act.type';
784
- readonly category: 'act';
785
- readonly severity: 1;
786
- readonly title: 'Type into a text field';
787
- readonly description: 'Lets the app fill in form fields on your behalf.';
788
- }, {
789
- readonly scope: 'act.hover';
790
- readonly category: 'act';
791
- readonly severity: 1;
792
- readonly title: 'Hover over the page';
793
- readonly description: 'Lets the app point at things to reveal menus or tooltips.';
794
- }, {
795
- readonly scope: 'media.video';
796
- readonly category: 'media';
797
- readonly severity: 0;
798
- readonly title: 'Control video playback';
799
- readonly description: 'Lets the app play, pause, seek, and read the video on the page.';
800
- }, {
801
- readonly scope: 'media.appear';
802
- readonly category: 'media';
803
- readonly severity: 0;
804
- readonly title: 'Change page appearance';
805
- readonly description: 'Lets the app restyle parts of the page (safely filtered).';
806
- }, {
807
- readonly scope: 'media.appearU';
808
- readonly category: 'media';
809
- readonly severity: 2;
810
- readonly unsafe: true;
811
- readonly title: 'Change page appearance (unsafe)';
812
- readonly description: 'Lets the app restyle the page WITHOUT safety filtering. Could be used to leak data over the network.';
813
- }, {
814
- readonly scope: 'embed.iframe';
815
- readonly category: 'embed';
816
- readonly severity: 0;
817
- readonly title: 'Load another website inside this app';
818
- readonly description: 'Lets the app embed external pages directly inside its own view.';
819
- }, {
820
- readonly scope: 'embed.open';
821
- readonly category: 'embed';
822
- readonly severity: 0;
823
- readonly title: 'Open a website inside this app';
824
- readonly description: 'Lets the app navigate to another site without leaving its window.';
825
- }, {
826
- readonly scope: 'frame.fetchRead';
827
- readonly category: 'network';
828
- readonly severity: 3;
829
- readonly unsafe: true;
830
- readonly title: 'Read your account data on this site';
831
- readonly description: 'Lets the app read pages and data from this site as you, using the session in the frame.';
832
- }, {
833
- readonly scope: 'frame.fetchWrite';
834
- readonly category: 'network';
835
- readonly severity: 3;
836
- readonly unsafe: true;
837
- readonly title: 'Change your account data on this site';
838
- readonly description: 'Lets the app send changes to this site as you, using the session in the frame.';
839
- }, {
840
- readonly scope: 'network.fetch';
841
- readonly category: 'network';
842
- readonly severity: 0;
843
- readonly title: 'Fetch data from other sites';
844
- readonly description: 'Lets the app download public data from other websites directly, past the usual cross-origin limits.';
845
- }, {
846
- readonly scope: 'network.fetchCredentialed';
847
- readonly category: 'network';
848
- readonly severity: 3;
849
- readonly unsafe: true;
850
- readonly title: 'Fetch from other sites, signed in as you';
851
- readonly description: 'Lets the app fetch other sites using your logged-in session cookies, so it can read data only you should see.';
852
- }, {
853
- readonly scope: 'network.fetchLocal';
854
- readonly category: 'network';
855
- readonly severity: 3;
856
- readonly unsafe: true;
857
- readonly title: 'Access devices on your local network';
858
- readonly description: 'Lets the app reach devices and services on your home or work network, which websites normally cannot touch.';
859
- }, {
860
- readonly scope: 'network.readCookie';
861
- readonly category: 'network';
862
- readonly severity: 3;
863
- readonly unsafe: true;
864
- readonly title: 'Read a site’s cookie';
865
- readonly description: 'Lets the app read a named cookie from another site, which can include the login token only that site should see.';
866
- }, {
867
- readonly scope: 'network.modifyRequestHeaders';
868
- readonly category: 'network';
869
- readonly severity: 2;
870
- readonly unsafe: true;
871
- readonly title: 'Rewrite request headers to other sites';
872
- readonly description: 'Lets the app set or remove headers (like Origin and Referer) on this page’s own requests to the listed sites.';
873
- }];
874
- type PermissionScope = (typeof PERMISSIONS)[number]['scope'];
875
- //#endregion
876
- //#region node_modules/@mfkn/web-extension/lib/lib/permissions.d.ts
877
- type PermissionRequest = {
878
- key: PermissionScope;
879
- scope?: string;
880
- reason?: string;
881
- };
882
- type PermissionGrant = {
883
- key: PermissionScope;
884
- scope: string;
885
- allow: boolean;
886
- };
887
- declare const permissions: {
888
- request: (requests: PermissionRequest[]) => Promise<PermissionGrant[]>;
889
- };
890
- //#endregion
891
- //#region node_modules/@mfkn/web-extension/lib/utils/extension.d.ts
892
- type ExtensionEventMap = {
893
- statuschange: CustomEvent<{
894
- enabled: boolean;
895
- }>;
896
- };
897
- declare const extension: import("osra").TypedEventTarget<ExtensionEventMap>;
898
- declare const isExtensionExposed: () => boolean;
899
- type MissingExtensionHandler = () => Promise<void>;
900
- declare const setMissingExtensionHandler: (handler: MissingExtensionHandler | null) => void;
901
- declare const waitForExtensionExposure: (timeout?: number) => Promise<void>;
623
+ declare const attachFrame: ({ iframe, domains, syncCookies, lockdown }: AttachFrameOptions) => Promise<Frame>;
902
624
  //#endregion
903
- export { fetch as $, LOCATOR_DENIED as A, SelectorPart as B, RemoteVideoElement as C, isType as D, createVideoElementHandle as E, isTerminalError as F, setRequestHeaderRule as G, RequestHeaderRule as H, Executor as I, cookies as J, CookieDetails as K, Gate as L, LOCATOR_UNSUPPORTED as M, isLocatorDenied as N, revive as O, isLocatorUnsupported as P, assertFetchableUrl as Q, GateTools as R, BoxedVideoElement as S, box as T, modifyRequestHeadersPermission as U, HeaderOperation as V, removeRequestHeaderRule as W, FetchInit as X, readCookiePermission as Y, ProxyFetchRequest as Z, gotoPermission as _, PermissionGrant as a, FORGEABLE_HEADERS as at, isBlockedFrameUrl as b, ATTACH_FRAME_EVENT_KEY as c, hasForgedCookie as ct, Frame as d, fetchCredentialedPermission as et, FrameBackend as f, createFrame as g, attachFramePermission as h, waitForExtensionExposure as i, isLocalNetworkUrl as it, LOCATOR_ERROR as j, type as k, attachFrame as l, Locator as m, isExtensionExposed as n, fetchPermission as nt, PermissionRequest as o, assertForgeableHeaders as ot, GotoOptions as p, SiteCookie as q, setMissingExtensionHandler as r, isBlockedFetchUrl as rt, permissions as s, assertOneCookieIdentity as st, extension as t, fetchLocalPermission as tt, AttachFrameOptions as u, assertAttachableFrameUrl as v, VideoElementState as w, handleRevivableModules as x, assertLockdownApplicable as y, OperationRequest as z };
625
+ export { OperationRequest as C, GateTools as S, isType as _, FrameBackend as a, Executor as b, attachFramePermission as c, handleRevivableModules as d, BoxedVideoElement as f, createVideoElementHandle as g, box as h, Frame as i, createFrame as l, VideoElementState as m, attachFrame as n, GotoOptions as o, RemoteVideoElement as p, AttachFrameOptions as r, Locator as s, ATTACH_FRAME_EVENT_KEY as t, gotoPermission as u, revive as v, SelectorPart as w, Gate as x, type as y };