import{f as u,eG as I,d as x,eB as q,r as c,o as k,S as b,b as f,ev as g,w as p,u as i,c as A,ex as B,e as O,bV as D,ar as h,a$ as P,eC as R,eD as V,cH as j,eE as E,eF as N,v as $}from"./outputWidgets.0a8e4948.js";import"./router.a730a2c1.js";import"./index.fea4a6f4.js";import{P as F}from"./project.aaf35bd5.js";import{e as L}from"./toggleHighContrast.2817880b.js";import{A as M}from"./index.2673874d.js";import{A as Q}from"./index.67ec613b.js";import"./Form.c559c050.js";import"./hasIn.8bcc6abb.js";import"./index.cf4c23b9.js";import"./record.68d70ea4.js";import"./pubsub.dcb12b9f.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ca5f3ad1-73e6-48db-8ac1-afe369a78f37",e._sentryDebugIdIdentifier="sentry-dbid-ca5f3ad1-73e6-48db-8ac1-afe369a78f37")}catch{}})();var z={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M715.8 493.5L335 165.1c-14.2-12.2-35-1.2-35 18.5v656.8c0 19.7 20.8 30.7 35 18.5l380.8-328.4c10.9-9.4 10.9-27.6 0-37z"}}]},name:"caret-right",theme:"outlined"};const T=z;function S(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?Object(arguments[t]):{},n=Object.keys(a);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(a).filter(function(r){return Object.getOwnPropertyDescriptor(a,r).enumerable}))),n.forEach(function(r){H(e,r,a[r])})}return e}function H(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var _=function(t,a){var n=S({},t,a.attrs);return u(I,S({},n,{icon:T}),null)};_.displayName="CaretRightOutlined";_.inheritAttrs=!1;const G=_;function J(e){const t={};for(const a in e)e.hasOwnProperty(a)&&(t[a]=e[a].toString());return t}const U=e=>(E("data-v-29bbdaa2"),e=e(),N(),e),W={class:"container"},X=U(()=>O("br",null,null,-1)),Y=x({__name:"Sql",setup(e){const a=q().params.projectId,n=c(null),r=c(""),v=c([]),y=c([]),m=c([]),w=async()=>{const o=await F.executeQuery(a,r.value,[]);if(b.set("lastQuery",r.value),!o)return;const{returns:s,errors:d}=o;m.value=d,y.value=s.fields.map(l=>({title:l.name,key:l.name,dataIndex:l.name})),v.value=s.result.map((l,C)=>J({key:`${C+1}`,...l}))};return k(()=>{const o=L.create(n.value,{language:"sql",value:r.value,fontFamily:"monospace",lineNumbers:"on",minimap:{enabled:!1},scrollbar:{vertical:"hidden",horizontal:"visible"},fontSize:14,scrollBeyondLastLine:!1,lineHeight:20});o.onDidChangeModelContent(()=>{r.value=o.getValue()});const s=b.get("lastQuery");s&&(r.value=s,o.setValue(s))}),(o,s)=>(f(),g("div",W,[u(i(M),{gap:"large",class:"sql-container",align:"center"},{default:p(()=>[O("div",{ref_key:"sqlEditor",ref:n,class:"sql-editor"},null,512),u(i(D),{type:"primary",onClick:w},{icon:p(()=>[u(i(G))]),default:p(()=>[h(" Run ")]),_:1})]),_:1}),m.value.length?(f(),A(i(Q),{key:0,type:"error","show-icon":""},{message:p(()=>[(f(!0),g(P,null,R(m.value,d=>(f(),g("span",{key:d},[h(V(d)+" ",1),X]))),128))]),_:1})):B("",!0),u(i(j),{style:{width:"100%"},scroll:{x:100},"data-source":v.value,columns:y.value},null,8,["data-source","columns"])]))}});const ue=$(Y,[["__scopeId","data-v-29bbdaa2"]]);export{ue as default};
//# sourceMappingURL=Sql.9dfd829a.js.map
