import{x as B,y as D,E as T,w as j,J as N}from"./element-plus.9cae3cb1.js";import{f as r,b as S}from"./index.7f83e315.js";import{u as U}from"./vue-clipboard3.dca5bca3.js";import{d as $,r as F,b as L,ag as J,o as c,c as d,V as o,M as t,u as m,j as i,U as M,aa as P,L as R,a as p,S as q}from"./@vue.96c135a1.js";const z={class:"code-preview"},A={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=J("highlightjs"),y=T,C=S,E=j,k=B,x=D,w=N;return c(),d("div",z,[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(M,null,P(a.code,(e,u)=>(c(),R(k,{label:e.name,name:`index${u}`,key:u},{default:t(()=>[p("div",A,[o(y,{class:"flex-1"},{default:t(()=>[o(v,{autodetect:"",code:e.content},null,8,["code"])]),_:2},1024),p("div",null,[o(E,{onClick:G=>g(e.content),type:"primary",link:""},{icon:t(()=>[o(C,{name:"el-icon-CopyDocument"})]),default:t(()=>[q(" \u590D\u5236 ")]),_:2},1032,["onClick"])])])]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])])}}});export{Q as _};
