const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./DfOJF6LD.js","./ChQ2IioC.js","./entry.1_l-hn2N.css","./DvIxiWzI.js","./editor.d-_yvVgq.css","./DUtQECFo.js","./monaco-setup.COQM9i0P.css"])))=>i.map(i=>d[i]);
import{An as e,Cr as t,Dr as n,Hr as r,Ir as i,Or as a,Un as o,Zn as s,_r as c,br as l,gr as u,ii as d,ir as f,jr as p,kr as m,mr as h,qr as g,t as _,ti as v,zr as y}from"./ChQ2IioC.js";var b={class:`flex flex-col gap-2`},x={class:`flex items-center justify-end gap-3 text-xs`},S={key:0,class:`flex cursor-pointer items-center gap-1`},C={key:1,class:`badge badge-ghost badge-sm`},w=t({__name:`MonacoYamlEditor.client`,props:{modelValue:{},readOnly:{type:Boolean,default:!1},language:{default:`yaml`}},emits:[`update:modelValue`],setup(t,{emit:w}){let T=t,E=w,{t:D}=e(),O=_(),k=o(),A=g(),j=g(!1),M=null,N=null,P=null;function F(){if(typeof document<`u`){let e=getComputedStyle(document.documentElement).colorScheme;if(e.includes(`dark`))return`vs-dark`;if(e.includes(`light`))return`vs`}return k.value?`vs-dark`:`vs`}return m(async()=>{M=(await s(()=>import(`./DfOJF6LD.js`),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).ensureMonacoYaml();let e=T.language===`javascript`,t=M.Uri.parse(e?`inmemory://profile/script.js`:`inmemory://profile/config.yaml`);P=M.editor.getModel(t)??M.editor.createModel(T.modelValue,e?`javascript`:`yaml`,t),P.setValue(T.modelValue),N=M.editor.create(A.value,{model:P,theme:F(),readOnly:T.readOnly,automaticLayout:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:13,tabSize:2}),N.onDidChangeModelContent(()=>{E(`update:modelValue`,N.getValue())})}),a(()=>{N?.dispose(),P?.dispose(),N=null,P=null}),i(()=>T.modelValue,e=>{P&&e!==P.getValue()&&P.setValue(e)}),i(()=>T.readOnly,e=>N?.updateOptions({readOnly:e})),i([()=>O.curTheme,k],async()=>{await n(),M?.editor.setTheme(F())}),i(j,e=>{!M||!P||T.language!==`yaml`||M.editor.setModelLanguage(P,e?`plaintext`:`yaml`)}),(e,n)=>(p(),c(`div`,b,[h(`div`,x,[t.language===`yaml`?(p(),c(`label`,S,[y(h(`input`,{"onUpdate:modelValue":n[0]||=e=>r(j)?j.value=e:null,type:`checkbox`,class:`toggle toggle-xs`},null,512),[[f,v(j)]]),l(` `+d(v(D)(`editorDisableValidation`)),1)])):u(``,!0),t.readOnly?(p(),c(`span`,C,d(v(D)(`editorReadOnly`)),1)):u(``,!0)]),h(`div`,{ref_key:`container`,ref:A,class:`h-[60vh] w-full overflow-hidden rounded-lg border border-base-content/10`},null,512)]))}}),T=Object.assign(w,{__name:`MonacoYamlEditor`});export{T as default};