import{g as v,h as b,x as D,L as y,r as E,o as h,c as w,b as t,w as u,e as l,bL as k}from"./index.df7b46f6.js";function C(_){const{container:d=document.body,width:c="240",height:n="100",textAlign:f="left",textBaseline:F="bottom",font:s="16px Microsoft Yahei",fillStyle:o="#000",content:e="Vue Admin Perfect",globalAlpha:r=.3,rotate:p=16,zIndex:a=1e3,isCancel:B=!0}=_,i=document.createElement("canvas");i.setAttribute("width",c),i.setAttribute("height",n);const m=i.getContext("2d");m.globalAlpha=r,m.textAlign=f,m.textBaseline=F,m.font=s,m.fillStyle=o,m.rotate(Math.PI*p/180),m.fillText(e,50,50);const x=i.toDataURL(),A=document.querySelector(".__wm")||document.createElement("div"),g=`
    position:absolute;
    top:0px;
    left:0px;
    width:100%;
    height:100%;
    z-index:${a};
    pointer-events:none;
    background-repeat:repeat;
    background-image:url('${x}')`;A.setAttribute("style",g),A.classList.add("__wm"),d.style.position="relative",d.appendChild(A)}const S={class:"m-water-marker"},M=v({__name:"index",setup(_){const d=b(.2);let c=b(-1);const n={rotate:-10,globalAlpha:d.value};function f(o,e){const r=e-o,p=Math.random();return(o+r*p).toFixed(0)}const F=["red"];for(let o=0;o<30;o++)F.push(k());const s=o=>{switch(o){case-1:c.value=o,n.container=document.getElementsByClassName("m-water-marker")[0],C(n);return;case 0:c.value=o,delete n.container,C(n);return;case 1:n.fillStyle="#000",C(n);return;case 2:n.fillStyle=F[f(0,30)],C(n);return;case 3:n.globalAlpha=d.value,C(n);return;case 4:y(()=>{const e=document.getElementsByClassName("__wm")[0];e&&(c.value===-1?e.remove():document.body.removeChild(e))})}};return D(()=>{y(()=>{s(-1)})}),(o,e)=>{const r=E("el-button"),p=E("el-input"),a=E("el-descriptions-item"),B=E("el-descriptions");return h(),w("div",S,[t(r,{onClick:e[0]||(e[0]=i=>s(-1)),type:"primary"},{default:u(()=>[l("\u9ED8\u8BA4\u5C40\u90E8\u6C34\u5370")]),_:1}),t(r,{onClick:e[1]||(e[1]=i=>s(0)),type:"primary"},{default:u(()=>[l("\u751F\u6210\u5168\u5C40\u6C34\u5370")]),_:1}),t(r,{onClick:e[2]||(e[2]=i=>s(1)),type:"primary"},{default:u(()=>[l("\u751F\u6210\u9ED8\u8BA4\u989C\u8272\u6C34\u5370")]),_:1}),t(r,{onClick:e[3]||(e[3]=i=>s(2)),type:"primary"},{default:u(()=>[l("\u751F\u6210\u968F\u673A\u989C\u8272\u6C34\u5370")]),_:1}),t(p,{modelValue:d.value,"onUpdate:modelValue":e[4]||(e[4]=i=>d.value=i),style:{width:"100px","margin-left":"20px"}},null,8,["modelValue"]),t(r,{onClick:e[5]||(e[5]=i=>s(3)),type:"primary"},{default:u(()=>[l("\u8BBE\u7F6E\u900F\u660E\u5EA6")]),_:1}),t(r,{onClick:e[6]||(e[6]=i=>s(4)),type:"primary"},{default:u(()=>[l("\u53D6\u6D88\u6C34\u5370")]),_:1}),t(B,{title:"\u914D\u7F6E\u9879 ",column:1,border:"",class:"descriptions"},{default:u(()=>[t(a,{label:"content"},{default:u(()=>[l(" \u6C34\u5370\u5185\u5BB9\uFF0C\u9ED8\u8BA4\u4E3A 'Vue Admin Perfect' ")]),_:1}),t(a,{label:"container"},{default:u(()=>[l(" \u6C34\u5370\u5BB9\u5668\uFF0C\u9ED8\u8BA4\u751F\u6210\u5728 document.body \u4E0B\u9762 ")]),_:1}),t(a,{label:"globalAlpha"},{default:u(()=>[l(" \u8BBE\u7F6E\u56FE\u5F62\u548C\u56FE\u50CF\u900F\u660E\u5EA6\u7684\u503C\uFF0C\u9ED8\u8BA4\u4E3A 0.3 ")]),_:1}),t(a,{label:"height"},{default:u(()=>[l(" \u6C34\u5370\u9AD8\u5EA6\uFF0C\u9ED8\u8BA4\u4E3A 240 ")]),_:1}),t(a,{label:"width"},{default:u(()=>[l(" \u6C34\u5370\u5BBD\u5EA6\uFF0C\u9ED8\u8BA4\u4E3A 100 ")]),_:1}),t(a,{label:"fillStyle"},{default:u(()=>[l(" \u6C34\u5370\u989C\u8272\uFF0C\u9ED8\u8BA4\u4E3A '#000' ")]),_:1}),t(a,{label:"textAlign"},{default:u(()=>[l(" \u6587\u5B57\u5BF9\u9F50\uFF0C\u9ED8\u8BA4\u4E3A 'left' ")]),_:1}),t(a,{label:"textBaseline"},{default:u(()=>[l(" \u57FA\u51C6\u7EBF\uFF0C\u9ED8\u8BA4\u4E3A 'bottom' ")]),_:1}),t(a,{label:"rotate"},{default:u(()=>[l(" \u6587\u5B57\u65CB\u8F6C\u89D2\u5EA6\uFF0C\u9ED8\u8BA4\u4E3A '16' \u8BA1\u7B97\u65B9\u5F0F\u4E3A (Math.PI * rotate) / 180 ")]),_:1}),t(a,{label:"iconStyle"},{default:u(()=>[l(' \u56FE\u6807\u7684\u6837\u5F0F\uFF0C\u9ED8\u8BA4\u6837\u5F0F\u4E3A { width: "1em", height: " 1em" } ')]),_:1})]),_:1})])}}});export{M as default};
