plotboilerplate 1.27.1 → 1.28.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/index.esm.js +135 -36
  2. package/dist/index.esm.js.map +1 -1
  3. package/dist/index.esm.min.js +1 -1
  4. package/dist/index.esm.min.js.map +1 -1
  5. package/dist/plotboilerplate.browser.min.js +1 -1
  6. package/dist/plotboilerplate.browser.min.js.map +1 -1
  7. package/dist/plotboilerplate.js +96 -17
  8. package/dist/plotboilerplate.min.js +1 -1
  9. package/package.json +2 -1
  10. package/src/cjs/PlotBoilerplate.d.ts +11 -1
  11. package/src/cjs/PlotBoilerplate.js +23 -7
  12. package/src/cjs/PlotBoilerplate.js.map +1 -1
  13. package/src/cjs/VertexListeners.d.ts +2 -1
  14. package/src/cjs/VertexListeners.js +5 -1
  15. package/src/cjs/VertexListeners.js.map +1 -1
  16. package/src/cjs/draw.d.ts +18 -2
  17. package/src/cjs/draw.js +21 -2
  18. package/src/cjs/draw.js.map +1 -1
  19. package/src/cjs/drawgl.d.ts +18 -3
  20. package/src/cjs/drawgl.js +19 -2
  21. package/src/cjs/drawgl.js.map +1 -1
  22. package/src/cjs/drawutilssvg.d.ts +19 -1
  23. package/src/cjs/drawutilssvg.js +28 -5
  24. package/src/cjs/drawutilssvg.js.map +1 -1
  25. package/src/cjs/interfaces/DrawLib.d.ts +18 -1
  26. package/src/cjs/interfaces/DrawLib.js +2 -0
  27. package/src/cjs/interfaces/DrawLib.js.map +1 -1
  28. package/src/cjs/utils/Params.d.ts +3 -2
  29. package/src/cjs/utils/Params.js +11 -3
  30. package/src/cjs/utils/Params.js.map +1 -1
  31. package/src/cjs/utils/WebColors.d.ts +2 -1
  32. package/src/cjs/utils/WebColors.js +15 -2
  33. package/src/cjs/utils/WebColors.js.map +1 -1
  34. package/src/cjs/utils/algorithms/HobbyPath.js +13 -16
  35. package/src/cjs/utils/algorithms/HobbyPath.js.map +1 -1
  36. package/src/cjs/utils/helpers/BezierResizeHelper.d.ts +144 -0
  37. package/src/cjs/utils/helpers/BezierResizeHelper.js +319 -0
  38. package/src/cjs/utils/helpers/BezierResizeHelper.js.map +1 -0
  39. package/src/esm/PlotBoilerplate.d.ts +11 -1
  40. package/src/esm/PlotBoilerplate.js +23 -7
  41. package/src/esm/PlotBoilerplate.js.map +1 -1
  42. package/src/esm/VertexListeners.d.ts +2 -1
  43. package/src/esm/VertexListeners.js +5 -1
  44. package/src/esm/VertexListeners.js.map +1 -1
  45. package/src/esm/draw.d.ts +18 -2
  46. package/src/esm/draw.js +21 -2
  47. package/src/esm/draw.js.map +1 -1
  48. package/src/esm/drawgl.d.ts +18 -3
  49. package/src/esm/drawgl.js +19 -2
  50. package/src/esm/drawgl.js.map +1 -1
  51. package/src/esm/drawutilssvg.d.ts +19 -1
  52. package/src/esm/drawutilssvg.js +28 -5
  53. package/src/esm/drawutilssvg.js.map +1 -1
  54. package/src/esm/interfaces/DrawLib.d.ts +18 -1
  55. package/src/esm/interfaces/DrawLib.js +2 -0
  56. package/src/esm/interfaces/DrawLib.js.map +1 -1
  57. package/src/esm/utils/Params.d.ts +3 -2
  58. package/src/esm/utils/Params.js +11 -3
  59. package/src/esm/utils/Params.js.map +1 -1
  60. package/src/esm/utils/WebColors.d.ts +2 -1
  61. package/src/esm/utils/WebColors.js +15 -2
  62. package/src/esm/utils/WebColors.js.map +1 -1
  63. package/src/esm/utils/algorithms/HobbyPath.js +13 -16
  64. package/src/esm/utils/algorithms/HobbyPath.js.map +1 -1
  65. package/src/esm/utils/helpers/BezierResizeHelper.d.ts +144 -0
  66. package/src/esm/utils/helpers/BezierResizeHelper.js +314 -0
  67. package/src/esm/utils/helpers/BezierResizeHelper.js.map +1 -0
  68. package/src/ts/PlotBoilerplate.ts +37 -11
  69. package/src/ts/VertexListeners.ts +5 -1
  70. package/src/ts/draw.ts +32 -2
  71. package/src/ts/drawgl.ts +38 -3
  72. package/src/ts/drawutilssvg.ts +33 -6
  73. package/src/ts/interfaces/DrawLib.ts +19 -1
  74. package/src/ts/utils/Params.ts +11 -3
  75. package/src/ts/utils/WebColors.ts +15 -2
  76. package/src/ts/utils/algorithms/HobbyPath.ts +248 -272
  77. package/src/ts/utils/helpers/BezierResizeHelper.ts +390 -0
  78. package/src/cjs/utils/_gup.js_ +0 -13
@@ -1,2 +1,2 @@
1
- (()=>{"use strict";var t={30:function(t,e,i){var s,r=this&&this.__extends||(s=function(t,e){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},s(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}s(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0}),e.Vector=void 0;var n=i(590),o=i(787),a=function(t){function e(i,s){var r=t.call(this,i,s,function(t,i){return new e(t,i)})||this;return r.className="Vector",r}return r(e,t),e.prototype.perp=function(){var t=this.clone();return t.sub(this.a),(t=new e(new o.Vertex,new o.Vertex(-t.b.y,t.b.x))).a.add(this.a),t.b.add(this.a),t},e.prototype.inverse=function(){var t=this.a;return this.a=this.b,this.b=t,this},e.prototype.inv=function(){return this.b.x=this.a.x-(this.b.x-this.a.x),this.b.y=this.a.y-(this.b.y-this.a.y),this},e.prototype.intersection=function(t){var e=this.denominator(t);if(0==e)return null;var i=this.a.y-t.a.y,s=this.a.x-t.a.x,r=(t.b.x-t.a.x)*i-(t.b.y-t.a.y)*s,n=(this.b.x-this.a.x)*i-(this.b.y-this.a.y)*s;return i=r/e,s=n/e,new o.Vertex(this.a.x+i*(this.b.x-this.a.x),this.a.y+i*(this.b.y-this.a.y))},e.prototype.getOrthogonal=function(){var t=this.a.clone(),i=this.b.clone().sub(this.a),s=i.x;return i.x=-i.y,i.y=s,new e(t,i.add(this.a))},e.prototype.rotate=function(t){return this.b.rotate(t,this.a),this},e.utils={buildArrowHead:function(t,e,i,s,r){var n=Math.atan2((e.y-t.y)*r,(e.x-t.x)*s),a=[];return a.push(new o.Vertex(e.x*s-i*Math.cos(n),e.y*r-i*Math.sin(n))),a.push(new o.Vertex(e.x*s-1.35*i*Math.cos(n-Math.PI/8),e.y*r-1.35*i*Math.sin(n-Math.PI/8))),a.push(new o.Vertex(e.x*s,e.y*r)),a.push(new o.Vertex(e.x*s-1.35*i*Math.cos(n+Math.PI/8),e.y*r-1.35*i*Math.sin(n+Math.PI/8))),a}},e}(n.VertTuple);e.Vector=a},39:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.drawutils=void 0;var s=i(973),r=i(787),n=i(378),o=i(30),a=function(){function t(t,e){this.ctx=t,this.offset=new r.Vertex(0,0),this.scale=new r.Vertex(1,1),this.fillShapes=e}return t.prototype.applyStrokeOpts=function(t){var e,i,s,r=this;this.ctx.setLineDash((null!==(e=null==t?void 0:t.dashArray)&&void 0!==e?e:[]).map(function(t){return t*r.scale.x})),this.ctx.lineDashOffset=(null!==(i=null==t?void 0:t.dashOffset)&&void 0!==i?i:0)*this.scale.x,this.ctx.lineJoin=null!==(s=null==t?void 0:t.lineJoin)&&void 0!==s?s:null},t.prototype._fillOrDraw=function(t){this.fillShapes?(this.ctx.fillStyle=t,this.ctx.fill()):(this.ctx.strokeStyle=t,this.ctx.stroke())},t.prototype.beginDrawCycle=function(t){},t.prototype.endDrawCycle=function(t){},t.prototype.setConfiguration=function(t){this.ctx.globalCompositeOperation=t.blendMode||"source-over"},t.prototype.setCurrentId=function(t){},t.prototype.setCurrentClassName=function(t){},t.prototype.line=function(t,e,i,s,r){this.ctx.save(),this.ctx.beginPath(),this.applyStrokeOpts(r),this.ctx.moveTo(this.offset.x+t.x*this.scale.x,this.offset.y+t.y*this.scale.y),this.ctx.lineTo(this.offset.x+e.x*this.scale.x,this.offset.y+e.y*this.scale.y),this.ctx.strokeStyle=i,this.ctx.lineWidth=s||1,this.ctx.stroke(),this.ctx.restore()},t.prototype.arrow=function(t,e,i,s,n,o){void 0===n&&(n=8);var a=new r.Vertex(0,0);this.arrowHead(t,e,i,s,n,void 0,a),this.line(t,a,i,s,o)},t.prototype.cubicBezierArrow=function(t,e,i,s,n,o,a,h){var c=new r.Vertex(0,0);this.arrowHead(s,e,n,o,a,void 0,c);var l=c.difference(e);this.cubicBezier(t,{x:e.x-l.x,y:e.y-l.y},i,{x:s.x-l.x,y:s.y-l.y},n,o,h)},t.prototype.arrowHead=function(t,e,i,s,r,n,a){void 0===r&&(r=8),this.ctx.save(),this.ctx.beginPath(),this.applyStrokeOpts(n);var h=o.Vector.utils.buildArrowHead(t,e,r,this.scale.x,this.scale.y);a&&(a.x=h[0].x/this.scale.x,a.y=h[0].y/this.scale.y),this.ctx.moveTo(this.offset.x+h[0].x,this.offset.y+h[0].y);for(var c=0;c<h.length;c++)this.ctx.lineTo(this.offset.x+h[c].x,this.offset.y+h[c].y);this.ctx.lineTo(this.offset.x+h[0].x,this.offset.y+h[0].y),this.ctx.lineWidth=s||1,this._fillOrDraw(i),this.ctx.restore()},t.prototype.image=function(t,e,i,s){void 0===s&&(s=1),t.complete&&t.naturalWidth&&(this.ctx.save(),this.ctx.globalAlpha=s,this.ctx.drawImage(t,0,0,t.naturalWidth-1,t.naturalHeight-1,this.offset.x+e.x*this.scale.x,this.offset.y+e.y*this.scale.y,i.x*this.scale.x,i.y*this.scale.y),this.ctx.restore())},t.prototype.texturedPoly=function(e,i,s,n,o){var a=s.getBounds(),h=(new r.Vertex(n.x,n.y).difference(a.getCenter()),new r.Vertex(i.width,i.height)),c=new r.Vertex(i.min.x,i.min.y).sub(n);this.ctx.save(),this.ctx.translate(this.offset.x+n.x*this.scale.x,this.offset.y+n.y*this.scale.y),t.helpers.clipPoly(this.ctx,{x:-n.x*this.scale.x,y:-n.y*this.scale.y},this.scale,s.vertices),this.ctx.scale(this.scale.x,this.scale.y),this.ctx.rotate(o),this.ctx.drawImage(e,0,0,e.naturalWidth-1,e.naturalHeight-1,c.x,c.y,h.x,h.y),this.ctx.restore()},t.prototype.rect=function(t,e,i,s,r,n){this.ctx.save(),this.ctx.beginPath(),this.applyStrokeOpts(n),this.ctx.moveTo(this.offset.x+t.x*this.scale.x,this.offset.y+t.y*this.scale.y),this.ctx.lineTo(this.offset.x+(t.x+e)*this.scale.x,this.offset.y+t.y*this.scale.y),this.ctx.lineTo(this.offset.x+(t.x+e)*this.scale.x,this.offset.y+(t.y+i)*this.scale.y),this.ctx.lineTo(this.offset.x+t.x*this.scale.x,this.offset.y+(t.y+i)*this.scale.y),this.ctx.closePath(),this.ctx.lineWidth=r||1,this._fillOrDraw(s),this.ctx.restore()},t.prototype.cubicBezier=function(t,e,i,r,n,o,a){t instanceof s.CubicBezierCurve?this.cubicBezier(t.startPoint,t.endPoint,t.startControlPoint,t.endControlPoint,n,o):(this.ctx.save(),this.ctx.beginPath(),this.applyStrokeOpts(a),this.ctx.moveTo(this.offset.x+t.x*this.scale.x,this.offset.y+t.y*this.scale.y),this.ctx.bezierCurveTo(this.offset.x+i.x*this.scale.x,this.offset.y+i.y*this.scale.y,this.offset.x+r.x*this.scale.x,this.offset.y+r.y*this.scale.y,this.offset.x+e.x*this.scale.x,this.offset.y+e.y*this.scale.y),this.ctx.lineWidth=o||2,this._fillOrDraw(n),this.ctx.restore())},t.prototype.quadraticBezier=function(t,e,i,s,r,n){this.ctx.save(),this.ctx.beginPath(),this.applyStrokeOpts(n),this.ctx.moveTo(this.offset.x+t.x*this.scale.x,this.offset.y+t.y*this.scale.y),this.ctx.quadraticCurveTo(this.offset.x+e.x*this.scale.x,this.offset.y+e.y*this.scale.y,this.offset.x+i.x*this.scale.x,this.offset.y+i.y*this.scale.y),this.ctx.lineWidth=r||2,this._fillOrDraw(s),this.ctx.restore()},t.prototype.cubicBezierPath=function(t,e,i,s,r){if(t&&0!=t.length){var n,o,a;this.ctx.save(),this.ctx.beginPath(),this.applyStrokeOpts(s),this.ctx.moveTo(this.offset.x+t[0].x*this.scale.x,this.offset.y+t[0].y*this.scale.y);for(var h=1;h<t.length;h+=3)o=t[h],a=t[h+1],n=t[h+2],this.ctx.bezierCurveTo(this.offset.x+o.x*this.scale.x,this.offset.y+o.y*this.scale.y,this.offset.x+a.x*this.scale.x,this.offset.y+a.y*this.scale.y,this.offset.x+n.x*this.scale.x,this.offset.y+n.y*this.scale.y);r||this.ctx.closePath(),this.ctx.lineWidth=i||1,this._fillOrDraw(e),this.ctx.restore()}},t.prototype.handle=function(t,e){this.point(t,"rgb(0,32,192)"),this.square(e,5,"rgba(0,128,192,0.5)")},t.prototype.handleLine=function(t,e){this.line(t,e,"rgba(128,128,128, 0.5)",void 0)},t.prototype.dot=function(t,e){this.ctx.save(),this.ctx.beginPath(),this.ctx.setLineDash([]),this.ctx.moveTo(Math.round(this.offset.x+this.scale.x*t.x),Math.round(this.offset.y+this.scale.y*t.y)),this.ctx.lineTo(Math.round(this.offset.x+this.scale.x*t.x+1),Math.round(this.offset.y+this.scale.y*t.y+1)),this.ctx.closePath(),this.ctx.lineWidth=1,this._fillOrDraw(e),this.ctx.restore()},t.prototype.point=function(t,e){this.ctx.setLineDash([]),this.ctx.beginPath(),this.ctx.arc(this.offset.x+t.x*this.scale.x,this.offset.y+t.y*this.scale.y,3,0,2*Math.PI,!1),this.ctx.closePath(),this.ctx.lineWidth=1,this._fillOrDraw(e)},t.prototype.circle=function(t,e,i,s,r){this.applyStrokeOpts(r),this.ctx.beginPath(),this.ctx.ellipse(this.offset.x+t.x*this.scale.x,this.offset.y+t.y*this.scale.y,e*this.scale.x,e*this.scale.y,0,0,2*Math.PI),this.ctx.closePath(),this.ctx.lineWidth=s||1,this._fillOrDraw(i)},t.prototype.circleArc=function(t,e,i,s,r,n,o){o&&o.asSegment||this.ctx.beginPath(),this.applyStrokeOpts(o),this.ctx.ellipse(this.offset.x+t.x*this.scale.x,this.offset.y+t.y*this.scale.y,e*this.scale.x,e*this.scale.y,0,i,s,!1),o&&o.asSegment||(this.ctx.lineWidth=n||1,this._fillOrDraw(r||"#000000"))},t.prototype.ellipse=function(t,e,i,s,r,n,o){void 0===n&&(n=0),this.applyStrokeOpts(o),this.ctx.beginPath(),this.ctx.ellipse(this.offset.x+t.x*this.scale.x,this.offset.y+t.y*this.scale.y,e*this.scale.x,i*this.scale.y,n,0,2*Math.PI),this.ctx.closePath(),this.ctx.lineWidth=r||1,this._fillOrDraw(s)},t.prototype.square=function(t,e,i,s,r){this.applyStrokeOpts(r),this.ctx.beginPath(),this.ctx.rect(this.offset.x+(t.x-e/2)*this.scale.x,this.offset.y+(t.y-e/2)*this.scale.y,e*this.scale.x,e*this.scale.y),this.ctx.closePath(),this.ctx.lineWidth=s||1,this._fillOrDraw(i)},t.prototype.grid=function(t,e,i,s,r,n){this.ctx.setLineDash([]),this.ctx.beginPath();for(var o=-Math.ceil(.5*i/r)*r,a=i/2,h=-Math.ceil(.5*e/s)*s;h<e/2;h+=s)this.ctx.moveTo(this.offset.x+(t.x+h)*this.scale.x,this.offset.y+(t.y+o)*this.scale.y),this.ctx.lineTo(this.offset.x+(t.x+h)*this.scale.x,this.offset.y+(t.y+a)*this.scale.y);for(var c=-Math.ceil(.5*e/s)*s,l=e/2,u=-Math.ceil(.5*i/r)*r;u<i/2;u+=r)this.ctx.moveTo(this.offset.x+(t.x+c)*this.scale.x-4,this.offset.y+(t.y+u)*this.scale.y),this.ctx.lineTo(this.offset.x+(t.x+l)*this.scale.x+4,this.offset.y+(t.y+u)*this.scale.y);this.ctx.strokeStyle=n,this.ctx.lineWidth=1,this.ctx.stroke(),this.ctx.closePath()},t.prototype.raster=function(t,e,i,s,r,n){this.ctx.save(),this.ctx.setLineDash([]),this.ctx.beginPath();for(var o=-Math.ceil(.5*e/s)*s;o<e/2;o+=s)for(var a=-Math.ceil(.5*i/r)*r;a<i/2;a+=r)this.ctx.moveTo(this.offset.x+(t.x+o)*this.scale.x-4,this.offset.y+(t.y+a)*this.scale.y),this.ctx.lineTo(this.offset.x+(t.x+o)*this.scale.x+4,this.offset.y+(t.y+a)*this.scale.y),this.ctx.moveTo(this.offset.x+(t.x+o)*this.scale.x,this.offset.y+(t.y+a)*this.scale.y-4),this.ctx.lineTo(this.offset.x+(t.x+o)*this.scale.x,this.offset.y+(t.y+a)*this.scale.y+4);this.ctx.strokeStyle=n,this.ctx.lineWidth=1,this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()},t.prototype.diamondHandle=function(t,e,i){this.ctx.setLineDash([]),this.ctx.beginPath(),this.ctx.moveTo(this.offset.x+t.x*this.scale.x-e/2,this.offset.y+t.y*this.scale.y),this.ctx.lineTo(this.offset.x+t.x*this.scale.x,this.offset.y+t.y*this.scale.y-e/2),this.ctx.lineTo(this.offset.x+t.x*this.scale.x+e/2,this.offset.y+t.y*this.scale.y),this.ctx.lineTo(this.offset.x+t.x*this.scale.x,this.offset.y+t.y*this.scale.y+e/2),this.ctx.closePath(),this.ctx.lineWidth=1,this._fillOrDraw(i)},t.prototype.squareHandle=function(t,e,i){this.ctx.setLineDash([]),this.ctx.beginPath(),this.ctx.rect(this.offset.x+t.x*this.scale.x-e/2,this.offset.y+t.y*this.scale.y-e/2,e,e),this.ctx.closePath(),this.ctx.lineWidth=1,this._fillOrDraw(i)},t.prototype.circleHandle=function(t,e,i){e=e||3,this.ctx.setLineDash([]),this.ctx.beginPath(),this.ctx.arc(this.offset.x+t.x*this.scale.x,this.offset.y+t.y*this.scale.y,e,0,2*Math.PI,!1),this.ctx.closePath(),this.ctx.lineWidth=1,this._fillOrDraw(i)},t.prototype.crosshair=function(t,e,i,s){this.ctx.save(),this.ctx.setLineDash([]),this.ctx.beginPath(),this.ctx.moveTo(this.offset.x+t.x*this.scale.x-e,this.offset.y+t.y*this.scale.y),this.ctx.lineTo(this.offset.x+t.x*this.scale.x+e,this.offset.y+t.y*this.scale.y),this.ctx.moveTo(this.offset.x+t.x*this.scale.x,this.offset.y+t.y*this.scale.y-e),this.ctx.lineTo(this.offset.x+t.x*this.scale.x,this.offset.y+t.y*this.scale.y+e),this.ctx.strokeStyle=i,this.ctx.lineWidth=s||.5,this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()},t.prototype.cross=function(t,e,i,s){this.ctx.save(),this.ctx.setLineDash([]),this.ctx.beginPath(),this.ctx.moveTo(this.offset.x+t.x*this.scale.x-e,this.offset.y+t.y*this.scale.y-e),this.ctx.lineTo(this.offset.x+t.x*this.scale.x+e,this.offset.y+t.y*this.scale.y+e),this.ctx.moveTo(this.offset.x+t.x*this.scale.x-e,this.offset.y+t.y*this.scale.y+e),this.ctx.lineTo(this.offset.x+t.x*this.scale.x+e,this.offset.y+t.y*this.scale.y-e),this.ctx.strokeStyle=i,this.ctx.lineWidth=s||1,this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()},t.prototype.polygon=function(t,e,i,s){this.polyline(t.vertices,t.isOpen,e,i,s)},t.prototype.polyline=function(t,e,i,s,r){if(!(t.length<=1)){this.ctx.save(),this.applyStrokeOpts(r),this.ctx.beginPath(),this.ctx.lineWidth=s||1,this.ctx.moveTo(this.offset.x+t[0].x*this.scale.x,this.offset.y+t[0].y*this.scale.y);for(var n=0;n<t.length;n++)this.ctx.lineTo(this.offset.x+t[n].x*this.scale.x,this.offset.y+t[n].y*this.scale.y);e||this.ctx.closePath(),this._fillOrDraw(i),this.ctx.closePath(),this.ctx.setLineDash([]),this.ctx.restore()}},t.prototype.text=function(t,e,i,s){var r,n,o;s=s||{},this.ctx.save();var a=this.offset.x+e*this.scale.x,h=this.offset.y+i*this.scale.y,c=s.color||"black";(s.fontSize||s.fontFamily)&&(this.ctx.font=(s.fontWeight?s.fontWeight+" ":"")+(s.fontStyle?s.fontStyle+" ":"")+(s.fontSize?s.fontSize*this.scale.x+"px ":" ")+(s.fontFamily?-1===s.fontFamily.indexOf(" ")?s.fontFamily:'"'.concat(s.fontFamily,'"'):"Arial")),s.textAlign&&(this.ctx.textAlign=s.textAlign);var l=null!==(r=s.rotation)&&void 0!==r?r:0,u=(null!==(o=null!==(n=s.lineHeight)&&void 0!==n?n:s.fontSize)&&void 0!==o?o:0)*this.scale.x;this.ctx.translate(a,h),this.ctx.rotate(l),this.fillShapes?(this.ctx.fillStyle=c,this.ctx.fillText(t,0,u/2)):(this.ctx.strokeStyle=c,this.ctx.strokeText(t,0,u/2)),this.ctx.restore()},t.prototype.label=function(t,e,i,s,r){this.ctx.save(),this.ctx.font="lighter 9pt Arial",this.ctx.translate(e,i),void 0!==s&&this.ctx.rotate(s),this.ctx.fillStyle=r||"black",this.fillShapes?this.ctx.fillText(t,0,0):this.ctx.strokeText(t,0,0),this.ctx.restore()},t.prototype.path=function(t,e,i,s){var r=s&&s.inplace?t:n.drawutilssvg.copyPathData(t);n.drawutilssvg.transformPathData(r,this.offset,this.scale),e&&(this.ctx.strokeStyle=e),this.ctx.lineWidth=i||1,this.applyStrokeOpts(s),this.fillShapes?(e&&(this.ctx.fillStyle=e),this.ctx.fill(new Path2D(r.join(" ")))):(e&&(this.ctx.strokeStyle=e),this.ctx.stroke(new Path2D(r.join(" "))))},t.prototype.clear=function(t){this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.fillStyle=t,this.ctx.fillRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height)},t.helpers={clipPoly:function(t,e,i,s){t.beginPath(),t.moveTo(e.x+s[0].x*i.x,e.y+s[0].y*i.y);for(var r=1;r<s.length;r++){var n=s[r];t.lineTo(e.x+n.x*i.x,e.y+n.y*i.y)}t.closePath(),t.clip()}},t}();e.drawutils=a},76:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Bounds=void 0;var s=i(687),r=i(787),n=function(){function t(t,e){this.min=t,this.max=e,this.width=e.x-t.x,this.height=e.y-t.y}return t.prototype.containsVert=function(t){return this.min.x<=t.x&&t.x<this.max.x&&this.min.y<=t.y&&t.y<this.max.y},t.prototype.getWidth=function(){return this.max.x-this.min.x},t.prototype.getHeight=function(){return this.max.y-this.min.y},t.prototype.getScaled=function(e){var i=this.getCenter();return new t(new r.Vertex(this.min).scale(e,i),new r.Vertex(this.max).scale(e,i))},t.prototype.getMoved=function(e){return new t(new r.Vertex(this.min).move(e),new r.Vertex(this.max).move(e))},t.prototype.getNorthPoint=function(){return new r.Vertex(this.min.x+this.width/2,this.min.y)},t.prototype.getSouthPoint=function(){return new r.Vertex(this.min.x+this.width/2,this.max.y)},t.prototype.getWestPoint=function(){return new r.Vertex(this.min.x,this.min.y+this.height/2)},t.prototype.getEastPoint=function(){return new r.Vertex(this.max.x,this.min.y+this.height/2)},t.prototype.getNorthWestPoint=function(){return new r.Vertex(this.min.x,this.min.y)},t.prototype.getNorthEastPoint=function(){return new r.Vertex(this.max.x,this.min.y)},t.prototype.getSouthEastPoint=function(){return new r.Vertex(this.max.x,this.max.y)},t.prototype.getSouthWestPoint=function(){return new r.Vertex(this.min.x,this.max.y)},t.prototype.toPolygon=function(){return new s.Polygon([new r.Vertex(this.min),new r.Vertex(this.max.x,this.min.y),new r.Vertex(this.max),new r.Vertex(this.min.x,this.max.y)],!1)},t.prototype.getCenter=function(){return new r.Vertex(this.min.x+(this.max.x-this.min.x)/2,this.min.y+(this.max.y-this.min.y)/2)},t.prototype.getMinDimension=function(){return Math.min(this.width,this.height)},t.prototype.getMaxDimension=function(){return Math.max(this.width,this.height)},t.prototype.randomPoint=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0);var i=t>0&&t<1?this.width*t:t,s=e>0&&e<1?this.height*e:e;return new r.Vertex(this.min.x+i+Math.random()*(this.width-2*i),this.min.y+s+Math.random()*(this.height-2*s))},t.prototype.toString=function(){return"{ min: ".concat(this.min.toString(),", max : ").concat(this.max.toString(),", width: ").concat(this.width,", height : ").concat(this.height," }")},t.prototype.clone=function(){return new t({x:this.min.x,y:this.min.y},{x:this.max.x,y:this.max.y})},t.computeFromVertices=function(e){if(0==e.length)return new t(new r.Vertex(0,0),new r.Vertex(0,0));var i,s=e[0].x,n=e[0].x,o=e[0].y,a=e[0].y;for(var h in e)i=e[h],s=Math.min(s,i.x),n=Math.max(n,i.x),o=Math.min(o,i.y),a=Math.max(a,i.y);return new t(new r.Vertex(s,o),new r.Vertex(n,a))},t.computeFromBoundsSet=function(e){if(0==e.length)return new t(new r.Vertex(0,0),new r.Vertex(0,0));var i,s=e[0].min.x,n=e[0].max.x,o=e[0].min.y,a=e[0].min.y;for(var h in e)i=e[h],s=Math.min(s,i.min.x),n=Math.max(n,i.max.x),o=Math.min(o,i.min.y),a=Math.max(a,i.min.y);return new t(new r.Vertex(s,o),new r.Vertex(n,a))},t.fromDimension=function(e,i,s){return new t(null!=s?s:{x:0,y:0},{x:(s?s.x:0)+e,y:(s?s.y:0)+i})},t}();e.Bounds=n},118:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Circle=void 0;var s=i(76),r=i(939),n=i(938),o=i(30),a=i(787),h=function(){function t(t,e){this.className="Circle",this.uid=n.UIDGenerator.next(),this.center=t,this.radius=e}return t.prototype.move=function(t){return this.center.add(t),this},t.prototype.containsPoint=function(t){return this.center.distance(t)<this.radius},t.prototype.containsCircle=function(t){return this.center.distance(t.center)+t.radius<this.radius},t.prototype.lineDistance=function(t){return t.getClosestPoint(this.center).distance(this.center)-this.radius},t.prototype.vertAt=function(e){return t.circleUtils.vertAt(e,this.radius).add(this.center)},t.prototype.tangentAt=function(e){var i=t.circleUtils.vertAt(e,this.radius);return new o.Vector(i,new a.Vertex(0,0)).add(this.center).perp()},t.prototype.getBounds=function(){return new s.Bounds(this.center.clone().subXY(Math.abs(this.radius),Math.abs(this.radius)),this.center.clone().addXY(Math.abs(this.radius),Math.abs(this.radius)))},t.prototype.circleIntersection=function(t){if(this.center.distance(t.center)>this.radius+t.radius)return null;if(this.center.distance(t.center)<Math.abs(this.radius-t.radius))return null;var e=this.center,i=t.center,s=e.distance(i),n=(this.radius*this.radius-t.radius*t.radius+s*s)/(2*s),o=Math.sqrt(this.radius*this.radius-n*n),h=i.clone().scale(n/s,e),c=h.x+o*(i.y-e.y)/s,l=h.y-o*(i.x-e.x)/s,u=h.x-o*(i.y-e.y)/s,d=h.y+o*(i.x-e.x)/s;return new r.Line(new a.Vertex(c,l),new a.Vertex(u,d))},t.prototype.lineIntersection=function(t,e){var i=new a.Vertex,s=new a.Vertex,n=new a.Vertex(t).sub(this.center),o=new a.Vertex(e).sub(this.center),h=n.difference(o);0===Math.abs(h.y)&&(h.y=1e-6);var c=n.distance(o),l=n.x*o.y-n.y*o.x,u=c*c;if(this.radius*this.radius*u-l*l<0)return null;var d=this.radius*this.radius*c*c-l*l,p=Math.sqrt(d);return i.x=(l*h.y+Math.sign(h.y)*h.x*p)/u,s.x=(l*h.y-Math.sign(h.y)*h.x*p)/u,i.y=(-l*h.x+Math.abs(h.y)*p)/u,s.y=(-l*h.x-Math.abs(h.y)*p)/u,new r.Line(i.add(this.center),s.add(this.center))},t.prototype.lineIntersections=function(t,e){void 0===e&&(e=!1);var i=this.lineIntersection(t.a,t.b);return i?e?[i.a,i.b].filter(function(e){return t.hasPoint(e,!0)}):[i.a,i.b]:[]},t.prototype.lineIntersectionTangents=function(t,e){var i=this;return void 0===e&&(e=!1),this.lineIntersections(t,e).map(function(t){var e=new r.Line(i.center,t).angle();return i.tangentAt(e)})},t.prototype.closestPoint=function(t){var e=this.lineIntersection(this.center,t);return e?e.a.distance(t)<e.b.distance(t)?e.a:e.b:new a.Vertex},t.prototype.destroy=function(){this.center.destroy(),this.isDestroyed=!0},t.circleUtils={vertAt:function(t,e){return new a.Vertex(Math.cos(t)*e,Math.sin(t)*e)}},t}();e.Circle=h},135:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CircleSector=void 0;var s=i(76),r=i(118),n=i(939),o=i(938),a=i(787),h=i(328),c=function(){function t(t,e,i){this.className="CircleSector",this.uid=o.UIDGenerator.next(),this.circle=t,this.startAngle=e,this.endAngle=i}return t.prototype.getBounds=function(){var t=this,e=this.circle.getBounds(),i=[e.getNorthPoint(),e.getSouthPoint(),e.getWestPoint(),e.getEastPoint()].filter(function(e){var i=new n.Line(t.circle.center,e).angle();return t.containsAngle(i)});return s.Bounds.computeFromVertices(i.concat([this.getStartPoint(),this.getEndPoint()]))},t.prototype.move=function(t){return this.circle.move(t),this},t.prototype.containsAngle=function(t){var e=h.geomutils.mapAngleTo2PI(t),i=h.geomutils.mapAngleTo2PI(this.startAngle),s=h.geomutils.mapAngleTo2PI(this.endAngle);return i<=s?e>=i&&e<s:e>=i||e<s},t.prototype.angleAt=function(t){return this.startAngle<=this.endAngle?(this.startAngle+(this.endAngle-this.startAngle)*t)%(2*Math.PI):(this.startAngle+(2*Math.PI-this.startAngle+this.endAngle)*t)%(2*Math.PI)},t.prototype.getStartPoint=function(){return this.circle.vertAt(this.startAngle)},t.prototype.getEndPoint=function(){return this.circle.vertAt(this.endAngle)},t.prototype.circleSectorIntersection=function(e){var i=this.circle.circleIntersection(e.circle);if(!i)return null;var s=this.circle.center.angle(i.a),n=this.circle.center.angle(i.b);if(!this.containsAngle(s)||!this.containsAngle(n))return null;var o=e.circle.center.angle(i.a),a=e.circle.center.angle(i.b);if(!e.containsAngle(o)||!e.containsAngle(a))return null;var h=new t(this.circle,this.endAngle,this.startAngle).angleAt(.5),c=new t(new r.Circle(this.circle.center.clone(),this.circle.radius),s,n);return c.containsAngle(h)&&(c.startAngle=n,c.endAngle=s),c},t.prototype.lineIntersections=function(t,e){var i=this;void 0===e&&(e=!1);var s=this.circle.lineIntersections(t,e),r=new n.Line(this.circle.center,new a.Vertex);return s.filter(function(t){r.b.set(t);var e=r.angle();return i.containsAngle(h.geomutils.wrapMinMax(e,0,2*Math.PI))})},t.prototype.lineIntersectionTangents=function(t,e){var i=this;return void 0===e&&(e=!1),this.lineIntersections(t,e).map(function(t){var e=new n.Line(i.circle.center,t).angle();return i.circle.tangentAt(e)})},t.prototype.describeSVGPath=function(e){return t.circleSectorUtils.describeSVGArc(this.circle.center.x,this.circle.center.y,this.circle.radius,this.startAngle,this.endAngle,e)},t.prototype.destroy=function(){this.circle.destroy(),this.isDestroyed=!0},t.circleSectorUtils={polarToCartesian:function(t,e,i,s){return{x:t+i*Math.cos(s),y:e+i*Math.sin(s)}},describeSVGArc:function(e,i,s,r,n,o){void 0===o&&(o={moveToStart:!0});var a=t.circleSectorUtils.polarToCartesian(e,i,s,n),h=t.circleSectorUtils.polarToCartesian(e,i,s,r);if(2*Math.PI-Math.abs(r-n)<.001){var c=t.circleSectorUtils.describeSVGArc(e,i,s,r,r+(n-r)/2,o),l=t.circleSectorUtils.describeSVGArc(e,i,s,r+(n-r)/2,n,o);return c.concat(l)}var u,d,p=n-r;p<0?(u=Math.abs(p)<Math.PI?1:0,d=1):(u=Math.abs(p)>Math.PI?1:0,d=1);var f=[];return o.moveToStart&&f.push("M",h.x,h.y),f.push("A",s,s,0,u,d,a.x,a.y),f}},t}();e.CircleSector=c},264:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.drawutilsgl=void 0;var s=i(787),r=function(){function t(e,i){this.gl=e,this.offset=new s.Vertex(0,0),this.scale=new s.Vertex(1,1),this.fillShapes=i,this._zindex=0,null!=e&&void 0!==e&&(this.glutils=new n(e),this._vertShader=this.glutils.compileShader(t.vertCode,this.gl.VERTEX_SHADER),this._fragShader=this.glutils.compileShader(t.fragCode,this.gl.FRAGMENT_SHADER),this._program=this.glutils.makeProgram(this._vertShader,this._fragShader),this.vertex_buffer=this.gl.createBuffer(),console.log("gl initialized"))}return t.prototype._x2rel=function(t){return(this.scale.x*t+this.offset.x)/this.gl.canvas.width*2-1},t.prototype._y2rel=function(t){return(this.offset.y-this.scale.y*t)/this.gl.canvas.height*2-1},t.prototype.copyInstance=function(e){var i=new t(null,e);return i.gl=this.gl,i.glutils=this.glutils,i._vertShader=this._vertShader,i._fragShader=this._fragShader,i._program=this._program,i},t.prototype.beginDrawCycle=function(t){this._zindex=0,this.renderTime=t},t.prototype.endDrawCycle=function(t){},t.prototype.setConfiguration=function(t){},t.prototype.setCurrentId=function(t){this.curId=t},t.prototype.setCurrentClassName=function(t){},t.prototype.line=function(t,e,i){var s=new Float32Array(6);s[0]=this._x2rel(t.x),s[1]=this._y2rel(t.y),s[2]=this._zindex,s[3]=this._x2rel(e.x),s[4]=this._y2rel(e.y),s[5]=this._zindex,this._zindex+=.001,this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertex_buffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,s,this.gl.STATIC_DRAW);var r=this.gl.getAttribLocation(this._program,"position");this.gl.vertexAttribPointer(r,3,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(r),this.gl.viewport(0,0,this.gl.canvas.width,this.gl.canvas.height);var n=this.gl.getUniformLocation(this._program,"uRotationVector");this.gl.uniform2fv(n,[0,1]),this.gl.lineWidth(5),this.gl.drawArrays(this.gl.LINES,0,s.length/3)},t.prototype.arrow=function(t,e,i){},t.prototype.cubicBezierArrow=function(t,e,i,s,r,n,o){},t.prototype.arrowHead=function(t,e,i,s,r){},t.prototype.image=function(t,e,i,s){void 0===s&&(s=0)},t.prototype.texturedPoly=function(t,e,i,s,r){},t.prototype._fillOrDraw=function(t){},t.prototype.cubicBezier=function(t,e,i,s,r,n){},t.prototype.cubicBezierPath=function(t,e,i,s,r){},t.prototype.handle=function(t,e){},t.prototype.handleLine=function(t,e){},t.prototype.dot=function(t,e){},t.prototype.point=function(t,e){},t.prototype.circle=function(t,e,i,s){},t.prototype.circleArc=function(t,e,i,s,r,n){},t.prototype.ellipse=function(t,e,i,s,r,n){},t.prototype.square=function(t,e,i,s){},t.prototype.rect=function(t,e,i,s,r){},t.prototype.grid=function(t,e,i,s,r,n){},t.prototype.raster=function(t,e,i,s,r,n){},t.prototype.diamondHandle=function(t,e,i){},t.prototype.squareHandle=function(t,e,i){},t.prototype.circleHandle=function(t,e,i){},t.prototype.crosshair=function(t,e,i,s){},t.prototype.cross=function(t,e,i,s){},t.prototype.polygon=function(t,e,i){for(var s=new Float32Array(3*t.vertices.length),r=0;r<t.vertices.length;r++)s[3*r+0]=this._x2rel(t.vertices[r].x),s[3*r+1]=this._y2rel(t.vertices[r].y),s[3*r+2]=this._zindex;this._zindex+=.001,this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertex_buffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,s,this.gl.STATIC_DRAW);var n=this.gl.getAttribLocation(this._program,"position");this.gl.vertexAttribPointer(n,3,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(n),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,null),this.gl.viewport(0,0,this.gl.canvas.width,this.gl.canvas.height);var o=this.gl.getUniformLocation(this._program,"uRotationVector");this.gl.uniform2fv(o,[0,1]),this.gl.drawArrays(this.gl.TRIANGLE_FAN,0,s.length/3)},t.prototype.polyline=function(t,e,i,s){},t.prototype.text=function(t,e,i,s){},t.prototype.label=function(t,e,i,s,r){},t.prototype.path=function(t,e,i,s){},t.prototype.clear=function(t){this.gl.clearColor(1,1,1,1),this.gl.enable(this.gl.DEPTH_TEST),this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT)},t.vertCode="\n precision mediump float;\n\n attribute vec3 position;\n\n uniform vec2 uRotationVector;\n\n void main(void) {\n\tvec2 rotatedPosition = vec2(\n\t position.x * uRotationVector.y +\n\t\tposition.y * uRotationVector.x,\n\t position.y * uRotationVector.y -\n\t\tposition.x * uRotationVector.x\n\t);\n\n\tgl_Position = vec4(rotatedPosition, position.z, 1.0);\n }",t.fragCode="\n precision highp float;\n\n void main(void) {\n\tgl_FragColor = vec4(0.0,0.75,1.0,1.0);\n }",t}();e.drawutilsgl=r;var n=function(){function t(t){this.gl=t}return t.prototype.bufferData=function(t){var e=this.gl.createBuffer();return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,e),this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,null),e},t.prototype.compileShader=function(t,e){var i=this.gl.createShader(e);return this.gl.shaderSource(i,t),this.gl.compileShader(i),this.gl.getShaderParameter(i,this.gl.COMPILE_STATUS)?i:(console.warn("Error in shader:"+this.gl.getShaderInfoLog(i)),this.gl.deleteShader(i),null)},t.prototype.makeProgram=function(t,e){var i=this.gl.createProgram();return this.gl.attachShader(i,t),this.gl.attachShader(i,e),this.gl.linkProgram(i),this.gl.useProgram(i),this.gl.detachShader(i,t),this.gl.detachShader(i,e),this.gl.deleteShader(t),this.gl.deleteShader(e),i},t}()},289:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Grid=void 0;var i=function(){function t(t,e){this.center=t,this.size=e}return t.utils={baseLog:function(t,e){return Math.log(t)/Math.log(e)},mapRasterScale:function(e,i){var s=1;return i>=1?(s=Math.abs(Math.floor(1/t.utils.baseLog(e,i))),s=1/Math.pow(e,s)):s=Math.abs(Math.floor(t.utils.baseLog(1/e,1/(i+1)))),s}},t}();e.Grid=i},328:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.geomutils=void 0;var s=i(939),r=i(737);e.geomutils={mapAngleTo2PI:function(t){var e=Math.asin(Math.sin(t));return Math.cos(t)<0?Math.PI-e:e<0?e+2*Math.PI:e},dist4:function(t,e,i,s){return Math.sqrt(Math.pow(i-t,2)+Math.pow(e-s,2))},dotProduct:function(t,e){return t.x*e.x+t.y*e.y},nsectAngle:function(t,e,i,n){var o=new r.Triangle(t,e,i),a=new s.Line(t,e),h=new s.Line(t,i),c=a.angle(h),l=o.determinant()>0;c<0&&(c=2*Math.PI+c),l||(c=-1*(2*Math.PI-c));for(var u=Math.max(a.length(),h.length())/a.length(),d=[],p=1;p<n;p++)d.push(new s.Line(t,e.clone().rotate(c/n*-p,t)).scale(u));return d},wrapMax:function(t,e){return(e+t%e)%e},wrapMinMax:function(t,i,s){return i+e.geomutils.wrapMax(t-i,s-i)}}},378:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.drawutilssvg=void 0;var s=i(135),r=i(973),n=i(787),o=i(938),a=i(30),h=180/Math.PI,c=function(){function t(t,e,i,s,r,o,a,h,c,l,u,d){if(this.svgNode=t,this.offset=new n.Vertex(0,0).set(e),this.scale=new n.Vertex(1,1).set(i),this.fillShapes=r,this.isSecondary=Boolean(a),this.drawConfig=o,this.drawlibConfiguration={},this.cache=new Map,this.setSize(s),a){if(!(h&&c&&l&&u))throw"Cannot create secondary svg draw lib with undefinde gNode|bufferGNode|nodeDefs|bufferNodeDefs.";this.gNode=h,this.bufferGNode=c,this.nodeDefs=l,this.bufferedNodeDefs=u,d&&(this.nodeStyle=d)}else this.addStyleDefs(o),this.addDefsNode(),this.gNode=this.createSVGNode("g"),this.bufferGNode=this.createSVGNode("g"),this.svgNode.appendChild(this.gNode)}return t.prototype.addStyleDefs=function(t){this.nodeStyle=this.createSVGNode("style"),this.svgNode.appendChild(this.nodeStyle),this.rebuildStyleDefs(t)},t.prototype.rebuildStyleDefs=function(t){var e={bezier:"CubicBezierCurve",polygon:"Polygon",triangle:"Triangle",ellipse:"Ellipse",ellipseSector:"EllipseSector",circle:"Circle",circleSector:"CircleSector",vertex:"Vertex",line:"Line",vector:"Vector",image:"Image",text:"Text"},i=[];for(var s in e){var r=e[s],n=t[s];n?i.push(".".concat(r," { fill : none; stroke: ").concat(n.color,"; stroke-width: ").concat(n.lineWidth,"px }")):console.warn("Warning: your draw config is missing the key '".concat(s,"' which is required."))}this.customStyleDefs&&(i.push("\n/* Custom styles */\n"),this.customStyleDefs.forEach(function(t,e){i.push(e+" { "+t+" }")})),this.nodeStyle.innerHTML=i.join("\n")},t.prototype.addDefsNode=function(){this.nodeDefs=this.createSVGNode("defs"),this.bufferedNodeDefs=this.createSVGNode("defs"),this.svgNode.appendChild(this.nodeDefs)},t.prototype.addCustomStyleDefs=function(t){this.customStyleDefs=t},t.prototype.findElement=function(t,e){if(!t)return null;var i=this.cache.get(t);return i&&i.nodeName.toUpperCase()===e.toUpperCase()?(this.cache.delete(t),i):null},t.prototype.createSVGNode=function(t){return document.createElementNS("http://www.w3.org/2000/svg",t)},t.prototype.makeNode=function(t){var e=this.findElement(this.curId,t);if(e||(e=this.createSVGNode(t)),this.drawlibConfiguration.blendMode){var i=e.style["mix-blend-mode"];"function"==typeof i?i(this.drawlibConfiguration.blendMode):e.style["mix-blend-mode"]=this.drawlibConfiguration.blendMode}return e},t.prototype._bindFillDraw=function(t,e,i,s,r){return this._configureNode(t,e,this.fillShapes,i,s,r),this._bindNode(t,void 0)},t.prototype._bindNode=function(t,e){return t.parentNode||(null!=e?e:this.bufferGNode).appendChild(t),t},t.prototype._addCSSClasses=function(t,e){this.curClassName?t.setAttribute("class","".concat(e," ").concat(this.curClassName)):t.setAttribute("class",e)},t.prototype._configureNode=function(t,e,i,s,r,n){return this._addCSSClasses(t,e),t.setAttribute("fill",i&&s?s:"none"),t.setAttribute("stroke",i?"none":s||"none"),t.setAttribute("stroke-width","".concat(r||1)),this.curId&&t.setAttribute("id","".concat(this.curId)),this.applyStrokeOpts(t,n),t},t.prototype.setSize=function(t){this.canvasSize=t,this.svgNode.setAttribute("viewBox","0 0 ".concat(this.canvasSize.width," ").concat(this.canvasSize.height)),this.svgNode.setAttribute("width","".concat(this.canvasSize.width)),this.svgNode.setAttribute("height","".concat(this.canvasSize.height))},t.prototype.copyInstance=function(e){return new t(this.svgNode,this.offset,this.scale,this.canvasSize,e,this.drawConfig,!0,this.gNode,this.bufferGNode,this.nodeDefs,this.bufferedNodeDefs,this.nodeStyle)},t.prototype.setConfiguration=function(t){this.drawlibConfiguration=t},t.prototype.setCurrentId=function(t){this.curId=t},t.prototype.setCurrentClassName=function(t){this.curClassName=t},t.prototype.beginDrawCycle=function(t){this.cache.clear();for(var e=0;e<this.bufferGNode.childNodes.length;e++){var i=this.bufferGNode.childNodes[e];this.cache.set(i.getAttribute("id"),i)}this.removeAllChildNodes()},t.prototype.endDrawCycle=function(t){this.rebuildStyleDefs(this.drawConfig),this.isSecondary||(this.svgNode.replaceChild(this.bufferedNodeDefs,this.nodeDefs),this.svgNode.replaceChild(this.bufferGNode,this.gNode));var e=this.gNode;this.gNode=this.bufferGNode,this.bufferGNode=e;var i=this.nodeDefs;this.nodeDefs=this.bufferedNodeDefs,this.bufferedNodeDefs=i},t.prototype.applyStrokeOpts=function(e,i){var s=this;i&&i.dashArray&&i.dashArray.length>0&&t.nodeSupportsLineDash(e.tagName)&&(e.setAttribute("stroke-dasharray",i.dashArray.map(function(t){return t*s.scale.x}).join(" ")),i.dashOffset&&e.setAttribute("stroke-dashoffset","".concat(i.dashOffset*this.scale.x))),i&&i.lineJoin&&t.nodeSupportsLineJoin(e.tagName)&&e.setAttribute("stroke-linejoin",i.lineJoin)},t.prototype._x=function(t){return this.offset.x+this.scale.x*t},t.prototype._y=function(t){return this.offset.y+this.scale.y*t},t.prototype.line=function(t,e,i,s,r){var n=this.makeLineNode(t,e,i,s,r);return this._bindFillDraw(n,"line",i,s||1,r)},t.prototype.arrow=function(t,e,i,s,r,n){void 0===r&&(r=8);var o=this.makeNode("g"),a={x:0,y:0},h=this.makeArrowHeadNode(t,e,i,s,r,void 0,a),c=this.makeLineNode(t,a,i,s,n);return o.appendChild(c),o.appendChild(h),this._addCSSClasses(o,"linear-arrow"),this._bindNode(o,void 0),o},t.prototype.cubicBezierArrow=function(t,e,i,s,r,o,a,h){void 0===a&&(a=8);var c=this.makeNode("g"),l=new n.Vertex(0,0),u=this.makeArrowHeadNode(s,e,r,o,a,void 0,l),d=l.difference(e),p=this.makeCubicBezierNode(t,{x:e.x-d.x,y:e.y-d.y},i,{x:s.x-d.x,y:s.y-d.y},r,o,h);return c.appendChild(p),c.appendChild(u),this._addCSSClasses(c,"cubicbezier-arrow"),this._bindNode(c,void 0),c},t.prototype.arrowHead=function(t,e,i,s,r,n){void 0===r&&(r=8);var o=this.makeArrowHeadNode(t,e,i,s,r,n);return this._bindFillDraw(o,"arrowhead",i,s||1,n)},t.prototype.image=function(t,e,i,s){var r=this;void 0===s&&(s=1);var n=this.makeNode("image"),o=function(t){if(t.naturalWidth){var o=i.x/t.naturalWidth,a=i.y/t.naturalHeight;n.setAttribute("width","".concat(t.naturalWidth*r.scale.x)),n.setAttribute("height","".concat(t.naturalHeight*r.scale.y)),n.setAttribute("display",null),n.setAttribute("opacity","".concat(s)),n.setAttribute("transform","translate(".concat(r._x(e.x)," ").concat(r._y(e.y),") scale(").concat(o," ").concat(a,")"))}};return t.addEventListener("load",function(e){o(t)}),n.setAttribute("x","".concat(0)),n.setAttribute("y","".concat(0)),n.setAttribute("display","none"),o(t),n.setAttribute("href",t.src),this._bindFillDraw(n,"image",null,null)},t.prototype.texturedPoly=function(t,e,i,s,r){var a=new n.Vertex(e.min).clone().rotate(r,s),c=this.makeNode("clipPath"),l="clippath_".concat(o.UIDGenerator.next());c.setAttribute("id",l);var u=this.makeNode("g"),d=this.makeNode("image");d.setAttribute("x","".concat(this._x(a.x))),d.setAttribute("y","".concat(this._y(a.y))),d.setAttribute("width","".concat(e.width)),d.setAttribute("height","".concat(e.height)),d.setAttribute("href",t.src),d.setAttribute("transform","rotate(".concat(r*h,", ").concat(this._x(a.x),", ").concat(this._y(a.y),")"));var p=this.makeNode("path"),f=[];if(i.vertices.length>0){f.push("M","".concat(this._x(i.vertices[0].x)),"".concat(this._y(i.vertices[0].y)));for(var y=1;y<i.vertices.length;y++)f.push("L","".concat(this._x(i.vertices[y].x)),"".concat(this._y(i.vertices[y].y)))}p.setAttribute("d",f.join(" ")),c.appendChild(p),this.bufferedNodeDefs.appendChild(c),u.appendChild(d),u.setAttribute("transform-origin","".concat(this._x(a.x)," ").concat(this._y(a.y))),u.setAttribute("transform","scale(".concat(this.scale.x,", ").concat(this.scale.y,")"));var v=this.makeNode("g");return v.appendChild(u),v.setAttribute("clip-path","url(#".concat(l,")")),this._bindFillDraw(v,"image",null,null),v},t.prototype.cubicBezier=function(t,e,i,s,r,n,o){var a=this.makeCubicBezierNode(t,e,i,s,r,n,o);return this._bindNode(a,void 0)},t.prototype.cubicBezierPath=function(t,e,i,s,r){var n=this.makeNode("path");if(this.applyStrokeOpts(n,s),!t||0==t.length)return n;for(var o,a,h,c=["M",this._x(t[0].x),this._y(t[0].y)],l=1;l<t.length;l+=3)a=t[l],h=t[l+1],o=t[l+2],c.push("C",this._x(a.x),this._y(a.y),this._x(h.x),this._y(h.y),this._x(o.x),this._y(o.y));return r||c.push("Z"),n.setAttribute("d",c.join(" ")),this._bindFillDraw(n,"cubicBezierPath",e,i||1)},t.prototype.handle=function(t,e){this.point(t,"rgb(0,32,192)"),this.square(e,5,"rgba(0,128,192,0.5)")},t.prototype.handleLine=function(t,e){this.line(t,e,"rgb(128,128,128,0.5)")},t.prototype.dot=function(t,e){var i=this.makeNode("line");return i.setAttribute("x1","".concat(this._x(t.x))),i.setAttribute("y1","".concat(this._y(t.y))),i.setAttribute("x2","".concat(this._x(t.x))),i.setAttribute("y2","".concat(this._y(t.y))),this._bindFillDraw(i,"dot",e,1)},t.prototype.point=function(t,e){var i=this.makeNode("circle");return i.setAttribute("cx","".concat(this._x(t.x))),i.setAttribute("cy","".concat(this._y(t.y))),i.setAttribute("r","".concat(3)),this._bindFillDraw(i,"point",e,1)},t.prototype.circle=function(t,e,i,s,r){var n=this.makeNode("circle");return this.applyStrokeOpts(n,r),n.setAttribute("cx","".concat(this._x(t.x))),n.setAttribute("cy","".concat(this._y(t.y))),n.setAttribute("r","".concat(e*this.scale.x)),this._bindFillDraw(n,"circle",i,s||1)},t.prototype.circleArc=function(t,e,i,r,n,o,a){var h=this.makeNode("path");this.applyStrokeOpts(h,a);var c=s.CircleSector.circleSectorUtils.describeSVGArc(this._x(t.x),this._y(t.y),e*this.scale.x,i,r);return h.setAttribute("d",c.join(" ")),this._bindFillDraw(h,"circleArc",n,o||1)},t.prototype.ellipse=function(t,e,i,s,r,n,o){void 0===n&&(n=0);var a=this.makeNode("ellipse");return this.applyStrokeOpts(a,o),a.setAttribute("cx","".concat(this._x(t.x))),a.setAttribute("cy","".concat(this._y(t.y))),a.setAttribute("rx","".concat(e*this.scale.x)),a.setAttribute("ry","".concat(i*this.scale.y)),a.setAttribute("transform","rotate(".concat(180*n/Math.PI," ").concat(this._x(t.x)," ").concat(this._y(t.y),")")),this._bindFillDraw(a,"ellipse",s,r||1)},t.prototype.square=function(t,e,i,s,r){var n=this.makeNode("rectangle");return this.applyStrokeOpts(n,r),n.setAttribute("x","".concat(this._x(t.x-e/2))),n.setAttribute("y","".concat(this._y(t.y-e/2))),n.setAttribute("width","".concat(e*this.scale.x)),n.setAttribute("height","".concat(e*this.scale.y)),this._bindFillDraw(n,"square",i,s||1)},t.prototype.rect=function(t,e,i,s,r,n){var o=this.makeNode("rect");return this.applyStrokeOpts(o,n),o.setAttribute("x","".concat(this._x(t.x))),o.setAttribute("y","".concat(this._y(t.y))),o.setAttribute("width","".concat(e*this.scale.x)),o.setAttribute("height","".concat(i*this.scale.y)),this._bindFillDraw(o,"rect",s,r||1)},t.prototype.grid=function(t,e,i,s,r,n){for(var o=this.makeNode("path"),a=[],h=-Math.ceil(.5*i/r)*r,c=i/2,l=-Math.ceil(.5*e/s)*s;l<e/2;l+=s)a.push("M",this._x(t.x+l),this._y(t.y+h)),a.push("L",this._x(t.x+l),this._y(t.y+c));for(var u=-Math.ceil(.5*e/s)*s,d=e/2,p=-Math.ceil(.5*i/r)*r;p<i/2;p+=r)a.push("M",this._x(t.x+u),this._y(t.y+p)),a.push("L",this._x(t.x+d),this._y(t.y+p));return o.setAttribute("d",a.join(" ")),this._bindFillDraw(o,"grid",n,1)},t.prototype.raster=function(t,e,i,s,r,n){for(var o=this.makeNode("path"),a=[],h=-Math.ceil(.5*e/s)*s;h<e/2;h+=s)for(var c=-Math.ceil(.5*i/r)*r;c<i/2;c+=r)a.push("M",this._x(t.x+h)-4,this._y(t.y+c)),a.push("L",this._x(t.x+h)+4,this._y(t.y+c)),a.push("M",this._x(t.x+h),this._y(t.y+c)-4),a.push("L",this._x(t.x+h),this._y(t.y+c)+4);return o.setAttribute("d",a.join(" ")),this._bindFillDraw(o,"raster",n,1)},t.prototype.diamondHandle=function(t,e,i){var s=this.makeNode("path"),r=["M",this._x(t.x)-e/2,this._y(t.y),"L",this._x(t.x),this._y(t.y)-e/2,"L",this._x(t.x)+e/2,this._y(t.y),"L",this._x(t.x),this._y(t.y)+e/2,"Z"];return s.setAttribute("d",r.join(" ")),this._bindFillDraw(s,"diamondHandle",i,1)},t.prototype.squareHandle=function(t,e,i){var s=this.makeNode("rect");return s.setAttribute("x","".concat(this._x(t.x)-e/2)),s.setAttribute("y","".concat(this._y(t.y)-e/2)),s.setAttribute("width","".concat(e)),s.setAttribute("height","".concat(e)),this._bindFillDraw(s,"squareHandle",i,1)},t.prototype.circleHandle=function(t,e,i){e=e||3;var s=this.makeNode("circle");return s.setAttribute("cx","".concat(this._x(t.x))),s.setAttribute("cy","".concat(this._y(t.y))),s.setAttribute("r","".concat(e)),this._bindFillDraw(s,"circleHandle",i,1)},t.prototype.crosshair=function(t,e,i,s){var r=this.makeNode("path"),n=["M",this._x(t.x)-e,this._y(t.y),"L",this._x(t.x)+e,this._y(t.y),"M",this._x(t.x),this._y(t.y)-e,"L",this._x(t.x),this._y(t.y)+e];return r.setAttribute("d",n.join(" ")),this._bindFillDraw(r,"crosshair",i,s||.5)},t.prototype.cross=function(t,e,i,s){var r=this.makeNode("path"),n=["M",this._x(t.x)-e,this._y(t.y)-e,"L",this._x(t.x)+e,this._y(t.y)+e,"M",this._x(t.x)-e,this._y(t.y)+e,"L",this._x(t.x)+e,this._y(t.y)-e];return r.setAttribute("d",n.join(" ")),this._bindFillDraw(r,"cross",i,s||1)},t.prototype.polygon=function(t,e,i,s){return this.polyline(t.vertices,t.isOpen,e,i,s)},t.prototype.polyline=function(t,e,i,s,r){var n=this.makeNode("path");if(this.applyStrokeOpts(n,r),0==t.length)return n;for(var o=["M",this._x(t[0].x),this._y(t[0].y)],a=t.length,h=1;h<a;h++)o.push("L",this._x(t[h].x),this._y(t[h].y));return e||o.push("Z"),n.setAttribute("d",o.join(" ")),this._bindFillDraw(n,"polygon",i,s||1)},t.prototype.text=function(t,e,i,s){var r,n,o,a=(s=s||{}).color||"black",c=(null!==(n=null!==(r=s.lineHeight)&&void 0!==r?r:s.fontSize)&&void 0!==n?n:0)*this.scale.x,l="left"===s.textAlign||"start"===s.textAlign?"start":"center"===s.textAlign?"middle":"right"===s.textAlign||"end"===s.textAlign?"end":"start",u="".concat(this._x(e),"px ").concat(this._y(i),"px"),d="translate(".concat(this._x(e)," ").concat(this._y(i)+c/2,")"),p=s.rotation?"rotate(".concat(s.rotation*h," 0 0)"):"",f=this.makeNode("g"),y=this.curId;this.curId=y+"_text";var v=this.makeNode("text");return f.appendChild(v),v.setAttribute("font-family",null!==(o=s.fontFamily)&&void 0!==o?o:""),v.setAttribute("font-size",s.fontSize?"".concat(s.fontSize*this.scale.x):""),v.setAttribute("font-style",s.fontStyle?"".concat(s.fontStyle):""),v.setAttribute("font-weight",s.fontWeight?"".concat(s.fontWeight):""),v.setAttribute("text-anchor",l),v.setAttribute("transform-origin","0 0"),v.setAttribute("transform",p),f.setAttribute("transform-origin",u),f.setAttribute("transform",d),v.innerHTML=t,this.curId=y,this._bindFillDraw(f,"text",a,1)},t.prototype.label=function(t,e,i,s,r){var n=this.makeNode("text");return n.setAttribute("transform","translate(".concat(e,",").concat(i,"), rotate(").concat((s||0)/Math.PI*180,")")),n.setAttribute("font-family","Arial"),n.setAttribute("font-size","9pt"),n.setAttribute("font-style","normal"),n.setAttribute("font-weight","lighter"),n.innerHTML=t,this._bindFillDraw(n,"label",r||"black",null)},t.prototype.path=function(e,i,s,r){var n=this.makeNode("path");this.applyStrokeOpts(n,r);var o=r&&r.inplace?e:t.copyPathData(e);return t.transformPathData(o,this.offset,this.scale),n.setAttribute("d",o.join(" ")),this._bindFillDraw(n,"path",i,s)},t.prototype.clear=function(t){if(!this.isSecondary){this.curId="background",this.curClassName=null;var e=this.makeNode("rect");e.setAttribute("x","0"),e.setAttribute("y","0"),e.setAttribute("width","".concat(this.canvasSize.width)),e.setAttribute("height","".concat(this.canvasSize.height)),this._bindFillDraw(e,this.curId,null,null),e.setAttribute("fill",void 0===t?"none":t),this.curId=null}},t.prototype.removeAllChildNodes=function(){for(;this.bufferGNode.lastChild;)this.bufferGNode.removeChild(this.bufferGNode.lastChild);for(;this.bufferedNodeDefs.lastChild;)this.bufferedNodeDefs.removeChild(this.bufferedNodeDefs.lastChild)},t.createSvg=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg")},t.copyPathData=function(t){for(var e=new Array(t.length),i=0,s=t.length;i<s;i++)e[i]=t[i];return e},t.transformPathData=function(t,e,i){for(var s=function(s){t[s]=e.x+i.x*Number(t[s])},r=function(s){t[s]=e.y+i.y*Number(t[s])},n=function(e){t[e]=i.x*Number(t[e])},o=function(e){t[e]=i.y*Number(t[e])},a=0,h={x:NaN,y:NaN},c=function(e){h.x=Number(t[e]),h.y=Number(t[e+1])};a<t.length;)switch(t[a]){case"M":case"L":case"T":s(a+1),r(a+2),c(a+1),a+=3;break;case"m":case"l":case"t":n(a+1),o(a+2),c(a+1),a+=3;break;case"H":s(a+1),h.x=Number(t[a+1]),a+=2;break;case"h":n(a+1),h.x=Number(t[a+1]),a+=2;break;case"V":r(a+1),h.y=Number(t[a+1]),a+=2;break;case"v":o(a+1),h.y=Number(t[a+1]),a+=2;break;case"C":s(a+1),r(a+2),s(a+3),r(a+4),s(a+5),r(a+6),c(a+5),a+=7;break;case"c":n(a+1),o(a+2),n(a+3),o(a+4),n(a+5),o(a+6),c(a+5),a+=7;break;case"S":case"Q":s(a+1),r(a+2),s(a+3),r(a+4),c(a+3),a+=5;break;case"s":case"q":n(a+1),o(a+2),n(a+3),o(a+4),c(a+3),a+=5;break;case"A":n(a+1),o(a+2),s(a+6),r(a+7),c(a+6),(i.x<0&&i.y>=0||i.x>=0&&i.y<0)&&(t[a+5]=t[a+5]?0:1),a+=8;break;case"a":n(a+1),o(a+2),n(a+6),o(a+7),c(a+6),a+=8;break;default:a++}},t.nodeSupportsLineDash=function(t){return["line","path","circle","ellipse","rectangle","rect"].includes(t)},t.nodeSupportsLineJoin=function(t){return["line","path","circle","ellipse","rectangle","rect"].includes(t)},t.prototype.makeLineNode=function(t,e,i,s,r,n){var o=this.makeNode("line");return o.setAttribute("x1","".concat(this._x(t.x))),o.setAttribute("y1","".concat(this._y(t.y))),o.setAttribute("x2","".concat(this._x(e.x))),o.setAttribute("y2","".concat(this._y(e.y))),this._configureNode(o,null!=n?n:"line",this.fillShapes,i,s||1,r),o},t.prototype.makePathNode=function(t,e,i,s,r){var n=this.makeNode("path");return n.setAttribute("d",t),this._configureNode(n,null!=r?r:"path",this.fillShapes,e,i||1,s),n},t.prototype.makeArrowHeadNode=function(t,e,i,s,r,n,o){void 0===r&&(r=8);var h=a.Vector.utils.buildArrowHead(t,e,r,this.scale.x,this.scale.y),c=["M",this.offset.x+h[0].x,this.offset.y+h[0].y];o&&(o.x=h[0].x/this.scale.x,o.y=h[0].y/this.scale.y);for(var l=1;l<=h.length;l++)c.push("L"),c.push(this.offset.x+h[l%h.length].x),c.push(this.offset.y+h[l%h.length].y);return this.makePathNode(c.join(" "),i,s,n,"arrowhead")},t.prototype.makeCubicBezierNode=function(t,e,i,s,n,o,a){if(t instanceof r.CubicBezierCurve)return this.cubicBezier(t.startPoint,t.endPoint,t.startControlPoint,t.endControlPoint,n,o);var h=["M",this._x(t.x),this._y(t.y),"C",this._x(i.x),this._y(i.y),this._x(s.x),this._y(s.y),this._x(e.x),this._y(e.y)];return this.makePathNode(h.join(" "),n,o,a,"cubicBezier")},t.HEAD_XML=['<?xml version="1.0" encoding="UTF-8" standalone="no"?>','<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" ',' "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">',""].join("\n"),t}();e.drawutilssvg=c},476:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VertexAttr=void 0;var i=function(){function t(){for(var e in this.draggable=!0,this.selectable=!0,this.isSelected=!1,this.visible=!0,t.model)this[e]=t.model[e]}return t.model={draggable:!0,selectable:!0,isSelected:!1,visible:!0},t}();e.VertexAttr=i},531:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.KeyHandler=void 0;var i=function(){function t(t){this.downListeners=[],this.pressListeners=[],this.upListeners=[],this.keyStates={},t=t||{},this.element=t.element?t.element:globalThis,this.downListeners=[],this.pressListeners=[],this.upListeners=[],this.keyStates=[],this.trackAllKeys=t.trackAll||!1,this.installListeners()}return t.prototype.fireEvent=function(t,e){var i=!1;for(var s in e){var r=e[s];r.keyCode==t.keyCode&&(r.listener(t),i=!0)}return i},t.prototype.fireDownEvent=function(t,e){(e.fireEvent(t,e.downListeners)||e.trackAllKeys)&&(e.keyStates[t.keyCode]="down")},t.prototype.firePressEvent=function(t,e){e.fireEvent(t,e.pressListeners)},t.prototype.fireUpEvent=function(t,e){(e.fireEvent(t,e.upListeners)||e.trackAllKeys)&&delete e.keyStates[t.keyCode]},t.key2code=function(e){if("number"==typeof e)return e;if("string"!=typeof e)throw"Unknown key name or key type (should be a string or integer): "+e;if(t.KEY_CODES[e])return t.KEY_CODES[e];throw"Unknown key (cannot resolve key code): "+e},t.prototype.installListeners=function(){var t=this;this.element.addEventListener("keydown",this._keyDownListener=function(e){t.fireDownEvent(e,t)}),this.element.addEventListener("keypress",this._keyPressListener=function(e){t.firePressEvent(e,t)}),this.element.addEventListener("keyup",this._keyUpListener=function(e){t.fireUpEvent(e,t)})},t.prototype.releaseListeners=function(){this.element.removeEventListener("keydown",this._keyDownListener),this.element.removeEventListener("keypress",this._keyPressListener),this.element.removeEventListener("keyup",this._keyUpListener)},t.prototype.down=function(e,i){return this.downListeners.push({key:e,keyCode:t.key2code(e),listener:i}),this},t.prototype.press=function(e,i){return this.pressListeners.push({key:e,keyCode:t.key2code(e),listener:i}),this},t.prototype.up=function(e,i){return this.upListeners.push({key:e,keyCode:t.key2code(e),listener:i}),this},t.prototype.isDown=function(e){return"number"==typeof e?!!this.keyStates[e]:!!this.keyStates[t.key2code(e)]},t.prototype.destroy=function(){this.releaseListeners()},t.KEY_CODES={break:3,backspace:8,tab:9,clear:12,enter:13,shift:16,ctrl:17,alt:18,pause:19,capslock:20,hangul:21,hanja:25,escape:27,conversion:28,"non-conversion":29,spacebar:32,pageup:33,pagedown:34,end:35,home:36,leftarrow:37,uparrow:38,rightarrow:39,downarrow:40,select:41,print:42,execute:43,printscreen:44,insert:45,delete:46,help:47,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,":":58,"semicolon (firefox)":59,equals:59,"<":60,"equals (firefox)":61,ß:63,"@ (firefox)":64,a:65,b:66,c:67,d:68,e:69,f:70,g:71,h:72,i:73,j:74,k:75,l:76,m:77,n:78,o:79,p:80,q:81,r:82,s:83,t:84,u:85,v:86,w:87,x:88,y:89,z:90,windows:91,leftcommand:91,chromebooksearch:91,rightwindowkey:92,windowsmenu:93,rightcommant:93,sleep:95,numpad0:96,numpad1:97,numpad2:98,numpad3:99,numpad4:100,numpad5:101,numpad6:102,numpad7:103,numpad8:104,numpad9:105,multiply:106,add:107,numpadperiod:108,subtract:109,decimalpoint:110,divide:111,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123,f13:124,f14:125,f15:126,f16:127,f17:128,f18:129,f19:130,f20:131,f21:132,f22:133,f23:134,f24:135,numlock:144,scrolllock:145,"^":160,"!":161,"#":163,$:164,ù:165,pagebackward:166,pageforward:167,refresh:168,closingparen:169,"*":170,"~+*":171,minus:173,decreasevolumelevel:174,increasevolumelevel:175,next:176,previous:177,stop:178,"play/pause":179,email:180,mute:181,unmute:181,semicolon:186,ñ:186,equal:187,comma:188,dash:189,period:190,forwardslash:191,ç:191,"grave accent":192,æ:192,ö:192,"?":193,"/":193,"°":193,openbracket:219,backslash:220,closebracket:221,å:221,singlequote:222,ø:222,ä:222,"`":223,altgr:225,"GNOME Compose Key":230,XF86Forward:233,XF86Back:234,alphanumeric:240,hiragana:242,katakana:242,"half-width":243,"full-width":243,kanji:244,unlocktrackpad:251,toggletouchpad:255},t}();e.KeyHandler=i},559:function(t,e,i){var s=this&&this.__setFunctionName||function(t,e,i){return"symbol"==typeof e&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:i?"".concat(i," ",e):e})};Object.defineProperty(e,"__esModule",{value:!0}),e.PlotBoilerplate=void 0;var r=i(597),n=i(39),o=i(264),a=i(378),h=i(733),c=i(76),l=i(118),u=i(135),d=i(289),p=i(531),f=i(939),y=i(912),v=i(862),g=i(687),x=i(737),m=i(881),b=i(719),w=i(30),C=i(787),P=i(476),A=i(628),T=function(){function t(e,i){var s,r;if(this.contentChangeListeners=[],this.renderTime=0,this._gui=null,P.VertexAttr.model={bezierAutoAdjust:!1,renderTime:0,selectable:!0,isSelected:!1,draggable:!0,visible:!0},void 0===e.canvas)throw"No canvas specified.";var h=t.utils.fetch;this.config={canvas:e.canvas,fullSize:h.val(e,"fullSize",!0),fitToParent:h.bool(e,"fitToParent",!0),scaleX:h.num(e,"scaleX",1),scaleY:h.num(e,"scaleY",1),offsetX:h.num(e,"offsetX",0),offsetY:h.num(e,"offsetY",0),rasterGrid:h.bool(e,"rasterGrid",!0),drawRaster:h.bool(e,"drawRaster",!0),rasterScaleX:h.num(e,"rasterScaleX",1),rasterScaleY:h.num(e,"rasterScaleY",1),rasterAdjustFactor:h.num(e,"rasterAdjustdFactror",2),drawOrigin:h.bool(e,"drawOrigin",!1),autoAdjustOffset:h.val(e,"autoAdjustOffset",!0),offsetAdjustXPercent:h.num(e,"offsetAdjustXPercent",50),offsetAdjustYPercent:h.num(e,"offsetAdjustYPercent",50),backgroundColor:e.backgroundColor||"#ffffff",redrawOnResize:h.bool(e,"redrawOnResize",!0),defaultCanvasWidth:h.num(e,"defaultCanvasWidth",t.DEFAULT_CANVAS_WIDTH),defaultCanvasHeight:h.num(e,"defaultCanvasHeight",t.DEFAULT_CANVAS_HEIGHT),canvasWidthFactor:h.num(e,"canvasWidthFactor",1),canvasHeightFactor:h.num(e,"canvasHeightFactor",1),cssScaleX:h.num(e,"cssScaleX",1),cssScaleY:h.num(e,"cssScaleY",1),cssUniformScale:h.bool(e,"cssUniformScale",!0),saveFile:function(){u.hooks.saveFile(u)},setToRetina:function(){u._setToRetina()},autoDetectRetina:h.bool(e,"autoDetectRetina",!0),enableSVGExport:h.bool(e,"enableSVGExport",!0),preClear:h.func(e,"preClear",null),preDraw:h.func(e,"preDraw",null),postDraw:h.func(e,"postDraw",null),enableMouse:h.bool(e,"enableMouse",!0),enableTouch:h.bool(e,"enableTouch",!0),enableKeys:h.bool(e,"enableKeys",!0),enableMouseWheel:h.bool(e,"enableMouseWheel",!0),enableZoom:h.bool(e,"enableZoom",!0),enablePan:h.bool(e,"enablePan",!0),enableGL:h.bool(e,"enableGL",!1),isBackdropFiltersEnabled:h.bool(e,"isBackdropFiltersEnabled",!0)},this.drawConfig={drawVertices:!0,drawBezierHandleLines:h.bool(e,"drawBezierHandleLines",!0),drawBezierHandlePoints:h.bool(e,"drawBezierHandlePoints",!0),drawHandleLines:h.bool(e,"drawHandleLines",!0),drawHandlePoints:h.bool(e,"drawHandlePoints",!0),drawGrid:h.bool(e,"drawGrid",!0),drawRaster:h.bool(e,"drawRaster",!0),bezier:{color:"#00a822",lineWidth:2,handleLine:{color:"rgba(180,180,180,0.5)",lineWidth:1},pathVertex:{color:"#B400FF",lineWidth:1,fill:!0},controlVertex:{color:"#B8D438",lineWidth:1,fill:!0}},polygon:{color:"#0022a8",lineWidth:1},triangle:{color:"#6600ff",lineWidth:1},ellipse:{color:"#2222a8",lineWidth:1},ellipseSector:{color:"#a822a8",lineWidth:2},circle:{color:"#22a8a8",lineWidth:2},circleSector:{color:"#2280a8",lineWidth:1},vertex:{color:"#a8a8a8",lineWidth:1},selectedVertex:{color:"#c08000",lineWidth:2},line:{color:"#a844a8",lineWidth:1},vector:{color:"#ff44a8",lineWidth:1},image:{color:"#a8a8a8",lineWidth:1},text:{color:"rgba(192,0,128,0.5)",lineWidth:1,fill:!0,anchor:!0},origin:{color:"#000000"}},this.grid=new d.Grid(new C.Vertex(0,0),new C.Vertex(50,50)),this.canvasSize={width:t.DEFAULT_CANVAS_WIDTH,height:t.DEFAULT_CANVAS_HEIGHT};var c="string"==typeof e.canvas?document.querySelector(e.canvas):e.canvas;if(void 0===c)throw'Cannot initialize PlotBoilerplate with a null canvas (element "'.concat(e.canvas," not found).");if("canvas"===c.tagName.toLowerCase())if(this.canvas=c,this.eventCatcher=this.canvas,this.config.enableGL&&void 0===o.drawutilsgl&&(console.warn("Cannot use webgl. Package was compiled without experimental gl support. Please use plotboilerplate-glsupport.min.js instead."),console.warn("Disabling GL and falling back to Canvas2D."),this.config.enableGL=!1),this.config.enableGL){var l=this.canvas.getContext("webgl");this.draw=new o.drawutilsgl(l,!1),this.fill=this.draw.copyInstance(!0),console.warn("Initialized with experimental mode enableGL=true. Note that this is not yet fully implemented.")}else l=this.canvas.getContext("2d"),this.draw=new n.drawutils(l,!1),this.fill=new n.drawutils(l,!0);else{if("svg"!==c.tagName.toLowerCase())throw"Element is neither a canvas nor an svg element.";if(void 0===a.drawutilssvg)throw"The svg draw library is not yet integrated part of PlotBoilerplate. Please include ./src/js/utils/helpers/drawutils.svg into your document.";this.canvas=c,this.draw=new a.drawutilssvg(this.canvas,new C.Vertex,new C.Vertex,this.canvasSize,!1,this.drawConfig,!1),this.fill=this.draw.copyInstance(!0),this.canvas.parentElement?(this.eventCatcher=document.createElement("div"),this.eventCatcher.style.position="absolute",this.eventCatcher.style.left="0",this.eventCatcher.style.top="0",this.eventCatcher.style.cursor="pointer",this.canvas.parentElement.style.position="relative",this.canvas.parentElement.appendChild(this.eventCatcher)):this.eventCatcher=document.body}e.title&&this.eventCatcher.setAttribute("title",e.title),this.draw.scale.set(null!==(s=this.config.scaleX)&&void 0!==s?s:1,this.config.scaleY),this.fill.scale.set(null!==(r=this.config.scaleX)&&void 0!==r?r:1,this.config.scaleY),this.vertices=[],this.selectPolygon=null,this.draggedElements=[],this.drawables=[],this.console=console,this.hooks={saveFile:t._saveFile};var u=this;globalThis.addEventListener("resize",function(){return u.resizeCanvas()}),this.resizeCanvas(),e.autoDetectRetina&&this._setToRetina(),this.installInputListeners(),this.updateCSSscale(),this.redraw(),this.canvas.focus()}var e;return t._saveFile=function(t){var e=document.createElementNS("http://www.w3.org/2000/svg","svg"),i=new a.drawutilssvg(e,t.draw.offset,t.draw.scale,t.canvasSize,!1,t.drawConfig),s=i.copyInstance(!0);i.beginDrawCycle(0),s.beginDrawCycle(0),t.config.preClear&&t.config.preClear(),i.clear(t.config.backgroundColor||"white"),t.config.preDraw&&t.config.preDraw(i,s),t.drawAll(0,i,s),t.drawVertices(0,i),t.config.postDraw&&t.config.postDraw(i,s),i.endDrawCycle(0),s.endDrawCycle(0);var r=(new XMLSerializer).serializeToString(e),n=new Blob(['<?xml version="1.0" encoding="utf-8"?>\n'+r],{type:"image/svg;charset=utf-8"});if("function"!=typeof globalThis.saveAs)throw"Cannot save file; did you load the ./utils/savefile helper function and the eligrey/SaveFile library?";(0,globalThis.saveAs)(n,"plotboilerplate.svg")},t.prototype._setToRetina=function(){this.config.autoDetectRetina=!0;var t=globalThis.devicePixelRatio||1;this.config.cssScaleX=this.config.cssScaleY=1/t,this.config.canvasWidthFactor=this.config.canvasHeightFactor=t,this.resizeCanvas(),this.updateCSSscale()},t.prototype.fitToView=function(t){var e=new C.Vertex(this.canvasSize.width/2,this.canvasSize.height/2),i=this.canvasSize.width/this.canvasSize.height,s=t.width/t.height,r=new C.Vertex(t.max.x-t.width/2,t.max.y-t.height/2).inv().addXY(this.canvasSize.width/2,this.canvasSize.height/2);if(this.setOffset(r),i<s){var n=this.canvasSize.width/t.width;this.setZoom(n,n,e)}else n=this.canvasSize.height/t.height,this.setZoom(n,n,e);this.redraw()},t.prototype.setConsole=function(t){this.console=t},t.prototype.updateCSSscale=function(){var e,i,s,r;this.config.cssUniformScale?t.utils.setCSSscale(this.canvas,null!==(e=this.config.cssScaleX)&&void 0!==e?e:1,null!==(i=this.config.cssScaleX)&&void 0!==i?i:1):t.utils.setCSSscale(this.canvas,null!==(s=this.config.cssScaleX)&&void 0!==s?s:1,null!==(r=this.config.cssScaleY)&&void 0!==r?r:1)},t.prototype.addContentChangeListener=function(t){for(var e in this.contentChangeListeners)if(this.contentChangeListeners[e]===t)return;this.contentChangeListeners.push(t)},t.prototype.removeContentChangeListener=function(t){for(var e=0;e<this.contentChangeListeners.length;e++)if(this.contentChangeListeners[e]===t)return void this.contentChangeListeners.splice(e,1)},t.prototype._fireContentChanged=function(t,e){for(var i in this.contentChangeListeners){var s=this.contentChangeListeners[i];s&&"function"==typeof s&&s({type:t.length>0?"DRAWABLES_ADDED":"DRAWABLES_REMOVED",addedDrawables:t,removedDrawables:e})}},t.prototype.add=function(e,i,s){if(Array.isArray(e))for(var r=e,n=0;n<r.length;n++)this.add(r[n],!1,s);else{var o=[e];if(e instanceof C.Vertex)this.drawables.push(e),this.vertices.push(e);else if(e instanceof f.Line)this.drawables.push(e),this.vertices.push(e.a),this.vertices.push(e.b),o.push(e.a,e.b);else if(e instanceof w.Vector)this.drawables.push(e),this.vertices.push(e.a),this.vertices.push(e.b),o.push(e.a,e.b),e.a.listeners.addDragListener(function(t){e.b.add(t.params.dragAmount)});else if(e instanceof m.VEllipse)this.vertices.push(e.center),this.vertices.push(e.axis),o.push(e.center,e.axis),this.drawables.push(e),e.center.listeners.addDragListener(function(t){e.axis.add(t.params.dragAmount)});else if(e instanceof b.VEllipseSector)this.vertices.push(e.ellipse.center),this.vertices.push(e.ellipse.axis),o.push(e.ellipse.center,e.ellipse.axis),this.drawables.push(e),e.ellipse.center.listeners.addDragListener(function(t){e.ellipse.axis.add(t.params.dragAmount)});else if(e instanceof l.Circle)this.vertices.push(e.center),o.push(e.center),this.drawables.push(e);else if(e instanceof u.CircleSector)this.vertices.push(e.circle.center),o.push(e.circle.center),this.drawables.push(e);else if(e instanceof g.Polygon)for(this.drawables.push(e),n=0;n<e.vertices.length;n++)this.vertices.push(e.vertices[n]),o.push(e.vertices[n]);else if(e instanceof x.Triangle)this.drawables.push(e),this.vertices.push(e.a),this.vertices.push(e.b),this.vertices.push(e.c),o.push(e.a,e.b,e.c);else if(e instanceof h.BezierPath){this.drawables.push(e);var a=e;for(n=0;n<a.bezierCurves.length;n++)e.adjustCircular||0!=n||(this.vertices.push(a.bezierCurves[n].startPoint),o.push(a.bezierCurves[n].startPoint)),this.vertices.push(a.bezierCurves[n].endPoint),this.vertices.push(a.bezierCurves[n].startControlPoint),this.vertices.push(a.bezierCurves[n].endControlPoint),o.push(a.bezierCurves[n].endPoint,a.bezierCurves[n].startControlPoint,a.bezierCurves[n].endControlPoint),a.bezierCurves[n].startControlPoint.attr.selectable=!1,a.bezierCurves[n].endControlPoint.attr.selectable=!1;t.utils.enableBezierPathAutoAdjust(e)}else if(e instanceof v.PBImage)this.vertices.push(e.upperLeft),this.vertices.push(e.lowerRight),o.push(e.upperLeft,e.lowerRight),this.drawables.push(e),e.upperLeft.listeners.addDragListener(function(t){e.lowerRight.add(t.params.dragAmount)}),e.lowerRight.attr.selectable=!1;else{if(!(e instanceof A.PBText))throw"Cannot add drawable of unrecognized type: "+typeof e+".";this.vertices.push(e.anchor),o.push(e.anchor),this.drawables.push(e),e.anchor.attr.selectable=!1}!s&&this._fireContentChanged(o,[])}(i||void 0===i)&&this.redraw()},t.prototype.remove=function(t,e,i,s){if(Array.isArray(t)){for(var r=[],n=0;n<t.length;n++)this.remove(t[n],!1,i,!0)&&r.push(t[n]);return e&&this.redraw(),!s&&this._fireContentChanged([],r),r.length>0}if(t instanceof C.Vertex){var o=this.removeVertex(t,!1,!1);return e&&this.redraw(),!s&&this._fireContentChanged([],[t]),o}var a=!1,c=[];for(n=0;n<this.drawables.length;n++)if(this.drawables[n]===t||this.drawables[n].uid===t.uid){if(this.drawables.splice(n,1),c.push(t),i)if(t instanceof f.Line)this.removeVertex(t.a,!1,!0),this.removeVertex(t.b,!1,!0),c.push(t.a,t.b);else if(t instanceof w.Vector)this.removeVertex(t.a,!1,!0),this.removeVertex(t.b,!1,!0),c.push(t.a,t.b);else if(t instanceof m.VEllipse)this.removeVertex(t.center,!1,!0),this.removeVertex(t.axis,!1,!0),c.push(t.center,t.axis);else if(t instanceof b.VEllipseSector)this.removeVertex(t.ellipse.center,!1,!0),this.removeVertex(t.ellipse.axis,!1,!0),c.push(t.ellipse.center,t.ellipse.axis);else if(t instanceof l.Circle)this.removeVertex(t.center,!1,!0);else if(t instanceof u.CircleSector)this.removeVertex(t.circle.center,!1,!0),c.push(t.circle.center);else if(t instanceof g.Polygon)for(n=0;n<t.vertices.length;n++)this.removeVertex(t.vertices[n],!1,!0),c.push(t.vertices[n]);else if(t instanceof x.Triangle)this.removeVertex(t.a,!1,!0),this.removeVertex(t.b,!1,!0),this.removeVertex(t.c,!1,!0),c.push(t.a,t.b,t.c);else if(t instanceof h.BezierPath)for(n=0;n<t.bezierCurves.length;n++)this.removeVertex(t.bezierCurves[n].startPoint,!1,!0),this.removeVertex(t.bezierCurves[n].startControlPoint,!1,!0),this.removeVertex(t.bezierCurves[n].endControlPoint,!1,!0),c.push(t.bezierCurves[n].startPoint,t.bezierCurves[n].startControlPoint,t.bezierCurves[n].endControlPoint),n+1==t.bezierCurves.length&&(this.removeVertex(t.bezierCurves[n].endPoint,!1,!0),c.push(t.bezierCurves[n].endPoint));else t instanceof v.PBImage?(this.removeVertex(t.upperLeft,!1,!0),this.removeVertex(t.lowerRight,!1,!0),c.push(t.upperLeft,t.lowerRight)):t instanceof A.PBText&&(this.removeVertex(t.anchor,!1,!0),c.push(t.anchor));e&&this.redraw(),!s&&this._fireContentChanged([],c),a=!0}return a},t.prototype.removeVertex=function(t,e,i){for(var s=0;s<this.vertices.length;s++)if(this.vertices[s]===t)return this.vertices.splice(s,1),e&&this.redraw(),!i&&this._fireContentChanged([],[t]),!0;return!1},t.prototype.removeAll=function(t,e){var i=this.drawables;this.drawables=[],Boolean(t)||(i=i.concat(this.vertices),this.vertices=[]),(e||void 0===e)&&this.redraw(),i.length>0&&this._fireContentChanged([],i)},t.prototype.getVertexNear=function(t,e){var i,s,r=this.locatePointNear(this.transformMousePosition(t.x,t.y),e/Math.min(null!==(i=this.config.cssScaleX)&&void 0!==i?i:1,null!==(s=this.config.cssScaleY)&&void 0!==s?s:1));if(r&&"vertex"==r.typeName)return this.vertices[r.vindex]},t.prototype.drawGrid=function(t){void 0===t&&(t=this.draw);var e=d.Grid.utils.mapRasterScale(this.config.rasterAdjustFactor,this.draw.scale.x)*this.config.rasterScaleX/this.config.cssScaleX,i=d.Grid.utils.mapRasterScale(this.config.rasterAdjustFactor,this.draw.scale.y)*this.config.rasterScaleY/this.config.cssScaleY,s={width:this.grid.size.x*e,height:this.grid.size.y*i},r=this.canvasSize.width/2,n=this.canvasSize.height/2,o=this.draw.offset.clone().inv();o.x=Math.round(o.x+r)/Math.round(s.width)*s.width/this.draw.scale.x+(this.draw.offset.x-r)/this.draw.scale.x%s.width,o.y=Math.round(o.y+n)/Math.round(s.height)*s.height/this.draw.scale.y+(this.draw.offset.y-n)/this.draw.scale.x%s.height,this.drawConfig.drawGrid&&(t.setCurrentClassName(null),this.config.rasterGrid?(t.setCurrentId("raster"),t.raster(o,this.canvasSize.width/this.draw.scale.x,this.canvasSize.height/this.draw.scale.y,s.width,s.height,"rgba(0,128,255,0.125)")):(t.setCurrentId("grid"),t.grid(o,this.canvasSize.width/this.draw.scale.x,this.canvasSize.height/this.draw.scale.y,s.width,s.height,"rgba(0,128,255,0.095)")))},t.prototype.drawOrigin=function(t){t.setCurrentId("origin"),t.crosshair({x:0,y:0},10,this.drawConfig.origin.color)},t.prototype._handleColor=function(t,e){return t.attr.isSelected?this.drawConfig.selectedVertex.color:t.attr.draggable?e:"rgba(128,128,128,0.5)"},t.prototype.drawDrawables=function(t,e,i){for(var s in this.drawables){var r=this.drawables[s];this.draw.setCurrentId(r.uid),this.fill.setCurrentId(r.uid),this.draw.setCurrentClassName(r.className),this.fill.setCurrentClassName(r.className),this.drawDrawable(r,t,e,i)}},t.prototype.drawDrawable=function(t,e,i,s){if(t instanceof h.BezierPath){var r=0;for(var n in t.bezierCurves){var o;if(this.draw.setCurrentId("".concat(t.uid,"-").concat(r)),this.fill.setCurrentId("".concat(t.uid,"-").concat(r)),this.draw.setCurrentClassName(t.className),this.fill.setCurrentClassName(t.className),i.cubicBezier(t.bezierCurves[n].startPoint,t.bezierCurves[n].endPoint,t.bezierCurves[n].startControlPoint,t.bezierCurves[n].endControlPoint,this.drawConfig.bezier.color,this.drawConfig.bezier.lineWidth),this.drawConfig.drawBezierHandlePoints&&this.drawConfig.drawHandlePoints)t.bezierCurves[n].startPoint.attr.visible&&((o=this.drawConfig.bezier.pathVertex.fill?s:i).setCurrentId("".concat(t.uid,"_h0")),o.setCurrentClassName("".concat(t.className,"-start-handle")),t.bezierCurves[n].startPoint.attr.bezierAutoAdjust?o.squareHandle(t.bezierCurves[n].startPoint,5,this._handleColor(t.bezierCurves[n].startPoint,this.drawConfig.bezier.pathVertex.color)):o.diamondHandle(t.bezierCurves[n].startPoint,7,this._handleColor(t.bezierCurves[n].startPoint,this.drawConfig.bezier.pathVertex.color))),t.bezierCurves[n].startPoint.attr.renderTime=e,t.bezierCurves[n].endPoint.attr.visible&&((o=this.drawConfig.bezier.pathVertex.fill?s:i).setCurrentId("".concat(t.uid,"_h0")),o.setCurrentClassName("".concat(t.className,"-start-handle")),t.bezierCurves[n].endPoint.attr.bezierAutoAdjust?o.squareHandle(t.bezierCurves[n].endPoint,5,this._handleColor(t.bezierCurves[n].endPoint,this.drawConfig.bezier.pathVertex.color)):o.diamondHandle(t.bezierCurves[n].endPoint,7,this._handleColor(t.bezierCurves[n].endPoint,this.drawConfig.bezier.pathVertex.color))),t.bezierCurves[n].startControlPoint.attr.visible&&((o=this.drawConfig.bezier.controlVertex.fill?s:i).setCurrentId("".concat(t.uid,"_h2")),o.setCurrentClassName("".concat(t.className,"-start-control-handle")),o.circleHandle(t.bezierCurves[n].startControlPoint,3,this._handleColor(t.bezierCurves[n].startControlPoint,this.drawConfig.bezier.controlVertex.color))),t.bezierCurves[n].endControlPoint.attr.visible&&((o=this.drawConfig.bezier.controlVertex.fill?s:i).setCurrentId("".concat(t.uid,"_h3")),o.setCurrentClassName("".concat(t.className,"-end-control-handle")),o.circleHandle(t.bezierCurves[n].endControlPoint,3,this._handleColor(t.bezierCurves[n].endControlPoint,this.drawConfig.bezier.controlVertex.color))),t.bezierCurves[n].startPoint.attr.renderTime=e,t.bezierCurves[n].endPoint.attr.renderTime=e,t.bezierCurves[n].startControlPoint.attr.renderTime=e,t.bezierCurves[n].endControlPoint.attr.renderTime=e;else t.bezierCurves[n].startPoint.attr.renderTime=e,t.bezierCurves[n].endPoint.attr.renderTime=e,t.bezierCurves[n].startControlPoint.attr.renderTime=e,t.bezierCurves[n].endControlPoint.attr.renderTime=e;this.drawConfig.drawBezierHandleLines&&this.drawConfig.drawHandleLines&&(i.setCurrentId("".concat(t.uid,"_l0")),i.setCurrentClassName("".concat(t.className,"-start-line")),i.handleLine(t.bezierCurves[n].startPoint,t.bezierCurves[n].startControlPoint),i.setCurrentId("".concat(t.uid,"_l1")),i.setCurrentClassName("".concat(t.className,"-end-line")),i.handleLine(t.bezierCurves[n].endPoint,t.bezierCurves[n].endControlPoint)),r++}}else if(t instanceof g.Polygon){if(i.polygon(t,this.drawConfig.polygon.color,this.drawConfig.polygon.lineWidth),!this.drawConfig.drawHandlePoints)for(var a in t.vertices)t.vertices[a].attr.renderTime=e}else if(t instanceof x.Triangle)i.polyline([t.a,t.b,t.c],!1,this.drawConfig.triangle.color,this.drawConfig.triangle.lineWidth),this.drawConfig.drawHandlePoints||(t.a.attr.renderTime=t.b.attr.renderTime=t.c.attr.renderTime=e);else if(t instanceof m.VEllipse)this.drawConfig.drawHandleLines&&(i.setCurrentId("".concat(t.uid,"_e0")),i.setCurrentClassName("".concat(t.className,"-v-line")),i.handleLine(t.center.clone().add(0,t.signedRadiusV()).rotate(t.rotation,t.center),t.axis),i.setCurrentId("".concat(t.uid,"_e1")),i.setCurrentClassName("".concat(t.className,"-h-line")),i.handleLine(t.center.clone().add(t.signedRadiusH(),0).rotate(t.rotation,t.center),t.axis)),i.setCurrentId(t.uid),i.setCurrentClassName("".concat(t.className)),i.ellipse(t.center,t.radiusH(),t.radiusV(),this.drawConfig.ellipse.color,this.drawConfig.ellipse.lineWidth,t.rotation),this.drawConfig.drawHandlePoints||(t.center.attr.renderTime=e,t.axis.attr.renderTime=e);else if(t instanceof b.VEllipseSector){i.setCurrentId(t.uid),i.setCurrentClassName("".concat(t.className));var c=b.VEllipseSector.ellipseSectorUtils.describeSVGArc(t.ellipse.center.x,t.ellipse.center.y,t.ellipse.radiusH(),t.ellipse.radiusV(),t.startAngle,t.endAngle,t.ellipse.rotation,{moveToStart:!0});i.path(c,this.drawConfig.ellipseSector.color,this.drawConfig.ellipseSector.lineWidth)}else t instanceof l.Circle?i.circle(t.center,t.radius,this.drawConfig.circle.color,this.drawConfig.circle.lineWidth):t instanceof u.CircleSector?i.circleArc(t.circle.center,t.circle.radius,t.startAngle,t.endAngle,this.drawConfig.circleSector.color,this.drawConfig.circleSector.lineWidth):t instanceof C.Vertex?!this.drawConfig.drawVertices||t.attr.selectable&&t.attr.draggable||!t.attr.visible||(i.circleHandle(t,7,this.drawConfig.vertex.color),t.attr.renderTime=e):t instanceof f.Line?(i.line(t.a,t.b,this.drawConfig.line.color,this.drawConfig.line.lineWidth),this.drawConfig.drawHandlePoints&&t.a.attr.selectable||(t.a.attr.renderTime=e),this.drawConfig.drawHandlePoints&&t.b.attr.selectable||(t.b.attr.renderTime=e)):t instanceof w.Vector?(i.arrow(t.a,t.b,this.drawConfig.vector.color,this.drawConfig.vector.lineWidth),this.drawConfig.drawHandlePoints&&t.b.attr.selectable&&t.b.attr.visible?(i.setCurrentId("".concat(t.uid,"_h0")),i.setCurrentClassName("".concat(t.className,"-handle")),i.circleHandle(t.b,3,"#a8a8a8")):t.b.attr.renderTime=e,this.drawConfig.drawHandlePoints&&t.a.attr.selectable||(t.a.attr.renderTime=e),this.drawConfig.drawHandlePoints&&t.b.attr.selectable||(t.b.attr.renderTime=e)):t instanceof v.PBImage?(this.drawConfig.drawHandleLines&&(i.setCurrentId("".concat(t.uid,"_l0")),i.setCurrentClassName("".concat(t.className,"-line")),i.line(t.upperLeft,t.lowerRight,this.drawConfig.image.color,this.drawConfig.image.lineWidth)),s.setCurrentId(t.uid),s.image(t.image,t.upperLeft,t.lowerRight.clone().sub(t.upperLeft)),this.drawConfig.drawHandlePoints&&(i.setCurrentId("".concat(t.uid,"_h0")),i.setCurrentClassName("".concat(t.className,"-lower-right")),i.circleHandle(t.lowerRight,3,this.drawConfig.image.color),t.lowerRight.attr.renderTime=e)):t instanceof A.PBText?(s.setCurrentId(t.uid),s.text(t.text,t.anchor.x,t.anchor.y,t),this.drawConfig.text.anchor&&(i.setCurrentId("".concat(t.uid,"_a0")),i.setCurrentClassName("".concat(t.className,"-anchor")),(this.drawConfig.text.fill?s:i).point(t.anchor,this.drawConfig.text.color)),t.anchor.attr.renderTime=e):console.error("Cannot draw object. Unknown class.");i.setCurrentClassName(null),i.setCurrentId(null),s.setCurrentClassName(null),s.setCurrentId(null)},t.prototype.drawSelectPolygon=function(t){null!=this.selectPolygon&&this.selectPolygon.vertices.length>0&&(t.setCurrentId(this.selectPolygon.uid),t.polygon(this.selectPolygon,"#888888"),t.crosshair(this.selectPolygon.vertices[0],3,"#008888"))},t.prototype.drawVertices=function(t,e){for(var i in this.vertices)this.drawConfig.drawVertices&&this.vertices[i].attr.renderTime!=t&&this.vertices[i].attr.visible&&(e.setCurrentId(this.vertices[i].uid),e.squareHandle(this.vertices[i],5,this._handleColor(this.vertices[i],"rgb(0,128,192)")),this.vertices[i].attr.renderTime=t)},t.prototype.redraw=function(){var t=this.renderTime++;this.draw.beginDrawCycle(t),this.fill.beginDrawCycle(t),this.config.preClear&&this.config.preClear(),this.clear(),this.config.preDraw&&this.config.preDraw(this.draw,this.fill),this.drawAll(t,this.draw,this.fill),this.config.postDraw&&this.config.postDraw(this.draw,this.fill),this.draw.endDrawCycle(t),this.fill.endDrawCycle(t)},t.prototype.drawAll=function(t,e,i){this.config.drawRaster&&this.drawGrid(e),this.config.drawOrigin&&this.drawOrigin(e),this.drawDrawables(t,e,i),this.drawVertices(t,e),this.drawSelectPolygon(e),e.setCurrentId(null),e.setCurrentClassName(null)},t.prototype.clear=function(){this.draw.clear(this.config.backgroundColor||"white")},t.prototype.clearSelection=function(t){for(var e in this.vertices)this.vertices[e].attr.isSelected=!1;return t&&this.redraw(),this},t.prototype.viewport=function(){var t,e;return new c.Bounds(this.transformMousePosition(0,0),this.transformMousePosition(this.canvasSize.width*(null!==(t=this.config.cssScaleX)&&void 0!==t?t:1),this.canvasSize.height*(null!==(e=this.config.cssScaleY)&&void 0!==e?e:1)))},t.prototype.saveFile=function(){this.hooks.saveFile(this)},t.prototype.getFProp=function(t,e){return parseFloat(globalThis.getComputedStyle(t,null).getPropertyValue(e))},t.prototype.getAvailableContainerSpace=function(){var t=this,e=t.canvas.parentNode;t.canvas.style.display="none";var i=this.getFProp(e,"padding")||0,s=this.getFProp(t.canvas,"border-width")||0,r=this.getFProp(e,"padding-left")||i,n=this.getFProp(e,"padding-right")||i,o=this.getFProp(e,"padding-top")||i,a=this.getFProp(e,"padding-bottom")||i,h=this.getFProp(t.canvas,"border-left-width")||s,c=this.getFProp(t.canvas,"border-right-width")||s,l=this.getFProp(t.canvas,"border-top-width")||s,u=this.getFProp(t.canvas,"border-bottom-width")||s,d=e.clientWidth,p=e.clientHeight;return t.canvas.style.display="block",{width:d-r-n-h-c,height:p-o-a-l-u}},t.prototype.resizeCanvas=function(){var t,e,i,s,r,n,o=this,a=this,h=function(t,e){var i,s;t*=null!==(i=a.config.canvasWidthFactor)&&void 0!==i?i:1,e*=null!==(s=a.config.canvasHeightFactor)&&void 0!==s?s:1,a.canvasSize.width=t,a.canvasSize.height=e,a.canvas instanceof HTMLCanvasElement?(a.canvas.width=t,a.canvas.height=e):a.canvas instanceof SVGElement?(o.canvas.setAttribute("viewBox","0 0 ".concat(t," ").concat(e)),o.canvas.setAttribute("width","".concat(t)),o.canvas.setAttribute("height","".concat(e)),o.draw.setSize(a.canvasSize),o.eventCatcher.style.width="".concat(t,"px"),o.eventCatcher.style.height="".concat(e,"px")):console.error("Error: cannot resize canvas element because it seems neither be a HTMLCanvasElement nor an SVGElement."),a.config.autoAdjustOffset&&a.adjustOffset(!1)};if(a.config.fullSize&&!a.config.fitToParent){var c=globalThis.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,l=globalThis.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;a.canvas.style.position="absolute",a.canvas.style.width=(null!==(t=a.config.canvasWidthFactor)&&void 0!==t?t:1)*c+"px",a.canvas.style.height=(null!==(e=a.config.canvasWidthFactor)&&void 0!==e?e:1)*l+"px",a.canvas.style.top="0px",a.canvas.style.left="0px",h(c,l)}else if(a.config.fitToParent){a.canvas.style.position="static";var u=this.getAvailableContainerSpace();a.canvas.style.width=(null!==(i=a.config.canvasWidthFactor)&&void 0!==i?i:1)*u.width+"px",a.canvas.style.height=(null!==(s=a.config.canvasHeightFactor)&&void 0!==s?s:1)*u.height+"px",a.canvas.style.top="",a.canvas.style.left="",h(u.width,u.height)}else a.canvas.style.width="",a.canvas.style.height="",h(null!==(r=a.config.defaultCanvasWidth)&&void 0!==r?r:1024,null!==(n=a.config.defaultCanvasHeight)&&void 0!==n?n:768);a.config.redrawOnResize&&a.redraw()},t.prototype.selectVerticesInPolygon=function(t){for(var e in this.vertices)this.vertices[e].attr.selectable&&t.containsVert(this.vertices[e])&&(this.vertices[e].attr.isSelected=!0)},t.prototype.locatePointNear=function(e,i){var s=this;void 0===i&&(i=7),i/=s.draw.scale.x;for(var r=0;r<s.vertices.length;r++){var n=s.vertices[r];if((n.attr.draggable||n.attr.selectable)&&n.distance(e)<i)return new t.Draggable(n,t.Draggable.VERTEX).setVIndex(r)}return null},t.prototype.handleClick=function(e){var i=this,s=this.locatePointNear(i.transformMousePosition(e.params.pos.x,e.params.pos.y),t.DEFAULT_CLICK_TOLERANCE/Math.min(i.config.cssScaleX||1,i.config.cssScaleY||1));if(s)i.vertices[s.vindex].listeners.fireClickEvent(e),this.keyHandler&&this.keyHandler.isDown("shift")?("bpath"==s.typeName?(r=i.paths[s.pindex].bezierCurves[s.cindex].getPointByID(s.pid)).attr.selectable&&(r.attr.isSelected=!r.attr.isSelected):"vertex"==s.typeName&&(r=i.vertices[s.vindex]).attr.selectable&&(r.attr.isSelected=!r.attr.isSelected),i.redraw()):this.keyHandler&&this.keyHandler.isDown("y")&&(i.vertices[s.vindex].attr.bezierAutoAdjust=!i.vertices[s.vindex].attr.bezierAutoAdjust,i.redraw());else if(null!=i.selectPolygon){var r=i.transformMousePosition(e.params.pos.x,e.params.pos.y);i.selectPolygon.vertices.push(new C.Vertex(r.x,r.y)),i.redraw()}},t.prototype.transformMousePosition=function(t,e){return{x:(t/this.config.cssScaleX-this.config.offsetX)/this.config.scaleX,y:(e/this.config.cssScaleY-this.config.offsetY)/this.config.scaleY}},t.prototype.revertMousePosition=function(t,e){return{x:t/this.config.cssScaleX+this.config.offsetX,y:e/this.config.cssScaleY+this.config.offsetY}},t.prototype.getDraggedElementCount=function(){return this.draggedElements.length},t.prototype.mouseDownHandler=function(e){var i=this;if(0==e.button){var s=i.locatePointNear(i.transformMousePosition(e.params.pos.x,e.params.pos.y),t.DEFAULT_CLICK_TOLERANCE/Math.min(i.config.cssScaleX,i.config.cssScaleY));if(s){if("vertex"==s.typeName&&i.vertices[s.vindex].attr.isSelected)for(var r=0;r<i.vertices.length;r++)i.vertices[r].attr.isSelected&&(i.draggedElements.push(new t.Draggable(i.vertices[r],t.Draggable.VERTEX).setVIndex(r)),i.vertices[r].listeners.fireDragStartEvent(e));else{if(!i.vertices[s.vindex].attr.draggable)return;i.draggedElements.push(s),"bpath"==s.typeName?i.paths[s.pindex].bezierCurves[s.cindex].getPointByID(s.pid).listeners.fireDragStartEvent(e):"vertex"==s.typeName&&i.vertices[s.vindex].listeners.fireDragStartEvent(e)}i.redraw()}}},t.prototype.mouseDragHandler=function(t){var e=this,i={x:t.params.dragAmount.x,y:t.params.dragAmount.y};if(t.params.dragAmount.x/=e.config.cssScaleX,t.params.dragAmount.y/=e.config.cssScaleY,this.keyHandler&&(this.keyHandler.isDown("alt")||this.keyHandler.isDown("spacebar"))){if(!this.config.enablePan)return;e.setOffset(e.draw.offset.clone().add(t.params.dragAmount)),e.redraw()}else for(var s in t.params.dragAmount.x/=e.draw.scale.x,t.params.dragAmount.y/=e.draw.scale.y,e.draggedElements){var r=e.draggedElements[s];if("bpath"==r.typeName)e.paths[r.pindex].moveCurvePoint(r.cindex,r.pid,new C.Vertex(t.params.dragAmount.x,t.params.dragAmount.y)),e.paths[r.pindex].bezierCurves[r.cindex].getPointByID(r.pid).listeners.fireDragEvent(t);else if("vertex"==r.typeName){if(!e.vertices[r.vindex].attr.draggable)continue;e.vertices[r.vindex].add(t.params.dragAmount),e.vertices[r.vindex].listeners.fireDragEvent(t)}}t.params.dragAmount.x=i.x,t.params.dragAmount.y=i.y,e.redraw()},t.prototype.mouseUpHandler=function(t){var e=this;if(0==t.button){for(var i in t.params.wasDragged||e.handleClick(t),e.draggedElements){var s=e.draggedElements[i];"bpath"==s.typeName?e.paths[s.pindex].bezierCurves[s.cindex].getPointByID(s.pid).listeners.fireDragEndEvent(t):"vertex"==s.typeName&&e.vertices[s.vindex].listeners.fireDragEndEvent(t)}e.draggedElements=[],e.redraw()}},t.prototype.mouseWheelHandler=function(t){if(this.config.enableZoom){var e=1.25,i=this,s=t;s.deltaY<0?i.setZoom(i.config.scaleX*e,i.config.scaleY*e,new C.Vertex(t.params.pos.x,t.params.pos.y)):s.deltaY>0&&i.setZoom(i.config.scaleX/e,i.config.scaleY/e,new C.Vertex(t.params.pos.x,t.params.pos.y)),t.preventDefault(),i.redraw()}},t.prototype.adjustOffset=function(t){this.draw.offset.x=this.fill.offset.x=this.config.offsetX=this.canvasSize.width*(this.config.offsetAdjustXPercent/100),this.draw.offset.y=this.fill.offset.y=this.config.offsetY=this.canvasSize.height*(this.config.offsetAdjustYPercent/100),t&&this.redraw()},t.prototype.setOffset=function(t){this.draw.offset.set(t),this.fill.offset.set(t),this.config.offsetX=t.x,this.config.offsetY=t.y},t.prototype.setZoom=function(t,e,i){var s=this.transformMousePosition(i.x,i.y);this.draw.scale.x=this.fill.scale.x=this.config.scaleX=Math.max(t,.01),this.draw.scale.y=this.fill.scale.y=this.config.scaleY=Math.max(e,.01);var r=this.transformMousePosition(i.x,i.y),n=this.draw.offset.x+(r.x-s.x)*this.draw.scale.x,o=this.draw.offset.y+(r.y-s.y)*this.draw.scale.y;this.setOffset({x:n,y:o})},t.prototype.installInputListeners=function(){var e=this,i=this;if(this.config.enableMouse?new y.MouseHandler(this.eventCatcher?this.eventCatcher:this.canvas).down(function(t){i.mouseDownHandler(t)}).drag(function(t){i.mouseDragHandler(t)}).up(function(t){i.mouseUpHandler(t)}):i.console.log("Mouse interaction disabled."),this.config.enableMouseWheel?new y.MouseHandler(this.eventCatcher?this.eventCatcher:this.canvas).wheel(function(t){i.mouseWheelHandler(t)}):i.console.log("Mouse wheel interaction disabled."),this.config.enableTouch){var s=function(t){var e=i.canvas.getBoundingClientRect();return{x:t.x-e.left,y:t.y-e.top}};if("function"==typeof globalThis.AlloyFinger||"function"==typeof globalThis.createAlloyFinger)try{var n=null,o=null,a=null,h=null,c=function(){n=null,o=null,a=null,h=null,i.draggedElements=[]},l={touchStart:function(e){if(1==e.touches.length&&(n=new C.Vertex(s({x:e.touches[0].clientX,y:e.touches[0].clientY})),o=new C.Vertex(s({x:e.touches[0].clientX,y:e.touches[0].clientY})),(a=i.locatePointNear(i.transformMousePosition(n.x,n.y),t.DEFAULT_TOUCH_TOLERANCE/Math.min(i.config.cssScaleX,i.config.cssScaleY)))&&"vertex"==a.typeName)){var r=i.vertices[a.vindex],h={params:{isTouchEvent:!0,dragAmount:{x:0,y:0},wasDragged:!1,mouseDownPos:o.clone(),mouseDragPos:o.clone(),vertex:r}};i.draggedElements=[a],r.listeners.fireDragStartEvent(h)}},touchMove:function(t){if(1==t.touches.length&&a){if(t.preventDefault(),t.stopPropagation(),!o||!n)return;var r=s({x:t.touches[0].clientX,y:t.touches[0].clientY}),h=i.transformMousePosition(r.x,r.y),c=new C.Vertex(i.transformMousePosition(n.x,n.y)).difference(h);if("vertex"==a.typeName){if(!i.vertices[a.vindex].attr.draggable)return;i.vertices[a.vindex].add(c);var l=i.vertices[a.vindex],u={isTouchEvent:!0,params:{dragAmount:c.clone(),wasDragged:!0,mouseDownPos:o.clone(),mouseDragPos:o.clone().add(c),vertex:l}};l.listeners.fireDragEvent(u),i.redraw()}n=new C.Vertex(r)}else if(2==t.touches.length){if(!e.config.enablePan)return;t.preventDefault(),t.stopPropagation(),i.setOffset(i.draw.offset.clone().addXY(t.deltaX,t.deltaY)),i.redraw()}},touchEnd:function(t){if(a&&"vertex"==a.typeName){if(!o)return;var e=i.vertices[a.vindex],s={isTouchEvent:!0,params:{dragAmount:{x:0,y:0},wasDragged:!1,mouseDownPos:o.clone(),mouseDragPos:o.clone(),vertex:e}};n&&o&&o.distance(n)<.001?e.listeners.fireClickEvent(s):e.listeners.fireDragEndEvent(s)}c()},touchCancel:function(t){c()},multipointStart:function(t){h=i.draw.scale.clone()},multipointEnd:function(t){h=null},pinch:function(t){if(e.config.enableZoom){var s=t.touches.item(0),r=t.touches.item(1);if(t.touches&&h&&s&&r){var n=new C.Vertex(s.clientX,s.clientY),o=new C.Vertex(r.clientX,r.clientY),a=new f.Line(n,o).vertAt(.5);i.setZoom(h.x*t.zoom,h.y*t.zoom,a),i.redraw()}}}};window.createAlloyFinger?(0,window.createAlloyFinger)(this.eventCatcher?this.eventCatcher:this.canvas,l):new r.default(this.eventCatcher?this.eventCatcher:this.canvas,l)}catch(t){console.error("Failed to initialize AlloyFinger!"),console.error(t)}else globalThis.Touchy&&"function"==typeof globalThis.Touchy?console.error("[Deprecation] Found Touchy which is not supported any more. Please use AlloyFinger instead."):console.warn("Cannot initialize the touch handler. AlloyFinger is missig. Did you include it?")}else i.console.log("Touch interaction disabled.");this.config.enableKeys?this.keyHandler=new p.KeyHandler({trackAll:!0}).down("escape",function(){i.clearSelection(!0)}).down("shift",function(){i.selectPolygon=new g.Polygon,i.redraw()}).up("shift",function(){null!=i.selectPolygon&&(i.selectVerticesInPolygon(i.selectPolygon),i.selectPolygon=null,i.redraw())}):i.console.log("Keyboard interaction disabled.")},t.prototype.createGUI=function(t){var e=globalThis.utils;if(e&&"function"==typeof e.createGUI)return this._gui=e.createGUI(this,t);throw"Cannot create dat.GUI or lil-gui instance; did you load the ./utils/creategui helper function an the dat.GUI/lil-gui library?"},t.prototype.getGUI=function(){return this._gui},t.DEFAULT_CANVAS_WIDTH=1024,t.DEFAULT_CANVAS_HEIGHT=768,t.DEFAULT_CLICK_TOLERANCE=8,t.DEFAULT_TOUCH_TOLERANCE=32,t.Draggable=(e=function(){function e(t,e){this.item=t,this.typeName=e}return e.prototype.isVertex=function(){return this.typeName==t.Draggable.VERTEX},e.prototype.setVIndex=function(t){return this.vindex=t,this},e}(),s(e,"Draggable"),e.VERTEX="vertex",e),t.utils={safeMergeByKeys:function(t,e){for(var i in e)if(e.hasOwnProperty(i))if(t.hasOwnProperty(i)){var s=typeof t[i],r=e[i];try{t[i]="boolean"==s?"string"==typeof r?Boolean(!!JSON.parse(r)):r:"number"==s&&"string"==typeof r?Number(1*JSON.parse(r)):e[i]}catch(t){console.error("error in key ",i,r,t)}}else t[i]=e[i];return t},setCSSscale:function(t,e,i){t.style.transformOrigin="0 0",1==e&&1==i?t.style.removeProperty("transform"):t.style.transform="scale("+e+","+i+")"},fetch:{val:function(t,e,i){return t.hasOwnProperty(e)?void 0===t[e]?i:t[e]:i},num:function(t,e,i){if(!t.hasOwnProperty(e))return i;if("number"==typeof t[e])return t[e];try{return 1*JSON.parse(t[e])}catch(t){return i}},bool:function(t,e,i){if(!t.hasOwnProperty(e))return i;if("boolean"==typeof t[e])return t[e];try{return!!JSON.parse(t[e])}catch(t){return i}},func:function(t,e,i){return t.hasOwnProperty(e)?"function"!=typeof t[e]?i:t[e]:i}},enableBezierPathAutoAdjust:function(t){for(var e=0;e<t.bezierCurves.length;e++)t.bezierCurves[e].startPoint.listeners.addDragListener(function(e){var i=t.locateCurveByStartPoint(e.params.vertex);t.bezierCurves[i].startPoint.addXY(-e.params.dragAmount.x,-e.params.dragAmount.y),t.moveCurvePoint(1*i,t.START_POINT,e.params.dragAmount),t.updateArcLengths()}),t.bezierCurves[e].startControlPoint.listeners.addDragListener(function(e){var i=t.locateCurveByStartControlPoint(e.params.vertex);t.bezierCurves[i].startPoint.attr.bezierAutoAdjust&&(t.adjustPredecessorControlPoint(1*i,!0,!1),t.updateArcLengths())}),t.bezierCurves[e].endControlPoint.listeners.addDragListener(function(e){var i=t.locateCurveByEndControlPoint(e.params.vertex);t.bezierCurves[i%t.bezierCurves.length].endPoint.attr.bezierAutoAdjust&&(t.adjustSuccessorControlPoint(1*i,!0,!1),t.updateArcLengths())}),e+1==t.bezierCurves.length&&t.bezierCurves[t.bezierCurves.length-1].endPoint.listeners.addDragListener(function(e){if(!t.adjustCircular){var i=t.locateCurveByEndPoint(e.params.vertex);t.moveCurvePoint(1*i,t.END_CONTROL_POINT,new C.Vertex({x:e.params.dragAmount.x,y:e.params.dragAmount.y}))}t.updateArcLengths()})}},t}();e.PlotBoilerplate=T,e.default=T},590:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VertTuple=void 0;var s=i(787),r=i(938),n=function(){function t(t,e,i){this.uid=r.UIDGenerator.next(),this.a=t,this.b=e,this.factory=i}return t.prototype.length=function(){return Math.sqrt(Math.pow(this.b.x-this.a.x,2)+Math.pow(this.b.y-this.a.y,2))},t.prototype.setLength=function(t){return this.scale(t/this.length())},t.prototype.sub=function(t){return this.a.sub(t),this.b.sub(t),this},t.prototype.add=function(t){return this.a.add(t),this.b.add(t),this},t.prototype.revert=function(){var t=this.a;return this.a=this.b,this.b=t,this},t.prototype.normalize=function(){return this.b.set(this.a.x+(this.b.x-this.a.x)/this.length(),this.a.y+(this.b.y-this.a.y)/this.length()),this},t.prototype.scale=function(t){return this.b.set(this.a.x+(this.b.x-this.a.x)*t,this.a.y+(this.b.y-this.a.y)*t),this},t.prototype.moveTo=function(t){var e=this.a.difference(t);return this.a.add(e),this.b.add(e),this},t.prototype.move=function(t){return this.a.add(t),this.b.add(t),this},t.prototype.angle=function(t){null!=t&&void 0!==t||(t=this.factory(new s.Vertex(0,0),new s.Vertex(100,0)));var e=this.b.clone().sub(this.a),i=t.b.clone().sub(t.a);return Math.atan2(i.x,i.y)-Math.atan2(e.x,e.y)},t.prototype.vertAt=function(t){return new s.Vertex(this.a.x+(this.b.x-this.a.x)*t,this.a.y+(this.b.y-this.a.y)*t)},t.prototype.denominator=function(t){return(t.b.y-t.a.y)*(this.b.x-this.a.x)-(t.b.x-t.a.x)*(this.b.y-this.a.y)},t.prototype.colinear=function(t,e){return Math.abs(this.denominator(t))<(void 0===e?s.Vertex.EPSILON:e)},t.prototype.getClosestT=function(e){var i=t.vtutils.dist2(this.a,this.b);return 0===i?0:((e.x-this.a.x)*(this.b.x-this.a.x)+(e.y-this.a.y)*(this.b.y-this.a.y))/i},t.prototype.hasPoint=function(e,i,r){var n=this.getClosestT(e),o=Math.sqrt(t.vtutils.dist2(e,this.vertAt(n)));return void 0!==i&&i?o<(null!=r?r:s.Vertex.EPSILON)&&n>=0&&n<=1:o<(null!=r?r:s.Vertex.EPSILON)},t.prototype.getClosestPoint=function(t){var e=this.getClosestT(t);return this.vertAt(e)},t.prototype.pointDistance=function(e){return Math.sqrt(t.vtutils.dist2(e,this.vertAt(this.getClosestT(e))))},t.prototype.clone=function(){return this.factory(this.a.clone(),this.b.clone())},t.prototype.toString=function(){return"{ a : "+this.a.toString()+", b : "+this.b.toString()+" }"},t.prototype.destroy=function(){this.a.destroy(),this.b.destroy(),this.isDestroyed=!0},t.vtutils={dist2:function(t,e){return(t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y)}},t}();e.VertTuple=n},597:(t,e,i)=>{i.r(e),i.d(e,{AlloyFinger:()=>o,default:()=>a});const s=t=>Math.sqrt(t.x*t.x+t.y*t.y);class r{constructor(t){this.handlers=[],this.el=t}add(t){this.handlers.push(t)}del(t){t||(this.handlers=[]);for(var e=this.handlers.length;e>=0;e--)this.handlers[e]===t&&this.handlers.splice(e,1)}dispatch(...t){for(var e=0,i=this.handlers.length;e<i;e++){const t=this.handlers[e];"function"==typeof t&&t.apply(this.el,arguments)}}}const n=(t,e)=>{const i=new r(t);return i.add(e),i};class o{constructor(t,e){this.element="string"==typeof t?document.querySelector(t):t,this.start=this.start.bind(this),this.move=this.move.bind(this),this.end=this.end.bind(this),this.cancel=this.cancel.bind(this),this.element.addEventListener("touchstart",this.start,!1),this.element.addEventListener("touchmove",this.move,!1),this.element.addEventListener("touchend",this.end,!1),this.element.addEventListener("touchcancel",this.cancel,!1),this.preV={x:null,y:null},this.pinchStartLen=null,this.zoom=1,this.isDoubleTap=!1;const i=()=>{};this.rotate=n(this.element,e.rotate||i),this.touchStart=n(this.element,e.touchStart||i),this.multipointStart=n(this.element,e.multipointStart||i),this.multipointEnd=n(this.element,e.multipointEnd||i),this.pinch=n(this.element,e.pinch||i),this.swipe=n(this.element,e.swipe||i),this.tap=n(this.element,e.tap||i),this.doubleTap=n(this.element,e.doubleTap||i),this.longTap=n(this.element,e.longTap||i),this.singleTap=n(this.element,e.singleTap||i),this.pressMove=n(this.element,e.pressMove||i),this.twoFingerPressMove=n(this.element,e.twoFingerPressMove||i),this.touchMove=n(this.element,e.touchMove||i),this.touchEnd=n(this.element,e.touchEnd||i),this.touchCancel=n(this.element,e.touchCancel||i),this._cancelAllHandler=this.cancelAll.bind(this),globalThis&&"function"==typeof globalThis.addEventListener&&globalThis.addEventListener("scroll",this._cancelAllHandler),this.delta=null,this.last=null,this.now=null,this.tapTimeout=null,this.singleTapTimeout=null,this.longTapTimeout=null,this.swipeTimeout=null,this.x1=this.x2=this.y1=this.y2=null,this.preTapPosition={x:null,y:null}}start(t){if(!t.touches)return;const e=this;this.now=Date.now(),this.x1=t.touches[0].pageX,this.y1=t.touches[0].pageY,this.delta=this.now-(this.last||this.now),this.touchStart.dispatch(t,this.element),null!==this.preTapPosition.x&&(this.isDoubleTap=this.delta>0&&this.delta<=250&&Math.abs(this.preTapPosition.x-this.x1)<30&&Math.abs(this.preTapPosition.y-this.y1)<30,this.isDoubleTap&&clearTimeout(this.singleTapTimeout)),this.preTapPosition.x=this.x1,this.preTapPosition.y=this.y1,this.last=this.now;const i=this.preV;if(t.touches.length>1){this._cancelLongTap(),this._cancelSingleTap();const e={x:t.touches[1].pageX-this.x1,y:t.touches[1].pageY-this.y1};i.x=e.x,i.y=e.y,this.pinchStartLen=s(i),this.multipointStart.dispatch(t,this.element)}this._preventTap=!1,this.longTapTimeout=setTimeout((()=>{e.longTap.dispatch(t,e.element),e._preventTap=!0}).bind(e),750)}move(t){if(!t.touches)return;const e=t,i=this.preV,r=t.touches.length,n=t.touches[0].pageX,o=t.touches[0].pageY;if(this.isDoubleTap=!1,r>1){const t=e.touches[1].pageX,r=e.touches[1].pageY,l={x:e.touches[1].pageX-n,y:e.touches[1].pageY-o};null!==i.x&&(this.pinchStartLen>0&&(e.zoom=s(l)/this.pinchStartLen,this.pinch.dispatch(e,this.element)),e.angle=(c=((t,e)=>{const i=s(t)*s(e);if(0===i)return 0;var r=((t,e)=>t.x*e.x+t.y*e.y)(t,e)/i;return r>1&&(r=1),Math.acos(r)})(a=l,h=i),((t,e)=>t.x*e.y-e.x*t.y)(a,h)>0&&(c*=-1),180*c/Math.PI),this.rotate.dispatch(e,this.element)),i.x=l.x,i.y=l.y,null!==this.x2&&null!==this.sx2?(e.deltaX=(n-this.x2+t-this.sx2)/2,e.deltaY=(o-this.y2+r-this.sy2)/2):(e.deltaX=0,e.deltaY=0),this.twoFingerPressMove.dispatch(e,this.element),this.sx2=t,this.sy2=r}else{if(null!==this.x2){e.deltaX=n-this.x2,e.deltaY=o-this.y2;const t=Math.abs(this.x1-this.x2),i=Math.abs(this.y1-this.y2);(t>10||i>10)&&(this._preventTap=!0)}else e.deltaX=0,e.deltaY=0;this.pressMove.dispatch(e,this.element)}var a,h,c;this.touchMove.dispatch(e,this.element),this._cancelLongTap(),this.x2=n,this.y2=o,r>1&&t.preventDefault()}end(t){if(!t.changedTouches)return;const e=t;this._cancelLongTap();const i=this;e.touches.length<2&&(this.multipointEnd.dispatch(e,this.element),this.sx2=this.sy2=null),this.x2&&Math.abs(this.x1-this.x2)>30||this.y2&&Math.abs(this.y1-this.y2)>30?(e.direction=this._swipeDirection(this.x1,this.x2,this.y1,this.y2),this.swipeTimeout=setTimeout(function(){i.swipe.dispatch(e,i.element)},0)):(this.tapTimeout=setTimeout(function(){i._preventTap||i.tap.dispatch(e,i.element),i.isDoubleTap&&(i.doubleTap.dispatch(e,i.element),i.isDoubleTap=!1)},0),i.isDoubleTap||(i.singleTapTimeout=setTimeout(function(){i.singleTap.dispatch(e,i.element)},250))),this.touchEnd.dispatch(e,this.element),this.preV.x=0,this.preV.y=0,this.zoom=1,this.pinchStartLen=null,this.x1=this.x2=this.y1=this.y2=null}cancelAll(){this._preventTap=!0,clearTimeout(this.singleTapTimeout),clearTimeout(this.tapTimeout),clearTimeout(this.longTapTimeout),clearTimeout(this.swipeTimeout)}cancel(t){this.cancelAll(),this.touchCancel.dispatch(t,this.element)}_cancelLongTap(){clearTimeout(this.longTapTimeout)}_cancelSingleTap(){clearTimeout(this.singleTapTimeout)}_swipeDirection(t,e,i,s){return Math.abs(t-e)>=Math.abs(i-s)?t-e>0?"Left":"Right":i-s>0?"Up":"Down"}on(t,e){this[t]&&this[t].add(e)}off(t,e){this[t]&&this[t].del(e)}destroy(){this.singleTapTimeout&&clearTimeout(this.singleTapTimeout),this.tapTimeout&&clearTimeout(this.tapTimeout),this.longTapTimeout&&clearTimeout(this.longTapTimeout),this.swipeTimeout&&clearTimeout(this.swipeTimeout),this.element.removeEventListener("touchstart",this.start),this.element.removeEventListener("touchmove",this.move),this.element.removeEventListener("touchend",this.end),this.element.removeEventListener("touchcancel",this.cancel),this.rotate.del(),this.touchStart.del(),this.multipointStart.del(),this.multipointEnd.del(),this.pinch.del(),this.swipe.del(),this.tap.del(),this.doubleTap.del(),this.longTap.del(),this.singleTap.del(),this.pressMove.del(),this.twoFingerPressMove.del(),this.touchMove.del(),this.touchEnd.del(),this.touchCancel.del(),this.preV=this.pinchStartLen=this.zoom=this.isDoubleTap=this.delta=this.last=this.now=this.tapTimeout=this.singleTapTimeout=this.longTapTimeout=this.swipeTimeout=this.x1=this.x2=this.y1=this.y2=this.preTapPosition=this.rotate=this.touchStart=this.multipointStart=this.multipointEnd=this.pinch=this.swipe=this.tap=this.doubleTap=this.longTap=this.singleTap=this.pressMove=this.touchMove=this.touchEnd=this.touchCancel=this.twoFingerPressMove=null,globalThis&&"function"==typeof globalThis.removeEventListener&&globalThis.removeEventListener("scroll",this._cancelAllHandler)}}const a=o},628:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PBText=void 0;var s=i(938),r=i(787),n=function(){function t(t,e,i){this.className="PBText",this.uid=s.UIDGenerator.next(),this.text=t,this.anchor=null!=e?e:new r.Vertex,this.color=null==i?void 0:i.color,this.fontFamily=null==i?void 0:i.fontFamily,this.fontSize=null==i?void 0:i.fontSize,this.fontStyle=null==i?void 0:i.fontStyle,this.fontWeight=null==i?void 0:i.fontWeight,this.lineHeight=null==i?void 0:i.lineHeight,this.textAlign=null==i?void 0:i.textAlign,this.rotation=null==i?void 0:i.rotation}return t.prototype.destroy=function(){this.anchor.destroy(),this.isDestroyed=!0},t}();e.PBText=n},687:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Polygon=void 0;var s=i(733),r=i(76),n=i(939),o=i(737),a=i(938),h=i(30),c=i(787),l=i(328),u=function(){function t(t,e){this.className="Polygon",this.uid=a.UIDGenerator.next(),void 0===t&&(t=[]),this.vertices=t,this.isOpen=e||!1}return t.prototype.addVertex=function(t){this.vertices.push(t)},t.prototype.addVertexAt=function(t,e){this.vertices.splice(e,0,t)},t.prototype.getEdgeAt=function(t){return new n.Line(this.getVertexAt(t),this.getVertexAt(t+1))},t.prototype.getEdges=function(){for(var t=[],e=0;e+1<this.vertices.length;e++)t.push(this.getEdgeAt(e));return!this.isOpen&&this.vertices.length>0&&t.push(this.getEdgeAt(this.vertices.length-1)),t},t.prototype.getInnerAngleAt=function(t){var e=this.vertices[t%this.vertices.length],i=this.vertices[(t+this.vertices.length-1)%this.vertices.length].clone(),s=this.vertices[(t+1)%this.vertices.length].clone(),r=this.isAngleAcute(t),n=new c.Vertex(0,0),o=new c.Vertex(e.x-i.x,e.y-i.y),a=new c.Vertex(s.x-e.x,s.y-e.y),h=n.distance(o),u=n.distance(a),d=l.geomutils.dotProduct(o,a),p=h*u;return r?Math.PI-Math.acos(d/p):Math.PI+Math.acos(d/p)},t.prototype.isAngleAcute=function(t){var e=this.vertices[(t+this.vertices.length-1)%this.vertices.length].clone(),i=this.vertices[t%this.vertices.length],s=this.vertices[(t+1)%this.vertices.length].clone();return o.Triangle.utils.determinant(e,i,s)<0},t.prototype.getVertexAt=function(t){return t<0?this.vertices[this.vertices.length-Math.abs(t)%this.vertices.length]:this.vertices[t%this.vertices.length]},t.prototype.move=function(t){for(var e in this.vertices)this.vertices[e].add(t);return this},t.prototype.containsVert=function(t){for(var e=!1,i=0,s=this.vertices.length-1;i<this.vertices.length;s=i++){var r=this.vertices[i].x,n=this.vertices[i].y,o=this.vertices[s].x,a=this.vertices[s].y;n>t.y!=a>t.y&&t.x<(o-r)*(t.y-n)/(a-n)+r&&(e=!e)}return e},t.prototype.containsVerts=function(t){var e=this;return t.every(function(t){return e.containsVert(t)})},t.prototype.containsPolygon=function(t){for(var e=0;e<t.vertices.length;e++)if(!this.containsVert(t.vertices[e]))return!1;var i=new n.Line(new c.Vertex,new c.Vertex);for(e=0;e<t.vertices.length;e++)if(i.a.set(t.vertices[e]),i.b.set(t.vertices[(e+1)%t.vertices.length]),this.lineIntersections(i,!0).length>0)return!1;return!0},t.prototype.area=function(){return t.utils.area(this.vertices)},t.prototype.signedArea=function(){return t.utils.signedArea(this.vertices)},t.prototype.isClockwise=function(){return t.utils.isClockwise(this.vertices)},t.prototype.perimeter=function(){for(var t=0,e=1;e<this.vertices.length;e++)t+=this.vertices[e-1].distance(this.vertices[e]);return!this.isOpen&&this.vertices.length>1&&(t+=this.vertices[0].distance(this.vertices[this.vertices.length-1])),t},t.prototype.scale=function(t,e){for(var i in this.vertices)"function"==typeof this.vertices[i].scale?this.vertices[i].scale(t,e):console.log("There seems to be a null vertex!",this.vertices[i]);return this},t.prototype.rotate=function(t,e){for(var i in this.vertices)this.vertices[i].rotate(t,e);return this},t.prototype.getMeanCenter=function(){if(0===this.vertices.length)return null;for(var t=this.vertices[0].clone(),e=1;e<this.vertices.length;e++)t.add(this.vertices[e]);return t.x/=this.vertices.length,t.y/=this.vertices.length,t},t.prototype.getCentroid=function(){if(0===this.vertices.length)return null;for(var t=new c.Vertex(0,0),e=this.vertices.length,i=0;i<e;i++){var s=this.vertices[i],r=this.vertices[(i+1)%e],n=s.x*r.y-r.x*s.y;t.x+=(s.x+r.x)*n,t.y+=(s.y+r.y)*n}var o=this.area();return t.x*=1/(6*o),t.y*=1/(6*o),t},t.prototype.lineIntersections=function(e,i){return void 0===i&&(i=!1),t.utils.locateLineIntersecion(e,this.vertices,this.isOpen,i).map(function(t){return t.intersection})},t.prototype.lineIntersectionTangents=function(e,i){var s=this;return void 0===i&&(i=!1),t.utils.locateLineIntersecion(e,this.vertices,this.isOpen,i).map(function(t){var e=s.getEdgeAt(t.edgeIndex);return new h.Vector(e.a.clone(),e.b.clone()).moveTo(t.intersection)})},t.prototype.lineIntersectionTangentsIndices=function(e,i){var s=this;return void 0===i&&(i=!1),t.utils.locateLineIntersecion(e,this.vertices,this.isOpen,i).map(function(t){var e=s.getEdgeAt(t.edgeIndex);return{intersection:new h.Vector(e.a.clone(),e.b.clone()).moveTo(t.intersection),edgeIndex:t.edgeIndex}})},t.prototype.closestLineIntersection=function(t,e){void 0===e&&(e=!1);var i=this.closestLineIntersectionIndex(t,e);return i?i.intersection:null},t.prototype.closestLineIntersectionIndex=function(t,e){void 0===e&&(e=!1);var i=this.lineIntersections(t,e);if(i.length<=0)return null;for(var s=new c.Vertex(Number.MAX_VALUE,Number.MAX_VALUE),r=-1,n=Number.MAX_VALUE,o=0;o<i.length;o++){var a=i[o],h=a.distance(t.a);h<n&&(n=h,s=a,r=o)}return{edgeIndex:r,intersection:s}},t.prototype.getInterpolationPolygon=function(e){for(var i=[],s=0;s<this.vertices.length;s++){var r=this.vertices[s],n=this.vertices[(s+1)%this.vertices.length];if(i.push(r.clone()),!this.isOpen||s+1!==this.vertices.length)for(var o=1/(e+1),a=1;a<=e;a++)i.push(r.clone().lerp(n,o*a))}return new t(i,this.isOpen)},t.prototype.getEvenDistributionPolygon=function(e){if(e<=0)throw new Error("pointCount must be larger than zero; is "+e+".");var i=new t([],this.isOpen);if(0===this.vertices.length)return i;var s=new c.Vertex(this.vertices[0]);if(i.vertices.push(s),1===this.vertices.length)return i;for(var r=this.perimeter()/e,n=this.vertices.length,o=1,a=new c.Vertex(this.vertices[1]),h=s.distance(a),l=this.isOpen?n:n+1,u=r,d=1;d<e&&o<l;)if(u<h){var p=s.clone().lerpAbs(a,u);i.vertices.push(p),u+=r,d++}else o++,s=a,a=new c.Vertex(this.vertices[o%n]),u-=h,h=s.distance(a);return i},t.prototype.getBounds=function(){return r.Bounds.computeFromVertices(this.vertices)},t.prototype.clone=function(){return new t(this.vertices.map(function(t){return t.clone()}),this.isOpen)},t.prototype.elimitateColinearEdges=function(e){for(var i=void 0===e?1:e,s=this.vertices.slice(),r=0,o=new n.Line(new c.Vertex,new c.Vertex),a=new n.Line(new c.Vertex,new c.Vertex);r+1<s.length&&s.length>2;){var h=s[r],l=s[(r+1)%s.length];o.a=h,o.b=l,a.a=l;var u=!1,d=r+2;do{var p=s[d%s.length];a.b=p,(u=o.colinear(a,i))&&d++}while(u);d-r>2&&s.splice(r+1,d-r-2),r++}return new t(s,this.isOpen)},t.prototype.toQuadraticBezierData=function(){if(this.vertices.length<3)return[];var t=[],e=this.vertices[0],i=this.vertices[1],s=new c.Vertex(e.x+(i.x-e.x)/2,e.y+(i.y-e.y)/2);t.push(s);for(var r=this.isOpen?this.vertices.length:this.vertices.length+1,n=1;n<r;n++)e=this.vertices[n%this.vertices.length],i=this.vertices[(n+1)%this.vertices.length],s=new c.Vertex(e.x+(i.x-e.x)/2,e.y+(i.y-e.y)/2),t.push(e),t.push(s),e=i;return t},t.prototype.toQuadraticBezierSVGString=function(){var t=this.toQuadraticBezierData();if(0==t.length)return"";for(var e=["M "+t[0].x+" "+t[0].y],i=1;i<t.length;i+=2)e.push("Q "+t[i].x+" "+t[i].y+", "+t[i+1].x+" "+t[i+1].y);return e.join(" ")},t.prototype.toCubicBezierData=function(t){if(void 0===t&&(t=1),this.vertices.length<3)return[];var e=[],i=this.vertices[0],s=this.vertices[1],r=new c.Vertex(i.x+(s.x-i.x)/2,i.y+(s.y-i.y)/2);e.push(r);for(var n=this.isOpen?this.vertices.length-1:this.vertices.length,o=0;o<n;o++){i=this.vertices[o%this.vertices.length],s=this.vertices[(o+1)%this.vertices.length];var a=this.vertices[(o+2)%this.vertices.length],h=new c.Vertex(i.x+(s.x-i.x)/2,i.y+(s.y-i.y)/2),l=new c.Vertex(s.x+(a.x-s.x)/2,s.y+(a.y-s.y)/2),u=new c.Vertex(h.x+(s.x-h.x)*t,h.y+(s.y-h.y)*t),d=new c.Vertex(l.x+(s.x-l.x)*t,l.y+(s.y-l.y)*t);e.push(u),e.push(d),e.push(l)}return e},t.prototype.toCubicBezierSVGString=function(t){var e=this.toCubicBezierData(t);if(0==e.length)return"";for(var i=["M "+e[0].x+" "+e[0].y],s=1;s<e.length;s+=3)i.push("C "+e[s].x+" "+e[s].y+", "+e[s+1].x+" "+e[s+1].y+", "+e[s+2].x+" "+e[s+2].y);return i.join(" ")},t.prototype.toCubicBezierPath=function(t){for(var e=this.toCubicBezierData(t),i=[],r=0;r+3<e.length;r+=3)i.push([e[r],e[r+3],e[r+1],e[r+2]]);return s.BezierPath.fromArray(i)},t.prototype.destroy=function(){for(var t=0;t<this.vertices.length;t++)this.vertices[t].destroy();this.isDestroyed=!0},t.utils={area:function(t){for(var e=0,i=0,s=t.length;i<s;i++)e+=t[i].x*t[(i+1)%s].y*.5,e-=t[(i+1)%s].x*t[i].y*.5;return Math.abs(e)},isClockwise:function(e){return t.utils.signedArea(e)<0},signedArea:function(t){for(var e=0,i=t.length,s=0;s<i;s++){var r=(s+1)%i;e+=(t[r].x-t[s].x)*(t[s].y+t[r].y)}return e},locateLineIntersecion:function(t,e,i,s){for(var r=[],o=i?e.length-1:e.length,a=0;a<o;a++){var h=new n.Line(e[a%o],e[(a+1)%o]),c=h.intersection(t);null===c||!h.hasPoint(c,!0)||s&&!t.hasPoint(c,s)||r.push({edgeIndex:a,intersection:c})}return r}},t}();e.Polygon=u},719:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VEllipseSector=void 0;var s=i(76),r=i(973),n=i(328),o=i(939),a=i(938),h=i(881),c=i(787),l=function(){function t(t,e,i){this.className="VEllipseSector",this.uid=a.UIDGenerator.next(),this.ellipse=t,this.startAngle=n.geomutils.wrapMinMax(e,0,2*Math.PI),this.endAngle=n.geomutils.wrapMinMax(i,0,2*Math.PI)}return t.prototype.move=function(t){return this.ellipse.move(t),this},t.prototype.containsAngle=function(t){t=n.geomutils.mapAngleTo2PI(t);var e=n.geomutils.mapAngleTo2PI(this.startAngle),i=n.geomutils.mapAngleTo2PI(this.endAngle);return e<=i?t>=e&&t<i:t>=e||t<i},t.prototype.getStartPoint=function(){return this.ellipse.vertAt(this.startAngle)},t.prototype.getEndPoint=function(){return this.ellipse.vertAt(this.endAngle)},t.prototype.getBounds=function(){var t=this,e=this.ellipse.getExtremePoints().filter(function(e){var i=new o.Line(t.ellipse.center,e).angle()-t.ellipse.rotation;return t.containsAngle(i)});return s.Bounds.computeFromVertices([this.getStartPoint(),this.getEndPoint()].concat(e))},t.prototype.lineIntersections=function(t,e){var i=this;void 0===e&&(e=!1);var s=this.ellipse.lineIntersections(t,e),r=new o.Line(this.ellipse.center,new c.Vertex);return s.filter(function(t){r.b.set(t);var e=r.angle();return i.containsAngle(e-i.ellipse.rotation)})},t.prototype.lineIntersectionTangents=function(t,e){var i=this;return void 0===e&&(e=!1),this.lineIntersections(t,e).map(function(t){var e=new o.Line(i.ellipse.center,t).angle();return i.ellipse.tangentAt(e)})},t.prototype.toCubicBezier=function(e,i){var s=4*Math.max(1,e||3);i=void 0===i?.666666:i;for(var n=this.ellipse.radiusH(),o=this.ellipse.radiusV(),a=t.ellipseSectorUtils.normalizeAngle(this.startAngle),h=t.ellipseSectorUtils.normalizeAngle(this.endAngle),c=t.ellipseSectorUtils.equidistantVertAngles(n,o,a,h,s),l=[],u=(c=[a].concat(c).concat([h]))[0],d=this.ellipse.vertAt(u),p=0;p+1<c.length;p++){var f=c[(p+1)%c.length],y=this.ellipse.vertAt(f),v=this.ellipse.tangentAt(u+this.ellipse.rotation),g=this.ellipse.tangentAt(f+this.ellipse.rotation);if(Math.abs(o)<1e-4||Math.abs(n)<1e-4){var x=d.difference(y),m=new r.CubicBezierCurve(d.clone(),y.clone(),d.clone().addXY(.333*x.x,.333*x.y),y.clone().addXY(.333*-x.x,.333*-x.y));l.push(m)}else{var b=v.intersection(g);if(b){var w=d.difference(b),C=y.difference(b);m=new r.CubicBezierCurve(d.clone(),y.clone(),d.clone().add(w.scale(i)),y.clone().add(C.scale(i))),l.push(m)}}d=y,u=f}return l},t.prototype.destroy=function(){this.ellipse.destroy(),this.isDestroyed=!0},t.ellipseSectorUtils={describeSVGArc:function(t,e,i,s,r,o,a,l){void 0===l&&(l={moveToStart:!0}),void 0===a&&(a=0),r=n.geomutils.wrapMax(r,2*Math.PI),o=n.geomutils.wrapMax(o,2*Math.PI);var u=new c.Vertex(h.VEllipse.utils.polarToCartesian(t,e,i,s,o)),d=new c.Vertex(h.VEllipse.utils.polarToCartesian(t,e,i,s,r));u.rotate(a,{x:t,y:e}),d.rotate(a,{x:t,y:e});var p,f=o-r;p=f<0?Math.abs(f)<Math.PI?1:0:Math.abs(f)>Math.PI?1:0;var y=[];l.moveToStart&&y.push("M",d.x,d.y);var v=180/Math.PI;return y.push("A",i,s,a*v,p,1,u.x,u.y),y},equidistantVertAngles:function(e,i,s,r,n){var o=h.VEllipse.utils.equidistantVertAngles(e,i,n);o=(o=o.map(function(e){return t.ellipseSectorUtils.normalizeAngle(e)})).filter(function(t){return s<r?t>=s&&t<=r:t>=s||t<=r&&t>=0});for(var a=t.ellipseSectorUtils.findClosestToStartAngle(s,r,o),c=[],l=0;l<o.length;l++)c.push(o[(a+l)%o.length]);return c},findClosestToStartAngle:function(t,e,i){if(t>e)for(var s=i.length,r=0;r<s;r++){var o=n.geomutils.wrapMinMax(i[r],0,2*Math.PI);if(o>=t&&o>=e)return r}return 0},normalizeAngle:function(t){return t<0?2*Math.PI+t:t},endpointToCenterParameters:function(e,i,s,r,n,a,l,u,d){var p=Math.abs,f=Math.sin,y=Math.cos,v=Math.sqrt,g=function(t){return t*t},x=f(n),m=y(n),b=m*(e-u)/2+x*(i-d)/2,w=-x*(e-u)/2+m*(i-d)/2,C=g(b),P=g(w),A=g(s),T=g(r),S=C/A+P/T;S>1?(s=v(S)*p(s),r=v(S)*p(r)):(s=p(s),r=p(r));var _=a===l?-1:1,M=v(Math.abs((A*T-A*P-T*C)/(A*P+T*C)))*_,N=M*(s*w)/r,z=M*(-r*b)/s,L=m*N-x*z+(e+u)/2,V=x*N+m*z+(i+d)/2,D=new c.Vertex(L,V),E=D.clone().addXY(s,r),I=new h.VEllipse(D,E,0);return I.rotate(n),new t(I,new o.Line(I.center,new c.Vertex(e,i)).angle()-n,new o.Line(I.center,new c.Vertex(u,d)).angle()-n)}},t}();e.VEllipseSector=l},733:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BezierPath=void 0;var s=i(76),r=i(973),n=i(938),o=i(787),a=function(){function t(){this.className="BezierPath",this.START_POINT=0,this.START_CONTROL_POINT=1,this.END_CONTROL_POINT=2,this.END_POINT=3,this.uid=n.UIDGenerator.next(),this.totalArcLength=0,this.adjustCircular=!1,this.bezierCurves=[]}return t.prototype.addCurve=function(t){if(null==t||void 0===t)throw"Cannot add null curve to bézier path.";this.bezierCurves.push(t),this.bezierCurves.length>1?(t.startPoint=this.bezierCurves[this.bezierCurves.length-2].endPoint,this.adjustSuccessorControlPoint(this.bezierCurves.length-2,!0,!0)):this.totalArcLength+=t.getLength()},t.prototype.locateCurveByStartPoint=function(t){for(var e=0;e<this.bezierCurves.length;e++)if(this.bezierCurves[e].startPoint.equals(t))return e;return-1},t.prototype.locateCurveByEndPoint=function(t){for(var e=0;e<this.bezierCurves.length;e++)if(this.bezierCurves[e].endPoint.equals(t))return e;return-1},t.prototype.locateCurveByStartControlPoint=function(t){for(var e=0;e<this.bezierCurves.length;e++)if(this.bezierCurves[e].startControlPoint.equals(t))return e;return-1},t.prototype.locateCurveByEndControlPoint=function(t){for(var e=0;e<this.bezierCurves.length;e++)if(this.bezierCurves[e].endControlPoint.equals(t))return e;return-1},t.prototype.getLength=function(){return this.totalArcLength},t.prototype.updateArcLengths=function(){this.totalArcLength=0;for(var t=0;t<this.bezierCurves.length;t++)this.bezierCurves[t].updateArcLengths(),this.totalArcLength+=this.bezierCurves[t].getLength()},t.prototype.getCurveCount=function(){return this.bezierCurves.length},t.prototype.getCurveAt=function(t){return this.bezierCurves[t]},t.prototype.translate=function(t){for(var e=0;e<this.bezierCurves.length;e++)(i=this.bezierCurves[e]).getStartPoint().add(t),i.getStartControlPoint().add(t),i.getEndControlPoint().add(t);var i;return(i=this.bezierCurves[this.bezierCurves.length-1]).getEndPoint().add(t),this.updateArcLengths(),this},t.prototype.move=function(t){return this.translate(t)},t.prototype.scale=function(t,e){return this.scaleXY({x:e,y:e},t)},t.prototype.scaleXY=function(t,e){for(var i=0;i<this.bezierCurves.length;i++){var s=this.bezierCurves[i];s.getStartPoint().scaleXY(t,e),s.getStartControlPoint().scaleXY(t,e),s.getEndControlPoint().scaleXY(t,e)}return this.bezierCurves.length>0&&!this.adjustCircular&&this.bezierCurves[this.bezierCurves.length-1].getEndPoint().scaleXY(t,e),this.updateArcLengths(),this},t.prototype.rotate=function(t,e){for(var i=0;i<this.bezierCurves.length;i++){var s=this.bezierCurves[i];s.getStartPoint().rotate(t,e),s.getStartControlPoint().rotate(t,e),s.getEndControlPoint().rotate(t,e)}this.bezierCurves.length>0&&!this.adjustCircular&&this.bezierCurves[this.bezierCurves.length-1].getEndPoint().rotate(t,e)},t.prototype.getClosestT=function(t){for(var e=-1,i=0,s=0,r=0,n=0,o=0,a=0;a<this.bezierCurves.length;a++)r=this.bezierCurves[a].getClosestT(t),s=this.bezierCurves[a].getPointAt(r).distance(t),(-1==e||s<i)&&(e=a,i=s,n=o+r*this.bezierCurves[a].getLength()),o+=this.bezierCurves[a].getLength();return Math.max(0,Math.min(1,n/this.totalArcLength))},t.prototype.getPoint=function(t){(t<0||t>this.totalArcLength)&&(console.warn("[BezierPath.getPoint(u)] u is out of bounds: "+t+"."),t=Math.min(this.totalArcLength,Math.max(t,0)));for(var e=0,i=0;e<this.bezierCurves.length&&i+this.bezierCurves[e].getLength()<t;)i+=this.bezierCurves[e].getLength(),e++;if(e>=this.bezierCurves.length)return this.bezierCurves[this.bezierCurves.length-1].getEndPoint().clone();var s=t-i;return this.bezierCurves[e].getPoint(s)},t.prototype.getPointAt=function(t){return this.getPoint(t*this.totalArcLength)},t.prototype.getTangentAt=function(t){return this.getTangent(t*this.totalArcLength)},t.prototype.getTangent=function(t){(t<0||t>this.totalArcLength)&&(console.warn("[BezierPath.getTangent(u)] u is out of bounds: "+t+"."),t=Math.min(this.totalArcLength,Math.max(0,t)));for(var e=0,i=0;e<this.bezierCurves.length&&i+this.bezierCurves[e].getLength()<t;)i+=this.bezierCurves[e].getLength(),e++;var s=t-i;return this.bezierCurves[e].getTangent(s)},t.prototype.getPerpendicularAt=function(t){return this.getPerpendicular(t*this.totalArcLength)},t.prototype.getPerpendicular=function(e){(e<0||e>this.totalArcLength)&&(console.log("[BezierPath.getPerpendicular(u)] u is out of bounds: "+e+"."),e=Math.min(this.totalArcLength,Math.max(0,e)));var i=t._locateUIndex(this,e),s=this.bezierCurves[i.i],r=e-i.uPart;return s.getPerpendicular(r)},t.prototype.lineIntersections=function(t,e){return void 0===e&&(e=!1),this.bezierCurves.reduce(function(i,s){return i.concat(s.lineIntersections(t,e))},[])},t.prototype.lineIntersectionTangents=function(t,e){return void 0===e&&(e=!1),this.bezierCurves.reduce(function(i,s){return i.concat(s.lineIntersectionTangents(t,e))},[])},t._locateUIndex=function(t,e){for(var i=0,s=0,r=0;i<t.bezierCurves.length&&s+t.bezierCurves[i].getLength()<e;)s+=t.bezierCurves[i].getLength(),i+1<t.bezierCurves.length&&(r+=t.bezierCurves[i].getLength()),i++;return{i,uPart:s,uBefore:r}},t.prototype.getSubPathAt=function(e,i){e=Math.max(0,e),i=Math.min(1,i);var s=e*this.totalArcLength,r=i*this.totalArcLength,n=t._locateUIndex(this,s),o=t._locateUIndex(this,r),a=(s-n.uBefore)/this.bezierCurves[n.i].getLength();if(n.i==o.i){var h=(r-o.uBefore)/this.bezierCurves[o.i].getLength(),c=this.bezierCurves[n.i].getSubCurveAt(a,h);return t.fromArray([c])}var l=[];if(n.i>o.i){c=this.bezierCurves[n.i].getSubCurveAt(a,0),l.push(c);for(var u=n.i-1;u>o.i;u--)l.push(this.bezierCurves[u].clone().reverse());h=(r-o.uBefore)/this.bezierCurves[o.i].getLength(),l.push(this.bezierCurves[o.i].getSubCurveAt(1,h))}else{for(c=this.bezierCurves[n.i].getSubCurveAt(a,1),l.push(c),u=n.i+1;u<o.i&&u<this.bezierCurves.length;u++)l.push(this.bezierCurves[u].clone());h=(r-o.uBefore)/this.bezierCurves[o.i].getLength(),l.push(this.bezierCurves[o.i].getSubCurveAt(0,h))}return t.fromArray(l)},t.prototype.moveCurvePoint=function(t,e,i){this.getCurveAt(t).moveCurvePoint(e,i,!0,!0),e==this.START_POINT&&(t>0||this.adjustCircular)?this.getCurveAt(t-1<0?this.bezierCurves.length+(t-1):t-1).moveCurvePoint(this.END_CONTROL_POINT,i,!0,!1):e==this.END_POINT&&(t+1<this.bezierCurves.length||this.adjustCircular)?this.getCurveAt((t+1)%this.bezierCurves.length).moveCurvePoint(this.START_CONTROL_POINT,i,!0,!1):e==this.START_CONTROL_POINT&&t>0?this.adjustPredecessorControlPoint(t,!0,!1):e==this.END_CONTROL_POINT&&t+1<this.getCurveCount()&&this.adjustSuccessorControlPoint(t,!0,!1),this.updateArcLengths()},t.prototype.adjustPredecessorControlPoint=function(e,i,s){if(this.adjustCircular||!(e<=0)){var r=this.getCurveAt(e),n=this.getCurveAt(e-1<0?this.getCurveCount()+(e-1):e-1);t.adjustNeighbourControlPoint(r,n,r.getStartPoint(),r.getStartControlPoint(),n.getEndPoint(),n.getEndControlPoint(),i,s)}},t.prototype.adjustSuccessorControlPoint=function(e,i,s){if(this.adjustCircular||!(e+1>this.getCurveCount())){var r=this.getCurveAt(e),n=this.getCurveAt((e+1)%this.getCurveCount());t.adjustNeighbourControlPoint(r,n,r.getEndPoint(),r.getEndControlPoint(),n.getStartPoint(),n.getStartControlPoint(),i,s)}},t.adjustNeighbourControlPoint=function(t,e,i,s,r,n,a,h){var c=new o.Vertex(s.x-i.x,s.y-i.y),l=new o.Vertex(n.x-r.x,n.y-r.y),u=Math.sqrt(Math.pow(c.x,2)+Math.pow(c.y,2)),d=Math.sqrt(Math.pow(l.x,2)+Math.pow(l.y,2));u<=.1||(a?n.set(r.x-c.x*(d/u),r.y-c.y*(d/u)):n.set(r.x-c.x,r.y-c.y),e.updateArcLengths())},t.prototype.getBounds=function(){for(var t,e=new o.Vertex(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),i=new o.Vertex(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY),r=0;r<this.bezierCurves.length;r++)t=this.bezierCurves[r].getBounds(),e.x=Math.min(e.x,t.min.x),e.y=Math.min(e.y,t.min.y),i.x=Math.max(i.x,t.max.x),i.y=Math.max(i.y,t.max.y);return new s.Bounds(e,i)},t.prototype.getEvenDistributionVertices=function(t){if(t<2)throw new Error("pointCount must be larger than one; is "+t+".");var e=[];if(0===this.bezierCurves.length)return e;var i=new o.Vertex(this.bezierCurves[0].startPoint);e.push(i);for(var s=this.totalArcLength/(t-1),r=this.bezierCurves.length,n=0,a=this.bezierCurves[0].arcLength,h=s,c=1;c<t&&n<r;)if(h<a){var l=this.bezierCurves[n].getPoint(h);e.push(l),h+=s,c++}else h-=a,a=++n<r?this.bezierCurves[n].arcLength:0;return e.push(new o.Vertex(this.bezierCurves[r-1].endPoint)),e},t.prototype.clone=function(){for(var e=new t,i=0;i<this.bezierCurves.length;i++)e.bezierCurves.push(this.bezierCurves[i].clone()),i>0&&(e.bezierCurves[i-1].endPoint=e.bezierCurves[i].startPoint);return e.updateArcLengths(),e.adjustCircular=this.adjustCircular,e},t.prototype.equals=function(t){if(!t)return!1;if(!t.bezierCurves)return!1;if(void 0===t.bezierCurves.length)return!1;if(t.bezierCurves.length!=this.bezierCurves.length)return!1;for(var e=0;e<this.bezierCurves.length;e++)if(!this.bezierCurves[e].equals(t.bezierCurves[e]))return!1;return!0},t.prototype.destroy=function(){for(var t=0;t<this.bezierCurves.length;t++)this.bezierCurves[t].destroy();this.isDestroyed=!0},t.prototype.toPathPoints=function(){if(0===this.bezierCurves.length)return[];if(1===this.bezierCurves.length)return[this.bezierCurves[0].startPoint,this.bezierCurves[0].startControlPoint,this.bezierCurves[0].endControlPoint,this.bezierCurves[0].endPoint];var t=[];t.push(this.bezierCurves[0].startPoint),t.push(this.bezierCurves[0].startControlPoint);for(var e=1;e<this.bezierCurves.length;e++)t.push(this.bezierCurves[e-1].endControlPoint),t.push(this.bezierCurves[e-1].endPoint),t.push(this.bezierCurves[e].startPoint),t.push(this.bezierCurves[e].startControlPoint);return t.push(this.bezierCurves[0].endControlPoint),t.push(this.bezierCurves[0].endPoint),t},t.prototype.toJSON=function(t){var e=[];e.push("[");for(var i=0;i<this.bezierCurves.length;i++)i>0&&e.push(","),t?e.push("\n\t"):e.push(" "),e.push(this.bezierCurves[i].toJSON(t));return 0!=this.bezierCurves.length&&e.push(" "),e.push("]"),e.join("")},t.fromJSON=function(e){var i=JSON.parse(e);return t.fromArray(i)},t.fromCurve=function(e){var i=new t;return i.addCurve(e),i},t.fromArray=function(e){if(!Array.isArray(e))throw"[BezierPath.fromArray] Passed object must be an array.";var i=e;if(i.length<1)throw"[BezierPath.fromArray] Passed array must contain at least one bezier curve (has "+i.length+").";for(var s=new t,n=null,o=0;o<i.length;o++){var a;if(r.CubicBezierCurve.isInstance(i[o]))a=i[o].clone();else if(0 in i[o]&&1 in i[o]&&2 in i[o]&&3 in i[o]){if(!(i[o][0]&&i[o][1]&&i[o][2]&&i[o][3]))throw"Cannot convert path data to BezierPath instance. At least one element is undefined (index="+o+"): "+i[o];a=r.CubicBezierCurve.fromArray(i[o])}else a=r.CubicBezierCurve.fromObject(i[o]);n&&(a.startPoint=n.endPoint),s.bezierCurves.push(a),n=a}return s.updateArcLengths(),s},t.prototype.toReducedListRepresentation=function(t){void 0===t&&(t=1);var e=[];e.push("[");for(var i=0;i<this.bezierCurves.length;i++){var s=this.bezierCurves[i];e.push(s.getStartPoint().x.toFixed(t)),e.push(","),e.push(s.getStartPoint().y.toFixed(t)),e.push(","),e.push(s.getStartControlPoint().x.toFixed(t)),e.push(","),e.push(s.getStartControlPoint().y.toFixed(t)),e.push(","),e.push(s.getEndControlPoint().x.toFixed(t)),e.push(","),e.push(s.getEndControlPoint().y.toFixed(t)),e.push(",")}return 0!=this.bezierCurves.length&&(s=this.bezierCurves[this.bezierCurves.length-1],e.push(s.getEndPoint().x.toFixed(t)),e.push(","),e.push(s.getEndPoint().y.toFixed(t))),e.push("]"),e.join("")},t.fromReducedListRepresentation=function(e,i){var s=JSON.parse(e);if(!s.length)throw console.log("Cannot parse bezier path from non-array object nor from empty point list."),"Cannot parse bezier path from non-array object nor from empty point list.";if(s.length<8)throw console.log("Cannot build bezier path. The passed array must contain at least 8 elements (numbers)."),"Cannot build bezier path. The passed array must contain at least 8 elements (numbers).";return t.fromReducedList(s,i)},t.fromReducedList=function(e,i){var s,n,a,h=new t,c=new o.Vertex,l=0;do{0==l&&(c=new o.Vertex(e[l],e[l+1])),s=new o.Vertex(e[l+2],e[l+3]),n=new o.Vertex(e[l+4],e[l+5]),a=new o.Vertex(e[l+6],e[l+7]);var u=new r.CubicBezierCurve(c,a,s,n);h.bezierCurves.push(u),c=a,l+=6}while(l+2<e.length);return h.adjustCircular=null!=i&&i,i&&(h.bezierCurves[h.bezierCurves.length-1].endPoint=h.bezierCurves[0].startPoint),h.updateArcLengths(),h},t.START_POINT=0,t.START_CONTROL_POINT=1,t.END_CONTROL_POINT=2,t.END_POINT=3,t}();e.BezierPath=a},737:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Triangle=void 0;var s=i(76),r=i(118),n=i(939),o=i(687),a=i(938),h=i(30),c=i(787),l=i(328),u=function(){function t(t,e,i){this.className="Triangle",this.uid=a.UIDGenerator.next(),this.a=t,this.b=e,this.c=i,this.calcCircumcircle()}return t.fromArray=function(e){if(e.length<3)throw"Cannot create triangle from array with less than three vertices (".concat(e.length,")");return new t(e[0],e[1],e[2])},t.prototype.getArea=function(){return Math.abs(t.utils.signedArea(this.a.x,this.a.y,this.b.x,this.b.y,this.c.x,this.c.y))},t.prototype.getCentroid=function(){return new c.Vertex((this.a.x+this.b.x+this.c.x)/3,(this.a.y+this.b.y+this.c.y)/3)},t.prototype.scaleToCentroid=function(t){var e=this.getCentroid();return this.a.scale(t,e),this.b.scale(t,e),this.c.scale(t,e),this},t.prototype.getBounds=function(){return this.bounds()},t.prototype.move=function(t){return this.a.add(t),this.b.add(t),this.c.add(t),this},t.prototype.getCircumcircle=function(){return this.calcCircumcircle(),new r.Circle(this.center.clone(),this.radius)},t.prototype.isAdjacent=function(t){var e=this.a.equals(t.a)||this.a.equals(t.b)||this.a.equals(t.c),i=this.b.equals(t.a)||this.b.equals(t.b)||this.b.equals(t.c),s=this.c.equals(t.a)||this.c.equals(t.b)||this.c.equals(t.c);return e&&i||e&&s||i&&s},t.prototype.getThirdVertex=function(t,e){return this.a.equals(t)&&this.b.equals(e)||this.a.equals(e)&&this.b.equals(t)?this.c:this.b.equals(t)&&this.c.equals(e)||this.b.equals(e)&&this.c.equals(t)?this.a:this.b},t.prototype.calcCircumcircle=function(){var e,i,s=this.b.x-this.a.x,r=this.b.y-this.a.y,n=this.c.x-this.a.x,o=this.c.y-this.a.y,a=s*(this.a.x+this.b.x)+r*(this.a.y+this.b.y),h=n*(this.a.x+this.c.x)+o*(this.a.y+this.c.y),l=2*(s*(this.c.y-this.b.y)-r*(this.c.x-this.b.x));if(Math.abs(l)<t.EPSILON){var u=this.bounds();this.center=new c.Vertex((u.min.x+u.max.x)/2,(u.min.y+u.max.y)/2),e=this.center.x-u.min.x,i=this.center.y-u.min.y}else{var d=(o*a-r*h)/l,p=(s*h-n*a)/l;this.center=new c.Vertex(d,p),e=this.center.x-this.a.x,i=this.center.y-this.a.y}this.radius_squared=e*e+i*i,this.radius=Math.sqrt(this.radius_squared)},t.prototype.inCircumcircle=function(t){var e=this.center.x-t.x,i=this.center.y-t.y;return e*e+i*i<=this.radius_squared},t.prototype.bounds=function(){return new s.Bounds(new c.Vertex(t.utils.min3(this.a.x,this.b.x,this.c.x),t.utils.min3(this.a.y,this.b.y,this.c.y)),new c.Vertex(t.utils.max3(this.a.x,this.b.x,this.c.x),t.utils.max3(this.a.y,this.b.y,this.c.y)))},t.prototype.lineIntersections=function(t,e){return void 0===e&&(e=!1),o.Polygon.utils.locateLineIntersecion(t,[this.a,this.b,this.c],!1,e).map(function(t){return t.intersection})},t.prototype.lineIntersectionTangents=function(t,e){var i=this;return void 0===e&&(e=!1),o.Polygon.utils.locateLineIntersecion(t,[this.a,this.b,this.c],!1,e).map(function(t){var e=i.getEdgeAt(t.edgeIndex);return new h.Vector(e.a.clone(),e.b.clone()).moveTo(t.intersection)})},t.prototype.getEdgeAt=function(t){var e=t%3;return 0===e?new n.Line(this.a,this.b):1===e?new n.Line(this.b,this.c):new n.Line(this.c,this.a)},t.prototype.toPolygon=function(){return new o.Polygon([this.a,this.b,this.c])},t.prototype.determinant=function(){return t.utils.determinant(this.a,this.b,this.c)},t.prototype.containsPoint=function(e){return t.utils.pointIsInTriangle(e.x,e.y,this.a.x,this.a.y,this.b.x,this.b.y,this.c.x,this.c.y)},t.prototype.getIncircularTriangle=function(){var e=new n.Line(this.a,this.b),i=new n.Line(this.b,this.c),s=new n.Line(this.c,this.a),r=l.geomutils.nsectAngle(this.b,this.a,this.c,2)[0],o=l.geomutils.nsectAngle(this.c,this.b,this.a,2)[0],a=r.intersection(o);return new t(e.getClosestPoint(a),i.getClosestPoint(a),s.getClosestPoint(a))},t.prototype.getIncircle=function(){return this.getIncircularTriangle().getCircumcircle()},t.prototype.getIncenter=function(){return this.center&&this.radius||this.calcCircumcircle(),this.center.clone()},t.prototype.toString=function(){return"{ a : "+this.a.toString()+", b : "+this.b.toString()+", c : "+this.c.toString()+"}"},t.prototype.destroy=function(){this.a.destroy(),this.b.destroy(),this.c.destroy(),this.isDestroyed=!0},t.EPSILON=1e-6,t.utils={max3:function(t,e,i){return t>=e&&t>=i?t:e>=t&&e>=i?e:i},min3:function(t,e,i){return t<=e&&t<=i?t:e<=t&&e<=i?e:i},signedArea:function(t,e,i,s,r,n){return.5*(-s*r+e*(-i+r)+t*(s-n)+i*n)},pointIsInTriangle:function(e,i,s,r,n,o,a,h){var c=t.utils.signedArea(s,r,n,o,a,h),l=1/(2*c)*(r*a-s*h+(h-r)*e+(s-a)*i),u=1/(2*c)*(s*o-r*n+(r-o)*e+(n-s)*i);return l>0&&u>0&&1-l-u>0},determinant:function(t,e,i){return(e.y-t.y)*(i.x-e.x)-(i.y-e.y)*(e.x-t.x)}},t}();e.Triangle=u},787:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Vertex=void 0;var s=i(476),r=i(938),n=i(934),o=i(328),a=i(76),h=function(){function t(t,e){if(this.className="Vertex",this.uid=r.UIDGenerator.next(),void 0===t)this.x=0,this.y=0;else if("number"==typeof t&&"number"==typeof e)this.x=t,this.y=e;else{var i=t;"number"==typeof i.x&&"number"==typeof i.y?(this.x=i.x,this.y=i.y):(this.x="number"==typeof t?t:void 0===t?0:NaN,this.y="number"==typeof e?e:void 0===e?0:NaN)}this.attr=new s.VertexAttr,this.listeners=new n.VertexListeners(this)}return t.prototype.set=function(t,e){if("number"==typeof t&&"number"==typeof e)this.x=t,this.y=e;else{var i=t;"number"==typeof i.x&&"number"==typeof i.y?(this.x=i.x,this.y=i.y):(this.x="number"==typeof t?t:void 0===t?0:NaN,this.y="number"==typeof e?e:void 0===e?0:NaN)}return this},t.prototype.setX=function(t){return this.x=t,this},t.prototype.setY=function(t){return this.y=t,this},t.prototype.invX=function(){return this.x=-this.x,this},t.prototype.invY=function(){return this.y=-this.y,this},t.prototype.add=function(t,e){if("number"==typeof t&&"number"==typeof e)this.x+=t,this.y+=e;else{var i=t;if("number"==typeof i.x&&"number"==typeof i.y)this.x+=i.x,this.y+=i.y;else{if("number"!=typeof t)throw"Cannot add ".concat(typeof t," to numeric x component!");if(this.x+=t,"number"!=typeof e)throw"Cannot add ".concat(typeof e," to numeric y component!");this.y+=e}}return this},t.prototype.move=function(t){return this.add(t)},t.prototype.addXY=function(t,e){return this.x+=t,this.y+=e,this},t.prototype.addX=function(t){return this.x+=t,this},t.prototype.addY=function(t){return this.y+=t,this},t.prototype.sub=function(t,e){if("number"==typeof t&&"number"==typeof e)this.x-=t,this.y-=e;else{var i=t;if("number"==typeof i.x&&"number"==typeof i.y)this.x-=i.x,this.y-=i.y;else{if("number"!=typeof t)throw"Cannot add ".concat(typeof t," to numeric x component!");if(this.x-=t,"number"!=typeof e)throw"Cannot add ".concat(typeof e," to numeric y component!");this.y-=e}}return this},t.prototype.subXY=function(t,e){return this.x-=t,this.y-=e,this},t.prototype.subX=function(t){return this.x-=t,this},t.prototype.subY=function(t){return this.y-=t,this},t.prototype.equals=function(e){var i=Math.abs(this.x-e.x)<t.EPSILON,s=Math.abs(this.y-e.y)<t.EPSILON;return i&&s},t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.distance=function(t){return o.geomutils.dist4(this.x,this.y,t.x,t.y)},t.prototype.angle=function(t){var e=void 0===t?Math.PI/2-Math.atan2(this.x,this.y):Math.PI/2-Math.atan2(t.x-this.x,t.y-this.y);return e<0?2*Math.PI+e:e},t.prototype.difference=function(e){return new t(e.x-this.x,e.y-this.y)},t.prototype.scale=function(t,e){return this.scaleXY({x:t,y:t},e)},t.prototype.lerp=function(t,e){var i=this.difference(t);return this.x+=i.x*e,this.y+=i.y*e,this},t.prototype.lerpAbs=function(t,e){var i=this.distance(t),s=this.difference(t),r=s.x/i,n=s.y/i;return this.x+=r*e,this.y+=n*e,this},t.prototype.scaleXY=function(t,e){return e&&void 0!==e||(e={x:0,y:0}),this.x=e.x+(this.x-e.x)*t.x,this.y=e.y+(this.y-e.y)*t.y,this},t.prototype.rotate=function(e,i){i&&void 0!==i||(i={x:0,y:0}),this.sub(i),e+=Math.atan2(this.y,this.x);var s=this.distance(t.ZERO);return this.x=s*Math.cos(e),this.y=s*Math.sin(e),this.add(i),this},t.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this},t.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},t.prototype.inv=function(){return this.x=-this.x,this.y=-this.y,this},t.prototype.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},t.prototype.getBounds=function(){return a.Bounds.computeFromVertices([this])},t.prototype.toString=function(t){return void 0===t?"("+this.x+","+this.y+")":"("+this.x.toFixed(t)+","+this.y.toFixed(t)+")"},t.prototype.destroy=function(){this.listeners.removeAllListeners(),this.isDestroyed=!0},t.randomVertex=function(e){return new t(e.min.x+Math.random()*(e.max.x-e.min.x),e.min.y+Math.random()*(e.max.y-e.min.y))},t.ZERO=new t(0,0),t.EPSILON=1e-6,t.utils={buildArrowHead:function(e,i,s,r,n){console.warn("[DEPRECATION] Vertex.utils.buildArrowHead is deprecated. Please use Vector.utils.buildArrowHead instead.");var o=Math.atan2((i.y-e.y)*n,(i.x-e.x)*r),a=[];return a.push(new t(i.x*r-s*Math.cos(o),i.y*n-s*Math.sin(o))),a.push(new t(i.x*r-1.35*s*Math.cos(o-Math.PI/8),i.y*n-1.35*s*Math.sin(o-Math.PI/8))),a.push(new t(i.x*r,i.y*n)),a.push(new t(i.x*r-1.35*s*Math.cos(o+Math.PI/8),i.y*n-1.35*s*Math.sin(o+Math.PI/8))),a},arrayToJSON:function(t,e){return JSON.stringify(t.map(function(t){return void 0===typeof e?{x:t.x,y:t.y}:{x:Number(t.x.toFixed(e)),y:Number(t.y.toFixed(e))}}))}},t}();e.Vertex=h},862:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PBImage=void 0;var s=i(938),r=function(){function t(t,e,i){this.className="PBImage",this.uid=s.UIDGenerator.next(),this.image=t,this.upperLeft=e,this.lowerRight=i}return t.prototype.destroy=function(){this.upperLeft.destroy(),this.lowerRight.destroy(),this.isDestroyed=!0},t}();e.PBImage=r},881:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VEllipse=void 0;var s=i(939),r=i(30),n=i(787),o=i(938),a=i(973),h=i(118),c=i(76),l=function(){function t(t,e,i){this.className="VEllipse",this.uid=o.UIDGenerator.next(),this.center=t,this.axis=e,this.rotation=i||0}return t.prototype.clone=function(){return new t(this.center.clone(),this.axis.clone(),this.rotation)},t.prototype.radiusH=function(){return Math.abs(this.signedRadiusH())},t.prototype.signedRadiusH=function(){return new n.Vertex(this.axis).rotate(-this.rotation,this.center).x-this.center.x},t.prototype.radiusV=function(){return Math.abs(this.signedRadiusV())},t.prototype.signedRadiusV=function(){return new n.Vertex(this.axis).rotate(-this.rotation,this.center).y-this.center.y},t.prototype.getExtremePoints=function(){var t,e,i=this.radiusH(),s=this.radiusV(),r=Math.atan2(-s*Math.sin(this.rotation),i*Math.cos(this.rotation)),o=r+Math.PI,a=this.center.x+i*Math.cos(r)*Math.cos(this.rotation)-s*Math.sin(r)*Math.sin(this.rotation),h=this.center.y+i*Math.cos(r)*Math.sin(this.rotation)+s*Math.sin(r)*Math.cos(this.rotation),c=this.center.x+i*Math.cos(o)*Math.cos(this.rotation)-s*Math.sin(o)*Math.sin(this.rotation),l=this.center.y+i*Math.cos(o)*Math.sin(this.rotation)+s*Math.sin(o)*Math.cos(this.rotation);a>c?(t=new n.Vertex(a,h),e=new n.Vertex(c,l)):(t=new n.Vertex(c,l),e=new n.Vertex(a,h));var u,d,p=Math.atan2(s*Math.cos(this.rotation),i*Math.sin(this.rotation)),f=p+Math.PI,y=this.center.x+i*Math.cos(p)*Math.cos(this.rotation)-s*Math.sin(p)*Math.sin(this.rotation),v=this.center.y+i*Math.cos(p)*Math.sin(this.rotation)+s*Math.sin(p)*Math.cos(this.rotation),g=this.center.x+i*Math.cos(f)*Math.cos(this.rotation)-s*Math.sin(f)*Math.sin(this.rotation),x=this.center.y+i*Math.cos(f)*Math.sin(this.rotation)+s*Math.sin(f)*Math.cos(this.rotation);return v>x?(u=new n.Vertex(y,v),d=new n.Vertex(g,x)):(u=new n.Vertex(g,x),d=new n.Vertex(y,v)),[t,e,u,d]},t.prototype.getBounds=function(){var t=this.radiusH(),e=this.radiusV(),i=t*Math.cos(this.rotation),s=t*Math.sin(this.rotation),r=e*Math.cos(this.rotation+Math.PI/2),n=e*Math.sin(this.rotation+Math.PI/2),o=Math.sqrt(i*i+r*r),a=Math.sqrt(s*s+n*n);return new c.Bounds({x:this.center.x-o,y:this.center.y-a},{x:this.center.x+o,y:this.center.y+a})},t.prototype.move=function(t){return this.center.add(t),this.axis.add(t),this},t.prototype.scale=function(t){return this.axis.scale(t,this.center),this},t.prototype.rotate=function(t){return this.axis.rotate(t,this.center),this.rotation+=t,this},t.prototype.vertAt=function(e){var i=this.radiusH(),s=this.radiusV();return new n.Vertex(t.utils.polarToCartesian(this.center.x,this.center.y,i,s,e)).rotate(this.rotation,this.center)},t.prototype.normalAt=function(t,e){var i=this.vertAt(t-this.rotation),n=this.getFoci(),o=new s.Line(i,n[0]).angle(),a=o+(new s.Line(i,n[1]).angle()-o)/2,h=i.clone().addX(50).clone().rotate(a,i),c=i.clone().addX(50).clone().rotate(Math.PI+a,i),l=this.center.distance(h)<this.center.distance(c)?new r.Vector(i,c):new r.Vector(i,h);return"number"==typeof e&&l.setLength(e),l},t.prototype.tangentAt=function(t,e){return this.normalAt(t,e).inv().perp()},t.prototype.perimeter=function(){var t=this.radiusH(),e=this.radiusV();return Math.PI*(3*(t+e)-Math.sqrt((3*t+e)*(t+3*e)))},t.prototype.getFoci=function(){var t=this.radiusH(),e=this.radiusV(),i=t*t-e*e,s=Math.sqrt(Math.abs(i));return i<0?[this.center.clone().addY(s).rotate(this.rotation,this.center),this.center.clone().addY(-s).rotate(this.rotation,this.center)]:[this.center.clone().addX(s).rotate(this.rotation,this.center),this.center.clone().addX(-s).rotate(this.rotation,this.center)]},t.prototype.getEquidistantVertices=function(e){for(var i=t.utils.equidistantVertAngles(this.radiusH(),this.radiusV(),e),s=[],r=0;r<i.length;r++)s.push(this.vertAt(i[r]));return s},t.prototype.lineIntersections=function(t,e){void 0===e&&(e=!1);var i=this.clone(),s=t.clone(),r=i.center.clone().inv();i.move(r),s.add(r);var o=-i.rotation;i.rotate(o),s.a.rotate(o,i.center),s.b.rotate(o,i.center);var a=i.radiusH(),c=i.radiusV(),l=a>c?{x:c/a,y:1}:{x:1,y:a/c};i.axis.scaleXY(l),s.a.scaleXY(l),s.b.scaleXY(l);var u=new h.Circle(new n.Vertex,i.radiusH()).lineIntersections(s,e);return u.forEach(function(t){t.scaleXY({x:1/l.x,y:1/l.y},i.center),t.rotate(-o,i.center),t.sub(r)}),u},t.prototype.lineIntersectionTangents=function(t,e){var i=this;return void 0===e&&(e=!1),this.lineIntersections(t,e).map(function(t){var e=new s.Line(i.center,t).angle();return i.tangentAt(e)})},t.prototype.toCubicBezier=function(e,i){var s=4*Math.max(1,e||3);i=void 0===i?.666666:i;for(var r=this.radiusH(),n=this.radiusV(),o=[],h=t.utils.equidistantVertAngles(r,n,s),c=h[0]+this.rotation,l=this.vertAt(c),u=0;u<h.length;u++){var d=h[(u+1)%h.length]+this.rotation,p=this.vertAt(d);if(Math.abs(n)<1e-4||Math.abs(r)<1e-4){var f=l.difference(p),y=new a.CubicBezierCurve(l.clone(),p.clone(),l.clone().addXY(.333*f.x,.333*f.y),p.clone().addXY(.333*-f.x,.333*-f.y));o.push(y)}else{var v=this.tangentAt(c+this.rotation),g=this.tangentAt(d+this.rotation),x=v.intersection(g),m=l.difference(x),b=p.difference(x);y=new a.CubicBezierCurve(l.clone(),p.clone(),l.clone().add(m.scale(i)),p.clone().add(b.scale(i))),o.push(y)}l=p,c=d}return o},t.prototype.destroy=function(){this.center.destroy(),this.axis.destroy(),this.isDestroyed=!0},t.utils={polarToCartesian:function(t,e,i,s,r){var n=Math.sin(Math.PI/2-r),o=Math.cos(Math.PI/2-r);return{x:t+i*s*n/Math.sqrt(Math.pow(i*o,2)+Math.pow(s*n,2)),y:e+i*s*o/Math.sqrt(Math.pow(i*o,2)+Math.pow(s*n,2))}},phiToTheta:function(t,e,i){var s=Math.tan(i),r=s*s;return-Math.PI/2+i+Math.atan((t-e)*s/(e+t*r))},equidistantVertAngles:function(e,i,s){for(var r=[],n=0;n<s;n++){var o=Math.PI/2+2*Math.PI/s*n,a=t.utils.phiToTheta(e,i,o);r[n]=a}return r}},t}();e.VEllipse=l},912:function(t,e){var i,s=this&&this.__extends||(i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},i(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function s(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(s.prototype=e.prototype,new s)});Object.defineProperty(e,"__esModule",{value:!0}),e.MouseHandler=e.XWheelEvent=e.XMouseEvent=void 0;var r=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e}(MouseEvent);e.XMouseEvent=r;var n=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e}(WheelEvent);e.XWheelEvent=n;var o=function(){function t(t,e){this.mouseDownPos=void 0,this.mouseDragPos=void 0,this.mouseButton=-1,this.listeners={},this.installed={},this.handlers={},this.name=e,this.element=t,this.mouseDownPos=void 0,this.mouseDragPos=void 0,this.mouseButton=-1,this.listeners={},this.installed={},this.handlers={};var i=this;this.handlers.mousemove=function(t){i.listeners.mousemove&&i.listeners.mousemove(i.mkParams(t,"mousemove")),i.mouseDragPos&&i.listeners.drag&&i.listeners.drag(i.mkParams(t,"drag")),i.mouseDownPos&&(i.mouseDragPos=i.relPos(t))},this.handlers.mouseup=function(t){i.listeners.mouseup&&i.listeners.mouseup(i.mkParams(t,"mouseup")),i.mouseDragPos=void 0,i.mouseDownPos=void 0,i.mouseButton=-1},this.handlers.mousedown=function(t){i.mouseDragPos=i.relPos(t),i.mouseDownPos=i.relPos(t),i.mouseButton=t.button,i.listeners.mousedown&&i.listeners.mousedown(i.mkParams(t,"mousedown"))},this.handlers.click=function(t){i.listeners.click&&i.listeners.click(i.mkParams(t,"click"))},this.handlers.wheel=function(t){i.listeners.wheel&&i.listeners.wheel(i.mkParams(t,"wheel"))},this.element.addEventListener("mousemove",this.handlers.mousemove),this.element.addEventListener("mouseup",this.handlers.mouseup),this.element.addEventListener("mousedown",this.handlers.mousedown),this.element.addEventListener("click",this.handlers.click),this.element.addEventListener("wheel",this.handlers.wheel)}return t.prototype.relPos=function(t){return{x:t.offsetX,y:t.offsetY}},t.prototype.mkParams=function(t,e){var i,s,r=this.relPos(t),n=t;return n.params={element:this.element,name:e,isTouchEvent:!1,pos:r,button:t.button,leftButton:0===t.button,middleButton:1===t.button,rightButton:2===t.button,mouseDownPos:null!==(i=this.mouseDownPos)&&void 0!==i?i:{x:NaN,y:NaN},draggedFrom:null!==(s=this.mouseDragPos)&&void 0!==s?s:{x:NaN,y:NaN},wasDragged:null!=this.mouseDownPos&&(this.mouseDownPos.x!=r.x||this.mouseDownPos.y!=r.y),dragAmount:null!=this.mouseDragPos?{x:r.x-this.mouseDragPos.x,y:r.y-this.mouseDragPos.y}:{x:0,y:0}},n},t.prototype.listenFor=function(t){this.installed[t]||(this.installed[t]=!0)},t.prototype.unlistenFor=function(t){this.installed[t]&&delete this.installed[t]},t.prototype.drag=function(t){return this.listeners.drag&&this.throwAlreadyInstalled("drag"),this.listeners.drag=t,this.listenFor("mousedown"),this.listenFor("mousemove"),this.listenFor("mouseup"),this},t.prototype.move=function(t){return this.listeners.mousemove&&this.throwAlreadyInstalled("mousemove"),this.listenFor("mousemove"),this.listeners.mousemove=t,this},t.prototype.up=function(t){return this.listeners.mouseup&&this.throwAlreadyInstalled("mouseup"),this.listenFor("mouseup"),this.listeners.mouseup=t,this},t.prototype.down=function(t){return this.listeners.mousedown&&this.throwAlreadyInstalled("mousedown"),this.listenFor("mousedown"),this.listeners.mousedown=t,this},t.prototype.click=function(t){return this.listeners.click&&this.throwAlreadyInstalled("click"),this.listenFor("click"),this.listeners.click=t,this},t.prototype.wheel=function(t){return this.listeners.wheel&&this.throwAlreadyInstalled("wheel"),this.listenFor("wheel"),this.listeners.wheel=t,this},t.prototype.throwAlreadyInstalled=function(t){throw"This MouseHandler already has a '".concat(t,"' callback. To keep the code simple there is only room for one.")},t.prototype.destroy=function(){this.unlistenFor("mousedown"),this.unlistenFor("mousemove"),this.unlistenFor("moseup"),this.unlistenFor("click"),this.unlistenFor("wheel"),this.element.removeEventListener("mousemove",this.handlers.mousemove),this.element.removeEventListener("mouseup",this.handlers.mousedown),this.element.removeEventListener("mousedown",this.handlers.mousedown),this.element.removeEventListener("click",this.handlers.click),this.element.removeEventListener("wheel",this.handlers.wheel)},t}();e.MouseHandler=o},934:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VertexListeners=void 0;var i=function(){function t(t){this.click=[],this.drag=[],this.dragStart=[],this.dragEnd=[],this.vertex=t}return t.prototype.addClickListener=function(e){return t._addListener(this.click,e),this},t.prototype.removeClickListener=function(e){return this.click=t._removeListener(this.click,e),this},t.prototype.addDragListener=function(e){return t._addListener(this.drag,e),this},t.prototype.removeDragListener=function(e){return this.drag=t._removeListener(this.drag,e),this},t.prototype.addDragStartListener=function(e){return t._addListener(this.dragStart,e),this},t.prototype.removeDragStartListener=function(e){return this.dragStart=t._removeListener(this.dragStart,e),this},t.prototype.addDragEndListener=function(e){return t._addListener(this.dragEnd,e),this},t.prototype.removeDragEndListener=function(e){return this.dragEnd=t._removeListener(this.dragEnd,e),this},t.prototype.fireClickEvent=function(e){t._fireEvent(this,this.click,e)},t.prototype.fireDragEvent=function(e){t._fireEvent(this,this.drag,e)},t.prototype.fireDragStartEvent=function(e){t._fireEvent(this,this.dragStart,e)},t.prototype.fireDragEndEvent=function(e){t._fireEvent(this,this.dragEnd,e)},t.prototype.removeAllListeners=function(){this.click=[],this.drag=[],this.dragStart=[],this.dragEnd=[]},t._fireEvent=function(t,e,i){var s=i;for(var r in void 0===s.params?s.params={vertex:t.vertex}:s.params.vertex=t.vertex,e)e[r](s)},t._addListener=function(t,e){for(var i in t)if(t[i]==e)return!1;return t.push(e),!0},t._removeListener=function(t,e){for(var i=0;i<t.length;i++)if(t[i]==e)return t.splice(i,1);return t},t}();e.VertexListeners=i},938:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.UIDGenerator=void 0;var i=function(){function t(){}return t.next=function(){return"".concat(t.current++)},t.current=0,t}();e.UIDGenerator=i},939:function(t,e,i){var s,r=this&&this.__extends||(s=function(t,e){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},s(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}s(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0}),e.Line=void 0;var n=i(76),o=i(30),a=i(590),h=i(787),c=function(t){function e(i,s){var r=t.call(this,i,s,function(t,i){return new e(t,i)})||this;return r.className="Line",r}return r(e,t),e.prototype.intersection=function(t){var e=this.denominator(t);if(0==e)return null;var i=this.a.y-t.a.y,s=this.a.x-t.a.x,r=(t.b.x-t.a.x)*i-(t.b.y-t.a.y)*s,n=(this.b.x-this.a.x)*i-(this.b.y-this.a.y)*s;i=r/e,s=n/e;var o=this.a.x+i*(this.b.x-this.a.x),a=this.a.y+i*(this.b.y-this.a.y);return isNaN(i)||isNaN(o)||isNaN(a)?null:new h.Vertex(o,a)},e.prototype.getBounds=function(){return n.Bounds.computeFromVertices([this.a,this.b])},e.prototype.getStartPoint=function(){return this.a},e.prototype.getEndPoint=function(){return this.b},e.prototype.getStartTangent=function(){return this.b},e.prototype.getEndTangent=function(){return this.a},e.prototype.reverse=function(){var t=this.a;return this.a=this.b,this.b=t,this},e.prototype.lineIntersections=function(t,e){void 0===e&&(e=!1);var i=this.intersection(t);return i?!this.hasPoint(i,!0)||e&&!t.hasPoint(i,e)?[]:[i]:[]},e.prototype.lineIntersectionTangents=function(t,e){void 0===e&&(e=!1);var i=this.lineIntersections(t,e);if(0===i.length)return[];var s=i[0];return[new o.Vector(this.a.clone(),this.b.clone()).moveTo(s)]},e}(a.VertTuple);e.Line=c},973:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CubicBezierCurve=void 0;var s=i(76),r=i(938),n=i(787),o=i(30),a=function(){function t(e,i,s,n){this.START_POINT=t.START_POINT,this.START_CONTROL_POINT=t.START_CONTROL_POINT,this.END_CONTROL_POINT=t.END_CONTROL_POINT,this.END_POINT=t.END_POINT,this.uid=r.UIDGenerator.next(),this.startPoint=e,this.startControlPoint=s,this.endPoint=i,this.endControlPoint=n,this.curveIntervals=30,this.segmentCache=[],this.segmentLengths=[],this.updateArcLengths()}return t.prototype.moveCurvePoint=function(t,e,i,s){t==this.START_POINT?(this.getStartPoint().add(e),i&&this.getStartControlPoint().add(e)):t==this.START_CONTROL_POINT?this.getStartControlPoint().add(e):t==this.END_CONTROL_POINT?this.getEndControlPoint().add(e):t==this.END_POINT?(this.getEndPoint().add(e),i&&this.getEndControlPoint().add(e)):console.log("[CubicBezierCurve.moveCurvePoint] pointID '".concat(t,"' invalid.")),s&&this.updateArcLengths()},t.prototype.translate=function(t){return this.startPoint.add(t),this.startControlPoint.add(t),this.endControlPoint.add(t),this.endPoint.add(t),this},t.prototype.move=function(t){return this.translate(t)},t.prototype.reverse=function(){var t=this.startPoint;return this.startPoint=this.endPoint,this.endPoint=t,t=this.startControlPoint,this.startControlPoint=this.endControlPoint,this.endControlPoint=t,this},t.prototype.getLength=function(){return this.arcLength},t.prototype.updateArcLengths=function(){var t=this.startPoint.clone(),e=new n.Vertex(0,0),i=1/this.curveIntervals;this.segmentCache=[],this.segmentCache.push(this.startPoint),this.segmentLengths=[];for(var s,r=0,o=0;o<=1;)e=this.getPointAt(o),this.segmentCache.push(e),s=t.distance(e),this.segmentLengths.push(s),r+=s,t=e,o+=i;this.arcLength=r},t.prototype.getClosestT=function(t){var e={t:0,tPrev:0,tNext:1},i=0;do{e=this.locateIntervalByDistance(t,e.tPrev,e.tNext,this.curveIntervals),i++}while(i<4&&this.getPointAt(e.tPrev).distance(this.getPointAt(e.tNext))>1);return e.t},t.prototype.locateIntervalByDistance=function(t,e,i,s){for(var r=-1,n=0,o=0,a=i-e,h=0;h<=s;h++){o=e+a*(h/s);var c=this.getPointAt(o).distance(t);(-1==r||c<n)&&(r=h,n=c)}return{t:e+a*(r/s),tPrev:e+a*(Math.max(0,r-1)/s),tNext:e+a*(Math.min(s,r+1)/s)}},t.prototype.getBounds=function(){var e=t.utils.cubicPolyMinMax(this.startPoint.x,this.startControlPoint.x,this.endControlPoint.x,this.endPoint.x),i=e.min,r=e.max,n=t.utils.cubicPolyMinMax(this.startPoint.y,this.startControlPoint.y,this.endControlPoint.y,this.endPoint.y),o=n.min,a=n.max;return s.Bounds.computeFromVertices([{x:i,y:o},{x:i,y:a},{x:r,y:a},{x:r,y:o}])},t.prototype.getStartPoint=function(){return this.startPoint},t.prototype.getEndPoint=function(){return this.endPoint},t.prototype.getStartControlPoint=function(){return this.startControlPoint},t.prototype.getEndControlPoint=function(){return this.endControlPoint},t.prototype.getPointByID=function(t){if(t==this.START_POINT)return this.startPoint;if(t==this.END_POINT)return this.endPoint;if(t==this.START_CONTROL_POINT)return this.startControlPoint;if(t==this.END_CONTROL_POINT)return this.endControlPoint;throw new Error("Invalid point ID '".concat(t,"'."))},t.prototype.getPointAt=function(e){var i=t.utils.evaluateT(this.startPoint.x,this.startControlPoint.x,this.endControlPoint.x,this.endPoint.x,e),s=t.utils.evaluateT(this.startPoint.y,this.startControlPoint.y,this.endControlPoint.y,this.endPoint.y,e);return new n.Vertex(i,s)},t.prototype.getPoint=function(t){return this.getPointAt(t/this.arcLength)},t.prototype.getTangentAt=function(t){var e=this.getStartPoint(),i=this.getStartControlPoint(),s=this.getEndControlPoint(),r=this.getEndPoint(),o=t*t,a=1-2*t+o,h=-3*e.x*a+i.x*(3*a-6*(t-o))+s.x*(6*(t-o)-3*o)+3*r.x*o,c=-3*e.y*a+i.y*(3*a-6*(t-o))+s.y*(6*(t-o)-3*o)+3*r.y*o;return new n.Vertex(h,c)},t.prototype.trimStart=function(t){return this.trimStartAt(this.convertU2T(t))},t.prototype.trimStartAt=function(e){var i=t.utils.getSubCurvePointsAt(this,e,1);return this.startPoint.set(i[0]),this.startControlPoint.set(i[2]),this.endPoint.set(i[1]),this.endControlPoint.set(i[3]),this.updateArcLengths(),this},t.prototype.trimEnd=function(t){return this.trimEndAt(this.convertU2T(t))},t.prototype.trimEndAt=function(e){var i=t.utils.getSubCurvePointsAt(this,0,e);return this.startPoint.set(i[0]),this.startControlPoint.set(i[2]),this.endPoint.set(i[1]),this.endControlPoint.set(i[3]),this.updateArcLengths(),this},t.prototype.getSubCurve=function(t,e){return this.getSubCurveAt(this.convertU2T(t),this.convertU2T(e))},t.prototype.getSubCurveAt=function(e,i){var s=t.utils.getSubCurvePointsAt(this,e,i);return new t(s[0],s[1],s[2],s[3])},t.prototype.convertU2T=function(t){return Math.max(0,Math.min(1,t/this.arcLength))},t.prototype.getTangent=function(t){return this.getTangentAt(this.convertU2T(t))},t.prototype.getPerpendicular=function(t){return this.getPerpendicularAt(this.convertU2T(t))},t.prototype.getPerpendicularAt=function(t){var e=this.getTangentAt(t);return new n.Vertex(e.y,-e.x)},t.prototype.clone=function(){return new t(this.getStartPoint().clone(),this.getEndPoint().clone(),this.getStartControlPoint().clone(),this.getEndControlPoint().clone())},t.prototype.getStartTangent=function(){return this.startControlPoint},t.prototype.getEndTangent=function(){return this.endControlPoint},t.prototype.lineIntersections=function(t,e){var i=this;void 0===e&&(e=!1);var s=this.lineIntersectionTs(t).map(function(t){return i.getPointAt(t)});return e?s.filter(function(e){return t.hasPoint(e,!0)}):s},t.prototype.lineIntersectionTangents=function(t,e){var i=this;void 0===e&&(e=!1);var s=this.lineIntersectionTs(t).map(function(t){var e=i.getPointAt(t),s=i.getTangentAt(t);return new o.Vector(e,s.add(e))});return e?s.filter(function(e){return t.hasPoint(e.a,!0)}):s},t.prototype.lineIntersectionTs=function(e){var i=e.b.y-e.a.y,s=e.a.x-e.b.x,r=e.a.x*(e.a.y-e.b.y)+e.a.y*(e.b.x-e.a.x),n=t.utils.bezierCoeffs(this.startPoint.x,this.startControlPoint.x,this.endControlPoint.x,this.endPoint.x),o=t.utils.bezierCoeffs(this.startPoint.y,this.startControlPoint.y,this.endControlPoint.y,this.endPoint.y),a=Array(4);return a[0]=i*n[0]+s*o[0],a[1]=i*n[1]+s*o[1],a[2]=i*n[2]+s*o[2],a[3]=i*n[3]+s*o[3]+r,t.utils.cubicRoots(a).filter(function(t){return-1!=t})},t.prototype.equals=function(t){return!!t&&!!(t.startPoint&&t.endPoint&&t.startControlPoint&&t.endControlPoint)&&this.startPoint.equals(t.startPoint)&&this.endPoint.equals(t.endPoint)&&this.startControlPoint.equals(t.startControlPoint)&&this.endControlPoint.equals(t.endControlPoint)},t.prototype.destroy=function(){this.startPoint.destroy(),this.endPoint.destroy(),this.startControlPoint.destroy(),this.endControlPoint.destroy(),this.isDestroyed=!0},t.isInstance=function(e){return e instanceof t},t.prototype.toJSON=function(t){return"{ "+(t?"\n\t":"")+'"startPoint" : ['+this.getStartPoint().x+","+this.getStartPoint().y+"], "+(t?"\n\t":"")+'"endPoint" : ['+this.getEndPoint().x+","+this.getEndPoint().y+"], "+(t?"\n\t":"")+'"startControlPoint": ['+this.getStartControlPoint().x+","+this.getStartControlPoint().y+"], "+(t?"\n\t":"")+'"endControlPoint" : ['+this.getEndControlPoint().x+","+this.getEndControlPoint().y+"]"+(t?"\n\t":"")+" }"},t.fromJSON=function(e){var i=JSON.parse(e);return t.fromObject(i)},t.fromObject=function(e){if("object"!=typeof e)throw"Can only build from object.";if(!e.startPoint)throw'Object member "startPoint" missing.';if(!e.endPoint)throw'Object member "endPoint" missing.';if(!e.startControlPoint)throw'Object member "startControlPoint" missing.';if(!e.endControlPoint)throw'Object member "endControlPoint" missing.';return new t(new n.Vertex(e.startPoint[0],e.startPoint[1]),new n.Vertex(e.endPoint[0],e.endPoint[1]),new n.Vertex(e.startControlPoint[0],e.startControlPoint[1]),new n.Vertex(e.endControlPoint[0],e.endControlPoint[1]))},t.fromArray=function(e){if(!Array.isArray(e))throw"Can only build from object.";if(4!=e.length)throw"Can only build from array with four elements.";return new t(e[0],e[1],e[2],e[3])},t.START_POINT=0,t.START_CONTROL_POINT=1,t.END_CONTROL_POINT=2,t.END_POINT=3,t.utils={evaluateT:function(t,e,i,s,r){return t*Math.pow(1-r,3)+3*e*r*Math.pow(1-r,2)+3*i*Math.pow(r,2)*(1-r)+s*Math.pow(r,3)},cubicPolyMinMax:function(e,i,s,r){var n=t.utils.cubicPoly(e,i,s,r),o=n[0],a=n[1],h=(n[2],n[1]*n[1]-4*n[0]*n[2]),c=Math.min(r,e),l=Math.max(r,e);if(h>=0){var u=(-a+Math.sqrt(h))/(2*o);if(u>0&&u<1){var d=t.utils.evaluateT(e,i,s,r,u);d<c&&(c=d),d>l&&(l=d)}var p=(-a-Math.sqrt(h))/(2*o);if(p>0&&p<1){var f=t.utils.evaluateT(e,i,s,r,p);f<c&&(c=f),f>l&&(l=f)}}return{min:c,max:l}},getSubCurvePointsAt:function(t,e,i){var s=new o.Vector(t.getPointAt(e),t.getTangentAt(e)),r=new o.Vector(t.getPointAt(i),t.getTangentAt(i).inv());return s.b.add(s.a),r.b.add(r.a),s.scale(.33333333*(i-e)),r.scale(.33333333*(i-e)),[s.a,r.a,s.b,r.b]},cubicRoots:function(e){var i,s,r=e[0],n=e[1]/r,o=e[2]/r,a=e[3]/r,h=(3*o-Math.pow(n,2))/9,c=(9*n*o-27*a-2*Math.pow(n,3))/54,l=Math.pow(h,3)+Math.pow(c,2),u=[];if(l>=0)i=t.utils.sgn(c+Math.sqrt(l))*Math.pow(Math.abs(c+Math.sqrt(l)),1/3),s=t.utils.sgn(c-Math.sqrt(l))*Math.pow(Math.abs(c-Math.sqrt(l)),1/3),u[0]=-n/3+(i+s),u[1]=-n/3-(i+s)/2,u[2]=-n/3-(i+s)/2,0!=Math.abs(Math.sqrt(3)*(i-s)/2)&&(u[1]=-1,u[2]=-1);else{var d=Math.acos(c/Math.sqrt(-Math.pow(h,3)));u[0]=2*Math.sqrt(-h)*Math.cos(d/3)-n/3,u[1]=2*Math.sqrt(-h)*Math.cos((d+2*Math.PI)/3)-n/3,u[2]=2*Math.sqrt(-h)*Math.cos((d+4*Math.PI)/3)-n/3}return u.filter(function(t){return t>=0&&t<=1}).sort()},bezierCoeffs:function(t,e,i,s){var r=[NaN,NaN,NaN,NaN];return r[0]=3*e-t+-3*i+s,r[1]=3*t-6*e+3*i,r[2]=-3*t+3*e,r[3]=t,r},cubicPoly:function(t,e,i,s){return[3*s-9*i+9*e-3*t,6*t-12*e+6*i,3*e-3*t]},sgn:function(t){return t<0?-1:1}},t}();e.CubicBezierCurve=a}},e={};function i(s){var r=e[s];if(void 0!==r)return r.exports;var n=e[s]={exports:{}};return t[s].call(n.exports,n,n.exports,i),n.exports}i.d=(t,e)=>{for(var s in e)i.o(e,s)&&!i.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},globalThis.UIDGenerator=i(938).UIDGenerator,globalThis.VertexAttr=i(476).VertexAttr,globalThis.VertexListeners=i(934).VertexListeners,globalThis.Vertex=i(787).Vertex,globalThis.Bounds=i(76).Bounds,globalThis.Grid=i(289).Grid,globalThis.Line=i(939).Line,globalThis.Vector=i(30).Vector,globalThis.CubicBezierCurve=i(973).CubicBezierCurve,globalThis.BezierPath=i(733).BezierPath,globalThis.Polygon=i(687).Polygon,globalThis.Triangle=i(737).Triangle,globalThis.VEllipse=i(881).VEllipse,globalThis.VEllipseSector=i(719).VEllipseSector,globalThis.Circle=i(118).Circle,globalThis.CircleSector=i(135).CircleSector,globalThis.PBImage=i(862).PBImage,globalThis.PBText=i(628).PBText,globalThis.MouseHandler=i(912).MouseHandler,globalThis.KeyHandler=i(531).KeyHandler,globalThis.drawutils=i(39).drawutils,globalThis.drawutilssvg=i(378).drawutilssvg,globalThis.geomutils=i(328).geomutils,globalThis.PlotBoilerplate=i(559).PlotBoilerplate})();
1
+ (()=>{"use strict";var t={30:function(t,e,i){var s,r=this&&this.__extends||(s=function(t,e){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},s(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}s(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0}),e.Vector=void 0;var n=i(590),o=i(787),a=function(t){function e(i,s){var r=t.call(this,i,s,function(t,i){return new e(t,i)})||this;return r.className="Vector",r}return r(e,t),e.prototype.perp=function(){var t=this.clone();return t.sub(this.a),(t=new e(new o.Vertex,new o.Vertex(-t.b.y,t.b.x))).a.add(this.a),t.b.add(this.a),t},e.prototype.inverse=function(){var t=this.a;return this.a=this.b,this.b=t,this},e.prototype.inv=function(){return this.b.x=this.a.x-(this.b.x-this.a.x),this.b.y=this.a.y-(this.b.y-this.a.y),this},e.prototype.intersection=function(t){var e=this.denominator(t);if(0==e)return null;var i=this.a.y-t.a.y,s=this.a.x-t.a.x,r=(t.b.x-t.a.x)*i-(t.b.y-t.a.y)*s,n=(this.b.x-this.a.x)*i-(this.b.y-this.a.y)*s;return i=r/e,s=n/e,new o.Vertex(this.a.x+i*(this.b.x-this.a.x),this.a.y+i*(this.b.y-this.a.y))},e.prototype.getOrthogonal=function(){var t=this.a.clone(),i=this.b.clone().sub(this.a),s=i.x;return i.x=-i.y,i.y=s,new e(t,i.add(this.a))},e.prototype.rotate=function(t){return this.b.rotate(t,this.a),this},e.utils={buildArrowHead:function(t,e,i,s,r){var n=Math.atan2((e.y-t.y)*r,(e.x-t.x)*s),a=[];return a.push(new o.Vertex(e.x*s-i*Math.cos(n),e.y*r-i*Math.sin(n))),a.push(new o.Vertex(e.x*s-1.35*i*Math.cos(n-Math.PI/8),e.y*r-1.35*i*Math.sin(n-Math.PI/8))),a.push(new o.Vertex(e.x*s,e.y*r)),a.push(new o.Vertex(e.x*s-1.35*i*Math.cos(n+Math.PI/8),e.y*r-1.35*i*Math.sin(n+Math.PI/8))),a}},e}(n.VertTuple);e.Vector=a},39:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.drawutils=void 0;var s=i(973),r=i(787),n=i(378),o=i(30),a=function(){function t(t,e){this.ctx=t,this.offset=new r.Vertex(0,0),this.scale=new r.Vertex(1,1),this.fillShapes=e}return t.prototype.applyStrokeOpts=function(t){var e,i,s,r,n=this;this.ctx.setLineDash((null!==(e=null==t?void 0:t.dashArray)&&void 0!==e?e:[]).map(function(t){return t*n.scale.x})),this.ctx.lineDashOffset=(null!==(i=null==t?void 0:t.dashOffset)&&void 0!==i?i:0)*this.scale.x,this.ctx.lineJoin=null!==(s=null==t?void 0:t.lineJoin)&&void 0!==s?s:null,this.ctx.lineCap=null!==(r=null==t?void 0:t.lineCap)&&void 0!==r?r:null},t.prototype._fillOrDraw=function(t){this.fillShapes?(this.ctx.fillStyle=t,this.ctx.fill()):(this.ctx.strokeStyle=t,this.ctx.stroke())},t.prototype.beginDrawCycle=function(t){},t.prototype.endDrawCycle=function(t){},t.prototype.setConfiguration=function(t){this.ctx.globalCompositeOperation=t.blendMode||"source-over"},t.prototype.setCurrentId=function(t){},t.prototype.setCurrentClassName=function(t){},t.prototype.line=function(t,e,i,s,r){this.ctx.save(),this.ctx.beginPath(),this.applyStrokeOpts(r),this.ctx.moveTo(this.offset.x+t.x*this.scale.x,this.offset.y+t.y*this.scale.y),this.ctx.lineTo(this.offset.x+e.x*this.scale.x,this.offset.y+e.y*this.scale.y),this.ctx.strokeStyle=i,this.ctx.lineWidth=s||1,this.ctx.stroke(),this.ctx.restore()},t.prototype.arrow=function(t,e,i,s,n,o){void 0===n&&(n=8);var a=new r.Vertex(0,0);this.arrowHead(t,e,i,s,n,void 0,a),this.line(t,a,i,s,o)},t.prototype.cubicBezierArrow=function(t,e,i,s,n,o,a,h){var c=new r.Vertex(0,0);this.arrowHead(s,e,n,o,a,void 0,c);var l=c.difference(e);this.cubicBezier(t,{x:e.x-l.x,y:e.y-l.y},i,{x:s.x-l.x,y:s.y-l.y},n,o,h)},t.prototype.arrowHead=function(t,e,i,s,r,n,a){void 0===r&&(r=8),this.ctx.save(),this.ctx.beginPath(),this.applyStrokeOpts(n);var h=o.Vector.utils.buildArrowHead(t,e,r,this.scale.x,this.scale.y);a&&(a.x=h[0].x/this.scale.x,a.y=h[0].y/this.scale.y),this.ctx.moveTo(this.offset.x+h[0].x,this.offset.y+h[0].y);for(var c=0;c<h.length;c++)this.ctx.lineTo(this.offset.x+h[c].x,this.offset.y+h[c].y);this.ctx.lineTo(this.offset.x+h[0].x,this.offset.y+h[0].y),this.ctx.lineWidth=s||1,this._fillOrDraw(i),this.ctx.restore()},t.prototype.image=function(t,e,i,s){void 0===s&&(s=1),t.complete&&t.naturalWidth&&(this.ctx.save(),this.ctx.globalAlpha=s,this.ctx.drawImage(t,0,0,t.naturalWidth-1,t.naturalHeight-1,this.offset.x+e.x*this.scale.x,this.offset.y+e.y*this.scale.y,i.x*this.scale.x,i.y*this.scale.y),this.ctx.restore())},t.prototype.texturedPoly=function(e,i,s,n,o){var a=s.getBounds(),h=(new r.Vertex(n.x,n.y).difference(a.getCenter()),new r.Vertex(i.width,i.height)),c=new r.Vertex(i.min.x,i.min.y).sub(n);this.ctx.save(),this.ctx.translate(this.offset.x+n.x*this.scale.x,this.offset.y+n.y*this.scale.y),t.helpers.clipPoly(this.ctx,{x:-n.x*this.scale.x,y:-n.y*this.scale.y},this.scale,s.vertices),this.ctx.scale(this.scale.x,this.scale.y),this.ctx.rotate(o),this.ctx.drawImage(e,0,0,e.naturalWidth-1,e.naturalHeight-1,c.x,c.y,h.x,h.y),this.ctx.restore()},t.prototype.rect=function(t,e,i,s,r,n){this.ctx.save(),this.ctx.beginPath(),this.applyStrokeOpts(n),this.ctx.moveTo(this.offset.x+t.x*this.scale.x,this.offset.y+t.y*this.scale.y),this.ctx.lineTo(this.offset.x+(t.x+e)*this.scale.x,this.offset.y+t.y*this.scale.y),this.ctx.lineTo(this.offset.x+(t.x+e)*this.scale.x,this.offset.y+(t.y+i)*this.scale.y),this.ctx.lineTo(this.offset.x+t.x*this.scale.x,this.offset.y+(t.y+i)*this.scale.y),this.ctx.closePath(),this.ctx.lineWidth=r||1,this._fillOrDraw(s),this.ctx.restore()},t.prototype.bounds=function(t,e,i,s){this.rect(t.min,t.max.x-t.min.x,t.max.y-t.min.y,e,i,s)},t.prototype.cubicBezier=function(t,e,i,r,n,o,a){t instanceof s.CubicBezierCurve?this.cubicBezier(t.startPoint,t.endPoint,t.startControlPoint,t.endControlPoint,n,o):(this.ctx.save(),this.ctx.beginPath(),this.applyStrokeOpts(a),this.ctx.moveTo(this.offset.x+t.x*this.scale.x,this.offset.y+t.y*this.scale.y),this.ctx.bezierCurveTo(this.offset.x+i.x*this.scale.x,this.offset.y+i.y*this.scale.y,this.offset.x+r.x*this.scale.x,this.offset.y+r.y*this.scale.y,this.offset.x+e.x*this.scale.x,this.offset.y+e.y*this.scale.y),this.ctx.lineWidth=o||2,this._fillOrDraw(n),this.ctx.restore())},t.prototype.quadraticBezier=function(t,e,i,s,r,n){this.ctx.save(),this.ctx.beginPath(),this.applyStrokeOpts(n),this.ctx.moveTo(this.offset.x+t.x*this.scale.x,this.offset.y+t.y*this.scale.y),this.ctx.quadraticCurveTo(this.offset.x+e.x*this.scale.x,this.offset.y+e.y*this.scale.y,this.offset.x+i.x*this.scale.x,this.offset.y+i.y*this.scale.y),this.ctx.lineWidth=r||2,this._fillOrDraw(s),this.ctx.restore()},t.prototype.cubicBezierPath=function(t,e,i,s,r){if(t&&0!=t.length){var n,o,a;this.ctx.save(),this.ctx.beginPath(),this.applyStrokeOpts(s),this.ctx.moveTo(this.offset.x+t[0].x*this.scale.x,this.offset.y+t[0].y*this.scale.y);for(var h=1;h<t.length;h+=3)o=t[h],a=t[h+1],n=t[h+2],this.ctx.bezierCurveTo(this.offset.x+o.x*this.scale.x,this.offset.y+o.y*this.scale.y,this.offset.x+a.x*this.scale.x,this.offset.y+a.y*this.scale.y,this.offset.x+n.x*this.scale.x,this.offset.y+n.y*this.scale.y);r||this.ctx.closePath(),this.ctx.lineWidth=i||1,this._fillOrDraw(e),this.ctx.restore()}},t.prototype.handle=function(t,e){this.point(t,"rgb(0,32,192)"),this.square(e,5,"rgba(0,128,192,0.5)")},t.prototype.handleLine=function(t,e){this.line(t,e,"rgba(128,128,128, 0.5)",void 0)},t.prototype.dot=function(t,e){this.ctx.save(),this.ctx.beginPath(),this.ctx.setLineDash([]),this.ctx.moveTo(Math.round(this.offset.x+this.scale.x*t.x),Math.round(this.offset.y+this.scale.y*t.y)),this.ctx.lineTo(Math.round(this.offset.x+this.scale.x*t.x+1),Math.round(this.offset.y+this.scale.y*t.y+1)),this.ctx.closePath(),this.ctx.lineWidth=1,this._fillOrDraw(e),this.ctx.restore()},t.prototype.point=function(t,e){this.ctx.setLineDash([]),this.ctx.beginPath(),this.ctx.arc(this.offset.x+t.x*this.scale.x,this.offset.y+t.y*this.scale.y,3,0,2*Math.PI,!1),this.ctx.closePath(),this.ctx.lineWidth=1,this._fillOrDraw(e)},t.prototype.circle=function(t,e,i,s,r){this.applyStrokeOpts(r),this.ctx.beginPath(),this.ctx.ellipse(this.offset.x+t.x*this.scale.x,this.offset.y+t.y*this.scale.y,e*this.scale.x,e*this.scale.y,0,0,2*Math.PI),this.ctx.closePath(),this.ctx.lineWidth=s||1,this._fillOrDraw(i)},t.prototype.circleArc=function(t,e,i,s,r,n,o){o&&o.asSegment||this.ctx.beginPath(),this.applyStrokeOpts(o),this.ctx.ellipse(this.offset.x+t.x*this.scale.x,this.offset.y+t.y*this.scale.y,e*this.scale.x,e*this.scale.y,0,i,s,!1),o&&o.asSegment||(this.ctx.lineWidth=n||1,this._fillOrDraw(r||"#000000"))},t.prototype.ellipse=function(t,e,i,s,r,n,o){void 0===n&&(n=0),this.applyStrokeOpts(o),this.ctx.beginPath(),this.ctx.ellipse(this.offset.x+t.x*this.scale.x,this.offset.y+t.y*this.scale.y,e*this.scale.x,i*this.scale.y,n,0,2*Math.PI),this.ctx.closePath(),this.ctx.lineWidth=r||1,this._fillOrDraw(s)},t.prototype.square=function(t,e,i,s,r){this.applyStrokeOpts(r),this.ctx.beginPath(),this.ctx.rect(this.offset.x+(t.x-e/2)*this.scale.x,this.offset.y+(t.y-e/2)*this.scale.y,e*this.scale.x,e*this.scale.y),this.ctx.closePath(),this.ctx.lineWidth=s||1,this._fillOrDraw(i)},t.prototype.grid=function(t,e,i,s,r,n){this.ctx.setLineDash([]),this.ctx.beginPath();for(var o=-Math.ceil(.5*i/r)*r,a=i/2,h=-Math.ceil(.5*e/s)*s;h<e/2;h+=s)this.ctx.moveTo(this.offset.x+(t.x+h)*this.scale.x,this.offset.y+(t.y+o)*this.scale.y),this.ctx.lineTo(this.offset.x+(t.x+h)*this.scale.x,this.offset.y+(t.y+a)*this.scale.y);for(var c=-Math.ceil(.5*e/s)*s,l=e/2,u=-Math.ceil(.5*i/r)*r;u<i/2;u+=r)this.ctx.moveTo(this.offset.x+(t.x+c)*this.scale.x-4,this.offset.y+(t.y+u)*this.scale.y),this.ctx.lineTo(this.offset.x+(t.x+l)*this.scale.x+4,this.offset.y+(t.y+u)*this.scale.y);this.ctx.strokeStyle=n,this.ctx.lineWidth=1,this.ctx.stroke(),this.ctx.closePath()},t.prototype.raster=function(t,e,i,s,r,n){this.ctx.save(),this.ctx.setLineDash([]),this.ctx.beginPath();for(var o=-Math.ceil(.5*e/s)*s;o<e/2;o+=s)for(var a=-Math.ceil(.5*i/r)*r;a<i/2;a+=r)this.ctx.moveTo(this.offset.x+(t.x+o)*this.scale.x-4,this.offset.y+(t.y+a)*this.scale.y),this.ctx.lineTo(this.offset.x+(t.x+o)*this.scale.x+4,this.offset.y+(t.y+a)*this.scale.y),this.ctx.moveTo(this.offset.x+(t.x+o)*this.scale.x,this.offset.y+(t.y+a)*this.scale.y-4),this.ctx.lineTo(this.offset.x+(t.x+o)*this.scale.x,this.offset.y+(t.y+a)*this.scale.y+4);this.ctx.strokeStyle=n,this.ctx.lineWidth=1,this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()},t.prototype.diamondHandle=function(t,e,i){this.ctx.setLineDash([]),this.ctx.beginPath(),this.ctx.moveTo(this.offset.x+t.x*this.scale.x-e/2,this.offset.y+t.y*this.scale.y),this.ctx.lineTo(this.offset.x+t.x*this.scale.x,this.offset.y+t.y*this.scale.y-e/2),this.ctx.lineTo(this.offset.x+t.x*this.scale.x+e/2,this.offset.y+t.y*this.scale.y),this.ctx.lineTo(this.offset.x+t.x*this.scale.x,this.offset.y+t.y*this.scale.y+e/2),this.ctx.closePath(),this.ctx.lineWidth=1,this._fillOrDraw(i)},t.prototype.squareHandle=function(t,e,i){this.ctx.setLineDash([]),this.ctx.beginPath(),this.ctx.rect(this.offset.x+t.x*this.scale.x-e/2,this.offset.y+t.y*this.scale.y-e/2,e,e),this.ctx.closePath(),this.ctx.lineWidth=1,this._fillOrDraw(i)},t.prototype.circleHandle=function(t,e,i){e=e||3,this.ctx.setLineDash([]),this.ctx.beginPath(),this.ctx.arc(this.offset.x+t.x*this.scale.x,this.offset.y+t.y*this.scale.y,e,0,2*Math.PI,!1),this.ctx.closePath(),this.ctx.lineWidth=1,this._fillOrDraw(i)},t.prototype.crosshair=function(t,e,i,s){this.ctx.save(),this.ctx.setLineDash([]),this.ctx.beginPath(),this.ctx.moveTo(this.offset.x+t.x*this.scale.x-e,this.offset.y+t.y*this.scale.y),this.ctx.lineTo(this.offset.x+t.x*this.scale.x+e,this.offset.y+t.y*this.scale.y),this.ctx.moveTo(this.offset.x+t.x*this.scale.x,this.offset.y+t.y*this.scale.y-e),this.ctx.lineTo(this.offset.x+t.x*this.scale.x,this.offset.y+t.y*this.scale.y+e),this.ctx.strokeStyle=i,this.ctx.lineWidth=s||.5,this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()},t.prototype.cross=function(t,e,i,s){this.ctx.save(),this.ctx.setLineDash([]),this.ctx.beginPath(),this.ctx.moveTo(this.offset.x+t.x*this.scale.x-e,this.offset.y+t.y*this.scale.y-e),this.ctx.lineTo(this.offset.x+t.x*this.scale.x+e,this.offset.y+t.y*this.scale.y+e),this.ctx.moveTo(this.offset.x+t.x*this.scale.x-e,this.offset.y+t.y*this.scale.y+e),this.ctx.lineTo(this.offset.x+t.x*this.scale.x+e,this.offset.y+t.y*this.scale.y-e),this.ctx.strokeStyle=i,this.ctx.lineWidth=s||1,this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()},t.prototype.polygon=function(t,e,i,s){this.polyline(t.vertices,t.isOpen,e,i,s)},t.prototype.polyline=function(t,e,i,s,r){if(!(t.length<=1)){this.ctx.save(),this.applyStrokeOpts(r),this.ctx.beginPath(),this.ctx.lineWidth=s||1,this.ctx.moveTo(this.offset.x+t[0].x*this.scale.x,this.offset.y+t[0].y*this.scale.y);for(var n=0;n<t.length;n++)this.ctx.lineTo(this.offset.x+t[n].x*this.scale.x,this.offset.y+t[n].y*this.scale.y);e||this.ctx.closePath(),this._fillOrDraw(i),this.ctx.closePath(),this.ctx.setLineDash([]),this.ctx.restore()}},t.prototype.text=function(t,e,i,s){var r,n,o;s=s||{},this.ctx.save();var a=this.offset.x+e*this.scale.x,h=this.offset.y+i*this.scale.y,c=s.color||"black";(s.fontSize||s.fontFamily)&&(this.ctx.font=(s.fontWeight?s.fontWeight+" ":"")+(s.fontStyle?s.fontStyle+" ":"")+(s.fontSize?s.fontSize*this.scale.x+"px ":" ")+(s.fontFamily?-1===s.fontFamily.indexOf(" ")?s.fontFamily:'"'.concat(s.fontFamily,'"'):"Arial")),s.textAlign&&(this.ctx.textAlign=s.textAlign);var l=null!==(r=s.rotation)&&void 0!==r?r:0,u=(null!==(o=null!==(n=s.lineHeight)&&void 0!==n?n:s.fontSize)&&void 0!==o?o:0)*this.scale.x;this.ctx.translate(a,h),this.ctx.rotate(l),this.fillShapes?(this.ctx.fillStyle=c,this.ctx.fillText(t,0,u/2)):(this.ctx.strokeStyle=c,this.ctx.strokeText(t,0,u/2)),this.ctx.restore()},t.prototype.label=function(t,e,i,s,r){this.ctx.save(),this.ctx.font="lighter 9pt Arial",this.ctx.translate(e,i),void 0!==s&&this.ctx.rotate(s),this.ctx.fillStyle=r||"black",this.fillShapes?this.ctx.fillText(t,0,0):this.ctx.strokeText(t,0,0),this.ctx.restore()},t.prototype.path=function(t,e,i,s){var r=s&&s.inplace?t:n.drawutilssvg.copyPathData(t);n.drawutilssvg.transformPathData(r,this.offset,this.scale),e&&(this.ctx.strokeStyle=e),this.ctx.lineWidth=i||1,this.applyStrokeOpts(s),this.fillShapes?(e&&(this.ctx.fillStyle=e),this.ctx.fill(new Path2D(r.join(" ")))):(e&&(this.ctx.strokeStyle=e),this.ctx.stroke(new Path2D(r.join(" "))))},t.prototype.clear=function(t){this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.fillStyle=t,this.ctx.fillRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height)},t.helpers={clipPoly:function(t,e,i,s){t.beginPath(),t.moveTo(e.x+s[0].x*i.x,e.y+s[0].y*i.y);for(var r=1;r<s.length;r++){var n=s[r];t.lineTo(e.x+n.x*i.x,e.y+n.y*i.y)}t.closePath(),t.clip()}},t}();e.drawutils=a},76:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Bounds=void 0;var s=i(687),r=i(787),n=function(){function t(t,e){this.min=t,this.max=e,this.width=e.x-t.x,this.height=e.y-t.y}return t.prototype.containsVert=function(t){return this.min.x<=t.x&&t.x<this.max.x&&this.min.y<=t.y&&t.y<this.max.y},t.prototype.getWidth=function(){return this.max.x-this.min.x},t.prototype.getHeight=function(){return this.max.y-this.min.y},t.prototype.getScaled=function(e){var i=this.getCenter();return new t(new r.Vertex(this.min).scale(e,i),new r.Vertex(this.max).scale(e,i))},t.prototype.getMoved=function(e){return new t(new r.Vertex(this.min).move(e),new r.Vertex(this.max).move(e))},t.prototype.getNorthPoint=function(){return new r.Vertex(this.min.x+this.width/2,this.min.y)},t.prototype.getSouthPoint=function(){return new r.Vertex(this.min.x+this.width/2,this.max.y)},t.prototype.getWestPoint=function(){return new r.Vertex(this.min.x,this.min.y+this.height/2)},t.prototype.getEastPoint=function(){return new r.Vertex(this.max.x,this.min.y+this.height/2)},t.prototype.getNorthWestPoint=function(){return new r.Vertex(this.min.x,this.min.y)},t.prototype.getNorthEastPoint=function(){return new r.Vertex(this.max.x,this.min.y)},t.prototype.getSouthEastPoint=function(){return new r.Vertex(this.max.x,this.max.y)},t.prototype.getSouthWestPoint=function(){return new r.Vertex(this.min.x,this.max.y)},t.prototype.toPolygon=function(){return new s.Polygon([new r.Vertex(this.min),new r.Vertex(this.max.x,this.min.y),new r.Vertex(this.max),new r.Vertex(this.min.x,this.max.y)],!1)},t.prototype.getCenter=function(){return new r.Vertex(this.min.x+(this.max.x-this.min.x)/2,this.min.y+(this.max.y-this.min.y)/2)},t.prototype.getMinDimension=function(){return Math.min(this.width,this.height)},t.prototype.getMaxDimension=function(){return Math.max(this.width,this.height)},t.prototype.randomPoint=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0);var i=t>0&&t<1?this.width*t:t,s=e>0&&e<1?this.height*e:e;return new r.Vertex(this.min.x+i+Math.random()*(this.width-2*i),this.min.y+s+Math.random()*(this.height-2*s))},t.prototype.toString=function(){return"{ min: ".concat(this.min.toString(),", max : ").concat(this.max.toString(),", width: ").concat(this.width,", height : ").concat(this.height," }")},t.prototype.clone=function(){return new t({x:this.min.x,y:this.min.y},{x:this.max.x,y:this.max.y})},t.computeFromVertices=function(e){if(0==e.length)return new t(new r.Vertex(0,0),new r.Vertex(0,0));var i,s=e[0].x,n=e[0].x,o=e[0].y,a=e[0].y;for(var h in e)i=e[h],s=Math.min(s,i.x),n=Math.max(n,i.x),o=Math.min(o,i.y),a=Math.max(a,i.y);return new t(new r.Vertex(s,o),new r.Vertex(n,a))},t.computeFromBoundsSet=function(e){if(0==e.length)return new t(new r.Vertex(0,0),new r.Vertex(0,0));var i,s=e[0].min.x,n=e[0].max.x,o=e[0].min.y,a=e[0].min.y;for(var h in e)i=e[h],s=Math.min(s,i.min.x),n=Math.max(n,i.max.x),o=Math.min(o,i.min.y),a=Math.max(a,i.min.y);return new t(new r.Vertex(s,o),new r.Vertex(n,a))},t.fromDimension=function(e,i,s){return new t(null!=s?s:{x:0,y:0},{x:(s?s.x:0)+e,y:(s?s.y:0)+i})},t}();e.Bounds=n},118:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Circle=void 0;var s=i(76),r=i(939),n=i(938),o=i(30),a=i(787),h=function(){function t(t,e){this.className="Circle",this.uid=n.UIDGenerator.next(),this.center=t,this.radius=e}return t.prototype.move=function(t){return this.center.add(t),this},t.prototype.containsPoint=function(t){return this.center.distance(t)<this.radius},t.prototype.containsCircle=function(t){return this.center.distance(t.center)+t.radius<this.radius},t.prototype.lineDistance=function(t){return t.getClosestPoint(this.center).distance(this.center)-this.radius},t.prototype.vertAt=function(e){return t.circleUtils.vertAt(e,this.radius).add(this.center)},t.prototype.tangentAt=function(e){var i=t.circleUtils.vertAt(e,this.radius);return new o.Vector(i,new a.Vertex(0,0)).add(this.center).perp()},t.prototype.getBounds=function(){return new s.Bounds(this.center.clone().subXY(Math.abs(this.radius),Math.abs(this.radius)),this.center.clone().addXY(Math.abs(this.radius),Math.abs(this.radius)))},t.prototype.circleIntersection=function(t){if(this.center.distance(t.center)>this.radius+t.radius)return null;if(this.center.distance(t.center)<Math.abs(this.radius-t.radius))return null;var e=this.center,i=t.center,s=e.distance(i),n=(this.radius*this.radius-t.radius*t.radius+s*s)/(2*s),o=Math.sqrt(this.radius*this.radius-n*n),h=i.clone().scale(n/s,e),c=h.x+o*(i.y-e.y)/s,l=h.y-o*(i.x-e.x)/s,u=h.x-o*(i.y-e.y)/s,d=h.y+o*(i.x-e.x)/s;return new r.Line(new a.Vertex(c,l),new a.Vertex(u,d))},t.prototype.lineIntersection=function(t,e){var i=new a.Vertex,s=new a.Vertex,n=new a.Vertex(t).sub(this.center),o=new a.Vertex(e).sub(this.center),h=n.difference(o);0===Math.abs(h.y)&&(h.y=1e-6);var c=n.distance(o),l=n.x*o.y-n.y*o.x,u=c*c;if(this.radius*this.radius*u-l*l<0)return null;var d=this.radius*this.radius*c*c-l*l,p=Math.sqrt(d);return i.x=(l*h.y+Math.sign(h.y)*h.x*p)/u,s.x=(l*h.y-Math.sign(h.y)*h.x*p)/u,i.y=(-l*h.x+Math.abs(h.y)*p)/u,s.y=(-l*h.x-Math.abs(h.y)*p)/u,new r.Line(i.add(this.center),s.add(this.center))},t.prototype.lineIntersections=function(t,e){void 0===e&&(e=!1);var i=this.lineIntersection(t.a,t.b);return i?e?[i.a,i.b].filter(function(e){return t.hasPoint(e,!0)}):[i.a,i.b]:[]},t.prototype.lineIntersectionTangents=function(t,e){var i=this;return void 0===e&&(e=!1),this.lineIntersections(t,e).map(function(t){var e=new r.Line(i.center,t).angle();return i.tangentAt(e)})},t.prototype.closestPoint=function(t){var e=this.lineIntersection(this.center,t);return e?e.a.distance(t)<e.b.distance(t)?e.a:e.b:new a.Vertex},t.prototype.destroy=function(){this.center.destroy(),this.isDestroyed=!0},t.circleUtils={vertAt:function(t,e){return new a.Vertex(Math.cos(t)*e,Math.sin(t)*e)}},t}();e.Circle=h},135:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CircleSector=void 0;var s=i(76),r=i(118),n=i(939),o=i(938),a=i(787),h=i(328),c=function(){function t(t,e,i){this.className="CircleSector",this.uid=o.UIDGenerator.next(),this.circle=t,this.startAngle=e,this.endAngle=i}return t.prototype.getBounds=function(){var t=this,e=this.circle.getBounds(),i=[e.getNorthPoint(),e.getSouthPoint(),e.getWestPoint(),e.getEastPoint()].filter(function(e){var i=new n.Line(t.circle.center,e).angle();return t.containsAngle(i)});return s.Bounds.computeFromVertices(i.concat([this.getStartPoint(),this.getEndPoint()]))},t.prototype.move=function(t){return this.circle.move(t),this},t.prototype.containsAngle=function(t){var e=h.geomutils.mapAngleTo2PI(t),i=h.geomutils.mapAngleTo2PI(this.startAngle),s=h.geomutils.mapAngleTo2PI(this.endAngle);return i<=s?e>=i&&e<s:e>=i||e<s},t.prototype.angleAt=function(t){return this.startAngle<=this.endAngle?(this.startAngle+(this.endAngle-this.startAngle)*t)%(2*Math.PI):(this.startAngle+(2*Math.PI-this.startAngle+this.endAngle)*t)%(2*Math.PI)},t.prototype.getStartPoint=function(){return this.circle.vertAt(this.startAngle)},t.prototype.getEndPoint=function(){return this.circle.vertAt(this.endAngle)},t.prototype.circleSectorIntersection=function(e){var i=this.circle.circleIntersection(e.circle);if(!i)return null;var s=this.circle.center.angle(i.a),n=this.circle.center.angle(i.b);if(!this.containsAngle(s)||!this.containsAngle(n))return null;var o=e.circle.center.angle(i.a),a=e.circle.center.angle(i.b);if(!e.containsAngle(o)||!e.containsAngle(a))return null;var h=new t(this.circle,this.endAngle,this.startAngle).angleAt(.5),c=new t(new r.Circle(this.circle.center.clone(),this.circle.radius),s,n);return c.containsAngle(h)&&(c.startAngle=n,c.endAngle=s),c},t.prototype.lineIntersections=function(t,e){var i=this;void 0===e&&(e=!1);var s=this.circle.lineIntersections(t,e),r=new n.Line(this.circle.center,new a.Vertex);return s.filter(function(t){r.b.set(t);var e=r.angle();return i.containsAngle(h.geomutils.wrapMinMax(e,0,2*Math.PI))})},t.prototype.lineIntersectionTangents=function(t,e){var i=this;return void 0===e&&(e=!1),this.lineIntersections(t,e).map(function(t){var e=new n.Line(i.circle.center,t).angle();return i.circle.tangentAt(e)})},t.prototype.describeSVGPath=function(e){return t.circleSectorUtils.describeSVGArc(this.circle.center.x,this.circle.center.y,this.circle.radius,this.startAngle,this.endAngle,e)},t.prototype.destroy=function(){this.circle.destroy(),this.isDestroyed=!0},t.circleSectorUtils={polarToCartesian:function(t,e,i,s){return{x:t+i*Math.cos(s),y:e+i*Math.sin(s)}},describeSVGArc:function(e,i,s,r,n,o){void 0===o&&(o={moveToStart:!0});var a=t.circleSectorUtils.polarToCartesian(e,i,s,n),h=t.circleSectorUtils.polarToCartesian(e,i,s,r);if(2*Math.PI-Math.abs(r-n)<.001){var c=t.circleSectorUtils.describeSVGArc(e,i,s,r,r+(n-r)/2,o),l=t.circleSectorUtils.describeSVGArc(e,i,s,r+(n-r)/2,n,o);return c.concat(l)}var u,d,p=n-r;p<0?(u=Math.abs(p)<Math.PI?1:0,d=1):(u=Math.abs(p)>Math.PI?1:0,d=1);var f=[];return o.moveToStart&&f.push("M",h.x,h.y),f.push("A",s,s,0,u,d,a.x,a.y),f}},t}();e.CircleSector=c},264:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.drawutilsgl=void 0;var s=i(787),r=function(){function t(e,i){this.gl=e,this.offset=new s.Vertex(0,0),this.scale=new s.Vertex(1,1),this.fillShapes=i,this._zindex=0,null!=e&&void 0!==e&&(this.glutils=new n(e),this._vertShader=this.glutils.compileShader(t.vertCode,this.gl.VERTEX_SHADER),this._fragShader=this.glutils.compileShader(t.fragCode,this.gl.FRAGMENT_SHADER),this._program=this.glutils.makeProgram(this._vertShader,this._fragShader),this.vertex_buffer=this.gl.createBuffer(),console.log("gl initialized"))}return t.prototype._x2rel=function(t){return(this.scale.x*t+this.offset.x)/this.gl.canvas.width*2-1},t.prototype._y2rel=function(t){return(this.offset.y-this.scale.y*t)/this.gl.canvas.height*2-1},t.prototype.copyInstance=function(e){var i=new t(null,e);return i.gl=this.gl,i.glutils=this.glutils,i._vertShader=this._vertShader,i._fragShader=this._fragShader,i._program=this._program,i},t.prototype.beginDrawCycle=function(t){this._zindex=0,this.renderTime=t},t.prototype.endDrawCycle=function(t){},t.prototype.setConfiguration=function(t){},t.prototype.setCurrentId=function(t){this.curId=t},t.prototype.setCurrentClassName=function(t){},t.prototype.line=function(t,e,i){var s=new Float32Array(6);s[0]=this._x2rel(t.x),s[1]=this._y2rel(t.y),s[2]=this._zindex,s[3]=this._x2rel(e.x),s[4]=this._y2rel(e.y),s[5]=this._zindex,this._zindex+=.001,this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertex_buffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,s,this.gl.STATIC_DRAW);var r=this.gl.getAttribLocation(this._program,"position");this.gl.vertexAttribPointer(r,3,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(r),this.gl.viewport(0,0,this.gl.canvas.width,this.gl.canvas.height);var n=this.gl.getUniformLocation(this._program,"uRotationVector");this.gl.uniform2fv(n,[0,1]),this.gl.lineWidth(5),this.gl.drawArrays(this.gl.LINES,0,s.length/3)},t.prototype.arrow=function(t,e,i){},t.prototype.cubicBezierArrow=function(t,e,i,s,r,n,o){},t.prototype.arrowHead=function(t,e,i,s,r){},t.prototype.image=function(t,e,i,s){void 0===s&&(s=0)},t.prototype.texturedPoly=function(t,e,i,s,r){},t.prototype._fillOrDraw=function(t){},t.prototype.cubicBezier=function(t,e,i,s,r,n){},t.prototype.cubicBezierPath=function(t,e,i,s,r){},t.prototype.handle=function(t,e){},t.prototype.handleLine=function(t,e){},t.prototype.dot=function(t,e){},t.prototype.point=function(t,e){},t.prototype.circle=function(t,e,i,s){},t.prototype.circleArc=function(t,e,i,s,r,n){},t.prototype.ellipse=function(t,e,i,s,r,n){},t.prototype.square=function(t,e,i,s){},t.prototype.rect=function(t,e,i,s,r,n){},t.prototype.bounds=function(t,e,i,s){this.rect(t.min,t.max.x-t.min.x,t.max.y-t.min.y,e,i,s)},t.prototype.grid=function(t,e,i,s,r,n){},t.prototype.raster=function(t,e,i,s,r,n){},t.prototype.diamondHandle=function(t,e,i){},t.prototype.squareHandle=function(t,e,i){},t.prototype.circleHandle=function(t,e,i){},t.prototype.crosshair=function(t,e,i,s){},t.prototype.cross=function(t,e,i,s){},t.prototype.polygon=function(t,e,i){for(var s=new Float32Array(3*t.vertices.length),r=0;r<t.vertices.length;r++)s[3*r+0]=this._x2rel(t.vertices[r].x),s[3*r+1]=this._y2rel(t.vertices[r].y),s[3*r+2]=this._zindex;this._zindex+=.001,this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertex_buffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,s,this.gl.STATIC_DRAW);var n=this.gl.getAttribLocation(this._program,"position");this.gl.vertexAttribPointer(n,3,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(n),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,null),this.gl.viewport(0,0,this.gl.canvas.width,this.gl.canvas.height);var o=this.gl.getUniformLocation(this._program,"uRotationVector");this.gl.uniform2fv(o,[0,1]),this.gl.drawArrays(this.gl.TRIANGLE_FAN,0,s.length/3)},t.prototype.polyline=function(t,e,i,s){},t.prototype.text=function(t,e,i,s){},t.prototype.label=function(t,e,i,s,r){},t.prototype.path=function(t,e,i,s){},t.prototype.clear=function(t){this.gl.clearColor(1,1,1,1),this.gl.enable(this.gl.DEPTH_TEST),this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT)},t.vertCode="\n precision mediump float;\n\n attribute vec3 position;\n\n uniform vec2 uRotationVector;\n\n void main(void) {\n\tvec2 rotatedPosition = vec2(\n\t position.x * uRotationVector.y +\n\t\tposition.y * uRotationVector.x,\n\t position.y * uRotationVector.y -\n\t\tposition.x * uRotationVector.x\n\t);\n\n\tgl_Position = vec4(rotatedPosition, position.z, 1.0);\n }",t.fragCode="\n precision highp float;\n\n void main(void) {\n\tgl_FragColor = vec4(0.0,0.75,1.0,1.0);\n }",t}();e.drawutilsgl=r;var n=function(){function t(t){this.gl=t}return t.prototype.bufferData=function(t){var e=this.gl.createBuffer();return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,e),this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,null),e},t.prototype.compileShader=function(t,e){var i=this.gl.createShader(e);return this.gl.shaderSource(i,t),this.gl.compileShader(i),this.gl.getShaderParameter(i,this.gl.COMPILE_STATUS)?i:(console.warn("Error in shader:"+this.gl.getShaderInfoLog(i)),this.gl.deleteShader(i),null)},t.prototype.makeProgram=function(t,e){var i=this.gl.createProgram();return this.gl.attachShader(i,t),this.gl.attachShader(i,e),this.gl.linkProgram(i),this.gl.useProgram(i),this.gl.detachShader(i,t),this.gl.detachShader(i,e),this.gl.deleteShader(t),this.gl.deleteShader(e),i},t}()},289:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Grid=void 0;var i=function(){function t(t,e){this.center=t,this.size=e}return t.utils={baseLog:function(t,e){return Math.log(t)/Math.log(e)},mapRasterScale:function(e,i){var s=1;return i>=1?(s=Math.abs(Math.floor(1/t.utils.baseLog(e,i))),s=1/Math.pow(e,s)):s=Math.abs(Math.floor(t.utils.baseLog(1/e,1/(i+1)))),s}},t}();e.Grid=i},328:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.geomutils=void 0;var s=i(939),r=i(737);e.geomutils={mapAngleTo2PI:function(t){var e=Math.asin(Math.sin(t));return Math.cos(t)<0?Math.PI-e:e<0?e+2*Math.PI:e},dist4:function(t,e,i,s){return Math.sqrt(Math.pow(i-t,2)+Math.pow(e-s,2))},dotProduct:function(t,e){return t.x*e.x+t.y*e.y},nsectAngle:function(t,e,i,n){var o=new r.Triangle(t,e,i),a=new s.Line(t,e),h=new s.Line(t,i),c=a.angle(h),l=o.determinant()>0;c<0&&(c=2*Math.PI+c),l||(c=-1*(2*Math.PI-c));for(var u=Math.max(a.length(),h.length())/a.length(),d=[],p=1;p<n;p++)d.push(new s.Line(t,e.clone().rotate(c/n*-p,t)).scale(u));return d},wrapMax:function(t,e){return(e+t%e)%e},wrapMinMax:function(t,i,s){return i+e.geomutils.wrapMax(t-i,s-i)}}},378:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.drawutilssvg=void 0;var s=i(135),r=i(973),n=i(787),o=i(938),a=i(30),h=180/Math.PI,c=function(){function t(t,e,i,s,r,o,a,h,c,l,u,d){if(this.svgNode=t,this.offset=new n.Vertex(0,0).set(e),this.scale=new n.Vertex(1,1).set(i),this.fillShapes=r,this.isSecondary=Boolean(a),this.drawConfig=o,this.drawlibConfiguration={},this.cache=new Map,this.setSize(s),a){if(!(h&&c&&l&&u))throw"Cannot create secondary svg draw lib with undefinde gNode|bufferGNode|nodeDefs|bufferNodeDefs.";this.gNode=h,this.bufferGNode=c,this.nodeDefs=l,this.bufferedNodeDefs=u,d&&(this.nodeStyle=d)}else this.addStyleDefs(o),this.addDefsNode(),this.gNode=this.createSVGNode("g"),this.bufferGNode=this.createSVGNode("g"),this.svgNode.appendChild(this.gNode)}return t.prototype.addStyleDefs=function(t){this.nodeStyle=this.createSVGNode("style"),this.svgNode.appendChild(this.nodeStyle),this.rebuildStyleDefs(t)},t.prototype.rebuildStyleDefs=function(t){var e={bezier:"CubicBezierCurve",polygon:"Polygon",triangle:"Triangle",ellipse:"Ellipse",ellipseSector:"EllipseSector",circle:"Circle",circleSector:"CircleSector",vertex:"Vertex",line:"Line",vector:"Vector",image:"Image",text:"Text"},i=[];for(var s in e){var r=e[s],n=t[s];n?i.push(".".concat(r," { fill : none; stroke: ").concat(n.color,"; stroke-width: ").concat(n.lineWidth,"px }")):console.warn("Warning: your draw config is missing the key '".concat(s,"' which is required."))}this.customStyleDefs&&(i.push("\n/* Custom styles */\n"),this.customStyleDefs.forEach(function(t,e){i.push(e+" { "+t+" }")})),this.nodeStyle.innerHTML=i.join("\n")},t.prototype.addDefsNode=function(){this.nodeDefs=this.createSVGNode("defs"),this.bufferedNodeDefs=this.createSVGNode("defs"),this.svgNode.appendChild(this.nodeDefs)},t.prototype.addCustomStyleDefs=function(t){this.customStyleDefs=t},t.prototype.findElement=function(t,e){if(!t)return null;var i=this.cache.get(t);return i&&i.nodeName.toUpperCase()===e.toUpperCase()?(this.cache.delete(t),i):null},t.prototype.createSVGNode=function(t){return document.createElementNS("http://www.w3.org/2000/svg",t)},t.prototype.makeNode=function(t){var e=this.findElement(this.curId,t);if(e||(e=this.createSVGNode(t)),this.drawlibConfiguration.blendMode){var i=e.style["mix-blend-mode"];"function"==typeof i?i(this.drawlibConfiguration.blendMode):e.style["mix-blend-mode"]=this.drawlibConfiguration.blendMode}return e},t.prototype._bindFillDraw=function(t,e,i,s,r){return this._configureNode(t,e,this.fillShapes,i,s,r),this._bindNode(t,void 0)},t.prototype._bindNode=function(t,e){return t.parentNode||(null!=e?e:this.bufferGNode).appendChild(t),t},t.prototype._addCSSClasses=function(t,e){this.curClassName?t.setAttribute("class","".concat(e," ").concat(this.curClassName)):t.setAttribute("class",e)},t.prototype._configureNode=function(t,e,i,s,r,n){return this._addCSSClasses(t,e),t.setAttribute("fill",i&&s?s:"none"),t.setAttribute("stroke",i?"none":s||"none"),t.setAttribute("stroke-width","".concat(r||1)),this.curId&&t.setAttribute("id","".concat(this.curId)),this.applyStrokeOpts(t,n),t},t.prototype.setSize=function(t){this.canvasSize=t,this.svgNode.setAttribute("viewBox","0 0 ".concat(this.canvasSize.width," ").concat(this.canvasSize.height)),this.svgNode.setAttribute("width","".concat(this.canvasSize.width)),this.svgNode.setAttribute("height","".concat(this.canvasSize.height))},t.prototype.copyInstance=function(e){return new t(this.svgNode,this.offset,this.scale,this.canvasSize,e,this.drawConfig,!0,this.gNode,this.bufferGNode,this.nodeDefs,this.bufferedNodeDefs,this.nodeStyle)},t.prototype.setConfiguration=function(t){this.drawlibConfiguration=t},t.prototype.setCurrentId=function(t){this.curId=t},t.prototype.setCurrentClassName=function(t){this.curClassName=t},t.prototype.beginDrawCycle=function(t){this.cache.clear();for(var e=0;e<this.bufferGNode.childNodes.length;e++){var i=this.bufferGNode.childNodes[e];this.cache.set(i.getAttribute("id"),i)}this.removeAllChildNodes()},t.prototype.endDrawCycle=function(t){this.rebuildStyleDefs(this.drawConfig),this.isSecondary||(this.svgNode.replaceChild(this.bufferedNodeDefs,this.nodeDefs),this.svgNode.replaceChild(this.bufferGNode,this.gNode));var e=this.gNode;this.gNode=this.bufferGNode,this.bufferGNode=e;var i=this.nodeDefs;this.nodeDefs=this.bufferedNodeDefs,this.bufferedNodeDefs=i},t.prototype.applyStrokeOpts=function(e,i){var s=this;i&&i.dashArray&&i.dashArray.length>0&&t.nodeSupportsLineDash(e.tagName)&&(e.setAttribute("stroke-dasharray",i.dashArray.map(function(t){return t*s.scale.x}).join(" ")),i.dashOffset&&e.setAttribute("stroke-dashoffset","".concat(i.dashOffset*this.scale.x))),i&&i.lineJoin&&t.nodeSupportsLineJoin(e.tagName)&&e.setAttribute("stroke-linejoin",i.lineJoin),i&&i.lineCap&&t.nodeSupportsLineCap(e.tagName)&&e.setAttribute("stroke-linecap",i.lineCap)},t.prototype._x=function(t){return this.offset.x+this.scale.x*t},t.prototype._y=function(t){return this.offset.y+this.scale.y*t},t.prototype.line=function(t,e,i,s,r){var n=this.makeLineNode(t,e,i,s,r);return this._bindFillDraw(n,"line",i,s||1,r)},t.prototype.arrow=function(t,e,i,s,r,n){void 0===r&&(r=8);var o=this.makeNode("g"),a={x:0,y:0},h=this.makeArrowHeadNode(t,e,i,s,r,void 0,a),c=this.makeLineNode(t,a,i,s,n);return o.appendChild(c),o.appendChild(h),this._addCSSClasses(o,"linear-arrow"),this._bindNode(o,void 0),o},t.prototype.cubicBezierArrow=function(t,e,i,s,r,o,a,h){void 0===a&&(a=8);var c=this.makeNode("g"),l=new n.Vertex(0,0),u=this.makeArrowHeadNode(s,e,r,o,a,void 0,l),d=l.difference(e),p=this.makeCubicBezierNode(t,{x:e.x-d.x,y:e.y-d.y},i,{x:s.x-d.x,y:s.y-d.y},r,o,h);return c.appendChild(p),c.appendChild(u),this._addCSSClasses(c,"cubicbezier-arrow"),this._bindNode(c,void 0),c},t.prototype.arrowHead=function(t,e,i,s,r,n){void 0===r&&(r=8);var o=this.makeArrowHeadNode(t,e,i,s,r,n);return this._bindFillDraw(o,"arrowhead",i,s||1,n)},t.prototype.image=function(t,e,i,s){var r=this;void 0===s&&(s=1);var n=this.makeNode("image"),o=function(t){if(t.naturalWidth){var o=i.x/t.naturalWidth,a=i.y/t.naturalHeight;n.setAttribute("width","".concat(t.naturalWidth*r.scale.x)),n.setAttribute("height","".concat(t.naturalHeight*r.scale.y)),n.setAttribute("display",null),n.setAttribute("opacity","".concat(s)),n.setAttribute("transform","translate(".concat(r._x(e.x)," ").concat(r._y(e.y),") scale(").concat(o," ").concat(a,")"))}};return t.addEventListener("load",function(e){o(t)}),n.setAttribute("x","".concat(0)),n.setAttribute("y","".concat(0)),n.setAttribute("display","none"),o(t),n.setAttribute("href",t.src),this._bindFillDraw(n,"image",null,null)},t.prototype.texturedPoly=function(t,e,i,s,r){var a=new n.Vertex(e.min).clone().rotate(r,s),c=this.makeNode("clipPath"),l="clippath_".concat(o.UIDGenerator.next());c.setAttribute("id",l);var u=this.makeNode("g"),d=this.makeNode("image");d.setAttribute("x","".concat(this._x(a.x))),d.setAttribute("y","".concat(this._y(a.y))),d.setAttribute("width","".concat(e.width)),d.setAttribute("height","".concat(e.height)),d.setAttribute("href",t.src),d.setAttribute("transform","rotate(".concat(r*h,", ").concat(this._x(a.x),", ").concat(this._y(a.y),")"));var p=this.makeNode("path"),f=[];if(i.vertices.length>0){f.push("M","".concat(this._x(i.vertices[0].x)),"".concat(this._y(i.vertices[0].y)));for(var y=1;y<i.vertices.length;y++)f.push("L","".concat(this._x(i.vertices[y].x)),"".concat(this._y(i.vertices[y].y)))}p.setAttribute("d",f.join(" ")),c.appendChild(p),this.bufferedNodeDefs.appendChild(c),u.appendChild(d),u.setAttribute("transform-origin","".concat(this._x(a.x)," ").concat(this._y(a.y))),u.setAttribute("transform","scale(".concat(this.scale.x,", ").concat(this.scale.y,")"));var v=this.makeNode("g");return v.appendChild(u),v.setAttribute("clip-path","url(#".concat(l,")")),this._bindFillDraw(v,"image",null,null),v},t.prototype.cubicBezier=function(t,e,i,s,r,n,o){var a=this.makeCubicBezierNode(t,e,i,s,r,n,o);return this._bindNode(a,void 0)},t.prototype.cubicBezierPath=function(t,e,i,s,r){var n=this.makeNode("path");if(this.applyStrokeOpts(n,s),!t||0==t.length)return n;for(var o,a,h,c=["M",this._x(t[0].x),this._y(t[0].y)],l=1;l<t.length;l+=3)a=t[l],h=t[l+1],o=t[l+2],c.push("C",this._x(a.x),this._y(a.y),this._x(h.x),this._y(h.y),this._x(o.x),this._y(o.y));return r||c.push("Z"),n.setAttribute("d",c.join(" ")),this._bindFillDraw(n,"cubicBezierPath",e,i||1)},t.prototype.handle=function(t,e){this.point(t,"rgb(0,32,192)"),this.square(e,5,"rgba(0,128,192,0.5)")},t.prototype.handleLine=function(t,e){this.line(t,e,"rgb(128,128,128,0.5)")},t.prototype.dot=function(t,e){var i=this.makeNode("line");return i.setAttribute("x1","".concat(this._x(t.x))),i.setAttribute("y1","".concat(this._y(t.y))),i.setAttribute("x2","".concat(this._x(t.x))),i.setAttribute("y2","".concat(this._y(t.y))),this._bindFillDraw(i,"dot",e,1)},t.prototype.point=function(t,e){var i=this.makeNode("circle");return i.setAttribute("cx","".concat(this._x(t.x))),i.setAttribute("cy","".concat(this._y(t.y))),i.setAttribute("r","".concat(3)),this._bindFillDraw(i,"point",e,1)},t.prototype.circle=function(t,e,i,s,r){var n=this.makeNode("circle");return this.applyStrokeOpts(n,r),n.setAttribute("cx","".concat(this._x(t.x))),n.setAttribute("cy","".concat(this._y(t.y))),n.setAttribute("r","".concat(e*this.scale.x)),this._bindFillDraw(n,"circle",i,s||1)},t.prototype.circleArc=function(t,e,i,r,n,o,a){var h=this.makeNode("path");this.applyStrokeOpts(h,a);var c=s.CircleSector.circleSectorUtils.describeSVGArc(this._x(t.x),this._y(t.y),e*this.scale.x,i,r);return h.setAttribute("d",c.join(" ")),this._bindFillDraw(h,"circleArc",n,o||1)},t.prototype.ellipse=function(t,e,i,s,r,n,o){void 0===n&&(n=0);var a=this.makeNode("ellipse");return this.applyStrokeOpts(a,o),a.setAttribute("cx","".concat(this._x(t.x))),a.setAttribute("cy","".concat(this._y(t.y))),a.setAttribute("rx","".concat(e*this.scale.x)),a.setAttribute("ry","".concat(i*this.scale.y)),a.setAttribute("transform","rotate(".concat(180*n/Math.PI," ").concat(this._x(t.x)," ").concat(this._y(t.y),")")),this._bindFillDraw(a,"ellipse",s,r||1)},t.prototype.square=function(t,e,i,s,r){var n=this.makeNode("rectangle");return this.applyStrokeOpts(n,r),n.setAttribute("x","".concat(this._x(t.x-e/2))),n.setAttribute("y","".concat(this._y(t.y-e/2))),n.setAttribute("width","".concat(e*this.scale.x)),n.setAttribute("height","".concat(e*this.scale.y)),this._bindFillDraw(n,"square",i,s||1)},t.prototype.rect=function(t,e,i,s,r,n){var o=this.makeNode("rect");return this.applyStrokeOpts(o,n),o.setAttribute("x","".concat(this._x(t.x))),o.setAttribute("y","".concat(this._y(t.y))),o.setAttribute("width","".concat(e*this.scale.x)),o.setAttribute("height","".concat(i*this.scale.y)),this._bindFillDraw(o,"rect",s,r||1)},t.prototype.bounds=function(t,e,i,s){this.rect(t.min,t.max.x-t.min.x,t.max.y-t.min.y,e,i,s)},t.prototype.grid=function(t,e,i,s,r,n){for(var o=this.makeNode("path"),a=[],h=-Math.ceil(.5*i/r)*r,c=i/2,l=-Math.ceil(.5*e/s)*s;l<e/2;l+=s)a.push("M",this._x(t.x+l),this._y(t.y+h)),a.push("L",this._x(t.x+l),this._y(t.y+c));for(var u=-Math.ceil(.5*e/s)*s,d=e/2,p=-Math.ceil(.5*i/r)*r;p<i/2;p+=r)a.push("M",this._x(t.x+u),this._y(t.y+p)),a.push("L",this._x(t.x+d),this._y(t.y+p));return o.setAttribute("d",a.join(" ")),this._bindFillDraw(o,"grid",n,1)},t.prototype.raster=function(t,e,i,s,r,n){for(var o=this.makeNode("path"),a=[],h=-Math.ceil(.5*e/s)*s;h<e/2;h+=s)for(var c=-Math.ceil(.5*i/r)*r;c<i/2;c+=r)a.push("M",this._x(t.x+h)-4,this._y(t.y+c)),a.push("L",this._x(t.x+h)+4,this._y(t.y+c)),a.push("M",this._x(t.x+h),this._y(t.y+c)-4),a.push("L",this._x(t.x+h),this._y(t.y+c)+4);return o.setAttribute("d",a.join(" ")),this._bindFillDraw(o,"raster",n,1)},t.prototype.diamondHandle=function(t,e,i){var s=this.makeNode("path"),r=["M",this._x(t.x)-e/2,this._y(t.y),"L",this._x(t.x),this._y(t.y)-e/2,"L",this._x(t.x)+e/2,this._y(t.y),"L",this._x(t.x),this._y(t.y)+e/2,"Z"];return s.setAttribute("d",r.join(" ")),this._bindFillDraw(s,"diamondHandle",i,1)},t.prototype.squareHandle=function(t,e,i){var s=this.makeNode("rect");return s.setAttribute("x","".concat(this._x(t.x)-e/2)),s.setAttribute("y","".concat(this._y(t.y)-e/2)),s.setAttribute("width","".concat(e)),s.setAttribute("height","".concat(e)),this._bindFillDraw(s,"squareHandle",i,1)},t.prototype.circleHandle=function(t,e,i){e=e||3;var s=this.makeNode("circle");return s.setAttribute("cx","".concat(this._x(t.x))),s.setAttribute("cy","".concat(this._y(t.y))),s.setAttribute("r","".concat(e)),this._bindFillDraw(s,"circleHandle",i,1)},t.prototype.crosshair=function(t,e,i,s){var r=this.makeNode("path"),n=["M",this._x(t.x)-e,this._y(t.y),"L",this._x(t.x)+e,this._y(t.y),"M",this._x(t.x),this._y(t.y)-e,"L",this._x(t.x),this._y(t.y)+e];return r.setAttribute("d",n.join(" ")),this._bindFillDraw(r,"crosshair",i,s||.5)},t.prototype.cross=function(t,e,i,s){var r=this.makeNode("path"),n=["M",this._x(t.x)-e,this._y(t.y)-e,"L",this._x(t.x)+e,this._y(t.y)+e,"M",this._x(t.x)-e,this._y(t.y)+e,"L",this._x(t.x)+e,this._y(t.y)-e];return r.setAttribute("d",n.join(" ")),this._bindFillDraw(r,"cross",i,s||1)},t.prototype.polygon=function(t,e,i,s){return this.polyline(t.vertices,t.isOpen,e,i,s)},t.prototype.polyline=function(t,e,i,s,r){var n=this.makeNode("path");if(this.applyStrokeOpts(n,r),0==t.length)return n;for(var o=["M",this._x(t[0].x),this._y(t[0].y)],a=t.length,h=1;h<a;h++)o.push("L",this._x(t[h].x),this._y(t[h].y));return e||o.push("Z"),n.setAttribute("d",o.join(" ")),this._bindFillDraw(n,"polygon",i,s||1)},t.prototype.text=function(t,e,i,s){var r,n,o,a=(s=s||{}).color||"black",c=(null!==(n=null!==(r=s.lineHeight)&&void 0!==r?r:s.fontSize)&&void 0!==n?n:0)*this.scale.x,l="left"===s.textAlign||"start"===s.textAlign?"start":"center"===s.textAlign?"middle":"right"===s.textAlign||"end"===s.textAlign?"end":"start",u="".concat(this._x(e),"px ").concat(this._y(i),"px"),d="translate(".concat(this._x(e)," ").concat(this._y(i)+c/2,")"),p=s.rotation?"rotate(".concat(s.rotation*h," 0 0)"):"",f=this.makeNode("g"),y=this.curId;this.curId=y+"_text";var v=this.makeNode("text");return f.appendChild(v),v.setAttribute("font-family",null!==(o=s.fontFamily)&&void 0!==o?o:""),v.setAttribute("font-size",s.fontSize?"".concat(s.fontSize*this.scale.x):""),v.setAttribute("font-style",s.fontStyle?"".concat(s.fontStyle):""),v.setAttribute("font-weight",s.fontWeight?"".concat(s.fontWeight):""),v.setAttribute("text-anchor",l),v.setAttribute("transform-origin","0 0"),v.setAttribute("transform",p),f.setAttribute("transform-origin",u),f.setAttribute("transform",d),v.innerHTML=t,this.curId=y,this._bindFillDraw(f,"text",a,1)},t.prototype.label=function(t,e,i,s,r){var n=this.makeNode("text");return n.setAttribute("transform","translate(".concat(e,",").concat(i,"), rotate(").concat((s||0)/Math.PI*180,")")),n.setAttribute("font-family","Arial"),n.setAttribute("font-size","9pt"),n.setAttribute("font-style","normal"),n.setAttribute("font-weight","lighter"),n.innerHTML=t,this._bindFillDraw(n,"label",r||"black",null)},t.prototype.path=function(e,i,s,r){var n=this.makeNode("path");this.applyStrokeOpts(n,r);var o=r&&r.inplace?e:t.copyPathData(e);return t.transformPathData(o,this.offset,this.scale),n.setAttribute("d",o.join(" ")),this._bindFillDraw(n,"path",i,s)},t.prototype.clear=function(t){if(!this.isSecondary){this.curId="background",this.curClassName=null;var e=this.makeNode("rect");e.setAttribute("x","0"),e.setAttribute("y","0"),e.setAttribute("width","".concat(this.canvasSize.width)),e.setAttribute("height","".concat(this.canvasSize.height)),this._bindFillDraw(e,this.curId,null,null),e.setAttribute("fill",void 0===t?"none":t),this.curId=null}},t.prototype.removeAllChildNodes=function(){for(;this.bufferGNode.lastChild;)this.bufferGNode.removeChild(this.bufferGNode.lastChild);for(;this.bufferedNodeDefs.lastChild;)this.bufferedNodeDefs.removeChild(this.bufferedNodeDefs.lastChild)},t.createSvg=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg")},t.copyPathData=function(t){return t.slice()},t.transformPathData=function(t,e,i){for(var s=function(s){t[s]=e.x+i.x*Number(t[s])},r=function(s){t[s]=e.y+i.y*Number(t[s])},n=function(e){t[e]=i.x*Number(t[e])},o=function(e){t[e]=i.y*Number(t[e])},a=0,h={x:NaN,y:NaN},c=function(e){h.x=Number(t[e]),h.y=Number(t[e+1])};a<t.length;)switch(t[a]){case"M":case"L":case"T":s(a+1),r(a+2),c(a+1),a+=3;break;case"m":case"l":case"t":n(a+1),o(a+2),c(a+1),a+=3;break;case"H":s(a+1),h.x=Number(t[a+1]),a+=2;break;case"h":n(a+1),h.x=Number(t[a+1]),a+=2;break;case"V":r(a+1),h.y=Number(t[a+1]),a+=2;break;case"v":o(a+1),h.y=Number(t[a+1]),a+=2;break;case"C":s(a+1),r(a+2),s(a+3),r(a+4),s(a+5),r(a+6),c(a+5),a+=7;break;case"c":n(a+1),o(a+2),n(a+3),o(a+4),n(a+5),o(a+6),c(a+5),a+=7;break;case"S":case"Q":s(a+1),r(a+2),s(a+3),r(a+4),c(a+3),a+=5;break;case"s":case"q":n(a+1),o(a+2),n(a+3),o(a+4),c(a+3),a+=5;break;case"A":n(a+1),o(a+2),s(a+6),r(a+7),c(a+6),(i.x<0&&i.y>=0||i.x>=0&&i.y<0)&&(t[a+5]=t[a+5]?0:1),a+=8;break;case"a":n(a+1),o(a+2),n(a+6),o(a+7),c(a+6),a+=8;break;default:a++}},t.nodeSupportsLineDash=function(t){return["line","path","circle","ellipse","rectangle","rect"].includes(t)},t.nodeSupportsLineJoin=function(t){return["line","path","circle","ellipse","rectangle","rect"].includes(t)},t.nodeSupportsLineCap=function(t){return["line","path","circle","ellipse","rectangle","rect"].includes(t)},t.prototype.makeLineNode=function(t,e,i,s,r,n){var o=this.makeNode("line");return o.setAttribute("x1","".concat(this._x(t.x))),o.setAttribute("y1","".concat(this._y(t.y))),o.setAttribute("x2","".concat(this._x(e.x))),o.setAttribute("y2","".concat(this._y(e.y))),this._configureNode(o,null!=n?n:"line",this.fillShapes,i,s||1,r),o},t.prototype.makePathNode=function(t,e,i,s,r){var n=this.makeNode("path");return n.setAttribute("d",t),this._configureNode(n,null!=r?r:"path",this.fillShapes,e,i||1,s),n},t.prototype.makeArrowHeadNode=function(t,e,i,s,r,n,o){void 0===r&&(r=8);var h=a.Vector.utils.buildArrowHead(t,e,r,this.scale.x,this.scale.y),c=["M",this.offset.x+h[0].x,this.offset.y+h[0].y];o&&(o.x=h[0].x/this.scale.x,o.y=h[0].y/this.scale.y);for(var l=1;l<=h.length;l++)c.push("L"),c.push(this.offset.x+h[l%h.length].x),c.push(this.offset.y+h[l%h.length].y);return this.makePathNode(c.join(" "),i,s,n,"arrowhead")},t.prototype.makeCubicBezierNode=function(t,e,i,s,n,o,a){if(t instanceof r.CubicBezierCurve)return this.cubicBezier(t.startPoint,t.endPoint,t.startControlPoint,t.endControlPoint,n,o);var h=["M",this._x(t.x),this._y(t.y),"C",this._x(i.x),this._y(i.y),this._x(s.x),this._y(s.y),this._x(e.x),this._y(e.y)];return this.makePathNode(h.join(" "),n,o,a,"cubicBezier")},t.HEAD_XML=['<?xml version="1.0" encoding="UTF-8" standalone="no"?>','<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" ',' "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">',""].join("\n"),t}();e.drawutilssvg=c},476:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VertexAttr=void 0;var i=function(){function t(){for(var e in this.draggable=!0,this.selectable=!0,this.isSelected=!1,this.visible=!0,t.model)this[e]=t.model[e]}return t.model={draggable:!0,selectable:!0,isSelected:!1,visible:!0},t}();e.VertexAttr=i},531:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.KeyHandler=void 0;var i=function(){function t(t){this.downListeners=[],this.pressListeners=[],this.upListeners=[],this.keyStates={},t=t||{},this.element=t.element?t.element:globalThis,this.downListeners=[],this.pressListeners=[],this.upListeners=[],this.keyStates=[],this.trackAllKeys=t.trackAll||!1,this.installListeners()}return t.prototype.fireEvent=function(t,e){var i=!1;for(var s in e){var r=e[s];r.keyCode==t.keyCode&&(r.listener(t),i=!0)}return i},t.prototype.fireDownEvent=function(t,e){(e.fireEvent(t,e.downListeners)||e.trackAllKeys)&&(e.keyStates[t.keyCode]="down")},t.prototype.firePressEvent=function(t,e){e.fireEvent(t,e.pressListeners)},t.prototype.fireUpEvent=function(t,e){(e.fireEvent(t,e.upListeners)||e.trackAllKeys)&&delete e.keyStates[t.keyCode]},t.key2code=function(e){if("number"==typeof e)return e;if("string"!=typeof e)throw"Unknown key name or key type (should be a string or integer): "+e;if(t.KEY_CODES[e])return t.KEY_CODES[e];throw"Unknown key (cannot resolve key code): "+e},t.prototype.installListeners=function(){var t=this;this.element.addEventListener("keydown",this._keyDownListener=function(e){t.fireDownEvent(e,t)}),this.element.addEventListener("keypress",this._keyPressListener=function(e){t.firePressEvent(e,t)}),this.element.addEventListener("keyup",this._keyUpListener=function(e){t.fireUpEvent(e,t)})},t.prototype.releaseListeners=function(){this.element.removeEventListener("keydown",this._keyDownListener),this.element.removeEventListener("keypress",this._keyPressListener),this.element.removeEventListener("keyup",this._keyUpListener)},t.prototype.down=function(e,i){return this.downListeners.push({key:e,keyCode:t.key2code(e),listener:i}),this},t.prototype.press=function(e,i){return this.pressListeners.push({key:e,keyCode:t.key2code(e),listener:i}),this},t.prototype.up=function(e,i){return this.upListeners.push({key:e,keyCode:t.key2code(e),listener:i}),this},t.prototype.isDown=function(e){return"number"==typeof e?!!this.keyStates[e]:!!this.keyStates[t.key2code(e)]},t.prototype.destroy=function(){this.releaseListeners()},t.KEY_CODES={break:3,backspace:8,tab:9,clear:12,enter:13,shift:16,ctrl:17,alt:18,pause:19,capslock:20,hangul:21,hanja:25,escape:27,conversion:28,"non-conversion":29,spacebar:32,pageup:33,pagedown:34,end:35,home:36,leftarrow:37,uparrow:38,rightarrow:39,downarrow:40,select:41,print:42,execute:43,printscreen:44,insert:45,delete:46,help:47,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,":":58,"semicolon (firefox)":59,equals:59,"<":60,"equals (firefox)":61,ß:63,"@ (firefox)":64,a:65,b:66,c:67,d:68,e:69,f:70,g:71,h:72,i:73,j:74,k:75,l:76,m:77,n:78,o:79,p:80,q:81,r:82,s:83,t:84,u:85,v:86,w:87,x:88,y:89,z:90,windows:91,leftcommand:91,chromebooksearch:91,rightwindowkey:92,windowsmenu:93,rightcommant:93,sleep:95,numpad0:96,numpad1:97,numpad2:98,numpad3:99,numpad4:100,numpad5:101,numpad6:102,numpad7:103,numpad8:104,numpad9:105,multiply:106,add:107,numpadperiod:108,subtract:109,decimalpoint:110,divide:111,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123,f13:124,f14:125,f15:126,f16:127,f17:128,f18:129,f19:130,f20:131,f21:132,f22:133,f23:134,f24:135,numlock:144,scrolllock:145,"^":160,"!":161,"#":163,$:164,ù:165,pagebackward:166,pageforward:167,refresh:168,closingparen:169,"*":170,"~+*":171,minus:173,decreasevolumelevel:174,increasevolumelevel:175,next:176,previous:177,stop:178,"play/pause":179,email:180,mute:181,unmute:181,semicolon:186,ñ:186,equal:187,comma:188,dash:189,period:190,forwardslash:191,ç:191,"grave accent":192,æ:192,ö:192,"?":193,"/":193,"°":193,openbracket:219,backslash:220,closebracket:221,å:221,singlequote:222,ø:222,ä:222,"`":223,altgr:225,"GNOME Compose Key":230,XF86Forward:233,XF86Back:234,alphanumeric:240,hiragana:242,katakana:242,"half-width":243,"full-width":243,kanji:244,unlocktrackpad:251,toggletouchpad:255},t}();e.KeyHandler=i},559:function(t,e,i){var s=this&&this.__setFunctionName||function(t,e,i){return"symbol"==typeof e&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:i?"".concat(i," ",e):e})};Object.defineProperty(e,"__esModule",{value:!0}),e.PlotBoilerplate=void 0;var r=i(597),n=i(39),o=i(264),a=i(378),h=i(733),c=i(76),l=i(118),u=i(135),d=i(289),p=i(531),f=i(939),y=i(912),v=i(862),g=i(687),x=i(737),m=i(881),b=i(719),w=i(30),C=i(787),P=i(476),A=i(628),T=function(){function t(e,i){var s,r;if(this.contentChangeListeners=[],this.renderTime=0,this._gui=null,P.VertexAttr.model={bezierAutoAdjust:!1,renderTime:0,selectable:!0,isSelected:!1,draggable:!0,visible:!0},void 0===e.canvas)throw"No canvas specified.";var h=t.utils.fetch;this.config={canvas:e.canvas,fullSize:h.val(e,"fullSize",!0),fitToParent:h.bool(e,"fitToParent",!0),scaleX:h.num(e,"scaleX",1),scaleY:h.num(e,"scaleY",1),offsetX:h.num(e,"offsetX",0),offsetY:h.num(e,"offsetY",0),rasterGrid:h.bool(e,"rasterGrid",!0),drawRaster:h.bool(e,"drawRaster",!0),rasterScaleX:h.num(e,"rasterScaleX",1),rasterScaleY:h.num(e,"rasterScaleY",1),rasterAdjustFactor:h.num(e,"rasterAdjustdFactror",2),drawOrigin:h.bool(e,"drawOrigin",!1),autoAdjustOffset:h.val(e,"autoAdjustOffset",!0),offsetAdjustXPercent:h.num(e,"offsetAdjustXPercent",50),offsetAdjustYPercent:h.num(e,"offsetAdjustYPercent",50),backgroundColor:e.backgroundColor||"#ffffff",redrawOnResize:h.bool(e,"redrawOnResize",!0),defaultCanvasWidth:h.num(e,"defaultCanvasWidth",t.DEFAULT_CANVAS_WIDTH),defaultCanvasHeight:h.num(e,"defaultCanvasHeight",t.DEFAULT_CANVAS_HEIGHT),canvasWidthFactor:h.num(e,"canvasWidthFactor",1),canvasHeightFactor:h.num(e,"canvasHeightFactor",1),cssScaleX:h.num(e,"cssScaleX",1),cssScaleY:h.num(e,"cssScaleY",1),cssUniformScale:h.bool(e,"cssUniformScale",!0),saveFile:function(){u.hooks.saveFile(u)},setToRetina:function(){u._setToRetina()},autoDetectRetina:h.bool(e,"autoDetectRetina",!0),enableSVGExport:h.bool(e,"enableSVGExport",!0),preClear:h.func(e,"preClear",null),preDraw:h.func(e,"preDraw",null),postDraw:h.func(e,"postDraw",null),enableMouse:h.bool(e,"enableMouse",!0),enableTouch:h.bool(e,"enableTouch",!0),enableKeys:h.bool(e,"enableKeys",!0),enableMouseWheel:h.bool(e,"enableMouseWheel",!0),enableZoom:h.bool(e,"enableZoom",!0),enablePan:h.bool(e,"enablePan",!0),enableGL:h.bool(e,"enableGL",!1),isBackdropFiltersEnabled:h.bool(e,"isBackdropFiltersEnabled",!0)},this.drawConfig={drawVertices:!0,drawBezierHandleLines:h.bool(e,"drawBezierHandleLines",!0),drawBezierHandlePoints:h.bool(e,"drawBezierHandlePoints",!0),drawHandleLines:h.bool(e,"drawHandleLines",!0),drawHandlePoints:h.bool(e,"drawHandlePoints",!0),drawGrid:h.bool(e,"drawGrid",!0),drawRaster:h.bool(e,"drawRaster",!0),bezier:{color:"#00a822",lineWidth:2,handleLine:{color:"rgba(180,180,180,0.5)",lineWidth:1},pathVertex:{color:"#B400FF",lineWidth:1,fill:!0},controlVertex:{color:"#B8D438",lineWidth:1,fill:!0}},polygon:{color:"#0022a8",lineWidth:1},triangle:{color:"#6600ff",lineWidth:1},ellipse:{color:"#2222a8",lineWidth:1},ellipseSector:{color:"#a822a8",lineWidth:2},circle:{color:"#22a8a8",lineWidth:2},circleSector:{color:"#2280a8",lineWidth:1},vertex:{color:"#a8a8a8",lineWidth:1},selectedVertex:{color:"#c08000",lineWidth:2},line:{color:"#a844a8",lineWidth:1},vector:{color:"#ff44a8",lineWidth:1},image:{color:"#a8a8a8",lineWidth:1},text:{color:"rgba(192,0,128,0.5)",lineWidth:1,fill:!0,anchor:!0},origin:{color:"#000000"}},this.grid=new d.Grid(new C.Vertex(0,0),new C.Vertex(50,50)),this.canvasSize={width:t.DEFAULT_CANVAS_WIDTH,height:t.DEFAULT_CANVAS_HEIGHT};var c="string"==typeof e.canvas?document.querySelector(e.canvas):e.canvas;if(void 0===c)throw'Cannot initialize PlotBoilerplate with a null canvas (element "'.concat(e.canvas," not found).");if("canvas"===c.tagName.toLowerCase())if(this.canvas=c,this.eventCatcher=this.canvas,this.config.enableGL&&void 0===o.drawutilsgl&&(console.warn("Cannot use webgl. Package was compiled without experimental gl support. Please use plotboilerplate-glsupport.min.js instead."),console.warn("Disabling GL and falling back to Canvas2D."),this.config.enableGL=!1),this.config.enableGL){var l=this.canvas.getContext("webgl");this.draw=new o.drawutilsgl(l,!1),this.fill=this.draw.copyInstance(!0),console.warn("Initialized with experimental mode enableGL=true. Note that this is not yet fully implemented.")}else l=this.canvas.getContext("2d"),this.draw=new n.drawutils(l,!1),this.fill=new n.drawutils(l,!0);else{if("svg"!==c.tagName.toLowerCase())throw"Element is neither a canvas nor an svg element.";if(void 0===a.drawutilssvg)throw"The svg draw library is not yet integrated part of PlotBoilerplate. Please include ./src/js/utils/helpers/drawutils.svg into your document.";this.canvas=c,this.draw=new a.drawutilssvg(this.canvas,new C.Vertex,new C.Vertex,this.canvasSize,!1,this.drawConfig,!1),this.fill=this.draw.copyInstance(!0),this.canvas.parentElement?(this.eventCatcher=document.createElement("div"),this.eventCatcher.style.position="absolute",this.eventCatcher.style.left="0",this.eventCatcher.style.top="0",this.eventCatcher.style.cursor="pointer",this.canvas.parentElement.style.position="relative",this.canvas.parentElement.appendChild(this.eventCatcher)):this.eventCatcher=document.body}e.title&&this.eventCatcher.setAttribute("title",e.title),this.draw.scale.set(null!==(s=this.config.scaleX)&&void 0!==s?s:1,this.config.scaleY),this.fill.scale.set(null!==(r=this.config.scaleX)&&void 0!==r?r:1,this.config.scaleY),this.vertices=[],this.selectPolygon=null,this.draggedElements=[],this.drawables=[],this.console=console,this.hooks={saveFile:t._saveFile};var u=this;globalThis.addEventListener("resize",function(){return u.resizeCanvas()}),this.resizeCanvas(),e.autoDetectRetina&&this._setToRetina(),this.installInputListeners(),this.updateCSSscale(),this.redraw(),this.canvas.focus()}var e;return t._saveFile=function(t){var e=document.createElementNS("http://www.w3.org/2000/svg","svg"),i=new a.drawutilssvg(e,t.draw.offset,t.draw.scale,t.canvasSize,!1,t.drawConfig),s=i.copyInstance(!0);i.beginDrawCycle(0),s.beginDrawCycle(0),t.config.preClear&&t.config.preClear(),i.clear(t.config.backgroundColor||"white"),t.config.preDraw&&t.config.preDraw(i,s),t.drawAll(0,i,s),t.drawVertices(0,i),t.config.postDraw&&t.config.postDraw(i,s),i.endDrawCycle(0),s.endDrawCycle(0);var r=(new XMLSerializer).serializeToString(e),n=new Blob(['<?xml version="1.0" encoding="utf-8"?>\n'+r],{type:"image/svg;charset=utf-8"});if("function"!=typeof globalThis.saveAs)throw"Cannot save file; did you load the ./utils/savefile helper function and the eligrey/SaveFile library?";(0,globalThis.saveAs)(n,"plotboilerplate.svg")},t.prototype._setToRetina=function(){this.config.autoDetectRetina=!0;var t=globalThis.devicePixelRatio||1;this.config.cssScaleX=this.config.cssScaleY=1/t,this.config.canvasWidthFactor=this.config.canvasHeightFactor=t,this.resizeCanvas(),this.updateCSSscale()},t.prototype.isPanning=function(){return this.isInPanningMode},t.prototype.fitToView=function(t){var e=new C.Vertex(this.canvasSize.width/2,this.canvasSize.height/2),i=this.canvasSize.width/this.canvasSize.height,s=t.width/t.height,r=new C.Vertex(t.max.x-t.width/2,t.max.y-t.height/2).inv().addXY(this.canvasSize.width/2,this.canvasSize.height/2);if(this.setOffset(r),i<s){var n=this.canvasSize.width/t.width;this.setZoom(n,n,e)}else n=this.canvasSize.height/t.height,this.setZoom(n,n,e);this.redraw()},t.prototype.setConsole=function(t){this.console=t},t.prototype.updateCSSscale=function(){var e,i,s,r;this.config.cssUniformScale?t.utils.setCSSscale(this.canvas,null!==(e=this.config.cssScaleX)&&void 0!==e?e:1,null!==(i=this.config.cssScaleX)&&void 0!==i?i:1):t.utils.setCSSscale(this.canvas,null!==(s=this.config.cssScaleX)&&void 0!==s?s:1,null!==(r=this.config.cssScaleY)&&void 0!==r?r:1)},t.prototype.addContentChangeListener=function(t){for(var e in this.contentChangeListeners)if(this.contentChangeListeners[e]===t)return;this.contentChangeListeners.push(t)},t.prototype.removeContentChangeListener=function(t){for(var e=0;e<this.contentChangeListeners.length;e++)if(this.contentChangeListeners[e]===t)return void this.contentChangeListeners.splice(e,1)},t.prototype._fireContentChanged=function(t,e){for(var i in this.contentChangeListeners){var s=this.contentChangeListeners[i];s&&"function"==typeof s&&s({type:t.length>0?"DRAWABLES_ADDED":"DRAWABLES_REMOVED",addedDrawables:t,removedDrawables:e})}},t.prototype.add=function(e,i,s){if(Array.isArray(e))for(var r=e,n=0;n<r.length;n++)this.add(r[n],!1,s);else{var o=[e];if(e instanceof C.Vertex)this.drawables.push(e),this.vertices.push(e);else if(e instanceof f.Line)this.drawables.push(e),this.vertices.push(e.a),this.vertices.push(e.b),o.push(e.a,e.b);else if(e instanceof w.Vector)this.drawables.push(e),this.vertices.push(e.a),this.vertices.push(e.b),o.push(e.a,e.b),e.a.listeners.addDragListener(function(t){e.b.add(t.params.dragAmount)});else if(e instanceof m.VEllipse)this.vertices.push(e.center),this.vertices.push(e.axis),o.push(e.center,e.axis),this.drawables.push(e),e.center.listeners.addDragListener(function(t){e.axis.add(t.params.dragAmount)});else if(e instanceof b.VEllipseSector)this.vertices.push(e.ellipse.center),this.vertices.push(e.ellipse.axis),o.push(e.ellipse.center,e.ellipse.axis),this.drawables.push(e),e.ellipse.center.listeners.addDragListener(function(t){e.ellipse.axis.add(t.params.dragAmount)});else if(e instanceof l.Circle)this.vertices.push(e.center),o.push(e.center),this.drawables.push(e);else if(e instanceof u.CircleSector)this.vertices.push(e.circle.center),o.push(e.circle.center),this.drawables.push(e);else if(e instanceof g.Polygon)for(this.drawables.push(e),n=0;n<e.vertices.length;n++)this.vertices.push(e.vertices[n]),o.push(e.vertices[n]);else if(e instanceof x.Triangle)this.drawables.push(e),this.vertices.push(e.a),this.vertices.push(e.b),this.vertices.push(e.c),o.push(e.a,e.b,e.c);else if(e instanceof h.BezierPath){this.drawables.push(e);var a=e;for(n=0;n<a.bezierCurves.length;n++)e.adjustCircular||0!=n||(this.vertices.push(a.bezierCurves[n].startPoint),o.push(a.bezierCurves[n].startPoint)),this.vertices.push(a.bezierCurves[n].endPoint),this.vertices.push(a.bezierCurves[n].startControlPoint),this.vertices.push(a.bezierCurves[n].endControlPoint),o.push(a.bezierCurves[n].endPoint,a.bezierCurves[n].startControlPoint,a.bezierCurves[n].endControlPoint),a.bezierCurves[n].startControlPoint.attr.selectable=!1,a.bezierCurves[n].endControlPoint.attr.selectable=!1;t.utils.enableBezierPathAutoAdjust(e)}else if(e instanceof v.PBImage)this.vertices.push(e.upperLeft),this.vertices.push(e.lowerRight),o.push(e.upperLeft,e.lowerRight),this.drawables.push(e),e.upperLeft.listeners.addDragListener(function(t){e.lowerRight.add(t.params.dragAmount)}),e.lowerRight.attr.selectable=!1;else{if(!(e instanceof A.PBText))throw"Cannot add drawable of unrecognized type: "+typeof e+".";this.vertices.push(e.anchor),o.push(e.anchor),this.drawables.push(e),e.anchor.attr.selectable=!1}!s&&this._fireContentChanged(o,[])}(i||void 0===i)&&this.redraw()},t.prototype.remove=function(t,e,i,s){if(Array.isArray(t)){for(var r=[],n=0;n<t.length;n++)this.remove(t[n],!1,i,!0)&&r.push(t[n]);return e&&this.redraw(),!s&&this._fireContentChanged([],r),r.length>0}if(t instanceof C.Vertex){var o=this.removeVertex(t,!1,!1);return e&&this.redraw(),!s&&this._fireContentChanged([],[t]),o}var a=!1,c=[];for(n=0;n<this.drawables.length;n++)if(this.drawables[n]===t||this.drawables[n].uid===t.uid){if(this.drawables.splice(n,1),c.push(t),i)if(t instanceof f.Line)this.removeVertex(t.a,!1,!0),this.removeVertex(t.b,!1,!0),c.push(t.a,t.b);else if(t instanceof w.Vector)this.removeVertex(t.a,!1,!0),this.removeVertex(t.b,!1,!0),c.push(t.a,t.b);else if(t instanceof m.VEllipse)this.removeVertex(t.center,!1,!0),this.removeVertex(t.axis,!1,!0),c.push(t.center,t.axis);else if(t instanceof b.VEllipseSector)this.removeVertex(t.ellipse.center,!1,!0),this.removeVertex(t.ellipse.axis,!1,!0),c.push(t.ellipse.center,t.ellipse.axis);else if(t instanceof l.Circle)this.removeVertex(t.center,!1,!0);else if(t instanceof u.CircleSector)this.removeVertex(t.circle.center,!1,!0),c.push(t.circle.center);else if(t instanceof g.Polygon)for(n=0;n<t.vertices.length;n++)this.removeVertex(t.vertices[n],!1,!0),c.push(t.vertices[n]);else if(t instanceof x.Triangle)this.removeVertex(t.a,!1,!0),this.removeVertex(t.b,!1,!0),this.removeVertex(t.c,!1,!0),c.push(t.a,t.b,t.c);else if(t instanceof h.BezierPath)for(n=0;n<t.bezierCurves.length;n++)this.removeVertex(t.bezierCurves[n].startPoint,!1,!0),this.removeVertex(t.bezierCurves[n].startControlPoint,!1,!0),this.removeVertex(t.bezierCurves[n].endControlPoint,!1,!0),c.push(t.bezierCurves[n].startPoint,t.bezierCurves[n].startControlPoint,t.bezierCurves[n].endControlPoint),n+1==t.bezierCurves.length&&(this.removeVertex(t.bezierCurves[n].endPoint,!1,!0),c.push(t.bezierCurves[n].endPoint));else t instanceof v.PBImage?(this.removeVertex(t.upperLeft,!1,!0),this.removeVertex(t.lowerRight,!1,!0),c.push(t.upperLeft,t.lowerRight)):t instanceof A.PBText&&(this.removeVertex(t.anchor,!1,!0),c.push(t.anchor));e&&this.redraw(),!s&&this._fireContentChanged([],c),a=!0}return a},t.prototype.removeVertex=function(t,e,i){for(var s=0;s<this.vertices.length;s++)if(this.vertices[s]===t)return this.vertices.splice(s,1),e&&this.redraw(),!i&&this._fireContentChanged([],[t]),!0;return!1},t.prototype.removeAll=function(t,e){var i=this.drawables;this.drawables=[],Boolean(t)||(i=i.concat(this.vertices),this.vertices=[]),(e||void 0===e)&&this.redraw(),i.length>0&&this._fireContentChanged([],i)},t.prototype.getVertexNear=function(t,e){var i,s,r=this.locatePointNear(this.transformMousePosition(t.x,t.y),e/Math.min(null!==(i=this.config.cssScaleX)&&void 0!==i?i:1,null!==(s=this.config.cssScaleY)&&void 0!==s?s:1));if(r&&"vertex"==r.typeName)return this.vertices[r.vindex]},t.prototype.drawGrid=function(t){void 0===t&&(t=this.draw);var e=d.Grid.utils.mapRasterScale(this.config.rasterAdjustFactor,this.draw.scale.x)*this.config.rasterScaleX/this.config.cssScaleX,i=d.Grid.utils.mapRasterScale(this.config.rasterAdjustFactor,this.draw.scale.y)*this.config.rasterScaleY/this.config.cssScaleY,s={width:this.grid.size.x*e,height:this.grid.size.y*i},r=this.canvasSize.width/2,n=this.canvasSize.height/2,o=this.draw.offset.clone().inv();o.x=Math.round(o.x+r)/Math.round(s.width)*s.width/this.draw.scale.x+(this.draw.offset.x-r)/this.draw.scale.x%s.width,o.y=Math.round(o.y+n)/Math.round(s.height)*s.height/this.draw.scale.y+(this.draw.offset.y-n)/this.draw.scale.x%s.height,this.drawConfig.drawGrid&&(t.setCurrentClassName(null),this.config.rasterGrid?(t.setCurrentId("raster"),t.raster(o,this.canvasSize.width/this.draw.scale.x,this.canvasSize.height/this.draw.scale.y,s.width,s.height,"rgba(0,128,255,0.125)")):(t.setCurrentId("grid"),t.grid(o,this.canvasSize.width/this.draw.scale.x,this.canvasSize.height/this.draw.scale.y,s.width,s.height,"rgba(0,128,255,0.095)")))},t.prototype.drawOrigin=function(t){t.setCurrentId("origin"),t.crosshair({x:0,y:0},10,this.drawConfig.origin.color)},t.prototype._handleColor=function(t,e){return t.attr.isSelected?this.drawConfig.selectedVertex.color:t.attr.draggable?e:"rgba(128,128,128,0.5)"},t.prototype.drawDrawables=function(t,e,i){for(var s in this.drawables){var r=this.drawables[s];this.draw.setCurrentId(r.uid),this.fill.setCurrentId(r.uid),this.draw.setCurrentClassName(r.className),this.fill.setCurrentClassName(r.className),this.drawDrawable(r,t,e,i)}},t.prototype.drawDrawable=function(t,e,i,s){if(t instanceof h.BezierPath){var r=0;for(var n in t.bezierCurves){var o;if(this.draw.setCurrentId("".concat(t.uid,"-").concat(r)),this.fill.setCurrentId("".concat(t.uid,"-").concat(r)),this.draw.setCurrentClassName(t.className),this.fill.setCurrentClassName(t.className),i.cubicBezier(t.bezierCurves[n].startPoint,t.bezierCurves[n].endPoint,t.bezierCurves[n].startControlPoint,t.bezierCurves[n].endControlPoint,this.drawConfig.bezier.color,this.drawConfig.bezier.lineWidth),this.drawConfig.drawBezierHandlePoints&&this.drawConfig.drawHandlePoints)t.bezierCurves[n].startPoint.attr.visible&&((o=this.drawConfig.bezier.pathVertex.fill?s:i).setCurrentId("".concat(t.uid,"_h0")),o.setCurrentClassName("".concat(t.className,"-start-handle")),t.bezierCurves[n].startPoint.attr.bezierAutoAdjust?o.squareHandle(t.bezierCurves[n].startPoint,5,this._handleColor(t.bezierCurves[n].startPoint,this.drawConfig.bezier.pathVertex.color)):o.diamondHandle(t.bezierCurves[n].startPoint,7,this._handleColor(t.bezierCurves[n].startPoint,this.drawConfig.bezier.pathVertex.color))),t.bezierCurves[n].startPoint.attr.renderTime=e,t.bezierCurves[n].endPoint.attr.visible&&((o=this.drawConfig.bezier.pathVertex.fill?s:i).setCurrentId("".concat(t.uid,"_h0")),o.setCurrentClassName("".concat(t.className,"-start-handle")),t.bezierCurves[n].endPoint.attr.bezierAutoAdjust?o.squareHandle(t.bezierCurves[n].endPoint,5,this._handleColor(t.bezierCurves[n].endPoint,this.drawConfig.bezier.pathVertex.color)):o.diamondHandle(t.bezierCurves[n].endPoint,7,this._handleColor(t.bezierCurves[n].endPoint,this.drawConfig.bezier.pathVertex.color))),t.bezierCurves[n].startControlPoint.attr.visible&&((o=this.drawConfig.bezier.controlVertex.fill?s:i).setCurrentId("".concat(t.uid,"_h2")),o.setCurrentClassName("".concat(t.className,"-start-control-handle")),o.circleHandle(t.bezierCurves[n].startControlPoint,3,this._handleColor(t.bezierCurves[n].startControlPoint,this.drawConfig.bezier.controlVertex.color))),t.bezierCurves[n].endControlPoint.attr.visible&&((o=this.drawConfig.bezier.controlVertex.fill?s:i).setCurrentId("".concat(t.uid,"_h3")),o.setCurrentClassName("".concat(t.className,"-end-control-handle")),o.circleHandle(t.bezierCurves[n].endControlPoint,3,this._handleColor(t.bezierCurves[n].endControlPoint,this.drawConfig.bezier.controlVertex.color))),t.bezierCurves[n].startPoint.attr.renderTime=e,t.bezierCurves[n].endPoint.attr.renderTime=e,t.bezierCurves[n].startControlPoint.attr.renderTime=e,t.bezierCurves[n].endControlPoint.attr.renderTime=e;else t.bezierCurves[n].startPoint.attr.renderTime=e,t.bezierCurves[n].endPoint.attr.renderTime=e,t.bezierCurves[n].startControlPoint.attr.renderTime=e,t.bezierCurves[n].endControlPoint.attr.renderTime=e;this.drawConfig.drawBezierHandleLines&&this.drawConfig.drawHandleLines&&(i.setCurrentId("".concat(t.uid,"_l0")),i.setCurrentClassName("".concat(t.className,"-start-line")),i.handleLine(t.bezierCurves[n].startPoint,t.bezierCurves[n].startControlPoint),i.setCurrentId("".concat(t.uid,"_l1")),i.setCurrentClassName("".concat(t.className,"-end-line")),i.handleLine(t.bezierCurves[n].endPoint,t.bezierCurves[n].endControlPoint)),r++}}else if(t instanceof g.Polygon){if(i.polygon(t,this.drawConfig.polygon.color,this.drawConfig.polygon.lineWidth),!this.drawConfig.drawHandlePoints)for(var a in t.vertices)t.vertices[a].attr.renderTime=e}else if(t instanceof x.Triangle)i.polyline([t.a,t.b,t.c],!1,this.drawConfig.triangle.color,this.drawConfig.triangle.lineWidth),this.drawConfig.drawHandlePoints||(t.a.attr.renderTime=t.b.attr.renderTime=t.c.attr.renderTime=e);else if(t instanceof m.VEllipse)this.drawConfig.drawHandleLines&&(i.setCurrentId("".concat(t.uid,"_e0")),i.setCurrentClassName("".concat(t.className,"-v-line")),i.handleLine(t.center.clone().add(0,t.signedRadiusV()).rotate(t.rotation,t.center),t.axis),i.setCurrentId("".concat(t.uid,"_e1")),i.setCurrentClassName("".concat(t.className,"-h-line")),i.handleLine(t.center.clone().add(t.signedRadiusH(),0).rotate(t.rotation,t.center),t.axis)),i.setCurrentId(t.uid),i.setCurrentClassName("".concat(t.className)),i.ellipse(t.center,t.radiusH(),t.radiusV(),this.drawConfig.ellipse.color,this.drawConfig.ellipse.lineWidth,t.rotation),this.drawConfig.drawHandlePoints||(t.center.attr.renderTime=e,t.axis.attr.renderTime=e);else if(t instanceof b.VEllipseSector){i.setCurrentId(t.uid),i.setCurrentClassName("".concat(t.className));var c=b.VEllipseSector.ellipseSectorUtils.describeSVGArc(t.ellipse.center.x,t.ellipse.center.y,t.ellipse.radiusH(),t.ellipse.radiusV(),t.startAngle,t.endAngle,t.ellipse.rotation,{moveToStart:!0});i.path(c,this.drawConfig.ellipseSector.color,this.drawConfig.ellipseSector.lineWidth)}else t instanceof l.Circle?i.circle(t.center,t.radius,this.drawConfig.circle.color,this.drawConfig.circle.lineWidth):t instanceof u.CircleSector?i.circleArc(t.circle.center,t.circle.radius,t.startAngle,t.endAngle,this.drawConfig.circleSector.color,this.drawConfig.circleSector.lineWidth):t instanceof C.Vertex?!this.drawConfig.drawVertices||t.attr.selectable&&t.attr.draggable||!t.attr.visible||(i.circleHandle(t,7,this.drawConfig.vertex.color),t.attr.renderTime=e):t instanceof f.Line?(i.line(t.a,t.b,this.drawConfig.line.color,this.drawConfig.line.lineWidth),this.drawConfig.drawHandlePoints&&t.a.attr.selectable||(t.a.attr.renderTime=e),this.drawConfig.drawHandlePoints&&t.b.attr.selectable||(t.b.attr.renderTime=e)):t instanceof w.Vector?(i.arrow(t.a,t.b,this.drawConfig.vector.color,this.drawConfig.vector.lineWidth),this.drawConfig.drawHandlePoints&&t.b.attr.selectable&&t.b.attr.visible?(i.setCurrentId("".concat(t.uid,"_h0")),i.setCurrentClassName("".concat(t.className,"-handle")),i.circleHandle(t.b,3,"#a8a8a8")):t.b.attr.renderTime=e,this.drawConfig.drawHandlePoints&&t.a.attr.selectable||(t.a.attr.renderTime=e),this.drawConfig.drawHandlePoints&&t.b.attr.selectable||(t.b.attr.renderTime=e)):t instanceof v.PBImage?(this.drawConfig.drawHandleLines&&(i.setCurrentId("".concat(t.uid,"_l0")),i.setCurrentClassName("".concat(t.className,"-line")),i.line(t.upperLeft,t.lowerRight,this.drawConfig.image.color,this.drawConfig.image.lineWidth)),s.setCurrentId(t.uid),s.image(t.image,t.upperLeft,t.lowerRight.clone().sub(t.upperLeft)),this.drawConfig.drawHandlePoints&&(i.setCurrentId("".concat(t.uid,"_h0")),i.setCurrentClassName("".concat(t.className,"-lower-right")),i.circleHandle(t.lowerRight,3,this.drawConfig.image.color),t.lowerRight.attr.renderTime=e)):t instanceof A.PBText?(s.setCurrentId(t.uid),s.text(t.text,t.anchor.x,t.anchor.y,t),this.drawConfig.text.anchor&&(i.setCurrentId("".concat(t.uid,"_a0")),i.setCurrentClassName("".concat(t.className,"-anchor")),(this.drawConfig.text.fill?s:i).point(t.anchor,this.drawConfig.text.color)),t.anchor.attr.renderTime=e):console.error("Cannot draw object. Unknown class.");i.setCurrentClassName(null),i.setCurrentId(null),s.setCurrentClassName(null),s.setCurrentId(null)},t.prototype.drawSelectPolygon=function(t){null!=this.selectPolygon&&this.selectPolygon.vertices.length>0&&(t.setCurrentId(this.selectPolygon.uid),t.polygon(this.selectPolygon,"#888888"),t.crosshair(this.selectPolygon.vertices[0],3,"#008888"))},t.prototype.drawVertices=function(t,e){for(var i in this.vertices)this.drawConfig.drawVertices&&this.vertices[i].attr.renderTime!=t&&this.vertices[i].attr.visible&&(e.setCurrentId(this.vertices[i].uid),e.squareHandle(this.vertices[i],5,this._handleColor(this.vertices[i],"rgb(0,128,192)")),this.vertices[i].attr.renderTime=t)},t.prototype.redraw=function(){var t=this.renderTime++;this.draw.beginDrawCycle(t),this.fill.beginDrawCycle(t),this.config.preClear&&this.config.preClear(),this.clear(),this.config.preDraw&&this.config.preDraw(this.draw,this.fill),this.drawAll(t,this.draw,this.fill),this.config.postDraw&&this.config.postDraw(this.draw,this.fill),this.draw.endDrawCycle(t),this.fill.endDrawCycle(t)},t.prototype.drawAll=function(t,e,i){this.config.drawRaster&&this.drawGrid(e),this.config.drawOrigin&&this.drawOrigin(e),this.drawDrawables(t,e,i),this.drawVertices(t,e),this.drawSelectPolygon(e),e.setCurrentId(null),e.setCurrentClassName(null)},t.prototype.clear=function(){this.draw.clear(this.config.backgroundColor||"white")},t.prototype.clearSelection=function(t){for(var e in this.vertices)this.vertices[e].attr.isSelected=!1;return t&&this.redraw(),this},t.prototype.viewport=function(){var t,e;return new c.Bounds(this.transformMousePosition(0,0),this.transformMousePosition(this.canvasSize.width*(null!==(t=this.config.cssScaleX)&&void 0!==t?t:1),this.canvasSize.height*(null!==(e=this.config.cssScaleY)&&void 0!==e?e:1)))},t.prototype.saveFile=function(){this.hooks.saveFile(this)},t.prototype.getFProp=function(t,e){return parseFloat(globalThis.getComputedStyle(t,null).getPropertyValue(e))},t.prototype.getAvailableContainerSpace=function(){var t=this.canvas.parentNode;this.canvas.style.display="none";var e=this.getFProp(t,"padding")||0,i=this.getFProp(this.canvas,"border-width")||0,s=this.getFProp(t,"padding-left")||e,r=this.getFProp(t,"padding-right")||e,n=this.getFProp(t,"padding-top")||e,o=this.getFProp(t,"padding-bottom")||e,a=this.getFProp(this.canvas,"border-left-width")||i,h=this.getFProp(this.canvas,"border-right-width")||i,c=this.getFProp(this.canvas,"border-top-width")||i,l=this.getFProp(this.canvas,"border-bottom-width")||i,u=t.clientWidth,d=t.clientHeight;return this.canvas.style.display="block",{width:u-s-r-a-h,height:d-n-o-c-l}},t.prototype.resizeCanvas=function(){var t,e,i,s,r,n,o=this,a=this,h=function(t,e){var i,s;t*=null!==(i=a.config.canvasWidthFactor)&&void 0!==i?i:1,e*=null!==(s=a.config.canvasHeightFactor)&&void 0!==s?s:1,a.canvasSize.width=t,a.canvasSize.height=e,a.canvas instanceof HTMLCanvasElement?(a.canvas.width=t,a.canvas.height=e):a.canvas instanceof SVGElement?(o.canvas.setAttribute("viewBox","0 0 ".concat(t," ").concat(e)),o.canvas.setAttribute("width","".concat(t)),o.canvas.setAttribute("height","".concat(e)),o.draw.setSize(a.canvasSize),o.eventCatcher.style.width="".concat(t,"px"),o.eventCatcher.style.height="".concat(e,"px")):console.error("Error: cannot resize canvas element because it seems neither be a HTMLCanvasElement nor an SVGElement."),a.config.autoAdjustOffset&&a.adjustOffset(!1)};if(a.config.fullSize&&!a.config.fitToParent){var c=globalThis.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,l=globalThis.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;a.canvas.style.position="absolute",a.canvas.style.width=(null!==(t=a.config.canvasWidthFactor)&&void 0!==t?t:1)*c+"px",a.canvas.style.height=(null!==(e=a.config.canvasWidthFactor)&&void 0!==e?e:1)*l+"px",a.canvas.style.top="0px",a.canvas.style.left="0px",h(c,l)}else if(a.config.fitToParent){a.canvas.style.position="static";var u=this.getAvailableContainerSpace();a.canvas.style.width=(null!==(i=a.config.canvasWidthFactor)&&void 0!==i?i:1)*u.width+"px",a.canvas.style.height=(null!==(s=a.config.canvasHeightFactor)&&void 0!==s?s:1)*u.height+"px",a.canvas.style.top="",a.canvas.style.left="",h(u.width,u.height)}else a.canvas.style.width="",a.canvas.style.height="",h(null!==(r=a.config.defaultCanvasWidth)&&void 0!==r?r:1024,null!==(n=a.config.defaultCanvasHeight)&&void 0!==n?n:768);a.config.redrawOnResize&&a.redraw()},t.prototype.selectVerticesInPolygon=function(t){for(var e in this.vertices)this.vertices[e].attr.selectable&&t.containsVert(this.vertices[e])&&(this.vertices[e].attr.isSelected=!0)},t.prototype.locatePointNear=function(e,i){var s=this;void 0===i&&(i=7),i/=s.draw.scale.x;for(var r=0;r<s.vertices.length;r++){var n=s.vertices[r];if((n.attr.draggable||n.attr.selectable)&&n.distance(e)<i)return new t.Draggable(n,t.Draggable.VERTEX).setVIndex(r)}return null},t.prototype.handleClick=function(e){var i=this,s=this.locatePointNear(i.transformMousePosition(e.params.pos.x,e.params.pos.y),t.DEFAULT_CLICK_TOLERANCE/Math.min(i.config.cssScaleX||1,i.config.cssScaleY||1));if(s)i.vertices[s.vindex].listeners.fireClickEvent(e),this.keyHandler&&this.keyHandler.isDown("shift")?("bpath"==s.typeName?(r=i.paths[s.pindex].bezierCurves[s.cindex].getPointByID(s.pid)).attr.selectable&&(r.attr.isSelected=!r.attr.isSelected):"vertex"==s.typeName&&(r=i.vertices[s.vindex]).attr.selectable&&(r.attr.isSelected=!r.attr.isSelected),i.redraw()):this.keyHandler&&this.keyHandler.isDown("y")&&(i.vertices[s.vindex].attr.bezierAutoAdjust=!i.vertices[s.vindex].attr.bezierAutoAdjust,i.redraw());else if(null!=i.selectPolygon){var r=i.transformMousePosition(e.params.pos.x,e.params.pos.y);i.selectPolygon.vertices.push(new C.Vertex(r.x,r.y)),i.redraw()}},t.prototype.transformMousePosition=function(t,e){return{x:(t/this.config.cssScaleX-this.config.offsetX)/this.config.scaleX,y:(e/this.config.cssScaleY-this.config.offsetY)/this.config.scaleY}},t.prototype.revertMousePosition=function(t,e){return{x:t/this.config.cssScaleX+this.config.offsetX,y:e/this.config.cssScaleY+this.config.offsetY}},t.prototype.getDraggedElementCount=function(){return this.draggedElements.length},t.prototype.mouseDownHandler=function(e){var i=this;if(0==e.button){var s=i.locatePointNear(i.transformMousePosition(e.params.pos.x,e.params.pos.y),t.DEFAULT_CLICK_TOLERANCE/Math.min(i.config.cssScaleX,i.config.cssScaleY));if(s){if("vertex"==s.typeName&&i.vertices[s.vindex].attr.isSelected)for(var r=0;r<i.vertices.length;r++)i.vertices[r].attr.isSelected&&(i.draggedElements.push(new t.Draggable(i.vertices[r],t.Draggable.VERTEX).setVIndex(r)),i.vertices[r].listeners.fireDragStartEvent(e));else{if(!i.vertices[s.vindex].attr.draggable)return;i.draggedElements.push(s),"bpath"==s.typeName?i.paths[s.pindex].bezierCurves[s.cindex].getPointByID(s.pid).listeners.fireDragStartEvent(e):"vertex"==s.typeName&&i.vertices[s.vindex].listeners.fireDragStartEvent(e)}i.redraw()}}},t.prototype.mouseDragHandler=function(t){var e=this,i={x:t.params.dragAmount.x,y:t.params.dragAmount.y};if(t.params.dragAmount.x/=e.config.cssScaleX,t.params.dragAmount.y/=e.config.cssScaleY,this.isInPanningMode){if(!this.config.enablePan)return;e.setOffset(e.draw.offset.clone().add(t.params.dragAmount)),e.redraw()}else for(var s in t.params.dragAmount.x/=e.draw.scale.x,t.params.dragAmount.y/=e.draw.scale.y,e.draggedElements){var r=e.draggedElements[s];if("bpath"==r.typeName)e.paths[r.pindex].moveCurvePoint(r.cindex,r.pid,new C.Vertex(t.params.dragAmount.x,t.params.dragAmount.y)),e.paths[r.pindex].bezierCurves[r.cindex].getPointByID(r.pid).listeners.fireDragEvent(t);else if("vertex"==r.typeName){if(!e.vertices[r.vindex].attr.draggable)continue;e.vertices[r.vindex].add(t.params.dragAmount),e.vertices[r.vindex].listeners.fireDragEvent(t)}}t.params.dragAmount.x=i.x,t.params.dragAmount.y=i.y,e.redraw()},t.prototype.mouseUpHandler=function(t){var e=this;if(0==t.button){for(var i in t.params.wasDragged||e.handleClick(t),e.draggedElements){var s=e.draggedElements[i];"bpath"==s.typeName?e.paths[s.pindex].bezierCurves[s.cindex].getPointByID(s.pid).listeners.fireDragEndEvent(t):"vertex"==s.typeName&&e.vertices[s.vindex].listeners.fireDragEndEvent(t)}e.draggedElements=[],e.redraw()}},t.prototype.mouseWheelHandler=function(t){if(this.config.enableZoom){var e=1.25,i=this,s=t;s.deltaY<0?i.setZoom(i.config.scaleX*e,i.config.scaleY*e,new C.Vertex(t.params.pos.x,t.params.pos.y)):s.deltaY>0&&i.setZoom(i.config.scaleX/e,i.config.scaleY/e,new C.Vertex(t.params.pos.x,t.params.pos.y)),t.preventDefault(),i.redraw()}},t.prototype.adjustOffset=function(t){this.draw.offset.x=this.fill.offset.x=this.config.offsetX=this.canvasSize.width*(this.config.offsetAdjustXPercent/100),this.draw.offset.y=this.fill.offset.y=this.config.offsetY=this.canvasSize.height*(this.config.offsetAdjustYPercent/100),t&&this.redraw()},t.prototype.setOffset=function(t){this.draw.offset.set(t),this.fill.offset.set(t),this.config.offsetX=t.x,this.config.offsetY=t.y},t.prototype.setZoom=function(t,e,i){var s=this.transformMousePosition(i.x,i.y);this.draw.scale.x=this.fill.scale.x=this.config.scaleX=Math.max(t,.01),this.draw.scale.y=this.fill.scale.y=this.config.scaleY=Math.max(e,.01);var r=this.transformMousePosition(i.x,i.y),n=this.draw.offset.x+(r.x-s.x)*this.draw.scale.x,o=this.draw.offset.y+(r.y-s.y)*this.draw.scale.y;this.setOffset({x:n,y:o})},t.prototype.installInputListeners=function(){var e=this,i=this;if(this.config.enableMouse?new y.MouseHandler(this.eventCatcher?this.eventCatcher:this.canvas).down(function(t){i.mouseDownHandler(t)}).drag(function(t){i.mouseDragHandler(t)}).up(function(t){i.mouseUpHandler(t)}):i.console.log("Mouse interaction disabled."),this.config.enableMouseWheel?new y.MouseHandler(this.eventCatcher?this.eventCatcher:this.canvas).wheel(function(t){i.mouseWheelHandler(t)}):i.console.log("Mouse wheel interaction disabled."),this.config.enableTouch){var s=function(t){var e=i.canvas.getBoundingClientRect();return{x:t.x-e.left,y:t.y-e.top}};if("function"==typeof globalThis.AlloyFinger||"function"==typeof globalThis.createAlloyFinger)try{var n=null,o=null,a=null,h=null,c=function(){n=null,o=null,a=null,h=null,i.draggedElements=[]},l={touchStart:function(e){if(1==e.touches.length&&(n=new C.Vertex(s({x:e.touches[0].clientX,y:e.touches[0].clientY})),o=new C.Vertex(s({x:e.touches[0].clientX,y:e.touches[0].clientY})),(a=i.locatePointNear(i.transformMousePosition(n.x,n.y),t.DEFAULT_TOUCH_TOLERANCE/Math.min(i.config.cssScaleX,i.config.cssScaleY)))&&"vertex"==a.typeName)){var r=i.vertices[a.vindex],h={params:{isTouchEvent:!0,dragAmount:{x:0,y:0},wasDragged:!1,mouseDownPos:o.clone(),mouseDragPos:o.clone(),vertex:r}};i.draggedElements=[a],r.listeners.fireDragStartEvent(h)}},touchMove:function(t){if(1==t.touches.length&&a){if(t.preventDefault(),t.stopPropagation(),!o||!n)return;var r=s({x:t.touches[0].clientX,y:t.touches[0].clientY}),h=i.transformMousePosition(r.x,r.y),c=new C.Vertex(i.transformMousePosition(n.x,n.y)).difference(h);if("vertex"==a.typeName){if(!i.vertices[a.vindex].attr.draggable)return;i.vertices[a.vindex].add(c);var l=i.vertices[a.vindex],u={isTouchEvent:!0,params:{dragAmount:c.clone(),wasDragged:!0,mouseDownPos:o.clone(),mouseDragPos:o.clone().add(c),vertex:l}};l.listeners.fireDragEvent(u),i.redraw()}n=new C.Vertex(r)}else if(2==t.touches.length){if(!e.config.enablePan)return;t.preventDefault(),t.stopPropagation(),i.setOffset(i.draw.offset.clone().addXY(t.deltaX,t.deltaY)),i.redraw()}},touchEnd:function(t){if(a&&"vertex"==a.typeName){if(!o)return;var e=i.vertices[a.vindex],s={isTouchEvent:!0,params:{dragAmount:{x:0,y:0},wasDragged:!1,mouseDownPos:o.clone(),mouseDragPos:o.clone(),vertex:e}};n&&o&&o.distance(n)<.001?e.listeners.fireClickEvent(s):e.listeners.fireDragEndEvent(s)}c()},touchCancel:function(t){c()},multipointStart:function(t){h=i.draw.scale.clone()},multipointEnd:function(t){h=null},pinch:function(t){if(e.config.enableZoom){var s=t.touches.item(0),r=t.touches.item(1);if(t.touches&&h&&s&&r){var n=new C.Vertex(s.clientX,s.clientY),o=new C.Vertex(r.clientX,r.clientY),a=new f.Line(n,o).vertAt(.5);i.setZoom(h.x*t.zoom,h.y*t.zoom,a),i.redraw()}}}};window.createAlloyFinger?(0,window.createAlloyFinger)(this.eventCatcher?this.eventCatcher:this.canvas,l):new r.default(this.eventCatcher?this.eventCatcher:this.canvas,l)}catch(t){console.error("Failed to initialize AlloyFinger!"),console.error(t)}else globalThis.Touchy&&"function"==typeof globalThis.Touchy?console.error("[Deprecation] Found Touchy which is not supported any more. Please use AlloyFinger instead."):console.warn("Cannot initialize the touch handler. AlloyFinger is missig. Did you include it?")}else i.console.log("Touch interaction disabled.");this.config.enableKeys?this.keyHandler=new p.KeyHandler({trackAll:!0}).down("escape",function(){i.clearSelection(!0)}).down("shift",function(){i.selectPolygon=new g.Polygon,i.redraw()}).up("shift",function(){null!=i.selectPolygon&&(i.selectVerticesInPolygon(i.selectPolygon),i.selectPolygon=null,i.redraw())}).down("alt",function(){i.isInPanningMode=!0}).up("alt",function(){i.isInPanningMode=!1}).down("spacebar",function(){i.isInPanningMode=!0}).up("spacebar",function(){i.isInPanningMode=!1}):i.console.log("Keyboard interaction disabled.")},t.prototype.createGUI=function(t){var e=globalThis.utils;if(e&&"function"==typeof e.createGUI)return this._gui=e.createGUI(this,t);throw"Cannot create dat.GUI or lil-gui instance; did you load the ./utils/creategui helper function an the dat.GUI/lil-gui library?"},t.prototype.getGUI=function(){return this._gui},t.DEFAULT_CANVAS_WIDTH=1024,t.DEFAULT_CANVAS_HEIGHT=768,t.DEFAULT_CLICK_TOLERANCE=8,t.DEFAULT_TOUCH_TOLERANCE=32,t.Draggable=(e=function(){function e(t,e){this.item=t,this.typeName=e}return e.prototype.isVertex=function(){return this.typeName==t.Draggable.VERTEX},e.prototype.setVIndex=function(t){return this.vindex=t,this},e}(),s(e,"Draggable"),e.VERTEX="vertex",e),t.utils={safeMergeByKeys:function(t,e){for(var i in e)if(e.hasOwnProperty(i))if(t.hasOwnProperty(i)){var s=typeof t[i],r=e[i];try{t[i]="boolean"==s?"string"==typeof r?Boolean(!!JSON.parse(r)):r:"number"==s&&"string"==typeof r?Number(1*JSON.parse(r)):e[i]}catch(t){console.error("error in key ",i,r,t)}}else t[i]=e[i];return t},setCSSscale:function(t,e,i){t.style.transformOrigin="0 0",1==e&&1==i?t.style.removeProperty("transform"):t.style.transform="scale("+e+","+i+")"},fetch:{val:function(t,e,i){return t.hasOwnProperty(e)?void 0===t[e]?i:t[e]:i},num:function(t,e,i){if(!t.hasOwnProperty(e))return i;if("number"==typeof t[e])return t[e];try{return 1*JSON.parse(t[e])}catch(t){return i}},bool:function(t,e,i){if(!t.hasOwnProperty(e))return i;if("boolean"==typeof t[e])return t[e];try{return!!JSON.parse(t[e])}catch(t){return i}},func:function(t,e,i){return t.hasOwnProperty(e)?"function"!=typeof t[e]?i:t[e]:i}},enableBezierPathAutoAdjust:function(t){for(var e=0;e<t.bezierCurves.length;e++)t.bezierCurves[e].startPoint.listeners.addDragListener(function(e){var i=t.locateCurveByStartPoint(e.params.vertex);t.bezierCurves[i].startPoint.addXY(-e.params.dragAmount.x,-e.params.dragAmount.y),t.moveCurvePoint(1*i,t.START_POINT,e.params.dragAmount),t.updateArcLengths()}),t.bezierCurves[e].startControlPoint.listeners.addDragListener(function(e){var i=t.locateCurveByStartControlPoint(e.params.vertex);t.bezierCurves[i].startPoint.attr.bezierAutoAdjust&&(t.adjustPredecessorControlPoint(1*i,!0,!1),t.updateArcLengths())}),t.bezierCurves[e].endControlPoint.listeners.addDragListener(function(e){var i=t.locateCurveByEndControlPoint(e.params.vertex);t.bezierCurves[i%t.bezierCurves.length].endPoint.attr.bezierAutoAdjust&&(t.adjustSuccessorControlPoint(1*i,!0,!1),t.updateArcLengths())}),e+1==t.bezierCurves.length&&t.bezierCurves[t.bezierCurves.length-1].endPoint.listeners.addDragListener(function(e){if(!t.adjustCircular){var i=t.locateCurveByEndPoint(e.params.vertex);t.moveCurvePoint(1*i,t.END_CONTROL_POINT,new C.Vertex({x:e.params.dragAmount.x,y:e.params.dragAmount.y}))}t.updateArcLengths()})}},t}();e.PlotBoilerplate=T,e.default=T},590:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VertTuple=void 0;var s=i(787),r=i(938),n=function(){function t(t,e,i){this.uid=r.UIDGenerator.next(),this.a=t,this.b=e,this.factory=i}return t.prototype.length=function(){return Math.sqrt(Math.pow(this.b.x-this.a.x,2)+Math.pow(this.b.y-this.a.y,2))},t.prototype.setLength=function(t){return this.scale(t/this.length())},t.prototype.sub=function(t){return this.a.sub(t),this.b.sub(t),this},t.prototype.add=function(t){return this.a.add(t),this.b.add(t),this},t.prototype.revert=function(){var t=this.a;return this.a=this.b,this.b=t,this},t.prototype.normalize=function(){return this.b.set(this.a.x+(this.b.x-this.a.x)/this.length(),this.a.y+(this.b.y-this.a.y)/this.length()),this},t.prototype.scale=function(t){return this.b.set(this.a.x+(this.b.x-this.a.x)*t,this.a.y+(this.b.y-this.a.y)*t),this},t.prototype.moveTo=function(t){var e=this.a.difference(t);return this.a.add(e),this.b.add(e),this},t.prototype.move=function(t){return this.a.add(t),this.b.add(t),this},t.prototype.angle=function(t){null!=t&&void 0!==t||(t=this.factory(new s.Vertex(0,0),new s.Vertex(100,0)));var e=this.b.clone().sub(this.a),i=t.b.clone().sub(t.a);return Math.atan2(i.x,i.y)-Math.atan2(e.x,e.y)},t.prototype.vertAt=function(t){return new s.Vertex(this.a.x+(this.b.x-this.a.x)*t,this.a.y+(this.b.y-this.a.y)*t)},t.prototype.denominator=function(t){return(t.b.y-t.a.y)*(this.b.x-this.a.x)-(t.b.x-t.a.x)*(this.b.y-this.a.y)},t.prototype.colinear=function(t,e){return Math.abs(this.denominator(t))<(void 0===e?s.Vertex.EPSILON:e)},t.prototype.getClosestT=function(e){var i=t.vtutils.dist2(this.a,this.b);return 0===i?0:((e.x-this.a.x)*(this.b.x-this.a.x)+(e.y-this.a.y)*(this.b.y-this.a.y))/i},t.prototype.hasPoint=function(e,i,r){var n=this.getClosestT(e),o=Math.sqrt(t.vtutils.dist2(e,this.vertAt(n)));return void 0!==i&&i?o<(null!=r?r:s.Vertex.EPSILON)&&n>=0&&n<=1:o<(null!=r?r:s.Vertex.EPSILON)},t.prototype.getClosestPoint=function(t){var e=this.getClosestT(t);return this.vertAt(e)},t.prototype.pointDistance=function(e){return Math.sqrt(t.vtutils.dist2(e,this.vertAt(this.getClosestT(e))))},t.prototype.clone=function(){return this.factory(this.a.clone(),this.b.clone())},t.prototype.toString=function(){return"{ a : "+this.a.toString()+", b : "+this.b.toString()+" }"},t.prototype.destroy=function(){this.a.destroy(),this.b.destroy(),this.isDestroyed=!0},t.vtutils={dist2:function(t,e){return(t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y)}},t}();e.VertTuple=n},597:(t,e,i)=>{i.r(e),i.d(e,{AlloyFinger:()=>o,default:()=>a});const s=t=>Math.sqrt(t.x*t.x+t.y*t.y);class r{constructor(t){this.handlers=[],this.el=t}add(t){this.handlers.push(t)}del(t){t||(this.handlers=[]);for(var e=this.handlers.length;e>=0;e--)this.handlers[e]===t&&this.handlers.splice(e,1)}dispatch(...t){for(var e=0,i=this.handlers.length;e<i;e++){const t=this.handlers[e];"function"==typeof t&&t.apply(this.el,arguments)}}}const n=(t,e)=>{const i=new r(t);return i.add(e),i};class o{constructor(t,e){this.element="string"==typeof t?document.querySelector(t):t,this.start=this.start.bind(this),this.move=this.move.bind(this),this.end=this.end.bind(this),this.cancel=this.cancel.bind(this),this.element.addEventListener("touchstart",this.start,!1),this.element.addEventListener("touchmove",this.move,!1),this.element.addEventListener("touchend",this.end,!1),this.element.addEventListener("touchcancel",this.cancel,!1),this.preV={x:null,y:null},this.pinchStartLen=null,this.zoom=1,this.isDoubleTap=!1;const i=()=>{};this.rotate=n(this.element,e.rotate||i),this.touchStart=n(this.element,e.touchStart||i),this.multipointStart=n(this.element,e.multipointStart||i),this.multipointEnd=n(this.element,e.multipointEnd||i),this.pinch=n(this.element,e.pinch||i),this.swipe=n(this.element,e.swipe||i),this.tap=n(this.element,e.tap||i),this.doubleTap=n(this.element,e.doubleTap||i),this.longTap=n(this.element,e.longTap||i),this.singleTap=n(this.element,e.singleTap||i),this.pressMove=n(this.element,e.pressMove||i),this.twoFingerPressMove=n(this.element,e.twoFingerPressMove||i),this.touchMove=n(this.element,e.touchMove||i),this.touchEnd=n(this.element,e.touchEnd||i),this.touchCancel=n(this.element,e.touchCancel||i),this._cancelAllHandler=this.cancelAll.bind(this),globalThis&&"function"==typeof globalThis.addEventListener&&globalThis.addEventListener("scroll",this._cancelAllHandler),this.delta=null,this.last=null,this.now=null,this.tapTimeout=null,this.singleTapTimeout=null,this.longTapTimeout=null,this.swipeTimeout=null,this.x1=this.x2=this.y1=this.y2=null,this.preTapPosition={x:null,y:null}}start(t){if(!t.touches)return;const e=this;this.now=Date.now(),this.x1=t.touches[0].pageX,this.y1=t.touches[0].pageY,this.delta=this.now-(this.last||this.now),this.touchStart.dispatch(t,this.element),null!==this.preTapPosition.x&&(this.isDoubleTap=this.delta>0&&this.delta<=250&&Math.abs(this.preTapPosition.x-this.x1)<30&&Math.abs(this.preTapPosition.y-this.y1)<30,this.isDoubleTap&&clearTimeout(this.singleTapTimeout)),this.preTapPosition.x=this.x1,this.preTapPosition.y=this.y1,this.last=this.now;const i=this.preV;if(t.touches.length>1){this._cancelLongTap(),this._cancelSingleTap();const e={x:t.touches[1].pageX-this.x1,y:t.touches[1].pageY-this.y1};i.x=e.x,i.y=e.y,this.pinchStartLen=s(i),this.multipointStart.dispatch(t,this.element)}this._preventTap=!1,this.longTapTimeout=setTimeout((()=>{e.longTap.dispatch(t,e.element),e._preventTap=!0}).bind(e),750)}move(t){if(!t.touches)return;const e=t,i=this.preV,r=t.touches.length,n=t.touches[0].pageX,o=t.touches[0].pageY;if(this.isDoubleTap=!1,r>1){const t=e.touches[1].pageX,r=e.touches[1].pageY,l={x:e.touches[1].pageX-n,y:e.touches[1].pageY-o};null!==i.x&&(this.pinchStartLen>0&&(e.zoom=s(l)/this.pinchStartLen,this.pinch.dispatch(e,this.element)),e.angle=(c=((t,e)=>{const i=s(t)*s(e);if(0===i)return 0;var r=((t,e)=>t.x*e.x+t.y*e.y)(t,e)/i;return r>1&&(r=1),Math.acos(r)})(a=l,h=i),((t,e)=>t.x*e.y-e.x*t.y)(a,h)>0&&(c*=-1),180*c/Math.PI),this.rotate.dispatch(e,this.element)),i.x=l.x,i.y=l.y,null!==this.x2&&null!==this.sx2?(e.deltaX=(n-this.x2+t-this.sx2)/2,e.deltaY=(o-this.y2+r-this.sy2)/2):(e.deltaX=0,e.deltaY=0),this.twoFingerPressMove.dispatch(e,this.element),this.sx2=t,this.sy2=r}else{if(null!==this.x2){e.deltaX=n-this.x2,e.deltaY=o-this.y2;const t=Math.abs(this.x1-this.x2),i=Math.abs(this.y1-this.y2);(t>10||i>10)&&(this._preventTap=!0)}else e.deltaX=0,e.deltaY=0;this.pressMove.dispatch(e,this.element)}var a,h,c;this.touchMove.dispatch(e,this.element),this._cancelLongTap(),this.x2=n,this.y2=o,r>1&&t.preventDefault()}end(t){if(!t.changedTouches)return;const e=t;this._cancelLongTap();const i=this;e.touches.length<2&&(this.multipointEnd.dispatch(e,this.element),this.sx2=this.sy2=null),this.x2&&Math.abs(this.x1-this.x2)>30||this.y2&&Math.abs(this.y1-this.y2)>30?(e.direction=this._swipeDirection(this.x1,this.x2,this.y1,this.y2),this.swipeTimeout=setTimeout(function(){i.swipe.dispatch(e,i.element)},0)):(this.tapTimeout=setTimeout(function(){i._preventTap||i.tap.dispatch(e,i.element),i.isDoubleTap&&(i.doubleTap.dispatch(e,i.element),i.isDoubleTap=!1)},0),i.isDoubleTap||(i.singleTapTimeout=setTimeout(function(){i.singleTap.dispatch(e,i.element)},250))),this.touchEnd.dispatch(e,this.element),this.preV.x=0,this.preV.y=0,this.zoom=1,this.pinchStartLen=null,this.x1=this.x2=this.y1=this.y2=null}cancelAll(){this._preventTap=!0,clearTimeout(this.singleTapTimeout),clearTimeout(this.tapTimeout),clearTimeout(this.longTapTimeout),clearTimeout(this.swipeTimeout)}cancel(t){this.cancelAll(),this.touchCancel.dispatch(t,this.element)}_cancelLongTap(){clearTimeout(this.longTapTimeout)}_cancelSingleTap(){clearTimeout(this.singleTapTimeout)}_swipeDirection(t,e,i,s){return Math.abs(t-e)>=Math.abs(i-s)?t-e>0?"Left":"Right":i-s>0?"Up":"Down"}on(t,e){this[t]&&this[t].add(e)}off(t,e){this[t]&&this[t].del(e)}destroy(){this.singleTapTimeout&&clearTimeout(this.singleTapTimeout),this.tapTimeout&&clearTimeout(this.tapTimeout),this.longTapTimeout&&clearTimeout(this.longTapTimeout),this.swipeTimeout&&clearTimeout(this.swipeTimeout),this.element.removeEventListener("touchstart",this.start),this.element.removeEventListener("touchmove",this.move),this.element.removeEventListener("touchend",this.end),this.element.removeEventListener("touchcancel",this.cancel),this.rotate.del(),this.touchStart.del(),this.multipointStart.del(),this.multipointEnd.del(),this.pinch.del(),this.swipe.del(),this.tap.del(),this.doubleTap.del(),this.longTap.del(),this.singleTap.del(),this.pressMove.del(),this.twoFingerPressMove.del(),this.touchMove.del(),this.touchEnd.del(),this.touchCancel.del(),this.preV=this.pinchStartLen=this.zoom=this.isDoubleTap=this.delta=this.last=this.now=this.tapTimeout=this.singleTapTimeout=this.longTapTimeout=this.swipeTimeout=this.x1=this.x2=this.y1=this.y2=this.preTapPosition=this.rotate=this.touchStart=this.multipointStart=this.multipointEnd=this.pinch=this.swipe=this.tap=this.doubleTap=this.longTap=this.singleTap=this.pressMove=this.touchMove=this.touchEnd=this.touchCancel=this.twoFingerPressMove=null,globalThis&&"function"==typeof globalThis.removeEventListener&&globalThis.removeEventListener("scroll",this._cancelAllHandler)}}const a=o},628:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PBText=void 0;var s=i(938),r=i(787),n=function(){function t(t,e,i){this.className="PBText",this.uid=s.UIDGenerator.next(),this.text=t,this.anchor=null!=e?e:new r.Vertex,this.color=null==i?void 0:i.color,this.fontFamily=null==i?void 0:i.fontFamily,this.fontSize=null==i?void 0:i.fontSize,this.fontStyle=null==i?void 0:i.fontStyle,this.fontWeight=null==i?void 0:i.fontWeight,this.lineHeight=null==i?void 0:i.lineHeight,this.textAlign=null==i?void 0:i.textAlign,this.rotation=null==i?void 0:i.rotation}return t.prototype.destroy=function(){this.anchor.destroy(),this.isDestroyed=!0},t}();e.PBText=n},687:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Polygon=void 0;var s=i(733),r=i(76),n=i(939),o=i(737),a=i(938),h=i(30),c=i(787),l=i(328),u=function(){function t(t,e){this.className="Polygon",this.uid=a.UIDGenerator.next(),void 0===t&&(t=[]),this.vertices=t,this.isOpen=e||!1}return t.prototype.addVertex=function(t){this.vertices.push(t)},t.prototype.addVertexAt=function(t,e){this.vertices.splice(e,0,t)},t.prototype.getEdgeAt=function(t){return new n.Line(this.getVertexAt(t),this.getVertexAt(t+1))},t.prototype.getEdges=function(){for(var t=[],e=0;e+1<this.vertices.length;e++)t.push(this.getEdgeAt(e));return!this.isOpen&&this.vertices.length>0&&t.push(this.getEdgeAt(this.vertices.length-1)),t},t.prototype.getInnerAngleAt=function(t){var e=this.vertices[t%this.vertices.length],i=this.vertices[(t+this.vertices.length-1)%this.vertices.length].clone(),s=this.vertices[(t+1)%this.vertices.length].clone(),r=this.isAngleAcute(t),n=new c.Vertex(0,0),o=new c.Vertex(e.x-i.x,e.y-i.y),a=new c.Vertex(s.x-e.x,s.y-e.y),h=n.distance(o),u=n.distance(a),d=l.geomutils.dotProduct(o,a),p=h*u;return r?Math.PI-Math.acos(d/p):Math.PI+Math.acos(d/p)},t.prototype.isAngleAcute=function(t){var e=this.vertices[(t+this.vertices.length-1)%this.vertices.length].clone(),i=this.vertices[t%this.vertices.length],s=this.vertices[(t+1)%this.vertices.length].clone();return o.Triangle.utils.determinant(e,i,s)<0},t.prototype.getVertexAt=function(t){return t<0?this.vertices[this.vertices.length-Math.abs(t)%this.vertices.length]:this.vertices[t%this.vertices.length]},t.prototype.move=function(t){for(var e in this.vertices)this.vertices[e].add(t);return this},t.prototype.containsVert=function(t){for(var e=!1,i=0,s=this.vertices.length-1;i<this.vertices.length;s=i++){var r=this.vertices[i].x,n=this.vertices[i].y,o=this.vertices[s].x,a=this.vertices[s].y;n>t.y!=a>t.y&&t.x<(o-r)*(t.y-n)/(a-n)+r&&(e=!e)}return e},t.prototype.containsVerts=function(t){var e=this;return t.every(function(t){return e.containsVert(t)})},t.prototype.containsPolygon=function(t){for(var e=0;e<t.vertices.length;e++)if(!this.containsVert(t.vertices[e]))return!1;var i=new n.Line(new c.Vertex,new c.Vertex);for(e=0;e<t.vertices.length;e++)if(i.a.set(t.vertices[e]),i.b.set(t.vertices[(e+1)%t.vertices.length]),this.lineIntersections(i,!0).length>0)return!1;return!0},t.prototype.area=function(){return t.utils.area(this.vertices)},t.prototype.signedArea=function(){return t.utils.signedArea(this.vertices)},t.prototype.isClockwise=function(){return t.utils.isClockwise(this.vertices)},t.prototype.perimeter=function(){for(var t=0,e=1;e<this.vertices.length;e++)t+=this.vertices[e-1].distance(this.vertices[e]);return!this.isOpen&&this.vertices.length>1&&(t+=this.vertices[0].distance(this.vertices[this.vertices.length-1])),t},t.prototype.scale=function(t,e){for(var i in this.vertices)"function"==typeof this.vertices[i].scale?this.vertices[i].scale(t,e):console.log("There seems to be a null vertex!",this.vertices[i]);return this},t.prototype.rotate=function(t,e){for(var i in this.vertices)this.vertices[i].rotate(t,e);return this},t.prototype.getMeanCenter=function(){if(0===this.vertices.length)return null;for(var t=this.vertices[0].clone(),e=1;e<this.vertices.length;e++)t.add(this.vertices[e]);return t.x/=this.vertices.length,t.y/=this.vertices.length,t},t.prototype.getCentroid=function(){if(0===this.vertices.length)return null;for(var t=new c.Vertex(0,0),e=this.vertices.length,i=0;i<e;i++){var s=this.vertices[i],r=this.vertices[(i+1)%e],n=s.x*r.y-r.x*s.y;t.x+=(s.x+r.x)*n,t.y+=(s.y+r.y)*n}var o=this.area();return t.x*=1/(6*o),t.y*=1/(6*o),t},t.prototype.lineIntersections=function(e,i){return void 0===i&&(i=!1),t.utils.locateLineIntersecion(e,this.vertices,this.isOpen,i).map(function(t){return t.intersection})},t.prototype.lineIntersectionTangents=function(e,i){var s=this;return void 0===i&&(i=!1),t.utils.locateLineIntersecion(e,this.vertices,this.isOpen,i).map(function(t){var e=s.getEdgeAt(t.edgeIndex);return new h.Vector(e.a.clone(),e.b.clone()).moveTo(t.intersection)})},t.prototype.lineIntersectionTangentsIndices=function(e,i){var s=this;return void 0===i&&(i=!1),t.utils.locateLineIntersecion(e,this.vertices,this.isOpen,i).map(function(t){var e=s.getEdgeAt(t.edgeIndex);return{intersection:new h.Vector(e.a.clone(),e.b.clone()).moveTo(t.intersection),edgeIndex:t.edgeIndex}})},t.prototype.closestLineIntersection=function(t,e){void 0===e&&(e=!1);var i=this.closestLineIntersectionIndex(t,e);return i?i.intersection:null},t.prototype.closestLineIntersectionIndex=function(t,e){void 0===e&&(e=!1);var i=this.lineIntersections(t,e);if(i.length<=0)return null;for(var s=new c.Vertex(Number.MAX_VALUE,Number.MAX_VALUE),r=-1,n=Number.MAX_VALUE,o=0;o<i.length;o++){var a=i[o],h=a.distance(t.a);h<n&&(n=h,s=a,r=o)}return{edgeIndex:r,intersection:s}},t.prototype.getInterpolationPolygon=function(e){for(var i=[],s=0;s<this.vertices.length;s++){var r=this.vertices[s],n=this.vertices[(s+1)%this.vertices.length];if(i.push(r.clone()),!this.isOpen||s+1!==this.vertices.length)for(var o=1/(e+1),a=1;a<=e;a++)i.push(r.clone().lerp(n,o*a))}return new t(i,this.isOpen)},t.prototype.getEvenDistributionPolygon=function(e){if(e<=0)throw new Error("pointCount must be larger than zero; is "+e+".");var i=new t([],this.isOpen);if(0===this.vertices.length)return i;var s=new c.Vertex(this.vertices[0]);if(i.vertices.push(s),1===this.vertices.length)return i;for(var r=this.perimeter()/e,n=this.vertices.length,o=1,a=new c.Vertex(this.vertices[1]),h=s.distance(a),l=this.isOpen?n:n+1,u=r,d=1;d<e&&o<l;)if(u<h){var p=s.clone().lerpAbs(a,u);i.vertices.push(p),u+=r,d++}else o++,s=a,a=new c.Vertex(this.vertices[o%n]),u-=h,h=s.distance(a);return i},t.prototype.getBounds=function(){return r.Bounds.computeFromVertices(this.vertices)},t.prototype.clone=function(){return new t(this.vertices.map(function(t){return t.clone()}),this.isOpen)},t.prototype.elimitateColinearEdges=function(e){for(var i=void 0===e?1:e,s=this.vertices.slice(),r=0,o=new n.Line(new c.Vertex,new c.Vertex),a=new n.Line(new c.Vertex,new c.Vertex);r+1<s.length&&s.length>2;){var h=s[r],l=s[(r+1)%s.length];o.a=h,o.b=l,a.a=l;var u=!1,d=r+2;do{var p=s[d%s.length];a.b=p,(u=o.colinear(a,i))&&d++}while(u);d-r>2&&s.splice(r+1,d-r-2),r++}return new t(s,this.isOpen)},t.prototype.toQuadraticBezierData=function(){if(this.vertices.length<3)return[];var t=[],e=this.vertices[0],i=this.vertices[1],s=new c.Vertex(e.x+(i.x-e.x)/2,e.y+(i.y-e.y)/2);t.push(s);for(var r=this.isOpen?this.vertices.length:this.vertices.length+1,n=1;n<r;n++)e=this.vertices[n%this.vertices.length],i=this.vertices[(n+1)%this.vertices.length],s=new c.Vertex(e.x+(i.x-e.x)/2,e.y+(i.y-e.y)/2),t.push(e),t.push(s),e=i;return t},t.prototype.toQuadraticBezierSVGString=function(){var t=this.toQuadraticBezierData();if(0==t.length)return"";for(var e=["M "+t[0].x+" "+t[0].y],i=1;i<t.length;i+=2)e.push("Q "+t[i].x+" "+t[i].y+", "+t[i+1].x+" "+t[i+1].y);return e.join(" ")},t.prototype.toCubicBezierData=function(t){if(void 0===t&&(t=1),this.vertices.length<3)return[];var e=[],i=this.vertices[0],s=this.vertices[1],r=new c.Vertex(i.x+(s.x-i.x)/2,i.y+(s.y-i.y)/2);e.push(r);for(var n=this.isOpen?this.vertices.length-1:this.vertices.length,o=0;o<n;o++){i=this.vertices[o%this.vertices.length],s=this.vertices[(o+1)%this.vertices.length];var a=this.vertices[(o+2)%this.vertices.length],h=new c.Vertex(i.x+(s.x-i.x)/2,i.y+(s.y-i.y)/2),l=new c.Vertex(s.x+(a.x-s.x)/2,s.y+(a.y-s.y)/2),u=new c.Vertex(h.x+(s.x-h.x)*t,h.y+(s.y-h.y)*t),d=new c.Vertex(l.x+(s.x-l.x)*t,l.y+(s.y-l.y)*t);e.push(u),e.push(d),e.push(l)}return e},t.prototype.toCubicBezierSVGString=function(t){var e=this.toCubicBezierData(t);if(0==e.length)return"";for(var i=["M "+e[0].x+" "+e[0].y],s=1;s<e.length;s+=3)i.push("C "+e[s].x+" "+e[s].y+", "+e[s+1].x+" "+e[s+1].y+", "+e[s+2].x+" "+e[s+2].y);return i.join(" ")},t.prototype.toCubicBezierPath=function(t){for(var e=this.toCubicBezierData(t),i=[],r=0;r+3<e.length;r+=3)i.push([e[r],e[r+3],e[r+1],e[r+2]]);return s.BezierPath.fromArray(i)},t.prototype.destroy=function(){for(var t=0;t<this.vertices.length;t++)this.vertices[t].destroy();this.isDestroyed=!0},t.utils={area:function(t){for(var e=0,i=0,s=t.length;i<s;i++)e+=t[i].x*t[(i+1)%s].y*.5,e-=t[(i+1)%s].x*t[i].y*.5;return Math.abs(e)},isClockwise:function(e){return t.utils.signedArea(e)<0},signedArea:function(t){for(var e=0,i=t.length,s=0;s<i;s++){var r=(s+1)%i;e+=(t[r].x-t[s].x)*(t[s].y+t[r].y)}return e},locateLineIntersecion:function(t,e,i,s){for(var r=[],o=i?e.length-1:e.length,a=0;a<o;a++){var h=new n.Line(e[a%o],e[(a+1)%o]),c=h.intersection(t);null===c||!h.hasPoint(c,!0)||s&&!t.hasPoint(c,s)||r.push({edgeIndex:a,intersection:c})}return r}},t}();e.Polygon=u},719:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VEllipseSector=void 0;var s=i(76),r=i(973),n=i(328),o=i(939),a=i(938),h=i(881),c=i(787),l=function(){function t(t,e,i){this.className="VEllipseSector",this.uid=a.UIDGenerator.next(),this.ellipse=t,this.startAngle=n.geomutils.wrapMinMax(e,0,2*Math.PI),this.endAngle=n.geomutils.wrapMinMax(i,0,2*Math.PI)}return t.prototype.move=function(t){return this.ellipse.move(t),this},t.prototype.containsAngle=function(t){t=n.geomutils.mapAngleTo2PI(t);var e=n.geomutils.mapAngleTo2PI(this.startAngle),i=n.geomutils.mapAngleTo2PI(this.endAngle);return e<=i?t>=e&&t<i:t>=e||t<i},t.prototype.getStartPoint=function(){return this.ellipse.vertAt(this.startAngle)},t.prototype.getEndPoint=function(){return this.ellipse.vertAt(this.endAngle)},t.prototype.getBounds=function(){var t=this,e=this.ellipse.getExtremePoints().filter(function(e){var i=new o.Line(t.ellipse.center,e).angle()-t.ellipse.rotation;return t.containsAngle(i)});return s.Bounds.computeFromVertices([this.getStartPoint(),this.getEndPoint()].concat(e))},t.prototype.lineIntersections=function(t,e){var i=this;void 0===e&&(e=!1);var s=this.ellipse.lineIntersections(t,e),r=new o.Line(this.ellipse.center,new c.Vertex);return s.filter(function(t){r.b.set(t);var e=r.angle();return i.containsAngle(e-i.ellipse.rotation)})},t.prototype.lineIntersectionTangents=function(t,e){var i=this;return void 0===e&&(e=!1),this.lineIntersections(t,e).map(function(t){var e=new o.Line(i.ellipse.center,t).angle();return i.ellipse.tangentAt(e)})},t.prototype.toCubicBezier=function(e,i){var s=4*Math.max(1,e||3);i=void 0===i?.666666:i;for(var n=this.ellipse.radiusH(),o=this.ellipse.radiusV(),a=t.ellipseSectorUtils.normalizeAngle(this.startAngle),h=t.ellipseSectorUtils.normalizeAngle(this.endAngle),c=t.ellipseSectorUtils.equidistantVertAngles(n,o,a,h,s),l=[],u=(c=[a].concat(c).concat([h]))[0],d=this.ellipse.vertAt(u),p=0;p+1<c.length;p++){var f=c[(p+1)%c.length],y=this.ellipse.vertAt(f),v=this.ellipse.tangentAt(u+this.ellipse.rotation),g=this.ellipse.tangentAt(f+this.ellipse.rotation);if(Math.abs(o)<1e-4||Math.abs(n)<1e-4){var x=d.difference(y),m=new r.CubicBezierCurve(d.clone(),y.clone(),d.clone().addXY(.333*x.x,.333*x.y),y.clone().addXY(.333*-x.x,.333*-x.y));l.push(m)}else{var b=v.intersection(g);if(b){var w=d.difference(b),C=y.difference(b);m=new r.CubicBezierCurve(d.clone(),y.clone(),d.clone().add(w.scale(i)),y.clone().add(C.scale(i))),l.push(m)}}d=y,u=f}return l},t.prototype.destroy=function(){this.ellipse.destroy(),this.isDestroyed=!0},t.ellipseSectorUtils={describeSVGArc:function(t,e,i,s,r,o,a,l){void 0===l&&(l={moveToStart:!0}),void 0===a&&(a=0),r=n.geomutils.wrapMax(r,2*Math.PI),o=n.geomutils.wrapMax(o,2*Math.PI);var u=new c.Vertex(h.VEllipse.utils.polarToCartesian(t,e,i,s,o)),d=new c.Vertex(h.VEllipse.utils.polarToCartesian(t,e,i,s,r));u.rotate(a,{x:t,y:e}),d.rotate(a,{x:t,y:e});var p,f=o-r;p=f<0?Math.abs(f)<Math.PI?1:0:Math.abs(f)>Math.PI?1:0;var y=[];l.moveToStart&&y.push("M",d.x,d.y);var v=180/Math.PI;return y.push("A",i,s,a*v,p,1,u.x,u.y),y},equidistantVertAngles:function(e,i,s,r,n){var o=h.VEllipse.utils.equidistantVertAngles(e,i,n);o=(o=o.map(function(e){return t.ellipseSectorUtils.normalizeAngle(e)})).filter(function(t){return s<r?t>=s&&t<=r:t>=s||t<=r&&t>=0});for(var a=t.ellipseSectorUtils.findClosestToStartAngle(s,r,o),c=[],l=0;l<o.length;l++)c.push(o[(a+l)%o.length]);return c},findClosestToStartAngle:function(t,e,i){if(t>e)for(var s=i.length,r=0;r<s;r++){var o=n.geomutils.wrapMinMax(i[r],0,2*Math.PI);if(o>=t&&o>=e)return r}return 0},normalizeAngle:function(t){return t<0?2*Math.PI+t:t},endpointToCenterParameters:function(e,i,s,r,n,a,l,u,d){var p=Math.abs,f=Math.sin,y=Math.cos,v=Math.sqrt,g=function(t){return t*t},x=f(n),m=y(n),b=m*(e-u)/2+x*(i-d)/2,w=-x*(e-u)/2+m*(i-d)/2,C=g(b),P=g(w),A=g(s),T=g(r),S=C/A+P/T;S>1?(s=v(S)*p(s),r=v(S)*p(r)):(s=p(s),r=p(r));var _=a===l?-1:1,M=v(Math.abs((A*T-A*P-T*C)/(A*P+T*C)))*_,N=M*(s*w)/r,z=M*(-r*b)/s,L=m*N-x*z+(e+u)/2,V=x*N+m*z+(i+d)/2,D=new c.Vertex(L,V),I=D.clone().addXY(s,r),E=new h.VEllipse(D,I,0);return E.rotate(n),new t(E,new o.Line(E.center,new c.Vertex(e,i)).angle()-n,new o.Line(E.center,new c.Vertex(u,d)).angle()-n)}},t}();e.VEllipseSector=l},733:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BezierPath=void 0;var s=i(76),r=i(973),n=i(938),o=i(787),a=function(){function t(){this.className="BezierPath",this.START_POINT=0,this.START_CONTROL_POINT=1,this.END_CONTROL_POINT=2,this.END_POINT=3,this.uid=n.UIDGenerator.next(),this.totalArcLength=0,this.adjustCircular=!1,this.bezierCurves=[]}return t.prototype.addCurve=function(t){if(null==t||void 0===t)throw"Cannot add null curve to bézier path.";this.bezierCurves.push(t),this.bezierCurves.length>1?(t.startPoint=this.bezierCurves[this.bezierCurves.length-2].endPoint,this.adjustSuccessorControlPoint(this.bezierCurves.length-2,!0,!0)):this.totalArcLength+=t.getLength()},t.prototype.locateCurveByStartPoint=function(t){for(var e=0;e<this.bezierCurves.length;e++)if(this.bezierCurves[e].startPoint.equals(t))return e;return-1},t.prototype.locateCurveByEndPoint=function(t){for(var e=0;e<this.bezierCurves.length;e++)if(this.bezierCurves[e].endPoint.equals(t))return e;return-1},t.prototype.locateCurveByStartControlPoint=function(t){for(var e=0;e<this.bezierCurves.length;e++)if(this.bezierCurves[e].startControlPoint.equals(t))return e;return-1},t.prototype.locateCurveByEndControlPoint=function(t){for(var e=0;e<this.bezierCurves.length;e++)if(this.bezierCurves[e].endControlPoint.equals(t))return e;return-1},t.prototype.getLength=function(){return this.totalArcLength},t.prototype.updateArcLengths=function(){this.totalArcLength=0;for(var t=0;t<this.bezierCurves.length;t++)this.bezierCurves[t].updateArcLengths(),this.totalArcLength+=this.bezierCurves[t].getLength()},t.prototype.getCurveCount=function(){return this.bezierCurves.length},t.prototype.getCurveAt=function(t){return this.bezierCurves[t]},t.prototype.translate=function(t){for(var e=0;e<this.bezierCurves.length;e++)(i=this.bezierCurves[e]).getStartPoint().add(t),i.getStartControlPoint().add(t),i.getEndControlPoint().add(t);var i;return(i=this.bezierCurves[this.bezierCurves.length-1]).getEndPoint().add(t),this.updateArcLengths(),this},t.prototype.move=function(t){return this.translate(t)},t.prototype.scale=function(t,e){return this.scaleXY({x:e,y:e},t)},t.prototype.scaleXY=function(t,e){for(var i=0;i<this.bezierCurves.length;i++){var s=this.bezierCurves[i];s.getStartPoint().scaleXY(t,e),s.getStartControlPoint().scaleXY(t,e),s.getEndControlPoint().scaleXY(t,e)}return this.bezierCurves.length>0&&!this.adjustCircular&&this.bezierCurves[this.bezierCurves.length-1].getEndPoint().scaleXY(t,e),this.updateArcLengths(),this},t.prototype.rotate=function(t,e){for(var i=0;i<this.bezierCurves.length;i++){var s=this.bezierCurves[i];s.getStartPoint().rotate(t,e),s.getStartControlPoint().rotate(t,e),s.getEndControlPoint().rotate(t,e)}this.bezierCurves.length>0&&!this.adjustCircular&&this.bezierCurves[this.bezierCurves.length-1].getEndPoint().rotate(t,e)},t.prototype.getClosestT=function(t){for(var e=-1,i=0,s=0,r=0,n=0,o=0,a=0;a<this.bezierCurves.length;a++)r=this.bezierCurves[a].getClosestT(t),s=this.bezierCurves[a].getPointAt(r).distance(t),(-1==e||s<i)&&(e=a,i=s,n=o+r*this.bezierCurves[a].getLength()),o+=this.bezierCurves[a].getLength();return Math.max(0,Math.min(1,n/this.totalArcLength))},t.prototype.getPoint=function(t){(t<0||t>this.totalArcLength)&&(console.warn("[BezierPath.getPoint(u)] u is out of bounds: "+t+"."),t=Math.min(this.totalArcLength,Math.max(t,0)));for(var e=0,i=0;e<this.bezierCurves.length&&i+this.bezierCurves[e].getLength()<t;)i+=this.bezierCurves[e].getLength(),e++;if(e>=this.bezierCurves.length)return this.bezierCurves[this.bezierCurves.length-1].getEndPoint().clone();var s=t-i;return this.bezierCurves[e].getPoint(s)},t.prototype.getPointAt=function(t){return this.getPoint(t*this.totalArcLength)},t.prototype.getTangentAt=function(t){return this.getTangent(t*this.totalArcLength)},t.prototype.getTangent=function(t){(t<0||t>this.totalArcLength)&&(console.warn("[BezierPath.getTangent(u)] u is out of bounds: "+t+"."),t=Math.min(this.totalArcLength,Math.max(0,t)));for(var e=0,i=0;e<this.bezierCurves.length&&i+this.bezierCurves[e].getLength()<t;)i+=this.bezierCurves[e].getLength(),e++;var s=t-i;return this.bezierCurves[e].getTangent(s)},t.prototype.getPerpendicularAt=function(t){return this.getPerpendicular(t*this.totalArcLength)},t.prototype.getPerpendicular=function(e){(e<0||e>this.totalArcLength)&&(console.log("[BezierPath.getPerpendicular(u)] u is out of bounds: "+e+"."),e=Math.min(this.totalArcLength,Math.max(0,e)));var i=t._locateUIndex(this,e),s=this.bezierCurves[i.i],r=e-i.uPart;return s.getPerpendicular(r)},t.prototype.lineIntersections=function(t,e){return void 0===e&&(e=!1),this.bezierCurves.reduce(function(i,s){return i.concat(s.lineIntersections(t,e))},[])},t.prototype.lineIntersectionTangents=function(t,e){return void 0===e&&(e=!1),this.bezierCurves.reduce(function(i,s){return i.concat(s.lineIntersectionTangents(t,e))},[])},t._locateUIndex=function(t,e){for(var i=0,s=0,r=0;i<t.bezierCurves.length&&s+t.bezierCurves[i].getLength()<e;)s+=t.bezierCurves[i].getLength(),i+1<t.bezierCurves.length&&(r+=t.bezierCurves[i].getLength()),i++;return{i,uPart:s,uBefore:r}},t.prototype.getSubPathAt=function(e,i){e=Math.max(0,e),i=Math.min(1,i);var s=e*this.totalArcLength,r=i*this.totalArcLength,n=t._locateUIndex(this,s),o=t._locateUIndex(this,r),a=(s-n.uBefore)/this.bezierCurves[n.i].getLength();if(n.i==o.i){var h=(r-o.uBefore)/this.bezierCurves[o.i].getLength(),c=this.bezierCurves[n.i].getSubCurveAt(a,h);return t.fromArray([c])}var l=[];if(n.i>o.i){c=this.bezierCurves[n.i].getSubCurveAt(a,0),l.push(c);for(var u=n.i-1;u>o.i;u--)l.push(this.bezierCurves[u].clone().reverse());h=(r-o.uBefore)/this.bezierCurves[o.i].getLength(),l.push(this.bezierCurves[o.i].getSubCurveAt(1,h))}else{for(c=this.bezierCurves[n.i].getSubCurveAt(a,1),l.push(c),u=n.i+1;u<o.i&&u<this.bezierCurves.length;u++)l.push(this.bezierCurves[u].clone());h=(r-o.uBefore)/this.bezierCurves[o.i].getLength(),l.push(this.bezierCurves[o.i].getSubCurveAt(0,h))}return t.fromArray(l)},t.prototype.moveCurvePoint=function(t,e,i){this.getCurveAt(t).moveCurvePoint(e,i,!0,!0),e==this.START_POINT&&(t>0||this.adjustCircular)?this.getCurveAt(t-1<0?this.bezierCurves.length+(t-1):t-1).moveCurvePoint(this.END_CONTROL_POINT,i,!0,!1):e==this.END_POINT&&(t+1<this.bezierCurves.length||this.adjustCircular)?this.getCurveAt((t+1)%this.bezierCurves.length).moveCurvePoint(this.START_CONTROL_POINT,i,!0,!1):e==this.START_CONTROL_POINT&&t>0?this.adjustPredecessorControlPoint(t,!0,!1):e==this.END_CONTROL_POINT&&t+1<this.getCurveCount()&&this.adjustSuccessorControlPoint(t,!0,!1),this.updateArcLengths()},t.prototype.adjustPredecessorControlPoint=function(e,i,s){if(this.adjustCircular||!(e<=0)){var r=this.getCurveAt(e),n=this.getCurveAt(e-1<0?this.getCurveCount()+(e-1):e-1);t.adjustNeighbourControlPoint(r,n,r.getStartPoint(),r.getStartControlPoint(),n.getEndPoint(),n.getEndControlPoint(),i,s)}},t.prototype.adjustSuccessorControlPoint=function(e,i,s){if(this.adjustCircular||!(e+1>this.getCurveCount())){var r=this.getCurveAt(e),n=this.getCurveAt((e+1)%this.getCurveCount());t.adjustNeighbourControlPoint(r,n,r.getEndPoint(),r.getEndControlPoint(),n.getStartPoint(),n.getStartControlPoint(),i,s)}},t.adjustNeighbourControlPoint=function(t,e,i,s,r,n,a,h){var c=new o.Vertex(s.x-i.x,s.y-i.y),l=new o.Vertex(n.x-r.x,n.y-r.y),u=Math.sqrt(Math.pow(c.x,2)+Math.pow(c.y,2)),d=Math.sqrt(Math.pow(l.x,2)+Math.pow(l.y,2));u<=.1||(a?n.set(r.x-c.x*(d/u),r.y-c.y*(d/u)):n.set(r.x-c.x,r.y-c.y),e.updateArcLengths())},t.prototype.getBounds=function(){for(var t,e=new o.Vertex(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),i=new o.Vertex(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY),r=0;r<this.bezierCurves.length;r++)t=this.bezierCurves[r].getBounds(),e.x=Math.min(e.x,t.min.x),e.y=Math.min(e.y,t.min.y),i.x=Math.max(i.x,t.max.x),i.y=Math.max(i.y,t.max.y);return new s.Bounds(e,i)},t.prototype.getEvenDistributionVertices=function(t){if(t<2)throw new Error("pointCount must be larger than one; is "+t+".");var e=[];if(0===this.bezierCurves.length)return e;var i=new o.Vertex(this.bezierCurves[0].startPoint);e.push(i);for(var s=this.totalArcLength/(t-1),r=this.bezierCurves.length,n=0,a=this.bezierCurves[0].arcLength,h=s,c=1;c<t&&n<r;)if(h<a){var l=this.bezierCurves[n].getPoint(h);e.push(l),h+=s,c++}else h-=a,a=++n<r?this.bezierCurves[n].arcLength:0;return e.push(new o.Vertex(this.bezierCurves[r-1].endPoint)),e},t.prototype.clone=function(){for(var e=new t,i=0;i<this.bezierCurves.length;i++)e.bezierCurves.push(this.bezierCurves[i].clone()),i>0&&(e.bezierCurves[i-1].endPoint=e.bezierCurves[i].startPoint);return e.updateArcLengths(),e.adjustCircular=this.adjustCircular,e},t.prototype.equals=function(t){if(!t)return!1;if(!t.bezierCurves)return!1;if(void 0===t.bezierCurves.length)return!1;if(t.bezierCurves.length!=this.bezierCurves.length)return!1;for(var e=0;e<this.bezierCurves.length;e++)if(!this.bezierCurves[e].equals(t.bezierCurves[e]))return!1;return!0},t.prototype.destroy=function(){for(var t=0;t<this.bezierCurves.length;t++)this.bezierCurves[t].destroy();this.isDestroyed=!0},t.prototype.toPathPoints=function(){if(0===this.bezierCurves.length)return[];if(1===this.bezierCurves.length)return[this.bezierCurves[0].startPoint,this.bezierCurves[0].startControlPoint,this.bezierCurves[0].endControlPoint,this.bezierCurves[0].endPoint];var t=[];t.push(this.bezierCurves[0].startPoint),t.push(this.bezierCurves[0].startControlPoint);for(var e=1;e<this.bezierCurves.length;e++)t.push(this.bezierCurves[e-1].endControlPoint),t.push(this.bezierCurves[e-1].endPoint),t.push(this.bezierCurves[e].startPoint),t.push(this.bezierCurves[e].startControlPoint);return t.push(this.bezierCurves[0].endControlPoint),t.push(this.bezierCurves[0].endPoint),t},t.prototype.toJSON=function(t){var e=[];e.push("[");for(var i=0;i<this.bezierCurves.length;i++)i>0&&e.push(","),t?e.push("\n\t"):e.push(" "),e.push(this.bezierCurves[i].toJSON(t));return 0!=this.bezierCurves.length&&e.push(" "),e.push("]"),e.join("")},t.fromJSON=function(e){var i=JSON.parse(e);return t.fromArray(i)},t.fromCurve=function(e){var i=new t;return i.addCurve(e),i},t.fromArray=function(e){if(!Array.isArray(e))throw"[BezierPath.fromArray] Passed object must be an array.";var i=e;if(i.length<1)throw"[BezierPath.fromArray] Passed array must contain at least one bezier curve (has "+i.length+").";for(var s=new t,n=null,o=0;o<i.length;o++){var a;if(r.CubicBezierCurve.isInstance(i[o]))a=i[o].clone();else if(0 in i[o]&&1 in i[o]&&2 in i[o]&&3 in i[o]){if(!(i[o][0]&&i[o][1]&&i[o][2]&&i[o][3]))throw"Cannot convert path data to BezierPath instance. At least one element is undefined (index="+o+"): "+i[o];a=r.CubicBezierCurve.fromArray(i[o])}else a=r.CubicBezierCurve.fromObject(i[o]);n&&(a.startPoint=n.endPoint),s.bezierCurves.push(a),n=a}return s.updateArcLengths(),s},t.prototype.toReducedListRepresentation=function(t){void 0===t&&(t=1);var e=[];e.push("[");for(var i=0;i<this.bezierCurves.length;i++){var s=this.bezierCurves[i];e.push(s.getStartPoint().x.toFixed(t)),e.push(","),e.push(s.getStartPoint().y.toFixed(t)),e.push(","),e.push(s.getStartControlPoint().x.toFixed(t)),e.push(","),e.push(s.getStartControlPoint().y.toFixed(t)),e.push(","),e.push(s.getEndControlPoint().x.toFixed(t)),e.push(","),e.push(s.getEndControlPoint().y.toFixed(t)),e.push(",")}return 0!=this.bezierCurves.length&&(s=this.bezierCurves[this.bezierCurves.length-1],e.push(s.getEndPoint().x.toFixed(t)),e.push(","),e.push(s.getEndPoint().y.toFixed(t))),e.push("]"),e.join("")},t.fromReducedListRepresentation=function(e,i){var s=JSON.parse(e);if(!s.length)throw console.log("Cannot parse bezier path from non-array object nor from empty point list."),"Cannot parse bezier path from non-array object nor from empty point list.";if(s.length<8)throw console.log("Cannot build bezier path. The passed array must contain at least 8 elements (numbers)."),"Cannot build bezier path. The passed array must contain at least 8 elements (numbers).";return t.fromReducedList(s,i)},t.fromReducedList=function(e,i){var s,n,a,h=new t,c=new o.Vertex,l=0;do{0==l&&(c=new o.Vertex(e[l],e[l+1])),s=new o.Vertex(e[l+2],e[l+3]),n=new o.Vertex(e[l+4],e[l+5]),a=new o.Vertex(e[l+6],e[l+7]);var u=new r.CubicBezierCurve(c,a,s,n);h.bezierCurves.push(u),c=a,l+=6}while(l+2<e.length);return h.adjustCircular=null!=i&&i,i&&(h.bezierCurves[h.bezierCurves.length-1].endPoint=h.bezierCurves[0].startPoint),h.updateArcLengths(),h},t.START_POINT=0,t.START_CONTROL_POINT=1,t.END_CONTROL_POINT=2,t.END_POINT=3,t}();e.BezierPath=a},737:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Triangle=void 0;var s=i(76),r=i(118),n=i(939),o=i(687),a=i(938),h=i(30),c=i(787),l=i(328),u=function(){function t(t,e,i){this.className="Triangle",this.uid=a.UIDGenerator.next(),this.a=t,this.b=e,this.c=i,this.calcCircumcircle()}return t.fromArray=function(e){if(e.length<3)throw"Cannot create triangle from array with less than three vertices (".concat(e.length,")");return new t(e[0],e[1],e[2])},t.prototype.getArea=function(){return Math.abs(t.utils.signedArea(this.a.x,this.a.y,this.b.x,this.b.y,this.c.x,this.c.y))},t.prototype.getCentroid=function(){return new c.Vertex((this.a.x+this.b.x+this.c.x)/3,(this.a.y+this.b.y+this.c.y)/3)},t.prototype.scaleToCentroid=function(t){var e=this.getCentroid();return this.a.scale(t,e),this.b.scale(t,e),this.c.scale(t,e),this},t.prototype.getBounds=function(){return this.bounds()},t.prototype.move=function(t){return this.a.add(t),this.b.add(t),this.c.add(t),this},t.prototype.getCircumcircle=function(){return this.calcCircumcircle(),new r.Circle(this.center.clone(),this.radius)},t.prototype.isAdjacent=function(t){var e=this.a.equals(t.a)||this.a.equals(t.b)||this.a.equals(t.c),i=this.b.equals(t.a)||this.b.equals(t.b)||this.b.equals(t.c),s=this.c.equals(t.a)||this.c.equals(t.b)||this.c.equals(t.c);return e&&i||e&&s||i&&s},t.prototype.getThirdVertex=function(t,e){return this.a.equals(t)&&this.b.equals(e)||this.a.equals(e)&&this.b.equals(t)?this.c:this.b.equals(t)&&this.c.equals(e)||this.b.equals(e)&&this.c.equals(t)?this.a:this.b},t.prototype.calcCircumcircle=function(){var e,i,s=this.b.x-this.a.x,r=this.b.y-this.a.y,n=this.c.x-this.a.x,o=this.c.y-this.a.y,a=s*(this.a.x+this.b.x)+r*(this.a.y+this.b.y),h=n*(this.a.x+this.c.x)+o*(this.a.y+this.c.y),l=2*(s*(this.c.y-this.b.y)-r*(this.c.x-this.b.x));if(Math.abs(l)<t.EPSILON){var u=this.bounds();this.center=new c.Vertex((u.min.x+u.max.x)/2,(u.min.y+u.max.y)/2),e=this.center.x-u.min.x,i=this.center.y-u.min.y}else{var d=(o*a-r*h)/l,p=(s*h-n*a)/l;this.center=new c.Vertex(d,p),e=this.center.x-this.a.x,i=this.center.y-this.a.y}this.radius_squared=e*e+i*i,this.radius=Math.sqrt(this.radius_squared)},t.prototype.inCircumcircle=function(t){var e=this.center.x-t.x,i=this.center.y-t.y;return e*e+i*i<=this.radius_squared},t.prototype.bounds=function(){return new s.Bounds(new c.Vertex(t.utils.min3(this.a.x,this.b.x,this.c.x),t.utils.min3(this.a.y,this.b.y,this.c.y)),new c.Vertex(t.utils.max3(this.a.x,this.b.x,this.c.x),t.utils.max3(this.a.y,this.b.y,this.c.y)))},t.prototype.lineIntersections=function(t,e){return void 0===e&&(e=!1),o.Polygon.utils.locateLineIntersecion(t,[this.a,this.b,this.c],!1,e).map(function(t){return t.intersection})},t.prototype.lineIntersectionTangents=function(t,e){var i=this;return void 0===e&&(e=!1),o.Polygon.utils.locateLineIntersecion(t,[this.a,this.b,this.c],!1,e).map(function(t){var e=i.getEdgeAt(t.edgeIndex);return new h.Vector(e.a.clone(),e.b.clone()).moveTo(t.intersection)})},t.prototype.getEdgeAt=function(t){var e=t%3;return 0===e?new n.Line(this.a,this.b):1===e?new n.Line(this.b,this.c):new n.Line(this.c,this.a)},t.prototype.toPolygon=function(){return new o.Polygon([this.a,this.b,this.c])},t.prototype.determinant=function(){return t.utils.determinant(this.a,this.b,this.c)},t.prototype.containsPoint=function(e){return t.utils.pointIsInTriangle(e.x,e.y,this.a.x,this.a.y,this.b.x,this.b.y,this.c.x,this.c.y)},t.prototype.getIncircularTriangle=function(){var e=new n.Line(this.a,this.b),i=new n.Line(this.b,this.c),s=new n.Line(this.c,this.a),r=l.geomutils.nsectAngle(this.b,this.a,this.c,2)[0],o=l.geomutils.nsectAngle(this.c,this.b,this.a,2)[0],a=r.intersection(o);return new t(e.getClosestPoint(a),i.getClosestPoint(a),s.getClosestPoint(a))},t.prototype.getIncircle=function(){return this.getIncircularTriangle().getCircumcircle()},t.prototype.getIncenter=function(){return this.center&&this.radius||this.calcCircumcircle(),this.center.clone()},t.prototype.toString=function(){return"{ a : "+this.a.toString()+", b : "+this.b.toString()+", c : "+this.c.toString()+"}"},t.prototype.destroy=function(){this.a.destroy(),this.b.destroy(),this.c.destroy(),this.isDestroyed=!0},t.EPSILON=1e-6,t.utils={max3:function(t,e,i){return t>=e&&t>=i?t:e>=t&&e>=i?e:i},min3:function(t,e,i){return t<=e&&t<=i?t:e<=t&&e<=i?e:i},signedArea:function(t,e,i,s,r,n){return.5*(-s*r+e*(-i+r)+t*(s-n)+i*n)},pointIsInTriangle:function(e,i,s,r,n,o,a,h){var c=t.utils.signedArea(s,r,n,o,a,h),l=1/(2*c)*(r*a-s*h+(h-r)*e+(s-a)*i),u=1/(2*c)*(s*o-r*n+(r-o)*e+(n-s)*i);return l>0&&u>0&&1-l-u>0},determinant:function(t,e,i){return(e.y-t.y)*(i.x-e.x)-(i.y-e.y)*(e.x-t.x)}},t}();e.Triangle=u},787:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Vertex=void 0;var s=i(476),r=i(938),n=i(934),o=i(328),a=i(76),h=function(){function t(t,e){if(this.className="Vertex",this.uid=r.UIDGenerator.next(),void 0===t)this.x=0,this.y=0;else if("number"==typeof t&&"number"==typeof e)this.x=t,this.y=e;else{var i=t;"number"==typeof i.x&&"number"==typeof i.y?(this.x=i.x,this.y=i.y):(this.x="number"==typeof t?t:void 0===t?0:NaN,this.y="number"==typeof e?e:void 0===e?0:NaN)}this.attr=new s.VertexAttr,this.listeners=new n.VertexListeners(this)}return t.prototype.set=function(t,e){if("number"==typeof t&&"number"==typeof e)this.x=t,this.y=e;else{var i=t;"number"==typeof i.x&&"number"==typeof i.y?(this.x=i.x,this.y=i.y):(this.x="number"==typeof t?t:void 0===t?0:NaN,this.y="number"==typeof e?e:void 0===e?0:NaN)}return this},t.prototype.setX=function(t){return this.x=t,this},t.prototype.setY=function(t){return this.y=t,this},t.prototype.invX=function(){return this.x=-this.x,this},t.prototype.invY=function(){return this.y=-this.y,this},t.prototype.add=function(t,e){if("number"==typeof t&&"number"==typeof e)this.x+=t,this.y+=e;else{var i=t;if("number"==typeof i.x&&"number"==typeof i.y)this.x+=i.x,this.y+=i.y;else{if("number"!=typeof t)throw"Cannot add ".concat(typeof t," to numeric x component!");if(this.x+=t,"number"!=typeof e)throw"Cannot add ".concat(typeof e," to numeric y component!");this.y+=e}}return this},t.prototype.move=function(t){return this.add(t)},t.prototype.addXY=function(t,e){return this.x+=t,this.y+=e,this},t.prototype.addX=function(t){return this.x+=t,this},t.prototype.addY=function(t){return this.y+=t,this},t.prototype.sub=function(t,e){if("number"==typeof t&&"number"==typeof e)this.x-=t,this.y-=e;else{var i=t;if("number"==typeof i.x&&"number"==typeof i.y)this.x-=i.x,this.y-=i.y;else{if("number"!=typeof t)throw"Cannot add ".concat(typeof t," to numeric x component!");if(this.x-=t,"number"!=typeof e)throw"Cannot add ".concat(typeof e," to numeric y component!");this.y-=e}}return this},t.prototype.subXY=function(t,e){return this.x-=t,this.y-=e,this},t.prototype.subX=function(t){return this.x-=t,this},t.prototype.subY=function(t){return this.y-=t,this},t.prototype.equals=function(e){var i=Math.abs(this.x-e.x)<t.EPSILON,s=Math.abs(this.y-e.y)<t.EPSILON;return i&&s},t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.distance=function(t){return o.geomutils.dist4(this.x,this.y,t.x,t.y)},t.prototype.angle=function(t){var e=void 0===t?Math.PI/2-Math.atan2(this.x,this.y):Math.PI/2-Math.atan2(t.x-this.x,t.y-this.y);return e<0?2*Math.PI+e:e},t.prototype.difference=function(e){return new t(e.x-this.x,e.y-this.y)},t.prototype.scale=function(t,e){return this.scaleXY({x:t,y:t},e)},t.prototype.lerp=function(t,e){var i=this.difference(t);return this.x+=i.x*e,this.y+=i.y*e,this},t.prototype.lerpAbs=function(t,e){var i=this.distance(t),s=this.difference(t),r=s.x/i,n=s.y/i;return this.x+=r*e,this.y+=n*e,this},t.prototype.scaleXY=function(t,e){return e&&void 0!==e||(e={x:0,y:0}),this.x=e.x+(this.x-e.x)*t.x,this.y=e.y+(this.y-e.y)*t.y,this},t.prototype.rotate=function(e,i){i&&void 0!==i||(i={x:0,y:0}),this.sub(i),e+=Math.atan2(this.y,this.x);var s=this.distance(t.ZERO);return this.x=s*Math.cos(e),this.y=s*Math.sin(e),this.add(i),this},t.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this},t.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},t.prototype.inv=function(){return this.x=-this.x,this.y=-this.y,this},t.prototype.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},t.prototype.getBounds=function(){return a.Bounds.computeFromVertices([this])},t.prototype.toString=function(t){return void 0===t?"("+this.x+","+this.y+")":"("+this.x.toFixed(t)+","+this.y.toFixed(t)+")"},t.prototype.destroy=function(){this.listeners.removeAllListeners(),this.isDestroyed=!0},t.randomVertex=function(e){return new t(e.min.x+Math.random()*(e.max.x-e.min.x),e.min.y+Math.random()*(e.max.y-e.min.y))},t.ZERO=new t(0,0),t.EPSILON=1e-6,t.utils={buildArrowHead:function(e,i,s,r,n){console.warn("[DEPRECATION] Vertex.utils.buildArrowHead is deprecated. Please use Vector.utils.buildArrowHead instead.");var o=Math.atan2((i.y-e.y)*n,(i.x-e.x)*r),a=[];return a.push(new t(i.x*r-s*Math.cos(o),i.y*n-s*Math.sin(o))),a.push(new t(i.x*r-1.35*s*Math.cos(o-Math.PI/8),i.y*n-1.35*s*Math.sin(o-Math.PI/8))),a.push(new t(i.x*r,i.y*n)),a.push(new t(i.x*r-1.35*s*Math.cos(o+Math.PI/8),i.y*n-1.35*s*Math.sin(o+Math.PI/8))),a},arrayToJSON:function(t,e){return JSON.stringify(t.map(function(t){return void 0===typeof e?{x:t.x,y:t.y}:{x:Number(t.x.toFixed(e)),y:Number(t.y.toFixed(e))}}))}},t}();e.Vertex=h},862:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PBImage=void 0;var s=i(938),r=function(){function t(t,e,i){this.className="PBImage",this.uid=s.UIDGenerator.next(),this.image=t,this.upperLeft=e,this.lowerRight=i}return t.prototype.destroy=function(){this.upperLeft.destroy(),this.lowerRight.destroy(),this.isDestroyed=!0},t}();e.PBImage=r},881:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VEllipse=void 0;var s=i(939),r=i(30),n=i(787),o=i(938),a=i(973),h=i(118),c=i(76),l=function(){function t(t,e,i){this.className="VEllipse",this.uid=o.UIDGenerator.next(),this.center=t,this.axis=e,this.rotation=i||0}return t.prototype.clone=function(){return new t(this.center.clone(),this.axis.clone(),this.rotation)},t.prototype.radiusH=function(){return Math.abs(this.signedRadiusH())},t.prototype.signedRadiusH=function(){return new n.Vertex(this.axis).rotate(-this.rotation,this.center).x-this.center.x},t.prototype.radiusV=function(){return Math.abs(this.signedRadiusV())},t.prototype.signedRadiusV=function(){return new n.Vertex(this.axis).rotate(-this.rotation,this.center).y-this.center.y},t.prototype.getExtremePoints=function(){var t,e,i=this.radiusH(),s=this.radiusV(),r=Math.atan2(-s*Math.sin(this.rotation),i*Math.cos(this.rotation)),o=r+Math.PI,a=this.center.x+i*Math.cos(r)*Math.cos(this.rotation)-s*Math.sin(r)*Math.sin(this.rotation),h=this.center.y+i*Math.cos(r)*Math.sin(this.rotation)+s*Math.sin(r)*Math.cos(this.rotation),c=this.center.x+i*Math.cos(o)*Math.cos(this.rotation)-s*Math.sin(o)*Math.sin(this.rotation),l=this.center.y+i*Math.cos(o)*Math.sin(this.rotation)+s*Math.sin(o)*Math.cos(this.rotation);a>c?(t=new n.Vertex(a,h),e=new n.Vertex(c,l)):(t=new n.Vertex(c,l),e=new n.Vertex(a,h));var u,d,p=Math.atan2(s*Math.cos(this.rotation),i*Math.sin(this.rotation)),f=p+Math.PI,y=this.center.x+i*Math.cos(p)*Math.cos(this.rotation)-s*Math.sin(p)*Math.sin(this.rotation),v=this.center.y+i*Math.cos(p)*Math.sin(this.rotation)+s*Math.sin(p)*Math.cos(this.rotation),g=this.center.x+i*Math.cos(f)*Math.cos(this.rotation)-s*Math.sin(f)*Math.sin(this.rotation),x=this.center.y+i*Math.cos(f)*Math.sin(this.rotation)+s*Math.sin(f)*Math.cos(this.rotation);return v>x?(u=new n.Vertex(y,v),d=new n.Vertex(g,x)):(u=new n.Vertex(g,x),d=new n.Vertex(y,v)),[t,e,u,d]},t.prototype.getBounds=function(){var t=this.radiusH(),e=this.radiusV(),i=t*Math.cos(this.rotation),s=t*Math.sin(this.rotation),r=e*Math.cos(this.rotation+Math.PI/2),n=e*Math.sin(this.rotation+Math.PI/2),o=Math.sqrt(i*i+r*r),a=Math.sqrt(s*s+n*n);return new c.Bounds({x:this.center.x-o,y:this.center.y-a},{x:this.center.x+o,y:this.center.y+a})},t.prototype.move=function(t){return this.center.add(t),this.axis.add(t),this},t.prototype.scale=function(t){return this.axis.scale(t,this.center),this},t.prototype.rotate=function(t){return this.axis.rotate(t,this.center),this.rotation+=t,this},t.prototype.vertAt=function(e){var i=this.radiusH(),s=this.radiusV();return new n.Vertex(t.utils.polarToCartesian(this.center.x,this.center.y,i,s,e)).rotate(this.rotation,this.center)},t.prototype.normalAt=function(t,e){var i=this.vertAt(t-this.rotation),n=this.getFoci(),o=new s.Line(i,n[0]).angle(),a=o+(new s.Line(i,n[1]).angle()-o)/2,h=i.clone().addX(50).clone().rotate(a,i),c=i.clone().addX(50).clone().rotate(Math.PI+a,i),l=this.center.distance(h)<this.center.distance(c)?new r.Vector(i,c):new r.Vector(i,h);return"number"==typeof e&&l.setLength(e),l},t.prototype.tangentAt=function(t,e){return this.normalAt(t,e).inv().perp()},t.prototype.perimeter=function(){var t=this.radiusH(),e=this.radiusV();return Math.PI*(3*(t+e)-Math.sqrt((3*t+e)*(t+3*e)))},t.prototype.getFoci=function(){var t=this.radiusH(),e=this.radiusV(),i=t*t-e*e,s=Math.sqrt(Math.abs(i));return i<0?[this.center.clone().addY(s).rotate(this.rotation,this.center),this.center.clone().addY(-s).rotate(this.rotation,this.center)]:[this.center.clone().addX(s).rotate(this.rotation,this.center),this.center.clone().addX(-s).rotate(this.rotation,this.center)]},t.prototype.getEquidistantVertices=function(e){for(var i=t.utils.equidistantVertAngles(this.radiusH(),this.radiusV(),e),s=[],r=0;r<i.length;r++)s.push(this.vertAt(i[r]));return s},t.prototype.lineIntersections=function(t,e){void 0===e&&(e=!1);var i=this.clone(),s=t.clone(),r=i.center.clone().inv();i.move(r),s.add(r);var o=-i.rotation;i.rotate(o),s.a.rotate(o,i.center),s.b.rotate(o,i.center);var a=i.radiusH(),c=i.radiusV(),l=a>c?{x:c/a,y:1}:{x:1,y:a/c};i.axis.scaleXY(l),s.a.scaleXY(l),s.b.scaleXY(l);var u=new h.Circle(new n.Vertex,i.radiusH()).lineIntersections(s,e);return u.forEach(function(t){t.scaleXY({x:1/l.x,y:1/l.y},i.center),t.rotate(-o,i.center),t.sub(r)}),u},t.prototype.lineIntersectionTangents=function(t,e){var i=this;return void 0===e&&(e=!1),this.lineIntersections(t,e).map(function(t){var e=new s.Line(i.center,t).angle();return i.tangentAt(e)})},t.prototype.toCubicBezier=function(e,i){var s=4*Math.max(1,e||3);i=void 0===i?.666666:i;for(var r=this.radiusH(),n=this.radiusV(),o=[],h=t.utils.equidistantVertAngles(r,n,s),c=h[0]+this.rotation,l=this.vertAt(c),u=0;u<h.length;u++){var d=h[(u+1)%h.length]+this.rotation,p=this.vertAt(d);if(Math.abs(n)<1e-4||Math.abs(r)<1e-4){var f=l.difference(p),y=new a.CubicBezierCurve(l.clone(),p.clone(),l.clone().addXY(.333*f.x,.333*f.y),p.clone().addXY(.333*-f.x,.333*-f.y));o.push(y)}else{var v=this.tangentAt(c+this.rotation),g=this.tangentAt(d+this.rotation),x=v.intersection(g),m=l.difference(x),b=p.difference(x);y=new a.CubicBezierCurve(l.clone(),p.clone(),l.clone().add(m.scale(i)),p.clone().add(b.scale(i))),o.push(y)}l=p,c=d}return o},t.prototype.destroy=function(){this.center.destroy(),this.axis.destroy(),this.isDestroyed=!0},t.utils={polarToCartesian:function(t,e,i,s,r){var n=Math.sin(Math.PI/2-r),o=Math.cos(Math.PI/2-r);return{x:t+i*s*n/Math.sqrt(Math.pow(i*o,2)+Math.pow(s*n,2)),y:e+i*s*o/Math.sqrt(Math.pow(i*o,2)+Math.pow(s*n,2))}},phiToTheta:function(t,e,i){var s=Math.tan(i),r=s*s;return-Math.PI/2+i+Math.atan((t-e)*s/(e+t*r))},equidistantVertAngles:function(e,i,s){for(var r=[],n=0;n<s;n++){var o=Math.PI/2+2*Math.PI/s*n,a=t.utils.phiToTheta(e,i,o);r[n]=a}return r}},t}();e.VEllipse=l},912:function(t,e){var i,s=this&&this.__extends||(i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},i(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function s(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(s.prototype=e.prototype,new s)});Object.defineProperty(e,"__esModule",{value:!0}),e.MouseHandler=e.XWheelEvent=e.XMouseEvent=void 0;var r=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e}(MouseEvent);e.XMouseEvent=r;var n=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e}(WheelEvent);e.XWheelEvent=n;var o=function(){function t(t,e){this.mouseDownPos=void 0,this.mouseDragPos=void 0,this.mouseButton=-1,this.listeners={},this.installed={},this.handlers={},this.name=e,this.element=t,this.mouseDownPos=void 0,this.mouseDragPos=void 0,this.mouseButton=-1,this.listeners={},this.installed={},this.handlers={};var i=this;this.handlers.mousemove=function(t){i.listeners.mousemove&&i.listeners.mousemove(i.mkParams(t,"mousemove")),i.mouseDragPos&&i.listeners.drag&&i.listeners.drag(i.mkParams(t,"drag")),i.mouseDownPos&&(i.mouseDragPos=i.relPos(t))},this.handlers.mouseup=function(t){i.listeners.mouseup&&i.listeners.mouseup(i.mkParams(t,"mouseup")),i.mouseDragPos=void 0,i.mouseDownPos=void 0,i.mouseButton=-1},this.handlers.mousedown=function(t){i.mouseDragPos=i.relPos(t),i.mouseDownPos=i.relPos(t),i.mouseButton=t.button,i.listeners.mousedown&&i.listeners.mousedown(i.mkParams(t,"mousedown"))},this.handlers.click=function(t){i.listeners.click&&i.listeners.click(i.mkParams(t,"click"))},this.handlers.wheel=function(t){i.listeners.wheel&&i.listeners.wheel(i.mkParams(t,"wheel"))},this.element.addEventListener("mousemove",this.handlers.mousemove),this.element.addEventListener("mouseup",this.handlers.mouseup),this.element.addEventListener("mousedown",this.handlers.mousedown),this.element.addEventListener("click",this.handlers.click),this.element.addEventListener("wheel",this.handlers.wheel)}return t.prototype.relPos=function(t){return{x:t.offsetX,y:t.offsetY}},t.prototype.mkParams=function(t,e){var i,s,r=this.relPos(t),n=t;return n.params={element:this.element,name:e,isTouchEvent:!1,pos:r,button:t.button,leftButton:0===t.button,middleButton:1===t.button,rightButton:2===t.button,mouseDownPos:null!==(i=this.mouseDownPos)&&void 0!==i?i:{x:NaN,y:NaN},draggedFrom:null!==(s=this.mouseDragPos)&&void 0!==s?s:{x:NaN,y:NaN},wasDragged:null!=this.mouseDownPos&&(this.mouseDownPos.x!=r.x||this.mouseDownPos.y!=r.y),dragAmount:null!=this.mouseDragPos?{x:r.x-this.mouseDragPos.x,y:r.y-this.mouseDragPos.y}:{x:0,y:0}},n},t.prototype.listenFor=function(t){this.installed[t]||(this.installed[t]=!0)},t.prototype.unlistenFor=function(t){this.installed[t]&&delete this.installed[t]},t.prototype.drag=function(t){return this.listeners.drag&&this.throwAlreadyInstalled("drag"),this.listeners.drag=t,this.listenFor("mousedown"),this.listenFor("mousemove"),this.listenFor("mouseup"),this},t.prototype.move=function(t){return this.listeners.mousemove&&this.throwAlreadyInstalled("mousemove"),this.listenFor("mousemove"),this.listeners.mousemove=t,this},t.prototype.up=function(t){return this.listeners.mouseup&&this.throwAlreadyInstalled("mouseup"),this.listenFor("mouseup"),this.listeners.mouseup=t,this},t.prototype.down=function(t){return this.listeners.mousedown&&this.throwAlreadyInstalled("mousedown"),this.listenFor("mousedown"),this.listeners.mousedown=t,this},t.prototype.click=function(t){return this.listeners.click&&this.throwAlreadyInstalled("click"),this.listenFor("click"),this.listeners.click=t,this},t.prototype.wheel=function(t){return this.listeners.wheel&&this.throwAlreadyInstalled("wheel"),this.listenFor("wheel"),this.listeners.wheel=t,this},t.prototype.throwAlreadyInstalled=function(t){throw"This MouseHandler already has a '".concat(t,"' callback. To keep the code simple there is only room for one.")},t.prototype.destroy=function(){this.unlistenFor("mousedown"),this.unlistenFor("mousemove"),this.unlistenFor("moseup"),this.unlistenFor("click"),this.unlistenFor("wheel"),this.element.removeEventListener("mousemove",this.handlers.mousemove),this.element.removeEventListener("mouseup",this.handlers.mousedown),this.element.removeEventListener("mousedown",this.handlers.mousedown),this.element.removeEventListener("click",this.handlers.click),this.element.removeEventListener("wheel",this.handlers.wheel)},t}();e.MouseHandler=o},934:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VertexListeners=void 0;var i=function(){function t(t){this.click=[],this.drag=[],this.dragStart=[],this.dragEnd=[],this.vertex=t}return t.prototype.addClickListener=function(e){return t._addListener(this.click,e),this},t.prototype.removeClickListener=function(e){return this.click=t._removeListener(this.click,e),this},t.prototype.addDragListener=function(e){return t._addListener(this.drag,e),this},t.prototype.removeDragListener=function(e){return this.drag=t._removeListener(this.drag,e),this},t.prototype.addDragStartListener=function(e){return t._addListener(this.dragStart,e),this},t.prototype.removeDragStartListener=function(e){return this.dragStart=t._removeListener(this.dragStart,e),this},t.prototype.addDragEndListener=function(e){return t._addListener(this.dragEnd,e),this},t.prototype.removeDragEndListener=function(e){return this.dragEnd=t._removeListener(this.dragEnd,e),this},t.prototype.fireClickEvent=function(e){t._fireEvent(this,this.click,e)},t.prototype.fireDragEvent=function(e){t._fireEvent(this,this.drag,e)},t.prototype.fireDragStartEvent=function(e){t._fireEvent(this,this.dragStart,e)},t.prototype.fireDragEndEvent=function(e){t._fireEvent(this,this.dragEnd,e)},t.prototype.removeAllListeners=function(){this.click=[],this.drag=[],this.dragStart=[],this.dragEnd=[]},t._fireEvent=function(t,e,i){var s=i;for(var r in void 0===s.params?s.params={vertex:t.vertex}:s.params.vertex=t.vertex,e)e[r](s)},t._addListener=function(t,e){if(!e)throw new Error("Cannot add null listener. This would lead to unpredictable errors during event handling.");for(var i in t)if(t[i]==e)return!1;return t.push(e),!0},t._removeListener=function(t,e){for(var i=0;i<t.length;i++)if(t[i]==e)return t.splice(i,1);return t},t}();e.VertexListeners=i},938:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.UIDGenerator=void 0;var i=function(){function t(){}return t.next=function(){return"".concat(t.current++)},t.current=0,t}();e.UIDGenerator=i},939:function(t,e,i){var s,r=this&&this.__extends||(s=function(t,e){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},s(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}s(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0}),e.Line=void 0;var n=i(76),o=i(30),a=i(590),h=i(787),c=function(t){function e(i,s){var r=t.call(this,i,s,function(t,i){return new e(t,i)})||this;return r.className="Line",r}return r(e,t),e.prototype.intersection=function(t){var e=this.denominator(t);if(0==e)return null;var i=this.a.y-t.a.y,s=this.a.x-t.a.x,r=(t.b.x-t.a.x)*i-(t.b.y-t.a.y)*s,n=(this.b.x-this.a.x)*i-(this.b.y-this.a.y)*s;i=r/e,s=n/e;var o=this.a.x+i*(this.b.x-this.a.x),a=this.a.y+i*(this.b.y-this.a.y);return isNaN(i)||isNaN(o)||isNaN(a)?null:new h.Vertex(o,a)},e.prototype.getBounds=function(){return n.Bounds.computeFromVertices([this.a,this.b])},e.prototype.getStartPoint=function(){return this.a},e.prototype.getEndPoint=function(){return this.b},e.prototype.getStartTangent=function(){return this.b},e.prototype.getEndTangent=function(){return this.a},e.prototype.reverse=function(){var t=this.a;return this.a=this.b,this.b=t,this},e.prototype.lineIntersections=function(t,e){void 0===e&&(e=!1);var i=this.intersection(t);return i?!this.hasPoint(i,!0)||e&&!t.hasPoint(i,e)?[]:[i]:[]},e.prototype.lineIntersectionTangents=function(t,e){void 0===e&&(e=!1);var i=this.lineIntersections(t,e);if(0===i.length)return[];var s=i[0];return[new o.Vector(this.a.clone(),this.b.clone()).moveTo(s)]},e}(a.VertTuple);e.Line=c},973:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CubicBezierCurve=void 0;var s=i(76),r=i(938),n=i(787),o=i(30),a=function(){function t(e,i,s,n){this.START_POINT=t.START_POINT,this.START_CONTROL_POINT=t.START_CONTROL_POINT,this.END_CONTROL_POINT=t.END_CONTROL_POINT,this.END_POINT=t.END_POINT,this.uid=r.UIDGenerator.next(),this.startPoint=e,this.startControlPoint=s,this.endPoint=i,this.endControlPoint=n,this.curveIntervals=30,this.segmentCache=[],this.segmentLengths=[],this.updateArcLengths()}return t.prototype.moveCurvePoint=function(t,e,i,s){t==this.START_POINT?(this.getStartPoint().add(e),i&&this.getStartControlPoint().add(e)):t==this.START_CONTROL_POINT?this.getStartControlPoint().add(e):t==this.END_CONTROL_POINT?this.getEndControlPoint().add(e):t==this.END_POINT?(this.getEndPoint().add(e),i&&this.getEndControlPoint().add(e)):console.log("[CubicBezierCurve.moveCurvePoint] pointID '".concat(t,"' invalid.")),s&&this.updateArcLengths()},t.prototype.translate=function(t){return this.startPoint.add(t),this.startControlPoint.add(t),this.endControlPoint.add(t),this.endPoint.add(t),this},t.prototype.move=function(t){return this.translate(t)},t.prototype.reverse=function(){var t=this.startPoint;return this.startPoint=this.endPoint,this.endPoint=t,t=this.startControlPoint,this.startControlPoint=this.endControlPoint,this.endControlPoint=t,this},t.prototype.getLength=function(){return this.arcLength},t.prototype.updateArcLengths=function(){var t=this.startPoint.clone(),e=new n.Vertex(0,0),i=1/this.curveIntervals;this.segmentCache=[],this.segmentCache.push(this.startPoint),this.segmentLengths=[];for(var s,r=0,o=0;o<=1;)e=this.getPointAt(o),this.segmentCache.push(e),s=t.distance(e),this.segmentLengths.push(s),r+=s,t=e,o+=i;this.arcLength=r},t.prototype.getClosestT=function(t){var e={t:0,tPrev:0,tNext:1},i=0;do{e=this.locateIntervalByDistance(t,e.tPrev,e.tNext,this.curveIntervals),i++}while(i<4&&this.getPointAt(e.tPrev).distance(this.getPointAt(e.tNext))>1);return e.t},t.prototype.locateIntervalByDistance=function(t,e,i,s){for(var r=-1,n=0,o=0,a=i-e,h=0;h<=s;h++){o=e+a*(h/s);var c=this.getPointAt(o).distance(t);(-1==r||c<n)&&(r=h,n=c)}return{t:e+a*(r/s),tPrev:e+a*(Math.max(0,r-1)/s),tNext:e+a*(Math.min(s,r+1)/s)}},t.prototype.getBounds=function(){var e=t.utils.cubicPolyMinMax(this.startPoint.x,this.startControlPoint.x,this.endControlPoint.x,this.endPoint.x),i=e.min,r=e.max,n=t.utils.cubicPolyMinMax(this.startPoint.y,this.startControlPoint.y,this.endControlPoint.y,this.endPoint.y),o=n.min,a=n.max;return s.Bounds.computeFromVertices([{x:i,y:o},{x:i,y:a},{x:r,y:a},{x:r,y:o}])},t.prototype.getStartPoint=function(){return this.startPoint},t.prototype.getEndPoint=function(){return this.endPoint},t.prototype.getStartControlPoint=function(){return this.startControlPoint},t.prototype.getEndControlPoint=function(){return this.endControlPoint},t.prototype.getPointByID=function(t){if(t==this.START_POINT)return this.startPoint;if(t==this.END_POINT)return this.endPoint;if(t==this.START_CONTROL_POINT)return this.startControlPoint;if(t==this.END_CONTROL_POINT)return this.endControlPoint;throw new Error("Invalid point ID '".concat(t,"'."))},t.prototype.getPointAt=function(e){var i=t.utils.evaluateT(this.startPoint.x,this.startControlPoint.x,this.endControlPoint.x,this.endPoint.x,e),s=t.utils.evaluateT(this.startPoint.y,this.startControlPoint.y,this.endControlPoint.y,this.endPoint.y,e);return new n.Vertex(i,s)},t.prototype.getPoint=function(t){return this.getPointAt(t/this.arcLength)},t.prototype.getTangentAt=function(t){var e=this.getStartPoint(),i=this.getStartControlPoint(),s=this.getEndControlPoint(),r=this.getEndPoint(),o=t*t,a=1-2*t+o,h=-3*e.x*a+i.x*(3*a-6*(t-o))+s.x*(6*(t-o)-3*o)+3*r.x*o,c=-3*e.y*a+i.y*(3*a-6*(t-o))+s.y*(6*(t-o)-3*o)+3*r.y*o;return new n.Vertex(h,c)},t.prototype.trimStart=function(t){return this.trimStartAt(this.convertU2T(t))},t.prototype.trimStartAt=function(e){var i=t.utils.getSubCurvePointsAt(this,e,1);return this.startPoint.set(i[0]),this.startControlPoint.set(i[2]),this.endPoint.set(i[1]),this.endControlPoint.set(i[3]),this.updateArcLengths(),this},t.prototype.trimEnd=function(t){return this.trimEndAt(this.convertU2T(t))},t.prototype.trimEndAt=function(e){var i=t.utils.getSubCurvePointsAt(this,0,e);return this.startPoint.set(i[0]),this.startControlPoint.set(i[2]),this.endPoint.set(i[1]),this.endControlPoint.set(i[3]),this.updateArcLengths(),this},t.prototype.getSubCurve=function(t,e){return this.getSubCurveAt(this.convertU2T(t),this.convertU2T(e))},t.prototype.getSubCurveAt=function(e,i){var s=t.utils.getSubCurvePointsAt(this,e,i);return new t(s[0],s[1],s[2],s[3])},t.prototype.convertU2T=function(t){return Math.max(0,Math.min(1,t/this.arcLength))},t.prototype.getTangent=function(t){return this.getTangentAt(this.convertU2T(t))},t.prototype.getPerpendicular=function(t){return this.getPerpendicularAt(this.convertU2T(t))},t.prototype.getPerpendicularAt=function(t){var e=this.getTangentAt(t);return new n.Vertex(e.y,-e.x)},t.prototype.clone=function(){return new t(this.getStartPoint().clone(),this.getEndPoint().clone(),this.getStartControlPoint().clone(),this.getEndControlPoint().clone())},t.prototype.getStartTangent=function(){return this.startControlPoint},t.prototype.getEndTangent=function(){return this.endControlPoint},t.prototype.lineIntersections=function(t,e){var i=this;void 0===e&&(e=!1);var s=this.lineIntersectionTs(t).map(function(t){return i.getPointAt(t)});return e?s.filter(function(e){return t.hasPoint(e,!0)}):s},t.prototype.lineIntersectionTangents=function(t,e){var i=this;void 0===e&&(e=!1);var s=this.lineIntersectionTs(t).map(function(t){var e=i.getPointAt(t),s=i.getTangentAt(t);return new o.Vector(e,s.add(e))});return e?s.filter(function(e){return t.hasPoint(e.a,!0)}):s},t.prototype.lineIntersectionTs=function(e){var i=e.b.y-e.a.y,s=e.a.x-e.b.x,r=e.a.x*(e.a.y-e.b.y)+e.a.y*(e.b.x-e.a.x),n=t.utils.bezierCoeffs(this.startPoint.x,this.startControlPoint.x,this.endControlPoint.x,this.endPoint.x),o=t.utils.bezierCoeffs(this.startPoint.y,this.startControlPoint.y,this.endControlPoint.y,this.endPoint.y),a=Array(4);return a[0]=i*n[0]+s*o[0],a[1]=i*n[1]+s*o[1],a[2]=i*n[2]+s*o[2],a[3]=i*n[3]+s*o[3]+r,t.utils.cubicRoots(a).filter(function(t){return-1!=t})},t.prototype.equals=function(t){return!!t&&!!(t.startPoint&&t.endPoint&&t.startControlPoint&&t.endControlPoint)&&this.startPoint.equals(t.startPoint)&&this.endPoint.equals(t.endPoint)&&this.startControlPoint.equals(t.startControlPoint)&&this.endControlPoint.equals(t.endControlPoint)},t.prototype.destroy=function(){this.startPoint.destroy(),this.endPoint.destroy(),this.startControlPoint.destroy(),this.endControlPoint.destroy(),this.isDestroyed=!0},t.isInstance=function(e){return e instanceof t},t.prototype.toJSON=function(t){return"{ "+(t?"\n\t":"")+'"startPoint" : ['+this.getStartPoint().x+","+this.getStartPoint().y+"], "+(t?"\n\t":"")+'"endPoint" : ['+this.getEndPoint().x+","+this.getEndPoint().y+"], "+(t?"\n\t":"")+'"startControlPoint": ['+this.getStartControlPoint().x+","+this.getStartControlPoint().y+"], "+(t?"\n\t":"")+'"endControlPoint" : ['+this.getEndControlPoint().x+","+this.getEndControlPoint().y+"]"+(t?"\n\t":"")+" }"},t.fromJSON=function(e){var i=JSON.parse(e);return t.fromObject(i)},t.fromObject=function(e){if("object"!=typeof e)throw"Can only build from object.";if(!e.startPoint)throw'Object member "startPoint" missing.';if(!e.endPoint)throw'Object member "endPoint" missing.';if(!e.startControlPoint)throw'Object member "startControlPoint" missing.';if(!e.endControlPoint)throw'Object member "endControlPoint" missing.';return new t(new n.Vertex(e.startPoint[0],e.startPoint[1]),new n.Vertex(e.endPoint[0],e.endPoint[1]),new n.Vertex(e.startControlPoint[0],e.startControlPoint[1]),new n.Vertex(e.endControlPoint[0],e.endControlPoint[1]))},t.fromArray=function(e){if(!Array.isArray(e))throw"Can only build from object.";if(4!=e.length)throw"Can only build from array with four elements.";return new t(e[0],e[1],e[2],e[3])},t.START_POINT=0,t.START_CONTROL_POINT=1,t.END_CONTROL_POINT=2,t.END_POINT=3,t.utils={evaluateT:function(t,e,i,s,r){return t*Math.pow(1-r,3)+3*e*r*Math.pow(1-r,2)+3*i*Math.pow(r,2)*(1-r)+s*Math.pow(r,3)},cubicPolyMinMax:function(e,i,s,r){var n=t.utils.cubicPoly(e,i,s,r),o=n[0],a=n[1],h=(n[2],n[1]*n[1]-4*n[0]*n[2]),c=Math.min(r,e),l=Math.max(r,e);if(h>=0){var u=(-a+Math.sqrt(h))/(2*o);if(u>0&&u<1){var d=t.utils.evaluateT(e,i,s,r,u);d<c&&(c=d),d>l&&(l=d)}var p=(-a-Math.sqrt(h))/(2*o);if(p>0&&p<1){var f=t.utils.evaluateT(e,i,s,r,p);f<c&&(c=f),f>l&&(l=f)}}return{min:c,max:l}},getSubCurvePointsAt:function(t,e,i){var s=new o.Vector(t.getPointAt(e),t.getTangentAt(e)),r=new o.Vector(t.getPointAt(i),t.getTangentAt(i).inv());return s.b.add(s.a),r.b.add(r.a),s.scale(.33333333*(i-e)),r.scale(.33333333*(i-e)),[s.a,r.a,s.b,r.b]},cubicRoots:function(e){var i,s,r=e[0],n=e[1]/r,o=e[2]/r,a=e[3]/r,h=(3*o-Math.pow(n,2))/9,c=(9*n*o-27*a-2*Math.pow(n,3))/54,l=Math.pow(h,3)+Math.pow(c,2),u=[];if(l>=0)i=t.utils.sgn(c+Math.sqrt(l))*Math.pow(Math.abs(c+Math.sqrt(l)),1/3),s=t.utils.sgn(c-Math.sqrt(l))*Math.pow(Math.abs(c-Math.sqrt(l)),1/3),u[0]=-n/3+(i+s),u[1]=-n/3-(i+s)/2,u[2]=-n/3-(i+s)/2,0!=Math.abs(Math.sqrt(3)*(i-s)/2)&&(u[1]=-1,u[2]=-1);else{var d=Math.acos(c/Math.sqrt(-Math.pow(h,3)));u[0]=2*Math.sqrt(-h)*Math.cos(d/3)-n/3,u[1]=2*Math.sqrt(-h)*Math.cos((d+2*Math.PI)/3)-n/3,u[2]=2*Math.sqrt(-h)*Math.cos((d+4*Math.PI)/3)-n/3}return u.filter(function(t){return t>=0&&t<=1}).sort()},bezierCoeffs:function(t,e,i,s){var r=[NaN,NaN,NaN,NaN];return r[0]=3*e-t+-3*i+s,r[1]=3*t-6*e+3*i,r[2]=-3*t+3*e,r[3]=t,r},cubicPoly:function(t,e,i,s){return[3*s-9*i+9*e-3*t,6*t-12*e+6*i,3*e-3*t]},sgn:function(t){return t<0?-1:1}},t}();e.CubicBezierCurve=a}},e={};function i(s){var r=e[s];if(void 0!==r)return r.exports;var n=e[s]={exports:{}};return t[s].call(n.exports,n,n.exports,i),n.exports}i.d=(t,e)=>{for(var s in e)i.o(e,s)&&!i.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},globalThis.UIDGenerator=i(938).UIDGenerator,globalThis.VertexAttr=i(476).VertexAttr,globalThis.VertexListeners=i(934).VertexListeners,globalThis.Vertex=i(787).Vertex,globalThis.Bounds=i(76).Bounds,globalThis.Grid=i(289).Grid,globalThis.Line=i(939).Line,globalThis.Vector=i(30).Vector,globalThis.CubicBezierCurve=i(973).CubicBezierCurve,globalThis.BezierPath=i(733).BezierPath,globalThis.Polygon=i(687).Polygon,globalThis.Triangle=i(737).Triangle,globalThis.VEllipse=i(881).VEllipse,globalThis.VEllipseSector=i(719).VEllipseSector,globalThis.Circle=i(118).Circle,globalThis.CircleSector=i(135).CircleSector,globalThis.PBImage=i(862).PBImage,globalThis.PBText=i(628).PBText,globalThis.MouseHandler=i(912).MouseHandler,globalThis.KeyHandler=i(531).KeyHandler,globalThis.drawutils=i(39).drawutils,globalThis.drawutilssvg=i(378).drawutilssvg,globalThis.geomutils=i(328).geomutils,globalThis.PlotBoilerplate=i(559).PlotBoilerplate})();
2
2
  //# sourceMappingURL=plotboilerplate.browser.min.js.map