1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[70614,76433],{884:function(e,t,i){var n;!function(e,s,a){function l(e){var t=this,i="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:i+=e;for(var n=0;n<i.length+64;n++)t.x^=0|i.charCodeAt(n),t.next()}function o(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t}function u(e,t){var i=new l(e),n=t&&t.state,s=function(){return(i.next()>>>0)/0x100000000};return s.double=function(){do var e=((i.next()>>>11)+(i.next()>>>0)/0x100000000)/2097152;while(0===e);return e},s.int32=i.next,s.quick=s,n&&("object"==typeof n&&o(n,i),s.state=function(){return o(i,{})}),s}s&&s.exports?s.exports=u:i.amdD&&i.amdO?void 0!==(n=(function(){return u}).call(t,i,t,s))&&(s.exports=n):this.xor128=u}(0,e=i.nmd(e),i.amdD)},2286:(e,t,i)=>{"use strict";e.exports=i.p+"static/media/postgres.f4d4c3f7.wasm"},4805:(e,t,i)=>{"use strict";i.d(t,{HE:()=>h,Io:()=>g,Lf:()=>m,XI:()=>p,e:()=>l});var n=i(6996),s=i(56970);let a=Symbol.for("drizzle:Schema"),l=Symbol.for("drizzle:Columns"),o=Symbol.for("drizzle:ExtraConfigColumns"),u=Symbol.for("drizzle:OriginalName"),c=Symbol.for("drizzle:BaseName"),h=Symbol.for("drizzle:IsAlias"),d=Symbol.for("drizzle:ExtraConfigBuilder"),f=Symbol.for("drizzle:IsDrizzleTable");class p{static [n.i]="Table";static Symbol={Name:s.E,Schema:a,OriginalName:u,Columns:l,ExtraConfigColumns:o,BaseName:c,IsAlias:h,ExtraConfigBuilder:d};[s.E];[u];[a];[l];[o];[c];[h]=!1;[f]=!0;[d]=void 0;constructor(e,t,i){this[s.E]=this[u]=e,this[a]=t,this[c]=i}}function g(e){return e[s.E]}function m(e){return`${e[a]??"public"}.${e[s.E]}`}},6996:(e,t,i)=>{"use strict";i.d(t,{i:()=>n,is:()=>s});let n=Symbol.for("drizzle:entityKind");function s(e,t){if(!e||"object"!=typeof e)return!1;if(e instanceof t)return!0;if(!Object.prototype.hasOwnProperty.call(t,n))throw Error(`Class "${t.name??"<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let i=Object.getPrototypeOf(e).constructor;if(i)for(;i;){if(n in i&&i[n]===t[n])return!0;i=Object.getPrototypeOf(i)}return!1}Symbol.for("drizzle:hasOwnEntityKind")},7272:(e,t,i)=>{"use strict";i.d(t,{n:()=>n});let n=Symbol.for("drizzle:ViewBaseConfig")},7307:(e,t,i)=>{"use strict";function n(e,...t){return e(...t)}i.d(t,{i:()=>n})},7610:(e,t)=>{t.read=function(e,t,i,n,s){var a,l,o=8*s-n-1,u=(1<<o)-1,c=u>>1,h=-7,d=i?s-1:0,f=i?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-h)-1,p>>=-h,h+=o;h>0;a=256*a+e[t+d],d+=f,h-=8);for(l=a&(1<<-h)-1,a>>=-h,h+=n;h>0;l=256*l+e[t+d],d+=f,h-=8);if(0===a)a=1-c;else{if(a===u)return l?NaN:1/0*(p?-1:1);l+=Math.pow(2,n),a-=c}return(p?-1:1)*l*Math.pow(2,a-n)},t.write=function(e,t,i,n,s,a){var l,o,u,c=8*a-s-1,h=(1<<c)-1,d=h>>1,f=5960464477539062e-23*(23===s),p=n?0:a-1,g=n?1:-1,m=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(o=+!!isNaN(t),l=h):(l=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-l))<1&&(l--,u*=2),l+d>=1?t+=f/u:t+=f*Math.pow(2,1-d),t*u>=2&&(l++,u/=2),l+d>=h?(o=0,l=h):l+d>=1?(o=(t*u-1)*Math.pow(2,s),l+=d):(o=t*Math.pow(2,d-1)*Math.pow(2,s),l=0));s>=8;e[i+p]=255&o,p+=g,o/=256,s-=8);for(l=l<<s|o,c+=s;c>0;e[i+p]=255&l,p+=g,l/=256,c-=8);e[i+p-g]|=128*m}},9102:(e,t,i)=>{"use strict";i.d(t,{a:()=>d,b:()=>f,c:()=>g,d:()=>m,e:()=>b,f:()=>w,g:()=>v,h:()=>S,i:()=>x,j:()=>T});var n=Object.create,s=Object.defineProperty,a=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,o=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty,c=e=>{throw TypeError(e)},h=(e,t,i)=>t in e?s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,d=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),f=(e,t)=>{for(var i in t)s(e,i,{get:t[i],enumerable:!0})},p=(e,t,i,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let o of l(t))u.call(e,o)||o===i||s(e,o,{get:()=>t[o],enumerable:!(n=a(t,o))||n.enumerable});return e},g=(e,t,i)=>(i=null!=e?n(o(e)):{},p(!t&&e&&e.__esModule?i:s(i,"default",{value:e,enumerable:!0}),e)),m=(e,t,i)=>h(e,"symbol"!=typeof t?t+"":t,i),y=(e,t,i)=>t.has(e)||c("Cannot "+i),b=(e,t,i)=>(y(e,t,"read from private field"),i?i.call(e):t.get(e)),w=(e,t,i)=>t.has(e)?c("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),v=(e,t,i,n)=>(y(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i),S=(e,t,i)=>(y(e,t,"access private method"),i),x=(e,t,i,n)=>
1({set _(r){v(e,t,r,i)},get _(){return b(e,t,n)}}),T=((e,t)=>()=>(e&&(t=e(e=0)),t))(()=>{})},9813:(e,t,i)=>{"use strict";i.d(t,{a:()=>h,b:()=>g,c:()=>T,d:()=>P,e:()=>N,f:()=>C,g:()=>k});var n=i(9102),s=i(87358),a=(0,n.a)((e,t)=>{(0,n.j)();var i=void 0;function s(e){return"string"==typeof e||"[object String]"==Object.prototype.toString.call(e)}function a(e){return null!==e&&"object"==typeof e}function l(e){return"function"==typeof e}function o(e){var t;return a(e)&&!l(e)&&"number"==typeof(t=e.length)&&t>-1&&t%1==0&&t<=0x1fffffffffffff}function u(e){return"[object ArrayBuffer]"==Object.prototype.toString.call(e)}t.exports.MAX_SAFE_INTEGER=0x1fffffffffffff,t.exports.isUndefined=function(e){return e===i},t.exports.isString=s,t.exports.isObject=a,t.exports.isDateTime=function(e){return"[object Date]"==Object.prototype.toString.call(e)},t.exports.isFunction=l,t.exports.isArray=function(e){return"[object Array]"==Object.prototype.toString.call(e)},t.exports.isArrayLike=o,t.exports.isArrayBuffer=u,t.exports.map=function(e,t){return Array.prototype.map.call(e,t)},t.exports.find=function(e,t){var n=i;return l(t)&&Array.prototype.every.call(e,function(e,i,s){var a=t(e,i,s);return a&&(n=e),!a}),n},t.exports.extend=function(e){return Object.assign.apply(null,arguments)},t.exports.toUint8Array=function e(t){var i,n,c;if(s(t)){for(c=new Uint8Array(n=t.length),i=0;i<n;i++)c[i]=255&t.charCodeAt(i);return c}return u(t)?new Uint8Array(t):a(t)&&u(t.buffer)?new Uint8Array(t.buffer):o(t)?new Uint8Array(t):a(t)&&l(t.toString)?e(t.toString()):new Uint8Array}}),l=(0,n.a)((e,t)=>{(0,n.j)(),t.exports={NULL_CHAR:"\0",TMAGIC:"ustar\x0000",OLDGNU_MAGIC:"ustar \0",REGTYPE:0,LNKTYPE:1,SYMTYPE:2,CHRTYPE:3,BLKTYPE:4,DIRTYPE:5,FIFOTYPE:6,CONTTYPE:7,TSUID:parseInt("4000",8),TSGID:parseInt("2000",8),TSVTX:parseInt("1000",8),TUREAD:parseInt("0400",8),TUWRITE:parseInt("0200",8),TUEXEC:parseInt("0100",8),TGREAD:parseInt("0040",8),TGWRITE:parseInt("0020",8),TGEXEC:parseInt("0010",8),TOREAD:parseInt("0004",8),TOWRITE:parseInt("0002",8),TOEXEC:parseInt("0001",8),TPERMALL:parseInt("0777",8),TPERMMASK:parseInt("0777",8)}}),o=(0,n.a)((e,t)=>{(0,n.j)();var i=a(),s=l(),o=s.TPERMALL,u=[["name",100,0,function(e,t){return h(e[t[0]],t[1])},function(e,t,i){return p(e.slice(t,t+i[1]))}],["mode",8,100,function(e,t){var i=e[t[0]]||o;return d(i&=s.TPERMMASK,t[1],o)},function(e,t,i){return g(e.slice(t,t+i[1]))&s.TPERMMASK}],["uid",8,108,function(e,t){return d(e[t[0]],t[1],0)},function(e,t,i){return g(e.slice(t,t+i[1]))}],["gid",8,116,function(e,t){return d(e[t[0]],t[1],0)},function(e,t,i){return g(e.slice(t,t+i[1]))}],["size",12,124,function(e,t){return d(e.data.length,t[1])},function(e,t,i){return g(e.slice(t,t+i[1]))}],["modifyTime",12,136,function(e,t){return f(e[t[0]],t[1])},function(e,t,i){return m(e.slice(t,t+i[1]))}],["checksum",8,148,function(e,t){return" "},function(e,t,i){return g(e.slice(t,t+i[1]))}],["type",1,156,function(e,t){return""+(parseInt(e[t[0]],10)||0)%8},function(e,t,i){return(parseInt(String.fromCharCode(e[t]),10)||0)%8}],["linkName",100,157,function(e,t){return""},function(e,t,i){return p(e.slice(t,t+i[1]))}],["ustar",8,257,function(e,t){return s.TMAGIC},function(e,t,i){return function(e){if(8==e.length){var t=e.split("");if(t[5]==s.NULL_CHAR)return(" "==t[6]||t[6]==s.NULL_CHAR)&&(t[6]="0"),(" "==t[7]||t[7]==s.NULL_CHAR)&&(t[7]="0"),(t=t.join(""))==s.TMAGIC?t:e;if(t[7]==s.NULL_CHAR)return t[5]==s.NULL_CHAR&&(t[5]=" "),t[6]==s.NULL_CHAR&&(t[6]=" "),t==s.OLDGNU_MAGIC?t:e}return e}(p(e.slice(t,t+i[1]),!0))},function(e,t){return e[t[0]]==s.TMAGIC||e[t[0]]==s.OLDGNU_MAGIC}],["owner",32,265,function(e,t){return h(e[t[0]],t[1])},function(e,t,i){return p(e.slice(t,t+i[1]))}],["group",32,297,function(e,t){return h(e[t[0]],t[1])},function(e,t,i){return p(e.slice(t,t+i[1]))}],["majorNumber",8,329,function(e,t){return""},function(e,t,i){return g(e.slice(t,t+i[1]))}],["minorNumber",8,337,function(e,t){return""},function(e,t,i){return g(e.slice(t,t+i[1]))}],["prefix",131,345,function(e,t){return h(e[t[0]],t[1])},function(e,t,i){return p(e.slice(t,t+i[1]))}],["accessTime",12,476,function(e,t){return f(e[t[0]],t[1])},function(e,t,i){return m(e.slice(t,t+i[1]))}],["createTime",12,488,function(e,t){return f(e[t[0]],t[1])},function(e,t,i){return m(e.slice(t,t+i[1]))}]],c=function(e){var t=e[e.length-1];return t[2]+t[1]}(u);function h(e,t){return t-=1,i.isUndefined(e)&&(e=""),(e=(""+e).substr(0,t))+s.NULL_CHAR}function d(e,t,i){for(i=parseInt(i)||0,t-=1,e=(parseInt(e)||i).toString(8).substr(-t,t);e.length<t;)e="0"+e;return e+s.NULL_CHAR}function f(e,t){if(i.isDateTime(e))e=Math.floor(+e/1e3);else if(isFinite(e=parseInt(e,10))){if(e<=0)return""}else e=Math.floor(+new Date/1e3);return d(e,t,0)}function p(e,t){var i=String.fromCharCode.apply(null,e);if(t)return i;var n=i.indexOf(s.NULL_CHAR);return n>=0?i.substr(0,n):i}function g(e){return parseInt(String.fromCharCode.apply(null,e).replace(/^0+$/g,""),8)||0}function m(e){return 0==e.length||0==e[0]?null:new Date(1e3*g(e))}t.exports.recordSize=512,t.exports.defaultFileMode=o,t.exports.defaultUid=0,t.exp
1orts.defaultGid=0,t.exports.posixHeader=u,t.exports.effectiveHeaderSize=c,t.exports.calculateChecksum=function(e,t,i){var n=parseInt(t,10)||0,s=Math.min(n+c,e.length),a=0,l=0,o=0;i&&u.every(function(e){return"checksum"!=e[0]||(o=(l=n+e[2])+e[1],!1)});for(var h=n;h<s;h++)a=(a+(h>=l&&h<o?32:e[h]))%262144;return a},t.exports.formatTarString=h,t.exports.formatTarNumber=d,t.exports.formatTarDateTime=f,t.exports.parseTarString=p,t.exports.parseTarNumber=g,t.exports.parseTarDateTime=m}),u=(0,n.a)((e,t)=>{(0,n.j)();var i=l(),s=a(),u=o();function c(e){return u.recordSize}function h(e){return Math.ceil(e.data.length/u.recordSize)*u.recordSize}t.exports.tar=function(e){e=s.map(e,function(e){return s.extend({},e,{data:s.toUint8Array(e.data)})});var t,n=(t=0,e.forEach(function(e){t+=c(e)+h(e)}),new Uint8Array(t+=2*u.recordSize)),a=0;return e.forEach(function(e){var t;t=parseInt(t=a=function(e,t,n){var a=n=parseInt(n)||0;u.posixHeader.forEach(function(i){for(var n=i[3](t,i),s=n.length,l=0;l<s;l+=1)e[a+l]=255&n.charCodeAt(l);a+=i[1]});var l=s.find(u.posixHeader,function(e){return"checksum"==e[0]});if(l){var o=u.calculateChecksum(e,n,!0),h=u.formatTarNumber(o,l[1]-2)+i.NULL_CHAR+" ";a=n+l[2];for(var d=0;d<h.length;d+=1)e[a]=255&h.charCodeAt(d),a++}return n+c(t)}(n,e,a),10)||0,n.set(e.data,t),a=t+h(e)}),n}}),c=(0,n.a)((e,t)=>{(0,n.j)();var i=l(),s=a(),u=o(),c={extractData:!0,checkHeader:!0,checkChecksum:!0,checkFileSize:!0},h={size:!0,checksum:!0,ustar:!0},d={unexpectedEndOfFile:"Unexpected end of file.",fileCorrupted:"File is corrupted.",checksumCheckFailed:"Checksum check failed."};t.exports.untar=function(e,t){t=s.extend({},c,t);for(var n=[],a=0,l=e.length;l-a>=u.recordSize;){var o,f,p=function(e,t,i){if(e.length-t<u.recordSize){if(i.checkFileSize)throw Error(d.unexpectedEndOfFile);return null}t=parseInt(t)||0;var n={},a=t;if(u.posixHeader.forEach(function(t){n[t[0]]=t[4](e,a,t),a+=t[1]}),0!=n.type&&(n.size=0),i.checkHeader&&u.posixHeader.forEach(function(e){if(s.isFunction(e[5])&&!e[5](n,e)){var i=Error(d.fileCorrupted);throw i.data={offset:t+e[2],field:e[0]},i}}),i.checkChecksum){var l=u.calculateChecksum(e,t,!0);if(l!=n.checksum){var o=Error(d.checksumCheckFailed);throw o.data={offset:t,header:n,checksum:l},o}}return n}(e=s.toUint8Array(e),a,t);if(!p)break;a+=u.recordSize;var g=(o=e,f=a,t.extractData?p.size<=0?new Uint8Array:o.slice(f,f+p.size):null);if(n.push(function(e,t){var n={};return u.posixHeader.forEach(function(t){var i=t[0];h[i]||(n[i]=e[i])}),n.isOldGNUFormat=e.ustar==i.OLDGNU_MAGIC,t&&(n.data=t),n}(p,g)),function(e,t){for(var i=Math.min(e.length,t+2*u.recordSize),n=t;n<i;n++)if(0!=e[n])return!1;return!0}(e,a+=Math.ceil(p.size/u.recordSize)*u.recordSize))break}return n}}),h=(0,n.a)((e,t)=>{(0,n.j)();var i=a(),s=l(),o=u(),h=c();i.extend(t.exports,o,h,s)});(0,n.j)(),(0,n.j)();var d=(0,n.c)(h(),1);async function f(e,t,i="pgdata",n="auto"){let s=function(e,t){let i,n;let s=(i=[],(n=s=>{e.readdir(s).forEach(a=>{if("."===a||".."===a)return;let l=s+"/"+a,o=e.stat(l),u=e.isFile(o.mode)?e.readFile(l,{encoding:"binary"}):new Uint8Array(0);i.push({name:l.substring(t.length),mode:o.mode,size:o.size,type:e.isFile(o.mode)?d.REGTYPE:d.DIRTYPE,modifyTime:o.mtime,data:u}),e.isDir(o.mode)&&n(l)})})(t),i);return(0,d.tar)(s)}(e,t),[a,l]=await m(s,n),o=l?"application/x-gzip":"application/x-tar";return"u">typeof File?new File([a],i+(l?".tar.gz":".tar"),{type:o}):new Blob([a],{type:o})}var p=["application/x-gtar","application/x-tar+gzip","application/x-gzip","application/gzip"];async function g(e,t,i){let n,s=new Uint8Array(await t.arrayBuffer()),a="u">typeof File&&t instanceof File?t.name:void 0;(p.includes(t.type)||a?.endsWith(".tgz")||a?.endsWith(".tar.gz"))&&(s=await w(s));try{n=(0,d.untar)(s)}catch(e){if(e instanceof Error&&e.message.includes("File is corrupted"))s=await w(s),n=(0,d.untar)(s);else throw e}for(let t of n){let n=i+t.name,s=n.split("/").slice(0,-1);for(let t=1;t<=s.length;t++){let i=s.slice(0,t).join("/");e.analyzePath(i).exists||e.mkdir(i)}t.type===d.REGTYPE?(e.writeFile(n,t.data),e.utime(n,x(t.modifyTime),x(t.modifyTime))):t.type===d.DIRTYPE&&e.mkdir(n)}}async function m(e,t="auto"){if("none"===t)return[e,!1];if("u">typeof CompressionStream)return[await y(e),!0];if("u">typeof s&&s.versions&&s.versions.node)return[await b(e),!0];if("auto"===t)return[e,!1];throw Error("Compression not supported in this environment")}async function y(e){let t=new CompressionStream("gzip"),i=t.writable.getWriter(),n=t.readable.getReader();i.write(e),i.close();let s=[];for(;;){let{value:e,done:t}=await n.read();if(t)break;e&&s.push(e)}let a=new Uint8Array(s.reduce((e,t)=>
1e+t.length,0)),l=0;return s.forEach(e=>{a.set(e,l),l+=e.length}),a}async function b(e){let{promisify:t}=await i.e(10622).then(i.t.bind(i,10622,23)),{gzip:n}=await i.e(2097).then(i.t.bind(i,2097,23));return await t(n)(e)}async function w(e){if("u">typeof CompressionStream)return await v(e);if("u">typeof s&&s.versions&&s.versions.node)return await S(e);throw Error("Unsupported environment for decompression")}async function v(e){let t=new DecompressionStream("gzip"),i=t.writable.getWriter(),n=t.readable.getReader();i.write(e),i.close();let s=[];for(;;){let{value:e,done:t}=await n.read();if(t)break;e&&s.push(e)}let a=new Uint8Array(s.reduce((e,t)=>e+t.length,0)),l=0;return s.forEach(e=>{a.set(e,l),l+=e.length}),a}async function S(e){let{promisify:t}=await i.e(10622).then(i.t.bind(i,10622,23)),{gunzip:n}=await i.e(2097).then(i.t.bind(i,2097,23));return await t(n)(e)}function x(e){return e?"number"==typeof e?e:Math.floor(e.getTime()/1e3):Math.floor(Date.now()/1e3)}var T="/tmp/pglite",P=T+"/base",N=class{constructor(e){this.dataDir=e}async init(e,t){return this.pg=e,{emscriptenOpts:t}}async syncToFs(e){}async initialSyncFs(){}async closeFs(){}async dumpTar(e,t){return f(this.pg.Module.FS,P,e,t)}},C=class{constructor(e,{debug:t=!1}={}){this.dataDir=e,this.debug=t}async syncToFs(e){}async initialSyncFs(){}async closeFs(){}async dumpTar(e,t){return f(this.pg.Module.FS,P,e,t)}async init(e,t){return this.pg=e,{emscriptenOpts:{...t,preRun:[...t.preRun||[],e=>{let t=A(e,this);e.FS.mkdir(P),e.FS.mount(t,{},P)}]}}}},k={EBADF:8,EBADFD:127,EEXIST:20,EINVAL:28,EISDIR:31,ENODEV:43,ENOENT:44,ENOTDIR:54,ENOTEMPTY:55},A=(e,t)=>{let i=e.FS,n=t.debug?console.log:null,s={tryFSOperation(e){try{return e()}catch(e){throw e.code?new i.ErrnoError("UNKNOWN"===e.code?k.EINVAL:e.code):e}},mount:e=>s.createNode(null,"/",16895,0),syncfs(e,t,i){},createNode(e,t,n,a){if(!i.isDir(n)&&!i.isFile(n))throw new i.ErrnoError(28);let l=i.createNode(e,t,n);return l.node_ops=s.node_ops,l.stream_ops=s.stream_ops,l},getMode:function(e){return n?.("getMode",e),s.tryFSOperation(()=>t.lstat(e).mode)},realPath:function(e){let t=[];for(;e.parent!==e;)t.push(e.name),e=e.parent;return t.push(e.mount.opts.root),t.reverse(),t.join("/")},node_ops:{getattr(e){n?.("getattr",s.realPath(e));let i=s.realPath(e);return s.tryFSOperation(()=>{let n=t.lstat(i);return{...n,dev:0,ino:e.id,nlink:1,rdev:e.rdev,atime:new Date(n.atime),mtime:new Date(n.mtime),ctime:new Date(n.ctime)}})},setattr(e,i){n?.("setattr",s.realPath(e),i);let a=s.realPath(e);s.tryFSOperation(()=>{void 0!==i.mode&&t.chmod(a,i.mode),void 0!==i.size&&t.truncate(a,i.size),void 0!==i.timestamp&&t.utimes(a,i.timestamp,i.timestamp),void 0!==i.size&&t.truncate(a,i.size)})},lookup(e,t){n?.("lookup",s.realPath(e),t);let i=[s.realPath(e),t].join("/"),a=s.getMode(i);return s.createNode(e,t,a)},mknod(e,a,l,o){n?.("mknod",s.realPath(e),a,l,o);let u=s.createNode(e,a,l,o),c=s.realPath(u);return s.tryFSOperation(()=>(i.isDir(u.mode)?t.mkdir(c,{mode:l}):t.writeFile(c,"",{mode:l}),u))},rename(e,i,a){n?.("rename",s.realPath(e),s.realPath(i),a);let l=s.realPath(e),o=[s.realPath(i),a].join("/");s.tryFSOperation(()=>{t.rename(l,o)}),e.name=a},unlink(e,i){n?.("unlink",s.realPath(e),i);let a=[s.realPath(e),i].join("/");try{t.unlink(a)}catch{}},rmdir(e,i){n?.("rmdir",s.realPath(e),i);let a=[s.realPath(e),i].join("/");return s.tryFSOperation(()=>{t.rmdir(a)})},readdir(e){n?.("readdir",s.realPath(e));let i=s.realPath(e);return s.tryFSOperation(()=>t.readdir(i))},symlink(e,t,a){throw n?.("symlink",s.realPath(e),t,a),new i.ErrnoError(63)},readlink(e){throw n?.("readlink",s.realPath(e)),new i.ErrnoError(63)}},stream_ops:{open(e){n?.("open stream",s.realPath(e.node));let a=s.realPath(e.node);return s.tryFSOperation(()=>{i.isFile(e.node.mode)&&(e.shared.refcount=1,e.nfd=t.open(a))})},close:e=>(n?.("close stream",s.realPath(e.node)),s.tryFSOperation(()=>{i.isFile(e.node.mode)&&e.nfd&&0==--e.shared.refcount&&t.close(e.nfd)})),dup(e){n?.("dup stream",s.realPath(e.node)),e.shared.refcount++},read:(e,i,a,l,o)=>(n?.("read stream",s.realPath(e.node),a,l,o),0===l?0:s.tryFSOperation(()=>t.read(e.nfd,i,a,l,o))),write:(e,i,a,l,o)=>(n?.("write stream",s.realPath(e.node),a,l,o),s.tryFSOperation(()=>t.write(e.nfd,i.buffer,a,l,o))),llseek(e,a,l){n?.("llseek stream",s.realPath(e.node),a,l);let o=a;if(1===l?o+=e.position:2===l&&i.isFile(e.node.mode)&&s.tryFSOperation(()=>{let i=t.fstat(e.nfd);o+=i.size}),o<0)throw new i.ErrnoError(28);return o},mmap(t,a,l,o,u){if(n?.("mmap stream",s.realPath(t.node),a,l,o,u),!i.isFile(t.no
1de.mode))throw new i.ErrnoError(k.ENODEV);let c=e.mmapAlloc(a);return s.stream_ops.read(t,e.HEAP8,c,a,l),{ptr:c,allocated:!0}},msync:(e,t,i,a,l)=>(n?.("msync stream",s.realPath(e.node),i,a,l),s.stream_ops.write(e,t,0,a,i),0)}};return s}},13432:(e,t,i)=>{"use strict";i.d(t,{DZ:()=>v,I$:()=>function e(t,i,n,l,o=e=>e){let u={};for(let[h,d]of l.entries())if(d.isJson){let s=i.relations[d.tsKey],l=n[h],c="string"==typeof l?JSON.parse(l):l;u[d.tsKey]=(0,a.is)(s,f)?c&&e(t,t[d.relationTableTsKey],c,d.selection,o):c.map(i=>e(t,t[d.relationTableTsKey],i,d.selection,o))}else{let e;let t=o(n[h]),i=d.field;e=(0,a.is)(i,s.V)?i:(0,a.is)(i,c.Xs)?i.decoder:i.sql.decoder,u[d.tsKey]=null===t?null:e.mapFromDriverValue(t)}return u},K1:()=>b,W0:()=>w,_k:()=>y,iv:()=>p,mm:()=>g,pD:()=>f,rl:()=>m});var n=i(4805),s=i(80269),a=i(6996),l=i(59882),o=i(55208),u=i(44778),c=i(51320);class h{constructor(e,t,i){this.sourceTable=e,this.referencedTable=t,this.relationName=i,this.referencedTableName=t[n.XI.Symbol.Name]}static [a.i]="Relation";referencedTableName;fieldName}class d{constructor(e,t){this.table=e,this.config=t}static [a.i]="Relations"}class f extends h{constructor(e,t,i,n){super(e,t,i?.relationName),this.config=i,this.isNullable=n}static [a.i]="One";withFieldName(e){let t=new f(this.sourceTable,this.referencedTable,this.config,this.isNullable);return t.fieldName=e,t}}class p extends h{constructor(e,t,i){super(e,t,i?.relationName),this.config=i}static [a.i]="Many";withFieldName(e){let t=new p(this.sourceTable,this.referencedTable,this.config);return t.fieldName=e,t}}function g(){return{and:o.Uo,between:o.Tq,eq:o.eq,exists:o.t2,gt:o.gt,gte:o.RO,ilike:o.B3,inArray:o.RV,isNull:o.kZ,isNotNull:o.Pe,like:o.mj,lt:o.lt,lte:o.wJ,ne:o.ne,not:o.AU,notBetween:o.o8,notExists:o.KJ,notLike:o.RK,notIlike:o.q1,notInArray:o.KL,or:o.or,sql:c.ll}}function m(){return{sql:c.ll,asc:u.Y,desc:u.i}}function y(e,t){1===Object.keys(e).length&&"default"in e&&!(0,a.is)(e.default,n.XI)&&(e=e.default);let i={},s={},o={};for(let[u,c]of Object.entries(e))if((0,a.is)(c,n.XI)){let e=(0,n.Lf)(c),t=s[e];for(let s of(i[e]=u,o[u]={tsName:u,dbName:c[n.XI.Symbol.Name],schema:c[n.XI.Symbol.Schema],columns:c[n.XI.Symbol.Columns],relations:t?.relations??{},primaryKey:t?.primaryKey??[]},Object.values(c[n.XI.Symbol.Columns])))s.primary&&o[u].primaryKey.push(s);let h=c[n.XI.Symbol.ExtraConfigBuilder]?.(c[n.XI.Symbol.ExtraConfigColumns]);if(h)for(let e of Object.values(h))(0,a.is)(e,l.hv)&&o[u].primaryKey.push(...e.columns)}else if((0,a.is)(c,d)){let e;let a=(0,n.Lf)(c.table),l=i[a];for(let[i,n]of Object.entries(c.config(t(c.table))))if(l){let t=o[l];t.relations[i]=n,e&&t.primaryKey.push(...e)}else a in s||(s[a]={relations:{},primaryKey:e}),s[a].relations[i]=n}return{tables:o,tableNamesMap:i}}function b(e,t){return new d(e,e=>Object.fromEntries(Object.entries(t(e)).map(([e,t])=>[e,t.withFieldName(e)])))}function w(e,t,i){if((0,a.is)(i,f)&&i.config)return{fields:i.config.fields,references:i.config.references};let s=t[(0,n.Lf)(i.referencedTable)];if(!s)throw Error(`Table "${i.referencedTable[n.XI.Symbol.Name]}" not found in schema`);let l=e[s];if(!l)throw Error(`Table "${s}" not found in schema`);let o=i.sourceTable,u=t[(0,n.Lf)(o)];if(!u)throw Error(`Table "${o[n.XI.Symbol.Name]}" not found in schema`);let c=[];for(let e of Object.values(l.relations))(i.relationName&&i!==e&&e.relationName===i.relationName||!i.relationName&&e.referencedTable===i.sourceTable)&&c.push(e);if(c.length>1)throw i.relationName?Error(`There are multiple relations with name "${i.relationName}" in table "${s}"`):Error(`There are multiple relations between "${s}" and "${i.sourceTable[n.XI.Symbol.Name]}". Please specify relation name`);if(c[0]&&(0,a.is)(c[0],f)&&c[0].config)return{fields:c[0].config.references,references:c[0].config.fields};throw Error(`There is not enough information to infer relation "${u}.${i.fieldName}"`)}function v(e){return{one:function(t,i){return new f(e,t,i,i?.fields.reduce((e,t)=>e&&t.notNull,!0)??!1)},many:function(t,i){return new p(e,t,i)}}}},14145:(e,t,i)=>{"use strict";i.d(t,{KM:()=>u,vE:()=>d,xQ:()=>h});var n=i(6996),s=i(44848),a=i(21137),l=i(90706);class o extends l.u{static [n.i]="PgTimestampBuilder";constructor(e,t,i){super(e,"date","PgTimestamp"),this.config.withTimezone=t,this.config.precision=i}build(e){return new u(e,this.config)}}class u extends a.Kl{static [n.i]="PgTimestamp";withTimezone;precision;constructor(e,t){super(e,t),this.withTimezone=t.withTimezone,this.precision=t.precision}getSQLType(){let e=void 0===this.precision?"":` (${this.precision})`;return`timestamp${e}
1${this.withTimezone?" with time zone":""}`}mapFromDriverValue=e=>new Date(this.withTimezone?e:e+"+0000");mapToDriverValue=e=>e.toISOString()}class c extends l.u{static [n.i]="PgTimestampStringBuilder";constructor(e,t,i){super(e,"string","PgTimestampString"),this.config.withTimezone=t,this.config.precision=i}build(e){return new h(e,this.config)}}class h extends a.Kl{static [n.i]="PgTimestampString";withTimezone;precision;constructor(e,t){super(e,t),this.withTimezone=t.withTimezone,this.precision=t.precision}getSQLType(){let e=void 0===this.precision?"":`(${this.precision})`;return`timestamp${e}${this.withTimezone?" with time zone":""}`}}function d(e,t={}){let{name:i,config:n}=(0,s.Ll)(e,t);return n?.mode==="string"?new c(i,n.withTimezone??!1,n.precision):new o(i,n?.withTimezone??!1,n?.precision)}},16739:(e,t,i)=>{"use strict";i.d(t,{Q:()=>s});var n=i(6996);class s{static [n.i]="ColumnBuilder";config;constructor(e,t,i){this.config={name:e,keyAsName:""===e,notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:t,columnType:i,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(e){return this.config.default=e,this.config.hasDefault=!0,this}$defaultFn(e){return this.config.defaultFn=e,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(e){return this.config.onUpdateFn=e,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(e){""===this.config.name&&(this.config.name=e)}}},17953:(e,t,i)=>{"use strict";i.d(t,{VV:()=>n});class n{constructor(){this._dataLength=0,this._bufferLength=0,this._state=new Int32Array(4),this._buffer=new ArrayBuffer(68),this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashStr(e,t=!1){return this.onePassHasher.start().appendStr(e).end(t)}static hashAsciiStr(e,t=!1){return this.onePassHasher.start().appendAsciiStr(e).end(t)}static _hex(e){let t,i,s,a;let l=n.hexChars,o=n.hexOut;for(a=0;a<4;a+=1)for(s=0,i=8*a,t=e[a];s<8;s+=2)o[i+1+s]=l.charAt(15&t),t>>>=4,o[i+0+s]=l.charAt(15&t),t>>>=4;return o.join("")}static _md5cycle(e,t){let i=e[0],n=e[1],s=e[2],a=e[3];i+=(n&s|~n&a)+t[0]-0x28955b88|0,a+=((i=(i<<7|i>>>25)+n|0)&n|~i&s)+t[1]-0x173848aa|0,s+=((a=(a<<12|a>>>20)+i|0)&i|~a&n)+t[2]+0x242070db|0,n+=((s=(s<<17|s>>>15)+a|0)&a|~s&i)+t[3]-0x3e423112|0,i+=((n=(n<<22|n>>>10)+s|0)&s|~n&a)+t[4]-0xa83f051|0,a+=((i=(i<<7|i>>>25)+n|0)&n|~i&s)+t[5]+0x4787c62a|0,s+=((a=(a<<12|a>>>20)+i|0)&i|~a&n)+t[6]-0x57cfb9ed|0,n+=((s=(s<<17|s>>>15)+a|0)&a|~s&i)+t[7]-0x2b96aff|0,i+=((n=(n<<22|n>>>10)+s|0)&s|~n&a)+t[8]+0x698098d8|0,a+=((i=(i<<7|i>>>25)+n|0)&n|~i&s)+t[9]-0x74bb0851|0,s+=((a=(a<<12|a>>>
120)+i|0)&i|~a&n)+t[10]-42063|0,n+=((s=(s<<17|s>>>15)+a|0)&a|~s&i)+t[11]-0x76a32842|0,i+=((n=(n<<22|n>>>10)+s|0)&s|~n&a)+t[12]+0x6b901122|0,a+=((i=(i<<7|i>>>25)+n|0)&n|~i&s)+t[13]-0x2678e6d|0,s+=((a=(a<<12|a>>>20)+i|0)&i|~a&n)+t[14]-0x5986bc72|0,n+=((s=(s<<17|s>>>15)+a|0)&a|~s&i)+t[15]+0x49b40821|0,i+=((n=(n<<22|n>>>10)+s|0)&a|s&~a)+t[1]-0x9e1da9e|0,a+=((i=(i<<5|i>>>27)+n|0)&s|n&~s)+t[6]-0x3fbf4cc0|0,s+=((a=(a<<9|a>>>23)+i|0)&n|i&~n)+t[11]+0x265e5a51|0,n+=((s=(s<<14|s>>>18)+a|0)&i|a&~i)+t[0]-0x16493856|0,i+=((n=(n<<20|n>>>12)+s|0)&a|s&~a)+t[5]-0x29d0efa3|0,a+=((i=(i<<5|i>>>27)+n|0)&s|n&~s)+t[10]+0x2441453|0,s+=((a=(a<<9|a>>>23)+i|0)&n|i&~n)+t[15]-0x275e197f|0,n+=((s=(s<<14|s>>>18)+a|0)&i|a&~i)+t[4]-0x182c0438|0,i+=((n=(n<<20|n>>>12)+s|0)&a|s&~a)+t[9]+0x21e1cde6|0,a+=((i=(i<<5|i>>>27)+n|0)&s|n&~s)+t[14]-0x3cc8f82a|0,s+=((a=(a<<9|a>>>23)+i|0)&n|i&~n)+t[3]-0xb2af279|0,n+=((s=(s<<14|s>>>18)+a|0)&i|a&~i)+t[8]+0x455a14ed|0,i+=((n=(n<<20|n>>>12)+s|0)&a|s&~a)+t[13]-0x561c16fb|0,a+=((i=(i<<5|i>>>27)+n|0)&s|n&~s)+t[2]-0x3105c08|0,s+=((a=(a<<9|a>>>23)+i|0)&n|i&~n)+t[7]+0x676f02d9|0,n+=((s=(s<<14|s>>>18)+a|0)&i|a&~i)+t[12]-0x72d5b376|0,i+=((n=(n<<20|n>>>12)+s|0)^s^a)+t[5]-378558|0,a+=((i=(i<<4|i>>>28)+n|0)^n^s)+t[8]-0x788e097f|0,s+=((a=(a<<11|a>>>21)+i|0)^i^n)+t[11]+0x6d9d6122|0,n+=((s=(s<<16|s>>>16)+a|0)^a^i)+t[14]-0x21ac7f4|0,i+=((n=(n<<23|n>>>9)+s|0)^s^a)+t[1]-0x5b4115bc|0,a+=((i=(i<<4|i>>>28)+n|0)^n^s)+t[4]+0x4bdecfa9|0,s+=((a=(a<<11|a>>>21)+i|0)^i^n)+t[7]-0x944b4a0|0,n+=((s=(s<<16|s>>>16)+a|0)^a^i)+t[10]-0x41404390|0,i+=((n=(n<<23|n>>>9)+s|0)^s^a)+t[13]+0x289b7ec6|0,a+=((i=(i<<4|i>>>28)+n|0)^n^s)+t[0]-0x155ed806|0,s+=((a=(a<<11|a>>>21)+i|0)^i^n)+t[3]-0x2b10cf7b|0,n+=((s=(s<<16|s>>>16)+a|0)^a^i)+t[6]+0x4881d05|0,i+=((n=(n<<23|n>>>9)+s|0)^s^a)+t[9]-0x262b2fc7|0,a+=((i=(i<<4|i>>>28)+n|0)^n^s)+t[12]-0x1924661b|0,s+=((a=(a<<11|a>>>21)+i|0)^i^n)+t[15]+0x1fa27cf8|0,n+=((s=(s<<16|s>>>16)+a|0)^a^i)+t[2]-0x3b53a99b|0,n=(n<<23|n>>>9)+s|0,i+=(s^(n|~a))+t[0]-0xbd6ddbc|0,i=(i<<6|i>>>26)+n|0,a+=(n^(i|~s))+t[7]+0x432aff97|0,a=(a<<10|a>>>22)+i|0,s+=(i^(a|~n))+t[14]-0x546bdc59|0,s=(s<<15|s>>>17)+a|0,n+=(a^(s|~i))+t[5]-0x36c5fc7|0,n=(n<<21|n>>>11)+s|0,i+=(s^(n|~a))+t[12]+0x655b59c3|0,i=(i<<6|i>>>26)+n|0,a+=(n^(i|~s))+t[3]-0x70f3336e|0,a=(a<<10|a>>>22)+i|0,s+=(i^(a|~n))+t[10]-1051523|0,s=(s<<15|s>>>17)+a|0,n+=(a^(s|~i))+t[1]-0x7a7ba22f|0,n=(n<<21|n>>>11)+s|0,i+=(s^(n|~a))+t[8]+0x6fa87e4f|0,i=(i<<6|i>>>26)+n|0,a+=(n^(i|~s))+t[15]-0x1d31920|0,a=(a<<10|a>>>22)+i|0,s+=(i^(a|~n))+t[6]-0x5cfebcec|0,s=(s<<15|s>>>17)+a|0,n+=(a^(s|~i))+t[13]+0x4e0811a1|0,n=(n<<21|n>>>11)+s|0,i+=(s^(n|~a))+t[4]-0x8ac817e|0,i=(i<<6|i>>>26)+n|0,a+=(n^(i|~s))+t[11]-0x42c50dcb|0,a=(a<<10|a>>>22)+i|0,s+=(i^(a|~n))+t[2]+0x2ad7d2bb|0,s=(s<<15|s>>>17)+a|0,n+=(a^(s|~i))+t[9]-0x14792c6f|0,n=(n<<21|n>>>11)+s|0,e[0]=i+e[0]|0,e[1]=n+e[1]|0,e[2]=s+e[2]|0,e[3]=a+e[3]|0}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(n.stateIdentity),this}appendStr(e){let t,i;let s=this._buffer8,a=this._buffer32,l=this._bufferLength;for(i=0;i<e.length;i+=1){if((t=e.charCodeAt(i))<128)s[l++]=t;else if(t<2048)s[l++]=(t>>>6)+192,s[l++]=63&t|128;else if(t<55296||t>56319)s[l++]=(t>>>12)+224,s[l++]=t>>>6&63|128,s[l++]=63&t|128;else{if((t=(t-55296)*1024+(e.charCodeAt(++i)-56320)+65536)>1114111)throw Error("Unicode standard supports code points up to U+10FFFF");s[l++]=(t>>>18)+240,s[l++]=t>>>12&63|128,s[l++]=t>>>6&63|128,s[l++]=63&t|128}l>=64&&(this._dataLength+=64,n._md5cycle(this._state,a),l-=64,a[0]=a[16])}return this._bufferLength=l,this}appendAsciiStr(e){let t;let i=this._buffer8,s=this._buffer32,a=this._bufferLength,l=0;for(;;){for(t=Math.min(e.length-l,64-a);t--;)i[a++]=e.charCodeAt(l++);if(a<64)break;this._dataLength+=64,n._md5cycle(this._state,s),a=0}return this._bufferLength=a,this}appendByteArray(e){let t;let i=this._buffer8,s=this._buffer32,a=this._bufferLength,l=0;for(;;){for(t=Math.min(e.length-l,64-a);t--;)i[a++]=e[l++];if(a<64)break;this._dataLength+=64,n._md5cycle(this._state,s),a=0}return this._bufferLength=a,this}getState(){let e=this._state;return{buffer:String.fromCharCode.apply(null,Array.from(this._buffer8)),buflen:this._bufferLength,length:this._dataLength,state:[e[0],e[1],e[2],e[3]]}}setState(e){let t;let i=e.buffer,n=e.state,s=this._state;for(t=0,this._dataLength=e.length,this._bufferLength=e.buflen,s[0]=n[0],s[1]=n[1],s[2]=n[2],s[3]=n[3];t<i.length;t+=1)this._buffer8[t]=i.charCodeAt(t)}end(e=!1){let t=this._bufferLength,i=this._buffer8,s=this._buffer32,a=(t>>2)+1;this._dataLength+=t;let l=8*this._dataLength;if(i[t]=128,i[t+1]=i[t+2]=i[t+3]=0,s.set(n.buffer32Identity.subarray(a),a),t>55&&(n._md5cycle(this._state,s),s.set(n.buffer32Identity)),l<=0xffffffff)s[14]=l;else{let e=l.toString(16).match(/(.*?)(.{0,8})$/);if(null===e)return;let t=parseInt(e[2],16),i=parseInt(e[1],16)||0;s[14]=t,s[15]=i}return n._md5cycle(this._state,s),e?this._state:n._hex(this._state)}}if(n.stateIdentity=new Int32Array([0x67452301,-0x10325477,-0x67452302,0x10325476]),n.buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),n.hexChars="0123456789abcdef",n.hexOut=[],n.onePassHasher=new n,"5d41402abc4b2a76b9719d911017c592"!==n.hashStr("hello"))throw Error("Md5 self test failed.")},20319:(e,t,i)=>{"use strict";i.d(t,{generate:()=>u});var n=i(60270),s=i.n(n);let a=["ability","able","aboard","about","above","accept","accident","according","account","accurate","acres","across","act","action","active","activity","actual","actually","add","addition","additional","adjective","adult","adventure","advice","affect","afraid","after","afternoon","again","against","age","ago","agree","a
1head","aid","air","airplane","alike","alive","all","allow","almost","alone","along","aloud","alphabet","already","also","although","am","among","amount","ancient","angle","angry","animal","announced","another","answer","ants","any","anybody","anyone","anything","anyway","anywhere","apart","apartment","appearance","apple","applied","appropriate","are","area","arm","army","around","arrange","arrangement","arrive","arrow","art","article","as","aside","ask","asleep","at","ate","atmosphere","atom","atomic","attached","attack","attempt","attention","audience","author","automobile","available","average","avoid","aware","away","baby","back","bad","badly","bag","balance","ball","balloon","band","bank","bar","bare","bark","barn","base","baseball","basic","basis","basket","bat","battle","be","bean","bear","beat","beautiful","beauty","became","because","become","becoming","bee","been","before","began","beginning","begun","behavior","behind","being","believed","bell","belong","below","belt","bend","beneath","bent","beside","best","bet","better","between","beyond","bicycle","bigger","biggest","bill","birds","birth","birthday","bit","bite","black","blank","blanket","blew","blind","block","blood","blow","blue","board","boat","body","bone","book","border","born","both","bottle","bottom","bound","bow","bowl","box","boy","brain","branch","brass","brave","bread","break","breakfast","breath","breathe","breathing","breeze","brick","bridge","brief","bright","bring","broad","broke","broken","brother","brought","brown","brush","buffalo","build","building","built","buried","burn","burst","bus","bush","business","busy","but","butter","buy","by","cabin","cage","cake","call","calm","came","camera","camp","can","canal","cannot","cap","capital","captain","captured","car","carbon","card","care","careful","carefully","carried","carry","case","cast","castle","cat","catch","cattle","caught","cause","cave","cell","cent","center","central","century","certain","certainly","chain","chair","chamber","chance","change","changing","chapter","character","characteristic","charge","chart","check","cheese","chemical","chest","chicken","chief","child","children","choice","choose","chose","chosen","church","circle","circus","citizen","city","class","classroom","claws","clay","clean","clear","clearly","climate","climb","clock","close","closely","closer","cloth","clothes","clothing","cloud","club","coach","coal","coast","coat","coffee","cold","collect","college","colony","color","column","combination","combine","come","comfortable","coming","command","common","community","company","compare","compass","complete","completely","complex","composed","composition","compound","concerned","condition","congress","connected","consider","consist","consonant","constantly","construction","contain","continent","continued","contrast","control","conversation","cook","cookies","cool","copper","copy","corn","corner","correct","correctly","cost","cotton","could","count","country","couple","courage","course","court","cover","cow","cowboy","crack","cream","create","creature","crew","crop","cross","crowd","cry","cup","curious","current","curve","customs","cut","cutting","daily","damage","dance","danger","dangerous","dark","darkness","date","daughter","dawn","day","dead","deal","dear","death","decide","declared","deep","deeply","deer","definition","degree","depend","depth","describe","desert","design","desk","detail","determine","develop","development","diagram","diameter","did","die","differ","difference","different","difficult","difficulty","dig","dinner","direct","direction","directly","dirt","dirty","disappear","discover","discovery","discuss","discussion","disease","dish","distance","distant","divide","division","do","doctor","does","dog","doing","doll","dollar","done","donkey","door","dot","double","doubt","down","dozen","draw","drawn","dream","dress","drew","dried","drink","drive","driven","driver","driving","drop","dropped","drove","dry","duck","due","dug","dull","during","dust","duty","each","eager","ear","earlier","early","earn","earth","easier","easily","east","easy","eat","eaten","edge","education","effect","effort","egg","eight","either","electric","electricity","element","elephant","eleven","else","empty","end","enemy","energy","engine","engineer","enjoy","enough","enter","entire","entirely","environment","equal","equally","equator","equipment","escape","especially","essential","establish","even","evening","event","eventually","ever","every","everybody","everyone","everything","everywhere","evidence","exact","exactly","examine","example","excellent","except","exchange","excited","excitement","exciting","exclaimed","exercise","exist","expect","experience","experiment","explain","explanation","explore","express","expression","extra","eye","face","facing","fact","factor","factory","failed","fair","fairly","fall","fallen","familiar","family","famous","far","farm","farmer","farther","fast","fastened","faster","fat","father","favorite","fear","feathers","feature","fed","feed","feel","feet","fell","fellow","felt","fence","few","fewer","field","fierce","fifteen","fifth","fifty","fight","fighting","figure","fill","film","final","finally","find","fine","finest","finger","finish","fire","fireplace","firm","first","fish","five","fix","flag","flame","flat","flew","flies","flight","floating","floor","flow","flower","fly","fog","folks","follow","food","foot","football","for","force","foreign","forest","forget","forgot","forgotten","form","former","fort","forth","forty","forward","fought","found","four","fourth","fox","frame","free","freedom","frequently","fresh","friend","friendly","frighten","frog","from","front","frozen","fruit","fuel","full","fully","fun","function","funny","fur","furniture","further","future","gain","game","garage","garden","gas","gasoline","gate","gather","gave","general","generally","gentle","gently","get","getting","giant","gift","girl","give","given","giving","glad","glass","globe","go","goes","gold","golden","gone","good","goose","got","government","grabbed","grade","gradually","grain","grandfather","grandmother","graph","grass","gravity","gray","great","greater","greatest","greatly","green","grew","ground","group","grow","grown","growth","guard","guess","guide","gulf","gun","habit","had","hair","half","halfway","hall","hand","handle","handsome","hang","happen","happened","happily","happy","harbor","hard","harder","hardly","has","hat","have","having","hay","he","headed","heading","health","heard","hearing","heart","heat","heavy","height","held","hello","help","helpful","her","herd","here","herself","hidden","hide","high","higher","highest","highway","hill","him","himself","his","history","hit","hold","hole","hollow","home","honor","hope","horn","horse","hospital","hot","hour","house","how","however","huge","human","hundred","hung","hungry","hunt","hunter","hurried","hurry","hurt","husband","ice","idea","identity","if","ill","image","imagine","immediately","importance","important","impossible","improve","in","inch","include","including","income","increase","indeed","independent","
1indicate","individual","industrial","industry","influence","information","inside","instance","instant","instead","instrument","interest","interior","into","introduced","invented","involved","iron","is","island","it","its","itself","jack","jar","jet","job","join","joined","journey","joy","judge","jump","jungle","just","keep","kept","key","kids","kill","kind","kitchen","knew","knife","know","knowledge","known","label","labor","lack","lady","laid","lake","lamp","land","language","large","larger","largest","last","late","later","laugh","law","lay","layers","lead","leader","leaf","learn","least","leather","leave","leaving","led","left","leg","length","lesson","let","letter","level","library","lie","life","lift","light","like","likely","limited","line","lion","lips","liquid","list","listen","little","live","living","load","local","locate","location","log","lonely","long","longer","look","loose","lose","loss","lost","lot","loud","love","lovely","low","lower","luck","lucky","lunch","lungs","lying","machine","machinery","mad","made","magic","magnet","mail","main","mainly","major","make","making","man","managed","manner","manufacturing","many","map","mark","market","married","mass","massage","master","material","mathematics","matter","may","maybe","me","meal","mean","means","meant","measure","meat","medicine","meet","melted","member","memory","men","mental","merely","met","metal","method","mice","middle","might","mighty","mile","military","milk","mill","mind","mine","minerals","minute","mirror","missing","mission","mistake","mix","mixture","model","modern","molecular","moment","money","monkey","month","mood","moon","more","morning","most","mostly","mother","motion","motor","mountain","mouse","mouth","move","movement","movie","moving","mud","muscle","music","musical","must","my","myself","mysterious","nails","name","nation","national","native","natural","naturally","nature","near","nearby","nearer","nearest","nearly","necessary","neck","needed","needle","needs","negative","neighbor","neighborhood","nervous","nest","never","new","news","newspaper","next","nice","night","nine","no","nobody","nodded","noise","none","noon","nor","north","nose","not","note","noted","nothing","notice","noun","now","number","numeral","nuts","object","observe","obtain","occasionally","occur","ocean","of","off","offer","office","officer","official","oil","old","older","oldest","on","once","one","only","onto","open","operation","opinion","opportunity","opposite","or","orange","orbit","order","ordinary","organization","organized","origin","original","other","ought","our","ourselves","out","outer","outline","outside","over","own","owner","oxygen","pack","package","page","paid","pain","paint","pair","palace","pale","pan","paper","paragraph","parallel","parent","park","part","particles","particular","particularly","partly","parts","party","pass","passage","past","path","pattern","pay","peace","pen","pencil","people","per","percent","perfect","perfectly","perhaps","period","person","personal","pet","phrase","physical","piano","pick","picture","pictured","pie","piece","pig","pile","pilot","pine","pink","pipe","pitch","place","plain","plan","plane","planet","planned","planning","plant","plastic","plate","plates","play","pleasant","please","pleasure","plenty","plural","plus","pocket","poem","poet","poetry","point","pole","police","policeman","political","pond","pony","pool","poor","popular","population","porch","port","position","positive","possible","possibly","post","pot","potatoes","pound","pour","powder","power","powerful","practical","practice","prepare","present","president","press","pressure","pretty","prevent","previous","price","pride","primitive","principal","principle","printed","private","prize","probably","problem","process","produce","product","production","program","progress","promised","proper","properly","property","protection","proud","prove","provide","public","pull","pupil","pure","purple","purpose","push","put","putting","quarter","queen","question","quick","quickly","quiet","quietly","quite","rabbit","race","radio","railroad","rain","raise","ran","ranch","range","rapidly","rate","rather","raw","rays","reach","read","reader","ready","real","realize","rear","reason","recall","receive","recent","recently","recognize","record","red","refer","refused","region","regular","related","relationship","religious","remain","remarkable","remember","remove","repeat","replace","replied","report","represent","require","research","respect","rest","result","return","review","rhyme","rhythm","rice","ric
1h","ride","riding","right","ring","rise","rising","river","road","roar","rock","rocket","rocky","rod","roll","roof","room","root","rope","rose","rough","round","route","row","rubbed","rubber","rule","ruler","run","running","rush","sad","saddle","safe","safety","said","sail","sale","salmon","salt","same","sand","sang","sat","satellites","satisfied","save","saved","saw","say","scale","scared","scene","school","science","scientific","scientist","score","screen","sea","search","season","seat","second","secret","section","see","seed","seeing","seems","seen","seldom","select","selection","sell","send","sense","sent","sentence","separate","series","serious","serve","service","sets","setting","settle","settlers","seven","several","shade","shadow","shake","shaking","shall","shallow","shape","share","sharp","she","sheep","sheet","shelf","shells","shelter","shine","shinning","ship","shirt","shoe","shoot","shop","shore","short","shorter","shot","should","shoulder","shout","show","shown","shut","sick","sides","sight","sign","signal","silence","silent","silk","silly","silver","similar","simple","simplest","simply","since","sing","single","sink","sister","sit","sitting","situation","six","size","skill","skin","sky","slabs","slave","sleep","slept","slide","slight","slightly","slip","slipped","slope","slow","slowly","small","smaller","smallest","smell","smile","smoke","smooth","snake","snow","so","soap","social","society","soft","softly","soil","solar","sold","soldier","solid","solution","solve","some","somebody","somehow","someone","something","sometime","somewhere","son","song","soon","sort","sound","source","south","southern","space","speak","special","species","specific","speech","speed","spell","spend","spent","spider","spin","spirit","spite","split","spoken","sport","spread","spring","square","stage","stairs","stand","standard","star","stared","start","state","statement","station","stay","steady","steam","steel","steep","stems","step","stepped","stick","stiff","still","stock","stomach","stone","stood","stop","stopped","store","storm","story","stove","straight","strange","stranger","straw","stream","street","strength","stretch","strike","string","strip","strong","stronger","struck","structure","struggle","stuck","student","studied","studying","subject","substance","success","successful","such","sudden","suddenly","sugar","suggest","suit","sum","summer","sun","sunlight","supper","supply","support","suppose","sure","surface","surprise","surrounded","swam","sweet","swept","swim","swimming","swing","swung","syllable","symbol","system","table","tail","take","taken","tales","talk","tall","tank","tape","task","taste","taught","tax","tea","teach","teacher","team","tears","teeth","telephone","television","tell","temperature","ten","tent","term","terrible","test","than","thank","that","thee","them","themselves","then","theory","there","therefore","these","they","thick","thin","thing","think","third","thirty","this","those","thou","though","thought","thousand","thread","three","threw","throat","through","throughout","throw","thrown","thumb","thus","thy","tide","tie","tight","tightly","till","time","tin","tiny","tip","tired","title","to","tobacco","today","together","told","tomorrow","tone","tongue","tonight","too","took","tool","top","topic","torn","total","touch","toward","tower","town","toy","trace","track","trade","traffic","trail","train","transportation","trap","travel","treated","tree","triangle","tribe","trick","tried","trip","troops","tropical","trouble","truck","trunk","truth","try","tube","tune","turn","twelve","twenty","twice","two","type","typical","uncle","under","underline","understanding","unhappy","union","unit","universe","unknown","unless","until","unusual","up","upon","upper","upward","us","use","useful","using","usual","usually","valley","valuable","value","vapor","variety","various","vast","vegetable","verb","vertical","very","vessels","victory","view","village","visit","visitor","voice","volume","vote","vowel","voyage","wagon","wait","walk","wall","want","war","warm","warn","was","wash","waste","watch","water","wave","way","we","weak","wealth","wear","weather","week","weigh","weight","welcome","well","went","were","west","western","wet","whale","what","whatever","wheat","wheel","when","whenever","where","wherever","whether","which","while","whispered","whistle","white","who","whole","whom","whose","why","wide","widely","wife","wild","will","willing","win","wind","window","wing","winter","wire","wise","wish","with","within","without","wolf","women","won","wonder","wonderful","wood","wooden","wool","word","wore","work","worker","world","worried","worry","worse","worth","would","wrapped","write","writer","writing","written","wrong","wrote","yard","year","yellow","yes","yesterday","yet","you","young","younger","your","yourself","youth","zero","zebra","zipper","zoo","zulu"],l=a.reduce((e,t)=>
1t.length<e.length?t:e).length,o=a.reduce((e,t)=>t.length>e.length?t:e).length;function u(e){let t=e?.seed?new(s())(e.seed):null,{minLength:i,maxLength:n,...u}=e||{};function c(){let e,t="number"!=typeof i?l:h(i),s="number"!=typeof n?o:h(n);t>s&&(t=s);let u=!1;for(;!u;)u=(e=a[d(a.length)]).length<=s&&e.length>=t;return e}function h(e){return e<l&&(e=l),e>o&&(e=o),e}function d(e){return Math.floor((t?t():Math.random())*e)}if(void 0===e)return c();if("number"==typeof e)e={exactly:e};else if(0===Object.keys(u).length)return c();e.exactly&&(e.min=e.exactly,e.max=e.exactly),"number"!=typeof e.wordsPerString&&(e.wordsPerString=1),"function"!=typeof e.formatter&&(e.formatter=e=>e),"string"!=typeof e.separator&&(e.separator=" ");let f=e.min+d(e.max+1-e.min),p=[],g="",m=0;for(let t=0;t<f*e.wordsPerString;t++)m===e.wordsPerString-1?g+=e.formatter(c(),m):g+=e.formatter(c(),m)+e.separator,m++,(t+1)%e.wordsPerString==0&&(p.push(g),g="",m=0);return"string"==typeof e.join&&(p=p.join(e.join)),p}},21137:(e,t,i)=>{"use strict";i.d(t,{ae:()=>m,Kl:()=>p,pe:()=>f});var n=i(16739),s=i(80269),a=i(6996),l=i(56970);class o{static [a.i]="PgForeignKeyBuilder";reference;_onUpdate="no action";_onDelete="no action";constructor(e,t){this.reference=()=>{let{name:t,columns:i,foreignColumns:n}=e();return{name:t,columns:i,foreignTable:n[0].table,foreignColumns:n}},t&&(this._onUpdate=t.onUpdate,this._onDelete=t.onDelete)}onUpdate(e){return this._onUpdate=void 0===e?"no action":e,this}onDelete(e){return this._onDelete=void 0===e?"no action":e,this}build(e){return new u(e,this)}}class u{constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}static [a.i]="PgForeignKey";reference;onUpdate;onDelete;getName(){let{name:e,columns:t,foreignColumns:i}=this.reference(),n=t.map(e=>e.name),s=i.map(e=>e.name),a=[this.table[l.E],...n,i[0].table[l.E],...s];return e??`${a.join("_")}_fk`}}var c=i(7307),h=i(98316);function d(e,t,i){for(let n=t;n<e.length;n++){let s=e[n];if("\\"===s){n++;continue}if('"'===s)return[e.slice(t,n).replace(/\\/g,""),n+1];if(!i&&(","===s||"}"===s))return[e.slice(t,n).replace(/\\/g,""),n]}return[e.slice(t).replace(/\\/g,""),e.length]}class f extends n.Q{foreignKeyConfigs=[];static [a.i]="PgColumnBuilder";array(e){return new y(this.config.name,this,e)}references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e,t){return this.config.isUnique=!0,this.config.uniqueName=e,this.config.uniqueType=t?.nulls,this}generatedAlwaysAs(e){return this.config.generated={as:e,type:"always",mode:"stored"},this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:i,actions:n})=>(0,c.i)((i,n)=>{let s=new o(()=>({columns:[e],foreignColumns:[i()]}));return n.onUpdate&&s.onUpdate(n.onUpdate),n.onDelete&&s.onDelete(n.onDelete),s.build(t)},i,n))}buildExtraConfigColumn(e){return new g(e,this.config)}}class p extends s.V{constructor(e,t){t.uniqueName||(t.uniqueName=(0,h.Wx)(e,[t.name])),super(e,t),this.table=e}static [a.i]="PgColumn"}class g extends p{static [a.i]="ExtraConfigColumn";getSQLType(){return this.getSQLType()}indexConfig={order:this.config.order??"asc",nulls:this.config.nulls??"last",opClass:this.config.opClass};defaultConfig={order:"asc",nulls:"last",opClass:void 0};asc(){return this.indexConfig.order="asc",this}desc(){return this.indexConfig.order="desc",this}nullsFirst(){return this.indexConfig.nulls="first",this}nullsLast(){return this.indexConfig.nulls="last",this}op(e){return this.indexConfig.opClass=e,this}}class m{static [a.i]="IndexedColumn";constructor(e,t,i,n){this.name=e,this.keyAsName=t,this.type=i,this.indexConfig=n}name;keyAsName;type;indexConfig}class y extends f{static [a.i]="PgArrayBuilder";constructor(e,t,i){super(e,"array","PgArray"),this.config.baseBuilder=t,this.config.size=i}build(e){let t=this.config.baseBuilder.build(e);return new b(e,this.config,t)}}class b extends p{constructor(e,t,i,n){super(e,t),this.baseColumn=i,this.range=n,this.size=t.size}size;static [a.i]="PgArray";getSQLType(){return`${this.baseColumn.getSQLType()}[${"number"==typeof this.size?this.size:""}]`}mapFromDriverValue(e){return"string"==typeof e&&(e=function(e){let[t]=function e(t,i=0){let n=[],s=i,a=!1;for(;s<t.length;){let l=t[s];if(","===l){(a||s===i)&&n.push(""),a=!0,s++;continue}if(a=!1,"\\"===l){s+=2;continue}if('"'===l){let[e,i]=d(t,s+1,!0);n.push(e),s=i;continue}if("}"===l)return[n,s+1];if("{"===l){let[i,a]=e(t,s+1);n.push(i),s=a;continue}let[o,u]=d(t,s,!1);n.push(o),s=u}return[n,s]}(e,1);return t}(e)),e.map(e=>this.baseColumn.mapFromDriverValue(e))}mapToDriverValue(e,t=!1){let i=e.map(e=>null===e?null:(0,a.is)(this.baseColumn,b)?this.baseColumn.mapToDriverValue(e,!0):this.baseColumn.mapToDriverValue(e));return t?i:function e(t){return`{${t.map(t=>Array.isArray(t)?e(t):"string"==typeof t?`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:`${t}`).join(",")}}`}(i)}}},23116:(e,t,i)=>{"use strict";i.d(t,{dL:()=>o,uR:()=>u});var n=i(6996),s=i(51320),a=i(21137);class l extends a.pe{static [n.i]="PgUUIDBuilder";constructor(e){super(e,"string","PgUUID")}defaultRandom(){return this.default((0,s.ll)`gen_random_uuid()`)}build(e){return new o(e,this.config)}}class o extends a.Kl{static [n.i]="PgUUID";getSQLType(){return"uuid"}}function u(e){return new l(e??"")}},23966:(e,t,i)=>{"use strict";i.d(t,{Z5:()=>o,sH:()=>u});var n=i(6996),s=i(44848),a=i(21137);class l extends a.pe{static [n.i]="PgNumericBuilder";constructor(e,t,i){super(e,"string","PgNumeric"),this.config.precision=t,this.config.scale=i}build(e){return new o(e,this.config)}}class o extends a.Kl{static [n.i]="PgNumeric";precision;scale;constructor(e,t){super(e,t),this.precision=t.precision,this.scale=t.scale}getSQLType(){return void 0!==this.precision&&void 0!==this.scale?`numeric(${this.precision}, ${this.scale})`:void 0===this.precision?"numeric":`numeric(${this.precision})`}}function u(e,t){let{name:i,config:n}=(0,s.Ll)(e,t);return new l(i,n?.precision,n?.scale)}},26011:(e,t,i)=>{"use strict";i.d(t,{dw:()=>h,p6:()=>d,qw:()=>u});var n=i(6996),s=i(44848),a=i(21137),l=i(90706);class o extends l.u{static [n.i]="PgDateBuilder";constructor(e){super(e,"date","PgDate")}build(e){return new u(e,this.config)}}class u extends a.Kl{static [n.i]="PgDate";
1getSQLType(){return"date"}mapFromDriverValue(e){return new Date(e)}mapToDriverValue(e){return e.toISOString()}}class c extends l.u{static [n.i]="PgDateStringBuilder";constructor(e){super(e,"string","PgDateString")}build(e){return new h(e,this.config)}}class h extends a.Kl{static [n.i]="PgDateString";getSQLType(){return"date"}}function d(e,t){let{name:i,config:n}=(0,s.Ll)(e,t);return n?.mode==="date"?new o(i):new c(i)}},26701:function(e,t,i){var n;!function(e,s,a){function l(e){var t,i=this,n=(t=0xefc8249d,function(e){e=String(e);for(var i=0;i<e.length;i++){var n=.02519603282416938*(t+=e.charCodeAt(i));t=n>>>0,n-=t,n*=t,t=n>>>0,n-=t,t+=0x100000000*n}return(t>>>0)*23283064365386963e-26});i.next=function(){var e=2091639*i.s0+23283064365386963e-26*i.c;return i.s0=i.s1,i.s1=i.s2,i.s2=e-(i.c=0|e)},i.c=1,i.s0=n(" "),i.s1=n(" "),i.s2=n(" "),i.s0-=n(e),i.s0<0&&(i.s0+=1),i.s1-=n(e),i.s1<0&&(i.s1+=1),i.s2-=n(e),i.s2<0&&(i.s2+=1)}function o(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function u(e,t){var i=new l(e),n=t&&t.state,s=i.next;return s.int32=function(){return 0x100000000*i.next()|0},s.double=function(){return s()+(2097152*s()|0)*11102230246251565e-32},s.quick=s,n&&("object"==typeof n&&o(n,i),s.state=function(){return o(i,{})}),s}s&&s.exports?s.exports=u:i.amdD&&i.amdO?void 0!==(n=(function(){return u}).call(t,i,t,s))&&(s.exports=n):this.alea=u}(0,e=i.nmd(e),i.amdD)},30433:(e,t,i)=>{"use strict";i.d(t,{J:()=>a,n:()=>s});var n=i(6996);class s{static [n.i]="Subquery";constructor(e,t,i,n=!1){this._={brand:"Subquery",sql:e,selectedFields:t,alias:i,isWith:n}}}class a extends s{static [n.i]="WithSubquery"}},33122:(e,t,i)=>{"use strict";i.d(t,{Xd:()=>u,kB:()=>c});var n=i(6996),s=i(44848),a=i(21137),l=i(90706);class o extends l.u{constructor(e,t,i){super(e,"string","PgTime"),this.withTimezone=t,this.precision=i,this.config.withTimezone=t,this.config.precision=i}static [n.i]="PgTimeBuilder";build(e){return new u(e,this.config)}}class u extends a.Kl{static [n.i]="PgTime";withTimezone;precision;constructor(e,t){super(e,t),this.withTimezone=t.withTimezone,this.precision=t.precision}getSQLType(){let e=void 0===this.precision?"":`(${this.precision})`;return`time${e}${this.withTimezone?" with time zone":""}`}}function c(e,t={}){let{name:i,config:n}=(0,s.Ll)(e,t);return new o(i,n.withTimezone??!1,n.precision)}},40068:(e,t,i)=>{"use strict";i.d(t,{Tp:()=>u,gH:()=>o});var n=i(6996),s=i(44848),a=i(21137);class l extends a.pe{static [n.i]="PgCharBuilder";constructor(e,t){super(e,"string","PgChar"),this.config.length=t.length,this.config.enumValues=t.enum}build(e){return new o(e,this.config)}}class o extends a.Kl{static [n.i]="PgChar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return void 0===this.length?"char":`char(${this.length})`}}function u(e,t={}){let{name:i,config:n}=(0,s.Ll)(e,t);return new l(i,n)}},42407:(e,t,i)=>{"use strict";i.d(t,{mu:()=>eF,cJ:()=>eQ});var n=i(6996),s=i(4805),a=i(44848),l=i(21137),o=i(84875);class u extends o.p{static [n.i]="PgBigInt53Builder";constructor(e){super(e,"number","PgBigInt53")}build(e){return new c(e,this.config)}}class c extends l.Kl{static [n.i]="PgBigInt53";getSQLType(){return"bigint"}mapFromDriverValue(e){return"number"==typeof e?e:Number(e)}}class h extends o.p{static [n.i]="PgBigInt64Builder";constructor(e){super(e,"bigint","PgBigInt64")}build(e){return new d(e,this.config)}}class d extends l.Kl{static [n.i]="PgBigInt64";getSQLType(){return"bigint"}mapFromDriverValue(e){return BigInt(e)}}function f(e,t){let{name:i,config:n}=(0,a.Ll)(e,t);return"number"===n.mode?new u(i):new h(i)}class p extends l.pe{static [n.i]="PgBigSerial53Builder";constructor(e){super(e,"number","PgBigSerial53"),this.config.hasDefault=!0,this.config.notNull=!0}build(e){return new g(e,this.config)}}class g extends l.Kl{static [n.i]="PgBigSerial53";getSQLType(){return"bigserial"}mapFromDriverValue(e){return"number"==typeof e?e:Number(e)}}class m extends l.pe{static [n.i]="PgBigSerial64Builder";constructor(e){super(e,"bigint","PgBigSerial64"),this.config.hasDefault=!0}build(e){return new y(e,this.config)}}
1class y extends l.Kl{static [n.i]="PgBigSerial64";getSQLType(){return"bigserial"}mapFromDriverValue(e){return BigInt(e)}}function b(e,t){let{name:i,config:n}=(0,a.Ll)(e,t);return"number"===n.mode?new p(i):new m(i)}var w=i(77653),v=i(40068);class S extends l.pe{static [n.i]="PgCidrBuilder";constructor(e){super(e,"string","PgCidr")}build(e){return new x(e,this.config)}}class x extends l.Kl{static [n.i]="PgCidr";getSQLType(){return"cidr"}}function T(e){return new S(e??"")}class P extends l.pe{static [n.i]="PgCustomColumnBuilder";constructor(e,t,i){super(e,"custom","PgCustomColumn"),this.config.fieldConfig=t,this.config.customTypeParams=i}build(e){return new N(e,this.config)}}class N extends l.Kl{static [n.i]="PgCustomColumn";sqlName;mapTo;mapFrom;constructor(e,t){super(e,t),this.sqlName=t.customTypeParams.dataType(t.fieldConfig),this.mapTo=t.customTypeParams.toDriver,this.mapFrom=t.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(e){return"function"==typeof this.mapFrom?this.mapFrom(e):e}mapToDriverValue(e){return"function"==typeof this.mapTo?this.mapTo(e):e}}function C(e){return(t,i)=>{let{name:n,config:s}=(0,a.Ll)(t,i);return new P(n,s,e)}}var k=i(26011);class A extends l.pe{static [n.i]="PgDoublePrecisionBuilder";constructor(e){super(e,"number","PgDoublePrecision")}build(e){return new I(e,this.config)}}class I extends l.Kl{static [n.i]="PgDoublePrecision";getSQLType(){return"double precision"}mapFromDriverValue(e){return"string"==typeof e?Number.parseFloat(e):e}}function D(e){return new A(e??"")}class $ extends l.pe{static [n.i]="PgInetBuilder";constructor(e){super(e,"string","PgInet")}build(e){return new L(e,this.config)}}class L extends l.Kl{static [n.i]="PgInet";getSQLType(){return"inet"}}function E(e){return new $(e??"")}var j=i(62207);class q extends l.pe{static [n.i]="PgIntervalBuilder";constructor(e,t){super(e,"string","PgInterval"),this.config.intervalConfig=t}build(e){return new O(e,this.config)}}class O extends l.Kl{static [n.i]="PgInterval";fields=this.config.intervalConfig.fields;precision=this.config.intervalConfig.precision;getSQLType(){let e=this.fields?` ${this.fields}`:"",t=this.precision?`(${this.precision})`:"";return`interval${e}${t}`}}function z(e,t={}){let{name:i,config:n}=(0,a.Ll)(e,t);return new q(i,n)}var _=i(45361),F=i(45169);class Q extends l.pe{static [n.i]="PgLineBuilder";constructor(e){super(e,"array","PgLine")}build(e){return new B(e,this.config)}}class B extends l.Kl{static [n.i]="PgLine";getSQLType(){return"line"}mapFromDriverValue(e){let[t,i,n]=e.slice(1,-1).split(",");return[Number.parseFloat(t),Number.parseFloat(i),Number.parseFloat(n)]}mapToDriverValue(e){return`{${e[0]},${e[1]},${e[2]}}`}}class M extends l.pe{static [n.i]="PgLineABCBuilder";constructor(e){super(e,"json","PgLineABC")}build(e){return new U(e,this.config)}}class U extends l.Kl{static [n.i]="PgLineABC";getSQLType(){return"line"}mapFromDriverValue(e){let[t,i,n]=e.slice(1,-1).split(",");return{a:Number.parseFloat(t),b:Number.parseFloat(i),c:Number.parseFloat(n)}}mapToDriverValue(e){return`{${e.a},${e.b},${e.c}}`}}function V(e,t){let{name:i,config:n}=(0,a.Ll)(e,t);return n?.mode&&"tuple"!==n.mode?new M(i):new Q(i)}class R extends l.pe{static [n.i]="PgMacaddrBuilder";constructor(e){super(e,"string","PgMacaddr")}build(e){return new X(e,this.config)}}class X extends l.Kl{static [n.i]="PgMacaddr";getSQLType(){return"macaddr"}}function K(e){return new R(e??"")}class J extends l.pe{static [n.i]="PgMacaddr8Builder";constructor(e){super(e,"string","PgMacaddr8")}build(e){return new W(e,this.config)}}class W extends l.Kl{static [n.i]="PgMacaddr8";getSQLType(){return"macaddr8"}}function G(e){return new J(e??"")}var H=i(23966);class Y extends l.pe{static [n.i]="PgPointTupleBuilder";constructor(e){super(e,"array","PgPointTuple")}build(e){return new Z(e,this.config)}}class Z extends l.Kl{static [n.i]="PgPointTuple";getSQLType(){return"point"}mapFromDriverValue(e){if("string"==typeof e){let[t,i]=e.slice(1,-1).split(",");return[Number.parseFloat(t),Number.parseFloat(i)]}return[e.x,e.y]}mapToDriverValue(e){return`(${e[0]},${e[1]})`}}class ee extends l.pe{static [n.i]="PgPointObjectBuilder";constructor(e){super(e,"json","PgPointObject")}build(e){return new et(e,this.config)}}class et extends l.Kl{static [n.i]="PgPointObject";getSQLType(){return"point"}mapFromDriverValue(e){if("string"==typeof e){let[t,i]=e.slice(1,-1).split(",");return{x:Number.parseFloat(t),y:Number.parseFloat(i)}}return e}mapToDriverValue(e){return`(${e.x},${e.y})`}}function ei(e,t){let{name:i,config:n}=(0,a.Ll)(e,t);return n?.mode&&"tuple"!==n.mode?new ee(i):new Y(i)}function er(e,t){let i=new DataView(new ArrayBuffer(8));for(let n=0;n<8;n++)i.setUint8(n,e[t+n]);return i.getFloat64(0,!0)}function en(e){let t=function(e){let t=[];for(let i=0;i<e.length;i+=2)t.push(Number.parseInt(e.slice(i,i+2),16));return new Uint8Array(t)}(e),i=0,n=t[0];i+=1;let s=new DataView(t.buffer),a=s.getUint32(i,1===n);if(i+=4,0x20000000&a&&(s.getUint32(i,1===n),i+=4),(65535&a)==1){let e=er(t,i),n=er(t,i+=8);return i+=8,[e,n]}throw Error("Unsupported geometry type")}class es extends l.pe{static [n.i]="PgGeometryBuilder";constructor(e){super(e,"array","PgGeometry")}build(e){return new ea(e,this.config)}}class ea extends l.Kl{static [n.i]="PgGeometry";getSQLType(){return"geometry(point)"}mapFromDriverValue(e){return en(e)}mapToDriverValue(e){return`point(${e[0]} ${e[1]})`}}class el extends l.pe{static [n.i]="PgGeometryObjectBuilder";constructor(e){super(e,"json","PgGeometryObject")}build(e){return new eo(e,this.config)}}class eo extends l.Kl{static [n.i]="PgGeometryObject";getSQLType(){return"geometry(point)"}mapFromDriverValue(e){let t=en(e);return{x:t[0],y:t[1]}}mapToDriverValue(e){return`point(${e.x} ${e.y})`}}function eu(e,t){let{name:i,config:n}=(0,a.Ll)(e,t);return n?.mode&&"tuple"!==n.mode?new el(i):new es(i)}class ec extends l.pe{static [n.i]="PgRealBuilder";constructor(e,t){super(e,"number","PgReal"),this.config.length=t}build(e){return new eh(e,this.config)}}class eh extends l.Kl{static [n.i]="PgReal";constructor(e,t){super(e,t)}getSQLType(){return"real"}mapFromDriverValue=e=>"string"==typeof e?Number.parseFloat(e):e}function ed(e){return new ec(e??"")}class ef extends l.pe{static [n.i]="PgSerialBuilder";constructor(e){super(e,"number","PgSerial"),this.config.hasDefault=!0,this.config.notNull=!0}build(e){return new ep(e,this.config)}}class ep extends l.Kl{static [n.i]="PgSerial";
1getSQLType(){return"serial"}}function eg(e){return new ef(e??"")}class em extends o.p{static [n.i]="PgSmallIntBuilder";constructor(e){super(e,"number","PgSmallInt")}build(e){return new ey(e,this.config)}}class ey extends l.Kl{static [n.i]="PgSmallInt";getSQLType(){return"smallint"}mapFromDriverValue=e=>"string"==typeof e?Number(e):e}function eb(e){return new em(e??"")}class ew extends l.pe{static [n.i]="PgSmallSerialBuilder";constructor(e){super(e,"number","PgSmallSerial"),this.config.hasDefault=!0,this.config.notNull=!0}build(e){return new ev(e,this.config)}}class ev extends l.Kl{static [n.i]="PgSmallSerial";getSQLType(){return"smallserial"}}function eS(e){return new ew(e??"")}var ex=i(73568),eT=i(33122),eP=i(14145),eN=i(23116),eC=i(63228);class ek extends l.pe{static [n.i]="PgBinaryVectorBuilder";constructor(e,t){super(e,"string","PgBinaryVector"),this.config.dimensions=t.dimensions}build(e){return new eA(e,this.config)}}class eA extends l.Kl{static [n.i]="PgBinaryVector";dimensions=this.config.dimensions;getSQLType(){return`bit(${this.dimensions})`}}function eI(e,t){let{name:i,config:n}=(0,a.Ll)(e,t);return new ek(i,n)}class eD extends l.pe{static [n.i]="PgHalfVectorBuilder";constructor(e,t){super(e,"array","PgHalfVector"),this.config.dimensions=t.dimensions}build(e){return new e$(e,this.config)}}class e$ extends l.Kl{static [n.i]="PgHalfVector";dimensions=this.config.dimensions;getSQLType(){return`halfvec(${this.dimensions})`}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){return e.slice(1,-1).split(",").map(e=>Number.parseFloat(e))}}function eL(e,t){let{name:i,config:n}=(0,a.Ll)(e,t);return new eD(i,n)}class eE extends l.pe{static [n.i]="PgSparseVectorBuilder";constructor(e,t){super(e,"string","PgSparseVector"),this.config.dimensions=t.dimensions}build(e){return new ej(e,this.config)}}class ej extends l.Kl{static [n.i]="PgSparseVector";dimensions=this.config.dimensions;getSQLType(){return`sparsevec(${this.dimensions})`}}function eq(e,t){let{name:i,config:n}=(0,a.Ll)(e,t);return new eE(i,n)}var eO=i(72068);let ez=Symbol.for("drizzle:PgInlineForeignKeys"),e_=Symbol.for("drizzle:EnableRLS");class eF extends s.XI{static [n.i]="PgTable";static Symbol=Object.assign({},s.XI.Symbol,{InlineForeignKeys:ez,EnableRLS:e_});[ez]=[];[e_]=!1;[s.XI.Symbol.ExtraConfigBuilder]=void 0;[s.XI.Symbol.ExtraConfigColumns]={}}let eQ=(e,t,i)=>(function(e,t,i,n,a=e){let l=new eF(e,n,a),o="function"==typeof t?t({bigint:f,bigserial:b,boolean:w.zM,char:v.Tp,cidr:T,customType:C,date:k.p6,doublePrecision:D,inet:E,integer:j.nd,interval:z,json:_.Pq,jsonb:F.Fx,line:V,macaddr:K,macaddr8:G,numeric:H.sH,point:ei,geometry:eu,real:ed,serial:eg,smallint:eb,smallserial:eS,text:ex.Qq,time:eT.kB,timestamp:eP.vE,uuid:eN.uR,varchar:eC.yf,bit:eI,halfvec:eL,sparsevec:eq,vector:eO.i1}):t,u=Object.fromEntries(Object.entries(o).map(([e,t])=>{t.setName(e);let i=t.build(l);return l[ez].push(...t.buildForeignKeys(i,l)),[e,i]})),c=Object.fromEntries(Object.entries(o).map(([e,t])=>(t.setName(e),[e,t.buildExtraConfigColumn(l)]))),h=Object.assign(l,u);return h[s.XI.Symbol.Columns]=u,h[s.XI.Symbol.ExtraConfigColumns]=c,i&&(h[eF.Symbol.ExtraConfigBuilder]=i),Object.assign(h,{enableRLS:()=>(h[eF.Symbol.EnableRLS]=!0,h)})})(e,t,i,void 0)},44778:(e,t,i)=>{"use strict";i.d(t,{Y:()=>s,i:()=>a});var n=i(51320);function s(e){return(0,n.ll)`${e} asc`}function a(e){return(0,n.ll)`${e} desc`}},44848:(e,t,i)=>{"use strict";i.d(t,{DV:()=>h,He:()=>function e(t,i){return Object.entries(t).reduce((t,[l,u])=>{if("string"!=typeof l)return t;let c=i?[...i,l]:[l];return(0,s.is)(u,n.V)||(0,s.is)(u,a.Xs)||(0,s.is)(u,a.Xs.Aliased)?t.push({path:c,field:u}):(0,s.is)(u,o.XI)?t.push(...e(u[o.XI.Symbol.Columns],c)):t.push(...e(u,c)),t},[])},Ll:()=>m,Lq:()=>y,XJ:()=>f,YD:()=>p,a6:()=>c,q:()=>d,zN:()=>g});var n=i(80269),s=i(6996),a=i(51320),l=i(30433),o=i(4805),u=i(7272);function c(e,t,i){let l={},u=e.reduce((e,{path:u,field:c},h)=>{let d;d=(0,s.is)(c,n.V)?c:(0,s.is)(c,a.Xs)?c.decoder:c.sql.decoder;let f=e;for(let[e,a]of u.entries())if(e<u.length-1)a in f||(f[a]={}),f=f[a];else{let e=t[h],p=f[a]=null===e?null:d.mapFromDriverValue(e);if(i&&(0,s.is)(c,n.V)&&2===u.length){let e=u[0];e in l?"string"==typeof l[e]&&l[e]!==(0,o.Io)(c.table)&&(l[e]=!1):l[e]=null===p&&(0,o.Io)(c.table)}}return e},{});if(i&&Object.keys(l).length>0)for(let[e,t]of Object.entries(l))"string"!=typeof t||i[t]||(u[e]=null);return u}function h(e,t){let i=Object.keys(e),n=Object.keys(t);if(i.length!==n.length)return!1;for(let[e,t]of i.entries())if(t!==n[e])return!1;return!0}function d(e,t){let i=Object.entries(t).filter(([,e])=>void 0!==e).map(([t,i])=>(0,s.is)(i,a.Xs)||(0,s.is)(i,n.V)?[t,i]:[t,new a.Iw(i,e[o.XI.Symbol.Columns][t])]);if(0===i.length)throw Error("No values to set");return Object.fromEntries(i)}function f(e,t){for(let i of t)for(let t of Object.getOwnPropertyNames(i.prototype))"constructor"!==t&&Object.defineProperty(e.prototype,t,Object.getOwnPropertyDescriptor(i.prototype,t)||Object.create(null))}function p(e){return e[o.XI.Symbol.Columns]}function g(e){return(0,s.is)(e,l.n)?e._.alias:(0,s.is)(e,a.Ss)?e[u.n].name:(0,s.is)(e,a.Xs)?void 0:e[o.XI.Symbol.IsAlias]?e[o.XI.Symbol.Name]:e[o.XI.Symbol.BaseName]}function m(e,t){return{name:"string"==typeof e&&e.length>0?e:"",config:"object"==typeof e?e:t}}function y(e){if("object"!=typeof e||null===e||"Object"!==e.constructor.name)return!1;if("logger"in e){let t=typeof e.logger;return"boolean"===t||"object"===t&&"function"==typeof e.logger.logQuery||"undefined"===t}if("schema"in e){let t=typeof e.logger;return"object"===t||"undefined"===t}if("casing"in e){let t=typeof e.logger;return"string"===t||"undefined"===t}if("mode"in e)return"default"===e.mode&&"planetscale"===e.mode&&void 0===e.mode;if("connection"in e){let t=typeof e.connection;return"string"===t||"object"===t||"undefined"===t}if("client"in e){let t=typeof e.client;return"object"===t||"function"===t||"undefined"===t}return 0===Object.keys(e).length}},45169:(e,t,i)=>{"use strict";i.d(t,{Fx:()=>o,kn:()=>l});var n=i(6996),s=i(21137);class a extends s.pe{static [n.i]="PgJsonbBuilder";constructor(e){super(e,"json","PgJsonb")}build(e){return new l(e,this.config)}}class l extends s.Kl{static [n.i]="PgJsonb";constructor(e,t){super(e,t)}getSQLType(){return"jsonb"}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){if("string"==typeof e)try{return JSON.parse(e)}catch{}return e}}function o(e){return new a(e??"")}},45361:(e,t,i)=>{"use strict";i.d(t,{Pq:()=>
1o,iX:()=>l});var n=i(6996),s=i(21137);class a extends s.pe{static [n.i]="PgJsonBuilder";constructor(e){super(e,"json","PgJson")}build(e){return new l(e,this.config)}}class l extends s.Kl{static [n.i]="PgJson";constructor(e,t){super(e,t)}getSQLType(){return"json"}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){if("string"==typeof e)try{return JSON.parse(e)}catch{}return e}}function o(e){return new a(e??"")}},46648:function(e,t,i){var n;!function(s,a,l){var o,u=l.pow(256,6),c=l.pow(2,52),h=2*c;function d(e,t,i){var n=[],d=g(function e(t,i){var n,s=[],a=typeof t;if(i&&"object"==a)for(n in t)try{s.push(e(t[n],i-1))}catch(e){}return s.length?s:"string"==a?t:t+"\0"}((t=!0==t?{entropy:!0}:t||{}).entropy?[e,m(a)]:null==e?function(){try{var e;return o&&(e=o.randomBytes)?e=e(256):(e=new Uint8Array(256),(s.crypto||s.msCrypto).getRandomValues(e)),m(e)}catch(e){var t=s.navigator,i=t&&t.plugins;return[+new Date,s,i,s.screen,m(a)]}}():e,3),n),y=new f(n),b=function(){for(var e=y.g(6),t=u,i=0;e<c;)e=(e+i)*256,t*=256,i=y.g(1);for(;e>=h;)e/=2,t/=2,i>>>=1;return(e+i)/t};return b.int32=function(){return 0|y.g(4)},b.quick=function(){return y.g(4)/0x100000000},b.double=b,g(m(y.S),a),(t.pass||i||function(e,t,i,n){return(n&&(n.S&&p(n,y),e.state=function(){return p(y,{})}),i)?(l.random=e,t):e})(b,d,"global"in t?t.global:this==l,t.state)}function f(e){var t,i=e.length,n=this,s=0,a=n.i=n.j=0,l=n.S=[];for(i||(e=[i++]);s<256;)l[s]=s++;for(s=0;s<256;s++)l[s]=l[a=255&a+e[s%i]+(t=l[s])],l[a]=t;(n.g=function(e){for(var t,i=0,s=n.i,a=n.j,l=n.S;e--;)t=l[s=255&s+1],i=256*i+l[255&(l[s]=l[a=255&a+t])+(l[a]=t)];return n.i=s,n.j=a,i})(256)}function p(e,t){return t.i=e.i,t.j=e.j,t.S=e.S.slice(),t}function g(e,t){for(var i,n=e+"",s=0;s<n.length;)t[255&s]=255&(i^=19*t[255&s])+n.charCodeAt(s++);return m(t)}function m(e){return String.fromCharCode.apply(0,e)}if(g(l.random(),a),e.exports){e.exports=d;try{o=i(41234)}catch(e){}}else void 0!==(n=(function(){return d}).call(t,i,t,e))&&(e.exports=n)}("undefined"!=typeof self?self:this,[],Math)},51320:(e,t,i)=>{"use strict";i.d(t,{Iw:()=>x,Or:()=>P,Xs:()=>y,DJ:()=>m,Ss:()=>k,Ct:()=>N,eG:()=>w,qt:()=>g,ll:()=>T});var n=i(6996),s=i(21137);let a=Symbol.for("drizzle:isPgEnum");class l extends s.pe{static [n.i]="PgEnumColumnBuilder";constructor(e,t){super(e,"string","PgEnumColumn"),this.config.enum=t}build(e){return new o(e,this.config)}}class o extends s.Kl{static [n.i]="PgEnumColumn";enum=this.config.enum;enumValues=this.config.enum.enumValues;constructor(e,t){super(e,t),this.enum=t.enum}getSQLType(){return this.enum.enumName}}var u=i(30433),c=i(69133),h=i(7272),d=i(80269),f=i(4805);class p{static [n.i]=null}function g(e){return null!=e&&"function"==typeof e.getSQL}class m{static [n.i]="StringChunk";value;constructor(e){this.value=Array.isArray(e)?e:[e]}getSQL(){return new y([this])}}class y{constructor(e){this.queryChunks=e}static [n.i]="SQL";decoder=v;shouldInlineParams=!1;append(e){return this.queryChunks.push(...e.queryChunks),this}toQuery(e){return c.k.startActiveSpan("drizzle.buildSQL",t=>{let i=this.buildQueryFromSourceParams(this.queryChunks,e);return t?.setAttributes({"drizzle.query.text":i.sql,"drizzle.query.params":JSON.stringify(i.params)}),i})}buildQueryFromSourceParams(e,t){let i=Object.assign({},t,{inlineParams:t.inlineParams||this.shouldInlineParams,paramStartIndex:t.paramStartIndex||{value:0}}),{casing:s,escapeName:l,escapeParam:o,prepareTyping:c,inlineParams:p,paramStartIndex:w}=i;return function(e){let t={sql:"",params:[]};for(let i of e)t.sql+=i.sql,t.params.push(...i.params),i.typings?.length&&(t.typings||(t.typings=[]),t.typings.push(...i.typings));return t}(e.map(e=>{if((0,n.is)(e,m))return{sql:e.value.join(""),params:[]};if((0,n.is)(e,b))return{sql:l(e.value),params:[]};if(void 0===e)return{sql:"",params:[]};if(Array.isArray(e)){let t=[new m("(")];for(let[i,n]of e.entries())t.push(n),i<e.length-1&&t.push(new m(", "));return t.push(new m(")")),this.buildQueryFromSourceParams(t,i)}if((0,n.is)(e,y))return this.buildQueryFromSourceParams(e.queryChunks,{...i,inlineParams:p||e.shouldInlineParams});if((0,n.is)(e,f.XI)){let t=e[f.XI.Symbol.Schema],i=e[f.XI.Symbol.Name];return{sql:void 0===t||e[f.HE]?l(i):l(t)+"."+l(i),params:[]}}if((0,n.is)(e,d.V)){let i=s.getColumnCasing(e);if("indexes"===t.invokeSource)return{sql:l(i),params:[]};let n=e.table[f.XI.Symbol.Schema];return{sql:e.table[f.HE]||void 0===n?l(e.table[f.XI.Symbol.Name])+"."+l(i):l(n)+"."+l(e.table[f.XI.Symbol.Name])+"."+l(i),params:[]}}if((0,n.is)(e,k)){let t=e[h.n].schema,i=e[h.n].name;return{sql:void 0===t||e[h.n].isAlias?l(i):l(t)+"."+l(i),params:[]}}if((0,n.is)(e,x)){if((0,n.is)(e.value,P))return{sql:o(w.value++,e),params:[e],typings:["none"]};let t=null===e.value?null:e.encoder.mapToDriverValue(e.value);if((0,n.is)(t,y))return this.buildQueryFromSourceParams([t],i);if(p)return{sql:this.mapInlineParam(t,i),params:[]};let s=["none"];return c&&(s=[c(e.encoder)]),{sql:o(w.value++,t),params:[t],typings:s}}return(0,n.is)(e,P)?{sql:o(w.value++,e),params:[e],typings:["none"]}:(0,n.is)(e,y.Aliased)&&void 0!==e.fieldAlias?{sql:l(e.fieldAlias),params:[]}:(0,n.is)(e,u.n)?e._.isWith?{sql:l(e._.alias),params:[]}:this.buildQueryFromSourceParams([new m("("),e._.sql,new m(") "),new b(e._.alias)],i):e&&"function"==typeof e&&a in e&&!0===e[a]?e.schema?{sql:l(e.schema)+"."+l(e.enumName),params:[]}:{sql:l(e.enumName),params:[]}:g(e)?e.shouldOmitSQLParens?.()?this.buildQueryFromSourceParams([e.getSQL()],i):this.buildQueryFromSourceParams([new m("("),e.getSQL(),new m(")")],i):p?{sql:this.mapInlineParam(e,i),params:[]}:{sql:o(w.value++,e),params:[e],typings:["none"]}}))}mapInlineParam(e,{escapeString:t}
1){if(null===e)return"null";if("number"==typeof e||"boolean"==typeof e)return e.toString();if("string"==typeof e)return t(e);if("object"==typeof e){let i=e.toString();return"[object Object]"===i?t(JSON.stringify(e)):t(i)}throw Error("Unexpected param value: "+e)}getSQL(){return this}as(e){return void 0===e?this:new y.Aliased(this,e)}mapWith(e){return this.decoder="function"==typeof e?{mapFromDriverValue:e}:e,this}inlineParams(){return this.shouldInlineParams=!0,this}if(e){return e?this:void 0}}class b{constructor(e){this.value=e}static [n.i]="Name";brand;getSQL(){return new y([this])}}function w(e){return"object"==typeof e&&null!==e&&"mapToDriverValue"in e&&"function"==typeof e.mapToDriverValue}let v={mapFromDriverValue:e=>e},S={mapToDriverValue:e=>e};({...v,...S});class x{constructor(e,t=S){this.value=e,this.encoder=t}static [n.i]="Param";brand;getSQL(){return new y([this])}}function T(e,...t){let i=[];for(let[n,s]of((t.length>0||e.length>0&&""!==e[0])&&i.push(new m(e[0])),t.entries()))i.push(s,new m(e[n+1]));return new y(i)}(e=>{e.empty=function(){return new y([])},e.fromList=function(e){return new y(e)},e.raw=function(e){return new y([new m(e)])},e.join=function(e,t){let i=[];for(let[n,s]of e.entries())n>0&&void 0!==t&&i.push(t),i.push(s);return new y(i)},e.identifier=function(e){return new b(e)},e.placeholder=function(e){return new P(e)},e.param=function(e,t){return new x(e,t)}})(T||(T={})),(e=>{class t{constructor(e,t){this.sql=e,this.fieldAlias=t}static [n.i]="SQL.Aliased";isSelectionField=!1;getSQL(){return this.sql}clone(){return new t(this.sql,this.fieldAlias)}}e.Aliased=t})(y||(y={}));class P{constructor(e){this.name=e}static [n.i]="Placeholder";getSQL(){return new y([this])}}function N(e,t){return e.map(e=>{if((0,n.is)(e,P)){if(!(e.name in t))throw Error(`No value for placeholder "${e.name}" was provided`);return t[e.name]}if((0,n.is)(e,x)&&(0,n.is)(e.value,P)){if(!(e.value.name in t))throw Error(`No value for placeholder "${e.value.name}" was provided`);return e.encoder.mapToDriverValue(t[e.value.name])}return e})}let C=Symbol.for("drizzle:IsDrizzleView");class k{static [n.i]="View";[h.n];[C]=!0;constructor({name:e,schema:t,selectedFields:i,query:n}){this[h.n]={name:e,originalName:e,schema:t,selectedFields:i,query:n,isExisting:!n,isAlias:!1}}getSQL(){return new y([this])}}d.V.prototype.getSQL=function(){return new y([this])},f.XI.prototype.getSQL=function(){return new y([this])},u.n.prototype.getSQL=function(){return new y([this])}},52015:(e,t,i)=>{"use strict";i.d(t,{a:()=>eb,b:()=>ew,c:()=>eT,d:()=>eN,e:()=>l,f:()=>ek,g:()=>eA,h:()=>eC,i:()=>tb,j:()=>eV,k:()=>eY,l:()=>e0,m:()=>e2,n:()=>eI,o:()=>tG,p:()=>e6,q:()=>tY,r:()=>tZ,s:()=>t0,t:()=>t1,u:()=>t2,v:()=>t6,x:()=>t8});var n,s=i(9102),a=i(87358),l={};(0,s.b)(l,{ABSTIME:()=>$,ACLITEM:()=>F,BIT:()=>J,BOOL:()=>c,BPCHAR:()=>Q,BYTEA:()=>h,CHAR:()=>d,CID:()=>S,CIDR:()=>A,CIRCLE:()=>j,DATE:()=>M,FLOAT4:()=>I,FLOAT8:()=>D,GTSVECTOR:()=>ec,INET:()=>_,INT2:()=>p,INT4:()=>g,INT8:()=>f,INTERVAL:()=>X,JSON:()=>x,JSONB:()=>ef,MACADDR:()=>z,MACADDR8:()=>q,MONEY:()=>O,NUMERIC:()=>G,OID:()=>b,PATH:()=>C,PG_DEPENDENCIES:()=>el,PG_LSN:()=>es,PG_NDISTINCT:()=>ea,PG_NODE_TREE:()=>P,POLYGON:()=>k,REFCURSOR:()=>H,REGCLASS:()=>et,REGCONFIG:()=>eh,REGDICTIONARY:()=>ed,REGNAMESPACE:()=>ep,REGOPER:()=>Z,REGOPERATOR:()=>ee,REGPROC:()=>m,REGPROCEDURE:()=>Y,REGROLE:()=>eg,REGTYPE:()=>ei,RELTIME:()=>L,SMGR:()=>N,TEXT:()=>y,TID:()=>w,TIME:()=>U,TIMESTAMP:()=>V,TIMESTAMPTZ:()=>R,TIMETZ:()=>K,TINTERVAL:()=>E,TSQUERY:()=>eu,TSVECTOR:()=>eo,TXID_SNAPSHOT:()=>en,UUID:()=>er,VARBIT:()=>W,VARCHAR:()=>B,XID:()=>v,XML:()=>T,arrayParser:()=>eN,arraySerializer:()=>eT,parseType:()=>ev,parsers:()=>eb,serializers:()=>ew,types:()=>em}),(0,s.j)();var o=globalThis.JSON.parse,u=globalThis.JSON.stringify,c=16,h=17,d=18,f=20,p=21,g=23,m=24,y=25,b=26,w=27,v=28,S=29,x=114,T=142,P=194,N=210,C=602,k=604,A=650,I=700,D=701,$=702,L=703,E=704,j=718,q=774,O=790,z=829,_=869,F=1033,Q=1042,B=1043,M=1082,U=1083,V=1114,R=1184,X=1186,K=1266,J=1560,W=1562,G=1700,H=1790,Y=2202,Z=2203,ee=2204,et=2205,ei=2206,er=2950,en=2970,es=3220,ea=3361,el=3402,eo=3614,eu=3615,ec=3642,eh=3734,ed=3769,ef=3802,ep=4089,eg=4096,em={string:{to:25,from:[25,1043,1042],serialize:e=>{if("string"==typeof e)return e;if("number"==typeof e)return e.toString();throw Error("Invalid input for string type")},parse:e=>e},number:{to:0,from:[21,23,26,700,701],serialize:e=>e.toString(),parse:e=>+e},bigint:{to:20,from:[20],serialize:e=>e.toString(),parse:e=>{let t=BigInt(e);return t<Number.MIN_SAFE_INTEGER||t>Number.MAX_SAFE_INTEGER?t:Number(t)}}
1,json:{to:114,from:[114,3802],serialize:e=>"string"==typeof e?e:u(e),parse:e=>o(e)},boolean:{to:16,from:[16],serialize:e=>{if("boolean"!=typeof e)throw Error("Invalid input for boolean type");return e?"t":"f"},parse:e=>"t"===e},date:{to:1184,from:[1082,1114,1184],serialize:e=>{if("string"==typeof e)return e;if("number"==typeof e)return new Date(e).toISOString();if(e instanceof Date)return e.toISOString();throw Error("Invalid input for date type")},parse:e=>new Date(e)},bytea:{to:17,from:[17],serialize:e=>{if(!(e instanceof Uint8Array))throw Error("Invalid input for bytea type");return"\\x"+Array.from(e).map(e=>e.toString(16).padStart(2,"0")).join("")},parse:e=>{let t=e.slice(2);return Uint8Array.from({length:t.length/2},(e,i)=>parseInt(t.substring(2*i,(i+1)*2),16))}}},ey=function(e){return Object.keys(e).reduce(({parsers:t,serializers:i},n)=>{let{to:s,from:a,serialize:l,parse:o}=e[n];return i[s]=l,i[n]=l,t[n]=o,Array.isArray(a)?a.forEach(e=>{t[e]=o,i[e]=l}):(t[a]=o,i[a]=l),{parsers:t,serializers:i}},{parsers:{},serializers:{}})}(em),eb=ey.parsers,ew=ey.serializers;function ev(e,t,i){if(null===e)return null;let n=i?.[t]??ey.parsers[t];return n?n(e,t):e}var eS=/\\/g,ex=/"/g;function eT(e,t,i){if(!1===Array.isArray(e))return e;if(!e.length)return"{}";let n=e[0],s=1020===i?";":",";return Array.isArray(n)?`{${e.map(e=>eT(e,t,i)).join(s)}}`:`{${e.map(e=>(void 0===e&&(e=null),null===e?"null":'"'+(t?t(e):e.toString()).replace(eS,"\\\\").replace(ex,'\\"')+'"')).join(s)}}`}var eP={i:0,char:null,str:"",quoted:!1,last:0,p:null};function eN(e,t,i){return eP.i=eP.last=0,function e(t,i,n,s){let a=[],l=1020===s?";":",";for(;t.i<i.length;t.i++){if(t.char=i[t.i],t.quoted)"\\"===t.char?t.str+=i[++t.i]:'"'===t.char?(a.push(n?n(t.str):t.str),t.str="",t.quoted='"'===i[t.i+1],t.last=t.i+2):t.str+=t.char;else if('"'===t.char)t.quoted=!0;else if("{"===t.char)t.last=++t.i,a.push(e(t,i,n,s));else if("}"===t.char){t.quoted=!1,t.last<t.i&&a.push(n?n(i.slice(t.last,t.i)):i.slice(t.last,t.i)),t.last=t.i+1;break}else t.char===l&&"}"!==t.p&&'"'!==t.p&&(a.push(n?n(i.slice(t.last,t.i)):i.slice(t.last,t.i)),t.last=t.i+1);t.p=t.char}return t.last<t.i&&a.push(n?n(i.slice(t.last,t.i+1)):i.slice(t.last,t.i+1)),a}(eP,e,t,i)[0]}var eC={};function ek(e,t,i,n){let s=[],a={rows:[],fields:[]},l=0,o={...t,...i?.parsers};return e.forEach(e=>{switch(e.name){case"rowDescription":a.fields=e.fields.map(e=>({name:e.name,dataTypeID:e.dataTypeID}));break;case"dataRow":if(!a)break;i?.rowMode==="array"?a.rows.push(e.fields.map((e,t)=>ev(e,a.fields[t].dataTypeID,o))):a.rows.push(Object.fromEntries(e.fields.map((e,t)=>[a.fields[t].name,ev(e,a.fields[t].dataTypeID,o)])));break;case"commandComplete":l+=function(e){let t=e.text.split(" ");switch(t[0]){case"INSERT":return parseInt(t[2],10);case"UPDATE":case"DELETE":case"COPY":return parseInt(t[1],10);default:return 0}}(e),s.push({...a,affectedRows:l,...n?{blob:n}:{}}),a={rows:[],fields:[]}}}),0===s.length&&s.push({affectedRows:0,rows:[],fields:[]}),s}function eA(e){let t=e.find(e=>"parameterDescription"===e.name);return t?t.dataTypeIDs:[]}(0,s.b)(eC,{parseDescribeStatementResults:()=>eA,parseResults:()=>ek}),(0,s.j)();var eI={};(0,s.b)(eI,{AuthenticationCleartextPassword:()=>eF,AuthenticationMD5Password:()=>eQ,AuthenticationOk:()=>e_,AuthenticationSASL:()=>eB,AuthenticationSASLContinue:()=>eM,AuthenticationSASLFinal:()=>eU,BackendKeyDataMessage:()=>eH,CommandCompleteMessage:()=>e0,CopyDataMessage:()=>eR,CopyResponse:()=>eX,DataRowMessage:()=>e1,DatabaseError:()=>eV,Field:()=>eK,NoticeMessage:()=>e2,NotificationResponseMessage:()=>eY,ParameterDescriptionMessage:()=>eW,ParameterStatusMessage:()=>eG,ReadyForQueryMessage:()=>eZ,RowDescriptionMessage:()=>eJ,bindComplete:()=>e$,closeComplete:()=>eL,copyDone:()=>ez,emptyQuery:()=>eO,noData:()=>eE,parseComplete:()=>eD,portalSuspended:()=>ej,replicationStart:()=>eq}),(0,s.j)();var eD={name:"parseComplete",length:5},e$={name:"bindComplete",length:5},eL={name:"closeComplete",length:5},eE={name:"noData",length:5},ej={name:"portalSuspended",length:5},eq={name:"replicationStart",length:4},eO={name:"emptyQuery",length:4},ez={name:"copyDone",length:4},e_=class{constructor(e){this.length=e,this.name="authenticationOk"}},eF=class{constructor(e){this.length=e,this.name="authenticationCleartextPassword"}},eQ=class{constructor(e,t){this.length=e,this.salt=t,this.name="authenticationMD5Password"}},eB=class{constructor(e,t){this.length=e,this.mechanisms=t,this.name="authenticationSASL"}},eM=class{constructor(e,t){this.length=e,this.data=t,this.name="authenticationSASLContinue"}},eU=class{constructor(e,t){this.length=e,this.data=t,this.name="authenticationSASLFinal"}}
1,eV=class extends Error{constructor(e,t,i){super(e),this.length=t,this.name=i}},eR=class{constructor(e,t){this.length=e,this.chunk=t,this.name="copyData"}},eX=class{constructor(e,t,i,n){this.length=e,this.name=t,this.binary=i,this.columnTypes=Array(n)}},eK=class{constructor(e,t,i,n,s,a,l){this.name=e,this.tableID=t,this.columnID=i,this.dataTypeID=n,this.dataTypeSize=s,this.dataTypeModifier=a,this.format=l}},eJ=class{constructor(e,t){this.length=e,this.fieldCount=t,this.name="rowDescription",this.fields=Array(this.fieldCount)}},eW=class{constructor(e,t){this.length=e,this.parameterCount=t,this.name="parameterDescription",this.dataTypeIDs=Array(this.parameterCount)}},eG=class{constructor(e,t,i){this.length=e,this.parameterName=t,this.parameterValue=i,this.name="parameterStatus"}},eH=class{constructor(e,t,i){this.length=e,this.processID=t,this.secretKey=i,this.name="backendKeyData"}},eY=class{constructor(e,t,i,n){this.length=e,this.processId=t,this.channel=i,this.payload=n,this.name="notification"}},eZ=class{constructor(e,t){this.length=e,this.status=t,this.name="readyForQuery"}},e0=class{constructor(e,t){this.length=e,this.text=t,this.name="commandComplete"}},e1=class{constructor(e,t){this.length=e,this.fields=t,this.name="dataRow",this.fieldCount=t.length}},e2=class{constructor(e,t){this.length=e,this.message=t,this.name="notice"}},e6={};function e8(e){let t=e.length;for(let i=e.length-1;i>=0;i--){let n=e.charCodeAt(i);n>127&&n<=2047?t++:n>2047&&n<=65535&&(t+=2),n>=56320&&n<=57343&&i--}return t}(0,s.b)(e6,{Parser:()=>tG,messages:()=>eI,serialize:()=>tb}),(0,s.j)(),(0,s.j)(),(0,s.j)(),(0,s.j)();var e3,e4,e5,e7,e9,te,tt,ti,tr,tn=class{constructor(e=256){this.size=e,(0,s.f)(this,te),(0,s.f)(this,e3),(0,s.f)(this,e4,5),(0,s.f)(this,e5,!1),(0,s.f)(this,e7,new TextEncoder),(0,s.f)(this,e9,0),(0,s.g)(this,e3,(0,s.h)(this,te,tt).call(this,e))}addInt32(e){return(0,s.h)(this,te,ti).call(this,4),(0,s.e)(this,e3).setInt32((0,s.e)(this,e4),e,(0,s.e)(this,e5)),(0,s.g)(this,e4,(0,s.e)(this,e4)+4),this}addInt16(e){return(0,s.h)(this,te,ti).call(this,2),(0,s.e)(this,e3).setInt16((0,s.e)(this,e4),e,(0,s.e)(this,e5)),(0,s.g)(this,e4,(0,s.e)(this,e4)+2),this}addCString(e){return e&&this.addString(e),(0,s.h)(this,te,ti).call(this,1),(0,s.e)(this,e3).setUint8((0,s.e)(this,e4),0),(0,s.i)(this,e4)._++,this}addString(e=""){let t=e8(e);return(0,s.h)(this,te,ti).call(this,t),(0,s.e)(this,e7).encodeInto(e,new Uint8Array((0,s.e)(this,e3).buffer,(0,s.e)(this,e4))),(0,s.g)(this,e4,(0,s.e)(this,e4)+t),this}add(e){return(0,s.h)(this,te,ti).call(this,e.byteLength),new Uint8Array((0,s.e)(this,e3).buffer).set(new Uint8Array(e),(0,s.e)(this,e4)),(0,s.g)(this,e4,(0,s.e)(this,e4)+e.byteLength),this}flush(e){let t=(0,s.h)(this,te,tr).call(this,e);return(0,s.g)(this,e4,5),(0,s.g)(this,e3,(0,s.h)(this,te,tt).call(this,this.size)),new Uint8Array(t)}};e3=new WeakMap,e4=new WeakMap,e5=new WeakMap,e7=new WeakMap,e9=new WeakMap,te=new WeakSet,tt=function(e){return new DataView(new ArrayBuffer(e))},ti=function(e){if((0,s.e)(this,e3).byteLength-(0,s.e)(this,e4)<e){let t=(0,s.e)(this,e3).buffer,i=t.byteLength+(t.byteLength>>1)+e;(0,s.g)(this,e3,(0,s.h)(this,te,tt).call(this,i)),new Uint8Array((0,s.e)(this,e3).buffer).set(new Uint8Array(t))}},tr=function(e){if(e){(0,s.e)(this,e3).setUint8((0,s.e)(this,e9),e);let t=(0,s.e)(this,e4)-((0,s.e)(this,e9)+1);(0,s.e)(this,e3).setInt32((0,s.e)(this,e9)+1,t,(0,s.e)(this,e5))}return(0,s.e)(this,e3).buffer.slice(5*!e,(0,s.e)(this,e4))};var ts=new tn,ta=[],tl=new tn,to=(e,t)=>{for(let i=0;i<e.length;i++){let n=t?t(e[i],i):e[i];if(null===n)ts.addInt16(0),tl.addInt32(-1);else if(n instanceof ArrayBuffer||ArrayBuffer.isView(n)){let e=ArrayBuffer.isView(n)?n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength):n;ts.addInt16(1),tl.addInt32(e.byteLength),tl.add(e)}else ts.addInt16(0),tl.addInt32(e8(n)),tl.addString(n)}},tu=new Uint8Array([69,0,0,0,9,0,0,0,0,0]),tc=(e,t)=>{let i=new tn;return i.addCString(t),i.flush(e)},th=ts.addCString("P").flush(68),td=ts.addCString("S").flush(68),tf=e=>new Uint8Array([e,0,0,0,4]),tp=tf(72),tg=tf(83),tm=tf(88),ty=tf(99),tb={startup:e=>{for(let t of(ts.addInt16(3).addInt16(0),Object.keys(e)))ts.addCString(t).addCString(e[t]);ts.addCString("client_encoding").addCString("UTF8");let t=ts.addCString("").flush(),i=t.byteLength+4;return new tn().addInt32(i).add(t).flush()},password:e=>ts.addCString(e).flush(112),requestSsl:()=>{let e=new DataView(new ArrayBuffer(8));return e.setInt32(0,8,!1),e.setInt32(4,0x4d2162f,!1),new Uint8Array(e.buffer)},sendSASLInitialResponseMessage:(e,t)=>
1(ts.addCString(e).addInt32(e8(t)).addString(t),ts.flush(112)),sendSCRAMClientFinalMessage:e=>ts.addString(e).flush(112),query:e=>ts.addCString(e).flush(81),parse:e=>{let t=e.name??"";t.length>63&&(console.error("Warning! Postgres only supports 63 characters for query names."),console.error("You supplied %s (%s)",t,t.length),console.error("This can cause conflicts and silent errors executing queries"));let i=ts.addCString(t).addCString(e.text).addInt16(e.types?.length??0);return e.types?.forEach(e=>i.addInt32(e)),ts.flush(80)},bind:(e={})=>{let t=e.portal??"",i=e.statement??"",n=e.binary??!1,s=e.values??ta,a=s.length;return ts.addCString(t).addCString(i),ts.addInt16(a),to(s,e.valueMapper),ts.addInt16(a),ts.add(tl.flush()),ts.addInt16(+!!n),ts.flush(66)},execute:e=>{if(!e||!e.portal&&!e.rows)return tu;let t=e.portal??"",i=e.rows??0,n=e8(t),s=4+n+1+4,a=new DataView(new ArrayBuffer(1+s));return a.setUint8(0,69),a.setInt32(1,s,!1),new TextEncoder().encodeInto(t,new Uint8Array(a.buffer,5)),a.setUint8(n+5,0),a.setUint32(a.byteLength-4,i,!1),new Uint8Array(a.buffer)},describe:e=>e.name?tc(68,`${e.type}${e.name??""}`):"P"===e.type?th:td,close:e=>tc(67,`${e.type}${e.name??""}`),flush:()=>tp,sync:()=>tg,end:()=>tm,copyData:e=>ts.add(e).flush(100),copyDone:()=>ty,copyFail:e=>tc(102,e),cancel:(e,t)=>{let i=new DataView(new ArrayBuffer(16));return i.setInt32(0,16,!1),i.setInt16(4,1234,!1),i.setInt16(6,5678,!1),i.setInt32(8,e,!1),i.setInt32(12,t,!1),new Uint8Array(i.buffer)}};(0,s.j)(),(0,s.j)();var tw={text:0,binary:1};(0,s.j)();var tv,tS,tx,tT,tP,tN=new ArrayBuffer(0),tC=class{constructor(e=0){(0,s.f)(this,tv,new DataView(tN)),(0,s.f)(this,tS),(0,s.f)(this,tx,"utf-8"),(0,s.f)(this,tT,new TextDecoder((0,s.e)(this,tx))),(0,s.f)(this,tP,!1),(0,s.g)(this,tS,e)}setBuffer(e,t){(0,s.g)(this,tS,e),(0,s.g)(this,tv,new DataView(t))}int16(){let e=(0,s.e)(this,tv).getInt16((0,s.e)(this,tS),(0,s.e)(this,tP));return(0,s.g)(this,tS,(0,s.e)(this,tS)+2),e}byte(){let e=(0,s.e)(this,tv).getUint8((0,s.e)(this,tS));return(0,s.i)(this,tS)._++,e}int32(){let e=(0,s.e)(this,tv).getInt32((0,s.e)(this,tS),(0,s.e)(this,tP));return(0,s.g)(this,tS,(0,s.e)(this,tS)+4),e}string(e){return(0,s.e)(this,tT).decode(this.bytes(e))}cstring(){let e=(0,s.e)(this,tS),t=e;for(;0!==(0,s.e)(this,tv).getUint8(t++););let i=this.string(t-e-1);return(0,s.g)(this,tS,t),i}bytes(e){let t=(0,s.e)(this,tv).buffer.slice((0,s.e)(this,tS),(0,s.e)(this,tS)+e);return(0,s.g)(this,tS,(0,s.e)(this,tS)+e),new Uint8Array(t)}};tv=new WeakMap,tS=new WeakMap,tx=new WeakMap,tT=new WeakMap,tP=new WeakMap;var tk,tA,tI,tD,t$,tL,tE,tj,tq,tO,tz,t_,tF,tQ,tB,tM,tU,tV,tR,tX,tK,tJ,tW=new ArrayBuffer(0),tG=class{constructor(){(0,s.f)(this,t$),(0,s.f)(this,tk,new DataView(tW)),(0,s.f)(this,tA,0),(0,s.f)(this,tI,0),(0,s.f)(this,tD,new tC)}parse(e,t){(0,s.h)(this,t$,tL).call(this,ArrayBuffer.isView(e)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):e);let i=(0,s.e)(this,tI)+(0,s.e)(this,tA),n=(0,s.e)(this,tI);for(;n+5<=i;){let e=(0,s.e)(this,tk).getUint8(n),a=(0,s.e)(this,tk).getUint32(n+1,!1),l=1+a;if(l+n<=i)t((0,s.h)(this,t$,tE).call(this,n+5,e,a,(0,s.e)(this,tk).buffer)),n+=l;else break}n===i?((0,s.g)(this,tk,new DataView(tW)),(0,s.g)(this,tA,0),(0,s.g)(this,tI,0)):((0,s.g)(this,tA,i-n),(0,s.g)(this,tI,n))}};tk=new WeakMap,tA=new WeakMap,tI=new WeakMap,tD=new WeakMap,t$=new WeakSet,tL=function(e){if((0,s.e)(this,tA)>0){let t=(0,s.e)(this,tA)+e.byteLength;if(t+(0,s.e)(this,tI)>(0,s.e)(this,tk).byteLength){let e;if(t<=(0,s.e)(this,tk).byteLength&&(0,s.e)(this,tI)>=(0,s.e)(this,tA))e=(0,s.e)(this,tk).buffer;else{let i=2*(0,s.e)(this,tk).byteLength;for(;t>=i;)i*=2;e=new ArrayBuffer(i)}new Uint8Array(e).set(new Uint8Array((0,s.e)(this,tk).buffer,(0,s.e)(this,tI),(0,s.e)(this,tA))),(0,s.g)(this,tk,new DataView(e)),(0,s.g)(this,tI,0)}new Uint8Array((0,s.e)(this,tk).buffer).set(new Uint8Array(e),(0,s.e)(this,tI)+(0,s.e)(this,tA)),(0,s.g)(this,tA,t)}else(0,s.g)(this,tk,new DataView(e)),(0,s.g)(this,tI,0),(0,s.g)(this,tA,e.byteLength)},tE=function(e,t,i,n){switch(t){case 50:return e$;case 49:return eD;case 51:return eL;case 110:return eE;case 115:return ej;case 99:return ez;case 87:return eq;case 73:return eO;case 68:return(0,s.h)(this,t$,tV).call(this,e,i,n);case 67:return(0,s.h)(this,t$,tq).call(this,e,i,n);case 90:return(0,s.h)(this,t$,tj).call(this,e,i,n);case 65:return(0,s.h)(this,t$,tQ).call(this,e,i,n);case 82:return(0,s.h)(this,t$,tK).call(this,e,i,n);case 83:return(0,s.h)(this,t$,tR).call(this,e,i,n);case 75:return(0,s.h)(this,t$,tX).call(this,e,i,n);case 69:return(0,s.h)(this,t$,tJ).call(this,e,i,n,"error");case 78:return(0,s.h)(this,t$,tJ).call(this,e,i,n,"notice");case 84:return(0,s.h)(this,t$,tB).call(this,e,i,n);case 116:return(0,s.h)(this,t$,tU).call(this,e,i,n);case 71:return(0,s.h)(this,t$,tz).call(this,e,i,n);case 72:return(0,s.h)(this,t$,t_).call(this,e,i,n);case 100:return(0,s.h)(this,t$,tO).call(this,e,i,n);
1default:return new eV("received invalid response: "+t.toString(16),i,"error")}},tj=function(e,t,i){return(0,s.e)(this,tD).setBuffer(e,i),new eZ(t,(0,s.e)(this,tD).string(1))},tq=function(e,t,i){return(0,s.e)(this,tD).setBuffer(e,i),new e0(t,(0,s.e)(this,tD).cstring())},tO=function(e,t,i){let n=i.slice(e,e+(t-4));return new eR(t,new Uint8Array(n))},tz=function(e,t,i){return(0,s.h)(this,t$,tF).call(this,e,t,i,"copyInResponse")},t_=function(e,t,i){return(0,s.h)(this,t$,tF).call(this,e,t,i,"copyOutResponse")},tF=function(e,t,i,n){(0,s.e)(this,tD).setBuffer(e,i);let a=0!==(0,s.e)(this,tD).byte(),l=(0,s.e)(this,tD).int16(),o=new eX(t,n,a,l);for(let e=0;e<l;e++)o.columnTypes[e]=(0,s.e)(this,tD).int16();return o},tQ=function(e,t,i){return(0,s.e)(this,tD).setBuffer(e,i),new eY(t,(0,s.e)(this,tD).int32(),(0,s.e)(this,tD).cstring(),(0,s.e)(this,tD).cstring())},tB=function(e,t,i){(0,s.e)(this,tD).setBuffer(e,i);let n=(0,s.e)(this,tD).int16(),a=new eJ(t,n);for(let e=0;e<n;e++)a.fields[e]=(0,s.h)(this,t$,tM).call(this);return a},tM=function(){return new eK((0,s.e)(this,tD).cstring(),(0,s.e)(this,tD).int32(),(0,s.e)(this,tD).int16(),(0,s.e)(this,tD).int32(),(0,s.e)(this,tD).int16(),(0,s.e)(this,tD).int32(),0===(0,s.e)(this,tD).int16()?tw.text:tw.binary)},tU=function(e,t,i){(0,s.e)(this,tD).setBuffer(e,i);let n=(0,s.e)(this,tD).int16(),a=new eW(t,n);for(let e=0;e<n;e++)a.dataTypeIDs[e]=(0,s.e)(this,tD).int32();return a},tV=function(e,t,i){(0,s.e)(this,tD).setBuffer(e,i);let n=(0,s.e)(this,tD).int16(),a=Array(n);for(let e=0;e<n;e++){let t=(0,s.e)(this,tD).int32();a[e]=-1===t?null:(0,s.e)(this,tD).string(t)}return new e1(t,a)},tR=function(e,t,i){return(0,s.e)(this,tD).setBuffer(e,i),new eG(t,(0,s.e)(this,tD).cstring(),(0,s.e)(this,tD).cstring())},tX=function(e,t,i){return(0,s.e)(this,tD).setBuffer(e,i),new eH(t,(0,s.e)(this,tD).int32(),(0,s.e)(this,tD).int32())},tK=function(e,t,i){(0,s.e)(this,tD).setBuffer(e,i);let n=(0,s.e)(this,tD).int32();switch(n){case 0:return new e_(t);case 3:return new eF(t);case 5:return new eQ(t,(0,s.e)(this,tD).bytes(4));case 10:{let e=[];for(;;){let i=(0,s.e)(this,tD).cstring();if(0===i.length)return new eB(t,e);e.push(i)}}case 11:return new eM(t,(0,s.e)(this,tD).string(t-8));case 12:return new eU(t,(0,s.e)(this,tD).string(t-8));default:throw Error("Unknown authenticationOk message type "+n)}},tJ=function(e,t,i,n){(0,s.e)(this,tD).setBuffer(e,i);let a={},l=(0,s.e)(this,tD).string(1);for(;"\0"!==l;)a[l]=(0,s.e)(this,tD).cstring(),l=(0,s.e)(this,tD).string(1);let o=a.M,u="notice"===n?new e2(t,o):new eV(o,t,n);return u.severity=a.S,u.code=a.C,u.detail=a.D,u.hint=a.H,u.position=a.P,u.internalPosition=a.p,u.internalQuery=a.q,u.where=a.W,u.schema=a.s,u.table=a.t,u.column=a.c,u.dataType=a.d,u.constraint=a.n,u.file=a.F,u.line=a.L,u.routine=a.R,u},(0,s.j)();var tH,tY="object"==typeof a&&"object"==typeof a.versions&&"string"==typeof a.versions.node;async function tZ(){!tY&&!tH&&(tH=fetch(new i.U(i(2286))))}async function t0(e,t){if(t||n)return WebAssembly.instantiate(t||n,e),{instance:await WebAssembly.instantiate(t||n,e),module:t||n};let s=new i.U(i(2286));if(tY){let t=await (await i.e(30040).then(i.t.bind(i,30040,23))).readFile(s),{module:a,instance:l}=await WebAssembly.instantiate(t,e);return n=a,{instance:l,module:a}}{tH||(tH=fetch(s));let t=await tH,{module:i,instance:a}=await WebAssembly.instantiateStreaming(t,e);return n=i,{instance:a,module:i}}}async function t1(){let e=new i.U(i(79974));return tY?(await (await i.e(30040).then(i.t.bind(i,30040,23))).readFile(e)).buffer:(await fetch(e)).arrayBuffer()}var t2=()=>{if(globalThis.crypto?.randomUUID)return globalThis.crypto.randomUUID();let e=new Uint8Array(16);if(globalThis.crypto?.getRandomValues)globalThis.crypto.getRandomValues(e);else for(let t=0;t<e.length;t++)e[t]=Math.floor(256*Math.random());e[6]=15&e[6]|64,e[8]=63&e[8]|128;let t=[];return e.forEach(e=>{t.push(e.toString(16).padStart(2,"0"))}),t.slice(0,4).join("")+"-"+t.slice(4,6).join("")+"-"+t.slice(6,8).join("")+"-"+t.slice(8,10).join("")+"-"+t.slice(10).join("")};async function t6(e,t,i,n){let s;if(!i||0===i.length)return t;n=n??e;try{await e.execProtocol(tb.parse({text:t}),{syncToFs:!1}),s=eA((await e.execProtocol(tb.describe({type:"S"}),{syncToFs:!1})).messages)}finally{await e.execProtocol(tb.sync(),{syncToFs:!1})}let a=t.replace(/\$([0-9]+)/g,(e,t)=>"%"+t+"L");return(await n.query(`SELECT format($1, ${i.map((e,t)=>`$${t+2}`).join(", ")}) as query`,[a,...i],{paramTypes:[y,...s]})).rows[0].query}function t8(e){return e.startsWith('"')&&e.endsWith('"')?e.substring(1,e.length-1):e.toLowerCase()}},52938:(e,t,i)=>{"use strict";i.d(t,{fd:()=>eT});var n=i(49613),s=i(6996);class a{static [s.i]="ConsoleLogWriter";write(e){console.log(e)}}class l{static [s.i]="DefaultLogger";writer;constructor(e){this.writer=e?.writer??new a}logQuery(e,t){let i=t.map(e=>{try{return JSON.stringify(e)}catch{return String(e)}}),n=i.length?` -- params: [${i.join(", ")}]`:"";this.writer.write(`Query: ${e}${n}`)}}class o{static [s.i]="NoopLogger";logQuery(){}}var u=i(80269),c=i(51320),h=i(4805),d=i(7272);class f{constructor(e){this.table=e}static [s.i]="ColumnAliasProxyHandler";get(e,t){return"table"===t?this.table:e[t]}}class p{constructor(e,t){this.alias=e,this.replaceOriginalName=t}static [s.i]="TableAliasProxyHandler";get(e,t){if(t===h.XI.Symbol.IsAlias)return!0;
1if(t===h.XI.Symbol.Name||this.replaceOriginalName&&t===h.XI.Symbol.OriginalName)return this.alias;if(t===d.n)return{...e[d.n],name:this.alias,isAlias:!0};if(t===h.XI.Symbol.Columns){let t=e[h.XI.Symbol.Columns];if(!t)return t;let i={};return Object.keys(t).map(n=>{i[n]=new Proxy(t[n],new f(new Proxy(e,this)))}),i}let i=e[t];return(0,s.is)(i,u.V)?new Proxy(i,new f(new Proxy(e,this))):i}}class g{constructor(e){this.alias=e}static [s.i]=null;get(e,t){return"sourceTable"===t?m(e.sourceTable,this.alias):e[t]}}function m(e,t){return new Proxy(e,new p(t,!1))}function y(e,t){return new Proxy(e,new f(new Proxy(e.table,new p(t,!1))))}function b(e,t){return new c.Xs.Aliased(w(e.sql,t),e.fieldAlias)}function w(e,t){return c.ll.join(e.queryChunks.map(e=>(0,s.is)(e,u.V)?y(e,t):(0,s.is)(e,c.Xs)?w(e,t):(0,s.is)(e,c.Xs.Aliased)?b(e,t):e))}function v(e){return(e.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map(e=>e.toLowerCase()).join("_")}function S(e){return(e.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((e,t,i)=>e+(0===i?t.toLowerCase():`${t[0].toUpperCase()}${t.slice(1)}`),"")}function x(e){return e}class T{static [s.i]="CasingCache";cache={};cachedTables={};convert;constructor(e){this.convert="snake_case"===e?v:"camelCase"===e?S:x}getColumnCasing(e){if(!e.keyAsName)return e.name;let t=e.table[h.XI.Symbol.Schema]??"public",i=e.table[h.XI.Symbol.OriginalName],n=`${t}.${i}.${e.name}`;return this.cache[n]||this.cacheTable(e.table),this.cache[n]}cacheTable(e){let t=e[h.XI.Symbol.Schema]??"public",i=e[h.XI.Symbol.OriginalName],n=`${t}.${i}`;if(!this.cachedTables[n]){for(let t of Object.values(e[h.XI.Symbol.Columns])){let e=`${n}.${t.name}`;this.cache[e]=this.convert(t.name)}this.cachedTables[n]=!0}}clearCache(){this.cache={},this.cachedTables={}}}class P extends Error{static [s.i]="DrizzleError";constructor({message:e,cause:t}){super(e),this.name="DrizzleError",this.cause=t}}class N extends P{static [s.i]="TransactionRollbackError";constructor(){super({message:"Rollback"})}}var C=i(21137),k=i(45169),A=i(45361),I=i(23966),D=i(33122),$=i(14145),L=i(26011),E=i(23116),j=i(42407),q=i(13432),O=i(55208),z=i(30433),_=i(44848);class F extends c.Ss{static [s.i]="PgViewBase"}class Q{static [s.i]="PgDialect";casing;constructor(e){this.casing=new T(e?.casing)}async migrate(e,t,i){let n="string"==typeof i?"__drizzle_migrations":i.migrationsTable??"__drizzle_migrations",s="string"==typeof i?"drizzle":i.migrationsSchema??"drizzle",a=(0,c.ll)` 2 CREATE TABLE IF NOT EXISTS ${c.ll.identifier(s)}.${c.ll.identifier(n)} ( 3 id SERIAL PRIMARY KEY, 4 hash text NOT NULL, 5 created_at bigint 6 ) 7 `;await t.execute((0,c.ll)`CREATE SCHEMA IF NOT EXISTS ${c.ll.identifier(s)}`),await t.execute(a);let l=(await t.all((0,c.ll)`select id, hash, created_at from ${c.ll.identifier(s)}.${c.ll.identifier(n)} order by created_at desc limit 1`))[0];await t.transaction(async t=>{for await(let i of e)if(!l||Number(l.created_at)<i.folderMillis){for(let e of i.sql)await t.execute(c.ll.raw(e));await t.execute((0,c.ll)`insert into ${c.ll.identifier(s)}.${c.ll.identifier(n)} ("hash", "created_at") values(${i.hash}, ${i.folderMillis})`)}})}escapeName(e){return`"${e}"`}escapeParam(e){return`$${e+1}`}escapeString(e){return`'${e.replace(/'/g,"''")}'`}buildWithCTE(e){if(!e?.length)return;let t=[(0,c.ll)`with `];for(let[i,n]of e.entries())t.push((0,c.ll)`${c.ll.identifier(n._.alias)} as (${n._.sql})`),i<e.length-1&&t.push((0,c.ll)`, `);return t.push((0,c.ll)` `),c.ll.join(t)}buildDeleteQuery({table:e,where:t,returning:i,withList:n}){let s=this.buildWithCTE(n),a=i?(0,c.ll)` returning ${this.buildSelection(i,{isSingleTable:!0})}`:void 0,l=t?(0,c.ll)` where ${t}`:void 0;return(0,c.ll)`${s}delete from ${e}${l}${a}`}buildUpdateSet(e,t){let i=e[h.XI.Symbol.Columns],n=Object.keys(i).filter(e=>void 0!==t[e]||i[e]?.onUpdateFn!==void 0),s=n.length;return c.ll.join(n.flatMap((e,n)=>{let a=i[e],l=t[e]??c.ll.param(a.onUpdateFn(),a),o=(0,c.ll)`${c.ll.identifier(this.casing.getColumnCasing(a))} = ${l}`;
7return n<s-1?[o,c.ll.raw(", ")]:[o]}))}buildUpdateQuery({table:e,set:t,where:i,returning:n,withList:s,from:a,joins:l}){let o=this.buildWithCTE(s),u=e[j.mu.Symbol.Name],h=e[j.mu.Symbol.Schema],d=e[j.mu.Symbol.OriginalName],f=u===d?void 0:u,p=(0,c.ll)`${h?(0,c.ll)`${c.ll.identifier(h)}.`:void 0}${c.ll.identifier(d)}${f&&(0,c.ll)` ${c.ll.identifier(f)}`}`,g=this.buildUpdateSet(e,t),m=a&&c.ll.join([c.ll.raw(" from "),this.buildFromTable(a)]),y=this.buildJoins(l),b=n?(0,c.ll)` returning ${this.buildSelection(n,{isSingleTable:!a})}`:void 0,w=i?(0,c.ll)` where ${i}`:void 0;return(0,c.ll)`${o}update ${p} set ${g}${m}${y}${w}${b}`}buildSelection(e,{isSingleTable:t=!1}={}){let i=e.length,n=e.flatMap(({field:e},n)=>{let a=[];if((0,s.is)(e,c.Xs.Aliased)&&e.isSelectionField)a.push(c.ll.identifier(e.fieldAlias));else if((0,s.is)(e,c.Xs.Aliased)||(0,s.is)(e,c.Xs)){let i=(0,s.is)(e,c.Xs.Aliased)?e.sql:e;t?a.push(new c.Xs(i.queryChunks.map(e=>(0,s.is)(e,C.Kl)?c.ll.identifier(this.casing.getColumnCasing(e)):e))):a.push(i),(0,s.is)(e,c.Xs.Aliased)&&a.push((0,c.ll)` as ${c.ll.identifier(e.fieldAlias)}`)}else(0,s.is)(e,u.V)&&(t?a.push(c.ll.identifier(this.casing.getColumnCasing(e))):a.push(e));return n<i-1&&a.push((0,c.ll)`, `),a});return c.ll.join(n)}buildJoins(e){if(!e||0===e.length)return;let t=[];for(let[i,n]of e.entries()){0===i&&t.push((0,c.ll)` `);let a=n.table,l=n.lateral?(0,c.ll)` lateral`:void 0;if((0,s.is)(a,j.mu)){let e=a[j.mu.Symbol.Name],i=a[j.mu.Symbol.Schema],s=a[j.mu.Symbol.OriginalName],o=e===s?void 0:n.alias;t.push((0,c.ll)`${c.ll.raw(n.joinType)} join${l} ${i?(0,c.ll)`${c.ll.identifier(i)}.`:void 0}${c.ll.identifier(s)}${o&&(0,c.ll)` ${c.ll.identifier(o)}`} on ${n.on}`)}else if((0,s.is)(a,c.Ss)){let e=a[d.n].name,i=a[d.n].schema,s=a[d.n].originalName,o=e===s?void 0:n.alias;t.push((0,c.ll)`${c.ll.raw(n.joinType)} join${l} ${i?(0,c.ll)`${c.ll.identifier(i)}.`:void 0}${c.ll.identifier(s)}${o&&(0,c.ll)` ${c.ll.identifier(o)}`} on ${n.on}`)}else t.push((0,c.ll)`${c.ll.raw(n.joinType)} join${l} ${a} on ${n.on}`);i<e.length-1&&t.push((0,c.ll)` `)}return c.ll.join(t)}buildFromTable(e){if((0,s.is)(e,h.XI)&&e[h.XI.Symbol.OriginalName]!==e[h.XI.Symbol.Name]){let t=(0,c.ll)`${c.ll.identifier(e[h.XI.Symbol.OriginalName])}`;return e[h.XI.Symbol.Schema]&&(t=(0,c.ll)`${c.ll.identifier(e[h.XI.Symbol.Schema])}.${t}`),(0,c.ll)`${t} ${c.ll.identifier(e[h.XI.Symbol.Name])}`}return e}buildSelectQuery({withList:e,fields:t,fieldsFlat:i,where:n,having:a,table:l,joins:o,orderBy:f,groupBy:p,limit:g,offset:m,lockingClause:y,distinct:b,setOperators:w}){let v,S,x;let T=i??(0,_.He)(t);for(let e of T){let t;if((0,s.is)(e.field,u.V)&&(0,h.Io)(e.field.table)!==((0,s.is)(l,z.n)?l._.alias:(0,s.is)(l,F)?l[d.n].name:(0,s.is)(l,c.Xs)?void 0:(0,h.Io)(l))&&(t=e.field.table,!o?.some(({alias:e})=>e===(t[h.XI.Symbol.IsAlias]?h.Io(t):t[h.XI.Symbol.BaseName])))){let t=(0,h.Io)(e.field.table);throw Error(`Your "${e.path.join("->")}" field references a column "${t}"."${e.field.name}", but the table "${t}" is not part of the query! Did you forget to join it?`)}}let P=!o||0===o.length,N=this.buildWithCTE(e);b&&(v=!0===b?(0,c.ll)` distinct`:(0,c.ll)` distinct on (${c.ll.join(b.on,(0,c.ll)`, `)})`);let C=this.buildSelection(T,{isSingleTable:P}),k=this.buildFromTable(l),A=this.buildJoins(o),I=n?(0,c.ll)` where ${n}`:void 0,D=a?(0,c.ll)` having ${a}`:void 0;f&&f.length>0&&(S=(0,c.ll)` order by ${c.ll.join(f,(0,c.ll)`, `)}`),p&&p.length>0&&(x=(0,c.ll)` group by ${c.ll.join(p,(0,c.ll)`, `)}`);let $="object"==typeof g||"number"==typeof g&&g>=0?(0,c.ll)` limit ${g}`:void 0,L=m?(0,c.ll)` offset ${m}`:void 0,E=c.ll.empty();if(y){let e=(0,c.ll)` for ${c.ll.raw(y.strength)}`;y.config.of&&e.append((0,c.ll)` of ${c.ll.join(Array.isArray(y.config.of)?y.config.of:[y.config.of],(0,c.ll)`, `)}`),y.config.noWait?e.append((0,c.ll)` no wait`):y.config.skipLocked&&e.append((0,c.ll)` skip locked`),E.append(e)}let j=(0,c.ll)`${N}select${v} ${C} from ${k}${A}${I}${x}${D}${S}${$}${L}${E}`;return w.length>0?this.buildSetOperations(j,w):j}buildSetOperations(e,t){let[i,...n]=t;if(!i)throw Error("Cannot pass undefined values to any set operator");
7return 0===n.length?this.buildSetOperationQuery({leftSelect:e,setOperator:i}):this.buildSetOperations(this.buildSetOperationQuery({leftSelect:e,setOperator:i}),n)}buildSetOperationQuery({leftSelect:e,setOperator:{type:t,isAll:i,rightSelect:n,limit:a,orderBy:l,offset:o}}){let u;let h=(0,c.ll)`(${e.getSQL()}) `,d=(0,c.ll)`(${n.getSQL()})`;if(l&&l.length>0){let e=[];for(let t of l)if((0,s.is)(t,C.Kl))e.push(c.ll.identifier(t.name));else if((0,s.is)(t,c.Xs)){for(let e=0;e<t.queryChunks.length;e++){let i=t.queryChunks[e];(0,s.is)(i,C.Kl)&&(t.queryChunks[e]=c.ll.identifier(i.name))}e.push((0,c.ll)`${t}`)}else e.push((0,c.ll)`${t}`);u=(0,c.ll)` order by ${c.ll.join(e,(0,c.ll)`, `)} `}let f="object"==typeof a||"number"==typeof a&&a>=0?(0,c.ll)` limit ${a}`:void 0,p=c.ll.raw(`${t} ${i?"all ":""}`),g=o?(0,c.ll)` offset ${o}`:void 0;return(0,c.ll)`${h}${p}${d}${u}${f}${g}`}buildInsertQuery({table:e,values:t,onConflict:i,returning:n,withList:a,select:l,overridingSystemValue_:o}){let u=[],d=Object.entries(e[h.XI.Symbol.Columns]).filter(([e,t])=>!t.shouldDisableInsert()),f=d.map(([,e])=>c.ll.identifier(this.casing.getColumnCasing(e)));if(l)(0,s.is)(t,c.Xs)?u.push(t):u.push(t.getSQL());else for(let[e,i]of(u.push(c.ll.raw("values ")),t.entries())){let n=[];for(let[e,t]of d){let a=i[e];if(void 0===a||(0,s.is)(a,c.Iw)&&void 0===a.value){if(void 0!==t.defaultFn){let e=t.defaultFn(),i=(0,s.is)(e,c.Xs)?e:c.ll.param(e,t);n.push(i)}else if(t.default||void 0===t.onUpdateFn)n.push((0,c.ll)`default`);else{let e=t.onUpdateFn(),i=(0,s.is)(e,c.Xs)?e:c.ll.param(e,t);n.push(i)}}else n.push(a)}u.push(n),e<t.length-1&&u.push((0,c.ll)`, `)}let p=this.buildWithCTE(a),g=c.ll.join(u),m=n?(0,c.ll)` returning ${this.buildSelection(n,{isSingleTable:!0})}`:void 0,y=i?(0,c.ll)` on conflict ${i}`:void 0,b=!0===o?(0,c.ll)`overriding system value `:void 0;return(0,c.ll)`${p}insert into ${e} ${f} ${b}${g}${y}${m}`}buildRefreshMaterializedViewQuery({view:e,concurrently:t,withNoData:i}){let n=t?(0,c.ll)` concurrently`:void 0,s=i?(0,c.ll)` with no data`:void 0;return(0,c.ll)`refresh materialized view${n} ${e}${s}`}prepareTyping(e){if((0,s.is)(e,k.kn)||(0,s.is)(e,A.iX))return"json";if((0,s.is)(e,I.Z5))return"decimal";if((0,s.is)(e,D.Xd))return"time";if((0,s.is)(e,$.KM)||(0,s.is)(e,$.xQ))return"timestamp";if((0,s.is)(e,L.qw)||(0,s.is)(e,L.dw))return"date";else if((0,s.is)(e,E.dL))return"uuid";else return"none"}sqlToQuery(e,t){return e.toQuery({casing:this.casing,escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,prepareTyping:this.prepareTyping,invokeSource:t})}buildRelationalQueryWithoutPK({fullSchema:e,schema:t,tableNamesMap:i,table:n,tableConfig:a,queryConfig:l,tableAlias:o,nestedQueryRelation:d,joinOn:f}){let p,g=[],v,S,x=[],T,N=[];if(!0===l)g=Object.entries(a.columns).map(([e,t])=>({dbKey:t.name,tsKey:e,field:y(t,o),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{let n=Object.fromEntries(Object.entries(a.columns).map(([e,t])=>[e,y(t,o)]));if(l.where){let e="function"==typeof l.where?l.where(n,(0,q.mm)()):l.where;T=e&&w(e,o)}let d=[],f=[];if(l.columns){let e=!1;for(let[t,i]of Object.entries(l.columns))void 0!==i&&t in a.columns&&(e||!0!==i||(e=!0),f.push(t));f.length>0&&(f=e?f.filter(e=>l.columns?.[e]===!0):Object.keys(a.columns).filter(e=>!f.includes(e)))}else f=Object.keys(a.columns);for(let e of f){let t=a.columns[e];d.push({tsKey:e,value:t})}let p=[];if(l.with&&(p=Object.entries(l.with).filter(e=>!!e[1]).map(([e,t])=>({tsKey:e,queryConfig:t,relation:a.relations[e]}))),l.extras)for(let[e,t]of Object.entries("function"==typeof l.extras?l.extras(n,{sql:c.ll}):l.extras))d.push({tsKey:e,value:b(t,o)});for(let{tsKey:e,value:t}of d)g.push({dbKey:(0,s.is)(t,c.Xs.Aliased)?t.fieldAlias:a.columns[e].name,tsKey:e,field:(0,s.is)(t,u.V)?y(t,o):t,relationTableTsKey:void 0,isJson:!1,selection:[]});let m="function"==typeof l.orderBy?l.orderBy(n,(0,q.rl)()):l.orderBy??[];for(let{tsKey:n,queryConfig:a,relation:d}of(Array.isArray(m)||(m=[m]),x=m.map(e=>(0,s.is)(e,u.V)?y(e,o):w(e,o)),v=l.limit,S=l.offset,p)){let l=(0,q.W0)(t,i,d),u=i[(0,h.Lf)(d.referencedTable)],f=`${o}_${n}`,p=(0,O.Uo)(...l.fields.map((e,t)=>(0,O.eq)(y(l.references[t],f),y(e,o)))),m=this.buildRelationalQueryWithoutPK({fullSchema:e,schema:t,tableNamesMap:i,table:e[u],tableConfig:t[u],queryConfig:(0,s.is)(d,q.pD)?!0===a?{limit:1}:{...a,limit:1}:a,tableAlias:f,joinOn:p,nestedQueryRelation:d}),b=(0,c.ll)`${c.ll.identifier(f)}.${c.ll.identifier("data")}`.as(n);N.push({on:(0,c.ll)`true`,table:new z.n(m.sql,{},f),alias:f,joinType:"left",lateral:!0}),g.push({dbKey:n,tsKey:n,field:b,relationTableTsKey:u,isJson:!0,selection:m.selection})}}if(0===g.length)throw new P({message:`No fields selected for table "${a.tsName}" ("${o}")`});if(T=(0,O.Uo)(f,T),d){let e=(0,c.ll)`json_build_array(${c.ll.join(g.map(({field:e,tsKey:t,isJson:i})=>i?(0,c.ll)`${c.ll.identifier(`${o}_${t}`)}.${c.ll.identifier("data")}`:(0,s.is)(e,c.Xs.Aliased)?e.sql:e),(0,c.ll)`, `)})`;(0,s.is)(d,q.iv)&&(e=(0,c.ll)`coalesce(json_agg(${e}${x.length>0?(0,c.ll)` order by ${c.ll.join(x,(0,c.ll)`, `)}`:void 0}), '[]'::json)`);let t=[{dbKey:"data",tsKey:"data",field:e.as("data"),isJson:!0,relationTableTsKey:a.tsName,selection:g}];void 0!==v||void 0!==S||x.length>0?(p=this.buildSelectQuery({table:m(n,o),fields:{},fieldsFlat:[{path:[],field:c.ll.raw("*")}],where:T,limit:v,offset:S,orderBy:x,setOperators:[]}),T=void 0,v=void 0,S=void 0,x=[]):p=m(n,o),p=this.buildSelectQuery({table:(0,s.is)(p,j.mu)?p:new z.n(p,{},o),fields:{},fieldsFlat:t.map(({field:e})=>({path:[],field:(0,s.is)(e,u.V)?y(e,o):e})),joins:N,where:T,limit:v,offset:S,orderBy:x,setOperators:[]})}else p=this.buildSelectQuery({table:m(n,o),fields:{},fieldsFlat:g.map(({field:e})=>({path:[],field:(0,s.is)(e,u.V)?y(e,o):e})),joins:N,where:T,limit:v,offset:S,orderBy:x,setOperators:[]});return{tableTsKey:a.tsName,sql:p,selection:g}}}class B{static [s.i]="SelectionProxyHandler";config;constructor(e){this.config={...e}}get(e,t){if("_"===t)return{...e._,selectedFields:new Proxy(e._.selectedFields,this)};if(t===d.n)return{...e[d.n],selectedFields:new Proxy(e[d.n].selectedFields,this)};if("symbol"==typeof t)return e[t];let i=((0,s.is)(e,z.n)?e._.selectedFields:(0,s.is)(e,c.Ss)?e[d.n].selectedFields:e)[t];if((0,s.is)(i,c.Xs.Aliased)){if("sql"===this.config.sqlAliasedBehavior&&!i.isSelectionField)return i.sql;let e=i.clone();return e.isSelectionField=!0,e}
7if((0,s.is)(i,c.Xs)){if("sql"===this.config.sqlBehavior)return i;throw Error(`You tried to reference "${t}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}return(0,s.is)(i,u.V)?this.config.alias?new Proxy(i,new f(new Proxy(i.table,new p(this.config.alias,this.config.replaceOriginalName??!1)))):i:"object"!=typeof i||null===i?i:new Proxy(i,new B(this.config))}}class M{static [s.i]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}}class U{static [s.i]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch(e){return this.then(void 0,e)}finally(e){return this.then(t=>(e?.(),t),t=>{throw e?.(),t})}then(e,t){return this.execute().then(e,t)}}var V=i(69133);class R{static [s.i]="PgSelectBuilder";fields;session;dialect;withList=[];distinct;constructor(e){this.fields=e.fields,this.session=e.session,this.dialect=e.dialect,e.withList&&(this.withList=e.withList),this.distinct=e.distinct}authToken;setToken(e){return this.authToken=e,this}from(e){let t;let i=!!this.fields;return t=this.fields?this.fields:(0,s.is)(e,z.n)?Object.fromEntries(Object.keys(e._.selectedFields).map(t=>[t,e[t]])):(0,s.is)(e,F)?e[d.n].selectedFields:(0,s.is)(e,c.Xs)?{}:(0,_.YD)(e),new K({table:e,fields:t,isPartialSelect:i,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct}).setToken(this.authToken)}}class X extends M{static [s.i]="PgSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;constructor({table:e,fields:t,isPartialSelect:i,session:n,dialect:s,withList:a,distinct:l}){super(),this.config={withList:a,table:e,fields:{...t},distinct:l,setOperators:[]},this.isPartialSelect=i,this.session=n,this.dialect=s,this._={selectedFields:t},this.tableName=(0,_.zN)(e),this.joinsNotNullableMap="string"==typeof this.tableName?{[this.tableName]:!0}:{}}createJoin(e){return(t,i)=>{let n=this.tableName,a=(0,_.zN)(t);if("string"==typeof a&&this.config.joins?.some(e=>e.alias===a))throw Error(`Alias "${a}" is already used in this query`);if(!this.isPartialSelect&&(1===Object.keys(this.joinsNotNullableMap).length&&"string"==typeof n&&(this.config.fields={[n]:this.config.fields}),"string"==typeof a&&!(0,s.is)(t,c.Xs))){let e=(0,s.is)(t,z.n)?t._.selectedFields:(0,s.is)(t,c.Ss)?t[d.n].selectedFields:t[h.XI.Symbol.Columns];this.config.fields[a]=e}if("function"==typeof i&&(i=i(new Proxy(this.config.fields,new B({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.joins||(this.config.joins=[]),this.config.joins.push({on:i,table:t,joinType:e,alias:a}),"string"==typeof a)switch(e){case"left":this.joinsNotNullableMap[a]=!1;break;case"right":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[a]=!0;break;case"inner":this.joinsNotNullableMap[a]=!0;break;case"full":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[a]=!1}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");createSetOperator(e,t){return i=>{let n="function"==typeof i?i(W()):i;if(!(0,_.DV)(this.getSelectedFields(),n.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:e,isAll:t,rightSelect:n}),this}}union=this.createSetOperator("union",!1);unionAll=this.createSetOperator("union",!0);intersect=this.createSetOperator("intersect",!1);intersectAll=this.createSetOperator("intersect",!0);except=this.createSetOperator("except",!1);exceptAll=this.createSetOperator("except",!0);addSetOperators(e){return this.config.setOperators.push(...e),this}where(e){return"function"==typeof e&&(e=e(new Proxy(this.config.fields,new B({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.where=e,this}having(e){return"function"==typeof e&&(e=e(new Proxy(this.config.fields,new B({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.having=e,this}groupBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.fields,new B({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(t)?t:[t]}else this.config.groupBy=e;return this}orderBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.fields,new B({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(t)?t:[t];this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=i:this.config.orderBy=i}else this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=e:this.config.orderBy=e;return this}limit(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).limit=e:this.config.limit=e,this}offset(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).offset=e:this.config.offset=e,this}for(e,t={}){return this.config.lockingClause={strength:e,config:t},this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}as(e){return new Proxy(new z.n(this.getSQL(),this.config.fields,e),new B({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new B({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}}class K extends X{static [s.i]="PgSelect";_prepare(e){let{session:t,config:i,dialect:n,joinsNotNullableMap:s,authToken:a}=this;if(!t)throw Error("Cannot execute a query on a query builder. Please use a database instance instead.");return V.k.startActiveSpan("drizzle.prepareQuery",()=>{let l=(0,_.He)(i.fields),o=t.prepareQuery(n.sqlToQuery(this.getSQL()),l,e,!0);return o.joinsNotNullableMap=s,o.setToken(a)})}prepare(e){return this._prepare(e)}authToken;setToken(e){return this.authToken=e,this}execute=e=>V.k.startActiveSpan("drizzle.operation",()=>this._prepare().execute(e,this.authToken))}function J(e,t){return(i,n,...s)=>{let a=[n,...s].map(i=>({type:e,isAll:t,rightSelect:i}));for(let e of a)if(!(0,_.DV)(i.getSelectedFields(),e.rightSelect.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return i.addSetOperators(a)}}(0,_.XJ)(K,[U]);let W=()=>({union:G,unionAll:H,intersect:Y,intersectAll:Z,except:ee,exceptAll:et}),G=J("union",!1),H=J("union",!0),Y=J("intersect",!1),Z=J("intersect",!0),ee=J("except",!1),et=J("except",!0);class ei{static [s.i]="PgQueryBuilder";dialect;dialectConfig;constructor(e){this.dialect=(0,s.is)(e,Q)?e:void 0,this.dialectConfig=(0,s.is)(e,Q)?void 0:e}$with=(e,t)=>{let i=this;return{as:n=>("function"==typeof n&&(n=n(i)),new Proxy(new z.J(n.getSQL(),t??("getSelectedFields"in n?n.getSelectedFields()??{}:{}),e,!0),new B({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}};with(...e){let t=this;return{select:function(i){return new R({fields:i??void 0,session:void 0,dialect:t.getDialect(),withList:e})},selectDistinct:function(e){return new R({fields:e??void 0,session:void 0,dialect:t.getDialect(),distinct:!0})},selectDistinctOn:function(e,i){return new R({fields:i??void 0,session:void 0,dialect:t.getDialect(),distinct:{on:e}})}}}select(e){return new R({fields:e??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct(e){return new R({fields:e??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}selectDistinctOn(e,t){return new R({fields:t??void 0,session:void 0,dialect:this.getDialect(),distinct:{on:e}})}getDialect(){return this.dialect||(this.dialect=new Q(this.dialectConfig)),this.dialect}}class er{constructor(e,t,i,n){this.table=e,this.session=t,this.dialect=i,this.withList=n}static [s.i]="PgUpdateBuilder";authToken;setToken(e){return this.authToken=e,this}set(e){return new en(this.table,(0,_.q)(this.table,e),this.session,this.dialect,this.withList).setToken(this.authToken)}}class en extends U{constructor(e,t,i,n,s){super(),this.session=i,this.dialect=n,this.config={set:t,table:e,withList:s,joins:[]},this.tableName=(0,_.zN)(e),this.joinsNotNullableMap="string"==typeof this.tableName?{[this.tableName]:!0}:{}}static [s.i]="PgUpdate";config;tableName;joinsNotNullableMap;from(e){let t=(0,_.zN)(e);return"string"==typeof t&&(this.joinsNotNullableMap[t]=!0),this.config.from=e,this}getTableLikeFields(e){return(0,s.is)(e,j.mu)?e[h.XI.Symbol.Columns]:(0,s.is)(e,z.n)?e._.selectedFields:e[d.n].selectedFields}createJoin(e){return(t,i)=>{let n=(0,_.zN)(t);if("string"==typeof n&&this.config.joins.some(e=>e.alias===n))throw Error(`Alias "${n}" is already used in this query`);
7if("function"==typeof i){let e=this.config.from&&!(0,s.is)(this.config.from,c.Xs)?this.getTableLikeFields(this.config.from):void 0;i=i(new Proxy(this.config.table[h.XI.Symbol.Columns],new B({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),e&&new Proxy(e,new B({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))}if(this.config.joins.push({on:i,table:t,joinType:e,alias:n}),"string"==typeof n)switch(e){case"left":this.joinsNotNullableMap[n]=!1;break;case"right":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[n]=!0;break;case"inner":this.joinsNotNullableMap[n]=!0;break;case"full":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[n]=!1}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");where(e){return this.config.where=e,this}returning(e){if(!e&&(e=Object.assign({},this.config.table[h.XI.Symbol.Columns]),this.config.from)){let t=(0,_.zN)(this.config.from);if("string"==typeof t&&this.config.from&&!(0,s.is)(this.config.from,c.Xs)){let i=this.getTableLikeFields(this.config.from);e[t]=i}for(let t of this.config.joins){let i=(0,_.zN)(t.table);if("string"==typeof i&&!(0,s.is)(t.table,c.Xs)){let n=this.getTableLikeFields(t.table);e[i]=n}}}return this.config.returningFields=e,this.config.returning=(0,_.He)(e),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e){let t=this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,e,!0);return t.joinsNotNullableMap=this.joinsNotNullableMap,t}prepare(e){return this._prepare(e)}authToken;setToken(e){return this.authToken=e,this}execute=e=>this._prepare().execute(e,this.authToken);getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new B({alias:(0,h.Io)(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}class es{constructor(e,t,i,n,s){this.table=e,this.session=t,this.dialect=i,this.withList=n,this.overridingSystemValue_=s}static [s.i]="PgInsertBuilder";authToken;setToken(e){return this.authToken=e,this}overridingSystemValue(){return this.overridingSystemValue_=!0,this}values(e){if(0===(e=Array.isArray(e)?e:[e]).length)throw Error("values() must be called with at least one value");let t=e.map(e=>{let t={},i=this.table[h.XI.Symbol.Columns];for(let n of Object.keys(e)){let a=e[n];t[n]=(0,s.is)(a,c.Xs)?a:new c.Iw(a,i[n])}return t});return new ea(this.table,t,this.session,this.dialect,this.withList,!1,this.overridingSystemValue_).setToken(this.authToken)}select(e){let t="function"==typeof e?e(new ei):e;if(!(0,s.is)(t,c.Xs)&&!(0,_.DV)(this.table[h.e],t._.selectedFields))throw Error("Insert select error: selected fields are not the same or are in a different order compared to the table definition");return new ea(this.table,t,this.session,this.dialect,this.withList,!0)}}class ea extends U{constructor(e,t,i,n,s,a,l){super(),this.session=i,this.dialect=n,this.config={table:e,values:t,withList:s,select:a,overridingSystemValue_:l}}static [s.i]="PgInsert";config;returning(e=this.config.table[h.XI.Symbol.Columns]){return this.config.returningFields=e,this.config.returning=(0,_.He)(e),this}onConflictDoNothing(e={}){if(void 0===e.target)this.config.onConflict=(0,c.ll)`do nothing`;else{let t="";t=Array.isArray(e.target)?e.target.map(e=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(e))).join(","):this.dialect.escapeName(this.dialect.casing.getColumnCasing(e.target));let i=e.where?(0,c.ll)` where ${e.where}`:void 0;this.config.onConflict=(0,c.ll)`(${c.ll.raw(t)})${i} do nothing`}return this}onConflictDoUpdate(e){if(e.where&&(e.targetWhere||e.setWhere))throw Error('You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.');let t=e.where?(0,c.ll)` where ${e.where}`:void 0,i=e.targetWhere?(0,c.ll)` where ${e.targetWhere}`:void 0,n=e.setWhere?(0,c.ll)` where ${e.setWhere}`:void 0,s=this.dialect.buildUpdateSet(this.config.table,(0,_.q)(this.config.table,e.set)),a="";return a=Array.isArray(e.target)?e.target.map(e=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(e))).join(","):this.dialect.escapeName(this.dialect.casing.getColumnCasing(e.target)),this.config.onConflict=(0,c.ll)`(${c.ll.raw(a)})${i} do update set ${s}${t}${n}`,this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e){return V.k.startActiveSpan("drizzle.prepareQuery",()=>this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,e,!0))}prepare(e){return this._prepare(e)}authToken;setToken(e){return this.authToken=e,this}execute=e=>V.k.startActiveSpan("drizzle.operation",()=>this._prepare().execute(e,this.authToken));getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new B({alias:(0,h.Io)(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}class el extends U{constructor(e,t,i,n){super(),this.session=t,this.dialect=i,this.config={table:e,withList:n}}static [s.i]="PgDelete";config;where(e){return this.config.where=e,this}returning(e=this.config.table[h.XI.Symbol.Columns]){return this.config.returningFields=e,this.config.returning=(0,_.He)(e),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e){return V.k.startActiveSpan("drizzle.prepareQuery",()=>this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,e,!0))}prepare(e){return this._prepare(e)}authToken;setToken(e){return this.authToken=e,this}execute=e=>V.k.startActiveSpan("drizzle.operation",()=>this._prepare().execute(e,this.authToken));getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new B({alias:(0,h.Io)(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}class eo extends c.Xs{constructor(e){super(eo.buildEmbeddedCount(e.source,e.filters).queryChunks),this.params=e,this.mapWith(Number),this.session=e.session,this.sql=eo.buildCount(e.source,e.filters)}sql;token;static [s.i]="PgCountBuilder";[Symbol.toStringTag]="PgCountBuilder";session;static buildEmbeddedCount(e,t){return(0,c.ll)`(select count(*) from ${e}${c.ll.raw(" where ").if(t)}${t})`}static buildCount(e,t){return(0,c.ll)`select count(*) as count from ${e}${c.ll.raw(" where ").if(t)}${t};`}setToken(e){return this.token=e,this}then(e,t){return Promise.resolve(this.session.count(this.sql,this.token)).then(e,t)}catch(e){return this.then(void 0,e)}finally(e){return this.then(t=>(e?.(),t),t=>{throw e?.(),t})}}class eu{constructor(e,t,i,n,s,a,l){this.fullSchema=e,this.schema=t,this.tableNamesMap=i,this.table=n,this.tableConfig=s,this.dialect=a,this.session=l}static [s.i]="PgRelationalQueryBuilder";findMany(e){return new ec(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e||{},"many")}findFirst(e){return new ec(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?{...e,limit:1}:{limit:1},"first")}}class ec extends U{constructor(e,t,i,n,s,a,l,o,u){super(),this.fullSchema=e,this.schema=t,this.tableNamesMap=i,this.table=n,this.tableConfig=s,this.dialect=a,this.session=l,this.config=o,this.mode=u}static [s.i]="PgRelationalQuery";_prepare(e){return V.k.startActiveSpan("drizzle.prepareQuery",()=>{let{query:t,builtQuery:i}=this._toSQL();return this.session.prepareQuery(i,void 0,e,!0,(e,i)=>{let n=e.map(e=>(0,q.I$)(this.schema,this.tableConfig,e,t.selection,i));return"first"===this.mode?n[0]:n})})}prepare(e){return this._prepare(e)}_getQuery(){return this.dialect.buildRelationalQueryWithoutPK({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName})}getSQL(){return this._getQuery().sql}_toSQL(){let e=this._getQuery(),t=this.dialect.sqlToQuery(e.sql);return{query:e,builtQuery:t}}toSQL(){return this._toSQL().builtQuery}authToken;setToken(e){return this.authToken=e,this}execute(){return V.k.startActiveSpan("drizzle.operation",()=>this._prepare().execute(void 0,this.authToken))}}class eh extends U{constructor(e,t,i,n){super(),this.execute=e,this.sql=t,this.query=i,this.mapBatchResult=n}static [s.i]="PgRaw";getSQL(){return this.sql}getQuery(){return this.query}mapResult(e,t){return t?this.mapBatchResult(e):e}_prepare(){return this}isResponseInArrayMode(){return!1}}class ed extends U{constructor(e,t,i){super(),this.session=t,this.dialect=i,this.config={view:e}}static [s.i]="PgRefreshMaterializedView";config;concurrently(){if(void 0!==this.config.withNoData)throw Error("Cannot use concurrently and withNoData together");return this.config.concurrently=!0,this}withNoData(){if(void 0!==this.config.concurrently)throw Error("Cannot use concurrently and withNoData together");return this.config.withNoData=!0,this}getSQL(){return this.dialect.buildRefreshMaterializedViewQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e){return V.k.startActiveSpan("drizzle.prepareQuery",()=>this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),void 0,e,!0))}prepare(e){return this._prepare(e)}authToken;setToken(e){return this.authToken=e,this}execute=e=>V.k.startActiveSpan("drizzle.operation",()=>this._prepare().execute(e,this.authToken))}class ef{constructor(e,t,i){if(this.dialect=e,this.session=t,this._=i?{schema:i.schema,fullSchema:i.fullSchema,tableNamesMap:i.tableNamesMap,session:t}:{schema:void 0,fullSchema:{},tableNamesMap:{},session:t},this.query={},this._.schema)for(let[n,s]of Object.entries(this._.schema))this.query[n]=new eu(i.fullSchema,this._.schema,this._.tableNamesMap,i.fullSchema[n],s,e,t)}static [s.i]="PgDatabase";query;$with=(e,t)=>{let i=this;return{as:n=>("function"==typeof n&&(n=n(new ei(i.dialect))),new Proxy(new z.J(n.getSQL(),t??("getSelectedFields"in n?n.getSelectedFields()??{}:{}),e,!0),new B({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}};$count(e,t){return new eo({source:e,filters:t,session:this.session})}with(...e){let t=this;return{select:function(i){return new R({fields:i??void 0,session:t.session,dialect:t.dialect,withList:e})},selectDistinct:function(i){return new R({fields:i??void 0,session:t.session,dialect:t.dialect,withList:e,distinct:!0})},selectDistinctOn:function(i,n){return new R({fields:n??void 0,session:t.session,dialect:t.dialect,withList:e,distinct:{on:i}})},update:function(i){return new er(i,t.session,t.dialect,e)},insert:function(i){return new es(i,t.session,t.dialect,e)},delete:function(i){return new el(i,t.session,t.dialect,e)}}}select(e){return new R({fields:e??void 0,session:this.session,dialect:this.dialect})}selectDistinct(e){return new R({fields:e??void 0,session:this.session,dialect:this.dialect,distinct:!0})}selectDistinctOn(e,t){return new R({fields:t??void 0,session:this.session,dialect:this.dialect,distinct:{on:e}})}update(e){return new er(e,this.session,this.dialect)}insert(e){return new es(e,this.session,this.dialect)}delete(e){return new el(e,this.session,this.dialect)}refreshMaterializedView(e){return new ed(e,this.session,this.dialect)}authToken;execute(e){let t="string"==typeof e?c.ll.raw(e):e.getSQL(),i=this.dialect.sqlToQuery(t),n=this.session.prepareQuery(i,void 0,void 0,!1);return new eh(()=>n.execute(void 0,this.authToken),t,i,e=>n.mapResult(e,!0))}transaction(e,t){return this.session.transaction(e,t)}}class ep{constructor(e){this.query=e}authToken;getQuery(){return this.query}mapResult(e,t){return e}setToken(e){return this.authToken=e,this}static [s.i]="PgPreparedQuery";joinsNotNullableMap}class eg{constructor(e){this.dialect=e}static [s.i]="PgSession";execute(e,t){return V.k.startActiveSpan("drizzle.operation",()=>V.k.startActiveSpan("drizzle.prepareQuery",()=>this.prepareQuery(this.dialect.sqlToQuery(e),void 0,void 0,!1)).setToken(t).execute(void 0,t))}all(e){return this.prepareQuery(this.dialect.sqlToQuery(e),void 0,void 0,!1).all()}async count(e,t){return Number((await this.execute(e,t))[0].count)}
7}class em extends ef{constructor(e,t,i,n=0){super(e,t,i),this.schema=i,this.nestedIndex=n}static [s.i]="PgTransaction";rollback(){throw new N}getTransactionConfigSQL(e){let t=[];return e.isolationLevel&&t.push(`isolation level ${e.isolationLevel}`),e.accessMode&&t.push(e.accessMode),"boolean"==typeof e.deferrable&&t.push(e.deferrable?"deferrable":"not deferrable"),c.ll.raw(t.join(" "))}setTransaction(e){return this.session.execute((0,c.ll)`set transaction ${this.getTransactionConfigSQL(e)}`)}}class ey extends ep{constructor(e,t,i,s,a,l,o,u){super({sql:t,params:i}),this.client=e,this.queryString=t,this.params=i,this.logger=s,this.fields=a,this._isResponseInArrayMode=o,this.customResultMapper=u,this.rawQueryConfig={rowMode:"object",parsers:{[n.types.TIMESTAMP]:e=>e,[n.types.TIMESTAMPTZ]:e=>e,[n.types.INTERVAL]:e=>e,[n.types.DATE]:e=>e}},this.queryConfig={rowMode:"array",parsers:{[n.types.TIMESTAMP]:e=>e,[n.types.TIMESTAMPTZ]:e=>e,[n.types.INTERVAL]:e=>e,[n.types.DATE]:e=>e}}}static [s.i]="PglitePreparedQuery";rawQueryConfig;queryConfig;async execute(e={}){let t=(0,c.Ct)(this.params,e);this.logger.logQuery(this.queryString,t);let{fields:i,rawQueryConfig:n,client:s,queryConfig:a,joinsNotNullableMap:l,customResultMapper:o,queryString:u}=this;if(!i&&!o)return s.query(u,t,n);let h=await s.query(u,t,a);return o?o(h.rows):h.rows.map(e=>(0,_.a6)(i,e,l))}all(e={}){let t=(0,c.Ct)(this.params,e);return this.logger.logQuery(this.queryString,t),this.client.query(this.queryString,t,this.rawQueryConfig).then(e=>e.rows)}isResponseInArrayMode(){return this._isResponseInArrayMode}}class eb extends eg{constructor(e,t,i,n={}){super(t),this.client=e,this.schema=i,this.options=n,this.logger=n.logger??new o}static [s.i]="PgliteSession";logger;prepareQuery(e,t,i,n,s){return new ey(this.client,e.sql,e.params,this.logger,t,i,n,s)}async transaction(e,t){return this.client.transaction(async i=>{let n=new eb(i,this.dialect,this.schema,this.options),s=new ew(this.dialect,n,this.schema);return t&&await s.setTransaction(t),e(s)})}async count(e){return Number((await this.execute(e)).rows[0].count)}}class ew extends em{static [s.i]="PgliteTransaction";async transaction(e){let t=`sp${this.nestedIndex+1}`,i=new ew(this.dialect,this.session,this.schema,this.nestedIndex+1);await i.execute(c.ll.raw(`savepoint ${t}`));try{let n=await e(i);return await i.execute(c.ll.raw(`release savepoint ${t}`)),n}catch(e){throw await i.execute(c.ll.raw(`rollback to savepoint ${t}`)),e}}}class ev{constructor(e,t,i={}){this.client=e,this.dialect=t,this.options=i}static [s.i]="PgliteDriver";createSession(e){return new eb(this.client,this.dialect,e,{logger:this.options.logger})}}class eS extends ef{static [s.i]="PgliteDatabase"}function ex(e,t={}){let i,n;let s=new Q({casing:t.casing});if(!0===t.logger?i=new l:!1!==t.logger&&(i=t.logger),t.schema){let e=(0,q._k)(t.schema,q.DZ);n={fullSchema:t.schema,schema:e.tables,tableNamesMap:e.tableNamesMap}}let a=new ev(e,s,{logger:i}).createSession(n),o=new eS(s,a,n);return o.$client=e,o}function eT(...e){if(void 0===e[0]||"string"==typeof e[0])return ex(new n.PGlite(e[0]),e[1]);if((0,_.Lq)(e[0])){let{connection:t,client:i,...s}=e[0];if(i)return ex(i,s);if("object"==typeof t){let{dataDir:e,...i}=t;return ex(new n.PGlite(e,i),s)}return ex(new n.PGlite(t),s)}return ex(e[0],e[1])}(eT||(eT={})).mock=function(e){return ex({},e)}},55208:(e,t,i)=>{"use strict";i.d(t,{AU:()=>f,B3:()=>A,KJ:()=>T,KL:()=>w,Pe:()=>S,RK:()=>k,RO:()=>g,RV:()=>b,Tq:()=>P,Uo:()=>h,eq:()=>u,gt:()=>p,kZ:()=>v,lt:()=>m,mj:()=>C,ne:()=>c,o8:()=>N,or:()=>d,q1:()=>I,t2:()=>x,wJ:()=>y});var n=i(80269),s=i(6996),a=i(4805),l=i(51320);function o(e,t){return!(0,l.eG)(t)||(0,l.qt)(e)||(0,s.is)(e,l.Iw)||(0,s.is)(e,l.Or)||(0,s.is)(e,n.V)||(0,s.is)(e,a.XI)||(0,s.is)(e,l.Ss)?e:new l.Iw(e,t)}let u=(e,t)=>(0,l.ll)`${e} = ${o(t,e)}`,c=(e,t)=>(0,l.ll)`${e} <> ${o(t,e)}`;function h(...e){let t=e.filter(e=>void 0!==e);return 0===t.length?void 0:new l.Xs(1===t.length?t:[new l.DJ("("),l.ll.join(t,new l.DJ(" and ")),new l.DJ(")")])}function d(...e){let t=e.filter(e=>void 0!==e);return 0===t.length?void 0:new l.Xs(1===t.length?t:[new l.DJ("("),l.ll.join(t,new l.DJ(" or ")),new l.DJ(")")])}function f(e){return(0,l.ll)`not ${e}`}let p=(e,t)=>(0,l.ll)`${e} > ${o(t,e)}`,g=(e,t)=>(0,l.ll)`${e} >= ${o(t,e)}`,m=(e,t)=>
7(0,l.ll)`${e} < ${o(t,e)}`,y=(e,t)=>(0,l.ll)`${e} <= ${o(t,e)}`;function b(e,t){return Array.isArray(t)?0===t.length?(0,l.ll)`false`:(0,l.ll)`${e} in ${t.map(t=>o(t,e))}`:(0,l.ll)`${e} in ${o(t,e)}`}function w(e,t){return Array.isArray(t)?0===t.length?(0,l.ll)`true`:(0,l.ll)`${e} not in ${t.map(t=>o(t,e))}`:(0,l.ll)`${e} not in ${o(t,e)}`}function v(e){return(0,l.ll)`${e} is null`}function S(e){return(0,l.ll)`${e} is not null`}function x(e){return(0,l.ll)`exists ${e}`}function T(e){return(0,l.ll)`not exists ${e}`}function P(e,t,i){return(0,l.ll)`${e} between ${o(t,e)} and ${o(i,e)}`}function N(e,t,i){return(0,l.ll)`${e} not between ${o(t,e)} and ${o(i,e)}`}function C(e,t){return(0,l.ll)`${e} like ${t}`}function k(e,t){return(0,l.ll)`${e} not like ${t}`}function A(e,t){return(0,l.ll)`${e} ilike ${t}`}function I(e,t){return(0,l.ll)`${e} not ilike ${t}`}},56970:(e,t,i)=>{"use strict";i.d(t,{E:()=>n});let n=Symbol.for("drizzle:Name")},59882:(e,t,i)=>{"use strict";i.d(t,{hv:()=>l,ie:()=>a});var n=i(6996),s=i(42407);function a(...e){return e[0].columns?new l(e[0].columns,e[0].name):new l(e)}class l{static [n.i]="PgPrimaryKeyBuilder";columns;name;constructor(e,t){this.columns=e,this.name=t}build(e){return new o(e,this.columns,this.name)}}class o{constructor(e,t,i){this.table=e,this.columns=t,this.name=i}static [n.i]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[s.mu.Symbol.Name]}_${this.columns.map(e=>e.name).join("_")}_pk`}}},60270:(e,t,i)=>{var n=i(26701),s=i(884),a=i(63718),l=i(95522),o=i(78736),u=i(75652),c=i(46648);c.alea=n,c.xor128=s,c.xorwow=a,c.xorshift7=l,c.xor4096=o,c.tychei=u,e.exports=c},62207:(e,t,i)=>{"use strict";i.d(t,{nd:()=>u});var n=i(6996),s=i(21137),a=i(84875);class l extends a.p{static [n.i]="PgIntegerBuilder";constructor(e){super(e,"number","PgInteger")}build(e){return new o(e,this.config)}}class o extends s.Kl{static [n.i]="PgInteger";getSQLType(){return"integer"}mapFromDriverValue(e){return"string"==typeof e?Number.parseInt(e):e}}function u(e){return new l(e??"")}},63228:(e,t,i)=>{"use strict";i.d(t,{tO:()=>o,yf:()=>u});var n=i(6996),s=i(44848),a=i(21137);class l extends a.pe{static [n.i]="PgVarcharBuilder";constructor(e,t){super(e,"string","PgVarchar"),this.config.length=t.length,this.config.enumValues=t.enum}build(e){return new o(e,this.config)}}class o extends a.Kl{static [n.i]="PgVarchar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return void 0===this.length?"varchar":`varchar(${this.length})`}}function u(e,t={}){let{name:i,config:n}=(0,s.Ll)(e,t);return new l(i,n)}},63718:function(e,t,i){var n;!function(e,s,a){function l(e){var t=this,i="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^(e^e<<1))|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:i+=e;for(var n=0;n<i.length+64;n++)t.x^=0|i.charCodeAt(n),n==i.length&&(t.d=t.x<<10^t.x>>>4),t.next()}function o(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function u(e,t){var i=new l(e),n=t&&t.state,s=function(){return(i.next()>>>0)/0x100000000};return s.double=function(){do var e=((i.next()>>>11)+(i.next()>>>0)/0x100000000)/2097152;while(0===e);return e},s.int32=i.next,s.quick=s,n&&("object"==typeof n&&o(n,i),s.state=function(){return o(i,{})}),s}s&&s.exports?s.exports=u:i.amdD&&i.amdO?void 0!==(n=(function(){return u}).call(t,i,t,s))&&(s.exports=n):this.xorwow=u}(0,e=i.nmd(e),i.amdD)},65677:(e,t,i)=>{"use strict";i.d(t,{r:()=>U,aJ:()=>V});var n=i(44848),s=i(6996),a=i(16739),l=i(80269),o=i(56970);class u{static [s.i]="MySqlForeignKeyBuilder";reference;_onUpdate;_onDelete;constructor(e,t){this.reference=()=>{let{name:t,columns:i,foreignColumns:n}=e();return{name:t,columns:i,foreignTable:n[0].table,foreignColumns:n}},t&&(this._onUpdate=t.onUpdate,this._onDelete=t.onDelete)}onUpdate(e){return this._onUpdate=e,this}onDelete(e){return this._onDelete=e,this}build(e){return new c(e,this)}}class c{constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}static [s.i]="MySqlForeignKey";reference;onUpdate;onDelete;getName(){let{name:e,columns:t,foreignColumns:i}=this.reference(),n=t.map(e=>e.name),s=i.map(e=>e.name),a=[this.table[o.E],...n,i[0].table[o.E],...s];return e??`${a.join("_")}_fk`}}function h(e,t){return`${e[o.E]}_${t.join("_")}_unique`}class d{constructor(e,t){this.name=t,this.columns=e}static [s.i]=null;columns;build(e){return new p(e,this.columns,this.name)}}class f{static [s.i]=null;name;constructor(e){this.name=e}on(...e){return new d(e,this.name)}}class p{constructor(e,t,i){this.table=e,this.columns=t,this.name=i??h(this.table,this.columns.map(e=>e.name))}static [s.i]=null;columns;name;nullsNotDistinct=!1;getName(){return this.name}}class g extends a.Q{static [s.i]="MySqlColumnBuilder";foreignKeyConfigs=[];references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e){return this.config.isUnique=!0,this.config.uniqueName=e,this}generatedAlwaysAs(e,t){return this.config.generated={as:e,type:"always",mode:t?.mode??"virtual"},this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:i,actions:n})=>((i,n)=>{let s=new u(()=>({columns:[e],foreignColumns:[i()]}));return n.onUpdate&&s.onUpdate(n.onUpdate),n.onDelete&&s.onDelete(n.onDelete),s.build(t)})(i,n))}}class m extends l.V{constructor(e,t){t.uniqueName||(t.uniqueName=h(e,[t.name])),super(e,t),this.table=e}static [s.i]="MySqlColumn"}class y extends g{static [s.i]="MySqlColumnBuilderWithAutoIncrement";constructor(e,t,i){super(e,t,i),this.config.autoIncrement=!1}autoincrement(){return this.config.autoIncrement=!0,this.config.hasDefault=!0,this}}class b extends null{static [s.i]=null;autoIncrement=this.config.autoIncrement}class w extends g{static [s.i]="MySqlVarCharBuilder";constructor(e,t){super(e,"string","MySqlVarChar"),this.config.length=t.length,this.config.enum=t.enum}build(e){return new v(e,this.config)}}class v extends m{static [s.i]="MySqlVarChar";length=this.config.length;enumValues=this.config.enum;getSQLType(){return void 0===this.length?"varchar":`varchar(${this.length})`}}class S extends g{static [s.i]="MySqlVarBinaryBuilder";constructor(e,t){super(e,"string","MySqlVarBinary"),this.config.length=t?.length}build(e){return new x(e,this.config)}}class x extends m{static [s.i]="MySqlVarBinary";length=this.config.length;getSQLType(){return void 0===this.length?"varbinary":`varbinary(${this.length})`}}class T extends g{static [s.i]="MySqlCharBuilder";constructor(e,t){super(e,"string","MySqlChar"),this.config.length=t.length,this.config.enum=t.enum}build(e){return new P(e,this.config)}}class P extends m{static [s.i]="MySqlChar";length=this.config.length;enumValues=this.config.enum;getSQLType(){return void 0===this.length?"char":`char(${this.length})`}}var N=i(23116),C=i(40068),k=i(63228);class A{static [s.i]="SQLiteForeignKeyBuilder";reference;
7_onUpdate;_onDelete;constructor(e,t){this.reference=()=>{let{name:t,columns:i,foreignColumns:n}=e();return{name:t,columns:i,foreignTable:n[0].table,foreignColumns:n}},t&&(this._onUpdate=t.onUpdate,this._onDelete=t.onDelete)}onUpdate(e){return this._onUpdate=e,this}onDelete(e){return this._onDelete=e,this}build(e){return new I(e,this)}}class I{constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}static [s.i]="SQLiteForeignKey";reference;onUpdate;onDelete;getName(){let{name:e,columns:t,foreignColumns:i}=this.reference(),n=t.map(e=>e.name),s=i.map(e=>e.name),a=[this.table[o.E],...n,i[0].table[o.E],...s];return e??`${a.join("_")}_fk`}}function D(e,t){return`${e[o.E]}_${t.join("_")}_unique`}class ${constructor(e,t){this.name=t,this.columns=e}static [s.i]=null;columns;build(e){return new E(e,this.columns,this.name)}}class L{static [s.i]=null;name;constructor(e){this.name=e}on(...e){return new $(e,this.name)}}class E{constructor(e,t,i){this.table=e,this.columns=t,this.name=i??D(this.table,this.columns.map(e=>e.name))}static [s.i]=null;columns;name;getName(){return this.name}}class j extends a.Q{static [s.i]="SQLiteColumnBuilder";foreignKeyConfigs=[];references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e){return this.config.isUnique=!0,this.config.uniqueName=e,this}generatedAlwaysAs(e,t){return this.config.generated={as:e,type:"always",mode:t?.mode??"virtual"},this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:i,actions:n})=>((i,n)=>{let s=new A(()=>({columns:[e],foreignColumns:[i()]}));return n.onUpdate&&s.onUpdate(n.onUpdate),n.onDelete&&s.onDelete(n.onDelete),s.build(t)})(i,n))}}class q extends l.V{constructor(e,t){t.uniqueName||(t.uniqueName=D(e,[t.name])),super(e,t),this.table=e}static [s.i]="SQLiteColumn"}class O extends j{static [s.i]="SQLiteTextBuilder";constructor(e,t){super(e,"string","SQLiteText"),this.config.enumValues=t.enum,this.config.length=t.length}build(e){return new z(e,this.config)}}class z extends q{static [s.i]="SQLiteText";enumValues=this.config.enumValues;length=this.config.length;constructor(e,t){super(e,t)}getSQLType(){return`text${this.config.length?`(${this.config.length})`:""}`}}
7class _ extends j{static [s.i]="SQLiteTextJsonBuilder";constructor(e){super(e,"json","SQLiteTextJson")}build(e){return new F(e,this.config)}}class F extends q{static [s.i]="SQLiteTextJson";getSQLType(){return"text"}mapFromDriverValue(e){return JSON.parse(e)}mapToDriverValue(e){return JSON.stringify(e)}}var Q=i(75452);let B=Q.z.union([Q.z.string(),Q.z.number(),Q.z.boolean(),Q.z.null()]),M=Q.z.lazy(()=>Q.z.union([B,Q.z.array(M),Q.z.record(M)]));function U(e,t){let i=Object.entries((0,n.YD)(e)),s=Object.fromEntries(i.map(([e,t])=>[e,R(t)]));for(let[e,n]of(t&&(s=Object.assign(s,Object.fromEntries(Object.entries(t).map(([e,t])=>[e,"function"==typeof t?t(s):t])))),i))n.notNull?n.hasDefault&&(s[e]=s[e].optional()):s[e]=s[e].nullable().optional();return Q.z.object(s)}function V(e,t){let i=Object.entries((0,n.YD)(e)),s=Object.fromEntries(i.map(([e,t])=>[e,R(t)]));for(let[e,n]of(t&&(s=Object.assign(s,Object.fromEntries(Object.entries(t).map(([e,t])=>[e,"function"==typeof t?t(s):t])))),i))n.notNull||(s[e]=s[e].nullable());return Q.z.object(s)}function R(e){let t;if("enumValues"in e&&Array.isArray(e.enumValues)&&e.enumValues.length>0&&(t=e.enumValues.length?Q.z.enum(e.enumValues):Q.z.string()),!t){if((0,s.is)(e,N.dL))t=Q.z.string().uuid();else if("custom"===e.dataType)t=Q.z.any();else if("json"===e.dataType)t=M;else if("array"===e.dataType)t=Q.z.array(R(e.baseColumn));else if("number"===e.dataType)t=Q.z.number();else if("bigint"===e.dataType)t=Q.z.bigint();else if("boolean"===e.dataType)t=Q.z.boolean();else if("date"===e.dataType)t=Q.z.date();else if("string"===e.dataType){let i=Q.z.string();((0,s.is)(e,C.gH)||(0,s.is)(e,k.tO)||(0,s.is)(e,v)||(0,s.is)(e,x)||(0,s.is)(e,P)||(0,s.is)(e,z))&&"number"==typeof e.length&&(i=i.max(e.length)),t=i}}return t||(t=Q.z.any()),t}},69133:(e,t,i)=>{"use strict";let n,s;i.d(t,{k:()=>l});var a=i(7307);let l={startActiveSpan:(e,t)=>n?(s||(s=n.trace.getTracer("drizzle-orm","0.40.0")),(0,a.i)((i,n)=>n.startActiveSpan(e,e=>{try{return t(e)}catch(t){throw e.setStatus({code:i.SpanStatusCode.ERROR,message:t instanceof Error?t.message:"Unknown error"}),t}finally{e.end()}}),n,s)):t()}},72068:(e,t,i)=>{"use strict";i.d(t,{i1:()=>u});var n=i(6996),s=i(44848),a=i(21137);class l extends a.pe{static [n.i]="PgVectorBuilder";constructor(e,t){super(e,"array","PgVector"),this.config.dimensions=t.dimensions}build(e){return new o(e,this.config)}}class o extends a.Kl{static [n.i]="PgVector";dimensions=this.config.dimensions;getSQLType(){return`vector(${this.dimensions})`}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){return e.slice(1,-1).split(",").map(e=>Number.parseFloat(e))}}function u(e,t){let{name:i,config:n}=(0,s.Ll)(e,t);return new l(i,n)}},73568:(e,t,i)=>{"use strict";i.d(t,{Qq:()=>u});var n=i(6996),s=i(44848),a=i(21137);class l extends a.pe{static [n.i]="PgTextBuilder";constructor(e,t){super(e,"string","PgText"),this.config.enumValues=t.enum}build(e){return new o(e,this.config)}}class o extends a.Kl{static [n.i]="PgText";enumValues=this.config.enumValues;getSQLType(){return"text"}}function u(e,t={}){let{name:i,config:n}=(0,s.Ll)(e,t);return new l(i,n)}},75652:function(e,t,i){var n;!function(e,s,a){function l(e){var t=this,i="";t.next=function(){var e=t.b,i=t.c,n=t.d,s=t.a;return e=e<<25^e>>>7^i,i=i-n|0,n=n<<24^n>>>8^s,s=s-e|0,t.b=e=e<<20^e>>>12^i,t.c=i=i-n|0,t.d=n<<16^i>>>16^s,t.a=s-e|0},t.a=0,t.b=0,t.c=-0x61c88647,t.d=0x517cc1b7,e===Math.floor(e)?(t.a=e/0x100000000|0,t.b=0|e):i+=e;for(var n=0;n<i.length+20;n++)t.b^=0|i.charCodeAt(n),t.next()}function o(e,t){return t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t}function u(e,t){var i=new l(e),n=t&&t.state,s=function(){return(i.next()>>>0)/0x100000000};return s.double=function(){do var e=((i.next()>>>11)+(i.next()>>>0)/0x100000000)/2097152;while(0===e);return e},s.int32=i.next,s.quick=s,n&&("object"==typeof n&&o(n,i),s.state=function(){return o(i,{})}),s}s&&s.exports?s.exports=u:i.amdD&&i.amdO?void 0!==(n=(function(){return u}).call(t,i,t,s))&&(s.exports=n):this.tychei=u}(0,e=i.nmd(e),i.amdD)},77653:(e,t,i)=>{"use strict";i.d(t,{zM:()=>o});var n=i(6996),s=i(21137);class a extends s.pe{static [n.i]="PgBooleanBuilder";constructor(e){super(e,"boolean","PgBoolean")}build(e){return new l(e,this.config)}}class l extends s.Kl{static [n.i]="PgBoolean";getSQLType(){return"boolean"}}function o(e){return new a(e??"")}},78736:function(e,t,i){var n;!function(e,s,a){function l(e){var t=this;
7t.next=function(){var e,i,n=t.w,s=t.X,a=t.i;return t.w=n=n+0x61c88647|0,i=s[a+34&127],e=s[a=a+1&127],i^=i<<13,e^=e<<17,i^=i>>>15,e^=e>>>12,i=s[a]=i^e,t.i=a,i+(n^n>>>16)|0},!function(e,t){var i,n,s,a,l,o=[],u=128;for(t===(0|t)?(n=t,t=null):(t+="\0",n=0,u=Math.max(u,t.length)),s=0,a=-32;a<u;++a)t&&(n^=t.charCodeAt((a+32)%t.length)),0===a&&(l=n),n^=n<<10,n^=n>>>15,n^=n<<4,n^=n>>>13,a>=0&&(l=l+0x61c88647|0,s=0==(i=o[127&a]^=n+l)?s+1:0);for(s>=128&&(o[127&(t&&t.length||0)]=-1),s=127,a=512;a>0;--a)n=o[s+34&127],i=o[s=s+1&127],n^=n<<13,i^=i<<17,n^=n>>>15,i^=i>>>12,o[s]=n^i;e.w=l,e.X=o,e.i=s}(t,e)}function o(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function u(e,t){null==e&&(e=+new Date);var i=new l(e),n=t&&t.state,s=function(){return(i.next()>>>0)/0x100000000};return s.double=function(){do var e=((i.next()>>>11)+(i.next()>>>0)/0x100000000)/2097152;while(0===e);return e},s.int32=i.next,s.quick=s,n&&(n.X&&o(n,i),s.state=function(){return o(i,{})}),s}s&&s.exports?s.exports=u:i.amdD&&i.amdO?void 0!==(n=(function(){return u}).call(t,i,t,s))&&(s.exports=n):this.xor4096=u}(0,e=i.nmd(e),i.amdD)},79974:(e,t,i)=>{"use strict";e.exports=i.p+"static/media/postgres.37e5aa16.data"},80269:(e,t,i)=>{"use strict";i.d(t,{V:()=>s});var n=i(6996);class s{constructor(e,t){this.table=e,this.config=t,this.name=t.name,this.keyAsName=t.keyAsName,this.notNull=t.notNull,this.default=t.default,this.defaultFn=t.defaultFn,this.onUpdateFn=t.onUpdateFn,this.hasDefault=t.hasDefault,this.primary=t.primaryKey,this.isUnique=t.isUnique,this.uniqueName=t.uniqueName,this.uniqueType=t.uniqueType,this.dataType=t.dataType,this.columnType=t.columnType,this.generated=t.generated,this.generatedIdentity=t.generatedIdentity}static [n.i]="Column";name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;config;mapFromDriverValue(e){return e}mapToDriverValue(e){return e}shouldDisableInsert(){return void 0!==this.config.generated&&"byDefault"!==this.config.generated.type}}},84341:(e,t,i)=>{"use strict";i.d(t,{GL:()=>h,Pe:()=>c});var n=i(51320),s=i(6996),a=i(21137);class l{constructor(e,t){this.unique=e,this.name=t}static [s.i]="PgIndexBuilderOn";on(...e){return new o(e.map(e=>{if((0,s.is)(e,n.Xs))return e;let t=new a.ae(e.name,!!e.keyAsName,e.columnType,e.indexConfig);return e.indexConfig=JSON.parse(JSON.stringify(e.defaultConfig)),t}),this.unique,!1,this.name)}onOnly(...e){return new o(e.map(e=>{if((0,s.is)(e,n.Xs))return e;let t=new a.ae(e.name,!!e.keyAsName,e.columnType,e.indexConfig);return e.indexConfig=e.defaultConfig,t}),this.unique,!0,this.name)}using(e,...t){return new o(t.map(e=>{if((0,s.is)(e,n.Xs))return e;let t=new a.ae(e.name,!!e.keyAsName,e.columnType,e.indexConfig);return e.indexConfig=JSON.parse(JSON.stringify(e.defaultConfig)),t}),this.unique,!0,this.name,e)}}class o{static [s.i]="PgIndexBuilder";config;constructor(e,t,i,n,s="btree"){this.config={name:n,columns:e,unique:t,only:i,method:s}}concurrently(){return this.config.concurrently=!0,this}with(e){return this.config.with=e,this}where(e){return this.config.where=e,this}build(e){return new u(this.config,e)}}class u{static [s.i]="PgIndex";config;constructor(e,t){this.config={...e,table:t}}}function c(e){return new l(!1,e)}function h(e){return new l(!0,e)}},84875:(e,t,i)=>{"use strict";i.d(t,{p:()=>a});var n=i(6996),s=i(21137);class a extends s.pe{static [n.i]="PgIntColumnBaseBuilder";generatedAlwaysAsIdentity(e){if(e){let{name:t,...i}=e;this.config.generatedIdentity={type:"always",sequenceName:t,sequenceOptions:i}}else this.config.generatedIdentity={type:"always"};return this.config.hasDefault=!0,this.config.notNull=!0,this}generatedByDefaultAsIdentity(e){if(e){let{name:t,...i}=e;this.config.generatedIdentity={type:"byDefault",sequenceName:t,sequenceOptions:i}}else this.config.generatedIdentity={type:"byDefault"};return this.config.hasDefault=!0,this.config.notNull=!0,this}}},86411:(e,t,i)=>{"use strict";i.d(t,{d:()=>a}),(0,i(9102).j)();var n={part:"part",container:"container"};function s(e,t,...i){let n=e.length-1,a=i.length-1;if(-1!==a){if(0===a){e[n]=e[n]+i[0]+t;return}e[n]=e[n]+i[0],e.push(...i.slice(1,a)),e.push(i[a]+t)}}function a(e,...t){let{strings:i,values:l}=function(e,...t){let i=[e[0]];i.raw=[e.raw[0]];let a=[];for(let l=0;l<t.length;l++){let o=t[l],u=l+1;if(o?._templateType===n.part){s(i,e[u],o.str),s(i.raw,e.raw[u],o.str);continue}if(o?._templateType===n.container){s(i,e[u],...o.strings),s(i.raw,e.raw[u],...o.strings.raw),a.push(...o.values);continue}i.push(e[u]),i.raw.push(e.raw[u]),a.push(o)}return{_templateType:"container",strings:i,values:a}}(e,...t);return{query:[i[0],...l.flatMap((e,t)=>[`$${t+1}`,i[t+1]])].join(""),params:l}}},89045:(e,t,i)=>{"use strict";i.d(t,{d:()=>n});let n=(e,t=21)=>(i=t)=>{let n="",s=0|i;for(;s--;)n+=e[Math.random()*e.length|0];return n}},90706:(e,t,i)=>{"use strict";i.d(t,{u:()=>l});var n=i(6996),s=i(51320),a=i(21137);class l extends a.pe{static [n.i]="PgDateColumnBaseBuilder";defaultNow(){return this.default((0,s.ll)`now()`)}}},95522:function(e,t,i){var n;!function(e,s,a){function l(e){var t=this;t.next=function(){var e,i,n=t.x,s=t.i;return e=n[s],e^=e>>>7,i=e^e<<24^((e=n[s+1&7])^e>>>10)^((e=n[s+3&7])^e>>>3)^((e=n[s+4&7])^e<<7),e=n[s+7&7],e^=e<<13,i^=e^e<<9,n[s]=i,t.i=s+1&7,i},!function(e,t){var i,n=[];if(t===(0|t))n[0]=t;else for(i=0,t=""+t;i<t.length;++i)n[7&i]=n[7&i]<<15^t.charCodeAt(i)+n[i+1&7]<<13;for(;n.length<8;)n.push(0);for(i=0;i<8&&0===n[i];++i);for(8==i?n[7]=-1:n[i],e.x=n,e.i=0,i=256;i>0;--i)e.next()}(t,e)}function o(e,t){return t.x=e.x.slice(),t.i=e.i,t}function u(e,t){null==e&&(e=+new Date);var i=new l(e),n=t&&t.state,s=function(){return(i.next()>>>0)/0x100000000};return s.double=function(){do var e=((i.next()>>>11)+(i.next()>>>0)/0x100000000)/2097152;while(0===e);return e}
7,s.int32=i.next,s.quick=s,n&&(n.x&&o(n,i),s.state=function(){return o(i,{})}),s}s&&s.exports?s.exports=u:i.amdD&&i.amdO?void 0!==(n=(function(){return u}).call(t,i,t,s))&&(s.exports=n):this.xorshift7=u}(0,e=i.nmd(e),i.amdD)},98316:(e,t,i)=>{"use strict";i.d(t,{Am:()=>a,Wx:()=>l});var n=i(6996),s=i(56970);function a(e){return new u(e)}function l(e,t){return`${e[s.E]}_${t.join("_")}_unique`}class o{constructor(e,t){this.name=t,this.columns=e}static [n.i]="PgUniqueConstraintBuilder";columns;nullsNotDistinctConfig=!1;nullsNotDistinct(){return this.nullsNotDistinctConfig=!0,this}build(e){return new c(e,this.columns,this.nullsNotDistinctConfig,this.name)}}class u{static [n.i]="PgUniqueOnConstraintBuilder";name;constructor(e){this.name=e}on(...e){return new o(e,this.name)}}class c{constructor(e,t,i,n){this.table=e,this.columns=t,this.name=n??l(this.table,this.columns.map(e=>e.name)),this.nullsNotDistinct=i}static [n.i]="PgUniqueConstraint";columns;name;nullsNotDistinct=!1;getName(){return this.name}}},99439:(e,t,i)=>{"use strict";i.d(t,{a:()=>p});var n=i(52015),s=i(86411),a=i(9102);(0,a.j)();var l,o,u,c,h,d,f,p=class{constructor(){(0,a.f)(this,u),this.serializers={...n.b},this.parsers={...n.a},(0,a.f)(this,l,!1),(0,a.f)(this,o,!1)}async _initArrayTypes({force:e=!1}={}){if(!(0,a.e)(this,l)||e)for(let e of((0,a.g)(this,l,!0),(await this.query(` 8 SELECT b.oid, b.typarray 9 FROM pg_catalog.pg_type a 10 LEFT JOIN pg_catalog.pg_type b ON b.oid = a.typelem 11 WHERE a.typcategory = 'A' 12 GROUP BY b.oid, b.typarray 13 ORDER BY b.oid 14 `)).rows))this.serializers[e.typarray]=t=>(0,n.c)(t,this.serializers[e.oid],e.typarray),this.parsers[e.typarray]=t=>(0,n.d)(t,this.parsers[e.oid],e.typarray)}async refreshArrayTypes(){await this._initArrayTypes({force:!0})}async query(e,t,i){return await this._checkReady(),await this._runExclusiveTransaction(async()=>await (0,a.h)(this,u,h).call(this,e,t,i))}async sql(e,...t){let{query:i,params:n}=(0,s.d)(e,...t);return await this.query(i,n)}async exec(e,t){return await this._checkReady(),await this._runExclusiveTransaction(async()=>await (0,a.h)(this,u,d).call(this,e,t))}async describeQuery(e,t){try{await (0,a.h)(this,u,c).call(this,n.i.parse({text:e,types:t?.paramTypes}),t);let i=await (0,a.h)(this,u,c).call(this,n.i.describe({type:"S"}),t),s=i.messages.find(e=>"parameterDescription"===e.name),l=i.messages.find(e=>"rowDescription"===e.name),o=s?.dataTypeIDs.map(e=>({dataTypeID:e,serializer:this.serializers[e]}))??[],h=l?.fields.map(e=>({name:e.name,dataTypeID:e.dataTypeID,parser:this.parsers[e.dataTypeID]}))??[];return{queryParams:o,resultFields:h}}finally{await (0,a.h)(this,u,c).call(this,n.i.sync(),t)}}async transaction(e){return await this._checkReady(),await this._runExclusiveTransaction(async()=>{await (0,a.h)(this,u,d).call(this,"BEGIN"),(0,a.g)(this,o,!0);let t=!1,i=()=>{if(t)throw Error("Transaction is closed")};try{let n=await e({query:async(e,t,n)=>(i(),await (0,a.h)(this,u,h).call(this,e,t,n)),sql:async(e,...t)=>{let{query:i,params:n}=(0,s.d)(e,...t);return await (0,a.h)(this,u,h).call(this,i,n)},exec:async(e,t)=>(i(),await (0,a.h)(this,u,d).call(this,e,t)),rollback:async()=>{i(),await (0,a.h)(this,u,d).call(this,"ROLLBACK"),t=!0},get closed(){return t}});return t||(t=!0,await (0,a.h)(this,u,d).call(this,"COMMIT")),(0,a.g)(this,o,!1),n}catch(e){throw t||await (0,a.h)(this,u,d).call(this,"ROLLBACK"),(0,a.g)(this,o,!1),e}})}async runExclusive(e){return await this._runExclusiveQuery(e)}};l=new WeakMap,o=new WeakMap,u=new WeakSet,c=async function(e,t={}){return await this.execProtocol(e,{...t,syncToFs:!1})},h=async function(e,t=[],i){return await this._runExclusiveQuery(async()=>{let s;(0,a.h)(this,u,f).call(this,"runQuery",e,t,i),await this._handleBlob(i?.blob);try{let{messages:l}=await (0,a.h)(this,u,c).call(this,n.i.parse({text:e,types:i?.paramTypes}),i),o=(0,n.g)((await (0,a.h)(this,u,c).call(this,n.i.describe({type:"S"}),i)).messages),h=t.map((e,t)=>{let n=o[t];if(null==e)return null;let s=i?.serializers?.[n]??this.serializers[n];return s?s(e):e.toString()});s=[...l,...(await (0,a.h)(this,u,c).call(this,n.i.bind({values:h}),i)).messages,...(await (0,a.h)(this,u,c).call(this,n.i.describe({type:"P"}),i)).messages,...(await (0,a.h)(this,u,c).call(this,n.i.execute({}),i)).messages]}finally{await (0,a.h)(this,u,c).call(this,n.i.sync(),i)}await this._cleanupBlob(),(0,a.e)(this,o)||await this.syncToFs();let l=await this._getWrittenBlob();return(0,n.f)(s,this.parsers,i,l)[0]})},d=async function(e,t){return await this._runExclusiveQuery(async()=>{let i;(0,a.h)(this,u,f).call(this,"runExec",e,t),await this._handleBlob(t?.blob);try{i=(await (0,a.h)(this,u,c).call(this,n.i.query(e),t)).messages}finally{await (0,a.h)(this,u,c).call(this,n.i.sync(),t)}this._cleanupBlob(),(0,a.e)(this,o)||await this.syncToFs();let s=await this._getWrittenBlob();return(0,n.f)(i,this.parsers,t,s)})},f=function(...e){this.debug>0&&console.log(...e)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.