import{Q as d,e as A}from"./QBtn.bea536be.js";import{Q as c,a as P,b as Z}from"./QToolbarTitle.64e67d75.js";import{k,aL as j,aM as G,av as J,v as g,a8 as K}from"./QTable.e346e9cb.js";import{x as O,v as Y,I as W,y as X,R as ee,r as i,i as te,k as oe,w as R,z as m,J as D,C as e,B as a,Y as ae,Z as le,H as T,F as t,D as u,E as h,G as ie,V as se}from"./index.98090efd.js";import re from"./CodeEditor.310f3181.js";/**
 * @license lucide-vue-next v0.406.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ne=k("Columns2Icon",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);/**
 * @license lucide-vue-next v0.406.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const de=k("FileCodeIcon",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);/**
 * @license lucide-vue-next v0.406.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ce=k("FileTextIcon",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
 * @license lucide-vue-next v0.406.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ue=k("RedoIcon",[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]);/**
 * @license lucide-vue-next v0.406.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const he=k("UndoIcon",[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]]),pe={key:0},ve=["height","src"],v=17,De={__name:"MarkdownEditor",props:{height:{type:Number,required:!0},width:{type:Number,required:!0},recordID:String},setup(U){const _=O(),B=Y();W(B);const{t:r}=X();ee();const p=i(50),y=i([20,80]),z=i(null),n=U,$=te("editorData");oe(()=>{H(),F(),V()}),R(()=>n.height,s=>{H()}),R(()=>n.recordID,s=>{x.value=0,F(),V()});const H=()=>{f.value=n.height-q.value,L.value=f.value-6,S.value="height:"+f.value+"px"},f=i(100),L=i(100),q=i(29),S=i("height: 400px;"),b=i(!1),V=()=>{b.value=!j(n.recordID)||G(n.recordID)},w=i("sidebyside"),C=s=>{w.value=s,s=="sidebyside"?(y.value=[20,80],p.value=50):s=="source"?(y.value=[99,100],p.value=99):(y.value=[0,0],p.value=0)},I=s=>{var o=_.iconColor;return s==w.value&&(o=_.defaultStyles.iconColorBlue),o},E=[{icon:"icon-icons8-bold",action:"bold",tooltip:"bold"},{icon:"icon-icons8-Italic",action:"italic",tooltip:"italic"},{icon:"icon-icons8-underline",action:"underline",tooltip:"underline"},{icon:"icon-icons8-strikethrough",action:"strike",tooltip:"strikethrough"},{icon:"icon-icons8-highlight",action:"highlight",tooltip:"highlight"}],M=s=>{z.value.onAction(s)},Q=i(""),x=i(0),N=()=>{x.value++},F=()=>{Q.value=J(n.recordID)};return(s,o)=>(m(),D("div",null,[e(Z,{class:T(t(g)("toolbar-light editor-toolbar","toolbar-dark editor-toolbar"))},{default:a(()=>[w.value!="preview"?(m(),D("div",pe,[(m(),D(ae,null,le(E,l=>e(d,{key:l.action,flat:"",dense:"",onClick:ke=>M(l.action),disable:b.value},{default:a(()=>[e(A,{name:l.icon,size:"17px",class:T(t(g)("toolbar-icon-light","toolbar-icon-dark"))},null,8,["name","class"]),e(c,{class:"DTTooltip",delay:1e3},{default:a(()=>[u(h(t(r)(l.tooltip)),1)]),_:2},1024)]),_:2},1032,["onClick","disable"])),64)),e(d,{flat:"",dense:"",onClick:o[0]||(o[0]=l=>M("undo")),disable:b.value},{default:a(()=>[e(t(he),{size:v,class:T(t(g)("toolbar-icon-light","toolbar-icon-dark"))},null,8,["class"]),e(c,{class:"DTTooltip",delay:1e3},{default:a(()=>[u(h(t(r)("undo")),1)]),_:1})]),_:1},8,["disable"]),e(d,{flat:"",dense:"",onClick:o[1]||(o[1]=l=>M("redo")),disable:b.value},{default:a(()=>[e(t(ue),{size:v,class:T(t(g)("toolbar-icon-light","toolbar-icon-dark"))},null,8,["class"]),e(c,{class:"DTTooltip",delay:1e3},{default:a(()=>[u(h(t(r)("redo")),1)]),_:1})]),_:1},8,["disable"])])):ie("",!0),e(P),e(d,{flat:"",dense:"",onClick:o[2]||(o[2]=l=>C("preview"))},{default:a(()=>[e(t(ce),{size:v,"stroke-width":"1.5",color:I("preview")},null,8,["color"]),e(c,{class:"DTTooltip",delay:1e3},{default:a(()=>[u(h(t(r)("preview")),1)]),_:1})]),_:1}),e(d,{flat:"",dense:"",onClick:o[3]||(o[3]=l=>C("source"))},{default:a(()=>[e(t(de),{size:v,"stroke-width":"1.5",color:I("source")},null,8,["color"]),e(c,{class:"DTTooltip",delay:1e3},{default:a(()=>[u(h(t(r)("source")),1)]),_:1})]),_:1}),e(d,{flat:"",dense:"",onClick:o[4]||(o[4]=l=>C("sidebyside"))},{default:a(()=>[e(t(ne),{size:v,"stroke-width":"1.5",color:I("sidebyside")},null,8,["color"]),e(c,{class:"DTTooltip",delay:1e3},{default:a(()=>[u(h(t(r)("sidebyside")),1)]),_:1})]),_:1})]),_:1},8,["class"]),e(K,{modelValue:p.value,"onUpdate:modelValue":o[5]||(o[5]=l=>p.value=l),limits:y.value,style:se(S.value)},{before:a(()=>[e(re,{ref_key:"actualEditor",ref:z,width:"100%",height:f.value,recordID:t($).recordID,onTextUpdated:N},null,8,["height","recordID"])]),after:a(()=>[(m(),D("iframe",{class:"DTFrame",width:"100%",height:L.value,src:Q.value,frameborder:"0",key:x.value},null,8,ve))]),_:1},8,["modelValue","limits","style"])]))}};export{De as default};
