物管理前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

1 lines
34 KiB

import{c as Y,s as _,ah as Be,d as De,t as oe,o as R,f as j,w as Ce,M as xe,b as F,F as _e,r as Ze,n as Q,av as Wt,aw as Vt,g as ne,u as E,k as Re,h as W,j as Ie,v as ze,S as Ht,e as le,Q as Ft,y as ke,z as Me,p as Je,P as Pe,W as Ot,q as qt,m as qe,a as jt}from"./index-bVOhw2NF.js";import{u as Ut,_ as Gt,a as Kt}from"./vue-repl-jaFwbjhK.js";import{_ as Qt,u as Zt}from"./codemirror-editor-CFwWTn8s.js";import{G as Jt}from"./GridRect-B5GXph4N.js";import{u as We,a as en}from"./editor-ouq_SSv2.js";import"./helpers-CjmtV6uB.js";import{i as et,e as Ee}from"./common-CalHcBJp.js";import{f as tn,i as nn,j as on,k as an,c as sn}from"./index-C8mAaM2V.js";import{p as je,T as rn,o as ln}from"./style-D4sssT3k.js";function un(o,n){const e=Y(()=>{var l;return((l=o.value.container)==null?void 0:l.scaleRatio)||100}),t=_();function s(l){let v=!1;o.value.elements.forEach(x=>{x.selected&&(x.selected=!1,v=!0)}),t.value=!1,v||n.value.onMouseDown(l)}function c(l){for(let v=0;v<o.value.elements.length;v++){const x=o.value.elements[v],i=l.left<x.left&&l.left+l.width>x.left+x.width,k=l.top<x.top&&l.top+l.height>x.top+x.height;i&&k?x.selected=!0:x.selected=!1}}function p(){t.value=o.value.elements.some(l=>l.selected),t.value&&setTimeout(()=>{document.addEventListener("click",()=>{t.value=!1},{once:!0})})}function a(l,v){if(!v)return;const x=l.target,{clientX:i,clientY:k}=l,{left:h,top:m}=x.getBoundingClientRect(),f=i-h,M=k-m,d=f/(e.value/100),g=M/(e.value/100),r=et({name:"es-text",nameCn:"输入文本",dataMap:!1,isRemote:!1});r.left=d,r.top=g,r.props.options={text:"",inputingText:!0,link:"","font-family":"Microsoft Yahei",color:"#1890ff","font-size":20,"font-weight":"normal",paddingX:2,paddingY:2,"justify-content":"start","writing-mode":"horizontal-tb","letter-spacing":2,"border-width":0,"border-color":"#ffffff","border-radius":2,"background-color":"#CD171700",textFormat:"",gradientFontColor:"",valueColor:"",valueNumberConfig:!1,wanFormat:!1,valueDecimal:2,textEditable:!0},r.height=50,r.width=150,r.selected=!0,o.value.elements.push(r),setTimeout(()=>{const w=document.getElementById(r.id).querySelector(".val-widget");w&&w.focus()},200)}return{areaSelected:t,onEditorMouseDown:s,onAreaMove:c,onAreaUp:p,onAreaClick:a}}function Ve(){const o=_(!1);return Be(document,"keydown",n=>{n.code==="Space"&&(o.value=!0)}),Be(document,"keyup",n=>{n.code==="Space"&&(o.value=!1)}),o}function cn(o){const n=Ve(),e=document.querySelector(o);Be(e,"mousedown",a);let t=0,s=0,c=!1;const p={left:0,top:0};function a(x){p.left=e.scrollLeft,p.top=e.scrollTop,e.addEventListener("mousemove",l),e.addEventListener("mouseup",v),t=x.clientX,s=x.clientY,c=!0}function l(x){if(c&&n.value){const i=x.clientX-t,k=x.clientY-s;e.scrollTo({left:p.left-i,top:p.top-k})}}function v(){c=!1,e.removeEventListener("mousemove",l),e.removeEventListener("mouseup",v)}}function dn(o,n,e,t){const s=document.querySelector(o);let c=!1,p={},a={},l=[],v=null;function x(d){t.value&&(c?(clearTimeout(v),v=setTimeout(()=>{if(c=!0,d.ctrlKey||(a={x:d.offsetX,y:d.offsetY}),p.x===a.x&&p.y===a.y){clearTimeout(v),k();return}l.push({start:p,end:a}),p=a,f()},100)):v=setTimeout(()=>{c=!0,p={x:d.offsetX,y:d.offsetY},a={x:d.offsetX,y:d.offsetY},m()},100),s.addEventListener("mousemove",i),s.addEventListener("dblclick",h))}function i(d){if(c){if(d.ctrlKey){const g=[0,45,90,180,270,360];a={x:d.offsetX,y:d.offsetY};const r=a.x-p.x,y=a.y-p.y;let w=Math.atan2(y,r)*180/Math.PI;w<0&&(w+=360);let C=0;for(const X of g)(!C||Math.abs(w-X)<Math.abs(w-C))&&(C=X);const L=Math.sqrt(r*r+y*y),$=C*Math.PI/180;a.x=p.x+L*Math.cos($),a.y=p.y+L*Math.sin($)}else a={x:d.offsetX,y:d.offsetY};m()}}function k(){c=!1,p={},a={};const d=[];l.forEach((r,y)=>{y===0?d.push({x:r.start.x,y:r.start.y}):d.push({x:r.end.x,y:r.end.y})}),n(d),l=[],v=null;const g=s.querySelector(".pathContainer");s.removeChild(g),s.removeEventListener("mousemove",i),s.removeEventListener("dblclick",h),t.value=!1}function h(){clearTimeout(v),k()}function m(){const d=s.querySelector(".pathContainer");if(!d)M();else{const g=d.querySelector("path");let r="";if(l.length===0)r=`M${p.x},${p.y} L${a.x},${a.y}`,l.push({start:p,end:a});else{for(let y=0;y<l.length;y++){const w=l[y];y===0?r+=`M${w.start.x},${w.start.y} `:r+=`L${w.end.x},${w.end.y} `}r+=`L${a.x},${a.y}`}g.setAttribute("d",r),g.setAttribute("fill","none"),g.setAttribute("stroke","#FFB243"),g.setAttribute("class","path")}}function f(){const d=s.querySelector(".pathContainer");if(!d)M();else{d&&s.removeChild(d);const g=document.createElementNS("http://www.w3.org/2000/svg","svg");g.setAttribute("viewBox","0 0 1920 1080"),g.setAttribute("class","pathContainer");const r=document.createElementNS("http://www.w3.org/2000/svg","path");let y="";for(let w=0;w<l.length;w++){const C=l[w];w===0?y+=`M${C.start.x},${C.start.y} `:y+=`L${C.end.x},${C.end.y} `}r.setAttribute("d",y.trimEnd()),r.setAttribute("class","path"),r.setAttribute("fill","none"),r.setAttribute("stroke","#FFB243"),g.appendChild(r),s.appendChild(g)}}function M(){const d=document.createElementNS("http://www.w3.org/2000/svg","svg");d.setAttribute("viewBox","0 0 1920 1080"),d.setAttribute("class","pathContainer");for(let g=0;g<l.length;g++){const r=l[g],y=document.createElementNS("http://www.w3.org/2000/svg","path"),w=`M${r.start.x},${r.start.y} L${r.end.x},${r.end.y}`;y.setAttribute("d",w),y.setAttribute("class","path"),d.appendChild(y)}if(c){const g=document.createElementNS("http://www.w3.org/2000/svg","path"),r=`M${p.x},${p.y} L${a.x},${a.y}`;g.setAttribute("d",r),g.setAttribute("class","dashed-path"),d.appendChild(g)}s.appendChild(d)}s&&s.addEventListener("mousedown",x)}function pn(o,n){const e=n.x-o.x,t=n.y-o.y;return Math.sqrt(e*e+t*t)}function fn(o,n,e){const t=e.x-n.x,s=e.y-n.y,c=((o.x-n.x)*t+(o.y-n.y)*s)/(t*t+s*s);let p;return c<0?p=n:c>1?p=e:p={x:n.x+c*t,y:n.y+c*s},pn(o,p)}function hn(o,n){let e=Number.MAX_SAFE_INTEGER,t=-1;for(let s=0;s<o.length-1;s++){const c=o[s],p=o[s+1],a=fn(n,c,p);a<e&&(e=a,t=s+1)}o.splice(t,0,n)}const tt=!1,nt=5,ot=3,at="#FF1900",st="none",rt="",lt={width:66,height:66,x:0,y:-33,repeat:1,interval:2},it=!1,ut=12,ct=12,dt=12,pt="100%",ft=!1,ht=8,vt="blue",gt="square",mt="#28e8d8",yt=4,bt="solid",wt="#1B1B93FF",xt=8,kt=[{color:"rgba(46,165,255,1)",hex:"#2ea5ff",rgba:{r:46,g:165,b:255,a:1},pst:0},{color:"rgba(20,51,204,1)",hex:"#1433cc",rgba:{r:20,g:51,b:204,a:1},pst:2},{color:"rgba(46,165,255,1)",hex:"#2ea5ff",rgba:{r:46,g:165,b:255,a:1},pst:50},{color:"rgba(20,51,204,1)",hex:"#1433cc",rgba:{r:20,g:51,b:204,a:1},pst:98},{color:"rgba(46,165,255,1)",hex:"#2ea5ff",rgba:{r:46,g:165,b:255,a:1},pst:100}],Mt="linear-gradient(90deg, rgba(46,165,255,1) 0%,rgba(20,51,204,1) 2%,rgba(46,165,255,1) 50%,rgba(20,51,204,1) 98%,rgba(46,165,255,1) 100%)",Ct=!0,Et="es_animate_dash",Lt="20s",Dt="none",St="",$t=null,At=null,Yt=[],Xt=!1,Pt={x:22,y:12,blur:6,color:"rgba(0,0,0,0.35)"},Tt={showCorner:tt,radius:nt,"is2.5d":!1,cornerWidth:ot,cornerBack:at,animationStyle:st,animationImage:rt,animationImgStyle:lt,animationReverse:it,strokeDashWidth:ut,strokeDashWidth2:ct,strokeDashSpace:dt,strokeDashoffset:pt,circlePointMoving:ft,circlePointWidth:ht,circlePointBackground:vt,strokeLineCap:gt,borderColor:mt,borderWidth:yt,borderStyle:bt,backgroundColor:wt,backgroundWidth:xt,gradientBg:kt,gradientStr:Mt,isAnimation:Ct,animationName:Et,animationDuration:Lt,arrowType:Dt,dataPoint:St,min:$t,max:At,animCondition:Yt,enableShadow:Xt,dropShadow:Pt},Qn=Object.freeze(Object.defineProperty({__proto__:null,animCondition:Yt,animationDuration:Lt,animationImage:rt,animationImgStyle:lt,animationName:Et,animationReverse:it,animationStyle:st,arrowType:Dt,backgroundColor:wt,backgroundWidth:xt,borderColor:mt,borderStyle:bt,borderWidth:yt,circlePointBackground:vt,circlePointMoving:ft,circlePointWidth:ht,cornerBack:at,cornerWidth:ot,dataPoint:St,default:Tt,dropShadow:Pt,enableShadow:Xt,gradientBg:kt,gradientStr:Mt,isAnimation:Ct,max:At,min:$t,radius:nt,showCorner:tt,strokeDashSpace:dt,strokeDashWidth:ut,strokeDashWidth2:ct,strokeDashoffset:pt,strokeLineCap:gt},Symbol.toStringTag,{value:"Module"}));function vn(o){let n=0,e=0;const t=[],s=[];o.forEach(v=>{t.push(v.x),s.push(v.y)});const c=Math.min(...t),p=Math.min(...s),a=Math.max(...t),l=Math.max(...s);return n=Math.abs(a-c),e=Math.abs(l-p),{maxWidth:n,maxHeight:e}}function Ue(o){let n=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY;o.forEach(c=>{c.x<n&&(n=c.x),c.y<e&&(e=c.y)});const{maxWidth:t,maxHeight:s}=vn(o);return{minLeft:n,minTop:e,maxWidth:t,maxHeight:s}}function gn(o,n){const e=_(!1),t=We(),s=Y({get:()=>t.current,set:i=>{t.current=i}}),c=Y(()=>t.data.elements);function p(i){if(i.length<2)return;const{minLeft:k,minTop:h,maxWidth:m,maxHeight:f}=Ue(i),M=et({name:"es-line",nameCn:"自由画线"});M.props.points=i.map(r=>({x:r.x-k,y:r.y-h})),M.props.options={...Tt};const d={...M,left:k,top:h,width:m,height:f};t.current=d;const g=[...t.data.elements,d];t.data.elements=g}function a(i,k){let h=0,m=0;const f=()=>{document.removeEventListener("mousemove",d,!0),document.removeEventListener("mouseup",f,!0),Ee.emit("dragend")},M=g=>{var y,w;const r=(y=g.target)==null?void 0:y.classList;if(r.contains("es-line-bg")||r.contains("es-line")||r.contains("es-line-rect")){i.value||c.value.forEach($=>{$.selected=!1}),h=g.clientX,m=g.clientY,document.addEventListener("mousemove",d,!0),document.addEventListener("mouseup",f,!0);const C=(w=g.target)==null?void 0:w.dataset.id,L=c.value.find($=>$.id===C);if(!L)return;L.selected=!0,s.value=L,k.value=L,Ee.emit("dragstart")}};document.addEventListener("mousedown",M,!0);function d(g){if(!s.value)return;const r=g.clientX-h,y=g.clientY-m;s.value.left+=r/(o.value/100),s.value.top+=y/(o.value/100),c.value.forEach(w=>{var C;w.selected&&((C=s.value)==null?void 0:C.id)!==w.id&&(w.left+=r/(o.value/100),w.top+=y/(o.value/100))}),h=g.clientX,m=g.clientY}}function l(i,k,h){const{x:m,y:f,index:M}=i,d=[];h.props.points.forEach((C,L)=>{L===M?d.push({x:m,y:f}):d.push({x:C.x+k.lineLeft,y:C.y+k.lineTop})});const{minLeft:g,minTop:r,maxWidth:y,maxHeight:w}=Ue(d);t.current.props.points=d.map(C=>({x:C.x-g,y:C.y-r})),t.current.left=g,t.current.top=r,t.current.width=y,t.current.height=w}function v(i,k){if(k.props.points.length<=2)return window.$popmessage({str:"至少需要两个点才能画线",type:"warn"});k.props.points.splice(i,1)}function x(i,k,h){const m=n.value.getBoundingClientRect();hn(h.props.points,{x:(i.clientX-m.left)/(o.value/100)-k.lineLeft,y:(i.clientY-m.top)/(o.value/100)-k.lineTop})}return{startDrawLines:e,finishDrawLine:p,updatePointHandler:l,deletePointHandler:v,addPointHandler:x,listenerMoving:a}}const mn={tag:{type:[String,Object],default:"div"},resizable:{type:Boolean,default:!0},rotatable:{type:Boolean,default:!1},boundary:{type:Boolean},disabled:Boolean,width:{type:Number,default:0},height:{type:Number,default:0},left:{type:Number,default:0},top:{type:Number,default:0},zIndex:{type:Number,default:0},angle:{type:Number,default:0},color:{type:String,default:"#3a7afe"},minWidth:{type:Number,default:-1/0},minHeight:{type:Number,default:-1/0},maxWidth:{type:Number,default:0},maxHeight:{type:Number,default:0},aspectRatio:{type:Number},selected:Boolean,snapToGrid:Boolean,gridX:{type:Number,default:50},gridY:{type:Number,default:50},scaleRatio:{type:Number,default:1},disabledKeyEvent:Boolean,border:{type:Boolean,default:!0},resizeList:{type:Array},equalProportion:{type:Boolean},checkCollision:{type:Boolean},snap:Boolean,snapThreshold:{type:Number,default:10},markline:[Boolean,Function]};function He(o,n){const e=t=>{n&&n(t),document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",e),document.removeEventListener("mouseleave",e),document.removeEventListener("touchmove",o),document.removeEventListener("touchend",e)};document.addEventListener("mousemove",o),document.addEventListener("mouseup",e),document.addEventListener("mouseleave",e),document.addEventListener("touchmove",o),document.addEventListener("touchend",e)}function ie(o){let n=0,e=0;if(yn(o)){const t=o.targetTouches[0];n=t.pageX,e=t.pageY}else n=o.clientX,e=o.clientY;return{clientX:n,clientY:e}}function yn(o){const n=Object.prototype.toString.call(o);return n.substring(8,n.length-1)==="TouchEvent"}const we=(o=0)=>parseInt(o+"")+"px",Te={n:"top",s:"bottom",e:"right",w:"left",ne:"top-right",nw:"top-left",se:"bottom-right",sw:"bottom-left"},Ne=["n","ne","e","se","s","sw","w","nw"],bn={n:0,ne:1,e:2,se:3,s:4,sw:5,w:6,nw:7},wn={0:0,1:1,2:2,3:2,4:3,5:4,6:4,7:5,8:6,9:6,10:7,11:8},xn=(o,n)=>{const e=wn[Math.floor(o/30)],t=(bn[n]+e)%8;return Ne[t]},Ge=(o=0,n)=>{let e=[];for(let t=0;t<Ne.length;t++){const s=Ne[t],[c,p]=Te[s].split("-"),a=xn(o,s),l={[c]:"0%",cursor:a+"-resize",side:Te[s]};if(p)l[p]="0%";else{const v=["top","bottom"].includes(c)?"left":"top";l[v]="50%"}n?n.includes(Te[s])&&e.push(l):e.push(l)}return e},Fe=o=>o*Math.PI/180,kn=(o,n)=>Math.sqrt(o*o+n*n),P=o=>Math.cos(Fe(o)),T=o=>Math.sin(Fe(o)),Mn=(o,n,e,t,s,c,p)=>{let{width:a,height:l,centerX:v,centerY:x,rotateAngle:i}=n;const k=a<0?-1:1,h=l<0?-1:1;switch(a=Math.abs(a),l=Math.abs(l),o){case"right":{const m=te(a,e,c);a=m.width,e=m.deltaW,s?(t=e/s,l=a/s,v+=e/2*P(i)-t/2*T(i),x+=e/2*T(i)+t/2*P(i)):(v+=e/2*P(i),x+=e/2*T(i));break}case"top-right":{t=-t;const m=te(a,e,c);a=m.width,e=m.deltaW;const f=ee(l,t,p);l=f.height,t=f.deltaH,s&&(e=t*s,a=l*s),v+=e/2*P(i)+t/2*T(i),x+=e/2*T(i)-t/2*P(i);break}case"bottom-right":{const m=te(a,e,c);a=m.width,e=m.deltaW;const f=ee(l,t,p);l=f.height,t=f.deltaH,s&&(e=t*s,a=l*s),v+=e/2*P(i)-t/2*T(i),x+=e/2*T(i)+t/2*P(i);break}case"bottom":{const m=ee(l,t,p);l=m.height,t=m.deltaH,s?(e=t*s,a=l*s,v+=e/2*P(i)-t/2*T(i),x+=e/2*T(i)+t/2*P(i)):(v-=t/2*T(i),x+=t/2*P(i));break}case"bottom-left":{e=-e;const m=te(a,e,c);a=m.width,e=m.deltaW;const f=ee(l,t,p);l=f.height,t=f.deltaH,s&&(l=a/s,t=e/s),v-=e/2*P(i)+t/2*T(i),x-=e/2*T(i)-t/2*P(i);break}case"left":{e=-e;const m=te(a,e,c);a=m.width,e=m.deltaW,s?(l=a/s,t=e/s,v-=e/2*P(i)+t/2*T(i),x-=e/2*T(i)-t/2*P(i)):(v-=e/2*P(i),x-=e/2*T(i));break}case"top-left":{e=-e,t=-t;const m=te(a,e,c);a=m.width,e=m.deltaW;const f=ee(l,t,p);l=f.height,t=f.deltaH,s&&(a=l*s,e=t*s),v-=e/2*P(i)-t/2*T(i),x-=e/2*T(i)+t/2*P(i);break}case"top":{t=-t;const m=ee(l,t,p);l=m.height,t=m.deltaH,s?(a=l*s,e=t*s,v+=e/2*P(i)+t/2*T(i),x+=e/2*T(i)-t/2*P(i)):(v+=t/2*T(i),x-=t/2*P(i));break}}return{position:{centerX:v,centerY:x},size:{width:a*k,height:l*h}}},ee=(o,n,e)=>{const t=o+n;return t>e?o=t:(n=e-o,o=e),{height:o,deltaH:n}},te=(o,n,e)=>{const t=o+n;return t>e?o=t:(n=e-o,o=e),{width:o,deltaW:n}},Cn=({centerX:o,centerY:n,width:e,height:t,angle:s})=>({top:n-t/2,left:o-e/2,width:e,height:t,angle:s}),En=(o,n,e)=>{const{width:t,height:s}=o;return{width:Math.abs(t),height:Math.abs(s),left:n-Math.abs(t)/2,top:e-Math.abs(s)/2}};function Le(o,n){const e=Math.abs(o)%n,t=o>0?n:-n;let s=0;return e>n/2?s=t*Math.ceil(Math.abs(o)/n):s=t*Math.floor(Math.abs(o)/n),s}function Ln(o,n,e){if(!o||!n)return!1;const t=O(o,e),s=O(n,e);return t.left<s.left+s.width&&t.left+t.width>s.left&&t.top<s.top+s.height&&t.top+t.height>s.top}const O=(o,n)=>{var e=o.getBoundingClientRect();return{...e,left:e.left/n,top:e.top/n,right:e.right/n,bottom:e.bottom/n,width:e.width/n,height:e.height/n}},Ke=o=>typeof o=="function";function Dn(o,n){let e=null,t=null;const s=Y(()=>o.value.offsetParent||document.body),c=Y(()=>O(s.value,n.scaleRatio)),p=_({x:[],y:[]}),a=()=>{n.markline&&!Ke(n.markline)&&(e||(e=document.querySelector(".es-drager-markline-x")||Qe("x",s.value,n.color)),t||(t=document.querySelector(".es-drager-markline-y")||Qe("y",s.value,n.color)))},l=(h={})=>{if(n.markline){if(Ke(n.markline))return n.markline(h);h.left===null?e.style.display="none":(e.style.left=h.left+"px",e.style.backgroundColor=n.color,e.style.display="block"),h.top===null?t.style.display="none":(t.style.top=h.top+"px",t.style.backgroundColor=n.color,t.style.display="block")}},v=()=>{const h=O(o.value,n.scaleRatio),m=document.querySelectorAll(".es-drager"),f=[];for(let M=0;M<m.length;M++){const d=m[M];d!==o.value&&f.push(O(d,n.scaleRatio))}p.value=Sn(f,h)},x=()=>{const h={top:null,left:null,diffX:0,diffY:0},m=O(o.value,n.scaleRatio);for(let f=0;f<p.value.y.length;f++){const{top:M,showTop:d}=p.value.y[f];if(Math.abs(M-m.top)<n.snapThreshold){h.diffY=M-m.top,h.top=d-c.value.top;break}}for(let f=0;f<p.value.x.length;f++){const{left:M,showLeft:d}=p.value.x[f];if(Math.abs(M-m.left)<n.snapThreshold){h.diffX=M-m.left,h.left=d-c.value.left;break}}return l(h),h},i=()=>{l({left:null,top:null})},k=h=>{if(!(!n.snap&&!n.markline))switch(h){case"drag-start":v();break;case"drag":return x();case"drag-end":i();break}};return ze(()=>{a()}),{marklineEmit:k}}function Qe(o="x",n,e=""){const t=document.createElement("div");return t.classList.add(`es-drager-markline-${o}`),t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.style.zIndex="9999",t.style.backgroundColor=e,t.style.display="none",o==="x"?(t.style.height="100%",t.style.width="1px"):(t.style.height="1px",t.style.width="100%"),n.appendChild(t),t}function Sn(o,n){const e={x:[],y:[]},{width:t=0,height:s=0}=n;return o.forEach(c=>{const{top:p,left:a,width:l,height:v}=c;e.y.push({showTop:p,top:p}),e.y.push({showTop:p,top:p-s}),e.y.push({showTop:p+v/2,top:p+v/2-s/2}),e.y.push({showTop:p+v,top:p+v}),e.y.push({showTop:p+v,top:p+v-s}),e.x.push({showLeft:a,left:a}),e.x.push({showLeft:a+l,left:a+l}),e.x.push({showLeft:a+l/2,left:a+l/2-t/2}),e.x.push({showLeft:a+l,left:a+l-t}),e.x.push({showLeft:a,left:a-t})}),e}function $n(o,n,e,{getBoundary:t,fixBoundary:s,checkDragerCollision:c,emit:p}){let a=0,l=0;return{onKeydown:v=>{let{left:x,top:i}=n.value;if(a||(a=x),l||(l=i),["ArrowRight","ArrowLeft"].includes(v.key)){const k=v.key==="ArrowRight";let h=k?1:-1;o.snapToGrid&&(h=k?o.gridX:-o.gridX),x=x+h}else if(["ArrowUp","ArrowDown"].includes(v.key)){const k=v.key==="ArrowDown";let h=k?1:-1;o.snapToGrid&&(h=k?o.gridY:-o.gridY),i=i+h}if(o.boundary){const[k,h,m,f]=t();[x,i]=s(x,i,k,h,m,f)}n.value.left=x,n.value.top=i},onKeyup:v=>{["ArrowRight","ArrowLeft","ArrowUp","ArrowDown"].includes(v.key)&&o.checkCollision&&c()&&(n.value.left=a,n.value.top=l),a=0,l=0}}}function An(o,n,e){const t=_(!1),s=_(!1),c=_({width:n.width,height:n.height,left:n.left,top:n.top,angle:n.angle}),{marklineEmit:p}=Dn(o,n),a=new Set;function l(f){if(a.add(f.button),n.disabled)return;t.value=!0,s.value=!0;let{clientX:M,clientY:d}=ie(f);const{left:g,top:r}=c.value;let y=0,w=0,C=0,L=0;n.boundary&&([y,w,C,L]=v()),p("drag-start"),e&&e("drag-start",c.value),He($=>{if(a.size>1)return;const{clientX:X,clientY:A}=ie($);let N=(X-M)/n.scaleRatio+g,B=(A-d)/n.scaleRatio+r;if(n.snapToGrid){let{left:I,top:V}=c.value;const z=N-I,ae=B-V;N=I+Le(z,n.gridX),B=V+Le(ae,n.gridY)}n.boundary&&([N,B]=x(N,B,y,w,C,L)),c.value.left=N,c.value.top=B,e&&e("drag",c.value),Ft(()=>{const I=p("drag");n.snap&&(I.diffX&&(c.value.left+=I.diffX),I.diffY&&(c.value.top+=I.diffY))})},$=>{n.checkCollision&&i()&&(c.value.top=r,c.value.left=g),a.clear(),t.value=!1,p("drag-end"),e&&e("drag-end",c.value)})}const v=()=>{let f=0,M=0;const{left:d,top:g,height:r,width:y,angle:w}=c.value,C=o.value.offsetParent||document.body,L=O(C,n.scaleRatio);if(w){const A=O(o.value,n.scaleRatio);f=A.left-Math.floor(d-(A.width-y)+L.left),M=A.top-Math.floor(g-(A.height-r)+L.top)}const $=L.width-y,X=L.height-r;return[f,$-f,M,X-M,L.width,L.height]},x=(f,M,d,g,r,y)=>(f=f<d?d:f,f=f>g?g:f,M=M<r?r:M,M=M>y?y:M,[f,M]),i=()=>{const f=o.value.offsetParent||document.body,M=Array.from(f.children).filter(d=>d!==o.value&&d.classList.contains("es-drager"));for(let d=0;d<M.length;d++){const g=M[d];if(Ln(o.value,g,n.scaleRatio))return!0}},k=()=>{s.value=!1},{onKeydown:h,onKeyup:m}=$n(n,c,s,{getBoundary:v,fixBoundary:x,checkDragerCollision:i,emit:e});return oe(s,f=>{f?(e("focus",f),document.addEventListener("click",k,{once:!0})):e("blur",f),!n.disabledKeyEvent&&(f?(document.addEventListener("keydown",h),document.addEventListener("keyup",m)):(document.removeEventListener("keydown",h),document.removeEventListener("keyup",m)))}),ze(()=>{if(o.value){if(!c.value.width&&!c.value.height){const{width:f,height:M}=O(o.value,n.scaleRatio);c.value={...c.value,width:f||100,height:M||100}}o.value.addEventListener("mousedown",l),o.value.addEventListener("touchstart",l,{passive:!0})}}),Ht(()=>{document.removeEventListener("click",k),document.removeEventListener("keydown",h),document.removeEventListener("keyup",m)}),{isMousedown:t,selected:s,dragData:c,getBoundary:v,checkDragerCollision:i}}const Yn=le("div",{class:"es-drager-rotate-handle"},[le("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},[le("path",{fill:"currentColor",d:"M784.512 230.272v-50.56a32 32 0 1 1 64 0v149.056a32 32 0 0 1-32 32H667.52a32 32 0 1 1 0-64h92.992A320 320 0 1 0 524.8 833.152a320 320 0 0 0 320-320h64a384 384 0 0 1-384 384 384 384 0 0 1-384-384 384 384 0 0 1 643.712-282.88z"})])],-1),Xn=De({__name:"rotate",props:{modelValue:{type:Number,default:0},element:{type:Object}},emits:["update:modelValue","rotate","rotate-start","rotate-end"],setup(o,{emit:n}){const e=o,t=n,s=_(null),c=Y({get:()=>e.modelValue,set:a=>{t("update:modelValue",a)}});function p(a){if(!e.element)return console.warn("[es-drager] rotate component need drag element property");a.stopPropagation();const{width:l,height:v,left:x,top:i}=e.element.getBoundingClientRect(),k=x+l/2,h=i+v/2;t("rotate-start",c.value),He(m=>{const{clientX:f,clientY:M}=ie(m),d=k-f,g=h-M,r=Math.atan2(g,d)*180/Math.PI-90;c.value=(r+360)%360,t("rotate",c.value)},()=>{t("rotate-end",c.value)})}return(a,l)=>(R(),F("div",{ref_key:"rotateRef",ref:s,class:"es-drager-rotate",onMousedown:p,onTouchstartPassive:p},[xe(a.$slots,"default",{},()=>[Yn])],544))}}),Pn=["data-side","onMousedown","onTouchstartPassive"],Tn=le("div",{class:"es-drager-dot-handle"},null,-1),Oe=De({__name:"drager",props:mn,emits:["change","drag","drag-start","drag-end","resize","resize-start","resize-end","rotate","rotate-start","rotate-end","focus","blur"],setup(o,{emit:n}){const e=o,t=n,s=(r,...y)=>{t(r,...y)},c=_(null),{selected:p,dragData:a,isMousedown:l,getBoundary:v,checkDragerCollision:x}=An(c,e,s),i=_(Ge(0,e.resizeList)),k=Y(()=>e.resizable&&!e.disabled),h=Y(()=>e.rotatable&&!e.disabled&&p.value),m=Y(()=>{const{width:r,height:y,left:w,top:C,angle:L}=a.value,$={};return r&&($.width=we(r)),y&&($.height=we(y)),{...$,left:we(w),top:we(C),zIndex:e.zIndex,transform:`rotate(${L}deg)`,"--es-drager-color":e.color}});function f(r){c.value||(c.value=r.$el||r)}function M(r){i.value=Ge(r,e.resizeList),s("rotate-end",a.value)}function d(r,y){if(e.disabled)return;y.stopPropagation();const{clientX:w,clientY:C}=ie(y),L=w,$=C,{width:X,height:A,left:N,top:B}=a.value,I=N+X/2,V=B+A/2,z={width:X,height:A,centerX:I,centerY:V,rotateAngle:a.value.angle},ae=r.side,{minWidth:ue,minHeight:ce,aspectRatio:se,equalProportion:de}=e;s("resize-start",a.value);let pe=[];e.boundary&&(pe=v()),He(re=>{const{clientX:fe,clientY:he}=ie(re);let U=(fe-L)/e.scaleRatio,G=(he-$)/e.scaleRatio;e.snapToGrid&&(U=Le(U,e.gridX),G=Le(G,e.gridY));const Se=Math.atan2(G,U),ve=kn(U,G),ge=re.shiftKey,me=Se-Fe(z.rotateAngle),$e=ve*Math.cos(me),Z=ve*Math.sin(me),ye=(de||ge)&&!se?z.width/z.height:se,{position:{centerX:K,centerY:be},size:{width:J,height:Ae}}=Mn(ae,{...z,rotateAngle:z.rotateAngle},$e,Z,ye,ue,ce),Ye=Cn({centerX:K,centerY:be,width:J,height:Ae,angle:a.value.angle});let H={...a.value,...En(Ye,K,be)};e.maxWidth>0&&(H.width=Math.min(H.width,e.maxWidth)),e.maxHeight>0&&(H.height=Math.min(H.height,e.maxHeight)),e.boundary&&(H=g(H,pe,ye)),a.value=H,s("resize",a.value)},()=>{e.checkCollision&&x()&&(a.value={...a.value,width:X,height:A,left:N,top:B}),s("resize-end",a.value)})}function g(r,y,w){const[C,L,$,X,A,N]=y,B=r.left<C,I=r.left+r.width>A,V=r.top<$,z=r.top+r.height>N;return B&&(r.left=C,r.width=a.value.width),V&&(r.top=$,r.height=a.value.height),(I||z)&&(I&&(r.left=a.value.left),z&&(r.top=a.value.top),z||(r.width=A-r.left),I||(r.height=N-r.top)),(z||V)&&w&&(r.width=a.value.width,r.left=a.value.left),(I||B)&&w&&(r.height=a.value.height,r.top=a.value.top),r}return oe(()=>[e.width,e.height,e.left,e.top,e.angle],([r,y,w,C,L],[$,X,A,N,B])=>{r!==$&&(a.value.width=r),y!==X&&(a.value.height=y),w!==A&&(a.value.left=w),C!==N&&(a.value.top=C),L!==B&&(a.value.angle=L)}),oe(()=>a.value,r=>{t("change",{...r})},{deep:!0}),oe(()=>e.selected,r=>{p.value=r},{immediate:!0}),(r,y)=>(R(),j(Ie(r.tag),{ref:f,class:Re(["es-drager",{disabled:r.disabled,dragging:E(l),selected:E(p),border:r.border}]),style:Q(m.value),onClick:y[3]||(y[3]=W(()=>{},["stop"]))},{default:Ce(()=>[xe(r.$slots,"default"),k.value?(R(!0),F(_e,{key:0},Ze(i.value,(w,C)=>(R(),F("div",{key:C,class:"es-drager-dot","data-side":w.side,style:Q({...w}),onMousedown:L=>d(w,L),onTouchstartPassive:L=>d(w,L)},[xe(r.$slots,"resize",Wt(Vt({side:w.side})),()=>[Tn])],44,Pn))),128)):ne("",!0),h.value?(R(),j(Xn,{key:1,modelValue:E(a).angle,"onUpdate:modelValue":y[0]||(y[0]=w=>E(a).angle=w),element:c.value,onRotate:y[1]||(y[1]=w=>s("rotate",E(a))),onRotateStart:y[2]||(y[2]=w=>s("rotate-start",E(a))),onRotateEnd:M},{default:Ce(()=>[xe(r.$slots,"rotate")]),_:3},8,["modelValue","element"])):ne("",!0)]),_:3},8,["class","style"]))}}),Bn=o=>{o.component("es-drager",Oe)};Oe.install=Bn;const _n=De({__name:"Area",emits:["move","up"],setup(o,{expose:n,emit:e}){const t=e,s=We(),c=Y(()=>s.data.container.scaleRatio/100),p=_(!1),a=_({width:0,height:0,top:0,left:0}),l=Y(()=>{const{width:i,height:k,top:h,left:m}=a.value;return{width:`${i}px`,height:`${k}px`,top:`${h}px`,left:`${m}px`}}),v=Ve();function x(i){if(v.value)return;const{pageX:k,pageY:h}=i,m=i.target.getBoundingClientRect(),f=k-m.left,M=h-m.top,d=r=>{const y=r.pageX-k,w=r.pageY-h;let C=f,L=M;const $=Math.abs(y),X=Math.abs(w);($>2||X>2)&&(p.value=!0),y<0&&(C=f-$),w<0&&(L=M-X);const A=c.value;a.value={width:$/A,height:X/A,left:C/A,top:L/A},t("move",{...a.value})},g=()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",g),p.value=!1,a.value={width:0,height:0,top:0,left:0},t("up",a.value)};document.addEventListener("mousemove",d),document.addEventListener("mouseup",g)}return n({isSpacePressed:v,onMouseDown:x,areaData:a}),(i,k)=>ke((R(),F("div",{class:"es-editor-area border bg-blue opacity-20 dark:border-dark",style:Q(l.value)},null,4)),[[Me,p.value]])}}),Rn=Je(_n,[["__scopeId","data-v-dd1da676"]]),In=["id"],Nn={class:"es-canvas-mask"},zn=De({__name:"index",props:{modelValue:{type:Object,required:!0,default:()=>({})},commands:{type:Object}},emits:["selectWidget"],setup(o,{expose:n,emit:e}){const t=o,s=e,c=_(!1),p=Ve(),a=_(!1),l=We(),v=en(),{svgVisible:x,initSvgBoard:i}=tn(),k=_(null);Pe("canvasRef",k);const h=Y({get:()=>t.modelValue,set:()=>{}}),m=Y(()=>{var b;return((b=t.modelValue.container)==null?void 0:b.gridSize)||10}),f=Y(()=>{var b;return((b=t.modelValue.container)==null?void 0:b.scaleRatio)||100});Pe("scaleRatio",f);const M=Y(()=>{const{width:b,height:S,backgroundImage:u}=l.data.container.style,D=l.initScale;return{...l.data.container.style,position:"absolute",top:"50%",left:"50%","user-select":"none","transform-style":"preserve-3d",perspective:"3000px",width:`${b}px`,height:`${S}px`,"background-image":u==="none"?"none":`url(${u})`,transform:`scale(${f.value/100},${f.value/100})`,transformOrigin:"top left",cursor:a.value?"text":p.value?"grab":"auto","margin-left":`-${b*(D/100)/2}px`,"margin-top":`-${S*(D/100)/2}px`,visibility:c.value?"visible":"hidden"}}),d=_({startX:0,startY:0,disX:0,disY:0}),g=Y({get:()=>l.current,set:b=>{l.current=b}}),r=_(),{areaSelected:y,onEditorMouseDown:w,onAreaMove:C,onAreaUp:L,onAreaClick:$}=un(h,r),{onContextmenu:X,onEditorContextMenu:A,actions:N}=nn(h,k),B=_(null);function I(b){y.value||(B.value&&(B.value.selected=!1),g.value&&(g.value.selected=!1)),g.value=b,g.value.selected=!0,d.value.startX=g.value.left,d.value.startY=g.value.top,B.value=b,Ee.emit("dragstart")}function V(b){const S=b.left-d.value.startX,u=b.top-d.value.startY;h.value.elements.length<2||(h.value.elements.forEach(D=>{var q;D.selected&&((q=g.value)==null?void 0:q.id)!==D.id&&(D.left+=S,D.top+=u)}),d.value.startX=b.left,d.value.startY=b.top)}function z(){Ee.emit("dragend")}function ae(b,S){Object.keys(b).forEach(u=>{S[u]=b[u]})}const ue={dblclick:()=>{!g.value||!g.value.selected||(g.value.editable=!0)},click:()=>{g.value&&(g.value.editable=!1)}};function ce(b="on"){["dblclick","click"].forEach(u=>{b==="on"?document.addEventListener(u,ue[u]):document.removeEventListener(u,ue[u])})}const se=Y(()=>b=>b.animationEnabled?{animate__animated:b.animationEnabled,[`animate__${b.animationOptions.name}`]:b.animationEnabled}:{}),de=Y(()=>b=>{if(!b.animationEnabled)return{};const{duration:S,delay:u,direction:D,iterationCount:q,timingFunction:zt}=b.animationOptions;return{animationDuration:`${S}s`,animationDelay:`${u}s`,animationDirection:D,animationIterationCount:q,animationTimingFunction:zt}}),pe=Y(()=>b=>{let S="none";return b.flipX&&(S="matrix(-1, 0, 0, 1, 0, 0)"),b.flipY&&(S="matrix(1, 0, 0, -1, 0, 0)"),{...je(b.style,!1),width:"100%",height:"100%",transform:S}}),{click:re,dblclick:fe,mouseenter:he,mouseleave:U,change:G,vnodeMounted:Se,vnodeBeforeMount:ve}=on();Pe("eventHandlers",{click:re,dblclick:fe,mouseenter:he,mouseleave:U,change:G});const{importMap:ge,vueVersion:me,productionMode:$e}=Ut({runtimeDev:`${window.serverEntry}/visual/cdn/vue.runtime.esm-browser.js`,serverRenderer:`${window.serverEntry}/visual/cdn/vue.server-renderer.esm-browser.js`});$e.value=!1,Object.assign(ge.value.imports,{echarts:`${window.serverEntry}/visual/cdn/echarts.min.js`});const Z=new Map;function ye(b){if(Z.get(b.id))return Z.get(b.id);{const S=Kt({builtinImportMap:ge,vueVersion:me});return b.hash&&(S.files=JSON.parse(b.hash)),Z.set(b.id,S),Z.get(b.id)}}const K=new Map;function be(b){return K.get(b.id)||K.set(b.id,b.previewOptions),K.get(b.id)}window.$globalVarList=Y({get(){return l.data.globals.variables},set(b){l.data.globals.variables=b}}),window.$globalExposeFunctions=Y(()=>l.data.globals.filters);const{startDrawLines:J,finishDrawLine:Ae,updatePointHandler:Ye,deletePointHandler:H,addPointHandler:Bt,listenerMoving:_t}=gn(f,k),{init:Rt}=Zt();ze(()=>{ce(),an(".es-canvas"),cn(".edit-screens"),sn();const b=k.value.getBoundingClientRect();dn(".es-canvas-mask",Ae,{x:b.left,y:b.top},J),_t(y,B)}),oe(J,b=>{b||s("selectWidget")});let Xe=null;function It(){l.togglePage(),l.updateTheme(localStorage.getItem("vueuse-color-scheme")==="dark"),Xe&&Xe(),Xe=oe(()=>l.data.elements,(b,S)=>{b.length!==S.length&&(v.$state[v.activePageIndex].data.elements=b)},{deep:!0})}Ot(()=>{ce("off")}),n({startDrawLines:J,actions:N,showCanvas:c,editingText:a,initDefaultPage:It});function Nt(b){a.value=!1,!b.props.options.text&&!b.props.eventData&&h.value.elements.pop()}return(b,S)=>(R(),F("div",{ref_key:"canvasRef",ref:k,class:"es-canvas",style:Q(M.value),onMousedown:S[4]||(S[4]=(...u)=>E(w)&&E(w)(...u)),onContextmenu:S[5]||(S[5]=W((...u)=>E(A)&&E(A)(...u),["prevent"]))},[a.value?(R(),F("div",{key:0,class:"editing-mask",onClick:S[0]||(S[0]=W(u=>E($)(u,a.value),["stop"]))})):ne("",!0),h.value.svgBoard?(R(),F("div",{key:1,id:`${E(l).pageName}-svg-board`,style:Q({visibility:E(x)?"visible":"hidden"}),class:"svg-board",onVnodeMounted:S[1]||(S[1]=u=>E(i)(`${E(l).pageName}-svg-board`))},null,12,In)):ne("",!0),(R(!0),F(_e,null,Ze(h.value.elements,u=>(R(),F(_e,{key:u.id},[u.component!=="es-line"?ke((R(),j(E(Oe),qe({key:0,ref_for:!0},E(ln)(u,["style","props","hash","previewoptions"]),{class:{selected:u.selected,...se.value(u)},style:de.value(u),rotatable:"","grid-x":m.value,"grid-y":m.value,"scale-ratio":f.value/100,boundary:"",snap:"",markline:h.value.container.markline.show,"snap-threshold":h.value.container.gridSize,onDragStart:D=>I(u),onDrag:V,onDragEnd:z,onChange:D=>ae(D,u),onContextmenu:W(D=>E(X)(D,u),["stop"]),onMousedown:S[2]||(S[2]=W(()=>{},["stop"])),onClick:W(D=>E(re)(u.props.datasets,u.props.eventData,u),["stop"])}),{default:Ce(()=>[u.isRemote?(R(),j(E(Gt),{key:1,store:ye(u),editor:E(Qt),"show-compile-output":!1,class:Re(["es-repl",{"repl-dark":E(jt)}]),"preview-options":be(u),onVnodeMounted:D=>E(Rt)(u)},null,8,["store","editor","class","preview-options","onVnodeMounted"])):(R(),j(Ie(u.component),qe({key:0,ref_for:!0},u.props,{"event-data":u.props.eventData,"onUpdate:eventData":D=>u.props.eventData=D,datasets:u.props.datasets,options:u.props.options,element:u,style:pe.value(u),onDblclick:W(D=>E(fe)(u.props.datasets,u.props.eventData,u),["stop"]),onMouseenter:W(D=>E(he)(u.props.datasets,u.props.eventData,u),["stop"]),onMouseleave:W(D=>E(U)(u.props.datasets,u.props.eventData,u),["stop"]),onUpdateValue:D=>E(G)(u.props.datasets,u.props.eventData,u),onVnodeMounted:D=>{E(Se)(u.props.datasets,u.props.eventData,u,D)},onVnodeBeforeMount:D=>{E(ve)(u.props.datasets,u.props.eventData,u,D)},onBlurInput:D=>Nt(u)}),{default:Ce(()=>[u.text?(R(),j(rn,{key:0,editable:u.editable,text:u.text,style:Q(E(je)(u.style))},null,8,["editable","text","style"])):ne("",!0)]),_:2},1040,["event-data","onUpdate:eventData","datasets","options","element","style","onDblclick","onMouseenter","onMouseleave","onUpdateValue","onVnodeMounted","onVnodeBeforeMount","onBlurInput"]))]),_:2},1040,["class","style","grid-x","grid-y","scale-ratio","markline","snap-threshold","onDragStart","onChange","onContextmenu","onClick"])),[[Me,u.visible]]):ke((R(),j(Ie(u.component),{key:1,class:Re({selected:u.selected,...se.value(u)}),style:Q(de.value(u)),datasets:u.props.datasets,options:u.props.options,element:u,points:u.props.points,"area-selected":E(y),"anim-condition":u.props.options.animCondition,onMousedown:S[3]||(S[3]=W(()=>{},["stop"])),onContextmenu:W(D=>E(X)(D,u),["stop"]),onUpdatePoint:(D,q)=>E(Ye)(D,q,u),onAddPoint:(D,q)=>E(Bt)(D,q,u),onDeletePoint:D=>E(H)(D,u)},null,40,["class","style","datasets","options","element","points","area-selected","anim-condition","onContextmenu","onUpdatePoint","onAddPoint","onDeletePoint"])),[[Me,u.visible]])],64))),128)),h.value.container.snapToGrid?(R(),j(Jt,{key:2,grid:h.value.container.gridSize,width:h.value.container.gridOuterWidth,height:h.value.container.gridOuterHeight,"border-color":h.value.container.gridColor},null,8,["grid","width","height","border-color"])):ne("",!0),qt(Rn,{ref_key:"areaRef",ref:r,onMove:E(C),onUp:E(L)},null,8,["onMove","onUp"]),ke(le("div",Nn,null,512),[[Me,E(J)]])],36))}}),Wn=Je(zn,[["__scopeId","data-v-921aab5a"]]),Zn=Object.freeze(Object.defineProperty({__proto__:null,default:Wn},Symbol.toStringTag,{value:"Module"}));export{Wn as C,Qn as a,Zn as i};