import{d,Q as P}from"./QBtn.9455f382.js";import{Q as c,a as A,b as K}from"./QToolbarTitle.4eccf591.js";import{Q as Z}from"./MainPage.683ca653.js";import{x as j,v as G,J,y as O,I as Y,r as i,i as W,k as X,w as U,z as m,K as g,C as e,B as a,Y as ee,Z as te,H as D,F as t,D as u,E as h,G as oe,V as ae}from"./index.f89c7e6e.js";import le from"./CodeEditor.d9a6ae07.js";import{k,aP as ie,aQ as se,ax as re,v as T}from"./QTable.18dd05c1.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,Te={__name:"MarkdownEditor",props:{height:{type:Number,required:!0},width:{type:Number,required:!0},recordID:String},setup(B){const _=j(),R=G();J(R);const{t:r}=O();Y();const p=i(50),f=i([20,80]),z=i(null),n=B,$=W("editorData");X(()=>{H(),F(),L()}),U(()=>n.height,s=>{H()}),U(()=>n.recordID,s=>{M.value=0,F(),L()});const H=()=>{y.value=n.height-q.value,Q.value=y.value-6,S.value="height:"+y.value+"px"},y=i(100),Q=i(100),q=i(29),S=i("height: 400px;"),b=i(!1),L=()=>{b.value=!ie(n.recordID)||se(n.recordID)},w=i("sidebyside"),C=s=>{w.value=s,s=="sidebyside"?(f.value=[20,80],p.value=50):s=="source"?(f.value=[99,100],p.value=99):(f.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"}],x=s=>{z.value.onAction(s)},V=i(""),M=i(0),N=()=>{M.value++},F=()=>{V.value=re(n.recordID)};return(s,o)=>(m(),g("div",null,[e(K,{class:D(t(T)("toolbar-light editor-toolbar","toolbar-dark editor-toolbar"))},{default:a(()=>[w.value!="preview"?(m(),g("div",pe,[(m(),g(ee,null,te(E,l=>e(d,{key:l.action,flat:"",dense:"",onClick:ke=>x(l.action),disable:b.value},{default:a(()=>[e(P,{name:l.icon,size:"17px",class:D(t(T)("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=>x("undo")),disable:b.value},{default:a(()=>[e(t(he),{size:v,class:D(t(T)("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=>x("redo")),disable:b.value},{default:a(()=>[e(t(ue),{size:v,class:D(t(T)("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"])])):oe("",!0),e(A),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(Z,{modelValue:p.value,"onUpdate:modelValue":o[5]||(o[5]=l=>p.value=l),limits:f.value,style:ae(S.value)},{before:a(()=>[e(le,{ref_key:"actualEditor",ref:z,width:"100%",height:y.value,recordID:t($).recordID,onTextUpdated:N},null,8,["height","recordID"])]),after:a(()=>[(m(),g("iframe",{class:"DTFrame",width:"100%",height:Q.value,src:V.value,frameborder:"0",key:M.value},null,8,ve))]),_:1},8,["modelValue","limits","style"])]))}};export{Te as default};
