import{C as ue,D as ie,E as W,F as fe,s as ne,r as P,i as g,g as d,w as S,e as y,x,b as w,d as T,h as I,j as v,z as B,a as L,f as N,t as z,l as se,p as G}from"../chunks/scheduler.C39PMv9a.js";import{g as H,a as E,c as R,t as $,S as ce,i as oe,b as O,d as A,m as D,e as j}from"../chunks/index.Te5Nl1-a.js";import{e as U,u as Y,o as J,I as q}from"../chunks/VennDiagram.svelte_svelte_type_style_lang.-64_fZ65.js";import"../chunks/entry.galzRTFy.js";import{D as _e,T as he,A as me,a as de,b as pe,_ as be}from"../chunks/index.ta-mt3DI.js";function ge(u,e){const l=e.token={};function t(r,o,_,c){if(e.token!==l)return;e.resolved=c;let n=e.ctx;_!==void 0&&(n=n.slice(),n[_]=c);const a=r&&(e.current=r)(n);let s=!1;e.block&&(e.blocks?e.blocks.forEach((m,f)=>{f!==o&&m&&(H(),E(m,1,1,()=>{e.blocks[f]===m&&(e.blocks[f]=null)}),R())}):e.block.d(1),a.c(),$(a,1),a.m(e.mount(),e.anchor),s=!0),e.block=a,e.blocks&&(e.blocks[o]=a),s&&fe()}if(ue(u)){const r=ie();if(u.then(o=>{W(r),t(e.then,1,e.value,o),W(null)},o=>{if(W(r),t(e.catch,2,e.error,o),W(null),!e.hasCatch)throw o}),e.current!==e.pending)return t(e.pending,0),!0}else{if(e.current!==e.then)return t(e.then,1,e.value,u),!0;e.resolved=u}}function ke(u,e,l){const t=e.slice(),{resolved:r}=u;u.current===u.then&&(t[u.value]=r),u.current===u.catch&&(t[u.error]=r),u.block.p(t,l)}function Q(u,e,l){const t=u.slice();return t[8]=e[l][0],t[9]=e[l][1],t}function X(u,e,l){const t=u.slice();return t[12]=e[l][0],t[13]=e[l][1],t}function Z(u,e,l){const t=u.slice();return t[16]=e[l],t}function $e(u){let e,l,t=u[19].message+"",r;return{c(){e=S(`An error was encountered while loading project schema. `),l=y("pre"),r=S(t),this.h()},l(o){e=x(o,`An error was encountered while loading project schema. `),l=w(o,"PRE",{class:!0});var _=T(l);r=x(_,t),_.forEach(d),this.h()},h(){I(l,"class","px-4 py-2 bg-red-800 text-white")},m(o,_){g(o,e,_),g(o,l,_),v(l,r)},p:B,i:B,o:B,d(o){o&&(d(e),d(l))}}}function ve(u){let e,l,t,r=[],o=new Map,_,c=U(Object.entries(u[7]));const n=a=>a[8];for(let a=0;an[12];for(let n=0;n<_.length;n+=1){let a=X(u,_,n),s=c(a);t.set(s,l[n]=re(s,a))}return{c(){e=y("ul");for(let n=0;nc[16].column_name;for(let c=0;c{i=null}),R())},i(h){s||($(r.$$.fragment,h),$(i),s=!0)},o(h){E(r.$$.fragment,h),E(i),s=!1},d(h){h&&(d(l),d(n),d(a)),j(r),i&&i.d(h),m=!1,f()}}}function ae(u,e){let l,t,r,o,_=e[8]+"",c,n,a,s,m,f;r=new q({props:{src:_e,class:"text-white w-5 h-5 mr-1"}});function b(){return e[4](e[8])}let i=e[1]===e[8]&&ee(e);return{key:u,first:null,c(){l=y("li"),t=y("button"),O(r.$$.fragment),o=L(),c=S(_),n=L(),i&&i.c(),a=P(),this.h()},l(h){l=w(h,"LI",{class:!0});var p=T(l);t=w(p,"BUTTON",{class:!0});var C=T(t);A(r.$$.fragment,C),o=N(C),c=x(C,_),C.forEach(d),p.forEach(d),n=N(h),i&&i.l(h),a=P(),this.h()},h(){I(t,"class","bg-gray-500 px-2 py-1 rounded font-bold flex w-full hover:bg-blue-500"),z(t,"bg-blue-500",e[1]===e[8]),I(l,"class","font-mono m-0 text-sm text-white"),this.first=l},m(h,p){g(h,l,p),v(l,t),D(r,t,null),v(t,o),v(t,c),g(h,n,p),i&&i.m(h,p),g(h,a,p),s=!0,m||(f=se(t,"click",b),m=!0)},p(h,p){e=h,(!s||p&6)&&z(t,"bg-blue-500",e[1]===e[8]),e[1]===e[8]?i?(i.p(e,p),p&2&&$(i,1)):(i=ee(e),i.c(),$(i,1),i.m(a.parentNode,a)):i&&(H(),E(i,1,1,()=>{i=null}),R())},i(h){s||($(r.$$.fragment,h),$(i),s=!0)},o(h){E(r.$$.fragment,h),E(i),s=!1},d(h){h&&(d(l),d(n),d(a)),j(r),i&&i.d(h),m=!1,f()}}}function Ie(u){let e;return{c(){e=S("Loading Schema Information...")},l(l){e=x(l,"Loading Schema Information...")},m(l,t){g(l,e,t)},p:B,i:B,o:B,d(l){l&&d(e)}}}function Ce(u){let e,l,t={ctx:u,current:null,token:null,hasCatch:!0,pending:Ie,then:ve,catch:$e,value:7,error:19,blocks:[,,,]};return ge(u[2](),t),{c(){e=P(),t.block.c()},l(r){e=P(),t.block.l(r)},m(r,o){g(r,e,o),t.block.m(r,t.anchor=o),t.mount=()=>e.parentNode,t.anchor=e,l=!0},p(r,[o]){u=r,ke(t,u,o)},i(r){l||($(t.block),l=!0)},o(r){for(let o=0;o<3;o+=1){const _=t.blocks[o];E(_)}l=!1},d(r){r&&d(e),t.block.d(r),t.token=null,t=null}}}function Le(u,e,l){let{data:t}=e,{__db:r}=t;async function o(){const s=await r.query("SELECT * FROM information_schema.tables WHERE table_catalog = 'memory' AND table_name != 'stats'"),m={};return await Promise.all(s.map(async f=>{const b=await r.query(`SELECT * FROM information_schema.columns WHERE table_name = '${f.table_name}' AND table_schema = '${f.table_schema}'`);m[f.table_schema]||(m[f.table_schema]={}),m[f.table_schema][f.table_name]={table:f,columns:b}})),m}let _="",c="";const n=s=>{l(1,c=c===s?"":s),l(0,_="")},a=s=>{l(0,_=_===s?"":s)};return u.$$set=s=>{"data"in s&&l(3,t=s.data)},[_,c,o,t,n,a]}class Ne extends ce{constructor(e){super(),oe(this,e,Le,Ce,ne,{data:3})}}function Se(u){let e,l="Project Schema",t,r,o="This page details the tables and columns that are currently loaded in your project.",_,c,n="Sources",a,s,m;return s=new Ne({props:{data:u[0]}}),{c(){e=y("h1"),e.textContent=l,t=L(),r=y("p"),r.textContent=o,_=L(),c=y("h2"),c.textContent=n,a=L(),O(s.$$.fragment),this.h()},l(f){e=w(f,"H1",{class:!0,"data-svelte-h":!0}),G(e)!=="svelte-15777oi"&&(e.textContent=l),t=N(f),r=w(f,"P",{class:!0,"data-svelte-h":!0}),G(r)!=="svelte-ak948l"&&(r.textContent=o),_=N(f),c=w(f,"H2",{class:!0,"data-svelte-h":!0}),G(c)!=="svelte-9qt1ro"&&(c.textContent=n),a=N(f),A(s.$$.fragment,f),this.h()},h(){I(e,"class","markdown"),I(r,"class","markdown"),I(c,"class","markdown")},m(f,b){g(f,e,b),g(f,t,b),g(f,r,b),g(f,_,b),g(f,c,b),g(f,a,b),D(s,f,b),m=!0},p(f,[b]){const i={};b&1&&(i.data=f[0]),s.$set(i)},i(f){m||($(s.$$.fragment,f),m=!0)},o(f){E(s.$$.fragment,f),m=!1},d(f){f&&(d(e),d(t),d(r),d(_),d(c),d(a)),j(s,f)}}}function xe(u,e,l){let{data:t}=e;return u.$$set=r=>{"data"in r&&l(0,t=r.data)},[t]}class Be extends ce{constructor(e){super(),oe(this,e,xe,Se,ne,{data:0})}}export{Be as component};