(()=>{var I,v,b;(I=Path2D.prototype).roundRect??(I.roundRect=d),globalThis.CanvasRenderingContext2D&&((v=globalThis.CanvasRenderingContext2D.prototype).roundRect??(v.roundRect=d)),globalThis.OffscreenCanvasRenderingContext2D&&((b=globalThis.OffscreenCanvasRenderingContext2D.prototype).roundRect??(b.roundRect=d));function d(e,l,x,y,n){if(![e,l,x,y].every(i=>Number.isFinite(i)))return;n=N(n);let t,h,a,s;if(n.length===4)t=o(n[0]),h=o(n[1]),a=o(n[2]),s=o(n[3]);else if(n.length===3)t=o(n[0]),h=o(n[1]),s=o(n[1]),a=o(n[2]);else if(n.length===2)t=o(n[0]),a=o(n[0]),h=o(n[1]),s=o(n[1]);else if(n.length===1)t=o(n[0]),h=o(n[0]),a=o(n[0]),s=o(n[0]);else throw new RangeError(`${R(this)} ${n.length} is not a valid size for radii sequence.`);const p=[t,h,a,s],u=p.find(({x:i,y:r})=>i<0||r<0);if((u==null?void 0:u.x)<0?u.x:u==null||u.y,p.some(({x:i,y:r})=>!Number.isFinite(i)||!Number.isFinite(r)))return;if(u)throw new RangeError(`${R(this)} Radius value ${u} is negative.`);D(p),x<0&&y<0?(this.moveTo(e-t.x,l),this.ellipse(e+x+h.x,l-h.y,h.x,h.y,0,-Math.PI*1.5,-Math.PI),this.ellipse(e+x+a.x,l+y+a.y,a.x,a.y,0,-Math.PI,-Math.PI/2),this.ellipse(e-s.x,l+y+s.y,s.x,s.y,0,-Math.PI/2,0),this.ellipse(e-t.x,l-t.y,t.x,t.y,0,0,-Math.PI/2)):x<0?(this.moveTo(e-t.x,l),this.ellipse(e+x+h.x,l+h.y,h.x,h.y,0,-Math.PI/2,-Math.PI,1),this.ellipse(e+x+a.x,l+y-a.y,a.x,a.y,0,-Math.PI,-Math.PI*1.5,1),this.ellipse(e-s.x,l+y-s.y,s.x,s.y,0,Math.PI/2,0,1),this.ellipse(e-t.x,l+t.y,t.x,t.y,0,0,-Math.PI/2,1)):y<0?(this.moveTo(e+t.x,l),this.ellipse(e+x-h.x,l-h.y,h.x,h.y,0,Math.PI/2,0,1),this.ellipse(e+x-a.x,l+y+a.y,a.x,a.y,0,0,-Math.PI/2,1),this.ellipse(e+s.x,l+y+s.y,s.x,s.y,0,-Math.PI/2,-Math.PI,1),this.ellipse(e+t.x,l-t.y,t.x,t.y,0,-Math.PI,-Math.PI*1.5,1)):(this.moveTo(e+t.x,l),this.ellipse(e+x-h.x,l+h.y,h.x,h.y,0,-Math.PI/2,0),this.ellipse(e+x-a.x,l+y-a.y,a.x,a.y,0,0,Math.PI/2),this.ellipse(e+s.x,l+y-s.y,s.x,s.y,0,Math.PI/2,Math.PI),this.ellipse(e+t.x,l+t.y,t.x,t.y,0,Math.PI,Math.PI*1.5)),this.closePath(),this.moveTo(e,l);function C(i){const{x:r,y:c,z:f,w:P}=i;return{x:r,y:c,z:f,w:P}}function N(i){const r=typeof i;return r==="undefined"||i===null?[0]:r==="function"?[NaN]:r==="object"?typeof i[Symbol.iterator]=="function"?[...i].map(c=>{const f=typeof c;return f==="undefined"||c===null?0:f==="function"?NaN:f==="object"?C(c):M(c)}):[C(i)]:[M(i)]}function M(i){return+i}function o(i){const r=M(i);return Number.isFinite(r)?{x:r,y:r}:Object(i)===i?{x:M(i.x??0),y:M(i.y??0)}:{x:NaN,y:NaN}}function D(i){const[r,c,f,P]=i,O=[Math.abs(x)/(r.x+c.x),Math.abs(y)/(c.y+f.y),Math.abs(x)/(f.x+P.x),Math.abs(y)/(r.y+P.y)],g=Math.min(...O);if(g<=1)for(const m of i)m.x*=g,m.y*=g}}function R(e){return`Failed to execute 'roundRect' on '${T(e)}':`}function T(e){return Object(e)===e&&e instanceof Path2D?"Path2D":e instanceof(globalThis==null?void 0:globalThis.CanvasRenderingContext2D)?"CanvasRenderingContext2D":e instanceof(globalThis==null?void 0:globalThis.OffscreenCanvasRenderingContext2D)?"OffscreenCanvasRenderingContext2D":(e==null?void 0:e.constructor.name)||e}})();
