{"version":3,"sources":["webpack://plotboilerplate/./src/js/BezierPath.js","webpack://plotboilerplate/./src/js/Bounds.js","webpack://plotboilerplate/./src/js/Circle.js","webpack://plotboilerplate/./src/js/CircleSector.js","webpack://plotboilerplate/./src/js/CubicBezierCurve.js","webpack://plotboilerplate/./src/js/Grid.js","webpack://plotboilerplate/./src/js/KeyHandler.js","webpack://plotboilerplate/./src/js/Line.js","webpack://plotboilerplate/./src/js/MouseHandler.js","webpack://plotboilerplate/./src/js/PBImage.js","webpack://plotboilerplate/./src/js/PlotBoilerplate.js","webpack://plotboilerplate/./src/js/Polygon.js","webpack://plotboilerplate/./src/js/Triangle.js","webpack://plotboilerplate/./src/js/UIDGenerator.js","webpack://plotboilerplate/./src/js/VEllipse.js","webpack://plotboilerplate/./src/js/Vector.js","webpack://plotboilerplate/./src/js/VertTuple.js","webpack://plotboilerplate/./src/js/Vertex.js","webpack://plotboilerplate/./src/js/VertexAttr.js","webpack://plotboilerplate/./src/js/VertexListeners.js","webpack://plotboilerplate/./src/js/draw.js","webpack://plotboilerplate/./src/js/drawgl.js","webpack://plotboilerplate/./src/js/geomutils.js","webpack://plotboilerplate/./src/js/utils/helpers/drawutilssvg.js","webpack://plotboilerplate/webpack/bootstrap","webpack://plotboilerplate/./src/js/entry.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,CAAC,cAAc,EAAC;AAC7D,kBAAkB;AAClB,eAAe,mBAAO,CAAC,oCAAU;AACjC,yBAAyB,mBAAO,CAAC,wDAAoB;AACrD,qBAAqB,mBAAO,CAAC,gDAAgB;AAC7C,eAAe,mBAAO,CAAC,oCAAU;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA,uBAAuB,OAAO;AAC9B;AACA,uBAAuB,OAAO;AAC9B;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,iBAAiB;AAChC;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,gCAAgC;AACnD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;;AAEA;AACA;;AAEA;AACA,mBAAmB,8BAA8B;;AAEjD;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB,kBAAkB;AACrC;;AAEA;;AAEA;AACA,4BAA4B,gCAAgC;AAC5D;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,0CAA0C,gBAAgB;AAC1D;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,kDAAkD;;AAErE;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA,gBAAgB,WAAW;AAC3B;AACA;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB,WAAW;AAC3B;AACA;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB;AAChB;AACA;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,OAAO;AACjB,UAAU,OAAO;AACjB,UAAU,OAAO;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB,WAAW;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE,KAAK;AACvE,8DAA8D,KAAK;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,kBAAkB;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,kDAAkD;AAClG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA,eAAe,SAAS;AACxB;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,mBAAmB,W;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,iBAAiB;AAChC,eAAe,iBAAiB;AAChC,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,WAAW;AAC1B;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,QAAQ;AACjC;AACA;AACA;AACA,eAAe,QAAQ,YAAY;AACnC,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA,yBAAyB;AACzB,uBAAuB,8BAA8B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA,gBAAgB,WAAW;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,WAAW;AAC1B;AACA;AACA;AACA,gBAAgB,WAAW;AAC3B;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA,uBAAuB,gBAAgB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB,uBAAuB,8BAA8B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA,gBAAgB,WAAW;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA,mBAAmB,OAAO;AAC1B;AACA,mBAAmB,OAAO;AAC1B;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA,CAAC;AACD,kBAAkB;AAClB,sC;;;;;;;;;;;;;;;AClqCa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,CAAC,cAAc,EAAC;AAC7D,cAAc;AACd,gBAAgB,mBAAO,CAAC,sCAAW;AACnC,eAAe,mBAAO,CAAC,oCAAU;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,cAAc;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,IAAI;AACL,cAAc;AACd,kC;;;;;;;;;;;;;;;ACrFa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,CAAC,cAAc,EAAC;AAC7D,cAAc;AACd,aAAa,mBAAO,CAAC,gCAAQ;AAC7B,qBAAqB,mBAAO,CAAC,gDAAgB;AAC7C,eAAe,mBAAO,CAAC,oCAAU;AACjC,eAAe,mBAAO,CAAC,oCAAU;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,KAAK;AACpB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,UAAU;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,Y;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD;AAClD;AACA;AACA;AACA;AACA,CAAC,IAAI;AACL,cAAc;AACd,kC;;;;;;;;;;;;;;;ACrMa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,CAAC,cAAc,EAAC;AAC7D,oBAAoB;AACpB,qBAAqB,mBAAO,CAAC,gDAAgB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB,iBAAiB,OAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,QAAQ;AAC3B;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,IAAI;AACL,oBAAoB;AACpB,wC;;;;;;;;;;;;;;;AC7Ga;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,CAAC,cAAc,EAAC;AAC7D,wBAAwB;AACxB,eAAe,mBAAO,CAAC,oCAAU;AACjC,qBAAqB,mBAAO,CAAC,gDAAgB;AAC7C,eAAe,mBAAO,CAAC,oCAAU;AACjC,eAAe,mBAAO,CAAC,oCAAU;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA,uBAAuB,OAAO;AAC9B;AACA,uBAAuB,OAAO;AAC9B;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,IAAI;AACnD;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,gBAAgB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oEAAoE;AACpE;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,iBAAiB;AAChC;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,IAAI;AACnB;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,EAAE;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA,mBAAmB,OAAO;AAC1B;AACA,mBAAmB,OAAO;AAC1B;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA,CAAC;AACD,wBAAwB;AACxB,4C;;;;;;;;;;;;;;;ACrsBa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,CAAC,cAAc,EAAC;AAC7D,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B,oBAAoB,OAAO;AAC3B;AACA,uCAAuC,uCAAuC,EAAE;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,YAAY;AACZ,gC;;;;;;;;;;;;;;;AC1Fa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,CAAC,cAAc,EAAC;AAC7D,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,kBAAkB;AACtC,iCAAiC,+BAA+B,EAAE;AAClE,kCAAkC,mCAAmC,EAAE;AACvE,+BAA+B,oCAAoC,EAAE;AACrE;AACA,kCAAkC,wEAAwE,EAAE;AAC5G;AACA,iCAAiC,sCAAsC,EAAE;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,YAAY,0DAA0D;AACrF,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,cAAc;AAC7B,eAAe,oBAAoB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,cAAc;AAC7B,eAAe,WAAW;AAC1B,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,cAAc;AAC7B,eAAe,WAAW;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,cAAc;AAC7B,eAAe,WAAW;AAC1B,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uFAAuF,+BAA+B,EAAE;AACxH,yFAAyF,gCAAgC,EAAE;AAC3H,mFAAmF,6BAA6B,EAAE;AAClH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D,0BAA0B;AACpF;AACA;AACA;AACA;AACA,eAAe,cAAc;AAC7B,eAAe,wBAAwB;AACvC,gBAAgB,WAAW;AAC3B;AACA;AACA,iCAAiC,kEAAkE;AACnG;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D,8BAA8B;AACzF;AACA;AACA;AACA;AACA,eAAe,cAAc;AAC7B,eAAe,wBAAwB;AACvC,gBAAgB,WAAW;AAC3B;AACA;AACA,kCAAkC,kEAAkE;AACpG;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD,+BAA+B;AACvF;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,yBAAyB;AACxC,gBAAgB,WAAW;AAC3B;AACA;AACA,+BAA+B,kEAAkE;AACjG;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,cAAc;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,kBAAkB;AAClB,sC;;;;;;;;;;;;;AC7aa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,gBAAgB,sCAAsC,iBAAiB,EAAE;AACvF,6BAA6B,8EAA8E;AAC3G;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA,CAAC;AACD,8CAA6C,CAAC,cAAc,EAAC;AAC7D,YAAY;AACZ,kBAAkB,mBAAO,CAAC,0CAAa;AACvC,eAAe,mBAAO,CAAC,oCAAU;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA,6DAA6D,uBAAuB,EAAE;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,KAAK;AACpB,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,YAAY;AACZ,gC;;;;;;;;;;;;;ACzHa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,gBAAgB,sCAAsC,iBAAiB,EAAE;AACvF,6BAA6B,8EAA8E;AAC3G;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA,CAAC;AACD,8CAA6C,CAAC,cAAc,EAAC;AAC7D,oBAAoB,GAAG,mBAAmB,GAAG,mBAAmB;AAChE;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA,YAAY;AACZ;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA,YAAY;AACZ;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,eAAe,YAAY;AAC3B;AACA;AACA;AACA;AACA;AACA,qCAAqC,qBAAqB;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,WAAW;AAC1B,gBAAgB,SAAS;AACzB;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,WAAW;AAC1B,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,iEAAiE,IAAI,aAAa;AACxI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,eAAe;AAC9B,gBAAgB,aAAa;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,eAAe;AAC9B,gBAAgB,aAAa;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,eAAe;AAC9B,gBAAgB,aAAa;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,eAAe;AAC9B,gBAAgB,aAAa;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,eAAe;AAC9B,gBAAgB,aAAa;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,eAAe;AAC9B,gBAAgB,aAAa;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,oBAAoB;AACpB,wC;;;;;;;;;;;;;;;AC5aa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,CAAC,cAAc,EAAC;AAC7D,eAAe;AACf,qBAAqB,mBAAO,CAAC,gDAAgB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,eAAe;AACf,mC;;;;;;;;;;;;;;;AChEa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD,aAAa;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAiE;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,CAAC,cAAc,EAAC;AAC7D,uBAAuB;AACvB,wBAAwB,kCAAkC;AAC1D,uBAAuB,kCAAkC;AACzD,+BAA+B,mBAAO,CAAC,qJAAwB;AAC/D,aAAa,mBAAO,CAAC,gCAAQ;AAC7B,eAAe,mBAAO,CAAC,oCAAU;AACjC,qBAAqB,mBAAO,CAAC,4EAA8B;AAC3D,mBAAmB,mBAAO,CAAC,4CAAc;AACzC,eAAe,mBAAO,CAAC,oCAAU;AACjC,eAAe,mBAAO,CAAC,oCAAU;AACjC,qBAAqB,mBAAO,CAAC,gDAAgB;AAC7C,aAAa,mBAAO,CAAC,gCAAQ;AAC7B,mBAAmB,mBAAO,CAAC,4CAAc;AACzC,aAAa,mBAAO,CAAC,gCAAQ;AAC7B,qBAAqB,mBAAO,CAAC,gDAAgB;AAC7C,gBAAgB,mBAAO,CAAC,sCAAW;AACnC,gBAAgB,mBAAO,CAAC,sCAAW;AACnC,iBAAiB,mBAAO,CAAC,wCAAY;AACrC,iBAAiB,mBAAO,CAAC,wCAAY;AACrC,eAAe,mBAAO,CAAC,oCAAU;AACjC,eAAe,mBAAO,CAAC,oCAAU;AACjC,mBAAmB,mBAAO,CAAC,4CAAc;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO,UAAU;AAChC,eAAe,kBAAkB;AACjC,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,QAAQ;AACvB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB;AACA,4CAA4C,IAAI;AAChD,eAAe,QAAQ;AACvB;AACA,eAAe,QAAQ;AACvB;AACA,eAAe,QAAQ;AACvB;AACA,eAAe,QAAQ;AACvB;AACA,eAAe,QAAQ;AACvB,4DAA4D,IAAI;AAChE;AACA,eAAe,QAAQ;AACvB,4DAA4D,IAAI;AAChE;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,SAAS;AACxB,eAAe,QAAQ;AACvB,eAAe,SAAS;AACxB;AACA,eAAe,SAAS;AACxB;AACA,eAAe,SAAS;AACxB,eAAe,UAAU;AACzB;AACA,eAAe,UAAU;AACzB;AACA,eAAe,UAAU;AACzB;AACA,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,6BAA6B,EAAE;AAClE,sCAAsC,sBAAsB,EAAE;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D,6BAA6B,EAAE;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,kBAAkB,gBAAgB;AAC1E;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,yEAAyE;AACzE,oFAAoF;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,sEAAsE,IAAI;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,oBAAoB;AACnC,eAAe,QAAQ;AACvB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,2BAA2B,gBAAgB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,8BAA8B;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,oCAAoC;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA,uBAAuB,2BAA2B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,8BAA8B;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,kCAAkC;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA,uBAAuB,0BAA0B;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,cAAc;AAC7B;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,kBAAkB;AAClB;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA,wBAAwB,aAAa;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB;AACA;AACA,gBAAgB,gBAAgB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB;AACA,gBAAgB,WAAW;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,gCAAgC;AAC5D;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB,SAAS,uBAAuB,yBAAyB;AACzE;AACA;AACA,mBAAmB;AACnB,oFAAoF;AACpF;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB,SAAS;AACzB;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,YAAY;AAC3B;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,2BAA2B;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,YAAY;AAC3B;AACA,gBAAgB;AAChB;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,YAAY;AAC3B;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,YAAY;AAC3B;AACA,gBAAgB;AAChB;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,OAAO;AACrB,cAAc,OAAO;AACrB,cAAc,OAAO;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,+BAA+B;AACvD;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,2BAA2B,EAAE;AACjE,oCAAoC,2BAA2B,EAAE;AACjE,kCAAkC,yBAAyB,EAAE;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,4BAA4B,EAAE;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6EAA6E,uDAAuD;AACpI,6EAA6E,uDAAuD;AACpI;AACA;AACA;AACA,qDAAqD,UAAU,kCAAkC,aAAa,qHAAqH;AACnO;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA,oDAAoD,uDAAuD;AAC3G;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,8BAA8B,uJAAuJ;AAC1O;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yGAAyG;AACzG;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA,iDAAiD,8BAA8B,cAAc,aAAa,qHAAqH;AAC/N;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA,yBAAyB;AACzB;AACA;AACA,yBAAyB;AACzB;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D,iBAAiB;AAC5E;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD;AAClD;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA,mBAAmB,OAAO;AAC1B;AACA,mBAAmB,OAAO;AAC1B;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,0DAA0D;AAChH;AACA,6DAA6D,sBAAsB,aAAa;AAChG;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B,oBAAoB,OAAO;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,mBAAmB,YAAY;AAC/B,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,uBAAuB,IAAI;AAC3B,uBAAuB,OAAO;AAC9B,uBAAuB,IAAI;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,uBAAuB,IAAI;AAC3B,uBAAuB,OAAO;AAC9B,uBAAuB,OAAO;AAC9B,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,uBAAuB,IAAI;AAC3B,uBAAuB,OAAO;AAC9B,uBAAuB,QAAQ;AAC/B,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,uBAAuB,IAAI;AAC3B,uBAAuB,OAAO;AAC9B,uBAAuB,SAAS;AAChC,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,WAAW;AAC9B;AACA;AACA,2BAA2B,oCAAoC;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,8DAA8D,qC;AAC9D;AACA;AACA;AACA;AACA,qHAAqH,qDAAqD;AAC1K;AACA;AACA,qBAAqB;AACrB;AACA,aAAa;AACb;AACA,MAAM;AACN;AACA,CAAC,IAAI;AACL,uBAAuB;AACvB,2C;;;;;;;;;;;;;;;AC15Da;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,CAAC,cAAc,EAAC;AAC7D,eAAe;AACf,mBAAmB,mBAAO,CAAC,4CAAc;AACzC,eAAe,mBAAO,CAAC,oCAAU;AACjC,qBAAqB,mBAAO,CAAC,gDAAgB;AAC7C,eAAe,mBAAO,CAAC,oCAAU;AACjC;AACA,4EAA4E;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,0BAA0B;AAC/E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,WAAW;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,WAAW;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,WAAW;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,0BAA0B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA,gDAAgD,OAAO;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA,2BAA2B,OAAO;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,eAAe;AACf,mC;;;;;;;;;;;;;;;ACxba;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,CAAC,cAAc,EAAC;AAC7D,gBAAgB;AAChB,eAAe,mBAAO,CAAC,oCAAU;AACjC,eAAe,mBAAO,CAAC,oCAAU;AACjC,aAAa,mBAAO,CAAC,gCAAQ;AAC7B,gBAAgB,mBAAO,CAAC,sCAAW;AACnC,qBAAqB,mBAAO,CAAC,gDAAgB;AAC7C,eAAe,mBAAO,CAAC,oCAAU;AACjC,kBAAkB,mBAAO,CAAC,0CAAa;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,cAAc;AAC7B;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO,IAAI;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA,uFAAuF;AACvF,uFAAuF;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA,iBAAiB,6FAA6F;AAC9G;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,qBAAqB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,gBAAgB;AAChB,oC;;;;;;;;;;;;;;;AC5ba;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,CAAC,cAAc,EAAC;AAC7D,oBAAoB;AACpB;AACA;AACA;AACA,qCAAqC,oCAAoC;AACzE;AACA;AACA;AACA,CAAC;AACD,oBAAoB;AACpB;AACA,wC;;;;;;;;;;;;;;;ACpBa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,CAAC,cAAc,EAAC;AAC7D,gBAAgB;AAChB,qBAAqB,mBAAO,CAAC,gDAAgB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO,UAAU;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,gBAAgB;AAChB,oC;;;;;;;;;;;;;AClEa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,gBAAgB,sCAAsC,iBAAiB,EAAE;AACvF,6BAA6B,8EAA8E;AAC3G;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA,CAAC;AACD,8CAA6C,CAAC,cAAc,EAAC;AAC7D,cAAc;AACd,kBAAkB,mBAAO,CAAC,0CAAa;AACvC,eAAe,mBAAO,CAAC,oCAAU;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA,qEAAqE,yBAAyB,EAAE;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,cAAc;AACd,kC;;;;;;;;;;;;;;;AC5Ma;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,CAAC,cAAc,EAAC;AAC7D,iBAAiB;AACjB,eAAe,mBAAO,CAAC,oCAAU;AACjC,qBAAqB,mBAAO,CAAC,gDAAgB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA,gBAAgB,EAAE;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,gBAAgB,UAAU;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,gBAAgB,KAAK;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,UAAU;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,UAAU;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,UAAU;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,EAAE;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA,iBAAiB,+DAA+D;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,iBAAiB;AACjB,qC;;;;;;;;;;;;;;;ACzTa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D,IAAI;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,CAAC,cAAc,EAAC;AAC7D,cAAc;AACd,mBAAmB,mBAAO,CAAC,4CAAc;AACzC,qBAAqB,mBAAO,CAAC,gDAAgB;AAC7C,wBAAwB,mBAAO,CAAC,sDAAmB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,OAAO,GAAG,OAAO;AACvD,aAAa,OAAO;AACpB;AACA;AACA,eAAe,gBAAgB;AAC/B,eAAe,QAAQ;AACvB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,OAAO,GAAG,OAAO;AACvD,aAAa,OAAO;AACpB;AACA;AACA,eAAe,gBAAgB;AAC/B,eAAe,QAAQ;AACvB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO,4CAA4C;AAClE,eAAe,QAAQ,gCAAgC;AACvD,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO,2CAA2C;AACjE,eAAe,QAAQ,iCAAiC;AACxD,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,KAAK,QAAQ;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO,2BAA2B;AACjD,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS,eAAe,uBAAuB;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,cAAc;AACd,kC;;;;;;;;;;;;;;;ACrjBa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,CAAC,cAAc,EAAC;AAC7D,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,kBAAkB;AAClB,sC;;;;;;;;;;;;;;;ACzDa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,CAAC,cAAc,EAAC;AAC7D,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,6BAA6B;AAC5C,gBAAgB,gBAAgB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB;AACA;AACA;AACA;AACA;AACA,eAAe,6BAA6B;AAC5C,gBAAgB,gBAAgB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB;AACA;AACA;AACA;AACA;AACA,eAAe,6BAA6B;AAC5C,gBAAgB,gBAAgB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB;AACA;AACA;AACA;AACA;AACA,eAAe,6BAA6B;AAC5C,gBAAgB,gBAAgB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,kCAAkC;AACjD,gBAAgB,gBAAgB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB;AACA;AACA;AACA;AACA;AACA,eAAe,6BAA6B;AAC5C,gBAAgB,gBAAgB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,gCAAgC;AAC/C,gBAAgB,gBAAgB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB;AACA;AACA;AACA;AACA;AACA,cAAc,8BAA8B;AAC5C,eAAe,gBAAgB;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,sBAAsB;AACrC,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,sBAAsB;AACrC,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,sBAAsB;AACrC,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,sBAAsB;AACrC,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,uBAAuB;AACvB,2C;;;;;;;;;;;;;;;ACjRa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2FAA2F;AAC3F,iFAAiF;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,CAAC,cAAc,EAAC;AAC7D,iBAAiB;AACjB,yBAAyB,mBAAO,CAAC,wDAAoB;AACrD,eAAe,mBAAO,CAAC,oCAAU;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,wBAAwB;AACvC,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,IAAI;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,QAAQ,8CAA8C;AACrE,gBAAgB;AAChB;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,cAAc;AAC7B,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,iBAAiB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,eAAe;AAC9B,eAAe,SAAS;AACxB,kBAAkB,cAAc;AAChC,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+DAA+D,eAAe;AAC9E;AACA;AACA;AACA,6DAA6D;AAC7D,6BAA6B;AAC7B,gEAAgE,gBAAgB;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,+DAA+D,eAAe;AAC9E,oEAAoE,gBAAgB;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,iBAAiB;AACjB,gC;;;;;;;;;;;;;;;ACxvBa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,CAAC,cAAc,EAAC;AAC7D,mBAAmB;AACnB,eAAe,mBAAO,CAAC,oCAAU;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,sBAAsB;AACrC,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,8EAA8E;AAC/H;AACA,iDAAiD,+EAA+E;AAChI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,IAAI;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,QAAQ,8CAA8C;AACrE,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,eAAe,QAAQ,8CAA8C;AACrE,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,QAAQ,8CAA8C;AACrE,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,QAAQ,8CAA8C;AACrE,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,QAAQ,8CAA8C;AACrE,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,uBAAuB,6BAA6B;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,QAAQ,+CAA+C;AACtE,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA,sCAAsC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D,gCAAgC,qCAAqC,yBAAyB,+LAA+L,2DAA2D,OAAO;AACzZ;AACA,wDAAwD,yBAAyB,0CAA0C,OAAO;AAClI;AACA,CAAC;AACD,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,kC;;;;;;;;;;;;;;;ACjpBa;AACb;AACA;AACA;AACA;AACA;AACA,8CAA6C,CAAC,cAAc,EAAC;AAC7D,iBAAiB;AACjB,aAAa,mBAAO,CAAC,gCAAQ;AAC7B,iBAAiB,mBAAO,CAAC,wCAAY;AACrC;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA,qC;;;;;;;;;;;;;;;ACpDa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,CAAC,cAAc,EAAC;AAC7D,oBAAoB;AACpB,qBAAqB,mBAAO,CAAC,oDAAoB;AACjD,yBAAyB,mBAAO,CAAC,4DAAwB;AACzD,eAAe,mBAAO,CAAC,wCAAc;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,WAAW;AAC1B,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,YAAY;AAC3B,eAAe,QAAQ;AACvB,eAAe,WAAW;AAC1B,eAAe,SAAS;AACxB,eAAe,YAAY,sEAAsE;AACjG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,aAAa,oCAAoC,iDAAiD;AAC9I;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,IAAI;AACnB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,OAAO;AACxC;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,WAAW;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,WAAW;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,WAAW;AAC1B,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,gBAAgB,WAAW;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,YAAY;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,IAAI;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,yCAAyC;AACvF,8CAA8C,yCAAyC;AACvF;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,QAAQ,8CAA8C;AACrE,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD;AACnD;AACA;AACA;AACA,yDAAyD,qBAAqB,EAAE;AAChF;AACA;AACA;AACA;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,iBAAiB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,QAAQ,8CAA8C;AACrE,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,QAAQ,8CAA8C;AACrE,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,QAAQ,8CAA8C;AACrE,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+DAA+D,eAAe;AAC9E;AACA;AACA;AACA;AACA;AACA,gEAAgE,gBAAgB;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,+DAA+D,eAAe;AAC9E,oEAAoE,gBAAgB;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,OAAO;AACtB,eAAe,QAAQ,8CAA8C;AACrE,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,QAAQ,8CAA8C;AACrE,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,kCAAkC;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qEAAqE;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,OAAO;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,oBAAoB;AACpB,wC;;;;;;UC33BA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;;;;;ACrBa;AACb;;AAEA;AACA,wBAAwB,kCAAkC;;AAE1D,0BAA0B,kFAAsC;AAChE,wBAAwB,+EAAqC;AAC7D,6BAA6B,8FAA+C;AAC5E,oBAAoB,mEAA6B;;AAEjD,oBAAoB,mEAA6B;AACjD,kBAAkB,6DAAyB;AAC3C,kBAAkB,6DAAyB;AAC3C,oBAAoB,mEAA6B;AACjD,8BAA8B,iGAAiD;AAC/E,wBAAwB,+EAAqC;AAC7D,qBAAqB,sEAA+B;AACpD,sBAAsB,yEAAiC;AACvD,sBAAsB,yEAAiC;AACvD,oBAAoB,mEAA6B;AACjD,0BAA0B,qFAAyC;AACnE,qBAAqB,sEAA+B;AACpD,0BAA0B,qFAAyC;AACnE,wBAAwB,+EAAqC;AAC7D,uBAAuB,kEAA8B;AACrD;AACA;AACA,0BAA0B,iHAAuD;AACjF,uBAAuB,4EAAmC;AAC1D,6BAA6B,8FAA+C","file":"plotboilerplate.js","sourcesContent":["\"use strict\";\n/**\n * @author Ikaros Kappler\n * @date 2013-08-19\n * @modified 2018-08-16 Added closure. Removed the 'IKRS' wrapper.\n * @modified 2018-11-20 Added circular auto-adjustment.\n * @modified 2018-11-25 Added the point constants to the BezierPath class itself.\n * @modified 2018-11-28 Added the locateCurveByStartPoint() function.\n * @modified 2018-12-04 Added the toSVGString() function.\n * @modified 2019-03-23 Added JSDoc tags.\n * @modified 2019-03-23 Changed the fuctions getPoint and getPointAt to match semantics in the Line class.\n * @modified 2019-11-18 Fixed the clone function: adjustCircular attribute was not cloned.\n * @modified 2019-12-02 Removed some excessive comments.\n * @modified 2019-12-04 Fixed the missing obtainHandleLengths behavior in the adjustNeightbourControlPoint function.\n * @modified 2020-02-06 Added function locateCurveByEndPoint( Vertex ).\n * @modified 2020-02-11 Added 'return this' to the scale(Vertex,number) and to the translate(Vertex) function.\n * @modified 2020-03-24 Ported this class from vanilla-JS to Typescript.\n * @modified 2020-06-03 Made the private helper function _locateUIndex to a private function.\n * @modified 2020-06-03 Added the getBounds() function.\n * @modified 2020-07-14 Changed the moveCurvePoint(...,Vertex) to moveCurvePoint(...,XYCoords).\n * @modified 2020-07-24 Added the getClosestT(Vertex) function.\n * @modified 2020-12-29 Constructor is now private (no explicit use intended).\n * @version 2.3.0\n *\n * @file BezierPath\n * @public\n **/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.BezierPath = void 0;\nvar Bounds_1 = require(\"./Bounds\");\nvar CubicBezierCurve_1 = require(\"./CubicBezierCurve\");\nvar UIDGenerator_1 = require(\"./UIDGenerator\");\nvar Vertex_1 = require(\"./Vertex\");\n/**\n * @classdesc A BezierPath class.\n *\n * This was refactored from an older project.\n *\n * @requires Bounds\n * @requires Vertex\n * @requires CubicBezierCurve\n * @requires XYCoords\n * @requires SVGSerializable\n * @requires UID\n * @requires UIDGenerator\n **/\nvar BezierPath = /** @class */ (function () {\n    /**\n     * The constructor.<br>\n     * <br>\n     * This constructor expects a sequence of path points and will approximate\n     * the location of control points by picking some between the points.<br>\n     * You should consider just constructing empty paths and then add more curves later using\n     * the addCurve() function.\n     *\n     * @constructor\n     * @name BezierPath\n     * @param {Vertex[]} pathPoints - An array of path vertices (no control points).\n     **/\n    function BezierPath(pathPoints) {\n        /**\n         * Required to generate proper CSS classes and other class related IDs.\n         **/\n        this.className = \"BezierPath\";\n        /** @constant {number} */\n        this.START_POINT = 0;\n        /** @constant {number} */\n        this.START_CONTROL_POINT = 1;\n        /** @constant {number} */\n        this.END_CONTROL_POINT = 2;\n        /** @constant {number} */\n        this.END_POINT = 3;\n        this.uid = UIDGenerator_1.UIDGenerator.next();\n        if (!pathPoints)\n            pathPoints = [];\n        this.totalArcLength = 0.0;\n        // Set this flag to true if you want the first point and\n        // last point of the path to be auto adjusted, too.\n        this.adjustCircular = false;\n        this.bezierCurves = [];\n    }\n    ;\n    /**\n     * Add a cubic bezier curve to the end of this path.\n     *\n     * @method addCurve\n     * @param {CubicBezierCurve} curve - The curve to be added to the end of the path.\n     * @instance\n     * @memberof BezierPath\n     * @return {void}\n     **/\n    BezierPath.prototype.addCurve = function (curve) {\n        if (curve == null || typeof curve == 'undefined')\n            throw \"Cannot add null curve to bézier path.\";\n        this.bezierCurves.push(curve);\n        if (this.bezierCurves.length > 1) {\n            curve.startPoint = this.bezierCurves[this.bezierCurves.length - 2].endPoint;\n            this.adjustSuccessorControlPoint(this.bezierCurves.length - 2, // curveIndex,\n            true, // obtainHandleLength,  \n            true // updateArcLengths  \n            );\n        }\n        else {\n            this.totalArcLength += curve.getLength();\n        }\n    };\n    ;\n    /**\n     * Locate the curve with the given start point (function returns the index).\n     *\n     * @method locateCurveByStartPoint\n     * @param {Vertex} point - The (curve start-) point to look for.\n     * @instance\n     * @memberof BezierPath\n     * @return {number} The curve index or -1 if curve (start-) point not found\n     **/\n    BezierPath.prototype.locateCurveByStartPoint = function (point) {\n        // for( var i in this.bezierCurves ) {\n        for (var i = 0; i < this.bezierCurves.length; i++) {\n            if (this.bezierCurves[i].startPoint.equals(point))\n                return i;\n        }\n        return -1;\n    };\n    ;\n    /**\n     * Locate the curve with the given end point (function returns the index).\n     *\n     * @method locateCurveByEndPoint\n     * @param {Vertex} point - The (curve end-) point to look for.\n     * @instance\n     * @memberof BezierPath\n     * @return {number} The curve index or -1 if curve (end-) point not found\n     **/\n    BezierPath.prototype.locateCurveByEndPoint = function (point) {\n        // for( var i in this.bezierCurves ) {\n        for (var i = 0; i < this.bezierCurves.length; i++) {\n            if (this.bezierCurves[i].endPoint.equals(point))\n                return i;\n        }\n        return -1;\n    };\n    ;\n    /**\n     * Locate the curve with the given start point (function returns the index).\n     *\n     * @method locateCurveByStartControlPoint\n     * @param {Vertex} point - The (curve endt-) point to look for.\n     * @instance\n     * @memberof BezierPath\n     * @return {number} The curve index or -1 if curve (end-) point not found\n     **/\n    BezierPath.prototype.locateCurveByStartControlPoint = function (point) {\n        // for( var i in this.bezierCurves ) {\n        for (var i = 0; i < this.bezierCurves.length; i++) {\n            if (this.bezierCurves[i].startControlPoint.equals(point))\n                return i;\n        }\n        return -1;\n    };\n    ;\n    // +---------------------------------------------------------------------------------\n    // | Locate the curve with the given end control point.\n    // |\n    // | @param point:Vertex The point to look for.\n    // | @return Number The index or -1 if not found.\n    // +-------------------------------\n    BezierPath.prototype.locateCurveByEndControlPoint = function (point) {\n        // for( var i in this.bezierCurves ) {\n        for (var i = 0; i < this.bezierCurves.length; i++) {\n            if (this.bezierCurves[i].endControlPoint.equals(point))\n                return i;\n        }\n        return -1;\n    };\n    ;\n    /**\n     * Get the total length of this path.<br>\n     * <br>\n     * Note that the returned value comes from the curve buffer. Unregistered changes\n     * to the curve points will result in invalid path length values.\n     *\n     * @method getLength\n     * @instance\n     * @memberof BezierPath\n     * @return {number} The (buffered) length of the path.\n     **/\n    BezierPath.prototype.getLength = function () {\n        return this.totalArcLength;\n    };\n    ;\n    /**\n     * This function is internally called whenever the curve or path configuration\n     * changed. It updates the attribute that stores the path length information.<br>\n     * <br>\n     * If you perform any unregistered changes to the curve points you should call\n     * this function afterwards to update the curve buffer. Not updating may\n     * result in unexpected behavior.\n     *\n     * @method updateArcLengths\n     * @instance\n     * @memberof BezierPath\n     * @return {void}\n     **/\n    BezierPath.prototype.updateArcLengths = function () {\n        this.totalArcLength = 0.0;\n        for (var i = 0; i < this.bezierCurves.length; i++) {\n            this.bezierCurves[i].updateArcLengths();\n            this.totalArcLength += this.bezierCurves[i].getLength();\n        }\n    };\n    ;\n    /**\n     * Get the number of curves in this path.\n     *\n     * @method getCurveCount\n     * @instance\n     * @memberof BezierPath\n     * @return {number} The number of curves in this path.\n     **/\n    BezierPath.prototype.getCurveCount = function () {\n        return this.bezierCurves.length;\n    };\n    ;\n    /**\n     * Get the cubic bezier curve at the given index.\n     *\n     * @method getCurveAt\n     * @param {number} index - The curve index from 0 to getCurveCount()-1.\n     * @instance\n     * @memberof BezierPath\n     * @return {CubicBezierCurve} The curve at the specified index.\n     **/\n    BezierPath.prototype.getCurveAt = function (curveIndex) {\n        return this.bezierCurves[curveIndex];\n    };\n    ;\n    /**\n     * Remove the end point of this path (which removes the last curve from this path).<br>\n     * <br>\n     * Please note that this function does never remove the first curve, thus the path\n     * cannot be empty after this call.\n     *\n     * @method removeEndPoint\n     * @instance\n     * @memberof BezierPath\n     * @return {boolean} Indicating if the last curve was removed.\n     **/\n    /*\n    BezierPath.prototype.removeEndPoint = function() {\n    if( this.bezierCurves.length <= 1 )\n        return false;\n    \n    var newArray = [ this.bezierCurves.length-1 ];\n    for( var i = 0; i < this.bezierCurves.length-1; i++ ) {\n        newArray[i] = this.bezierCurves[i];\n    }\n    \n    // Update arc length\n    this.totalArcLength -= this.bezierCurves[ this.bezierCurves.length-1 ].getLength();\n    this.bezierCurves = newArray;\n    return true;\n    }\n    */\n    /**\n     * Remove the start point of this path (which removes the first curve from this path).<br>\n     * <br>\n     * Please note that this function does never remove the last curve, thus the path\n     * cannot be empty after this call.<br>\n     *\n     * @method removeStartPoint\n     * @instance\n     * @memberof BezierPath\n     * @return {boolean} Indicating if the first curve was removed.\n     **/\n    /*\n    BezierPath.prototype.removeStartPoint = function() {\n\n    if( this.bezierCurves.length <= 1 )\n        return false;\n\n    var newArray = [ this.bezierCurves.length-1 ];\n    for( var i = 1; i < this.bezierCurves.length; i++ ) {\n\n        newArray[i-1] = this.bezierCurves[i];\n\n    }\n    \n    // Update arc length\n    this.totalArcLength -= this.bezierCurves[ 0 ].getLength();\n    this.bezierCurves = newArray;\n    \n    return true;\n    }\n    */\n    /**\n     * Removes a path point inside the path.\n     *\n     * This function joins the bezier curve at the given index with\n     * its predecessor, which means that the start point at the given\n     * curve index will be removed.\n     *\n     * @method joinAt\n     * @param {number} curveIndex - The index of the curve to be joined with its predecessor.\n     * @instance\n     * @memberof BezierPath\n     * @return {boolean} True if the passed index indicated an inner vertex and the two curves were joined.\n     **/\n    /*\n    BezierPath.prototype.joinAt = function( curveIndex ) {\n\n    if( curveIndex < 0 || curveIndex >= this.bezierCurves.length )\n        return false;\n    \n    var leftCurve  = this.bezierCurves[ curveIndex-1 ];\n    var rightCurve = this.bezierCurves[ curveIndex ];\n\n    // Make the length of the new handle double that long\n    var leftControlPoint = leftCurve.getStartControlPoint().clone();\n    leftControlPoint.sub( leftCurve.getStartPoint() );\n    leftControlPoint.multiplyScalar( 2.0 );\n    leftControlPoint.add( leftCurve.getStartPoint() );\n    \n    var rightControlPoint = rightCurve.getEndControlPoint().clone();\n    rightControlPoint.sub( rightCurve.getEndPoint() );\n    rightControlPoint.multiplyScalar( 2.0 );\n    rightControlPoint.add( rightCurve.getEndPoint() );\n\n    var newCurve = new IKRS.CubicBezierCurve( leftCurve.getStartPoint(),\n                          rightCurve.getEndPoint(),\n                          leftControlPoint,\n                          rightControlPoint\n                        );\n    // Place into array\n    var newArray = [ this.bezierCurves.length - 1 ];\n\n    for( var i = 0; i < curveIndex-1; i++ )\n        newArray[ i ] = this.bezierCurves[i];\n    \n    newArray[ curveIndex-1 ] = newCurve;\n    \n    // Shift trailing curves left\n    for( var i = curveIndex; i+1 < this.bezierCurves.length; i++ )\n        newArray[ i ] = this.bezierCurves[ i+1 ];\n        \n    this.bezierCurves = newArray;\n    this.updateArcLengths();\n\n    return true;\n    }\n    */\n    /**\n     * Add a new inner curve point to the path.<br>\n     * <br>\n     * This function splits the bezier curve at the given index and given\n     * curve segment index.\n     *\n     * @method splitAt\n     * @param {number} curveIndex - The index of the curve to split.\n     * @param {nunber} segmentIndex - The index of the curve segment where the split should be performed.\n     * @instance\n     * @memberof BezierPath\n     * @return {boolean} True if the passed indices were valid and the path was split.\n     **/\n    /*\n    BezierPath.prototype.splitAt = function( curveIndex,\n                         segmentIndex\n                       ) {\n    // Must be a valid curve index\n    if( curveIndex < 0 || curveIndex >= this.bezierCurves.length )\n        return false;\n\n    var oldCurve = this.bezierCurves[ curveIndex ];\n\n    // Segment must be an INNER point!\n    // (the outer points are already bezier end/start points!)\n    if( segmentIndex < 1 || segmentIndex-1 >= oldCurve.segmentCache.length )\n        return false;\n\n    // Make room for a new curve\n    for( var c = this.bezierCurves.length; c > curveIndex; c-- ) {\n        // Move one position to the right\n        this.bezierCurves[ c ] = this.bezierCurves[ c-1 ];\n    }\n\n    // Accumulate segment lengths\n    var u = 0;\n    for( var i = 0; i < segmentIndex; i++ )\n        u += oldCurve.segmentLengths[i];\n    //var tangent = oldCurve.getTangentAt( u );\n    var tangent = oldCurve.getTangent( u );\n    tangent = tangent.multiplyScalar( 0.25 );\n\n    var leftEndControlPoint = oldCurve.segmentCache[ segmentIndex ].clone();\n    leftEndControlPoint.sub( tangent );\n    \n    var rightStartControlPoint = oldCurve.segmentCache[ segmentIndex ].clone();\n    rightStartControlPoint.add( tangent );\n    \n    // Make the old existing handles a quarter that long\n    var leftStartControlPoint = oldCurve.getStartControlPoint().clone();\n    // move to (0,0)\n    leftStartControlPoint.sub( oldCurve.getStartPoint() );\n    leftStartControlPoint.multiplyScalar( 0.25 );\n    leftStartControlPoint.add( oldCurve.getStartPoint() );\n\n    var rightEndControlPoint = oldCurve.getEndControlPoint().clone();\n    // move to (0,0)\n    rightEndControlPoint.sub( oldCurve.getEndPoint() );\n    rightEndControlPoint.multiplyScalar( 0.25 );\n    rightEndControlPoint.add( oldCurve.getEndPoint() );\n\n    var newLeft  = new CubicBezierCurve( oldCurve.getStartPoint(),                      // old start point\n                         oldCurve.segmentCache[ segmentIndex ],         // new end point\n                         leftStartControlPoint,                         // old start control point\n                         leftEndControlPoint                            // new end control point\n                       );\n    var newRight = new CubicBezierCurve( oldCurve.segmentCache[ segmentIndex ],         // new start point\n                         oldCurve.getEndPoint(),                        // old end point\n                         rightStartControlPoint,                        // new start control point\n                         rightEndControlPoint                           // old end control point\n                       );\n    \n    // Insert split curve(s) at free index\n    this.bezierCurves[ curveIndex ]     = newLeft;\n    this.bezierCurves[ curveIndex + 1 ] = newRight;\n    \n    // Update total arc length, even if there is only a very little change!\n    this.totalArcLength -= oldCurve.getLength();\n    this.totalArcLength += newLeft.getLength();\n    this.totalArcLength += newRight.getLength();\n\n    return true;\n    };\n    */\n    /*\n    insertVertexAt( t:number ) : void {\n    console.log('Inserting vertex at', t );\n    // Find the curve index\n    var u : number = 0;\n    var curveIndex : number = -1;\n    var localT : number = 0.0;\n    for( var i = 0; curveIndex == -1 && i < this.bezierCurves.length; i++ ) {\n        \n    }\n    }; */\n    /**\n     * Move the whole bezier path by the given (x,y)-amount.\n     *\n     * @method translate\n     * @param {Vertex} amount - The amount to be added (amount.x and amount.y)\n     *                          to each vertex of the curve.\n     * @instance\n     * @memberof BezierPath\n     * @return {BezierPath} this for chaining\n     **/\n    BezierPath.prototype.translate = function (amount) {\n        for (var i = 0; i < this.bezierCurves.length; i++) {\n            var curve = this.bezierCurves[i];\n            curve.getStartPoint().add(amount);\n            curve.getStartControlPoint().add(amount);\n            curve.getEndControlPoint().add(amount);\n        }\n        // Don't forget to translate the last curve's last point\n        var curve = this.bezierCurves[this.bezierCurves.length - 1];\n        curve.getEndPoint().add(amount);\n        this.updateArcLengths();\n        return this;\n    };\n    ;\n    /**\n     * Scale the whole bezier path by the given (x,y)-factors.\n     *\n     * @method scale\n     * @param {Vertex} anchor - The scale origin to scale from.\n     * @param {number} amount - The scalar to be multiplied with.\n     * @instance\n     * @memberof BezierPath\n     * @return {BezierPath} this for chaining.\n     **/\n    BezierPath.prototype.scale = function (anchor, scaling) {\n        for (var i = 0; i < this.bezierCurves.length; i++) {\n            var curve = this.bezierCurves[i];\n            curve.getStartPoint().scale(scaling, anchor);\n            curve.getStartControlPoint().scale(scaling, anchor);\n            curve.getEndControlPoint().scale(scaling, anchor);\n            // Do NOT scale the end point here!\n            // Don't forget that the curves are connected and on curve's end point\n            // the the successor's start point (same instance)!\n        }\n        // Finally move the last end point (was not scaled yet)\n        if (this.bezierCurves.length > 0 && !this.adjustCircular) {\n            this.bezierCurves[this.bezierCurves.length - 1].getEndPoint().scale(scaling, anchor);\n        }\n        this.updateArcLengths();\n        return this;\n    };\n    ;\n    /**\n     * Rotate the whole bezier path around a point..\n     *\n     * @method rotate\n     * @param {Vertex} angle  - The angle to rotate this path by.\n     * @param {Vertex} center - The rotation center.\n     * @instance\n     * @memberof BezierPath\n     * @return {void}\n     **/\n    BezierPath.prototype.rotate = function (angle, center) {\n        for (var i = 0; i < this.bezierCurves.length; i++) {\n            var curve = this.bezierCurves[i];\n            curve.getStartPoint().rotate(angle, center);\n            curve.getStartControlPoint().rotate(angle, center);\n            curve.getEndControlPoint().rotate(angle, center);\n            // Do NOT rotate the end point here!\n            // Don't forget that the curves are connected and on curve's end point\n            // the the successor's start point (same instance)!\n        }\n        // Finally move the last end point (was not scaled yet)\n        if (this.bezierCurves.length > 0 && !this.adjustCircular) {\n            this.bezierCurves[this.bezierCurves.length - 1].getEndPoint().rotate(angle, center);\n        }\n    };\n    ;\n    /**\n     * Get the 't' position on this curve with the minimal distance to point p.\n     *\n     * @param {Vertex} p - The point to find the closest curve point for.\n     * @return {number} A value t with 0.0 <= t <= 1.0.\n     **/\n    BezierPath.prototype.getClosestT = function (p) {\n        // Find the spline to extract the value from\n        var minIndex = -1;\n        var minDist = 0.0;\n        var dist = 0.0;\n        var curveT = 0.0;\n        var uMin = 0.0;\n        var u = 0.0;\n        for (var i = 0; i < this.bezierCurves.length; i++) {\n            curveT = this.bezierCurves[i].getClosestT(p);\n            dist = this.bezierCurves[i].getPointAt(curveT).distance(p);\n            if (minIndex == -1 || dist < minDist) {\n                minIndex = i;\n                minDist = dist;\n                uMin = u + curveT * this.bezierCurves[i].getLength();\n            }\n            u += this.bezierCurves[i].getLength();\n        }\n        return Math.max(0.0, Math.min(1.0, uMin / this.totalArcLength));\n    };\n    ;\n    /**\n     * Get the point on the bézier path at the given relative path location.\n     *\n     * @method getPoint\n     * @param {number} u - The relative path position: <pre>0 <= u <= this.getLength()</pre>\n     * @instance\n     * @memberof BezierPath\n     * @return {Vertex} The point at the relative path position.\n     **/\n    BezierPath.prototype.getPoint = function (u) {\n        if (u < 0 || u > this.totalArcLength) {\n            console.log(\"[BezierPath.getPoint(u)] u is out of bounds: \" + u + \".\");\n            u = Math.min(this.totalArcLength, Math.max(u, 0));\n        }\n        // Find the spline to extract the value from\n        var i = 0;\n        var uTemp = 0.0;\n        while (i < this.bezierCurves.length &&\n            (uTemp + this.bezierCurves[i].getLength()) < u) {\n            uTemp += this.bezierCurves[i].getLength();\n            i++;\n        }\n        // if u == arcLength\n        //   -> i is max\n        if (i >= this.bezierCurves.length)\n            return this.bezierCurves[this.bezierCurves.length - 1].getEndPoint().clone();\n        var bCurve = this.bezierCurves[i];\n        var relativeU = u - uTemp;\n        return bCurve.getPoint(relativeU);\n    };\n    ;\n    /**\n     * Get the point on the bézier path at the given path fraction.\n     *\n     * @method getPointAt\n     * @param {number} t - The absolute path position: <pre>0.0 <= t <= 1.0</pre>\n     * @instance\n     * @memberof BezierPath\n     * @return {Vertex} The point at the absolute path position.\n     **/\n    BezierPath.prototype.getPointAt = function (t) {\n        return this.getPoint(t * this.totalArcLength);\n    };\n    ;\n    /**\n     * Get the tangent of the bézier path at the given path fraction.<br>\n     * <br>\n     * Note that the returned vector is not normalized.\n     *\n     * @method getTangentAt\n     * @param {number} t - The absolute path position: <pre>0.0 <= t <= 1.0</pre>\n     * @instance\n     * @memberof BezierPath\n     * @return {Vertex} The tangent vector at the absolute path position.\n     **/\n    BezierPath.prototype.getTangentAt = function (t) {\n        return this.getTangent(t * this.totalArcLength);\n    };\n    ;\n    /**\n     *  Get the tangent of the bézier path at the given path location.<br>\n     * <br>\n     * Note that the returned vector is not normalized.\n     *\n     * @method getTangent\n     * @param {number} u - The relative path position: <pre>0 <= u <= getLength()</pre>\n     * @instance\n     * @memberof BezierPath\n     * @return {Vertex} The tangent vector at the relative path position.\n     **/\n    BezierPath.prototype.getTangent = function (u) {\n        if (u < 0 || u > this.totalArcLength) {\n            console.warn(\"[BezierPath.getTangent(u)] u is out of bounds: \" + u + \".\");\n            // return undefined;\n            u = Math.min(this.totalArcLength, Math.max(0, u));\n        }\n        // Find the spline to extract the value from\n        var i = 0;\n        var uTemp = 0.0;\n        while (i < this.bezierCurves.length &&\n            (uTemp + this.bezierCurves[i].getLength()) < u) {\n            uTemp += this.bezierCurves[i].getLength();\n            i++;\n        }\n        var bCurve = this.bezierCurves[i];\n        var relativeU = u - uTemp;\n        return bCurve.getTangent(relativeU);\n    };\n    ;\n    /**\n     * Get the perpendicular of the bézier path at the given absolute path location (fraction).<br>\n     * <br>\n     * Note that the returned vector is not normalized.\n     *\n     * @method getPerpendicularAt\n     * @param {number} t - The absolute path position: <pre>0.0 <= t <= 1.0</pre>\n     * @instance\n     * @memberof BezierPath\n     * @return {Vertex} The perpendicluar vector at the absolute path position.\n     **/\n    BezierPath.prototype.getPerpendicularAt = function (t) {\n        return this.getPerpendicular(t * this.totalArcLength);\n    };\n    ;\n    /**\n     * Get the perpendicular of the bézier path at the given relative path location.<br>\n     * <br>\n     * Note that the returned vector is not normalized.\n     *\n     * @method getPerpendicular\n     * @param {number} u - The relative path position: <pre>0 <= u <= getLength()</pre>\n     * @instance\n     * @memberof BezierPath\n     * @return {Vertex} The perpendicluar vector at the relative path position.\n     **/\n    BezierPath.prototype.getPerpendicular = function (u) {\n        if (u < 0 || u > this.totalArcLength) {\n            console.log(\"[BezierPath.getPerpendicular(u)] u is out of bounds: \" + u + \".\");\n            u = Math.min(this.totalArcLength, Math.max(0, u));\n        }\n        // Find the spline to extract the value from\n        var uResult = BezierPath._locateUIndex(this, u);\n        var bCurve = this.bezierCurves[uResult.i];\n        var relativeU = u - uResult.uPart;\n        return bCurve.getPerpendicular(relativeU);\n    };\n    ;\n    /**\n     * This is a helper function to locate the curve index for a given\n     * absolute path position u.\n     *\n     * I decided to put this into privat scope as it is really specific. Maybe\n     * put this into a utils wrapper.\n     *\n     * Returns:\n     * - {number} i - the index of the containing curve.\n     * - {number} uPart - the absolute curve length sum (length from the beginning to u, should equal u itself).\n     * - {number} uBefore - the absolute curve length for all segments _before_ the matched curve (usually uBefore <= uPart).\n     **/\n    BezierPath._locateUIndex = function (path, u) {\n        var i = 0;\n        var uTemp = 0.0;\n        var uBefore = 0.0;\n        while (i < path.bezierCurves.length &&\n            (uTemp + path.bezierCurves[i].getLength()) < u) {\n            uTemp += path.bezierCurves[i].getLength();\n            if (i + 1 < path.bezierCurves.length)\n                uBefore += path.bezierCurves[i].getLength();\n            i++;\n        }\n        return { i: i, uPart: uTemp, uBefore: uBefore };\n    };\n    ;\n    /**\n     * Get a specific sub path from this path. The start and end position are specified by\n     * ratio number in [0..1].\n     *\n     * 0.0 is at the beginning of the path.\n     * 1.0 is at the end of the path.\n     *\n     * Values below 0 or beyond 1 are cropped down to the [0..1] interval.\n     *\n     * startT > endT is allowed, the returned sub path will have inverse direction then.\n     *\n     * @method getSubPathAt\n     * @param {number} startT - The start position of the sub path.\n     * @param {number} endT - The end position of the sub path.\n     * @instance\n     * @memberof BezierPath\n     * @return {BezierPath} The desired sub path in the bounds [startT..endT].\n     **/\n    BezierPath.prototype.getSubPathAt = function (startT, endT) {\n        startT = Math.max(0, startT);\n        endT = Math.min(1.0, endT);\n        var startU = startT * this.totalArcLength;\n        var endU = endT * this.totalArcLength;\n        var uStartResult = BezierPath._locateUIndex(this, startU); // { i:int, uPart:float, uBefore:float }\n        var uEndResult = BezierPath._locateUIndex(this, endU); // { i:int, uPart:float, uBefore:float }\n        var firstT = (startU - uStartResult.uBefore) / this.bezierCurves[uStartResult.i].getLength();\n        if (uStartResult.i == uEndResult.i) {\n            // Subpath begins and ends in the same path segment (just get a simple sub curve from that path element).\n            var lastT = (endU - uEndResult.uBefore) / this.bezierCurves[uEndResult.i].getLength();\n            var firstCurve = this.bezierCurves[uStartResult.i].getSubCurveAt(firstT, lastT);\n            return BezierPath.fromArray([firstCurve]);\n        }\n        else {\n            var curves = [];\n            if (uStartResult.i > uEndResult.i) {\n                // Back to front direction\n                var firstCurve = this.bezierCurves[uStartResult.i].getSubCurveAt(firstT, 0.0);\n                curves.push(firstCurve);\n                for (var i = uStartResult.i - 1; i > uEndResult.i; i--) {\n                    curves.push(this.bezierCurves[i].clone().reverse());\n                }\n                var lastT = (endU - uEndResult.uBefore) / this.bezierCurves[uEndResult.i].getLength();\n                curves.push(this.bezierCurves[uEndResult.i].getSubCurveAt(1.0, lastT));\n            }\n            else {\n                // Front to back direction\n                var firstCurve = this.bezierCurves[uStartResult.i].getSubCurveAt(firstT, 1.0);\n                curves.push(firstCurve);\n                for (var i = uStartResult.i + 1; i < uEndResult.i && i < this.bezierCurves.length; i++) {\n                    curves.push(this.bezierCurves[i].clone());\n                }\n                var lastT = (endU - uEndResult.uBefore) / this.bezierCurves[uEndResult.i].getLength();\n                curves.push(this.bezierCurves[uEndResult.i].getSubCurveAt(0, lastT));\n            }\n            return BezierPath.fromArray(curves);\n        }\n    };\n    ;\n    /**\n     * This function moves the addressed curve point (or control point) with\n     * keeping up the path's curve integrity.<br>\n     * <br>\n     * Thus is done by moving neighbour- and control- points as needed.\n     *\n     * @method moveCurvePoint\n     * @param {number} curveIndex - The curve index to move a point from.\n     * @param {number} pointID - One of the curve's four point IDs (START_POINT,\n     *                           START_CONTROL_POINT, END_CONTRO_POINT or END_POINT).\n     * @param {XYCoords} moveAmount - The amount to move the addressed vertex by.\n     * @instance\n     * @memberof BezierPath\n     * @return {void}\n     **/\n    BezierPath.prototype.moveCurvePoint = function (curveIndex, pointID, moveAmount) {\n        var bCurve = this.getCurveAt(curveIndex);\n        bCurve.moveCurvePoint(pointID, moveAmount, true, // move control point, too\n        true // updateArcLengths\n        );\n        // If inner point and NOT control point\n        //  --> move neightbour\n        if (pointID == this.START_POINT && (curveIndex > 0 || this.adjustCircular)) {\n            // Set predecessor's control point!\n            var predecessor = this.getCurveAt(curveIndex - 1 < 0 ? this.bezierCurves.length + (curveIndex - 1) : curveIndex - 1);\n            predecessor.moveCurvePoint(this.END_CONTROL_POINT, moveAmount, true, // move control point, too\n            false // updateArcLengths\n            );\n        }\n        else if (pointID == this.END_POINT && (curveIndex + 1 < this.bezierCurves.length || this.adjustCircular)) {\n            // Set successcor\n            var successor = this.getCurveAt((curveIndex + 1) % this.bezierCurves.length);\n            successor.moveCurvePoint(this.START_CONTROL_POINT, moveAmount, true, // move control point, too\n            false // updateArcLengths\n            );\n        }\n        else if (pointID == this.START_CONTROL_POINT && curveIndex > 0) {\n            this.adjustPredecessorControlPoint(curveIndex, true, // obtain handle length?\n            false // update arc lengths\n            );\n        }\n        else if (pointID == this.END_CONTROL_POINT && curveIndex + 1 < this.getCurveCount()) {\n            this.adjustSuccessorControlPoint(curveIndex, true, // obtain handle length?\n            false // update arc lengths\n            );\n        }\n        // Don't forget to update the arc lengths!\n        // Note: this can be optimized as only two curves have changed their lengths!\n        this.updateArcLengths();\n    };\n    ;\n    /**\n     * This helper function adjusts the given point's predecessor's control point.\n     *\n     * @method adjustPredecessorControlPoint\n     * @param {number} curveIndex - The curve index to move a point from.\n     * @param {boolean} obtainHandleLength - Moves the point with keeping the original handle length.\n     * @param {boolean} updateArcLength - The amount to move the addressed vertex by.\n     * @instance\n     * @private\n     * @memberof BezierPath\n     * @return {void}\n     **/\n    BezierPath.prototype.adjustPredecessorControlPoint = function (curveIndex, obtainHandleLength, updateArcLengths) {\n        if (!this.adjustCircular && curveIndex <= 0)\n            return; // false;\n        var mainCurve = this.getCurveAt(curveIndex);\n        var neighbourCurve = this.getCurveAt(curveIndex - 1 < 0 ? this.getCurveCount() + (curveIndex - 1) : curveIndex - 1);\n        BezierPath.adjustNeighbourControlPoint(mainCurve, neighbourCurve, mainCurve.getStartPoint(), // the reference point\n        mainCurve.getStartControlPoint(), // the dragged control point\n        neighbourCurve.getEndPoint(), // the neighbour's point\n        neighbourCurve.getEndControlPoint(), // the neighbour's control point to adjust\n        obtainHandleLength, updateArcLengths);\n    };\n    ;\n    /**\n     * This helper function adjusts the given point's successor's control point.\n     *\n     * @method adjustSuccessorControlPoint\n     * @param {number} curveIndex - The curve index to move a point from.\n     * @param {boolean} obtainHandleLength - Moves the point with keeping the original handle length.\n     * @param {boolean} updateArcLength - The amount to move the addressed vertex by.\n     * @instance\n     * @private\n     * @memberof BezierPath\n     * @return {void}\n     **/\n    BezierPath.prototype.adjustSuccessorControlPoint = function (curveIndex, obtainHandleLength, updateArcLengths) {\n        if (!this.adjustCircular && curveIndex + 1 > this.getCurveCount())\n            return; //  false; \n        var mainCurve = this.getCurveAt(curveIndex);\n        var neighbourCurve = this.getCurveAt((curveIndex + 1) % this.getCurveCount());\n        /* return */ BezierPath.adjustNeighbourControlPoint(mainCurve, neighbourCurve, mainCurve.getEndPoint(), // the reference point\n        mainCurve.getEndControlPoint(), // the dragged control point\n        neighbourCurve.getStartPoint(), // the neighbour's point\n        neighbourCurve.getStartControlPoint(), // the neighbour's control point to adjust\n        obtainHandleLength, updateArcLengths);\n    };\n    ;\n    /**\n     * This helper function adjusts the given point's successor's control point.\n     *\n     * @method adjustNeighbourControlPoint\n     * @param {CubicBezierCurve} mainCurve\n     * @param {CubicBezierCurve} neighbourCurve\n     * @param {Vertex} mainPoint\n     * @param {Vertex} mainControlPoint\n     * @param {Vertex} neighbourPoint\n     * @param {Vertex} neighbourControlPoint\n     * @param {boolean} obtainHandleLengths\n     * @param {boolean} updateArcLengths\n     * @instance\n     * @private\n     * @memberof BezierPath\n     * @return {void}\n     **/\n    BezierPath.adjustNeighbourControlPoint = function (_mainCurve, // TODO: remove param\n    neighbourCurve, mainPoint, mainControlPoint, neighbourPoint, neighbourControlPoint, obtainHandleLengths, _updateArcLengths // TODO: remove param\n    ) {\n        // Calculate start handle length\n        var mainHandleBounds = new Vertex_1.Vertex(mainControlPoint.x - mainPoint.x, mainControlPoint.y - mainPoint.y);\n        var neighbourHandleBounds = new Vertex_1.Vertex(neighbourControlPoint.x - neighbourPoint.x, neighbourControlPoint.y - neighbourPoint.y);\n        var mainHandleLength = Math.sqrt(Math.pow(mainHandleBounds.x, 2) + Math.pow(mainHandleBounds.y, 2));\n        var neighbourHandleLength = Math.sqrt(Math.pow(neighbourHandleBounds.x, 2) + Math.pow(neighbourHandleBounds.y, 2));\n        if (mainHandleLength <= 0.1)\n            return; // no secure length available for division? What about zoom? Use EPSILON?\t\n        // Just invert the main handle (keep length or not?\n        if (obtainHandleLengths) {\n            neighbourControlPoint.set(neighbourPoint.x - mainHandleBounds.x * (neighbourHandleLength / mainHandleLength), neighbourPoint.y - mainHandleBounds.y * (neighbourHandleLength / mainHandleLength));\n        }\n        else {\n            neighbourControlPoint.set(neighbourPoint.x - mainHandleBounds.x, neighbourPoint.y - mainHandleBounds.y);\n        }\n        neighbourCurve.updateArcLengths();\n    };\n    ;\n    /**\n     * Get the bounds of this Bézier path.\n     *\n     * Note the the curves' underlyung segment buffers are used to determine the bounds. The more\n     * elements the segment buffers have, the more precise the returned bounds will be.\n     *\n     * @return {Bounds} The bounds of this Bézier path.\n     **/\n    BezierPath.prototype.getBounds = function () {\n        var min = new Vertex_1.Vertex(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY);\n        var max = new Vertex_1.Vertex(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY);\n        var b;\n        for (var i = 0; i < this.bezierCurves.length; i++) {\n            b = this.bezierCurves[i].getBounds();\n            min.x = Math.min(min.x, b.min.x);\n            min.y = Math.min(min.y, b.min.y);\n            max.x = Math.max(max.x, b.max.x);\n            max.y = Math.max(max.y, b.max.y);\n        }\n        return new Bounds_1.Bounds(min, max);\n    };\n    ;\n    /**\n     * Clone this BezierPath (deep clone).\n     *\n     * @method clone\n     * @instance\n     * @memberof BezierPath\n     * @return {BezierPath}\n     **/\n    BezierPath.prototype.clone = function () {\n        var path = new BezierPath(undefined);\n        for (var i = 0; i < this.bezierCurves.length; i++) {\n            path.bezierCurves.push(this.bezierCurves[i].clone());\n            // Connect splines\n            if (i > 0)\n                path.bezierCurves[i - 1].endPoint = path.bezierCurves[i].startPoint;\n        }\n        path.updateArcLengths();\n        path.adjustCircular = this.adjustCircular;\n        return path;\n    };\n    ;\n    /**\n     * Compare this and the passed Bézier path.\n     *\n     * @method equals\n     * @param {BezierPath} path - The pass to compare with.\n     * @instance\n     * @memberof BezierPath\n     * @return {boolean}\n     **/\n    BezierPath.prototype.equals = function (path) {\n        if (!path)\n            return false;\n        // Check if path contains the credentials\n        if (!path.bezierCurves)\n            return false;\n        if (typeof path.bezierCurves.length == \"undefined\")\n            return false;\n        if (path.bezierCurves.length != this.bezierCurves.length)\n            return false;\n        for (var i = 0; i < this.bezierCurves.length; i++) {\n            if (!this.bezierCurves[i].equals(path.bezierCurves[i]))\n                return false;\n        }\n        return true;\n    };\n    ;\n    /**\n     * Create a <pre>&lt;path&gt;</pre> SVG representation of this bézier curve.\n     *\n     * @deprecated DEPRECATION Please use the drawutilssvg library and an XMLSerializer instead.\n     * @method toSVGString\n     * @param {object=} [options={}] - Like options.className\n     * @param {string=} [options.className] - The classname to use for the SVG item.\n     * @instance\n     * @memberof BezierPath\n     * @return {string} The SVG string.\n     **/\n    BezierPath.prototype.toSVGString = function (options) {\n        options = options || {};\n        var buffer = [];\n        buffer.push('<path');\n        if (options.className)\n            buffer.push(' class=\"' + options.className + '\"');\n        buffer.push(' d=\"');\n        for (var c = 0; c < this.bezierCurves.length; c++) {\n            if (c > 0)\n                buffer.push(' ');\n            buffer.push(this.bezierCurves[c].toSVGPathData());\n        }\n        buffer.push('\" />');\n        return buffer.join('');\n    };\n    ;\n    /**\n     * Create a JSON string representation of this bézier curve.\n     *\n     * @method toJSON\n     * @param {boolean} prettyFormat - If true then the function will add line breaks.\n     * @instance\n     * @memberof BezierPath\n     * @return {string} The JSON string.\n     **/\n    BezierPath.prototype.toJSON = function (prettyFormat) {\n        var buffer = [];\n        buffer.push(\"[\"); // array begin\n        for (var i = 0; i < this.bezierCurves.length; i++) {\n            if (i > 0)\n                buffer.push(\",\");\n            if (prettyFormat)\n                buffer.push(\"\\n\\t\");\n            else\n                buffer.push(\" \");\n            buffer.push(this.bezierCurves[i].toJSON(prettyFormat));\n        }\n        if (this.bezierCurves.length != 0)\n            buffer.push(\" \");\n        buffer.push(\"]\"); // array end\n        return buffer.join(\"\"); // Convert to string, with empty separator.\n    };\n    ;\n    /**\n     * Parse a BezierPath from the given JSON string.\n     *\n     * @method fromJSON\n     * @param {string} jsonString - The string with the JSON data.\n     * @throw An error if the string is not JSON or does not contain a bezier path object.\n     * @static\n     * @memberof BezierPath\n     * @return {BezierPath} The parsed bezier path instance.\n     **/\n    BezierPath.fromJSON = function (jsonString) {\n        var obj = JSON.parse(jsonString);\n        return BezierPath.fromArray(obj);\n    };\n    ;\n    /**\n     * Create a BezierPath instance from the given array.\n     *\n     * @method fromArray\n     * @param {Vertex[][]} arr - A two-dimensional array containing the bezier path vertices.\n     * @throw An error if the array does not contain proper bezier path data.\n     * @static\n     * @memberof BezierPath\n     * @return {BezierPath} The bezier path instance retrieved from the array data.\n     **/\n    BezierPath.fromArray = function (obj) {\n        if (!Array.isArray(obj))\n            throw \"[BezierPath.fromArray] Passed object must be an array.\";\n        var arr = obj; // FORCE?\n        if (arr.length < 1)\n            throw \"[BezierPath.fromArray] Passed array must contain at least one bezier curve (has \" + arr.length + \").\";\n        // Create an empty bezier path\n        var bPath = new BezierPath(undefined);\n        var lastCurve = null;\n        for (var i = 0; i < arr.length; i++) {\n            // Convert object (or array?) to bezier curve\n            var bCurve;\n            if (CubicBezierCurve_1.CubicBezierCurve.isInstance(arr[i])) {\n                bCurve = arr[i].clone();\n            }\n            else if (0 in arr[i] && 1 in arr[i] && 2 in arr[i] && 3 in arr[i]) {\n                if (!arr[i][0] || !arr[i][1] || !arr[i][2] || !arr[i][3])\n                    throw \"Cannot convert path data to BezierPath instance. At least one element is undefined (index=\" + i + \"): \" + arr[i];\n                bCurve = CubicBezierCurve_1.CubicBezierCurve.fromArray(arr[i]);\n            }\n            else {\n                bCurve = CubicBezierCurve_1.CubicBezierCurve.fromObject(arr[i]);\n            }\n            // Set curve start point?\n            // (avoid duplicate point instances!)\n            if (lastCurve)\n                bCurve.startPoint = lastCurve.endPoint;\n            // Add to path's internal list\n            bPath.bezierCurves.push(bCurve);\n            // bPath.totalArcLength += bCurve.getLength(); \t    \n            lastCurve = bCurve;\n        }\n        bPath.updateArcLengths();\n        // Bezier segments added. Done\n        return bPath;\n    };\n    ;\n    /**\n     * This function converts the bezier path into a string containing\n     * integer values only.\n     * The points' float values are rounded to 1 digit after the comma.\n     *\n     * The returned string represents a JSON array (with leading '[' and\n     * trailing ']', the separator is ',').\n     *\n     * @method toReducedListRepresentation\n     * @param {number} digits - The number of digits to be used after the comma '.'.\n     * @instance\n     * @memberof BezierPath\n     * @return {string} The reduced list representation of this path.\n     **/\n    BezierPath.prototype.toReducedListRepresentation = function (digits) {\n        if (typeof digits == \"undefined\")\n            digits = 1;\n        var buffer = [];\n        buffer.push(\"[\"); // array begin\n        for (var i = 0; i < this.bezierCurves.length; i++) {\n            var curve = this.bezierCurves[i];\n            buffer.push(curve.getStartPoint().x.toFixed(digits));\n            buffer.push(\",\");\n            buffer.push(curve.getStartPoint().y.toFixed(digits));\n            buffer.push(\",\");\n            buffer.push(curve.getStartControlPoint().x.toFixed(digits));\n            buffer.push(\",\");\n            buffer.push(curve.getStartControlPoint().y.toFixed(digits));\n            buffer.push(\",\");\n            buffer.push(curve.getEndControlPoint().x.toFixed(digits));\n            buffer.push(\",\");\n            buffer.push(curve.getEndControlPoint().y.toFixed(digits));\n            buffer.push(\",\");\n        }\n        if (this.bezierCurves.length != 0) {\n            var curve = this.bezierCurves[this.bezierCurves.length - 1];\n            buffer.push(curve.getEndPoint().x.toFixed(digits));\n            buffer.push(\",\");\n            buffer.push(curve.getEndPoint().y.toFixed(digits));\n        }\n        buffer.push(\"]\"); // array end\n        return buffer.join(\"\"); // Convert to string, with empty separator.\n    };\n    ;\n    /**\n     * Parse a BezierPath instance from the reduced list representation.<br>\n     * <br>\n     * The passed string must represent a JSON array containing numbers only.\n     *\n     * @method fromReducedListRepresentation\n     * @param {string} listJSON - The number of digits to be used after the floating point.\n     * @throw An error if the string is malformed.\n     * @instance\n     * @memberof BezierPath\n     * @return {BezierPath} The bezier path instance retrieved from the string.\n     **/\n    BezierPath.fromReducedListRepresentation = function (listJSON) {\n        // Parse the array\n        var pointArray = JSON.parse(listJSON);\n        if (!pointArray.length) {\n            console.log(\"Cannot parse bezier path from non-array object nor from empty point list.\");\n            throw \"Cannot parse bezier path from non-array object nor from empty point list.\";\n        }\n        if (pointArray.length < 8) {\n            console.log(\"Cannot build bezier path. The passed array must contain at least 8 elements (numbers).\");\n            throw \"Cannot build bezier path. The passed array must contain at least 8 elements (numbers).\";\n        }\n        // Convert to object\n        var bezierPath = new BezierPath(null); // No points yet\n        var startPoint;\n        var startControlPoint;\n        var endControlPoint;\n        var endPoint;\n        var i = 0;\n        do {\n            //if( i == 0 )\n            startPoint = new Vertex_1.Vertex(pointArray[i], pointArray[i + 1]);\n            startControlPoint = new Vertex_1.Vertex(pointArray[i + 2], pointArray[i + 3]);\n            endControlPoint = new Vertex_1.Vertex(pointArray[i + 4], pointArray[i + 5]);\n            endPoint = new Vertex_1.Vertex(pointArray[i + 6], pointArray[i + 7]);\n            var bCurve = new CubicBezierCurve_1.CubicBezierCurve(startPoint, endPoint, startControlPoint, endControlPoint);\n            bezierPath.bezierCurves.push(bCurve);\n            startPoint = endPoint;\n            i += 6;\n        } while (i + 2 < pointArray.length);\n        bezierPath.updateArcLengths();\n        return bezierPath;\n    };\n    ;\n    // +---------------------------------------------------------------------------------\n    // | These constants equal the values from CubicBezierCurve.\n    // +-------------------------------\n    /** @constant {number} */\n    BezierPath.START_POINT = 0;\n    /** @constant {number} */\n    BezierPath.START_CONTROL_POINT = 1;\n    /** @constant {number} */\n    BezierPath.END_CONTROL_POINT = 2;\n    /** @constant {number} */\n    BezierPath.END_POINT = 3;\n    return BezierPath;\n}());\nexports.BezierPath = BezierPath;\n//# sourceMappingURL=BezierPath.js.map","\"use strict\";\n/**\n * @author   Ikaros Kappler\n * @date     2020-05-11\n * @modified 2020-10-30 Added the static computeFromVertices function.\n * @modified 2020-11-19 Set min, max, width and height to private.\n * @modified 2021-02-02 Added the `toPolygon` method.\n * @version  1.2.0\n **/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Bounds = void 0;\nvar Polygon_1 = require(\"./Polygon\");\nvar Vertex_1 = require(\"./Vertex\");\n/**\n * @classdesc A bounds class with min and max values. Implementing IBounds.\n *\n * @requires XYCoords\n * @requires Vertex\n * @requires IBounds\n **/\nvar Bounds = /** @class */ (function () {\n    /**\n     * The constructor.\n     *\n     * @constructor\n     * @name Bounds\n     * @param {XYCoords} min - The min values (x,y) as a XYCoords tuple.\n     * @param {XYCoords} max - The max values (x,y) as a XYCoords tuple.\n     **/\n    function Bounds(min, max) {\n        this.min = min;\n        this.max = max;\n        this.width = max.x - min.x;\n        this.height = max.y - min.y;\n    }\n    ;\n    /**\n     * Convert this rectangular bounding box to a polygon with four vertices.\n     *\n     * @method toPolygon\n     * @instance\n     * @memberof Bounds\n     * @return {Polygon} This bound rectangle as a polygon.\n     */\n    Bounds.prototype.toPolygon = function () {\n        return new Polygon_1.Polygon([\n            new Vertex_1.Vertex(this.min),\n            new Vertex_1.Vertex(this.max.x, this.min.y),\n            new Vertex_1.Vertex(this.max),\n            new Vertex_1.Vertex(this.min.x, this.max.y)\n        ], false);\n    };\n    ;\n    /**\n     * Compute the minimal bounding box for a given set of vertices.\n     *\n     * An empty vertex array will return an empty bounding box located at (0,0).\n     *\n     * @static\n     * @method computeFromVertices\n     * @memberof Bounds\n     * @param {Array<Vertex>} vertices - The set of vertices you want to get the bounding box for.\n     * @return The minimal Bounds for the given vertices.\n     **/\n    Bounds.computeFromVertices = function (vertices) {\n        if (vertices.length == 0)\n            return new Bounds(new Vertex_1.Vertex(0, 0), new Vertex_1.Vertex(0, 0));\n        var xMin = vertices[0].x;\n        var xMax = vertices[0].x;\n        var yMin = vertices[0].y;\n        var yMax = vertices[0].y;\n        var vert;\n        for (var i in vertices) {\n            vert = vertices[i];\n            xMin = Math.min(xMin, vert.x);\n            xMax = Math.max(xMax, vert.x);\n            yMin = Math.min(yMin, vert.y);\n            yMax = Math.max(yMax, vert.y);\n        }\n        return new Bounds(new Vertex_1.Vertex(xMin, yMin), new Vertex_1.Vertex(xMax, yMax));\n    };\n    ;\n    return Bounds;\n}()); // END class bounds\nexports.Bounds = Bounds;\n//# sourceMappingURL=Bounds.js.map","\"use strict\";\n/**\n * @author   Ikaros Kappler\n * @date     2020-05-04\n * @modified 2020-05-09 Ported to typescript.\n * @modified 2020-05-25 Added the vertAt and tangentAt functions.\n * @mofidied 2020-09-07 Added the circleIntersection(Circle) function.\n * @modified 2020-09-07 Changed the vertAt function by switching sin and cos! The old version did not return the correct vertex (by angle) accoring to the assumed circle math.\n * @modified 2020-10-16 Added the containsCircle(...) function.\n * @modified 2021-01-20 Added UID.\n * @version  1.2.0\n **/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Circle = void 0;\nvar Line_1 = require(\"./Line\");\nvar UIDGenerator_1 = require(\"./UIDGenerator\");\nvar Vector_1 = require(\"./Vector\");\nvar Vertex_1 = require(\"./Vertex\");\n/**\n * @classdesc A simple circle: center point and radius.\n *\n * @requires Line\n * @requires Vector\n * @requires VertTuple\n * @requires Vertex\n * @requires SVGSerializale\n * @requires UID\n * @requires UIDGenerator\n **/\nvar Circle = /** @class */ (function () {\n    /**\n     * Create a new circle with given center point and radius.\n     *\n     * @constructor\n     * @name Circle\n     * @param {Vertex} center - The center point of the circle.\n     * @param {number} radius - The radius of the circle.\n     */\n    function Circle(center, radius) {\n        /**\n         * Required to generate proper CSS classes and other class related IDs.\n         **/\n        this.className = \"Circle\";\n        this.uid = UIDGenerator_1.UIDGenerator.next();\n        this.center = center;\n        this.radius = radius;\n    }\n    ;\n    /**\n     * Check if the given circle is fully contained inside this circle.\n     *\n     * @method containsCircle\n     * @param {Circle} circle - The circle to check if it is contained in this circle.\n     * @instance\n     * @memberof Circle\n     * @return {boolean} `true` if any only if the given circle is completely inside this circle.\n     */\n    Circle.prototype.containsCircle = function (circle) {\n        return this.center.distance(circle.center) + circle.radius < this.radius;\n    };\n    ;\n    /**\n     * Calculate the distance from this circle to the given line.\n     *\n     * * If the line does not intersect this ciecle then the returned\n     *   value will be the minimal distance.\n     * * If the line goes through this circle then the returned value\n     *   will be max inner distance and it will be negative.\n     *\n     * @method lineDistance\n     * @param {Line} line - The line to measure the distance to.\n     * @return {number} The minimal distance from the outline of this circle to the given line.\n     * @instance\n     * @memberof Circle\n     */\n    Circle.prototype.lineDistance = function (line) {\n        var closestPointOnLine = line.getClosestPoint(this.center);\n        return closestPointOnLine.distance(this.center) - this.radius;\n    };\n    ;\n    /**\n     * Get the vertex on the this circle for the given angle.\n     *\n     * @method vertAt\n     * @param {number} angle - The angle (in radians) to use.\n     * @return {Vertex} The vertex (point) at the given angle.\n     * @instance\n     * @memberof Circle\n     **/\n    Circle.prototype.vertAt = function (angle) {\n        // Find the point on the circle respective the angle. Then move relative to center.\n        return Circle.circleUtils.vertAt(angle, this.radius).add(this.center);\n    };\n    ;\n    /**\n     * Get a tangent line of this circle for a given angle.\n     *\n     * Point a of the returned line is located on the circle, the length equals the radius.\n     *\n     * @method tangentAt\n     * @instance\n     * @param {number} angle - The angle (in radians) to use.\n     * @return {Line} The tangent line.\n     * @memberof Circle\n     **/\n    Circle.prototype.tangentAt = function (angle) {\n        var pointA = Circle.circleUtils.vertAt(angle, this.radius);\n        // Construct the perpendicular of the line in point a. Then move relative to center.\n        return new Vector_1.Vector(pointA, new Vertex_1.Vertex(0, 0)).add(this.center).perp();\n    };\n    ;\n    /**\n     * Calculate the intersection points (if exists) with the given circle.\n     *\n     * @method circleIntersection\n     * @instance\n     * @memberof Circle\n     * @param {Circle} circle\n     * @return {Line|null} The intersection points (as a line) or null if the two circles do not intersect.\n     **/\n    Circle.prototype.circleIntersection = function (circle) {\n        // Circles do not intersect at all?\n        if (this.center.distance(circle.center) > this.radius + circle.radius) {\n            return null;\n        }\n        // One circle is fully inside the other?\n        if (this.center.distance(circle.center) < Math.abs(this.radius - circle.radius)) {\n            return null;\n        }\n        // Based on the C++ implementation by Robert King\n        //    https://stackoverflow.com/questions/3349125/circle-circle-intersection-points\n        // and the 'Circles and spheres' article by Paul Bourke.\n        //    http://paulbourke.net/geometry/circlesphere/\n        //\n        // This is the original C++ implementation:\n        //\n        // pair<Point, Point> intersections(Circle c) {\n        //    Point P0(x, y);\n        //    Point P1(c.x, c.y);\n        //    float d, a, h;\n        //    d = P0.distance(P1);\n        //    a = (r*r - c.r*c.r + d*d)/(2*d);\n        //    h = sqrt(r*r - a*a);\n        //    Point P2 = P1.sub(P0).scale(a/d).add(P0);\n        //    float x3, y3, x4, y4;\n        //    x3 = P2.x + h*(P1.y - P0.y)/d;\n        //    y3 = P2.y - h*(P1.x - P0.x)/d;\n        //    x4 = P2.x - h*(P1.y - P0.y)/d;\n        //    y4 = P2.y + h*(P1.x - P0.x)/d;\n        //    return pair<Point, Point>(Point(x3, y3), Point(x4, y4));\n        // } \n        var p0 = this.center;\n        var p1 = circle.center;\n        var d = p0.distance(p1);\n        var a = (this.radius * this.radius - circle.radius * circle.radius + d * d) / (2 * d);\n        var h = Math.sqrt(this.radius * this.radius - a * a);\n        var p2 = p1.clone().scale(a / d, p0);\n        var x3 = p2.x + h * (p1.y - p0.y) / d;\n        var y3 = p2.y - h * (p1.x - p0.x) / d;\n        var x4 = p2.x - h * (p1.y - p0.y) / d;\n        var y4 = p2.y + h * (p1.x - p0.x) / d;\n        return new Line_1.Line(new Vertex_1.Vertex(x3, y3), new Vertex_1.Vertex(x4, y4));\n    };\n    ;\n    /**\n      * Create an SVG representation of this circle.\n      *\n      * @deprecated DEPRECATION Please use the drawutilssvg library and an XMLSerializer instead.\n      * @method toSVGString\n      * @param {object=} options - An optional set of options, like 'className'.\n      * @return {string} A string representing the SVG code for this vertex.\n      * @instance\n      * @memberof Circle\n      */\n    Circle.prototype.toSVGString = function (options) {\n        options = options || {};\n        var buffer = [];\n        buffer.push('<circle');\n        if (options.className)\n            buffer.push(' class=\"' + options.className + '\"');\n        buffer.push(' cx=\"' + this.center.x + '\"');\n        buffer.push(' cy=\"' + this.center.y + '\"');\n        buffer.push(' r=\"' + this.radius + '\"');\n        buffer.push(' />');\n        return buffer.join('');\n    };\n    ;\n    Circle.circleUtils = {\n        vertAt: function (angle, radius) {\n            /* return new Vertex( Math.sin(angle) * radius,\n                       Math.cos(angle) * radius ); */\n            return new Vertex_1.Vertex(Math.cos(angle) * radius, Math.sin(angle) * radius);\n        }\n    };\n    return Circle;\n}()); // END class\nexports.Circle = Circle;\n//# sourceMappingURL=Circle.js.map","\"use strict\";\n/**\n * @author   Ikaros Kappler\n * @date     2020-12-17\n * @modified 2021-01-20 Added UID.\n * @version  1.1.0\n **/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CircleSector = void 0;\nvar UIDGenerator_1 = require(\"./UIDGenerator\");\n/**\n * @classdesc A simple circle sector: circle, start- and end-angle.\n *\n * @requires Line\n * @requires SVGSerializale\n * @requires UID\n * @requires UIDGenerator\n * @requires XYCoords\n **/\nvar CircleSector = /** @class */ (function () {\n    /**\n     * Create a new circle sector with given circle, start- and end-angle.\n     *\n     * @constructor\n     * @name CircleSector\n     * @param {Circle} circle - The circle.\n     * @param {number} startAngle - The start angle of the sector.\n     * @param {number} endAngle - The end angle of the sector.\n     */\n    function CircleSector(circle, startAngle, endAngle) {\n        /**\n         * Required to generate proper CSS classes and other class related IDs.\n         **/\n        this.className = \"CircleSector\";\n        this.uid = UIDGenerator_1.UIDGenerator.next();\n        this.circle = circle;\n        this.startAngle = startAngle;\n        this.endAngle = endAngle;\n    }\n    ;\n    /**\n      * Create an SVG representation of this circle.\n      *\n      * @method toSVGString\n      * @param {object=} options - An optional set of options, like 'className'.\n      * @return {string} A string representing the SVG code for this vertex.\n      * @instance\n      * @memberof Circle\n      */\n    CircleSector.prototype.toSVGString = function (options) {\n        options = options || {};\n        var buffer = [];\n        buffer.push('<path ');\n        if (options.className)\n            buffer.push(' class=\"' + options.className + '\"');\n        var data = CircleSector.circleSectorUtils.describeSVGArc(this.circle.center.x, this.circle.center.y, this.circle.radius, this.startAngle, this.endAngle);\n        buffer.push(' d=\"' + data.join(\" \") + '\" />');\n        return buffer.join('');\n    };\n    ;\n    CircleSector.circleSectorUtils = {\n        /**\n         * Helper function to convert polar circle coordinates to cartesian coordinates.\n         *\n         * TODO: generalize for ellipses (two radii).\n         *\n         * @param {number} angle - The angle in radians.\n        */\n        polarToCartesian: function (centerX, centerY, radius, angle) {\n            return {\n                x: centerX + (radius * Math.cos(angle)),\n                y: centerY + (radius * Math.sin(angle))\n            };\n        },\n        /**\n         * Helper function to convert a circle section as SVG arc params (for the `d` attribute).\n         * Found at: https://stackoverflow.com/questions/5736398/how-to-calculate-the-svg-path-for-an-arc-of-a-circle\n         *\n         * TODO: generalize for ellipses (two radii).\n         *\n         * @param {boolean} options.moveToStart - If false (default=true) the initial 'Move' command will not be used.\n         * @return [ 'A', radiusx, radiusy, rotation=0, largeArcFlag=1|0, sweepFlag=0, endx, endy ]\n         */\n        describeSVGArc: function (x, y, radius, startAngle, endAngle, options) {\n            if (typeof options === 'undefined')\n                options = { moveToStart: true };\n            var end = CircleSector.circleSectorUtils.polarToCartesian(x, y, radius, endAngle);\n            var start = CircleSector.circleSectorUtils.polarToCartesian(x, y, radius, startAngle);\n            // Split full circles into two halves.\n            // Some browsers have problems to render full circles (described by start==end).\n            if (Math.PI * 2 - Math.abs(startAngle - endAngle) < 0.001) {\n                var firstHalf = CircleSector.circleSectorUtils.describeSVGArc(x, y, radius, startAngle, startAngle + (endAngle - startAngle) / 2, options);\n                var secondHalf = CircleSector.circleSectorUtils.describeSVGArc(x, y, radius, startAngle + (endAngle - startAngle) / 2, endAngle, options);\n                return firstHalf.concat(secondHalf);\n            }\n            // Boolean stored as integers (0|1).\n            var largeArcFlag = endAngle - startAngle <= Math.PI ? 0 : 1;\n            var sweepFlag = 1;\n            var pathData = [];\n            if (options.moveToStart) {\n                pathData.push('M', start.x, start.y);\n            }\n            pathData.push(\"A\", radius, radius, 0, largeArcFlag, sweepFlag, end.x, end.y);\n            return pathData;\n        }\n    };\n    return CircleSector;\n}()); // END class\nexports.CircleSector = CircleSector;\n//# sourceMappingURL=CircleSector.js.map","\"use strict\";\n/**\n * @author   Ikaros Kappler\n * @date     2013-08-15\n * @modified 2018-08-16 Added a closure. Removed the wrapper class 'IKRS'. Replaced class THREE.Vector2 by Vertex class.\n * @modified 2018-11-19 Added the fromArray(Array) function.\n * @modified 2018-11-28 Added the locateCurveByPoint(Vertex) function.\n * @modified 2018-12-04 Added the toSVGPathData() function.\n * @modified 2019-03-20 Added JSDoc tags.\n * @modified 2019-03-23 Changed the signatures of getPoint, getPointAt and getTangent (!version 2.0).\n * @modified 2019-12-02 Fixed the updateArcLength function. It used the wrong pointAt function (was renamed before).\n * @modified 2020-02-06 Added the getSubCurveAt(number,number) function.\n * @modified 2020-02-06 Fixed a serious bug in the arc lenght calculation (length was never reset, urgh).\n * @modified 2020-02-07 Added the isInstance(any) function.\n * @modified 2020-02-10 Added the reverse() function.\n * @modified 2020-02-10 Fixed the translate(...) function (returning 'this' was missing).\n * @modified 2020-03-24 Ported this class from vanilla JS to Typescript.\n * @modified 2020-06-03 Added the getBounds() function.\n * @modified 2020-07-14 Changed the moveCurvePoint(...,Vertex) to moveCurvePoint(...,XYCoords), which is more generic.\n * @modified 2020-07-24 Added the getClosestT function and the helper function locateIntervalByDistance(...).\n * @modified 2021-01-20 Added UID.\n * @version 2.5.0\n *\n * @file CubicBezierCurve\n * @public\n **/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CubicBezierCurve = void 0;\nvar Bounds_1 = require(\"./Bounds\");\nvar UIDGenerator_1 = require(\"./UIDGenerator\");\nvar Vertex_1 = require(\"./Vertex\");\nvar Vector_1 = require(\"./Vector\");\n/**\n * @classdesc A refactored cubic bezier curve class.\n *\n * @requires Bounds\n * @requires Vertex\n * @requires Vector\n * @requires XYCoords\n * @requires UID\n * @requires UIDGenerator\n */\nvar CubicBezierCurve = /** @class */ (function () {\n    /**\n     * The constructor.\n     *\n     * @constructor\n     * @name CubicBezierCurve\n     * @param {Vertex} startPoint - The Bézier curve's start point.\n     * @param {Vertex} endPoint   - The Bézier curve's end point.\n     * @param {Vertex} startControlPoint - The Bézier curve's start control point.\n     * @param {Vertex} endControlPoint   - The Bézier curve's end control point.\n     **/\n    function CubicBezierCurve(startPoint, endPoint, startControlPoint, endControlPoint) {\n        /** @constant {number} */\n        this.START_POINT = CubicBezierCurve.START_POINT;\n        /** @constant {number} */\n        this.START_CONTROL_POINT = CubicBezierCurve.START_CONTROL_POINT;\n        /** @constant {number} */\n        this.END_CONTROL_POINT = CubicBezierCurve.END_CONTROL_POINT;\n        /** @constant {number} */\n        this.END_POINT = CubicBezierCurve.END_POINT;\n        this.uid = UIDGenerator_1.UIDGenerator.next();\n        this.startPoint = startPoint;\n        this.startControlPoint = startControlPoint;\n        this.endPoint = endPoint;\n        this.endControlPoint = endControlPoint;\n        this.curveIntervals = 30;\n        // An array of vertices\n        this.segmentCache = [];\n        // An array of floats\n        this.segmentLengths = [];\n        // float\n        this.arcLength = null;\n        this.updateArcLengths();\n    }\n    ;\n    /**\n     * Move the given curve point (the start point, end point or one of the two\n     * control points).\n     *\n     * @method moveCurvePoint\n     * @param {number} pointID - The numeric identicator of the point to move. Use one of the four eBezierPoint constants.\n     * @param {XYCoords} moveAmount - The amount to move the specified point by.\n     * @param {boolean} moveControlPoint - Move the control points along with their path point (if specified point is a path point).\n     * @param {boolean} updateArcLengths - Specifiy if the internal arc segment buffer should be updated.\n     * @instance\n     * @memberof CubicBezierCurve\n     * @return {void}\n     **/\n    CubicBezierCurve.prototype.moveCurvePoint = function (pointID, moveAmount, moveControlPoint, updateArcLengths) {\n        if (pointID == this.START_POINT) {\n            this.getStartPoint().add(moveAmount);\n            if (moveControlPoint)\n                this.getStartControlPoint().add(moveAmount);\n        }\n        else if (pointID == this.START_CONTROL_POINT) {\n            this.getStartControlPoint().add(moveAmount);\n        }\n        else if (pointID == this.END_CONTROL_POINT) {\n            this.getEndControlPoint().add(moveAmount);\n        }\n        else if (pointID == this.END_POINT) {\n            this.getEndPoint().add(moveAmount);\n            if (moveControlPoint)\n                this.getEndControlPoint().add(moveAmount);\n        }\n        else {\n            console.log(\"[CubicBezierCurve.moveCurvePoint] pointID '\" + pointID + \"' invalid.\");\n        }\n        if (updateArcLengths)\n            this.updateArcLengths();\n    };\n    ;\n    /**\n     * Translate the whole curve by the given {x,y} amount: moves all four points.\n     *\n     * @method translate\n     * @param {Vertex} amount - The amount to translate this curve by.\n     * @instance\n     * @memberof CubicBezierCurve\n     * @return {CubicBezierCurve} this (for chaining).\n     **/\n    CubicBezierCurve.prototype.translate = function (amount) {\n        this.startPoint.add(amount);\n        this.startControlPoint.add(amount);\n        this.endControlPoint.add(amount);\n        this.endPoint.add(amount);\n        return this;\n    };\n    ;\n    /**\n     * Reverse this curve, means swapping start- and end-point and swapping\n     * start-control- and end-control-point.\n     *\n     * @method reverse\n     * @instance\n     * @memberof CubicBezierCurve\n     * @return {CubicBezierCurve} this (for chaining).\n     **/\n    CubicBezierCurve.prototype.reverse = function () {\n        var tmp = this.startPoint;\n        this.startPoint = this.endPoint;\n        this.endPoint = tmp;\n        tmp = this.startControlPoint;\n        this.startControlPoint = this.endControlPoint;\n        this.endControlPoint = tmp;\n        return this;\n    };\n    ;\n    /**\n     * Get the total curve length.<br>\n     * <br>\n     * As not all Bézier curved have a closed formula to calculate their lengths, this\n     * implementation uses a segment buffer (with a length of 30 segments). So the\n     * returned length is taken from the arc segment buffer.<br>\n     * <br>\n     * Note that if the curve points were changed and the segment buffer was not\n     * updated this function might return wrong (old) values.\n     *\n     * @method getLength\n     * @instance\n     * @memberof CubicBezierCurve\n     * @return {number} >= 0\n     **/\n    CubicBezierCurve.prototype.getLength = function () {\n        return this.arcLength;\n    };\n    ;\n    /**\n     * Uptate the internal arc segment buffer and their lengths.<br>\n     * <br>\n     * All class functions update the buffer automatically; if any\n     * curve point is changed by other reasons you should call this\n     * function to keep actual values in the buffer.\n     *\n     * @method updateArcLengths\n     * @instance\n     * @memberof CubicBezierCurve\n     * @return {void}\n     **/\n    CubicBezierCurve.prototype.updateArcLengths = function () {\n        var pointA = this.startPoint.clone();\n        var pointB = new Vertex_1.Vertex(0, 0);\n        var curveStep = 1.0 / this.curveIntervals;\n        // Clear segment cache\n        this.segmentCache = [];\n        // Push start point into buffer\n        this.segmentCache.push(this.startPoint);\n        this.segmentLengths = [];\n        var newLength = 0.0;\n        var t = 0.0;\n        var tmpLength;\n        while (t <= 1.0) {\n            pointB = this.getPointAt(t);\n            // Store point into cache\n            this.segmentCache.push(pointB);\n            // Calculate segment length\n            tmpLength = pointA.distance(pointB);\n            this.segmentLengths.push(tmpLength);\n            newLength += tmpLength;\n            pointA = pointB;\n            t += curveStep;\n        }\n        this.arcLength = newLength;\n    };\n    ;\n    /**\n     * Get a 't' (relative position on curve) with the closest distance to point 'p'.\n     *\n     * The returned number is 0.0 <= t <= 1.0. Use the getPointAt(t) function to retrieve the actual curve point.\n     *\n     * This function uses a recursive approach by cutting the curve into several linear segments.\n     *\n     * @param {Vertex} p - The point to find the closest position ('t' on the curve).\n     * @return {number}\n     **/\n    CubicBezierCurve.prototype.getClosestT = function (p) {\n        // We would like to have an error that's not larger than 1.0.\n        var desiredEpsilon = 1.0;\n        var result = { t: 0, tPrev: 0.0, tNext: 1.0 };\n        var iteration = 0;\n        do {\n            result = this.locateIntervalByDistance(p, result.tPrev, result.tNext, this.curveIntervals);\n            iteration++;\n            // Be sure: stop after 4 iterations\n        } while (iteration < 4 && this.getPointAt(result.tPrev).distance(this.getPointAt(result.tNext)) > desiredEpsilon);\n        return result.t;\n    };\n    ;\n    /**\n     * This helper function locates the 't' on a fixed step interval with the minimal distance\n     * between the curve (at 't') and the given point.\n     *\n     * Furthermore you must specify a sub curve (start 't' and end 't') you want to search on.\n     * Using tStart=0.0 and tEnd=1.0 will search on the full curve.\n     *\n     * @param {Vertex} p - The point to find the closest curve point for.\n     * @param {number} tStart - The start position (start 't' of the sub curve). Should be >= 0.0.\n     * @param {number} tEnd - The end position (end 't' of the sub curve). Should be <= 1.0.\n     * @param {number} stepCount - The number of steps to check within the interval.\n     *\n     * @return {object} - An object with t, tPrev and tNext (numbers).\n     **/\n    CubicBezierCurve.prototype.locateIntervalByDistance = function (p, tStart, tEnd, stepCount) {\n        var minIndex = -1;\n        var minDist = 0;\n        var t = 0.0;\n        var tDiff = tEnd - tStart;\n        for (var i = 0; i <= stepCount; i++) {\n            t = tStart + tDiff * (i / stepCount);\n            var vert = this.getPointAt(t);\n            var dist = vert.distance(p);\n            if (minIndex == -1 || dist < minDist) {\n                minIndex = i;\n                minDist = dist;\n            }\n        }\n        return { t: tStart + tDiff * (minIndex / stepCount),\n            tPrev: tStart + tDiff * (Math.max(0, minIndex - 1) / stepCount),\n            tNext: tStart + tDiff * (Math.min(stepCount, minIndex + 1) / stepCount)\n        };\n    };\n    ;\n    /**\n     * Get the bounds of this bezier curve.\n     *\n     * The bounds are approximated by the underlying segment buffer; the more segment there are,\n     * the more accurate will be the returned bounds.\n     *\n     * @return {Bounds} The bounds of this curve.\n     **/\n    CubicBezierCurve.prototype.getBounds = function () {\n        var min = new Vertex_1.Vertex(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY);\n        var max = new Vertex_1.Vertex(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY);\n        var v;\n        for (var i = 0; i < this.segmentCache.length; i++) {\n            v = this.segmentCache[i];\n            min.x = Math.min(min.x, v.x);\n            min.y = Math.min(min.y, v.y);\n            max.x = Math.max(max.x, v.x);\n            max.y = Math.max(max.y, v.y);\n        }\n        return new Bounds_1.Bounds(min, max);\n    };\n    ;\n    /**\n     * Get the start point of the curve.<br>\n     * <br>\n     * This function just returns this.startPoint.\n     *\n     * @method getStartPoint\n     * @instance\n     * @memberof CubicBezierCurve\n     * @return {Vertex} this.startPoint\n     **/\n    CubicBezierCurve.prototype.getStartPoint = function () {\n        return this.startPoint;\n    };\n    ;\n    /**\n     * Get the end point of the curve.<br>\n     * <br>\n     * This function just returns this.endPoint.\n     *\n     * @method getEndPoint\n     * @instance\n     * @memberof CubicBezierCurve\n     * @return {Vertex} this.endPoint\n     **/\n    CubicBezierCurve.prototype.getEndPoint = function () {\n        return this.endPoint;\n    };\n    ;\n    /**\n     * Get the start control point of the curve.<br>\n     * <br>\n     * This function just returns this.startControlPoint.\n     *\n     * @method getStartControlPoint\n     * @instance\n     * @memberof CubicBezierCurve\n     * @return {Vertex} this.startControlPoint\n     **/\n    CubicBezierCurve.prototype.getStartControlPoint = function () {\n        return this.startControlPoint;\n    };\n    ;\n    /**\n     * Get the end control point of the curve.<br>\n     * <br>\n     * This function just returns this.endControlPoint.\n     *\n     * @method getEndControlPoint\n     * @instance\n     * @memberof CubicBezierCurve\n     * @return {Vertex} this.endControlPoint\n     **/\n    CubicBezierCurve.prototype.getEndControlPoint = function () {\n        return this.endControlPoint;\n    };\n    ;\n    /**\n     * Get one of the four curve points specified by the passt point ID.\n     *\n     * @method getEndControlPoint\n     * @param {number} id - One of START_POINT, START_CONTROL_POINT, END_CONTROL_POINT or END_POINT.\n     * @instance\n     * @memberof CubicBezierCurve\n     * @return {Vertex}\n     **/\n    CubicBezierCurve.prototype.getPointByID = function (id) {\n        if (id == this.START_POINT)\n            return this.startPoint;\n        if (id == this.END_POINT)\n            return this.endPoint;\n        if (id == this.START_CONTROL_POINT)\n            return this.startControlPoint;\n        if (id == this.END_CONTROL_POINT)\n            return this.endControlPoint;\n        throw new Error(\"Invalid point ID '\" + id + \"'.\");\n    };\n    ;\n    /**\n     * Get the curve point at a given position t, where t is in [0,1].<br>\n     * <br>\n     * @see Line.pointAt\n     *\n     * @method getPointAt\n     * @param {number} t - The position on the curve in [0,1] (0 means at\n     *                     start point, 1 means at end point, other values address points in bertween).\n     * @instance\n     * @memberof CubicBezierCurve\n     * @return {Vertex}\n     **/\n    CubicBezierCurve.prototype.getPointAt = function (t) {\n        // Perform some powerful math magic\n        var x = this.startPoint.x * Math.pow(1.0 - t, 3) + this.startControlPoint.x * 3 * t * Math.pow(1.0 - t, 2)\n            + this.endControlPoint.x * 3 * Math.pow(t, 2) * (1.0 - t) + this.endPoint.x * Math.pow(t, 3);\n        var y = this.startPoint.y * Math.pow(1.0 - t, 3) + this.startControlPoint.y * 3 * t * Math.pow(1.0 - t, 2)\n            + this.endControlPoint.y * 3 * Math.pow(t, 2) * (1.0 - t) + this.endPoint.y * Math.pow(t, 3);\n        return new Vertex_1.Vertex(x, y);\n    };\n    ;\n    /**\n     * Get the curve point at a given position u, where u is in [0,arcLength].<br>\n     * <br>\n     * @see CubicBezierCurve.getPointAt\n     *\n     * @method getPoint\n     * @param {number} u - The position on the curve in [0,arcLength] (0 means at\n     *                     start point, arcLength means at end point, other values address points in bertween).\n     * @instance\n     * @memberof CubicBezierCurve\n     * @return {Vertex}\n     **/\n    CubicBezierCurve.prototype.getPoint = function (u) {\n        return this.getPointAt(u / this.arcLength);\n    };\n    ;\n    /**\n     * Get the curve tangent vector at a given absolute curve position t in [0,1].<br>\n     * <br>\n     * Note that the returned tangent vector (end point) is not normalized and relative to (0,0).\n     *\n     * @method getTangent\n     * @param {number} t - The position on the curve in [0,1].\n     * @instance\n     * @memberof CubicBezierCurve\n     * @return {Vertex}\n     **/\n    CubicBezierCurve.prototype.getTangentAt = function (t) {\n        var a = this.getStartPoint();\n        var b = this.getStartControlPoint();\n        var c = this.getEndControlPoint();\n        var d = this.getEndPoint();\n        // This is the shortened one\n        var t2 = t * t;\n        // (1 - t)^2 = (1-t)*(1-t) = 1 - t - t + t^2 = 1 - 2*t + t^2\n        var nt2 = 1 - 2 * t + t2;\n        var tX = -3 * a.x * nt2 +\n            b.x * (3 * nt2 - 6 * (t - t2)) +\n            c.x * (6 * (t - t2) - 3 * t2) +\n            3 * d.x * t2;\n        var tY = -3 * a.y * nt2 +\n            b.y * (3 * nt2 - 6 * (t - t2)) +\n            c.y * (6 * (t - t2) - 3 * t2) +\n            3 * d.y * t2;\n        // Note: my implementation does NOT normalize tangent vectors!\n        return new Vertex_1.Vertex(tX, tY);\n    };\n    ;\n    /**\n     * Get a sub curve at the given start end end offsets (values between 0.0 and 1.0).\n     *\n     * tStart >= tEnd is allowed, you will get a reversed sub curve then.\n     *\n     * @method getSubCurveAt\n     * @param {number} tStart – The start offset of the desired sub curve (must be in [0..1]).\n     * @param {number} tEnd – The end offset if the desired cub curve (must be in [0..1]).\n     * @instance\n     * @memberof CubicBezierCurve\n     * @return {CubicBezierCurve} The sub curve as a new curve.\n     **/\n    CubicBezierCurve.prototype.getSubCurveAt = function (tStart, tEnd) {\n        var startVec = new Vector_1.Vector(this.getPointAt(tStart), this.getTangentAt(tStart));\n        var endVec = new Vector_1.Vector(this.getPointAt(tEnd), this.getTangentAt(tEnd).inv());\n        // Tangents are relative. Make absolute.\n        startVec.b.add(startVec.a);\n        endVec.b.add(endVec.a);\n        // This 'splits' the curve at the given point at t.\n        startVec.scale(0.33333333 * (tEnd - tStart));\n        endVec.scale(0.33333333 * (tEnd - tStart));\n        // Draw the bezier curve\n        // pb.draw.cubicBezier( startVec.a, endVec.a, startVec.b, endVec.b, '#8800ff', 2 );\n        return new CubicBezierCurve(startVec.a, endVec.a, startVec.b, endVec.b);\n    };\n    ;\n    /**\n     * Convert a relative curve position u to the absolute curve position t.\n     *\n     * @method convertU2t\n     * @param {number} u - The relative position on the curve in [0,arcLength].\n     * @instance\n     * @memberof CubicBezierCurve\n     * @return {number}\n     **/\n    CubicBezierCurve.prototype.convertU2T = function (u) {\n        return Math.max(0.0, Math.min(1.0, (u / this.arcLength)));\n    };\n    ;\n    /**\n     * Get the curve tangent vector at a given relative position u in [0,arcLength].<br>\n     * <br>\n     * Note that the returned tangent vector (end point) is not normalized.\n     *\n     * @method getTangent\n     * @param {number} u - The position on the curve in [0,arcLength].\n     * @instance\n     * @memberof CubicBezierCurve\n     * @return {Vertex}\n     **/\n    CubicBezierCurve.prototype.getTangent = function (u) {\n        return this.getTangentAt(this.convertU2T(u));\n    };\n    ;\n    /**\n     * Get the curve perpendicular at a given relative position u in [0,arcLength] as a vector.<br>\n     * <br>\n     * Note that the returned vector (end point) is not normalized.\n     *\n     * @method getPerpendicular\n     * @param {number} u - The relative position on the curve in [0,arcLength].\n     * @instance\n     * @memberof CubicBezierCurve\n     * @return {Vertex}\n     **/\n    CubicBezierCurve.prototype.getPerpendicular = function (u) {\n        return this.getPerpendicularAt(this.convertU2T(u));\n    };\n    ;\n    /**\n     * Get the curve perpendicular at a given absolute position t in [0,1] as a vector.<br>\n     * <br>\n     * Note that the returned vector (end point) is not normalized.\n     *\n     * @method getPerpendicularAt\n     * @param {number} u - The absolute position on the curve in [0,1].\n     * @instance\n     * @memberof CubicBezierCurve\n     * @return {Vertex}\n     **/\n    CubicBezierCurve.prototype.getPerpendicularAt = function (t) {\n        var tangentVector = this.getTangentAt(t);\n        return new Vertex_1.Vertex(tangentVector.y, -tangentVector.x);\n    };\n    ;\n    /**\n     * Clone this Bézier curve (deep clone).\n     *\n     * @method clone\n     * @instance\n     * @memberof CubicBezierCurve\n     * @return {CubicBezierCurve}\n     **/\n    CubicBezierCurve.prototype.clone = function () {\n        return new CubicBezierCurve(this.getStartPoint().clone(), this.getEndPoint().clone(), this.getStartControlPoint().clone(), this.getEndControlPoint().clone());\n    };\n    ;\n    /**\n     * Check if this and the specified curve are equal.<br>\n     * <br>\n     * All four points need to be equal for this, the Vertex.equals function is used.<br>\n     * <br>\n     * Please note that this function is not type safe (comparison with any object will fail).\n     *\n     * @method clone\n     * @param {CubicBezierCurve} curve - The curve to compare with.\n     * @instance\n     * @memberof CubicBezierCurve\n     * @return {boolean}\n     **/\n    CubicBezierCurve.prototype.equals = function (curve) {\n        // Note: in the earlier vanilla-JS version this was callable with plain objects.\n        //       Let's see if this restricted version works out.\n        if (!curve)\n            return false;\n        if (!curve.startPoint ||\n            !curve.endPoint ||\n            !curve.startControlPoint ||\n            !curve.endControlPoint)\n            return false;\n        return this.startPoint.equals(curve.startPoint)\n            && this.endPoint.equals(curve.endPoint)\n            && this.startControlPoint.equals(curve.startControlPoint)\n            && this.endControlPoint.equals(curve.endControlPoint);\n    };\n    ;\n    /**\n     * Quick check for class instance.\n     * Is there a better way?\n     *\n     * @method isInstance\n     * @param {any} obj - Check if the passed object/value is an instance of CubicBezierCurve.\n     * @instance\n     * @memberof CubicBezierCurve\n     * @return {boolean}\n     **/\n    CubicBezierCurve.isInstance = function (obj) {\n        // Note: check this again\n        /* OLD VANILLA JS IMPLEMENTATION */\n        /* if( typeof obj != \"object\" )\n            return false;\n        function hasXY(v) {\n            return typeof v != \"undefined\" && typeof v.x == \"number\" && typeof v.y == \"number\";\n        }\n        return typeof obj.startPoint == \"object\" && hasXY(obj.startPoint)\n            && typeof obj.endPoint == \"object\" && hasXY(obj.endPoint)\n            && typeof obj.startControlPoint == \"object\" && hasXY(obj.startControlPoint)\n            && typeof obj.endControlPoint == \"object\" && hasXY(obj.endControlPoint);\n        */\n        return obj instanceof CubicBezierCurve;\n    };\n    ;\n    /**\n     * Create an SVG path data representation of this bézier curve.\n     *\n     * Path data string format is:<br>\n     *  <pre>'M x0 y1 C dx0 dy1 dx1 dy1 x1 x2'</pre><br>\n     * or in other words<br>\n     *   <pre>'M startoint.x startPoint.y C startControlPoint.x startControlPoint.y endControlPoint.x endControlPoint.y endPoint.x endPoint.y'</pre>\n     *\n     * @method toSVGPathData\n     * @instance\n     * @memberof CubicBezierCurve\n     * @return {string}  The SVG path data string.\n     **/\n    CubicBezierCurve.prototype.toSVGPathData = function () {\n        var buffer = [];\n        buffer.push('M ');\n        buffer.push(this.startPoint.x.toString());\n        buffer.push(' ');\n        buffer.push(this.startPoint.y.toString());\n        buffer.push(' C ');\n        buffer.push(this.startControlPoint.x.toString());\n        buffer.push(' ');\n        buffer.push(this.startControlPoint.y.toString());\n        buffer.push(' ');\n        buffer.push(this.endControlPoint.x.toString());\n        buffer.push(' ');\n        buffer.push(this.endControlPoint.y.toString());\n        buffer.push(' ');\n        buffer.push(this.endPoint.x.toString());\n        buffer.push(' ');\n        buffer.push(this.endPoint.y.toString());\n        return buffer.join('');\n    };\n    ;\n    /**\n     * Convert this curve to a JSON string.\n     *\n     * @method toJSON\n     * @param {boolean=} [prettyFormat=false] - If set to true the function will add line breaks.\n     * @instance\n     * @memberof CubicBezierCurve\n     * @return {string} The JSON data.\n     **/\n    CubicBezierCurve.prototype.toJSON = function (prettyFormat) {\n        var jsonString = \"{ \" + // begin object\n            (prettyFormat ? \"\\n\\t\" : \"\") +\n            \"\\\"startPoint\\\" : [\" + this.getStartPoint().x + \",\" + this.getStartPoint().y + \"], \" +\n            (prettyFormat ? \"\\n\\t\" : \"\") +\n            \"\\\"endPoint\\\" : [\" + this.getEndPoint().x + \",\" + this.getEndPoint().y + \"], \" +\n            (prettyFormat ? \"\\n\\t\" : \"\") +\n            \"\\\"startControlPoint\\\": [\" + this.getStartControlPoint().x + \",\" + this.getStartControlPoint().y + \"], \" +\n            (prettyFormat ? \"\\n\\t\" : \"\") +\n            \"\\\"endControlPoint\\\" : [\" + this.getEndControlPoint().x + \",\" + this.getEndControlPoint().y + \"]\" +\n            (prettyFormat ? \"\\n\\t\" : \"\") +\n            \" }\"; // end object\n        return jsonString;\n    };\n    ;\n    /**\n     * Parse a Bézier curve from the given JSON string.\n     *\n     * @method fromJSON\n     * @param {string} jsonString - The JSON data to parse.\n     * @memberof CubicBezierCurve\n     * @static\n     * @throws An exception if the JSON string is malformed.\n     * @return {CubicBezierCurve}\n     **/\n    CubicBezierCurve.fromJSON = function (jsonString) {\n        var obj = JSON.parse(jsonString);\n        return CubicBezierCurve.fromObject(obj);\n    };\n    ;\n    /**\n     * Try to convert the passed object to a CubicBezierCurve.\n     *\n     * @method fromObject\n     * @param {object} obj - The object to convert.\n     * @memberof CubicBezierCurve\n     * @static\n     * @throws An exception if the passed object is malformed.\n     * @return {CubicBezierCurve}\n     **/\n    CubicBezierCurve.fromObject = function (obj) {\n        if (typeof obj !== \"object\")\n            throw \"Can only build from object.\";\n        if (!obj.startPoint)\n            throw \"Object member \\\"startPoint\\\" missing.\";\n        if (!obj.endPoint)\n            throw \"Object member \\\"endPoint\\\" missing.\";\n        if (!obj.startControlPoint)\n            throw \"Object member \\\"startControlPoint\\\" missing.\";\n        if (!obj.endControlPoint)\n            throw \"Object member \\\"endControlPoint\\\" missing.\";\n        return new CubicBezierCurve(new Vertex_1.Vertex(obj.startPoint[0], obj.startPoint[1]), new Vertex_1.Vertex(obj.endPoint[0], obj.endPoint[1]), new Vertex_1.Vertex(obj.startControlPoint[0], obj.startControlPoint[1]), new Vertex_1.Vertex(obj.endControlPoint[0], obj.endControlPoint[1]));\n    };\n    ;\n    /**\n     * Convert a 4-element array of vertices to a cubic bézier curve.\n     *\n     * @method fromArray\n     * @param {Vertex[]} arr -  [ startVertex, endVertex, startControlVertex, endControlVertex ]\n     * @memberof CubicBezierCurve\n     * @throws An exception if the passed array is malformed.\n     * @return {CubicBezierCurve}\n     **/\n    CubicBezierCurve.fromArray = function (arr) {\n        if (!Array.isArray(arr))\n            throw \"Can only build from object.\";\n        if (arr.length != 4)\n            throw \"Can only build from array with four elements.\";\n        return new CubicBezierCurve(arr[0], arr[1], arr[2], arr[3]);\n    };\n    ;\n    /** @constant {number} */\n    CubicBezierCurve.START_POINT = 0;\n    /** @constant {number} */\n    CubicBezierCurve.START_CONTROL_POINT = 1;\n    /** @constant {number} */\n    CubicBezierCurve.END_CONTROL_POINT = 2;\n    /** @constant {number} */\n    CubicBezierCurve.END_POINT = 3;\n    return CubicBezierCurve;\n}());\nexports.CubicBezierCurve = CubicBezierCurve;\n//# sourceMappingURL=CubicBezierCurve.js.map","\"use strict\";\n/**\n * @author   Ikaros Kappler\n * @date     2018-11-28\n * @modified 2018-12-09 Added the utils: baseLog(Number,Number) and mapRasterScale(Number,Number).\n * @version  1.0.1\n *\n * @file Grid\n * @fileoverview Note that the PlotBoilerplate already has a Grid instance member. The Grid is not meant\n *               to be added to the canvas as a drawable as it encapsulates more an abstract concept of the canvas\n *               rather than a drawable object.\n * @public\n **/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Grid = void 0;\n/**\n * @classdesc A grid class with vertical and horizontal lines (or a raster).\n *\n * Note that the PlotBoilerplate already has a Grid instance member. The Grid is not meant\n * to be added to the canvas as a drawable as it encapsulates more an abstract concept of the canvas\n * rather than a drawable object.\n *\n * @requires Vertex\n */\nvar Grid = /** @class */ (function () {\n    /**\n     * The constructor.\n     *\n     * @constructor\n     * @name Grid\n     * @param {Vertex} center - The offset of the grid (default is [0,0]).\n     * @param {Vertex} size   - The x- and y-size of the grid.\n     **/\n    function Grid(center, size) {\n        this.center = center;\n        this.size = size;\n    }\n    ;\n    /**\n     * @memberof Grid\n     **/\n    Grid.utils = {\n        /**\n         * Calculate the logarithm of the given number (num) to a given base.<br>\n         * <br>\n         * This function returns the number l with<br>\n         *  <pre>num == Math.pow(base,l)</pre>\n         *\n         * @member baseLog\n         * @function\n         * @memberof Grid\n         * @inner\n         * @param {number} base - The base to calculate the logarithm to.\n         * @param {number} num  - The number to calculate the logarithm for.\n         * @return {number} <pre>log(base)/log(num)</pre>\n         **/\n        baseLog: function (base, num) { return Math.log(base) / Math.log(num); },\n        /**\n         * Calculate the raster scale for a given logarithmic mapping.<br>\n         * <br>\n         * Example (with adjustFactor=2):<br>\n         * <pre>\n         * If scale is 4.33, then the mapping is 1/2 (because 2^2 <= 4.33 <= 2^3)<br>\n         * If scale is 0.33, then the mapping is 2 because (2^(1/2) >= 0.33 >= 2^(1/4)\n         * </pre>\n         *\n         * @member mapRasterScale\n         * @function\n         * @memberof Grid\n         * @inner\n         * @param {number} adjustFactor The base for the logarithmic raster scaling when zoomed.\n         * @param {number} scale        The currently used scale factor.\n         * @return {number}\n         **/\n        mapRasterScale: function (adjustFactor, scale) {\n            var gf = 1.0;\n            if (scale >= 1) {\n                gf = Math.abs(Math.floor(1 / Grid.utils.baseLog(adjustFactor, scale)));\n                gf = 1 / Math.pow(adjustFactor, gf);\n            }\n            else {\n                gf = Math.abs(Math.floor(Grid.utils.baseLog(1 / adjustFactor, 1 / (scale + 1))));\n                //gf = Math.pow( adjustFactor, gf );\n            }\n            return gf;\n        }\n    };\n    return Grid;\n}());\nexports.Grid = Grid;\n//# sourceMappingURL=Grid.js.map","\"use strict\";\n/**\n * @author   Ikaros Kappler\n * @date     2018-11-11 (Alaaf)\n * @modified 2020-03-28 Ported this class from vanilla-JS to Typescript.\n * @modified 2020-07-28 Changed the `delete` key code from 8 to 46.\n * @modified 2020-10-04 Changed `window` to `globalThis`.\n * @modified 2020-10-04 Added extended JSDoc.\n * @version  1.0.4\n *\n * @file KeyHandler\n * @public\n **/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.KeyHandler = void 0;\n/**\n * @classdesc A generic key handler.\n *\n * Example\n * =======\n * @example\n *      // Javascript\n *\tnew KeyHandler( { trackAll : true } )\n *\t    .down('enter',function() { console.log('ENTER was hit.'); } )\n *\t    .press('enter',function() { console.log('ENTER was pressed.'); } )\n *\t    .up('enter',function() { console.log('ENTER was released.'); } )\n *\n *          .down('e',function() { console.log('e was hit. shift is pressed?',keyHandler.isDown('shift')); } )\n *\n *\t    .up('windows',function() { console.log('windows was released.'); } )\n *\t;\n */\nvar KeyHandler = /** @class */ (function () {\n    /**\n     * The constructor.\n     *\n     * @constructor\n     * @instance\n     * @memberof KeyHandler\n     * @param {HTMLElement} options.element (optional) The HTML element to listen on; if null then 'window' will be used.\n     * @param {boolean} options.trackAll (optional) Set to true if you want to keep track of _all_ keys (keyStatus).\n    **/\n    function KeyHandler(options) {\n        this.downListeners = [];\n        this.pressListeners = [];\n        this.upListeners = [];\n        this.keyStates = {};\n        options = options || {};\n        this.element = options.element ? options.element : globalThis;\n        this.downListeners = [];\n        this.pressListeners = [];\n        this.upListeners = [];\n        this.keyStates = [];\n        // This could be made configurable in a later version. It allows to\n        // keep track of the key status no matter if there are any listeners\n        // on the key or not.\n        this.trackAllKeys = options.trackAll || false;\n        // Install the listeners\n        this.installListeners();\n    }\n    ;\n    /**\n     * A helper function to fire key events from this KeyHandler.\n     *\n     * @param {KeyboardEvent} event - The key event to fire.\n     * @param {Array<XKeyListener>} listener - The listeners to fire to.\n     */\n    KeyHandler.prototype.fireEvent = function (event, listeners) {\n        var hasListener = false;\n        for (var i in listeners) {\n            var lis = listeners[i];\n            if (lis.keyCode != event.keyCode)\n                continue;\n            lis.listener(event);\n            hasListener = true;\n        }\n        return hasListener;\n    };\n    ;\n    /**\n     * Internal function to fire a new keydown event to all listeners.\n     * You should not call this function on your own unless you know what you do.\n     *\n     * @name fireDownEvent\n     * @memberof KeyHandler\n     * @instance\n     * @private\n     * @param {KeyboardEvent} e\n     * @param {KeyHandler} handler\n     * @return {void}\n     */\n    KeyHandler.prototype.fireDownEvent = function (e, handler) {\n        if (handler.fireEvent(e, handler.downListeners) || handler.trackAllKeys) {\n            // Down event has listeners. Update key state.\n            handler.keyStates[e.keyCode] = 'down';\n        }\n    };\n    ;\n    /**\n     * Internal function to fire a new keypress event to all listeners.\n     * You should not call this function on your own unless you know what you do.\n     *\n     * @name firePressEvent\n     * @memberof KeyHandler\n     * @instance\n     * @private\n     * @param {KeyboardEvent} e\n     * @param {KeyHandler} handler\n     * @return void\n     */\n    KeyHandler.prototype.firePressEvent = function (e, handler) {\n        handler.fireEvent(e, handler.pressListeners);\n    };\n    ;\n    /**\n     * Internal function to fire a new keyup event to all listeners.\n     * You should not call this function on your own unless you know what you do.\n     *\n     * @name fireUpEvent\n     * @memberof KeyHandler\n     * @instance\n     * @private\n     * @param {KeyboardEvent} e\n     * @param {KeyHandler} handler\n     * @return {void}\n     */\n    KeyHandler.prototype.fireUpEvent = function (e, handler) {\n        if (handler.fireEvent(e, handler.upListeners) || handler.trackAllKeys) {\n            // Up event has listeners. Clear key state.\n            delete handler.keyStates[e.keyCode];\n        }\n    };\n    ;\n    /**\n     * Resolve the key/name code.\n     */\n    KeyHandler.key2code = function (key) {\n        if (typeof key == 'number')\n            return key;\n        if (typeof key != 'string')\n            throw \"Unknown key name or key type (should be a string or integer): \" + key;\n        if (KeyHandler.KEY_CODES[key])\n            return KeyHandler.KEY_CODES[key];\n        throw \"Unknown key (cannot resolve key code): \" + key;\n    };\n    ;\n    /**\n     * Install the required listeners into the initially passed element.\n     *\n     * By default the listeners are installed into the root element specified on\n     * construction (or 'window').\n     */\n    KeyHandler.prototype.installListeners = function () {\n        var _self = this;\n        this.element.addEventListener('keydown', this._keyDownListener = function (e) { _self.fireDownEvent(e, _self); });\n        this.element.addEventListener('keypress', this._keyPressListener = function (e) { _self.firePressEvent(e, _self); });\n        this.element.addEventListener('keyup', this._keyUpListener = function (e) { _self.fireUpEvent(e, _self); });\n    };\n    ;\n    /**\n     *  Remove all installed event listeners from the underlying element.\n     */\n    KeyHandler.prototype.releaseListeners = function () {\n        this.element.removeEventListener('keydown', this._keyDownListener);\n        this.element.removeEventListener('keypress', this._keyPressListener);\n        this.element.removeEventListener('keyup', this._keyUpListener);\n    };\n    ;\n    /**\n     * Listen for key down. This function allows chaining.\n     *\n     * Example: new KeyHandler().down('enter',function() {console.log('Enter hit.')});\n     *\n     * @name down\n     * @memberof KeyHandler\n     * @instance\n     * @param {string|number} key -  Any key identifier, key code or one from the KEY_CODES list.\n     * @param {(e:KeyboardEvent)=>void} e -  The callback to be triggered.\n     * @return {KeyHandler} this\n     */\n    KeyHandler.prototype.down = function (key, listener) {\n        this.downListeners.push({ key: key, keyCode: KeyHandler.key2code(key), listener: listener });\n        return this;\n    };\n    ;\n    /**\n     * Listen for key press.\n     *\n     * Example: new KeyHandler().press('enter',function() {console.log('Enter pressed.')});\n     *\n     * @name press\n     * @memberof KeyHandler\n     * @instance\n     * @param {string|number} key - Any key identifier, key code or one from the KEY_CODES list.\n     * @param {(e:KeyboardEvent)=>void} listener - The callback to be triggered.\n     * @return {KeyHandler} this\n     */\n    KeyHandler.prototype.press = function (key, listener) {\n        this.pressListeners.push({ key: key, keyCode: KeyHandler.key2code(key), listener: listener });\n        return this;\n    };\n    ;\n    /**\n     * Listen for key up.\n     *\n     * Example: new KeyHandler().up('enter',function() {console.log('Enter released.')});\n     *\n     * @name up\n     * @memberof KeyHandler\n     * @instance\n     * @param {string} key - Any key identifier, key code or one from the KEY_CODES list.\n     * @param {(e:KeyboardEvent)=>void)} e - The callback to be triggered.\n     * @return {KeyHandler} this\n     */\n    KeyHandler.prototype.up = function (key, listener) {\n        this.upListeners.push({ key: key, keyCode: KeyHandler.key2code(key), listener: listener });\n        return this;\n    };\n    ;\n    /**\n     * Check if a specific key is currently held pressed.\n     *\n     * @param {string|number} key - Any key identifier, key code or one from the KEY_CODES list.\n     */\n    KeyHandler.prototype.isDown = function (key) {\n        if (typeof key == 'number')\n            return this.keyStates[key] ? true : false;\n        else\n            return this.keyStates[KeyHandler.key2code(key)] ? true : false;\n    };\n    /**\n     * Source:\n     * https://keycode.info/\n     */\n    KeyHandler.KEY_CODES = {\n        'break': 3,\n        'backspace': 8,\n        // 'delete'\t : 8, // alternate: 46\n        'tab': 9,\n        'clear': 12,\n        'enter': 13,\n        'shift': 16,\n        'ctrl': 17,\n        'alt': 18,\n        'pause': 19,\n        // 'break'\t         : 19,\n        'capslock': 20,\n        'hangul': 21,\n        'hanja': 25,\n        'escape': 27,\n        'conversion': 28,\n        'non-conversion': 29,\n        'spacebar': 32,\n        'pageup': 33,\n        'pagedown': 34,\n        'end': 35,\n        'home': 36,\n        'leftarrow': 37,\n        'uparrow': 38,\n        'rightarrow': 39,\n        'downarrow': 40,\n        'select': 41,\n        'print': 42,\n        'execute': 43,\n        'printscreen': 44,\n        'insert': 45,\n        'delete': 46,\n        'help': 47,\n        '0': 48,\n        '1': 49,\n        '2': 50,\n        '3': 51,\n        '4': 52,\n        '5': 53,\n        '6': 54,\n        '7': 55,\n        '8': 56,\n        '9': 57,\n        ':': 58,\n        'semicolon (firefox)': 59,\n        'equals': 59,\n        '<': 60,\n        'equals (firefox)': 61,\n        'ß': 63,\n        '@ (firefox)': 64,\n        'a': 65,\n        'b': 66,\n        'c': 67,\n        'd': 68,\n        'e': 69,\n        'f': 70,\n        'g': 71,\n        'h': 72,\n        'i': 73,\n        'j': 74,\n        'k': 75,\n        'l': 76,\n        'm': 77,\n        'n': 78,\n        'o': 79,\n        'p': 80,\n        'q': 81,\n        'r': 82,\n        's': 83,\n        't': 84,\n        'u': 85,\n        'v': 86,\n        'w': 87,\n        'x': 88,\n        'y': 89,\n        'z': 90,\n        'windows': 91,\n        'leftcommand': 91,\n        'chromebooksearch': 91,\n        'rightwindowkey': 92,\n        'windowsmenu': 93,\n        'rightcommant': 93,\n        'sleep': 95,\n        'numpad0': 96,\n        'numpad1': 97,\n        'numpad2': 98,\n        'numpad3': 99,\n        'numpad4': 100,\n        'numpad5': 101,\n        'numpad6': 102,\n        'numpad7': 103,\n        'numpad8': 104,\n        'numpad9': 105,\n        'multiply': 106,\n        'add': 107,\n        'numpadperiod': 108,\n        'subtract': 109,\n        'decimalpoint': 110,\n        'divide': 111,\n        'f1': 112,\n        'f2': 113,\n        'f3': 114,\n        'f4': 115,\n        'f5': 116,\n        'f6': 117,\n        'f7': 118,\n        'f8': 119,\n        'f9': 120,\n        'f10': 121,\n        'f11': 122,\n        'f12': 123,\n        'f13': 124,\n        'f14': 125,\n        'f15': 126,\n        'f16': 127,\n        'f17': 128,\n        'f18': 129,\n        'f19': 130,\n        'f20': 131,\n        'f21': 132,\n        'f22': 133,\n        'f23': 134,\n        'f24': 135,\n        'numlock': 144,\n        'scrolllock': 145,\n        '^': 160,\n        '!': 161,\n        // '؛' \t : 162 // (arabic semicolon)\n        '#': 163,\n        '$': 164,\n        'ù': 165,\n        'pagebackward': 166,\n        'pageforward': 167,\n        'refresh': 168,\n        'closingparen': 169,\n        '*': 170,\n        '~+*': 171,\n        // 'home'\t         : 172,\n        'minus': 173,\n        // 'mute'           : 173,\n        // 'unmute'\t : 173,\n        'decreasevolumelevel': 174,\n        'increasevolumelevel': 175,\n        'next': 176,\n        'previous': 177,\n        'stop': 178,\n        'play/pause': 179,\n        'email': 180,\n        'mute': 181,\n        'unmute': 181,\n        //'decreasevolumelevel'\t182 // firefox\n        //'increasevolumelevel'\t183 // firefox\n        'semicolon': 186,\n        'ñ': 186,\n        'equal': 187,\n        'comma': 188,\n        'dash': 189,\n        'period': 190,\n        'forwardslash': 191,\n        'ç': 191,\n        'grave accent': 192,\n        //'ñ' 192,\n        'æ': 192,\n        'ö': 192,\n        '?': 193,\n        '/': 193,\n        '°': 193,\n        // 'numpadperiod'\t : 194, // chrome\n        'openbracket': 219,\n        'backslash': 220,\n        'closebracket': 221,\n        'å': 221,\n        'singlequote': 222,\n        'ø': 222,\n        'ä': 222,\n        '`': 223,\n        // 'left or right ⌘ key (firefox)'\t224\n        'altgr': 225,\n        // '< /git >, left back slash'\t226\n        'GNOME Compose Key': 230,\n        'XF86Forward': 233,\n        'XF86Back': 234,\n        'alphanumeric': 240,\n        'hiragana': 242,\n        'katakana': 242,\n        'half-width': 243,\n        'full-width': 243,\n        'kanji': 244,\n        'unlocktrackpad': 251,\n        'toggletouchpad': 255\n    };\n    return KeyHandler;\n}());\nexports.KeyHandler = KeyHandler;\n//# sourceMappingURL=KeyHandler.js.map","\"use strict\";\n/**\n * @author   Ikaros Kappler\n * @date     2016-03-12\n * @modified 2018-12-05 Refactored the code from the morley-triangle script.\n * @modified 2019-03-20 Added JSDoc tags.\n * @modified 2019-04-28 Fixed a bug in the Line.sub( Vertex ) function (was not working).\n * @modified 2019-09-02 Added the Line.add( Vertex ) function.\n * @modified 2019-09-02 Added the Line.denominator( Line ) function.\n * @modified 2019-09-02 Added the Line.colinear( Line ) function.\n * @modified 2019-09-02 Fixed an error in the Line.intersection( Line ) function (class Point was renamed to Vertex).\n * @modified 2019-12-15 Added the Line.moveTo(Vertex) function.\n * @modified 2020-03-16 The Line.angle(Line) parameter is now optional. The baseline (x-axis) will be used if not defined.\n * @modified 2020-03-23 Ported to Typescript from JS.\n * @modified 2020-12-04 The `intersection` function returns undefined if both lines are parallel.\n * @version  2.1.3\n *\n * @file Line\n * @public\n **/\nvar __extends = (this && this.__extends) || (function () {\n    var extendStatics = function (d, b) {\n        extendStatics = Object.setPrototypeOf ||\n            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n        return extendStatics(d, b);\n    };\n    return function (d, b) {\n        extendStatics(d, b);\n        function __() { this.constructor = d; }\n        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n    };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Line = void 0;\nvar VertTuple_1 = require(\"./VertTuple\");\nvar Vertex_1 = require(\"./Vertex\");\n/**\n * @classdesc A line consists of two vertices a and b.<br>\n * <br>\n * This is some refactored code from my 'Morley Triangle' test<br>\n *   https://github.com/IkarosKappler/morleys-trisector-theorem\n *\n * @requires Vertex\n */\nvar Line = /** @class */ (function (_super) {\n    __extends(Line, _super);\n    /**\n     * Creates an instance of Line.\n     *\n     * @constructor\n     * @name Line\n     * @param {Vertex} a The line's first point.\n     * @param {Vertex} b The line's second point.\n     **/\n    function Line(a, b) {\n        var _this = _super.call(this, a, b, function (a, b) { return new Line(a, b); }) || this;\n        /**\n         * Required to generate proper CSS classes and other class related IDs.\n         **/\n        _this.className = \"Line\";\n        return _this;\n    }\n    /**\n     * Get the intersection if this line and the specified line.\n     *\n     * @method intersection\n     * @param {Line} line The second line.\n     * @return {Vertex|undefined} The intersection (may lie outside the end-points) or `undefined` if both lines are parallel.\n     * @instance\n     * @memberof Line\n     **/\n    // !!! DO NOT MOVE TO VertTuple\n    Line.prototype.intersection = function (line) {\n        var denominator = this.denominator(line);\n        if (denominator == 0)\n            return null;\n        var a = this.a.y - line.a.y;\n        var b = this.a.x - line.a.x;\n        var numerator1 = ((line.b.x - line.a.x) * a) - ((line.b.y - line.a.y) * b);\n        var numerator2 = ((this.b.x - this.a.x) * a) - ((this.b.y - this.a.y) * b);\n        a = numerator1 / denominator; // NaN if parallel lines\n        b = numerator2 / denominator;\n        // Catch NaN?\n        var x = this.a.x + (a * (this.b.x - this.a.x));\n        var y = this.a.y + (a * (this.b.y - this.a.y));\n        if (isNaN(a) || isNaN(x) || isNaN(y)) {\n            return undefined;\n        }\n        // if we cast these lines infinitely in both directions, they intersect here:\n        return new Vertex_1.Vertex(x, y);\n    };\n    ;\n    /**\n     * Create an SVG representation of this line.\n     *\n     * @deprecated DEPRECATION Please use the drawutilssvg library and an XMLSerializer instead.\n     * @method toSVGString\n     * @param {options} p - A set of options, like the 'classname' to use\n     *                      for the line object.\n     * @return {string} The SVG string representing this line.\n     * @instance\n     * @memberof Line\n     **/\n    Line.prototype.toSVGString = function (options) {\n        options = options || {};\n        var buffer = [];\n        buffer.push('<line');\n        if (options.className)\n            buffer.push(' class=\"' + options.className + '\"');\n        buffer.push(' x1=\"' + this.a.x + '\"');\n        buffer.push(' y1=\"' + this.a.y + '\"');\n        buffer.push(' x2=\"' + this.b.x + '\"');\n        buffer.push(' y2=\"' + this.b.y + '\"');\n        buffer.push(' />');\n        return buffer.join('');\n    };\n    ;\n    return Line;\n}(VertTuple_1.VertTuple));\nexports.Line = Line;\n//# sourceMappingURL=Line.js.map","\"use strict\";\n/**\n * @author   Ikaros Kappler\n * @date     2018-03-19\n * @modified 2018-04-28 Added the param 'wasDragged'.\n * @modified 2018-08-16 Added the param 'dragAmount'.\n * @modified 2018-08-27 Added the param 'element'.\n * @modified 2018-11-11 Changed the scope from a simple global var to a member of window/_context.\n * @modified 2018-11-19 Renamed the 'mousedown' function to 'down' and the 'mouseup' function to 'up'.\n * @modified 2018-11-28 Added the 'wheel' listener.\n * @modified 2018-12-09 Cleaned up some code.\n * @modified 2019-02-10 Cleaned up some more code.\n * @modified 2020-03-25 Ported this class from vanilla-JS to Typescript.\n * @modified 2020-04-08 Fixed the click event (internally fired a 'mouseup' event) (1.0.10)\n * @modified 2020-04-08 Added the optional 'name' property. (1.0.11)\n * @modified 2020-04-08 The new version always installs internal listenrs to track drag events even\n *                      if there is no external drag listener installed (1.1.0).\n * @modified 2020-10-04 Added extended JSDoc comments.\n * @modified 2020-11-25 Added the `isTouchEvent` param.\n * @modified 2021-01-10 The mouse handler is now also working with SVGElements.\n * @version  1.2.0\n *\n * @file MouseHandler\n * @public\n **/\nvar __extends = (this && this.__extends) || (function () {\n    var extendStatics = function (d, b) {\n        extendStatics = Object.setPrototypeOf ||\n            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n        return extendStatics(d, b);\n    };\n    return function (d, b) {\n        extendStatics(d, b);\n        function __() { this.constructor = d; }\n        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n    };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MouseHandler = exports.XWheelEvent = exports.XMouseEvent = void 0;\nvar XMouseEvent = /** @class */ (function (_super) {\n    __extends(XMouseEvent, _super);\n    function XMouseEvent() {\n        return _super !== null && _super.apply(this, arguments) || this;\n    }\n    return XMouseEvent;\n}(MouseEvent));\nexports.XMouseEvent = XMouseEvent;\nvar XWheelEvent = /** @class */ (function (_super) {\n    __extends(XWheelEvent, _super);\n    function XWheelEvent() {\n        return _super !== null && _super.apply(this, arguments) || this;\n    }\n    return XWheelEvent;\n}(WheelEvent));\nexports.XWheelEvent = XWheelEvent;\n/**\n * @classdesc A simple mouse handler for demos.\n * Use to avoid load massive libraries like jQuery.\n *\n * @requires XYCoords\n */\nvar MouseHandler = /** @class */ (function () {\n    /**\n     * The constructor.\n     *\n     * Pass the DOM element you want to receive mouse events from.\n     *\n     * Usage\n     * =====\n     * @example\n     *   // Javascript\n     *   new MouseHandler( document.getElementById('mycanvas') )\n     *\t    .drag( function(e) {\n     *\t\tconsole.log( 'Mouse dragged: ' + JSON.stringify(e) );\n     *\t\tif( e.params.leftMouse ) ;\n     *\t\telse if( e.params.rightMouse ) ;\n     *\t    } )\n     *\t    .move( function(e) {\n     *\t\tconsole.log( 'Mouse moved: ' + JSON.stringify(e.params) );\n     *\t    } )\n     *          .up( function(e) {\n     *              console.log( 'Mouse up. Was dragged?', e.params.wasDragged );\n     *          } )\n     *          .down( function(e) {\n     *              console.log( 'Mouse down.' );\n     *          } )\n     *          .click( function(e) {\n     *              console.log( 'Click.' );\n     *          } )\n     *          .wheel( function(e) {\n     *              console.log( 'Wheel. delta='+e.deltaY );\n     *          } )\n     *\n     * @example\n     *   // Typescript\n     *   new MouseHandler( document.getElementById('mycanvas') )\n     *\t    .drag( (e:XMouseEvent) => {\n     *\t\tconsole.log( 'Mouse dragged: ' + JSON.stringify(e) );\n     *\t\tif( e.params.leftMouse ) ;\n     *\t\telse if( e.params.rightMouse ) ;\n     *\t    } )\n     *\t    .move( (e:XMouseEvent) => {\n     *\t\tconsole.log( 'Mouse moved: ' + JSON.stringify(e.params) );\n     *\t    } )\n     *          .up( (e:XMouseEvent) => {\n     *              console.log( 'Mouse up. Was dragged?', e.params.wasDragged );\n     *          } )\n     *          .down( (e:XMouseEvent) => {\n     *              console.log( 'Mouse down.' );\n     *          } )\n     *          .click( (e:XMouseEvent) => {\n     *              console.log( 'Click.' );\n     *          } )\n     *          .wheel( (e:XWheelEvent) => {\n     *              console.log( 'Wheel. delta='+e.deltaY );\n     *          } )\n     *\n     * @constructor\n     * @instance\n     * @memberof MouseHandler\n     * @param {HTMLElement} element\n     **/\n    function MouseHandler(element, name) {\n        this.mouseDownPos = undefined;\n        this.mouseDragPos = undefined;\n        // TODO: cc\n        // private mousePos       : { x:number, y:number }|undefined = undefined;\n        this.mouseButton = -1;\n        this.listeners = {};\n        this.installed = {};\n        this.handlers = {};\n        // +----------------------------------------------------------------------\n        // | Some private vars to store the current mouse/position/button state.\n        // +-------------------------------------------------\n        this.name = name;\n        this.element = element;\n        this.mouseDownPos = null;\n        this.mouseDragPos = null;\n        // this.mousePos     = null;\n        this.mouseButton = -1;\n        this.listeners = {};\n        this.installed = {};\n        this.handlers = {};\n        // +----------------------------------------------------------------------\n        // | Define the internal event handlers.\n        // |\n        // | They will dispatch the modified event (relative mouse position,\n        // | drag offset, ...) to the callbacks.\n        // +-------------------------------------------------\n        var _self = this;\n        this.handlers['mousemove'] = function (e) {\n            if (_self.listeners.mousemove)\n                _self.listeners.mousemove(_self.mkParams(e, 'mousemove'));\n            if (_self.mouseDragPos && _self.listeners.drag)\n                _self.listeners.drag(_self.mkParams(e, 'drag'));\n            if (_self.mouseDownPos)\n                _self.mouseDragPos = _self.relPos(e);\n        };\n        this.handlers['mouseup'] = function (e) {\n            if (_self.listeners.mouseup)\n                _self.listeners.mouseup(_self.mkParams(e, 'mouseup'));\n            _self.mouseDragPos = undefined;\n            _self.mouseDownPos = undefined;\n            _self.mouseButton = -1;\n        };\n        this.handlers['mousedown'] = function (e) {\n            _self.mouseDragPos = _self.relPos(e);\n            _self.mouseDownPos = _self.relPos(e);\n            _self.mouseButton = e.button;\n            if (_self.listeners.mousedown)\n                _self.listeners.mousedown(_self.mkParams(e, 'mousedown'));\n        };\n        this.handlers['click'] = function (e) {\n            if (_self.listeners.click)\n                _self.listeners.click(_self.mkParams(e, 'click'));\n        };\n        this.handlers['wheel'] = function (e) {\n            if (_self.listeners.wheel)\n                _self.listeners.wheel(_self.mkParams(e, 'wheel'));\n        };\n        this.element.addEventListener('mousemove', this.handlers['mousemove']);\n        this.element.addEventListener('mouseup', this.handlers['mouseup']);\n        this.element.addEventListener('mousedown', this.handlers['mousedown']);\n        this.element.addEventListener('click', this.handlers['click']);\n        this.element.addEventListener('wheel', this.handlers['wheel']);\n    }\n    /**\n     * Get relative position from the given MouseEvent.\n     *\n     * @name relPos\n     * @memberof MouseHandler\n     * @instance\n     * @private\n     * @param {MouseEvent} e - The mouse event to get the relative position for.\n     * @return {XYCoords} The relative mouse coordinates.\n     */\n    MouseHandler.prototype.relPos = function (e) {\n        return { x: e.offsetX,\n            y: e.offsetY\n        };\n    };\n    ;\n    /**\n     * Build the extended event params.\n     *\n     * @name mkParams\n     * @memberof MouseHandler\n     * @instance\n     * @private\n     * @param {MouseEvent} e - The mouse event to get the relative position for.\n     * @param {string} eventName - The name of the firing event.\n     * @return {XMouseEvent}\n     */\n    MouseHandler.prototype.mkParams = function (e, eventName) {\n        var rel = this.relPos(e);\n        var xEvent = e;\n        xEvent.params = {\n            element: this.element,\n            name: eventName,\n            isTouchEvent: false,\n            pos: rel,\n            button: this.mouseButton,\n            leftButton: this.mouseButton == 0,\n            middleButton: this.mouseButton == 1,\n            rightButton: this.mouseButton == 2,\n            mouseDownPos: this.mouseDownPos,\n            draggedFrom: this.mouseDragPos,\n            wasDragged: (this.mouseDownPos != null && (this.mouseDownPos.x != rel.x || this.mouseDownPos.y != rel.y)),\n            dragAmount: (this.mouseDownPos != null ? { x: rel.x - this.mouseDragPos.x, y: rel.y - this.mouseDragPos.y } : { x: 0, y: 0 })\n        };\n        return xEvent;\n    };\n    /**\n     * Install a new listener.\n     * Please note that this mouse handler can only handle one listener per event type.\n     *\n     * @name listenFor\n     * @memberof MouseHandler\n     * @instance\n     * @private\n     * @param {string} eventName - The name of the firing event to listen for.\n     * @return {void}\n     */\n    MouseHandler.prototype.listenFor = function (eventName) {\n        if (this.installed[eventName])\n            return;\n        // In the new version 1.1.0 has all internal listeners installed by default.\n        this.installed[eventName] = true;\n    };\n    /**\n     * Un-install a new listener.\n     *\n     * @name listenFor\n     * @memberof MouseHandler\n     * @instance\n     * @private\n     * @param {string} eventName - The name of the firing event to unlisten for.\n     * @return {void}\n     */\n    MouseHandler.prototype.unlistenFor = function (eventName) {\n        if (!this.installed[eventName])\n            return;\n        // In the new version 1.1.0 has all internal listeners installed by default.\n        delete this.installed[eventName];\n    };\n    /**\n     * Installer function to listen for a specific event: mouse-drag.\n     * Pass your callbacks here.\n     *\n     * Note: this support chaining.\n     *\n     * @name drag\n     * @memberof MouseHandler\n     * @instance\n     * @param {XMouseCallback} callback - The drag-callback to listen for.\n     * @return {MouseHandler} this\n     */\n    MouseHandler.prototype.drag = function (callback) {\n        if (this.listeners.drag)\n            this.throwAlreadyInstalled('drag');\n        this.listeners.drag = callback;\n        this.listenFor('mousedown');\n        this.listenFor('mousemove');\n        this.listenFor('mouseup');\n        return this;\n    };\n    ;\n    /**\n     * Installer function to listen for a specific event: mouse-move.\n     * Pass your callbacks here.\n     *\n     * Note: this support chaining.\n     *\n     * @name move\n     * @memberof MouseHandler\n     * @instance\n     * @param {XMouseCallback} callback - The move-callback to listen for.\n     * @return {MouseHandler} this\n     */\n    MouseHandler.prototype.move = function (callback) {\n        if (this.listeners.mousemove)\n            this.throwAlreadyInstalled('mousemove');\n        this.listenFor('mousemove');\n        this.listeners.mousemove = callback;\n        return this;\n    };\n    ;\n    /**\n     * Installer function to listen for a specific event: mouse-up.\n     * Pass your callbacks here.\n     *\n     * Note: this support chaining.\n     *\n     * @name up\n     * @memberof MouseHandler\n     * @instance\n     * @param {XMouseCallback} callback - The up-callback to listen for.\n     * @return {MouseHandler} this\n     */\n    MouseHandler.prototype.up = function (callback) {\n        if (this.listeners.mouseup)\n            this.throwAlreadyInstalled('mouseup');\n        this.listenFor('mouseup');\n        this.listeners.mouseup = callback;\n        return this;\n    };\n    ;\n    /**\n     * Installer function to listen for a specific event: mouse-down.\n     * Pass your callbacks here.\n     *\n     * Note: this support chaining.\n     *\n     * @name down\n     * @memberof MouseHandler\n     * @instance\n     * @param {XMouseCallback} callback - The down-callback to listen for.\n     * @return {MouseHandler} this\n     */\n    MouseHandler.prototype.down = function (callback) {\n        if (this.listeners.mousedown)\n            this.throwAlreadyInstalled('mousedown');\n        this.listenFor('mousedown');\n        this.listeners.mousedown = callback;\n        return this;\n    };\n    ;\n    /**\n     * Installer function to listen for a specific event: mouse-click.\n     * Pass your callbacks here.\n     *\n     * Note: this support chaining.\n     *\n     * @name click\n     * @memberof MouseHandler\n     * @instance\n     * @param {XMouseCallback} callback - The click-callback to listen for.\n     * @return {MouseHandler} this\n     */\n    MouseHandler.prototype.click = function (callback) {\n        if (this.listeners.click)\n            this.throwAlreadyInstalled('click');\n        this.listenFor('click');\n        this.listeners.click = callback;\n        return this;\n    };\n    ;\n    /**\n     * Installer function to listen for a specific event: mouse-wheel.\n     * Pass your callbacks here.\n     *\n     * Note: this support chaining.\n     *\n     * @name wheel\n     * @memberof MouseHandler\n     * @instance\n     * @param {XWheelCallback} callback - The wheel-callback to listen for.\n     * @return {MouseHandler} this\n     */\n    MouseHandler.prototype.wheel = function (callback) {\n        if (this.listeners.wheel)\n            this.throwAlreadyInstalled('wheel');\n        this.listenFor('wheel');\n        this.listeners.wheel = callback;\n        return this;\n    };\n    ;\n    /**\n     * An internal function to throw events.\n     *\n     * @name throwAlreadyInstalled\n     * @memberof MouseHandler\n     * @instance\n     * @private\n     * @param {string} name - The name of the event.\n     * @return {void}\n     */\n    MouseHandler.prototype.throwAlreadyInstalled = function (name) {\n        throw \"This MouseHandler already has a '\" + name + \"' callback. To keep the code simple there is only room for one.\";\n    };\n    ;\n    /**\n     * Call this when your work is done.\n     *\n     * The function will un-install all event listeners.\n     *\n     * @name destroy\n     * @memberof MouseHandler\n     * @instance\n     * @private\n     * @return {void}\n     */\n    MouseHandler.prototype.destroy = function () {\n        this.unlistenFor('mousedown');\n        this.unlistenFor('mousemove');\n        this.unlistenFor('moseup');\n        this.unlistenFor('click');\n        this.unlistenFor('wheel');\n        this.element.removeEventListener('mousemove', this.handlers['mousemove']);\n        this.element.removeEventListener('mouseup', this.handlers['mousedown']);\n        this.element.removeEventListener('mousedown', this.handlers['mousedown']);\n        this.element.removeEventListener('click', this.handlers['click']);\n        this.element.removeEventListener('wheel', this.handlers['wheel']);\n    };\n    return MouseHandler;\n}());\nexports.MouseHandler = MouseHandler;\n//# sourceMappingURL=MouseHandler.js.map","\"use strict\";\n/**\n * @author   Ikaros Kappler\n * @date     2019-01-30\n * @modified 2019-03-23 Added JSDoc tags.\n * @modified 2020-03-25 Ported this class from vanilla-JS to Typescript.\n * @modified 2021-01-20 Added UID.\n * @version 1.1.0\n *\n * @file PBImage\n * @fileoverview As native Image objects have only a position and with\n *               and height thei are not suitable for UI dragging interfaces.\n * @public\n **/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PBImage = void 0;\nvar UIDGenerator_1 = require(\"./UIDGenerator\");\n/**\n * @classdesc A wrapper for image objects. Has an upper left and a lower right corner point.\n *\n * @requires Vertex\n * @requires SVGSerializable\n * @requires UID\n * @requires UIDGenerator\n */\nvar PBImage = /** @class */ (function () {\n    /**\n     * The constructor.\n     *\n     * @constructor\n     * @name PBImage\n     * @param {Image} image - The actual image.\n     * @param {Vertex} upperLeft - The upper left corner.\n     * @param {Vertex} lowerRight - The lower right corner.\n     **/\n    function PBImage(image, upperLeft, lowerRight) {\n        /**\n         * Required to generate proper CSS classes and other class related IDs.\n         **/\n        this.className = \"PBImage\";\n        this.uid = UIDGenerator_1.UIDGenerator.next();\n        this.image = image;\n        this.upperLeft = upperLeft;\n        this.lowerRight = lowerRight;\n    }\n    ;\n    /**\n     * Convert this vertex to SVG code.\n     *\n     * @deprecated DEPRECATION Please use the drawutilssvg library and an XMLSerializer instead.\n     * @method toSVGString\n     * @param {object=} options - An optional set of options, like 'className'.\n     * @return {string} A string representing the SVG code for this vertex.\n     * @instance\n     * @memberof PBImage\n     **/\n    PBImage.prototype.toSVGString = function (options) {\n        console.warn(\"PBImage is not yet SVG serializable. Returning empty SVG string.\");\n        return \"\";\n    };\n    ;\n    return PBImage;\n}());\nexports.PBImage = PBImage;\n//# sourceMappingURL=PBImage.js.map","\"use strict\";\n/**\n * @author   Ikaros Kappler\n * @date     2018-10-23\n * @modified 2018-11-19 Added multi-select and multi-drag.\n * @modified 2018-12-04 Added basic SVG export.\n * @modified 2018-12-09 Extended the constructor (canvas).\n * @modified 2018-12-18 Added the config.redrawOnResize param.\n * @modified 2018-12-18 Added the config.defaultCanvas{Width,Height} params.\n * @modified 2018-12-19 Added CSS scaling.\n * @modified 2018-12-28 Removed the unused 'drawLabel' param. Added the 'enableMouse' and 'enableKeys' params.\n * @modified 2018-12-29 Added the 'drawOrigin' param.\n * @modified 2018-12-29 Renamed the 'autoCenterOffset' param to 'autoAdjustOffset'. Added the params 'offsetAdjustXPercent' and 'offsetAdjustYPercent'.\n * @modified 2019-01-14 Added params 'drawBezierHandleLines' and 'drawBezierHandlePoints'. Added the 'redraw' praam to the add() function.\n * @modified 2019-01-16 Added params 'drawHandleLines' and 'drawHandlePoints'. Added the new params to the dat.gui interface.\n * @modified 2019-01-30 Added the 'Vector' type (extending the Line class).\n * @modified 2019-01-30 Added the 'PBImage' type (a wrapper for images).\n * @modified 2019-02-02 Added the 'canvasWidthFactor' and 'canvasHeightFactor' params.\n * @modified 2019-02-03 Removed the drawBackgroundImage() function, with had no purpose at all. Just add an image to the drawables-list.\n * @modified 2019-02-06 Vertices (instace of Vertex) can now be added. Added the 'draggable' attribute to the vertex attributes.\n * @modified 2019-02-10 Fixed a draggable-bug in PBImage handling (scaling was not possible).\n * @modified 2019-02-10 Added the 'enableTouch' option (default is true).\n * @modified 2019-02-14 Added the console for debugging (setConsole(object)).\n * @modified 2019-02-19 Added two new constants: DEFAULT_CLICK_TOLERANCE and DEFAULT_TOUCH_TOLERANCE.\n * @modified 2019-02-19 Added the second param to the locatePointNear(Vertex,Number) function.\n * @modified 2019-02-20 Removed the 'loadFile' entry from the GUI as it was experimental and never in use.\n * @modified 2019-02-23 Removed the 'rebuild' function as it had no purpose.\n * @modified 2019-02-23 Added scaling of the click-/touch-tolerance with the CSS scale.\n * @modified 2019-03-23 Added JSDoc tags. Changed the default value of config.drawOrigin to false.\n * @modified 2019-04-03 Fixed the touch-drag position detection for canvas elements that are not located at document position (0,0).\n * @modified 2019-04-03 Tweaked the fit-to-parent function to work with paddings and borders.\n * @modified 2019-04-28 Added the preClear callback param (called before the canvas was cleared on redraw and before any elements are drawn).\n * @modified 2019-09-18 Added basics for WebGL support (strictly experimental).\n * @modified 2019-10-03 Added the .beginDrawCycle call in the redraw function.\n * @modified 2019-11-06 Added fetch.num, fetch.val, fetch.bool, fetch.func functions.\n * @modified 2019-11-13 Fixed an issue with the mouse-sensitive area around vertices (were affected by zoom).\n * @modified 2019-11-13 Added the 'enableMouseWheel' param.\n * @modified 2019-11-18 Added the Triangle class as a regular drawable element.\n * @modified 2019-11-18 The add function now works with arrays, too.\n * @modified 2019-11-18 Added the _handleColor helper function to determine the render color of non-draggable vertices.\n * @modified 2019-11-19 Fixed a bug in the resizeCanvas function; retina resolution was not possible.\n * @modified 2019-12-04 Added relative positioned zooming.\n * @modified 2019-12-04 Added offsetX and offsetY params.\n * @modified 2019-12-04 Added an 'Set to fullsize retina' button to the GUI config.\n * @modified 2019-12-07 Added the drawConfig for lines, polygons, ellipse, triangles, bezier curves and image control lines.\n * @modified 2019-12-08 Fixed a css scale bug in the viewport() function.\n * @modified 2019-12-08 Added the drawconfig UI panel (line colors and line widths).\n * @modified 2020-02-06 Added handling for the end- and end-control-points of non-cirular Bézier paths (was still missing).\n * @modified 2020-02-06 Fixed a drag-amount bug in the move handling of end points of Bezier paths (control points was not properly moved when non circular).\n * @modified 2020-03-28 Ported this class from vanilla-JS to Typescript.\n * @modified 2020-03-29 Fixed the enableSVGExport flag (read enableEport before).\n * @modified 2020-05-09 Included the Cirlcle class.\n * @modified 2020-06-22 Added the rasterScaleX and rasterScaleY config params.\n * @modified 2020-06-03 Fixed the selectedVerticesOnPolyon(Polygon) function: non-selectable vertices were selected too, before.\n * @modified 2020-07-06 Replacing Touchy.js by AlloyFinger.js\n * @modified 2020-07-27 Added the getVertexNear(XYCoords,number) function\n * @modified 2020-07-27 Extended the remove(Drawable) function: vertices are now removed, too.\n * @modified 2020-07-28 Added PlotBoilerplate.revertMousePosition(number,number) –  the inverse function of transformMousePosition(...).\n * @modified 2020-07-31 Added PlotBoilerplate.getDraggedElementCount() to check wether any elements are currently being dragged.\n * @modified 2020-08-19 Added the VertexAttributes.visible attribute to make vertices invisible.\n * @modified 2020-11-17 Added pure click handling (no dragEnd and !wasMoved jiggliny any more) to the PlotBoilerplate.\n * @modified 2020-12-11 Added the `removeAll(boolean)` function.\n * @modified 2020-12-17 Added the `CircleSector` drawable.\n * @modified 2021-01-04 Avoiding multiple redraw call on adding multiple Drawables (array).\n * @modified 2021-01-08 Added param `draw:DraLib<void>` to the methods `drawVertices`, `drawGrid` and `drawSelectPolygon`.\n * @modified 2021-01-08 Added the customizable `drawAll(...)` function.\n * @modified 2021-01-09 Added the `drawDrawable(...)` function.\n * @modified 2021-01-10 Added the `eventCatcher` element (used to track mouse events on SVGs).\n * @modified 2021-01-26 Fixed SVG resizing.\n * @modified 2021-01-26 Replaced the old SVGBuilder by the new `drawutilssvg` library.\n * @modified 2021-02-08 Fixed a lot of es2015 compatibility issues.\n * @version  1.12.3\n *\n * @file PlotBoilerplate\n * @fileoverview The main class.\n * @public\n **/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PlotBoilerplate = void 0;\n// import AlloyFinger, { TouchMoveEvent, TouchPinchEvent } from \"alloyfinger-typescript/dist/types\";\n//import AlloyFinger, { TouchMoveEvent, TouchPinchEvent } from \"alloyfinger-typescript/src/ts\";\nvar alloyfinger_typescript_1 = require(\"alloyfinger-typescript\");\nvar draw_1 = require(\"./draw\");\nvar drawgl_1 = require(\"./drawgl\");\nvar drawutilssvg_1 = require(\"./utils/helpers/drawutilssvg\");\nvar BezierPath_1 = require(\"./BezierPath\");\nvar Bounds_1 = require(\"./Bounds\");\nvar Circle_1 = require(\"./Circle\");\nvar CircleSector_1 = require(\"./CircleSector\");\nvar Grid_1 = require(\"./Grid\");\nvar KeyHandler_1 = require(\"./KeyHandler\");\nvar Line_1 = require(\"./Line\");\nvar MouseHandler_1 = require(\"./MouseHandler\");\nvar PBImage_1 = require(\"./PBImage\");\nvar Polygon_1 = require(\"./Polygon\");\nvar Triangle_1 = require(\"./Triangle\");\nvar VEllipse_1 = require(\"./VEllipse\");\nvar Vector_1 = require(\"./Vector\");\nvar Vertex_1 = require(\"./Vertex\");\nvar VertexAttr_1 = require(\"./VertexAttr\");\n/**\n * @classdesc The main class of the PlotBoilerplate.\n *\n * @requires Vertex\n * @requires Line\n * @requires Vector\n * @requires Polygon\n * @requires PBImage\n * @requires VEllipse\n * @requires Circle\n * @requires MouseHandler\n * @requires KeyHandler\n * @requires VertexAttr\n * @requires CubicBezierCurve\n * @requires BezierPath\n * @requires Drawable\n * @requires DrawConfig\n * @requires IHooks\n * @requires PBParams\n * @requires Triangle\n * @requires drawutils\n * @requires drawutilsgl\n * @requires SVGSerializable\n * @requires XYCoords\n * @requires XYDimension\n */\nvar PlotBoilerplate = /** @class */ (function () {\n    /**\n     * The constructor.\n     *\n     * @constructor\n     * @name PlotBoilerplate\n     * @public\n     * @param {object} config={} - The configuration.\n     * @param {HTMLCanvasElement} config.canvas - Your canvas element in the DOM (required).\n     * @param {boolean=} [config.fullSize=true] - If set to true the canvas will gain full window size.\n     * @param {boolean=} [config.fitToParent=true] - If set to true the canvas will gain the size of its parent container (overrides fullSize).\n     * @param {number=}  [config.scaleX=1.0] - The initial x-zoom. Default is 1.0.\n     * @param {number=}  [config.scaleY=1.0] - The initial y-zoom. Default is 1.0.\n     * @param {number=}  [config.offsetX=1.0] - The initial x-offset. Default is 0.0. Note that autoAdjustOffset=true overrides these values.\n     * @param {number=}  [config.offsetY=1.0] - The initial y-offset. Default is 0.0. Note that autoAdjustOffset=true overrides these values.\n     * @param {boolean=} [config.rasterGrid=true] - If set to true the background grid will be drawn rastered.\n     * @param {boolean=} [config.rasterScaleX=1.0] - Define the default horizontal raster scale (default=1.0).\n     * @param {boolean=} [config.rasterScaleY=1.0] - Define the default vertical raster scale (default=1.0).\n     * @param {number=}  [config.rasterAdjustFactor=1.0] - The exponential limit for wrapping down the grid. (2.0 means: halve the grid each 2.0*n zoom step).\n     * @param {boolean=} [config.drawOrigin=false] - Draw a crosshair at (0,0).\n     * @param {boolean=} [config.autoAdjustOffset=true] -  When set to true then the origin of the XY plane will\n     *                         be re-adjusted automatically (see the params\n     *                         offsetAdjust{X,Y}Percent for more).\n     * @param {number=}  [config.offsetAdjustXPercent=50] - The x-fallback position for the origin after\n     *                         resizing the canvas.\n     * @param {number=}  [config.offsetAdjustYPercent=50] - The y-fallback position for the origin after\n     *                         resizing the canvas.\n     * @param {number=}  [config.defaultCanvasWidth=1024] - The canvas size fallback (width) if no automatic resizing\n     *                         is switched on.\n     * @param {number=}  [config.defaultCanvasHeight=768] - The canvas size fallback (height) if no automatic resizing\n     *                         is switched on.\n     * @param {number=}  [config.canvasWidthFactor=1.0] - Scaling factor (width) upon the canvas size.\n     *                         In combination with cssScale{X,Y} this can be used to obtain\n     *                         sub pixel resolutions for retina displays.\n     * @param {number=}  [config.canvasHeightFactor=1.0] - Scaling factor (height) upon the canvas size.\n     *                         In combination with cssScale{X,Y} this can be used to obtain\n     *                         sub pixel resolutions for retina displays.\n     * @param {number=}  [config.cssScaleX=1.0] - Visually resize the canvas (horizontally) using CSS transforms (scale).\n     * @param {number=}  [config.cssScaleY=1.0] - Visually resize the canvas (vertically) using CSS transforms (scale).\n     * @param {boolan=}  [config.cssUniformScale=true] - CSS scale x and y obtaining aspect ratio.\n     * @param {boolean=} [config.autoDetectRetina=true] - When set to true (default) the canvas will try to use the display's pixel ratio.\n     * @param {string=}  [config.backgroundColor=#ffffff] - The backround color.\n     * @param {boolean=} [config.redrawOnResize=true] - Switch auto-redrawing on resize on/off (some applications\n     *                         might want to prevent automatic redrawing to avoid data loss from the draw buffer).\n     * @param {boolean=} [config.drawBezierHandleLines=true] - Indicates if Bézier curve handles should be drawn (used for\n     *                         editors, no required in pure visualizations).\n     * @param {boolean=} [config.drawBezierHandlePoints=true] - Indicates if Bézier curve handle points should be drawn.\n     * @param {function=} [config.preClear=null] - A callback function that will be triggered just before the\n     *                         draw function clears the canvas (before anything else was drawn).\n     * @param {function=} [config.preDraw=null] - A callback function that will be triggered just before the draw\n     *                         function starts.\n     * @param {function=} [config.postDraw=null] - A callback function that will be triggered right after the drawing\n     *                         process finished.\n     * @param {boolean=} [config.enableMouse=true] - Indicates if the application should handle mouse events for you.\n     * @param {boolean=} [config.enableTouch=true] - Indicates if the application should handle touch events for you.\n     * @param {boolean=} [config.enableKeys=true] - Indicates if the application should handle key events for you.\n     * @param {boolean=} [config.enableMouseWheel=true] - Indicates if the application should handle mouse wheel events for you.\n     * @param {boolean=} [config.enableGL=false] - Indicates if the application should use the experimental WebGL features (not recommended).\n     * @param {boolean=} [config.enableSVGExport=true] - Indicates if the SVG export should be enabled (default is true).\n     *                                                   Note that changes from the postDraw hook might not be visible in the export.\n     */\n    function PlotBoilerplate(config) {\n        // This should be in some static block ...\n        VertexAttr_1.VertexAttr.model = { bezierAutoAdjust: false,\n            renderTime: 0,\n            selectable: true,\n            isSelected: false,\n            draggable: true,\n            visible: true\n        };\n        if (typeof config.canvas == 'undefined')\n            throw \"No canvas specified.\";\n        /**\n         * A global config that's attached to the dat.gui control interface.\n         *\n         * @member {Object}\n         * @memberof PlotBoilerplate\n         * @instance\n         */\n        var f = PlotBoilerplate.utils.fetch;\n        this.config = {\n            canvas: config.canvas,\n            fullSize: f.val(config, 'fullSize', true),\n            fitToParent: f.bool(config, 'fitToParent', true),\n            scaleX: f.num(config, 'scaleX', 1.0),\n            scaleY: f.num(config, 'scaleY', 1.0),\n            offsetX: f.num(config, 'offsetX', 0.0),\n            offsetY: f.num(config, 'offsetY', 0.0),\n            rasterGrid: f.bool(config, 'rasterGrid', true),\n            rasterScaleX: f.num(config, 'rasterScaleX', 1.0),\n            rasterScaleY: f.num(config, 'rasterScaleY', 1.0),\n            rasterAdjustFactor: f.num(config, 'rasterAdjustdFactror', 2.0),\n            drawOrigin: f.bool(config, 'drawOrigin', false),\n            autoAdjustOffset: f.val(config, 'autoAdjustOffset', true),\n            offsetAdjustXPercent: f.num(config, 'offsetAdjustXPercent', 50),\n            offsetAdjustYPercent: f.num(config, 'offsetAdjustYPercent', 50),\n            backgroundColor: config.backgroundColor || '#ffffff',\n            redrawOnResize: f.bool(config, 'redrawOnResize', true),\n            defaultCanvasWidth: f.num(config, 'defaultCanvasWidth', PlotBoilerplate.DEFAULT_CANVAS_WIDTH),\n            defaultCanvasHeight: f.num(config, 'defaultCanvasHeight', PlotBoilerplate.DEFAULT_CANVAS_HEIGHT),\n            canvasWidthFactor: f.num(config, 'canvasWidthFactor', 1.0),\n            canvasHeightFactor: f.num(config, 'canvasHeightFactor', 1.0),\n            cssScaleX: f.num(config, 'cssScaleX', 1.0),\n            cssScaleY: f.num(config, 'cssScaleY', 1.0),\n            cssUniformScale: f.bool(config, 'cssUniformScale', true),\n            saveFile: function () { _self.hooks.saveFile(_self); },\n            setToRetina: function () { _self._setToRetina(); },\n            autoDetectRetina: f.bool(config, 'autoDetectRetina', true),\n            enableSVGExport: f.bool(config, 'enableSVGExport', true),\n            // Listeners/observers\n            preClear: f.func(config, 'preClear', null),\n            preDraw: f.func(config, 'preDraw', null),\n            postDraw: f.func(config, 'postDraw', null),\n            // Interaction\n            enableMouse: f.bool(config, 'enableMouse', true),\n            enableTouch: f.bool(config, 'enableTouch', true),\n            enableKeys: f.bool(config, 'enableKeys', true),\n            enableMouseWheel: f.bool(config, 'enableMouseWheel', true),\n            // Experimental (and unfinished)\n            enableGL: f.bool(config, 'enableGL', false)\n        }; // END confog\n        /**\n         * Configuration for drawing things.\n         *\n         * @member {Object}\n         * @memberof PlotBoilerplate\n         * @instance\n         */\n        this.drawConfig = {\n            drawVertices: true,\n            drawBezierHandleLines: f.bool(config, 'drawBezierHandleLines', true),\n            drawBezierHandlePoints: f.bool(config, 'drawBezierHandlePoints', true),\n            drawHandleLines: f.bool(config, 'drawHandleLines', true),\n            drawHandlePoints: f.bool(config, 'drawHandlePoints', true),\n            drawGrid: f.bool(config, 'drawGrid', true),\n            bezier: {\n                color: '#00a822',\n                lineWidth: 2,\n                handleLine: {\n                    color: 'rgba(180,180,180,0.5)',\n                    lineWidth: 1\n                }\n            },\n            polygon: {\n                color: '#0022a8',\n                lineWidth: 1\n            },\n            triangle: {\n                color: '#6600ff',\n                lineWidth: 1\n            },\n            ellipse: {\n                color: '#2222a8',\n                lineWidth: 1\n            },\n            circle: {\n                color: '#22a8a8',\n                lineWidth: 2\n            },\n            circleSector: {\n                color: '#2280a8',\n                lineWidth: 1\n            },\n            vertex: {\n                color: '#a8a8a8',\n                lineWidth: 1\n            },\n            selectedVertex: {\n                color: '#c08000',\n                lineWidth: 2\n            },\n            line: {\n                color: '#a844a8',\n                lineWidth: 1\n            },\n            vector: {\n                color: '#ff44a8',\n                lineWidth: 1\n            },\n            image: {\n                color: '#a8a8a8',\n                lineWidth: 1\n            }\n        }; // END drawConfig\n        // +---------------------------------------------------------------------------------\n        // | Object members.\n        // +-------------------------------\n        this.grid = new Grid_1.Grid(new Vertex_1.Vertex(0, 0), new Vertex_1.Vertex(50, 50));\n        this.canvasSize = { width: PlotBoilerplate.DEFAULT_CANVAS_WIDTH, height: PlotBoilerplate.DEFAULT_CANVAS_HEIGHT };\n        var canvasElement = typeof config.canvas == 'string'\n            ? document.querySelector(config.canvas)\n            : config.canvas;\n        // Which renderer to use: Canvas2D, WebGL (experimental) or SVG?\n        if (canvasElement.tagName.toLowerCase() === 'canvas') {\n            this.canvas = canvasElement;\n            this.eventCatcher = this.canvas;\n            if (this.config.enableGL && typeof drawgl_1.drawutilsgl === \"undefined\") {\n                console.warn(\"Cannot use webgl. Package was compiled without experimental gl support. Please use plotboilerplate-glsupport.min.js instead.\");\n                console.warn(\"Disabling GL and falling back to Canvas2D.\");\n                this.config.enableGL = false;\n            }\n            if (this.config.enableGL) {\n                var ctx = this.canvas.getContext('webgl'); // webgl-experimental?\n                this.draw = new drawgl_1.drawutilsgl(ctx, false);\n                // PROBLEM: same instance of fill and draw when using WebGL.\n                //          Shader program cannot be duplicated on the same context.\n                this.fill = this.draw.copyInstance(true);\n                console.warn('Initialized with experimental mode enableGL=true. Note that this is not yet fully implemented.');\n            }\n            else {\n                var ctx = this.canvas.getContext('2d');\n                this.draw = new draw_1.drawutils(ctx, false);\n                this.fill = new draw_1.drawutils(ctx, true);\n            }\n        }\n        else if (canvasElement.tagName.toLowerCase() === 'svg') {\n            if (typeof drawutilssvg_1.drawutilssvg === \"undefined\")\n                throw \"The svg draw library is not yet integrated part of PlotBoilerplate. Please include ./src/js/utils/helpers/drawutils.svg into your document.\";\n            this.canvas = canvasElement;\n            this.draw = new drawutilssvg_1.drawutilssvg(this.canvas, new Vertex_1.Vertex(), // offset\n            new Vertex_1.Vertex(), // scale\n            this.canvasSize, false, // fillShapes=false\n            this.drawConfig, false // isSecondary=false\n            );\n            this.fill = this.draw.copyInstance(true); // fillShapes=true\n            if (this.canvas.parentElement) {\n                this.eventCatcher = document.createElement('div');\n                this.eventCatcher.style.position = 'absolute';\n                this.eventCatcher.style.left = '0';\n                this.eventCatcher.style.top = '0';\n                this.eventCatcher.style.cursor = 'pointer';\n                this.canvas.parentElement.style.position = 'relative';\n                this.canvas.parentElement.appendChild(this.eventCatcher);\n            }\n            else {\n                this.eventCatcher = document.body;\n            }\n        }\n        else {\n            throw 'Element is neither a canvas nor an svg element.';\n        }\n        this.draw.scale.set(this.config.scaleX, this.config.scaleY);\n        this.fill.scale.set(this.config.scaleX, this.config.scaleY);\n        this.vertices = [];\n        this.selectPolygon = null;\n        this.draggedElements = [];\n        this.drawables = [];\n        this.console = console;\n        this.hooks = {\n            // This is changable from the outside\n            saveFile: PlotBoilerplate._saveFile\n        };\n        var _self = this;\n        globalThis.addEventListener('resize', function () { return _self.resizeCanvas(); });\n        this.resizeCanvas();\n        if (config.autoDetectRetina) {\n            this._setToRetina();\n        }\n        this.installInputListeners();\n        // Apply the configured CSS scale.\n        this.updateCSSscale();\n        // Init\t\n        this.redraw();\n        // Gain focus\n        this.canvas.focus();\n    }\n    ; // END constructor\n    /**\n     * This function opens a save-as file dialog and – once an output file is\n     * selected – stores the current canvas contents as an SVG image.\n     *\n     * It is the default hook for saving files and can be overwritten.\n     *\n     * @method _saveFile\n     * @instance\n     * @memberof PlotBoilerplate\n     * @return {void}\n     * @private\n     **/\n    PlotBoilerplate._saveFile = function (pb) {\n        if (typeof drawutilssvg_1.drawutilssvg === \"undefined\") {\n            console.error(\"Cannot convert image to SVG. The svg renderer 'drawutilssvg' is missing. Did you load it?\");\n            return;\n        }\n        // Create fake SVG node\n        var svgNode = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n        // var svgNode = document.getElementById('preview-svg');\n        // Draw everything to fake node.\n        var tosvgDraw = new drawutilssvg_1.drawutilssvg(svgNode, pb.draw.offset, pb.draw.scale, pb.canvasSize, false, // fillShapes=false\n        pb.drawConfig);\n        var tosvgFill = tosvgDraw.copyInstance(true); // fillShapes=true\n        tosvgDraw.beginDrawCycle(0);\n        tosvgFill.beginDrawCycle(0);\n        tosvgDraw.clear(pb.config.backgroundColor);\n        pb.drawAll(0, tosvgDraw, tosvgFill);\n        // Full support in all browsers \\o/\n        //    https://caniuse.com/xml-serializer\n        var serializer = new XMLSerializer();\n        var svgCode = serializer.serializeToString(svgNode);\n        var blob = new Blob([svgCode], { type: \"image/svg;charset=utf-8\" });\n        // See documentation for FileSaver.js for usage.\n        //    https://github.com/eligrey/FileSaver.js\n        if (typeof globalThis[\"saveAs\"] != \"function\")\n            throw \"Cannot save file; did you load the ./utils/savefile helper function and the eligrey/SaveFile library?\";\n        var _saveAs = globalThis[\"saveAs\"];\n        _saveAs(blob, \"plotboilerplate.svg\");\n    };\n    ;\n    /**\n     * This function sets the canvas resolution to factor 2.0 (or the preferred pixel ratio of your device) for retina displays.\n     * Please not that in non-GL mode this might result in very slow rendering as the canvas buffer size may increase.\n     *\n     * @method _setToRetina\n     * @instance\n     * @memberof PlotBoilerplate\n     * @return {void}\n     * @private\n     **/\n    PlotBoilerplate.prototype._setToRetina = function () {\n        this.config.autoDetectRetina = true;\n        var pixelRatio = globalThis.devicePixelRatio || 1;\n        this.config.cssScaleX = this.config.cssScaleY = 1.0 / pixelRatio; // 0.5;\n        this.config.canvasWidthFactor = this.config.canvasHeightFactor = pixelRatio; // 2.0;\n        this.resizeCanvas();\n        this.updateCSSscale();\n    };\n    ;\n    /**\n     * Set the current zoom and draw offset to fit the given bounds.\n     *\n     * This method currently restores the aspect zoom ratio.\n     *\n     **/\n    PlotBoilerplate.prototype.fitToView = function (bounds) {\n        var canvasCenter = new Vertex_1.Vertex(this.canvasSize.width / 2.0, this.canvasSize.height / 2.0);\n        var canvasRatio = this.canvasSize.width / this.canvasSize.height;\n        var ratio = bounds.width / bounds.height;\n        // Find the new draw offset\n        var center = new Vertex_1.Vertex(bounds.max.x - bounds.width / 2.0, bounds.max.y - bounds.height / 2.0)\n            .inv()\n            .addXY(this.canvasSize.width / 2.0, this.canvasSize.height / 2.0);\n        this.setOffset(center);\n        if (canvasRatio < ratio) {\n            var newUniformZoom = this.canvasSize.width / bounds.width;\n            this.setZoom(newUniformZoom, newUniformZoom, canvasCenter);\n        }\n        else {\n            var newUniformZoom = this.canvasSize.height / bounds.height;\n            this.setZoom(newUniformZoom, newUniformZoom, canvasCenter);\n        }\n        this.redraw();\n    };\n    ;\n    /**\n     * Set the console for this instance.\n     *\n     * @method setConsole\n     * @param {Console} con - The new console object (default is globalThis.console).\n     * @instance\n     * @memberof PlotBoilerplate\n     * @return {void}\n     **/\n    PlotBoilerplate.prototype.setConsole = function (con) {\n        this.console = con;\n    };\n    ;\n    /**\n     * Update the CSS scale for the canvas depending onf the cssScale{X,Y} settings.<br>\n     * <br>\n     * This function is usually only used inernally.\n     *\n     * @method updateCSSscale\n     * @instance\n     * @memberof PlotBoilerplate\n     * @return {void}\n     * @private\n     **/\n    PlotBoilerplate.prototype.updateCSSscale = function () {\n        if (this.config.cssUniformScale) {\n            PlotBoilerplate.utils.setCSSscale(this.canvas, this.config.cssScaleX, this.config.cssScaleX);\n        }\n        else {\n            PlotBoilerplate.utils.setCSSscale(this.canvas, this.config.cssScaleX, this.config.cssScaleY);\n        }\n    };\n    ;\n    /**\n     * Add a drawable object.<br>\n     * <br>\n     * This must be either:<br>\n     * <pre>\n     *  * a Vertex\n     *  * a Line\n     *  * a Vector\n     *  * a VEllipse\n     *  * a Circle\n     *  * a Polygon\n     *  * a Triangle\n     *  * a BezierPath\n     *  * a BPImage\n     * </pre>\n     *\n     * @param {Drawable|Drawable[]} drawable - The drawable (of one of the allowed class instance) to add.\n     * @param {boolean} [redraw=true] - If true the function will trigger redraw after the drawable(s) was/were added.\n     * @method add\n     * @instance\n     * @memberof PlotBoilerplate\n     * @return {void}\n     **/\n    PlotBoilerplate.prototype.add = function (drawable, redraw) {\n        if (Array.isArray(drawable)) {\n            var arr = drawable;\n            // for( var i in arr )\n            for (var i = 0; i < arr.length; i++) {\n                this.add(arr[i], false);\n            }\n        }\n        else if (drawable instanceof Vertex_1.Vertex) {\n            this.drawables.push(drawable);\n            this.vertices.push(drawable);\n        }\n        else if (drawable instanceof Line_1.Line) {\n            // Add some lines\n            this.drawables.push(drawable);\n            this.vertices.push(drawable.a);\n            this.vertices.push(drawable.b);\n        }\n        else if (drawable instanceof Vector_1.Vector) {\n            this.drawables.push(drawable);\n            this.vertices.push(drawable.a);\n            this.vertices.push(drawable.b);\n        }\n        else if (drawable instanceof VEllipse_1.VEllipse) {\n            this.vertices.push(drawable.center);\n            this.vertices.push(drawable.axis);\n            this.drawables.push(drawable);\n            drawable.center.listeners.addDragListener(function (e) {\n                drawable.axis.add(e.params.dragAmount);\n            });\n        }\n        else if (drawable instanceof Circle_1.Circle) {\n            this.vertices.push(drawable.center);\n            this.drawables.push(drawable);\n        }\n        else if (drawable instanceof CircleSector_1.CircleSector) {\n            this.vertices.push(drawable.circle.center);\n            this.drawables.push(drawable);\n        }\n        else if (drawable instanceof Polygon_1.Polygon) {\n            this.drawables.push(drawable);\n            // for( var i in drawable.vertices )\n            for (var i = 0; i < drawable.vertices.length; i++)\n                this.vertices.push(drawable.vertices[i]);\n        }\n        else if (drawable instanceof Triangle_1.Triangle) {\n            this.drawables.push(drawable);\n            this.vertices.push(drawable.a);\n            this.vertices.push(drawable.b);\n            this.vertices.push(drawable.c);\n        }\n        else if (drawable instanceof BezierPath_1.BezierPath) {\n            this.drawables.push(drawable);\n            var bezierPath = drawable;\n            for (var i = 0; i < bezierPath.bezierCurves.length; i++) {\n                if (!drawable.adjustCircular && i == 0)\n                    this.vertices.push(bezierPath.bezierCurves[i].startPoint);\n                this.vertices.push(bezierPath.bezierCurves[i].endPoint);\n                this.vertices.push(bezierPath.bezierCurves[i].startControlPoint);\n                this.vertices.push(bezierPath.bezierCurves[i].endControlPoint);\n                bezierPath.bezierCurves[i].startControlPoint.attr.selectable = false;\n                bezierPath.bezierCurves[i].endControlPoint.attr.selectable = false;\n            }\n            PlotBoilerplate.utils.enableBezierPathAutoAdjust(drawable);\n        }\n        else if (drawable instanceof PBImage_1.PBImage) {\n            this.vertices.push(drawable.upperLeft);\n            this.vertices.push(drawable.lowerRight);\n            this.drawables.push(drawable);\n            // Todo: think about a IDragEvent interface\n            drawable.upperLeft.listeners.addDragListener(function (e) {\n                drawable.lowerRight.add(e.params.dragAmount);\n            });\n            drawable.lowerRight.attr.selectable = false;\n        }\n        else {\n            throw \"Cannot add drawable of unrecognized type: \" + (typeof drawable) + \".\";\n        }\n        // This is a workaround for backwards compatibility when the 'redraw' param was not yet present.\n        if (redraw || typeof redraw == 'undefined')\n            this.redraw();\n    };\n    ;\n    /**\n     * Remove a drawable object.<br>\n     * <br>\n     * This must be either:<br>\n     * <pre>\n     *  * a Vertex\n     *  * a Line\n     *  * a Vector\n     *  * a VEllipse\n     *  * a Circle\n     *  * a Polygon\n     *  * a BezierPath\n     *  * a BPImage\n     *  * a Triangle\n     * </pre>\n     *\n     * @param {Object} drawable - The drawable (of one of the allowed class instance) to remove.\n     * @param {boolean} [redraw=false]\n     * @method remove\n     * @instance\n     * @memberof PlotBoilerplate\n     * @return {void}\n     **/\n    PlotBoilerplate.prototype.remove = function (drawable, redraw, removeWithVertices) {\n        if (drawable instanceof Vertex_1.Vertex)\n            this.removeVertex(drawable, false);\n        for (var i = 0; i < this.drawables.length; i++) {\n            if (this.drawables[i] === drawable) {\n                this.drawables.splice(i, 1);\n                if (removeWithVertices) {\n                    // Check if some listeners need to be removed\n                    if (drawable instanceof Line_1.Line) {\n                        // Add some lines\n                        this.removeVertex(drawable.a, false);\n                        this.removeVertex(drawable.b, false);\n                    }\n                    else if (drawable instanceof Vector_1.Vector) {\n                        this.removeVertex(drawable.a, false);\n                        this.removeVertex(drawable.b, false);\n                    }\n                    else if (drawable instanceof VEllipse_1.VEllipse) {\n                        this.removeVertex(drawable.center, false);\n                        this.removeVertex(drawable.axis, false);\n                    }\n                    else if (drawable instanceof Circle_1.Circle) {\n                        this.removeVertex(drawable.center, false);\n                    }\n                    else if (drawable instanceof CircleSector_1.CircleSector) {\n                        this.removeVertex(drawable.circle.center, false);\n                    }\n                    else if (drawable instanceof Polygon_1.Polygon) {\n                        // for( var i in drawable.vertices )\n                        for (var i = 0; i < drawable.vertices.length; i++)\n                            this.removeVertex(drawable.vertices[i], false);\n                    }\n                    else if (drawable instanceof Triangle_1.Triangle) {\n                        this.removeVertex(drawable.a, false);\n                        this.removeVertex(drawable.b, false);\n                        this.removeVertex(drawable.c, false);\n                    }\n                    else if (drawable instanceof BezierPath_1.BezierPath) {\n                        for (var i = 0; i < drawable.bezierCurves.length; i++) {\n                            this.removeVertex(drawable.bezierCurves[i].startPoint, false);\n                            this.removeVertex(drawable.bezierCurves[i].startControlPoint, false);\n                            this.removeVertex(drawable.bezierCurves[i].endControlPoint, false);\n                            if (i + 1 == drawable.bezierCurves.length) {\n                                this.removeVertex(drawable.bezierCurves[i].endPoint, false);\n                            }\n                        }\n                    }\n                    else if (drawable instanceof PBImage_1.PBImage) {\n                        this.removeVertex(drawable.upperLeft, false);\n                        this.removeVertex(drawable.lowerRight, false);\n                    }\n                } // END removeWithVertices\n                if (redraw)\n                    this.redraw();\n                return;\n            }\n        }\n    };\n    ;\n    /**\n     * Remove a vertex from the vertex list.<br>\n     *\n     * @param {Vertex} vert - The vertex to remove.\n     * @param {boolean} [redraw=false]\n     * @method removeVertex\n     * @instance\n     * @memberof PlotBoilerplate\n     * @return {void}\n     **/\n    PlotBoilerplate.prototype.removeVertex = function (vert, redraw) {\n        for (var i = 0; i < this.vertices.length; i++) {\n            if (this.vertices[i] === vert) {\n                this.vertices.splice(i, 1);\n                if (redraw)\n                    this.redraw();\n                return;\n            }\n        }\n    };\n    ;\n    /**\n     * Remove all elements.\n     *\n     * If you want to keep the vertices, pass `true`.\n     *\n     * @method removeAll\n     * @param {boolean=false} keepVertices\n     * @instance\n     * @memberof PlotBoilerplate\n     * @return {void}\n     */\n    PlotBoilerplate.prototype.removeAll = function (keepVertices) {\n        this.drawables = [];\n        if (!Boolean(keepVertices)) {\n            this.vertices = [];\n        }\n        this.redraw();\n    };\n    ;\n    /**\n     * Find the vertex near the given position.\n     *\n     * The position is the absolute vertex position, not the x-y-coordinates on the canvas.\n     *\n     * @param {XYCoords} position - The position of the vertex to search for.\n     * @param {number} pixelTolerance - A radius around the position to include into the search.\n     *                                  Note that the tolerance will be scaled up/down when zoomed.\n     * @return The vertex near the given position or undefined if none was found there.\n     **/\n    PlotBoilerplate.prototype.getVertexNear = function (pixelPosition, pixelTolerance) {\n        var p = this.locatePointNear(this.transformMousePosition(pixelPosition.x, pixelPosition.y), pixelTolerance / Math.min(this.config.cssScaleX, this.config.cssScaleY));\n        if (p && p.typeName == \"vertex\")\n            return this.vertices[p.vindex];\n        return undefined;\n    };\n    ;\n    /**\n     * Draw the grid with the current config settings.<br>\n     *\n     * This function is usually only used internally.\n     *\n     * @method drawGrid\n     * @param {DrawLib} draw - The drawing library to use to draw lines.\n     * @private\n     * @instance\n     * @memberof PlotBoilerplate\n     * @return {void}\n     **/\n    PlotBoilerplate.prototype.drawGrid = function (draw) {\n        var gScale = {\n            x: Grid_1.Grid.utils.mapRasterScale(this.config.rasterAdjustFactor, this.draw.scale.x) * this.config.rasterScaleX / this.config.cssScaleX,\n            y: Grid_1.Grid.utils.mapRasterScale(this.config.rasterAdjustFactor, this.draw.scale.y) * this.config.rasterScaleY / this.config.cssScaleY\n        };\n        var gSize = { width: this.grid.size.x * gScale.x, height: this.grid.size.y * gScale.y };\n        var cs = { width: this.canvasSize.width / 2, height: this.canvasSize.height / 2 };\n        var offset = this.draw.offset.clone().inv();\n        offset.x = (Math.round(offset.x + cs.width) / Math.round(gSize.width)) * (gSize.width) / this.draw.scale.x + (((this.draw.offset.x - cs.width) / this.draw.scale.x) % gSize.width);\n        offset.y = (Math.round(offset.y + cs.height) / Math.round(gSize.height)) * (gSize.height) / this.draw.scale.y + (((this.draw.offset.y - cs.height) / this.draw.scale.x) % gSize.height);\n        if (this.drawConfig.drawGrid) {\n            if (this.config.rasterGrid) { // TODO: move config member to drawConfig\n                draw.setCurrentId('raster');\n                draw.raster(offset, (this.canvasSize.width) / this.draw.scale.x, (this.canvasSize.height) / this.draw.scale.y, gSize.width, gSize.height, 'rgba(0,128,255,0.125)');\n            }\n            else {\n                draw.setCurrentId('grid');\n                draw.grid(offset, (this.canvasSize.width) / this.draw.scale.x, (this.canvasSize.height) / this.draw.scale.y, gSize.width, gSize.height, 'rgba(0,128,255,0.095)');\n            }\n        }\n    };\n    ;\n    /**\n     * Draw the origin with the current config settings.<br>\n     *\n     * This function is usually only used internally.\n     *\n     * @method drawOrigin\n     * @param {DrawLib} draw - The drawing library to use to draw lines.\n     * @private\n     * @instance\n     * @memberof PlotBoilerplate\n     * @return {void}\n     **/\n    PlotBoilerplate.prototype.drawOrigin = function (draw) {\n        // Add a crosshair to mark the origin\n        draw.setCurrentId('origin');\n        draw.crosshair({ x: 0, y: 0 }, 10, '#000000');\n    };\n    ;\n    /**\n     * This is just a tiny helper function to determine the render color of vertices.\n     **/\n    PlotBoilerplate.prototype._handleColor = function (h, color) {\n        return h.attr.isSelected ? this.drawConfig.selectedVertex.color : (h.attr.draggable ? color : 'rgba(128,128,128,0.5)');\n    };\n    /**\n     * Draw all drawables.\n     *\n     * This function is usually only used internally.\n     *\n     * @method drawDrawables\n     * @param {number} renderTime - The current render time. It will be used to distinct\n     *                              already draw vertices from non-draw-yet vertices.\n     * @param {DrawLib} draw - The drawing library to use to draw lines.\n     * @param {DrawLib} fill - The drawing library to use to fill areas.\n     * @instance\n     * @memberof PlotBoilerplate\n     * @return {void}\n     **/\n    PlotBoilerplate.prototype.drawDrawables = function (renderTime, draw, fill) {\n        for (var i in this.drawables) {\n            var d = this.drawables[i];\n            this.draw.setCurrentId(d.uid);\n            this.fill.setCurrentId(d.uid);\n            this.draw.setCurrentClassName(d.className);\n            this.draw.setCurrentClassName(d.className);\n            this.drawDrawable(d, renderTime, draw, fill);\n        }\n    };\n    ;\n    /**\n     * Draw the given drawable.\n     *\n     * This function is usually only used internally.\n     *\n     * @method drawDrawable\n     * @param {Drawable} d - The drawable to draw.\n     * @param {number} renderTime - The current render time. It will be used to distinct\n     *                              already draw vertices from non-draw-yet vertices.\n     * @param {DrawLib} draw - The drawing library to use to draw lines.\n     * @param {DrawLib} fill - The drawing library to use to fill areas.\n     * @instance\n     * @memberof PlotBoilerplate\n     * @return {void}\n     **/\n    PlotBoilerplate.prototype.drawDrawable = function (d, renderTime, draw, fill) {\n        if (d instanceof BezierPath_1.BezierPath) {\n            for (var c in d.bezierCurves) {\n                draw.cubicBezier(d.bezierCurves[c].startPoint, d.bezierCurves[c].endPoint, d.bezierCurves[c].startControlPoint, d.bezierCurves[c].endControlPoint, this.drawConfig.bezier.color, this.drawConfig.bezier.lineWidth);\n                if (this.drawConfig.drawBezierHandlePoints && this.drawConfig.drawHandlePoints) {\n                    if (!d.bezierCurves[c].startPoint.attr.bezierAutoAdjust) {\n                        if (d.bezierCurves[c].startPoint.attr.visible) {\n                            draw.setCurrentId(d.uid + \"_h0\");\n                            draw.setCurrentClassName(d.className + \"-start-handle\");\n                            draw.diamondHandle(d.bezierCurves[c].startPoint, 7, this._handleColor(d.bezierCurves[c].startPoint, this.drawConfig.vertex.color));\n                        }\n                        d.bezierCurves[c].startPoint.attr.renderTime = renderTime;\n                    }\n                    if (!d.bezierCurves[c].endPoint.attr.bezierAutoAdjust) {\n                        if (d.bezierCurves[c].endPoint.attr.visible) {\n                            draw.setCurrentId(d.uid + \"_h1\");\n                            draw.setCurrentClassName(d.className + \"-end-handle\");\n                            draw.diamondHandle(d.bezierCurves[c].endPoint, 7, this._handleColor(d.bezierCurves[c].endPoint, this.drawConfig.vertex.color));\n                        }\n                        d.bezierCurves[c].endPoint.attr.renderTime = renderTime;\n                    }\n                    if (d.bezierCurves[c].startControlPoint.attr.visible) {\n                        draw.setCurrentId(d.uid + \"_h2\");\n                        draw.setCurrentClassName(d.className + \"-start-control-handle\");\n                        draw.circleHandle(d.bezierCurves[c].startControlPoint, 3, this._handleColor(d.bezierCurves[c].startControlPoint, '#008888'));\n                    }\n                    if (d.bezierCurves[c].endControlPoint.attr.visible) {\n                        draw.setCurrentId(d.uid + \"_h3\");\n                        draw.setCurrentClassName(d.className + \"-end-control-handle\");\n                        draw.circleHandle(d.bezierCurves[c].endControlPoint, 3, this._handleColor(d.bezierCurves[c].endControlPoint, '#008888'));\n                    }\n                    d.bezierCurves[c].startControlPoint.attr.renderTime = renderTime;\n                    d.bezierCurves[c].endControlPoint.attr.renderTime = renderTime;\n                }\n                else {\n                    d.bezierCurves[c].startPoint.attr.renderTime = renderTime;\n                    d.bezierCurves[c].endPoint.attr.renderTime = renderTime;\n                    d.bezierCurves[c].startControlPoint.attr.renderTime = renderTime;\n                    d.bezierCurves[c].endControlPoint.attr.renderTime = renderTime;\n                }\n                if (this.drawConfig.drawBezierHandleLines && this.drawConfig.drawHandleLines) {\n                    draw.setCurrentId(d.uid + \"_l0\");\n                    draw.setCurrentClassName(d.className + \"-start-line\");\n                    draw.line(d.bezierCurves[c].startPoint, d.bezierCurves[c].startControlPoint, this.drawConfig.bezier.handleLine.color, this.drawConfig.bezier.handleLine.lineWidth);\n                    draw.setCurrentId(d.uid + \"_l1\");\n                    draw.setCurrentClassName(d.className + \"-end-line\");\n                    draw.line(d.bezierCurves[c].endPoint, d.bezierCurves[c].endControlPoint, this.drawConfig.bezier.handleLine.color, this.drawConfig.bezier.handleLine.lineWidth);\n                }\n            }\n        }\n        else if (d instanceof Polygon_1.Polygon) {\n            draw.polygon(d, this.drawConfig.polygon.color, this.drawConfig.polygon.lineWidth);\n            if (!this.drawConfig.drawHandlePoints) {\n                for (var i in d.vertices) {\n                    d.vertices[i].attr.renderTime = renderTime;\n                }\n            }\n        }\n        else if (d instanceof Triangle_1.Triangle) {\n            draw.polyline([d.a, d.b, d.c], false, this.drawConfig.triangle.color, this.drawConfig.triangle.lineWidth);\n            if (!this.drawConfig.drawHandlePoints)\n                d.a.attr.renderTime = d.b.attr.renderTime = d.c.attr.renderTime = renderTime;\n        }\n        else if (d instanceof VEllipse_1.VEllipse) {\n            if (this.drawConfig.drawHandleLines) {\n                draw.setCurrentId(d.uid + \"_e0\");\n                draw.setCurrentClassName(d.className + \"-v-line\");\n                draw.line(d.center.clone().add(0, d.axis.y - d.center.y), d.axis, '#c8c8c8');\n                draw.setCurrentId(d.uid + \"_e1\");\n                draw.setCurrentClassName(d.className + \"-h-line\");\n                draw.line(d.center.clone().add(d.axis.x - d.center.x, 0), d.axis, '#c8c8c8');\n            }\n            draw.setCurrentId(d.uid);\n            draw.setCurrentClassName(\"\" + d.className);\n            draw.ellipse(d.center, Math.abs(d.axis.x - d.center.x), Math.abs(d.axis.y - d.center.y), this.drawConfig.ellipse.color, this.drawConfig.ellipse.lineWidth);\n            if (!this.drawConfig.drawHandlePoints) {\n                d.center.attr.renderTime = renderTime;\n                d.axis.attr.renderTime = renderTime;\n            }\n        }\n        else if (d instanceof Circle_1.Circle) {\n            draw.circle(d.center, d.radius, this.drawConfig.circle.color, this.drawConfig.circle.lineWidth);\n        }\n        else if (d instanceof CircleSector_1.CircleSector) {\n            draw.circleArc(d.circle.center, d.circle.radius, d.startAngle, d.endAngle, this.drawConfig.circleSector.color, this.drawConfig.circleSector.lineWidth);\n        }\n        else if (d instanceof Vertex_1.Vertex) {\n            if (this.drawConfig.drawVertices &&\n                (!d.attr.selectable || !d.attr.draggable) && d.attr.visible) {\n                // Draw as special point (grey)\t\t\n                draw.circleHandle(d, 7, this.drawConfig.vertex.color);\n                d.attr.renderTime = renderTime;\n            }\n        }\n        else if (d instanceof Line_1.Line) {\n            draw.line(d.a, d.b, this.drawConfig.line.color, this.drawConfig.line.lineWidth);\n            if (!this.drawConfig.drawHandlePoints || !d.a.attr.selectable)\n                d.a.attr.renderTime = renderTime;\n            if (!this.drawConfig.drawHandlePoints || !d.b.attr.selectable)\n                d.b.attr.renderTime = renderTime;\n        }\n        else if (d instanceof Vector_1.Vector) {\n            draw.arrow(d.a, d.b, this.drawConfig.vector.color);\n            if (this.drawConfig.drawHandlePoints && d.b.attr.selectable && d.b.attr.visible) {\n                draw.setCurrentId(d.uid + \"_h0\");\n                draw.setCurrentClassName(d.className + \"-handle\");\n                draw.circleHandle(d.b, 3, '#a8a8a8');\n            }\n            else {\n                d.b.attr.renderTime = renderTime;\n            }\n            if (!this.drawConfig.drawHandlePoints || !d.a.attr.selectable)\n                d.a.attr.renderTime = renderTime;\n            if (!this.drawConfig.drawHandlePoints || !d.b.attr.selectable)\n                d.b.attr.renderTime = renderTime;\n        }\n        else if (d instanceof PBImage_1.PBImage) {\n            if (this.drawConfig.drawHandleLines) {\n                draw.setCurrentId(d.uid + \"_l0\");\n                draw.setCurrentClassName(d.className + \"-line\");\n                draw.line(d.upperLeft, d.lowerRight, this.drawConfig.image.color, this.drawConfig.image.lineWidth);\n            }\n            fill.setCurrentId(d.uid);\n            fill.image(d.image, d.upperLeft, d.lowerRight.clone().sub(d.upperLeft));\n            if (this.drawConfig.drawHandlePoints) {\n                draw.setCurrentId(d.uid + \"_h0\");\n                draw.setCurrentClassName(d.className + \"-lower-right\");\n                draw.circleHandle(d.lowerRight, 3, this.drawConfig.image.color);\n                d.lowerRight.attr.renderTime = renderTime;\n            }\n        }\n        else {\n            console.error('Cannot draw object. Unknown class.');\n        }\n    };\n    ;\n    /**\n     * Draw the select-polygon (if there is one).\n     *\n     * This function is usually only used internally.\n     *\n     * @method drawSelectPolygon\n     * @private\n     * @instance\n     * @memberof PlotBoilerplate\n     * @return {void}\n     **/\n    PlotBoilerplate.prototype.drawSelectPolygon = function (draw) {\n        // Draw select polygon?\n        if (this.selectPolygon != null && this.selectPolygon.vertices.length > 0) {\n            draw.setCurrentId(this.selectPolygon.uid);\n            draw.polygon(this.selectPolygon, '#888888');\n            draw.crosshair(this.selectPolygon.vertices[0], 3, '#008888');\n        }\n    };\n    ;\n    /**\n     * Draw all vertices that were not yet drawn with the given render time.<br>\n     * <br>\n     * This function is usually only used internally.\n     *\n     * @method drawVertices\n     * @private\n     * @param {number} renderTime - The current render time. It is used to distinct\n     *                              already draw vertices from non-draw-yet vertices.\n     * @instance\n     * @memberof PlotBoilerplate\n     * @return {void}\n     **/\n    PlotBoilerplate.prototype.drawVertices = function (renderTime, draw) {\n        // Draw all vertices as small squares if they were not already drawn by other objects\n        for (var i in this.vertices) {\n            if (this.drawConfig.drawVertices\n                && this.vertices[i].attr.renderTime != renderTime\n                && this.vertices[i].attr.visible) {\n                draw.setCurrentId(this.vertices[i].uid);\n                draw.squareHandle(this.vertices[i], 5, this._handleColor(this.vertices[i], 'rgb(0,128,192)'));\n            }\n        }\n    };\n    ;\n    /**\n     * Trigger redrawing of all objects.<br>\n     * <br>\n     * Usually this function is automatically called when objects change.\n     *\n     * @method redraw\n     * @instance\n     * @memberof PlotBoilerplate\n     * @return {void}\n     **/\n    PlotBoilerplate.prototype.redraw = function () {\n        var renderTime = new Date().getTime();\n        if (this.config.preClear)\n            this.config.preClear();\n        this.clear();\n        if (this.config.preDraw)\n            this.config.preDraw();\n        this.drawAll(renderTime, this.draw, this.fill);\n        if (this.config.postDraw)\n            this.config.postDraw();\n    };\n    ;\n    /**\n     * Draw all: drawables, grid, select-polygon and vertices.\n     *\n     * @method drawAll\n     * @instance\n     * @memberof PlotBoilerplate\n     * @return {void}\n     **/\n    PlotBoilerplate.prototype.drawAll = function (renderTime, draw, fill) {\n        // Tell the drawing library that a new drawing cycle begins (required for the GL lib).\n        draw.beginDrawCycle(renderTime);\n        fill.beginDrawCycle(renderTime);\n        this.drawGrid(draw);\n        if (this.config.drawOrigin)\n            this.drawOrigin(draw);\n        this.drawDrawables(renderTime, draw, fill);\n        this.drawVertices(renderTime, draw);\n        this.drawSelectPolygon(draw);\n    };\n    ; // END redraw\n    /**\n     * This function clears the canvas with the configured background color.<br>\n     * <br>\n     * This function is usually only used internally.\n     *\n     * @method clear\n     * @private\n     * @instance\n     * @memberof PlotBoilerplate\n     * @return {void}\n     **/\n    PlotBoilerplate.prototype.clear = function () {\n        // Note that elements might have an alpha channel. Clear the scene first.\n        this.draw.clear(this.config.backgroundColor);\n    };\n    ;\n    /**\n     * Clear the selection.<br>\n     * <br>\n     * This function is usually only used internally.\n     *\n     * @method clearSelection\n     * @private\n     * @param {boolean=} [redraw=false] - Indicates if the redraw function should be triggered.\n     * @instance\n     * @memberof PlotBoilerplate\n     * @return {PlotBoilerplate} this\n     **/\n    PlotBoilerplate.prototype.clearSelection = function (redraw) {\n        for (var i in this.vertices)\n            this.vertices[i].attr.isSelected = false;\n        if (redraw)\n            this.redraw();\n        return this;\n    };\n    ;\n    /**\n     * Get the current view port.\n     *\n     * @method viewport\n     * @instance\n     * @memberof PlotBoilerplate\n     * @return {Bounds} The current viewport.\n     **/\n    PlotBoilerplate.prototype.viewport = function () {\n        return new Bounds_1.Bounds(this.transformMousePosition(0, 0), this.transformMousePosition(this.canvasSize.width * this.config.cssScaleX, this.canvasSize.height * this.config.cssScaleY));\n    };\n    ;\n    /**\n     * Trigger the saveFile.hook.\n     *\n     * @method saveFile\n     * @instance\n     * @memberof PlotBoilerplate\n     * @return {void}\n     **/\n    PlotBoilerplate.prototype.saveFile = function () {\n        this.hooks.saveFile(this);\n    };\n    ;\n    /**\n     * Internal helper function used to get 'float' properties from elements.\n     * Used to determine border withs and paddings that were defined using CSS.\n     */\n    PlotBoilerplate.prototype.getFProp = function (elem, propName) {\n        return parseFloat(globalThis.getComputedStyle(elem, null).getPropertyValue(propName));\n    };\n    /**\n     * Get the available inner space of the given container.\n     *\n     * Size minus padding minus border.\n     **/\n    PlotBoilerplate.prototype.getAvailableContainerSpace = function () {\n        var _self = this;\n        var container = _self.canvas.parentNode; // Element | Document | DocumentFragment;\n        // var canvas : HTMLCanvasElement = _self.canvas;\n        _self.canvas.style.display = 'none';\n        /* var\n        padding : number = parseFloat( globalThis.getComputedStyle(container, null).getPropertyValue('padding') ) || 0,\n        border : number = parseFloat( globalThis.getComputedStyle(_self.canvas, null).getPropertyValue('border-width') ) || 0,\n        pl : number = parseFloat( globalThis.getComputedStyle(container, null).getPropertyValue('padding-left') ) || padding,\n        pr : number = parseFloat( globalThis.getComputedStyle(container, null).getPropertyValue('padding-right') ) || padding,\n        pt : number = parseFloat( globalThis.getComputedStyle(container, null).getPropertyValue('padding-top') ) || padding,\n        pb : number = parseFloat( globalThis.getComputedStyle(container, null).getPropertyValue('padding-bottom') ) || padding,\n        bl : number = parseFloat( globalThis.getComputedStyle(_self.canvas, null).getPropertyValue('border-left-width') ) || border,\n        br : number = parseFloat( globalThis.getComputedStyle(_self.canvas, null).getPropertyValue('border-right-width') ) || border,\n        bt : number = parseFloat( globalThis.getComputedStyle(_self.canvas, null).getPropertyValue('border-top-width') ) || border,\n        bb : number = parseFloat( globalThis.getComputedStyle(_self.canvas, null).getPropertyValue('border-bottom-width') ) || border;\n        */\n        var padding = this.getFProp(container, 'padding') || 0, border = this.getFProp(_self.canvas, 'border-width') || 0, pl = this.getFProp(container, 'padding-left') || padding, pr = this.getFProp(container, 'padding-right') || padding, pt = this.getFProp(container, 'padding-top') || padding, pb = this.getFProp(container, 'padding-bottom') || padding, bl = this.getFProp(_self.canvas, 'border-left-width') || border, br = this.getFProp(_self.canvas, 'border-right-width') || border, bt = this.getFProp(_self.canvas, 'border-top-width') || border, bb = this.getFProp(_self.canvas, 'border-bottom-width') || border;\n        var w = container.clientWidth;\n        var h = container.clientHeight;\n        _self.canvas.style.display = 'block';\n        return { width: (w - pl - pr - bl - br), height: (h - pt - pb - bt - bb) };\n    };\n    ;\n    /**\n     * This function resizes the canvas to the required settings (toggles fullscreen).<br>\n     * <br>\n     * This function is usually only used internally but feel free to call it if resizing required.\n     *\n     * @method resizeCanvas\n     * @instance\n     * @memberof PlotBoilerplate\n     * @return {void}\n     **/\n    PlotBoilerplate.prototype.resizeCanvas = function () {\n        var _this = this;\n        var _self = this;\n        var _setSize = function (w, h) {\n            w *= _self.config.canvasWidthFactor;\n            h *= _self.config.canvasHeightFactor;\n            _self.canvasSize.width = w;\n            _self.canvasSize.height = h;\n            // TODO: use CanvasWrapper.setSize here?\n            if (_self.canvas instanceof HTMLCanvasElement) {\n                _self.canvas.width = w;\n                _self.canvas.height = h;\n            }\n            else if (_self.canvas instanceof SVGElement) {\n                _this.canvas.setAttribute('viewBox', \"0 0 \" + w + \" \" + h);\n                _this.canvas.setAttribute('width', \"\" + w);\n                _this.canvas.setAttribute('height', \"\" + h);\n                _this.draw.setSize(_self.canvasSize); // No need to set size to this.fill (instance copy)\n                // console.log(\n                _this.eventCatcher.style.width = w + \"px\";\n                _this.eventCatcher.style.height = h + \"px\";\n            }\n            else {\n                console.error('Error: cannot resize canvas element because it seems neither be a HTMLCanvasElement nor an SVGElement.');\n            }\n            if (_self.config.autoAdjustOffset) {\n                _self.draw.offset.x = _self.fill.offset.x = _self.config.offsetX = w * (_self.config.offsetAdjustXPercent / 100);\n                _self.draw.offset.y = _self.fill.offset.y = _self.config.offsetY = h * (_self.config.offsetAdjustYPercent / 100);\n            }\n        };\n        if (_self.config.fullSize && !_self.config.fitToParent) {\n            // Set editor size\n            var width = globalThis.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;\n            var height = globalThis.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;\n            _self.canvas.style.position = 'absolute';\n            _self.canvas.style.width = (_self.config.canvasWidthFactor * width) + 'px';\n            _self.canvas.style.height = (_self.config.canvasWidthFactor * height) + 'px';\n            _self.canvas.style.top = '0px';\n            _self.canvas.style.left = '0px';\n            _setSize(width, height);\n        }\n        else if (_self.config.fitToParent) {\n            // Set editor size\n            _self.canvas.style.position = 'absolute';\n            var space = this.getAvailableContainerSpace();\n            _self.canvas.style.width = (_self.config.canvasWidthFactor * space.width) + 'px';\n            _self.canvas.style.height = (_self.config.canvasHeightFactor * space.height) + 'px';\n            _self.canvas.style.top = null;\n            _self.canvas.style.left = null;\n            _setSize(space.width, space.height);\n        }\n        else {\n            _self.canvas.style.width = null;\n            _self.canvas.style.height = null;\n            _setSize(_self.config.defaultCanvasWidth, _self.config.defaultCanvasHeight);\n        }\n        if (_self.config.redrawOnResize)\n            _self.redraw();\n    };\n    ;\n    /**\n     *  Add all vertices inside the polygon to the current selection.<br>\n     *\n     * @method selectVerticesInPolygon\n     * @param {Polygon} polygon - The polygonal selection area.\n     * @instance\n     * @memberof PlotBoilerplate\n     * @return {void}\n     **/\n    PlotBoilerplate.prototype.selectVerticesInPolygon = function (polygon) {\n        for (var i in this.vertices) {\n            if (this.vertices[i].attr.selectable && polygon.containsVert(this.vertices[i]))\n                this.vertices[i].attr.isSelected = true;\n        }\n    };\n    ;\n    /**\n     * (Helper) Locates the point (index) at the passed position. Using an internal tolerance of 7 pixels.\n     *\n     * The result is an object { type : 'bpath', pindex, cindex, pid }\n     *\n     * Returns false if no point is near the passed position.\n     *\n     * @method locatePointNear\n     * @param {Vertex} point - The polygonal selection area.\n     * @param {number=} [tolerance=7] - The tolerance to use identtifying vertices.\n     * @private\n     * @return {IDraggable} Or false if none found.\n     **/\n    PlotBoilerplate.prototype.locatePointNear = function (point, tolerance) {\n        var _self = this;\n        if (typeof tolerance == 'undefined')\n            tolerance = 7;\n        // Apply the zoom (the tolerant area should not shrink or grow when zooming)\n        tolerance /= _self.draw.scale.x;\n        // Search in vertices\n        // for( var vindex in _self.vertices ) {\n        for (var vindex = 0; vindex < _self.vertices.length; vindex++) {\n            var vert = _self.vertices[vindex];\n            if ((vert.attr.draggable || vert.attr.selectable) && vert.distance(point) < tolerance) {\n                // { type : 'vertex', vindex : vindex };\n                return new PlotBoilerplate.Draggable(vert, PlotBoilerplate.Draggable.VERTEX).setVIndex(vindex);\n            }\n        }\n        return null;\n    };\n    /**\n     * Handle left-click event.<br>\n     *\n     * @method handleClick\n     * @param {number} x - The click X position on the canvas.\n     * @param {number} y - The click Y position on the canvas.\n     * @private\n     * @return {void}\n     **/\n    PlotBoilerplate.prototype.handleClick = function (e) {\n        var _self = this;\n        // const x:number = e.params.pos.x;\n        //const y:number = e.params.pos.y;\n        var p = this.locatePointNear(_self.transformMousePosition(e.params.pos.x, e.params.pos.y), PlotBoilerplate.DEFAULT_CLICK_TOLERANCE / Math.min(_self.config.cssScaleX, _self.config.cssScaleY));\n        if (p) {\n            _self.vertices[p.vindex].listeners.fireClickEvent(e);\n            if (this.keyHandler && this.keyHandler.isDown('shift')) {\n                if (p.typeName == 'bpath') {\n                    var vert = _self.paths[p.pindex].bezierCurves[p.cindex].getPointByID(p.pid);\n                    if (vert.attr.selectable)\n                        vert.attr.isSelected = !vert.attr.isSelected;\n                }\n                else if (p.typeName == 'vertex') {\n                    var vert = _self.vertices[p.vindex];\n                    if (vert.attr.selectable)\n                        vert.attr.isSelected = !vert.attr.isSelected;\n                }\n                _self.redraw();\n            }\n            else if (this.keyHandler.isDown('y') /* && p.type=='bpath' && (p.pid==BezierPath.START_POINT || p.pid==BezierPath.END_POINT) */) {\n                _self.vertices[p.vindex].attr.bezierAutoAdjust = !_self.vertices[p.vindex].attr.bezierAutoAdjust;\n                _self.redraw();\n            }\n        }\n        else if (_self.selectPolygon != null) {\n            var vert = _self.transformMousePosition(e.params.pos.x, e.params.pos.y);\n            _self.selectPolygon.vertices.push(new Vertex_1.Vertex(vert.x, vert.y));\n            _self.redraw();\n        }\n    };\n    /**\n     * Transforms the given x-y-(mouse-)point to coordinates respecting the view offset\n     * and the zoom settings.\n     *\n     * @method transformMousePosition\n     * @param {number} x - The x position relative to the canvas.\n     * @param {number} y - The y position relative to the canvas.\n     * @instance\n     * @memberof PlotBoilerplate\n     * @return {XYCoords} A simple object <pre>{ x : Number, y : Number }</pre> with the transformed coordinates.\n     **/\n    PlotBoilerplate.prototype.transformMousePosition = function (x, y) {\n        /* return { x : (x/this.config.cssScaleX-this.config.offsetX)/(this.config.scaleX),\n           y : (y/this.config.cssScaleY-this.config.offsetY)/(this.config.scaleY) }; */\n        // console.log('offset', this.config.offsetX, this.config.offsetY, this.draw.offset );\n        return { x: (x / this.config.cssScaleX - this.config.offsetX) / (this.config.scaleX),\n            y: (y / this.config.cssScaleY - this.config.offsetY) / (this.config.scaleY) };\n    };\n    ;\n    /**\n     * Revert a transformed mouse position back to canvas coordinates.\n     *\n     * This is the inverse function of `transformMousePosition`.\n     *\n     * @method revertMousePosition\n     * @param {number} x - The x component of the position to revert.\n     * @param {number} y - The y component of the position to revert.\n     * @instance\n     * @memberof PlotBoilerplate\n     * @return {XYCoords} The canvas coordinates for the given position.\n     **/\n    PlotBoilerplate.prototype.revertMousePosition = function (x, y) {\n        return { x: x / this.config.cssScaleX + this.config.offsetX,\n            y: y / this.config.cssScaleY + this.config.offsetY };\n    };\n    ;\n    /**\n     * Determine if any elements are currently being dragged (on mouse move or touch move).\n     *\n     * @method getDraggedElementCount\n     * @instance\n     * @memberof PlotBoilerplate\n     * @return {number} The number of elements that are currently being dragged.\n     **/\n    PlotBoilerplate.prototype.getDraggedElementCount = function () {\n        return this.draggedElements.length;\n    };\n    ;\n    /**\n     * (Helper) The mouse-down handler.\n     *\n     * It selects vertices for dragging.\n     *\n     * @method mouseDownHandler.\n     * @param {XMouseEvent} e - The event to handle\n     * @private\n     * @return {void}\n     **/\n    PlotBoilerplate.prototype.mouseDownHandler = function (e) {\n        var _self = this;\n        if (e.which != 1)\n            return; // Only react on left mouse or touch events\n        var p = _self.locatePointNear(_self.transformMousePosition(e.params.pos.x, e.params.pos.y), PlotBoilerplate.DEFAULT_CLICK_TOLERANCE / Math.min(_self.config.cssScaleX, _self.config.cssScaleY));\n        if (!p)\n            return;\n        // Drag all selected elements?\n        if (p.typeName == 'vertex' && _self.vertices[p.vindex].attr.isSelected) {\n            // Multi drag\n            // for( var i in _self.vertices ) {\n            for (var i = 0; i < _self.vertices.length; i++) {\n                if (_self.vertices[i].attr.isSelected) {\n                    _self.draggedElements.push(new PlotBoilerplate.Draggable(_self.vertices[i], PlotBoilerplate.Draggable.VERTEX).setVIndex(i));\n                    _self.vertices[i].listeners.fireDragStartEvent(e);\n                }\n            }\n        }\n        else {\n            // Single drag\n            if (!_self.vertices[p.vindex].attr.draggable)\n                return;\n            _self.draggedElements.push(p);\n            if (p.typeName == 'bpath')\n                _self.paths[p.pindex].bezierCurves[p.cindex].getPointByID(p.pid).listeners.fireDragStartEvent(e);\n            else if (p.typeName == 'vertex')\n                _self.vertices[p.vindex].listeners.fireDragStartEvent(e);\n        }\n        _self.redraw();\n    };\n    ;\n    /**\n     * The mouse-drag handler.\n     *\n     * It moves selected elements around or performs the panning if the ctrl-key if\n     * hold down.\n     *\n     * @method mouseDragHandler.\n     * @param {XMouseEvent} e - The event to handle\n     * @private\n     * @return {void}\n     **/\n    PlotBoilerplate.prototype.mouseDragHandler = function (e) {\n        var _self = this;\n        var oldDragAmount = { x: e.params.dragAmount.x, y: e.params.dragAmount.y };\n        e.params.dragAmount.x /= _self.config.cssScaleX;\n        e.params.dragAmount.y /= _self.config.cssScaleY;\n        // Important note to: this.keyHandler.isDown('ctrl')\n        //    We should not use this for any input.\n        //    Reason: most browsers use [Ctrl]+[t] to create new browser tabs.\n        //            If so, the key-up event for [Ctrl] will be fired in the _new tab_,\n        //            not this one. So this tab will never receive any [Ctrl-down] events\n        //            until next keypress; the implication is, that [Ctrl] would still\n        //            considered to be pressed which is not true.\n        if (this.keyHandler.isDown('alt') || this.keyHandler.isDown('spacebar')) {\n            _self.setOffset(_self.draw.offset.clone().add(e.params.dragAmount));\n            _self.redraw();\n        }\n        else {\n            // Convert drag amount by scaling\n            // Warning: this possibly invalidates the dragEvent for other listeners!\n            //          Rethink the solution when other features are added.\n            e.params.dragAmount.x /= _self.draw.scale.x;\n            e.params.dragAmount.y /= _self.draw.scale.y;\n            for (var i in _self.draggedElements) {\n                var p = _self.draggedElements[i];\n                if (p.typeName == 'bpath') {\n                    _self.paths[p.pindex].moveCurvePoint(p.cindex, p.pid, new Vertex_1.Vertex(e.params.dragAmount.x, e.params.dragAmount.y));\n                    _self.paths[p.pindex].bezierCurves[p.cindex].getPointByID(p.pid).listeners.fireDragEvent(e);\n                }\n                else if (p.typeName == 'vertex') {\n                    if (!_self.vertices[p.vindex].attr.draggable)\n                        continue;\n                    _self.vertices[p.vindex].add(e.params.dragAmount);\n                    _self.vertices[p.vindex].listeners.fireDragEvent(e);\n                }\n            }\n        }\n        // Restore old event values!\n        e.params.dragAmount.x = oldDragAmount.x;\n        e.params.dragAmount.y = oldDragAmount.y;\n        _self.redraw();\n    };\n    ;\n    /**\n     * The mouse-up handler.\n     *\n     * It clears the dragging-selection.\n     *\n     * @method mouseUpHandler.\n     * @param {XMouseEvent} e - The event to handle\n     * @private\n     * @return {void}\n     **/\n    PlotBoilerplate.prototype.mouseUpHandler = function (e) {\n        var _self = this;\n        if (e.which != 1)\n            return; // Only react on left mouse;\n        if (!e.params.wasDragged) {\n            _self.handleClick(e); // e.params.pos.x, e.params.pos.y );\n        }\n        for (var i in _self.draggedElements) {\n            var p = _self.draggedElements[i];\n            if (p.typeName == 'bpath') {\n                _self.paths[p.pindex].bezierCurves[p.cindex].getPointByID(p.pid).listeners.fireDragEndEvent(e);\n            }\n            else if (p.typeName == 'vertex') {\n                _self.vertices[p.vindex].listeners.fireDragEndEvent(e);\n            }\n        }\n        _self.draggedElements = [];\n        _self.redraw();\n    };\n    ;\n    /**\n     * The mouse-wheel handler.\n     *\n     * It performs the zooming.\n     *\n     * @method mouseWheelHandler.\n     * @param {XMouseEvent} e - The event to handle\n     * @private\n     * @return {void}\n     **/\n    PlotBoilerplate.prototype.mouseWheelHandler = function (e) {\n        var zoomStep = 1.25; // Make configurable?\n        // CHANGED replaced _self by this\n        var _self = this;\n        var we = e;\n        if (we.deltaY < 0) {\n            _self.setZoom(_self.config.scaleX * zoomStep, _self.config.scaleY * zoomStep, new Vertex_1.Vertex(e.params.pos.x, e.params.pos.y));\n        }\n        else if (we.deltaY > 0) {\n            _self.setZoom(_self.config.scaleX / zoomStep, _self.config.scaleY / zoomStep, new Vertex_1.Vertex(e.params.pos.x, e.params.pos.y));\n        }\n        e.preventDefault();\n        _self.redraw();\n    };\n    ;\n    /**\n     * Set the new draw offset.\n     *\n     * Note: the function will not trigger any redraws.\n     *\n     * @param {Vertex} newOffset - The new draw offset to use.\n     **/\n    PlotBoilerplate.prototype.setOffset = function (newOffset) {\n        this.draw.offset.set(newOffset);\n        this.fill.offset.set(newOffset);\n        this.config.offsetX = newOffset.x;\n        this.config.offsetY = newOffset.y;\n    };\n    ;\n    /**\n    * Set a new zoom value (and re-adjust the draw offset).\n    *\n    * Note: the function will not trigger any redraws.\n    *\n    * @param {number} zoomFactorX - The new horizontal zoom value.\n    * @param {number} zoomFactorY - The new vertical zoom value.\n    * @param {Vertex} interactionPos - The position of mouse/touch interaction.\n    **/\n    PlotBoilerplate.prototype.setZoom = function (zoomFactorX, zoomFactorY, interactionPos) {\n        var oldPos = this.transformMousePosition(interactionPos.x, interactionPos.y);\n        this.draw.scale.x = this.fill.scale.x = this.config.scaleX = Math.max(zoomFactorX, 0.01);\n        this.draw.scale.y = this.fill.scale.y = this.config.scaleY = Math.max(zoomFactorY, 0.01);\n        var newPos = this.transformMousePosition(interactionPos.x, interactionPos.y);\n        var newOffsetX = this.draw.offset.x + (newPos.x - oldPos.x) * this.draw.scale.x;\n        var newOffsetY = this.draw.offset.y + (newPos.y - oldPos.y) * this.draw.scale.y;\n        this.setOffset({ x: newOffsetX, y: newOffsetY });\n    };\n    PlotBoilerplate.prototype.installInputListeners = function () {\n        var _self = this;\n        if (this.config.enableMouse) {\n            // Install a mouse handler on the canvas.\n            new MouseHandler_1.MouseHandler(this.eventCatcher ? this.eventCatcher : this.canvas)\n                .down(function (e) { _self.mouseDownHandler(e); })\n                .drag(function (e) { _self.mouseDragHandler(e); })\n                .up(function (e) { _self.mouseUpHandler(e); });\n        }\n        else {\n            _self.console.log('Mouse interaction disabled.');\n        }\n        if (this.config.enableMouseWheel) {\n            // Install a mouse handler on the canvas.\n            new MouseHandler_1.MouseHandler(this.eventCatcher ? this.eventCatcher : this.canvas)\n                .wheel(function (e) { _self.mouseWheelHandler(e); });\n        }\n        else {\n            _self.console.log('Mouse wheel interaction disabled.');\n        }\n        if (this.config.enableTouch) {\n            // Install a touch handler on the canvas.\n            var relPos_1 = function (pos) {\n                var bounds = _self.canvas.getBoundingClientRect();\n                return { x: pos.x - bounds.left,\n                    y: pos.y - bounds.top\n                };\n            };\n            if (globalThis[\"AlloyFinger\"] && typeof globalThis[\"AlloyFinger\"] == \"function\") {\n                try {\n                    // Do not include AlloyFinger itself to the library\n                    // (17kb, but we want to keep this lib as tiny as possible).\n                    // Solution: only import type defintions from AlloyFinger.\n                    var touchMovePos = null;\n                    var touchDownPos = null;\n                    var draggedElement = null;\n                    var multiTouchStartScale = null;\n                    var clearTouch_1 = function () {\n                        touchMovePos = null;\n                        touchDownPos = null;\n                        draggedElement = null;\n                        multiTouchStartScale = null;\n                        _self.draggedElements = [];\n                    };\n                    new alloyfinger_typescript_1.default(this.eventCatcher ? this.eventCatcher : this.canvas, {\n                        touchStart: function (evt) {\n                            if (evt.touches.length == 1) {\n                                touchMovePos = new Vertex_1.Vertex(relPos_1({ x: evt.touches[0].clientX, y: evt.touches[0].clientY }));\n                                touchDownPos = new Vertex_1.Vertex(relPos_1({ x: evt.touches[0].clientX, y: evt.touches[0].clientY }));\n                                draggedElement = _self.locatePointNear(_self.transformMousePosition(touchMovePos.x, touchMovePos.y), PlotBoilerplate.DEFAULT_TOUCH_TOLERANCE / Math.min(_self.config.cssScaleX, _self.config.cssScaleY));\n                                if (draggedElement && draggedElement.typeName == 'vertex') {\n                                    var draggingVertex = _self.vertices[draggedElement.vindex];\n                                    var fakeEvent = { params: { isTouchEvent: true, dragAmount: { x: 0, y: 0 }, wasDragged: false, mouseDownPos: touchDownPos.clone(), mouseDragPos: touchDownPos.clone(), vertex: draggingVertex } };\n                                    _self.draggedElements = [draggedElement];\n                                    draggingVertex.listeners.fireDragStartEvent(fakeEvent);\n                                }\n                            }\n                        },\n                        touchMove: function (evt) {\n                            if (evt.touches.length == 1 && draggedElement) {\n                                evt.preventDefault();\n                                evt.stopPropagation();\n                                var rel = relPos_1({ x: evt.touches[0].clientX, y: evt.touches[0].clientY });\n                                var trans = _self.transformMousePosition(rel.x, rel.y);\n                                var diff = new Vertex_1.Vertex(_self.transformMousePosition(touchMovePos.x, touchMovePos.y)).difference(trans);\n                                if (draggedElement.typeName == 'vertex') {\n                                    if (!_self.vertices[draggedElement.vindex].attr.draggable)\n                                        return;\n                                    _self.vertices[draggedElement.vindex].add(diff);\n                                    var draggingVertex = _self.vertices[draggedElement.vindex];\n                                    var fakeEvent = { isTouchEvent: true, params: { dragAmount: diff.clone(), wasDragged: true, mouseDownPos: touchDownPos.clone(), mouseDragPos: touchDownPos.clone().add(diff), vertex: draggingVertex } };\n                                    draggingVertex.listeners.fireDragEvent(fakeEvent);\n                                    _self.redraw();\n                                }\n                                touchMovePos = new Vertex_1.Vertex(rel);\n                            }\n                            else if (evt.touches.length == 2) {\n                                // If at least two fingers touch and move, then change the draw offset (panning).\n                                evt.preventDefault();\n                                evt.stopPropagation();\n                                _self.setOffset(_self.draw.offset.clone().addXY(evt.deltaX, evt.deltaY)); // Apply zoom?\n                                _self.redraw();\n                            }\n                        },\n                        touchEnd: function (evt) {\n                            // Note: e.touches.length is 0 here\n                            if (draggedElement && draggedElement.typeName == 'vertex') {\n                                var draggingVertex = _self.vertices[draggedElement.vindex];\n                                var fakeEvent = { isTouchEvent: true, params: { dragAmount: { x: 0, y: 0 }, wasDragged: false, mouseDownPos: touchDownPos.clone(), mouseDragPos: touchDownPos.clone(), vertex: draggingVertex } };\n                                // Check if vertex was moved\n                                if (touchMovePos && touchDownPos && touchDownPos.distance(touchMovePos) < 0.001) {\n                                    // if( e.touches.length == 1 && diff.x == 0 && diff.y == 0 ) {\n                                    draggingVertex.listeners.fireClickEvent(fakeEvent);\n                                }\n                                else {\n                                    draggingVertex.listeners.fireDragEndEvent(fakeEvent);\n                                }\n                            }\n                            clearTouch_1();\n                        },\n                        touchCancel: function (evt) {\n                            clearTouch_1();\n                        },\n                        multipointStart: function (evt) {\n                            multiTouchStartScale = _self.draw.scale.clone();\n                        },\n                        multipointEnd: function (evt) {\n                            multiTouchStartScale = null;\n                        },\n                        pinch: function (evt) {\n                            // For pinching there must be at least two touch items\n                            var fingerA = new Vertex_1.Vertex(evt.touches.item(0).clientX, evt.touches.item(0).clientY);\n                            var fingerB = new Vertex_1.Vertex(evt.touches.item(1).clientX, evt.touches.item(1).clientY);\n                            var center = new Line_1.Line(fingerA, fingerB).vertAt(0.5);\n                            _self.setZoom(multiTouchStartScale.x * evt.zoom, multiTouchStartScale.y * evt.zoom, center);\n                            _self.redraw();\n                        }\n                    });\n                }\n                catch (e) {\n                    console.error(\"Failed to initialize AlloyFinger!\");\n                    console.error(e);\n                }\n                ;\n            }\n            else if (globalThis[\"Touchy\"] && typeof globalThis[\"Touchy\"] == \"function\") {\n                console.error('[Deprecation] Found Touchy which is not supported any more. Please use AlloyFinger instead.');\n                // Convert absolute touch positions to relative DOM element position (relative to canvas)\n            }\n            else {\n                console.warn(\"Cannot initialize the touch handler. AlloyFinger is missig. Did you include it?\");\n            }\n        }\n        else {\n            _self.console.log('Touch interaction disabled.');\n        }\n        if (this.config.enableKeys) {\n            // Install key handler\n            this.keyHandler = new KeyHandler_1.KeyHandler({ trackAll: true })\n                .down('escape', function () {\n                _self.clearSelection(true);\n            })\n                .down('shift', function () {\n                _self.selectPolygon = new Polygon_1.Polygon();\n                _self.redraw();\n            })\n                .up('shift', function () {\n                // Find and select vertices in the drawn area\n                if (_self.selectPolygon == null)\n                    return;\n                _self.selectVerticesInPolygon(_self.selectPolygon);\n                _self.selectPolygon = null;\n                _self.redraw();\n            });\n        } // END IF enableKeys?\n        else {\n            _self.console.log('Keyboard interaction disabled.');\n        }\n    };\n    /**\n     * Creates a control GUI (a dat.gui instance) for this\n     * plot boilerplate instance.\n     *\n     * @method createGUI\n     * @instance\n     * @memberof PlotBoilerplate\n     * @return {dat.gui.GUI}\n     **/\n    PlotBoilerplate.prototype.createGUI = function () {\n        // This function moved to the helper utils.\n        // We do not want to include the whole dat.GUI package.\n        if (globalThis[\"utils\"] && typeof globalThis[\"utils\"].createGUI == \"function\")\n            return globalThis[\"utils\"].createGUI(this);\n        else\n            throw \"Cannot create dat.GUI instance; did you load the ./utils/creategui helper function an the dat.GUI library?\";\n    };\n    ;\n    var _a;\n    /** @constant {number} */\n    PlotBoilerplate.DEFAULT_CANVAS_WIDTH = 1024;\n    /** @constant {number} */\n    PlotBoilerplate.DEFAULT_CANVAS_HEIGHT = 768;\n    /** @constant {number} */\n    PlotBoilerplate.DEFAULT_CLICK_TOLERANCE = 8;\n    /** @constant {number} */\n    PlotBoilerplate.DEFAULT_TOUCH_TOLERANCE = 32;\n    /**\n     * A wrapper class for draggable items (mostly vertices).\n     * @private\n     **/\n    PlotBoilerplate.Draggable = (_a = /** @class */ (function () {\n            function class_1(item, typeName) {\n                this.item = item;\n                this.typeName = typeName;\n            }\n            ;\n            class_1.prototype.isVertex = function () { return this.typeName == PlotBoilerplate.Draggable.VERTEX; };\n            ;\n            class_1.prototype.setVIndex = function (vindex) { this.vindex = vindex; return this; };\n            ;\n            return class_1;\n        }()),\n        _a.VERTEX = 'vertex',\n        _a);\n    /**\n     * A set of helper functions.\n     **/\n    PlotBoilerplate.utils = {\n        /**\n         * Merge the elements in the 'extension' object into the 'base' object based on\n         * the keys of 'base'.\n         *\n         * @param {Object} base\n         * @param {Object} extension\n         * @return {Object} base extended by the new attributes.\n         **/\n        safeMergeByKeys: function (base, extension) {\n            for (var k in extension) {\n                if (!extension.hasOwnProperty(k))\n                    continue;\n                if (base.hasOwnProperty(k)) {\n                    var typ = typeof base[k];\n                    try {\n                        if (typ == 'boolean')\n                            base[k] = !!JSON.parse(extension[k]);\n                        else if (typ == 'number')\n                            base[k] = JSON.parse(extension[k]) * 1;\n                        else if (typ == 'function' && typeof extension[k] == 'function')\n                            base[k] = extension[k];\n                        else\n                            base[k] = extension[k];\n                    }\n                    catch (e) {\n                        console.error('error in key ', k, extension[k], e);\n                    }\n                }\n                else {\n                    base[k] = extension[k];\n                }\n            }\n            return base;\n        },\n        /**\n         * A helper function to scale elements (usually the canvas) using CSS.\n         *\n         * transform-origin is at (0,0).\n         *\n         * @param {HTMLElement} element - The DOM element to scale.\n         * @param {number} scaleX The - X scale factor.\n         * @param {number} scaleY The - Y scale factor.\n         * @return {void}\n         **/\n        setCSSscale: function (element, scaleX, scaleY) {\n            element.style['transform-origin'] = '0 0';\n            if (scaleX == 1.0 && scaleY == 1.0)\n                element.style.transform = null;\n            else\n                element.style.transform = 'scale(' + scaleX + ',' + scaleY + ')';\n        },\n        // A helper for fetching data from objects.\n        fetch: {\n            /**\n             * A helper function to the the object property value specified by the given key.\n             *\n             * @param {any} object   - The object to get the property's value from. Must not be null.\n             * @param {string} key      - The key of the object property (the name).\n             * @param {any}    fallback - A default value if the key does not exist.\n             **/\n            val: function (obj, key, fallback) {\n                if (!obj.hasOwnProperty(key))\n                    return fallback;\n                if (typeof obj[key] == 'undefined')\n                    return fallback;\n                return obj[key];\n            },\n            /**\n             * A helper function to the the object property numeric value specified by the given key.\n             *\n             * @param {any}    object   - The object to get the property's value from. Must not be null.\n             * @param {string} key      - The key of the object property (the name).\n             * @param {number} fallback - A default value if the key does not exist.\n             * @return {number}\n             **/\n            num: function (obj, key, fallback) {\n                if (!obj.hasOwnProperty(key))\n                    return fallback;\n                if (typeof obj[key] === 'number')\n                    return obj[key];\n                else {\n                    try {\n                        return JSON.parse(obj[key]) * 1;\n                    }\n                    catch (e) {\n                        return fallback;\n                    }\n                }\n            },\n            /**\n             * A helper function to the the object property boolean value specified by the given key.\n             *\n             * @param {any}     object   - The object to get the property's value from. Must not be null.\n             * @param {string}  key      - The key of the object property (the name).\n             * @param {boolean} fallback - A default value if the key does not exist.\n             * @return {boolean}\n             **/\n            bool: function (obj, key, fallback) {\n                if (!obj.hasOwnProperty(key))\n                    return fallback;\n                if (typeof obj[key] == 'boolean')\n                    return obj[key];\n                else {\n                    try {\n                        return !!JSON.parse(obj[key]);\n                    }\n                    catch (e) {\n                        return fallback;\n                    }\n                }\n            },\n            /**\n             * A helper function to the the object property function-value specified by the given key.\n             *\n             * @param {any}      object   - The object to get the property's value from. Must not be null.\n             * @param {string}   key      - The key of the object property (the name).\n             * @param {function} fallback - A default value if the key does not exist.\n             * @return {function}\n             **/\n            func: function (obj, key, fallback) {\n                if (!obj.hasOwnProperty(key))\n                    return fallback;\n                if (typeof obj[key] !== 'function')\n                    return fallback;\n                return obj[key];\n            }\n        },\n        /**\n         * Installs vertex listeners to the path's vertices so that controlpoints\n         * move with their path points when dragged.\n         *\n         * Bézier path points with attr.bezierAutoAdjust==true will have their\n         * two control points audo-updated if moved, too (keep path connections smooth).\n         *\n         * @param {BezierPath} bezierPath - The path to use auto-adjustment for.\n         **/\n        enableBezierPathAutoAdjust: function (bezierPath) {\n            for (var i = 0; i < bezierPath.bezierCurves.length; i++) {\n                // This should be wrapped into the BezierPath implementation.\n                bezierPath.bezierCurves[i].startPoint.listeners.addDragListener(function (e) {\n                    var cindex = bezierPath.locateCurveByStartPoint(e.params.vertex);\n                    bezierPath.bezierCurves[cindex].startPoint.addXY(-e.params.dragAmount.x, -e.params.dragAmount.y);\n                    bezierPath.moveCurvePoint(cindex * 1, bezierPath.START_POINT, e.params.dragAmount);\n                    bezierPath.updateArcLengths();\n                });\n                bezierPath.bezierCurves[i].startControlPoint.listeners.addDragListener(function (e) {\n                    var cindex = bezierPath.locateCurveByStartControlPoint(e.params.vertex);\n                    if (!bezierPath.bezierCurves[cindex].startPoint.attr.bezierAutoAdjust)\n                        return;\n                    bezierPath.adjustPredecessorControlPoint(cindex * 1, true, // obtain handle length?\n                    false // update arc lengths\n                    );\n                    bezierPath.updateArcLengths();\n                });\n                bezierPath.bezierCurves[i].endControlPoint.listeners.addDragListener(function (e) {\n                    var cindex = bezierPath.locateCurveByEndControlPoint(e.params.vertex);\n                    if (!bezierPath.bezierCurves[cindex % bezierPath.bezierCurves.length].endPoint.attr.bezierAutoAdjust)\n                        return;\n                    bezierPath.adjustSuccessorControlPoint(cindex * 1, true, // obtain handle length?\n                    false // update arc lengths\n                    );\n                    bezierPath.updateArcLengths();\n                });\n                if (i + 1 == bezierPath.bezierCurves.length) { // && !bezierPath.adjustCircular ) { \n                    // Move last control point with the end point (if not circular)\n                    bezierPath.bezierCurves[bezierPath.bezierCurves.length - 1].endPoint.listeners.addDragListener(function (e) {\n                        if (!bezierPath.adjustCircular) {\n                            var cindex = bezierPath.locateCurveByEndPoint(e.params.vertex);\n                            bezierPath.moveCurvePoint(cindex * 1, bezierPath.END_CONTROL_POINT, new Vertex_1.Vertex({ x: e.params.dragAmount.x, y: e.params.dragAmount.y }));\n                        }\n                        bezierPath.updateArcLengths();\n                    });\n                }\n            } // END for\n        }\n    }; // END utils\n    return PlotBoilerplate;\n}()); // END class PlotBoilerplate\nexports.PlotBoilerplate = PlotBoilerplate;\n//# sourceMappingURL=PlotBoilerplate.js.map","\"use strict\";\n/**\n * @author   Ikaros Kappler\n * @date     2018-04-14\n * @modified 2018-11-17 Added the containsVert function.\n * @modified 2018-12-04 Added the toSVGString function.\n * @modified 2019-03-20 Added JSDoc tags.\n * @modified 2019-10-25 Added the scale function.\n * @modified 2019-11-06 JSDoc update.\n * @modified 2019-11-07 Added toCubicBezierPath(number) function.\n * @modified 2019-11-22 Added the rotate(number,Vertex) function.\n * @modified 2020-03-24 Ported this class from vanilla-JS to Typescript.\n * @modified 2020-10-30 Added the `addVertex` function.\n * @modified 2020-10-31 Added the `getVertexAt` function.\n * @modified 2020-11-06 Added the `move` function.\n * @modified 2020-11-10 Added the `getBounds` function.\n * @modified 2020-11-11 Generalized `move(Vertex)` to `move(XYCoords)`.\n * @modified 2021-01-20 Added UID.\n * @modified 2021-01-29 Added the `signedArea` function (was global function in the demos before).\n * @modified 2021-01-29 Added the `isClockwise` function.\n * @modified 2021-01-29 Added the `area` function.\n * @modified 2021-01-29 Changed the param type for `containsVert` from Vertex to XYCoords.\n * @version 1.7.0\n *\n * @file Polygon\n * @public\n **/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Polygon = void 0;\nvar BezierPath_1 = require(\"./BezierPath\");\nvar Bounds_1 = require(\"./Bounds\");\nvar UIDGenerator_1 = require(\"./UIDGenerator\");\nvar Vertex_1 = require(\"./Vertex\");\n/**\n * @classdesc A polygon class. Any polygon consists of an array of vertices; polygons can be open or closed.\n *\n * @requires BezierPath\n * @requires Bounds\n * @requires SVGSerializabe\n * @requires UID\n * @requires UIDGenerator\n * @requires Vertex\n * @requires XYCoords\n */\nvar Polygon = /** @class */ (function () {\n    /**\n     * The constructor.\n     *\n     * @constructor\n     * @name Polygon\n     * @param {Vertex[]} vertices - An array of 2d vertices that shape the polygon.\n     * @param {boolean} isOpen - Indicates if the polygon should be rendered as an open or closed shape.\n     **/\n    function Polygon(vertices, isOpen) {\n        /**\n         * Required to generate proper CSS classes and other class related IDs.\n         **/\n        this.className = \"Polygon\";\n        this.uid = UIDGenerator_1.UIDGenerator.next();\n        if (typeof vertices == 'undefined')\n            vertices = [];\n        this.vertices = vertices;\n        this.isOpen = isOpen;\n    }\n    ;\n    /**\n     * Add a vertex to the end of the `vertices` array.\n     *\n     * @method addVert\n     * @param {Vertex} vert - The vertex to add.\n     * @instance\n     * @memberof Polygon\n     **/\n    Polygon.prototype.addVertex = function (vert) {\n        this.vertices.push(vert);\n    };\n    ;\n    /**\n     * Get the polygon vertex at the given position (index).\n     *\n     * The index may exceed the total vertex count, and will be wrapped around then (modulo).\n     *\n     * For k >= 0:\n     *  - getVertexAt( vertices.length )     == getVertexAt( 0 )\n     *  - getVertexAt( vertices.length + k ) == getVertexAt( k )\n     *  - getVertexAt( -k )                  == getVertexAt( vertices.length -k )\n     *\n     * @metho getVertexAt\n     * @param {number} index - The index of the desired vertex.\n     * @instance\n     * @memberof Polygon\n     * @return {Vertex} At the given index.\n     **/\n    Polygon.prototype.getVertexAt = function (index) {\n        if (index < 0)\n            return this.vertices[this.vertices.length - (Math.abs(index) % this.vertices.length)];\n        else\n            return this.vertices[index % this.vertices.length];\n    };\n    ;\n    /**\n     * Move the polygon's vertices by the given amount.\n     *\n     * @method move\n     * @param {XYCoords} amount - The amount to move.\n     * @instance\n     * @memberof Polygon\n     * @return {Polygon} this for chaining\n     **/\n    Polygon.prototype.move = function (vert) {\n        for (var i in this.vertices) {\n            this.vertices[i].add(vert);\n        }\n        return this;\n    };\n    ;\n    /**\n     * Check if the given vertex is inside this polygon.<br>\n     * <br>\n     * Ray-casting algorithm found at<br>\n     *    https://stackoverflow.com/questions/22521982/check-if-point-inside-a-polygon\n     *\n     * @method containsVert\n     * @param {XYCoords} vert - The vertex to check. The new x-component.\n     * @return {boolean} True if the passed vertex is inside this polygon. The polygon is considered closed.\n     * @instance\n     * @memberof Polygon\n     **/\n    Polygon.prototype.containsVert = function (vert) {\n        // ray-casting algorithm based on\n        //    http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html\n        var inside = false;\n        for (var i = 0, j = this.vertices.length - 1; i < this.vertices.length; j = i++) {\n            var xi = this.vertices[i].x, yi = this.vertices[i].y;\n            var xj = this.vertices[j].x, yj = this.vertices[j].y;\n            var intersect = ((yi > vert.y) != (yj > vert.y))\n                && (vert.x < (xj - xi) * (vert.y - yi) / (yj - yi) + xi);\n            if (intersect)\n                inside = !inside;\n        }\n        return inside;\n    };\n    ;\n    /**\n     * Calculate the area of the given polygon (unsigned).\n     *\n     * Note that this does not work for self-intersecting polygons.\n     *\n     * @method area\n     * @instance\n     * @memberof Polygon\n     * @return {number}\n     */\n    Polygon.prototype.area = function () {\n        return Polygon.utils.area(this.vertices);\n    };\n    ;\n    /**\n     * Calulate the signed polyon area by interpreting the polygon as a matrix\n     * and calculating its determinant.\n     *\n     * @method signedArea\n     * @instance\n     * @memberof Polygon\n     * @return {number}\n     */\n    Polygon.prototype.signedArea = function () {\n        return Polygon.utils.signedArea(this.vertices);\n    };\n    ;\n    /**\n     * Get the winding order of this polgon: clockwise or counterclockwise.\n     *\n     * @method isClockwise\n     * @instance\n     * @memberof Polygon\n     * @return {boolean}\n     */\n    Polygon.prototype.isClockwise = function () {\n        return Polygon.utils.signedArea(this.vertices) < 0;\n    };\n    ;\n    /**\n     * Scale the polygon relative to the given center.\n     *\n     * @method scale\n     * @param {number} factor - The scale factor.\n     * @param {Vertex} center - The center of scaling.\n     * @return {Polygon} this, for chaining.\n     * @instance\n     * @memberof Polygon\n     **/\n    Polygon.prototype.scale = function (factor, center) {\n        for (var i in this.vertices) {\n            if (typeof this.vertices[i].scale == 'function')\n                this.vertices[i].scale(factor, center);\n            else\n                console.log('There seems to be a null vertex!', this.vertices[i]);\n        }\n        return this;\n    };\n    ;\n    /**\n     * Rotate the polygon around the given center.\n     *\n     * @method rotate\n     * @param {number} angle  - The rotation angle.\n     * @param {Vertex} center - The center of rotation.\n     * @instance\n     * @memberof Polygon\n     * @return {Polygon} this, for chaining.\n     **/\n    Polygon.prototype.rotate = function (angle, center) {\n        for (var i in this.vertices) {\n            this.vertices[i].rotate(angle, center);\n        }\n        return this;\n    };\n    ;\n    /**\n     * Get the bounding box (bounds) of this polygon.\n     *\n     * @method getBounds\n     * @instance\n     * @memberof Polygon\n     * @return {Bounds} The rectangular bounds of this polygon.\n     **/\n    Polygon.prototype.getBounds = function () {\n        return Bounds_1.Bounds.computeFromVertices(this.vertices);\n    };\n    ;\n    /**\n     * Convert this polygon to a sequence of quadratic Bézier curves.<br>\n     * <br>\n     * The first vertex in the returned array is the start point.<br>\n     * The following sequence are pairs of control-point-and-end-point:\n     * <pre>startPoint, controlPoint0, pathPoint1, controlPoint1, pathPoint2, controlPoint2, ..., endPoint</pre>\n     *\n     * @method toQuadraticBezierData\n     * @return {Vertex[]}  An array of 2d vertices that shape the quadratic Bézier curve.\n     * @instance\n     * @memberof Polygon\n     **/\n    Polygon.prototype.toQuadraticBezierData = function () {\n        if (this.vertices.length < 3)\n            return [];\n        var qbezier = [];\n        var cc0 = this.vertices[0];\n        var cc1 = this.vertices[1];\n        var edgeCenter = new Vertex_1.Vertex(cc0.x + (cc1.x - cc0.x) / 2, cc0.y + (cc1.y - cc0.y) / 2);\n        qbezier.push(edgeCenter);\n        var limit = this.isOpen ? this.vertices.length : this.vertices.length + 1;\n        for (var t = 1; t < limit; t++) {\n            cc0 = this.vertices[t % this.vertices.length];\n            cc1 = this.vertices[(t + 1) % this.vertices.length];\n            var edgeCenter = new Vertex_1.Vertex(cc0.x + (cc1.x - cc0.x) / 2, cc0.y + (cc1.y - cc0.y) / 2);\n            qbezier.push(cc0);\n            qbezier.push(edgeCenter);\n            cc0 = cc1;\n        }\n        return qbezier;\n    };\n    ;\n    /**\n     * Convert this polygon to a quadratic bezier curve, represented as an SVG data string.\n     *\n     * @method toQuadraticBezierSVGString\n     * @return {string} The 'd' part for an SVG 'path' element.\n     * @instance\n     * @memberof Polygon\n     **/\n    Polygon.prototype.toQuadraticBezierSVGString = function () {\n        var qdata = this.toQuadraticBezierData();\n        if (qdata.length == 0)\n            return \"\";\n        var buffer = ['M ' + qdata[0].x + ' ' + qdata[0].y];\n        for (var i = 1; i < qdata.length; i += 2) {\n            buffer.push('Q ' + qdata[i].x + ' ' + qdata[i].y + ', ' + qdata[i + 1].x + ' ' + qdata[i + 1].y);\n        }\n        return buffer.join(' ');\n    };\n    ;\n    /**\n     * Convert this polygon to a sequence of cubic Bézier curves.<br>\n     * <br>\n     * The first vertex in the returned array is the start point.<br>\n     * The following sequence are triplets of (first-control-point, secnond-control-point, end-point):<br>\n     * <pre>startPoint, controlPoint0_0, controlPoint1_1, pathPoint1, controlPoint1_0, controlPoint1_1, ..., endPoint</pre>\n     *\n     * @method toCubicBezierData\n     * @param {number=} threshold - An optional threshold (default=1.0) how strong the curve segments\n     *                              should over-/under-drive. Should be between 0.0 and 1.0 for best\n     *                              results but other values are allowed.\n     * @return {Vertex[]}  An array of 2d vertices that shape the cubic Bézier curve.\n     * @instance\n     * @memberof Polygon\n     **/\n    Polygon.prototype.toCubicBezierData = function (threshold) {\n        if (typeof threshold == 'undefined')\n            threshold = 1.0;\n        if (this.vertices.length < 3)\n            return [];\n        var cbezier = [];\n        var a = this.vertices[0];\n        var b = this.vertices[1];\n        var edgeCenter = new Vertex_1.Vertex(a.x + (b.x - a.x) / 2, a.y + (b.y - a.y) / 2);\n        cbezier.push(edgeCenter);\n        var limit = this.isOpen ? this.vertices.length - 1 : this.vertices.length;\n        for (var t = 0; t < limit; t++) {\n            var a = this.vertices[t % this.vertices.length];\n            var b = this.vertices[(t + 1) % this.vertices.length];\n            var c = this.vertices[(t + 2) % this.vertices.length];\n            var aCenter = new Vertex_1.Vertex(a.x + (b.x - a.x) / 2, a.y + (b.y - a.y) / 2);\n            var bCenter = new Vertex_1.Vertex(b.x + (c.x - b.x) / 2, b.y + (c.y - b.y) / 2);\n            var a2 = new Vertex_1.Vertex(aCenter.x + (b.x - aCenter.x) * threshold, aCenter.y + (b.y - aCenter.y) * threshold);\n            var b0 = new Vertex_1.Vertex(bCenter.x + (b.x - bCenter.x) * threshold, bCenter.y + (b.y - bCenter.y) * threshold);\n            cbezier.push(a2);\n            cbezier.push(b0);\n            cbezier.push(bCenter);\n        }\n        return cbezier;\n    };\n    ;\n    /**\n     * Convert this polygon to a cubic bezier curve, represented as an SVG data string.\n     *\n     * @method toCubicBezierSVGString\n     * @return {string} The 'd' part for an SVG 'path' element.\n     * @instance\n     * @memberof Polygon\n     **/\n    Polygon.prototype.toCubicBezierSVGString = function (threshold) {\n        var qdata = this.toCubicBezierData(threshold);\n        if (qdata.length == 0)\n            return \"\";\n        var buffer = ['M ' + qdata[0].x + ' ' + qdata[0].y];\n        for (var i = 1; i < qdata.length; i += 3) {\n            buffer.push('C ' + qdata[i].x + ' ' + qdata[i].y + ', ' + qdata[i + 1].x + ' ' + qdata[i + 1].y + ', ' + qdata[i + 2].x + ' ' + qdata[i + 2].y);\n        }\n        return buffer.join(' ');\n    };\n    ;\n    /**\n     * Convert this polygon to a cubic bezier path instance.\n     *\n     * @method toCubicBezierPath\n     * @param {number} threshold - The threshold, usually from 0.0 to 1.0.\n     * @return {BezierPath}      - A bezier path instance.\n     * @instance\n     * @memberof Polygon\n     **/\n    Polygon.prototype.toCubicBezierPath = function (threshold) {\n        var qdata = this.toCubicBezierData(threshold);\n        // Conver the linear path vertices to a two-dimensional path array\n        var pathdata = [];\n        for (var i = 0; i + 3 < qdata.length; i += 3) {\n            pathdata.push([qdata[i], qdata[i + 3], qdata[i + 1], qdata[i + 2]]);\n        }\n        return BezierPath_1.BezierPath.fromArray(pathdata);\n    };\n    ;\n    /**\n     * Create an SVG representation of this polygon.\n     *\n     * @deprecated DEPRECATION Please use the drawutilssvg library and an XMLSerializer instead.\n     * @method toSVGString\n     * @param {object=} options - An optional set of options, like 'className'.\n     * @return {string} The SVG string.\n     * @instance\n     * @memberof Polygon\n     **/\n    Polygon.prototype.toSVGString = function (options) {\n        options = options || {};\n        var buffer = [];\n        buffer.push('<path');\n        if (options.className)\n            buffer.push(' class=\"' + options.className + '\"');\n        buffer.push(' d=\"');\n        if (this.vertices.length > 0) {\n            buffer.push('M ');\n            buffer.push(this.vertices[0].x.toString());\n            buffer.push(' ');\n            buffer.push(this.vertices[0].y.toString());\n            for (var i = 1; i < this.vertices.length; i++) {\n                buffer.push(' L ');\n                buffer.push(this.vertices[i].x.toString());\n                buffer.push(' ');\n                buffer.push(this.vertices[i].y.toString());\n            }\n            if (!this.isOpen) {\n                buffer.push(' Z');\n            }\n        }\n        buffer.push('\" />');\n        return buffer.join('');\n    };\n    ;\n    Polygon.utils = {\n        /**\n         * Calculate the area of the given polygon (unsigned).\n         *\n         * Note that this does not work for self-intersecting polygons.\n         *\n         * @name area\n         * @return {number}\n         */\n        area: function (vertices) {\n            // Found at:\n            //    https://stackoverflow.com/questions/16285134/calculating-polygon-area\n            var total = 0.0;\n            for (var i = 0, l = vertices.length; i < l; i++) {\n                var addX = vertices[i].x;\n                var addY = vertices[(i + 1) % l].y;\n                var subX = vertices[(i + 1) % l].x;\n                var subY = vertices[i].y;\n                total += (addX * addY * 0.5);\n                total -= (subX * subY * 0.5);\n            }\n            return Math.abs(total);\n        },\n        /**\n         * Calulate the signed polyon area by interpreting the polygon as a matrix\n         * and calculating its determinant.\n         *\n         * @name signedArea\n         * @return {number}\n         */\n        signedArea: function (vertices) {\n            var sum = 0;\n            var n = vertices.length;\n            for (var i = 0; i < n; i++) {\n                var j = (i + 1) % n;\n                sum += (vertices[j].x - vertices[i].x) * (vertices[i].y + vertices[j].y);\n            }\n            return sum;\n        }\n    };\n    return Polygon;\n}());\nexports.Polygon = Polygon;\n//# sourceMappingURL=Polygon.js.map","\"use strict\";\n/**\n * @author    Ikaros Kappler\n * @date_init 2012-10-17 (Wrote a first version of this in that year).\n * @date      2018-04-03 (Refactored the code into a new class).\n * @modified  2018-04-28 Added some documentation.\n * @modified  2019-09-11 Added the scaleToCentroid(Number) function (used by the walking triangle demo).\n * @modified  2019-09-12 Added beautiful JSDoc compliable comments.\n * @modified  2019-11-07 Added to toSVG(options) function to make Triangles renderable as SVG.\n * @modified  2019-12-09 Fixed the determinant() function. The calculation was just wrong.\n * @modified  2020-03-16 (Corona times) Added the 'fromArray' function.\n * @modified  2020-03-17 Added the Triangle.toPolygon() function.\n * @modified  2020-03-17 Added proper JSDoc comments.\n * @modified  2020-03-25 Ported this class from vanilla-JS to Typescript.\n * @modified  2020-05-09 Added the new Circle class (ported to Typescript from the demos).\n * @modified  2020-05-12 Added getIncircularTriangle() function.\n * @modified  2020-05-12 Added getIncircle() function.\n * @modified  2020-05-12 Fixed the signature of getCircumcirle(). Was still a generic object.\n * @modified  2020-06-18 Added the `getIncenter` function.\n * @modified  2020-12-28 Added the `getArea` function.\n * @modified  2021-01-20 Added UID.\n * @modified  2021-01-22 Always updating circumcircle when retieving it.\n * @version   2.5.1\n *\n * @file Triangle\n * @fileoverview A simple triangle class: three vertices.\n * @public\n **/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Triangle = void 0;\nvar Bounds_1 = require(\"./Bounds\");\nvar Circle_1 = require(\"./Circle\");\nvar Line_1 = require(\"./Line\");\nvar Polygon_1 = require(\"./Polygon\");\nvar UIDGenerator_1 = require(\"./UIDGenerator\");\nvar Vertex_1 = require(\"./Vertex\");\nvar geomutils_1 = require(\"./geomutils\");\n/**\n * @classdesc A triangle class for triangulations.\n *\n * The class was written for a Delaunay trinagulation demo so it might\n * contain some strange and unexpected functions.\n *\n * @requires Bounds\n * @requires Circle\n * @requires Line\n * @requires Vertex\n * @requires Polygon\n * @requires SVGSerializale\n * @requires UID\n * @requires UIDGenerator\n * @requires geomutils\n *\n */\nvar Triangle = /** @class */ (function () {\n    /**\n     * The constructor.\n     *\n     * @constructor\n     * @name Triangle\n     * @param {Vertex} a - The first vertex of the triangle.\n     * @param {Vertex} b - The second vertex of the triangle.\n     * @param {Vertex} c - The third vertex of the triangle.\n     **/\n    function Triangle(a, b, c) {\n        /**\n         * Required to generate proper CSS classes and other class related IDs.\n         **/\n        this.className = \"Triangle\";\n        this.uid = UIDGenerator_1.UIDGenerator.next();\n        this.a = a;\n        this.b = b;\n        this.c = c;\n        this.calcCircumcircle();\n    }\n    /**\n     * Create a new triangle from the given array of vertices.\n     *\n     * The array must have at least three vertices, otherwise an error will be raised.\n     * This function will not create copies of the vertices.\n     *\n     * @method fromArray\n     * @static\n     * @param {Array<Vertex>} arr - The required array with at least three vertices.\n     * @memberof Vertex\n     * @return {Triangle}\n     **/\n    Triangle.fromArray = function (arr) {\n        if (arr.length < 3)\n            throw \"Cannot create triangle from array with less than three vertices (\" + arr.length + \")\";\n        return new Triangle(arr[0], arr[1], arr[2]);\n    };\n    ;\n    /**\n     * Get the area of this triangle. The returned area is never negative.\n     *\n     * If you are interested in the signed area, please consider using the\n     * `Triangle.utils.signedArea` helper function. This method just returns\n     * the absolute value of the signed area.\n     *\n     * @method getArea\n     * @instance\n     * @memberof Triangle\n     * @return {number} The non-negative area of this triangle.\n     */\n    Triangle.prototype.getArea = function () {\n        return Math.abs(Triangle.utils.signedArea(this.a.x, this.a.y, this.b.x, this.b.y, this.c.x, this.c.y));\n    };\n    ;\n    /**\n     * Get the centroid of this triangle.\n     *\n     * The centroid is the average midpoint for each side.\n     *\n     * @method getCentroid\n     * @return {Vertex} The centroid\n     * @instance\n     * @memberof Triangle\n     **/\n    Triangle.prototype.getCentroid = function () {\n        return new Vertex_1.Vertex((this.a.x + this.b.x + this.c.x) / 3, (this.a.y + this.b.y + this.c.y) / 3);\n    };\n    ;\n    /**\n     * Scale the triangle towards its centroid.\n     *\n     * @method scaleToCentroid\n     * @param {number} - The scale factor to use. That can be any scalar.\n     * @return {Triangle} this (for chaining)\n     * @instance\n     * @memberof Triangle\n     */\n    Triangle.prototype.scaleToCentroid = function (factor) {\n        var centroid = this.getCentroid();\n        this.a.scale(factor, centroid);\n        this.b.scale(factor, centroid);\n        this.c.scale(factor, centroid);\n        return this;\n    };\n    ;\n    /**\n     * Get the circumcircle of this triangle.\n     *\n     * The circumcircle is that unique circle on which all three\n     * vertices of this triangle are located on.\n     *\n     * Please note that for performance reasons any changes to vertices will not reflect in changes\n     * of the circumcircle (center or radius). Please call the calcCirumcircle() function\n     * after triangle vertex changes.\n     *\n     * @method getCircumcircle\n     * @return {Object} - { center:Vertex, radius:float }\n     * @instance\n     * @memberof Triangle\n     */\n    Triangle.prototype.getCircumcircle = function () {\n        // if( !this.center || !this.radius ) \n        this.calcCircumcircle();\n        return new Circle_1.Circle(this.center.clone(), this.radius);\n    };\n    ;\n    /**\n     * Check if this triangle and the passed triangle share an\n     * adjacent edge.\n     *\n     * For edge-checking Vertex.equals is used which uses an\n     * an epsilon for comparison.\n     *\n     * @method isAdjacent\n     * @param {Triangle} tri - The second triangle to check adjacency with.\n     * @return {boolean} - True if this and the passed triangle have at least one common edge.\n     * @instance\n     * @memberof Triangle\n     */\n    Triangle.prototype.isAdjacent = function (tri) {\n        var a = this.a.equals(tri.a) || this.a.equals(tri.b) || this.a.equals(tri.c);\n        var b = this.b.equals(tri.a) || this.b.equals(tri.b) || this.b.equals(tri.c);\n        var c = this.c.equals(tri.a) || this.c.equals(tri.b) || this.c.equals(tri.c);\n        return (a && b) || (a && c) || (b && c);\n    };\n    ;\n    /**\n     * Get that vertex of this triangle (a,b,c) that is not vert1 nor vert2 of\n     * the passed two.\n     *\n     * @method getThirdVertex\n     * @param {Vertex} vert1 - The first vertex.\n     * @param {Vertex} vert2 - The second vertex.\n     * @return {Vertex} - The third vertex of this triangle that makes up the whole triangle with vert1 and vert2.\n     * @instance\n     * @memberof Triangle\n     */\n    Triangle.prototype.getThirdVertex = function (vert1, vert2) {\n        if (this.a.equals(vert1) && this.b.equals(vert2) || this.a.equals(vert2) && this.b.equals(vert1))\n            return this.c;\n        if (this.b.equals(vert1) && this.c.equals(vert2) || this.b.equals(vert2) && this.c.equals(vert1))\n            return this.a;\n        //if( this.c.equals(vert1) && this.a.equals(vert2) || this.c.equals(vert2) && this.a.equals(vert1) )\n        return this.b;\n    };\n    ;\n    /**\n     * Re-compute the circumcircle of this triangle (if the vertices\n     * have changed).\n     *\n     * The circumcenter and radius are stored in this.center and\n     * this.radius. There is a third result: radius_squared (for internal computations).\n     *\n     * @method calcCircumcircle\n     * @return void\n     * @instance\n     * @memberof Triangle\n     */\n    Triangle.prototype.calcCircumcircle = function () {\n        // From\n        //    http://www.exaflop.org/docs/cgafaq/cga1.html\n        var A = this.b.x - this.a.x;\n        var B = this.b.y - this.a.y;\n        var C = this.c.x - this.a.x;\n        var D = this.c.y - this.a.y;\n        var E = A * (this.a.x + this.b.x) + B * (this.a.y + this.b.y);\n        var F = C * (this.a.x + this.c.x) + D * (this.a.y + this.c.y);\n        var G = 2.0 * (A * (this.c.y - this.b.y) - B * (this.c.x - this.b.x));\n        var dx, dy;\n        if (Math.abs(G) < Triangle.EPSILON) {\n            // Collinear - find extremes and use the midpoint\n            var bounds = this.bounds();\n            this.center = new Vertex_1.Vertex((bounds.min.x + bounds.max.x) / 2, (bounds.min.y + bounds.max.y) / 2);\n            dx = this.center.x - bounds.min.x;\n            dy = this.center.y - bounds.min.y;\n        }\n        else {\n            var cx = (D * E - B * F) / G;\n            var cy = (A * F - C * E) / G;\n            this.center = new Vertex_1.Vertex(cx, cy);\n            dx = this.center.x - this.a.x;\n            dy = this.center.y - this.a.y;\n        }\n        this.radius_squared = dx * dx + dy * dy;\n        this.radius = Math.sqrt(this.radius_squared);\n    };\n    ; // END calcCircumcircle\n    /**\n     * Check if the passed vertex is inside this triangle's\n     * circumcircle.\n     *\n     * @method inCircumcircle\n     * @param {Vertex} v - The vertex to check.\n     * @return {boolean}\n     * @instance\n     * @memberof Triangle\n     */\n    Triangle.prototype.inCircumcircle = function (v) {\n        var dx = this.center.x - v.x;\n        var dy = this.center.y - v.y;\n        var dist_squared = dx * dx + dy * dy;\n        return (dist_squared <= this.radius_squared);\n    };\n    ;\n    /**\n     * Get the rectangular bounds for this triangle.\n     *\n     * @method bounds\n     * @return {Bounds} - The min/max bounds of this triangle.\n     * @instance\n     * @memberof Triangle\n     */\n    Triangle.prototype.bounds = function () {\n        return new Bounds_1.Bounds(new Vertex_1.Vertex(Triangle.utils.min3(this.a.x, this.b.x, this.c.x), Triangle.utils.min3(this.a.y, this.b.y, this.c.y)), new Vertex_1.Vertex(Triangle.utils.max3(this.a.x, this.b.x, this.c.x), Triangle.utils.max3(this.a.y, this.b.y, this.c.y)));\n    };\n    ;\n    /**\n     * Convert this triangle to a polygon instance.\n     *\n     * Plase note that this conversion does not perform a deep clone.\n     *\n     * @method toPolygon\n     * @return {Polygon} A new polygon representing this triangle.\n     * @instance\n     * @memberof Triangle\n     **/\n    Triangle.prototype.toPolygon = function () {\n        return new Polygon_1.Polygon([this.a, this.b, this.c]);\n    };\n    ;\n    /**\n     * Get the determinant of this triangle.\n     *\n     * @method determinant\n     * @return {number} - The determinant (float).\n     * @instance\n     * @memberof Triangle\n     */\n    Triangle.prototype.determinant = function () {\n        // (b.y - a.y)*(c.x - b.x) - (c.y - b.y)*(b.x - a.x);\n        return (this.b.y - this.a.y) * (this.c.x - this.b.x) - (this.c.y - this.b.y) * (this.b.x - this.a.x);\n    };\n    ;\n    /**\n     * Checks if the passed vertex (p) is inside this triangle.\n     *\n     * Note: matrix determinants rock.\n     *\n     * @method containsPoint\n     * @param {Vertex} p - The vertex to check.\n     * @return {boolean}\n     * @instance\n     * @memberof Triangle\n     */\n    Triangle.prototype.containsPoint = function (p) {\n        return Triangle.utils.pointIsInTriangle(p.x, p.y, this.a.x, this.a.y, this.b.x, this.b.y, this.c.x, this.c.y);\n    };\n    ;\n    /**\n     * Get that inner triangle which defines the maximal incircle.\n     *\n     * @return {Triangle} The triangle of those points in this triangle that define the incircle.\n     */\n    Triangle.prototype.getIncircularTriangle = function () {\n        var lineA = new Line_1.Line(this.a, this.b);\n        var lineB = new Line_1.Line(this.b, this.c);\n        var lineC = new Line_1.Line(this.c, this.a);\n        var bisector1 = geomutils_1.geomutils.nsectAngle(this.b, this.a, this.c, 2)[0]; // bisector of first angle (in b)\n        var bisector2 = geomutils_1.geomutils.nsectAngle(this.c, this.b, this.a, 2)[0]; // bisector of second angle (in c)\n        var intersection = bisector1.intersection(bisector2);\n        // Find the closest points on one of the polygon lines (all have same distance by construction)\n        var circleIntersA = lineA.getClosestPoint(intersection);\n        var circleIntersB = lineB.getClosestPoint(intersection);\n        var circleIntersC = lineC.getClosestPoint(intersection);\n        return new Triangle(circleIntersA, circleIntersB, circleIntersC);\n    };\n    ;\n    /**\n     * Get the incircle of this triangle. That is the circle that touches each side\n     * of this triangle in exactly one point.\n     *\n     * Note this just calls getIncircularTriangle().getCircumcircle()\n     *\n     * @return {Circle} The incircle of this triangle.\n     */\n    Triangle.prototype.getIncircle = function () {\n        return this.getIncircularTriangle().getCircumcircle();\n    };\n    ;\n    /**\n     * Get the incenter of this triangle (which is the center of the circumcircle).\n     *\n     * Note: due to performance reasonst the incenter is buffered inside the triangle because\n     *       computing it is relatively expensive. If a, b or c have changed you should call the\n     *       calcCircumcircle() function first, otherwise you might get wrong results.\n     * @return Vertex The incenter of this triangle.\n     **/\n    Triangle.prototype.getIncenter = function () {\n        if (!this.center || !this.radius)\n            this.calcCircumcircle();\n        return this.center.clone();\n    };\n    ;\n    /**\n     * Converts this triangle into a human-readable string.\n     *\n     * @method toString\n     * @return {string}\n     * @instance\n     * @memberof Triangle\n     */\n    Triangle.prototype.toString = function () {\n        return '{ a : ' + this.a.toString() + ', b : ' + this.b.toString() + ', c : ' + this.c.toString() + '}';\n    };\n    ;\n    /**\n     * Create an SVG representation of this triangle.\n     *\n     * @deprecated DEPRECATION Please use the drawutilssvg library and an XMLSerializer instead.\n     * @method toSVGString\n     * @param {object=} options - An optional set of options, like 'className'.\n     * @return {string} The SVG string.\n     * @instance\n     * @memberof Triangle\n     **/\n    Triangle.prototype.toSVGString = function (options) {\n        options = options || {};\n        var buffer = [];\n        buffer.push('<path');\n        if (options.className)\n            buffer.push(' class=\"' + options.className + '\"');\n        buffer.push(' d=\"');\n        var vertices = [this.a, this.b, this.c];\n        if (vertices.length > 0) {\n            buffer.push('M ');\n            buffer.push(vertices[0].x);\n            buffer.push(' ');\n            buffer.push(vertices[0].y);\n            for (var i = 1; i < vertices.length; i++) {\n                buffer.push(' L ');\n                buffer.push(vertices[i].x);\n                buffer.push(' ');\n                buffer.push(vertices[i].y);\n            }\n            //if( !this.isOpen ) {\n            buffer.push(' Z');\n            //}\n        }\n        buffer.push('\" />');\n        return buffer.join('');\n    };\n    ;\n    /**\n     * An epsilon for comparison.\n     * This should be the same epsilon as in Vertex.\n     *\n     * @private\n     **/\n    Triangle.EPSILON = 1.0e-6;\n    Triangle.utils = {\n        // Used in the bounds() function.\n        max3: function (a, b, c) {\n            return (a >= b && a >= c) ? a : (b >= a && b >= c) ? b : c;\n        },\n        min3: function (a, b, c) {\n            return (a <= b && a <= c) ? a : (b <= a && b <= c) ? b : c;\n        },\n        signedArea: function (p0x, p0y, p1x, p1y, p2x, p2y) {\n            return 0.5 * (-p1y * p2x + p0y * (-p1x + p2x) + p0x * (p1y - p2y) + p1x * p2y);\n        },\n        /**\n         * Used by the containsPoint() function.\n         *\n         * @private\n         **/\n        pointIsInTriangle: function (px, py, p0x, p0y, p1x, p1y, p2x, p2y) {\n            //\n            // Point-in-Triangle test found at\n            //   http://stackoverflow.com/questions/2049582/how-to-determine-a-point-in-a-2d-triangle\n            // var area : number = 1/2*(-p1y*p2x + p0y*(-p1x + p2x) + p0x*(p1y - p2y) + p1x*p2y);\n            var area = Triangle.utils.signedArea(p0x, p0y, p1x, p1y, p2x, p2y);\n            var s = 1 / (2 * area) * (p0y * p2x - p0x * p2y + (p2y - p0y) * px + (p0x - p2x) * py);\n            var t = 1 / (2 * area) * (p0x * p1y - p0y * p1x + (p0y - p1y) * px + (p1x - p0x) * py);\n            return s > 0 && t > 0 && (1 - s - t) > 0;\n        }\n    };\n    return Triangle;\n}());\nexports.Triangle = Triangle;\n//# sourceMappingURL=Triangle.js.map","\"use strict\";\n/**\n * @classdesc A static UIDGenerator.\n *\n * @author  Ikaros Kappler\n * @date    2021-01-20\n * @version 1.0.0\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.UIDGenerator = void 0;\nvar UIDGenerator = /** @class */ (function () {\n    function UIDGenerator() {\n    }\n    UIDGenerator.next = function () { return \"\" + UIDGenerator.current++; };\n    ;\n    UIDGenerator.current = 0;\n    return UIDGenerator;\n}());\nexports.UIDGenerator = UIDGenerator;\n;\n//# sourceMappingURL=UIDGenerator.js.map","\"use strict\";\n/**\n * @author   Ikaros Kappler\n * @date     2018-11-28\n * @modified 2018-12-04 Added the toSVGString function.\n * @modified 2020-03-25 Ported this class from vanilla-JS to Typescript.\n * @modified 2021-01-20 Added UID.\n * @version  1.1.0\n *\n * @file VEllipse\n * @fileoverview Ellipses with a center and an x- and a y-axis (stored as a vertex).\n **/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.VEllipse = void 0;\nvar UIDGenerator_1 = require(\"./UIDGenerator\");\n/**\n * @classdesc An ellipse class based on two vertices [centerX,centerY] and [radiusX,radiusY].\n *\n * @requires SVGSerializable\n * @requires UID\n * @requires UIDGenerator\n * @requires Vertex\n */\nvar VEllipse = /** @class */ (function () {\n    /**\n     * The constructor.\n     *\n     * @constructor\n     * @param {Vertex} center The ellipses center.\n     * @param {Vertex} axis The x- and y-axis.\n     * @name VEllipse\n     **/\n    function VEllipse(center, axis) {\n        /**\n         * Required to generate proper CSS classes and other class related IDs.\n         **/\n        this.className = \"VEllipse\";\n        this.uid = UIDGenerator_1.UIDGenerator.next();\n        this.center = center;\n        this.axis = axis;\n    }\n    ;\n    /**\n     * Create an SVG representation of this ellipse.\n     *\n     * @deprecated DEPRECATION Please use the drawutilssvg library and an XMLSerializer instead.\n     * @param {object} options { className?:string }\n     * @return string The SVG string\n     */\n    VEllipse.prototype.toSVGString = function (options) {\n        options = options || {};\n        var buffer = [];\n        buffer.push('<ellipse');\n        if (options.className)\n            buffer.push(' class=\"' + options.className + '\"');\n        buffer.push(' cx=\"' + this.center.x + '\"');\n        buffer.push(' cy=\"' + this.center.y + '\"');\n        buffer.push(' rx=\"' + this.axis.x + '\"');\n        buffer.push(' ry=\"' + this.axis.y + '\"');\n        buffer.push(' />');\n        return buffer.join('');\n    };\n    ;\n    return VEllipse;\n}());\nexports.VEllipse = VEllipse;\n//# sourceMappingURL=VEllipse.js.map","\"use strict\";\n/**\n * @author   Ikaros Kappler\n * @date     2019-01-30\n * @modified 2019-02-23 Added the toSVGString function, overriding Line.toSVGString.\n * @modified 2019-03-20 Added JSDoc tags.\n * @modified 2019-04-19 Added the clone function (overriding Line.clone()).\n * @modified 2019-09-02 Added the Vector.perp() function.\n * @modified 2019-09-02 Added the Vector.inverse() function.\n * @modified 2019-12-04 Added the Vector.inv() function.\n * @modified 2020-03-23 Ported to Typescript from JS.\n * @modified 2021-01-20 Added UID.\n * @version  1.3.0\n *\n * @file Vector\n * @public\n **/\nvar __extends = (this && this.__extends) || (function () {\n    var extendStatics = function (d, b) {\n        extendStatics = Object.setPrototypeOf ||\n            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n        return extendStatics(d, b);\n    };\n    return function (d, b) {\n        extendStatics(d, b);\n        function __() { this.constructor = d; }\n        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n    };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Vector = void 0;\nvar VertTuple_1 = require(\"./VertTuple\");\nvar Vertex_1 = require(\"./Vertex\");\n/**\n * @classdesc A vector (Vertex,Vertex) is a line with a visible direction.<br>\n *            <br>\n *            Vectors are drawn with an arrow at their end point.<br>\n *            <b>The Vector class extends the Line class.</b>\n *\n * @requires VertTuple\n * @requires Vertex\n **/\nvar Vector = /** @class */ (function (_super) {\n    __extends(Vector, _super);\n    /**\n     * The constructor.\n     *\n     * @constructor\n     * @name Vector\n     * @extends Line\n     * @param {Vertex} vertA - The start vertex of the vector.\n     * @param {Vertex} vertB - The end vertex of the vector.\n     **/\n    function Vector(vertA, vertB) {\n        var _this = _super.call(this, vertA, vertB, function (a, b) { return new Vector(a, b); }) || this;\n        /**\n         * Required to generate proper CSS classes and other class related IDs.\n         **/\n        _this.className = \"Vector\";\n        return _this;\n    }\n    ;\n    /**\n     * Get the perpendicular of this vector which is located at a.\n     *\n     * @param {Number} t The position on the vector.\n     * @return {Vector} A new vector being the perpendicular of this vector sitting on a.\n     **/\n    Vector.prototype.perp = function () {\n        var v = this.clone();\n        v.sub(this.a);\n        v = new Vector(new Vertex_1.Vertex(), new Vertex_1.Vertex(-v.b.y, v.b.x));\n        v.a.add(this.a);\n        v.b.add(this.a);\n        return v;\n    };\n    ;\n    /**\n     * The inverse of a vector is a vector witht the same magnitude but oppose direction.\n     *\n     * Please not that the origin of this vector changes here: a->b becomes b->a.\n     *\n     * @return {Vector}\n     **/\n    Vector.prototype.inverse = function () {\n        var tmp = this.a;\n        this.a = this.b;\n        this.b = tmp;\n        return this;\n    };\n    ;\n    /**\n     * This function computes the inverse of the vector, which means 'a' stays untouched.\n     *\n     * @return {Vector} this for chaining.\n     **/\n    Vector.prototype.inv = function () {\n        this.b.x = this.a.x - (this.b.x - this.a.x);\n        this.b.y = this.a.y - (this.b.y - this.a.y);\n        return this;\n    };\n    ;\n    /**\n     * Get the intersection if this vector and the specified vector.\n     *\n     * @method intersection\n     * @param {Vector} line The second vector.\n     * @return {Vertex} The intersection (may lie outside the end-points).\n     * @instance\n     * @memberof Line\n     **/\n    Vector.prototype.intersection = function (line) {\n        var denominator = this.denominator(line);\n        if (denominator == 0)\n            return null;\n        var a = this.a.y - line.a.y;\n        var b = this.a.x - line.a.x;\n        var numerator1 = ((line.b.x - line.a.x) * a) - ((line.b.y - line.a.y) * b);\n        var numerator2 = ((this.b.x - this.a.x) * a) - ((this.b.y - this.a.y) * b);\n        a = numerator1 / denominator; // NaN if parallel lines\n        b = numerator2 / denominator;\n        // TODO:\n        // FOR A VECTOR THE LINE-INTERSECTION MUST BE ON BOTH VECTORS\n        // if we cast these lines infinitely in both directions, they intersect here:\n        return new Vertex_1.Vertex(this.a.x + (a * (this.b.x - this.a.x)), this.a.y + (a * (this.b.y - this.a.y)));\n    };\n    ;\n    /**\n     * Create an SVG representation of this line.\n     *\n     * @deprecated DEPRECATION Please use the drawutilssvg library and an XMLSerializer instead.\n     * @method toSVGString\n     * @override\n     * @param {object=} options - A set of options, like 'className'.\n     * @return {string} The SVG string representation.\n     * @instance\n     * @memberof Vector\n     **/\n    Vector.prototype.toSVGString = function (options) {\n        options = options || {};\n        var buffer = [];\n        var vertices = Vector.utils.buildArrowHead(this.a, this.b, 8, 1.0, 1.0);\n        buffer.push('<g');\n        if (options.className)\n            buffer.push(' class=\"' + options.className + '\"');\n        buffer.push('>');\n        buffer.push('   <line');\n        buffer.push(' x1=\"' + this.a.x + '\"');\n        buffer.push(' y1=\"' + this.a.y + '\"');\n        buffer.push(' x2=\"' + vertices[0].x + '\"');\n        buffer.push(' y2=\"' + vertices[0].y + '\"');\n        buffer.push(' />');\n        // Add arrow head\n        buffer.push('   <polygon points=\"');\n        for (var i = 0; i < vertices.length; i++) {\n            if (i > 0)\n                buffer.push(' ');\n            buffer.push('' + vertices[i].x + ',' + vertices[i].y);\n        }\n        buffer.push('\"/>');\n        buffer.push('</g>');\n        return buffer.join('');\n    };\n    ;\n    Vector.utils = {\n        /**\n         * Generate a four-point arrow head, starting at the vector end minus the\n         * arrow head length.\n         *\n         * The first vertex in the returned array is guaranteed to be the located\n         * at the vector line end minus the arrow head length.\n         *\n         *\n         * Due to performance all params are required.\n         *\n         * The params scaleX and scaleY are required for the case that the scaling is not uniform (x and y\n         * scaling different). Arrow heads should not look distored on non-uniform scaling.\n         *\n         * If unsure use 1.0 for scaleX and scaleY (=no distortion).\n         * For headlen use 8, it's a good arrow head size.\n         *\n         * Example:\n         *    buildArrowHead( new Vertex(0,0), new Vertex(50,100), 8, 1.0, 1.0 )\n         *\n         * @param {Vertex} zA - The start vertex of the vector to calculate the arrow head for.\n         * @param {Vertex} zB - The end vertex of the vector.\n         * @param {number} headlen - The length of the arrow head (along the vector direction. A good value is 12).\n         * @param {number} scaleX  - The horizontal scaling during draw.\n         * @param {number} scaleY  - the vertical scaling during draw.\n         **/\n        buildArrowHead: function (zA, zB, headlen, scaleX, scaleY) {\n            var angle = Math.atan2((zB.y - zA.y) * scaleY, (zB.x - zA.x) * scaleX);\n            var vertices = [];\n            vertices.push(new Vertex_1.Vertex(zB.x * scaleX - (headlen) * Math.cos(angle), zB.y * scaleY - (headlen) * Math.sin(angle)));\n            vertices.push(new Vertex_1.Vertex(zB.x * scaleX - (headlen * 1.35) * Math.cos(angle - Math.PI / 8), zB.y * scaleY - (headlen * 1.35) * Math.sin(angle - Math.PI / 8)));\n            vertices.push(new Vertex_1.Vertex(zB.x * scaleX, zB.y * scaleY));\n            vertices.push(new Vertex_1.Vertex(zB.x * scaleX - (headlen * 1.35) * Math.cos(angle + Math.PI / 8), zB.y * scaleY - (headlen * 1.35) * Math.sin(angle + Math.PI / 8)));\n            return vertices;\n        }\n    };\n    return Vector;\n}(VertTuple_1.VertTuple));\nexports.Vector = Vector;\n//# sourceMappingURL=Vector.js.map","\"use strict\";\n/**\n * @author Ikaros Kappler\n * @date   2020-03-24\n * @modified 2020-05-04 Fixed a serious bug in the pointDistance function.\n * @modified 2020-05-12 The angle(line) param was still not optional. Changed that.\n * @modified 2020-11-11 Generalized the `add` and `sub` param from `Vertex` to `XYCoords`.\n * @modified 2020-12-04 Changed`vtutils.dist2` params from `Vertex` to `XYCoords` (generalized).\n * @modified 2020-12-04 Changed `getClosestT` param from `Vertex` to `XYCoords` (generalized).\n * @modified 2020-12-04 Added the `hasPoint(XYCoords)` function.\n * @modified 2021-01-20 Added UID.\n * @version 1.1.0\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.VertTuple = void 0;\nvar Vertex_1 = require(\"./Vertex\");\nvar UIDGenerator_1 = require(\"./UIDGenerator\");\n/**\n * @classdesc An abstract base classes for vertex tuple constructs, like Lines or Vectors.\n * @abstract\n * @requires UID\n * @requires Vertex\n * @requires XYCoords\n */\nvar VertTuple = /** @class */ (function () {\n    /**\n     * Creates an instance.\n     *\n     * @constructor\n     * @name VertTuple\n     * @param {Vertex} a The tuple's first point.\n     * @param {Vertex} b The tuple's second point.\n     **/\n    function VertTuple(a, b, factory) {\n        this.uid = UIDGenerator_1.UIDGenerator.next();\n        this.a = a;\n        this.b = b;\n        this.factory = factory;\n    }\n    /**\n     * Get the length of this line.\n     *\n     * @method length\n     * @instance\n     * @memberof VertTuple\n     **/\n    VertTuple.prototype.length = function () {\n        return Math.sqrt(Math.pow(this.b.x - this.a.x, 2) + Math.pow(this.b.y - this.a.y, 2));\n    };\n    ;\n    /**\n     * Set the length of this vector to the given amount. This only works if this\n     * vector is not a null vector.\n     *\n     * @method setLength\n     * @param {number} length - The desired length.\n     * @memberof VertTuple\n     * @return {T} this (for chaining)\n     **/\n    VertTuple.prototype.setLength = function (length) {\n        return this.scale(length / this.length());\n    };\n    ;\n    /**\n     * Substract the given vertex from this line's end points.\n     *\n     * @method sub\n     * @param {XYCoords} amount The amount (x,y) to substract.\n     * @return {VertTuple} this\n     * @instance\n     * @memberof VertTuple\n     **/\n    VertTuple.prototype.sub = function (amount) {\n        this.a.sub(amount);\n        this.b.sub(amount);\n        return this;\n    };\n    ;\n    /**\n     * Add the given vertex to this line's end points.\n     *\n     * @method add\n     * @param {XYCoords} amount The amount (x,y) to add.\n     * @return {Line} this\n     * @instance\n     * @memberof VertTuple\n     **/\n    VertTuple.prototype.add = function (amount) {\n        this.a.add(amount);\n        this.b.add(amount);\n        return this;\n    };\n    ;\n    /**\n     * Normalize this line (set to length 1).\n     *\n     * @method normalize\n     * @return {VertTuple} this\n     * @instance\n     * @memberof VertTuple\n     **/\n    VertTuple.prototype.normalize = function () {\n        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());\n        return this;\n    };\n    ;\n    /**\n     * Scale this line by the given factor.\n     *\n     * @method scale\n     * @param {number} factor The factor for scaling (1.0 means no scale).\n     * @return {VertTuple} this\n     * @instance\n     * @memberof VertTuple\n     **/\n    VertTuple.prototype.scale = function (factor) {\n        this.b.set(this.a.x + (this.b.x - this.a.x) * factor, this.a.y + (this.b.y - this.a.y) * factor);\n        return this;\n    };\n    ;\n    /**\n     * Move this line to a new location.\n     *\n     * @method moveTo\n     * @param {Vertex} newA - The new desired location of 'a'. Vertex 'b' will be moved, too.\n     * @return {VertTuple} this\n     * @instance\n     * @memberof VertTuple\n     **/\n    VertTuple.prototype.moveTo = function (newA) {\n        var diff = this.a.difference(newA);\n        this.a.add(diff);\n        this.b.add(diff);\n        return this;\n    };\n    ;\n    /**\n     * Get the angle between this and the passed line (in radians).\n     *\n     * @method angle\n     * @param {VertTuple} line - (optional) The line to calculate the angle to. If null the baseline (x-axis) will be used.\n     * @return {number} this\n     * @instance\n     * @memberof VertTuple\n     **/\n    VertTuple.prototype.angle = function (line) {\n        if (line == null || typeof line == 'undefined') {\n            line = this.factory(new Vertex_1.Vertex(0, 0), new Vertex_1.Vertex(100, 0));\n        }\n        // Compute the angle from x axis and the return the difference :)\n        var v0 = this.b.clone().sub(this.a);\n        var v1 = line.b.clone().sub(line.a);\n        // Thank you, Javascript, for this second atan function. No additional math is needed here!\n        // The result might be negative, but isn't it usually nicer to determine angles in positive values only?\n        return Math.atan2(v1.x, v1.y) - Math.atan2(v0.x, v0.y);\n    };\n    ;\n    /**\n     * Get line point at position t in [0 ... 1]:<br>\n     * <pre>[P(0)]=[A]--------------------[P(t)]------[B]=[P(1)]</pre><br>\n     * <br>\n     * The counterpart of this function is Line.getClosestT(Vertex).\n     *\n     * @method vertAt\n     * @param {number} t The position scalar.\n     * @return {Vertex} The vertex a position t.\n     * @instance\n     * @memberof VertTuple\n     **/\n    VertTuple.prototype.vertAt = function (t) {\n        return new Vertex_1.Vertex(this.a.x + (this.b.x - this.a.x) * t, this.a.y + (this.b.y - this.a.y) * t);\n    };\n    ;\n    /**\n     * Get the denominator of this and the given line.\n     *\n     * If the denominator is zero (or close to zero) both line are co-linear.\n     *\n     * @method denominator\n     * @param {VertTuple} line\n     * @instance\n     * @memberof VertTuple\n     * @return {Number}\n     **/\n    VertTuple.prototype.denominator = function (line) {\n        // http://jsfiddle.net/justin_c_rounds/Gd2S2/\n        return ((line.b.y - line.a.y) * (this.b.x - this.a.x)) - ((line.b.x - line.a.x) * (this.b.y - this.a.y));\n    };\n    ;\n    /**\n     * Checks if this and the given line are co-linear.\n     *\n     * The constant Vertex.EPSILON is used for tolerance.\n     *\n     * @method colinear\n     * @param {VertTuple} line\n     * @instance\n     * @memberof VertTuple\n     * @return true if both lines are co-linear.\n     */\n    VertTuple.prototype.colinear = function (line) {\n        return Math.abs(this.denominator(line)) < Vertex_1.Vertex.EPSILON;\n    };\n    ;\n    /**\n     * Get the closest position T from this line to the specified point.\n     *\n     * The counterpart for this function is Line.vertAt(Number).\n     *\n     * @name getClosetT\n     * @method getClosestT\n     * @param {XYCoords} p The point (vertex) to measure the distance to.\n     * @return {number} The line position t of minimal distance to p.\n     * @instance\n     * @memberof VertTuple\n     **/\n    VertTuple.prototype.getClosestT = function (p) {\n        var l2 = VertTuple.vtutils.dist2(this.a, this.b);\n        if (l2 === 0)\n            return 0;\n        var t = ((p.x - this.a.x) * (this.b.x - this.a.x) + (p.y - this.a.y) * (this.b.y - this.a.y)) / l2;\n        // Do not wrap to [0,1] here.\n        // Other results are of interest, too.\n        // t = Math.max(0, Math.min(1, t));\n        return t;\n    };\n    ;\n    /**\n     * Check if the given point is located on this line. Optionally also check if\n     * that point is located between point `a` and `b`.\n     *\n     * @method hasPoint\n     * @param {Vertex} point The point to check.\n     * @param {boolean=} insideBoundsOnly If set to to true (default=false) the point must be between start and end point of the line.\n     * @return {boolean} True if the given point is on this line.\n     * @instance\n     * @memberof VertTuple\n     */\n    VertTuple.prototype.hasPoint = function (point, insideBoundsOnly) {\n        var t = this.getClosestT(point);\n        // Compare to pointDistance?\n        if (typeof insideBoundsOnly !== \"undefined\" && insideBoundsOnly) {\n            var distance = Math.sqrt(VertTuple.vtutils.dist2(point, this.vertAt(t)));\n            return distance < Vertex_1.Vertex.EPSILON && t >= 0 && t <= 1;\n        }\n        else {\n            return t >= 0 && t <= 1;\n        }\n    };\n    /**\n     * Get the closest point on this line to the specified point.\n     *\n     * @method getClosestPoint\n     * @param {Vertex} p The point (vertex) to measre the distance to.\n     * @return {Vertex} The point on the line that is closest to p.\n     * @instance\n     * @memberof VertTuple\n     **/\n    VertTuple.prototype.getClosestPoint = function (p) {\n        var t = this.getClosestT(p);\n        return this.vertAt(t);\n    };\n    ;\n    /**\n     * The the minimal distance between this line and the specified point.\n     *\n     * @method pointDistance\n     * @param {Vertex} p The point (vertex) to measre the distance to.\n     * @return {number} The absolute minimal distance.\n     * @instance\n     * @memberof VertTuple\n     **/\n    VertTuple.prototype.pointDistance = function (p) {\n        // Taken From:\n        // https://stackoverflow.com/questions/849211/shortest-distance-between-a-point-and-a-line-segment\n        return Math.sqrt(VertTuple.vtutils.dist2(p, this.vertAt(this.getClosestT(p))));\n    };\n    ;\n    /**\n     * Create a deep clone of this instance.\n     *\n     * @method cloneLine\n     * @return {T} A type safe clone if this instance.\n     * @instance\n     * @memberof VertTuple\n     **/\n    VertTuple.prototype.clone = function () {\n        return this.factory(this.a.clone(), this.b.clone());\n    };\n    ;\n    /**\n     * Create a string representation of this line.\n     *\n     * @method totring\n     * @return {string} The string representing this line.\n     * @instance\n     * @memberof VertTuple\n     **/\n    VertTuple.prototype.toString = function () {\n        return \"{ a : \" + this.a.toString() + \", b : \" + this.b.toString() + \" }\";\n    };\n    ;\n    /**\n     * @private\n     **/\n    VertTuple.vtutils = {\n        dist2: function (v, w) {\n            return (v.x - w.x) * (v.x - w.x) + (v.y - w.y) * (v.y - w.y);\n        }\n    };\n    return VertTuple;\n}());\nexports.VertTuple = VertTuple;\n//# sourceMappingURL=VertTuple.js.map","\"use strict\";\n/**\n * @author   Ikaros Kappler\n * @date     2012-10-17\n * @modified 2018-04-03 Refactored the code of october 2012 into a new class.\n * @modified 2018-04-28 Added some documentation.\n * @modified 2018-08-16 Added the set() function.\n * @modified 2018-08-26 Added VertexAttr.\n * @modified 2018-10-31 Extended the constructor by object{x,y}.\n * @modified 2018-11-19 Extended the set(number,number) function to set(Vertex).\n * @modified 2018-11-28 Added 'this' to the VertexAttr constructor.\n * @modified 2018-12-05 Added the sub(...) function. Changed the signature of the add() function! add(Vertex) and add(number,number) are now possible.\n * @modified 2018-12-21 (It's winter solstice) Added the inv()-function.\n * @modified 2019-01-30 Added the setX(Number) and setY(Number) functions.\n * @modified 2019-02-19 Added the difference(Vertex) function.\n * @modified 2019-03-20 Added JSDoc tags.\n * @modified 2019-04-24 Added the randomVertex(ViewPort) function.\n * @modified 2019-11-07 Added toSVGString(object) function.\n * @modified 2019-11-18 Added the rotate(number,Vertex) function.\n * @modified 2019-11-21 Fixed a bug in the rotate(...) function (elements were moved).\n * @modified 2020-03-06 Added functions invX() and invY().\n * @modified 2020-03-23 Ported to Typescript from JS.\n * @modified 2020-05-26 Added functions addX(number) and addY(number).\n * @modifeid 2020-10-30 Change the warnings in `sub(...)` and `add(...)` into real errors.\n * @version  2.4.1\n *\n * @file Vertex\n * @public\n **/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Vertex = void 0;\nvar VertexAttr_1 = require(\"./VertexAttr\");\nvar UIDGenerator_1 = require(\"./UIDGenerator\");\nvar VertexListeners_1 = require(\"./VertexListeners\");\n/**\n * @classdesc A vertex is a pair of two numbers.<br>\n * <br>\n * It is used to identify a 2-dimensional point on the x-y-plane.\n *\n * @requires IVertexAttr\n * @requires SVGSerializable\n * @requires UID\n * @requires UIDGenerator\n * @requires VertexAttr\n * @requires VertexListeners\n * @requires XYCoords\n *\n */\nvar Vertex = /** @class */ (function () {\n    /**\n     * The constructor for the vertex class.\n     *\n     * @constructor\n     * @name Vertex\n     * @param {number} x - The x-coordinate of the new vertex.\n     * @param {number} y - The y-coordinate of the new vertex.\n     **/\n    function Vertex(x, y) {\n        /**\n         * Required to generate proper CSS classes and other class related IDs.\n         **/\n        this.className = \"Vertex\";\n        this.uid = UIDGenerator_1.UIDGenerator.next();\n        if (typeof x == 'undefined') {\n            this.x = 0;\n            this.y = 0;\n        }\n        else if (typeof x == 'number' && typeof y == 'number') {\n            this.x = x;\n            this.y = y;\n        }\n        else {\n            var tuple = x;\n            if (typeof tuple.x == \"number\" && typeof tuple.y == \"number\") {\n                this.x = tuple.x;\n                this.y = tuple.y;\n            }\n            else {\n                if (typeof x == 'number')\n                    this.x = x;\n                else if (typeof x == 'undefined')\n                    this.x = 0;\n                else\n                    this.x = NaN;\n                if (typeof y == 'number')\n                    this.y = y;\n                else if (typeof y == 'undefined')\n                    this.y = 0;\n                else\n                    this.y = NaN;\n            }\n        }\n        this.attr = new VertexAttr_1.VertexAttr();\n        this.listeners = new VertexListeners_1.VertexListeners(this);\n    }\n    ;\n    /**\n     * Set the x- and y- component of this vertex.\n     *\n     * @method set\n     * @param {number} x - The new x-component.\n     * @param {number} y - The new y-component.\n     * @return {Vertex} this\n     * @instance\n     * @memberof Vertex\n     **/\n    Vertex.prototype.set = function (x, y) {\n        if (typeof x == 'number' && typeof y == 'number') {\n            this.x = x;\n            this.y = y;\n        }\n        else {\n            var tuple = x;\n            if (typeof tuple.x == \"number\" && typeof tuple.y == \"number\") {\n                this.x = tuple.x;\n                this.y = tuple.y;\n            }\n            else {\n                if (typeof x == 'number')\n                    this.x = x;\n                else if (typeof x == 'undefined')\n                    this.x = 0;\n                else\n                    this.x = NaN;\n                if (typeof y == 'number')\n                    this.y = y;\n                else if (typeof y == 'undefined')\n                    this.y = 0;\n                else\n                    this.y = NaN;\n            }\n        }\n        return this;\n    };\n    ;\n    /**\n     * Set the x-component of this vertex.\n     *\n     * @method setX\n     * @param {number} x - The new x-component.\n     * @return {Vertex} this\n     * @instance\n     * @memberof Vertex\n     **/\n    Vertex.prototype.setX = function (x) {\n        this.x = x;\n        return this;\n    };\n    ;\n    /**\n     * Set the y-component of this vertex.\n     *\n     * @method setY\n     * @param {number} y - The new y-component.\n     * @return {Vertex} this\n     * @instance\n     * @memberof Vertex\n     **/\n    Vertex.prototype.setY = function (y) {\n        this.y = y;\n        return this;\n    };\n    ;\n    /**\n     * Set the x-component if this vertex to the inverse of its value.\n     *\n     * @method invX\n     * @return {Vertex} this\n     * @instance\n     * @memberof Vertex\n     **/\n    Vertex.prototype.invX = function () {\n        this.x = -this.x;\n        return this;\n    };\n    ;\n    /**\n     * Set the y-component if this vertex to the inverse of its value.\n     *\n     * @method invY\n     * @return {Vertex} this\n     * @instance\n     * @memberof Vertex\n     **/\n    Vertex.prototype.invY = function () {\n        this.y = -this.y;\n        return this;\n    };\n    ;\n    /**\n     * Add the passed amount to x- and y- component of this vertex.<br>\n     * <br>\n     * This function works with add( {number}, {number} ) and\n     * add( {Vertex} ), as well.\n     *\n     * @method add\n     * @param {(number|Vertex)} x - The amount to add to x (or a vertex itself).\n     * @param {number=} y - The amount to add to y.\n     * @return {Vertex} this\n     * @instance\n     * @memberof Vertex\n     **/\n    Vertex.prototype.add = function (x, y) {\n        if (typeof x == 'number' && typeof y == 'number') {\n            this.x += x;\n            this.y += y;\n        }\n        else {\n            var tuple = x;\n            if (typeof tuple.x == \"number\" && typeof tuple.y == \"number\") {\n                this.x += tuple.x;\n                this.y += tuple.y;\n            }\n            else {\n                if (typeof x == 'number')\n                    this.x += x;\n                else\n                    throw \"Cannot add \" + typeof x + \" to numeric x component!\";\n                if (typeof y == 'number')\n                    this.y += y;\n                else\n                    throw \"Cannot add \" + typeof y + \" to numeric y component!\";\n            }\n        }\n        return this;\n    };\n    ;\n    /**\n     * Add the passed amounts to the x- and y- components of this vertex.\n     *\n     * @method addXY\n     * @param {number} x - The amount to add to x.\n     * @param {number} y - The amount to add to y.\n     * @return {Vertex} this\n     * @instance\n     * @memberof Vertex\n     **/\n    Vertex.prototype.addXY = function (amountX, amountY) {\n        this.x += amountX;\n        this.y += amountY;\n        return this;\n    };\n    ;\n    /**\n     * Add the passed amounts to the x-component of this vertex.\n     *\n     * @method addX\n     * @param {number} x - The amount to add to x.\n     * @return {Vertex} this\n     * @instance\n     * @memberof Vertex\n     **/\n    Vertex.prototype.addX = function (amountX) {\n        this.x += amountX;\n        return this;\n    };\n    ;\n    /**\n     * Add the passed amounts to the y-component of this vertex.\n     *\n     * @method addY\n     * @param {number} y - The amount to add to y.\n     * @return {Vertex} this\n     * @instance\n     * @memberof Vertex\n     **/\n    Vertex.prototype.addY = function (amountY) {\n        this.y += amountY;\n        return this;\n    };\n    ;\n    /**\n     * Substract the passed amount from x- and y- component of this vertex.<br>\n     * <br>\n     * This function works with sub( {number}, {number} ) and\n     * sub( {Vertex} ), as well.\n     *\n     * @method sub\n     * @param {(number|Vertex)} x - The amount to substract from x (or a vertex itself).\n     * @param {number=} y - The amount to substract from y.\n     * @return {Vertex} this\n     * @instance\n     * @memberof Vertex\n     **/\n    Vertex.prototype.sub = function (x, y) {\n        if (typeof x == 'number' && typeof y == 'number') {\n            this.x -= x;\n            this.y -= y;\n        }\n        else {\n            var tuple = x;\n            if (typeof tuple.x == \"number\" && typeof tuple.y == \"number\") {\n                this.x -= tuple.x;\n                this.y -= tuple.y;\n            }\n            else {\n                if (typeof x == 'number')\n                    this.x -= x;\n                else\n                    throw \"Cannot add \" + typeof x + \" to numeric x component!\";\n                if (typeof y == 'number')\n                    this.y -= y;\n                else\n                    throw \"Cannot add \" + typeof y + \" to numeric y component!\";\n            }\n        }\n        return this;\n    };\n    ;\n    /**\n     * Check if this vertex equals the passed one.\n     * <br>\n     * This function uses an internal epsilon as tolerance.\n     *\n     * @method equals\n     * @param {Vertex} vertex - The vertex to compare this with.\n     * @return {boolean}\n     * @instance\n     * @memberof Vertex\n     **/\n    Vertex.prototype.equals = function (vertex) {\n        var eqX = (Math.abs(this.x - vertex.x) < Vertex.EPSILON);\n        var eqY = (Math.abs(this.y - vertex.y) < Vertex.EPSILON);\n        var result = eqX && eqY;\n        return result;\n    };\n    ;\n    /**\n     * Create a copy of this vertex.\n     *\n     * @method clone\n     * @return {Vertex} A new vertex, an exact copy of this.\n     * @instance\n     * @memberof Vertex\n     **/\n    Vertex.prototype.clone = function () {\n        return new Vertex(this.x, this.y);\n    };\n    ;\n    /**\n     * Get the distance to the passed point (in euclidean metric)\n     *\n     * @method distance\n     * @param {XYCoords} vert - The vertex to measure the distance to.\n     * @return {number}\n     * @instance\n     * @memberof Vertex\n     **/\n    Vertex.prototype.distance = function (vert) {\n        return Math.sqrt(Math.pow(vert.x - this.x, 2) + Math.pow(vert.y - this.y, 2));\n    };\n    ;\n    /**\n     * Get the angle of this point (relative to (0,0) or to the given other origin point).\n     *\n     * @method angle\n     * @param {XYCoords} origin - The vertex to measure the angle from.\n     * @return {number}\n     * @instance\n     * @memberof Vertex\n     **/\n    Vertex.prototype.angle = function (origin) {\n        var a = (typeof origin === \"undefined\" ? Math.PI / 2 - Math.atan2(this.x, this.y) : Math.PI / 2 - Math.atan2(origin.x - this.x, origin.y - this.y));\n        // Map to positive value\n        return a < 0 ? Math.PI * 2 + a : a;\n    };\n    ;\n    /**\n     * Get the difference to the passed point.<br>\n     * <br>\n     * The difference is (vert.x-this.x, vert.y-this.y).\n     *\n     * @method difference\n     * @param {Vertex} vert - The vertex to measure the x-y-difference to.\n     * @return {Vertex} A new vertex.\n     * @instance\n     * @memberof Vertex\n     **/\n    Vertex.prototype.difference = function (vert) {\n        return new Vertex(vert.x - this.x, vert.y - this.y);\n    };\n    ;\n    /**\n     * This is a vector-like behavior and 'scales' this vertex\n     * towards/from a given center.\n     *\n     * @method scale\n     * @param {number} factor - The factor to 'scale' this vertex; 1.0 means no change.\n     * @param {Vertex=} center - The origin of scaling; default is (0,0).\n     * @return {Vertex} this\n     * @instance\n     * @memberof Vertex\n     **/\n    Vertex.prototype.scale = function (factor, center) {\n        if (!center || typeof center === \"undefined\")\n            center = new Vertex(0, 0);\n        this.x = center.x + (this.x - center.x) * factor;\n        this.y = center.y + (this.y - center.y) * factor;\n        return this;\n    };\n    ;\n    /**\n     * This is a vector-like behavior and 'rotates' this vertex\n     * around given center.\n     *\n     * @method rotate\n     * @param {number} angle - The angle to 'rotate' this vertex; 0.0 means no change.\n     * @param {Vertex=} center - The center of rotation; default is (0,0).\n     * @return {Vertex} this\n     * @instance\n     * @memberof Vertex\n     **/\n    Vertex.prototype.rotate = function (angle, center) {\n        if (!center || typeof center === \"undefined\")\n            center = new Vertex(0, 0);\n        this.sub(center);\n        angle += Math.atan2(this.y, this.x);\n        var len = this.distance(Vertex.ZERO); // {x:0,y:0});\n        this.x = len * Math.cos(angle);\n        this.y = len * Math.sin(angle);\n        this.add(center);\n        return this;\n    };\n    ;\n    /**\n     * Multiply both components of this vertex with the given scalar.<br>\n     * <br>\n     * Note: as in<br>\n     *    https://threejs.org/docs/#api/math/Vector2.multiplyScalar\n     *\n     * @method multiplyScalar\n     * @param {number} scalar - The scale factor; 1.0 means no change.\n     * @return {Vertex} this\n     * @instance\n     * @memberof Vertex\n     **/\n    Vertex.prototype.multiplyScalar = function (scalar) {\n        this.x *= scalar;\n        this.y *= scalar;\n        return this;\n    };\n    ;\n    /**\n     * Round the two components x and y of this vertex.\n     *\n     * @method round\n     * @return {Vertex} this\n     * @instance\n     * @memberof Vertex\n     **/\n    Vertex.prototype.round = function () {\n        this.x = Math.round(this.x);\n        this.y = Math.round(this.y);\n        return this;\n    };\n    ;\n    /**\n     * Change this vertex (x,y) to its inverse (-x,-y).\n     *\n     * @method inv\n     * @return {Vertex} this\n     * @instance\n     * @memberof Vertex\n     **/\n    Vertex.prototype.inv = function () {\n        this.x = -this.x;\n        this.y = -this.y;\n        return this;\n    };\n    ;\n    /**\n     * Get a string representation of this vertex.\n     *\n     * @method toString\n     * @return {string} The string representation of this vertex.\n     * @instance\n     * @memberof Vertex\n     **/\n    Vertex.prototype.toString = function () {\n        return '(' + this.x + ',' + this.y + ')';\n    };\n    ;\n    /**\n     * Convert this vertex to SVG code.\n     *\n     * @deprecated DEPRECATION Please use the drawutilssvg library and an XMLSerializer instead.\n     * @method toSVGString\n     * @param {object=} options - An optional set of options, like 'className'.\n     * @return {string} A string representing the SVG code for this vertex.\n     * @instance\n     * @memberof Vertex\n     **/\n    Vertex.prototype.toSVGString = function (options) {\n        options = options || {};\n        var buffer = [];\n        buffer.push('<circle');\n        if (options.className)\n            buffer.push(' class=\"' + options.className + '\"');\n        buffer.push(' cx=\"' + this.x + '\"');\n        buffer.push(' cy=\"' + this.y + '\"');\n        buffer.push(' r=\"2\"');\n        buffer.push(' />');\n        return buffer.join('');\n    };\n    ;\n    // END Vertex\n    /**\n     * Create a new random vertex inside the given viewport.\n     *\n     * @param {ViewPort} viewPort - A {min:Vertex, max:Vertex} viewport specifying the bounds.\n     * @return A new vertex with a random position.\n     **/\n    Vertex.randomVertex = function (viewPort) {\n        return new Vertex(viewPort.min.x + Math.random() * (viewPort.max.x - viewPort.min.x), viewPort.min.y + Math.random() * (viewPort.max.y - viewPort.min.y));\n    };\n    ;\n    Vertex.ZERO = new Vertex(0, 0);\n    /**\n     * An epsilon for comparison\n     *\n     * @private\n     * @readonly\n     **/\n    Vertex.EPSILON = 1.0e-6;\n    Vertex.utils = {\n        /**\n         * Generate a four-point arrow head, starting at the vector end minus the\n         * arrow head length.\n         *\n         * The first vertex in the returned array is guaranteed to be the located\n         * at the vector line end minus the arrow head length.\n         *\n         *\n         * Due to performance all params are required.\n         *\n         * The params scaleX and scaleY are required for the case that the scaling is not uniform (x and y\n         * scaling different). Arrow heads should not look distored on non-uniform scaling.\n         *\n         * If unsure use 1.0 for scaleX and scaleY (=no distortion).\n         * For headlen use 8, it's a good arrow head size.\n         *\n         * Example:\n         *    buildArrowHead( new Vertex(0,0), new Vertex(50,100), 8, 1.0, 1.0 )\n         *\n         * @param {Vertex} zA - The start vertex of the vector to calculate the arrow head for.\n         * @param {Vertex} zB - The end vertex of the vector.\n         * @param {number} headlen - The length of the arrow head (along the vector direction. A good value is 12).\n         * @param {number} scaleX  - The horizontal scaling during draw.\n         * @param {number} scaleY  - the vertical scaling during draw.\n         **/\n        // @DEPRECATED: use Vector.utils.buildArrowHead instead!!!\n        buildArrowHead: function (zA, zB, headlen, scaleX, scaleY) {\n            // console.warn('This function is deprecated! Use Vector.utils.buildArrowHead instead!');\n            var angle = Math.atan2((zB.y - zA.y) * scaleY, (zB.x - zA.x) * scaleX);\n            var vertices = [];\n            vertices.push(new Vertex(zB.x * scaleX - (headlen) * Math.cos(angle), zB.y * scaleY - (headlen) * Math.sin(angle)));\n            vertices.push(new Vertex(zB.x * scaleX - (headlen * 1.35) * Math.cos(angle - Math.PI / 8), zB.y * scaleY - (headlen * 1.35) * Math.sin(angle - Math.PI / 8)));\n            vertices.push(new Vertex(zB.x * scaleX, zB.y * scaleY));\n            vertices.push(new Vertex(zB.x * scaleX - (headlen * 1.35) * Math.cos(angle + Math.PI / 8), zB.y * scaleY - (headlen * 1.35) * Math.sin(angle + Math.PI / 8)));\n            return vertices;\n        }\n    };\n    return Vertex;\n}());\nexports.Vertex = Vertex;\n//# sourceMappingURL=Vertex.js.map","\"use strict\";\n/**\n * @author   Ikaros Kappler\n * @date     2018-08-26\n * @modified 2018-11-17 Added the 'isSelected' attribute.\n * @modified 2018-11-27 Added the global model for instantiating with custom attributes.\n * @modified 2019-03-20 Added JSDoc tags.\n * @modified 2020-02-29 Added the 'selectable' attribute.\n * @modified 2020-03-23 Ported to Typescript from JS.\n * @version  1.1.1\n *\n * @file VertexAttr\n * @public\n **/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.VertexAttr = void 0;\n/**\n * @classdesc The VertexAttr is a helper class to wrap together additional attributes\n * to vertices that do not belong to the 'standard canonical' vertex implementation.<br>\n * <br>\n * This is some sort of 'userData' object, but the constructor uses a global model\n * to obtain a (configurable) default attribute set to all instances.<br>\n */\nvar VertexAttr = /** @class */ (function () {\n    /**\n     * The constructor.\n     *\n     * Attributes will be initialized as defined in the model object\n     * which serves as a singleton.\n     *\n     * @constructor\n     * @name VertexAttr\n     **/\n    function VertexAttr() {\n        this.draggable = true;\n        this.selectable = true;\n        this.isSelected = false;\n        this.visible = true;\n        for (var key in VertexAttr.model)\n            this[key] = VertexAttr.model[key];\n    }\n    ;\n    /**\n     * This is the global attribute model. Set these object on the initialization\n     * of your app to gain all VertexAttr instances have these attributes.\n     *\n     * @type {object}\n     **/\n    VertexAttr.model = {\n        draggable: true,\n        selectable: true,\n        isSelected: false,\n        visible: true\n    };\n    return VertexAttr;\n}());\nexports.VertexAttr = VertexAttr;\n//# sourceMappingURL=VertexAttr.js.map","\"use strict\";\n/**\n * @author   Ikaros Kappler\n * @date     2018-08-27\n * @modified 2018-11-28 Added the vertex-param to the constructor and extended the event. Vertex events now have a 'params' attribute object.\n * @modified 2019-03-20 Added JSDoc tags.\n * @modified 2020-02-22 Added 'return this' to the add* functions (for chanining).\n * @modified 2020-03-23 Ported to Typescript from JS.\n * @modified 2020-11-17 Added the `click` handler.\n * @version  1.1.0\n *\n * @file VertexListeners\n * @public\n **/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.VertexListeners = void 0;\n/**\n * @classdesc An event listeners wrapper. This is just a set of three listener\n *              queues (drag, dragStart, dragEnd) and their respective firing\n *              functions.\n *\n */\nvar VertexListeners = /** @class */ (function () {\n    /**\n     * The constructor.\n     *\n     * @constructor\n     * @name VertexListeners\n     * @param {Vertex} vertex - The vertex to use these listeners on (just a backward reference).\n     **/\n    function VertexListeners(vertex) {\n        this.click = [];\n        this.drag = [];\n        this.dragStart = [];\n        this.dragEnd = [];\n        this.vertex = vertex;\n    }\n    ;\n    /**\n     * Add a click listener.\n     *\n     * @method addClickListener\n     * @param {VertexListeners~dragListener} listener - The click listener to add (a callback).\n     * @return {VertexListeners} this (for chaining)\n     * @instance\n     * @memberof VertexListeners\n     **/\n    VertexListeners.prototype.addClickListener = function (listener) {\n        VertexListeners._addListener(this.click, listener);\n        return this;\n    };\n    ;\n    /**\n     * The click listener is a function with a single drag event param.\n     * @callback VertexListeners~clickListener\n     * @param {Event} e - The (extended) click event.\n     */\n    /**\n     * Remove a drag listener.\n     *\n     * @method removeDragListener\n     * @param {VertexListeners~dragListener} listener - The drag listener to remove (a callback).\n     * @return {VertexListeners} this (for chaining)\n     * @instance\n     * @memberof VertexListeners\n     **/\n    VertexListeners.prototype.removeClickListener = function (listener) {\n        this.click = VertexListeners._removeListener(this.click, listener);\n        return this;\n    };\n    ;\n    /**\n     * The click listener is a function with a single drag event param.\n     * @callback VertexListeners~clickListener\n     * @param {Event} e - The (extended) click event.\n     */\n    /**\n     * Add a drag listener.\n     *\n     * @method addDragListener\n     * @param {VertexListeners~dragListener} listener - The drag listener to add (a callback).\n     * @return {VertexListeners} this (for chaining)\n     * @instance\n     * @memberof VertexListeners\n     **/\n    VertexListeners.prototype.addDragListener = function (listener) {\n        VertexListeners._addListener(this.drag, listener);\n        return this;\n    };\n    ;\n    /**\n     * The drag listener is a function with a single drag event param.\n     * @callback VertexListeners~dragListener\n     * @param {Event} e - The (extended) drag event.\n     */\n    /**\n     * Remove a drag listener.\n     *\n     * @method removeDragListener\n     * @param {VertexListeners~dragListener} listener - The drag listener to remove (a callback).\n     * @return {VertexListeners} this (for chaining)\n     * @instance\n     * @memberof VertexListeners\n     **/\n    VertexListeners.prototype.removeDragListener = function (listener) {\n        this.drag = VertexListeners._removeListener(this.drag, listener);\n        return this;\n    };\n    ;\n    /**\n     * Add a dragStart listener.\n     *\n     * @method addDragListener\n     * @param {VertexListeners~dragStartListener} listener - The drag-start listener to add (a callback).\n     * @return {VertexListeners} this (for chaining)\n     * @instance\n     * @memberof VertexListeners\n     **/\n    VertexListeners.prototype.addDragStartListener = function (listener) {\n        VertexListeners._addListener(this.dragStart, listener);\n        return this;\n    };\n    ;\n    /**\n     * The drag-start listener is a function with a single drag event param.\n     * @callback VertexListeners~dragStartListener\n     * @param {Event} e - The (extended) drag event.\n     */\n    /**\n     * Remove a dragStart listener.\n     *\n     * @method addDragStartListener\n     * @param {VertexListeners~dragListener} listener - The drag listener to remove (a callback).\n     * @return {VertexListeners} this (for chaining)\n     * @instance\n     * @memberof VertexListeners\n     **/\n    VertexListeners.prototype.removeDragStartListener = function (listener) {\n        this.dragStart = VertexListeners._removeListener(this.dragStart, listener);\n        return this;\n    };\n    ;\n    /**\n     * Add a dragEnd listener.\n     *\n     * @method addDragListener\n     * @param {VertexListeners~dragEndListener} listener - The drag-end listener to add (a callback).\n     * @return {VertexListeners} this (for chaining)\n     * @instance\n     * @memberof VertexListeners\n     **/\n    VertexListeners.prototype.addDragEndListener = function (listener) {\n        // this.dragEnd.push( listener );\n        VertexListeners._addListener(this.dragEnd, listener);\n        return this;\n    };\n    ;\n    /**\n     * The drag-end listener is a function with a single drag event param.\n     * @callback VertexListeners~dragEndListener\n     * @param {Event} e - The (extended) drag event.\n     */\n    /**\n    * Remove a drag listener.\n    *\n    * @method removeDragEndListener\n    * @param {VertexListeners~clickListener} listener - The drag listener to remove (a callback).\n    * @return {VertexListeners} this (for chaining)\n    * @instance\n    * @memberof VertexListeners\n    **/\n    VertexListeners.prototype.removeDragEndListener = function (listener) {\n        // this.drag.push( listener );\n        this.dragEnd = VertexListeners._removeListener(this.dragEnd, listener);\n        return this;\n    };\n    ;\n    /**\n     * Fire a click event with the given event instance to all\n     * installed click listeners.\n     *\n     * @method fireClickEvent\n     * @param {VertEvent|XMouseEvent} e - The click event itself to be fired to all installed drag listeners.\n     * @return {void}\n     * @instance\n     * @memberof VertexListeners\n     **/\n    VertexListeners.prototype.fireClickEvent = function (e) {\n        VertexListeners._fireEvent(this, this.click, e);\n    };\n    ;\n    /**\n     * Fire a drag event with the given event instance to all\n     * installed drag listeners.\n     *\n     * @method fireDragEvent\n     * @param {VertEvent|XMouseEvent} e - The drag event itself to be fired to all installed drag listeners.\n     * @return {void}\n     * @instance\n     * @memberof VertexListeners\n     **/\n    VertexListeners.prototype.fireDragEvent = function (e) {\n        VertexListeners._fireEvent(this, this.drag, e);\n    };\n    ;\n    /**\n     * Fire a dragStart event with the given event instance to all\n     * installed drag-start listeners.\n     *\n     * @method fireDragStartEvent\n     * @param {VertEvent|XMouseEvent} e - The drag-start event itself to be fired to all installed dragStart listeners.\n     * @return {void}\n     * @instance\n     * @memberof VertexListeners\n     **/\n    VertexListeners.prototype.fireDragStartEvent = function (e) {\n        VertexListeners._fireEvent(this, this.dragStart, e);\n    };\n    ;\n    /**\n     * Fire a dragEnd event with the given event instance to all\n     * installed drag-end listeners.\n     *\n     * @method fireDragEndEvent\n     * @param {VertEvent|XMouseEvent} e - The drag-end event itself to be fired to all installed dragEnd listeners.\n     * @return {void}\n     * @instance\n     * @memberof VertexListeners\n     **/\n    VertexListeners.prototype.fireDragEndEvent = function (e) {\n        VertexListeners._fireEvent(this, this.dragEnd, e);\n    };\n    ;\n    /**\n     * @private\n     **/\n    VertexListeners._fireEvent = function (_self, listeners, e) {\n        var ve = e;\n        if (typeof ve.params == 'undefined')\n            ve.params = { vertex: _self.vertex };\n        else\n            ve.params.vertex = _self.vertex;\n        for (var i in listeners) {\n            listeners[i](ve);\n        }\n    };\n    ;\n    /**\n     * @private\n     */\n    VertexListeners._addListener = function (listeners, newListener) {\n        for (var i in listeners) {\n            if (listeners[i] == newListener)\n                return false;\n        }\n        listeners.push(newListener);\n        return true;\n    };\n    ;\n    /**\n     * @private\n     */\n    VertexListeners._removeListener = function (listeners, oldListener) {\n        for (var i = 0; i < listeners.length; i++) {\n            if (listeners[i] == oldListener)\n                return listeners.splice(i, 1);\n        }\n        return listeners;\n    };\n    ;\n    return VertexListeners;\n}());\nexports.VertexListeners = VertexListeners;\n//# sourceMappingURL=VertexListeners.js.map","\"use strict\";\n/**\n * @author   Ikaros Kappler\n * @date     2018-04-22\n * @modified 2018-08-16 Added the curve() function to draw cubic bézier curves.\n * @modified 2018-10-23 Recognizing the offset param in the circle() function.\n * @modified 2018-11-27 Added the diamondHandle() function.\n * @modified 2018-11-28 Added the grid() function and the ellipse() function.\n * @modified 2018-11-30 Renamed the text() function to label() as it is not scaling.\n * @modified 2018-12-06 Added a test function for drawing arc in SVG style.\n * @modified 2018-12-09 Added the dot(Vertex,color) function (copied from Feigenbaum-plot-script).\n * @modified 2019-01-30 Added the arrow(Vertex,Vertex,color) function for drawing arrow heads.\n * @modified 2019-01-30 Added the image(Image,Vertex,Vertex) function for drawing images.\n * @modified 2019-04-27 Fixed a severe drawing bug in the arrow(...) function. Scaling arrows did not work properly.\n * @modified 2019-04-28 Added Math.round to the dot() drawing parameters to really draw a singlt dot.\n * @modified 2019-06-07 Fixed an issue in the cubicBezier() function. Paths were always closed.\n * @modified 2019-10-03 Added the beginDrawCycle hook.\n * @modified 2019-10-25 Polygons are no longer drawn with dashed lines (solid lines instead).\n * @modified 2019-11-18 Added the polyline function.\n * @modified 2019-11-22 Added a second workaround for th drawImage bug in Safari.\n * @modified 2019-12-07 Added the 'lineWidth' param to the line(...) function.\n * @modified 2019-12-07 Added the 'lineWidth' param to the cubicBezier(...) function.\n * @modified 2019-12-11 Added the 'color' param to the label(...) function.\n * @modified 2019-12-18 Added the quadraticBezier(...) function (for the sake of approximating Lissajous curves).\n * @modified 2019-12-20 Added the 'lineWidth' param to the polyline(...) function.\n * @modified 2020-01-09 Added the 'lineWidth' param to the ellipse(...) function.\n * @modified 2020-03-25 Ported this class from vanilla-JS to Typescript.\n * @modified 2020-05-05 Added the 'lineWidth' param to the circle(...) function.\n * @modified 2020-05-12 Drawing any handles (square, circle, diamond) with lineWidth 1 now; this was not reset before.\n * @modified 2020-06-22 Added a context.clearRect() call to the clear() function; clearing with alpha channel did not work as expected.\n * @modified 2020-09-07 Added the circleArc(...) function to draw sections of circles.\n * @modified 2020-10-06 Removed the .closePath() instruction from the circleArc function.\n * @modified 2020-10-15 Re-added the text() function.\n * @modified 2020-10-28 Added the path(Path2D) function.\n * @modified 2020-12-28 Added the `singleSegment` mode (test).\n * @modified 2021-01-05 Added the image-loaded/broken check.\n * @modified 2021-01-24 Added the `setCurrentId` function from the `DrawLib` interface.\n * @version  1.8.3\n **/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.drawutils = void 0;\nvar CubicBezierCurve_1 = require(\"./CubicBezierCurve\");\nvar Vertex_1 = require(\"./Vertex\");\n// Todo: rename this class to Drawutils?\n/**\n * @classdesc A wrapper class for basic drawing operations.\n *\n * @requires CubicBzierCurvce\n * @requires Polygon\n * @requires Vertex\n * @requires XYCoords\n */\nvar drawutils = /** @class */ (function () {\n    /**\n     * The constructor.\n     *\n     * @constructor\n     * @name drawutils\n     * @param {anvasRenderingContext2D} context - The drawing context.\n     * @param {boolean} fillShaped - Indicates if the constructed drawutils should fill all drawn shapes (if possible).\n     **/\n    function drawutils(context, fillShapes) {\n        this.ctx = context;\n        this.offset = new Vertex_1.Vertex(0, 0);\n        this.scale = new Vertex_1.Vertex(1, 1);\n        this.fillShapes = fillShapes;\n    }\n    ;\n    /**\n     * Called before each draw cycle.\n     * @param {UID=} uid - (optional) A UID identifying the currently drawn element(s).\n     **/\n    drawutils.prototype.beginDrawCycle = function (renderTime) {\n        // NOOP\n    };\n    ;\n    /**\n     * This method shouled be called each time the currently drawn `Drawable` changes.\n     * It is used by some libraries for identifying elemente on re-renders.\n     *\n     * @name setCurrentId\n     * @method\n     * @param {UID} uid - A UID identifying the currently drawn element(s).\n     **/\n    drawutils.prototype.setCurrentId = function (uid) {\n        // NOOP\n    };\n    ;\n    /**\n     * This method shouled be called each time the currently drawn `Drawable` changes.\n     * Determine the class name for further usage here.\n     *\n     * @name setCurrentClassName\n     * @method\n     * @param {string} className - A class name for further custom use cases.\n     **/\n    drawutils.prototype.setCurrentClassName = function (className) {\n        // NOOP\n    };\n    ;\n    /**\n     * Draw the line between the given two points with the specified (CSS-) color.\n     *\n     * @method line\n     * @param {Vertex} zA - The start point of the line.\n     * @param {Vertex} zB - The end point of the line.\n     * @param {string} color - Any valid CSS color string.\n     * @param {number} lineWidth? - [optional] The line's width.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     **/\n    drawutils.prototype.line = function (zA, zB, color, lineWidth) {\n        this.ctx.save();\n        this.ctx.beginPath();\n        this.ctx.moveTo(this.offset.x + zA.x * this.scale.x, this.offset.y + zA.y * this.scale.y);\n        this.ctx.lineTo(this.offset.x + zB.x * this.scale.x, this.offset.y + zB.y * this.scale.y);\n        this.ctx.strokeStyle = color;\n        this.ctx.lineWidth = lineWidth || 1;\n        this.ctx.stroke();\n        this.ctx.restore();\n    };\n    ;\n    /**\n     * Draw a line and an arrow at the end (zB) of the given line with the specified (CSS-) color.\n     *\n     * @method arrow\n     * @param {Vertex} zA - The start point of the arrow-line.\n     * @param {Vertex} zB - The end point of the arrow-line.\n     * @param {string} color - Any valid CSS color string.\n     * @param {number=} lineWidth - (optional) The line width to use; default is 1.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     **/\n    drawutils.prototype.arrow = function (zA, zB, color, lineWidth) {\n        var headlen = 8; // length of head in pixels\n        // var vertices = PlotBoilerplate.utils.buildArrowHead( zA, zB, headlen, this.scale.x, this.scale.y );\n        // var vertices : Array<Vertex> = Vertex.utils.buildArrowHead( zA, zB, headlen, this.scale.x, this.scale.y );\n        this.ctx.save();\n        this.ctx.beginPath();\n        var vertices = Vertex_1.Vertex.utils.buildArrowHead(zA, zB, headlen, this.scale.x, this.scale.y);\n        this.ctx.moveTo(this.offset.x + zA.x * this.scale.x, this.offset.y + zA.y * this.scale.y);\n        for (var i = 0; i < vertices.length; i++) {\n            this.ctx.lineTo(this.offset.x + vertices[i].x, this.offset.y + vertices[i].y);\n        }\n        this.ctx.lineTo(this.offset.x + vertices[0].x, this.offset.y + vertices[0].y);\n        this.ctx.lineWidth = lineWidth || 1;\n        this._fillOrDraw(color);\n        this.ctx.restore();\n    };\n    ;\n    /**\n     * Draw an image at the given position with the given size.<br>\n     * <br>\n     * Note: SVG images may have resizing issues at the moment.Draw a line and an arrow at the end (zB) of the given line with the specified (CSS-) color.\n     *\n     * @method image\n     * @param {Image} image - The image object to draw.\n     * @param {Vertex} position - The position to draw the the upper left corner at.\n     * @param {Vertex} size - The x/y-size to draw the image with.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     **/\n    drawutils.prototype.image = function (image, position, size) {\n        if (!image.complete || !image.naturalWidth) {\n            // Avoid drawing un-unloaded or broken images\n            return;\n        }\n        this.ctx.save();\n        // Note that there is a Safari bug with the 3 or 5 params variant.\n        // Only the 9-param varaint works.\n        this.ctx.drawImage(image, 0, 0, image.naturalWidth - 1, // There is this horrible Safari bug (fixed in newer versions)\n        image.naturalHeight - 1, // To avoid errors substract 1 here.\n        this.offset.x + position.x * this.scale.x, this.offset.y + position.y * this.scale.y, size.x * this.scale.x, size.y * this.scale.y);\n        this.ctx.restore();\n    };\n    ;\n    /**\n     * Draw a rectangle.\n     *\n     * @param {Vertex} position - The upper left corner of the rectangle.\n     * @param {number} width - The width of the rectangle.\n     * @param {number} height - The height of the rectangle.\n     * @param {string} color - The color to use.\n     * @param {number=1} lineWidth - (optional) The line with to use (default is 1).\n     **/\n    drawutils.prototype.rect = function (position, width, height, color, lineWidth) {\n        this.ctx.save();\n        this.ctx.beginPath();\n        this.ctx.moveTo(this.offset.x + position.x * this.scale.x, this.offset.y + position.y * this.scale.y);\n        this.ctx.lineTo(this.offset.x + (position.x + width) * this.scale.x, this.offset.y + position.y * this.scale.y);\n        this.ctx.lineTo(this.offset.x + (position.x + width) * this.scale.x, this.offset.y + (position.y + height) * this.scale.y);\n        this.ctx.lineTo(this.offset.x + position.x * this.scale.x, this.offset.y + (position.y + height) * this.scale.y);\n        // this.ctx.lineTo( this.offset.x+position.x*this.scale.x, this.offset.y+position.y*this.scale.y );\n        this.ctx.closePath();\n        this.ctx.lineWidth = lineWidth || 1;\n        this._fillOrDraw(color);\n        this.ctx.restore();\n    };\n    ;\n    // +---------------------------------------------------------------------------------\n    // | This is the final helper function for drawing and filling stuff. It is not\n    // | intended to be used from the outside.\n    // |\n    // | When in draw mode it draws the current shape.\n    // | When in fill mode it fills the current shape.\n    // |\n    // | This function is usually only called internally.\n    // |\n    // | @param color A stroke/fill color to use.\n    // +-------------------------------\n    // TODO: convert this to a STATIC function.\n    drawutils.prototype._fillOrDraw = function (color) {\n        if (this.fillShapes) {\n            this.ctx.fillStyle = color;\n            this.ctx.fill();\n        }\n        else {\n            this.ctx.strokeStyle = color;\n            this.ctx.stroke();\n        }\n    };\n    ;\n    /**\n     * Draw the given (cubic) bézier curve.\n     *\n     * @method cubicBezier\n     * @param {Vertex} startPoint - The start point of the cubic Bézier curve\n     * @param {Vertex} endPoint   - The end point the cubic Bézier curve.\n     * @param {Vertex} startControlPoint - The start control point the cubic Bézier curve.\n     * @param {Vertex} endControlPoint   - The end control point the cubic Bézier curve.\n     * @param {string} color - The CSS color to draw the curve with.\n     * @param {number} lineWidth - (optional) The line width to use.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutils.prototype.cubicBezier = function (startPoint, endPoint, startControlPoint, endControlPoint, color, lineWidth) {\n        if (startPoint instanceof CubicBezierCurve_1.CubicBezierCurve) {\n            this.cubicBezier(startPoint.startPoint, startPoint.endPoint, startPoint.startControlPoint, startPoint.endControlPoint, color, lineWidth);\n            return;\n        }\n        // Draw curve\n        this.ctx.save();\n        this.ctx.beginPath();\n        this.ctx.moveTo(this.offset.x + startPoint.x * this.scale.x, this.offset.y + startPoint.y * this.scale.y);\n        this.ctx.bezierCurveTo(this.offset.x + startControlPoint.x * this.scale.x, this.offset.y + startControlPoint.y * this.scale.y, this.offset.x + endControlPoint.x * this.scale.x, this.offset.y + endControlPoint.y * this.scale.y, this.offset.x + endPoint.x * this.scale.x, this.offset.y + endPoint.y * this.scale.y);\n        //this.ctx.closePath();\n        this.ctx.lineWidth = lineWidth || 2;\n        this._fillOrDraw(color);\n        this.ctx.restore();\n    };\n    ;\n    /**\n     * Draw the given (quadratic) bézier curve.\n     *\n     * @method quadraticBezier\n     * @param {Vertex} startPoint   - The start point of the cubic Bézier curve\n     * @param {Vertex} controlPoint - The control point the cubic Bézier curve.\n     * @param {Vertex} endPoint     - The end control point the cubic Bézier curve.\n     * @param {string} color        - The CSS color to draw the curve with.\n     * @param {number|string} lineWidth - (optional) The line width to use.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutils.prototype.quadraticBezier = function (startPoint, controlPoint, endPoint, color, lineWidth) {\n        // Draw curve\n        this.ctx.save();\n        this.ctx.beginPath();\n        this.ctx.moveTo(this.offset.x + startPoint.x * this.scale.x, this.offset.y + startPoint.y * this.scale.y);\n        this.ctx.quadraticCurveTo(this.offset.x + controlPoint.x * this.scale.x, this.offset.y + controlPoint.y * this.scale.y, this.offset.x + endPoint.x * this.scale.x, this.offset.y + endPoint.y * this.scale.y);\n        this.ctx.lineWidth = lineWidth || 2;\n        this._fillOrDraw(color);\n        this.ctx.restore();\n    };\n    ;\n    /**\n     * Draw the given (cubic) Bézier path.\n     *\n     * The given path must be an array with n*3+1 vertices, where n is the number of\n     * curves in the path:\n     * <pre> [ point1, point1_startControl, point2_endControl, point2, point2_startControl, point3_endControl, point3, ... pointN_endControl, pointN ]</pre>\n     *\n     * @method cubicBezierPath\n     * @param {Vertex[]} path - The cubic bezier path as described above.\n     * @param {string} color - The CSS colot to draw the path with.\n     * @param {number=1} lineWidth - (optional) The line width to use.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutils.prototype.cubicBezierPath = function (path, color, lineWidth) {\n        if (!path || path.length == 0)\n            return;\n        // Draw curve\n        this.ctx.save();\n        this.ctx.beginPath();\n        var endPoint;\n        var startControlPoint;\n        var endControlPoint;\n        this.ctx.moveTo(this.offset.x + path[0].x * this.scale.x, this.offset.y + path[0].y * this.scale.y);\n        for (var i = 1; i < path.length; i += 3) {\n            startControlPoint = path[i];\n            endControlPoint = path[i + 1];\n            endPoint = path[i + 2];\n            this.ctx.bezierCurveTo(this.offset.x + startControlPoint.x * this.scale.x, this.offset.y + startControlPoint.y * this.scale.y, this.offset.x + endControlPoint.x * this.scale.x, this.offset.y + endControlPoint.y * this.scale.y, this.offset.x + endPoint.x * this.scale.x, this.offset.y + endPoint.y * this.scale.y);\n        }\n        this.ctx.closePath();\n        this.ctx.lineWidth = lineWidth || 1;\n        this._fillOrDraw(color);\n        this.ctx.restore();\n    };\n    ;\n    /**\n     * Draw the given handle and handle point (used to draw interactive Bézier curves).\n     *\n     * The colors for this are fixed and cannot be specified.\n     *\n     * @method handle\n     * @param {Vertex} startPoint - The start of the handle.\n     * @param {Vertex} endPoint - The end point of the handle.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutils.prototype.handle = function (startPoint, endPoint) {\n        // Draw handles\n        // (No need to save and restore here)\n        this.point(startPoint, 'rgb(0,32,192)');\n        this.square(endPoint, 5, 'rgba(0,128,192,0.5)');\n    };\n    ;\n    /**\n     * Draw a handle line (with a light grey).\n     *\n     * @method handleLine\n     * @param {Vertex} startPoint - The start point to draw the handle at.\n     * @param {Vertex} endPoint - The end point to draw the handle at.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutils.prototype.handleLine = function (startPoint, endPoint) {\n        // Draw handle lines\n        this.line(startPoint, endPoint, 'rgb(192,192,192)');\n    };\n    ;\n    /**\n     * Draw a 1x1 dot with the specified (CSS-) color.\n     *\n     * @method dot\n     * @param {Vertex} p - The position to draw the dot at.\n     * @param {string} color - The CSS color to draw the dot with.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutils.prototype.dot = function (p, color) {\n        this.ctx.save();\n        this.ctx.beginPath();\n        this.ctx.moveTo(Math.round(this.offset.x + this.scale.x * p.x), Math.round(this.offset.y + this.scale.y * p.y));\n        this.ctx.lineTo(Math.round(this.offset.x + this.scale.x * p.x + 1), Math.round(this.offset.y + this.scale.y * p.y + 1));\n        this.ctx.closePath();\n        this.ctx.lineWidth = 1;\n        this._fillOrDraw(color);\n        this.ctx.restore();\n    };\n    ;\n    /**\n     * Draw the given point with the specified (CSS-) color and radius 3.\n     *\n     * @method point\n     * @param {Vertex} p - The position to draw the point at.\n     * @param {string} color - The CSS color to draw the point with.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutils.prototype.point = function (p, color) {\n        var radius = 3;\n        this.ctx.beginPath();\n        this.ctx.arc(this.offset.x + p.x * this.scale.x, this.offset.y + p.y * this.scale.y, radius, 0, 2 * Math.PI, false);\n        this.ctx.closePath();\n        this.ctx.lineWidth = 1;\n        this._fillOrDraw(color);\n    };\n    ;\n    /**\n     * Draw a circle with the specified (CSS-) color and radius.<br>\n     * <br>\n     * Note that if the x- and y- scales are different the result will be an ellipse rather than a circle.\n     *\n     * @method circle\n     * @param {Vertex} center - The center of the circle.\n     * @param {number} radius - The radius of the circle.\n     * @param {string} color - The CSS color to draw the circle with.\n     * @param {number} lineWidth - The line width (optional, default=1).\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutils.prototype.circle = function (center, radius, color, lineWidth) {\n        this.ctx.beginPath();\n        this.ctx.ellipse(this.offset.x + center.x * this.scale.x, this.offset.y + center.y * this.scale.y, radius * this.scale.x, radius * this.scale.y, 0.0, 0.0, Math.PI * 2);\n        this.ctx.closePath();\n        this.ctx.lineWidth = lineWidth || 1;\n        this._fillOrDraw(color);\n    };\n    ;\n    /**\n     * Draw a circular arc (section of a circle) with the given CSS color.\n     *\n     * @method circleArc\n     * @param {Vertex} center - The center of the circle.\n     * @param {number} radius - The radius of the circle.\n     * @param {number} startAngle - The angle to start at.\n     * @param {number} endAngle - The angle to end at.\n     * @param {string=#000000} color - The CSS color to draw the circle with.\n     * @param {number=1} lineWidth - The line width to use\n     // * @param {boolean=false} options.asSegment - If `true` then no beginPath and no draw will be applied (as part of larger path).\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutils.prototype.circleArc = function (center, radius, startAngle, endAngle, color, lineWidth, options) {\n        if (!options || !options.asSegment) {\n            this.ctx.beginPath();\n        }\n        this.ctx.ellipse(this.offset.x + center.x * this.scale.x, this.offset.y + center.y * this.scale.y, radius * this.scale.x, radius * this.scale.y, 0.0, startAngle, endAngle, false);\n        if (!options || !options.asSegment) {\n            // this.ctx.closePath();\n            this.ctx.lineWidth = lineWidth || 1;\n            this._fillOrDraw(color || '#000000');\n        }\n    };\n    ;\n    /**\n     * Draw an ellipse with the specified (CSS-) color and thw two radii.\n     *\n     * @method ellipse\n     * @param {Vertex} center - The center of the ellipse.\n     * @param {number} radiusX - The radius of the ellipse.\n     * @param {number} radiusY - The radius of the ellipse.\n     * @param {string} color - The CSS color to draw the ellipse with.\n     * @param {number} lineWidth=1 - An optional line width param (default is 1).\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutils.prototype.ellipse = function (center, radiusX, radiusY, color, lineWidth) {\n        this.ctx.beginPath();\n        this.ctx.ellipse(this.offset.x + center.x * this.scale.x, this.offset.y + center.y * this.scale.y, radiusX * this.scale.x, radiusY * this.scale.y, 0.0, 0.0, Math.PI * 2);\n        this.ctx.closePath();\n        this.ctx.lineWidth = lineWidth || 1;\n        this._fillOrDraw(color);\n    };\n    ;\n    /**\n     * Draw square at the given center, size and with the specified (CSS-) color.<br>\n     * <br>\n     * Note that if the x-scale and the y-scale are different the result will be a rectangle rather than a square.\n     *\n     * @method square\n     * @param {Vertex} center - The center of the square.\n     * @param {Vertex} size - The size of the square.\n     * @param {string} color - The CSS color to draw the square with.\n     * @param {number} lineWidth - The line with to use (optional, default is 1).\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutils.prototype.square = function (center, size, color, lineWidth) {\n        this.ctx.beginPath();\n        this.ctx.rect(this.offset.x + (center.x - size / 2.0) * this.scale.x, this.offset.y + (center.y - size / 2.0) * this.scale.y, size * this.scale.x, size * this.scale.y);\n        this.ctx.closePath();\n        this.ctx.lineWidth = lineWidth || 1;\n        this._fillOrDraw(color);\n    };\n    ;\n    /**\n     * Draw a grid of horizontal and vertical lines with the given (CSS-) color.\n     *\n     * @method grid\n     * @param {Vertex} center - The center of the grid.\n     * @param {number} width - The total width of the grid (width/2 each to the left and to the right).\n     * @param {number} height - The total height of the grid (height/2 each to the top and to the bottom).\n     * @param {number} sizeX - The horizontal grid size.\n     * @param {number} sizeY - The vertical grid size.\n     * @param {string} color - The CSS color to draw the grid with.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutils.prototype.grid = function (center, width, height, sizeX, sizeY, color) {\n        this.ctx.beginPath();\n        var yMin = -Math.ceil((height * 0.5) / sizeY) * sizeY;\n        var yMax = height / 2;\n        for (var x = -Math.ceil((width * 0.5) / sizeX) * sizeX; x < width / 2; x += sizeX) {\n            this.ctx.moveTo(this.offset.x + (center.x + x) * this.scale.x, this.offset.y + (center.y + yMin) * this.scale.y);\n            this.ctx.lineTo(this.offset.x + (center.x + x) * this.scale.x, this.offset.y + (center.y + yMax) * this.scale.y);\n        }\n        var xMin = -Math.ceil((width * 0.5) / sizeX) * sizeX; // -Math.ceil((height*0.5)/sizeY)*sizeY;\n        var xMax = width / 2; // height/2;\n        for (var y = -Math.ceil((height * 0.5) / sizeY) * sizeY; y < height / 2; y += sizeY) {\n            this.ctx.moveTo(this.offset.x + (center.x + xMin) * this.scale.x - 4, this.offset.y + (center.y + y) * this.scale.y);\n            this.ctx.lineTo(this.offset.x + (center.x + xMax) * this.scale.x + 4, this.offset.y + (center.y + y) * this.scale.y);\n        }\n        this.ctx.strokeStyle = color;\n        this.ctx.lineWidth = 1.0;\n        this.ctx.stroke();\n        this.ctx.closePath();\n    };\n    ;\n    /**\n     * Draw a raster of crosshairs in the given grid.<br>\n     *\n     * This works analogue to the grid() function\n     *\n     * @method raster\n     * @param {Vertex} center - The center of the raster.\n     * @param {number} width - The total width of the raster (width/2 each to the left and to the right).\n     * @param {number} height - The total height of the raster (height/2 each to the top and to the bottom).\n     * @param {number} sizeX - The horizontal raster size.\n     * @param {number} sizeY - The vertical raster size.\n     * @param {string} color - The CSS color to draw the raster with.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutils.prototype.raster = function (center, width, height, sizeX, sizeY, color) {\n        this.ctx.save();\n        this.ctx.beginPath();\n        for (var x = -Math.ceil((width * 0.5) / sizeX) * sizeX; x < width / 2; x += sizeX) {\n            for (var y = -Math.ceil((height * 0.5) / sizeY) * sizeY; y < height / 2; y += sizeY) {\n                // Draw a crosshair\n                this.ctx.moveTo(this.offset.x + (center.x + x) * this.scale.x - 4, this.offset.y + (center.y + y) * this.scale.y);\n                this.ctx.lineTo(this.offset.x + (center.x + x) * this.scale.x + 4, this.offset.y + (center.y + y) * this.scale.y);\n                this.ctx.moveTo(this.offset.x + (center.x + x) * this.scale.x, this.offset.y + (center.y + y) * this.scale.y - 4);\n                this.ctx.lineTo(this.offset.x + (center.x + x) * this.scale.x, this.offset.y + (center.y + y) * this.scale.y + 4);\n            }\n        }\n        this.ctx.strokeStyle = color;\n        this.ctx.lineWidth = 1.0;\n        this.ctx.stroke();\n        this.ctx.closePath();\n        this.ctx.restore();\n    };\n    ;\n    /**\n     * Draw a diamond handle (square rotated by 45°) with the given CSS color.\n     *\n     * It is an inherent feature of the handle functions that the drawn elements are not scaled and not\n     * distorted. So even if the user zooms in or changes the aspect ratio, the handles will be drawn\n     * as even shaped diamonds.\n     *\n     * @method diamondHandle\n     * @param {Vertex} center - The center of the diamond.\n     * @param {Vertex} size - The x/y-size of the diamond.\n     * @param {string} color - The CSS color to draw the diamond with.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutils.prototype.diamondHandle = function (center, size, color) {\n        this.ctx.beginPath();\n        this.ctx.moveTo(this.offset.x + center.x * this.scale.x - size / 2.0, this.offset.y + center.y * this.scale.y);\n        this.ctx.lineTo(this.offset.x + center.x * this.scale.x, this.offset.y + center.y * this.scale.y - size / 2.0);\n        this.ctx.lineTo(this.offset.x + center.x * this.scale.x + size / 2.0, this.offset.y + center.y * this.scale.y);\n        this.ctx.lineTo(this.offset.x + center.x * this.scale.x, this.offset.y + center.y * this.scale.y + size / 2.0);\n        this.ctx.closePath();\n        this.ctx.lineWidth = 1;\n        this._fillOrDraw(color);\n    };\n    ;\n    /**\n     * Draw a square handle with the given CSS color.<br>\n     * <br>\n     * It is an inherent feature of the handle functions that the drawn elements are not scaled and not\n     * distorted. So even if the user zooms in or changes the aspect ratio, the handles will be drawn\n     * as even shaped squares.\n     *\n     * @method squareHandle\n     * @param {Vertex} center - The center of the square.\n     * @param {Vertex} size - The x/y-size of the square.\n     * @param {string} color - The CSS color to draw the square with.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutils.prototype.squareHandle = function (center, size, color) {\n        this.ctx.beginPath();\n        this.ctx.rect(this.offset.x + center.x * this.scale.x - size / 2.0, this.offset.y + center.y * this.scale.y - size / 2.0, size, size);\n        this.ctx.closePath();\n        this.ctx.lineWidth = 1;\n        this._fillOrDraw(color);\n    };\n    ;\n    /**\n     * Draw a circle handle with the given CSS color.<br>\n     * <br>\n     * It is an inherent feature of the handle functions that the drawn elements are not scaled and not\n     * distorted. So even if the user zooms in or changes the aspect ratio, the handles will be drawn\n     * as even shaped circles.\n     *\n     * @method circleHandle\n     * @param {Vertex} center - The center of the circle.\n     * @param {number} radius - The radius of the circle.\n     * @param {string} color - The CSS color to draw the circle with.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutils.prototype.circleHandle = function (center, radius, color) {\n        radius = radius || 3;\n        this.ctx.beginPath();\n        this.ctx.arc(this.offset.x + center.x * this.scale.x, this.offset.y + center.y * this.scale.y, radius, 0, 2 * Math.PI, false);\n        this.ctx.closePath();\n        this.ctx.lineWidth = 1;\n        this._fillOrDraw(color);\n    };\n    ;\n    /**\n     * Draw a crosshair with given radius and color at the given position.<br>\n     * <br>\n     * Note that the crosshair radius will not be affected by scaling.\n     *\n     * @method crosshair\n     * @param {XYCoords} center - The center of the crosshair.\n     * @param {number} radius - The radius of the crosshair.\n     * @param {string} color - The CSS color to draw the crosshair with.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutils.prototype.crosshair = function (center, radius, color) {\n        this.ctx.save();\n        this.ctx.beginPath();\n        this.ctx.moveTo(this.offset.x + center.x * this.scale.x - radius, this.offset.y + center.y * this.scale.y);\n        this.ctx.lineTo(this.offset.x + center.x * this.scale.x + radius, this.offset.y + center.y * this.scale.y);\n        this.ctx.moveTo(this.offset.x + center.x * this.scale.x, this.offset.y + center.y * this.scale.y - radius);\n        this.ctx.lineTo(this.offset.x + center.x * this.scale.x, this.offset.y + center.y * this.scale.y + radius);\n        this.ctx.strokeStyle = color;\n        this.ctx.lineWidth = 0.5;\n        this.ctx.stroke();\n        this.ctx.closePath();\n        this.ctx.restore();\n    };\n    ;\n    /**\n     * Draw a polygon.\n     *\n     * @method polygon\n     * @param {Polygon}  polygon - The polygon to draw.\n     * @param {string}   color - The CSS color to draw the polygon with.\n     * @param {string}   lineWidth - The line width to use.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutils.prototype.polygon = function (polygon, color, lineWidth) {\n        this.polyline(polygon.vertices, polygon.isOpen, color, lineWidth);\n    };\n    ;\n    /**\n     * Draw a polygon line (alternative function to the polygon).\n     *\n     * @method polyline\n     * @param {Vertex[]} vertices   - The polygon vertices to draw.\n     * @param {boolan}   isOpen     - If true the polyline will not be closed at its end.\n     * @param {string}   color      - The CSS color to draw the polygon with.\n     * @param {number}   lineWidth  - The line width (default is 1.0);\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutils.prototype.polyline = function (vertices, isOpen, color, lineWidth) {\n        if (vertices.length <= 1)\n            return;\n        this.ctx.save();\n        this.ctx.beginPath();\n        this.ctx.lineWidth = lineWidth || 1.0;\n        this.ctx.moveTo(this.offset.x + vertices[0].x * this.scale.x, this.offset.y + vertices[0].y * this.scale.y);\n        for (var i = 0; i < vertices.length; i++) {\n            this.ctx.lineTo(this.offset.x + vertices[i].x * this.scale.x, this.offset.y + vertices[i].y * this.scale.y);\n        }\n        if (!isOpen) // && vertices.length > 2 )\n            this.ctx.closePath();\n        this._fillOrDraw(color);\n        this.ctx.closePath();\n        this.ctx.setLineDash([]);\n        this.ctx.restore();\n    };\n    ;\n    drawutils.prototype.text = function (text, x, y, options) {\n        options = options || {};\n        this.ctx.save();\n        x = this.offset.x + x * this.scale.x;\n        y = this.offset.y + y * this.scale.y;\n        var color = options.color || 'black';\n        if (this.fillShapes) {\n            this.ctx.fillStyle = color;\n            this.ctx.fillText(text, x, y);\n        }\n        else {\n            this.ctx.strokeStyle = color;\n            this.ctx.strokeText(text, x, y);\n        }\n        this.ctx.restore();\n    };\n    ;\n    /**\n     * Draw a non-scaling text label at the given position.\n     *\n     * Note that these are absolute label positions, they are not affected by offset or scale.\n     *\n     * @method label\n     * @param {string} text - The text to draw.\n     * @param {number} x - The x-position to draw the text at.\n     * @param {number} y - The y-position to draw the text at.\n     * @param {number=} rotation - The (optional) rotation in radians (default=0).\n     * @param {string=} color - The color to render the text with (default=black).\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutils.prototype.label = function (text, x, y, rotation, color) {\n        this.ctx.save();\n        this.ctx.translate(x, y);\n        if (typeof rotation != 'undefined')\n            this.ctx.rotate(rotation);\n        this.ctx.fillStyle = color || 'black';\n        if (this.fillShapes) {\n            this.ctx.fillText(text, 0, 0);\n        }\n        else {\n            this.ctx.strokeText(text, 0, 0);\n        }\n        this.ctx.restore();\n    };\n    ;\n    /**\n     * Due to gl compatibility there is a generic 'clear' function required\n     * to avoid accessing the context object itself directly.\n     *\n     * This function just fills the whole canvas with a single color.\n     *\n     * @param {string} color - The color to clear with.\n     **/\n    drawutils.prototype.clear = function (color) {\n        this.ctx.clearRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height);\n        this.ctx.fillStyle = color;\n        this.ctx.fillRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height);\n    };\n    ;\n    return drawutils;\n}());\nexports.drawutils = drawutils;\n//# sourceMappingURL=draw.js.map","\"use strict\";\n/**\n * @author   Ikaros Kappler\n * @date     2019-09-18\n * @modified 2019-10-03 Added the beginDrawCycle hook.\n * @modified 2020-03-25 Ported stub to Typescript.\n * @modified 2020-10-15 Re-added the text() function.\n * @modified 2021-01-24 Added the `setCurrentId` function.\n * @version  0.0.5\n **/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.drawutilsgl = void 0;\nvar Vertex_1 = require(\"./Vertex\");\n/**\n * @classdesc A wrapper class for basic drawing operations. This is the WebGL\n * implementation whih sould work with shaders.\n *\n * @requires CubicBzierCurvce\n * @requires Polygon\n * @requires SVGSerializable\n * @requires Vertex\n * @requires XYCoords\n */\nvar drawutilsgl = /** @class */ (function () {\n    /**\n     * The constructor.\n     *\n     * @constructor\n     * @name drawutils\n     * @param {WebGLRenderingContext} context - The drawing context.\n     * @param {boolean} fillShaped - Indicates if the constructed drawutils should fill all drawn shapes (if possible).\n     **/\n    function drawutilsgl(context, fillShapes) {\n        this.gl = context;\n        this.offset = new Vertex_1.Vertex(0, 0);\n        this.scale = new Vertex_1.Vertex(1, 1);\n        this.fillShapes = fillShapes;\n        this._zindex = 0.0;\n        if (context == null || typeof context === 'undefined')\n            return;\n        this.glutils = new GLU(context);\n        // PROBLEM: CANNOT USE MULTIPLE SHADER PROGRAM INSTANCES ON THE SAME CONTEXT!\n        // SOLUTION: USE SHARED SHADER PROGRAM!!! ... somehow ...\n        // This needs to be considered in the overlying component; both draw-instances need to\n        // share their gl context.\n        // That's what the copyInstace(boolean) method is good for.\n        this._vertShader = this.glutils.compileShader(drawutilsgl.vertCode, this.gl.VERTEX_SHADER);\n        this._fragShader = this.glutils.compileShader(drawutilsgl.fragCode, this.gl.FRAGMENT_SHADER);\n        this._program = this.glutils.makeProgram(this._vertShader, this._fragShader);\n        // Create an empty buffer object\n        this.vertex_buffer = this.gl.createBuffer();\n        // Bind appropriate array buffer to it\n        // this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.vertex_buffer);\n        console.log('gl initialized');\n    }\n    ;\n    drawutilsgl.prototype._x2rel = function (x) { return (this.scale.x * x + this.offset.x) / this.gl.canvas.width * 2.0 - 1.0; };\n    ;\n    drawutilsgl.prototype._y2rel = function (y) { return (this.offset.y - this.scale.y * y) / this.gl.canvas.height * 2.0 - 1.0; };\n    ;\n    /**\n     * Creates a 'shallow' (non deep) copy of this instance. This implies\n     * that under the hood the same gl context and gl program will be used.\n     */\n    drawutilsgl.prototype.copyInstance = function (fillShapes) {\n        var copy = new drawutilsgl(null, fillShapes);\n        copy.gl = this.gl;\n        copy.glutils = this.glutils;\n        copy._vertShader = this._vertShader;\n        copy._fragShader = this._fragShader;\n        copy._program = this._program;\n        return copy;\n    };\n    ;\n    /**\n     * Called before each draw cycle.\n     * @param {number} renderTime\n     **/\n    drawutilsgl.prototype.beginDrawCycle = function (renderTime) {\n        this._zindex = 0.0;\n        this.renderTime = renderTime;\n    };\n    ;\n    /**\n     * This method shouled be called each time the currently drawn `Drawable` changes.\n     * It is used by some libraries for identifying elemente on re-renders.\n     *\n     * @name setCurrentId\n     * @method\n     * @param {UID} uid - A UID identifying the currently drawn element(s).es.\n     **/\n    drawutilsgl.prototype.setCurrentId = function (uid) {\n        // NOOP\n        this.curId = uid;\n    };\n    ;\n    /**\n     * This method shouled be called each time the currently drawn `Drawable` changes.\n     * Determine the class name for further usage here.\n     *\n     * @name setCurrentClassName\n     * @method\n     * @param {string} className - A class name for further custom use cases.\n     **/\n    drawutilsgl.prototype.setCurrentClassName = function (className) {\n        // NOOP\n    };\n    ;\n    /**\n     * Draw the line between the given two points with the specified (CSS-) color.\n     *\n     * @method line\n     * @param {Vertex} zA - The start point of the line.\n     * @param {Vertex} zB - The end point of the line.\n     * @param {string} color - Any valid CSS color string.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     **/\n    drawutilsgl.prototype.line = function (zA, zB, color) {\n        var vertices = new Float32Array(6);\n        vertices[0] = this._x2rel(zA.x);\n        vertices[1] = this._y2rel(zA.y);\n        vertices[2] = this._zindex;\n        vertices[3] = this._x2rel(zB.x);\n        vertices[4] = this._y2rel(zB.y);\n        vertices[5] = this._zindex;\n        this._zindex += 0.001;\n        // Create an empty buffer object\n        // const vertex_buffer = this.gl.createBuffer();\n        // Bind appropriate array buffer to it\n        this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.vertex_buffer);\n        // Pass the vertex data to the buffer\n        this.gl.bufferData(this.gl.ARRAY_BUFFER, vertices, this.gl.STATIC_DRAW);\n        // Bind vertex buffer object\n        // this.gl.bindBuffer(this.gl.ARRAY_BUFFER, vertex_buffer);\n        // Get the attribute location\n        var coord = this.gl.getAttribLocation(this._program, \"position\");\n        // Point an attribute to the currently bound VBO\n        this.gl.vertexAttribPointer(coord, 3, this.gl.FLOAT, false, 0, 0);\n        // Enable the attribute\n        this.gl.enableVertexAttribArray(coord);\n        // Unbind the buffer?\n        //this.gl.bindBuffer(this.gl.ARRAY_BUFFER, null);\n        // Set the view port\n        this.gl.viewport(0, 0, this.gl.canvas.width, this.gl.canvas.height);\n        var uRotationVector = this.gl.getUniformLocation(this._program, \"uRotationVector\");\n        // let radians = currentAngle * Math.PI / 180.0;\n        var currentRotation = [0.0, 1.0];\n        //currentRotation[0] = Math.sin(radians);\n        //currentRotation[1] = Math.cos(radians);\n        this.gl.uniform2fv(uRotationVector, currentRotation);\n        this.gl.lineWidth(5);\n        // Draw the line\n        this.gl.drawArrays(this.gl.LINES, 0, vertices.length / 3);\n        // POINTS, LINE_STRIP, LINE_LOOP, LINES,\n        // TRIANGLE_STRIP,TRIANGLE_FAN, TRIANGLES\n    };\n    ;\n    /**\n     * Draw a line and an arrow at the end (zB) of the given line with the specified (CSS-) color.\n     *\n     * @method arrow\n     * @param {Vertex} zA - The start point of the arrow-line.\n     * @param {Vertex} zB - The end point of the arrow-line.\n     * @param {string} color - Any valid CSS color string.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     **/\n    drawutilsgl.prototype.arrow = function (zA, zB, color) {\n        // NOT YET IMPLEMENTED\n    };\n    ;\n    /**\n     * Draw an image at the given position with the given size.<br>\n     * <br>\n     * Note: SVG images may have resizing issues at the moment.Draw a line and an arrow at the end (zB) of the given line with the specified (CSS-) color.\n     *\n     * @method image\n     * @param {Image} image - The image object to draw.\n     * @param {Vertex} position - The position to draw the the upper left corner at.\n     * @param {Vertex} size - The x/y-size to draw the image with.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     **/\n    drawutilsgl.prototype.image = function (image, position, size) {\n        // NOT YET IMPLEMENTED\n    };\n    ;\n    // +---------------------------------------------------------------------------------\n    // | This is the final helper function for drawing and filling stuff. It is not\n    // | intended to be used from the outside.\n    // |\n    // | When in draw mode it draws the current shape.\n    // | When in fill mode it fills the current shape.\n    // |\n    // | This function is usually only called internally.\n    // |\n    // | @param color A stroke/fill color to use.\n    // +-------------------------------\n    drawutilsgl.prototype._fillOrDraw = function (color) {\n        // NOT YET IMPLEMENTED\n    };\n    ;\n    /**\n     * Draw the given (cubic) bézier curve.\n     *\n     * @method cubicBezier\n     * @param {Vertex} startPoint - The start point of the cubic Bézier curve\n     * @param {Vertex} endPoint   - The end point the cubic Bézier curve.\n     * @param {Vertex} startControlPoint - The start control point the cubic Bézier curve.\n     * @param {Vertex} endControlPoint   - The end control point the cubic Bézier curve.\n     * @param {string} color - The CSS color to draw the curve with.\n     * @param {number=} lineWidth - (optional) The line width to use; default is 1.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutilsgl.prototype.cubicBezier = function (startPoint, endPoint, startControlPoint, endControlPoint, color, lineWidth) {\n        // NOT YET IMPLEMENTED\n    };\n    ;\n    /**\n     * Draw the given (cubic) Bézier path.\n     *\n     * The given path must be an array with n*3+1 vertices, where n is the number of\n     * curves in the path:\n     * <pre> [ point1, point1_startControl, point2_endControl, point2, point2_startControl, point3_endControl, point3, ... pointN_endControl, pointN ]</pre>\n     *\n     * @method cubicBezierPath\n     * @param {Vertex[]} path - The cubic bezier path as described above.\n     * @param {string} color - The CSS colot to draw the path with.\n     * @param {number=} lineWidth - (optional) The line width to use; default is 1.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutilsgl.prototype.cubicBezierPath = function (path, color, lineWidth) {\n        // NOT YET IMPLEMENTED\n    };\n    ;\n    /**\n     * Draw the given handle and handle point (used to draw interactive Bézier curves).\n     *\n     * The colors for this are fixed and cannot be specified.\n     *\n     * @method handle\n     * @param {Vertex} startPoint - The start of the handle.\n     * @param {Vertex} endPoint - The end point of the handle.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutilsgl.prototype.handle = function (startPoint, endPoint) {\n        // NOT YET IMPLEMENTED\n    };\n    ;\n    /**\n     * Draw a handle line (with a light grey).\n     *\n     * @method handleLine\n     * @param {Vertex} startPoint - The start point to draw the handle at.\n     * @param {Vertex} endPoint - The end point to draw the handle at.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutilsgl.prototype.handleLine = function (startPoint, endPoint) {\n        // NOT YET IMPLEMENTED\n    };\n    ;\n    /**\n     * Draw a 1x1 dot with the specified (CSS-) color.\n     *\n     * @method dot\n     * @param {Vertex} p - The position to draw the dot at.\n     * @param {string} color - The CSS color to draw the dot with.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutilsgl.prototype.dot = function (p, color) {\n        // NOT YET IMPLEMENTED\n    };\n    ;\n    /**\n     * Draw the given point with the specified (CSS-) color and radius 3.\n     *\n     * @method point\n     * @param {Vertex} p - The position to draw the point at.\n     * @param {string} color - The CSS color to draw the point with.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutilsgl.prototype.point = function (p, color) {\n        // NOT YET IMPLEMENTED\n    };\n    ;\n    /**\n     * Draw a circle with the specified (CSS-) color and radius.<br>\n     * <br>\n     * Note that if the x- and y- scales are different the result will be an ellipse rather than a circle.\n     *\n     * @method circle\n     * @param {Vertex} center - The center of the circle.\n     * @param {number} radius - The radius of the circle.\n     * @param {string} color - The CSS color to draw the circle with.\n     * @param {number=} lineWidth - (optional) The line width to use; default is 1.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutilsgl.prototype.circle = function (center, radius, color, lineWidth) {\n        // NOT YET IMPLEMENTED\n    };\n    ;\n    /**\n     * Draw a circular arc (section of a circle) with the given CSS color.\n     *\n     * @method circleArc\n     * @param {Vertex} center - The center of the circle.\n     * @param {number} radius - The radius of the circle.\n     * @param {number} startAngle - The angle to start at.\n     * @param {number} endAngle - The angle to end at.\n     * @param {string} color - The CSS color to draw the circle with.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutilsgl.prototype.circleArc = function (center, radius, startAngle, endAngle, color, lineWidth) {\n        // NOT YET IMPLEMENTED\n    };\n    ;\n    /**\n     * Draw an ellipse with the specified (CSS-) color and thw two radii.\n     *\n     * @method ellipse\n     * @param {Vertex} center - The center of the ellipse.\n     * @param {number} radiusX - The radius of the ellipse.\n     * @param {number} radiusY - The radius of the ellipse.\n     * @param {string} color - The CSS color to draw the ellipse with.\n     * @param {number=} lineWidth - (optional) The line width to use; default is 1.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutilsgl.prototype.ellipse = function (center, radiusX, radiusY, color, lineWidth) {\n        // NOT YET IMPLEMENTED\n    };\n    ;\n    /**\n     * Draw square at the given center, size and with the specified (CSS-) color.<br>\n     * <br>\n     * Note that if the x-scale and the y-scale are different the result will be a rectangle rather than a square.\n     *\n     * @method square\n     * @param {Vertex} center - The center of the square.\n     * @param {Vertex} size - The size of the square.\n     * @param {string} color - The CSS color to draw the square with.\n     * @param {number=} lineWidth - (optional) The line width to use; default is 1.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutilsgl.prototype.square = function (center, size, color, lineWidth) {\n        // NOT YET IMPLEMENTED\n    };\n    ;\n    /**\n     * Draw a grid of horizontal and vertical lines with the given (CSS-) color.\n     *\n     * @method grid\n     * @param {Vertex} center - The center of the grid.\n     * @param {number} width - The total width of the grid (width/2 each to the left and to the right).\n     * @param {number} height - The total height of the grid (height/2 each to the top and to the bottom).\n     * @param {number} sizeX - The horizontal grid size.\n     * @param {number} sizeY - The vertical grid size.\n     * @param {string} color - The CSS color to draw the grid with.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutilsgl.prototype.grid = function (center, width, height, sizeX, sizeY, color) {\n        // NOT YET IMPLEMENTED\n    };\n    ;\n    /**\n     * Draw a raster of crosshairs in the given grid.<br>\n     *\n     * This works analogue to the grid() function\n     *\n     * @method raster\n     * @param {Vertex} center - The center of the raster.\n     * @param {number} width - The total width of the raster (width/2 each to the left and to the right).\n     * @param {number} height - The total height of the raster (height/2 each to the top and to the bottom).\n     * @param {number} sizeX - The horizontal raster size.\n     * @param {number} sizeY - The vertical raster size.\n     * @param {string} color - The CSS color to draw the raster with.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutilsgl.prototype.raster = function (center, width, height, sizeX, sizeY, color) {\n        // NOT YET IMPLEMENTED\n    };\n    ;\n    /**\n     * Draw a diamond handle (square rotated by 45°) with the given CSS color.\n     *\n     * It is an inherent featur of the handle functions that the drawn elements are not scaled and not\n     * distorted. So even if the user zooms in or changes the aspect ratio, the handles will be drawn\n     * as even shaped diamonds.\n     *\n     * @method diamondHandle\n     * @param {Vertex} center - The center of the diamond.\n     * @param {Vertex} size - The x/y-size of the diamond.\n     * @param {string} color - The CSS color to draw the diamond with.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutilsgl.prototype.diamondHandle = function (center, size, color) {\n        // NOT YET IMPLEMENTED\n    };\n    ;\n    /**\n     * Draw a square handle with the given CSS color.<br>\n     * <br>\n     * It is an inherent featur of the handle functions that the drawn elements are not scaled and not\n     * distorted. So even if the user zooms in or changes the aspect ratio, the handles will be drawn\n     * as even shaped squares.\n     *\n     * @method squareHandle\n     * @param {Vertex} center - The center of the square.\n     * @param {Vertex} size - The x/y-size of the square.\n     * @param {string} color - The CSS color to draw the square with.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutilsgl.prototype.squareHandle = function (center, size, color) {\n        // NOT YET IMPLEMENTED\n    };\n    ;\n    /**\n     * Draw a circle handle with the given CSS color.<br>\n     * <br>\n     * It is an inherent featur of the handle functions that the drawn elements are not scaled and not\n     * distorted. So even if the user zooms in or changes the aspect ratio, the handles will be drawn\n     * as even shaped circles.\n     *\n     * @method circleHandle\n     * @param {Vertex} center - The center of the circle.\n     * @param {number} radius - The radius of the circle.\n     * @param {string} color - The CSS color to draw the circle with.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutilsgl.prototype.circleHandle = function (center, size, color) {\n        // NOT YET IMPLEMENTED\n    };\n    ;\n    /**\n     * Draw a crosshair with given radius and color at the given position.<br>\n     * <br>\n     * Note that the crosshair radius will not be affected by scaling.\n     *\n     * @method crosshair\n     * @param {XYCoords} center - The center of the crosshair.\n     * @param {number} radius - The radius of the crosshair.\n     * @param {string} color - The CSS color to draw the crosshair with.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutilsgl.prototype.crosshair = function (center, radius, color) {\n        // NOT YET IMPLEMENTED\t\n    };\n    ;\n    /**\n     * Draw a polygon.\n     *\n     * @method polygon\n     * @param {Polygon} polygon - The polygon to draw.\n     * @param {string} color - The CSS color to draw the polygon with.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutilsgl.prototype.polygon = function (polygon, color, lineWidth) {\n        var vertices = new Float32Array(polygon.vertices.length * 3);\n        for (var i = 0; i < polygon.vertices.length; i++) {\n            vertices[i * 3 + 0] = this._x2rel(polygon.vertices[i].x);\n            vertices[i * 3 + 1] = this._y2rel(polygon.vertices[i].y);\n            vertices[i * 3 + 2] = this._zindex;\n        }\n        this._zindex += 0.001;\n        //console.log( vertices );\n        // Create an empty buffer object\n        // const vertex_buffer = this.gl.createBuffer();\n        // Bind appropriate array buffer to it\n        this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.vertex_buffer);\n        // Pass the vertex data to the buffer\n        this.gl.bufferData(this.gl.ARRAY_BUFFER, vertices, this.gl.STATIC_DRAW);\n        // Bind vertex buffer object\n        // this.gl.bindBuffer(this.gl.ARRAY_BUFFER, vertex_buffer);\n        // Get the attribute location\n        var coord = this.gl.getAttribLocation(this._program, \"position\");\n        // Point an attribute to the currently bound VBO\n        this.gl.vertexAttribPointer(coord, 3, this.gl.FLOAT, false, 0, 0);\n        // Enable the attribute\n        this.gl.enableVertexAttribArray(coord);\n        // Unbind the buffer?\n        this.gl.bindBuffer(this.gl.ARRAY_BUFFER, null);\n        // Set the view port\n        this.gl.viewport(0, 0, this.gl.canvas.width, this.gl.canvas.height);\n        var uRotationVector = this.gl.getUniformLocation(this._program, \"uRotationVector\");\n        // let radians = currentAngle * Math.PI / 180.0;\n        var currentRotation = [0.0, 1.0];\n        //currentRotation[0] = Math.sin(radians);\n        //currentRotation[1] = Math.cos(radians);\n        this.gl.uniform2fv(uRotationVector, currentRotation);\n        // Draw the polygon\n        this.gl.drawArrays(this.gl.TRIANGLE_FAN, 0, vertices.length / 3);\n        // POINTS, LINE_STRIP, LINE_LOOP, LINES,\n        // TRIANGLE_STRIP,TRIANGLE_FAN, TRIANGLES\n    };\n    ;\n    /**\n     * Draw a polygon line (alternative function to the polygon).\n     *\n     * @method polyline\n     * @param {Vertex[]} vertices - The polygon vertices to draw.\n     * @param {boolan}   isOpen   - If true the polyline will not be closed at its end.\n     * @param {string}   color    - The CSS color to draw the polygon with.\n     * @param {number=}  lineWidth - (optional) The line width to use; default is 1.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    drawutilsgl.prototype.polyline = function (vertices, isOpen, color, lineWidth) {\n        // NOT YET IMPLEMENTED\n    };\n    ;\n    drawutilsgl.prototype.text = function (text, x, y, options) {\n        // NOT YET IMPLEMENTED\n    };\n    ;\n    /**\n     * Draw a non-scaling text label at the given position.\n     *\n     * @method label\n     * @param {string} text - The text to draw.\n     * @param {number} x - The x-position to draw the text at.\n     * @param {number} y - The y-position to draw the text at.\n     * @param {number=} rotation - The (aoptional) rotation in radians.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    // +---------------------------------------------------------------------------------\n    // | Draw a non-scaling text label at the given position.\n    // +-------------------------------\n    drawutilsgl.prototype.label = function (text, x, y, rotation) {\n        // NOT YET IMPLEMENTED\n    };\n    ;\n    /**\n     * Due to gl compatibility there is a generic 'clear' function required\n     * to avoid accessing the context object itself directly.\n     *\n     * This function just fills the whole canvas with a single color.\n     *\n     * @param {string} color - The color to clear with.\n     **/\n    drawutilsgl.prototype.clear = function (color) {\n        // NOT YET IMPLEMENTED\n        // if( typeof color == 'string' )\n        // color = Color.parse(color); // Color class does not yet exist in TS\n        // Clear the canvas\n        this.gl.clearColor(1.0, 1.0, 1.0, 1.0);\n        // Enable the depth test\n        this.gl.enable(this.gl.DEPTH_TEST);\n        // Clear the color and depth buffer\n        this.gl.clear(this.gl.COLOR_BUFFER_BIT | this.gl.DEPTH_BUFFER_BIT);\n    };\n    ;\n    // Vertex shader source code\n    drawutilsgl.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    }\";\n    // Fragment shader source code\n    drawutilsgl.fragCode = \"\\n    precision highp float;\\n\\n    void main(void) {\\n\\tgl_FragColor = vec4(0.0,0.75,1.0,1.0);\\n    }\";\n    return drawutilsgl;\n}());\nexports.drawutilsgl = drawutilsgl;\n/**\n * Some GL helper utils.\n **/\nvar GLU = /** @class */ (function () {\n    function GLU(gl) {\n        this.gl = gl;\n    }\n    ;\n    GLU.prototype.bufferData = function (verts) {\n        // Create an empty buffer object\n        var vbuffer = this.gl.createBuffer();\n        // Bind appropriate array buffer to it\n        this.gl.bindBuffer(this.gl.ARRAY_BUFFER, vbuffer);\n        // Pass the vertex data to the buffer\n        this.gl.bufferData(this.gl.ARRAY_BUFFER, verts, this.gl.STATIC_DRAW);\n        // Unbind the buffer\n        this.gl.bindBuffer(this.gl.ARRAY_BUFFER, null);\n        return vbuffer;\n    };\n    ;\n    /*=================== Shaders ====================*/\n    GLU.prototype.compileShader = function (shaderCode, shaderType) {\n        // Create a vertex shader object\n        var shader = this.gl.createShader(shaderType);\n        // Attach vertex shader source code\n        this.gl.shaderSource(shader, shaderCode);\n        // Compile the vertex shader\n        this.gl.compileShader(shader);\n        var vertStatus = this.gl.getShaderParameter(shader, this.gl.COMPILE_STATUS);\n        if (!vertStatus) {\n            console.warn(\"Error in shader:\" + this.gl.getShaderInfoLog(shader));\n            this.gl.deleteShader(shader);\n            return null;\n        }\n        return shader;\n    };\n    ;\n    GLU.prototype.makeProgram = function (vertShader, fragShader) {\n        // Create a shader program object to store\n        // the combined shader program\n        var program = this.gl.createProgram();\n        // Attach a vertex shader\n        this.gl.attachShader(program, vertShader);\n        // Attach a fragment shader\n        this.gl.attachShader(program, fragShader);\n        // Link both the programs\n        this.gl.linkProgram(program);\n        // Use the combined shader program object\n        this.gl.useProgram(program);\n        /*======= Do some cleanup ======*/\n        this.gl.detachShader(program, vertShader);\n        this.gl.detachShader(program, fragShader);\n        this.gl.deleteShader(vertShader);\n        this.gl.deleteShader(fragShader);\n        return program;\n    };\n    ;\n    return GLU;\n}());\n//# sourceMappingURL=drawgl.js.map","\"use strict\";\n/**\n * @author  Ikaros Kappler\n * @date    2019-02-03\n * @version 1.0.0\n **/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.geomutils = void 0;\nvar Line_1 = require(\"./Line\");\nvar Triangle_1 = require(\"./Triangle\");\n/**\n * A collection of usefull geometry utilities.\n *\n * @global\n **/\nexports.geomutils = {\n    /**\n     * Compute the n-section of the angle – described as a triangle (A,B,C) – in point A.\n     *\n     * @param {Vertex} pA - The first triangle point.\n     * @param {Vertex} pB - The second triangle point.\n     * @param {Vertex} pC - The third triangle point.\n     * @param {number} n - The number of desired angle sections (example: 2 means the angle will be divided into two sections,\n     *                      means an returned array with length 1, the middle line).\n     *\n     * @return {Line[]} An array of n-1 lines secting the given angle in point A into n equal sized angle sections. The lines' first vertex is A.\n     */\n    nsectAngle: function (pA, pB, pC, n) {\n        var triangle = new Triangle_1.Triangle(pA, pB, pC);\n        var lineAB = new Line_1.Line(pA, pB);\n        var lineAC = new Line_1.Line(pA, pC);\n        // Compute the difference; this is the angle between AB and AC\n        var insideAngle = lineAB.angle(lineAC);\n        // We want the inner angles of the triangle, not the outer angle;\n        //   which one is which depends on the triangle 'direction'\n        var clockwise = triangle.determinant() > 0;\n        // For convenience convert the angle [-PI,PI] to [0,2*PI]\n        if (insideAngle < 0)\n            insideAngle = 2 * Math.PI + insideAngle;\n        if (!clockwise)\n            insideAngle = (2 * Math.PI - insideAngle) * (-1);\n        // Scale the rotated lines to the max leg length (looks better)\n        var lineLength = Math.max(lineAB.length(), lineAC.length());\n        var scaleFactor = lineLength / lineAB.length();\n        var result = [];\n        for (var i = 1; i < n; i++) {\n            // Compute the i-th inner sector line\n            result.push(new Line_1.Line(pA, pB.clone().rotate((-i * (insideAngle / n)), pA)).scale(scaleFactor));\n        }\n        return result;\n    }\n};\n//# sourceMappingURL=geomutils.js.map","\"use strict\";\n/**\n * Draws elements into an SVG node.\n *\n * @author   Ikaros Kappler\n * @date     2021-01-03\n * @modified 2021-01-24 Fixed the `fillShapes` attribute in the copyInstance function.\n * @modified 2021-01-26 Changed the `isPrimary` (default true) attribute to `isSecondary` (default false).\n * @modified 2021-02-03 Added the static `createSvg` function.\n * @modified 2021-02-03 Fixed the currentId='background' bug on the clear() function.\n * @modified 2021-02-03 Fixed CSSProperty `stroke-width` (was line-width before, which is wrong).\n * @modified 2021-02-03 Added the static `HEAD_XML` attribute.\n * @version  1.0.0\n **/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.drawutilssvg = void 0;\nvar CircleSector_1 = require(\"../../CircleSector\");\nvar CubicBezierCurve_1 = require(\"../../CubicBezierCurve\");\nvar Vertex_1 = require(\"../../Vertex\");\n/**\n * @classdesc A helper class for basic SVG drawing operations. This class should\n * be compatible to the default 'draw' class.\n *\n * @requires CubicBzierCurvce\n * @requires Polygon\n * @requires Vertex\n * @requires XYCoords\n */\nvar drawutilssvg = /** @class */ (function () {\n    /**\n     * The constructor.\n     *\n     * @constructor\n     * @name drawutilssvg\n     * @param {SVGElement} svgNode - The SVG node to use.\n     * @param {XYCoords} offset - The draw offset to use.\n     * @param {XYCoords} scale - The scale factors to use.\n     * @param {XYDimension} canvasSize - The initial canvas size (use setSize to change).\n     * @param {boolean} fillShapes - Indicates if the constructed drawutils should fill all drawn shapes (if possible).\n     * @param {DrawConfig} drawConfig - The default draw config to use for CSS fallback styles.\n     * @param {boolean=} isSecondary - (optional) Indicates if this is the primary or secondary instance. Only primary instances manage child nodes.\n     * @param {SVGElement=} gNode - (optional) Primary and seconday instances share the same &lt;g> node.\n     **/\n    function drawutilssvg(svgNode, offset, scale, canvasSize, fillShapes, drawConfig, isSecondary, gNode) {\n        this.svgNode = svgNode;\n        this.offset = new Vertex_1.Vertex(0, 0).set(offset);\n        this.scale = new Vertex_1.Vertex(1, 1).set(scale);\n        this.fillShapes = fillShapes;\n        this.isSecondary = isSecondary;\n        this.cache = new Map();\n        this.setSize(canvasSize);\n        if (isSecondary) {\n            this.gNode = gNode;\n        }\n        else {\n            this.addStyleDefs(drawConfig);\n            this.gNode = this.createSVGNode('g');\n            this.svgNode.appendChild(this.gNode);\n        }\n    }\n    ;\n    drawutilssvg.prototype.addStyleDefs = function (drawConfig) {\n        var nodeStyle = this.createSVGNode('style');\n        this.svgNode.appendChild(nodeStyle); // nodeDef);\n        // Which default styles to add? -> All from the DrawConfig.\n        // Compare with DrawConfig interface\n        var keys = {\n            'polygon': 'Polygon',\n            'triangle': 'Triangle',\n            'ellipse': 'Ellipse',\n            'circle': 'Circle',\n            'circleSector': 'CircleSector',\n            'vertex': 'Vertex',\n            'line': 'Line',\n            'vector': 'Vector',\n            'image': 'Image'\n        };\n        // Question: why isn't this working if the svgNode is created dynamically? (nodeStyle.sheet is null)\n        var rules = [];\n        for (var k in keys) {\n            var className = keys[k];\n            var drawSettings = drawConfig[k];\n            rules.push(\".\" + className + \" { fill : none; stroke: \" + drawSettings.color + \"; stroke-width: \" + drawSettings.lineWidth + \"px }\");\n        }\n        nodeStyle.innerHTML = rules.join(\"\\n\");\n    };\n    ;\n    /**\n     * Retieve an old (cached) element.\n     * Only if both – key and nodeName – match, the element will be returned (null otherwise).\n     *\n     * @method findElement\n     * @private\n     * @memberof drawutilssvg\n     * @instance\n     * @param {UID} key - The key of the desired element (used when re-drawing).\n     * @param {string} nodeName - The expected node name.\n     */\n    drawutilssvg.prototype.findElement = function (key, nodeName) {\n        var node = this.cache.get(key);\n        if (node && node.nodeName.toUpperCase() === nodeName.toUpperCase()) {\n            this.cache.delete(key);\n            return node;\n        }\n        return null;\n    };\n    /**\n     * Create a new DOM node &lt;svg&gt; in the SVG namespace.\n     *\n     * @method createSVGNode\n     * @private\n     * @memberof drawutilssvg\n     * @instance\n     * @param {string} nodeName - The node name (tag-name).\n     * @return {SVGElement} A new element in the SVG namespace with the given node name.\n     */\n    drawutilssvg.prototype.createSVGNode = function (nodeName) {\n        return document.createElementNS(\"http://www.w3.org/2000/svg\", nodeName);\n    };\n    ;\n    /**\n     * Make a new SVG node (or recycle an old one) with the given node name (circle, path, line, rect, ...).\n     *\n     * This function is used in draw cycles to re-use old DOM nodes (in hope to boost performance).\n     *\n     * @method makeNode\n     * @private\n     * @instance\n     * @memberof drawutilssvg\n     * @param {string} nodeName - The node name.\n     * @return {SVGElement} The new node, which is not yet added to any document.\n     */\n    drawutilssvg.prototype.makeNode = function (nodeName) {\n        // Try to find node in current DOM cache.\n        // Unique node keys are strictly necessary.\n        // Try to recycle an old element from cache.\n        var node = this.findElement(this.curId, nodeName);\n        if (!node) {\n            // If no such old elements exists (key not found, tag name not matching),\n            // then create a new one.\n            node = this.createSVGNode(nodeName);\n        }\n        return node;\n    };\n    ;\n    /**\n     * This is the final helper function for drawing and filling stuff and binding new\n     * nodes to the SVG document.\n     * It is not intended to be used from the outside.\n     *\n     * When in draw mode it draws the current shape.\n     * When in fill mode it fills the current shape.\n     *\n     * This function is usually only called internally.\n     *\n     * @method _bindFillDraw\n     * @private\n     * @instance\n     * @memberof drawutilssvg\n     * @param {SVGElement} node - The node to draw/fill and bind.\n     * @param {string} className - The class name(s) to use.\n     * @param {string} color - A stroke/fill color to use.\n     * @param {number=1} lineWidth - (optional) A line width to use for drawing (default is 1).\n     * @return {SVGElement} The node itself (for chaining).\n     */\n    drawutilssvg.prototype._bindFillDraw = function (node, className, color, lineWidth) {\n        if (this.curClassName) {\n            node.setAttribute('class', this.curClassName + \" \" + className);\n        }\n        else {\n            node.setAttribute('class', className);\n        }\n        node.setAttribute('fill', this.fillShapes ? color : 'none');\n        node.setAttribute('stroke', this.fillShapes ? 'none' : color);\n        node.setAttribute('stroke-width', \"\" + (lineWidth || 1));\n        if (this.curId) {\n            node.setAttribute('id', \"\" + this.curId); // Maybe React-style 'key' would be better?\n        }\n        if (!node.parentNode) {\n            // Attach to DOM only if not already attached\n            this.gNode.appendChild(node);\n        }\n        return node;\n    };\n    ;\n    /**\n     * Sets the size and view box of the document. Call this if canvas size changes.\n     *\n     * @method setSize\n     * @instance\n     * @memberof drawutilssvg\n     * @param {XYDimension} canvasSize - The new canvas size.\n     */\n    drawutilssvg.prototype.setSize = function (canvasSize) {\n        this.canvasSize = canvasSize;\n        this.svgNode.setAttribute('viewBox', \"0 0 \" + this.canvasSize.width + \" \" + this.canvasSize.height);\n        this.svgNode.setAttribute('width', \"\" + this.canvasSize.width);\n        this.svgNode.setAttribute('height', \"\" + this.canvasSize.height);\n    };\n    ;\n    /**\n     * Creates a 'shallow' (non deep) copy of this instance. This implies\n     * that under the hood the same gl context and gl program will be used.\n     */\n    drawutilssvg.prototype.copyInstance = function (fillShapes) {\n        var copy = new drawutilssvg(this.svgNode, this.offset, this.scale, this.canvasSize, fillShapes, null, // no DrawConfig\n        true, // isSecondary\n        this.gNode);\n        return copy;\n    };\n    ;\n    /**\n     * This method shouled be called each time the currently drawn `Drawable` changes.\n     * It is used by some libraries for identifying elemente on re-renders.\n     *\n     * @name setCurrentId\n     * @method\n     * @param {UID} uid - A UID identifying the currently drawn element(s).\n     * @instance\n     * @memberof drawutilssvg\n     **/\n    drawutilssvg.prototype.setCurrentId = function (uid) {\n        this.curId = uid;\n    };\n    ;\n    /**\n     * This method shouled be called each time the currently drawn `Drawable` changes.\n     * Determine the class name for further usage here.\n     *\n     * @name setCurrentClassName\n     * @method\n     * @param {string} className - A class name for further custom use cases.\n     * @instance\n     * @memberof drawutilssvg\n     **/\n    drawutilssvg.prototype.setCurrentClassName = function (className) {\n        this.curClassName = className;\n    };\n    ;\n    /**\n     * Called before each draw cycle.\n     * This is required for compatibility with other draw classes in the library.\n     *\n     * @name beginDrawCycle\n     * @method\n     * @param {UID=} uid - (optional) A UID identifying the currently drawn element(s).\n     * @instance\n     * @memberof drawutilssvg\n     **/\n    drawutilssvg.prototype.beginDrawCycle = function (renderTime) {\n        // Clear non-recycable elements from last draw cycle.\n        this.cache.clear();\n    };\n    ;\n    drawutilssvg.prototype._x = function (x) { return this.offset.x + this.scale.x * x; };\n    drawutilssvg.prototype._y = function (y) { return this.offset.y + this.scale.y * y; };\n    /**\n     * Draw the line between the given two points with the specified (CSS-) color.\n     *\n     * @method line\n     * @param {Vertex} zA - The start point of the line.\n     * @param {Vertex} zB - The end point of the line.\n     * @param {string} color - Any valid CSS color string.\n     * @param {number=1} lineWidth? - [optional] The line's width.\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     **/\n    drawutilssvg.prototype.line = function (zA, zB, color, lineWidth) {\n        var line = this.makeNode('line');\n        line.setAttribute('x1', \"\" + this._x(zA.x));\n        line.setAttribute('y1', \"\" + this._y(zA.y));\n        line.setAttribute('x2', \"\" + this._x(zB.x));\n        line.setAttribute('y2', \"\" + this._y(zB.y));\n        return this._bindFillDraw(line, 'line', color, lineWidth || 1);\n    };\n    ;\n    /**\n     * Draw a line and an arrow at the end (zB) of the given line with the specified (CSS-) color.\n     *\n     * @method arrow\n     * @param {Vertex} zA - The start point of the arrow-line.\n     * @param {Vertex} zB - The end point of the arrow-line.\n     * @param {string} color - Any valid CSS color string.\n     * @param {number=} lineWidth - (optional) The line width to use; default is 1.\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     **/\n    drawutilssvg.prototype.arrow = function (zA, zB, color, lineWidth) {\n        var node = this.makeNode('path');\n        var headlen = 8; // length of head in pixels\n        var vertices = Vertex_1.Vertex.utils.buildArrowHead(zA, zB, headlen, this.scale.x, this.scale.y);\n        var d = [\n            'M', this._x(zA.x), this._y(zA.y)\n        ];\n        for (var i = 0; i <= vertices.length; i++) {\n            d.push('L');\n            // Note: only use offset here (the vertices are already scaled)\n            d.push(this.offset.x + vertices[i % vertices.length].x);\n            d.push(this.offset.y + vertices[i % vertices.length].y);\n        }\n        node.setAttribute('d', d.join(' '));\n        return this._bindFillDraw(node, 'arrow', color, lineWidth || 1);\n    };\n    ;\n    /**\n     * Draw an image at the given position with the given size.<br>\n     * <br>\n     * Note: SVG images may have resizing issues at the moment.Draw a line and an arrow at the end (zB) of the given line with the specified (CSS-) color.\n     *\n     * @method image\n     * @param {Image} image - The image object to draw.\n     * @param {Vertex} position - The position to draw the the upper left corner at.\n     * @param {Vertex} size - The x/y-size to draw the image with.\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     **/\n    drawutilssvg.prototype.image = function (image, position, size) {\n        var _this = this;\n        var node = this.makeNode('image');\n        // We need to re-adjust the image if it was not yet fully loaded before.\n        var setImageSize = function (image) {\n            if (image.naturalWidth) {\n                var ratioX = size.x / image.naturalWidth;\n                var ratioY = size.y / image.naturalHeight;\n                node.setAttribute('width', \"\" + image.naturalWidth * _this.scale.x);\n                node.setAttribute('height', \"\" + image.naturalHeight * _this.scale.y);\n                node.setAttribute('display', null); // Dislay when loaded\n                node.setAttribute('transform', \"translate(\" + _this._x(position.x) + \" \" + _this._y(position.y) + \") scale(\" + (ratioX) + \" \" + (ratioY) + \")\");\n            }\n        };\n        image.addEventListener('load', function (event) { setImageSize(image); });\n        // Safari has a transform-origin bug.\n        // Use x=0, y=0 and translate/scale instead (see above)\n        node.setAttribute('x', \"\" + 0);\n        node.setAttribute('y', \"\" + 0);\n        node.setAttribute('display', 'none'); // Hide before loaded\n        setImageSize(image);\n        node.setAttribute('href', image.src);\n        return this._bindFillDraw(node, 'image', null, null);\n    };\n    ;\n    /**\n     * Draw the given (cubic) bézier curve.\n     *\n     * @method cubicBezier\n     * @param {Vertex} startPoint - The start point of the cubic Bézier curve\n     * @param {Vertex} endPoint   - The end point the cubic Bézier curve.\n     * @param {Vertex} startControlPoint - The start control point the cubic Bézier curve.\n     * @param {Vertex} endControlPoint   - The end control point the cubic Bézier curve.\n     * @param {string} color - The CSS color to draw the curve with.\n     * @param {number} lineWidth - (optional) The line width to use.\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     */\n    drawutilssvg.prototype.cubicBezier = function (startPoint, endPoint, startControlPoint, endControlPoint, color, lineWidth) {\n        if (startPoint instanceof CubicBezierCurve_1.CubicBezierCurve) {\n            return this.cubicBezier(startPoint.startPoint, startPoint.endPoint, startPoint.startControlPoint, startPoint.endControlPoint, color, lineWidth);\n        }\n        var node = this.makeNode('path');\n        // Draw curve\n        var d = [\n            'M', this._x(startPoint.x), this._y(startPoint.y),\n            'C', this._x(startControlPoint.x), this._y(startControlPoint.y), this._x(endControlPoint.x), this._y(endControlPoint.y), this._x(endPoint.x), this._y(endPoint.y)\n        ];\n        node.setAttribute('d', d.join(' '));\n        return this._bindFillDraw(node, 'cubierBezier', color, lineWidth);\n    };\n    ;\n    /**\n     * Draw the given (cubic) Bézier path.\n     *\n     * The given path must be an array with n*3+1 vertices, where n is the number of\n     * curves in the path:\n     * <pre> [ point1, point1_startControl, point2_endControl, point2, point2_startControl, point3_endControl, point3, ... pointN_endControl, pointN ]</pre>\n     *\n     * @method cubicBezierPath\n     * @param {Vertex[]} path - The cubic bezier path as described above.\n     * @param {string} color - The CSS colot to draw the path with.\n     * @param {number=1} lineWidth - (optional) The line width to use.\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     */\n    drawutilssvg.prototype.cubicBezierPath = function (path, color, lineWidth) {\n        var node = this.makeNode('path');\n        if (!path || path.length == 0)\n            return node;\n        // Draw curve\n        var d = [\n            'M', this._x(path[0].x), this._y(path[0].y)\n        ];\n        // Draw curve path\n        var endPoint;\n        var startControlPoint;\n        var endControlPoint;\n        for (var i = 1; i < path.length; i += 3) {\n            startControlPoint = path[i];\n            endControlPoint = path[i + 1];\n            endPoint = path[i + 2];\n            d.push('C', this._x(startControlPoint.x), this._y(startControlPoint.y), this._x(endControlPoint.x), this._y(endControlPoint.y), this._x(endPoint.x), this._y(endPoint.y));\n        }\n        node.setAttribute('d', d.join(' '));\n        return this._bindFillDraw(node, 'cubicBezierPath', color, lineWidth || 1);\n    };\n    ;\n    /**\n     * Draw the given handle and handle point (used to draw interactive Bézier curves).\n     *\n     * The colors for this are fixed and cannot be specified.\n     *\n     * @method handle\n     * @param {Vertex} startPoint - The start of the handle.\n     * @param {Vertex} endPoint - The end point of the handle.\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     */\n    drawutilssvg.prototype.handle = function (startPoint, endPoint) {\n        // TODO: redefine methods like these into an abstract class?\n        this.point(startPoint, 'rgb(0,32,192)');\n        this.square(endPoint, 5, 'rgba(0,128,192,0.5)');\n    };\n    ;\n    /**\n     * Draw a handle line (with a light grey).\n     *\n     * @method handleLine\n     * @param {Vertex} startPoint - The start point to draw the handle at.\n     * @param {Vertex} endPoint - The end point to draw the handle at.\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     */\n    drawutilssvg.prototype.handleLine = function (startPoint, endPoint) {\n        this.line(startPoint, endPoint, 'rgb(192,192,192)');\n    };\n    ;\n    /**\n     * Draw a 1x1 dot with the specified (CSS-) color.\n     *\n     * @method dot\n     * @param {Vertex} p - The position to draw the dot at.\n     * @param {string} color - The CSS color to draw the dot with.\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     */\n    drawutilssvg.prototype.dot = function (p, color) {\n        var node = this.makeNode('line');\n        return this._bindFillDraw(node, 'dot', color, 1);\n    };\n    ;\n    /**\n     * Draw the given point with the specified (CSS-) color and radius 3.\n     *\n     * @method point\n     * @param {Vertex} p - The position to draw the point at.\n     * @param {string} color - The CSS color to draw the point with.\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     */\n    drawutilssvg.prototype.point = function (p, color) {\n        var radius = 3;\n        var node = this.makeNode('circle');\n        node.setAttribute('cx', \"\" + this._x(p.x));\n        node.setAttribute('cy', \"\" + this._y(p.y));\n        node.setAttribute('r', \"\" + radius);\n        return this._bindFillDraw(node, 'point', color, 1);\n    };\n    ;\n    /**\n     * Draw a circle with the specified (CSS-) color and radius.<br>\n     * <br>\n     * Note that if the x- and y- scales are different the result will be an ellipse rather than a circle.\n     *\n     * @method circle\n     * @param {Vertex} center - The center of the circle.\n     * @param {number} radius - The radius of the circle.\n     * @param {string} color - The CSS color to draw the circle with.\n     * @param {number=} lineWidth - (optional) The line width to use; default is 1.\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     */\n    drawutilssvg.prototype.circle = function (center, radius, color, lineWidth) {\n        var node = this.makeNode('circle');\n        node.setAttribute('cx', \"\" + this._x(center.x));\n        node.setAttribute('cy', \"\" + this._y(center.y));\n        node.setAttribute('r', \"\" + radius * this.scale.x); // y?\n        return this._bindFillDraw(node, 'circle', color, lineWidth || 1);\n    };\n    ;\n    /**\n     * Draw a circular arc (section of a circle) with the given CSS color.\n     *\n     * @method circleArc\n     * @param {Vertex} center - The center of the circle.\n     * @param {number} radius - The radius of the circle.\n     * @param {number} startAngle - The angle to start at.\n     * @param {number} endAngle - The angle to end at.\n     * @param {string} color - The CSS color to draw the circle with.\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     */\n    drawutilssvg.prototype.circleArc = function (center, radius, startAngle, endAngle, color, lineWidth) {\n        var node = this.makeNode('path');\n        var arcData = CircleSector_1.CircleSector.circleSectorUtils.describeSVGArc(this._x(center.x), this._y(center.y), radius * this.scale.x, // y?\n        startAngle, endAngle);\n        node.setAttribute('d', arcData.join(' '));\n        return this._bindFillDraw(node, 'circleArc', color, lineWidth || 1);\n    };\n    ;\n    /**\n     * Draw an ellipse with the specified (CSS-) color and thw two radii.\n     *\n     * @method ellipse\n     * @param {Vertex} center - The center of the ellipse.\n     * @param {number} radiusX - The radius of the ellipse.\n     * @param {number} radiusY - The radius of the ellipse.\n     * @param {string} color - The CSS color to draw the ellipse with.\n     * @param {number=} lineWidth - (optional) The line width to use; default is 1.\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     */\n    drawutilssvg.prototype.ellipse = function (center, radiusX, radiusY, color, lineWidth) {\n        var node = this.makeNode('ellipse');\n        node.setAttribute('cx', \"\" + this._x(center.x));\n        node.setAttribute('cy', \"\" + this._y(center.y));\n        node.setAttribute('rx', \"\" + radiusX * this.scale.x);\n        node.setAttribute('ry', \"\" + radiusY * this.scale.y);\n        return this._bindFillDraw(node, 'ellipse', color, lineWidth || 1);\n    };\n    ;\n    /**\n     * Draw square at the given center, size and with the specified (CSS-) color.<br>\n     * <br>\n     * Note that if the x-scale and the y-scale are different the result will be a rectangle rather than a square.\n     *\n     * @method square\n     * @param {Vertex} center - The center of the square.\n     * @param {Vertex} size - The size of the square.\n     * @param {string} color - The CSS color to draw the square with.\n     * @param {number=} lineWidth - (optional) The line width to use; default is 1.\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     */\n    drawutilssvg.prototype.square = function (center, size, color, lineWidth) {\n        var node = this.makeNode('rectangle');\n        node.setAttribute('x', \"\" + this._x(center.x - size / 2.0));\n        node.setAttribute('y', \"\" + this._y(center.y - size / 2.0));\n        node.setAttribute('width', \"\" + size * this.scale.x);\n        node.setAttribute('height', \"\" + size * this.scale.y);\n        return this._bindFillDraw(node, 'square', color, lineWidth || 1);\n    };\n    ;\n    /**\n     * Draw a grid of horizontal and vertical lines with the given (CSS-) color.\n     *\n     * @method grid\n     * @param {Vertex} center - The center of the grid.\n     * @param {number} width - The total width of the grid (width/2 each to the left and to the right).\n     * @param {number} height - The total height of the grid (height/2 each to the top and to the bottom).\n     * @param {number} sizeX - The horizontal grid size.\n     * @param {number} sizeY - The vertical grid size.\n     * @param {string} color - The CSS color to draw the grid with.\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     */\n    drawutilssvg.prototype.grid = function (center, width, height, sizeX, sizeY, color) {\n        var node = this.makeNode('path');\n        var d = [];\n        var yMin = -Math.ceil((height * 0.5) / sizeY) * sizeY;\n        var yMax = height / 2;\n        for (var x = -Math.ceil((width * 0.5) / sizeX) * sizeX; x < width / 2; x += sizeX) {\n            d.push('M', this._x(center.x + x), this._y(center.y + yMin));\n            d.push('L', this._x(center.x + x), this._y(center.y + yMax));\n        }\n        var xMin = -Math.ceil((width * 0.5) / sizeX) * sizeX;\n        var xMax = width / 2;\n        for (var y = -Math.ceil((height * 0.5) / sizeY) * sizeY; y < height / 2; y += sizeY) {\n            d.push('M', this._x(center.x + xMin), this._y(center.y + y));\n            d.push('L', this._x(center.x + xMax), this._y(center.y + y));\n        }\n        node.setAttribute('d', d.join(' '));\n        return this._bindFillDraw(node, 'grid', color, 1);\n    };\n    ;\n    /**\n     * Draw a raster of crosshairs in the given grid.<br>\n     *\n     * This works analogue to the grid() function\n     *\n     * @method raster\n     * @param {Vertex} center - The center of the raster.\n     * @param {number} width - The total width of the raster (width/2 each to the left and to the right).\n     * @param {number} height - The total height of the raster (height/2 each to the top and to the bottom).\n     * @param {number} sizeX - The horizontal raster size.\n     * @param {number} sizeY - The vertical raster size.\n     * @param {string} color - The CSS color to draw the raster with.\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     */\n    drawutilssvg.prototype.raster = function (center, width, height, sizeX, sizeY, color) {\n        var node = this.makeNode('path');\n        var d = [];\n        for (var x = -Math.ceil((width * 0.5) / sizeX) * sizeX; x < width / 2; x += sizeX) {\n            for (var y = -Math.ceil((height * 0.5) / sizeY) * sizeY; y < height / 2; y += sizeY) {\n                // Draw a crosshair\n                d.push('M', this._x(center.x + x) - 4, this._y(center.y + y));\n                d.push('L', this._x(center.x + x) + 4, this._y(center.y + y));\n                d.push('M', this._x(center.x + x), this._y(center.y + y) - 4);\n                d.push('L', this._x(center.x + x), this._y(center.y + y) + 4);\n            }\n        }\n        node.setAttribute('d', d.join(' '));\n        return this._bindFillDraw(node, 'raster', color, 1);\n    };\n    ;\n    /**\n     * Draw a diamond handle (square rotated by 45°) with the given CSS color.\n     *\n     * It is an inherent featur of the handle functions that the drawn elements are not scaled and not\n     * distorted. So even if the user zooms in or changes the aspect ratio, the handles will be drawn\n     * as even shaped diamonds.\n     *\n     * @method diamondHandle\n     * @param {Vertex} center - The center of the diamond.\n     * @param {Vertex} size - The x/y-size of the diamond.\n     * @param {string} color - The CSS color to draw the diamond with.\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     */\n    drawutilssvg.prototype.diamondHandle = function (center, size, color) {\n        var node = this.makeNode('path');\n        var d = [\n            'M', this._x(center.x) - size / 2.0, this._y(center.y),\n            'L', this._x(center.x), this._y(center.y) - size / 2.0,\n            'L', this._x(center.x) + size / 2.0, this._y(center.y),\n            'L', this._x(center.x), this._y(center.y) + size / 2.0,\n            'Z'\n        ];\n        ;\n        node.setAttribute('d', d.join(' '));\n        return this._bindFillDraw(node, 'diamondHandle', color, 1);\n    };\n    ;\n    /**\n     * Draw a square handle with the given CSS color.<br>\n     * <br>\n     * It is an inherent featur of the handle functions that the drawn elements are not scaled and not\n     * distorted. So even if the user zooms in or changes the aspect ratio, the handles will be drawn\n     * as even shaped squares.\n     *\n     * @method squareHandle\n     * @param {Vertex} center - The center of the square.\n     * @param {Vertex} size - The x/y-size of the square.\n     * @param {string} color - The CSS color to draw the square with.\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     */\n    drawutilssvg.prototype.squareHandle = function (center, size, color) {\n        var node = this.makeNode('rect');\n        node.setAttribute('x', \"\" + (this._x(center.x) - size / 2.0));\n        node.setAttribute('y', \"\" + (this._y(center.y) - size / 2.0));\n        node.setAttribute('width', \"\" + size);\n        node.setAttribute('height', \"\" + size);\n        return this._bindFillDraw(node, 'squareHandle', color, 1);\n    };\n    ;\n    /**\n     * Draw a circle handle with the given CSS color.<br>\n     * <br>\n     * It is an inherent featur of the handle functions that the drawn elements are not scaled and not\n     * distorted. So even if the user zooms in or changes the aspect ratio, the handles will be drawn\n     * as even shaped circles.\n     *\n     * @method circleHandle\n     * @param {Vertex} center - The center of the circle.\n     * @param {number} radius - The radius of the circle.\n     * @param {string} color - The CSS color to draw the circle with.\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     */\n    drawutilssvg.prototype.circleHandle = function (center, radius, color) {\n        radius = radius || 3;\n        var node = this.makeNode('circle');\n        node.setAttribute('cx', \"\" + this._x(center.x));\n        node.setAttribute('cy', \"\" + this._y(center.y));\n        node.setAttribute('r', \"\" + radius);\n        return this._bindFillDraw(node, 'circleHandle', color, 1);\n    };\n    ;\n    /**\n     * Draw a crosshair with given radius and color at the given position.<br>\n     * <br>\n     * Note that the crosshair radius will not be affected by scaling.\n     *\n     * @method crosshair\n     * @param {XYCoords} center - The center of the crosshair.\n     * @param {number} radius - The radius of the crosshair.\n     * @param {string} color - The CSS color to draw the crosshair with.\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     */\n    drawutilssvg.prototype.crosshair = function (center, radius, color) {\n        var node = this.makeNode('path');\n        var d = [\n            'M', this._x(center.x) - radius, this._y(center.y),\n            'L', this._x(center.x) + radius, this._y(center.y),\n            'M', this._x(center.x), this._y(center.y) - radius,\n            'L', this._x(center.x), this._y(center.y) + radius\n        ];\n        node.setAttribute('d', d.join(' '));\n        return this._bindFillDraw(node, 'crosshair', color, 0.5);\n    };\n    ;\n    /**\n     * Draw a polygon.\n     *\n     * @method polygon\n     * @param {Polygon} polygon - The polygon to draw.\n     * @param {string} color - The CSS color to draw the polygon with.\n     * @param {number=} lineWidth - (optional) The line width to use; default is 1.\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     */\n    drawutilssvg.prototype.polygon = function (polygon, color, lineWidth) {\n        return this.polyline(polygon.vertices, polygon.isOpen, color, lineWidth);\n    };\n    ;\n    /**\n     * Draw a polygon line (alternative function to the polygon).\n     *\n     * @method polyline\n     * @param {Vertex[]} vertices - The polygon vertices to draw.\n     * @param {boolan}   isOpen   - If true the polyline will not be closed at its end.\n     * @param {string}   color    - The CSS color to draw the polygon with.\n     * @param {number=} lineWidth - (optional) The line width to use; default is 1.\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     */\n    drawutilssvg.prototype.polyline = function (vertices, isOpen, color, lineWidth) {\n        var node = this.makeNode('path');\n        if (vertices.length == 0)\n            return node;\n        // Draw curve\n        var d = [\n            'M', this._x(vertices[0].x), this._y(vertices[0].y)\n        ];\n        var n = vertices.length;\n        for (var i = 1; i < n; i++) {\n            d.push('L', this._x(vertices[i].x), this._y(vertices[i].y));\n        }\n        if (!isOpen)\n            d.push('Z');\n        node.setAttribute('d', d.join(' '));\n        return this._bindFillDraw(node, 'polyline', color, lineWidth || 1);\n    };\n    ;\n    /**\n     * Draw a text label at the given relative position.\n     *\n     * @method label\n     * @param {string} text - The text to draw.\n     * @param {number} x - The x-position to draw the text at.\n     * @param {number} y - The y-position to draw the text at.\n     * @param {number=} rotation - The (optional) rotation in radians.\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     */\n    drawutilssvg.prototype.text = function (text, x, y, options) {\n        options = options || {};\n        var color = options.color || 'black';\n        var node = this.makeNode('text');\n        node.setAttribute('x', \"\" + this._x(x));\n        node.setAttribute('y', \"\" + this._x(y));\n        node.innerHTML = text;\n        return this._bindFillDraw(node, 'text', color, 1);\n    };\n    ;\n    /**\n     * Draw a non-scaling text label at the given position.\n     *\n     * @method label\n     * @param {string} text - The text to draw.\n     * @param {number} x - The x-position to draw the text at.\n     * @param {number} y - The y-position to draw the text at.\n     * @param {number=} rotation - The (optional) rotation in radians.\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     */\n    drawutilssvg.prototype.label = function (text, x, y, rotation) {\n        var node = this.makeNode('text');\n        // For some strange reason SVG rotation transforms use degrees instead of radians\n        node.setAttribute('transform', \"translate(\" + this.offset.x + \",\" + this.offset.y + \"), rotate(\" + rotation / Math.PI * 180 + \")\");\n        node.innerHTML = text;\n        return this._bindFillDraw(node, 'label', 'black', null);\n    };\n    ;\n    /**\n     * Due to gl compatibility there is a generic 'clear' function required\n     * to avoid accessing the context object itself directly.\n     *\n     * This function just fills the whole canvas with a single color.\n     *\n     * @param {string} color - The color to clear with.\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     **/\n    drawutilssvg.prototype.clear = function (color) {\n        // If this isn't the primary handler then do not remove anything here.\n        // The primary handler will do that (no double work).\n        if (this.isSecondary) {\n            return;\n        }\n        // Clearing an SVG is equivalent to removing all its child elements.\n        for (var i = 0; i < this.gNode.childNodes.length; i++) {\n            // Hide all nodes here. Don't throw them away.\n            // We can probably re-use them in the next draw cycle.\n            var child = this.gNode.childNodes[i];\n            this.cache.set(child.getAttribute('id'), child);\n        }\n        this.removeAllChildNodes();\n        // Add a covering rect with the given background color\n        this.curId = 'background';\n        var node = this.makeNode('rect');\n        // For some strange reason SVG rotation transforms use degrees instead of radians\n        // Note that the background does not scale with the zoom level (always covers full element)\n        node.setAttribute('x', '0');\n        node.setAttribute('y', '0');\n        node.setAttribute('width', \"\" + this.canvasSize.width);\n        node.setAttribute('height', \"\" + this.canvasSize.height);\n        // Bind this special element into the document\n        this._bindFillDraw(node, this.curId, null, null);\n        node.setAttribute('fill', typeof color === \"undefined\" ? 'none' : color);\n        // Clear the current ID again\n        this.curId = undefined;\n        // return node;\n    };\n    ;\n    /**\n     * A private helper function to clear all SVG nodes from the &gt;g> node.\n     *\n     * @private\n     */\n    drawutilssvg.prototype.removeAllChildNodes = function () {\n        while (this.gNode.lastChild) {\n            this.gNode.removeChild(this.gNode.lastChild);\n        }\n    };\n    ;\n    /**\n     * Create a new and empty `SVGElement` &lt;svg&gt; in the svg-namespace.\n     *\n     * @name createSvg\n     * @static\n     * @memberof drawutilssvg\n     * @return SVGElement\n     */\n    drawutilssvg.createSvg = function () {\n        return document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n    };\n    ;\n    drawutilssvg.HEAD_XML = [\n        '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>',\n        '<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.0//EN\" ',\n        '         \"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\">',\n        ''\n    ].join(\"\\n\");\n    return drawutilssvg;\n}());\nexports.drawutilssvg = drawutilssvg;\n//# sourceMappingURL=drawutilssvg.js.map","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","\"use strict\";\n/* Imports for webpack */\n\n// import path from \"path\";\n// import AlloyFinger, { TouchMoveEvent, TouchPinchEvent } from \"alloyfinger-typescript/src/js/index\";\n\nglobalThis.UIDGenerator = require(\"./UIDGenerator.js\").geomutils;\nglobalThis.VertexAttr = require(\"./VertexAttr.js\").VertexAttr;\nglobalThis.VertexListeners = require(\"./VertexListeners.js\").VertexListeners;\nglobalThis.Vertex = require(\"./Vertex.js\").Vertex;\n\nglobalThis.Bounds = require(\"./Bounds.js\").Bounds;\nglobalThis.Grid = require(\"./Grid.js\").Grid;\nglobalThis.Line = require(\"./Line.js\").Line;\nglobalThis.Vector = require(\"./Vector.js\").Vector;\nglobalThis.CubicBezierCurve = require(\"./CubicBezierCurve.js\").CubicBezierCurve;\nglobalThis.BezierPath = require(\"./BezierPath.js\").BezierPath;\nglobalThis.Polygon = require(\"./Polygon.js\").Polygon;\nglobalThis.Triangle = require(\"./Triangle.js\").Triangle;\nglobalThis.VEllipse = require(\"./VEllipse.js\").VEllipse;\nglobalThis.Circle = require(\"./Circle.js\").Circle;\nglobalThis.CircleSector = require(\"./CircleSector.js\").CircleSector;\nglobalThis.PBImage = require(\"./PBImage.js\").PBImage;\nglobalThis.MouseHandler = require(\"./MouseHandler.js\").MouseHandler;\nglobalThis.KeyHandler = require(\"./KeyHandler.js\").KeyHandler;\nglobalThis.drawutils = require(\"./draw.js\").drawutils;\n// globalThis.drawutilsgl = require(\"./drawgl.js\").drawutilsgl;\n// globalThis.drawutilsgl = {};\nglobalThis.drawutilssvg = require(\"./utils/helpers/drawutilssvg.js\").drawutilssvg;\nglobalThis.geomutils = require(\"./geomutils.js\").geomutils;\nglobalThis.PlotBoilerplate = require(\"./PlotBoilerplate.js\").PlotBoilerplate;\n\n"],"sourceRoot":""}