import{x as B,y as D,E as T,w as j,M as N}from"./element-plus.55d71530.js";import{f as r,b as S}from"./index.e2bd5212.js";import{u as U}from"./vue-clipboard3.dca5bca3.js";import{d as $,r as F,b as L,ag as M,o as c,c as d,V as o,M as t,u as m,j as i,U as P,aa as R,L as q,a as p,S as z}from"./@vue.96c135a1.js";const A={class:"code-preview"},G={class:"flex",style:{height:"50vh"}},Q=$({__name:"code-preview",props:{modelValue:{type:Boolean},code:{}},emits:["update:modelValue"],setup(_,{emit:f}){const b=_,V=f,{toClipboard:h}=U(),n=F("index0"),g=async a=>{try{await h(a),r.msgSuccess("\u590D\u5236\u6210\u529F")}catch{r.msgError("\u590D\u5236\u5931\u8D25")}},s=L({get(){return b.modelValue},set(a){V("update:modelValue",a)}});return(a,l)=>{const v=M("highlightjs"),y=T,C=S,E=j,k=B,x=D,w=N;return c(),d("div",A,[o(w,{modelValue:m(s),"onUpdate:modelValue":l[1]||(l[1]=e=>i(s)?s.value=e:null),width:"900px",title:"\u4EE3\u7801\u9884\u89C8"},{default:t(()=>[o(x,{modelValue:m(n),"onUpdate:modelValue":l[0]||(l[0]=e=>i(n)?n.value=e:null)},{default:t(()=>[(c(!0),d(P,null,R(a.code,(e,u)=>(c(),q(k,{label:e.name,name:`index${u}`,key:u},{default:t(()=>[p("div",G,[o(y,{class:"flex-1"},{default:t(()=>[o(v,{autodetect:"",code:e.content},null,8,["code"])]),_:2},1024),p("div",null,[o(E,{onClick:H=>g(e.content),type:"primary",link:""},{icon:t(()=>[o(C,{name:"el-icon-CopyDocument"})]),default:t(()=>[z(" \u590D\u5236 ")]),_:2},1032,["onClick"])])])]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])])}}});export{Q as _};
