import{l as t,a4 as a,$ as e,a2 as s,z as i,Y as m,x as o,dH as n,bj as c,bn as l,d as r}from"./utils-lib.js?v=20260328163632";import{Z as d,aI as p,az as u,W as y,aN as b,aO as h}from"./index115.js?v=20260328163632";import{k as f,r as x,m as j,o as _,V as g,W as k,O as w,a3 as N,Y as v}from"./base-lib.js?v=20260328163632";import"./naive-ui.js?v=20260328163632";import"./__commonjsHelpers__.js?v=20260328163632";import"./env-lib.js?v=20260328163632";import"./index88.js?v=20260328163632";const q={class:"py-[10px] px-16px"},D=f({__name:"index",props:{compData:{default:()=>({})}},emits:["close"],setup(f,{expose:D,emit:H}){const C=r(),z=f,E=H,L=x({columns:[{title:t("版本时间"),key:"mtime",render:t=>j("span",{},(t=>{const a=new Date(1e3*Number(t));return isNaN(a.getTime())?t:m(a)})(t.mtime))},a([{onClick:async t=>{const a=await o({request:c({filename:t.path})}),e=p(d.id);a.status?(u.value={id:d.id,st_mtime:t.mtime,path:d.path,type:"editor"},E("close"),await y({title:"".concat(d.title," <-> ").concat(d.title),type:"diff",mode:"diff",path:d.path}),await b({mode:"ace/mode/".concat(d.mode),left:{content:a.data.data,editable:!1,copyLinkEnabled:!1},right:{content:e.getValue(),editable:!1,copyLinkEnabled:!1}})):C.request(a)},width:65,title:"文件对比"},{onClick:async a=>{await i({title:t("恢复历史文件"),content:t("是否恢复历史文件 {0}?恢复历史文件后，当前文件内容将会被替换！",[m(Number(a.mtime))])}),o({loading:t("正在恢复历史文件，请稍后..."),request:n({filename:d.path,history_name:m(Number(a.mtime),"yyyyMMddHHmmss")}),message:!0,success:t=>{t.status&&(z.compData.callback(),T())}})},title:"恢复"},{onClick:async a=>{await i({title:t("删除历史文件"),content:t("是否删除历史文件 {0}?删除历史文件后，将无法恢复！",[m(Number(a.mtime))])}),o({loading:t("正在删除历史文件，请稍后..."),request:l({filename:a.path}),message:!0,success:t=>{t.status&&T()}})},title:"删除"}])],data:z.compData.editorTabsActive.history||[]}),[M,O]=e(L),T=async()=>{try{const{data:t}=await h(d.path);L.value.data=t.history}catch(t){}};return _((()=>{T()})),D({}),(t,a)=>(g(),k("div",q,[w(v(s),null,{content:N((()=>[w(v(M),{"max-height":400})])),_:1})]))}});export{D as default};
