"use strict";(self.webpackChunkdami=self.webpackChunkdami||[]).push([[8071],{78071:(e,t,a)=>{a.r(t),a.d(t,{default:()=>x});var s=a(49963),l=a(2262),n=a(66252),o=a(3577),r=a(47421),i=a(17054),d=a(15615),u=a(53740),c=a(78120),y=a(31862),f=a(45383),p=a(23732),g=a(42468),m=a(64747);const h={key:0,class:"absolute text-xs text-gray-300 px-2 items-center bottom-0 left-0 w-full h-6 flex z-10"},v=(0,n._)("div",{class:"flex-grow"},null,-1),x={__name:"SharedCodemirror",props:{lang:{type:String,default:"javascript"},modelValue:{type:String,default:""},readonly:{type:Boolean,default:!1},lineNumbers:{type:Boolean,default:!0},extensions:{type:[Object,Array],default:()=>[]},hideLang:Boolean},emits:["change","update:modelValue"],setup(e,{emit:t}){const a=e;(0,s.useCssVars)((e=>({"5174e0b9":(0,l.SU)(m.h).whiteSpace})));let x=null;const b={json:d.AV,javascript:g.eJ,html:u.dy,css:i.iv},k=(0,l.iH)(null),w=r.tk.updateListener.of((e=>{if(e.docChanged){e.state.sliceDoc(0,20);const a=e.state.doc.toString();t("change",a),t("update:modelValue",a)}})),S=Array.isArray(a.extensions)?a.extensions:[a.extensions],V=c.yy.create({doc:a.modelValue,extensions:[p.vk,y.Xy,w,b[a.lang]?.(),c.yy.tabSize.of(2),r.$f.of([f.oc]),c.yy.readOnly.of(a.readonly),...S]});return(0,n.YP)((()=>a.modelValue),(e=>{e!==x.state.doc.toString()&&x.dispatch({changes:{from:0,to:x.state.doc.length,insert:e}})})),(0,n.bv)((()=>{x=new r.tk({state:V,parent:k.value})})),(0,n.Jd)((()=>{x?.destroy()})),(t,a)=>((0,n.wg)(),(0,n.iD)("div",{ref_key:"containerEl",ref:k,class:(0,o.normalizeClass)([{"hide-gutters":!e.lineNumbers},"codemirror relative overflow-auto rounded-lg"])},[e.hideLang?(0,n.kq)("",!0):((0,n.wg)(),(0,n.iD)("div",h,[v,(0,n._)("span",null,(0,o.toDisplayString)(e.lang),1)]))],2))}}}}]);