/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/svg-path-editor-lib@1.0.3/dist/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
const kCommandTypeRegex=/^[\t\n\f\r ]*([MLHVZCSQTAmlhvzcsqta])[\t\n\f\r ]*/,kFlagRegex=/^[01]/,kNumberRegex=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,kCoordinateRegex=kNumberRegex,kCommaWsp=/^(([\t\n\f\r ]+,?[\t\n\f\r ]*)|(,[\t\n\f\r ]*))/,kGrammar={M:[kNumberRegex,kNumberRegex],L:[kNumberRegex,kNumberRegex],H:[kNumberRegex],V:[kNumberRegex],Z:[],C:[kNumberRegex,kNumberRegex,kNumberRegex,kNumberRegex,kNumberRegex,kNumberRegex],S:[kNumberRegex,kNumberRegex,kNumberRegex,kNumberRegex],Q:[kNumberRegex,kNumberRegex,kNumberRegex,kNumberRegex],T:[kNumberRegex,kNumberRegex],A:[kNumberRegex,kNumberRegex,kNumberRegex,kFlagRegex,kFlagRegex,kNumberRegex,kNumberRegex]};var PathParser=class t{static components(t,e,s){const o=kGrammar[t.toUpperCase()],i=[];for(;s<=e.length;){const a=[t];for(const t of o){const o=e.slice(s).match(t);if(null===o){if(1===a.length&&i.length>=1)return[s,i];throw new Error("malformed path (first error at "+s+")")}{a.push(o[0]),s+=o[0].length;const t=e.slice(s).match(kCommaWsp);null!==t&&(s+=t[0].length)}}if(i.push(a),0===o.length)return[s,i];"m"===t&&(t="l"),"M"===t&&(t="L")}throw new Error("malformed path (first error at "+s+")")}static parse(e){let s=0,o=[];for(;s<e.length;){const i=e.slice(s).match(kCommandTypeRegex);if(null===i)throw new Error("malformed path (first error at "+s+")");{const a=i[1];if(0===s&&"m"!==a.toLowerCase())throw new Error("malformed path (first error at "+s+")");s+=i[0].length;const n=t.components(a,e,s);s=n[0],o=[...o,...n[1]]}}return o}};function formatNumber(t,e,s=!1){let o=t.toFixed(e).replace(/^(-?[0-9]*\.([0-9]*[1-9])?)0*$/,"$1").replace(/\.$/,"");return s&&(o=o.replace(/^(-?)0\./,"$1.")),o}var Point=class{constructor(t,e){this.x=t,this.y=e}},SvgPoint=class extends Point{constructor(t,e,s=!0){super(t,e),this.itemReference=new DummySvgItem,this.movable=!0,this.movable=s}},SvgControlPoint=class extends SvgPoint{constructor(t,e,s=!0){super(t.x,t.y,s),this.relations=e,this.subIndex=0}},SvgItem=class t{constructor(t,e){this.previousPoint=new Point(0,0),this.absolutePoints=[],this.absoluteControlPoints=[],this.values=t,this.relative=e}static Make(t){let e;const s=t[0].toUpperCase()!==t[0],o=t.slice(1).map((t=>parseFloat(t)));switch(t[0].toUpperCase()){case MoveTo.key:e=new MoveTo(o,s);break;case LineTo.key:e=new LineTo(o,s);break;case HorizontalLineTo.key:e=new HorizontalLineTo(o,s);break;case VerticalLineTo.key:e=new VerticalLineTo(o,s);break;case ClosePath.key:e=new ClosePath(o,s);break;case CurveTo.key:e=new CurveTo(o,s);break;case SmoothCurveTo.key:e=new SmoothCurveTo(o,s);break;case QuadraticBezierCurveTo.key:e=new QuadraticBezierCurveTo(o,s);break;case SmoothQuadraticBezierCurveTo.key:e=new SmoothQuadraticBezierCurveTo(o,s);break;case EllipticalArcTo.key:e=new EllipticalArcTo(o,s)}if(!e)throw"Invalid SVG item";return e}static MakeFrom(e,s,o){const i=e.targetLocation(),a=i.x.toString(),n=i.y.toString();let r=[];const h=o.toUpperCase();switch(h){case MoveTo.key:r=[MoveTo.key,a,n];break;case LineTo.key:r=[LineTo.key,a,n];break;case HorizontalLineTo.key:r=[HorizontalLineTo.key,a];break;case VerticalLineTo.key:r=[VerticalLineTo.key,n];break;case ClosePath.key:r=[ClosePath.key];break;case CurveTo.key:r=[CurveTo.key,"0","0","0","0",a,n];break;case SmoothCurveTo.key:r=[SmoothCurveTo.key,"0","0",a,n];break;case QuadraticBezierCurveTo.key:r=[QuadraticBezierCurveTo.key,"0","0",a,n];break;case SmoothQuadraticBezierCurveTo.key:r=[SmoothQuadraticBezierCurveTo.key,a,n];break;case EllipticalArcTo.key:r=[EllipticalArcTo.key,"1","1","0","0","0",a,n]}const l=t.Make(r),u=e.absoluteControlPoints;return l.previousPoint=s.targetLocation(),l.absolutePoints=[i],l.resetControlPoints(s),(e instanceof CurveTo||e instanceof SmoothCurveTo)&&(l instanceof CurveTo||l instanceof SmoothCurveTo)&&(l instanceof CurveTo&&(l.values[0]=u[0].x,l.values[1]=u[0].y,l.values[2]=u[1].x,l.values[3]=u[1].y),l instanceof SmoothCurveTo&&(l.values[0]=u[1].x,l.values[1]=u[1].y)),(e instanceof QuadraticBezierCurveTo||e instanceof SmoothQuadraticBezierCurveTo)&&l instanceof QuadraticBezierCurveTo&&(l.values[0]=u[0].x,l.values[1]=u[0].y),o!==h&&l.setRelative(!0),l}refreshAbsolutePoints(t,e){this.previousPoint=e?e.targetLocation():new Point(0,0),this.absolutePoints=[];let s=e?e.targetLocation():new Point(0,0);this.relative||(s=new Point(0,0));for(let t=0;t<this.values.length-1;t+=2)this.absolutePoints.push(new SvgPoint(s.x+this.values[t],s.y+this.values[t+1]))}setRelative(t){this.relative!==t&&(this.relative=!1,t?(this.translate(-this.previousPoint.x,-this.previousPoint.y),this.relative=!0):this.translate(this.previousPoint.x,this.previousPoint.y))}refreshAbsoluteControlPoints(t,e){this.absoluteControlPoints=[]}resetControlPoints(t){}refresh(t,e){this.refreshAbsolutePoints(t,e),this.refreshAbsoluteControlPoints(t,e),this.absolutePoints.forEach((t=>t.itemReference=this)),this.absoluteControlPoints.forEach((t=>t.itemReference=this))}translate(t,e,s=!1){this.relative&&!s||this.values.forEach(((s,o)=>{this.values[o]=s+(o%2==0?t:e)}))}scale(t,e){this.values.forEach(((s,o)=>{this.values[o]=s*(o%2==0?t:e)}))}rotate(t,e,s,o=!1){const i=s*Math.PI/180,a=Math.cos(i),n=Math.sin(i);for(let s=0;s<this.values.length;s+=2){const i=this.values[s],r=this.values[s+1],h=this.relative&&!o?0:t,l=this.relative&&!o?0:e,u=h+(i-h)*a-(r-l)*n,c=l+(i-h)*n+(r-l)*a;this.values[s]=u,this.values[s+1]=c}}targetLocation(){const t=this.absolutePoints.length;return this.absolutePoints[t-1]}setTargetLocation(t){const e=this.targetLocation(),s=t.x-e.x,o=t.y-e.y,i=this.values.length;this.values[i-2]+=s,this.values[i-1]+=o}setControlLocation(t,e){const s=this.absolutePoints[t],o=e.x-s.x,i=e.y-s.y;this.values[2*t]+=o,this.values[2*t+1]+=i}controlLocations(){return this.absoluteControlPoints}getType(t=!1){let e=this.constructor.key;return this.relative&&!t&&(e=e.toLowerCase()),e}asStandaloneString(){return["M",this.previousPoint.x,this.previousPoint.y,this.getType(),...this.values].join(" ")}asString(t=4,e=!1,s=[]){const o=[this.values,...s.map((t=>t.values))].reduce(((t,e)=>t.concat(e)),[]).map((s=>formatNumber(s,t,e)));return[this.getType(),...o].join(" ")}},DummySvgItem=class extends SvgItem{constructor(){super([],!1)}},MoveTo=class extends SvgItem{static{this.key="M"}},LineTo=class extends SvgItem{static{this.key="L"}},CurveTo=class extends SvgItem{static{this.key="C"}refreshAbsoluteControlPoints(t,e){if(!e)throw"Invalid path";this.absoluteControlPoints=[new SvgControlPoint(this.absolutePoints[0],[e.targetLocation()]),new SvgControlPoint(this.absolutePoints[1],[this.targetLocation()])]}resetControlPoints(t){const e=t.targetLocation(),s=this.targetLocation(),o=this.relative?e:new Point(0,0);this.values[0]=2*e.x/3+s.x/3-o.x,this.values[1]=2*e.y/3+s.y/3-o.y,this.values[2]=e.x/3+2*s.x/3-o.x,this.values[3]=e.y/3+2*s.y/3-o.y}},SmoothCurveTo=class t extends SvgItem{static{this.key="S"}refreshAbsoluteControlPoints(e,s){if(this.absoluteControlPoints=[],s instanceof CurveTo||s instanceof t){const t=s.targetLocation(),e=s.absoluteControlPoints[1],o=new Point(2*t.x-e.x,2*t.y-e.y);this.absoluteControlPoints.push(new SvgControlPoint(o,[t],!1))}else{const t=s?s.targetLocation():new Point(0,0),e=new Point(t.x,t.y);this.absoluteControlPoints.push(new SvgControlPoint(e,[],!1))}this.absoluteControlPoints.push(new SvgControlPoint(this.absolutePoints[0],[this.targetLocation()]))}asStandaloneString(){return["M",this.previousPoint.x,this.previousPoint.y,"C",this.absoluteControlPoints[0].x,this.absoluteControlPoints[0].y,this.absoluteControlPoints[1].x,this.absoluteControlPoints[1].y,this.absolutePoints[1].x,this.absolutePoints[1].y].join(" ")}resetControlPoints(t){const e=t.targetLocation(),s=this.targetLocation(),o=this.relative?e:new Point(0,0);this.values[0]=e.x/3+2*s.x/3-o.x,this.values[1]=e.y/3+2*s.y/3-o.y}setControlLocation(t,e){const s=this.absoluteControlPoints[1],o=e.x-s.x,i=e.y-s.y;this.values[0]+=o,this.values[1]+=i}},QuadraticBezierCurveTo=class extends SvgItem{static{this.key="Q"}refreshAbsoluteControlPoints(t,e){if(!e)throw"Invalid path";this.absoluteControlPoints=[new SvgControlPoint(this.absolutePoints[0],[e.targetLocation(),this.targetLocation()])]}resetControlPoints(t){const e=t.targetLocation(),s=this.targetLocation(),o=this.relative?e:new Point(0,0);this.values[0]=e.x/2+s.x/2-o.x,this.values[1]=e.y/2+s.y/2-o.y}},SmoothQuadraticBezierCurveTo=class t extends SvgItem{static{this.key="T"}refreshAbsoluteControlPoints(e,s){if(s instanceof QuadraticBezierCurveTo||s instanceof t){const t=s.targetLocation(),e=s.absoluteControlPoints[0],o=new Point(2*t.x-e.x,2*t.y-e.y);this.absoluteControlPoints=[new SvgControlPoint(o,[t,this.targetLocation()],!1)]}else{const t=s?s.targetLocation():new Point(0,0),e=new Point(t.x,t.y);this.absoluteControlPoints=[new SvgControlPoint(e,[],!1)]}}asStandaloneString(){return["M",this.previousPoint.x,this.previousPoint.y,"Q",this.absoluteControlPoints[0].x,this.absoluteControlPoints[0].y,this.absolutePoints[0].x,this.absolutePoints[0].y].join(" ")}},ClosePath=class extends SvgItem{static{this.key="Z"}refreshAbsolutePoints(t,e){this.previousPoint=e?e.targetLocation():new Point(0,0),this.absolutePoints=[new SvgPoint(t.x,t.y,!1)]}},HorizontalLineTo=class extends SvgItem{static{this.key="H"}rotate(t,e,s,o=!1){180==s&&(this.values[0]=-this.values[0])}refreshAbsolutePoints(t,e){this.previousPoint=e?e.targetLocation():new Point(0,0),this.relative?this.absolutePoints=[new SvgPoint(this.values[0]+this.previousPoint.x,this.previousPoint.y)]:this.absolutePoints=[new SvgPoint(this.values[0],this.previousPoint.y)]}setTargetLocation(t){const e=this.targetLocation(),s=t.x-e.x;this.values[0]+=s}},VerticalLineTo=class extends SvgItem{static{this.key="V"}rotate(t,e,s,o=!1){180==s&&(this.values[0]=-this.values[0])}translate(t,e,s=!1){this.relative||(this.values[0]+=e)}scale(t,e){this.values[0]*=e}refreshAbsolutePoints(t,e){this.previousPoint=e?e.targetLocation():new Point(0,0),this.relative?this.absolutePoints=[new SvgPoint(this.previousPoint.x,this.values[0]+this.previousPoint.y)]:this.absolutePoints=[new SvgPoint(this.previousPoint.x,this.values[0])]}setTargetLocation(t){const e=this.targetLocation(),s=t.y-e.y;this.values[0]+=s}},EllipticalArcTo=class extends SvgItem{static{this.key="A"}translate(t,e,s=!1){this.relative||(this.values[5]+=t,this.values[6]+=e)}rotate(t,e,s,o=!1){this.values[2]=(this.values[2]+s)%360;const i=s*Math.PI/180,a=Math.cos(i),n=Math.sin(i),r=this.values[5],h=this.values[6],l=this.relative&&!o?0:t,u=this.relative&&!o?0:e,c=(r-l)*a-(h-u)*n+l,v=(r-l)*n+(h-u)*a+u;this.values[5]=c,this.values[6]=v}scale(t,e){const s=this.values[0],o=this.values[1],i=Math.PI*this.values[2]/180,a=Math.cos(i),n=Math.sin(i),r=o*o*e*e*a*a+s*s*e*e*n*n,h=2*t*e*a*n*(o*o-s*s),l=s*s*t*t*a*a+o*o*t*t*n*n,u=-s*s*o*o*t*t*e*e,c=h*h-4*r*l,v=Math.sqrt((r-l)*(r-l)+h*h);this.values[2]=0!==h?180*Math.atan((l-r-v)/h)/Math.PI:r<l?0:90,0!==c&&(this.values[0]=-Math.sqrt(2*c*u*(r+l+v))/c,this.values[1]=-Math.sqrt(2*c*u*(r+l-v))/c),this.values[5]*=t,this.values[6]*=e,this.values[4]=t*e>=0?this.values[4]:1-this.values[4]}refreshAbsolutePoints(t,e){this.previousPoint=e?e.targetLocation():new Point(0,0),this.relative?this.absolutePoints=[new SvgPoint(this.values[5]+this.previousPoint.x,this.values[6]+this.previousPoint.y)]:this.absolutePoints=[new SvgPoint(this.values[5],this.values[6])]}asString(t=4,e=!1,s=[]){if(e){const o=[this.values,...s.map((t=>t.values))].map((s=>s.map((s=>formatNumber(s,t,e))))).map((t=>`${t[0]} ${t[1]} ${t[2]} ${t[3]}${t[4]}${t[5]} ${t[6]}`));return[this.getType(),...o].join(" ")}return super.asString(t,e,s)}},SvgPath=class{constructor(t){this.path=PathParser.parse(t).map((t=>SvgItem.Make(t))),this.refreshAbsolutePositions()}translate(t,e){return this.path.forEach(((s,o)=>{s.translate(t,e,0===o)})),this.refreshAbsolutePositions(),this}scale(t,e){return this.path.forEach((s=>{s.scale(t,e)})),this.refreshAbsolutePositions(),this}rotate(t,e,s){return 0==(s%=360)||(this.path.forEach(((o,i)=>{const a=o.constructor;if(180!==s&&(o instanceof HorizontalLineTo||o instanceof VerticalLineTo)){const t=o.relative?LineTo.key.toLowerCase():LineTo.key;o=this.changeType(o,t)||o}if(o.rotate(t,e,s,0===i),90===s||270===s)if(a===HorizontalLineTo){this.refreshAbsolutePositions();const t=o.relative?VerticalLineTo.key.toLowerCase():VerticalLineTo.key;this.changeType(o,t)}else if(a===VerticalLineTo){this.refreshAbsolutePositions();const t=o.relative?HorizontalLineTo.key.toLowerCase():HorizontalLineTo.key;this.changeType(o,t)}})),this.refreshAbsolutePositions()),this}setRelative(t){return this.path.forEach((e=>{e.setRelative(t)})),this.refreshAbsolutePositions(),this}delete(t){const e=this.path.indexOf(t);return-1!==e&&(this.path.splice(e,1),this.refreshAbsolutePositions()),this}insert(t,e){const s=e?this.path.indexOf(e):-1;-1!==s?this.path.splice(s+1,0,t):this.path.push(t),this.refreshAbsolutePositions()}changeType(t,e){const s=this.path.indexOf(t);if(s>0){const o=this.path[s-1];return this.path[s]=SvgItem.MakeFrom(t,o,e),this.refreshAbsolutePositions(),this.path[s]}return null}asString(t=4,e=!1){return this.path.reduce(((t,s)=>{const o=s.getType();if(e&&t.length>0){const e=t[t.length-1];if(e.type===o)return e.trailing.push(s),t}return t.push({type:"m"===o?"l":"M"===o?"L":o,item:s,trailing:[]}),t}),[]).map((s=>{const o=s.item.asString(t,e,s.trailing);return e?o.replace(/^([a-z]) /i,"$1").replace(/ -/g,"-").replace(/(\.[0-9]+) (?=\.)/g,"$1"):o})).join(e?"":" ")}targetLocations(){return this.path.map((t=>t.targetLocation()))}controlLocations(){let t=[];for(let e=1;e<this.path.length;++e){const s=this.path[e].controlLocations();s.forEach(((t,e)=>{t.subIndex=e})),t=[...t,...s]}return t}setLocation(t,e){t instanceof SvgControlPoint?t.itemReference.setControlLocation(t.subIndex,e):t.itemReference.setTargetLocation(e),this.refreshAbsolutePositions()}refreshAbsolutePositions(){let t=null,e=new Point(0,0);for(const s of this.path)s.refresh(e,t),(s instanceof MoveTo||s instanceof ClosePath)&&(e=s.targetLocation()),t=s}};const findPreviousMoveTo=(t,e)=>{let s=e;for(;s>0&&"M"!==t.path[s].getType(!0);)s--;return s},findNextMoveTo=(t,e)=>{let s=e+1;for(;s<t.path.length&&"M"!==t.path[s].getType(!0);)s++;return s},getSubPathBounds=(t,e)=>({start:void 0===e?0:findPreviousMoveTo(t,e),end:void 0===e?t.path.length:findNextMoveTo(t,e)}),toStr$1=t=>[String(t.x),String(t.y)],reversePath=(t,e)=>{const{start:s,end:o}=getSubPathBounds(t,e);if(o-s<=1)return;const i=o<t.path.length&&t.path[o].relative;i&&t.path[o].setRelative(!1);const a=[],n=[...t.path.slice(s,o)].reverse().slice(0,-1),r=n[0].targetLocation();a.push(SvgItem.Make(["M",...toStr$1(r)]));let h="",l=!1;for(const t of n){const e=toStr$1(t.previousPoint),s=t.absolutePoints.map(toStr$1),o=t.getType(!0);switch(o){case"M":case"Z":l&&a.push(SvgItem.Make(["Z"])),l="Z"===o,"M"===a[a.length-1].getType(!0)?a[a.length-1]=SvgItem.Make(["M",...e]):a.push(SvgItem.Make(["M",...e]));break;case"L":a.push(SvgItem.Make(["L",...e]));break;case"H":a.push(SvgItem.Make(["H",e[0]]));break;case"V":a.push(SvgItem.Make(["V",e[1]]));break;case"C":a.push(SvgItem.Make(["C",...s[1],...s[0],...e]));break;case"S":{const o=toStr$1(t.controlLocations()[0]);"S"!==h?a.push(SvgItem.Make(["C",...s[0],...o,...e])):a.push(SvgItem.Make(["S",...o,...e]));break}case"Q":a.push(SvgItem.Make(["Q",...s[0],...e]));break;case"T":if("T"!==h){const s=toStr$1(t.controlLocations()[0]);a.push(SvgItem.Make(["Q",...s,...e]))}else a.push(SvgItem.Make(["T",...e]));break;case"A":a.push(SvgItem.Make(["A",...t.values.slice(0,4).map(String),String(1-t.values[4]),...e]))}h=o}l&&a.push(SvgItem.Make(["Z"])),t.path=[...t.path.slice(0,s),...a,...t.path.slice(o)],t.refreshAbsolutePositions(),i&&t.path[s+a.length].setRelative(!0),optimizePath(t,{removeUselessCommands:!0,useShorthands:!0})},toStr=t=>[String(t.x),String(t.y)],optimizeRelativeAbsolute=t=>{let e=t.asString(4,!0).length;const s=new Point(0,0);for(let o=0;o<t.path.length;++o){const i=o>0?t.path[o-1]:null,a=t.path[o];if("Z"===a.getType(!0))continue;a.setRelative(!a.relative);const n=t.asString(4,!0).length;n<e?(e=n,a.refresh(s,i)):a.setRelative(!a.relative)}},optimizePath=(t,{removeUselessCommands:e=!1,removeOrphanDots:s=!1,useShorthands:o=!1,useHorizontalAndVerticalLines:i=!1,useRelativeAbsolute:a=!1,useReverse:n=!1,useClosePath:r=!1})=>{const h=t.path,l=new Point(0,0);let u=new Point(0,0);for(let t=1;t<h.length;++t){const a=h[t-1],n=h[t],c=a.getType(!0),v=n.getType(!0);if("M"===c&&(u=a.targetLocation()),e){if("M"===c&&"M"===v){n.setRelative(!1),h.splice(t-1,1),t--;continue}if("Z"===c&&"Z"===v){h.splice(t,1),t--;continue}if("Z"===c&&"M"===v){const e=a.targetLocation();if(e.x===n.absolutePoints[0].x&&e.y===n.absolutePoints[0].y){h.splice(t,1),t--;continue}}if("L"===v||"V"===v||"H"===v){const e=n.targetLocation();if(e.x===n.previousPoint.x&&e.y===n.previousPoint.y){h.splice(t,1),t--;continue}}}if(s&&"M"===c&&"Z"===v)h.splice(t,1),t--;else{if(i&&"L"===v){const e=n.targetLocation();if(e.x===n.previousPoint.x){h[t]=SvgItem.MakeFrom(n,a,"V");continue}if(e.y===n.previousPoint.y){h[t]=SvgItem.MakeFrom(n,a,"H");continue}}if(o){if(("Q"===c||"T"===c)&&"Q"===v){const e=toStr(h[t].targetLocation()),s=SvgItem.Make(["T",...e]);s.refresh(l,a);const o=s.controlLocations();o[0].x===n.absolutePoints[0].x&&o[0].y===n.absolutePoints[0].y&&(h[t]=s)}if(("C"===c||"S"===c)&&"C"===v){const e=toStr(h[t].targetLocation()),s=toStr(h[t].absolutePoints[1]),o=SvgItem.Make(["S",...s,...e]);o.refresh(l,a);const i=o.controlLocations();i[0].x===n.absolutePoints[0].x&&i[0].y===n.absolutePoints[0].y&&(h[t]=o)}if("C"!==c&&"S"!==c&&"C"===v&&n.previousPoint.x===n.absolutePoints[0].x&&n.previousPoint.y===n.absolutePoints[0].y){const e=toStr(n.targetLocation()),s=toStr(n.absolutePoints[1]);h[t]=SvgItem.Make(["S",...s,...e]),h[t].refresh(l,a)}}if(r&&("L"===v||"H"===v||"V"===v)){const e=n.targetLocation();u.x===e.x&&u.y===e.y&&(h[t]=SvgItem.Make(["Z"]),h[t].refresh(u,a))}}}if((e||s)&&(h.length>0&&"M"===h[h.length-1].getType(!0)&&h.splice(h.length-1,1),t.refreshAbsolutePositions()),a&&optimizeRelativeAbsolute(t),n){const e=t.asString(4,!0).length,s=t.path;reversePath(t),a&&optimizeRelativeAbsolute(t),t.asString(4,!0).length>=e&&(t.path=s)}},changePathOrigin=(t,e,s)=>{if(t.path.length<=e||0===e)return;const{start:o,end:i}=getSubPathBounds(t,s?e:void 0),a=i-o,n=i<t.path.length&&t.path[i].relative;n&&t.path[i].setRelative(!1);const r=t.path[e],h=t.path[e-1];switch(r.getType().toUpperCase()){case"S":t.changeType(r,r.relative?"c":"C");break;case"T":t.changeType(r,r.relative?"q":"Q")}for(let s=e;s<i;++s){const e=t.path[s],o=e.getType().toUpperCase();if("Z"===o&&t.changeType(e,"L"),"M"===o)break}const l=[],u=t.path.slice(o,i),c=u[0],v=u[a-1];for(let t=0;t<a;++t){if(0===t){const t=h.targetLocation();l.push(SvgItem.Make(["M",String(t.x),String(t.y)]))}if(e+t===o+a){const t=c.targetLocation(),e=v.targetLocation();if(t.x===e.x&&t.y===e.y){const t=u.findIndex(((t,e)=>e>0&&"M"===t.getType().toUpperCase())),e=u.findIndex((t=>"Z"===t.getType().toUpperCase()));if(-1===e||-1!==t&&e>t)continue}}l.push(u[(e-o+t)%a])}t.path=[...t.path.slice(0,o),...l,...t.path.slice(i)],t.refreshAbsolutePositions(),n&&t.path[o+l.length].setRelative(!0),optimizePath(t,{removeUselessCommands:!0,useShorthands:!0,useClosePath:!0})};exports.PathParser=PathParser,exports.Point=Point,exports.SvgControlPoint=SvgControlPoint,exports.SvgItem=SvgItem,exports.SvgPath=SvgPath,exports.SvgPoint=SvgPoint,exports.changePathOrigin=changePathOrigin,exports.formatNumber=formatNumber,exports.optimizePath=optimizePath,exports.reversePath=reversePath;
//# sourceMappingURL=/sm/b3c7b8757332b936fdfe8dc4becac2c26f97c7a86db6268bd0747458432c894d.map