svg-path-commander 1.0.1 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,8 @@
1
- # SVGPathCommander [![Coverage Status](https://coveralls.io/repos/github/thednp/svg-path-commander/badge.svg?branch=master)](https://coveralls.io/github/thednp/svg-path-commander?branch=master) ![cypress version](https://img.shields.io/badge/cypress-9.6.0-brightgreen) ![typescript version](https://img.shields.io/badge/typescript-4.5.2-brightgreen) [![ci](https://github.com/thednp/svg-path-commander/actions/workflows/ci.yml/badge.svg)](https://github.com/thednp/svg-path-commander/actions/workflows/ci.yml)
1
+ # SVGPathCommander
2
+ [![Coverage Status](https://coveralls.io/repos/github/thednp/svg-path-commander/badge.svg)](https://coveralls.io/github/thednp/svg-path-commander)
3
+ ![cypress version](https://img.shields.io/badge/cypress-9.6.1-brightgreen)
4
+ ![typescript version](https://img.shields.io/badge/typescript-4.5.2-brightgreen)
5
+ [![ci](https://github.com/thednp/svg-path-commander/actions/workflows/ci.yml/badge.svg)](https://github.com/thednp/svg-path-commander/actions/workflows/ci.yml)
2
6
 
3
7
  ![image](./docs/assets/SVGPathCommander.svg)
4
8
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * SVGPathCommander v1.0.1 (http://thednp.github.io/svg-path-commander)
2
+ * SVGPathCommander v1.0.4 (http://thednp.github.io/svg-path-commander)
3
3
  * Copyright 2022 © thednp
4
4
  * Licensed under MIT (https://github.com/thednp/svg-path-commander/blob/master/LICENSE)
5
5
  */
@@ -37,7 +37,16 @@
37
37
  var data = path.data;
38
38
 
39
39
  while (data.length >= paramsCount[LK]) {
40
- path.segments.push([pathCommand ].concat( data.splice(0, paramsCount[LK])));
40
+ // overloaded `moveTo`
41
+ // https://github.com/rveciana/svg-path-properties/blob/master/src/parse.ts
42
+ if (LK === 'm' && data.length > 2) {
43
+ path.segments.push([pathCommand ].concat( data.splice(0, 2)));
44
+ LK = 'l';
45
+ pathCommand = pathCommand === 'm' ? 'l' : 'L';
46
+ } else {
47
+ path.segments.push([pathCommand ].concat( data.splice(0, paramsCount[LK])));
48
+ }
49
+
41
50
  if (!paramsCount[LK]) {
42
51
  break;
43
52
  }
@@ -384,15 +393,13 @@
384
393
  * of segments we like to call `pathArray`.
385
394
  *
386
395
  * @param {SVGPath.pathArray | string} pathInput the string to be parsed
387
- * @returns {SVGPath.pathArray | string} the resulted `pathArray`
396
+ * @returns {SVGPath.pathArray | string} the resulted `pathArray` or error string
388
397
  */
389
398
  function parsePathString(pathInput) {
390
399
  if (isPathArray(pathInput)) {
391
- // @ts-ignore -- isPathArray also checks if it's an `Array`
392
400
  return clonePath(pathInput);
393
401
  }
394
402
 
395
- // @ts-ignore -- pathInput is now string
396
403
  var path = new PathParser(pathInput);
397
404
 
398
405
  skipSpaces(path);
@@ -401,14 +408,6 @@
401
408
  scanSegment(path);
402
409
  }
403
410
 
404
- // if (!path.err.length) {
405
- // if (!'mM'.includes(path.segments[0][0])) {
406
- // path.err = `${error}: missing M/m`;
407
- // } else {
408
- // path.segments[0][0] = 'M';
409
- // }
410
- // }
411
-
412
411
  return path.err ? path.err : path.segments;
413
412
  }
414
413
 
@@ -549,7 +548,6 @@
549
548
  function pathToRelative(pathInput) {
550
549
  /* istanbul ignore else */
551
550
  if (isRelativeArray(pathInput)) {
552
- // @ts-ignore -- `isRelativeArray` checks if it's `pathArray`
553
551
  return clonePath(pathInput);
554
552
  }
555
553
 
@@ -557,14 +555,12 @@
557
555
  var x = 0; var y = 0;
558
556
  var mx = 0; var my = 0;
559
557
 
560
- // @ts-ignore -- this is actually a `relativeArray`
561
558
  return path.map(function (segment) {
562
559
  var assign;
563
560
 
564
561
  var values = segment.slice(1).map(Number);
565
562
  var pathCommand = segment[0];
566
563
  /** @type {SVGPath.relativeCommand} */
567
- // @ts-ignore
568
564
  var relativeCommand = pathCommand.toLowerCase();
569
565
 
570
566
  if (pathCommand === 'M') {
@@ -575,7 +571,6 @@
575
571
  }
576
572
 
577
573
  /** @type {SVGPath.relativeSegment} */
578
- // @ts-ignore -- trust me DON'T CHANGE
579
574
  var relativeSegment = [];
580
575
 
581
576
  if (pathCommand !== relativeCommand) {
@@ -595,15 +590,7 @@
595
590
  // use brakets for `eslint: no-case-declaration`
596
591
  // https://stackoverflow.com/a/50753272/803358
597
592
  var relValues = values.map(function (n, j) { return n - (j % 2 ? y : x); });
598
- // @ts-ignore for M, L, C, S, Q, T
599
593
  relativeSegment = [relativeCommand ].concat( relValues);
600
-
601
- // this branch makes no sense anymore
602
- // if (relativeCommand === 'm') {
603
- // [x, y] = values;
604
- // mx = x;
605
- // my = y;
606
- // }
607
594
  }
608
595
  }
609
596
  } else {
@@ -611,7 +598,6 @@
611
598
  mx = values[0] + x;
612
599
  my = values[1] + y;
613
600
  }
614
- // @ts-ignore
615
601
  relativeSegment = [relativeCommand ].concat( values);
616
602
  }
617
603
 
@@ -622,17 +608,13 @@
622
608
  y = my;
623
609
  break;
624
610
  case 'h':
625
- // @ts-ignore
626
611
  x += relativeSegment[1];
627
612
  break;
628
613
  case 'v':
629
- // @ts-ignore
630
614
  y += relativeSegment[1];
631
615
  break;
632
616
  default:
633
- // @ts-ignore
634
617
  x += relativeSegment[segLength - 2];
635
- // @ts-ignore
636
618
  y += relativeSegment[segLength - 1];
637
619
  }
638
620
  return relativeSegment;
@@ -1234,7 +1216,7 @@
1234
1216
  var segment = seg.seg;
1235
1217
  var data = seg.n;
1236
1218
  var prevSeg = i && path[i - 1];
1237
- var nextSeg = path[i + 1] && path[i + 1];
1219
+ var nextSeg = path[i + 1];
1238
1220
  var pathCommand = seg.c;
1239
1221
  var pLen = path.length;
1240
1222
  /** @type {number} */
@@ -1258,7 +1240,7 @@
1258
1240
  }
1259
1241
  break;
1260
1242
  case 'S':
1261
- if ((prevSeg && 'CS'.includes(prevSeg.c)) && (!nextSeg || (nextSeg && nextSeg.c !== 'S'))) {
1243
+ if ((prevSeg && 'CS'.includes(prevSeg.c)) && (!nextSeg || nextSeg.c !== 'S')) {
1262
1244
  result = ['C', data[3], data[4], data[1], data[2], x, y];
1263
1245
  } else {
1264
1246
  result = [pathCommand, data[1], data[2], x, y];
@@ -1272,7 +1254,7 @@
1272
1254
  }
1273
1255
  break;
1274
1256
  case 'T':
1275
- if ((prevSeg && 'QT'.includes(prevSeg.c)) && (!nextSeg || (nextSeg && nextSeg.c !== 'T'))) {
1257
+ if ((prevSeg && 'QT'.includes(prevSeg.c)) && (!nextSeg || nextSeg.c !== 'T')) {
1276
1258
  result = ['Q', data[1], data[2], x, y];
1277
1259
  } else {
1278
1260
  result = [pathCommand, x, y];
@@ -1991,7 +1973,7 @@
1991
1973
  m.m31 = 0; m.m32 = 0; m.m33 = 1; m.m34 = 0;
1992
1974
  m.m41 = 0; m.m42 = 0; m.m43 = 0; m.m44 = 1;
1993
1975
 
1994
- if (args && args.length) {
1976
+ if (args.length) {
1995
1977
  var ARGS = [16, 6].some(function (l) { return l === args.length; }) ? args : args[0];
1996
1978
 
1997
1979
  return m.setMatrixValue(ARGS);
@@ -2295,9 +2277,7 @@
2295
2277
  toArray: toArray,
2296
2278
  });
2297
2279
 
2298
- var version$1 = "1.0.1";
2299
-
2300
- // @ts-ignore
2280
+ var version$1 = "1.0.3";
2301
2281
 
2302
2282
  /**
2303
2283
  * A global namespace for library version.
@@ -2305,6 +2285,8 @@
2305
2285
  */
2306
2286
  var Version$1 = version$1;
2307
2287
 
2288
+ /** @typedef {import('../types/index')} */
2289
+
2308
2290
  Object.assign(CSSMatrix, { Version: Version$1 });
2309
2291
 
2310
2292
  /**
@@ -2953,10 +2935,9 @@
2953
2935
 
2954
2936
  var path = normalizePath(pathInput);
2955
2937
  var distanceIsNumber = typeof distance === 'number';
2956
- var isM = true;
2957
- /** @type {number[]} */
2938
+ var isM;
2958
2939
  var data = [];
2959
- var pathCommand = 'M';
2940
+ var pathCommand;
2960
2941
  var x = 0;
2961
2942
  var y = 0;
2962
2943
  var mx = 0;
@@ -3106,6 +3087,8 @@
3106
3087
  * @returns {SVGPathCommander} a new SVGPathCommander instance
3107
3088
  */
3108
3089
  var SVGPathCommander = function SVGPathCommander(pathValue, config) {
3090
+ var assign;
3091
+
3109
3092
  var instanceOptions = config || {};
3110
3093
 
3111
3094
  var undefPath = typeof pathValue === 'undefined';
@@ -3132,19 +3115,22 @@
3132
3115
  var cz = ref.cz;
3133
3116
 
3134
3117
  // set instance options.round
3135
- var round = defaultOptions.round;
3136
- var origin = defaultOptions.origin;
3137
3118
  var roundOption = instanceOptions.round;
3138
3119
  var originOption = instanceOptions.origin;
3120
+ var round;
3139
3121
 
3140
3122
  if (roundOption === 'auto') {
3141
3123
  var pathScale = (("" + (Math.floor(Math.max(width, height))))).length;
3142
3124
  round = pathScale >= 4 ? 0 : 4 - pathScale;
3143
3125
  } else if (Number.isInteger(roundOption) || roundOption === 'off') {
3144
3126
  round = roundOption;
3127
+ } else {
3128
+ ((assign = defaultOptions, round = assign.round));
3145
3129
  }
3146
3130
 
3147
3131
  // set instance options.origin
3132
+ // the SVGPathCommander class will always override the default origin
3133
+ var origin;
3148
3134
  if (Array.isArray(originOption) && originOption.length >= 2) {
3149
3135
  var ref$1 = originOption.map(Number);
3150
3136
  var originX = ref$1[0];
@@ -3158,10 +3144,9 @@
3158
3144
  origin = [cx, cy, cz];
3159
3145
  }
3160
3146
 
3161
- /**
3162
- * @type {number | 'off'}
3163
- */
3147
+ /** @type {number | 'off'} */
3164
3148
  this.round = round;
3149
+ /** @type {[number, number, number=]} */
3165
3150
  this.origin = origin;
3166
3151
 
3167
3152
  return this;
@@ -3495,7 +3480,6 @@
3495
3480
  * @returns {SVGPath.pointProperties} the requested properties
3496
3481
  */
3497
3482
  function getPropertiesAtPoint(pathInput, point) {
3498
- // const path = fixPath(parsePathString(pathInput));
3499
3483
  var path = (parsePathString(pathInput));
3500
3484
  var normalPath = normalizePath(path);
3501
3485
  var pathLength = getTotalLength(path);
@@ -3506,9 +3490,9 @@
3506
3490
  return dx * dx + dy * dy;
3507
3491
  };
3508
3492
  var precision = 8;
3509
- var scan = { x: 0, y: 0 };
3493
+ var scan;
3510
3494
  var scanDistance = 0;
3511
- var closest = scan;
3495
+ var closest;
3512
3496
  var bestLength = 0;
3513
3497
  var bestDistance = Infinity;
3514
3498
 
@@ -3525,8 +3509,8 @@
3525
3509
 
3526
3510
  // binary search for precise estimate
3527
3511
  precision /= 2;
3528
- var before = { x: 0, y: 0 };
3529
- var after = before;
3512
+ var before;
3513
+ var after;
3530
3514
  var beforeLength = 0;
3531
3515
  var afterLength = 0;
3532
3516
  var beforeDistance = 0;
@@ -3577,9 +3561,6 @@
3577
3561
  * @returns {SVGPath.pathSegment?} the requested segment
3578
3562
  */
3579
3563
  function getSegmentOfPoint(path, point) {
3580
- // const props = getPropertiesAtPoint(path, point);
3581
- // const { segment } = props;
3582
- // return typeof segment !== 'undefined' ? segment.segment : null;
3583
3564
  return getPropertiesAtPoint(path, point).segment;
3584
3565
  }
3585
3566
 
@@ -3590,9 +3571,6 @@
3590
3571
  * @returns {SVGPath.pathSegment?} the requested segment
3591
3572
  */
3592
3573
  function getSegmentAtLength(pathInput, distance) {
3593
- // const props = getPropertiesAtLength(pathInput, distance);
3594
- // const { segment } = typeof props !== 'undefined' ? props : { segment: null };
3595
- // return segment;
3596
3574
  return getPropertiesAtLength(pathInput, distance).segment;
3597
3575
  }
3598
3576
 
@@ -3851,12 +3829,6 @@
3851
3829
  return [['M' ].concat( rotatedCurve[0].slice(0, 2)) ].concat( rotatedCurve.map(function (x) { return ['C' ].concat( x.slice(2)); }));
3852
3830
  }
3853
3831
 
3854
- /**
3855
- * Must have at least one import of the main namespace.
3856
- * @typedef {import('../../types/index')}
3857
- * @typedef {import('../types/index')}
3858
- */
3859
-
3860
3832
  /**
3861
3833
  * @interface
3862
3834
  */
@@ -3898,7 +3870,7 @@
3898
3870
  options: defaultOptions,
3899
3871
  };
3900
3872
 
3901
- var version = "1.0.1";
3873
+ var version = "1.0.4";
3902
3874
 
3903
3875
  /**
3904
3876
  * A global namespace for library version.
@@ -3906,6 +3878,8 @@
3906
3878
  */
3907
3879
  var Version = version;
3908
3880
 
3881
+ /** @typedef {import('../types/index')} */
3882
+
3909
3883
  // Export to global
3910
3884
  Object.assign(SVGPathCommander, Util, { Version: Version });
3911
3885
 
@@ -1,2 +1,2 @@
1
- // SVGPathCommander v1.0.1 | thednp © 2022 | MIT-License
2
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).SVGPathCommander=e()}(this,(function(){"use strict";var t={origin:[0,0,0],round:4},e={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function r(t){for(var r=t.pathValue[t.segmentStart],n=r.toLowerCase(),a=t.data;a.length>=e[n]&&(t.segments.push([r].concat(a.splice(0,e[n]))),e[n]););}var n="SVGPathCommander error";function a(t){var e=t.index,r=t.pathValue,a=r.charCodeAt(e);return 48===a?(t.param=0,void(t.index+=1)):49===a?(t.param=1,void(t.index+=1)):void(t.err=n+': invalid Arc flag "'+r[e]+'", expecting 0 or 1 at index '+e)}function i(t){return t>=48&&t<=57}function o(t){var e,r=t.max,a=t.pathValue,o=t.index,u=o,c=!1,s=!1,m=!1,f=!1;if(u>=r)t.err=n+": Invalid path value at index "+u+', "pathValue" is missing param';else if(43!==(e=a.charCodeAt(u))&&45!==e||(u+=1,e=a.charCodeAt(u)),i(e)||46===e){if(46!==e){if(c=48===e,u+=1,e=a.charCodeAt(u),c&&u<r&&e&&i(e))return void(t.err=n+": Invalid path value at index "+o+', "'+a[o]+'" illegal number');for(;u<r&&i(a.charCodeAt(u));)u+=1,s=!0;e=a.charCodeAt(u)}if(46===e){for(f=!0,u+=1;i(a.charCodeAt(u));)u+=1,m=!0;e=a.charCodeAt(u)}if(101===e||69===e){if(f&&!s&&!m)return void(t.err=n+": Invalid path value at index "+u+', "'+a[u]+'" invalid float exponent');if(u+=1,43!==(e=a.charCodeAt(u))&&45!==e||(u+=1),!(u<r&&i(a.charCodeAt(u))))return void(t.err=n+": Invalid path value at index "+u+', "'+a[u]+'" invalid integer exponent');for(;u<r&&i(a.charCodeAt(u));)u+=1}t.index=u,t.param=+t.pathValue.slice(o,u)}else t.err=n+": Invalid path value at index "+u+', "'+a[u]+'" is not a number'}function u(t){for(var e,r=t.pathValue,n=t.max;t.index<n&&(10===(e=r.charCodeAt(t.index))||13===e||8232===e||8233===e||32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e));)t.index+=1}function c(t){return t>=48&&t<=57||43===t||45===t||46===t}function s(t){var i=t.max,s=t.pathValue,m=t.index,f=s.charCodeAt(m),h=e[s[m].toLowerCase()];if(t.segmentStart=m,function(t){switch(32|t){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:return!0;default:return!1}}(f))if(t.index+=1,u(t),t.data=[],h){for(;;){for(var l=h;l>0;l-=1){if(97!=(32|f)||3!==l&&4!==l?o(t):a(t),t.err.length)return;t.data.push(t.param),u(t),t.index<i&&44===s.charCodeAt(t.index)&&(t.index+=1,u(t))}if(t.index>=t.max)break;if(!c(s.charCodeAt(t.index)))break}r(t)}else r(t);else t.err=n+': Invalid path value "'+s[m]+'" is not a path command'}function m(t){return t.map((function(t){return Array.isArray(t)?[].concat(t):t}))}function f(t){this.segments=[],this.pathValue=t,this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}function h(t){return Array.isArray(t)&&t.every((function(t){var r=t[0].toLowerCase();return e[r]===t.length-1&&"achlmqstvz".includes(r)}))}function l(t){if(h(t))return m(t);var e=new f(t);for(u(e);e.index<e.max&&!e.err.length;)s(e);return e.err?e.err:e.segments}function p(t){return h(t)&&t.every((function(t){var e=t[0];return e===e.toUpperCase()}))}function y(t){if(p(t))return m(t);var e=l(t),r=0,n=0,a=0,i=0;return e.map((function(t){var e,o=t.slice(1).map(Number),u=t[0],c=u.toUpperCase();if("M"===u)return r=(e=o)[0],n=e[1],a=r,i=n,["M",r,n];var s=[];if(u!==c)switch(c){case"A":s=[c,o[0],o[1],o[2],o[3],o[4],o[5]+r,o[6]+n];break;case"V":s=[c,o[0]+n];break;case"H":s=[c,o[0]+r];break;default:var m=o.map((function(t,e){return t+(e%2?n:r)}));s=[c].concat(m)}else s=[c].concat(o);var f=s.length;switch(c){case"Z":r=a,n=i;break;case"H":r=s[1];break;case"V":n=s[1];break;default:r=s[f-2],n=s[f-1],"M"===c&&(a=r,i=n)}return s}))}function v(t){return h(t)&&t.slice(1).every((function(t){var e=t[0];return e===e.toLowerCase()}))}function x(t){if(v(t))return m(t);var e=l(t),r=0,n=0,a=0,i=0;return e.map((function(t){var e,o=t.slice(1).map(Number),u=t[0],c=u.toLowerCase();if("M"===u)return r=(e=o)[0],n=e[1],a=r,i=n,["M",r,n];var s=[];if(u!==c)switch(c){case"a":s=[c,o[0],o[1],o[2],o[3],o[4],o[5]-r,o[6]-n];break;case"v":s=[c,o[0]-n];break;case"h":s=[c,o[0]-r];break;default:var m=o.map((function(t,e){return t-(e%2?n:r)}));s=[c].concat(m)}else"m"===u&&(a=o[0]+r,i=o[1]+n),s=[c].concat(o);var f=s.length;switch(c){case"z":r=a,n=i;break;case"h":r+=s[1];break;case"v":n+=s[1];break;default:r+=s[f-2],n+=s[f-1]}return s}))}function g(t,e,r){if(t[r].length>7){t[r].shift();for(var n=t[r],a=r;n.length;)e[r]="A",t.splice(a+=1,0,["C"].concat(n.splice(0,6)));t.splice(r,1)}}function d(t,e){var r=t[0],n=e.x1,a=e.y1,i=e.x2,o=e.y2,u=t.slice(1).map(Number),c=t;if("TQ".includes(r)||(e.qx=null,e.qy=null),"H"===r)c=["L",t[1],a];else if("V"===r)c=["L",n,t[1]];else if("S"===r){var s=2*n-i,m=2*a-o;e.x1=s,e.y1=m,c=["C",s,m].concat(u)}else if("T"===r){var f=2*n-e.qx,h=2*a-e.qy;e.qx=f,e.qy=h,c=["Q",f,h].concat(u)}else if("Q"===r){var l=u[0],p=u[1];e.qx=l,e.qy=p}return c}function M(t){return p(t)&&t.every((function(t){var e=t[0];return"ACLMQZ".includes(e)}))}var b={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function w(t){if(M(t))return m(t);for(var e=y(t),r=Object.assign({},b),n=[],a=e.length,i="",o=0;o<a;o+=1){i=e[o][0],n[o]=i,e[o]=d(e[o],r);var u=e[o],c=u.length;r.x1=+u[c-2],r.y1=+u[c-1],r.x2=+u[c-4]||r.x1,r.y2=+u[c-3]||r.y1}return e}function N(t){var e=l(t),r=w(e),n=e.length,a="Z"===r.slice(-1)[0][0],i=a?n-2:n-1,o=r[0].slice(1),u=o[0],c=o[1],s=r[i].slice(-2),m=s[0],f=s[1];return a&&u===m&&c===f?e.slice(0,-1):e}function A(t){return M(t)&&t.every((function(t){var e=t[0];return"MC".includes(e)}))}function C(t,e,r){return{x:t*Math.cos(r)-e*Math.sin(r),y:t*Math.sin(r)+e*Math.cos(r)}}function S(t,e,r,n,a,i,o,u,c,s){var m,f,h,l,p,y,v=t,x=e,g=r,d=n,M=u,b=c,w=120*Math.PI/180,N=Math.PI/180*(+a||0),A=[];if(s)h=(m=s)[0],l=m[1],p=m[2],y=m[3];else{v=(f=C(v,x,-N)).x,x=f.y;var k=(v-(M=(f=C(M,b,-N)).x))/2,P=(x-(b=f.y))/2,T=k*k/(g*g)+P*P/(d*d);T>1&&(g*=T=Math.sqrt(T),d*=T);var j=g*g,q=d*d,I=(i===o?-1:1)*Math.sqrt(Math.abs((j*q-j*P*P-q*k*k)/(j*P*P+q*k*k)));p=I*g*P/d+(v+M)/2,y=I*-d*k/g+(x+b)/2,h=(Math.asin((x-y)/d)*Math.pow(10,9)>>0)/Math.pow(10,9),l=(Math.asin((b-y)/d)*Math.pow(10,9)>>0)/Math.pow(10,9),h=v<p?Math.PI-h:h,l=M<p?Math.PI-l:l,h<0&&(h=2*Math.PI+h),l<0&&(l=2*Math.PI+l),o&&h>l&&(h-=2*Math.PI),!o&&l>h&&(l-=2*Math.PI)}var O=l-h;if(Math.abs(O)>w){var V=l,L=M,E=b;l=h+w*(o&&l>h?1:-1),A=S(M=p+g*Math.cos(l),b=y+d*Math.sin(l),g,d,a,0,o,L,E,[l,V,p,y])}O=l-h;var z=Math.cos(h),Z=Math.sin(h),Q=Math.cos(l),D=Math.sin(l),F=Math.tan(O/4),H=4/3*g*F,X=4/3*d*F,Y=[v,x],B=[v+H*Z,x-X*z],R=[M+H*D,b-X*Q],G=[M,b];if(B[0]=2*Y[0]-B[0],B[1]=2*Y[1]-B[1],s)return B.concat(R,G,A);for(var J=[],U=0,K=(A=B.concat(R,G,A)).length;U<K;U+=1)J[U]=U%2?C(A[U-1],A[U],N).y:C(A[U],A[U+1],N).x;return J}function k(t,e,r,n,a,i){return[1/3*t+2/3*r,1/3*e+2/3*n,1/3*a+2/3*r,1/3*i+2/3*n,a,i]}function P(t,e,r){var n=t[0],a=t[1];return[n+(e[0]-n)*r,a+(e[1]-a)*r]}function T(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}function j(t,e,r,n,a){var i=T([t,e],[r,n]),o={x:0,y:0};if("number"==typeof a)if(0===a)o={x:t,y:e};else if(a>=i)o={x:r,y:n};else{var u=P([t,e],[r,n],a/i);o={x:u[0],y:u[1]}}return{length:i,point:o,min:{x:Math.min(t,r),y:Math.min(e,n)},max:{x:Math.max(t,r),y:Math.max(e,n)}}}function q(t,e,r,n){var a=.5,i=[t,e],o=[r,n],u=P(i,o,a),c=P(o,u,a),s=P(u,c,a),m=P(c,s,a),f=P(s,m,a),h=i.concat(u,s,f,[a]),l=j.apply(void 0,h).point,p=f.concat(m,c,o,[0]),y=j.apply(void 0,p).point;return[l.x,l.y,y.x,y.y,r,n]}function I(t,e){var r,n=t[0],a=t.slice(1).map(Number),i=a[0],o=a[1],u=e.x1,c=e.y1,s=e.x,m=e.y;switch("TQ".includes(n)||(e.qx=null,e.qy=null),n){case"M":return e.x=i,e.y=o,t;case"A":return r=[u,c].concat(a),["C"].concat(S.apply(void 0,r));case"Q":return e.qx=i,e.qy=o,r=[u,c].concat(a),["C"].concat(k.apply(void 0,r));case"L":return["C"].concat(q(u,c,i,o));case"Z":return["C"].concat(q(u,c,s,m))}return t}function O(t){if(A(t))return m(t);for(var e=N(w(t)),r=Object.assign({},b),n=[],a="",i=e.length,o=0;o<i;o+=1){a=e[o][0],n[o]=a,e[o]=I(e[o],r),g(e,n,o),i=e.length;var u=e[o],c=u.length;r.x1=+u[c-2],r.y1=+u[c-1],r.x2=+u[c-4]||r.x1,r.y2=+u[c-3]||r.y1}return e}function V(e,r){var n=t.round;if("off"===r||"off"===n)return m(e);var a="number"==typeof(n=r>=0?r:n)&&n>=1?Math.pow(10,n):1;return e.map((function(t){var e=t.slice(1).map(Number).map((function(t){return n?Math.round(t*a)/a:Math.round(t)}));return[t[0]].concat(e)}))}function L(t,e){return V(t,e).map((function(t){return t[0]+t.slice(1).join(" ")})).join("")}function E(t){var e=y(t),r="Z"===e.slice(-1)[0][0],n=w(e).map((function(t,r){var n=t.slice(-2).map(Number),a=n[0],i=n[1];return{seg:e[r],n:t,c:e[r][0],x:a,y:i}})).map((function(t,e,n){var a=t.seg,i=t.n,o=e&&n[e-1],u=n[e+1]&&n[e+1],c=t.c,s=n.length,m=e?n[e-1].x:n[s-1].x,f=e?n[e-1].y:n[s-1].y,h=[];switch(c){case"M":h=r?["Z"]:[c,m,f];break;case"A":h=[c].concat(a.slice(1,-3),[1===a[5]?0:1],[m],[f]);break;case"C":h=u&&"S"===u.c?["S",a[1],a[2],m,f]:[c,a[3],a[4],a[1],a[2],m,f];break;case"S":h=o&&"CS".includes(o.c)&&(!u||u&&"S"!==u.c)?["C",i[3],i[4],i[1],i[2],m,f]:[c,i[1],i[2],m,f];break;case"Q":h=u&&"T"===u.c?["T",m,f]:[c].concat(a.slice(1,-2),[m],[f]);break;case"T":h=o&&"QT".includes(o.c)&&(!u||u&&"T"!==u.c)?["Q",i[1],i[2],m,f]:[c,m,f];break;case"Z":h=["M",m,f];break;case"H":h=[c,m];break;case"V":h=[c,f];break;default:h=[c].concat(a.slice(1,-2),[m],[f])}return h}));return r?n.reverse():[n[0]].concat(n.slice(1).reverse())}function z(t){var e,r=[],n=-1;return t.forEach((function(t){"M"===t[0]?(e=[t],n+=1):e=e.concat([t]),r[n]=e})),r}function Z(t,e,r,n){var a=t[0],i=function(t){return Math.round(t*Math.pow(10,4))/Math.pow(10,4)},o=t.slice(1).map((function(t){return+t})),u=e.slice(1).map((function(t){return+t})),c=r.x1,s=r.y1,m=r.x2,f=r.y2,h=r.x,l=r.y,p=t,y=u.slice(-2),v=y[0],x=y[1];if("TQ".includes(a)||(r.qx=null,r.qy=null),["V","H","S","T","Z"].includes(a))p=[a].concat(o);else if("L"===a)i(h)===i(v)?p=["V",x]:i(l)===i(x)&&(p=["H",v]);else if("C"===a){var g=u[0],d=u[1];"CS".includes(n)&&(i(g)===i(2*c-m)&&i(d)===i(2*s-f)||i(c)===i(2*m-h)&&i(s)===i(2*f-l))&&(p=["S"].concat(u.slice(-4))),r.x1=g,r.y1=d}else if("Q"===a){var M=u[0],b=u[1];r.qx=M,r.qy=b,"QT".includes(n)&&(i(M)===i(2*c-m)&&i(b)===i(2*s-f)||i(c)===i(2*m-h)&&i(s)===i(2*f-l))&&(p=["T"].concat(u.slice(-2)))}return p}function Q(t,e){for(var r,n=y(t),a=w(n),i=Object.assign({},b),o=[],u=n.length,c="",s="",m=0,f=0,h=0,l=0,p=0;p<u;p+=1){c=n[p][0],o[p]=c,p&&(s=o[p-1]),n[p]=Z(n[p],a[p],i,s);var v=n[p],g=v.length;switch(i.x1=+v[g-2],i.y1=+v[g-1],i.x2=+v[g-4]||i.x1,i.y2=+v[g-3]||i.y1,c){case"Z":m=h,f=l;break;case"H":m=v[1];break;case"V":f=v[1];break;default:m=(r=v.slice(-2).map(Number))[0],f=r[1],"M"===c&&(h=m,l=f)}i.x=m,i.y=f}var d=V(n,e),M=V(x(n),e);return d.map((function(t,e){return e?t.join("").length<M[e].join("").length?t:M[e]:t}))}function D(t){var e=new $,r=Array.from(t);if(!r.every((function(t){return!Number.isNaN(t)})))throw TypeError('CSSMatrix: "'+t+'" must only have numbers.');if(16===r.length){var n=r[0],a=r[1],i=r[2],o=r[3],u=r[4],c=r[5],s=r[6],m=r[7],f=r[8],h=r[9],l=r[10],p=r[11],y=r[12],v=r[13],x=r[14],g=r[15];e.m11=n,e.a=n,e.m21=u,e.c=u,e.m31=f,e.m41=y,e.e=y,e.m12=a,e.b=a,e.m22=c,e.d=c,e.m32=h,e.m42=v,e.f=v,e.m13=i,e.m23=s,e.m33=l,e.m43=x,e.m14=o,e.m24=m,e.m34=p,e.m44=g}else{if(6!==r.length)throw new TypeError("CSSMatrix: expecting an Array of 6/16 values.");var d=r[0],M=r[1],b=r[2],w=r[3],N=r[4],A=r[5];e.m11=d,e.a=d,e.m12=M,e.b=M,e.m21=b,e.c=b,e.m22=w,e.d=w,e.m41=N,e.e=N,e.m42=A,e.f=A}return e}function F(t){var e=Object.keys(new $);if("object"==typeof t&&e.every((function(e){return e in t})))return D([t.m11,t.m12,t.m13,t.m14,t.m21,t.m22,t.m23,t.m24,t.m31,t.m32,t.m33,t.m34,t.m41,t.m42,t.m43,t.m44]);throw TypeError('CSSMatrix: "'+JSON.stringify(t)+'" is not a DOMMatrix / CSSMatrix / JSON compatible object.')}function H(t){if("string"!=typeof t)throw TypeError('CSSMatrix: "'+t+'" is not a string.');var e=String(t).replace(/\s/g,""),r=new $,n='CSSMatrix: invalid transform string "'+t+'"';return e.split(")").filter((function(t){return t})).forEach((function(t){var e=t.split("("),a=e[0],i=e[1];if(!i)throw TypeError(n);var o=i.split(",").map((function(t){return t.includes("rad")?parseFloat(t)*(180/Math.PI):parseFloat(t)})),u=o[0],c=o[1],s=o[2],m=o[3],f=[u,c,s],h=[u,c,s,m];if("perspective"===a&&u&&[c,s].every((function(t){return void 0===t})))r.m34=-1/u;else if(a.includes("matrix")&&[6,16].includes(o.length)&&o.every((function(t){return!Number.isNaN(+t)}))){var l=o.map((function(t){return Math.abs(t)<1e-6?0:t}));r=r.multiply(D(l))}else if("translate3d"===a&&f.every((function(t){return!Number.isNaN(+t)})))r=r.translate(u,c,s);else if("translate"===a&&u&&void 0===s)r=r.translate(u,c||0,0);else if("rotate3d"===a&&h.every((function(t){return!Number.isNaN(+t)}))&&m)r=r.rotateAxisAngle(u,c,s,m);else if("rotate"===a&&u&&[c,s].every((function(t){return void 0===t})))r=r.rotate(0,0,u);else if("scale3d"===a&&f.every((function(t){return!Number.isNaN(+t)}))&&f.some((function(t){return 1!==t})))r=r.scale(u,c,s);else if("scale"!==a||Number.isNaN(u)||1===u||void 0!==s)if("skew"===a&&(u||!Number.isNaN(u)&&c)&&void 0===s)r=r.skew(u,c||0);else{if(!(/[XYZ]/.test(a)&&u&&[c,s].every((function(t){return void 0===t}))&&["translate","rotate","scale","skew"].some((function(t){return a.includes(t)}))))throw TypeError(n);if(["skewX","skewY"].includes(a))r=r[a](u);else{var p=a.replace(/[XYZ]/,""),y=a.replace(p,""),v=["X","Y","Z"].indexOf(y),x="scale"===p?1:0,g=[0===v?u:x,1===v?u:x,2===v?u:x];r=r[p].apply(r,g)}}else{var d=Number.isNaN(+c)?u:c;r=r.scale(u,d,1)}})),r}function X(t,e){return e?[t.a,t.b,t.c,t.d,t.e,t.f]:[t.m11,t.m12,t.m13,t.m14,t.m21,t.m22,t.m23,t.m24,t.m31,t.m32,t.m33,t.m34,t.m41,t.m42,t.m43,t.m44]}function Y(t,e,r){var n=new $;return n.m41=t,n.e=t,n.m42=e,n.f=e,n.m43=r,n}function B(t,e,r){var n=new $,a=Math.PI/180,i=t*a,o=e*a,u=r*a,c=Math.cos(i),s=-Math.sin(i),m=Math.cos(o),f=-Math.sin(o),h=Math.cos(u),l=-Math.sin(u),p=m*h,y=-m*l;n.m11=p,n.a=p,n.m12=y,n.b=y,n.m13=f;var v=s*f*h+c*l;n.m21=v,n.c=v;var x=c*h-s*f*l;return n.m22=x,n.d=x,n.m23=-s*m,n.m31=s*l-c*f*h,n.m32=s*h+c*f*l,n.m33=c*m,n}function R(t,e,r,n){var a=new $,i=Math.sqrt(t*t+e*e+r*r);if(0===i)return a;var o=t/i,u=e/i,c=r/i,s=n*(Math.PI/360),m=Math.sin(s),f=Math.cos(s),h=m*m,l=o*o,p=u*u,y=c*c,v=1-2*(p+y)*h;a.m11=v,a.a=v;var x=2*(o*u*h+c*m*f);a.m12=x,a.b=x,a.m13=2*(o*c*h-u*m*f);var g=2*(u*o*h-c*m*f);a.m21=g,a.c=g;var d=1-2*(y+l)*h;return a.m22=d,a.d=d,a.m23=2*(u*c*h+o*m*f),a.m31=2*(c*o*h+u*m*f),a.m32=2*(c*u*h-o*m*f),a.m33=1-2*(l+p)*h,a}function G(t,e,r){var n=new $;return n.m11=t,n.a=t,n.m22=e,n.d=e,n.m33=r,n}function J(t,e){var r=new $;if(t){var n=t*Math.PI/180,a=Math.tan(n);r.m21=a,r.c=a}if(e){var i=e*Math.PI/180,o=Math.tan(i);r.m12=o,r.b=o}return r}function U(t){return J(t,0)}function K(t){return J(0,t)}function W(t,e){return D([e.m11*t.m11+e.m12*t.m21+e.m13*t.m31+e.m14*t.m41,e.m11*t.m12+e.m12*t.m22+e.m13*t.m32+e.m14*t.m42,e.m11*t.m13+e.m12*t.m23+e.m13*t.m33+e.m14*t.m43,e.m11*t.m14+e.m12*t.m24+e.m13*t.m34+e.m14*t.m44,e.m21*t.m11+e.m22*t.m21+e.m23*t.m31+e.m24*t.m41,e.m21*t.m12+e.m22*t.m22+e.m23*t.m32+e.m24*t.m42,e.m21*t.m13+e.m22*t.m23+e.m23*t.m33+e.m24*t.m43,e.m21*t.m14+e.m22*t.m24+e.m23*t.m34+e.m24*t.m44,e.m31*t.m11+e.m32*t.m21+e.m33*t.m31+e.m34*t.m41,e.m31*t.m12+e.m32*t.m22+e.m33*t.m32+e.m34*t.m42,e.m31*t.m13+e.m32*t.m23+e.m33*t.m33+e.m34*t.m43,e.m31*t.m14+e.m32*t.m24+e.m33*t.m34+e.m34*t.m44,e.m41*t.m11+e.m42*t.m21+e.m43*t.m31+e.m44*t.m41,e.m41*t.m12+e.m42*t.m22+e.m43*t.m32+e.m44*t.m42,e.m41*t.m13+e.m42*t.m23+e.m43*t.m33+e.m44*t.m43,e.m41*t.m14+e.m42*t.m24+e.m43*t.m34+e.m44*t.m44])}var $=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=this;if(r.a=1,r.b=0,r.c=0,r.d=1,r.e=0,r.f=0,r.m11=1,r.m12=0,r.m13=0,r.m14=0,r.m21=0,r.m22=1,r.m23=0,r.m24=0,r.m31=0,r.m32=0,r.m33=1,r.m34=0,r.m41=0,r.m42=0,r.m43=0,r.m44=1,t&&t.length){var n=[16,6].some((function(e){return e===t.length}))?t:t[0];return r.setMatrixValue(n)}return r},_={isIdentity:{configurable:!0},is2D:{configurable:!0}};_.isIdentity.get=function(){var t=this;return 1===t.m11&&0===t.m12&&0===t.m13&&0===t.m14&&0===t.m21&&1===t.m22&&0===t.m23&&0===t.m24&&0===t.m31&&0===t.m32&&1===t.m33&&0===t.m34&&0===t.m41&&0===t.m42&&0===t.m43&&1===t.m44},_.is2D.get=function(){var t=this;return 0===t.m31&&0===t.m32&&1===t.m33&&0===t.m34&&0===t.m43&&1===t.m44},$.prototype.setMatrixValue=function(t){return"string"==typeof t&&t.length&&"none"!==t?H(t):[Array,Float64Array,Float32Array].some((function(e){return t instanceof e}))?D(t):[$,DOMMatrix,Object].some((function(e){return t instanceof e}))?F(t):this},$.prototype.toFloat32Array=function(t){return Float32Array.from(X(this,t))},$.prototype.toFloat64Array=function(t){return Float64Array.from(X(this,t))},$.prototype.toString=function(){var t=this.is2D;return(t?"matrix":"matrix3d")+"("+this.toFloat64Array(t).join(", ")+")"},$.prototype.toJSON=function(){var t=this,e=t.is2D,r=t.isIdentity;return Object.assign({},t,{is2D:e,isIdentity:r})},$.prototype.multiply=function(t){return W(this,t)},$.prototype.translate=function(t,e,r){var n=e,a=r;return void 0===n&&(n=0),void 0===a&&(a=0),W(this,Y(t,n,a))},$.prototype.scale=function(t,e,r){var n=e,a=r;return void 0===n&&(n=t),void 0===a&&(a=1),W(this,G(t,n,a))},$.prototype.rotate=function(t,e,r){var n=t,a=e||0,i=r||0;return"number"==typeof t&&void 0===e&&void 0===r&&(i=n,n=0,a=0),W(this,B(n,a,i))},$.prototype.rotateAxisAngle=function(t,e,r,n){if([t,e,r,n].some((function(t){return Number.isNaN(+t)})))throw new TypeError("CSSMatrix: expecting 4 values");return W(this,R(t,e,r,n))},$.prototype.skewX=function(t){return W(this,U(t))},$.prototype.skewY=function(t){return W(this,K(t))},$.prototype.skew=function(t,e){return W(this,J(t,e))},$.prototype.transformPoint=function(t){var e=this,r=e.m11*t.x+e.m21*t.y+e.m31*t.z+e.m41*t.w,n=e.m12*t.x+e.m22*t.y+e.m32*t.z+e.m42*t.w,a=e.m13*t.x+e.m23*t.y+e.m33*t.z+e.m43*t.w,i=e.m14*t.x+e.m24*t.y+e.m34*t.z+e.m44*t.w;return t instanceof DOMPoint?new DOMPoint(r,n,a,i):{x:r,y:n,z:a,w:i}},Object.defineProperties($.prototype,_),Object.assign($,{Translate:Y,Rotate:B,RotateAxisAngle:R,Scale:G,SkewX:U,SkewY:K,Skew:J,Multiply:W,fromArray:D,fromMatrix:F,fromString:H,toArray:X});function tt(t,e,r){var n=r[0],a=r[1],i=r[2],o=function(t,e){var r,n=Y.apply(void 0,e);return r=e,n.m44=r[3],[(n=t.multiply(n)).m41,n.m42,n.m43,n.m44]}(t,e.concat([0],[1])),u=o[0],c=o[1]-a,s=o[2]-i;return[(u-n)*(Math.abs(i)/Math.abs(s)||1)+n,c*(Math.abs(i)/Math.abs(s)||1)+a]}function et(e,r){var n,a,i,o,u,c,s=0,f=0,h=y(e),l=r&&Object.keys(r);if(!r||!l.length)return m(h);var p=w(h);if(!r.origin){var v=t.origin;Object.assign(r,{origin:v})}var x=function(t){var e=new $,r=t.origin,n=r[0],a=r[1],i=t.translate,o=t.rotate,u=t.skew,c=t.scale;return Array.isArray(i)&&i.every((function(t){return!Number.isNaN(+t)}))&&i.some((function(t){return 0!==t}))?e=e.translate.apply(e,i):"number"!=typeof i||Number.isNaN(i)||(e=e.translate(i)),(o||u||c)&&(e=e.translate(n,a),Array.isArray(o)&&o.every((function(t){return!Number.isNaN(+t)}))&&o.some((function(t){return 0!==t}))?e=e.rotate.apply(e,o):"number"!=typeof o||Number.isNaN(o)||(e=e.rotate(o)),Array.isArray(u)&&u.every((function(t){return!Number.isNaN(+t)}))&&u.some((function(t){return 0!==t}))?(e=u[0]?e.skewX(u[0]):e,e=u[1]?e.skewY(u[1]):e):"number"!=typeof u||Number.isNaN(u)||(e=e.skewX(u)),Array.isArray(c)&&c.every((function(t){return!Number.isNaN(+t)}))&&c.some((function(t){return 1!==t}))?e=e.scale.apply(e,c):"number"!=typeof c||Number.isNaN(c)||(e=e.scale(c)),e=e.translate(-n,-a)),e}(r),d=r.origin,M=Object.assign({},b),N=[],A=0,C="",S=[],k=[];if(!x.isIdentity){for(n=0,i=h.length;n<i;n+=1){N=h[n],h[n]&&(C=N[0]),k[n]=C,"A"===C&&(N=I(p[n],M),h[n]=I(p[n],M),g(h,k,n),p[n]=I(p[n],M),g(p,k,n),i=Math.max(h.length,p.length)),A=(N=p[n]).length,M.x1=+N[A-2],M.y1=+N[A-1],M.x2=+N[A-4]||M.x1,M.y2=+N[A-3]||M.y1;var P={s:h[n],c:h[n][0],x:M.x1,y:M.y1};S=S.concat([P])}return S.map((function(t){var e,r;switch(C=t.c,N=t.s,C){case"L":case"H":case"V":return e=tt(x,[t.x,t.y],d),u=e[0],c=e[1],s!==u&&f!==c?N=["L",u,c]:f===c?N=["H",u]:s===u&&(N=["V",c]),s=u,f=c,N;default:for(a=1,o=N.length;a<o;a+=2)r=tt(x,[+N[a],+N[a+1]],d),s=r[0],f=r[1],N[a]=s,N[a+1]=f;return N}}))}return m(h)}function rt(t,e){var r=t.x,n=t.y,a=e.x,i=e.y,o=r*a+n*i,u=Math.sqrt((Math.pow(r,2)+Math.pow(n,2))*(Math.pow(a,2)+Math.pow(i,2)));return(r*i-n*a<0?-1:1)*Math.acos(o/u)}function nt(t,e,r,n,a,i,o,u,c,s){var m=Math.abs,f=Math.sin,h=Math.cos,l=Math.sqrt,p=Math.PI,y=m(r),v=m(n),x=(a%360+360)%360*(p/180);if(t===u&&e===c)return{x:t,y:e};if(0===y||0===v)return j(t,e,u,c,s).point;var g=(t-u)/2,d=(e-c)/2,M={x:h(x)*g+f(x)*d,y:-f(x)*g+h(x)*d},b=Math.pow(M.x,2)/Math.pow(y,2)+Math.pow(M.y,2)/Math.pow(v,2);b>1&&(y*=l(b),v*=l(b));var w=(Math.pow(y,2)*Math.pow(v,2)-Math.pow(y,2)*Math.pow(M.y,2)-Math.pow(v,2)*Math.pow(M.x,2))/(Math.pow(y,2)*Math.pow(M.y,2)+Math.pow(v,2)*Math.pow(M.x,2)),N=(i!==o?1:-1)*l(w=w<0?0:w),A=N*(y*M.y/v),C=N*(-v*M.x/y),S=h(x)*A-f(x)*C+(t+u)/2,k=f(x)*A+h(x)*C+(e+c)/2,P={x:(M.x-A)/y,y:(M.y-C)/v},T=rt({x:1,y:0},P),q=rt(P,{x:(-M.x-A)/y,y:(-M.y-C)/v});!o&&q>0?q-=2*p:o&&q<0&&(q+=2*p);var I=T+(q%=2*p)*s,O=y*h(I),V=v*f(I);return{x:h(x)*O-f(x)*V+S,y:f(x)*O+h(x)*V+k}}function at(t,e,r,n,a,i,o,u,c,s){var m,f="number"==typeof s,h=t,l=e,p=0,y=[h,l,p],v=[h,l],x={x:0,y:0},g=[{x:h,y:l}];f&&0===s&&(x={x:h,y:l});for(var d=0;d<=300;d+=1){if(h=(m=nt(t,e,r,n,a,i,o,u,c,d/300)).x,l=m.y,g=g.concat([{x:h,y:l}]),p+=T(v,[h,l]),v=[h,l],f&&p>s&&s>y[2]){var M=(p-s)/(p-y[2]);x={x:v[0]*(1-M)+y[0]*M,y:v[1]*(1-M)+y[1]*M}}y=[h,l,p]}return f&&s>=p&&(x={x:u,y:c}),{length:p,point:x,min:{x:Math.min.apply(Math,g.map((function(t){return t.x}))),y:Math.min.apply(Math,g.map((function(t){return t.y})))},max:{x:Math.max.apply(Math,g.map((function(t){return t.x}))),y:Math.max.apply(Math,g.map((function(t){return t.y})))}}}function it(t,e,r,n,a,i,o,u,c){var s=1-c;return{x:Math.pow(s,3)*t+3*Math.pow(s,2)*c*r+3*s*Math.pow(c,2)*a+Math.pow(c,3)*o,y:Math.pow(s,3)*e+3*Math.pow(s,2)*c*n+3*s*Math.pow(c,2)*i+Math.pow(c,3)*u}}function ot(t,e,r,n,a,i,o,u,c){var s,m="number"==typeof c,f=t,h=e,l=0,p=[f,h,l],y=[f,h],v={x:0,y:0},x=[{x:f,y:h}];m&&0===c&&(v={x:f,y:h});for(var g=0;g<=300;g+=1){if(f=(s=it(t,e,r,n,a,i,o,u,g/300)).x,h=s.y,x=x.concat([{x:f,y:h}]),l+=T(y,[f,h]),y=[f,h],m&&l>c&&c>p[2]){var d=(l-c)/(l-p[2]);v={x:y[0]*(1-d)+p[0]*d,y:y[1]*(1-d)+p[1]*d}}p=[f,h,l]}return m&&c>=l&&(v={x:o,y:u}),{length:l,point:v,min:{x:Math.min.apply(Math,x.map((function(t){return t.x}))),y:Math.min.apply(Math,x.map((function(t){return t.y})))},max:{x:Math.max.apply(Math,x.map((function(t){return t.x}))),y:Math.max.apply(Math,x.map((function(t){return t.y})))}}}function ut(t,e,r,n,a,i,o){var u=1-o;return{x:Math.pow(u,2)*t+2*u*o*r+Math.pow(o,2)*a,y:Math.pow(u,2)*e+2*u*o*n+Math.pow(o,2)*i}}function ct(t,e,r,n,a,i,o){var u,c="number"==typeof o,s=t,m=e,f=0,h=[s,m,f],l=[s,m],p={x:0,y:0},y=[{x:s,y:m}];c&&0===o&&(p={x:s,y:m});for(var v=0;v<=300;v+=1){if(s=(u=ut(t,e,r,n,a,i,v/300)).x,m=u.y,y=y.concat([{x:s,y:m}]),f+=T(l,[s,m]),l=[s,m],c&&f>o&&o>h[2]){var x=(f-o)/(f-h[2]);p={x:l[0]*(1-x)+h[0]*x,y:l[1]*(1-x)+h[1]*x}}h=[s,m,f]}return c&&o>=f&&(p={x:a,y:i}),{length:f,point:p,min:{x:Math.min.apply(Math,y.map((function(t){return t.x}))),y:Math.min.apply(Math,y.map((function(t){return t.y})))},max:{x:Math.max.apply(Math,y.map((function(t){return t.x}))),y:Math.max.apply(Math,y.map((function(t){return t.y})))}}}function st(t,e){for(var r,n,a,i,o,u,c,s,m=w(t),f="number"==typeof e,h=!0,l=[],p="M",y=0,v=0,x=0,g=0,d=[],M=[],b=0,N={x:0,y:0},A=N,C=N,S=N,k=0,P=0,T=m.length;P<T;P+=1)l=(h="M"===(p=(s=m[P])[0]))?l:[y,v].concat(s.slice(1)),h?(A=N={x:x=(r=s)[1],y:g=r[2]},b=0,f&&e<.001&&(S=N)):"L"===p?(b=(n=j.apply(void 0,l.concat([(e||0)-k]))).length,N=n.min,A=n.max,C=n.point):"A"===p?(b=(a=at.apply(void 0,l.concat([(e||0)-k]))).length,N=a.min,A=a.max,C=a.point):"C"===p?(b=(i=ot.apply(void 0,l.concat([(e||0)-k]))).length,N=i.min,A=i.max,C=i.point):"Q"===p?(b=(o=ct.apply(void 0,l.concat([(e||0)-k]))).length,N=o.min,A=o.max,C=o.point):"Z"===p&&(l=[y,v,x,g],b=(u=j.apply(void 0,l.concat([(e||0)-k]))).length,N=u.min,A=u.max,C=u.point),f&&k<e&&k+b>=e&&(S=C),M=M.concat([A]),d=d.concat([N]),k+=b,y=(c="Z"!==p?s.slice(-2):[x,g])[0],v=c[1];return f&&e>=k&&(S={x:y,y:v}),{length:k,point:S,min:{x:Math.min.apply(Math,d.map((function(t){return t.x}))),y:Math.min.apply(Math,d.map((function(t){return t.y})))},max:{x:Math.max.apply(Math,M.map((function(t){return t.x}))),y:Math.max.apply(Math,M.map((function(t){return t.y})))}}}function mt(t){if(!t)return{x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};var e=st(t),r=e.min,n=r.x,a=r.y,i=e.max,o=i.x,u=i.y,c=o-n,s=u-a;return{width:c,height:s,x:n,y:a,x2:o,y2:u,cx:n+c/2,cy:a+s/2,cz:Math.max(c,s)+Math.min(c,s)/2}}function ft(t){return st(t).length}function ht(t,e){return st(t,e).point}Object.assign($,{Version:"1.0.1"});var lt=function(e,r){var a=r||{},i=void 0===e;if(i||!e.length)throw TypeError(n+': "pathValue" is '+(i?"undefined":"empty"));var o=l(e);if("string"==typeof o)throw TypeError(o);this.segments=o;var u=this.getBBox(),c=u.width,s=u.height,m=u.cx,f=u.cy,h=u.cz,p=t.round,y=t.origin,v=a.round,x=a.origin;if("auto"===v){var g=(""+Math.floor(Math.max(c,s))).length;p=g>=4?0:4-g}else(Number.isInteger(v)||"off"===v)&&(p=v);if(Array.isArray(x)&&x.length>=2){var d=x.map(Number),M=d[0],b=d[1],w=d[2];y=[Number.isNaN(M)?m:M,Number.isNaN(b)?f:b,Number.isNaN(w)?h:w]}else y=[m,f,h];return this.round=p,this.origin=y,this};function pt(t,e,r,n,a,i,o,u){return 3*((u-e)*(r+a)-(o-t)*(n+i)+n*(t-a)-r*(e-i)+u*(a+t/3)-o*(i+e/3))/20}function yt(t){var e=0,r=0,n=0;return O(t).map((function(t){var a,i;switch(t[0]){case"M":return e=(a=t)[1],r=a[2],0;default:return n=pt.apply(void 0,[e,r].concat(t.slice(1))),i=t.slice(-2),e=i[0],r=i[1],n}})).reduce((function(t,e){return t+e}),0)}function vt(t,e){var r=l(t);if("string"==typeof r)throw TypeError(r);var n=[].concat(r),a=ft(n),i=n.length-1,o=0,u=0,c=r[0],s=c.slice(-2),m={x:s[0],y:s[1]};if(i<=0||!e||!Number.isFinite(e))return{segment:c,index:0,length:u,point:m,lengthAtSegment:o};if(e>=a)return u=a-(o=ft(n=r.slice(0,-1))),{segment:r[i],index:i,length:u,lengthAtSegment:o};for(var f=[];i>0;)c=n[i],u=a-(o=ft(n=n.slice(0,-1))),a=o,f.push({segment:c,index:i,length:u,lengthAtSegment:o}),i-=1;return f.find((function(t){return t.lengthAtSegment<=e}))}function xt(t,e){for(var r=l(t),n=w(r),a=ft(r),i=function(t){var r=t.x-e.x,n=t.y-e.y;return r*r+n*n},o=8,u={x:0,y:0},c=0,s=u,m=0,f=1/0,h=0;h<=a;h+=o)(c=i(u=ht(n,h)))<f&&(s=u,m=h,f=c);o/=2;for(var p={x:0,y:0},y=p,v=0,x=0,g=0,d=0;o>.5;)g=i(p=ht(n,v=m-o)),d=i(y=ht(n,x=m+o)),v>=0&&g<f?(s=p,m=v,f=g):x<=a&&d<f?(s=y,m=x,f=d):o/=2;var M=vt(r,m);return{closest:s,distance:Math.sqrt(f),segment:M}}function gt(t){if("string"!=typeof t)return!1;var e=new f(t);for(u(e);e.index<e.max&&!e.err.length;)s(e);return!e.err.length&&"mM".includes(e.segments[0][0])}lt.prototype.getBBox=function(){return mt(this.segments)},lt.prototype.getTotalLength=function(){return ft(this.segments)},lt.prototype.getPointAtLength=function(t){return ht(this.segments,t)},lt.prototype.toAbsolute=function(){var t=this.segments;return this.segments=y(t),this},lt.prototype.toRelative=function(){var t=this.segments;return this.segments=x(t),this},lt.prototype.toCurve=function(){var t=this.segments;return this.segments=O(t),this},lt.prototype.reverse=function(t){this.toAbsolute();var e=this.segments,r=z(e),n=r.length>1?r:0,a=n&&m(n).map((function(e,r){return t?r?E(e):l(e):E(e)})),i=[];return i=n?a.flat(1):t?e:E(e),this.segments=m(i),this},lt.prototype.normalize=function(){var t=this.segments;return this.segments=w(t),this},lt.prototype.optimize=function(){var t=this.segments;return this.segments=Q(t,this.round),this},lt.prototype.transform=function(t){if(!t||"object"!=typeof t||"object"==typeof t&&!["translate","rotate","skew","scale"].some((function(e){return e in t})))return this;var e={};Object.keys(t).forEach((function(r){e[r]=Array.isArray(t[r])?[].concat(t[r]):Number(t[r])}));var r=this.segments,n=this.origin,a=n[0],i=n[1],o=n[2],u=e.origin;if(Array.isArray(u)&&u.length>=2){var c=u.map(Number),s=c[0],m=c[1],f=c[2];e.origin=[Number.isNaN(s)?a:s,Number.isNaN(m)?i:m,f||o]}else e.origin=[a,i,o];return this.segments=et(r,e),this},lt.prototype.flipX=function(){return this.transform({rotate:[0,180,0]}),this},lt.prototype.flipY=function(){return this.transform({rotate:[180,0,0]}),this},lt.prototype.toString=function(){return L(this.segments,this.round)};var dt={line:["x1","y1","x2","y2"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],rect:["width","height","x","y","rx","ry"],polygon:["points"],polyline:["points"],glyph:["d"]};var Mt={CSSMatrix:$,parsePathString:l,isPathArray:h,isCurveArray:A,isAbsoluteArray:p,isRelativeArray:v,isNormalizedArray:M,isValidPath:gt,pathToAbsolute:y,pathToRelative:x,pathToCurve:O,pathToString:L,getDrawDirection:function(t){return yt(O(t))>=0},getPathArea:yt,getPathBBox:mt,pathLengthFactory:st,getTotalLength:ft,getPointAtLength:ht,getClosestPoint:function(t,e){return xt(t,e).closest},getSegmentOfPoint:function(t,e){return xt(t,e).segment},getPropertiesAtPoint:xt,getPropertiesAtLength:vt,getSegmentAtLength:function(t,e){return vt(t,e).segment},isPointInStroke:function(t,e){var r=xt(t,e).distance;return Math.abs(r)<.001},clonePath:m,splitPath:z,fixPath:N,roundPath:V,optimizePath:Q,reverseCurve:function(t){var e=t.slice(1).map((function(e,r,n){return r?n[r-1].slice(-2).concat(e.slice(1)):t[0].slice(1).concat(e.slice(1))})).map((function(t){return t.map((function(e,r){return t[t.length-r-2*(1-r%2)]}))})).reverse();return[["M"].concat(e[0].slice(0,2))].concat(e.map((function(t){return["C"].concat(t.slice(2))})))},reversePath:E,normalizePath:w,transformPath:et,shapeToPath:function(e,r){var a=Object.keys(dt),i=e.tagName;if(i&&!a.some((function(t){return i===t})))throw TypeError(n+': "'+i+'" is not SVGElement');var o=document.createElementNS("http://www.w3.org/2000/svg","path"),u=i||e.type,c={};c.type=u;var s,m=dt[u];i?(m.forEach((function(t){c[t]=e.getAttribute(t)})),Object.values(e.attributes).forEach((function(t){var e=t.name,r=t.value;m.includes(e)||o.setAttribute(e,r)}))):(Object.assign(c,e),Object.keys(c).forEach((function(t){m.includes(t)||"type"===t||o.setAttribute(t.replace(/[A-Z]/g,(function(t){return"-"+t.toLowerCase()})),c[t])})));var f,h,l,p,y=t.round;return"circle"===u?s=L((h=(f=c).cx,l=f.cy,p=f.r,[["M",h-p,l],["a",p,p,0,1,0,2*p,0],["a",p,p,0,1,0,-2*p,0]]),y):"ellipse"===u?s=L(function(t){var e=t.cx,r=t.cy,n=t.rx,a=t.ry;return[["M",e-n,r],["a",n,a,0,1,0,2*n,0],["a",n,a,0,1,0,-2*n,0]]}(c),y):["polyline","polygon"].includes(u)?s=L(function(t){for(var e=[],r=(t.points||"").trim().split(/[\s|,]/).map(Number),n=0;n<r.length;)e.push([n?"L":"M",r[n],r[n+1]]),n+=2;return"polygon"===t.type?e.concat([["z"]]):e}(c),y):"rect"===u?s=L(function(t){var e=+t.x||0,r=+t.y||0,n=+t.width,a=+t.height,i=+t.rx,o=+t.ry;return i||o?(i=i||o,o=o||i,2*i>n&&(i-=(2*i-n)/2),2*o>a&&(o-=(2*o-a)/2),[["M",e+i,r],["h",n-2*i],["s",i,0,i,o],["v",a-2*o],["s",0,o,-i,o],["h",2*i-n],["s",-i,0,-i,-o],["v",2*o-a],["s",0,-o,i,-o]]):[["M",e,r],["h",n],["v",a],["H",e],["Z"]]}(c),y):"line"===u?s=L(function(t){return[["M",t.x1,t.y1],["L",t.x2,t.y2]]}(c),y):"glyph"===u&&(s=i?e.getAttribute("d"):e.d),!!gt(s)&&(o.setAttribute("d",s),r&&i&&(e.before(o,e),e.remove()),o)},options:t};return Object.assign(lt,Mt,{Version:"1.0.1"}),lt}));
1
+ // SVGPathCommander v1.0.4 | thednp © 2022 | MIT-License
2
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).SVGPathCommander=e()}(this,(function(){"use strict";var t={origin:[0,0,0],round:4},e={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function r(t){for(var r=t.pathValue[t.segmentStart],n=r.toLowerCase(),a=t.data;a.length>=e[n]&&("m"===n&&a.length>2?(t.segments.push([r].concat(a.splice(0,2))),n="l",r="m"===r?"l":"L"):t.segments.push([r].concat(a.splice(0,e[n]))),e[n]););}var n="SVGPathCommander error";function a(t){var e=t.index,r=t.pathValue,a=r.charCodeAt(e);return 48===a?(t.param=0,void(t.index+=1)):49===a?(t.param=1,void(t.index+=1)):void(t.err=n+': invalid Arc flag "'+r[e]+'", expecting 0 or 1 at index '+e)}function i(t){return t>=48&&t<=57}function o(t){var e,r=t.max,a=t.pathValue,o=t.index,u=o,c=!1,s=!1,m=!1,f=!1;if(u>=r)t.err=n+": Invalid path value at index "+u+', "pathValue" is missing param';else if(43!==(e=a.charCodeAt(u))&&45!==e||(u+=1,e=a.charCodeAt(u)),i(e)||46===e){if(46!==e){if(c=48===e,u+=1,e=a.charCodeAt(u),c&&u<r&&e&&i(e))return void(t.err=n+": Invalid path value at index "+o+', "'+a[o]+'" illegal number');for(;u<r&&i(a.charCodeAt(u));)u+=1,s=!0;e=a.charCodeAt(u)}if(46===e){for(f=!0,u+=1;i(a.charCodeAt(u));)u+=1,m=!0;e=a.charCodeAt(u)}if(101===e||69===e){if(f&&!s&&!m)return void(t.err=n+": Invalid path value at index "+u+', "'+a[u]+'" invalid float exponent');if(u+=1,43!==(e=a.charCodeAt(u))&&45!==e||(u+=1),!(u<r&&i(a.charCodeAt(u))))return void(t.err=n+": Invalid path value at index "+u+', "'+a[u]+'" invalid integer exponent');for(;u<r&&i(a.charCodeAt(u));)u+=1}t.index=u,t.param=+t.pathValue.slice(o,u)}else t.err=n+": Invalid path value at index "+u+', "'+a[u]+'" is not a number'}function u(t){for(var e,r=t.pathValue,n=t.max;t.index<n&&(10===(e=r.charCodeAt(t.index))||13===e||8232===e||8233===e||32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e));)t.index+=1}function c(t){return t>=48&&t<=57||43===t||45===t||46===t}function s(t){var i=t.max,s=t.pathValue,m=t.index,f=s.charCodeAt(m),h=e[s[m].toLowerCase()];if(t.segmentStart=m,function(t){switch(32|t){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:return!0;default:return!1}}(f))if(t.index+=1,u(t),t.data=[],h){for(;;){for(var l=h;l>0;l-=1){if(97!=(32|f)||3!==l&&4!==l?o(t):a(t),t.err.length)return;t.data.push(t.param),u(t),t.index<i&&44===s.charCodeAt(t.index)&&(t.index+=1,u(t))}if(t.index>=t.max)break;if(!c(s.charCodeAt(t.index)))break}r(t)}else r(t);else t.err=n+': Invalid path value "'+s[m]+'" is not a path command'}function m(t){return t.map((function(t){return Array.isArray(t)?[].concat(t):t}))}function f(t){this.segments=[],this.pathValue=t,this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}function h(t){return Array.isArray(t)&&t.every((function(t){var r=t[0].toLowerCase();return e[r]===t.length-1&&"achlmqstvz".includes(r)}))}function l(t){if(h(t))return m(t);var e=new f(t);for(u(e);e.index<e.max&&!e.err.length;)s(e);return e.err?e.err:e.segments}function p(t){return h(t)&&t.every((function(t){var e=t[0];return e===e.toUpperCase()}))}function y(t){if(p(t))return m(t);var e=l(t),r=0,n=0,a=0,i=0;return e.map((function(t){var e,o=t.slice(1).map(Number),u=t[0],c=u.toUpperCase();if("M"===u)return r=(e=o)[0],n=e[1],a=r,i=n,["M",r,n];var s=[];if(u!==c)switch(c){case"A":s=[c,o[0],o[1],o[2],o[3],o[4],o[5]+r,o[6]+n];break;case"V":s=[c,o[0]+n];break;case"H":s=[c,o[0]+r];break;default:var m=o.map((function(t,e){return t+(e%2?n:r)}));s=[c].concat(m)}else s=[c].concat(o);var f=s.length;switch(c){case"Z":r=a,n=i;break;case"H":r=s[1];break;case"V":n=s[1];break;default:r=s[f-2],n=s[f-1],"M"===c&&(a=r,i=n)}return s}))}function v(t){return h(t)&&t.slice(1).every((function(t){var e=t[0];return e===e.toLowerCase()}))}function x(t){if(v(t))return m(t);var e=l(t),r=0,n=0,a=0,i=0;return e.map((function(t){var e,o=t.slice(1).map(Number),u=t[0],c=u.toLowerCase();if("M"===u)return r=(e=o)[0],n=e[1],a=r,i=n,["M",r,n];var s=[];if(u!==c)switch(c){case"a":s=[c,o[0],o[1],o[2],o[3],o[4],o[5]-r,o[6]-n];break;case"v":s=[c,o[0]-n];break;case"h":s=[c,o[0]-r];break;default:var m=o.map((function(t,e){return t-(e%2?n:r)}));s=[c].concat(m)}else"m"===u&&(a=o[0]+r,i=o[1]+n),s=[c].concat(o);var f=s.length;switch(c){case"z":r=a,n=i;break;case"h":r+=s[1];break;case"v":n+=s[1];break;default:r+=s[f-2],n+=s[f-1]}return s}))}function g(t,e,r){if(t[r].length>7){t[r].shift();for(var n=t[r],a=r;n.length;)e[r]="A",t.splice(a+=1,0,["C"].concat(n.splice(0,6)));t.splice(r,1)}}function d(t,e){var r=t[0],n=e.x1,a=e.y1,i=e.x2,o=e.y2,u=t.slice(1).map(Number),c=t;if("TQ".includes(r)||(e.qx=null,e.qy=null),"H"===r)c=["L",t[1],a];else if("V"===r)c=["L",n,t[1]];else if("S"===r){var s=2*n-i,m=2*a-o;e.x1=s,e.y1=m,c=["C",s,m].concat(u)}else if("T"===r){var f=2*n-e.qx,h=2*a-e.qy;e.qx=f,e.qy=h,c=["Q",f,h].concat(u)}else if("Q"===r){var l=u[0],p=u[1];e.qx=l,e.qy=p}return c}function M(t){return p(t)&&t.every((function(t){var e=t[0];return"ACLMQZ".includes(e)}))}var b={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function w(t){if(M(t))return m(t);for(var e=y(t),r=Object.assign({},b),n=[],a=e.length,i="",o=0;o<a;o+=1){i=e[o][0],n[o]=i,e[o]=d(e[o],r);var u=e[o],c=u.length;r.x1=+u[c-2],r.y1=+u[c-1],r.x2=+u[c-4]||r.x1,r.y2=+u[c-3]||r.y1}return e}function N(t){var e=l(t),r=w(e),n=e.length,a="Z"===r.slice(-1)[0][0],i=a?n-2:n-1,o=r[0].slice(1),u=o[0],c=o[1],s=r[i].slice(-2),m=s[0],f=s[1];return a&&u===m&&c===f?e.slice(0,-1):e}function A(t){return M(t)&&t.every((function(t){var e=t[0];return"MC".includes(e)}))}function C(t,e,r){return{x:t*Math.cos(r)-e*Math.sin(r),y:t*Math.sin(r)+e*Math.cos(r)}}function S(t,e,r,n,a,i,o,u,c,s){var m,f,h,l,p,y,v=t,x=e,g=r,d=n,M=u,b=c,w=120*Math.PI/180,N=Math.PI/180*(+a||0),A=[];if(s)h=(m=s)[0],l=m[1],p=m[2],y=m[3];else{v=(f=C(v,x,-N)).x,x=f.y;var k=(v-(M=(f=C(M,b,-N)).x))/2,P=(x-(b=f.y))/2,T=k*k/(g*g)+P*P/(d*d);T>1&&(g*=T=Math.sqrt(T),d*=T);var j=g*g,q=d*d,I=(i===o?-1:1)*Math.sqrt(Math.abs((j*q-j*P*P-q*k*k)/(j*P*P+q*k*k)));p=I*g*P/d+(v+M)/2,y=I*-d*k/g+(x+b)/2,h=(Math.asin((x-y)/d)*Math.pow(10,9)>>0)/Math.pow(10,9),l=(Math.asin((b-y)/d)*Math.pow(10,9)>>0)/Math.pow(10,9),h=v<p?Math.PI-h:h,l=M<p?Math.PI-l:l,h<0&&(h=2*Math.PI+h),l<0&&(l=2*Math.PI+l),o&&h>l&&(h-=2*Math.PI),!o&&l>h&&(l-=2*Math.PI)}var O=l-h;if(Math.abs(O)>w){var V=l,L=M,E=b;l=h+w*(o&&l>h?1:-1),A=S(M=p+g*Math.cos(l),b=y+d*Math.sin(l),g,d,a,0,o,L,E,[l,V,p,y])}O=l-h;var z=Math.cos(h),Z=Math.sin(h),Q=Math.cos(l),D=Math.sin(l),F=Math.tan(O/4),H=4/3*g*F,X=4/3*d*F,Y=[v,x],B=[v+H*Z,x-X*z],R=[M+H*D,b-X*Q],G=[M,b];if(B[0]=2*Y[0]-B[0],B[1]=2*Y[1]-B[1],s)return B.concat(R,G,A);for(var J=[],U=0,K=(A=B.concat(R,G,A)).length;U<K;U+=1)J[U]=U%2?C(A[U-1],A[U],N).y:C(A[U],A[U+1],N).x;return J}function k(t,e,r,n,a,i){return[1/3*t+2/3*r,1/3*e+2/3*n,1/3*a+2/3*r,1/3*i+2/3*n,a,i]}function P(t,e,r){var n=t[0],a=t[1];return[n+(e[0]-n)*r,a+(e[1]-a)*r]}function T(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}function j(t,e,r,n,a){var i=T([t,e],[r,n]),o={x:0,y:0};if("number"==typeof a)if(0===a)o={x:t,y:e};else if(a>=i)o={x:r,y:n};else{var u=P([t,e],[r,n],a/i);o={x:u[0],y:u[1]}}return{length:i,point:o,min:{x:Math.min(t,r),y:Math.min(e,n)},max:{x:Math.max(t,r),y:Math.max(e,n)}}}function q(t,e,r,n){var a=.5,i=[t,e],o=[r,n],u=P(i,o,a),c=P(o,u,a),s=P(u,c,a),m=P(c,s,a),f=P(s,m,a),h=i.concat(u,s,f,[a]),l=j.apply(void 0,h).point,p=f.concat(m,c,o,[0]),y=j.apply(void 0,p).point;return[l.x,l.y,y.x,y.y,r,n]}function I(t,e){var r,n=t[0],a=t.slice(1).map(Number),i=a[0],o=a[1],u=e.x1,c=e.y1,s=e.x,m=e.y;switch("TQ".includes(n)||(e.qx=null,e.qy=null),n){case"M":return e.x=i,e.y=o,t;case"A":return r=[u,c].concat(a),["C"].concat(S.apply(void 0,r));case"Q":return e.qx=i,e.qy=o,r=[u,c].concat(a),["C"].concat(k.apply(void 0,r));case"L":return["C"].concat(q(u,c,i,o));case"Z":return["C"].concat(q(u,c,s,m))}return t}function O(t){if(A(t))return m(t);for(var e=N(w(t)),r=Object.assign({},b),n=[],a="",i=e.length,o=0;o<i;o+=1){a=e[o][0],n[o]=a,e[o]=I(e[o],r),g(e,n,o),i=e.length;var u=e[o],c=u.length;r.x1=+u[c-2],r.y1=+u[c-1],r.x2=+u[c-4]||r.x1,r.y2=+u[c-3]||r.y1}return e}function V(e,r){var n=t.round;if("off"===r||"off"===n)return m(e);var a="number"==typeof(n=r>=0?r:n)&&n>=1?Math.pow(10,n):1;return e.map((function(t){var e=t.slice(1).map(Number).map((function(t){return n?Math.round(t*a)/a:Math.round(t)}));return[t[0]].concat(e)}))}function L(t,e){return V(t,e).map((function(t){return t[0]+t.slice(1).join(" ")})).join("")}function E(t){var e=y(t),r="Z"===e.slice(-1)[0][0],n=w(e).map((function(t,r){var n=t.slice(-2).map(Number),a=n[0],i=n[1];return{seg:e[r],n:t,c:e[r][0],x:a,y:i}})).map((function(t,e,n){var a=t.seg,i=t.n,o=e&&n[e-1],u=n[e+1],c=t.c,s=n.length,m=e?n[e-1].x:n[s-1].x,f=e?n[e-1].y:n[s-1].y,h=[];switch(c){case"M":h=r?["Z"]:[c,m,f];break;case"A":h=[c].concat(a.slice(1,-3),[1===a[5]?0:1],[m],[f]);break;case"C":h=u&&"S"===u.c?["S",a[1],a[2],m,f]:[c,a[3],a[4],a[1],a[2],m,f];break;case"S":h=!o||!"CS".includes(o.c)||u&&"S"===u.c?[c,i[1],i[2],m,f]:["C",i[3],i[4],i[1],i[2],m,f];break;case"Q":h=u&&"T"===u.c?["T",m,f]:[c].concat(a.slice(1,-2),[m],[f]);break;case"T":h=!o||!"QT".includes(o.c)||u&&"T"===u.c?[c,m,f]:["Q",i[1],i[2],m,f];break;case"Z":h=["M",m,f];break;case"H":h=[c,m];break;case"V":h=[c,f];break;default:h=[c].concat(a.slice(1,-2),[m],[f])}return h}));return r?n.reverse():[n[0]].concat(n.slice(1).reverse())}function z(t){var e,r=[],n=-1;return t.forEach((function(t){"M"===t[0]?(e=[t],n+=1):e=e.concat([t]),r[n]=e})),r}function Z(t,e,r,n){var a=t[0],i=function(t){return Math.round(t*Math.pow(10,4))/Math.pow(10,4)},o=t.slice(1).map((function(t){return+t})),u=e.slice(1).map((function(t){return+t})),c=r.x1,s=r.y1,m=r.x2,f=r.y2,h=r.x,l=r.y,p=t,y=u.slice(-2),v=y[0],x=y[1];if("TQ".includes(a)||(r.qx=null,r.qy=null),["V","H","S","T","Z"].includes(a))p=[a].concat(o);else if("L"===a)i(h)===i(v)?p=["V",x]:i(l)===i(x)&&(p=["H",v]);else if("C"===a){var g=u[0],d=u[1];"CS".includes(n)&&(i(g)===i(2*c-m)&&i(d)===i(2*s-f)||i(c)===i(2*m-h)&&i(s)===i(2*f-l))&&(p=["S"].concat(u.slice(-4))),r.x1=g,r.y1=d}else if("Q"===a){var M=u[0],b=u[1];r.qx=M,r.qy=b,"QT".includes(n)&&(i(M)===i(2*c-m)&&i(b)===i(2*s-f)||i(c)===i(2*m-h)&&i(s)===i(2*f-l))&&(p=["T"].concat(u.slice(-2)))}return p}function Q(t,e){for(var r,n=y(t),a=w(n),i=Object.assign({},b),o=[],u=n.length,c="",s="",m=0,f=0,h=0,l=0,p=0;p<u;p+=1){c=n[p][0],o[p]=c,p&&(s=o[p-1]),n[p]=Z(n[p],a[p],i,s);var v=n[p],g=v.length;switch(i.x1=+v[g-2],i.y1=+v[g-1],i.x2=+v[g-4]||i.x1,i.y2=+v[g-3]||i.y1,c){case"Z":m=h,f=l;break;case"H":m=v[1];break;case"V":f=v[1];break;default:m=(r=v.slice(-2).map(Number))[0],f=r[1],"M"===c&&(h=m,l=f)}i.x=m,i.y=f}var d=V(n,e),M=V(x(n),e);return d.map((function(t,e){return e?t.join("").length<M[e].join("").length?t:M[e]:t}))}function D(t){var e=new $,r=Array.from(t);if(!r.every((function(t){return!Number.isNaN(t)})))throw TypeError('CSSMatrix: "'+t+'" must only have numbers.');if(16===r.length){var n=r[0],a=r[1],i=r[2],o=r[3],u=r[4],c=r[5],s=r[6],m=r[7],f=r[8],h=r[9],l=r[10],p=r[11],y=r[12],v=r[13],x=r[14],g=r[15];e.m11=n,e.a=n,e.m21=u,e.c=u,e.m31=f,e.m41=y,e.e=y,e.m12=a,e.b=a,e.m22=c,e.d=c,e.m32=h,e.m42=v,e.f=v,e.m13=i,e.m23=s,e.m33=l,e.m43=x,e.m14=o,e.m24=m,e.m34=p,e.m44=g}else{if(6!==r.length)throw new TypeError("CSSMatrix: expecting an Array of 6/16 values.");var d=r[0],M=r[1],b=r[2],w=r[3],N=r[4],A=r[5];e.m11=d,e.a=d,e.m12=M,e.b=M,e.m21=b,e.c=b,e.m22=w,e.d=w,e.m41=N,e.e=N,e.m42=A,e.f=A}return e}function F(t){var e=Object.keys(new $);if("object"==typeof t&&e.every((function(e){return e in t})))return D([t.m11,t.m12,t.m13,t.m14,t.m21,t.m22,t.m23,t.m24,t.m31,t.m32,t.m33,t.m34,t.m41,t.m42,t.m43,t.m44]);throw TypeError('CSSMatrix: "'+JSON.stringify(t)+'" is not a DOMMatrix / CSSMatrix / JSON compatible object.')}function H(t){if("string"!=typeof t)throw TypeError('CSSMatrix: "'+t+'" is not a string.');var e=String(t).replace(/\s/g,""),r=new $,n='CSSMatrix: invalid transform string "'+t+'"';return e.split(")").filter((function(t){return t})).forEach((function(t){var e=t.split("("),a=e[0],i=e[1];if(!i)throw TypeError(n);var o=i.split(",").map((function(t){return t.includes("rad")?parseFloat(t)*(180/Math.PI):parseFloat(t)})),u=o[0],c=o[1],s=o[2],m=o[3],f=[u,c,s],h=[u,c,s,m];if("perspective"===a&&u&&[c,s].every((function(t){return void 0===t})))r.m34=-1/u;else if(a.includes("matrix")&&[6,16].includes(o.length)&&o.every((function(t){return!Number.isNaN(+t)}))){var l=o.map((function(t){return Math.abs(t)<1e-6?0:t}));r=r.multiply(D(l))}else if("translate3d"===a&&f.every((function(t){return!Number.isNaN(+t)})))r=r.translate(u,c,s);else if("translate"===a&&u&&void 0===s)r=r.translate(u,c||0,0);else if("rotate3d"===a&&h.every((function(t){return!Number.isNaN(+t)}))&&m)r=r.rotateAxisAngle(u,c,s,m);else if("rotate"===a&&u&&[c,s].every((function(t){return void 0===t})))r=r.rotate(0,0,u);else if("scale3d"===a&&f.every((function(t){return!Number.isNaN(+t)}))&&f.some((function(t){return 1!==t})))r=r.scale(u,c,s);else if("scale"!==a||Number.isNaN(u)||1===u||void 0!==s)if("skew"===a&&(u||!Number.isNaN(u)&&c)&&void 0===s)r=r.skew(u,c||0);else{if(!(/[XYZ]/.test(a)&&u&&[c,s].every((function(t){return void 0===t}))&&["translate","rotate","scale","skew"].some((function(t){return a.includes(t)}))))throw TypeError(n);if(["skewX","skewY"].includes(a))r=r[a](u);else{var p=a.replace(/[XYZ]/,""),y=a.replace(p,""),v=["X","Y","Z"].indexOf(y),x="scale"===p?1:0,g=[0===v?u:x,1===v?u:x,2===v?u:x];r=r[p].apply(r,g)}}else{var d=Number.isNaN(+c)?u:c;r=r.scale(u,d,1)}})),r}function X(t,e){return e?[t.a,t.b,t.c,t.d,t.e,t.f]:[t.m11,t.m12,t.m13,t.m14,t.m21,t.m22,t.m23,t.m24,t.m31,t.m32,t.m33,t.m34,t.m41,t.m42,t.m43,t.m44]}function Y(t,e,r){var n=new $;return n.m41=t,n.e=t,n.m42=e,n.f=e,n.m43=r,n}function B(t,e,r){var n=new $,a=Math.PI/180,i=t*a,o=e*a,u=r*a,c=Math.cos(i),s=-Math.sin(i),m=Math.cos(o),f=-Math.sin(o),h=Math.cos(u),l=-Math.sin(u),p=m*h,y=-m*l;n.m11=p,n.a=p,n.m12=y,n.b=y,n.m13=f;var v=s*f*h+c*l;n.m21=v,n.c=v;var x=c*h-s*f*l;return n.m22=x,n.d=x,n.m23=-s*m,n.m31=s*l-c*f*h,n.m32=s*h+c*f*l,n.m33=c*m,n}function R(t,e,r,n){var a=new $,i=Math.sqrt(t*t+e*e+r*r);if(0===i)return a;var o=t/i,u=e/i,c=r/i,s=n*(Math.PI/360),m=Math.sin(s),f=Math.cos(s),h=m*m,l=o*o,p=u*u,y=c*c,v=1-2*(p+y)*h;a.m11=v,a.a=v;var x=2*(o*u*h+c*m*f);a.m12=x,a.b=x,a.m13=2*(o*c*h-u*m*f);var g=2*(u*o*h-c*m*f);a.m21=g,a.c=g;var d=1-2*(y+l)*h;return a.m22=d,a.d=d,a.m23=2*(u*c*h+o*m*f),a.m31=2*(c*o*h+u*m*f),a.m32=2*(c*u*h-o*m*f),a.m33=1-2*(l+p)*h,a}function G(t,e,r){var n=new $;return n.m11=t,n.a=t,n.m22=e,n.d=e,n.m33=r,n}function J(t,e){var r=new $;if(t){var n=t*Math.PI/180,a=Math.tan(n);r.m21=a,r.c=a}if(e){var i=e*Math.PI/180,o=Math.tan(i);r.m12=o,r.b=o}return r}function U(t){return J(t,0)}function K(t){return J(0,t)}function W(t,e){return D([e.m11*t.m11+e.m12*t.m21+e.m13*t.m31+e.m14*t.m41,e.m11*t.m12+e.m12*t.m22+e.m13*t.m32+e.m14*t.m42,e.m11*t.m13+e.m12*t.m23+e.m13*t.m33+e.m14*t.m43,e.m11*t.m14+e.m12*t.m24+e.m13*t.m34+e.m14*t.m44,e.m21*t.m11+e.m22*t.m21+e.m23*t.m31+e.m24*t.m41,e.m21*t.m12+e.m22*t.m22+e.m23*t.m32+e.m24*t.m42,e.m21*t.m13+e.m22*t.m23+e.m23*t.m33+e.m24*t.m43,e.m21*t.m14+e.m22*t.m24+e.m23*t.m34+e.m24*t.m44,e.m31*t.m11+e.m32*t.m21+e.m33*t.m31+e.m34*t.m41,e.m31*t.m12+e.m32*t.m22+e.m33*t.m32+e.m34*t.m42,e.m31*t.m13+e.m32*t.m23+e.m33*t.m33+e.m34*t.m43,e.m31*t.m14+e.m32*t.m24+e.m33*t.m34+e.m34*t.m44,e.m41*t.m11+e.m42*t.m21+e.m43*t.m31+e.m44*t.m41,e.m41*t.m12+e.m42*t.m22+e.m43*t.m32+e.m44*t.m42,e.m41*t.m13+e.m42*t.m23+e.m43*t.m33+e.m44*t.m43,e.m41*t.m14+e.m42*t.m24+e.m43*t.m34+e.m44*t.m44])}var $=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=this;if(r.a=1,r.b=0,r.c=0,r.d=1,r.e=0,r.f=0,r.m11=1,r.m12=0,r.m13=0,r.m14=0,r.m21=0,r.m22=1,r.m23=0,r.m24=0,r.m31=0,r.m32=0,r.m33=1,r.m34=0,r.m41=0,r.m42=0,r.m43=0,r.m44=1,t.length){var n=[16,6].some((function(e){return e===t.length}))?t:t[0];return r.setMatrixValue(n)}return r},_={isIdentity:{configurable:!0},is2D:{configurable:!0}};_.isIdentity.get=function(){var t=this;return 1===t.m11&&0===t.m12&&0===t.m13&&0===t.m14&&0===t.m21&&1===t.m22&&0===t.m23&&0===t.m24&&0===t.m31&&0===t.m32&&1===t.m33&&0===t.m34&&0===t.m41&&0===t.m42&&0===t.m43&&1===t.m44},_.is2D.get=function(){var t=this;return 0===t.m31&&0===t.m32&&1===t.m33&&0===t.m34&&0===t.m43&&1===t.m44},$.prototype.setMatrixValue=function(t){return"string"==typeof t&&t.length&&"none"!==t?H(t):[Array,Float64Array,Float32Array].some((function(e){return t instanceof e}))?D(t):[$,DOMMatrix,Object].some((function(e){return t instanceof e}))?F(t):this},$.prototype.toFloat32Array=function(t){return Float32Array.from(X(this,t))},$.prototype.toFloat64Array=function(t){return Float64Array.from(X(this,t))},$.prototype.toString=function(){var t=this.is2D;return(t?"matrix":"matrix3d")+"("+this.toFloat64Array(t).join(", ")+")"},$.prototype.toJSON=function(){var t=this,e=t.is2D,r=t.isIdentity;return Object.assign({},t,{is2D:e,isIdentity:r})},$.prototype.multiply=function(t){return W(this,t)},$.prototype.translate=function(t,e,r){var n=e,a=r;return void 0===n&&(n=0),void 0===a&&(a=0),W(this,Y(t,n,a))},$.prototype.scale=function(t,e,r){var n=e,a=r;return void 0===n&&(n=t),void 0===a&&(a=1),W(this,G(t,n,a))},$.prototype.rotate=function(t,e,r){var n=t,a=e||0,i=r||0;return"number"==typeof t&&void 0===e&&void 0===r&&(i=n,n=0,a=0),W(this,B(n,a,i))},$.prototype.rotateAxisAngle=function(t,e,r,n){if([t,e,r,n].some((function(t){return Number.isNaN(+t)})))throw new TypeError("CSSMatrix: expecting 4 values");return W(this,R(t,e,r,n))},$.prototype.skewX=function(t){return W(this,U(t))},$.prototype.skewY=function(t){return W(this,K(t))},$.prototype.skew=function(t,e){return W(this,J(t,e))},$.prototype.transformPoint=function(t){var e=this,r=e.m11*t.x+e.m21*t.y+e.m31*t.z+e.m41*t.w,n=e.m12*t.x+e.m22*t.y+e.m32*t.z+e.m42*t.w,a=e.m13*t.x+e.m23*t.y+e.m33*t.z+e.m43*t.w,i=e.m14*t.x+e.m24*t.y+e.m34*t.z+e.m44*t.w;return t instanceof DOMPoint?new DOMPoint(r,n,a,i):{x:r,y:n,z:a,w:i}},Object.defineProperties($.prototype,_),Object.assign($,{Translate:Y,Rotate:B,RotateAxisAngle:R,Scale:G,SkewX:U,SkewY:K,Skew:J,Multiply:W,fromArray:D,fromMatrix:F,fromString:H,toArray:X});function tt(t,e,r){var n=r[0],a=r[1],i=r[2],o=function(t,e){var r,n=Y.apply(void 0,e);return r=e,n.m44=r[3],[(n=t.multiply(n)).m41,n.m42,n.m43,n.m44]}(t,e.concat([0],[1])),u=o[0],c=o[1]-a,s=o[2]-i;return[(u-n)*(Math.abs(i)/Math.abs(s)||1)+n,c*(Math.abs(i)/Math.abs(s)||1)+a]}function et(e,r){var n,a,i,o,u,c,s=0,f=0,h=y(e),l=r&&Object.keys(r);if(!r||!l.length)return m(h);var p=w(h);if(!r.origin){var v=t.origin;Object.assign(r,{origin:v})}var x=function(t){var e=new $,r=t.origin,n=r[0],a=r[1],i=t.translate,o=t.rotate,u=t.skew,c=t.scale;return Array.isArray(i)&&i.every((function(t){return!Number.isNaN(+t)}))&&i.some((function(t){return 0!==t}))?e=e.translate.apply(e,i):"number"!=typeof i||Number.isNaN(i)||(e=e.translate(i)),(o||u||c)&&(e=e.translate(n,a),Array.isArray(o)&&o.every((function(t){return!Number.isNaN(+t)}))&&o.some((function(t){return 0!==t}))?e=e.rotate.apply(e,o):"number"!=typeof o||Number.isNaN(o)||(e=e.rotate(o)),Array.isArray(u)&&u.every((function(t){return!Number.isNaN(+t)}))&&u.some((function(t){return 0!==t}))?(e=u[0]?e.skewX(u[0]):e,e=u[1]?e.skewY(u[1]):e):"number"!=typeof u||Number.isNaN(u)||(e=e.skewX(u)),Array.isArray(c)&&c.every((function(t){return!Number.isNaN(+t)}))&&c.some((function(t){return 1!==t}))?e=e.scale.apply(e,c):"number"!=typeof c||Number.isNaN(c)||(e=e.scale(c)),e=e.translate(-n,-a)),e}(r),d=r.origin,M=Object.assign({},b),N=[],A=0,C="",S=[],k=[];if(!x.isIdentity){for(n=0,i=h.length;n<i;n+=1){N=h[n],h[n]&&(C=N[0]),k[n]=C,"A"===C&&(N=I(p[n],M),h[n]=I(p[n],M),g(h,k,n),p[n]=I(p[n],M),g(p,k,n),i=Math.max(h.length,p.length)),A=(N=p[n]).length,M.x1=+N[A-2],M.y1=+N[A-1],M.x2=+N[A-4]||M.x1,M.y2=+N[A-3]||M.y1;var P={s:h[n],c:h[n][0],x:M.x1,y:M.y1};S=S.concat([P])}return S.map((function(t){var e,r;switch(C=t.c,N=t.s,C){case"L":case"H":case"V":return e=tt(x,[t.x,t.y],d),u=e[0],c=e[1],s!==u&&f!==c?N=["L",u,c]:f===c?N=["H",u]:s===u&&(N=["V",c]),s=u,f=c,N;default:for(a=1,o=N.length;a<o;a+=2)r=tt(x,[+N[a],+N[a+1]],d),s=r[0],f=r[1],N[a]=s,N[a+1]=f;return N}}))}return m(h)}function rt(t,e){var r=t.x,n=t.y,a=e.x,i=e.y,o=r*a+n*i,u=Math.sqrt((Math.pow(r,2)+Math.pow(n,2))*(Math.pow(a,2)+Math.pow(i,2)));return(r*i-n*a<0?-1:1)*Math.acos(o/u)}function nt(t,e,r,n,a,i,o,u,c,s){var m=Math.abs,f=Math.sin,h=Math.cos,l=Math.sqrt,p=Math.PI,y=m(r),v=m(n),x=(a%360+360)%360*(p/180);if(t===u&&e===c)return{x:t,y:e};if(0===y||0===v)return j(t,e,u,c,s).point;var g=(t-u)/2,d=(e-c)/2,M={x:h(x)*g+f(x)*d,y:-f(x)*g+h(x)*d},b=Math.pow(M.x,2)/Math.pow(y,2)+Math.pow(M.y,2)/Math.pow(v,2);b>1&&(y*=l(b),v*=l(b));var w=(Math.pow(y,2)*Math.pow(v,2)-Math.pow(y,2)*Math.pow(M.y,2)-Math.pow(v,2)*Math.pow(M.x,2))/(Math.pow(y,2)*Math.pow(M.y,2)+Math.pow(v,2)*Math.pow(M.x,2)),N=(i!==o?1:-1)*l(w=w<0?0:w),A=N*(y*M.y/v),C=N*(-v*M.x/y),S=h(x)*A-f(x)*C+(t+u)/2,k=f(x)*A+h(x)*C+(e+c)/2,P={x:(M.x-A)/y,y:(M.y-C)/v},T=rt({x:1,y:0},P),q=rt(P,{x:(-M.x-A)/y,y:(-M.y-C)/v});!o&&q>0?q-=2*p:o&&q<0&&(q+=2*p);var I=T+(q%=2*p)*s,O=y*h(I),V=v*f(I);return{x:h(x)*O-f(x)*V+S,y:f(x)*O+h(x)*V+k}}function at(t,e,r,n,a,i,o,u,c,s){var m,f="number"==typeof s,h=t,l=e,p=0,y=[h,l,p],v=[h,l],x={x:0,y:0},g=[{x:h,y:l}];f&&0===s&&(x={x:h,y:l});for(var d=0;d<=300;d+=1){if(h=(m=nt(t,e,r,n,a,i,o,u,c,d/300)).x,l=m.y,g=g.concat([{x:h,y:l}]),p+=T(v,[h,l]),v=[h,l],f&&p>s&&s>y[2]){var M=(p-s)/(p-y[2]);x={x:v[0]*(1-M)+y[0]*M,y:v[1]*(1-M)+y[1]*M}}y=[h,l,p]}return f&&s>=p&&(x={x:u,y:c}),{length:p,point:x,min:{x:Math.min.apply(Math,g.map((function(t){return t.x}))),y:Math.min.apply(Math,g.map((function(t){return t.y})))},max:{x:Math.max.apply(Math,g.map((function(t){return t.x}))),y:Math.max.apply(Math,g.map((function(t){return t.y})))}}}function it(t,e,r,n,a,i,o,u,c){var s=1-c;return{x:Math.pow(s,3)*t+3*Math.pow(s,2)*c*r+3*s*Math.pow(c,2)*a+Math.pow(c,3)*o,y:Math.pow(s,3)*e+3*Math.pow(s,2)*c*n+3*s*Math.pow(c,2)*i+Math.pow(c,3)*u}}function ot(t,e,r,n,a,i,o,u,c){var s,m="number"==typeof c,f=t,h=e,l=0,p=[f,h,l],y=[f,h],v={x:0,y:0},x=[{x:f,y:h}];m&&0===c&&(v={x:f,y:h});for(var g=0;g<=300;g+=1){if(f=(s=it(t,e,r,n,a,i,o,u,g/300)).x,h=s.y,x=x.concat([{x:f,y:h}]),l+=T(y,[f,h]),y=[f,h],m&&l>c&&c>p[2]){var d=(l-c)/(l-p[2]);v={x:y[0]*(1-d)+p[0]*d,y:y[1]*(1-d)+p[1]*d}}p=[f,h,l]}return m&&c>=l&&(v={x:o,y:u}),{length:l,point:v,min:{x:Math.min.apply(Math,x.map((function(t){return t.x}))),y:Math.min.apply(Math,x.map((function(t){return t.y})))},max:{x:Math.max.apply(Math,x.map((function(t){return t.x}))),y:Math.max.apply(Math,x.map((function(t){return t.y})))}}}function ut(t,e,r,n,a,i,o){var u=1-o;return{x:Math.pow(u,2)*t+2*u*o*r+Math.pow(o,2)*a,y:Math.pow(u,2)*e+2*u*o*n+Math.pow(o,2)*i}}function ct(t,e,r,n,a,i,o){var u,c="number"==typeof o,s=t,m=e,f=0,h=[s,m,f],l=[s,m],p={x:0,y:0},y=[{x:s,y:m}];c&&0===o&&(p={x:s,y:m});for(var v=0;v<=300;v+=1){if(s=(u=ut(t,e,r,n,a,i,v/300)).x,m=u.y,y=y.concat([{x:s,y:m}]),f+=T(l,[s,m]),l=[s,m],c&&f>o&&o>h[2]){var x=(f-o)/(f-h[2]);p={x:l[0]*(1-x)+h[0]*x,y:l[1]*(1-x)+h[1]*x}}h=[s,m,f]}return c&&o>=f&&(p={x:a,y:i}),{length:f,point:p,min:{x:Math.min.apply(Math,y.map((function(t){return t.x}))),y:Math.min.apply(Math,y.map((function(t){return t.y})))},max:{x:Math.max.apply(Math,y.map((function(t){return t.x}))),y:Math.max.apply(Math,y.map((function(t){return t.y})))}}}function st(t,e){for(var r,n,a,i,o,u,c,s,m,f,h=w(t),l="number"==typeof e,p=[],y=0,v=0,x=0,g=0,d=[],M=[],b=0,N={x:0,y:0},A=N,C=N,S=N,k=0,P=0,T=h.length;P<T;P+=1)p=(s="M"===(m=(f=h[P])[0]))?p:[y,v].concat(f.slice(1)),s?(A=N={x:x=(r=f)[1],y:g=r[2]},b=0,l&&e<.001&&(S=N)):"L"===m?(b=(n=j.apply(void 0,p.concat([(e||0)-k]))).length,N=n.min,A=n.max,C=n.point):"A"===m?(b=(a=at.apply(void 0,p.concat([(e||0)-k]))).length,N=a.min,A=a.max,C=a.point):"C"===m?(b=(i=ot.apply(void 0,p.concat([(e||0)-k]))).length,N=i.min,A=i.max,C=i.point):"Q"===m?(b=(o=ct.apply(void 0,p.concat([(e||0)-k]))).length,N=o.min,A=o.max,C=o.point):"Z"===m&&(p=[y,v,x,g],b=(u=j.apply(void 0,p.concat([(e||0)-k]))).length,N=u.min,A=u.max,C=u.point),l&&k<e&&k+b>=e&&(S=C),M=M.concat([A]),d=d.concat([N]),k+=b,y=(c="Z"!==m?f.slice(-2):[x,g])[0],v=c[1];return l&&e>=k&&(S={x:y,y:v}),{length:k,point:S,min:{x:Math.min.apply(Math,d.map((function(t){return t.x}))),y:Math.min.apply(Math,d.map((function(t){return t.y})))},max:{x:Math.max.apply(Math,M.map((function(t){return t.x}))),y:Math.max.apply(Math,M.map((function(t){return t.y})))}}}function mt(t){if(!t)return{x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};var e=st(t),r=e.min,n=r.x,a=r.y,i=e.max,o=i.x,u=i.y,c=o-n,s=u-a;return{width:c,height:s,x:n,y:a,x2:o,y2:u,cx:n+c/2,cy:a+s/2,cz:Math.max(c,s)+Math.min(c,s)/2}}function ft(t){return st(t).length}function ht(t,e){return st(t,e).point}Object.assign($,{Version:"1.0.3"});var lt=function(e,r){var a=r||{},i=void 0===e;if(i||!e.length)throw TypeError(n+': "pathValue" is '+(i?"undefined":"empty"));var o=l(e);if("string"==typeof o)throw TypeError(o);this.segments=o;var u,c,s=this.getBBox(),m=s.width,f=s.height,h=s.cx,p=s.cy,y=s.cz,v=a.round,x=a.origin;if("auto"===v){var g=(""+Math.floor(Math.max(m,f))).length;u=g>=4?0:4-g}else u=Number.isInteger(v)||"off"===v?v:t.round;if(Array.isArray(x)&&x.length>=2){var d=x.map(Number),M=d[0],b=d[1],w=d[2];c=[Number.isNaN(M)?h:M,Number.isNaN(b)?p:b,Number.isNaN(w)?y:w]}else c=[h,p,y];return this.round=u,this.origin=c,this};function pt(t,e,r,n,a,i,o,u){return 3*((u-e)*(r+a)-(o-t)*(n+i)+n*(t-a)-r*(e-i)+u*(a+t/3)-o*(i+e/3))/20}function yt(t){var e=0,r=0,n=0;return O(t).map((function(t){var a,i;switch(t[0]){case"M":return e=(a=t)[1],r=a[2],0;default:return n=pt.apply(void 0,[e,r].concat(t.slice(1))),i=t.slice(-2),e=i[0],r=i[1],n}})).reduce((function(t,e){return t+e}),0)}function vt(t,e){var r=l(t);if("string"==typeof r)throw TypeError(r);var n=[].concat(r),a=ft(n),i=n.length-1,o=0,u=0,c=r[0],s=c.slice(-2),m={x:s[0],y:s[1]};if(i<=0||!e||!Number.isFinite(e))return{segment:c,index:0,length:u,point:m,lengthAtSegment:o};if(e>=a)return u=a-(o=ft(n=r.slice(0,-1))),{segment:r[i],index:i,length:u,lengthAtSegment:o};for(var f=[];i>0;)c=n[i],u=a-(o=ft(n=n.slice(0,-1))),a=o,f.push({segment:c,index:i,length:u,lengthAtSegment:o}),i-=1;return f.find((function(t){return t.lengthAtSegment<=e}))}function xt(t,e){for(var r,n,a,i,o=l(t),u=w(o),c=ft(o),s=function(t){var r=t.x-e.x,n=t.y-e.y;return r*r+n*n},m=8,f=0,h=0,p=1/0,y=0;y<=c;y+=m)(f=s(r=ht(u,y)))<p&&(n=r,h=y,p=f);m/=2;for(var v=0,x=0,g=0,d=0;m>.5;)g=s(a=ht(u,v=h-m)),d=s(i=ht(u,x=h+m)),v>=0&&g<p?(n=a,h=v,p=g):x<=c&&d<p?(n=i,h=x,p=d):m/=2;var M=vt(o,h);return{closest:n,distance:Math.sqrt(p),segment:M}}function gt(t){if("string"!=typeof t)return!1;var e=new f(t);for(u(e);e.index<e.max&&!e.err.length;)s(e);return!e.err.length&&"mM".includes(e.segments[0][0])}lt.prototype.getBBox=function(){return mt(this.segments)},lt.prototype.getTotalLength=function(){return ft(this.segments)},lt.prototype.getPointAtLength=function(t){return ht(this.segments,t)},lt.prototype.toAbsolute=function(){var t=this.segments;return this.segments=y(t),this},lt.prototype.toRelative=function(){var t=this.segments;return this.segments=x(t),this},lt.prototype.toCurve=function(){var t=this.segments;return this.segments=O(t),this},lt.prototype.reverse=function(t){this.toAbsolute();var e=this.segments,r=z(e),n=r.length>1?r:0,a=n&&m(n).map((function(e,r){return t?r?E(e):l(e):E(e)})),i=[];return i=n?a.flat(1):t?e:E(e),this.segments=m(i),this},lt.prototype.normalize=function(){var t=this.segments;return this.segments=w(t),this},lt.prototype.optimize=function(){var t=this.segments;return this.segments=Q(t,this.round),this},lt.prototype.transform=function(t){if(!t||"object"!=typeof t||"object"==typeof t&&!["translate","rotate","skew","scale"].some((function(e){return e in t})))return this;var e={};Object.keys(t).forEach((function(r){e[r]=Array.isArray(t[r])?[].concat(t[r]):Number(t[r])}));var r=this.segments,n=this.origin,a=n[0],i=n[1],o=n[2],u=e.origin;if(Array.isArray(u)&&u.length>=2){var c=u.map(Number),s=c[0],m=c[1],f=c[2];e.origin=[Number.isNaN(s)?a:s,Number.isNaN(m)?i:m,f||o]}else e.origin=[a,i,o];return this.segments=et(r,e),this},lt.prototype.flipX=function(){return this.transform({rotate:[0,180,0]}),this},lt.prototype.flipY=function(){return this.transform({rotate:[180,0,0]}),this},lt.prototype.toString=function(){return L(this.segments,this.round)};var dt={line:["x1","y1","x2","y2"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],rect:["width","height","x","y","rx","ry"],polygon:["points"],polyline:["points"],glyph:["d"]};var Mt={CSSMatrix:$,parsePathString:l,isPathArray:h,isCurveArray:A,isAbsoluteArray:p,isRelativeArray:v,isNormalizedArray:M,isValidPath:gt,pathToAbsolute:y,pathToRelative:x,pathToCurve:O,pathToString:L,getDrawDirection:function(t){return yt(O(t))>=0},getPathArea:yt,getPathBBox:mt,pathLengthFactory:st,getTotalLength:ft,getPointAtLength:ht,getClosestPoint:function(t,e){return xt(t,e).closest},getSegmentOfPoint:function(t,e){return xt(t,e).segment},getPropertiesAtPoint:xt,getPropertiesAtLength:vt,getSegmentAtLength:function(t,e){return vt(t,e).segment},isPointInStroke:function(t,e){var r=xt(t,e).distance;return Math.abs(r)<.001},clonePath:m,splitPath:z,fixPath:N,roundPath:V,optimizePath:Q,reverseCurve:function(t){var e=t.slice(1).map((function(e,r,n){return r?n[r-1].slice(-2).concat(e.slice(1)):t[0].slice(1).concat(e.slice(1))})).map((function(t){return t.map((function(e,r){return t[t.length-r-2*(1-r%2)]}))})).reverse();return[["M"].concat(e[0].slice(0,2))].concat(e.map((function(t){return["C"].concat(t.slice(2))})))},reversePath:E,normalizePath:w,transformPath:et,shapeToPath:function(e,r){var a=Object.keys(dt),i=e.tagName;if(i&&!a.some((function(t){return i===t})))throw TypeError(n+': "'+i+'" is not SVGElement');var o=document.createElementNS("http://www.w3.org/2000/svg","path"),u=i||e.type,c={};c.type=u;var s,m=dt[u];i?(m.forEach((function(t){c[t]=e.getAttribute(t)})),Object.values(e.attributes).forEach((function(t){var e=t.name,r=t.value;m.includes(e)||o.setAttribute(e,r)}))):(Object.assign(c,e),Object.keys(c).forEach((function(t){m.includes(t)||"type"===t||o.setAttribute(t.replace(/[A-Z]/g,(function(t){return"-"+t.toLowerCase()})),c[t])})));var f,h,l,p,y=t.round;return"circle"===u?s=L((h=(f=c).cx,l=f.cy,p=f.r,[["M",h-p,l],["a",p,p,0,1,0,2*p,0],["a",p,p,0,1,0,-2*p,0]]),y):"ellipse"===u?s=L(function(t){var e=t.cx,r=t.cy,n=t.rx,a=t.ry;return[["M",e-n,r],["a",n,a,0,1,0,2*n,0],["a",n,a,0,1,0,-2*n,0]]}(c),y):["polyline","polygon"].includes(u)?s=L(function(t){for(var e=[],r=(t.points||"").trim().split(/[\s|,]/).map(Number),n=0;n<r.length;)e.push([n?"L":"M",r[n],r[n+1]]),n+=2;return"polygon"===t.type?e.concat([["z"]]):e}(c),y):"rect"===u?s=L(function(t){var e=+t.x||0,r=+t.y||0,n=+t.width,a=+t.height,i=+t.rx,o=+t.ry;return i||o?(i=i||o,o=o||i,2*i>n&&(i-=(2*i-n)/2),2*o>a&&(o-=(2*o-a)/2),[["M",e+i,r],["h",n-2*i],["s",i,0,i,o],["v",a-2*o],["s",0,o,-i,o],["h",2*i-n],["s",-i,0,-i,-o],["v",2*o-a],["s",0,-o,i,-o]]):[["M",e,r],["h",n],["v",a],["H",e],["Z"]]}(c),y):"line"===u?s=L(function(t){return[["M",t.x1,t.y1],["L",t.x2,t.y2]]}(c),y):"glyph"===u&&(s=i?e.getAttribute("d"):e.d),!!gt(s)&&(o.setAttribute("d",s),r&&i&&(e.before(o,e),e.remove()),o)},options:t};return Object.assign(lt,Mt,{Version:"1.0.4"}),lt}));