const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/editor.main-BljYFdfA.js","assets/index-CqK_XPg7.js","assets/index-BiMZ3Oo8.css","assets/editor.api2-SLfptPIG.js","assets/editor-BnkT-hT5.css","assets/workers-BIEUw9pN.js","assets/monaco.contribution-HZxb4U4v.js"])))=>i.map(i=>d[i]);
import{a as e,c as t,d as n,f as r,i,l as a,n as o,o as s,r as c,s as l,t as u,u as d}from"./index-CqK_XPg7.js";function f(e){return new Worker(`/__musea__/assets/editor.worker-Bd9IXS8d.js`,{name:e?.name})}function p(e){return new Worker(`/__musea__/assets/json.worker-DzV-CpCQ.js`,{name:e?.name})}function m(e){return new Worker(`/__musea__/assets/css.worker-Wv5dxAWO.js`,{name:e?.name})}function h(e){return new Worker(`/__musea__/assets/html.worker-CQP8QQsS.js`,{name:e?.name})}function g(e){return new Worker(`/__musea__/assets/ts.worker-METxwbDZ.js`,{name:e?.name})}var _=o(s({__name:`MonacoEditor`,props:{modelValue:{},language:{},theme:{},height:{},readOnly:{type:Boolean},completionItems:{}},emits:[`update:modelValue`],setup(o,{emit:s}){let _=o,v=s,{resolvedTheme:y}=c(),b=n(null),x=null,S=null,C=null,w=i(()=>y.value===`dark`?`musea-dark`:`musea-light`);t(async()=>{b.value&&(self.MonacoEnvironment={getWorker(e,t){switch(t){case`json`:return new p;case`css`:case`scss`:case`less`:return new m;case`html`:case`handlebars`:case`razor`:return new h;case`typescript`:case`javascript`:return new g;default:return new f}}},S=await u(()=>import(`./editor.main-BljYFdfA.js`),__vite__mapDeps([0,1,2,3,4,5,6])),S.editor.defineTheme(`musea-dark`,{base:`vs-dark`,inherit:!0,rules:[],colors:{"editor.background":`#1a1a1a`,"editor.foreground":`#e5e5e5`,"editor.lineHighlightBackground":`#252525`,"editorCursor.foreground":`#e07048`,"editor.selectionBackground":`#3d3d3d`}}),S.editor.defineTheme(`musea-light`,{base:`vs`,inherit:!0,rules:[],colors:{"editor.background":`#ddd9cd`,"editor.foreground":`#121212`,"editor.lineHighlightBackground":`#d4d0c4`,"editorCursor.foreground":`#121212`,"editor.selectionBackground":`#c8c4b8`}}),_.completionItems&&_.completionItems.length>0&&T(S,_.completionItems),x=S.editor.create(b.value,{value:_.modelValue,language:_.language||`html`,theme:_.theme||w.value,minimap:{enabled:!1},fontSize:12,lineNumbers:`on`,lineNumbersMinChars:3,scrollBeyondLastLine:!1,wordWrap:`on`,automaticLayout:!0,readOnly:_.readOnly||!1,padding:{top:8,bottom:8},renderLineHighlight:`line`,scrollbar:{vertical:`auto`,horizontal:`auto`,verticalScrollbarSize:8,horizontalScrollbarSize:8},overviewRulerLanes:0,hideCursorInOverviewRuler:!0,overviewRulerBorder:!1,folding:!1,tabSize:2}),x.onDidChangeModelContent(()=>{v(`update:modelValue`,x?.getValue()||``)}))});function T(e,t){C?.dispose(),C=e.languages.registerCompletionItemProvider(`css`,{triggerCharacters:[`-`,`(`],provideCompletionItems(n,r){let i=n.getLineContent(r.lineNumber).substring(0,r.column-1),a=/var\(\s*-*$/.test(i),o=/:\s*[^;]*$/.test(i);if(!a&&!o)return{suggestions:[]};let s=n.getWordUntilPosition(r),c={startLineNumber:r.lineNumber,startColumn:s.startColumn,endLineNumber:r.lineNumber,endColumn:s.endColumn};return{suggestions:t.map(t=>{let n=`--${t.replace(/\./g,`-`)}`;return{label:n,kind:e.languages.CompletionItemKind.Variable,detail:`Design token: ${t}`,insertText:a?n:`var(${n})`,range:c,sortText:`0`+t}})}}}),C=e.languages.registerCompletionItemProvider(`html`,{triggerCharacters:[`-`,`(`],provideCompletionItems(n,r){let i=n.getLineContent(r.lineNumber).substring(0,r.column-1),a=/var\(\s*-*$/.test(i),o=/:\s*[^;]*$/.test(i);if(!a&&!o)return{suggestions:[]};let s=n.getWordUntilPosition(r),c={startLineNumber:r.lineNumber,startColumn:s.startColumn,endLineNumber:r.lineNumber,endColumn:s.endColumn};return{suggestions:t.map(t=>{let n=`--${t.replace(/\./g,`-`)}`;return{label:n,kind:e.languages.CompletionItemKind.Variable,detail:`Design token: ${t}`,insertText:a?n:`var(${n})`,range:c,sortText:`0`+t}})}}})}return l(()=>{C?.dispose(),x?.dispose()}),d(()=>_.modelValue,e=>{x&&x.getValue()!==e&&x.setValue(e)}),d(()=>_.language,e=>{if(x&&S&&e){let t=x.getModel();t&&S.editor.setModelLanguage(t,e)}}),d(()=>_.completionItems,e=>{S&&e&&e.length>0&&T(S,e)}),d(w,e=>{S&&!_.theme&&S.editor.setTheme(e)}),(t,n)=>(a(),e(`div`,{ref_key:`containerRef`,ref:b,class:`monaco-container`,style:r({height:o.height||`120px`})},null,4))}}),[[`__scopeId`,`data-v-bbc42d64`]]);export{_ as default};