text: // SVGPathCommander v0.1.25 | thednp © 2022 | MIT-License
  !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){var r=t.pathValue[t.segmentStart],n=r.toLowerCase(),a=t.data;for("m"===n&&a.length>2&&(t.segments.push([r,a[0],a[1]]),a=a.slice(2),n="l",r="m"===r?"l":"L");a.length>=e[n]&&(t.segments.push([r].concat(a.splice(0,e[n]))),e[n]););}function n(t){var e=t.index,r=t.pathValue.charCodeAt(e);return 48===r?(t.param=0,void(t.index+=1)):49===r?(t.param=1,void(t.index+=1)):void(t.err='Invalid path value: invalid Arc flag "'+r+'", expecting 0 or 1 at index '+e)}function a(t){return t>=48&&t<=57}function i(t){var e,r=t.max,n=t.pathValue,i=t.index,o=i,s=!1,u=!1,c=!1,m=!1;if(o>=r)t.err="Invalid path value at "+o+": missing param "+n[o];else if(43!==(e=n.charCodeAt(o))&&45!==e||(e=(o+=1)<r?n.charCodeAt(o):0),a(e)||46===e){if(46!==e){if(s=48===e,e=(o+=1)<r?n.charCodeAt(o):0,s&&o<r&&e&&a(e))return void(t.err="Invalid path value at index "+i+": "+n[i]+" illegal number");for(;o<r&&a(n.charCodeAt(o));)o+=1,u=!0;e=o<r?n.charCodeAt(o):0}if(46===e){for(m=!0,o+=1;a(n.charCodeAt(o));)o+=1,c=!0;e=o<r?n.charCodeAt(o):0}if(101===e||69===e){if(m&&!u&&!c)return void(t.err="Invalid path value at index "+o+": "+n[o]+" invalid float exponent");if(43!==(e=(o+=1)<r?n.charCodeAt(o):0)&&45!==e||(o+=1),!(o<r&&a(n.charCodeAt(o))))return void(t.err="Invalid path value at index "+o+": "+n[o]+" invalid float exponent");for(;o<r&&a(n.charCodeAt(o));)o+=1}t.index=o,t.param=+t.pathValue.slice(i,o)}else t.err="Invalid path value at index "+o+": "+n[o]+" is not a number"}function o(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 s(t){return t>=48&&t<=57||43===t||45===t||46===t}function u(t){var a=t.max,u=t.pathValue,c=t.index,m=u.charCodeAt(c),f=e[u[c].toLowerCase()];if(t.segmentStart=c,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}}(m))if(t.index+=1,o(t),t.data=[],f){for(;;){for(var h=f;h>0;h-=1){if(97!=(32|m)||3!==h&&4!==h?i(t):n(t),t.err.length)return;t.data.push(t.param),o(t),t.index<a&&44===u.charCodeAt(t.index)&&(t.index+=1,o(t))}if(t.index>=t.max)break;if(!s(u.charCodeAt(t.index)))break}r(t)}else r(t);else t.err="Invalid path value: "+u[c]+" not a path command"}function c(t){return t.map((function(t){return Array.isArray(t)?[].concat(t):t}))}function m(t){this.segments=[],this.pathValue=t,this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}function f(t){return Array.isArray(t)&&t.every((function(t){var r=t[0].toLowerCase();return e[r]===t.length-1&&"achlmqstvz".includes(r)}))}function h(t){if(f(t))return c(t);var e=new m(t);for(o(e);e.index<e.max&&!e.err.length;)u(e);return e.err.length?e.segments=[]:e.segments.length&&("mM".includes(e.segments[0][0])?e.segments[0][0]="M":(e.err="Invalid path value: missing M/m",e.segments=[])),e.segments}function l(t){return f(t)&&t.every((function(t){return t[0]===t[0].toUpperCase()}))}function p(t){if(l(t))return c(t);var e=h(t),r=0,n=0,a=0,i=0;return e.map((function(t){var e,o=t.slice(1).map(Number),s=t[0],u=s.toUpperCase();if("M"===s)return r=(e=o)[0],n=e[1],a=r,i=n,["M",r,n];var c=[];if(s!==u)switch(u){case"A":c=[u,o[0],o[1],o[2],o[3],o[4],o[5]+r,o[6]+n];break;case"V":c=[u,o[0]+n];break;case"H":c=[u,o[0]+r];break;default:var m=o.map((function(t,e){return t+(e%2?n:r)}));c=[u].concat(m)}else c=[u].concat(o);var f=c.length;switch(u){case"Z":r=a,n=i;break;case"H":r=c[1];break;case"V":n=c[1];break;default:r=c[f-2],n=c[f-1],"M"===u&&(a=r,i=n)}return c}))}function y(t){return f(t)&&t.slice(1).every((function(t){return t[0]===t[0].toLowerCase()}))}function v(t){if(y(t))return c(t);var e=h(t),r=0,n=0,a=0,i=0;return e.map((function(t){var e,o,s=t.slice(1).map(Number),u=t[0],c=u.toLowerCase();if("M"===u)return r=(e=s)[0],n=e[1],a=r,i=n,["M",r,n];var m=[];if(u!==c)switch(c){case"a":m=[c,s[0],s[1],s[2],s[3],s[4],s[5]-r,s[6]-n];break;case"v":m=[c,s[0]-n];break;case"h":m=[c,s[0]-r];break;default:var f=s.map((function(t,e){return t-(e%2?n:r)}));m=[c].concat(f),"m"===c&&(r=(o=s)[0],n=o[1],a=r,i=n)}else"m"===u&&(a=s[0]+r,i=s[1]+n),m=[c].concat(s);var h=m.length;switch(c){case"z":r=a,n=i;break;case"h":r+=m[1];break;case"v":n+=m[1];break;default:r+=m[h-2],n+=m[h-1]}return m}))}function x(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,r){var n=t[0],a=e.x1,i=e.y1,o=e.x2,s=e.y2,u=t.slice(1).map(Number),c=t;if("TQ".includes(n)||(e.qx=null,e.qy=null),"H"===n)c=["L",t[1],i];else if("V"===n)c=["L",a,t[1]];else if("S"===n){var m=function(t,e,r,n,a){return"CS".includes(a)?{x1:2*t-r,y1:2*e-n}:{x1:t,y1:e}}(a,i,o,s,r),f=m.x1,h=m.y1;e.x1=f,e.y1=h,c=["C",f,h].concat(u)}else if("T"===n){var l=function(t,e,r,n,a){return"QT".includes(a)?{qx:2*t-r,qy:2*e-n}:{qx:t,qy:e}}(a,i,e.qx,e.qy,r),p=l.qx,y=l.qy;e.qx=p,e.qy=y,c=["Q",p,y].concat(u)}else if("Q"===n){var v=u[0],x=u[1];e.qx=v,e.qy=x}return c}function g(t){return l(t)&&t.every((function(t){return"ACLMQZ".includes(t[0])}))}var M={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function b(t){if(g(t))return c(t);for(var e=p(t),r=Object.assign({},M),n=[],a=e.length,i="",o="",s=0;s<a;s+=1){i=e[s][0],n[s]=i,s&&(o=n[s-1]),e[s]=d(e[s],r,o);var u=e[s],m=u.length;r.x1=+u[m-2],r.y1=+u[m-1],r.x2=+u[m-4]||r.x1,r.y2=+u[m-3]||r.y1}return e}function w(t){var e=h(t),r=b(e),n=e.length,a="Z"===r.slice(-1)[0][0],i=a?n-2:n-1,o=r[0].slice(1),s=o[0],u=o[1],c=r[i].slice(-2),m=c[0],f=c[1];return a&&s===m&&u===f?e.slice(0,-1):e}function N(t){return f(t)&&t.every((function(t){return"MC".includes(t[0])}))}function A(t,e,r){return{x:t*Math.cos(r)-e*Math.sin(r),y:t*Math.sin(r)+e*Math.cos(r)}}function C(t,e,r,n,a,i,o,s,u,c){var m,f,h,l,p,y,v=t,x=e,d=r,g=n,M=s,b=u,w=120*Math.PI/180,N=Math.PI/180*(+a||0),S=[];if(c)h=(m=c)[0],l=m[1],p=m[2],y=m[3];else{v=(f=A(v,x,-N)).x,x=f.y;var k=(v-(M=(f=A(M,b,-N)).x))/2,P=(x-(b=f.y))/2,q=k*k/(d*d)+P*P/(g*g);q>1&&(d*=q=Math.sqrt(q),g*=q);var I=d*d,T=g*g,j=(i===o?-1:1)*Math.sqrt(Math.abs((I*T-I*P*P-T*k*k)/(I*P*P+T*k*k)));p=j*d*P/g+(v+M)/2,y=j*-g*k/d+(x+b)/2,h=(Math.asin((x-y)/g)*Math.pow(10,9)>>0)/Math.pow(10,9),l=(Math.asin((b-y)/g)*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 L=l-h;if(Math.abs(L)>w){var V=l,z=M,O=b;l=h+w*(o&&l>h?1:-1),S=C(M=p+d*Math.cos(l),b=y+g*Math.sin(l),d,g,a,0,o,z,O,[l,V,p,y])}L=l-h;var E=Math.cos(h),Z=Math.sin(h),Q=Math.cos(l),D=Math.sin(l),X=Math.tan(L/4),H=4/3*d*X,Y=4/3*g*X,F=[v,x],R=[v+H*Z,x-Y*E],B=[M+H*D,b-Y*Q],G=[M,b];if(R[0]=2*F[0]-R[0],R[1]=2*F[1]-R[1],c)return R.concat(B,G,S);for(var J=[],U=0,$=(S=R.concat(B,G,S)).length;U<$;U+=1)J[U]=U%2?A(S[U-1],S[U],N).y:A(S[U],S[U+1],N).x;return J}function S(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 k(t,e,r){var n=t[0],a=t[1];return[n+(e[0]-n)*r,a+(e[1]-a)*r]}function P(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}function q(t,e,r,n,a){var i=P([t,e],[r,n]);if("number"==typeof a){if(a<.001)return{x:t,y:e};if(a>i)return{x:r,y:n};var o=k([t,e],[r,n],a/i);return{x:o[0],y:o[1]}}return i}function I(t,e,r,n){var a=.5,i=[t,e],o=[r,n],s=k(i,o,a),u=k(o,s,a),c=k(s,u,a),m=k(u,c,a),f=k(c,m,a),h=i.concat(s,c,f,[a]),l=q.apply(void 0,h),p=f.concat(m,u,o,[0]),y=q.apply(void 0,p);return[l.x,l.y,y.x,y.y,r,n]}function T(t,e){var r,n=t[0],a=t.slice(1).map((function(t){return+t})),i=a[0],o=a[1],s=e.x1,u=e.y1,c=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=[s,u].concat(a),["C"].concat(C.apply(void 0,r));case"Q":return e.qx=i,e.qy=o,r=[s,u].concat(a),["C"].concat(S.apply(void 0,r));case"L":return["C"].concat(I(s,u,i,o));case"Z":return["C"].concat(I(s,u,c,m))}return t}function j(t){if(N(t))return c(t);for(var e=w(b(t)),r=Object.assign({},M),n=[],a="",i=e.length,o=0;o<i;o+=1){a=e[o][0],n[o]=a,e[o]=T(e[o],r),x(e,n,o),i=e.length;var s=e[o],u=s.length;r.x1=+s[u-2],r.y1=+s[u-1],r.x2=+s[u-4]||r.x1,r.y2=+s[u-3]||r.y1}return e}function L(e,r){var n=t.round;if(!1===r||!1===n)return c(e);var a=(n=r>=1?r:n)>=1?Math.pow(10,n):1;return e.map((function(t){var e=t.slice(1).map(Number).map((function(t){return t%1==0?t:Math.round(t*a)/a}));return[t[0]].concat(e)}))}function V(t,e){return L(t,e).map((function(t){return t[0]+t.slice(1).join(" ")})).join("")}function z(t){var e=p(t),r="Z"===e.slice(-1)[0][0],n=b(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],s=n[e+1]&&n[e+1],u=t.c,c=n.length,m=e?n[e-1].x:n[c-1].x,f=e?n[e-1].y:n[c-1].y,h=[];switch(u){case"M":h=r?["Z"]:[u,m,f];break;case"A":h=[u].concat(a.slice(1,-3),[1===a[5]?0:1],[m],[f]);break;case"C":h=s&&"S"===s.c?["S",a[1],a[2],m,f]:[u,a[3],a[4],a[1],a[2],m,f];break;case"S":h=o&&"CS".includes(o.c)&&(!s||s&&"S"!==s.c)?["C",i[3],i[4],i[1],i[2],m,f]:[u,i[1],i[2],m,f];break;case"Q":h=s&&"T"===s.c?["T",m,f]:[u].concat(a.slice(1,-2),[m],[f]);break;case"T":h=o&&"QT".includes(o.c)&&(!s||s&&"T"!==s.c)?["Q",i[1],i[2],m,f]:[u,m,f];break;case"Z":h=["M",m,f];break;case"H":h=[u,m];break;case"V":h=[u,f];break;default:h=[u].concat(a.slice(1,-2),[m],[f])}return h}));return r?n.reverse():[n[0]].concat(n.slice(1).reverse())}function O(t){return V(p(t),0).replace(/(m|M)/g,"|$1").split("|").map((function(t){return t.trim()})).filter((function(t){return t}))}function E(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})),s=e.slice(1).map((function(t){return+t})),u=r.x1,c=r.y1,m=r.x2,f=r.y2,h=r.x,l=r.y,p=t,y=s.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 d=s[0],g=s[1];"CS".includes(n)&&i(d)===i(2*u-m)&&i(g)===i(2*c-f)&&(p=["S"].concat(s.slice(-4))),r.x1=d,r.y1=g}else if("Q"===a){var M=s[0],b=s[1];r.qx=M,r.qy=b,"QT".includes(n)&&i(M)===i(2*u-m)&&i(b)===i(2*c-f)&&(p=["T"].concat(s.slice(-2)))}return p}function Z(t,e){for(var r,n=p(t),a=b(n),i=Object.assign({},M),o=[],s=n.length,u="",c="",m=0,f=0,h=0,l=0,y=0;y<s;y+=1){u=n[y][0],o[y]=u,y&&(c=o[y-1]),n[y]=E(n[y],a[y],i,c);var x=n[y],d=x.length;switch(i.x1=+x[d-2],i.y1=+x[d-1],i.x2=+x[d-4]||i.x1,i.y2=+x[d-3]||i.y1,u){case"Z":m=h,f=l;break;case"H":m=x[1];break;case"V":f=x[1];break;default:m=(r=x.slice(-2).map(Number))[0],f=r[1],"M"===u&&(h=m,l=f)}i.x=m,i.y=f}var g=L(n,e),w=L(v(n),e);return g.map((function(t,e){return e?t.join("").length<w[e].join("").length?t:w[e]:t}))}function Q(t){var e=new U,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],s=r[4],u=r[5],c=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],d=r[15];e.m11=n,e.a=n,e.m21=s,e.c=s,e.m31=f,e.m41=y,e.e=y,e.m12=a,e.b=a,e.m22=u,e.d=u,e.m32=h,e.m42=v,e.f=v,e.m13=i,e.m23=c,e.m33=l,e.m43=x,e.m14=o,e.m24=m,e.m34=p,e.m44=d}else{if(6!==r.length)throw new TypeError("CSSMatrix: expecting an Array of 6/16 values.");var g=r[0],M=r[1],b=r[2],w=r[3],N=r[4],A=r[5];e.m11=g,e.a=g,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 D(t){var e=Object.keys(new U);if("object"==typeof t&&e.every((function(e){return e in t})))return Q([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: "'+t+'" is not a DOMMatrix / CSSMatrix / JSON compatible object.')}function X(t){if("string"!=typeof t)throw TypeError('CSSMatrix: "'+t+'" is not a string.');var e=String(t).replace(/\s/g,""),r=new U,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)})),s=o[0],u=o[1],c=o[2],m=o[3],f=[s,u,c],h=[s,u,c,m];if("perspective"===a&&s&&[u,c].every((function(t){return void 0===t})))r.m34=-1/s;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(Q(l))}else if("translate3d"===a&&f.every((function(t){return!Number.isNaN(+t)})))r=r.translate(s,u,c);else if("translate"===a&&s&&void 0===c)r=r.translate(s,u||0,0);else if("rotate3d"===a&&h.every((function(t){return!Number.isNaN(+t)}))&&m)r=r.rotateAxisAngle(s,u,c,m);else if("rotate"===a&&s&&[u,c].every((function(t){return void 0===t})))r=r.rotate(0,0,s);else if("scale3d"===a&&f.every((function(t){return!Number.isNaN(+t)}))&&f.some((function(t){return 1!==t})))r=r.scale(s,u,c);else if("scale"!==a||Number.isNaN(s)||1===s||void 0!==c)if("skew"===a&&s&&void 0===c)r=r.skewX(s),r=u?r.skewY(u):r;else{if(!(/[XYZ]/.test(a)&&s&&[u,c].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](s);else{var p=a.replace(/[XYZ]/,""),y=a.replace(p,""),v=["X","Y","Z"].indexOf(y),x=[0===v?s:0,1===v?s:0,2===v?s:0];r=r[p].apply(r,x)}}else{var d=Number.isNaN(+u)?s:u;r=r.scale(s,d,1)}})),r}function H(t,e,r){var n=new U;return n.m41=t,n.e=t,n.m42=e,n.f=e,n.m43=r,n}function Y(t,e,r){var n=new U,a=Math.PI/180,i=t*a,o=e*a,s=r*a,u=Math.cos(i),c=-Math.sin(i),m=Math.cos(o),f=-Math.sin(o),h=Math.cos(s),l=-Math.sin(s),p=m*h,y=-m*l;n.m11=p,n.a=p,n.m12=y,n.b=y,n.m13=f;var v=c*f*h+u*l;n.m21=v,n.c=v;var x=u*h-c*f*l;return n.m22=x,n.d=x,n.m23=-c*m,n.m31=c*l-u*f*h,n.m32=c*h+u*f*l,n.m33=u*m,n}function F(t,e,r,n){var a=new U,i=n*(Math.PI/360),o=Math.sin(i),s=Math.cos(i),u=o*o,c=Math.sqrt(t*t+e*e+r*r),m=t,f=e,h=r;0===c?(m=0,f=0,h=1):(m/=c,f/=c,h/=c);var l=m*m,p=f*f,y=h*h,v=1-2*(p+y)*u;a.m11=v,a.a=v;var x=2*(m*f*u+h*o*s);a.m12=x,a.b=x,a.m13=2*(m*h*u-f*o*s);var d=2*(f*m*u-h*o*s);a.m21=d,a.c=d;var g=1-2*(y+l)*u;return a.m22=g,a.d=g,a.m23=2*(f*h*u+m*o*s),a.m31=2*(h*m*u+f*o*s),a.m32=2*(h*f*u-m*o*s),a.m33=1-2*(l+p)*u,a}function R(t,e,r){var n=new U;return n.m11=t,n.a=t,n.m22=e,n.d=e,n.m33=r,n}function B(t){var e=new U,r=t*Math.PI/180,n=Math.tan(r);return e.m21=n,e.c=n,e}function G(t){var e=new U,r=t*Math.PI/180,n=Math.tan(r);return e.m12=n,e.b=n,e}function J(t,e){return Q([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 U=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.set=function(t){this.isIdentity=t},$.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},$.is2D.set=function(t){this.is2D=t},U.prototype.setMatrixValue=function(t){return[Array,Float64Array,Float32Array].some((function(e){return t instanceof e}))?Q(t):"string"==typeof t&&t.length&&"none"!==t?X(t):"object"==typeof t?D(t):this},U.prototype.toArray=function(){var t=this,e=Math.pow(10,6);return(t.is2D?[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]).map((function(t){return Math.abs(t)<1e-6?0:(t*e>>0)/e}))},U.prototype.toString=function(){var t=this.toArray();return(this.is2D?"matrix":"matrix3d")+"("+t+")"},U.prototype.toJSON=function(){var t=this,e=t.is2D,r=t.isIdentity;return Object.assign({},t,{is2D:e,isIdentity:r})},U.prototype.multiply=function(t){return J(this,t)},U.prototype.translate=function(t,e,r){var n=e,a=r;return void 0===a&&(a=0),void 0===n&&(n=0),J(this,H(t,n,a))},U.prototype.scale=function(t,e,r){var n=e,a=r;return void 0===n&&(n=t),void 0===a&&(a=1),J(this,R(t,n,a))},U.prototype.rotate=function(t,e,r){var n=t,a=e,i=r;return void 0===a&&(a=0),void 0===i&&(i=n,n=0),J(this,Y(n,a,i))},U.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 J(this,F(t,e,r,n))},U.prototype.skewX=function(t){return J(this,B(t))},U.prototype.skewY=function(t){return J(this,G(t))},U.prototype.transformPoint=function(t){var e=H(t.x,t.y,t.z);return e.m44=t.w||1,{x:(e=this.multiply(e)).m41,y:e.m42,z:e.m43,w:e.m44}},U.prototype.transform=function(t){var e=this,r=e.m11*t.x+e.m12*t.y+e.m13*t.z+e.m14*t.w,n=e.m21*t.x+e.m22*t.y+e.m23*t.z+e.m24*t.w,a=e.m31*t.x+e.m32*t.y+e.m33*t.z+e.m34*t.w,i=e.m41*t.x+e.m42*t.y+e.m43*t.z+e.m44*t.w;return{x:r/i,y:n/i,z:a/i,w:i}},Object.defineProperties(U.prototype,$),Object.assign(U,{Translate:H,Rotate:Y,RotateAxisAngle:F,Scale:R,SkewX:B,SkewY:G,Multiply:J,fromArray:Q,fromMatrix:D,fromString:X});function K(t,e,r){var n=e[0],a=e[1],i=r[0],o=r[1],s=r[2],u=t.transformPoint({x:n,y:a,z:0,w:1}),c=u.x-i,m=u.y-o,f=u.z-s;return[c*(Math.abs(s)/Math.abs(f))+i,m*(Math.abs(s)/Math.abs(f))+o]}function W(t,e){var r,n,a,i,o,s,u,m=0,f=0,h=p(t),l=b(h),y=function(t){var e=new U,r=t.origin,n=r[0],a=r[1],i=t.translate,o=t.rotate,s=t.skew,u=t.scale;return Array.isArray(i)&&i.every((function(t){return!Number.isNaN(+t)}))&&i.some((function(t){return 0!==t}))?e=e.translate(i[0]||0,i[1]||0,i[2]||0):"number"!=typeof i||Number.isNaN(+i)||(e=e.translate(i||0,0,0)),(o||s||u)&&(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(o[0],o[1],o[2]):"number"!=typeof o||Number.isNaN(+o)||(e=e.rotate(0,0,o)),Array.isArray(s)&&s.every((function(t){return!Number.isNaN(+t)}))&&s.some((function(t){return 0!==t}))?(e=s[0]?e.skewX(s[0]):e,e=s[1]?e.skewY(s[1]):e):"number"!=typeof s||Number.isNaN(+s)||(e=e.skewX(s||0)),Array.isArray(u)&&u.every((function(t){return!Number.isNaN(+t)}))&&u.some((function(t){return 1!==t}))?e=e.scale(u[0],u[1],u[2]):"number"!=typeof u||Number.isNaN(+u)||(e=e.scale(u||1,u||1,u||1)),e=e.translate(-n,-a)),e}(e),v=Object.keys(e),d=e.origin,g=[y.a,y.b,y.c,y.d,y.e,y.f],w=Object.assign({},M),N=[],A=0,C="",S=[],k=[];if(!y.isIdentity){for(r=0,a=h.length;r<a;r+=1){N=h[r],h[r]&&(C=N[0]),k[r]=C,"A"!==C||y.is2D&&["skewX","skewY"].find((function(t){return v.includes(t)}))||(N=T(l[r],w),h[r]=T(l[r],w),x(h,k,r),l[r]=T(l[r],w),x(l,k,r),a=Math.max(h.length,l.length)),A=(N=l[r]).length,w.x1=+N[A-2],w.y1=+N[A-1],w.x2=+N[A-4]||w.x1,w.y2=+N[A-3]||w.y1;var P={s:h[r],c:h[r][0],x:w.x1,y:w.y1};S=S.concat([P])}return S.map((function(t){var e,r,a;switch(C=t.c,N=t.s,C){case"A":return u=function(t,e,r,n){var a=Math.cos(n*Math.PI/180),i=Math.sin(n*Math.PI/180),o=[e*(t[0]*a+t[2]*i),e*(t[1]*a+t[3]*i),r*(-t[0]*i+t[2]*a),r*(-t[1]*i+t[3]*a)],s=o[0]*o[0]+o[2]*o[2],u=o[1]*o[1]+o[3]*o[3],c=((o[0]-o[3])*(o[0]-o[3])+(o[2]+o[1])*(o[2]+o[1]))*((o[0]+o[3])*(o[0]+o[3])+(o[2]-o[1])*(o[2]-o[1])),m=(s+u)/2;if(c<1e-9*m){var f=Math.sqrt(m);return{rx:f,ry:f,ax:0}}var h,l,p=o[0]*o[1]+o[2]*o[3],y=m+(c=Math.sqrt(c))/2,v=m-c/2,x=Math.abs(p)<1e-9&&Math.abs(y-u)<1e-9?90:Math.atan(Math.abs(p)>Math.abs(y-u)?(y-s)/p:p/(y-u)*180)/Math.PI;return x>=0?(h=Math.sqrt(y),l=Math.sqrt(v)):(x+=90,h=Math.sqrt(v),l=Math.sqrt(y)),{rx:h,ry:l,ax:x}}(g,N[1],N[2],N[3]),g[0]*g[3]-g[1]*g[2]<0&&(N[5]=N[5]?0:1),e=K(y,[+N[6],+N[7]],d),o=e[0],s=e[1],N=m===o&&f===s||u.rx<1e-9*u.ry||u.ry<1e-9*u.rx?["L",o,s]:[C,u.rx,u.ry,u.ax,N[4],N[5],o,s],m=o,f=s,N;case"L":case"H":case"V":return r=K(y,[t.x,t.y],d),o=r[0],s=r[1],m!==o&&f!==s?N=["L",o,s]:f===s?N=["H",o]:m===o&&(N=["V",s]),m=o,f=s,N;default:for(n=1,i=N.length;n<i;n+=2)a=K(y,[+N[n],+N[n+1]],d),m=a[0],f=a[1],N[n]=m,N[n+1]=f;return N}}))}return c(h)}function _(t,e,r,n,a,i,o,s,u){var c=1-u;return{x:Math.pow(c,3)*t+3*Math.pow(c,2)*u*r+3*c*Math.pow(u,2)*a+Math.pow(u,3)*o,y:Math.pow(c,3)*e+3*Math.pow(c,2)*u*n+3*c*Math.pow(u,2)*i+Math.pow(u,3)*s}}function tt(t,e,r,n,a,i,o,s,u){var c,m="number"==typeof u,f=t,h=e,l=0,p=[t,e,l],y=[t,e];if(m&&u<.001)return{x:f,y:h};for(var v=0;v<=100;v+=1){if(l+=P(y,[f=(c=_(t,e,r,n,a,i,o,s,v/100)).x,h=c.y]),y=[f,h],m&&l>=u){var x=(l-u)/(l-p[2]);return{x:y[0]*(1-x)+p[0]*x,y:y[1]*(1-x)+p[1]*x}}p=[f,h,l]}return m&&u>=l?{x:o,y:s}:l}function et(t,e,r,n,a,i,o,s){var u,c,m,f,h=a-2*r+t-(o-2*a+r),l=2*(r-t)-2*(a-r),p=t-r,y=(-l+Math.sqrt(l*l-4*h*p))/2/h,v=(-l-Math.sqrt(l*l-4*h*p))/2/h,x=[t,o],d=[e,s],g=0,M=0;return Math.abs(y)>1e12&&(y=.5),Math.abs(v)>1e12&&(v=.5),y>0&&y<1&&(g=(u=tt(t,e,r,n,a,i,o,s,y)).x,M=u.y,x.push(g),d.push(M)),v>0&&v<1&&(g=(c=tt(t,e,r,n,a,i,o,s,v)).x,M=c.y,x.push(g),d.push(M)),h=i-2*n+e-(s-2*i+n),p=e-n,y=(-(l=2*(n-e)-2*(i-n))+Math.sqrt(l*l-4*h*p))/2/h,v=(-l-Math.sqrt(l*l-4*h*p))/2/h,Math.abs(y)>1e12&&(y=.5),Math.abs(v)>1e12&&(v=.5),y>0&&y<1&&(g=(m=tt(t,e,r,n,a,i,o,s,y)).x,M=m.y,x.push(g),d.push(M)),v>0&&v<1&&(g=(f=tt(t,e,r,n,a,i,o,s,v)).x,M=f.y,x.push(g),d.push(M)),{min:{x:Math.min.apply(Math,x),y:Math.min.apply(Math,d)},max:{x:Math.max.apply(Math,x),y:Math.max.apply(Math,d)}}}function rt(t){if(!t)return{x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};var e=j(t),r=0,n=0,a=[],i=[];e.forEach((function(t){var e=t.slice(-2).map(Number),o=e[0],s=e[1];if("M"===t[0])r=o,n=s,a.push(o),i.push(s);else{var u=[r,n].concat(t.slice(1)),c=et.apply(void 0,u);a=a.concat([c.min.x],[c.max.x]),i=i.concat([c.min.y],[c.max.y]),r=o,n=s}}));var o=Math.min.apply(Math,a),s=Math.min.apply(Math,i),u=Math.max.apply(Math,a),c=Math.max.apply(Math,i),m=u-o,f=c-s;return{width:m,height:f,x:o,y:s,x2:u,y2:c,cx:o+m/2,cy:s+f/2,cz:Math.max(m,f)+Math.min(m,f)/2}}Object.assign(U,{Version:"0.0.24"});var nt=function(e,r){var n=r||{};this.segments=h(e);var a=rt(this.segments),i=a.width,o=a.height,s=a.cx,u=a.cy,c=a.cz,m=t.round,f=t.origin,l=n.round,p=n.origin;if("auto"===l){var y=(""+Math.floor(Math.max(i,o))).length;m=y>=4?0:4-y}else(Number.isInteger(l)&&l>=1||!1===l)&&(m=l);if(Array.isArray(p)&&p.length>=2){var v=p.map(Number),x=v[0],d=v[1],g=v[2];f=[Number.isNaN(x)?s:x,Number.isNaN(d)?u:d,g||c]}else f=[s,u,c];return this.round=m,this.origin=f,this};function at(t,e,r,n,a,i,o,s){return 3*((s-e)*(r+a)-(o-t)*(n+i)+n*(t-a)-r*(e-i)+s*(a+t/3)-o*(i+e/3))/20}function it(t){var e=0,r=0,n=0;return j(t).map((function(t){var a,i;switch(t[0]){case"M":return e=(a=t)[1],r=a[2],0;default:return n=at.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 ot(t,e,r,n,a,i,o,s,u,c){var m,f=C(t,e,r,n,a,i,o,s,u),h="number"==typeof c,l=[t,e],p=l[0],y=l[1],v=0,x=[],d=[],g=0;if(h&&c<.001)return{x:p,y:y};for(var M=0,b=f.length;M<b;M+=6){if(x=f.slice(M,M+6),d=[p,y].concat(x),g=tt.apply(void 0,d),h&&v+g>=c)return tt.apply(void 0,d.concat([c-v]));v+=g,p=(m=x.slice(-2))[0],y=m[1]}return h&&c>=v?{x:s,y:u}:v}function st(t,e,r,n,a,i,o){var s=1-o;return{x:Math.pow(s,2)*t+2*s*o*r+Math.pow(o,2)*a,y:Math.pow(s,2)*e+2*s*o*n+Math.pow(o,2)*i}}function ut(t,e,r,n,a,i,o){var s,u="number"==typeof o,c=t,m=e,f=0,h=[t,e,f],l=[t,e];if(u&&o<.001)return{x:c,y:m};for(var p=0;p<=100;p+=1){if(f+=P(l,[c=(s=st(t,e,r,n,a,i,p/100)).x,m=s.y]),l=[c,m],u&&f>=o){var y=(f-o)/(f-h[2]);return{x:l[0]*(1-y)+h[0]*y,y:l[1]*(1-y)+h[1]*y}}h=[c,m,f]}return u&&o>=f?{x:a,y:i}:f}function ct(t,e){for(var r,n,a,i=w(b(t)),o="number"==typeof e,s=0,u=!0,c=[],m="M",f=0,h=0,l=0,p=0,y=0,v=0,x=i.length;v<x;v+=1){if(c=(u="M"===(m=(a=i[v])[0]))?c:[h,l].concat(a.slice(1)),u){if(p=(r=a)[1],y=r[2],o&&e<.001)return{x:p,y:y}}else if("L"===m){if(f=q.apply(void 0,c),o&&s+f>=e)return q.apply(void 0,c.concat([e-s]));s+=f}else if("A"===m){if(f=ot.apply(void 0,c),o&&s+f>=e)return ot.apply(void 0,c.concat([e-s]));s+=f}else if("C"===m){if(f=tt.apply(void 0,c),o&&s+f>=e)return tt.apply(void 0,c.concat([e-s]));s+=f}else if("Q"===m){if(f=ut.apply(void 0,c),o&&s+f>=e)return ut.apply(void 0,c.concat([e-s]));s+=f}else if("Z"===m){if(c=[h,l,p,y],f=q.apply(void 0,c),o&&s+f>=e)return q.apply(void 0,c.concat([e-s]));s+=f}h=(n="Z"!==m?a.slice(-2):[p,y])[0],l=n[1]}return o&&e>=s?{x:h,y:l}:s}function mt(t){return ct(t)}function ft(t,e){return ct(t,e)}function ht(t,e){var r=h(t),n=[],a=[].concat(r),i=mt(a),o=a.length-1,s=0,u=0,c=r[0],m=c.slice(-2),f={x:m[0],y:m[1]};if(o<=0||!e||!Number.isFinite(e))return{segment:c,index:0,length:u,point:f,lengthAtSegment:s};if(e>=i)return u=i-(s=mt(a=r.slice(0,-1))),{segment:r[o],index:o,length:u,lengthAtSegment:s};for(;o>0;)c=a[o],u=i-(s=mt(a=a.slice(0,-1))),i=s,n.push({segment:c,index:o,length:u,lengthAtSegment:s}),o-=1;return n.find((function(t){return t.lengthAtSegment<=e}))}function lt(t,e){for(var r=w(h(t)),n=b(r),a=mt(r),i=function(t){var r=t.x-e.x,n=t.y-e.y;return r*r+n*n},o=8,s={x:0,y:0},u=0,c=s,m=0,f=1/0,l=0;l<=a;l+=o)(u=i(s=ft(n,l)))<f&&(c=s,m=l,f=u);o/=2;for(var p={x:0,y:0},y=p,v=0,x=0,d=0,g=0;o>.5;)d=i(p=ft(n,v=m-o)),g=i(y=ft(n,x=m+o)),v>=0&&d<f?(c=p,m=v,f=d):x<=a&&g<f?(c=y,m=x,f=g):o/=2;var M=ht(r,m);return{closest:c,distance:Math.sqrt(f),segment:M}}nt.prototype.toAbsolute=function(){var t=this.segments;return this.segments=p(t),this},nt.prototype.toRelative=function(){var t=this.segments;return this.segments=v(t),this},nt.prototype.toCurve=function(){var t=this.segments;return this.segments=j(t),this},nt.prototype.reverse=function(t){this.toAbsolute();var e=this.segments,r=O(this.toString()),n=r.length>1?r:0,a=n&&c(n).map((function(e,r){return t?r?z(e):h(e):z(e)})),i=[];return i=n?a.flat(1):t?e:z(e),this.segments=c(i),this},nt.prototype.normalize=function(){var t=this.segments;return this.segments=b(t),this},nt.prototype.optimize=function(){var t=this.segments;return this.segments=Z(t,this.round),this},nt.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=e.origin;if(n&&n.length>=2){var a=n.map(Number),i=a[0],o=a[1],s=a[2],u=this.origin,c=u[0],m=u[1],f=u[2];e.origin=[Number.isNaN(i)?c:i,Number.isNaN(o)?m:o,s||f]}else e.origin=Object.assign({},this.origin);return this.segments=W(r,e),this},nt.prototype.flipX=function(){return this.transform({rotate:[180,0,0]}),this},nt.prototype.flipY=function(){return this.transform({rotate:[0,180,0]}),this},nt.prototype.toString=function(){return V(this.segments,this.round)};var pt={circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],rect:["width","height","x","y","rx","ry"],polygon:["points"],polyline:["points"],glyph:[]};var yt={CSSMatrix:U,parsePathString:h,isPathArray:f,isCurveArray:N,isAbsoluteArray:l,isRelativeArray:y,isNormalizedArray:g,isValidPath:function(t){if("string"!=typeof t)return!1;var e=new m(t);for(o(e);e.index<e.max&&!e.err.length;)u(e);return!e.err.length&&"mM".includes(e.segments[0][0])},pathToAbsolute:p,pathToRelative:v,pathToCurve:j,pathToString:V,getDrawDirection:function(t){return it(j(t))>=0},getPathArea:it,getPathBBox:rt,getTotalLength:mt,getPathLength:function(t){var e=0;return j(t).forEach((function(t,r,n){var a="M"!==t[0]?n[r-1].slice(-2).concat(t.slice(1)):[];e+="M"===t[0]?0:tt.apply(void 0,a)})),e},getPointAtLength:ft,getPointAtPathLength:function(t,e){return ft(t,e)},getClosestPoint:function(t,e){return lt(t,e).closest},getSegmentOfPoint:function(t,e){var r=lt(t,e).segment;return void 0!==r?r.segment:null},getPropertiesAtPoint:lt,getPropertiesAtLength:ht,getSegmentAtLength:function(t,e){var r=ht(t,e);return(void 0!==r?r:{segment:null}).segment},isPointInStroke:function(t,e){var r=lt(t,e).distance;return Math.abs(r)<.01},clonePath:c,splitPath:O,fixPath:w,roundPath:L,optimizePath:Z,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:z,normalizePath:b,transformPath:W,shapeToPath:function(e,r){var n=Object.keys(pt),a=e instanceof Element;if(a&&!n.some((function(t){return e.tagName===t})))throw TypeError('shapeToPath: "'+e+'" is not SVGElement');var i,o=document.createElementNS("http://www.w3.org/2000/svg","path"),s=a?e.tagName:e.type,u={};if(u.type=s,a){var c=pt[s];c.forEach((function(t){u[t]=e.getAttribute(t)})),Object.values(e.attributes).forEach((function(t){var e=t.name,r=t.value;c.includes(e)||o.setAttribute(e,r)}))}else Object.assign(u,e);var m,f,h,l,p=t.round;return"circle"===s?i=V((f=(m=u).cx,h=m.cy,l=m.r,[["M",f-l,h],["a",l,l,0,1,0,2*l,0],["a",l,l,0,1,0,-2*l,0]]),p):"ellipse"===s?i=V(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]]}(u),p):["polyline","polygon"].includes(s)?i=V(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}(u),p):"rect"===s?i=V(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"]]}(u),p):"line"===s?i=V(function(t){return[["M",t.x1,t.y1],["L",t.x2,t.y2]]}(u),p):"glyph"===s&&(i=a?e.getAttribute("d"):e.type),!!i&&(o.setAttribute("d",i),r&&a&&(e.before(o,e),e.remove()),o)},options:t};return Object.assign(nt,yt,{Version:"0.1.25"}),nt}));
  