import{f as u,f5 as S,d as w,f1 as x,L as C,z as q,r as i,o as I,b as E,eV as P,w as p,u as d,e as R,bF as k,am as B,cY as L,cJ as V,cz as y,E as j}from"./outputWidgets.abde7be7.js";import{e as D}from"./toggleHighContrast.004586ad.js";import"./gateway.e5c93921.js";import"./index.2e366912.js";import{P as Q}from"./project.0d7f508d.js";import"./popupNotifcation.51a8836c.js";import"./record.4adc9d27.js";import"./pubsub.7f579dee.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]="56e3134f-4575-46b3-9800-5957f0ed705c",e._sentryDebugIdIdentifier="sentry-dbid-56e3134f-4575-46b3-9800-5957f0ed705c")}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 N=z;function v(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?Object(arguments[t]):{},r=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(a){return Object.getOwnPropertyDescriptor(n,a).enumerable}))),r.forEach(function(a){A(e,a,n[a])})}return e}function A(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var m=function(t,n){var r=v({},t,n.attrs);return u(S,v({},r,{icon:N}),null)};m.displayName="CaretRightOutlined";m.inheritAttrs=!1;const F=m;function M(e){const t={};for(const n in e)e.hasOwnProperty(n)&&(t[n]=String(e[n]));return t}const $={class:"container"},T=w({__name:"Sql",setup(e){const n=x().params.projectId,r=new C(q.string(),"lastQuery"),a=i(null),c=i(""),g=i([]),_=i([]),b=i([]),h=async()=>{const o=await Q.executeQuery(n,c.value,[]);if(r.set(c.value),!o)return;const{returns:s,errors:f}=o;b.value=f;for(const l of f)y.error({message:"SQL Execution Failed",description:l});f.length||y.success({message:"SQL Execution Succeeded"}),_.value=s.fields.map(l=>({title:l.name,key:l.name,dataIndex:l.name})),g.value=s.result.map((l,O)=>M({key:`${O+1}`,...l}))};return I(()=>{const o=D.create(a.value,{language:"sql",value:c.value,fontFamily:"monospace",lineNumbers:"on",minimap:{enabled:!1},scrollbar:{vertical:"hidden",horizontal:"visible"},fontSize:14,scrollBeyondLastLine:!1,lineHeight:20});o.onDidChangeModelContent(()=>{c.value=o.getValue()});const s=r.get();s&&(c.value=s,o.setValue(s))}),(o,s)=>(E(),P("div",$,[u(d(L),{gap:"large",class:"sql-container",align:"center"},{default:p(()=>[R("div",{ref_key:"sqlEditor",ref:a,class:"sql-editor"},null,512),u(d(k),{type:"primary",onClick:h},{icon:p(()=>[u(d(F))]),default:p(()=>[B(" Run ")]),_:1})]),_:1}),u(d(V),{style:{width:"100%"},scroll:{x:100},"data-source":g.value,columns:_.value},null,8,["data-source","columns"])]))}});const K=j(T,[["__scopeId","data-v-cdc1d7a6"]]);export{K as default};
//# sourceMappingURL=Sql.59a1f046.js.map
