const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./DsTJo1qP.js","./BvNnk7SS.js","./entry.Le7YthGh.css"])))=>i.map(i=>d[i]);
import{d as x,r as k,X as w,Y as B,G as p,_ as L,Z as C,o as s,e as y,p as N,f as M,N as S,E as b,a0 as U,a1 as I,bo as j,b as _,a as E,c as v,w as D,D as $,i as z,aa as T,a2 as A,a3 as P}from"./BvNnk7SS.js";import{_ as G}from"./PcnCkWCW.js";import{_ as W}from"./Cs47TkFU.js";import"./CuzaDH-7.js";import"./DXjXgEo6.js";const X=x({__name:"MonacoDiffEditor.client",props:{lang:{default:()=>"plaintext"},options:{default:()=>({})},original:{default:()=>""},modelValue:{default:()=>""}},emits:["update:modelValue","load"],setup(r,{expose:u,emit:V}){const e=r,g=V,m=k(!0),i=w(),d=B();let n,o,t;const l=w(),a={automaticLayout:!0};return p(()=>[e.original,e.modelValue],()=>{(o.getValue()!==e.original||t.getValue()!==e.modelValue)&&(o.setValue(e.original),t.setValue(e.modelValue))}),p(()=>e.lang,()=>{const f=o?.getValue()||e.original,c=t?.getValue()||e.modelValue;o&&o.dispose(),t&&t.dispose(),o=d.editor.createModel(f,e.lang),t=d.editor.createModel(c,e.lang),n.setModel({original:o,modified:t})}),p(()=>e.options,()=>{n?.updateOptions(L(e.options,a))}),u({$editor:l}),p(i,(f,c)=>{!i.value||c||(n=d.editor.createDiffEditor(i.value,L(e.options,a)),l.value=n,o=d.editor.createModel(e.original,e.lang),t=d.editor.createModel(e.modelValue,e.lang),n.setModel({original:o,modified:t}),n.onDidUpdateDiff(()=>{g("update:modelValue",n.getModel().modified.getValue())}),m.value=!1,g("load",n))}),C(()=>{n?.dispose(),o?.dispose(),t?.dispose()}),(f,c)=>(s(),y("div",{ref_key:"editorElement",ref:i},[m.value?N(f.$slots,"default",{key:0}):M("",!0)],512))}}),Y=T(W),Z=T(X),q=A(()=>P(()=>import("./DsTJo1qP.js"),__vite__mapDeps([0,1,2]),import.meta.url).then(r=>r.default||r)),F={key:0,flex:"~ col gap6",class:"file-container-loading","h-full":"","items-center":"","justify-center":""},H={key:1},J={flex:"","items-center":"","bg-active":"","justify-between":""},K={key:0,"h-full":""},ne=x({__name:"EditorDiff",props:{change:{},readOnly:{type:Boolean}},emits:["update:modelValue","focus","blur"],setup(r){const u=r,{editItem:V}=S(),{content:e,isLoading:g}=V(u.change.key),m=b(()=>U(u.change.key));I(async()=>{});const i=b(()=>u.change.original||""),d=k(),n=k(),o=j(),t={theme:`vs-${o.value}`,minimap:{enabled:!1},scrollBeyondLastLine:!1,automaticLayout:!0,readOnly:u.readOnly,roundedSelection:!0,wordWrap:"on",lineNumbers:"off",folding:!1,padding:{top:10,bottom:10}};return p(o,l=>{d.value?.$editor._themeService.setTheme(`vs-${l}`),n.value?.$editor._themeService.setTheme(`vs-${l}`)}),(l,a)=>{const f=G,c=Y,O=Z,R=q;return _(g)||_(e)===null||_(e)===void 0?(s(),y("div",F,a[2]||(a[2]=[E("div",{op50:"","i-carbon-circle-dash":"",h10:"",w10:"","animate-spin":""},null,-1),E("div",{"text-lg":"",op50:""}," Loading... ",-1)]))):(s(),y("div",H,[E("div",J,[l.change?.action==="DELETE"?(s(),v(f,{key:0,icon:"i-carbon-warning-filled",n:"red","w-full":"","rounded-none":""},{default:D(()=>a[3]||(a[3]=[$(" This file has been deleted. ")])),_:1})):M("",!0)]),["text","data"].includes(l.change.type)?(s(),y("div",K,[l.change?.action==="DELETE"?(s(),v(c,{key:0,ref_key:"editorRef",ref:d,options:{...t,readOnly:!0},lang:m.value,"model-value":i.value,"h-full":"","w-full":"","of-auto":""},null,8,["options","lang","model-value"])):(s(),v(O,{key:1,ref_key:"diffEditorRef",ref:n,modelValue:_(e),"onUpdate:modelValue":a[0]||(a[0]=h=>z(e)?e.value=h:null),options:t,original:i.value,lang:m.value,"h-full":"","w-full":"","of-auto":""},{default:D(()=>a[4]||(a[4]=[$(" Loading... ")])),_:1},8,["modelValue","original","lang"]))])):l.change.type==="image"?(s(),v(R,{key:1,modelValue:i.value,"onUpdate:modelValue":a[1]||(a[1]=h=>i.value=h)},null,8,["modelValue"])):M("",!0)]))}}});export{ne as default};
