thorwebdev
commited on
Commit
β’
59d509e
1
Parent(s):
5b47463
Initial commit.
Browse files- .gitattributes +1 -0
- README.md +17 -11
- assets/__vite-browser-external-BIHI7g3E.js +1 -0
- assets/index-BIxJTxbb.js +3 -0
- assets/index-C8iGwwE4.js +0 -0
- assets/index-D41yMqDA.js +15 -0
- assets/index-DDNtMdqT.css +1 -0
- assets/nodefs-CCGrc9rU.js +1 -0
- assets/postgres-7Zdp-caD.data +3 -0
- assets/postgres-DSvoAWnW.wasm +3 -0
- assets/vector.tar-NT8T069k.gz +3 -0
- assets/worker-Dx_8b-Xw.js +0 -0
- index.html +13 -18
- vite.svg +1 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
assets/postgres-7Zdp-caD.data filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
@@ -1,11 +1,17 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# In-Browser Semantic Search with Transformers.js and pglite + pgvector
|
2 |
+
|
3 |
+
100% in-browser Semantic Search with [Transformers.js](https://huggingface.co/docs/transformers.js), [PGlite](https://github.com/electric-sql/pglite) + [pgvector](https://github.com/pgvector/pgvector)!
|
4 |
+
|
5 |
+
## Getting Started
|
6 |
+
|
7 |
+
First, run the development server:
|
8 |
+
|
9 |
+
```bash
|
10 |
+
npm run dev
|
11 |
+
# or
|
12 |
+
yarn dev
|
13 |
+
# or
|
14 |
+
pnpm dev
|
15 |
+
```
|
16 |
+
|
17 |
+
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
|
assets/__vite-browser-external-BIHI7g3E.js
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
const e={};export{e as default};
|
assets/index-BIxJTxbb.js
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
import{x as W,P as K,L as y,h as E,g as l,z as B,D as Y,a as c,R as L}from"./index-C8iGwwE4.js";W();W();W();var $={EBADF:8,EBADFD:127,EEXIST:20,EINVAL:28,EISDIR:31,ENODEV:43,ENOENT:44,ENOTDIR:54,ENOTEMPTY:55},w=class extends Error{constructor(d,t){super(t),typeof d=="number"?this.code=d:typeof d=="string"&&(this.code=$[d])}},q=(d,t)=>{let a=d.FS,i={tryFSOperation(e){try{return e()}catch(r){throw r.code?r.code==="UNKNOWN"?new a.ErrnoError($.EINVAL):new a.ErrnoError(r.code):r}},mount(e){return i.createNode(null,"/",16895,0)},syncfs(e,r,s){},createNode(e,r,s,n){if(!a.isDir(s)&&!a.isFile(s))throw new a.ErrnoError(28);let o=a.createNode(e,r,s);return o.node_ops=i.node_ops,o.stream_ops=i.stream_ops,o},getMode:function(e){return i.tryFSOperation(()=>t.lstat(e).mode)},realPath:function(e){let r=[];for(;e.parent!==e;)r.push(e.name),e=e.parent;return r.push(e.mount.opts.root),r.reverse(),r.join("/")},node_ops:{getattr(e){m("getattr",i.realPath(e));let r=i.realPath(e);return i.tryFSOperation(()=>{let s=t.lstat(r);return{...s,dev:0,ino:e.id,nlink:1,rdev:e.rdev,atime:new Date(s.atime),mtime:new Date(s.mtime),ctime:new Date(s.ctime)}})},setattr(e,r){m("setattr",i.realPath(e),r);let s=i.realPath(e);i.tryFSOperation(()=>{r.mode!==void 0&&t.chmod(s,r.mode),r.size!==void 0&&t.truncate(s,r.size),r.timestamp!==void 0&&t.utimes(s,r.timestamp,r.timestamp),r.size!==void 0&&t.truncate(s,r.size)})},lookup(e,r){m("lookup",i.realPath(e),r);let s=[i.realPath(e),r].join("/"),n=i.getMode(s);return i.createNode(e,r,n)},mknod(e,r,s,n){m("mknod",i.realPath(e),r,s,n);let o=i.createNode(e,r,s,n),p=i.realPath(o);return i.tryFSOperation(()=>(a.isDir(o.mode)?t.mkdir(p,{mode:s}):t.writeFile(p,"",{mode:s}),o))},rename(e,r,s){m("rename",i.realPath(e),i.realPath(r),s);let n=i.realPath(e),o=[i.realPath(r),s].join("/");i.tryFSOperation(()=>{t.rename(n,o)}),e.name=s},unlink(e,r){m("unlink",i.realPath(e),r);let s=[i.realPath(e),r].join("/");try{t.unlink(s)}catch{}},rmdir(e,r){m("rmdir",i.realPath(e),r);let s=[i.realPath(e),r].join("/");return i.tryFSOperation(()=>{t.rmdir(s)})},readdir(e){m("readdir",i.realPath(e));let r=i.realPath(e);return i.tryFSOperation(()=>t.readdir(r))},symlink(e,r,s){throw m("symlink",i.realPath(e),r,s),new a.ErrnoError(63)},readlink(e){throw m("readlink",i.realPath(e)),new a.ErrnoError(63)}},stream_ops:{open(e){m("open stream",i.realPath(e.node));let r=i.realPath(e.node);return i.tryFSOperation(()=>{a.isFile(e.node.mode)&&(e.shared.refcount=1,e.nfd=t.open(r))})},close(e){return m("close stream",i.realPath(e.node)),i.tryFSOperation(()=>{a.isFile(e.node.mode)&&e.nfd&&--e.shared.refcount===0&&t.close(e.nfd)})},dup(e){m("dup stream",i.realPath(e.node)),e.shared.refcount++},read(e,r,s,n,o){return m("read stream",i.realPath(e.node),s,n,o),n===0?0:i.tryFSOperation(()=>t.read(e.nfd,r,s,n,o))},write(e,r,s,n,o){return m("write stream",i.realPath(e.node),s,n,o),i.tryFSOperation(()=>t.write(e.nfd,r.buffer,s,n,o))},llseek(e,r,s){m("llseek stream",i.realPath(e.node),r,s);let n=r;if(s===1?n+=e.position:s===2&&a.isFile(e.node.mode)&&i.tryFSOperation(()=>{let o=t.fstat(e.nfd);n+=o.size}),n<0)throw new a.ErrnoError(28);return n},mmap(e,r,s,n,o){if(m("mmap stream",i.realPath(e.node),r,s,n,o),!a.isFile(e.node.mode))throw new a.ErrnoError($.ENODEV);let p=d.mmapAlloc(r);return i.stream_ops.read(e,d.HEAP8,p,r,s),{ptr:p,allocated:!0}},msync(e,r,s,n,o){return m("msync stream",i.realPath(e.node),s,n,o),i.stream_ops.write(e,r,0,n,s),0}}};return i};function m(...d){}W();var G="state.txt",Q="data",H={DIR:16384,FILE:32768},R,T,b,I,j,u,O,S,v,D,F,k,h,C,N,M,g,f,_,J,x,U=class V{constructor({root:t,initialPoolSize:a,maintainedPoolSize:i}){y(this,h),y(this,R,!1),y(this,T),y(this,b),y(this,I),y(this,j),y(this,u),y(this,O,new Map),y(this,S,new Map),y(this,v,0),y(this,D,new Map),y(this,F,new Map),this.lastCheckpoint=0,this.checkpointInterval=1e3*60,this.poolCounter=0,y(this,k,new Set),this.root=t,this.initialPoolSize=a||1e3,this.maintainedPoolSize=i||100,this.readyPromise=c(this,h,C).call(this)}static async create(t){let a=new V(t);return await a.readyPromise,a}get ready(){return l(this,R)}async maintainPool(t){t=t||this.maintainedPoolSize;let a=t-this.state.pool.length,i=[];for(let e=0;e<a;e++)i.push(new Promise(async r=>{++this.poolCounter;let s=`${(Date.now()-1704063600).toString(16).padStart(8,"0")}-${this.poolCounter.toString(16).padStart(8,"0")}`,n=await l(this,I).getFileHandle(s,{create:!0}),o=await n.createSyncAccessHandle();l(this,O).set(s,n),l(this,S).set(s,o),c(this,h,M).call(this,{opp:"createPoolFile",args:[s]}),this.state.pool.push(s),r()}));for(let e=0;e>a;e--)i.push(new Promise(async r=>{var o;let s=this.state.pool.pop();c(this,h,M).call(this,{opp:"deletePoolFile",args:[s]});let n=l(this,O).get(s);(o=l(this,S).get(s))==null||o.close(),await n.remove().then(()=>{l(this,O).delete(s),l(this,S).delete(s),r()})}));await Promise.all(i)}_createPoolFileState(t){this.state.pool.push(t)}_deletePoolFileState(t){let a=this.state.pool.indexOf(t);a>-1&&this.state.pool.splice(a,1)}async maybeCheckpointState(){Date.now()-this.lastCheckpoint>this.checkpointInterval&&await this.checkpointState()}async checkpointState(){let t=new TextEncoder().encode(JSON.stringify(this.state));l(this,u).truncate(0),l(this,u).write(t,{at:0}),l(this,u).flush(),this.lastCheckpoint=Date.now()}flush(){for(let t of l(this,k))try{t.flush()}catch{}l(this,k).clear()}exit(){for(let t of l(this,S).values())t.close();l(this,u).flush(),l(this,u).close()}chmod(t,a){c(this,h,N).call(this,{opp:"chmod",args:[t,a]},()=>{this._chmodState(t,a)})}_chmodState(t,a){let i=c(this,h,f).call(this,t);i.mode=a}close(t){let a=c(this,h,_).call(this,t);l(this,D).delete(t),l(this,F).delete(a)}fstat(t){let a=c(this,h,_).call(this,t);return this.lstat(a)}lstat(t){let a=c(this,h,f).call(this,t),i=a.type==="file"?l(this,S).get(a.backingFilename).getSize():0,e=4096;return{dev:0,ino:0,mode:a.mode,nlink:1,uid:0,gid:0,rdev:0,size:i,blksize:e,blocks:Math.ceil(i/e),atime:a.lastModified,mtime:a.lastModified,ctime:a.lastModified}}mkdir(t,a){c(this,h,N).call(this,{opp:"mkdir",args:[t,a]},()=>{this._mkdirState(t,a)})}_mkdirState(t,a){let i=c(this,h,g).call(this,t),e=i.pop(),r=[],s=this.state.root;for(let o of i){if(r.push(t),!Object.prototype.hasOwnProperty.call(s.children,o))if(a!=null&&a.recursive)this.mkdir(r.join("/"));else throw new w("ENOENT","No such file or directory");if(s.children[o].type!=="directory")throw new w("ENOTDIR","Not a directory");s=s.children[o]}if(Object.prototype.hasOwnProperty.call(s.children,e))throw new w("EEXIST","File exists");let n={type:"directory",lastModified:Date.now(),mode:(a==null?void 0:a.mode)||H.DIR,children:{}};s.children[e]=n}open(t,a,i){if(c(this,h,f).call(this,t).type!=="file")throw new w("EISDIR","Is a directory");let e=c(this,h,J).call(this);return l(this,D).set(e,t),l(this,F).set(t,e),e}readdir(t){let a=c(this,h,f).call(this,t);if(a.type!=="directory")throw new w("ENOTDIR","Not a directory");return Object.keys(a.children)}read(t,a,i,e,r){let s=c(this,h,_).call(this,t),n=c(this,h,f).call(this,s);if(n.type!=="file")throw new w("EISDIR","Is a directory");return l(this,S).get(n.backingFilename).read(new Int8Array(a.buffer,i,e),{at:r})}rename(t,a){c(this,h,N).call(this,{opp:"rename",args:[t,a]},()=>{this._renameState(t,a,!0)})}_renameState(t,a,i=!1){let e=c(this,h,g).call(this,t),r=e.pop(),s=c(this,h,f).call(this,e.join("/"));if(!Object.prototype.hasOwnProperty.call(s.children,r))throw new w("ENOENT","No such file or directory");let n=c(this,h,g).call(this,a),o=n.pop(),p=c(this,h,f).call(this,n.join("/"));if(i&&Object.prototype.hasOwnProperty.call(p.children,o)){let P=p.children[o];l(this,S).get(P.backingFilename).truncate(0),this.state.pool.push(P.backingFilename)}p.children[o]=s.children[r],delete s.children[r]}rmdir(t){c(this,h,N).call(this,{opp:"rmdir",args:[t]},()=>{this._rmdirState(t)})}_rmdirState(t){let a=c(this,h,g).call(this,t),i=a.pop(),e=c(this,h,f).call(this,a.join("/"));if(!Object.prototype.hasOwnProperty.call(e.children,i))throw new w("ENOENT","No such file or directory");let r=e.children[i];if(r.type!=="directory")throw new w("ENOTDIR","Not a directory");if(Object.keys(r.children).length>0)throw new w("ENOTEMPTY","Directory not empty");delete e.children[i]}truncate(t,a=0){let i=c(this,h,f).call(this,t);if(i.type!=="file")throw new w("EISDIR","Is a directory");let e=l(this,S).get(i.backingFilename);if(!e)throw new w("ENOENT","No such file or directory");e.truncate(a),l(this,k).add(e)}unlink(t){c(this,h,N).call(this,{opp:"unlink",args:[t]},()=>{this._unlinkState(t,!0)})}_unlinkState(t,a=!1){let i=c(this,h,g).call(this,t),e=i.pop(),r=c(this,h,f).call(this,i.join("/"));if(!Object.prototype.hasOwnProperty.call(r.children,e))throw new w("ENOENT","No such file or directory");let s=r.children[e];if(s.type!=="file")throw new w("EISDIR","Is a directory");if(delete r.children[e],a){let n=l(this,S).get(s.backingFilename);n==null||n.truncate(0),l(this,k).add(n),l(this,F).has(t)&&(l(this,D).delete(l(this,F).get(t)),l(this,F).delete(t))}this.state.pool.push(s.backingFilename)}utimes(t,a,i){c(this,h,N).call(this,{opp:"utimes",args:[t,a,i]},()=>{this._utimesState(t,a,i)})}_utimesState(t,a,i){let e=c(this,h,f).call(this,t);e.lastModified=i}writeFile(t,a,i){let e=c(this,h,g).call(this,t),r=e.pop(),s=c(this,h,f).call(this,e.join("/"));if(Object.prototype.hasOwnProperty.call(s.children,r)){let p=s.children[r];p.lastModified=Date.now(),c(this,h,M).call(this,{opp:"setLastModified",args:[t,p.lastModified]})}else{if(this.state.pool.length===0)throw new Error("No more file handles available in the pool");let p={type:"file",lastModified:Date.now(),mode:(i==null?void 0:i.mode)||H.FILE,backingFilename:this.state.pool.pop()};s.children[r]=p,c(this,h,M).call(this,{opp:"createFileNode",args:[t,p]})}let n=s.children[r],o=l(this,S).get(n.backingFilename);a.length>0&&(o.write(typeof a=="string"?new TextEncoder().encode(a):new Int8Array(a),{at:0}),t.startsWith("/pg_wal")&&l(this,k).add(o))}_createFileNodeState(t,a){let i=c(this,h,g).call(this,t),e=i.pop(),r=c(this,h,f).call(this,i.join("/"));r.children[e]=a;let s=this.state.pool.indexOf(a.backingFilename);return s>-1&&this.state.pool.splice(s,1),a}_setLastModifiedState(t,a){let i=c(this,h,f).call(this,t);i.lastModified=a}write(t,a,i,e,r){let s=c(this,h,_).call(this,t),n=c(this,h,f).call(this,s);if(n.type!=="file")throw new w("EISDIR","Is a directory");let o=l(this,S).get(n.backingFilename);if(!o)throw new w("EBADF","Bad file descriptor");let p=o.write(new Int8Array(a,i,e),{at:r});return s.startsWith("/pg_wal")&&l(this,k).add(o),p}};R=new WeakMap,T=new WeakMap,b=new WeakMap,I=new WeakMap,j=new WeakMap,u=new WeakMap,O=new WeakMap,S=new WeakMap,v=new WeakMap,D=new WeakMap,F=new WeakMap,k=new WeakMap,h=new WeakSet,C=async function(){E(this,T,await navigator.storage.getDirectory()),E(this,b,await c(this,h,x).call(this,this.root,{create:!0})),E(this,I,await c(this,h,x).call(this,Q,{from:l(this,b),create:!0})),E(this,j,await l(this,b).getFileHandle(G,{create:!0})),E(this,u,await l(this,j).createSyncAccessHandle());let d=new ArrayBuffer(l(this,u).getSize());l(this,u).read(d,{at:0});let t,a=new TextDecoder().decode(d).split(`
|
2 |
+
`),i=!1;try{t=JSON.parse(a[0])}catch{t={root:{type:"directory",lastModified:Date.now(),mode:H.DIR,children:{}},pool:[]},l(this,u).truncate(0),l(this,u).write(new TextEncoder().encode(JSON.stringify(t)),{at:0}),i=!0}this.state=t;let e=a.slice(1).filter(Boolean).map(o=>JSON.parse(o));for(let o of e){let p=`_${o.opp}State`;if(typeof this[p]=="function")try{this[p].bind(this)(...o.args)}catch(P){console.warn("Error applying OPFS AHP WAL entry",o,P)}}let r=[],s=async o=>{if(o.type==="file")try{let p=await l(this,I).getFileHandle(o.backingFilename),P=await p.createSyncAccessHandle();l(this,O).set(o.backingFilename,p),l(this,S).set(o.backingFilename,P)}catch(p){console.error("Error opening file handle for node",o,p)}else for(let p of Object.values(o.children))r.push(s(p))};await s(this.state.root);let n=[];for(let o of this.state.pool)n.push(new Promise(async p=>{l(this,O).has(o)&&console.warn("File handle already exists for pool file",o);let P=await l(this,I).getFileHandle(o),X=await P.createSyncAccessHandle();l(this,O).set(o,P),l(this,S).set(o,X),p()}));await Promise.all([...r,...n]),await this.maintainPool(i?this.initialPoolSize:this.maintainedPoolSize),E(this,R,!0)},N=function(d,t){let a=c(this,h,M).call(this,d);try{t()}catch(i){throw l(this,u).truncate(a),i}},M=function(d){let t=JSON.stringify(d),a=new TextEncoder().encode(`
|
3 |
+
${t}`),i=l(this,u).getSize();return l(this,u).write(a,{at:i}),l(this,k).add(l(this,u)),i},g=function(d){return d.split("/").filter(Boolean)},f=function(d,t){let a=c(this,h,g).call(this,d),i=t||this.state.root;for(let e of a){if(i.type!=="directory")throw new w("ENOTDIR","Not a directory");if(!Object.prototype.hasOwnProperty.call(i.children,e))throw new w("ENOENT","No such file or directory");i=i.children[e]}return i},_=function(d){let t=l(this,D).get(d);if(!t)throw new w("EBADF","Bad file descriptor");return t},J=function(){let d=++L(this,v)._;for(;l(this,D).has(d);)L(this,v)._++;return d},x=async function(d,t){let a=c(this,h,g).call(this,d),i=(t==null?void 0:t.from)||l(this,T);for(let e of a)i=await i.getDirectoryHandle(e,{create:t==null?void 0:t.create});return i};var Z=U,z,A,et=class extends K{constructor(d,{initialPoolSize:t,maintainedPoolSize:a}={}){super(d),y(this,z),y(this,A),E(this,z,t??1e3),E(this,A,a??100)}async emscriptenOpts(d){return this.opfsAhp=await Z.create({root:this.dataDir,initialPoolSize:l(this,z),maintainedPoolSize:l(this,A)}),{...d,preRun:[...d.preRun||[],t=>{let a=q(t,this.opfsAhp);t.FS.mkdir(B),t.FS.mount(a,{},B)}]}}async syncToFs(d,t=!1){var a,i,e;await((a=this.opfsAhp)==null?void 0:a.maybeCheckpointState()),await((i=this.opfsAhp)==null?void 0:i.maintainPool()),t||((e=this.opfsAhp)==null||e.flush())}async dumpTar(d,t){return Y(d,t)}async close(d){var t;(t=this.opfsAhp)==null||t.exit(),d.quit()}};z=new WeakMap,A=new WeakMap;export{et as OpfsAhpFS};
|
assets/index-C8iGwwE4.js
ADDED
The diff for this file is too large to render.
See raw diff
|
|
assets/index-D41yMqDA.js
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import{b as Tr,d as Ut,e as Fr,f as Rr,g as He,h as Pe,i as _t,j as Ot}from"./chunk-T24MUNUQ.js";import{a as Nt,b as Lt,c as Sr,d as Pr}from"./chunk-OUZ4AEES.js";import{a as Ve,b as Se,c as Ct,d,e as x,f as B,g as y,i as m}from"./chunk-ZYB3MGPW.js";var Qt=Ve(Me=>{"use strict";m();Me.byteLength=Or;Me.toByteArray=Lr;Me.fromByteArray=Gr;var _=[],S=[],_r=typeof Uint8Array<"u"?Uint8Array:Array,it="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(W=0,Gt=it.length;W<Gt;++W)_[W]=it[W],S[it.charCodeAt(W)]=W;var W,Gt;S[45]=62;S[95]=63;function $t(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}function Or(r){var e=$t(r),t=e[0],n=e[1];return(t+n)*3/4-n}function Nr(r,e,t){return(e+t)*3/4-t}function Lr(r){var e,t=$t(r),n=t[0],i=t[1],s=new _r(Nr(r,n,i)),o=0,a=i>0?n-4:n,c;for(c=0;c<a;c+=4)e=S[r.charCodeAt(c)]<<18|S[r.charCodeAt(c+1)]<<12|S[r.charCodeAt(c+2)]<<6|S[r.charCodeAt(c+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=S[r.charCodeAt(c)]<<2|S[r.charCodeAt(c+1)]>>4,s[o++]=e&255),i===1&&(e=S[r.charCodeAt(c)]<<10|S[r.charCodeAt(c+1)]<<4|S[r.charCodeAt(c+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function kr(r){return _[r>>18&63]+_[r>>12&63]+_[r>>6&63]+_[r&63]}function vr(r,e,t){for(var n,i=[],s=e;s<t;s+=3)n=(r[s]<<16&16711680)+(r[s+1]<<8&65280)+(r[s+2]&255),i.push(kr(n));return i.join("")}function Gr(r){for(var e,t=r.length,n=t%3,i=[],s=16383,o=0,a=t-n;o<a;o+=s)i.push(vr(r,o,o+s>a?a:o+s));return n===1?(e=r[t-1],i.push(_[e>>2]+_[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(_[e>>10]+_[e>>4&63]+_[e<<2&63]+"=")),i.join("")}});var zt=Ve(st=>{"use strict";m();st.read=function(r,e,t,n,i){var s,o,a=i*8-n-1,c=(1<<a)-1,f=c>>1,l=-7,p=t?i-1:0,T=t?-1:1,w=r[e+p];for(p+=T,s=w&(1<<-l)-1,w>>=-l,l+=a;l>0;s=s*256+r[e+p],p+=T,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=n;l>0;o=o*256+r[e+p],p+=T,l-=8);if(s===0)s=1-f;else{if(s===c)return o?NaN:(w?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-f}return(w?-1:1)*o*Math.pow(2,s-n)};st.write=function(r,e,t,n,i,s){var o,a,c,f=s*8-i-1,l=(1<<f)-1,p=l>>1,T=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=n?0:s-1,R=n?1:-1,Fe=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=l):(o=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+p>=1?e+=T/c:e+=T*Math.pow(2,1-p),e*c>=2&&(o++,c/=2),o+p>=l?(a=0,o=l):o+p>=1?(a=(e*c-1)*Math.pow(2,i),o=o+p):(a=e*Math.pow(2,p-1)*Math.pow(2,i),o=0));i>=8;r[t+w]=a&255,w+=R,a/=256,i-=8);for(o=o<<i|a,f+=i;f>0;r[t+w]=o&255,w+=R,o/=256,f-=8);r[t+w-R]|=Fe*128}});var or=Ve(ne=>{"use strict";m();var ot=Qt(),te=zt(),qt=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ne.Buffer=u;ne.SlowBuffer=jr;ne.INSPECT_MAX_BYTES=50;var De=2147483647;ne.kMaxLength=De;u.TYPED_ARRAY_SUPPORT=$r();!u.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function $r(){try{let r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch{return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}});Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}});function N(r){if(r>De)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array(r);return Object.setPrototypeOf(e,u.prototype),e}function u(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return ft(r)}return Ht(r,e,t)}u.poolSize=8192;function Ht(r,e,t){if(typeof r=="string")return zr(r,e);if(ArrayBuffer.isView(r))return qr(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(O(r,ArrayBuffer)||r&&O(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(O(r,SharedArrayBuffer)||r&&O(r.buffer,SharedArrayBuffer)))return ut(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=r.valueOf&&r.valueOf();if(n!=null&&n!==r)return u.from(n,e,t);let i=Wr(r);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return u.from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}u.from=function(r,e,t){return Ht(r,e,t)};Object.setPrototypeOf(u.prototype,Uint8Array.prototype);Object.setPrototypeOf(u,Uint8Array);function Yt(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function Qr(r,e,t){return Yt(r),r<=0?N(r):e!==void 0?typeof t=="string"?N(r).fill(e,t):N(r).fill(e):N(r)}u.alloc=function(r,e,t){return Qr(r,e,t)};function ft(r){return Yt(r),N(r<0?0:lt(r)|0)}u.allocUnsafe=function(r){return ft(r)};u.allocUnsafeSlow=function(r){return ft(r)};function zr(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=Kt(r,e)|0,n=N(t),i=n.write(r,e);return i!==t&&(n=n.slice(0,i)),n}function at(r){let e=r.length<0?0:lt(r.length)|0,t=N(e);for(let n=0;n<e;n+=1)t[n]=r[n]&255;return t}function qr(r){if(O(r,Uint8Array)){let e=new Uint8Array(r);return ut(e.buffer,e.byteOffset,e.byteLength)}return at(r)}function ut(r,e,t){if(e<0||r.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(r.byteLength<e+(t||0))throw new RangeError('"length" is outside of buffer bounds');let n;return e===void 0&&t===void 0?n=new Uint8Array(r):t===void 0?n=new Uint8Array(r,e):n=new Uint8Array(r,e,t),Object.setPrototypeOf(n,u.prototype),n}function Wr(r){if(u.isBuffer(r)){let e=lt(r.length)|0,t=N(e);return t.length===0||r.copy(t,0,0,e),t}if(r.length!==void 0)return typeof r.length!="number"||ht(r.length)?N(0):at(r);if(r.type==="Buffer"&&Array.isArray(r.data))return at(r.data)}function lt(r){if(r>=De)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+De.toString(16)+" bytes");return r|0}function jr(r){return+r!=r&&(r=0),u.alloc(+r)}u.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==u.prototype};u.compare=function(e,t){if(O(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),O(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,i=t.length;for(let s=0,o=Math.min(n,i);s<o;++s)if(e[s]!==t[s]){n=e[s],i=t[s];break}return n<i?-1:i<n?1:0};u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};u.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return u.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let i=u.allocUnsafe(t),s=0;for(n=0;n<e.length;++n){let o=e[n];if(O(o,Uint8Array))s+o.length>i.length?(u.isBuffer(o)||(o=u.from(o)),o.copy(i,s)):Uint8Array.prototype.set.call(i,o,s);else if(u.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function Kt(r,e){if(u.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||O(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&t===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return ct(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return sr(r).length;default:if(i)return n?-1:ct(r).length;e=(""+e).toLowerCase(),i=!0}}u.byteLength=Kt;function Vr(r,e,t){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return nn(this,e,t);case"utf8":case"utf-8":return Jt(this,e,t);case"ascii":return tn(this,e,t);case"latin1":case"binary":return rn(this,e,t);case"base64":return Zr(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return sn(this,e,t);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}u.prototype._isBuffer=!0;function j(r,e,t){let n=r[e];r[e]=r[t],r[t]=n}u.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)j(this,t,t+1);return this};u.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)j(this,t,t+3),j(this,t+1,t+2);return this};u.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)j(this,t,t+7),j(this,t+1,t+6),j(this,t+2,t+5),j(this,t+3,t+4);return this};u.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?Jt(this,0,e):Vr.apply(this,arguments)};u.prototype.toLocaleString=u.prototype.toString;u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:u.compare(this,e)===0};u.prototype.inspect=function(){let e="",t=ne.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"};qt&&(u.prototype[qt]=u.prototype.inspect);u.prototype.compare=function(e,t,n,i,s){if(O(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),t<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&t>=n)return 0;if(i>=s)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;let o=s-i,a=n-t,c=Math.min(o,a),f=this.slice(i,s),l=e.slice(t,n);for(let p=0;p<c;++p)if(f[p]!==l[p]){o=f[p],a=l[p];break}return o<a?-1:a<o?1:0};function Xt(r,e,t,n,i){if(r.length===0)return-1;if(typeof t=="string"?(n=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,ht(t)&&(t=i?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(i)return-1;t=r.length-1}else if(t<0)if(i)t=0;else return-1;if(typeof e=="string"&&(e=u.from(e,n)),u.isBuffer(e))return e.length===0?-1:Wt(r,e,t,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):Wt(r,[e],t,n,i);throw new TypeError("val must be string, number or Buffer")}function Wt(r,e,t,n,i){let s=1,o=r.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||e.length<2)return-1;s=2,o/=2,a/=2,t/=2}function c(l,p){return s===1?l[p]:l.readUInt16BE(p*s)}let f;if(i){let l=-1;for(f=t;f<o;f++)if(c(r,f)===c(e,l===-1?0:f-l)){if(l===-1&&(l=f),f-l+1===a)return l*s}else l!==-1&&(f-=f-l),l=-1}else for(t+a>o&&(t=o-a),f=t;f>=0;f--){let l=!0;for(let p=0;p<a;p++)if(c(r,f+p)!==c(e,p)){l=!1;break}if(l)return f}return-1}u.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1};u.prototype.indexOf=function(e,t,n){return Xt(this,e,t,n,!0)};u.prototype.lastIndexOf=function(e,t,n){return Xt(this,e,t,n,!1)};function Hr(r,e,t,n){t=Number(t)||0;let i=r.length-t;n?(n=Number(n),n>i&&(n=i)):n=i;let s=e.length;n>s/2&&(n=s/2);let o;for(o=0;o<n;++o){let a=parseInt(e.substr(o*2,2),16);if(ht(a))return o;r[t+o]=a}return o}function Yr(r,e,t,n){return Ce(ct(e,r.length-t),r,t,n)}function Kr(r,e,t,n){return Ce(cn(e),r,t,n)}function Xr(r,e,t,n){return Ce(sr(e),r,t,n)}function Jr(r,e,t,n){return Ce(fn(e,r.length-t),r,t,n)}u.prototype.write=function(e,t,n,i){if(t===void 0)i="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")i=t,n=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-t;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return Hr(this,e,t,n);case"utf8":case"utf-8":return Yr(this,e,t,n);case"ascii":case"latin1":case"binary":return Kr(this,e,t,n);case"base64":return Xr(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Jr(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Zr(r,e,t){return e===0&&t===r.length?ot.fromByteArray(r):ot.fromByteArray(r.slice(e,t))}function Jt(r,e,t){t=Math.min(r.length,t);let n=[],i=e;for(;i<t;){let s=r[i],o=null,a=s>239?4:s>223?3:s>191?2:1;if(i+a<=t){let c,f,l,p;switch(a){case 1:s<128&&(o=s);break;case 2:c=r[i+1],(c&192)===128&&(p=(s&31)<<6|c&63,p>127&&(o=p));break;case 3:c=r[i+1],f=r[i+2],(c&192)===128&&(f&192)===128&&(p=(s&15)<<12|(c&63)<<6|f&63,p>2047&&(p<55296||p>57343)&&(o=p));break;case 4:c=r[i+1],f=r[i+2],l=r[i+3],(c&192)===128&&(f&192)===128&&(l&192)===128&&(p=(s&15)<<18|(c&63)<<12|(f&63)<<6|l&63,p>65535&&p<1114112&&(o=p))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return en(n)}var jt=4096;function en(r){let e=r.length;if(e<=jt)return String.fromCharCode.apply(String,r);let t="",n=0;for(;n<e;)t+=String.fromCharCode.apply(String,r.slice(n,n+=jt));return t}function tn(r,e,t){let n="";t=Math.min(r.length,t);for(let i=e;i<t;++i)n+=String.fromCharCode(r[i]&127);return n}function rn(r,e,t){let n="";t=Math.min(r.length,t);for(let i=e;i<t;++i)n+=String.fromCharCode(r[i]);return n}function nn(r,e,t){let n=r.length;(!e||e<0)&&(e=0),(!t||t<0||t>n)&&(t=n);let i="";for(let s=e;s<t;++s)i+=ln[r[s]];return i}function sn(r,e,t){let n=r.slice(e,t),i="";for(let s=0;s<n.length-1;s+=2)i+=String.fromCharCode(n[s]+n[s+1]*256);return i}u.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let i=this.subarray(e,t);return Object.setPrototypeOf(i,u.prototype),i};function E(r,e,t){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+e>t)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUintLE=u.prototype.readUIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||E(e,t,this.length);let i=this[e],s=1,o=0;for(;++o<t&&(s*=256);)i+=this[e+o]*s;return i};u.prototype.readUintBE=u.prototype.readUIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||E(e,t,this.length);let i=this[e+--t],s=1;for(;t>0&&(s*=256);)i+=this[e+--t]*s;return i};u.prototype.readUint8=u.prototype.readUInt8=function(e,t){return e=e>>>0,t||E(e,1,this.length),this[e]};u.prototype.readUint16LE=u.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||E(e,2,this.length),this[e]|this[e+1]<<8};u.prototype.readUint16BE=u.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||E(e,2,this.length),this[e]<<8|this[e+1]};u.prototype.readUint32LE=u.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||E(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};u.prototype.readUint32BE=u.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||E(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};u.prototype.readBigUInt64LE=v(function(e){e=e>>>0,re(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&be(e,this.length-8);let i=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<<BigInt(32))});u.prototype.readBigUInt64BE=v(function(e){e=e>>>0,re(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&be(e,this.length-8);let i=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(i)<<BigInt(32))+BigInt(s)});u.prototype.readIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||E(e,t,this.length);let i=this[e],s=1,o=0;for(;++o<t&&(s*=256);)i+=this[e+o]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*t)),i};u.prototype.readIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||E(e,t,this.length);let i=t,s=1,o=this[e+--i];for(;i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*t)),o};u.prototype.readInt8=function(e,t){return e=e>>>0,t||E(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};u.prototype.readInt16LE=function(e,t){e=e>>>0,t||E(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};u.prototype.readInt16BE=function(e,t){e=e>>>0,t||E(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};u.prototype.readInt32LE=function(e,t){return e=e>>>0,t||E(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};u.prototype.readInt32BE=function(e,t){return e=e>>>0,t||E(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};u.prototype.readBigInt64LE=v(function(e){e=e>>>0,re(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&be(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});u.prototype.readBigInt64BE=v(function(e){e=e>>>0,re(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&be(e,this.length-8);let i=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)});u.prototype.readFloatLE=function(e,t){return e=e>>>0,t||E(e,4,this.length),te.read(this,e,!0,23,4)};u.prototype.readFloatBE=function(e,t){return e=e>>>0,t||E(e,4,this.length),te.read(this,e,!1,23,4)};u.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||E(e,8,this.length),te.read(this,e,!0,52,8)};u.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||E(e,8,this.length),te.read(this,e,!1,52,8)};function F(r,e,t,n,i,s){if(!u.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(t+n>r.length)throw new RangeError("Index out of range")}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;F(this,e,t,n,a,0)}let s=1,o=0;for(this[t]=e&255;++o<n&&(s*=256);)this[t+o]=e/s&255;return t+n};u.prototype.writeUintBE=u.prototype.writeUIntBE=function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;F(this,e,t,n,a,0)}let s=n-1,o=1;for(this[t+s]=e&255;--s>=0&&(o*=256);)this[t+s]=e/o&255;return t+n};u.prototype.writeUint8=u.prototype.writeUInt8=function(e,t,n){return e=+e,t=t>>>0,n||F(this,e,t,1,255,0),this[t]=e&255,t+1};u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||F(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||F(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||F(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4};u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||F(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function Zt(r,e,t,n,i){ir(e,n,i,r,t,7);let s=Number(e&BigInt(4294967295));r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,t}function er(r,e,t,n,i){ir(e,n,i,r,t,7);let s=Number(e&BigInt(4294967295));r[t+7]=s,s=s>>8,r[t+6]=s,s=s>>8,r[t+5]=s,s=s>>8,r[t+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+3]=o,o=o>>8,r[t+2]=o,o=o>>8,r[t+1]=o,o=o>>8,r[t]=o,t+8}u.prototype.writeBigUInt64LE=v(function(e,t=0){return Zt(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});u.prototype.writeBigUInt64BE=v(function(e,t=0){return er(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});u.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t=t>>>0,!i){let c=Math.pow(2,8*n-1);F(this,e,t,n,c-1,-c)}let s=0,o=1,a=0;for(this[t]=e&255;++s<n&&(o*=256);)e<0&&a===0&&this[t+s-1]!==0&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+n};u.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t=t>>>0,!i){let c=Math.pow(2,8*n-1);F(this,e,t,n,c-1,-c)}let s=n-1,o=1,a=0;for(this[t+s]=e&255;--s>=0&&(o*=256);)e<0&&a===0&&this[t+s+1]!==0&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+n};u.prototype.writeInt8=function(e,t,n){return e=+e,t=t>>>0,n||F(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};u.prototype.writeInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||F(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};u.prototype.writeInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||F(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};u.prototype.writeInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||F(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4};u.prototype.writeInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||F(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};u.prototype.writeBigInt64LE=v(function(e,t=0){return Zt(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});u.prototype.writeBigInt64BE=v(function(e,t=0){return er(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function tr(r,e,t,n,i,s){if(t+n>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function rr(r,e,t,n,i){return e=+e,t=t>>>0,i||tr(r,e,t,4,34028234663852886e22,-34028234663852886e22),te.write(r,e,t,n,23,4),t+4}u.prototype.writeFloatLE=function(e,t,n){return rr(this,e,t,!0,n)};u.prototype.writeFloatBE=function(e,t,n){return rr(this,e,t,!1,n)};function nr(r,e,t,n,i){return e=+e,t=t>>>0,i||tr(r,e,t,8,17976931348623157e292,-17976931348623157e292),te.write(r,e,t,n,52,8),t+8}u.prototype.writeDoubleLE=function(e,t,n){return nr(this,e,t,!0,n)};u.prototype.writeDoubleBE=function(e,t,n){return nr(this,e,t,!1,n)};u.prototype.copy=function(e,t,n,i){if(!u.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);let s=i-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),t),s};u.prototype.fill=function(e,t,n,i){if(typeof e=="string"){if(typeof t=="string"?(i=t,t=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!u.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(e.length===1){let o=e.charCodeAt(0);(i==="utf8"&&o<128||i==="latin1")&&(e=o)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let s;if(typeof e=="number")for(s=t;s<n;++s)this[s]=e;else{let o=u.isBuffer(e)?e:u.from(e,i),a=o.length;if(a===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<n-t;++s)this[s+t]=o[s%a]}return this};var ee={};function pt(r,e,t){ee[r]=class extends t{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${r}]`,this.stack,delete this.name}get code(){return r}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${r}]: ${this.message}`}}}pt("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r?`${r} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);pt("ERR_INVALID_ARG_TYPE",function(r,e){return`The "${r}" argument must be of type number. Received type ${typeof e}`},TypeError);pt("ERR_OUT_OF_RANGE",function(r,e,t){let n=`The value of "${r}" is out of range.`,i=t;return Number.isInteger(t)&&Math.abs(t)>2**32?i=Vt(String(t)):typeof t=="bigint"&&(i=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i=Vt(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function Vt(r){let e="",t=r.length,n=r[0]==="-"?1:0;for(;t>=n+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0,t)}${e}`}function on(r,e,t){re(e,"offset"),(r[e]===void 0||r[e+t]===void 0)&&be(e,r.length-(t+1))}function ir(r,e,t,n,i,s){if(r>t||r<e){let o=typeof e=="bigint"?"n":"",a;throw s>3?e===0||e===BigInt(0)?a=`>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:a=`>= -(2${o} ** ${(s+1)*8-1}${o}) and < 2 ** ${(s+1)*8-1}${o}`:a=`>= ${e}${o} and <= ${t}${o}`,new ee.ERR_OUT_OF_RANGE("value",a,r)}on(n,i,s)}function re(r,e){if(typeof r!="number")throw new ee.ERR_INVALID_ARG_TYPE(e,"number",r)}function be(r,e,t){throw Math.floor(r)!==r?(re(r,t),new ee.ERR_OUT_OF_RANGE(t||"offset","an integer",r)):e<0?new ee.ERR_BUFFER_OUT_OF_BOUNDS:new ee.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${e}`,r)}var an=/[^+/0-9A-Za-z-_]/g;function un(r){if(r=r.split("=")[0],r=r.trim().replace(an,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function ct(r,e){e=e||1/0;let t,n=r.length,i=null,s=[];for(let o=0;o<n;++o){if(t=r.charCodeAt(o),t>55295&&t<57344){if(!i){if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191,189),i=t;continue}t=(i-55296<<10|t-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,t<128){if((e-=1)<0)break;s.push(t)}else if(t<2048){if((e-=2)<0)break;s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return s}function cn(r){let e=[];for(let t=0;t<r.length;++t)e.push(r.charCodeAt(t)&255);return e}function fn(r,e){let t,n,i,s=[];for(let o=0;o<r.length&&!((e-=2)<0);++o)t=r.charCodeAt(o),n=t>>8,i=t%256,s.push(i),s.push(n);return s}function sr(r){return ot.toByteArray(un(r))}function Ce(r,e,t,n){let i;for(i=0;i<n&&!(i+t>=e.length||i>=r.length);++i)e[i+t]=r[i];return i}function O(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function ht(r){return r!==r}var ln=function(){let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let i=0;i<16;++i)e[n+i]=r[t]+r[i]}return e}();function v(r){return typeof BigInt>"u"?pn:r}function pn(){throw new Error("BigInt not supported")}});m();m();m();var Oi=new Error("timeout while waiting for mutex to become available"),Ni=new Error("mutex already locked"),Mr=new Error("request for lock canceled"),Dr=function(r,e,t,n){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(l){try{f(n.next(l))}catch(p){o(p)}}function c(l){try{f(n.throw(l))}catch(p){o(p)}}function f(l){l.done?s(l.value):i(l.value).then(a,c)}f((n=n.apply(r,e||[])).next())})},Ye=class{constructor(e,t=Mr){this._value=e,this._cancelError=t,this._weightedQueues=[],this._weightedWaiters=[]}acquire(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((t,n)=>{this._weightedQueues[e-1]||(this._weightedQueues[e-1]=[]),this._weightedQueues[e-1].push({resolve:t,reject:n}),this._dispatch()})}runExclusive(e,t=1){return Dr(this,void 0,void 0,function*(){let[n,i]=yield this.acquire(t);try{return yield e(n)}finally{i()}})}waitForUnlock(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise(t=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),this._weightedWaiters[e-1].push(t),this._dispatch()})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatch()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatch()}cancel(){this._weightedQueues.forEach(e=>e.forEach(t=>t.reject(this._cancelError))),this._weightedQueues=[]}_dispatch(){var e;for(let t=this._value;t>0;t--){let n=(e=this._weightedQueues[t-1])===null||e===void 0?void 0:e.shift();if(!n)continue;let i=this._value,s=t;this._value-=t,t=this._value+1,n.resolve([i,this._newReleaser(s)])}this._drainUnlockWaiters()}_newReleaser(e){let t=!1;return()=>{t||(t=!0,this.release(e))}}_drainUnlockWaiters(){for(let e=this._value;e>0;e--)this._weightedWaiters[e-1]&&(this._weightedWaiters[e-1].forEach(t=>t()),this._weightedWaiters[e-1]=[])}},Cr=function(r,e,t,n){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(l){try{f(n.next(l))}catch(p){o(p)}}function c(l){try{f(n.throw(l))}catch(p){o(p)}}function f(l){l.done?s(l.value):i(l.value).then(a,c)}f((n=n.apply(r,e||[])).next())})},Q=class{constructor(e){this._semaphore=new Ye(1,e)}acquire(){return Cr(this,void 0,void 0,function*(){let[,e]=yield this._semaphore.acquire();return e})}runExclusive(e){return this._semaphore.runExclusive(()=>e())}isLocked(){return this._semaphore.isLocked()}waitForUnlock(){return this._semaphore.waitForUnlock()}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}};m();import Ur from"./postgres.js";var kt=Ur;var mr={};Se(mr,{parseResults:()=>Qe});m();var vt={};Se(vt,{AuthenticationMD5Password:()=>ye,BackendKeyDataMessage:()=>me,CommandCompleteMessage:()=>U,CopyDataMessage:()=>fe,CopyResponse:()=>le,DataRowMessage:()=>k,DatabaseError:()=>C,Field:()=>pe,NoticeMessage:()=>q,NotificationResponseMessage:()=>z,ParameterDescriptionMessage:()=>he,ParameterStatusMessage:()=>de,ReadyForQueryMessage:()=>ge,RowDescriptionMessage:()=>L,bindComplete:()=>Xe,closeComplete:()=>Je,copyDone:()=>nt,emptyQuery:()=>rt,noData:()=>Ze,parseComplete:()=>Ke,portalSuspended:()=>et,replicationStart:()=>tt});m();var Ke={name:"parseComplete",length:5},Xe={name:"bindComplete",length:5},Je={name:"closeComplete",length:5},Ze={name:"noData",length:5},et={name:"portalSuspended",length:5},tt={name:"replicationStart",length:4},rt={name:"emptyQuery",length:4},nt={name:"copyDone",length:4},C=class extends Error{constructor(t,n,i){super(t);this.length=n;this.name=i}},fe=class{constructor(e,t){this.length=e;this.chunk=t;this.name="copyData"}},le=class{constructor(e,t,n,i){this.length=e;this.name=t;this.binary=n;this.columnTypes=new Array(i)}},pe=class{constructor(e,t,n,i,s,o,a){this.name=e;this.tableID=t;this.columnID=n;this.dataTypeID=i;this.dataTypeSize=s;this.dataTypeModifier=o;this.format=a}},L=class{constructor(e,t){this.length=e;this.fieldCount=t;this.name="rowDescription";this.fields=new Array(this.fieldCount)}},he=class{constructor(e,t){this.length=e;this.parameterCount=t;this.name="parameterDescription";this.dataTypeIDs=new Array(this.parameterCount)}},de=class{constructor(e,t,n){this.length=e;this.parameterName=t;this.parameterValue=n;this.name="parameterStatus"}},ye=class{constructor(e,t){this.length=e;this.salt=t;this.name="authenticationMD5Password"}},me=class{constructor(e,t,n){this.length=e;this.processID=t;this.secretKey=n;this.name="backendKeyData"}},z=class{constructor(e,t,n,i){this.length=e;this.processId=t;this.channel=n;this.payload=i;this.name="notification"}},ge=class{constructor(e,t){this.length=e;this.status=t;this.name="readyForQuery"}},U=class{constructor(e,t){this.length=e;this.text=t;this.name="commandComplete"}},k=class{constructor(e,t){this.length=e;this.fields=t;this.name="dataRow";this.fieldCount=t.length}},q=class{constructor(e,t){this.length=e;this.message=t;this.name="notice"}};var yr={};Se(yr,{ABSTIME:()=>Tn,ACLITEM:()=>Un,BIT:()=>kn,BOOL:()=>dt,BPCHAR:()=>_n,BYTEA:()=>Oe,CHAR:()=>ur,CID:()=>bn,CIDR:()=>An,CIRCLE:()=>Sn,DATE:()=>xt,FLOAT4:()=>bt,FLOAT8:()=>ke,GTSVECTOR:()=>ei,INET:()=>Cn,INT2:()=>yt,INT4:()=>mt,INT8:()=>we,INTERVAL:()=>Nn,JSON:()=>Le,JSONB:()=>It,MACADDR:()=>Dn,MACADDR8:()=>Pn,MONEY:()=>Mn,NUMERIC:()=>Gn,OID:()=>gt,PATH:()=>Bn,PG_DEPENDENCIES:()=>Xn,PG_LSN:()=>Yn,PG_NDISTINCT:()=>Kn,PG_NODE_TREE:()=>xn,POLYGON:()=>In,REFCURSOR:()=>$n,REGCLASS:()=>Wn,REGCONFIG:()=>ti,REGDICTIONARY:()=>ri,REGNAMESPACE:()=>ni,REGOPER:()=>zn,REGOPERATOR:()=>qn,REGPROC:()=>yn,REGPROCEDURE:()=>Qn,REGROLE:()=>ii,REGTYPE:()=>jn,RELTIME:()=>Fn,SMGR:()=>En,TEXT:()=>Ne,TID:()=>mn,TIME:()=>On,TIMESTAMP:()=>Et,TIMESTAMPTZ:()=>Bt,TIMETZ:()=>Ln,TINTERVAL:()=>Rn,TSQUERY:()=>Zn,TSVECTOR:()=>Jn,TXID_SNAPSHOT:()=>Hn,UUID:()=>Vn,VARBIT:()=>vn,VARCHAR:()=>wt,XID:()=>gn,XML:()=>wn,arrayTypes:()=>Ue,parseArray:()=>dr,parseType:()=>$e,parsers:()=>fr,serializeType:()=>Ge,serializerFor:()=>pr,serializerInstanceof:()=>lr,serializers:()=>_e,types:()=>cr});m();m();var ar=Ct(or(),1),g;globalThis.Buffer?g=globalThis.Buffer:g=ar.Buffer;var hn=globalThis.JSON.parse,dn=globalThis.JSON.stringify,dt=16,Oe=17,ur=18,we=20,yt=21,mt=23,yn=24,Ne=25,gt=26,mn=27,gn=28,bn=29,Le=114,wn=142,xn=194,En=210,Bn=602,In=604,An=650,bt=700,ke=701,Tn=702,Fn=703,Rn=704,Sn=718,Pn=774,Mn=790,Dn=829,Cn=869,Un=1033,_n=1042,wt=1043,xt=1082,On=1083,Et=1114,Bt=1184,Nn=1186,Ln=1266,kn=1560,vn=1562,Gn=1700,$n=1790,Qn=2202,zn=2203,qn=2204,Wn=2205,jn=2206,Vn=2950,Hn=2970,Yn=3220,Kn=3361,Xn=3402,Jn=3614,Zn=3615,ei=3642,ti=3734,ri=3769,It=3802,ni=4089,ii=4096,Ue={1001:Oe,1002:ur,1016:we,1005:yt,1007:mt,1009:Ne,1028:gt,199:Le,1021:bt,1022:ke,1015:wt,3807:It,1182:xt,1115:Et,1116:Bt},cr={string:{to:0,from:[Ne,wt],serialize:r=>r,parse:r=>r,forceTo:Ne},number:{to:0,from:[yt,mt,gt,bt,ke],serialize:r=>r.toString(),parse:r=>+r,forceTo:r=>Number.isInteger(r)?we:ke},bigint:{to:we,from:[we],js:[BigInt],serialize:r=>r.toString(),parse:r=>{let e=BigInt(r);return e<Number.MIN_SAFE_INTEGER||e>Number.MAX_SAFE_INTEGER?e:Number(e)}},json:{to:Le,from:[Le,It],serialize:r=>dn(r),parse:r=>hn(r)},boolean:{to:dt,from:[dt],serialize:r=>r===!0?"t":"f",parse:r=>r==="t"},date:{to:1184,from:[xt,Et,Bt],js:[Date],serialize:r=>(r instanceof Date?r:new Date(r)).toISOString(),parse:r=>new Date(r)},bytea:{to:Oe,from:[Oe],js:[Uint8Array,g],serialize:r=>"\\x"+g.from(r).toString("hex"),parse:r=>new Uint8Array(g.from(r.slice(2),"hex"))},array:{to:0,from:Object.keys(Ue).map(r=>+r),serialize:r=>hr(r),parse:(r,e)=>{let t;return e&&e in Ue&&(t=fr[Ue[e]]),dr(r,t)}}},ve=oi(cr),fr=ve.parsers,_e=ve.serializers,lr=ve.serializerInstanceof;function pr(r){if(Array.isArray(r))return _e.array;let e=_e[typeof r];if(e)return e;for(let[t,n]of lr)if(r instanceof t)return n;return _e.json}function Ge(r,e=!1){return r==null?[null,0]:pr(r)(r,e)}function si(r){return'"'+r.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'}function hr(r){let e="{";for(let t=0;t<r.length;t++)if(t>0&&(e=e+","),r[t]===null||typeof r[t]>"u")e=e+"NULL";else if(Array.isArray(r[t]))e=e+hr(r[t]);else if(ArrayBuffer.isView(r[t])){let n=r[t];if(!(n instanceof g)){let i=g.from(n.buffer,n.byteOffset,n.byteLength);i.length===n.byteLength?n=i:n=i.slice(n.byteOffset,n.byteOffset+n.byteLength)}e+="\\\\x"+n.toString("hex")}else e+=si(Ge(r[t])[0]);return e=e+"}",e}function dr(r,e){let t=0,n=null,i="",s=!1,o=0,a;function c(f){let l=[];for(;t<f.length;t++){if(n=f[t],s)n==="\\"?i+=f[++t]:n==='"'?(l.push(e?e(i):i),i="",s=f[t+1]==='"',o=t+2):i+=n;else if(n==='"')s=!0;else if(n==="{")o=++t,l.push(c(f));else if(n==="}"){s=!1,o<t&&l.push(e?e(f.slice(o,t)):f.slice(o,t)),o=t+1;break}else n===","&&a!=="}"&&a!=='"'&&(l.push(e?e(f.slice(o,t)):f.slice(o,t)),o=t+1);a=n}return o<t&&l.push(e?e(f.slice(o,t+1)):f.slice(o,t+1)),l}return c(r)[0]}function $e(r,e,t){if(r===null)return null;let n=t?.[e]??ve.parsers[e];return n?n(r,e):r}function oi(r){return Object.keys(r).reduce(({parsers:e,serializers:t,serializerInstanceof:n},i)=>{let{to:s,from:o,serialize:a,parse:c=null,forceTo:f}=r[i],l=(p,T=!1)=>[a(p),T&&f?typeof f=="function"?f(p):f:s];return t[s]=l,t[i]=l,r[i].js&&r[i].js.forEach(p=>n.push([p,l])),c&&(Array.isArray(o)?o.forEach(p=>e[p]=c):e[o]=c,e[i]=c),{parsers:e,serializers:t,serializerInstanceof:n}},{parsers:{},serializers:{},serializerInstanceof:[]})}function Qe(r,e,t){let n=[],i={rows:[],fields:[]},s=0,o=r.filter(a=>a instanceof L||a instanceof k||a instanceof U);return o.forEach((a,c)=>{a instanceof L?i.fields=a.fields.map(f=>({name:f.name,dataTypeID:f.dataTypeID})):a instanceof k&&i?e?.rowMode==="array"?i.rows.push(a.fields.map((f,l)=>$e(f,i.fields[l].dataTypeID,e?.parsers))):i.rows.push(Object.fromEntries(a.fields.map((f,l)=>[i.fields[l].name,$e(f,i.fields[l].dataTypeID,e?.parsers)]))):a instanceof U&&(s+=ai(a),c===o.length-1?n.push({...i,affectedRows:s,...t?{blob:t}:{}}):n.push(i),i={rows:[],fields:[]})}),n.length===0&&n.push({rows:[],fields:[]}),n}function ai(r){let e=r.text.split(" ");switch(e[0]){case"INSERT":return parseInt(e[2],10);case"UPDATE":case"DELETE":return parseInt(e[1],10);default:return 0}}m();var gr=Ct(Tr(),1);async function At(r){if(Nt){let e=await import("fs"),t=await import("zlib"),{Writable:n}=await import("stream"),{pipeline:i}=await import("stream/promises");if(!e.existsSync(r))throw new Error(`Extension bundle not found: ${r}`);let s=t.createGunzip(),o=[];return await i(e.createReadStream(r),s,new n({write(a,c,f){o.push(a),f()}})),new Blob(o)}else{let e=await fetch(r.toString());if(!e.ok||!e.body)return null;if(e.headers.get("Content-Encoding")==="gzip")return e.blob();{let t=new DecompressionStream("gzip");return new Response(e.body.pipeThrough(t)).blob()}}}async function br(r,e){for(let t in r.pg_extensions){let n;try{n=await r.pg_extensions[t]}catch(i){console.error("Failed to fetch extension:",t,i);continue}if(n){let i=new Uint8Array(await n.arrayBuffer());ui(r,t,i,e)}else console.error("Could not get binary data for extension:",t)}}function ui(r,e,t,n){gr.default.untar(t).forEach(s=>{if(!s.name.startsWith(".")){let o=r.WASM_PREFIX+"/"+s.name;if(s.name.endsWith(".so")){let a=(...f)=>{n("pgfs:ext OK",o,f)},c=(...f)=>{n("pgfs:ext FAIL",o,f)};r.FS.createPreloadedFile(ci(o),s.name.split("/").pop().slice(0,-3),s.data,!0,!0,a,c,!1)}else r.FS.writeFile(o,s.data)}})}function ci(r){let e=r.lastIndexOf("/");return e>0?r.slice(0,e):r}var Br={};Se(Br,{DatabaseError:()=>C,parse:()=>_i,serialize:()=>P});m();m();m();var ie=class{constructor(e=256){this.size=e;this.offset=5;this.headerPosition=0;this.buffer=g.allocUnsafe(e)}ensure(e){var t=this.buffer.length-this.offset;if(t<e){var n=this.buffer,i=n.length+(n.length>>1)+e;this.buffer=g.allocUnsafe(i),n.copy(this.buffer)}}addInt32(e){return this.ensure(4),this.buffer[this.offset++]=e>>>24&255,this.buffer[this.offset++]=e>>>16&255,this.buffer[this.offset++]=e>>>8&255,this.buffer[this.offset++]=e>>>0&255,this}addInt16(e){return this.ensure(2),this.buffer[this.offset++]=e>>>8&255,this.buffer[this.offset++]=e>>>0&255,this}addCString(e){if(!e)this.ensure(1);else{var t=g.byteLength(e);this.ensure(t+1),this.buffer.write(e,this.offset,"utf-8"),this.offset+=t}return this.buffer[this.offset++]=0,this}addString(e=""){var t=g.byteLength(e);return this.ensure(t),this.buffer.write(e,this.offset),this.offset+=t,this}add(e){return this.ensure(e.length),e.copy(this.buffer,this.offset),this.offset+=e.length,this}join(e){if(e){this.buffer[this.headerPosition]=e;let t=this.offset-(this.headerPosition+1);this.buffer.writeInt32BE(t,this.headerPosition+1)}return this.buffer.slice(e?0:5,this.offset)}flush(e){var t=this.join(e);return this.offset=5,this.headerPosition=0,this.buffer=g.allocUnsafe(this.size),t}};var b=new ie,fi=r=>{b.addInt16(3).addInt16(0);for(let n of Object.keys(r))b.addCString(n).addCString(r[n]);b.addCString("client_encoding").addCString("UTF8");var e=b.addCString("").flush(),t=e.length+4;return new ie().addInt32(t).add(e).flush()},li=()=>{let r=g.allocUnsafe(8);return r.writeInt32BE(8,0),r.writeInt32BE(80877103,4),r},pi=r=>b.addCString(r).flush(112),hi=function(r,e){return b.addCString(r).addInt32(g.byteLength(e)).addString(e),b.flush(112)},di=function(r){return b.addString(r).flush(112)},yi=r=>b.addCString(r).flush(81),wr=[],mi=r=>{let e=r.name||"";e.length>63&&(console.error("Warning! Postgres only supports 63 characters for query names."),console.error("You supplied %s (%s)",e,e.length),console.error("This can cause conflicts and silent errors executing queries"));let t=r.types||wr;for(var n=t.length,i=b.addCString(e).addCString(r.text).addInt16(n),s=0;s<n;s++)i.addInt32(t[s]);return b.flush(80)},se=new ie;var gi=function(r,e){for(let t=0;t<r.length;t++){let n=e?e(r[t],t):r[t];n==null?(b.addInt16(0),se.addInt32(-1)):n instanceof g?(b.addInt16(1),se.addInt32(n.length),se.add(n)):(b.addInt16(0),se.addInt32(g.byteLength(n)),se.addString(n))}},bi=(r={})=>{let e=r.portal||"",t=r.statement||"",n=r.binary||!1,i=r.values||wr,s=i.length;return b.addCString(e).addCString(t),b.addInt16(s),gi(i,r.valueMapper),b.addInt16(s),b.add(se.flush()),b.addInt16(n?1:0),b.flush(66)},wi=g.from([69,0,0,0,9,0,0,0,0,0]),xi=r=>{if(!r||!r.portal&&!r.rows)return wi;let e=r.portal||"",t=r.rows||0,n=g.byteLength(e),i=4+n+1+4,s=g.allocUnsafe(1+i);return s[0]=69,s.writeInt32BE(i,1),s.write(e,5,"utf-8"),s[n+5]=0,s.writeUInt32BE(t,s.length-4),s},Ei=(r,e)=>{let t=g.allocUnsafe(16);return t.writeInt32BE(16,0),t.writeInt16BE(1234,4),t.writeInt16BE(5678,6),t.writeInt32BE(r,8),t.writeInt32BE(e,12),t},Tt=(r,e)=>{let n=4+g.byteLength(e)+1,i=g.allocUnsafe(1+n);return i[0]=r,i.writeInt32BE(n,1),i.write(e,5,"utf-8"),i[n]=0,i},Bi=b.addCString("P").flush(68),Ii=b.addCString("S").flush(68),Ai=r=>r.name?Tt(68,`${r.type}${r.name||""}`):r.type==="P"?Bi:Ii,Ti=r=>{let e=`${r.type}${r.name||""}`;return Tt(67,e)},Fi=r=>b.add(r).flush(100),Ri=r=>Tt(102,r),ze=r=>g.from([r,0,0,0,4]),Si=ze(72),Pi=ze(83),Mi=ze(88),Di=ze(99),P={startup:fi,password:pi,requestSsl:li,sendSASLInitialResponseMessage:hi,sendSCRAMClientFinalMessage:di,query:yi,parse:mi,bind:bi,execute:xi,describe:Ai,close:Ti,flush:()=>Si,sync:()=>Pi,end:()=>Mi,copyData:Fi,copyDone:()=>Di,copyFail:Ri,cancel:Ei};m();m();var Ci=g.allocUnsafe(0),qe=class{constructor(e=0){this.offset=e;this.buffer=Ci;this.encoding="utf-8"}setBuffer(e,t){this.offset=e,this.buffer=t}int16(){let e=this.buffer.readInt16BE(this.offset);return this.offset+=2,e}byte(){let e=this.buffer[this.offset];return this.offset++,e}int32(){let e=this.buffer.readInt32BE(this.offset);return this.offset+=4,e}string(e){let t=this.buffer.toString(this.encoding,this.offset,this.offset+e);return this.offset+=e,t}cstring(){let e=this.offset,t=e;for(;this.buffer[t++]!==0;);return this.offset=t,this.buffer.toString(this.encoding,e,t-1)}bytes(e){let t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}};var Ft=1,Ui=4,xr=Ft+Ui,Er=g.allocUnsafe(0);var V=class{constructor(e){this.buffer=Er;this.bufferLength=0;this.bufferOffset=0;this.reader=new qe;if(e?.mode==="binary")throw new Error("Binary mode not supported yet");this.mode=e?.mode||"text"}parse(e,t){this.mergeBuffer(e);let n=this.bufferOffset+this.bufferLength,i=this.bufferOffset;for(;i+xr<=n;){let s=this.buffer[i],o=this.buffer.readUInt32BE(i+Ft),a=Ft+o;if(a+i<=n){let c=this.handlePacket(i+xr,s,o,this.buffer);t(c),i+=a}else break}i===n?(this.buffer=Er,this.bufferLength=0,this.bufferOffset=0):(this.bufferLength=n-i,this.bufferOffset=i)}mergeBuffer(e){if(this.bufferLength>0){let t=this.bufferLength+e.byteLength;if(t+this.bufferOffset>this.buffer.byteLength){let i;if(t<=this.buffer.byteLength&&this.bufferOffset>=this.bufferLength)i=this.buffer;else{let s=this.buffer.byteLength*2;for(;t>=s;)s*=2;i=g.allocUnsafe(s)}this.buffer.copy(i,0,this.bufferOffset,this.bufferOffset+this.bufferLength),this.buffer=i,this.bufferOffset=0}e.copy(this.buffer,this.bufferOffset+this.bufferLength),this.bufferLength=t}else this.buffer=e,this.bufferOffset=0,this.bufferLength=e.byteLength}handlePacket(e,t,n,i){switch(t){case 50:return Xe;case 49:return Ke;case 51:return Je;case 110:return Ze;case 115:return et;case 99:return nt;case 87:return tt;case 73:return rt;case 68:return this.parseDataRowMessage(e,n,i);case 67:return this.parseCommandCompleteMessage(e,n,i);case 90:return this.parseReadyForQueryMessage(e,n,i);case 65:return this.parseNotificationMessage(e,n,i);case 82:return this.parseAuthenticationResponse(e,n,i);case 83:return this.parseParameterStatusMessage(e,n,i);case 75:return this.parseBackendKeyData(e,n,i);case 69:return this.parseErrorMessage(e,n,i,"error");case 78:return this.parseErrorMessage(e,n,i,"notice");case 84:return this.parseRowDescriptionMessage(e,n,i);case 116:return this.parseParameterDescriptionMessage(e,n,i);case 71:return this.parseCopyInMessage(e,n,i);case 72:return this.parseCopyOutMessage(e,n,i);case 100:return this.parseCopyData(e,n,i);default:return new C("received invalid response: "+t.toString(16),n,"error")}}parseReadyForQueryMessage(e,t,n){this.reader.setBuffer(e,n);let i=this.reader.string(1);return new ge(t,i)}parseCommandCompleteMessage(e,t,n){this.reader.setBuffer(e,n);let i=this.reader.cstring();return new U(t,i)}parseCopyData(e,t,n){let i=n.slice(e,e+(t-4));return new fe(t,i)}parseCopyInMessage(e,t,n){return this.parseCopyMessage(e,t,n,"copyInResponse")}parseCopyOutMessage(e,t,n){return this.parseCopyMessage(e,t,n,"copyOutResponse")}parseCopyMessage(e,t,n,i){this.reader.setBuffer(e,n);let s=this.reader.byte()!==0,o=this.reader.int16(),a=new le(t,i,s,o);for(let c=0;c<o;c++)a.columnTypes[c]=this.reader.int16();return a}parseNotificationMessage(e,t,n){this.reader.setBuffer(e,n);let i=this.reader.int32(),s=this.reader.cstring(),o=this.reader.cstring();return new z(t,i,s,o)}parseRowDescriptionMessage(e,t,n){this.reader.setBuffer(e,n);let i=this.reader.int16(),s=new L(t,i);for(let o=0;o<i;o++)s.fields[o]=this.parseField();return s}parseField(){let e=this.reader.cstring(),t=this.reader.int32(),n=this.reader.int16(),i=this.reader.int32(),s=this.reader.int16(),o=this.reader.int32(),a=this.reader.int16()===0?"text":"binary";return new pe(e,t,n,i,s,o,a)}parseParameterDescriptionMessage(e,t,n){this.reader.setBuffer(e,n);let i=this.reader.int16(),s=new he(t,i);for(let o=0;o<i;o++)s.dataTypeIDs[o]=this.reader.int32();return s}parseDataRowMessage(e,t,n){this.reader.setBuffer(e,n);let i=this.reader.int16(),s=new Array(i);for(let o=0;o<i;o++){let a=this.reader.int32();s[o]=a===-1?null:this.reader.string(a)}return new k(t,s)}parseParameterStatusMessage(e,t,n){this.reader.setBuffer(e,n);let i=this.reader.cstring(),s=this.reader.cstring();return new de(t,i,s)}parseBackendKeyData(e,t,n){this.reader.setBuffer(e,n);let i=this.reader.int32(),s=this.reader.int32();return new me(t,i,s)}parseAuthenticationResponse(e,t,n){this.reader.setBuffer(e,n);let i=this.reader.int32(),s={name:"authenticationOk",length:t};switch(i){case 0:break;case 3:s.length===8&&(s.name="authenticationCleartextPassword");break;case 5:if(s.length===12){s.name="authenticationMD5Password";let a=this.reader.bytes(4);return new ye(t,a)}break;case 10:s.name="authenticationSASL",s.mechanisms=[];let o;do o=this.reader.cstring(),o&&s.mechanisms.push(o);while(o);break;case 11:s.name="authenticationSASLContinue",s.data=this.reader.string(t-8);break;case 12:s.name="authenticationSASLFinal",s.data=this.reader.string(t-8);break;default:throw new Error("Unknown authenticationOk message type "+i)}return s}parseErrorMessage(e,t,n,i){this.reader.setBuffer(e,n);let s={},o=this.reader.string(1);for(;o!=="\0";)s[o]=this.reader.cstring(),o=this.reader.string(1);let a=s.M,c=i==="notice"?new q(t,a):new C(a,t,i);return c.severity=s.S,c.code=s.C,c.detail=s.D,c.hint=s.H,c.position=s.P,c.internalPosition=s.p,c.internalQuery=s.q,c.where=s.W,c.schema=s.s,c.table=s.t,c.column=s.c,c.dataType=s.d,c.constraint=s.n,c.file=s.F,c.line=s.L,c.routine=s.R,c}};function _i(r,e){let t=new V;return r.on("data",n=>t.parse(n,e)),new Promise(n=>r.on("end",()=>n()))}var oe,Y,K,X,ae,Be,ue,We,ce,Ie,Ae,Te,J,M,D,Z,h,Ar,Rt,G,St,Pt,xe,$,Ee,H,Mt=class Mt{constructor(e={},t={}){x(this,h);x(this,oe,!1);x(this,Y,!1);x(this,K,!1);x(this,X,!1);x(this,ae,!1);x(this,Be,new Q);x(this,ue,new Q);x(this,We,new Q);x(this,ce,!1);this.debug=0;x(this,Ie);x(this,Ae,[]);x(this,Te,new V);x(this,J);x(this,M);x(this,D,new Map);x(this,Z,new Set);typeof e=="string"?t={dataDir:e,...t}:t=e,this.dataDir=t.dataDir,t?.debug!==void 0&&(this.debug=t.debug),t?.relaxedDurability!==void 0&&B(this,ae,t.relaxedDurability),B(this,Ie,t.extensions??{}),this.waitReady=y(this,h,Ar).call(this,t??{})}static async create(e){let t=new Mt(e);return await t.waitReady,t}get Module(){return this.mod}get ready(){return d(this,oe)&&!d(this,Y)&&!d(this,K)}get closed(){return d(this,K)}async close(){await y(this,h,xe).call(this),B(this,Y,!0);for(let e of d(this,Ae))await e();try{await this.execProtocol(P.end())}catch(e){let t=e;if(!(t.name==="ExitStatus"&&t.status===0))throw e}await this.fs.close(this.mod.FS),B(this,K,!0),B(this,Y,!1)}async[Symbol.asyncDispose](){await this.close()}async query(e,t,n){return await y(this,h,xe).call(this),await d(this,ue).runExclusive(async()=>await y(this,h,Rt).call(this,e,t,n))}async exec(e,t){return await y(this,h,xe).call(this),await d(this,ue).runExclusive(async()=>await y(this,h,G).call(this,e,t))}async transaction(e){return await y(this,h,xe).call(this),await d(this,ue).runExclusive(async()=>{await y(this,h,G).call(this,"BEGIN");let t=!1,n=()=>{if(t)throw new Error("Transaction is closed")};try{let s=await e({query:async(o,a,c)=>(n(),await y(this,h,Rt).call(this,o,a,c)),exec:async(o,a)=>(n(),await y(this,h,G).call(this,o,a)),rollback:async()=>{n(),await y(this,h,G).call(this,"ROLLBACK"),t=!0},get closed(){return t}});return t||(t=!0,await y(this,h,G).call(this,"COMMIT")),s}catch(i){throw t||await y(this,h,G).call(this,"ROLLBACK"),i}})}async execProtocolRaw(e,{syncToFs:t=!0}={}){let n=e.length,i=this.mod;i._interactive_write(n),i.HEAPU8.set(e,1),i._interactive_one();let s=n+2,o=s+i._interactive_read(),a=i.HEAPU8.subarray(s,o);return t&&await y(this,h,Ee).call(this),a}async execProtocol(e,{syncToFs:t=!0,onNotice:n}={}){let i=await this.execProtocolRaw(e,{syncToFs:t}),s=[];return d(this,Te).parse(g.from(i),o=>{if(o instanceof C)throw B(this,Te,new V),o;if(o instanceof q)this.debug>0&&console.warn(o),n&&n(o);else if(o instanceof U)switch(o.text){case"BEGIN":B(this,X,!0);break;case"COMMIT":case"ROLLBACK":B(this,X,!1);break}else if(o instanceof z){let a=d(this,D).get(o.channel);a&&a.forEach(c=>{queueMicrotask(()=>c(o.payload))}),d(this,Z).forEach(c=>{queueMicrotask(()=>c(o.channel,o.payload))})}s.push([o,i])}),s}async listen(e,t){return d(this,D).has(e)||d(this,D).set(e,new Set),d(this,D).get(e).add(t),await this.exec(`LISTEN ${e}`),async()=>{await this.unlisten(e,t)}}async unlisten(e,t){t?(d(this,D).get(e)?.delete(t),d(this,D).get(e)?.size===0&&(await this.exec(`UNLISTEN ${e}`),d(this,D).delete(e))):(await this.exec(`UNLISTEN ${e}`),d(this,D).delete(e))}onNotification(e){return d(this,Z).add(e),()=>{d(this,Z).delete(e)}}offNotification(e){d(this,Z).delete(e)}async dumpDataDir(){let e=this.dataDir?.split("/").pop()??"pgdata";return this.fs.dumpTar(this.mod.FS,e)}};oe=new WeakMap,Y=new WeakMap,K=new WeakMap,X=new WeakMap,ae=new WeakMap,Be=new WeakMap,ue=new WeakMap,We=new WeakMap,ce=new WeakMap,Ie=new WeakMap,Ae=new WeakMap,Te=new WeakMap,J=new WeakMap,M=new WeakMap,D=new WeakMap,Z=new WeakMap,h=new WeakSet,Ar=async function(e){if(e.fs)this.fs=e.fs;else{let{dataDir:a,fsType:c}=_t(e.dataDir);this.fs=await Ot(a,c)}let t={},n=[],i=[`PGDATA=${Pe}`,`PREFIX=${He}`,`PGUSER=${e.username??"postgres"}`,`PGDATABASE=${e.database??"template1"}`,"MODE=REACT","REPL=N",...this.debug?["-d",this.debug.toString()]:[]],s={WASM_PREFIX:He,arguments:i,INITIAL_MEMORY:e.initialMemory,noExitRuntime:!0,...this.debug>0?{print:console.info,printErr:console.error}:{print:()=>{},printErr:()=>{}},locateFile:await Lt(),preRun:[a=>{let c=a.FS.makedev(64,0),f={open:l=>{},close:l=>{},read:(l,p,T,w,R)=>{let Fe=d(this,J);if(!Fe)throw new Error("No /dev/blob File or Blob provided to read from");let je=new Uint8Array(Fe);if(R>=je.length)return 0;let Dt=Math.min(je.length-R,w);for(let Re=0;Re<Dt;Re++)p[T+Re]=je[R+Re];return Dt},write:(l,p,T,w,R)=>(d(this,M)??B(this,M,[]),d(this,M).push(p.slice(T,T+w)),w),llseek:(l,p,T)=>{let w=d(this,J);if(!w)throw new Error("No /dev/blob File or Blob provided to llseek");let R=p;if(T===1?R+=l.position:T===2&&(R=new Uint8Array(w).length),R<0)throw new a.FS.ErrnoError(28);return R}};a.FS.registerDevice(c,f),a.FS.mkdev("/dev/blob",c)}]};s=await this.fs.emscriptenOpts(s);for(let[a,c]of Object.entries(d(this,Ie)))if(c instanceof URL)t[a]=At(c);else{let f=await c.setup(this,s);if(f.emscriptenOpts&&(s=f.emscriptenOpts),f.namespaceObj){let l=this;l[a]=f.namespaceObj}f.bundlePath&&(t[a]=At(f.bundlePath)),f.init&&n.push(f.init),f.close&&d(this,Ae).push(f.close)}if(s.pg_extensions=t,this.mod=await kt(s),await this.fs.initialSyncFs(this.mod.FS),e.loadDataDir){if(this.mod.FS.analyzePath(Pe+"/PG_VERSION").exists)throw new Error("Database already exists, cannot load from tarball");y(this,h,H).call(this,"pglite: loading data from tarball"),await Ut(this.mod.FS,e.loadDataDir)}this.mod.FS.analyzePath(Pe+"/PG_VERSION").exists?y(this,h,H).call(this,"pglite: found DB, resuming"):y(this,h,H).call(this,"pglite: no db"),await br(this.mod,(...a)=>y(this,h,H).call(this,...a));let o=this.mod._pg_initdb();if(!o)throw new Error("INITDB failed to return value");if(o&1)throw new Error("INITDB failed");if(o&2){let a=e.username??"postgres",c=e.database??"template1";if(o&4){if(!(o&12))throw new Error("Invalid db/user combination")}else if(c!=="template1"&&a!=="postgres")throw new Error("INITDB created a new datadir, but an alternative db/user was requested")}await y(this,h,Ee).call(this),await y(this,h,G).call(this,"SET search_path TO public;"),B(this,oe,!0);for(let a of n)await a()},Rt=async function(e,t,n){return await d(this,Be).runExclusive(async()=>{y(this,h,H).call(this,"runQuery",e,t,n),await y(this,h,St).call(this,n?.blob);let i=t?.map(a=>Ge(a,n?.setAllTypes))||[],s;try{s=[...await y(this,h,$).call(this,P.parse({text:e,types:i.map(([,a])=>a)}),n),...await y(this,h,$).call(this,P.bind({values:i.map(([a])=>a)}),n),...await y(this,h,$).call(this,P.describe({type:"P"}),n),...await y(this,h,$).call(this,P.execute({}),n)]}finally{await y(this,h,$).call(this,P.sync(),n)}y(this,h,Pt).call(this),d(this,X)||await y(this,h,Ee).call(this);let o;return d(this,M)&&(o=new Blob(d(this,M)),B(this,M,void 0)),Qe(s.map(([a])=>a),n,o)[0]})},G=async function(e,t){return await d(this,Be).runExclusive(async()=>{y(this,h,H).call(this,"runExec",e,t),await y(this,h,St).call(this,t?.blob);let n;try{n=await y(this,h,$).call(this,P.query(e),t)}finally{await y(this,h,$).call(this,P.sync(),t)}y(this,h,Pt).call(this),d(this,X)||await y(this,h,Ee).call(this);let i;return d(this,M)&&(i=new Blob(d(this,M)),B(this,M,void 0)),Qe(n.map(([s])=>s),t,i)})},St=async function(e){B(this,J,e?await e.arrayBuffer():void 0)},Pt=function(){B(this,J,void 0)},xe=async function(){if(d(this,Y))throw new Error("PGlite is closing");if(d(this,K))throw new Error("PGlite is closed");d(this,oe)||await this.waitReady},$=async function(e,t={}){return await this.execProtocol(e,{...t,syncToFs:!1})},Ee=async function(){if(d(this,ce))return;B(this,ce,!0);let e=async()=>{await d(this,We).runExclusive(async()=>{B(this,ce,!1),await this.fs.syncToFs(this.mod.FS,d(this,ae))})};d(this,ae)?e():await e()},H=function(...e){this.debug>0&&console.log(...e)};var Ir=Mt;m();export{Fr as IdbFs,Rr as MemoryFS,Q as Mutex,Ir as PGlite,Pr as formatQuery,vt as messages,mr as parse,Br as protocol,yr as types,Sr as uuid};
|
2 |
+
/*! Bundled license information:
|
3 |
+
|
4 |
+
ieee754/index.js:
|
5 |
+
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
6 |
+
|
7 |
+
buffer/index.js:
|
8 |
+
(*!
|
9 |
+
* The buffer module from node.js, for the browser.
|
10 |
+
*
|
11 |
+
* @author Feross Aboukhadijeh <https://feross.org>
|
12 |
+
* @license MIT
|
13 |
+
*)
|
14 |
+
*/
|
15 |
+
//# sourceMappingURL=index.js.map
|
assets/index-DDNtMdqT.css
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.static{position:static}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.flex{display:flex}.table{display:table}.min-h-screen{min-height:100vh}.w-full{width:100%}.max-w-xs{max-width:20rem}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.rounded{border-radius:.25rem}.border{border-width:1px}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity))}.p-12{padding:3rem}.p-2{padding:.5rem}.text-center{text-align:center}.text-2xl{font-size:1.5rem;line-height:2rem}.text-5xl{font-size:3rem;line-height:1}.font-bold{font-weight:700}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.underline{text-decoration-line:underline}:root{--foreground-rgb: 0, 0, 0;--background-start-rgb: 214, 219, 220;--background-end-rgb: 255, 255, 255}body{color:rgb(var(--foreground-rgb));background:linear-gradient(to bottom,transparent,rgb(var(--background-end-rgb))) rgb(var(--background-start-rgb))}
|
assets/nodefs-CCGrc9rU.js
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
import{x as s,P as i,z as t,D as o}from"./index-C8iGwwE4.js";s();var d=class extends i{constructor(e){super(e),this.rootDir=(void 0)(e),(void 0)((void 0)(this.rootDir))||(void 0)(this.rootDir)}async emscriptenOpts(e){return{...e,preRun:[...e.preRun||[],r=>{let n=r.FS.filesystems.NODEFS;r.FS.mkdir(t),r.FS.mount(n,{root:this.rootDir},t)}]}}async dumpTar(e,r){return o(e,r)}async close(e){e.quit()}};export{d as NodeFS};
|
assets/postgres-7Zdp-caD.data
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e92b77f47fa9e7d3ca4e56a4ce70a316b99d5fd03c9de93c9c3505a7e1ba6731
|
3 |
+
size 2988700
|
assets/postgres-DSvoAWnW.wasm
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:14a548392be7044caa124eaae973a57c194251a4bb7b7cc1e3256538ff59b41a
|
3 |
+
size 7471643
|
assets/vector.tar-NT8T069k.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:734d14f7a07587a11959089893ad093ccc035d62ce79725a1afbd6211e7ca803
|
3 |
+
size 44128
|
assets/worker-Dx_8b-Xw.js
ADDED
The diff for this file is too large to render.
See raw diff
|
|
index.html
CHANGED
@@ -1,19 +1,14 @@
|
|
1 |
-
<!
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
Also don't forget to check the
|
15 |
-
<a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
|
16 |
-
</p>
|
17 |
-
</div>
|
18 |
-
</body>
|
19 |
</html>
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8" />
|
5 |
+
<link rel="icon" type="image/svg+xml" href="/browser-vector-search/vite.svg" />
|
6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
7 |
+
<title>Browser Vector Search</title>
|
8 |
+
<script type="module" crossorigin src="/browser-vector-search/assets/index-C8iGwwE4.js"></script>
|
9 |
+
<link rel="stylesheet" crossorigin href="/browser-vector-search/assets/index-DDNtMdqT.css">
|
10 |
+
</head>
|
11 |
+
<body>
|
12 |
+
<div id="root"></div>
|
13 |
+
</body>
|
|
|
|
|
|
|
|
|
|
|
14 |
</html>
|
vite.svg
ADDED