1!function(t,e){"function"==typeof define&&define.amd?define([],(function(){return t.SignaturePad=e()})):"object"==typeof exports?module.exports=e():t.SignaturePad=e()}(this,(function(){var t=function(t){"use strict";var e=function(t,e){var n=this,o=e||{};this.velocityFilterWeight=o.velocityFilterWeight||.7,this.minWidth=o.minWidth||.5,this.maxWidth=o.maxWidth||2.5,this.dotSize=o.dotSize||function(){return(this.minWidth+this.maxWidth)/2},this.penColor=o.penColor||"black",this.backgroundColor=o.backgroundColor||"rgba(0,0,0,0)",this.onEnd=o.onEnd,this.onBegin=o.onBegin,this._canvas=t,this._ctx=t.getContext("2d"),this.clear(),this._handleMouseDown=function(t){1===t.which&&(n._mouseButtonDown=!0,n._strokeBegin(t))},this._handleMouseMove=function(t){n._mouseButtonDown&&n._strokeUpdate(t)},this._handleMouseUp=function(t){1===t.which&&n._mouseButtonDown&&(n._mouseButtonDown=!1,n._strokeEnd(t))},this._handleTouchStart=function(t){if(1==t.targetTouches.length){var e=t.changedTouches[0];n._strokeBegin(e)}},this._handleTouchMove=function(t){t.preventDefault();var e=t.targetTouches[0];n._strokeUpdate(e)},this._handleTouchEnd=function(t){t.target===n._canvas&&(t.preventDefault(),n._strokeEnd(t))},this._handleMouseEvents(),this._handleTouchEvents()};e.prototype.clear=function(){var t=this._ctx,e=this._canvas;t.fillStyle=this.backgroundColor,t.clearRect(0,0,e.width,e.height),t.fillRect(0,0,e.width,e.height),this._reset()},e.prototype.toDataURL=function(t,e){var n=this._canvas;return n.toDataURL.apply(n,arguments)},e.prototype.fromDataURL=function(t){var e=this,n=new Image,o=window.devicePixelRatio||1,i=this._canvas.width/o,s=this._canvas.height/o;this._reset(),n.src=t,n.onload=function(){e._ctx.drawImage(n,0,0,i,s)},this._isEmpty=!1},e.prototype._strokeUpdate=function(t){var e=this._createPoint(t);this._addPoint(e)},e.prototype._strokeBegin=function(t){this._reset(),this._strokeUpdate(t),"function"==typeof this.onBegin&&this.onBegin(t)},e.prototype._strokeDraw=function(t){var e=this._ctx,n="function"==typeof this.dotSize?this.dotSize():this.dotSize;e.beginPath(),this._drawPoint(t.x,t.y,n),e.closePath(),e.fill()},e.prototype._strokeEnd=function(t){var e=this.points.length>2,n=this.points[0];!e&&n&&this._strokeDraw(n),"function"==typeof this.onEnd&&this.onEnd(t)},e.prototype._handleMouseEvents=function(){this._mouseButtonDown=!1,this._canvas.addEventListener("mousedown",this._handleMouseDown),this._canvas.addEventListener("mousemove",this._handleMouseMove),t.addEventListener("mouseup",this._handleMouseUp)},e.prototype._handleTouchEvents=function(){this._canvas.style.msTouchAction="none",this._canvas.style.touchAction="none",this._canvas.addEventListener("touchstart",this._handleTouchStart),this._canvas.addEventListener("touchmove",this._handleTouchMove),this._canvas.addEventListener("touchend",this._handleTouchEnd)},e.prototype.on=function(){this._handleMouseEvents(),this._handleTouchEvents()},e.prototype.off=function(){this._canvas.removeEventListener("mousedown",this._handleMouseDown),this._canvas.removeEventListener("mousemove",this._handleMouseMove),t.removeEventListener("mouseup",this._handleMouseUp),this._canvas.removeEventListener("touchstart",this._handleTouchStart),this._canvas.removeEventListener("touchmove",this._handleTouchMove),this._canvas.removeEventListener("touchend",this._handleTouchEnd)},e.prototype.isEmpty=function(){return this._isEmpty},e.prototype._reset=function(){this.points=[],this._lastVelocity=0,this._lastWidth=(this.minWidth+this.maxWidth)/2,this._isEmpty=!0,this._ctx.fillStyle=this.penColor},e.prototype._createPoint=function(t){var e=this._canvas.getBoundingClientRect();return new n(t.clientX-e.left,t.clientY-e.top)},e.prototype._addPoint=function(t){var e,n,i,s=this.points;s.push(t),s.length>2&&(3===s.length&&s.unshift(s[0]),e=this._calculateCurveControlPoints(s[0],s[1],s[2]).c2,n=this._calculateCurveControlPoints(s[1],s[2],s[3]).c1,i=new o(s[1],e,n,s[2]),this._addCurve(i),s.shift())},e.prototype._calculateCurveControlPoints=function(t,e,o){var i=t.x-e.x,s=t.y-e.y,h=e.x-o.x,r=e.y-o.y,a=(t.x+e.x)/2,c=(t.y+e.y)/2,u=(e.x+o.x)/2,d=(e.y+o.y)/2,l=Math.sqrt(i*i+s*s),_=Math.sqrt(h*h+r*r),v=_/(l+_),p=u+(a-u)*v,y=d+(c-d)*v,f=e.x-p,m=e.y-y;return{c1:new n(a+f,c+m),c2:new n(u+f,d+m)}},e.prototype._addCurve=function(t){var e,n,o=t.startPoint;e=t.endPoint.velocityFrom(o),e=this.velocityFilterWeight*e+(1-this.velocityFilterWeight)*this._lastVelocity,n=this._strokeWidth(e),this._drawCurve(t,this._lastWidth,n),this._lastVelocity=e,this._lastWidth=n},e.prototype._drawPoint=function(t,e,n){var o=this._ctx;o.moveTo(t,e),o.arc(t,e,n,0,2*Math.PI,!1),this._isEmpty=!1},e.prototype._drawCurve=function(t,e,n){var o,i,s,h,r,a,c,u,d,l,_,v=this._ctx,p=n-e;for(o=Math.floor(t.length()),v.beginPath(),s=0;s<o;s++)a=(r=(h=s/o)*h)*h,l=(d=(u=(c=1-h)*c)*c)*t.startPoint.x,l+=3*u*h*t.control1.x,l+=3*c*r*t.control2.x,l+=a*t.endPoint.x,_=d*t.startPoint.y,_+=3*u*h*t.control1.y,_+=3*c*r*t.control2.y,_+=a*t.endPoint.y,i=e+a*p,this._drawPoint(l,_,i);v.closePath(),v.fill()},e.prototype._strokeWidth=function(t){return Math.max(this.maxWidth/(t+1),this.minWidth)};var n=function(t,e,n){this.x=t,this.y=e,this.time=n||(new Date).getTime()};n.prototype.velocityFrom=function(t){return this.time!==t.time?this.distanceTo(t)/(this.time-t.time):1},n.prototype.distanceTo=function(t){return Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))};var o=function(t,e,n,o){this.startPoint=t,this.control1=e,this.control2=n,this.endPoint=o};return o.prototype.length=function(){var t,e,n,o,i,s,h,r,a=0;for(t=0;t<=10;t++)e=t/10,n=this._point(e,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),o=this._point(e,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y),t>0&&(h=n-i,r=o-s,a+=Math.sqrt(h*h+r*r)),i=n,s=o;return a},o.prototype._point=function(t,e,n,o,i){return e*(1-t)*(1-t)*(1-t)+3*n*(1-t)*(1-t)*t+3*o*(1-t)*t*t+i*t*t*t},e}(document);return t}));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.