import{f as u,eH as I,d as q,eB as x,r as i,o as k,S as b,b as f,eu as g,w as p,u as c,c as A,ew as B,e as w,bF as P,aq as h,aC as R,eC as D,eE as V,cF as j,eF as E,eG as F,v as N}from"./outputWidgets.f017b1ba.js";import"./router.bd5e0bcd.js";import"./index.2d300106.js";import{P as L}from"./project.cffa897f.js";import{e as M}from"./toggleHighContrast.a7b5bb1d.js";import{A as Q}from"./index.5cbbe314.js";import{A as $}from"./index.4a35214d.js";import"./Form.c4ae4d63.js";import"./hasIn.a2b4c2f9.js";import"./popupNotifcation.d47f45e7.js";import"./index.cf4c23b9.js";import"./record.e2bcfa5f.js";import"./pubsub.4d72db7b.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]="3fcaf9f9-55e3-40a5-a468-3d59f997b859",e._sentryDebugIdIdentifier="sentry-dbid-3fcaf9f9-55e3-40a5-a468-3d59f997b859")}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]=String(e[a]));return t}const U=e=>(E("data-v-29bbdaa2"),e=e(),F(),e),W={class:"container"},X=U(()=>w("br",null,null,-1)),Y=q({__name:"Sql",setup(e){const a=x().params.projectId,n=i(null),r=i(""),y=i([]),v=i([]),m=i([]),O=async()=>{const o=await L.executeQuery(a,r.value,[]);if(b.set("lastQuery",r.value),!o)return;const{returns:s,errors:d}=o;m.value=d,v.value=s.fields.map(l=>({title:l.name,key:l.name,dataIndex:l.name})),y.value=s.result.map((l,C)=>J({key:`${C+1}`,...l}))};return k(()=>{const o=M.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(c(Q),{gap:"large",class:"sql-container",align:"center"},{default:p(()=>[w("div",{ref_key:"sqlEditor",ref:n,class:"sql-editor"},null,512),u(c(P),{type:"primary",onClick:O},{icon:p(()=>[u(c(G))]),default:p(()=>[h(" Run ")]),_:1})]),_:1}),m.value.length?(f(),A(c($),{key:0,type:"error","show-icon":""},{message:p(()=>[(f(!0),g(R,null,D(m.value,d=>(f(),g("span",{key:d},[h(V(d)+" ",1),X]))),128))]),_:1})):B("",!0),u(c(j),{style:{width:"100%"},scroll:{x:100},"data-source":y.value,columns:v.value},null,8,["data-source","columns"])]))}});const de=N(Y,[["__scopeId","data-v-29bbdaa2"]]);export{de as default};
//# sourceMappingURL=Sql.d67509fe.js.map
