diff --git a/assets/index-acb9cdff.js b/assets/index-acb9cdff.js new file mode 100644 index 0000000..49cc3c6 --- /dev/null +++ b/assets/index-acb9cdff.js @@ -0,0 +1,15 @@ +var qm=Object.defineProperty;var Wm=(t,e,n)=>e in t?qm(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Yt=(t,e,n)=>(Wm(t,typeof e!="symbol"?e+"":e,n),n),Tl=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)};var r=(t,e,n)=>(Tl(t,e,"read from private field"),n?n.call(t):e.get(t)),S=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},P=(t,e,n,i)=>(Tl(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n);var qe=(t,e,n)=>(Tl(t,e,"access private method"),n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))i(a);new MutationObserver(a=>{for(const l of a)if(l.type==="childList")for(const m of l.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&i(m)}).observe(document,{childList:!0,subtree:!0});function n(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(a){if(a.ep)return;a.ep=!0;const l=n(a);fetch(a.href,l)}})();function bf(t,e){const n=Object.create(null),i=t.split(",");for(let a=0;a!!n[a.toLowerCase()]:a=>!!n[a]}function Nf(t){if(Ie(t)){const e={};for(let n=0;n{if(n){const i=n.split(Am);i.length>1&&(e[i[0].trim()]=i[1].trim())}}),e}function vf(t){let e="";if(Lt(t))e=t;else if(Ie(t))for(let n=0;nLt(t)?t:t==null?"":Ie(t)||yt(t)&&(t.toString===Ed||!Se(t.toString))?JSON.stringify(t,vd,2):String(t),vd=(t,e)=>e&&e.__v_isRef?vd(t,e.value):eo(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((n,[i,a])=>(n[`${i} =>`]=a,n),{})}:_d(e)?{[`Set(${e.size})`]:[...e.values()]}:yt(e)&&!Ie(e)&&!Cd(e)?String(e):e,lt={},Zs=[],dr=()=>{},Lm=()=>!1,Pm=/^on[^a-z]/,sl=t=>Pm.test(t),_f=t=>t.startsWith("onUpdate:"),on=Object.assign,xf=(t,e)=>{const n=t.indexOf(e);n>-1&&t.splice(n,1)},Mm=Object.prototype.hasOwnProperty,Be=(t,e)=>Mm.call(t,e),Ie=Array.isArray,eo=t=>ol(t)==="[object Map]",_d=t=>ol(t)==="[object Set]",Se=t=>typeof t=="function",Lt=t=>typeof t=="string",Ef=t=>typeof t=="symbol",yt=t=>t!==null&&typeof t=="object",xd=t=>yt(t)&&Se(t.then)&&Se(t.catch),Ed=Object.prototype.toString,ol=t=>Ed.call(t),Bm=t=>ol(t).slice(8,-1),Cd=t=>ol(t)==="[object Object]",Cf=t=>Lt(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Ju=bf(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),al=t=>{const e=Object.create(null);return n=>e[n]||(e[n]=t(n))},Fm=/-(\w)/g,ko=al(t=>t.replace(Fm,(e,n)=>n?n.toUpperCase():"")),Um=/\B([A-Z])/g,$o=al(t=>t.replace(Um,"-$1").toLowerCase()),Od=al(t=>t.charAt(0).toUpperCase()+t.slice(1)),Sl=al(t=>t?`on${Od(t)}`:""),Wa=(t,e)=>!Object.is(t,e),kl=(t,e)=>{for(let n=0;n{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})},$m=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let rh;const Qm=()=>rh||(rh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});let er;class jm{constructor(e=!1){this.detached=e,this._active=!0,this.effects=[],this.cleanups=[],this.parent=er,!e&&er&&(this.index=(er.scopes||(er.scopes=[])).push(this)-1)}get active(){return this._active}run(e){if(this._active){const n=er;try{return er=this,e()}finally{er=n}}}on(){er=this}off(){er=this.parent}stop(e){if(this._active){let n,i;for(n=0,i=this.effects.length;n{const e=new Set(t);return e.w=0,e.n=0,e},qd=t=>(t.w&vi)>0,Wd=t=>(t.n&vi)>0,zm=({deps:t})=>{if(t.length)for(let e=0;e{const{deps:e}=t;if(e.length){let n=0;for(let i=0;i{(W==="length"||W>=v)&&w.push(d)})}else switch(n!==void 0&&w.push(m.get(n)),e){case"add":Ie(t)?Cf(n)&&w.push(m.get("length")):(w.push(m.get(Ns)),eo(t)&&w.push(m.get(Vl)));break;case"delete":Ie(t)||(w.push(m.get(Ns)),eo(t)&&w.push(m.get(Vl)));break;case"set":eo(t)&&w.push(m.get(Ns));break}if(w.length===1)w[0]&&zl(w[0]);else{const v=[];for(const d of w)d&&v.push(...d);zl(Of(v))}}function zl(t,e){const n=Ie(t)?t:[...t];for(const i of n)i.computed&&sh(i);for(const i of n)i.computed||sh(i)}function sh(t,e){(t!==cr||t.allowRecurse)&&(t.scheduler?t.scheduler():t.run())}const Jm=bf("__proto__,__v_isRef,__isVue"),Td=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(Ef)),Gm=Wf(),Xm=Wf(!1,!0),Ym=Wf(!0),oh=Zm();function Zm(){const t={};return["includes","indexOf","lastIndexOf"].forEach(e=>{t[e]=function(...n){const i=Fe(this);for(let l=0,m=this.length;l{t[e]=function(...n){Qo();const i=Fe(this)[e].apply(this,n);return jo(),i}}),t}function ey(t){const e=Fe(this);return xn(e,"has",t),e.hasOwnProperty(t)}function Wf(t=!1,e=!1){return function(i,a,l){if(a==="__v_isReactive")return!t;if(a==="__v_isReadonly")return t;if(a==="__v_isShallow")return e;if(a==="__v_raw"&&l===(t?e?yy:Ld:e?Dd:Rd).get(i))return i;const m=Ie(i);if(!t){if(m&&Be(oh,a))return Reflect.get(oh,a,l);if(a==="hasOwnProperty")return ey}const w=Reflect.get(i,a,l);return(Ef(a)?Td.has(a):Jm(a))||(t||xn(i,"get",a),e)?w:rn(w)?m&&Cf(a)?w:w.value:yt(w)?t?Pd(w):Tf(w):w}}const ty=Sd(),ny=Sd(!0);function Sd(t=!1){return function(n,i,a,l){let m=n[i];if(Ro(m)&&rn(m)&&!rn(a))return!1;if(!t&&(!ac(a)&&!Ro(a)&&(m=Fe(m),a=Fe(a)),!Ie(n)&&rn(m)&&!rn(a)))return m.value=a,!0;const w=Ie(n)&&Cf(i)?Number(i)t,ul=t=>Reflect.getPrototypeOf(t);function Bu(t,e,n=!1,i=!1){t=t.__v_raw;const a=Fe(t),l=Fe(e);n||(e!==l&&xn(a,"get",e),xn(a,"get",l));const{has:m}=ul(a),w=i?If:n?kf:Ia;if(m.call(a,e))return w(t.get(e));if(m.call(a,l))return w(t.get(l));t!==a&&t.get(e)}function Fu(t,e=!1){const n=this.__v_raw,i=Fe(n),a=Fe(t);return e||(t!==a&&xn(i,"has",t),xn(i,"has",a)),t===a?n.has(t):n.has(t)||n.has(a)}function Uu(t,e=!1){return t=t.__v_raw,!e&&xn(Fe(t),"iterate",Ns),Reflect.get(t,"size",t)}function ah(t){t=Fe(t);const e=Fe(this);return ul(e).has.call(e,t)||(e.add(t),jr(e,"add",t,t)),this}function uh(t,e){e=Fe(e);const n=Fe(this),{has:i,get:a}=ul(n);let l=i.call(n,t);l||(t=Fe(t),l=i.call(n,t));const m=a.call(n,t);return n.set(t,e),l?Wa(e,m)&&jr(n,"set",t,e):jr(n,"add",t,e),this}function ch(t){const e=Fe(this),{has:n,get:i}=ul(e);let a=n.call(e,t);a||(t=Fe(t),a=n.call(e,t)),i&&i.call(e,t);const l=e.delete(t);return a&&jr(e,"delete",t,void 0),l}function lh(){const t=Fe(this),e=t.size!==0,n=t.clear();return e&&jr(t,"clear",void 0,void 0),n}function $u(t,e){return function(i,a){const l=this,m=l.__v_raw,w=Fe(m),v=e?If:t?kf:Ia;return!t&&xn(w,"iterate",Ns),m.forEach((d,W)=>i.call(a,v(d),v(W),l))}}function Qu(t,e,n){return function(...i){const a=this.__v_raw,l=Fe(a),m=eo(l),w=t==="entries"||t===Symbol.iterator&&m,v=t==="keys"&&m,d=a[t](...i),W=n?If:e?kf:Ia;return!e&&xn(l,"iterate",v?Vl:Ns),{next(){const{value:F,done:U}=d.next();return U?{value:F,done:U}:{value:w?[W(F[0]),W(F[1])]:W(F),done:U}},[Symbol.iterator](){return this}}}}function ni(t){return function(...e){return t==="delete"?!1:this}}function uy(){const t={get(l){return Bu(this,l)},get size(){return Uu(this)},has:Fu,add:ah,set:uh,delete:ch,clear:lh,forEach:$u(!1,!1)},e={get(l){return Bu(this,l,!1,!0)},get size(){return Uu(this)},has:Fu,add:ah,set:uh,delete:ch,clear:lh,forEach:$u(!1,!0)},n={get(l){return Bu(this,l,!0)},get size(){return Uu(this,!0)},has(l){return Fu.call(this,l,!0)},add:ni("add"),set:ni("set"),delete:ni("delete"),clear:ni("clear"),forEach:$u(!0,!1)},i={get(l){return Bu(this,l,!0,!0)},get size(){return Uu(this,!0)},has(l){return Fu.call(this,l,!0)},add:ni("add"),set:ni("set"),delete:ni("delete"),clear:ni("clear"),forEach:$u(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(l=>{t[l]=Qu(l,!1,!1),n[l]=Qu(l,!0,!1),e[l]=Qu(l,!1,!0),i[l]=Qu(l,!0,!0)}),[t,n,e,i]}const[cy,ly,fy,hy]=uy();function Af(t,e){const n=e?t?hy:fy:t?ly:cy;return(i,a,l)=>a==="__v_isReactive"?!t:a==="__v_isReadonly"?t:a==="__v_raw"?i:Reflect.get(Be(n,a)&&a in i?n:i,a,l)}const dy={get:Af(!1,!1)},py={get:Af(!1,!0)},my={get:Af(!0,!1)},Rd=new WeakMap,Dd=new WeakMap,Ld=new WeakMap,yy=new WeakMap;function wy(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function gy(t){return t.__v_skip||!Object.isExtensible(t)?0:wy(Bm(t))}function Tf(t){return Ro(t)?t:Sf(t,!1,kd,dy,Rd)}function by(t){return Sf(t,!1,ay,py,Dd)}function Pd(t){return Sf(t,!0,oy,my,Ld)}function Sf(t,e,n,i,a){if(!yt(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const l=a.get(t);if(l)return l;const m=gy(t);if(m===0)return t;const w=new Proxy(t,m===2?i:n);return a.set(t,w),w}function to(t){return Ro(t)?to(t.__v_raw):!!(t&&t.__v_isReactive)}function Ro(t){return!!(t&&t.__v_isReadonly)}function ac(t){return!!(t&&t.__v_isShallow)}function Md(t){return to(t)||Ro(t)}function Fe(t){const e=t&&t.__v_raw;return e?Fe(e):t}function Bd(t){return oc(t,"__v_skip",!0),t}const Ia=t=>yt(t)?Tf(t):t,kf=t=>yt(t)?Pd(t):t;function Fd(t){gi&&cr&&(t=Fe(t),Ad(t.dep||(t.dep=Of())))}function Ud(t,e){t=Fe(t);const n=t.dep;n&&zl(n)}function rn(t){return!!(t&&t.__v_isRef===!0)}function Ny(t){return vy(t,!1)}function vy(t,e){return rn(t)?t:new _y(t,e)}class _y{constructor(e,n){this.__v_isShallow=n,this.dep=void 0,this.__v_isRef=!0,this._rawValue=n?e:Fe(e),this._value=n?e:Ia(e)}get value(){return Fd(this),this._value}set value(e){const n=this.__v_isShallow||ac(e)||Ro(e);e=n?e:Fe(e),Wa(e,this._rawValue)&&(this._rawValue=e,this._value=n?e:Ia(e),Ud(this))}}function $d(t){return rn(t)?t.value:t}const xy={get:(t,e,n)=>$d(Reflect.get(t,e,n)),set:(t,e,n,i)=>{const a=t[e];return rn(a)&&!rn(n)?(a.value=n,!0):Reflect.set(t,e,n,i)}};function Qd(t){return to(t)?t:new Proxy(t,xy)}var jd;class Ey{constructor(e,n,i,a){this._setter=n,this.dep=void 0,this.__v_isRef=!0,this[jd]=!1,this._dirty=!0,this.effect=new qf(e,()=>{this._dirty||(this._dirty=!0,Ud(this))}),this.effect.computed=this,this.effect.active=this._cacheable=!a,this.__v_isReadonly=i}get value(){const e=Fe(this);return Fd(e),(e._dirty||!e._cacheable)&&(e._dirty=!1,e._value=e.effect.run()),e._value}set value(e){this._setter(e)}}jd="__v_isReadonly";function Cy(t,e,n=!1){let i,a;const l=Se(t);return l?(i=t,a=dr):(i=t.get,a=t.set),new Ey(i,a,l||!a,n)}function bi(t,e,n,i){let a;try{a=i?t(...i):t()}catch(l){cl(l,e,n)}return a}function Hn(t,e,n,i){if(Se(t)){const l=bi(t,e,n,i);return l&&xd(l)&&l.catch(m=>{cl(m,e,n)}),l}const a=[];for(let l=0;l>>1;Ta(nn[i])qr&&nn.splice(e,1)}function Ay(t){Ie(t)?no.push(...t):(!Rr||!Rr.includes(t,t.allowRecurse?Ki+1:Ki))&&no.push(t),Vd()}function fh(t,e=Aa?qr+1:0){for(;eTa(n)-Ta(i)),Ki=0;Kit.id==null?1/0:t.id,Ty=(t,e)=>{const n=Ta(t)-Ta(e);if(n===0){if(t.pre&&!e.pre)return-1;if(e.pre&&!t.pre)return 1}return n};function Kd(t){Kl=!1,Aa=!0,nn.sort(Ty);const e=dr;try{for(qr=0;qrLt(Y)?Y.trim():Y)),F&&(a=n.map($m))}let w,v=i[w=Sl(e)]||i[w=Sl(ko(e))];!v&&l&&(v=i[w=Sl($o(e))]),v&&Hn(v,t,6,a);const d=i[w+"Once"];if(d){if(!t.emitted)t.emitted={};else if(t.emitted[w])return;t.emitted[w]=!0,Hn(d,t,6,a)}}function Jd(t,e,n=!1){const i=e.emitsCache,a=i.get(t);if(a!==void 0)return a;const l=t.emits;let m={},w=!1;if(!Se(t)){const v=d=>{const W=Jd(d,e,!0);W&&(w=!0,on(m,W))};!n&&e.mixins.length&&e.mixins.forEach(v),t.extends&&v(t.extends),t.mixins&&t.mixins.forEach(v)}return!l&&!w?(yt(t)&&i.set(t,null),null):(Ie(l)?l.forEach(v=>m[v]=null):on(m,l),yt(t)&&i.set(t,m),m)}function ll(t,e){return!t||!sl(e)?!1:(e=e.slice(2).replace(/Once$/,""),Be(t,e[0].toLowerCase()+e.slice(1))||Be(t,$o(e))||Be(t,e))}let lr=null,Gd=null;function uc(t){const e=lr;return lr=t,Gd=t&&t.type.__scopeId||null,e}function ky(t,e=lr,n){if(!e||t._n)return t;const i=(...a)=>{i._d&&Nh(-1);const l=uc(e);let m;try{m=t(...a)}finally{uc(l),i._d&&Nh(1)}return m};return i._n=!0,i._c=!0,i._d=!0,i}function Rl(t){const{type:e,vnode:n,proxy:i,withProxy:a,props:l,propsOptions:[m],slots:w,attrs:v,emit:d,render:W,renderCache:F,data:U,setupState:Y,ctx:Z,inheritAttrs:b}=t;let C,N;const q=uc(t);try{if(n.shapeFlag&4){const ne=a||i;C=Cr(W.call(ne,ne,F,l,Y,U,Z)),N=v}else{const ne=e;C=Cr(ne.length>1?ne(l,{attrs:v,slots:w,emit:d}):ne(l,null)),N=e.props?v:Ry(v)}}catch(ne){Na.length=0,cl(ne,t,1),C=vs(Fr)}let T=C;if(N&&b!==!1){const ne=Object.keys(N),{shapeFlag:Ne}=T;ne.length&&Ne&7&&(m&&ne.some(_f)&&(N=Dy(N,m)),T=_i(T,N))}return n.dirs&&(T=_i(T),T.dirs=T.dirs?T.dirs.concat(n.dirs):n.dirs),n.transition&&(T.transition=n.transition),C=T,uc(q),C}const Ry=t=>{let e;for(const n in t)(n==="class"||n==="style"||sl(n))&&((e||(e={}))[n]=t[n]);return e},Dy=(t,e)=>{const n={};for(const i in t)(!_f(i)||!(i.slice(9)in e))&&(n[i]=t[i]);return n};function Ly(t,e,n){const{props:i,children:a,component:l}=t,{props:m,children:w,patchFlag:v}=e,d=l.emitsOptions;if(e.dirs||e.transition)return!0;if(n&&v>=0){if(v&1024)return!0;if(v&16)return i?hh(i,m,d):!!m;if(v&8){const W=e.dynamicProps;for(let F=0;Ft.__isSuspense;function By(t,e){e&&e.pendingBranch?Ie(t)?e.effects.push(...t):e.effects.push(t):Ay(t)}function Fy(t,e){if(Ot){let n=Ot.provides;const i=Ot.parent&&Ot.parent.provides;i===n&&(n=Ot.provides=Object.create(i)),n[t]=e}}function Gu(t,e,n=!1){const i=Ot||lr;if(i){const a=i.parent==null?i.vnode.appContext&&i.vnode.appContext.provides:i.parent.provides;if(a&&t in a)return a[t];if(arguments.length>1)return n&&Se(e)?e.call(i.proxy):e}}const ju={};function Dl(t,e,n){return Xd(t,e,n)}function Xd(t,e,{immediate:n,deep:i,flush:a,onTrack:l,onTrigger:m}=lt){const w=Vm()===(Ot==null?void 0:Ot.scope)?Ot:null;let v,d=!1,W=!1;if(rn(t)?(v=()=>t.value,d=ac(t)):to(t)?(v=()=>t,i=!0):Ie(t)?(W=!0,d=t.some(T=>to(T)||ac(T)),v=()=>t.map(T=>{if(rn(T))return T.value;if(to(T))return Ks(T);if(Se(T))return bi(T,w,2)})):Se(t)?e?v=()=>bi(t,w,2):v=()=>{if(!(w&&w.isUnmounted))return F&&F(),Hn(t,w,3,[U])}:v=dr,e&&i){const T=v;v=()=>Ks(T())}let F,U=T=>{F=N.onStop=()=>{bi(T,w,4)}},Y;if(Ra)if(U=dr,e?n&&Hn(e,w,3,[v(),W?[]:void 0,U]):v(),a==="sync"){const T=Bw();Y=T.__watcherHandles||(T.__watcherHandles=[])}else return dr;let Z=W?new Array(t.length).fill(ju):ju;const b=()=>{if(N.active)if(e){const T=N.run();(i||d||(W?T.some((ne,Ne)=>Wa(ne,Z[Ne])):Wa(T,Z)))&&(F&&F(),Hn(e,w,3,[T,Z===ju?void 0:W&&Z[0]===ju?[]:Z,U]),Z=T)}else N.run()};b.allowRecurse=!!e;let C;a==="sync"?C=b:a==="post"?C=()=>bn(b,w&&w.suspense):(b.pre=!0,w&&(b.id=w.uid),C=()=>Df(b));const N=new qf(v,C);e?n?b():Z=N.run():a==="post"?bn(N.run.bind(N),w&&w.suspense):N.run();const q=()=>{N.stop(),w&&w.scope&&xf(w.scope.effects,N)};return Y&&Y.push(q),q}function Uy(t,e,n){const i=this.proxy,a=Lt(t)?t.includes(".")?Yd(i,t):()=>i[t]:t.bind(i,i);let l;Se(e)?l=e:(l=e.handler,n=e);const m=Ot;Do(this);const w=Xd(a,l.bind(i),n);return m?Do(m):_s(),w}function Yd(t,e){const n=e.split(".");return()=>{let i=t;for(let a=0;a{Ks(n,e)});else if(Cd(t))for(const n in t)Ks(t[n],e);return t}function $y(){const t={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return np(()=>{t.isMounted=!0}),rp(()=>{t.isUnmounting=!0}),t}const Fn=[Function,Array],Qy={name:"BaseTransition",props:{mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Fn,onEnter:Fn,onAfterEnter:Fn,onEnterCancelled:Fn,onBeforeLeave:Fn,onLeave:Fn,onAfterLeave:Fn,onLeaveCancelled:Fn,onBeforeAppear:Fn,onAppear:Fn,onAfterAppear:Fn,onAppearCancelled:Fn},setup(t,{slots:e}){const n=Tw(),i=$y();let a;return()=>{const l=e.default&&ep(e.default(),!0);if(!l||!l.length)return;let m=l[0];if(l.length>1){for(const b of l)if(b.type!==Fr){m=b;break}}const w=Fe(t),{mode:v}=w;if(i.isLeaving)return Ll(m);const d=dh(m);if(!d)return Ll(m);const W=Jl(d,w,i,n);Gl(d,W);const F=n.subTree,U=F&&dh(F);let Y=!1;const{getTransitionKey:Z}=d.type;if(Z){const b=Z();a===void 0?a=b:b!==a&&(a=b,Y=!0)}if(U&&U.type!==Fr&&(!Ji(d,U)||Y)){const b=Jl(U,w,i,n);if(Gl(U,b),v==="out-in")return i.isLeaving=!0,b.afterLeave=()=>{i.isLeaving=!1,n.update.active!==!1&&n.update()},Ll(m);v==="in-out"&&d.type!==Fr&&(b.delayLeave=(C,N,q)=>{const T=Zd(i,U);T[String(U.key)]=U,C._leaveCb=()=>{N(),C._leaveCb=void 0,delete W.delayedLeave},W.delayedLeave=q})}return m}}},jy=Qy;function Zd(t,e){const{leavingVNodes:n}=t;let i=n.get(e.type);return i||(i=Object.create(null),n.set(e.type,i)),i}function Jl(t,e,n,i){const{appear:a,mode:l,persisted:m=!1,onBeforeEnter:w,onEnter:v,onAfterEnter:d,onEnterCancelled:W,onBeforeLeave:F,onLeave:U,onAfterLeave:Y,onLeaveCancelled:Z,onBeforeAppear:b,onAppear:C,onAfterAppear:N,onAppearCancelled:q}=e,T=String(t.key),ne=Zd(n,t),Ne=(xe,tt)=>{xe&&Hn(xe,i,9,tt)},ae=(xe,tt)=>{const ze=tt[1];Ne(xe,tt),Ie(xe)?xe.every(qt=>qt.length<=1)&&ze():xe.length<=1&&ze()},_e={mode:l,persisted:m,beforeEnter(xe){let tt=w;if(!n.isMounted)if(a)tt=b||w;else return;xe._leaveCb&&xe._leaveCb(!0);const ze=ne[T];ze&&Ji(t,ze)&&ze.el._leaveCb&&ze.el._leaveCb(),Ne(tt,[xe])},enter(xe){let tt=v,ze=d,qt=W;if(!n.isMounted)if(a)tt=C||v,ze=N||d,qt=q||W;else return;let Wt=!1;const Qe=xe._enterCb=Kt=>{Wt||(Wt=!0,Kt?Ne(qt,[xe]):Ne(ze,[xe]),_e.delayedLeave&&_e.delayedLeave(),xe._enterCb=void 0)};tt?ae(tt,[xe,Qe]):Qe()},leave(xe,tt){const ze=String(t.key);if(xe._enterCb&&xe._enterCb(!0),n.isUnmounting)return tt();Ne(F,[xe]);let qt=!1;const Wt=xe._leaveCb=Qe=>{qt||(qt=!0,tt(),Qe?Ne(Z,[xe]):Ne(Y,[xe]),xe._leaveCb=void 0,ne[ze]===t&&delete ne[ze])};ne[ze]=t,U?ae(U,[xe,Wt]):Wt()},clone(xe){return Jl(xe,e,n,i)}};return _e}function Ll(t){if(fl(t))return t=_i(t),t.children=null,t}function dh(t){return fl(t)?t.children?t.children[0]:void 0:t}function Gl(t,e){t.shapeFlag&6&&t.component?Gl(t.component.subTree,e):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function ep(t,e=!1,n){let i=[],a=0;for(let l=0;l1)for(let l=0;l!!t.type.__asyncLoader,fl=t=>t.type.__isKeepAlive;function Vy(t,e){tp(t,"a",e)}function zy(t,e){tp(t,"da",e)}function tp(t,e,n=Ot){const i=t.__wdc||(t.__wdc=()=>{let a=n;for(;a;){if(a.isDeactivated)return;a=a.parent}return t()});if(hl(e,i,n),n){let a=n.parent;for(;a&&a.parent;)fl(a.parent.vnode)&&Ky(i,e,n,a),a=a.parent}}function Ky(t,e,n,i){const a=hl(e,t,i,!0);ip(()=>{xf(i[e],a)},n)}function hl(t,e,n=Ot,i=!1){if(n){const a=n[t]||(n[t]=[]),l=e.__weh||(e.__weh=(...m)=>{if(n.isUnmounted)return;Qo(),Do(n);const w=Hn(e,n,t,m);return _s(),jo(),w});return i?a.unshift(l):a.push(l),l}}const Vr=t=>(e,n=Ot)=>(!Ra||t==="sp")&&hl(t,(...i)=>e(...i),n),Jy=Vr("bm"),np=Vr("m"),Gy=Vr("bu"),Xy=Vr("u"),rp=Vr("bum"),ip=Vr("um"),Yy=Vr("sp"),Zy=Vr("rtg"),ew=Vr("rtc");function tw(t,e=Ot){hl("ec",t,e)}function ji(t,e,n,i){const a=t.dirs,l=e&&e.dirs;for(let m=0;mt?pp(t)?Bf(t)||t.proxy:Xl(t.parent):null,ba=on(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>Xl(t.parent),$root:t=>Xl(t.root),$emit:t=>t.emit,$options:t=>Lf(t),$forceUpdate:t=>t.f||(t.f=()=>Df(t.update)),$nextTick:t=>t.n||(t.n=qy.bind(t.proxy)),$watch:t=>Uy.bind(t)}),Pl=(t,e)=>t!==lt&&!t.__isScriptSetup&&Be(t,e),rw={get({_:t},e){const{ctx:n,setupState:i,data:a,props:l,accessCache:m,type:w,appContext:v}=t;let d;if(e[0]!=="$"){const Y=m[e];if(Y!==void 0)switch(Y){case 1:return i[e];case 2:return a[e];case 4:return n[e];case 3:return l[e]}else{if(Pl(i,e))return m[e]=1,i[e];if(a!==lt&&Be(a,e))return m[e]=2,a[e];if((d=t.propsOptions[0])&&Be(d,e))return m[e]=3,l[e];if(n!==lt&&Be(n,e))return m[e]=4,n[e];Yl&&(m[e]=0)}}const W=ba[e];let F,U;if(W)return e==="$attrs"&&xn(t,"get",e),W(t);if((F=w.__cssModules)&&(F=F[e]))return F;if(n!==lt&&Be(n,e))return m[e]=4,n[e];if(U=v.config.globalProperties,Be(U,e))return U[e]},set({_:t},e,n){const{data:i,setupState:a,ctx:l}=t;return Pl(a,e)?(a[e]=n,!0):i!==lt&&Be(i,e)?(i[e]=n,!0):Be(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(l[e]=n,!0)},has({_:{data:t,setupState:e,accessCache:n,ctx:i,appContext:a,propsOptions:l}},m){let w;return!!n[m]||t!==lt&&Be(t,m)||Pl(e,m)||(w=l[0])&&Be(w,m)||Be(i,m)||Be(ba,m)||Be(a.config.globalProperties,m)},defineProperty(t,e,n){return n.get!=null?t._.accessCache[e]=0:Be(n,"value")&&this.set(t,e,n.value,null),Reflect.defineProperty(t,e,n)}};let Yl=!0;function iw(t){const e=Lf(t),n=t.proxy,i=t.ctx;Yl=!1,e.beforeCreate&&ph(e.beforeCreate,t,"bc");const{data:a,computed:l,methods:m,watch:w,provide:v,inject:d,created:W,beforeMount:F,mounted:U,beforeUpdate:Y,updated:Z,activated:b,deactivated:C,beforeDestroy:N,beforeUnmount:q,destroyed:T,unmounted:ne,render:Ne,renderTracked:ae,renderTriggered:_e,errorCaptured:xe,serverPrefetch:tt,expose:ze,inheritAttrs:qt,components:Wt,directives:Qe,filters:Kt}=e;if(d&&sw(d,i,null,t.appContext.config.unwrapInjectedRef),m)for(const ge in m){const Oe=m[ge];Se(Oe)&&(i[ge]=Oe.bind(n))}if(a){const ge=a.call(n,n);yt(ge)&&(t.data=Tf(ge))}if(Yl=!0,l)for(const ge in l){const Oe=l[ge],ut=Se(Oe)?Oe.bind(n,n):Se(Oe.get)?Oe.get.bind(n,n):dr,we=!Se(Oe)&&Se(Oe.set)?Oe.set.bind(n):dr,Re=Pw({get:ut,set:we});Object.defineProperty(i,ge,{enumerable:!0,configurable:!0,get:()=>Re.value,set:Pt=>Re.value=Pt})}if(w)for(const ge in w)sp(w[ge],i,n,ge);if(v){const ge=Se(v)?v.call(n):v;Reflect.ownKeys(ge).forEach(Oe=>{Fy(Oe,ge[Oe])})}W&&ph(W,t,"c");function wt(ge,Oe){Ie(Oe)?Oe.forEach(ut=>ge(ut.bind(n))):Oe&&ge(Oe.bind(n))}if(wt(Jy,F),wt(np,U),wt(Gy,Y),wt(Xy,Z),wt(Vy,b),wt(zy,C),wt(tw,xe),wt(ew,ae),wt(Zy,_e),wt(rp,q),wt(ip,ne),wt(Yy,tt),Ie(ze))if(ze.length){const ge=t.exposed||(t.exposed={});ze.forEach(Oe=>{Object.defineProperty(ge,Oe,{get:()=>n[Oe],set:ut=>n[Oe]=ut})})}else t.exposed||(t.exposed={});Ne&&t.render===dr&&(t.render=Ne),qt!=null&&(t.inheritAttrs=qt),Wt&&(t.components=Wt),Qe&&(t.directives=Qe)}function sw(t,e,n=dr,i=!1){Ie(t)&&(t=Zl(t));for(const a in t){const l=t[a];let m;yt(l)?"default"in l?m=Gu(l.from||a,l.default,!0):m=Gu(l.from||a):m=Gu(l),rn(m)&&i?Object.defineProperty(e,a,{enumerable:!0,configurable:!0,get:()=>m.value,set:w=>m.value=w}):e[a]=m}}function ph(t,e,n){Hn(Ie(t)?t.map(i=>i.bind(e.proxy)):t.bind(e.proxy),e,n)}function sp(t,e,n,i){const a=i.includes(".")?Yd(n,i):()=>n[i];if(Lt(t)){const l=e[t];Se(l)&&Dl(a,l)}else if(Se(t))Dl(a,t.bind(n));else if(yt(t))if(Ie(t))t.forEach(l=>sp(l,e,n,i));else{const l=Se(t.handler)?t.handler.bind(n):e[t.handler];Se(l)&&Dl(a,l,t)}}function Lf(t){const e=t.type,{mixins:n,extends:i}=e,{mixins:a,optionsCache:l,config:{optionMergeStrategies:m}}=t.appContext,w=l.get(e);let v;return w?v=w:!a.length&&!n&&!i?v=e:(v={},a.length&&a.forEach(d=>cc(v,d,m,!0)),cc(v,e,m)),yt(e)&&l.set(e,v),v}function cc(t,e,n,i=!1){const{mixins:a,extends:l}=e;l&&cc(t,l,n,!0),a&&a.forEach(m=>cc(t,m,n,!0));for(const m in e)if(!(i&&m==="expose")){const w=ow[m]||n&&n[m];t[m]=w?w(t[m],e[m]):e[m]}return t}const ow={data:mh,props:zi,emits:zi,methods:zi,computed:zi,beforeCreate:un,created:un,beforeMount:un,mounted:un,beforeUpdate:un,updated:un,beforeDestroy:un,beforeUnmount:un,destroyed:un,unmounted:un,activated:un,deactivated:un,errorCaptured:un,serverPrefetch:un,components:zi,directives:zi,watch:uw,provide:mh,inject:aw};function mh(t,e){return e?t?function(){return on(Se(t)?t.call(this,this):t,Se(e)?e.call(this,this):e)}:e:t}function aw(t,e){return zi(Zl(t),Zl(e))}function Zl(t){if(Ie(t)){const e={};for(let n=0;n0)&&!(m&16)){if(m&8){const W=t.vnode.dynamicProps;for(let F=0;F{v=!0;const[U,Y]=ap(F,e,!0);on(m,U),Y&&w.push(...Y)};!n&&e.mixins.length&&e.mixins.forEach(W),t.extends&&W(t.extends),t.mixins&&t.mixins.forEach(W)}if(!l&&!v)return yt(t)&&i.set(t,Zs),Zs;if(Ie(l))for(let W=0;W-1,Y[1]=b<0||Z-1||Be(Y,"default"))&&w.push(F)}}}const d=[m,w];return yt(t)&&i.set(t,d),d}function yh(t){return t[0]!=="$"}function wh(t){const e=t&&t.toString().match(/^\s*(function|class) (\w+)/);return e?e[2]:t===null?"null":""}function gh(t,e){return wh(t)===wh(e)}function bh(t,e){return Ie(e)?e.findIndex(n=>gh(n,t)):Se(e)&&gh(e,t)?0:-1}const up=t=>t[0]==="_"||t==="$stable",Pf=t=>Ie(t)?t.map(Cr):[Cr(t)],fw=(t,e,n)=>{if(e._n)return e;const i=ky((...a)=>Pf(e(...a)),n);return i._c=!1,i},cp=(t,e,n)=>{const i=t._ctx;for(const a in t){if(up(a))continue;const l=t[a];if(Se(l))e[a]=fw(a,l,i);else if(l!=null){const m=Pf(l);e[a]=()=>m}}},lp=(t,e)=>{const n=Pf(e);t.slots.default=()=>n},hw=(t,e)=>{if(t.vnode.shapeFlag&32){const n=e._;n?(t.slots=Fe(e),oc(e,"_",n)):cp(e,t.slots={})}else t.slots={},e&&lp(t,e);oc(t.slots,pl,1)},dw=(t,e,n)=>{const{vnode:i,slots:a}=t;let l=!0,m=lt;if(i.shapeFlag&32){const w=e._;w?n&&w===1?l=!1:(on(a,e),!n&&w===1&&delete a._):(l=!e.$stable,cp(e,a)),m=e}else e&&(lp(t,e),m={default:1});if(l)for(const w in a)!up(w)&&!(w in m)&&delete a[w]};function fp(){return{app:null,config:{isNativeTag:Lm,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let pw=0;function mw(t,e){return function(i,a=null){Se(i)||(i=Object.assign({},i)),a!=null&&!yt(a)&&(a=null);const l=fp(),m=new Set;let w=!1;const v=l.app={_uid:pw++,_component:i,_props:a,_container:null,_context:l,_instance:null,version:Fw,get config(){return l.config},set config(d){},use(d,...W){return m.has(d)||(d&&Se(d.install)?(m.add(d),d.install(v,...W)):Se(d)&&(m.add(d),d(v,...W))),v},mixin(d){return l.mixins.includes(d)||l.mixins.push(d),v},component(d,W){return W?(l.components[d]=W,v):l.components[d]},directive(d,W){return W?(l.directives[d]=W,v):l.directives[d]},mount(d,W,F){if(!w){const U=vs(i,a);return U.appContext=l,W&&e?e(U,d):t(U,d,F),w=!0,v._container=d,d.__vue_app__=v,Bf(U.component)||U.component.proxy}},unmount(){w&&(t(null,v._container),delete v._container.__vue_app__)},provide(d,W){return l.provides[d]=W,v}};return v}}function tf(t,e,n,i,a=!1){if(Ie(t)){t.forEach((U,Y)=>tf(U,e&&(Ie(e)?e[Y]:e),n,i,a));return}if(Xu(i)&&!a)return;const l=i.shapeFlag&4?Bf(i.component)||i.component.proxy:i.el,m=a?null:l,{i:w,r:v}=t,d=e&&e.r,W=w.refs===lt?w.refs={}:w.refs,F=w.setupState;if(d!=null&&d!==v&&(Lt(d)?(W[d]=null,Be(F,d)&&(F[d]=null)):rn(d)&&(d.value=null)),Se(v))bi(v,w,12,[m,W]);else{const U=Lt(v),Y=rn(v);if(U||Y){const Z=()=>{if(t.f){const b=U?Be(F,v)?F[v]:W[v]:v.value;a?Ie(b)&&xf(b,l):Ie(b)?b.includes(l)||b.push(l):U?(W[v]=[l],Be(F,v)&&(F[v]=W[v])):(v.value=[l],t.k&&(W[t.k]=v.value))}else U?(W[v]=m,Be(F,v)&&(F[v]=m)):Y&&(v.value=m,t.k&&(W[t.k]=m))};m?(Z.id=-1,bn(Z,n)):Z()}}}const bn=By;function yw(t){return ww(t)}function ww(t,e){const n=Qm();n.__VUE__=!0;const{insert:i,remove:a,patchProp:l,createElement:m,createText:w,createComment:v,setText:d,setElementText:W,parentNode:F,nextSibling:U,setScopeId:Y=dr,insertStaticContent:Z}=t,b=(x,O,R,M=null,K=null,ee=null,j=!1,z=null,re=!!O.dynamicChildren)=>{if(x===O)return;x&&!Ji(x,O)&&(M=fe(x),Pt(x,K,ee,!0),x=null),O.patchFlag===-2&&(re=!1,O.dynamicChildren=null);const{type:J,ref:ce,shapeFlag:oe}=O;switch(J){case dl:C(x,O,R,M);break;case Fr:N(x,O,R,M);break;case Ml:x==null&&q(O,R,M,j);break;case ur:Wt(x,O,R,M,K,ee,j,z,re);break;default:oe&1?Ne(x,O,R,M,K,ee,j,z,re):oe&6?Qe(x,O,R,M,K,ee,j,z,re):(oe&64||oe&128)&&J.process(x,O,R,M,K,ee,j,z,re,zn)}ce!=null&&K&&tf(ce,x&&x.ref,ee,O||x,!O)},C=(x,O,R,M)=>{if(x==null)i(O.el=w(O.children),R,M);else{const K=O.el=x.el;O.children!==x.children&&d(K,O.children)}},N=(x,O,R,M)=>{x==null?i(O.el=v(O.children||""),R,M):O.el=x.el},q=(x,O,R,M)=>{[x.el,x.anchor]=Z(x.children,O,R,M,x.el,x.anchor)},T=({el:x,anchor:O},R,M)=>{let K;for(;x&&x!==O;)K=U(x),i(x,R,M),x=K;i(O,R,M)},ne=({el:x,anchor:O})=>{let R;for(;x&&x!==O;)R=U(x),a(x),x=R;a(O)},Ne=(x,O,R,M,K,ee,j,z,re)=>{j=j||O.type==="svg",x==null?ae(O,R,M,K,ee,j,z,re):tt(x,O,K,ee,j,z,re)},ae=(x,O,R,M,K,ee,j,z)=>{let re,J;const{type:ce,props:oe,shapeFlag:ue,transition:be,dirs:Ee}=x;if(re=x.el=m(x.type,ee,oe&&oe.is,oe),ue&8?W(re,x.children):ue&16&&xe(x.children,re,null,M,K,ee&&ce!=="foreignObject",j,z),Ee&&ji(x,null,M,"created"),_e(re,x,x.scopeId,j,M),oe){for(const Le in oe)Le!=="value"&&!Ju(Le)&&l(re,Le,null,oe[Le],ee,x.children,M,K,pn);"value"in oe&&l(re,"value",null,oe.value),(J=oe.onVnodeBeforeMount)&&gr(J,M,x)}Ee&&ji(x,null,M,"beforeMount");const je=(!K||K&&!K.pendingBranch)&&be&&!be.persisted;je&&be.beforeEnter(re),i(re,O,R),((J=oe&&oe.onVnodeMounted)||je||Ee)&&bn(()=>{J&&gr(J,M,x),je&&be.enter(re),Ee&&ji(x,null,M,"mounted")},K)},_e=(x,O,R,M,K)=>{if(R&&Y(x,R),M)for(let ee=0;ee{for(let J=re;J{const z=O.el=x.el;let{patchFlag:re,dynamicChildren:J,dirs:ce}=O;re|=x.patchFlag&16;const oe=x.props||lt,ue=O.props||lt;let be;R&&Hi(R,!1),(be=ue.onVnodeBeforeUpdate)&&gr(be,R,O,x),ce&&ji(O,x,R,"beforeUpdate"),R&&Hi(R,!0);const Ee=K&&O.type!=="foreignObject";if(J?ze(x.dynamicChildren,J,z,R,M,Ee,ee):j||Oe(x,O,z,null,R,M,Ee,ee,!1),re>0){if(re&16)qt(z,O,oe,ue,R,M,K);else if(re&2&&oe.class!==ue.class&&l(z,"class",null,ue.class,K),re&4&&l(z,"style",oe.style,ue.style,K),re&8){const je=O.dynamicProps;for(let Le=0;Le{be&&gr(be,R,O,x),ce&&ji(O,x,R,"updated")},M)},ze=(x,O,R,M,K,ee,j)=>{for(let z=0;z{if(R!==M){if(R!==lt)for(const z in R)!Ju(z)&&!(z in M)&&l(x,z,R[z],null,j,O.children,K,ee,pn);for(const z in M){if(Ju(z))continue;const re=M[z],J=R[z];re!==J&&z!=="value"&&l(x,z,J,re,j,O.children,K,ee,pn)}"value"in M&&l(x,"value",R.value,M.value)}},Wt=(x,O,R,M,K,ee,j,z,re)=>{const J=O.el=x?x.el:w(""),ce=O.anchor=x?x.anchor:w("");let{patchFlag:oe,dynamicChildren:ue,slotScopeIds:be}=O;be&&(z=z?z.concat(be):be),x==null?(i(J,R,M),i(ce,R,M),xe(O.children,R,ce,K,ee,j,z,re)):oe>0&&oe&64&&ue&&x.dynamicChildren?(ze(x.dynamicChildren,ue,R,K,ee,j,z),(O.key!=null||K&&O===K.subTree)&&hp(x,O,!0)):Oe(x,O,R,ce,K,ee,j,z,re)},Qe=(x,O,R,M,K,ee,j,z,re)=>{O.slotScopeIds=z,x==null?O.shapeFlag&512?K.ctx.activate(O,R,M,j,re):Kt(O,R,M,K,ee,j,re):dn(x,O,re)},Kt=(x,O,R,M,K,ee,j)=>{const z=x.component=Aw(x,M,K);if(fl(x)&&(z.ctx.renderer=zn),Sw(z),z.asyncDep){if(K&&K.registerDep(z,wt),!x.el){const re=z.subTree=vs(Fr);N(null,re,O,R)}return}wt(z,x,O,R,K,ee,j)},dn=(x,O,R)=>{const M=O.component=x.component;if(Ly(x,O,R))if(M.asyncDep&&!M.asyncResolved){ge(M,O,R);return}else M.next=O,Iy(M.update),M.update();else O.el=x.el,M.vnode=O},wt=(x,O,R,M,K,ee,j)=>{const z=()=>{if(x.isMounted){let{next:ce,bu:oe,u:ue,parent:be,vnode:Ee}=x,je=ce,Le;Hi(x,!1),ce?(ce.el=Ee.el,ge(x,ce,j)):ce=Ee,oe&&kl(oe),(Le=ce.props&&ce.props.onVnodeBeforeUpdate)&&gr(Le,be,ce,Ee),Hi(x,!0);const it=Rl(x),me=x.subTree;x.subTree=it,b(me,it,F(me.el),fe(me),x,K,ee),ce.el=it.el,je===null&&Py(x,it.el),ue&&bn(ue,K),(Le=ce.props&&ce.props.onVnodeUpdated)&&bn(()=>gr(Le,be,ce,Ee),K)}else{let ce;const{el:oe,props:ue}=O,{bm:be,m:Ee,parent:je}=x,Le=Xu(O);if(Hi(x,!1),be&&kl(be),!Le&&(ce=ue&&ue.onVnodeBeforeMount)&&gr(ce,je,O),Hi(x,!0),oe&&Ke){const it=()=>{x.subTree=Rl(x),Ke(oe,x.subTree,x,K,null)};Le?O.type.__asyncLoader().then(()=>!x.isUnmounted&&it()):it()}else{const it=x.subTree=Rl(x);b(null,it,R,M,x,K,ee),O.el=it.el}if(Ee&&bn(Ee,K),!Le&&(ce=ue&&ue.onVnodeMounted)){const it=O;bn(()=>gr(ce,je,it),K)}(O.shapeFlag&256||je&&Xu(je.vnode)&&je.vnode.shapeFlag&256)&&x.a&&bn(x.a,K),x.isMounted=!0,O=R=M=null}},re=x.effect=new qf(z,()=>Df(J),x.scope),J=x.update=()=>re.run();J.id=x.uid,Hi(x,!0),J()},ge=(x,O,R)=>{O.component=x;const M=x.vnode.props;x.vnode=O,x.next=null,lw(x,O.props,M,R),dw(x,O.children,R),Qo(),fh(),jo()},Oe=(x,O,R,M,K,ee,j,z,re=!1)=>{const J=x&&x.children,ce=x?x.shapeFlag:0,oe=O.children,{patchFlag:ue,shapeFlag:be}=O;if(ue>0){if(ue&128){we(J,oe,R,M,K,ee,j,z,re);return}else if(ue&256){ut(J,oe,R,M,K,ee,j,z,re);return}}be&8?(ce&16&&pn(J,K,ee),oe!==J&&W(R,oe)):ce&16?be&16?we(J,oe,R,M,K,ee,j,z,re):pn(J,K,ee,!0):(ce&8&&W(R,""),be&16&&xe(oe,R,M,K,ee,j,z,re))},ut=(x,O,R,M,K,ee,j,z,re)=>{x=x||Zs,O=O||Zs;const J=x.length,ce=O.length,oe=Math.min(J,ce);let ue;for(ue=0;uece?pn(x,K,ee,!0,!1,oe):xe(O,R,M,K,ee,j,z,re,oe)},we=(x,O,R,M,K,ee,j,z,re)=>{let J=0;const ce=O.length;let oe=x.length-1,ue=ce-1;for(;J<=oe&&J<=ue;){const be=x[J],Ee=O[J]=re?si(O[J]):Cr(O[J]);if(Ji(be,Ee))b(be,Ee,R,null,K,ee,j,z,re);else break;J++}for(;J<=oe&&J<=ue;){const be=x[oe],Ee=O[ue]=re?si(O[ue]):Cr(O[ue]);if(Ji(be,Ee))b(be,Ee,R,null,K,ee,j,z,re);else break;oe--,ue--}if(J>oe){if(J<=ue){const be=ue+1,Ee=beue)for(;J<=oe;)Pt(x[J],K,ee,!0),J++;else{const be=J,Ee=J,je=new Map;for(J=Ee;J<=ue;J++){const le=O[J]=re?si(O[J]):Cr(O[J]);le.key!=null&&je.set(le.key,J)}let Le,it=0;const me=ue-Ee+1;let Cn=!1,Ci=0;const Gt=new Array(me);for(J=0;J=me){Pt(le,K,ee,!0);continue}let Mt;if(le.key!=null)Mt=je.get(le.key);else for(Le=Ee;Le<=ue;Le++)if(Gt[Le-Ee]===0&&Ji(le,O[Le])){Mt=Le;break}Mt===void 0?Pt(le,K,ee,!0):(Gt[Mt-Ee]=J+1,Mt>=Ci?Ci=Mt:Cn=!0,b(le,O[Mt],R,null,K,ee,j,z,re),it++)}const Cs=Cn?gw(Gt):Zs;for(Le=Cs.length-1,J=me-1;J>=0;J--){const le=Ee+J,Mt=O[le],te=le+1{const{el:ee,type:j,transition:z,children:re,shapeFlag:J}=x;if(J&6){Re(x.component.subTree,O,R,M);return}if(J&128){x.suspense.move(O,R,M);return}if(J&64){j.move(x,O,R,zn);return}if(j===ur){i(ee,O,R);for(let oe=0;oez.enter(ee),K);else{const{leave:oe,delayLeave:ue,afterLeave:be}=z,Ee=()=>i(ee,O,R),je=()=>{oe(ee,()=>{Ee(),be&&be()})};ue?ue(ee,Ee,je):je()}else i(ee,O,R)},Pt=(x,O,R,M=!1,K=!1)=>{const{type:ee,props:j,ref:z,children:re,dynamicChildren:J,shapeFlag:ce,patchFlag:oe,dirs:ue}=x;if(z!=null&&tf(z,null,R,x,!0),ce&256){O.ctx.deactivate(x);return}const be=ce&1&&ue,Ee=!Xu(x);let je;if(Ee&&(je=j&&j.onVnodeBeforeUnmount)&&gr(je,O,x),ce&6)En(x.component,R,M);else{if(ce&128){x.suspense.unmount(R,M);return}be&&ji(x,null,O,"beforeUnmount"),ce&64?x.type.remove(x,O,R,K,zn,M):J&&(ee!==ur||oe>0&&oe&64)?pn(J,O,R,!1,!0):(ee===ur&&oe&384||!K&&ce&16)&&pn(re,O,R),M&&Ar(x)}(Ee&&(je=j&&j.onVnodeUnmounted)||be)&&bn(()=>{je&&gr(je,O,x),be&&ji(x,null,O,"unmounted")},R)},Ar=x=>{const{type:O,el:R,anchor:M,transition:K}=x;if(O===ur){Es(R,M);return}if(O===Ml){ne(x);return}const ee=()=>{a(R),K&&!K.persisted&&K.afterLeave&&K.afterLeave()};if(x.shapeFlag&1&&K&&!K.persisted){const{leave:j,delayLeave:z}=K,re=()=>j(R,ee);z?z(x.el,ee,re):re()}else ee()},Es=(x,O)=>{let R;for(;x!==O;)R=U(x),a(x),x=R;a(O)},En=(x,O,R)=>{const{bum:M,scope:K,update:ee,subTree:j,um:z}=x;M&&kl(M),K.stop(),ee&&(ee.active=!1,Pt(j,x,O,R)),z&&bn(z,O),bn(()=>{x.isUnmounted=!0},O),O&&O.pendingBranch&&!O.isUnmounted&&x.asyncDep&&!x.asyncResolved&&x.suspenseId===O.pendingId&&(O.deps--,O.deps===0&&O.resolve())},pn=(x,O,R,M=!1,K=!1,ee=0)=>{for(let j=ee;jx.shapeFlag&6?fe(x.component.subTree):x.shapeFlag&128?x.suspense.next():U(x.anchor||x.el),Me=(x,O,R)=>{x==null?O._vnode&&Pt(O._vnode,null,null,!0):b(O._vnode||null,x,O,null,null,null,R),fh(),zd(),O._vnode=x},zn={p:b,um:Pt,m:Re,r:Ar,mt:Kt,mc:xe,pc:Oe,pbc:ze,n:fe,o:t};let Jt,Ke;return e&&([Jt,Ke]=e(zn)),{render:Me,hydrate:Jt,createApp:mw(Me,Jt)}}function Hi({effect:t,update:e},n){t.allowRecurse=e.allowRecurse=n}function hp(t,e,n=!1){const i=t.children,a=e.children;if(Ie(i)&&Ie(a))for(let l=0;l>1,t[n[w]]0&&(e[i]=n[l-1]),n[l]=i)}}for(l=n.length,m=n[l-1];l-- >0;)n[l]=m,m=e[m];return n}const bw=t=>t.__isTeleport,ur=Symbol(void 0),dl=Symbol(void 0),Fr=Symbol(void 0),Ml=Symbol(void 0),Na=[];let fr=null;function Nw(t=!1){Na.push(fr=t?null:[])}function vw(){Na.pop(),fr=Na[Na.length-1]||null}let Sa=1;function Nh(t){Sa+=t}function _w(t){return t.dynamicChildren=Sa>0?fr||Zs:null,vw(),Sa>0&&fr&&fr.push(t),t}function xw(t,e,n,i,a,l){return _w(Ct(t,e,n,i,a,l,!0))}function Ew(t){return t?t.__v_isVNode===!0:!1}function Ji(t,e){return t.type===e.type&&t.key===e.key}const pl="__vInternal",dp=({key:t})=>t??null,Yu=({ref:t,ref_key:e,ref_for:n})=>t!=null?Lt(t)||rn(t)||Se(t)?{i:lr,r:t,k:e,f:!!n}:t:null;function Ct(t,e=null,n=null,i=0,a=null,l=t===ur?0:1,m=!1,w=!1){const v={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&dp(e),ref:e&&Yu(e),scopeId:Gd,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:l,patchFlag:i,dynamicProps:a,dynamicChildren:null,appContext:null,ctx:lr};return w?(Mf(v,n),l&128&&t.normalize(v)):n&&(v.shapeFlag|=Lt(n)?8:16),Sa>0&&!m&&fr&&(v.patchFlag>0||l&6)&&v.patchFlag!==32&&fr.push(v),v}const vs=Cw;function Cw(t,e=null,n=null,i=0,a=null,l=!1){if((!t||t===nw)&&(t=Fr),Ew(t)){const w=_i(t,e,!0);return n&&Mf(w,n),Sa>0&&!l&&fr&&(w.shapeFlag&6?fr[fr.indexOf(t)]=w:fr.push(w)),w.patchFlag|=-2,w}if(Lw(t)&&(t=t.__vccOpts),e){e=Ow(e);let{class:w,style:v}=e;w&&!Lt(w)&&(e.class=vf(w)),yt(v)&&(Md(v)&&!Ie(v)&&(v=on({},v)),e.style=Nf(v))}const m=Lt(t)?1:My(t)?128:bw(t)?64:yt(t)?4:Se(t)?2:0;return Ct(t,e,n,i,a,m,l,!0)}function Ow(t){return t?Md(t)||pl in t?on({},t):t:null}function _i(t,e,n=!1){const{props:i,ref:a,patchFlag:l,children:m}=t,w=e?qw(i||{},e):i;return{__v_isVNode:!0,__v_skip:!0,type:t.type,props:w,key:w&&dp(w),ref:e&&e.ref?n&&a?Ie(a)?a.concat(Yu(e)):[a,Yu(e)]:Yu(e):a,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:m,target:t.target,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==ur?l===-1?16:l|16:l,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:t.transition,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&_i(t.ssContent),ssFallback:t.ssFallback&&_i(t.ssFallback),el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce}}function ka(t=" ",e=0){return vs(dl,null,t,e)}function Cr(t){return t==null||typeof t=="boolean"?vs(Fr):Ie(t)?vs(ur,null,t.slice()):typeof t=="object"?si(t):vs(dl,null,String(t))}function si(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:_i(t)}function Mf(t,e){let n=0;const{shapeFlag:i}=t;if(e==null)e=null;else if(Ie(e))n=16;else if(typeof e=="object")if(i&65){const a=e.default;a&&(a._c&&(a._d=!1),Mf(t,a()),a._c&&(a._d=!0));return}else{n=32;const a=e._;!a&&!(pl in e)?e._ctx=lr:a===3&&lr&&(lr.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else Se(e)?(e={default:e,_ctx:lr},n=32):(e=String(e),i&64?(n=16,e=[ka(e)]):n=8);t.children=e,t.shapeFlag|=n}function qw(...t){const e={};for(let n=0;nOt||lr,Do=t=>{Ot=t,t.scope.on()},_s=()=>{Ot&&Ot.scope.off(),Ot=null};function pp(t){return t.vnode.shapeFlag&4}let Ra=!1;function Sw(t,e=!1){Ra=e;const{props:n,children:i}=t.vnode,a=pp(t);cw(t,n,a,e),hw(t,i);const l=a?kw(t,e):void 0;return Ra=!1,l}function kw(t,e){const n=t.type;t.accessCache=Object.create(null),t.proxy=Bd(new Proxy(t.ctx,rw));const{setup:i}=n;if(i){const a=t.setupContext=i.length>1?Dw(t):null;Do(t),Qo();const l=bi(i,t,0,[t.props,a]);if(jo(),_s(),xd(l)){if(l.then(_s,_s),e)return l.then(m=>{vh(t,m,e)}).catch(m=>{cl(m,t,0)});t.asyncDep=l}else vh(t,l,e)}else mp(t,e)}function vh(t,e,n){Se(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:yt(e)&&(t.setupState=Qd(e)),mp(t,n)}let _h;function mp(t,e,n){const i=t.type;if(!t.render){if(!e&&_h&&!i.render){const a=i.template||Lf(t).template;if(a){const{isCustomElement:l,compilerOptions:m}=t.appContext.config,{delimiters:w,compilerOptions:v}=i,d=on(on({isCustomElement:l,delimiters:w},m),v);i.render=_h(a,d)}}t.render=i.render||dr}Do(t),Qo(),iw(t),jo(),_s()}function Rw(t){return new Proxy(t.attrs,{get(e,n){return xn(t,"get","$attrs"),e[n]}})}function Dw(t){const e=i=>{t.exposed=i||{}};let n;return{get attrs(){return n||(n=Rw(t))},slots:t.slots,emit:t.emit,expose:e}}function Bf(t){if(t.exposed)return t.exposeProxy||(t.exposeProxy=new Proxy(Qd(Bd(t.exposed)),{get(e,n){if(n in e)return e[n];if(n in ba)return ba[n](t)},has(e,n){return n in e||n in ba}}))}function Lw(t){return Se(t)&&"__vccOpts"in t}const Pw=(t,e)=>Cy(t,e,Ra),Mw=Symbol(""),Bw=()=>Gu(Mw),Fw="3.2.47",Uw="http://www.w3.org/2000/svg",Gi=typeof document<"u"?document:null,xh=Gi&&Gi.createElement("template"),$w={insert:(t,e,n)=>{e.insertBefore(t,n||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,n,i)=>{const a=e?Gi.createElementNS(Uw,t):Gi.createElement(t,n?{is:n}:void 0);return t==="select"&&i&&i.multiple!=null&&a.setAttribute("multiple",i.multiple),a},createText:t=>Gi.createTextNode(t),createComment:t=>Gi.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>Gi.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,n,i,a,l){const m=n?n.previousSibling:e.lastChild;if(a&&(a===l||a.nextSibling))for(;e.insertBefore(a.cloneNode(!0),n),!(a===l||!(a=a.nextSibling)););else{xh.innerHTML=i?`${t}`:t;const w=xh.content;if(i){const v=w.firstChild;for(;v.firstChild;)w.appendChild(v.firstChild);w.removeChild(v)}e.insertBefore(w,n)}return[m?m.nextSibling:e.firstChild,n?n.previousSibling:e.lastChild]}};function Qw(t,e,n){const i=t._vtc;i&&(e=(e?[e,...i]:[...i]).join(" ")),e==null?t.removeAttribute("class"):n?t.setAttribute("class",e):t.className=e}function jw(t,e,n){const i=t.style,a=Lt(n);if(n&&!a){if(e&&!Lt(e))for(const l in e)n[l]==null&&nf(i,l,"");for(const l in n)nf(i,l,n[l])}else{const l=i.display;a?e!==n&&(i.cssText=n):e&&t.removeAttribute("style"),"_vod"in t&&(i.display=l)}}const Eh=/\s*!important$/;function nf(t,e,n){if(Ie(n))n.forEach(i=>nf(t,e,i));else if(n==null&&(n=""),e.startsWith("--"))t.setProperty(e,n);else{const i=Hw(t,e);Eh.test(n)?t.setProperty($o(i),n.replace(Eh,""),"important"):t[i]=n}}const Ch=["Webkit","Moz","ms"],Bl={};function Hw(t,e){const n=Bl[e];if(n)return n;let i=ko(e);if(i!=="filter"&&i in t)return Bl[e]=i;i=Od(i);for(let a=0;aFl||(Yw.then(()=>Fl=0),Fl=Date.now());function eg(t,e){const n=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=n.attached)return;Hn(tg(i,n.value),e,5,[i])};return n.value=t,n.attached=Zw(),n}function tg(t,e){if(Ie(e)){const n=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{n.call(t),t._stopped=!0},e.map(i=>a=>!a._stopped&&i&&i(a))}else return e}const Wh=/^on[a-z]/,ng=(t,e,n,i,a=!1,l,m,w,v)=>{e==="class"?Qw(t,i,a):e==="style"?jw(t,n,i):sl(e)?_f(e)||Gw(t,e,n,i,m):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):rg(t,e,i,a))?zw(t,e,i,l,m,w,v):(e==="true-value"?t._trueValue=i:e==="false-value"&&(t._falseValue=i),Vw(t,e,i,a))};function rg(t,e,n,i){return i?!!(e==="innerHTML"||e==="textContent"||e in t&&Wh.test(e)&&Se(n)):e==="spellcheck"||e==="draggable"||e==="translate"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA"||Wh.test(e)&&Lt(n)?!1:e in t}const ig={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String};jy.props;const sg=on({patchProp:ng},$w);let Ih;function og(){return Ih||(Ih=yw(sg))}const ag=(...t)=>{const e=og().createApp(...t),{mount:n}=e;return e.mount=i=>{const a=ug(i);if(!a)return;const l=e._component;!Se(l)&&!l.render&&!l.template&&(l.template=a.innerHTML),a.innerHTML="";const m=n(a,!1,a instanceof SVGElement);return a instanceof Element&&(a.removeAttribute("v-cloak"),a.setAttribute("data-v-app","")),m},e};function ug(t){return Lt(t)?document.querySelector(t):t}function va(t){return typeof t>"u"||t===void 0}function pr(t){return typeof t=="string"}function cg(t){return typeof t=="number"}function yp(t){return typeof t=="boolean"}function wp(t){return t===null}function lg(t){return t instanceof Date}function fg(t){return typeof t=="bigint"}function Vn(t){return typeof t=="function"}function Wr(t){return typeof t=="object"&&t!==null}function p(t){return Object.freeze(t)}function wu(t){return Array.isArray(t)}function Lo(t){return t}const Et=p({is(t){return t.kind==="AlterTableNode"},create(t){return p({kind:"AlterTableNode",table:t})},cloneWithTableProps(t,e){return p({...t,...e})},cloneWithColumnAlteration(t,e){return p({...t,columnAlterations:t.columnAlterations?[...t.columnAlterations,e]:[e]})}}),mt=p({is(t){return t.kind==="IdentifierNode"},create(t){return p({kind:"IdentifierNode",name:t})}}),ri=p({is(t){return t.kind==="CreateIndexNode"},create(t){return p({kind:"CreateIndexNode",name:mt.create(t)})},cloneWith(t,e){return p({...t,...e})},cloneWithColumns(t,e){return p({...t,columns:[...t.columns||[],...e]})}}),gp=p({is(t){return t.kind==="CreateSchemaNode"},create(t,e){return p({kind:"CreateSchemaNode",schema:mt.create(t),...e})},cloneWith(t,e){return p({...t,...e})}}),hg=["preserve rows","delete rows","drop"],Zn=p({is(t){return t.kind==="CreateTableNode"},create(t){return p({kind:"CreateTableNode",table:t,columns:p([])})},cloneWithColumn(t,e){return p({...t,columns:p([...t.columns,e])})},cloneWithConstraint(t,e){return p({...t,constraints:t.constraints?p([...t.constraints,e]):p([e])})},cloneWithFrontModifier(t,e){return p({...t,frontModifiers:t.frontModifiers?p([...t.frontModifiers,e]):p([e])})},cloneWithEndModifier(t,e){return p({...t,endModifiers:t.endModifiers?p([...t.endModifiers,e]):p([e])})},cloneWith(t,e){return p({...t,...e})}}),xi=p({is(t){return t.kind==="SchemableIdentifierNode"},create(t){return p({kind:"SchemableIdentifierNode",identifier:mt.create(t)})},createWithSchema(t,e){return p({kind:"SchemableIdentifierNode",schema:mt.create(t),identifier:mt.create(e)})}}),Zu=p({is(t){return t.kind==="DropIndexNode"},create(t,e){return p({kind:"DropIndexNode",name:xi.create(t),...e})},cloneWith(t,e){return p({...t,...e})}}),rf=p({is(t){return t.kind==="DropSchemaNode"},create(t,e){return p({kind:"DropSchemaNode",schema:mt.create(t),...e})},cloneWith(t,e){return p({...t,...e})}}),sf=p({is(t){return t.kind==="DropTableNode"},create(t,e){return p({kind:"DropTableNode",table:t,...e})},cloneWith(t,e){return p({...t,...e})}}),xs=p({is(t){return t.kind==="AliasNode"},create(t,e){return p({kind:"AliasNode",node:t,alias:e})}}),Ni=p({is(t){return t.kind==="TableNode"},create(t){return p({kind:"TableNode",table:xi.create(t)})},createWithSchema(t,e){return p({kind:"TableNode",table:xi.createWithSchema(t,e)})}});function hn(t){return Wr(t)&&Vn(t.toOperationNode)}function dg(t){return Wr(t)&&"expressionType"in t&&hn(t)}function pg(t){return Wr(t)&&"expression"in t&&pr(t.alias)&&hn(t)}const Sr=p({is(t){return t.kind==="SelectModifierNode"},create(t){return p({kind:"SelectModifierNode",modifier:t})},createWithExpression(t){return p({kind:"SelectModifierNode",rawModifier:t})}}),Da=p({is(t){return t.kind==="AndNode"},create(t,e){return p({kind:"AndNode",left:t,right:e})}}),La=p({is(t){return t.kind==="OrNode"},create(t,e){return p({kind:"OrNode",left:t,right:e})}}),pa=p({is(t){return t.kind==="OnNode"},create(t){return p({kind:"OnNode",on:t})},cloneWithOperation(t,e,n){return p({...t,on:e==="And"?Da.create(t.on,n):La.create(t.on,n)})}}),jn=p({is(t){return t.kind==="JoinNode"},create(t,e){return p({kind:"JoinNode",joinType:t,table:e,on:void 0})},createWithOn(t,e,n){return p({kind:"JoinNode",joinType:t,table:e,on:pa.create(n)})},cloneWithOn(t,e){return p({...t,on:t.on?pa.cloneWithOperation(t.on,"And",e):pa.create(e)})},cloneWithOrOn(t,e){return p({...t,on:t.on?pa.cloneWithOperation(t.on,"Or",e):pa.create(e)})}}),ml=p({is(t){return t.kind==="BinaryOperationNode"},create(t,e,n){return p({kind:"BinaryOperationNode",leftOperand:t,operator:e,rightOperand:n})}}),en=p({is(t){return t.kind==="RawNode"},create(t,e){return p({kind:"RawNode",sqlFragments:p(t),parameters:p(e)})},createWithSql(t){return en.create([t],[])},createWithChild(t){return en.create(["",""],[t])},createWithChildren(t){return en.create(new Array(t.length+1).fill(""),t)}}),bp=["=","==","!=","<>",">",">=","<","<=","in","not in","is","is not","like","not like","match","ilike","not ilike","@>","<@","?","?&","!<","!>","<=>","!~","~","~*","!~*","@@","@@@","!!","<->"],mg=["+","-","*","/","%","^","&","|","#","<<",">>"],Np=[...bp,...mg,"&&","||"],yg=["exists","not exists"],wg=["not","-",...yg],gg=[...Np,...wg],Ff=p({is(t){return t.kind==="OperatorNode"},create(t){return p({kind:"OperatorNode",operator:t})}});function vp(t){return pr(t)&&Np.includes(t)}function _p(t){return pr(t)&&bp.includes(t)}const ro=p({is(t){return t.kind==="ParensNode"},create(t){return p({kind:"ParensNode",node:t})}}),Nt=p({is(t){return t.kind==="ColumnNode"},create(t){return p({kind:"ColumnNode",column:mt.create(t)})}}),Uf=p({is(t){return t.kind==="SelectAllNode"},create(){return p({kind:"SelectAllNode"})}}),yl=p({is(t){return t.kind==="ReferenceNode"},create(t,e){return p({kind:"ReferenceNode",table:t,column:e})},createSelectAll(t){return p({kind:"ReferenceNode",table:t,column:Uf.create()})}}),bg=p({is(t){return t.kind==="OrderByItemNode"},create(t,e){return p({kind:"OrderByItemNode",orderBy:t,direction:e})}});function Ng(t){return t==="asc"||t==="desc"}function wl(t,e){return bg.create(vg(t),_g(e))}function vg(t){return Hr(t)}function _g(t){if(t)return t==="asc"||t==="desc"?en.createWithSql(t):t.toOperationNode()}function xp(t){return pr(t)?Po(t):t.toOperationNode()}function Pa(t){return wu(t)?t.map(e=>Hr(e)):[Hr(t)]}function Hr(t){return xl(t)?_l(t):xp(t)}function Po(t){const e=".";if(t.includes(e)){const n=t.split(e).map($f);if(n.length===3)return Eg(n);if(n.length===2)return Cg(n);throw new Error(`invalid column reference ${t}`)}else return Nt.create(t)}function xg(t){const e=" as ";if(t.includes(e)){const[n,i]=t.split(e).map($f);return xs.create(Po(n),mt.create(i))}else return Po(t)}function Ep(t){return Nt.create(t)}function Ah(t){const e=" ";if(t.includes(e)){const[n,i]=t.split(e).map($f);if(!Ng(i))throw new Error(`invalid order direction "${i}" next to "${n}"`);return wl(n,i)}else return Ep(t)}function Eg(t){const[e,n,i]=t;return yl.create(Ni.createWithSchema(e,n),Nt.create(i))}function Cg(t){const[e,n]=t;return yl.create(Ni.create(e),Nt.create(n))}function $f(t){return t.trim()}const Cp=p({is(t){return t.kind==="PrimitiveValueListNode"},create(t){return p({kind:"PrimitiveValueListNode",values:p([...t])})}}),Qf=p({is(t){return t.kind==="ValueListNode"},create(t){return p({kind:"ValueListNode",values:p(t)})}}),Ir=p({is(t){return t.kind==="ValueNode"},create(t){return p({kind:"ValueNode",value:t})},createImmediate(t){return p({kind:"ValueNode",value:t,immediate:!0})}});function Op(t){return wu(t)?Og(t):Ur(t)}function Ur(t){return xl(t)?_l(t):Ir.create(t)}function Og(t){return t.some(xl)?Qf.create(t.map(e=>Ur(e))):Cp.create(t)}const Mo=p({is(t){return t.kind==="OrderByNode"},create(t){return p({kind:"OrderByNode",items:p([t])})},cloneWithItem(t,e){return p({...t,items:p([...t.items,e])})}}),Th=p({is(t){return t.kind==="PartitionByNode"},create(t){return p({kind:"PartitionByNode",items:p(t)})},cloneWithItems(t,e){return p({...t,items:p([...t.items,...e])})}}),of=p({is(t){return t.kind==="OverNode"},create(){return p({kind:"OverNode"})},cloneWithOrderByItem(t,e){return p({...t,orderBy:t.orderBy?Mo.cloneWithItem(t.orderBy,e):Mo.create(e)})},cloneWithPartitionByItems(t,e){return p({...t,partitionBy:t.partitionBy?Th.cloneWithItems(t.partitionBy,e):Th.create(e)})}}),lc=p({is(t){return t.kind==="FromNode"},create(t){return p({kind:"FromNode",froms:p(t)})},cloneWithFroms(t,e){return p({...t,froms:p([...t.froms,...e])})}}),Sh=p({is(t){return t.kind==="GroupByNode"},create(t){return p({kind:"GroupByNode",items:p(t)})},cloneWithItems(t,e){return p({...t,items:p([...t.items,...e])})}}),Hu=p({is(t){return t.kind==="HavingNode"},create(t){return p({kind:"HavingNode",having:t})},cloneWithOperation(t,e,n){return p({...t,having:e==="And"?Da.create(t.having,n):La.create(t.having,n)})}}),We=p({is(t){return t.kind==="SelectQueryNode"},create(t,e){return p({kind:"SelectQueryNode",from:lc.create(t),...e&&{with:e}})},cloneWithSelections(t,e){return p({...t,selections:t.selections?p([...t.selections,...e]):p(e)})},cloneWithDistinctOn(t,e){return p({...t,distinctOn:t.distinctOn?p([...t.distinctOn,...e]):p(e)})},cloneWithFrontModifier(t,e){return p({...t,frontModifiers:t.frontModifiers?p([...t.frontModifiers,e]):p([e])})},cloneWithEndModifier(t,e){return p({...t,endModifiers:t.endModifiers?p([...t.endModifiers,e]):p([e])})},cloneWithOrderByItem(t,e){return p({...t,orderBy:t.orderBy?Mo.cloneWithItem(t.orderBy,e):Mo.create(e)})},cloneWithGroupByItems(t,e){return p({...t,groupBy:t.groupBy?Sh.cloneWithItems(t.groupBy,e):Sh.create(e)})},cloneWithLimit(t,e){return p({...t,limit:e})},cloneWithOffset(t,e){return p({...t,offset:e})},cloneWithHaving(t,e){return p({...t,having:t.having?Hu.cloneWithOperation(t.having,"And",e):Hu.create(e)})},cloneWithOrHaving(t,e){return p({...t,having:t.having?Hu.cloneWithOperation(t.having,"Or",e):Hu.create(e)})},cloneWithSetOperation(t,e){return p({...t,setOperations:t.setOperations?p([...t.setOperations,e]):p([e])})},cloneWithoutSelections(t){return p({...t,selections:[]})},cloneWithoutLimit(t){return p({...t,limit:void 0})},cloneWithoutOffset(t){return p({...t,offset:void 0})},cloneWithoutOrderBy(t){return p({...t,orderBy:void 0})}}),qp=p({is(t){return t.kind==="UnaryOperationNode"},create(t,e){return p({kind:"UnaryOperationNode",operator:t,operand:e})}});function sn(t){return jf("exists",t)}function Vt(t){return jf("not exists",t)}function jf(t,e){return qp.create(Ff.create(t),Hr(e))}function $e(t,e){Object.defineProperties(t.prototype,{then:{enumerable:!1,value:()=>{throw new Error(e)}}})}var ft;const tr=class{constructor(e){S(this,ft,void 0);P(this,ft,p(e))}on(...e){return new tr({...r(this,ft),joinNode:jn.cloneWithOn(r(this,ft).joinNode,jh(e))})}orOn(...e){return new tr({...r(this,ft),joinNode:jn.cloneWithOrOn(r(this,ft).joinNode,jh(e))})}onRef(e,n,i){return new tr({...r(this,ft),joinNode:jn.cloneWithOn(r(this,ft).joinNode,zt(e,n,i))})}orOnRef(e,n,i){return new tr({...r(this,ft),joinNode:jn.cloneWithOrOn(r(this,ft).joinNode,zt(e,n,i))})}onExists(e){return new tr({...r(this,ft),joinNode:jn.cloneWithOn(r(this,ft).joinNode,sn(e))})}onNotExists(e){return new tr({...r(this,ft),joinNode:jn.cloneWithOn(r(this,ft).joinNode,Vt(e))})}orOnExists(e){return new tr({...r(this,ft),joinNode:jn.cloneWithOrOn(r(this,ft).joinNode,sn(e))})}orOnNotExists(e){return new tr({...r(this,ft),joinNode:jn.cloneWithOrOn(r(this,ft).joinNode,Vt(e))})}onTrue(){return new tr({...r(this,ft),joinNode:jn.cloneWithOn(r(this,ft).joinNode,en.createWithSql("true"))})}$call(e){return e(this)}toOperationNode(){return r(this,ft).joinNode}};let fc=tr;ft=new WeakMap;$e(fc,"don't await JoinBuilder instances. They are never executed directly and are always just a part of a query.");const qg=p({is(t){return t.kind==="PartitionByItemNode"},create(t){return p({kind:"PartitionByItemNode",partitionBy:t})}});function Wg(t){return Pa(t).map(qg.create)}var ns;const Rc=class{constructor(e){S(this,ns,void 0);P(this,ns,p(e))}orderBy(e,n){return new Rc({overNode:of.cloneWithOrderByItem(r(this,ns).overNode,wl(e,n))})}partitionBy(e){return new Rc({overNode:of.cloneWithPartitionByItems(r(this,ns).overNode,Wg(e))})}$call(e){return e(this)}toOperationNode(){return r(this,ns).overNode}};let hc=Rc;ns=new WeakMap;$e(hc,"don't await OverBuilder instances. They are never executed directly and are always just a part of a query.");const _a=p({is(t){return t.kind==="SelectionNode"},create(t){return p({kind:"SelectionNode",selection:t})},createSelectAll(){return p({kind:"SelectionNode",selection:Uf.create()})},createSelectAllFromTable(t){return p({kind:"SelectionNode",selection:yl.createSelectAll(t)})}});var io;class Ig{constructor(e){S(this,io,void 0);P(this,io,e)}get dynamicReference(){return r(this,io)}get refType(){}toOperationNode(){return xp(r(this,io))}}io=new WeakMap;function Ag(t){return Wr(t)&&hn(t)&&pr(t.dynamicReference)}function gu(t){return Vn(t)?gu(t($r())):wu(t)?t.map(e=>kh(e)):[kh(t)]}function kh(t){return pr(t)?_a.create(xg(t)):Ag(t)?_a.create(t.toOperationNode()):_a.create(Hp(t))}function bu(t){return t?Array.isArray(t)?t.map(Rh):[Rh(t)]:[_a.createSelectAll()]}function Rh(t){if(pr(t))return _a.createSelectAllFromTable(_n(t));throw new Error(`invalid value selectAll expression: ${JSON.stringify(t)}`)}const Tg=p({is(t){return t.kind==="ValuesNode"},create(t){return p({kind:"ValuesNode",values:p(t)})}}),Sg=p({is(t){return t.kind==="DefaultInsertValueNode"},create(){return p({kind:"DefaultInsertValueNode"})}});function kg(t){const e=Vn(t)?t($r()):t,n=wu(e)?e:p([e]);return Rg(n)}function Rg(t){const e=Dg(t);return[p([...e.keys()].map(Nt.create)),Tg.create(t.map(n=>Lg(n,e)))]}function Dg(t){const e=new Map;for(const n of t){const i=Object.keys(n);for(const a of i)!e.has(a)&&n[a]!==void 0&&e.set(a,e.size)}return e}function Lg(t,e){const n=Object.keys(t),i=Array.from({length:e.size});let a=!1;for(const m of n){const w=e.get(m);if(va(w))continue;const v=t[m];(va(v)||xl(v))&&(a=!0),i[w]=v}if(n.lengthva(w)?m:Ur(w)))}return Cp.create(i)}const Or=p({is(t){return t.kind==="InsertQueryNode"},create(t,e,n){return p({kind:"InsertQueryNode",into:t,...e&&{with:e},replace:n})},cloneWith(t,e){return p({...t,...e})}}),dc=p({is(t){return t.kind==="UpdateQueryNode"},create(t,e){return p({kind:"UpdateQueryNode",table:t,...e&&{with:e}})},cloneWithFromItems(t,e){return p({...t,from:t.from?lc.cloneWithFroms(t.from,e):lc.create(e)})},cloneWithUpdates(t,e){return p({...t,updates:t.updates?p([...t.updates,...e]):e})}}),Dh=p({is(t){return t.kind==="UsingNode"},create(t){return p({kind:"UsingNode",tables:p(t)})},cloneWithTables(t,e){return p({...t,tables:p([...t.tables,...e])})}}),xa=p({is(t){return t.kind==="DeleteQueryNode"},create(t,e){return p({kind:"DeleteQueryNode",from:lc.create(t),...e&&{with:e}})},cloneWithOrderByItem(t,e){return p({...t,orderBy:t.orderBy?Mo.cloneWithItem(t.orderBy,e):Mo.create(e)})},cloneWithLimit(t,e){return p({...t,limit:e})},cloneWithUsing(t,e){return p({...t,using:t.using!==void 0?Dh.cloneWithTables(t.using,e):Dh.create(e)})}}),tn=p({is(t){return t.kind==="WhereNode"},create(t){return p({kind:"WhereNode",where:t})},cloneWithOperation(t,e,n){return p({...t,where:e==="And"?Da.create(t.where,n):La.create(t.where,n)})}}),Lh=p({is(t){return t.kind==="ReturningNode"},create(t){return p({kind:"ReturningNode",selections:p(t)})},cloneWithSelections(t,e){return p({...t,selections:t.selections?p([...t.selections,...e]):p(e)})}}),Pg=p({is(t){return t.kind==="ExplainNode"},create(t,e){return p({kind:"ExplainNode",format:t,options:e})}}),ye=p({is(t){return We.is(t)||Or.is(t)||dc.is(t)||xa.is(t)},cloneWithWhere(t,e){return p({...t,where:t.where?tn.cloneWithOperation(t.where,"And",e):tn.create(e)})},cloneWithOrWhere(t,e){return p({...t,where:t.where?tn.cloneWithOperation(t.where,"Or",e):tn.create(e)})},cloneWithJoin(t,e){return p({...t,joins:t.joins?p([...t.joins,e]):p([e])})},cloneWithReturning(t,e){return p({...t,returning:t.returning?Lh.cloneWithSelections(t.returning,e):Lh.create(e)})},cloneWithoutWhere(t){return p({...t,where:void 0})},cloneWithExplain(t,e,n){return p({...t,explain:Pg.create(e,n==null?void 0:n.toOperationNode())})}}),Mg=p({is(t){return t.kind==="ColumnUpdateNode"},create(t,e){return p({kind:"ColumnUpdateNode",column:t,value:e})}});function Hf(t){const e=Vn(t)?t($r()):t;return Object.entries(e).filter(([n,i])=>i!==void 0).map(([n,i])=>Mg.create(Nt.create(n),Ur(i)))}const Bg=p({is(t){return t.kind==="OnDuplicateKeyNode"},create(t){return p({kind:"OnDuplicateKeyNode",updates:t})}});var Qa,ja;class Wp{constructor(e,n){S(this,Qa,void 0);S(this,ja,void 0);P(this,Qa,e),P(this,ja,n)}get insertId(){return r(this,Qa)}get numInsertedOrUpdatedRows(){return r(this,ja)}}Qa=new WeakMap,ja=new WeakMap;for(const t of["insertId","numInsertedOrUpdatedRows"])Object.defineProperty(Wp.prototype,t,{enumerable:!0});class gl extends Error{constructor(n){super("no result");Yt(this,"node");this.node=n}}function bl(t){return Object.prototype.hasOwnProperty.call(t,"prototype")}const at=p({is(t){return t.kind==="OnConflictNode"},create(){return p({kind:"OnConflictNode"})},cloneWith(t,e){return p({...t,...e})},cloneWithIndexWhere(t,e){return p({...t,indexWhere:t.indexWhere?tn.cloneWithOperation(t.indexWhere,"And",e):tn.create(e)})},cloneWithIndexOrWhere(t,e){return p({...t,indexWhere:t.indexWhere?tn.cloneWithOperation(t.indexWhere,"Or",e):tn.create(e)})},cloneWithUpdateWhere(t,e){return p({...t,updateWhere:t.updateWhere?tn.cloneWithOperation(t.updateWhere,"And",e):tn.create(e)})},cloneWithUpdateOrWhere(t,e){return p({...t,updateWhere:t.updateWhere?tn.cloneWithOperation(t.updateWhere,"Or",e):tn.create(e)})},cloneWithoutIndexWhere(t){return p({...t,indexWhere:void 0})},cloneWithoutUpdateWhere(t){return p({...t,updateWhere:void 0})}});var ke;const cn=class{constructor(e){S(this,ke,void 0);P(this,ke,p(e))}column(e){const n=Nt.create(e);return new cn({...r(this,ke),onConflictNode:at.cloneWith(r(this,ke).onConflictNode,{columns:r(this,ke).onConflictNode.columns?p([...r(this,ke).onConflictNode.columns,n]):p([n])})})}columns(e){const n=e.map(Nt.create);return new cn({...r(this,ke),onConflictNode:at.cloneWith(r(this,ke).onConflictNode,{columns:r(this,ke).onConflictNode.columns?p([...r(this,ke).onConflictNode.columns,...n]):p(n)})})}constraint(e){return new cn({...r(this,ke),onConflictNode:at.cloneWith(r(this,ke).onConflictNode,{constraint:mt.create(e)})})}expression(e){return new cn({...r(this,ke),onConflictNode:at.cloneWith(r(this,ke).onConflictNode,{indexExpression:e.toOperationNode()})})}where(...e){return new cn({...r(this,ke),onConflictNode:at.cloneWithIndexWhere(r(this,ke).onConflictNode,Rn(e))})}whereRef(e,n,i){return new cn({...r(this,ke),onConflictNode:at.cloneWithIndexWhere(r(this,ke).onConflictNode,zt(e,n,i))})}orWhere(...e){return new cn({...r(this,ke),onConflictNode:at.cloneWithIndexOrWhere(r(this,ke).onConflictNode,Rn(e))})}orWhereRef(e,n,i){return new cn({...r(this,ke),onConflictNode:at.cloneWithIndexOrWhere(r(this,ke).onConflictNode,zt(e,n,i))})}whereExists(e){return new cn({...r(this,ke),onConflictNode:at.cloneWithIndexWhere(r(this,ke).onConflictNode,sn(e))})}whereNotExists(e){return new cn({...r(this,ke),onConflictNode:at.cloneWithIndexWhere(r(this,ke).onConflictNode,Vt(e))})}orWhereExists(e){return new cn({...r(this,ke),onConflictNode:at.cloneWithIndexOrWhere(r(this,ke).onConflictNode,sn(e))})}orWhereNotExists(e){return new cn({...r(this,ke),onConflictNode:at.cloneWithIndexOrWhere(r(this,ke).onConflictNode,Vt(e))})}clearWhere(){return new cn({...r(this,ke),onConflictNode:at.cloneWithoutIndexWhere(r(this,ke).onConflictNode)})}doNothing(){return new Ip({...r(this,ke),onConflictNode:at.cloneWith(r(this,ke).onConflictNode,{doNothing:!0})})}doUpdateSet(e){return new mc({...r(this,ke),onConflictNode:at.cloneWith(r(this,ke).onConflictNode,{updates:Hf(e)})})}$call(e){return e(this)}};let pc=cn;ke=new WeakMap;$e(pc,"don't await OnConflictBuilder instances.");var Ha;class Ip{constructor(e){S(this,Ha,void 0);P(this,Ha,p(e))}toOperationNode(){return r(this,Ha).onConflictNode}}Ha=new WeakMap;$e(Ip,"don't await OnConflictDoNothingBuilder instances.");var ht;const nr=class{constructor(e){S(this,ht,void 0);P(this,ht,p(e))}where(...e){return new nr({...r(this,ht),onConflictNode:at.cloneWithUpdateWhere(r(this,ht).onConflictNode,Rn(e))})}whereRef(e,n,i){return new nr({...r(this,ht),onConflictNode:at.cloneWithUpdateWhere(r(this,ht).onConflictNode,zt(e,n,i))})}orWhere(...e){return new nr({...r(this,ht),onConflictNode:at.cloneWithUpdateOrWhere(r(this,ht).onConflictNode,Rn(e))})}orWhereRef(e,n,i){return new nr({...r(this,ht),onConflictNode:at.cloneWithUpdateOrWhere(r(this,ht).onConflictNode,zt(e,n,i))})}whereExists(e){return new nr({...r(this,ht),onConflictNode:at.cloneWithUpdateWhere(r(this,ht).onConflictNode,sn(e))})}whereNotExists(e){return new nr({...r(this,ht),onConflictNode:at.cloneWithUpdateWhere(r(this,ht).onConflictNode,Vt(e))})}orWhereExists(e){return new nr({...r(this,ht),onConflictNode:at.cloneWithUpdateOrWhere(r(this,ht).onConflictNode,sn(e))})}orWhereNotExists(e){return new nr({...r(this,ht),onConflictNode:at.cloneWithUpdateOrWhere(r(this,ht).onConflictNode,Vt(e))})}clearWhere(){return new nr({...r(this,ht),onConflictNode:at.cloneWithoutUpdateWhere(r(this,ht).onConflictNode)})}$call(e){return e(this)}toOperationNode(){return r(this,ht).onConflictNode}};let mc=nr;ht=new WeakMap;$e(mc,"don't await OnConflictUpdateBuilder instances.");var Te;const Tt=class{constructor(e){S(this,Te,void 0);P(this,Te,p(e))}values(e){const[n,i]=kg(e);return new Tt({...r(this,Te),queryNode:Or.cloneWith(r(this,Te).queryNode,{columns:n,values:i})})}columns(e){return new Tt({...r(this,Te),queryNode:Or.cloneWith(r(this,Te).queryNode,{columns:p(e.map(Nt.create))})})}expression(e){return new Tt({...r(this,Te),queryNode:Or.cloneWith(r(this,Te).queryNode,{values:_l(e)})})}ignore(){return new Tt({...r(this,Te),queryNode:Or.cloneWith(r(this,Te).queryNode,{ignore:!0})})}onConflict(e){return new Tt({...r(this,Te),queryNode:Or.cloneWith(r(this,Te).queryNode,{onConflict:e(new pc({onConflictNode:at.create()})).toOperationNode()})})}onDuplicateKeyUpdate(e){return new Tt({...r(this,Te),queryNode:Or.cloneWith(r(this,Te).queryNode,{onDuplicateKey:Bg.create(Hf(e))})})}returning(e){return new Tt({...r(this,Te),queryNode:ye.cloneWithReturning(r(this,Te).queryNode,gu(e))})}returningAll(){return new Tt({...r(this,Te),queryNode:ye.cloneWithReturning(r(this,Te).queryNode,bu())})}$call(e){return e(this)}call(e){return this.$call(e)}$if(e,n){return e?n(this):new Tt({...r(this,Te)})}if(e,n){return e?n(this):new Tt({...r(this,Te)})}$castTo(){return new Tt(r(this,Te))}castTo(){return this.$castTo()}$narrowType(){return new Tt(r(this,Te))}$assertType(){return new Tt(r(this,Te))}assertType(){return new Tt(r(this,Te))}withPlugin(e){return new Tt({...r(this,Te),executor:r(this,Te).executor.withPlugin(e)})}toOperationNode(){return r(this,Te).executor.transformQuery(r(this,Te).queryNode,r(this,Te).queryId)}compile(){return r(this,Te).executor.compileQuery(this.toOperationNode(),r(this,Te).queryId)}async execute(){const e=this.compile(),n=e.query,i=await r(this,Te).executor.executeQuery(e,r(this,Te).queryId);return r(this,Te).executor.adapter.supportsReturning&&n.returning?i.rows:[new Wp(i.insertId,i.numAffectedRows??i.numUpdatedOrDeletedRows)]}async executeTakeFirst(){const[e]=await this.execute();return e}async executeTakeFirstOrThrow(e=gl){const n=await this.executeTakeFirst();if(n===void 0)throw bl(e)?new e(this.toOperationNode()):e(this.toOperationNode());return n}async*stream(e=100){const n=this.compile(),i=r(this,Te).executor.stream(n,e,r(this,Te).queryId);for await(const a of i)yield*a.rows}async explain(e,n){return await new Tt({...r(this,Te),queryNode:ye.cloneWithExplain(r(this,Te).queryNode,e,n)}).execute()}};let Ma=Tt;Te=new WeakMap;$e(Ma,"don't await InsertQueryBuilder instances directly. To execute the query you need to call `execute` or `executeTakeFirst`.");var Va;class Ap{constructor(e){S(this,Va,void 0);P(this,Va,e)}get numDeletedRows(){return r(this,Va)}}Va=new WeakMap;Object.defineProperty(Ap.prototype,"numDeletedRows",{enumerable:!0});const Tp=p({is(t){return t.kind==="LimitNode"},create(t){return p({kind:"LimitNode",limit:Ir.create(t)})}});var de;const Xe=class{constructor(e){S(this,de,void 0);P(this,de,p(e))}where(...e){return new Xe({...r(this,de),queryNode:ye.cloneWithWhere(r(this,de).queryNode,Rn(e))})}whereRef(e,n,i){return new Xe({...r(this,de),queryNode:ye.cloneWithWhere(r(this,de).queryNode,zt(e,n,i))})}orWhere(...e){return new Xe({...r(this,de),queryNode:ye.cloneWithOrWhere(r(this,de).queryNode,Rn(e))})}orWhereRef(e,n,i){return new Xe({...r(this,de),queryNode:ye.cloneWithOrWhere(r(this,de).queryNode,zt(e,n,i))})}whereExists(e){return new Xe({...r(this,de),queryNode:ye.cloneWithWhere(r(this,de).queryNode,sn(e))})}whereNotExists(e){return new Xe({...r(this,de),queryNode:ye.cloneWithWhere(r(this,de).queryNode,Vt(e))})}orWhereExists(e){return new Xe({...r(this,de),queryNode:ye.cloneWithOrWhere(r(this,de).queryNode,sn(e))})}orWhereNotExists(e){return new Xe({...r(this,de),queryNode:ye.cloneWithOrWhere(r(this,de).queryNode,Vt(e))})}clearWhere(){return new Xe({...r(this,de),queryNode:ye.cloneWithoutWhere(r(this,de).queryNode)})}using(e){return new Xe({...r(this,de),queryNode:xa.cloneWithUsing(r(this,de).queryNode,Fo(e))})}innerJoin(...e){return new Xe({...r(this,de),queryNode:ye.cloneWithJoin(r(this,de).queryNode,vn("InnerJoin",e))})}leftJoin(...e){return new Xe({...r(this,de),queryNode:ye.cloneWithJoin(r(this,de).queryNode,vn("LeftJoin",e))})}rightJoin(...e){return new Xe({...r(this,de),queryNode:ye.cloneWithJoin(r(this,de).queryNode,vn("RightJoin",e))})}fullJoin(...e){return new Xe({...r(this,de),queryNode:ye.cloneWithJoin(r(this,de).queryNode,vn("FullJoin",e))})}returning(e){return new Xe({...r(this,de),queryNode:ye.cloneWithReturning(r(this,de).queryNode,gu(e))})}returningAll(e){return new Xe({...r(this,de),queryNode:ye.cloneWithReturning(r(this,de).queryNode,bu(e))})}orderBy(e,n){return new Xe({...r(this,de),queryNode:xa.cloneWithOrderByItem(r(this,de).queryNode,wl(e,n))})}limit(e){return new Xe({...r(this,de),queryNode:xa.cloneWithLimit(r(this,de).queryNode,Tp.create(e))})}$call(e){return e(this)}call(e){return this.$call(e)}$if(e,n){return e?n(this):new Xe({...r(this,de)})}if(e,n){return this.$if(e,n)}$castTo(){return new Xe(r(this,de))}castTo(){return this.$castTo()}$narrowType(){return new Xe(r(this,de))}$assertType(){return new Xe(r(this,de))}assertType(){return new Xe(r(this,de))}withPlugin(e){return new Xe({...r(this,de),executor:r(this,de).executor.withPlugin(e)})}toOperationNode(){return r(this,de).executor.transformQuery(r(this,de).queryNode,r(this,de).queryId)}compile(){return r(this,de).executor.compileQuery(this.toOperationNode(),r(this,de).queryId)}async execute(){const e=this.compile(),n=e.query,i=await r(this,de).executor.executeQuery(e,r(this,de).queryId);return r(this,de).executor.adapter.supportsReturning&&n.returning?i.rows:[new Ap(i.numAffectedRows??i.numUpdatedOrDeletedRows??BigInt(0))]}async executeTakeFirst(){const[e]=await this.execute();return e}async executeTakeFirstOrThrow(e=gl){const n=await this.executeTakeFirst();if(n===void 0)throw bl(e)?new e(this.toOperationNode()):e(this.toOperationNode());return n}async*stream(e=100){const n=this.compile(),i=r(this,de).executor.stream(n,e,r(this,de).queryId);for await(const a of i)yield*a.rows}async explain(e,n){return await new Xe({...r(this,de),queryNode:ye.cloneWithExplain(r(this,de).queryNode,e,n)}).execute()}};let yc=Xe;de=new WeakMap;$e(yc,"don't await DeleteQueryBuilder instances directly. To execute the query you need to call `execute` or `executeTakeFirst`.");var za;class Sp{constructor(e){S(this,za,void 0);P(this,za,e)}get numUpdatedRows(){return r(this,za)}}za=new WeakMap;Object.defineProperty(Sp.prototype,"numUpdatedRows",{enumerable:!0});var pe;const nt=class{constructor(e){S(this,pe,void 0);P(this,pe,p(e))}where(...e){return new nt({...r(this,pe),queryNode:ye.cloneWithWhere(r(this,pe).queryNode,Rn(e))})}whereRef(e,n,i){return new nt({...r(this,pe),queryNode:ye.cloneWithWhere(r(this,pe).queryNode,zt(e,n,i))})}orWhere(...e){return new nt({...r(this,pe),queryNode:ye.cloneWithOrWhere(r(this,pe).queryNode,Rn(e))})}orWhereRef(e,n,i){return new nt({...r(this,pe),queryNode:ye.cloneWithOrWhere(r(this,pe).queryNode,zt(e,n,i))})}whereExists(e){return new nt({...r(this,pe),queryNode:ye.cloneWithWhere(r(this,pe).queryNode,sn(e))})}whereNotExists(e){return new nt({...r(this,pe),queryNode:ye.cloneWithWhere(r(this,pe).queryNode,Vt(e))})}orWhereExists(e){return new nt({...r(this,pe),queryNode:ye.cloneWithOrWhere(r(this,pe).queryNode,sn(e))})}orWhereNotExists(e){return new nt({...r(this,pe),queryNode:ye.cloneWithOrWhere(r(this,pe).queryNode,Vt(e))})}clearWhere(){return new nt({...r(this,pe),queryNode:ye.cloneWithoutWhere(r(this,pe).queryNode)})}from(e){return new nt({...r(this,pe),queryNode:dc.cloneWithFromItems(r(this,pe).queryNode,Fo(e))})}innerJoin(...e){return new nt({...r(this,pe),queryNode:ye.cloneWithJoin(r(this,pe).queryNode,vn("InnerJoin",e))})}leftJoin(...e){return new nt({...r(this,pe),queryNode:ye.cloneWithJoin(r(this,pe).queryNode,vn("LeftJoin",e))})}rightJoin(...e){return new nt({...r(this,pe),queryNode:ye.cloneWithJoin(r(this,pe).queryNode,vn("RightJoin",e))})}fullJoin(...e){return new nt({...r(this,pe),queryNode:ye.cloneWithJoin(r(this,pe).queryNode,vn("FullJoin",e))})}set(e){return new nt({...r(this,pe),queryNode:dc.cloneWithUpdates(r(this,pe).queryNode,Hf(e))})}returning(e){return new nt({...r(this,pe),queryNode:ye.cloneWithReturning(r(this,pe).queryNode,gu(e))})}returningAll(){return new nt({...r(this,pe),queryNode:ye.cloneWithReturning(r(this,pe).queryNode,bu())})}$call(e){return e(this)}call(e){return this.$call(e)}$if(e,n){return e?n(this):new nt({...r(this,pe)})}if(e,n){return this.$if(e,n)}$castTo(){return new nt(r(this,pe))}castTo(){return this.$castTo()}$narrowType(){return new nt(r(this,pe))}$assertType(){return new nt(r(this,pe))}assertType(){return new nt(r(this,pe))}withPlugin(e){return new nt({...r(this,pe),executor:r(this,pe).executor.withPlugin(e)})}toOperationNode(){return r(this,pe).executor.transformQuery(r(this,pe).queryNode,r(this,pe).queryId)}compile(){return r(this,pe).executor.compileQuery(this.toOperationNode(),r(this,pe).queryId)}async execute(){const e=this.compile(),n=e.query,i=await r(this,pe).executor.executeQuery(e,r(this,pe).queryId);return r(this,pe).executor.adapter.supportsReturning&&n.returning?i.rows:[new Sp(i.numAffectedRows??i.numUpdatedOrDeletedRows??BigInt(0))]}async executeTakeFirst(){const[e]=await this.execute();return e}async executeTakeFirstOrThrow(e=gl){const n=await this.executeTakeFirst();if(n===void 0)throw bl(e)?new e(this.toOperationNode()):e(this.toOperationNode());return n}async*stream(e=100){const n=this.compile(),i=r(this,pe).executor.stream(n,e,r(this,pe).queryId);for await(const a of i)yield*a.rows}async explain(e,n){return await new nt({...r(this,pe),queryNode:ye.cloneWithExplain(r(this,pe).queryNode,e,n)}).execute()}};let wc=nt;pe=new WeakMap;$e(wc,"don't await UpdateQueryBuilder instances directly. To execute the query you need to call `execute` or `executeTakeFirst`.");const Fg=p({is(t){return t.kind==="CommonTableExpressionNode"},create(t,e){return p({kind:"CommonTableExpressionNode",name:t,expression:e})}}),Ph=p({is(t){return t.kind==="CommonTableExpressionNameNode"},create(t,e){return p({kind:"CommonTableExpressionNameNode",table:Ni.create(t),columns:e?p(e.map(Nt.create)):void 0})}});function Mh(t,e){const n=e(Gg());return Fg.create(Ug(t),n.toOperationNode())}function Ug(t){if(t.includes("(")){const e=t.split(/[\(\)]/),n=e[0],i=e[1].split(",").map(a=>a.trim());return Ph.create(n,i)}else return Ph.create(t)}const Vu=p({is(t){return t.kind==="WithNode"},create(t,e){return p({kind:"WithNode",expressions:p([t]),...e})},cloneWithExpression(t,e){return p({...t,expressions:p([...t.expressions,e])})}}),Bh=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"];function $g(t){let e="";for(let n=0;nthis.transformNode(n)))}transformSelectQuery(e){return{kind:"SelectQueryNode",from:this.transformNode(e.from),selections:this.transformNodeList(e.selections),distinctOn:this.transformNodeList(e.distinctOn),joins:this.transformNodeList(e.joins),groupBy:this.transformNode(e.groupBy),orderBy:this.transformNode(e.orderBy),where:this.transformNode(e.where),frontModifiers:this.transformNodeList(e.frontModifiers),endModifiers:this.transformNodeList(e.endModifiers),limit:this.transformNode(e.limit),offset:this.transformNode(e.offset),with:this.transformNode(e.with),having:this.transformNode(e.having),explain:this.transformNode(e.explain),setOperations:this.transformNodeList(e.setOperations)}}transformSelection(e){return{kind:"SelectionNode",selection:this.transformNode(e.selection)}}transformColumn(e){return{kind:"ColumnNode",column:this.transformNode(e.column)}}transformAlias(e){return{kind:"AliasNode",node:this.transformNode(e.node),alias:this.transformNode(e.alias)}}transformTable(e){return{kind:"TableNode",table:this.transformNode(e.table)}}transformFrom(e){return{kind:"FromNode",froms:this.transformNodeList(e.froms)}}transformReference(e){return{kind:"ReferenceNode",table:this.transformNode(e.table),column:this.transformNode(e.column)}}transformAnd(e){return{kind:"AndNode",left:this.transformNode(e.left),right:this.transformNode(e.right)}}transformOr(e){return{kind:"OrNode",left:this.transformNode(e.left),right:this.transformNode(e.right)}}transformValueList(e){return{kind:"ValueListNode",values:this.transformNodeList(e.values)}}transformParens(e){return{kind:"ParensNode",node:this.transformNode(e.node)}}transformJoin(e){return{kind:"JoinNode",joinType:e.joinType,table:this.transformNode(e.table),on:this.transformNode(e.on)}}transformRaw(e){return{kind:"RawNode",sqlFragments:p([...e.sqlFragments]),parameters:this.transformNodeList(e.parameters)}}transformWhere(e){return{kind:"WhereNode",where:this.transformNode(e.where)}}transformInsertQuery(e){return{kind:"InsertQueryNode",into:this.transformNode(e.into),columns:this.transformNodeList(e.columns),values:this.transformNode(e.values),returning:this.transformNode(e.returning),onConflict:this.transformNode(e.onConflict),onDuplicateKey:this.transformNode(e.onDuplicateKey),with:this.transformNode(e.with),ignore:e.ignore,replace:e.replace,explain:this.transformNode(e.explain)}}transformValues(e){return{kind:"ValuesNode",values:this.transformNodeList(e.values)}}transformDeleteQuery(e){return{kind:"DeleteQueryNode",from:this.transformNode(e.from),using:this.transformNode(e.using),joins:this.transformNodeList(e.joins),where:this.transformNode(e.where),returning:this.transformNode(e.returning),with:this.transformNode(e.with),orderBy:this.transformNode(e.orderBy),limit:this.transformNode(e.limit),explain:this.transformNode(e.explain)}}transformReturning(e){return{kind:"ReturningNode",selections:this.transformNodeList(e.selections)}}transformCreateTable(e){return{kind:"CreateTableNode",table:this.transformNode(e.table),columns:this.transformNodeList(e.columns),constraints:this.transformNodeList(e.constraints),temporary:e.temporary,ifNotExists:e.ifNotExists,onCommit:e.onCommit,frontModifiers:this.transformNodeList(e.frontModifiers),endModifiers:this.transformNodeList(e.endModifiers)}}transformColumnDefinition(e){return{kind:"ColumnDefinitionNode",column:this.transformNode(e.column),dataType:this.transformNode(e.dataType),references:this.transformNode(e.references),primaryKey:e.primaryKey,autoIncrement:e.autoIncrement,unique:e.unique,notNull:e.notNull,unsigned:e.unsigned,defaultTo:this.transformNode(e.defaultTo),check:this.transformNode(e.check),generated:this.transformNode(e.generated),frontModifiers:this.transformNodeList(e.frontModifiers),endModifiers:this.transformNodeList(e.endModifiers)}}transformAddColumn(e){return{kind:"AddColumnNode",column:this.transformNode(e.column)}}transformDropTable(e){return{kind:"DropTableNode",table:this.transformNode(e.table),ifExists:e.ifExists,cascade:e.cascade}}transformOrderBy(e){return{kind:"OrderByNode",items:this.transformNodeList(e.items)}}transformOrderByItem(e){return{kind:"OrderByItemNode",orderBy:this.transformNode(e.orderBy),direction:this.transformNode(e.direction)}}transformGroupBy(e){return{kind:"GroupByNode",items:this.transformNodeList(e.items)}}transformGroupByItem(e){return{kind:"GroupByItemNode",groupBy:this.transformNode(e.groupBy)}}transformUpdateQuery(e){return{kind:"UpdateQueryNode",table:this.transformNode(e.table),from:this.transformNode(e.from),joins:this.transformNodeList(e.joins),where:this.transformNode(e.where),updates:this.transformNodeList(e.updates),returning:this.transformNode(e.returning),with:this.transformNode(e.with),explain:this.transformNode(e.explain)}}transformColumnUpdate(e){return{kind:"ColumnUpdateNode",column:this.transformNode(e.column),value:this.transformNode(e.value)}}transformLimit(e){return{kind:"LimitNode",limit:this.transformNode(e.limit)}}transformOffset(e){return{kind:"OffsetNode",offset:this.transformNode(e.offset)}}transformOnConflict(e){return{kind:"OnConflictNode",columns:this.transformNodeList(e.columns),constraint:this.transformNode(e.constraint),indexExpression:this.transformNode(e.indexExpression),indexWhere:this.transformNode(e.indexWhere),updates:this.transformNodeList(e.updates),updateWhere:this.transformNode(e.updateWhere),doNothing:e.doNothing}}transformOnDuplicateKey(e){return{kind:"OnDuplicateKeyNode",updates:this.transformNodeList(e.updates)}}transformCreateIndex(e){return{kind:"CreateIndexNode",name:this.transformNode(e.name),table:this.transformNode(e.table),columns:this.transformNodeList(e.columns),unique:e.unique,using:this.transformNode(e.using),ifNotExists:e.ifNotExists,where:this.transformNode(e.where)}}transformList(e){return{kind:"ListNode",items:this.transformNodeList(e.items)}}transformDropIndex(e){return{kind:"DropIndexNode",name:this.transformNode(e.name),table:this.transformNode(e.table),ifExists:e.ifExists,cascade:e.cascade}}transformPrimaryKeyConstraint(e){return{kind:"PrimaryKeyConstraintNode",columns:this.transformNodeList(e.columns),name:this.transformNode(e.name)}}transformUniqueConstraint(e){return{kind:"UniqueConstraintNode",columns:this.transformNodeList(e.columns),name:this.transformNode(e.name)}}transformForeignKeyConstraint(e){return{kind:"ForeignKeyConstraintNode",columns:this.transformNodeList(e.columns),references:this.transformNode(e.references),name:this.transformNode(e.name),onDelete:e.onDelete,onUpdate:e.onUpdate}}transformSetOperation(e){return{kind:"SetOperationNode",operator:e.operator,expression:this.transformNode(e.expression),all:e.all}}transformReferences(e){return{kind:"ReferencesNode",table:this.transformNode(e.table),columns:this.transformNodeList(e.columns),onDelete:e.onDelete,onUpdate:e.onUpdate}}transformCheckConstraint(e){return{kind:"CheckConstraintNode",expression:this.transformNode(e.expression),name:this.transformNode(e.name)}}transformWith(e){return{kind:"WithNode",expressions:this.transformNodeList(e.expressions),recursive:e.recursive}}transformCommonTableExpression(e){return{kind:"CommonTableExpressionNode",name:this.transformNode(e.name),expression:this.transformNode(e.expression)}}transformCommonTableExpressionName(e){return{kind:"CommonTableExpressionNameNode",table:this.transformNode(e.table),columns:this.transformNodeList(e.columns)}}transformHaving(e){return{kind:"HavingNode",having:this.transformNode(e.having)}}transformCreateSchema(e){return{kind:"CreateSchemaNode",schema:this.transformNode(e.schema),ifNotExists:e.ifNotExists}}transformDropSchema(e){return{kind:"DropSchemaNode",schema:this.transformNode(e.schema),ifExists:e.ifExists,cascade:e.cascade}}transformAlterTable(e){return{kind:"AlterTableNode",table:this.transformNode(e.table),renameTo:this.transformNode(e.renameTo),setSchema:this.transformNode(e.setSchema),columnAlterations:this.transformNodeList(e.columnAlterations),addConstraint:this.transformNode(e.addConstraint),dropConstraint:this.transformNode(e.dropConstraint)}}transformDropColumn(e){return{kind:"DropColumnNode",column:this.transformNode(e.column)}}transformRenameColumn(e){return{kind:"RenameColumnNode",column:this.transformNode(e.column),renameTo:this.transformNode(e.renameTo)}}transformAlterColumn(e){return{kind:"AlterColumnNode",column:this.transformNode(e.column),dataType:this.transformNode(e.dataType),dataTypeExpression:this.transformNode(e.dataTypeExpression),setDefault:this.transformNode(e.setDefault),dropDefault:e.dropDefault,setNotNull:e.setNotNull,dropNotNull:e.dropNotNull}}transformModifyColumn(e){return{kind:"ModifyColumnNode",column:this.transformNode(e.column)}}transformAddConstraint(e){return{kind:"AddConstraintNode",constraint:this.transformNode(e.constraint)}}transformDropConstraint(e){return{kind:"DropConstraintNode",constraintName:this.transformNode(e.constraintName),ifExists:e.ifExists,modifier:e.modifier}}transformCreateView(e){return{kind:"CreateViewNode",name:this.transformNode(e.name),temporary:e.temporary,orReplace:e.orReplace,ifNotExists:e.ifNotExists,materialized:e.materialized,columns:this.transformNodeList(e.columns),as:this.transformNode(e.as)}}transformDropView(e){return{kind:"DropViewNode",name:this.transformNode(e.name),ifExists:e.ifExists,materialized:e.materialized,cascade:e.cascade}}transformGenerated(e){return{kind:"GeneratedNode",byDefault:e.byDefault,always:e.always,identity:e.identity,stored:e.stored,expression:this.transformNode(e.expression)}}transformDefaultValue(e){return{kind:"DefaultValueNode",defaultValue:this.transformNode(e.defaultValue)}}transformOn(e){return{kind:"OnNode",on:this.transformNode(e.on)}}transformSelectModifier(e){return{kind:"SelectModifierNode",modifier:e.modifier,rawModifier:this.transformNode(e.rawModifier)}}transformCreateType(e){return{kind:"CreateTypeNode",name:this.transformNode(e.name),enum:this.transformNode(e.enum)}}transformDropType(e){return{kind:"DropTypeNode",name:this.transformNode(e.name),ifExists:e.ifExists}}transformExplain(e){return{kind:"ExplainNode",format:e.format,options:this.transformNode(e.options)}}transformSchemableIdentifier(e){return{kind:"SchemableIdentifierNode",schema:this.transformNode(e.schema),identifier:this.transformNode(e.identifier)}}transformAggregateFunction(e){return{kind:"AggregateFunctionNode",aggregated:this.transformNodeList(e.aggregated),distinct:e.distinct,filter:this.transformNode(e.filter),func:e.func,over:this.transformNode(e.over)}}transformOver(e){return{kind:"OverNode",orderBy:this.transformNode(e.orderBy),partitionBy:this.transformNode(e.partitionBy)}}transformPartitionBy(e){return{kind:"PartitionByNode",items:this.transformNodeList(e.items)}}transformPartitionByItem(e){return{kind:"PartitionByItemNode",partitionBy:this.transformNode(e.partitionBy)}}transformBinaryOperation(e){return{kind:"BinaryOperationNode",leftOperand:this.transformNode(e.leftOperand),operator:this.transformNode(e.operator),rightOperand:this.transformNode(e.rightOperand)}}transformUnaryOperation(e){return{kind:"UnaryOperationNode",operator:this.transformNode(e.operator),operand:this.transformNode(e.operand)}}transformUsing(e){return{kind:"UsingNode",tables:this.transformNodeList(e.tables)}}transformFunction(e){return{kind:"FunctionNode",func:e.func,arguments:this.transformNodeList(e.arguments)}}transformCase(e){return{kind:"CaseNode",value:this.transformNode(e.value),when:this.transformNodeList(e.when),else:this.transformNode(e.else),isStatement:e.isStatement}}transformWhen(e){return{kind:"WhenNode",condition:this.transformNode(e.condition),result:this.transformNode(e.result)}}transformDataType(e){return e}transformSelectAll(e){return e}transformIdentifier(e){return e}transformValue(e){return e}transformPrimitiveValueList(e){return e}transformOperator(e){return e}transformDefaultInsertValue(e){return e}}Dc=new WeakMap;const Hg=p({AlterTableNode:!0,CreateIndexNode:!0,CreateSchemaNode:!0,CreateTableNode:!0,CreateTypeNode:!0,CreateViewNode:!0,DeleteQueryNode:!0,DropIndexNode:!0,DropSchemaNode:!0,DropTableNode:!0,DropTypeNode:!0,DropViewNode:!0,InsertQueryNode:!0,RawNode:!0,SelectQueryNode:!0,UpdateQueryNode:!0});var oo,rs,Lc,kp,Pc,Rp,is,wa,Ka,af,Mc,Dp;class Vg extends Vf{constructor(n){super();S(this,Lc);S(this,Pc);S(this,is);S(this,Ka);S(this,Mc);S(this,oo,void 0);S(this,rs,new Set);P(this,oo,n)}transformNodeImpl(n){if(!qe(this,Lc,kp).call(this,n))return super.transformNodeImpl(n);const i=qe(this,Pc,Rp).call(this,n);for(const l of i)r(this,rs).add(l);const a=super.transformNodeImpl(n);for(const l of i)r(this,rs).delete(l);return a}transformSchemableIdentifier(n){const i=super.transformSchemableIdentifier(n);return i.schema||!r(this,rs).has(n.identifier.name)?i:{...i,schema:mt.create(r(this,oo))}}transformReferences(n){const i=super.transformReferences(n);return i.table.table.schema?i:{...i,table:Ni.createWithSchema(r(this,oo),i.table.table.identifier.name)}}}oo=new WeakMap,rs=new WeakMap,Lc=new WeakSet,kp=function(n){return n.kind in Hg},Pc=new WeakSet,Rp=function(n){const i=new Set;if("name"in n&&n.name&&xi.is(n.name)&&qe(this,Ka,af).call(this,n.name,i),"from"in n&&n.from)for(const a of n.from.froms)qe(this,is,wa).call(this,a,i);if("into"in n&&n.into&&qe(this,is,wa).call(this,n.into,i),"table"in n&&n.table&&qe(this,is,wa).call(this,n.table,i),"joins"in n&&n.joins)for(const a of n.joins)qe(this,is,wa).call(this,a.table,i);return"with"in n&&n.with&&qe(this,Mc,Dp).call(this,n.with,i),i},is=new WeakSet,wa=function(n,i){const a=Ni.is(n)?n:xs.is(n)&&Ni.is(n.node)?n.node:null;a&&qe(this,Ka,af).call(this,a.table,i)},Ka=new WeakSet,af=function(n,i){r(this,rs).has(n.identifier.name)||i.add(n.identifier.name)},Mc=new WeakSet,Dp=function(n,i){for(const a of n.expressions)i.delete(a.name.table.table.identifier.name)};var Ja;class Nu{constructor(e){S(this,Ja,void 0);P(this,Ja,new Vg(e))}transformQuery(e){return r(this,Ja).transformNode(e.node)}async transformResult(e){return e.result}}Ja=new WeakMap;var rt;const Zi=class{constructor(e){S(this,rt,void 0);P(this,rt,p(e))}selectFrom(e){return new Bo({queryId:et(),executor:r(this,rt).executor,queryNode:We.create(Fo(e),r(this,rt).withNode)})}insertInto(e){return new Ma({queryId:et(),executor:r(this,rt).executor,queryNode:Or.create(_n(e),r(this,rt).withNode)})}replaceInto(e){return new Ma({queryId:et(),executor:r(this,rt).executor,queryNode:Or.create(_n(e),r(this,rt).withNode,!0)})}deleteFrom(e){return new yc({queryId:et(),executor:r(this,rt).executor,queryNode:xa.create(Fo(e),r(this,rt).withNode)})}updateTable(e){return new wc({queryId:et(),executor:r(this,rt).executor,queryNode:dc.create(Fa(e),r(this,rt).withNode)})}with(e,n){const i=Mh(e,n);return new Zi({...r(this,rt),withNode:r(this,rt).withNode?Vu.cloneWithExpression(r(this,rt).withNode,i):Vu.create(i)})}withRecursive(e,n){const i=Mh(e,n);return new Zi({...r(this,rt),withNode:r(this,rt).withNode?Vu.cloneWithExpression(r(this,rt).withNode,i):Vu.create(i,{recursive:!0})})}withPlugin(e){return new Zi({...r(this,rt),executor:r(this,rt).executor.withPlugin(e)})}withoutPlugins(){return new Zi({...r(this,rt),executor:r(this,rt).executor.withoutPlugins()})}withSchema(e){return new Zi({...r(this,rt),executor:r(this,rt).executor.withPluginAtFront(new Nu(e))})}};let gc=Zi;rt=new WeakMap;var Ga,ao,uo;class Fh{constructor(){S(this,Ga,void 0);S(this,ao,void 0);S(this,uo,void 0);Yt(this,"resolve",e=>{r(this,ao)&&r(this,ao).call(this,e)});Yt(this,"reject",e=>{r(this,uo)&&r(this,uo).call(this,e)});P(this,Ga,new Promise((e,n)=>{P(this,uo,n),P(this,ao,e)}))}get promise(){return r(this,Ga)}}Ga=new WeakMap,ao=new WeakMap,uo=new WeakMap;const Uh=new Set;function zg(t){Uh.has(t)||(Uh.add(t),console.log(t))}const Kg=p([]);var ss,Xa,uf;class Lp{constructor(e=Kg){S(this,Xa);S(this,ss,void 0);P(this,ss,e)}get plugins(){return r(this,ss)}transformQuery(e,n){for(const i of r(this,ss)){const a=i.transformQuery({node:e,queryId:n});if(a.kind===e.kind)e=a;else throw new Error(["KyselyPlugin.transformQuery must return a node","of the same kind that was given to it.",`The plugin was given a ${e.kind}`,`but it returned a ${a.kind}`].join(" "))}return e}async executeQuery(e,n){return await this.provideConnection(async i=>{const a=await i.executeQuery(e),l=await qe(this,Xa,uf).call(this,a,n);return Jg(a,l),l})}async*stream(e,n,i){const a=new Fh,l=new Fh;this.provideConnection(async w=>(a.resolve(w),await l.promise)).catch(w=>a.reject(w));const m=await a.promise;try{for await(const w of m.streamQuery(e,n))yield await qe(this,Xa,uf).call(this,w,i)}finally{l.resolve()}}}ss=new WeakMap,Xa=new WeakSet,uf=async function(e,n){for(const i of r(this,ss))e=await i.transformResult({result:e,queryId:n});return e};function Jg(t,e){const{numAffectedRows:n}=t;n===void 0&&t.numUpdatedOrDeletedRows===void 0||n!==void 0&&e.numAffectedRows!==void 0||zg("kysely:warning: outdated driver/plugin detected! QueryResult.numUpdatedOrDeletedRows is deprecated and will be removed in a future release.")}class Js extends Lp{get adapter(){throw new Error("this query cannot be compiled to SQL")}compileQuery(){throw new Error("this query cannot be compiled to SQL")}provideConnection(){throw new Error("this query cannot be executed")}withConnectionProvider(){throw new Error("this query cannot have a connection provider")}withPlugin(e){return new Js([...this.plugins,e])}withPlugins(e){return new Js([...this.plugins,...e])}withPluginAtFront(e){return new Js([e,...this.plugins])}withoutPlugins(){return new Js([])}}const Nl=new Js;function $h(){return new Bo({queryId:et(),executor:Nl,queryNode:We.create(Fo([]))})}function Gg(){return new gc({executor:Nl})}function Pp(t,e){return new fc({joinNode:jn.create(t,Fa(e))})}function Xg(){return new hc({overNode:of.create()})}const zf=p({is(t){return t.kind==="WhenNode"},create(t){return p({kind:"WhenNode",condition:t})},cloneWithResult(t,e){return p({...t,result:e})}}),hr=p({is(t){return t.kind==="CaseNode"},create(t){return p({kind:"CaseNode",value:t})},cloneWithWhen(t,e){return p({...t,when:p(t.when?[...t.when,e]:[e])})},cloneWithThen(t,e){return p({...t,when:t.when?p([...t.when.slice(0,-1),zf.cloneWithResult(t.when[t.when.length-1],e)]):void 0})},cloneWith(t,e){return p({...t,...e})}});function cf(t,e,n){if(!vp(e)&&!hn(e))throw new Error(`invalid binary operator ${JSON.stringify(e)}`);return eb(e,n)?tb(t,e,n):ml.create(Hr(t),Kf(e),Op(n))}function Yg(t,e,n){if(!vp(e)&&!hn(e))throw new Error(`invalid binary operator ${JSON.stringify(e)}`);return ml.create(Hr(t),Kf(e),Hr(n))}function Zg(t,e,n){if(!_p(e)&&!hn(e))throw new Error(`invalid comparison operator ${JSON.stringify(e)}`);return cf(t,e,n)}function zt(t,e,n){if(!_p(e)&&!hn(e))throw new Error(`invalid comparison operator ${JSON.stringify(e)}`);return Yg(t,e,n)}function Rn(t){return vl("where",t)}function Qh(t){return vl("having",t)}function jh(t){return vl("on",t)}function Mp(t){return vl("when",t)}function vl(t,e){if(e.length===3)return Zg(e[0],e[1],e[2]);if(e.length===1)return nb(t,e[0]);throw Bp(t,e)}function eb(t,e){return(t==="is"||t==="is not")&&(wp(e)||yp(e))}function tb(t,e,n){return ml.create(Hr(t),Kf(e),Ir.createImmediate(n))}function Kf(t){if(pr(t)&&gg.includes(t))return Ff.create(t);if(hn(t))return t.toOperationNode();throw new Error(`invalid operator ${JSON.stringify(t)}`)}function nb(t,e){if(Vn(e)){if(t==="when")throw new Error("when method doesn't accept a callback as an argument");return rb[t](e)}else if(hn(e)){const n=e.toOperationNode();if(en.is(n)||ml.is(n)||qp.is(n)||ro.is(n)||hr.is(n))return n}else if(t==="when")return Ir.create(e);throw Bp(t,e)}function Bp(t,e){return new Error(`invalid arguments passed to a '${t}' method: ${JSON.stringify(e)}`)}const rb=p({where(t){const e=$h(),n=$r(),a=t(Object.assign(e,n)).toOperationNode();if(We.is(a)){if(!a.where)throw new Error("no `where` methods called inside a group callback");return ro.create(a.where.where)}else return a},having(t){const e=$h(),n=$r(),a=t(Object.assign(e,n)).toOperationNode();if(We.is(a)){if(!a.having)throw new Error("no `having` methods called inside a group callback");return ro.create(a.having.having)}else return a},on(t){const e=Pp("InnerJoin","table"),n=$r(),a=t(Object.assign(e,n)).toOperationNode();if(jn.is(a)){if(!a.on)throw new Error("no `on` methods called inside a group callback");return ro.create(a.on.on)}else return a}});function vn(t,e){if(e.length===3)return sb(t,e[0],e[1],e[2]);if(e.length===2)return ib(t,e[0],e[1]);throw new Error("not implemented")}function ib(t,e,n){return n(Pp(t,e)).toOperationNode()}function sb(t,e,n,i){return jn.createWithOn(t,Fa(e),zt(n,"=",i))}const ob=p({is(t){return t.kind==="OffsetNode"},create(t){return p({kind:"OffsetNode",offset:Ir.create(t)})}}),ab=p({is(t){return t.kind==="GroupByItemNode"},create(t){return p({kind:"GroupByItemNode",groupBy:t})}});function ub(t){return t=Vn(t)?t($r()):t,Pa(t).map(ab.create)}const Fp=p({is(t){return t.kind==="SetOperationNode"},create(t,e,n){return p({kind:"SetOperationNode",operator:t,expression:e,all:n})}});function Qs(t,e,n){return Fp.create(t,e.toOperationNode(),n)}var $;const he=class{constructor(e){S(this,$,void 0);P(this,$,p(e))}get expressionType(){}where(...e){return new he({...r(this,$),queryNode:ye.cloneWithWhere(r(this,$).queryNode,Rn(e))})}whereRef(e,n,i){return new he({...r(this,$),queryNode:ye.cloneWithWhere(r(this,$).queryNode,zt(e,n,i))})}orWhere(...e){return new he({...r(this,$),queryNode:ye.cloneWithOrWhere(r(this,$).queryNode,Rn(e))})}orWhereRef(e,n,i){return new he({...r(this,$),queryNode:ye.cloneWithOrWhere(r(this,$).queryNode,zt(e,n,i))})}whereExists(e){return new he({...r(this,$),queryNode:ye.cloneWithWhere(r(this,$).queryNode,sn(e))})}whereNotExists(e){return new he({...r(this,$),queryNode:ye.cloneWithWhere(r(this,$).queryNode,Vt(e))})}orWhereExists(e){return new he({...r(this,$),queryNode:ye.cloneWithOrWhere(r(this,$).queryNode,sn(e))})}orWhereNotExists(e){return new he({...r(this,$),queryNode:ye.cloneWithOrWhere(r(this,$).queryNode,Vt(e))})}having(...e){return new he({...r(this,$),queryNode:We.cloneWithHaving(r(this,$).queryNode,Qh(e))})}havingRef(e,n,i){return new he({...r(this,$),queryNode:We.cloneWithHaving(r(this,$).queryNode,zt(e,n,i))})}orHaving(...e){return new he({...r(this,$),queryNode:We.cloneWithOrHaving(r(this,$).queryNode,Qh(e))})}orHavingRef(e,n,i){return new he({...r(this,$),queryNode:We.cloneWithOrHaving(r(this,$).queryNode,zt(e,n,i))})}havingExists(e){return new he({...r(this,$),queryNode:We.cloneWithHaving(r(this,$).queryNode,sn(e))})}havingNotExist(e){return new he({...r(this,$),queryNode:We.cloneWithHaving(r(this,$).queryNode,Vt(e))})}havingNotExists(e){return new he({...r(this,$),queryNode:We.cloneWithHaving(r(this,$).queryNode,Vt(e))})}orHavingExists(e){return new he({...r(this,$),queryNode:We.cloneWithOrHaving(r(this,$).queryNode,sn(e))})}orHavingNotExists(e){return new he({...r(this,$),queryNode:We.cloneWithOrHaving(r(this,$).queryNode,Vt(e))})}select(e){return new he({...r(this,$),queryNode:We.cloneWithSelections(r(this,$).queryNode,gu(e))})}distinctOn(e){return new he({...r(this,$),queryNode:We.cloneWithDistinctOn(r(this,$).queryNode,Pa(e))})}modifyFront(e){return new he({...r(this,$),queryNode:We.cloneWithFrontModifier(r(this,$).queryNode,Sr.createWithExpression(e.toOperationNode()))})}modifyEnd(e){return new he({...r(this,$),queryNode:We.cloneWithEndModifier(r(this,$).queryNode,Sr.createWithExpression(e.toOperationNode()))})}distinct(){return new he({...r(this,$),queryNode:We.cloneWithFrontModifier(r(this,$).queryNode,Sr.create("Distinct"))})}forUpdate(){return new he({...r(this,$),queryNode:We.cloneWithEndModifier(r(this,$).queryNode,Sr.create("ForUpdate"))})}forShare(){return new he({...r(this,$),queryNode:We.cloneWithEndModifier(r(this,$).queryNode,Sr.create("ForShare"))})}forKeyShare(){return new he({...r(this,$),queryNode:We.cloneWithEndModifier(r(this,$).queryNode,Sr.create("ForKeyShare"))})}forNoKeyUpdate(){return new he({...r(this,$),queryNode:We.cloneWithEndModifier(r(this,$).queryNode,Sr.create("ForNoKeyUpdate"))})}skipLocked(){return new he({...r(this,$),queryNode:We.cloneWithEndModifier(r(this,$).queryNode,Sr.create("SkipLocked"))})}noWait(){return new he({...r(this,$),queryNode:We.cloneWithEndModifier(r(this,$).queryNode,Sr.create("NoWait"))})}selectAll(e){return new he({...r(this,$),queryNode:We.cloneWithSelections(r(this,$).queryNode,bu(e))})}innerJoin(...e){return new he({...r(this,$),queryNode:ye.cloneWithJoin(r(this,$).queryNode,vn("InnerJoin",e))})}leftJoin(...e){return new he({...r(this,$),queryNode:ye.cloneWithJoin(r(this,$).queryNode,vn("LeftJoin",e))})}rightJoin(...e){return new he({...r(this,$),queryNode:ye.cloneWithJoin(r(this,$).queryNode,vn("RightJoin",e))})}fullJoin(...e){return new he({...r(this,$),queryNode:ye.cloneWithJoin(r(this,$).queryNode,vn("FullJoin",e))})}innerJoinLateral(...e){return new he({...r(this,$),queryNode:ye.cloneWithJoin(r(this,$).queryNode,vn("LateralInnerJoin",e))})}leftJoinLateral(...e){return new he({...r(this,$),queryNode:ye.cloneWithJoin(r(this,$).queryNode,vn("LateralLeftJoin",e))})}orderBy(e,n){return new he({...r(this,$),queryNode:We.cloneWithOrderByItem(r(this,$).queryNode,wl(e,n))})}groupBy(e){return new he({...r(this,$),queryNode:We.cloneWithGroupByItems(r(this,$).queryNode,ub(e))})}limit(e){return new he({...r(this,$),queryNode:We.cloneWithLimit(r(this,$).queryNode,Tp.create(e))})}offset(e){return new he({...r(this,$),queryNode:We.cloneWithOffset(r(this,$).queryNode,ob.create(e))})}union(e){return new he({...r(this,$),queryNode:We.cloneWithSetOperation(r(this,$).queryNode,Qs("union",e,!1))})}unionAll(e){return new he({...r(this,$),queryNode:We.cloneWithSetOperation(r(this,$).queryNode,Qs("union",e,!0))})}intersect(e){return new he({...r(this,$),queryNode:We.cloneWithSetOperation(r(this,$).queryNode,Qs("intersect",e,!1))})}intersectAll(e){return new he({...r(this,$),queryNode:We.cloneWithSetOperation(r(this,$).queryNode,Qs("intersect",e,!0))})}except(e){return new he({...r(this,$),queryNode:We.cloneWithSetOperation(r(this,$).queryNode,Qs("except",e,!1))})}exceptAll(e){return new he({...r(this,$),queryNode:We.cloneWithSetOperation(r(this,$).queryNode,Qs("except",e,!0))})}as(e){return new cb(this,e)}clearSelect(){return new he({...r(this,$),queryNode:We.cloneWithoutSelections(r(this,$).queryNode)})}clearWhere(){return new he({...r(this,$),queryNode:ye.cloneWithoutWhere(r(this,$).queryNode)})}clearLimit(){return new he({...r(this,$),queryNode:We.cloneWithoutLimit(r(this,$).queryNode)})}clearOffset(){return new he({...r(this,$),queryNode:We.cloneWithoutOffset(r(this,$).queryNode)})}clearOrderBy(){return new he({...r(this,$),queryNode:We.cloneWithoutOrderBy(r(this,$).queryNode)})}$call(e){return e(this)}call(e){return this.$call(e)}$if(e,n){return e?n(this):new he({...r(this,$)})}if(e,n){return this.$if(e,n)}$castTo(){return new he(r(this,$))}castTo(){return this.$castTo()}$narrowType(){return new he(r(this,$))}$assertType(){return new he(r(this,$))}assertType(){return new he(r(this,$))}withPlugin(e){return new he({...r(this,$),executor:r(this,$).executor.withPlugin(e)})}toOperationNode(){return r(this,$).executor.transformQuery(r(this,$).queryNode,r(this,$).queryId)}compile(){return r(this,$).executor.compileQuery(this.toOperationNode(),r(this,$).queryId)}async execute(){const e=this.compile();return(await r(this,$).executor.executeQuery(e,r(this,$).queryId)).rows}async executeTakeFirst(){const[e]=await this.execute();return e}async executeTakeFirstOrThrow(e=gl){const n=await this.executeTakeFirst();if(n===void 0)throw bl(e)?new e(this.toOperationNode()):e(this.toOperationNode());return n}async*stream(e=100){const n=this.compile(),i=r(this,$).executor.stream(n,e,r(this,$).queryId);for await(const a of i)yield*a.rows}async explain(e,n){return await new he({...r(this,$),queryNode:ye.cloneWithExplain(r(this,$).queryNode,e,n)}).execute()}};let Bo=he;$=new WeakMap;$e(Bo,"don't await SelectQueryBuilder instances directly. To execute the query you need to call `execute` or `executeTakeFirst`.");var co,lo;class cb{constructor(e,n){S(this,co,void 0);S(this,lo,void 0);P(this,co,e),P(this,lo,n)}get expression(){return r(this,co)}get alias(){return r(this,lo)}toOperationNode(){return xs.create(r(this,co).toOperationNode(),mt.create(r(this,lo)))}}co=new WeakMap,lo=new WeakMap;var fo;const Yf=class{constructor(e){S(this,fo,void 0);P(this,fo,e)}get expressionType(){}as(e){return new lb(this,e)}$castTo(){return new Yf(r(this,fo))}toOperationNode(){return r(this,fo)}};let Dt=Yf;fo=new WeakMap;var ho,ci;class lb{constructor(e,n){S(this,ho,void 0);S(this,ci,void 0);P(this,ho,e),P(this,ci,n)}get expression(){return r(this,ho)}get alias(){return r(this,ci)}toOperationNode(){return xs.create(r(this,ho).toOperationNode(),hn(r(this,ci))?r(this,ci).toOperationNode():mt.create(r(this,ci)))}}ho=new WeakMap,ci=new WeakMap;const Un=p({is(t){return t.kind==="AggregateFunctionNode"},create(t,e=[]){return p({kind:"AggregateFunctionNode",func:t,aggregated:e})},cloneWithDistinct(t){return p({...t,distinct:!0})},cloneWithFilter(t,e){return p({...t,filter:t.filter?tn.cloneWithOperation(t.filter,"And",e):tn.create(e)})},cloneWithOrFilter(t,e){return p({...t,filter:t.filter?tn.cloneWithOperation(t.filter,"Or",e):tn.create(e)})},cloneWithOver(t,e){return p({...t,over:e})}}),fb=p({is(t){return t.kind==="FunctionNode"},create(t,e){return p({kind:"FunctionNode",func:t,arguments:e})}});var st;const $n=class{constructor(e){S(this,st,void 0);P(this,st,p(e))}get expressionType(){}as(e){return new hb(this,e)}distinct(){return new $n({...r(this,st),aggregateFunctionNode:Un.cloneWithDistinct(r(this,st).aggregateFunctionNode)})}filterWhere(...e){return new $n({...r(this,st),aggregateFunctionNode:Un.cloneWithFilter(r(this,st).aggregateFunctionNode,Rn(e))})}filterWhereExists(e){return new $n({...r(this,st),aggregateFunctionNode:Un.cloneWithFilter(r(this,st).aggregateFunctionNode,sn(e))})}filterWhereNotExists(e){return new $n({...r(this,st),aggregateFunctionNode:Un.cloneWithFilter(r(this,st).aggregateFunctionNode,Vt(e))})}filterWhereRef(e,n,i){return new $n({...r(this,st),aggregateFunctionNode:Un.cloneWithFilter(r(this,st).aggregateFunctionNode,zt(e,n,i))})}orFilterWhere(...e){return new $n({...r(this,st),aggregateFunctionNode:Un.cloneWithOrFilter(r(this,st).aggregateFunctionNode,Rn(e))})}orFilterWhereExists(e){return new $n({...r(this,st),aggregateFunctionNode:Un.cloneWithOrFilter(r(this,st).aggregateFunctionNode,sn(e))})}orFilterWhereNotExists(e){return new $n({...r(this,st),aggregateFunctionNode:Un.cloneWithOrFilter(r(this,st).aggregateFunctionNode,Vt(e))})}orFilterWhereRef(e,n,i){return new $n({...r(this,st),aggregateFunctionNode:Un.cloneWithOrFilter(r(this,st).aggregateFunctionNode,zt(e,n,i))})}over(e){const n=Xg();return new $n({...r(this,st),aggregateFunctionNode:Un.cloneWithOver(r(this,st).aggregateFunctionNode,(e?e(n):n).toOperationNode())})}$call(e){return e(this)}toOperationNode(){return r(this,st).aggregateFunctionNode}};let Ba=$n;st=new WeakMap;$e(Ba,"don't await AggregateFunctionBuilder instances. They are never executed directly and are always just a part of a query.");var po,mo;class hb{constructor(e,n){S(this,po,void 0);S(this,mo,void 0);P(this,po,e),P(this,mo,n)}get expression(){return r(this,po)}get alias(){return r(this,mo)}toOperationNode(){return xs.create(r(this,po).toOperationNode(),mt.create(r(this,mo)))}}po=new WeakMap,mo=new WeakMap;function Up(){const t=(n,i)=>new Dt(fb.create(n,Pa(i))),e=(n,i)=>new Ba({aggregateFunctionNode:Un.create(n,i?Pa(i):void 0)});return Object.assign(t,{agg:e,avg(n){return e("avg",[n])},coalesce(n,...i){return t("coalesce",[n,...i])},count(n){return e("count",[n])},countAll(n){return new Ba({aggregateFunctionNode:Un.create("count",bu(n))})},max(n){return e("max",[n])},min(n){return e("min",[n])},sum(n){return e("sum",[n])}})}var yo;class $p{constructor(e){S(this,yo,void 0);P(this,yo,p(e))}when(...e){return new Qp({...r(this,yo),node:hr.cloneWithWhen(r(this,yo).node,zf.create(Mp(e)))})}}yo=new WeakMap;var wo;class Qp{constructor(e){S(this,wo,void 0);P(this,wo,p(e))}then(e){return new db({...r(this,wo),node:hr.cloneWithThen(r(this,wo).node,Ur(e))})}}wo=new WeakMap;var vr;class db{constructor(e){S(this,vr,void 0);P(this,vr,p(e))}when(...e){return new Qp({...r(this,vr),node:hr.cloneWithWhen(r(this,vr).node,zf.create(Mp(e)))})}else(e){return new pb({...r(this,vr),node:hr.cloneWith(r(this,vr).node,{else:Ur(e)})})}end(){return new Dt(hr.cloneWith(r(this,vr).node,{isStatement:!1}))}endCase(){return new Dt(hr.cloneWith(r(this,vr).node,{isStatement:!0}))}}vr=new WeakMap;var go;class pb{constructor(e){S(this,go,void 0);P(this,go,p(e))}end(){return new Dt(hr.cloneWith(r(this,go).node,{isStatement:!1}))}endCase(){return new Dt(hr.cloneWith(r(this,go).node,{isStatement:!0}))}}go=new WeakMap;function jp(t=Nl){function e(n,i){return new Dt(jf(n,i))}return{get fn(){return Up()},selectFrom(n){return new Bo({queryId:et(),executor:t,queryNode:We.create(Fo(n))})},case(n){return new $p({node:hr.create(va(n)?void 0:Hr(n))})},ref(n){return new Dt(Po(n))},val(n){return new Dt(Op(n))},cmpr(n,i,a){return new Dt(cf(n,i,a))},bxp(n,i,a){return new Dt(cf(n,i,a))},unary:e,not(n){return e("not",n)},exists(n){return e("exists",n)},neg(n){return e("-",n)},and(n){if(n.length===0)return new Dt(Ir.createImmediate(!0));if(n.length===1)return new Dt(n[0].toOperationNode());let i=Da.create(n[0].toOperationNode(),n[1].toOperationNode());for(let a=2;aFa(e)):[Fa(t)]}function Fa(t){return pr(t)?mb(t):Hp(t)}function mb(t){const e=" as ";if(t.includes(e)){const[n,i]=t.split(e).map(Vp);return xs.create(_n(n),mt.create(i))}else return _n(t)}function _n(t){const e=".";if(t.includes(e)){const[n,i]=t.split(e).map(Vp);return Ni.createWithSchema(n,i)}else return Ni.create(t)}function Vp(t){return t.trim()}const zp=p({is(t){return t.kind==="AddColumnNode"},create(t){return p({kind:"AddColumnNode",column:t})}}),Xi=p({is(t){return t.kind==="AlterColumnNode"},create(t){return p({kind:"AlterColumnNode",column:Nt.create(t)})},cloneWith(t,e){return p({...t,...e})}}),bt=p({is(t){return t.kind==="ColumnDefinitionNode"},create(t,e){return p({kind:"ColumnDefinitionNode",column:Nt.create(t),dataType:e})},cloneWithFrontModifier(t,e){return p({...t,frontModifiers:t.frontModifiers?p([...t.frontModifiers,e]):[e]})},cloneWithEndModifier(t,e){return p({...t,endModifiers:t.endModifiers?p([...t.endModifiers,e]):[e]})},cloneWith(t,e){return p({...t,...e})}}),Kp=p({is(t){return t.kind==="DropColumnNode"},create(t){return p({kind:"DropColumnNode",column:Nt.create(t)})}}),Jp=p({is(t){return t.kind==="RenameColumnNode"},create(t,e){return p({kind:"RenameColumnNode",column:Nt.create(t),renameTo:Nt.create(e)})}}),Jf=p({is(t){return t.kind==="CheckConstraintNode"},create(t,e){return p({kind:"CheckConstraintNode",expression:t,name:e?mt.create(e):void 0})}}),yb=["no action","restrict","cascade","set null","set default"],ec=p({is(t){return t.kind==="ReferencesNode"},create(t,e){return p({kind:"ReferencesNode",table:t,columns:p([...e])})},cloneWithOnDelete(t,e){return p({...t,onDelete:e})},cloneWithOnUpdate(t,e){return p({...t,onUpdate:e})}});function Gp(t){return hn(t)?t.toOperationNode():Ir.createImmediate(t)}const zu=p({is(t){return t.kind==="GeneratedNode"},create(t){return p({kind:"GeneratedNode",...t})},createWithExpression(t){return p({kind:"GeneratedNode",always:!0,expression:t})},cloneWith(t,e){return p({...t,...e})}}),wb=p({is(t){return t.kind==="DefaultValueNode"},create(t){return p({kind:"DefaultValueNode",defaultValue:t})}});function bc(t){if(yb.includes(t))return t;throw new Error(`invalid OnModifyForeignAction ${t}`)}var Ye;const St=class{constructor(e){S(this,Ye,void 0);P(this,Ye,e)}autoIncrement(){return new St(bt.cloneWith(r(this,Ye),{autoIncrement:!0}))}primaryKey(){return new St(bt.cloneWith(r(this,Ye),{primaryKey:!0}))}references(e){const n=Po(e);if(!yl.is(n)||Uf.is(n.column))throw new Error(`invalid call references('${e}'). The reference must have format table.column or schema.table.column`);return new St(bt.cloneWith(r(this,Ye),{references:ec.create(n.table,[n.column])}))}onDelete(e){if(!r(this,Ye).references)throw new Error("on delete constraint can only be added for foreign keys");return new St(bt.cloneWith(r(this,Ye),{references:ec.cloneWithOnDelete(r(this,Ye).references,bc(e))}))}onUpdate(e){if(!r(this,Ye).references)throw new Error("on update constraint can only be added for foreign keys");return new St(bt.cloneWith(r(this,Ye),{references:ec.cloneWithOnUpdate(r(this,Ye).references,bc(e))}))}unique(){return new St(bt.cloneWith(r(this,Ye),{unique:!0}))}notNull(){return new St(bt.cloneWith(r(this,Ye),{notNull:!0}))}unsigned(){return new St(bt.cloneWith(r(this,Ye),{unsigned:!0}))}defaultTo(e){return new St(bt.cloneWith(r(this,Ye),{defaultTo:wb.create(Gp(e))}))}check(e){return new St(bt.cloneWith(r(this,Ye),{check:Jf.create(e.toOperationNode())}))}generatedAlwaysAs(e){return new St(bt.cloneWith(r(this,Ye),{generated:zu.createWithExpression(e.toOperationNode())}))}generatedAlwaysAsIdentity(){return new St(bt.cloneWith(r(this,Ye),{generated:zu.create({identity:!0,always:!0})}))}generatedByDefaultAsIdentity(){return new St(bt.cloneWith(r(this,Ye),{generated:zu.create({identity:!0,byDefault:!0})}))}stored(){if(!r(this,Ye).generated)throw new Error("stored() can only be called after generatedAlwaysAs");return new St(bt.cloneWith(r(this,Ye),{generated:zu.cloneWith(r(this,Ye).generated,{stored:!0})}))}modifyFront(e){return new St(bt.cloneWithFrontModifier(r(this,Ye),e.toOperationNode()))}modifyEnd(e){return new St(bt.cloneWithEndModifier(r(this,Ye),e.toOperationNode()))}$call(e){return e(this)}toOperationNode(){return r(this,Ye)}};let Ei=St;Ye=new WeakMap;$e(Ei,"don't await ColumnDefinitionBuilder instances directly.");const Xp=p({is(t){return t.kind==="ModifyColumnNode"},create(t){return p({kind:"ModifyColumnNode",column:t})}}),gb=p({is(t){return t.kind==="DataTypeNode"},create(t){return p({kind:"DataTypeNode",dataType:t})}});function Uo(t){return hn(t)?t.toOperationNode():gb.create(t)}const Nc=p({is(t){return t.kind==="ForeignKeyConstraintNode"},create(t,e,n,i){return p({kind:"ForeignKeyConstraintNode",columns:t,references:ec.create(e,n),name:i?mt.create(i):void 0})},cloneWith(t,e){return p({...t,...e})}});var os;const Bc=class{constructor(e){S(this,os,void 0);P(this,os,e)}onDelete(e){return new Bc(Nc.cloneWith(r(this,os),{onDelete:bc(e)}))}onUpdate(e){return new Bc(Nc.cloneWith(r(this,os),{onUpdate:bc(e)}))}$call(e){return e(this)}toOperationNode(){return r(this,os)}};let Ua=Bc;os=new WeakMap;$e(Ua,"don't await ForeignKeyConstraintBuilder instances directly.");const lf=p({is(t){return t.kind==="AddConstraintNode"},create(t){return p({kind:"AddConstraintNode",constraint:t})}}),Yp=p({is(t){return t.kind==="UniqueConstraintNode"},create(t,e){return p({kind:"UniqueConstraintNode",columns:p(t.map(Nt.create)),name:e?mt.create(e):void 0})}}),tc=p({is(t){return t.kind==="DropConstraintNode"},create(t){return p({kind:"DropConstraintNode",constraintName:mt.create(t)})},cloneWith(t,e){return p({...t,...e})}});class El{constructor(e){Yt(this,"alterColumnNode");this.alterColumnNode=e}setDataType(e){return new ma(Xi.cloneWith(this.alterColumnNode,{dataType:Uo(e)}))}setDefault(e){return new ma(Xi.cloneWith(this.alterColumnNode,{setDefault:Gp(e)}))}dropDefault(){return new ma(Xi.cloneWith(this.alterColumnNode,{dropDefault:!0}))}setNotNull(){return new ma(Xi.cloneWith(this.alterColumnNode,{setNotNull:!0}))}dropNotNull(){return new ma(Xi.cloneWith(this.alterColumnNode,{dropNotNull:!0}))}$call(e){return e(this)}}class ma extends El{toOperationNode(){return this.alterColumnNode}}var ir;class ga{constructor(e){S(this,ir,void 0);P(this,ir,p(e))}toOperationNode(){return r(this,ir).executor.transformQuery(r(this,ir).node,r(this,ir).queryId)}compile(){return r(this,ir).executor.compileQuery(this.toOperationNode(),r(this,ir).queryId)}async execute(){await r(this,ir).executor.executeQuery(this.compile(),r(this,ir).queryId)}}ir=new WeakMap;$e(ga,"don't await AlterTableExecutor instances directly. To execute the query you need to call `execute`");var Zt;const Fc=class{constructor(e){S(this,Zt,void 0);P(this,Zt,p(e))}onDelete(e){return new Fc({...r(this,Zt),constraintBuilder:r(this,Zt).constraintBuilder.onDelete(e)})}onUpdate(e){return new Fc({...r(this,Zt),constraintBuilder:r(this,Zt).constraintBuilder.onUpdate(e)})}$call(e){return e(this)}toOperationNode(){return r(this,Zt).executor.transformQuery(Et.cloneWithTableProps(r(this,Zt).node,{addConstraint:lf.create(r(this,Zt).constraintBuilder.toOperationNode())}),r(this,Zt).queryId)}compile(){return r(this,Zt).executor.compileQuery(this.toOperationNode(),r(this,Zt).queryId)}async execute(){await r(this,Zt).executor.executeQuery(this.compile(),r(this,Zt).queryId)}};let vc=Fc;Zt=new WeakMap;$e(vc,"don't await AlterTableAddForeignKeyConstraintBuilder instances directly. To execute the query you need to call `execute`");var _t;const Ea=class{constructor(e){S(this,_t,void 0);P(this,_t,p(e))}ifExists(){return new Ea({...r(this,_t),node:Et.cloneWithTableProps(r(this,_t).node,{dropConstraint:tc.cloneWith(r(this,_t).node.dropConstraint,{ifExists:!0})})})}cascade(){return new Ea({...r(this,_t),node:Et.cloneWithTableProps(r(this,_t).node,{dropConstraint:tc.cloneWith(r(this,_t).node.dropConstraint,{modifier:"cascade"})})})}restrict(){return new Ea({...r(this,_t),node:Et.cloneWithTableProps(r(this,_t).node,{dropConstraint:tc.cloneWith(r(this,_t).node.dropConstraint,{modifier:"restrict"})})})}$call(e){return e(this)}toOperationNode(){return r(this,_t).executor.transformQuery(r(this,_t).node,r(this,_t).queryId)}compile(){return r(this,_t).executor.compileQuery(this.toOperationNode(),r(this,_t).queryId)}async execute(){await r(this,_t).executor.executeQuery(this.compile(),r(this,_t).queryId)}};let _c=Ea;_t=new WeakMap;$e(_c,"don't await AlterTableDropConstraintBuilder instances directly. To execute the query you need to call `execute`");var ot;class Zp{constructor(e){S(this,ot,void 0);P(this,ot,p(e))}renameTo(e){return new ga({...r(this,ot),node:Et.cloneWithTableProps(r(this,ot).node,{renameTo:_n(e)})})}setSchema(e){return new ga({...r(this,ot),node:Et.cloneWithTableProps(r(this,ot).node,{setSchema:mt.create(e)})})}alterColumn(e,n){const i=n(new El(Xi.create(e)));return new ui({...r(this,ot),node:Et.cloneWithColumnAlteration(r(this,ot).node,i.toOperationNode())})}dropColumn(e){return new ui({...r(this,ot),node:Et.cloneWithColumnAlteration(r(this,ot).node,Kp.create(e))})}renameColumn(e,n){return new ui({...r(this,ot),node:Et.cloneWithColumnAlteration(r(this,ot).node,Jp.create(e,n))})}addColumn(e,n,i=Lo){const a=i(new Ei(bt.create(e,Uo(n))));return new ui({...r(this,ot),node:Et.cloneWithColumnAlteration(r(this,ot).node,zp.create(a.toOperationNode()))})}modifyColumn(e,n,i=Lo){const a=i(new Ei(bt.create(e,Uo(n))));return new ui({...r(this,ot),node:Et.cloneWithColumnAlteration(r(this,ot).node,Xp.create(a.toOperationNode()))})}addUniqueConstraint(e,n){return new ga({...r(this,ot),node:Et.cloneWithTableProps(r(this,ot).node,{addConstraint:lf.create(Yp.create(n,e))})})}addCheckConstraint(e,n){return new ga({...r(this,ot),node:Et.cloneWithTableProps(r(this,ot).node,{addConstraint:lf.create(Jf.create(n.toOperationNode(),e))})})}addForeignKeyConstraint(e,n,i,a){return new vc({...r(this,ot),constraintBuilder:new Ua(Nc.create(n.map(Nt.create),_n(i),a.map(Nt.create),e))})}dropConstraint(e){return new _c({...r(this,ot),node:Et.cloneWithTableProps(r(this,ot).node,{dropConstraint:tc.create(e)})})}$call(e){return e(this)}call(e){return this.$call(e)}}ot=new WeakMap;var gt;const es=class{constructor(e){S(this,gt,void 0);P(this,gt,p(e))}alterColumn(e,n){const i=n(new El(Xi.create(e)));return new es({...r(this,gt),node:Et.cloneWithColumnAlteration(r(this,gt).node,i.toOperationNode())})}dropColumn(e){return new es({...r(this,gt),node:Et.cloneWithColumnAlteration(r(this,gt).node,Kp.create(e))})}renameColumn(e,n){return new es({...r(this,gt),node:Et.cloneWithColumnAlteration(r(this,gt).node,Jp.create(e,n))})}addColumn(e,n,i=Lo){const a=i(new Ei(bt.create(e,Uo(n))));return new es({...r(this,gt),node:Et.cloneWithColumnAlteration(r(this,gt).node,zp.create(a.toOperationNode()))})}modifyColumn(e,n,i=Lo){const a=i(new Ei(bt.create(e,Uo(n))));return new es({...r(this,gt),node:Et.cloneWithColumnAlteration(r(this,gt).node,Xp.create(a.toOperationNode()))})}toOperationNode(){return r(this,gt).executor.transformQuery(r(this,gt).node,r(this,gt).queryId)}compile(){return r(this,gt).executor.compileQuery(this.toOperationNode(),r(this,gt).queryId)}async execute(){await r(this,gt).executor.executeQuery(this.compile(),r(this,gt).queryId)}};let ui=es;gt=new WeakMap;$e(Zp,"don't await AlterTableBuilder instances");$e(El,"don't await AlterColumnBuilder instances");$e(ui,"don't await AlterTableColumnAlteringBuilder instances directly. To execute the query you need to call `execute`");class em extends Vf{transformValue(e){return{...super.transformValue(e),immediate:!0}}}var Ze;const br=class{constructor(e){S(this,Ze,void 0);P(this,Ze,p(e))}ifNotExists(){return new br({...r(this,Ze),node:ri.cloneWith(r(this,Ze).node,{ifNotExists:!0})})}unique(){return new br({...r(this,Ze),node:ri.cloneWith(r(this,Ze).node,{unique:!0})})}on(e){return new br({...r(this,Ze),node:ri.cloneWith(r(this,Ze).node,{table:_n(e)})})}column(e){return new br({...r(this,Ze),node:ri.cloneWithColumns(r(this,Ze).node,[Ah(e)])})}columns(e){return new br({...r(this,Ze),node:ri.cloneWithColumns(r(this,Ze).node,e.map(Ah))})}expression(e){return new br({...r(this,Ze),node:ri.cloneWithColumns(r(this,Ze).node,[e.toOperationNode()])})}using(e){return new br({...r(this,Ze),node:ri.cloneWith(r(this,Ze).node,{using:en.createWithSql(e)})})}where(...e){const n=new em;return new br({...r(this,Ze),node:ye.cloneWithWhere(r(this,Ze).node,n.transformNode(Rn(e)))})}$call(e){return e(this)}toOperationNode(){return r(this,Ze).executor.transformQuery(r(this,Ze).node,r(this,Ze).queryId)}compile(){return r(this,Ze).executor.compileQuery(this.toOperationNode(),r(this,Ze).queryId)}async execute(){await r(this,Ze).executor.executeQuery(this.compile(),r(this,Ze).queryId)}};let xc=br;Ze=new WeakMap;$e(xc,"don't await CreateIndexBuilder instances directly. To execute the query you need to call `execute`");var Wn;const Zf=class{constructor(e){S(this,Wn,void 0);P(this,Wn,p(e))}ifNotExists(){return new Zf({...r(this,Wn),node:gp.cloneWith(r(this,Wn).node,{ifNotExists:!0})})}$call(e){return e(this)}toOperationNode(){return r(this,Wn).executor.transformQuery(r(this,Wn).node,r(this,Wn).queryId)}compile(){return r(this,Wn).executor.compileQuery(this.toOperationNode(),r(this,Wn).queryId)}async execute(){await r(this,Wn).executor.executeQuery(this.compile(),r(this,Wn).queryId)}};let Ec=Zf;Wn=new WeakMap;$e(Ec,"don't await CreateSchemaBuilder instances directly. To execute the query you need to call `execute`");const bb=p({is(t){return t.kind==="PrimaryKeyConstraintNode"},create(t,e){return p({kind:"PrimaryKeyConstraintNode",columns:p(t.map(Nt.create)),name:e?mt.create(e):void 0})}});function Nb(t){if(hg.includes(t))return t;throw new Error(`invalid OnCommitAction ${t}`)}var Ue;const Qn=class{constructor(e){S(this,Ue,void 0);P(this,Ue,p(e))}temporary(){return new Qn({...r(this,Ue),node:Zn.cloneWith(r(this,Ue).node,{temporary:!0})})}onCommit(e){return new Qn({...r(this,Ue),node:Zn.cloneWith(r(this,Ue).node,{onCommit:Nb(e)})})}ifNotExists(){return new Qn({...r(this,Ue),node:Zn.cloneWith(r(this,Ue).node,{ifNotExists:!0})})}addColumn(e,n,i=Lo){const a=i(new Ei(bt.create(e,Uo(n))));return new Qn({...r(this,Ue),node:Zn.cloneWithColumn(r(this,Ue).node,a.toOperationNode())})}addPrimaryKeyConstraint(e,n){return new Qn({...r(this,Ue),node:Zn.cloneWithConstraint(r(this,Ue).node,bb.create(n,e))})}addUniqueConstraint(e,n){return new Qn({...r(this,Ue),node:Zn.cloneWithConstraint(r(this,Ue).node,Yp.create(n,e))})}addCheckConstraint(e,n){return new Qn({...r(this,Ue),node:Zn.cloneWithConstraint(r(this,Ue).node,Jf.create(n.toOperationNode(),e))})}addForeignKeyConstraint(e,n,i,a,l=Lo){const m=l(new Ua(Nc.create(n.map(Nt.create),_n(i),a.map(Nt.create),e)));return new Qn({...r(this,Ue),node:Zn.cloneWithConstraint(r(this,Ue).node,m.toOperationNode())})}modifyFront(e){return new Qn({...r(this,Ue),node:Zn.cloneWithFrontModifier(r(this,Ue).node,e.toOperationNode())})}modifyEnd(e){return new Qn({...r(this,Ue),node:Zn.cloneWithEndModifier(r(this,Ue).node,e.toOperationNode())})}$call(e){return e(this)}call(e){return this.$call(e)}toOperationNode(){return r(this,Ue).executor.transformQuery(r(this,Ue).node,r(this,Ue).queryId)}compile(){return r(this,Ue).executor.compileQuery(this.toOperationNode(),r(this,Ue).queryId)}async execute(){await r(this,Ue).executor.executeQuery(this.compile(),r(this,Ue).queryId)}};let Cc=Qn;Ue=new WeakMap;$e(Cc,"don't await CreateTableBuilder instances directly. To execute the query you need to call `execute`");var Ut;const Ca=class{constructor(e){S(this,Ut,void 0);P(this,Ut,p(e))}on(e){return new Ca({...r(this,Ut),node:Zu.cloneWith(r(this,Ut).node,{table:_n(e)})})}ifExists(){return new Ca({...r(this,Ut),node:Zu.cloneWith(r(this,Ut).node,{ifExists:!0})})}cascade(){return new Ca({...r(this,Ut),node:Zu.cloneWith(r(this,Ut).node,{cascade:!0})})}$call(e){return e(this)}toOperationNode(){return r(this,Ut).executor.transformQuery(r(this,Ut).node,r(this,Ut).queryId)}compile(){return r(this,Ut).executor.compileQuery(this.toOperationNode(),r(this,Ut).queryId)}async execute(){await r(this,Ut).executor.executeQuery(this.compile(),r(this,Ut).queryId)}};let Oc=Ca;Ut=new WeakMap;$e(Oc,"don't await DropIndexBuilder instances directly. To execute the query you need to call `execute`");var ln;const Uc=class{constructor(e){S(this,ln,void 0);P(this,ln,p(e))}ifExists(){return new Uc({...r(this,ln),node:rf.cloneWith(r(this,ln).node,{ifExists:!0})})}cascade(){return new Uc({...r(this,ln),node:rf.cloneWith(r(this,ln).node,{cascade:!0})})}$call(e){return e(this)}toOperationNode(){return r(this,ln).executor.transformQuery(r(this,ln).node,r(this,ln).queryId)}compile(){return r(this,ln).executor.compileQuery(this.toOperationNode(),r(this,ln).queryId)}async execute(){await r(this,ln).executor.executeQuery(this.compile(),r(this,ln).queryId)}};let qc=Uc;ln=new WeakMap;$e(qc,"don't await DropSchemaBuilder instances directly. To execute the query you need to call `execute`");var fn;const $c=class{constructor(e){S(this,fn,void 0);P(this,fn,p(e))}ifExists(){return new $c({...r(this,fn),node:sf.cloneWith(r(this,fn).node,{ifExists:!0})})}cascade(){return new $c({...r(this,fn),node:sf.cloneWith(r(this,fn).node,{cascade:!0})})}$call(e){return e(this)}toOperationNode(){return r(this,fn).executor.transformQuery(r(this,fn).node,r(this,fn).queryId)}compile(){return r(this,fn).executor.compileQuery(this.toOperationNode(),r(this,fn).queryId)}async execute(){await r(this,fn).executor.executeQuery(this.compile(),r(this,fn).queryId)}};let Wc=$c;fn=new WeakMap;$e(Wc,"don't await DropTableBuilder instances directly. To execute the query you need to call `execute`");const oi=p({is(t){return t.kind==="CreateViewNode"},create(t){return p({kind:"CreateViewNode",name:xi.create(t)})},cloneWith(t,e){return p({...t,...e})}});var Qc;class vb{constructor(){S(this,Qc,new em)}transformQuery(e){return r(this,Qc).transformNode(e.node)}transformResult(e){return Promise.resolve(e.result)}}Qc=new WeakMap;var dt;const ai=class{constructor(e){S(this,dt,void 0);P(this,dt,p(e))}temporary(){return new ai({...r(this,dt),node:oi.cloneWith(r(this,dt).node,{temporary:!0})})}materialized(){return new ai({...r(this,dt),node:oi.cloneWith(r(this,dt).node,{materialized:!0})})}ifNotExists(){return new ai({...r(this,dt),node:oi.cloneWith(r(this,dt).node,{ifNotExists:!0})})}orReplace(){return new ai({...r(this,dt),node:oi.cloneWith(r(this,dt).node,{orReplace:!0})})}columns(e){return new ai({...r(this,dt),node:oi.cloneWith(r(this,dt).node,{columns:e.map(Ep)})})}as(e){const n=e.withPlugin(new vb).toOperationNode();return new ai({...r(this,dt),node:oi.cloneWith(r(this,dt).node,{as:n})})}$call(e){return e(this)}toOperationNode(){return r(this,dt).executor.transformQuery(r(this,dt).node,r(this,dt).queryId)}compile(){return r(this,dt).executor.compileQuery(this.toOperationNode(),r(this,dt).queryId)}async execute(){await r(this,dt).executor.executeQuery(this.compile(),r(this,dt).queryId)}};let Ic=ai;dt=new WeakMap;$e(Ic,"don't await CreateViewBuilder instances directly. To execute the query you need to call `execute`");const nc=p({is(t){return t.kind==="DropViewNode"},create(t){return p({kind:"DropViewNode",name:xi.create(t)})},cloneWith(t,e){return p({...t,...e})}});var $t;const Oa=class{constructor(e){S(this,$t,void 0);P(this,$t,p(e))}materialized(){return new Oa({...r(this,$t),node:nc.cloneWith(r(this,$t).node,{materialized:!0})})}ifExists(){return new Oa({...r(this,$t),node:nc.cloneWith(r(this,$t).node,{ifExists:!0})})}cascade(){return new Oa({...r(this,$t),node:nc.cloneWith(r(this,$t).node,{cascade:!0})})}$call(e){return e(this)}toOperationNode(){return r(this,$t).executor.transformQuery(r(this,$t).node,r(this,$t).queryId)}compile(){return r(this,$t).executor.compileQuery(this.toOperationNode(),r(this,$t).queryId)}async execute(){await r(this,$t).executor.executeQuery(this.compile(),r(this,$t).queryId)}};let Ac=Oa;$t=new WeakMap;$e(Ac,"don't await DropViewBuilder instances directly. To execute the query you need to call `execute`");const tm=p({is(t){return t.kind==="CreateTypeNode"},create(t){return p({kind:"CreateTypeNode",name:t})},cloneWithEnum(t,e){return p({...t,enum:Qf.create(e.map(n=>Ir.createImmediate(n)))})}});var In;const eh=class{constructor(e){S(this,In,void 0);P(this,In,p(e))}toOperationNode(){return r(this,In).executor.transformQuery(r(this,In).node,r(this,In).queryId)}asEnum(e){return new eh({...r(this,In),node:tm.cloneWithEnum(r(this,In).node,e)})}$call(e){return e(this)}compile(){return r(this,In).executor.compileQuery(this.toOperationNode(),r(this,In).queryId)}async execute(){await r(this,In).executor.executeQuery(this.compile(),r(this,In).queryId)}};let Tc=eh;In=new WeakMap;$e(Tc,"don't await CreateTypeBuilder instances directly. To execute the query you need to call `execute`");const nm=p({is(t){return t.kind==="DropTypeNode"},create(t){return p({kind:"DropTypeNode",name:t})},cloneWith(t,e){return p({...t,...e})}});var An;const th=class{constructor(e){S(this,An,void 0);P(this,An,p(e))}ifExists(){return new th({...r(this,An),node:nm.cloneWith(r(this,An).node,{ifExists:!0})})}$call(e){return e(this)}toOperationNode(){return r(this,An).executor.transformQuery(r(this,An).node,r(this,An).queryId)}compile(){return r(this,An).executor.compileQuery(this.toOperationNode(),r(this,An).queryId)}async execute(){await r(this,An).executor.executeQuery(this.compile(),r(this,An).queryId)}};let Sc=th;An=new WeakMap;$e(Sc,"don't await DropTypeBuilder instances directly. To execute the query you need to call `execute`");function Hh(t){const e=".";if(t.includes(e)){const n=t.split(e).map(_b);if(n.length===2)return xi.createWithSchema(n[0],n[1]);throw new Error(`invalid schemable identifier ${t}`)}else return xi.create(t)}function _b(t){return t.trim()}var kt;const qa=class{constructor(e){S(this,kt,void 0);P(this,kt,e)}createTable(e){return new Cc({queryId:et(),executor:r(this,kt),node:Zn.create(_n(e))})}dropTable(e){return new Wc({queryId:et(),executor:r(this,kt),node:sf.create(_n(e))})}createIndex(e){return new xc({queryId:et(),executor:r(this,kt),node:ri.create(e)})}dropIndex(e){return new Oc({queryId:et(),executor:r(this,kt),node:Zu.create(e)})}createSchema(e){return new Ec({queryId:et(),executor:r(this,kt),node:gp.create(e)})}dropSchema(e){return new qc({queryId:et(),executor:r(this,kt),node:rf.create(e)})}alterTable(e){return new Zp({queryId:et(),executor:r(this,kt),node:Et.create(_n(e))})}createView(e){return new Ic({queryId:et(),executor:r(this,kt),node:oi.create(e)})}dropView(e){return new Ac({queryId:et(),executor:r(this,kt),node:nc.create(e)})}createType(e){return new Tc({queryId:et(),executor:r(this,kt),node:tm.create(Hh(e))})}dropType(e){return new Sc({queryId:et(),executor:r(this,kt),node:nm.create(Hh(e))})}withPlugin(e){return new qa(r(this,kt).withPlugin(e))}withoutPlugins(){return new qa(r(this,kt).withoutPlugins())}withSchema(e){return new qa(r(this,kt).withPluginAtFront(new Nu(e)))}};let ff=qa;kt=new WeakMap;class xb{ref(e){return new Ig(e)}}var bo;class Eb{constructor(e){S(this,bo,void 0);P(this,bo,e)}async provideConnection(e){const n=await r(this,bo).acquireConnection();try{return await e(n)}finally{await r(this,bo).releaseConnection(n)}}}bo=new WeakMap;var _r,xr,Dr;const ts=class extends Lp{constructor(n,i,a,l=[]){super(l);S(this,_r,void 0);S(this,xr,void 0);S(this,Dr,void 0);P(this,_r,n),P(this,xr,i),P(this,Dr,a)}get adapter(){return r(this,xr)}compileQuery(n){return r(this,_r).compileQuery(n)}provideConnection(n){return r(this,Dr).provideConnection(n)}withPlugins(n){return new ts(r(this,_r),r(this,xr),r(this,Dr),[...this.plugins,...n])}withPlugin(n){return new ts(r(this,_r),r(this,xr),r(this,Dr),[...this.plugins,n])}withPluginAtFront(n){return new ts(r(this,_r),r(this,xr),r(this,Dr),[n,...this.plugins])}withConnectionProvider(n){return new ts(r(this,_r),r(this,xr),n,[...this.plugins])}withoutPlugins(){return new ts(r(this,_r),r(this,xr),r(this,Dr),[])}};let hf=ts;_r=new WeakMap,xr=new WeakMap,Dr=new WeakMap;function Vh(){return typeof performance<"u"&&Vn(performance.now)?performance.now():Date.now()}var sr,li,Lr,as,Ya,jc,rm,Hc,im,Vc,sm,zc,om,Za,df;class Cb{constructor(e,n){S(this,jc);S(this,Hc);S(this,Vc);S(this,zc);S(this,Za);S(this,sr,void 0);S(this,li,void 0);S(this,Lr,void 0);S(this,as,void 0);S(this,Ya,new WeakSet);P(this,sr,e),P(this,li,n)}async init(){r(this,Lr)||P(this,Lr,r(this,sr).init().catch(e=>(P(this,Lr,void 0),Promise.reject(e)))),await r(this,Lr)}async acquireConnection(){await this.init();const e=await r(this,sr).acquireConnection();return r(this,Ya).has(e)||(qe(this,jc,rm).call(this)&&qe(this,Hc,im).call(this,e),r(this,Ya).add(e)),e}async releaseConnection(e){await r(this,sr).releaseConnection(e)}beginTransaction(e,n){return r(this,sr).beginTransaction(e,n)}commitTransaction(e){return r(this,sr).commitTransaction(e)}rollbackTransaction(e){return r(this,sr).rollbackTransaction(e)}async destroy(){r(this,Lr)&&(await r(this,Lr),r(this,as)||P(this,as,r(this,sr).destroy().catch(e=>(P(this,as,void 0),Promise.reject(e)))),await r(this,as))}}sr=new WeakMap,li=new WeakMap,Lr=new WeakMap,as=new WeakMap,Ya=new WeakMap,jc=new WeakSet,rm=function(){return r(this,li).isLevelEnabled("query")||r(this,li).isLevelEnabled("error")},Hc=new WeakSet,im=function(e){const n=e.executeQuery;e.executeQuery=async i=>{const a=Vh();try{return await n.call(e,i)}catch(l){throw await qe(this,Vc,sm).call(this,l,i,a),l}finally{await qe(this,zc,om).call(this,i,a)}}},Vc=new WeakSet,sm=async function(e,n,i){await r(this,li).error(()=>({level:"error",error:e,query:n,queryDurationMillis:qe(this,Za,df).call(this,i)}))},zc=new WeakSet,om=async function(e,n){await r(this,li).query(()=>({level:"query",query:e,queryDurationMillis:qe(this,Za,df).call(this,n)}))},Za=new WeakSet,df=function(e){return Vh()-e};var eu,fi,Kc,um;class am{constructor(e){S(this,Kc);S(this,eu,void 0);S(this,fi,void 0);P(this,eu,e)}async provideConnection(e){for(;r(this,fi);)await r(this,fi);const n=qe(this,Kc,um).call(this,e);return P(this,fi,n.then(()=>{P(this,fi,void 0)}).catch(()=>{P(this,fi,void 0)})),n}}eu=new WeakMap,fi=new WeakMap,Kc=new WeakSet,um=async function(e){return await e(r(this,eu))};const Ob=["read uncommitted","read committed","repeatable read","serializable"];p(["query","error"]);var hi,us;class qb{constructor(e){S(this,hi,void 0);S(this,us,void 0);Vn(e)?(P(this,us,e),P(this,hi,p({query:!0,error:!0}))):(P(this,us,Wb),P(this,hi,p({query:e.includes("query"),error:e.includes("error")})))}isLevelEnabled(e){return r(this,hi)[e]}async query(e){r(this,hi).query&&await r(this,us).call(this,e())}async error(e){r(this,hi).error&&await r(this,us).call(this,e())}}hi=new WeakMap,us=new WeakMap;function Wb(t){t.level==="query"?(console.log(`kysely:query: ${t.query.sql}`),console.log(`kysely:query: duration: ${t.queryDurationMillis.toFixed(1)}ms`)):t.level==="error"&&(t.error instanceof Error?console.error(`kysely:error: ${t.error.stack??t.error.message}`):console.error(`kysely:error: ${t}`))}function Ib(t){return Wr(t)&&Vn(t.compile)}var Qt;const Xs=class extends gc{constructor(n){let i,a;if(Ab(n))i={executor:n.executor},a={...n};else{const l=n.dialect,m=l.createDriver(),w=l.createQueryCompiler(),v=l.createAdapter(),d=new qb(n.log??[]),W=new Cb(m,d),F=new Eb(W),U=new hf(w,v,F,n.plugins??[]);i={executor:U},a={config:n,executor:U,dialect:l,driver:W}}super(i);S(this,Qt,void 0);P(this,Qt,p(a))}get schema(){return new ff(r(this,Qt).executor)}get dynamic(){return new xb}get introspection(){return r(this,Qt).dialect.createIntrospector(this.withoutPlugins())}case(n){return new $p({node:hr.create(va(n)?void 0:_l(n))})}get fn(){return Up()}transaction(){return new kc({...r(this,Qt)})}connection(){return new cm({...r(this,Qt)})}withPlugin(n){return new Xs({...r(this,Qt),executor:r(this,Qt).executor.withPlugin(n)})}withoutPlugins(){return new Xs({...r(this,Qt),executor:r(this,Qt).executor.withoutPlugins()})}withSchema(n){return new Xs({...r(this,Qt),executor:r(this,Qt).executor.withPluginAtFront(new Nu(n))})}withTables(){return new Xs({...r(this,Qt)})}async destroy(){await r(this,Qt).driver.destroy()}get isTransaction(){return!1}getExecutor(){return r(this,Qt).executor}executeQuery(n,i=et()){const a=Ib(n)?n.compile():n;return this.getExecutor().executeQuery(a,i)}};let $a=Xs;Qt=new WeakMap;var or;const Ys=class extends $a{constructor(n){super(n);S(this,or,void 0);P(this,or,n)}get isTransaction(){return!0}transaction(){throw new Error("calling the transaction method for a Transaction is not supported")}connection(){throw new Error("calling the connection method for a Transaction is not supported")}async destroy(){throw new Error("calling the destroy method for a Transaction is not supported")}withPlugin(n){return new Ys({...r(this,or),executor:r(this,or).executor.withPlugin(n)})}withoutPlugins(){return new Ys({...r(this,or),executor:r(this,or).executor.withoutPlugins()})}withSchema(n){return new Ys({...r(this,or),executor:r(this,or).executor.withPluginAtFront(new Nu(n))})}withTables(){return new Ys({...r(this,or)})}};let pf=Ys;or=new WeakMap;function Ab(t){return Wr(t)&&Wr(t.config)&&Wr(t.driver)&&Wr(t.executor)&&Wr(t.dialect)}var cs;class cm{constructor(e){S(this,cs,void 0);P(this,cs,p(e))}async execute(e){return r(this,cs).executor.provideConnection(async n=>{const i=r(this,cs).executor.withConnectionProvider(new am(n)),a=new $a({...r(this,cs),executor:i});return await e(a)})}}cs=new WeakMap;$e(cm,"don't await ConnectionBuilder instances directly. To execute the query you need to call the `execute` method");var ar;const nh=class{constructor(e){S(this,ar,void 0);P(this,ar,p(e))}setIsolationLevel(e){return new nh({...r(this,ar),isolationLevel:e})}async execute(e){const{isolationLevel:n,...i}=r(this,ar),a={isolationLevel:n};return Tb(a),r(this,ar).executor.provideConnection(async l=>{const m=r(this,ar).executor.withConnectionProvider(new am(l)),w=new pf({...i,executor:m});try{await r(this,ar).driver.beginTransaction(l,a);const v=await e(w);return await r(this,ar).driver.commitTransaction(l),v}catch(v){throw await r(this,ar).driver.rollbackTransaction(l),v}})}};let kc=nh;ar=new WeakMap;$e(kc,"don't await TransactionBuilder instances directly. To execute the transaction you need to call the `execute` method");function Tb(t){if(t.isolationLevel&&!Ob.includes(t.isolationLevel))throw new Error(`invalid transaction isolation level ${t.isolationLevel}`)}var Nn,No,rc,tu,mf,nu,yf;const Jc=class{constructor(e){S(this,No);S(this,tu);S(this,nu);S(this,Nn,void 0);P(this,Nn,p(e))}get expressionType(){}as(e){return new Sb(this,e)}$castTo(){return new Jc({...r(this,Nn)})}castTo(){return this.$castTo()}withPlugin(e){return new Jc({...r(this,Nn),plugins:r(this,Nn).plugins!==void 0?p([...r(this,Nn).plugins,e]):p([e])})}toOperationNode(){return qe(this,tu,mf).call(this,qe(this,No,rc).call(this))}compile(e){return qe(this,nu,yf).call(this,qe(this,No,rc).call(this,e))}async execute(e){const n=qe(this,No,rc).call(this,e);return n.executeQuery(qe(this,nu,yf).call(this,n),r(this,Nn).queryId)}};let rr=Jc;Nn=new WeakMap,No=new WeakSet,rc=function(e){const n=e!==void 0?e.getExecutor():Nl;return r(this,Nn).plugins!==void 0?n.withPlugins(r(this,Nn).plugins):n},tu=new WeakSet,mf=function(e){return e.transformQuery(r(this,Nn).rawNode,r(this,Nn).queryId)},nu=new WeakSet,yf=function(e){return e.compileQuery(qe(this,tu,mf).call(this,e),r(this,Nn).queryId)};$e(rr,"don't await RawBuilder instances directly. To execute the query you need to call `execute`");var vo,di;class Sb{constructor(e,n){S(this,vo,void 0);S(this,di,void 0);P(this,vo,e),P(this,di,n)}get expression(){return r(this,vo)}get alias(){return r(this,di)}toOperationNode(){return xs.create(r(this,vo).toOperationNode(),hn(r(this,di))?r(this,di).toOperationNode():mt.create(r(this,di)))}}vo=new WeakMap,di=new WeakMap;const kn=Object.assign((t,...e)=>new rr({queryId:et(),rawNode:en.create(t,(e==null?void 0:e.map(Ur))??[])}),{ref(t){return new rr({queryId:et(),rawNode:en.createWithChild(Po(t))})},val(t){return new rr({queryId:et(),rawNode:en.createWithChild(Ur(t))})},value(t){return this.val(t)},table(t){return new rr({queryId:et(),rawNode:en.createWithChild(_n(t))})},id(...t){const e=new Array(t.length+1).fill(".");return e[0]="",e[e.length-1]="",new rr({queryId:et(),rawNode:en.create(e,t.map(mt.create))})},lit(t){return new rr({queryId:et(),rawNode:en.createWithChild(Ir.createImmediate(t))})},literal(t){return this.lit(t)},raw(t){return new rr({queryId:et(),rawNode:en.createWithSql(t)})},join(t,e=kn`, `){const n=new Array(2*t.length-1),i=e.toOperationNode();for(let a=0;a{this.nodeStack.push(e),r(this,Gc)[e.kind](e),this.nodeStack.pop()})}get parentNode(){return this.nodeStack[this.nodeStack.length-2]}}Gc=new WeakMap;var _o,ls;class Rb extends kb{constructor(){super(...arguments);S(this,_o,"");S(this,ls,[])}get numParameters(){return r(this,ls).length}compileQuery(n){return P(this,_o,""),P(this,ls,[]),this.visitNode(n),p({query:n,sql:this.getSql(),parameters:[...r(this,ls)]})}getSql(){return r(this,_o)}visitSelectQuery(n){const i=this.parentNode!==void 0&&!Or.is(this.parentNode)&&!oi.is(this.parentNode)&&!Fp.is(this.parentNode);this.parentNode===void 0&&n.explain&&(this.visitNode(n.explain),this.append(" ")),i&&this.append("("),n.with&&(this.visitNode(n.with),this.append(" ")),this.append("select "),n.distinctOn&&(this.compileDistinctOn(n.distinctOn),this.append(" ")),n.frontModifiers&&n.frontModifiers.length>0&&(this.compileList(n.frontModifiers," "),this.append(" ")),n.selections&&(this.compileList(n.selections),this.append(" ")),this.visitNode(n.from),n.joins&&(this.append(" "),this.compileList(n.joins," ")),n.where&&(this.append(" "),this.visitNode(n.where)),n.groupBy&&(this.append(" "),this.visitNode(n.groupBy)),n.having&&(this.append(" "),this.visitNode(n.having)),n.setOperations&&(this.append(" "),this.compileList(n.setOperations," ")),n.orderBy&&(this.append(" "),this.visitNode(n.orderBy)),n.limit&&(this.append(" "),this.visitNode(n.limit)),n.offset&&(this.append(" "),this.visitNode(n.offset)),n.endModifiers&&n.endModifiers.length>0&&(this.append(" "),this.compileList(n.endModifiers," ")),i&&this.append(")")}visitFrom(n){this.append("from "),this.compileList(n.froms)}visitSelection(n){this.visitNode(n.selection)}visitColumn(n){this.visitNode(n.column)}compileDistinctOn(n){this.append("distinct on ("),this.compileList(n),this.append(")")}compileList(n,i=", "){const a=n.length-1;for(let l=0;l<=a;l++)this.visitNode(n[l]),ll&&this.visitNode(a[l])}visitOperator(n){this.append(n.operator)}visitTable(n){this.visitNode(n.table)}visitSchemableIdentifier(n){n.schema&&(this.visitNode(n.schema),this.append(".")),this.visitNode(n.identifier)}visitCreateTable(n){this.append("create "),n.frontModifiers&&n.frontModifiers.length>0&&(this.compileList(n.frontModifiers," "),this.append(" ")),n.temporary&&this.append("temporary "),this.append("table "),n.ifNotExists&&this.append("if not exists "),this.visitNode(n.table),this.append(" ("),this.compileList([...n.columns,...n.constraints??[]]),this.append(")"),n.onCommit&&(this.append(" on commit "),this.append(n.onCommit)),n.endModifiers&&n.endModifiers.length>0&&(this.append(" "),this.compileList(n.endModifiers," "))}visitColumnDefinition(n){this.visitNode(n.column),this.append(" "),this.visitNode(n.dataType),n.unsigned&&this.append(" unsigned"),n.frontModifiers&&n.frontModifiers.length>0&&(this.append(" "),this.compileList(n.frontModifiers," ")),n.generated&&(this.append(" "),this.visitNode(n.generated)),n.defaultTo&&(this.append(" "),this.visitNode(n.defaultTo)),n.notNull&&this.append(" not null"),n.unique&&this.append(" unique"),n.primaryKey&&this.append(" primary key"),n.autoIncrement&&(this.append(" "),this.append(this.getAutoIncrement())),n.references&&(this.append(" "),this.visitNode(n.references)),n.check&&(this.append(" "),this.visitNode(n.check)),n.endModifiers&&n.endModifiers.length>0&&(this.append(" "),this.compileList(n.endModifiers," "))}getAutoIncrement(){return"auto_increment"}visitReferences(n){this.append("references "),this.visitNode(n.table),this.append(" ("),this.compileList(n.columns),this.append(")"),n.onDelete&&(this.append(" on delete "),this.append(n.onDelete)),n.onUpdate&&(this.append(" on update "),this.append(n.onUpdate))}visitDropTable(n){this.append("drop table "),n.ifExists&&this.append("if exists "),this.visitNode(n.table),n.cascade&&this.append(" cascade")}visitDataType(n){this.append(n.dataType)}visitOrderBy(n){this.append("order by "),this.compileList(n.items)}visitOrderByItem(n){this.visitNode(n.orderBy),n.direction&&(this.append(" "),this.visitNode(n.direction))}visitGroupBy(n){this.append("group by "),this.compileList(n.items)}visitGroupByItem(n){this.visitNode(n.groupBy)}visitUpdateQuery(n){const i=this.nodeStack.find(ye.is)!==n;!i&&n.explain&&(this.visitNode(n.explain),this.append(" ")),i&&this.append("("),n.with&&(this.visitNode(n.with),this.append(" ")),this.append("update "),this.visitNode(n.table),this.append(" set "),n.updates&&this.compileList(n.updates),n.from&&(this.append(" "),this.visitNode(n.from)),n.joins&&(this.append(" "),this.compileList(n.joins," ")),n.where&&(this.append(" "),this.visitNode(n.where)),n.returning&&(this.append(" "),this.visitNode(n.returning)),i&&this.append(")")}visitColumnUpdate(n){this.visitNode(n.column),this.append(" = "),this.visitNode(n.value)}visitLimit(n){this.append("limit "),this.visitNode(n.limit)}visitOffset(n){this.append("offset "),this.visitNode(n.offset)}visitOnConflict(n){this.append("on conflict"),n.columns?(this.append(" ("),this.compileList(n.columns),this.append(")")):n.constraint?(this.append(" on constraint "),this.visitNode(n.constraint)):n.indexExpression&&(this.append(" ("),this.visitNode(n.indexExpression),this.append(")")),n.indexWhere&&(this.append(" "),this.visitNode(n.indexWhere)),n.doNothing===!0?this.append(" do nothing"):n.updates&&(this.append(" do update set "),this.compileList(n.updates),n.updateWhere&&(this.append(" "),this.visitNode(n.updateWhere)))}visitOnDuplicateKey(n){this.append("on duplicate key update "),this.compileList(n.updates)}visitCreateIndex(n){this.append("create "),n.unique&&this.append("unique "),this.append("index "),n.ifNotExists&&this.append("if not exists "),this.visitNode(n.name),n.table&&(this.append(" on "),this.visitNode(n.table)),n.using&&(this.append(" using "),this.visitNode(n.using)),n.columns&&(this.append(" ("),this.compileList(n.columns),this.append(")")),n.where&&(this.append(" "),this.visitNode(n.where))}visitDropIndex(n){this.append("drop index "),n.ifExists&&this.append("if exists "),this.visitNode(n.name),n.table&&(this.append(" on "),this.visitNode(n.table)),n.cascade&&this.append(" cascade")}visitCreateSchema(n){this.append("create schema "),n.ifNotExists&&this.append("if not exists "),this.visitNode(n.schema)}visitDropSchema(n){this.append("drop schema "),n.ifExists&&this.append("if exists "),this.visitNode(n.schema),n.cascade&&this.append(" cascade")}visitPrimaryKeyConstraint(n){n.name&&(this.append("constraint "),this.visitNode(n.name),this.append(" ")),this.append("primary key ("),this.compileList(n.columns),this.append(")")}visitUniqueConstraint(n){n.name&&(this.append("constraint "),this.visitNode(n.name),this.append(" ")),this.append("unique ("),this.compileList(n.columns),this.append(")")}visitCheckConstraint(n){n.name&&(this.append("constraint "),this.visitNode(n.name),this.append(" ")),this.append("check ("),this.visitNode(n.expression),this.append(")")}visitForeignKeyConstraint(n){n.name&&(this.append("constraint "),this.visitNode(n.name),this.append(" ")),this.append("foreign key ("),this.compileList(n.columns),this.append(") "),this.visitNode(n.references),n.onDelete&&(this.append(" on delete "),this.append(n.onDelete)),n.onUpdate&&(this.append(" on update "),this.append(n.onUpdate))}visitList(n){this.compileList(n.items)}visitWith(n){this.append("with "),n.recursive&&this.append("recursive "),this.compileList(n.expressions)}visitCommonTableExpression(n){this.visitNode(n.name),this.append(" as "),this.visitNode(n.expression)}visitCommonTableExpressionName(n){this.visitNode(n.table),n.columns&&(this.append("("),this.compileList(n.columns),this.append(")"))}visitAlterTable(n){this.append("alter table "),this.visitNode(n.table),this.append(" "),n.renameTo&&(this.append("rename to "),this.visitNode(n.renameTo)),n.setSchema&&(this.append("set schema "),this.visitNode(n.setSchema)),n.addConstraint&&this.visitNode(n.addConstraint),n.dropConstraint&&this.visitNode(n.dropConstraint),n.columnAlterations&&this.compileList(n.columnAlterations)}visitAddColumn(n){this.append("add column "),this.visitNode(n.column)}visitRenameColumn(n){this.append("rename column "),this.visitNode(n.column),this.append(" to "),this.visitNode(n.renameTo)}visitDropColumn(n){this.append("drop column "),this.visitNode(n.column)}visitAlterColumn(n){this.append("alter column "),this.visitNode(n.column),this.append(" "),n.dataType&&(this.append("type "),this.visitNode(n.dataType),n.dataTypeExpression&&(this.append("using "),this.visitNode(n.dataTypeExpression))),n.setDefault&&(this.append("set default "),this.visitNode(n.setDefault)),n.dropDefault&&this.append("drop default"),n.setNotNull&&this.append("set not null"),n.dropNotNull&&this.append("drop not null")}visitModifyColumn(n){this.append("modify column "),this.visitNode(n.column)}visitAddConstraint(n){this.append("add "),this.visitNode(n.constraint)}visitDropConstraint(n){this.append("drop constraint "),n.ifExists&&this.append("if exists "),this.visitNode(n.constraintName),n.modifier==="cascade"?this.append(" cascade"):n.modifier==="restrict"&&this.append(" restrict")}visitSetOperation(n){this.append(n.operator),this.append(" "),n.all&&this.append("all "),this.visitNode(n.expression)}visitCreateView(n){this.append("create "),n.orReplace&&this.append("or replace "),n.materialized&&this.append("materialized "),n.temporary&&this.append("temporary "),this.append("view "),n.ifNotExists&&this.append("if not exists "),this.visitNode(n.name),this.append(" "),n.columns&&(this.append("("),this.compileList(n.columns),this.append(") ")),n.as&&(this.append("as "),this.visitNode(n.as))}visitDropView(n){this.append("drop "),n.materialized&&this.append("materialized "),this.append("view "),n.ifExists&&this.append("if exists "),this.visitNode(n.name),n.cascade&&this.append(" cascade")}visitGenerated(n){this.append("generated "),n.always&&this.append("always "),n.byDefault&&this.append("by default "),this.append("as "),n.identity&&this.append("identity"),n.expression&&(this.append("("),this.visitNode(n.expression),this.append(")")),n.stored&&this.append(" stored")}visitDefaultValue(n){this.append("default "),this.visitNode(n.defaultValue)}visitSelectModifier(n){n.rawModifier?this.visitNode(n.rawModifier):this.append(Db[n.modifier])}visitCreateType(n){this.append("create type "),this.visitNode(n.name),n.enum&&(this.append(" as enum "),this.visitNode(n.enum))}visitDropType(n){this.append("drop type "),n.ifExists&&this.append("if exists "),this.visitNode(n.name)}visitExplain(n){this.append("explain"),(n.options||n.format)&&(this.append(" "),this.append(this.getLeftExplainOptionsWrapper()),n.options&&(this.visitNode(n.options),n.format&&this.append(this.getExplainOptionsDelimiter())),n.format&&(this.append("format"),this.append(this.getExplainOptionAssignment()),this.append(n.format)),this.append(this.getRightExplainOptionsWrapper()))}visitDefaultInsertValue(n){this.append("default")}visitAggregateFunction(n){this.append(n.func),this.append("("),n.distinct&&this.append("distinct "),this.compileList(n.aggregated),this.append(")"),n.filter&&(this.append(" filter("),this.visitNode(n.filter),this.append(")")),n.over&&(this.append(" "),this.visitNode(n.over))}visitOver(n){this.append("over("),n.partitionBy&&(this.visitNode(n.partitionBy),n.orderBy&&this.append(" ")),n.orderBy&&this.visitNode(n.orderBy),this.append(")")}visitPartitionBy(n){this.append("partition by "),this.compileList(n.items)}visitPartitionByItem(n){this.visitNode(n.partitionBy)}visitBinaryOperation(n){this.visitNode(n.leftOperand),this.append(" "),this.visitNode(n.operator),this.append(" "),this.visitNode(n.rightOperand)}visitUnaryOperation(n){this.visitNode(n.operator),this.isMinusOperator(n.operator)||this.append(" "),this.visitNode(n.operand)}isMinusOperator(n){return Ff.is(n)&&n.operator==="-"}visitUsing(n){this.append("using "),this.compileList(n.tables)}visitFunction(n){this.append(n.func),this.append("("),this.compileList(n.arguments),this.append(")")}visitCase(n){this.append("case"),n.value&&(this.append(" "),this.visitNode(n.value)),n.when&&(this.append(" "),this.compileList(n.when," ")),n.else&&(this.append(" else "),this.visitNode(n.else)),this.append(" end"),n.isStatement&&this.append(" case")}visitWhen(n){this.append("when "),this.visitNode(n.condition),n.result&&(this.append(" then "),this.visitNode(n.result))}append(n){P(this,_o,r(this,_o)+n)}appendValue(n){this.addParameter(n),this.append(this.getCurrentParameterPlaceholder())}getLeftIdentifierWrapper(){return'"'}getRightIdentifierWrapper(){return'"'}getCurrentParameterPlaceholder(){return"$"+this.numParameters}getLeftExplainOptionsWrapper(){return"("}getExplainOptionAssignment(){return" "}getExplainOptionsDelimiter(){return", "}getRightExplainOptionsWrapper(){return")"}sanitizeIdentifier(n){const i=this.getLeftIdentifierWrapper(),a=this.getRightIdentifierWrapper();let l="";for(const m of n)l+=m,m===i?l+=i:m===a&&(l+=a);return l}addParameter(n){r(this,ls).push(n)}appendImmediateValue(n){if(pr(n))this.append(`'${n}'`);else if(cg(n)||yp(n))this.append(n.toString());else if(wp(n))this.append("null");else if(lg(n))this.appendImmediateValue(n.toISOString());else if(fg(n))this.appendImmediateValue(n.toString());else throw new Error(`invalid immediate value ${n}`)}}_o=new WeakMap,ls=new WeakMap;const Db=p({ForKeyShare:"for key share",ForNoKeyUpdate:"for no key update",ForUpdate:"for update",ForShare:"for share",NoWait:"nowait",SkipLocked:"skip locked",Distinct:"distinct"}),Lb=p({InnerJoin:"inner join",LeftJoin:"left join",RightJoin:"right join",FullJoin:"full join",LateralInnerJoin:"inner join lateral",LateralLeftJoin:"left join lateral"}),Qr=p({raw(t){return p({sql:t,query:en.createWithSql(t),parameters:p([])})}}),Pb=/"/g;class lm extends Rb{getCurrentParameterPlaceholder(){return"?"}getLeftExplainOptionsWrapper(){return""}getRightExplainOptionsWrapper(){return""}getLeftIdentifierWrapper(){return'"'}getRightIdentifierWrapper(){return'"'}getAutoIncrement(){return"autoincrement"}sanitizeIdentifier(e){return e.replace(Pb,'""')}visitDefaultInsertValue(e){this.append("null")}}const Mb="kysely_migration",Bb="kysely_migration_lock";p({__noMigrations__:!0});var xo,Xc,hm;class fm{constructor(e){S(this,Xc);S(this,xo,void 0);P(this,xo,e)}async getSchemas(){return[]}async getTables(e={withInternalKyselyTables:!1}){let n=r(this,xo).selectFrom("sqlite_schema").where("type","in",["table","view"]).where("name","not like","sqlite_%").select("name").orderBy("name").$castTo();e.withInternalKyselyTables||(n=n.where("name","!=",Mb).where("name","!=",Bb));const i=await n.execute();return Promise.all(i.map(({name:a})=>qe(this,Xc,hm).call(this,a)))}async getMetadata(e){return{tables:await this.getTables(e)}}}xo=new WeakMap,Xc=new WeakSet,hm=async function(e){var m,w,v,d,W,F;const n=r(this,xo),i=await n.selectFrom("sqlite_master").where("name","=",e).select(["sql","type"]).$castTo().executeTakeFirstOrThrow(),a=(F=(W=(d=(v=(w=(m=i.sql)==null?void 0:m.split(/[\(\),]/))==null?void 0:w.find(U=>U.toLowerCase().includes("autoincrement")))==null?void 0:v.trimStart())==null?void 0:d.split(/\s+/))==null?void 0:W[0])==null?void 0:F.replace(/["`]/g,""),l=await n.selectFrom(kn`pragma_table_info(${e})`.as("table_info")).select(["name","type","notnull","dflt_value"]).orderBy("cid").execute();return{name:e,isView:i.type==="view",columns:l.map(U=>({name:U.name,dataType:U.type,isNullable:!U.notnull,isAutoIncrementing:U.name===a,hasDefaultValue:U.dflt_value!=null}))}};class dm{get supportsTransactionalDdl(){return!1}get supportsReturning(){return!0}async acquireMigrationLock(){}async releaseMigrationLock(){}}var pm=class{createQueryCompiler(){return new lm}createAdapter(){return new dm}createIntrospector(t){return new fm(t)}},ru,Yc,sd,mm=(sd=class{constructor(){S(this,ru,new Fb);Yt(this,"connection");S(this,Yc,void 0)}async acquireConnection(){return await r(this,ru).lock(),this.connection}async beginTransaction(t){await t.executeQuery(Qr.raw("begin"))}async commitTransaction(t){await t.executeQuery(Qr.raw("commit"))}async rollbackTransaction(t){await t.executeQuery(Qr.raw("rollback"))}async releaseConnection(){r(this,ru).unlock()}async destroy(){var t;(t=r(this,Yc))==null||t.close()}},ru=new WeakMap,Yc=new WeakMap,sd),fs,Eo,od,Fb=(od=class{constructor(){S(this,fs,void 0);S(this,Eo,void 0)}async lock(){for(;r(this,fs);)await r(this,fs);P(this,fs,new Promise(e=>{P(this,Eo,e)}))}unlock(){const e=r(this,Eo);P(this,fs,void 0),P(this,Eo,void 0),e==null||e()}},fs=new WeakMap,Eo=new WeakMap,od),ym=class{streamQuery(){throw new Error("Sqlite driver doesn't support streaming")}async executeQuery(t){const{parameters:e,sql:n,query:i}=t;return["SelectQueryNode","RawNode"].includes(i.kind)?{rows:await this.query(n,e)}:{rows:[],...await this.exec(n,e)}}};function Ub({func:t,delay:e,maxCalls:n}){let i,a=0,l=null;function m(){i&&clearTimeout(i),a=0,l=null}function w(){a>=n?(t(l),m()):(i&&clearTimeout(i),i=setTimeout(()=>{t(l),m(),i=void 0},e))}return v=>{a++,l=v,i===void 0&&a===0?(t(v),a++):w()}}var Tn,Co,ad,$b=(ad=class extends mm{constructor(e){super();S(this,Tn,void 0);S(this,Co,void 0);P(this,Tn,e)}async init(){var e,n,i,a;if(P(this,Co,typeof r(this,Tn).database=="function"?await r(this,Tn).database():r(this,Tn).database),!r(this,Co))throw new Error("no database");this.connection=new Qb(r(this,Co),(e=r(this,Tn).onWrite)==null?void 0:e.func,(n=r(this,Tn).onWrite)==null?void 0:n.isThrottle,(i=r(this,Tn).onWrite)==null?void 0:i.maxCalls,(a=r(this,Tn).onWrite)==null?void 0:a.delay),r(this,Tn).onCreateConnection&&await r(this,Tn).onCreateConnection(this.connection)}async beginTransaction(e){await e.executeQuery(Qr.raw("begin")),this.connection&&this.connection.transactionNum++}async commitTransaction(e){await e.executeQuery(Qr.raw("commit")),this.connection&&this.connection.transactionNum--}async rollbackTransaction(e){await e.executeQuery(Qr.raw("rollback")),this.connection&&this.connection.transactionNum--}},Tn=new WeakMap,Co=new WeakMap,ad),pi,Oo,ud,Qb=(ud=class extends ym{constructor(e,n,i=!1,a=1e3,l=2e3){super();S(this,pi,void 0);S(this,Oo,void 0);Yt(this,"transactionNum",0);P(this,pi,e),P(this,Oo,n?i?Ub({func:n,maxCalls:a,delay:l}):n:void 0)}query(e,n){const i=r(this,pi).prepare(e);i.bind(n);const a=[];for(;i.step();)a.push(i.getAsObject());return i.free(),a}exec(e,n){r(this,pi).run(e,n);const i=BigInt(this.query("SELECT last_insert_rowid() as id")[0].id),a=BigInt(r(this,pi).getRowsModified());return this.transactionNum===0&&r(this,Oo)&&r(this,Oo).call(this,r(this,pi).export()),{numAffectedRows:a,insertId:i}}},pi=new WeakMap,Oo=new WeakMap,ud),iu,cd,jb=(cd=class extends pm{constructor(e){super();S(this,iu,void 0);P(this,iu,e)}createDriver(){return new $b(r(this,iu))}},iu=new WeakMap,cd),Pr,hs,ld,Hb=(ld=class extends mm{constructor(e){super();S(this,Pr,void 0);S(this,hs,void 0);P(this,Pr,e)}async init(){P(this,hs,typeof r(this,Pr).database=="function"?await r(this,Pr).database():r(this,Pr).database),this.connection=new Vb(r(this,hs)),r(this,Pr).onCreateConnection&&await r(this,Pr).onCreateConnection(this.connection)}async close(){var e;await((e=r(this,hs))==null?void 0:e.sqlite.close(r(this,hs).db))}},Pr=new WeakMap,hs=new WeakMap,ld),Sn,ds,fd,Vb=(fd=class extends ym{constructor(e){super();S(this,Sn,void 0);S(this,ds,void 0);P(this,ds,e.db),P(this,Sn,e.sqlite)}async run(e){const n=r(this,Sn).str_new(r(this,ds),e.sql),i=await r(this,Sn).prepare_v2(r(this,ds),r(this,Sn).str_value(n));if(i===null)return[];const a=i.stmt;try{typeof e.param<"u"&&r(this,Sn).bind_collection(a,e.param);const l=[];let m=[];for(;await r(this,Sn).step(a)===100;){m=m.length===0?r(this,Sn).column_names(a):m;const w=r(this,Sn).row(a);l.push(m.reduce((v,d,W)=>(v[d]=w[W],v),{}))}return l}finally{await r(this,Sn).finalize(a)}}async query(e,n){return await this.run({sql:e,param:n})}async exec(e,n){await this.run({sql:e,param:n});const i=await this.run({sql:"SELECT last_insert_rowid() as id"});return{insertId:BigInt(i[0].id),numAffectedRows:BigInt(r(this,Sn).changes(r(this,ds)))}}},Sn=new WeakMap,ds=new WeakMap,fd),su,hd,zb=(hd=class extends pm{constructor(e){super();S(this,su,void 0);P(this,su,e)}createDriver(){return new Hb(r(this,su))}},su=new WeakMap,hd);function Kb(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Jb(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function i(){if(this instanceof i){var a=[null];a.push.apply(a,arguments);var l=Function.bind.apply(e,a);return new l}return e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(i){var a=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(n,i,a.get?a:{enumerable:!0,get:function(){return t[i]}})}),n}var wm={exports:{}};const Gb={},Xb=Object.freeze(Object.defineProperty({__proto__:null,default:Gb},Symbol.toStringTag,{value:"Module"})),Ku=Jb(Xb);(function(t,e){var n=void 0,i=function(a){return n||(n=new Promise(function(l,m){var w=typeof a<"u"?a:{},v=w.onAbort;w.onAbort=function(o){m(new Error(o)),v&&v(o)},w.postRun=w.postRun||[],w.postRun.push(function(){l(w)}),t=void 0;var d;d||(d=typeof w<"u"?w:{}),d.onRuntimeInitialized=function(){function o(I,G){switch(typeof G){case"boolean":Mu(I,G?1:0);break;case"number":Lu(I,G);break;case"string":ha(I,G,-1,-1);break;case"object":if(G===null)fa(I);else if(G.length!=null){var s=Bs(G);Pu(I,s,G.length,-1),Fi(s)}else Qi(I,"Wrong API use : tried to return a value of an unknown type ("+G+").",-1);break;default:fa(I)}}function c(I,G){for(var s=[],u=0;u>>0),I!=null){var G=this.filename,s="/",u=G;if(s&&(s=typeof s=="string"?s:Oi(s),u=G?ue(s+"/"+G):s),G=mn(!0,!0),u=Wi(u,(G!==void 0?G:438)&4095|32768,0),I){if(typeof I=="string"){s=Array(I.length);for(var f=0,y=I.length;f{ne||(T=Ku,ne=Ku)},C=function(o,c){return Ne(),o=ne.normalize(o),T.readFileSync(o,c?void 0:"utf8")},q=o=>(o=C(o,!0),o.buffer||(o=new Uint8Array(o)),o),N=(o,c,h)=>{Ne(),o=ne.normalize(o),T.readFile(o,function(g,E){g?h(g):c(E.buffer)})},1{var c=new XMLHttpRequest;return c.open("GET",o,!1),c.send(null),c.responseText},Y&&(q=o=>{var c=new XMLHttpRequest;return c.open("GET",o,!1),c.responseType="arraybuffer",c.send(null),new Uint8Array(c.response)}),N=(o,c,h)=>{var g=new XMLHttpRequest;g.open("GET",o,!0),g.responseType="arraybuffer",g.onload=()=>{g.status==200||g.status==0&&g.response?c(g.response):h()},g.onerror=h,g.send(null)});var ae=d.print||console.log.bind(console),_e=d.printErr||console.warn.bind(console);Object.assign(d,W),W=null,d.thisProgram&&(F=d.thisProgram);var xe;d.wasmBinary&&(xe=d.wasmBinary),d.noExitRuntime,typeof WebAssembly!="object"&&x("no native wasm support detected");var tt,ze=!1,qt=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function Wt(o,c,h){var g=c+h;for(h=c;o[h]&&!(h>=g);)++h;if(16E?g+=String.fromCharCode(E):(E-=65536,g+=String.fromCharCode(55296|E>>10,56320|E&1023))}}else g+=String.fromCharCode(E)}return g}function Qe(o,c){return o?Wt(Oe,o,c):""}function Kt(o,c,h,g){if(!(0=Q){var ve=o.charCodeAt(++D);Q=65536+((Q&1023)<<10)|ve&1023}if(127>=Q){if(h>=g)break;c[h++]=Q}else{if(2047>=Q){if(h+1>=g)break;c[h++]=192|Q>>6}else{if(65535>=Q){if(h+2>=g)break;c[h++]=224|Q>>12}else{if(h+3>=g)break;c[h++]=240|Q>>18,c[h++]=128|Q>>12&63}c[h++]=128|Q>>6&63}c[h++]=128|Q&63}}return c[h]=0,h-E}function dn(o){for(var c=0,h=0;h=g?c++:2047>=g?c+=2:55296<=g&&57343>=g?(c+=4,++h):c+=3}return c}var wt,ge,Oe,ut,we,Re,Pt,Ar;function Es(){var o=tt.buffer;wt=o,d.HEAP8=ge=new Int8Array(o),d.HEAP16=ut=new Int16Array(o),d.HEAP32=we=new Int32Array(o),d.HEAPU8=Oe=new Uint8Array(o),d.HEAPU16=new Uint16Array(o),d.HEAPU32=Re=new Uint32Array(o),d.HEAPF32=Pt=new Float32Array(o),d.HEAPF64=Ar=new Float64Array(o)}var En,pn=[],fe=[],Me=[];function zn(){var o=d.preRun.shift();pn.unshift(o)}var Jt=0,Ke=null;function x(o){throw d.onAbort&&d.onAbort(o),o="Aborted("+o+")",_e(o),ze=!0,new WebAssembly.RuntimeError(o+". Build with -sASSERTIONS for more info.")}function O(){return R.startsWith("data:application/octet-stream;base64,")}var R;if(R="sql-wasm.wasm",!O()){var M=R;R=d.locateFile?d.locateFile(M,b):b+M}function K(){var o=R;try{if(o==R&&xe)return new Uint8Array(xe);if(q)return q(o);throw"both async and sync fetching of the wasm failed"}catch(c){x(c)}}function ee(){if(!xe&&(U||Y)){if(typeof fetch=="function"&&!R.startsWith("file://"))return fetch(R,{credentials:"same-origin"}).then(function(o){if(!o.ok)throw"failed to load wasm binary file at '"+R+"'";return o.arrayBuffer()}).catch(function(){return K()});if(N)return new Promise(function(o,c){N(R,function(h){o(new Uint8Array(h))},c)})}return Promise.resolve().then(function(){return K()})}var j,z;function re(o){for(;0>0];case"i8":return ge[o>>0];case"i16":return ut[o>>1];case"i32":return we[o>>2];case"i64":return we[o>>2];case"float":return Pt[o>>2];case"double":return Ar[o>>3];case"*":return Re[o>>2];default:x("invalid type for getValue: "+c)}return null}function ce(o){var c="i32";switch(c.endsWith("*")&&(c="*"),c){case"i1":ge[o>>0]=0;break;case"i8":ge[o>>0]=0;break;case"i16":ut[o>>1]=0;break;case"i32":we[o>>2]=0;break;case"i64":z=[0,(j=0,1<=+Math.abs(j)?0>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],we[o>>2]=z[0],we[o+4>>2]=z[1];break;case"float":Pt[o>>2]=0;break;case"double":Ar[o>>3]=0;break;case"*":Re[o>>2]=0;break;default:x("invalid type for setValue: "+c)}}var oe=(o,c)=>{for(var h=0,g=o.length-1;0<=g;g--){var E=o[g];E==="."?o.splice(g,1):E===".."?(o.splice(g,1),h++):h&&(o.splice(g,1),h--)}if(c)for(;h;h--)o.unshift("..");return o},ue=o=>{var c=o.charAt(0)==="/",h=o.substr(-1)==="/";return(o=oe(o.split("/").filter(g=>!!g),!c).join("/"))||c||(o="."),o&&h&&(o+="/"),(c?"/":"")+o},be=o=>{var c=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(o).slice(1);return o=c[0],c=c[1],!o&&!c?".":(c&&(c=c.substr(0,c.length-1)),o+c)},Ee=o=>{if(o==="/")return"/";o=ue(o),o=o.replace(/\/$/,"");var c=o.lastIndexOf("/");return c===-1?o:o.substr(c+1)};function je(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var o=new Uint8Array(1);return()=>(crypto.getRandomValues(o),o[0])}if(Z)try{var c=Ku;return()=>c.randomBytes(1)[0]}catch{}return()=>x("randomDevice")}function Le(){for(var o="",c=!1,h=arguments.length-1;-1<=h&&!c;h--){if(c=0<=h?arguments[h]:"/",typeof c!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!c)return"";o=c+"/"+o,c=c.charAt(0)==="/"}return o=oe(o.split("/").filter(g=>!!g),!c).join("/"),(c?"/":"")+o||"."}function it(o,c){var h=Array(dn(o)+1);return o=Kt(o,h,0,h.length),c&&(h.length=o),h}var me=[];function Cn(o,c){me[o]={input:[],output:[],Xa:c},qi(o,Ci)}var Ci={open:function(o){var c=me[o.node.rdev];if(!c)throw new H(43);o.tty=c,o.seekable=!1},close:function(o){o.tty.Xa.fsync(o.tty)},fsync:function(o){o.tty.Xa.fsync(o.tty)},read:function(o,c,h,g){if(!o.tty||!o.tty.Xa.tb)throw new H(60);for(var E=0,D=0;D=c||(c=Math.max(c,h*(1048576>h?2:1.125)>>>0),h!=0&&(c=Math.max(c,256)),h=o.Ia,o.Ia=new Uint8Array(c),0=o.node.Ma)return 0;if(o=Math.min(o.node.Ma-E,g),8c)throw new H(28);return c},lb:function(o,c,h){le.qb(o.node,c+h),o.node.Ma=Math.max(o.node.Ma,c+h)},bb:function(o,c,h,g,E){if((o.node.mode&61440)!==32768)throw new H(43);if(o=o.node.Ia,E&2||o.buffer!==wt){if((0{if(o=Le("/",o),!o)return{path:"",node:null};if(c=Object.assign({rb:!0,kb:0},c),8!!Q),!1);for(var h=Mt,g="/",E=0;E{for(var c;;){if(o===o.parent)return o=o.Ra.ub,c?o[o.length-1]!=="/"?o+"/"+c:o+c:o;c=c?o.name+"/"+c:o.name,o=o.parent}},qs=(o,c)=>{for(var h=0,g=0;g>>0)%On.length},Tr=o=>{var c=qs(o.parent.id,o.name);if(On[c]===o)On[c]=o.Wa;else for(c=On[c];c;){if(c.Wa===o){c.Wa=o.Wa;break}c=c.Wa}},mr=(o,c)=>{var h;if(h=(h=zr(o,"x"))?h:o.Ga.lookup?0:2)throw new H(h,o);for(h=On[qs(o.id,c)];h;h=h.Wa){var g=h.name;if(h.parent.id===o.id&&g===c)return h}return o.Ga.lookup(o,c)},Ho=(o,c,h,g)=>(o=new na(o,c,h,g),c=qs(o.parent.id,o.name),o.Wa=On[c],On[c]=o),Cl={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},Vo=o=>{var c=["r","w","rw"][o&3];return o&512&&(c+="w"),c},zr=(o,c)=>{if(Os)return 0;if(!c.includes("r")||o.mode&292){if(c.includes("w")&&!(o.mode&146)||c.includes("x")&&!(o.mode&73))return 2}else return 2;return 0},Ws=(o,c)=>{try{return mr(o,c),20}catch{}return zr(o,"wx")},zo=(o,c,h)=>{try{var g=mr(o,c)}catch(E){return E.Ka}if(o=zr(o,"wx"))return o;if(h){if((g.mode&61440)!==16384)return 54;if(g===g.parent||Oi(g)==="/")return 10}else if((g.mode&61440)===16384)return 31;return 0},Ko=(o=0)=>{for(;4096>=o;o++)if(!Dn[o])return o;throw new H(33)},qn=(o,c)=>(Di||(Di=function(){this.$a={}},Di.prototype={},Object.defineProperties(Di.prototype,{object:{get:function(){return this.node},set:function(h){this.node=h}},flags:{get:function(){return this.$a.flags},set:function(h){this.$a.flags=h}},position:{get:function(){return this.$a.position},set:function(h){this.$a.position=h}}})),o=Object.assign(new Di,o),c=Ko(c),o.fd=c,Dn[c]=o),Is={open:o=>{o.Ha=te[o.node.rdev].Ha,o.Ha.open&&o.Ha.open(o)},Ta:()=>{throw new H(70)}},qi=(o,c)=>{te[o]={Ha:c}},Jo=(o,c)=>{var h=c==="/",g=!c;if(h&&Mt)throw new H(10);if(!h&&!g){var E=Bt(c,{rb:!1});if(c=E.path,E=E.node,E.Va)throw new H(10);if((E.mode&61440)!==16384)throw new H(54)}c={type:o,Kb:{},ub:c,Eb:[]},o=o.Ra(c),o.Ra=c,c.root=o,h?Mt=o:E&&(E.Va=c,E.Ra&&E.Ra.Eb.push(c))},Wi=(o,c,h)=>{var g=Bt(o,{parent:!0}).node;if(o=Ee(o),!o||o==="."||o==="..")throw new H(28);var E=Ws(g,o);if(E)throw new H(E);if(!g.Ga.ab)throw new H(63);return g.Ga.ab(g,o,c,h)},an=(o,c)=>Wi(o,(c!==void 0?c:511)&1023|16384,0),Ii=(o,c,h)=>{typeof h>"u"&&(h=c,c=438),Wi(o,c|8192,h)},As=(o,c)=>{if(!Le(o))throw new H(44);var h=Bt(c,{parent:!0}).node;if(!h)throw new H(44);c=Ee(c);var g=Ws(h,c);if(g)throw new H(g);if(!h.Ga.symlink)throw new H(63);h.Ga.symlink(h,c,o)},Go=o=>{var c=Bt(o,{parent:!0}).node;o=Ee(o);var h=mr(c,o),g=zo(c,o,!0);if(g)throw new H(g);if(!c.Ga.rmdir)throw new H(63);if(h.Va)throw new H(10);c.Ga.rmdir(c,o),Tr(h)},Ai=o=>{var c=Bt(o,{parent:!0}).node;if(!c)throw new H(44);o=Ee(o);var h=mr(c,o),g=zo(c,o,!1);if(g)throw new H(g);if(!c.Ga.unlink)throw new H(63);if(h.Va)throw new H(10);c.Ga.unlink(c,o),Tr(h)},Xo=o=>{if(o=Bt(o).node,!o)throw new H(44);if(!o.Ga.readlink)throw new H(28);return Le(Oi(o.parent),o.Ga.readlink(o))},Kr=(o,c)=>{if(o=Bt(o,{Sa:!c}).node,!o)throw new H(44);if(!o.Ga.Pa)throw new H(63);return o.Ga.Pa(o)},Yo=o=>Kr(o,!0),Ts=(o,c)=>{if(o=typeof o=="string"?Bt(o,{Sa:!0}).node:o,!o.Ga.Oa)throw new H(63);o.Ga.Oa(o,{mode:c&4095|o.mode&-4096,timestamp:Date.now()})},Jr=(o,c)=>{if(0>c)throw new H(28);if(o=typeof o=="string"?Bt(o,{Sa:!0}).node:o,!o.Ga.Oa)throw new H(63);if((o.mode&61440)===16384)throw new H(31);if((o.mode&61440)!==32768)throw new H(28);var h=zr(o,"w");if(h)throw new H(h);o.Ga.Oa(o,{size:c,timestamp:Date.now()})},yr=(o,c,h)=>{if(o==="")throw new H(44);if(typeof c=="string"){var g=Cl[c];if(typeof g>"u")throw Error("Unknown file open mode: "+c);c=g}if(h=c&64?(typeof h>"u"?438:h)&4095|32768:0,typeof o=="object")var E=o;else{o=ue(o);try{E=Bt(o,{Sa:!(c&131072)}).node}catch{}}if(g=!1,c&64)if(E){if(c&128)throw new H(20)}else E=Wi(o,h,0),g=!0;if(!E)throw new H(44);if((E.mode&61440)===8192&&(c&=-513),c&65536&&(E.mode&61440)!==16384)throw new H(54);if(!g&&(h=E?(E.mode&61440)===40960?32:(E.mode&61440)===16384&&(Vo(c)!=="r"||c&512)?31:zr(E,Vo(c)):44))throw new H(h);return c&512&&!g&&Jr(E,0),c&=-131713,E=qn({node:E,path:Oi(E),flags:c,seekable:!0,position:0,Ha:E.Ha,Ib:[],error:!1}),E.Ha.open&&E.Ha.open(E),!d.logReadFiles||c&1||(Li||(Li={}),o in Li||(Li[o]=1)),E},He=o=>{if(o.fd===null)throw new H(8);o.hb&&(o.hb=null);try{o.Ha.close&&o.Ha.close(o)}catch(c){throw c}finally{Dn[o.fd]=null}o.fd=null},Gr=(o,c,h)=>{if(o.fd===null)throw new H(8);if(!o.seekable||!o.Ha.Ta)throw new H(70);if(h!=0&&h!=1&&h!=2)throw new H(28);o.position=o.Ha.Ta(o,c,h),o.Ib=[]},Ti=(o,c,h,g,E)=>{if(0>g||0>E)throw new H(28);if(o.fd===null)throw new H(8);if((o.flags&2097155)===1)throw new H(8);if((o.node.mode&61440)===16384)throw new H(31);if(!o.Ha.read)throw new H(28);var D=typeof E<"u";if(!D)E=o.position;else if(!o.seekable)throw new H(70);return c=o.Ha.read(o,c,h,g,E),D||(o.position+=c),c},wr=(o,c,h,g,E)=>{if(0>g||0>E)throw new H(28);if(o.fd===null)throw new H(8);if(!(o.flags&2097155))throw new H(8);if((o.node.mode&61440)===16384)throw new H(31);if(!o.Ha.write)throw new H(28);o.seekable&&o.flags&1024&&Gr(o,0,2);var D=typeof E<"u";if(!D)E=o.position;else if(!o.seekable)throw new H(70);return c=o.Ha.write(o,c,h,g,E,void 0),D||(o.position+=c),c},Ss=o=>{var c,h=yr(o,h||0);o=Kr(o).size;var g=new Uint8Array(o);return Ti(h,g,0,o,0),c=g,He(h),c},Si=()=>{H||(H=function(o,c){this.node=c,this.Hb=function(h){this.Ka=h},this.Hb(o),this.message="FS error"},H.prototype=Error(),H.prototype.constructor=H,[44].forEach(o=>{Kn[o]=new H(o),Kn[o].stack=""}))},ki,mn=(o,c)=>{var h=0;return o&&(h|=365),c&&(h|=146),h},Ln=(o,c,h)=>{o=ue("/dev/"+o);var g=mn(!!c,!!h);Ri||(Ri=64);var E=Ri++<<8|0;qi(E,{open:D=>{D.seekable=!1},close:()=>{h&&h.buffer&&h.buffer.length&&h(10)},read:(D,Q,ve,Pe)=>{for(var De=0,ct=0;ct{for(var De=0;De>2]=g.dev,we[h+8>>2]=g.ino,we[h+12>>2]=g.mode,Re[h+16>>2]=g.nlink,we[h+20>>2]=g.uid,we[h+24>>2]=g.gid,we[h+28>>2]=g.rdev,z=[g.size>>>0,(j=g.size,1<=+Math.abs(j)?0>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],we[h+40>>2]=z[0],we[h+44>>2]=z[1],we[h+48>>2]=4096,we[h+52>>2]=g.blocks,z=[Math.floor(g.atime.getTime()/1e3)>>>0,(j=Math.floor(g.atime.getTime()/1e3),1<=+Math.abs(j)?0>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],we[h+56>>2]=z[0],we[h+60>>2]=z[1],Re[h+64>>2]=0,z=[Math.floor(g.mtime.getTime()/1e3)>>>0,(j=Math.floor(g.mtime.getTime()/1e3),1<=+Math.abs(j)?0>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],we[h+72>>2]=z[0],we[h+76>>2]=z[1],Re[h+80>>2]=0,z=[Math.floor(g.ctime.getTime()/1e3)>>>0,(j=Math.floor(g.ctime.getTime()/1e3),1<=+Math.abs(j)?0>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],we[h+88>>2]=z[0],we[h+92>>2]=z[1],Re[h+96>>2]=0,z=[g.ino>>>0,(j=g.ino,1<=+Math.abs(j)?0>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],we[h+104>>2]=z[0],we[h+108>>2]=z[1],0}var Xr=void 0;function Mi(){return Xr+=4,we[Xr-4>>2]}function yn(o){if(o=Dn[o],!o)throw new H(8);return o}function ks(o){return Re[o>>2]+4294967296*we[o+4>>2]}function Zo(o){var c=dn(o)+1,h=Bi(c);return h&&Kt(o,ge,h,c),h}function vu(o,c,h){function g(Pe){return(Pe=Pe.toTimeString().match(/\(([A-Za-z ]+)\)$/))?Pe[1]:"GMT"}var E=new Date().getFullYear(),D=new Date(E,0,1),Q=new Date(E,6,1);E=D.getTimezoneOffset();var ve=Q.getTimezoneOffset();we[o>>2]=60*Math.max(E,ve),we[c>>2]=+(E!=ve),o=g(D),c=g(Q),o=Zo(o),c=Zo(c),ve>2]=o,Re[h+4>>2]=c):(Re[h>>2]=c,Re[h+4>>2]=o)}function Rs(o,c,h){Rs.Bb||(Rs.Bb=!0,vu(o,c,h))}var ea;ea=Z?()=>{var o=process.hrtime();return 1e3*o[0]+o[1]/1e6}:()=>performance.now();var Ds={};function ta(){if(!Ls){var o={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:F||"./this.program"},c;for(c in Ds)Ds[c]===void 0?delete o[c]:o[c]=Ds[c];var h=[];for(c in o)h.push(c+"="+o[c]);Ls=h}return Ls}var Ls,Gn=void 0,Ps=[];function Ms(o,c){if(!Gn){Gn=new WeakMap;var h=En.length;if(Gn)for(var g=0;g<0+h;g++){var E=En.get(g);E&&Gn.set(E,g)}}if(Gn.has(o))return Gn.get(o);if(Ps.length)h=Ps.pop();else{try{En.grow(1)}catch(ve){throw ve instanceof RangeError?"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.":ve}h=En.length-1}try{En.set(h,o)}catch(ve){if(!(ve instanceof TypeError))throw ve;if(typeof WebAssembly.Function=="function"){g=WebAssembly.Function,E={i:"i32",j:"i64",f:"f32",d:"f64",p:"i32"};for(var D={parameters:[],results:c[0]=="v"?[]:[E[c[0]]]},Q=1;QQ?g.push(Q):g.push(Q%128|128,Q>>7),Q=0;QE?c.push(E):c.push(E%128|128,E>>7),c.push.apply(c,g),c.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0),c=new WebAssembly.Module(new Uint8Array(c)),c=new WebAssembly.Instance(c,{e:{f:o}}).exports.f}En.set(h,c)}return Gn.set(o,h),h}function Yr(o){Gn.delete(En.get(o)),Ps.push(o)}function Bs(o){var c=Bi(o.length);return o.subarray||o.slice||(o=new Uint8Array(o)),Oe.set(o,c),c}function _u(o,c,h,g){var E={string:De=>{var ct=0;if(De!=null&&De!==0){var Pn=(De.length<<2)+1;ct=Xn(Pn),Kt(De,Oe,ct,Pn)}return ct},array:De=>{var ct=Xn(De.length);return ge.set(De,ct),ct}};o=d["_"+o];var D=[],Q=0;if(g)for(var ve=0;ve{an("/dev"),qi(259,{read:()=>0,write:(c,h,g,E)=>E}),Ii("/dev/null",259),Cn(1280,Gt),Cn(1536,Cs),Ii("/dev/tty",1280),Ii("/dev/tty1",1536);var o=je();Ln("random",o),Ln("urandom",o),an("/dev/shm"),an("/dev/shm/tmp")})(),(()=>{an("/proc");var o=an("/proc/self");an("/proc/self/fd"),Jo({Ra:()=>{var c=Ho(o,"fd",16895,73);return c.Ga={lookup:(h,g)=>{var E=Dn[+g];if(!E)throw new H(8);return h={parent:null,Ra:{ub:"fake"},Ga:{readlink:()=>E.path}},h.parent=h}},c}},"/proc/self/fd")})();var xu={a:function(o,c,h,g){x("Assertion failed: "+Qe(o)+", at: "+[c?Qe(c):"unknown filename",h,g?Qe(g):"unknown function"])},h:function(o,c){try{return o=Qe(o),Ts(o,c),0}catch(h){if(typeof Je>"u"||!(h instanceof H))throw h;return-h.Ka}},H:function(o,c,h){try{if(c=Qe(c),c=Jn(o,c),h&-8)return-28;var g=Bt(c,{Sa:!0}).node;return g?(o="",h&4&&(o+="r"),h&2&&(o+="w"),h&1&&(o+="x"),o&&zr(g,o)?-2:0):-44}catch(E){if(typeof Je>"u"||!(E instanceof H))throw E;return-E.Ka}},i:function(o,c){try{var h=Dn[o];if(!h)throw new H(8);return Ts(h.node,c),0}catch(g){if(typeof Je>"u"||!(g instanceof H))throw g;return-g.Ka}},g:function(o){try{var c=Dn[o];if(!c)throw new H(8);var h=c.node,g=typeof h=="string"?Bt(h,{Sa:!0}).node:h;if(!g.Ga.Oa)throw new H(63);return g.Ga.Oa(g,{timestamp:Date.now()}),0}catch(E){if(typeof Je>"u"||!(E instanceof H))throw E;return-E.Ka}},b:function(o,c,h){Xr=h;try{var g=yn(o);switch(c){case 0:var E=Mi();return 0>E?-28:qn(g,E).fd;case 1:case 2:return 0;case 3:return g.flags;case 4:return E=Mi(),g.flags|=E,0;case 5:return E=Mi(),ut[E+0>>1]=2,0;case 6:case 7:return 0;case 16:case 8:return-28;case 9:return we[ra()>>2]=28,-1;default:return-28}}catch(D){if(typeof Je>"u"||!(D instanceof H))throw D;return-D.Ka}},G:function(o,c){try{var h=yn(o);return Pi(Kr,h.path,c)}catch(g){if(typeof Je>"u"||!(g instanceof H))throw g;return-g.Ka}},l:function(o,c,h){try{if(c=h+2097152>>>0<4194305-!!c?(c>>>0)+4294967296*h:NaN,isNaN(c))return-61;var g=Dn[o];if(!g)throw new H(8);if(!(g.flags&2097155))throw new H(28);return Jr(g.node,c),0}catch(E){if(typeof Je>"u"||!(E instanceof H))throw E;return-E.Ka}},B:function(o,c){try{if(c===0)return-28;var h=dn("/")+1;return c"u"||!(g instanceof H))throw g;return-g.Ka}},E:function(o,c){try{return o=Qe(o),Pi(Yo,o,c)}catch(h){if(typeof Je>"u"||!(h instanceof H))throw h;return-h.Ka}},y:function(o,c,h){try{return c=Qe(c),c=Jn(o,c),c=ue(c),c[c.length-1]==="/"&&(c=c.substr(0,c.length-1)),an(c,h),0}catch(g){if(typeof Je>"u"||!(g instanceof H))throw g;return-g.Ka}},D:function(o,c,h,g){try{c=Qe(c);var E=g&256;return c=Jn(o,c,g&4096),Pi(E?Yo:Kr,c,h)}catch(D){if(typeof Je>"u"||!(D instanceof H))throw D;return-D.Ka}},v:function(o,c,h,g){Xr=g;try{c=Qe(c),c=Jn(o,c);var E=g?Mi():0;return yr(c,h,E).fd}catch(D){if(typeof Je>"u"||!(D instanceof H))throw D;return-D.Ka}},t:function(o,c,h,g){try{if(c=Qe(c),c=Jn(o,c),0>=g)return-28;var E=Xo(c),D=Math.min(g,dn(E)),Q=ge[h+D];return Kt(E,Oe,h,g+1),ge[h+D]=Q,D}catch(ve){if(typeof Je>"u"||!(ve instanceof H))throw ve;return-ve.Ka}},s:function(o){try{return o=Qe(o),Go(o),0}catch(c){if(typeof Je>"u"||!(c instanceof H))throw c;return-c.Ka}},F:function(o,c){try{return o=Qe(o),Pi(Kr,o,c)}catch(h){if(typeof Je>"u"||!(h instanceof H))throw h;return-h.Ka}},p:function(o,c,h){try{return c=Qe(c),c=Jn(o,c),h===0?Ai(c):h===512?Go(c):x("Invalid flags passed to unlinkat"),0}catch(g){if(typeof Je>"u"||!(g instanceof H))throw g;return-g.Ka}},o:function(o,c,h){try{if(c=Qe(c),c=Jn(o,c,!0),h){var g=ks(h),E=we[h+8>>2];D=1e3*g+E/1e6,h+=16,g=ks(h),E=we[h+8>>2],Q=1e3*g+E/1e6}else var D=Date.now(),Q=D;o=D;var ve=Bt(c,{Sa:!0}).node;return ve.Ga.Oa(ve,{timestamp:Math.max(o,Q)}),0}catch(Pe){if(typeof Je>"u"||!(Pe instanceof H))throw Pe;return-Pe.Ka}},e:function(){return Date.now()},j:function(o,c){o=new Date(1e3*ks(o)),we[c>>2]=o.getSeconds(),we[c+4>>2]=o.getMinutes(),we[c+8>>2]=o.getHours(),we[c+12>>2]=o.getDate(),we[c+16>>2]=o.getMonth(),we[c+20>>2]=o.getFullYear()-1900,we[c+24>>2]=o.getDay();var h=new Date(o.getFullYear(),0,1);we[c+28>>2]=(o.getTime()-h.getTime())/864e5|0,we[c+36>>2]=-(60*o.getTimezoneOffset());var g=new Date(o.getFullYear(),6,1).getTimezoneOffset();h=h.getTimezoneOffset(),we[c+32>>2]=(g!=h&&o.getTimezoneOffset()==Math.min(h,g))|0},w:function(o,c,h,g,E,D){try{var Q=yn(g);if(c&2&&!(h&2)&&(Q.flags&2097155)!==2)throw new H(2);if((Q.flags&2097155)===1)throw new H(2);if(!Q.Ha.bb)throw new H(43);var ve=Q.Ha.bb(Q,o,E,c,h),Pe=ve.Fb;return we[D>>2]=ve.vb,Pe}catch(De){if(typeof Je>"u"||!(De instanceof H))throw De;return-De.Ka}},x:function(o,c,h,g,E,D){try{var Q=yn(E);if(h&2){var ve=Oe.slice(o,o+c);Q&&Q.Ha.cb&&Q.Ha.cb(Q,ve,D,c,g)}}catch(Pe){if(typeof Je>"u"||!(Pe instanceof H))throw Pe;return-Pe.Ka}},n:Rs,q:function(){return 2147483648},d:ea,c:function(o){var c=Oe.length;if(o>>>=0,2147483648=h;h*=2){var g=c*(1+.2/h);g=Math.min(g,o+100663296);var E=Math;g=Math.max(o,g),E=E.min.call(E,2147483648,g+(65536-g%65536)%65536);e:{try{tt.grow(E-wt.byteLength+65535>>>16),Es();var D=1;break e}catch{}D=void 0}if(D)return!0}return!1},z:function(o,c){var h=0;return ta().forEach(function(g,E){var D=c+h;for(E=Re[o+4*E>>2]=D,D=0;D>0]=g.charCodeAt(D);ge[E>>0]=0,h+=g.length+1}),0},A:function(o,c){var h=ta();Re[o>>2]=h.length;var g=0;return h.forEach(function(E){g+=E.length+1}),Re[c>>2]=g,0},f:function(o){try{var c=yn(o);return He(c),0}catch(h){if(typeof Je>"u"||!(h instanceof H))throw h;return h.Ka}},m:function(o,c){try{var h=yn(o);return ge[c>>0]=h.tty?2:(h.mode&61440)===16384?3:(h.mode&61440)===40960?7:4,0}catch(g){if(typeof Je>"u"||!(g instanceof H))throw g;return g.Ka}},u:function(o,c,h,g){try{e:{var E=yn(o);o=c;for(var D=c=0;D>2],ve=Re[o+4>>2];o+=8;var Pe=Ti(E,ge,Q,ve);if(0>Pe){var De=-1;break e}if(c+=Pe,Pe>2]=De,0}catch(ct){if(typeof Je>"u"||!(ct instanceof H))throw ct;return ct.Ka}},k:function(o,c,h,g,E){try{if(c=h+2097152>>>0<4194305-!!c?(c>>>0)+4294967296*h:NaN,isNaN(c))return 61;var D=yn(o);return Gr(D,c,g),z=[D.position>>>0,(j=D.position,1<=+Math.abs(j)?0>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],we[E>>2]=z[0],we[E+4>>2]=z[1],D.hb&&c===0&&g===0&&(D.hb=null),0}catch(Q){if(typeof Je>"u"||!(Q instanceof H))throw Q;return Q.Ka}},C:function(o){try{var c=yn(o);return c.Ha&&c.Ha.fsync?c.Ha.fsync(c):0}catch(h){if(typeof Je>"u"||!(h instanceof H))throw h;return h.Ka}},r:function(o,c,h,g){try{e:{var E=yn(o);o=c;for(var D=c=0;D>2],ve=Re[o+4>>2];o+=8;var Pe=wr(E,ge,Q,ve);if(0>Pe){var De=-1;break e}c+=Pe}De=c}return Re[g>>2]=De,0}catch(ct){if(typeof Je>"u"||!(ct instanceof H))throw ct;return ct.Ka}}};(function(){function o(E){d.asm=E.exports,tt=d.asm.I,Es(),En=d.asm.Aa,fe.unshift(d.asm.J),Jt--,d.monitorRunDependencies&&d.monitorRunDependencies(Jt),Jt==0&&Ke&&(E=Ke,Ke=null,E())}function c(E){o(E.instance)}function h(E){return ee().then(function(D){return WebAssembly.instantiate(D,g)}).then(function(D){return D}).then(E,function(D){_e("failed to asynchronously prepare wasm: "+D),x(D)})}var g={a:xu};if(Jt++,d.monitorRunDependencies&&d.monitorRunDependencies(Jt),d.instantiateWasm)try{return d.instantiateWasm(g,o)}catch(E){return _e("Module.instantiateWasm callback failed with error: "+E),!1}return function(){return xe||typeof WebAssembly.instantiateStreaming!="function"||O()||R.startsWith("file://")||Z||typeof fetch!="function"?h(c):fetch(R,{credentials:"same-origin"}).then(function(E){return WebAssembly.instantiateStreaming(E,g).then(c,function(D){return _e("wasm streaming compile failed: "+D),_e("falling back to ArrayBuffer instantiation"),h(c)})})}(),{}})(),d.___wasm_call_ctors=function(){return(d.___wasm_call_ctors=d.asm.J).apply(null,arguments)},d._sqlite3_free=function(){return(d._sqlite3_free=d.asm.K).apply(null,arguments)},d._sqlite3_value_double=function(){return(d._sqlite3_value_double=d.asm.L).apply(null,arguments)},d._sqlite3_value_text=function(){return(d._sqlite3_value_text=d.asm.M).apply(null,arguments)};var ra=d.___errno_location=function(){return(ra=d.___errno_location=d.asm.N).apply(null,arguments)};d._sqlite3_prepare_v2=function(){return(d._sqlite3_prepare_v2=d.asm.O).apply(null,arguments)},d._sqlite3_step=function(){return(d._sqlite3_step=d.asm.P).apply(null,arguments)},d._sqlite3_finalize=function(){return(d._sqlite3_finalize=d.asm.Q).apply(null,arguments)},d._sqlite3_reset=function(){return(d._sqlite3_reset=d.asm.R).apply(null,arguments)},d._sqlite3_value_int=function(){return(d._sqlite3_value_int=d.asm.S).apply(null,arguments)},d._sqlite3_clear_bindings=function(){return(d._sqlite3_clear_bindings=d.asm.T).apply(null,arguments)},d._sqlite3_value_blob=function(){return(d._sqlite3_value_blob=d.asm.U).apply(null,arguments)},d._sqlite3_value_bytes=function(){return(d._sqlite3_value_bytes=d.asm.V).apply(null,arguments)},d._sqlite3_value_type=function(){return(d._sqlite3_value_type=d.asm.W).apply(null,arguments)},d._sqlite3_result_blob=function(){return(d._sqlite3_result_blob=d.asm.X).apply(null,arguments)},d._sqlite3_result_double=function(){return(d._sqlite3_result_double=d.asm.Y).apply(null,arguments)},d._sqlite3_result_error=function(){return(d._sqlite3_result_error=d.asm.Z).apply(null,arguments)},d._sqlite3_result_int=function(){return(d._sqlite3_result_int=d.asm._).apply(null,arguments)},d._sqlite3_result_int64=function(){return(d._sqlite3_result_int64=d.asm.$).apply(null,arguments)},d._sqlite3_result_null=function(){return(d._sqlite3_result_null=d.asm.aa).apply(null,arguments)},d._sqlite3_result_text=function(){return(d._sqlite3_result_text=d.asm.ba).apply(null,arguments)},d._sqlite3_sql=function(){return(d._sqlite3_sql=d.asm.ca).apply(null,arguments)},d._sqlite3_aggregate_context=function(){return(d._sqlite3_aggregate_context=d.asm.da).apply(null,arguments)},d._sqlite3_column_count=function(){return(d._sqlite3_column_count=d.asm.ea).apply(null,arguments)},d._sqlite3_data_count=function(){return(d._sqlite3_data_count=d.asm.fa).apply(null,arguments)},d._sqlite3_column_blob=function(){return(d._sqlite3_column_blob=d.asm.ga).apply(null,arguments)},d._sqlite3_column_bytes=function(){return(d._sqlite3_column_bytes=d.asm.ha).apply(null,arguments)},d._sqlite3_column_double=function(){return(d._sqlite3_column_double=d.asm.ia).apply(null,arguments)},d._sqlite3_column_text=function(){return(d._sqlite3_column_text=d.asm.ja).apply(null,arguments)},d._sqlite3_column_type=function(){return(d._sqlite3_column_type=d.asm.ka).apply(null,arguments)},d._sqlite3_column_name=function(){return(d._sqlite3_column_name=d.asm.la).apply(null,arguments)},d._sqlite3_bind_blob=function(){return(d._sqlite3_bind_blob=d.asm.ma).apply(null,arguments)},d._sqlite3_bind_double=function(){return(d._sqlite3_bind_double=d.asm.na).apply(null,arguments)},d._sqlite3_bind_int=function(){return(d._sqlite3_bind_int=d.asm.oa).apply(null,arguments)},d._sqlite3_bind_text=function(){return(d._sqlite3_bind_text=d.asm.pa).apply(null,arguments)},d._sqlite3_bind_parameter_index=function(){return(d._sqlite3_bind_parameter_index=d.asm.qa).apply(null,arguments)},d._sqlite3_normalized_sql=function(){return(d._sqlite3_normalized_sql=d.asm.ra).apply(null,arguments)},d._sqlite3_errmsg=function(){return(d._sqlite3_errmsg=d.asm.sa).apply(null,arguments)},d._sqlite3_exec=function(){return(d._sqlite3_exec=d.asm.ta).apply(null,arguments)},d._sqlite3_changes=function(){return(d._sqlite3_changes=d.asm.ua).apply(null,arguments)},d._sqlite3_close_v2=function(){return(d._sqlite3_close_v2=d.asm.va).apply(null,arguments)},d._sqlite3_create_function_v2=function(){return(d._sqlite3_create_function_v2=d.asm.wa).apply(null,arguments)},d._sqlite3_open=function(){return(d._sqlite3_open=d.asm.xa).apply(null,arguments)};var Bi=d._malloc=function(){return(Bi=d._malloc=d.asm.ya).apply(null,arguments)},Fi=d._free=function(){return(Fi=d._free=d.asm.za).apply(null,arguments)};d._RegisterExtensionFunctions=function(){return(d._RegisterExtensionFunctions=d.asm.Ba).apply(null,arguments)};var ia=d._emscripten_builtin_memalign=function(){return(ia=d._emscripten_builtin_memalign=d.asm.Ca).apply(null,arguments)},Zr=d.stackSave=function(){return(Zr=d.stackSave=d.asm.Da).apply(null,arguments)},ei=d.stackRestore=function(){return(ei=d.stackRestore=d.asm.Ea).apply(null,arguments)},Xn=d.stackAlloc=function(){return(Xn=d.stackAlloc=d.asm.Fa).apply(null,arguments)};d.UTF8ToString=Qe,d.stackAlloc=Xn,d.stackSave=Zr,d.stackRestore=ei,d.cwrap=function(o,c,h,g){h=h||[];var E=h.every(D=>D==="number"||D==="boolean");return c!=="string"&&E&&!g?d["_"+o]:function(){return _u(o,c,h,arguments)}};var Ui;Ke=function o(){Ui||sa(),Ui||(Ke=o)};function sa(){function o(){if(!Ui&&(Ui=!0,d.calledRun=!0,!ze)){if(d.noFSInit||ki||(ki=!0,Si(),d.stdin=d.stdin,d.stdout=d.stdout,d.stderr=d.stderr,d.stdin?Ln("stdin",d.stdin):As("/dev/tty","/dev/stdin"),d.stdout?Ln("stdout",null,d.stdout):As("/dev/tty","/dev/stdout"),d.stderr?Ln("stderr",null,d.stderr):As("/dev/tty1","/dev/stderr"),yr("/dev/stdin",0),yr("/dev/stdout",1),yr("/dev/stderr",1)),Os=!1,re(fe),d.onRuntimeInitialized&&d.onRuntimeInitialized(),d.postRun)for(typeof d.postRun=="function"&&(d.postRun=[d.postRun]);d.postRun.length;){var c=d.postRun.shift();Me.unshift(c)}re(Me)}}if(!(0=this._size)return 0;const i=this._data.subarray(e,Math.min(this._size,e+n.length));return n.set(i),i.length}reserve(e){if(this._data.length>=e)return;const n=e-this._data.length,i=Math.min(rN,Math.max(nN,this._data.length)),a=new Uint8Array(this._data.length+Math.max(i,n));a.set(this._data),this._data=a}write(e,n){return this.reserve(e+n.length),this._data.set(n,e),this._size=Math.max(this._size,e+n.length),n.length}truncate(e){this._size=e}toUint8Array(){return this._data.subarray(0,this._size)}}const sN=self.indexedDB||window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB||window.shimIndexedDB,Gf=new Promise((t,e)=>{const n=sN.open(tN,1);n.onupgradeneeded=()=>n.result.createObjectStore("files",{keyPath:"name"}),n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error)});async function oN(t){const e=await Gf,n=await new Promise((i,a)=>{const m=e.transaction("files","readonly").objectStore("files").get(t);m.onsuccess=()=>i(m.result),m.onerror=()=>a(m.error)});if(n&&!Gs.has(t)){const i=new iN(n.data);return Gs.set(t,i),i}else return Gs.has(t)?Gs.get(t):null}async function aN(t,e){const n=await Gf;await new Promise((i,a)=>{const m=n.transaction("files","readwrite").objectStore("files").put({name:t,data:e});m.onsuccess=()=>i(!0),m.onerror=()=>a(m.error)})}async function zh(t){const e=await Gf;await new Promise((n,i)=>{const l=e.transaction("files","readwrite").objectStore("files").delete(t);l.onsuccess=()=>n(!0),l.onerror=()=>i(l.error)})}async function uN(t,e){if(await aN(t,e),Gs.has(t)){const n=Gs.get(t);n.truncate(0),n.write(0,e)}}var cN=t=>t==null||typeof t=="bigint"||typeof t=="number"||typeof t=="object"&&"buffer"in t?t:typeof t=="boolean"?`${t}`:t instanceof Date?t.toISOString():JSON.stringify(t),lN=t=>{if(t==null||typeof t=="bigint"||typeof t=="number"||typeof t=="object"&&"buffer"in t)return t;if(typeof t=="string"){const e=/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?Z?$/;if(/^(true|false)$/.test(t))return t==="true";if(e.test(t))return new Date(t);try{return JSON.parse(t,(n,i)=>typeof i=="string"&&e.exec(i)?new Date(i):i)}catch{}}return t},ps,dd,fN=(dd=class extends Vf{constructor(e){super();S(this,ps,void 0);P(this,ps,e||cN)}transformPrimitiveValueList(e){return{...e,values:e.values.map(r(this,ps))}}transformColumnUpdate(e){const{value:n}=e;if(n.kind!=="ValueNode")return super.transformColumnUpdate(e);const{value:i,...a}=n,l=r(this,ps).call(this,i);return i===l?super.transformColumnUpdate(e):super.transformColumnUpdate({...e,value:{...a,value:l}})}transformValue(e){return{...e,value:r(this,ps).call(this,e.value)}}},ps=new WeakMap,dd),ou,au,qo,pd,hN=(pd=class{constructor(t={}){S(this,ou,void 0);S(this,au,void 0);S(this,qo,void 0);P(this,ou,new fN(t.serializer)),P(this,au,t.deserializer||lN),P(this,qo,new WeakMap)}transformQuery(t){const{node:e,queryId:n}=t;return e.kind==="SelectQueryNode"&&r(this,qo).set(n,e.kind),r(this,ou).transformNode(t.node)}async parseResult(t){return await Promise.all(t.map(async e=>{const n={...e};for(const i in n)n[i]=await r(this,au).call(this,n[i]);return n}))}async transformResult(t){const{result:e,queryId:n}=t,{rows:i}=e,a=r(this,qo).get(n);return i&&a==="SelectQueryNode"?{...t.result,rows:await this.parseResult(i)}:t.result}},ou=new WeakMap,au=new WeakMap,qo=new WeakMap,pd);function Ul(t){return typeof t=="string"}function dN(t){return typeof t=="boolean"}async function Kh(t,e,n,i,a="rowid"){await kn` + create trigger if not exists ${kn.raw(e)}_${kn.raw(i)} + after ${kn.raw(n)} + on ${kn.table(e)} + begin + update ${kn.table(e)} + set ${kn.ref(i)} = datetime('now','localtime') + where ${kn.ref(a)} = NEW.${kn.ref(a)}; + end + `.execute(t).catch(l=>{console.error(l)})}function pN(t){const e=new Map;for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const i=t[n];e.set(n,i)}return e}async function mN(t,e,n=!1){for(const[i,a]of e){const{columns:l,property:m}=a;n&&await t.schema.dropTable(i).ifExists().execute().catch();let w=t.schema.createTable(i),v="rowid",d=!1,W="createAt",F="updateAt";if(m!=null&&m.timestamp&&!dN(m.timestamp)){const{create:U,update:Y}=m.timestamp;W=U??"createAt",F=Y??"updateAt"}for(const U in l){if(!Object.prototype.hasOwnProperty.call(l,U))continue;const Y=l[U];let Z="text";const{type:b,notNull:C,defaultTo:N}=Y;switch(b){case"boolean":case"date":case"object":case"string":Z="text";break;case"increments":v=U;case"number":Z="integer";break;case"blob":Z="blob"}[W,F].includes(U)||(w=w.addColumn(U,Z,q=>b==="increments"?(d=!0,q.autoIncrement().primaryKey()):(C&&(q=q.notNull()),N!==void 0&&(q=q.defaultTo(N instanceof Function?N(kn):N)),q)))}if(m){const U=m.primary,Y=m.unique;if(m.timestamp&&(W&&(w=w.addColumn(W,"text")),F&&(w=w.addColumn(F,"text"))),!d&&U){const Z=Ul(U);v=Z?U:U[0],w=w.addPrimaryKeyConstraint(`pk_${Z?U:U.join("_")}`,Z?[U]:U)}Y==null||Y.forEach(Z=>{const b=Ul(Z);v=!U&&!d?b?Z:Z[0]:v,w=w.addUniqueConstraint(`un_${b?Z:Z.join("_")}`,b?[Z]:Z)})}if(await w.ifNotExists().execute(),m!=null&&m.index)for(const U of m.index){const Y=Ul(U);let Z=t.schema.createIndex(`idx_${Y?U:U.join("_")}`).on(i);Z=Y?Z.column(U):Z.columns(U),await Z.ifNotExists().execute()}m!=null&&m.timestamp&&(W&&await Kh(t,i,"insert",W,v),F&&await Kh(t,i,"update",F,v))}}var mi,uu,md,yN=(md=class{constructor(t){Yt(this,"kysely");S(this,mi,void 0);S(this,uu,void 0);const{dialect:e,tables:n,dropTableBeforeInit:i,onError:a,onQuery:l,plugins:m}=t,w=m??[];w.push(new hN),this.kysely=new $a({dialect:e,log:v=>{v.level==="error"?a&&a(v.error):l&&l(v.query,v.queryDurationMillis)},plugins:w}),P(this,mi,i?0:1),P(this,uu,pN(n))}async init(t=!1){const e=t||r(this,mi)===0;return await mN(this.kysely,r(this,uu),e),P(this,mi,2),this}async checkInit(){if(r(this,mi)!==2&&await this.init(),r(this,mi)!==2)throw new Error("fail to init table")}async transaction(t,e=!1){return await this.checkInit(),await this.kysely.transaction().execute(t).catch(n=>{e&&console.error(n)})}async exec(t,e=!1){return await this.checkInit(),t(this.kysely).catch(n=>{e&&console.error(n)})}async toSQL(t){return await this.checkInit(),t(this.kysely).compile()}async raw(t){return await this.checkInit(),t(kn).execute(this.kysely)}},mi=new WeakMap,uu=new WeakMap,md);async function Xf(t){const e=await new yN({dialect:t,tables:{test:{columns:{id:{type:"increments"},name:{type:"string"},blobtest:{type:"blob"},createAt:{type:"date"},updateAt:{type:"date"}},property:{timestamp:!0}}}}).init();console.log("test"),console.log(await e.raw(n=>n`PRAGMA table_info(${n.table("test")});`)),console.log(await e.raw(n=>n`select last_insert_rowid()`));for(let n=0;n<100;n++)await e.transaction(i=>i.insertInto("test").values({name:`test at ${Date.now()}`,blobtest:Uint8Array.from([2,3,4,5,6,7,8])}).execute());return e.exec(n=>n.selectFrom("test").selectAll().execute())}const wN=new jb({async database(){const t=await Zb({locateFile:()=>eN});return new t.Database(await oN("sqljs"))},onWrite:{func(t){console.log(`[sqljs] write to indexeddb, length: ${t.length}`),uN("sqljs",t)},isThrottle:!0}});function gN(){const t=Ny();function e(){Xf(wN).then(n=>{t.value=n})}return{result:t,run:e}}function bN(){return new Worker(""+new URL("sqljsWorker-9211ff35.js",import.meta.url).href)}function NN(){return new Worker(""+new URL("officialWasmWorker-f13be864.js",import.meta.url).href)}const Ve=0,vN=5,xt=10,gm=12,bm=14,Vi=21,$l=25,_N=27,Jh=100,xN=101,EN=3850,CN=522,ON=1,qN=2,Nm=4,WN=8,Hs=0,Yi=1,ic=2,IN=3,sc=4,AN=512,TN=1024,SN=2048,kN=16384,Gh=1,Xh=2,Yh=3,Zh=4,ed=5,td=0x7fffffffffffffffn,nd=-0x8000000000000000n;class kr extends Error{constructor(e,n){super(e),this.code=n}}const js=!0;function RN(t){const e={},n=t._getSqliteFree(),i=t._malloc(8),a=[i,i+4];function l(b){if(typeof b!="string")return 0;const C=t.lengthBytesUTF8(b),N=t._sqlite3_malloc(C+1);return t.stringToUTF8(b,N,C+1),N}function m(b,C){return BigInt(C)<<32n|BigInt(b)&0xffffffffn}const w=function(){const b=BigInt(Number.MAX_SAFE_INTEGER)>>32n,C=BigInt(Number.MIN_SAFE_INTEGER)>>32n;return function(N,q){return q>b||q2147483647||T<-2147483648)return $l;const ne=C(N,q,T);return Z(b,ne,W.get(N))}}(),e.bind_int64=function(){const b="sqlite3_bind_int64",C=t.cwrap(b,...Ce("nnnn:n"));return function(N,q,T){if(F(N),T>td||T>32n,ae=C(N,q,Number(ne),Number(Ne));return Z(b,ae,W.get(N))}}(),e.bind_null=function(){const b="sqlite3_bind_null",C=t.cwrap(b,...Ce("nn:n"));return function(N,q){F(N);const T=C(N,q);return Z(b,T,W.get(N))}}(),e.bind_parameter_name=function(){const b="sqlite3_bind_parameter_name",C=t.cwrap(b,...Ce("n:s"));return function(N,q){return F(N),C(N,q)}}(),e.bind_text=function(){const b="sqlite3_bind_text",C=t.cwrap(b,...Ce("nnnnn:n"));return function(N,q,T){F(N);const ne=l(T),Ne=C(N,q,ne,-1,n);return Z(b,Ne,W.get(N))}}(),e.changes=function(){const b="sqlite3_changes",C=t.cwrap(b,...Ce("n:n"));return function(N){return d(N),C(N)}}(),e.close=function(){const b="sqlite3_close",C=t.cwrap(b,...Ce("n:n"),{async:js});return async function(N){d(N);const q=await C(N);return v.delete(N),Z(b,q,N)}}(),e.column=function(b,C){F(b);const N=e.column_type(b,C);switch(N){case Zh:return e.column_blob(b,C);case Xh:return e.column_double(b,C);case Gh:const q=e.column_int(b,C),T=t.getTempRet0();return w(q,T);case ed:return null;case Yh:return e.column_text(b,C);default:throw new kr("unknown type",N)}},e.column_blob=function(){const b="sqlite3_column_blob",C=t.cwrap(b,...Ce("nn:n"));return function(N,q){F(N);const T=e.column_bytes(N,q),ne=C(N,q);return t.HEAPU8.subarray(ne,ne+T)}}(),e.column_bytes=function(){const b="sqlite3_column_bytes",C=t.cwrap(b,...Ce("nn:n"));return function(N,q){return F(N),C(N,q)}}(),e.column_count=function(){const b="sqlite3_column_count",C=t.cwrap(b,...Ce("n:n"));return function(N){return F(N),C(N)}}(),e.column_double=function(){const b="sqlite3_column_double",C=t.cwrap(b,...Ce("nn:n"));return function(N,q){return F(N),C(N,q)}}(),e.column_int=function(){const b="sqlite3_column_int64",C=t.cwrap(b,...Ce("nn:n"));return function(N,q){return F(N),C(N,q)}}(),e.column_int64=function(){const b="sqlite3_column_int64",C=t.cwrap(b,...Ce("nn:n"));return function(N,q){F(N);const T=C(N,q),ne=t.getTempRet0();return m(T,ne)}}(),e.column_name=function(){const b="sqlite3_column_name",C=t.cwrap(b,...Ce("nn:s"));return function(N,q){return F(N),C(N,q)}}(),e.column_names=function(b){const C=[],N=e.column_count(b);for(let q=0;qtd||q>32n;C(N,Number(T),Number(ne))}}(),e.result_null=function(){const b="sqlite3_result_null",C=t.cwrap(b,...Ce("n:n"));return function(N){C(N)}}(),e.result_text=function(){const b="sqlite3_result_text",C=t.cwrap(b,...Ce("nnnn:n"));return function(N,q){const T=l(q);C(N,T,-1,n)}}(),e.row=function(b){const C=[],N=e.data_count(b);for(let q=0;q{var t=import.meta.url;return function(e={}){var n;n||(n=typeof e<"u"?e:{});var i,a;n.ready=new Promise((s,u)=>{i=s,a=u});var l=Object.assign({},n),m="./this.program",w=(s,u)=>{throw u},v=typeof window=="object",d=typeof importScripts=="function",W="",F;(v||d)&&(d?W=self.location.href:typeof document<"u"&&document.currentScript&&(W=document.currentScript.src),t&&(W=t),W.indexOf("blob:")!==0?W=W.substr(0,W.replace(/[?#].*/,"").lastIndexOf("/")+1):W="",d&&(F=s=>{var u=new XMLHttpRequest;return u.open("GET",s,!1),u.responseType="arraybuffer",u.send(null),new Uint8Array(u.response)}));var U=n.print||console.log.bind(console),Y=n.printErr||console.warn.bind(console);Object.assign(n,l),l=null,n.thisProgram&&(m=n.thisProgram),n.quit&&(w=n.quit);var Z;n.wasmBinary&&(Z=n.wasmBinary);var b=n.noExitRuntime||!0;typeof WebAssembly!="object"&&ut("no native wasm support detected");var C,N=!1,q,T,ne,Ne,ae,_e,xe,tt;function ze(){var s=C.buffer;n.HEAP8=T=new Int8Array(s),n.HEAP16=Ne=new Int16Array(s),n.HEAP32=ae=new Int32Array(s),n.HEAPU8=ne=new Uint8Array(s),n.HEAPU16=new Uint16Array(s),n.HEAPU32=_e=new Uint32Array(s),n.HEAPF32=xe=new Float32Array(s),n.HEAPF64=tt=new Float64Array(s)}var qt=[],Wt=[],Qe=[],Kt=[],dn=0;function wt(){var s=n.preRun.shift();qt.unshift(s)}var ge=0,Oe=null;function ut(s){throw n.onAbort&&n.onAbort(s),s="Aborted("+s+")",Y(s),N=!0,q=1,s=new WebAssembly.RuntimeError(s+". Build with -sASSERTIONS for more info."),a(s),s}function we(s){return s.startsWith("data:application/octet-stream;base64,")}var Re;if(n.locateFile){if(Re="wa-sqlite-async.wasm",!we(Re)){var Pt=Re;Re=n.locateFile?n.locateFile(Pt,W):W+Pt}}else Re=new URL(""+new URL("wa-sqlite-async-24800831.wasm",import.meta.url).href,self.location).href;function Ar(s){try{if(s==Re&&Z)return new Uint8Array(Z);if(F)return F(s);throw"both async and sync fetching of the wasm failed"}catch(u){ut(u)}}function Es(s){return Z||!v&&!d||typeof fetch!="function"?Promise.resolve().then(()=>Ar(s)):fetch(s,{credentials:"same-origin"}).then(u=>{if(!u.ok)throw"failed to load wasm binary file at '"+s+"'";return u.arrayBuffer()}).catch(()=>Ar(s))}function En(s,u,f){return Es(s).then(y=>WebAssembly.instantiate(y,u)).then(y=>y).then(f,y=>{Y("failed to asynchronously prepare wasm: "+y),ut(y)})}function pn(s,u){var f=Re;return Z||typeof WebAssembly.instantiateStreaming!="function"||we(f)||typeof fetch!="function"?En(f,s,u):fetch(f,{credentials:"same-origin"}).then(y=>WebAssembly.instantiateStreaming(y,s).then(u,function(_){return Y("wasm streaming compile failed: "+_),Y("falling back to ArrayBuffer instantiation"),En(f,s,u)}))}var fe,Me;function zn(s){this.name="ExitStatus",this.message="Program terminated with exit("+s+")",this.status=s}function Jt(s){for(;0>0];case"i8":return T[s>>0];case"i16":return Ne[s>>1];case"i32":return ae[s>>2];case"i64":return ae[s>>2];case"float":return xe[s>>2];case"double":return tt[s>>3];case"*":return _e[s>>2];default:ut("invalid type for getValue: "+u)}}function x(s,u,f="i8"){switch(f.endsWith("*")&&(f="*"),f){case"i1":T[s>>0]=u;break;case"i8":T[s>>0]=u;break;case"i16":Ne[s>>1]=u;break;case"i32":ae[s>>2]=u;break;case"i64":Me=[u>>>0,(fe=u,1<=+Math.abs(fe)?0>>0:~~+Math.ceil((fe-+(~~fe>>>0))/4294967296)>>>0:0)],ae[s>>2]=Me[0],ae[s+4>>2]=Me[1];break;case"float":xe[s>>2]=u;break;case"double":tt[s>>3]=u;break;case"*":_e[s>>2]=u;break;default:ut("invalid type for setValue: "+f)}}var O=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function R(s,u,f){var y=u+f;for(f=u;s[f]&&!(f>=y);)++f;if(16_?y+=String.fromCharCode(_):(_-=65536,y+=String.fromCharCode(55296|_>>10,56320|_&1023))}}else y+=String.fromCharCode(_)}return y}function M(s,u){return s?R(ne,s,u):""}var K=(s,u)=>{for(var f=0,y=s.length-1;0<=y;y--){var _=s[y];_==="."?s.splice(y,1):_===".."?(s.splice(y,1),f++):f&&(s.splice(y,1),f--)}if(u)for(;f;f--)s.unshift("..");return s},ee=s=>{var u=s.charAt(0)==="/",f=s.substr(-1)==="/";return(s=K(s.split("/").filter(y=>!!y),!u).join("/"))||u||(s="."),s&&f&&(s+="/"),(u?"/":"")+s},j=s=>{var u=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(s).slice(1);return s=u[0],u=u[1],!s&&!u?".":(u&&(u=u.substr(0,u.length-1)),s+u)},z=s=>{if(s==="/")return"/";s=ee(s),s=s.replace(/\/$/,"");var u=s.lastIndexOf("/");return u===-1?s:s.substr(u+1)};function re(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return s=>crypto.getRandomValues(s);ut("initRandomDevice")}function J(s){return(J=re())(s)}function ce(){for(var s="",u=!1,f=arguments.length-1;-1<=f&&!u;f--){if(u=0<=f?arguments[f]:"/",typeof u!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!u)return"";s=u+"/"+s,u=u.charAt(0)==="/"}return s=K(s.split("/").filter(y=>!!y),!u).join("/"),(u?"/":"")+s||"."}function oe(s){for(var u=0,f=0;f=y?u++:2047>=y?u+=2:55296<=y&&57343>=y?(u+=4,++f):u+=3}return u}function ue(s,u,f,y){if(!(0=A){var V=s.charCodeAt(++k);A=65536+((A&1023)<<10)|V&1023}if(127>=A){if(f>=y)break;u[f++]=A}else{if(2047>=A){if(f+1>=y)break;u[f++]=192|A>>6}else{if(65535>=A){if(f+2>=y)break;u[f++]=224|A>>12}else{if(f+3>=y)break;u[f++]=240|A>>18,u[f++]=128|A>>12&63}u[f++]=128|A>>6&63}u[f++]=128|A&63}}return u[f]=0,f-_}var be=[];function Ee(s,u){be[s]={input:[],Rb:[],bc:u},Ws(s,je)}var je={open:function(s){var u=be[s.node.ec];if(!u)throw new te(43);s.Sb=u,s.seekable=!1},close:function(s){s.Sb.bc.ic(s.Sb)},ic:function(s){s.Sb.bc.ic(s.Sb)},read:function(s,u,f,y){if(!s.Sb||!s.Sb.bc.zc)throw new te(60);for(var _=0,k=0;k=u||(u=Math.max(u,f*(1048576>f?2:1.125)>>>0),f!=0&&(u=Math.max(u,256)),f=s.Nb,s.Nb=new Uint8Array(u),0=s.node.Pb)return 0;if(s=Math.min(s.node.Pb-_,y),8u)throw new te(28);return u},vc:function(s,u,f){me.xc(s.node,u+f),s.node.Pb=Math.max(s.node.Pb,u+f)},kc:function(s,u,f,y,_){if((s.node.mode&61440)!==32768)throw new te(43);if(s=s.node.Nb,_&2||s.buffer!==T.buffer){if((0{if(s=ce(s),!s)return{path:"",node:null};if(u=Object.assign({yc:!0,tc:0},u),8!!A);for(var f=Cn,y="/",_=0;_{for(var u;;){if(s===s.parent)return s=s.Ub.Ac,u?s[s.length-1]!=="/"?s+"/"+u:s+u:s;u=u?s.name+"/"+u:s.name,s=s.parent}},Os=(s,u)=>{for(var f=0,y=0;y>>0)%le.length},H=s=>{var u=Os(s.parent.id,s.name);if(le[u]===s)le[u]=s.ac;else for(u=le[u];u;){if(u.ac===s){u.ac=s.ac;break}u=u.ac}},Kn=(s,u)=>{var f;if(f=(f=Tr(s,"x"))?f:s.Cb.cc?0:2)throw new te(f,s);for(f=le[Os(s.id,u)];f;f=f.ac){var y=f.name;if(f.parent.id===s.id&&y===u)return f}return s.Cb.cc(s,u)},Bt=(s,u,f,y)=>(s=new Tu(s,u,f,y),u=Os(s.parent.id,s.name),s.ac=le[u],le[u]=s),Oi={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},qs=s=>{var u=["r","w","rw"][s&3];return s&512&&(u+="w"),u},Tr=(s,u)=>{if(Mt)return 0;if(!u.includes("r")||s.mode&292){if(u.includes("w")&&!(s.mode&146)||u.includes("x")&&!(s.mode&73))return 2}else return 2;return 0},mr=(s,u)=>{try{return Kn(s,u),20}catch{}return Tr(s,"wx")},Ho=(s,u,f)=>{try{var y=Kn(s,u)}catch(_){return _.Ob}if(s=Tr(s,"wx"))return s;if(f){if((y.mode&61440)!==16384)return 54;if(y===y.parent||On(y)==="/")return 10}else if((y.mode&61440)===16384)return 31;return 0},Cl=(s=0)=>{for(;4096>=s;s++)if(!Gt[s])return s;throw new te(33)},Vo=(s,u)=>(Gr||(Gr=function(){this.hc={}},Gr.prototype={},Object.defineProperties(Gr.prototype,{object:{get:function(){return this.node},set:function(f){this.node=f}},flags:{get:function(){return this.hc.flags},set:function(f){this.hc.flags=f}},position:{get:function(){return this.hc.position},set:function(f){this.hc.position=f}}})),s=Object.assign(new Gr,s),u=Cl(u),s.Wb=u,Gt[u]=s),zr={open:s=>{s.Mb=Ci[s.node.ec].Mb,s.Mb.open&&s.Mb.open(s)},Zb:()=>{throw new te(70)}},Ws=(s,u)=>{Ci[s]={Mb:u}},zo=(s,u)=>{var f=u==="/",y=!u;if(f&&Cn)throw new te(10);if(!f&&!y){var _=Xt(u,{yc:!1});if(u=_.path,_=_.node,_.$b)throw new te(10);if((_.mode&61440)!==16384)throw new te(54)}u={type:s,Wc:{},Ac:u,Mc:[]},s=s.Ub(u),s.Ub=u,u.root=s,f?Cn=s:_&&(_.$b=u,_.Ub&&_.Ub.Mc.push(u))},Ko=(s,u,f)=>{var y=Xt(s,{parent:!0}).node;if(s=z(s),!s||s==="."||s==="..")throw new te(28);var _=mr(y,s);if(_)throw new te(_);if(!y.Cb.jc)throw new te(63);return y.Cb.jc(y,s,u,f)},qn=(s,u)=>Ko(s,(u!==void 0?u:511)&1023|16384,0),Is=(s,u,f)=>{typeof f>"u"&&(f=u,u=438),Ko(s,u|8192,f)},qi=(s,u)=>{if(!ce(s))throw new te(44);var f=Xt(u,{parent:!0}).node;if(!f)throw new te(44);u=z(u);var y=mr(f,u);if(y)throw new te(y);if(!f.Cb.nc)throw new te(63);f.Cb.nc(f,u,s)},Jo=s=>{var u=Xt(s,{parent:!0}).node;s=z(s);var f=Kn(u,s),y=Ho(u,s,!0);if(y)throw new te(y);if(!u.Cb.mc)throw new te(63);if(f.$b)throw new te(10);u.Cb.mc(u,s),H(f)},Wi=s=>{if(s=Xt(s).node,!s)throw new te(44);if(!s.Cb.fc)throw new te(28);return ce(On(s.parent),s.Cb.fc(s))},an=(s,u)=>{if(s=Xt(s,{Yb:!u}).node,!s)throw new te(44);if(!s.Cb.Tb)throw new te(63);return s.Cb.Tb(s)},Ii=s=>an(s,!0),As=(s,u)=>{if(s=typeof s=="string"?Xt(s,{Yb:!0}).node:s,!s.Cb.Qb)throw new te(63);s.Cb.Qb(s,{mode:u&4095|s.mode&-4096,timestamp:Date.now()})},Go=(s,u)=>{if(0>u)throw new te(28);if(s=typeof s=="string"?Xt(s,{Yb:!0}).node:s,!s.Cb.Qb)throw new te(63);if((s.mode&61440)===16384)throw new te(31);if((s.mode&61440)!==32768)throw new te(28);var f=Tr(s,"w");if(f)throw new te(f);s.Cb.Qb(s,{size:u,timestamp:Date.now()})},Ai=(s,u,f)=>{if(s==="")throw new te(44);if(typeof u=="string"){var y=Oi[u];if(typeof y>"u")throw Error("Unknown file open mode: "+u);u=y}if(f=u&64?(typeof f>"u"?438:f)&4095|32768:0,typeof s=="object")var _=s;else{s=ee(s);try{_=Xt(s,{Yb:!(u&131072)}).node}catch{}}if(y=!1,u&64)if(_){if(u&128)throw new te(20)}else _=Ko(s,f,0),y=!0;if(!_)throw new te(44);if((_.mode&61440)===8192&&(u&=-513),u&65536&&(_.mode&61440)!==16384)throw new te(54);if(!y&&(f=_?(_.mode&61440)===40960?32:(_.mode&61440)===16384&&(qs(u)!=="r"||u&512)?31:Tr(_,qs(u)):44))throw new te(f);return u&512&&!y&&Go(_,0),u&=-131713,_=Vo({node:_,path:On(_),flags:u,seekable:!0,position:0,Mb:_.Mb,Tc:[],error:!1}),_.Mb.open&&_.Mb.open(_),!n.logReadFiles||u&1||(Ti||(Ti={}),s in Ti||(Ti[s]=1)),_},Xo=(s,u,f)=>{if(s.Wb===null)throw new te(8);if(!s.seekable||!s.Mb.Zb)throw new te(70);if(f!=0&&f!=1&&f!=2)throw new te(28);s.position=s.Mb.Zb(s,u,f),s.Tc=[]},Kr=()=>{te||(te=function(s,u){this.name="ErrnoError",this.node=u,this.Rc=function(f){this.Ob=f},this.Rc(s),this.message="FS error"},te.prototype=Error(),te.prototype.constructor=te,[44].forEach(s=>{Dn[s]=new te(s),Dn[s].stack=""}))},Yo,Ts=(s,u)=>{var f=0;return s&&(f|=365),u&&(f|=146),f},Jr=(s,u,f)=>{s=ee("/dev/"+s);var y=Ts(!!u,!!f);yr||(yr=64);var _=yr++<<8|0;Ws(_,{open:k=>{k.seekable=!1},close:()=>{f&&f.buffer&&f.buffer.length&&f(10)},read:(k,A,V,L)=>{for(var B=0,ie=0;ie{for(var B=0;B>2]=y.Ic,ae[f+8>>2]=y.qc,ae[f+12>>2]=y.mode,_e[f+16>>2]=y.Oc,ae[f+20>>2]=y.uid,ae[f+24>>2]=y.Lc,ae[f+28>>2]=y.ec,Me=[y.size>>>0,(fe=y.size,1<=+Math.abs(fe)?0>>0:~~+Math.ceil((fe-+(~~fe>>>0))/4294967296)>>>0:0)],ae[f+40>>2]=Me[0],ae[f+44>>2]=Me[1],ae[f+48>>2]=4096,ae[f+52>>2]=y.Gc,s=y.Ec.getTime(),u=y.Nc.getTime();var _=y.Hc.getTime();return Me=[Math.floor(s/1e3)>>>0,(fe=Math.floor(s/1e3),1<=+Math.abs(fe)?0>>0:~~+Math.ceil((fe-+(~~fe>>>0))/4294967296)>>>0:0)],ae[f+56>>2]=Me[0],ae[f+60>>2]=Me[1],_e[f+64>>2]=s%1e3*1e3,Me=[Math.floor(u/1e3)>>>0,(fe=Math.floor(u/1e3),1<=+Math.abs(fe)?0>>0:~~+Math.ceil((fe-+(~~fe>>>0))/4294967296)>>>0:0)],ae[f+72>>2]=Me[0],ae[f+76>>2]=Me[1],_e[f+80>>2]=u%1e3*1e3,Me=[Math.floor(_/1e3)>>>0,(fe=Math.floor(_/1e3),1<=+Math.abs(fe)?0>>0:~~+Math.ceil((fe-+(~~fe>>>0))/4294967296)>>>0:0)],ae[f+88>>2]=Me[0],ae[f+92>>2]=Me[1],_e[f+96>>2]=_%1e3*1e3,Me=[y.qc>>>0,(fe=y.qc,1<=+Math.abs(fe)?0>>0:~~+Math.ceil((fe-+(~~fe>>>0))/4294967296)>>>0:0)],ae[f+104>>2]=Me[0],ae[f+108>>2]=Me[1],0}var Si=void 0;function ki(){return Si+=4,ae[Si-4>>2]}function mn(s){if(s=Gt[s],!s)throw new te(8);return s}function Ln(s,u,f){return ue(s,ne,u,f)}function Ri(s){return _e[s>>2]+4294967296*ae[s+4>>2]}var Je=[0,31,60,91,121,152,182,213,244,274,305,335],Di=[0,31,59,90,120,151,181,212,243,273,304,334];function Li(s){var u=oe(s)+1,f=la(u);return f&&Ln(s,f,u),f}var Jn={};function Pi(){if(!Xr){var s={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:m||"./this.program"},u;for(u in Jn)Jn[u]===void 0?delete s[u]:s[u]=Jn[u];var f=[];for(u in s)f.push(u+"="+s[u]);Xr=f}return Xr}var Xr;function Mi(){}function yn(){}function ks(){}function Zo(){}function vu(){}function Rs(){}function ea(){}function Ds(){}function ta(){}function Ls(){}function Gn(){}function Ps(){}function Ms(){}function Yr(){}function Bs(){}function _u(){}function na(){}function xu(){}function ra(){}function Bi(){}function Fi(){}function ia(){}function Zr(){}function ei(){}function Xn(){}function Ui(){}function sa(){}function o(){}function c(){}function h(){}function g(){}function E(){}function D(){}function Q(){}function ve(){}function Pe(){}function De(){}function ct(){}function Pn(){}function oa(s){q=s,b||0{ua={resolve:s,reject:u}})}function Il(){var s=la(12300),u=s+12;ae[s>>2]=u,ae[s+4>>2]=u+12288,u=Fs[0];var f=Cu[u];return f===void 0&&(f=ql++,Cu[u]=f,Ou[f]=u),ae[s+8>>2]=f,s}function Wu(s){if(!N){if(Yn===0){var u=!1,f=!1;s((y=0)=>{if(!N&&(Eu=y,u=!0,f)){Yn=2,$i(()=>Qi(Mn)),y=!1;try{var _=(0,n.asm[Ou[ae[Mn+8>>2]]])()}catch(V){_=V,y=!0}var k=!1;if(!Mn){var A=ua;A&&(ua=null,(y?A.reject:A.resolve)(_),k=!0)}if(y&&!k)throw _}}),f=!0,u||(Yn=1,Mn=Il(),$i(()=>Pu(Mn)))}else Yn===2?(Yn=0,$i(da),Su(Mn),Mn=null,Wl.forEach(y=>{if(!N)try{if(y(),!(b||0{s().then(u)})}var Au={};function Bn(s,u,f,y,_){function k(X){return--dn,L!==0&&fa(L),u==="string"?M(X):u==="boolean"?!!X:X}var A={string:X=>{var se=0;if(X!=null&&X!==0){se=oe(X)+1;var Ae=ha(se);Ln(X,Ae,se),se=Ae}return se},array:X=>{var se=ha(X.length);return T.set(X,se),se}};s=n["_"+s];var V=[],L=0;if(y)for(var B=0;B{qn("/dev"),Ws(259,{read:()=>0,write:(y,_,k,A)=>A}),Is("/dev/null",259),Ee(1280,Le),Ee(1536,it),Is("/dev/tty",1280),Is("/dev/tty1",1536);var s=new Uint8Array(1024),u=0,f=()=>(u===0&&(u=J(s).byteLength),s[--u]);Jr("random",f),Jr("urandom",f),qn("/dev/shm"),qn("/dev/shm/tmp")})(),(()=>{qn("/proc");var s=qn("/proc/self");qn("/proc/self/fd"),zo({Ub:()=>{var u=Bt(s,"fd",16895,73);return u.Cb={cc:(f,y)=>{var _=Gt[+y];if(!_)throw new te(8);return f={parent:null,Ub:{Ac:"fake"},Cb:{fc:()=>_.path}},f.parent=f}},u}},"/proc/self/fd")})(),function(){const s=new Map;n.setAuthorizer=function(u,f,y){return f?s.set(u,{f,uc:y}):s.delete(u),Bn("set_authorizer","number",["number"],[u])},Mi=function(u,f,y,_,k,A){if(s.has(u)){const{f:V,uc:L}=s.get(u);return V(L,f,y?M(y):null,_?M(_):null,k?M(k):null,A?M(A):null)}return 0}}(),function(){const s=new Map,u=new Map;n.createFunction=function(f,y,_,k,A,V){const L=s.size;return s.set(L,{f:V,Xb:A}),Bn("create_function","number","number string number number number number".split(" "),[f,y,_,k,L,0])},n.createAggregate=function(f,y,_,k,A,V,L){const B=s.size;return s.set(B,{step:V,Jc:L,Xb:A}),Bn("create_function","number","number string number number number number".split(" "),[f,y,_,k,B,1])},n.getFunctionUserData=function(f){return u.get(f)},ks=function(f,y,_,k){f=s.get(f),u.set(y,f.Xb),f.f(y,new Uint32Array(ne.buffer,k,_)),u.delete(y)},vu=function(f,y,_,k){f=s.get(f),u.set(y,f.Xb),f.step(y,new Uint32Array(ne.buffer,k,_)),u.delete(y)},yn=function(f,y){f=s.get(f),u.set(y,f.Xb),f.Jc(y),u.delete(y)}}(),function(){const s=new Map;n.progressHandler=function(u,f,y,_){return y?s.set(u,{f:y,uc:_}):s.delete(u),Bn("progress_handler",null,["number","number"],[u,f])},Zo=function(u){if(s.has(u)){const{f,uc:y}=s.get(u);return f(y)}return 0}}(),function(){function s(L,B){const ie=`get${L}`,X=`set${L}`;return new Proxy(new DataView(ne.buffer,B,L==="Int32"?4:8),{get(se,Ae){if(Ae===ie)return function(Ge,At){if(!At)throw Error("must be little endian");return se[Ae](Ge,At)};if(Ae===X)return function(Ge,At,vt){if(!vt)throw Error("must be little endian");return se[Ae](Ge,At,vt)};if(typeof Ae=="string"&&Ae.match(/^(get)|(set)/))throw Error("invalid type");return se[Ae]}})}const u=typeof Au=="object",f=new Map,y=new Map,_=new Map,k=u?new Set:null,A=u?new Set:null,V=new Map;ia=function(L,B,ie,X){V.set(M(L),{size:B,dc:Array.from(new Uint32Array(ne.buffer,X,ie))})},n.createModule=function(L,B,ie,X){u&&(ie.handleAsync=Iu);const se=f.size;return f.set(se,{module:ie,Xb:X}),X=0,ie.xCreate&&(X|=1),ie.xConnect&&(X|=2),ie.xBestIndex&&(X|=4),ie.xDisconnect&&(X|=8),ie.xDestroy&&(X|=16),ie.xOpen&&(X|=32),ie.xClose&&(X|=64),ie.xFilter&&(X|=128),ie.xNext&&(X|=256),ie.xEof&&(X|=512),ie.xColumn&&(X|=1024),ie.xRowid&&(X|=2048),ie.xUpdate&&(X|=4096),ie.xBegin&&(X|=8192),ie.xSync&&(X|=16384),ie.xCommit&&(X|=32768),ie.xRollback&&(X|=65536),ie.xFindFunction&&(X|=131072),ie.xRename&&(X|=262144),Bn("create_module","number",["number","string","number","number"],[L,B,se,X])},Ps=function(L,B,ie,X,se,Ae){if(B=f.get(B),y.set(se,B),u){k.delete(se);for(const Ge of k)y.delete(Ge)}return X=Array.from(new Uint32Array(ne.buffer,X,ie)).map(Ge=>M(Ge)),B.module.xCreate(L,B.Xb,X,se,s("Int32",Ae))},Gn=function(L,B,ie,X,se,Ae){if(B=f.get(B),y.set(se,B),u){k.delete(se);for(const Ge of k)y.delete(Ge)}return X=Array.from(new Uint32Array(ne.buffer,X,ie)).map(Ge=>M(Ge)),B.module.xConnect(L,B.Xb,X,se,s("Int32",Ae))},ea=function(L,B){var ie=y.get(L),X=V.get("sqlite3_index_info").dc;const se={};se.nConstraint=Ke(B+X[0],"i32"),se.aConstraint=[];for(var Ae=Ke(B+X[1],"*"),Ge=V.get("sqlite3_index_constraint").size,At=0;At>=2,_e[A]+_e[A+1]*2**32}const f=typeof Au=="object",y=new Map,_=new Map;n.registerVFS=function(A,V){if(Bn("sqlite3_vfs_find","number",["string"],[A.name]))throw Error(`VFS '${A.name}' already registered`);f&&(A.handleAsync=Iu);var L=A.Vc??64;const B=n._malloc(4);return V=Bn("register_vfs","number",["string","number","number","number"],[A.name,L,V?1:0,B]),V||(L=Ke(B,"*"),y.set(L,A)),n._free(B),V};const k=f?new Set:null;sa=function(A){const V=_.get(A);return f?k.add(A):_.delete(A),V.xClose(A)},Q=function(A,V,L,B){return _.get(A).xRead(A,ne.subarray(V,V+L),u(B))},Pn=function(A,V,L,B){return _.get(A).xWrite(A,ne.subarray(V,V+L),u(B))},De=function(A,V){return _.get(A).xTruncate(A,u(V))},Pe=function(A,V){return _.get(A).xSync(A,V)},g=function(A,V){const L=_.get(A);return V=s("BigInt64",V),L.xFileSize(A,V)},E=function(A,V){return _.get(A).xLock(A,V)},ct=function(A,V){return _.get(A).xUnlock(A,V)},Ui=function(A,V){const L=_.get(A);return V=s("Int32",V),L.xCheckReservedLock(A,V)},h=function(A,V,L){const B=_.get(A);return L=new DataView(ne.buffer,L),B.xFileControl(A,V,L)},ve=function(A){return _.get(A).xSectorSize(A)},c=function(A){return _.get(A).xDeviceCharacteristics(A)},D=function(A,V,L,B,ie){if(A=y.get(A),_.set(L,A),f){k.delete(L);for(var X of k)_.delete(X)}if(X=null,B&64){X=1;const se=[];for(;X;){const Ae=ne[V++];if(Ae)se.push(Ae);else switch(ne[V]||(X=null),X){case 1:se.push(63),X=2;break;case 2:se.push(61),X=3;break;case 3:se.push(38),X=2}}X=new TextDecoder().decode(new Uint8Array(se))}else V&&(X=M(V));return ie=s("Int32",ie),A.xOpen(X,L,B,ie)},o=function(A,V,L){return y.get(A).xDelete(M(V),L)},Xn=function(A,V,L,B){return A=y.get(A),B=s("Int32",B),A.xAccess(M(V),L,B)}}();var Al={a:function(s,u,f,y){ut("Assertion failed: "+M(s)+", at: "+[u?M(u):"unknown filename",f,y?M(y):"unknown function"])},K:function(s,u){try{return s=M(s),As(s,u),0}catch(f){if(typeof He>"u"||f.name!=="ErrnoError")throw f;return-f.Ob}},M:function(s,u,f){try{if(u=M(u),u=wr(s,u),f&-8)return-28;var y=Xt(u,{Yb:!0}).node;return y?(s="",f&4&&(s+="r"),f&2&&(s+="w"),f&1&&(s+="x"),s&&Tr(y,s)?-2:0):-44}catch(_){if(typeof He>"u"||_.name!=="ErrnoError")throw _;return-_.Ob}},L:function(s,u){try{var f=Gt[s];if(!f)throw new te(8);return As(f.node,u),0}catch(y){if(typeof He>"u"||y.name!=="ErrnoError")throw y;return-y.Ob}},J:function(s){try{var u=Gt[s];if(!u)throw new te(8);var f=u.node,y=typeof f=="string"?Xt(f,{Yb:!0}).node:f;if(!y.Cb.Qb)throw new te(63);return y.Cb.Qb(y,{timestamp:Date.now()}),0}catch(_){if(typeof He>"u"||_.name!=="ErrnoError")throw _;return-_.Ob}},b:function(s,u,f){Si=f;try{var y=mn(s);switch(u){case 0:var _=ki();return 0>_?-28:Vo(y,_).Wb;case 1:case 2:return 0;case 3:return y.flags;case 4:return _=ki(),y.flags|=_,0;case 5:return _=ki(),Ne[_+0>>1]=2,0;case 6:case 7:return 0;case 16:case 8:return-28;case 9:return ae[ca()>>2]=28,-1;default:return-28}}catch(k){if(typeof He>"u"||k.name!=="ErrnoError")throw k;return-k.Ob}},I:function(s,u){try{var f=mn(s);return Ss(an,f.path,u)}catch(y){if(typeof He>"u"||y.name!=="ErrnoError")throw y;return-y.Ob}},j:function(s,u,f){try{if(u=f+2097152>>>0<4194305-!!u?(u>>>0)+4294967296*f:NaN,isNaN(u))return-61;var y=Gt[s];if(!y)throw new te(8);if(!(y.flags&2097155))throw new te(28);return Go(y.node,u),0}catch(_){if(typeof He>"u"||_.name!=="ErrnoError")throw _;return-_.Ob}},C:function(s,u){try{if(u===0)return-28;var f=oe("/")+1;return u"u"||y.name!=="ErrnoError")throw y;return-y.Ob}},F:function(s,u){try{return s=M(s),Ss(Ii,s,u)}catch(f){if(typeof He>"u"||f.name!=="ErrnoError")throw f;return-f.Ob}},z:function(s,u,f){try{return u=M(u),u=wr(s,u),u=ee(u),u[u.length-1]==="/"&&(u=u.substr(0,u.length-1)),qn(u,f),0}catch(y){if(typeof He>"u"||y.name!=="ErrnoError")throw y;return-y.Ob}},E:function(s,u,f,y){try{u=M(u);var _=y&256;return u=wr(s,u,y&4096),Ss(_?Ii:an,u,f)}catch(k){if(typeof He>"u"||k.name!=="ErrnoError")throw k;return-k.Ob}},u:function(s,u,f,y){Si=y;try{u=M(u),u=wr(s,u);var _=y?ki():0;return Ai(u,f,_).Wb}catch(k){if(typeof He>"u"||k.name!=="ErrnoError")throw k;return-k.Ob}},s:function(s,u,f,y){try{if(u=M(u),u=wr(s,u),0>=y)return-28;var _=Wi(u),k=Math.min(y,oe(_)),A=T[f+k];return Ln(_,f,y+1),T[f+k]=A,k}catch(V){if(typeof He>"u"||V.name!=="ErrnoError")throw V;return-V.Ob}},r:function(s){try{return s=M(s),Jo(s),0}catch(u){if(typeof He>"u"||u.name!=="ErrnoError")throw u;return-u.Ob}},H:function(s,u){try{return s=M(s),Ss(an,s,u)}catch(f){if(typeof He>"u"||f.name!=="ErrnoError")throw f;return-f.Ob}},o:function(s,u,f){try{if(u=M(u),u=wr(s,u),f===0){s=u;var y=Xt(s,{parent:!0}).node;if(!y)throw new te(44);var _=z(s),k=Kn(y,_),A=Ho(y,_,!1);if(A)throw new te(A);if(!y.Cb.oc)throw new te(63);if(k.$b)throw new te(10);y.Cb.oc(y,_),H(k)}else f===512?Jo(u):ut("Invalid flags passed to unlinkat");return 0}catch(V){if(typeof He>"u"||V.name!=="ErrnoError")throw V;return-V.Ob}},n:function(s,u,f){try{if(u=M(u),u=wr(s,u,!0),f){var y=Ri(f),_=ae[f+8>>2];k=1e3*y+_/1e6,f+=16,y=Ri(f),_=ae[f+8>>2],A=1e3*y+_/1e6}else var k=Date.now(),A=k;s=k;var V=Xt(u,{Yb:!0}).node;return V.Cb.Qb(V,{timestamp:Math.max(s,A)}),0}catch(L){if(typeof He>"u"||L.name!=="ErrnoError")throw L;return-L.Ob}},y:function(s,u){s=new Date(1e3*Ri(s)),ae[u>>2]=s.getSeconds(),ae[u+4>>2]=s.getMinutes(),ae[u+8>>2]=s.getHours(),ae[u+12>>2]=s.getDate(),ae[u+16>>2]=s.getMonth(),ae[u+20>>2]=s.getFullYear()-1900,ae[u+24>>2]=s.getDay();var f=s.getFullYear();ae[u+28>>2]=(f%4!==0||f%100===0&&f%400!==0?Di:Je)[s.getMonth()]+s.getDate()-1|0,ae[u+36>>2]=-(60*s.getTimezoneOffset()),f=new Date(s.getFullYear(),6,1).getTimezoneOffset();var y=new Date(s.getFullYear(),0,1).getTimezoneOffset();ae[u+32>>2]=(f!=y&&s.getTimezoneOffset()==Math.min(y,f))|0},w:function(s,u,f,y,_,k,A){try{var V=mn(y);if(u&2&&!(f&2)&&(V.flags&2097155)!==2)throw new te(2);if((V.flags&2097155)===1)throw new te(2);if(!V.Mb.kc)throw new te(43);var L=V.Mb.kc(V,s,_,u,f),B=L.Pc;return ae[k>>2]=L.Dc,_e[A>>2]=B,0}catch(ie){if(typeof He>"u"||ie.name!=="ErrnoError")throw ie;return-ie.Ob}},x:function(s,u,f,y,_,k){try{var A=mn(_);if(f&2){if((A.node.mode&61440)!==32768)throw new te(43);y&2||A.Mb.lc&&A.Mb.lc(A,ne.slice(s,s+u),k,u,y)}}catch(V){if(typeof He>"u"||V.name!=="ErrnoError")throw V;return-V.Ob}},p:function(s,u,f){function y(L){return(L=L.toTimeString().match(/\(([A-Za-z ]+)\)$/))?L[1]:"GMT"}var _=new Date().getFullYear(),k=new Date(_,0,1),A=new Date(_,6,1);_=k.getTimezoneOffset();var V=A.getTimezoneOffset();_e[s>>2]=60*Math.max(_,V),ae[u>>2]=+(_!=V),s=y(k),u=y(A),s=Li(s),u=Li(u),V<_?(_e[f>>2]=s,_e[f+4>>2]=u):(_e[f>>2]=u,_e[f+4>>2]=s)},e:function(){return Date.now()},d:()=>performance.now(),l:function(s){var u=ne.length;if(s>>>=0,2147483648=f;f*=2){var y=u*(1+.2/f);y=Math.min(y,s+100663296);var _=Math,k=_.min;y=Math.max(s,y),y+=(65536-y%65536)%65536;e:{var A=C.buffer;try{C.grow(k.call(_,2147483648,y)-A.byteLength+65535>>>16),ze();var V=1;break e}catch{}V=void 0}if(V)return!0}return!1},A:function(s,u){var f=0;return Pi().forEach(function(y,_){var k=u+f;for(_=_e[s+4*_>>2]=k,k=0;k>0]=y.charCodeAt(k);T[_>>0]=0,f+=y.length+1}),0},B:function(s,u){var f=Pi();_e[s>>2]=f.length;var y=0;return f.forEach(function(_){y+=_.length+1}),_e[u>>2]=y,0},f:function(s){try{var u=mn(s);if(u.Wb===null)throw new te(8);u.pc&&(u.pc=null);try{u.Mb.close&&u.Mb.close(u)}catch(f){throw f}finally{Gt[u.Wb]=null}return u.Wb=null,0}catch(f){if(typeof He>"u"||f.name!=="ErrnoError")throw f;return f.Ob}},m:function(s,u){try{var f=mn(s);return T[u>>0]=f.Sb?2:(f.mode&61440)===16384?3:(f.mode&61440)===40960?7:4,Ne[u+2>>1]=0,Me=[0,(fe=0,1<=+Math.abs(fe)?0>>0:~~+Math.ceil((fe-+(~~fe>>>0))/4294967296)>>>0:0)],ae[u+8>>2]=Me[0],ae[u+12>>2]=Me[1],Me=[0,(fe=0,1<=+Math.abs(fe)?0>>0:~~+Math.ceil((fe-+(~~fe>>>0))/4294967296)>>>0:0)],ae[u+16>>2]=Me[0],ae[u+20>>2]=Me[1],0}catch(y){if(typeof He>"u"||y.name!=="ErrnoError")throw y;return y.Ob}},t:function(s,u,f,y){try{e:{var _=mn(s);s=u;for(var k,A=u=0;A>2],L=_e[s+4>>2];s+=8;var B=_,ie=V,X=L,se=k,Ae=T;if(0>X||0>se)throw new te(28);if(B.Wb===null)throw new te(8);if((B.flags&2097155)===1)throw new te(8);if((B.node.mode&61440)===16384)throw new te(31);if(!B.Mb.read)throw new te(28);var Ge=typeof se<"u";if(!Ge)se=B.position;else if(!B.seekable)throw new te(70);var At=B.Mb.read(B,Ae,ie,X,se);Ge||(B.position+=At);var vt=At;if(0>vt){var wn=-1;break e}if(u+=vt,vt>2]=wn,0}catch(Ft){if(typeof He>"u"||Ft.name!=="ErrnoError")throw Ft;return Ft.Ob}},i:function(s,u,f,y,_){try{if(u=f+2097152>>>0<4194305-!!u?(u>>>0)+4294967296*f:NaN,isNaN(u))return 61;var k=mn(s);return Xo(k,u,y),Me=[k.position>>>0,(fe=k.position,1<=+Math.abs(fe)?0>>0:~~+Math.ceil((fe-+(~~fe>>>0))/4294967296)>>>0:0)],ae[_>>2]=Me[0],ae[_+4>>2]=Me[1],k.pc&&u===0&&y===0&&(k.pc=null),0}catch(A){if(typeof He>"u"||A.name!=="ErrnoError")throw A;return A.Ob}},D:function(s){try{var u=mn(s);return Wu(function(f){var y=u.node.Ub;y.type.Sc?y.type.Sc(y,!1,function(_){f(_?function(){return 29}:0)}):f(0)})}catch(f){if(typeof He>"u"||f.name!=="ErrnoError")throw f;return f.Ob}},q:function(s,u,f,y){try{e:{var _=mn(s);s=u;for(var k,A=u=0;A>2],L=_e[s+4>>2];s+=8;var B=_,ie=V,X=L,se=k,Ae=T;if(0>X||0>se)throw new te(28);if(B.Wb===null)throw new te(8);if(!(B.flags&2097155))throw new te(8);if((B.node.mode&61440)===16384)throw new te(31);if(!B.Mb.write)throw new te(28);B.seekable&&B.flags&1024&&Xo(B,0,2);var Ge=typeof se<"u";if(!Ge)se=B.position;else if(!B.seekable)throw new te(70);var At=B.Mb.write(B,Ae,ie,X,se,void 0);Ge||(B.position+=At);var vt=At;if(0>vt){var wn=-1;break e}u+=vt,typeof k<"u"&&(k+=vt)}wn=u}return _e[y>>2]=wn,0}catch(Ft){if(typeof He>"u"||Ft.name!=="ErrnoError")throw Ft;return Ft.Ob}},ra:Mi,N:yn,ga:ks,ca:Zo,Y:vu,la:Rs,G:ea,h:Ds,oa:ta,ja:Ls,ea:Gn,fa:Ps,k:Ms,v:Yr,pa:Bs,g:_u,qa:na,da:xu,ha:ra,ia:Bi,na:Fi,c:ia,ka:Zr,ma:ei,aa:Xn,V:Ui,$:sa,ba:o,S:c,U:h,Z:g,X:E,R:D,Q,T:ve,_:Pe,O:De,W:ct,P:Pn};(function(){function s(f){if(f=f.exports,f=Ol(f),n.asm=f,C=n.asm.sa,ze(),Wt.unshift(n.asm.ta),ge--,n.monitorRunDependencies&&n.monitorRunDependencies(ge),ge==0&&Oe){var y=Oe;Oe=null,y()}return f}var u={a:Al};if(ge++,n.monitorRunDependencies&&n.monitorRunDependencies(ge),n.instantiateWasm)try{return n.instantiateWasm(u,s)}catch(f){Y("Module.instantiateWasm callback failed with error: "+f),a(f)}return pn(u,function(f){s(f.instance)}).catch(a),{}})(),n._sqlite3_vfs_find=function(){return(n._sqlite3_vfs_find=n.asm.ua).apply(null,arguments)},n._sqlite3_malloc=function(){return(n._sqlite3_malloc=n.asm.va).apply(null,arguments)},n._sqlite3_free=function(){return(n._sqlite3_free=n.asm.wa).apply(null,arguments)},n._sqlite3_prepare_v2=function(){return(n._sqlite3_prepare_v2=n.asm.xa).apply(null,arguments)},n._sqlite3_step=function(){return(n._sqlite3_step=n.asm.ya).apply(null,arguments)},n._sqlite3_column_int64=function(){return(n._sqlite3_column_int64=n.asm.za).apply(null,arguments)},n._sqlite3_column_int=function(){return(n._sqlite3_column_int=n.asm.Aa).apply(null,arguments)},n._sqlite3_finalize=function(){return(n._sqlite3_finalize=n.asm.Ba).apply(null,arguments)},n._sqlite3_reset=function(){return(n._sqlite3_reset=n.asm.Ca).apply(null,arguments)},n._sqlite3_clear_bindings=function(){return(n._sqlite3_clear_bindings=n.asm.Da).apply(null,arguments)},n._sqlite3_value_blob=function(){return(n._sqlite3_value_blob=n.asm.Ea).apply(null,arguments)},n._sqlite3_value_text=function(){return(n._sqlite3_value_text=n.asm.Fa).apply(null,arguments)},n._sqlite3_value_bytes=function(){return(n._sqlite3_value_bytes=n.asm.Ga).apply(null,arguments)},n._sqlite3_value_double=function(){return(n._sqlite3_value_double=n.asm.Ha).apply(null,arguments)},n._sqlite3_value_int=function(){return(n._sqlite3_value_int=n.asm.Ia).apply(null,arguments)},n._sqlite3_value_int64=function(){return(n._sqlite3_value_int64=n.asm.Ja).apply(null,arguments)},n._sqlite3_value_type=function(){return(n._sqlite3_value_type=n.asm.Ka).apply(null,arguments)},n._sqlite3_result_blob=function(){return(n._sqlite3_result_blob=n.asm.La).apply(null,arguments)},n._sqlite3_result_double=function(){return(n._sqlite3_result_double=n.asm.Ma).apply(null,arguments)},n._sqlite3_result_error=function(){return(n._sqlite3_result_error=n.asm.Na).apply(null,arguments)},n._sqlite3_result_int=function(){return(n._sqlite3_result_int=n.asm.Oa).apply(null,arguments)},n._sqlite3_result_int64=function(){return(n._sqlite3_result_int64=n.asm.Pa).apply(null,arguments)},n._sqlite3_result_null=function(){return(n._sqlite3_result_null=n.asm.Qa).apply(null,arguments)},n._sqlite3_result_text=function(){return(n._sqlite3_result_text=n.asm.Ra).apply(null,arguments)},n._sqlite3_column_count=function(){return(n._sqlite3_column_count=n.asm.Sa).apply(null,arguments)},n._sqlite3_data_count=function(){return(n._sqlite3_data_count=n.asm.Ta).apply(null,arguments)},n._sqlite3_column_blob=function(){return(n._sqlite3_column_blob=n.asm.Ua).apply(null,arguments)},n._sqlite3_column_bytes=function(){return(n._sqlite3_column_bytes=n.asm.Va).apply(null,arguments)},n._sqlite3_column_double=function(){return(n._sqlite3_column_double=n.asm.Wa).apply(null,arguments)},n._sqlite3_column_text=function(){return(n._sqlite3_column_text=n.asm.Xa).apply(null,arguments)},n._sqlite3_column_type=function(){return(n._sqlite3_column_type=n.asm.Ya).apply(null,arguments)},n._sqlite3_column_name=function(){return(n._sqlite3_column_name=n.asm.Za).apply(null,arguments)},n._sqlite3_bind_blob=function(){return(n._sqlite3_bind_blob=n.asm._a).apply(null,arguments)},n._sqlite3_bind_double=function(){return(n._sqlite3_bind_double=n.asm.$a).apply(null,arguments)},n._sqlite3_bind_int=function(){return(n._sqlite3_bind_int=n.asm.ab).apply(null,arguments)},n._sqlite3_bind_int64=function(){return(n._sqlite3_bind_int64=n.asm.bb).apply(null,arguments)},n._sqlite3_bind_null=function(){return(n._sqlite3_bind_null=n.asm.cb).apply(null,arguments)},n._sqlite3_bind_text=function(){return(n._sqlite3_bind_text=n.asm.db).apply(null,arguments)},n._sqlite3_bind_parameter_count=function(){return(n._sqlite3_bind_parameter_count=n.asm.eb).apply(null,arguments)},n._sqlite3_bind_parameter_name=function(){return(n._sqlite3_bind_parameter_name=n.asm.fb).apply(null,arguments)},n._sqlite3_sql=function(){return(n._sqlite3_sql=n.asm.gb).apply(null,arguments)},n._sqlite3_exec=function(){return(n._sqlite3_exec=n.asm.hb).apply(null,arguments)},n._sqlite3_errmsg=function(){return(n._sqlite3_errmsg=n.asm.ib).apply(null,arguments)},n._sqlite3_declare_vtab=function(){return(n._sqlite3_declare_vtab=n.asm.jb).apply(null,arguments)},n._sqlite3_libversion=function(){return(n._sqlite3_libversion=n.asm.kb).apply(null,arguments)},n._sqlite3_libversion_number=function(){return(n._sqlite3_libversion_number=n.asm.lb).apply(null,arguments)},n._sqlite3_changes=function(){return(n._sqlite3_changes=n.asm.mb).apply(null,arguments)},n._sqlite3_close=function(){return(n._sqlite3_close=n.asm.nb).apply(null,arguments)},n._sqlite3_limit=function(){return(n._sqlite3_limit=n.asm.ob).apply(null,arguments)},n._sqlite3_open_v2=function(){return(n._sqlite3_open_v2=n.asm.pb).apply(null,arguments)},n._sqlite3_get_autocommit=function(){return(n._sqlite3_get_autocommit=n.asm.qb).apply(null,arguments)};function ca(){return(ca=n.asm.rb).apply(null,arguments)}var la=n._malloc=function(){return(la=n._malloc=n.asm.sb).apply(null,arguments)},Su=n._free=function(){return(Su=n._free=n.asm.tb).apply(null,arguments)};n._RegisterExtensionFunctions=function(){return(n._RegisterExtensionFunctions=n.asm.ub).apply(null,arguments)},n._set_authorizer=function(){return(n._set_authorizer=n.asm.vb).apply(null,arguments)},n._create_function=function(){return(n._create_function=n.asm.wb).apply(null,arguments)},n._create_module=function(){return(n._create_module=n.asm.xb).apply(null,arguments)},n._progress_handler=function(){return(n._progress_handler=n.asm.yb).apply(null,arguments)},n._register_vfs=function(){return(n._register_vfs=n.asm.zb).apply(null,arguments)},n._getSqliteFree=function(){return(n._getSqliteFree=n.asm.Ab).apply(null,arguments)};var ku=n._main=function(){return(ku=n._main=n.asm.Bb).apply(null,arguments)};function Ru(){return(Ru=n.asm.Db).apply(null,arguments)}function Du(){return(Du=n.asm.Eb).apply(null,arguments)}function Lu(){return(Lu=n.asm.Fb).apply(null,arguments)}function fa(){return(fa=n.asm.Gb).apply(null,arguments)}function ha(){return(ha=n.asm.Hb).apply(null,arguments)}function Pu(){return(Pu=n.asm.Ib).apply(null,arguments)}function Mu(){return(Mu=n.asm.Jb).apply(null,arguments)}function Qi(){return(Qi=n.asm.Kb).apply(null,arguments)}function da(){return(da=n.asm.Lb).apply(null,arguments)}n.getTempRet0=Du,n.ccall=Bn,n.cwrap=function(s,u,f,y){var _=!f||f.every(k=>k==="number"||k==="boolean");return u!=="string"&&_&&!y?n["_"+s]:function(){return Bn(s,u,f,arguments,y)}},n.setValue=x,n.getValue=Ke,n.UTF8ToString=M,n.stringToUTF8=Ln,n.lengthBytesUTF8=oe;var Us;Oe=function s(){Us||I(),Us||(Oe=s)};function I(){function s(){if(!Us&&(Us=!0,n.calledRun=!0,!N)){if(n.noFSInit||Yo||(Yo=!0,Kr(),n.stdin=n.stdin,n.stdout=n.stdout,n.stderr=n.stderr,n.stdin?Jr("stdin",n.stdin):qi("/dev/tty","/dev/stdin"),n.stdout?Jr("stdout",null,n.stdout):qi("/dev/tty","/dev/stdout"),n.stderr?Jr("stderr",null,n.stderr):qi("/dev/tty1","/dev/stderr"),Ai("/dev/stdin",0),Ai("/dev/stdout",1),Ai("/dev/stderr",1)),Mt=!1,Jt(Wt),Jt(Qe),i(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),G){var u=ku;try{var f=u(0,0);q=f,oa(f)}catch(y){aa(y)}}if(n.postRun)for(typeof n.postRun=="function"&&(n.postRun=[n.postRun]);n.postRun.length;)u=n.postRun.shift(),Kt.unshift(u);Jt(Kt)}}if(!(0{try{await navigator.locks.request(e,n,l=>{if(i(l),l)return new Promise(m=>r(this,Wo).set(e,m))})}catch(l){a(l)}})}_releaseWebLock(e){var n;(n=r(this,Wo).get(e))==null||n(),r(this,Wo).delete(e)}async _pollWebLock(e){var i;return(i=(await navigator.locks.query()).held.find(({name:a})=>a===e))==null?void 0:i.mode}_getTimeoutSignal(){if(this.timeoutMillis){const e=new AbortController;return setTimeout(()=>e.abort(),this.timeoutMillis),e.signal}}}jt=new WeakMap,Wo=new WeakMap,cu=new WeakMap,lu=new WeakSet,wf=async function(e,n){const i=n&PN;try{const a=()=>e.call(this,i);return await P(this,cu,r(this,cu).then(a,a)),P(this,jt,i),Ve}catch(a){return a.name==="AbortError"?vN:(console.error(a),EN)}},Zc=new WeakSet,vm=async function(e){if(e===r(this,jt))return Ve;switch(r(this,jt)){case Hs:switch(e){case Yi:return this._NONEtoSHARED();default:throw new Error(`unexpected transition ${r(this,jt)} -> ${e}`)}case Yi:switch(e){case ic:return this._SHAREDtoRESERVED();case sc:return this._SHAREDtoEXCLUSIVE();default:throw new Error(`unexpected transition ${r(this,jt)} -> ${e}`)}case ic:switch(e){case sc:return this._RESERVEDtoEXCLUSIVE();default:throw new Error(`unexpected transition ${r(this,jt)} -> ${e}`)}default:throw new Error(`unexpected transition ${r(this,jt)} -> ${e}`)}},el=new WeakSet,_m=async function(e){if(e===r(this,jt))return Ve;switch(r(this,jt)){case sc:switch(e){case Yi:return this._EXCLUSIVEtoSHARED();case Hs:return this._EXCLUSIVEtoNONE();default:throw new Error(`unexpected transition ${r(this,jt)} -> ${e}`)}case ic:switch(e){case Yi:return this._RESERVEDtoSHARED();case Hs:return this._RESERVEDtoNONE();default:throw new Error(`unexpected transition ${r(this,jt)} -> ${e}`)}case Yi:switch(e){case Hs:return this._SHAREDtoNONE();default:throw new Error(`unexpected transition ${r(this,jt)} -> ${e}`)}default:throw new Error(`unexpected transition ${r(this,jt)} -> ${e}`)}};class BN extends MN{constructor(e){super(),this._lockName=e+"-outer",this._reservedName=e+"-reserved"}async isSomewhereReserved(){return await this._pollWebLock(this._reservedName)==="exclusive"}async _NONEtoSHARED(){await this._acquireWebLock(this._lockName,{mode:"exclusive",signal:this._getTimeoutSignal()})}async _SHAREDtoRESERVED(){await this._acquireWebLock(this._reservedName,{mode:"exclusive",signal:this._getTimeoutSignal()})}async _RESERVEDtoSHARED(){this._releaseWebLock(this._reservedName)}async _SHAREDtoNONE(){this._releaseWebLock(this._lockName)}}const FN=5e3;let UN=0;const Ql=new WeakMap;function Nr(...t){}var Io,Ao,fu,Rt,hu,To,ms,tl,xm;class $N{constructor(e,n={durability:"default"}){S(this,tl);S(this,Io,void 0);S(this,Ao,void 0);S(this,fu,void 0);S(this,Rt,null);S(this,hu,0);S(this,To,Promise.resolve());S(this,ms,Promise.resolve());P(this,Ao,Promise.resolve(e).then(i=>P(this,Io,i))),P(this,fu,n)}async close(){const e=r(this,Io)??await r(this,Ao);await r(this,To),await this.sync(),e.close()}async run(e,n){const i=r(this,To).then(()=>qe(this,tl,xm).call(this,e,n));return P(this,To,i.catch(()=>{})),i}async sync(){await r(this,ms),P(this,ms,Promise.resolve())}}Io=new WeakMap,Ao=new WeakMap,fu=new WeakMap,Rt=new WeakMap,hu=new WeakMap,To=new WeakMap,ms=new WeakMap,tl=new WeakSet,xm=async function(e,n){var a,l;const i=r(this,Io)??await r(this,Ao);if(e==="readwrite"&&((a=r(this,Rt))==null?void 0:a.mode)==="readonly")P(this,Rt,null);else if(performance.now()-r(this,hu)>FN){try{(l=r(this,Rt))==null||l.commit()}catch(m){if(m.name!=="InvalidStateError")throw m}await new Promise(m=>setTimeout(m)),P(this,Rt,null)}for(let m=0;m<2;++m){if(!r(this,Rt)){P(this,Rt,i.transaction(i.objectStoreNames,e,r(this,fu)));const w=P(this,hu,performance.now());P(this,ms,r(this,ms).then(()=>new Promise((v,d)=>{r(this,Rt).addEventListener("complete",W=>{v(),r(this,Rt)===W.target&&P(this,Rt,null),Nr(`transaction ${Ql.get(W.target)} complete`)}),r(this,Rt).addEventListener("abort",W=>{console.warn("tx abort",(performance.now()-w)/1e3);const F=W.target.error;d(F),r(this,Rt)===W.target&&P(this,Rt,null),Nr(`transaction ${Ql.get(W.target)} aborted`,F)})}))),Ql.set(r(this,Rt),UN++)}try{const w=Object.fromEntries(Array.from(i.objectStoreNames,v=>[v,new QN(r(this,Rt).objectStore(v))]));return await n(w)}catch(w){if(P(this,Rt,null),m)throw w}}};function ii(t){return new Promise((e,n)=>{t.addEventListener("success",()=>e(t.result)),t.addEventListener("error",()=>n(t.error))})}var It;class QN{constructor(e){S(this,It,void 0);P(this,It,e)}get(e){Nr(`get ${r(this,It).name}`,e);const n=r(this,It).get(e);return ii(n)}getAll(e,n){Nr(`getAll ${r(this,It).name}`,e,n);const i=r(this,It).getAll(e,n);return ii(i)}getKey(e){Nr(`getKey ${r(this,It).name}`,e);const n=r(this,It).getKey(e);return ii(n)}getAllKeys(e,n){Nr(`getAllKeys ${r(this,It).name}`,e,n);const i=r(this,It).getAllKeys(e,n);return ii(i)}put(e,n){Nr(`put ${r(this,It).name}`,e,n);const i=r(this,It).put(e,n);return ii(i)}delete(e){Nr(`delete ${r(this,It).name}`,e);const n=r(this,It).delete(e);return ii(n)}clear(){Nr(`clear ${r(this,It).name}`);const e=r(this,It).clear();return ii(e)}index(e){return new jN(r(this,It).index(e))}}It=new WeakMap;var ys;class jN{constructor(e){S(this,ys,void 0);P(this,ys,e)}getAllKeys(e,n){Nr(`IDBIndex.getAllKeys ${r(this,ys).objectStore.name}<${r(this,ys).name}>`,e,n);const i=r(this,ys).getAllKeys(e,n);return ii(i)}}ys=new WeakMap;const HN=512,rd=3e3,id={durability:"default",purge:"deferred",purgeAtLeast:16};function gn(...t){}var yi,Ht,pt,ws,gs,Mr,du,gf,nl,Em,rl,Cm,wi,Vs,il,Om;class VN extends LN{constructor(n="wa-sqlite",i=id){super();S(this,du);S(this,nl);S(this,rl);S(this,wi);S(this,il);S(this,yi,void 0);S(this,Ht,new Map);S(this,pt,void 0);S(this,ws,new Set);S(this,gs,performance.now());S(this,Mr,new Set);this.name=n,P(this,yi,Object.assign({},id,i)),P(this,pt,new $N(zN(n),{durability:r(this,yi).durability}))}async close(){var n;for(const i of r(this,Ht).keys())await this.xClose(i);await((n=r(this,pt))==null?void 0:n.close()),P(this,pt,null)}xOpen(n,i,a,l){return this.handleAsync(async()=>{n===null&&(n=`null_${i}`),gn(`xOpen ${n} 0x${i.toString(16)} 0x${a.toString(16)}`);try{const m=new URL(n,"http://localhost/"),w={path:m.pathname,flags:a,block0:null,locks:new BN(m.pathname)};return r(this,Ht).set(i,w),await r(this,pt).run("readwrite",async({blocks:v})=>{if(w.block0=await v.get(qe(this,wi,Vs).call(this,w,0)),!w.block0)if(a&Nm)w.block0={path:w.path,offset:0,version:0,data:new Uint8Array(0),fileSize:0},v.put(w.block0);else throw new Error(`file not found: ${w.path}`)}),l.setInt32(0,a&ON,!0),Ve}catch(m){return console.error(m),bm}})}xClose(n){return this.handleAsync(async()=>{try{const i=r(this,Ht).get(n);return i&&(gn(`xClose ${i.path}`),r(this,Ht).delete(n),i.flags&WN&&r(this,pt).run("readwrite",({blocks:a})=>{a.delete(IDBKeyRange.bound([i.path],[i.path,[]]))})),Ve}catch(i){return console.error(i),xt}})}xRead(n,i,a){return this.handleAsync(async()=>{const l=r(this,Ht).get(n);gn(`xRead ${l.path} ${i.byteLength} ${a}`);try{return await r(this,pt).run("readonly",async({blocks:w})=>{let v=0;for(;vrd){const m=this.handleAsync(async()=>{this.handleAsync!==super.handleAsync&&r(this,Mr).add(n),await new Promise(v=>setTimeout(v));const w=qe(this,du,gf).call(this,n,i,a);return P(this,gs,performance.now()),w});return l&&r(this,Mr).delete(n),m}return qe(this,du,gf).call(this,n,i,a)}xTruncate(n,i){const a=r(this,Ht).get(n);gn(`xTruncate ${a.path} ${i}`);try{Object.assign(a.block0,{fileSize:i,data:a.block0.data.slice(0,i)});const l=Object.assign({},a.block0);return r(this,pt).run("readwrite",({blocks:m})=>{m.delete(qe(this,wi,Vs).call(this,a,-1/0,-i)),m.put(l)}),Ve}catch(l){return console.error(l),xt}}xSync(n,i){const a=r(this,Mr).has(n);if(a||r(this,yi).durability!=="relaxed"||performance.now()-r(this,gs)>rd){const m=this.handleAsync(async()=>{this.handleAsync!==super.handleAsync&&r(this,Mr).add(n);const w=await qe(this,nl,Em).call(this,n,i);return P(this,gs,performance.now()),w});return a&&r(this,Mr).delete(n),m}const l=r(this,Ht).get(n);return gn(`xSync ${l.path} ${i}`),Ve}xFileSize(n,i){const a=r(this,Ht).get(n);return gn(`xFileSize ${a.path}`),i.setBigInt64(0,BigInt(a.block0.fileSize),!0),Ve}xLock(n,i){return this.handleAsync(async()=>{const a=r(this,Ht).get(n);gn(`xLock ${a.path} ${i}`);try{const l=await a.locks.lock(i);return l===Ve&&a.locks.state===Yi&&(a.block0=await r(this,pt).run("readonly",({blocks:m})=>m.get(qe(this,wi,Vs).call(this,a,0)))),l}catch(l){return console.error(l),xt}})}xUnlock(n,i){return this.handleAsync(async()=>{const a=r(this,Ht).get(n);gn(`xUnlock ${a.path} ${i}`);try{return a.locks.unlock(i)}catch(l){return console.error(l),xt}})}xCheckReservedLock(n,i){return this.handleAsync(async()=>{const a=r(this,Ht).get(n);gn(`xCheckReservedLock ${a.path}`);const l=await a.locks.isSomewhereReserved();return i.setInt32(0,l?1:0,!0),Ve})}xSectorSize(n){return HN}xDeviceCharacteristics(n){return kN|AN|TN|SN}xFileControl(n,i,a){const l=r(this,Ht).get(n);switch(gn(`xFileControl ${l.path} ${i}`),i){case 11:return l.overwrite=!0,Ve;case 21:if(l.overwrite)try{return this.handleAsync(async()=>(await qe(this,il,Om).call(this,l),Ve))}catch(m){return console.error(m),xt}return Ve;case 22:return l.overwrite=!1,Ve;case 31:return this.handleAsync(async()=>{try{return l.block0.version--,l.changedPages=new Set,r(this,pt).run("readwrite",async({blocks:m})=>{const w=await m.index("version").getAllKeys(IDBKeyRange.bound([l.path],[l.path,l.block0.version]));for(const v of w)m.delete(v)}),Ve}catch(m){return console.error(m),xt}});case 32:try{const m=Object.assign({},l.block0);m.data=m.data.slice();const w=l.changedPages;return l.changedPages=null,r(this,pt).run("readwrite",async({blocks:v})=>{v.put(m);const d=await v.get([l.path,"purge",0])??{path:l.path,offset:"purge",version:0,data:new Map,count:0};d.count+=w.size;for(const W of w)d.data.set(W,m.version);v.put(d),qe(this,rl,Cm).call(this,l.path,d.count)}),Ve}catch(m){return console.error(m),xt}case 33:return this.handleAsync(async()=>{try{return l.changedPages=null,l.block0=await r(this,pt).run("readonly",({blocks:m})=>m.get([l.path,0,l.block0.version+1])),Ve}catch(m){return console.error(m),xt}});default:return gm}}xAccess(n,i,a){return this.handleAsync(async()=>{try{const l=new URL(n,"file://localhost/").pathname;gn(`xAccess ${l} ${i}`);const m=await r(this,pt).run("readonly",({blocks:w})=>w.getKey(qe(this,wi,Vs).call(this,{path:l},0)));return a.setInt32(0,m?1:0,!0),Ve}catch(l){return console.error(l),xt}})}xDelete(n,i){return this.handleAsync(async()=>{const a=new URL(n,"file://localhost/").pathname;try{return r(this,pt).run("readwrite",({blocks:l})=>l.delete(IDBKeyRange.bound([a],[a,[]]))),i&&await r(this,pt).sync(),Ve}catch(l){return console.error(l),xt}})}async purge(n){const i=Date.now();await r(this,pt).run("readwrite",async({blocks:a})=>{const l=await a.get([n,"purge",0]);if(l){for(const[m,w]of l.data)a.delete(IDBKeyRange.bound([n,m,w],[n,m,1/0],!0,!1));await a.delete([n,"purge",0])}gn(`purge ${n} ${(l==null?void 0:l.data.size)??0} pages in ${Date.now()-i} ms`)})}}yi=new WeakMap,Ht=new WeakMap,pt=new WeakMap,ws=new WeakMap,gs=new WeakMap,Mr=new WeakMap,du=new WeakSet,gf=function(n,i,a){const l=r(this,Ht).get(n);gn(`xWrite ${l.path} ${i.byteLength} ${a}`);try{const m=l.block0.fileSize;l.block0.fileSize=Math.max(l.block0.fileSize,a+i.byteLength);const w=a===0?l.block0:{path:l.path,offset:-a,version:l.block0.version,data:null};return w.data=i.slice(),l.changedPages?(m===l.block0.fileSize&&l.changedPages.add(-a),a!==0&&r(this,pt).run("readwrite",({blocks:v})=>v.put(w))):r(this,pt).run("readwrite",({blocks:v})=>v.put(w)),Ve}catch(m){return console.error(m),xt}},nl=new WeakSet,Em=async function(n,i){const a=r(this,Ht).get(n);gn(`xSync ${a.path} ${i}`);try{await r(this,pt).sync()}catch(l){return console.error(l),xt}return Ve},rl=new WeakSet,Cm=function(n,i){r(this,yi).purge==="manual"||r(this,ws).has(n)||i{this.purge(n),r(this,ws).delete(n)}):setTimeout(()=>{this.purge(n),r(this,ws).delete(n)}),r(this,ws).add(n))},wi=new WeakSet,Vs=function(n,i,a=0){const l=!i||-i{const Y=await U.index("version").getAllKeys(IDBKeyRange.bound([n.path,F+1],[n.path,1/0]));for(const Z of Y)U.delete(Z);U.delete([n.path,"purge",0]);for(let Z=0;Z=W)break;const T={path:C.path,offset:q,version:F,data:C.data.subarray(N*l,(N+1)*l)};T.offset===0&&(T.fileSize=W,n.block0=T),U.put(T)}}}})};function zN(t){return new Promise((e,n)=>{const i=globalThis.indexedDB.open(t,5);i.addEventListener("upgradeneeded",function(){i.result.createObjectStore("blocks",{keyPath:["path","offset","version"]}).createIndex("version",["path","version"])}),i.addEventListener("success",()=>{e(i.result)}),i.addEventListener("error",()=>{n(i.error)})})}const KN=""+new URL("wa-sqlite-async-24800831.wasm",import.meta.url).href,JN=new zb({async database(){const t=await DN({locateFile:()=>KN}),e=RN(t),n="wa-sqlite-test";e.vfs_register(new VN(n));const i=await e.open_v2(n,void 0,n);return{sqlite:e,db:i}}});function GN(){console.log("start wa-sqlite test"),Xf(JN).then(t=>{t==null||t.forEach(e=>console.log("[wa-sqlite]",e))})}function XN(t){return{all:t=t||new Map,on:function(e,n){var i=t.get(e);i?i.push(n):t.set(e,[n])},off:function(e,n){var i=t.get(e);i&&(n?i.splice(i.indexOf(n)>>>0,1):t.set(e,[]))},emit:function(e,n){var i=t.get(e);i&&i.slice().map(function(a){a(n)}),(i=t.get("*"))&&i.slice().map(function(a){a(e,n)})}}}function YN(t){const e=XN(t);return{...e,once(n,i){const a=l=>{e.off(n,a),i(l)};e.on(n,a)}}}var zs=YN(),Br,Er,pu,yd,ZN=(yd=class{constructor(t){S(this,Br,void 0);S(this,Er,void 0);Yt(this,"connection");S(this,pu,new e0);P(this,Br,t),P(this,Er,r(this,Br).worker??new Worker(new URL(""+new URL("worker-72ad2512.js",import.meta.url).href,self.location),{type:"module"})),r(this,Er).onmessage=n=>{const{type:i,msg:a}=n.data;zs.emit(i,a)};const e={type:"init",dbName:r(this,Br).dbName,url:r(this,Br).url};r(this,Er).postMessage(e)}async init(){await new Promise((t,e)=>{zs.once("init",n=>{const{err:i}=n;i?e(i):t()})}),this.connection=new t0(r(this,Er)),r(this,Br).onCreateConnection&&await r(this,Br).onCreateConnection(this.connection)}async acquireConnection(){return await r(this,pu).lock(),this.connection}async beginTransaction(t){await t.executeQuery(Qr.raw("begin"))}async commitTransaction(t){await t.executeQuery(Qr.raw("commit"))}async rollbackTransaction(t){await t.executeQuery(Qr.raw("rollback"))}async releaseConnection(){r(this,pu).unlock()}async destroy(){if(r(this,Er))return r(this,Er).postMessage({type:"close"}),new Promise((t,e)=>{zs.once("close",n=>{const{err:i}=n;i?e(i):(r(this,Er).terminate(),zs.all.clear(),zs=null,t())})})}},Br=new WeakMap,Er=new WeakMap,pu=new WeakMap,yd),bs,So,wd,e0=(wd=class{constructor(){S(this,bs,void 0);S(this,So,void 0)}async lock(){for(;r(this,bs);)await r(this,bs);P(this,bs,new Promise(t=>{P(this,So,t)}))}unlock(){const t=r(this,So);P(this,bs,void 0),P(this,So,void 0),t==null||t()}},bs=new WeakMap,So=new WeakMap,wd),mu,gd,t0=(gd=class{constructor(t){S(this,mu,void 0);P(this,mu,t)}streamQuery(){throw new Error("Sqlite driver doesn't support streaming")}async executeQuery(t){const{parameters:e,sql:n,query:i}=t,l={type:"run",isQuery:["SelectQueryNode","RawNode"].includes(i.kind),sql:n,parameters:e};return r(this,mu).postMessage(l),new Promise((m,w)=>{zs.once("run",v=>{const{data:d,err:W}=v;!W&&d?m(d):w(W)})})}},mu=new WeakMap,gd),yu,bd,n0=(bd=class{constructor(t){S(this,yu,void 0);P(this,yu,t)}createDriver(){return new ZN(r(this,yu))}createQueryCompiler(){return new lm}createAdapter(){return new dm}createIntrospector(t){return new fm(t)}},yu=new WeakMap,bd);const r0=""+new URL("wa-sqlite-async-24800831.wasm",import.meta.url).href,i0=new n0({dbName:"wa-sqlite-worker-test",url:r0});function s0(){console.log("start wa-sqlite-worker test"),Xf(i0).then(t=>{t==null||t.forEach(e=>console.log("[wa-sqlite-worker]",e))})}const o0=Ct("h1",null,[ka(" test "),Ct("a",{href:"https://github.com/kysely-org/kysely",target:"_blank"},"Kysely"),ka(" WASM dialect ")],-1),a0=Ct("br",null,null,-1),u0=Ct("h3",null,"see worker result in console",-1),c0=Ct("h3",null,[ka(" you can explore "),Ct("a",{href:"https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API#origin_private_file_system",target:"_blank"}," OPFS "),ka(" file using "),Ct("a",{href:"https://chrome.google.com/webstore/detail/opfs-explorer/acndjpgkpaclldomagafnognkcgjignd",target:"_blank"}," opfs-explorer ")],-1),l0=Ct("br",null,null,-1),f0={class:"buttons"},h0=Ct("br",null,null,-1),d0=Ct("div",null," result run in main thread: ",-1),p0=Hy({__name:"App",setup(t){const e=new bN,{result:n,run:i}=gN(),a=new NN;function l(){i()}function m(){e.postMessage("")}function w(){a.postMessage("")}function v(){GN()}function d(){s0()}async function W(){(await window.indexedDB.databases()).forEach(Y=>{window.indexedDB.deleteDatabase(Y.name)})}async function F(){const U=await navigator.storage.getDirectory();await zh("sqljs"),await zh("sqlijsWorker"),await W();try{await U.removeEntry("test.db")}catch{}try{await U.removeEntry("test.db-journal")}catch{}console.log("clear all")}return(U,Y)=>(Nw(),xw(ur,null,[o0,a0,u0,c0,l0,Ct("div",f0,[Ct("button",{onClick:Y[0]||(Y[0]=Z=>l())}," test sqljs in main thread "),Ct("button",{onClick:Y[1]||(Y[1]=Z=>m())}," test sqljs in Worker "),Ct("button",{onClick:Y[2]||(Y[2]=Z=>w())}," test officialWasm in Worker "),Ct("button",{onClick:Y[3]||(Y[3]=Z=>v())}," test wa-sqlite in main thread "),Ct("button",{onClick:Y[4]||(Y[4]=Z=>d())}," test wa-sqlite in Worker "),Ct("button",{onClick:Y[5]||(Y[5]=Z=>F())}," clear ")]),h0,d0,Ct("pre",null,""+Dm($d(n))+` + `,1)],64))}});ag(p0).mount("#root"); diff --git a/assets/index-c9ae33ff.js b/assets/index-c9ae33ff.js deleted file mode 100644 index 1a3aea8..0000000 --- a/assets/index-c9ae33ff.js +++ /dev/null @@ -1,15 +0,0 @@ -var qm=Object.defineProperty;var Wm=(t,e,n)=>e in t?qm(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Yt=(t,e,n)=>(Wm(t,typeof e!="symbol"?e+"":e,n),n),Tl=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)};var r=(t,e,n)=>(Tl(t,e,"read from private field"),n?n.call(t):e.get(t)),S=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},P=(t,e,n,i)=>(Tl(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n);var qe=(t,e,n)=>(Tl(t,e,"access private method"),n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))i(a);new MutationObserver(a=>{for(const l of a)if(l.type==="childList")for(const m of l.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&i(m)}).observe(document,{childList:!0,subtree:!0});function n(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(a){if(a.ep)return;a.ep=!0;const l=n(a);fetch(a.href,l)}})();function bf(t,e){const n=Object.create(null),i=t.split(",");for(let a=0;a!!n[a.toLowerCase()]:a=>!!n[a]}function Nf(t){if(Ie(t)){const e={};for(let n=0;n{if(n){const i=n.split(Am);i.length>1&&(e[i[0].trim()]=i[1].trim())}}),e}function vf(t){let e="";if(Lt(t))e=t;else if(Ie(t))for(let n=0;nLt(t)?t:t==null?"":Ie(t)||yt(t)&&(t.toString===Ed||!Se(t.toString))?JSON.stringify(t,vd,2):String(t),vd=(t,e)=>e&&e.__v_isRef?vd(t,e.value):eo(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((n,[i,a])=>(n[`${i} =>`]=a,n),{})}:_d(e)?{[`Set(${e.size})`]:[...e.values()]}:yt(e)&&!Ie(e)&&!Cd(e)?String(e):e,lt={},Zs=[],pr=()=>{},Lm=()=>!1,Pm=/^on[^a-z]/,sl=t=>Pm.test(t),_f=t=>t.startsWith("onUpdate:"),on=Object.assign,xf=(t,e)=>{const n=t.indexOf(e);n>-1&&t.splice(n,1)},Mm=Object.prototype.hasOwnProperty,Be=(t,e)=>Mm.call(t,e),Ie=Array.isArray,eo=t=>ol(t)==="[object Map]",_d=t=>ol(t)==="[object Set]",Se=t=>typeof t=="function",Lt=t=>typeof t=="string",Ef=t=>typeof t=="symbol",yt=t=>t!==null&&typeof t=="object",xd=t=>yt(t)&&Se(t.then)&&Se(t.catch),Ed=Object.prototype.toString,ol=t=>Ed.call(t),Bm=t=>ol(t).slice(8,-1),Cd=t=>ol(t)==="[object Object]",Cf=t=>Lt(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Ju=bf(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),al=t=>{const e=Object.create(null);return n=>e[n]||(e[n]=t(n))},Fm=/-(\w)/g,ko=al(t=>t.replace(Fm,(e,n)=>n?n.toUpperCase():"")),Um=/\B([A-Z])/g,$o=al(t=>t.replace(Um,"-$1").toLowerCase()),Od=al(t=>t.charAt(0).toUpperCase()+t.slice(1)),Sl=al(t=>t?`on${Od(t)}`:""),Wa=(t,e)=>!Object.is(t,e),kl=(t,e)=>{for(let n=0;n{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})},$m=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let rh;const Qm=()=>rh||(rh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});let er;class jm{constructor(e=!1){this.detached=e,this._active=!0,this.effects=[],this.cleanups=[],this.parent=er,!e&&er&&(this.index=(er.scopes||(er.scopes=[])).push(this)-1)}get active(){return this._active}run(e){if(this._active){const n=er;try{return er=this,e()}finally{er=n}}}on(){er=this}off(){er=this.parent}stop(e){if(this._active){let n,i;for(n=0,i=this.effects.length;n{const e=new Set(t);return e.w=0,e.n=0,e},qd=t=>(t.w&vi)>0,Wd=t=>(t.n&vi)>0,zm=({deps:t})=>{if(t.length)for(let e=0;e{const{deps:e}=t;if(e.length){let n=0;for(let i=0;i{(W==="length"||W>=v)&&w.push(d)})}else switch(n!==void 0&&w.push(m.get(n)),e){case"add":Ie(t)?Cf(n)&&w.push(m.get("length")):(w.push(m.get(vs)),eo(t)&&w.push(m.get(Vl)));break;case"delete":Ie(t)||(w.push(m.get(vs)),eo(t)&&w.push(m.get(Vl)));break;case"set":eo(t)&&w.push(m.get(vs));break}if(w.length===1)w[0]&&zl(w[0]);else{const v=[];for(const d of w)d&&v.push(...d);zl(Of(v))}}function zl(t,e){const n=Ie(t)?t:[...t];for(const i of n)i.computed&&sh(i);for(const i of n)i.computed||sh(i)}function sh(t,e){(t!==lr||t.allowRecurse)&&(t.scheduler?t.scheduler():t.run())}const Jm=bf("__proto__,__v_isRef,__isVue"),Td=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(Ef)),Gm=Wf(),Xm=Wf(!1,!0),Ym=Wf(!0),oh=Zm();function Zm(){const t={};return["includes","indexOf","lastIndexOf"].forEach(e=>{t[e]=function(...n){const i=Fe(this);for(let l=0,m=this.length;l{t[e]=function(...n){Qo();const i=Fe(this)[e].apply(this,n);return jo(),i}}),t}function ey(t){const e=Fe(this);return xn(e,"has",t),e.hasOwnProperty(t)}function Wf(t=!1,e=!1){return function(i,a,l){if(a==="__v_isReactive")return!t;if(a==="__v_isReadonly")return t;if(a==="__v_isShallow")return e;if(a==="__v_raw"&&l===(t?e?yy:Ld:e?Dd:Rd).get(i))return i;const m=Ie(i);if(!t){if(m&&Be(oh,a))return Reflect.get(oh,a,l);if(a==="hasOwnProperty")return ey}const w=Reflect.get(i,a,l);return(Ef(a)?Td.has(a):Jm(a))||(t||xn(i,"get",a),e)?w:rn(w)?m&&Cf(a)?w:w.value:yt(w)?t?Pd(w):Tf(w):w}}const ty=Sd(),ny=Sd(!0);function Sd(t=!1){return function(n,i,a,l){let m=n[i];if(Ro(m)&&rn(m)&&!rn(a))return!1;if(!t&&(!ac(a)&&!Ro(a)&&(m=Fe(m),a=Fe(a)),!Ie(n)&&rn(m)&&!rn(a)))return m.value=a,!0;const w=Ie(n)&&Cf(i)?Number(i)t,ul=t=>Reflect.getPrototypeOf(t);function Bu(t,e,n=!1,i=!1){t=t.__v_raw;const a=Fe(t),l=Fe(e);n||(e!==l&&xn(a,"get",e),xn(a,"get",l));const{has:m}=ul(a),w=i?If:n?kf:Ia;if(m.call(a,e))return w(t.get(e));if(m.call(a,l))return w(t.get(l));t!==a&&t.get(e)}function Fu(t,e=!1){const n=this.__v_raw,i=Fe(n),a=Fe(t);return e||(t!==a&&xn(i,"has",t),xn(i,"has",a)),t===a?n.has(t):n.has(t)||n.has(a)}function Uu(t,e=!1){return t=t.__v_raw,!e&&xn(Fe(t),"iterate",vs),Reflect.get(t,"size",t)}function ah(t){t=Fe(t);const e=Fe(this);return ul(e).has.call(e,t)||(e.add(t),jr(e,"add",t,t)),this}function uh(t,e){e=Fe(e);const n=Fe(this),{has:i,get:a}=ul(n);let l=i.call(n,t);l||(t=Fe(t),l=i.call(n,t));const m=a.call(n,t);return n.set(t,e),l?Wa(e,m)&&jr(n,"set",t,e):jr(n,"add",t,e),this}function ch(t){const e=Fe(this),{has:n,get:i}=ul(e);let a=n.call(e,t);a||(t=Fe(t),a=n.call(e,t)),i&&i.call(e,t);const l=e.delete(t);return a&&jr(e,"delete",t,void 0),l}function lh(){const t=Fe(this),e=t.size!==0,n=t.clear();return e&&jr(t,"clear",void 0,void 0),n}function $u(t,e){return function(i,a){const l=this,m=l.__v_raw,w=Fe(m),v=e?If:t?kf:Ia;return!t&&xn(w,"iterate",vs),m.forEach((d,W)=>i.call(a,v(d),v(W),l))}}function Qu(t,e,n){return function(...i){const a=this.__v_raw,l=Fe(a),m=eo(l),w=t==="entries"||t===Symbol.iterator&&m,v=t==="keys"&&m,d=a[t](...i),W=n?If:e?kf:Ia;return!e&&xn(l,"iterate",v?Vl:vs),{next(){const{value:B,done:D}=d.next();return D?{value:B,done:D}:{value:w?[W(B[0]),W(B[1])]:W(B),done:D}},[Symbol.iterator](){return this}}}}function ni(t){return function(...e){return t==="delete"?!1:this}}function uy(){const t={get(l){return Bu(this,l)},get size(){return Uu(this)},has:Fu,add:ah,set:uh,delete:ch,clear:lh,forEach:$u(!1,!1)},e={get(l){return Bu(this,l,!1,!0)},get size(){return Uu(this)},has:Fu,add:ah,set:uh,delete:ch,clear:lh,forEach:$u(!1,!0)},n={get(l){return Bu(this,l,!0)},get size(){return Uu(this,!0)},has(l){return Fu.call(this,l,!0)},add:ni("add"),set:ni("set"),delete:ni("delete"),clear:ni("clear"),forEach:$u(!0,!1)},i={get(l){return Bu(this,l,!0,!0)},get size(){return Uu(this,!0)},has(l){return Fu.call(this,l,!0)},add:ni("add"),set:ni("set"),delete:ni("delete"),clear:ni("clear"),forEach:$u(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(l=>{t[l]=Qu(l,!1,!1),n[l]=Qu(l,!0,!1),e[l]=Qu(l,!1,!0),i[l]=Qu(l,!0,!0)}),[t,n,e,i]}const[cy,ly,fy,hy]=uy();function Af(t,e){const n=e?t?hy:fy:t?ly:cy;return(i,a,l)=>a==="__v_isReactive"?!t:a==="__v_isReadonly"?t:a==="__v_raw"?i:Reflect.get(Be(n,a)&&a in i?n:i,a,l)}const dy={get:Af(!1,!1)},py={get:Af(!1,!0)},my={get:Af(!0,!1)},Rd=new WeakMap,Dd=new WeakMap,Ld=new WeakMap,yy=new WeakMap;function wy(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function gy(t){return t.__v_skip||!Object.isExtensible(t)?0:wy(Bm(t))}function Tf(t){return Ro(t)?t:Sf(t,!1,kd,dy,Rd)}function by(t){return Sf(t,!1,ay,py,Dd)}function Pd(t){return Sf(t,!0,oy,my,Ld)}function Sf(t,e,n,i,a){if(!yt(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const l=a.get(t);if(l)return l;const m=gy(t);if(m===0)return t;const w=new Proxy(t,m===2?i:n);return a.set(t,w),w}function to(t){return Ro(t)?to(t.__v_raw):!!(t&&t.__v_isReactive)}function Ro(t){return!!(t&&t.__v_isReadonly)}function ac(t){return!!(t&&t.__v_isShallow)}function Md(t){return to(t)||Ro(t)}function Fe(t){const e=t&&t.__v_raw;return e?Fe(e):t}function Bd(t){return oc(t,"__v_skip",!0),t}const Ia=t=>yt(t)?Tf(t):t,kf=t=>yt(t)?Pd(t):t;function Fd(t){gi&&lr&&(t=Fe(t),Ad(t.dep||(t.dep=Of())))}function Ud(t,e){t=Fe(t);const n=t.dep;n&&zl(n)}function rn(t){return!!(t&&t.__v_isRef===!0)}function Ny(t){return vy(t,!1)}function vy(t,e){return rn(t)?t:new _y(t,e)}class _y{constructor(e,n){this.__v_isShallow=n,this.dep=void 0,this.__v_isRef=!0,this._rawValue=n?e:Fe(e),this._value=n?e:Ia(e)}get value(){return Fd(this),this._value}set value(e){const n=this.__v_isShallow||ac(e)||Ro(e);e=n?e:Fe(e),Wa(e,this._rawValue)&&(this._rawValue=e,this._value=n?e:Ia(e),Ud(this))}}function $d(t){return rn(t)?t.value:t}const xy={get:(t,e,n)=>$d(Reflect.get(t,e,n)),set:(t,e,n,i)=>{const a=t[e];return rn(a)&&!rn(n)?(a.value=n,!0):Reflect.set(t,e,n,i)}};function Qd(t){return to(t)?t:new Proxy(t,xy)}var jd;class Ey{constructor(e,n,i,a){this._setter=n,this.dep=void 0,this.__v_isRef=!0,this[jd]=!1,this._dirty=!0,this.effect=new qf(e,()=>{this._dirty||(this._dirty=!0,Ud(this))}),this.effect.computed=this,this.effect.active=this._cacheable=!a,this.__v_isReadonly=i}get value(){const e=Fe(this);return Fd(e),(e._dirty||!e._cacheable)&&(e._dirty=!1,e._value=e.effect.run()),e._value}set value(e){this._setter(e)}}jd="__v_isReadonly";function Cy(t,e,n=!1){let i,a;const l=Se(t);return l?(i=t,a=pr):(i=t.get,a=t.set),new Ey(i,a,l||!a,n)}function bi(t,e,n,i){let a;try{a=i?t(...i):t()}catch(l){cl(l,e,n)}return a}function Hn(t,e,n,i){if(Se(t)){const l=bi(t,e,n,i);return l&&xd(l)&&l.catch(m=>{cl(m,e,n)}),l}const a=[];for(let l=0;l>>1;Ta(nn[i])qr&&nn.splice(e,1)}function Ay(t){Ie(t)?no.push(...t):(!Rr||!Rr.includes(t,t.allowRecurse?Ki+1:Ki))&&no.push(t),Vd()}function fh(t,e=Aa?qr+1:0){for(;eTa(n)-Ta(i)),Ki=0;Kit.id==null?1/0:t.id,Ty=(t,e)=>{const n=Ta(t)-Ta(e);if(n===0){if(t.pre&&!e.pre)return-1;if(e.pre&&!t.pre)return 1}return n};function Kd(t){Kl=!1,Aa=!0,nn.sort(Ty);const e=pr;try{for(qr=0;qrLt(ne)?ne.trim():ne)),B&&(a=n.map($m))}let w,v=i[w=Sl(e)]||i[w=Sl(ko(e))];!v&&l&&(v=i[w=Sl($o(e))]),v&&Hn(v,t,6,a);const d=i[w+"Once"];if(d){if(!t.emitted)t.emitted={};else if(t.emitted[w])return;t.emitted[w]=!0,Hn(d,t,6,a)}}function Jd(t,e,n=!1){const i=e.emitsCache,a=i.get(t);if(a!==void 0)return a;const l=t.emits;let m={},w=!1;if(!Se(t)){const v=d=>{const W=Jd(d,e,!0);W&&(w=!0,on(m,W))};!n&&e.mixins.length&&e.mixins.forEach(v),t.extends&&v(t.extends),t.mixins&&t.mixins.forEach(v)}return!l&&!w?(yt(t)&&i.set(t,null),null):(Ie(l)?l.forEach(v=>m[v]=null):on(m,l),yt(t)&&i.set(t,m),m)}function ll(t,e){return!t||!sl(e)?!1:(e=e.slice(2).replace(/Once$/,""),Be(t,e[0].toLowerCase()+e.slice(1))||Be(t,$o(e))||Be(t,e))}let fr=null,Gd=null;function uc(t){const e=fr;return fr=t,Gd=t&&t.type.__scopeId||null,e}function ky(t,e=fr,n){if(!e||t._n)return t;const i=(...a)=>{i._d&&Nh(-1);const l=uc(e);let m;try{m=t(...a)}finally{uc(l),i._d&&Nh(1)}return m};return i._n=!0,i._c=!0,i._d=!0,i}function Rl(t){const{type:e,vnode:n,proxy:i,withProxy:a,props:l,propsOptions:[m],slots:w,attrs:v,emit:d,render:W,renderCache:B,data:D,setupState:ne,ctx:te,inheritAttrs:b}=t;let C,N;const q=uc(t);try{if(n.shapeFlag&4){const ee=a||i;C=Cr(W.call(ee,ee,B,l,ne,D,te)),N=v}else{const ee=e;C=Cr(ee.length>1?ee(l,{attrs:v,slots:w,emit:d}):ee(l,null)),N=e.props?v:Ry(v)}}catch(ee){Na.length=0,cl(ee,t,1),C=_s(Fr)}let T=C;if(N&&b!==!1){const ee=Object.keys(N),{shapeFlag:Ne}=T;ee.length&&Ne&7&&(m&&ee.some(_f)&&(N=Dy(N,m)),T=_i(T,N))}return n.dirs&&(T=_i(T),T.dirs=T.dirs?T.dirs.concat(n.dirs):n.dirs),n.transition&&(T.transition=n.transition),C=T,uc(q),C}const Ry=t=>{let e;for(const n in t)(n==="class"||n==="style"||sl(n))&&((e||(e={}))[n]=t[n]);return e},Dy=(t,e)=>{const n={};for(const i in t)(!_f(i)||!(i.slice(9)in e))&&(n[i]=t[i]);return n};function Ly(t,e,n){const{props:i,children:a,component:l}=t,{props:m,children:w,patchFlag:v}=e,d=l.emitsOptions;if(e.dirs||e.transition)return!0;if(n&&v>=0){if(v&1024)return!0;if(v&16)return i?hh(i,m,d):!!m;if(v&8){const W=e.dynamicProps;for(let B=0;Bt.__isSuspense;function By(t,e){e&&e.pendingBranch?Ie(t)?e.effects.push(...t):e.effects.push(t):Ay(t)}function Fy(t,e){if(Ot){let n=Ot.provides;const i=Ot.parent&&Ot.parent.provides;i===n&&(n=Ot.provides=Object.create(i)),n[t]=e}}function Gu(t,e,n=!1){const i=Ot||fr;if(i){const a=i.parent==null?i.vnode.appContext&&i.vnode.appContext.provides:i.parent.provides;if(a&&t in a)return a[t];if(arguments.length>1)return n&&Se(e)?e.call(i.proxy):e}}const ju={};function Dl(t,e,n){return Xd(t,e,n)}function Xd(t,e,{immediate:n,deep:i,flush:a,onTrack:l,onTrigger:m}=lt){const w=Vm()===(Ot==null?void 0:Ot.scope)?Ot:null;let v,d=!1,W=!1;if(rn(t)?(v=()=>t.value,d=ac(t)):to(t)?(v=()=>t,i=!0):Ie(t)?(W=!0,d=t.some(T=>to(T)||ac(T)),v=()=>t.map(T=>{if(rn(T))return T.value;if(to(T))return Ks(T);if(Se(T))return bi(T,w,2)})):Se(t)?e?v=()=>bi(t,w,2):v=()=>{if(!(w&&w.isUnmounted))return B&&B(),Hn(t,w,3,[D])}:v=pr,e&&i){const T=v;v=()=>Ks(T())}let B,D=T=>{B=N.onStop=()=>{bi(T,w,4)}},ne;if(Ra)if(D=pr,e?n&&Hn(e,w,3,[v(),W?[]:void 0,D]):v(),a==="sync"){const T=Bw();ne=T.__watcherHandles||(T.__watcherHandles=[])}else return pr;let te=W?new Array(t.length).fill(ju):ju;const b=()=>{if(N.active)if(e){const T=N.run();(i||d||(W?T.some((ee,Ne)=>Wa(ee,te[Ne])):Wa(T,te)))&&(B&&B(),Hn(e,w,3,[T,te===ju?void 0:W&&te[0]===ju?[]:te,D]),te=T)}else N.run()};b.allowRecurse=!!e;let C;a==="sync"?C=b:a==="post"?C=()=>bn(b,w&&w.suspense):(b.pre=!0,w&&(b.id=w.uid),C=()=>Df(b));const N=new qf(v,C);e?n?b():te=N.run():a==="post"?bn(N.run.bind(N),w&&w.suspense):N.run();const q=()=>{N.stop(),w&&w.scope&&xf(w.scope.effects,N)};return ne&&ne.push(q),q}function Uy(t,e,n){const i=this.proxy,a=Lt(t)?t.includes(".")?Yd(i,t):()=>i[t]:t.bind(i,i);let l;Se(e)?l=e:(l=e.handler,n=e);const m=Ot;Do(this);const w=Xd(a,l.bind(i),n);return m?Do(m):xs(),w}function Yd(t,e){const n=e.split(".");return()=>{let i=t;for(let a=0;a{Ks(n,e)});else if(Cd(t))for(const n in t)Ks(t[n],e);return t}function $y(){const t={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return np(()=>{t.isMounted=!0}),rp(()=>{t.isUnmounting=!0}),t}const Fn=[Function,Array],Qy={name:"BaseTransition",props:{mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Fn,onEnter:Fn,onAfterEnter:Fn,onEnterCancelled:Fn,onBeforeLeave:Fn,onLeave:Fn,onAfterLeave:Fn,onLeaveCancelled:Fn,onBeforeAppear:Fn,onAppear:Fn,onAfterAppear:Fn,onAppearCancelled:Fn},setup(t,{slots:e}){const n=Tw(),i=$y();let a;return()=>{const l=e.default&&ep(e.default(),!0);if(!l||!l.length)return;let m=l[0];if(l.length>1){for(const b of l)if(b.type!==Fr){m=b;break}}const w=Fe(t),{mode:v}=w;if(i.isLeaving)return Ll(m);const d=dh(m);if(!d)return Ll(m);const W=Jl(d,w,i,n);Gl(d,W);const B=n.subTree,D=B&&dh(B);let ne=!1;const{getTransitionKey:te}=d.type;if(te){const b=te();a===void 0?a=b:b!==a&&(a=b,ne=!0)}if(D&&D.type!==Fr&&(!Ji(d,D)||ne)){const b=Jl(D,w,i,n);if(Gl(D,b),v==="out-in")return i.isLeaving=!0,b.afterLeave=()=>{i.isLeaving=!1,n.update.active!==!1&&n.update()},Ll(m);v==="in-out"&&d.type!==Fr&&(b.delayLeave=(C,N,q)=>{const T=Zd(i,D);T[String(D.key)]=D,C._leaveCb=()=>{N(),C._leaveCb=void 0,delete W.delayedLeave},W.delayedLeave=q})}return m}}},jy=Qy;function Zd(t,e){const{leavingVNodes:n}=t;let i=n.get(e.type);return i||(i=Object.create(null),n.set(e.type,i)),i}function Jl(t,e,n,i){const{appear:a,mode:l,persisted:m=!1,onBeforeEnter:w,onEnter:v,onAfterEnter:d,onEnterCancelled:W,onBeforeLeave:B,onLeave:D,onAfterLeave:ne,onLeaveCancelled:te,onBeforeAppear:b,onAppear:C,onAfterAppear:N,onAppearCancelled:q}=e,T=String(t.key),ee=Zd(n,t),Ne=(xe,tt)=>{xe&&Hn(xe,i,9,tt)},ae=(xe,tt)=>{const ze=tt[1];Ne(xe,tt),Ie(xe)?xe.every(qt=>qt.length<=1)&&ze():xe.length<=1&&ze()},_e={mode:l,persisted:m,beforeEnter(xe){let tt=w;if(!n.isMounted)if(a)tt=b||w;else return;xe._leaveCb&&xe._leaveCb(!0);const ze=ee[T];ze&&Ji(t,ze)&&ze.el._leaveCb&&ze.el._leaveCb(),Ne(tt,[xe])},enter(xe){let tt=v,ze=d,qt=W;if(!n.isMounted)if(a)tt=C||v,ze=N||d,qt=q||W;else return;let Wt=!1;const Qe=xe._enterCb=Kt=>{Wt||(Wt=!0,Kt?Ne(qt,[xe]):Ne(ze,[xe]),_e.delayedLeave&&_e.delayedLeave(),xe._enterCb=void 0)};tt?ae(tt,[xe,Qe]):Qe()},leave(xe,tt){const ze=String(t.key);if(xe._enterCb&&xe._enterCb(!0),n.isUnmounting)return tt();Ne(B,[xe]);let qt=!1;const Wt=xe._leaveCb=Qe=>{qt||(qt=!0,tt(),Qe?Ne(te,[xe]):Ne(ne,[xe]),xe._leaveCb=void 0,ee[ze]===t&&delete ee[ze])};ee[ze]=t,D?ae(D,[xe,Wt]):Wt()},clone(xe){return Jl(xe,e,n,i)}};return _e}function Ll(t){if(fl(t))return t=_i(t),t.children=null,t}function dh(t){return fl(t)?t.children?t.children[0]:void 0:t}function Gl(t,e){t.shapeFlag&6&&t.component?Gl(t.component.subTree,e):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function ep(t,e=!1,n){let i=[],a=0;for(let l=0;l1)for(let l=0;l!!t.type.__asyncLoader,fl=t=>t.type.__isKeepAlive;function Vy(t,e){tp(t,"a",e)}function zy(t,e){tp(t,"da",e)}function tp(t,e,n=Ot){const i=t.__wdc||(t.__wdc=()=>{let a=n;for(;a;){if(a.isDeactivated)return;a=a.parent}return t()});if(hl(e,i,n),n){let a=n.parent;for(;a&&a.parent;)fl(a.parent.vnode)&&Ky(i,e,n,a),a=a.parent}}function Ky(t,e,n,i){const a=hl(e,t,i,!0);ip(()=>{xf(i[e],a)},n)}function hl(t,e,n=Ot,i=!1){if(n){const a=n[t]||(n[t]=[]),l=e.__weh||(e.__weh=(...m)=>{if(n.isUnmounted)return;Qo(),Do(n);const w=Hn(e,n,t,m);return xs(),jo(),w});return i?a.unshift(l):a.push(l),l}}const Vr=t=>(e,n=Ot)=>(!Ra||t==="sp")&&hl(t,(...i)=>e(...i),n),Jy=Vr("bm"),np=Vr("m"),Gy=Vr("bu"),Xy=Vr("u"),rp=Vr("bum"),ip=Vr("um"),Yy=Vr("sp"),Zy=Vr("rtg"),ew=Vr("rtc");function tw(t,e=Ot){hl("ec",t,e)}function ji(t,e,n,i){const a=t.dirs,l=e&&e.dirs;for(let m=0;mt?pp(t)?Bf(t)||t.proxy:Xl(t.parent):null,ba=on(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>Xl(t.parent),$root:t=>Xl(t.root),$emit:t=>t.emit,$options:t=>Lf(t),$forceUpdate:t=>t.f||(t.f=()=>Df(t.update)),$nextTick:t=>t.n||(t.n=qy.bind(t.proxy)),$watch:t=>Uy.bind(t)}),Pl=(t,e)=>t!==lt&&!t.__isScriptSetup&&Be(t,e),rw={get({_:t},e){const{ctx:n,setupState:i,data:a,props:l,accessCache:m,type:w,appContext:v}=t;let d;if(e[0]!=="$"){const ne=m[e];if(ne!==void 0)switch(ne){case 1:return i[e];case 2:return a[e];case 4:return n[e];case 3:return l[e]}else{if(Pl(i,e))return m[e]=1,i[e];if(a!==lt&&Be(a,e))return m[e]=2,a[e];if((d=t.propsOptions[0])&&Be(d,e))return m[e]=3,l[e];if(n!==lt&&Be(n,e))return m[e]=4,n[e];Yl&&(m[e]=0)}}const W=ba[e];let B,D;if(W)return e==="$attrs"&&xn(t,"get",e),W(t);if((B=w.__cssModules)&&(B=B[e]))return B;if(n!==lt&&Be(n,e))return m[e]=4,n[e];if(D=v.config.globalProperties,Be(D,e))return D[e]},set({_:t},e,n){const{data:i,setupState:a,ctx:l}=t;return Pl(a,e)?(a[e]=n,!0):i!==lt&&Be(i,e)?(i[e]=n,!0):Be(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(l[e]=n,!0)},has({_:{data:t,setupState:e,accessCache:n,ctx:i,appContext:a,propsOptions:l}},m){let w;return!!n[m]||t!==lt&&Be(t,m)||Pl(e,m)||(w=l[0])&&Be(w,m)||Be(i,m)||Be(ba,m)||Be(a.config.globalProperties,m)},defineProperty(t,e,n){return n.get!=null?t._.accessCache[e]=0:Be(n,"value")&&this.set(t,e,n.value,null),Reflect.defineProperty(t,e,n)}};let Yl=!0;function iw(t){const e=Lf(t),n=t.proxy,i=t.ctx;Yl=!1,e.beforeCreate&&ph(e.beforeCreate,t,"bc");const{data:a,computed:l,methods:m,watch:w,provide:v,inject:d,created:W,beforeMount:B,mounted:D,beforeUpdate:ne,updated:te,activated:b,deactivated:C,beforeDestroy:N,beforeUnmount:q,destroyed:T,unmounted:ee,render:Ne,renderTracked:ae,renderTriggered:_e,errorCaptured:xe,serverPrefetch:tt,expose:ze,inheritAttrs:qt,components:Wt,directives:Qe,filters:Kt}=e;if(d&&sw(d,i,null,t.appContext.config.unwrapInjectedRef),m)for(const ge in m){const Oe=m[ge];Se(Oe)&&(i[ge]=Oe.bind(n))}if(a){const ge=a.call(n,n);yt(ge)&&(t.data=Tf(ge))}if(Yl=!0,l)for(const ge in l){const Oe=l[ge],ut=Se(Oe)?Oe.bind(n,n):Se(Oe.get)?Oe.get.bind(n,n):pr,we=!Se(Oe)&&Se(Oe.set)?Oe.set.bind(n):pr,Re=Pw({get:ut,set:we});Object.defineProperty(i,ge,{enumerable:!0,configurable:!0,get:()=>Re.value,set:Pt=>Re.value=Pt})}if(w)for(const ge in w)sp(w[ge],i,n,ge);if(v){const ge=Se(v)?v.call(n):v;Reflect.ownKeys(ge).forEach(Oe=>{Fy(Oe,ge[Oe])})}W&&ph(W,t,"c");function wt(ge,Oe){Ie(Oe)?Oe.forEach(ut=>ge(ut.bind(n))):Oe&&ge(Oe.bind(n))}if(wt(Jy,B),wt(np,D),wt(Gy,ne),wt(Xy,te),wt(Vy,b),wt(zy,C),wt(tw,xe),wt(ew,ae),wt(Zy,_e),wt(rp,q),wt(ip,ee),wt(Yy,tt),Ie(ze))if(ze.length){const ge=t.exposed||(t.exposed={});ze.forEach(Oe=>{Object.defineProperty(ge,Oe,{get:()=>n[Oe],set:ut=>n[Oe]=ut})})}else t.exposed||(t.exposed={});Ne&&t.render===pr&&(t.render=Ne),qt!=null&&(t.inheritAttrs=qt),Wt&&(t.components=Wt),Qe&&(t.directives=Qe)}function sw(t,e,n=pr,i=!1){Ie(t)&&(t=Zl(t));for(const a in t){const l=t[a];let m;yt(l)?"default"in l?m=Gu(l.from||a,l.default,!0):m=Gu(l.from||a):m=Gu(l),rn(m)&&i?Object.defineProperty(e,a,{enumerable:!0,configurable:!0,get:()=>m.value,set:w=>m.value=w}):e[a]=m}}function ph(t,e,n){Hn(Ie(t)?t.map(i=>i.bind(e.proxy)):t.bind(e.proxy),e,n)}function sp(t,e,n,i){const a=i.includes(".")?Yd(n,i):()=>n[i];if(Lt(t)){const l=e[t];Se(l)&&Dl(a,l)}else if(Se(t))Dl(a,t.bind(n));else if(yt(t))if(Ie(t))t.forEach(l=>sp(l,e,n,i));else{const l=Se(t.handler)?t.handler.bind(n):e[t.handler];Se(l)&&Dl(a,l,t)}}function Lf(t){const e=t.type,{mixins:n,extends:i}=e,{mixins:a,optionsCache:l,config:{optionMergeStrategies:m}}=t.appContext,w=l.get(e);let v;return w?v=w:!a.length&&!n&&!i?v=e:(v={},a.length&&a.forEach(d=>cc(v,d,m,!0)),cc(v,e,m)),yt(e)&&l.set(e,v),v}function cc(t,e,n,i=!1){const{mixins:a,extends:l}=e;l&&cc(t,l,n,!0),a&&a.forEach(m=>cc(t,m,n,!0));for(const m in e)if(!(i&&m==="expose")){const w=ow[m]||n&&n[m];t[m]=w?w(t[m],e[m]):e[m]}return t}const ow={data:mh,props:zi,emits:zi,methods:zi,computed:zi,beforeCreate:un,created:un,beforeMount:un,mounted:un,beforeUpdate:un,updated:un,beforeDestroy:un,beforeUnmount:un,destroyed:un,unmounted:un,activated:un,deactivated:un,errorCaptured:un,serverPrefetch:un,components:zi,directives:zi,watch:uw,provide:mh,inject:aw};function mh(t,e){return e?t?function(){return on(Se(t)?t.call(this,this):t,Se(e)?e.call(this,this):e)}:e:t}function aw(t,e){return zi(Zl(t),Zl(e))}function Zl(t){if(Ie(t)){const e={};for(let n=0;n0)&&!(m&16)){if(m&8){const W=t.vnode.dynamicProps;for(let B=0;B{v=!0;const[D,ne]=ap(B,e,!0);on(m,D),ne&&w.push(...ne)};!n&&e.mixins.length&&e.mixins.forEach(W),t.extends&&W(t.extends),t.mixins&&t.mixins.forEach(W)}if(!l&&!v)return yt(t)&&i.set(t,Zs),Zs;if(Ie(l))for(let W=0;W-1,ne[1]=b<0||te-1||Be(ne,"default"))&&w.push(B)}}}const d=[m,w];return yt(t)&&i.set(t,d),d}function yh(t){return t[0]!=="$"}function wh(t){const e=t&&t.toString().match(/^\s*(function|class) (\w+)/);return e?e[2]:t===null?"null":""}function gh(t,e){return wh(t)===wh(e)}function bh(t,e){return Ie(e)?e.findIndex(n=>gh(n,t)):Se(e)&&gh(e,t)?0:-1}const up=t=>t[0]==="_"||t==="$stable",Pf=t=>Ie(t)?t.map(Cr):[Cr(t)],fw=(t,e,n)=>{if(e._n)return e;const i=ky((...a)=>Pf(e(...a)),n);return i._c=!1,i},cp=(t,e,n)=>{const i=t._ctx;for(const a in t){if(up(a))continue;const l=t[a];if(Se(l))e[a]=fw(a,l,i);else if(l!=null){const m=Pf(l);e[a]=()=>m}}},lp=(t,e)=>{const n=Pf(e);t.slots.default=()=>n},hw=(t,e)=>{if(t.vnode.shapeFlag&32){const n=e._;n?(t.slots=Fe(e),oc(e,"_",n)):cp(e,t.slots={})}else t.slots={},e&&lp(t,e);oc(t.slots,pl,1)},dw=(t,e,n)=>{const{vnode:i,slots:a}=t;let l=!0,m=lt;if(i.shapeFlag&32){const w=e._;w?n&&w===1?l=!1:(on(a,e),!n&&w===1&&delete a._):(l=!e.$stable,cp(e,a)),m=e}else e&&(lp(t,e),m={default:1});if(l)for(const w in a)!up(w)&&!(w in m)&&delete a[w]};function fp(){return{app:null,config:{isNativeTag:Lm,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let pw=0;function mw(t,e){return function(i,a=null){Se(i)||(i=Object.assign({},i)),a!=null&&!yt(a)&&(a=null);const l=fp(),m=new Set;let w=!1;const v=l.app={_uid:pw++,_component:i,_props:a,_container:null,_context:l,_instance:null,version:Fw,get config(){return l.config},set config(d){},use(d,...W){return m.has(d)||(d&&Se(d.install)?(m.add(d),d.install(v,...W)):Se(d)&&(m.add(d),d(v,...W))),v},mixin(d){return l.mixins.includes(d)||l.mixins.push(d),v},component(d,W){return W?(l.components[d]=W,v):l.components[d]},directive(d,W){return W?(l.directives[d]=W,v):l.directives[d]},mount(d,W,B){if(!w){const D=_s(i,a);return D.appContext=l,W&&e?e(D,d):t(D,d,B),w=!0,v._container=d,d.__vue_app__=v,Bf(D.component)||D.component.proxy}},unmount(){w&&(t(null,v._container),delete v._container.__vue_app__)},provide(d,W){return l.provides[d]=W,v}};return v}}function tf(t,e,n,i,a=!1){if(Ie(t)){t.forEach((D,ne)=>tf(D,e&&(Ie(e)?e[ne]:e),n,i,a));return}if(Xu(i)&&!a)return;const l=i.shapeFlag&4?Bf(i.component)||i.component.proxy:i.el,m=a?null:l,{i:w,r:v}=t,d=e&&e.r,W=w.refs===lt?w.refs={}:w.refs,B=w.setupState;if(d!=null&&d!==v&&(Lt(d)?(W[d]=null,Be(B,d)&&(B[d]=null)):rn(d)&&(d.value=null)),Se(v))bi(v,w,12,[m,W]);else{const D=Lt(v),ne=rn(v);if(D||ne){const te=()=>{if(t.f){const b=D?Be(B,v)?B[v]:W[v]:v.value;a?Ie(b)&&xf(b,l):Ie(b)?b.includes(l)||b.push(l):D?(W[v]=[l],Be(B,v)&&(B[v]=W[v])):(v.value=[l],t.k&&(W[t.k]=v.value))}else D?(W[v]=m,Be(B,v)&&(B[v]=m)):ne&&(v.value=m,t.k&&(W[t.k]=m))};m?(te.id=-1,bn(te,n)):te()}}}const bn=By;function yw(t){return ww(t)}function ww(t,e){const n=Qm();n.__VUE__=!0;const{insert:i,remove:a,patchProp:l,createElement:m,createText:w,createComment:v,setText:d,setElementText:W,parentNode:B,nextSibling:D,setScopeId:ne=pr,insertStaticContent:te}=t,b=(x,O,R,F=null,K=null,Y=null,j=!1,z=null,re=!!O.dynamicChildren)=>{if(x===O)return;x&&!Ji(x,O)&&(F=fe(x),Pt(x,K,Y,!0),x=null),O.patchFlag===-2&&(re=!1,O.dynamicChildren=null);const{type:J,ref:ce,shapeFlag:oe}=O;switch(J){case dl:C(x,O,R,F);break;case Fr:N(x,O,R,F);break;case Ml:x==null&&q(O,R,F,j);break;case cr:Wt(x,O,R,F,K,Y,j,z,re);break;default:oe&1?Ne(x,O,R,F,K,Y,j,z,re):oe&6?Qe(x,O,R,F,K,Y,j,z,re):(oe&64||oe&128)&&J.process(x,O,R,F,K,Y,j,z,re,zn)}ce!=null&&K&&tf(ce,x&&x.ref,Y,O||x,!O)},C=(x,O,R,F)=>{if(x==null)i(O.el=w(O.children),R,F);else{const K=O.el=x.el;O.children!==x.children&&d(K,O.children)}},N=(x,O,R,F)=>{x==null?i(O.el=v(O.children||""),R,F):O.el=x.el},q=(x,O,R,F)=>{[x.el,x.anchor]=te(x.children,O,R,F,x.el,x.anchor)},T=({el:x,anchor:O},R,F)=>{let K;for(;x&&x!==O;)K=D(x),i(x,R,F),x=K;i(O,R,F)},ee=({el:x,anchor:O})=>{let R;for(;x&&x!==O;)R=D(x),a(x),x=R;a(O)},Ne=(x,O,R,F,K,Y,j,z,re)=>{j=j||O.type==="svg",x==null?ae(O,R,F,K,Y,j,z,re):tt(x,O,K,Y,j,z,re)},ae=(x,O,R,F,K,Y,j,z)=>{let re,J;const{type:ce,props:oe,shapeFlag:ue,transition:be,dirs:Ee}=x;if(re=x.el=m(x.type,Y,oe&&oe.is,oe),ue&8?W(re,x.children):ue&16&&xe(x.children,re,null,F,K,Y&&ce!=="foreignObject",j,z),Ee&&ji(x,null,F,"created"),_e(re,x,x.scopeId,j,F),oe){for(const Le in oe)Le!=="value"&&!Ju(Le)&&l(re,Le,null,oe[Le],Y,x.children,F,K,pn);"value"in oe&&l(re,"value",null,oe.value),(J=oe.onVnodeBeforeMount)&&br(J,F,x)}Ee&&ji(x,null,F,"beforeMount");const je=(!K||K&&!K.pendingBranch)&&be&&!be.persisted;je&&be.beforeEnter(re),i(re,O,R),((J=oe&&oe.onVnodeMounted)||je||Ee)&&bn(()=>{J&&br(J,F,x),je&&be.enter(re),Ee&&ji(x,null,F,"mounted")},K)},_e=(x,O,R,F,K)=>{if(R&&ne(x,R),F)for(let Y=0;Y{for(let J=re;J{const z=O.el=x.el;let{patchFlag:re,dynamicChildren:J,dirs:ce}=O;re|=x.patchFlag&16;const oe=x.props||lt,ue=O.props||lt;let be;R&&Hi(R,!1),(be=ue.onVnodeBeforeUpdate)&&br(be,R,O,x),ce&&ji(O,x,R,"beforeUpdate"),R&&Hi(R,!0);const Ee=K&&O.type!=="foreignObject";if(J?ze(x.dynamicChildren,J,z,R,F,Ee,Y):j||Oe(x,O,z,null,R,F,Ee,Y,!1),re>0){if(re&16)qt(z,O,oe,ue,R,F,K);else if(re&2&&oe.class!==ue.class&&l(z,"class",null,ue.class,K),re&4&&l(z,"style",oe.style,ue.style,K),re&8){const je=O.dynamicProps;for(let Le=0;Le{be&&br(be,R,O,x),ce&&ji(O,x,R,"updated")},F)},ze=(x,O,R,F,K,Y,j)=>{for(let z=0;z{if(R!==F){if(R!==lt)for(const z in R)!Ju(z)&&!(z in F)&&l(x,z,R[z],null,j,O.children,K,Y,pn);for(const z in F){if(Ju(z))continue;const re=F[z],J=R[z];re!==J&&z!=="value"&&l(x,z,J,re,j,O.children,K,Y,pn)}"value"in F&&l(x,"value",R.value,F.value)}},Wt=(x,O,R,F,K,Y,j,z,re)=>{const J=O.el=x?x.el:w(""),ce=O.anchor=x?x.anchor:w("");let{patchFlag:oe,dynamicChildren:ue,slotScopeIds:be}=O;be&&(z=z?z.concat(be):be),x==null?(i(J,R,F),i(ce,R,F),xe(O.children,R,ce,K,Y,j,z,re)):oe>0&&oe&64&&ue&&x.dynamicChildren?(ze(x.dynamicChildren,ue,R,K,Y,j,z),(O.key!=null||K&&O===K.subTree)&&hp(x,O,!0)):Oe(x,O,R,ce,K,Y,j,z,re)},Qe=(x,O,R,F,K,Y,j,z,re)=>{O.slotScopeIds=z,x==null?O.shapeFlag&512?K.ctx.activate(O,R,F,j,re):Kt(O,R,F,K,Y,j,re):dn(x,O,re)},Kt=(x,O,R,F,K,Y,j)=>{const z=x.component=Aw(x,F,K);if(fl(x)&&(z.ctx.renderer=zn),Sw(z),z.asyncDep){if(K&&K.registerDep(z,wt),!x.el){const re=z.subTree=_s(Fr);N(null,re,O,R)}return}wt(z,x,O,R,K,Y,j)},dn=(x,O,R)=>{const F=O.component=x.component;if(Ly(x,O,R))if(F.asyncDep&&!F.asyncResolved){ge(F,O,R);return}else F.next=O,Iy(F.update),F.update();else O.el=x.el,F.vnode=O},wt=(x,O,R,F,K,Y,j)=>{const z=()=>{if(x.isMounted){let{next:ce,bu:oe,u:ue,parent:be,vnode:Ee}=x,je=ce,Le;Hi(x,!1),ce?(ce.el=Ee.el,ge(x,ce,j)):ce=Ee,oe&&kl(oe),(Le=ce.props&&ce.props.onVnodeBeforeUpdate)&&br(Le,be,ce,Ee),Hi(x,!0);const it=Rl(x),me=x.subTree;x.subTree=it,b(me,it,B(me.el),fe(me),x,K,Y),ce.el=it.el,je===null&&Py(x,it.el),ue&&bn(ue,K),(Le=ce.props&&ce.props.onVnodeUpdated)&&bn(()=>br(Le,be,ce,Ee),K)}else{let ce;const{el:oe,props:ue}=O,{bm:be,m:Ee,parent:je}=x,Le=Xu(O);if(Hi(x,!1),be&&kl(be),!Le&&(ce=ue&&ue.onVnodeBeforeMount)&&br(ce,je,O),Hi(x,!0),oe&&Ke){const it=()=>{x.subTree=Rl(x),Ke(oe,x.subTree,x,K,null)};Le?O.type.__asyncLoader().then(()=>!x.isUnmounted&&it()):it()}else{const it=x.subTree=Rl(x);b(null,it,R,F,x,K,Y),O.el=it.el}if(Ee&&bn(Ee,K),!Le&&(ce=ue&&ue.onVnodeMounted)){const it=O;bn(()=>br(ce,je,it),K)}(O.shapeFlag&256||je&&Xu(je.vnode)&&je.vnode.shapeFlag&256)&&x.a&&bn(x.a,K),x.isMounted=!0,O=R=F=null}},re=x.effect=new qf(z,()=>Df(J),x.scope),J=x.update=()=>re.run();J.id=x.uid,Hi(x,!0),J()},ge=(x,O,R)=>{O.component=x;const F=x.vnode.props;x.vnode=O,x.next=null,lw(x,O.props,F,R),dw(x,O.children,R),Qo(),fh(),jo()},Oe=(x,O,R,F,K,Y,j,z,re=!1)=>{const J=x&&x.children,ce=x?x.shapeFlag:0,oe=O.children,{patchFlag:ue,shapeFlag:be}=O;if(ue>0){if(ue&128){we(J,oe,R,F,K,Y,j,z,re);return}else if(ue&256){ut(J,oe,R,F,K,Y,j,z,re);return}}be&8?(ce&16&&pn(J,K,Y),oe!==J&&W(R,oe)):ce&16?be&16?we(J,oe,R,F,K,Y,j,z,re):pn(J,K,Y,!0):(ce&8&&W(R,""),be&16&&xe(oe,R,F,K,Y,j,z,re))},ut=(x,O,R,F,K,Y,j,z,re)=>{x=x||Zs,O=O||Zs;const J=x.length,ce=O.length,oe=Math.min(J,ce);let ue;for(ue=0;uece?pn(x,K,Y,!0,!1,oe):xe(O,R,F,K,Y,j,z,re,oe)},we=(x,O,R,F,K,Y,j,z,re)=>{let J=0;const ce=O.length;let oe=x.length-1,ue=ce-1;for(;J<=oe&&J<=ue;){const be=x[J],Ee=O[J]=re?si(O[J]):Cr(O[J]);if(Ji(be,Ee))b(be,Ee,R,null,K,Y,j,z,re);else break;J++}for(;J<=oe&&J<=ue;){const be=x[oe],Ee=O[ue]=re?si(O[ue]):Cr(O[ue]);if(Ji(be,Ee))b(be,Ee,R,null,K,Y,j,z,re);else break;oe--,ue--}if(J>oe){if(J<=ue){const be=ue+1,Ee=beue)for(;J<=oe;)Pt(x[J],K,Y,!0),J++;else{const be=J,Ee=J,je=new Map;for(J=Ee;J<=ue;J++){const le=O[J]=re?si(O[J]):Cr(O[J]);le.key!=null&&je.set(le.key,J)}let Le,it=0;const me=ue-Ee+1;let Cn=!1,Ci=0;const Gt=new Array(me);for(J=0;J=me){Pt(le,K,Y,!0);continue}let Mt;if(le.key!=null)Mt=je.get(le.key);else for(Le=Ee;Le<=ue;Le++)if(Gt[Le-Ee]===0&&Ji(le,O[Le])){Mt=Le;break}Mt===void 0?Pt(le,K,Y,!0):(Gt[Mt-Ee]=J+1,Mt>=Ci?Ci=Mt:Cn=!0,b(le,O[Mt],R,null,K,Y,j,z,re),it++)}const Os=Cn?gw(Gt):Zs;for(Le=Os.length-1,J=me-1;J>=0;J--){const le=Ee+J,Mt=O[le],Z=le+1{const{el:Y,type:j,transition:z,children:re,shapeFlag:J}=x;if(J&6){Re(x.component.subTree,O,R,F);return}if(J&128){x.suspense.move(O,R,F);return}if(J&64){j.move(x,O,R,zn);return}if(j===cr){i(Y,O,R);for(let oe=0;oez.enter(Y),K);else{const{leave:oe,delayLeave:ue,afterLeave:be}=z,Ee=()=>i(Y,O,R),je=()=>{oe(Y,()=>{Ee(),be&&be()})};ue?ue(Y,Ee,je):je()}else i(Y,O,R)},Pt=(x,O,R,F=!1,K=!1)=>{const{type:Y,props:j,ref:z,children:re,dynamicChildren:J,shapeFlag:ce,patchFlag:oe,dirs:ue}=x;if(z!=null&&tf(z,null,R,x,!0),ce&256){O.ctx.deactivate(x);return}const be=ce&1&&ue,Ee=!Xu(x);let je;if(Ee&&(je=j&&j.onVnodeBeforeUnmount)&&br(je,O,x),ce&6)En(x.component,R,F);else{if(ce&128){x.suspense.unmount(R,F);return}be&&ji(x,null,O,"beforeUnmount"),ce&64?x.type.remove(x,O,R,K,zn,F):J&&(Y!==cr||oe>0&&oe&64)?pn(J,O,R,!1,!0):(Y===cr&&oe&384||!K&&ce&16)&&pn(re,O,R),F&&Ar(x)}(Ee&&(je=j&&j.onVnodeUnmounted)||be)&&bn(()=>{je&&br(je,O,x),be&&ji(x,null,O,"unmounted")},R)},Ar=x=>{const{type:O,el:R,anchor:F,transition:K}=x;if(O===cr){Cs(R,F);return}if(O===Ml){ee(x);return}const Y=()=>{a(R),K&&!K.persisted&&K.afterLeave&&K.afterLeave()};if(x.shapeFlag&1&&K&&!K.persisted){const{leave:j,delayLeave:z}=K,re=()=>j(R,Y);z?z(x.el,Y,re):re()}else Y()},Cs=(x,O)=>{let R;for(;x!==O;)R=D(x),a(x),x=R;a(O)},En=(x,O,R)=>{const{bum:F,scope:K,update:Y,subTree:j,um:z}=x;F&&kl(F),K.stop(),Y&&(Y.active=!1,Pt(j,x,O,R)),z&&bn(z,O),bn(()=>{x.isUnmounted=!0},O),O&&O.pendingBranch&&!O.isUnmounted&&x.asyncDep&&!x.asyncResolved&&x.suspenseId===O.pendingId&&(O.deps--,O.deps===0&&O.resolve())},pn=(x,O,R,F=!1,K=!1,Y=0)=>{for(let j=Y;jx.shapeFlag&6?fe(x.component.subTree):x.shapeFlag&128?x.suspense.next():D(x.anchor||x.el),Me=(x,O,R)=>{x==null?O._vnode&&Pt(O._vnode,null,null,!0):b(O._vnode||null,x,O,null,null,null,R),fh(),zd(),O._vnode=x},zn={p:b,um:Pt,m:Re,r:Ar,mt:Kt,mc:xe,pc:Oe,pbc:ze,n:fe,o:t};let Jt,Ke;return e&&([Jt,Ke]=e(zn)),{render:Me,hydrate:Jt,createApp:mw(Me,Jt)}}function Hi({effect:t,update:e},n){t.allowRecurse=e.allowRecurse=n}function hp(t,e,n=!1){const i=t.children,a=e.children;if(Ie(i)&&Ie(a))for(let l=0;l>1,t[n[w]]0&&(e[i]=n[l-1]),n[l]=i)}}for(l=n.length,m=n[l-1];l-- >0;)n[l]=m,m=e[m];return n}const bw=t=>t.__isTeleport,cr=Symbol(void 0),dl=Symbol(void 0),Fr=Symbol(void 0),Ml=Symbol(void 0),Na=[];let hr=null;function Nw(t=!1){Na.push(hr=t?null:[])}function vw(){Na.pop(),hr=Na[Na.length-1]||null}let Sa=1;function Nh(t){Sa+=t}function _w(t){return t.dynamicChildren=Sa>0?hr||Zs:null,vw(),Sa>0&&hr&&hr.push(t),t}function xw(t,e,n,i,a,l){return _w(Ct(t,e,n,i,a,l,!0))}function Ew(t){return t?t.__v_isVNode===!0:!1}function Ji(t,e){return t.type===e.type&&t.key===e.key}const pl="__vInternal",dp=({key:t})=>t??null,Yu=({ref:t,ref_key:e,ref_for:n})=>t!=null?Lt(t)||rn(t)||Se(t)?{i:fr,r:t,k:e,f:!!n}:t:null;function Ct(t,e=null,n=null,i=0,a=null,l=t===cr?0:1,m=!1,w=!1){const v={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&dp(e),ref:e&&Yu(e),scopeId:Gd,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:l,patchFlag:i,dynamicProps:a,dynamicChildren:null,appContext:null,ctx:fr};return w?(Mf(v,n),l&128&&t.normalize(v)):n&&(v.shapeFlag|=Lt(n)?8:16),Sa>0&&!m&&hr&&(v.patchFlag>0||l&6)&&v.patchFlag!==32&&hr.push(v),v}const _s=Cw;function Cw(t,e=null,n=null,i=0,a=null,l=!1){if((!t||t===nw)&&(t=Fr),Ew(t)){const w=_i(t,e,!0);return n&&Mf(w,n),Sa>0&&!l&&hr&&(w.shapeFlag&6?hr[hr.indexOf(t)]=w:hr.push(w)),w.patchFlag|=-2,w}if(Lw(t)&&(t=t.__vccOpts),e){e=Ow(e);let{class:w,style:v}=e;w&&!Lt(w)&&(e.class=vf(w)),yt(v)&&(Md(v)&&!Ie(v)&&(v=on({},v)),e.style=Nf(v))}const m=Lt(t)?1:My(t)?128:bw(t)?64:yt(t)?4:Se(t)?2:0;return Ct(t,e,n,i,a,m,l,!0)}function Ow(t){return t?Md(t)||pl in t?on({},t):t:null}function _i(t,e,n=!1){const{props:i,ref:a,patchFlag:l,children:m}=t,w=e?qw(i||{},e):i;return{__v_isVNode:!0,__v_skip:!0,type:t.type,props:w,key:w&&dp(w),ref:e&&e.ref?n&&a?Ie(a)?a.concat(Yu(e)):[a,Yu(e)]:Yu(e):a,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:m,target:t.target,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==cr?l===-1?16:l|16:l,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:t.transition,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&_i(t.ssContent),ssFallback:t.ssFallback&&_i(t.ssFallback),el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce}}function ka(t=" ",e=0){return _s(dl,null,t,e)}function Cr(t){return t==null||typeof t=="boolean"?_s(Fr):Ie(t)?_s(cr,null,t.slice()):typeof t=="object"?si(t):_s(dl,null,String(t))}function si(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:_i(t)}function Mf(t,e){let n=0;const{shapeFlag:i}=t;if(e==null)e=null;else if(Ie(e))n=16;else if(typeof e=="object")if(i&65){const a=e.default;a&&(a._c&&(a._d=!1),Mf(t,a()),a._c&&(a._d=!0));return}else{n=32;const a=e._;!a&&!(pl in e)?e._ctx=fr:a===3&&fr&&(fr.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else Se(e)?(e={default:e,_ctx:fr},n=32):(e=String(e),i&64?(n=16,e=[ka(e)]):n=8);t.children=e,t.shapeFlag|=n}function qw(...t){const e={};for(let n=0;nOt||fr,Do=t=>{Ot=t,t.scope.on()},xs=()=>{Ot&&Ot.scope.off(),Ot=null};function pp(t){return t.vnode.shapeFlag&4}let Ra=!1;function Sw(t,e=!1){Ra=e;const{props:n,children:i}=t.vnode,a=pp(t);cw(t,n,a,e),hw(t,i);const l=a?kw(t,e):void 0;return Ra=!1,l}function kw(t,e){const n=t.type;t.accessCache=Object.create(null),t.proxy=Bd(new Proxy(t.ctx,rw));const{setup:i}=n;if(i){const a=t.setupContext=i.length>1?Dw(t):null;Do(t),Qo();const l=bi(i,t,0,[t.props,a]);if(jo(),xs(),xd(l)){if(l.then(xs,xs),e)return l.then(m=>{vh(t,m,e)}).catch(m=>{cl(m,t,0)});t.asyncDep=l}else vh(t,l,e)}else mp(t,e)}function vh(t,e,n){Se(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:yt(e)&&(t.setupState=Qd(e)),mp(t,n)}let _h;function mp(t,e,n){const i=t.type;if(!t.render){if(!e&&_h&&!i.render){const a=i.template||Lf(t).template;if(a){const{isCustomElement:l,compilerOptions:m}=t.appContext.config,{delimiters:w,compilerOptions:v}=i,d=on(on({isCustomElement:l,delimiters:w},m),v);i.render=_h(a,d)}}t.render=i.render||pr}Do(t),Qo(),iw(t),jo(),xs()}function Rw(t){return new Proxy(t.attrs,{get(e,n){return xn(t,"get","$attrs"),e[n]}})}function Dw(t){const e=i=>{t.exposed=i||{}};let n;return{get attrs(){return n||(n=Rw(t))},slots:t.slots,emit:t.emit,expose:e}}function Bf(t){if(t.exposed)return t.exposeProxy||(t.exposeProxy=new Proxy(Qd(Bd(t.exposed)),{get(e,n){if(n in e)return e[n];if(n in ba)return ba[n](t)},has(e,n){return n in e||n in ba}}))}function Lw(t){return Se(t)&&"__vccOpts"in t}const Pw=(t,e)=>Cy(t,e,Ra),Mw=Symbol(""),Bw=()=>Gu(Mw),Fw="3.2.47",Uw="http://www.w3.org/2000/svg",Gi=typeof document<"u"?document:null,xh=Gi&&Gi.createElement("template"),$w={insert:(t,e,n)=>{e.insertBefore(t,n||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,n,i)=>{const a=e?Gi.createElementNS(Uw,t):Gi.createElement(t,n?{is:n}:void 0);return t==="select"&&i&&i.multiple!=null&&a.setAttribute("multiple",i.multiple),a},createText:t=>Gi.createTextNode(t),createComment:t=>Gi.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>Gi.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,n,i,a,l){const m=n?n.previousSibling:e.lastChild;if(a&&(a===l||a.nextSibling))for(;e.insertBefore(a.cloneNode(!0),n),!(a===l||!(a=a.nextSibling)););else{xh.innerHTML=i?`${t}`:t;const w=xh.content;if(i){const v=w.firstChild;for(;v.firstChild;)w.appendChild(v.firstChild);w.removeChild(v)}e.insertBefore(w,n)}return[m?m.nextSibling:e.firstChild,n?n.previousSibling:e.lastChild]}};function Qw(t,e,n){const i=t._vtc;i&&(e=(e?[e,...i]:[...i]).join(" ")),e==null?t.removeAttribute("class"):n?t.setAttribute("class",e):t.className=e}function jw(t,e,n){const i=t.style,a=Lt(n);if(n&&!a){if(e&&!Lt(e))for(const l in e)n[l]==null&&nf(i,l,"");for(const l in n)nf(i,l,n[l])}else{const l=i.display;a?e!==n&&(i.cssText=n):e&&t.removeAttribute("style"),"_vod"in t&&(i.display=l)}}const Eh=/\s*!important$/;function nf(t,e,n){if(Ie(n))n.forEach(i=>nf(t,e,i));else if(n==null&&(n=""),e.startsWith("--"))t.setProperty(e,n);else{const i=Hw(t,e);Eh.test(n)?t.setProperty($o(i),n.replace(Eh,""),"important"):t[i]=n}}const Ch=["Webkit","Moz","ms"],Bl={};function Hw(t,e){const n=Bl[e];if(n)return n;let i=ko(e);if(i!=="filter"&&i in t)return Bl[e]=i;i=Od(i);for(let a=0;aFl||(Yw.then(()=>Fl=0),Fl=Date.now());function eg(t,e){const n=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=n.attached)return;Hn(tg(i,n.value),e,5,[i])};return n.value=t,n.attached=Zw(),n}function tg(t,e){if(Ie(e)){const n=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{n.call(t),t._stopped=!0},e.map(i=>a=>!a._stopped&&i&&i(a))}else return e}const Wh=/^on[a-z]/,ng=(t,e,n,i,a=!1,l,m,w,v)=>{e==="class"?Qw(t,i,a):e==="style"?jw(t,n,i):sl(e)?_f(e)||Gw(t,e,n,i,m):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):rg(t,e,i,a))?zw(t,e,i,l,m,w,v):(e==="true-value"?t._trueValue=i:e==="false-value"&&(t._falseValue=i),Vw(t,e,i,a))};function rg(t,e,n,i){return i?!!(e==="innerHTML"||e==="textContent"||e in t&&Wh.test(e)&&Se(n)):e==="spellcheck"||e==="draggable"||e==="translate"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA"||Wh.test(e)&&Lt(n)?!1:e in t}const ig={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String};jy.props;const sg=on({patchProp:ng},$w);let Ih;function og(){return Ih||(Ih=yw(sg))}const ag=(...t)=>{const e=og().createApp(...t),{mount:n}=e;return e.mount=i=>{const a=ug(i);if(!a)return;const l=e._component;!Se(l)&&!l.render&&!l.template&&(l.template=a.innerHTML),a.innerHTML="";const m=n(a,!1,a instanceof SVGElement);return a instanceof Element&&(a.removeAttribute("v-cloak"),a.setAttribute("data-v-app","")),m},e};function ug(t){return Lt(t)?document.querySelector(t):t}function va(t){return typeof t>"u"||t===void 0}function mr(t){return typeof t=="string"}function cg(t){return typeof t=="number"}function yp(t){return typeof t=="boolean"}function wp(t){return t===null}function lg(t){return t instanceof Date}function fg(t){return typeof t=="bigint"}function Vn(t){return typeof t=="function"}function Wr(t){return typeof t=="object"&&t!==null}function p(t){return Object.freeze(t)}function wu(t){return Array.isArray(t)}function Lo(t){return t}const Et=p({is(t){return t.kind==="AlterTableNode"},create(t){return p({kind:"AlterTableNode",table:t})},cloneWithTableProps(t,e){return p({...t,...e})},cloneWithColumnAlteration(t,e){return p({...t,columnAlterations:t.columnAlterations?[...t.columnAlterations,e]:[e]})}}),mt=p({is(t){return t.kind==="IdentifierNode"},create(t){return p({kind:"IdentifierNode",name:t})}}),ri=p({is(t){return t.kind==="CreateIndexNode"},create(t){return p({kind:"CreateIndexNode",name:mt.create(t)})},cloneWith(t,e){return p({...t,...e})},cloneWithColumns(t,e){return p({...t,columns:[...t.columns||[],...e]})}}),gp=p({is(t){return t.kind==="CreateSchemaNode"},create(t,e){return p({kind:"CreateSchemaNode",schema:mt.create(t),...e})},cloneWith(t,e){return p({...t,...e})}}),hg=["preserve rows","delete rows","drop"],Zn=p({is(t){return t.kind==="CreateTableNode"},create(t){return p({kind:"CreateTableNode",table:t,columns:p([])})},cloneWithColumn(t,e){return p({...t,columns:p([...t.columns,e])})},cloneWithConstraint(t,e){return p({...t,constraints:t.constraints?p([...t.constraints,e]):p([e])})},cloneWithFrontModifier(t,e){return p({...t,frontModifiers:t.frontModifiers?p([...t.frontModifiers,e]):p([e])})},cloneWithEndModifier(t,e){return p({...t,endModifiers:t.endModifiers?p([...t.endModifiers,e]):p([e])})},cloneWith(t,e){return p({...t,...e})}}),xi=p({is(t){return t.kind==="SchemableIdentifierNode"},create(t){return p({kind:"SchemableIdentifierNode",identifier:mt.create(t)})},createWithSchema(t,e){return p({kind:"SchemableIdentifierNode",schema:mt.create(t),identifier:mt.create(e)})}}),Zu=p({is(t){return t.kind==="DropIndexNode"},create(t,e){return p({kind:"DropIndexNode",name:xi.create(t),...e})},cloneWith(t,e){return p({...t,...e})}}),rf=p({is(t){return t.kind==="DropSchemaNode"},create(t,e){return p({kind:"DropSchemaNode",schema:mt.create(t),...e})},cloneWith(t,e){return p({...t,...e})}}),sf=p({is(t){return t.kind==="DropTableNode"},create(t,e){return p({kind:"DropTableNode",table:t,...e})},cloneWith(t,e){return p({...t,...e})}}),Es=p({is(t){return t.kind==="AliasNode"},create(t,e){return p({kind:"AliasNode",node:t,alias:e})}}),Ni=p({is(t){return t.kind==="TableNode"},create(t){return p({kind:"TableNode",table:xi.create(t)})},createWithSchema(t,e){return p({kind:"TableNode",table:xi.createWithSchema(t,e)})}});function hn(t){return Wr(t)&&Vn(t.toOperationNode)}function dg(t){return Wr(t)&&"expressionType"in t&&hn(t)}function pg(t){return Wr(t)&&"expression"in t&&mr(t.alias)&&hn(t)}const Sr=p({is(t){return t.kind==="SelectModifierNode"},create(t){return p({kind:"SelectModifierNode",modifier:t})},createWithExpression(t){return p({kind:"SelectModifierNode",rawModifier:t})}}),Da=p({is(t){return t.kind==="AndNode"},create(t,e){return p({kind:"AndNode",left:t,right:e})}}),La=p({is(t){return t.kind==="OrNode"},create(t,e){return p({kind:"OrNode",left:t,right:e})}}),pa=p({is(t){return t.kind==="OnNode"},create(t){return p({kind:"OnNode",on:t})},cloneWithOperation(t,e,n){return p({...t,on:e==="And"?Da.create(t.on,n):La.create(t.on,n)})}}),jn=p({is(t){return t.kind==="JoinNode"},create(t,e){return p({kind:"JoinNode",joinType:t,table:e,on:void 0})},createWithOn(t,e,n){return p({kind:"JoinNode",joinType:t,table:e,on:pa.create(n)})},cloneWithOn(t,e){return p({...t,on:t.on?pa.cloneWithOperation(t.on,"And",e):pa.create(e)})},cloneWithOrOn(t,e){return p({...t,on:t.on?pa.cloneWithOperation(t.on,"Or",e):pa.create(e)})}}),ml=p({is(t){return t.kind==="BinaryOperationNode"},create(t,e,n){return p({kind:"BinaryOperationNode",leftOperand:t,operator:e,rightOperand:n})}}),en=p({is(t){return t.kind==="RawNode"},create(t,e){return p({kind:"RawNode",sqlFragments:p(t),parameters:p(e)})},createWithSql(t){return en.create([t],[])},createWithChild(t){return en.create(["",""],[t])},createWithChildren(t){return en.create(new Array(t.length+1).fill(""),t)}}),bp=["=","==","!=","<>",">",">=","<","<=","in","not in","is","is not","like","not like","match","ilike","not ilike","@>","<@","?","?&","!<","!>","<=>","!~","~","~*","!~*","@@","@@@","!!","<->"],mg=["+","-","*","/","%","^","&","|","#","<<",">>"],Np=[...bp,...mg,"&&","||"],yg=["exists","not exists"],wg=["not","-",...yg],gg=[...Np,...wg],Ff=p({is(t){return t.kind==="OperatorNode"},create(t){return p({kind:"OperatorNode",operator:t})}});function vp(t){return mr(t)&&Np.includes(t)}function _p(t){return mr(t)&&bp.includes(t)}const ro=p({is(t){return t.kind==="ParensNode"},create(t){return p({kind:"ParensNode",node:t})}}),Nt=p({is(t){return t.kind==="ColumnNode"},create(t){return p({kind:"ColumnNode",column:mt.create(t)})}}),Uf=p({is(t){return t.kind==="SelectAllNode"},create(){return p({kind:"SelectAllNode"})}}),yl=p({is(t){return t.kind==="ReferenceNode"},create(t,e){return p({kind:"ReferenceNode",table:t,column:e})},createSelectAll(t){return p({kind:"ReferenceNode",table:t,column:Uf.create()})}}),bg=p({is(t){return t.kind==="OrderByItemNode"},create(t,e){return p({kind:"OrderByItemNode",orderBy:t,direction:e})}});function Ng(t){return t==="asc"||t==="desc"}function wl(t,e){return bg.create(vg(t),_g(e))}function vg(t){return Hr(t)}function _g(t){if(t)return t==="asc"||t==="desc"?en.createWithSql(t):t.toOperationNode()}function xp(t){return mr(t)?Po(t):t.toOperationNode()}function Pa(t){return wu(t)?t.map(e=>Hr(e)):[Hr(t)]}function Hr(t){return xl(t)?_l(t):xp(t)}function Po(t){const e=".";if(t.includes(e)){const n=t.split(e).map($f);if(n.length===3)return Eg(n);if(n.length===2)return Cg(n);throw new Error(`invalid column reference ${t}`)}else return Nt.create(t)}function xg(t){const e=" as ";if(t.includes(e)){const[n,i]=t.split(e).map($f);return Es.create(Po(n),mt.create(i))}else return Po(t)}function Ep(t){return Nt.create(t)}function Ah(t){const e=" ";if(t.includes(e)){const[n,i]=t.split(e).map($f);if(!Ng(i))throw new Error(`invalid order direction "${i}" next to "${n}"`);return wl(n,i)}else return Ep(t)}function Eg(t){const[e,n,i]=t;return yl.create(Ni.createWithSchema(e,n),Nt.create(i))}function Cg(t){const[e,n]=t;return yl.create(Ni.create(e),Nt.create(n))}function $f(t){return t.trim()}const Cp=p({is(t){return t.kind==="PrimitiveValueListNode"},create(t){return p({kind:"PrimitiveValueListNode",values:p([...t])})}}),Qf=p({is(t){return t.kind==="ValueListNode"},create(t){return p({kind:"ValueListNode",values:p(t)})}}),Ir=p({is(t){return t.kind==="ValueNode"},create(t){return p({kind:"ValueNode",value:t})},createImmediate(t){return p({kind:"ValueNode",value:t,immediate:!0})}});function Op(t){return wu(t)?Og(t):Ur(t)}function Ur(t){return xl(t)?_l(t):Ir.create(t)}function Og(t){return t.some(xl)?Qf.create(t.map(e=>Ur(e))):Cp.create(t)}const Mo=p({is(t){return t.kind==="OrderByNode"},create(t){return p({kind:"OrderByNode",items:p([t])})},cloneWithItem(t,e){return p({...t,items:p([...t.items,e])})}}),Th=p({is(t){return t.kind==="PartitionByNode"},create(t){return p({kind:"PartitionByNode",items:p(t)})},cloneWithItems(t,e){return p({...t,items:p([...t.items,...e])})}}),of=p({is(t){return t.kind==="OverNode"},create(){return p({kind:"OverNode"})},cloneWithOrderByItem(t,e){return p({...t,orderBy:t.orderBy?Mo.cloneWithItem(t.orderBy,e):Mo.create(e)})},cloneWithPartitionByItems(t,e){return p({...t,partitionBy:t.partitionBy?Th.cloneWithItems(t.partitionBy,e):Th.create(e)})}}),lc=p({is(t){return t.kind==="FromNode"},create(t){return p({kind:"FromNode",froms:p(t)})},cloneWithFroms(t,e){return p({...t,froms:p([...t.froms,...e])})}}),Sh=p({is(t){return t.kind==="GroupByNode"},create(t){return p({kind:"GroupByNode",items:p(t)})},cloneWithItems(t,e){return p({...t,items:p([...t.items,...e])})}}),Hu=p({is(t){return t.kind==="HavingNode"},create(t){return p({kind:"HavingNode",having:t})},cloneWithOperation(t,e,n){return p({...t,having:e==="And"?Da.create(t.having,n):La.create(t.having,n)})}}),We=p({is(t){return t.kind==="SelectQueryNode"},create(t,e){return p({kind:"SelectQueryNode",from:lc.create(t),...e&&{with:e}})},cloneWithSelections(t,e){return p({...t,selections:t.selections?p([...t.selections,...e]):p(e)})},cloneWithDistinctOn(t,e){return p({...t,distinctOn:t.distinctOn?p([...t.distinctOn,...e]):p(e)})},cloneWithFrontModifier(t,e){return p({...t,frontModifiers:t.frontModifiers?p([...t.frontModifiers,e]):p([e])})},cloneWithEndModifier(t,e){return p({...t,endModifiers:t.endModifiers?p([...t.endModifiers,e]):p([e])})},cloneWithOrderByItem(t,e){return p({...t,orderBy:t.orderBy?Mo.cloneWithItem(t.orderBy,e):Mo.create(e)})},cloneWithGroupByItems(t,e){return p({...t,groupBy:t.groupBy?Sh.cloneWithItems(t.groupBy,e):Sh.create(e)})},cloneWithLimit(t,e){return p({...t,limit:e})},cloneWithOffset(t,e){return p({...t,offset:e})},cloneWithHaving(t,e){return p({...t,having:t.having?Hu.cloneWithOperation(t.having,"And",e):Hu.create(e)})},cloneWithOrHaving(t,e){return p({...t,having:t.having?Hu.cloneWithOperation(t.having,"Or",e):Hu.create(e)})},cloneWithSetOperation(t,e){return p({...t,setOperations:t.setOperations?p([...t.setOperations,e]):p([e])})},cloneWithoutSelections(t){return p({...t,selections:[]})},cloneWithoutLimit(t){return p({...t,limit:void 0})},cloneWithoutOffset(t){return p({...t,offset:void 0})},cloneWithoutOrderBy(t){return p({...t,orderBy:void 0})}}),qp=p({is(t){return t.kind==="UnaryOperationNode"},create(t,e){return p({kind:"UnaryOperationNode",operator:t,operand:e})}});function sn(t){return jf("exists",t)}function Vt(t){return jf("not exists",t)}function jf(t,e){return qp.create(Ff.create(t),Hr(e))}function $e(t,e){Object.defineProperties(t.prototype,{then:{enumerable:!1,value:()=>{throw new Error(e)}}})}var ft;const tr=class{constructor(e){S(this,ft,void 0);P(this,ft,p(e))}on(...e){return new tr({...r(this,ft),joinNode:jn.cloneWithOn(r(this,ft).joinNode,jh(e))})}orOn(...e){return new tr({...r(this,ft),joinNode:jn.cloneWithOrOn(r(this,ft).joinNode,jh(e))})}onRef(e,n,i){return new tr({...r(this,ft),joinNode:jn.cloneWithOn(r(this,ft).joinNode,zt(e,n,i))})}orOnRef(e,n,i){return new tr({...r(this,ft),joinNode:jn.cloneWithOrOn(r(this,ft).joinNode,zt(e,n,i))})}onExists(e){return new tr({...r(this,ft),joinNode:jn.cloneWithOn(r(this,ft).joinNode,sn(e))})}onNotExists(e){return new tr({...r(this,ft),joinNode:jn.cloneWithOn(r(this,ft).joinNode,Vt(e))})}orOnExists(e){return new tr({...r(this,ft),joinNode:jn.cloneWithOrOn(r(this,ft).joinNode,sn(e))})}orOnNotExists(e){return new tr({...r(this,ft),joinNode:jn.cloneWithOrOn(r(this,ft).joinNode,Vt(e))})}onTrue(){return new tr({...r(this,ft),joinNode:jn.cloneWithOn(r(this,ft).joinNode,en.createWithSql("true"))})}$call(e){return e(this)}toOperationNode(){return r(this,ft).joinNode}};let fc=tr;ft=new WeakMap;$e(fc,"don't await JoinBuilder instances. They are never executed directly and are always just a part of a query.");const qg=p({is(t){return t.kind==="PartitionByItemNode"},create(t){return p({kind:"PartitionByItemNode",partitionBy:t})}});function Wg(t){return Pa(t).map(qg.create)}var rs;const Rc=class{constructor(e){S(this,rs,void 0);P(this,rs,p(e))}orderBy(e,n){return new Rc({overNode:of.cloneWithOrderByItem(r(this,rs).overNode,wl(e,n))})}partitionBy(e){return new Rc({overNode:of.cloneWithPartitionByItems(r(this,rs).overNode,Wg(e))})}$call(e){return e(this)}toOperationNode(){return r(this,rs).overNode}};let hc=Rc;rs=new WeakMap;$e(hc,"don't await OverBuilder instances. They are never executed directly and are always just a part of a query.");const _a=p({is(t){return t.kind==="SelectionNode"},create(t){return p({kind:"SelectionNode",selection:t})},createSelectAll(){return p({kind:"SelectionNode",selection:Uf.create()})},createSelectAllFromTable(t){return p({kind:"SelectionNode",selection:yl.createSelectAll(t)})}});var io;class Ig{constructor(e){S(this,io,void 0);P(this,io,e)}get dynamicReference(){return r(this,io)}get refType(){}toOperationNode(){return xp(r(this,io))}}io=new WeakMap;function Ag(t){return Wr(t)&&hn(t)&&mr(t.dynamicReference)}function gu(t){return Vn(t)?gu(t($r())):wu(t)?t.map(e=>kh(e)):[kh(t)]}function kh(t){return mr(t)?_a.create(xg(t)):Ag(t)?_a.create(t.toOperationNode()):_a.create(Hp(t))}function bu(t){return t?Array.isArray(t)?t.map(Rh):[Rh(t)]:[_a.createSelectAll()]}function Rh(t){if(mr(t))return _a.createSelectAllFromTable(_n(t));throw new Error(`invalid value selectAll expression: ${JSON.stringify(t)}`)}const Tg=p({is(t){return t.kind==="ValuesNode"},create(t){return p({kind:"ValuesNode",values:p(t)})}}),Sg=p({is(t){return t.kind==="DefaultInsertValueNode"},create(){return p({kind:"DefaultInsertValueNode"})}});function kg(t){const e=Vn(t)?t($r()):t,n=wu(e)?e:p([e]);return Rg(n)}function Rg(t){const e=Dg(t);return[p([...e.keys()].map(Nt.create)),Tg.create(t.map(n=>Lg(n,e)))]}function Dg(t){const e=new Map;for(const n of t){const i=Object.keys(n);for(const a of i)!e.has(a)&&n[a]!==void 0&&e.set(a,e.size)}return e}function Lg(t,e){const n=Object.keys(t),i=Array.from({length:e.size});let a=!1;for(const m of n){const w=e.get(m);if(va(w))continue;const v=t[m];(va(v)||xl(v))&&(a=!0),i[w]=v}if(n.lengthva(w)?m:Ur(w)))}return Cp.create(i)}const Or=p({is(t){return t.kind==="InsertQueryNode"},create(t,e,n){return p({kind:"InsertQueryNode",into:t,...e&&{with:e},replace:n})},cloneWith(t,e){return p({...t,...e})}}),dc=p({is(t){return t.kind==="UpdateQueryNode"},create(t,e){return p({kind:"UpdateQueryNode",table:t,...e&&{with:e}})},cloneWithFromItems(t,e){return p({...t,from:t.from?lc.cloneWithFroms(t.from,e):lc.create(e)})},cloneWithUpdates(t,e){return p({...t,updates:t.updates?p([...t.updates,...e]):e})}}),Dh=p({is(t){return t.kind==="UsingNode"},create(t){return p({kind:"UsingNode",tables:p(t)})},cloneWithTables(t,e){return p({...t,tables:p([...t.tables,...e])})}}),xa=p({is(t){return t.kind==="DeleteQueryNode"},create(t,e){return p({kind:"DeleteQueryNode",from:lc.create(t),...e&&{with:e}})},cloneWithOrderByItem(t,e){return p({...t,orderBy:t.orderBy?Mo.cloneWithItem(t.orderBy,e):Mo.create(e)})},cloneWithLimit(t,e){return p({...t,limit:e})},cloneWithUsing(t,e){return p({...t,using:t.using!==void 0?Dh.cloneWithTables(t.using,e):Dh.create(e)})}}),tn=p({is(t){return t.kind==="WhereNode"},create(t){return p({kind:"WhereNode",where:t})},cloneWithOperation(t,e,n){return p({...t,where:e==="And"?Da.create(t.where,n):La.create(t.where,n)})}}),Lh=p({is(t){return t.kind==="ReturningNode"},create(t){return p({kind:"ReturningNode",selections:p(t)})},cloneWithSelections(t,e){return p({...t,selections:t.selections?p([...t.selections,...e]):p(e)})}}),Pg=p({is(t){return t.kind==="ExplainNode"},create(t,e){return p({kind:"ExplainNode",format:t,options:e})}}),ye=p({is(t){return We.is(t)||Or.is(t)||dc.is(t)||xa.is(t)},cloneWithWhere(t,e){return p({...t,where:t.where?tn.cloneWithOperation(t.where,"And",e):tn.create(e)})},cloneWithOrWhere(t,e){return p({...t,where:t.where?tn.cloneWithOperation(t.where,"Or",e):tn.create(e)})},cloneWithJoin(t,e){return p({...t,joins:t.joins?p([...t.joins,e]):p([e])})},cloneWithReturning(t,e){return p({...t,returning:t.returning?Lh.cloneWithSelections(t.returning,e):Lh.create(e)})},cloneWithoutWhere(t){return p({...t,where:void 0})},cloneWithExplain(t,e,n){return p({...t,explain:Pg.create(e,n==null?void 0:n.toOperationNode())})}}),Mg=p({is(t){return t.kind==="ColumnUpdateNode"},create(t,e){return p({kind:"ColumnUpdateNode",column:t,value:e})}});function Hf(t){const e=Vn(t)?t($r()):t;return Object.entries(e).filter(([n,i])=>i!==void 0).map(([n,i])=>Mg.create(Nt.create(n),Ur(i)))}const Bg=p({is(t){return t.kind==="OnDuplicateKeyNode"},create(t){return p({kind:"OnDuplicateKeyNode",updates:t})}});var Qa,ja;class Wp{constructor(e,n){S(this,Qa,void 0);S(this,ja,void 0);P(this,Qa,e),P(this,ja,n)}get insertId(){return r(this,Qa)}get numInsertedOrUpdatedRows(){return r(this,ja)}}Qa=new WeakMap,ja=new WeakMap;for(const t of["insertId","numInsertedOrUpdatedRows"])Object.defineProperty(Wp.prototype,t,{enumerable:!0});class gl extends Error{constructor(n){super("no result");Yt(this,"node");this.node=n}}function bl(t){return Object.prototype.hasOwnProperty.call(t,"prototype")}const at=p({is(t){return t.kind==="OnConflictNode"},create(){return p({kind:"OnConflictNode"})},cloneWith(t,e){return p({...t,...e})},cloneWithIndexWhere(t,e){return p({...t,indexWhere:t.indexWhere?tn.cloneWithOperation(t.indexWhere,"And",e):tn.create(e)})},cloneWithIndexOrWhere(t,e){return p({...t,indexWhere:t.indexWhere?tn.cloneWithOperation(t.indexWhere,"Or",e):tn.create(e)})},cloneWithUpdateWhere(t,e){return p({...t,updateWhere:t.updateWhere?tn.cloneWithOperation(t.updateWhere,"And",e):tn.create(e)})},cloneWithUpdateOrWhere(t,e){return p({...t,updateWhere:t.updateWhere?tn.cloneWithOperation(t.updateWhere,"Or",e):tn.create(e)})},cloneWithoutIndexWhere(t){return p({...t,indexWhere:void 0})},cloneWithoutUpdateWhere(t){return p({...t,updateWhere:void 0})}});var ke;const cn=class{constructor(e){S(this,ke,void 0);P(this,ke,p(e))}column(e){const n=Nt.create(e);return new cn({...r(this,ke),onConflictNode:at.cloneWith(r(this,ke).onConflictNode,{columns:r(this,ke).onConflictNode.columns?p([...r(this,ke).onConflictNode.columns,n]):p([n])})})}columns(e){const n=e.map(Nt.create);return new cn({...r(this,ke),onConflictNode:at.cloneWith(r(this,ke).onConflictNode,{columns:r(this,ke).onConflictNode.columns?p([...r(this,ke).onConflictNode.columns,...n]):p(n)})})}constraint(e){return new cn({...r(this,ke),onConflictNode:at.cloneWith(r(this,ke).onConflictNode,{constraint:mt.create(e)})})}expression(e){return new cn({...r(this,ke),onConflictNode:at.cloneWith(r(this,ke).onConflictNode,{indexExpression:e.toOperationNode()})})}where(...e){return new cn({...r(this,ke),onConflictNode:at.cloneWithIndexWhere(r(this,ke).onConflictNode,Rn(e))})}whereRef(e,n,i){return new cn({...r(this,ke),onConflictNode:at.cloneWithIndexWhere(r(this,ke).onConflictNode,zt(e,n,i))})}orWhere(...e){return new cn({...r(this,ke),onConflictNode:at.cloneWithIndexOrWhere(r(this,ke).onConflictNode,Rn(e))})}orWhereRef(e,n,i){return new cn({...r(this,ke),onConflictNode:at.cloneWithIndexOrWhere(r(this,ke).onConflictNode,zt(e,n,i))})}whereExists(e){return new cn({...r(this,ke),onConflictNode:at.cloneWithIndexWhere(r(this,ke).onConflictNode,sn(e))})}whereNotExists(e){return new cn({...r(this,ke),onConflictNode:at.cloneWithIndexWhere(r(this,ke).onConflictNode,Vt(e))})}orWhereExists(e){return new cn({...r(this,ke),onConflictNode:at.cloneWithIndexOrWhere(r(this,ke).onConflictNode,sn(e))})}orWhereNotExists(e){return new cn({...r(this,ke),onConflictNode:at.cloneWithIndexOrWhere(r(this,ke).onConflictNode,Vt(e))})}clearWhere(){return new cn({...r(this,ke),onConflictNode:at.cloneWithoutIndexWhere(r(this,ke).onConflictNode)})}doNothing(){return new Ip({...r(this,ke),onConflictNode:at.cloneWith(r(this,ke).onConflictNode,{doNothing:!0})})}doUpdateSet(e){return new mc({...r(this,ke),onConflictNode:at.cloneWith(r(this,ke).onConflictNode,{updates:Hf(e)})})}$call(e){return e(this)}};let pc=cn;ke=new WeakMap;$e(pc,"don't await OnConflictBuilder instances.");var Ha;class Ip{constructor(e){S(this,Ha,void 0);P(this,Ha,p(e))}toOperationNode(){return r(this,Ha).onConflictNode}}Ha=new WeakMap;$e(Ip,"don't await OnConflictDoNothingBuilder instances.");var ht;const nr=class{constructor(e){S(this,ht,void 0);P(this,ht,p(e))}where(...e){return new nr({...r(this,ht),onConflictNode:at.cloneWithUpdateWhere(r(this,ht).onConflictNode,Rn(e))})}whereRef(e,n,i){return new nr({...r(this,ht),onConflictNode:at.cloneWithUpdateWhere(r(this,ht).onConflictNode,zt(e,n,i))})}orWhere(...e){return new nr({...r(this,ht),onConflictNode:at.cloneWithUpdateOrWhere(r(this,ht).onConflictNode,Rn(e))})}orWhereRef(e,n,i){return new nr({...r(this,ht),onConflictNode:at.cloneWithUpdateOrWhere(r(this,ht).onConflictNode,zt(e,n,i))})}whereExists(e){return new nr({...r(this,ht),onConflictNode:at.cloneWithUpdateWhere(r(this,ht).onConflictNode,sn(e))})}whereNotExists(e){return new nr({...r(this,ht),onConflictNode:at.cloneWithUpdateWhere(r(this,ht).onConflictNode,Vt(e))})}orWhereExists(e){return new nr({...r(this,ht),onConflictNode:at.cloneWithUpdateOrWhere(r(this,ht).onConflictNode,sn(e))})}orWhereNotExists(e){return new nr({...r(this,ht),onConflictNode:at.cloneWithUpdateOrWhere(r(this,ht).onConflictNode,Vt(e))})}clearWhere(){return new nr({...r(this,ht),onConflictNode:at.cloneWithoutUpdateWhere(r(this,ht).onConflictNode)})}$call(e){return e(this)}toOperationNode(){return r(this,ht).onConflictNode}};let mc=nr;ht=new WeakMap;$e(mc,"don't await OnConflictUpdateBuilder instances.");var Te;const Tt=class{constructor(e){S(this,Te,void 0);P(this,Te,p(e))}values(e){const[n,i]=kg(e);return new Tt({...r(this,Te),queryNode:Or.cloneWith(r(this,Te).queryNode,{columns:n,values:i})})}columns(e){return new Tt({...r(this,Te),queryNode:Or.cloneWith(r(this,Te).queryNode,{columns:p(e.map(Nt.create))})})}expression(e){return new Tt({...r(this,Te),queryNode:Or.cloneWith(r(this,Te).queryNode,{values:_l(e)})})}ignore(){return new Tt({...r(this,Te),queryNode:Or.cloneWith(r(this,Te).queryNode,{ignore:!0})})}onConflict(e){return new Tt({...r(this,Te),queryNode:Or.cloneWith(r(this,Te).queryNode,{onConflict:e(new pc({onConflictNode:at.create()})).toOperationNode()})})}onDuplicateKeyUpdate(e){return new Tt({...r(this,Te),queryNode:Or.cloneWith(r(this,Te).queryNode,{onDuplicateKey:Bg.create(Hf(e))})})}returning(e){return new Tt({...r(this,Te),queryNode:ye.cloneWithReturning(r(this,Te).queryNode,gu(e))})}returningAll(){return new Tt({...r(this,Te),queryNode:ye.cloneWithReturning(r(this,Te).queryNode,bu())})}$call(e){return e(this)}call(e){return this.$call(e)}$if(e,n){return e?n(this):new Tt({...r(this,Te)})}if(e,n){return e?n(this):new Tt({...r(this,Te)})}$castTo(){return new Tt(r(this,Te))}castTo(){return this.$castTo()}$narrowType(){return new Tt(r(this,Te))}$assertType(){return new Tt(r(this,Te))}assertType(){return new Tt(r(this,Te))}withPlugin(e){return new Tt({...r(this,Te),executor:r(this,Te).executor.withPlugin(e)})}toOperationNode(){return r(this,Te).executor.transformQuery(r(this,Te).queryNode,r(this,Te).queryId)}compile(){return r(this,Te).executor.compileQuery(this.toOperationNode(),r(this,Te).queryId)}async execute(){const e=this.compile(),n=e.query,i=await r(this,Te).executor.executeQuery(e,r(this,Te).queryId);return r(this,Te).executor.adapter.supportsReturning&&n.returning?i.rows:[new Wp(i.insertId,i.numAffectedRows??i.numUpdatedOrDeletedRows)]}async executeTakeFirst(){const[e]=await this.execute();return e}async executeTakeFirstOrThrow(e=gl){const n=await this.executeTakeFirst();if(n===void 0)throw bl(e)?new e(this.toOperationNode()):e(this.toOperationNode());return n}async*stream(e=100){const n=this.compile(),i=r(this,Te).executor.stream(n,e,r(this,Te).queryId);for await(const a of i)yield*a.rows}async explain(e,n){return await new Tt({...r(this,Te),queryNode:ye.cloneWithExplain(r(this,Te).queryNode,e,n)}).execute()}};let Ma=Tt;Te=new WeakMap;$e(Ma,"don't await InsertQueryBuilder instances directly. To execute the query you need to call `execute` or `executeTakeFirst`.");var Va;class Ap{constructor(e){S(this,Va,void 0);P(this,Va,e)}get numDeletedRows(){return r(this,Va)}}Va=new WeakMap;Object.defineProperty(Ap.prototype,"numDeletedRows",{enumerable:!0});const Tp=p({is(t){return t.kind==="LimitNode"},create(t){return p({kind:"LimitNode",limit:Ir.create(t)})}});var de;const Xe=class{constructor(e){S(this,de,void 0);P(this,de,p(e))}where(...e){return new Xe({...r(this,de),queryNode:ye.cloneWithWhere(r(this,de).queryNode,Rn(e))})}whereRef(e,n,i){return new Xe({...r(this,de),queryNode:ye.cloneWithWhere(r(this,de).queryNode,zt(e,n,i))})}orWhere(...e){return new Xe({...r(this,de),queryNode:ye.cloneWithOrWhere(r(this,de).queryNode,Rn(e))})}orWhereRef(e,n,i){return new Xe({...r(this,de),queryNode:ye.cloneWithOrWhere(r(this,de).queryNode,zt(e,n,i))})}whereExists(e){return new Xe({...r(this,de),queryNode:ye.cloneWithWhere(r(this,de).queryNode,sn(e))})}whereNotExists(e){return new Xe({...r(this,de),queryNode:ye.cloneWithWhere(r(this,de).queryNode,Vt(e))})}orWhereExists(e){return new Xe({...r(this,de),queryNode:ye.cloneWithOrWhere(r(this,de).queryNode,sn(e))})}orWhereNotExists(e){return new Xe({...r(this,de),queryNode:ye.cloneWithOrWhere(r(this,de).queryNode,Vt(e))})}clearWhere(){return new Xe({...r(this,de),queryNode:ye.cloneWithoutWhere(r(this,de).queryNode)})}using(e){return new Xe({...r(this,de),queryNode:xa.cloneWithUsing(r(this,de).queryNode,Fo(e))})}innerJoin(...e){return new Xe({...r(this,de),queryNode:ye.cloneWithJoin(r(this,de).queryNode,vn("InnerJoin",e))})}leftJoin(...e){return new Xe({...r(this,de),queryNode:ye.cloneWithJoin(r(this,de).queryNode,vn("LeftJoin",e))})}rightJoin(...e){return new Xe({...r(this,de),queryNode:ye.cloneWithJoin(r(this,de).queryNode,vn("RightJoin",e))})}fullJoin(...e){return new Xe({...r(this,de),queryNode:ye.cloneWithJoin(r(this,de).queryNode,vn("FullJoin",e))})}returning(e){return new Xe({...r(this,de),queryNode:ye.cloneWithReturning(r(this,de).queryNode,gu(e))})}returningAll(e){return new Xe({...r(this,de),queryNode:ye.cloneWithReturning(r(this,de).queryNode,bu(e))})}orderBy(e,n){return new Xe({...r(this,de),queryNode:xa.cloneWithOrderByItem(r(this,de).queryNode,wl(e,n))})}limit(e){return new Xe({...r(this,de),queryNode:xa.cloneWithLimit(r(this,de).queryNode,Tp.create(e))})}$call(e){return e(this)}call(e){return this.$call(e)}$if(e,n){return e?n(this):new Xe({...r(this,de)})}if(e,n){return this.$if(e,n)}$castTo(){return new Xe(r(this,de))}castTo(){return this.$castTo()}$narrowType(){return new Xe(r(this,de))}$assertType(){return new Xe(r(this,de))}assertType(){return new Xe(r(this,de))}withPlugin(e){return new Xe({...r(this,de),executor:r(this,de).executor.withPlugin(e)})}toOperationNode(){return r(this,de).executor.transformQuery(r(this,de).queryNode,r(this,de).queryId)}compile(){return r(this,de).executor.compileQuery(this.toOperationNode(),r(this,de).queryId)}async execute(){const e=this.compile(),n=e.query,i=await r(this,de).executor.executeQuery(e,r(this,de).queryId);return r(this,de).executor.adapter.supportsReturning&&n.returning?i.rows:[new Ap(i.numAffectedRows??i.numUpdatedOrDeletedRows??BigInt(0))]}async executeTakeFirst(){const[e]=await this.execute();return e}async executeTakeFirstOrThrow(e=gl){const n=await this.executeTakeFirst();if(n===void 0)throw bl(e)?new e(this.toOperationNode()):e(this.toOperationNode());return n}async*stream(e=100){const n=this.compile(),i=r(this,de).executor.stream(n,e,r(this,de).queryId);for await(const a of i)yield*a.rows}async explain(e,n){return await new Xe({...r(this,de),queryNode:ye.cloneWithExplain(r(this,de).queryNode,e,n)}).execute()}};let yc=Xe;de=new WeakMap;$e(yc,"don't await DeleteQueryBuilder instances directly. To execute the query you need to call `execute` or `executeTakeFirst`.");var za;class Sp{constructor(e){S(this,za,void 0);P(this,za,e)}get numUpdatedRows(){return r(this,za)}}za=new WeakMap;Object.defineProperty(Sp.prototype,"numUpdatedRows",{enumerable:!0});var pe;const nt=class{constructor(e){S(this,pe,void 0);P(this,pe,p(e))}where(...e){return new nt({...r(this,pe),queryNode:ye.cloneWithWhere(r(this,pe).queryNode,Rn(e))})}whereRef(e,n,i){return new nt({...r(this,pe),queryNode:ye.cloneWithWhere(r(this,pe).queryNode,zt(e,n,i))})}orWhere(...e){return new nt({...r(this,pe),queryNode:ye.cloneWithOrWhere(r(this,pe).queryNode,Rn(e))})}orWhereRef(e,n,i){return new nt({...r(this,pe),queryNode:ye.cloneWithOrWhere(r(this,pe).queryNode,zt(e,n,i))})}whereExists(e){return new nt({...r(this,pe),queryNode:ye.cloneWithWhere(r(this,pe).queryNode,sn(e))})}whereNotExists(e){return new nt({...r(this,pe),queryNode:ye.cloneWithWhere(r(this,pe).queryNode,Vt(e))})}orWhereExists(e){return new nt({...r(this,pe),queryNode:ye.cloneWithOrWhere(r(this,pe).queryNode,sn(e))})}orWhereNotExists(e){return new nt({...r(this,pe),queryNode:ye.cloneWithOrWhere(r(this,pe).queryNode,Vt(e))})}clearWhere(){return new nt({...r(this,pe),queryNode:ye.cloneWithoutWhere(r(this,pe).queryNode)})}from(e){return new nt({...r(this,pe),queryNode:dc.cloneWithFromItems(r(this,pe).queryNode,Fo(e))})}innerJoin(...e){return new nt({...r(this,pe),queryNode:ye.cloneWithJoin(r(this,pe).queryNode,vn("InnerJoin",e))})}leftJoin(...e){return new nt({...r(this,pe),queryNode:ye.cloneWithJoin(r(this,pe).queryNode,vn("LeftJoin",e))})}rightJoin(...e){return new nt({...r(this,pe),queryNode:ye.cloneWithJoin(r(this,pe).queryNode,vn("RightJoin",e))})}fullJoin(...e){return new nt({...r(this,pe),queryNode:ye.cloneWithJoin(r(this,pe).queryNode,vn("FullJoin",e))})}set(e){return new nt({...r(this,pe),queryNode:dc.cloneWithUpdates(r(this,pe).queryNode,Hf(e))})}returning(e){return new nt({...r(this,pe),queryNode:ye.cloneWithReturning(r(this,pe).queryNode,gu(e))})}returningAll(){return new nt({...r(this,pe),queryNode:ye.cloneWithReturning(r(this,pe).queryNode,bu())})}$call(e){return e(this)}call(e){return this.$call(e)}$if(e,n){return e?n(this):new nt({...r(this,pe)})}if(e,n){return this.$if(e,n)}$castTo(){return new nt(r(this,pe))}castTo(){return this.$castTo()}$narrowType(){return new nt(r(this,pe))}$assertType(){return new nt(r(this,pe))}assertType(){return new nt(r(this,pe))}withPlugin(e){return new nt({...r(this,pe),executor:r(this,pe).executor.withPlugin(e)})}toOperationNode(){return r(this,pe).executor.transformQuery(r(this,pe).queryNode,r(this,pe).queryId)}compile(){return r(this,pe).executor.compileQuery(this.toOperationNode(),r(this,pe).queryId)}async execute(){const e=this.compile(),n=e.query,i=await r(this,pe).executor.executeQuery(e,r(this,pe).queryId);return r(this,pe).executor.adapter.supportsReturning&&n.returning?i.rows:[new Sp(i.numAffectedRows??i.numUpdatedOrDeletedRows??BigInt(0))]}async executeTakeFirst(){const[e]=await this.execute();return e}async executeTakeFirstOrThrow(e=gl){const n=await this.executeTakeFirst();if(n===void 0)throw bl(e)?new e(this.toOperationNode()):e(this.toOperationNode());return n}async*stream(e=100){const n=this.compile(),i=r(this,pe).executor.stream(n,e,r(this,pe).queryId);for await(const a of i)yield*a.rows}async explain(e,n){return await new nt({...r(this,pe),queryNode:ye.cloneWithExplain(r(this,pe).queryNode,e,n)}).execute()}};let wc=nt;pe=new WeakMap;$e(wc,"don't await UpdateQueryBuilder instances directly. To execute the query you need to call `execute` or `executeTakeFirst`.");const Fg=p({is(t){return t.kind==="CommonTableExpressionNode"},create(t,e){return p({kind:"CommonTableExpressionNode",name:t,expression:e})}}),Ph=p({is(t){return t.kind==="CommonTableExpressionNameNode"},create(t,e){return p({kind:"CommonTableExpressionNameNode",table:Ni.create(t),columns:e?p(e.map(Nt.create)):void 0})}});function Mh(t,e){const n=e(Gg());return Fg.create(Ug(t),n.toOperationNode())}function Ug(t){if(t.includes("(")){const e=t.split(/[\(\)]/),n=e[0],i=e[1].split(",").map(a=>a.trim());return Ph.create(n,i)}else return Ph.create(t)}const Vu=p({is(t){return t.kind==="WithNode"},create(t,e){return p({kind:"WithNode",expressions:p([t]),...e})},cloneWithExpression(t,e){return p({...t,expressions:p([...t.expressions,e])})}}),Bh=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"];function $g(t){let e="";for(let n=0;nthis.transformNode(n)))}transformSelectQuery(e){return{kind:"SelectQueryNode",from:this.transformNode(e.from),selections:this.transformNodeList(e.selections),distinctOn:this.transformNodeList(e.distinctOn),joins:this.transformNodeList(e.joins),groupBy:this.transformNode(e.groupBy),orderBy:this.transformNode(e.orderBy),where:this.transformNode(e.where),frontModifiers:this.transformNodeList(e.frontModifiers),endModifiers:this.transformNodeList(e.endModifiers),limit:this.transformNode(e.limit),offset:this.transformNode(e.offset),with:this.transformNode(e.with),having:this.transformNode(e.having),explain:this.transformNode(e.explain),setOperations:this.transformNodeList(e.setOperations)}}transformSelection(e){return{kind:"SelectionNode",selection:this.transformNode(e.selection)}}transformColumn(e){return{kind:"ColumnNode",column:this.transformNode(e.column)}}transformAlias(e){return{kind:"AliasNode",node:this.transformNode(e.node),alias:this.transformNode(e.alias)}}transformTable(e){return{kind:"TableNode",table:this.transformNode(e.table)}}transformFrom(e){return{kind:"FromNode",froms:this.transformNodeList(e.froms)}}transformReference(e){return{kind:"ReferenceNode",table:this.transformNode(e.table),column:this.transformNode(e.column)}}transformAnd(e){return{kind:"AndNode",left:this.transformNode(e.left),right:this.transformNode(e.right)}}transformOr(e){return{kind:"OrNode",left:this.transformNode(e.left),right:this.transformNode(e.right)}}transformValueList(e){return{kind:"ValueListNode",values:this.transformNodeList(e.values)}}transformParens(e){return{kind:"ParensNode",node:this.transformNode(e.node)}}transformJoin(e){return{kind:"JoinNode",joinType:e.joinType,table:this.transformNode(e.table),on:this.transformNode(e.on)}}transformRaw(e){return{kind:"RawNode",sqlFragments:p([...e.sqlFragments]),parameters:this.transformNodeList(e.parameters)}}transformWhere(e){return{kind:"WhereNode",where:this.transformNode(e.where)}}transformInsertQuery(e){return{kind:"InsertQueryNode",into:this.transformNode(e.into),columns:this.transformNodeList(e.columns),values:this.transformNode(e.values),returning:this.transformNode(e.returning),onConflict:this.transformNode(e.onConflict),onDuplicateKey:this.transformNode(e.onDuplicateKey),with:this.transformNode(e.with),ignore:e.ignore,replace:e.replace,explain:this.transformNode(e.explain)}}transformValues(e){return{kind:"ValuesNode",values:this.transformNodeList(e.values)}}transformDeleteQuery(e){return{kind:"DeleteQueryNode",from:this.transformNode(e.from),using:this.transformNode(e.using),joins:this.transformNodeList(e.joins),where:this.transformNode(e.where),returning:this.transformNode(e.returning),with:this.transformNode(e.with),orderBy:this.transformNode(e.orderBy),limit:this.transformNode(e.limit),explain:this.transformNode(e.explain)}}transformReturning(e){return{kind:"ReturningNode",selections:this.transformNodeList(e.selections)}}transformCreateTable(e){return{kind:"CreateTableNode",table:this.transformNode(e.table),columns:this.transformNodeList(e.columns),constraints:this.transformNodeList(e.constraints),temporary:e.temporary,ifNotExists:e.ifNotExists,onCommit:e.onCommit,frontModifiers:this.transformNodeList(e.frontModifiers),endModifiers:this.transformNodeList(e.endModifiers)}}transformColumnDefinition(e){return{kind:"ColumnDefinitionNode",column:this.transformNode(e.column),dataType:this.transformNode(e.dataType),references:this.transformNode(e.references),primaryKey:e.primaryKey,autoIncrement:e.autoIncrement,unique:e.unique,notNull:e.notNull,unsigned:e.unsigned,defaultTo:this.transformNode(e.defaultTo),check:this.transformNode(e.check),generated:this.transformNode(e.generated),frontModifiers:this.transformNodeList(e.frontModifiers),endModifiers:this.transformNodeList(e.endModifiers)}}transformAddColumn(e){return{kind:"AddColumnNode",column:this.transformNode(e.column)}}transformDropTable(e){return{kind:"DropTableNode",table:this.transformNode(e.table),ifExists:e.ifExists,cascade:e.cascade}}transformOrderBy(e){return{kind:"OrderByNode",items:this.transformNodeList(e.items)}}transformOrderByItem(e){return{kind:"OrderByItemNode",orderBy:this.transformNode(e.orderBy),direction:this.transformNode(e.direction)}}transformGroupBy(e){return{kind:"GroupByNode",items:this.transformNodeList(e.items)}}transformGroupByItem(e){return{kind:"GroupByItemNode",groupBy:this.transformNode(e.groupBy)}}transformUpdateQuery(e){return{kind:"UpdateQueryNode",table:this.transformNode(e.table),from:this.transformNode(e.from),joins:this.transformNodeList(e.joins),where:this.transformNode(e.where),updates:this.transformNodeList(e.updates),returning:this.transformNode(e.returning),with:this.transformNode(e.with),explain:this.transformNode(e.explain)}}transformColumnUpdate(e){return{kind:"ColumnUpdateNode",column:this.transformNode(e.column),value:this.transformNode(e.value)}}transformLimit(e){return{kind:"LimitNode",limit:this.transformNode(e.limit)}}transformOffset(e){return{kind:"OffsetNode",offset:this.transformNode(e.offset)}}transformOnConflict(e){return{kind:"OnConflictNode",columns:this.transformNodeList(e.columns),constraint:this.transformNode(e.constraint),indexExpression:this.transformNode(e.indexExpression),indexWhere:this.transformNode(e.indexWhere),updates:this.transformNodeList(e.updates),updateWhere:this.transformNode(e.updateWhere),doNothing:e.doNothing}}transformOnDuplicateKey(e){return{kind:"OnDuplicateKeyNode",updates:this.transformNodeList(e.updates)}}transformCreateIndex(e){return{kind:"CreateIndexNode",name:this.transformNode(e.name),table:this.transformNode(e.table),columns:this.transformNodeList(e.columns),unique:e.unique,using:this.transformNode(e.using),ifNotExists:e.ifNotExists,where:this.transformNode(e.where)}}transformList(e){return{kind:"ListNode",items:this.transformNodeList(e.items)}}transformDropIndex(e){return{kind:"DropIndexNode",name:this.transformNode(e.name),table:this.transformNode(e.table),ifExists:e.ifExists,cascade:e.cascade}}transformPrimaryKeyConstraint(e){return{kind:"PrimaryKeyConstraintNode",columns:this.transformNodeList(e.columns),name:this.transformNode(e.name)}}transformUniqueConstraint(e){return{kind:"UniqueConstraintNode",columns:this.transformNodeList(e.columns),name:this.transformNode(e.name)}}transformForeignKeyConstraint(e){return{kind:"ForeignKeyConstraintNode",columns:this.transformNodeList(e.columns),references:this.transformNode(e.references),name:this.transformNode(e.name),onDelete:e.onDelete,onUpdate:e.onUpdate}}transformSetOperation(e){return{kind:"SetOperationNode",operator:e.operator,expression:this.transformNode(e.expression),all:e.all}}transformReferences(e){return{kind:"ReferencesNode",table:this.transformNode(e.table),columns:this.transformNodeList(e.columns),onDelete:e.onDelete,onUpdate:e.onUpdate}}transformCheckConstraint(e){return{kind:"CheckConstraintNode",expression:this.transformNode(e.expression),name:this.transformNode(e.name)}}transformWith(e){return{kind:"WithNode",expressions:this.transformNodeList(e.expressions),recursive:e.recursive}}transformCommonTableExpression(e){return{kind:"CommonTableExpressionNode",name:this.transformNode(e.name),expression:this.transformNode(e.expression)}}transformCommonTableExpressionName(e){return{kind:"CommonTableExpressionNameNode",table:this.transformNode(e.table),columns:this.transformNodeList(e.columns)}}transformHaving(e){return{kind:"HavingNode",having:this.transformNode(e.having)}}transformCreateSchema(e){return{kind:"CreateSchemaNode",schema:this.transformNode(e.schema),ifNotExists:e.ifNotExists}}transformDropSchema(e){return{kind:"DropSchemaNode",schema:this.transformNode(e.schema),ifExists:e.ifExists,cascade:e.cascade}}transformAlterTable(e){return{kind:"AlterTableNode",table:this.transformNode(e.table),renameTo:this.transformNode(e.renameTo),setSchema:this.transformNode(e.setSchema),columnAlterations:this.transformNodeList(e.columnAlterations),addConstraint:this.transformNode(e.addConstraint),dropConstraint:this.transformNode(e.dropConstraint)}}transformDropColumn(e){return{kind:"DropColumnNode",column:this.transformNode(e.column)}}transformRenameColumn(e){return{kind:"RenameColumnNode",column:this.transformNode(e.column),renameTo:this.transformNode(e.renameTo)}}transformAlterColumn(e){return{kind:"AlterColumnNode",column:this.transformNode(e.column),dataType:this.transformNode(e.dataType),dataTypeExpression:this.transformNode(e.dataTypeExpression),setDefault:this.transformNode(e.setDefault),dropDefault:e.dropDefault,setNotNull:e.setNotNull,dropNotNull:e.dropNotNull}}transformModifyColumn(e){return{kind:"ModifyColumnNode",column:this.transformNode(e.column)}}transformAddConstraint(e){return{kind:"AddConstraintNode",constraint:this.transformNode(e.constraint)}}transformDropConstraint(e){return{kind:"DropConstraintNode",constraintName:this.transformNode(e.constraintName),ifExists:e.ifExists,modifier:e.modifier}}transformCreateView(e){return{kind:"CreateViewNode",name:this.transformNode(e.name),temporary:e.temporary,orReplace:e.orReplace,ifNotExists:e.ifNotExists,materialized:e.materialized,columns:this.transformNodeList(e.columns),as:this.transformNode(e.as)}}transformDropView(e){return{kind:"DropViewNode",name:this.transformNode(e.name),ifExists:e.ifExists,materialized:e.materialized,cascade:e.cascade}}transformGenerated(e){return{kind:"GeneratedNode",byDefault:e.byDefault,always:e.always,identity:e.identity,stored:e.stored,expression:this.transformNode(e.expression)}}transformDefaultValue(e){return{kind:"DefaultValueNode",defaultValue:this.transformNode(e.defaultValue)}}transformOn(e){return{kind:"OnNode",on:this.transformNode(e.on)}}transformSelectModifier(e){return{kind:"SelectModifierNode",modifier:e.modifier,rawModifier:this.transformNode(e.rawModifier)}}transformCreateType(e){return{kind:"CreateTypeNode",name:this.transformNode(e.name),enum:this.transformNode(e.enum)}}transformDropType(e){return{kind:"DropTypeNode",name:this.transformNode(e.name),ifExists:e.ifExists}}transformExplain(e){return{kind:"ExplainNode",format:e.format,options:this.transformNode(e.options)}}transformSchemableIdentifier(e){return{kind:"SchemableIdentifierNode",schema:this.transformNode(e.schema),identifier:this.transformNode(e.identifier)}}transformAggregateFunction(e){return{kind:"AggregateFunctionNode",aggregated:this.transformNodeList(e.aggregated),distinct:e.distinct,filter:this.transformNode(e.filter),func:e.func,over:this.transformNode(e.over)}}transformOver(e){return{kind:"OverNode",orderBy:this.transformNode(e.orderBy),partitionBy:this.transformNode(e.partitionBy)}}transformPartitionBy(e){return{kind:"PartitionByNode",items:this.transformNodeList(e.items)}}transformPartitionByItem(e){return{kind:"PartitionByItemNode",partitionBy:this.transformNode(e.partitionBy)}}transformBinaryOperation(e){return{kind:"BinaryOperationNode",leftOperand:this.transformNode(e.leftOperand),operator:this.transformNode(e.operator),rightOperand:this.transformNode(e.rightOperand)}}transformUnaryOperation(e){return{kind:"UnaryOperationNode",operator:this.transformNode(e.operator),operand:this.transformNode(e.operand)}}transformUsing(e){return{kind:"UsingNode",tables:this.transformNodeList(e.tables)}}transformFunction(e){return{kind:"FunctionNode",func:e.func,arguments:this.transformNodeList(e.arguments)}}transformCase(e){return{kind:"CaseNode",value:this.transformNode(e.value),when:this.transformNodeList(e.when),else:this.transformNode(e.else),isStatement:e.isStatement}}transformWhen(e){return{kind:"WhenNode",condition:this.transformNode(e.condition),result:this.transformNode(e.result)}}transformDataType(e){return e}transformSelectAll(e){return e}transformIdentifier(e){return e}transformValue(e){return e}transformPrimitiveValueList(e){return e}transformOperator(e){return e}transformDefaultInsertValue(e){return e}}Dc=new WeakMap;const Hg=p({AlterTableNode:!0,CreateIndexNode:!0,CreateSchemaNode:!0,CreateTableNode:!0,CreateTypeNode:!0,CreateViewNode:!0,DeleteQueryNode:!0,DropIndexNode:!0,DropSchemaNode:!0,DropTableNode:!0,DropTypeNode:!0,DropViewNode:!0,InsertQueryNode:!0,RawNode:!0,SelectQueryNode:!0,UpdateQueryNode:!0});var oo,is,Lc,kp,Pc,Rp,ss,wa,Ka,af,Mc,Dp;class Vg extends Vf{constructor(n){super();S(this,Lc);S(this,Pc);S(this,ss);S(this,Ka);S(this,Mc);S(this,oo,void 0);S(this,is,new Set);P(this,oo,n)}transformNodeImpl(n){if(!qe(this,Lc,kp).call(this,n))return super.transformNodeImpl(n);const i=qe(this,Pc,Rp).call(this,n);for(const l of i)r(this,is).add(l);const a=super.transformNodeImpl(n);for(const l of i)r(this,is).delete(l);return a}transformSchemableIdentifier(n){const i=super.transformSchemableIdentifier(n);return i.schema||!r(this,is).has(n.identifier.name)?i:{...i,schema:mt.create(r(this,oo))}}transformReferences(n){const i=super.transformReferences(n);return i.table.table.schema?i:{...i,table:Ni.createWithSchema(r(this,oo),i.table.table.identifier.name)}}}oo=new WeakMap,is=new WeakMap,Lc=new WeakSet,kp=function(n){return n.kind in Hg},Pc=new WeakSet,Rp=function(n){const i=new Set;if("name"in n&&n.name&&xi.is(n.name)&&qe(this,Ka,af).call(this,n.name,i),"from"in n&&n.from)for(const a of n.from.froms)qe(this,ss,wa).call(this,a,i);if("into"in n&&n.into&&qe(this,ss,wa).call(this,n.into,i),"table"in n&&n.table&&qe(this,ss,wa).call(this,n.table,i),"joins"in n&&n.joins)for(const a of n.joins)qe(this,ss,wa).call(this,a.table,i);return"with"in n&&n.with&&qe(this,Mc,Dp).call(this,n.with,i),i},ss=new WeakSet,wa=function(n,i){const a=Ni.is(n)?n:Es.is(n)&&Ni.is(n.node)?n.node:null;a&&qe(this,Ka,af).call(this,a.table,i)},Ka=new WeakSet,af=function(n,i){r(this,is).has(n.identifier.name)||i.add(n.identifier.name)},Mc=new WeakSet,Dp=function(n,i){for(const a of n.expressions)i.delete(a.name.table.table.identifier.name)};var Ja;class Nu{constructor(e){S(this,Ja,void 0);P(this,Ja,new Vg(e))}transformQuery(e){return r(this,Ja).transformNode(e.node)}async transformResult(e){return e.result}}Ja=new WeakMap;var rt;const es=class{constructor(e){S(this,rt,void 0);P(this,rt,p(e))}selectFrom(e){return new Bo({queryId:et(),executor:r(this,rt).executor,queryNode:We.create(Fo(e),r(this,rt).withNode)})}insertInto(e){return new Ma({queryId:et(),executor:r(this,rt).executor,queryNode:Or.create(_n(e),r(this,rt).withNode)})}replaceInto(e){return new Ma({queryId:et(),executor:r(this,rt).executor,queryNode:Or.create(_n(e),r(this,rt).withNode,!0)})}deleteFrom(e){return new yc({queryId:et(),executor:r(this,rt).executor,queryNode:xa.create(Fo(e),r(this,rt).withNode)})}updateTable(e){return new wc({queryId:et(),executor:r(this,rt).executor,queryNode:dc.create(Fa(e),r(this,rt).withNode)})}with(e,n){const i=Mh(e,n);return new es({...r(this,rt),withNode:r(this,rt).withNode?Vu.cloneWithExpression(r(this,rt).withNode,i):Vu.create(i)})}withRecursive(e,n){const i=Mh(e,n);return new es({...r(this,rt),withNode:r(this,rt).withNode?Vu.cloneWithExpression(r(this,rt).withNode,i):Vu.create(i,{recursive:!0})})}withPlugin(e){return new es({...r(this,rt),executor:r(this,rt).executor.withPlugin(e)})}withoutPlugins(){return new es({...r(this,rt),executor:r(this,rt).executor.withoutPlugins()})}withSchema(e){return new es({...r(this,rt),executor:r(this,rt).executor.withPluginAtFront(new Nu(e))})}};let gc=es;rt=new WeakMap;var Ga,ao,uo;class Fh{constructor(){S(this,Ga,void 0);S(this,ao,void 0);S(this,uo,void 0);Yt(this,"resolve",e=>{r(this,ao)&&r(this,ao).call(this,e)});Yt(this,"reject",e=>{r(this,uo)&&r(this,uo).call(this,e)});P(this,Ga,new Promise((e,n)=>{P(this,uo,n),P(this,ao,e)}))}get promise(){return r(this,Ga)}}Ga=new WeakMap,ao=new WeakMap,uo=new WeakMap;const Uh=new Set;function zg(t){Uh.has(t)||(Uh.add(t),console.log(t))}const Kg=p([]);var os,Xa,uf;class Lp{constructor(e=Kg){S(this,Xa);S(this,os,void 0);P(this,os,e)}get plugins(){return r(this,os)}transformQuery(e,n){for(const i of r(this,os)){const a=i.transformQuery({node:e,queryId:n});if(a.kind===e.kind)e=a;else throw new Error(["KyselyPlugin.transformQuery must return a node","of the same kind that was given to it.",`The plugin was given a ${e.kind}`,`but it returned a ${a.kind}`].join(" "))}return e}async executeQuery(e,n){return await this.provideConnection(async i=>{const a=await i.executeQuery(e),l=await qe(this,Xa,uf).call(this,a,n);return Jg(a,l),l})}async*stream(e,n,i){const a=new Fh,l=new Fh;this.provideConnection(async w=>(a.resolve(w),await l.promise)).catch(w=>a.reject(w));const m=await a.promise;try{for await(const w of m.streamQuery(e,n))yield await qe(this,Xa,uf).call(this,w,i)}finally{l.resolve()}}}os=new WeakMap,Xa=new WeakSet,uf=async function(e,n){for(const i of r(this,os))e=await i.transformResult({result:e,queryId:n});return e};function Jg(t,e){const{numAffectedRows:n}=t;n===void 0&&t.numUpdatedOrDeletedRows===void 0||n!==void 0&&e.numAffectedRows!==void 0||zg("kysely:warning: outdated driver/plugin detected! QueryResult.numUpdatedOrDeletedRows is deprecated and will be removed in a future release.")}class Js extends Lp{get adapter(){throw new Error("this query cannot be compiled to SQL")}compileQuery(){throw new Error("this query cannot be compiled to SQL")}provideConnection(){throw new Error("this query cannot be executed")}withConnectionProvider(){throw new Error("this query cannot have a connection provider")}withPlugin(e){return new Js([...this.plugins,e])}withPlugins(e){return new Js([...this.plugins,...e])}withPluginAtFront(e){return new Js([e,...this.plugins])}withoutPlugins(){return new Js([])}}const Nl=new Js;function $h(){return new Bo({queryId:et(),executor:Nl,queryNode:We.create(Fo([]))})}function Gg(){return new gc({executor:Nl})}function Pp(t,e){return new fc({joinNode:jn.create(t,Fa(e))})}function Xg(){return new hc({overNode:of.create()})}const zf=p({is(t){return t.kind==="WhenNode"},create(t){return p({kind:"WhenNode",condition:t})},cloneWithResult(t,e){return p({...t,result:e})}}),dr=p({is(t){return t.kind==="CaseNode"},create(t){return p({kind:"CaseNode",value:t})},cloneWithWhen(t,e){return p({...t,when:p(t.when?[...t.when,e]:[e])})},cloneWithThen(t,e){return p({...t,when:t.when?p([...t.when.slice(0,-1),zf.cloneWithResult(t.when[t.when.length-1],e)]):void 0})},cloneWith(t,e){return p({...t,...e})}});function cf(t,e,n){if(!vp(e)&&!hn(e))throw new Error(`invalid binary operator ${JSON.stringify(e)}`);return eb(e,n)?tb(t,e,n):ml.create(Hr(t),Kf(e),Op(n))}function Yg(t,e,n){if(!vp(e)&&!hn(e))throw new Error(`invalid binary operator ${JSON.stringify(e)}`);return ml.create(Hr(t),Kf(e),Hr(n))}function Zg(t,e,n){if(!_p(e)&&!hn(e))throw new Error(`invalid comparison operator ${JSON.stringify(e)}`);return cf(t,e,n)}function zt(t,e,n){if(!_p(e)&&!hn(e))throw new Error(`invalid comparison operator ${JSON.stringify(e)}`);return Yg(t,e,n)}function Rn(t){return vl("where",t)}function Qh(t){return vl("having",t)}function jh(t){return vl("on",t)}function Mp(t){return vl("when",t)}function vl(t,e){if(e.length===3)return Zg(e[0],e[1],e[2]);if(e.length===1)return nb(t,e[0]);throw Bp(t,e)}function eb(t,e){return(t==="is"||t==="is not")&&(wp(e)||yp(e))}function tb(t,e,n){return ml.create(Hr(t),Kf(e),Ir.createImmediate(n))}function Kf(t){if(mr(t)&&gg.includes(t))return Ff.create(t);if(hn(t))return t.toOperationNode();throw new Error(`invalid operator ${JSON.stringify(t)}`)}function nb(t,e){if(Vn(e)){if(t==="when")throw new Error("when method doesn't accept a callback as an argument");return rb[t](e)}else if(hn(e)){const n=e.toOperationNode();if(en.is(n)||ml.is(n)||qp.is(n)||ro.is(n)||dr.is(n))return n}else if(t==="when")return Ir.create(e);throw Bp(t,e)}function Bp(t,e){return new Error(`invalid arguments passed to a '${t}' method: ${JSON.stringify(e)}`)}const rb=p({where(t){const e=$h(),n=$r(),a=t(Object.assign(e,n)).toOperationNode();if(We.is(a)){if(!a.where)throw new Error("no `where` methods called inside a group callback");return ro.create(a.where.where)}else return a},having(t){const e=$h(),n=$r(),a=t(Object.assign(e,n)).toOperationNode();if(We.is(a)){if(!a.having)throw new Error("no `having` methods called inside a group callback");return ro.create(a.having.having)}else return a},on(t){const e=Pp("InnerJoin","table"),n=$r(),a=t(Object.assign(e,n)).toOperationNode();if(jn.is(a)){if(!a.on)throw new Error("no `on` methods called inside a group callback");return ro.create(a.on.on)}else return a}});function vn(t,e){if(e.length===3)return sb(t,e[0],e[1],e[2]);if(e.length===2)return ib(t,e[0],e[1]);throw new Error("not implemented")}function ib(t,e,n){return n(Pp(t,e)).toOperationNode()}function sb(t,e,n,i){return jn.createWithOn(t,Fa(e),zt(n,"=",i))}const ob=p({is(t){return t.kind==="OffsetNode"},create(t){return p({kind:"OffsetNode",offset:Ir.create(t)})}}),ab=p({is(t){return t.kind==="GroupByItemNode"},create(t){return p({kind:"GroupByItemNode",groupBy:t})}});function ub(t){return t=Vn(t)?t($r()):t,Pa(t).map(ab.create)}const Fp=p({is(t){return t.kind==="SetOperationNode"},create(t,e,n){return p({kind:"SetOperationNode",operator:t,expression:e,all:n})}});function js(t,e,n){return Fp.create(t,e.toOperationNode(),n)}var $;const he=class{constructor(e){S(this,$,void 0);P(this,$,p(e))}get expressionType(){}where(...e){return new he({...r(this,$),queryNode:ye.cloneWithWhere(r(this,$).queryNode,Rn(e))})}whereRef(e,n,i){return new he({...r(this,$),queryNode:ye.cloneWithWhere(r(this,$).queryNode,zt(e,n,i))})}orWhere(...e){return new he({...r(this,$),queryNode:ye.cloneWithOrWhere(r(this,$).queryNode,Rn(e))})}orWhereRef(e,n,i){return new he({...r(this,$),queryNode:ye.cloneWithOrWhere(r(this,$).queryNode,zt(e,n,i))})}whereExists(e){return new he({...r(this,$),queryNode:ye.cloneWithWhere(r(this,$).queryNode,sn(e))})}whereNotExists(e){return new he({...r(this,$),queryNode:ye.cloneWithWhere(r(this,$).queryNode,Vt(e))})}orWhereExists(e){return new he({...r(this,$),queryNode:ye.cloneWithOrWhere(r(this,$).queryNode,sn(e))})}orWhereNotExists(e){return new he({...r(this,$),queryNode:ye.cloneWithOrWhere(r(this,$).queryNode,Vt(e))})}having(...e){return new he({...r(this,$),queryNode:We.cloneWithHaving(r(this,$).queryNode,Qh(e))})}havingRef(e,n,i){return new he({...r(this,$),queryNode:We.cloneWithHaving(r(this,$).queryNode,zt(e,n,i))})}orHaving(...e){return new he({...r(this,$),queryNode:We.cloneWithOrHaving(r(this,$).queryNode,Qh(e))})}orHavingRef(e,n,i){return new he({...r(this,$),queryNode:We.cloneWithOrHaving(r(this,$).queryNode,zt(e,n,i))})}havingExists(e){return new he({...r(this,$),queryNode:We.cloneWithHaving(r(this,$).queryNode,sn(e))})}havingNotExist(e){return new he({...r(this,$),queryNode:We.cloneWithHaving(r(this,$).queryNode,Vt(e))})}havingNotExists(e){return new he({...r(this,$),queryNode:We.cloneWithHaving(r(this,$).queryNode,Vt(e))})}orHavingExists(e){return new he({...r(this,$),queryNode:We.cloneWithOrHaving(r(this,$).queryNode,sn(e))})}orHavingNotExists(e){return new he({...r(this,$),queryNode:We.cloneWithOrHaving(r(this,$).queryNode,Vt(e))})}select(e){return new he({...r(this,$),queryNode:We.cloneWithSelections(r(this,$).queryNode,gu(e))})}distinctOn(e){return new he({...r(this,$),queryNode:We.cloneWithDistinctOn(r(this,$).queryNode,Pa(e))})}modifyFront(e){return new he({...r(this,$),queryNode:We.cloneWithFrontModifier(r(this,$).queryNode,Sr.createWithExpression(e.toOperationNode()))})}modifyEnd(e){return new he({...r(this,$),queryNode:We.cloneWithEndModifier(r(this,$).queryNode,Sr.createWithExpression(e.toOperationNode()))})}distinct(){return new he({...r(this,$),queryNode:We.cloneWithFrontModifier(r(this,$).queryNode,Sr.create("Distinct"))})}forUpdate(){return new he({...r(this,$),queryNode:We.cloneWithEndModifier(r(this,$).queryNode,Sr.create("ForUpdate"))})}forShare(){return new he({...r(this,$),queryNode:We.cloneWithEndModifier(r(this,$).queryNode,Sr.create("ForShare"))})}forKeyShare(){return new he({...r(this,$),queryNode:We.cloneWithEndModifier(r(this,$).queryNode,Sr.create("ForKeyShare"))})}forNoKeyUpdate(){return new he({...r(this,$),queryNode:We.cloneWithEndModifier(r(this,$).queryNode,Sr.create("ForNoKeyUpdate"))})}skipLocked(){return new he({...r(this,$),queryNode:We.cloneWithEndModifier(r(this,$).queryNode,Sr.create("SkipLocked"))})}noWait(){return new he({...r(this,$),queryNode:We.cloneWithEndModifier(r(this,$).queryNode,Sr.create("NoWait"))})}selectAll(e){return new he({...r(this,$),queryNode:We.cloneWithSelections(r(this,$).queryNode,bu(e))})}innerJoin(...e){return new he({...r(this,$),queryNode:ye.cloneWithJoin(r(this,$).queryNode,vn("InnerJoin",e))})}leftJoin(...e){return new he({...r(this,$),queryNode:ye.cloneWithJoin(r(this,$).queryNode,vn("LeftJoin",e))})}rightJoin(...e){return new he({...r(this,$),queryNode:ye.cloneWithJoin(r(this,$).queryNode,vn("RightJoin",e))})}fullJoin(...e){return new he({...r(this,$),queryNode:ye.cloneWithJoin(r(this,$).queryNode,vn("FullJoin",e))})}innerJoinLateral(...e){return new he({...r(this,$),queryNode:ye.cloneWithJoin(r(this,$).queryNode,vn("LateralInnerJoin",e))})}leftJoinLateral(...e){return new he({...r(this,$),queryNode:ye.cloneWithJoin(r(this,$).queryNode,vn("LateralLeftJoin",e))})}orderBy(e,n){return new he({...r(this,$),queryNode:We.cloneWithOrderByItem(r(this,$).queryNode,wl(e,n))})}groupBy(e){return new he({...r(this,$),queryNode:We.cloneWithGroupByItems(r(this,$).queryNode,ub(e))})}limit(e){return new he({...r(this,$),queryNode:We.cloneWithLimit(r(this,$).queryNode,Tp.create(e))})}offset(e){return new he({...r(this,$),queryNode:We.cloneWithOffset(r(this,$).queryNode,ob.create(e))})}union(e){return new he({...r(this,$),queryNode:We.cloneWithSetOperation(r(this,$).queryNode,js("union",e,!1))})}unionAll(e){return new he({...r(this,$),queryNode:We.cloneWithSetOperation(r(this,$).queryNode,js("union",e,!0))})}intersect(e){return new he({...r(this,$),queryNode:We.cloneWithSetOperation(r(this,$).queryNode,js("intersect",e,!1))})}intersectAll(e){return new he({...r(this,$),queryNode:We.cloneWithSetOperation(r(this,$).queryNode,js("intersect",e,!0))})}except(e){return new he({...r(this,$),queryNode:We.cloneWithSetOperation(r(this,$).queryNode,js("except",e,!1))})}exceptAll(e){return new he({...r(this,$),queryNode:We.cloneWithSetOperation(r(this,$).queryNode,js("except",e,!0))})}as(e){return new cb(this,e)}clearSelect(){return new he({...r(this,$),queryNode:We.cloneWithoutSelections(r(this,$).queryNode)})}clearWhere(){return new he({...r(this,$),queryNode:ye.cloneWithoutWhere(r(this,$).queryNode)})}clearLimit(){return new he({...r(this,$),queryNode:We.cloneWithoutLimit(r(this,$).queryNode)})}clearOffset(){return new he({...r(this,$),queryNode:We.cloneWithoutOffset(r(this,$).queryNode)})}clearOrderBy(){return new he({...r(this,$),queryNode:We.cloneWithoutOrderBy(r(this,$).queryNode)})}$call(e){return e(this)}call(e){return this.$call(e)}$if(e,n){return e?n(this):new he({...r(this,$)})}if(e,n){return this.$if(e,n)}$castTo(){return new he(r(this,$))}castTo(){return this.$castTo()}$narrowType(){return new he(r(this,$))}$assertType(){return new he(r(this,$))}assertType(){return new he(r(this,$))}withPlugin(e){return new he({...r(this,$),executor:r(this,$).executor.withPlugin(e)})}toOperationNode(){return r(this,$).executor.transformQuery(r(this,$).queryNode,r(this,$).queryId)}compile(){return r(this,$).executor.compileQuery(this.toOperationNode(),r(this,$).queryId)}async execute(){const e=this.compile();return(await r(this,$).executor.executeQuery(e,r(this,$).queryId)).rows}async executeTakeFirst(){const[e]=await this.execute();return e}async executeTakeFirstOrThrow(e=gl){const n=await this.executeTakeFirst();if(n===void 0)throw bl(e)?new e(this.toOperationNode()):e(this.toOperationNode());return n}async*stream(e=100){const n=this.compile(),i=r(this,$).executor.stream(n,e,r(this,$).queryId);for await(const a of i)yield*a.rows}async explain(e,n){return await new he({...r(this,$),queryNode:ye.cloneWithExplain(r(this,$).queryNode,e,n)}).execute()}};let Bo=he;$=new WeakMap;$e(Bo,"don't await SelectQueryBuilder instances directly. To execute the query you need to call `execute` or `executeTakeFirst`.");var co,lo;class cb{constructor(e,n){S(this,co,void 0);S(this,lo,void 0);P(this,co,e),P(this,lo,n)}get expression(){return r(this,co)}get alias(){return r(this,lo)}toOperationNode(){return Es.create(r(this,co).toOperationNode(),mt.create(r(this,lo)))}}co=new WeakMap,lo=new WeakMap;var fo;const Yf=class{constructor(e){S(this,fo,void 0);P(this,fo,e)}get expressionType(){}as(e){return new lb(this,e)}$castTo(){return new Yf(r(this,fo))}toOperationNode(){return r(this,fo)}};let Dt=Yf;fo=new WeakMap;var ho,ci;class lb{constructor(e,n){S(this,ho,void 0);S(this,ci,void 0);P(this,ho,e),P(this,ci,n)}get expression(){return r(this,ho)}get alias(){return r(this,ci)}toOperationNode(){return Es.create(r(this,ho).toOperationNode(),hn(r(this,ci))?r(this,ci).toOperationNode():mt.create(r(this,ci)))}}ho=new WeakMap,ci=new WeakMap;const Un=p({is(t){return t.kind==="AggregateFunctionNode"},create(t,e=[]){return p({kind:"AggregateFunctionNode",func:t,aggregated:e})},cloneWithDistinct(t){return p({...t,distinct:!0})},cloneWithFilter(t,e){return p({...t,filter:t.filter?tn.cloneWithOperation(t.filter,"And",e):tn.create(e)})},cloneWithOrFilter(t,e){return p({...t,filter:t.filter?tn.cloneWithOperation(t.filter,"Or",e):tn.create(e)})},cloneWithOver(t,e){return p({...t,over:e})}}),fb=p({is(t){return t.kind==="FunctionNode"},create(t,e){return p({kind:"FunctionNode",func:t,arguments:e})}});var st;const $n=class{constructor(e){S(this,st,void 0);P(this,st,p(e))}get expressionType(){}as(e){return new hb(this,e)}distinct(){return new $n({...r(this,st),aggregateFunctionNode:Un.cloneWithDistinct(r(this,st).aggregateFunctionNode)})}filterWhere(...e){return new $n({...r(this,st),aggregateFunctionNode:Un.cloneWithFilter(r(this,st).aggregateFunctionNode,Rn(e))})}filterWhereExists(e){return new $n({...r(this,st),aggregateFunctionNode:Un.cloneWithFilter(r(this,st).aggregateFunctionNode,sn(e))})}filterWhereNotExists(e){return new $n({...r(this,st),aggregateFunctionNode:Un.cloneWithFilter(r(this,st).aggregateFunctionNode,Vt(e))})}filterWhereRef(e,n,i){return new $n({...r(this,st),aggregateFunctionNode:Un.cloneWithFilter(r(this,st).aggregateFunctionNode,zt(e,n,i))})}orFilterWhere(...e){return new $n({...r(this,st),aggregateFunctionNode:Un.cloneWithOrFilter(r(this,st).aggregateFunctionNode,Rn(e))})}orFilterWhereExists(e){return new $n({...r(this,st),aggregateFunctionNode:Un.cloneWithOrFilter(r(this,st).aggregateFunctionNode,sn(e))})}orFilterWhereNotExists(e){return new $n({...r(this,st),aggregateFunctionNode:Un.cloneWithOrFilter(r(this,st).aggregateFunctionNode,Vt(e))})}orFilterWhereRef(e,n,i){return new $n({...r(this,st),aggregateFunctionNode:Un.cloneWithOrFilter(r(this,st).aggregateFunctionNode,zt(e,n,i))})}over(e){const n=Xg();return new $n({...r(this,st),aggregateFunctionNode:Un.cloneWithOver(r(this,st).aggregateFunctionNode,(e?e(n):n).toOperationNode())})}$call(e){return e(this)}toOperationNode(){return r(this,st).aggregateFunctionNode}};let Ba=$n;st=new WeakMap;$e(Ba,"don't await AggregateFunctionBuilder instances. They are never executed directly and are always just a part of a query.");var po,mo;class hb{constructor(e,n){S(this,po,void 0);S(this,mo,void 0);P(this,po,e),P(this,mo,n)}get expression(){return r(this,po)}get alias(){return r(this,mo)}toOperationNode(){return Es.create(r(this,po).toOperationNode(),mt.create(r(this,mo)))}}po=new WeakMap,mo=new WeakMap;function Up(){const t=(n,i)=>new Dt(fb.create(n,Pa(i))),e=(n,i)=>new Ba({aggregateFunctionNode:Un.create(n,i?Pa(i):void 0)});return Object.assign(t,{agg:e,avg(n){return e("avg",[n])},coalesce(n,...i){return t("coalesce",[n,...i])},count(n){return e("count",[n])},countAll(n){return new Ba({aggregateFunctionNode:Un.create("count",bu(n))})},max(n){return e("max",[n])},min(n){return e("min",[n])},sum(n){return e("sum",[n])}})}var yo;class $p{constructor(e){S(this,yo,void 0);P(this,yo,p(e))}when(...e){return new Qp({...r(this,yo),node:dr.cloneWithWhen(r(this,yo).node,zf.create(Mp(e)))})}}yo=new WeakMap;var wo;class Qp{constructor(e){S(this,wo,void 0);P(this,wo,p(e))}then(e){return new db({...r(this,wo),node:dr.cloneWithThen(r(this,wo).node,Ur(e))})}}wo=new WeakMap;var _r;class db{constructor(e){S(this,_r,void 0);P(this,_r,p(e))}when(...e){return new Qp({...r(this,_r),node:dr.cloneWithWhen(r(this,_r).node,zf.create(Mp(e)))})}else(e){return new pb({...r(this,_r),node:dr.cloneWith(r(this,_r).node,{else:Ur(e)})})}end(){return new Dt(dr.cloneWith(r(this,_r).node,{isStatement:!1}))}endCase(){return new Dt(dr.cloneWith(r(this,_r).node,{isStatement:!0}))}}_r=new WeakMap;var go;class pb{constructor(e){S(this,go,void 0);P(this,go,p(e))}end(){return new Dt(dr.cloneWith(r(this,go).node,{isStatement:!1}))}endCase(){return new Dt(dr.cloneWith(r(this,go).node,{isStatement:!0}))}}go=new WeakMap;function jp(t=Nl){function e(n,i){return new Dt(jf(n,i))}return{get fn(){return Up()},selectFrom(n){return new Bo({queryId:et(),executor:t,queryNode:We.create(Fo(n))})},case(n){return new $p({node:dr.create(va(n)?void 0:Hr(n))})},ref(n){return new Dt(Po(n))},val(n){return new Dt(Op(n))},cmpr(n,i,a){return new Dt(cf(n,i,a))},bxp(n,i,a){return new Dt(cf(n,i,a))},unary:e,not(n){return e("not",n)},exists(n){return e("exists",n)},neg(n){return e("-",n)},and(n){if(n.length===0)return new Dt(Ir.createImmediate(!0));if(n.length===1)return new Dt(n[0].toOperationNode());let i=Da.create(n[0].toOperationNode(),n[1].toOperationNode());for(let a=2;aFa(e)):[Fa(t)]}function Fa(t){return mr(t)?mb(t):Hp(t)}function mb(t){const e=" as ";if(t.includes(e)){const[n,i]=t.split(e).map(Vp);return Es.create(_n(n),mt.create(i))}else return _n(t)}function _n(t){const e=".";if(t.includes(e)){const[n,i]=t.split(e).map(Vp);return Ni.createWithSchema(n,i)}else return Ni.create(t)}function Vp(t){return t.trim()}const zp=p({is(t){return t.kind==="AddColumnNode"},create(t){return p({kind:"AddColumnNode",column:t})}}),Xi=p({is(t){return t.kind==="AlterColumnNode"},create(t){return p({kind:"AlterColumnNode",column:Nt.create(t)})},cloneWith(t,e){return p({...t,...e})}}),bt=p({is(t){return t.kind==="ColumnDefinitionNode"},create(t,e){return p({kind:"ColumnDefinitionNode",column:Nt.create(t),dataType:e})},cloneWithFrontModifier(t,e){return p({...t,frontModifiers:t.frontModifiers?p([...t.frontModifiers,e]):[e]})},cloneWithEndModifier(t,e){return p({...t,endModifiers:t.endModifiers?p([...t.endModifiers,e]):[e]})},cloneWith(t,e){return p({...t,...e})}}),Kp=p({is(t){return t.kind==="DropColumnNode"},create(t){return p({kind:"DropColumnNode",column:Nt.create(t)})}}),Jp=p({is(t){return t.kind==="RenameColumnNode"},create(t,e){return p({kind:"RenameColumnNode",column:Nt.create(t),renameTo:Nt.create(e)})}}),Jf=p({is(t){return t.kind==="CheckConstraintNode"},create(t,e){return p({kind:"CheckConstraintNode",expression:t,name:e?mt.create(e):void 0})}}),yb=["no action","restrict","cascade","set null","set default"],ec=p({is(t){return t.kind==="ReferencesNode"},create(t,e){return p({kind:"ReferencesNode",table:t,columns:p([...e])})},cloneWithOnDelete(t,e){return p({...t,onDelete:e})},cloneWithOnUpdate(t,e){return p({...t,onUpdate:e})}});function Gp(t){return hn(t)?t.toOperationNode():Ir.createImmediate(t)}const zu=p({is(t){return t.kind==="GeneratedNode"},create(t){return p({kind:"GeneratedNode",...t})},createWithExpression(t){return p({kind:"GeneratedNode",always:!0,expression:t})},cloneWith(t,e){return p({...t,...e})}}),wb=p({is(t){return t.kind==="DefaultValueNode"},create(t){return p({kind:"DefaultValueNode",defaultValue:t})}});function bc(t){if(yb.includes(t))return t;throw new Error(`invalid OnModifyForeignAction ${t}`)}var Ye;const St=class{constructor(e){S(this,Ye,void 0);P(this,Ye,e)}autoIncrement(){return new St(bt.cloneWith(r(this,Ye),{autoIncrement:!0}))}primaryKey(){return new St(bt.cloneWith(r(this,Ye),{primaryKey:!0}))}references(e){const n=Po(e);if(!yl.is(n)||Uf.is(n.column))throw new Error(`invalid call references('${e}'). The reference must have format table.column or schema.table.column`);return new St(bt.cloneWith(r(this,Ye),{references:ec.create(n.table,[n.column])}))}onDelete(e){if(!r(this,Ye).references)throw new Error("on delete constraint can only be added for foreign keys");return new St(bt.cloneWith(r(this,Ye),{references:ec.cloneWithOnDelete(r(this,Ye).references,bc(e))}))}onUpdate(e){if(!r(this,Ye).references)throw new Error("on update constraint can only be added for foreign keys");return new St(bt.cloneWith(r(this,Ye),{references:ec.cloneWithOnUpdate(r(this,Ye).references,bc(e))}))}unique(){return new St(bt.cloneWith(r(this,Ye),{unique:!0}))}notNull(){return new St(bt.cloneWith(r(this,Ye),{notNull:!0}))}unsigned(){return new St(bt.cloneWith(r(this,Ye),{unsigned:!0}))}defaultTo(e){return new St(bt.cloneWith(r(this,Ye),{defaultTo:wb.create(Gp(e))}))}check(e){return new St(bt.cloneWith(r(this,Ye),{check:Jf.create(e.toOperationNode())}))}generatedAlwaysAs(e){return new St(bt.cloneWith(r(this,Ye),{generated:zu.createWithExpression(e.toOperationNode())}))}generatedAlwaysAsIdentity(){return new St(bt.cloneWith(r(this,Ye),{generated:zu.create({identity:!0,always:!0})}))}generatedByDefaultAsIdentity(){return new St(bt.cloneWith(r(this,Ye),{generated:zu.create({identity:!0,byDefault:!0})}))}stored(){if(!r(this,Ye).generated)throw new Error("stored() can only be called after generatedAlwaysAs");return new St(bt.cloneWith(r(this,Ye),{generated:zu.cloneWith(r(this,Ye).generated,{stored:!0})}))}modifyFront(e){return new St(bt.cloneWithFrontModifier(r(this,Ye),e.toOperationNode()))}modifyEnd(e){return new St(bt.cloneWithEndModifier(r(this,Ye),e.toOperationNode()))}$call(e){return e(this)}toOperationNode(){return r(this,Ye)}};let Ei=St;Ye=new WeakMap;$e(Ei,"don't await ColumnDefinitionBuilder instances directly.");const Xp=p({is(t){return t.kind==="ModifyColumnNode"},create(t){return p({kind:"ModifyColumnNode",column:t})}}),gb=p({is(t){return t.kind==="DataTypeNode"},create(t){return p({kind:"DataTypeNode",dataType:t})}});function Uo(t){return hn(t)?t.toOperationNode():gb.create(t)}const Nc=p({is(t){return t.kind==="ForeignKeyConstraintNode"},create(t,e,n,i){return p({kind:"ForeignKeyConstraintNode",columns:t,references:ec.create(e,n),name:i?mt.create(i):void 0})},cloneWith(t,e){return p({...t,...e})}});var as;const Bc=class{constructor(e){S(this,as,void 0);P(this,as,e)}onDelete(e){return new Bc(Nc.cloneWith(r(this,as),{onDelete:bc(e)}))}onUpdate(e){return new Bc(Nc.cloneWith(r(this,as),{onUpdate:bc(e)}))}$call(e){return e(this)}toOperationNode(){return r(this,as)}};let Ua=Bc;as=new WeakMap;$e(Ua,"don't await ForeignKeyConstraintBuilder instances directly.");const lf=p({is(t){return t.kind==="AddConstraintNode"},create(t){return p({kind:"AddConstraintNode",constraint:t})}}),Yp=p({is(t){return t.kind==="UniqueConstraintNode"},create(t,e){return p({kind:"UniqueConstraintNode",columns:p(t.map(Nt.create)),name:e?mt.create(e):void 0})}}),tc=p({is(t){return t.kind==="DropConstraintNode"},create(t){return p({kind:"DropConstraintNode",constraintName:mt.create(t)})},cloneWith(t,e){return p({...t,...e})}});class El{constructor(e){Yt(this,"alterColumnNode");this.alterColumnNode=e}setDataType(e){return new ma(Xi.cloneWith(this.alterColumnNode,{dataType:Uo(e)}))}setDefault(e){return new ma(Xi.cloneWith(this.alterColumnNode,{setDefault:Gp(e)}))}dropDefault(){return new ma(Xi.cloneWith(this.alterColumnNode,{dropDefault:!0}))}setNotNull(){return new ma(Xi.cloneWith(this.alterColumnNode,{setNotNull:!0}))}dropNotNull(){return new ma(Xi.cloneWith(this.alterColumnNode,{dropNotNull:!0}))}$call(e){return e(this)}}class ma extends El{toOperationNode(){return this.alterColumnNode}}var ir;class ga{constructor(e){S(this,ir,void 0);P(this,ir,p(e))}toOperationNode(){return r(this,ir).executor.transformQuery(r(this,ir).node,r(this,ir).queryId)}compile(){return r(this,ir).executor.compileQuery(this.toOperationNode(),r(this,ir).queryId)}async execute(){await r(this,ir).executor.executeQuery(this.compile(),r(this,ir).queryId)}}ir=new WeakMap;$e(ga,"don't await AlterTableExecutor instances directly. To execute the query you need to call `execute`");var Zt;const Fc=class{constructor(e){S(this,Zt,void 0);P(this,Zt,p(e))}onDelete(e){return new Fc({...r(this,Zt),constraintBuilder:r(this,Zt).constraintBuilder.onDelete(e)})}onUpdate(e){return new Fc({...r(this,Zt),constraintBuilder:r(this,Zt).constraintBuilder.onUpdate(e)})}$call(e){return e(this)}toOperationNode(){return r(this,Zt).executor.transformQuery(Et.cloneWithTableProps(r(this,Zt).node,{addConstraint:lf.create(r(this,Zt).constraintBuilder.toOperationNode())}),r(this,Zt).queryId)}compile(){return r(this,Zt).executor.compileQuery(this.toOperationNode(),r(this,Zt).queryId)}async execute(){await r(this,Zt).executor.executeQuery(this.compile(),r(this,Zt).queryId)}};let vc=Fc;Zt=new WeakMap;$e(vc,"don't await AlterTableAddForeignKeyConstraintBuilder instances directly. To execute the query you need to call `execute`");var _t;const Ea=class{constructor(e){S(this,_t,void 0);P(this,_t,p(e))}ifExists(){return new Ea({...r(this,_t),node:Et.cloneWithTableProps(r(this,_t).node,{dropConstraint:tc.cloneWith(r(this,_t).node.dropConstraint,{ifExists:!0})})})}cascade(){return new Ea({...r(this,_t),node:Et.cloneWithTableProps(r(this,_t).node,{dropConstraint:tc.cloneWith(r(this,_t).node.dropConstraint,{modifier:"cascade"})})})}restrict(){return new Ea({...r(this,_t),node:Et.cloneWithTableProps(r(this,_t).node,{dropConstraint:tc.cloneWith(r(this,_t).node.dropConstraint,{modifier:"restrict"})})})}$call(e){return e(this)}toOperationNode(){return r(this,_t).executor.transformQuery(r(this,_t).node,r(this,_t).queryId)}compile(){return r(this,_t).executor.compileQuery(this.toOperationNode(),r(this,_t).queryId)}async execute(){await r(this,_t).executor.executeQuery(this.compile(),r(this,_t).queryId)}};let _c=Ea;_t=new WeakMap;$e(_c,"don't await AlterTableDropConstraintBuilder instances directly. To execute the query you need to call `execute`");var ot;class Zp{constructor(e){S(this,ot,void 0);P(this,ot,p(e))}renameTo(e){return new ga({...r(this,ot),node:Et.cloneWithTableProps(r(this,ot).node,{renameTo:_n(e)})})}setSchema(e){return new ga({...r(this,ot),node:Et.cloneWithTableProps(r(this,ot).node,{setSchema:mt.create(e)})})}alterColumn(e,n){const i=n(new El(Xi.create(e)));return new ui({...r(this,ot),node:Et.cloneWithColumnAlteration(r(this,ot).node,i.toOperationNode())})}dropColumn(e){return new ui({...r(this,ot),node:Et.cloneWithColumnAlteration(r(this,ot).node,Kp.create(e))})}renameColumn(e,n){return new ui({...r(this,ot),node:Et.cloneWithColumnAlteration(r(this,ot).node,Jp.create(e,n))})}addColumn(e,n,i=Lo){const a=i(new Ei(bt.create(e,Uo(n))));return new ui({...r(this,ot),node:Et.cloneWithColumnAlteration(r(this,ot).node,zp.create(a.toOperationNode()))})}modifyColumn(e,n,i=Lo){const a=i(new Ei(bt.create(e,Uo(n))));return new ui({...r(this,ot),node:Et.cloneWithColumnAlteration(r(this,ot).node,Xp.create(a.toOperationNode()))})}addUniqueConstraint(e,n){return new ga({...r(this,ot),node:Et.cloneWithTableProps(r(this,ot).node,{addConstraint:lf.create(Yp.create(n,e))})})}addCheckConstraint(e,n){return new ga({...r(this,ot),node:Et.cloneWithTableProps(r(this,ot).node,{addConstraint:lf.create(Jf.create(n.toOperationNode(),e))})})}addForeignKeyConstraint(e,n,i,a){return new vc({...r(this,ot),constraintBuilder:new Ua(Nc.create(n.map(Nt.create),_n(i),a.map(Nt.create),e))})}dropConstraint(e){return new _c({...r(this,ot),node:Et.cloneWithTableProps(r(this,ot).node,{dropConstraint:tc.create(e)})})}$call(e){return e(this)}call(e){return this.$call(e)}}ot=new WeakMap;var gt;const ts=class{constructor(e){S(this,gt,void 0);P(this,gt,p(e))}alterColumn(e,n){const i=n(new El(Xi.create(e)));return new ts({...r(this,gt),node:Et.cloneWithColumnAlteration(r(this,gt).node,i.toOperationNode())})}dropColumn(e){return new ts({...r(this,gt),node:Et.cloneWithColumnAlteration(r(this,gt).node,Kp.create(e))})}renameColumn(e,n){return new ts({...r(this,gt),node:Et.cloneWithColumnAlteration(r(this,gt).node,Jp.create(e,n))})}addColumn(e,n,i=Lo){const a=i(new Ei(bt.create(e,Uo(n))));return new ts({...r(this,gt),node:Et.cloneWithColumnAlteration(r(this,gt).node,zp.create(a.toOperationNode()))})}modifyColumn(e,n,i=Lo){const a=i(new Ei(bt.create(e,Uo(n))));return new ts({...r(this,gt),node:Et.cloneWithColumnAlteration(r(this,gt).node,Xp.create(a.toOperationNode()))})}toOperationNode(){return r(this,gt).executor.transformQuery(r(this,gt).node,r(this,gt).queryId)}compile(){return r(this,gt).executor.compileQuery(this.toOperationNode(),r(this,gt).queryId)}async execute(){await r(this,gt).executor.executeQuery(this.compile(),r(this,gt).queryId)}};let ui=ts;gt=new WeakMap;$e(Zp,"don't await AlterTableBuilder instances");$e(El,"don't await AlterColumnBuilder instances");$e(ui,"don't await AlterTableColumnAlteringBuilder instances directly. To execute the query you need to call `execute`");class em extends Vf{transformValue(e){return{...super.transformValue(e),immediate:!0}}}var Ze;const Nr=class{constructor(e){S(this,Ze,void 0);P(this,Ze,p(e))}ifNotExists(){return new Nr({...r(this,Ze),node:ri.cloneWith(r(this,Ze).node,{ifNotExists:!0})})}unique(){return new Nr({...r(this,Ze),node:ri.cloneWith(r(this,Ze).node,{unique:!0})})}on(e){return new Nr({...r(this,Ze),node:ri.cloneWith(r(this,Ze).node,{table:_n(e)})})}column(e){return new Nr({...r(this,Ze),node:ri.cloneWithColumns(r(this,Ze).node,[Ah(e)])})}columns(e){return new Nr({...r(this,Ze),node:ri.cloneWithColumns(r(this,Ze).node,e.map(Ah))})}expression(e){return new Nr({...r(this,Ze),node:ri.cloneWithColumns(r(this,Ze).node,[e.toOperationNode()])})}using(e){return new Nr({...r(this,Ze),node:ri.cloneWith(r(this,Ze).node,{using:en.createWithSql(e)})})}where(...e){const n=new em;return new Nr({...r(this,Ze),node:ye.cloneWithWhere(r(this,Ze).node,n.transformNode(Rn(e)))})}$call(e){return e(this)}toOperationNode(){return r(this,Ze).executor.transformQuery(r(this,Ze).node,r(this,Ze).queryId)}compile(){return r(this,Ze).executor.compileQuery(this.toOperationNode(),r(this,Ze).queryId)}async execute(){await r(this,Ze).executor.executeQuery(this.compile(),r(this,Ze).queryId)}};let xc=Nr;Ze=new WeakMap;$e(xc,"don't await CreateIndexBuilder instances directly. To execute the query you need to call `execute`");var Wn;const Zf=class{constructor(e){S(this,Wn,void 0);P(this,Wn,p(e))}ifNotExists(){return new Zf({...r(this,Wn),node:gp.cloneWith(r(this,Wn).node,{ifNotExists:!0})})}$call(e){return e(this)}toOperationNode(){return r(this,Wn).executor.transformQuery(r(this,Wn).node,r(this,Wn).queryId)}compile(){return r(this,Wn).executor.compileQuery(this.toOperationNode(),r(this,Wn).queryId)}async execute(){await r(this,Wn).executor.executeQuery(this.compile(),r(this,Wn).queryId)}};let Ec=Zf;Wn=new WeakMap;$e(Ec,"don't await CreateSchemaBuilder instances directly. To execute the query you need to call `execute`");const bb=p({is(t){return t.kind==="PrimaryKeyConstraintNode"},create(t,e){return p({kind:"PrimaryKeyConstraintNode",columns:p(t.map(Nt.create)),name:e?mt.create(e):void 0})}});function Nb(t){if(hg.includes(t))return t;throw new Error(`invalid OnCommitAction ${t}`)}var Ue;const Qn=class{constructor(e){S(this,Ue,void 0);P(this,Ue,p(e))}temporary(){return new Qn({...r(this,Ue),node:Zn.cloneWith(r(this,Ue).node,{temporary:!0})})}onCommit(e){return new Qn({...r(this,Ue),node:Zn.cloneWith(r(this,Ue).node,{onCommit:Nb(e)})})}ifNotExists(){return new Qn({...r(this,Ue),node:Zn.cloneWith(r(this,Ue).node,{ifNotExists:!0})})}addColumn(e,n,i=Lo){const a=i(new Ei(bt.create(e,Uo(n))));return new Qn({...r(this,Ue),node:Zn.cloneWithColumn(r(this,Ue).node,a.toOperationNode())})}addPrimaryKeyConstraint(e,n){return new Qn({...r(this,Ue),node:Zn.cloneWithConstraint(r(this,Ue).node,bb.create(n,e))})}addUniqueConstraint(e,n){return new Qn({...r(this,Ue),node:Zn.cloneWithConstraint(r(this,Ue).node,Yp.create(n,e))})}addCheckConstraint(e,n){return new Qn({...r(this,Ue),node:Zn.cloneWithConstraint(r(this,Ue).node,Jf.create(n.toOperationNode(),e))})}addForeignKeyConstraint(e,n,i,a,l=Lo){const m=l(new Ua(Nc.create(n.map(Nt.create),_n(i),a.map(Nt.create),e)));return new Qn({...r(this,Ue),node:Zn.cloneWithConstraint(r(this,Ue).node,m.toOperationNode())})}modifyFront(e){return new Qn({...r(this,Ue),node:Zn.cloneWithFrontModifier(r(this,Ue).node,e.toOperationNode())})}modifyEnd(e){return new Qn({...r(this,Ue),node:Zn.cloneWithEndModifier(r(this,Ue).node,e.toOperationNode())})}$call(e){return e(this)}call(e){return this.$call(e)}toOperationNode(){return r(this,Ue).executor.transformQuery(r(this,Ue).node,r(this,Ue).queryId)}compile(){return r(this,Ue).executor.compileQuery(this.toOperationNode(),r(this,Ue).queryId)}async execute(){await r(this,Ue).executor.executeQuery(this.compile(),r(this,Ue).queryId)}};let Cc=Qn;Ue=new WeakMap;$e(Cc,"don't await CreateTableBuilder instances directly. To execute the query you need to call `execute`");var Ut;const Ca=class{constructor(e){S(this,Ut,void 0);P(this,Ut,p(e))}on(e){return new Ca({...r(this,Ut),node:Zu.cloneWith(r(this,Ut).node,{table:_n(e)})})}ifExists(){return new Ca({...r(this,Ut),node:Zu.cloneWith(r(this,Ut).node,{ifExists:!0})})}cascade(){return new Ca({...r(this,Ut),node:Zu.cloneWith(r(this,Ut).node,{cascade:!0})})}$call(e){return e(this)}toOperationNode(){return r(this,Ut).executor.transformQuery(r(this,Ut).node,r(this,Ut).queryId)}compile(){return r(this,Ut).executor.compileQuery(this.toOperationNode(),r(this,Ut).queryId)}async execute(){await r(this,Ut).executor.executeQuery(this.compile(),r(this,Ut).queryId)}};let Oc=Ca;Ut=new WeakMap;$e(Oc,"don't await DropIndexBuilder instances directly. To execute the query you need to call `execute`");var ln;const Uc=class{constructor(e){S(this,ln,void 0);P(this,ln,p(e))}ifExists(){return new Uc({...r(this,ln),node:rf.cloneWith(r(this,ln).node,{ifExists:!0})})}cascade(){return new Uc({...r(this,ln),node:rf.cloneWith(r(this,ln).node,{cascade:!0})})}$call(e){return e(this)}toOperationNode(){return r(this,ln).executor.transformQuery(r(this,ln).node,r(this,ln).queryId)}compile(){return r(this,ln).executor.compileQuery(this.toOperationNode(),r(this,ln).queryId)}async execute(){await r(this,ln).executor.executeQuery(this.compile(),r(this,ln).queryId)}};let qc=Uc;ln=new WeakMap;$e(qc,"don't await DropSchemaBuilder instances directly. To execute the query you need to call `execute`");var fn;const $c=class{constructor(e){S(this,fn,void 0);P(this,fn,p(e))}ifExists(){return new $c({...r(this,fn),node:sf.cloneWith(r(this,fn).node,{ifExists:!0})})}cascade(){return new $c({...r(this,fn),node:sf.cloneWith(r(this,fn).node,{cascade:!0})})}$call(e){return e(this)}toOperationNode(){return r(this,fn).executor.transformQuery(r(this,fn).node,r(this,fn).queryId)}compile(){return r(this,fn).executor.compileQuery(this.toOperationNode(),r(this,fn).queryId)}async execute(){await r(this,fn).executor.executeQuery(this.compile(),r(this,fn).queryId)}};let Wc=$c;fn=new WeakMap;$e(Wc,"don't await DropTableBuilder instances directly. To execute the query you need to call `execute`");const oi=p({is(t){return t.kind==="CreateViewNode"},create(t){return p({kind:"CreateViewNode",name:xi.create(t)})},cloneWith(t,e){return p({...t,...e})}});var Qc;class vb{constructor(){S(this,Qc,new em)}transformQuery(e){return r(this,Qc).transformNode(e.node)}transformResult(e){return Promise.resolve(e.result)}}Qc=new WeakMap;var dt;const ai=class{constructor(e){S(this,dt,void 0);P(this,dt,p(e))}temporary(){return new ai({...r(this,dt),node:oi.cloneWith(r(this,dt).node,{temporary:!0})})}materialized(){return new ai({...r(this,dt),node:oi.cloneWith(r(this,dt).node,{materialized:!0})})}ifNotExists(){return new ai({...r(this,dt),node:oi.cloneWith(r(this,dt).node,{ifNotExists:!0})})}orReplace(){return new ai({...r(this,dt),node:oi.cloneWith(r(this,dt).node,{orReplace:!0})})}columns(e){return new ai({...r(this,dt),node:oi.cloneWith(r(this,dt).node,{columns:e.map(Ep)})})}as(e){const n=e.withPlugin(new vb).toOperationNode();return new ai({...r(this,dt),node:oi.cloneWith(r(this,dt).node,{as:n})})}$call(e){return e(this)}toOperationNode(){return r(this,dt).executor.transformQuery(r(this,dt).node,r(this,dt).queryId)}compile(){return r(this,dt).executor.compileQuery(this.toOperationNode(),r(this,dt).queryId)}async execute(){await r(this,dt).executor.executeQuery(this.compile(),r(this,dt).queryId)}};let Ic=ai;dt=new WeakMap;$e(Ic,"don't await CreateViewBuilder instances directly. To execute the query you need to call `execute`");const nc=p({is(t){return t.kind==="DropViewNode"},create(t){return p({kind:"DropViewNode",name:xi.create(t)})},cloneWith(t,e){return p({...t,...e})}});var $t;const Oa=class{constructor(e){S(this,$t,void 0);P(this,$t,p(e))}materialized(){return new Oa({...r(this,$t),node:nc.cloneWith(r(this,$t).node,{materialized:!0})})}ifExists(){return new Oa({...r(this,$t),node:nc.cloneWith(r(this,$t).node,{ifExists:!0})})}cascade(){return new Oa({...r(this,$t),node:nc.cloneWith(r(this,$t).node,{cascade:!0})})}$call(e){return e(this)}toOperationNode(){return r(this,$t).executor.transformQuery(r(this,$t).node,r(this,$t).queryId)}compile(){return r(this,$t).executor.compileQuery(this.toOperationNode(),r(this,$t).queryId)}async execute(){await r(this,$t).executor.executeQuery(this.compile(),r(this,$t).queryId)}};let Ac=Oa;$t=new WeakMap;$e(Ac,"don't await DropViewBuilder instances directly. To execute the query you need to call `execute`");const tm=p({is(t){return t.kind==="CreateTypeNode"},create(t){return p({kind:"CreateTypeNode",name:t})},cloneWithEnum(t,e){return p({...t,enum:Qf.create(e.map(n=>Ir.createImmediate(n)))})}});var In;const eh=class{constructor(e){S(this,In,void 0);P(this,In,p(e))}toOperationNode(){return r(this,In).executor.transformQuery(r(this,In).node,r(this,In).queryId)}asEnum(e){return new eh({...r(this,In),node:tm.cloneWithEnum(r(this,In).node,e)})}$call(e){return e(this)}compile(){return r(this,In).executor.compileQuery(this.toOperationNode(),r(this,In).queryId)}async execute(){await r(this,In).executor.executeQuery(this.compile(),r(this,In).queryId)}};let Tc=eh;In=new WeakMap;$e(Tc,"don't await CreateTypeBuilder instances directly. To execute the query you need to call `execute`");const nm=p({is(t){return t.kind==="DropTypeNode"},create(t){return p({kind:"DropTypeNode",name:t})},cloneWith(t,e){return p({...t,...e})}});var An;const th=class{constructor(e){S(this,An,void 0);P(this,An,p(e))}ifExists(){return new th({...r(this,An),node:nm.cloneWith(r(this,An).node,{ifExists:!0})})}$call(e){return e(this)}toOperationNode(){return r(this,An).executor.transformQuery(r(this,An).node,r(this,An).queryId)}compile(){return r(this,An).executor.compileQuery(this.toOperationNode(),r(this,An).queryId)}async execute(){await r(this,An).executor.executeQuery(this.compile(),r(this,An).queryId)}};let Sc=th;An=new WeakMap;$e(Sc,"don't await DropTypeBuilder instances directly. To execute the query you need to call `execute`");function Hh(t){const e=".";if(t.includes(e)){const n=t.split(e).map(_b);if(n.length===2)return xi.createWithSchema(n[0],n[1]);throw new Error(`invalid schemable identifier ${t}`)}else return xi.create(t)}function _b(t){return t.trim()}var kt;const qa=class{constructor(e){S(this,kt,void 0);P(this,kt,e)}createTable(e){return new Cc({queryId:et(),executor:r(this,kt),node:Zn.create(_n(e))})}dropTable(e){return new Wc({queryId:et(),executor:r(this,kt),node:sf.create(_n(e))})}createIndex(e){return new xc({queryId:et(),executor:r(this,kt),node:ri.create(e)})}dropIndex(e){return new Oc({queryId:et(),executor:r(this,kt),node:Zu.create(e)})}createSchema(e){return new Ec({queryId:et(),executor:r(this,kt),node:gp.create(e)})}dropSchema(e){return new qc({queryId:et(),executor:r(this,kt),node:rf.create(e)})}alterTable(e){return new Zp({queryId:et(),executor:r(this,kt),node:Et.create(_n(e))})}createView(e){return new Ic({queryId:et(),executor:r(this,kt),node:oi.create(e)})}dropView(e){return new Ac({queryId:et(),executor:r(this,kt),node:nc.create(e)})}createType(e){return new Tc({queryId:et(),executor:r(this,kt),node:tm.create(Hh(e))})}dropType(e){return new Sc({queryId:et(),executor:r(this,kt),node:nm.create(Hh(e))})}withPlugin(e){return new qa(r(this,kt).withPlugin(e))}withoutPlugins(){return new qa(r(this,kt).withoutPlugins())}withSchema(e){return new qa(r(this,kt).withPluginAtFront(new Nu(e)))}};let ff=qa;kt=new WeakMap;class xb{ref(e){return new Ig(e)}}var bo;class Eb{constructor(e){S(this,bo,void 0);P(this,bo,e)}async provideConnection(e){const n=await r(this,bo).acquireConnection();try{return await e(n)}finally{await r(this,bo).releaseConnection(n)}}}bo=new WeakMap;var xr,Er,Dr;const ns=class extends Lp{constructor(n,i,a,l=[]){super(l);S(this,xr,void 0);S(this,Er,void 0);S(this,Dr,void 0);P(this,xr,n),P(this,Er,i),P(this,Dr,a)}get adapter(){return r(this,Er)}compileQuery(n){return r(this,xr).compileQuery(n)}provideConnection(n){return r(this,Dr).provideConnection(n)}withPlugins(n){return new ns(r(this,xr),r(this,Er),r(this,Dr),[...this.plugins,...n])}withPlugin(n){return new ns(r(this,xr),r(this,Er),r(this,Dr),[...this.plugins,n])}withPluginAtFront(n){return new ns(r(this,xr),r(this,Er),r(this,Dr),[n,...this.plugins])}withConnectionProvider(n){return new ns(r(this,xr),r(this,Er),n,[...this.plugins])}withoutPlugins(){return new ns(r(this,xr),r(this,Er),r(this,Dr),[])}};let hf=ns;xr=new WeakMap,Er=new WeakMap,Dr=new WeakMap;function Vh(){return typeof performance<"u"&&Vn(performance.now)?performance.now():Date.now()}var sr,li,Lr,us,Ya,jc,rm,Hc,im,Vc,sm,zc,om,Za,df;class Cb{constructor(e,n){S(this,jc);S(this,Hc);S(this,Vc);S(this,zc);S(this,Za);S(this,sr,void 0);S(this,li,void 0);S(this,Lr,void 0);S(this,us,void 0);S(this,Ya,new WeakSet);P(this,sr,e),P(this,li,n)}async init(){r(this,Lr)||P(this,Lr,r(this,sr).init().catch(e=>(P(this,Lr,void 0),Promise.reject(e)))),await r(this,Lr)}async acquireConnection(){await this.init();const e=await r(this,sr).acquireConnection();return r(this,Ya).has(e)||(qe(this,jc,rm).call(this)&&qe(this,Hc,im).call(this,e),r(this,Ya).add(e)),e}async releaseConnection(e){await r(this,sr).releaseConnection(e)}beginTransaction(e,n){return r(this,sr).beginTransaction(e,n)}commitTransaction(e){return r(this,sr).commitTransaction(e)}rollbackTransaction(e){return r(this,sr).rollbackTransaction(e)}async destroy(){r(this,Lr)&&(await r(this,Lr),r(this,us)||P(this,us,r(this,sr).destroy().catch(e=>(P(this,us,void 0),Promise.reject(e)))),await r(this,us))}}sr=new WeakMap,li=new WeakMap,Lr=new WeakMap,us=new WeakMap,Ya=new WeakMap,jc=new WeakSet,rm=function(){return r(this,li).isLevelEnabled("query")||r(this,li).isLevelEnabled("error")},Hc=new WeakSet,im=function(e){const n=e.executeQuery;e.executeQuery=async i=>{const a=Vh();try{return await n.call(e,i)}catch(l){throw await qe(this,Vc,sm).call(this,l,i,a),l}finally{await qe(this,zc,om).call(this,i,a)}}},Vc=new WeakSet,sm=async function(e,n,i){await r(this,li).error(()=>({level:"error",error:e,query:n,queryDurationMillis:qe(this,Za,df).call(this,i)}))},zc=new WeakSet,om=async function(e,n){await r(this,li).query(()=>({level:"query",query:e,queryDurationMillis:qe(this,Za,df).call(this,n)}))},Za=new WeakSet,df=function(e){return Vh()-e};var eu,fi,Kc,um;class am{constructor(e){S(this,Kc);S(this,eu,void 0);S(this,fi,void 0);P(this,eu,e)}async provideConnection(e){for(;r(this,fi);)await r(this,fi);const n=qe(this,Kc,um).call(this,e);return P(this,fi,n.then(()=>{P(this,fi,void 0)}).catch(()=>{P(this,fi,void 0)})),n}}eu=new WeakMap,fi=new WeakMap,Kc=new WeakSet,um=async function(e){return await e(r(this,eu))};const Ob=["read uncommitted","read committed","repeatable read","serializable"];p(["query","error"]);var hi,cs;class qb{constructor(e){S(this,hi,void 0);S(this,cs,void 0);Vn(e)?(P(this,cs,e),P(this,hi,p({query:!0,error:!0}))):(P(this,cs,Wb),P(this,hi,p({query:e.includes("query"),error:e.includes("error")})))}isLevelEnabled(e){return r(this,hi)[e]}async query(e){r(this,hi).query&&await r(this,cs).call(this,e())}async error(e){r(this,hi).error&&await r(this,cs).call(this,e())}}hi=new WeakMap,cs=new WeakMap;function Wb(t){t.level==="query"?(console.log(`kysely:query: ${t.query.sql}`),console.log(`kysely:query: duration: ${t.queryDurationMillis.toFixed(1)}ms`)):t.level==="error"&&(t.error instanceof Error?console.error(`kysely:error: ${t.error.stack??t.error.message}`):console.error(`kysely:error: ${t}`))}function Ib(t){return Wr(t)&&Vn(t.compile)}var Qt;const Xs=class extends gc{constructor(n){let i,a;if(Ab(n))i={executor:n.executor},a={...n};else{const l=n.dialect,m=l.createDriver(),w=l.createQueryCompiler(),v=l.createAdapter(),d=new qb(n.log??[]),W=new Cb(m,d),B=new Eb(W),D=new hf(w,v,B,n.plugins??[]);i={executor:D},a={config:n,executor:D,dialect:l,driver:W}}super(i);S(this,Qt,void 0);P(this,Qt,p(a))}get schema(){return new ff(r(this,Qt).executor)}get dynamic(){return new xb}get introspection(){return r(this,Qt).dialect.createIntrospector(this.withoutPlugins())}case(n){return new $p({node:dr.create(va(n)?void 0:_l(n))})}get fn(){return Up()}transaction(){return new kc({...r(this,Qt)})}connection(){return new cm({...r(this,Qt)})}withPlugin(n){return new Xs({...r(this,Qt),executor:r(this,Qt).executor.withPlugin(n)})}withoutPlugins(){return new Xs({...r(this,Qt),executor:r(this,Qt).executor.withoutPlugins()})}withSchema(n){return new Xs({...r(this,Qt),executor:r(this,Qt).executor.withPluginAtFront(new Nu(n))})}withTables(){return new Xs({...r(this,Qt)})}async destroy(){await r(this,Qt).driver.destroy()}get isTransaction(){return!1}getExecutor(){return r(this,Qt).executor}executeQuery(n,i=et()){const a=Ib(n)?n.compile():n;return this.getExecutor().executeQuery(a,i)}};let $a=Xs;Qt=new WeakMap;var or;const Ys=class extends $a{constructor(n){super(n);S(this,or,void 0);P(this,or,n)}get isTransaction(){return!0}transaction(){throw new Error("calling the transaction method for a Transaction is not supported")}connection(){throw new Error("calling the connection method for a Transaction is not supported")}async destroy(){throw new Error("calling the destroy method for a Transaction is not supported")}withPlugin(n){return new Ys({...r(this,or),executor:r(this,or).executor.withPlugin(n)})}withoutPlugins(){return new Ys({...r(this,or),executor:r(this,or).executor.withoutPlugins()})}withSchema(n){return new Ys({...r(this,or),executor:r(this,or).executor.withPluginAtFront(new Nu(n))})}withTables(){return new Ys({...r(this,or)})}};let pf=Ys;or=new WeakMap;function Ab(t){return Wr(t)&&Wr(t.config)&&Wr(t.driver)&&Wr(t.executor)&&Wr(t.dialect)}var ls;class cm{constructor(e){S(this,ls,void 0);P(this,ls,p(e))}async execute(e){return r(this,ls).executor.provideConnection(async n=>{const i=r(this,ls).executor.withConnectionProvider(new am(n)),a=new $a({...r(this,ls),executor:i});return await e(a)})}}ls=new WeakMap;$e(cm,"don't await ConnectionBuilder instances directly. To execute the query you need to call the `execute` method");var ar;const nh=class{constructor(e){S(this,ar,void 0);P(this,ar,p(e))}setIsolationLevel(e){return new nh({...r(this,ar),isolationLevel:e})}async execute(e){const{isolationLevel:n,...i}=r(this,ar),a={isolationLevel:n};return Tb(a),r(this,ar).executor.provideConnection(async l=>{const m=r(this,ar).executor.withConnectionProvider(new am(l)),w=new pf({...i,executor:m});try{await r(this,ar).driver.beginTransaction(l,a);const v=await e(w);return await r(this,ar).driver.commitTransaction(l),v}catch(v){throw await r(this,ar).driver.rollbackTransaction(l),v}})}};let kc=nh;ar=new WeakMap;$e(kc,"don't await TransactionBuilder instances directly. To execute the transaction you need to call the `execute` method");function Tb(t){if(t.isolationLevel&&!Ob.includes(t.isolationLevel))throw new Error(`invalid transaction isolation level ${t.isolationLevel}`)}var Nn,No,rc,tu,mf,nu,yf;const Jc=class{constructor(e){S(this,No);S(this,tu);S(this,nu);S(this,Nn,void 0);P(this,Nn,p(e))}get expressionType(){}as(e){return new Sb(this,e)}$castTo(){return new Jc({...r(this,Nn)})}castTo(){return this.$castTo()}withPlugin(e){return new Jc({...r(this,Nn),plugins:r(this,Nn).plugins!==void 0?p([...r(this,Nn).plugins,e]):p([e])})}toOperationNode(){return qe(this,tu,mf).call(this,qe(this,No,rc).call(this))}compile(e){return qe(this,nu,yf).call(this,qe(this,No,rc).call(this,e))}async execute(e){const n=qe(this,No,rc).call(this,e);return n.executeQuery(qe(this,nu,yf).call(this,n),r(this,Nn).queryId)}};let rr=Jc;Nn=new WeakMap,No=new WeakSet,rc=function(e){const n=e!==void 0?e.getExecutor():Nl;return r(this,Nn).plugins!==void 0?n.withPlugins(r(this,Nn).plugins):n},tu=new WeakSet,mf=function(e){return e.transformQuery(r(this,Nn).rawNode,r(this,Nn).queryId)},nu=new WeakSet,yf=function(e){return e.compileQuery(qe(this,tu,mf).call(this,e),r(this,Nn).queryId)};$e(rr,"don't await RawBuilder instances directly. To execute the query you need to call `execute`");var vo,di;class Sb{constructor(e,n){S(this,vo,void 0);S(this,di,void 0);P(this,vo,e),P(this,di,n)}get expression(){return r(this,vo)}get alias(){return r(this,di)}toOperationNode(){return Es.create(r(this,vo).toOperationNode(),hn(r(this,di))?r(this,di).toOperationNode():mt.create(r(this,di)))}}vo=new WeakMap,di=new WeakMap;const kn=Object.assign((t,...e)=>new rr({queryId:et(),rawNode:en.create(t,(e==null?void 0:e.map(Ur))??[])}),{ref(t){return new rr({queryId:et(),rawNode:en.createWithChild(Po(t))})},val(t){return new rr({queryId:et(),rawNode:en.createWithChild(Ur(t))})},value(t){return this.val(t)},table(t){return new rr({queryId:et(),rawNode:en.createWithChild(_n(t))})},id(...t){const e=new Array(t.length+1).fill(".");return e[0]="",e[e.length-1]="",new rr({queryId:et(),rawNode:en.create(e,t.map(mt.create))})},lit(t){return new rr({queryId:et(),rawNode:en.createWithChild(Ir.createImmediate(t))})},literal(t){return this.lit(t)},raw(t){return new rr({queryId:et(),rawNode:en.createWithSql(t)})},join(t,e=kn`, `){const n=new Array(2*t.length-1),i=e.toOperationNode();for(let a=0;a{this.nodeStack.push(e),r(this,Gc)[e.kind](e),this.nodeStack.pop()})}get parentNode(){return this.nodeStack[this.nodeStack.length-2]}}Gc=new WeakMap;var _o,fs;class Rb extends kb{constructor(){super(...arguments);S(this,_o,"");S(this,fs,[])}get numParameters(){return r(this,fs).length}compileQuery(n){return P(this,_o,""),P(this,fs,[]),this.visitNode(n),p({query:n,sql:this.getSql(),parameters:[...r(this,fs)]})}getSql(){return r(this,_o)}visitSelectQuery(n){const i=this.parentNode!==void 0&&!Or.is(this.parentNode)&&!oi.is(this.parentNode)&&!Fp.is(this.parentNode);this.parentNode===void 0&&n.explain&&(this.visitNode(n.explain),this.append(" ")),i&&this.append("("),n.with&&(this.visitNode(n.with),this.append(" ")),this.append("select "),n.distinctOn&&(this.compileDistinctOn(n.distinctOn),this.append(" ")),n.frontModifiers&&n.frontModifiers.length>0&&(this.compileList(n.frontModifiers," "),this.append(" ")),n.selections&&(this.compileList(n.selections),this.append(" ")),this.visitNode(n.from),n.joins&&(this.append(" "),this.compileList(n.joins," ")),n.where&&(this.append(" "),this.visitNode(n.where)),n.groupBy&&(this.append(" "),this.visitNode(n.groupBy)),n.having&&(this.append(" "),this.visitNode(n.having)),n.setOperations&&(this.append(" "),this.compileList(n.setOperations," ")),n.orderBy&&(this.append(" "),this.visitNode(n.orderBy)),n.limit&&(this.append(" "),this.visitNode(n.limit)),n.offset&&(this.append(" "),this.visitNode(n.offset)),n.endModifiers&&n.endModifiers.length>0&&(this.append(" "),this.compileList(n.endModifiers," ")),i&&this.append(")")}visitFrom(n){this.append("from "),this.compileList(n.froms)}visitSelection(n){this.visitNode(n.selection)}visitColumn(n){this.visitNode(n.column)}compileDistinctOn(n){this.append("distinct on ("),this.compileList(n),this.append(")")}compileList(n,i=", "){const a=n.length-1;for(let l=0;l<=a;l++)this.visitNode(n[l]),ll&&this.visitNode(a[l])}visitOperator(n){this.append(n.operator)}visitTable(n){this.visitNode(n.table)}visitSchemableIdentifier(n){n.schema&&(this.visitNode(n.schema),this.append(".")),this.visitNode(n.identifier)}visitCreateTable(n){this.append("create "),n.frontModifiers&&n.frontModifiers.length>0&&(this.compileList(n.frontModifiers," "),this.append(" ")),n.temporary&&this.append("temporary "),this.append("table "),n.ifNotExists&&this.append("if not exists "),this.visitNode(n.table),this.append(" ("),this.compileList([...n.columns,...n.constraints??[]]),this.append(")"),n.onCommit&&(this.append(" on commit "),this.append(n.onCommit)),n.endModifiers&&n.endModifiers.length>0&&(this.append(" "),this.compileList(n.endModifiers," "))}visitColumnDefinition(n){this.visitNode(n.column),this.append(" "),this.visitNode(n.dataType),n.unsigned&&this.append(" unsigned"),n.frontModifiers&&n.frontModifiers.length>0&&(this.append(" "),this.compileList(n.frontModifiers," ")),n.generated&&(this.append(" "),this.visitNode(n.generated)),n.defaultTo&&(this.append(" "),this.visitNode(n.defaultTo)),n.notNull&&this.append(" not null"),n.unique&&this.append(" unique"),n.primaryKey&&this.append(" primary key"),n.autoIncrement&&(this.append(" "),this.append(this.getAutoIncrement())),n.references&&(this.append(" "),this.visitNode(n.references)),n.check&&(this.append(" "),this.visitNode(n.check)),n.endModifiers&&n.endModifiers.length>0&&(this.append(" "),this.compileList(n.endModifiers," "))}getAutoIncrement(){return"auto_increment"}visitReferences(n){this.append("references "),this.visitNode(n.table),this.append(" ("),this.compileList(n.columns),this.append(")"),n.onDelete&&(this.append(" on delete "),this.append(n.onDelete)),n.onUpdate&&(this.append(" on update "),this.append(n.onUpdate))}visitDropTable(n){this.append("drop table "),n.ifExists&&this.append("if exists "),this.visitNode(n.table),n.cascade&&this.append(" cascade")}visitDataType(n){this.append(n.dataType)}visitOrderBy(n){this.append("order by "),this.compileList(n.items)}visitOrderByItem(n){this.visitNode(n.orderBy),n.direction&&(this.append(" "),this.visitNode(n.direction))}visitGroupBy(n){this.append("group by "),this.compileList(n.items)}visitGroupByItem(n){this.visitNode(n.groupBy)}visitUpdateQuery(n){const i=this.nodeStack.find(ye.is)!==n;!i&&n.explain&&(this.visitNode(n.explain),this.append(" ")),i&&this.append("("),n.with&&(this.visitNode(n.with),this.append(" ")),this.append("update "),this.visitNode(n.table),this.append(" set "),n.updates&&this.compileList(n.updates),n.from&&(this.append(" "),this.visitNode(n.from)),n.joins&&(this.append(" "),this.compileList(n.joins," ")),n.where&&(this.append(" "),this.visitNode(n.where)),n.returning&&(this.append(" "),this.visitNode(n.returning)),i&&this.append(")")}visitColumnUpdate(n){this.visitNode(n.column),this.append(" = "),this.visitNode(n.value)}visitLimit(n){this.append("limit "),this.visitNode(n.limit)}visitOffset(n){this.append("offset "),this.visitNode(n.offset)}visitOnConflict(n){this.append("on conflict"),n.columns?(this.append(" ("),this.compileList(n.columns),this.append(")")):n.constraint?(this.append(" on constraint "),this.visitNode(n.constraint)):n.indexExpression&&(this.append(" ("),this.visitNode(n.indexExpression),this.append(")")),n.indexWhere&&(this.append(" "),this.visitNode(n.indexWhere)),n.doNothing===!0?this.append(" do nothing"):n.updates&&(this.append(" do update set "),this.compileList(n.updates),n.updateWhere&&(this.append(" "),this.visitNode(n.updateWhere)))}visitOnDuplicateKey(n){this.append("on duplicate key update "),this.compileList(n.updates)}visitCreateIndex(n){this.append("create "),n.unique&&this.append("unique "),this.append("index "),n.ifNotExists&&this.append("if not exists "),this.visitNode(n.name),n.table&&(this.append(" on "),this.visitNode(n.table)),n.using&&(this.append(" using "),this.visitNode(n.using)),n.columns&&(this.append(" ("),this.compileList(n.columns),this.append(")")),n.where&&(this.append(" "),this.visitNode(n.where))}visitDropIndex(n){this.append("drop index "),n.ifExists&&this.append("if exists "),this.visitNode(n.name),n.table&&(this.append(" on "),this.visitNode(n.table)),n.cascade&&this.append(" cascade")}visitCreateSchema(n){this.append("create schema "),n.ifNotExists&&this.append("if not exists "),this.visitNode(n.schema)}visitDropSchema(n){this.append("drop schema "),n.ifExists&&this.append("if exists "),this.visitNode(n.schema),n.cascade&&this.append(" cascade")}visitPrimaryKeyConstraint(n){n.name&&(this.append("constraint "),this.visitNode(n.name),this.append(" ")),this.append("primary key ("),this.compileList(n.columns),this.append(")")}visitUniqueConstraint(n){n.name&&(this.append("constraint "),this.visitNode(n.name),this.append(" ")),this.append("unique ("),this.compileList(n.columns),this.append(")")}visitCheckConstraint(n){n.name&&(this.append("constraint "),this.visitNode(n.name),this.append(" ")),this.append("check ("),this.visitNode(n.expression),this.append(")")}visitForeignKeyConstraint(n){n.name&&(this.append("constraint "),this.visitNode(n.name),this.append(" ")),this.append("foreign key ("),this.compileList(n.columns),this.append(") "),this.visitNode(n.references),n.onDelete&&(this.append(" on delete "),this.append(n.onDelete)),n.onUpdate&&(this.append(" on update "),this.append(n.onUpdate))}visitList(n){this.compileList(n.items)}visitWith(n){this.append("with "),n.recursive&&this.append("recursive "),this.compileList(n.expressions)}visitCommonTableExpression(n){this.visitNode(n.name),this.append(" as "),this.visitNode(n.expression)}visitCommonTableExpressionName(n){this.visitNode(n.table),n.columns&&(this.append("("),this.compileList(n.columns),this.append(")"))}visitAlterTable(n){this.append("alter table "),this.visitNode(n.table),this.append(" "),n.renameTo&&(this.append("rename to "),this.visitNode(n.renameTo)),n.setSchema&&(this.append("set schema "),this.visitNode(n.setSchema)),n.addConstraint&&this.visitNode(n.addConstraint),n.dropConstraint&&this.visitNode(n.dropConstraint),n.columnAlterations&&this.compileList(n.columnAlterations)}visitAddColumn(n){this.append("add column "),this.visitNode(n.column)}visitRenameColumn(n){this.append("rename column "),this.visitNode(n.column),this.append(" to "),this.visitNode(n.renameTo)}visitDropColumn(n){this.append("drop column "),this.visitNode(n.column)}visitAlterColumn(n){this.append("alter column "),this.visitNode(n.column),this.append(" "),n.dataType&&(this.append("type "),this.visitNode(n.dataType),n.dataTypeExpression&&(this.append("using "),this.visitNode(n.dataTypeExpression))),n.setDefault&&(this.append("set default "),this.visitNode(n.setDefault)),n.dropDefault&&this.append("drop default"),n.setNotNull&&this.append("set not null"),n.dropNotNull&&this.append("drop not null")}visitModifyColumn(n){this.append("modify column "),this.visitNode(n.column)}visitAddConstraint(n){this.append("add "),this.visitNode(n.constraint)}visitDropConstraint(n){this.append("drop constraint "),n.ifExists&&this.append("if exists "),this.visitNode(n.constraintName),n.modifier==="cascade"?this.append(" cascade"):n.modifier==="restrict"&&this.append(" restrict")}visitSetOperation(n){this.append(n.operator),this.append(" "),n.all&&this.append("all "),this.visitNode(n.expression)}visitCreateView(n){this.append("create "),n.orReplace&&this.append("or replace "),n.materialized&&this.append("materialized "),n.temporary&&this.append("temporary "),this.append("view "),n.ifNotExists&&this.append("if not exists "),this.visitNode(n.name),this.append(" "),n.columns&&(this.append("("),this.compileList(n.columns),this.append(") ")),n.as&&(this.append("as "),this.visitNode(n.as))}visitDropView(n){this.append("drop "),n.materialized&&this.append("materialized "),this.append("view "),n.ifExists&&this.append("if exists "),this.visitNode(n.name),n.cascade&&this.append(" cascade")}visitGenerated(n){this.append("generated "),n.always&&this.append("always "),n.byDefault&&this.append("by default "),this.append("as "),n.identity&&this.append("identity"),n.expression&&(this.append("("),this.visitNode(n.expression),this.append(")")),n.stored&&this.append(" stored")}visitDefaultValue(n){this.append("default "),this.visitNode(n.defaultValue)}visitSelectModifier(n){n.rawModifier?this.visitNode(n.rawModifier):this.append(Db[n.modifier])}visitCreateType(n){this.append("create type "),this.visitNode(n.name),n.enum&&(this.append(" as enum "),this.visitNode(n.enum))}visitDropType(n){this.append("drop type "),n.ifExists&&this.append("if exists "),this.visitNode(n.name)}visitExplain(n){this.append("explain"),(n.options||n.format)&&(this.append(" "),this.append(this.getLeftExplainOptionsWrapper()),n.options&&(this.visitNode(n.options),n.format&&this.append(this.getExplainOptionsDelimiter())),n.format&&(this.append("format"),this.append(this.getExplainOptionAssignment()),this.append(n.format)),this.append(this.getRightExplainOptionsWrapper()))}visitDefaultInsertValue(n){this.append("default")}visitAggregateFunction(n){this.append(n.func),this.append("("),n.distinct&&this.append("distinct "),this.compileList(n.aggregated),this.append(")"),n.filter&&(this.append(" filter("),this.visitNode(n.filter),this.append(")")),n.over&&(this.append(" "),this.visitNode(n.over))}visitOver(n){this.append("over("),n.partitionBy&&(this.visitNode(n.partitionBy),n.orderBy&&this.append(" ")),n.orderBy&&this.visitNode(n.orderBy),this.append(")")}visitPartitionBy(n){this.append("partition by "),this.compileList(n.items)}visitPartitionByItem(n){this.visitNode(n.partitionBy)}visitBinaryOperation(n){this.visitNode(n.leftOperand),this.append(" "),this.visitNode(n.operator),this.append(" "),this.visitNode(n.rightOperand)}visitUnaryOperation(n){this.visitNode(n.operator),this.isMinusOperator(n.operator)||this.append(" "),this.visitNode(n.operand)}isMinusOperator(n){return Ff.is(n)&&n.operator==="-"}visitUsing(n){this.append("using "),this.compileList(n.tables)}visitFunction(n){this.append(n.func),this.append("("),this.compileList(n.arguments),this.append(")")}visitCase(n){this.append("case"),n.value&&(this.append(" "),this.visitNode(n.value)),n.when&&(this.append(" "),this.compileList(n.when," ")),n.else&&(this.append(" else "),this.visitNode(n.else)),this.append(" end"),n.isStatement&&this.append(" case")}visitWhen(n){this.append("when "),this.visitNode(n.condition),n.result&&(this.append(" then "),this.visitNode(n.result))}append(n){P(this,_o,r(this,_o)+n)}appendValue(n){this.addParameter(n),this.append(this.getCurrentParameterPlaceholder())}getLeftIdentifierWrapper(){return'"'}getRightIdentifierWrapper(){return'"'}getCurrentParameterPlaceholder(){return"$"+this.numParameters}getLeftExplainOptionsWrapper(){return"("}getExplainOptionAssignment(){return" "}getExplainOptionsDelimiter(){return", "}getRightExplainOptionsWrapper(){return")"}sanitizeIdentifier(n){const i=this.getLeftIdentifierWrapper(),a=this.getRightIdentifierWrapper();let l="";for(const m of n)l+=m,m===i?l+=i:m===a&&(l+=a);return l}addParameter(n){r(this,fs).push(n)}appendImmediateValue(n){if(mr(n))this.append(`'${n}'`);else if(cg(n)||yp(n))this.append(n.toString());else if(wp(n))this.append("null");else if(lg(n))this.appendImmediateValue(n.toISOString());else if(fg(n))this.appendImmediateValue(n.toString());else throw new Error(`invalid immediate value ${n}`)}}_o=new WeakMap,fs=new WeakMap;const Db=p({ForKeyShare:"for key share",ForNoKeyUpdate:"for no key update",ForUpdate:"for update",ForShare:"for share",NoWait:"nowait",SkipLocked:"skip locked",Distinct:"distinct"}),Lb=p({InnerJoin:"inner join",LeftJoin:"left join",RightJoin:"right join",FullJoin:"full join",LateralInnerJoin:"inner join lateral",LateralLeftJoin:"left join lateral"}),Qr=p({raw(t){return p({sql:t,query:en.createWithSql(t),parameters:p([])})}}),Pb=/"/g;class lm extends Rb{getCurrentParameterPlaceholder(){return"?"}getLeftExplainOptionsWrapper(){return""}getRightExplainOptionsWrapper(){return""}getLeftIdentifierWrapper(){return'"'}getRightIdentifierWrapper(){return'"'}getAutoIncrement(){return"autoincrement"}sanitizeIdentifier(e){return e.replace(Pb,'""')}visitDefaultInsertValue(e){this.append("null")}}const Mb="kysely_migration",Bb="kysely_migration_lock";p({__noMigrations__:!0});var xo,Xc,hm;class fm{constructor(e){S(this,Xc);S(this,xo,void 0);P(this,xo,e)}async getSchemas(){return[]}async getTables(e={withInternalKyselyTables:!1}){let n=r(this,xo).selectFrom("sqlite_schema").where("type","in",["table","view"]).where("name","not like","sqlite_%").select("name").orderBy("name").$castTo();e.withInternalKyselyTables||(n=n.where("name","!=",Mb).where("name","!=",Bb));const i=await n.execute();return Promise.all(i.map(({name:a})=>qe(this,Xc,hm).call(this,a)))}async getMetadata(e){return{tables:await this.getTables(e)}}}xo=new WeakMap,Xc=new WeakSet,hm=async function(e){var m,w,v,d,W,B;const n=r(this,xo),i=await n.selectFrom("sqlite_master").where("name","=",e).select(["sql","type"]).$castTo().executeTakeFirstOrThrow(),a=(B=(W=(d=(v=(w=(m=i.sql)==null?void 0:m.split(/[\(\),]/))==null?void 0:w.find(D=>D.toLowerCase().includes("autoincrement")))==null?void 0:v.trimStart())==null?void 0:d.split(/\s+/))==null?void 0:W[0])==null?void 0:B.replace(/["`]/g,""),l=await n.selectFrom(kn`pragma_table_info(${e})`.as("table_info")).select(["name","type","notnull","dflt_value"]).orderBy("cid").execute();return{name:e,isView:i.type==="view",columns:l.map(D=>({name:D.name,dataType:D.type,isNullable:!D.notnull,isAutoIncrementing:D.name===a,hasDefaultValue:D.dflt_value!=null}))}};class dm{get supportsTransactionalDdl(){return!1}get supportsReturning(){return!0}async acquireMigrationLock(){}async releaseMigrationLock(){}}var pm=class{createQueryCompiler(){return new lm}createAdapter(){return new dm}createIntrospector(t){return new fm(t)}},ru,Yc,sd,mm=(sd=class{constructor(){S(this,ru,new Fb);Yt(this,"connection");S(this,Yc,void 0)}async acquireConnection(){return await r(this,ru).lock(),this.connection}async beginTransaction(t){await t.executeQuery(Qr.raw("begin"))}async commitTransaction(t){await t.executeQuery(Qr.raw("commit"))}async rollbackTransaction(t){await t.executeQuery(Qr.raw("rollback"))}async releaseConnection(){r(this,ru).unlock()}async destroy(){var t;(t=r(this,Yc))==null||t.close()}},ru=new WeakMap,Yc=new WeakMap,sd),hs,Eo,od,Fb=(od=class{constructor(){S(this,hs,void 0);S(this,Eo,void 0)}async lock(){for(;r(this,hs);)await r(this,hs);P(this,hs,new Promise(e=>{P(this,Eo,e)}))}unlock(){const e=r(this,Eo);P(this,hs,void 0),P(this,Eo,void 0),e==null||e()}},hs=new WeakMap,Eo=new WeakMap,od),ym=class{streamQuery(){throw new Error("Sqlite driver doesn't support streaming")}async executeQuery(t){const{parameters:e,sql:n,query:i}=t;return["SelectQueryNode","RawNode"].includes(i.kind)?{rows:await this.query(n,e)}:{rows:[],...await this.exec(n,e)}}};function Ub({func:t,delay:e,maxCalls:n}){let i,a=0,l=null;function m(){i&&clearTimeout(i),a=0,l=null}function w(){a>=n?(t(l),m()):(i&&clearTimeout(i),i=setTimeout(()=>{t(l),m(),i=void 0},e))}return v=>{a++,l=v,i===void 0&&a===0?(t(v),a++):w()}}var Tn,Co,ad,$b=(ad=class extends mm{constructor(e){super();S(this,Tn,void 0);S(this,Co,void 0);P(this,Tn,e)}async init(){var e,n,i,a;if(P(this,Co,typeof r(this,Tn).database=="function"?await r(this,Tn).database():r(this,Tn).database),!r(this,Co))throw new Error("no database");this.connection=new Qb(r(this,Co),(e=r(this,Tn).onWrite)==null?void 0:e.func,(n=r(this,Tn).onWrite)==null?void 0:n.isThrottle,(i=r(this,Tn).onWrite)==null?void 0:i.maxCalls,(a=r(this,Tn).onWrite)==null?void 0:a.delay),r(this,Tn).onCreateConnection&&await r(this,Tn).onCreateConnection(this.connection)}async beginTransaction(e){await e.executeQuery(Qr.raw("begin")),this.connection&&this.connection.transactionNum++}async commitTransaction(e){await e.executeQuery(Qr.raw("commit")),this.connection&&this.connection.transactionNum--}async rollbackTransaction(e){await e.executeQuery(Qr.raw("rollback")),this.connection&&this.connection.transactionNum--}},Tn=new WeakMap,Co=new WeakMap,ad),pi,Oo,ud,Qb=(ud=class extends ym{constructor(e,n,i=!1,a=1e3,l=2e3){super();S(this,pi,void 0);S(this,Oo,void 0);Yt(this,"transactionNum",0);P(this,pi,e),P(this,Oo,n?i?Ub({func:n,maxCalls:a,delay:l}):n:void 0)}query(e,n){const i=r(this,pi).prepare(e);i.bind(n);const a=[];for(;i.step();)a.push(i.getAsObject());return i.free(),a}exec(e,n){r(this,pi).run(e,n);const i=BigInt(this.query("SELECT last_insert_rowid() as id")[0].id),a=BigInt(r(this,pi).getRowsModified());return this.transactionNum===0&&r(this,Oo)&&r(this,Oo).call(this,r(this,pi).export()),{numAffectedRows:a,insertId:i}}},pi=new WeakMap,Oo=new WeakMap,ud),iu,cd,jb=(cd=class extends pm{constructor(e){super();S(this,iu,void 0);P(this,iu,e)}createDriver(){return new $b(r(this,iu))}},iu=new WeakMap,cd),Pr,ds,ld,Hb=(ld=class extends mm{constructor(e){super();S(this,Pr,void 0);S(this,ds,void 0);P(this,Pr,e)}async init(){P(this,ds,typeof r(this,Pr).database=="function"?await r(this,Pr).database():r(this,Pr).database),this.connection=new Vb(r(this,ds)),r(this,Pr).onCreateConnection&&await r(this,Pr).onCreateConnection(this.connection)}async close(){var e;await((e=r(this,ds))==null?void 0:e.sqlite.close(r(this,ds).db))}},Pr=new WeakMap,ds=new WeakMap,ld),Sn,ps,fd,Vb=(fd=class extends ym{constructor(e){super();S(this,Sn,void 0);S(this,ps,void 0);P(this,ps,e.db),P(this,Sn,e.sqlite)}async run(e){const n=r(this,Sn).str_new(r(this,ps),e.sql),i=await r(this,Sn).prepare_v2(r(this,ps),r(this,Sn).str_value(n));if(i===null)return[];const a=i.stmt;try{typeof e.param<"u"&&r(this,Sn).bind_collection(a,e.param);const l=[];let m=[];for(;await r(this,Sn).step(a)===100;){m=m.length===0?r(this,Sn).column_names(a):m;const w=r(this,Sn).row(a);l.push(m.reduce((v,d,W)=>(v[d]=w[W],v),{}))}return l}finally{await r(this,Sn).finalize(a)}}async query(e,n){return await this.run({sql:e,param:n})}async exec(e,n){await this.run({sql:e,param:n});const i=await this.run({sql:"SELECT last_insert_rowid() as id"});return{insertId:BigInt(i[0].id),numAffectedRows:BigInt(r(this,Sn).changes(r(this,ps)))}}},Sn=new WeakMap,ps=new WeakMap,fd),su,hd,zb=(hd=class extends pm{constructor(e){super();S(this,su,void 0);P(this,su,e)}createDriver(){return new Hb(r(this,su))}},su=new WeakMap,hd);function Kb(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Jb(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function i(){if(this instanceof i){var a=[null];a.push.apply(a,arguments);var l=Function.bind.apply(e,a);return new l}return e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(i){var a=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(n,i,a.get?a:{enumerable:!0,get:function(){return t[i]}})}),n}var wm={exports:{}};const Gb={},Xb=Object.freeze(Object.defineProperty({__proto__:null,default:Gb},Symbol.toStringTag,{value:"Module"})),Ku=Jb(Xb);(function(t,e){var n=void 0,i=function(a){return n||(n=new Promise(function(l,m){var w=typeof a<"u"?a:{},v=w.onAbort;w.onAbort=function(o){m(new Error(o)),v&&v(o)},w.postRun=w.postRun||[],w.postRun.push(function(){l(w)}),t=void 0;var d;d||(d=typeof w<"u"?w:{}),d.onRuntimeInitialized=function(){function o(I,G){switch(typeof G){case"boolean":Mu(I,G?1:0);break;case"number":Lu(I,G);break;case"string":ha(I,G,-1,-1);break;case"object":if(G===null)fa(I);else if(G.length!=null){var s=Fs(G);Pu(I,s,G.length,-1),Fi(s)}else Qi(I,"Wrong API use : tried to return a value of an unknown type ("+G+").",-1);break;default:fa(I)}}function c(I,G){for(var s=[],u=0;u>>0),I!=null){var G=this.filename,s="/",u=G;if(s&&(s=typeof s=="string"?s:Oi(s),u=G?ue(s+"/"+G):s),G=mn(!0,!0),u=Wi(u,(G!==void 0?G:438)&4095|32768,0),I){if(typeof I=="string"){s=Array(I.length);for(var f=0,y=I.length;f{ee||(T=Ku,ee=Ku)},C=function(o,c){return Ne(),o=ee.normalize(o),T.readFileSync(o,c?void 0:"utf8")},q=o=>(o=C(o,!0),o.buffer||(o=new Uint8Array(o)),o),N=(o,c,h)=>{Ne(),o=ee.normalize(o),T.readFile(o,function(g,E){g?h(g):c(E.buffer)})},1{var c=new XMLHttpRequest;return c.open("GET",o,!1),c.send(null),c.responseText},ne&&(q=o=>{var c=new XMLHttpRequest;return c.open("GET",o,!1),c.responseType="arraybuffer",c.send(null),new Uint8Array(c.response)}),N=(o,c,h)=>{var g=new XMLHttpRequest;g.open("GET",o,!0),g.responseType="arraybuffer",g.onload=()=>{g.status==200||g.status==0&&g.response?c(g.response):h()},g.onerror=h,g.send(null)});var ae=d.print||console.log.bind(console),_e=d.printErr||console.warn.bind(console);Object.assign(d,W),W=null,d.thisProgram&&(B=d.thisProgram);var xe;d.wasmBinary&&(xe=d.wasmBinary),d.noExitRuntime,typeof WebAssembly!="object"&&x("no native wasm support detected");var tt,ze=!1,qt=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function Wt(o,c,h){var g=c+h;for(h=c;o[h]&&!(h>=g);)++h;if(16E?g+=String.fromCharCode(E):(E-=65536,g+=String.fromCharCode(55296|E>>10,56320|E&1023))}}else g+=String.fromCharCode(E)}return g}function Qe(o,c){return o?Wt(Oe,o,c):""}function Kt(o,c,h,g){if(!(0=Q){var ve=o.charCodeAt(++L);Q=65536+((Q&1023)<<10)|ve&1023}if(127>=Q){if(h>=g)break;c[h++]=Q}else{if(2047>=Q){if(h+1>=g)break;c[h++]=192|Q>>6}else{if(65535>=Q){if(h+2>=g)break;c[h++]=224|Q>>12}else{if(h+3>=g)break;c[h++]=240|Q>>18,c[h++]=128|Q>>12&63}c[h++]=128|Q>>6&63}c[h++]=128|Q&63}}return c[h]=0,h-E}function dn(o){for(var c=0,h=0;h=g?c++:2047>=g?c+=2:55296<=g&&57343>=g?(c+=4,++h):c+=3}return c}var wt,ge,Oe,ut,we,Re,Pt,Ar;function Cs(){var o=tt.buffer;wt=o,d.HEAP8=ge=new Int8Array(o),d.HEAP16=ut=new Int16Array(o),d.HEAP32=we=new Int32Array(o),d.HEAPU8=Oe=new Uint8Array(o),d.HEAPU16=new Uint16Array(o),d.HEAPU32=Re=new Uint32Array(o),d.HEAPF32=Pt=new Float32Array(o),d.HEAPF64=Ar=new Float64Array(o)}var En,pn=[],fe=[],Me=[];function zn(){var o=d.preRun.shift();pn.unshift(o)}var Jt=0,Ke=null;function x(o){throw d.onAbort&&d.onAbort(o),o="Aborted("+o+")",_e(o),ze=!0,new WebAssembly.RuntimeError(o+". Build with -sASSERTIONS for more info.")}function O(){return R.startsWith("data:application/octet-stream;base64,")}var R;if(R="sql-wasm.wasm",!O()){var F=R;R=d.locateFile?d.locateFile(F,b):b+F}function K(){var o=R;try{if(o==R&&xe)return new Uint8Array(xe);if(q)return q(o);throw"both async and sync fetching of the wasm failed"}catch(c){x(c)}}function Y(){if(!xe&&(D||ne)){if(typeof fetch=="function"&&!R.startsWith("file://"))return fetch(R,{credentials:"same-origin"}).then(function(o){if(!o.ok)throw"failed to load wasm binary file at '"+R+"'";return o.arrayBuffer()}).catch(function(){return K()});if(N)return new Promise(function(o,c){N(R,function(h){o(new Uint8Array(h))},c)})}return Promise.resolve().then(function(){return K()})}var j,z;function re(o){for(;0>0];case"i8":return ge[o>>0];case"i16":return ut[o>>1];case"i32":return we[o>>2];case"i64":return we[o>>2];case"float":return Pt[o>>2];case"double":return Ar[o>>3];case"*":return Re[o>>2];default:x("invalid type for getValue: "+c)}return null}function ce(o){var c="i32";switch(c.endsWith("*")&&(c="*"),c){case"i1":ge[o>>0]=0;break;case"i8":ge[o>>0]=0;break;case"i16":ut[o>>1]=0;break;case"i32":we[o>>2]=0;break;case"i64":z=[0,(j=0,1<=+Math.abs(j)?0>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],we[o>>2]=z[0],we[o+4>>2]=z[1];break;case"float":Pt[o>>2]=0;break;case"double":Ar[o>>3]=0;break;case"*":Re[o>>2]=0;break;default:x("invalid type for setValue: "+c)}}var oe=(o,c)=>{for(var h=0,g=o.length-1;0<=g;g--){var E=o[g];E==="."?o.splice(g,1):E===".."?(o.splice(g,1),h++):h&&(o.splice(g,1),h--)}if(c)for(;h;h--)o.unshift("..");return o},ue=o=>{var c=o.charAt(0)==="/",h=o.substr(-1)==="/";return(o=oe(o.split("/").filter(g=>!!g),!c).join("/"))||c||(o="."),o&&h&&(o+="/"),(c?"/":"")+o},be=o=>{var c=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(o).slice(1);return o=c[0],c=c[1],!o&&!c?".":(c&&(c=c.substr(0,c.length-1)),o+c)},Ee=o=>{if(o==="/")return"/";o=ue(o),o=o.replace(/\/$/,"");var c=o.lastIndexOf("/");return c===-1?o:o.substr(c+1)};function je(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var o=new Uint8Array(1);return()=>(crypto.getRandomValues(o),o[0])}if(te)try{var c=Ku;return()=>c.randomBytes(1)[0]}catch{}return()=>x("randomDevice")}function Le(){for(var o="",c=!1,h=arguments.length-1;-1<=h&&!c;h--){if(c=0<=h?arguments[h]:"/",typeof c!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!c)return"";o=c+"/"+o,c=c.charAt(0)==="/"}return o=oe(o.split("/").filter(g=>!!g),!c).join("/"),(c?"/":"")+o||"."}function it(o,c){var h=Array(dn(o)+1);return o=Kt(o,h,0,h.length),c&&(h.length=o),h}var me=[];function Cn(o,c){me[o]={input:[],output:[],Xa:c},qi(o,Ci)}var Ci={open:function(o){var c=me[o.node.rdev];if(!c)throw new H(43);o.tty=c,o.seekable=!1},close:function(o){o.tty.Xa.fsync(o.tty)},fsync:function(o){o.tty.Xa.fsync(o.tty)},read:function(o,c,h,g){if(!o.tty||!o.tty.Xa.tb)throw new H(60);for(var E=0,L=0;L=c||(c=Math.max(c,h*(1048576>h?2:1.125)>>>0),h!=0&&(c=Math.max(c,256)),h=o.Ia,o.Ia=new Uint8Array(c),0=o.node.Ma)return 0;if(o=Math.min(o.node.Ma-E,g),8c)throw new H(28);return c},lb:function(o,c,h){le.qb(o.node,c+h),o.node.Ma=Math.max(o.node.Ma,c+h)},bb:function(o,c,h,g,E){if((o.node.mode&61440)!==32768)throw new H(43);if(o=o.node.Ia,E&2||o.buffer!==wt){if((0{if(o=Le("/",o),!o)return{path:"",node:null};if(c=Object.assign({rb:!0,kb:0},c),8!!Q),!1);for(var h=Mt,g="/",E=0;E{for(var c;;){if(o===o.parent)return o=o.Ra.ub,c?o[o.length-1]!=="/"?o+"/"+c:o+c:o;c=c?o.name+"/"+c:o.name,o=o.parent}},Ws=(o,c)=>{for(var h=0,g=0;g>>0)%On.length},Tr=o=>{var c=Ws(o.parent.id,o.name);if(On[c]===o)On[c]=o.Wa;else for(c=On[c];c;){if(c.Wa===o){c.Wa=o.Wa;break}c=c.Wa}},yr=(o,c)=>{var h;if(h=(h=zr(o,"x"))?h:o.Ga.lookup?0:2)throw new H(h,o);for(h=On[Ws(o.id,c)];h;h=h.Wa){var g=h.name;if(h.parent.id===o.id&&g===c)return h}return o.Ga.lookup(o,c)},Ho=(o,c,h,g)=>(o=new na(o,c,h,g),c=Ws(o.parent.id,o.name),o.Wa=On[c],On[c]=o),Cl={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},Vo=o=>{var c=["r","w","rw"][o&3];return o&512&&(c+="w"),c},zr=(o,c)=>{if(qs)return 0;if(!c.includes("r")||o.mode&292){if(c.includes("w")&&!(o.mode&146)||c.includes("x")&&!(o.mode&73))return 2}else return 2;return 0},Is=(o,c)=>{try{return yr(o,c),20}catch{}return zr(o,"wx")},zo=(o,c,h)=>{try{var g=yr(o,c)}catch(E){return E.Ka}if(o=zr(o,"wx"))return o;if(h){if((g.mode&61440)!==16384)return 54;if(g===g.parent||Oi(g)==="/")return 10}else if((g.mode&61440)===16384)return 31;return 0},Ko=(o=0)=>{for(;4096>=o;o++)if(!Dn[o])return o;throw new H(33)},qn=(o,c)=>(Di||(Di=function(){this.$a={}},Di.prototype={},Object.defineProperties(Di.prototype,{object:{get:function(){return this.node},set:function(h){this.node=h}},flags:{get:function(){return this.$a.flags},set:function(h){this.$a.flags=h}},position:{get:function(){return this.$a.position},set:function(h){this.$a.position=h}}})),o=Object.assign(new Di,o),c=Ko(c),o.fd=c,Dn[c]=o),As={open:o=>{o.Ha=Z[o.node.rdev].Ha,o.Ha.open&&o.Ha.open(o)},Ta:()=>{throw new H(70)}},qi=(o,c)=>{Z[o]={Ha:c}},Jo=(o,c)=>{var h=c==="/",g=!c;if(h&&Mt)throw new H(10);if(!h&&!g){var E=Bt(c,{rb:!1});if(c=E.path,E=E.node,E.Va)throw new H(10);if((E.mode&61440)!==16384)throw new H(54)}c={type:o,Kb:{},ub:c,Eb:[]},o=o.Ra(c),o.Ra=c,c.root=o,h?Mt=o:E&&(E.Va=c,E.Ra&&E.Ra.Eb.push(c))},Wi=(o,c,h)=>{var g=Bt(o,{parent:!0}).node;if(o=Ee(o),!o||o==="."||o==="..")throw new H(28);var E=Is(g,o);if(E)throw new H(E);if(!g.Ga.ab)throw new H(63);return g.Ga.ab(g,o,c,h)},an=(o,c)=>Wi(o,(c!==void 0?c:511)&1023|16384,0),Ii=(o,c,h)=>{typeof h>"u"&&(h=c,c=438),Wi(o,c|8192,h)},Ts=(o,c)=>{if(!Le(o))throw new H(44);var h=Bt(c,{parent:!0}).node;if(!h)throw new H(44);c=Ee(c);var g=Is(h,c);if(g)throw new H(g);if(!h.Ga.symlink)throw new H(63);h.Ga.symlink(h,c,o)},Go=o=>{var c=Bt(o,{parent:!0}).node;o=Ee(o);var h=yr(c,o),g=zo(c,o,!0);if(g)throw new H(g);if(!c.Ga.rmdir)throw new H(63);if(h.Va)throw new H(10);c.Ga.rmdir(c,o),Tr(h)},Ai=o=>{var c=Bt(o,{parent:!0}).node;if(!c)throw new H(44);o=Ee(o);var h=yr(c,o),g=zo(c,o,!1);if(g)throw new H(g);if(!c.Ga.unlink)throw new H(63);if(h.Va)throw new H(10);c.Ga.unlink(c,o),Tr(h)},Xo=o=>{if(o=Bt(o).node,!o)throw new H(44);if(!o.Ga.readlink)throw new H(28);return Le(Oi(o.parent),o.Ga.readlink(o))},Kr=(o,c)=>{if(o=Bt(o,{Sa:!c}).node,!o)throw new H(44);if(!o.Ga.Pa)throw new H(63);return o.Ga.Pa(o)},Yo=o=>Kr(o,!0),Ss=(o,c)=>{if(o=typeof o=="string"?Bt(o,{Sa:!0}).node:o,!o.Ga.Oa)throw new H(63);o.Ga.Oa(o,{mode:c&4095|o.mode&-4096,timestamp:Date.now()})},Jr=(o,c)=>{if(0>c)throw new H(28);if(o=typeof o=="string"?Bt(o,{Sa:!0}).node:o,!o.Ga.Oa)throw new H(63);if((o.mode&61440)===16384)throw new H(31);if((o.mode&61440)!==32768)throw new H(28);var h=zr(o,"w");if(h)throw new H(h);o.Ga.Oa(o,{size:c,timestamp:Date.now()})},wr=(o,c,h)=>{if(o==="")throw new H(44);if(typeof c=="string"){var g=Cl[c];if(typeof g>"u")throw Error("Unknown file open mode: "+c);c=g}if(h=c&64?(typeof h>"u"?438:h)&4095|32768:0,typeof o=="object")var E=o;else{o=ue(o);try{E=Bt(o,{Sa:!(c&131072)}).node}catch{}}if(g=!1,c&64)if(E){if(c&128)throw new H(20)}else E=Wi(o,h,0),g=!0;if(!E)throw new H(44);if((E.mode&61440)===8192&&(c&=-513),c&65536&&(E.mode&61440)!==16384)throw new H(54);if(!g&&(h=E?(E.mode&61440)===40960?32:(E.mode&61440)===16384&&(Vo(c)!=="r"||c&512)?31:zr(E,Vo(c)):44))throw new H(h);return c&512&&!g&&Jr(E,0),c&=-131713,E=qn({node:E,path:Oi(E),flags:c,seekable:!0,position:0,Ha:E.Ha,Ib:[],error:!1}),E.Ha.open&&E.Ha.open(E),!d.logReadFiles||c&1||(Li||(Li={}),o in Li||(Li[o]=1)),E},He=o=>{if(o.fd===null)throw new H(8);o.hb&&(o.hb=null);try{o.Ha.close&&o.Ha.close(o)}catch(c){throw c}finally{Dn[o.fd]=null}o.fd=null},Gr=(o,c,h)=>{if(o.fd===null)throw new H(8);if(!o.seekable||!o.Ha.Ta)throw new H(70);if(h!=0&&h!=1&&h!=2)throw new H(28);o.position=o.Ha.Ta(o,c,h),o.Ib=[]},Ti=(o,c,h,g,E)=>{if(0>g||0>E)throw new H(28);if(o.fd===null)throw new H(8);if((o.flags&2097155)===1)throw new H(8);if((o.node.mode&61440)===16384)throw new H(31);if(!o.Ha.read)throw new H(28);var L=typeof E<"u";if(!L)E=o.position;else if(!o.seekable)throw new H(70);return c=o.Ha.read(o,c,h,g,E),L||(o.position+=c),c},gr=(o,c,h,g,E)=>{if(0>g||0>E)throw new H(28);if(o.fd===null)throw new H(8);if(!(o.flags&2097155))throw new H(8);if((o.node.mode&61440)===16384)throw new H(31);if(!o.Ha.write)throw new H(28);o.seekable&&o.flags&1024&&Gr(o,0,2);var L=typeof E<"u";if(!L)E=o.position;else if(!o.seekable)throw new H(70);return c=o.Ha.write(o,c,h,g,E,void 0),L||(o.position+=c),c},ks=o=>{var c,h=wr(o,h||0);o=Kr(o).size;var g=new Uint8Array(o);return Ti(h,g,0,o,0),c=g,He(h),c},Si=()=>{H||(H=function(o,c){this.node=c,this.Hb=function(h){this.Ka=h},this.Hb(o),this.message="FS error"},H.prototype=Error(),H.prototype.constructor=H,[44].forEach(o=>{Kn[o]=new H(o),Kn[o].stack=""}))},ki,mn=(o,c)=>{var h=0;return o&&(h|=365),c&&(h|=146),h},Ln=(o,c,h)=>{o=ue("/dev/"+o);var g=mn(!!c,!!h);Ri||(Ri=64);var E=Ri++<<8|0;qi(E,{open:L=>{L.seekable=!1},close:()=>{h&&h.buffer&&h.buffer.length&&h(10)},read:(L,Q,ve,Pe)=>{for(var De=0,ct=0;ct{for(var De=0;De>2]=g.dev,we[h+8>>2]=g.ino,we[h+12>>2]=g.mode,Re[h+16>>2]=g.nlink,we[h+20>>2]=g.uid,we[h+24>>2]=g.gid,we[h+28>>2]=g.rdev,z=[g.size>>>0,(j=g.size,1<=+Math.abs(j)?0>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],we[h+40>>2]=z[0],we[h+44>>2]=z[1],we[h+48>>2]=4096,we[h+52>>2]=g.blocks,z=[Math.floor(g.atime.getTime()/1e3)>>>0,(j=Math.floor(g.atime.getTime()/1e3),1<=+Math.abs(j)?0>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],we[h+56>>2]=z[0],we[h+60>>2]=z[1],Re[h+64>>2]=0,z=[Math.floor(g.mtime.getTime()/1e3)>>>0,(j=Math.floor(g.mtime.getTime()/1e3),1<=+Math.abs(j)?0>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],we[h+72>>2]=z[0],we[h+76>>2]=z[1],Re[h+80>>2]=0,z=[Math.floor(g.ctime.getTime()/1e3)>>>0,(j=Math.floor(g.ctime.getTime()/1e3),1<=+Math.abs(j)?0>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],we[h+88>>2]=z[0],we[h+92>>2]=z[1],Re[h+96>>2]=0,z=[g.ino>>>0,(j=g.ino,1<=+Math.abs(j)?0>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],we[h+104>>2]=z[0],we[h+108>>2]=z[1],0}var Xr=void 0;function Mi(){return Xr+=4,we[Xr-4>>2]}function yn(o){if(o=Dn[o],!o)throw new H(8);return o}function Rs(o){return Re[o>>2]+4294967296*we[o+4>>2]}function Zo(o){var c=dn(o)+1,h=Bi(c);return h&&Kt(o,ge,h,c),h}function vu(o,c,h){function g(Pe){return(Pe=Pe.toTimeString().match(/\(([A-Za-z ]+)\)$/))?Pe[1]:"GMT"}var E=new Date().getFullYear(),L=new Date(E,0,1),Q=new Date(E,6,1);E=L.getTimezoneOffset();var ve=Q.getTimezoneOffset();we[o>>2]=60*Math.max(E,ve),we[c>>2]=+(E!=ve),o=g(L),c=g(Q),o=Zo(o),c=Zo(c),ve>2]=o,Re[h+4>>2]=c):(Re[h>>2]=c,Re[h+4>>2]=o)}function Ds(o,c,h){Ds.Bb||(Ds.Bb=!0,vu(o,c,h))}var ea;ea=te?()=>{var o=process.hrtime();return 1e3*o[0]+o[1]/1e6}:()=>performance.now();var Ls={};function ta(){if(!Ps){var o={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:B||"./this.program"},c;for(c in Ls)Ls[c]===void 0?delete o[c]:o[c]=Ls[c];var h=[];for(c in o)h.push(c+"="+o[c]);Ps=h}return Ps}var Ps,Gn=void 0,Ms=[];function Bs(o,c){if(!Gn){Gn=new WeakMap;var h=En.length;if(Gn)for(var g=0;g<0+h;g++){var E=En.get(g);E&&Gn.set(E,g)}}if(Gn.has(o))return Gn.get(o);if(Ms.length)h=Ms.pop();else{try{En.grow(1)}catch(ve){throw ve instanceof RangeError?"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.":ve}h=En.length-1}try{En.set(h,o)}catch(ve){if(!(ve instanceof TypeError))throw ve;if(typeof WebAssembly.Function=="function"){g=WebAssembly.Function,E={i:"i32",j:"i64",f:"f32",d:"f64",p:"i32"};for(var L={parameters:[],results:c[0]=="v"?[]:[E[c[0]]]},Q=1;QQ?g.push(Q):g.push(Q%128|128,Q>>7),Q=0;QE?c.push(E):c.push(E%128|128,E>>7),c.push.apply(c,g),c.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0),c=new WebAssembly.Module(new Uint8Array(c)),c=new WebAssembly.Instance(c,{e:{f:o}}).exports.f}En.set(h,c)}return Gn.set(o,h),h}function Yr(o){Gn.delete(En.get(o)),Ms.push(o)}function Fs(o){var c=Bi(o.length);return o.subarray||o.slice||(o=new Uint8Array(o)),Oe.set(o,c),c}function _u(o,c,h,g){var E={string:De=>{var ct=0;if(De!=null&&De!==0){var Pn=(De.length<<2)+1;ct=Xn(Pn),Kt(De,Oe,ct,Pn)}return ct},array:De=>{var ct=Xn(De.length);return ge.set(De,ct),ct}};o=d["_"+o];var L=[],Q=0;if(g)for(var ve=0;ve{an("/dev"),qi(259,{read:()=>0,write:(c,h,g,E)=>E}),Ii("/dev/null",259),Cn(1280,Gt),Cn(1536,Os),Ii("/dev/tty",1280),Ii("/dev/tty1",1536);var o=je();Ln("random",o),Ln("urandom",o),an("/dev/shm"),an("/dev/shm/tmp")})(),(()=>{an("/proc");var o=an("/proc/self");an("/proc/self/fd"),Jo({Ra:()=>{var c=Ho(o,"fd",16895,73);return c.Ga={lookup:(h,g)=>{var E=Dn[+g];if(!E)throw new H(8);return h={parent:null,Ra:{ub:"fake"},Ga:{readlink:()=>E.path}},h.parent=h}},c}},"/proc/self/fd")})();var xu={a:function(o,c,h,g){x("Assertion failed: "+Qe(o)+", at: "+[c?Qe(c):"unknown filename",h,g?Qe(g):"unknown function"])},h:function(o,c){try{return o=Qe(o),Ss(o,c),0}catch(h){if(typeof Je>"u"||!(h instanceof H))throw h;return-h.Ka}},H:function(o,c,h){try{if(c=Qe(c),c=Jn(o,c),h&-8)return-28;var g=Bt(c,{Sa:!0}).node;return g?(o="",h&4&&(o+="r"),h&2&&(o+="w"),h&1&&(o+="x"),o&&zr(g,o)?-2:0):-44}catch(E){if(typeof Je>"u"||!(E instanceof H))throw E;return-E.Ka}},i:function(o,c){try{var h=Dn[o];if(!h)throw new H(8);return Ss(h.node,c),0}catch(g){if(typeof Je>"u"||!(g instanceof H))throw g;return-g.Ka}},g:function(o){try{var c=Dn[o];if(!c)throw new H(8);var h=c.node,g=typeof h=="string"?Bt(h,{Sa:!0}).node:h;if(!g.Ga.Oa)throw new H(63);return g.Ga.Oa(g,{timestamp:Date.now()}),0}catch(E){if(typeof Je>"u"||!(E instanceof H))throw E;return-E.Ka}},b:function(o,c,h){Xr=h;try{var g=yn(o);switch(c){case 0:var E=Mi();return 0>E?-28:qn(g,E).fd;case 1:case 2:return 0;case 3:return g.flags;case 4:return E=Mi(),g.flags|=E,0;case 5:return E=Mi(),ut[E+0>>1]=2,0;case 6:case 7:return 0;case 16:case 8:return-28;case 9:return we[ra()>>2]=28,-1;default:return-28}}catch(L){if(typeof Je>"u"||!(L instanceof H))throw L;return-L.Ka}},G:function(o,c){try{var h=yn(o);return Pi(Kr,h.path,c)}catch(g){if(typeof Je>"u"||!(g instanceof H))throw g;return-g.Ka}},l:function(o,c,h){try{if(c=h+2097152>>>0<4194305-!!c?(c>>>0)+4294967296*h:NaN,isNaN(c))return-61;var g=Dn[o];if(!g)throw new H(8);if(!(g.flags&2097155))throw new H(28);return Jr(g.node,c),0}catch(E){if(typeof Je>"u"||!(E instanceof H))throw E;return-E.Ka}},B:function(o,c){try{if(c===0)return-28;var h=dn("/")+1;return c"u"||!(g instanceof H))throw g;return-g.Ka}},E:function(o,c){try{return o=Qe(o),Pi(Yo,o,c)}catch(h){if(typeof Je>"u"||!(h instanceof H))throw h;return-h.Ka}},y:function(o,c,h){try{return c=Qe(c),c=Jn(o,c),c=ue(c),c[c.length-1]==="/"&&(c=c.substr(0,c.length-1)),an(c,h),0}catch(g){if(typeof Je>"u"||!(g instanceof H))throw g;return-g.Ka}},D:function(o,c,h,g){try{c=Qe(c);var E=g&256;return c=Jn(o,c,g&4096),Pi(E?Yo:Kr,c,h)}catch(L){if(typeof Je>"u"||!(L instanceof H))throw L;return-L.Ka}},v:function(o,c,h,g){Xr=g;try{c=Qe(c),c=Jn(o,c);var E=g?Mi():0;return wr(c,h,E).fd}catch(L){if(typeof Je>"u"||!(L instanceof H))throw L;return-L.Ka}},t:function(o,c,h,g){try{if(c=Qe(c),c=Jn(o,c),0>=g)return-28;var E=Xo(c),L=Math.min(g,dn(E)),Q=ge[h+L];return Kt(E,Oe,h,g+1),ge[h+L]=Q,L}catch(ve){if(typeof Je>"u"||!(ve instanceof H))throw ve;return-ve.Ka}},s:function(o){try{return o=Qe(o),Go(o),0}catch(c){if(typeof Je>"u"||!(c instanceof H))throw c;return-c.Ka}},F:function(o,c){try{return o=Qe(o),Pi(Kr,o,c)}catch(h){if(typeof Je>"u"||!(h instanceof H))throw h;return-h.Ka}},p:function(o,c,h){try{return c=Qe(c),c=Jn(o,c),h===0?Ai(c):h===512?Go(c):x("Invalid flags passed to unlinkat"),0}catch(g){if(typeof Je>"u"||!(g instanceof H))throw g;return-g.Ka}},o:function(o,c,h){try{if(c=Qe(c),c=Jn(o,c,!0),h){var g=Rs(h),E=we[h+8>>2];L=1e3*g+E/1e6,h+=16,g=Rs(h),E=we[h+8>>2],Q=1e3*g+E/1e6}else var L=Date.now(),Q=L;o=L;var ve=Bt(c,{Sa:!0}).node;return ve.Ga.Oa(ve,{timestamp:Math.max(o,Q)}),0}catch(Pe){if(typeof Je>"u"||!(Pe instanceof H))throw Pe;return-Pe.Ka}},e:function(){return Date.now()},j:function(o,c){o=new Date(1e3*Rs(o)),we[c>>2]=o.getSeconds(),we[c+4>>2]=o.getMinutes(),we[c+8>>2]=o.getHours(),we[c+12>>2]=o.getDate(),we[c+16>>2]=o.getMonth(),we[c+20>>2]=o.getFullYear()-1900,we[c+24>>2]=o.getDay();var h=new Date(o.getFullYear(),0,1);we[c+28>>2]=(o.getTime()-h.getTime())/864e5|0,we[c+36>>2]=-(60*o.getTimezoneOffset());var g=new Date(o.getFullYear(),6,1).getTimezoneOffset();h=h.getTimezoneOffset(),we[c+32>>2]=(g!=h&&o.getTimezoneOffset()==Math.min(h,g))|0},w:function(o,c,h,g,E,L){try{var Q=yn(g);if(c&2&&!(h&2)&&(Q.flags&2097155)!==2)throw new H(2);if((Q.flags&2097155)===1)throw new H(2);if(!Q.Ha.bb)throw new H(43);var ve=Q.Ha.bb(Q,o,E,c,h),Pe=ve.Fb;return we[L>>2]=ve.vb,Pe}catch(De){if(typeof Je>"u"||!(De instanceof H))throw De;return-De.Ka}},x:function(o,c,h,g,E,L){try{var Q=yn(E);if(h&2){var ve=Oe.slice(o,o+c);Q&&Q.Ha.cb&&Q.Ha.cb(Q,ve,L,c,g)}}catch(Pe){if(typeof Je>"u"||!(Pe instanceof H))throw Pe;return-Pe.Ka}},n:Ds,q:function(){return 2147483648},d:ea,c:function(o){var c=Oe.length;if(o>>>=0,2147483648=h;h*=2){var g=c*(1+.2/h);g=Math.min(g,o+100663296);var E=Math;g=Math.max(o,g),E=E.min.call(E,2147483648,g+(65536-g%65536)%65536);e:{try{tt.grow(E-wt.byteLength+65535>>>16),Cs();var L=1;break e}catch{}L=void 0}if(L)return!0}return!1},z:function(o,c){var h=0;return ta().forEach(function(g,E){var L=c+h;for(E=Re[o+4*E>>2]=L,L=0;L>0]=g.charCodeAt(L);ge[E>>0]=0,h+=g.length+1}),0},A:function(o,c){var h=ta();Re[o>>2]=h.length;var g=0;return h.forEach(function(E){g+=E.length+1}),Re[c>>2]=g,0},f:function(o){try{var c=yn(o);return He(c),0}catch(h){if(typeof Je>"u"||!(h instanceof H))throw h;return h.Ka}},m:function(o,c){try{var h=yn(o);return ge[c>>0]=h.tty?2:(h.mode&61440)===16384?3:(h.mode&61440)===40960?7:4,0}catch(g){if(typeof Je>"u"||!(g instanceof H))throw g;return g.Ka}},u:function(o,c,h,g){try{e:{var E=yn(o);o=c;for(var L=c=0;L>2],ve=Re[o+4>>2];o+=8;var Pe=Ti(E,ge,Q,ve);if(0>Pe){var De=-1;break e}if(c+=Pe,Pe>2]=De,0}catch(ct){if(typeof Je>"u"||!(ct instanceof H))throw ct;return ct.Ka}},k:function(o,c,h,g,E){try{if(c=h+2097152>>>0<4194305-!!c?(c>>>0)+4294967296*h:NaN,isNaN(c))return 61;var L=yn(o);return Gr(L,c,g),z=[L.position>>>0,(j=L.position,1<=+Math.abs(j)?0>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],we[E>>2]=z[0],we[E+4>>2]=z[1],L.hb&&c===0&&g===0&&(L.hb=null),0}catch(Q){if(typeof Je>"u"||!(Q instanceof H))throw Q;return Q.Ka}},C:function(o){try{var c=yn(o);return c.Ha&&c.Ha.fsync?c.Ha.fsync(c):0}catch(h){if(typeof Je>"u"||!(h instanceof H))throw h;return h.Ka}},r:function(o,c,h,g){try{e:{var E=yn(o);o=c;for(var L=c=0;L>2],ve=Re[o+4>>2];o+=8;var Pe=gr(E,ge,Q,ve);if(0>Pe){var De=-1;break e}c+=Pe}De=c}return Re[g>>2]=De,0}catch(ct){if(typeof Je>"u"||!(ct instanceof H))throw ct;return ct.Ka}}};(function(){function o(E){d.asm=E.exports,tt=d.asm.I,Cs(),En=d.asm.Aa,fe.unshift(d.asm.J),Jt--,d.monitorRunDependencies&&d.monitorRunDependencies(Jt),Jt==0&&Ke&&(E=Ke,Ke=null,E())}function c(E){o(E.instance)}function h(E){return Y().then(function(L){return WebAssembly.instantiate(L,g)}).then(function(L){return L}).then(E,function(L){_e("failed to asynchronously prepare wasm: "+L),x(L)})}var g={a:xu};if(Jt++,d.monitorRunDependencies&&d.monitorRunDependencies(Jt),d.instantiateWasm)try{return d.instantiateWasm(g,o)}catch(E){return _e("Module.instantiateWasm callback failed with error: "+E),!1}return function(){return xe||typeof WebAssembly.instantiateStreaming!="function"||O()||R.startsWith("file://")||te||typeof fetch!="function"?h(c):fetch(R,{credentials:"same-origin"}).then(function(E){return WebAssembly.instantiateStreaming(E,g).then(c,function(L){return _e("wasm streaming compile failed: "+L),_e("falling back to ArrayBuffer instantiation"),h(c)})})}(),{}})(),d.___wasm_call_ctors=function(){return(d.___wasm_call_ctors=d.asm.J).apply(null,arguments)},d._sqlite3_free=function(){return(d._sqlite3_free=d.asm.K).apply(null,arguments)},d._sqlite3_value_double=function(){return(d._sqlite3_value_double=d.asm.L).apply(null,arguments)},d._sqlite3_value_text=function(){return(d._sqlite3_value_text=d.asm.M).apply(null,arguments)};var ra=d.___errno_location=function(){return(ra=d.___errno_location=d.asm.N).apply(null,arguments)};d._sqlite3_prepare_v2=function(){return(d._sqlite3_prepare_v2=d.asm.O).apply(null,arguments)},d._sqlite3_step=function(){return(d._sqlite3_step=d.asm.P).apply(null,arguments)},d._sqlite3_finalize=function(){return(d._sqlite3_finalize=d.asm.Q).apply(null,arguments)},d._sqlite3_reset=function(){return(d._sqlite3_reset=d.asm.R).apply(null,arguments)},d._sqlite3_value_int=function(){return(d._sqlite3_value_int=d.asm.S).apply(null,arguments)},d._sqlite3_clear_bindings=function(){return(d._sqlite3_clear_bindings=d.asm.T).apply(null,arguments)},d._sqlite3_value_blob=function(){return(d._sqlite3_value_blob=d.asm.U).apply(null,arguments)},d._sqlite3_value_bytes=function(){return(d._sqlite3_value_bytes=d.asm.V).apply(null,arguments)},d._sqlite3_value_type=function(){return(d._sqlite3_value_type=d.asm.W).apply(null,arguments)},d._sqlite3_result_blob=function(){return(d._sqlite3_result_blob=d.asm.X).apply(null,arguments)},d._sqlite3_result_double=function(){return(d._sqlite3_result_double=d.asm.Y).apply(null,arguments)},d._sqlite3_result_error=function(){return(d._sqlite3_result_error=d.asm.Z).apply(null,arguments)},d._sqlite3_result_int=function(){return(d._sqlite3_result_int=d.asm._).apply(null,arguments)},d._sqlite3_result_int64=function(){return(d._sqlite3_result_int64=d.asm.$).apply(null,arguments)},d._sqlite3_result_null=function(){return(d._sqlite3_result_null=d.asm.aa).apply(null,arguments)},d._sqlite3_result_text=function(){return(d._sqlite3_result_text=d.asm.ba).apply(null,arguments)},d._sqlite3_sql=function(){return(d._sqlite3_sql=d.asm.ca).apply(null,arguments)},d._sqlite3_aggregate_context=function(){return(d._sqlite3_aggregate_context=d.asm.da).apply(null,arguments)},d._sqlite3_column_count=function(){return(d._sqlite3_column_count=d.asm.ea).apply(null,arguments)},d._sqlite3_data_count=function(){return(d._sqlite3_data_count=d.asm.fa).apply(null,arguments)},d._sqlite3_column_blob=function(){return(d._sqlite3_column_blob=d.asm.ga).apply(null,arguments)},d._sqlite3_column_bytes=function(){return(d._sqlite3_column_bytes=d.asm.ha).apply(null,arguments)},d._sqlite3_column_double=function(){return(d._sqlite3_column_double=d.asm.ia).apply(null,arguments)},d._sqlite3_column_text=function(){return(d._sqlite3_column_text=d.asm.ja).apply(null,arguments)},d._sqlite3_column_type=function(){return(d._sqlite3_column_type=d.asm.ka).apply(null,arguments)},d._sqlite3_column_name=function(){return(d._sqlite3_column_name=d.asm.la).apply(null,arguments)},d._sqlite3_bind_blob=function(){return(d._sqlite3_bind_blob=d.asm.ma).apply(null,arguments)},d._sqlite3_bind_double=function(){return(d._sqlite3_bind_double=d.asm.na).apply(null,arguments)},d._sqlite3_bind_int=function(){return(d._sqlite3_bind_int=d.asm.oa).apply(null,arguments)},d._sqlite3_bind_text=function(){return(d._sqlite3_bind_text=d.asm.pa).apply(null,arguments)},d._sqlite3_bind_parameter_index=function(){return(d._sqlite3_bind_parameter_index=d.asm.qa).apply(null,arguments)},d._sqlite3_normalized_sql=function(){return(d._sqlite3_normalized_sql=d.asm.ra).apply(null,arguments)},d._sqlite3_errmsg=function(){return(d._sqlite3_errmsg=d.asm.sa).apply(null,arguments)},d._sqlite3_exec=function(){return(d._sqlite3_exec=d.asm.ta).apply(null,arguments)},d._sqlite3_changes=function(){return(d._sqlite3_changes=d.asm.ua).apply(null,arguments)},d._sqlite3_close_v2=function(){return(d._sqlite3_close_v2=d.asm.va).apply(null,arguments)},d._sqlite3_create_function_v2=function(){return(d._sqlite3_create_function_v2=d.asm.wa).apply(null,arguments)},d._sqlite3_open=function(){return(d._sqlite3_open=d.asm.xa).apply(null,arguments)};var Bi=d._malloc=function(){return(Bi=d._malloc=d.asm.ya).apply(null,arguments)},Fi=d._free=function(){return(Fi=d._free=d.asm.za).apply(null,arguments)};d._RegisterExtensionFunctions=function(){return(d._RegisterExtensionFunctions=d.asm.Ba).apply(null,arguments)};var ia=d._emscripten_builtin_memalign=function(){return(ia=d._emscripten_builtin_memalign=d.asm.Ca).apply(null,arguments)},Zr=d.stackSave=function(){return(Zr=d.stackSave=d.asm.Da).apply(null,arguments)},ei=d.stackRestore=function(){return(ei=d.stackRestore=d.asm.Ea).apply(null,arguments)},Xn=d.stackAlloc=function(){return(Xn=d.stackAlloc=d.asm.Fa).apply(null,arguments)};d.UTF8ToString=Qe,d.stackAlloc=Xn,d.stackSave=Zr,d.stackRestore=ei,d.cwrap=function(o,c,h,g){h=h||[];var E=h.every(L=>L==="number"||L==="boolean");return c!=="string"&&E&&!g?d["_"+o]:function(){return _u(o,c,h,arguments)}};var Ui;Ke=function o(){Ui||sa(),Ui||(Ke=o)};function sa(){function o(){if(!Ui&&(Ui=!0,d.calledRun=!0,!ze)){if(d.noFSInit||ki||(ki=!0,Si(),d.stdin=d.stdin,d.stdout=d.stdout,d.stderr=d.stderr,d.stdin?Ln("stdin",d.stdin):Ts("/dev/tty","/dev/stdin"),d.stdout?Ln("stdout",null,d.stdout):Ts("/dev/tty","/dev/stdout"),d.stderr?Ln("stderr",null,d.stderr):Ts("/dev/tty1","/dev/stderr"),wr("/dev/stdin",0),wr("/dev/stdout",1),wr("/dev/stderr",1)),qs=!1,re(fe),d.onRuntimeInitialized&&d.onRuntimeInitialized(),d.postRun)for(typeof d.postRun=="function"&&(d.postRun=[d.postRun]);d.postRun.length;){var c=d.postRun.shift();Me.unshift(c)}re(Me)}}if(!(0=this._size)return 0;const i=this._data.subarray(e,Math.min(this._size,e+n.length));return n.set(i),i.length}reserve(e){if(this._data.length>=e)return;const n=e-this._data.length,i=Math.min(rN,Math.max(nN,this._data.length)),a=new Uint8Array(this._data.length+Math.max(i,n));a.set(this._data),this._data=a}write(e,n){return this.reserve(e+n.length),this._data.set(n,e),this._size=Math.max(this._size,e+n.length),n.length}truncate(e){this._size=e}toUint8Array(){return this._data.subarray(0,this._size)}}const sN=self.indexedDB||window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB||window.shimIndexedDB,Gf=new Promise((t,e)=>{const n=sN.open(tN,1);n.onupgradeneeded=()=>n.result.createObjectStore("files",{keyPath:"name"}),n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error)});async function oN(t){const e=await Gf,n=await new Promise((i,a)=>{const m=e.transaction("files","readonly").objectStore("files").get(t);m.onsuccess=()=>i(m.result),m.onerror=()=>a(m.error)});if(n&&!Gs.has(t)){const i=new iN(n.data);return Gs.set(t,i),i}else return Gs.has(t)?Gs.get(t):null}async function aN(t,e){const n=await Gf;await new Promise((i,a)=>{const m=n.transaction("files","readwrite").objectStore("files").put({name:t,data:e});m.onsuccess=()=>i(!0),m.onerror=()=>a(m.error)})}async function zh(t){const e=await Gf;await new Promise((n,i)=>{const l=e.transaction("files","readwrite").objectStore("files").delete(t);l.onsuccess=()=>n(!0),l.onerror=()=>i(l.error)})}async function uN(t,e){if(await aN(t,e),Gs.has(t)){const n=Gs.get(t);n.truncate(0),n.write(0,e)}}var cN=t=>t==null||typeof t=="bigint"||typeof t=="number"||typeof t=="object"&&"buffer"in t?t:typeof t=="boolean"?`${t}`:t instanceof Date?t.toISOString():JSON.stringify(t),lN=t=>{if(t==null||typeof t=="bigint"||typeof t=="number"||typeof t=="object"&&"buffer"in t)return t;if(typeof t=="string"){const e=/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?Z?$/;if(/^(true|false)$/.test(t))return t==="true";if(e.test(t))return new Date(t);try{return JSON.parse(t,(n,i)=>typeof i=="string"&&e.exec(i)?new Date(i):i)}catch{}}return t},ms,dd,fN=(dd=class extends Vf{constructor(e){super();S(this,ms,void 0);P(this,ms,e||cN)}transformPrimitiveValueList(e){return{...e,values:e.values.map(r(this,ms))}}transformColumnUpdate(e){const{value:n}=e;if(n.kind!=="ValueNode")return super.transformColumnUpdate(e);const{value:i,...a}=n,l=r(this,ms).call(this,i);return i===l?super.transformColumnUpdate(e):super.transformColumnUpdate({...e,value:{...a,value:l}})}transformValue(e){return{...e,value:r(this,ms).call(this,e.value)}}},ms=new WeakMap,dd),ou,au,qo,pd,hN=(pd=class{constructor(t={}){S(this,ou,void 0);S(this,au,void 0);S(this,qo,void 0);P(this,ou,new fN(t.serializer)),P(this,au,t.deserializer||lN),P(this,qo,new WeakMap)}transformQuery(t){const{node:e,queryId:n}=t;return e.kind==="SelectQueryNode"&&r(this,qo).set(n,e.kind),r(this,ou).transformNode(t.node)}async parseResult(t){return await Promise.all(t.map(async e=>{const n={...e};for(const i in n)n[i]=await r(this,au).call(this,n[i]);return n}))}async transformResult(t){const{result:e,queryId:n}=t,{rows:i}=e,a=r(this,qo).get(n);return i&&a==="SelectQueryNode"?{...t.result,rows:await this.parseResult(i)}:t.result}},ou=new WeakMap,au=new WeakMap,qo=new WeakMap,pd);function Ul(t){return typeof t=="string"}function dN(t){return typeof t=="boolean"}async function Kh(t,e,n,i,a="rowid"){await kn` - create trigger if not exists ${kn.raw(e)}_${kn.raw(i)} - after ${kn.raw(n)} - on ${kn.table(e)} - begin - update ${kn.table(e)} - set ${kn.ref(i)} = datetime('now','localtime') - where ${kn.ref(a)} = NEW.${kn.ref(a)}; - end - `.execute(t).catch(l=>{console.error(l)})}function pN(t){const e=new Map;for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const i=t[n];e.set(n,i)}return e}async function mN(t,e,n=!1){for(const[i,a]of e){const{columns:l,property:m}=a;n&&await t.schema.dropTable(i).ifExists().execute().catch();let w=t.schema.createTable(i),v="rowid",d=!1,W="createAt",B="updateAt";if(m!=null&&m.timestamp&&!dN(m.timestamp)){const{create:D,update:ne}=m.timestamp;W=D??"createAt",B=ne??"updateAt"}for(const D in l){if(!Object.prototype.hasOwnProperty.call(l,D))continue;const ne=l[D];let te="text";const{type:b,notNull:C,defaultTo:N}=ne;switch(b){case"boolean":case"date":case"object":case"string":te="text";break;case"increments":v=D;case"number":te="integer";break;case"blob":te="blob"}[W,B].includes(D)||(w=w.addColumn(D,te,q=>b==="increments"?(d=!0,q.autoIncrement().primaryKey()):(C&&(q=q.notNull()),N!==void 0&&(q=q.defaultTo(N instanceof Function?N(kn):N)),q)))}if(m){const D=m.primary,ne=m.unique;if(m.timestamp&&(W&&(w=w.addColumn(W,"text")),B&&(w=w.addColumn(B,"text"))),!d&&D){const te=Ul(D);v=te?D:D[0],w=w.addPrimaryKeyConstraint(`pk_${te?D:D.join("_")}`,te?[D]:D)}ne==null||ne.forEach(te=>{const b=Ul(te);v=!D&&!d?b?te:te[0]:v,w=w.addUniqueConstraint(`un_${b?te:te.join("_")}`,b?[te]:te)})}if(await w.ifNotExists().execute(),m!=null&&m.index)for(const D of m.index){const ne=Ul(D);let te=t.schema.createIndex(`idx_${ne?D:D.join("_")}`).on(i);te=ne?te.column(D):te.columns(D),await te.ifNotExists().execute()}m!=null&&m.timestamp&&(W&&await Kh(t,i,"insert",W,v),B&&await Kh(t,i,"update",B,v))}}var mi,uu,md,yN=(md=class{constructor(t){Yt(this,"kysely");S(this,mi,void 0);S(this,uu,void 0);const{dialect:e,tables:n,dropTableBeforeInit:i,onError:a,onQuery:l,plugins:m}=t,w=[new hN];m&&w.push(...m),this.kysely=new $a({dialect:e,log:v=>{v.level==="error"?a&&a(v.error):l&&l(v.query,v.queryDurationMillis)},plugins:w}),P(this,mi,i?0:1),P(this,uu,pN(n))}async init(t=!1){const e=t||r(this,mi)===0;return await mN(this.kysely,r(this,uu),e),P(this,mi,2),this}async checkInit(){if(r(this,mi)!==2&&await this.init(),r(this,mi)!==2)throw new Error("fail to init table")}async transaction(t,e=!1){return await this.checkInit(),await this.kysely.transaction().execute(t).catch(n=>{e&&console.error(n)})}async exec(t,e=!1){return await this.checkInit(),t(this.kysely).catch(n=>{e&&console.error(n)})}async toSQL(t){return await this.checkInit(),t(this.kysely).compile()}async raw(t){return await this.checkInit(),t(kn).execute(this.kysely)}},mi=new WeakMap,uu=new WeakMap,md);async function Xf(t){const e=await new yN({dialect:t,tables:{test:{columns:{id:{type:"increments"},name:{type:"string"},blobtest:{type:"blob"},createAt:{type:"date"},updateAt:{type:"date"}},property:{timestamp:!0}}}}).init();console.log("test"),console.log(await e.raw(n=>n`PRAGMA table_info(${n.table("test")});`)),console.log(await e.raw(n=>n`select last_insert_rowid()`));for(let n=0;n<100;n++)await e.transaction(i=>i.insertInto("test").values({name:`test at ${Date.now()}`,blobtest:Uint8Array.from([2,3,4,5,6,7,8])}).execute());return e.exec(n=>n.selectFrom("test").selectAll().execute())}const wN=new jb({async database(){const t=await Zb({locateFile:()=>eN});return new t.Database(await oN("sqljs"))},onWrite:{func(t){console.log(`[sqljs] write to indexeddb, length: ${t.length}`),uN("sqljs",t)},isThrottle:!0}});function gN(){const t=Ny();function e(){Xf(wN).then(n=>{t.value=n})}return{result:t,run:e}}function bN(){return new Worker(""+new URL("sqljsWorker-342e964b.js",import.meta.url).href)}function NN(){return new Worker(""+new URL("officialWasmWorker-b264d8ca.js",import.meta.url).href)}const Ve=0,vN=5,xt=10,gm=12,bm=14,Vi=21,$l=25,_N=27,Jh=100,xN=101,EN=3850,CN=522,ON=1,qN=2,Nm=4,WN=8,Vs=0,Yi=1,ic=2,IN=3,sc=4,AN=512,TN=1024,SN=2048,kN=16384,Gh=1,Xh=2,Yh=3,Zh=4,ed=5,td=0x7fffffffffffffffn,nd=-0x8000000000000000n;class kr extends Error{constructor(e,n){super(e),this.code=n}}const Hs=!0;function RN(t){const e={},n=t._getSqliteFree(),i=t._malloc(8),a=[i,i+4];function l(b){if(typeof b!="string")return 0;const C=t.lengthBytesUTF8(b),N=t._sqlite3_malloc(C+1);return t.stringToUTF8(b,N,C+1),N}function m(b,C){return BigInt(C)<<32n|BigInt(b)&0xffffffffn}const w=function(){const b=BigInt(Number.MAX_SAFE_INTEGER)>>32n,C=BigInt(Number.MIN_SAFE_INTEGER)>>32n;return function(N,q){return q>b||q2147483647||T<-2147483648)return $l;const ee=C(N,q,T);return te(b,ee,W.get(N))}}(),e.bind_int64=function(){const b="sqlite3_bind_int64",C=t.cwrap(b,...Ce("nnnn:n"));return function(N,q,T){if(B(N),T>td||T>32n,ae=C(N,q,Number(ee),Number(Ne));return te(b,ae,W.get(N))}}(),e.bind_null=function(){const b="sqlite3_bind_null",C=t.cwrap(b,...Ce("nn:n"));return function(N,q){B(N);const T=C(N,q);return te(b,T,W.get(N))}}(),e.bind_parameter_name=function(){const b="sqlite3_bind_parameter_name",C=t.cwrap(b,...Ce("n:s"));return function(N,q){return B(N),C(N,q)}}(),e.bind_text=function(){const b="sqlite3_bind_text",C=t.cwrap(b,...Ce("nnnnn:n"));return function(N,q,T){B(N);const ee=l(T),Ne=C(N,q,ee,-1,n);return te(b,Ne,W.get(N))}}(),e.changes=function(){const b="sqlite3_changes",C=t.cwrap(b,...Ce("n:n"));return function(N){return d(N),C(N)}}(),e.close=function(){const b="sqlite3_close",C=t.cwrap(b,...Ce("n:n"),{async:Hs});return async function(N){d(N);const q=await C(N);return v.delete(N),te(b,q,N)}}(),e.column=function(b,C){B(b);const N=e.column_type(b,C);switch(N){case Zh:return e.column_blob(b,C);case Xh:return e.column_double(b,C);case Gh:const q=e.column_int(b,C),T=t.getTempRet0();return w(q,T);case ed:return null;case Yh:return e.column_text(b,C);default:throw new kr("unknown type",N)}},e.column_blob=function(){const b="sqlite3_column_blob",C=t.cwrap(b,...Ce("nn:n"));return function(N,q){B(N);const T=e.column_bytes(N,q),ee=C(N,q);return t.HEAPU8.subarray(ee,ee+T)}}(),e.column_bytes=function(){const b="sqlite3_column_bytes",C=t.cwrap(b,...Ce("nn:n"));return function(N,q){return B(N),C(N,q)}}(),e.column_count=function(){const b="sqlite3_column_count",C=t.cwrap(b,...Ce("n:n"));return function(N){return B(N),C(N)}}(),e.column_double=function(){const b="sqlite3_column_double",C=t.cwrap(b,...Ce("nn:n"));return function(N,q){return B(N),C(N,q)}}(),e.column_int=function(){const b="sqlite3_column_int64",C=t.cwrap(b,...Ce("nn:n"));return function(N,q){return B(N),C(N,q)}}(),e.column_int64=function(){const b="sqlite3_column_int64",C=t.cwrap(b,...Ce("nn:n"));return function(N,q){B(N);const T=C(N,q),ee=t.getTempRet0();return m(T,ee)}}(),e.column_name=function(){const b="sqlite3_column_name",C=t.cwrap(b,...Ce("nn:s"));return function(N,q){return B(N),C(N,q)}}(),e.column_names=function(b){const C=[],N=e.column_count(b);for(let q=0;qtd||q>32n;C(N,Number(T),Number(ee))}}(),e.result_null=function(){const b="sqlite3_result_null",C=t.cwrap(b,...Ce("n:n"));return function(N){C(N)}}(),e.result_text=function(){const b="sqlite3_result_text",C=t.cwrap(b,...Ce("nnnn:n"));return function(N,q){const T=l(q);C(N,T,-1,n)}}(),e.row=function(b){const C=[],N=e.data_count(b);for(let q=0;q{var t=import.meta.url;return function(e={}){var n;n||(n=typeof e<"u"?e:{});var i,a;n.ready=new Promise((s,u)=>{i=s,a=u});var l=Object.assign({},n),m="./this.program",w=(s,u)=>{throw u},v=typeof window=="object",d=typeof importScripts=="function",W="",B;(v||d)&&(d?W=self.location.href:typeof document<"u"&&document.currentScript&&(W=document.currentScript.src),t&&(W=t),W.indexOf("blob:")!==0?W=W.substr(0,W.replace(/[?#].*/,"").lastIndexOf("/")+1):W="",d&&(B=s=>{var u=new XMLHttpRequest;return u.open("GET",s,!1),u.responseType="arraybuffer",u.send(null),new Uint8Array(u.response)}));var D=n.print||console.log.bind(console),ne=n.printErr||console.warn.bind(console);Object.assign(n,l),l=null,n.thisProgram&&(m=n.thisProgram),n.quit&&(w=n.quit);var te;n.wasmBinary&&(te=n.wasmBinary);var b=n.noExitRuntime||!0;typeof WebAssembly!="object"&&ut("no native wasm support detected");var C,N=!1,q,T,ee,Ne,ae,_e,xe,tt;function ze(){var s=C.buffer;n.HEAP8=T=new Int8Array(s),n.HEAP16=Ne=new Int16Array(s),n.HEAP32=ae=new Int32Array(s),n.HEAPU8=ee=new Uint8Array(s),n.HEAPU16=new Uint16Array(s),n.HEAPU32=_e=new Uint32Array(s),n.HEAPF32=xe=new Float32Array(s),n.HEAPF64=tt=new Float64Array(s)}var qt=[],Wt=[],Qe=[],Kt=[],dn=0;function wt(){var s=n.preRun.shift();qt.unshift(s)}var ge=0,Oe=null;function ut(s){throw n.onAbort&&n.onAbort(s),s="Aborted("+s+")",ne(s),N=!0,q=1,s=new WebAssembly.RuntimeError(s+". Build with -sASSERTIONS for more info."),a(s),s}function we(s){return s.startsWith("data:application/octet-stream;base64,")}var Re;if(n.locateFile){if(Re="wa-sqlite-async.wasm",!we(Re)){var Pt=Re;Re=n.locateFile?n.locateFile(Pt,W):W+Pt}}else Re=new URL(""+new URL("wa-sqlite-async-24800831.wasm",import.meta.url).href,self.location).href;function Ar(s){try{if(s==Re&&te)return new Uint8Array(te);if(B)return B(s);throw"both async and sync fetching of the wasm failed"}catch(u){ut(u)}}function Cs(s){return te||!v&&!d||typeof fetch!="function"?Promise.resolve().then(()=>Ar(s)):fetch(s,{credentials:"same-origin"}).then(u=>{if(!u.ok)throw"failed to load wasm binary file at '"+s+"'";return u.arrayBuffer()}).catch(()=>Ar(s))}function En(s,u,f){return Cs(s).then(y=>WebAssembly.instantiate(y,u)).then(y=>y).then(f,y=>{ne("failed to asynchronously prepare wasm: "+y),ut(y)})}function pn(s,u){var f=Re;return te||typeof WebAssembly.instantiateStreaming!="function"||we(f)||typeof fetch!="function"?En(f,s,u):fetch(f,{credentials:"same-origin"}).then(y=>WebAssembly.instantiateStreaming(y,s).then(u,function(_){return ne("wasm streaming compile failed: "+_),ne("falling back to ArrayBuffer instantiation"),En(f,s,u)}))}var fe,Me;function zn(s){this.name="ExitStatus",this.message="Program terminated with exit("+s+")",this.status=s}function Jt(s){for(;0>0];case"i8":return T[s>>0];case"i16":return Ne[s>>1];case"i32":return ae[s>>2];case"i64":return ae[s>>2];case"float":return xe[s>>2];case"double":return tt[s>>3];case"*":return _e[s>>2];default:ut("invalid type for getValue: "+u)}}function x(s,u,f="i8"){switch(f.endsWith("*")&&(f="*"),f){case"i1":T[s>>0]=u;break;case"i8":T[s>>0]=u;break;case"i16":Ne[s>>1]=u;break;case"i32":ae[s>>2]=u;break;case"i64":Me=[u>>>0,(fe=u,1<=+Math.abs(fe)?0>>0:~~+Math.ceil((fe-+(~~fe>>>0))/4294967296)>>>0:0)],ae[s>>2]=Me[0],ae[s+4>>2]=Me[1];break;case"float":xe[s>>2]=u;break;case"double":tt[s>>3]=u;break;case"*":_e[s>>2]=u;break;default:ut("invalid type for setValue: "+f)}}var O=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function R(s,u,f){var y=u+f;for(f=u;s[f]&&!(f>=y);)++f;if(16_?y+=String.fromCharCode(_):(_-=65536,y+=String.fromCharCode(55296|_>>10,56320|_&1023))}}else y+=String.fromCharCode(_)}return y}function F(s,u){return s?R(ee,s,u):""}var K=(s,u)=>{for(var f=0,y=s.length-1;0<=y;y--){var _=s[y];_==="."?s.splice(y,1):_===".."?(s.splice(y,1),f++):f&&(s.splice(y,1),f--)}if(u)for(;f;f--)s.unshift("..");return s},Y=s=>{var u=s.charAt(0)==="/",f=s.substr(-1)==="/";return(s=K(s.split("/").filter(y=>!!y),!u).join("/"))||u||(s="."),s&&f&&(s+="/"),(u?"/":"")+s},j=s=>{var u=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(s).slice(1);return s=u[0],u=u[1],!s&&!u?".":(u&&(u=u.substr(0,u.length-1)),s+u)},z=s=>{if(s==="/")return"/";s=Y(s),s=s.replace(/\/$/,"");var u=s.lastIndexOf("/");return u===-1?s:s.substr(u+1)};function re(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return s=>crypto.getRandomValues(s);ut("initRandomDevice")}function J(s){return(J=re())(s)}function ce(){for(var s="",u=!1,f=arguments.length-1;-1<=f&&!u;f--){if(u=0<=f?arguments[f]:"/",typeof u!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!u)return"";s=u+"/"+s,u=u.charAt(0)==="/"}return s=K(s.split("/").filter(y=>!!y),!u).join("/"),(u?"/":"")+s||"."}function oe(s){for(var u=0,f=0;f=y?u++:2047>=y?u+=2:55296<=y&&57343>=y?(u+=4,++f):u+=3}return u}function ue(s,u,f,y){if(!(0=A){var V=s.charCodeAt(++k);A=65536+((A&1023)<<10)|V&1023}if(127>=A){if(f>=y)break;u[f++]=A}else{if(2047>=A){if(f+1>=y)break;u[f++]=192|A>>6}else{if(65535>=A){if(f+2>=y)break;u[f++]=224|A>>12}else{if(f+3>=y)break;u[f++]=240|A>>18,u[f++]=128|A>>12&63}u[f++]=128|A>>6&63}u[f++]=128|A&63}}return u[f]=0,f-_}var be=[];function Ee(s,u){be[s]={input:[],Rb:[],bc:u},Is(s,je)}var je={open:function(s){var u=be[s.node.ec];if(!u)throw new Z(43);s.Sb=u,s.seekable=!1},close:function(s){s.Sb.bc.ic(s.Sb)},ic:function(s){s.Sb.bc.ic(s.Sb)},read:function(s,u,f,y){if(!s.Sb||!s.Sb.bc.zc)throw new Z(60);for(var _=0,k=0;k=u||(u=Math.max(u,f*(1048576>f?2:1.125)>>>0),f!=0&&(u=Math.max(u,256)),f=s.Nb,s.Nb=new Uint8Array(u),0=s.node.Pb)return 0;if(s=Math.min(s.node.Pb-_,y),8u)throw new Z(28);return u},vc:function(s,u,f){me.xc(s.node,u+f),s.node.Pb=Math.max(s.node.Pb,u+f)},kc:function(s,u,f,y,_){if((s.node.mode&61440)!==32768)throw new Z(43);if(s=s.node.Nb,_&2||s.buffer!==T.buffer){if((0{if(s=ce(s),!s)return{path:"",node:null};if(u=Object.assign({yc:!0,tc:0},u),8!!A);for(var f=Cn,y="/",_=0;_{for(var u;;){if(s===s.parent)return s=s.Ub.Ac,u?s[s.length-1]!=="/"?s+"/"+u:s+u:s;u=u?s.name+"/"+u:s.name,s=s.parent}},qs=(s,u)=>{for(var f=0,y=0;y>>0)%le.length},H=s=>{var u=qs(s.parent.id,s.name);if(le[u]===s)le[u]=s.ac;else for(u=le[u];u;){if(u.ac===s){u.ac=s.ac;break}u=u.ac}},Kn=(s,u)=>{var f;if(f=(f=Tr(s,"x"))?f:s.Cb.cc?0:2)throw new Z(f,s);for(f=le[qs(s.id,u)];f;f=f.ac){var y=f.name;if(f.parent.id===s.id&&y===u)return f}return s.Cb.cc(s,u)},Bt=(s,u,f,y)=>(s=new Tu(s,u,f,y),u=qs(s.parent.id,s.name),s.ac=le[u],le[u]=s),Oi={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},Ws=s=>{var u=["r","w","rw"][s&3];return s&512&&(u+="w"),u},Tr=(s,u)=>{if(Mt)return 0;if(!u.includes("r")||s.mode&292){if(u.includes("w")&&!(s.mode&146)||u.includes("x")&&!(s.mode&73))return 2}else return 2;return 0},yr=(s,u)=>{try{return Kn(s,u),20}catch{}return Tr(s,"wx")},Ho=(s,u,f)=>{try{var y=Kn(s,u)}catch(_){return _.Ob}if(s=Tr(s,"wx"))return s;if(f){if((y.mode&61440)!==16384)return 54;if(y===y.parent||On(y)==="/")return 10}else if((y.mode&61440)===16384)return 31;return 0},Cl=(s=0)=>{for(;4096>=s;s++)if(!Gt[s])return s;throw new Z(33)},Vo=(s,u)=>(Gr||(Gr=function(){this.hc={}},Gr.prototype={},Object.defineProperties(Gr.prototype,{object:{get:function(){return this.node},set:function(f){this.node=f}},flags:{get:function(){return this.hc.flags},set:function(f){this.hc.flags=f}},position:{get:function(){return this.hc.position},set:function(f){this.hc.position=f}}})),s=Object.assign(new Gr,s),u=Cl(u),s.Wb=u,Gt[u]=s),zr={open:s=>{s.Mb=Ci[s.node.ec].Mb,s.Mb.open&&s.Mb.open(s)},Zb:()=>{throw new Z(70)}},Is=(s,u)=>{Ci[s]={Mb:u}},zo=(s,u)=>{var f=u==="/",y=!u;if(f&&Cn)throw new Z(10);if(!f&&!y){var _=Xt(u,{yc:!1});if(u=_.path,_=_.node,_.$b)throw new Z(10);if((_.mode&61440)!==16384)throw new Z(54)}u={type:s,Wc:{},Ac:u,Mc:[]},s=s.Ub(u),s.Ub=u,u.root=s,f?Cn=s:_&&(_.$b=u,_.Ub&&_.Ub.Mc.push(u))},Ko=(s,u,f)=>{var y=Xt(s,{parent:!0}).node;if(s=z(s),!s||s==="."||s==="..")throw new Z(28);var _=yr(y,s);if(_)throw new Z(_);if(!y.Cb.jc)throw new Z(63);return y.Cb.jc(y,s,u,f)},qn=(s,u)=>Ko(s,(u!==void 0?u:511)&1023|16384,0),As=(s,u,f)=>{typeof f>"u"&&(f=u,u=438),Ko(s,u|8192,f)},qi=(s,u)=>{if(!ce(s))throw new Z(44);var f=Xt(u,{parent:!0}).node;if(!f)throw new Z(44);u=z(u);var y=yr(f,u);if(y)throw new Z(y);if(!f.Cb.nc)throw new Z(63);f.Cb.nc(f,u,s)},Jo=s=>{var u=Xt(s,{parent:!0}).node;s=z(s);var f=Kn(u,s),y=Ho(u,s,!0);if(y)throw new Z(y);if(!u.Cb.mc)throw new Z(63);if(f.$b)throw new Z(10);u.Cb.mc(u,s),H(f)},Wi=s=>{if(s=Xt(s).node,!s)throw new Z(44);if(!s.Cb.fc)throw new Z(28);return ce(On(s.parent),s.Cb.fc(s))},an=(s,u)=>{if(s=Xt(s,{Yb:!u}).node,!s)throw new Z(44);if(!s.Cb.Tb)throw new Z(63);return s.Cb.Tb(s)},Ii=s=>an(s,!0),Ts=(s,u)=>{if(s=typeof s=="string"?Xt(s,{Yb:!0}).node:s,!s.Cb.Qb)throw new Z(63);s.Cb.Qb(s,{mode:u&4095|s.mode&-4096,timestamp:Date.now()})},Go=(s,u)=>{if(0>u)throw new Z(28);if(s=typeof s=="string"?Xt(s,{Yb:!0}).node:s,!s.Cb.Qb)throw new Z(63);if((s.mode&61440)===16384)throw new Z(31);if((s.mode&61440)!==32768)throw new Z(28);var f=Tr(s,"w");if(f)throw new Z(f);s.Cb.Qb(s,{size:u,timestamp:Date.now()})},Ai=(s,u,f)=>{if(s==="")throw new Z(44);if(typeof u=="string"){var y=Oi[u];if(typeof y>"u")throw Error("Unknown file open mode: "+u);u=y}if(f=u&64?(typeof f>"u"?438:f)&4095|32768:0,typeof s=="object")var _=s;else{s=Y(s);try{_=Xt(s,{Yb:!(u&131072)}).node}catch{}}if(y=!1,u&64)if(_){if(u&128)throw new Z(20)}else _=Ko(s,f,0),y=!0;if(!_)throw new Z(44);if((_.mode&61440)===8192&&(u&=-513),u&65536&&(_.mode&61440)!==16384)throw new Z(54);if(!y&&(f=_?(_.mode&61440)===40960?32:(_.mode&61440)===16384&&(Ws(u)!=="r"||u&512)?31:Tr(_,Ws(u)):44))throw new Z(f);return u&512&&!y&&Go(_,0),u&=-131713,_=Vo({node:_,path:On(_),flags:u,seekable:!0,position:0,Mb:_.Mb,Tc:[],error:!1}),_.Mb.open&&_.Mb.open(_),!n.logReadFiles||u&1||(Ti||(Ti={}),s in Ti||(Ti[s]=1)),_},Xo=(s,u,f)=>{if(s.Wb===null)throw new Z(8);if(!s.seekable||!s.Mb.Zb)throw new Z(70);if(f!=0&&f!=1&&f!=2)throw new Z(28);s.position=s.Mb.Zb(s,u,f),s.Tc=[]},Kr=()=>{Z||(Z=function(s,u){this.name="ErrnoError",this.node=u,this.Rc=function(f){this.Ob=f},this.Rc(s),this.message="FS error"},Z.prototype=Error(),Z.prototype.constructor=Z,[44].forEach(s=>{Dn[s]=new Z(s),Dn[s].stack=""}))},Yo,Ss=(s,u)=>{var f=0;return s&&(f|=365),u&&(f|=146),f},Jr=(s,u,f)=>{s=Y("/dev/"+s);var y=Ss(!!u,!!f);wr||(wr=64);var _=wr++<<8|0;Is(_,{open:k=>{k.seekable=!1},close:()=>{f&&f.buffer&&f.buffer.length&&f(10)},read:(k,A,V,M)=>{for(var U=0,ie=0;ie{for(var U=0;U>2]=y.Ic,ae[f+8>>2]=y.qc,ae[f+12>>2]=y.mode,_e[f+16>>2]=y.Oc,ae[f+20>>2]=y.uid,ae[f+24>>2]=y.Lc,ae[f+28>>2]=y.ec,Me=[y.size>>>0,(fe=y.size,1<=+Math.abs(fe)?0>>0:~~+Math.ceil((fe-+(~~fe>>>0))/4294967296)>>>0:0)],ae[f+40>>2]=Me[0],ae[f+44>>2]=Me[1],ae[f+48>>2]=4096,ae[f+52>>2]=y.Gc,s=y.Ec.getTime(),u=y.Nc.getTime();var _=y.Hc.getTime();return Me=[Math.floor(s/1e3)>>>0,(fe=Math.floor(s/1e3),1<=+Math.abs(fe)?0>>0:~~+Math.ceil((fe-+(~~fe>>>0))/4294967296)>>>0:0)],ae[f+56>>2]=Me[0],ae[f+60>>2]=Me[1],_e[f+64>>2]=s%1e3*1e3,Me=[Math.floor(u/1e3)>>>0,(fe=Math.floor(u/1e3),1<=+Math.abs(fe)?0>>0:~~+Math.ceil((fe-+(~~fe>>>0))/4294967296)>>>0:0)],ae[f+72>>2]=Me[0],ae[f+76>>2]=Me[1],_e[f+80>>2]=u%1e3*1e3,Me=[Math.floor(_/1e3)>>>0,(fe=Math.floor(_/1e3),1<=+Math.abs(fe)?0>>0:~~+Math.ceil((fe-+(~~fe>>>0))/4294967296)>>>0:0)],ae[f+88>>2]=Me[0],ae[f+92>>2]=Me[1],_e[f+96>>2]=_%1e3*1e3,Me=[y.qc>>>0,(fe=y.qc,1<=+Math.abs(fe)?0>>0:~~+Math.ceil((fe-+(~~fe>>>0))/4294967296)>>>0:0)],ae[f+104>>2]=Me[0],ae[f+108>>2]=Me[1],0}var Si=void 0;function ki(){return Si+=4,ae[Si-4>>2]}function mn(s){if(s=Gt[s],!s)throw new Z(8);return s}function Ln(s,u,f){return ue(s,ee,u,f)}function Ri(s){return _e[s>>2]+4294967296*ae[s+4>>2]}var Je=[0,31,60,91,121,152,182,213,244,274,305,335],Di=[0,31,59,90,120,151,181,212,243,273,304,334];function Li(s){var u=oe(s)+1,f=la(u);return f&&Ln(s,f,u),f}var Jn={};function Pi(){if(!Xr){var s={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:m||"./this.program"},u;for(u in Jn)Jn[u]===void 0?delete s[u]:s[u]=Jn[u];var f=[];for(u in s)f.push(u+"="+s[u]);Xr=f}return Xr}var Xr;function Mi(){}function yn(){}function Rs(){}function Zo(){}function vu(){}function Ds(){}function ea(){}function Ls(){}function ta(){}function Ps(){}function Gn(){}function Ms(){}function Bs(){}function Yr(){}function Fs(){}function _u(){}function na(){}function xu(){}function ra(){}function Bi(){}function Fi(){}function ia(){}function Zr(){}function ei(){}function Xn(){}function Ui(){}function sa(){}function o(){}function c(){}function h(){}function g(){}function E(){}function L(){}function Q(){}function ve(){}function Pe(){}function De(){}function ct(){}function Pn(){}function oa(s){q=s,b||0{ua={resolve:s,reject:u}})}function Il(){var s=la(12300),u=s+12;ae[s>>2]=u,ae[s+4>>2]=u+12288,u=Us[0];var f=Cu[u];return f===void 0&&(f=ql++,Cu[u]=f,Ou[f]=u),ae[s+8>>2]=f,s}function Wu(s){if(!N){if(Yn===0){var u=!1,f=!1;s((y=0)=>{if(!N&&(Eu=y,u=!0,f)){Yn=2,$i(()=>Qi(Mn)),y=!1;try{var _=(0,n.asm[Ou[ae[Mn+8>>2]]])()}catch(V){_=V,y=!0}var k=!1;if(!Mn){var A=ua;A&&(ua=null,(y?A.reject:A.resolve)(_),k=!0)}if(y&&!k)throw _}}),f=!0,u||(Yn=1,Mn=Il(),$i(()=>Pu(Mn)))}else Yn===2?(Yn=0,$i(da),Su(Mn),Mn=null,Wl.forEach(y=>{if(!N)try{if(y(),!(b||0{s().then(u)})}var Au={};function Bn(s,u,f,y,_){function k(X){return--dn,M!==0&&fa(M),u==="string"?F(X):u==="boolean"?!!X:X}var A={string:X=>{var se=0;if(X!=null&&X!==0){se=oe(X)+1;var Ae=ha(se);Ln(X,Ae,se),se=Ae}return se},array:X=>{var se=ha(X.length);return T.set(X,se),se}};s=n["_"+s];var V=[],M=0;if(y)for(var U=0;U{qn("/dev"),Is(259,{read:()=>0,write:(y,_,k,A)=>A}),As("/dev/null",259),Ee(1280,Le),Ee(1536,it),As("/dev/tty",1280),As("/dev/tty1",1536);var s=new Uint8Array(1024),u=0,f=()=>(u===0&&(u=J(s).byteLength),s[--u]);Jr("random",f),Jr("urandom",f),qn("/dev/shm"),qn("/dev/shm/tmp")})(),(()=>{qn("/proc");var s=qn("/proc/self");qn("/proc/self/fd"),zo({Ub:()=>{var u=Bt(s,"fd",16895,73);return u.Cb={cc:(f,y)=>{var _=Gt[+y];if(!_)throw new Z(8);return f={parent:null,Ub:{Ac:"fake"},Cb:{fc:()=>_.path}},f.parent=f}},u}},"/proc/self/fd")})(),function(){const s=new Map;n.setAuthorizer=function(u,f,y){return f?s.set(u,{f,uc:y}):s.delete(u),Bn("set_authorizer","number",["number"],[u])},Mi=function(u,f,y,_,k,A){if(s.has(u)){const{f:V,uc:M}=s.get(u);return V(M,f,y?F(y):null,_?F(_):null,k?F(k):null,A?F(A):null)}return 0}}(),function(){const s=new Map,u=new Map;n.createFunction=function(f,y,_,k,A,V){const M=s.size;return s.set(M,{f:V,Xb:A}),Bn("create_function","number","number string number number number number".split(" "),[f,y,_,k,M,0])},n.createAggregate=function(f,y,_,k,A,V,M){const U=s.size;return s.set(U,{step:V,Jc:M,Xb:A}),Bn("create_function","number","number string number number number number".split(" "),[f,y,_,k,U,1])},n.getFunctionUserData=function(f){return u.get(f)},Rs=function(f,y,_,k){f=s.get(f),u.set(y,f.Xb),f.f(y,new Uint32Array(ee.buffer,k,_)),u.delete(y)},vu=function(f,y,_,k){f=s.get(f),u.set(y,f.Xb),f.step(y,new Uint32Array(ee.buffer,k,_)),u.delete(y)},yn=function(f,y){f=s.get(f),u.set(y,f.Xb),f.Jc(y),u.delete(y)}}(),function(){const s=new Map;n.progressHandler=function(u,f,y,_){return y?s.set(u,{f:y,uc:_}):s.delete(u),Bn("progress_handler",null,["number","number"],[u,f])},Zo=function(u){if(s.has(u)){const{f,uc:y}=s.get(u);return f(y)}return 0}}(),function(){function s(M,U){const ie=`get${M}`,X=`set${M}`;return new Proxy(new DataView(ee.buffer,U,M==="Int32"?4:8),{get(se,Ae){if(Ae===ie)return function(Ge,At){if(!At)throw Error("must be little endian");return se[Ae](Ge,At)};if(Ae===X)return function(Ge,At,vt){if(!vt)throw Error("must be little endian");return se[Ae](Ge,At,vt)};if(typeof Ae=="string"&&Ae.match(/^(get)|(set)/))throw Error("invalid type");return se[Ae]}})}const u=typeof Au=="object",f=new Map,y=new Map,_=new Map,k=u?new Set:null,A=u?new Set:null,V=new Map;ia=function(M,U,ie,X){V.set(F(M),{size:U,dc:Array.from(new Uint32Array(ee.buffer,X,ie))})},n.createModule=function(M,U,ie,X){u&&(ie.handleAsync=Iu);const se=f.size;return f.set(se,{module:ie,Xb:X}),X=0,ie.xCreate&&(X|=1),ie.xConnect&&(X|=2),ie.xBestIndex&&(X|=4),ie.xDisconnect&&(X|=8),ie.xDestroy&&(X|=16),ie.xOpen&&(X|=32),ie.xClose&&(X|=64),ie.xFilter&&(X|=128),ie.xNext&&(X|=256),ie.xEof&&(X|=512),ie.xColumn&&(X|=1024),ie.xRowid&&(X|=2048),ie.xUpdate&&(X|=4096),ie.xBegin&&(X|=8192),ie.xSync&&(X|=16384),ie.xCommit&&(X|=32768),ie.xRollback&&(X|=65536),ie.xFindFunction&&(X|=131072),ie.xRename&&(X|=262144),Bn("create_module","number",["number","string","number","number"],[M,U,se,X])},Ms=function(M,U,ie,X,se,Ae){if(U=f.get(U),y.set(se,U),u){k.delete(se);for(const Ge of k)y.delete(Ge)}return X=Array.from(new Uint32Array(ee.buffer,X,ie)).map(Ge=>F(Ge)),U.module.xCreate(M,U.Xb,X,se,s("Int32",Ae))},Gn=function(M,U,ie,X,se,Ae){if(U=f.get(U),y.set(se,U),u){k.delete(se);for(const Ge of k)y.delete(Ge)}return X=Array.from(new Uint32Array(ee.buffer,X,ie)).map(Ge=>F(Ge)),U.module.xConnect(M,U.Xb,X,se,s("Int32",Ae))},ea=function(M,U){var ie=y.get(M),X=V.get("sqlite3_index_info").dc;const se={};se.nConstraint=Ke(U+X[0],"i32"),se.aConstraint=[];for(var Ae=Ke(U+X[1],"*"),Ge=V.get("sqlite3_index_constraint").size,At=0;At>=2,_e[A]+_e[A+1]*2**32}const f=typeof Au=="object",y=new Map,_=new Map;n.registerVFS=function(A,V){if(Bn("sqlite3_vfs_find","number",["string"],[A.name]))throw Error(`VFS '${A.name}' already registered`);f&&(A.handleAsync=Iu);var M=A.Vc??64;const U=n._malloc(4);return V=Bn("register_vfs","number",["string","number","number","number"],[A.name,M,V?1:0,U]),V||(M=Ke(U,"*"),y.set(M,A)),n._free(U),V};const k=f?new Set:null;sa=function(A){const V=_.get(A);return f?k.add(A):_.delete(A),V.xClose(A)},Q=function(A,V,M,U){return _.get(A).xRead(A,ee.subarray(V,V+M),u(U))},Pn=function(A,V,M,U){return _.get(A).xWrite(A,ee.subarray(V,V+M),u(U))},De=function(A,V){return _.get(A).xTruncate(A,u(V))},Pe=function(A,V){return _.get(A).xSync(A,V)},g=function(A,V){const M=_.get(A);return V=s("BigInt64",V),M.xFileSize(A,V)},E=function(A,V){return _.get(A).xLock(A,V)},ct=function(A,V){return _.get(A).xUnlock(A,V)},Ui=function(A,V){const M=_.get(A);return V=s("Int32",V),M.xCheckReservedLock(A,V)},h=function(A,V,M){const U=_.get(A);return M=new DataView(ee.buffer,M),U.xFileControl(A,V,M)},ve=function(A){return _.get(A).xSectorSize(A)},c=function(A){return _.get(A).xDeviceCharacteristics(A)},L=function(A,V,M,U,ie){if(A=y.get(A),_.set(M,A),f){k.delete(M);for(var X of k)_.delete(X)}if(X=null,U&64){X=1;const se=[];for(;X;){const Ae=ee[V++];if(Ae)se.push(Ae);else switch(ee[V]||(X=null),X){case 1:se.push(63),X=2;break;case 2:se.push(61),X=3;break;case 3:se.push(38),X=2}}X=new TextDecoder().decode(new Uint8Array(se))}else V&&(X=F(V));return ie=s("Int32",ie),A.xOpen(X,M,U,ie)},o=function(A,V,M){return y.get(A).xDelete(F(V),M)},Xn=function(A,V,M,U){return A=y.get(A),U=s("Int32",U),A.xAccess(F(V),M,U)}}();var Al={a:function(s,u,f,y){ut("Assertion failed: "+F(s)+", at: "+[u?F(u):"unknown filename",f,y?F(y):"unknown function"])},K:function(s,u){try{return s=F(s),Ts(s,u),0}catch(f){if(typeof He>"u"||f.name!=="ErrnoError")throw f;return-f.Ob}},M:function(s,u,f){try{if(u=F(u),u=gr(s,u),f&-8)return-28;var y=Xt(u,{Yb:!0}).node;return y?(s="",f&4&&(s+="r"),f&2&&(s+="w"),f&1&&(s+="x"),s&&Tr(y,s)?-2:0):-44}catch(_){if(typeof He>"u"||_.name!=="ErrnoError")throw _;return-_.Ob}},L:function(s,u){try{var f=Gt[s];if(!f)throw new Z(8);return Ts(f.node,u),0}catch(y){if(typeof He>"u"||y.name!=="ErrnoError")throw y;return-y.Ob}},J:function(s){try{var u=Gt[s];if(!u)throw new Z(8);var f=u.node,y=typeof f=="string"?Xt(f,{Yb:!0}).node:f;if(!y.Cb.Qb)throw new Z(63);return y.Cb.Qb(y,{timestamp:Date.now()}),0}catch(_){if(typeof He>"u"||_.name!=="ErrnoError")throw _;return-_.Ob}},b:function(s,u,f){Si=f;try{var y=mn(s);switch(u){case 0:var _=ki();return 0>_?-28:Vo(y,_).Wb;case 1:case 2:return 0;case 3:return y.flags;case 4:return _=ki(),y.flags|=_,0;case 5:return _=ki(),Ne[_+0>>1]=2,0;case 6:case 7:return 0;case 16:case 8:return-28;case 9:return ae[ca()>>2]=28,-1;default:return-28}}catch(k){if(typeof He>"u"||k.name!=="ErrnoError")throw k;return-k.Ob}},I:function(s,u){try{var f=mn(s);return ks(an,f.path,u)}catch(y){if(typeof He>"u"||y.name!=="ErrnoError")throw y;return-y.Ob}},j:function(s,u,f){try{if(u=f+2097152>>>0<4194305-!!u?(u>>>0)+4294967296*f:NaN,isNaN(u))return-61;var y=Gt[s];if(!y)throw new Z(8);if(!(y.flags&2097155))throw new Z(28);return Go(y.node,u),0}catch(_){if(typeof He>"u"||_.name!=="ErrnoError")throw _;return-_.Ob}},C:function(s,u){try{if(u===0)return-28;var f=oe("/")+1;return u"u"||y.name!=="ErrnoError")throw y;return-y.Ob}},F:function(s,u){try{return s=F(s),ks(Ii,s,u)}catch(f){if(typeof He>"u"||f.name!=="ErrnoError")throw f;return-f.Ob}},z:function(s,u,f){try{return u=F(u),u=gr(s,u),u=Y(u),u[u.length-1]==="/"&&(u=u.substr(0,u.length-1)),qn(u,f),0}catch(y){if(typeof He>"u"||y.name!=="ErrnoError")throw y;return-y.Ob}},E:function(s,u,f,y){try{u=F(u);var _=y&256;return u=gr(s,u,y&4096),ks(_?Ii:an,u,f)}catch(k){if(typeof He>"u"||k.name!=="ErrnoError")throw k;return-k.Ob}},u:function(s,u,f,y){Si=y;try{u=F(u),u=gr(s,u);var _=y?ki():0;return Ai(u,f,_).Wb}catch(k){if(typeof He>"u"||k.name!=="ErrnoError")throw k;return-k.Ob}},s:function(s,u,f,y){try{if(u=F(u),u=gr(s,u),0>=y)return-28;var _=Wi(u),k=Math.min(y,oe(_)),A=T[f+k];return Ln(_,f,y+1),T[f+k]=A,k}catch(V){if(typeof He>"u"||V.name!=="ErrnoError")throw V;return-V.Ob}},r:function(s){try{return s=F(s),Jo(s),0}catch(u){if(typeof He>"u"||u.name!=="ErrnoError")throw u;return-u.Ob}},H:function(s,u){try{return s=F(s),ks(an,s,u)}catch(f){if(typeof He>"u"||f.name!=="ErrnoError")throw f;return-f.Ob}},o:function(s,u,f){try{if(u=F(u),u=gr(s,u),f===0){s=u;var y=Xt(s,{parent:!0}).node;if(!y)throw new Z(44);var _=z(s),k=Kn(y,_),A=Ho(y,_,!1);if(A)throw new Z(A);if(!y.Cb.oc)throw new Z(63);if(k.$b)throw new Z(10);y.Cb.oc(y,_),H(k)}else f===512?Jo(u):ut("Invalid flags passed to unlinkat");return 0}catch(V){if(typeof He>"u"||V.name!=="ErrnoError")throw V;return-V.Ob}},n:function(s,u,f){try{if(u=F(u),u=gr(s,u,!0),f){var y=Ri(f),_=ae[f+8>>2];k=1e3*y+_/1e6,f+=16,y=Ri(f),_=ae[f+8>>2],A=1e3*y+_/1e6}else var k=Date.now(),A=k;s=k;var V=Xt(u,{Yb:!0}).node;return V.Cb.Qb(V,{timestamp:Math.max(s,A)}),0}catch(M){if(typeof He>"u"||M.name!=="ErrnoError")throw M;return-M.Ob}},y:function(s,u){s=new Date(1e3*Ri(s)),ae[u>>2]=s.getSeconds(),ae[u+4>>2]=s.getMinutes(),ae[u+8>>2]=s.getHours(),ae[u+12>>2]=s.getDate(),ae[u+16>>2]=s.getMonth(),ae[u+20>>2]=s.getFullYear()-1900,ae[u+24>>2]=s.getDay();var f=s.getFullYear();ae[u+28>>2]=(f%4!==0||f%100===0&&f%400!==0?Di:Je)[s.getMonth()]+s.getDate()-1|0,ae[u+36>>2]=-(60*s.getTimezoneOffset()),f=new Date(s.getFullYear(),6,1).getTimezoneOffset();var y=new Date(s.getFullYear(),0,1).getTimezoneOffset();ae[u+32>>2]=(f!=y&&s.getTimezoneOffset()==Math.min(y,f))|0},w:function(s,u,f,y,_,k,A){try{var V=mn(y);if(u&2&&!(f&2)&&(V.flags&2097155)!==2)throw new Z(2);if((V.flags&2097155)===1)throw new Z(2);if(!V.Mb.kc)throw new Z(43);var M=V.Mb.kc(V,s,_,u,f),U=M.Pc;return ae[k>>2]=M.Dc,_e[A>>2]=U,0}catch(ie){if(typeof He>"u"||ie.name!=="ErrnoError")throw ie;return-ie.Ob}},x:function(s,u,f,y,_,k){try{var A=mn(_);if(f&2){if((A.node.mode&61440)!==32768)throw new Z(43);y&2||A.Mb.lc&&A.Mb.lc(A,ee.slice(s,s+u),k,u,y)}}catch(V){if(typeof He>"u"||V.name!=="ErrnoError")throw V;return-V.Ob}},p:function(s,u,f){function y(M){return(M=M.toTimeString().match(/\(([A-Za-z ]+)\)$/))?M[1]:"GMT"}var _=new Date().getFullYear(),k=new Date(_,0,1),A=new Date(_,6,1);_=k.getTimezoneOffset();var V=A.getTimezoneOffset();_e[s>>2]=60*Math.max(_,V),ae[u>>2]=+(_!=V),s=y(k),u=y(A),s=Li(s),u=Li(u),V<_?(_e[f>>2]=s,_e[f+4>>2]=u):(_e[f>>2]=u,_e[f+4>>2]=s)},e:function(){return Date.now()},d:()=>performance.now(),l:function(s){var u=ee.length;if(s>>>=0,2147483648=f;f*=2){var y=u*(1+.2/f);y=Math.min(y,s+100663296);var _=Math,k=_.min;y=Math.max(s,y),y+=(65536-y%65536)%65536;e:{var A=C.buffer;try{C.grow(k.call(_,2147483648,y)-A.byteLength+65535>>>16),ze();var V=1;break e}catch{}V=void 0}if(V)return!0}return!1},A:function(s,u){var f=0;return Pi().forEach(function(y,_){var k=u+f;for(_=_e[s+4*_>>2]=k,k=0;k>0]=y.charCodeAt(k);T[_>>0]=0,f+=y.length+1}),0},B:function(s,u){var f=Pi();_e[s>>2]=f.length;var y=0;return f.forEach(function(_){y+=_.length+1}),_e[u>>2]=y,0},f:function(s){try{var u=mn(s);if(u.Wb===null)throw new Z(8);u.pc&&(u.pc=null);try{u.Mb.close&&u.Mb.close(u)}catch(f){throw f}finally{Gt[u.Wb]=null}return u.Wb=null,0}catch(f){if(typeof He>"u"||f.name!=="ErrnoError")throw f;return f.Ob}},m:function(s,u){try{var f=mn(s);return T[u>>0]=f.Sb?2:(f.mode&61440)===16384?3:(f.mode&61440)===40960?7:4,Ne[u+2>>1]=0,Me=[0,(fe=0,1<=+Math.abs(fe)?0>>0:~~+Math.ceil((fe-+(~~fe>>>0))/4294967296)>>>0:0)],ae[u+8>>2]=Me[0],ae[u+12>>2]=Me[1],Me=[0,(fe=0,1<=+Math.abs(fe)?0>>0:~~+Math.ceil((fe-+(~~fe>>>0))/4294967296)>>>0:0)],ae[u+16>>2]=Me[0],ae[u+20>>2]=Me[1],0}catch(y){if(typeof He>"u"||y.name!=="ErrnoError")throw y;return y.Ob}},t:function(s,u,f,y){try{e:{var _=mn(s);s=u;for(var k,A=u=0;A>2],M=_e[s+4>>2];s+=8;var U=_,ie=V,X=M,se=k,Ae=T;if(0>X||0>se)throw new Z(28);if(U.Wb===null)throw new Z(8);if((U.flags&2097155)===1)throw new Z(8);if((U.node.mode&61440)===16384)throw new Z(31);if(!U.Mb.read)throw new Z(28);var Ge=typeof se<"u";if(!Ge)se=U.position;else if(!U.seekable)throw new Z(70);var At=U.Mb.read(U,Ae,ie,X,se);Ge||(U.position+=At);var vt=At;if(0>vt){var wn=-1;break e}if(u+=vt,vt>2]=wn,0}catch(Ft){if(typeof He>"u"||Ft.name!=="ErrnoError")throw Ft;return Ft.Ob}},i:function(s,u,f,y,_){try{if(u=f+2097152>>>0<4194305-!!u?(u>>>0)+4294967296*f:NaN,isNaN(u))return 61;var k=mn(s);return Xo(k,u,y),Me=[k.position>>>0,(fe=k.position,1<=+Math.abs(fe)?0>>0:~~+Math.ceil((fe-+(~~fe>>>0))/4294967296)>>>0:0)],ae[_>>2]=Me[0],ae[_+4>>2]=Me[1],k.pc&&u===0&&y===0&&(k.pc=null),0}catch(A){if(typeof He>"u"||A.name!=="ErrnoError")throw A;return A.Ob}},D:function(s){try{var u=mn(s);return Wu(function(f){var y=u.node.Ub;y.type.Sc?y.type.Sc(y,!1,function(_){f(_?function(){return 29}:0)}):f(0)})}catch(f){if(typeof He>"u"||f.name!=="ErrnoError")throw f;return f.Ob}},q:function(s,u,f,y){try{e:{var _=mn(s);s=u;for(var k,A=u=0;A>2],M=_e[s+4>>2];s+=8;var U=_,ie=V,X=M,se=k,Ae=T;if(0>X||0>se)throw new Z(28);if(U.Wb===null)throw new Z(8);if(!(U.flags&2097155))throw new Z(8);if((U.node.mode&61440)===16384)throw new Z(31);if(!U.Mb.write)throw new Z(28);U.seekable&&U.flags&1024&&Xo(U,0,2);var Ge=typeof se<"u";if(!Ge)se=U.position;else if(!U.seekable)throw new Z(70);var At=U.Mb.write(U,Ae,ie,X,se,void 0);Ge||(U.position+=At);var vt=At;if(0>vt){var wn=-1;break e}u+=vt,typeof k<"u"&&(k+=vt)}wn=u}return _e[y>>2]=wn,0}catch(Ft){if(typeof He>"u"||Ft.name!=="ErrnoError")throw Ft;return Ft.Ob}},ra:Mi,N:yn,ga:Rs,ca:Zo,Y:vu,la:Ds,G:ea,h:Ls,oa:ta,ja:Ps,ea:Gn,fa:Ms,k:Bs,v:Yr,pa:Fs,g:_u,qa:na,da:xu,ha:ra,ia:Bi,na:Fi,c:ia,ka:Zr,ma:ei,aa:Xn,V:Ui,$:sa,ba:o,S:c,U:h,Z:g,X:E,R:L,Q,T:ve,_:Pe,O:De,W:ct,P:Pn};(function(){function s(f){if(f=f.exports,f=Ol(f),n.asm=f,C=n.asm.sa,ze(),Wt.unshift(n.asm.ta),ge--,n.monitorRunDependencies&&n.monitorRunDependencies(ge),ge==0&&Oe){var y=Oe;Oe=null,y()}return f}var u={a:Al};if(ge++,n.monitorRunDependencies&&n.monitorRunDependencies(ge),n.instantiateWasm)try{return n.instantiateWasm(u,s)}catch(f){ne("Module.instantiateWasm callback failed with error: "+f),a(f)}return pn(u,function(f){s(f.instance)}).catch(a),{}})(),n._sqlite3_vfs_find=function(){return(n._sqlite3_vfs_find=n.asm.ua).apply(null,arguments)},n._sqlite3_malloc=function(){return(n._sqlite3_malloc=n.asm.va).apply(null,arguments)},n._sqlite3_free=function(){return(n._sqlite3_free=n.asm.wa).apply(null,arguments)},n._sqlite3_prepare_v2=function(){return(n._sqlite3_prepare_v2=n.asm.xa).apply(null,arguments)},n._sqlite3_step=function(){return(n._sqlite3_step=n.asm.ya).apply(null,arguments)},n._sqlite3_column_int64=function(){return(n._sqlite3_column_int64=n.asm.za).apply(null,arguments)},n._sqlite3_column_int=function(){return(n._sqlite3_column_int=n.asm.Aa).apply(null,arguments)},n._sqlite3_finalize=function(){return(n._sqlite3_finalize=n.asm.Ba).apply(null,arguments)},n._sqlite3_reset=function(){return(n._sqlite3_reset=n.asm.Ca).apply(null,arguments)},n._sqlite3_clear_bindings=function(){return(n._sqlite3_clear_bindings=n.asm.Da).apply(null,arguments)},n._sqlite3_value_blob=function(){return(n._sqlite3_value_blob=n.asm.Ea).apply(null,arguments)},n._sqlite3_value_text=function(){return(n._sqlite3_value_text=n.asm.Fa).apply(null,arguments)},n._sqlite3_value_bytes=function(){return(n._sqlite3_value_bytes=n.asm.Ga).apply(null,arguments)},n._sqlite3_value_double=function(){return(n._sqlite3_value_double=n.asm.Ha).apply(null,arguments)},n._sqlite3_value_int=function(){return(n._sqlite3_value_int=n.asm.Ia).apply(null,arguments)},n._sqlite3_value_int64=function(){return(n._sqlite3_value_int64=n.asm.Ja).apply(null,arguments)},n._sqlite3_value_type=function(){return(n._sqlite3_value_type=n.asm.Ka).apply(null,arguments)},n._sqlite3_result_blob=function(){return(n._sqlite3_result_blob=n.asm.La).apply(null,arguments)},n._sqlite3_result_double=function(){return(n._sqlite3_result_double=n.asm.Ma).apply(null,arguments)},n._sqlite3_result_error=function(){return(n._sqlite3_result_error=n.asm.Na).apply(null,arguments)},n._sqlite3_result_int=function(){return(n._sqlite3_result_int=n.asm.Oa).apply(null,arguments)},n._sqlite3_result_int64=function(){return(n._sqlite3_result_int64=n.asm.Pa).apply(null,arguments)},n._sqlite3_result_null=function(){return(n._sqlite3_result_null=n.asm.Qa).apply(null,arguments)},n._sqlite3_result_text=function(){return(n._sqlite3_result_text=n.asm.Ra).apply(null,arguments)},n._sqlite3_column_count=function(){return(n._sqlite3_column_count=n.asm.Sa).apply(null,arguments)},n._sqlite3_data_count=function(){return(n._sqlite3_data_count=n.asm.Ta).apply(null,arguments)},n._sqlite3_column_blob=function(){return(n._sqlite3_column_blob=n.asm.Ua).apply(null,arguments)},n._sqlite3_column_bytes=function(){return(n._sqlite3_column_bytes=n.asm.Va).apply(null,arguments)},n._sqlite3_column_double=function(){return(n._sqlite3_column_double=n.asm.Wa).apply(null,arguments)},n._sqlite3_column_text=function(){return(n._sqlite3_column_text=n.asm.Xa).apply(null,arguments)},n._sqlite3_column_type=function(){return(n._sqlite3_column_type=n.asm.Ya).apply(null,arguments)},n._sqlite3_column_name=function(){return(n._sqlite3_column_name=n.asm.Za).apply(null,arguments)},n._sqlite3_bind_blob=function(){return(n._sqlite3_bind_blob=n.asm._a).apply(null,arguments)},n._sqlite3_bind_double=function(){return(n._sqlite3_bind_double=n.asm.$a).apply(null,arguments)},n._sqlite3_bind_int=function(){return(n._sqlite3_bind_int=n.asm.ab).apply(null,arguments)},n._sqlite3_bind_int64=function(){return(n._sqlite3_bind_int64=n.asm.bb).apply(null,arguments)},n._sqlite3_bind_null=function(){return(n._sqlite3_bind_null=n.asm.cb).apply(null,arguments)},n._sqlite3_bind_text=function(){return(n._sqlite3_bind_text=n.asm.db).apply(null,arguments)},n._sqlite3_bind_parameter_count=function(){return(n._sqlite3_bind_parameter_count=n.asm.eb).apply(null,arguments)},n._sqlite3_bind_parameter_name=function(){return(n._sqlite3_bind_parameter_name=n.asm.fb).apply(null,arguments)},n._sqlite3_sql=function(){return(n._sqlite3_sql=n.asm.gb).apply(null,arguments)},n._sqlite3_exec=function(){return(n._sqlite3_exec=n.asm.hb).apply(null,arguments)},n._sqlite3_errmsg=function(){return(n._sqlite3_errmsg=n.asm.ib).apply(null,arguments)},n._sqlite3_declare_vtab=function(){return(n._sqlite3_declare_vtab=n.asm.jb).apply(null,arguments)},n._sqlite3_libversion=function(){return(n._sqlite3_libversion=n.asm.kb).apply(null,arguments)},n._sqlite3_libversion_number=function(){return(n._sqlite3_libversion_number=n.asm.lb).apply(null,arguments)},n._sqlite3_changes=function(){return(n._sqlite3_changes=n.asm.mb).apply(null,arguments)},n._sqlite3_close=function(){return(n._sqlite3_close=n.asm.nb).apply(null,arguments)},n._sqlite3_limit=function(){return(n._sqlite3_limit=n.asm.ob).apply(null,arguments)},n._sqlite3_open_v2=function(){return(n._sqlite3_open_v2=n.asm.pb).apply(null,arguments)},n._sqlite3_get_autocommit=function(){return(n._sqlite3_get_autocommit=n.asm.qb).apply(null,arguments)};function ca(){return(ca=n.asm.rb).apply(null,arguments)}var la=n._malloc=function(){return(la=n._malloc=n.asm.sb).apply(null,arguments)},Su=n._free=function(){return(Su=n._free=n.asm.tb).apply(null,arguments)};n._RegisterExtensionFunctions=function(){return(n._RegisterExtensionFunctions=n.asm.ub).apply(null,arguments)},n._set_authorizer=function(){return(n._set_authorizer=n.asm.vb).apply(null,arguments)},n._create_function=function(){return(n._create_function=n.asm.wb).apply(null,arguments)},n._create_module=function(){return(n._create_module=n.asm.xb).apply(null,arguments)},n._progress_handler=function(){return(n._progress_handler=n.asm.yb).apply(null,arguments)},n._register_vfs=function(){return(n._register_vfs=n.asm.zb).apply(null,arguments)},n._getSqliteFree=function(){return(n._getSqliteFree=n.asm.Ab).apply(null,arguments)};var ku=n._main=function(){return(ku=n._main=n.asm.Bb).apply(null,arguments)};function Ru(){return(Ru=n.asm.Db).apply(null,arguments)}function Du(){return(Du=n.asm.Eb).apply(null,arguments)}function Lu(){return(Lu=n.asm.Fb).apply(null,arguments)}function fa(){return(fa=n.asm.Gb).apply(null,arguments)}function ha(){return(ha=n.asm.Hb).apply(null,arguments)}function Pu(){return(Pu=n.asm.Ib).apply(null,arguments)}function Mu(){return(Mu=n.asm.Jb).apply(null,arguments)}function Qi(){return(Qi=n.asm.Kb).apply(null,arguments)}function da(){return(da=n.asm.Lb).apply(null,arguments)}n.getTempRet0=Du,n.ccall=Bn,n.cwrap=function(s,u,f,y){var _=!f||f.every(k=>k==="number"||k==="boolean");return u!=="string"&&_&&!y?n["_"+s]:function(){return Bn(s,u,f,arguments,y)}},n.setValue=x,n.getValue=Ke,n.UTF8ToString=F,n.stringToUTF8=Ln,n.lengthBytesUTF8=oe;var $s;Oe=function s(){$s||I(),$s||(Oe=s)};function I(){function s(){if(!$s&&($s=!0,n.calledRun=!0,!N)){if(n.noFSInit||Yo||(Yo=!0,Kr(),n.stdin=n.stdin,n.stdout=n.stdout,n.stderr=n.stderr,n.stdin?Jr("stdin",n.stdin):qi("/dev/tty","/dev/stdin"),n.stdout?Jr("stdout",null,n.stdout):qi("/dev/tty","/dev/stdout"),n.stderr?Jr("stderr",null,n.stderr):qi("/dev/tty1","/dev/stderr"),Ai("/dev/stdin",0),Ai("/dev/stdout",1),Ai("/dev/stderr",1)),Mt=!1,Jt(Wt),Jt(Qe),i(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),G){var u=ku;try{var f=u(0,0);q=f,oa(f)}catch(y){aa(y)}}if(n.postRun)for(typeof n.postRun=="function"&&(n.postRun=[n.postRun]);n.postRun.length;)u=n.postRun.shift(),Kt.unshift(u);Jt(Kt)}}if(!(0{try{await navigator.locks.request(e,n,l=>{if(i(l),l)return new Promise(m=>r(this,Wo).set(e,m))})}catch(l){a(l)}})}_releaseWebLock(e){var n;(n=r(this,Wo).get(e))==null||n(),r(this,Wo).delete(e)}async _pollWebLock(e){var i;return(i=(await navigator.locks.query()).held.find(({name:a})=>a===e))==null?void 0:i.mode}_getTimeoutSignal(){if(this.timeoutMillis){const e=new AbortController;return setTimeout(()=>e.abort(),this.timeoutMillis),e.signal}}}jt=new WeakMap,Wo=new WeakMap,cu=new WeakMap,lu=new WeakSet,wf=async function(e,n){const i=n&PN;try{const a=()=>e.call(this,i);return await P(this,cu,r(this,cu).then(a,a)),P(this,jt,i),Ve}catch(a){return a.name==="AbortError"?vN:(console.error(a),EN)}},Zc=new WeakSet,vm=async function(e){if(e===r(this,jt))return Ve;switch(r(this,jt)){case Vs:switch(e){case Yi:return this._NONEtoSHARED();default:throw new Error(`unexpected transition ${r(this,jt)} -> ${e}`)}case Yi:switch(e){case ic:return this._SHAREDtoRESERVED();case sc:return this._SHAREDtoEXCLUSIVE();default:throw new Error(`unexpected transition ${r(this,jt)} -> ${e}`)}case ic:switch(e){case sc:return this._RESERVEDtoEXCLUSIVE();default:throw new Error(`unexpected transition ${r(this,jt)} -> ${e}`)}default:throw new Error(`unexpected transition ${r(this,jt)} -> ${e}`)}},el=new WeakSet,_m=async function(e){if(e===r(this,jt))return Ve;switch(r(this,jt)){case sc:switch(e){case Yi:return this._EXCLUSIVEtoSHARED();case Vs:return this._EXCLUSIVEtoNONE();default:throw new Error(`unexpected transition ${r(this,jt)} -> ${e}`)}case ic:switch(e){case Yi:return this._RESERVEDtoSHARED();case Vs:return this._RESERVEDtoNONE();default:throw new Error(`unexpected transition ${r(this,jt)} -> ${e}`)}case Yi:switch(e){case Vs:return this._SHAREDtoNONE();default:throw new Error(`unexpected transition ${r(this,jt)} -> ${e}`)}default:throw new Error(`unexpected transition ${r(this,jt)} -> ${e}`)}};class BN extends MN{constructor(e){super(),this._lockName=e+"-outer",this._reservedName=e+"-reserved"}async isSomewhereReserved(){return await this._pollWebLock(this._reservedName)==="exclusive"}async _NONEtoSHARED(){await this._acquireWebLock(this._lockName,{mode:"exclusive",signal:this._getTimeoutSignal()})}async _SHAREDtoRESERVED(){await this._acquireWebLock(this._reservedName,{mode:"exclusive",signal:this._getTimeoutSignal()})}async _RESERVEDtoSHARED(){this._releaseWebLock(this._reservedName)}async _SHAREDtoNONE(){this._releaseWebLock(this._lockName)}}const FN=5e3;let UN=0;const Ql=new WeakMap;function vr(...t){}var Io,Ao,fu,Rt,hu,To,ys,tl,xm;class $N{constructor(e,n={durability:"default"}){S(this,tl);S(this,Io,void 0);S(this,Ao,void 0);S(this,fu,void 0);S(this,Rt,null);S(this,hu,0);S(this,To,Promise.resolve());S(this,ys,Promise.resolve());P(this,Ao,Promise.resolve(e).then(i=>P(this,Io,i))),P(this,fu,n)}async close(){const e=r(this,Io)??await r(this,Ao);await r(this,To),await this.sync(),e.close()}async run(e,n){const i=r(this,To).then(()=>qe(this,tl,xm).call(this,e,n));return P(this,To,i.catch(()=>{})),i}async sync(){await r(this,ys),P(this,ys,Promise.resolve())}}Io=new WeakMap,Ao=new WeakMap,fu=new WeakMap,Rt=new WeakMap,hu=new WeakMap,To=new WeakMap,ys=new WeakMap,tl=new WeakSet,xm=async function(e,n){var a,l;const i=r(this,Io)??await r(this,Ao);if(e==="readwrite"&&((a=r(this,Rt))==null?void 0:a.mode)==="readonly")P(this,Rt,null);else if(performance.now()-r(this,hu)>FN){try{(l=r(this,Rt))==null||l.commit()}catch(m){if(m.name!=="InvalidStateError")throw m}await new Promise(m=>setTimeout(m)),P(this,Rt,null)}for(let m=0;m<2;++m){if(!r(this,Rt)){P(this,Rt,i.transaction(i.objectStoreNames,e,r(this,fu)));const w=P(this,hu,performance.now());P(this,ys,r(this,ys).then(()=>new Promise((v,d)=>{r(this,Rt).addEventListener("complete",W=>{v(),r(this,Rt)===W.target&&P(this,Rt,null),vr(`transaction ${Ql.get(W.target)} complete`)}),r(this,Rt).addEventListener("abort",W=>{console.warn("tx abort",(performance.now()-w)/1e3);const B=W.target.error;d(B),r(this,Rt)===W.target&&P(this,Rt,null),vr(`transaction ${Ql.get(W.target)} aborted`,B)})}))),Ql.set(r(this,Rt),UN++)}try{const w=Object.fromEntries(Array.from(i.objectStoreNames,v=>[v,new QN(r(this,Rt).objectStore(v))]));return await n(w)}catch(w){if(P(this,Rt,null),m)throw w}}};function ii(t){return new Promise((e,n)=>{t.addEventListener("success",()=>e(t.result)),t.addEventListener("error",()=>n(t.error))})}var It;class QN{constructor(e){S(this,It,void 0);P(this,It,e)}get(e){vr(`get ${r(this,It).name}`,e);const n=r(this,It).get(e);return ii(n)}getAll(e,n){vr(`getAll ${r(this,It).name}`,e,n);const i=r(this,It).getAll(e,n);return ii(i)}getKey(e){vr(`getKey ${r(this,It).name}`,e);const n=r(this,It).getKey(e);return ii(n)}getAllKeys(e,n){vr(`getAllKeys ${r(this,It).name}`,e,n);const i=r(this,It).getAllKeys(e,n);return ii(i)}put(e,n){vr(`put ${r(this,It).name}`,e,n);const i=r(this,It).put(e,n);return ii(i)}delete(e){vr(`delete ${r(this,It).name}`,e);const n=r(this,It).delete(e);return ii(n)}clear(){vr(`clear ${r(this,It).name}`);const e=r(this,It).clear();return ii(e)}index(e){return new jN(r(this,It).index(e))}}It=new WeakMap;var ws;class jN{constructor(e){S(this,ws,void 0);P(this,ws,e)}getAllKeys(e,n){vr(`IDBIndex.getAllKeys ${r(this,ws).objectStore.name}<${r(this,ws).name}>`,e,n);const i=r(this,ws).getAllKeys(e,n);return ii(i)}}ws=new WeakMap;const HN=512,rd=3e3,id={durability:"default",purge:"deferred",purgeAtLeast:16};function gn(...t){}var yi,Ht,pt,gs,bs,Mr,du,gf,nl,Em,rl,Cm,wi,zs,il,Om;class VN extends LN{constructor(n="wa-sqlite",i=id){super();S(this,du);S(this,nl);S(this,rl);S(this,wi);S(this,il);S(this,yi,void 0);S(this,Ht,new Map);S(this,pt,void 0);S(this,gs,new Set);S(this,bs,performance.now());S(this,Mr,new Set);this.name=n,P(this,yi,Object.assign({},id,i)),P(this,pt,new $N(zN(n),{durability:r(this,yi).durability}))}async close(){var n;for(const i of r(this,Ht).keys())await this.xClose(i);await((n=r(this,pt))==null?void 0:n.close()),P(this,pt,null)}xOpen(n,i,a,l){return this.handleAsync(async()=>{n===null&&(n=`null_${i}`),gn(`xOpen ${n} 0x${i.toString(16)} 0x${a.toString(16)}`);try{const m=new URL(n,"http://localhost/"),w={path:m.pathname,flags:a,block0:null,locks:new BN(m.pathname)};return r(this,Ht).set(i,w),await r(this,pt).run("readwrite",async({blocks:v})=>{if(w.block0=await v.get(qe(this,wi,zs).call(this,w,0)),!w.block0)if(a&Nm)w.block0={path:w.path,offset:0,version:0,data:new Uint8Array(0),fileSize:0},v.put(w.block0);else throw new Error(`file not found: ${w.path}`)}),l.setInt32(0,a&ON,!0),Ve}catch(m){return console.error(m),bm}})}xClose(n){return this.handleAsync(async()=>{try{const i=r(this,Ht).get(n);return i&&(gn(`xClose ${i.path}`),r(this,Ht).delete(n),i.flags&WN&&r(this,pt).run("readwrite",({blocks:a})=>{a.delete(IDBKeyRange.bound([i.path],[i.path,[]]))})),Ve}catch(i){return console.error(i),xt}})}xRead(n,i,a){return this.handleAsync(async()=>{const l=r(this,Ht).get(n);gn(`xRead ${l.path} ${i.byteLength} ${a}`);try{return await r(this,pt).run("readonly",async({blocks:w})=>{let v=0;for(;vrd){const m=this.handleAsync(async()=>{this.handleAsync!==super.handleAsync&&r(this,Mr).add(n),await new Promise(v=>setTimeout(v));const w=qe(this,du,gf).call(this,n,i,a);return P(this,bs,performance.now()),w});return l&&r(this,Mr).delete(n),m}return qe(this,du,gf).call(this,n,i,a)}xTruncate(n,i){const a=r(this,Ht).get(n);gn(`xTruncate ${a.path} ${i}`);try{Object.assign(a.block0,{fileSize:i,data:a.block0.data.slice(0,i)});const l=Object.assign({},a.block0);return r(this,pt).run("readwrite",({blocks:m})=>{m.delete(qe(this,wi,zs).call(this,a,-1/0,-i)),m.put(l)}),Ve}catch(l){return console.error(l),xt}}xSync(n,i){const a=r(this,Mr).has(n);if(a||r(this,yi).durability!=="relaxed"||performance.now()-r(this,bs)>rd){const m=this.handleAsync(async()=>{this.handleAsync!==super.handleAsync&&r(this,Mr).add(n);const w=await qe(this,nl,Em).call(this,n,i);return P(this,bs,performance.now()),w});return a&&r(this,Mr).delete(n),m}const l=r(this,Ht).get(n);return gn(`xSync ${l.path} ${i}`),Ve}xFileSize(n,i){const a=r(this,Ht).get(n);return gn(`xFileSize ${a.path}`),i.setBigInt64(0,BigInt(a.block0.fileSize),!0),Ve}xLock(n,i){return this.handleAsync(async()=>{const a=r(this,Ht).get(n);gn(`xLock ${a.path} ${i}`);try{const l=await a.locks.lock(i);return l===Ve&&a.locks.state===Yi&&(a.block0=await r(this,pt).run("readonly",({blocks:m})=>m.get(qe(this,wi,zs).call(this,a,0)))),l}catch(l){return console.error(l),xt}})}xUnlock(n,i){return this.handleAsync(async()=>{const a=r(this,Ht).get(n);gn(`xUnlock ${a.path} ${i}`);try{return a.locks.unlock(i)}catch(l){return console.error(l),xt}})}xCheckReservedLock(n,i){return this.handleAsync(async()=>{const a=r(this,Ht).get(n);gn(`xCheckReservedLock ${a.path}`);const l=await a.locks.isSomewhereReserved();return i.setInt32(0,l?1:0,!0),Ve})}xSectorSize(n){return HN}xDeviceCharacteristics(n){return kN|AN|TN|SN}xFileControl(n,i,a){const l=r(this,Ht).get(n);switch(gn(`xFileControl ${l.path} ${i}`),i){case 11:return l.overwrite=!0,Ve;case 21:if(l.overwrite)try{return this.handleAsync(async()=>(await qe(this,il,Om).call(this,l),Ve))}catch(m){return console.error(m),xt}return Ve;case 22:return l.overwrite=!1,Ve;case 31:return this.handleAsync(async()=>{try{return l.block0.version--,l.changedPages=new Set,r(this,pt).run("readwrite",async({blocks:m})=>{const w=await m.index("version").getAllKeys(IDBKeyRange.bound([l.path],[l.path,l.block0.version]));for(const v of w)m.delete(v)}),Ve}catch(m){return console.error(m),xt}});case 32:try{const m=Object.assign({},l.block0);m.data=m.data.slice();const w=l.changedPages;return l.changedPages=null,r(this,pt).run("readwrite",async({blocks:v})=>{v.put(m);const d=await v.get([l.path,"purge",0])??{path:l.path,offset:"purge",version:0,data:new Map,count:0};d.count+=w.size;for(const W of w)d.data.set(W,m.version);v.put(d),qe(this,rl,Cm).call(this,l.path,d.count)}),Ve}catch(m){return console.error(m),xt}case 33:return this.handleAsync(async()=>{try{return l.changedPages=null,l.block0=await r(this,pt).run("readonly",({blocks:m})=>m.get([l.path,0,l.block0.version+1])),Ve}catch(m){return console.error(m),xt}});default:return gm}}xAccess(n,i,a){return this.handleAsync(async()=>{try{const l=new URL(n,"file://localhost/").pathname;gn(`xAccess ${l} ${i}`);const m=await r(this,pt).run("readonly",({blocks:w})=>w.getKey(qe(this,wi,zs).call(this,{path:l},0)));return a.setInt32(0,m?1:0,!0),Ve}catch(l){return console.error(l),xt}})}xDelete(n,i){return this.handleAsync(async()=>{const a=new URL(n,"file://localhost/").pathname;try{return r(this,pt).run("readwrite",({blocks:l})=>l.delete(IDBKeyRange.bound([a],[a,[]]))),i&&await r(this,pt).sync(),Ve}catch(l){return console.error(l),xt}})}async purge(n){const i=Date.now();await r(this,pt).run("readwrite",async({blocks:a})=>{const l=await a.get([n,"purge",0]);if(l){for(const[m,w]of l.data)a.delete(IDBKeyRange.bound([n,m,w],[n,m,1/0],!0,!1));await a.delete([n,"purge",0])}gn(`purge ${n} ${(l==null?void 0:l.data.size)??0} pages in ${Date.now()-i} ms`)})}}yi=new WeakMap,Ht=new WeakMap,pt=new WeakMap,gs=new WeakMap,bs=new WeakMap,Mr=new WeakMap,du=new WeakSet,gf=function(n,i,a){const l=r(this,Ht).get(n);gn(`xWrite ${l.path} ${i.byteLength} ${a}`);try{const m=l.block0.fileSize;l.block0.fileSize=Math.max(l.block0.fileSize,a+i.byteLength);const w=a===0?l.block0:{path:l.path,offset:-a,version:l.block0.version,data:null};return w.data=i.slice(),l.changedPages?(m===l.block0.fileSize&&l.changedPages.add(-a),a!==0&&r(this,pt).run("readwrite",({blocks:v})=>v.put(w))):r(this,pt).run("readwrite",({blocks:v})=>v.put(w)),Ve}catch(m){return console.error(m),xt}},nl=new WeakSet,Em=async function(n,i){const a=r(this,Ht).get(n);gn(`xSync ${a.path} ${i}`);try{await r(this,pt).sync()}catch(l){return console.error(l),xt}return Ve},rl=new WeakSet,Cm=function(n,i){r(this,yi).purge==="manual"||r(this,gs).has(n)||i{this.purge(n),r(this,gs).delete(n)}):setTimeout(()=>{this.purge(n),r(this,gs).delete(n)}),r(this,gs).add(n))},wi=new WeakSet,zs=function(n,i,a=0){const l=!i||-i{const ne=await D.index("version").getAllKeys(IDBKeyRange.bound([n.path,B+1],[n.path,1/0]));for(const te of ne)D.delete(te);D.delete([n.path,"purge",0]);for(let te=0;te=W)break;const T={path:C.path,offset:q,version:B,data:C.data.subarray(N*l,(N+1)*l)};T.offset===0&&(T.fileSize=W,n.block0=T),D.put(T)}}}})};function zN(t){return new Promise((e,n)=>{const i=globalThis.indexedDB.open(t,5);i.addEventListener("upgradeneeded",function(){i.result.createObjectStore("blocks",{keyPath:["path","offset","version"]}).createIndex("version",["path","version"])}),i.addEventListener("success",()=>{e(i.result)}),i.addEventListener("error",()=>{n(i.error)})})}const KN=""+new URL("wa-sqlite-async-24800831.wasm",import.meta.url).href,JN=new zb({async database(){const t=await DN({locateFile:()=>KN}),e=RN(t),n="wa-sqlite-test";e.vfs_register(new VN(n));const i=await e.open_v2(n,void 0,n);return{sqlite:e,db:i}}});function GN(){console.log("start wa-sqlite test"),Xf(JN).then(t=>{t==null||t.forEach(e=>console.log("[wa-sqlite]",e))})}function XN(t){return{all:t=t||new Map,on:function(e,n){var i=t.get(e);i?i.push(n):t.set(e,[n])},off:function(e,n){var i=t.get(e);i&&(n?i.splice(i.indexOf(n)>>>0,1):t.set(e,[]))},emit:function(e,n){var i=t.get(e);i&&i.slice().map(function(a){a(n)}),(i=t.get("*"))&&i.slice().map(function(a){a(e,n)})}}}var Zi=XN(),Br,ur,pu,yd,YN=(yd=class{constructor(t){S(this,Br,void 0);S(this,ur,void 0);Yt(this,"connection");S(this,pu,new ZN);P(this,Br,t),P(this,ur,r(this,Br).worker??new Worker(new URL(""+new URL("worker-72ad2512.js",import.meta.url).href,self.location),{type:"module"})),r(this,ur).onmessage=n=>{const{type:i,msg:a}=n.data;Zi.emit(i,a)};const e={type:"init",dbName:r(this,Br).dbName,url:r(this,Br).url};r(this,ur).postMessage(e)}async init(){await new Promise((t,e)=>{Zi.on("init",n=>{Zi.off("init");const{err:i}=n;i?e(i):t()})}),this.connection=new e0(r(this,ur)),r(this,Br).onCreateConnection&&await r(this,Br).onCreateConnection(this.connection)}async acquireConnection(){return await r(this,pu).lock(),this.connection}async beginTransaction(t){await t.executeQuery(Qr.raw("begin"))}async commitTransaction(t){await t.executeQuery(Qr.raw("commit"))}async rollbackTransaction(t){await t.executeQuery(Qr.raw("rollback"))}async releaseConnection(){r(this,pu).unlock()}async destroy(){if(r(this,ur))return r(this,ur).postMessage({type:"close"}),new Promise((t,e)=>{Zi.on("close",n=>{Zi.off("close");const{err:i}=n;i?e(i):(r(this,ur).terminate(),P(this,ur,null),t())})})}},Br=new WeakMap,ur=new WeakMap,pu=new WeakMap,yd),Ns,So,wd,ZN=(wd=class{constructor(){S(this,Ns,void 0);S(this,So,void 0)}async lock(){for(;r(this,Ns);)await r(this,Ns);P(this,Ns,new Promise(t=>{P(this,So,t)}))}unlock(){const t=r(this,So);P(this,Ns,void 0),P(this,So,void 0),t==null||t()}},Ns=new WeakMap,So=new WeakMap,wd),mu,gd,e0=(gd=class{constructor(t){S(this,mu,void 0);P(this,mu,t)}streamQuery(){throw new Error("Sqlite driver doesn't support streaming")}async executeQuery(t){const{parameters:e,sql:n,query:i}=t,l={type:"run",isQuery:["SelectQueryNode","RawNode"].includes(i.kind),sql:n,parameters:e};return r(this,mu).postMessage(l),new Promise((m,w)=>{Zi.on("run",v=>{Zi.off("run");const{data:d,err:W}=v;!W&&d?m(d):w(W)})})}},mu=new WeakMap,gd),yu,bd,t0=(bd=class{constructor(t){S(this,yu,void 0);P(this,yu,t)}createDriver(){return new YN(r(this,yu))}createQueryCompiler(){return new lm}createAdapter(){return new dm}createIntrospector(t){return new fm(t)}},yu=new WeakMap,bd);const n0=""+new URL("wa-sqlite-async-24800831.wasm",import.meta.url).href,r0=new t0({dbName:"wa-sqlite-worker-test",url:n0});function i0(){console.log("start wa-sqlite-worker test"),Xf(r0).then(t=>{t==null||t.forEach(e=>console.log("[wa-sqlite-worker]",e))})}const s0=Ct("h1",null,[ka(" test "),Ct("a",{href:"https://github.com/kysely-org/kysely",target:"_blank"},"Kysely"),ka(" WASM dialect ")],-1),o0=Ct("br",null,null,-1),a0=Ct("h3",null,"see worker result in console",-1),u0=Ct("h3",null,[ka(" you can explore "),Ct("a",{href:"https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API#origin_private_file_system",target:"_blank"}," OPFS "),ka(" file using "),Ct("a",{href:"https://chrome.google.com/webstore/detail/opfs-explorer/acndjpgkpaclldomagafnognkcgjignd",target:"_blank"}," opfs-explorer ")],-1),c0=Ct("br",null,null,-1),l0={class:"buttons"},f0=Ct("br",null,null,-1),h0=Ct("div",null," result run in main thread: ",-1),d0=Hy({__name:"App",setup(t){const e=new bN,{result:n,run:i}=gN(),a=new NN;function l(){i()}function m(){e.postMessage("")}function w(){a.postMessage("")}function v(){GN()}function d(){i0()}async function W(){console.clear();const B=await navigator.storage.getDirectory();await zh("sqljs"),await zh("sqlijsWorker"),indexedDB.deleteDatabase("idb-batch-atomic");try{await B.removeEntry("test.db")}catch{}try{await B.removeEntry("test.db-journal")}catch{}console.log("clear all")}return(B,D)=>(Nw(),xw(cr,null,[s0,o0,a0,u0,c0,Ct("div",l0,[Ct("button",{onClick:D[0]||(D[0]=ne=>l())}," test sqljs in main thread "),Ct("button",{onClick:D[1]||(D[1]=ne=>m())}," test sqljs in Worker "),Ct("button",{onClick:D[2]||(D[2]=ne=>w())}," test officialWasm in Worker "),Ct("button",{onClick:D[3]||(D[3]=ne=>v())}," test wa-sqlite in main thread "),Ct("button",{onClick:D[4]||(D[4]=ne=>d())}," test wa-sqlite in Worker "),Ct("button",{onClick:D[5]||(D[5]=ne=>W())}," clear ")]),f0,h0,Ct("pre",null,""+Dm($d(n))+` - `,1)],64))}});ag(d0).mount("#root"); diff --git a/assets/officialWasmWorker-b264d8ca.js b/assets/officialWasmWorker-f13be864.js similarity index 99% rename from assets/officialWasmWorker-b264d8ca.js rename to assets/officialWasmWorker-f13be864.js index b4ae12e..9541966 100644 --- a/assets/officialWasmWorker-b264d8ca.js +++ b/assets/officialWasmWorker-f13be864.js @@ -10,4 +10,4 @@ Total of`,j,"op(s) for",Q,"ms (incl. "+Y+" ms of waiting on the async side)"),i. set ${Wt.ref(n)} = datetime('now','localtime') where ${Wt.ref(A)} = NEW.${Wt.ref(A)}; end - `.execute(t).catch(X=>{console.error(X)})}function sc(t){const e=new Map;for(const r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;const n=t[r];e.set(r,n)}return e}async function oc(t,e,r=!1){for(const[n,A]of e){const{columns:X,property:ae}=A;r&&await t.schema.dropTable(n).ifExists().execute().catch();let me=t.schema.createTable(n),Oe="rowid",At=!1,nt="createAt",rt="updateAt";if(ae!=null&&ae.timestamp&&!ic(ae.timestamp)){const{create:ue,update:Qt}=ae.timestamp;nt=ue??"createAt",rt=Qt??"updateAt"}for(const ue in X){if(!Object.prototype.hasOwnProperty.call(X,ue))continue;const Qt=X[ue];let Qe="text";const{type:gn,notNull:vi,defaultTo:wn}=Qt;switch(gn){case"boolean":case"date":case"object":case"string":Qe="text";break;case"increments":Oe=ue;case"number":Qe="integer";break;case"blob":Qe="blob"}[nt,rt].includes(ue)||(me=me.addColumn(ue,Qe,Et=>gn==="increments"?(At=!0,Et.autoIncrement().primaryKey()):(vi&&(Et=Et.notNull()),wn!==void 0&&(Et=Et.defaultTo(wn instanceof Function?wn(Wt):wn)),Et)))}if(ae){const ue=ae.primary,Qt=ae.unique;if(ae.timestamp&&(nt&&(me=me.addColumn(nt,"text")),rt&&(me=me.addColumn(rt,"text"))),!At&&ue){const Qe=ao(ue);Oe=Qe?ue:ue[0],me=me.addPrimaryKeyConstraint(`pk_${Qe?ue:ue.join("_")}`,Qe?[ue]:ue)}Qt==null||Qt.forEach(Qe=>{const gn=ao(Qe);Oe=!ue&&!At?gn?Qe:Qe[0]:Oe,me=me.addUniqueConstraint(`un_${gn?Qe:Qe.join("_")}`,gn?[Qe]:Qe)})}if(await me.ifNotExists().execute(),ae!=null&&ae.index)for(const ue of ae.index){const Qt=ao(ue);let Qe=t.schema.createIndex(`idx_${Qt?ue:ue.join("_")}`).on(n);Qe=Qt?Qe.column(ue):Qe.columns(ue),await Qe.ifNotExists().execute()}ae!=null&&ae.timestamp&&(nt&&await Ia(t,n,"insert",nt,Oe),rt&&await Ia(t,n,"update",rt,Oe))}}var ac=(La=class{constructor(t){Tt(this,"kysely");R(this,Wn,void 0);R(this,Ni,void 0);const{dialect:e,tables:r,dropTableBeforeInit:n,onError:A,onQuery:X,plugins:ae}=t,me=[new rc];ae&&me.push(...ae),this.kysely=new Yr({dialect:e,log:Oe=>{Oe.level==="error"?A&&A(Oe.error):X&&X(Oe.query,Oe.queryDurationMillis)},plugins:me}),U(this,Wn,n?0:1),U(this,Ni,sc(r))}async init(t=!1){const e=t||s(this,Wn)===0;return await oc(this.kysely,s(this,Ni),e),U(this,Wn,2),this}async checkInit(){if(s(this,Wn)!==2&&await this.init(),s(this,Wn)!==2)throw new Error("fail to init table")}async transaction(t,e=!1){return await this.checkInit(),await this.kysely.transaction().execute(t).catch(r=>{e&&console.error(r)})}async exec(t,e=!1){return await this.checkInit(),t(this.kysely).catch(r=>{e&&console.error(r)})}async toSQL(t){return await this.checkInit(),t(this.kysely).compile()}async raw(t){return await this.checkInit(),t(Wt).execute(this.kysely)}},Wn=new WeakMap,Ni=new WeakMap,La);async function lc(t){const e=await new ac({dialect:t,tables:{test:{columns:{id:{type:"increments"},name:{type:"string"},blobtest:{type:"blob"},createAt:{type:"date"},updateAt:{type:"date"}},property:{timestamp:!0}}}}).init();console.log("test"),console.log(await e.raw(r=>r`PRAGMA table_info(${r.table("test")});`)),console.log(await e.raw(r=>r`select last_insert_rowid()`));for(let r=0;r<100;r++)await e.transaction(n=>n.insertInto("test").values({name:`test at ${Date.now()}`,blobtest:Uint8Array.from([2,3,4,5,6,7,8])}).execute());return e.exec(r=>r.selectFrom("test").selectAll().execute())}const uc=new Xu({database:async()=>{const t=(await Zu()).oo1;if(!t)return Promise.reject("fail to load sqlite");const e="/test.db";return t.OpfsDb?(console.log("support OPFS"),new t.OpfsDb(e)):(console.log("doesn't support OPFS"),new t.DB(e))}});onmessage=()=>{console.log("start official wasm test"),lc(uc).then(t=>{t==null||t.forEach(e=>console.log("[official wasm]",e))})}})(); + `.execute(t).catch(X=>{console.error(X)})}function sc(t){const e=new Map;for(const r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;const n=t[r];e.set(r,n)}return e}async function oc(t,e,r=!1){for(const[n,A]of e){const{columns:X,property:ae}=A;r&&await t.schema.dropTable(n).ifExists().execute().catch();let me=t.schema.createTable(n),Oe="rowid",At=!1,nt="createAt",rt="updateAt";if(ae!=null&&ae.timestamp&&!ic(ae.timestamp)){const{create:ue,update:Qt}=ae.timestamp;nt=ue??"createAt",rt=Qt??"updateAt"}for(const ue in X){if(!Object.prototype.hasOwnProperty.call(X,ue))continue;const Qt=X[ue];let Qe="text";const{type:gn,notNull:vi,defaultTo:wn}=Qt;switch(gn){case"boolean":case"date":case"object":case"string":Qe="text";break;case"increments":Oe=ue;case"number":Qe="integer";break;case"blob":Qe="blob"}[nt,rt].includes(ue)||(me=me.addColumn(ue,Qe,Et=>gn==="increments"?(At=!0,Et.autoIncrement().primaryKey()):(vi&&(Et=Et.notNull()),wn!==void 0&&(Et=Et.defaultTo(wn instanceof Function?wn(Wt):wn)),Et)))}if(ae){const ue=ae.primary,Qt=ae.unique;if(ae.timestamp&&(nt&&(me=me.addColumn(nt,"text")),rt&&(me=me.addColumn(rt,"text"))),!At&&ue){const Qe=ao(ue);Oe=Qe?ue:ue[0],me=me.addPrimaryKeyConstraint(`pk_${Qe?ue:ue.join("_")}`,Qe?[ue]:ue)}Qt==null||Qt.forEach(Qe=>{const gn=ao(Qe);Oe=!ue&&!At?gn?Qe:Qe[0]:Oe,me=me.addUniqueConstraint(`un_${gn?Qe:Qe.join("_")}`,gn?[Qe]:Qe)})}if(await me.ifNotExists().execute(),ae!=null&&ae.index)for(const ue of ae.index){const Qt=ao(ue);let Qe=t.schema.createIndex(`idx_${Qt?ue:ue.join("_")}`).on(n);Qe=Qt?Qe.column(ue):Qe.columns(ue),await Qe.ifNotExists().execute()}ae!=null&&ae.timestamp&&(nt&&await Ia(t,n,"insert",nt,Oe),rt&&await Ia(t,n,"update",rt,Oe))}}var ac=(La=class{constructor(t){Tt(this,"kysely");R(this,Wn,void 0);R(this,Ni,void 0);const{dialect:e,tables:r,dropTableBeforeInit:n,onError:A,onQuery:X,plugins:ae}=t,me=ae??[];me.push(new rc),this.kysely=new Yr({dialect:e,log:Oe=>{Oe.level==="error"?A&&A(Oe.error):X&&X(Oe.query,Oe.queryDurationMillis)},plugins:me}),U(this,Wn,n?0:1),U(this,Ni,sc(r))}async init(t=!1){const e=t||s(this,Wn)===0;return await oc(this.kysely,s(this,Ni),e),U(this,Wn,2),this}async checkInit(){if(s(this,Wn)!==2&&await this.init(),s(this,Wn)!==2)throw new Error("fail to init table")}async transaction(t,e=!1){return await this.checkInit(),await this.kysely.transaction().execute(t).catch(r=>{e&&console.error(r)})}async exec(t,e=!1){return await this.checkInit(),t(this.kysely).catch(r=>{e&&console.error(r)})}async toSQL(t){return await this.checkInit(),t(this.kysely).compile()}async raw(t){return await this.checkInit(),t(Wt).execute(this.kysely)}},Wn=new WeakMap,Ni=new WeakMap,La);async function lc(t){const e=await new ac({dialect:t,tables:{test:{columns:{id:{type:"increments"},name:{type:"string"},blobtest:{type:"blob"},createAt:{type:"date"},updateAt:{type:"date"}},property:{timestamp:!0}}}}).init();console.log("test"),console.log(await e.raw(r=>r`PRAGMA table_info(${r.table("test")});`)),console.log(await e.raw(r=>r`select last_insert_rowid()`));for(let r=0;r<100;r++)await e.transaction(n=>n.insertInto("test").values({name:`test at ${Date.now()}`,blobtest:Uint8Array.from([2,3,4,5,6,7,8])}).execute());return e.exec(r=>r.selectFrom("test").selectAll().execute())}const uc=new Xu({database:async()=>{const t=(await Zu()).oo1;if(!t)return Promise.reject("fail to load sqlite");const e="/test.db";return t.OpfsDb?(console.log("support OPFS"),new t.OpfsDb(e)):(console.log("doesn't support OPFS"),new t.DB(e))}});onmessage=()=>{console.log("start official wasm test"),lc(uc).then(t=>{t==null||t.forEach(e=>console.log("[official wasm]",e))})}})(); diff --git a/assets/sqljsWorker-342e964b.js b/assets/sqljsWorker-9211ff35.js similarity index 99% rename from assets/sqljsWorker-342e964b.js rename to assets/sqljsWorker-9211ff35.js index b6cdfea..0954d1c 100644 --- a/assets/sqljsWorker-342e964b.js +++ b/assets/sqljsWorker-9211ff35.js @@ -9,4 +9,4 @@ var Hl=Object.defineProperty;var Yl=(J,_,me)=>_ in J?Hl(J,_,{enumerable:!0,confi set ${Je.ref(u)} = datetime('now','localtime') where ${Je.ref(d)} = NEW.${Je.ref(d)}; end - `.execute(t).catch(b=>{console.error(b)})}function rl(t){const e=new Map;for(const r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;const u=t[r];e.set(r,u)}return e}async function nl(t,e,r=!1){for(const[u,d]of e){const{columns:b,property:k}=d;r&&await t.schema.dropTable(u).ifExists().execute().catch();let I=t.schema.createTable(u),j="rowid",c=!1,_e="createAt",Fe="updateAt";if(k!=null&&k.timestamp&&!tl(k.timestamp)){const{create:P,update:Re}=k.timestamp;_e=P??"createAt",Fe=Re??"updateAt"}for(const P in b){if(!Object.prototype.hasOwnProperty.call(b,P))continue;const Re=b[P];let Y="text";const{type:Ee,notNull:Zn,defaultTo:Rt}=Re;switch(Ee){case"boolean":case"date":case"object":case"string":Y="text";break;case"increments":j=P;case"number":Y="integer";break;case"blob":Y="blob"}[_e,Fe].includes(P)||(I=I.addColumn(P,Y,yt=>Ee==="increments"?(c=!0,yt.autoIncrement().primaryKey()):(Zn&&(yt=yt.notNull()),Rt!==void 0&&(yt=yt.defaultTo(Rt instanceof Function?Rt(Je):Rt)),yt)))}if(k){const P=k.primary,Re=k.unique;if(k.timestamp&&(_e&&(I=I.addColumn(_e,"text")),Fe&&(I=I.addColumn(Fe,"text"))),!c&&P){const Y=to(P);j=Y?P:P[0],I=I.addPrimaryKeyConstraint(`pk_${Y?P:P.join("_")}`,Y?[P]:P)}Re==null||Re.forEach(Y=>{const Ee=to(Y);j=!P&&!c?Ee?Y:Y[0]:j,I=I.addUniqueConstraint(`un_${Ee?Y:Y.join("_")}`,Ee?[Y]:Y)})}if(await I.ifNotExists().execute(),k!=null&&k.index)for(const P of k.index){const Re=to(P);let Y=t.schema.createIndex(`idx_${Re?P:P.join("_")}`).on(u);Y=Re?Y.column(P):Y.columns(P),await Y.ifNotExists().execute()}k!=null&&k.timestamp&&(_e&&await _a(t,u,"insert",_e,j),Fe&&await _a(t,u,"update",Fe,j))}}var il=(Ga=class{constructor(t){Xe(this,"kysely");w(this,Yt,void 0);w(this,Xn,void 0);const{dialect:e,tables:r,dropTableBeforeInit:u,onError:d,onQuery:b,plugins:k}=t,I=[new el];k&&I.push(...k),this.kysely=new En({dialect:e,log:j=>{j.level==="error"?d&&d(j.error):b&&b(j.query,j.queryDurationMillis)},plugins:I}),g(this,Yt,u?0:1),g(this,Xn,rl(r))}async init(t=!1){const e=t||n(this,Yt)===0;return await nl(this.kysely,n(this,Xn),e),g(this,Yt,2),this}async checkInit(){if(n(this,Yt)!==2&&await this.init(),n(this,Yt)!==2)throw new Error("fail to init table")}async transaction(t,e=!1){return await this.checkInit(),await this.kysely.transaction().execute(t).catch(r=>{e&&console.error(r)})}async exec(t,e=!1){return await this.checkInit(),t(this.kysely).catch(r=>{e&&console.error(r)})}async toSQL(t){return await this.checkInit(),t(this.kysely).compile()}async raw(t){return await this.checkInit(),t(Je).execute(this.kysely)}},Yt=new WeakMap,Xn=new WeakMap,Ga);async function sl(t){const e=await new il({dialect:t,tables:{test:{columns:{id:{type:"increments"},name:{type:"string"},blobtest:{type:"blob"},createAt:{type:"date"},updateAt:{type:"date"}},property:{timestamp:!0}}}}).init();console.log("test"),console.log(await e.raw(r=>r`PRAGMA table_info(${r.table("test")});`)),console.log(await e.raw(r=>r`select last_insert_rowid()`));for(let r=0;r<100;r++)await e.transaction(u=>u.insertInto("test").values({name:`test at ${Date.now()}`,blobtest:Uint8Array.from([2,3,4,5,6,7,8])}).execute());return e.exec(r=>r.selectFrom("test").selectAll().execute())}const ol=new Lc({async database(){const t=await Qc({locateFile:()=>Uc});return new t.Database(await Kc("sqlijsWorker"))},onWrite:{func(t){console.log(`[sqljs worker] write to indexeddb, length: ${t.length}`),Hc("sqlijsWorker",t)}}});onmessage=()=>{console.log("start sqljs test"),sl(ol).then(t=>{t==null||t.forEach(e=>console.log("[sqlijs]",e))})}})(); + `.execute(t).catch(b=>{console.error(b)})}function rl(t){const e=new Map;for(const r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;const u=t[r];e.set(r,u)}return e}async function nl(t,e,r=!1){for(const[u,d]of e){const{columns:b,property:k}=d;r&&await t.schema.dropTable(u).ifExists().execute().catch();let I=t.schema.createTable(u),j="rowid",c=!1,_e="createAt",Fe="updateAt";if(k!=null&&k.timestamp&&!tl(k.timestamp)){const{create:P,update:Re}=k.timestamp;_e=P??"createAt",Fe=Re??"updateAt"}for(const P in b){if(!Object.prototype.hasOwnProperty.call(b,P))continue;const Re=b[P];let Y="text";const{type:Ee,notNull:Zn,defaultTo:Rt}=Re;switch(Ee){case"boolean":case"date":case"object":case"string":Y="text";break;case"increments":j=P;case"number":Y="integer";break;case"blob":Y="blob"}[_e,Fe].includes(P)||(I=I.addColumn(P,Y,yt=>Ee==="increments"?(c=!0,yt.autoIncrement().primaryKey()):(Zn&&(yt=yt.notNull()),Rt!==void 0&&(yt=yt.defaultTo(Rt instanceof Function?Rt(Je):Rt)),yt)))}if(k){const P=k.primary,Re=k.unique;if(k.timestamp&&(_e&&(I=I.addColumn(_e,"text")),Fe&&(I=I.addColumn(Fe,"text"))),!c&&P){const Y=to(P);j=Y?P:P[0],I=I.addPrimaryKeyConstraint(`pk_${Y?P:P.join("_")}`,Y?[P]:P)}Re==null||Re.forEach(Y=>{const Ee=to(Y);j=!P&&!c?Ee?Y:Y[0]:j,I=I.addUniqueConstraint(`un_${Ee?Y:Y.join("_")}`,Ee?[Y]:Y)})}if(await I.ifNotExists().execute(),k!=null&&k.index)for(const P of k.index){const Re=to(P);let Y=t.schema.createIndex(`idx_${Re?P:P.join("_")}`).on(u);Y=Re?Y.column(P):Y.columns(P),await Y.ifNotExists().execute()}k!=null&&k.timestamp&&(_e&&await _a(t,u,"insert",_e,j),Fe&&await _a(t,u,"update",Fe,j))}}var il=(Ga=class{constructor(t){Xe(this,"kysely");w(this,Yt,void 0);w(this,Xn,void 0);const{dialect:e,tables:r,dropTableBeforeInit:u,onError:d,onQuery:b,plugins:k}=t,I=k??[];I.push(new el),this.kysely=new En({dialect:e,log:j=>{j.level==="error"?d&&d(j.error):b&&b(j.query,j.queryDurationMillis)},plugins:I}),g(this,Yt,u?0:1),g(this,Xn,rl(r))}async init(t=!1){const e=t||n(this,Yt)===0;return await nl(this.kysely,n(this,Xn),e),g(this,Yt,2),this}async checkInit(){if(n(this,Yt)!==2&&await this.init(),n(this,Yt)!==2)throw new Error("fail to init table")}async transaction(t,e=!1){return await this.checkInit(),await this.kysely.transaction().execute(t).catch(r=>{e&&console.error(r)})}async exec(t,e=!1){return await this.checkInit(),t(this.kysely).catch(r=>{e&&console.error(r)})}async toSQL(t){return await this.checkInit(),t(this.kysely).compile()}async raw(t){return await this.checkInit(),t(Je).execute(this.kysely)}},Yt=new WeakMap,Xn=new WeakMap,Ga);async function sl(t){const e=await new il({dialect:t,tables:{test:{columns:{id:{type:"increments"},name:{type:"string"},blobtest:{type:"blob"},createAt:{type:"date"},updateAt:{type:"date"}},property:{timestamp:!0}}}}).init();console.log("test"),console.log(await e.raw(r=>r`PRAGMA table_info(${r.table("test")});`)),console.log(await e.raw(r=>r`select last_insert_rowid()`));for(let r=0;r<100;r++)await e.transaction(u=>u.insertInto("test").values({name:`test at ${Date.now()}`,blobtest:Uint8Array.from([2,3,4,5,6,7,8])}).execute());return e.exec(r=>r.selectFrom("test").selectAll().execute())}const ol=new Lc({async database(){const t=await Qc({locateFile:()=>Uc});return new t.Database(await Kc("sqlijsWorker"))},onWrite:{func(t){console.log(`[sqljs worker] write to indexeddb, length: ${t.length}`),Hc("sqlijsWorker",t)}}});onmessage=()=>{console.log("start sqljs test"),sl(ol).then(t=>{t==null||t.forEach(e=>console.log("[sqlijs]",e))})}})(); diff --git a/index.html b/index.html index f815cbc..1930d20 100644 --- a/index.html +++ b/index.html @@ -8,7 +8,7 @@ test - +