ht-xeditinteractor.js 62 KB

12
  1. !function(F,M,D){"use strict";var e="ht",K=F[e],E=K.Default,S=K.graph,J=E.getInternal(),x=J.ui(),m=x.NodeUI.prototype,y=x.ShapeUI.prototype,C=S.GraphView,i=C.prototype,p=x.EdgeUI.prototype,Y=K.Node,P=K.Shape,Q=K.Edge,L=K.Group,c=E.isTouchable,U=E.preventDefault,w=F.setTimeout,u=E.grow,j=E.isDragging,h=E.getDistance,d=null,G=K.List,t="undefined"!=typeof Float32Array?Float32Array:Array,X=Math,N=X.PI,n="Crossing",T="No Crossing",v=N/2,I=2*N,W=X.atan2,B=X.sqrt,k=X.pow,A=X.sin,V=X.cos,g=X.min,o=X.max,H=X.abs,l=X.ceil,R=X.round,s=E.unionPoint,O=E.unionRect,f=E.containsPoint,a=E.clone,z="rgb(52, 152, 219)",Z="red",q={northwest:0,north:1,northeast:2,west:7,east:3,southwest:6,south:5,southeast:4},_={width:400,height:100,comps:[{type:"shape",points:{func:function(){for(var k=[10,8,162,36,314,37,269,2,398,49,268,98,314,58,161,60,9,91,103,49,10,8],H=0;H<k.length;H++){var K=k[H];K=0===H%2?K/400*_.width:K/100*_.height,k[H]=K}return _.width>120&&(k[4]=_.width-26,k[6]=_.width-40,k[10]=_.width-40,k[12]=_.width-26,k[18]=33),k}},segments:[1,3,2,2,2,2,3,2,2],background:"white",gradient:"linear.east",gradientColor:"red"}]},b={width:300,height:300,comps:[{type:"circle",rect:[20,0,120,120],background:z,rotation:.61},{type:"circle",rect:[200,120,70,70],background:z,rotation:.61},{type:"circle",rect:[200,220,70,70],background:z,rotation:.61},{type:"shape",points:[80,60,80,155,200,155],borderWidth:20,borderColor:z},{type:"shape",points:[80,60,80,255,200,255],borderWidth:20,borderColor:z}]},r={width:300,height:300,comps:[{type:"shape",points:[114,239,115,106,112,73,149,73,149,73,175,73,177,105,179,261,178,302,147,307,98,308,83,307,72,276,73,260,72,81,74,29,115,21,191,21,221,22,224,53,223,238],segments:[1,2,3,2,3,2,3,2,4,2,3,2,3,2],borderWidth:20,borderColor:Z,rotation:.61}]},$={width:300,height:300,comps:[{type:"circle",rect:[210,0,90,90],background:z},{type:"circle",rect:[0,210,90,90],background:z},{type:"shape",points:[255,45,45,255],borderWidth:20,borderColor:z}]},uh={width:300,height:300,comps:[{type:"shape",points:[20,20,280,280],borderWidth:30,borderColor:Z},{type:"shape",points:[280,20,20,280],borderWidth:30,borderColor:Z}]},Pl={width:300,height:300,comps:[{type:"shape",points:[270,30,30,150,270,270],borderWidth:40,borderColor:z}]},Aq={width:300,height:300,comps:[{type:"shape",points:[30,30,270,150,30,270],borderWidth:40,borderColor:Z}]},ei={width:300,height:300,comps:[{type:"rect",rect:[125.58,52.76,40,231.96],background:"rgb(0,0,0)",borderWidth:1,borderColor:"#000"},{type:"rect",rect:[27.87,61.06,150,30],background:"rgb(0,0,0)",borderWidth:1,borderColor:"#000",rotation:5.5},{type:"rect",rect:[113.36,61,150,30],background:"rgb(0,0,0)",borderWidth:1,borderColor:"#000",rotation:.79}]},vg={width:300,height:300,author:"",note:"",comps:[{type:"rect",rect:[135.15,38.76,28.63,82.84],background:"rgb(0,0,0)",borderWidth:1,borderColor:"#000"},{type:"triangle",rect:[94.69,2.35,110,44.77],background:"rgb(0,0,0)",borderWidth:1,borderColor:"#000"},{type:"rect",rect:[31.71,115.72,240,15],background:"rgb(0,0,0)",borderWidth:1,borderColor:"#000"},{type:"rect",rect:[31.71,167.62,240,15],background:"rgb(0,0,0)",borderWidth:1,borderColor:"#000"},{type:"rect",rect:[135.15,177.33,28.63,82.84],background:"rgb(0,0,0)",borderWidth:1,borderColor:"#000"},{type:"triangle",rect:[94.69,251.39,110,44.77],background:"rgb(0,0,0)",borderWidth:1,borderColor:"#000",rotation:3.14}]},Vb=function(T){var e=T.touches[0];return e?e:T.changedTouches[0]},Cg=function(c,m,Y,P){return W(P-m,Y-c)},Vp=function(s,M){return{x:s.x*M,y:s.y*M}},fd=function(Q,D){var h,X,A,G,z=Q._layers,e=Q.sm().getSelection()._as,d=e.length;if(z)for(h=0;h<z.length;h++){G=z[h];for(var q=0;d>q;q++)if(X=e[q],X._layer===G&&(A=D(X),A===!1))return}else for(h=0;d>h;h++)if(X=e[h],A=D(X),A===!1)return},Tm=function(V,x,U){var n,d,e,f,p,c=this,A=x,B=c.gv;if(V instanceof P){e=V.getSegments();var r=B.getDataUI(V);p=r._55O.$15l,e&&e.size()||(e=dn(p)),V.isClosePath()&&e.indexOf(5)<0&&(e=new G(e._as),e.add(5)),n=Yk(V,r,A),d=p[n]}else{var l=B.getDataUI(V);p=De(l,V.s("edge.points")),e=V.s("edge.segments"),e&&e.size()||(e=dn(p)),p=p._as,n=Yk(V,l,A),d=p[n]}if(e&&(f=e.get(A)),2===f||1===f||5===f){var z=p[n+1];5===f&&(z=p[0]);var F=Me(d,U,z);return F}return U},Vg=function(Z,H){var D,w,x,L,z=Z._layers,v=Z.sm().getSelection()._as,r=v.length;if(z)for(D=z.length-1;D>=0;D--){L=z[D];for(var h=r-1;h>=0;h--)if(w=v[h],w._layer===L&&(x=H(w),x===!1))return}else for(D=r-1;D>=0;D--)if(w=v[D],x=H(w),x===!1)return},Qk=function(s,U,D,$){var Z=U/2,V=D/2,v=ui(s,-Z,-V,$),z=ui(s,Z,-V,$),K=ui(s,-Z,V,$),g=ui(s,Z,V,$),T=ui(s,0,-V,$),u=ui(s,Z,0,$),J=ui(s,0,V,$),e=ui(s,-Z,0,$);return[v,z,K,g,T,u,J,e]},Me=function(L,r,W){var q={x:r.x-L.x,y:r.y-L.y},K={x:W.x-L.x,y:W.y-L.y},X=B(k(W.x-L.x,2)+k(W.y-L.y,2)),d={x:K.x/X,y:K.y/X},D=q.x*d.x+q.y*d.y,i={x:d.x*D,y:d.y*D};return{x:L.x+i.x,y:L.y+i.y}},ui=function(v,S,o,y){var K=V(y)*S-A(y)*o,w=A(y)*S+V(y)*o;return v?{x:v.x+K,y:v.y+w}:{x:K,y:w}},Up=function(A,M){return M>2*A?A:M/2},lh=function(e,k,F,R){var y=h(e,k);return F=R?g(F,y):Up(F,y),y?F/=y:F=0,{x:e.x+(k.x-e.x)*F,y:e.y+(k.y-e.y)*F}},qd=function(i,u){var j,c,v=i.gv,r=i._data,P=r._40I,C=r._41I,a=r.s("edge.offset"),A=r.s("edge.source.position"),x=r.s("edge.target.position"),_=r.s("edge.source.offset.x"),f=r.s("edge.source.offset.y"),O=r.s("edge.target.offset.x"),s=r.s("edge.target.offset.y"),m=r.s("edge.source.anchor.x"),d=r.s("edge.source.anchor.y"),o=r.s("edge.target.anchor.x"),W=r.s("edge.target.anchor.y");if(u?(j=J.getEdgeAgentPosition(v,P,A,_,f,m,d),c=J.getEdgeAgentPosition(v,C,x,O,s,o,W)):(j=J.getEdgeAgentPosition(v,P,A,0,0,m,d),c=J.getEdgeAgentPosition(v,C,x,0,0,o,W)),"points"===r.s("edge.type")&&a&&!r.s("edge.center")&&j){var w=r.s("edge.points")||new G,X=w.size(),R=lh(j,X?w.get(0):c,a,X),e=lh(c,X?w.get(X-1):j,a,X);j=R,c=e}return[j,c]},De=function(g,q,h){var N=g._78o,P=g._data,p=P.s("edge.type"),u=[N.sourcePoint,N.targetPoint];return"points"===p?h&&(u=qd(g)):u=N.center?p?h?qd(g):qd(g,!0):h?qd(g):[N.c1,N.c2]:h?qd(g):qd(g,!0),q=new G(q?q._as:d),q.add(u[0],0),q.add(u[1]),q},Ah=function(c){return c=new G(c._as),c.removeAt(0),c.removeAt(c.size()-1),c},dn=function(x){x._as||(x=new G(x));var j=new G;j.add(1);for(var X=1;X<x.size();X++)j.add(2);return j},og=function(o,K){return{x:(o.x+K.x)/2,y:(o.y+K.y)/2}},Gh=function(O,D){return{x:O.x+1*(D.x-O.x)/4,y:O.y+1*(D.y-O.y)/4}},oj=function(l,g){return{x:l.x+3*(g.x-l.x)/4,y:l.y+3*(g.y-l.y)/4}},Ug=function(m,G,N,L){var T=G.x+G.width/2,U=G.y+G.height/2,M=B(T*T+U*U),c=W(U,T)+N;return{x:L.x+M*V(c),y:L.y+M*A(c)}},mh=i.validateImpl,Sd=i.isRectEditable,Ob=i.isPointEditable,bd=i._42,ml=y._79o,Di=p._79o,rk=y._48O,ze=y._47O,re=m._48O,xc=m._80o,Mj=y._80o,pr=m._2o,jm=m._47O,yd=p._47O,Do=i.isEditable,ns=["northwest","north","northeast","east","southeast","south","southwest","west"],Zd=function(O,z,K,G,j,a,y,m,H,W){var q=O.x,N=O.y,D=O.width,M=O.height,k={x:q+D/2,y:N+M/2};G=G||0,z=ui(k,z.x-k.x,z.y-k.y,-G),y&&!m&&(z.x+=H,z.y+=W);var Q=.01;if("northwest"===K?(z.x+j>q+D-Q&&(z.x=q+D-j-Q),z.y+j>N+M-Q&&(z.y=N+M-j-Q),O=s(z,{x:q+D,y:N+M})):"north"===K?(z.y+j>N+M-Q&&(z.y=N+M-j-Q),O=s({x:q,y:z.y},{x:q+D,y:N+M})):"northeast"===K?(z.x<q+j+Q&&(z.x=q+j+Q),z.y+j>N+M-Q&&(z.y=N+M-j-Q),O=s({x:q,y:z.y},{x:z.x,y:N+M})):"west"===K?(z.x+j>q+D-Q&&(z.x=q+D-j-Q),O=s({x:z.x,y:N},{x:q+D,y:N+M})):"east"===K?(z.x<q+j+Q&&(z.x=q+j+Q),O=s({x:q,y:N},{x:z.x,y:N+M})):"southwest"===K?(z.x+j>q+D-Q&&(z.x=q+D-j-Q),z.y<N+j+Q&&(z.y=N+j+Q),O=s({x:z.x,y:N},{x:q+D,y:z.y})):"south"===K?(z.y<N+j+Q&&(z.y=N+j+Q),O=s({x:q,y:N},{x:q+D,y:z.y})):"southeast"===K&&(z.x<q+j+Q&&(z.x=q+j+Q),z.y<N+j+Q&&(z.y=N+j+Q),O=s({x:q,y:N},z)),"keepRatio"===a&&(!y&&m||y&&!m)&&("northeast"===K||"southeast"===K||"northwest"===K||"southwest"===K)){var _=O.width,u=O.height,B=_/D,X=u/M,t=g(B,X);O.width=D*t,O.height=M*t,"northeast"===K?O.y=N+(M-O.height):"northwest"===K?(O.y=N+(M-O.height),O.x=q+(D-O.width)):"southwest"===K&&(O.x=q+(D-O.width))}O.x-=k.x,O.y-=k.y;var U=Ug(d,O,G,k);return O.x=U.x-O.width/2,O.y=U.y-O.height/2,O},kl=function(l,L,c,N){var e=l.getRotation(),F=L,m=F.x,i=F.y,S=F.width,Q=F.height,J={x:m+F.width/2,y:i+F.height/2};N=ui(J,N.x-J.x,N.y-J.y,-e),"northwest"===c?F=s(N,{x:m+S,y:i+Q}):"north"===c?F=s({x:m,y:N.y},{x:m+S,y:i+Q}):"northeast"===c?F=s({x:m,y:N.y},{x:N.x,y:i+Q}):"west"===c?F=s({x:N.x,y:i},{x:m+S,y:i+Q}):"east"===c?F=s({x:m,y:i},{x:N.x,y:i+Q}):"southwest"===c?F=s({x:N.x,y:i},{x:m+S,y:N.y}):"south"===c?F=s({x:m,y:i},{x:m+S,y:N.y}):"southeast"===c&&(F=s({x:m,y:i},N)),l.setRect(F),F.x-=J.x,F.y-=J.y;var O=Ug(l,F,e,J);l.p(O.x,O.y)},_b=function(k,b,i,w,j,z,x,J){var S=d;z?(S=ui(d,j.x-b.x,j.y-b.y,-i),S.x-=x.x,S.y-=x.y):S=ui(d,j.x-b.x,j.y-b.y,0);var r={x:b.x+S.x,y:b.y+S.y};J&&(r=J(r.x,r.y)),r.e=k.getPoints().get(w).e,k.setPoint(w,r);var R=k.getWidth(),I=k.getHeight(),s=k.p().x-R/2,f=k.p().y-I/2;s-=b.x,f-=b.y;var n=Ug(k,{x:s,y:f,width:R,height:I},i,b);k.p(n.x,n.y)},Yk=function(V,S,E){var x,U;if(V instanceof P?(x=V.getPoints(),U=V.getSegments()):V instanceof Q&&"points"===V.s("edge.type")&&(x=V.s("edge.points"),U=V.s("edge.segments"),x=De(S,x)),U&&U.size()||(U=dn(x)),V instanceof P&&V.isClosePath()&&U.indexOf(5)<0&&(U=new G(U._as),U.add(5)),U)for(var C=-1,A=0;A<U.size();A++){if(A===E)return C;var e=U.get(A);1===e?C+=1:2===e?C+=1:3===e?C+=2:4===e&&(C+=3)}},Xb=function(u,w,S){var h,E;if(u instanceof P?(h=u.getPoints(),E=u.getSegments()):u instanceof Q&&"points"===u.s("edge.type")&&(h=u.s("edge.points"),E=u.s("edge.segments"),h=De(w,h)),E&&E.size()||(E=dn(h)),E)for(var k=-1,a=0;a<E.size();a++){var H=E.get(a);if(1===H?k+=1:2===H?k+=1:3===H?k+=2:4===H&&(k+=3),k===S)return a}},Ci=function(P,X){var i=[P[0]-X[0],P[1]-X[1],P[2]-X[2]];return i},Ql=function(){var L=new t(16);return L[0]=1,L[1]=0,L[2]=0,L[3]=0,L[4]=0,L[5]=1,L[6]=0,L[7]=0,L[8]=0,L[9]=0,L[10]=1,L[11]=0,L[12]=0,L[13]=0,L[14]=0,L[15]=1,L},$f=function(b,r){var W=b[0],Y=b[1],z=b[2];return b[0]=r[0]*W+r[4]*Y+r[8]*z+r[12],b[1]=r[1]*W+r[5]*Y+r[9]*z+r[13],b[2]=r[2]*W+r[6]*Y+r[10]*z+r[14],b},$g=function(B,l){if(l){var R=A(l),Y=V(l),f=B[0],v=B[1],u=B[2],T=B[3],o=B[8],J=B[9],E=B[10],$=B[11];B[0]=f*Y-o*R,B[1]=v*Y-J*R,B[2]=u*Y-E*R,B[3]=T*Y-$*R,B[8]=f*R+o*Y,B[9]=v*R+J*Y,B[10]=u*R+E*Y,B[11]=T*R+$*Y}},us=function(x,i){for(var Z=x.s("grid.row.count"),k=x.s("grid.column.count"),G=0;Z>G;G++)for(var T=0;k>T;T++){var A=x.getCellRect(G,T);if(f(A,i))return{rowIndex:G,columnIndex:T,rect:A,grid:x}}return null},fm=function(o,W,Z,s,S,Y){var v={},K=Z-o,j=s-W,G=X.sqrt(K*K+j*j),D=K/G,H=j/G,r=(-o+S)*D+(-W+Y)*H;return 0>=r?(v.x=o,v.y=W):r>=G?(v.x=Z,v.y=s):(v.x=o+r*D,v.y=W+r*H),K=S-v.x,j=Y-v.y,v.z=X.sqrt(K*K+j*j),v},Lg=function(L,R){var q,G,$,W,z,T,F,e,r=L.getPoints(),s=L.getSegments(),C=L.p(),X=L.getRotation();if(!s||!(s.indexOf(3)>0||s.indexOf(4)>0)){for(e=0;e<=r.size()-1;e++)if(e===r.size()-1?(z=r.get(0),W=r.get(e)):(W=r.get(e),z=r.get(e+1)),W=ui(C,W.x-C.x,W.y-C.y,X),z=ui(C,z.x-C.x,z.y-C.y,X),T=fm(W.x,W.y,z.x,z.y,R.x,R.y),F=T.z,F<(L.s("shape.border.width")||10)){G=W,$=z,q=e;break}if(q!=d){var I=fm(G.x,G.y,$.x,$.y,R.x,R.y),N=h(G,I);return{attachIndex:q,attachOffset:N}}}},es=function(q){for(var Y=q._data,b=Y.p(),x=Y.getRotation(),O=Y.getPoints(),R=d,E=[],K=0;K<O.size();K++)R=O.get(K),E.push(ui(b,R.x-b.x,R.y-b.y,x));q._55O.$15l=E};i._editPointSize=c?24:9,i._edgeHelpers=["parent","remove","source","target"],i._leftTopHelpers=["parent"],i._rightTopHelpers=["host"],i._leftBottomHelpers=["edge"],i._rightBottomHelpers=["remove"],ns=ns.concat(ns).concat(ns),p._79o=function(){var W=this,r=W.gv,U=r.getZoom(),T=r._editInteractor,w=Di.call(W);if(!w)return null;var n=qd(W,!0),z=n[0],Z=n[1],b={x:w.x,y:w.y,width:w.width,height:w.height},Q=s(z,Z);if(T instanceof S.XEditInteractor){b=O(b,Q);var o=W._55O,N=r.getEditPointSize()/U+2,m=0;o&&o._43O&&(m+=N/2,u(b,m))}return b},p._47O=function(B){var Q=this,p=Q.gv,N=p._editInteractor;N instanceof S.XEditInteractor||yd.call(Q,B)},p.rectIntersects=function(e){var L=this,w=L._data,F=L.gv,O=F.getZoom(),X=L._55O,Q=F._editInteractor;if(Q instanceof S.XEditInteractor&&F.isEditable(w)&&X&&X._43O&&"points"===w.s("edge.type")){var D=w.s("edge.points"),f=w.s("edge.segments");D=De(L,D),f&&f.size()||(f=dn(D)),D=D._as;var i=!1,Y=c?5:1,Z=e.x+Y,a=e.y+Y,q={x:Z,y:a};if(Q._edge===w&&Q._hoverSegmentIndex>=0){var j=F._editInteractor._hoverSegmentIndex,s=f.get(j),R=Yk(w,L,j),k=d;if(R!=d&&R>=0){var I=D[R],P=F.getSegmentHoverWidth()/O;if(2===s||1===s){var M=D[R+1];k=pd(new rc(I.x,I.y),new rc(M.x,M.y),new rc(q.x-P,q.y-P),new rc(q.x+2*P,q.y+2*P)),k.$62l===n&&(i=!0)}else if(3===s){var x=D[R+1],M=D[R+2];k=yc(new rc(I.x,I.y),new rc(x.x,x.y),new rc(M.x,M.y),new rc(q.x-P,q.y-P),new rc(q.x+2*P,q.y+2*P)),k.$62l===n&&(i=!0)}else if(4===s){var h=D[R+1],z=D[R+2];M=D[R+3],k=Ue(new rc(I.x,I.y),new rc(h.x,h.y),new rc(z.x,z.y),new rc(M.x,M.y),new rc(q.x-P,q.y-P),new rc(q.x+2*P,q.y+2*P)),k.$62l===n&&(i=!0)}}}if(i)return!0}return d},y._47O=function(u){var C=this,D=C.gv,s=D._editInteractor;s instanceof S.XEditInteractor||ze.call(C,u)},y.rectIntersects=function(o){var O=this,H=O._data,b=O.gv,L=b.getZoom(),i=O._55O,Y=b._editInteractor;if(Y instanceof S.XEditInteractor&&b.isEditable(H)&&i&&i._43O){var G=i.$15l,D=!1,x=c?5:1,u=o.x+x,M=o.y+x,B={x:u,y:M};if(G&&G.length===H.getPoints().size()||(es(O),G=i.$15l),Y._shape===H&&Y._hoverSegmentIndex>=0){var T=H.getSegments();T&&T.size()||(T=dn(G));var Z=b._editInteractor._hoverSegmentIndex,s=T.get(Z),p=Yk(H,O,Z),f=d;if(p!=d&&p>=0){var q=G[p],_=b.getSegmentHoverWidth()/L;if(2===s||1===s){var h=G[p+1];f=pd(new rc(q.x,q.y),new rc(h.x,h.y),new rc(B.x-_,B.y-_),new rc(B.x+2*_,B.y+2*_)),f.$62l===n&&(D=!0)}else if(3===s){var U=G[p+1],h=G[p+2];f=yc(new rc(q.x,q.y),new rc(U.x,U.y),new rc(h.x,h.y),new rc(B.x-_,B.y-_),new rc(B.x+2*_,B.y+2*_)),f.$62l===n&&(D=!0)}else if(4===s){var g=G[p+1],X=G[p+2];h=G[p+3],f=Ue(new rc(q.x,q.y),new rc(g.x,g.y),new rc(X.x,X.y),new rc(h.x,h.y),new rc(B.x-_,B.y-_),new rc(B.x+2*_,B.y+2*_)),f.$62l===n&&(D=!0)}}}if(D)return!0}return d},y._48O=function(){var g=this,z=g.gv,i=z._editInteractor;i instanceof S.XEditInteractor?(m._48O.call(g),g._55O._43O&&es(g)):rk.call(g)},y._79o=function(){var J=this,b=J.gv,F=b.getZoom(),B=b._editInteractor,l=ml.call(J);if(l){var n={x:l.x,y:l.y,width:l.width,height:l.height};if(B instanceof S.XEditInteractor){var N=J._55O,X=b.getEditPointSize()/F+2,q=0;N&&N._43O&&(q+=X/2,u(n,q))}return n}},m._47O=function(s){var x=this,C=x.gv,d=C._editInteractor;if(d instanceof S.XEditInteractor);else{var w=x._55O;w&&w._98o&&jm.call(x,s)}},m._2o=function(){var V=this,n=V.gv,N=n._editInteractor,X=V._data;return n.isEditable(X)&&N instanceof S.XEditInteractor?0:pr.call(V)},m._80o=function(n){var V=this,O=V.gv._editInteractor;if(xc.call(V,n),O&&O._debug){n.save(),n.beginPath(),n.lineWidth=1,n.strokeStyle="green";var v=V._79o();v&&(n.rect(v.x,v.y,v.width,v.height),n.stroke()),n.restore()}},y._80o=function(U){var F=this,O=F.gv._editInteractor;if(Mj.call(F,U),O&&O._debug){U.save(),U.beginPath(),U.lineWidth=1,U.strokeStyle="green";var X=F._79o();U.rect(X.x,X.y,X.width,X.height),U.stroke(),U.restore()}},m._48O=function(){var X=this,L=X.gv,M=X._data,T=L._editInteractor,n=X._55O,E=M.p(),v=M.getRotation();if(T instanceof S.XEditInteractor){if(n._42O){var B=Qk(E,M.getWidth(),M.getHeight(),v),k=B[0],C=B[1],V=B[2],h=B[3],H=B[4],p=B[5],D=B[6],P=B[7];n.$45l=[k,H,C,p,h,D,V,P]}}else re.call(X)},i.getResizeMode=function(){return this.$25l||"normal"},i.setResizeMode=function(h){var g=this.$25l;this.$25l=h,this.fp("resizeMode",g,h)},i.getSnapAngle=function(){return this.$26l||Math.PI/36},i.setSnapAngle=function(h){var v=this.$26l;this.$26l=h,this.fp("snapAngle",v,h)},i.getSnapSpacing=function(){return this.$27l},i.setSnapSpacing=function(s){var e=this.$27l;this.$27l=s,this.fp("snapSpacing",e,s)},i.getPointSnapSpacing=function(){return this._pointSnapSpacing},i.setPointSnapSpacing=function(G){var e=this._pointSnapSpacing;this._pointSnapSpacing=G,this.fp("pointSnapSpacing",e,G)},i.setHelperEditableFunc=function(R){var r=this._helperEditableFunc;this._helperEditableFunc=R,this.fp("helperEditableFunc",r,R)},i.getHelperEditableFunc=function(){return this._helperEditableFunc},i.setLeftTopHelpers=function(a){var e=this._leftTopHelpers;this._leftTopHelpers=a,this.fp("leftTopHelpers",e,a)},i.getLeftTopHelpers=function(){return this._leftTopHelpers},i.setLeftTopHelpersAlign=function(Q){var m=this._leftTopHelpersAlign;this._leftTopHelpersAlign=Q,this.fp("leftTopHelpersAlign",m,Q)},i.getLeftTopHelpersAlign=function(){return this._leftTopHelpersAlign},i.setRightTopHelpers=function(j){var M=this._rightTopHelpers;this._rightTopHelpers=j,this.fp("rightTopHelpers",M,j)},i.getRightTopHelpers=function(){return this._rightTopHelpers},i.setRightTopHelpersAlign=function(Z){var J=this._rightTopHelpersAlign;this._rightTopHelpersAlign=Z,this.fp("rightTopHelpersAlign",J,Z)},i.getRightTopHelpersAlign=function(){return this._rightTopHelpersAlign},i.setLeftBottomHelpers=function(U){var o=this._leftBottomHelpers;this._leftBottomHelpers=U,this.fp("leftBottomHelpers",o,U)},i.getLeftBottomHelpers=function(){return this._leftBottomHelpers},i.setLeftBottomHelpersAlign=function(M){var H=this._leftBottomHelpersAlign;this._leftBottomHelpersAlign=M,this.fp("leftBottomHelpersAlign",H,M)},i.getLeftBottomHelpersAlign=function(){return this._leftBottomHelpersAlign},i.setRightBottomHelpers=function(N){var C=this._rightBottomHelpers;this._rightBottomHelpers=N,this.fp("rightBottomHelpers",C,N)},i.getRightBottomHelpers=function(){return this._rightBottomHelpers},i.setRightBottomHelpersAlign=function(q){var b=this._rightBottomHelpersAlign;this._rightBottomHelpersAlign=q,this.fp("rightBottomHelpersAlign",b,q)},i.getRightBottomHelpersAlign=function(){return this._rightBottomHelpersAlign},i.setEdgeHelpers=function(Q){var f=this._edgeHelpers;this._edgeHelpers=Q,this.fp("edgeHelpers",f,Q)},i.getEdgeHelpers=function(){return this._edgeHelpers},i.isHelperEditable=function(y,I){return y instanceof Q&&("host"===I||"edge"===I||"elevation"===I||"tall"===I)?!1:y instanceof Y&&("source"===I||"target"===I)?!1:"pointElevation"===I?this._helperEditableFunc?this._helperEditableFunc(y,I):!1:this._helperEditableFunc?this._helperEditableFunc(y,I):!0},i.getEditHelperSize=function(){return this._editHelperSize||(c?28:16)},i.setEditHelperSize=function(N){var T=this._editHelperSize;this._editHelperSize=N,this.fp("editHelperSize",T,N)},i.getEditRectBorderColor=function(){return this.$28l||"rgb(0, 168, 255)"},i.setEditRectBorderColor=function(t){var B=this.$28l;this.$28l=t,this.fp("editRectBorderColor",B,t)},i.getNodeBorderColor=function(){return this.$29l||"#1ABC9C"},i.setNodeBorderColor=function(Z){var o=this.$29l;this.$29l=Z,this.fp("nodeBorderColor",o,Z)},i.getEditRectBorderStyle=function(){return this.$30l||"dashed"},i.setEditRectBorderStyle=function(c){var h=this.$30l;this.$30l=c,this.fp("editRectBorderStyle",h,c)},i.getControlPointBackground=function(){return this.$31l||"#ff0"},i.setControlPointBackground=function(_){var o=this.$31l;this.$31l=_,this.fp("controlPointBackground",o,_)},i.getControlPointBorderColor=function(){return this.$32l||this._editPointBorderColor},i.setControlPointBorderColor=function(L){var M=this.$32l;this.$32l=L,this.fp("controlPointBorderColor",M,L)},i.getJoinPointBackground=function(){return this.$33l||this._editPointBackground},i.setJoinPointBackground=function(W){var j=this.$33l;this.$33l=W,this.fp("joinPointBackground",j,W)},i.getJoinPointBorderColor=function(){return this.$34l||this._editPointBorderColor},i.setJoinPointBorderColor=function(H){var f=this.$34l;this.$34l=H,this.fp("joinPointBorderColor",f,H)},i.getDirectionLineColor=function(){return this.$35l||"#888"},i.setDirectionLineColor=function(I){var q=this.$35l;this.$35l=I,this.fp("directionLineColor",q,I)},i.getSegmentHoverColor=function(){return this.$36l||"rgba(255, 0, 0, 0.3)"},i.setSegmentHoverColor=function(a){var Z=this.$36l;this.$36l=a,this.fp("segmentHoverColor",Z,a)},i.getSegmentHoverWidth=function(){return this.$22l||(c?16:8)},i.setSegmentHoverWidth=function($){var B=this.$22l;this.$22l=$,this.fp("segmentHoverWidth",B,$)},i.getSnapPointBorderColor=function(){return this.$38l||"#f00"},i.setSnapPointBorderColor=function(N){var x=this.$38l;this.$38l=N,this.fp("snapPointBorderColor",x,N)},i.getEditRectPadding=function(){return this.$39l!=d?this.$39l:6},i.setEditRectPadding=function(h){var r=this.$39l;this.$39l=h,this.fp("editRectPading",r,h)},i.isRectEditable=function(V){var M=this,o=M._editInteractor;return o instanceof S.XEditInteractor?M._rectEditableFunc?M._rectEditableFunc(V):!0:Sd.call(M,V)},i.isPointEditable=function(Q){var U=this,g=U._editInteractor;return g instanceof S.XEditInteractor?U._pointEditableFunc?U._pointEditableFunc(Q):!0:Ob.call(U,Q)},i.validateImpl=function(){var l=this,j=l.$14l,w=l._editInteractor;if(j){var b=l.getWidth(),H=l.getHeight();(b!==j.clientWidth||H!==j.clientHeight)&&(w&&(w._68I=1),J.setCanvas(j,b,H),l._32I=1)}mh.call(this)},i.isEditable=function(W){var X=Do.call(this,W),T=this._editInteractor;if(T instanceof S.XEditInteractor&&W instanceof Q){if(!W.s("2d.editable"))return!1;var k=this.getEditableFunc();X=k?k(W):!0}return X},i._42=function(H,j){var g=this,C=g._editInteractor;bd.call(g,H,j),C instanceof S.XEditInteractor&&C._68I&&C._42()},i.isSnapPoint=function(){return!0};var yf=function(X){arguments.length>0&&this.$58l(X)},lf=yf.prototype;lf.$58l=function(U){this.$62l=U,this.points=new Array},lf.$56l=function(_){this.points.push(_)},lf.$57l=function(O){this.points=this.points.concat(O)};var rc=function(d,C){arguments.length>0&&this.$58l(d,C)},ho=rc.prototype;ho.$58l=function(Z,p){this.x=Z,this.y=p},ho.add=function(t){return new rc(this.x+t.x,this.y+t.y)},ho.addEquals=function(s){return this.x+=s.x,this.y+=s.y,this},ho.$55l=function(h){return new rc(this.x*h,this.y*h)},ho.eq=function(q){return this.x==q.x&&this.y==q.y},ho.lt=function(G){return this.x<G.x&&this.y<G.y},ho.lte=function(a){return this.x<=a.x&&this.y<=a.y},ho.gt=function(N){return this.x>N.x&&this.y>N.y},ho.gte=function(m){return this.x>=m.x&&this.y>=m.y},ho.lerp=function(W,t){return new rc(this.x+(W.x-this.x)*t,this.y+(W.y-this.y)*t)},ho.distanceFrom=function(g){var c=this.x-g.x,j=this.y-g.y;return B(c*c+j*j)},ho.min=function(w){return new rc(g(this.x,w.x),g(this.y,w.y))},ho.max=function(x){return new rc(o(this.x,x.x),o(this.y,x.y))},ho.toString=function(){return this.x+","+this.y};var kh=function(){this.$58l(arguments)},pg=kh.prototype;kh.TO=1e-6,kh.AC=6,pg.$58l=function(p){this.co=new Array;for(var C=p.length-1;C>=0;C--)this.co.push(p[C])},pg.$55l=function(t){for(var Q=new kh,X=0;X<=this.$50l()+t.$50l();X++)Q.co.push(0);for(var X=0;X<=this.$50l();X++)for(var j=0;j<=t.$50l();j++)Q.co[X+j]+=this.co[X]*t.co[j];return Q},pg.$59l=function(){for(var f=this.$50l();f>=0&&H(this.co[f])<=kh.TO;f--)this.co.pop()},pg.$50l=function(){return this.co.length-1},pg.$51l=function(){var L;switch(this.$59l(),this.$50l()){case 0:L=new Array;break;case 1:L=this.$52l();break;case 2:L=this.$53l();break;case 3:L=this.$54l();break;case 4:L=this.$63l();break;default:L=new Array}return L},pg.$52l=function(){var b=new Array,F=this.co[1];return 0!=F&&b.push(-this.co[0]/F),b},pg.$53l=function(){var G=new Array;if(2==this.$50l()){var i=this.co[2],d=this.co[1]/i,z=this.co[0]/i,f=d*d-4*z;if(f>0){var r=B(f);G.push(.5*(-d+r)),G.push(.5*(-d-r))}else 0==f&&G.push(.5*-d)}return G},pg.$63l=function(){var o=new Array;if(4==this.$50l()){var X=this.co[4],d=this.co[3]/X,W=this.co[2]/X,D=this.co[1]/X,S=this.co[0]/X,U=new kh(1,-W,d*D-4*S,-d*d*S+4*W*S-D*D).$54l(),e=U[0],J=d*d/4-W+e;if(H(J)<=kh.TO&&(J=0),J>0){var P=B(J),V=3*d*d/4-P*P-2*W,u=(4*d*W-8*D-d*d*d)/(4*P),c=V+u,Y=V-u;if(H(c)<=kh.TO&&(c=0),H(Y)<=kh.TO&&(Y=0),c>=0){var M=B(c);o.push(-d/4+(P+M)/2),o.push(-d/4+(P-M)/2)}if(Y>=0){var M=B(Y);o.push(-d/4+(M-P)/2),o.push(-d/4-(M+P)/2)}}else if(0>J);else{var u=e*e-4*S;if(u>=-kh.TO){if(0>u&&(u=0),u=2*B(u),V=3*d*d/4-2*W,V+u>=kh.TO){var Z=B(V+u);o.push(-d/4+Z/2),o.push(-d/4-Z/2)}if(V-u>=kh.TO){var Z=B(V-u);o.push(-d/4+Z/2),o.push(-d/4-Z/2)}}}}return o},pg.$54l=function(){var b=new Array;if(3==this.$50l()){var O=this.co[3],T=this.co[2]/O,n=this.co[1]/O,J=this.co[0]/O,U=(3*n-T*T)/3,a=(2*T*T*T-9*n*T+27*J)/27,j=T/3,F=a*a/4+U*U*U/27,y=a/2;if(H(F)<=kh.TO&&(F=0),F>0){var x,z,r=B(F);x=-y+r,z=x>=0?k(x,1/3):-k(-x,1/3),x=-y-r,x>=0?z+=k(x,1/3):z-=k(-x,1/3),b.push(z-j)}else if(0>F){var c=B(-U/3),I=W(B(-F),-y)/3,f=V(I),G=A(I),P=B(3);b.push(2*c*f-j),b.push(-c*(f+P*G)-j),b.push(-c*(f-P*G)-j)}else{var x;x=y>=0?-k(y,1/3):k(-y,1/3),b.push(2*x-j),b.push(-x-j)}}return b};var Ji=function(s,C){arguments.length>0&&this.$58l(s,C)},Od=Ji.prototype;Od.$58l=function(j,B){this.x=j,this.y=B},Od.length=function(){return B(this.x*this.x+this.y*this.y)},Od.$60l=function($){return this.x*$.x+this.y*$.y};var _g=function(x,F,y,b){var $,t=(b.x-y.x)*(x.y-y.y)-(b.y-y.y)*(x.x-y.x),W=(F.x-x.x)*(x.y-y.y)-(F.y-x.y)*(x.x-y.x),K=(b.y-y.y)*(F.x-x.x)-(b.x-y.x)*(F.y-x.y);if(0!=K){var j=t/K,B=W/K;j>=0&&1>=j&&B>=0&&1>=B?($=new yf(n),$.points.push(new rc(x.x+j*(F.x-x.x),x.y+j*(F.y-x.y)))):$=new yf(T)}else $=0==t||0==W?new yf("C"):new yf("P");return $},Zj=function(N,v,G,k,i){var c,P,F,L,q,Z,A,K=k.min(i),D=k.max(i),x=new yf(T);c=v.$55l(-2),F=N.add(c.add(G)),c=N.$55l(-2),P=v.$55l(2),L=c.add(P),q=new rc(N.x,N.y),A=new Ji(k.y-i.y,i.x-k.x),Z=k.x*i.y-i.x*k.y;for(var d=new kh(A.$60l(F),A.$60l(L),A.$60l(q)+Z).$51l(),R=0;R<d.length;R++){var U=d[R];if(U>=0&&1>=U){var W=N.lerp(v,U),u=v.lerp(G,U),t=W.lerp(u,U);k.x==i.x?K.y<=t.y&&t.y<=D.y&&(x.$62l=n,x.$56l(t)):k.y==i.y?K.x<=t.x&&t.x<=D.x&&(x.$62l=n,x.$56l(t)):t.gte(K)&&t.lte(D)&&(x.$62l=n,x.$56l(t))}}return x},yc=function(c,M,p,m,E){var H=m.min(E),q=m.max(E),e=new rc(q.x,H.y),X=new rc(H.x,q.y),D=Zj(c,M,p,H,e),b=Zj(c,M,p,e,q),y=Zj(c,M,p,q,X),Q=Zj(c,M,p,X,H),o=new yf(T);return o.$57l(D.points),o.$57l(b.points),o.$57l(y.points),o.$57l(Q.points),o.points.length>0&&(o.$62l=n),o},Ib=function(_,I,S,e,F,J){var x,h,z,b,c,G,m,V,P,Q,Y=F.min(J),q=F.max(J),A=new yf(T);x=_.$55l(-1),h=I.$55l(3),z=S.$55l(-3),b=x.add(h.add(z.add(e))),c=new Ji(b.x,b.y),x=_.$55l(3),h=I.$55l(-6),z=S.$55l(3),b=x.add(h.add(z)),G=new Ji(b.x,b.y),x=_.$55l(-3),h=I.$55l(3),z=x.add(h),m=new Ji(z.x,z.y),V=new Ji(_.x,_.y),Q=new Ji(F.y-J.y,J.x-F.x),P=F.x*J.y-J.x*F.y;for(var U=new kh(Q.$60l(c),Q.$60l(G),Q.$60l(m),Q.$60l(V)+P).$51l(),W=0;W<U.length;W++){var s=U[W];if(s>=0&&1>=s){var d=_.lerp(I,s),C=I.lerp(S,s),H=S.lerp(e,s),j=d.lerp(C,s),X=C.lerp(H,s),f=j.lerp(X,s);F.x==J.x?Y.y<=f.y&&f.y<=q.y&&(A.$62l=n,A.$56l(f)):F.y==J.y?Y.x<=f.x&&f.x<=q.x&&(A.$62l=n,A.$56l(f)):f.gte(Y)&&f.lte(q)&&(A.$62l=n,A.$56l(f))}}return A},Ue=function(U,Y,c,H,P,I){var t=P.min(I),R=P.max(I),O=new rc(R.x,t.y),K=new rc(t.x,R.y),h=Ib(U,Y,c,H,t,O),w=Ib(U,Y,c,H,O,R),A=Ib(U,Y,c,H,R,K),p=Ib(U,Y,c,H,K,t),g=new yf(T);return g.$57l(h.points),g.$57l(w.points),g.$57l(A.points),g.$57l(p.points),g.points.length>0&&(g.$62l=n),g},pd=function(H,u,l,X){var t=l.min(X),Z=l.max(X),q=new rc(Z.x,t.y),$=new rc(t.x,Z.y),M=_g(t,q,H,u),R=_g(q,Z,H,u),h=_g(Z,$,H,u),j=_g($,t,H,u),C=new yf(T);return C.$57l(M.points),C.$57l(R.points),C.$57l(h.points),C.$57l(j.points),C.points.length>0&&(C.$62l=n),C},pq=S.XEditInteractor=function(K){var S=this,Q=S._view=document.createElement("canvas");Q.className="editCanvas",Q.style.position="absolute",pq.superClass.constructor.call(S,K)};E.def(pq,S.Interactor,{ms_edit:1,setUp:function(){var o=this,f=o.gv,Q=f.getView(),r=o._view;pq.superClass.setUp.call(o),f.setEditInteractor(o),f.$14l=r,f._79O?Q.insertBefore(r,f._79O):Q.appendChild(r);var O=o.$49l=o.$11l.bind(o);f.dm().md(O),f.sm().ms(O),f.mp(O)},tearDown:function(){var i=this,N=i.gv,$=N.getView(),Z=i.$49l;pq.superClass.tearDown.call(i),N.setEditInteractor(d),N.$14l=d,$.removeChild(i._view),N.dm().umd(Z),N.sm().ums(Z),N.ump(Z)},clear:function(){var e=this,R=e.gv;delete e._hoverSegmentIndex,delete e._edge,delete e._shape,delete R._editing,delete e.$10l,delete e.$13l,delete e.$9l,delete e._removePointIndex,delete e._lp,e.$12l="",delete e.$40l,delete e.$67l,delete e.$72l,delete e.$73l,delete e.$75l,delete e.$1l,delete e.$3l,delete e.$2l,delete e.$92l,delete e.$93l,delete e.$94l,e.clearDragging()},handle_keydown:function(d){this.$48l!==d.shiftKey&&(this.$48l=d.shiftKey,this.handle_mousemove(d,D,!0))},handle_keyup:function(h){this.$48l!==h.shiftKey&&(this.$48l=h.shiftKey,this.handle_mousemove(h,D,!0))},handle_touchstart:function(Y){this.handle_mousemove(Y),this.handle_mousedown(Y)},handle_mousedown:function(G){U(G);var B=this,o=B.$13l,Z=B.gv,K=Z.dm(),y=K.getHistoryManager(),T=Z.sm(),j=Z.getZoom(),m=Z.lp(G),k=E.isDoubleClick(G),R=E.isLeftButton(G),H=B.$7l,d=B._shape,$=B._hoverSegmentIndex,X=B._edge,_=B.$87l,s=B.$88l,P=function(){B._68I||_===B.$87l&&s===B.$88l||B.$43l()};if(7!==B.$67l&&(delete B.$87l,delete B.$88l),R&&(d||X)&&$>=0&&k&&(d&&T.contains(d)||X&&T.contains(X))){var v=Tm.call(B,d||X,$,m);return B.addShapePoint(d||X,$,v),w(function(){B.handle_mousemove(G)},40),void 0}if(R&&(d||X)&&B._removePointIndex>=0&&k)return B.removeShapePoint(),B.$5l=1,w(function(){B.handle_mousemove(G)},40),void 0;if(!R||!Z._editing)return P(),void 0;if(d&&o>=0){var i=d.getPoints().get(o),p=d.p(),V=ui(p,i.x-p.x,i.y-p.y,-H+d.getRotation());A=ui(p,m.x-p.x,m.y-p.y,-H),B.$24l={x:A.x-V.x,y:A.y-V.y},B.startDragging(G),y&&y.beginInteraction(),B.fi({kind:"beginEditPoint",event:G,data:d,index:o}),B.$88l=o,B.$87l=d}else if(B.$10l){var S=Z.sm().getSelection(),t=B.$6l,n=B.$1l={},r=B.$3l={},b=B.$16l[q[B.$10l]],L={x:t.x,y:t.y},O={x:t.x+t.width/2,y:t.y+t.height/2};B.$24l={x:m.x-b.x/j,y:m.y-b.y/j},B.$2l=a(B.$8l),B.$4l=a(t),S.each(function(d){if(d instanceof Y){var g=d.p(),y=d.getWidth(),z=d.getHeight(),m=ui(O,g.x-O.x,g.y-O.y,-H);n[d.getId()]={x:g.x-y/2,y:g.y-z/2,width:y,height:z},r[d.getId()]={x:(m.x-L.x)/t.width,y:(m.y-L.y)/t.height}}}),B.startDragging(G),y&&y.beginInteraction(),B.fi({kind:"beginEditRect",event:G,direction:B.$10l})}else if(X&&o>=0){var W=De(Z.getDataUI(X),X.s("edge.points")),i=W.get(o);B.$24l={x:m.x-i.x,y:m.y-i.y},B.startDragging(G),y&&y.beginInteraction(),B.fi({kind:"beginEditPoint",event:G,data:X,index:o}),B.$88l=o,B.$87l=X}else if(B.$40l){var t=B.$6l,O={x:t.x+t.width/2,y:t.y+t.height/2},C=a(B.$23l);C.x/=j,C.y/=j;var D=ui(O,C.x-O.x,C.y-O.y,-H),A=ui(O,m.x-O.x,m.y-O.y,-H);B.$24l={x:A.x-D.x,y:A.y-D.y},B.startDragging(G),y&&y.beginInteraction(),B.fi({kind:"beginEditRotation",event:G,data:B._rotationNode})}else if([1,2,3,5,6,7,8,9].indexOf(B.$67l)>=0)B.startDragging(G);else if(B.$71l&&k&&B.$79l(B.$71l,m)){var I=T.toSelection();y&&y.beginInteraction(),I.each(function(R){K.remove(R)}),y&&y.endInteraction()}P()},$11l:function(){var K=this,t=K.gv;t._editing&&(K.$13l==d||K._shape==d&&K._edge==d)&&(K.$73l==d||1!==K.$67l&&5!==K.$67l&&6!==K.$67l)||(K.$5l=1),K._68I=1},$46l:function(W){var Y=this,$=Y.gv,E=$.lp(W),U=[];return Vg($,function(T){var c=$.getDataUI(T);if(c){var F=c._79o();f(F,E)&&U.push(T)}}),U},$47l:function(C){var T=this,Q=T.$13l,r=T.gv.dm(),N=r.getHistoryManager();T.$10l?(T.fi({kind:"endEditRect",event:C,direction:T.$10l}),N&&N.endInteraction()):T._shape&&Q>=0?(T.fi({kind:"endEditPoint",event:C,data:T._shape,index:Q}),N&&N.endInteraction()):T._edge&&Q>=0?(T.fi({kind:"endEditPoint",event:C,data:T._edge,index:Q}),N&&N.endInteraction()):T.$23l&&T.$40l&&(T.fi({kind:"endEditRotation",event:C}),N&&N.endInteraction())},handleWindowTouchEnd:function(W){this.handleWindowMouseUp(W)},handleWindowMouseUp:function(M){var z=this,S=z.gv,B=S.dm(),u=B.getHistoryManager(),$=z._shape,q=z._edge,U=z.$13l,A=z.$40l,x=z.$9l,O=z.$10l,m=z.$67l;if(($||q)&&U>=0&&x>=0){var l,L;if($){var k=$.p(),h=$.getRotation();l=$.getPoints(),L=l.get(x),_b($,k,h,U,L,!1)}else if(l=De(S.getDataUI(q),q.s("edge.points"),!0),L=l.get(x),0===U){var N=l.get(0);q.s("edge.source.offset.x",L.x-N.x),q.s("edge.source.offset.y",L.y-N.y)}else if(U===l.size()-1){var V=l.get(l.size()-1);q.s("edge.target.offset.x",L.x-V.x),q.s("edge.target.offset.y",L.y-V.y)}else"points"===q.s("edge.type")&&(l.set(U,L),q.s("edge.points",Ah(l)))}z.$47l(M);var e=z.$73l;1===m?(u&&u.beginInteraction(),e?S.sm().each(function(r){if(r.setHost&&S.isHelperEditable(r,"host")){r.setHost(e);
  2. var $=z.$75l,h=z.$74l;$&&(r.s("attach.row.index",$.rowIndex),r.s("attach.column.index",$.columnIndex)),h&&(r.s("attach.index",h.attachIndex),r.s("attach.offset",h.attachOffset),r.s("attach.offset.relative",!1),r.s("attach.offset.opposite",!1))}}):S.sm().each(function(b){b.setHost&&S.isHelperEditable(b,"host")&&(b.setHost(d),b.s("attach.row.index",D),b.s("attach.column.index",D),b.s("attach.index",D),b.s("attach.offset",D),b.s("attach.offset.relative",!1),b.s("attach.offset.opposite",!1))}),u&&u.endInteraction()):2===m?(u&&u.beginInteraction(),e?S.sm().each(function(o){o.setParent&&S.isHelperEditable(o,"parent")&&o.setParent(e)}):S.sm().each(function(o){o.setParent&&S.isHelperEditable(o,"parent")&&o.setParent(d)}),u&&u.endInteraction()):3===m?e&&(u&&u.beginInteraction(),S.sm().each(function(w){if(S.isHelperEditable(w,"edge")&&w instanceof Y&&e instanceof Y){var m=new K.Edge;B.add(m),m.setSource(w),m.setTarget(e),z.onEdgeCreated&&z.onEdgeCreated(M,m)}}),u&&u.endInteraction()):(5===m||6===m)&&e&&(u&&u.beginInteraction(),S.sm().each(function(f){f instanceof Q&&e instanceof Y&&(5===m&&S.isHelperEditable(f,"source")?f.setSource(e):6===m&&S.isHelperEditable(f,"source")&&f.setTarget(e))}),u&&u.endInteraction()),(O||A)&&z.$43l(!0),c?(z.clear(),delete z.$64l,z._68I||z.$43l()):(z.handle_mousemove(M,!0),m&&!z._68I&&z.$43l())},handleWindowTouchMove:function(Q){this.handleWindowMouseMove(Q)},handleWindowMouseMove:function(D){this._78I(D)},handle_mousemove:function(v,k,r){if(!this._pause){if(!r){var U=c?Vb(v):v;this.$61l={clientX:U.clientX,clientY:U.clientY}}if(k===!0||!j()){var I=this,V=I.gv,_=!1,l=d;I.clear(),V.sm().size()>0&&(l=V.lp(r?I.$61l:v),_=I._79I(v,l)),_&&(V._editing=1),I.$12l!==I.$65l&&(I.$65l=I.$12l,I.setCursor(I.$12l)),I.$40l!==I.$64l&&(I.$64l=I.$40l,I._68I||I.$43l()),I._hoverSegmentIndex!==I.$66l&&(I.$66l=I._hoverSegmentIndex,I._68I||I.$43l())}}},_78I:function(g){this.autoScroll(g);var t=this,q=t.gv,V=q.lp(g),o=q.getZoom(),m=t.$13l;if((t._shape||t._edge)&&m>=0){var O,f,n,s=t._shape,z=t._edge,u=t.$24l,A=q.getPointSnapSpacing(),C=function(b,t){return A==d||isNaN(A)?{x:b,y:t}:{x:R(b/A)*A,y:R(t/A)*A}};if(s){O=s.getPoints();var G=s.p(),S=s.getRotation(),X=0;f=ui(G,V.x-G.x,V.y-G.y,-S),_b(s,G,S,m,V,!0,u,C),t.fi({kind:"betweenEditPoint",event:g,data:s,index:m})}else if(z){O=De(q.getDataUI(z),z.s("edge.points"),!0),V.x-=u.x,V.y-=u.y,f=V;var k,l,K=z.s("edge.offset"),j=O.size(),$=j>2;if(0===m){var y=O.get(0);K&&(y=lh(y,O.get(1),-K,$),V=lh(V,O.get(1),-K,$)),k=V.x-y.x,l=V.y-y.y,n=C(k,l),z.s("edge.source.offset.x",n.x),z.s("edge.source.offset.y",n.y)}else if(m===j-1){var c=O.get(j-1);K&&(c=lh(c,O.get(j-2),-K,$),V=lh(V,O.get(j-2),-K,$)),k=V.x-c.x,l=V.y-c.y,n=C(k,l),z.s("edge.target.offset.x",n.x),z.s("edge.target.offset.y",n.y)}else"points"===z.s("edge.type")&&(n=C(V.x,V.y),n.e=O.get(m).e,O.set(m,n),z.s("edge.points",Ah(O)));t.fi({kind:"betweenEditPoint",event:g,data:z,index:m})}if(delete t.$9l,q.isSnapPoint(s)||q.isSnapPoint(z))for(X=0;X<O.size();X++)if(X!==m){var r=O.get(X);if(h(r,f)<q.getEditPointSize()/o){t.$9l=X;break}}}else if(t.$10l){var u=t.$24l;V.x-=u.x,V.y-=u.y;var i=q.sm().getSelection(),F=t.$1l,p=t.$7l,J=t.$10l,T=t.$4l,D=t.$2l,e=q.getEditRectPadding()/o,a=2*e,L=q.getSnapSpacing(),U=L!=d&&!isNaN(L),_=Zd(D,V,J,p,2*e,q.getResizeMode(),U,!0),x=t.$6l;if(U){var M=_.width-a,b=_.height-a,Z=R(M/L)*L,Wd=R(b/L)*L,Lf=Z-M,oh=Wd-b;("west"===J||"northwest"===J||"southwest"===J)&&(Lf=-Lf),("north"===J||"northwest"===J||"northeast"===J)&&(oh=-oh),_=Zd(D,V,J,p,2*e,q.getResizeMode(),U,!1,Lf,oh)}t.$8l=_,x.x=_.x+e,x.y=_.y+e,x.width=_.width-a,x.height=_.height-a;var rl=_.x+_.width/2,Nk=_.y+_.height/2,zg=x.x,_n=x.y,ks=x.width/T.width,hm=x.height/T.height;i.each(function(C){if(C instanceof Y&&q.isEditable(C)&&q.isRectEditable(C)){var n=F[C.getId()],K=t.$3l[C.getId()],S={x:n.x+n.width/2,y:n.y+n.height/2},y=0,B=0,d=J,j=180*H(p-C.getRotation())/N;"northeast"===J?j>=315||45>j?(y=n.width*ks+n.x,B=n.height*(1-hm)+n.y,d="northeast"):j>=45&&135>j?(y=n.width*(1-hm)+n.x,B=n.height*(1-ks)+n.y,d="northwest"):j>=135&&225>j?(y=n.width*(1-ks)+n.x,B=n.height*hm+n.y,d="southwest"):(y=n.width*hm+n.x,B=n.height*ks+n.y,d="southeast"):"north"===J?j>=315||45>j?(B=n.height*(1-hm)+n.y,d="north"):j>=45&&135>j?(y=n.width*(1-hm)+n.x,d="west"):j>=135&&225>j?(B=n.height*hm+n.y,d="south"):(y=n.width*hm+n.x,d="east"):"northwest"===J?j>=315||45>j?(y=n.width*(1-ks)+n.x,B=n.height*(1-hm)+n.y,d="northwest"):j>=45&&135>j?(y=n.width*(1-hm)+n.x,B=n.height*ks+n.y,d="southwest"):j>=135&&225>j?(y=n.width*ks+n.x,B=n.height*hm+n.y,d="southeast"):(y=n.width*hm+n.x,B=n.height*(1-ks)+n.y,d="northeast"):"west"===J?j>=315||45>j?(y=n.width*(1-ks)+n.x,d="west"):j>=45&&135>j?(B=n.height*ks+n.y,d="south"):j>=135&&225>j?(y=n.width*ks+n.x,d="east"):(B=n.height*(1-ks)+n.y,d="north"):"southwest"===J?j>=315||45>j?(y=n.width*(1-ks)+n.x,B=n.height*hm+n.y,d="southwest"):j>=45&&135>j?(y=n.width*hm+n.x,B=n.height*ks+n.y,d="southeast"):j>=135&&225>j?(y=n.width*ks+n.x,B=n.height*(1-hm)+n.y,d="northeast"):(y=n.width*(1-hm)+n.x,B=n.height*(1-ks)+n.y,d="northwest"):"east"===J?j>=315||45>j?(y=n.width*ks+n.x,d="east"):j>=45&&135>j?(B=n.height*(1-ks)+n.y,d="north"):j>=135&&225>j?(y=n.width*(1-ks)+n.x,d="west"):(B=n.height*ks+n.y,d="south"):"south"===J?j>=315||45>j?(B=n.height*hm+n.y,d="south"):j>=45&&135>j?(y=n.width*hm+n.x,d="east"):j>=135&&225>j?(B=n.height*(1-hm)+n.y,d="north"):(y=n.width*(1-hm)+n.x,d="west"):"southeast"===J&&(j>=315||45>j?(y=n.width*ks+n.x,B=n.height*hm+n.y,d="southeast"):j>=45&&135>j?(y=n.width*hm+n.x,B=n.height*(1-ks)+n.y,d="northeast"):j>=135&&225>j?(y=n.width*(1-ks)+n.x,B=n.height*(1-hm)+n.y,d="northwest"):(y=n.width*(1-hm)+n.x,B=n.height*ks+n.y,d="southwest"));var T=ui(S,y-S.x,B-S.y,C.getRotation());kl(C,n,d,{x:T.x,y:T.y});var I=zg+x.width*K.x,Q=_n+x.height*K.y,i={x:I,y:Q};i=ui({x:rl,y:Nk},i.x-rl,i.y-Nk,p),C.p(i.x,i.y)}}),t.fi({kind:"betweenEditRect",event:g,direction:J})}else if(t.$23l&&t.$40l){var pi=t.$8l,Oq=pi.width,qe=pi.height,G={x:pi.x+Oq/2,y:pi.y+qe/2},u=t.$24l,gl=t.$23l,wk=gl.x/o-G.x,fc=gl.y/o-G.y,Ni=B(wk*wk+fc*fc),xp=Math.asin(u.x/Ni),xk=q.sm().getSelection(),Dr=v+W(V.y-G.y,V.x-G.x)-xp,Uo=q.getSnapAngle(),Dr=R(Dr/Uo)*Uo;0>Dr&&(Dr+=I);var Gl=Dr-t.$7l,hi=[G.x,0,G.y];xk.each(function(u){if(q.isEditable(u)&&q.isRotationEditable(u)&&q.isVisible(u)){var N=Ci(u.p3(),hi),U=Ql();$g(U,-Gl),u.setRotation(u.getRotation()+Gl),$f(N,U),u.p3(hi[0]+N[0],hi[1]+N[1],hi[2]+N[2])}}),t.$7l=Dr,t.fi({kind:"betweenEditRotation",event:g})}else if([1,2,3,5,6].indexOf(t.$67l)>=0)t.$72l=g,t.$78l||(t.$78l=1,w(function(){E.isDragging()&&t.$43l(),delete t.$78l},12));else if(7===t.$67l){if(t.$87l instanceof P){var s=t.$87l,cp=t.$88l,Lm=E.clone(s.getPoints().get(cp)),Fr=V.y-Lm.y;Lm.e||(Lm.e=0),t.$92l||(t.$92l=Lm.e),Lm.e=t.$92l-Fr,s.setPoint(cp,Lm)}else if(t.$87l instanceof Q){var z=t.$87l,cp=t.$88l,O=De(q.getDataUI(z),z.s("edge.points")),Lm=O.get(cp),Fr=V.y-Lm.y;Lm.e||(Lm.e=0),t.$92l||(t.$92l=Lm.e),Lm.e=t.$92l-Fr,O.set(cp,Lm),z.s("edge.points",Ah(O))}}else if(8===t.$67l){var xk=q.sm().getSelection(),eg=t.$93l;eg||(eg=t.$93l={}),xk.each(function(s){if(s.p3){var b=s.p3(),C=eg[s.getId()];C==d&&(C=eg[s.getId()]=b[1]),s.p3([b[0],C-(V.y-t.$90l.y/o),b[2]])}})}else if(9===t.$67l){var xk=q.sm().getSelection(),tk=t.$94l;tk||(tk=t.$94l={}),xk.each(function(I){if(I.s3){var D=I.s3(),l=tk[I.getId()];l==d&&(l=tk[I.getId()]=D[1]);var u=l-(V.y-t.$91l.y/o);0>u&&(u=.01),I.s3([D[0],u,D[2]])}})}},$79l:function(U,z){var e=this,g=e.gv,Q=g.getZoom(),u=g.getEditHelperSize(),$=U.x/Q,K=U.y/Q,T=u/Q,B=T/2;return f({x:$-B,y:K-B,width:T,height:T},z)?!0:void 0},getHelperCursor:function(){return"crosshair"},_79I:function(r,D){for(var G=this,Z=G.gv,s=Z.getZoom(),R=Z.getEditPointSize(),E=R/s,N=E/2,m=G.$46l(r),v=0;v<m.length;v++){var K,l,a=m[v],x=Z.getDataUI(a);if(x&&x._55O){var X=x._55O;if(X._43O&&a instanceof Q){if(K=a.s("edge.points"),K=De(x,K),l=a.s("edge.segments"),l&&l.size()||(l=dn(K)),G.$42l(a,D,K._as,l,"edge"))return!0;if("points"===a.s("edge.type"))return G.$41l(a,D,K._as,l,"edge"),void 0}if(X._43O&&a instanceof P&&X.$15l&&X.$15l.length===a.getPoints().size()){if(K=X.$15l,l=a.getSegments(),l&&l.size()||(l=dn(K)),G.$42l(a,D,K,l,"shape"))return!0;if(G.$41l(a,D,K,l,"shape"))return}}}if(G.$16l){var K,p=G.$16l,Y=p[3].x-p[7].x,T=p[3].y-p[7].y,k=B(Y*Y+T*T),e=p[1].x-p[5].x,c=p[1].y-p[5].y,H=B(e*e+c*c),y={x:D.x*s,y:D.y*s};if(G._80I(y,0,p[0],"northwest",k,H)||G._80I(y,1,p[1],"north",k,H)||G._80I(y,2,p[2],"northeast",k,H)||G._80I(y,7,p[7],"west",k,H)||G._80I(y,3,p[3],"east",k,H)||G._80I(y,6,p[6],"southwest",k,H)||G._80I(y,5,p[5],"south",k,H)||G._80I(y,4,p[4],"southeast",k,H))return!0}if(G.$23l){var L=G.$23l,J=L.x/s,t=L.y/s;if(f({x:J-N,y:t-N,width:E,height:E},D))return G.$40l=1,G.$12l=G.getHelperCursor("rotation")||"crosshair",!0}return G.$68l&&G.$79l(G.$68l,D)?(G.$67l=1,G.$12l=G.getHelperCursor("host")||"crosshair",!0):G.$69l&&G.$79l(G.$69l,D)?(G.$67l=2,G.$12l=G.getHelperCursor("parent")||"crosshair",!0):G.$70l&&G.$79l(G.$70l,D)?(G.$67l=3,G.$12l=G.getHelperCursor("edge")||"crosshair",!0):G.$71l&&G.$79l(G.$71l,D)?(G.$67l=4,G.$12l=G.getHelperCursor("remove")||"crosshair",!0):G.$82l&&G.$79l(G.$82l,D)?(G.$67l=5,G.$12l=G.getHelperCursor("source")||"crosshair",!0):G.$83l&&G.$79l(G.$83l,D)?(G.$67l=6,G.$12l=G.getHelperCursor("target")||"crosshair",!0):G._pointElevationHelperPoint&&G.$79l(G._pointElevationHelperPoint,D)?(G.$67l=7,G.$12l=G.getHelperCursor("pointElevation")||"crosshair",!0):G.$90l&&G.$79l(G.$90l,D)?(G.$67l=8,G.$12l=G.getHelperCursor("elevation")||"crosshair",!0):G.$91l&&G.$79l(G.$91l,D)?(G.$67l=9,G.$12l=G.getHelperCursor("tall")||"crosshair",!0):!1},_80I:function(Q,t,D,F,m,c){var _=this,X=_.gv,b=X.getEditPointSize(),i=b/2,x=X.sm(),z=X.isDirectionEditable;if(z&&1===x.size()){var y=x.ld();if(z=z.bind(X),y instanceof Y){if(!z(y,F))return!1;if("east"===F){if(z(y,"northeast")&&z(y,"southeast")&&2*b>=c)return!1}else if("west"===F){if(z(y,"northwest")&&z(y,"southwest")&&2*b>=c)return!1}else if("north"===F){if(z(y,"northwest")&&z(y,"northeast")&&2*b>=m)return!1}else if("south"===F&&z(y,"southwest")&&z(y,"southeast")&&2*b>=m)return!1}}else{if(2*b>=m&&("north"===F||"south"===F))return!1;if(2*b>=c&&("east"===F||"west"===F))return!1}if(f({x:D.x-i,y:D.y-i,width:b,height:b},Q)){if(_.$10l!==F){var p=180*_.$7l/N,I="";p>=337.5||22.5>p?I="north":p>=22.5&&67.5>p?I="northeast":p>=67.5&&112.5>p?I="east":p>=112.5&&157.5>p?I="southeast":p>=157.5&&202.5>p?I="south":p>=202.5&&247.5>p?I="southwest":p>=247.5&&292.5>p?I="west":p>=292.5&&337.5>p&&(I="northwest");var s=ns.indexOf(I),I=ns[t-(1-s)+8];switch(I){case"northwest":_.$12l="nwse-resize";break;case"northeast":_.$12l="nesw-resize";break;case"southwest":_.$12l="nesw-resize";break;case"southeast":_.$12l="nwse-resize";break;case"north":_.$12l="ns-resize";break;case"east":_.$12l="ew-resize";break;case"south":_.$12l="ns-resize";break;case"west":_.$12l="ew-resize"}_.$10l=F}return!0}return!1},$42l:function(O,W,A,j,s){var y,R=this,B=R.gv,x=B.getEditPointSize(),D=x/B.getZoom(),$=-1,v={x:W.x,y:W.y,width:0,height:0},l=function(p){"shape"===s?R._shape=O:R._edge=O,R._removePointIndex=p},T=function(V){"shape"===s?R._shape=O:R._edge=O,R.$13l=V,R.$12l="crosshair"};for(u(v,D/2),$=A.length-1,y=j.size()-1;y>=0;y--){var I=j.get(y);if(1===I||2===I)$-=1;else if(3===I){var Y=A[$-1];if(f(v,Y))return T($-1),!0;$-=2}else if(4===I){var c=A[$-1],C=A[$-2];if(f(v,c))return T($-1),!0;if(f(v,C))return T($-2),!0;$-=3}}for($=A.length-1,y=j.size()-1;y>=0;y--){var I=j.get(y),h=A[$];if(f(v,h))return l($),T($),!0;1===I||2===I?$-=1:3===I?$-=2:4===I&&($-=3)}return!1},$41l:function(U,Y,f,C,e){var b=this,Z=b.gv,L=-1,p=0,s={x:Y.x,y:Y.y,width:0,height:0},X=function(_,o){b._hoverSegmentIndex=o,b._lp=Y,"shape"===e?b._shape=U:b._edge=U};for(u(s,Z.getSegmentHoverWidth()/2/Z.getZoom()),U instanceof P&&U.isClosePath()&&C.indexOf(5)<0&&(C=new G(C._as),C.add(5));p<C.size();p++){var l=C.get(p);if(1===l){var R=f[L],H=f[L+1];if(R){var $=pd(new rc(R.x,R.y),new rc(H.x,H.y),new rc(s.x,s.y),new rc(s.x+s.width,s.y+s.height));if($.$62l===n&&$.points.length>0)return X($,p),!0}L+=1}else if(2===l){var R=f[L],H=f[L+1],$=pd(new rc(R.x,R.y),new rc(H.x,H.y),new rc(s.x,s.y),new rc(s.x+s.width,s.y+s.height));if($.$62l===n&&$.points.length>0)return X($,p),!0;L+=1}else if(3===l){var R=f[L],K=f[L+1],M=f[L+2],$=yc(new rc(R.x,R.y),new rc(K.x,K.y),new rc(M.x,M.y),new rc(s.x,s.y),new rc(s.x+s.width,s.y+s.height));if($.$62l===n)return X($,p),!0;L+=2}else if(4===l){var R=f[L],J=f[L+1],O=f[L+2],M=f[L+3],$=Ue(new rc(R.x,R.y),new rc(J.x,J.y),new rc(O.x,O.y),new rc(M.x,M.y),new rc(s.x,s.y),new rc(s.x+s.width,s.y+s.height));if($.$62l===n)return X($,p),!0;L+=3}else if(5===l){var R=f[L],H=f[0];if(R){var $=pd(new rc(R.x,R.y),new rc(H.x,H.y),new rc(s.x,s.y),new rc(s.x+s.width,s.y+s.height));if($.$62l===n&&$.points.length>0)return X($,p),!0}}}return!1},addShapePoint:function(M,x,N){var n=this,p=n.gv,U=p.dm(),K=U.getHistoryManager();if(K&&K.beginInteraction(),0===arguments.length&&(M=n._shape||n._edge,x=n._hoverSegmentIndex,N=n._lp),M instanceof P||M instanceof Q){var O=Yk(M,p.getDataUI(M),x);if(!isNaN(x)&&N&&!isNaN(O)){var q=N;if(M instanceof P){var H=M.p(),g=M.getRotation(),i=M.toSegments();i&&i.size()||(i=dn(M.getPoints())),M.isClosePath()&&i.indexOf(5)<0&&(i=new G(i._as),i.add(5));var C=i.get(x),s="addPoint",j="removePointAt";if(2===C||1===C){var _={x:q.x,y:q.y};i.add(C,x),_=ui(H,_.x-H.x,_.y-H.y,-g),M[s](_,O+1)}else if(3===C){var A=M.getPoints(),R=A.get(O),Z=A.get(O+2),_={x:q.x,y:q.y};_=ui(H,_.x-H.x,_.y-H.y,-g);var c=og(R,_),z=og(_,Z);i.removeAt(x),i.add(3,x),i.add(3,x),M.setPoint(O+1,_),M[s](z,O+2),M[s](c,O+1)}else if(4===C){var A=M.getPoints(),R=A.get(O),Z=A.get(O+3),_={x:q.x,y:q.y};_=ui(H,_.x-H.x,_.y-H.y,-g);var c=Gh(R,_),z=oj(R,_),F=Gh(_,Z),m=oj(_,Z);i.removeAt(x),i.add(4,x),i.add(4,x),M[j](O+1),M[j](O+1),M[s](_,O+1),M[s](m,O+2),M[s](F,O+2),M[s](z,O+1),M[s](c,O+1)}else if(5===C){var _={x:q.x,y:q.y};i.add(2,x),_=ui(H,_.x-H.x,_.y-H.y,-g),M[s](_,O+1)}M.isClosePath()&&i.remove(5),M.setSegments(i);var h=M.getWidth(),l=M.getHeight(),L=M.p().x-h/2,T=M.p().y-l/2;L-=H.x,T-=H.y;var V=Ug(M,{x:L,y:T,width:h,height:l},g,H);M.p(V.x,V.y)}else if(M instanceof Q){if("points"!==M.s("edge.type"))return K&&K.endInteraction(),void 0;var A=M.s("edge.points");i=M.s("edge.segments"),A=De(p.getDataUI(M),A),i&&i.size()||(i=dn(A)),i=new G(i._as.slice(0)),A=new G(A._as.slice(0));var C=i.get(x);if(2===C||1===C){var _={x:q.x,y:q.y};i.add(C,x),A.add(_,O+1)}else if(3===C){var R=A.get(O),Z=A.get(O+2),_={x:q.x,y:q.y},c=og(R,_),z=og(_,Z);i.removeAt(x),i.add(3,x),i.add(3,x),A.set(O+1,_),A.add(z,O+2),A.add(c,O+1)}else if(4===C){var R=A.get(O),Z=A.get(O+3),_={x:q.x,y:q.y},c=Gh(R,_),z=oj(R,_),F=Gh(_,Z),m=oj(_,Z);i.removeAt(x),i.add(4,x),i.add(4,x),A.removeAt(O+1),A.removeAt(O+1),A.add(_,O+1),A.add(m,O+2),A.add(F,O+2),A.add(z,O+1),A.add(c,O+1)}M.s("edge.points",Ah(A)),M.s("edge.segments",i)}}}K&&K.endInteraction()},removeShapePoint:function(N,Y){var K=this,n="removeAt",c=K.gv,L=c.dm(),C=L.getHistoryManager();if(C&&C.beginInteraction(),0===arguments.length&&(N=K._shape||K._edge,Y=K._removePointIndex),Y>=0&&(N instanceof P||N instanceof Q)){var U=Xb(N,K.gv.getDataUI(N),Y),R=Y;if(N instanceof P){var f=N.p(),e=N.toSegments();e&&e.size()||(e=dn(N.getPoints()));var Z=e.get(U),u="removePointAt";if(1===Z&&0===R)if(N.getPoints().size()>1){var y=e.get(U+1);e[n](U+1),3===y?N[u](R+1):4===y&&(N[u](R+2),N[u](R+1)),N[u](R)}else N.dm().remove(N);else 2===Z||1===Z?(e[n](U),N[u](R)):3===Z?(e[n](U),N[u](R),N[u](R-1)):4===Z&&(e[n](U),N[u](R),N[u](R-1),N[u](R-2));N.setSegments(e);var h=N.getWidth(),J=N.getHeight(),p=N.p().x-h/2,M=N.p().y-J/2;p-=f.x,M-=f.y;var H=Ug(N,{x:p,y:M,width:h,height:J},N.getRotation(),f);N.p(H.x,H.y)}else if(N instanceof Q){if("points"!==N.s("edge.type"))return C&&C.endInteraction(),void 0;var B=N.s("edge.points");if(e=N.s("edge.segments"),B&&(B=De(K.gv.getDataUI(N),B),e&&e.size()||(e=dn(B))),0===Y||Y===B.size()-1)return C&&C.endInteraction(),void 0;e=new G(e._as.slice(0)),B=new G(B._as.slice(0));var Z=e.get(U);2===Z||1===Z?(e[n](U),B[n](R)):3===Z?(e[n](U),B[n](R),B[n](R-1)):4===Z&&(e[n](U),B[n](R),B[n](R-1),B[n](R-2)),N.s("edge.segments",e),N.s("edge.points",Ah(B))}}C&&C.endInteraction()},changeShapeSegment:function(O,F,Z){var k=this,r=k.gv,v=r.dm(),s=v.getHistoryManager();if(s&&s.beginInteraction(),1!==arguments.length||isNaN(O)||(Z=O,O=k._shape||k._edge,F=k._hoverSegmentIndex),O instanceof P||O instanceof Q){var T=Yk(O,k.gv.getDataUI(O),F);if(!isNaN(F)&&!isNaN(T))if(O instanceof P){var t=O.p(),p=O.toSegments();p&&p.size()||(p=dn(O.getPoints()));var Y=p.get(F),i=O.toPoints();if(1===Z||2===Z)1===Y||2===Y?p.set(F,Z):3===Y?(p.set(F,Z),i.removeAt(T+1)):4===Y&&(p.set(F,Z),i.removeAt(T+1),i.removeAt(T+1));else if(3===Z){var c=function(){var z=i.get(T),N=i.get(T+1),o=og(z,N);p.set(F,3),i.add(o,T+1)};2===Y||1===Y?c():4===Y&&(i.removeAt(T+1),i.removeAt(T+1),c())}else if(4===Z){var L=function(){var y=i.get(T),l=i.get(T+1),q=Gh(y,l),x=oj(y,l);p.set(F,4),i.add(q,T+1),i.add(x,T+2)};2===Y||1===Y?L():3===Y&&(i.removeAt(T+1),L())}O.setSegments(p),O.setPoints(i);var B=O.getWidth(),E=O.getHeight(),S=O.p().x-B/2,n=O.p().y-E/2;S-=t.x,n-=t.y;var A=new Ug(O,{x:S,y:n,width:B,height:E},O.getRotation(),t);O.p(A.x,A.y)}else if(O instanceof Q){if("points"!==O.s("edge.type"))return s&&s.endInteraction(),void 0;var i=O.s("edge.points");p=O.s("edge.segments"),i&&(i=De(k.gv.getDataUI(O),i),p&&p.size()||(p=dn(i))),p=new G(p._as.slice(0)),i=new G(i._as.slice(0));var Y=p.get(F);if(1===Z||2===Z)1===Y||2===Y?p.set(F,Z):3===Y?(p.set(F,Z),i.removeAt(T+1)):4===Y&&(p.set(F,Z),i.removeAt(T+1),i.removeAt(T+1));else if(3===Z){var c=function(){var J=i.get(T),m=i.get(T+1),z=og(J,m);p.set(F,3),i.add(z,T+1)};2===Y||1===Y?c():4===Y&&(i.removeAt(T+1),i.removeAt(T+1),c())}else if(4===Z){var L=function(){var s=i.get(T),c=i.get(T+1),B=Gh(s,c),$=oj(s,c);p.set(F,4),i.add(B,T+1),i.add($,T+2)};2===Y||1===Y?L():3===Y&&(i.removeAt(T+1),L())}O.s("edge.points",Ah(i)),O.s("edge.segments",p)}}s&&s.endInteraction()},getDefaultSegments:function(o){var m=this.gv,L=m.getDataUI(o);if(o instanceof Q){var j=o.s("edge.points");return j=De(L,j),dn(j)}if(o instanceof P){var j=o.getPoints(),H=o.getSegments();return H&&H.size()>0?H:dn(j)}},$43l:function(q){var M=this;q&&(M.$5l=1),M._68I=1,M._42()},_42:function(){var U=this;if(U._68I){delete U._68I;var h=U.gv,A=U.$5l,t=h.getZoom(),c=h.getEditPointSize(),w=c/2,$=new G,T=U._view,r=U._edge,N=U._shape,j=T.getContext("2d"),F=h.tx(),H=h.ty(),e=d,f=h.getEditPointBackground(),D=h.getControlPointBackground(),v=h.getControlPointBorderColor(),X=h.getEditPointBorderColor(),x=h.getEditRectBorderColor(),g=h.getDirectionLineColor(),W=h.getSegmentHoverColor(),R=h.getSnapPointBorderColor(),m=h.getJoinPointBackground(),q=h.getJoinPointBorderColor(),o=h.getSegmentHoverWidth(),S=[5,5],p=h.getEditRectBorderStyle();fd(h,function(m){h.isSelected(m)&&h.isVisible(m)&&$.add(m)}),j.clearRect(0,0,l(T.width),l(T.height)),j.save(),J.translateAndScale(j,F,H,1);var C=d,i={x:0,y:0,width:0,height:0},V=0,M=0,n=0,k=0,y=0,b=0,Qc=0,Uq=0,Sc=0,as=0,Qo=[];if(A?(delete U.$6l,delete U.$8l,delete U.$7l,delete U.$16l,delete U.$23l):(C=U.$6l,e=U.$7l),delete U.$68l,delete U.$69l,delete U.$71l,delete U.$70l,delete U.$82l,delete U.$83l,delete U._pointElevationHelperPoint,delete U.$90l,delete U.$91l,delete U.$75l,delete U.$74l,$.each(function(T){var $=h.getDataUI(T);if($){var v=$._55O;if(h.isEditable(T))v._56O&&T instanceof Y&&M++,Qo.push(T),v._42O&&T instanceof Y&&V++,h.isHelperEditable(T,"host")&&k++,h.isHelperEditable(T,"parent")&&n++,h.isHelperEditable(T,"remove")&&y++,h.isHelperEditable(T,"edge")&&b++,h.isHelperEditable(T,"source")&&Qc++,h.isHelperEditable(T,"target")&&Uq++,h.isHelperEditable(T,"elevation")&&Sc++,h.isHelperEditable(T,"tall")&&as++;else if(T instanceof L&&T.isExpanded()){var i=!0,f=h.getEditableFunc();f&&(i=f(T)),i&&(h.isHelperEditable(T,"host")&&k++,h.isHelperEditable(T,"parent")&&n++,h.isHelperEditable(T,"remove")&&y++,h.isHelperEditable(T,"edge")&&b++,h.isHelperEditable(T,"source")&&Qc++,h.isHelperEditable(T,"target")&&Uq++,h.isHelperEditable(T,"elevation")&&Sc++,h.isHelperEditable(T,"tall")&&as++,Qo.push(T))}}}),j.beginPath(),j.lineWidth=1,j.strokeStyle=h.getNodeBorderColor(),Qo.forEach(function(E){var m=h.getDataUI(E),g=m._55O;if(A)if(e==d&&(e=E instanceof Q?0:E instanceof L&&E.isExpanded()?0:E.getRotation(),U.$7l=e),C==d){var a,o,H;if(E instanceof L&&E.isExpanded()||E instanceof Q){var r=h.getDataUIBounds(E);o=r.width,H=r.height,a={x:r.x+o/2,y:r.y+H/2}}else a=E.p(),o=E.getWidth(),H=E.getHeight();C={x:a.x,y:a.y,width:0,height:0},i.x=a.x-o/2,i.y=a.y-H/2,i.width=o,i.height=H,C=O(C,i)}else{var a,o,H,u,W=C.x+C.width/2,N=C.y+C.height/2,I={x:W,y:N};if(E instanceof L&&E.isExpanded()||E instanceof Q){u=0;var r=h.getDataUIBounds(E);o=r.width,H=r.height,a={x:r.x+o/2,y:r.y+H/2}}else a=E.p(),o=E.getWidth(),H=E.getHeight(),u=E.getRotation();var n={x:a.x-o/2,y:a.y-H/2,width:o,height:H},G={x:n.x,y:n.y},S={x:n.x+n.width,y:n.y},B={x:n.x,y:n.y+n.height},R={x:n.x+n.width,y:n.y+n.height},G=ui(a,G.x-a.x,G.y-a.y,u),B=ui(a,B.x-a.x,B.y-a.y,u),R=ui(a,R.x-a.x,R.y-a.y,u),S=ui(a,S.x-a.x,S.y-a.y,u),P=-e,k=ui(I,G.x-I.x,G.y-I.y,P),v=ui(I,S.x-I.x,S.y-I.y,P),D=ui(I,B.x-I.x,B.y-I.y,P),q=ui(I,R.x-I.x,R.y-I.y,P),F=s([k,v,D,q]);C=O(C,F),C.x-=W,C.y-=N;var l=Ug(d,C,e,I);C.x=l.x-C.width/2,C.y=l.y-C.height/2}if(V>1&&h.isEditable(E)&&h.isRectEditable(E)&&E instanceof Y){var $=E.getRect(),x=g.$45l,T=Vp(x[0],t),_=Vp(x[2],t),z=Vp(x[4],t),f=Vp(x[6],t);E.getRotation()?(j.moveTo(T.x,T.y),j.lineTo(_.x,_.y),j.lineTo(z.x,z.y),j.lineTo(f.x,f.y),j.lineTo(T.x,T.y)):j.rect($.x*t,$.y*t,$.width*t,$.height*t)}}),j.stroke(),C){U.$6l=a(C),u(C,h.getEditRectPadding()/t);var ih={x:C.x+C.width/2,y:C.y+C.height/2},of=Qk(ih,C.width,C.height,e),ts=of[0],wm=of[1],Oo=of[2],wl=of[3],Jg=of[4],xk=of[5],_o=of[6],Nf=of[7];if(ts=Vp(of[0],t),wm=Vp(of[1],t),Oo=Vp(of[2],t),wl=Vp(of[3],t),Jg=Vp(of[4],t),xk=Vp(of[5],t),_o=Vp(of[6],t),Nf=Vp(of[7],t),U.$8l=C,V>0&&(U.$16l=[ts,Jg,wm,xk,wl,_o,Oo,Nf],j.beginPath(),j.lineWidth=1,j.strokeStyle=x,"dashed"===p&&j.setLineDash&&j.setLineDash(S),j.moveTo(ts.x,ts.y),j.lineTo(wm.x,wm.y),j.lineTo(wl.x,wl.y),j.lineTo(Oo.x,Oo.y),j.lineTo(ts.x,ts.y),j.stroke(),"dashed"===p&&j.setLineDash&&j.setLineDash([])),j.beginPath(),j.lineWidth=1,j.fillStyle=f,j.strokeStyle=X,V>0){var Vk=xk.x-Nf.x,wj=xk.y-Nf.y,Qd=B(Vk*Vk+wj*wj),Xh=Jg.x-_o.x,$l=Jg.y-_o.y,df=B(Xh*Xh+$l*$l),Ac=2*c;if(h.isDirectionEditable&&1===Qo.length){var mi=Qo[0],Qf=h.getDataUI(mi),sl=Qf._55O,Ur=h.isDirectionEditable.bind(h);if(sl._42O){var qq,gd,Zn,wq;Ur(mi,"northwest")&&(qq=!0,j.rect(ts.x-w,ts.y-w,c,c)),Ur(mi,"northeast")&&(gd=!0,j.rect(wm.x-w,wm.y-w,c,c)),Ur(mi,"southwest")&&(Zn=!0,j.rect(Oo.x-w,Oo.y-w,c,c)),Ur(mi,"southeast")&&(wq=!0,j.rect(wl.x-w,wl.y-w,c,c)),Ur(mi,"north")&&(qq&&gd?Qd>Ac&&j.rect(Jg.x-w,Jg.y-w,c,c):j.rect(Jg.x-w,Jg.y-w,c,c)),Ur(mi,"south")&&(wq&&Zn?Qd>Ac&&j.rect(_o.x-w,_o.y-w,c,c):j.rect(_o.x-w,_o.y-w,c,c)),Ur(mi,"west")&&(Zn&&qq?df>Ac&&j.rect(Nf.x-w,Nf.y-w,c,c):j.rect(Nf.x-w,Nf.y-w,c,c)),Ur(mi,"east")&&(wq&&gd?df>Ac&&j.rect(xk.x-w,xk.y-w,c,c):j.rect(xk.x-w,xk.y-w,c,c))}}else Qd>Ac&&(j.rect(Jg.x-w,Jg.y-w,c,c),j.rect(_o.x-w,_o.y-w,c,c)),df>Ac&&(j.rect(xk.x-w,xk.y-w,c,c),j.rect(Nf.x-w,Nf.y-w,c,c)),j.rect(ts.x-w,ts.y-w,c,c),j.rect(wm.x-w,wm.y-w,c,c),j.rect(Oo.x-w,Oo.y-w,c,c),j.rect(wl.x-w,wl.y-w,c,c)}if(M>0){var Zb=U.$23l=ui(Jg,0,2*-c,e);j.moveTo(Zb.x+w,Zb.y),j.arc(Zb.x,Zb.y,w,0,I,!1)}j.fill(),j.stroke(),U.$40l&&U.$44l(j,C,e);var kk,Dg,Ap=h.getLeftTopHelpers(),mc=h.getRightTopHelpers(),Mn=h.getLeftBottomHelpers(),Ci=h.getRightBottomHelpers(),An=h.getEdgeHelpers(),Jh=h.getEditHelperSize(),nf=Jh/2,fq=function(B,z,K,v){"leftTop"===z?(kk=C.x*t-Jh-w-("h"===v?K*(Jh+w):0)-1,Dg=C.y*t-Jh-w-("v"===v?K*(Jh+w):0)-1):"rightTop"===z?(kk=(C.x+C.width)*t+w+("h"===v?K*(Jh+w):0)+1,Dg=C.y*t-Jh-w-("v"===v?K*(Jh+w):0)-1):"leftBottom"===z?(kk=C.x*t-Jh-w-("h"===v?K*(Jh+w):0)-1,Dg=(C.y+C.height)*t+w+("v"===v?K*(Jh+w):0)+1):"rightBottom"===z&&(kk=(C.x+C.width)*t+w+("h"===v?K*(Jh+w):0)+1,Dg=(C.y+C.height)*t+w+("v"===v?K*(Jh+w):0)+1);var J=kk+nf,O=Dg+nf,L=(C.x+C.width/2)*t,r=(C.y+C.height/2)*t,W=ui({x:L,y:r},J-L,O-r,e);if("host"===B){if(k>0)return U.$77l(j,e,W),!0}else if("edge"===B){if(b>0)return U.$80l(j,e,W),!0}else if("remove"===B){if(y>0)return Qo&&1===Qo.length&&Qo[0]instanceof Q?U.$81l(j,e,{x:L+Jh/2+5,y:r}):U.$81l(j,e,W),!0}else if("parent"===B){if(n>0)return Qo&&1===Qo.length&&Qo[0]instanceof Q?U.$76l(j,e,{x:L-Jh/2-5,y:r}):U.$76l(j,e,W),!0}else if("elevation"===B){if(Sc>0)return U.$85l(j,e,W),!0}else if("tall"===B){if(as>0)return U.$86l(j,e,W),!0}else if("source"===B||"target"===B){var a=Qo[0],s=h.getDataUI(a),T=qd(s,!0),u=T[0],c=T[1];if(Qc&&"source"===B)return U.$84l(j,C,u,!0,a.isLooped(),z,K,v),!0;if(Uq&&"target"===B)return U.$84l(j,C,c,!1,a.isLooped(),z,K,v),!0}};if(Ap&&Ap.length>0){var bn=0;Ap.forEach(function(F){fq(F,"leftTop",bn,h.getLeftTopHelpersAlign()||"h")&&bn++})}if(mc&&mc.length>0){var bn=0;mc.forEach(function(v){fq(v,"rightTop",bn,h.getRightTopHelpersAlign()||"h")&&bn++})}if(Mn&&Mn.length>0){var bn=0;Mn.forEach(function(i){fq(i,"leftBottom",bn,h.getLeftBottomHelpersAlign()||"h")&&bn++})}if(Ci&&Ci.length>0){var bn=0;Ci.forEach(function(C){fq(C,"rightBottom",bn,h.getRightBottomHelpersAlign()||"h")&&bn++})}if(An&&An.length>0&&((Qc||Uq)&&Qo&&1===Qo.length&&Qo[0]instanceof Q?!0:!1)){var bn=0;An.forEach(function(X){fq(X,"edge",bn,"h")&&bn++})}if(U.$72l){var Ag,eo=U.$67l,nq=U.$68l,_m=U.$69l,jk=(U.$71l,U.$70l),Ih=U.$82l,Ie=U.$83l;if(1===eo?Ag=nq:2===eo?Ag=_m:3===eo?Ag=jk:5===eo?Ag=Ih:6===eo&&(Ag=Ie),Ag){var kh=h.lp(U.$72l),Gl=h.getDataAt(U.$72l);if(Gl&&Gl instanceof Y){var $c,Jn,pk;if(U.$73l=Gl,1===eo)if(Gl instanceof K.Grid)$c=U.$75l=us(Gl,kh);else if(Gl instanceof K.Shape){pk=U.$74l=Lg(Gl,kh);var Lk=Gl.getPoints();if(pk){var xm=pk.attachIndex,Tf=Yk(Gl,h.getDataUI(Gl),xm)+1,Xi=Tf+1>=Lk.size()?0:Tf+1,pp=Lk.get(Tf),ad=Lk.get(Xi),Kq=Gl.p(),ko=Gl.getRotation();pp=ui(Kq,pp.x-Kq.x,pp.y-Kq.y,ko),ad=ui(Kq,ad.x-Kq.x,ad.y-Kq.y,ko),j.beginPath(),j.strokeStyle=W,j.lineWidth=o,j.moveTo(pp.x*t,pp.y*t),j.lineTo(ad.x*t,ad.y*t),j.stroke()}}$c?Jn=$c.rect:(Jn=E.clone(h.getDataUIBounds(Gl)),E.grow(Jn,2)),j.beginPath(),j.rect(Jn.x*t,Jn.y*t,Jn.width*t,Jn.height*t),j.strokeStyle=1===eo||4===eo||6===eo?Z:z,j.lineWidth=2,j.setLineDash&&j.setLineDash([8,8]),j.stroke()}else delete U.$73l;kh.x=kh.x*t,kh.y=kh.y*t;var bq=Cg(Ag.x,Ag.y,kh.x,kh.y),Xk=ui(Ag,kh.x-Ag.x,kh.y-Ag.y,-bq),Un=Xk.x-Ag.x;j.translate(Ag.x,Ag.y),j.rotate(bq),_.width=Un,_.height=40;var nm=z;(1===eo||4===eo||6===eo)&&(nm=Z),_.comps[0].gradientColor=nm,E.drawImage(j,_,0,-20,Un,40)}}}if($.each(function(s){var M=h.getDataUI(s);if(M){var e,y,k=M._55O,z=M._78o;if(k&&k._43O&&s instanceof P?(e=k.$15l,y=s.getSegments(),y&&y.size()||(y=dn(e)),s.isClosePath()&&y.indexOf(5)<0&&(y=new G(y._as),y.add(5))):k&&z&&k._43O&&(e=s.s("edge.points"),y=s.s("edge.segments"),e=De(M,e),y&&y.size()||(y=dn(e)),e&&(e=e._as)),e&&y){var L=0,K=y.size(),u=U._hoverSegmentIndex;e=e.slice(0);for(var a=0;a<e.length;a++)e[a]=Vp(e[a],t);j.beginPath(),j.strokeStyle=g,j.lineWidth=1,L=0;for(var a=0;K>a;a++){var f=y.get(a);if(1===f||2===f)L++;else if(3===f){var H=e[L-1],B=e[L],T=e[L+1];j.moveTo(H.x,H.y),j.lineTo(B.x,B.y),j.lineTo(T.x,T.y),L+=2}else if(4===f){var H=e[L-1],C=e[L],c=e[L+1],T=e[L+2];j.moveTo(H.x,H.y),j.lineTo(C.x,C.y),j.moveTo(c.x,c.y),j.lineTo(T.x,T.y),L+=3}}if(j.stroke(),N===s||r===s&&"points"===r.s("edge.type")){j.beginPath(),L=0,j.strokeStyle=W,j.lineWidth=o;for(var a=0;K>a;a++){var f=y.get(a);if(1===f||2===f){if(u===a){var H=e[L-1],T=e[L];j.moveTo(H.x,H.y),j.lineTo(T.x,T.y);break}L++}else if(3===f){if(u===a){var H=e[L-1],B=e[L],T=e[L+1];j.moveTo(H.x,H.y),j.quadraticCurveTo(B.x,B.y,T.x,T.y);break}L+=2}else if(4===f){if(u===a){var H=e[L-1],C=e[L],c=e[L+1],T=e[L+2];j.moveTo(H.x,H.y),j.bezierCurveTo(C.x,C.y,c.x,c.y,T.x,T.y);break}L+=3}else if(5===f&&u===a){var H=e[L-1],T=e[0];j.moveTo(H.x,H.y),j.lineTo(T.x,T.y);break}}j.stroke()}j.beginPath(),L=0,j.strokeStyle=q,j.lineWidth=1,j.fillStyle=m;for(var a=0;K>a;a++){var f=y.get(a);if(1===f||2===f){var T=e[L];j.moveTo(T.x+w,T.y),j.arc(T.x,T.y,w,0,I,!0),L++}else if(3===f){var T=e[L+1];j.moveTo(T.x+w,T.y),j.arc(T.x,T.y,w,0,I,!0),L+=2}else if(4===f){var T=e[L+2];j.moveTo(T.x+w,T.y),j.arc(T.x,T.y,w,0,I,!0),L+=3}}j.fill(),j.stroke(),j.beginPath(),L=0,j.strokeStyle=v,j.lineWidth=1,j.fillStyle=D;for(var a=0;K>a;a++){var f=y.get(a);if(1===f||2===f)L++;else if(3===f){var B=e[L];j.moveTo(B.x+w,B.y),j.arc(B.x,B.y,w,0,I,!0),L+=2}else if(4===f){var C=e[L],c=e[L+1];j.moveTo(C.x+w,C.y),j.arc(C.x,C.y,w,0,I,!0),j.moveTo(c.x+w,c.y),j.arc(c.x,c.y,w,0,I,!0),L+=3}}if(j.fill(),j.stroke(),j.beginPath(),L=0,j.strokeStyle=R,j.lineWidth=2,(N===s||r===s)&&U.$9l!=d){var T=e[U.$9l];j.moveTo(T.x+w,T.y),j.arc(T.x,T.y,w,0,I,!0),j.stroke()}}}}),U.$87l&&h.sm().contains(U.$87l)){var Er,ln=U.$87l,Tr=U.$88l,Jh=h.getEditHelperSize(),nf=Jh/2;if(h.isHelperEditable(ln,"pointElevation"))if(ln instanceof P){var jd=ln.getPosition();Er=E.clone(ln.getPoints().get(Tr)),Er=ui({x:jd.x,y:jd.y},Er.x-jd.x,Er.y-jd.y,ln.getRotation()),Er.x*=t,Er.y*=t,j.translate(Er.x,Er.y),E.drawImage(j,ei,nf,-nf,Jh,Jh),j.translate(-Er.x,-Er.y),U._pointElevationHelperPoint={x:Er.x+Jh,y:Er.y}}else if(ln instanceof Q){var hj=De(h.getDataUI(ln),ln.s("edge.points")),Er=E.clone(hj.get(Tr));Er.x*=t,Er.y*=t,j.translate(Er.x,Er.y),E.drawImage(j,ei,nf,-nf,Jh,Jh),j.translate(-Er.x,-Er.y),U._pointElevationHelperPoint={x:Er.x+Jh,y:Er.y}}}j.restore(),U.$5l=0}},$89l:function(t,O,$,X){t.save();var Q=this,j=Q.gv,u=j.getEditHelperSize(),y=u/2;t.beginPath(),t.translate($.x,$.y),t.rotate(O),E.drawImage(t,X,-y,-y,u,u),t.restore()},$85l:function(o,T,l){var _=this;_.$90l=l,_.$89l(o,T,l,ei)},$86l:function(R,p,_){var Y=this;Y.$91l=_,Y.$89l(R,p,_,vg)},$77l:function(K,Q,x){var e=this;e.$68l=x,e.$89l(K,Q,x,r)},$80l:function(f,m,J){var w=this;w.$70l=J,w.$89l(f,m,J,$)},$81l:function(S,M,k){var g=this;g.$71l=k,g.$89l(S,M,k,uh)},$76l:function(d,U,E){var D=this;D.$69l=E,D.$89l(d,U,E,b)},$84l:function(r,y,d,p,h){var k,q=this,Q=q.gv,g=Q.getZoom(),X=Q.getEditHelperSize(),l=X/2;d.x*=g,d.y*=g,h&&(p?d.x-=l+5:d.x+=l+5),d.y-=X-2,p?(q.$82l=d,k=Pl):(q.$83l=d,k=Aq),r.beginPath(),r.translate(d.x,d.y),E.drawImage(r,k,-l,-l,X,X),r.translate(-d.x,-d.y)},$44l:function(e,J,F){e.save();var X=this.gv.getZoom(),G=B(k(J.width,2)+k(J.height,2))/2*X+10,z=G,M=z+8,h=z+18,b=F,p=J.x+J.width/2,T=J.y+J.height/2;e.translate(p*X,T*X),e.beginPath(),e.strokeStyle="rgb(150, 150, 150)";for(var E=0,o=0,x=0,j=0,m=0,U=0;360>U;U++)E=U*N/180,0===U%5&&(o=V(E)*z,x=A(E)*z,j=V(E)*M,m=A(E)*M,e.moveTo(o,x),e.lineTo(j,m)),0===U%45&&(o=V(E)*z,x=A(E)*z,j=V(E)*h,m=A(E)*h,e.moveTo(o,x),e.lineTo(j,m));e.stroke(),e.beginPath(),e.rotate(-v),e.beginPath(),e.fillStyle="rgba(255, 0, 0, 0.1)",e.strokeStyle="rgb(157, 157, 157)",e.moveTo(0,0),e.arc(0,0,h,0,F,!1),e.fill(),e.beginPath(),e.moveTo(0+h,0),e.arc(0,0,h,0,F,!1),e.stroke(),e.rotate(v),e.font="bold 12px Verdana, Arial";var Y=20*A(b),i=20*V(b),t=R(180*b/N)+"°";e.textAlign="center",e.textBaseline="middle",e.beginPath();var S=e.measureText("365.°").width;e.fillStyle="white",e.rect(Y-S/2,-i-10,S,20),e.fill(),e.beginPath(),e.fillStyle="rgb(79,79,79)",e.fillText(t,Y,-i),e.restore()}})}("undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:this,Object);