svg-path-simplify 0.3.4 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.yml +28 -0
  2. package/.github/ISSUE_TEMPLATE/feature_request.yml +35 -0
  3. package/dist/svg-path-simplify.esm.js +4104 -3481
  4. package/dist/svg-path-simplify.esm.min.js +2 -8
  5. package/dist/svg-path-simplify.js +4105 -3480
  6. package/dist/svg-path-simplify.min.js +2 -8
  7. package/dist/svg-path-simplify.pathdata.esm.js +1090 -1039
  8. package/dist/svg-path-simplify.pathdata.esm.min.js +2 -8
  9. package/index.html +493 -116
  10. package/package.json +1 -1
  11. package/site.webmanifest +21 -0
  12. package/src/constants.js +3 -1
  13. package/src/index.js +7 -1
  14. package/src/pathData_simplify_cubic.js +1 -10
  15. package/src/pathSimplify-main.js +71 -28
  16. package/src/pathSimplify-only-pathdata.js +2 -2
  17. package/src/svg-getAttributes.js +13 -0
  18. package/src/svg_flatten_transforms.js +43 -0
  19. package/src/svg_getViewbox.js +23 -11
  20. package/src/svg_rootSVG.js +9 -0
  21. package/src/svgii/convert_colors.js +98 -0
  22. package/src/svgii/convert_units.js +144 -0
  23. package/src/svgii/geometry.js +24 -4
  24. package/src/svgii/geometry_bbox.js +2 -1
  25. package/src/svgii/geometry_bbox_element.js +46 -0
  26. package/src/svgii/pathData_analyze.js +1 -1
  27. package/src/svgii/pathData_convert.js +143 -29
  28. package/src/svgii/pathData_parse.js +2 -99
  29. package/src/svgii/pathData_parse_els.js +198 -125
  30. package/src/svgii/pathData_simplify_refineCorners.js +72 -43
  31. package/src/svgii/pathData_stringify.js +6 -5
  32. package/src/svgii/poly_normalize.js +21 -1
  33. package/src/svgii/rounding.js +36 -5
  34. package/src/svgii/svg-styles-getTransforms.js +43 -5
  35. package/src/svgii/svg-styles-to-attributes-const.js +8 -3
  36. package/src/svgii/svg-styles-to-attributes.js +106 -9
  37. package/src/svgii/svg_cleanup.js +291 -35
  38. package/src/svgii/svg_el_parse_style_props.js +423 -0
  39. package/src/svgii/stringify.js +0 -103
@@ -1,9 +1,3 @@
1
- function e(e,t,a="red",l="1%",r="1",n="",s=!0,i="",o=""){Array.isArray(t)&&(t={x:t[0],y:t[1]});let p=`<circle class="${o}" opacity="${r}" id="${i}" cx="${t.x}" cy="${t.y}" r="${l}" fill="${a}">\n <title>${n}</title></circle>`;if(!s)return p;e.insertAdjacentHTML("beforeend",p)}function t(e,t="",a="green",l="1%",r="1",n=!0){let s=`<path d="${t}" fill="none" stroke="${a}" stroke-width="${l}" stroke-opacity="${r}" /> `;if(!n)return s;e.insertAdjacentHTML("beforeend",s)}const{abs:a,acos:l,asin:r,atan:n,atan2:s,ceil:i,cos:o,exp:p,floor:u,log:h,hypot:y,max:c,min:x,pow:f,random:g,round:m,sin:d,sqrt:v,tan:M,PI:b}=Math,{abs:A,acos:w,asin:C,atan:k,atan2:P,ceil:L,cos:E,exp:S,floor:D,log:T,max:I,min:F,pow:$,random:q,round:j,sin:z,sqrt:Q,tan:B,PI:N}=Math;function O(e,t,a=!1){let l=P(t.y-e.y,t.x-e.x);return a&&l<0&&(l+=2*Math.PI),l}function R(e,t,a,l=!1){let r=Math.atan2(t.y-e.y,t.x-e.x),n=Math.atan2(a.y-e.y,a.x-e.x),s=n-r;s=(e=>{let t=e%(2*Math.PI);return t>Math.PI?t-=2*Math.PI:t<=-Math.PI&&(t+=2*Math.PI),t})(s),l&&(s=2*Math.PI-Math.abs(s));let i=180/Math.PI;return{startAngle:r,endAngle:n,deltaAngle:s,startAngleDeg:r*i,endAngleDeg:n*i,deltaAngleDeg:s*i}}function G(e=null,t=null,a=null,l=null,r=!0,n=!1,s=!1){let i,o,p,u,h,y={};if(!(e&&t&&a&&l))return s&&console.warn("points missing"),!1;try{if(i=(l.y-a.y)*(t.x-e.x)-(l.x-a.x)*(t.y-e.y),0===i)return!1}catch{return s&&console.warn("!catch",e,t,"p3:",a,"p4:",l),!1}o=e.y-a.y,p=e.x-a.x,u=(l.x-a.x)*o-(l.y-a.y)*p,h=(t.x-e.x)*o-(t.y-e.y)*p,o=u/i,p=h/i,y={x:e.x+o*(t.x-e.x),y:e.y+o*(t.y-e.y)};let c=!1;return o>0&&o<1&&p>0&&p<1&&(c=!0),!r&&n&&(o>0&&p<0||o<0&&p>0)?(c=!1,!1):!(r&&!c)&&y}function U(e,t,a,l=!1){const r=(e,t,a)=>e>=t&&e<=a||e<=t&&e>=a;let n=!1;if((!l||!a.bottom)&&(a.left>e.x||a.top>e.y||a.bottom<e.y||a.right<e.x))return!1;let s=t.length;for(let a=s-1,l=0;l<s;a=l,l++){const s=t[a],i=t[l];if(e.x==s.x&&e.y==s.y||e.x==i.x&&e.y==i.y)return!0;if(s.y==i.y&&e.y==s.y&&r(e.x,s.x,i.x))return!0;if(r(e.y,s.y,i.y)){if(e.y==s.y&&i.y>=s.y||e.y==i.y&&s.y>=i.y)continue;const t=(s.x-e.x)*(i.y-e.y)-(i.x-e.x)*(s.y-e.y);if(0==t)return!0;s.y<i.y==t>0&&(n=!n)}}return!!n}function Z(e,t,a,l=!1){let r={x:(t.x-e.x)*a+e.x,y:(t.y-e.y)*a+e.y};return l&&(r.angle=O(e,t),r.angle<0&&(r.angle+=2*N)),r}function H(e,t=.5,a=!1,l=!1,r=!1){let n;return Array.isArray(e[0])&&(e=e.map(e=>({x:e[0],y:e[1]})),r=!0),n=e.length>2?((e,t,a=!1)=>{let r=4===e.length,n=e[0],s=e[1],i=r?e[2]:e[1],o=e[e.length-1],p={x:0,y:0};if(a||l){let e,a,u,h,y,c=n.x===s.x&&n.y===s.y,x=o.x===i.x&&o.y===i.y;0!==t||c?1!==t||x?(c&&(t+=1e-7),x&&(t-=1e-7),e=Z(n,s,t),r?(a=Z(s,i,t),u=Z(i,o,t),h=Z(e,a,t),y=Z(a,u,t),p=Z(h,y,t),p.angle=O(h,y),l&&(p.cpts=[a,u,h,y])):(a=Z(n,s,t),u=Z(s,o,t),p=Z(a,u,t),p.angle=O(a,u),l&&(p.cpts=[a,u]))):(p.x=o.x,p.y=o.y,p.angle=O(i,o)):(p.x=n.x,p.y=n.y,p.angle=O(n,s))}else{let e=1-t;p=r?{x:e**3*n.x+3*e**2*t*s.x+3*e*t**2*i.x+t**3*o.x,y:e**3*n.y+3*e**2*t*s.y+3*e*t**2*i.y+t**3*o.y}:{x:e*e*n.x+2*e*t*s.x+t**2*o.x,y:e*e*n.y+2*e*t*s.y+t**2*o.y}}return p})(e,t,a):Z(e[0],e[1],t,a),a&&n.angle<0&&(n.angle+=2*N),r?[n.x,n.y]:n}function W(e){let t=[],a={x:e[0].values[0],y:e[0].values[1]};return e.forEach(e=>{let{type:l,values:r}=e;if(r.length){let e=r.length>1?{x:r[r.length-2],y:r[r.length-1]}:"V"===l?{x:a.x,y:r[0]}:{x:r[0],y:a.y};t.push(e),a=e}}),t}function V(e,t,a,l,r,n,s,i,o){const p=(e,t,a,l)=>P(l-t,a-e);let u={cx:0,cy:0,rx:a=A(a),ry:l=A(l),startAngle:0,endAngle:0,deltaAngle:0,clockwise:s,xAxisRotation:r,largeArc:n,sweep:s};if(0==a||0==l)throw Error("rx and ry can not be 0");if(a===l){let a=Math.abs(i-e),l=Math.abs(o-t),r=a,n=Math.min(e,i),p=Math.min(t,o),h=.5*Math.PI;if(0===a&&l||0===l&&a)return r=0===a&&l?l/2:a/2,u.rx=r,u.ry=r,0===a&&l?(u.cx=e,u.cy=p+l/2,u.startAngle=t>o?h:-h,u.endAngle=t>o?-h:h,u.deltaAngle=s?Math.PI:-Math.PI):0===l&&a&&(u.cx=n+a/2,u.cy=t,u.startAngle=e>i?Math.PI:0,u.endAngle=e>i?-Math.PI:Math.PI,u.deltaAngle=s?Math.PI:-Math.PI),u}let h,y,c=a===l?0:r*N/180,x=c?Math.sin(c):0,f=c?Math.cos(c):1,g=(e-i)/2,m=(t-o)/2,d=(e+i)/2,v=(t+o)/2,M=c?f*g+x*m:g,b=c?f*m-x*g:m,w=M*M/(a*a)+b*b/(l*l);w>1&&(a*=Math.sqrt(w),l*=Math.sqrt(w),u.rx=a,u.ry=l);let C=a*l,k=a*b,L=l*M,E=k**2+L**2;if(!E)throw Error("start point can not be same as end point");let S=Math.sqrt(Math.abs((C*C-E)/E));n==s&&(S=-S);let D=S*k/l,T=-S*L/a;h=c?f*D-x*T+d:d+D,y=c?x*D+f*T+v:v+T,u.cy=y,u.cx=h;let I=p(h,y,e,t),F=p(h,y,i,o);!s&&F>I&&(F-=2*Math.PI),s&&I>F&&(F=F<=0?F+2*Math.PI:F);let $=F-I;return u.startAngle=I,u.endAngle=F,u.deltaAngle=$,u}function J(e,t,a,l=0,r=!1){return l?(l=r?l/180*Math.PI:l,{x:t+(e.x-t)*Math.cos(l)-(e.y-a)*Math.sin(l),y:a+(e.x-t)*Math.sin(l)+(e.y-a)*Math.cos(l)}):e}function X(e,t,a,l,r,n=0,s=!0,i=!1){if(r=i?r*N/180:r,n=i?n*N/180:n,n=a!==l&&n!==2*N?n:0,s&&a!==l){let e=k(B(r=n?r-n:r)*(a/l));r=E(r)<0?e+N:e}let o=e+a*E(r),p=t+l*z(r),u={x:o,y:p};return n&&(u.x=e+(o-e)*E(n)-(p-t)*z(n),u.y=t+(o-e)*z(n)+(p-t)*E(n)),u}function Y(e,t,a){if(t===a||e%N*.5==0)return e;let l=k(B(e)*(t/a));return l=E(e)<0?l+N:l,l}function _(e=null,t=[]){e||(e=t[0],t=t.slice(1,t.length));let a=t.length,l=t[a-1],r=t[0],n=3===a?t[1]:r,s=Math.min(e.y,l.y),i=Math.min(e.x,l.x),o=Math.max(e.x,l.x),p=Math.max(e.y,l.y);return!(r.y>=s&&r.y<=p&&n.y>=s&&n.y<=p&&r.x>=i&&r.x<=o&&n.x>=i&&n.x<=o)}function K(e,{addExtremes:t=!0,addSemiExtremes:a=!1}={}){let l=4===e.length?function(e,t,a,l,{addExtremes:r=!0,addSemiExtremes:n=!1}={}){const s=e=>{const t=Math.PI/4,a=Math.cos(t),l=Math.sin(t);return{x:e.x*a-e.y*l,y:e.x*l+e.y*a}};n&&(e=s(e),t=s(t),a=s(a),l=s(l));let[i,o,p,u,h,y,c,x]=[e.x,e.y,t.x,t.y,a.x,a.y,l.x,l.y],f=Math.min(e.y,l.y),g=Math.min(e.x,l.x),m=Math.max(e.x,l.x),d=Math.max(e.y,l.y);if(t.y>=f&&t.y<=d&&a.y>=f&&a.y<=d&&t.x>=g&&t.x<=m&&a.x>=g&&a.x<=m)return[];let v,M,b,A,w,C,k,P,L=[];for(let e=0;e<2;++e)if(0==e?(M=6*i-12*p+6*h,v=-3*i+9*p-9*h+3*c,b=3*p-3*i):(M=6*o-12*u+6*y,v=-3*o+9*u-9*y+3*x,b=3*u-3*o),Math.abs(v)<1e-8){if(Math.abs(M)<1e-8)continue;A=-b/M,0<A&&A<1&&L.push(A)}else k=M*M-4*b*v,k<0?Math.abs(k)<1e-8&&(A=-M/(2*v),0<A&&A<1&&L.push(A)):(P=Math.sqrt(k),w=(-M+P)/(2*v),0<w&&w<1&&L.push(w),C=(-M-P)/(2*v),0<C&&C<1&&L.push(C));let E=L.length;for(;E--;)A=L[E];return L}(e[0],e[1],e[2],e[3],{addExtremes:t,addSemiExtremes:a}):function(e,t,a,{addExtremes:l=!0,addSemiExtremes:r=!1}={}){const n=e=>{const t=-Math.PI/4,a=Math.cos(t),l=Math.sin(t);return{x:e.x*a-e.y*l,y:e.x*l+e.y*a}};r&&(e=n(e),t=n(t),a=n(a));let s,i,o,p=Math.min(e.y,a.y),u=Math.min(e.x,a.x),h=Math.max(e.x,a.x),y=Math.max(e.y,a.y);if(t.y>=p&&t.y<=y&&t.x>=u&&t.x<=h)return[];let[c,x,f,g,m,d]=[e.x,e.y,t.x,t.y,a.x,a.y],v=[];for(let e=0;e<2;++e)s=0==e?c-2*f+m:x-2*g+d,i=0==e?-2*c+2*f:-2*x+2*g,Math.abs(s)>1e-12&&(o=-i/(2*s),o>0&&o<1&&v.push(o));return v}(e[0],e[1],e[2],{addExtremes:t,addSemiExtremes:a});return l}function ee(e,t){const a=(e,t,a,l,r,n)=>{var s=Math.cos(n),i=Math.sin(n),o=l*Math.cos(e),p=r*Math.sin(e);return{x:t+s*o-i*p,y:a+i*o+s*p}};let l,r,n,s,i,o=V(e.x,e.y,t[0],t[1],t[2],t[3],t[4],t[5],t[6]),{rx:p,ry:u,cx:h,cy:y,endAngle:c,deltaAngle:x}=o,f=t[2],g={x:t[5],y:t[6]},m=[g],d=f*Math.PI/180,v=Math.tan(d);i=Math.atan2(-u*v,p);let M=i,b=i+Math.PI,A=Math.atan2(u,p*v),w=A+Math.PI,C=[e.x,g.x],k=[e.y,g.y],P=Math.min(...C),L=Math.max(...C),E=Math.min(...k),S=Math.max(...k),D=a(c-.001*x,h,y,p,u,d),T=a(c-.999*x,h,y,p,u,d);return(D.x>L||T.x>L)&&(l=a(M,h,y,p,u,d),m.push(l)),(D.x<P||T.x<P)&&(r=a(b,h,y,p,u,d),m.push(r)),(D.y<E||T.y<E)&&(s=a(w,h,y,p,u,d),m.push(s)),(D.y>S||T.y>S)&&(n=a(A,h,y,p,u,d),m.push(n)),m}function te(e=[],t=[]){let a=e.length,l=4===a;t.length||(t=[0]);let r=t.length,n=[];for(let s=0;s<r;s++){let r=t[s],i=r?[]:e.slice(0);if(r)for(let t=0;t<a;t++){let a=e[t];i.push(J(a,0,0,r))}let o=l?ae(...i):le(...i);n.push(...o)}return n=[...new Set(n)].sort(),n}function ae(e,t,a,l){if(!_(e,[t,a,l]))return[];let r,n,s,i,o,p,u,h,[y,c,x,f,g,m,d,v]=[e.x,e.y,t.x,t.y,a.x,a.y,l.x,l.y],M=[],b=1e-8;for(let e=0;e<2;++e)if(0==e?(n=6*y-12*x+6*g,r=-3*y+9*x-9*g+3*d,s=3*x-3*y):(n=6*c-12*f+6*m,r=-3*c+9*f-9*m+3*v,s=3*f-3*c),Math.abs(r)<b){if(Math.abs(n)<b)continue;i=-s/n,i>0&&i<1&&M.push(i)}else u=n*n-4*s*r,u<0?Math.abs(u)<b&&(i=-n/(2*r),i>0&&i<1&&M.push(i)):(h=Math.sqrt(u),o=(-n+h)/(2*r),o>0&&o<1&&M.push(o),p=(-n-h)/(2*r),p>0&&p<1&&M.push(p));let A=M.length;for(;A--;)i=M[A];return[...new Set(M)].sort()}function le(e,t,a){if(!_(e,[t,a]))return[];let l,r,n,[s,i,o,p,u,h]=[e.x,e.y,t.x,t.y,a.x,a.y],y=[];for(let e=0;e<2;++e)l=0==e?s-2*o+u:i-2*p+h,r=0==e?-2*s+2*o:-2*i+2*p,Math.abs(l)>1e-12&&(n=-r/(2*l),n>0&&n<1&&y.push(n));return[...new Set(y)].sort()}function re(e,t=.001){let a=Math.PI/2,l=a/2;return!(Math.abs(e/a-Math.round(e/a))<t)&&Math.abs(e/l-Math.round(e/l))<t}function ne(e,t,a=!1){let l=a?t[0]-e[0]:t.x-e.x,r=a?t[1]-e[1]:t.y-e.y;return Q(l*l+r*r)}function se(e,t){let a=t.x-e.x,l=t.y-e.y;return a*a+l*l}function ie(e,t){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)}function oe(e,t){return.5*(Math.abs(t.x-e.x)+Math.abs(t.y-e.y))}function pe(e,t=48){if(!Array.isArray(e)||e.length<=t)return e;let a=e.length,l=a/t,r=[];for(let a=0;a<t;a++)r.push(e[Math.floor(a*l)]);let n=r.length;return r[n-1]!==e[a-1]&&(r[n-1]=e[a-1]),r}function ue(e){let t=[],a=[e[0]],l=e.length;for(let r=1;r<l;r++){let l=e[r];"M"!==l.type&&"m"!==l.type||(t.push(a),a=[]),a.push(l)}return a.length&&t.push(a),t}function he(e,t){let a,l,r,n,s,i,o=[],p=[],u=e[0],h=e[1],y=e[e.length-2],c=e[e.length-1];return 4===e.length?(a=H([u,h],t),l=H([h,y],t),r=H([y,c],t),n=H([a,l],t),s=H([l,r],t),i=H([n,s],t),o.push({x:u.x,y:u.y},{x:a.x,y:a.y},{x:n.x,y:n.y},{x:i.x,y:i.y}),p.push({x:i.x,y:i.y},{x:s.x,y:s.y},{x:r.x,y:r.y},{x:c.x,y:c.y})):3===e.length?(l=H([u,h],t),r=H([h,c],t),i=H([l,r],t),o.push({x:u.x,y:u.y},{x:l.x,y:l.y},{x:i.x,y:i.y}),p.push({x:i.x,y:i.y},{x:r.x,y:r.y},{x:c.x,y:c.y})):2===e.length&&(l=H([u,c],t),o.push({x:u.x,y:u.y},{x:l.x,y:l.y}),p.push({x:l.x,y:l.y},{x:c.x,y:c.y})),[o,p]}function ye(e,t,{tMin:a=0,tMax:l=1,addExtremes:r=!0,addSemiExtremes:n=!1}={}){let s=[],i=6===t.length?"C":"Q",o={x:t[0],y:t[1]},p="C"===i?{x:t[2],y:t[3]}:o,u={x:t[4],y:t[5]},h=0;let y="C"===i?[e,o,p,u]:[e,o,u],c=r?K(y,{addExtremes:r,addSemiExtremes:!1}):[],x=n?K(y,{addExtremes:r,addSemiExtremes:n}):[],f=Array.from(new Set([...c,...x])).sort();if(f=f.filter(e=>e>0&&e<1),f.length){let a=function(e,t,a,l=!0){let r=[];if(!a.length)return!1;let n,s,i,o=t.length,p={x:t[o-2],y:t[o-1]};2===t.length?i=[e,p]:4===t.length?(n={x:t[0],y:t[1]},i=[e,n,p]):6===t.length&&(n={x:t[0],y:t[1]},s={x:t[2],y:t[3]},i=[e,n,s,p]);if(a.length)if(1===a.length){let e=he(i,a[0]),t=e[0],l=e[1];r.push(t,l)}else{let e=a[0],t=he(i,e),l=t[0];r.push(l),i=t[1];for(let t=1;t<a.length;t++){e=a[t-1];let l=he(i,(a[t]-e)/(1-e));r.push(l[0]),t===a.length-1&&r.push(l[l.length-1]),i=l[1]}}if(l){let e,t,a=[];return r.forEach(l=>{e={type:"",values:[]},l.shift(),t=l.map(e=>Object.values(e)).flat(),e.values=t,3===l.length?e.type="C":2===l.length?e.type="Q":1===l.length&&(e.type="L"),a.push(e)}),a}return r}(e,t,f);s.push(...a),h+=a.length}else s.push({type:i,values:t});return{pathData:s,count:h}}function ce(e,{tMin:t=0,tMax:a=1,addExtremes:l=!0,addSemiExtremes:r=!1}={}){let n=[e[0]],s={x:e[0].values[0],y:e[0].values[1]},i={x:e[0].values[0],y:e[0].values[1]},o=e.length;for(let p=1;o&&p<o;p++){let o=e[p],{type:u,values:h}=o,y=h.slice(-2);if(y[0],y[1],"C"!==u&&"Q"!==u)n.push(o);else if((l||r)&&("C"===u||"Q"===u)){let e=ye(s,h,{tMin:t,tMax:a,addExtremes:l,addSemiExtremes:r}).pathData;n.push(...e)}s={x:y[0],y:y[1]},"z"===u.toLowerCase()?s=i:"M"===u&&(i={x:y[0],y:y[1]})}return n}function xe(e,t=-1){let a=e.map(e=>e.x),l=e.map(e=>e.y),r=Math.min(...a),n=Math.max(...a),s=Math.min(...l),i=Math.max(...l),o={x:r,left:r,right:n,y:s,top:s,bottom:i,width:n-r,height:i-s};if(t>-1)for(let e in o)o[e]=+o[e].toFixed(t);return o}function fe(e){let t=[];return e.forEach(e=>{let a=function(e){let t=function(e){let t=[];for(let a=0;a<e.length;a++){let l=e[a],r=a>0?e[a-1]:e[a],{type:n,values:s}=l,i={x:r.values[r.values.length-2],y:r.values[r.values.length-1]},o=s.length?{x:s[s.length-2],y:s[s.length-1]}:"",p=s.length?{x:s[0],y:s[1]}:"";switch(n){case"A":if("function"!=typeof arcToBezier){let e=ne(i,o)/2,a=Z(i,o,.5),l=X(a.x,a.y,e,e,0),r=X(a.x,a.y,e,e,Math.PI);t.push(l,r,o);break}arcToBezier(i,s).forEach(e=>{let a=e.values,l={x:a[0],y:a[1]},r={x:a[2],y:a[3]},n={x:a[4],y:a[5]};t.push(l,r,n)});break;case"C":let e={x:s[2],y:s[3]};t.push(p,e);break;case"Q":t.push(p)}"z"!==n.toLowerCase()&&t.push(o)}return t}(e),a=xe(t);return a}(e);t.push(a)}),t}function ge(e,t){let[a,l,r,n,s,i]=[e.x,e.y,e.width,e.height,e.x+e.width,e.y+e.height],[o,p,u,h,y,c]=[t.x,t.y,t.width,t.height,t.x+t.width,t.y+t.height],x=!1;return r*n!=u*h&&r*n>u*h&&a<o&&s>y&&l<p&&i>c&&(x=!0),x}function me(e,t=9){let a=0,l=[],r=ue(e),n=r.length>1,s=[];if(n){let e=fe(r);e.forEach(function(t,a){for(let a=0;a<e.length;a++){let l=e[a];if(t!=l){ge(t,l)&&s.push(a)}}})}return r.forEach((e,t)=>{l=[];let r=0,n=0,i=1,o=[];e.forEach(function(t,a){let[n,s]=[t.type,t.values],i=s.length;if(s.length){let p=(a>0?e[a-1]:e[0]).values,u=p.length,h={x:p[u-2],y:p[u-1]},y={x:s[i-2],y:s[i-1]};if("C"===n||"Q"===n){let e={x:s[0],y:s[1]};o="C"===n?[h,e,{x:s[2],y:s[3]},y]:[h,e,y];let t=Math.abs(function(e,t=!1){let a,[l,r,n,s]=[e[0],e[1],e[2],e[e.length-1]];if(e.length<3)return 0;3===e.length&&(r={x:1*e[0].x/3+2*e[1].x/3,y:1*e[0].y/3+2*e[1].y/3},n={x:1*e[2].x/3+2*e[1].x/3,y:1*e[2].y/3+2*e[1].y/3});return a=3*(l.x*(-2*r.y-n.y+3*s.y)+r.x*(2*l.y-n.y-s.y)+n.x*(l.y+r.y-2*s.y)+s.x*(-3*l.y+r.y+2*n.y))/20,t?Math.abs(a):a}(o));r+=t,l.push(h,y)}else if("A"===n){let e=V(h.x,h.y,t.values[0],t.values[1],t.values[2],t.values[3],t.values[4],y.x,y.y),{cx:a,cy:n,rx:s,ry:i,startAngle:o,endAngle:p,deltaAngle:u}=e,c=Math.abs(function(e,t,a,l){const r=Math.PI*e*t;let n=(l-a+2*Math.PI)%(2*Math.PI);if(e===t)return r*(n/(2*Math.PI));const s=a=>Math.atan2(e*Math.sin(a),t*Math.cos(a));return a=s(a),l=s(l),n=(l-a+2*Math.PI)%(2*Math.PI),r*(n/(2*Math.PI))}(s,i,o,p));c-=Math.abs(de([h,{x:a,y:n},y])),l.push(h,y),r+=c}else l.push(h,y)}});let p=de(l);-1!==s.indexOf(t)&&(i=-1),n=p<0&&r<0?(Math.abs(r)-Math.abs(p))*i:(Math.abs(r)+Math.abs(p))*i,a+=n}),a}function de(e,t=!1){let a=0,l=e.length;for(let t=0;l&&t<l;t++){a+=e[t].x*e[t===e.length-1?0:t+1].y*.5-e[t===e.length-1?0:t+1].x*e[t].y*.5}return t&&(a=Math.abs(a)),a}function ve(e,t=0){t=parseFloat(t);let a=e.length,l=t>1,r=!l&&!t,n="",s=l?"\n":r?"":" ",i=r?"":" ";n=`${e[0].type}${i}${e[0].values.join(" ")}${s}`;for(let t=1;t<a;t++){let a=e[t-1],l=e[t],{type:o,values:p}=l;if(!r||"A"!==o&&"a"!==o||(p=[p[0],p[1],p[2],`${p[3]}${p[4]}${p[5]}`,p[6]]),o=r&&a.type===l.type&&"m"!==l.type.toLowerCase()||r&&"M"===a.type&&"L"===l.type?" ":l.type,r){let e="",t=!1;for(let a=0,l=p.length;a<l;a++){let l=p[a],r=l.toString(),n=r.includes(".")&&Math.abs(l)<1;n&&t&&(r=r.replace(/^0\./,".")),!(a>0)||t&&n||(e+=" "),e+=r,t=n}n+=`${o}${i}${e}${s}`}else n+=`${o}${i}${p.join(" ")}${s}`}return r&&(n=n.replace(/ 0\./g," .").replace(/ -/g,"-").replace(/-0\./g,"-.").replace(/Z/g,"z")),n}function Me(e,t,a=0,l=1,r=!1){const n=(e,t,a,l,r)=>{let n=1-r;return{x:3*n*n*(t.x-e.x)+6*n*r*(a.x-t.x)+3*r*r*(l.x-a.x),y:3*n*n*(t.y-e.y)+6*n*r*(a.y-t.y)+3*r*r*(l.y-a.y)}};let s=[e,t],i=oe(e.p0,e.p)>oe(t.p0,t.p),o=JSON.parse(JSON.stringify(e)),p=JSON.parse(JSON.stringify(t)),u=G(o.p0,o.cp1,p.p,p.cp2,!1);if(!u)return s;if(i){let a={p0:{x:e.p.x,y:e.p.y},cp1:{x:e.cp2.x,y:e.cp2.y},cp2:{x:e.cp1.x,y:e.cp1.y},p:{x:e.p0.x,y:e.p0.y}};e={p0:{x:t.p.x,y:t.p.y},cp1:{x:t.cp2.x,y:t.cp2.y},cp2:{x:t.cp1.x,y:t.cp1.y},p:{x:t.p0.x,y:t.p0.y}},t=a}let h=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),y=(e,t)=>({x:e.x*t,y:e.y*t}),c=(e,t)=>e.x*t.x+e.y*t.y,x=t.p0,f=n(t.p0,t.cp1,t.cp2,t.p,0),g=c(h(e.p0,x),f)/c(f,f),m=H([t.p0,t.cp1,t.cp2,t.p],g),d=n(t.p0,t.cp1,t.cp2,t.p,g);g-=c(h(m,e.p0),d)/c(d,d);let v=H([t.p0,t.cp1,t.cp2,t.p],g),M=t.p,b=n(t.p0,t.cp1,t.cp2,t.p,g),A=n(t.p0,t.cp1,t.cp2,t.p,1),w=1-g,C=(k=v,P=y(b,w/3),{x:k.x+P.x,y:k.y+P.y});var k,P;let L=h(M,y(A,w/3)),E={p0:v,cp1:C,cp2:L,p:M,t0:g};i&&(E={p0:M,cp1:L,cp2:C,p:v,t0:g});let S=.5*(1-g),D=H([E.p0,E.cp1,E.cp2,E.p],S,!1,!0),T=D.cpts[2],I=G(D,T,E.p0,u,!1),F=G(D,T,E.p,u,!1),$=Z(E.p0,I,1.333),q=Z(E.p,F,1.333);if(G(o.p0,$,p.p,q,!0))return s;E.cp1=$,E.cp2=q;let j=oe(o.p0,E.p0)+oe(p.p,E.p);if(E.p0=o.p0,E.p=p.p,E.extreme=p.extreme,E.corner=p.corner,E.dimA=p.dimA,E.directionChange=p.directionChange,E.type="C",E.values=[E.cp1.x,E.cp1.y,E.cp2.x,E.cp2.y,E.p.x,E.p.y],j<a){let t=i?1+g:Math.abs(g),n=1+Math.abs(g);if(t=i?1+g:Math.abs(g)/n,oe(H([E.p0,E.cp1,E.cp2,E.p],t),e.p)>a*l)return s;let u=me([{type:"M",values:[o.p0.x,o.p0.y]},{type:"C",values:[o.cp1.x,o.cp1.y,o.cp2.x,o.cp2.y,o.p.x,o.p.y]},{type:"C",values:[p.cp1.x,p.cp1.y,p.cp2.x,p.cp2.y,p.p.x,p.p.y]}]),h=[{type:"M",values:[E.p0.x,E.p0.y]},{type:"C",values:[E.cp1.x,E.cp1.y,E.cp2.x,E.cp2.y,E.p.x,E.p.y]}],y=me(h),c=Math.abs(y/u-1);E.error=5*c*l,r&&ve(h),c<.05*l&&(s=[E])}return s}function be(e,{keepExtremes:t=!0,keepInflections:a=!0,keepCorners:l=!0,extrapolateDominant:r=!0,tolerance:n=1}={}){let s=[e[0]],i=e.length;for(let r=2;i&&r<=i;r++){let o=e[r-1],p=r<i?e[r]:null,u=p?.type||null,{type:h,values:y,p0:c,p:x,cp1:f=null,cp2:g=null,extreme:m=!1,directionChange:d=!1,corner:v=!1,dimA:M=0}=o;if("C"===h&&"C"===u)if(l&&v||t&&m)s.push(o);else{let u=Ae(o,p,{tolerance:n}),h=0;
2
- //!count simplification success or failure - just for debugging
3
- if(1===u.length){o=u[0];let p=1;h+=o.error;
4
- //!log.push(`success1: ${i} and ${i + 1}`)
5
- for(let s=r+1;h<n&&s<i;s++){let r=e[s];if("C"!==r.type||a&&o.directionChange||l&&o.corner||t&&o.extreme)break;let i=Ae(o,r,{tolerance:n});if(i.length>1)break;h+=.5*i[0].error,p++,
6
- //!log.push(`success2: ${i} and ${n}`)
7
- o=i[0]}s.push(o),r<i&&(r+=p)}else s.push(o)}else s.push(o)}return s}function Ae(e,t,{tolerance:a=1}={}){let l=[e,t],r=function(e,t){let a=ie(e.cp2,e.p);if(0===a)return 0;let l=ie(e.p,t.cp1);if(0===l)return 0;let r=ie(e.cp2,t.cp1);return a/r}(e,t);if(!r)return l;let n=ie(e.p0,e.p),s=ie(t.p0,t.p),i=.08*Math.max(0,Math.min(n,s))*a,o=function(e,t,a=0){let{p0:l,cp1:r}=e,{p:n,cp2:s}=t;return r={x:(r.x-(1-a)*l.x)/a,y:(r.y-(1-a)*l.y)/a},s={x:(s.x-a*n.x)/(1-a),y:(s.y-a*n.y)/(1-a)},{p0:l,cp1:r,cp2:s,p:n}}(e,t,r),p=H([o.p0,o.cp1,o.cp2,o.p],r),u=ie(e.p,p),h=0,y=0,c=!1,x=u;if(u<i){let a=.5*(1+r);if(h=ie(H([t.p0,t.cp1,t.cp2,t.p],.5),H([o.p0,o.cp1,o.cp2,o.p],a)),x+=h,h<i){let t=.5*r;y=ie(H([e.p0,e.cp1,e.cp2,e.p],.5),H([o.p0,o.cp1,o.cp2,o.p],t)),x+=y,x<i&&(c=!0)}}return c&&(o.p0=e.p0,o.p=t.p,o.dimA=ie(o.p0,o.p),o.type="C",o.extreme=t.extreme,o.directionChange=t.directionChange,o.corner=t.corner,o.values=[o.cp1.x,o.cp1.y,o.cp2.x,o.cp2.y,o.p.x,o.p.y],o.error=x/i,l=[o]),l}function we(e,{tolerance:t=1,debug:a=!1}={}){let l=!1,r={flat:!0,steepness:0},n=e[0],s=e[e.length-1],i=new Set([...e.map(e=>+e.x.toFixed(8))]),o=new Set([...e.map(e=>+e.y.toFixed(8))]);if(1===i.size||1===o.size)return!a||r;let p=se(n,s),u=p/1e3*t,h=de(e,!0);return h<u&&(l=!0),a&&(r.flat=l,r.steepness=h/p*10),a?r:l}function Ce(e){let t=[];for(let a=1,l=e.length;a<l;a++){let l=e[a],{type:r,values:n,p0:s=null,p:i=null,dimA:o=0}=l;n.length&&i&&s&&(o=o||ie(s,i),o&&t.push(o))}let a=t.sort(),l=Math.ceil(a.length/8);a=a.slice(0,l);let r=a.reduce((e,t)=>e+t,0)/l,n=r>112.5?0:Math.floor(75/r).toString().length;return Math.min(Math.max(0,n),8)}function ke(e=0,t=3){if(!t)return Math.round(e);let a=10**t;return Math.round(e*a)/a}function Pe(e,t=-1){if(t<0)return e;let a=e.length;for(let l=0;l<a;l++){let a=e[l].values,r=a.length;if(r)for(let n=0;n<r;n++)e[l].values[n]=ke(a[n],t)}return e}function Le(t=[],{detectExtremes:a=!0,detectCorners:l=!0,detectDirection:r=!0,detectSemiExtremes:n=!1,debug:s=!1,addSquareLength:i=!0,addArea:o=!0}={}){t=function(e,{addSquareLength:t=!0,addArea:a=!1,addArcParams:l=!1,addAverageDim:r=!0}={}){let n=e[0],s={x:n.values[0],y:n.values[1]},i=s,o=s;n.p0=i,n.p=o,n.idx=0,n.dimA=0;let p=e.length,u=[n];for(let l=1;l<p;l++){let r,n,p=e[l],{type:h,values:y}=p,c=y.length;if(o=c?{x:y[c-2],y:y[c-1]}:s,p.p0=i,p.p=o,p.dimA=ie(i,o),"M"===h&&(s=o),"Q"===h||"C"===h)r={x:y[0],y:y[1]},n="C"===h?{x:y[2],y:y[3]}:null,p.cp1=r,n&&(p.cp2=n);else if("A"===h){let{rx:e,ry:t,cx:a,cy:l,startAngle:r,endAngle:n,deltaAngle:s}=V(i.x,i.y,...y);p.cx=a,p.cy=l,p.rx=e,p.ry=t,p.xAxisRotation=y[2]/180*Math.PI,p.largeArc=y[3],p.sweep=y[4],p.startAngle=r,p.endAngle=n,p.deltaAngle=s}if("Z"===h&&s.x!==o.x&&s.y!==o.y&&(p.closePath=!0),t&&(p.squareDist=se(i,o)),a){let e=0;"C"===h&&(e=de([i,r,n,o],!1)),"Q"===h&&(e=de([i,r,o],!1)),p.cptArea=e}p.idx=l,i=o,u.push(p)}return u}(t,{addSquareLength:i,addArea:o});let p=[],u=xe(W(t)),{left:h,right:y,top:c,bottom:x,width:f,height:g}=u;t[0].corner=!1,t[0].extreme=!1,t[0].semiExtreme=!1,t[0].directionChange=!1,t[0].closePath=!1;let m=[t[0]],d=t.length;for(let a=2;d&&a<=d;a++){let l=t[a-1],{type:r,values:i,p0:o,p:p,cp1:u=null,cp2:f=null,squareDist:g=0,cptArea:d=0,dimA:v=0}=l,M=t[a]||null;l.corner=!1,l.extreme=!1,l.semiExtreme=!1,l.directionChange=!1,l.closePath=!1;let b="C"===r||"Q"===r?"C"===r?[o,u,f,p]:[o,u,p]:[o,p],A=.1*v,w=.01*A,C="Q"===r||"C"===r,k=M&&("Q"===M.type||"C"===M.type),P=!1;
1
+ function e(e,t,a="red",l="1%",r="1",n="",s=!0,i="",o=""){Array.isArray(t)&&(t={x:t[0],y:t[1]});let p=`<circle class="${o}" opacity="${r}" id="${i}" cx="${t.x}" cy="${t.y}" r="${l}" fill="${a}">\n <title>${n}</title></circle>`;if(!s)return p;e.insertAdjacentHTML("beforeend",p)}function t(e,t="",a="green",l="1%",r="1",n=!0){let s=`<path d="${t}" fill="none" stroke="${a}" stroke-width="${l}" stroke-opacity="${r}" /> `;if(!n)return s;e.insertAdjacentHTML("beforeend",s)}const{abs:a,acos:l,asin:r,atan:n,atan2:s,ceil:i,cos:o,exp:p,floor:h,log:u,hypot:c,max:y,min:x,pow:f,random:g,round:d,sin:m,sqrt:v,tan:b,PI:M}=Math,A=180/Math.PI,w="http://www.w3.org/2000/svg",{abs:C,acos:k,asin:S,atan:E,atan2:P,ceil:L,cos:D,exp:T,floor:I,log:$,max:F,min:q,pow:N,random:z,round:j,sin:B,sqrt:Q,tan:O,PI:R}=Math;function _(e,t,a=!1){let l=P(t.y-e.y,t.x-e.x);return a&&l<0&&(l+=2*Math.PI),l}function G(e,t,a,l=!1){let r=Math.atan2(t.y-e.y,t.x-e.x),n=Math.atan2(a.y-e.y,a.x-e.x),s=n-r;s=(e=>{let t=e%(2*Math.PI);return t>Math.PI?t-=2*Math.PI:t<=-Math.PI&&(t+=2*Math.PI),t})(s),l&&(s=2*Math.PI-Math.abs(s));let i=180/Math.PI;return{startAngle:r,endAngle:n,deltaAngle:s,startAngleDeg:r*i,endAngleDeg:n*i,deltaAngleDeg:s*i}}function U(e=null,t=null,a=null,l=null,r=!0,n=!1,s=!1){let i,o,p,h,u,c={};if(!(e&&t&&a&&l))return s&&console.warn("points missing"),!1;if(e.x===t.x&&e.y===t.y||a.x===l.x&&a.y===l.y)return!1;try{if(i=(l.y-a.y)*(t.x-e.x)-(l.x-a.x)*(t.y-e.y),0===i)return!1}catch{return s&&console.warn("!catch",e,t,"p3:",a,"p4:",l),!1}o=e.y-a.y,p=e.x-a.x,h=(l.x-a.x)*o-(l.y-a.y)*p,u=(t.x-e.x)*o-(t.y-e.y)*p,o=h/i,p=u/i,c={x:e.x+o*(t.x-e.x),y:e.y+o*(t.y-e.y)};let y=!1;return o>0&&o<1&&p>0&&p<1&&(y=!0),!r&&n&&(o>0&&p<0||o<0&&p>0)?(y=!1,!1):!(r&&!y)&&c}function V(e,t,a,l=!1){const r=(e,t,a)=>e>=t&&e<=a||e<=t&&e>=a;let n=!1;if((!l||!a.bottom)&&(a.left>e.x||a.top>e.y||a.bottom<e.y||a.right<e.x))return!1;let s=t.length;for(let a=s-1,l=0;l<s;a=l,l++){const s=t[a],i=t[l];if(e.x==s.x&&e.y==s.y||e.x==i.x&&e.y==i.y)return!0;if(s.y==i.y&&e.y==s.y&&r(e.x,s.x,i.x))return!0;if(r(e.y,s.y,i.y)){if(e.y==s.y&&i.y>=s.y||e.y==i.y&&s.y>=i.y)continue;const t=(s.x-e.x)*(i.y-e.y)-(i.x-e.x)*(s.y-e.y);if(0==t)return!0;s.y<i.y==t>0&&(n=!n)}}return!!n}function Z(e,t,a,l=!1){let r={x:(t.x-e.x)*a+e.x,y:(t.y-e.y)*a+e.y};return l&&(r.angle=_(e,t),r.angle<0&&(r.angle+=2*R)),r}function H(e,t=.5,a=!1,l=!1,r=!1){let n;return Array.isArray(e[0])&&(e=e.map(e=>({x:e[0],y:e[1]})),r=!0),n=e.length>2?((e,t,a=!1)=>{let r=4===e.length,n=e[0],s=e[1],i=r?e[2]:e[1],o=e[e.length-1],p={x:0,y:0};if(a||l){let e,a,h,u,c,y=n.x===s.x&&n.y===s.y,x=o.x===i.x&&o.y===i.y;0!==t||y?1!==t||x?(y&&(t+=1e-7),x&&(t-=1e-7),e=Z(n,s,t),r?(a=Z(s,i,t),h=Z(i,o,t),u=Z(e,a,t),c=Z(a,h,t),p=Z(u,c,t),p.angle=_(u,c),l&&(p.cpts=[a,h,u,c])):(a=Z(n,s,t),h=Z(s,o,t),p=Z(a,h,t),p.angle=_(a,h),l&&(p.cpts=[a,h]))):(p.x=o.x,p.y=o.y,p.angle=_(i,o)):(p.x=n.x,p.y=n.y,p.angle=_(n,s))}else{let e=1-t;p=r?{x:e**3*n.x+3*e**2*t*s.x+3*e*t**2*i.x+t**3*o.x,y:e**3*n.y+3*e**2*t*s.y+3*e*t**2*i.y+t**3*o.y}:{x:e*e*n.x+2*e*t*s.x+t**2*o.x,y:e*e*n.y+2*e*t*s.y+t**2*o.y}}return p})(e,t,a):Z(e[0],e[1],t,a),a&&n.angle<0&&(n.angle+=2*R),r?[n.x,n.y]:n}function W(e){let t=[],a={x:e[0].values[0],y:e[0].values[1]};return e.forEach(e=>{let{type:l,values:r}=e;if(r.length){let e=r.length>1?{x:r[r.length-2],y:r[r.length-1]}:"V"===l?{x:a.x,y:r[0]}:{x:r[0],y:a.y};t.push(e),a=e}}),t}function J(e,t,a,l,r,n,s,i,o){const p=(e,t,a,l)=>P(l-t,a-e);let h={cx:0,cy:0,rx:a=C(a),ry:l=C(l),startAngle:0,endAngle:0,deltaAngle:0,clockwise:s,xAxisRotation:r,largeArc:n,sweep:s};if(0==a||0==l)throw Error("rx and ry can not be 0");if(a===l){let a=Math.abs(i-e),l=Math.abs(o-t),r=a,n=Math.min(e,i),p=Math.min(t,o),u=.5*Math.PI;if(0===a&&l||0===l&&a)return r=0===a&&l?l/2:a/2,h.rx=r,h.ry=r,0===a&&l?(h.cx=e,h.cy=p+l/2,h.startAngle=t>o?u:-u,h.endAngle=t>o?-u:u,h.deltaAngle=s?Math.PI:-Math.PI):0===l&&a&&(h.cx=n+a/2,h.cy=t,h.startAngle=e>i?Math.PI:0,h.endAngle=e>i?-Math.PI:Math.PI,h.deltaAngle=s?Math.PI:-Math.PI),h}let u,c,y=a===l?0:r*R/180,x=y?Math.sin(y):0,f=y?Math.cos(y):1,g=(e-i)/2,d=(t-o)/2,m=(e+i)/2,v=(t+o)/2,b=y?f*g+x*d:g,M=y?f*d-x*g:d,A=b*b/(a*a)+M*M/(l*l);A>1&&(a*=Math.sqrt(A),l*=Math.sqrt(A),h.rx=a,h.ry=l);let w=a*l,k=a*M,S=l*b,E=k**2+S**2;if(!E)throw Error("start point can not be same as end point");let L=Math.sqrt(Math.abs((w*w-E)/E));n==s&&(L=-L);let D=L*k/l,T=-L*S/a;u=y?f*D-x*T+m:m+D,c=y?x*D+f*T+v:v+T,h.cy=c,h.cx=u;let I=p(u,c,e,t),$=p(u,c,i,o);!s&&$>I&&($-=2*Math.PI),s&&I>$&&($=$<=0?$+2*Math.PI:$);let F=$-I;return h.startAngle=I,h.endAngle=$,h.deltaAngle=F,h}function X(e,t,a,l=0,r=!1){return l?(l=r?l/180*Math.PI:l,{x:t+(e.x-t)*Math.cos(l)-(e.y-a)*Math.sin(l),y:a+(e.x-t)*Math.sin(l)+(e.y-a)*Math.cos(l)}):e}function Y(e,t,a,l,r,n=0,s=!0,i=!1){if(r=i?r*R/180:r,n=i?n*R/180:n,n=a!==l&&n!==2*R?n:0,s&&a!==l){let e=E(O(r=n?r-n:r)*(a/l));r=D(r)<0?e+R:e}let o=e+a*D(r),p=t+l*B(r),h={x:o,y:p};return n&&(h.x=e+(o-e)*D(n)-(p-t)*B(n),h.y=t+(o-e)*B(n)+(p-t)*D(n)),h}function K(e,t,a){if(t===a||e%R*.5==0)return e;let l=E(O(e)*(t/a));return l=D(e)<0?l+R:l,l}function ee(e=null,t=[]){e||(e=t[0],t=t.slice(1,t.length));let a=t.length,l=t[a-1],r=t[0],n=3===a?t[1]:r,s=Math.min(e.y,l.y),i=Math.min(e.x,l.x),o=Math.max(e.x,l.x),p=Math.max(e.y,l.y);return!(r.y>=s&&r.y<=p&&n.y>=s&&n.y<=p&&r.x>=i&&r.x<=o&&n.x>=i&&n.x<=o)}function te(e,{addExtremes:t=!0,addSemiExtremes:a=!1}={}){let l=4===e.length?function(e,t,a,l,{addExtremes:r=!0,addSemiExtremes:n=!1}={}){const s=e=>{const t=Math.PI/4,a=Math.cos(t),l=Math.sin(t);return{x:e.x*a-e.y*l,y:e.x*l+e.y*a}};n&&(e=s(e),t=s(t),a=s(a),l=s(l));let[i,o,p,h,u,c,y,x]=[e.x,e.y,t.x,t.y,a.x,a.y,l.x,l.y],f=Math.min(e.y,l.y),g=Math.min(e.x,l.x),d=Math.max(e.x,l.x),m=Math.max(e.y,l.y);if(t.y>=f&&t.y<=m&&a.y>=f&&a.y<=m&&t.x>=g&&t.x<=d&&a.x>=g&&a.x<=d)return[];let v,b,M,A,w,C,k,S,E=[];for(let e=0;e<2;++e)if(0==e?(b=6*i-12*p+6*u,v=-3*i+9*p-9*u+3*y,M=3*p-3*i):(b=6*o-12*h+6*c,v=-3*o+9*h-9*c+3*x,M=3*h-3*o),Math.abs(v)<1e-8){if(Math.abs(b)<1e-8)continue;A=-M/b,0<A&&A<1&&E.push(A)}else k=b*b-4*M*v,k<0?Math.abs(k)<1e-8&&(A=-b/(2*v),0<A&&A<1&&E.push(A)):(S=Math.sqrt(k),w=(-b+S)/(2*v),0<w&&w<1&&E.push(w),C=(-b-S)/(2*v),0<C&&C<1&&E.push(C));let P=E.length;for(;P--;)A=E[P];return E}(e[0],e[1],e[2],e[3],{addExtremes:t,addSemiExtremes:a}):function(e,t,a,{addExtremes:l=!0,addSemiExtremes:r=!1}={}){const n=e=>{const t=-Math.PI/4,a=Math.cos(t),l=Math.sin(t);return{x:e.x*a-e.y*l,y:e.x*l+e.y*a}};r&&(e=n(e),t=n(t),a=n(a));let s,i,o,p=Math.min(e.y,a.y),h=Math.min(e.x,a.x),u=Math.max(e.x,a.x),c=Math.max(e.y,a.y);if(t.y>=p&&t.y<=c&&t.x>=h&&t.x<=u)return[];let[y,x,f,g,d,m]=[e.x,e.y,t.x,t.y,a.x,a.y],v=[];for(let e=0;e<2;++e)s=0==e?y-2*f+d:x-2*g+m,i=0==e?-2*y+2*f:-2*x+2*g,Math.abs(s)>1e-12&&(o=-i/(2*s),o>0&&o<1&&v.push(o));return v}(e[0],e[1],e[2],{addExtremes:t,addSemiExtremes:a});return l}function ae(e,t){const a=(e,t,a,l,r,n)=>{var s=Math.cos(n),i=Math.sin(n),o=l*Math.cos(e),p=r*Math.sin(e);return{x:t+s*o-i*p,y:a+i*o+s*p}};let l,r,n,s,i,o=J(e.x,e.y,t[0],t[1],t[2],t[3],t[4],t[5],t[6]),{rx:p,ry:h,cx:u,cy:c,endAngle:y,deltaAngle:x}=o,f=t[2],g={x:t[5],y:t[6]},d=[g],m=f*Math.PI/180,v=Math.tan(m);i=Math.atan2(-h*v,p);let b=i,M=i+Math.PI,A=Math.atan2(h,p*v),w=A+Math.PI,C=[e.x,g.x],k=[e.y,g.y],S=Math.min(...C),E=Math.max(...C),P=Math.min(...k),L=Math.max(...k),D=a(y-.001*x,u,c,p,h,m),T=a(y-.999*x,u,c,p,h,m);return(D.x>E||T.x>E)&&(l=a(b,u,c,p,h,m),d.push(l)),(D.x<S||T.x<S)&&(r=a(M,u,c,p,h,m),d.push(r)),(D.y<P||T.y<P)&&(s=a(w,u,c,p,h,m),d.push(s)),(D.y>L||T.y>L)&&(n=a(A,u,c,p,h,m),d.push(n)),d}function le(e=[],t=[]){let a=e.length,l=4===a;t.length||(t=[0]);let r=t.length,n=[];for(let s=0;s<r;s++){let r=t[s],i=r?[]:e.slice(0);if(r)for(let t=0;t<a;t++){let a=e[t];i.push(X(a,0,0,r))}let o=l?re(...i):ne(...i);n.push(...o)}return n=[...new Set(n)].sort(),n}function re(e,t,a,l){if(!ee(e,[t,a,l]))return[];let r,n,s,i,o,p,h,u,[c,y,x,f,g,d,m,v]=[e.x,e.y,t.x,t.y,a.x,a.y,l.x,l.y],b=[],M=1e-8;for(let e=0;e<2;++e)if(0==e?(n=6*c-12*x+6*g,r=-3*c+9*x-9*g+3*m,s=3*x-3*c):(n=6*y-12*f+6*d,r=-3*y+9*f-9*d+3*v,s=3*f-3*y),Math.abs(r)<M){if(Math.abs(n)<M)continue;i=-s/n,i>0&&i<1&&b.push(i)}else h=n*n-4*s*r,h<0?Math.abs(h)<M&&(i=-n/(2*r),i>0&&i<1&&b.push(i)):(u=Math.sqrt(h),o=(-n+u)/(2*r),o>0&&o<1&&b.push(o),p=(-n-u)/(2*r),p>0&&p<1&&b.push(p));let A=b.length;for(;A--;)i=b[A];return[...new Set(b)].sort()}function ne(e,t,a){if(!ee(e,[t,a]))return[];let l,r,n,[s,i,o,p,h,u]=[e.x,e.y,t.x,t.y,a.x,a.y],c=[];for(let e=0;e<2;++e)l=0==e?s-2*o+h:i-2*p+u,r=0==e?-2*s+2*o:-2*i+2*p,Math.abs(l)>1e-12&&(n=-r/(2*l),n>0&&n<1&&c.push(n));return[...new Set(c)].sort()}function se(e,t=.001){let a=Math.PI/2,l=a/2;return!(Math.abs(e/a-Math.round(e/a))<t)&&Math.abs(e/l-Math.round(e/l))<t}function ie(e,t,a=!1){let l=a?t[0]-e[0]:t.x-e.x,r=a?t[1]-e[1]:t.y-e.y;return Q(l*l+r*r)}function oe(e,t){let a=t.x-e.x,l=t.y-e.y;return a*a+l*l}function pe(e,t){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)}function he(e,t){return.5*(Math.abs(t.x-e.x)+Math.abs(t.y-e.y))}function ue(e,t=48){if(!Array.isArray(e)||e.length<=t)return e;let a=e.length,l=a/t,r=[];for(let a=0;a<t;a++)r.push(e[Math.floor(a*l)]);let n=r.length;return r[n-1]!==e[a-1]&&(r[n-1]=e[a-1]),r}function ce(e,t){if(!e||!t)return{a:1,b:0,c:0,d:1,e:0,f:0};return e.getScreenCTM().inverse().multiply(t.getScreenCTM())}function ye(e){let t=[],a=[e[0]],l=e.length;for(let r=1;r<l;r++){let l=e[r];"M"!==l.type&&"m"!==l.type||(t.push(a),a=[]),a.push(l)}return a.length&&t.push(a),t}function xe(e,t){let a,l,r,n,s,i,o=[],p=[],h=e[0],u=e[1],c=e[e.length-2],y=e[e.length-1];return 4===e.length?(a=H([h,u],t),l=H([u,c],t),r=H([c,y],t),n=H([a,l],t),s=H([l,r],t),i=H([n,s],t),o.push({x:h.x,y:h.y},{x:a.x,y:a.y},{x:n.x,y:n.y},{x:i.x,y:i.y}),p.push({x:i.x,y:i.y},{x:s.x,y:s.y},{x:r.x,y:r.y},{x:y.x,y:y.y})):3===e.length?(l=H([h,u],t),r=H([u,y],t),i=H([l,r],t),o.push({x:h.x,y:h.y},{x:l.x,y:l.y},{x:i.x,y:i.y}),p.push({x:i.x,y:i.y},{x:r.x,y:r.y},{x:y.x,y:y.y})):2===e.length&&(l=H([h,y],t),o.push({x:h.x,y:h.y},{x:l.x,y:l.y}),p.push({x:l.x,y:l.y},{x:y.x,y:y.y})),[o,p]}function fe(e,t,{tMin:a=0,tMax:l=1,addExtremes:r=!0,addSemiExtremes:n=!1}={}){let s=[],i=6===t.length?"C":"Q",o={x:t[0],y:t[1]},p="C"===i?{x:t[2],y:t[3]}:o,h={x:t[4],y:t[5]},u=0;let c="C"===i?[e,o,p,h]:[e,o,h],y=r?te(c,{addExtremes:r,addSemiExtremes:!1}):[],x=n?te(c,{addExtremes:r,addSemiExtremes:n}):[],f=Array.from(new Set([...y,...x])).sort();if(f=f.filter(e=>e>0&&e<1),f.length){let a=function(e,t,a,l=!0){let r=[];if(!a.length)return!1;let n,s,i,o=t.length,p={x:t[o-2],y:t[o-1]};2===t.length?i=[e,p]:4===t.length?(n={x:t[0],y:t[1]},i=[e,n,p]):6===t.length&&(n={x:t[0],y:t[1]},s={x:t[2],y:t[3]},i=[e,n,s,p]);if(a.length)if(1===a.length){let e=xe(i,a[0]),t=e[0],l=e[1];r.push(t,l)}else{let e=a[0],t=xe(i,e),l=t[0];r.push(l),i=t[1];for(let t=1;t<a.length;t++){e=a[t-1];let l=xe(i,(a[t]-e)/(1-e));r.push(l[0]),t===a.length-1&&r.push(l[l.length-1]),i=l[1]}}if(l){let e,t,a=[];return r.forEach(l=>{e={type:"",values:[]},l.shift(),t=l.map(e=>Object.values(e)).flat(),e.values=t,3===l.length?e.type="C":2===l.length?e.type="Q":1===l.length&&(e.type="L"),a.push(e)}),a}return r}(e,t,f);s.push(...a),u+=a.length}else s.push({type:i,values:t});return{pathData:s,count:u}}function ge(e,{tMin:t=0,tMax:a=1,addExtremes:l=!0,addSemiExtremes:r=!1}={}){let n=[e[0]],s={x:e[0].values[0],y:e[0].values[1]},i={x:e[0].values[0],y:e[0].values[1]},o=e.length;for(let p=1;o&&p<o;p++){let o=e[p],{type:h,values:u}=o,c=u.slice(-2);if(c[0],c[1],"C"!==h&&"Q"!==h)n.push(o);else if((l||r)&&("C"===h||"Q"===h)){let e=fe(s,u,{tMin:t,tMax:a,addExtremes:l,addSemiExtremes:r}).pathData;n.push(...e)}s={x:c[0],y:c[1]},"z"===h.toLowerCase()?s=i:"M"===h&&(i={x:c[0],y:c[1]})}return n}function de(e){let t=[];for(let a=1,l=e.length;a<l;a++){let l=e[a],{type:r,values:n,p0:s=null,p:i=null,dimA:o=0}=l;n.length&&i&&s&&(o=o||pe(s,i),o&&t.push(o))}let a=t.sort(),l=Math.ceil(a.length/8);a=a.slice(0,l);let r=a.reduce((e,t)=>e+t,0)/l,n=r>112.5?0:Math.floor(75/r).toString().length;return Math.min(Math.max(0,n),8)}function me(e=0,t=3){if(!t)return Math.round(e);let a=10**t;return Math.round(e*a)/a}function ve(e,t=10){let a=8;a=e>t?0:e>5?1:Math.ceil(t/e).toString().length;let l=10**a;return Math.round(e*l)/l}function be(e,t=-1){if(t<0)return e;let a=e.length,l=t;for(let t=0;t<a;t++){let a=e[t],{values:r}=a,n=r.length;if(n)for(let a=0;a<n;a++)e[t].values[a]=me(r[a],l)}return e}const Me=["x","cx","rx","dx","width","translateX"],Ae=["y","cy","ry","dy","height","translateY"],we=["path","polygon","polyline","line","rect","circle","ellipse"],Ce=["textPath","text","tspan"],ke=["stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-linecap","stroke-dasharray","stroke-dashoffset","stroke-miterlimit","stroke-opacity"],Se={atts:{id:"*",class:"*",viewBox:["symbol","svg"],preserveAspectRatio:["symbol","svg"],width:["svg","rect","use","image"],height:["svg","rect","use","image"],d:["path"],points:["polygon","polyline"],x:["image","rect","text","textPath","tspan","use","mask"],y:["image","rect","text","textPath","tspan","use","mask"],x1:["line","linearGradient"],x2:["line","linearGradient"],y1:["line","linearGradient"],y2:["line","linearGradient"],r:["circle","radialGradient"],rx:["rect","ellipse"],ry:["rect","ellipse"],cx:["circle","ellipse","radialGradient"],cy:["circle","ellipse","radialGradient"],refX:["symbol","markers"],refY:["symbol","markers"],transform:["svg","g","use",...we,...Ce],"transform-origin":["svg","g","use",...we,...Ce],fill:["svg","g","use",...we,...Ce,"animate","animateMotion"],"fill-opacity":["svg","g","use",...we,...Ce],"fill-rule":["svg","g","path","polygon","text","textPath"],opacity:["svg","g","use",...we,...Ce],stroke:["svg","g","use",...we,...Ce],"stroke-width":["svg","g","use",...we,...Ce,"mask"],"stroke-opacity":["svg","g","use",...we,...Ce,"mask"],"stroke-miterlimit":["svg","g","use",...we,...Ce,"mask"],"stroke-linejoin":["svg","g","use",...we,...Ce,"mask"],"stroke-linecap":["svg","g","use",...we,...Ce,"mask"],"stroke-dashoffset":["svg","g","use",...we,...Ce,"mask"],"stroke-dasharray":["svg","g","use",...we,...Ce,"mask"],"clip-path":["svg","g","use",...we,...Ce],"clip-rule":["path","polygon"],clipPathUnits:["clipPath"],mask:["svg","g","use",...we,...Ce],maskContentUnits:["mask"],maskUnits:["mask"],"font-family":["svg","g",...Ce],"font-size":["svg","g",...Ce],"font-style":["svg","g",...Ce],"font-weight":["svg","g",...Ce],"font-stretch":["svg","g",...Ce],"dominant-baseline":[...Ce],lengthAdjust:[...Ce],"text-anchor":["text"],textLength:["text","textPath","tspan"],dx:["text","tspan"],dy:["text","tspan"],method:["textPath"],spacing:["textPath"],startOffset:["textPath"],rotate:["text","tspan","animateMotion"],side:["textPath"],"white-space":["svg","g",...Ce],color:["svg","g",...Ce],playbackorder:["svg"],timelinebegin:["svg"],dur:["animate","animateTransform","animateMotion"],end:["animate","animateTransform","animateMotion"],from:["animate","animateTransform","animateMotion"],to:["animate","animateTransform","animateMotion"],type:["animateTransform"],values:["animate","animateTransform","animateMotion"],accumulate:["animate","animateTransform","animateMotion"],additive:["animate","animateTransform","animateMotion"],attributeName:["animate","animateTransform"],begin:["animate","animateTransform","animateMotion"],by:["animate","animateTransform","animateMotion"],calcMode:["animate","animateTransform","animateMotion"],keyPoints:["animateMotion"],keySplines:["animate","animateTransform","animateMotion"],keyTimes:["animate","animateTransform","animateMotion"],max:["animate","animateTransform","animateMotion"],min:["animate","animateTransform","animateMotion"],origin:["animateMotion"],repeatCount:["animate","animateTransform","animateMotion"],repeatDur:["animate","animateTransform","animateMotion"],restart:["animate","animateTransform","animateMotion"],gradientUnits:["linearGradient","radialGradient"],gradientTransform:["linearGradient","radialGradient"],fr:["radialGradient"],fx:["radialGradient"],fy:["radialGradient"],offset:["stop"],"stop-color":["stop"],"stop-opacity":["stop"],spreadMethod:["linearGradient","radialGradient"],href:["pattern","textPath","linearGradient","radialGradient","use","animate","animateTransform","animateMotion","image"],pathLength:[...we]},defaults:{transform:["none","matrix(1, 0, 0, 1, 0, 0)"],"transform-origin":["0px, 0px","0 0"],rx:["0","0px"],ry:["0","0px"],x:["0","0px"],y:["0","0px"],fill:["black","rgb(0, 0, 0)","rgba(0, 0, 0, 0)","#000","#000000"],color:["black","rgb(0, 0, 0)","rgba(0, 0, 0, 0)","#000","#000000"],stroke:["none"],"stroke-width":["1","1px"],opacity:["1"],"fill-opacity":["1"],"stroke-opacity":["1"],"stroke-linecap":["butt"],"stroke-miterlimit":["4"],"stroke-linejoin":["miter"],"stroke-dasharray":["none"],"stroke-dashoffset":["0","0px","none"],pathLength:["none"],"font-family":["serif"],"font-weight":["normal","400"],"font-stretch":["normal"],"font-width":["normal"],"letter-spacing":["auto","normal","0"],lengthAdjust:["spacing"],"text-anchor":["start"],"dominant-baseline":["auto"],spacing:["auto"],"white-space":["normal"],"stop-opacity":["1"],gradientUnits:["objectBoundingBox"],patternUnits:["objectBoundingBox"],"clip-path":["none"],"clip-rule":["nonzero"],"fill-rule":["nonzero"],clipPathUnits:["userSpaceOnUse"],mask:["none"],maskUnits:["objectBoundingBox"]}};function Ee(e=null,{unit:t=null,width:a=0,height:l=0,decimals:r=-1,isHorizontal:n=!1,isVertical:s=!1,autoRoundValues:i=!1,dpi:o=96,fontSize:p=16,normalizedDiagonal:h=!1}={}){if(h=a!==l&&h,!e)return e;let u=e.split(/,| /).length>1,c=e.includes("("),y=function(e=""){return!isNaN(e)||!isNaN(parseFloat(e))}(e);if(!y||u||c)return e;t=t||function(e){if(!e||!isNaN(e))return"";e=e.replace(/\+|\-/g,"");let t=e.match(/[^\d|.]+/g)[0];return t}(e);let x=parseFloat(e),f=1,g=Math.sqrt(a*a+l*l)/1.4142135623730951;if(!t)return x;switch(t){case"%":f=a&&n?a/100:l&&s?l/100:h?g/100:1;break;case"rad":f=A;break;case"turn":f=360;break;case"in":f=o;break;case"pt":f=1/72*o;break;case"cm":f=1/2.54*o;break;case"mm":f=1/2.54*o/10;break;case"em":case"rem":f=p;break;default:f=1}let d=x*f;return i?d=ve(d):r>-1&&(d=+d.toFixed(r)),d}function Pe(e,{x:t=0,y:a=0,width:l=0,height:r=0}={}){let n=[...e.attributes],s={};return n.forEach(e=>{let n=Ee(e.nodeValue,{x:t,y:a,width:l,height:r});s[e.name]=n}),s}function Le(e,t=-1){let a=e.map(e=>e.x),l=e.map(e=>e.y),r=Math.min(...a),n=Math.max(...a),s=Math.min(...l),i=Math.max(...l),o={x:r,left:r,right:n,y:s,top:s,bottom:i,width:n-r,height:i-s};if(t>-1)for(let e in o)o[e]=+o[e].toFixed(t);return o}function De(e){let t=[];return e.forEach(e=>{let a=function(e){let t=Ie(e),a=Le(t);return a}(e);t.push(a)}),t}function Te(e,t){let[a,l,r,n,s,i]=[e.x,e.y,e.width,e.height,e.x+e.width,e.y+e.height],[o,p,h,u,c,y]=[t.x,t.y,t.width,t.height,t.x+t.width,t.y+t.height],x=!1;return r*n!=h*u&&r*n>h*u&&a<o&&s>c&&l<p&&i>y&&(x=!0),x}function Ie(e){let t=[];for(let a=0;a<e.length;a++){let l=e[a],r=a>0?e[a-1]:e[a],{type:n,values:s}=l,i={x:r.values[r.values.length-2],y:r.values[r.values.length-1]},o=s.length?{x:s[s.length-2],y:s[s.length-1]}:"",p=s.length?{x:s[0],y:s[1]}:"";switch(n){case"A":if("function"!=typeof arcToBezier){let e=ie(i,o)/2,a=Z(i,o,.5),l=Y(a.x,a.y,e,e,0),r=Y(a.x,a.y,e,e,Math.PI);t.push(l,r,o);break}arcToBezier(i,s).forEach(e=>{let a=e.values,l={x:a[0],y:a[1]},r={x:a[2],y:a[3]},n={x:a[4],y:a[5]};t.push(l,r,n)});break;case"C":let e={x:s[2],y:s[3]};t.push(p,e);break;case"Q":t.push(p)}"z"!==n.toLowerCase()&&t.push(o)}return t}function $e(e,t=9){let a=0,l=[],r=ye(e),n=r.length>1,s=[];if(n){let e=De(r);e.forEach(function(t,a){for(let a=0;a<e.length;a++){let l=e[a];if(t!=l){Te(t,l)&&s.push(a)}}})}return r.forEach((e,t)=>{l=[];let r=0,n=0,i=1,o=[];e.forEach(function(t,a){let[n,s]=[t.type,t.values],i=s.length;if(s.length){let p=(a>0?e[a-1]:e[0]).values,h=p.length,u={x:p[h-2],y:p[h-1]},c={x:s[i-2],y:s[i-1]};if("C"===n||"Q"===n){let e={x:s[0],y:s[1]};o="C"===n?[u,e,{x:s[2],y:s[3]},c]:[u,e,c];let t=Math.abs(function(e,t=!1){let a,[l,r,n,s]=[e[0],e[1],e[2],e[e.length-1]];if(e.length<3)return 0;3===e.length&&(r={x:1*e[0].x/3+2*e[1].x/3,y:1*e[0].y/3+2*e[1].y/3},n={x:1*e[2].x/3+2*e[1].x/3,y:1*e[2].y/3+2*e[1].y/3});return a=3*(l.x*(-2*r.y-n.y+3*s.y)+r.x*(2*l.y-n.y-s.y)+n.x*(l.y+r.y-2*s.y)+s.x*(-3*l.y+r.y+2*n.y))/20,t?Math.abs(a):a}(o));r+=t,l.push(u,c)}else if("A"===n){let e=J(u.x,u.y,t.values[0],t.values[1],t.values[2],t.values[3],t.values[4],c.x,c.y),{cx:a,cy:n,rx:s,ry:i,startAngle:o,endAngle:p,deltaAngle:h}=e,y=Math.abs(function(e,t,a,l){const r=Math.PI*e*t;let n=(l-a+2*Math.PI)%(2*Math.PI);if(e===t)return r*(n/(2*Math.PI));const s=a=>Math.atan2(e*Math.sin(a),t*Math.cos(a));return a=s(a),l=s(l),n=(l-a+2*Math.PI)%(2*Math.PI),r*(n/(2*Math.PI))}(s,i,o,p));y-=Math.abs(Fe([u,{x:a,y:n},c])),l.push(u,c),r+=y}else l.push(u,c)}});let p=Fe(l);-1!==s.indexOf(t)&&(i=-1),n=p<0&&r<0?(Math.abs(r)-Math.abs(p))*i:(Math.abs(r)+Math.abs(p))*i,a+=n}),a}function Fe(e,t=!1){let a=0,l=e.length;for(let t=0;l&&t<l;t++){a+=e[t].x*e[t===e.length-1?0:t+1].y*.5-e[t===e.length-1?0:t+1].x*e[t].y*.5}return t&&(a=Math.abs(a)),a}function qe(e,t=0){t=parseFloat(t);let a=e.length,l=t>1,r=!l&&!t,n="",s=e[0].values.join(" "),i=l?"\n":r?"":" ",o=r?"":" ";n=`${e[0].type}${o}${s}${i}`;for(let t=1;t<a;t++){let a=e[t-1],l=e[t],{type:p,values:h}=l;if(s="",!r||"A"!==p&&"a"!==p||(h=[h[0],h[1],h[2],`${h[3]}${h[4]}${h[5]}`,h[6]]),p=r&&a.type===l.type&&"m"!==l.type.toLowerCase()||r&&"M"===a.type&&"L"===l.type?" ":l.type,r){let e=!1;for(let t=0,a=h.length;t<a;t++){let a=h[t],l=a.toString(),r=l.includes(".")&&Math.abs(a)<1;r&&e&&(l=l.replace(/^0\./,".")),!(t>0)||e&&r||(s+=" "),s+=l,e=r}n+=`${p}${o}${s}${i}`}else n+=`${p}${o}${h.join(" ")}${i}`}return r&&(n=n.replace(/[A-Za-z]0(?=\.)/g,e=>e[0]).replace(/ 0\./g," .").replace(/ -/g,"-").replace(/-0\./g,"-.").replace(/Z/g,"z")),n}function Ne(e,t,a=0,l=1,r=!1){const n=(e,t,a,l,r)=>{let n=1-r;return{x:3*n*n*(t.x-e.x)+6*n*r*(a.x-t.x)+3*r*r*(l.x-a.x),y:3*n*n*(t.y-e.y)+6*n*r*(a.y-t.y)+3*r*r*(l.y-a.y)}};let s=[e,t],i=he(e.p0,e.p)>he(t.p0,t.p),o=JSON.parse(JSON.stringify(e)),p=JSON.parse(JSON.stringify(t)),h=U(o.p0,o.cp1,p.p,p.cp2,!1);if(!h)return s;if(i){let a={p0:{x:e.p.x,y:e.p.y},cp1:{x:e.cp2.x,y:e.cp2.y},cp2:{x:e.cp1.x,y:e.cp1.y},p:{x:e.p0.x,y:e.p0.y}};e={p0:{x:t.p.x,y:t.p.y},cp1:{x:t.cp2.x,y:t.cp2.y},cp2:{x:t.cp1.x,y:t.cp1.y},p:{x:t.p0.x,y:t.p0.y}},t=a}let u=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),c=(e,t)=>({x:e.x*t,y:e.y*t}),y=(e,t)=>e.x*t.x+e.y*t.y,x=t.p0,f=n(t.p0,t.cp1,t.cp2,t.p,0),g=y(u(e.p0,x),f)/y(f,f),d=H([t.p0,t.cp1,t.cp2,t.p],g),m=n(t.p0,t.cp1,t.cp2,t.p,g);g-=y(u(d,e.p0),m)/y(m,m);let v=H([t.p0,t.cp1,t.cp2,t.p],g),b=t.p,M=n(t.p0,t.cp1,t.cp2,t.p,g),A=n(t.p0,t.cp1,t.cp2,t.p,1),w=1-g,C=(k=v,S=c(M,w/3),{x:k.x+S.x,y:k.y+S.y});var k,S;let E=u(b,c(A,w/3)),P={p0:v,cp1:C,cp2:E,p:b,t0:g};i&&(P={p0:b,cp1:E,cp2:C,p:v,t0:g});let L=.5*(1-g),D=H([P.p0,P.cp1,P.cp2,P.p],L,!1,!0),T=D.cpts[2],I=U(D,T,P.p0,h,!1),$=U(D,T,P.p,h,!1),F=Z(P.p0,I,1.333),q=Z(P.p,$,1.333);if(U(o.p0,F,p.p,q,!0))return s;P.cp1=F,P.cp2=q;let N=he(o.p0,P.p0)+he(p.p,P.p);if(P.p0=o.p0,P.p=p.p,P.extreme=p.extreme,P.corner=p.corner,P.dimA=p.dimA,P.directionChange=p.directionChange,P.type="C",P.values=[P.cp1.x,P.cp1.y,P.cp2.x,P.cp2.y,P.p.x,P.p.y],N<a){let t=i?1+g:Math.abs(g),n=1+Math.abs(g);if(t=i?1+g:Math.abs(g)/n,he(H([P.p0,P.cp1,P.cp2,P.p],t),e.p)>a*l)return s;let h=$e([{type:"M",values:[o.p0.x,o.p0.y]},{type:"C",values:[o.cp1.x,o.cp1.y,o.cp2.x,o.cp2.y,o.p.x,o.p.y]},{type:"C",values:[p.cp1.x,p.cp1.y,p.cp2.x,p.cp2.y,p.p.x,p.p.y]}]),u=[{type:"M",values:[P.p0.x,P.p0.y]},{type:"C",values:[P.cp1.x,P.cp1.y,P.cp2.x,P.cp2.y,P.p.x,P.p.y]}],c=$e(u),y=Math.abs(c/h-1);P.error=5*y*l,r&&qe(u),y<.05*l&&(s=[P])}return s}function ze(e,{keepExtremes:t=!0,keepInflections:a=!0,keepCorners:l=!0,extrapolateDominant:r=!0,tolerance:n=1}={}){let s=[e[0]],i=e.length;for(let r=2;i&&r<=i;r++){let o=e[r-1],p=r<i?e[r]:null,h=p?.type||null,{type:u,values:c,p0:y,p:x,cp1:f=null,cp2:g=null,extreme:d=!1,directionChange:m=!1,corner:v=!1,dimA:b=0}=o;if("C"===u&&"C"===h)if(l&&v||t&&d)s.push(o);else{let h=je(o,p,{tolerance:n}),u=0;if(1===h.length){o=h[0];let p=1;u+=o.error;for(let s=r+1;u<n&&s<i;s++){let r=e[s];if("C"!==r.type||a&&o.directionChange||l&&o.corner||t&&o.extreme)break;let i=je(o,r,{tolerance:n});if(i.length>1)break;u+=.5*i[0].error,p++,o=i[0]}s.push(o),r<i&&(r+=p)}else s.push(o)}else s.push(o)}return s}function je(e,t,{tolerance:a=1}={}){let l=[e,t],r=function(e,t){let a=pe(e.cp2,e.p);if(0===a)return 0;let l=pe(e.p,t.cp1);if(0===l)return 0;let r=pe(e.cp2,t.cp1);return a/r}(e,t);if(!r)return l;let n=pe(e.p0,e.p),s=pe(t.p0,t.p),i=.08*Math.max(0,Math.min(n,s))*a,o=function(e,t,a=0){let{p0:l,cp1:r}=e,{p:n,cp2:s}=t;return r={x:(r.x-(1-a)*l.x)/a,y:(r.y-(1-a)*l.y)/a},s={x:(s.x-a*n.x)/(1-a),y:(s.y-a*n.y)/(1-a)},{p0:l,cp1:r,cp2:s,p:n}}(e,t,r),p=H([o.p0,o.cp1,o.cp2,o.p],r),h=pe(e.p,p),u=0,c=0,y=!1,x=h;if(h<i){let a=.5*(1+r);if(u=pe(H([t.p0,t.cp1,t.cp2,t.p],.5),H([o.p0,o.cp1,o.cp2,o.p],a)),x+=u,u<i){let t=.5*r;c=pe(H([e.p0,e.cp1,e.cp2,e.p],.5),H([o.p0,o.cp1,o.cp2,o.p],t)),x+=c,x<i&&(y=!0)}}return y&&(o.p0=e.p0,o.p=t.p,o.dimA=pe(o.p0,o.p),o.type="C",o.extreme=t.extreme,o.directionChange=t.directionChange,o.corner=t.corner,o.values=[o.cp1.x,o.cp1.y,o.cp2.x,o.cp2.y,o.p.x,o.p.y],o.error=x/i,l=[o]),l}function Be(e,{tolerance:t=1,debug:a=!1}={}){let l=!1,r={flat:!0,steepness:0},n=e[0],s=e[e.length-1],i=new Set([...e.map(e=>+e.x.toFixed(8))]),o=new Set([...e.map(e=>+e.y.toFixed(8))]);if(1===i.size||1===o.size)return!a||r;let p=oe(n,s),h=p/1e3*t,u=Fe(e,!0);return u<h&&(l=!0),a&&(r.flat=l,r.steepness=u/p*10),a?r:l}function Qe(t=[],{detectExtremes:a=!0,detectCorners:l=!0,detectDirection:r=!0,detectSemiExtremes:n=!1,debug:s=!1,addSquareLength:i=!0,addArea:o=!0}={}){let p=[],h=Le(W(t=Oe(t,{addSquareLength:i,addArea:o}))),{left:u,right:c,top:y,bottom:x,width:f,height:g}=h;t[0].corner=!1,t[0].extreme=!1,t[0].semiExtreme=!1,t[0].directionChange=!1,t[0].closePath=!1;let d=[t[0]],m=t.length;for(let a=2;m&&a<=m;a++){let l=t[a-1],{type:r,values:i,p0:o,p:p,cp1:h=null,cp2:f=null,squareDist:g=0,cptArea:m=0,dimA:v=0}=l,b=t[a]||null;l.corner=!1,l.extreme=!1,l.semiExtreme=!1,l.directionChange=!1,l.closePath=!1;let M="C"===r||"Q"===r?"C"===r?[o,h,f,p]:[o,h,p]:[o,p],A=.1*v,w=.01*A,C="Q"===r||"C"===r,k=b&&("Q"===b.type||"C"===b.type),S=!1;
8
2
  //!isFlat &&
9
- if(C){let e="C"===r?Math.abs(l.cp2.x-l.p.x):Math.abs(l.cp1.x-l.p.x),t="C"===r?Math.abs(l.cp2.y-l.p.y):Math.abs(l.cp1.y-l.p.y);if(((0===t||t<w)&&e>0||(0===e||e<w)&&t>0)&&(P=!0),p.x!==h&&p.y!==c&&p.x!==y&&p.y!==x||(P=!0),!P){if(_(null,b)){let e=te(b);e.length&&e[0]>.2&&(P=!0)}}}if(P&&(l.extreme=!0),C&&k){if(n&&!l.extreme){let e=Math.abs(p.x-f.x),t=Math.abs(p.y-f.y),a=!1;if(e&&t&&e>A||t>A){let e=O(f,p),t=O(p,M.cp1);a=re(Math.abs(e+t)/2)}a&&(l.semiExtreme=!0)}if((l.cptArea<0&&M.cptArea>0||l.cptArea>0&&M.cptArea<0)&&(l.directionChange=!0),!l.extreme){let e=f||u,t=M.cp1,a=de([e,p,t],!1),r=.01*se(e,t),n=Math.abs(a)<r,s=a<0&&l.cptArea>0||a>0&&l.cptArea<0;!n&&s&&(l.corner=!0)}}s&&(l.directionChange&&e(markers,l.p,"orange","1.5%","0.5"),l.corner&&e(markers,l.p,"magenta","1.5%","0.5"),l.extreme&&e(markers,l.p,"cyan","1%","0.5")),m.push(l)}return p={pathData:m,bb:u,dimA:(f+g)/2},p}function Ee(e={},t={},a={},l={},r=1){let n=Z(e,t,1.5),s=Z(l,a,1.5),i=.01*ie(e,l)*r,o=ie(n,s),p=null,u={type:"C",values:[t.x,t.y,a.x,a.y,l.x,l.y]};return o<i&&(p=G(e,t,l,a,!1),p&&(u.type="Q",u.values=[p.x,p.y,l.x,l.y],u.p0=e,u.cp1=p,u.cp2=null,u.p=l)),u}function Se(e,{toShorthands:t=!0,toLonghands:a=!1,toRelative:l=!0,toAbsolute:r=!1,decimals:n=3,arcToCubic:s=!1,quadraticToCubic:i=!1,hasRelatives:o=!0,hasShorthands:p=!0,hasQuadratics:u=!0,hasArcs:h=!0,testTypes:y=!1}={}){if(y){let t=Array.from(new Set(e.map(e=>e.type))).join("");/[lcqamts]/gi.test(t),u=/[qt]/gi.test(t),h=/[a]/gi.test(t),p=/[vhst]/gi.test(t),isPoly=/[mlz]/gi.test(t)}return l=!r&&l,t=!a&&t,u&&i&&(e=Te(e)),h&&s&&(e=De(e)),t&&(e=function(e,t=-1,a=!1){let l;if(a){let t=e.map(e=>e.type).join("");l=/[astvqmhlc]/g.test(t)}e=a&&l?Fe(e):e;let r=e.length,n=new Array(r),s=e[0];n[0]=s;let i={x:e[0].values[0],y:e[0].values[1]},o=i;for(let t=1;t<r;t++){let a=e[t];s=a;let{type:l,values:r}=a,p=r.length,u=[r[p-2],r[p-1]],h=e[t-1];o={x:u[0],y:u[1]};let y=Math.abs(o.x-i.x),c=Math.abs(o.y-i.y),x=.01*ie(i,o),f=!1,g=!1,m=!1;if("C"===l&&"C"===h.type||"Q"===l&&"Q"===h.type){let e="C"===h.type?{x:h.values[2],y:h.values[3]}:{x:h.values[0],y:h.values[1]},t={x:r[0],y:r[1]},a=i.x-e.x,l=i.y-e.y;x=.025*ie(e,t),f=ie({x:e.x+2*a,y:e.y+2*l},t)<x}else"L"===l&&(g=0===c||c<x,m=0===y||y<x,f=m||g);switch(l){case"L":g&&(s={type:"H",values:[r[0]]}),m&&(s={type:"V",values:[r[1]]});break;case"Q":f&&(s={type:"T",values:[o.x,o.y]});break;case"C":f&&(s={type:"S",values:[r[2],r[3],o.x,o.y]});break;default:s={type:l,values:r}}i=o,n[t]=s}return n}(e)),p&&a&&(e=qe(e)),r&&(e=$e(e)),n>-1&&l&&(e=Pe(e,n)),l&&(e=function(e,t=-1){return Fe(e,!0,t)}(e)),n>-1&&(e=Pe(e,n)),e}function De(e,{arcAccuracy:t=1}={}){let a=[e[0]];for(let l=1,r=e.length;l<r;l++){let r=e[l],n=e[l-1].values,s=n.length,i={x:n[s-2],y:n[s-1]};if("A"===r.type){ze(i,r.values,t).forEach(e=>{a.push(e)})}else a.push(r)}return a}function Te(e){let t=[e[0]];for(let a=1,l=e.length;a<l;a++){let l=e[a],r=e[a-1].values,n=r.length,s={x:r[n-2],y:r[n-1]};"Q"===l.type?t.push(Ie(s,l.values)):t.push(l)}return t}function Ie(e,t){Array.isArray(e)&&(e={x:e[0],y:e[1]});let a={x:e.x+2/3*(t[0]-e.x),y:e.y+2/3*(t[1]-e.y)},l={x:t[2]+2/3*(t[0]-t[2]),y:t[3]+2/3*(t[1]-t[3])};return{type:"C",values:[a.x,a.y,l.x,l.y,t[2],t[3]]}}function Fe(e,t=!1,a=-1){a>=0&&(e[0].values=e[0].values.map(e=>+e.toFixed(a)));let l=e.length,r=e[0].values,n=r[0],s=r[1],i=n,o=s;for(let r=1;r<l;r++){let l=e[r],{type:p,values:u}=l,h=u.length,y=p.toLowerCase(),c=p.toUpperCase(),x=t?y:c;if(p!==x)switch(l.type=x,y){case"a":u[5]=t?u[5]-n:u[5]+n,u[6]=t?u[6]-s:u[6]+s;break;case"v":u[0]=t?u[0]-s:u[0]+s;break;case"h":u[0]=t?u[0]-n:u[0]+n;break;case"m":t?(u[0]-=n,u[1]-=s):(u[0]+=n,u[1]+=s),i=t?u[0]+n:u[0],o=t?u[1]+s:u[1];break;default:if(u.length)for(let e=0;e<u.length;e++)u[e]=t?u[e]-(e%2?s:n):u[e]+(e%2?s:n)}switch(y){case"z":n=i,s=o;break;case"h":n=t?n+u[0]:u[0];break;case"v":s=t?s+u[0]:u[0];break;case"m":i=u[h-2]+(t?n:0),o=u[h-1]+(t?s:0);default:n=u[h-2]+(t?n:0),s=u[h-1]+(t?s:0)}a>=0&&(l.values=l.values.map(e=>+e.toFixed(a)))}return e}function $e(e,t=-1){return Fe(e,!1,t)}function qe(e,t=-1,a=!0){let l=!1;if(a){let t=e.map(e=>e.type).join(""),a=/[hstv]/gi.test(t);if(l=/[astvqmhlc]/g.test(t),!a)return e}let r=[],n={type:"M",values:(e=a&&l?$e(e,t):e)[0].values};r.push(n);for(let a=1,l=e.length;a<l;a++){let l,s,i,o,p,u,h,y,c=e[a],{type:x,values:f}=c,g=f.length,m=n.values,d=m.length,[v,M]=[f[g-2],f[g-1]],[b,A]=[m[d-2],m[d-1]];switch(x){case"H":n={type:"L",values:[f[0],A]};break;case"V":n={type:"L",values:[b,f[0]]};break;case"T":[l,s]=[m[0],m[1]],[b,A]=[m[d-2],m[d-1]],i=b+(b-l),o=A+(A-s),n={type:"Q",values:[i,o,v,M]};break;case"S":[l,s]=[m[0],m[1]],[b,A]=[m[d-2],m[d-1]],[h,y]=d>2&&"A"!==n.type?[m[2],m[3]]:[b,A],i=2*b-h,o=2*A-y,p=f[0],u=f[1],n={type:"C",values:[i,o,p,u,v,M]};break;default:n={type:x,values:f}}t>-1&&(n.values=n.values.map(e=>+e.toFixed(t))),r.push(n)}return r}function je({p0:e={x:0,y:0},p:t={x:0,y:0},centroid:a={x:0,y:0},rx:l=0,ry:r=0,xAxisRotation:n=0,radToDegree:s=!1,startAngle:i=null,endAngle:o=null,deltaAngle:p=null}={}){if(!l||!r)return[];let u=[];const h=1.5707963267948966;let y=s?n:n*Math.PI/180,c=Math.cos(y),x=Math.sin(y);null!==i&&null!==o&&null!==p||({startAngle:i,endAngle:o,deltaAngle:p}=R(a,e,t));let f=l!==r?Y(i,l,r):i,g=l!==r?Y(p,l,r):p,m=Math.max(1,Math.ceil(Math.abs(g)/h)),d=g/m;for(let e=0;e<m;e++){const e=Math.abs(d)===h?.551785*Math.sign(d):4/3*Math.tan(d/4);let t=Math.cos(f),n=Math.sin(f),s=Math.cos(f+d),i=Math.sin(f+d),o=[];[{x:t-n*e,y:n+t*e},{x:s+i*e,y:i-s*e},{x:s,y:i}].forEach(e=>{let t=e.x*l,n=e.y*r;o.push(c*t-x*n+a.x,x*t+c*n+a.y)}),u.push({type:"C",values:o,cp1:{x:o[0],y:o[1]},cp2:{x:o[2],y:o[3]},p:{x:o[4],y:o[5]}}),f+=d}return u}function ze(e,t,a=1){const l=2*Math.PI;let[r,n,s,i,o,p,u]=t;if(0===r||0===n)return[];let h=s?s*l/360:0,y=h?Math.sin(h):0,c=h?Math.cos(h):1,x=c*(e.x-p)/2+y*(e.y-u)/2,f=-y*(e.x-p)/2+c*(e.y-u)/2;if(0===x&&0===f)return[];r=Math.abs(r),n=Math.abs(n);let g=x*x/(r*r)+f*f/(n*n);if(g>1){let e=Math.sqrt(g);r*=e,n*=e}let m=r*r,d=r===n?m:n*n,v=x*x,M=f*f,b=m*d-m*M-d*v;b<=0?b=0:(b/=m*M+d*v,b=Math.sqrt(b)*(i===o?-1:1));let A=b?b*r/n*f:0,w=b?b*-n/r*x:0,C=c*A-y*w+(e.x+p)/2,k=y*A+c*w+(e.y+u)/2,P=(x-A)/r,L=(f-w)/n,E=(-x-A)/r,S=(-f-w)/n;const D=(e,t,a,l)=>{let r=+(e*a+t*l).toFixed(9);return 1===r||-1===r?1===r?0:Math.PI:(r=r>1?1:r<-1?-1:r,(e*l-t*a<0?-1:1)*Math.acos(r))};let T=D(1,0,P,L),I=D(P,L,E,S);0===o&&I>0?I-=2*Math.PI:1===o&&I<0&&(I+=2*Math.PI);let F=(+(Math.abs(I)/(l/4)).toFixed(0)||1)*a;I/=F;let $=[];const q=1.5707963267948966,j=.551785;let z=I===q?j:I===-q?-j:4/3*Math.tan(I/4),Q=I?Math.cos(I):1,B=I?Math.sin(I):0;const N=(e,t,a,l,r)=>{let n=e!=t?Math.cos(e):l,s=e!=t?Math.sin(e):r,i=Math.cos(e+t),o=Math.sin(e+t);return[{x:n-s*a,y:s+n*a},{x:i+o*a,y:o-i*a},{x:i,y:o}]};for(let e=0;e<F;e++){let e={type:"C",values:[]};N(T,I,z,Q,B).forEach(t=>{let a=t.x*r,l=t.y*n;e.values.push(c*a-y*l+C,y*a+c*l+k)}),$.push(e),T+=I}return $}function Qe(e,{toAbsolute:t=!0,toLonghands:a=!0,quadraticToCubic:l=!1,arcToCubic:r=!1,arcAccuracy:n=4}={}){let s=Array.isArray(e),i=s&&"object"==typeof e[0]&&"function"==typeof e[0].constructor,o=s?e:Ue(e),{hasRelatives:p=!0,hasShorthands:u=!0,hasQuadratics:h=!0,hasArcs:y=!0}=o,c=i?o:o.pathData;return c=function(e=[],{toAbsolute:t=!0,toLonghands:a=!0,quadraticToCubic:l=!1,arcToCubic:r=!1,arcAccuracy:n=2,hasRelatives:s=!0,hasShorthands:i=!0,hasQuadratics:o=!0,hasArcs:p=!0,testTypes:u=!1}={}){if(u){let t=Array.from(new Set(e.map(e=>e.type))).join("");s=/[lcqamts]/gi.test(t),o=/[qt]/gi.test(t),p=/[a]/gi.test(t),i=/[vhst]/gi.test(t),isPoly=/[mlz]/gi.test(t)}return(o&&l||p&&r)&&(a=!0,t=!0),s&&t&&(e=Fe(e,!1)),i&&a&&(e=qe(e,-1,!1)),p&&r&&(e=De(e,n)),o&&l&&(e=Te(e)),e}(c,{toAbsolute:t,toLonghands:a,quadraticToCubic:l,arcToCubic:r,arcAccuracy:n,hasRelatives:p,hasShorthands:u,hasQuadratics:h,hasArcs:y}),c}const Be=new Set([77,109,65,97,67,99,76,108,81,113,83,115,84,116,72,104,86,118,90,122]),Ne=new Uint8Array(128);Ne[77]=2,Ne[109]=2,Ne[65]=7,Ne[97]=7,Ne[67]=6,Ne[99]=6,Ne[76]=2,Ne[108]=2,Ne[81]=4,Ne[113]=4,Ne[83]=4,Ne[115]=4,Ne[84]=2,Ne[116]=2,Ne[72]=1,Ne[104]=1,Ne[86]=1,Ne[118]=1,Ne[90]=0,Ne[122]=0;const Oe=new Set([5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279]),Re=e=>32===e||44===e||10===e||13===e||8232===e||8233===e||9===e||11===e||12===e||160===e||e>=5760&&Oe.has(e),Ge=(e="",t=0)=>{let a=e.length;return 3===t&&2===a?(e=[+e[0],+e[1]],t++):4===t&&a>1?(e=[+e[0],+e.substring(1)],t++):3===t&&a>=3?(e=[+e[0],+e[1],+e.substring(2)],t+=2):e=[+e],{val:e,valueIndex:t}};function Ue(e,t=!0,a=0){e=e.trim(),a&&console.log("!!!limit",a);let l={pathData:[],hasRelatives:!1,hasShorthands:!1,hasArcs:!1,hasQuadratics:!1,isPolygon:!1,log:[]};if(""===e)return l;let r,n=0,s=e.length,i="",o=-1,p="",u=!1,h=0,y=0,c=0,x=!1,f=new Set([]);const g=()=>{x&&("M"===i?i="L":"m"===i&&(i="l"),l.pathData.push({type:i,values:[]}),o++,y=0,x=!1)},m=(e=!1)=>{(e?h>0:""!==p)&&(t&&-1===o&&(r="Pathdata must start with M command",l.log.push(r),i="M",l.pathData.push({type:i,values:[]}),c=2,y=0,o++),"A"===i||"a"===i?(({val:p,valueIndex:y}=Ge(p,y)),l.pathData[o].values.push(...p)):(t&&p[1]&&"."!==p[1]&&"0"===p[0]&&(r=`${o}. command: Leading zeros not valid: ${p}`,l.log.push(r)),l.pathData[o].values.push(+p)),y++,p="",h=0,x=y>=c)},d=()=>{if(o>0){let e=l.pathData[o].values.length;if(e&&e<c||e&&e>c||("z"===i||"Z"===i)&&e>0){r=`${o}. command of type "${i}": ${c-e} values too few - ${c} expected`,l.log[l.log.length-1]!==r&&l.log.push(r)}}};let v=!1,M=!1,b=!1,A="";for(;n<s;){A=e.charCodeAt(n);let a=A>47&&A<58;if(a||(v=101===A||69===A,M=45===A||43===A,b=46===A),a||M||b||v){if(u||45!==A&&46!==A)g();else{let e=46===A;m(e),g(),e&&h++}p+=e[n],u=v,n++}else if((A<48||A>5759)&&Re(A))m(),n++;else{if(A>64){if(!Be.has(A)){r=`${o}. command "${e[n]}" is not a valid type`,l.log.push(r),n++;continue}""!==p&&(l.pathData[o].values.push(+p),y++,p=""),t&&d(),i=e[n],c=Ne[A];let a="M"===i||"m"===i,s=o>0&&("z"===l.pathData[o].type||"Z"===l.pathData[o].type);f.add(i),s&&!a&&(l.pathData.push({type:"m",values:[0,0]}),o++),l.pathData.push({type:i,values:[]}),o++,h=0,y=0,x=!1,n++;continue}a||(r=`${o}. ${e[n]} is not a valid separarator or token`,l.log.push(r),p=""),n++}}m(),t&&d(),t&&l.log.length&&(r="Invalid path data:\n"+l.log.join("\n"),"log"===t?console.log(r):console.warn(r)),l.pathData[0].type="M";let w=Array.from(f).join("");return l.hasRelatives=/[lcqamtsvh]/g.test(w),l.hasShorthands=/[vhst]/gi.test(w),l.hasArcs=/[a]/gi.test(w),l.hasQuadratics=/[qt]/gi.test(w),l.isPolygon=!/[cqats]/gi.test(w),l}function Ze(e){if("path"===e.nodeName.toLowerCase())return e;let t=function(e,t=!1){let a,l,r,n,s,i,o,p,u,h,y,c,x,f,g,m,d=[],v=e.nodeName.toLowerCase();const M=(e,t=9)=>{const a="svg"!==e.nodeName?e.closest("svg"):e,l=e=>{if(null===e)return 0;let a=96,l=e.match(/([a-z]+)/gi);l=l?l[0]:"";let r,n=parseFloat(e);if(!l)return n;switch(l){case"in":r=a;break;case"pt":r=1/72*96;break;case"cm":r=1/2.54*96;break;case"mm":r=1/2.54*96/10;break;case"em":case"rem":r=16;break;default:r=1}return+(n*r).toFixed(t)};let r=a.getAttribute("width");r=r?l(r):300;let n=a.getAttribute("height");n=r?l(n):150;let s=a.getAttribute("viewBox");s=s?s.replace(/,/g," ").split(" ").filter(Boolean).map(e=>+e):[];let i=s.length?s[2]:r,o=s.length?s[3]:n,p=i/100,u=o/100,h=Math.sqrt((Math.pow(p,2)+Math.pow(u,2))/2),y=["x","width","x1","x2","rx","cx","r"],c=["y","height","y1","y2","ry","cy"];e.getAttributeNames().forEach(t=>{let a=e.getAttribute(t),r=a;if(y.includes(t)||c.includes(t)){let n=y.includes(t)?p:u;n="r"===t&&i!=o?h:n;let s=a.match(/([a-z|%]+)/gi);s=s?s[0]:"",r=a.includes("%")?parseFloat(a)*n:l(a),e.setAttribute(t,+r)}})};M(e);const b=t=>(a={},t.forEach(t=>{a[t]=+e.getAttribute(t)}),a);switch(v){case"path":r=e.getAttribute("d"),d=Qe(r);break;case"rect":l=["x","y","width","height","rx","ry"],({x:n,y:s,width:i,height:o,rx:u,ry:h}=b(l)),u||h?(u=u||h,h=h||u,u>i/2&&(u=i/2),h>o/2&&(h=o/2),d=[{type:"M",values:[n+u,s]},{type:"L",values:[n+i-u,s]},{type:"A",values:[u,h,0,0,1,n+i,s+h]},{type:"L",values:[n+i,s+o-h]},{type:"A",values:[u,h,0,0,1,n+i-u,s+o]},{type:"L",values:[n+u,s+o]},{type:"A",values:[u,h,0,0,1,n,s+o-h]},{type:"L",values:[n,s+h]},{type:"A",values:[u,h,0,0,1,n+u,s]},{type:"Z",values:[]}]):d=[{type:"M",values:[n,s]},{type:"L",values:[n+i,s]},{type:"L",values:[n+i,s+o]},{type:"L",values:[n,s+o]},{type:"Z",values:[]}];break;case"circle":case"ellipse":l=["cx","cy","rx","ry","r"],({cx:y,cy:c,r:p,rx:u,ry:h}=b(l));let t="circle"===v;t?(u=p,h=p):(u=u||p,h=h||p);let a=t&&p>=1?1:u,M=t&&p>=1?1:u;d=[{type:"M",values:[y+u,c]},{type:"A",values:[a,M,0,1,1,y-u,c]},{type:"A",values:[a,M,0,1,1,y+u,c]}];break;case"line":l=["x1","y1","x2","y2"],({x1:x,y1:g,x2:f,y2:m}=b(l)),d=[{type:"M",values:[x,g]},{type:"L",values:[f,m]}];break;case"polygon":case"polyline":let A=e.getAttribute("points").replaceAll(","," ").split(" ").filter(Boolean);for(let e=0;e<A.length;e+=2)d.push({type:0===e?"M":"L",values:[+A[e],+A[e+1]]});"polygon"===v&&d.push({type:"Z",values:[]})}return t?function(e){return e.map(e=>`${e.type} ${e.values.join(" ")}`).join(" ")}(d):d}(e),a=t.map(e=>`${e.type} ${e.values} `).join(" "),l=[...e.attributes].map(e=>e.name),r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("d",a);let n=["x","y","x1","y1","x2","y2","cx","cy","dx","dy","r","rx","ry","width","height","points"];return l.forEach(t=>{if(!n.includes(t)){let a=e.getAttribute(t);r.setAttribute(t,a)}}),r}function He(e,{tolerance:t=1,flatBezierToLinetos:a=!0}={}){let l=[e[0]],r={x:e[0].values[0],y:e[0].values[1]},n=r,s=r;e[e.length-1].type.toLowerCase();for(let i=1,o=e.length;i<o;i++){let p=e[i],u=e[i+1]||e[o-1],h="z"===u.type.toLowerCase()?r:{x:u.values[u.values.length-2],y:u.values[u.values.length-1]},{type:y,values:c}=p,x=c.slice(-2);s="Z"!==y?{x:x[0],y:x[1]}:r;let f=h?de([n,s,h],!0):1/0,g=se(n,h),m=f<(g?g/333*t:0),d=!1;if(a||"C"!==y||(m=!1),a&&("C"===y||"Q"===y)){d=we([n,..."C"===y?[{x:c[0],y:c[1]},{x:c[2],y:c[3]}]:"Q"===y?[{x:c[0],y:c[1]}]:[],s],{tolerance:t}),d&&i<o-1&&(y="L",p.type="L",p.values=x)}m&&i<o-1&&"A"!==u.type&&("L"===y||a&&d)||(n=s,"M"===y&&(r=s),l.push(p))}return l}function We(e){let t=[];for(let a=0,l=e.length;a<l;a++){let l=e[a];if(!l)continue;let{type:r=null,values:n=[]}=l,s=e[a+1]?e[a+1]:null;"M"!==r&&"m"!==r||s&&(!s||"Z"!==s.type&&"z"!==s.type)?t.push(l):s&&a++}return t}function Ve(e){let t={x:e[0].values[0],y:e[0].values[1]},a=t,l=[e[0]];for(let r=1,n=e.length;r<n;r++){let n=e[r],s=e[r-1],i=e[r+1]||null,{type:o,values:p}=n,u="m"===s.type.toLowerCase()&&!i,h=p.length;if(a={x:p[h-2],y:p[h-1]},u||"L"!==o||a.x!==t.x||a.y!==t.y){if(!u&&("l"===o||"v"===o||"h"===o)){if("l"===o?"00"===p.join(""):0===p[0])continue}l.push(n),t=a}}return l}function Je(e){let t=e.length;if(!("z"===e[t-1].type.toLowerCase()))return e;let a=0,l=[];for(let a=0;a<t;a++){let t=e[a],{type:r,values:n}=t,s=n.length;if(s){let e={type:r,x:n[s-2],y:n[s-1],index:0};e.index=a,l.push(e)}}return l=l.sort((e,t)=>+e.y.toFixed(8)-+t.y.toFixed(8)||e.x-t.x),a=l[0].index,a?Ye(e,a):e}function Xe(e,{removeFinalLineto:t=!0,autoClose:a=!0}={}){let l=[],r=e.length,n={x:+e[0].values[0].toFixed(8),y:+e[0].values[1].toFixed(8)},s="z"===e[r-1].type.toLowerCase(),i=e.filter(e=>"L"===e.type),o=e[s?r-2:r-1],p=o.type,u=o.values.slice(-2).map(e=>+e.toFixed(8)),h=u[0]===n.x&&u[1]===n.y;!s&&a&&h&&(e.push({type:"Z",values:[]}),s=!0,r++);let y="L"!==e[1].type&&(!h||"L"===o.type);if(y=!1,!s)return e;let c=0;{let t=[];for(let a=0;a<r;a++){let l=e[a],{type:r,values:n}=l;if(n.length){let l=n.slice(-2),s=e[a-1]&&"L"===e[a-1].type,i=e[a+1]&&"L"===e[a+1].type,o=e[a-1]?e[a-1].type.toUpperCase():null,p=e[a+1]?e[a+1].type.toUpperCase():null,u={type:r,x:l[0],y:l[1],dist:0,index:0,prevL:s,nextL:i,prevCom:o,nextCom:p};u.index=a,t.push(u)}}if(i.length){let e=t.filter(e=>"L"!==e.type&&"M"!==e.type&&e.prevCom&&"L"===e.prevCom||"M"===e.prevCom&&"L"===p).sort((e,t)=>e.y-t.y||e.x-t.x)[0];c=e?e.index-1:0}else t=t.sort((e,t)=>+e.y.toFixed(8)-+t.y.toFixed(8)||e.x-t.x),c=t[0].index;e=c?Ye(e,c):e}return n={x:+e[0].values[0].toFixed(8),y:+e[0].values[1].toFixed(8)},r=e.length,o=e[r-2],p=o.type,u=o.values.slice(-2).map(e=>+e.toFixed(8)),h="L"===p&&u[0]===n.x&&u[1]===n.y,t&&h&&e.splice(r-2,1),l.push(...e),l}function Ye(e,t){let a=0,l="z"===e[e.length-1].type.toLowerCase();if(!l||t<1||e.length<3)return e;let r=l?1:0;!function(e){let t=e.length,a="z"===e[t-1].type.toLowerCase(),l=e[0],[r,n]=[l.values[0],l.values[1]].map(e=>+e.toFixed(8)),s=a?e[t-2]:e[t-1],i=s.values.length,[o,p]=[s.values[i-2],s.values[i-1]].map(e=>+e.toFixed(8));!a||r==o&&n==p||(e.pop(),e.push({type:"L",values:[r,n]},{type:"Z",values:[]}))}(e),a=t+1<e.length-1?t+1:e.length-1-r;let n,s,i=e.slice(a),o=e.slice(0,a);return o.shift(),n=o[o.length-1].values||[],s=[n[n.length-2],n[n.length-1]],r&&(i.pop(),o.push({type:"Z",values:[]})),e=[{type:"M",values:s},...i,...o]}function _e(e,{arcToCubic:t=!1,quadraticToCubic:a=!1,toClockwise:l=!1,returnD:r=!1}={}){const n=(e,t)=>{let a=[],l=[];if("A"!==e){for(let e=0;e<t.length;e+=2)a.push([t[e],t[e+1]]);l=a.pop(),a.reverse()}else{let e=0==t[4]?1:0;a=[t[0],t[1],t[2],t[3],e],l=[t[5],t[6]]}return{controlPoints:a,endPoints:l}};let s=[],i="z"===e[e.length-1].type.toLowerCase();i&&(e=(e=>{let t="z"===e[e.length-1].type.toLowerCase(),a=e[0],[l,r]=[a.values[0],a.values[1]],n=t?e[e.length-2]:e[e.length-1],[s,i]=[n.values[n.values.length-2],n.values[n.values.length-1]];return!t||l==s&&r==i||(e.pop(),e.push({type:"L",values:[l,r]},{type:"Z",values:[]})),e})(e),e.pop());let o=e[e.length-1].values,p=o.length,u=i?e[0]:{type:"M",values:[o[p-2],o[p-1]]};s.push(u),e.reverse();for(let t=1;t<e.length;t++){let a=e[t],l=a.type,r=a.values,i=e[t-1],o=i.type,p=[];p=[n(o,i.values).controlPoints,n(l,r).endPoints].flat(),s.push({type:o,values:p.flat()})}return i&&s.push({type:"z",values:[]}),s}function Ke(e,{threshold:t=null,tolerance:a=1}={}){if(!t){let a=function(e){let t=1/0,a=-1/0,l=1/0,r=-1/0;const n=e=>{e.x<t&&(t=e.x),e.x>a&&(a=e.x),e.y<l&&(l=e.y),e.y>r&&(r=e.y)};for(let t=0;t<e.length;t++){let a=e[t],{type:l,values:r}=a,s=r.length,i=(e[t-1]?e[t-1]:e[t]).values,o=i.length;if(s){let e={x:i[o-2],y:i[o-1]},t={x:r[s-2],y:r[s-1]};if(n(t),"C"===l||"Q"===l){let a={x:r[0],y:r[1]},s="C"===l?{x:r[2],y:r[3]}:a,i="C"===l?[e,a,s,t]:[e,a,t];K(i).forEach(e=>{let t=H(i,e);n(t)})}else"A"===l&&ee(e,r).forEach(e=>{n(e)})}}return{x:t,y:l,width:a-t,height:r-l}}(e);t=.05*(a.width+a.height)}let l=e.length;for(let r=0;r<l;r++){let l=e[r],{type:n,values:s,extreme:i,corner:o=!1,dimA:p,p0:u,p:h}=l,y=e[r+1]?e[r+1]:null,c=e[r+2]?e[r+2]:null,x=(y?ie(h,y.p):1/0)<t,f=(c?ie(c.p,y.p):1/0)<1*t;if(y&&c&&"C"===n&&"C"===y.type&&i&&c.extreme&&(f||x)){let l=Me(y,c,t,a,!1);if(1===l.length){l=l[0],e[r+1]=null,e[r+2].values=[l.cp1.x,l.cp1.y,l.cp2.x,l.cp2.y,l.p.x,l.p.y],e[r+2].cp1=l.cp1,e[r+2].cp2=l.cp2,e[r+2].p0=l.p0,e[r+2].p=l.p,e[r+2].extreme=l.extreme,r++;continue}}if(y&&"C"===n&&"C"===y.type&&i&&x){let e=de([l.p0,l.p,y.p]),t=de([l.p0,l.cp1,l.cp2,l.p]);if(e<0&&t>0||e>0&&t<0)continue}}l=(e=e.filter(Boolean)).length;let r="z"===e[l-1].type.toLowerCase()?l-2:l-1,n=e[r],s=e[r-1]||null,i={x:e[0].values[0],y:e[0].values[1]},o=n.values.slice(-2),p=+o[0].toFixed(8)===+i.x.toFixed(8)&&+o[1].toFixed(8)===+i.y.toFixed(8),u="C"===e[1].type&&e[1].extreme?e[1]:null,h=ie(n.p0,n.p)<t;if(s&&"C"===s.type&&h&&p&&u){let l=Me(s,n,t,a,!1);1===l.length&&(e[r-1]=l[0],e[r]=null,e=e.filter(Boolean))}return e}function et({transforms:e=[],transformOrigin:t={x:0,y:0}}={}){let a=function(e=[],t={x:0,y:0}){const a=(e,t)=>({a:e.a*t.a+e.c*t.b,b:e.b*t.a+e.d*t.b,c:e.a*t.c+e.c*t.d,d:e.b*t.c+e.d*t.d,e:e.a*t.e+e.c*t.f+e.e,f:e.b*t.e+e.d*t.f+e.f}),l=(e,t)=>({a:1,b:0,c:0,d:1,e:e,f:t}),r=(e,t)=>({a:e,b:0,c:0,d:t,e:0,f:0}),n=(e,t)=>{const a=e=>e*Math.PI/180;let[l,r]=e.map(e=>a(e)),n={};if("rot"===t){let e=Math.cos(l),t=Math.sin(l);n={a:e,b:t,c:-t,d:e,e:0,f:0}}else if("skew"===t){let e=Math.tan(l);n={a:1,b:Math.tan(r),c:e,d:1,e:0,f:0}}return n};let s={a:1,b:0,c:0,d:1,e:0,f:0};0===t.x&&0===t.y||(s=a(s,l(t.x,t.y)));const i={translate:[0,0],scale:[1,1],skew:[0,0],rotate:[0],matrix:[1,0,0,1,0,0]};for(const t of e){const e=Object.keys(t)[0],o=t[e]||i[e];let[p,u=i[e][1]]=o;switch("rotate"===e&&3===o.length&&(p=o[2]),e){case"matrix":let t=["a","b","c","d","e","f"];s=a(s,Object.fromEntries(t.map((e,t)=>[e,o[t]])));break;case"translate":(p||u)&&(s=a(s,l(p,u)));break;case"skew":(p||u)&&(s=a(s,n([p,u],"skew")));break;case"rotate":p&&(s=a(s,n([p],"rot")));break;case"scale":1===p&&1===u||(s=a(s,r(p,u)));break;default:throw new Error(`Unknown transformation type: ${e}`)}}0===t.x&&0===t.y||(s=a(s,l(-t.x,-t.y)));return s}(e,t);return a}const tt=["path","polygon","polyline","line","rect","circle","ellipse"],at=["textPath","text","tspan"],lt={atts:{id:"*",class:"*",viewBox:["symbol","svg"],preserveAspectRatio:["symbol","svg"],width:["svg","rect","use","image"],height:["svg","rect","use","image"],d:["path"],points:["polygon","polyline"],x:["image","rect","text","textPath","tspan","use","mask"],y:["image","rect","text","textPath","tspan","use","mask"],x1:["line","linearGradient"],x2:["line","linearGradient"],y1:["line","linearGradient"],y2:["line","linearGradient"],r:["circle","radialGradient"],rx:["rect","ellipse"],ry:["rect","ellipse"],cx:["circle","ellipse","radialGradient"],cy:["circle","ellipse","radialGradient"],refX:["symbol","markers"],refY:["symbol","markers"],transform:["svg","g","use",...tt,...at],"transform-origin":["svg","g","use",...tt,...at],fill:["svg","g","use",...tt,...at,"animate","animateMotion"],"fill-opacity":["svg","g","use",...tt,...at],"fill-rule":["svg","g","path","polygon","text","textPath"],opacity:["svg","g","use",...tt,...at],stroke:["svg","g","use",...tt,...at],"stroke-width":["svg","g","use",...tt,...at,"mask"],"stroke-opacity":["svg","g","use",...tt,...at,"mask"],"stroke-miterlimit":["svg","g","use",...tt,...at,"mask"],"stroke-linejoin":["svg","g","use",...tt,...at,"mask"],"stroke-linecap":["svg","g","use",...tt,...at,"mask"],"stroke-dashoffset":["svg","g","use",...tt,...at,"mask"],"stroke-dasharray":["svg","g","use",...tt,...at,"mask"],"clip-path":["svg","g","use",...tt,...at],"clip-rule":["path","polygon"],clipPathUnits:["clipPath"],mask:["svg","g","use",...tt,...at],maskContentUnits:["mask"],maskUnits:["mask"],"font-family":["svg","g",...at],"font-size":["svg","g",...at],"font-style":["svg","g",...at],"font-weight":["svg","g",...at],"font-stretch":["svg","g",...at],"dominant-baseline":[...at],lengthAdjust:[...at],"text-anchor":["text"],textLength:["text","textPath","tspan"],dx:["text","tspan"],dy:["text","tspan"],method:["textPath"],spacing:["textPath"],startOffset:["textPath"],rotate:["text","tspan","animateMotion"],side:["textPath"],"white-space":["svg","g",...at],color:["svg","g",...at],playbackorder:["svg"],timelinebegin:["svg"],dur:["animate","animateTransform","animateMotion"],end:["animate","animateTransform","animateMotion"],from:["animate","animateTransform","animateMotion"],to:["animate","animateTransform","animateMotion"],type:["animateTransform"],values:["animate","animateTransform","animateMotion"],accumulate:["animate","animateTransform","animateMotion"],additive:["animate","animateTransform","animateMotion"],attributeName:["animate","animateTransform"],begin:["animate","animateTransform","animateMotion"],by:["animate","animateTransform","animateMotion"],calcMode:["animate","animateTransform","animateMotion"],keyPoints:["animateMotion"],keySplines:["animate","animateTransform","animateMotion"],keyTimes:["animate","animateTransform","animateMotion"],max:["animate","animateTransform","animateMotion"],min:["animate","animateTransform","animateMotion"],origin:["animateMotion"],repeatCount:["animate","animateTransform","animateMotion"],repeatDur:["animate","animateTransform","animateMotion"],restart:["animate","animateTransform","animateMotion"],gradientUnits:["linearGradient","radialGradient"],gradientTransform:["linearGradient","radialGradient"],fr:["radialGradient"],fx:["radialGradient"],fy:["radialGradient"],offset:["stop"],"stop-color":["stop"],"stop-opacity":["stop"],spreadMethod:["linearGradient","radialGradient"],href:["pattern","textPath","linearGradient","radialGradient","use","animate","animateTransform","animateMotion","image"],pathLength:[...tt]},defaults:{transform:["none","matrix(1, 0, 0, 1, 0, 0)"],"transform-origin":["0px, 0px","0 0"],rx:["0","0px"],ry:["0","0px"],x:["0","0px"],y:["0","0px"],fill:["black","rgb(0, 0, 0)","rgba(0, 0, 0, 0)","#000","#000000"],color:["black","rgb(0, 0, 0)","rgba(0, 0, 0, 0)","#000","#000000"],stroke:["none"],"stroke-width":["1","1px"],opacity:["1"],"fill-opacity":["1"],"stroke-opacity":["1"],"stroke-linecap":["butt"],"stroke-miterlimit":["4"],"stroke-linejoin":["miter"],"stroke-dasharray":["none"],"stroke-dashoffset":["0","0px","none"],pathLength:["none"],"font-family":["serif"],"font-weight":["normal","400"],"font-stretch":["normal"],"font-width":["normal"],"letter-spacing":["auto","normal","0"],lengthAdjust:["spacing"],"text-anchor":["start"],"dominant-baseline":["auto"],spacing:["auto"],"white-space":["normal"],"stop-opacity":["1"],gradientUnits:["objectBoundingBox"],patternUnits:["objectBoundingBox"],"clip-path":["none"],"clip-rule":["nonzero"],"fill-rule":["nonzero"],clipPathUnits:["userSpaceOnUse"],mask:["none"],maskUnits:["objectBoundingBox"]}};function rt(e,{removeNameSpaced:t=!0,decimals:a=-1}={}){let l=e.nodeName.toLowerCase(),r=function(e){let t={},a=[...e.attributes].map(e=>e.name),l=a.length;if(!l)return t;for(let r=0;r<l;r++){let l=a[r],n=e.getAttribute(l);t[l]=n}return t}(e),n=function(e){let t=e.getAttribute("style"),a=t?function(e=""){let t={};if(!e)return t;let a=e.split(";").filter(Boolean).map(e=>e.trim()),l=a.length;if(!l)return t;for(let e=0;l&&e<l;e++){let l=a[e],[r,n]=l.split(":").filter(Boolean);t[r]=n}return t}(t):{};return a}(e),s={...r,...n},i={},o=n.transform;if(o){let e=et(function(e,t={x:0,y:0}){let a,l={transforms:[],transformOrigin:t},r=/(\w+)\(([^)]+)\)/g;function n(e){if("string"==typeof e){if(e.includes("rad"))return parseFloat(e)*(180/Math.PI);if(e.includes("turn"))return 360*parseFloat(e)}return parseFloat(e)}for(;null!==(a=r.exec(e));){let e=a[1],t=a[2].split(/,\s*/).map(e=>n(e));switch(e){case"translate":l.transforms.push({translate:[t[0]||0,t[1]||0]});break;case"translateX":l.transforms.push({translate:[t[0]||0,0,0]});break;case"translateY":l.transforms.push({translate:[0,t[0]||0,0]});break;case"scale":l.transforms.push({scale:[t[0]||0,t[1]||0]});break;case"skew":l.transforms.push({skew:[t[0]||0,t[1]||0]});break;case"skewX":l.transforms.push({skew:[t[0]||0,0]});break;case"skewY":l.transforms.push({skew:[0,t[0]||0]});break;case"rotate":l.transforms.push({rotate:[0,0,t[0]||0]});break;case"matrix":l.transforms.push({matrix:t})}}return e.split(/;\s*/).forEach(e=>{let[t,a]=e.split(":").map(e=>e.trim());if("transform-origin"===t||"perspective-origin"===t){let[e,r]=a.split(/\s+/).map(parseFloat);"transform-origin"===t&&(l.transformOrigin={x:e||0,y:r||0})}}),l}(`${o}`));s.transform=`matrix(${Object.values(e).join(",")})`}let p=["inline-size"],u=[];for(let a in s){let r=s[a];r&&a.startsWith("--")||p.includes(a)||!t&&a.startsWith("-")?u.push(`${a}:${r}`):(r&&lt.atts[a]&&("*"===lt.atts[a]||lt.atts[a].includes(l)||!t&&a.includes(":"))&&(i[a]=r),e.removeAttribute(a))}for(let t in i){let a=i[t];e.setAttribute(t,a)}return u.length&&e.setAttribute("style",u.join(";")),i}function nt(e,{returnDom:t=!1,removeHidden:a=!0,removeUnused:l=!0,stylesToAttributes:r=!0,removePrologue:n=!0,removeIds:s=!1,removeClassNames:i=!1,removeDimensions:o=!1,fixHref:p=!0,mergePaths:u=!1,cleanupSVGAtts:h=!0,removeNameSpaced:y=!0,attributesToGroup:c=!0,shapesToPaths:x=!1,decimals:f=-1,excludedEls:g=[]}={}){c=!!h,p&&(e=e.replaceAll("xlink:href=","href="));let m=(new DOMParser).parseFromString(e,"text/html").querySelector("svg");if(h){!function(e,t=["viewBox","xmlns","width","height","id","class"]){[...e.attributes].map(e=>e.name).forEach(a=>{t.includes(a)||e.removeAttribute(a)})}(m,["viewBox","xmlns","width","height","id","class","fill","stroke","stroke-width","stroke-linecap","stroke-linejoin"])}let d=["metadata","script",...g],v=m.querySelectorAll("*"),M=[],b=["polygon","polyline","line","rect","circle","ellipse"];for(let e=0;e<v.length;e++){let t=v[e],l=t.nodeName.toLowerCase();if(x&&"path"!==l&&b.includes(l)){let e=Ze(t);t.replaceWith(e),l="path",t=e}let n=t.getAttribute("style")||"",s=!!n&&n.trim().includes("display:none"),i=t.getAttribute("display")&&"none"===t.getAttribute("display")||s;if(l.includes(":")||d.includes(l)||a&&i)t.remove();else if(r||c||u){let a=rt(t,{removeNameSpaced:y,decimals:f});"path"===l&&M.push({el:t,name:l,idx:e,propsFiltered:a})}}if((c||u)&&function(e=[],t=!0){let a,l=[[e[0]]],r=0,n="",s=e.length,i=e.filter(e=>e.propstr);if(!i.length&&t){let t=e[0];a=t.el;let l=t.propsFiltered.d;for(let t=1;t<s;t++){let a=e[t],r=a.el,n=a.propsFiltered.d;l+=n.startsWith("M")?n:Ue(n).pathData.map(e=>`${e.type} ${e.values.join(" ")}`).join(" "),r.remove()}return void a.setAttribute("d",l)}for(let t=0;t<s;t++){let a=e[t],i=a.propsFiltered,o=[];for(let e in i)"d"!==e&&"id"!==e&&o.push(`${e}:${i[e]}`);o=o.join("_"),a.propstr=o,s>1&&o===n?l[r].push(a):s>1&&l[r].length&&(l.push([]),r++),n=o}for(let e=0;e<l.length;e++){let r=l[e];if(r.length>1){let e=r[0].el,l=r[0].propsFiltered,n=e.parentNode.closest("g")?e.parentNode.closest("g"):null;n||(n=document.createElementNS("http://www.w3.org/2000/svg","g"),e.parentNode.insertBefore(n,e),r.forEach(e=>{n.append(e.el)}));let s=[...n.children];for(let e in l){if("d"!==e&&"id"!==e){let t=l[e];n.setAttribute(e,t),s.forEach(a=>{a.getAttribute(e)===t&&a.removeAttribute(e)})}if(t){r=r.filter(Boolean);let e=r.length;if(1===e)return r[0].el;a=r[0].el;let t=r[0].propsFiltered.d;for(let a=1;a<e;a++){let e=r[a],l=e.el,n=e.propsFiltered.d;t+=n.startsWith("M")?n:Ue(n).pathData.map(e=>`${e.type} ${e.values.join(" ")}`).join(" "),l.remove()}a.setAttribute("d",t)}}}}}(M,u),o&&(m.removeAttribute("width"),m.removeAttribute("height")),i||s){let e=i?"class":"id",t=`[${e}]`,a=m.querySelectorAll(t);m.removeAttribute(e),a.forEach(t=>{t.removeAttribute(e)})}return m.querySelectorAll("defs").forEach(e=>{let t=[...e.children];[...e.attributes].length||t.length||e.remove()}),t?m:st(m)}function st(e,t=!1){let a=(new XMLSerializer).serializeToString(e);return t&&(a=a.replaceAll('xmlns="http://www.w3.org/2000/svg"',"")),a=a.replace(/\t/g,"").replace(/[\n\r|]/g,"\n").replace(/\n\s*\n/g,"\n").replace(/ +/g," ").replace(/> </g,"><").trim(),a}function it(e,{threshold:t=0,tolerance:a=1}={}){let l=e.length,r=[e[0]],n="z"===e[l-1].type.toLowerCase(),s=!!n&&(e[l-1].p.x===e[0].p0.x&&e[l-1].p.y===e[0].p0.y),i=n?2:1,o=e[l-i],p="L"===o.type,u="C"===o.type,h="L"===e[1].type,y="C"===e[1].type,c=n&&y&&(p||s);c&&(e[l-1].values=e[0].values,e[l-1].type="L",p=!0);for(let t=1;t<l;t++){let s=e[t],{type:o}=s,x=e[t+1]?e[t+1]:null;if("L"===o&&x&&"C"===x.type||"C"===o&&x&&"L"===x.type){let c="L"===o?s:null,f=null,g=[],m=0;if(1===t&&y&&p&&(g=[e[1]],c=e[l-1],f=x),!c){r.push(s);continue}n&&u&&h&&t===l-i-1&&(f=e[1],g=[e[l-i]]);for(let a=t+1;a<l;a++){let t=e[a]?e[a]:null,l=e[a-1];if("C"===l.type&&g.push(l),"L"===t.type&&"C"===l.type){f=t;break}m++}if(f){let e=ie(c.p0,c.p),l=ie(f.p0,f.p);g.length;let n=ie(c.p,f.p0),i=de([c.p0,c.p,f.p0,f.p],!1),o=de([g[0].p0,g[0].cp1,g[0].cp2,g[0].p],!1),p=i<0&&o>0||i>0&&o<0,u=.5*n*a,h=u<e&&u<l;if(g.length&&!p&&h){let e=Math.abs(o)<=.005*se(g[0].p0,g[0].p),a=e?null:G(c.p0,c.p,f.p0,f.p,!1);if(!e&&a){let e=.75*ie(H([c.p,a,f.p0],.5),1===g.length?H([g[0].p0,g[0].cp1,g[0].cp2,g[0].p],.5):g[0].p);if(u&&e>u&&e>.3*n){r.push(s);continue}{let e={type:"Q",values:[a.x,a.y,f.p0.x,f.p0.y]};e.p0=c.p,e.cp1=a,e.p=f.p0,r.push(c,e),t+=m;continue}}}}}c&&t===l-1&&"L"===o||r.push(s)}return(c||n&&"Z"!==r[r.length-1].type)&&r.push({type:"Z",values:[]}),r}function ot(e){if(e.length<3)return!1;let t=e[0],a=e[Math.floor(e.length/2)],l=e[e.length-1],r=t.x,n=t.y,s=a.x,i=a.y,o=l.x,p=l.y,u=r-s,h=n-i,y=r-o,c=n-p,x=(r*r-s*s+(n*n-i*i))/2,f=(r*r-o*o+(n*n-p*p))/2,g=u*c-h*y;if(Math.abs(g)<1e-10)return console.warn("Points are collinear or numerically unstable"),!1;let m={x:(c*x-h*f)/g,y:(-y*x+u*f)/g},d=ne(m,t),v=R(m,t,l),{deltaAngle:M,startAngle:b,endAngle:A}=v;return{centroid:m,r:d,startAngle:b,endAngle:A,deltaAngle:M}}function pt(e,{threshold:a=0,tolerance:l=1,toCubic:r=!1,debug:n=!1}={}){let s=e.length,i=[e[0]],o=[];for(let a=1;a<s;a++){let l=e[a],{type:s}=l,p=e[a-1],u=e[a+1]?e[a+1]:null,h=e[a+2]?e[a+2]:null,y=e[a+3]?e[a+3]:null,c=null;"C"===l.type||"Q"===l.type?c=l:!u||"C"!==u.type&&"Q"!==u.type||(c=u);let x,f,g,m,d,v=c?"C"===c.type?[c.p0,c.cp1,c.cp2,c.p]:[c.p0,c.cp1,c.p]:[],M=0,b=0,A=!1,w=!1,C=[];if("L"===p.type&&"L"===s&&c&&"L"===h.type&&y&&("L"===y.type||"Z"===y.type)?(x=[l.p0,l.p],f=[h.p0,h.p],g=l.p0,m=h.p,M=de(v,!1),b=de([...x,...f],!1),A=M<0&&b>0||M>0&&b<0,A||(d=H(v,.5),C=[g,d,m],w=!0)):"C"!==s&&"Q"!==s||"L"!==p.type||"C"!==u.type&&"Q"!==u.type||"L"!==h.type||(w=!0,x=[p.p0,p.p],f=[h.p0,h.p],g=p.p,m=h.p0,d=c.p,C=[g,c.p,m]),w){let e=ot(C);if(e){let s,{centroid:p,r:u,deltaAngle:h,startAngle:y,endAngle:c}=e,x=0,f=h>0?1:0,v=Math.abs(h)>Math.PI?1:0;if(oe(J(g,p.x,p.y,.5*h),d)<.05*oe(g,m)){if(s=je({p0:g,p:m,centroid:p,rx:u,ry:u,xAxisRotation:x,sweep:f,largeArc:v,deltaAngle:h,startAngle:y,endAngle:c}),1===s.length){let e=Ee(g,s[0].cp1,s[0].cp2,m);"Q"===e.type&&(r=!0),l=e}if(s.length>1&&(r=!1),r||(l.type="A",l.values=[u,u,x,v,f,m.x,m.y]),l.p0=g,l.p=m,l.extreme=!1,l.corner=!1,n){o=r?[{type:"M",values:[g.x,g.y]},...s]:[{type:"M",values:[g.x,g.y]},{type:"A",values:[u,u,x,v,f,m.x,m.y]}];let e=ve(o);t(markers,e,"orange","0.5%","0.5")}i.push(l),a++;continue}}}i.push(l)}return i}function ut(e=[],{threshold:t=0}={}){let a=e.length,l="z"===e[a-1].type.toLowerCase(),r=l?a-2:a-1,n=e[r],s=n.values.slice(-2),i={x:e[0].values[0],y:e[0].values[1]},o=oe(i,{x:s[0],y:s[1]});if(o&&o<t){let a=e[r].values.length;e[r].values[a-2]=i.x,e[r].values[a-1]=i.y;let l=e[1];if("C"===l.type&&"C"===n.type){let a=Math.abs(l.values[0]-n.values[2]),s=Math.abs(l.values[1]-n.values[3]),o=Math.abs(e[1].values[0]-l.values[0]),p=Math.abs(e[1].values[1]-l.values[1]),u=Math.abs(e[1].values[0]-n.values[2]),h=Math.abs(e[1].values[1]-n.values[3]),y=p<t&&h<t&&a;a&&a<t&&(o<t&&u<t&&s)&&(e[1].values[0]=i.x,e[r].values[2]=i.x),s&&s<t&&y&&(e[1].values[1]=i.y,e[r].values[3]=i.y)}}return e}function ht(e,t=1){let a=[];for(let l=0,r=e.length;l<r;l++){let r=e[l],{type:n,values:s}=r,i={type:n,values:[]};switch(n.toLowerCase()){case"h":case"v":i.values=[s[0]*t];break;case"a":i.values=[s[0]*t,s[1]*t,s[2],s[3],s[4],s[5]*t,s[6]*t];break;default:s.length&&(i.values=s.map((e,a)=>e*t))}a.push(i)}return a}function yt(e,t=1){for(let a=1,l=e.length;a<l;a++){let l=e[a],{type:r,values:n,p0:s,cp1:i=null,cp2:o=null,p:p=null}=l;if("C"===r){let r=Ee(s,i,o,p,t);"Q"===r.type&&(r.extreme=l.extreme,r.corner=l.corner,r.dimA=l.dimA,r.squareDist=l.squareDist,e[a]=r)}}return e}function ct(e,{areaThreshold:t=2.5}={}){for(let a=0,l=e.length;a<l;a++){let l=e[a],r=e[a+1]||null,{type:n,values:s,p0:i,cp1:o=null,cp2:p=null,p:u=null}=l;if("C"===n&&r&&"C"===r.type){let l=xt(i,o,p,u,t),n=xt(r.p0,r.cp1,r.cp2,r.p,t);if(l.isArc&&n.isArc){let t=.01*ie(i,r.p),s=Math.abs(r.p.x-i.x),o=Math.abs(r.p.y-i.y),p=o<t&&s>t,h=s<t&&o>t,{rx:y,ry:c}=l,x=de([i,u,r.p])<0?0:1;if(h||p){y=Math.min(y,n.rx),c=Math.min(c,n.ry),e[a]=null,e[a+1].type="A",e[a+1].values=[y,c,0,0,x,r.p.x,r.p.y];continue}}}}return e=e.filter(Boolean)}function xt(e,t,a,l,r=7.5){let n,s={type:"C",values:[t.x,t.y,a.x,a.y,l.x,l.y]},i=0,o=!1,p=O(e,t,!0),u=O(l,a,!0),h=180*Math.abs(p-u)/Math.PI,y=0,c=0;if(Math.abs(h%180-90)<3){n=G(e,J(t,e.x,e.y,-.5*Math.PI),l,J(a,l.x,l.y,.5*Math.PI),!1);let p=G(e,t,l,a,!1);if(p){let n=ne(e,p),u=ne(l,p),h=+Math.max(n,u).toFixed(8),x=+Math.min(n,u).toFixed(8);y=x,c=h;let f=de([e,t,a,l])<0?0:1,g=Math.abs(l.x-e.x)>Math.abs(l.y-e.y);100/y*Math.abs(y-c)<5&&(y=h,c=y),g&&(y=h,c=x);let m=me([{type:"M",values:[e.x,e.y]},{type:"C",values:[t.x,t.y,a.x,a.y,l.x,l.y]}]),d={type:"A",values:[y,c,0,0,f,l.x,l.y]};i=Math.PI*(y*c)/4,i-=Math.abs(de([e,l,p])),function(e,t){let a=Math.abs(e-t);return Math.abs(100-100/e*(e+a))}(m,i)<r&&(o=!0,s=d)}}return{com:s,isArc:o,area:i,rx:y,ry:c,centroid:n}}function ft(e,{quality:t=.9,width:a=0,height:l=0}={}){let r=!1;if("string"==typeof t&&(r=!0,t=parseFloat(t)),e.length<4||(!r&&t)>=1)return e;let n=t;if(!r){if(n=1-t,t>.5&&(n/=2),!a&&!l){let t=pe(e,12);({width:a,height:l}=xe(t))}n=(n*((a+l)/2/100))**2}const s=(e,t,a)=>{let l=t.x,r=t.y,n=a.x-l,s=a.y-r;if(0!==n||0!==s){let t=((e.x-l)*n+(e.y-r)*s)/(n*n+s*s);t>1?(l=a.x,r=a.y):t>0&&(l+=n*t,r+=s*t)}return(e.x-l)**2+(e.y-r)**2};let i=[e[0]],o=[];for(o.push([0,e.length-1]);o.length>0;){let[t,a]=o.pop(),l=n,r=-1;for(let n=t+1;n<a;n++){let i=s(e[n],e[t],e[a]);i>l&&(r=n,l=i)}l>n?(o.push([r,a]),o.push([t,r])):i.push(e[a])}return i}function gt(e,{quality:t=.9,width:a=0,height:l=0}={}){let r=!1;if("string"==typeof t){r=!0,t=parseFloat(t)}if(e.length<4||(!r&&t)>=1)return e;let n,s=e[0],i=[s],o=t;if(!r){if(o=1-t,!a&&!l){let t=pe(e,12);({width:a,height:l}=xe(t))}o=(o*((a+l)/2/25))**2,t>.5&&(o/=10)}for(let t=1,a=e.length;t<a;t++){n=e[t],se(s,n)>o&&(i.push(n),s=n)}return s.x!==n.x&&s.y!==n.y&&i.push(n),i}function mt(e,t=!0){let a=[],l=[];return Array.isArray(e[0])?e.forEach(e=>{l=[{type:"M",values:[e[0].x,e[0].y]},...e.slice(1).map(e=>({type:"L",values:[e.x,e.y]}))],a.push(...l)}):a=[{type:"M",values:[e[0].x,e[0].y]},...e.slice(1).map(e=>({type:"L",values:[e.x,e.y]}))],t&&a.push({type:"Z",values:[]}),a}function dt(e,{maxError:t=0,adjustCpts:a=!0,harmonize:l=!0,keepCorners:r=!0}={}){if(1===e.length)return[];if(2===e.length)return[{type:"L",values:[e[0].x,e[0].y]},{type:"L",values:[e[1].x,e[1].y]}];let n=e.length,s=function(e=[]){let t=[];return e.forEach(e=>{let a=4===e.length?"C":3===e.length?"Q":"L",l="C"===a||"Q"===a?e[1]:null,r="C"===a?e[2]:null,n=e[e.length-1],s={type:a,values:"C"===a?[l.x,l.y,r.x,r.y,n.x,n.y]:"Q"===a?[l.x,l.y,n.x,n.y]:[n.x,n.y]};t.push(s)}),t}(vt(e,wt(e[1],e[0]),wt(e[n-2],e[n-1]),t,r));return s}function vt(e,t,a,l,r=!1){let n,s=function(e){let t=[],a=e.length,l=e[0],r=e[1],n=0,s=0;for(let i=0;i<a;i++)r=e[i],n=s+ne(r,l,!1),t.push(n),s=n,l=r;return t=t.map(function(e){return e/s}),t}(e),i=Mt(e,s,s,t,a);n=i[0];let o=i[1],p=i[2];if(r){let t=function(e,t){let a,l=4,r=1/l,n=e.length,s=[t[0]];for(let e=1;e<l;e++){a=H(t,r*e),s.push(a)}s.push(t[t.length-1]);let i=de(e,!1);i||2!==e.length||(i=.01*se(e[0],e[1]));let o=de(s,!1)/i>1.1,p=t;if(o){let a=e[Math.floor(.5*n)],l=e[n-1];p=t=[e[0],a,a,l]}return{isBulged:o,bezierNew:p}}(e,n),{isBulged:a,bezierNew:l}=t;a&&(n=l)}if(0===o||o<l)return[n];if(o<l*l){let r=s,i=o,u=p;for(let h=0;h<20;h++){r=bt(n,e,r);let h=Mt(e,s,r,t,a);if(n=h[0],o=h[1],p=h[2],o<l)return[n];if(p===u){let e=o/i;if(e>.9999&&e<1.0001)break}i=o,u=p}}let u=[],h=Ct(e[p-1],e[p+1]);if(0===h.x&&0===h.y){h=Ct(e[p-1],e[p]);let t={x:-h.y,y:h.x};h.x=t.x,h.y=t.y}let y=function(e){let t=Math.sqrt(e.x*e.x+e.y*e.y);return 0===t?{x:0,y:0}:{x:e.x/t,y:e.y/t}}(h),c=Pt(y,-1);return e.length,u.push(...vt(e.slice(0,p+1),t,y,l,r),...vt(e.slice(p),c,a,l,r)),u}function Mt(e,t,a,l,r){let n,s,i;n=function(e,t,a,l){let r,n,s,i,o=e[0],p=e[e.length-1],u=[o,null,null,p],h=function(e){let t=[];for(;e--;)t.push([0,0]);return t}(t.length),y=t.length;for(let e=0;e<y;e++)s=t[e],i=1-s,r=h[e],r[0]=Pt(a,3*s*(i*i)),r[1]=Pt(l,3*i*(s*s));let c=[[0,0],[0,0]],x=[0,0],f=e.length;for(let a=0;a<f;a++)s=t[a],r=h[a],c[0][0]+=Lt(r[0],r[0]),c[0][1]+=Lt(r[0],r[1]),c[1][0]+=Lt(r[0],r[1]),c[1][1]+=Lt(r[1],r[1]),n=Ct(e[a],H([o,o,p,p],s)),x[0]+=Lt(r[0],n),x[1]+=Lt(r[1],n);let g=c[0][0]*c[1][1]-c[1][0]*c[0][1],m=c[0][0]*x[1]-c[1][0]*x[0],d=x[0]*c[1][1]-x[1]*c[0][1],v=0===g?0:d/g,M=0===g?0:m/g,b=ne(o,p,!1),A=1e-6*b;return v<A||M<A?(u[1]=kt(o,Pt(a,.333*b)),u[2]=kt(p,Pt(l,.333*b))):(u[1]=kt(o,Pt(a,v)),u[2]=kt(p,Pt(l,M))),u}(e,a,l,r);let o=function(e,t,a){let l,r,n,s,i,o;r=0,n=Math.floor(.5*e.length);let p=function(e,t){let a,l=[0],r=e[0],n=0;for(let s=1;s<=t;s++)a=H(e,s/t),n+=ne(a,r),l.push(n),r=a;return l=l.map(e=>e/n),l}(t,10),u=e.length,h=null;for(s=0;s<u;s++)i=e[s],o=At(a[s],p,10),h=H(t,o),l=se(h,i),l>r&&(r=l,n=s);return[r,n]}(e,n,t);return s=o[0],i=o[1],[n,s,i]}function bt(e,t,a){return a.map((a,l)=>function(e,t,a){let l=H(e,a),r=l.x-t.x,n=l.y-t.y,s=Et(e,a),i=r*s[0]+n*s[1],o=s[0]*s[0]+s[1]*s[1],p=Et(e,a,!0),u=2*(r*p[0]+n*p[1]),h=o+u;if(Math.abs(h)<1e-10)return a;return a-i/h}(e,t[l],a))}function At(e,t,a){if(e<0)return 0;if(e>1)return 1;let l,r,n,s,i;for(let o=1;o<=a;o++)if(e<=t[o]){s=(o-1)/a,n=o/a,r=t[o-1],l=t[o],i=(e-r)/(l-r)*(n-s)+s;break}return i}function wt(e,t){let a=e.x-t.x,l=e.y-t.y,r=Math.sqrt(a*a+l*l);return 0===r?{x:0,y:0}:{x:a/r,y:l/r}}function Ct(e,t){return{x:e.x-t.x,y:e.y-t.y}}function kt(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Pt(e,t){return{x:e.x*t,y:e.y*t}}function Lt(e,t){return e.x*t.x+e.y*t.y}function Et(e,t,a=!1){let l,r,n=e[0],s=e[1],i=e[2],o=e[3],p=t,u=1-p,h=u*u,y=p*p;return a?(l=6*u*(i.x-2*s.x+n.x)+6*p*(o.x-2*i.x+s.x),r=6*u*(i.y-2*s.y+n.y)+6*p*(o.y-2*i.y+s.y)):(l=3*h*(s.x-n.x)+6*u*p*(i.x-s.x)+3*y*(o.x-i.x),r=3*h*(s.y-n.y)+6*u*p*(i.y-s.y)+3*y*(o.y-i.y)),[l,r]}function St(e,{debug:t=!1,width:a=0,height:l=0,denoise:r=.9,keepCorners:n=!0,keepExtremes:s=!0,keepInflections:i=!1,manhattan:o=!1,absolute:p=!1,closed:u=!0,tolerance:h=1,simplifyRD:y=1,simplifyRDP:c=1}={}){let x=s||n?function(e,{x:t=0,y:a=0,width:l=0,height:r=0,debug:n=!1}={}){let s=e.length,i=xe(e);l&&r||({x:t,y:a,width:l,height:r}=i);let o=.01*(l+r);for(let t=0;t<s;t++){let a=t>0?e[t-1]:e[s-1],l=e[t],r=de([a,l,t<s-1?e[t+1]:e[s-1]],!1);l.area=r,l.dist=ie(a,l),l.idx=t}for(let t=0;t<s;t++){t>1?e[t-2]:e[s-1];let a=t>0?e[t-1]:e[s-1],l=e[t],r=t<s-1?e[t+1]:e[s-1];se(a,r),Math.abs(a.area);let n=Math.abs(l.area);Math.abs(r.area);let p=!1,u=!l.area||n<o;ie(l,a);let h=!1;l.x!==i.left&&l.x!==i.right&&l.y!==i.top&&l.y!==i.bottom||(h=!0);let y=l.y===a.y&&l.x!==a.x,c=l.x===a.x&&l.y!==a.y;(y||c)&&(a.isExtreme=!0,h=!0);let x=xe([a,r]),{left:f,right:g,top:m,bottom:d}=x,v=l.x<f||l.x>g||l.y<m||l.y>d;!h&&v&&(h=!0);let M=(a.area<0&&l.area>0||a.area>0&&l.area<0)&&!u&&!a.isDirChange;if(h){let e=R(l,r,a),{deltaAngleDeg:t}=e;t=Math.abs(t),t>10&&t<160&&(p=!0)}l.isCorner=p,l.isExtreme=h,l.isHorizontal=y,l.isVertical=c,l.isDirChange=M}let p=[],u=[];for(let t=0;t<e.length;t++){let a=e[t],l=e[t+1]||null,r=e[t+2]||null,n=[];if(l&&l.isExtreme&&a.isExtreme&&!a.isCorner){let e=l.dist<2*o&&!l.isCorner,s=r&&r.isExtreme&&r.dist<2*o&&!r.isCorner;if(e&&!s?n.push(a,l):s&&n.push(a,l,r),n.length){let e=n.reduce((e,t)=>e+t.x,0)/n.length,l=n.reduce((e,t)=>e+t.y,0)/n.length;a.x=e,a.y=l,t+=n.length-1}}(a.isExtreme||a.isCorner||a.isDirChange)&&u.push(p.length),p.push(a);let s=p.length,i=p[0],h=p[s-1],y=ie(i,h)<2*o;i.isExtreme&&h.isExtreme&&y&&(h.x=i.x,h.y=i.y)}return p}(e,{debug:!1}):e,f=s||n?function(e,{closed:t=!0,keepCorners:a=!0,keepExtremes:l=!0,keepInflections:r=!1}={}){let n=[[e[0]]],s=0,i=n[s],o=e.length;for(let t=1;t<o;t++){t>0?e[t]:e[o-1];let r=e[t];t<o-1?e[t+1]:e[o-1],(l&&r.isExtreme||a&&r.isCorner)&&(s++,n.push([])),i=n[s],i.push(r)}return n}(x,{keepCorners:n,keepExtremes:s,keepInflections:i}):[x],g=function(e=[],{closed:t=!0,keepCorners:a=!0,tolerance:l=1}={}){let r=e.length,n=[{type:"M",values:[e[0][0].x,e[0][0].y]}];for(let t=0;t<r;t++){let r=e[t],s=e[t+1]?e[t+1]:null,i=[],o=r.length;r[r.length-1],s&&r.push(s[0]),o<2||2===o&&r[1].isExtreme?(r[r.length-1],i=r.map(e=>({type:"L",values:[e.x,e.y]}))):i=dt(r,{maxError:l,keepCorners:a}),n.push(...i)}t&&n.push({type:"Z",values:[]});return n}(f,{closed:u,tolerance:a&&l?(a+l)/2*.004*h:2.5,keepCorners:n});return g}function Dt(e,{precisionPoly:t=1,autoAccuracy:a=!1,polyFormat:l="points",decimals:r=-1,simplifyRD:n=1,simplifyRDP:s=1}={}){let i=e.length,o=[],p=[{x:e[0].values[0],y:e[0].values[1]}],u=[];for(let t=1;t<i;t++){let a=e[t],{type:l,values:r,p0:n,p:s,dimA:i=0}=a;u.push(+i.toFixed(8)),p.push(s)}let h=[p[0]];u=u.filter(Boolean).sort();let y=u[u.length-1];t*=y>2&&y<25?1:20/y;for(let a=1;a<i;a++){let l=e[a],{type:r,values:n,p0:s,p:i,cp1:o=null,cp2:p=null,dimA:u}=l,y=u,c=o&&p?[s,o,p,i]:o?[s,o,i]:[];if(c.length){let e=p?Z(o,p,.5):o;y=.2*(ie(s,e)+ie(i,e))+u}let x=Math.ceil(.2*y*t),f=Math.ceil(x);if(f&&c.length){let e=f?1/(f+1):0;for(let t=1;t<=f;t++){let a=H(c,e*t);h.push(a)}}h.push(i)}n>0&&(h=gt(h,{quality:n+"px"})),s>0&&(h=ft(h,{quality:s+"px"})),o=mt(h),e=o,a&&(r=function(e){let t=[];for(let a=1,l=e.length;a<l;a++){let l=e[a],{p0:r=null,p:n=null,dimA:s=0}=l;n&&r&&(s=s||ie(r,n),s&&t.push(s))}let a=t.sort(),l=Math.ceil(a.length/8);a=a.slice(0,l);let r=a.reduce((e,t)=>e+t,0)/l,n=r>112.5?0:Math.floor(75/r).toString().length;return Math.min(Math.max(0,n),8)}(p));let c=r>-1?h.map(e=>({x:ke(e.x,r),y:ke(e.y,r)})):h.map(e=>({x:e.x,y:e.y}));return"array"===l?c=c.map(e=>[e.x,e.y]):"string"===l&&(c=c.map(e=>[e.x,e.y].join(",")).join(" ")),{pathData:e,poly:c}}function Tt(e){for(let t=1,a=e.length;t<a;t++){let a=e[t],{type:l,values:r,p0:n,cp1:s=null,cp2:i=null,p:o=null}=a;if("L"===l){let a=Z(n,o,.333),l=Z(o,n,.333);e[t].type="C",e[t].values=[a.x,a.y,l.x,l.y,o.x,o.y],e[t].cp1=a,e[t].cp2=l}}return e}function It(e=[],t=!1){let a=[];e.forEach((e,t)=>{let l=function(e=[],{precision:t=1}={}){let a=[];for(let t=0;t<e.length;t++){let l=e[t],r=t>0?e[t-1]:e[t],{type:n,values:s}=l,i={x:r.values[r.values.length-2],y:r.values[r.values.length-1]},o=s.length?{x:s[s.length-2],y:s[s.length-1]}:"",p=s.length?{x:s[0],y:s[1]}:"";switch(n){case"A":ze(i,s).forEach(e=>{let t=e.values,l={x:t[0],y:t[1]},r={x:t[2],y:t[3]},n={x:t[4],y:t[5]};a.push(l,r,n)});break;case"C":let e={x:s[2],y:s[3]};a.push(p,e);break;case"Q":a.push(p)}"z"!==n.toLowerCase()&&a.push(o)}return a}(e.pathData),r=de(l)>=0;a.push({pts:l,bb:xe(l),cw:r,index:t,inter:0,includes:[],includedIn:[]})});let l=a.length;for(let e=0;e<l;e++){let t=a[e],r=t.bb;for(let n=0;n<l;n++){let l=a[n],s=l.bb;e===n||l.includes.includes(e)||U({x:s.left+s.width/2,y:s.top+s.height/2},t.pts,r)&&(a[n].inter+=1,l.includedIn.push(e),t.includes.push(n))}}for(let r=0;r<l;r++){let l=a[r],{cw:n,includedIn:s,includes:i}=l;(!s.length&&n&&!t||!s.length&&!n&&t)&&(e[r].pathData=_e(e[r].pathData),a[r].cw=!a[r].cw,n=a[r].cw);for(let t=0;t<i.length;t++){let l=i[t];a[l].cw===n&&(e[l].pathData=_e(e[l].pathData),a[l].cw=!a[l].cw)}}return e}function Ft(e,{toObject:t=!0,toArray:a=!1,flatten:l=!1}={}){l&&(e=e.flat(2));let r=a?function(e){if(!Array.isArray(e[0][0])&&2===e[0].length)return e;let t=[];if(Array.isArray(e[0][0])&&2===e[0][0].length)return e.forEach(e=>{t.push(e.map(e=>[e.x,e.y]))}),t;return t=Array.from(e).map(e=>[e.x,e.y]),t}(e):function(e){if(void 0!==e[0].x&&void 0!==e[0].y)return e;let t=[];if(Array.isArray(e[0])&&void 0!==e[0][0].x&&void 0!==e[0][0].y)return e;if(Array.isArray(e[0][0])&&2===e[0][0].length)return e.forEach(e=>{t.push(e.map(e=>({x:e[0],y:e[1]})))}),t;return e.map(e=>({x:e[0],y:e[1]}))}(e);return r}function $t(e="",{getObject:t=!1,toAbsolute:a=!1,toRelative:l=!0,toShorthands:r=!0,toLonghands:n=!1,quadraticToCubic:s=!0,arcToCubic:i=!1,cubicToArc:o=!1,simplifyBezier:p=!0,optimizeOrder:u=!0,autoClose:h=!1,removeZeroLength:y=!0,refineClosing:c=!0,removeColinear:x=!0,flatBezierToLinetos:f=!0,revertToQuadratics:g=!0,refineExtremes:m=!0,simplifyCorners:d=!1,removeDimensions:v=!1,removeIds:M=!1,removeClassNames:b=!1,omitNamespace:A=!1,fixDirections:w=!1,keepExtremes:C=!0,keepCorners:k=!0,extrapolateDominant:P=!0,keepInflections:L=!1,addExtremes:E=!1,addSemiExtremes:S=!1,toPolygon:D=!1,smoothPoly:T=!1,polyFormat:I="points",precisionPoly:F=1,simplifyRD:$=1,simplifyRDP:q=1,harmonizeCpts:j=!1,removeOrphanSubpaths:z=!1,simplifyRound:Q=!1,scale:B=1,scaleTo:N=0,crop:O=!1,alignToOrigin:R=!1,decimals:G=3,autoAccuracy:U=!0,minifyD:Z=0,tolerance:H=1,reversePath:V=!1,cleanupSVGAtts:J=!0,removePrologue:X=!0,stylesToAttributes:Y=!0,fixHref:_=!0,removeNameSpaced:K=!0,attributesToGroup:ee=!1,mergePaths:te=!1,removeHidden:ae=!0,removeUnused:le=!0,shapesToPaths:re=!1,lineToCubic:ne=!1}={}){H=Math.max(.1,H),B=Math.max(.001,B);let se=function(e){let t="string";if(Array.isArray(e)){if(Array.isArray(e[0])){if(2===e[0].length)return"polyArray";if(Array.isArray(e[0][0])&&2===e[0][0].length)return"polyComplexArray";if(void 0!==e[0][0].x&&void 0!==e[0][0].y)return"polyComplexObjectArray"}else{if(void 0!==e[0].x&&void 0!==e[0].y)return"polyObjectArray";if(e[0]?.type&&e[0]?.values)return"pathData"}return"array"}if("string"==typeof e){let a=(e=e.trim()).includes("<svg")&&e.includes("</svg"),l=e.startsWith("M")||e.startsWith("m"),r=!isNaN(e.substring(0,1))&&!isNaN(e.substring(e.length-1,e.length));if(a)t="svgMarkup";else if(l)t="pathDataString";else if(r)t="polyString";else{let a=/^(file:|https?:\/\/|\/|\.\/|\.\.\/)/.test(e),l=e.startsWith("data:image");t=a||l?"url":"string"}return t}return t=typeof e,(e.constructor.name||t).toLowerCase()}(e),ie="",oe=0,pe=0,he=0,ye={},fe="",ge="svgMarkup"===se?1:0,me=[],de=[],Me=[],Ae="";oe=e.length;let we={x:0,y:0,width:0,height:0},ke={x:0,y:0,width:0,height:0},Pe=[],Ee=[];if(i=!!D||i,"svgMarkup"!==se){if("pathDataString"===se)fe=e;else if("polyString"===se)fe="M"+e;else if("polyArray"===se||"polyObjectArray"===se||"polyComplexArray"===se||"polyComplexObjectArray"===se){fe=mt(Ft(e)),Ae=fe.map(e=>`${e.type} ${e.values.join(" ")}`).join(" "),oe=Ae.length}else"pathData"===se&&(fe=e,Ae=Array.from(fe).map(e=>`${e.type} ${e.values.join(" ")}`).join(" "),oe=Ae.length);de.push({d:fe,el:null})}else{if(ie=nt(e,{removeIds:M,removeClassNames:b,removeDimensions:v,cleanupSVGAtts:J,returnDom:!0,removeHidden:ae,removeUnused:le,removeNameSpaced:K,stylesToAttributes:Y,removePrologue:X,fixHref:_,mergePaths:te,shapesToPaths:re}),re){ie.querySelectorAll("polygon, polyline, line, rect, circle, ellipse").forEach(e=>{let t=Ze(e);e.replaceWith(t)})}ie.querySelectorAll("path").forEach((e,t)=>{de.push({d:e.getAttribute("d"),el:e,idx:t})}),we=function(e=null,t=-1){const a=e=>e&&isNaN(e)?e.match(/[^\d|.]+/g)[0]:"";if(!e)return!1;let l=e.hasAttribute("width"),r=e.hasAttribute("height"),n=e.hasAttribute("viewBox"),s=l?e.getAttribute("width"):0,i=r?e.getAttribute("height"):0,o=!!l&&a(s),p=!!r&&a(s),u=s?s.includes("%")?0:parseFloat(s):300,h=i?i.includes("%")?0:parseFloat(i):150,y=n?e.getAttribute("viewBox").split(/,| /).filter(Boolean).map(Number):[0,0,u,h];return t>-1&&([u,h]=[u,h].map(e=>+e.toFixed(t)),y=y.map(e=>+e.toFixed(t))),{x:y[0],y:y[1],width:y[2],height:y[3],w:u,h:h,hasViewBox:n,hasWidth:l,hasHeight:r,widthUnit:o,heightUnit:p}}(ie,G)}let De={toRelative:l,toAbsolute:a,toLonghands:n,toShorthands:r,decimals:G},Te=[];for(let e=0,t=de.length;t&&e<t;e++){let t=[],a=de[e],{d:l,el:r}=a,n=Qe(l,{quadraticToCubic:s,arcToCubic:i}),h=T||D?xe(W(n)):null;if(1!==B||N){if(N)if(we.width&&!O)B=N/we.width;else{let e=n.map(e=>({type:e.type,values:e.values}));e=Se(e,{arcToCubic:!0}),e=ce(e);let t=xe(W(e));Pe.push(t.x,t.x+t.width),Ee.push(t.y,t.y+t.height);let a=N/t.width;B=a}n=ht(n,B)}let v=n.length;z&&(n=We(n));let M=ue(n),b=M.length;for(let e=0;e<b;e++){let a=M[e],l=[],r=Array.from(new Set(a.map(e=>e.type))).join(""),n=!/[acqts]/gi.test(r),s=/[z]/gi.test(r);if(n)l=W(a),$>0&&(l=gt(l,{quality:$+"px"})),q>0&&(l=ft(l,{quality:q+"px"})),a=mt(l,s);else if(D){p=!1,T=!1;let e=Le(a),{bb:t,pathData:l}=e;a=l;let r=Dt(a,{precisionPoly:F,autoAccuracy:U,polyFormat:I,decimals:G,simplifyRD:$,simplifyRDP:q});Me.push(r.poly),a=r.pathData}if(T&&n){a=Ve(a),a=St(W(a),{denoise:.8,tolerance:H,width:h.width,height:h.height,manhattan:!1,absolute:!1,keepCorners:k,keepExtremes:C,keepInflections:L,closed:s,simplifyRD:$,simplifyRDP:q})}(x||y)&&(a=Ve(a)),u&&(a=Je(a)),x&&(a=He(a,{tolerance:H,flatBezierToLinetos:!1})),(E||S)&&(a=ce(a,{tMin:0,tMax:1,addExtremes:E,addSemiExtremes:S,angles:[30]})),V&&(a=_e(a));let i=Le(a,{detectSemiExtremes:S}),{pathData:v,bb:b,dimA:A}=i;if(Pe.push(b.x,b.x+b.width),Ee.push(b.y,b.y+b.height),c&&(v=ut(v,{threshold:.001*A})),v=p?be(v,{simplifyBezier:p,keepInflections:L,keepExtremes:C,keepCorners:k,extrapolateDominant:P,revertToQuadratics:g,tolerance:H}):v,m){v=Ke(v,{threshold:.05*(b.width+b.height),tolerance:H})}if(o&&(v=ct(v,{areaThreshold:2.5})),x&&f&&(v=He(v,{tolerance:H,flatBezierToLinetos:f})),d){v=it(v,{threshold:.1*(b.width+b.height),tolerance:H})}Q&&(v=pt(v)),g&&(v=yt(v,H)),ne&&(v=Tt(v)),u&&(v=Xe(v,{autoClose:false})),t.push({pathData:v,bb:b})}let A=Math.min(...Pe),j=Math.min(...Ee);ke={x:A,y:j,width:Math.max(...Pe)-A,height:Math.max(...Ee)-j};let J=ke.height>ke.width;if(u&&(t=J?t.sort((e,t)=>e.bb.y-t.bb.y||e.bb.x-t.bb.x):t.sort((e,t)=>e.bb.x-t.bb.x||e.bb.y-t.bb.y)),w&&(t=It(t)),n=[],me.push(t),t.forEach(e=>{n.push(...e.pathData)}),U&&(G=Ce(n),De.decimals=G),r&&te)Te.push(...n);else{n=n.map(e=>({type:e.type,values:[...e.values]})),n=Se(n,De),y&&(n=Ve(n)),R&&(n[0].values[0]=(n[0].values[0]-ke.x).toFixed(G),n[0].values[1]=(n[0].values[1]-ke.y).toFixed(G),ke.x=0,ke.y=0);let e=n.length,t=ve(n,Z);pe=t.length,he=+(100/oe*pe).toFixed(2),a.d=t,a.report={original:v,new:e,saved:v-e,compression:he,decimals:G},r&&r.setAttribute("d",t)}}if(ge){if(Te.length){let e=Se(Te,De);e=Ve(e);let t=ve(e,Z);de[0].el.setAttribute("d",t);for(let e=1;e<de.length;e++){let t=de[e].el;t&&t.remove()}!function(e){e.querySelectorAll("g, defs").forEach(e=>{e.children.length||e.remove()})}(ie)}if(B){let{x:e,y:t,width:a,height:l,w:r,h:n,hasViewBox:s,hasWidth:i,hasHeight:o,widthUnit:p,heightUnit:u}=we;O&&(e=ke.x,t=ke.y,a=ke.width,l=ke.height,r=a,n=l),s&&ie.setAttribute("viewBox",[e,t,a,l].map(e=>+(e*B).toFixed(G)).join(" ")),i&&ie.setAttribute("width",+(r*B).toFixed(G)+p),o&&ie.setAttribute("height",+(n*B).toFixed(G)+u)}if(w){ie.querySelectorAll("path[fill-rule], path[clip-rule]").forEach(e=>{e.removeAttribute("fill-rule"),e.removeAttribute("clip-rule")})}ie=st(ie,A),pe=ie.length,he=+(100/oe*pe).toFixed(2),oe=+(oe/1024).toFixed(3),pe=+(pe/1024).toFixed(3),ye={svgSize:oe,svgSizeOpt:pe,compression:he,decimals:G}}else({d:fe,report:ye}=de[0]);return Me.length&&1===Me.length&&(Me=Me[0]),t?{svg:ie,d:fe,polys:Me,report:ye,pathDataPlusArr:me,inputType:se}:fe||ie}"undefined"!=typeof window&&(window.svgPathSimplify=$t);export{b as PI,a as abs,l as acos,r as asin,n as atan,s as atan2,i as ceil,o as cos,p as exp,u as floor,y as hypot,h as log,c as max,x as min,f as pow,g as random,m as round,d as sin,v as sqrt,$t as svgPathSimplify,M as tan};
3
+ if(C){let e="C"===r?Math.abs(l.cp2.x-l.p.x):Math.abs(l.cp1.x-l.p.x),t="C"===r?Math.abs(l.cp2.y-l.p.y):Math.abs(l.cp1.y-l.p.y);if(((0===t||t<w)&&e>0||(0===e||e<w)&&t>0)&&(S=!0),p.x!==u&&p.y!==y&&p.x!==c&&p.y!==x||(S=!0),!S){if(ee(null,M)){let e=le(M);e.length&&e[0]>.2&&(S=!0)}}}if(S&&(l.extreme=!0),C&&k){if(n&&!l.extreme){let e=Math.abs(p.x-f.x),t=Math.abs(p.y-f.y),a=!1;if(e&&t&&e>A||t>A){let e=_(f,p),t=_(p,b.cp1);a=se(Math.abs(e+t)/2)}a&&(l.semiExtreme=!0)}if((l.cptArea<0&&b.cptArea>0||l.cptArea>0&&b.cptArea<0)&&(l.directionChange=!0),!l.extreme){let e=f||h,t=b.cp1,a=Fe([e,p,t],!1),r=.01*oe(e,t),n=Math.abs(a)<r,s=a<0&&l.cptArea>0||a>0&&l.cptArea<0;!n&&s&&(l.corner=!0)}}s&&(l.directionChange&&e(markers,l.p,"orange","1.5%","0.5"),l.corner&&e(markers,l.p,"magenta","1.5%","0.5"),l.extreme&&e(markers,l.p,"cyan","1%","0.5")),d.push(l)}return p={pathData:d,bb:h,dimA:(f+g)/2},p}function Oe(e,{addSquareLength:t=!0,addArea:a=!1,addArcParams:l=!1,addAverageDim:r=!0}={}){let n=e[0],s={x:n.values[0],y:n.values[1]},i=s,o=s;n.p0=i,n.p=o,n.idx=0,n.dimA=0;let p=e.length,h=[n];for(let r=1;r<p;r++){let n,p,u=e[r],{type:c,values:y}=u,x=y.length;if(o=x?{x:y[x-2],y:y[x-1]}:s,u.p0=i,u.p=o,u.dimA=pe(i,o),"M"===c&&(s=o),"Q"===c||"C"===c)n={x:y[0],y:y[1]},p="C"===c?{x:y[2],y:y[3]}:null,u.cp1=n,p&&(u.cp2=p);else if("A"===c&&l){let{rx:e,ry:t,cx:a,cy:l,startAngle:r,endAngle:n,deltaAngle:s}=J(i.x,i.y,...y);u.cx=a,u.cy=l,u.rx=e,u.ry=t,u.xAxisRotation=y[2]/180*Math.PI,u.largeArc=y[3],u.sweep=y[4],u.startAngle=r,u.endAngle=n,u.deltaAngle=s}if("Z"===c&&s.x!==o.x&&s.y!==o.y&&(u.closePath=!0),t&&(u.squareDist=oe(i,o)),a){let e=0;"C"===c&&(e=Fe([i,n,p,o],!1)),"Q"===c&&(e=Fe([i,n,o],!1)),u.cptArea=e}u.idx=r,i=o,h.push(u)}return h}const Re=new Set([77,109,65,97,67,99,76,108,81,113,83,115,84,116,72,104,86,118,90,122]),_e=new Uint8Array(128);_e[77]=2,_e[109]=2,_e[65]=7,_e[97]=7,_e[67]=6,_e[99]=6,_e[76]=2,_e[108]=2,_e[81]=4,_e[113]=4,_e[83]=4,_e[115]=4,_e[84]=2,_e[116]=2,_e[72]=1,_e[104]=1,_e[86]=1,_e[118]=1,_e[90]=0,_e[122]=0;const Ge=new Set([5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279]),Ue=e=>32===e||44===e||10===e||13===e||8232===e||8233===e||9===e||11===e||12===e||160===e||e>=5760&&Ge.has(e);function Ve(e,t=!0,a=0){e=e.trim(),a&&console.log("!!!limit",a);let l={pathData:[],hasRelatives:!1,hasShorthands:!1,hasArcs:!1,hasQuadratics:!1,isPolygon:!1,log:[]};if(""===e)return l;let r,n=0,s=e.length,i="",o=-1,p="",h=!1,u=0,c=0,y=0,x=!1,f=new Set([]);const g=()=>{x&&("M"===i?i="L":"m"===i&&(i="l"),l.pathData.push({type:i,values:[]}),o++,c=0,x=!1)},d=(e=!1)=>{(e?u>0:""!==p)&&(t&&-1===o&&(r="Pathdata must start with M command",l.log.push(r),i="M",l.pathData.push({type:i,values:[]}),y=2,c=0,o++),"A"===i||"a"===i?(({val:p,valueIndex:c}=((e="",t=0)=>{let a=e.length;return 3===t&&2===a?(e=[+e[0],+e[1]],t++):4===t&&a>1?(e=[+e[0],+e.substring(1)],t++):3===t&&a>=3?(e=[+e[0],+e[1],+e.substring(2)],t+=2):e=[+e],{val:e,valueIndex:t}})(p,c)),l.pathData[o].values.push(...p)):(t&&p[1]&&"."!==p[1]&&"0"===p[0]&&(r=`${o}. command: Leading zeros not valid: ${p}`,l.log.push(r)),l.pathData[o].values.push(+p)),c++,p="",u=0,x=c>=y)},m=()=>{if(o>0){let e=l.pathData[o].values.length;if(e&&e<y||e&&e>y||("z"===i||"Z"===i)&&e>0){r=`${o}. command of type "${i}": ${y-e} values too few - ${y} expected`,l.log[l.log.length-1]!==r&&l.log.push(r)}}};let v=!1,b=!1,M=!1,A="";for(;n<s;){A=e.charCodeAt(n);let a=A>47&&A<58;if(a||(v=101===A||69===A,b=45===A||43===A,M=46===A),a||b||M||v){if(h||45!==A&&46!==A)g();else{let e=46===A;d(e),g(),e&&u++}p+=e[n],h=v,n++}else if((A<48||A>5759)&&Ue(A))d(),n++;else{if(A>64){if(!Re.has(A)){r=`${o}. command "${e[n]}" is not a valid type`,l.log.push(r),n++;continue}""!==p&&(l.pathData[o].values.push(+p),c++,p=""),t&&m(),i=e[n],y=_e[A];let a="M"===i||"m"===i,s=o>0&&("z"===l.pathData[o].type||"Z"===l.pathData[o].type);f.add(i),s&&!a&&(l.pathData.push({type:"m",values:[0,0]}),o++),l.pathData.push({type:i,values:[]}),o++,u=0,c=0,x=!1,n++;continue}a||(r=`${o}. ${e[n]} is not a valid separarator or token`,l.log.push(r),p=""),n++}}d(),t&&m(),t&&l.log.length&&(r="Invalid path data:\n"+l.log.join("\n"),"log"===t?console.log(r):console.warn(r)),l.pathData[0].type="M";let w=Array.from(f).join("");return l.hasRelatives=/[lcqamtsvh]/g.test(w),l.hasShorthands=/[vhst]/gi.test(w),l.hasArcs=/[a]/gi.test(w),l.hasQuadratics=/[qt]/gi.test(w),l.isPolygon=!/[cqats]/gi.test(w),l}function Ze(e,{toAbsolute:t=!0,toLonghands:a=!0,quadraticToCubic:l=!1,arcToCubic:r=!1,arcAccuracy:n=4}={}){let s=Array.isArray(e),i=s&&"object"==typeof e[0]&&"function"==typeof e[0].constructor,o=s?e:Ve(e),{hasRelatives:p=!0,hasShorthands:h=!0,hasQuadratics:u=!0,hasArcs:c=!0}=o,y=i?o:o.pathData;return y=function(e=[],{toAbsolute:t=!0,toLonghands:a=!0,quadraticToCubic:l=!1,arcToCubic:r=!1,arcAccuracy:n=2,hasRelatives:s=!0,hasShorthands:i=!0,hasQuadratics:o=!0,hasArcs:p=!0,testTypes:h=!1}={}){return He(e,{toAbsolute:t,toLonghands:a,quadraticToCubic:l,arcToCubic:r,arcAccuracy:n,hasRelatives:s,hasShorthands:i,hasQuadratics:o,hasArcs:p,testTypes:h,decimals:-1})}(y,{toAbsolute:t,toLonghands:a,quadraticToCubic:l,arcToCubic:r,arcAccuracy:n,hasRelatives:p,hasShorthands:h,hasQuadratics:u,hasArcs:c}),y}function He(e,{toShorthands:t=!0,toLonghands:a=!1,toRelative:l=!0,toAbsolute:r=!1,decimals:n=3,arcToCubic:s=!1,quadraticToCubic:i=!1,hasRelatives:o=!0,hasShorthands:p=!0,hasQuadratics:h=!0,hasArcs:u=!0,testTypes:c=!1}={}){if(c){let t=Array.from(new Set(e.map(e=>e.type))).join("");/[lcqamts]/gi.test(t),h=/[qt]/gi.test(t),u=/[a]/gi.test(t),p=/[vhst]/gi.test(t),isPoly=/[mlz]/gi.test(t)}return l=!r&&l,t=!a&&t,h&&i&&(e=function(e){let t=[e[0]];for(let a=1,l=e.length;a<l;a++){let l=e[a],r=e[a-1].values,n=r.length,s={x:r[n-2],y:r[n-1]};"Q"===l.type?t.push(Je(s,l.values)):t.push(l)}return t}(e)),t&&(e=function(e,t=-1,a=!1){let l;if(a){let t=e.map(e=>e.type).join("");l=/[astvqmhlc]/g.test(t)}e=a&&l?Xe(e):e;let r=e.length,n=new Array(r),s=e[0];n[0]=s;let i={x:e[0].values[0],y:e[0].values[1]},o=i;for(let t=1;t<r;t++){let a=e[t];s=a;let{type:l,values:r}=a,p=r.length,h=[r[p-2],r[p-1]],u=e[t-1];o={x:h[0],y:h[1]};let c=Math.abs(o.x-i.x),y=Math.abs(o.y-i.y),x=.01*pe(i,o),f=!1,g=!1,d=!1;if("C"===l&&"C"===u.type||"Q"===l&&"Q"===u.type){let e="C"===u.type?{x:u.values[2],y:u.values[3]}:{x:u.values[0],y:u.values[1]},t={x:r[0],y:r[1]},a=i.x-e.x,l=i.y-e.y;x=.025*pe(e,t),f=pe({x:e.x+2*a,y:e.y+2*l},t)<x}else"L"===l&&(g=0===y||y<x,d=0===c||c<x,f=d||g);switch(l){case"L":g&&(s={type:"H",values:[r[0]]}),d&&(s={type:"V",values:[r[1]]});break;case"Q":f&&(s={type:"T",values:[o.x,o.y]});break;case"C":f&&(s={type:"S",values:[r[2],r[3],o.x,o.y]});break;default:s={type:l,values:r}}i=o,n[t]=s}return n}(e)),p&&a&&(e=function(e,t=-1,a=!0){let l=!1;if(a){let t=e.map(e=>e.type).join(""),a=/[hstv]/gi.test(t);if(l=/[astvqmhlc]/g.test(t),!a)return e}e=a&&l?Ye(e,t):e;let r=[],n={type:"M",values:e[0].values};r.push(n);for(let a=1,l=e.length;a<l;a++){let l,s,i,o,p,h,u,c,y=e[a],{type:x,values:f}=y,g=f.length,d=n.values,m=d.length,[v,b]=[f[g-2],f[g-1]],[M,A]=[d[m-2],d[m-1]];switch(x){case"H":n={type:"L",values:[f[0],A]};break;case"V":n={type:"L",values:[M,f[0]]};break;case"T":[l,s]=[d[0],d[1]],[M,A]=[d[m-2],d[m-1]],i=M+(M-l),o=A+(A-s),n={type:"Q",values:[i,o,v,b]};break;case"S":[l,s]=[d[0],d[1]],[M,A]=[d[m-2],d[m-1]],[u,c]=m>2&&"A"!==n.type?[d[2],d[3]]:[M,A],i=2*M-u,o=2*A-c,p=f[0],h=f[1],n={type:"C",values:[i,o,p,h,v,b]};break;default:n={type:x,values:f}}t>-1&&(n.values=n.values.map(e=>+e.toFixed(t))),r.push(n)}return r}(e)),r&&(e=Ye(e)),u&&s&&(e=function(e,{arcAccuracy:t=1}={}){let a=[e[0]];for(let l=1,r=e.length;l<r;l++){let r=e[l],n=e[l-1].values,s=n.length,i={x:n[s-2],y:n[s-1]};if("A"===r.type){et(i,r.values,t).forEach(e=>{a.push(e)})}else a.push(r)}return a}(e)),n>-1&&l&&(e=be(e,n)),l&&(e=function(e,t=-1){return Xe(e,!0,t)}(e)),n>-1&&(e=be(e,n)),e}function We(e={},t={},a={},l={},r=1){let n=Z(e,t,1.5),s=Z(l,a,1.5),i=.01*pe(e,l)*r,o=pe(n,s),p=null,h={type:"C",values:[t.x,t.y,a.x,a.y,l.x,l.y]};return o<i&&(p=U(e,t,l,a,!1,!0),p&&(h.type="Q",h.values=[p.x,p.y,l.x,l.y],h.p0=e,h.cp1=p,h.cp2=null,h.p=l)),h}function Je(e,t){Array.isArray(e)&&(e={x:e[0],y:e[1]});let a={x:e.x+2/3*(t[0]-e.x),y:e.y+2/3*(t[1]-e.y)},l={x:t[2]+2/3*(t[0]-t[2]),y:t[3]+2/3*(t[1]-t[3])};return{type:"C",values:[a.x,a.y,l.x,l.y,t[2],t[3]]}}function Xe(e,t=!1,a=-1){a>=0&&(e[0].values=e[0].values.map(e=>+e.toFixed(a)));let l=e.length,r=e[0].values,n=r[0],s=r[1],i=n,o=s;for(let r=1;r<l;r++){let l=e[r],{type:p,values:h}=l,u=h.length,c=p.toLowerCase(),y=p.toUpperCase(),x=t?c:y;if(p!==x)switch(l.type=x,c){case"a":h[5]=t?h[5]-n:h[5]+n,h[6]=t?h[6]-s:h[6]+s;break;case"v":h[0]=t?h[0]-s:h[0]+s;break;case"h":h[0]=t?h[0]-n:h[0]+n;break;case"m":t?(h[0]-=n,h[1]-=s):(h[0]+=n,h[1]+=s),i=t?h[0]+n:h[0],o=t?h[1]+s:h[1];break;default:if(h.length)for(let e=0;e<h.length;e++)h[e]=t?h[e]-(e%2?s:n):h[e]+(e%2?s:n)}switch(c){case"z":n=i,s=o;break;case"h":n=t?n+h[0]:h[0];break;case"v":s=t?s+h[0]:h[0];break;case"m":i=h[u-2]+(t?n:0),o=h[u-1]+(t?s:0);default:n=h[u-2]+(t?n:0),s=h[u-1]+(t?s:0)}a>=0&&(l.values=l.values.map(e=>+e.toFixed(a)))}return e}function Ye(e,t=-1){return Xe(e,!1,t)}function Ke({p0:e={x:0,y:0},p:t={x:0,y:0},centroid:a={x:0,y:0},rx:l=0,ry:r=0,xAxisRotation:n=0,radToDegree:s=!1,startAngle:i=null,endAngle:o=null,deltaAngle:p=null}={}){if(!l||!r)return[];let h=[];const u=1.5707963267948966;let c=s?n:n*Math.PI/180,y=Math.cos(c),x=Math.sin(c);null!==i&&null!==o&&null!==p||({startAngle:i,endAngle:o,deltaAngle:p}=G(a,e,t));let f=l!==r?K(i,l,r):i,g=l!==r?K(p,l,r):p,d=Math.max(1,Math.ceil(Math.abs(g)/u)),m=g/d;for(let e=0;e<d;e++){const e=Math.abs(m)===u?.551785*Math.sign(m):4/3*Math.tan(m/4);let t=Math.cos(f),n=Math.sin(f),s=Math.cos(f+m),i=Math.sin(f+m),o=[];[{x:t-n*e,y:n+t*e},{x:s+i*e,y:i-s*e},{x:s,y:i}].forEach(e=>{let t=e.x*l,n=e.y*r;o.push(y*t-x*n+a.x,x*t+y*n+a.y)}),h.push({type:"C",values:o,cp1:{x:o[0],y:o[1]},cp2:{x:o[2],y:o[3]},p:{x:o[4],y:o[5]}}),f+=m}return h}function et(e,t,a=1){const l=2*Math.PI;let[r,n,s,i,o,p,h]=t;if(0===r||0===n)return[];let u=s?s*l/360:0,c=u?Math.sin(u):0,y=u?Math.cos(u):1,x=y*(e.x-p)/2+c*(e.y-h)/2,f=-c*(e.x-p)/2+y*(e.y-h)/2;if(0===x&&0===f)return[];r=Math.abs(r),n=Math.abs(n);let g=x*x/(r*r)+f*f/(n*n);if(g>1){let e=Math.sqrt(g);r*=e,n*=e}let d=r*r,m=r===n?d:n*n,v=x*x,b=f*f,M=d*m-d*b-m*v;M<=0?M=0:(M/=d*b+m*v,M=Math.sqrt(M)*(i===o?-1:1));let A=M?M*r/n*f:0,w=M?M*-n/r*x:0,C=y*A-c*w+(e.x+p)/2,k=c*A+y*w+(e.y+h)/2,S=(x-A)/r,E=(f-w)/n,P=(-x-A)/r,L=(-f-w)/n;const D=(e,t,a,l)=>{let r=+(e*a+t*l).toFixed(9);return 1===r||-1===r?1===r?0:Math.PI:(r=r>1?1:r<-1?-1:r,(e*l-t*a<0?-1:1)*Math.acos(r))};let T=D(1,0,S,E),I=D(S,E,P,L);0===o&&I>0?I-=2*Math.PI:1===o&&I<0&&(I+=2*Math.PI);let $=(+(Math.abs(I)/(l/4)).toFixed(0)||1)*a;I/=$;let F=[];const q=1.5707963267948966,N=.551785;let z=I===q?N:I===-q?-N:4/3*Math.tan(I/4),j=I?Math.cos(I):1,B=I?Math.sin(I):0;const Q=(e,t,a,l,r)=>{let n=e!=t?Math.cos(e):l,s=e!=t?Math.sin(e):r,i=Math.cos(e+t),o=Math.sin(e+t);return[{x:n-s*a,y:s+n*a},{x:i+o*a,y:o-i*a},{x:i,y:o}]};for(let e=0;e<$;e++){let e={type:"C",values:[]};Q(T,I,z,j,B).forEach(t=>{let a=t.x*r,l=t.y*n;e.values.push(y*a-c*l+C,c*a+y*l+k)}),F.push(e),T+=I}return F}function tt(e,{areaThreshold:t=2.5}={}){for(let a=0,l=e.length;a<l;a++){let l=e[a],r=e[a+1]||null,{type:n,values:s,p0:i,cp1:o=null,cp2:p=null,p:h=null}=l;if("C"===n&&r&&"C"===r.type){let l=at(i,o,p,h,t),n=at(r.p0,r.cp1,r.cp2,r.p,t);if(l.isArc&&n.isArc){let t=.01*pe(i,r.p),s=Math.abs(r.p.x-i.x),o=Math.abs(r.p.y-i.y),p=o<t&&s>t,u=s<t&&o>t,{rx:c,ry:y}=l,x=Fe([i,h,r.p])<0?0:1;if(u||p){c=Math.min(c,n.rx),y=Math.min(y,n.ry),e[a]=null,e[a+1].type="A",e[a+1].values=[c,y,0,0,x,r.p.x,r.p.y];continue}}}}return e=e.filter(Boolean)}function at(e,t,a,l,r=7.5){let n,s={type:"C",values:[t.x,t.y,a.x,a.y,l.x,l.y]},i=0,o=!1,p=_(e,t,!0),h=_(l,a,!0),u=180*Math.abs(p-h)/Math.PI,c=0,y=0;if(Math.abs(u%180-90)<3){n=U(e,X(t,e.x,e.y,-.5*Math.PI),l,X(a,l.x,l.y,.5*Math.PI),!1);let p=U(e,t,l,a,!1);if(p){let n=ie(e,p),h=ie(l,p),u=+Math.max(n,h).toFixed(8),x=+Math.min(n,h).toFixed(8);c=x,y=u;let f=Fe([e,t,a,l])<0?0:1,g=Math.abs(l.x-e.x)>Math.abs(l.y-e.y);100/c*Math.abs(c-y)<5&&(c=u,y=c),g&&(c=u,y=x);let d=$e([{type:"M",values:[e.x,e.y]},{type:"C",values:[t.x,t.y,a.x,a.y,l.x,l.y]}]),m={type:"A",values:[c,y,0,0,f,l.x,l.y]};i=Math.PI*(c*y)/4,i-=Math.abs(Fe([e,l,p])),function(e,t){let a=Math.abs(e-t);return Math.abs(100-100/e*(e+a))}(d,i)<r&&(o=!0,s=m)}}return{com:s,isArc:o,area:i,rx:c,ry:y,centroid:n}}function lt(e=null,{autoRoundValues:t=!0,decimals:a=-1}={}){if(!e)return!1;let l=e.hasAttribute("width"),r=e.hasAttribute("height"),n=e.hasAttribute("viewBox"),s=l?e.getAttribute("width"):0,i=r?e.getAttribute("height"):0,o=s?s.includes("%")?0:Ee(s,{isHorizontal:!0}):300,p=i?i.includes("%")?0:Ee(i,{isVertical:!0}):150,h=n?e.getAttribute("viewBox").split(/,| /).filter(Boolean).map(Number):[0,0,o,p];t?([o,p]=[o,p].map(e=>ve(e)),h=h.map(e=>ve(e))):!t&&a>-1&&([o,p]=[o,p].map(e=>+e.toFixed(a)),h=h.map(e=>+e.toFixed(a)));let[u=0,c=0,y=0,x=0]=h;return n&&(o=y,p=x),{x:u,y:c,width:y,height:x,w:o,h:p,hasViewBox:n,hasWidth:l,hasHeight:r,widthUnit:"",heightUnit:""}}function rt(e,{width:t=0,height:a=0,convert_rects:l=!1,convert_ellipses:r=!1,convert_poly:n=!1,convert_lines:s=!1}={}){let i=e.nodeName.toLowerCase();if("path"===i||"rect"===i&&!l||("circle"===i||"ellipse"===i)&&!r||("polygon"===i||"polyline"===i)&&!n||"line"===i&&!s)return e;let o=function(e,{stringify:t=!1,width:a=0,height:l=0}={}){let r,n,s,i,o,p,h,u,c,y,x,f,g=[],d=e.nodeName.toLowerCase();if(!a||!l){let t=function(e){let t=e.parentNode.closest("svg");for(;t&&t.parentNode&&t.parentNode.closest;){let e=t.parentNode.closest("svg");if(!e)break;t=e}return t}(e),r=lt(t);a=r.width,l=r.height}let m=function(e,{width:t=0,height:a=0,fontSize:l=16,dpi:r=96,autoRoundValues:n=!1,decimals:s=-1}={}){let i=[...e.attributes],o=i.map(e=>e.name),p=i.map(e=>e.nodeValue),h=t===a,u={};return o.forEach((l,r)=>{let s=Me.includes(l),i=Ae.includes(l),o=!h&&"r"===l,c=Ee(p[r],{isHorizontal:s,isVertical:i,width:t,height:a,normalizedDiagonal:o,autoRoundValues:n});u[l]=c,e.setAttribute(l,c)}),u}(e,{width:a,height:l});switch(d){case"path":r=e.getAttribute("d"),g=Ze(r);break;case"rect":({x:n=0,y:s=0,width:a=0,height:l=0,rx:o=0,ry:p=0}=m),o||p?(o=o||p,p=p||o,o>a/2&&(o=a/2),p>l/2&&(p=l/2),g=[{type:"M",values:[n+o,s]},{type:"L",values:[n+a-o,s]},{type:"A",values:[o,p,0,0,1,n+a,s+p]},{type:"L",values:[n+a,s+l-p]},{type:"A",values:[o,p,0,0,1,n+a-o,s+l]},{type:"L",values:[n+o,s+l]},{type:"A",values:[o,p,0,0,1,n,s+l-p]},{type:"L",values:[n,s+p]},{type:"A",values:[o,p,0,0,1,n+o,s]},{type:"Z",values:[]}]):g=[{type:"M",values:[n,s]},{type:"L",values:[n+a,s]},{type:"L",values:[n+a,s+l]},{type:"L",values:[n,s+l]},{type:"Z",values:[]}];break;case"circle":case"ellipse":({cx:h=0,cy:u=0,r:i,rx:o,ry:p}=m);let t="circle"===d;t?(o=i,p=i):(o=o||i,p=p||i);let v=t&&i>=1?1:o,b=t&&i>=1?1:p;g=[{type:"M",values:[h+o,u]},{type:"A",values:[v,b,0,1,1,h-o,u]},{type:"A",values:[v,b,0,1,1,h+o,u]}];break;case"line":({x1:c,y1:x,x2:y,y2:f}=m),g=[{type:"M",values:[c,x]},{type:"L",values:[y,f]}];break;case"polygon":case"polyline":let M=e.getAttribute("points").split(/,| /).filter(Boolean).map(Number);for(let e=0;e<M.length;e+=2)g.push({type:0===e?"M":"L",values:[M[e],M[e+1]]});"polygon"===d&&g.push({type:"Z",values:[]})}return t?function(e){return e.map(e=>`${e.type} ${e.values.join(" ")}`).join(" ")}(g):g}(e,{width:t,height:a}),p=o.map(e=>`${e.type} ${e.values} `).join(" "),h=[...e.attributes].map(e=>e.name),u=document.createElementNS(w,"path");u.setAttribute("d",p);let c=["x","y","x1","y1","x2","y2","cx","cy","dx","dy","r","rx","ry","width","height","points"];return h.forEach(t=>{if(!c.includes(t)){let a=e.getAttribute(t);u.setAttribute(t,a)}}),u}function nt(e,{tolerance:t=1,flatBezierToLinetos:a=!0}={}){let l=[e[0]],r={x:e[0].values[0],y:e[0].values[1]},n=r,s=r;e[e.length-1].type.toLowerCase();for(let i=1,o=e.length;i<o;i++){let p=e[i],h=e[i+1]||e[o-1],u="z"===h.type.toLowerCase()?r:{x:h.values[h.values.length-2],y:h.values[h.values.length-1]},{type:c,values:y}=p,x=y.slice(-2);s="Z"!==c?{x:x[0],y:x[1]}:r;let f=u?Fe([n,s,u],!0):1/0,g=oe(n,u),d=f<(g?g/333*t:0),m=!1;if(a||"C"!==c||(d=!1),a&&("C"===c||"Q"===c)){m=Be([n,..."C"===c?[{x:y[0],y:y[1]},{x:y[2],y:y[3]}]:"Q"===c?[{x:y[0],y:y[1]}]:[],s],{tolerance:t}),m&&i<o-1&&(c="L",p.type="L",p.values=x)}d&&i<o-1&&"A"!==h.type&&("L"===c||a&&m)||(n=s,"M"===c&&(r=s),l.push(p))}return l}function st(e){let t=[];for(let a=0,l=e.length;a<l;a++){let l=e[a];if(!l)continue;let{type:r=null,values:n=[]}=l,s=e[a+1]?e[a+1]:null;"M"!==r&&"m"!==r||s&&(!s||"Z"!==s.type&&"z"!==s.type)?t.push(l):s&&a++}return t}function it(e){let t={x:e[0].values[0],y:e[0].values[1]},a=t,l=[e[0]];for(let r=1,n=e.length;r<n;r++){let n=e[r],s=e[r-1],i=e[r+1]||null,{type:o,values:p}=n,h="m"===s.type.toLowerCase()&&!i,u=p.length;if(a={x:p[u-2],y:p[u-1]},h||"L"!==o||a.x!==t.x||a.y!==t.y){if(!h&&("l"===o||"v"===o||"h"===o)){if("l"===o?"00"===p.join(""):0===p[0])continue}l.push(n),t=a}}return l}function ot(e){let t=e.length;if(!("z"===e[t-1].type.toLowerCase()))return e;let a=0,l=[];for(let a=0;a<t;a++){let t=e[a],{type:r,values:n}=t,s=n.length;if(s){let e={type:r,x:n[s-2],y:n[s-1],index:0};e.index=a,l.push(e)}}return l=l.sort((e,t)=>+e.y.toFixed(8)-+t.y.toFixed(8)||e.x-t.x),a=l[0].index,a?ht(e,a):e}function pt(e,{removeFinalLineto:t=!0,autoClose:a=!0}={}){let l=[],r=e.length,n={x:+e[0].values[0].toFixed(8),y:+e[0].values[1].toFixed(8)},s="z"===e[r-1].type.toLowerCase(),i=e.filter(e=>"L"===e.type),o=e[s?r-2:r-1],p=o.type,h=o.values.slice(-2).map(e=>+e.toFixed(8)),u=h[0]===n.x&&h[1]===n.y;!s&&a&&u&&(e.push({type:"Z",values:[]}),s=!0,r++);let c="L"!==e[1].type&&(!u||"L"===o.type);if(c=!1,!s)return e;let y=0;{let t=[];for(let a=0;a<r;a++){let l=e[a],{type:r,values:n}=l;if(n.length){let l=n.slice(-2),s=e[a-1]&&"L"===e[a-1].type,i=e[a+1]&&"L"===e[a+1].type,o=e[a-1]?e[a-1].type.toUpperCase():null,p=e[a+1]?e[a+1].type.toUpperCase():null,h={type:r,x:l[0],y:l[1],dist:0,index:0,prevL:s,nextL:i,prevCom:o,nextCom:p};h.index=a,t.push(h)}}if(i.length){let e=t.filter(e=>"L"!==e.type&&"M"!==e.type&&e.prevCom&&"L"===e.prevCom||"M"===e.prevCom&&"L"===p).sort((e,t)=>e.y-t.y||e.x-t.x)[0];y=e?e.index-1:0}else t=t.sort((e,t)=>+e.y.toFixed(8)-+t.y.toFixed(8)||e.x-t.x),y=t[0].index;e=y?ht(e,y):e}return n={x:+e[0].values[0].toFixed(8),y:+e[0].values[1].toFixed(8)},r=e.length,o=e[r-2],p=o.type,h=o.values.slice(-2).map(e=>+e.toFixed(8)),u="L"===p&&h[0]===n.x&&h[1]===n.y,t&&u&&e.splice(r-2,1),l.push(...e),l}function ht(e,t){let a=0,l="z"===e[e.length-1].type.toLowerCase();if(!l||t<1||e.length<3)return e;let r=l?1:0;!function(e){let t=e.length,a="z"===e[t-1].type.toLowerCase(),l=e[0],[r,n]=[l.values[0],l.values[1]].map(e=>+e.toFixed(8)),s=a?e[t-2]:e[t-1],i=s.values.length,[o,p]=[s.values[i-2],s.values[i-1]].map(e=>+e.toFixed(8));!a||r==o&&n==p||(e.pop(),e.push({type:"L",values:[r,n]},{type:"Z",values:[]}))}(e),a=t+1<e.length-1?t+1:e.length-1-r;let n,s,i=e.slice(a),o=e.slice(0,a);return o.shift(),n=o[o.length-1].values||[],s=[n[n.length-2],n[n.length-1]],r&&(i.pop(),o.push({type:"Z",values:[]})),e=[{type:"M",values:s},...i,...o]}function ut(e,{arcToCubic:t=!1,quadraticToCubic:a=!1,toClockwise:l=!1,returnD:r=!1}={}){const n=(e,t)=>{let a=[],l=[];if("A"!==e){for(let e=0;e<t.length;e+=2)a.push([t[e],t[e+1]]);l=a.pop(),a.reverse()}else{let e=0==t[4]?1:0;a=[t[0],t[1],t[2],t[3],e],l=[t[5],t[6]]}return{controlPoints:a,endPoints:l}};let s=[],i="z"===e[e.length-1].type.toLowerCase();i&&(e=(e=>{let t="z"===e[e.length-1].type.toLowerCase(),a=e[0],[l,r]=[a.values[0],a.values[1]],n=t?e[e.length-2]:e[e.length-1],[s,i]=[n.values[n.values.length-2],n.values[n.values.length-1]];return!t||l==s&&r==i||(e.pop(),e.push({type:"L",values:[l,r]},{type:"Z",values:[]})),e})(e),e.pop());let o=e[e.length-1].values,p=o.length,h=i?e[0]:{type:"M",values:[o[p-2],o[p-1]]};s.push(h),e.reverse();for(let t=1;t<e.length;t++){let a=e[t],l=a.type,r=a.values,i=e[t-1],o=i.type,p=[];p=[n(o,i.values).controlPoints,n(l,r).endPoints].flat(),s.push({type:o,values:p.flat()})}return i&&s.push({type:"z",values:[]}),s}function ct(e,{threshold:t=null,tolerance:a=1}={}){if(!t){let a=function(e){let t=1/0,a=-1/0,l=1/0,r=-1/0;const n=e=>{e.x<t&&(t=e.x),e.x>a&&(a=e.x),e.y<l&&(l=e.y),e.y>r&&(r=e.y)};for(let t=0;t<e.length;t++){let a=e[t],{type:l,values:r}=a,s=r.length,i=(e[t-1]?e[t-1]:e[t]).values,o=i.length;if(s){let e={x:i[o-2],y:i[o-1]},t={x:r[s-2],y:r[s-1]};if(n(t),"C"===l||"Q"===l){let a={x:r[0],y:r[1]},s="C"===l?{x:r[2],y:r[3]}:a,i="C"===l?[e,a,s,t]:[e,a,t];te(i).forEach(e=>{let t=H(i,e);n(t)})}else"A"===l&&ae(e,r).forEach(e=>{n(e)})}}return{x:t,y:l,width:a-t,height:r-l}}(e);t=.05*(a.width+a.height)}let l=e.length;for(let r=0;r<l;r++){let l=e[r],{type:n,values:s,extreme:i,corner:o=!1,dimA:p,p0:h,p:u}=l,c=e[r+1]?e[r+1]:null,y=e[r+2]?e[r+2]:null,x=(c?pe(u,c.p):1/0)<t,f=(y?pe(y.p,c.p):1/0)<1*t;if(c&&y&&"C"===n&&"C"===c.type&&i&&y.extreme&&(f||x)){let l=Ne(c,y,t,a,!1);if(1===l.length){l=l[0],e[r+1]=null,e[r+2].values=[l.cp1.x,l.cp1.y,l.cp2.x,l.cp2.y,l.p.x,l.p.y],e[r+2].cp1=l.cp1,e[r+2].cp2=l.cp2,e[r+2].p0=l.p0,e[r+2].p=l.p,e[r+2].extreme=l.extreme,r++;continue}}if(c&&"C"===n&&"C"===c.type&&i&&x){let e=Fe([l.p0,l.p,c.p]),t=Fe([l.p0,l.cp1,l.cp2,l.p]);if(e<0&&t>0||e>0&&t<0)continue}}l=(e=e.filter(Boolean)).length;let r="z"===e[l-1].type.toLowerCase()?l-2:l-1,n=e[r],s=e[r-1]||null,i={x:e[0].values[0],y:e[0].values[1]},o=n.values.slice(-2),p=+o[0].toFixed(8)===+i.x.toFixed(8)&&+o[1].toFixed(8)===+i.y.toFixed(8),h="C"===e[1].type&&e[1].extreme?e[1]:null,u=pe(n.p0,n.p)<t;if(s&&"C"===s.type&&u&&p&&h){let l=Ne(s,n,t,a,!1);1===l.length&&(e[r-1]=l[0],e[r]=null,e=e.filter(Boolean))}return e}function yt({transforms:e=[],transformOrigin:t={x:0,y:0}}={}){let a=function(e=[],t={x:0,y:0}){const a=(e,t)=>({a:e.a*t.a+e.c*t.b,b:e.b*t.a+e.d*t.b,c:e.a*t.c+e.c*t.d,d:e.b*t.c+e.d*t.d,e:e.a*t.e+e.c*t.f+e.e,f:e.b*t.e+e.d*t.f+e.f}),l=(e,t)=>({a:1,b:0,c:0,d:1,e:e,f:t}),r=(e,t)=>({a:e,b:0,c:0,d:t,e:0,f:0}),n=(e,t)=>{const a=e=>e*Math.PI/180;let[l,r]=e.map(e=>a(e)),n={};if("rot"===t){let e=Math.cos(l),t=Math.sin(l);n={a:e,b:t,c:-t,d:e,e:0,f:0}}else if("skew"===t){let e=Math.tan(l);n={a:1,b:Math.tan(r),c:e,d:1,e:0,f:0}}return n};let s={a:1,b:0,c:0,d:1,e:0,f:0};0===t.x&&0===t.y||(s=a(s,l(t.x,t.y)));const i={translate:[0,0],scale:[1,1],skew:[0,0],rotate:[0],matrix:[1,0,0,1,0,0]};for(let t of e){let e=Object.keys(t)[0],o=t[e]||i[e],[p,h=i[e][1]]=o;switch("rotate"===e&&3===o.length&&(p=o[2]),e){case"matrix":let t=["a","b","c","d","e","f"];s=a(s,Object.fromEntries(t.map((e,t)=>[e,o[t]])));break;case"translate":(p||h)&&(s=a(s,l(p,h)));break;case"skew":(p||h)&&(s=a(s,n([p,h],"skew")));break;case"rotate":p&&(s=a(s,n([p],"rot")));break;case"scale":1===p&&1===h||(s=a(s,r(p,h)));break;default:throw new Error(`Unknown transformation type: ${e}`)}}0===t.x&&0===t.y||(s=a(s,l(-t.x,-t.y)));return s}(e,t);return a}function xt(e,{removeNameSpaced:t=!0,decimals:a=-1}={}){let l=e.nodeName.toLowerCase(),r=function(e){let t={},a=[...e.attributes].map(e=>e.name),l=a.length;if(!l)return t;for(let r=0;r<l;r++){let l=a[r],n=e.getAttribute(l);t[l]=n}return t}(e),n=function(e){let t=e.getAttribute("style"),a=t?function(e=""){let t={};if(!e)return t;let a=e.split(";").filter(Boolean).map(e=>e.trim()),l=a.length;if(!l)return t;for(let e=0;l&&e<l;e++){let l=a[e],[r,n]=l.split(":").filter(Boolean);t[r]=n}return t}(t):{};return a}(e),s={...r,...n},i={},o=n.transform;if(o){let e=yt(function(e,t={x:0,y:0}){if(!e)return!1;let a,l={transforms:[],transformOrigin:t},r=/(\w+)\(([^)]+)\)/g;function n(e){if("string"==typeof e){if(e.includes("rad"))return parseFloat(e)*(180/Math.PI);if(e.includes("turn"))return 360*parseFloat(e)}return parseFloat(e)}for(;null!==(a=r.exec(e));){let e=a[1],t=a[2].split(/,\s*/).map(e=>n(e));switch(e){case"translate":l.transforms.push({translate:[t[0]||0,t[1]||0]});break;case"translateX":l.transforms.push({translate:[t[0]||0,0,0]});break;case"translateY":l.transforms.push({translate:[0,t[0]||0,0]});break;case"scale":l.transforms.push({scale:[t[0]||0,t[1]||0]});break;case"skew":l.transforms.push({skew:[t[0]||0,t[1]||0]});break;case"skewX":l.transforms.push({skew:[t[0]||0,0]});break;case"skewY":l.transforms.push({skew:[0,t[0]||0]});break;case"rotate":console.log("rotate",t),l.transforms.push({rotate:[0,0,t[0]||0]});break;case"matrix":l.transforms.push({matrix:t})}}return e.split(/;\s*/).forEach(e=>{let[t,a]=e.split(":").map(e=>e.trim());if("transform-origin"===t||"perspective-origin"===t){let[e,r]=a.split(/\s+/).map(parseFloat);"transform-origin"===t&&(l.transformOrigin={x:e||0,y:r||0})}}),l}(`${o}`));s.transform=`matrix(${Object.values(e).join(",")})`}let p=["inline-size"],h=[];for(let a in s){let r=s[a];r&&a.startsWith("--")||p.includes(a)||!t&&a.startsWith("-")?h.push(`${a}:${r}`):(r&&Se.atts[a]&&("*"===Se.atts[a]||Se.atts[a].includes(l)||!t&&a.includes(":"))&&(i[a]=r),e.removeAttribute(a))}for(let t in i){let a=i[t];e.setAttribute(t,a)}return h.length&&e.setAttribute("style",h.join(";")),i}function ft(e,{toObject:t=!0,toArray:a=!1,flatten:l=!1}={}){if("string"==typeof e&&!isNaN(e[0]))return e=gt(e.split(/,| /).filter(Boolean).map(Number));l&&(e=e.flat(2));let r=a?function(e){if(!Array.isArray(e[0][0])&&2===e[0].length)return e;let t=[];if(Array.isArray(e[0][0])&&2===e[0][0].length)return e.forEach(e=>{t.push(e.map(e=>[e.x,e.y]))}),t;return t=Array.from(e).map(e=>[e.x,e.y]),t}(e):function(e){if(void 0!==e[0].x&&void 0!==e[0].y)return e;let t=[];if(Array.isArray(e[0])&&void 0!==e[0][0].x&&void 0!==e[0][0].y)return e;if(Array.isArray(e[0][0])&&2===e[0][0].length)return e.forEach(e=>{t.push(e.map(e=>({x:e[0],y:e[1]})))}),t;if(e.length>3)return e=gt(e);return e.map(e=>({x:e[0],y:e[1]}))}(e);return r}function gt(e){let t=[];for(let a=1,l=e.length;a<l;a+=2)t.push({x:e[a-1],y:e[a]});return t}function dt(e,{removeHidden:t=!0,stylesToAttributes:a=!0,removePrologue:l=!0,removeIds:r=!1,removeClassNames:n=!1,removeDimensions:s=!1,fixHref:i=!1,legacyHref:o=!1,cleanupDefs:p=!0,cleanupClip:h=!0,addViewBox:u=!1,addDimensions:c=!1,mergePaths:y=!1,removeOffCanvas:x=!0,cleanupSVGAtts:f=!0,removeNameSpaced:g=!0,attributesToGroup:d=!0,shapeConvert:m=!1,convert_rects:v=!1,convert_ellipses:b=!1,convert_poly:M=!1,convert_lines:A=!1,convertTransforms:C=!1,cleanUpStrokes:k=!0,decimals:S=-1,excludedEls:E=[]}={}){d=!!f,i&&(e=e.replaceAll("xlink:href=","href="));let P=(new DOMParser).parseFromString(e,"text/html").querySelector("svg"),L=lt(P),{x:D,y:T,width:I,height:$}=L;if(f){!function(e,t=["viewBox","xmlns","width","height","id","class"]){[...e.attributes].map(e=>e.name).forEach(a=>{t.includes(a)||e.removeAttribute(a)})}(P,["viewBox","xmlns","width","height","id","class","fill","stroke","stroke-width","stroke-linecap","stroke-linejoin"])}u&&function(e,{x:t=0,y:a=0,width:l=0,height:r=0}={}){if(e.hasAttribute("viewBox"))return;l&&r||({x:t,y:a,width:l,height:r}=lt(e));e.setAttribute("viewBox",[t,a,l,r].join(" "))}(P,{x:D,y:T,width:I,height:$}),c&&(P.setAttribute("width",I),P.setAttribute("height",$)),p&&function(e,{x:t=0,y:a=0,width:l=0,height:r=0,cleanupClip:n=!0}={}){let s=e.querySelectorAll("defs"),i=e.querySelectorAll("symbol, pattern, linearGradient, radialGradient, clipPath, mask, marker, filter");if(!s.length&&!i.length)return;s.forEach(t=>{[...t.children].length?e.insertBefore(t,e.children[0]):t.remove()});let o=new Set([]);i.forEach(e=>{o.add(e.id)}),Array.from(o).forEach(t=>{e.querySelectorAll(`[href="#${t}"], [xlink\\:href="#${t}"], [clip-path="url(#${t})"], [mask="url(#${t})"], [fill="url(#${t})"], [stroke="url(#${t})"]`).length||e.getElementById(t).remove()})}(P,{x:D,y:T,width:I,height:$,cleanupClip:h}),x&&function(e,{x:t=0,y:a=0,width:l=0,height:r=0}={}){let n=[...e.querySelectorAll("path, polygon, polyline, line, rect, circle, ellipse, text")];n=n.filter(e=>!(e.parentNode.closest("defs")||e.parentNode.closest("symbol")||e.parentNode.closest("clipPath")||e.parentNode.closest("mask")||e.parentNode.closest("pattern")));let s={x:t,y:a,width:l,height:r};s.right=t+l,s.bottom=a+r,n.forEach(e=>{let t=function(e){let t=e.nodeName.toLowerCase(),a=Pe(e),l={x:0,y:0,width:0,height:0},r=[];switch(t){case"path":l=Le(Ie(Ze(a.d)));break;case"rect":l={x:a.x||0,y:a.y||0,width:a.width,height:a.height};break;case"circle":let e=2*a.r;l={x:a.cx-a.r,y:a.cy-a.r,width:e,height:e};break;case"ellipse":l={x:a.cx-a.rx,y:a.cy-a.ry,width:2*a.rx,height:2*a.ry};break;case"line":r=[{x:a.x1,y:a.y1},{x:a.x2,y:a.y2}],l=Le(r);break;case"polyline":case"polygon":r=ft(a.points),l=Le(r)}return l}(e);(t.right<s.x||t.bottom<s.y||t.x>s.right||t.y>t.bottom)&&e.remove()})}(P,{x:D,y:T,width:I,height:$});let F=["metadata","script",...E],q=P.querySelectorAll("*"),N=[],z=["polygon","polyline","line","rect","circle","ellipse"];if("toShapes"===m){P.querySelectorAll("path").forEach(e=>{let t=function(e,{convert_rects:t=!1,convert_ellipses:a=!1,convert_poly:l=!1,convert_lines:r=!1}={}){let n=Ze(e.getAttribute("d")),s=Array.from(new Set(n.map(e=>e.type))).join(""),i=/[a]/gi.test(s),o=/[csqt]/gi.test(s),p=/[l]/gi.test(s),h=!/[acqts]/gi.test(s),u=/[z]/gi.test(s),c=null,y=null,x=Pe(e),f={};if(h)if(2===n.length&&r){y="line",c=document.createElementNS(w,y);let[e,t,a,l]=[...n[0].values,...n[1].values].map(e=>me(e,7));f={x1:e,y1:t,x2:a,y2:l}}else{let e=W(n),a=Le(e),r=Fe(e,!0),s=a.width*a.height,i=Math.abs(1-s/r);if(t&&i<.01){y="rect",c=document.createElementNS(w,y);let{x:e,y:t,width:l,height:r}=a;f={x:e,y:t,width:l,height:r}}else l&&(y=u?"polygon":"polyline",c=document.createElementNS(w,y),f={points:e.map(e=>[e.x,e.y]).flat().map(e=>me(e,7)).join(" ")})}else if(!p&&a&&(!i&&o&&(n=tt(n,{areaThreshold:2.5}),i=n.filter(e=>"A"===e.type).length),i)){let e=Oe(n,{addArcParams:!0}),t=e.filter(e=>"A"===e.type),a=new Set,l=new Set,r=new Set,s=new Set;if(t.length>1&&e.forEach(e=>{"A"===e.type&&(a.add(me(e.cx,7)),l.add(me(e.cy,7)),r.add(me(e.rx,7)),s.add(me(e.ry,7)))}),a=Array.from(a),l=Array.from(l),r=Array.from(r),s=Array.from(s),1===a.length&&1===l.length&&1===r.length&&1===s.length){let[e,t,n,i]=[r[0],s[0],a[0],l[0]];y=e===t?"circle":"ellipse",c=document.createElementNS(w,y),f="circle"===y?{r:e,cx:n,cy:i}:{rx:e,ry:t,cx:n,cy:i}}}if(c){let t=["id","class"];for(let e in f)c.setAttribute(e,f[e]);for(let e in x)(Se.atts[e].includes(y)||t.includes(e)||e.startsWith("data-"))&&c.setAttribute(e,x[e]);e=c}return e}(e,{convert_rects:v,convert_ellipses:b,convert_poly:M,convert_lines:A});e.replaceWith(t),e=t})}for(let e=0;e<q.length;e++){let l=q[e],r=l.nodeName.toLowerCase();if("toPaths"===m&&"path"!==r&&z.includes(r)){let e=rt(l,{width:I,height:$,convert_rects:v,convert_ellipses:b,convert_poly:M,convert_lines:A});l.replaceWith(e),r="path",l=e}let n=l.getAttribute("style")||"",s=!!n&&n.trim().includes("display:none"),i=l.getAttribute("display")&&"none"===l.getAttribute("display")||s;if(r.includes(":")||F.includes(r)||t&&i)l.remove();else if(a||d||y||k){let t=xt(l,{removeNameSpaced:g,decimals:S});N.push({el:l,name:r,idx:e,propsFiltered:t})}}if(k)for(let e of N){let{el:t,propsFiltered:a}=e;Object.keys(a).includes("stroke")||ke.forEach(a=>{t.removeAttribute(a),void 0!==e.propsFiltered[a]&&delete e.propsFiltered[a]})}if((d||y)&&function(e=[],t=!0){let a,l=[[e[0]]],r=0,n="",s=e.length,i=e.filter(e=>e.propstr),o="";if(!i.length&&t){let t=null;for(let a=0;a<s;a++){let l=e[a];if("path"!==l.name)continue;let r=!0,n=l.el;t||(t=n,r=!1);let s=l.propsFiltered.d;o+=s.startsWith("M")?s:Ve(s).pathData.map(e=>`${e.type} ${e.values.join(" ")}`).join(" "),r&&n.remove()}return void(t&&t.setAttribute("d",o))}for(let t=0;t<s;t++){let a=e[t],i=a.propsFiltered,o=[];for(let e in i)"d"!==e&&"id"!==e&&o.push(`${e}:${i[e]}`);o=o.join("_"),a.propstr=o,s>1&&o===n?l[r].push(a):s>1&&l[r].length&&(l.push([]),r++),n=o}for(let e=0;e<l.length;e++){let r=l[e];if(r.length>1){let e=r[0].el,l=r[0].propsFiltered,n=e.parentNode.closest("g")?e.parentNode.closest("g"):null;n||(n=document.createElementNS("http://www.w3.org/2000/svg","g"),e.parentNode.insertBefore(n,e),r.forEach(e=>{n.append(e.el)}));let s=[...n.children];for(let e in l){if("d"!==e&&"id"!==e){let t=l[e];n.setAttribute(e,t),s.forEach(a=>{a.getAttribute(e)===t&&a.removeAttribute(e)})}if(t){r=r.filter(Boolean);let e=r.length;if(1===e)return r[0].el;a=r[0].el;let t=r[0].propsFiltered.d;for(let a=1;a<e;a++){let e=r[a],l=e.el,n=e.propsFiltered.d,s=n.startsWith("M")?n:Ve(n).pathData.map(e=>`${e.type} ${e.values.join(" ")}`).join(" ");console.log("dAbs",s),t+=s,l.remove()}a.setAttribute("d",t)}}}}}(N,y),s&&(P.removeAttribute("width"),P.removeAttribute("height")),n||r){let e=n?"class":"id",t=`[${e}]`,a=P.querySelectorAll(t);P.removeAttribute(e),a.forEach(t=>{t.removeAttribute(e)})}if(h&&function(e,{x:t=0,y:a=0,width:l=0,height:r=0}={}){let n=e.querySelectorAll("clipPath");if(!n.length)return;l&&r||({x:t,y:a,width:l,height:r}=lt(e));n.forEach(n=>{let s=[...n.children];if(s.length>1)return;let i=s[0],o=i.nodeName.toLowerCase();if("path"===o||"rect"===o){let s={x:0,y:0,width:0,height:0};if("path"===o){let e=Ze(i.getAttribute("d")),t=Array.from(new Set(e.map(e=>e.type.toLowerCase()))).join("");if(!!/[acqts]/gi.test(t)||e.length>5)return;s=Le(W(e))}else"rect"===o&&(s={x:+i.getAttribute("x"),y:+i.getAttribute("y"),width:+i.getAttribute("width"),height:+i.getAttribute("height")});if(s.x===t&&s.y===a&&s.width===l&&s.height===r){n.remove(),e.querySelectorAll(`[clip-path="url(#${n.id})"]`).forEach(e=>{e.removeAttribute("clip-path")})}}})}(P,{x:D,y:T,width:I,height:$}),o){P.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),P.querySelectorAll("[href]").forEach(e=>{let t=e.getAttribute("href");e.setAttribute("xlink:href",t),e.removeAttribute("href")})}return{svg:P,svgElProps:N}}function mt(e,{threshold:t=0,tolerance:a=1}={}){let l=e.length,r=[e[0]],n="z"===e[l-1].type.toLowerCase(),s=!!n&&(e[l-1].p.x===e[0].p0.x&&e[l-1].p.y===e[0].p0.y),i=n?2:1,o=e[l-i],p="L"===o.type,h="C"===o.type,u="L"===e[1].type,c="C"===e[1].type,y=n&&c&&(p||s);y&&(e[l-1].values=e[0].values,e[l-1].type="L",p=!0);for(let t=1;t<l;t++){let s=e[t],{type:o}=s,x=e[t+1]?e[t+1]:null;if("L"===o&&x&&"C"===x.type||"C"===o&&x&&"L"===x.type){let y="L"===o?s:null,f=null,g=[],d=0;if(1===t&&c&&p&&(g=[e[1]],y=e[l-1],f=x),!y){r.push(s);continue}n&&h&&u&&t===l-i-1&&(f=e[1],g=[e[l-i]]);for(let a=t+1;a<l;a++){let t=e[a]?e[a]:null,l=e[a-1];if("C"===l.type&&g.push(l),"L"===t.type&&"C"===l.type){f=t;break}d++}if(f){let e=pe(y.p0,y.p),l=pe(f.p0,f.p),n=pe(y.p,f.p0),i=Fe([y.p0,y.p,f.p0,f.p],!1),o=Fe([g[0].p0,g[0].cp1,g[0].cp2,g[0].p],!1),p=i<0&&o>0||i>0&&o<0,h=.5*n*a,u=h<e&&h<l;if(g.length&&!p&&u){let e=Math.abs(o)<.005*oe(g[0].p0,g[0].p)?null:U(y.p0,y.p,f.p,f.p0,!1,!0);if(!e){r.push(s);continue}if(e){let t=Fe([y.p0,y.p,f.p0,f.p],!1),a=Math.abs(t),l=Fe([y.p0,y.p,e,f.p0,f.p],!1),n=Math.abs(l),i=Math.abs(a-n)/a;if(!e||(t<0&&l>0||t>0&&l<0)||i>.5){r.push(s);continue}}let a=.75*pe(H([y.p,e,f.p0],.5),1===g.length?H([g[0].p0,g[0].cp1,g[0].cp2,g[0].p],.5):g[0].p);if(h&&a>h&&a>.3*n){r.push(s);continue}{let a={type:"Q",values:[e.x,e.y,f.p0.x,f.p0.y]};a.p0=y.p,a.cp1=e,a.p=f.p0,r.push(y,a),t+=d;continue}}}}y&&t===l-1&&"L"===o||r.push(s)}return(y||n&&"Z"!==r[r.length-1].type)&&r.push({type:"Z",values:[]}),r}function vt(e){if(e.length<3)return!1;let t=e[0],a=e[Math.floor(e.length/2)],l=e[e.length-1],r=t.x,n=t.y,s=a.x,i=a.y,o=l.x,p=l.y,h=r-s,u=n-i,c=r-o,y=n-p,x=(r*r-s*s+(n*n-i*i))/2,f=(r*r-o*o+(n*n-p*p))/2,g=h*y-u*c;if(Math.abs(g)<1e-10)return console.warn("Points are collinear or numerically unstable"),!1;let d={x:(y*x-u*f)/g,y:(-c*x+h*f)/g},m=ie(d,t),v=G(d,t,l),{deltaAngle:b,startAngle:M,endAngle:A}=v;return{centroid:d,r:m,startAngle:M,endAngle:A,deltaAngle:b}}function bt(e,{threshold:a=0,tolerance:l=1,toCubic:r=!1,debug:n=!1}={}){let s=e.length,i=[e[0]],o=[];for(let a=1;a<s;a++){let l=e[a],{type:s}=l,p=e[a-1],h=e[a+1]?e[a+1]:null,u=e[a+2]?e[a+2]:null,c=e[a+3]?e[a+3]:null,y=null;"C"===l.type||"Q"===l.type?y=l:!h||"C"!==h.type&&"Q"!==h.type||(y=h);let x,f,g,d,m,v=y?"C"===y.type?[y.p0,y.cp1,y.cp2,y.p]:[y.p0,y.cp1,y.p]:[],b=0,M=0,A=!1,w=!1,C=[];if("L"===p.type&&"L"===s&&y&&"L"===u.type&&c&&("L"===c.type||"Z"===c.type)?(x=[l.p0,l.p],f=[u.p0,u.p],g=l.p0,d=u.p,b=Fe(v,!1),M=Fe([...x,...f],!1),A=b<0&&M>0||b>0&&M<0,A||(m=H(v,.5),C=[g,m,d],w=!0)):"C"!==s&&"Q"!==s||"L"!==p.type||"C"!==h.type&&"Q"!==h.type||"L"!==u.type||(w=!0,x=[p.p0,p.p],f=[u.p0,u.p],g=p.p,d=u.p0,m=y.p,C=[g,y.p,d]),w){let e=vt(C);if(e){let s,{centroid:p,r:h,deltaAngle:u,startAngle:c,endAngle:y}=e,x=0,f=u>0?1:0,v=Math.abs(u)>Math.PI?1:0;if(he(X(g,p.x,p.y,.5*u),m)<.05*he(g,d)){if(s=Ke({p0:g,p:d,centroid:p,rx:h,ry:h,xAxisRotation:x,sweep:f,largeArc:v,deltaAngle:u,startAngle:c,endAngle:y}),1===s.length){let e=We(g,s[0].cp1,s[0].cp2,d);"Q"===e.type&&(r=!0),l=e}if(s.length>1&&(r=!1),r||(l.type="A",l.values=[h,h,x,v,f,d.x,d.y]),l.p0=g,l.p=d,l.extreme=!1,l.corner=!1,n){o=r?[{type:"M",values:[g.x,g.y]},...s]:[{type:"M",values:[g.x,g.y]},{type:"A",values:[h,h,x,v,f,d.x,d.y]}];let e=qe(o);t(markers,e,"orange","0.5%","0.5")}i.push(l),a++;continue}}}i.push(l)}return i}function Mt(e=[],{threshold:t=0}={}){let a=e.length,l="z"===e[a-1].type.toLowerCase(),r=l?a-2:a-1,n=e[r],s=n.values.slice(-2),i={x:e[0].values[0],y:e[0].values[1]},o=he(i,{x:s[0],y:s[1]});if(o&&o<t){let a=e[r].values.length;e[r].values[a-2]=i.x,e[r].values[a-1]=i.y;let l=e[1];if("C"===l.type&&"C"===n.type){let a=Math.abs(l.values[0]-n.values[2]),s=Math.abs(l.values[1]-n.values[3]),o=Math.abs(e[1].values[0]-l.values[0]),p=Math.abs(e[1].values[1]-l.values[1]),h=Math.abs(e[1].values[0]-n.values[2]),u=Math.abs(e[1].values[1]-n.values[3]),c=p<t&&u<t&&a;a&&a<t&&(o<t&&h<t&&s)&&(e[1].values[0]=i.x,e[r].values[2]=i.x),s&&s<t&&c&&(e[1].values[1]=i.y,e[r].values[3]=i.y)}}return e}function At(e,t=1){let a=[];for(let l=0,r=e.length;l<r;l++){let r=e[l],{type:n,values:s}=r,i={type:n,values:[]};switch(n.toLowerCase()){case"h":case"v":i.values=[s[0]*t];break;case"a":i.values=[s[0]*t,s[1]*t,s[2],s[3],s[4],s[5]*t,s[6]*t];break;default:s.length&&(i.values=s.map((e,a)=>e*t))}a.push(i)}return a}function wt(e,t=1){for(let a=1,l=e.length;a<l;a++){let l=e[a],{type:r,values:n,p0:s,cp1:i=null,cp2:o=null,p:p=null}=l;if("C"===r){let r=We(s,i,o,p,t);"Q"===r.type&&(r.extreme=l.extreme,r.corner=l.corner,r.dimA=l.dimA,r.squareDist=l.squareDist,e[a]=r)}}return e}function Ct(e,{quality:t=.9,width:a=0,height:l=0}={}){let r=!1;if("string"==typeof t&&(r=!0,t=parseFloat(t)),e.length<4||(!r&&t)>=1)return e;let n=t;if(!r){if(n=1-t,t>.5&&(n/=2),!a&&!l){let t=ue(e,12);({width:a,height:l}=Le(t))}n=(n*((a+l)/2/100))**2}const s=(e,t,a)=>{let l=t.x,r=t.y,n=a.x-l,s=a.y-r;if(0!==n||0!==s){let t=((e.x-l)*n+(e.y-r)*s)/(n*n+s*s);t>1?(l=a.x,r=a.y):t>0&&(l+=n*t,r+=s*t)}return(e.x-l)**2+(e.y-r)**2};let i=[e[0]],o=[];for(o.push([0,e.length-1]);o.length>0;){let[t,a]=o.pop(),l=n,r=-1;for(let n=t+1;n<a;n++){let i=s(e[n],e[t],e[a]);i>l&&(r=n,l=i)}l>n?(o.push([r,a]),o.push([t,r])):i.push(e[a])}return i}function kt(e,{quality:t=.9,width:a=0,height:l=0}={}){let r=!1;if("string"==typeof t){r=!0,t=parseFloat(t)}if(e.length<4||(!r&&t)>=1)return e;let n,s=e[0],i=[s],o=t;if(!r){if(o=1-t,!a&&!l){let t=ue(e,12);({width:a,height:l}=Le(t))}o=(o*((a+l)/2/25))**2,t>.5&&(o/=10)}for(let t=1,a=e.length;t<a;t++){n=e[t],oe(s,n)>o&&(i.push(n),s=n)}return s.x!==n.x&&s.y!==n.y&&i.push(n),i}function St(e,t=!0){let a=[],l=[];return Array.isArray(e[0])?e.forEach(e=>{l=[{type:"M",values:[e[0].x,e[0].y]},...e.slice(1).map(e=>({type:"L",values:[e.x,e.y]}))],a.push(...l)}):a=[{type:"M",values:[e[0].x,e[0].y]},...e.slice(1).map(e=>({type:"L",values:[e.x,e.y]}))],t&&a.push({type:"Z",values:[]}),a}function Et(e,{maxError:t=0,adjustCpts:a=!0,harmonize:l=!0,keepCorners:r=!0}={}){if(1===e.length)return[];if(2===e.length)return[{type:"L",values:[e[0].x,e[0].y]},{type:"L",values:[e[1].x,e[1].y]}];let n=e.length,s=function(e=[]){let t=[];return e.forEach(e=>{let a=4===e.length?"C":3===e.length?"Q":"L",l="C"===a||"Q"===a?e[1]:null,r="C"===a?e[2]:null,n=e[e.length-1],s={type:a,values:"C"===a?[l.x,l.y,r.x,r.y,n.x,n.y]:"Q"===a?[l.x,l.y,n.x,n.y]:[n.x,n.y]};t.push(s)}),t}(Pt(e,It(e[1],e[0]),It(e[n-2],e[n-1]),t,r));return s}function Pt(e,t,a,l,r=!1){let n,s=function(e){let t=[],a=e.length,l=e[0],r=e[1],n=0,s=0;for(let i=0;i<a;i++)r=e[i],n=s+ie(r,l,!1),t.push(n),s=n,l=r;return t=t.map(function(e){return e/s}),t}(e),i=Lt(e,s,s,t,a);n=i[0];let o=i[1],p=i[2];if(r){let t=function(e,t){let a,l=4,r=1/l,n=e.length,s=[t[0]];for(let e=1;e<l;e++){a=H(t,r*e),s.push(a)}s.push(t[t.length-1]);let i=Fe(e,!1);i||2!==e.length||(i=.01*oe(e[0],e[1]));let o=Fe(s,!1)/i>1.1,p=t;if(o){let a=e[Math.floor(.5*n)],l=e[n-1];p=t=[e[0],a,a,l]}return{isBulged:o,bezierNew:p}}(e,n),{isBulged:a,bezierNew:l}=t;a&&(n=l)}if(0===o||o<l)return[n];if(o<l*l){let r=s,i=o,h=p;for(let u=0;u<20;u++){r=Dt(n,e,r);let u=Lt(e,s,r,t,a);if(n=u[0],o=u[1],p=u[2],o<l)return[n];if(p===h){let e=o/i;if(e>.9999&&e<1.0001)break}i=o,h=p}}let h=[],u=$t(e[p-1],e[p+1]);if(0===u.x&&0===u.y){u=$t(e[p-1],e[p]);let t={x:-u.y,y:u.x};u.x=t.x,u.y=t.y}let c=function(e){let t=Math.sqrt(e.x*e.x+e.y*e.y);return 0===t?{x:0,y:0}:{x:e.x/t,y:e.y/t}}(u),y=qt(c,-1);return e.length,h.push(...Pt(e.slice(0,p+1),t,c,l,r),...Pt(e.slice(p),y,a,l,r)),h}function Lt(e,t,a,l,r){let n,s,i;n=function(e,t,a,l){let r,n,s,i,o=e[0],p=e[e.length-1],h=[o,null,null,p],u=function(e){let t=[];for(;e--;)t.push([0,0]);return t}(t.length),c=t.length;for(let e=0;e<c;e++)s=t[e],i=1-s,r=u[e],r[0]=qt(a,3*s*(i*i)),r[1]=qt(l,3*i*(s*s));let y=[[0,0],[0,0]],x=[0,0],f=e.length;for(let a=0;a<f;a++)s=t[a],r=u[a],y[0][0]+=Nt(r[0],r[0]),y[0][1]+=Nt(r[0],r[1]),y[1][0]+=Nt(r[0],r[1]),y[1][1]+=Nt(r[1],r[1]),n=$t(e[a],H([o,o,p,p],s)),x[0]+=Nt(r[0],n),x[1]+=Nt(r[1],n);let g=y[0][0]*y[1][1]-y[1][0]*y[0][1],d=y[0][0]*x[1]-y[1][0]*x[0],m=x[0]*y[1][1]-x[1]*y[0][1],v=0===g?0:m/g,b=0===g?0:d/g,M=ie(o,p,!1),A=1e-6*M;return v<A||b<A?(h[1]=Ft(o,qt(a,.333*M)),h[2]=Ft(p,qt(l,.333*M))):(h[1]=Ft(o,qt(a,v)),h[2]=Ft(p,qt(l,b))),h}(e,a,l,r);let o=function(e,t,a){let l,r,n,s,i,o;r=0,n=Math.floor(.5*e.length);let p=function(e,t){let a,l=[0],r=e[0],n=0;for(let s=1;s<=t;s++)a=H(e,s/t),n+=ie(a,r),l.push(n),r=a;return l=l.map(e=>e/n),l}(t,10),h=e.length,u=null;for(s=0;s<h;s++)i=e[s],o=Tt(a[s],p,10),u=H(t,o),l=oe(u,i),l>r&&(r=l,n=s);return[r,n]}(e,n,t);return s=o[0],i=o[1],[n,s,i]}function Dt(e,t,a){return a.map((a,l)=>function(e,t,a){let l=H(e,a),r=l.x-t.x,n=l.y-t.y,s=zt(e,a),i=r*s[0]+n*s[1],o=s[0]*s[0]+s[1]*s[1],p=zt(e,a,!0),h=2*(r*p[0]+n*p[1]),u=o+h;if(Math.abs(u)<1e-10)return a;return a-i/u}(e,t[l],a))}function Tt(e,t,a){if(e<0)return 0;if(e>1)return 1;let l,r,n,s,i;for(let o=1;o<=a;o++)if(e<=t[o]){s=(o-1)/a,n=o/a,r=t[o-1],l=t[o],i=(e-r)/(l-r)*(n-s)+s;break}return i}function It(e,t){let a=e.x-t.x,l=e.y-t.y,r=Math.sqrt(a*a+l*l);return 0===r?{x:0,y:0}:{x:a/r,y:l/r}}function $t(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ft(e,t){return{x:e.x+t.x,y:e.y+t.y}}function qt(e,t){return{x:e.x*t,y:e.y*t}}function Nt(e,t){return e.x*t.x+e.y*t.y}function zt(e,t,a=!1){let l,r,n=e[0],s=e[1],i=e[2],o=e[3],p=t,h=1-p,u=h*h,c=p*p;return a?(l=6*h*(i.x-2*s.x+n.x)+6*p*(o.x-2*i.x+s.x),r=6*h*(i.y-2*s.y+n.y)+6*p*(o.y-2*i.y+s.y)):(l=3*u*(s.x-n.x)+6*h*p*(i.x-s.x)+3*c*(o.x-i.x),r=3*u*(s.y-n.y)+6*h*p*(i.y-s.y)+3*c*(o.y-i.y)),[l,r]}function jt(e,{debug:t=!1,width:a=0,height:l=0,denoise:r=.9,keepCorners:n=!0,keepExtremes:s=!0,keepInflections:i=!1,manhattan:o=!1,absolute:p=!1,closed:h=!0,tolerance:u=1,simplifyRD:c=1,simplifyRDP:y=1}={}){let x=s||n?function(e,{x:t=0,y:a=0,width:l=0,height:r=0,debug:n=!1}={}){let s=e.length,i=Le(e);l&&r||({x:t,y:a,width:l,height:r}=i);let o=.01*(l+r);for(let t=0;t<s;t++){let a=t>0?e[t-1]:e[s-1],l=e[t],r=Fe([a,l,t<s-1?e[t+1]:e[s-1]],!1);l.area=r,l.dist=pe(a,l),l.idx=t}for(let t=0;t<s;t++){t>1?e[t-2]:e[s-1];let a=t>0?e[t-1]:e[s-1],l=e[t],r=t<s-1?e[t+1]:e[s-1];oe(a,r),Math.abs(a.area);let n=Math.abs(l.area);Math.abs(r.area);let p=!1,h=!l.area||n<o;pe(l,a);let u=!1;l.x!==i.left&&l.x!==i.right&&l.y!==i.top&&l.y!==i.bottom||(u=!0);let c=l.y===a.y&&l.x!==a.x,y=l.x===a.x&&l.y!==a.y;(c||y)&&(a.isExtreme=!0,u=!0);let x=Le([a,r]),{left:f,right:g,top:d,bottom:m}=x,v=l.x<f||l.x>g||l.y<d||l.y>m;!u&&v&&(u=!0);let b=(a.area<0&&l.area>0||a.area>0&&l.area<0)&&!h&&!a.isDirChange;if(u){let e=G(l,r,a),{deltaAngleDeg:t}=e;t=Math.abs(t),t>10&&t<160&&(p=!0)}l.isCorner=p,l.isExtreme=u,l.isHorizontal=c,l.isVertical=y,l.isDirChange=b}let p=[],h=[];for(let t=0;t<e.length;t++){let a=e[t],l=e[t+1]||null,r=e[t+2]||null,n=[];if(l&&l.isExtreme&&a.isExtreme&&!a.isCorner){let e=l.dist<2*o&&!l.isCorner,s=r&&r.isExtreme&&r.dist<2*o&&!r.isCorner;if(e&&!s?n.push(a,l):s&&n.push(a,l,r),n.length){let e=n.reduce((e,t)=>e+t.x,0)/n.length,l=n.reduce((e,t)=>e+t.y,0)/n.length;a.x=e,a.y=l,t+=n.length-1}}(a.isExtreme||a.isCorner||a.isDirChange)&&h.push(p.length),p.push(a);let s=p.length,i=p[0],u=p[s-1],c=pe(i,u)<2*o;i.isExtreme&&u.isExtreme&&c&&(u.x=i.x,u.y=i.y)}return p}(e,{debug:!1}):e,f=s||n?function(e,{closed:t=!0,keepCorners:a=!0,keepExtremes:l=!0,keepInflections:r=!1}={}){let n=[[e[0]]],s=0,i=n[s],o=e.length;for(let t=1;t<o;t++){t>0?e[t]:e[o-1];let r=e[t];t<o-1?e[t+1]:e[o-1],(l&&r.isExtreme||a&&r.isCorner)&&(s++,n.push([])),i=n[s],i.push(r)}return n}(x,{keepCorners:n,keepExtremes:s,keepInflections:i}):[x],g=function(e=[],{closed:t=!0,keepCorners:a=!0,tolerance:l=1}={}){let r=e.length,n=[{type:"M",values:[e[0][0].x,e[0][0].y]}];for(let t=0;t<r;t++){let r=e[t],s=e[t+1]?e[t+1]:null,i=[],o=r.length;r[r.length-1],s&&r.push(s[0]),o<2||2===o&&r[1].isExtreme?(r[r.length-1],i=r.map(e=>({type:"L",values:[e.x,e.y]}))):i=Et(r,{maxError:l,keepCorners:a}),n.push(...i)}t&&n.push({type:"Z",values:[]});return n}(f,{closed:h,tolerance:a&&l?(a+l)/2*.004*u:2.5,keepCorners:n});return g}function Bt(e,{precisionPoly:t=1,autoAccuracy:a=!1,polyFormat:l="points",decimals:r=-1,simplifyRD:n=1,simplifyRDP:s=1}={}){let i=e.length,o=[],p=[{x:e[0].values[0],y:e[0].values[1]}],h=[];for(let t=1;t<i;t++){let a=e[t],{type:l,values:r,p0:n,p:s,dimA:i=0}=a;h.push(+i.toFixed(8)),p.push(s)}let u=[p[0]];h=h.filter(Boolean).sort();let c=h[h.length-1];t*=c>2&&c<25?1:20/c;for(let a=1;a<i;a++){let l=e[a],{type:r,values:n,p0:s,p:i,cp1:o=null,cp2:p=null,dimA:h}=l,c=h,y=o&&p?[s,o,p,i]:o?[s,o,i]:[];if(y.length){let e=p?Z(o,p,.5):o;c=.2*(pe(s,e)+pe(i,e))+h}let x=Math.ceil(.2*c*t),f=Math.ceil(x);if(f&&y.length){let e=f?1/(f+1):0;for(let t=1;t<=f;t++){let a=H(y,e*t);u.push(a)}}u.push(i)}n>0&&(u=kt(u,{quality:n+"px"})),s>0&&(u=Ct(u,{quality:s+"px"})),o=St(u),e=o,a&&(r=function(e){let t=[];for(let a=1,l=e.length;a<l;a++){let l=e[a],{p0:r=null,p:n=null,dimA:s=0}=l;n&&r&&(s=s||pe(r,n),s&&t.push(s))}let a=t.sort(),l=Math.ceil(a.length/8);a=a.slice(0,l);let r=a.reduce((e,t)=>e+t,0)/l,n=r>112.5?0:Math.floor(75/r).toString().length;return Math.min(Math.max(0,n),8)}(p));let y=r>-1?u.map(e=>({x:me(e.x,r),y:me(e.y,r)})):u.map(e=>({x:e.x,y:e.y}));return"array"===l?y=y.map(e=>[e.x,e.y]):"string"===l&&(y=y.map(e=>[e.x,e.y].join(",")).join(" ")),{pathData:e,poly:y}}function Qt(e){for(let t=1,a=e.length;t<a;t++){let a=e[t],{type:l,values:r,p0:n,cp1:s=null,cp2:i=null,p:o=null}=a;if("L"===l){let a=Z(n,o,.333),l=Z(o,n,.333);e[t].type="C",e[t].values=[a.x,a.y,l.x,l.y,o.x,o.y],e[t].cp1=a,e[t].cp2=l}}return e}function Ot(e=[],t=!1){let a=[];e.forEach((e,t)=>{let l=function(e=[],{precision:t=1}={}){let a=[];for(let t=0;t<e.length;t++){let l=e[t],r=t>0?e[t-1]:e[t],{type:n,values:s}=l,i={x:r.values[r.values.length-2],y:r.values[r.values.length-1]},o=s.length?{x:s[s.length-2],y:s[s.length-1]}:"",p=s.length?{x:s[0],y:s[1]}:"";switch(n){case"A":et(i,s).forEach(e=>{let t=e.values,l={x:t[0],y:t[1]},r={x:t[2],y:t[3]},n={x:t[4],y:t[5]};a.push(l,r,n)});break;case"C":let e={x:s[2],y:s[3]};a.push(p,e);break;case"Q":a.push(p)}"z"!==n.toLowerCase()&&a.push(o)}return a}(e.pathData),r=Fe(l)>=0;a.push({pts:l,bb:Le(l),cw:r,index:t,inter:0,includes:[],includedIn:[]})});let l=a.length;for(let e=0;e<l;e++){let t=a[e],r=t.bb;for(let n=0;n<l;n++){let l=a[n],s=l.bb;e===n||l.includes.includes(e)||V({x:s.left+s.width/2,y:s.top+s.height/2},t.pts,r)&&(a[n].inter+=1,l.includedIn.push(e),t.includes.push(n))}}for(let r=0;r<l;r++){let l=a[r],{cw:n,includedIn:s,includes:i}=l;(!s.length&&n&&!t||!s.length&&!n&&t)&&(e[r].pathData=ut(e[r].pathData),a[r].cw=!a[r].cw,n=a[r].cw);for(let t=0;t<i.length;t++){let l=i[t];a[l].cw===n&&(e[l].pathData=ut(e[l].pathData),a[l].cw=!a[l].cw)}}return e}function Rt(e="",{getObject:t=!1,toAbsolute:a=!1,toRelative:l=!0,toShorthands:r=!0,toLonghands:n=!1,quadraticToCubic:s=!0,arcToCubic:i=!1,cubicToArc:o=!1,simplifyBezier:p=!0,optimizeOrder:h=!0,autoClose:u=!1,removeZeroLength:c=!0,refineClosing:y=!0,removeColinear:x=!0,flatBezierToLinetos:f=!0,revertToQuadratics:g=!0,refineExtremes:d=!0,simplifyCorners:m=!1,removeDimensions:v=!1,removeIds:b=!1,removeClassNames:M=!1,omitNamespace:A=!1,fixDirections:w=!1,keepExtremes:C=!0,keepCorners:k=!0,extrapolateDominant:S=!0,keepInflections:E=!1,addExtremes:P=!1,addSemiExtremes:L=!1,toPolygon:D=!1,smoothPoly:T=!1,polyFormat:I="points",precisionPoly:$=1,simplifyRD:F=1,simplifyRDP:q=1,harmonizeCpts:N=!1,removeOrphanSubpaths:z=!1,simplifyRound:j=!1,scale:B=1,scaleTo:Q=0,crop:O=!1,alignToOrigin:R=!1,convertTransforms:_=!1,decimals:G=3,autoAccuracy:U=!0,minifyD:V=0,tolerance:Z=1,reversePath:H=!1,removePrologue:J=!0,removeHidden:X=!0,removeUnused:Y=!0,cleanupDefs:K=!0,cleanupClip:ee=!0,cleanupSVGAtts:te=!0,stylesToAttributes:ae=!1,fixHref:le=!1,legacyHref:re=!1,removeNameSpaced:ne=!0,attributesToGroup:se=!1,removeOffCanvas:ie=!1,mergePaths:oe=!1,shapesToPaths:pe=!1,shapeConvert:he=0,convert_rects:ue=!1,convert_ellipses:ce=!1,convert_poly:xe=!1,convert_lines:fe=!1,lineToCubic:me=!1,cleanUpStrokes:ve=!0,addViewBox:be=!1,addDimensions:Me=!1}={}){Z=Math.max(.1,Z),B=Math.max(.001,B);let Ae=function(e){let t="string";if(Array.isArray(e)){if(Array.isArray(e[0])){if(2===e[0].length)return"polyArray";if(Array.isArray(e[0][0])&&2===e[0][0].length)return"polyComplexArray";if(void 0!==e[0][0].x&&void 0!==e[0][0].y)return"polyComplexObjectArray"}else{if(void 0!==e[0].x&&void 0!==e[0].y)return"polyObjectArray";if(e[0]?.type&&e[0]?.values)return"pathData"}return"array"}if("string"==typeof e){let a=(e=e.trim()).includes("<svg")&&e.includes("</svg"),l=e.startsWith("M")||e.startsWith("m"),r=!isNaN(e.substring(0,1))&&!isNaN(e.substring(e.length-1,e.length));if(a)t="svgMarkup";else if(l)t="pathDataString";else if(r)t="polyString";else{let a=/^(file:|https?:\/\/|\/|\.\/|\.\.\/)/.test(e),l=e.startsWith("data:image");t=a||l?"url":"string"}return t}return t=typeof e,(e.constructor.name||t).toLowerCase()}(e),we="",Ce=0,ke=0,Se=0,Ee={},Pe="",De="svgMarkup"===Ae?1:0,Te=[],Ie=[],$e=[],Fe="";Ce=e.length;let Ne={x:0,y:0,width:0,height:0},je={x:0,y:0,width:0,height:0},Be=[],Oe=[];i=!!D||i;let Re=[];if("svgMarkup"!==Ae){if("pathDataString"===Ae)Pe=e;else if("polyString"===Ae)Pe="M"+e;else if("polyArray"===Ae||"polyObjectArray"===Ae||"polyComplexArray"===Ae||"polyComplexObjectArray"===Ae){Pe=St(ft(e)),Fe=Pe.map(e=>`${e.type} ${e.values.join(" ")}`).join(" "),Ce=Fe.length}else"pathData"===Ae&&(Pe=e,Fe=Array.from(Pe).map(e=>`${e.type} ${e.values.join(" ")}`).join(" "),Ce=Fe.length);Ie.push({d:Pe,el:null})}else{we=dt(e,{removeIds:b,removeClassNames:M,removeDimensions:v,cleanupSVGAtts:te,cleanUpStrokes:ve,removeHidden:X,removeUnused:Y,removeNameSpaced:ne,stylesToAttributes:ae,removePrologue:J,fixHref:le,mergePaths:oe,convertTransforms:_,legacyHref:re,cleanupDefs:K,cleanupClip:ee,addViewBox:be,removeOffCanvas:ie,addDimensions:Me,shapeConvert:he,convert_rects:ue,convert_ellipses:ce,convert_poly:xe,convert_lines:fe}).svg,we.querySelectorAll("path").forEach((e,t)=>{Ie.push({d:e.getAttribute("d"),el:e,idx:t})}),Ne=lt(we,G)}let _e={toRelative:l,toAbsolute:a,toLonghands:n,toShorthands:r,decimals:G},Ge=[];for(let e=0,t=Ie.length;t&&e<t;e++){let t=[],a=Ie[e],{d:l,el:r}=a,n=Ze(l,{quadraticToCubic:s,arcToCubic:i}),u=T||D?Le(W(n)):null;if(1!==B||Q){if(Q)if(Ne.width&&!O)B=Q/Ne.width;else{let e=n.map(e=>({type:e.type,values:e.values}));e=He(e,{arcToCubic:!0}),e=ge(e);let t=Le(W(e));Be.push(t.x,t.x+t.width),Oe.push(t.y,t.y+t.height);let a=Q/t.width;B=a}n=At(n,B)}let v=n.length;z&&(n=st(n));let b=ye(n),M=b.length;for(let e=0;e<M;e++){let a=b[e],l=[],r=Array.from(new Set(a.map(e=>e.type))).join(""),n=!/[acqts]/gi.test(r),s=/[z]/gi.test(r);if(n)l=W(a),F>0&&(l=kt(l,{quality:F+"px"})),q>0&&(l=Ct(l,{quality:q+"px"})),a=St(l,s);else if(D){p=!1,T=!1;let e=Qe(a),{bb:t,pathData:l}=e;a=l;let r=Bt(a,{precisionPoly:$,autoAccuracy:U,polyFormat:I,decimals:G,simplifyRD:F,simplifyRDP:q});$e.push(r.poly),a=r.pathData}if(T&&n){a=it(a),a=jt(W(a),{denoise:.8,tolerance:Z,width:u.width,height:u.height,manhattan:!1,absolute:!1,keepCorners:k,keepExtremes:C,keepInflections:E,closed:s,simplifyRD:F,simplifyRDP:q})}(x||c)&&(a=it(a)),h&&(a=ot(a)),x&&(a=nt(a,{tolerance:Z,flatBezierToLinetos:!1})),(P||L)&&(a=ge(a,{tMin:0,tMax:1,addExtremes:P,addSemiExtremes:L,angles:[30]})),H&&(a=ut(a));let v=Qe(a,{detectSemiExtremes:L}),{pathData:M,bb:A,dimA:w}=v;if(Be.push(A.x,A.x+A.width),Oe.push(A.y,A.y+A.height),y&&(M=Mt(M,{threshold:.001*w})),M=p?ze(M,{simplifyBezier:p,keepInflections:E,keepExtremes:C,keepCorners:k,extrapolateDominant:S,revertToQuadratics:g,tolerance:Z}):M,d){M=ct(M,{threshold:.05*(A.width+A.height),tolerance:Z})}if(!i&&o&&(M=tt(M,{areaThreshold:2.5})),x&&f&&(M=nt(M,{tolerance:Z,flatBezierToLinetos:f})),m){M=mt(M,{threshold:.1*(A.width+A.height),tolerance:Z})}if(j&&(M=bt(M)),g&&(M=wt(M,Z)),me&&(M=Qt(M)),h&&(M=pt(M,{autoClose:false})),U){let e=de(M);Re.push(e)}t.push({pathData:M,bb:A})}let A=Math.min(...Be),N=Math.min(...Oe);je={x:A,y:N,width:Math.max(...Be)-A,height:Math.max(...Oe)-N};let _=je.height>je.width;if(h&&(t=_?t.sort((e,t)=>e.bb.y-t.bb.y||e.bb.x-t.bb.x):t.sort((e,t)=>e.bb.x-t.bb.x||e.bb.y-t.bb.y)),w&&(t=Ot(t)),n=[],Te.push(t),t.forEach(e=>{n.push(...e.pathData)}),U){Re=Re.sort().reverse();let e=Re[Math.floor(.5*Re.length)];G=Math.floor(.5*(Re[0]+e)),_e.decimals=G}if(oe=!1,r&&oe)Ge.push(...n);else{n=JSON.parse(JSON.stringify(n)),n=He(n,_e),c&&(n=it(n)),R&&(n[0].values[0]=(n[0].values[0]-je.x).toFixed(G),n[0].values[1]=(n[0].values[1]-je.y).toFixed(G),je.x=0,je.y=0);let e=n.length,t=qe(n,V);ke=t.length,Se=+(100/Ce*ke).toFixed(2),a.d=t,a.report={original:v,new:e,saved:v-e,compression:Se,decimals:G},r&&r.setAttribute("d",t)}}if(De){if(Ge.length){let e=He(Ge,_e);e=it(e);let t=qe(e,V);Ie[0].el.setAttribute("d",t);for(let e=1;e<Ie.length;e++){let t=Ie[e].el;t&&t.remove()}!function(e){e.querySelectorAll("g, defs").forEach(e=>{e.children.length||e.remove()})}(we)}if(B){let{x:e,y:t,width:a,height:l,w:r,h:n,hasViewBox:s,hasWidth:i,hasHeight:o,widthUnit:p,heightUnit:h}=Ne;O&&(e=je.x,t=je.y,a=je.width,l=je.height,r=a,n=l),s&&we.setAttribute("viewBox",[e,t,a,l].map(e=>+(e*B).toFixed(G)).join(" ")),i&&we.setAttribute("width",+(r*B).toFixed(G)+p),o&&we.setAttribute("height",+(n*B).toFixed(G)+h)}if(w){we.querySelectorAll("path[fill-rule], path[clip-rule]").forEach(e=>{e.removeAttribute("fill-rule"),e.removeAttribute("clip-rule")})}we=function(e,t=!1){let a=(new XMLSerializer).serializeToString(e);return t&&(a=a.replaceAll('xmlns="http://www.w3.org/2000/svg"',"")),a=a.replace(/\t/g,"").replace(/[\n\r|]/g,"\n").replace(/\n\s*\n/g,"\n").replace(/ +/g," ").replace(/> </g,"><").trim().replaceAll("&#10;","\n"),a}(we,A),ke=we.length,Se=+(100/Ce*ke).toFixed(2),Ce=+(Ce/1024).toFixed(3),ke=+(ke/1024).toFixed(3),Ee={svgSize:Ce,svgSizeOpt:ke,compression:Se,decimals:G}}else({d:Pe,report:Ee}=Ie[0]);return $e.length&&1===$e.length&&($e=$e[0]),t?{svg:we,d:Pe,polys:$e,report:Ee,pathDataPlusArr:Te,inputType:Ae}:Pe||we}"undefined"!=typeof window&&(window.svgPathSimplify=Rt,window.getElementTransform=ce,window.getViewBox=lt);export{M as PI,a as abs,l as acos,r as asin,n as atan,s as atan2,i as ceil,o as cos,p as exp,h as floor,ce as getElementTransform,lt as getViewBox,c as hypot,u as log,y as max,x as min,f as pow,g as random,d as round,m as sin,v as sqrt,Rt as svgPathSimplify,b as tan};