{"version":3,"file":"rpg-dialogue-vendor.js","mappings":";;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,UAAU,mBAAmB,KAAK;AAC7C,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,UAAU,0BAA0B,KAAK;AACpD,WAAW,UAAU,2BAA2B,KAAK;AACrD,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,UAAU,0BAA0B,KAAK;AACpD,WAAW,UAAU,2BAA2B,KAAK;AACrD,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,UAAU,0BAA0B,KAAK;AACpD,WAAW,UAAU,2BAA2B,KAAK;AACrD,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,UAAU,0BAA0B,KAAK;AACpD,WAAW,UAAU,2BAA2B,KAAK;AACrD,YAAY,QAAQ;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,2CAA2C,QAAQ;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD,SAAS;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;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,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;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,aAAa;AACb;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8EAA8E;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8EAA8E;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,iEAAe,WAAW,EAAC;AAC3B;;;;;;;;;;;;;;;;ACpYA;AACA;AACA;AACA;AACA;AACA;AACA;AAC6C;AACtB;AACvB,iEAAe,sDAAW,EAAC;AAC3B;;;;;;;;;;ACVa;AACb;AACA;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,wBAAwB;AACxB,cAAc,mBAAO,CAAC,qGAAyB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;;;;;;;;;;ACzBa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,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;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;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,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,QAAQ;AACxB;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,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;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,QAAQ;AACxB;AACA;AACA;AACA;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,aAAa;AACb;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,eAAe;AACf;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,uBAAuB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,uBAAuB;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;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,kDAAkD,IAAI,YAAY,IAAI,YAAY,IAAI;AACtF;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,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,uBAAuB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,sBAAsB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,6BAA6B,uBAAuB;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,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,kBAAkB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,KAAK;AACN,aAAa;AACb;;;;;;;;;;ACnuBa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,gBAAgB;AAChB;AACA;AACA;AACA,eAAe,aAAa;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,WAAW;AAC9B,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,WAAW;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,WAAW;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,qBAAqB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,qBAAqB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,gBAAgB;AAChB;;;;;;;;;;;;;;;;;;AC5KA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACkC;AACoB;AACR;AACZ;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,QAAQ;AAC/B;AACA,uBAAuB,QAAQ;AAC/B;AACA,uBAAuB,QAAQ;AAC/B;AACA,uBAAuB,QAAQ;AAC/B;AACA,mBAAmB,uDAAY;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,kBAAkB;AACjC;AACA;AACA,gBAAgB;AAChB;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,QAAQ;AACxB;AACA;AACA;AACA,wBAAwB,8BAA8B;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA,wBAAwB,8BAA8B;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA,wBAAwB,8BAA8B;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,8BAA8B;AACtD;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,gBAAgB;AAChB;AACA;AACA;AACA,wBAAwB,8BAA8B;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB,kBAAkB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,gCAAgC;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,8BAA8B;AACpD;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,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,kBAAkB;AACxC;AACA;AACA;AACA;AACA;AACA,+BAA+B,gCAAgC;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,gBAAgB;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,kBAAkB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,kDAAkD;AACxE;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA,wBAAwB,8BAA8B;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA,2CAA2C;AAC3C,2BAA2B,8BAA8B;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,gCAAgC;AAC9D;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA,wBAAwB,8BAA8B;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB;AAChB;AACA;AACA,wBAAwB,8BAA8B;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,8BAA8B;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB,QAAQ;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,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB,QAAQ;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,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,QAAQ;AAClB,UAAU,QAAQ;AAClB,UAAU,QAAQ;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA,mEAAmE,KAAK;AACxE,+DAA+D,KAAK;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,kBAAkB;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,kDAAkD;AACnG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA,eAAe,UAAU;AACzB;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,eAAe,QAAQ;AACvB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,kBAAkB;AACjC,eAAe,kBAAkB;AACjC,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,mCAAmC,2CAAM;AACzC,wCAAwC,2CAAM;AAC9C;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA,wBAAwB,2CAAM;AAC9B,wBAAwB,2CAAM;AAC9B;AACA,wBAAwB,8BAA8B;AACtD;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,2CAAM;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA,iEAAiE;AACjE;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,2CAAM;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,2CAAM;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,wBAAwB,8BAA8B;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,YAAY;AAC3B;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,8BAA8B;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,8BAA8B;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA,0BAA0B;AAC1B,wBAAwB,8BAA8B;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,YAAY;AAC3B;AACA;AACA;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA,wBAAwB,gBAAgB;AACxC;AACA;AACA,gBAAgB,+DAAgB;AAChC;AACA;AACA;AACA;AACA;AACA,yBAAyB,+DAAgB;AACzC;AACA;AACA,yBAAyB,+DAAgB;AACzC;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,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B,wBAAwB,8BAA8B;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB;AACA;AACA;AACA;AACA,+CAA+C;AAC/C,6BAA6B,2CAAM;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,2CAAM;AACvC;AACA,oCAAoC,2CAAM;AAC1C,kCAAkC,2CAAM;AACxC;AACA;AACA,iBAAiB;AACjB,2BAA2B,2CAAM;AACjC;AACA,6BAA6B,+DAAgB;AAC7C;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA,eAAe,QAAQ;AACvB;AACA,eAAe,QAAQ;AACvB;AACA,eAAe,QAAQ;AACvB;AACA;;;;;;;;;;;;;;;;ACttCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACoC;AACF;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,SAAS;AACzB;AACA;AACA,mBAAmB,6CAAO,MAAM,2CAAM,gBAAgB,2CAAM,8BAA8B,2CAAM,gBAAgB,2CAAM;AACtH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,QAAQ;AACzB;AACA;AACA,mBAAmB,2CAAM;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,QAAQ;AACzB;AACA;AACA,kBAAkB,OAAO,oBAAoB,UAAU,oBAAoB,WAAW,WAAW,aAAa,cAAc;AAC5H;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,QAAQ;AACzB;AACA;AACA,4BAA4B,8BAA8B,IAAI,8BAA8B;AAC5F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,eAAe;AAC9B;AACA;AACA;AACA;AACA,kCAAkC,2CAAM,YAAY,2CAAM;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,2CAAM,kBAAkB,2CAAM;AAC5D;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,UAAU,UAAU;AACnC,iBAAiB,QAAQ;AACzB;AACA;AACA,4EAA4E,YAAY,IAAI,yEAAyE;AACrK;AACA,EAAE;AACF;;;;;;;;;;;;;;;;;;AC3HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC8B;AACgB;AACZ;AACA;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,uDAAY;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB;AACA;AACA,gBAAgB,SAAS;AACzB;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,eAAe,MAAM;AACrB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA,mBAAmB,2CAAM,aAAa,2CAAM;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,uCAAI,KAAK,2CAAM,cAAc,2CAAM;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB,WAAW;AAC3B;AACA;AACA;AACA;AACA,2BAA2B,2CAAM;AACjC,2BAA2B,2CAAM;AACjC;AACA,2BAA2B,2CAAM;AACjC,2BAA2B,2CAAM;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,uCAAI;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA,uBAAuB,2CAAM;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA,iDAAiD;AACjD,mBAAmB,2CAAM;AACzB;AACA;AACA;;;;;;;;;;;;;;;AC9PA;AACA;AACA;AACA;AACA;AACA;AACA;AAC8C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,uDAAY;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;ACtGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACkC;AACY;AACZ;AACA;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA,uBAAuB,QAAQ;AAC/B;AACA,uBAAuB,QAAQ;AAC/B;AACA,uBAAuB,QAAQ;AAC/B;AACA,uBAAuB,QAAQ;AAC/B;AACA,mBAAmB,uDAAY;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,UAAU;AACzB,eAAe,SAAS;AACxB,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,sEAAsE,QAAQ;AAC9E;AACA;AACA;AACA;AACA;AACA,+CAA+C,KAAK;AACpD;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB,kBAAkB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,kBAAkB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,yBAAyB,2CAAM;AAC/B;AACA;AACA;AACA;AACA;AACA;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,gBAAgB;AAChB;AACA;AACA;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,gBAAgB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qEAAqE;AACrE;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA,sBAAsB,2CAAM;AAC5B,sBAAsB,2CAAM;AAC5B;AACA,wBAAwB,8BAA8B;AACtD;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,2CAAM;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;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,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;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,6CAA6C,GAAG;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,2CAAM;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA,gBAAgB;AAChB;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;AACA;AACA,mBAAmB,2CAAM;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB,kBAAkB;AAClC;AACA;AACA,6BAA6B,2CAAM;AACnC,2BAA2B,2CAAM;AACjC;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,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB;AAChB;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,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,mBAAmB,2CAAM;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;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,eAAe,kBAAkB;AACjC;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,eAAe,KAAK;AACpB;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA,4BAA4B;AAC5B;AACA;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,GAAG;AAClB;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,2CAAM,4CAA4C,2CAAM,wCAAwC,2CAAM,0DAA0D,2CAAM;AAC9M;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA,eAAe,QAAQ;AACvB;AACA,eAAe,QAAQ;AACvB;AACA,eAAe,QAAQ;AACvB;AACA;;;;;;;;;;;;;;AClrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;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,QAAQ;AACvB,gBAAgB,QAAQ;AACxB;AACA,8BAA8B,wCAAwC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACpFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,kBAAkB;AACvC,kCAAkC,iCAAiC;AACnE,mCAAmC,qCAAqC;AACxE,gCAAgC,sCAAsC;AACtE;AACA,mCAAmC,0EAA0E;AAC7G;AACA,kCAAkC,wCAAwC;AAC1E;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa,0DAA0D;AACtF,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,eAAe,eAAe;AAC9B,eAAe,qBAAqB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,YAAY;AAC3B,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,YAAY;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,YAAY;AAC3B,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,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D,0BAA0B;AACpF;AACA;AACA;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,yBAAyB;AACxC,gBAAgB,YAAY;AAC5B;AACA;AACA,kCAAkC,iEAAiE;AACnG;AACA;AACA;AACA;AACA;AACA,2DAA2D,8BAA8B;AACzF;AACA;AACA;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,yBAAyB;AACxC,gBAAgB,YAAY;AAC5B;AACA;AACA,mCAAmC,iEAAiE;AACpG;AACA;AACA;AACA;AACA;AACA,wDAAwD,+BAA+B;AACvF;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,0BAA0B;AACzC,gBAAgB,YAAY;AAC5B;AACA;AACA,gCAAgC,iEAAiE;AACjG;AACA;AACA;AACA;AACA;AACA,eAAe,eAAe;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;AC7aA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACwC;AACN;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,mBAAmB,iDAAS;AACnC;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,gBAAgB,kBAAkB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,2CAAM;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,aAAa;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;ACrIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,kBAAkB;AAClB;AACA;AACA,kBAAkB;AAClB;AACA;AACA,kBAAkB;AAClB;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,kBAAkB;AAClB;AACA;AACA,kBAAkB;AAClB;AACA;AACA,kBAAkB;AAClB;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B;AACA;AACA;AACA;AACA;AACA,sCAAsC,oBAAoB;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,YAAY;AAC3B,gBAAgB,UAAU;AAC1B;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,YAAY;AAC3B,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sFAAsF,gBAAgB;AACtG,qFAAqF,gBAAgB;AACrG;AACA,sDAAsD,iEAAiE,IAAI;AAC3H;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,gBAAgB;AAC/B,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,gBAAgB;AAC/B,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,gBAAgB;AAC/B,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,gBAAgB;AAC/B,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,gBAAgB;AAC/B,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,gBAAgB;AAC/B,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA,kDAAkD,KAAK;AACvD;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;;;;;;;;;;;;;;;ACtYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC8C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,uDAAY;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;ACvDA;AACA;AACA;AACA;AACA;AACA;AAC8C;AACZ;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,uDAAY;AAC/B;AACA,0EAA0E,2CAAM;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACxDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD,cAAc;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oEAAoE;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACiD;AACd;AACI;AACO;AACJ;AACR;AACA;AACY;AAChB;AACY;AACZ;AACgB;AACV;AACA;AACE;AACA;AACY;AAChB;AACA;AACQ;AACR;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ,UAAU;AACjC,eAAe,mBAAmB;AAClC,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB;AACA,4CAA4C,IAAI;AAChD,eAAe,UAAU;AACzB;AACA,eAAe,UAAU;AACzB;AACA,eAAe,UAAU;AACzB;AACA,eAAe,UAAU;AACzB;AACA,eAAe,UAAU;AACzB,4DAA4D,KAAK;AACjE;AACA,eAAe,UAAU;AACzB,4DAA4D,KAAK;AACjE;AACA,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB;AACA,eAAe,UAAU;AACzB;AACA,eAAe,UAAU;AACzB,eAAe,WAAW;AAC1B;AACA,eAAe,WAAW;AAC1B;AACA,eAAe,WAAW;AAC1B;AACA,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB;AACA,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,oDAAU;AAClB;AACA;AACA;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;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;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,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,wBAAwB,uCAAI,KAAK,4CAAM,YAAY,4CAAM;AACzD,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA,+CAA+C,gDAAW;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D;AAC7D,gCAAgC,gDAAW;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,4CAAS;AACzC,gCAAgC,4CAAS;AACzC;AACA;AACA;AACA,uBAAuB,uDAAY;AACnC;AACA;AACA,4BAA4B,uDAAY,kBAAkB,4CAAM;AAChE,gBAAgB,4CAAM;AACtB;AACA;AACA;AACA,sDAAsD;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,uDAAY;AACxC;AACA,sDAAsD;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sFAAsF,iBAAiB,gBAAgB;AACvH;AACA;AACA;AACA,qCAAqC;AACrC;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,iCAAiC,4CAAM;AACvC;AACA;AACA;AACA,2BAA2B,4CAAM;AACjC;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,sEAAsE,KAAK;AAC3E;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,eAAe,qBAAqB;AACpC,eAAe,SAAS;AACxB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA,4BAA4B,gBAAgB;AAC5C;AACA;AACA;AACA,qCAAqC,4CAAM;AAC3C;AACA;AACA;AACA,qCAAqC,wCAAI;AACzC;AACA;AACA;AACA;AACA;AACA,qCAAqC,4CAAM;AAC3C;AACA;AACA;AACA;AACA,qCAAqC,gDAAQ;AAC7C;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,qCAAqC,4DAAc;AACnD;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,qCAAqC,2CAAM;AAC3C;AACA;AACA;AACA,qCAAqC,uDAAY;AACjD;AACA;AACA;AACA,qCAAqC,8CAAO;AAC5C;AACA,4BAA4B,8BAA8B;AAC1D;AACA;AACA;AACA,qCAAqC,gDAAQ;AAC7C;AACA;AACA;AACA;AACA;AACA,qCAAqC,mDAAU;AAC/C;AACA;AACA,4BAA4B,oCAAoC;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,8CAAO;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,qCAAqC,4CAAM;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;AACA;AACA;AACA,eAAe,0BAA0B;AACzC,eAAe,SAAS;AACxB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,4BAA4B,qBAAqB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,4CAAM;AACtC;AACA;AACA;AACA;AACA;AACA,wBAAwB,2BAA2B;AACnD;AACA;AACA;AACA;AACA,4CAA4C,wCAAI;AAChD;AACA;AACA;AACA;AACA,iDAAiD,4CAAM;AACvD;AACA;AACA;AACA,iDAAiD,gDAAQ;AACzD;AACA;AACA;AACA,iDAAiD,4DAAc;AAC/D;AACA;AACA;AACA,iDAAiD,2CAAM;AACvD;AACA;AACA,iDAAiD,uDAAY;AAC7D;AACA;AACA,iDAAiD,8CAAO;AACxD;AACA,wCAAwC,8BAA8B;AACtE;AACA;AACA,iDAAiD,gDAAQ;AACzD;AACA;AACA;AACA;AACA,iDAAiD,mDAAU;AAC3D,wCAAwC,kCAAkC;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,8CAAO;AACxD;AACA;AACA;AACA,iDAAiD,4CAAM;AACvD;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,SAAS;AACxB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA,wBAAwB,0BAA0B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,eAAe;AAC9B;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,uCAAI;AACpB;AACA,gBAAgB,uCAAI;AACpB;AACA;AACA,sBAAsB;AACtB,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,eAAe,SAAS;AACxB;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA,yBAAyB,YAAY;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,eAAe,QAAQ;AACvB;AACA,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB;AACA;AACA,gBAAgB;AAChB;AACA;AACA,yBAAyB,mDAAU;AACnC;AACA;AACA;AACA,0CAA0C,MAAM,GAAG,WAAW;AAC9D,0CAA0C,MAAM,GAAG,WAAW;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,MAAM;AACjD,kDAAkD,YAAY;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,MAAM;AACjD,kDAAkD,YAAY;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,MAAM;AACjD,kDAAkD,YAAY;AAC9D;AACA;AACA;AACA;AACA,2CAA2C,MAAM;AACjD,kDAAkD,YAAY;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,MAAM;AAC/C,gDAAgD,YAAY;AAC5D;AACA,yCAAyC,MAAM;AAC/C,gDAAgD,YAAY;AAC5D;AACA;AACA;AACA,cAAc;AACd;AACA,8BAA8B,8CAAO;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,gDAAQ;AACtC;AACA;AACA;AACA;AACA,8BAA8B,gDAAQ;AACtC;AACA,qCAAqC,MAAM;AAC3C,4CAA4C,YAAY;AACxD;AACA;AACA,qCAAqC,MAAM;AAC3C,4CAA4C,YAAY;AACxD;AACA;AACA;AACA;AACA,wCAAwC,YAAY;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,4DAAc;AAC5C;AACA,wCAAwC,YAAY;AACpD;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC,yBAAyB,4DAAc,qKAAqK,mBAAmB;AAC/N;AACA;AACA,8BAA8B,2CAAM;AACpC;AACA;AACA,8BAA8B,uDAAY;AAC1C;AACA;AACA,8BAA8B,4CAAM;AACpC;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,wCAAI;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,4CAAM;AACpC;AACA;AACA,qCAAqC,MAAM;AAC3C,4CAA4C,YAAY;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,8CAAO;AACrC;AACA,qCAAqC,MAAM;AAC3C,4CAA4C,YAAY;AACxD;AACA;AACA;AACA;AACA;AACA,qCAAqC,MAAM;AAC3C,4CAA4C,YAAY;AACxD;AACA;AACA;AACA;AACA,8BAA8B,4CAAM;AACpC;AACA;AACA;AACA,qCAAqC,MAAM;AAC3C,4CAA4C,YAAY;AACxD;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,eAAe,QAAQ;AACvB;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;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,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB;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,mBAAmB,2CAAM;AACzB;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;AACA,mDAAmD;AACnD;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;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,2DAA2D,GAAG,EAAE,EAAE;AAClE,qDAAqD,EAAE;AACvD,sDAAsD,EAAE;AACxD,qDAAqD;AACrD,mDAAmD,EAAE;AACrD,oDAAoD,EAAE;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;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;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,SAAS;AACxB;AACA,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,gCAAgC;AAC7D;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;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,kDAAkD,4CAAM;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB,UAAU,uBAAuB,wBAAwB;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB,UAAU;AAC1B;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,2BAA2B;AACvD;AACA;AACA;AACA;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,aAAa;AAC5B;AACA,gBAAgB;AAChB;AACA;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8EAA8E,4CAAM;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA,8FAA8F,4CAAM;AACpG;AACA;AACA,8FAA8F,4CAAM;AACpG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,eAAe;AAC9B,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,8BAA8B;AACvD;AACA;AACA;AACA;AACA;AACA,gBAAgB,wDAAY;AAC5B;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,wDAAY;AAC5B;AACA,aAAa;AACb;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,mDAAmD,4CAAM,UAAU,sDAAsD;AACzH,mDAAmD,4CAAM,UAAU,sDAAsD;AACzH;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D,YAAY;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,sDAAsD;AACzG;AACA,+CAA+C,4CAAM;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,4CAAM;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qEAAqE;AACrE;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,YAAY;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;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;AACA;AACA,gDAAgD,4CAAM;AACtD,gDAAgD,4CAAM;AACtD,+CAA+C,wCAAI;AACnD;AACA;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA,4BAA4B,8DAAW;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,mDAAU,GAAG,gBAAgB;AAC/D;AACA;AACA,aAAa;AACb;AACA,0CAA0C,8CAAO;AACjD;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD;AACnD;AACA,EAAE;AACF,eAAe,QAAQ;AACvB;AACA,eAAe,QAAQ;AACvB;AACA,eAAe,QAAQ;AACvB;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB,QAAQ;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,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,mBAAmB,KAAK;AACxB,mBAAmB,QAAQ;AAC3B,mBAAmB,QAAQ;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,mBAAmB,QAAQ;AAC3B,mBAAmB,QAAQ;AAC3B,mBAAmB,QAAQ;AAC3B,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B,mBAAmB,SAAS;AAC5B,mBAAmB,SAAS;AAC5B,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,mBAAmB,UAAU;AAC7B,mBAAmB,UAAU;AAC7B,mBAAmB,UAAU;AAC7B,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,YAAY;AAC3B;AACA;AACA,wBAAwB,oCAAoC;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,gGAAgG,4CAAM,GAAG,oDAAoD;AAC7J;AACA;AACA,iBAAiB;AACjB;AACA,UAAU;AACV;AACA,GAAG;AACH,iEAAe,eAAe,EAAC;AAC/B;;;;;;;;;;;;;;;;;;AC9mEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC0C;AACR;AACY;AACZ;AAClC;AACA,6EAA6E;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,uDAAY;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB;AACA;AACA,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,0BAA0B;AAChF;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,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,gBAAgB;AAChB;AACA;AACA;AACA,wBAAwB,0BAA0B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA,kEAAkE;AAClE;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,2CAAM;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,2CAAM;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,2CAAM;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA,eAAe,2CAAM;AACrB;AACA;AACA;AACA;AACA,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,WAAW;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,2CAAM;AACnC;AACA;AACA,wBAAwB,WAAW;AACnC;AACA;AACA,iCAAiC,2CAAM;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,kBAAkB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB;AACA;AACA,gBAAgB,WAAW;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,2CAAM;AACnC;AACA;AACA,wBAAwB,WAAW;AACnC;AACA;AACA;AACA,8BAA8B,2CAAM;AACpC,8BAA8B,2CAAM;AACpC,yBAAyB,2CAAM;AAC/B,yBAAyB,2CAAM;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,kBAAkB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,sBAAsB;AAC9C;AACA;AACA,eAAe,mDAAU;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,0BAA0B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,6CAA6C,OAAO;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;ACreA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACkC;AACA;AACJ;AACM;AACU;AACZ;AACM;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,uDAAY;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,eAAe;AAC9B;AACA,gBAAgB;AAChB;AACA;AACA;AACA,sFAAsF,WAAW;AACjG;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,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA,mBAAmB,2CAAM;AACzB;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,UAAU;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ,IAAI;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,2CAAM;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB,QAAQ;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,8BAA8B,2CAAM;AACpC;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,2CAAM;AACpC;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA,mBAAmB,2CAAM,KAAK,2CAAM,4GAA4G,2CAAM;AACtJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA,mBAAmB,6CAAO;AAC1B;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,UAAU;AAC1B;AACA;AACA,0BAA0B,uCAAI;AAC9B,0BAA0B,uCAAI;AAC9B,0BAA0B,uCAAI;AAC9B,0BAA0B,iDAAS,2CAA2C;AAC9E,0BAA0B,iDAAS,2CAA2C;AAC9E;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;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA,kBAAkB,4FAA4F;AAC9G;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,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;AC/YA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA,kBAAkB,uBAAuB;AACzC;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;ACbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC8B;AACI;AACA;AACY;AACQ;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,uDAAY;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,UAAU;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA,mBAAmB,2CAAM;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA,mBAAmB,2CAAM;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,UAAU;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,iBAAiB,UAAU;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,2CAAM;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,YAAY;AAC3B;AACA;AACA;AACA;AACA;AACA,2BAA2B,uCAAI;AAC/B,2BAA2B,uCAAI;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,2CAAM;AAC7B;AACA;AACA,uBAAuB,2CAAM;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,YAAY;AAC3B;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,gBAAgB,eAAe;AAC/B;AACA;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,iBAAiB;AACjB;AACA;AACA;AACA;AACA,wBAAwB,mBAAmB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,eAAe,iBAAiB;AAChC;AACA,gBAAgB,yBAAyB;AACzC;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,wBAAwB,mBAAmB;AAC3C;AACA;AACA;AACA;AACA;AACA,gCAAgC,+DAAgB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,+DAAgB;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;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,UAAU;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,QAAQ;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,gBAAgB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;;;;;;;;;;;;;;;;;;;ACxZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACsD;AACd;AACV;AACgB;AACR;AACJ;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,uDAAY;AAC/B;AACA,0BAA0B,iDAAS;AACnC,wBAAwB,iDAAS;AACjC;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,eAAe,iBAAiB;AAChC;AACA,gBAAgB,yBAAyB;AACzC;AACA;AACA;AACA;AACA,2DAA2D;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,uBAAuB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,+DAAgB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAiE;AACjE;AACA;AACA;AACA,oCAAoC,+DAAgB;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,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,iDAAS;AAC9B,mBAAmB,iDAAS;AAC5B;AACA;AACA,sBAAsB,2CAAM,CAAC,+CAAQ;AACrC,wBAAwB,2CAAM,CAAC,+CAAQ;AACvC,+BAA+B,YAAY;AAC3C,iCAAiC,YAAY;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,mGAAmG;AACnG;AACA;AACA;AACA,4EAA4E;AAC5E;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB,eAAe;AAC/B;AACA;AACA,4BAA4B,+CAAQ;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,0BAA0B;AAClD;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,4BAA4B,OAAO;AACnC,2BAA2B,iDAAS;AACpC;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,QAAQ;AACvB,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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,2CAAM;AACjC;AACA,4BAA4B,+CAAQ;AACpC;AACA;AACA,+BAA+B,uCAAI,qBAAqB,2CAAM;AAC9D,6BAA6B,uCAAI,qBAAqB,2CAAM;AAC5D;AACA;AACA,GAAG;AACH;;;;;;;;;;;;;;;;ACtRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACwC;AACN;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,qBAAqB,iDAAS;AACrC;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA,2BAA2B,2CAAM,QAAQ,2CAAM;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC;AACA;AACA;AACA;AACA,mBAAmB,2CAAM;AACzB;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA,0BAA0B,2CAAM;AAChC,0BAA0B,2CAAM;AAChC,0BAA0B,2CAAM;AAChC,0BAA0B,2CAAM;AAChC;AACA;AACA;AACA;;;;;;;;;;;;;;;;ACnKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACkC;AACY;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA,mBAAmB,uDAAY;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA,gBAAgB,GAAG;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,gBAAgB,WAAW;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,WAAW;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,WAAW;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,WAAW;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,WAAW;AAC1B,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA,oCAAoC,2CAAM,YAAY,2CAAM;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA,mBAAmB,2CAAM;AACzB;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,eAAe,WAAW;AAC1B;AACA;AACA;AACA;AACA;AACA,kDAAkD,2CAAM;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,UAAU;AACzB,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,2CAAM;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,GAAG;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA,kBAAkB,8DAA8D;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;AC/SA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC0C;AACI;AACM;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,uDAAY;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,mDAAU;AAClC,6BAA6B,6DAAe;AAC5C;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB,QAAQ;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,eAAe,QAAQ;AACvB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,QAAQ;AACxB;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,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,OAAO,GAAG,QAAQ;AACxD,aAAa,QAAQ;AACrB;AACA;AACA,eAAe,iBAAiB;AAChC,eAAe,SAAS;AACxB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,UAAU;AAClD;AACA;AACA;AACA,wCAAwC,UAAU;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,OAAO,GAAG,QAAQ;AACxD,aAAa,QAAQ;AACrB;AACA;AACA,eAAe,iBAAiB;AAChC,eAAe,SAAS;AACxB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,UAAU;AAClD;AACA;AACA;AACA,wCAAwC,UAAU;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB;AAChB;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,eAAe,UAAU;AACzB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ,4CAA4C;AACnE,eAAe,WAAW,gCAAgC;AAC1D,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA,8BAA8B,sBAAsB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ,4CAA4C;AACnE,eAAe,WAAW,gCAAgC;AAC1D,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ,2CAA2C;AAClE,eAAe,WAAW,iCAAiC;AAC3D,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA,8CAA8C,IAAI,QAAQ;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ,2BAA2B;AAClD,gBAAgB,QAAQ;AACxB;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,gBAAgB,QAAQ;AACxB;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,UAAU,cAAc,wBAAwB;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,eAAe,SAAS;AACxB,iBAAiB;AACjB;AACA;AACA;AACA;AACA,oBAAoB;AACpB,oBAAoB;AACpB,SAAS;AACT;AACA;AACA;;;;;;;;;;;;;;AC/nBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACpDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,8BAA8B;AAC7C,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA,eAAe,8BAA8B;AAC7C,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA,eAAe,8BAA8B;AAC7C,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA,eAAe,8BAA8B;AAC7C,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,mCAAmC;AAClD,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA,eAAe,8BAA8B;AAC7C,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,iCAAiC;AAChD,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA,eAAe,+BAA+B;AAC9C,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,uBAAuB;AACtC,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,uBAAuB;AACtC,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,uBAAuB;AACtC,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,uBAAuB;AACtC,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,sBAAsB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;ACrQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4FAA4F;AAC5F,kFAAkF;AAClF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACsD;AACpB;AACY;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,eAAe,yBAAyB;AACxC,eAAe,SAAS;AACxB;AACA;AACA;AACA,0BAA0B,2CAAM;AAChC,yBAAyB,2CAAM;AAC/B;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,sBAAsB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,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,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,SAAS,8CAA8C;AACtE,gBAAgB;AAChB;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA,uBAAuB,2CAAM;AAC7B;AACA,wBAAwB,qBAAqB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,YAAY;AAC3B,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,QAAQ,uCAAuC;AAC9D,eAAe,SAAS;AACxB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,UAAU,UAAU,mDAAmD;AACtF,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,kGAAkG;AAClG,oCAAoC;AACpC;AACA;AACA,oCAAoC,2CAAM;AAC1C;AACA,sCAAsC,2CAAM;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oGAAoG,YAAY;AAChH;AACA;AACA,+FAA+F;AAC/F,oCAAoC;AACpC;AACA;AACA,oCAAoC,2CAAM;AAC1C,sCAAsC,2CAAM;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;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,UAAU;AACzB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,UAAU;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA,kCAAkC,+DAAgB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,eAAe;AAC9B,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,eAAe,QAAQ;AACvB,eAAe,UAAU;AACzB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,iBAAiB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,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,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,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,QAAQ;AACzB,iBAAiB,QAAQ;AACzB,iBAAiB,QAAQ;AACzB,iBAAiB,QAAQ;AACzB,iBAAiB,gBAAgB;AACjC,iBAAiB,UAAU;AAC3B,oBAAoB,eAAe;AACnC,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,SAAS;AACxB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gEAAgE,eAAe;AAC/E;AACA;AACA;AACA,8DAA8D;AAC9D,8BAA8B;AAC9B,iEAAiE,gBAAgB;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,gEAAgE,eAAe;AAC/E,qEAAqE,gBAAgB;AACrF;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,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,eAAe,QAAQ;AACvB,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,eAAe,QAAQ;AACvB,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,eAAe,UAAU;AACzB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,YAAY;AAC3B,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,UAAU;AACzB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,UAAU;AACzB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,qBAAqB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,YAAY;AAC3B,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,mBAAmB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,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,aAAa;AAC5B,eAAe,aAAa;AAC5B,eAAe,UAAU;AACzB,eAAe,eAAe;AAC9B;AACA;AACA,gBAAgB,GAAG;AACnB;AACA;AACA,0DAA0D,uDAAY;AACtE,QAAQ,uDAAY;AACpB;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,qBAAqB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;ACn9BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,eAAe,4BAA4B;AAC3C,eAAe,SAAS;AACxB;AACA;AACA;AACA,0BAA0B,2CAAM;AAChC,yBAAyB,2CAAM;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mEAAmE;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,sBAAsB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,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;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,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,YAAY;AAC3B,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,QAAQ,uCAAuC;AAC9D,eAAe,SAAS;AACxB,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,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,SAAS,8CAA8C;AACtE,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,eAAe,QAAQ;AACvB,eAAe,SAAS,8CAA8C;AACtE,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,SAAS,8CAA8C;AACtE,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,SAAS,8CAA8C;AACtE,eAAe,SAAS;AACxB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,SAAS,8CAA8C;AACtE,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,UAAU;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,YAAY;AAC3B,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,UAAU;AACzB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,wBAAwB,6BAA6B;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,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,eAAe,UAAU,8CAA8C;AACvE,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,YAAY;AAC3B,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,SAAS;AACxB,eAAe,gBAAgB;AAC/B,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,aAAa;AAC5B,eAAe,UAAU;AACzB,eAAe,eAAe;AAC9B;AACA;AACA,gBAAgB,GAAG;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;AC/uBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;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;AACA;AACA;AACA;AACA;AACA;AACA;AAC8C;AACQ;AACpB;AACY;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,eAAe,YAAY;AAC3B,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,eAAe,YAAY;AAC3B,eAAe,UAAU;AACzB,eAAe,cAAc,qEAAqE;AAClG;AACA;AACA;AACA,0BAA0B,2CAAM;AAChC,yBAAyB,2CAAM;AAC/B;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,aAAa,aAAa,UAAU,qBAAqB,gBAAgB,uBAAuB,IAAI;AACnI;AACA;AACA,8EAA8E,EAAE;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;AACA,eAAe,oBAAoB;AACnC;AACA;AACA;AACA;AACA,kCAAkC,eAAe;AACjD,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,KAAK;AACpB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,QAAQ;AACzC;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;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,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,UAAU;AACzB,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA,0CAA0C,WAAW,EAAE,kBAAkB;AACzE;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,eAAe;AAC5D;AACA,uCAAuC,WAAW,IAAI;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B;AACA;AACA;AACA,oDAAoD,uBAAuB,EAAE,uBAAuB;AACpG,8CAA8C,sBAAsB;AACpE,+CAA+C,uBAAuB;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,sBAAsB;AACrC;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,eAAe,aAAa;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,wCAAwC;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA,uDAAuD;AACvD;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,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,UAAU;AACzB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,mCAAmC,cAAc;AACjD,mCAAmC,cAAc;AACjD,mCAAmC,cAAc;AACjD,mCAAmC,cAAc;AACjD;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,SAAS,8CAA8C;AACtE,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB,uBAAuB,2CAAM;AAC7B;AACA,wBAAwB,sBAAsB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,YAAY;AAC3B,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,kCAAkC;AAChF,+CAA+C,mCAAmC;AAClF,oDAAoD;AACpD;AACA,gDAAgD,MAAM;AACtD;AACA,4DAA4D,qBAAqB,EAAE,oBAAoB,UAAU,QAAQ,EAAE,OAAO;AAClI;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,kCAAkC,EAAE;AACpC,kCAAkC,EAAE;AACpC,8CAA8C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,QAAQ,uCAAuC;AAC9D,eAAe,SAAS;AACxB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,yCAAyC,2CAAM;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,uDAAY,QAAQ,GAAG;AAC9D;AACA;AACA;AACA,uCAAuC,gCAAgC;AACvE,uCAAuC,gCAAgC;AACvE,2CAA2C,kBAAkB;AAC7D,4CAA4C,mBAAmB;AAC/D;AACA;AACA;AACA,sDAAsD,sBAAsB,IAAI,gCAAgC,IAAI,gCAAgC;AACpJ;AACA;AACA;AACA;AACA,kCAAkC,+BAA+B,MAAM,+BAA+B;AACtG,4BAA4B,6BAA6B;AACzD,sCAAsC,+BAA+B,MAAM,+BAA+B;AAC1G;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD,iCAAiC,EAAE,gCAAgC;AACrH,iDAAiD,aAAa,IAAI,aAAa;AAC/E;AACA;AACA,mDAAmD,WAAW;AAC9D;AACA,2DAA2D;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA,kCAAkC,+DAAgB;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;AACA;AACA,eAAe,UAAU;AACzB,eAAe,QAAQ;AACvB,eAAe,UAAU;AACzB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,iBAAiB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,aAAa;AAChD,mCAAmC,aAAa;AAChD,kCAAkC,OAAO;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,SAAS,8CAA8C;AACtE,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,kBAAkB;AACrD,mCAAmC,kBAAkB;AACrD,kCAAkC,sBAAsB,IAAI;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,wBAAwB,uDAAY;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,SAAS,8CAA8C;AACtE,eAAe,SAAS;AACxB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,kBAAkB;AACrD,mCAAmC,kBAAkB;AACrD,mCAAmC,uBAAuB;AAC1D,mCAAmC,uBAAuB;AAC1D,4DAA4D,UAAU,EAAE,UAAU,EAAE,SAAS;AAC7F,iDAAiD,4BAA4B,EAAE,mBAAmB,EAAE,kBAAkB;AACtH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,SAAS,8CAA8C;AACtE,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,kCAAkC,+BAA+B;AACjE,kCAAkC,+BAA+B;AACjE,sCAAsC,oBAAoB;AAC1D,uCAAuC,oBAAoB;AAC3D;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,UAAU;AACzB;AACA;AACA;AACA,kCAAkC,oBAAoB;AACtD,kCAAkC,oBAAoB;AACtD,sCAAsC,qBAAqB;AAC3D,uCAAuC,sBAAsB;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gEAAgE,eAAe;AAC/E;AACA;AACA;AACA;AACA;AACA,iEAAiE,gBAAgB;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,gEAAgE,eAAe;AAC/E,qEAAqE,gBAAgB;AACrF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,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;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,kCAAkC,+BAA+B;AACjE,kCAAkC,+BAA+B;AACjE,sCAAsC,KAAK;AAC3C,uCAAuC,KAAK;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,kBAAkB;AACrD,mCAAmC,kBAAkB;AACrD,kCAAkC,OAAO;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,YAAY;AAC3B,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,UAAU;AACzB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,UAAU;AACzB,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,SAAS;AACxB,eAAe,QAAQ;AACvB,eAAe,SAAS,8CAA8C;AACtE,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB,eAAe,SAAS,8CAA8C;AACtE,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,YAAY;AAC3B,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,WAAW,KAAK,WAAW;AAC9D,uCAAuC,YAAY,EAAE,4BAA4B;AACjF;AACA;AACA;AACA;AACA,oDAAoD,+BAA+B;AACnF;AACA;AACA;AACA;AACA;AACA,6GAA6G;AAC7G,iEAAiE,gCAAgC;AACjG,mEAAmE,kBAAkB;AACrF,qEAAqE,mBAAmB;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,SAAS;AACxB,eAAe,gBAAgB;AAC/B,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD,EAAE,GAAG,EAAE,YAAY,kCAAkC;AACzG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,aAAa;AAC5B,eAAe,UAAU;AACzB,eAAe,eAAe;AAC9B;AACA;AACA,gBAAgB,GAAG;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,sBAAsB;AAC5D,uCAAuC,uBAAuB;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qEAAqE;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,QAAQ;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,OAAO;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;ACx1CA;AACA;AACA;AACA;AACA;AACA;AAC8B;AACQ;AACtC;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA,6BAA6B,+CAAQ;AACrC,2BAA2B,uCAAI;AAC/B,2BAA2B,uCAAI;AAC/B,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B;AACA,4BAA4B,uCAAI;AAChC;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC5E6B;AACJ;AACA;AACM;AACI;AACZ;AACE;AACM;AACH;AACL;AACM;AACA;AACN;AACQ;AACL;AACD;AACS;AACR;AACC;AACI;AACN;AACE;AACM;AACR;AACI;AACK;AACN;AAC5B;;;;;;;;;;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACU;AACV;;;;;;;;;;;ACvBU;AACV;;;;;;;;;;;ACDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACU;AACV;;;;;;;;;;;ACtBA;AACA;AACA;AACA;AACA;AACU;AACV;;;;;;;;;;;;;;;ACNuB;AACG;AACE;AACE;AAC9B;;;;;;;;;;ACJA;AACa;;AAEb;AACA;AACA;AACA;AACA;;AAEA;;AAEA,OAAO,UAAU;AACjB,OAAO,gBAAgB;;AAEvB;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA,aAAa,SAAS;AACtB;AACA,OAAO,SAAS;;AAEhB;AACA;AACA;AACA,WAAW,GAAG;AACd;AACA,aAAa,SAAS;AACtB;AACA;;AAEA;AACA;AACA;AACA,WAAW,GAAG;AACd;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,GAAG;AACd;AACA,aAAa,SAAS;AACtB;AACA;;;AAGA;AACA;AACA;AACA,WAAW,GAAG;AACd;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,GAAG;AACd;AACA,aAAa,SAAS;AACtB;AACA;;AAEA;AACA;AACA;AACA,WAAW,GAAG;AACd,aAAa,SAAS;AACtB;AACA;;AAEA;AACA;AACA;AACA,WAAW,GAAG;AACd;AACA,aAAa,SAAS;AACtB;AACA;;AAEA;AACA;AACA;AACA,WAAW,GAAG;AACd;AACA,aAAa,SAAS;AACtB;AACA;;AAEA;AACA;AACA;AACA,WAAW,GAAG;AACd,aAAa,SAAS;AACtB;AACA;;AAEA;AACA;AACA;AACA,WAAW,GAAG;AACd;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,GAAG;AACd;AACA,aAAa,SAAS;AACtB;AACA;;AAEA;AACA;AACA;AACA,WAAW,GAAG;AACd;AACA,aAAa,SAAS;AACtB;AACA;;AAEA;AACA;AACA;AACA,WAAW,GAAG;AACd;AACA,aAAa,SAAS;AACtB;AACA;;AAEA;AACA;AACA;AACA,WAAW,GAAG;AACd;AACA,aAAa,SAAS;AACtB;AACA;;AAEA;AACA;AACA;AACA,WAAW,GAAG;AACd;AACA,aAAa,SAAS;AACtB;AACA;;AAEA;AACA;AACA;AACA,WAAW,GAAG;AACd;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,GAAG;AACd;AACA,aAAa,SAAS;AACtB;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA,aAAa,QAAQ;AACrB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,UAAU;AACrB;AACA,WAAW,SAAS;AACpB,aAAa;AACb;AACA,2BAA2B,oBAAoB,IAAI;AACnD;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,gCAAgC,OAAO;AACvC;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,wFAAwF,qBAAM;AAC9F,CAAC;;AAED;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,SAAS,GAAG,SAAS;AAC5C,4BAA4B;AAC5B;AACA;AACA,WAAW,QAAQ;AACnB;AACA,aAAa,QAAQ;AACrB;AACA;AACA,SAAS,UAAU;AACnB;AACA;AACA;AACA;AACA;AACA,MAAM;AACN,kCAAkC;AAClC,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;;AAEA,wCAAwC,OAAO;AAC/C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA,WAAW,SAAS;AACpB,aAAa,QAAQ;AACrB;AACA,gCAAgC,WAAW,IAAI;AAC/C;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,GAAG,GAAG,WAAW;AACjB;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,UAAU;AACrB,WAAW,UAAU;AACrB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,kBAAkB;AAC7B,WAAW,UAAU;AACrB;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA,WAAW,GAAG;AACd;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,WAAW,kBAAkB;AAC7B,WAAW,UAAU;AACrB;AACA,aAAa;AACb;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B,eAAe;;AAEzC;AACA;AACA;AACA,WAAW,GAAG;AACd;AACA,aAAa,SAAS;AACtB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;AACA,WAAW,QAAQ;AACnB;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS,QAAQ;AACjB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,SAAS;AACpB;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA,aAAa,OAAO;AACpB;AACA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB,CAAC;;AAED;AACA,oDAAoD,YAAY;;AAEhE;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;;AAEH;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA,WAAW,YAAY;AACvB;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA,+CAA+C;AAC/C;AACA,CAAC;;AAED;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,SAAS;AACpB,WAAW,SAAS;AACpB,WAAW,UAAU;AACrB,WAAW,SAAS;AACpB,WAAW,SAAS;AACpB,WAAW,UAAU;AACrB;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA,WAAW,kBAAkB;AAC7B,WAAW,QAAQ;AACnB,WAAW,qBAAqB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,aAAa,GAAG;AAChB,aAAa,eAAe;AAC5B,aAAa,sBAAsB;AACnC,YAAY;AACZ;AACA,eAAe,SAAS;AACxB;AACA;AACA;;AAEA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA,WAAW,qBAAqB;AAChC,WAAW,qBAAqB;AAChC;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,SAAS;AACpB;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,UAAU;AACvB,aAAa,UAAU;AACvB;AACA,cAAc,QAAQ;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,aAAa,QAAQ;AACrB;AACA,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,UAAU;AACvB;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;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;;AAEA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;;AAGD;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA,WAAW,YAAY;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA,aAAa,4BAA4B;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,QAAQ;AACR;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,UAAU;AACrB,WAAW,UAAU;AACrB;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gEAAgE;AAChE;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,wBAAwB,iBAAiB;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,GAAG;;AAEH;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA,CAAC;;AAED;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,MAAM;AACN;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,2BAA2B,mBAAmB;AAC9C;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL,GAAG;AACH;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW,gBAAgB;AAC3B,WAAW,SAAS;AACpB;AACA,aAAa,GAAG;AAChB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;;AAEH;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,SAAS;AACpB,WAAW,SAAS;AACpB,WAAW,SAAS;AACpB;AACA,aAAa,eAAe;AAC5B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,WAAW,UAAU;AACrB,WAAW,UAAU;AACrB,WAAW,QAAQ;AACnB;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,yCAAyC;AACzC,OAAO;;AAEP;AACA,4DAA4D,wBAAwB;AACpF;AACA,OAAO;;AAEP;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA,gCAAgC;AAChC,8BAA8B,cAAc;AAC5C;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,QAAQ;AACtB,gBAAgB;AAChB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,cAAc,QAAQ;AACtB,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA,0BAA0B,KAAK;AAC/B;AACA;;AAEA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,8CAA8C;AAC9C,QAAQ;AACR,2DAA2D,WAAW;AACtE;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;;AAEP;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,yCAAyC,MAAM;AAC/C,MAAM;AACN;AACA;AACA,8CAA8C,MAAM;AACpD;AACA,CAAC;;AAED;AACA;AACA;;AAEA,WAAW,QAAQ;AACnB;AACA;;AAEA,oBAAoB,YAAY;AAChC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB,eAAe;AACpC;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,cAAc;AACpC,8BAA8B,cAAc;AAC5C;AACA;;AAEA;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA,aAAa,SAAS;AACtB;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;AACH;;AAEA;;AAEA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,+BAA+B,SAAS;AACxC,MAAM;AACN,2BAA2B;AAC3B,MAAM;AACN;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,4CAA4C;AAC5C;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;;AAEA;AACA;AACA;AACA,WAAW,mBAAmB;AAC9B,WAAW,SAAS;AACpB,WAAW,SAAS;AACpB;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,UAAU;AACrB;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,eAAe;AAC5B,aAAa,SAAS;AACtB;AACA,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;;AAEA;;AAEA,WAAW,yCAAyC;;AAEpD;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA,yBAAyB;AACzB,KAAK;AACL;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA,kDAAkD;AAClD;AACA;AACA;AACA,UAAU,IAAI;AACd;AACA;AACA,OAAO;AACP;AACA;;AAEA;;AAEA;AACA,CAAC;;AAED;;AAEA;AACA;AACA;AACA,WAAW,UAAU;AACrB;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;;AAEP;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA,WAAW,UAAU;AACrB;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,GAAG;AACd;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA,sDAAsD,iBAAiB;;AAEvE;AACA,yCAAyC,iBAAiB;;AAE1D;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA","sources":["webpack://RPGDialogue/./node_modules/alloyfinger-typescript/src/esm/alloy_finger.js","webpack://RPGDialogue/./node_modules/alloyfinger-typescript/src/esm/index.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/cjs/utils/algorithms/getContrastColor.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/cjs/utils/datastructures/Color.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/cjs/utils/io/FileDrop.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/BezierPath.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/Bounds.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/Circle.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/CircleSector.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/CubicBezierCurve.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/Grid.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/KeyHandler.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/Line.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/MouseHandler.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/PBImage.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/PBText.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/PlotBoilerplate.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/Polygon.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/Triangle.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/UIDGenerator.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/VEllipse.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/VEllipseSector.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/Vector.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/VertTuple.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/Vertex.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/VertexAttr.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/VertexListeners.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/draw.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/drawgl.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/drawutilssvg.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/geomutils.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/index.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/interfaces/DrawLib.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/interfaces/additionals.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/interfaces/core.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/interfaces/externals.js","webpack://RPGDialogue/./node_modules/plotboilerplate/src/esm/interfaces/index.js","webpack://RPGDialogue/./node_modules/axios/dist/browser/axios.cjs"],"sourcesContent":["/* Port from AlloyFinger v0.1.15\n * Original by dntzhang\n * Typescript port by Ikaros Kappler\n * Github: https://github.com/IkarosKappler/AlloyFinger-Typescript\n *\n * @date    2021-02-10 (Typescript port)\n * @version 0.1.18\n */\n;\n/**\n * Tiny math function to calculate the length of a vector in euclidean space.\n *\n * @param {XYCoords} v - The vector in {x,y} notation.\n * @return {number} The length of the vector.\n */\nconst getLen = (v) => {\n    return Math.sqrt(v.x * v.x + v.y * v.y);\n};\n/**\n * Tiny math function to calculate the dot product of two vectors.\n *\n * @param {XYCoords} v1 - The first vector in {x,y} notation.\n * @param {XYCoords} v2 - The second vector in {x,y} notation.\n * @return {number} The dot product of both vectors.\n */\nconst dot = (v1, v2) => {\n    return v1.x * v2.x + v1.y * v2.y;\n};\n/**\n * Tiny math function to calculate the angle between two vectors.\n *\n * @param {XYCoords} v1 - The first vector in {x,y} notation.\n * @param {XYCoords} v2 - The second vector in {x,y} notation.\n * @return {number} The angle (in radians) between the two vectors.\n */\nconst getAngle = (v1, v2) => {\n    const mr = getLen(v1) * getLen(v2);\n    if (mr === 0)\n        return 0;\n    var r = dot(v1, v2) / mr;\n    if (r > 1)\n        r = 1;\n    return Math.acos(r);\n};\n/**\n * Tiny math function to calculate the cross product of two vectors.\n *\n * @param {XYCoords} v1 - The first vector in {x,y} notation.\n * @param {XYCoords} v2 - The second vector in {x,y} notation.\n * @return {number} The cross product of both vectors.\n */\nconst cross = (v1, v2) => {\n    return v1.x * v2.y - v2.x * v1.y;\n};\n/**\n * Tiny math function to calculate the rotate-angle (in degrees) for two vectors.\n *\n * @param {XYCoords} v1 - The first vector in {x,y} notation.\n * @param {XYCoords} v2 - The second vector in {x,y} notation.\n * @return {number} The rotate-angle in degrees for the two vectors.\n */\nconst getRotateAngle = (v1, v2) => {\n    var angle = getAngle(v1, v2);\n    if (cross(v1, v2) > 0) {\n        angle *= -1;\n    }\n    return angle * 180 / Math.PI;\n};\n/**\n * A HandlerAdmin holds all the added event handlers for one kind of event type.\n */\nclass HandlerAdmin {\n    constructor(el) {\n        this.handlers = [];\n        this.el = el;\n    }\n    ;\n    add(handler) {\n        this.handlers.push(handler);\n    }\n    ;\n    del(handler) {\n        if (!handler)\n            this.handlers = [];\n        for (var i = this.handlers.length; i >= 0; i--) {\n            if (this.handlers[i] === handler) {\n                this.handlers.splice(i, 1);\n            }\n        }\n    }\n    ;\n    dispatch(..._args) {\n        for (var i = 0, len = this.handlers.length; i < len; i++) {\n            const handler = this.handlers[i];\n            if (typeof handler === 'function') {\n                handler.apply(this.el, arguments);\n            }\n        }\n    }\n    ;\n} // END class HandlerAdmin\n/**\n * A wrapper for handler functions; converts the passed handler function into a HadlerAdmin instance..\n */\nconst wrapFunc = (el, handler) => {\n    const handlerAdmin = new HandlerAdmin(el);\n    handlerAdmin.add(handler);\n    return handlerAdmin;\n};\n/**\n * @classdesc The AlloyFinger main class. Use this to add handler functions for\n *            touch events to any HTML- or SVG-Element.\n **/\nexport class AlloyFinger {\n    constructor(el, option) {\n        this.element = typeof el == 'string' ? document.querySelector(el) : el;\n        // Fancy stuff: change `this` from the start-, move-, end- and cancel-function.\n        //    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_objects/Function/bind\n        this.start = this.start.bind(this);\n        this.move = this.move.bind(this);\n        this.end = this.end.bind(this);\n        this.cancel = this.cancel.bind(this);\n        this.element.addEventListener(\"touchstart\", this.start, false);\n        this.element.addEventListener(\"touchmove\", this.move, false);\n        this.element.addEventListener(\"touchend\", this.end, false);\n        this.element.addEventListener(\"touchcancel\", this.cancel, false);\n        this.preV = { x: null, y: null };\n        this.pinchStartLen = null;\n        this.zoom = 1;\n        this.isDoubleTap = false;\n        const noop = () => { };\n        this.rotate = wrapFunc(this.element, option.rotate || noop);\n        this.touchStart = wrapFunc(this.element, option.touchStart || noop);\n        this.multipointStart = wrapFunc(this.element, option.multipointStart || noop);\n        this.multipointEnd = wrapFunc(this.element, option.multipointEnd || noop);\n        this.pinch = wrapFunc(this.element, option.pinch || noop);\n        this.swipe = wrapFunc(this.element, option.swipe || noop);\n        this.tap = wrapFunc(this.element, option.tap || noop);\n        this.doubleTap = wrapFunc(this.element, option.doubleTap || noop);\n        this.longTap = wrapFunc(this.element, option.longTap || noop);\n        this.singleTap = wrapFunc(this.element, option.singleTap || noop);\n        this.pressMove = wrapFunc(this.element, option.pressMove || noop);\n        this.twoFingerPressMove = wrapFunc(this.element, option.twoFingerPressMove || noop);\n        this.touchMove = wrapFunc(this.element, option.touchMove || noop);\n        this.touchEnd = wrapFunc(this.element, option.touchEnd || noop);\n        this.touchCancel = wrapFunc(this.element, option.touchCancel || noop);\n        this._cancelAllHandler = this.cancelAll.bind(this);\n        if (globalThis && typeof globalThis.addEventListener === \"function\") {\n            globalThis.addEventListener('scroll', this._cancelAllHandler);\n        }\n        this.delta = null;\n        this.last = null;\n        this.now = null;\n        this.tapTimeout = null;\n        this.singleTapTimeout = null;\n        this.longTapTimeout = null;\n        this.swipeTimeout = null;\n        this.x1 = this.x2 = this.y1 = this.y2 = null;\n        this.preTapPosition = { x: null, y: null };\n    }\n    ;\n    start(evt) {\n        if (!evt.touches)\n            return;\n        const _self = this;\n        this.now = Date.now();\n        this.x1 = evt.touches[0].pageX;\n        this.y1 = evt.touches[0].pageY;\n        this.delta = this.now - (this.last || this.now);\n        this.touchStart.dispatch(evt, this.element);\n        if (this.preTapPosition.x !== null) {\n            this.isDoubleTap = (this.delta > 0 && this.delta <= 250 && Math.abs(this.preTapPosition.x - this.x1) < 30 && Math.abs(this.preTapPosition.y - this.y1) < 30);\n            if (this.isDoubleTap)\n                clearTimeout(this.singleTapTimeout);\n        }\n        this.preTapPosition.x = this.x1;\n        this.preTapPosition.y = this.y1;\n        this.last = this.now;\n        const preV = this.preV;\n        const len = evt.touches.length;\n        if (len > 1) {\n            this._cancelLongTap();\n            this._cancelSingleTap();\n            const v = { x: evt.touches[1].pageX - this.x1, y: evt.touches[1].pageY - this.y1 };\n            preV.x = v.x;\n            preV.y = v.y;\n            this.pinchStartLen = getLen(preV);\n            this.multipointStart.dispatch(evt, this.element);\n        }\n        this._preventTap = false;\n        this.longTapTimeout = setTimeout((() => {\n            _self.longTap.dispatch(evt, _self.element);\n            _self._preventTap = true;\n        }).bind(_self), 750);\n    }\n    ;\n    move(event) {\n        if (!event.touches)\n            return;\n        const afEvent = event;\n        const preV = this.preV;\n        const len = event.touches.length;\n        const currentX = event.touches[0].pageX;\n        const currentY = event.touches[0].pageY;\n        this.isDoubleTap = false;\n        if (len > 1) {\n            const sCurrentX = afEvent.touches[1].pageX;\n            const sCurrentY = afEvent.touches[1].pageY;\n            const v = { x: afEvent.touches[1].pageX - currentX, y: afEvent.touches[1].pageY - currentY };\n            if (preV.x !== null) {\n                if (this.pinchStartLen > 0) {\n                    afEvent.zoom = getLen(v) / this.pinchStartLen;\n                    this.pinch.dispatch(afEvent, this.element);\n                }\n                afEvent.angle = getRotateAngle(v, preV);\n                this.rotate.dispatch(afEvent, this.element);\n            }\n            preV.x = v.x;\n            preV.y = v.y;\n            if (this.x2 !== null && this.sx2 !== null) {\n                afEvent.deltaX = (currentX - this.x2 + sCurrentX - this.sx2) / 2;\n                afEvent.deltaY = (currentY - this.y2 + sCurrentY - this.sy2) / 2;\n            }\n            else {\n                afEvent.deltaX = 0;\n                afEvent.deltaY = 0;\n            }\n            this.twoFingerPressMove.dispatch(afEvent, this.element);\n            this.sx2 = sCurrentX;\n            this.sy2 = sCurrentY;\n        }\n        else {\n            if (this.x2 !== null) {\n                afEvent.deltaX = currentX - this.x2;\n                afEvent.deltaY = currentY - this.y2;\n                //move事件中添加对当前触摸点到初始触摸点的判断，\n                //如果曾经大于过某个距离(比如10),就认为是移动到某个地方又移回来，应该不再触发tap事件才对。\n                //\n                // translation:\n                //    Add the judgment of the current touch point to the initial touch point in the event,\n                //    If it has been greater than a certain distance (such as 10), it is considered to be\n                //    moved to a certain place and then moved back, and the tap event should no longer be triggered.\n                const movedX = Math.abs(this.x1 - this.x2);\n                const movedY = Math.abs(this.y1 - this.y2);\n                if (movedX > 10 || movedY > 10) {\n                    this._preventTap = true;\n                }\n            }\n            else {\n                afEvent.deltaX = 0;\n                afEvent.deltaY = 0;\n            }\n            this.pressMove.dispatch(afEvent, this.element);\n        }\n        this.touchMove.dispatch(afEvent, this.element);\n        this._cancelLongTap();\n        this.x2 = currentX;\n        this.y2 = currentY;\n        if (len > 1) {\n            event.preventDefault();\n        }\n    }\n    ; // END move\n    end(event) {\n        if (!event.changedTouches)\n            return;\n        const afEvent = event;\n        this._cancelLongTap();\n        const self = this;\n        if (afEvent.touches.length < 2) {\n            this.multipointEnd.dispatch(afEvent, this.element);\n            this.sx2 = this.sy2 = null;\n        }\n        //swipe\n        if ((this.x2 && Math.abs(this.x1 - this.x2) > 30) ||\n            (this.y2 && Math.abs(this.y1 - this.y2) > 30)) {\n            afEvent.direction = this._swipeDirection(this.x1, this.x2, this.y1, this.y2);\n            this.swipeTimeout = setTimeout(function () {\n                self.swipe.dispatch(afEvent, self.element);\n            }, 0);\n        }\n        else {\n            this.tapTimeout = setTimeout(function () {\n                if (!self._preventTap) {\n                    self.tap.dispatch(afEvent, self.element);\n                }\n                // trigger double tap immediately\n                if (self.isDoubleTap) {\n                    self.doubleTap.dispatch(afEvent, self.element);\n                    self.isDoubleTap = false;\n                }\n            }, 0);\n            if (!self.isDoubleTap) {\n                self.singleTapTimeout = setTimeout(function () {\n                    self.singleTap.dispatch(afEvent, self.element);\n                }, 250);\n            }\n        }\n        this.touchEnd.dispatch(afEvent, this.element);\n        this.preV.x = 0;\n        this.preV.y = 0;\n        this.zoom = 1;\n        this.pinchStartLen = null;\n        this.x1 = this.x2 = this.y1 = this.y2 = null;\n    }\n    ; // END end\n    cancelAll() {\n        this._preventTap = true;\n        clearTimeout(this.singleTapTimeout);\n        clearTimeout(this.tapTimeout);\n        clearTimeout(this.longTapTimeout);\n        clearTimeout(this.swipeTimeout);\n    }\n    ;\n    cancel(evt) {\n        this.cancelAll();\n        this.touchCancel.dispatch(evt, this.element);\n    }\n    ;\n    _cancelLongTap() {\n        clearTimeout(this.longTapTimeout);\n    }\n    ;\n    _cancelSingleTap() {\n        clearTimeout(this.singleTapTimeout);\n    }\n    ;\n    _swipeDirection(x1, x2, y1, y2) {\n        return Math.abs(x1 - x2) >= Math.abs(y1 - y2) ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down');\n    }\n    ;\n    on(evt, handler) {\n        if (this[evt]) {\n            // Force the generic parameter into it's expected candidate here ;)\n            const admin = this[evt];\n            admin.add(handler);\n        }\n    }\n    ;\n    off(evt, handler) {\n        if (this[evt]) {\n            // Force the generic parameter into it's expected candidate here ;)\n            const admin = this[evt];\n            admin.del(handler);\n        }\n    }\n    ;\n    destroy() {\n        if (this.singleTapTimeout) {\n            clearTimeout(this.singleTapTimeout);\n        }\n        if (this.tapTimeout) {\n            clearTimeout(this.tapTimeout);\n        }\n        if (this.longTapTimeout) {\n            clearTimeout(this.longTapTimeout);\n        }\n        if (this.swipeTimeout) {\n            clearTimeout(this.swipeTimeout);\n        }\n        this.element.removeEventListener(\"touchstart\", this.start);\n        this.element.removeEventListener(\"touchmove\", this.move);\n        this.element.removeEventListener(\"touchend\", this.end);\n        this.element.removeEventListener(\"touchcancel\", this.cancel);\n        this.rotate.del();\n        this.touchStart.del();\n        this.multipointStart.del();\n        this.multipointEnd.del();\n        this.pinch.del();\n        this.swipe.del();\n        this.tap.del();\n        this.doubleTap.del();\n        this.longTap.del();\n        this.singleTap.del();\n        this.pressMove.del();\n        this.twoFingerPressMove.del();\n        this.touchMove.del();\n        this.touchEnd.del();\n        this.touchCancel.del();\n        this.preV = this.pinchStartLen = this.zoom = this.isDoubleTap = this.delta = this.last = this.now = this.tapTimeout = this.singleTapTimeout = this.longTapTimeout = this.swipeTimeout = this.x1 = this.x2 = this.y1 = this.y2 = this.preTapPosition = this.rotate = this.touchStart = this.multipointStart = this.multipointEnd = this.pinch = this.swipe = this.tap = this.doubleTap = this.longTap = this.singleTap = this.pressMove = this.touchMove = this.touchEnd = this.touchCancel = this.twoFingerPressMove = null;\n        if (globalThis && typeof globalThis.removeEventListener === \"function\") {\n            globalThis.removeEventListener('scroll', this._cancelAllHandler);\n        }\n    }\n    ; // END destroy\n}\n;\nexport default AlloyFinger;\n//# sourceMappingURL=alloy_finger.js.map","/**\n * TypeScript port by Ikaros Kappler.\n *\n * Original file from https://github.com/AlloyTeam/AlloyFinger\n *\n * @date 2021-02-10\n */\nimport { AlloyFinger } from './alloy_finger';\nexport { AlloyFinger };\nexport default AlloyFinger;\n//# sourceMappingURL=index.js.map","\"use strict\";\n/**\n * @author Original from Martin Sojka. Ported to TypesScript by Ikaros Kappler\n * @date   2020-11-10\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getContrastColor = void 0;\nvar Color_1 = require(\"../datastructures/Color\");\nvar BLACK = Color_1.Color.makeRGB(0, 0, 0);\nvar WHITE = Color_1.Color.makeRGB(255, 255, 255);\n/**\n * Contrast color algorithm by Martin Sojka's.\n * Found at\n *    https://gamedev.stackexchange.com/questions/38536/given-a-rgb-color-x-how-to-find-the-most-contrasting-color-y/38542#38542\n *\n * @requires Color\n */\nvar getContrastColor = function (color) {\n    // r,g,b in [0..1]\n    var gamma = 2.2;\n    var L = 0.2126 * Math.pow(color.r, gamma) + 0.7152 * Math.pow(color.g, gamma) + 0.0722 * Math.pow(color.b, gamma);\n    var use_black = L > Math.pow(0.5, gamma);\n    return use_black ? BLACK : WHITE;\n};\nexports.getContrastColor = getContrastColor;\n//# sourceMappingURL=getContrastColor.js.map","\"use strict\";\n/**\n * @author Extended, bugfixed and ported to TypeScript by Ikaros Kappler.\n * @modified 2018-xx-xx Added a clone() function.\n * @modified 2018-xx-xx Allowing leading '#' in the makeHEX() function.\n * @modified 2018-11-28 Fixed the checkHEX() function to accept 000000.\n * @modified 2019-11-18 Added a generic parse(string) function that detects the format.\n * @modified 2020-01-09 Fixed a bug in the parse(string) function. Hex colors with only three elements were considered faulty.\n * @modified 2020-10-23 Ported to Typescript.\n * @modified 2021-02-08 Fixed a lot of es2015 compatibility issues.\n * @modified 2021-02-08 Added basic tsdoc/jsdoc comments.\n * @modified 2021-11-05 Fixing the regex to parse rgba-strings.\n * @modified 2021-11-05 Added return value `this` to all modifier functions (for chaining).\n * @modified 2021-11-07 Changed the behavior of `darken` and `lighten`: the passed value is handled relative now which makes values much easier predictable and makes the change feel more 'natural'.\n * @modified 2021-11-07 Did the same with `saturate` and `desaturate`.\n * @modified 2021-11-07 Did the same with the `fadein` and `fadeout` functions.\n * @modified 2021-11-07 Added setRed, setGreen, setBlue, setHue, setSaturation, setLiminance functions.\n * @modified 2022-05-11 Modified the `clone` function by just copying the numeric calues, not re-calculating the whole color.\n * @modified 2022-05-11 Fixed the `interpolate` function.\n * @modified 2023-01-23 Added `Color.set(Color)` function to set all values (r,g,b,h,s,l,a) simultanoeusly.\n * @version 0.0.12\n **/\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Color = void 0;\n/**\n * @classdesc A color class, inspired by neolitec's Javascript class.\n *    Original found at\n *      https://gist.github.com/neolitec/1344610\n *    Thanks to neolitec\n */\nvar Color = /** @class */ (function () {\n    /**\n     * Construct a new color with `r=0 g=0 b=0`.\n     *\n     * Consider using the `makeHex`, `makeRGB` or `makeHSL` functions.\n     *\n     * @constructor\n     * @instance\n     * @memberof Color\n     */\n    function Color() {\n        this.r = this.g = this.b = 0;\n        this.h = this.s = this.l = 0;\n        this.a = 1;\n    }\n    // --- RGB ----------------------------------\n    /**\n     * Get this color as a CSS `rgb` string.\n     *\n     * Consult this for details: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value\n     *\n     * @method cssRGB\n     * @instance\n     * @memberof Color\n     * @return {string} This color as a CSS rgb string.\n     */\n    Color.prototype.cssRGB = function () {\n        return \"rgb(\" + Math.round(255 * this.r) + \",\" + Math.round(255 * this.g) + \",\" + Math.round(255 * this.b) + \")\";\n    };\n    /**\n     * Get this color as a CSS `rgba` string.\n     *\n     * Consult this for details: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value\n     *\n     * @method cssRGBA\n     * @instance\n     * @memberof Color\n     * @return {string} This color as a CSS rgba string.\n     */\n    Color.prototype.cssRGBA = function () {\n        return \"rgba(\" + Math.round(255 * this.r) + \",\" + Math.round(255 * this.g) + \",\" + Math.round(255 * this.b) + \",\" + this.a + \")\";\n    };\n    /**\n     * Get the red component of this RGB(A)color. This method just returns the `r` color attribute.\n     *\n     * @method red\n     * @instance\n     * @memberof Color\n     * @return {number} A value between 0.0 and 1.0.\n     */\n    Color.prototype.red = function () {\n        return this.r;\n    };\n    /**\n     * Get the green component of this RGB(A) color. This method just returns the `g` color attribute.\n     *\n     * @method green\n     * @instance\n     * @memberof Color\n     * @return {number} A value between 0.0 and 1.0.\n     */\n    Color.prototype.green = function () {\n        return this.g;\n    };\n    /**\n     * Get the blue component of this RGB(A) color. This method just returns the `b` color attribute.\n     *\n     * @method blue\n     * @instance\n     * @memberof Color\n     * @return {number} A value between 0.0 and 1.0.\n     */\n    Color.prototype.blue = function () {\n        return this.b;\n    };\n    Color.prototype.set = function (color) {\n        this.r = color.r;\n        this.g = color.g;\n        this.b = color.b;\n        this.a = color.a;\n        this.h = color.h;\n        this.s = color.s;\n        this.l = color.l;\n        return this;\n    };\n    Color.prototype.setRed = function (r) {\n        this.r = r;\n        return this;\n    };\n    Color.prototype.setBlue = function (b) {\n        this.b = b;\n        Color.Converter.RGBToHSL(this);\n        return this;\n    };\n    Color.prototype.setAlpha = function (a) {\n        this.a = a;\n        Color.Converter.RGBToHSL(this);\n        return this;\n    };\n    Color.prototype.setGreen = function (g) {\n        this.g = g;\n        Color.Converter.RGBToHSL(this);\n        return this;\n    };\n    Color.prototype.setHue = function (h) {\n        this.h = h;\n        Color.Converter.HSLToRGB(this);\n        return this;\n    };\n    Color.prototype.setSaturation = function (s) {\n        this.s = s;\n        Color.Converter.HSLToRGB(this);\n        return this;\n    };\n    Color.prototype.setLuminance = function (l) {\n        this.l = l;\n        Color.Converter.HSLToRGB(this);\n        return this;\n    };\n    // --- HSL ----------------------------------\n    /**\n     * Get this color as a CSS `hsl` string.\n     *\n     * @method cssHSL\n     * @instance\n     * @memberof Color\n     * @return {string} This color as a CSS hsl string.\n     */\n    Color.prototype.cssHSL = function () {\n        return \"hsl(\" + Math.round(360 * this.h) + \",\" + Math.round(100 * this.s) + \"%,\" + Math.round(100 * this.l) + \"%)\";\n    };\n    /**\n     * Get this color as a CSS `hsla` string.\n     *\n     * @method cssHSLA\n     * @instance\n     * @memberof Color\n     * @return {string} This color as a CSS hsla string.\n     */\n    Color.prototype.cssHSLA = function () {\n        return (\"hsla(\" +\n            Math.round(360 * this.h) +\n            \",\" +\n            Math.round(100 * this.s) +\n            \"%,\" +\n            Math.round(100 * this.l) +\n            \"%,\" +\n            Math.round(this.a) +\n            \")\");\n    };\n    /**\n     * Get the hue component of this HSL(A) color. This method just returns the `h` color attribute.\n     *\n     * @method hue\n     * @instance\n     * @memberof Color\n     * @return {number} A value between 0.0 and 1.0.\n     */\n    Color.prototype.hue = function () {\n        return this.h;\n    };\n    /**\n     * Get the saturation component of this HSL(A) color. This method just returns the `s` color attribute.\n     *\n     * @method saturation\n     * @instance\n     * @memberof Color\n     * @return {number} A value between 0.0 and 1.0.\n     */\n    Color.prototype.saturation = function () {\n        return this.s;\n    };\n    /**\n     * Get the lightness component of this HSL(A) color. This method just returns the `l` color attribute.\n     *\n     * @method lightness\n     * @instance\n     * @memberof Color\n     * @return {number} A value between 0.0 and 1.0.\n     */\n    Color.prototype.lightness = function () {\n        return this.l;\n    };\n    // --- HEX ----------------------------------\n    /**\n     * Get this color as a CSS-HEX string (non-alpha): #rrggbb\n     *\n     * @method cssHEX\n     * @instance\n     * @memberof Color\n     * @return {string} This color as a CSS-HEX string.\n     */\n    Color.prototype.cssHEX = function () {\n        return (\"#\" +\n            (255 * this.r < 16 ? \"0\" : \"\") +\n            Math.round(255 * this.r).toString(16) +\n            (255 * this.g < 16 ? \"0\" : \"\") +\n            Math.round(255 * this.g).toString(16) +\n            (255 * this.b < 16 ? \"0\" : \"\") +\n            Math.round(255 * this.b).toString(16));\n    };\n    // --- Transparency ----------------------------------\n    /**\n     * Get the alpha channel (transparency) of this color.\n     *\n     * @method alpha\n     * @instance\n     * @memberof Color\n     * @return {number} A value between 0.0 and 1.0.\n     */\n    Color.prototype.alpha = function () {\n        return this.a;\n    };\n    // --- Modifiers ----------------------------------\n    //   saturate(v: string | number): Color {\n    //     if (\"string\" == typeof v && v.indexOf(\"%\") > -1 && (v = parseInt(v)) != NaN) {\n    //       this.s += v / 100;\n    //     } else if (\"number\" == typeof v) {\n    //       // range 255\n    //       this.s += v / 255;\n    //     } else {\n    //       throw new Error(\"error: bad modifier format (percent or number)\");\n    //     }\n    //     if (this.s > 1) this.s = 1;\n    //     else if (this.s < 0) this.s = 0;\n    //     Color.Converter.HSLToRGB(this);\n    //     return this;\n    //   }\n    Color.prototype.saturate = function (v) {\n        if (\"string\" == typeof v && v.indexOf(\"%\") > -1 && (v = parseInt(v)) != NaN) {\n            this.s += (1 - this.s) * (v / 100);\n        }\n        else if (\"number\" == typeof v) {\n            if (v >= -0.0 && v <= 1.0) {\n                // range 255\n                this.s += (1 - this.s) * v;\n            }\n            else {\n                // range 0-1\n                this.s += (1 - this.s) * (v / 255);\n            }\n        }\n        else {\n            throw new Error(\"error: bad modifier format (percent or number)\");\n        }\n        if (this.s > 1)\n            this.s = 1;\n        else if (this.s < 0)\n            this.s = 0;\n        Color.Converter.HSLToRGB(this);\n        return this;\n    };\n    Color.prototype.desaturate = function (v) {\n        if (\"string\" == typeof v && v.indexOf(\"%\") > -1 && (v = parseInt(v)) != NaN) {\n            this.s -= v / 100;\n        }\n        else if (\"number\" == typeof v) {\n            if (v >= 0.0 && v <= 1.0) {\n                // range 255\n                this.s -= this.s * v;\n            }\n            else {\n                // range 0-1\n                this.s -= this.s * (v / 255);\n            }\n        }\n        else {\n            throw new Error(\"error: bad modifier format (percent or number)\");\n        }\n        if (this.s > 1)\n            this.s = 1;\n        else if (this.s < 0)\n            this.s = 0;\n        Color.Converter.HSLToRGB(this);\n        return this;\n    };\n    //   lighten(v: string | number): Color {\n    //     if (\"string\" == typeof v && v.indexOf(\"%\") > -1 && (v = parseInt(v)) != NaN) {\n    //       this.l += v / 100;\n    //     } else if (\"number\" == typeof v) {\n    //       if (v >= -1.0 && v <= 1.0) {\n    //         // range 0.0...1.0\n    //         this.l += v;\n    //       } else {\n    //         // range 255\n    //         this.l += v / 255;\n    //       }\n    //     } else {\n    //       throw new Error(\"error: bad modifier format (percent or number)\");\n    //     }\n    //     if (this.l > 1) this.l = 1;\n    //     else if (this.l < 0) this.l = 0;\n    //     Color.Converter.HSLToRGB(this);\n    //     return this;\n    //   }\n    Color.prototype.lighten = function (v) {\n        if (\"string\" == typeof v && v.indexOf(\"%\") > -1 && (v = parseInt(v)) != NaN) {\n            this.l += (1 - this.l) * (v / 100);\n        }\n        else if (\"number\" == typeof v) {\n            if (v >= 0.0 && v <= 1.0) {\n                // range 0.0...1.0\n                this.l += (1 - this.l) * v;\n            }\n            else {\n                // range 255\n                this.l += (1 - this.l) * (v / 255);\n            }\n        }\n        else {\n            throw new Error(\"error: bad modifier format (percent or number)\");\n        }\n        if (this.l > 1)\n            this.l = 1;\n        else if (this.l < 0)\n            this.l = 0;\n        Color.Converter.HSLToRGB(this);\n        return this;\n    };\n    Color.prototype.darken = function (v) {\n        if (\"string\" == typeof v && v.indexOf(\"%\") > -1 && (v = parseInt(v)) != NaN) {\n            this.l -= this.l * (v / 100);\n        }\n        else if (\"number\" == typeof v) {\n            if (v >= 0.0 && v <= 1.0) {\n                // range 0.0...1.0\n                this.l -= this.l * v;\n            }\n            else {\n                // range 255\n                this.l -= this.l * (v / 255);\n            }\n        }\n        else {\n            throw new Error(\"error: bad modifier format (percent or number)\");\n        }\n        if (this.l > 1)\n            this.l = 1;\n        else if (this.l < 0)\n            this.l = 0;\n        Color.Converter.HSLToRGB(this);\n        return this;\n    };\n    Color.prototype.fadein = function (v) {\n        if (\"string\" == typeof v && v.indexOf(\"%\") > -1 && (v = parseInt(v)) != NaN) {\n            this.a += (1 - this.a) * (v / 100);\n        }\n        else if (\"number\" == typeof v) {\n            if (v >= 0.0 && v <= 1.0) {\n                // range 0-1\n                this.a += (1 - this.a) * v;\n            }\n            else {\n                // range 255\n                this.a += (1 - this.a) * (v / 255);\n            }\n        }\n        else {\n            throw new Error(\"error: bad modifier format (percent or number)\");\n        }\n        console.log(\"New alpha\", this.a);\n        if (this.a > 1)\n            this.a = 1;\n        else if (this.a < 0)\n            this.a = 0;\n        Color.Converter.HSLToRGB(this);\n        return this;\n    };\n    Color.prototype.fadeout = function (v) {\n        if (\"string\" == typeof v && v.indexOf(\"%\") > -1 && (v = parseInt(v)) != NaN) {\n            this.a -= v / 100;\n        }\n        else if (\"number\" == typeof v) {\n            if (v >= 0.0 && v <= 1.0) {\n                // range 0-1\n                this.a -= v;\n            }\n            else {\n                // range 255\n                this.a -= v / 255;\n            }\n        }\n        else {\n            throw new Error(\"error: bad modifier format (percent or number)\");\n        }\n        if (this.a > 1)\n            this.a = 1;\n        else if (this.a < 0)\n            this.a = 0;\n        Color.Converter.HSLToRGB(this);\n        return this;\n    };\n    Color.prototype.spin = function (v) {\n        if (\"string\" == typeof v && v.indexOf(\"%\") > -1 && (v = parseInt(v)) != NaN)\n            this.h += v / 100;\n        else if (\"number\" == typeof v)\n            // range 360\n            this.h += v / 360;\n        else\n            throw new Error(\"error: bad modifier format (percent or number)\");\n        if (this.h > 1)\n            this.h = 1;\n        else if (this.h < 0)\n            this.h = 0;\n        Color.Converter.HSLToRGB(this);\n        return this;\n    };\n    Color.makeRGB = function () {\n        var args = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n            args[_i] = arguments[_i];\n        }\n        var c = new Color();\n        var sanitized;\n        if (arguments.length < 3 || arguments.length > 4)\n            throw new Error(\"error: 3 or 4 arguments\");\n        sanitized = Color.Sanitizer.RGB(arguments[0], arguments[1], arguments[2]);\n        c.r = sanitized[0];\n        c.g = sanitized[1];\n        c.b = sanitized[2];\n        if (arguments.length == 4) {\n            c.a = arguments[3];\n        }\n        else {\n            c.a = 1.0;\n        }\n        Color.Converter.RGBToHSL(c);\n        return c;\n    };\n    Color.makeHSL = function () {\n        var args = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n            args[_i] = arguments[_i];\n        }\n        var c = new Color();\n        var sanitized;\n        if (arguments.length < 3 || arguments.length > 4)\n            throw new Error(\"error: 3 or 4 arguments\");\n        sanitized = Color.Sanitizer.HSL(arguments[0], arguments[1], arguments[2]);\n        c.h = sanitized[0];\n        c.s = sanitized[1];\n        c.l = sanitized[2];\n        if (arguments.length == 4)\n            c.a = arguments[3];\n        else\n            c.a = 1.0;\n        Color.Converter.HSLToRGB(c);\n        return c;\n    };\n    Color.makeHEX = function (value) {\n        var c = new Color(), sanitized;\n        // Edit Ika 2018-0308\n        // Allow leading '#'\n        if (value && value.startsWith(\"#\"))\n            value = value.substr(1);\n        Color.Validator.checkHEX(value);\n        if (value.length == 3) {\n            sanitized = Color.Sanitizer.RGB(parseInt(value.substr(0, 1) + value.substr(0, 1), 16), parseInt(value.substr(1, 1) + value.substr(1, 1), 16), parseInt(value.substr(2, 1) + value.substr(2, 1), 16));\n        }\n        else if (value.length == 6) {\n            sanitized = Color.Sanitizer.RGB(parseInt(value.substr(0, 2), 16), parseInt(value.substr(2, 2), 16), parseInt(value.substr(4, 2), 16));\n        }\n        else\n            throw new Error(\"error: 3 or 6 arguments\");\n        c.r = sanitized[0];\n        c.g = sanitized[1];\n        c.b = sanitized[2];\n        c.a = 1.0; // TODO: Accept #xxxxxxxx (8 chars, too, for alpha)\n        Color.Converter.RGBToHSL(c);\n        return c;\n    };\n    /**\n     * Parse the given color string. Currently only these formate are recognized: hex, rgb, rgba.\n     *\n     * @method parse\n     * @static\n     * @memberof Color\n     * @param {string} str - The string representation to parse.\n     * @return {Color} The color instance that's represented by the given string.\n     */\n    Color.parse = function (str) {\n        if (typeof str == \"undefined\") {\n            return null;\n        }\n        if ((str = str.trim().toLowerCase()).length == 0) {\n            return null;\n        }\n        if (str.startsWith(\"#\"))\n            return Color.makeHEX(str.substring(1, str.length));\n        if (str.startsWith(\"rgb\")) {\n            var parts = str.match(/^rgba?\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,?\\s*(\\d*(?:\\.\\d+\\s*)?)\\)$/);\n            if (!parts) {\n                throw \"Unrecognized color format (2): \" + str;\n            }\n            // [ str, r, g, b, a|undefined ]\n            //   console.log(\"parts\", parts);\n            if (parts.length <= 4 || typeof parts[4] == \"undefined\" || parts[4] == \"\") {\n                return Color.makeRGB(parts[1], parts[2], parts[3]);\n            }\n            else {\n                return Color.makeRGB(parts[1], parts[2], parts[3], Number(parts[4]));\n            }\n        }\n        else {\n            throw \"Unrecognized color format (1): \" + str;\n        }\n    };\n    /**\n     * Create a clone of this color (RGB).\n     *\n     * @method clone\n     * @instance\n     * @memberof Color\n     * @return {Color} A clone of this color (in RGB mode).\n     */\n    Color.prototype.clone = function () {\n        // return Color.makeRGB(this.r, this.g, this.b, this.a);\n        var col = new Color();\n        col.r = this.r;\n        col.g = this.g;\n        col.b = this.b;\n        col.a = this.a;\n        col.h = this.h;\n        col.s = this.s;\n        col.l = this.l;\n        return col;\n    };\n    /**\n     * Interpolate this color on the RGB scale.\n     *\n     * @method interpolate\n     * @instance\n     * @memberof Color\n     * @param {Color} c - The color to interpolate to.\n     * @param {number} t - An interpolation value between 0.0 and 1.0.\n     * @return {Color} A clone of this color (in RGB mode).\n     */\n    Color.prototype.interpolate = function (c, t) {\n        this.r += (c.r - this.r) * t;\n        this.g += (c.g - this.g) * t;\n        this.b += (c.b - this.b) * t;\n        this.a += (c.a - this.a) * t;\n        return this;\n    };\n    Color.Sanitizer = {\n        RGB: function () {\n            var args = [];\n            for (var _i = 0; _i < arguments.length; _i++) {\n                args[_i] = arguments[_i];\n            }\n            var o = [];\n            if (arguments.length == 0) {\n                return [];\n            }\n            // const allAreFrac = Color.testFrac( arguments );\n            for (var i = 0; i < arguments.length; i++) {\n                var c = arguments[i];\n                if (\"string\" == typeof c && c.indexOf(\"%\") > -1) {\n                    if ((c = parseInt(c)) == NaN)\n                        throw new Error(\"Bad format\");\n                    if (c < 0 || c > 100)\n                        throw new Error(\"Bad format\");\n                    o[i] = c / 100;\n                }\n                else {\n                    if (\"string\" == typeof c && (c = parseInt(c)) == NaN) {\n                        throw new Error(\"Bad format\");\n                    }\n                    if (c < 0) {\n                        throw new Error(\"Bad format\");\n                    }\n                    //else if( allAreFrac ) o[i] = c; // c >= 0 && c <= 1 (all)\n                    else if (c >= 0 && c < 1) {\n                        o[i] = c;\n                    }\n                    // else if(c >= 0.0 && c <= 1.0) o[i] = c;\n                    else if (c >= 1 && c < 256) {\n                        o[i] = c / 255;\n                    }\n                    // ???\n                    // else if(c >= 0 && c < 256) o[i] = c/255;\n                    else\n                        throw new Error(\"Bad format (\" + c + \")\");\n                }\n            }\n            return o;\n        },\n        HSL: function () {\n            var args = [];\n            for (var _i = 0; _i < arguments.length; _i++) {\n                args[_i] = arguments[_i];\n            }\n            if (arguments.length < 3 || arguments.length > 4)\n                throw new Error(\"3 or 4 arguments required\");\n            var h = arguments[0], s = arguments[1], l = arguments[2];\n            if (\"string\" == typeof h && (h = parseFloat(h)) == NaN)\n                throw new Error(\"Bad format for hue\");\n            if (h < 0 || h > 360)\n                throw new Error(\"Hue out of range (0..360)\");\n            else if (((\"\" + h).indexOf(\".\") > -1 && h > 1) || (\"\" + h).indexOf(\".\") == -1)\n                h /= 360;\n            if (\"string\" == typeof s && s.indexOf(\"%\") > -1) {\n                if ((s = parseInt(s)) == NaN)\n                    throw new Error(\"Bad format for saturation\");\n                if (s < 0 || s > 100)\n                    throw new Error(\"Bad format for saturation\");\n                s /= 100;\n            }\n            else if (s < 0 || s > 1)\n                throw new Error(\"Bad format for saturation\");\n            if (\"string\" == typeof l && l.indexOf(\"%\") > -1) {\n                if ((l = parseInt(l)) == NaN)\n                    throw new Error(\"Bad format for lightness\");\n                if (l < 0 || l > 100)\n                    throw new Error(\"Bad format for lightness\");\n                l /= 100;\n            }\n            else if (l < 0 || l > 1)\n                throw new Error(\"Bad format for lightness\");\n            return [h, s, l];\n        }\n    }; // ENd sanitizer\n    Color.Validator = {\n        /**\n         * Check a hexa color (without #)\n         */\n        checkHEX: function (value) {\n            if (value.length != 6 && value.length != 3)\n                throw new Error(\"Hexa color: bad length (\" + value.length + \"),\" + value);\n            value = value.toLowerCase();\n            //for( var i in value ) {\n            for (var i = 0; i < value.length; i++) {\n                var c = value.charCodeAt(i);\n                if (!((c >= 48 && c <= 57) || (c >= 97 && c <= 102)))\n                    throw new Error(\"Hexa color: out of range for \\\"\" + value + \"\\\" at position \" + i + \".\");\n            }\n        }\n    };\n    Color.Converter = {\n        /**\n         * Calculates HSL Color.\n         * RGB must be normalized.\n         * http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript\n         */\n        RGBToHSL: function (color) {\n            var r = color.r;\n            var g = color.g;\n            var b = color.b;\n            var max = Math.max(r, g, b);\n            var min = Math.min(r, g, b);\n            color.l = (max + min) / 2;\n            if (max == min) {\n                color.h = color.s = 0; // achromatic\n            }\n            else {\n                var d = max - min;\n                color.s = color.l > 0.5 ? d / (2 - max - min) : d / (max + min);\n                switch (max) {\n                    case r:\n                        color.h = (g - b) / d + (g < b ? 6 : 0);\n                        break;\n                    case g:\n                        color.h = (b - r) / d + 2;\n                        break;\n                    case b:\n                        color.h = (r - g) / d + 4;\n                        break;\n                }\n                color.h /= 6;\n            }\n        },\n        /**\n         * Calculates RGB color (nomalized).\n         * HSL must be normalized.\n         *\n         * http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript\n         */\n        HSLToRGB: function (color) {\n            var h = color.h;\n            var s = color.s;\n            var l = color.l;\n            if (s == 0) {\n                color.r = color.g = color.b = l; // achromatic\n            }\n            else {\n                var q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n                var p = 2 * l - q;\n                color.r = Color.Converter.hue2rgb(p, q, h + 1 / 3);\n                color.g = Color.Converter.hue2rgb(p, q, h);\n                color.b = Color.Converter.hue2rgb(p, q, h - 1 / 3);\n            }\n        },\n        hue2rgb: function (p, q, t) {\n            if (t < 0)\n                t += 1;\n            if (t > 1)\n                t -= 1;\n            if (t < 1 / 6)\n                return p + (q - p) * 6 * t;\n            if (t < 1 / 2)\n                return q;\n            if (t < 2 / 3)\n                return p + (q - p) * (2 / 3 - t) * 6;\n            return p;\n        }\n    };\n    return Color;\n}()); // END class\nexports.Color = Color;\n//# sourceMappingURL=Color.js.map","\"use strict\";\n/**\n * A basic IO handler for file drop (Drag-and-drop).\n *\n * Example use:\n * ```javascript\n *  var body = document.getElememtByTagName(\"body\")[0];\n *  var fileDrop = new FileDrop(body);\n *    fileDrop.onFileJSONDropped(function (jsonObject) {\n *    console.log(\"jsonObject\", jsonObject);\n *  });\n * ```\n *\n * @author   Ikaros Kappler\n * @date     2021-10-13\n * @modified 2022-01-31 (ported from the ngdg project, then generalized)\n * @modified 2023-01-03 Fixing some minor type issues and adding SVG reading capabilities.\n * @version  2.1.0\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.FileDrop = void 0;\nvar FileDrop = /** @class */ (function () {\n    /**\n     *\n     * @param {HTMLElement} element - The element you wish to operate as the drop zone (like <body/>).\n     */\n    function FileDrop(element) {\n        var _this = this;\n        /**\n         * Internally handle a drop event.\n         *\n         * @param {DragEvent} event\n         * @returns {void}\n         */\n        this.handleDropEvent = function (event) {\n            event.preventDefault();\n            event.stopPropagation();\n            _this.element.style.opacity = \"1.0\";\n            if (!event.dataTransfer || !event.dataTransfer.files || event.dataTransfer.files.length === 0) {\n                // No files were dropped\n                return;\n            }\n            if (event.dataTransfer.files.length > 1) {\n                // Multiple file drop is not nupported\n                return;\n            }\n            // if (!this.fileDroppedCallbackJSON) {\n            //   // No handling callback defined.\n            //   return;\n            // }\n            if (event.dataTransfer.files[0]) {\n                var file_1 = event.dataTransfer.files[0];\n                // console.log(\"file\", file);\n                if (file_1.type.match(/json.*/) && _this.fileDroppedCallbackJSON !== null) {\n                    var reader = new FileReader();\n                    reader.onload = function (readEvent) {\n                        if (!readEvent.target) {\n                            console.warn(\"Cannot process JSON ProgressEvent data: target is null.\");\n                            return;\n                        }\n                        // Finished reading file data.\n                        var jsonObject = JSON.parse(readEvent.target.result);\n                        // TODO: what happens on fail?\n                        _this.fileDroppedCallbackJSON && _this.fileDroppedCallbackJSON(jsonObject);\n                    };\n                    reader.readAsText(file_1); // start reading the file data.\n                }\n                else if (file_1.type.match(/text\\/plain.*/) && _this.fileDroppedCallbackText) {\n                    var reader = new FileReader();\n                    reader.onload = function (readEvent) {\n                        if (!readEvent.target) {\n                            console.warn(\"Cannot process Text ProgressEvent data: target is null.\");\n                            return;\n                        }\n                        // Finished reading file data.\n                        _this.fileDroppedCallbackText && _this.fileDroppedCallbackText(readEvent.target.result);\n                    };\n                    reader.readAsText(file_1); // start reading the file data.\n                }\n                else if (_this.fileDroppedCallbackBinary) {\n                    var reader = new FileReader();\n                    reader.onload = function (readEvent) {\n                        if (!readEvent.target) {\n                            console.warn(\"Cannot process Binary ProgressEvent data: target is null.\");\n                            return;\n                        }\n                        // Finished reading file data.\n                        _this.fileDroppedCallbackBinary &&\n                            _this.fileDroppedCallbackBinary(new Blob([readEvent.target.result]), file_1);\n                    };\n                    reader.readAsBinaryString(file_1); // start reading the file data.\n                }\n                else if (_this.fileDroppedCallbackSVG) {\n                    var reader = new FileReader();\n                    reader.onload = function (readEvent) {\n                        if (!readEvent.target) {\n                            console.warn(\"Cannot process SVG ProgressEvent data: target is null.\");\n                            return;\n                        }\n                        var parser = new DOMParser();\n                        var doc = parser.parseFromString(readEvent.target.result, \"image/svg+xml\");\n                        // Finished reading file data.\n                        _this.fileDroppedCallbackSVG && _this.fileDroppedCallbackSVG(doc);\n                    };\n                    reader.readAsText(file_1); // start reading the file data.\n                }\n            }\n        };\n        /**\n         * Toggles the drop sensitive element's opacity to 0.5.\n         *\n         * @param {DragEvent} event - The event.\n         */\n        this.handleDragOverEvent = function (event) {\n            event.preventDefault();\n            event.stopPropagation();\n            _this.element.style.opacity = \"0.5\";\n        };\n        /**\n         * Restored the drop sensitive element's opacity back to 1.0.\n         *\n         * @param {DragEvent} event - The event.\n         */\n        this.handleDragLeaveEvent = function (event) {\n            event.preventDefault();\n            event.stopPropagation();\n            _this.element.style.opacity = \"1.0\";\n        };\n        this.element = element;\n        // Init the drop listeners\n        element.addEventListener(\"drop\", this.handleDropEvent.bind(this));\n        element.addEventListener(\"dragover\", this.handleDragOverEvent.bind(this));\n        element.addEventListener(\"dragleave\", this.handleDragLeaveEvent.bind(this));\n    }\n    /**\n     * Install the JSON (MIME type json*) file drop callback. Note than only one callback can be installed\n     * in this implementation. Calling this method multiple times will overwrite previously\n     * installed listeners.\n     *\n     * The callback will receive the dropped file content as an object (parsed JSON).\n     *\n     * @param {(data:object)=>void} callback\n     */\n    FileDrop.prototype.onFileJSONDropped = function (callback) {\n        this.fileDroppedCallbackJSON = callback;\n    };\n    /**\n     * Install the text file (MIME type text/plain) drop callback. Note than only one callback can be installed\n     * in this implementation. Calling this method multiple times will overwrite previously\n     * installed listeners.\n     *\n     * The callback will receive the dropped file content as a string.\n     *\n     * @param {(data:object)=>void} callback\n     */\n    FileDrop.prototype.onFileTextDropped = function (callback) {\n        this.fileDroppedCallbackText = callback;\n    };\n    FileDrop.prototype.onFileSVGDropped = function (callback) {\n        this.fileDroppedCallbackSVG = callback;\n    };\n    /**\n     * Removes all listeners (drop, dragover and dragleave).\n     */\n    FileDrop.prototype.destroy = function () {\n        this.element.removeEventListener(\"drop\", this.handleDropEvent);\n        this.element.removeEventListener(\"dragover\", this.handleDragOverEvent);\n        this.element.removeEventListener(\"dragleave\", this.handleDragLeaveEvent);\n    };\n    return FileDrop;\n}());\nexports.FileDrop = FileDrop;\n//# sourceMappingURL=FileDrop.js.map","/**\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 * @modified 2021-05-25 Added BezierPath.fromReducedList( Array<number> ).\n * @modified 2022-01-31 Added `BezierPath.getEvenDistributionVertices(number)`.\n * @modified 2022-02-02 Added the `destroy` method.\n * @modified 2022-02-02 Cleared the `toSVGString` function (deprecated). Use `drawutilssvg` instead.\n * @version 2.5.0\n *\n * @file BezierPath\n * @public\n **/\nimport { Bounds } from \"./Bounds\";\nimport { CubicBezierCurve } from \"./CubicBezierCurve\";\nimport { UIDGenerator } from \"./UIDGenerator\";\nimport { Vertex } from \"./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 **/\nexport class BezierPath {\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    constructor(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.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     * 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    addCurve(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     * 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    locateCurveByStartPoint(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     * 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    locateCurveByEndPoint(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     * 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    locateCurveByStartControlPoint(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    // | 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    locateCurveByEndControlPoint(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     * 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    getLength() {\n        return this.totalArcLength;\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    updateArcLengths() {\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     * 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    getCurveCount() {\n        return this.bezierCurves.length;\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    getCurveAt(curveIndex) {\n        return this.bezierCurves[curveIndex];\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    translate(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     * Scale the whole bezier path by the given uniform factor.\n     *\n     * @method scale\n     * @param {Vertex} anchor - The scale origin to scale from.\n     * @param {number} scaleFactor - The scalar to be multiplied with.\n     * @instance\n     * @memberof BezierPath\n     * @return {BezierPath} this for chaining.\n     **/\n    scale(anchor, scaleFactor) {\n        // var scaleFactors : XYCoords = { x : scaleFactor, y : scaleFactor };\n        // for (var i = 0; i < this.bezierCurves.length; i++) {\n        //   var curve = this.bezierCurves[i];\n        //   curve.getStartPoint().scale(scaleFactor, anchor);\n        //   curve.getStartControlPoint().scale(scaleFactor, anchor);\n        //   curve.getEndControlPoint().scale(scaleFactor, 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(scaleFactor, anchor);\n        // }\n        // this.updateArcLengths();\n        // return this;\n        return this.scaleXY({ x: scaleFactor, y: scaleFactor }, anchor);\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    scaleXY(scaleFactors, anchor) {\n        for (var i = 0; i < this.bezierCurves.length; i++) {\n            var curve = this.bezierCurves[i];\n            curve.getStartPoint().scaleXY(scaleFactors, anchor);\n            curve.getStartControlPoint().scaleXY(scaleFactors, anchor);\n            curve.getEndControlPoint().scaleXY(scaleFactors, 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().scaleXY(scaleFactors, anchor);\n        }\n        this.updateArcLengths();\n        return this;\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    rotate(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     * 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    getClosestT(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     * 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    getPoint(u) {\n        if (u < 0 || u > this.totalArcLength) {\n            console.warn(\"[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 && 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     * 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    getPointAt(t) {\n        return this.getPoint(t * this.totalArcLength);\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    getTangentAt(t) {\n        return this.getTangent(t * this.totalArcLength);\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    getTangent(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 && 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     * 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    getPerpendicularAt(t) {\n        return this.getPerpendicular(t * this.totalArcLength);\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    getPerpendicular(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     * 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    static _locateUIndex(path, u) {\n        var i = 0;\n        var uTemp = 0.0;\n        var uBefore = 0.0;\n        while (i < path.bezierCurves.length && 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     * 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    getSubPathAt(startT, endT) {\n        startT = Math.max(0, startT);\n        endT = Math.min(1.0, endT);\n        let startU = startT * this.totalArcLength;\n        let 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     * 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    moveCurvePoint(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     * 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    adjustPredecessorControlPoint(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     * 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    adjustSuccessorControlPoint(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     * 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    static adjustNeighbourControlPoint(_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(mainControlPoint.x - mainPoint.x, mainControlPoint.y - mainPoint.y);\n        var neighbourHandleBounds = new 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?\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     * 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    getBounds() {\n        const min = new Vertex(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY);\n        const max = new 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(min, max);\n    }\n    /**\n     * Get n 'equally' distributed vertices along this Bézier path.\n     *\n     * As the changing curvature of the B slines makes prediction of distances difficult, the\n     * returned vertices' distances are only relatively equal:\n     *  - the distance grows where curvature is large.\n     *  - the distance shrinks where curvature is small.\n     *\n     * Only the distance mean of all consecutive is 1/n-th of the total arc length.\n     *\n     * Usually this approximation is good enough for most use cases.\n     *\n     * @param {number} pointCount - (must be at least 2) The number of desired points (start and end point included).\n     * @return {Array<Vertex>}\n     */\n    getEvenDistributionVertices(pointCount) {\n        if (pointCount < 2) {\n            throw new Error(\"pointCount must be larger than one; is \" + pointCount + \".\");\n        }\n        const result = [];\n        if (this.bezierCurves.length === 0) {\n            return result;\n        }\n        // Fetch and add the start point from the source polygon\n        var polygonPoint = new Vertex(this.bezierCurves[0].startPoint);\n        result.push(polygonPoint);\n        // if (this.bezierCurves.length === 1) {\n        //   return result;\n        // }\n        const perimeter = this.totalArcLength;\n        const stepSize = perimeter / (pointCount - 1);\n        const n = this.bezierCurves.length;\n        let curveIndex = 0;\n        let segmentLength = this.bezierCurves[0].arcLength;\n        let curSegmentU = stepSize;\n        let i = 1;\n        while (i < pointCount && curveIndex < n) {\n            // Check if next eq point is inside this segment\n            if (curSegmentU < segmentLength) {\n                var newPoint = this.bezierCurves[curveIndex].getPoint(curSegmentU);\n                result.push(newPoint);\n                curSegmentU += stepSize;\n                i++;\n            }\n            else {\n                curveIndex++;\n                curSegmentU = curSegmentU - segmentLength;\n                segmentLength = curveIndex < n ? this.bezierCurves[curveIndex].arcLength : 0;\n            }\n        }\n        result.push(new Vertex(this.bezierCurves[n - 1].endPoint));\n        return result;\n    }\n    /**\n     * Clone this BezierPath (deep clone).\n     *\n     * @method clone\n     * @instance\n     * @memberof BezierPath\n     * @return {BezierPath}\n     **/\n    clone() {\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     * 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    equals(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     * This function should invalidate any installed listeners and invalidate this object.\n     * After calling this function the object might not hold valid data any more and\n     * should not be used.\n     */\n    destroy() {\n        for (var i = 0; i < this.bezierCurves.length; i++) {\n            this.bezierCurves[i].destroy();\n        }\n        this.isDestroyed = true;\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    toJSON(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     * 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    static fromJSON(jsonString) {\n        var obj = JSON.parse(jsonString);\n        return BezierPath.fromArray(obj);\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    static fromArray(obj) {\n        if (!Array.isArray(obj))\n            throw \"[BezierPath.fromArray] Passed object must be an array.\";\n        const 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.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.fromArray(arr[i]);\n            }\n            else {\n                bCurve = 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();\n            lastCurve = bCurve;\n        }\n        bPath.updateArcLengths();\n        // Bezier segments added. Done\n        return bPath;\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    toReducedListRepresentation(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     * 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    static fromReducedListRepresentation(listJSON, adjustCircular) {\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        return BezierPath.fromReducedList(pointArray, adjustCircular);\n    }\n    /**\n     * Convert a reduced list representation (array of numeric coordinates) to a BezierPath instance.\n     *\n     * The array's length must be 6*n + 2:\n     *  - [sx, sy,  scx, scy,  ecx, ecy, ... , ex,  ey ]\n     *     |                               |   |     |\n     *     +--- sequence of curves --------+   +-end-+\n     *\n     * @param {number[]} pointArray\n     * @returns BezierPath\n     */\n    static fromReducedList(pointArray, adjustCircular) {\n        // Convert to object\n        var bezierPath = new BezierPath(null); // No points yet\n        var startPoint = new Vertex();\n        var startControlPoint;\n        var endControlPoint;\n        var endPoint;\n        var i = 0;\n        do {\n            if (i == 0) {\n                // firstStartPoint =\n                startPoint = new Vertex(pointArray[i], pointArray[i + 1]);\n            }\n            startControlPoint = new Vertex(pointArray[i + 2], pointArray[i + 3]);\n            endControlPoint = new Vertex(pointArray[i + 4], pointArray[i + 5]);\n            // if (i + 8 >= pointArray.length) {\n            //   endPoint = firstStartPoint;\n            // } else {\n            endPoint = new Vertex(pointArray[i + 6], pointArray[i + 7]);\n            // }\n            var bCurve = new CubicBezierCurve(startPoint, endPoint, startControlPoint, endControlPoint);\n            bezierPath.bezierCurves.push(bCurve);\n            startPoint = endPoint;\n            i += 6;\n        } while (i + 2 < pointArray.length);\n        bezierPath.adjustCircular = adjustCircular !== null && adjustCircular !== void 0 ? adjustCircular : false;\n        if (adjustCircular) {\n            bezierPath.bezierCurves[bezierPath.bezierCurves.length - 1].endPoint = bezierPath.bezierCurves[0].startPoint;\n        }\n        bezierPath.updateArcLengths();\n        return bezierPath;\n    }\n}\n// +---------------------------------------------------------------------------------\n// | These constants equal the values from CubicBezierCurve.\n// +-------------------------------\n/** @constant {number} */\nBezierPath.START_POINT = 0;\n/** @constant {number} */\nBezierPath.START_CONTROL_POINT = 1;\n/** @constant {number} */\nBezierPath.END_CONTROL_POINT = 2;\n/** @constant {number} */\nBezierPath.END_POINT = 3;\n//# sourceMappingURL=BezierPath.js.map","/**\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 * @modified 2021-06-21 (mid-summer) Added `getCenter` method.\n * @modified 2022-02-01 Added the `toString` function.\n * @modified 2022-10-09 Added the `fromDimension` function.\n * @modified 2022-11-28 Added the `clone` method.\n * @version  1.6.0\n **/\nimport { Polygon } from \"./Polygon\";\nimport { Vertex } from \"./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 **/\nexport class Bounds {\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    constructor(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     * 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    toPolygon() {\n        return new Polygon([new Vertex(this.min), new Vertex(this.max.x, this.min.y), new Vertex(this.max), new Vertex(this.min.x, this.max.y)], false);\n    }\n    /**\n     * Get the center of this boinding box.\n     *\n     * @method getCenter\n     * @instance\n     * @memberof Bounds\n     * @returns {Vertex} The center of these bounds.\n     */\n    getCenter() {\n        return new Vertex(this.min.x + (this.max.x - this.min.x) / 2.0, this.min.y + (this.max.y - this.min.y) / 2);\n    }\n    /**\n     * Convert these bounds to a human readable form.\n     *\n     * Note: the returned format might change in the future, so please do not\n     * rely on the returned string format.\n     *\n     * @method toString\n     * @instance\n     * @memberof Bounds\n     * @returns {string} Get these bounds in a human readable form.\n     */\n    toString() {\n        return `{ min: ${this.min.toString()}, max : ${this.max.toString()}, width: ${this.width}, height : ${this.height} }`;\n    }\n    /**\n     * Clone this bounds object (create a deep clone).\n     *\n     * @method clone\n     * @instance\n     * @memberof Bounds\n     * @returns {Bounds} Creates a deep clone of this bounds object.\n     */\n    clone() {\n        return new Bounds({ x: this.min.x, y: this.min.y }, { x: this.max.x, y: this.max.y });\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    static computeFromVertices(vertices) {\n        if (vertices.length == 0)\n            return new Bounds(new Vertex(0, 0), new Vertex(0, 0));\n        let xMin = vertices[0].x;\n        let xMax = vertices[0].x;\n        let yMin = vertices[0].y;\n        let yMax = vertices[0].y;\n        let 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(xMin, yMin), new Vertex(xMax, yMax));\n    }\n    /**\n     * Create a new `Bounds` instance just from `width` and `height`, located at (0,0) or the optionally given origin.\n     *\n     * @param {number} width - The width of the bounds\n     * @param {number} height  - The height of the bounds\n     * @param {XYCoords={x:0,y:0}} origin - [optional] A origin to locate the new Bounds object at.\n     * @returns {Bounds} A new `Bounds` instance width given width and height, located at (0,0) or the given origin..\n     */\n    static fromDimension(width, height, origin) {\n        return new Bounds(origin !== null && origin !== void 0 ? origin : { x: 0, y: 0 }, { x: (origin ? origin.x : 0) + width, y: (origin ? origin.y : 0) + height });\n    }\n} // END class bounds\n//# sourceMappingURL=Bounds.js.map","/**\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 * @modified 2022-02-02 Added the `destroy` method.\n * @modified 2022-02-02 Cleared the `toSVGString` function (deprecated). Use `drawutilssvg` instead.\n * @modified 2022-08-15 Added the `containsPoint` function.\n * @modified 2022-08-23 Added the `lineIntersection` function.\n * @modified 2022-08-23 Added the `closestPoint` function.\n * @version  1.4.0\n **/\nimport { Line } from \"./Line\";\nimport { UIDGenerator } from \"./UIDGenerator\";\nimport { Vector } from \"./Vector\";\nimport { Vertex } from \"./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 **/\nexport class Circle {\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    constructor(center, radius) {\n        /**\n         * Required to generate proper CSS classes and other class related IDs.\n         **/\n        this.className = \"Circle\";\n        this.uid = UIDGenerator.next();\n        this.center = center;\n        this.radius = radius;\n    }\n    /**\n     * Check if the given circle is fully contained inside this circle.\n     *\n     * @method containsPoint\n     * @param {XYCoords} point - The point to check if it is contained in this circle.\n     * @instance\n     * @memberof Circle\n     * @return {boolean} `true` if the given point is inside this circle.\n     */\n    containsPoint(point) {\n        return this.center.distance(point) < this.radius;\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    containsCircle(circle) {\n        return this.center.distance(circle.center) + circle.radius < this.radius;\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    lineDistance(line) {\n        const closestPointOnLine = line.getClosestPoint(this.center);\n        return closestPointOnLine.distance(this.center) - this.radius;\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    vertAt(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     * 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    tangentAt(angle) {\n        const 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(pointA, new Vertex(0, 0)).add(this.center).perp();\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    circleIntersection(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(new Vertex(x3, y3), new Vertex(x4, y4));\n    }\n    /**\n     * Calculate the intersection points (if exists) with the given infinite line (defined by two points).\n     *\n     * @method lineIntersection\n     * @instance\n     * @memberof Circle\n     * @param {Vertex} a- The first of the two points defining the line.\n     * @param {Vertex} b - The second of the two points defining the line.\n     * @return {Line|null} The intersection points (as a line) or null if this circle does not intersect the line given.\n     **/\n    lineIntersection(a, b) {\n        // Based on the math from\n        //    https://mathworld.wolfram.com/Circle-LineIntersection.html\n        const interA = new Vertex();\n        const interB = new Vertex();\n        // First do a transformation, because the calculation is based on a cicle at (0,0)\n        const transA = new Vertex(a).sub(this.center);\n        const transB = new Vertex(b).sub(this.center);\n        const diff = transA.difference(transB);\n        // There is a special case if diff.y=0, where the intersection is not calcuatable.\n        // Use an non-zero epsilon here to approximate this case.\n        // TODO for the future: find a better solution\n        if (Math.abs(diff.y) === 0) {\n            diff.y = 0.000001;\n        }\n        const dist = transA.distance(transB);\n        const det = transA.x * transB.y - transA.y * transB.x;\n        const distSquared = dist * dist;\n        const radiusSquared = this.radius * this.radius;\n        // Check if circle and line have an intersection at all\n        if (radiusSquared * distSquared - det * det < 0) {\n            return null;\n        }\n        const belowSqrt = this.radius * this.radius * dist * dist - det * det;\n        const sqrt = Math.sqrt(belowSqrt);\n        interA.x = (det * diff.y + Math.sign(diff.y) * diff.x * sqrt) / distSquared;\n        interB.x = (det * diff.y - Math.sign(diff.y) * diff.x * sqrt) / distSquared;\n        interA.y = (-det * diff.x + Math.abs(diff.y) * sqrt) / distSquared;\n        interB.y = (-det * diff.x - Math.abs(diff.y) * sqrt) / distSquared;\n        return new Line(interA.add(this.center), interB.add(this.center));\n        // return new Line(interA, interB);\n    }\n    /**\n     * Calculate the closest point on the outline of this circle to the given point.\n     *\n     * @method closestPoint\n     * @instance\n     * @memberof Circle\n     * @param {XYCoords} vert - The point to find the closest circle point for.\n     * @return {Vertex} The closest point on this circle.\n     **/\n    closestPoint(vert) {\n        const lineIntersection = this.lineIntersection(this.center, vert);\n        if (!lineIntersection) {\n            // Note: this case should not happen as a radial from the center always intersect this circle.\n            return new Vertex();\n        }\n        // Return closed of both\n        if (lineIntersection.a.distance(vert) < lineIntersection.b.distance(vert)) {\n            return lineIntersection.a;\n        }\n        else {\n            return lineIntersection.b;\n        }\n    }\n    /**\n     * This function should invalidate any installed listeners and invalidate this object.\n     * After calling this function the object might not hold valid data any more and\n     * should not be used.\n     */\n    destroy() {\n        this.center.destroy();\n        this.isDestroyed = true;\n    }\n} // END class\nCircle.circleUtils = {\n    vertAt: (angle, radius) => {\n        /* return new Vertex( Math.sin(angle) * radius,\n                     Math.cos(angle) * radius ); */\n        return new Vertex(Math.cos(angle) * radius, Math.sin(angle) * radius);\n    }\n};\n//# sourceMappingURL=Circle.js.map","/**\n * @author   Ikaros Kappler\n * @date     2020-12-17\n * @modified 2021-01-20 Added UID.\n * @modified 2021-02-26 Fixed an error in the svg-arc-calculation (case angle<90deg and anti-clockwise).\n * @version  1.1.1\n **/\nimport { UIDGenerator } from \"./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 **/\nexport class CircleSector {\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    constructor(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.next();\n        this.circle = circle;\n        this.startAngle = startAngle;\n        this.endAngle = endAngle;\n    }\n    /**\n     * This function should invalidate any installed listeners and invalidate this object.\n     * After calling this function the object might not hold valid data any more and\n     * should not be used.\n     */\n    destroy() {\n        this.circle.destroy();\n        this.isDestroyed = true;\n    }\n} // END class\nCircleSector.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: (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: (x, y, radius, startAngle, endAngle, options) => {\n        if (typeof options === \"undefined\")\n            options = { moveToStart: true };\n        const end = CircleSector.circleSectorUtils.polarToCartesian(x, y, radius, endAngle);\n        const 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            const firstHalf = CircleSector.circleSectorUtils.describeSVGArc(x, y, radius, startAngle, startAngle + (endAngle - startAngle) / 2, options);\n            const 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        const diff = endAngle - startAngle;\n        var largeArcFlag;\n        var sweepFlag;\n        if (diff < 0) {\n            largeArcFlag = Math.abs(diff) < Math.PI ? 1 : 0;\n            sweepFlag = 1;\n        }\n        else {\n            largeArcFlag = Math.abs(diff) > Math.PI ? 1 : 0;\n            sweepFlag = 1;\n        }\n        const 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//# sourceMappingURL=CircleSector.js.map","/**\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 * @modified 2022-02-02 Added the `destroy` method.\n * @modified 2022-02-02 Cleared the `toSVGPathData` function (deprecated). Use `drawutilssvg` instead.\n * @modified 2022-10-17 The `CubicBezierCurve` class now implements the new `PathSegment` interface.\n * @version 2.7.1\n *\n * @file CubicBezierCurve\n * @public\n **/\nimport { Bounds } from \"./Bounds\";\nimport { UIDGenerator } from \"./UIDGenerator\";\nimport { Vertex } from \"./Vertex\";\nimport { Vector } from \"./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 */\nexport class CubicBezierCurve {\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    constructor(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.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     * 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    moveCurvePoint(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     * 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    translate(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     * 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    reverse() {\n        let 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     * 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    getLength() {\n        return this.arcLength;\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    updateArcLengths() {\n        let pointA = this.startPoint.clone();\n        let pointB = new Vertex(0, 0);\n        let 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        let newLength = 0.0;\n        var t = 0.0;\n        let 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     * 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    getClosestT(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     * 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    locateIntervalByDistance(p, tStart, tEnd, stepCount) {\n        var minIndex = -1;\n        var minDist = 0;\n        var t = 0.0;\n        const 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 {\n            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     * 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    getBounds() {\n        var min = new Vertex(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY);\n        var max = new Vertex(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY);\n        let 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(min, max);\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    getStartPoint() {\n        return this.startPoint;\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    getEndPoint() {\n        return this.endPoint;\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    getStartControlPoint() {\n        return this.startControlPoint;\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    getEndControlPoint() {\n        return this.endControlPoint;\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    getPointByID(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     * 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    getPointAt(t) {\n        // Perform some powerful math magic\n        const x = this.startPoint.x * Math.pow(1.0 - t, 3) +\n            this.startControlPoint.x * 3 * t * Math.pow(1.0 - t, 2) +\n            this.endControlPoint.x * 3 * Math.pow(t, 2) * (1.0 - t) +\n            this.endPoint.x * Math.pow(t, 3);\n        const y = this.startPoint.y * Math.pow(1.0 - t, 3) +\n            this.startControlPoint.y * 3 * t * Math.pow(1.0 - t, 2) +\n            this.endControlPoint.y * 3 * Math.pow(t, 2) * (1.0 - t) +\n            this.endPoint.y * Math.pow(t, 3);\n        return new Vertex(x, y);\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    getPoint(u) {\n        return this.getPointAt(u / this.arcLength);\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    getTangentAt(t) {\n        const a = this.getStartPoint();\n        const b = this.getStartControlPoint();\n        const c = this.getEndControlPoint();\n        const d = this.getEndPoint();\n        // This is the shortened one\n        const t2 = t * t;\n        // (1 - t)^2 = (1-t)*(1-t) = 1 - t - t + t^2 = 1 - 2*t + t^2\n        const nt2 = 1 - 2 * t + t2;\n        const tX = -3 * a.x * nt2 + b.x * (3 * nt2 - 6 * (t - t2)) + c.x * (6 * (t - t2) - 3 * t2) + 3 * d.x * t2;\n        const tY = -3 * a.y * nt2 + b.y * (3 * nt2 - 6 * (t - t2)) + c.y * (6 * (t - t2) - 3 * t2) + 3 * d.y * t2;\n        // Note: my implementation does NOT normalize tangent vectors!\n        return new Vertex(tX, tY);\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    getSubCurveAt(tStart, tEnd) {\n        const startVec = new Vector(this.getPointAt(tStart), this.getTangentAt(tStart));\n        const endVec = new 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     * 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    convertU2T(u) {\n        return Math.max(0.0, Math.min(1.0, u / this.arcLength));\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    getTangent(u) {\n        return this.getTangentAt(this.convertU2T(u));\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    getPerpendicular(u) {\n        return this.getPerpendicularAt(this.convertU2T(u));\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    getPerpendicularAt(t) {\n        const tangentVector = this.getTangentAt(t);\n        return new Vertex(tangentVector.y, -tangentVector.x);\n    }\n    /**\n     * Clone this Bézier curve (deep clone).\n     *\n     * @method clone\n     * @instance\n     * @memberof CubicBezierCurve\n     * @return {CubicBezierCurve}\n     **/\n    clone() {\n        return new CubicBezierCurve(this.getStartPoint().clone(), this.getEndPoint().clone(), this.getStartControlPoint().clone(), this.getEndControlPoint().clone());\n    }\n    //---BEGIN PathSegment-------------------------\n    /**\n     * Get the tangent's end point at the start point of this segment.\n     *\n     * @method getStartTangent\n     * @memberof PathSegment\n     * @return {Vertex} The end point of the starting point's tangent.\n     */\n    getStartTangent() {\n        return this.startControlPoint;\n    }\n    /**\n     * Get the tangent's end point at the end point of this segment.\n     *\n     * @method getEndTangent\n     * @memberof PathSegment\n     * @return {Vertex} The end point of the ending point's tangent.\n     */\n    getEndTangent() {\n        return this.endControlPoint;\n    }\n    //---END PathSegment-------------------------\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    equals(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 || !curve.endPoint || !curve.startControlPoint || !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     * This function should invalidate any installed listeners and invalidate this object.\n     * After calling this function the object might not hold valid data any more and\n     * should not be used.\n     */\n    destroy() {\n        this.startPoint.destroy();\n        this.endPoint.destroy();\n        this.startControlPoint.destroy();\n        this.endControlPoint.destroy();\n        this.isDestroyed = true;\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    static isInstance(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     * 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    toJSON(prettyFormat) {\n        var jsonString = \"{ \" + // begin object\n            (prettyFormat ? \"\\n\\t\" : \"\") +\n            '\"startPoint\" : [' +\n            this.getStartPoint().x +\n            \",\" +\n            this.getStartPoint().y +\n            \"], \" +\n            (prettyFormat ? \"\\n\\t\" : \"\") +\n            '\"endPoint\" : [' +\n            this.getEndPoint().x +\n            \",\" +\n            this.getEndPoint().y +\n            \"], \" +\n            (prettyFormat ? \"\\n\\t\" : \"\") +\n            '\"startControlPoint\": [' +\n            this.getStartControlPoint().x +\n            \",\" +\n            this.getStartControlPoint().y +\n            \"], \" +\n            (prettyFormat ? \"\\n\\t\" : \"\") +\n            '\"endControlPoint\" : [' +\n            this.getEndControlPoint().x +\n            \",\" +\n            this.getEndControlPoint().y +\n            \"]\" +\n            (prettyFormat ? \"\\n\\t\" : \"\") +\n            \" }\"; // end object\n        return jsonString;\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    static fromJSON(jsonString) {\n        var obj = JSON.parse(jsonString);\n        return CubicBezierCurve.fromObject(obj);\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    static fromObject(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(obj.startPoint[0], obj.startPoint[1]), new Vertex(obj.endPoint[0], obj.endPoint[1]), new Vertex(obj.startControlPoint[0], obj.startControlPoint[1]), new Vertex(obj.endControlPoint[0], obj.endControlPoint[1]));\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    static fromArray(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} */\nCubicBezierCurve.START_POINT = 0;\n/** @constant {number} */\nCubicBezierCurve.START_CONTROL_POINT = 1;\n/** @constant {number} */\nCubicBezierCurve.END_CONTROL_POINT = 2;\n/** @constant {number} */\nCubicBezierCurve.END_POINT = 3;\n//# sourceMappingURL=CubicBezierCurve.js.map","/**\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 **/\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 */\nexport class Grid {\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    constructor(center, size) {\n        this.center = center;\n        this.size = size;\n    }\n    ;\n}\n/**\n * @memberof Grid\n **/\nGrid.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: (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: (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        }\n        return gf;\n    }\n};\n//# sourceMappingURL=Grid.js.map","/**\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 * @modified 2022-02-02 Added the `destroy` method.\n * @version  1.1.0\n *\n * @file KeyHandler\n * @public\n **/\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 */\nexport class KeyHandler {\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    constructor(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     * 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    fireEvent(event, listeners) {\n        let 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     * 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    fireDownEvent(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     * 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    firePressEvent(e, handler) {\n        handler.fireEvent(e, handler.pressListeners);\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    fireUpEvent(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     * Resolve the key/name code.\n     */\n    static key2code(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     * 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    installListeners() {\n        var _self = this;\n        this.element.addEventListener(\"keydown\", (this._keyDownListener = (e) => {\n            _self.fireDownEvent(e, _self);\n        }));\n        this.element.addEventListener(\"keypress\", (this._keyPressListener = (e) => {\n            _self.firePressEvent(e, _self);\n        }));\n        this.element.addEventListener(\"keyup\", (this._keyUpListener = (e) => {\n            _self.fireUpEvent(e, _self);\n        }));\n    }\n    /**\n     *  Remove all installed event listeners from the underlying element.\n     */\n    releaseListeners() {\n        this.element.removeEventListener(\"keydown\", this._keyDownListener);\n        this.element.removeEventListener(\"keypress\", this._keyPressListener);\n        this.element.removeEventListener(\"keyup\", this._keyUpListener);\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    down(key, listener) {\n        this.downListeners.push({ key: key, keyCode: KeyHandler.key2code(key), listener: listener });\n        return this;\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    press(key, listener) {\n        this.pressListeners.push({ key: key, keyCode: KeyHandler.key2code(key), listener: listener });\n        return this;\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    up(key, listener) {\n        this.upListeners.push({ key: key, keyCode: KeyHandler.key2code(key), listener: listener });\n        return this;\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    isDown(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     * This function should invalidate any installed listeners and invalidate this object.\n     * After calling this function the object might not hold valid data any more and\n     * should not be used any more.\n     */\n    destroy() {\n        this.releaseListeners();\n    }\n}\n/**\n * Source:\n * https://keycode.info/\n */\n// prettier-ignore\nKeyHandler.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//# sourceMappingURL=KeyHandler.js.map","/**\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 * @modified 2022-02-02 Added the `destroy` method.\n * @modified 2022-10-09 Changed the actual return value of the `intersection` function to null (was undefined before).\n * @modified 2022-10-17 Adding these methods from the `PathSegment` interface: getStartPoint, getEndPoint, revert.\n * @version  2.3.0\n *\n * @file Line\n * @public\n **/\nimport { VertTuple } from \"./VertTuple\";\nimport { Vertex } from \"./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 */\nexport class Line extends VertTuple {\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    constructor(a, b) {\n        super(a, b, (a, b) => new Line(a, b));\n        /**\n         * Required to generate proper CSS classes and other class related IDs.\n         **/\n        this.className = \"Line\";\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    intersection(line) {\n        const denominator = this.denominator(line);\n        if (denominator == 0) {\n            return null;\n        }\n        let a = this.a.y - line.a.y;\n        let b = this.a.x - line.a.x;\n        const numerator1 = (line.b.x - line.a.x) * a - (line.b.y - line.a.y) * b;\n        const 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        const x = this.a.x + a * (this.b.x - this.a.x);\n        const y = this.a.y + a * (this.b.y - this.a.y);\n        if (isNaN(a) || isNaN(x) || isNaN(y)) {\n            return null;\n        }\n        // if we cast these lines infinitely in both directions, they intersect here:\n        return new Vertex(x, y);\n    }\n    //--- Implement PathSegment ---\n    /**\n     * Get the start point of this path segment.\n     *\n     * @method getStartPoint\n     * @memberof PathSegment\n     * @return {Vertex} The start point of this path segment.\n     */\n    getStartPoint() {\n        return this.a;\n    }\n    /**\n     * Get the end point of this path segment.\n     *\n     * @method getEndPoint\n     * @memberof PathSegment\n     * @return {Vertex} The end point of this path segment.\n     */\n    getEndPoint() {\n        return this.b;\n    }\n    /**\n     * Get the tangent's end point at the start point of this segment.\n     *\n     * @method getStartTangent\n     * @memberof PathSegment\n     * @return {Vertex} The end point of the starting point's tangent.\n     */\n    getStartTangent() {\n        return this.b;\n    }\n    /**\n     * Get the tangent's end point at the end point of this segment.\n     *\n     * @method getEndTangent\n     * @memberof PathSegment\n     * @return {Vertex} The end point of the ending point's tangent.\n     */\n    getEndTangent() {\n        return this.a;\n    }\n    /**\n     * Inverse this path segment (in-place) and return this same instance (useful for chaining).\n     *\n     * @method reverse\n     * @memberof PathSegment\n     * @return {PathSegment} This path segment instance (for chaining).\n     */\n    reverse() {\n        var tmp = this.a;\n        this.a = this.b;\n        this.b = tmp;\n        return this;\n    }\n}\n//# sourceMappingURL=Line.js.map","/**\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 * @modified 2022-08-16 Fixed a bug in the mouse button detection.\n * @version  1.2.1\n *\n * @file MouseHandler\n * @public\n **/\nexport class XMouseEvent extends MouseEvent {\n}\nexport class XWheelEvent extends WheelEvent {\n}\n/**\n * @classdesc A simple mouse handler for demos.\n * Use to avoid load massive libraries like jQuery.\n *\n * @requires XYCoords\n */\nexport class MouseHandler {\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    constructor(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 = undefined;\n        this.mouseDragPos = undefined;\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        const _self = this;\n        this.handlers[\"mousemove\"] = (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\"] = (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\"] = (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\"] = (e) => {\n            if (_self.listeners.click)\n                _self.listeners.click(_self.mkParams(e, \"click\"));\n        };\n        this.handlers[\"wheel\"] = (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    relPos(e) {\n        return { x: e.offsetX, y: e.offsetY };\n    }\n    /**\n     * Build the extended event params.\n     *\n     * @name mkParams\n     * @memberof MouseHandler\n     * @instance\n     * @private\n     * @param {MouseEvent} event - The mouse event to get the relative position for.\n     * @param {string} eventName - The name of the firing event.\n     * @return {XMouseEvent}\n     */\n    mkParams(event, eventName) {\n        var _a, _b;\n        const rel = this.relPos(event);\n        const xEvent = event;\n        xEvent.params = {\n            element: this.element,\n            name: eventName,\n            isTouchEvent: false,\n            pos: rel,\n            button: event.button,\n            leftButton: event.button === 0,\n            middleButton: event.button === 1,\n            rightButton: event.button === 2,\n            mouseDownPos: (_a = this.mouseDownPos) !== null && _a !== void 0 ? _a : { x: NaN, y: NaN },\n            draggedFrom: (_b = this.mouseDragPos) !== null && _b !== void 0 ? _b : { x: NaN, y: NaN },\n            wasDragged: this.mouseDownPos != null && (this.mouseDownPos.x != rel.x || this.mouseDownPos.y != rel.y),\n            dragAmount: this.mouseDragPos != 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    listenFor(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    unlistenFor(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    drag(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     * 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    move(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     * 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    up(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     * 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    down(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     * 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    click(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     * 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    wheel(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     * 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    throwAlreadyInstalled(name) {\n        throw `This MouseHandler already has a '${name}' callback. To keep the code simple there is only room for one.`;\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    destroy() {\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}\n//# sourceMappingURL=MouseHandler.js.map","/**\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 * @modified 2022-02-02 Added the `destroy` method.\n * @modified 2022-02-02 Cleared the `PBImage.toSVGString` function (deprecated). Use `drawutilssvg` instead.\n * @version 1.2.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 **/\nimport { UIDGenerator } from \"./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 */\nexport class PBImage {\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    constructor(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.next();\n        this.image = image;\n        this.upperLeft = upperLeft;\n        this.lowerRight = lowerRight;\n    }\n    /**\n     * This function should invalidate any installed listeners and invalidate this object.\n     * After calling this function the object might not hold valid data any more and\n     * should not be used.\n     */\n    destroy() {\n        this.upperLeft.destroy();\n        this.lowerRight.destroy();\n        this.isDestroyed = true;\n    }\n}\n//# sourceMappingURL=PBImage.js.map","/**\n * @author   Ikaros Kappler\n * @date     2021-11-16\n * @modified 2022-02-02 Added the `destroy` method.\n * @version  1.1.0\n **/\nimport { UIDGenerator } from \"./UIDGenerator\";\nimport { Vertex } from \"./Vertex\";\n/**\n * @classdesc A simple text element: position, fontSize, fontFamily, color, textAlign, lineHeight and rotation.\n *\n * @requires FontOptions\n * @requires FontSize\n * @requires FontStyle\n * @requires FontWeight\n * @requires Vertex\n * @requires SVGSerializale\n * @requires UID\n * @requires UIDGenerator\n **/\nexport class PBText {\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    constructor(text, anchor, options) {\n        /**\n         * Required to generate proper CSS classes and other class related IDs.\n         **/\n        this.className = \"PBText\";\n        this.uid = UIDGenerator.next();\n        this.text = text;\n        this.anchor = anchor !== null && anchor !== void 0 ? anchor : new Vertex();\n        this.color = options.color;\n        this.fontFamily = options.fontFamily;\n        this.fontSize = options.fontSize;\n        this.fontStyle = options.fontStyle;\n        this.fontWeight = options.fontWeight;\n        this.lineHeight = options.lineHeight;\n        this.textAlign = options.textAlign;\n        this.rotation = options.rotation;\n    }\n    /**\n     * This function should invalidate any installed listeners and invalidate this object.\n     * After calling this function the object might not hold valid data any more and\n     * should not be used.\n     */\n    destroy() {\n        this.anchor.destroy();\n        this.isDestroyed = true;\n    }\n} // END class\n//# sourceMappingURL=PBText.js.map","/**\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 * @modified 2021-02-18 Adding `adjustOffset(boolean)` function.\n * @modified 2021-03-01 Updated the `PlotBoilerplate.draw(...)` function: ellipses are now rotate-able.\n * @modified 2021-03-03 Added the `VEllipseSector` drawable.\n * @modified 2021-03-29 Clearing `currentClassName` and `currentId` after drawing each drawable.\n * @modified 2021-04-25 Extending `remove` to accept arrays of drawables.\n * @modified 2021-11-16 Adding the `PBText` drawable.\n * @modified 2022-08-01 Added `title` to the params.\n * @modified 2022-10-25 Added the `origin` to the default draw config.\n * @modified 2022-11-06 Adding an XML declaration to the SVG export routine.\n * @modified 2022-11-23 Added the `drawRaster` (default=true) option to the config/drawconfig.\n * @modified 2023-02-04 Fixed a bug in the `drawDrawable` function; fill's current classname was not set.\n * @modified 2023-02-10 Fixing an issue of the `style.position` setting when `fitToParent=true` from `absolute` to `static` (default).\n * @modified 2023-02-10 Cleaning up most type errors in the main class (mostly null checks).\n * @modified 2023-02-10 Adding `enableZoom` and `enablePan` (both default true) to have the option to disable these functions.\n * @version  1.17.2\n *\n * @file PlotBoilerplate\n * @fileoverview The main class.\n * @public\n **/\nvar _a;\nimport AlloyFinger from \"alloyfinger-typescript\";\nimport { drawutils } from \"./draw\";\nimport { drawutilsgl } from \"./drawgl\";\nimport { drawutilssvg } from \"./drawutilssvg\";\nimport { BezierPath } from \"./BezierPath\";\nimport { Bounds } from \"./Bounds\";\nimport { Circle } from \"./Circle\";\nimport { CircleSector } from \"./CircleSector\";\nimport { Grid } from \"./Grid\";\nimport { KeyHandler } from \"./KeyHandler\";\nimport { Line } from \"./Line\";\nimport { MouseHandler } from \"./MouseHandler\";\nimport { PBImage } from \"./PBImage\";\nimport { Polygon } from \"./Polygon\";\nimport { Triangle } from \"./Triangle\";\nimport { VEllipse } from \"./VEllipse\";\nimport { VEllipseSector } from \"./VEllipseSector\";\nimport { Vector } from \"./Vector\";\nimport { Vertex } from \"./Vertex\";\nimport { VertexAttr } from \"./VertexAttr\";\nimport { PBText } from \"./PBText\";\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 */\nexport class PlotBoilerplate {\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.enablePan=true] - (default true) Set to false if you want to disable panning completely.\n     * @param {boolean=} [config.enableZoom=true] - (default true) Set to false if you want to disable zooming completely.\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     * @param {string=} [config.title=null] - Specify any hover tile here. It will be attached as a `title` attribute to the most elevated element.\n     */\n    constructor(config) {\n        var _a, _b;\n        /**\n         * A discrete timestamp to identify single render cycles.\n         * Note that using system time milliseconds is not a safe way to identify render frames, as on modern powerful machines\n         * multiple frames might be rendered within each millisecond.\n         * @member {number}\n         * @memberof plotboilerplate\n         * @instance\n         * @private\n         */\n        this.renderTime = 0;\n        // This should be in some static block ...\n        VertexAttr.model = {\n            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        /**\n         * A global config that's attached to the dat.gui control interface.\n         *\n         * @member {Object}\n         * @memberof PlotBoilerplate\n         * @instance\n         */\n        const 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            drawRaster: f.bool(config, \"drawRaster\", 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: () => {\n                _self.hooks.saveFile(_self);\n            },\n            setToRetina: () => {\n                _self._setToRetina();\n            },\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            enableZoom: f.bool(config, \"enableZoom\", true),\n            enablePan: f.bool(config, \"enablePan\", 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            drawRaster: f.bool(config, \"drawRaster\", true),\n            bezier: {\n                color: \"#00a822\",\n                lineWidth: 2,\n                handleLine: {\n                    color: \"rgba(180,180,180,0.5)\",\n                    lineWidth: 1\n                },\n                pathVertex: {\n                    color: \"#B400FF\",\n                    lineWidth: 1,\n                    fill: true\n                },\n                controlVertex: {\n                    color: \"#B8D438\",\n                    lineWidth: 1,\n                    fill: true\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            ellipseSector: {\n                color: \"#a822a8\",\n                lineWidth: 2\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            text: {\n                color: \"rgba(192,0,128,0.5)\",\n                lineWidth: 1,\n                fill: true,\n                anchor: true\n            },\n            origin: {\n                color: \"#000000\"\n            }\n        }; // END drawConfig\n        // +---------------------------------------------------------------------------------\n        // | Object members.\n        // +-------------------------------\n        this.grid = new Grid(new Vertex(0, 0), new Vertex(50, 50));\n        this.canvasSize = { width: PlotBoilerplate.DEFAULT_CANVAS_WIDTH, height: PlotBoilerplate.DEFAULT_CANVAS_HEIGHT };\n        const canvasElement = typeof config.canvas == \"string\" ? document.querySelector(config.canvas) : 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 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                // Override the case 'null' here. If GL is not supported, well then nothing works.\n                const ctx = this.canvas.getContext(\"webgl\"); // webgl-experimental?\n                this.draw = new 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                // Override the case 'null' here. If context creation is not supported, well then nothing works.\n                const ctx = this.canvas.getContext(\"2d\");\n                this.draw = new drawutils(ctx, false);\n                this.fill = new drawutils(ctx, true);\n            }\n        }\n        else if (canvasElement.tagName.toLowerCase() === \"svg\") {\n            if (typeof 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(this.canvas, new Vertex(), // offset\n            new 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        // At this point the event cacher element is deinfed and located at highest elevation.\n        // Set `title` attribut?\n        if (config.title) {\n            this.eventCatcher.setAttribute(\"title\", config.title);\n        }\n        this.draw.scale.set((_a = this.config.scaleX) !== null && _a !== void 0 ? _a : 1.0, this.config.scaleY);\n        this.fill.scale.set((_b = this.config.scaleX) !== null && _b !== void 0 ? _b : 1.0, 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\", () => _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\n        this.redraw();\n        // Gain focus\n        this.canvas.focus();\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    static _saveFile(pb) {\n        // Create fake SVG node\n        const svgNode = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n        // Draw everything to fake node.\n        var tosvgDraw = new 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        if (pb.config.preClear) {\n            pb.config.preClear();\n        }\n        tosvgDraw.clear(pb.config.backgroundColor || \"white\");\n        if (pb.config.preDraw) {\n            pb.config.preDraw(tosvgDraw, tosvgFill);\n        }\n        pb.drawAll(0, tosvgDraw, tosvgFill);\n        pb.drawVertices(0, tosvgDraw);\n        if (pb.config.postDraw)\n            pb.config.postDraw(tosvgDraw, tosvgFill);\n        tosvgDraw.endDrawCycle(0);\n        tosvgFill.endDrawCycle(0);\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        // Add: '<?xml version=\"1.0\" encoding=\"utf-8\"?>\\n' ?\n        var blob = new Blob(['<?xml version=\"1.0\" encoding=\"utf-8\"?>\\n' + 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     * 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    _setToRetina() {\n        this.config.autoDetectRetina = true;\n        const pixelRatio = globalThis.devicePixelRatio || 1;\n        this.config.cssScaleX = this.config.cssScaleY = 1.0 / pixelRatio;\n        this.config.canvasWidthFactor = this.config.canvasHeightFactor = pixelRatio;\n        this.resizeCanvas();\n        this.updateCSSscale();\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    fitToView(bounds) {\n        const canvasCenter = new Vertex(this.canvasSize.width / 2.0, this.canvasSize.height / 2.0);\n        const canvasRatio = this.canvasSize.width / this.canvasSize.height;\n        const ratio = bounds.width / bounds.height;\n        // Find the new draw offset\n        const center = new 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            const newUniformZoom = this.canvasSize.width / bounds.width;\n            this.setZoom(newUniformZoom, newUniformZoom, canvasCenter);\n        }\n        else {\n            const newUniformZoom = this.canvasSize.height / bounds.height;\n            this.setZoom(newUniformZoom, newUniformZoom, canvasCenter);\n        }\n        this.redraw();\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    setConsole(con) {\n        this.console = con;\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    updateCSSscale() {\n        var _a, _b, _c, _d;\n        if (this.config.cssUniformScale) {\n            PlotBoilerplate.utils.setCSSscale(this.canvas, (_a = this.config.cssScaleX) !== null && _a !== void 0 ? _a : 1.0, (_b = this.config.cssScaleX) !== null && _b !== void 0 ? _b : 1.0);\n        }\n        else {\n            PlotBoilerplate.utils.setCSSscale(this.canvas, (_c = this.config.cssScaleX) !== null && _c !== void 0 ? _c : 1.0, (_d = this.config.cssScaleY) !== null && _d !== void 0 ? _d : 1.0);\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 VEllipseSector\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    add(drawable, redraw) {\n        if (Array.isArray(drawable)) {\n            const arr = drawable;\n            for (var i = 0; i < arr.length; i++) {\n                this.add(arr[i], false);\n            }\n        }\n        else if (drawable instanceof Vertex) {\n            this.drawables.push(drawable);\n            this.vertices.push(drawable);\n        }\n        else if (drawable instanceof 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) {\n            this.drawables.push(drawable);\n            this.vertices.push(drawable.a);\n            this.vertices.push(drawable.b);\n        }\n        else if (drawable instanceof VEllipse) {\n            this.vertices.push(drawable.center);\n            this.vertices.push(drawable.axis);\n            this.drawables.push(drawable);\n            drawable.center.listeners.addDragListener((event) => {\n                drawable.axis.add(event.params.dragAmount);\n            });\n        }\n        else if (drawable instanceof VEllipseSector) {\n            this.vertices.push(drawable.ellipse.center);\n            this.vertices.push(drawable.ellipse.axis);\n            this.drawables.push(drawable);\n            drawable.ellipse.center.listeners.addDragListener((event) => {\n                drawable.ellipse.axis.add(event.params.dragAmount);\n            });\n        }\n        else if (drawable instanceof Circle) {\n            this.vertices.push(drawable.center);\n            this.drawables.push(drawable);\n        }\n        else if (drawable instanceof CircleSector) {\n            this.vertices.push(drawable.circle.center);\n            this.drawables.push(drawable);\n        }\n        else if (drawable instanceof Polygon) {\n            this.drawables.push(drawable);\n            for (var i = 0; i < drawable.vertices.length; i++) {\n                this.vertices.push(drawable.vertices[i]);\n            }\n        }\n        else if (drawable instanceof 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) {\n            this.drawables.push(drawable);\n            const 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                }\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) {\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((e) => {\n                drawable.lowerRight.add(e.params.dragAmount);\n            });\n            drawable.lowerRight.attr.selectable = false;\n        }\n        else if (drawable instanceof PBText) {\n            this.vertices.push(drawable.anchor);\n            this.drawables.push(drawable);\n            drawable.anchor.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     * 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 {Drawable|Array<Drawable>} 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    remove(drawable, redraw, removeWithVertices) {\n        if (Array.isArray(drawable)) {\n            for (var i = 0; i < drawable.length; i++) {\n                this.remove(drawable[i], false, removeWithVertices);\n            }\n            if (redraw) {\n                this.redraw();\n            }\n            return;\n        }\n        if (drawable instanceof Vertex) {\n            this.removeVertex(drawable, false);\n            if (redraw) {\n                this.redraw();\n            }\n        }\n        for (var i = 0; i < this.drawables.length; i++) {\n            if (this.drawables[i] === drawable || this.drawables[i].uid === drawable.uid) {\n                this.drawables.splice(i, 1);\n                if (removeWithVertices) {\n                    // Check if some listeners need to be removed\n                    if (drawable instanceof Line) {\n                        // Add some lines\n                        this.removeVertex(drawable.a, false);\n                        this.removeVertex(drawable.b, false);\n                    }\n                    else if (drawable instanceof Vector) {\n                        this.removeVertex(drawable.a, false);\n                        this.removeVertex(drawable.b, false);\n                    }\n                    else if (drawable instanceof VEllipse) {\n                        this.removeVertex(drawable.center, false);\n                        this.removeVertex(drawable.axis, false);\n                    }\n                    else if (drawable instanceof VEllipseSector) {\n                        this.removeVertex(drawable.ellipse.center);\n                        this.removeVertex(drawable.ellipse.axis);\n                    }\n                    else if (drawable instanceof Circle) {\n                        this.removeVertex(drawable.center, false);\n                    }\n                    else if (drawable instanceof CircleSector) {\n                        this.removeVertex(drawable.circle.center, false);\n                    }\n                    else if (drawable instanceof 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) {\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) {\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) {\n                        this.removeVertex(drawable.upperLeft, false);\n                        this.removeVertex(drawable.lowerRight, false);\n                    }\n                    else if (drawable instanceof PBText) {\n                        this.removeVertex(drawable.anchor, false);\n                    }\n                } // END removeWithVertices\n                if (redraw) {\n                    this.redraw();\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    removeVertex(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                }\n                return;\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    removeAll(keepVertices) {\n        this.drawables = [];\n        if (!Boolean(keepVertices)) {\n            this.vertices = [];\n        }\n        this.redraw();\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    getVertexNear(pixelPosition, pixelTolerance) {\n        var _a, _b;\n        const p = this.locatePointNear(this.transformMousePosition(pixelPosition.x, pixelPosition.y), pixelTolerance / Math.min((_a = this.config.cssScaleX) !== null && _a !== void 0 ? _a : 1.0, (_b = this.config.cssScaleY) !== null && _b !== void 0 ? _b : 1.0));\n        if (p && p.typeName == \"vertex\") {\n            return this.vertices[p.vindex];\n        }\n        return undefined;\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    drawGrid(draw) {\n        if (typeof draw === \"undefined\") {\n            draw = this.draw;\n        }\n        const gScale = {\n            x: (Grid.utils.mapRasterScale(this.config.rasterAdjustFactor, this.draw.scale.x) * this.config.rasterScaleX) /\n                this.config.cssScaleX,\n            y: (Grid.utils.mapRasterScale(this.config.rasterAdjustFactor, this.draw.scale.y) * this.config.rasterScaleY) /\n                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        // console.log( \"drawGrid\", gScale, gSize, cs, offset );\n        offset.x =\n            ((Math.round(offset.x + cs.width) / Math.round(gSize.width)) * gSize.width) / this.draw.scale.x +\n                (((this.draw.offset.x - cs.width) / this.draw.scale.x) % gSize.width);\n        offset.y =\n            ((Math.round(offset.y + cs.height) / Math.round(gSize.height)) * gSize.height) / this.draw.scale.y +\n                (((this.draw.offset.y - cs.height) / this.draw.scale.x) % gSize.height);\n        if (this.drawConfig.drawGrid) {\n            draw.setCurrentClassName(null);\n            if (this.config.rasterGrid) {\n                // 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     * 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    drawOrigin(draw) {\n        // Add a crosshair to mark the origin\n        draw.setCurrentId(\"origin\");\n        draw.crosshair({ x: 0, y: 0 }, 10, this.drawConfig.origin.color);\n    }\n    /**\n     * This is just a tiny helper function to determine the render color of vertices.\n     **/\n    _handleColor(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    drawDrawables(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.fill.setCurrentClassName(d.className);\n            this.drawDrawable(d, renderTime, draw, fill);\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    drawDrawable(d, renderTime, draw, fill) {\n        if (d instanceof BezierPath) {\n            var curveIndex = 0;\n            for (var c in d.bezierCurves) {\n                // Restore these settings again in each loop (will be overwritten)\n                this.draw.setCurrentId(`${d.uid}-${curveIndex}`);\n                this.fill.setCurrentId(`${d.uid}-${curveIndex}`);\n                this.draw.setCurrentClassName(d.className);\n                this.fill.setCurrentClassName(d.className);\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.visible) {\n                        const df = this.drawConfig.bezier.pathVertex.fill ? fill : draw;\n                        df.setCurrentId(`${d.uid}_h0`);\n                        df.setCurrentClassName(`${d.className}-start-handle`);\n                        if (d.bezierCurves[c].startPoint.attr.bezierAutoAdjust) {\n                            df.squareHandle(d.bezierCurves[c].startPoint, 5, this._handleColor(d.bezierCurves[c].startPoint, this.drawConfig.bezier.pathVertex.color));\n                        }\n                        else {\n                            df.diamondHandle(d.bezierCurves[c].startPoint, 7, this._handleColor(d.bezierCurves[c].startPoint, this.drawConfig.bezier.pathVertex.color));\n                        }\n                    }\n                    d.bezierCurves[c].startPoint.attr.renderTime = renderTime;\n                    if (d.bezierCurves[c].endPoint.attr.visible) {\n                        const df = this.drawConfig.bezier.pathVertex.fill ? fill : draw;\n                        df.setCurrentId(`${d.uid}_h0`);\n                        df.setCurrentClassName(`${d.className}-start-handle`);\n                        if (d.bezierCurves[c].endPoint.attr.bezierAutoAdjust) {\n                            df.squareHandle(d.bezierCurves[c].endPoint, 5, this._handleColor(d.bezierCurves[c].endPoint, this.drawConfig.bezier.pathVertex.color));\n                        }\n                        else {\n                            df.diamondHandle(d.bezierCurves[c].endPoint, 7, this._handleColor(d.bezierCurves[c].endPoint, this.drawConfig.bezier.pathVertex.color));\n                        }\n                    }\n                    if (d.bezierCurves[c].startControlPoint.attr.visible) {\n                        const df = this.drawConfig.bezier.controlVertex.fill ? fill : draw;\n                        df.setCurrentId(`${d.uid}_h2`);\n                        df.setCurrentClassName(`${d.className}-start-control-handle`);\n                        df.circleHandle(d.bezierCurves[c].startControlPoint, 3, this._handleColor(d.bezierCurves[c].startControlPoint, this.drawConfig.bezier.controlVertex.color));\n                    }\n                    if (d.bezierCurves[c].endControlPoint.attr.visible) {\n                        const df = this.drawConfig.bezier.controlVertex.fill ? fill : draw;\n                        df.setCurrentId(`${d.uid}_h3`);\n                        df.setCurrentClassName(`${d.className}-end-control-handle`);\n                        df.circleHandle(d.bezierCurves[c].endControlPoint, 3, this._handleColor(d.bezierCurves[c].endControlPoint, this.drawConfig.bezier.controlVertex.color));\n                    }\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                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                curveIndex++;\n            } // END for\n        }\n        else if (d instanceof 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) {\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) {\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.line(d.center.clone().add(0, d.signedRadiusV()).rotate(d.rotation, d.center), 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                draw.line(d.center.clone().add(d.signedRadiusH(), 0).rotate(d.rotation, d.center), d.axis, \"#c8c8c8\");\n            }\n            draw.setCurrentId(d.uid);\n            draw.setCurrentClassName(`${d.className}`);\n            draw.ellipse(d.center, \n            // Math.abs(d.axis.x-d.center.x), Math.abs(d.axis.y-d.center.y),\n            d.radiusH(), d.radiusV(), this.drawConfig.ellipse.color, this.drawConfig.ellipse.lineWidth, d.rotation);\n            if (!this.drawConfig.drawHandlePoints) {\n                d.center.attr.renderTime = renderTime;\n                d.axis.attr.renderTime = renderTime;\n            }\n        }\n        else if (d instanceof VEllipseSector) {\n            draw.setCurrentId(d.uid);\n            draw.setCurrentClassName(`${d.className}`);\n            /* draw.ellipse( d.center,\n                    // Math.abs(d.axis.x-d.center.x), Math.abs(d.axis.y-d.center.y),\n                    d.radiusH(), d.radiusV(),\n                    this.drawConfig.ellipse.color,\n                    this.drawConfig.ellipse.lineWidth,\n                    d.rotation ); */\n            const data = VEllipseSector.ellipseSectorUtils.describeSVGArc(d.ellipse.center.x, d.ellipse.center.y, d.ellipse.radiusH(), d.ellipse.radiusV(), d.startAngle, d.endAngle, d.ellipse.rotation, { moveToStart: true });\n            draw.path(data, this.drawConfig.ellipseSector.color, this.drawConfig.ellipseSector.lineWidth);\n        }\n        else if (d instanceof Circle) {\n            draw.circle(d.center, d.radius, this.drawConfig.circle.color, this.drawConfig.circle.lineWidth);\n        }\n        else if (d instanceof 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) {\n            if (this.drawConfig.drawVertices && (!d.attr.selectable || !d.attr.draggable) && d.attr.visible) {\n                // Draw as special point (grey)\n                draw.circleHandle(d, 7, this.drawConfig.vertex.color);\n                d.attr.renderTime = renderTime;\n            }\n        }\n        else if (d instanceof 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) {\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) {\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 if (d instanceof PBText) {\n            fill.setCurrentId(d.uid);\n            fill.text(d.text, d.anchor.x, d.anchor.y, d);\n            if (this.drawConfig.text.anchor) {\n                draw.setCurrentId(`${d.uid}_a0`);\n                draw.setCurrentClassName(`${d.className}-anchor`);\n                (this.drawConfig.text.fill ? fill : draw).point(d.anchor, this.drawConfig.text.color);\n            }\n            d.anchor.attr.renderTime = renderTime;\n        }\n        else {\n            console.error(\"Cannot draw object. Unknown class.\");\n        }\n        draw.setCurrentClassName(null);\n        draw.setCurrentId(null);\n        fill.setCurrentClassName(null);\n        fill.setCurrentId(null);\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    drawSelectPolygon(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     * 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    drawVertices(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 && this.vertices[i].attr.renderTime != renderTime && 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                this.vertices[i].attr.renderTime = renderTime;\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    redraw() {\n        const renderTime = this.renderTime++;\n        // Tell the drawing library that a new drawing cycle begins (required for the GL lib).\n        this.draw.beginDrawCycle(renderTime);\n        this.fill.beginDrawCycle(renderTime);\n        if (this.config.preClear)\n            this.config.preClear();\n        this.clear();\n        if (this.config.preDraw)\n            this.config.preDraw(this.draw, this.fill);\n        this.drawAll(renderTime, this.draw, this.fill);\n        if (this.config.postDraw)\n            this.config.postDraw(this.draw, this.fill);\n        this.draw.endDrawCycle(renderTime);\n        this.fill.endDrawCycle(renderTime);\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    drawAll(renderTime, draw, fill) {\n        if (this.config.drawRaster) {\n            this.drawGrid(draw);\n        }\n        if (this.config.drawOrigin) {\n            this.drawOrigin(draw);\n        }\n        this.drawDrawables(renderTime, draw, fill);\n        this.drawVertices(renderTime, draw);\n        this.drawSelectPolygon(draw);\n        // Clear IDs and classnames (postDraw hook might draw somthing and the do not want\n        // to interfered with that).\n        draw.setCurrentId(null);\n        draw.setCurrentClassName(null);\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    clear() {\n        // Note that elements might have an alpha channel. Clear the scene first.\n        this.draw.clear(this.config.backgroundColor || \"white\");\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    clearSelection(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     * Get the current view port.\n     *\n     * @method viewport\n     * @instance\n     * @memberof PlotBoilerplate\n     * @return {Bounds} The current viewport.\n     **/\n    viewport() {\n        var _a, _b;\n        return new Bounds(this.transformMousePosition(0, 0), this.transformMousePosition(this.canvasSize.width * ((_a = this.config.cssScaleX) !== null && _a !== void 0 ? _a : 1.0), this.canvasSize.height * ((_b = this.config.cssScaleY) !== null && _b !== void 0 ? _b : 1.0)));\n    }\n    /**\n     * Trigger the saveFile.hook.\n     *\n     * @method saveFile\n     * @instance\n     * @memberof PlotBoilerplate\n     * @return {void}\n     **/\n    saveFile() {\n        this.hooks.saveFile(this);\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    // TODO: this was moved to the DOM utils\n    getFProp(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    // TODO: this was moved to the DOM utils\n    getAvailableContainerSpace() {\n        const _self = this;\n        const container = _self.canvas.parentNode; // Element | Document | DocumentFragment;\n        _self.canvas.style.display = \"none\";\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     * 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    resizeCanvas() {\n        var _a, _b, _c, _d, _e, _f;\n        const _self = this;\n        const _setSize = (w, h) => {\n            var _a, _b;\n            w *= (_a = _self.config.canvasWidthFactor) !== null && _a !== void 0 ? _a : 1.0;\n            h *= (_b = _self.config.canvasHeightFactor) !== null && _b !== void 0 ? _b : 1.0;\n            _self.canvasSize.width = w;\n            _self.canvasSize.height = h;\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                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                _self.adjustOffset(false);\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 = ((_a = _self.config.canvasWidthFactor) !== null && _a !== void 0 ? _a : 1.0) * width + \"px\";\n            _self.canvas.style.height = ((_b = _self.config.canvasWidthFactor) !== null && _b !== void 0 ? _b : 1.0) * 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 = \"static\";\n            const space = this.getAvailableContainerSpace();\n            _self.canvas.style.width = ((_c = _self.config.canvasWidthFactor) !== null && _c !== void 0 ? _c : 1.0) * space.width + \"px\";\n            _self.canvas.style.height = ((_d = _self.config.canvasHeightFactor) !== null && _d !== void 0 ? _d : 1.0) * space.height + \"px\";\n            _self.canvas.style.top = \"\";\n            _self.canvas.style.left = \"\";\n            _setSize(space.width, space.height);\n        }\n        else {\n            _self.canvas.style.width = \"\";\n            _self.canvas.style.height = \"\";\n            _setSize((_e = _self.config.defaultCanvasWidth) !== null && _e !== void 0 ? _e : 1024, (_f = _self.config.defaultCanvasHeight) !== null && _f !== void 0 ? _f : 768);\n        }\n        if (_self.config.redrawOnResize)\n            _self.redraw();\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    selectVerticesInPolygon(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     * (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    locatePointNear(point, tolerance) {\n        const _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 = 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    handleClick(e) {\n        const _self = this;\n        var point = this.locatePointNear(_self.transformMousePosition(e.params.pos.x, e.params.pos.y), PlotBoilerplate.DEFAULT_CLICK_TOLERANCE / Math.min(_self.config.cssScaleX || 1.0, _self.config.cssScaleY || 1.0));\n        if (point) {\n            _self.vertices[point.vindex].listeners.fireClickEvent(e);\n            if (this.keyHandler && this.keyHandler.isDown(\"shift\")) {\n                if (point.typeName == \"bpath\") {\n                    let vert = _self.paths[point.pindex].bezierCurves[point.cindex].getPointByID(point.pid);\n                    if (vert.attr.selectable)\n                        vert.attr.isSelected = !vert.attr.isSelected;\n                }\n                else if (point.typeName == \"vertex\") {\n                    let vert = _self.vertices[point.vindex];\n                    if (vert.attr.selectable)\n                        vert.attr.isSelected = !vert.attr.isSelected;\n                }\n                _self.redraw();\n            }\n            else if (this.keyHandler && this.keyHandler.isDown(\"y\")) {\n                _self.vertices[point.vindex].attr.bezierAutoAdjust = !_self.vertices[point.vindex].attr.bezierAutoAdjust;\n                _self.redraw();\n            }\n        }\n        else if (_self.selectPolygon != null) {\n            const vert = _self.transformMousePosition(e.params.pos.x, e.params.pos.y);\n            _self.selectPolygon.vertices.push(new 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    transformMousePosition(x, y) {\n        return {\n            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    revertMousePosition(x, y) {\n        return { x: x / this.config.cssScaleX + this.config.offsetX, y: y / this.config.cssScaleY + this.config.offsetY };\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    getDraggedElementCount() {\n        return this.draggedElements.length;\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    mouseDownHandler(e) {\n        const _self = this;\n        if (e.button != 0)\n            return; // Only react on left mouse or touch events\n        var draggablePoint = _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 (!draggablePoint)\n            return;\n        // Drag all selected elements?\n        if (draggablePoint.typeName == \"vertex\" && _self.vertices[draggablePoint.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[draggablePoint.vindex].attr.draggable)\n                return;\n            _self.draggedElements.push(draggablePoint);\n            if (draggablePoint.typeName == \"bpath\")\n                _self.paths[draggablePoint.pindex].bezierCurves[draggablePoint.cindex]\n                    .getPointByID(draggablePoint.pid)\n                    .listeners.fireDragStartEvent(e);\n            else if (draggablePoint.typeName == \"vertex\")\n                _self.vertices[draggablePoint.vindex].listeners.fireDragStartEvent(e);\n        }\n        _self.redraw();\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    mouseDragHandler(e) {\n        const _self = this;\n        const 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 && (this.keyHandler.isDown(\"alt\") || this.keyHandler.isDown(\"spacebar\"))) {\n            if (!this.config.enablePan) {\n                return;\n            }\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(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     * 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    mouseUpHandler(e) {\n        const _self = this;\n        if (e.button != 0)\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     * 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    mouseWheelHandler(e) {\n        if (!this.config.enableZoom) {\n            return;\n        }\n        var zoomStep = 1.25; // Make configurable?\n        // CHANGED replaced _self by this\n        const _self = this;\n        const we = e;\n        if (we.deltaY < 0) {\n            _self.setZoom(_self.config.scaleX * zoomStep, _self.config.scaleY * zoomStep, new 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(e.params.pos.x, e.params.pos.y));\n        }\n        e.preventDefault();\n        _self.redraw();\n    }\n    /**\n     * Re-adjust the configured offset depending on the current canvas size and zoom (scaleX and scaleY).\n     *\n     * @method adjustOffset\n     * @param {boolean=false} redraw - [optional] If set the canvas will redraw with the new offset (default=false).\n     * @return {void}\n     **/\n    adjustOffset(redraw) {\n        this.draw.offset.x =\n            this.fill.offset.x =\n                this.config.offsetX =\n                    this.canvasSize.width * (this.config.offsetAdjustXPercent / 100);\n        this.draw.offset.y =\n            this.fill.offset.y =\n                this.config.offsetY =\n                    this.canvasSize.height * (this.config.offsetAdjustYPercent / 100);\n        if (redraw) {\n            this.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    setOffset(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     * 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    setZoom(zoomFactorX, zoomFactorY, interactionPos) {\n        let 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        let newPos = this.transformMousePosition(interactionPos.x, interactionPos.y);\n        let newOffsetX = this.draw.offset.x + (newPos.x - oldPos.x) * this.draw.scale.x;\n        let newOffsetY = this.draw.offset.y + (newPos.y - oldPos.y) * this.draw.scale.y;\n        this.setOffset({ x: newOffsetX, y: newOffsetY });\n    }\n    installInputListeners() {\n        var _self = this;\n        if (this.config.enableMouse) {\n            // Install a mouse handler on the canvas.\n            new MouseHandler(this.eventCatcher ? this.eventCatcher : this.canvas)\n                .down((e) => {\n                _self.mouseDownHandler(e);\n            })\n                .drag((e) => {\n                _self.mouseDragHandler(e);\n            })\n                .up((e) => {\n                _self.mouseUpHandler(e);\n            });\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(this.eventCatcher ? this.eventCatcher : this.canvas).wheel((e) => {\n                _self.mouseWheelHandler(e);\n            });\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            const relPos = (pos) => {\n                const bounds = _self.canvas.getBoundingClientRect();\n                return { x: pos.x - bounds.left, y: pos.y - bounds.top };\n            };\n            // Make PB work together with both, AlloyFinger as a esm module or a commonjs function.\n            if (typeof globalThis[\"AlloyFinger\"] === \"function\" || typeof globalThis[\"createAlloyFinger\"] === \"function\") {\n                try {\n                    var touchMovePos = null;\n                    var touchDownPos = null;\n                    var draggedElement = null;\n                    var multiTouchStartScale = null;\n                    const clearTouch = () => {\n                        touchMovePos = null;\n                        touchDownPos = null;\n                        draggedElement = null;\n                        multiTouchStartScale = null;\n                        _self.draggedElements = [];\n                    };\n                    const afProps = {\n                        // touchStart: (evt: TouchEvent) => {\n                        touchStart: (evt) => {\n                            if (evt.touches.length == 1) {\n                                touchMovePos = new Vertex(relPos({ x: evt.touches[0].clientX, y: evt.touches[0].clientY }));\n                                touchDownPos = new Vertex(relPos({ 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 = {\n                                        params: {\n                                            isTouchEvent: true,\n                                            dragAmount: { x: 0, y: 0 },\n                                            wasDragged: false,\n                                            mouseDownPos: touchDownPos.clone(),\n                                            mouseDragPos: touchDownPos.clone(),\n                                            vertex: draggingVertex\n                                        }\n                                    };\n                                    _self.draggedElements = [draggedElement];\n                                    draggingVertex.listeners.fireDragStartEvent(fakeEvent);\n                                }\n                            }\n                        },\n                        touchMove: (evt) => {\n                            if (evt.touches.length == 1 && draggedElement) {\n                                evt.preventDefault();\n                                evt.stopPropagation();\n                                if (!touchDownPos || !touchMovePos) {\n                                    return;\n                                }\n                                var rel = relPos({ x: evt.touches[0].clientX, y: evt.touches[0].clientY });\n                                var trans = _self.transformMousePosition(rel.x, rel.y);\n                                var diff = new 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 = {\n                                        isTouchEvent: true,\n                                        params: {\n                                            dragAmount: diff.clone(),\n                                            wasDragged: true,\n                                            mouseDownPos: touchDownPos.clone(),\n                                            mouseDragPos: touchDownPos.clone().add(diff),\n                                            vertex: draggingVertex\n                                        }\n                                    };\n                                    draggingVertex.listeners.fireDragEvent(fakeEvent);\n                                    _self.redraw();\n                                }\n                                touchMovePos = new Vertex(rel);\n                            }\n                            else if (evt.touches.length == 2) {\n                                if (!this.config.enablePan) {\n                                    return;\n                                }\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\n                                    .clone()\n                                    .addXY(evt.deltaX, evt.deltaY)); // Apply zoom?\n                                _self.redraw();\n                            }\n                        },\n                        touchEnd: (evt) => {\n                            // Note: e.touches.length is 0 here\n                            if (draggedElement && draggedElement.typeName == \"vertex\") {\n                                if (!touchDownPos) {\n                                    return;\n                                }\n                                var draggingVertex = _self.vertices[draggedElement.vindex];\n                                var fakeEvent = {\n                                    isTouchEvent: true,\n                                    params: {\n                                        dragAmount: { x: 0, y: 0 },\n                                        wasDragged: false,\n                                        mouseDownPos: touchDownPos.clone(),\n                                        mouseDragPos: touchDownPos.clone(),\n                                        vertex: draggingVertex\n                                    }\n                                };\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();\n                        },\n                        touchCancel: (evt) => {\n                            clearTouch();\n                        },\n                        multipointStart: (evt) => {\n                            multiTouchStartScale = _self.draw.scale.clone();\n                        },\n                        multipointEnd: (evt) => {\n                            multiTouchStartScale = null;\n                        },\n                        pinch: (evt) => {\n                            if (!this.config.enableZoom) {\n                                return;\n                            }\n                            const touchItem0 = evt.touches.item(0);\n                            const touchItem1 = evt.touches.item(1);\n                            if (!evt.touches || !multiTouchStartScale || !touchItem0 || !touchItem1) {\n                                return;\n                            }\n                            // For pinching there must be at least two touch items\n                            const fingerA = new Vertex(touchItem0.clientX, touchItem0.clientY);\n                            const fingerB = new Vertex(touchItem1.clientX, touchItem1.clientY);\n                            const center = new Line(fingerA, fingerB).vertAt(0.5);\n                            _self.setZoom(multiTouchStartScale.x * evt.zoom, multiTouchStartScale.y * evt.zoom, center);\n                            _self.redraw();\n                        }\n                    }; // END afProps\n                    if (window[\"createAlloyFinger\"]) {\n                        window[\"createAlloyFinger\"](this.eventCatcher ? this.eventCatcher : this.canvas, afProps);\n                    }\n                    else {\n                        /* tslint:disable-next-line */\n                        new AlloyFinger(this.eventCatcher ? this.eventCatcher : this.canvas, afProps);\n                    }\n                }\n                catch (e) {\n                    console.error(\"Failed to initialize AlloyFinger!\");\n                    console.error(e);\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({ trackAll: true })\n                .down(\"escape\", function () {\n                _self.clearSelection(true);\n            })\n                .down(\"shift\", function () {\n                _self.selectPolygon = new 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    createGUI(props) {\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, props);\n        else\n            throw \"Cannot create dat.GUI instance; did you load the ./utils/creategui helper function an the dat.GUI library?\";\n    }\n} // END class PlotBoilerplate\n/** @constant {number} */\nPlotBoilerplate.DEFAULT_CANVAS_WIDTH = 1024;\n/** @constant {number} */\nPlotBoilerplate.DEFAULT_CANVAS_HEIGHT = 768;\n/** @constant {number} */\nPlotBoilerplate.DEFAULT_CLICK_TOLERANCE = 8;\n/** @constant {number} */\nPlotBoilerplate.DEFAULT_TOUCH_TOLERANCE = 32;\n/**\n * A wrapper class for draggable items (mostly vertices).\n * @private\n **/\nPlotBoilerplate.Draggable = (_a = class {\n        constructor(item, typeName) {\n            this.item = item;\n            this.typeName = typeName;\n        }\n        isVertex() {\n            return this.typeName == PlotBoilerplate.Draggable.VERTEX;\n        }\n        setVIndex(vindex) {\n            this.vindex = vindex;\n            return this;\n        }\n    },\n    _a.VERTEX = \"vertex\",\n    _a);\n/**\n * A set of helper functions.\n **/\nPlotBoilerplate.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: (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: (element, scaleX, scaleY) => {\n        element.style[\"transform-origin\"] = \"0 0\";\n        if (scaleX == 1.0 && scaleY == 1.0) {\n            // element.style.transform = null;\n            element.style.removeProperty(\"transform\");\n        }\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: (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: (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: (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: (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: (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) {\n                // && !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({ x: e.params.dragAmount.x, y: e.params.dragAmount.y }));\n                    }\n                    bezierPath.updateArcLengths();\n                });\n            }\n        } // END for\n    }\n}; // END utils\nexport default PlotBoilerplate;\n//# sourceMappingURL=PlotBoilerplate.js.map","/**\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 * @modified 2021-12-14 Added the `perimeter()` function.\n * @modified 2021-12-16 Added the `getEvenDistributionPolygon()` function.\n * @modified 2022-02-02 Added the `destroy` method.\n * @modified 2022-02-02 Cleared the `Polygon.toSVGString` function (deprecated). Use `drawutilssvg` instead.\n * @modified 2022-03-08 Added the `Polygon.clone()` function.\n * @version 1.10.0\n *\n * @file Polygon\n * @public\n **/\nimport { BezierPath } from \"./BezierPath\";\nimport { Bounds } from \"./Bounds\";\nimport { UIDGenerator } from \"./UIDGenerator\";\nimport { Vertex } from \"./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 */\nexport class Polygon {\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    constructor(vertices, isOpen) {\n        /**\n         * Required to generate proper CSS classes and other class related IDs.\n         **/\n        this.className = \"Polygon\";\n        this.uid = UIDGenerator.next();\n        if (typeof vertices == \"undefined\")\n            vertices = [];\n        this.vertices = vertices;\n        this.isOpen = isOpen || false;\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    addVertex(vert) {\n        this.vertices.push(vert);\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    getVertexAt(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     * 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    move(amount) {\n        for (var i in this.vertices) {\n            this.vertices[i].add(amount);\n        }\n        return this;\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    containsVert(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            let xi = this.vertices[i].x, yi = this.vertices[i].y;\n            let xj = this.vertices[j].x, yj = this.vertices[j].y;\n            var intersect = yi > vert.y != yj > vert.y && vert.x < ((xj - xi) * (vert.y - yi)) / (yj - yi) + xi;\n            if (intersect)\n                inside = !inside;\n        }\n        return inside;\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    area() {\n        return Polygon.utils.area(this.vertices);\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    signedArea() {\n        return Polygon.utils.signedArea(this.vertices);\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    isClockwise() {\n        return Polygon.utils.signedArea(this.vertices) < 0;\n    }\n    /**\n     * Get the perimeter of this polygon.\n     * The perimeter is the absolute length of the outline.\n     *\n     * If this polygon is open then the last segment (connecting the first and the\n     * last vertex) will be skipped.\n     *\n     * @method perimeter\n     * @instance\n     * @memberof Polygon\n     * @return {number}\n     */\n    perimeter() {\n        let length = 0;\n        for (var i = 1; i < this.vertices.length; i++) {\n            length += this.vertices[i - 1].distance(this.vertices[i]);\n        }\n        if (!this.isOpen && this.vertices.length > 1) {\n            length += this.vertices[0].distance(this.vertices[this.vertices.length - 1]);\n        }\n        return length;\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    scale(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     * 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    rotate(angle, center) {\n        for (var i in this.vertices) {\n            this.vertices[i].rotate(angle, center);\n        }\n        return this;\n    }\n    /**\n     * Convert this polygon into a new polygon with n evenly distributed vertices.\n     *\n     * @param {number} pointCount - Must not be negative.\n     */\n    getEvenDistributionPolygon(pointCount) {\n        if (pointCount <= 0) {\n            throw new Error(\"pointCount must be larger than zero; is \" + pointCount + \".\");\n        }\n        const result = new Polygon([], this.isOpen);\n        if (this.vertices.length === 0) {\n            return result;\n        }\n        // Fetch and add the start point from the source polygon\n        let polygonPoint = new Vertex(this.vertices[0]);\n        result.vertices.push(polygonPoint);\n        if (this.vertices.length === 1) {\n            return result;\n        }\n        const perimeter = this.perimeter();\n        const stepSize = perimeter / pointCount;\n        const n = this.vertices.length;\n        let polygonIndex = 1;\n        let nextPolygonPoint = new Vertex(this.vertices[1]);\n        let segmentLength = polygonPoint.distance(nextPolygonPoint);\n        let loopMax = this.isOpen ? n : n + 1;\n        let curSegmentU = stepSize;\n        var i = 1;\n        while (i < pointCount && polygonIndex < loopMax) {\n            // Check if next eq point is inside this segment\n            if (curSegmentU < segmentLength) {\n                let newPoint = polygonPoint.clone().lerpAbs(nextPolygonPoint, curSegmentU);\n                result.vertices.push(newPoint);\n                curSegmentU += stepSize;\n                i++;\n            }\n            else {\n                polygonIndex++;\n                polygonPoint = nextPolygonPoint;\n                nextPolygonPoint = new Vertex(this.vertices[polygonIndex % n]);\n                curSegmentU = curSegmentU - segmentLength;\n                segmentLength = polygonPoint.distance(nextPolygonPoint);\n            }\n        }\n        return result;\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    getBounds() {\n        return Bounds.computeFromVertices(this.vertices);\n    }\n    /**\n     * Create a deep copy of this polygon.\n     *\n     * @return {Polygon} The cloned polygon.\n     */\n    clone() {\n        return new Polygon(this.vertices.map(vert => vert.clone()), this.isOpen);\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    toQuadraticBezierData() {\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(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(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     * 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    toQuadraticBezierSVGString() {\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     * 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    toCubicBezierData(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(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(a.x + (b.x - a.x) / 2, a.y + (b.y - a.y) / 2);\n            var bCenter = new Vertex(b.x + (c.x - b.x) / 2, b.y + (c.y - b.y) / 2);\n            var a2 = new Vertex(aCenter.x + (b.x - aCenter.x) * threshold, aCenter.y + (b.y - aCenter.y) * threshold);\n            var b0 = new 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     * 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    toCubicBezierSVGString(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 \" +\n                qdata[i].x +\n                \" \" +\n                qdata[i].y +\n                \", \" +\n                qdata[i + 1].x +\n                \" \" +\n                qdata[i + 1].y +\n                \", \" +\n                qdata[i + 2].x +\n                \" \" +\n                qdata[i + 2].y);\n        }\n        return buffer.join(\" \");\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    toCubicBezierPath(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.fromArray(pathdata);\n    }\n    /**\n     * This function should invalidate any installed listeners and invalidate this object.\n     * After calling this function the object might not hold valid data any more and\n     * should not be used.\n     */\n    destroy() {\n        for (var i = 0; i < this.vertices.length; i++) {\n            this.vertices[i].destroy();\n        }\n        this.isDestroyed = true;\n    }\n}\nPolygon.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(vertices) {\n        // Found at:\n        //    https://stackoverflow.com/questions/16285134/calculating-polygon-area\n        let total = 0.0;\n        for (var i = 0, l = vertices.length; i < l; i++) {\n            const addX = vertices[i].x;\n            const addY = vertices[(i + 1) % l].y;\n            const subX = vertices[(i + 1) % l].x;\n            const 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(vertices) {\n        let sum = 0;\n        const n = vertices.length;\n        for (var i = 0; i < n; i++) {\n            const 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//# sourceMappingURL=Polygon.js.map","/**\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 * @modified  2022-02-02 Added the `destroy` method.\n * @modified  2022-02-02 Cleared the `Triangle.toSVGString` function (deprecated). Use `drawutilssvg` instead.\n * @version   2.6.0\n *\n * @file Triangle\n * @fileoverview A simple triangle class: three vertices.\n * @public\n **/\nimport { Bounds } from \"./Bounds\";\nimport { Circle } from \"./Circle\";\nimport { Line } from \"./Line\";\nimport { Polygon } from \"./Polygon\";\nimport { UIDGenerator } from \"./UIDGenerator\";\nimport { Vertex } from \"./Vertex\";\nimport { geomutils } from \"./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 */\nexport class Triangle {\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    constructor(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.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    static fromArray(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     * 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    getArea() {\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     * 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    getCentroid() {\n        return new Vertex((this.a.x + this.b.x + this.c.x) / 3, (this.a.y + this.b.y + this.c.y) / 3);\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    scaleToCentroid(factor) {\n        let 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     * 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    getCircumcircle() {\n        // if( !this.center || !this.radius )\n        this.calcCircumcircle();\n        return new Circle(this.center.clone(), this.radius);\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    isAdjacent(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     * 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    getThirdVertex(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     * 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    calcCircumcircle() {\n        // From\n        //    http://www.exaflop.org/docs/cgafaq/cga1.html\n        const A = this.b.x - this.a.x;\n        const B = this.b.y - this.a.y;\n        const C = this.c.x - this.a.x;\n        const D = this.c.y - this.a.y;\n        const E = A * (this.a.x + this.b.x) + B * (this.a.y + this.b.y);\n        const F = C * (this.a.x + this.c.x) + D * (this.a.y + this.c.y);\n        const G = 2.0 * (A * (this.c.y - this.b.y) - B * (this.c.x - this.b.x));\n        let dx, dy;\n        if (Math.abs(G) < Triangle.EPSILON) {\n            // Collinear - find extremes and use the midpoint\n            const bounds = this.bounds();\n            this.center = new 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            const cx = (D * E - B * F) / G;\n            const cy = (A * F - C * E) / G;\n            this.center = new 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    } // 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    inCircumcircle(v) {\n        const dx = this.center.x - v.x;\n        const dy = this.center.y - v.y;\n        const dist_squared = dx * dx + dy * dy;\n        return dist_squared <= this.radius_squared;\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    bounds() {\n        return new Bounds(new 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(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     * 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    toPolygon() {\n        return new Polygon([this.a, this.b, this.c]);\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    determinant() {\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     * 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    containsPoint(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     * 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    getIncircularTriangle() {\n        const lineA = new Line(this.a, this.b);\n        const lineB = new Line(this.b, this.c);\n        const lineC = new Line(this.c, this.a);\n        const bisector1 = geomutils.nsectAngle(this.b, this.a, this.c, 2)[0]; // bisector of first angle (in b)\n        const bisector2 = geomutils.nsectAngle(this.c, this.b, this.a, 2)[0]; // bisector of second angle (in c)\n        // Cast to non-null here because we know there _is_ an intersection\n        const intersection = bisector1.intersection(bisector2);\n        // Find the closest points on one of the polygon lines (all have same distance by construction)\n        const circleIntersA = lineA.getClosestPoint(intersection);\n        const circleIntersB = lineB.getClosestPoint(intersection);\n        const circleIntersC = lineC.getClosestPoint(intersection);\n        return new Triangle(circleIntersA, circleIntersB, circleIntersC);\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    getIncircle() {\n        return this.getIncircularTriangle().getCircumcircle();\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    getIncenter() {\n        if (!this.center || !this.radius)\n            this.calcCircumcircle();\n        return this.center.clone();\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    toString() {\n        return \"{ a : \" + this.a.toString() + \", b : \" + this.b.toString() + \", c : \" + this.c.toString() + \"}\";\n    }\n    /**\n     * This function should invalidate any installed listeners and invalidate this object.\n     * After calling this function the object might not hold valid data any more and\n     * should not be used.\n     */\n    destroy() {\n        this.a.destroy();\n        this.b.destroy();\n        this.c.destroy();\n        this.isDestroyed = true;\n    }\n}\n/**\n * An epsilon for comparison.\n * This should be the same epsilon as in Vertex.\n *\n * @private\n **/\nTriangle.EPSILON = 1.0e-6;\nTriangle.utils = {\n    // Used in the bounds() function.\n    max3(a, b, c) {\n        return a >= b && a >= c ? a : b >= a && b >= c ? b : c;\n    },\n    min3(a, b, c) {\n        return a <= b && a <= c ? a : b <= a && b <= c ? b : c;\n    },\n    signedArea(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(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//# sourceMappingURL=Triangle.js.map","/**\n * @classdesc A static UIDGenerator.\n *\n * @author  Ikaros Kappler\n * @date    2021-01-20\n * @version 1.0.0\n */\nexport class UIDGenerator {\n    static next() {\n        return `${UIDGenerator.current++}`;\n    }\n}\nUIDGenerator.current = 0;\n//# sourceMappingURL=UIDGenerator.js.map","/**\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 * @modified 2021-02-14 Added functions `radiusH` and `radiusV`.\n * @modified 2021-02-26 Added helper function `decribeSVGArc(...)`.\n * @modified 2021-03-01 Added attribute `rotation` to allow rotation of ellipses.\n * @modified 2021-03-03 Added the `vertAt` and `perimeter` methods.\n * @modified 2021-03-05 Added the `getFoci`, `normalAt` and `tangentAt` methods.\n * @modified 2021-03-09 Added the `clone` and `rotate` methods.\n * @modified 2021-03-10 Added the `toCubicBezier` method.\n * @modified 2021-03-15 Added `VEllipse.quarterSegmentCount` and `VEllipse.scale` functions.\n * @modified 2021-03-19 Added the `VEllipse.rotate` function.\n * @modified 2022-02-02 Added the `destroy` method.\n * @modified 2022-02-02 Cleared the `VEllipse.toSVGString` function (deprecated). Use `drawutilssvg` instead.\n * @version  1.3.0\n *\n * @file VEllipse\n * @fileoverview Ellipses with a center and an x- and a y-axis (stored as a vertex).\n **/\nimport { Line } from \"./Line\";\nimport { Vector } from \"./Vector\";\nimport { Vertex } from \"./Vertex\";\nimport { UIDGenerator } from \"./UIDGenerator\";\nimport { CubicBezierCurve } from \"./CubicBezierCurve\";\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 */\nexport class VEllipse {\n    /**\n     * The constructor.\n     *\n     * @constructor\n     * @param {Vertex} center - The ellipses center.\n     * @param {Vertex} axis - The x- and y-axis (the two radii encoded in a control point).\n     * @param {Vertex} rotation - [optional, default=0] The rotation of this ellipse.\n     * @name VEllipse\n     **/\n    constructor(center, axis, rotation) {\n        /**\n         * Required to generate proper CSS classes and other class related IDs.\n         **/\n        this.className = \"VEllipse\";\n        this.uid = UIDGenerator.next();\n        this.center = center;\n        this.axis = axis;\n        this.rotation = rotation || 0.0;\n    }\n    /**\n     * Clone this ellipse (deep clone).\n     *\n     * @return {VEllipse} A copy of this ellipse.s\n     */\n    clone() {\n        return new VEllipse(this.center.clone(), this.axis.clone(), this.rotation);\n    }\n    /**\n     * Get the non-negative horizonal radius of this ellipse.\n     *\n     * @method radiusH\n     * @instance\n     * @memberof VEllipse\n     * @return {number} The unsigned horizontal radius of this ellipse.\n     */\n    radiusH() {\n        return Math.abs(this.signedRadiusH());\n    }\n    /**\n     * Get the signed horizonal radius of this ellipse.\n     *\n     * @method signedRadiusH\n     * @instance\n     * @memberof VEllipse\n     * @return {number} The signed horizontal radius of this ellipse.\n     */\n    signedRadiusH() {\n        // return Math.abs(this.axis.x - this.center.x);\n        // Rotate axis back to origin before calculating radius\n        // return Math.abs(new Vertex(this.axis).rotate(-this.rotation,this.center).x - this.center.x);\n        return new Vertex(this.axis).rotate(-this.rotation, this.center).x - this.center.x;\n    }\n    /**\n     * Get the non-negative vertical radius of this ellipse.\n     *\n     * @method radiusV\n     * @instance\n     * @memberof VEllipse\n     * @return {number} The unsigned vertical radius of this ellipse.\n     */\n    radiusV() {\n        return Math.abs(this.signedRadiusV());\n    }\n    /**\n     * Get the signed vertical radius of this ellipse.\n     *\n     * @method radiusV\n     * @instance\n     * @memberof VEllipse\n     * @return {number} The signed vertical radius of this ellipse.\n     */\n    signedRadiusV() {\n        // return Math.abs(this.axis.y - this.center.y);\n        // Rotate axis back to origin before calculating radius\n        // return Math.abs(new Vertex(this.axis).rotate(-this.rotation,this.center).y - this.center.y);\n        return new Vertex(this.axis).rotate(-this.rotation, this.center).y - this.center.y;\n    }\n    /**\n     * Scale this ellipse by the given factor from the center point. The factor will be applied to both radii.\n     *\n     * @method scale\n     * @instance\n     * @memberof VEllipse\n     * @param {number} factor - The factor to scale by.\n     * @return {VEllipse} this for chaining.\n     */\n    scale(factor) {\n        this.axis.scale(factor, this.center);\n        return this;\n    }\n    /**\n     * Rotate this ellipse around its center.\n     *\n     * @method rotate\n     * @instance\n     * @memberof VEllipse\n     * @param {number} angle - The angle to rotate by.\n     * @returns {VEllipse} this for chaining.\n     */\n    rotate(angle) {\n        this.axis.rotate(angle, this.center);\n        this.rotation += angle;\n        return this;\n    }\n    /**\n     * Get the vertex on the ellipse's outline at the given angle.\n     *\n     * @method vertAt\n     * @instance\n     * @memberof VEllipse\n     * @param {number} angle - The angle to determine the vertex at.\n     * @return {Vertex} The vertex on the outline at the given angle.\n     */\n    vertAt(angle) {\n        // Tanks to Narasinham for the vertex-on-ellipse equations\n        // https://math.stackexchange.com/questions/22064/calculating-a-point-that-lies-on-an-ellipse-given-an-angle\n        const a = this.radiusH();\n        const b = this.radiusV();\n        return new Vertex(VEllipse.utils.polarToCartesian(this.center.x, this.center.y, a, b, angle)).rotate(this.rotation, this.center);\n    }\n    /**\n     * Get the normal vector at the given angle.\n     * The normal vector is the vector that intersects the ellipse in a 90 degree angle\n     * at the given point (speicified by the given angle).\n     *\n     * Length of desired normal vector can be specified, default is 1.0.\n     *\n     * @method normalAt\n     * @instance\n     * @memberof VEllipse\n     * @param {number} angle - The angle to get the normal vector at.\n     * @param {number=1.0} length - [optional, default=1] The length of the returned vector.\n     */\n    normalAt(angle, length) {\n        const point = this.vertAt(angle);\n        const foci = this.getFoci();\n        // Calculate the angle between [point,focusA] and [point,focusB]\n        const angleA = new Line(point, foci[0]).angle();\n        const angleB = new Line(point, foci[1]).angle();\n        const centerAngle = angleA + (angleB - angleA) / 2.0;\n        const endPointA = point.clone().addX(50).clone().rotate(centerAngle, point);\n        const endPointB = point\n            .clone()\n            .addX(50)\n            .clone()\n            .rotate(Math.PI + centerAngle, point);\n        if (this.center.distance(endPointA) < this.center.distance(endPointB)) {\n            return new Vector(point, endPointB);\n        }\n        else {\n            return new Vector(point, endPointA);\n        }\n    }\n    /**\n     * Get the tangent vector at the given angle.\n     * The tangent vector is the vector that touches the ellipse exactly at the given given\n     * point (speicified by the given angle).\n     *\n     * Note that the tangent is just 90 degree rotated normal vector.\n     *\n     * Length of desired tangent vector can be specified, default is 1.0.\n     *\n     * @method tangentAt\n     * @instance\n     * @memberof VEllipse\n     * @param {number} angle - The angle to get the tangent vector at.\n     * @param {number=1.0} length - [optional, default=1] The length of the returned vector.\n     */\n    tangentAt(angle, length) {\n        const normal = this.normalAt(angle, length);\n        // Rotate the normal by 90 degrees, then it is the tangent.\n        normal.b.rotate(Math.PI / 2, normal.a);\n        return normal;\n    }\n    /**\n     * Get the perimeter of this ellipse.\n     *\n     * @method perimeter\n     * @instance\n     * @memberof VEllipse\n     * @return {number}\n     */\n    perimeter() {\n        // This method does not use an iterative approximation to determine the perimeter, but it uses\n        // a wonderful closed approximation found by Srinivasa Ramanujan.\n        // Matt Parker made a neat video about it:\n        //    https://www.youtube.com/watch?v=5nW3nJhBHL0\n        const a = this.radiusH();\n        const b = this.radiusV();\n        return Math.PI * (3 * (a + b) - Math.sqrt((3 * a + b) * (a + 3 * b)));\n    }\n    /**\n     * Get the two foci of this ellipse.\n     *\n     * @method getFoci\n     * @instance\n     * @memberof VEllipse\n     * @return {Array<Vertex>} An array with two elements, the two focal points of the ellipse (foci).\n     */\n    getFoci() {\n        // https://www.mathopenref.com/ellipsefoci.html\n        const rh = this.radiusH();\n        const rv = this.radiusV();\n        const sdiff = rh * rh - rv * rv;\n        // f is the distance of each focs to the center.\n        const f = Math.sqrt(Math.abs(sdiff));\n        // Foci on x- or y-axis?\n        if (sdiff < 0) {\n            return [\n                this.center.clone().addY(f).rotate(this.rotation, this.center),\n                this.center.clone().addY(-f).rotate(this.rotation, this.center)\n            ];\n        }\n        else {\n            return [\n                this.center.clone().addX(f).rotate(this.rotation, this.center),\n                this.center.clone().addX(-f).rotate(this.rotation, this.center)\n            ];\n        }\n    }\n    /**\n     * Get equally distributed points on the outline of this ellipse.\n     *\n     * @param {number} pointCount - The number of points.\n     * @returns {Array<Vertex>}\n     */\n    getEquidistantVertices(pointCount) {\n        const angles = VEllipse.utils.equidistantVertAngles(this.radiusH(), this.radiusV(), pointCount);\n        const result = [];\n        for (var i = 0; i < angles.length; i++) {\n            result.push(this.vertAt(angles[i]));\n        }\n        return result;\n    }\n    /**\n     * Convert this ellipse into cubic Bézier curves.\n     *\n     * @param {number=3} quarterSegmentCount - The number of segments per base elliptic quarter (default is 3, min is 1).\n     * @param {number=0.666666} threshold - The Bézier threshold (default value 0.666666 approximates the ellipse with best results\n     * but you might wish to use other values)\n     * @return {Array<CubicBezierCurve>} An array of cubic Bézier curves representing this ellipse.\n     */\n    toCubicBezier(quarterSegmentCount, threshold) {\n        // Math by Luc Maisonobe\n        //    http://www.spaceroots.org/documents/ellipse/node22.html\n        // Note that ellipses with radiusH=0 or radiusV=0 cannot be represented as Bézier curves.\n        // Return a single line here (as a Bézier curve)\n        // if (Math.abs(this.radiusV()) < 0.00001) {\n        //   const radiusH = this.radiusH();\n        //   return [\n        //     new CubicBezierCurve(\n        //       this.center.clone().addX(radiusH),\n        //       this.center.clone().addX(-radiusH),\n        //       this.center.clone(),\n        //       this.center.clone()\n        //     )\n        //   ]; // TODO: test horizontal line ellipse\n        // }\n        // if (Math.abs(this.radiusH()) < 0.00001) {\n        //   const radiusV = this.radiusV();\n        //   return [\n        //     new CubicBezierCurve(\n        //       this.center.clone().addY(radiusV),\n        //       this.center.clone().addY(-radiusV),\n        //       this.center.clone(),\n        //       this.center.clone()\n        //     )\n        //   ]; // TODO: test vertical line ellipse\n        // }\n        // At least 4, but 16 seems to be a good value.\n        const segmentCount = Math.max(1, quarterSegmentCount || 3) * 4;\n        threshold = typeof threshold === \"undefined\" ? 0.666666 : threshold;\n        const radiusH = this.radiusH();\n        const radiusV = this.radiusV();\n        const curves = [];\n        const angles = VEllipse.utils.equidistantVertAngles(radiusH, radiusV, segmentCount);\n        let curAngle = angles[0];\n        let startPoint = this.vertAt(curAngle);\n        for (var i = 0; i < angles.length; i++) {\n            let nextAngle = angles[(i + 1) % angles.length];\n            let endPoint = this.vertAt(nextAngle);\n            if (Math.abs(radiusV) < 0.0001 || Math.abs(radiusH) < 0.0001) {\n                // Distorted ellipses can only be approximated by linear Bézier segments\n                let diff = startPoint.difference(endPoint);\n                let curve = new CubicBezierCurve(startPoint.clone(), endPoint.clone(), startPoint.clone().addXY(diff.x * 0.333, diff.y * 0.333), endPoint.clone().addXY(-diff.x * 0.333, -diff.y * 0.333));\n                curves.push(curve);\n            }\n            else {\n                let startTangent = this.tangentAt(curAngle);\n                let endTangent = this.tangentAt(nextAngle);\n                // Find intersection\n                let intersection = startTangent.intersection(endTangent);\n                // What if intersection is undefined?\n                // --> This *can* not happen if segmentCount > 2 and height and width of the ellipse are not zero.\n                let startDiff = startPoint.difference(intersection);\n                let endDiff = endPoint.difference(intersection);\n                let curve = new CubicBezierCurve(startPoint.clone(), endPoint.clone(), startPoint.clone().add(startDiff.scale(threshold)), endPoint.clone().add(endDiff.scale(threshold)));\n                curves.push(curve);\n            }\n            startPoint = endPoint;\n            curAngle = nextAngle;\n        }\n        return curves;\n    }\n    /**\n     * This function should invalidate any installed listeners and invalidate this object.\n     * After calling this function the object might not hold valid data any more and\n     * should not be used.\n     */\n    destroy() {\n        this.center.destroy();\n        this.axis.destroy();\n        this.isDestroyed = true;\n    }\n}\n/**\n * A static collection of ellipse-related helper functions.\n * @static\n */\nVEllipse.utils = {\n    /**\n     * Calculate a particular point on the outline of the given ellipse (center plus two radii plus angle).\n     *\n     * @name polarToCartesian\n     * @param {number} centerX - The x coordinate of the elliptic center.\n     * @param {number} centerY - The y coordinate of the elliptic center.\n     * @param {number} radiusH - The horizontal radius of the ellipse.\n     * @param {number} radiusV - The vertical radius of the ellipse.\n     * @param {number} angle - The angle (in radians) to get the desired outline point for.\n     * @reutn {XYCoords} The outlont point in absolute x-y-coordinates.\n     */\n    polarToCartesian: (centerX, centerY, radiusH, radiusV, angle) => {\n        // Tanks to Narasinham for the vertex-on-ellipse equations\n        // https://math.stackexchange.com/questions/22064/calculating-a-point-that-lies-on-an-ellipse-given-an-angle\n        var s = Math.sin(Math.PI / 2 - angle);\n        var c = Math.cos(Math.PI / 2 - angle);\n        return {\n            x: centerX + (radiusH * radiusV * s) / Math.sqrt(Math.pow(radiusH * c, 2) + Math.pow(radiusV * s, 2)),\n            y: centerY + (radiusH * radiusV * c) / Math.sqrt(Math.pow(radiusH * c, 2) + Math.pow(radiusV * s, 2))\n        };\n    },\n    /**\n     * Get the `theta` for a given `phi` (used to determine equidistant points on ellipse).\n     *\n     * @param radiusH\n     * @param radiusV\n     * @param phi\n     * @returns {number} theta\n     */\n    phiToTheta: (radiusH, radiusV, phi) => {\n        //  See https://math.stackexchange.com/questions/172766/calculating-equidistant-points-around-an-ellipse-arc\n        var tanPhi = Math.tan(phi);\n        var tanPhi2 = tanPhi * tanPhi;\n        var theta = -Math.PI / 2 + phi + Math.atan(((radiusH - radiusV) * tanPhi) / (radiusV + radiusH * tanPhi2));\n        return theta;\n    },\n    /**\n     * Get n equidistant points on the elliptic arc.\n     *\n     * @param pointCount\n     * @returns\n     */\n    equidistantVertAngles: (radiusH, radiusV, pointCount) => {\n        const angles = [];\n        for (var i = 0; i < pointCount; i++) {\n            var phi = Math.PI / 2.0 + ((Math.PI * 2) / pointCount) * i;\n            let theta = VEllipse.utils.phiToTheta(radiusH, radiusV, phi);\n            angles[i] = theta;\n        }\n        return angles;\n    }\n}; // END utils\n//# sourceMappingURL=VEllipse.js.map","/**\n * Implementation of elliptic sectors.\n * Note that sectors are constructed in clockwise direction.\n *\n * @author   Ikaros Kappler\n * @date     2021-02-26\n * @modified 2022-02-02 Added the `destroy` method.\n * @modified 2022-11-01 Tweaked the `endpointToCenterParameters` function to handle negative values, too, without errors.\n * @version  1.1.1\n */\nimport { CubicBezierCurve } from \"./CubicBezierCurve\";\nimport { geomutils } from \"./geomutils\";\nimport { Line } from \"./Line\";\nimport { UIDGenerator } from \"./UIDGenerator\";\nimport { VEllipse } from \"./VEllipse\";\nimport { Vertex } from \"./Vertex\";\n/**\n * @classdesc A class for elliptic sectors.\n *\n * @requires Line\n * @requires Vector\n * @requires VertTuple\n * @requires Vertex\n * @requires SVGSerializale\n * @requires UID\n * @requires UIDGenerator\n **/\nexport class VEllipseSector {\n    /**\n     * Create a new elliptic sector from the given ellipse and two angles.\n     *\n     * Note that the direction from start to end goes clockwise, and that start and end angle\n     * will be wrapped to [0,PI*2).\n     *\n     * @constructor\n     * @name VEllipseSector\n     * @param {VEllipse} - The underlying ellipse to use.\n     * @param {number} startAngle - The start angle of the sector.\n     * @param {numner} endAngle - The end angle of the sector.\n     */\n    constructor(ellipse, startAngle, endAngle) {\n        /**\n         * Required to generate proper CSS classes and other class related IDs.\n         **/\n        this.className = \"VEllipseSector\";\n        this.uid = UIDGenerator.next();\n        this.ellipse = ellipse;\n        this.startAngle = geomutils.wrapMinMax(startAngle, 0, Math.PI * 2);\n        this.endAngle = geomutils.wrapMinMax(endAngle, 0, Math.PI * 2);\n    }\n    /**\n     * Convert this elliptic sector into cubic Bézier curves.\n     *\n     * @param {number=3} quarterSegmentCount - The number of segments per base elliptic quarter (default is 3, min is 1).\n     * @param {number=0.666666} threshold - The Bézier threshold (default value 0.666666 approximates the ellipse with best results\n     * but you might wish to use other values)\n     * @return {Array<CubicBezierCurve>} An array of cubic Bézier curves representing the elliptic sector.\n     */\n    toCubicBezier(quarterSegmentCount, threshold) {\n        // There are at least 4 segments required (dour quarters) to approximate a whole\n        // ellipse with Bézier curves.\n        // A visually 'good' approximation should have 12; this seems to be a good value (anything multiple of 4).\n        const segmentCount = Math.max(1, quarterSegmentCount || 3) * 4;\n        threshold = typeof threshold === \"undefined\" ? 0.666666 : threshold;\n        const radiusH = this.ellipse.radiusH();\n        const radiusV = this.ellipse.radiusV();\n        var startAngle = VEllipseSector.ellipseSectorUtils.normalizeAngle(this.startAngle);\n        var endAngle = VEllipseSector.ellipseSectorUtils.normalizeAngle(this.endAngle);\n        // Find all angles inside start and end\n        var angles = VEllipseSector.ellipseSectorUtils.equidistantVertAngles(radiusH, radiusV, startAngle, endAngle, segmentCount);\n        angles = [startAngle].concat(angles).concat([endAngle]);\n        const curves = [];\n        let curAngle = angles[0];\n        let startPoint = this.ellipse.vertAt(curAngle);\n        for (var i = 0; i + 1 < angles.length; i++) {\n            let nextAngle = angles[(i + 1) % angles.length];\n            let endPoint = this.ellipse.vertAt(nextAngle);\n            let startTangent = this.ellipse.tangentAt(curAngle);\n            let endTangent = this.ellipse.tangentAt(nextAngle);\n            // Distorted ellipses can only be approximated by linear Bézier segments\n            if (Math.abs(radiusV) < 0.0001 || Math.abs(radiusH) < 0.0001) {\n                let diff = startPoint.difference(endPoint);\n                let curve = new CubicBezierCurve(startPoint.clone(), endPoint.clone(), startPoint.clone().addXY(diff.x * 0.333, diff.y * 0.333), endPoint.clone().addXY(-diff.x * 0.333, -diff.y * 0.333));\n                curves.push(curve);\n            }\n            else {\n                // Find intersection\n                let intersection = startTangent.intersection(endTangent);\n                // What if intersection is undefined?\n                // --> This *can* not happen if segmentCount > 2 and height and width of the ellipse are not zero.\n                if (intersection) {\n                    // It's VERY LIKELY hat this ALWAYS happens; it's just a typesave variant.\n                    // Intersection cannot be null.\n                    let startDiff = startPoint.difference(intersection);\n                    let endDiff = endPoint.difference(intersection);\n                    let curve = new CubicBezierCurve(startPoint.clone(), endPoint.clone(), startPoint.clone().add(startDiff.scale(threshold)), endPoint.clone().add(endDiff.scale(threshold)));\n                    curves.push(curve);\n                }\n            }\n            startPoint = endPoint;\n            curAngle = nextAngle;\n        }\n        return curves;\n    }\n    /**\n     * This function should invalidate any installed listeners and invalidate this object.\n     * After calling this function the object might not hold valid data any more and\n     * should not be used.\n     */\n    destroy() {\n        this.ellipse.destroy();\n        this.isDestroyed = true;\n    }\n}\nVEllipseSector.ellipseSectorUtils = {\n    /**\n     * Helper function to convert an elliptic section to SVG arc params (for the `d` attribute).\n     * Inspiration found at:\n     *    https://stackoverflow.com/questions/5736398/how-to-calculate-the-svg-path-for-an-arc-of-a-circle\n     *\n     * @param {boolean} options.moveToStart - If false (default=true) the initial 'Move' command will not be used.\n     * @return [ 'A', radiusH, radiusV, rotation, largeArcFlag=1|0, sweepFlag=0, endx, endy ]\n     */\n    describeSVGArc: (x, y, radiusH, radiusV, startAngle, endAngle, rotation, options) => {\n        if (typeof options === \"undefined\")\n            options = { moveToStart: true };\n        if (typeof rotation === \"undefined\")\n            rotation = 0.0;\n        // Important note: this function only works if start- and end-angle are within\n        // one whole circle [x,x+2*PI].\n        // Revelations of more than 2*PI might result in unexpected arcs.\n        // -> Use the geomutils.wrapMax( angle, 2*PI )\n        startAngle = geomutils.wrapMax(startAngle, Math.PI * 2);\n        endAngle = geomutils.wrapMax(endAngle, Math.PI * 2);\n        // Find the start- and end-point on the rotated ellipse\n        // XYCoords to Vertex (for rotation)\n        var end = new Vertex(VEllipse.utils.polarToCartesian(x, y, radiusH, radiusV, endAngle));\n        var start = new Vertex(VEllipse.utils.polarToCartesian(x, y, radiusH, radiusV, startAngle));\n        end.rotate(rotation, { x: x, y: y });\n        start.rotate(rotation, { x: x, y: y });\n        // Boolean stored as integers (0|1).\n        var diff = endAngle - startAngle;\n        var largeArcFlag;\n        if (diff < 0) {\n            largeArcFlag = Math.abs(diff) < Math.PI ? 1 : 0;\n        }\n        else {\n            largeArcFlag = Math.abs(diff) > Math.PI ? 1 : 0;\n        }\n        const sweepFlag = 1;\n        const pathData = [];\n        if (options.moveToStart) {\n            pathData.push(\"M\", start.x, start.y);\n        }\n        // Arc rotation in degrees, not radians.\n        const r2d = 180 / Math.PI;\n        pathData.push(\"A\", radiusH, radiusV, rotation * r2d, largeArcFlag, sweepFlag, end.x, end.y);\n        return pathData;\n    },\n    /**\n     * Helper function to find second-kind elliptic angles, so that the euclidean distance along the the\n     * elliptic sector is the same for all.\n     *\n     * Note that this is based on the full ellipse calculuation and start and end will be cropped; so the\n     * distance from the start angle to the first angle and/or the distance from the last angle to\n     * the end angle may be different to the others.\n     *\n     * Furthermore the computation is only possible on un-rotated ellipses; if your source ellipse has\n     * a rotation on the plane please 'rotate' the result angles afterwards to find matching angles.\n     *\n     * Returned angles are normalized to the interval `[ 0, PI*2 ]`.\n     *\n     * @param {number} radiusH - The first (horizonal) radius of the ellipse.\n     * @param {number} radiusV - The second (vertical) radius of the ellipse.\n     * @param {number} startAngle - The opening angle of your elliptic sector (please use normalized angles).\n     * @param {number} endAngle - The closing angle of your elliptic sector (please use normalized angles).\n     * @param {number} fullEllipsePointCount - The number of base segments to use from the source ellipse (12 or 16 are good numbers).\n     * @return {Array<number>} An array of n angles inside startAngle and endAngle (where n <= fullEllipsePointCount).\n     */\n    equidistantVertAngles: (radiusH, radiusV, startAngle, endAngle, fullEllipsePointCount) => {\n        var ellipseAngles = VEllipse.utils.equidistantVertAngles(radiusH, radiusV, fullEllipsePointCount);\n        ellipseAngles = ellipseAngles.map((angle) => VEllipseSector.ellipseSectorUtils.normalizeAngle(angle));\n        var angleIsInRange = (angle) => {\n            if (startAngle < endAngle)\n                return angle >= startAngle && angle <= endAngle;\n            else\n                return angle >= startAngle || (angle <= endAngle && angle >= 0);\n        };\n        // Drop all angles outside the sector\n        var ellipseAngles = ellipseAngles.filter(angleIsInRange);\n        // Now we need to sort the angles to the first one in the array is the closest to startAngle.\n        // --> find the angle that is closest to the start angle\n        var startIndex = VEllipseSector.ellipseSectorUtils.findClosestToStartAngle(startAngle, endAngle, ellipseAngles);\n        // Bring all angles into the correct order\n        //    Idea: use splice or slice here?\n        var angles = [];\n        for (var i = 0; i < ellipseAngles.length; i++) {\n            angles.push(ellipseAngles[(startIndex + i) % ellipseAngles.length]);\n        }\n        return angles;\n    },\n    findClosestToStartAngle: (startAngle, endAngle, ellipseAngles) => {\n        // Note: endAngle > 0 && startAngle > 0\n        if (startAngle > endAngle) {\n            const n = ellipseAngles.length;\n            for (var i = 0; i < n; i++) {\n                const ea = geomutils.wrapMinMax(ellipseAngles[i], 0, Math.PI * 2);\n                if (ea >= startAngle && ea >= endAngle) {\n                    return i;\n                }\n            }\n        }\n        return 0;\n    },\n    normalizeAngle: (angle) => (angle < 0 ? Math.PI * 2 + angle : angle),\n    /**\n     * Convert the elliptic arc from endpoint parameters to center parameters as described\n     * in the w3c svg arc implementation note.\n     *\n     * https://www.w3.org/TR/SVG/implnote.html#ArcConversionEndpointToCenter\n     *\n     * @param {number} x1 - The x component of the start point (end of last SVG command).\n     * @param {number} y1 - The y component of the start point (end of last SVG command).\n     * @param {number} rx - The first (horizontal) radius of the ellipse.\n     * @param {number} ry - The second (vertical) radius of the ellipse.\n     * @param {number} phi - The ellipse's rotational angle (angle of axis rotation) in radians (not in degrees as the SVG command uses!)\n     * @param {boolean} fa - The large-arc-flag (boolean, not 0 or 1).\n     * @param {boolean} fs - The sweep-flag (boolean, not 0 or 1).\n     * @param {number} x2 - The x component of the end point (end of last SVG command).\n     * @param {number} y2 - The y component of the end point (end of last SVG command).\n     * @returns\n     */\n    endpointToCenterParameters(x1, y1, rx, ry, phi, fa, fs, x2, y2) {\n        // console.log(\"endpointToCenterParameters\", x1, y1, phi, rx, ry, fa, fs, x2, y2);\n        // Thanks to\n        //    https://observablehq.com/@toja/ellipse-and-elliptical-arc-conversion\n        const abs = Math.abs;\n        const sin = Math.sin;\n        const cos = Math.cos;\n        const sqrt = Math.sqrt;\n        const pow = (n) => {\n            return n * n;\n        };\n        const sinphi = sin(phi);\n        const cosphi = cos(phi);\n        // Step 1: simplify through translation/rotation\n        const x = (cosphi * (x1 - x2)) / 2 + (sinphi * (y1 - y2)) / 2;\n        const y = (-sinphi * (x1 - x2)) / 2 + (cosphi * (y1 - y2)) / 2;\n        const px = pow(x), py = pow(y), prx = pow(rx), pry = pow(ry);\n        // correct of out-of-range radii\n        const L = px / prx + py / pry;\n        if (L > 1) {\n            rx = sqrt(L) * abs(rx);\n            ry = sqrt(L) * abs(ry);\n        }\n        else {\n            rx = abs(rx);\n            ry = abs(ry);\n        }\n        // Step 2 + 3: compute center\n        const sign = fa === fs ? -1 : 1;\n        // const M: number = sqrt((prx * pry - prx * py - pry * px) / (prx * py + pry * px)) * sign;\n        const M = sqrt(Math.abs((prx * pry - prx * py - pry * px) / (prx * py + pry * px))) * sign;\n        const _cx = (M * (rx * y)) / ry;\n        const _cy = (M * (-ry * x)) / rx;\n        const cx = cosphi * _cx - sinphi * _cy + (x1 + x2) / 2;\n        const cy = sinphi * _cx + cosphi * _cy + (y1 + y2) / 2;\n        // Step 4: Compute start and end angle\n        const center = new Vertex(cx, cy);\n        const axis = center.clone().addXY(rx, ry);\n        const ellipse = new VEllipse(center, axis, 0);\n        // console.log(\"VELLIPSE::::::\", ellipse);\n        ellipse.rotate(phi);\n        const startAngle = new Line(ellipse.center, new Vertex(x1, y1)).angle();\n        const endAngle = new Line(ellipse.center, new Vertex(x2, y2)).angle();\n        return new VEllipseSector(ellipse, startAngle - phi, endAngle - phi);\n    }\n}; // END ellipseSectorUtils\n//# sourceMappingURL=VEllipseSector.js.map","/**\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 * @modified 2022-02-02 Added the `destroy` method.\n * @modified 2022-02-02 Cleared the `Vector.toSVGString` function (deprecated). Use `drawutilssvg` instead.\n * @modified 2022-10-25 Added the `getOrthogonal` method.\n * @version  1.5.0\n *\n * @file Vector\n * @public\n **/\nimport { VertTuple } from \"./VertTuple\";\nimport { Vertex } from \"./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 **/\nexport class Vector extends VertTuple {\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    constructor(vertA, vertB) {\n        super(vertA, vertB, (a, b) => new Vector(a, b));\n        /**\n         * Required to generate proper CSS classes and other class related IDs.\n         **/\n        this.className = \"Vector\";\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    perp() {\n        var v = this.clone();\n        v.sub(this.a);\n        v = new Vector(new Vertex(), new 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     * The inverse of a vector is a vector with 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    inverse() {\n        var tmp = this.a;\n        this.a = this.b;\n        this.b = tmp;\n        return this;\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    inv() {\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     * 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    intersection(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(this.a.x + a * (this.b.x - this.a.x), this.a.y + a * (this.b.y - this.a.y));\n    }\n    /**\n     * Get the orthogonal \"vector\" of this vector (rotated by 90° clockwise).\n     *\n     * @name getOrthogonal\n     * @method getOrthogonal\n     * @return {Vector} A new vector with the same length that stands on this vector's point a.\n     * @instance\n     * @memberof Vector\n     **/\n    getOrthogonal() {\n        // Orthogonal of vector (0,0)->(x,y) is (0,0)->(-y,x)\n        const linePoint = this.a.clone();\n        const startPoint = this.b.clone().sub(this.a);\n        const tmp = startPoint.x;\n        startPoint.x = -startPoint.y;\n        startPoint.y = tmp;\n        return new Vector(linePoint, startPoint.add(this.a));\n    }\n}\nVector.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: (zA, zB, headlen, scaleX, scaleY) => {\n        const angle = Math.atan2((zB.y - zA.y) * scaleY, (zB.x - zA.x) * scaleX);\n        const 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//# sourceMappingURL=Vector.js.map","/**\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 * @modified 2022-02-02 Added the `destroy` method.\n * @version 1.2.0\n */\nimport { Vertex } from \"./Vertex\";\nimport { UIDGenerator } from \"./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 */\nexport class VertTuple {\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    constructor(a, b, factory) {\n        this.uid = 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    length() {\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     * 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    setLength(length) {\n        return this.scale(length / this.length());\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    sub(amount) {\n        this.a.sub(amount);\n        this.b.sub(amount);\n        return this;\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    add(amount) {\n        this.a.add(amount);\n        this.b.add(amount);\n        return this;\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    normalize() {\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     * 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    scale(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     * 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    moveTo(newA) {\n        let diff = this.a.difference(newA);\n        this.a.add(diff);\n        this.b.add(diff);\n        return this;\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    angle(line) {\n        if (line == null || typeof line == \"undefined\") {\n            line = this.factory(new Vertex(0, 0), new Vertex(100, 0));\n        }\n        // Compute the angle from x axis and the return the difference :)\n        const v0 = this.b.clone().sub(this.a);\n        const 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     * 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    vertAt(t) {\n        return new Vertex(this.a.x + (this.b.x - this.a.x) * t, this.a.y + (this.b.y - this.a.y) * t);\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    denominator(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     * 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    colinear(line) {\n        return Math.abs(this.denominator(line)) < Vertex.EPSILON;\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    getClosestT(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     * 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    hasPoint(point, insideBoundsOnly) {\n        const t = this.getClosestT(point);\n        // Compare to pointDistance?\n        if (typeof insideBoundsOnly !== \"undefined\" && insideBoundsOnly) {\n            const distance = Math.sqrt(VertTuple.vtutils.dist2(point, this.vertAt(t)));\n            return distance < 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    getClosestPoint(p) {\n        var t = this.getClosestT(p);\n        return this.vertAt(t);\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    pointDistance(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     * 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    clone() {\n        return this.factory(this.a.clone(), this.b.clone());\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    toString() {\n        return \"{ a : \" + this.a.toString() + \", b : \" + this.b.toString() + \" }\";\n    }\n    /**\n     * This function should invalidate any installed listeners and invalidate this object.\n     * After calling this function the object might not hold valid data any more and\n     * should not be used.\n     */\n    destroy() {\n        this.a.destroy();\n        this.b.destroy();\n        this.isDestroyed = true;\n    }\n}\n/**\n * @private\n **/\nVertTuple.vtutils = {\n    dist2: (v, w) => {\n        return (v.x - w.x) * (v.x - w.x) + (v.y - w.y) * (v.y - w.y);\n    }\n};\n//# sourceMappingURL=VertTuple.js.map","/**\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 * @modified 2020-10-30 Changed the warnings in `sub(...)` and `add(...)` into real errors.\n * @modified 2021-03-01 Changed the second param `center` in the `rotate` function from Vertex to XYCoords.\n * @modified 2021-12-01 Changed the type of param of `scale` to XYCoords.\n * @modified 2021-12-01 Added function `scaleXY` for non uniform scaling.\n * @modified 2021-12-17 Added the functions `lerp` and `lerpAbs` for linear interpolations.\n * @modified 2022-01-31 Added `Vertex.utils.arrayToJSON`.\n * @modified 2022-02-02 Added the `destroy` method.\n * @modified 2022-02-02 Cleared the `Vertex.toSVGString` function (deprecated). Use `drawutilssvg` instead.\n * @modified 2022-11-28 Added the `subXY`, `subX` and `subY` methods to the `Vertex` class.\n * @version  2.8.0\n *\n * @file Vertex\n * @public\n **/\nimport { VertexAttr } from \"./VertexAttr\";\nimport { UIDGenerator } from \"./UIDGenerator\";\nimport { VertexListeners } from \"./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 */\nexport class Vertex {\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    constructor(x, y) {\n        /**\n         * Required to generate proper CSS classes and other class related IDs.\n         **/\n        this.className = \"Vertex\";\n        this.uid = 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            const 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();\n        this.listeners = new VertexListeners(this);\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    set(x, y) {\n        if (typeof x == \"number\" && typeof y == \"number\") {\n            this.x = x;\n            this.y = y;\n        }\n        else {\n            const 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     * 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    setX(x) {\n        this.x = x;\n        return this;\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    setY(y) {\n        this.y = y;\n        return this;\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    invX() {\n        this.x = -this.x;\n        return this;\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    invY() {\n        this.y = -this.y;\n        return this;\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    add(x, y) {\n        if (typeof x == \"number\" && typeof y == \"number\") {\n            this.x += x;\n            this.y += y;\n        }\n        else {\n            const 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     * 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    addXY(amountX, amountY) {\n        this.x += amountX;\n        this.y += amountY;\n        return this;\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    addX(amountX) {\n        this.x += amountX;\n        return this;\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    addY(amountY) {\n        this.y += amountY;\n        return this;\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    sub(x, y) {\n        if (typeof x == \"number\" && typeof y == \"number\") {\n            this.x -= x;\n            this.y -= y;\n        }\n        else {\n            const 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     * Substract the passed amounts from the x- and y- components of this vertex.\n     *\n     * @method subXY\n     * @param {number} x - The amount to substract from x.\n     * @param {number} y - The amount to substract from y.\n     * @return {Vertex} this\n     * @instance\n     * @memberof Vertex\n     **/\n    subXY(amountX, amountY) {\n        this.x -= amountX;\n        this.y -= amountY;\n        return this;\n    }\n    /**\n     * Substract the passed amounts from the x-component of this vertex.\n     *\n     * @method addX\n     * @param {number} x - The amount to substract from x.\n     * @return {Vertex} this\n     * @instance\n     * @memberof Vertex\n     **/\n    subX(amountX) {\n        this.x -= amountX;\n        return this;\n    }\n    /**\n     * Substract the passed amounts from the y-component of this vertex.\n     *\n     * @method subY\n     * @param {number} y - The amount to substract from y.\n     * @return {Vertex} this\n     * @instance\n     * @memberof Vertex\n     **/\n    subY(amountY) {\n        this.y -= amountY;\n        return this;\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    equals(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     * 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    clone() {\n        return new Vertex(this.x, this.y);\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    distance(vert) {\n        return Math.sqrt(Math.pow(vert.x - this.x, 2) + Math.pow(vert.y - this.y, 2));\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    angle(origin) {\n        const a = typeof origin === \"undefined\"\n            ? Math.PI / 2 - Math.atan2(this.x, this.y)\n            : 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     * 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    difference(vert) {\n        return new Vertex(vert.x - this.x, vert.y - this.y);\n    }\n    /**\n     * This is a vector-like behavior and 'scales' this vertex\n     * towards/from a given center by one uniform scale factor.\n     *\n     * @method scale\n     * @param {number} factor - The factor to 'scale' this vertex; 1.0 means no change.\n     * @param {XYCoords=} center - The origin of scaling; default is (0,0).\n     * @return {Vertex} this\n     * @instance\n     * @memberof Vertex\n     **/\n    scale(factor, center) {\n        return this.scaleXY({ x: factor, y: factor }, center);\n    }\n    /**\n     * Perform a linear interpolation towards the given target vertex.\n     * The amount value `t` is relative, `t=0.0` means no change, `t=1.0`\n     * means this point will be moved to the exact target position.\n     *\n     * `t=0.5` will move this point to the middle of the connecting\n     * linear segment.\n     *\n     * @param {XYCoords} target - The target position to lerp this vertex to.\n     * @param {number} t - The relative amount, usually in [0..1], but other values will work, too.\n     * @returns\n     */\n    lerp(target, t) {\n        var diff = this.difference(target);\n        // return new Vertex(this.x + diff.x * t, this.y + diff.y * t);\n        this.x += diff.x * t;\n        this.y += diff.y * t;\n        return this;\n    }\n    /**\n     * Perform a linear interpolation towards the given target vertex (absolute variant).\n     * The amount value `t` is absolute, which means the lerp amount is a direct distance\n     * value. This point will have move the amount of the passed distance `u`.\n     *\n     * @param {XYCoords} target - The target position to lerp this vertex to.\n     * @param {number} t - The absolute move amount to use to lerping.\n     * @returns\n     */\n    lerpAbs(target, u) {\n        var dist = this.distance(target);\n        var diff = this.difference(target);\n        var step = { x: diff.x / dist, y: diff.y / dist };\n        // return new Vertex(this.x + step.x * u, this.y + step.y * u);\n        this.x += step.x * u;\n        this.y += step.y * u;\n        return this;\n    }\n    /**\n     * This is a vector-like behavior and 'scales' this vertex\n     * towards/from a given center by two independent x- and y- scale factors.\n     *\n     * @method scale\n     * @param {number} factor - The factor to 'scale' this vertex; 1.0 means no change.\n     * @param {XYCoords=} center - The origin of scaling; default is (0,0).\n     * @return {Vertex} this\n     * @instance\n     * @memberof Vertex\n     **/\n    scaleXY(factors, center) {\n        if (!center || typeof center === \"undefined\") {\n            center = { x: 0, y: 0 };\n        }\n        this.x = center.x + (this.x - center.x) * factors.x;\n        this.y = center.y + (this.y - center.y) * factors.y;\n        return this;\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 {XYCoords=} center - The center of rotation; default is (0,0).\n     * @return {Vertex} this\n     * @instance\n     * @memberof Vertex\n     **/\n    rotate(angle, center) {\n        if (!center || typeof center === \"undefined\") {\n            center = { x: 0, y: 0 };\n        }\n        this.sub(center);\n        angle += Math.atan2(this.y, this.x);\n        let 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     * 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    multiplyScalar(scalar) {\n        this.x *= scalar;\n        this.y *= scalar;\n        return this;\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    round() {\n        this.x = Math.round(this.x);\n        this.y = Math.round(this.y);\n        return this;\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    inv() {\n        this.x = -this.x;\n        this.y = -this.y;\n        return this;\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    toString() {\n        return \"(\" + this.x + \",\" + this.y + \")\";\n    }\n    /**\n     * This function should invalidate any installed listeners and invalidate this object.\n     * After calling this function the object might not hold valid data any more and\n     * should not be used.\n     */\n    destroy() {\n        this.listeners.removeAllListeners();\n        this.isDestroyed = true;\n    }\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    static randomVertex(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}\nVertex.ZERO = new Vertex(0, 0);\n/**\n * An epsilon for comparison\n *\n * @private\n * @readonly\n **/\nVertex.EPSILON = 1.0e-6;\nVertex.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: (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     * Convert the given vertices (array) to a JSON string.\n     *\n     * @param {number?} precision - (optional) The numeric precision to be used (number of precision digits).\n     * @returns {string}\n     */\n    arrayToJSON(vertices, precision) {\n        return JSON.stringify(vertices.map(function (vert) {\n            return typeof precision === undefined\n                ? { x: vert.x, y: vert.y }\n                : { x: Number(vert.x.toFixed(precision)), y: Number(vert.y.toFixed(precision)) };\n        }));\n    }\n};\n//# sourceMappingURL=Vertex.js.map","/**\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 **/\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 */\nexport class VertexAttr {\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    constructor() {\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/**\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 **/\nVertexAttr.model = {\n    draggable: true,\n    selectable: true,\n    isSelected: false,\n    visible: true\n};\n//# sourceMappingURL=VertexAttr.js.map","/**\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 **/\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 */\nexport class VertexListeners {\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    constructor(vertex) {\n        this.click = [];\n        this.drag = [];\n        this.dragStart = [];\n        this.dragEnd = [];\n        this.vertex = vertex;\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    addClickListener(listener) {\n        VertexListeners._addListener(this.click, listener);\n        return this;\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    removeClickListener(listener) {\n        this.click = VertexListeners._removeListener(this.click, listener);\n        return this;\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    addDragListener(listener) {\n        VertexListeners._addListener(this.drag, listener);\n        return this;\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    removeDragListener(listener) {\n        this.drag = VertexListeners._removeListener(this.drag, listener);\n        return this;\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    addDragStartListener(listener) {\n        VertexListeners._addListener(this.dragStart, listener);\n        return this;\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    removeDragStartListener(listener) {\n        this.dragStart = VertexListeners._removeListener(this.dragStart, listener);\n        return this;\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    addDragEndListener(listener) {\n        // this.dragEnd.push( listener );\n        VertexListeners._addListener(this.dragEnd, listener);\n        return this;\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    removeDragEndListener(listener) {\n        // this.drag.push( listener );\n        this.dragEnd = VertexListeners._removeListener(this.dragEnd, listener);\n        return this;\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    fireClickEvent(e) {\n        VertexListeners._fireEvent(this, this.click, e);\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    fireDragEvent(e) {\n        VertexListeners._fireEvent(this, this.drag, e);\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    fireDragStartEvent(e) {\n        VertexListeners._fireEvent(this, this.dragStart, e);\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    fireDragEndEvent(e) {\n        VertexListeners._fireEvent(this, this.dragEnd, e);\n    }\n    /**\n     * Removes all listeners from this listeners object.\n     */\n    removeAllListeners() {\n        this.click = [];\n        this.drag = [];\n        this.dragStart = [];\n        this.dragEnd = [];\n    }\n    /**\n     * @private\n     **/\n    static _fireEvent(_self, listeners, e) {\n        const 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     * @private\n     */\n    static _addListener(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     * @private\n     */\n    static _removeListener(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//# sourceMappingURL=VertexListeners.js.map","/**\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 * @modified 2021-02-22 Added the `path` drawing function to draw SVG path data.\n * @modified 2021-03-31 Added the `endDrawCycle` function from `DrawLib`.\n * @modified 2021-05-31 Added the `setConfiguration` function from `DrawLib`.\n * @modified 2021-11-12 Adding more parameters tot the `text()` function: fontSize, textAlign, fontFamily, lineHeight.\n * @modified 2021-11-19 Added the `color` param to the `label(...)` function.\n * @modified 2022-02-03 Added the `lineWidth` param to the `crosshair` function.\n * @modified 2022-02-03 Added the `cross(...)` function.\n * @modified 2022-03-27 Added the `texturedPoly` function.\n * @modified 2022-06-01 Tweaked the `polyline` function; lineWidth now scales with scale.x.\n * @modified 2022-07-26 Adding `alpha` to the `image(...)` function.\n * @modified 2022-08-23 Fixed a type issue in the `polyline` function.\n * @modified 2022-08-23 Fixed a type issue in the `setConfiguration` function.\n * @modified 2022-08-23 Fixed a type issue in the `path` function.\n * @modified 2023-02-10 The methods `setCurrentClassName` and `setCurrentId` also accept `null` now.\n * @version  1.12.4\n **/\nimport { CubicBezierCurve } from \"./CubicBezierCurve\";\nimport { Vertex } from \"./Vertex\";\nimport { drawutilssvg } from \"./drawutilssvg\";\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 */\nexport class drawutils {\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    constructor(context, fillShapes) {\n        this.ctx = context;\n        this.offset = new Vertex(0, 0);\n        this.scale = new Vertex(1, 1);\n        this.fillShapes = fillShapes;\n    }\n    /**\n     * Called before each draw cycle.\n     * @param {UID=} uid - (optional) A UID identifying the currently drawn element(s).\n     **/\n    beginDrawCycle(renderTime) {\n        // NOOP\n    }\n    /**\n     * Called after each draw cycle.\n     *\n     * This is required for compatibility with other draw classes in the library (like drawgl).\n     *\n     * @name endDrawCycle\n     * @method\n     * @param {number} renderTime\n     * @instance\n     **/\n    endDrawCycle(renderTime) {\n        // NOOP\n    }\n    /**\n     * Set the current drawlib configuration.\n     *\n     * @name setConfiguration\n     * @method\n     * @param {DrawLibConfiguration} configuration - The new configuration settings to use for the next render methods.\n     */\n    setConfiguration(configuration) {\n        this.ctx.globalCompositeOperation = configuration.blendMode || \"source-over\";\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|null} uid - A UID identifying the currently drawn element(s).\n     **/\n    setCurrentId(uid) {\n        // NOOP\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|null} className - A class name for further custom use cases.\n     **/\n    setCurrentClassName(className) {\n        // NOOP\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    line(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     * 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    arrow(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.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     * 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     * @param {number=0.0} alpha - (optional, default=0.0) The transparency (1.0=opaque, 0.0=transparent).\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     **/\n    image(image, position, size, alpha = 1.0) {\n        if (!image.complete || !image.naturalWidth) {\n            // Avoid drawing un-unloaded or broken images\n            return;\n        }\n        this.ctx.save();\n        this.ctx.globalAlpha = alpha;\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     * 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 texturedPoly\n     * @param {Image} textureImage - The image object to draw.\n     * @param {Bounds} textureSize - The texture size to use; these are the original bounds to map the polygon vertices to.\n     * @param {Polygon} polygon - The polygon to use as clip path.\n     * @param {Vertex} polygonPosition - The polygon's position (relative), measured at the bounding box's center.\n     * @param {number} rotation - The rotation to use for the polygon (and for the texture).\n     * @param {XYCoords={x:0,y:0}} rotationCenter - (optional) The rotational center; default is center of bounding box.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     **/\n    texturedPoly(textureImage, textureSize, polygon, polygonPosition, rotation) {\n        var basePolygonBounds = polygon.getBounds();\n        var targetCenterDifference = polygonPosition.clone().difference(basePolygonBounds.getCenter());\n        // var rotationalOffset = rotationCenter ? polygonPosition.difference(rotationCenter) : { x: 0, y: 0 };\n        // var rotationalOffset = { x: 0, y: 0 };\n        var tileCenter = basePolygonBounds.getCenter().sub(targetCenterDifference);\n        // Get the position offset of the polygon\n        var targetTextureSize = new Vertex(textureSize.width, textureSize.height);\n        // var targetTextureOffset = new Vertex(-textureSize.width / 2, -textureSize.height / 2).sub(targetCenterDifference);\n        var targetTextureOffset = new Vertex(textureSize.min.x, textureSize.min.y).sub(polygonPosition);\n        this.ctx.save();\n        // this.ctx.translate(this.offset.x + rotationCenter.x * this.scale.x, this.offset.y + rotationCenter.y * this.scale.y);\n        this.ctx.translate(this.offset.x + polygonPosition.x * this.scale.x, this.offset.y + polygonPosition.y * this.scale.y);\n        drawutils.helpers.clipPoly(this.ctx, {\n            x: -polygonPosition.x * this.scale.x,\n            y: -polygonPosition.y * this.scale.y\n        }, this.scale, polygon.vertices);\n        this.ctx.scale(this.scale.x, this.scale.y);\n        this.ctx.rotate(rotation);\n        this.ctx.drawImage(textureImage, 0, 0, textureImage.naturalWidth - 1, // There is this horrible Safari bug (fixed in newer versions)\n        textureImage.naturalHeight - 1, // To avoid errors substract 1 here.\n        targetTextureOffset.x, // * this.scale.x,\n        targetTextureOffset.y, // * this.scale.y,\n        targetTextureSize.x, //  * this.scale.x,\n        targetTextureSize.y // * this.scale.y\n        );\n        this.ctx.restore();\n    }\n    _texturedPoly(textureImage, textureSize, polygon, polygonPosition, rotation, rotationCenter = { x: 0, y: 0 }) {\n        var basePolygonBounds = polygon.getBounds();\n        var targetCenterDifference = polygonPosition.clone().difference(basePolygonBounds.getCenter());\n        var rotationalOffset = rotationCenter ? polygonPosition.difference(rotationCenter) : { x: 0, y: 0 };\n        // var rotationalOffset = { x: 0, y: 0 };\n        var tileCenter = basePolygonBounds.getCenter().sub(targetCenterDifference);\n        // Get the position offset of the polygon\n        var targetTextureSize = new Vertex(textureSize.width, textureSize.height);\n        var targetTextureOffset = new Vertex(-textureSize.width / 2, -textureSize.height / 2).sub(targetCenterDifference);\n        this.ctx.save();\n        // this.ctx.translate(\n        //   this.offset.x + (tileCenter.x - rotationalOffset.x * 0 + targetTextureOffset.x * 0.0) * this.scale.x,\n        //   this.offset.y + (tileCenter.y - rotationalOffset.y * 0 + targetTextureOffset.y * 0.0) * this.scale.y\n        // );\n        this.ctx.translate(this.offset.x + (tileCenter.x - rotationalOffset.x * 0 + targetTextureOffset.x * 0.0) * this.scale.x, this.offset.y + (tileCenter.y - rotationalOffset.y * 0 + targetTextureOffset.y * 0.0) * this.scale.y);\n        this.ctx.rotate(rotation);\n        drawutils.helpers.clipPoly(this.ctx, {\n            x: (-targetCenterDifference.x * 1 - tileCenter.x - rotationalOffset.x) * this.scale.x,\n            y: (-targetCenterDifference.y * 1 - tileCenter.y - rotationalOffset.y) * this.scale.y\n        }, this.scale, polygon.vertices);\n        this.ctx.drawImage(textureImage, 0, 0, textureImage.naturalWidth - 1, // There is this horrible Safari bug (fixed in newer versions)\n        textureImage.naturalHeight - 1, // To avoid errors substract 1 here.\n        (-polygonPosition.x + targetTextureOffset.x * 1 - rotationalOffset.x * 1) * this.scale.x, (-polygonPosition.y + targetTextureOffset.y * 1 - rotationalOffset.y * 1) * this.scale.y, targetTextureSize.x * this.scale.x, targetTextureSize.y * this.scale.y);\n        // const scaledTextureSize = new Bounds(\n        //   new Vertex(\n        //     -polygonPosition.x + targetTextureOffset.x - rotationalOffset.x,\n        //     -polygonPosition.y + targetTextureOffset.y - rotationalOffset.y\n        //   ).scaleXY(this.scale, rotationCenter),\n        //   new Vertex(\n        //     -polygonPosition.x + targetTextureOffset.x - rotationalOffset.x + targetTextureSize.x,\n        //     -polygonPosition.y + targetTextureOffset.y - rotationalOffset.y + targetTextureSize.y\n        //   ).scaleXY(this.scale, rotationCenter)\n        // );\n        // this.ctx.drawImage(\n        //   textureImage,\n        //   0,\n        //   0,\n        //   textureImage.naturalWidth - 1, // There is this horrible Safari bug (fixed in newer versions)\n        //   textureImage.naturalHeight - 1, // To avoid errors substract 1 here.\n        //   scaledTextureSize.min.x,\n        //   scaledTextureSize.min.y,\n        //   scaledTextureSize.width,\n        //   scaledTextureSize.height\n        // );\n        this.ctx.restore();\n    }\n    /**\n     * Draw a rectangle.\n     *\n     * @param {XYCoords} 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    rect(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    // | 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    _fillOrDraw(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     * 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    cubicBezier(startPoint, endPoint, startControlPoint, endControlPoint, color, lineWidth) {\n        if (startPoint instanceof 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     * 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    quadraticBezier(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     * 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    cubicBezierPath(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     * 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    handle(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     * 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    handleLine(startPoint, endPoint) {\n        // Draw handle lines\n        this.line(startPoint, endPoint, \"rgb(192,192,192)\");\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    dot(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     * 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    point(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     * 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    circle(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       * 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    circleArc(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     * 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     * @param {number=} rotation - (optional, default=0) The rotation of the ellipse.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    ellipse(center, radiusX, radiusY, color, lineWidth, rotation) {\n        if (typeof rotation === \"undefined\") {\n            rotation = 0.0;\n        }\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, rotation, 0.0, Math.PI * 2);\n        this.ctx.closePath();\n        this.ctx.lineWidth = lineWidth || 1;\n        this._fillOrDraw(color);\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 {XYCoords} center - The center of the square.\n     * @param {number} 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    square(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     * 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    grid(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     * 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    raster(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     * 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    diamondHandle(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     * 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    squareHandle(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     * 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    circleHandle(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     * 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     * @param {number=0.5} lineWidth - (optional, default=0.5) The line width to use.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    crosshair(center, radius, color, lineWidth) {\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 = lineWidth || 0.5;\n        this.ctx.stroke();\n        this.ctx.closePath();\n        this.ctx.restore();\n    }\n    /**\n     * Draw a cross with diagonal axes with given radius, color and lineWidth at the given position.<br>\n     * <br>\n     * Note that the x's 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     * @param {number=1} lineWidth - (optional, default=1.0) The line width to use.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    cross(center, radius, color, lineWidth) {\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 - radius);\n        this.ctx.lineTo(this.offset.x + center.x * this.scale.x + radius, this.offset.y + center.y * this.scale.y + radius);\n        this.ctx.moveTo(this.offset.x + center.x * this.scale.x - radius, this.offset.y + center.y * this.scale.y + radius);\n        this.ctx.lineTo(this.offset.x + center.x * this.scale.x + radius, this.offset.y + center.y * this.scale.y - radius);\n        this.ctx.strokeStyle = color;\n        this.ctx.lineWidth = lineWidth || 1.0;\n        this.ctx.stroke();\n        this.ctx.closePath();\n        this.ctx.restore();\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    polygon(polygon, color, lineWidth) {\n        this.polyline(polygon.vertices, polygon.isOpen, color, lineWidth);\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    polyline(vertices, isOpen, color, lineWidth) {\n        if (vertices.length <= 1) {\n            return;\n        }\n        this.ctx.save();\n        this.ctx.beginPath();\n        this.ctx.lineWidth = (lineWidth || 1.0) * this.scale.x;\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)\n            // && 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     * Draw a text at the given relative position.\n     *\n     * @method text\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 {string=} options.color - The Color to use.\n     * @param {string=} options.fontFamily - The font family to use.\n     * @param {number=} options.fontSize - The font size (in pixels) to use.\n     * @param {FontStyle=} options.fontStyle - The font style to use.\n     * @param {FontWeight=} options.fontWeight - The font weight to use.\n     * @param {number=} options.lineHeight - The line height (in pixels) to use.\n     * @param {number=} options.rotation - The (optional) rotation in radians.\n     * @param {string=} options.textAlign - The text align to use. According to the specifiactions (https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/textAlign) valid values are `\"left\" || \"right\" || \"center\" || \"start\" || \"end\"`.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    text(text, x, y, options) {\n        // See https://stackoverflow.com/a/23523697\n        var _a, _b, _c;\n        options = options || {};\n        this.ctx.save();\n        let relX = this.offset.x + x * this.scale.x;\n        let relY = this.offset.y + y * this.scale.y;\n        const color = options.color || \"black\";\n        if (options.fontSize || options.fontFamily) {\n            // Scaling of text only works in uniform mode\n            this.ctx.font =\n                (options.fontWeight ? options.fontWeight + \" \" : \"\") +\n                    (options.fontStyle ? options.fontStyle + \" \" : \"\") +\n                    (options.fontSize ? options.fontSize * this.scale.x + \"px \" : \" \") +\n                    (options.fontFamily\n                        ? options.fontFamily.indexOf(\" \") === -1\n                            ? options.fontFamily\n                            : `\"${options.fontFamily}\"`\n                        : \"Arial\");\n        }\n        if (options.textAlign) {\n            this.ctx.textAlign = options.textAlign;\n        }\n        const rotation = (_a = options.rotation) !== null && _a !== void 0 ? _a : 0.0;\n        const lineHeight = ((_c = (_b = options.lineHeight) !== null && _b !== void 0 ? _b : options.fontSize) !== null && _c !== void 0 ? _c : 0) * this.scale.x;\n        this.ctx.translate(relX, relY);\n        this.ctx.rotate(rotation);\n        if (this.fillShapes) {\n            this.ctx.fillStyle = color;\n            this.ctx.fillText(text, 0, lineHeight / 2);\n        }\n        else {\n            this.ctx.strokeStyle = color;\n            this.ctx.strokeText(text, 0, lineHeight / 2);\n        }\n        // this.ctx.translate(-relX, -relY);\n        // this.ctx.rotate(-rotation); // is this necessary before 'restore()'?\n        this.ctx.restore();\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    label(text, x, y, rotation, color) {\n        this.ctx.save();\n        this.ctx.font = \"lighter 9pt Arial\";\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     * Draw an SVG-like path given by the specified path data.\n     *\n     *\n     * @method path\n     * @param {SVGPathData} pathData - An array of path commands and params.\n     * @param {string=null} color - (optional) The color to draw this path with (default is null).\n     * @param {number=1} lineWidth - (optional) the line width to use (default is 1).\n     * @param {boolean=false} options.inplace - (optional) If set to true then path transforamtions (scale and translate) will be done in-place in the array. This can boost the performance.\n     * @instance\n     * @memberof drawutils\n     * @return {R} An instance representing the drawn path.\n     */\n    path(pathData, color, lineWidth, options) {\n        const d = options && options.inplace ? pathData : drawutilssvg.copyPathData(pathData);\n        drawutilssvg.transformPathData(d, this.offset, this.scale);\n        if (color) {\n            this.ctx.strokeStyle = color;\n        }\n        this.ctx.lineWidth = lineWidth || 1;\n        if (this.fillShapes) {\n            if (color) {\n                this.ctx.fillStyle = color;\n            }\n            this.ctx.fill(new Path2D(d.join(\" \")));\n        }\n        else {\n            if (color) {\n                this.ctx.strokeStyle = color;\n            }\n            this.ctx.stroke(new Path2D(d.join(\" \")));\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    clear(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}\ndrawutils.helpers = {\n    // A helper function to define the clipping path.\n    // This could be a candidate for the draw library.\n    clipPoly: (ctx, offset, scale, vertices) => {\n        ctx.beginPath();\n        // Set clip mask\n        ctx.moveTo(offset.x + vertices[0].x * scale.x, offset.y + vertices[0].y * scale.y);\n        for (var i = 1; i < vertices.length; i++) {\n            const vert = vertices[i];\n            ctx.lineTo(offset.x + vert.x * scale.x, offset.y + vert.y * scale.y);\n        }\n        ctx.closePath();\n        ctx.clip();\n    }\n};\n//# sourceMappingURL=draw.js.map","/**\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 * @modified 2021-05-31 Added the `setConfiguration` function from `DrawLib`.\n * @modified 2022-02-03 Added the `lineWidth` param to the `crosshair` function.\n * @modified 2022-02-03 Added the `cross(...)` function.\n * @modified 2022-03-27 Added the `texturedPoly` function.\n * @modified 2022-07-26 Adding `alpha` to the `image(...)` function.\n * @modified 2023-02-10 The methods `setCurrentClassName` and `setCurrentId` also accept `null` now.\n * @version  0.0.9\n **/\nimport { Vertex } from \"./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 */\nexport class drawutilsgl {\n    /**\n     * The constructor.\n     *\n     * @constructor\n     * @name drawutils\n     * @param {WebGLRenderingContext|null} context - The drawing context.\n     * @param {boolean} fillShaped - Indicates if the constructed drawutils should fill all drawn shapes (if possible).\n     **/\n    constructor(context, fillShapes) {\n        this.gl = context;\n        this.offset = new Vertex(0, 0);\n        this.scale = new 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    _x2rel(x) {\n        return ((this.scale.x * x + this.offset.x) / this.gl.canvas.width) * 2.0 - 1.0;\n    }\n    _y2rel(y) {\n        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    copyInstance(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     * Called before each draw cycle.\n     * @param {number} renderTime\n     **/\n    beginDrawCycle(renderTime) {\n        this._zindex = 0.0;\n        this.renderTime = renderTime;\n    }\n    /**\n     * Called after each draw cycle.\n     *\n     * This is required for compatibility with other draw classes in the library (like drawgl).\n     *\n     * @name endDrawCycle\n     * @method\n     * @param {number} renderTime\n     * @instance\n     **/\n    endDrawCycle(renderTime) {\n        // NOOP\n    }\n    /**\n     * Set the current drawlib configuration.\n     *\n     * @name setConfiguration\n     * @method\n     * @param {DrawLibConfiguration} configuration - The new configuration settings to use for the next render methods.\n     */\n    setConfiguration(configuration) {\n        // TODO\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|null} uid - A UID identifying the currently drawn element(s).es.\n     **/\n    setCurrentId(uid) {\n        // NOOP\n        this.curId = uid;\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|null} className - A class name for further custom use cases.\n     **/\n    setCurrentClassName(className) {\n        // NOOP\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    line(zA, zB, color) {\n        const 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        let uRotationVector = this.gl.getUniformLocation(this._program, \"uRotationVector\");\n        // let radians = currentAngle * Math.PI / 180.0;\n        let 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     * 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    arrow(zA, zB, color) {\n        // NOT YET IMPLEMENTED\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     * @param {number=0.0} alpha - (optional, default=0.0) The transparency (0.0=opaque, 1.0=transparent).\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     **/\n    image(image, position, size, alpha = 0.0) {\n        // NOT YET IMPLEMENTED\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 texturedPoly\n     * @param {Image} textureImage - The image object to draw.\n     * @param {Bounds} textureSize - The texture size to use; these are the original bounds to map the polygon vertices to.\n     * @param {Polygon} polygon - The polygon to use as clip path.\n     * @param {Vertex} polygonPosition - The polygon's position (relative), measured at the bounding box's center.\n     * @param {number} rotation - The rotation to use for the polygon (and for the texture).\n     * @return {void}\n     * @instance\n     * @memberof drawutilsgl\n     **/\n    texturedPoly(textureImage, textureSize, polygon, polygonPosition, rotation) {\n        // NOT YET IMPLEMENTED\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    _fillOrDraw(color) {\n        // NOT YET IMPLEMENTED\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    cubicBezier(startPoint, endPoint, startControlPoint, endControlPoint, color, lineWidth) {\n        // NOT YET IMPLEMENTED\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    cubicBezierPath(path, color, lineWidth) {\n        // NOT YET IMPLEMENTED\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    handle(startPoint, endPoint) {\n        // NOT YET IMPLEMENTED\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    handleLine(startPoint, endPoint) {\n        // NOT YET IMPLEMENTED\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    dot(p, color) {\n        // NOT YET IMPLEMENTED\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    point(p, color) {\n        // NOT YET IMPLEMENTED\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    circle(center, radius, color, lineWidth) {\n        // NOT YET IMPLEMENTED\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    circleArc(center, radius, startAngle, endAngle, color, lineWidth) {\n        // NOT YET IMPLEMENTED\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     * @param {number=} rotation - (optional, default=0) The rotation of the ellipse.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    ellipse(center, radiusX, radiusY, color, lineWidth, rotation) {\n        // NOT YET IMPLEMENTED\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 {XYCords} 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    square(center, size, color, lineWidth) {\n        // NOT YET IMPLEMENTED\n    }\n    /**\n     * Draw a rectangle.\n     *\n     * @param {XYCoords} 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    rect(position, width, height, color, lineWidth) {\n        // NOT YET IMPLEMENTED\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    grid(center, width, height, sizeX, sizeY, color) {\n        // NOT YET IMPLEMENTED\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    raster(center, width, height, sizeX, sizeY, color) {\n        // NOT YET IMPLEMENTED\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    diamondHandle(center, size, color) {\n        // NOT YET IMPLEMENTED\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    squareHandle(center, size, color) {\n        // NOT YET IMPLEMENTED\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    circleHandle(center, size, color) {\n        // NOT YET IMPLEMENTED\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     * @param {number=0.5} lineWidth - (optional, default=0.5) The line width to use.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    crosshair(center, radius, color, lineWidth) {\n        // NOT YET IMPLEMENTED\n    }\n    /**\n     * Draw a cross with diagonal axes with given radius, color and lineWidth at the given position.<br>\n     * <br>\n     * Note that the x's 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     * @param {number=1} lineWidth - (optional, default=1.0) The line width to use.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    cross(center, radius, color, lineWidth) {\n        // NOT YET IMPLEMENTED\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    polygon(polygon, color, lineWidth) {\n        const 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        let uRotationVector = this.gl.getUniformLocation(this._program, \"uRotationVector\");\n        // let radians = currentAngle * Math.PI / 180.0;\n        let 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     * 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    polyline(vertices, isOpen, color, lineWidth) {\n        // NOT YET IMPLEMENTED\n    }\n    /**\n     * Draw a text at the given relative position.\n     *\n     * @method text\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 {string=} options.color - The Color to use.\n     * @param {string=} options.fontFamily - The font family to use.\n     * @param {number=} options.fontSize - The font size (in pixels) to use.\n     * @param {FontStyle=} options.fontStyle - The font style to use.\n     * @param {FontWeight=} options.fontWeight - The font weight to use.\n     * @param {number=} options.lineHeight - The line height (in pixels) to use.\n     * @param {number=} options.rotation - The (optional) rotation in radians.\n     * @param {string=} options.textAlign - The text align to use. According to the specifiactions (https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/textAlign) valid values are `\"left\" || \"right\" || \"center\" || \"start\" || \"end\"`.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    text(text, x, y, options) {\n        // NOT YET IMPLEMENTED\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     * @param {string=\"black\"} color - The color to use (default is black).\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    label(text, x, y, rotation, color) {\n        // NOT YET IMPLEMENTED\n    }\n    /**\n     * Draw an SVG-like path given by the specified path data.\n     *\n     * @method path\n     * @param {SVGPathData} pathData - An array of path commands and params.\n     * @param {string=null} color - (optional) The color to draw this path with (default is null).\n     * @param {number=1} lineWidth - (optional) the line width to use (default is 1).\n     * @param {boolean=false} options.inplace - (optional) If set to true then path transforamtions (scale and translate) will be done in-place in the array. This can boost the performance.\n     * @instance\n     * @memberof drawutils\n     * @return {R} An instance representing the drawn path.\n     */\n    path(pathData, color, lineWidth, options) {\n        // NOT YET IMPLEMENTED\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    clear(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\ndrawutilsgl.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\ndrawutilsgl.fragCode = `\n    precision highp float;\n\n    void main(void) {\n\tgl_FragColor = vec4(0.0,0.75,1.0,1.0);\n    }`;\n/**\n * Some GL helper utils.\n **/\nclass GLU {\n    constructor(gl) {\n        this.gl = gl;\n    }\n    bufferData(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    /*=================== Shaders ====================*/\n    compileShader(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        const 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    makeProgram(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//# sourceMappingURL=drawgl.js.map","/**\n * Draws elements into an SVG node.\n *\n * Note that this library uses buffers and draw cycles. To draw onto an SVG canvas, do this:\n *   const drawLib = new drawutilssvg( svgNode, ... );\n *   const fillLib = drawLib.copyInstance(true);\n *   // Begin draw cycle\n *   drawLib.beginDrawCycle(time);\n *   // ... draw or fill your stuff ...\n *   drawLib.endDrawCycle(time); // Here the elements become visible\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 * @modified 2021-02-19 Added the static helper function `transformPathData(...)` for svg path transformations (scale and translate).\n * @modified 2021-02-22 Added the static helper function `copyPathData(...)`.\n * @modified 2021-02-22 Added the `path` drawing function to draw SVG path data.\n * @modified 2021-03-01 Fixed a bug in the `clear` function (curClassName was not cleared).\n * @modified 2021-03-29 Fixed a bug in the `text` function (second y param was wrong, used x here).\n * @modified 2021-03-29 Moved this file from `src/ts/utils/helpers/` to `src/ts/`.\n * @modified 2021-03-31 Added 'ellipseSector' the the class names.\n * @modified 2021-03-31 Implemented buffering using a buffer <g> node and the beginDrawCycle and endDrawCycle methods.\n * @modified 2021-05-31 Added the `setConfiguration` function from `DrawLib`.\n * @modified 2021-11-15 Adding more parameters tot the `text()` function: fontSize, textAlign, fontFamily, lineHeight.\n * @modified 2021-11-19 Fixing the `label(text,x,y)` position.\n * @modified 2021-11-19 Added the `color` param to the `label(...)` function.\n * @modified 2022-02-03 Added the `lineWidth` param to the `crosshair` function.\n * @modified 2022-02-03 Added the `cross(...)` function.\n * @modified 2022-03-26 Added the private `nodeDefs` and `bufferedNodeDefs` attributes.\n * @modified 2022-03-26 Added the `texturedPoly` function to draw textures polygons.\n * @modified 2022-07-26 Adding `alpha` to the `image(...)` function.\n * @modified 2022-11-10 Tweaking some type issues.\n * @modified 2023-02-04 Fixed a typo in the CSS classname for cubic Bézier paths: cubicBezier (was cubierBezier).\n * @modified 2023-02-10 The methods `setCurrentClassName` and `setCurrentId` also accept `null` now.\n * @version  1.6.4\n **/\nimport { CircleSector } from \"./CircleSector\";\nimport { CubicBezierCurve } from \"./CubicBezierCurve\";\nimport { Vertex } from \"./Vertex\";\nimport { UIDGenerator } from \"./UIDGenerator\";\nconst RAD_TO_DEG = 180 / Math.PI;\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 */\nexport class drawutilssvg {\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 {SVGGElement=} gNode - (optional) Primary and seconday instances share the same &lt;g> node.\n     **/\n    constructor(svgNode, offset, scale, canvasSize, fillShapes, drawConfig, isSecondary, gNode, bufferGNode, nodeDefs, bufferNodeDefs) {\n        this.svgNode = svgNode;\n        this.offset = new Vertex(0, 0).set(offset);\n        this.scale = new Vertex(1, 1).set(scale);\n        this.fillShapes = fillShapes;\n        this.isSecondary = Boolean(isSecondary);\n        this.drawlibConfiguration = {};\n        this.cache = new Map();\n        this.setSize(canvasSize);\n        if (isSecondary) {\n            this.gNode = gNode;\n            this.bufferGNode = bufferGNode;\n            this.nodeDefs = nodeDefs;\n            this.bufferedNodeDefs = bufferNodeDefs;\n        }\n        else {\n            this.addStyleDefs(drawConfig);\n            this.addDefsNode();\n            this.gNode = this.createSVGNode(\"g\");\n            this.bufferGNode = this.createSVGNode(\"g\");\n            this.svgNode.appendChild(this.gNode);\n        }\n    }\n    /**\n     * Adds a default style defintion based on the passed DrawConfig.\n     * Twaek the draw config to change default colors or line thicknesses.\n     *\n     * @param {DrawConfig} drawConfig\n     */\n    addStyleDefs(drawConfig) {\n        this.nodeStyle = this.createSVGNode(\"style\");\n        this.svgNode.appendChild(this.nodeStyle);\n        // Which default styles to add? -> All from the DrawConfig.\n        // Compare with DrawConfig interface\n        const keys = {\n            // \"bezier\": \"CubicBezierCurve\", // TODO: is this correct?\n            \"bezierPath\": \"BezierPath\",\n            \"polygon\": \"Polygon\",\n            \"triangle\": \"Triangle\",\n            \"ellipse\": \"Ellipse\",\n            \"ellipseSector\": \"EllipseSector\",\n            \"circle\": \"Circle\",\n            \"circleSector\": \"CircleSector\",\n            \"vertex\": \"Vertex\",\n            \"line\": \"Line\",\n            \"vector\": \"Vector\",\n            \"image\": \"Image\",\n            \"text\": \"Text\"\n        };\n        // Question: why isn't this working if the svgNode is created dynamically? (nodeStyle.sheet is null)\n        const rules = [];\n        for (var k in keys) {\n            const className = keys[k];\n            const drawSettings = drawConfig[k];\n            if (drawSettings) {\n                rules.push(`.${className} { fill : none; stroke: ${drawSettings.color}; stroke-width: ${drawSettings.lineWidth}px }`);\n            }\n            else {\n                console.warn(`Warning: your draw config is missing the key '${k}' which is required.`);\n            }\n        }\n        this.nodeStyle.innerHTML = rules.join(\"\\n\");\n    }\n    /**\n     * Adds the internal <defs> node.\n     */\n    addDefsNode() {\n        this.nodeDefs = this.createSVGNode(\"defs\");\n        // this.svgNode.appendChild(this.nodeDefs);\n        this.bufferedNodeDefs = this.createSVGNode(\"defs\");\n        this.svgNode.appendChild(this.nodeDefs);\n    }\n    /**\n     * This is a simple way to include custom CSS class mappings to the style defs of the generated SVG.\n     *\n     * The mapping should be of the form\n     *   [style-class] -> [style-def-string]\n     *\n     * Example:\n     *   \"rect.red\" -> \"fill: #ff0000; border: 1px solid red\"\n     *\n     * @param {Map<string,string>} defs\n     */\n    addCustomStyleDefs(defs) {\n        const buffer = [];\n        defs.forEach((value, key) => {\n            buffer.push(key + \" { \" + value + \" }\");\n        });\n        this.nodeStyle.innerHTML += \"\\n/* Custom styles */\\n\" + buffer.join(\"\\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    findElement(key, nodeName) {\n        if (!key) {\n            return null;\n        }\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    createSVGNode(nodeName) {\n        return document.createElementNS(\"http://www.w3.org/2000/svg\", nodeName);\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    makeNode(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        if (this.drawlibConfiguration.blendMode) {\n            node.style[\"mix-blend-mode\"] = this.drawlibConfiguration.blendMode;\n        }\n        return node;\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    _bindFillDraw(node, className, color, lineWidth) {\n        if (this.curClassName) {\n            node.setAttribute(\"class\", `${className} ${this.curClassName}`);\n        }\n        else {\n            node.setAttribute(\"class\", className);\n        }\n        node.setAttribute(\"fill\", this.fillShapes && color ? color : \"none\");\n        node.setAttribute(\"stroke\", this.fillShapes ? \"none\" : color || \"none\");\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.bufferGNode.appendChild(node);\n        }\n        return node;\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    setSize(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     * 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    copyInstance(fillShapes) {\n        var copy = new drawutilssvg(this.svgNode, this.offset, this.scale, this.canvasSize, fillShapes, null, // no DrawConfig\n        true, // isSecondary\n        this.gNode, this.bufferGNode, this.nodeDefs, this.bufferedNodeDefs);\n        return copy;\n    }\n    /**\n     * Set the current drawlib configuration.\n     *\n     * @name setConfiguration\n     * @method\n     * @param {DrawLibConfiguration} configuration - The new configuration settings to use for the next render methods.\n     */\n    setConfiguration(configuration) {\n        this.drawlibConfiguration = configuration;\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|null} uid - A UID identifying the currently drawn element(s).\n     * @instance\n     * @memberof drawutilssvg\n     **/\n    setCurrentId(uid) {\n        this.curId = uid;\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|null} className - A class name for further custom use cases.\n     * @instance\n     * @memberof drawutilssvg\n     **/\n    setCurrentClassName(className) {\n        this.curClassName = className;\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    beginDrawCycle(renderTime) {\n        // Clear non-recycable elements from last draw cycle.\n        this.cache.clear();\n        // Clearing an SVG is equivalent to removing all its child elements.\n        for (var i = 0; i < this.bufferGNode.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.bufferGNode.childNodes[i];\n            this.cache.set(child.getAttribute(\"id\"), child);\n        }\n        this.removeAllChildNodes();\n    }\n    /**\n     * Called after each draw cycle.\n     *\n     * This is required for compatibility with other draw classes in the library (like drawgl).\n     *\n     * @name endDrawCycle\n     * @method\n     * @param {number} renderTime\n     * @instance\n     **/\n    endDrawCycle(renderTime) {\n        if (!this.isSecondary) {\n            // All elements are drawn into the buffer; they are NOT yet visible, not did the browser perform any\n            // layout updates.\n            // Replace the old <g>-node with the buffer node.\n            //   https://stackoverflow.com/questions/27442464/how-to-update-a-svg-image-without-seeing-a-blinking\n            this.svgNode.replaceChild(this.bufferedNodeDefs, this.nodeDefs);\n            this.svgNode.replaceChild(this.bufferGNode, this.gNode);\n        }\n        const tmpGNode = this.gNode;\n        this.gNode = this.bufferGNode;\n        this.bufferGNode = tmpGNode;\n        const tmpDefsNode = this.nodeDefs;\n        this.nodeDefs = this.bufferedNodeDefs;\n        this.bufferedNodeDefs = tmpDefsNode;\n    }\n    _x(x) {\n        return this.offset.x + this.scale.x * x;\n    }\n    _y(y) {\n        return this.offset.y + this.scale.y * y;\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=1} lineWidth? - [optional] The line's width.\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     **/\n    line(zA, zB, color, lineWidth) {\n        const 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     * 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    arrow(zA, zB, color, lineWidth) {\n        const node = this.makeNode(\"path\");\n        var headlen = 8; // length of head in pixels\n        var vertices = Vertex.utils.buildArrowHead(zA, zB, headlen, this.scale.x, this.scale.y);\n        const d = [\"M\", this._x(zA.x), this._y(zA.y)];\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     * 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     * @param {number=0.0} alpha - (optional, default=0.0) The transparency (1.0=opaque, 0.0=transparent).\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     **/\n    image(image, position, size, alpha = 1.0) {\n        const node = this.makeNode(\"image\");\n        // We need to re-adjust the image if it was not yet fully loaded before.\n        const setImageSize = (image) => {\n            if (image.naturalWidth) {\n                const ratioX = size.x / image.naturalWidth;\n                const 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                // if (alpha) {\n                node.setAttribute(\"opacity\", `${alpha}`);\n                // }\n                node.setAttribute(\"transform\", `translate(${this._x(position.x)} ${this._y(position.y)}) scale(${ratioX} ${ratioY})`);\n            }\n        };\n        image.addEventListener(\"load\", event => {\n            setImageSize(image);\n        });\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     * 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 texturedPoly\n     * @param {Image} textureImage - The image object to draw.\n     * @param {Bounds} textureSize - The texture size to use; these are the original bounds to map the polygon vertices to.\n     * @param {Polygon} polygon - The polygon to use as clip path.\n     * @param {Vertex} polygonPosition - The polygon's position (relative), measured at the bounding box's center.\n     * @param {number} rotation - The rotation to use for the polygon (and for the texture).\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     **/\n    texturedPoly(textureImage, textureSize, polygon, polygonPosition, rotation) {\n        const basePolygonBounds = polygon.getBounds();\n        const rotatedScalingOrigin = new Vertex(textureSize.min).clone().rotate(rotation, polygonPosition);\n        const rotationCenter = polygonPosition.clone().add(rotatedScalingOrigin.difference(textureSize.min).inv());\n        // Create something like this\n        // ...\n        //    <defs>\n        //       <clipPath id=\"shape\">\n        //         <path fill=\"none\" d=\"...\"/>\n        //       </clipPath>\n        //    </defs>\n        //    ...\n        //    <g clip-path=\"url(#shape)\">\n        //       <g transform=\"scale(...)\">\n        //          <image width=\"643\" height=\"643\" transform=\"rotate(...)\" xlink:href=\"https://s3-us-west-2.amazonaws.com/s.cdpn.io/222579/beagle400.jpg\" >\n        //       </g>\n        //    </g>\n        //    </image>\n        // ...\n        const clipPathNode = this.makeNode(\"clipPath\");\n        const clipPathId = `clippath_${UIDGenerator.next()}`; // TODO: use a better UUID generator here?\n        clipPathNode.setAttribute(\"id\", clipPathId);\n        const gNode = this.makeNode(\"g\");\n        const imageNode = this.makeNode(\"image\");\n        imageNode.setAttribute(\"x\", `${this._x(rotatedScalingOrigin.x)}`);\n        imageNode.setAttribute(\"y\", `${this._y(rotatedScalingOrigin.y)}`);\n        imageNode.setAttribute(\"width\", `${textureSize.width}`);\n        imageNode.setAttribute(\"height\", `${textureSize.height}`);\n        imageNode.setAttribute(\"href\", textureImage.src);\n        // imageNode.setAttribute(\"opacity\", \"0.5\");\n        // SVG rotations in degrees\n        imageNode.setAttribute(\"transform\", `rotate(${rotation * RAD_TO_DEG}, ${this._x(rotatedScalingOrigin.x)}, ${this._y(rotatedScalingOrigin.y)})`);\n        const pathNode = this.makeNode(\"path\");\n        const pathData = [];\n        if (polygon.vertices.length > 0) {\n            const self = this;\n            pathData.push(\"M\", `${this._x(polygon.vertices[0].x)}`, `${this._y(polygon.vertices[0].y)}`);\n            for (var i = 1; i < polygon.vertices.length; i++) {\n                pathData.push(\"L\", `${this._x(polygon.vertices[i].x)}`, `${this._y(polygon.vertices[i].y)}`);\n            }\n        }\n        pathNode.setAttribute(\"d\", pathData.join(\" \"));\n        clipPathNode.appendChild(pathNode);\n        this.bufferedNodeDefs.appendChild(clipPathNode);\n        gNode.appendChild(imageNode);\n        gNode.setAttribute(\"transform-origin\", `${this._x(rotatedScalingOrigin.x)} ${this._y(rotatedScalingOrigin.y)}`);\n        gNode.setAttribute(\"transform\", `scale(${this.scale.x}, ${this.scale.y})`);\n        const clipNode = this.makeNode(\"g\");\n        clipNode.appendChild(gNode);\n        clipNode.setAttribute(\"clip-path\", `url(#${clipPathId})`);\n        // TODO: check if the image class is correct here or if we should use a 'clippedImage' class here\n        this._bindFillDraw(clipNode, \"image\", null, null); // No color, no lineWidth\n        return clipNode;\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    cubicBezier(startPoint, endPoint, startControlPoint, endControlPoint, color, lineWidth) {\n        if (startPoint instanceof CubicBezierCurve) {\n            return this.cubicBezier(startPoint.startPoint, startPoint.endPoint, startPoint.startControlPoint, startPoint.endControlPoint, color, lineWidth);\n        }\n        const node = this.makeNode(\"path\");\n        // Draw curve\n        const d = [\n            \"M\",\n            this._x(startPoint.x),\n            this._y(startPoint.y),\n            \"C\",\n            this._x(startControlPoint.x),\n            this._y(startControlPoint.y),\n            this._x(endControlPoint.x),\n            this._y(endControlPoint.y),\n            this._x(endPoint.x),\n            this._y(endPoint.y)\n        ];\n        node.setAttribute(\"d\", d.join(\" \"));\n        return this._bindFillDraw(node, \"cubicBezier\", color, lineWidth);\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    cubicBezierPath(path, color, lineWidth) {\n        const node = this.makeNode(\"path\");\n        if (!path || path.length == 0)\n            return node;\n        // Draw curve\n        const d = [\"M\", this._x(path[0].x), this._y(path[0].y)];\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     * 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    handle(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     * 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    handleLine(startPoint, endPoint) {\n        this.line(startPoint, endPoint, \"rgb(192,192,192)\");\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    dot(p, color) {\n        const node = this.makeNode(\"line\");\n        return this._bindFillDraw(node, \"dot\", color, 1);\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    point(p, color) {\n        var radius = 3;\n        const 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     * 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    circle(center, radius, color, lineWidth) {\n        // Todo: draw ellipse when scalex!=scaley\n        const 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     * 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    circleArc(center, radius, startAngle, endAngle, color, lineWidth) {\n        const node = this.makeNode(\"path\");\n        const arcData = 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     * 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     * @param {number=} rotation - (optional, default=0) The rotation of the ellipse.\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     */\n    ellipse(center, radiusX, radiusY, color, lineWidth, rotation) {\n        if (typeof rotation === \"undefined\") {\n            rotation = 0.0;\n        }\n        const 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        // node.setAttribute( 'style', `transform: rotate(${rotation} ${center.x} ${center.y})` );\n        node.setAttribute(\"transform\", `rotate(${(rotation * 180) / Math.PI} ${this._x(center.x)} ${this._y(center.y)})`);\n        return this._bindFillDraw(node, \"ellipse\", color, lineWidth || 1);\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 {XYCoords} 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    square(center, size, color, lineWidth) {\n        const 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     * Draw a rectangle.\n     *\n     * @param {XYCoords} 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    rect(position, width, height, color, lineWidth) {\n        const node = this.makeNode(\"rect\");\n        node.setAttribute(\"x\", `${this._x(position.x)}`);\n        node.setAttribute(\"y\", `${this._y(position.y)}`);\n        node.setAttribute(\"width\", `${width * this.scale.x}`);\n        node.setAttribute(\"height\", `${height * this.scale.y}`);\n        return this._bindFillDraw(node, \"rect\", color, lineWidth || 1);\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    grid(center, width, height, sizeX, sizeY, color) {\n        const node = this.makeNode(\"path\");\n        const 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     * 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    raster(center, width, height, sizeX, sizeY, color) {\n        const node = this.makeNode(\"path\");\n        const 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     * 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    diamondHandle(center, size, color) {\n        const node = this.makeNode(\"path\");\n        const d = [\n            \"M\",\n            this._x(center.x) - size / 2.0,\n            this._y(center.y),\n            \"L\",\n            this._x(center.x),\n            this._y(center.y) - size / 2.0,\n            \"L\",\n            this._x(center.x) + size / 2.0,\n            this._y(center.y),\n            \"L\",\n            this._x(center.x),\n            this._y(center.y) + size / 2.0,\n            \"Z\"\n        ];\n        node.setAttribute(\"d\", d.join(\" \"));\n        return this._bindFillDraw(node, \"diamondHandle\", color, 1);\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    squareHandle(center, size, color) {\n        const 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     * 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    circleHandle(center, radius, color) {\n        radius = radius || 3;\n        const 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     * 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     * @param {number=0.5} lineWidth - (optional, default=0.5) The line width to use.\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     */\n    crosshair(center, radius, color, lineWidth) {\n        const node = this.makeNode(\"path\");\n        const d = [\n            \"M\",\n            this._x(center.x) - radius,\n            this._y(center.y),\n            \"L\",\n            this._x(center.x) + radius,\n            this._y(center.y),\n            \"M\",\n            this._x(center.x),\n            this._y(center.y) - radius,\n            \"L\",\n            this._x(center.x),\n            this._y(center.y) + radius\n        ];\n        node.setAttribute(\"d\", d.join(\" \"));\n        return this._bindFillDraw(node, \"crosshair\", color, lineWidth || 0.5);\n    }\n    /**\n     * Draw a cross with diagonal axes with given radius, color and lineWidth at the given position.<br>\n     * <br>\n     * Note that the x's 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     * @param {number=1} lineWidth - (optional, default=1.0) The line width to use.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    cross(center, radius, color, lineWidth) {\n        const node = this.makeNode(\"path\");\n        const d = [\n            \"M\",\n            this._x(center.x) - radius,\n            this._y(center.y) - radius,\n            \"L\",\n            this._x(center.x) + radius,\n            this._y(center.y) + radius,\n            \"M\",\n            this._x(center.x) - radius,\n            this._y(center.y) + radius,\n            \"L\",\n            this._x(center.x) + radius,\n            this._y(center.y) - radius\n        ];\n        node.setAttribute(\"d\", d.join(\" \"));\n        return this._bindFillDraw(node, \"cross\", color, lineWidth || 1.0);\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    polygon(polygon, color, lineWidth) {\n        return this.polyline(polygon.vertices, polygon.isOpen, color, lineWidth);\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    polyline(vertices, isOpen, color, lineWidth) {\n        const node = this.makeNode(\"path\");\n        if (vertices.length == 0)\n            return node;\n        // Draw curve\n        const d = [\"M\", this._x(vertices[0].x), this._y(vertices[0].y)];\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, \"polygon\", color, lineWidth || 1);\n    }\n    /**\n     * Draw a text at the given relative position.\n     *\n     * @method text\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 {string=} options.color - The Color to use.\n     * @param {string=} options.fontFamily - The font family to use.\n     * @param {number=} options.fontSize - The font size (in pixels) to use.\n     * @param {FontStyle=} options.fontStyle - The font style to use.\n     * @param {FontWeight=} options.fontWeight - The font weight to use.\n     * @param {number=} options.lineHeight - The line height (in pixels) to use.\n     * @param {number=} options.rotation - The (optional) rotation in radians.\n     * @param {string=} options.textAlign - The text align to use. According to the specifiactions (https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/textAlign) valid values are `\"left\" || \"right\" || \"center\" || \"start\" || \"end\"`.\n     * @return {void}\n     * @instance\n     * @memberof drawutils\n     */\n    text(text, x, y, options) {\n        var _a, _b, _c;\n        options = options || {};\n        const color = options.color || \"black\";\n        const lineHeight = ((_b = (_a = options.lineHeight) !== null && _a !== void 0 ? _a : options.fontSize) !== null && _b !== void 0 ? _b : 0) * this.scale.x;\n        // https://www.w3.org/TR/SVG/text.html#TextAnchorProperty\n        //    start | middle | end\n        const textAlign = options.textAlign === \"left\" || options.textAlign === \"start\"\n            ? \"start\"\n            : options.textAlign === \"center\"\n                ? \"middle\"\n                : options.textAlign === \"right\" || options.textAlign === \"end\"\n                    ? \"end\"\n                    : \"start\";\n        const transformOrigin = `${this._x(x)}px ${this._y(y)}px`;\n        const translate = `translate(${this._x(x)} ${this._y(y) + lineHeight / 2})`;\n        // Safari has a transform-origin/rotation bug.\n        // It's essential to use rotate(r,x,y) here. \"rotate(r)\"\" with transform-origin(x,y) won't do the job.\n        // And rotate and translate cannot be used is combination on a text object.\n        // So wrap the text inside a <g>, translate the <g>, and rotate the text inside.\n        const rotate = options.rotation ? `rotate(${options.rotation * RAD_TO_DEG} 0 0)` : ``;\n        const node = this.makeNode(\"g\");\n        const curId = this.curId;\n        this.curId = curId + \"_text\";\n        const textNode = this.makeNode(\"text\");\n        node.appendChild(textNode);\n        textNode.setAttribute(\"font-family\", (_c = options.fontFamily) !== null && _c !== void 0 ? _c : \"\"); // May be undefined\n        textNode.setAttribute(\"font-size\", options.fontSize ? `${options.fontSize * this.scale.x}` : \"\");\n        textNode.setAttribute(\"font-style\", options.fontStyle ? `${options.fontStyle}` : \"\");\n        textNode.setAttribute(\"font-weight\", options.fontWeight ? `${options.fontWeight}` : \"\");\n        textNode.setAttribute(\"text-anchor\", textAlign);\n        textNode.setAttribute(\"transform-origin\", \"0 0\");\n        textNode.setAttribute(\"transform\", rotate);\n        node.setAttribute(\"transform-origin\", transformOrigin);\n        node.setAttribute(\"transform\", translate);\n        textNode.innerHTML = text;\n        // Restore old ID\n        this.curId = curId;\n        return this._bindFillDraw(node, \"text\", color, 1);\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     * @param {string=\"black\"} color - The color to use (default is black).\n     * @return {void}\n     * @instance\n     * @memberof drawutilssvg\n     */\n    label(text, x, y, rotation, color) {\n        const node = this.makeNode(\"text\");\n        // For some strange reason SVG rotation transforms use degrees instead of radians\n        node.setAttribute(\"transform\", `translate(${x},${y}), rotate(${((rotation || 0) / Math.PI) * 180})`);\n        node.setAttribute(\"font-family\", \"Arial\");\n        node.setAttribute(\"font-size\", \"9pt\");\n        node.setAttribute(\"font-style\", \"normal\");\n        node.setAttribute(\"font-weight\", \"lighter\");\n        node.innerHTML = text;\n        return this._bindFillDraw(node, \"label\", color || \"black\", null);\n    }\n    /**\n     * Draw an SVG-like path given by the specified path data.\n     *\n     * @method path\n     * @param {SVGPathData} pathData - An array of path commands and params.\n     * @param {string=null} color - (optional) The color to draw this path with (default is null).\n     * @param {number=1} lineWidth - (optional) the line width to use (default is 1).\n     * @param {boolean=false} options.inplace - (optional) If set to true then path transforamtions (scale and translate) will be done in-place in the array. This can boost the performance.\n     * @instance\n     * @memberof drawutils\n     * @return {R} An instance representing the drawn path.\n     */\n    path(pathData, color, lineWidth, options) {\n        const node = this.makeNode(\"path\");\n        // Transform the path: in-place (fast) or copy (slower)\n        const d = options && options.inplace ? pathData : drawutilssvg.copyPathData(pathData);\n        drawutilssvg.transformPathData(d, this.offset, this.scale);\n        node.setAttribute(\"d\", d.join(\" \"));\n        return this._bindFillDraw(node, \"path\", color, lineWidth);\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    clear(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        // Add a covering rect with the given background color\n        this.curId = \"background\";\n        this.curClassName = undefined;\n        const 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    }\n    /**\n     * A private helper function to clear all SVG nodes from the &gt;g> node.\n     *\n     * @private\n     */\n    removeAllChildNodes() {\n        while (this.bufferGNode.lastChild) {\n            this.bufferGNode.removeChild(this.bufferGNode.lastChild);\n        }\n        while (this.bufferedNodeDefs.lastChild) {\n            this.bufferedNodeDefs.removeChild(this.bufferedNodeDefs.lastChild);\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    static createSvg() {\n        return document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n    }\n    /**\n     * Create a copy of the given path data. As path data only consists of strings and numbers,\n     * the copy will be shallow by definition.\n     *\n     * @name copyPathData\n     * @static\n     * @memberof drawutilssvg\n     */\n    static copyPathData(data) {\n        const copy = new Array(data.length);\n        for (var i = 0, n = data.length; i < n; i++) {\n            copy[i] = data[i];\n        }\n        return copy;\n    }\n    /**\n     * Transform the given path data (translate and scale. rotating is not intended here).\n     *\n     * @name transformPathData\n     * @static\n     * @memberof drawutilssvg\n     * @param {SVGPathParams} data - The data to transform.\n     * @param {XYCoords} offset - The translation offset (neutral is x=0, y=0).\n     * @param {XYCoords} scale - The scale factors (neutral is x=1, y=1).\n     */\n    static transformPathData(data, offset, scale) {\n        // Scale and translate {x,y}\n        const _stx = (index) => {\n            data[index] = offset.x + scale.x * Number(data[index]);\n        };\n        const _sty = (index) => {\n            data[index] = offset.y + scale.y * Number(data[index]);\n        };\n        // scale only {x,y}\n        const _sx = (index) => {\n            data[index] = scale.x * Number(data[index]);\n        };\n        const _sy = (index) => {\n            data[index] = scale.y * Number(data[index]);\n        };\n        var i = 0;\n        var lastPoint = { x: NaN, y: NaN };\n        // \"save last point\"\n        var _slp = (index) => {\n            lastPoint.x = Number(data[index]);\n            lastPoint.y = Number(data[index + 1]);\n        };\n        while (i < data.length) {\n            const cmd = data[i];\n            switch (cmd) {\n                case \"M\":\n                // MoveTo: M|m x y\n                case \"L\":\n                // LineTo L|l x y\n                case \"T\":\n                    // Shorthand/smooth quadratic Bézier curveto: T|t x y\n                    _stx(i + 1);\n                    _sty(i + 2);\n                    _slp(i + 1);\n                    i += 3;\n                    break;\n                case \"m\":\n                // MoveTo: M|m x y\n                case \"l\":\n                // LineTo L|l x y\n                case \"t\":\n                    // Shorthand/smooth quadratic Bézier curveto: T|t x y\n                    _sx(i + 1);\n                    _sy(i + 2);\n                    _slp(i + 1);\n                    i += 3;\n                    break;\n                case \"H\":\n                    // HorizontalLineTo: H|h x\n                    _stx(i + 1);\n                    lastPoint.x = Number(data[i + 1]);\n                    i += 2;\n                    break;\n                case \"h\":\n                    // HorizontalLineTo: H|h x\n                    _sx(i + 1);\n                    lastPoint.x = Number(data[i + 1]);\n                    i += 2;\n                    break;\n                case \"V\":\n                    // VerticalLineTo: V|v y\n                    _sty(i + 1);\n                    lastPoint.y = Number(data[i + 1]);\n                    i += 2;\n                    break;\n                case \"v\":\n                    // VerticalLineTo: V|v y\n                    _sy(i + 1);\n                    lastPoint.y = Number(data[i + 1]);\n                    i += 2;\n                    break;\n                case \"C\":\n                    // CurveTo: C|c x1 y1 x2 y2 x y\n                    _stx(i + 1);\n                    _sty(i + 2);\n                    _stx(i + 3);\n                    _sty(i + 4);\n                    _stx(i + 5);\n                    _sty(i + 6);\n                    _slp(i + 5);\n                    i += 7;\n                    break;\n                case \"c\":\n                    // CurveTo: C|c x1 y1 x2 y2 x y\n                    _sx(i + 1);\n                    _sy(i + 2);\n                    _sx(i + 3);\n                    _sy(i + 4);\n                    _sx(i + 5);\n                    _sy(i + 6);\n                    _slp(i + 5);\n                    i += 7;\n                    break;\n                case \"S\":\n                case \"Q\":\n                    // Shorthand-/SmoothCurveTo: S|s x2 y2 x y\n                    // QuadraticCurveTo: Q|q x1 y1 x y\n                    _stx(i + 1);\n                    _sty(i + 2);\n                    _stx(i + 3);\n                    _sty(i + 4);\n                    _slp(i + 3);\n                    i += 5;\n                    break;\n                case \"s\":\n                case \"q\":\n                    // Shorthand-/SmoothCurveTo: S|s x2 y2 x y\n                    // QuadraticCurveTo: Q|q x1 y1 x y\n                    _sx(i + 1);\n                    _sy(i + 2);\n                    _sx(i + 3);\n                    _sy(i + 4);\n                    _slp(i + 3);\n                    i += 5;\n                    break;\n                case \"A\":\n                    // EllipticalArcTo: A|a rx ry x-axis-rotation large-arc-flag sweep-flag x y\n                    // Uniform scale: just scale\n                    // NOTE: here is something TODO\n                    //  * if scalex!=scaleY this won't work\n                    //  * Arcs have to be converted to Bézier curves here in that case\n                    _sx(i + 1);\n                    _sy(i + 2);\n                    _stx(i + 6);\n                    _sty(i + 7);\n                    _slp(i + 6);\n                    // Update the arc flag when x _or_ y scale is negative\n                    if ((scale.x < 0 && scale.y >= 0) || (scale.x >= 0 && scale.y < 0)) {\n                        data[i + 5] = data[i + 5] ? 0 : 1;\n                    }\n                    i += 8;\n                    break;\n                case \"a\":\n                    // EllipticalArcTo: A|a rx ry x-axis-rotation large-arc-flag sweep-flag x y\n                    _sx(i + 1);\n                    _sy(i + 2);\n                    _sx(i + 6);\n                    _sy(i + 7);\n                    _slp(i + 6);\n                    i += 8;\n                    break;\n                case \"z\":\n                case \"Z\":\n                    // ClosePath: Z|z (no arguments)\n                    // lastPoint.x = firstPoint.x;\n                    // lastPoint.y = firstPoint.y;\n                    i++;\n                    break;\n                // Safepoint: continue reading token by token until something is recognized again\n                default:\n                    i++;\n            }\n        } // END while\n    } // END transformPathData\n}\ndrawutilssvg.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//# sourceMappingURL=drawutilssvg.js.map","/**\n * @author   Ikaros Kappler\n * @date     2019-02-03\n * @modified 2021-03-01 Added `wrapMax` function.\n * @version  1.1.0\n **/\nimport { Line } from \"./Line\";\nimport { Triangle } from \"./Triangle\";\n/**\n * A collection of usefull geometry utilities.\n *\n * @global\n **/\nexport const 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(pA, pB, pC, n) {\n        const triangle = new Triangle(pA, pB, pC);\n        const lineAB = new Line(pA, pB);\n        const lineAC = new 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        const 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        const lineLength = Math.max(lineAB.length(), lineAC.length());\n        const 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(pA, pB.clone().rotate((-i * (insideAngle / n)), pA)).scale(scaleFactor));\n        }\n        return result;\n    },\n    /**\n     * Wrap the value (e.g. an angle) into the given range of [0,max).\n     *\n     * @name wrapMax\n     * @param {number} x - The value to wrap.\n     * @param {number} max - The max bound to use for the range.\n     * @return {number} The wrapped value inside the range [0,max).\n     */\n    wrapMax(x, max) {\n        // Found at\n        //    https://stackoverflow.com/questions/4633177/c-how-to-wrap-a-float-to-the-interval-pi-pi\n        return (max + (x % max)) % max;\n    },\n    /**\n     * Wrap the value (e.g. an angle) into the given range of [min,max).\n     *\n     * @name wrapMinMax\n     * @param {number} x - The value to wrap.\n     * @param {number} min - The min bound to use for the range.\n     * @param {number} max - The max bound to use for the range.\n     * @return {number} The wrapped value inside the range [min,max).\n     */\n    // Currently un-used\n    wrapMinMax(x, min, max) {\n        return min + geomutils.wrapMax(x - min, max - min);\n    }\n};\n//# sourceMappingURL=geomutils.js.map","export * from \"./BezierPath\";\nexport * from \"./Bounds\";\nexport * from \"./Circle\";\nexport * from \"./CircleSector\";\nexport * from \"./CubicBezierCurve\";\nexport * from \"./draw\";\nexport * from \"./drawgl\";\nexport * from \"./drawutilssvg\";\nexport * from \"./geomutils\";\nexport * from \"./Grid\";\nexport * from \"./interfaces\";\nexport * from \"./KeyHandler\";\nexport * from \"./Line\";\nexport * from \"./MouseHandler\";\nexport * from \"./PBImage\";\nexport * from \"./PBText\";\nexport * from \"./PlotBoilerplate\";\nexport * from \"./Polygon\";\nexport * from \"./Triangle\";\nexport * from \"./UIDGenerator\";\nexport * from \"./Vector\";\nexport * from \"./VEllipse\";\nexport * from \"./VEllipseSector\";\nexport * from \"./Vertex\";\nexport * from \"./VertexAttr\";\nexport * from \"./VertexListeners\";\nexport * from \"./VertTuple\";\n//# sourceMappingURL=index.js.map","/**\n * @author Ikaros Kappler\n * @modified 2021-01-10 Added the `CanvasWrapper` interface.\n * @modified 2021-01-20 Added the `UID` type.\n * @modified 2021-01-25 Added the `DrawLib.setCurrentId` and `DrawLib.setCurrentClassName` functions.\n * @modified 2021-01-25 Fixed the `PBParams` interface (inluding DrawConfig).\n * @modified 2021-02-08 Changed the `PBParams` interface: no longer sub-interface of `DrawConfig` (all those attributes were un-used).\n * @modified 2021-02-22 Added the `path` drawing function to draw SVG path data.\n * @modified 2021-03-01 Added the `rotation` param to the DrawLib.ellipse(...) function.\n * @modified 2021-03-02 Added the `VEllipseSector` as to the `Drawable` type.\n * @modified 2021-03-29 Added the `draw` and `fill` params to the `preDraw` and `postDraw` function (required for full svg export support).\n * @modified 2021-03-30 Added the `endDrawCycle` function to `DrawLib`.\n * @modified 2021-05-31 Added the `drawLib.setConfiguration` function.\n * @modified 2021-05-31 Splitted the large interfaces.ts file into this one and others.\n * @modified 2021-11-12 Added `text()` params fontSize, fontFamily, rotation, textAlign.\n * @modified 2021-11-16 Added `text()` params fontWeight and fontStyle.\n * @modified 2021-11-19 Added the `color` param to the `label(...)` function.\n * @modified 2022-02-03 Added the `lineWidth` param to the `crosshair` function.\n * @modified 2022-02-03 Added the `cross(...)` function.\n * @modified 2022-07-26 Adding `alpha` to the `image(...)` function.\n * @modified 2023-02-10 The methods `setCurrentClassName` and `setCurrentId` also accept `null` now.\n **/\nexport {};\n//# sourceMappingURL=DrawLib.js.map","export {};\n//# sourceMappingURL=additionals.js.map","/**\n * @author Ikaros Kappler\n * @modified 2021-01-10 Added the `CanvasWrapper` interface.\n * @modified 2021-01-20 Added the `UID` type.\n * @modified 2021-01-25 Added the `DrawLib.setCurrentId` and `DrawLib.setCurrentClassName` functions.\n * @modified 2021-01-25 Fixed the `PBParams` interface (inluding DrawConfig).\n * @modified 2021-02-08 Changed the `PBParams` interface: no longer sub-interface of `DrawConfig` (all those attributes were un-used).\n * @modified 2021-02-22 Added the `path` drawing function to draw SVG path data.\n * @modified 2021-03-01 Added the `rotation` param to the DrawLib.ellipse(...) function.\n * @modified 2021-03-02 Added the `VEllipseSector` as to the `Drawable` type.\n * @modified 2021-03-29 Added the `draw` and `fill` params to the `preDraw` and `postDraw` function (required for full svg export support).\n * @modified 2021-03-30 Added the `endDrawCycle` function to `DrawLib`.\n * @modified 2021-05-31 Added the `drawLib.setConfiguration` function.\n * @modified 2021-05-31 Splitted the large interfaces.ts file into this one and others.\n * @modified 2021-06-21 Added `IBounds.getCenter()`.\n * @modified 2021-11-16 Added `text` options to the `DrawConfig`.\n * @modified 2022-08-01 Added `title` param to the `PBParams` interface.\n * @modified 2022-10-25 Added `origin` param to the `DrawConfig` interface.\n * @modified 2022-11-23 Added `drawRaster` to the `Config` interface.\n * @modified 2023-02-10 All non-function attributes of the `Config` interface are now mandatory.\n **/\nexport {};\n//# sourceMappingURL=core.js.map","/**\n * @author  Ikaros Kappler\n * @date    2021-07-00\n * @version 1.0.0\n */\nexport {};\n//# sourceMappingURL=externals.js.map","export * from \"./core\";\nexport * from \"./DrawLib\";\nexport * from \"./externals\";\nexport * from \"./additionals\";\n//# sourceMappingURL=index.js.map","// Axios v1.4.0 Copyright (c) 2023 Matt Zabriskie and contributors\n'use strict';\n\nfunction bind(fn, thisArg) {\n  return function wrap() {\n    return fn.apply(thisArg, arguments);\n  };\n}\n\n// utils is a library of generic helper functions non-specific to axios\n\nconst {toString} = Object.prototype;\nconst {getPrototypeOf} = Object;\n\nconst kindOf = (cache => thing => {\n    const str = toString.call(thing);\n    return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());\n})(Object.create(null));\n\nconst kindOfTest = (type) => {\n  type = type.toLowerCase();\n  return (thing) => kindOf(thing) === type\n};\n\nconst typeOfTest = type => thing => typeof thing === type;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n *\n * @returns {boolean} True if value is an Array, otherwise false\n */\nconst {isArray} = Array;\n\n/**\n * Determine if a value is undefined\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nconst isUndefined = typeOfTest('undefined');\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n  return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n    && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nconst isArrayBuffer = kindOfTest('ArrayBuffer');\n\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n  let result;\n  if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n    result = ArrayBuffer.isView(val);\n  } else {\n    result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));\n  }\n  return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a String, otherwise false\n */\nconst isString = typeOfTest('string');\n\n/**\n * Determine if a value is a Function\n *\n * @param {*} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nconst isFunction = typeOfTest('function');\n\n/**\n * Determine if a value is a Number\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Number, otherwise false\n */\nconst isNumber = typeOfTest('number');\n\n/**\n * Determine if a value is an Object\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an Object, otherwise false\n */\nconst isObject = (thing) => thing !== null && typeof thing === 'object';\n\n/**\n * Determine if a value is a Boolean\n *\n * @param {*} thing The value to test\n * @returns {boolean} True if value is a Boolean, otherwise false\n */\nconst isBoolean = thing => thing === true || thing === false;\n\n/**\n * Determine if a value is a plain Object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a plain Object, otherwise false\n */\nconst isPlainObject = (val) => {\n  if (kindOf(val) !== 'object') {\n    return false;\n  }\n\n  const prototype = getPrototypeOf(val);\n  return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);\n};\n\n/**\n * Determine if a value is a Date\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Date, otherwise false\n */\nconst isDate = kindOfTest('Date');\n\n/**\n * Determine if a value is a File\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFile = kindOfTest('File');\n\n/**\n * Determine if a value is a Blob\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nconst isBlob = kindOfTest('Blob');\n\n/**\n * Determine if a value is a FileList\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFileList = kindOfTest('FileList');\n\n/**\n * Determine if a value is a Stream\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nconst isStream = (val) => isObject(val) && isFunction(val.pipe);\n\n/**\n * Determine if a value is a FormData\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nconst isFormData = (thing) => {\n  let kind;\n  return thing && (\n    (typeof FormData === 'function' && thing instanceof FormData) || (\n      isFunction(thing.append) && (\n        (kind = kindOf(thing)) === 'formdata' ||\n        // detect form-data instance\n        (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')\n      )\n    )\n  )\n};\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nconst isURLSearchParams = kindOfTest('URLSearchParams');\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n *\n * @returns {String} The String freed of excess whitespace\n */\nconst trim = (str) => str.trim ?\n  str.trim() : str.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n *\n * @param {Boolean} [allOwnKeys = false]\n * @returns {any}\n */\nfunction forEach(obj, fn, {allOwnKeys = false} = {}) {\n  // Don't bother if no value provided\n  if (obj === null || typeof obj === 'undefined') {\n    return;\n  }\n\n  let i;\n  let l;\n\n  // Force an array if not already something iterable\n  if (typeof obj !== 'object') {\n    /*eslint no-param-reassign:0*/\n    obj = [obj];\n  }\n\n  if (isArray(obj)) {\n    // Iterate over array values\n    for (i = 0, l = obj.length; i < l; i++) {\n      fn.call(null, obj[i], i, obj);\n    }\n  } else {\n    // Iterate over object keys\n    const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);\n    const len = keys.length;\n    let key;\n\n    for (i = 0; i < len; i++) {\n      key = keys[i];\n      fn.call(null, obj[key], key, obj);\n    }\n  }\n}\n\nfunction findKey(obj, key) {\n  key = key.toLowerCase();\n  const keys = Object.keys(obj);\n  let i = keys.length;\n  let _key;\n  while (i-- > 0) {\n    _key = keys[i];\n    if (key === _key.toLowerCase()) {\n      return _key;\n    }\n  }\n  return null;\n}\n\nconst _global = (() => {\n  /*eslint no-undef:0*/\n  if (typeof globalThis !== \"undefined\") return globalThis;\n  return typeof self !== \"undefined\" ? self : (typeof window !== 'undefined' ? window : global)\n})();\n\nconst isContextDefined = (context) => !isUndefined(context) && context !== _global;\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n *\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n  const {caseless} = isContextDefined(this) && this || {};\n  const result = {};\n  const assignValue = (val, key) => {\n    const targetKey = caseless && findKey(result, key) || key;\n    if (isPlainObject(result[targetKey]) && isPlainObject(val)) {\n      result[targetKey] = merge(result[targetKey], val);\n    } else if (isPlainObject(val)) {\n      result[targetKey] = merge({}, val);\n    } else if (isArray(val)) {\n      result[targetKey] = val.slice();\n    } else {\n      result[targetKey] = val;\n    }\n  };\n\n  for (let i = 0, l = arguments.length; i < l; i++) {\n    arguments[i] && forEach(arguments[i], assignValue);\n  }\n  return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n *\n * @param {Boolean} [allOwnKeys]\n * @returns {Object} The resulting value of object a\n */\nconst extend = (a, b, thisArg, {allOwnKeys}= {}) => {\n  forEach(b, (val, key) => {\n    if (thisArg && isFunction(val)) {\n      a[key] = bind(val, thisArg);\n    } else {\n      a[key] = val;\n    }\n  }, {allOwnKeys});\n  return a;\n};\n\n/**\n * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)\n *\n * @param {string} content with BOM\n *\n * @returns {string} content value without BOM\n */\nconst stripBOM = (content) => {\n  if (content.charCodeAt(0) === 0xFEFF) {\n    content = content.slice(1);\n  }\n  return content;\n};\n\n/**\n * Inherit the prototype methods from one constructor into another\n * @param {function} constructor\n * @param {function} superConstructor\n * @param {object} [props]\n * @param {object} [descriptors]\n *\n * @returns {void}\n */\nconst inherits = (constructor, superConstructor, props, descriptors) => {\n  constructor.prototype = Object.create(superConstructor.prototype, descriptors);\n  constructor.prototype.constructor = constructor;\n  Object.defineProperty(constructor, 'super', {\n    value: superConstructor.prototype\n  });\n  props && Object.assign(constructor.prototype, props);\n};\n\n/**\n * Resolve object with deep prototype chain to a flat object\n * @param {Object} sourceObj source object\n * @param {Object} [destObj]\n * @param {Function|Boolean} [filter]\n * @param {Function} [propFilter]\n *\n * @returns {Object}\n */\nconst toFlatObject = (sourceObj, destObj, filter, propFilter) => {\n  let props;\n  let i;\n  let prop;\n  const merged = {};\n\n  destObj = destObj || {};\n  // eslint-disable-next-line no-eq-null,eqeqeq\n  if (sourceObj == null) return destObj;\n\n  do {\n    props = Object.getOwnPropertyNames(sourceObj);\n    i = props.length;\n    while (i-- > 0) {\n      prop = props[i];\n      if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {\n        destObj[prop] = sourceObj[prop];\n        merged[prop] = true;\n      }\n    }\n    sourceObj = filter !== false && getPrototypeOf(sourceObj);\n  } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);\n\n  return destObj;\n};\n\n/**\n * Determines whether a string ends with the characters of a specified string\n *\n * @param {String} str\n * @param {String} searchString\n * @param {Number} [position= 0]\n *\n * @returns {boolean}\n */\nconst endsWith = (str, searchString, position) => {\n  str = String(str);\n  if (position === undefined || position > str.length) {\n    position = str.length;\n  }\n  position -= searchString.length;\n  const lastIndex = str.indexOf(searchString, position);\n  return lastIndex !== -1 && lastIndex === position;\n};\n\n\n/**\n * Returns new array from array like object or null if failed\n *\n * @param {*} [thing]\n *\n * @returns {?Array}\n */\nconst toArray = (thing) => {\n  if (!thing) return null;\n  if (isArray(thing)) return thing;\n  let i = thing.length;\n  if (!isNumber(i)) return null;\n  const arr = new Array(i);\n  while (i-- > 0) {\n    arr[i] = thing[i];\n  }\n  return arr;\n};\n\n/**\n * Checking if the Uint8Array exists and if it does, it returns a function that checks if the\n * thing passed in is an instance of Uint8Array\n *\n * @param {TypedArray}\n *\n * @returns {Array}\n */\n// eslint-disable-next-line func-names\nconst isTypedArray = (TypedArray => {\n  // eslint-disable-next-line func-names\n  return thing => {\n    return TypedArray && thing instanceof TypedArray;\n  };\n})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));\n\n/**\n * For each entry in the object, call the function with the key and value.\n *\n * @param {Object<any, any>} obj - The object to iterate over.\n * @param {Function} fn - The function to call for each entry.\n *\n * @returns {void}\n */\nconst forEachEntry = (obj, fn) => {\n  const generator = obj && obj[Symbol.iterator];\n\n  const iterator = generator.call(obj);\n\n  let result;\n\n  while ((result = iterator.next()) && !result.done) {\n    const pair = result.value;\n    fn.call(obj, pair[0], pair[1]);\n  }\n};\n\n/**\n * It takes a regular expression and a string, and returns an array of all the matches\n *\n * @param {string} regExp - The regular expression to match against.\n * @param {string} str - The string to search.\n *\n * @returns {Array<boolean>}\n */\nconst matchAll = (regExp, str) => {\n  let matches;\n  const arr = [];\n\n  while ((matches = regExp.exec(str)) !== null) {\n    arr.push(matches);\n  }\n\n  return arr;\n};\n\n/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */\nconst isHTMLForm = kindOfTest('HTMLFormElement');\n\nconst toCamelCase = str => {\n  return str.toLowerCase().replace(/[-_\\s]([a-z\\d])(\\w*)/g,\n    function replacer(m, p1, p2) {\n      return p1.toUpperCase() + p2;\n    }\n  );\n};\n\n/* Creating a function that will check if an object has a property. */\nconst hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);\n\n/**\n * Determine if a value is a RegExp object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a RegExp object, otherwise false\n */\nconst isRegExp = kindOfTest('RegExp');\n\nconst reduceDescriptors = (obj, reducer) => {\n  const descriptors = Object.getOwnPropertyDescriptors(obj);\n  const reducedDescriptors = {};\n\n  forEach(descriptors, (descriptor, name) => {\n    if (reducer(descriptor, name, obj) !== false) {\n      reducedDescriptors[name] = descriptor;\n    }\n  });\n\n  Object.defineProperties(obj, reducedDescriptors);\n};\n\n/**\n * Makes all methods read-only\n * @param {Object} obj\n */\n\nconst freezeMethods = (obj) => {\n  reduceDescriptors(obj, (descriptor, name) => {\n    // skip restricted props in strict mode\n    if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {\n      return false;\n    }\n\n    const value = obj[name];\n\n    if (!isFunction(value)) return;\n\n    descriptor.enumerable = false;\n\n    if ('writable' in descriptor) {\n      descriptor.writable = false;\n      return;\n    }\n\n    if (!descriptor.set) {\n      descriptor.set = () => {\n        throw Error('Can not rewrite read-only method \\'' + name + '\\'');\n      };\n    }\n  });\n};\n\nconst toObjectSet = (arrayOrString, delimiter) => {\n  const obj = {};\n\n  const define = (arr) => {\n    arr.forEach(value => {\n      obj[value] = true;\n    });\n  };\n\n  isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));\n\n  return obj;\n};\n\nconst noop = () => {};\n\nconst toFiniteNumber = (value, defaultValue) => {\n  value = +value;\n  return Number.isFinite(value) ? value : defaultValue;\n};\n\nconst ALPHA = 'abcdefghijklmnopqrstuvwxyz';\n\nconst DIGIT = '0123456789';\n\nconst ALPHABET = {\n  DIGIT,\n  ALPHA,\n  ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT\n};\n\nconst generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {\n  let str = '';\n  const {length} = alphabet;\n  while (size--) {\n    str += alphabet[Math.random() * length|0];\n  }\n\n  return str;\n};\n\n/**\n * If the thing is a FormData object, return true, otherwise return false.\n *\n * @param {unknown} thing - The thing to check.\n *\n * @returns {boolean}\n */\nfunction isSpecCompliantForm(thing) {\n  return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);\n}\n\nconst toJSONObject = (obj) => {\n  const stack = new Array(10);\n\n  const visit = (source, i) => {\n\n    if (isObject(source)) {\n      if (stack.indexOf(source) >= 0) {\n        return;\n      }\n\n      if(!('toJSON' in source)) {\n        stack[i] = source;\n        const target = isArray(source) ? [] : {};\n\n        forEach(source, (value, key) => {\n          const reducedValue = visit(value, i + 1);\n          !isUndefined(reducedValue) && (target[key] = reducedValue);\n        });\n\n        stack[i] = undefined;\n\n        return target;\n      }\n    }\n\n    return source;\n  };\n\n  return visit(obj, 0);\n};\n\nconst isAsyncFn = kindOfTest('AsyncFunction');\n\nconst isThenable = (thing) =>\n  thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);\n\nvar utils = {\n  isArray,\n  isArrayBuffer,\n  isBuffer,\n  isFormData,\n  isArrayBufferView,\n  isString,\n  isNumber,\n  isBoolean,\n  isObject,\n  isPlainObject,\n  isUndefined,\n  isDate,\n  isFile,\n  isBlob,\n  isRegExp,\n  isFunction,\n  isStream,\n  isURLSearchParams,\n  isTypedArray,\n  isFileList,\n  forEach,\n  merge,\n  extend,\n  trim,\n  stripBOM,\n  inherits,\n  toFlatObject,\n  kindOf,\n  kindOfTest,\n  endsWith,\n  toArray,\n  forEachEntry,\n  matchAll,\n  isHTMLForm,\n  hasOwnProperty,\n  hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection\n  reduceDescriptors,\n  freezeMethods,\n  toObjectSet,\n  toCamelCase,\n  noop,\n  toFiniteNumber,\n  findKey,\n  global: _global,\n  isContextDefined,\n  ALPHABET,\n  generateString,\n  isSpecCompliantForm,\n  toJSONObject,\n  isAsyncFn,\n  isThenable\n};\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [config] The config.\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n *\n * @returns {Error} The created error.\n */\nfunction AxiosError(message, code, config, request, response) {\n  Error.call(this);\n\n  if (Error.captureStackTrace) {\n    Error.captureStackTrace(this, this.constructor);\n  } else {\n    this.stack = (new Error()).stack;\n  }\n\n  this.message = message;\n  this.name = 'AxiosError';\n  code && (this.code = code);\n  config && (this.config = config);\n  request && (this.request = request);\n  response && (this.response = response);\n}\n\nutils.inherits(AxiosError, Error, {\n  toJSON: function toJSON() {\n    return {\n      // Standard\n      message: this.message,\n      name: this.name,\n      // Microsoft\n      description: this.description,\n      number: this.number,\n      // Mozilla\n      fileName: this.fileName,\n      lineNumber: this.lineNumber,\n      columnNumber: this.columnNumber,\n      stack: this.stack,\n      // Axios\n      config: utils.toJSONObject(this.config),\n      code: this.code,\n      status: this.response && this.response.status ? this.response.status : null\n    };\n  }\n});\n\nconst prototype$1 = AxiosError.prototype;\nconst descriptors = {};\n\n[\n  'ERR_BAD_OPTION_VALUE',\n  'ERR_BAD_OPTION',\n  'ECONNABORTED',\n  'ETIMEDOUT',\n  'ERR_NETWORK',\n  'ERR_FR_TOO_MANY_REDIRECTS',\n  'ERR_DEPRECATED',\n  'ERR_BAD_RESPONSE',\n  'ERR_BAD_REQUEST',\n  'ERR_CANCELED',\n  'ERR_NOT_SUPPORT',\n  'ERR_INVALID_URL'\n// eslint-disable-next-line func-names\n].forEach(code => {\n  descriptors[code] = {value: code};\n});\n\nObject.defineProperties(AxiosError, descriptors);\nObject.defineProperty(prototype$1, 'isAxiosError', {value: true});\n\n// eslint-disable-next-line func-names\nAxiosError.from = (error, code, config, request, response, customProps) => {\n  const axiosError = Object.create(prototype$1);\n\n  utils.toFlatObject(error, axiosError, function filter(obj) {\n    return obj !== Error.prototype;\n  }, prop => {\n    return prop !== 'isAxiosError';\n  });\n\n  AxiosError.call(axiosError, error.message, code, config, request, response);\n\n  axiosError.cause = error;\n\n  axiosError.name = error.name;\n\n  customProps && Object.assign(axiosError, customProps);\n\n  return axiosError;\n};\n\n// eslint-disable-next-line strict\nvar httpAdapter = null;\n\n/**\n * Determines if the given thing is a array or js object.\n *\n * @param {string} thing - The object or array to be visited.\n *\n * @returns {boolean}\n */\nfunction isVisitable(thing) {\n  return utils.isPlainObject(thing) || utils.isArray(thing);\n}\n\n/**\n * It removes the brackets from the end of a string\n *\n * @param {string} key - The key of the parameter.\n *\n * @returns {string} the key without the brackets.\n */\nfunction removeBrackets(key) {\n  return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;\n}\n\n/**\n * It takes a path, a key, and a boolean, and returns a string\n *\n * @param {string} path - The path to the current key.\n * @param {string} key - The key of the current object being iterated over.\n * @param {string} dots - If true, the key will be rendered with dots instead of brackets.\n *\n * @returns {string} The path to the current key.\n */\nfunction renderKey(path, key, dots) {\n  if (!path) return key;\n  return path.concat(key).map(function each(token, i) {\n    // eslint-disable-next-line no-param-reassign\n    token = removeBrackets(token);\n    return !dots && i ? '[' + token + ']' : token;\n  }).join(dots ? '.' : '');\n}\n\n/**\n * If the array is an array and none of its elements are visitable, then it's a flat array.\n *\n * @param {Array<any>} arr - The array to check\n *\n * @returns {boolean}\n */\nfunction isFlatArray(arr) {\n  return utils.isArray(arr) && !arr.some(isVisitable);\n}\n\nconst predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {\n  return /^is[A-Z]/.test(prop);\n});\n\n/**\n * Convert a data object to FormData\n *\n * @param {Object} obj\n * @param {?Object} [formData]\n * @param {?Object} [options]\n * @param {Function} [options.visitor]\n * @param {Boolean} [options.metaTokens = true]\n * @param {Boolean} [options.dots = false]\n * @param {?Boolean} [options.indexes = false]\n *\n * @returns {Object}\n **/\n\n/**\n * It converts an object into a FormData object\n *\n * @param {Object<any, any>} obj - The object to convert to form data.\n * @param {string} formData - The FormData object to append to.\n * @param {Object<string, any>} options\n *\n * @returns\n */\nfunction toFormData(obj, formData, options) {\n  if (!utils.isObject(obj)) {\n    throw new TypeError('target must be an object');\n  }\n\n  // eslint-disable-next-line no-param-reassign\n  formData = formData || new (FormData)();\n\n  // eslint-disable-next-line no-param-reassign\n  options = utils.toFlatObject(options, {\n    metaTokens: true,\n    dots: false,\n    indexes: false\n  }, false, function defined(option, source) {\n    // eslint-disable-next-line no-eq-null,eqeqeq\n    return !utils.isUndefined(source[option]);\n  });\n\n  const metaTokens = options.metaTokens;\n  // eslint-disable-next-line no-use-before-define\n  const visitor = options.visitor || defaultVisitor;\n  const dots = options.dots;\n  const indexes = options.indexes;\n  const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;\n  const useBlob = _Blob && utils.isSpecCompliantForm(formData);\n\n  if (!utils.isFunction(visitor)) {\n    throw new TypeError('visitor must be a function');\n  }\n\n  function convertValue(value) {\n    if (value === null) return '';\n\n    if (utils.isDate(value)) {\n      return value.toISOString();\n    }\n\n    if (!useBlob && utils.isBlob(value)) {\n      throw new AxiosError('Blob is not supported. Use a Buffer instead.');\n    }\n\n    if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {\n      return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);\n    }\n\n    return value;\n  }\n\n  /**\n   * Default visitor.\n   *\n   * @param {*} value\n   * @param {String|Number} key\n   * @param {Array<String|Number>} path\n   * @this {FormData}\n   *\n   * @returns {boolean} return true to visit the each prop of the value recursively\n   */\n  function defaultVisitor(value, key, path) {\n    let arr = value;\n\n    if (value && !path && typeof value === 'object') {\n      if (utils.endsWith(key, '{}')) {\n        // eslint-disable-next-line no-param-reassign\n        key = metaTokens ? key : key.slice(0, -2);\n        // eslint-disable-next-line no-param-reassign\n        value = JSON.stringify(value);\n      } else if (\n        (utils.isArray(value) && isFlatArray(value)) ||\n        ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))\n        )) {\n        // eslint-disable-next-line no-param-reassign\n        key = removeBrackets(key);\n\n        arr.forEach(function each(el, index) {\n          !(utils.isUndefined(el) || el === null) && formData.append(\n            // eslint-disable-next-line no-nested-ternary\n            indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),\n            convertValue(el)\n          );\n        });\n        return false;\n      }\n    }\n\n    if (isVisitable(value)) {\n      return true;\n    }\n\n    formData.append(renderKey(path, key, dots), convertValue(value));\n\n    return false;\n  }\n\n  const stack = [];\n\n  const exposedHelpers = Object.assign(predicates, {\n    defaultVisitor,\n    convertValue,\n    isVisitable\n  });\n\n  function build(value, path) {\n    if (utils.isUndefined(value)) return;\n\n    if (stack.indexOf(value) !== -1) {\n      throw Error('Circular reference detected in ' + path.join('.'));\n    }\n\n    stack.push(value);\n\n    utils.forEach(value, function each(el, key) {\n      const result = !(utils.isUndefined(el) || el === null) && visitor.call(\n        formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers\n      );\n\n      if (result === true) {\n        build(el, path ? path.concat(key) : [key]);\n      }\n    });\n\n    stack.pop();\n  }\n\n  if (!utils.isObject(obj)) {\n    throw new TypeError('data must be an object');\n  }\n\n  build(obj);\n\n  return formData;\n}\n\n/**\n * It encodes a string by replacing all characters that are not in the unreserved set with\n * their percent-encoded equivalents\n *\n * @param {string} str - The string to encode.\n *\n * @returns {string} The encoded string.\n */\nfunction encode$1(str) {\n  const charMap = {\n    '!': '%21',\n    \"'\": '%27',\n    '(': '%28',\n    ')': '%29',\n    '~': '%7E',\n    '%20': '+',\n    '%00': '\\x00'\n  };\n  return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {\n    return charMap[match];\n  });\n}\n\n/**\n * It takes a params object and converts it to a FormData object\n *\n * @param {Object<string, any>} params - The parameters to be converted to a FormData object.\n * @param {Object<string, any>} options - The options object passed to the Axios constructor.\n *\n * @returns {void}\n */\nfunction AxiosURLSearchParams(params, options) {\n  this._pairs = [];\n\n  params && toFormData(params, this, options);\n}\n\nconst prototype = AxiosURLSearchParams.prototype;\n\nprototype.append = function append(name, value) {\n  this._pairs.push([name, value]);\n};\n\nprototype.toString = function toString(encoder) {\n  const _encode = encoder ? function(value) {\n    return encoder.call(this, value, encode$1);\n  } : encode$1;\n\n  return this._pairs.map(function each(pair) {\n    return _encode(pair[0]) + '=' + _encode(pair[1]);\n  }, '').join('&');\n};\n\n/**\n * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their\n * URI encoded counterparts\n *\n * @param {string} val The value to be encoded.\n *\n * @returns {string} The encoded value.\n */\nfunction encode(val) {\n  return encodeURIComponent(val).\n    replace(/%3A/gi, ':').\n    replace(/%24/g, '$').\n    replace(/%2C/gi, ',').\n    replace(/%20/g, '+').\n    replace(/%5B/gi, '[').\n    replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @param {?object} options\n *\n * @returns {string} The formatted url\n */\nfunction buildURL(url, params, options) {\n  /*eslint no-param-reassign:0*/\n  if (!params) {\n    return url;\n  }\n  \n  const _encode = options && options.encode || encode;\n\n  const serializeFn = options && options.serialize;\n\n  let serializedParams;\n\n  if (serializeFn) {\n    serializedParams = serializeFn(params, options);\n  } else {\n    serializedParams = utils.isURLSearchParams(params) ?\n      params.toString() :\n      new AxiosURLSearchParams(params, options).toString(_encode);\n  }\n\n  if (serializedParams) {\n    const hashmarkIndex = url.indexOf(\"#\");\n\n    if (hashmarkIndex !== -1) {\n      url = url.slice(0, hashmarkIndex);\n    }\n    url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n  }\n\n  return url;\n}\n\nclass InterceptorManager {\n  constructor() {\n    this.handlers = [];\n  }\n\n  /**\n   * Add a new interceptor to the stack\n   *\n   * @param {Function} fulfilled The function to handle `then` for a `Promise`\n   * @param {Function} rejected The function to handle `reject` for a `Promise`\n   *\n   * @return {Number} An ID used to remove interceptor later\n   */\n  use(fulfilled, rejected, options) {\n    this.handlers.push({\n      fulfilled,\n      rejected,\n      synchronous: options ? options.synchronous : false,\n      runWhen: options ? options.runWhen : null\n    });\n    return this.handlers.length - 1;\n  }\n\n  /**\n   * Remove an interceptor from the stack\n   *\n   * @param {Number} id The ID that was returned by `use`\n   *\n   * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise\n   */\n  eject(id) {\n    if (this.handlers[id]) {\n      this.handlers[id] = null;\n    }\n  }\n\n  /**\n   * Clear all interceptors from the stack\n   *\n   * @returns {void}\n   */\n  clear() {\n    if (this.handlers) {\n      this.handlers = [];\n    }\n  }\n\n  /**\n   * Iterate over all the registered interceptors\n   *\n   * This method is particularly useful for skipping over any\n   * interceptors that may have become `null` calling `eject`.\n   *\n   * @param {Function} fn The function to call for each interceptor\n   *\n   * @returns {void}\n   */\n  forEach(fn) {\n    utils.forEach(this.handlers, function forEachHandler(h) {\n      if (h !== null) {\n        fn(h);\n      }\n    });\n  }\n}\n\nvar InterceptorManager$1 = InterceptorManager;\n\nvar transitionalDefaults = {\n  silentJSONParsing: true,\n  forcedJSONParsing: true,\n  clarifyTimeoutError: false\n};\n\nvar URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;\n\nvar FormData$1 = typeof FormData !== 'undefined' ? FormData : null;\n\nvar Blob$1 = typeof Blob !== 'undefined' ? Blob : null;\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n *  typeof window -> undefined\n *  typeof document -> undefined\n *\n * react-native:\n *  navigator.product -> 'ReactNative'\n * nativescript\n *  navigator.product -> 'NativeScript' or 'NS'\n *\n * @returns {boolean}\n */\nconst isStandardBrowserEnv = (() => {\n  let product;\n  if (typeof navigator !== 'undefined' && (\n    (product = navigator.product) === 'ReactNative' ||\n    product === 'NativeScript' ||\n    product === 'NS')\n  ) {\n    return false;\n  }\n\n  return typeof window !== 'undefined' && typeof document !== 'undefined';\n})();\n\n/**\n * Determine if we're running in a standard browser webWorker environment\n *\n * Although the `isStandardBrowserEnv` method indicates that\n * `allows axios to run in a web worker`, the WebWorker will still be\n * filtered out due to its judgment standard\n * `typeof window !== 'undefined' && typeof document !== 'undefined'`.\n * This leads to a problem when axios post `FormData` in webWorker\n */\n const isStandardBrowserWebWorkerEnv = (() => {\n  return (\n    typeof WorkerGlobalScope !== 'undefined' &&\n    // eslint-disable-next-line no-undef\n    self instanceof WorkerGlobalScope &&\n    typeof self.importScripts === 'function'\n  );\n})();\n\n\nvar platform = {\n  isBrowser: true,\n  classes: {\n    URLSearchParams: URLSearchParams$1,\n    FormData: FormData$1,\n    Blob: Blob$1\n  },\n  isStandardBrowserEnv,\n  isStandardBrowserWebWorkerEnv,\n  protocols: ['http', 'https', 'file', 'blob', 'url', 'data']\n};\n\nfunction toURLEncodedForm(data, options) {\n  return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({\n    visitor: function(value, key, path, helpers) {\n      if (platform.isNode && utils.isBuffer(value)) {\n        this.append(key, value.toString('base64'));\n        return false;\n      }\n\n      return helpers.defaultVisitor.apply(this, arguments);\n    }\n  }, options));\n}\n\n/**\n * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']\n *\n * @param {string} name - The name of the property to get.\n *\n * @returns An array of strings.\n */\nfunction parsePropPath(name) {\n  // foo[x][y][z]\n  // foo.x.y.z\n  // foo-x-y-z\n  // foo x y z\n  return utils.matchAll(/\\w+|\\[(\\w*)]/g, name).map(match => {\n    return match[0] === '[]' ? '' : match[1] || match[0];\n  });\n}\n\n/**\n * Convert an array to an object.\n *\n * @param {Array<any>} arr - The array to convert to an object.\n *\n * @returns An object with the same keys and values as the array.\n */\nfunction arrayToObject(arr) {\n  const obj = {};\n  const keys = Object.keys(arr);\n  let i;\n  const len = keys.length;\n  let key;\n  for (i = 0; i < len; i++) {\n    key = keys[i];\n    obj[key] = arr[key];\n  }\n  return obj;\n}\n\n/**\n * It takes a FormData object and returns a JavaScript object\n *\n * @param {string} formData The FormData object to convert to JSON.\n *\n * @returns {Object<string, any> | null} The converted object.\n */\nfunction formDataToJSON(formData) {\n  function buildPath(path, value, target, index) {\n    let name = path[index++];\n    const isNumericKey = Number.isFinite(+name);\n    const isLast = index >= path.length;\n    name = !name && utils.isArray(target) ? target.length : name;\n\n    if (isLast) {\n      if (utils.hasOwnProp(target, name)) {\n        target[name] = [target[name], value];\n      } else {\n        target[name] = value;\n      }\n\n      return !isNumericKey;\n    }\n\n    if (!target[name] || !utils.isObject(target[name])) {\n      target[name] = [];\n    }\n\n    const result = buildPath(path, value, target[name], index);\n\n    if (result && utils.isArray(target[name])) {\n      target[name] = arrayToObject(target[name]);\n    }\n\n    return !isNumericKey;\n  }\n\n  if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {\n    const obj = {};\n\n    utils.forEachEntry(formData, (name, value) => {\n      buildPath(parsePropPath(name), value, obj, 0);\n    });\n\n    return obj;\n  }\n\n  return null;\n}\n\nconst DEFAULT_CONTENT_TYPE = {\n  'Content-Type': undefined\n};\n\n/**\n * It takes a string, tries to parse it, and if it fails, it returns the stringified version\n * of the input\n *\n * @param {any} rawValue - The value to be stringified.\n * @param {Function} parser - A function that parses a string into a JavaScript object.\n * @param {Function} encoder - A function that takes a value and returns a string.\n *\n * @returns {string} A stringified version of the rawValue.\n */\nfunction stringifySafely(rawValue, parser, encoder) {\n  if (utils.isString(rawValue)) {\n    try {\n      (parser || JSON.parse)(rawValue);\n      return utils.trim(rawValue);\n    } catch (e) {\n      if (e.name !== 'SyntaxError') {\n        throw e;\n      }\n    }\n  }\n\n  return (encoder || JSON.stringify)(rawValue);\n}\n\nconst defaults = {\n\n  transitional: transitionalDefaults,\n\n  adapter: ['xhr', 'http'],\n\n  transformRequest: [function transformRequest(data, headers) {\n    const contentType = headers.getContentType() || '';\n    const hasJSONContentType = contentType.indexOf('application/json') > -1;\n    const isObjectPayload = utils.isObject(data);\n\n    if (isObjectPayload && utils.isHTMLForm(data)) {\n      data = new FormData(data);\n    }\n\n    const isFormData = utils.isFormData(data);\n\n    if (isFormData) {\n      if (!hasJSONContentType) {\n        return data;\n      }\n      return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;\n    }\n\n    if (utils.isArrayBuffer(data) ||\n      utils.isBuffer(data) ||\n      utils.isStream(data) ||\n      utils.isFile(data) ||\n      utils.isBlob(data)\n    ) {\n      return data;\n    }\n    if (utils.isArrayBufferView(data)) {\n      return data.buffer;\n    }\n    if (utils.isURLSearchParams(data)) {\n      headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);\n      return data.toString();\n    }\n\n    let isFileList;\n\n    if (isObjectPayload) {\n      if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {\n        return toURLEncodedForm(data, this.formSerializer).toString();\n      }\n\n      if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {\n        const _FormData = this.env && this.env.FormData;\n\n        return toFormData(\n          isFileList ? {'files[]': data} : data,\n          _FormData && new _FormData(),\n          this.formSerializer\n        );\n      }\n    }\n\n    if (isObjectPayload || hasJSONContentType ) {\n      headers.setContentType('application/json', false);\n      return stringifySafely(data);\n    }\n\n    return data;\n  }],\n\n  transformResponse: [function transformResponse(data) {\n    const transitional = this.transitional || defaults.transitional;\n    const forcedJSONParsing = transitional && transitional.forcedJSONParsing;\n    const JSONRequested = this.responseType === 'json';\n\n    if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {\n      const silentJSONParsing = transitional && transitional.silentJSONParsing;\n      const strictJSONParsing = !silentJSONParsing && JSONRequested;\n\n      try {\n        return JSON.parse(data);\n      } catch (e) {\n        if (strictJSONParsing) {\n          if (e.name === 'SyntaxError') {\n            throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);\n          }\n          throw e;\n        }\n      }\n    }\n\n    return data;\n  }],\n\n  /**\n   * A timeout in milliseconds to abort a request. If set to 0 (default) a\n   * timeout is not created.\n   */\n  timeout: 0,\n\n  xsrfCookieName: 'XSRF-TOKEN',\n  xsrfHeaderName: 'X-XSRF-TOKEN',\n\n  maxContentLength: -1,\n  maxBodyLength: -1,\n\n  env: {\n    FormData: platform.classes.FormData,\n    Blob: platform.classes.Blob\n  },\n\n  validateStatus: function validateStatus(status) {\n    return status >= 200 && status < 300;\n  },\n\n  headers: {\n    common: {\n      'Accept': 'application/json, text/plain, */*'\n    }\n  }\n};\n\nutils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {\n  defaults.headers[method] = {};\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n  defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);\n});\n\nvar defaults$1 = defaults;\n\n// RawAxiosHeaders whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nconst ignoreDuplicateOf = utils.toObjectSet([\n  'age', 'authorization', 'content-length', 'content-type', 'etag',\n  'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n  'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n  'referer', 'retry-after', 'user-agent'\n]);\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} rawHeaders Headers needing to be parsed\n *\n * @returns {Object} Headers parsed into an object\n */\nvar parseHeaders = rawHeaders => {\n  const parsed = {};\n  let key;\n  let val;\n  let i;\n\n  rawHeaders && rawHeaders.split('\\n').forEach(function parser(line) {\n    i = line.indexOf(':');\n    key = line.substring(0, i).trim().toLowerCase();\n    val = line.substring(i + 1).trim();\n\n    if (!key || (parsed[key] && ignoreDuplicateOf[key])) {\n      return;\n    }\n\n    if (key === 'set-cookie') {\n      if (parsed[key]) {\n        parsed[key].push(val);\n      } else {\n        parsed[key] = [val];\n      }\n    } else {\n      parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n    }\n  });\n\n  return parsed;\n};\n\nconst $internals = Symbol('internals');\n\nfunction normalizeHeader(header) {\n  return header && String(header).trim().toLowerCase();\n}\n\nfunction normalizeValue(value) {\n  if (value === false || value == null) {\n    return value;\n  }\n\n  return utils.isArray(value) ? value.map(normalizeValue) : String(value);\n}\n\nfunction parseTokens(str) {\n  const tokens = Object.create(null);\n  const tokensRE = /([^\\s,;=]+)\\s*(?:=\\s*([^,;]+))?/g;\n  let match;\n\n  while ((match = tokensRE.exec(str))) {\n    tokens[match[1]] = match[2];\n  }\n\n  return tokens;\n}\n\nconst isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());\n\nfunction matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {\n  if (utils.isFunction(filter)) {\n    return filter.call(this, value, header);\n  }\n\n  if (isHeaderNameFilter) {\n    value = header;\n  }\n\n  if (!utils.isString(value)) return;\n\n  if (utils.isString(filter)) {\n    return value.indexOf(filter) !== -1;\n  }\n\n  if (utils.isRegExp(filter)) {\n    return filter.test(value);\n  }\n}\n\nfunction formatHeader(header) {\n  return header.trim()\n    .toLowerCase().replace(/([a-z\\d])(\\w*)/g, (w, char, str) => {\n      return char.toUpperCase() + str;\n    });\n}\n\nfunction buildAccessors(obj, header) {\n  const accessorName = utils.toCamelCase(' ' + header);\n\n  ['get', 'set', 'has'].forEach(methodName => {\n    Object.defineProperty(obj, methodName + accessorName, {\n      value: function(arg1, arg2, arg3) {\n        return this[methodName].call(this, header, arg1, arg2, arg3);\n      },\n      configurable: true\n    });\n  });\n}\n\nclass AxiosHeaders {\n  constructor(headers) {\n    headers && this.set(headers);\n  }\n\n  set(header, valueOrRewrite, rewrite) {\n    const self = this;\n\n    function setHeader(_value, _header, _rewrite) {\n      const lHeader = normalizeHeader(_header);\n\n      if (!lHeader) {\n        throw new Error('header name must be a non-empty string');\n      }\n\n      const key = utils.findKey(self, lHeader);\n\n      if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {\n        self[key || _header] = normalizeValue(_value);\n      }\n    }\n\n    const setHeaders = (headers, _rewrite) =>\n      utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));\n\n    if (utils.isPlainObject(header) || header instanceof this.constructor) {\n      setHeaders(header, valueOrRewrite);\n    } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {\n      setHeaders(parseHeaders(header), valueOrRewrite);\n    } else {\n      header != null && setHeader(valueOrRewrite, header, rewrite);\n    }\n\n    return this;\n  }\n\n  get(header, parser) {\n    header = normalizeHeader(header);\n\n    if (header) {\n      const key = utils.findKey(this, header);\n\n      if (key) {\n        const value = this[key];\n\n        if (!parser) {\n          return value;\n        }\n\n        if (parser === true) {\n          return parseTokens(value);\n        }\n\n        if (utils.isFunction(parser)) {\n          return parser.call(this, value, key);\n        }\n\n        if (utils.isRegExp(parser)) {\n          return parser.exec(value);\n        }\n\n        throw new TypeError('parser must be boolean|regexp|function');\n      }\n    }\n  }\n\n  has(header, matcher) {\n    header = normalizeHeader(header);\n\n    if (header) {\n      const key = utils.findKey(this, header);\n\n      return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));\n    }\n\n    return false;\n  }\n\n  delete(header, matcher) {\n    const self = this;\n    let deleted = false;\n\n    function deleteHeader(_header) {\n      _header = normalizeHeader(_header);\n\n      if (_header) {\n        const key = utils.findKey(self, _header);\n\n        if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {\n          delete self[key];\n\n          deleted = true;\n        }\n      }\n    }\n\n    if (utils.isArray(header)) {\n      header.forEach(deleteHeader);\n    } else {\n      deleteHeader(header);\n    }\n\n    return deleted;\n  }\n\n  clear(matcher) {\n    const keys = Object.keys(this);\n    let i = keys.length;\n    let deleted = false;\n\n    while (i--) {\n      const key = keys[i];\n      if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {\n        delete this[key];\n        deleted = true;\n      }\n    }\n\n    return deleted;\n  }\n\n  normalize(format) {\n    const self = this;\n    const headers = {};\n\n    utils.forEach(this, (value, header) => {\n      const key = utils.findKey(headers, header);\n\n      if (key) {\n        self[key] = normalizeValue(value);\n        delete self[header];\n        return;\n      }\n\n      const normalized = format ? formatHeader(header) : String(header).trim();\n\n      if (normalized !== header) {\n        delete self[header];\n      }\n\n      self[normalized] = normalizeValue(value);\n\n      headers[normalized] = true;\n    });\n\n    return this;\n  }\n\n  concat(...targets) {\n    return this.constructor.concat(this, ...targets);\n  }\n\n  toJSON(asStrings) {\n    const obj = Object.create(null);\n\n    utils.forEach(this, (value, header) => {\n      value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);\n    });\n\n    return obj;\n  }\n\n  [Symbol.iterator]() {\n    return Object.entries(this.toJSON())[Symbol.iterator]();\n  }\n\n  toString() {\n    return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\\n');\n  }\n\n  get [Symbol.toStringTag]() {\n    return 'AxiosHeaders';\n  }\n\n  static from(thing) {\n    return thing instanceof this ? thing : new this(thing);\n  }\n\n  static concat(first, ...targets) {\n    const computed = new this(first);\n\n    targets.forEach((target) => computed.set(target));\n\n    return computed;\n  }\n\n  static accessor(header) {\n    const internals = this[$internals] = (this[$internals] = {\n      accessors: {}\n    });\n\n    const accessors = internals.accessors;\n    const prototype = this.prototype;\n\n    function defineAccessor(_header) {\n      const lHeader = normalizeHeader(_header);\n\n      if (!accessors[lHeader]) {\n        buildAccessors(prototype, _header);\n        accessors[lHeader] = true;\n      }\n    }\n\n    utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);\n\n    return this;\n  }\n}\n\nAxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);\n\nutils.freezeMethods(AxiosHeaders.prototype);\nutils.freezeMethods(AxiosHeaders);\n\nvar AxiosHeaders$1 = AxiosHeaders;\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Array|Function} fns A single function or Array of functions\n * @param {?Object} response The response object\n *\n * @returns {*} The resulting transformed data\n */\nfunction transformData(fns, response) {\n  const config = this || defaults$1;\n  const context = response || config;\n  const headers = AxiosHeaders$1.from(context.headers);\n  let data = context.data;\n\n  utils.forEach(fns, function transform(fn) {\n    data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);\n  });\n\n  headers.normalize();\n\n  return data;\n}\n\nfunction isCancel(value) {\n  return !!(value && value.__CANCEL__);\n}\n\n/**\n * A `CanceledError` is an object that is thrown when an operation is canceled.\n *\n * @param {string=} message The message.\n * @param {Object=} config The config.\n * @param {Object=} request The request.\n *\n * @returns {CanceledError} The created error.\n */\nfunction CanceledError(message, config, request) {\n  // eslint-disable-next-line no-eq-null,eqeqeq\n  AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);\n  this.name = 'CanceledError';\n}\n\nutils.inherits(CanceledError, AxiosError, {\n  __CANCEL__: true\n});\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n *\n * @returns {object} The response.\n */\nfunction settle(resolve, reject, response) {\n  const validateStatus = response.config.validateStatus;\n  if (!response.status || !validateStatus || validateStatus(response.status)) {\n    resolve(response);\n  } else {\n    reject(new AxiosError(\n      'Request failed with status code ' + response.status,\n      [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],\n      response.config,\n      response.request,\n      response\n    ));\n  }\n}\n\nvar cookies = platform.isStandardBrowserEnv ?\n\n// Standard browser envs support document.cookie\n  (function standardBrowserEnv() {\n    return {\n      write: function write(name, value, expires, path, domain, secure) {\n        const cookie = [];\n        cookie.push(name + '=' + encodeURIComponent(value));\n\n        if (utils.isNumber(expires)) {\n          cookie.push('expires=' + new Date(expires).toGMTString());\n        }\n\n        if (utils.isString(path)) {\n          cookie.push('path=' + path);\n        }\n\n        if (utils.isString(domain)) {\n          cookie.push('domain=' + domain);\n        }\n\n        if (secure === true) {\n          cookie.push('secure');\n        }\n\n        document.cookie = cookie.join('; ');\n      },\n\n      read: function read(name) {\n        const match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n        return (match ? decodeURIComponent(match[3]) : null);\n      },\n\n      remove: function remove(name) {\n        this.write(name, '', Date.now() - 86400000);\n      }\n    };\n  })() :\n\n// Non standard browser env (web workers, react-native) lack needed support.\n  (function nonStandardBrowserEnv() {\n    return {\n      write: function write() {},\n      read: function read() { return null; },\n      remove: function remove() {}\n    };\n  })();\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n *\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nfunction isAbsoluteURL(url) {\n  // A URL is considered absolute if it begins with \"<scheme>://\" or \"//\" (protocol-relative URL).\n  // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n  // by any combination of letters, digits, plus, period, or hyphen.\n  return /^([a-z][a-z\\d+\\-.]*:)?\\/\\//i.test(url);\n}\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n *\n * @returns {string} The combined URL\n */\nfunction combineURLs(baseURL, relativeURL) {\n  return relativeURL\n    ? baseURL.replace(/\\/+$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n    : baseURL;\n}\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n *\n * @returns {string} The combined full path\n */\nfunction buildFullPath(baseURL, requestedURL) {\n  if (baseURL && !isAbsoluteURL(requestedURL)) {\n    return combineURLs(baseURL, requestedURL);\n  }\n  return requestedURL;\n}\n\nvar isURLSameOrigin = platform.isStandardBrowserEnv ?\n\n// Standard browser envs have full support of the APIs needed to test\n// whether the request URL is of the same origin as current location.\n  (function standardBrowserEnv() {\n    const msie = /(msie|trident)/i.test(navigator.userAgent);\n    const urlParsingNode = document.createElement('a');\n    let originURL;\n\n    /**\n    * Parse a URL to discover it's components\n    *\n    * @param {String} url The URL to be parsed\n    * @returns {Object}\n    */\n    function resolveURL(url) {\n      let href = url;\n\n      if (msie) {\n        // IE needs attribute set twice to normalize properties\n        urlParsingNode.setAttribute('href', href);\n        href = urlParsingNode.href;\n      }\n\n      urlParsingNode.setAttribute('href', href);\n\n      // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n      return {\n        href: urlParsingNode.href,\n        protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n        host: urlParsingNode.host,\n        search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n        hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n        hostname: urlParsingNode.hostname,\n        port: urlParsingNode.port,\n        pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n          urlParsingNode.pathname :\n          '/' + urlParsingNode.pathname\n      };\n    }\n\n    originURL = resolveURL(window.location.href);\n\n    /**\n    * Determine if a URL shares the same origin as the current location\n    *\n    * @param {String} requestURL The URL to test\n    * @returns {boolean} True if URL shares the same origin, otherwise false\n    */\n    return function isURLSameOrigin(requestURL) {\n      const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n      return (parsed.protocol === originURL.protocol &&\n          parsed.host === originURL.host);\n    };\n  })() :\n\n  // Non standard browser envs (web workers, react-native) lack needed support.\n  (function nonStandardBrowserEnv() {\n    return function isURLSameOrigin() {\n      return true;\n    };\n  })();\n\nfunction parseProtocol(url) {\n  const match = /^([-+\\w]{1,25})(:?\\/\\/|:)/.exec(url);\n  return match && match[1] || '';\n}\n\n/**\n * Calculate data maxRate\n * @param {Number} [samplesCount= 10]\n * @param {Number} [min= 1000]\n * @returns {Function}\n */\nfunction speedometer(samplesCount, min) {\n  samplesCount = samplesCount || 10;\n  const bytes = new Array(samplesCount);\n  const timestamps = new Array(samplesCount);\n  let head = 0;\n  let tail = 0;\n  let firstSampleTS;\n\n  min = min !== undefined ? min : 1000;\n\n  return function push(chunkLength) {\n    const now = Date.now();\n\n    const startedAt = timestamps[tail];\n\n    if (!firstSampleTS) {\n      firstSampleTS = now;\n    }\n\n    bytes[head] = chunkLength;\n    timestamps[head] = now;\n\n    let i = tail;\n    let bytesCount = 0;\n\n    while (i !== head) {\n      bytesCount += bytes[i++];\n      i = i % samplesCount;\n    }\n\n    head = (head + 1) % samplesCount;\n\n    if (head === tail) {\n      tail = (tail + 1) % samplesCount;\n    }\n\n    if (now - firstSampleTS < min) {\n      return;\n    }\n\n    const passed = startedAt && now - startedAt;\n\n    return passed ? Math.round(bytesCount * 1000 / passed) : undefined;\n  };\n}\n\nfunction progressEventReducer(listener, isDownloadStream) {\n  let bytesNotified = 0;\n  const _speedometer = speedometer(50, 250);\n\n  return e => {\n    const loaded = e.loaded;\n    const total = e.lengthComputable ? e.total : undefined;\n    const progressBytes = loaded - bytesNotified;\n    const rate = _speedometer(progressBytes);\n    const inRange = loaded <= total;\n\n    bytesNotified = loaded;\n\n    const data = {\n      loaded,\n      total,\n      progress: total ? (loaded / total) : undefined,\n      bytes: progressBytes,\n      rate: rate ? rate : undefined,\n      estimated: rate && total && inRange ? (total - loaded) / rate : undefined,\n      event: e\n    };\n\n    data[isDownloadStream ? 'download' : 'upload'] = true;\n\n    listener(data);\n  };\n}\n\nconst isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';\n\nvar xhrAdapter = isXHRAdapterSupported && function (config) {\n  return new Promise(function dispatchXhrRequest(resolve, reject) {\n    let requestData = config.data;\n    const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();\n    const responseType = config.responseType;\n    let onCanceled;\n    function done() {\n      if (config.cancelToken) {\n        config.cancelToken.unsubscribe(onCanceled);\n      }\n\n      if (config.signal) {\n        config.signal.removeEventListener('abort', onCanceled);\n      }\n    }\n\n    if (utils.isFormData(requestData)) {\n      if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {\n        requestHeaders.setContentType(false); // Let the browser set it\n      } else {\n        requestHeaders.setContentType('multipart/form-data;', false); // mobile/desktop app frameworks\n      }\n    }\n\n    let request = new XMLHttpRequest();\n\n    // HTTP basic authentication\n    if (config.auth) {\n      const username = config.auth.username || '';\n      const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';\n      requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));\n    }\n\n    const fullPath = buildFullPath(config.baseURL, config.url);\n\n    request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);\n\n    // Set the request timeout in MS\n    request.timeout = config.timeout;\n\n    function onloadend() {\n      if (!request) {\n        return;\n      }\n      // Prepare the response\n      const responseHeaders = AxiosHeaders$1.from(\n        'getAllResponseHeaders' in request && request.getAllResponseHeaders()\n      );\n      const responseData = !responseType || responseType === 'text' || responseType === 'json' ?\n        request.responseText : request.response;\n      const response = {\n        data: responseData,\n        status: request.status,\n        statusText: request.statusText,\n        headers: responseHeaders,\n        config,\n        request\n      };\n\n      settle(function _resolve(value) {\n        resolve(value);\n        done();\n      }, function _reject(err) {\n        reject(err);\n        done();\n      }, response);\n\n      // Clean up request\n      request = null;\n    }\n\n    if ('onloadend' in request) {\n      // Use onloadend if available\n      request.onloadend = onloadend;\n    } else {\n      // Listen for ready state to emulate onloadend\n      request.onreadystatechange = function handleLoad() {\n        if (!request || request.readyState !== 4) {\n          return;\n        }\n\n        // The request errored out and we didn't get a response, this will be\n        // handled by onerror instead\n        // With one exception: request that using file: protocol, most browsers\n        // will return status as 0 even though it's a successful request\n        if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n          return;\n        }\n        // readystate handler is calling before onerror or ontimeout handlers,\n        // so we should call onloadend on the next 'tick'\n        setTimeout(onloadend);\n      };\n    }\n\n    // Handle browser request cancellation (as opposed to a manual cancellation)\n    request.onabort = function handleAbort() {\n      if (!request) {\n        return;\n      }\n\n      reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));\n\n      // Clean up request\n      request = null;\n    };\n\n    // Handle low level network errors\n    request.onerror = function handleError() {\n      // Real errors are hidden from us by the browser\n      // onerror should only fire if it's a network error\n      reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));\n\n      // Clean up request\n      request = null;\n    };\n\n    // Handle timeout\n    request.ontimeout = function handleTimeout() {\n      let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';\n      const transitional = config.transitional || transitionalDefaults;\n      if (config.timeoutErrorMessage) {\n        timeoutErrorMessage = config.timeoutErrorMessage;\n      }\n      reject(new AxiosError(\n        timeoutErrorMessage,\n        transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,\n        config,\n        request));\n\n      // Clean up request\n      request = null;\n    };\n\n    // Add xsrf header\n    // This is only done if running in a standard browser environment.\n    // Specifically not if we're in a web worker, or react-native.\n    if (platform.isStandardBrowserEnv) {\n      // Add xsrf header\n      const xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath))\n        && config.xsrfCookieName && cookies.read(config.xsrfCookieName);\n\n      if (xsrfValue) {\n        requestHeaders.set(config.xsrfHeaderName, xsrfValue);\n      }\n    }\n\n    // Remove Content-Type if data is undefined\n    requestData === undefined && requestHeaders.setContentType(null);\n\n    // Add headers to the request\n    if ('setRequestHeader' in request) {\n      utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {\n        request.setRequestHeader(key, val);\n      });\n    }\n\n    // Add withCredentials to request if needed\n    if (!utils.isUndefined(config.withCredentials)) {\n      request.withCredentials = !!config.withCredentials;\n    }\n\n    // Add responseType to request if needed\n    if (responseType && responseType !== 'json') {\n      request.responseType = config.responseType;\n    }\n\n    // Handle progress if needed\n    if (typeof config.onDownloadProgress === 'function') {\n      request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));\n    }\n\n    // Not all browsers support upload events\n    if (typeof config.onUploadProgress === 'function' && request.upload) {\n      request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));\n    }\n\n    if (config.cancelToken || config.signal) {\n      // Handle cancellation\n      // eslint-disable-next-line func-names\n      onCanceled = cancel => {\n        if (!request) {\n          return;\n        }\n        reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);\n        request.abort();\n        request = null;\n      };\n\n      config.cancelToken && config.cancelToken.subscribe(onCanceled);\n      if (config.signal) {\n        config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);\n      }\n    }\n\n    const protocol = parseProtocol(fullPath);\n\n    if (protocol && platform.protocols.indexOf(protocol) === -1) {\n      reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));\n      return;\n    }\n\n\n    // Send the request\n    request.send(requestData || null);\n  });\n};\n\nconst knownAdapters = {\n  http: httpAdapter,\n  xhr: xhrAdapter\n};\n\nutils.forEach(knownAdapters, (fn, value) => {\n  if(fn) {\n    try {\n      Object.defineProperty(fn, 'name', {value});\n    } catch (e) {\n      // eslint-disable-next-line no-empty\n    }\n    Object.defineProperty(fn, 'adapterName', {value});\n  }\n});\n\nvar adapters = {\n  getAdapter: (adapters) => {\n    adapters = utils.isArray(adapters) ? adapters : [adapters];\n\n    const {length} = adapters;\n    let nameOrAdapter;\n    let adapter;\n\n    for (let i = 0; i < length; i++) {\n      nameOrAdapter = adapters[i];\n      if((adapter = utils.isString(nameOrAdapter) ? knownAdapters[nameOrAdapter.toLowerCase()] : nameOrAdapter)) {\n        break;\n      }\n    }\n\n    if (!adapter) {\n      if (adapter === false) {\n        throw new AxiosError(\n          `Adapter ${nameOrAdapter} is not supported by the environment`,\n          'ERR_NOT_SUPPORT'\n        );\n      }\n\n      throw new Error(\n        utils.hasOwnProp(knownAdapters, nameOrAdapter) ?\n          `Adapter '${nameOrAdapter}' is not available in the build` :\n          `Unknown adapter '${nameOrAdapter}'`\n      );\n    }\n\n    if (!utils.isFunction(adapter)) {\n      throw new TypeError('adapter is not a function');\n    }\n\n    return adapter;\n  },\n  adapters: knownAdapters\n};\n\n/**\n * Throws a `CanceledError` if cancellation has been requested.\n *\n * @param {Object} config The config that is to be used for the request\n *\n * @returns {void}\n */\nfunction throwIfCancellationRequested(config) {\n  if (config.cancelToken) {\n    config.cancelToken.throwIfRequested();\n  }\n\n  if (config.signal && config.signal.aborted) {\n    throw new CanceledError(null, config);\n  }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n *\n * @returns {Promise} The Promise to be fulfilled\n */\nfunction dispatchRequest(config) {\n  throwIfCancellationRequested(config);\n\n  config.headers = AxiosHeaders$1.from(config.headers);\n\n  // Transform request data\n  config.data = transformData.call(\n    config,\n    config.transformRequest\n  );\n\n  if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {\n    config.headers.setContentType('application/x-www-form-urlencoded', false);\n  }\n\n  const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);\n\n  return adapter(config).then(function onAdapterResolution(response) {\n    throwIfCancellationRequested(config);\n\n    // Transform response data\n    response.data = transformData.call(\n      config,\n      config.transformResponse,\n      response\n    );\n\n    response.headers = AxiosHeaders$1.from(response.headers);\n\n    return response;\n  }, function onAdapterRejection(reason) {\n    if (!isCancel(reason)) {\n      throwIfCancellationRequested(config);\n\n      // Transform response data\n      if (reason && reason.response) {\n        reason.response.data = transformData.call(\n          config,\n          config.transformResponse,\n          reason.response\n        );\n        reason.response.headers = AxiosHeaders$1.from(reason.response.headers);\n      }\n    }\n\n    return Promise.reject(reason);\n  });\n}\n\nconst headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing;\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n *\n * @returns {Object} New object resulting from merging config2 to config1\n */\nfunction mergeConfig(config1, config2) {\n  // eslint-disable-next-line no-param-reassign\n  config2 = config2 || {};\n  const config = {};\n\n  function getMergedValue(target, source, caseless) {\n    if (utils.isPlainObject(target) && utils.isPlainObject(source)) {\n      return utils.merge.call({caseless}, target, source);\n    } else if (utils.isPlainObject(source)) {\n      return utils.merge({}, source);\n    } else if (utils.isArray(source)) {\n      return source.slice();\n    }\n    return source;\n  }\n\n  // eslint-disable-next-line consistent-return\n  function mergeDeepProperties(a, b, caseless) {\n    if (!utils.isUndefined(b)) {\n      return getMergedValue(a, b, caseless);\n    } else if (!utils.isUndefined(a)) {\n      return getMergedValue(undefined, a, caseless);\n    }\n  }\n\n  // eslint-disable-next-line consistent-return\n  function valueFromConfig2(a, b) {\n    if (!utils.isUndefined(b)) {\n      return getMergedValue(undefined, b);\n    }\n  }\n\n  // eslint-disable-next-line consistent-return\n  function defaultToConfig2(a, b) {\n    if (!utils.isUndefined(b)) {\n      return getMergedValue(undefined, b);\n    } else if (!utils.isUndefined(a)) {\n      return getMergedValue(undefined, a);\n    }\n  }\n\n  // eslint-disable-next-line consistent-return\n  function mergeDirectKeys(a, b, prop) {\n    if (prop in config2) {\n      return getMergedValue(a, b);\n    } else if (prop in config1) {\n      return getMergedValue(undefined, a);\n    }\n  }\n\n  const mergeMap = {\n    url: valueFromConfig2,\n    method: valueFromConfig2,\n    data: valueFromConfig2,\n    baseURL: defaultToConfig2,\n    transformRequest: defaultToConfig2,\n    transformResponse: defaultToConfig2,\n    paramsSerializer: defaultToConfig2,\n    timeout: defaultToConfig2,\n    timeoutMessage: defaultToConfig2,\n    withCredentials: defaultToConfig2,\n    adapter: defaultToConfig2,\n    responseType: defaultToConfig2,\n    xsrfCookieName: defaultToConfig2,\n    xsrfHeaderName: defaultToConfig2,\n    onUploadProgress: defaultToConfig2,\n    onDownloadProgress: defaultToConfig2,\n    decompress: defaultToConfig2,\n    maxContentLength: defaultToConfig2,\n    maxBodyLength: defaultToConfig2,\n    beforeRedirect: defaultToConfig2,\n    transport: defaultToConfig2,\n    httpAgent: defaultToConfig2,\n    httpsAgent: defaultToConfig2,\n    cancelToken: defaultToConfig2,\n    socketPath: defaultToConfig2,\n    responseEncoding: defaultToConfig2,\n    validateStatus: mergeDirectKeys,\n    headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)\n  };\n\n  utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {\n    const merge = mergeMap[prop] || mergeDeepProperties;\n    const configValue = merge(config1[prop], config2[prop], prop);\n    (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);\n  });\n\n  return config;\n}\n\nconst VERSION = \"1.4.0\";\n\nconst validators$1 = {};\n\n// eslint-disable-next-line func-names\n['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {\n  validators$1[type] = function validator(thing) {\n    return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;\n  };\n});\n\nconst deprecatedWarnings = {};\n\n/**\n * Transitional option validator\n *\n * @param {function|boolean?} validator - set to false if the transitional option has been removed\n * @param {string?} version - deprecated version / removed since version\n * @param {string?} message - some message with additional info\n *\n * @returns {function}\n */\nvalidators$1.transitional = function transitional(validator, version, message) {\n  function formatMessage(opt, desc) {\n    return '[Axios v' + VERSION + '] Transitional option \\'' + opt + '\\'' + desc + (message ? '. ' + message : '');\n  }\n\n  // eslint-disable-next-line func-names\n  return (value, opt, opts) => {\n    if (validator === false) {\n      throw new AxiosError(\n        formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),\n        AxiosError.ERR_DEPRECATED\n      );\n    }\n\n    if (version && !deprecatedWarnings[opt]) {\n      deprecatedWarnings[opt] = true;\n      // eslint-disable-next-line no-console\n      console.warn(\n        formatMessage(\n          opt,\n          ' has been deprecated since v' + version + ' and will be removed in the near future'\n        )\n      );\n    }\n\n    return validator ? validator(value, opt, opts) : true;\n  };\n};\n\n/**\n * Assert object's properties type\n *\n * @param {object} options\n * @param {object} schema\n * @param {boolean?} allowUnknown\n *\n * @returns {object}\n */\n\nfunction assertOptions(options, schema, allowUnknown) {\n  if (typeof options !== 'object') {\n    throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);\n  }\n  const keys = Object.keys(options);\n  let i = keys.length;\n  while (i-- > 0) {\n    const opt = keys[i];\n    const validator = schema[opt];\n    if (validator) {\n      const value = options[opt];\n      const result = value === undefined || validator(value, opt, options);\n      if (result !== true) {\n        throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);\n      }\n      continue;\n    }\n    if (allowUnknown !== true) {\n      throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);\n    }\n  }\n}\n\nvar validator = {\n  assertOptions,\n  validators: validators$1\n};\n\nconst validators = validator.validators;\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n *\n * @return {Axios} A new instance of Axios\n */\nclass Axios {\n  constructor(instanceConfig) {\n    this.defaults = instanceConfig;\n    this.interceptors = {\n      request: new InterceptorManager$1(),\n      response: new InterceptorManager$1()\n    };\n  }\n\n  /**\n   * Dispatch a request\n   *\n   * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)\n   * @param {?Object} config\n   *\n   * @returns {Promise} The Promise to be fulfilled\n   */\n  request(configOrUrl, config) {\n    /*eslint no-param-reassign:0*/\n    // Allow for axios('example/url'[, config]) a la fetch API\n    if (typeof configOrUrl === 'string') {\n      config = config || {};\n      config.url = configOrUrl;\n    } else {\n      config = configOrUrl || {};\n    }\n\n    config = mergeConfig(this.defaults, config);\n\n    const {transitional, paramsSerializer, headers} = config;\n\n    if (transitional !== undefined) {\n      validator.assertOptions(transitional, {\n        silentJSONParsing: validators.transitional(validators.boolean),\n        forcedJSONParsing: validators.transitional(validators.boolean),\n        clarifyTimeoutError: validators.transitional(validators.boolean)\n      }, false);\n    }\n\n    if (paramsSerializer != null) {\n      if (utils.isFunction(paramsSerializer)) {\n        config.paramsSerializer = {\n          serialize: paramsSerializer\n        };\n      } else {\n        validator.assertOptions(paramsSerializer, {\n          encode: validators.function,\n          serialize: validators.function\n        }, true);\n      }\n    }\n\n    // Set config.method\n    config.method = (config.method || this.defaults.method || 'get').toLowerCase();\n\n    let contextHeaders;\n\n    // Flatten headers\n    contextHeaders = headers && utils.merge(\n      headers.common,\n      headers[config.method]\n    );\n\n    contextHeaders && utils.forEach(\n      ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n      (method) => {\n        delete headers[method];\n      }\n    );\n\n    config.headers = AxiosHeaders$1.concat(contextHeaders, headers);\n\n    // filter out skipped interceptors\n    const requestInterceptorChain = [];\n    let synchronousRequestInterceptors = true;\n    this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n      if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {\n        return;\n      }\n\n      synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;\n\n      requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);\n    });\n\n    const responseInterceptorChain = [];\n    this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n      responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);\n    });\n\n    let promise;\n    let i = 0;\n    let len;\n\n    if (!synchronousRequestInterceptors) {\n      const chain = [dispatchRequest.bind(this), undefined];\n      chain.unshift.apply(chain, requestInterceptorChain);\n      chain.push.apply(chain, responseInterceptorChain);\n      len = chain.length;\n\n      promise = Promise.resolve(config);\n\n      while (i < len) {\n        promise = promise.then(chain[i++], chain[i++]);\n      }\n\n      return promise;\n    }\n\n    len = requestInterceptorChain.length;\n\n    let newConfig = config;\n\n    i = 0;\n\n    while (i < len) {\n      const onFulfilled = requestInterceptorChain[i++];\n      const onRejected = requestInterceptorChain[i++];\n      try {\n        newConfig = onFulfilled(newConfig);\n      } catch (error) {\n        onRejected.call(this, error);\n        break;\n      }\n    }\n\n    try {\n      promise = dispatchRequest.call(this, newConfig);\n    } catch (error) {\n      return Promise.reject(error);\n    }\n\n    i = 0;\n    len = responseInterceptorChain.length;\n\n    while (i < len) {\n      promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);\n    }\n\n    return promise;\n  }\n\n  getUri(config) {\n    config = mergeConfig(this.defaults, config);\n    const fullPath = buildFullPath(config.baseURL, config.url);\n    return buildURL(fullPath, config.params, config.paramsSerializer);\n  }\n}\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n  /*eslint func-names:0*/\n  Axios.prototype[method] = function(url, config) {\n    return this.request(mergeConfig(config || {}, {\n      method,\n      url,\n      data: (config || {}).data\n    }));\n  };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n  /*eslint func-names:0*/\n\n  function generateHTTPMethod(isForm) {\n    return function httpMethod(url, data, config) {\n      return this.request(mergeConfig(config || {}, {\n        method,\n        headers: isForm ? {\n          'Content-Type': 'multipart/form-data'\n        } : {},\n        url,\n        data\n      }));\n    };\n  }\n\n  Axios.prototype[method] = generateHTTPMethod();\n\n  Axios.prototype[method + 'Form'] = generateHTTPMethod(true);\n});\n\nvar Axios$1 = Axios;\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @param {Function} executor The executor function.\n *\n * @returns {CancelToken}\n */\nclass CancelToken {\n  constructor(executor) {\n    if (typeof executor !== 'function') {\n      throw new TypeError('executor must be a function.');\n    }\n\n    let resolvePromise;\n\n    this.promise = new Promise(function promiseExecutor(resolve) {\n      resolvePromise = resolve;\n    });\n\n    const token = this;\n\n    // eslint-disable-next-line func-names\n    this.promise.then(cancel => {\n      if (!token._listeners) return;\n\n      let i = token._listeners.length;\n\n      while (i-- > 0) {\n        token._listeners[i](cancel);\n      }\n      token._listeners = null;\n    });\n\n    // eslint-disable-next-line func-names\n    this.promise.then = onfulfilled => {\n      let _resolve;\n      // eslint-disable-next-line func-names\n      const promise = new Promise(resolve => {\n        token.subscribe(resolve);\n        _resolve = resolve;\n      }).then(onfulfilled);\n\n      promise.cancel = function reject() {\n        token.unsubscribe(_resolve);\n      };\n\n      return promise;\n    };\n\n    executor(function cancel(message, config, request) {\n      if (token.reason) {\n        // Cancellation has already been requested\n        return;\n      }\n\n      token.reason = new CanceledError(message, config, request);\n      resolvePromise(token.reason);\n    });\n  }\n\n  /**\n   * Throws a `CanceledError` if cancellation has been requested.\n   */\n  throwIfRequested() {\n    if (this.reason) {\n      throw this.reason;\n    }\n  }\n\n  /**\n   * Subscribe to the cancel signal\n   */\n\n  subscribe(listener) {\n    if (this.reason) {\n      listener(this.reason);\n      return;\n    }\n\n    if (this._listeners) {\n      this._listeners.push(listener);\n    } else {\n      this._listeners = [listener];\n    }\n  }\n\n  /**\n   * Unsubscribe from the cancel signal\n   */\n\n  unsubscribe(listener) {\n    if (!this._listeners) {\n      return;\n    }\n    const index = this._listeners.indexOf(listener);\n    if (index !== -1) {\n      this._listeners.splice(index, 1);\n    }\n  }\n\n  /**\n   * Returns an object that contains a new `CancelToken` and a function that, when called,\n   * cancels the `CancelToken`.\n   */\n  static source() {\n    let cancel;\n    const token = new CancelToken(function executor(c) {\n      cancel = c;\n    });\n    return {\n      token,\n      cancel\n    };\n  }\n}\n\nvar CancelToken$1 = CancelToken;\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n *  ```js\n *  function f(x, y, z) {}\n *  var args = [1, 2, 3];\n *  f.apply(null, args);\n *  ```\n *\n * With `spread` this example can be re-written.\n *\n *  ```js\n *  spread(function(x, y, z) {})([1, 2, 3]);\n *  ```\n *\n * @param {Function} callback\n *\n * @returns {Function}\n */\nfunction spread(callback) {\n  return function wrap(arr) {\n    return callback.apply(null, arr);\n  };\n}\n\n/**\n * Determines whether the payload is an error thrown by Axios\n *\n * @param {*} payload The value to test\n *\n * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n */\nfunction isAxiosError(payload) {\n  return utils.isObject(payload) && (payload.isAxiosError === true);\n}\n\nconst HttpStatusCode = {\n  Continue: 100,\n  SwitchingProtocols: 101,\n  Processing: 102,\n  EarlyHints: 103,\n  Ok: 200,\n  Created: 201,\n  Accepted: 202,\n  NonAuthoritativeInformation: 203,\n  NoContent: 204,\n  ResetContent: 205,\n  PartialContent: 206,\n  MultiStatus: 207,\n  AlreadyReported: 208,\n  ImUsed: 226,\n  MultipleChoices: 300,\n  MovedPermanently: 301,\n  Found: 302,\n  SeeOther: 303,\n  NotModified: 304,\n  UseProxy: 305,\n  Unused: 306,\n  TemporaryRedirect: 307,\n  PermanentRedirect: 308,\n  BadRequest: 400,\n  Unauthorized: 401,\n  PaymentRequired: 402,\n  Forbidden: 403,\n  NotFound: 404,\n  MethodNotAllowed: 405,\n  NotAcceptable: 406,\n  ProxyAuthenticationRequired: 407,\n  RequestTimeout: 408,\n  Conflict: 409,\n  Gone: 410,\n  LengthRequired: 411,\n  PreconditionFailed: 412,\n  PayloadTooLarge: 413,\n  UriTooLong: 414,\n  UnsupportedMediaType: 415,\n  RangeNotSatisfiable: 416,\n  ExpectationFailed: 417,\n  ImATeapot: 418,\n  MisdirectedRequest: 421,\n  UnprocessableEntity: 422,\n  Locked: 423,\n  FailedDependency: 424,\n  TooEarly: 425,\n  UpgradeRequired: 426,\n  PreconditionRequired: 428,\n  TooManyRequests: 429,\n  RequestHeaderFieldsTooLarge: 431,\n  UnavailableForLegalReasons: 451,\n  InternalServerError: 500,\n  NotImplemented: 501,\n  BadGateway: 502,\n  ServiceUnavailable: 503,\n  GatewayTimeout: 504,\n  HttpVersionNotSupported: 505,\n  VariantAlsoNegotiates: 506,\n  InsufficientStorage: 507,\n  LoopDetected: 508,\n  NotExtended: 510,\n  NetworkAuthenticationRequired: 511,\n};\n\nObject.entries(HttpStatusCode).forEach(([key, value]) => {\n  HttpStatusCode[value] = key;\n});\n\nvar HttpStatusCode$1 = HttpStatusCode;\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n *\n * @returns {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n  const context = new Axios$1(defaultConfig);\n  const instance = bind(Axios$1.prototype.request, context);\n\n  // Copy axios.prototype to instance\n  utils.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});\n\n  // Copy context to instance\n  utils.extend(instance, context, null, {allOwnKeys: true});\n\n  // Factory for creating new instances\n  instance.create = function create(instanceConfig) {\n    return createInstance(mergeConfig(defaultConfig, instanceConfig));\n  };\n\n  return instance;\n}\n\n// Create the default instance to be exported\nconst axios = createInstance(defaults$1);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios$1;\n\n// Expose Cancel & CancelToken\naxios.CanceledError = CanceledError;\naxios.CancelToken = CancelToken$1;\naxios.isCancel = isCancel;\naxios.VERSION = VERSION;\naxios.toFormData = toFormData;\n\n// Expose AxiosError class\naxios.AxiosError = AxiosError;\n\n// alias for CanceledError for backward compatibility\naxios.Cancel = axios.CanceledError;\n\n// Expose all/spread\naxios.all = function all(promises) {\n  return Promise.all(promises);\n};\n\naxios.spread = spread;\n\n// Expose isAxiosError\naxios.isAxiosError = isAxiosError;\n\n// Expose mergeConfig\naxios.mergeConfig = mergeConfig;\n\naxios.AxiosHeaders = AxiosHeaders$1;\n\naxios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);\n\naxios.HttpStatusCode = HttpStatusCode$1;\n\naxios.default = axios;\n\nmodule.exports = axios;\n//# sourceMappingURL=axios.cjs.map\n"],"names":[],"sourceRoot":""}