import{W as k,a as V,b as x,c as y}from"./ts.worker.921d436c.js";import{l as a,W as E,e as c}from"./toggleHighContrast.483b4227.js";import{f as T}from"./sqlFormatter.e0a34ad5.js";import{language as n}from"./sql.4f48b9c1.js";import{d as m,h as s,ag as W,L as b,ab as p,D as I,o as C,c as S,_ as w}from"./index.e3896b23.js";const B=["id"],L=m({name:"DataStudioIndex"}),$=m({...L,props:{id:{type:String,required:!1,default:()=>"codeEditBox"}},setup(i,{expose:f}){const g=i,r=s(""),h=s("sql"),l=s("vs-dark");W(()=>{t.dispose(),_.dispose(),console.log("editor dispose")}),b(()=>{v(),console.log("editor init")});const _=a.registerCompletionItemProvider("sql",{provideCompletionItems:function(){let o=[];return n.keywords.forEach(e=>{o.push({label:e,kind:a.CompletionItemKind.Keyword,insertText:e})}),n.operators.forEach(e=>{o.push({label:e,kind:a.CompletionItemKind.Operator,insertText:e})}),n.builtinFunctions.forEach(e=>{o.push({label:e,kind:a.CompletionItemKind.Function,insertText:e})}),n.builtinVariables.forEach(e=>{o.push({label:e,kind:a.CompletionItemKind.Variable,insertText:e})}),{suggestions:o}}});self.MonacoEnvironment={getWorker(o,e){return e==="json"?new k:e==="css"||e==="scss"||e==="less"?new V:e==="html"||e==="handlebars"||e==="razor"?new x:["typescript","javascript"].includes(e)?new y:new E}};let t=null;const d=p("editorValues"),u=p("editableTabsValue"),v=()=>{I(()=>{t?t.setValue(""):t=c.create(document.getElementById(g.id),{value:r.value,language:h.value,automaticLayout:!0,theme:l.value,foldingStrategy:"indentation",renderLineHighlight:"all",selectOnLineNumbers:!0,minimap:{enabled:!0},cursorStyle:"line",readOnly:!1,fontSize:16,autoIndent:!0,useTabStops:!1,quickSuggestionsDelay:100,scrollBeyondLastLine:!1,overviewRulerBorder:!1}),t.onDidChangeModelContent(o=>{r.value=t.getValue(),d[u.value]&&(d[u.value].codeText=r.value)})})};return f({setEditorValue:o=>{t.setValue(o)},getEditorValue:()=>t.getValue(),handleFormat:()=>{t.setValue(T(t.getValue()))},handleTheme:()=>{c.setTheme(l.value)}}),(o,e)=>(C(),S("div",{id:i.id,class:"codeEditBox"},null,8,B))}});const N=w($,[["__scopeId","data-v-873ac206"]]);export{N as default};
