/* @license Copyright (C) Exontrol. All rights reserved. */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):(t="undefined"!=typeof globalThis?globalThis:t||self,e(t.exontrol||{}))}(this,function(t){"use strict";function e(t){return null!=t}function o(t){return null==t}function i(t,e,o,i,r,s){t.drawLine([n(e),n(o)],[n(i),n(r)],s)}var r=r||window.exontrol,n=Math.round,s=Math.max,l=Math.min;r.Mrg(r,function(){function t(t,e){r.host.call(this,arguments)}return t.version="5.5",t.type="Bezier",t.Options={tfi:null,locked:null,readOnly:null,wheelChange:null,coord:null,size:null,color:null,sizeHoverPointControl:null,showControl:null,showDuplicateControl:null,sizeControl:null,colorControl:null,colorLineControl:null,showValue:null,colorValue:null,colorTextValue:null,colorShadowValue:null,colorValueOutside:null,colorTextValueOutside:null,colorShadowValueOutside:null,formatColorValue:null,primitiveValue:null,pArgValue:null,formatValue:null,showScale:null,colorScale:null,colorTextScale:null,colorTextMarginsScale:null,showScaleControl:null,scaleX:null,scaleRangeX:null,scaleY:null,scaleRangeY:null,colorScaleControl:null,highlightScaleProgress:null,showCoord:null,clip:null,restrict:null},t.p1h="bezier.p1.hover",t.p2h="bezier.p2.hover",t.sph="bezier.sp.hover",t.prototype.init=function(t,e){this.oBezier=new r.G.Bezier,this.oBezier.onchange={callback:this.onChange,thisArg:this},this.rtBezierP1=null,this.rtBezierP2=null,this.rtBezierP1Duplicate=null,this.rtBezierP2Duplicate=null,this.oO=r.Mrg(r.Cpy(this.defOpt()),e),this.Shortcuts=null,this.oSts=null,this.oBezierScale={x:.1,y:.1},this.rtBezierScalePoint=null,this.rgMeasureBezierValue=null,this.oMeasureBezierScaleTime=null,this.oMeasureBezierScaleProgress=null,this.oBezierValueExpr=null,this.oColorBezierValueExpr=null,this.canvas=null,this.client=null,this.Listeners=null,this.oLts=null,this.iLts(),this.SetClientRect(t),this.SetOptions(this.oO),r.CC.GetCanvas(t)&&this.SetCanvas(t),r.DPR.Reg(this)},t.prototype.defOpt=function(){return r[this.constructor.type].Options},r.SB.addProto(t.prototype),t.prototype.Refresh=function(){this.inv()},t.prototype.opt=function(t,e){var i=this.oO[t];return o(i)&&o(i=this.defOpt()[t])&&(i=e),i},t.prototype.GetOptions=function(){return this.oO},t.prototype.SetOptions=function(t){this.oO=r.Mrg(this.oO,t),this.oO.coord&&this.SetCoord(this.oO.coord),this.updateScale(),this.inv()},Object.defineProperty(t.prototype,"Options",{get:function(){return this.GetOptions()},set:function(t){this.SetOptions(t)},configurable:!0}),t.prototype.GetCanvas=function(){var t=this.canvas;return r.CC.GetCanvas(t)?t:null},t.prototype.SetCanvas=function(t,e){this.udefSts(this.oSts),this.oSts=null,this.resAO(),t=r.CC.GetCanvas(t),!e&&r.CC.SetCanvas(this,t),this.canvas=t,r.CC.GetCanvas(this.canvas)&&this.defSts(this.Shortcuts=this.oSts=new r.Sts)},r.ComboBox&&(t.prototype.dCBl=function(t,e){this.drawBezier(t,e),this.showCoord()&&this.drawCoord(t,e,0)},t.prototype.sCB=function(t){return t&&this.SetOptions({coord:[0,0,1,1]}),!this.oBezier.isL()},t.prototype.SetCanvas=function(t,e){return r.ComboBox.implExHost(t,"onchange")}(t.prototype.SetCanvas)),t.prototype.SetClientRect=function(t){var e=r.CC.GetCanvas(t);e&&(t=[0,0,e.width,e.height]),this.client=r.C2R(t),this.visAO()||this.resAO()},t.prototype.GetClientRect=function(){return this.client.slice()},t.prototype.GetClientBezier=function(t){var o=(t=t||this.GetClientRect()).slice(),i=[0,0,0,0];if(this.showControl()){var r=this.sizeControl(),n=r[0],l=r[1];i[0]=s(i[0],n/2),i[1]=s(i[1],n/2),i[2]=s(i[2],l/2),i[3]=s(i[3],l/2)}return this.showValue()&&e(this.rgMeasureBezierValue)&&(i[0]=s(i[0],this.rgMeasureBezierValue[0].width/2+4),i[3]=s(i[3],this.rgMeasureBezierValue[0].height/2+4),i[1]=s(i[1],this.rgMeasureBezierValue[1].width/2+4),i[2]=s(i[2],this.rgMeasureBezierValue[1].height/2+4)),this.showScale()&&(e(this.oMeasureBezierScaleTime)&&(i[1]=s(i[1],this.oMeasureBezierScaleTime.width/2),i[3]+=this.oMeasureBezierScaleTime.height+4),e(this.oMeasureBezierScaleProgress)&&(i[0]+=this.oMeasureBezierScaleProgress.width+4)),o[0]+=i[0],o[1]+=i[1],o[2]-=i[0]+i[2],o[3]-=i[1]+i[3],o},t.prototype.showCoord=function(){return this.opt("showCoord",!0)},t.prototype.getCoord=function(){var t="[",e="";return this.oBezier.GetP12().forEach(function(t){e.length&&(e+=", "),e+=r.Format(t)}),t+=e,t+="]"},t.prototype.drawCoord=function(t,e,i){var n=this.oBezier.GetName();o(n)?n="":(n=""+n+"",n+="\n"),n+=this.getCoord(),t.drawHTMLText(n,r.IRt(e.slice(),-4,-4),r.ToI(i,262170))},t.prototype.clip=function(){return this.opt("clip",!1)},t.prototype.initMeasureBezier=function(t){this.showValue()&&(this.rgMeasureBezierValue=[],this.rgMeasureBezierValue.push(this.measureBezierValue(t,this.getBezierValue(0))),this.rgMeasureBezierValue.push(this.measureBezierValue(t,this.getBezierValue(1)))),this.showScale()&&(this.oMeasureBezierScaleTime=this.measureBezierScaleTime(t,this.getBezierScaleTime(1)),this.oMeasureBezierScaleProgress=this.measureBezierScaleProgress(t,this.getBezierScaleProgress(1)))},t.prototype.draw=function(t,o,i){if(this.rtBezierP1=null,this.rtBezierP2=null,this.rtBezierP1Duplicate=null,this.rtBezierP2Duplicate=null,this.rtBezierScalePoint=null,t&&!r.EyR(o)){this.initMeasureBezier(t);var n=this.GetClientBezier(o);if(!r.EyR(n)){e(i)&&(this.oDefOpts=this.GetOptions(),this.SetOptions(i));var s=this.showScale(),l=this.showValue(),a=this.clip();a&&t.selClip(o),s&&this.drawBezierScale(t,n),this.drawBezier(t,n),l&&this.drawBezierValue(t,n),this.showScaleControl()&&this.drawBezierScaleControl(t,n),this.showControl()&&this.drawBezierControl(t,o,n),this.showCoord()&&this.drawCoord(t,n),a&&t.resClip(),void 0!==this.oDefOpts&&(this.SetOptions(this.oDefOpts),this.oDefOpts=void 0)}}},t.prototype.convertBezierToView=function(t,e){return{x:(e=e||this.GetClientBezier())[0]+t.x*e[2],y:e[1]+(1-t.y)*e[3]}},t.prototype.convertViewToBezier=function(t,e){var o=this.GetClientBezier(),i=this.convertBezierToView({x:0,y:0},o);return{x:t=(t-i.x)/o[2],y:e=-(e-i.y)/o[3]}},t.prototype.sizeControl=function(){return this.opt("sizeControl",[8,8])},t.prototype.getControlViewPointToRect=function(t){var e=this.sizeControl();return r.RRt(r.G.C2R(t,e[0],e[1]))},t.prototype.sizeHoverPointControl=function(){return this.opt("sizeHoverPointControl",2)},t.prototype.showControl=function(){return!this.isLocked()&&!!this.opt("showControl",!0)},t.prototype.showDuplicateControl=function(){return!this.isLocked()&&this.opt("showDuplicateControl",!0)},t.prototype.colorControl=function(){return this.opt("colorControl","#404040")},t.prototype.colorLineControl=function(){return this.opt("colorLineControl","#808080")},t.prototype.drawBezierControl=function(o,n,s){function l(t,e){r.D.P.fill(o,t,e,"Ellipse")}var a=this.colorControl(),h=this.colorLineControl(),u=o.gAO();o.saveSts("lineDash"),o.setLineDash([2,2]);var c=this.convertBezierToView({x:0,y:0},s),p=this.convertBezierToView(this.oBezier.GetP1(),s);i(o,c.x,c.y,p.x,p.y,h),this.rtBezierP1=this.getControlViewPointToRect(p);var f=this.rtBezierP1;if(u){e(S=u.get(this,t.p1h))&&(f=r.R.RectInc(S.state,S.range,f,this.sizeHoverPointControl()))}l(f,a);var y=this.convertBezierToView({x:1,y:1},s),v=this.convertBezierToView(this.oBezier.GetP2(),s);i(o,y.x,y.y,v.x,v.y,h),this.rtBezierP2=this.getControlViewPointToRect(v);var z=this.rtBezierP2;if(u){var S=u.get(this,t.p2h);e(S)&&(z=r.R.RectInc(S.state,S.range,z,this.sizeHoverPointControl()))}if(l(z,a),o.loadSts(),this.rtBezierP1Duplicate=null,this.rtBezierP2Duplicate=null,this.showDuplicateControl()){var d=o.globalAlpha;if(this.clip()||(o.globalAlpha=.5),!r.PInR(p.x,p.y,n)){var B=r.G.RDir(c,p.x-c.x,p.y-c.y,n);e(B)&&(this.rtBezierP1Duplicate=this.getControlViewPointToRect(B),l(this.rtBezierP1Duplicate,a))}if(!r.PInR(v.x,v.y,n)){var g=r.G.RDir(y,v.x-y.x,v.y-y.y,n);e(g)&&(this.rtBezierP2Duplicate=this.getControlViewPointToRect(g),l(this.rtBezierP2Duplicate,a))}o.globalAlpha=d}},t.prototype.size=function(){return this.opt("size",3)},t.prototype.color=function(){return this.opt("color","black")},t.prototype.drawBezier=function(t,e){!function(t,e,o,i){var r;e&&t&&((r=t.exontrol=t.exontrol||{}).ll1x=r.ll1x||0,r.ll1x++),o&&o.call(i),r&&--r.ll1x}(t,!0,function(){var o=e[0],i=e[1],r=e[2],n=e[3];t.saveSts("lineWidth","strokeStyle"),t.lineWidth=this.size(),t.strokeStyle=this.color(),t.beginPath();for(var s=o,l=o+r;s<=l;s++){var a=(s-o)/r,h=i+(1-this.oBezier.Get(a))*n;s===o?t.moveTo(s,h):t.lineTo(s,h)}t.stroke(),t.closePath(),t.loadSts()},this)},t.prototype.AdjustPointToScaleView=function(t){var e=this.GetScale();return t.x=e.x*Math.round(t.x/e.x),t.y=e.y*Math.round(t.y/e.y),t},t.prototype.restrict=function(){return this.opt("restrict",!1)},t.prototype.onChange=function(t,e){this.onchange({point:t,bezier:e})},t.prototype.onchange=function(t){this.oLts.onchange.do(t)},t.prototype.GetCoord=function(){return this.oBezier.GetP12()},t.prototype.SetCoord=function(t){this.oBezier.SetP12(t)},t.prototype.GetP=function(t){switch(t){case 1:return this.oBezier.GetP1();case 2:return this.oBezier.GetP2()}return null},t.prototype.SetP=function(t,e){switch(this.restrict()&&(e.x=r.G.Bezier.adjustX(e.x),e.y=r.G.Bezier.adjustX(e.y)),t){case 1:this.oBezier.SetP1(e);break;case 2:this.oBezier.SetP2(e)}},t.prototype.bezierScaleRange=function(t){var o=t;if(e(o)&&(o.min||o.max)){if(e(o.min)&&(o.min=s(0,~~o.min)),e(o.max)&&(o.max=s(0,~~o.max)),e(o.min)&&e(o.max)){var i=l(o.min,o.max),r=s(o.min,o.max);o.min=i,o.max=r}return o}return null},t.prototype.scaleX=function(){return s(0,r.ToI(this.opt("scaleX",10),10))},t.prototype.scaleRangeX=function(){return this.bezierScaleRange(this.opt("scaleRangeX",{min:1,max:100}))},t.prototype.limitScaleX=function(t){var o=this.scaleRangeX();return e(o)&&(e(o.min)&&(t=s(o.min,t)),e(o.max)&&(t=l(o.max,t))),s(1,t)},t.prototype.scaleY=function(){return s(0,r.ToI(this.opt("scaleY",10),10))},t.prototype.scaleRangeY=function(){return this.bezierScaleRange(this.opt("scaleRangeY",{min:1,max:100}))},t.prototype.limitScaleY=function(t){var o=this.scaleRangeY();return e(o)&&(e(o.min)&&(t=s(o.min,t)),e(o.max)&&(t=l(o.max,t))),s(1,t)},t.prototype.updateScale=function(){var t={x:1/this.limitScaleX(this.scaleX()),y:1/this.limitScaleY(this.scaleY())};this.SetScale(t)},t.prototype.GetScale=function(){var t=this.oBezierScale;return{x:t.x,y:t.y}},t.prototype.SetScale=function(t){t.x=l(1,s(t.x,0)),t.y=l(1,s(t.y,0));var e=this.GetClientRect();if(!r.EyR(e)){var o=e[2],i=e[3],n=Math.round(o/s(1,t.x*o));n=this.limitScaleX(n),t.x=1/n;var a=Math.round(i/s(1,t.y*i));a=this.limitScaleY(a),t.y=1/a}return this.oBezierScale=t},t.prototype.IncScale=function(t,e){var o=this.GetScale(),i=this.GetScale();0!=(t=~~t)&&(o.x=1/s(1/o.x+t)),0!=(e=~~e)&&(o.y=1/s(1/o.y+e)),this.SetScale(o);var r=this.GetScale();return i.x!=r.x||i.y!=r.y},t.prototype.getTfi=function(){return this.opt("tfi")},t.prototype.showScaleControl=function(){return!this.isLocked()&&this.opt("showScaleControl",!0)},t.prototype.colorScaleControl=function(){return this.opt("colorScaleControl","black")},t.prototype.drawBezierScaleControl=function(o,i){var n=this.colorScaleControl();this.rtBezierScalePoint=this.getControlViewPointToRect(this.convertBezierToView(this.GetScale(),i));var s=this.rtBezierScalePoint,l=o.gAO();if(l){var a=l.get(this,t.sph);e(a)&&(s=r.R.RectInc(a.state,a.range,s,this.sizeHoverPointControl()))}r.D.P.fill(o,s,n,"RoundRect",{x:2,y:2})},t.prototype.showScale=function(){return this.opt("showScale",!0)},t.prototype.colorTextScale=function(){return this.opt("colorTextScale","#A0A0A0")},t.prototype.colorTextMarginsScale=function(){return this.opt("colorTextMarginsScale","black")},t.prototype.colorScale=function(){return this.opt("colorScale","rgba(0,0,0,.10)")},t.prototype.highlightScaleProgress=function(){return this.opt("highlightScaleProgress",!0)},t.prototype.getBezierScaleTime=function(t){var e=Math.round(1*t/this.GetScale().x);return{x:t,value:e,sValue:e.toString()}},t.prototype.measureBezierScaleTime=function(t,e){var o=t.sizeHTMLText(e.sValue);return{width:o.width+4,height:o.height+4}},t.prototype.getBezierScaleProgress=function(t){var e=Math.round(1*t/this.GetScale().y);return{y:t,value:e,sValue:e.toString()}},t.prototype.measureBezierScaleProgress=function(t,e){var o=t.sizeHTMLText(e.sValue);return{width:o.width+4,height:o.height+4}},t.prototype.drawBezierScale=function(t,n){var s=n[0],l=n[1],a=n[2],h=n[3],u=this.colorScale(),c=this.colorTextScale(),p=this.colorTextMarginsScale();t.save(),t.setLineDash([1,1]);var f=this.convertBezierToView({x:0,y:0}),y=this.convertBezierToView({x:1,y:0}),v=this.GetScale(),z=(y.x-f.x)*v.x,S=null,d=8,B=null;if(z>0){var g=this.convertBezierToView({x:0,y:0}),x=this.convertBezierToView({x:0,y:1}),C=(g.y-x.y)*v.y;if(C>0){var w=this.highlightScaleProgress(),V=null;w&&(V=new r.Arr);for(var P=Math.round(a/z),m=Math.round(h/C),S=null,d=8,B=null,T=0,R=f.x,G=0;G<=P;R+=z,G++,T+=v.x){var M=0==G,b=G==P;if(o(S)||S+d"+D+"",(M||b)&&(D=""+D+"");var A=this.measureBezierScaleTime(t,k),E=r.G.C2R([R,O+4],A.width,A.height,18);(o(B)||r.EyR(r.NRt(B,E))||M||b)&&(t.drawHTMLText(D,E,r.DrawTextFormatEnum.exTextAlignCenter),B=E)}if(w){var L=this.oBezier.Get(T),F=Math.round(m*r.G.Bezier.adjustX(L));V.add(F)}}t.drawEdge(n,8,c);for(var I=null,X=null,H=0,R=g.y,G=0;G<=m;R-=C,G++,H+=v.y){var M=0==G,b=G==m;if(o(I)||I-d>R||M||b){var Y=s-8;i(t,Y,R,s+a+8,R,u),I=R}var j=this.getBezierScaleProgress(H),N=j.sValue,W=M||b,K=!W;e(V)&&V.has(G)&&(W=!0,K=!1),W&&(N=""+(N=""+N+"")+""),K&&(N=""+N+"");var U=this.measureBezierScaleProgress(t,j),q=r.G.C2R([Y,R],U.width,U.height,36);(o(X)||r.EyR(r.NRt(X,q))||M||b)&&(t.drawHTMLText(N,q,r.DrawTextFormatEnum.exTextAlignCenter|r.DrawTextFormatEnum.exTextAlignVCenter),X=q)}t.drawEdge(n,1,c)}}t.restore()},t.prototype.showValue=function(){return this.opt("showValue",!0)},t.prototype.colorValue=function(){return r.C.Convert(this.opt("colorValue","#FFFF00"))},t.prototype.colorTextValue=function(){return this.opt("colorTextValue","black")},t.prototype.colorShadowValue=function(){return this.opt("colorShadowValue","#808080")},t.prototype.colorValueOutside=function(){return r.C.Convert(this.opt("colorValueOutside","#FFFF00"))},t.prototype.colorTextValueOutside=function(){return this.opt("colorTextValueOutside","black")},t.prototype.colorShadowValueOutside=function(){return this.opt("colorShadowValueOutside","#808080")},t.prototype.primitiveValue=function(){return this.opt("primitiveValue","Ellipse")},t.prototype.pArgValue=function(){return this.opt("pArgValue",null)},t.prototype.formatValue=function(){return this.opt("formatValue","` ` + round( (value MIN 0 MAX 1) * scale) + ` `")},t.prototype.getFormatBezierValue=function(t){var i=this.formatValue(),n=1/this.GetScale().y;if(e(i)){var s=this.oBezierValueExpr;if((o(s)||s.GetExpr()!=i)&&(s=r.E.Create(i,"value,scale"),this.oBezierValueExpr=s),s.IsValid())return s.Evaluate(function(e){switch(e){case-1:return t;case-2:return n}})}return" "+Math.round(n*r.G.Bezier.adjustX(t))+" "},t.prototype.getBezierValue=function(t){var e=this.oBezier.Get(t);return{x:t,value:e,sValue:this.getFormatBezierValue(e).toString()}},t.prototype.measureBezierValue=function(t,e){var o=t.sizeHTMLText(e.sValue),i=Math.round(3*this.size()/2)+1,r=o.width+i,n=o.height+i;n=r=s(n,r);return{width:Math.round(r),height:Math.round(n)}},t.prototype.formatColorValue=function(){return this.opt("formatColorValue","round( color/2 + (color/2 * value))")},t.prototype.getFormatColorBezierValue=function(t,i){var n=this.formatColorValue();this.GetScale().y;if(e(n)){var s=this.oColorBezierValueExpr;if((o(s)||s.GetExpr()!=n)&&(s=r.E.Create(n,"value,color"),this.oColorBezierValueExpr=s),s.IsValid())return s.Evaluate(function(e){switch(e){case-1:return t;case-2:return i}})}return Math.round(i/2+i/2*t)},t.prototype.drawBezierValue=function(t,i){function n(t,e){return s.getFormatColorBezierValue(t,e)}var s=this,l=(i[0],i[1]),a=i[2],h=i[3],u=this.convertBezierToView({x:0,y:0}),c=this.convertBezierToView({x:1,y:0}),p=this.GetScale(),f=(c.x-u.x)*p.x,y=null;if(f>0){var v=this.convertBezierToView({x:0,y:0}),z=this.convertBezierToView({x:0,y:1});if((v.y-z.y)*p.y>0){var S=this.colorValue(),d=this.colorTextValue(),B=this.colorShadowValue(),g=this.colorValueOutside(),x=this.colorTextValueOutside(),C=this.colorShadowValueOutside(),w=this.primitiveValue(),V=this.pArgValue();t.saveSts("fillStyle","strokeStyle"),t.strokeStyle=t.fillStyle=d;for(var P=Math.round(a/f),m=0,m=0,T=u.x,R=0;R<=P;T+=f,R++,m+=p.x){var G=0==R,M=R==P,b=this.getBezierValue(m),O=this.measureBezierValue(t,b),k=r.G.C2R([T,l+(1-b.value)*h],O.width,O.height);if(o(y)||r.EyR(r.NRt(y,k))||G||M){var D=b.value<0||b.value>1,A=D?g:S;if(!A.IsTrans()){var E="rgb("+n(b.value,A.r)+","+n(b.value,A.g)+","+n(b.value,A.b)+")";r.D.P.fillS(t,k,E,D?C:B,{blur:8,x:0,y:0},w,V)}var L=null;D&&(L=t.fillStyle,t.strokeStyle=t.fillStyle=x),t.drawHTMLText(b.sValue,k,r.DrawTextFormatEnum.exTextAlignCenter|r.DrawTextFormatEnum.exTextAlignVCenter),e(L)&&(t.strokeStyle=t.fillStyle=L),y=k}}t.loadSts()}}},t.prototype.bezierControlFromPoint=function(t){var o=r.G.X(t),i=r.G.Y(t);return e(this.rtBezierP1)&&r.PInfR(o,i,this.rtBezierP1)?1:e(this.rtBezierP1Duplicate)&&r.PInfR(o,i,this.rtBezierP1Duplicate)?1:e(this.rtBezierP2)&&r.PInfR(o,i,this.rtBezierP2)?2:e(this.rtBezierP2Duplicate)&&r.PInfR(o,i,this.rtBezierP2Duplicate)?2:null},t.prototype.bezierScaleFromPoint=function(t){var o=r.G.X(t),i=r.G.Y(t);return!(!e(this.rtBezierScalePoint)||!r.PInfR(o,i,this.rtBezierScalePoint))},t.prototype.onClickBezierScale=function(t,o){r.RUR.Do(t,function(t){switch(t.drag.status){case 1:this.save=this.GetScale();break;case 0:e(this.save)&&(this.SetScale(this.save),delete this.save,this.inv());break;case 2:var o=t.drag.current,i=this.convertViewToBezier(o.x,o.y);if(t.drag.long||t.ctrlKey||t.altKey){var r=s(i.x,i.y);i.x=r,i.y=r}this.SetScale(i),this.inv()}},this)},t.prototype.onClickBezierControl=function(t,o){var i=o.code;r.RUR.Do(t,function(t){switch(t.drag.status){case 1:this.save=this.GetP(i);break;case 0:e(this.save)&&(this.SetP(i,this.save),delete this.save,this.inv());break;case 2:var o=t.drag.current,r=this.convertViewToBezier(o.x,o.y);(t.drag.long||t.ctrlKey||t.altKey)&&(r=this.AdjustPointToScaleView(r)),this.SetP(i,r),this.inv()}},this)},t.prototype.onmousemove=function(t){var e,o=this.hitTest(this.gPtr(t));return!!o&&(o.cursor&&(e=this.GetCanvas())&&(e.style.cursor=o.cursor),!0)},t.prototype.onwheel=function(t){if(this.isSelectable()){var o=this.gPtr(t);if(e(o)&&r.PInR(o.x,o.y,this.GetClientRect()))return this.dowheel(t)}return!1},t.prototype.dowheel=function(t){var e=r.WhelInc(t);if(e){var o=this.getWheelChange();if(o&&this.showScaleControl()){var i=e<0?-o:o;if(this.IncScale(i,i))return this.inv(),!0}}return!1},t.prototype.oncontextmenu=function(t){var o=this.gPtr(t);return e(o)&&r.PInR(o.x,o.y,this.GetClientRect()),!1},t.prototype.ondown=function(t){var o=this.gPtr(t),i=this.hitTest(o);return!!e(i)&&(i.callback instanceof Function&&i.callback.call(i.thisArg,t,i),!0)},t.prototype.onkeydown=function(t){this.onkey(t,-1)},t.prototype.onkeyup=function(t){this.onkey(t,0)},t.prototype.onkeypress=function(t){this.onkey(t,1)},t.prototype.onkey=function(t,o){e(this.oSts)&&this.oSts.onkey(t,o)},t.prototype.onlayout=function(t){if(t.IsSave())t.Add("p12",this.oBezier.GetP12()),t.Add("x-scale",this.oBezierScale.x),t.Add("y-scale",this.oBezierScale.y);else{var o=t.GetValue("p12");e(o)&&this.oBezier.SetP12(o);var i=t.GetValue("x-scale");e(i)&&(this.oBezierScale.x=i);var r=t.GetValue("y-scale");e(r)&&(this.oBezierScale.y=r)}},t.prototype.udefSts=function(t){t&&t.RemoveOf(this)},t.prototype.defSts=function(t){},t.prototype.iLts=function(){this.Listeners=this.oLts=new r.Lts,this.oLts.Add("onchange")},r.Lts.Onf(t.prototype),t.prototype.hitTest=function(t){var o=null;if(e(t)&&this.isSelectable()){var i=this.bezierControlFromPoint(t);i?o={cursor:"pointer",code:i,callback:this.onClickBezierControl,thisArg:this}:this.bezierScaleFromPoint(t)&&(o={cursor:"pointer",code:!0,callback:this.onClickBezierScale,thisArg:this})}return o},t.prototype.onSetAO=function(e){if(e){0!=this.sizeHoverPointControl()&&(this.showScaleControl()&&!e.has(this,t.sph)&&e.set({owner:this,id:t.sph,inv:this.inv,duration:125,hitTest:function(t,e){return this.isAP(t,e)&&this.bezierScaleFromPoint({x:t,y:e})}}),this.showControl()&&(!e.has(this,t.p1h)&&e.set({owner:this,id:t.p1h,inv:this.inv,duration:125,hitTest:function(t,e){return this.isAP(t,e)&&1==this.bezierControlFromPoint({x:t,y:e})}}),!e.has(this,t.p2h)&&e.set({owner:this,id:t.p2h,inv:this.inv,duration:125,hitTest:function(t,e){return this.isAP(t,e)&&2==this.bezierControlFromPoint({x:t,y:e})}})))}},t.prototype.getLocked=function(){return this.opt("locked",!1)||this.opt("readOnly",!1)},t.prototype.getWheelChange=function(){return this.opt("wheelChange",1)},r.expO({Canvas:null},t.prototype),{Bezier:t}}()),t.Bezier=r.Bezier});