emf-converter 5.0.0 → 5.0.1

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.
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunkEBIZSO4S_js=require('./chunk-EBIZSO4S.js'),chunkGD73XQBZ_js=require('./chunk-GD73XQBZ.js'),chunkSXBOBAYR_js=require('./chunk-SXBOBAYR.js');var _t=[1,0,0,1,0,0];function et(n,t){return [n[0]*t[0]+n[2]*t[1],n[1]*t[0]+n[3]*t[1],n[0]*t[2]+n[2]*t[3],n[1]*t[2]+n[3]*t[3],n[0]*t[4]+n[2]*t[5]+n[4],n[1]*t[4]+n[3]*t[5]+n[5]]}function Y(n){let t=n[0]*n[3]-n[1]*n[2];return !t||!Number.isFinite(t)?null:[n[3]/t,-n[1]/t,-n[2]/t,n[0]/t,(n[2]*n[5]-n[3]*n[4])/t,(n[1]*n[4]-n[0]*n[5])/t]}var nt=class n{constructor(){this.segs=[];this.cur=null;this.start=null;}reset(){this.segs=[],this.cur=null,this.start=null;}moveDevice(t){this.segs.push({t:"M",x:t.x,y:t.y}),this.cur=t,this.start=t;}lineDevice(t){if(!this.cur){this.moveDevice(t);return}this.segs.push({t:"L",x:t.x,y:t.y}),this.cur=t;}static map(t,e,r){return {x:t[0]*e+t[2]*r+t[4],y:t[1]*e+t[3]*r+t[5]}}moveTo(t,e,r){Number.isFinite(e)&&Number.isFinite(r)&&this.moveDevice(n.map(t,e,r));}lineTo(t,e,r){Number.isFinite(e)&&Number.isFinite(r)&&this.lineDevice(n.map(t,e,r));}curveUser(t,e,r,o,s,i,a){let c=n.map(t,e,r),u=n.map(t,o,s),l=n.map(t,i,a);this.cur||this.moveDevice(c),this.segs.push({t:"C",x1:c.x,y1:c.y,x2:u.x,y2:u.y,x:l.x,y:l.y}),this.cur=l;}bezierCurveTo(t,e,r,o,s,i,a){[e,r,o,s,i,a].every(Number.isFinite)&&this.curveUser(t,e,r,o,s,i,a);}quadraticCurveTo(t,e,r,o,s){if(![e,r,o,s].every(Number.isFinite))return;let i=Y(t),a=this.cur&&i?{x:i[0]*this.cur.x+i[2]*this.cur.y+i[4],y:i[1]*this.cur.x+i[3]*this.cur.y+i[5]}:{x:e,y:r};this.curveUser(t,a.x+2/3*(e-a.x),a.y+2/3*(r-a.y),o+2/3*(e-o),s+2/3*(r-s),o,s);}closePath(){this.cur&&(this.segs.push({t:"Z"}),this.cur=this.start);}rect(t,e,r,o,s){[e,r,o,s].every(Number.isFinite)&&(this.moveDevice(n.map(t,e,r)),this.lineDevice(n.map(t,e+o,r)),this.lineDevice(n.map(t,e+o,r+s)),this.lineDevice(n.map(t,e,r+s)),this.segs.push({t:"Z"}),this.moveDevice(n.map(t,e,r)));}ellipseUser(t,e,r,o,s,i,a,c,u){let l=Math.PI*2,m=c-a;u?m=-m>=l?-l:-((-m%l+l)%l):m=m>=l?l:(m%l+l)%l;let h=Math.cos(i),b=Math.sin(i),f=A=>{let R=o*Math.cos(A),g=s*Math.sin(A);return {x:e+R*h-g*b,y:r+R*b+g*h}},p=A=>{let R=-o*Math.sin(A),g=s*Math.cos(A);return {x:R*h-g*b,y:R*b+g*h}},M=f(a);if(this.lineDevice(n.map(t,M.x,M.y)),m===0)return;let x=Math.max(1,Math.ceil(Math.abs(m)/(Math.PI/2)-1e-9)),E=m/x,d=4/3*Math.tan(E/4);for(let A=0;A<x;A++){let R=a+A*E,g=R+E,S=f(R),y=f(g),P=p(R),T=p(g);this.curveUser(t,S.x+d*P.x,S.y+d*P.y,y.x-d*T.x,y.y-d*T.y,y.x,y.y);}}ellipse(t,e,r,o,s,i,a,c,u=false){if(o<0||s<0)throw new RangeError("The radii provided are negative");[e,r,o,s,i,a,c].every(Number.isFinite)&&this.ellipseUser(t,e,r,o,s,i,a,c,u);}arc(t,e,r,o,s,i,a=false){if(o<0)throw new RangeError("The radius provided is negative");[e,r,o,s,i].every(Number.isFinite)&&this.ellipseUser(t,e,r,o,o,0,s,i,a);}arcTo(t,e,r,o,s,i){if(![e,r,o,s,i].every(Number.isFinite)||i<0)return;if(!this.cur){this.moveDevice(n.map(t,e,r));return}let a=Y(t);if(!a)return;let c=a[0]*this.cur.x+a[2]*this.cur.y+a[4],u=a[1]*this.cur.x+a[3]*this.cur.y+a[5],l=c-e,m=u-r,h=o-e,b=s-r,f=Math.hypot(l,m),p=Math.hypot(h,b),M=l*b-m*h;if(i===0||f===0||p===0||Math.abs(M)<1e-12*f*p){this.lineDevice(n.map(t,e,r));return}let x=l/f,E=m/f,d=h/p,A=b/p,R=Math.acos(Math.max(-1,Math.min(1,x*d+E*A))),g=i/Math.tan(R/2),S={x:e+x*g,y:r+E*g},y={x:e+d*g,y:r+A*g},P=x+d,T=E+A,C=Math.hypot(P,T),L=i/Math.sin(R/2),_={x:e+P/C*L,y:r+T/C*L},w=Math.atan2(S.y-_.y,S.x-_.x),D=Math.atan2(y.y-_.y,y.x-_.x)-w;for(;D>Math.PI;)D-=2*Math.PI;for(;D<=-Math.PI;)D+=2*Math.PI;this.ellipseUser(t,_.x,_.y,i,i,0,w,w+D,D<0);}};function ft(n,t,e){let r=[],o=null,s=0,i=0,a=0,c=0,u=(l,m)=>{let h={pts:[l,m],smooth:[false],closed:false};return r.push(h),h};for(let l of n)switch(l.t){case "M":o=u(l.x,l.y),s=a=l.x,i=c=l.y;break;case "L":o||(o=u(s,i)),o.pts.push(l.x,l.y),o.smooth.push(false),a=l.x,c=l.y;break;case "C":{o||(o=u(s,i));let m=Math.max(Math.abs(a-2*l.x1+l.x2),Math.abs(l.x1-2*l.x2+l.x)),h=Math.max(Math.abs(c-2*l.y1+l.y2),Math.abs(l.y1-2*l.y2+l.y)),b=Math.hypot(m,h),f=e?e(a,c,l.x1,l.y1,l.x2,l.y2,l.x,l.y):Math.max(1,Math.min(1e3,Math.ceil(Math.sqrt(.75*b/t))));for(let p=1;p<=f;p++){let M=p/f,x=1-M,E=x*x*x,d=3*x*x*M,A=3*x*M*M,R=M*M*M;o.pts.push(E*a+d*l.x1+A*l.x2+R*l.x,E*c+d*l.y1+A*l.y2+R*l.y),o.smooth.push(p<f);}a=l.x,c=l.y;break}case "Z":o&&(o.closed=true,o=null,a=s,c=i);break}return r}function Qt(n,t,e,r){let o=0,s=0;for(let i of n){let a=i.pts,c=a.length/2;if(!(c<2))for(let u=0;u<c;u++){let l=a[u*2],m=a[u*2+1],h=u+1<c?u+1:0,b=a[h*2],f=a[h*2+1];(m<=e?f>e:f<=e)&&l+(e-m)*(b-l)/(f-m)>t&&(s++,o+=f>m?1:-1);}}return r==="evenodd"?(s&1)===1:o!==0}function It(n){let t=/^\s*((?:(?:italic|oblique|normal|bold|bolder|lighter|small-caps|\d{3})\s+)*)([\d.]+)px\s+(.+)$/i.exec(n);if(!t)return {style:"",weight:"",size:10,family:"sans-serif"};let e=t[1].trim().split(/\s+/).filter(Boolean),r=e.find(s=>/^(italic|oblique)$/i.test(s))??"",o=e.find(s=>/^(bold|bolder|lighter|\d{3})$/i.test(s))??"";return {style:r,weight:o,size:parseFloat(t[2]),family:t[3].trim()}}function Ot(n,t){let e=0;for(let r of n)/[ilj.,;:'!|]/.test(r)?e+=.28:/[mwMW@]/.test(r)?e+=.83:/[A-Z0-9]/.test(r)?e+=.64:r===" "?e+=.28:r.charCodeAt(0)>11903?e+=1:e+=.52;return e*t}function tn(n,t,e,r,o,s,i){let a=It(r).size,c=Ot(n,a)*1.5+a;i!==void 0&&Number.isFinite(i)&&i>0&&(c=Math.min(c,i+a));let u=a*.3,l,m;o==="center"?(l=t-c/2,m=t+c/2):o==="right"||o==="end"?(l=t-c,m=t+u):(l=t-u,m=t+c);let h,b;switch(s){case "top":case "hanging":h=.3,b=1.5;break;case "middle":h=.9,b=.9;break;case "bottom":case "ideographic":h=1.5,b=.3;break;default:h=1.2,b=.5;}return {x0:l,y0:e-h*a,x1:m,y1:e+b*a}}var oe=new Uint8Array(new Uint32Array([1]).buffer)[0]===1;function nn(n,t,e,r){let o=Math.round(n)&255,s=Math.round(t)&255,i=Math.round(e)&255,a=Math.round(r)&255;return (oe?a<<24|i<<16|s<<8|o:o<<24|s<<16|i<<8|a)>>>0}function ur(n,t,e){let r=o=>o.toString(16).padStart(2,"0");return `#${r(n&255)}${r(t&255)}${r(e&255)}`}function lr(n){let t=(n>>>24&255)/255,e=n>>>16&255,r=n>>>8&255,o=n&255;return `rgba(${e},${r},${o},${t.toFixed(3)})`}function mr(n,t,e){let r=Math.min(1,Math.max(0,e)),o=(m,h)=>Math.round(m+(h-m)*r),s=n>>>24&255,i=t>>>24&255,a=o(n>>>16&255,t>>>16&255),c=o(n>>>8&255,t>>>8&255),u=o(n&255,t&255),l=o(s,i)/255;return `rgba(${a},${c},${u},${l.toFixed(3)})`}function en(n){let t=/^#([0-9a-f]{6})$/i.exec(n);if(t)return `#${(16777215^parseInt(t[1],16)).toString(16).padStart(6,"0")}`;let e=/^#([0-9a-f]{3})$/i.exec(n);if(e){let[o,s,i]=e[1].split("").map(c=>parseInt(c+c,16)),a=c=>(255-c).toString(16).padStart(2,"0");return `#${a(o)}${a(s)}${a(i)}`}let r=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+)\s*)?\)$/i.exec(n);if(r){let o=255-Math.min(255,parseInt(r[1],10)),s=255-Math.min(255,parseInt(r[2],10)),i=255-Math.min(255,parseInt(r[3],10));return r[4]!==void 0?`rgba(${o},${s},${i},${r[4]})`:`rgb(${o},${s},${i})`}return n}var vt=new Float64Array(0),rn=new Uint8Array(0),bt=[],G=new Float64Array(0);function se(n){if(G.length<n){let t=new Float64Array(Math.max(n,G.length*2,1024));t.set(G),G=t;}}function ie(n,t,e,r,o,s,i,a,c){if(i===c)return;let u=1;if(i>c){u=-1;let M=s;s=a,a=M,M=i,i=c,c=M;}let l=Math.max(0,i),m=Math.min(r,c);if(l>=m)return;let h=(M,x,E)=>{let d=M*e+x;n[d]+=E,t[d]||(t[d]=1,bt[M].push(x));},b=(a-s)/(c-i),f=Math.min(o,Math.max(0,s+(l-i)*b)),p=Math.ceil(m);for(let M=Math.floor(l);M<p;M++){let x=Math.min(M+1,m)-Math.max(M,l),E=f+b*x;E<0?E=0:E>o&&(E=o);let d=x*u,A=f<E?f:E,R=f<E?E:f,g=Math.floor(A),S=Math.ceil(R);if(S<=g+1){let y=.5*(f+E)-g;h(M,g,d-d*y),h(M,g+1,d*y);}else {let y=1/(R-A),P=A-g,T=.5*y*(1-P)*(1-P),C=R-S+1,L=.5*y*C*C;if(h(M,g,d*T),S===g+2)h(M,g+1,d*(1-T-L));else {let _=y*(1.5-P);h(M,g+1,d*(_-T));for(let I=g+2;I<S-1;I++)h(M,I,d*y);let w=_+(S-g-3)*y;h(M,S-1,d*(1-w-L));}h(M,S,d*L);}f=E;}}function ae(n,t){let e;if(t){let r=Math.abs(n);r-=2*Math.floor(r/2),e=r>1?2-r:r;}else e=Math.abs(n),e>1&&(e=1);return Math.round(e*255)}var ce=(n,t)=>n-t;function rt(n,t,e,r){let o=1/0,s=1/0,i=-1/0,a=-1/0;for(let R of n)for(let g=0;g+1<R.length;g+=2){let S=R[g],y=R[g+1];S<o&&(o=S),S>i&&(i=S),y<s&&(s=y),y>a&&(a=y);}if(!(o<=i)||!(s<=a)||!Number.isFinite(o+i+s+a))return null;let c=Math.max(e.x0,Math.floor(o)),u=Math.max(e.y0,Math.floor(s)),l=Math.min(e.x1,Math.ceil(i)),m=Math.min(e.y1,Math.ceil(a));if(l<=c||m<=u)return null;let h=l-c,b=0,f=(R,g,S,y)=>{g!==y&&(se((b+1)*4),G[b*4]=R,G[b*4+1]=g,G[b*4+2]=S,G[b*4+3]=y,b++);},p=(R,g,S,y)=>{if(!(g===y||Math.max(g,y)<=u||Math.min(g,y)>=m)&&!(R>=h&&S>=h)){if(R>h||S>h){let P=(h-R)/(S-R),T=g+(y-g)*P;R>h?(R=h,g=T):(S=h,y=T);}if(R<=0&&S<=0){f(0,g,0,y);return}if(R<0||S<0){let P=(0-R)/(S-R),T=g+(y-g)*P;R<0?(f(0,g,0,T),f(0,T,S,y)):(f(R,g,0,T),f(0,T,0,y));return}f(R,g,S,y);}};for(let R of n){let g=R.length>>1;if(!(g<2))for(let S=0;S<g;S++){let y=S+1<g?S+1:0;p(R[S*2]-c,R[S*2+1],R[y*2]-c,R[y*2+1]);}}if(b===0)return null;let M=h+2,x=Math.max(1,Math.min(m-u,Math.floor(1048576/M)));for(vt.length<x*M&&(vt=new Float64Array(x*M),rn=new Uint8Array(x*M));bt.length<x;)bt.push([]);let E=vt,d=rn,A=t==="evenodd";for(let R=u;R<m;R+=x){let g=Math.min(x,m-R);for(let S=0;S<b;S++){let y=S*4,P=G[y+1]-R,T=G[y+3]-R;P<=0&&T<=0||P>=g&&T>=g||ie(E,d,M,g,h,G[y],P,G[y+2],T);}for(let S=0;S<g;S++){let y=bt[S];if(y.length===0)continue;y.sort(ce);let P=S*M,T=R+S,C=0;for(let L=0;L<y.length;L++){let _=y[L];if(C+=E[P+_],E[P+_]=0,d[P+_]=0,_>=h)continue;let w=L+1<y.length?Math.min(y[L+1],h):h,I=ae(C,A);I&&r(T,c+_,c+w,I);}y.length=0;}}return {x0:c,y0:u,x1:l,y1:m}}var ue={black:0,white:16777215,red:16711680,lime:65280,green:32768,blue:255,yellow:16776960,cyan:65535,aqua:65535,magenta:16711935,fuchsia:16711935,gray:8421504,grey:8421504,silver:12632256,maroon:8388608,olive:8421376,teal:32896,navy:128,purple:8388736,orange:16753920,darkgray:11119017,darkgrey:11119017,lightgray:13882323,lightgrey:13882323,dimgray:6908265,dimgrey:6908265,whitesmoke:16119285,gainsboro:14474460},xt=new Map;function dt(n){let t=xt.get(n);if(t!==void 0)return t;let e=le(n.trim().toLowerCase());return xt.size>4096&&xt.clear(),xt.set(n,e),e}function le(n){if(n==="transparent")return [0,0,0,0];if(n[0]==="#"){let r=n.slice(1);if(!/^[0-9a-f]+$/.test(r))return null;if(r.length===3||r.length===4){let o=[...r].map(s=>parseInt(s+s,16));return [o[0],o[1],o[2],r.length===4?o[3]/255:1]}return r.length===6||r.length===8?[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16),r.length===8?parseInt(r.slice(6,8),16)/255:1]:null}let t=/^rgba?\(([^)]*)\)$/.exec(n);if(t){let r=t[1].split(/[\s,/]+/).filter(Boolean);if(r.length<3)return null;let o=a=>{let c=a.endsWith("%")?parseFloat(a)*255/100:parseFloat(a);return Math.max(0,Math.min(255,Math.round(c)))},s=r.length>3?r[3].endsWith("%")?parseFloat(r[3])/100:parseFloat(r[3]):1,i=[o(r[0]),o(r[1]),o(r[2])];return i.some(a=>!Number.isFinite(a))||!Number.isFinite(s)?null:[i[0],i[1],i[2],Math.max(0,Math.min(1,s))]}let e=ue[n];return e===void 0?null:[e>>16&255,e>>8&255,e&255,1]}var H=class{constructor(t,e){this.kind=t;this.coords=e;this.stops=[];this.sorted=null;}addColorStop(t,e){if(!(t>=0&&t<=1))throw new RangeError("Gradient stop offset out of range");let r=dt(e);if(!r)throw new SyntaxError(`Invalid colour: ${e}`);this.stops.push({offset:t,color:r}),this.sorted=null;}sortedStops(){return this.sorted||(this.sorted=this.stops.map((t,e)=>({s:t,i:e})).sort((t,e)=>t.s.offset-e.s.offset||t.i-e.i).map(t=>t.s)),this.sorted}},V=class{constructor(t,e,r,o){this.data=t;this.width=e;this.height=r;this.repetition=o;this.matrix=[1,0,0,1,0,0];}setTransform(t){let e=[t?.a??1,t?.b??0,t?.c??0,t?.d??1,t?.e??0,t?.f??0];e.every(Number.isFinite)&&(this.matrix=e);}};function on(n,t,e){let r,o=n.length;if(t<=n[0].offset)r=n[0].color;else if(t>=n[o-1].offset)r=n[o-1].color;else {let s=0,i=o-1;for(;i-s>1;){let h=s+i>>1;n[h].offset<=t?s=h:i=h;}let a=n[s],c=n[i],u=c.offset-a.offset,l=u>0?(t-a.offset)/u:1,m=a.color[3]+(c.color[3]-a.color[3])*l;e[0]=(a.color[0]+(c.color[0]-a.color[0])*l)*m,e[1]=(a.color[1]+(c.color[1]-a.color[1])*l)*m,e[2]=(a.color[2]+(c.color[2]-a.color[2])*l)*m,e[3]=m*255;return}e[0]=r[0]*r[3],e[1]=r[1]*r[3],e[2]=r[2]*r[3],e[3]=r[3]*255;}function me(n,t){let e=n.sortedStops(),r=Y(t);if(e.length===0||!r)return null;let o=n.coords;if(n.kind==="linear"){let[p,M,x,E]=o,d=x-p,A=E-M,R=d*d+A*A;return R>0?{shade(g,S,y){let P=g+.5,T=S+.5,C=r[0]*P+r[2]*T+r[4],L=r[1]*P+r[3]*T+r[5];return on(e,((C-p)*d+(L-M)*A)/R,y),true}}:null}let[s,i,a,c,u,l]=o;if(s===c&&i===u&&a===l)return null;let m=c-s,h=u-i,b=l-a,f=m*m+h*h-b*b;return {shade(p,M,x){let E=p+.5,d=M+.5,A=r[0]*E+r[2]*d+r[4]-s,R=r[1]*E+r[3]*d+r[5]-i,g=A*m+R*h+a*b,S=A*A+R*R-a*a,y;if(Math.abs(f)<1e-12){if(Math.abs(g)<1e-12||(y=S/(2*g),a+y*b<0))return false}else {let P=g*g-f*S;if(P<0)return false;let T=Math.sqrt(P),C=(g+T)/f,L=(g-T)/f,_=Math.max(C,L),w=Math.min(C,L);if(a+_*b>=0)y=_;else if(a+w*b>=0)y=w;else return false}return on(e,y,x),true}}}function sn(n,t){let e=n%t;return e<0?e+t:e}function he(n,t,e,r){if(n.transparentOutside&&(!n.wrapX&&(t<n.minX||t>=n.maxX)||!n.wrapY&&(e<n.minY||e>=n.maxY)))return false;let o=n.data,s=n.width,i=T=>n.wrapX?sn(T,s):Math.min(n.maxX-1,Math.max(n.minX,T)),a=T=>n.wrapY?sn(T,n.height):Math.min(n.maxY-1,Math.max(n.minY,T));if(!n.smooth){let T=(a(Math.floor(e))*s+i(Math.floor(t)))*4;return r[0]=o[T],r[1]=o[T+1],r[2]=o[T+2],r[3]=o[T+3],true}let c=t-.5,u=e-.5,l=Math.floor(c),m=Math.floor(u),h=c-l,b=u-m,f=i(l),p=i(l+1),M=a(m)*s,x=a(m+1)*s,E=(M+f)*4,d=(M+p)*4,A=(x+f)*4,R=(x+p)*4,g=(1-h)*(1-b),S=h*(1-b),y=(1-h)*b,P=h*b;for(let T=0;T<4;T++)r[T]=o[E+T]*g+o[d+T]*S+o[A+T]*y+o[R+T]*P;return true}function wt(n,t){let e=Y(t);return e?{shade(r,o,s){let i=r+.5,a=o+.5;return he(n,e[0]*i+e[2]*a+e[4],e[1]*i+e[3]*a+e[5],s)}}:null}function ot(n,t,e){if(typeof n=="string"){let r=dt(n);return r?{solid:[r[0]*r[3],r[1]*r[3],r[2]*r[3],r[3]*255]}:null}if(n instanceof H)return me(n,t);if(n instanceof V){let r=n.repetition,o=r==="repeat"||r==="repeat-x",s=r==="repeat"||r==="repeat-y";return wt({data:n.data,width:n.width,height:n.height,wrapX:o,wrapY:s,minX:0,minY:0,maxX:n.width,maxY:n.height,transparentOutside:true,smooth:e},et(t,n.matrix))}return null}var ln=new Set(["copy","source-in","source-out","destination-in","destination-atop"]),Nt={multiply:(n,t)=>n*t,screen:(n,t)=>n+t-n*t,overlay:(n,t)=>an(t,n),darken:(n,t)=>Math.min(n,t),lighten:(n,t)=>Math.max(n,t),"color-dodge":(n,t)=>t===0?0:n>=1?1:Math.min(1,t/(1-n)),"color-burn":(n,t)=>t>=1?1:n<=0?0:1-Math.min(1,(1-t)/n),"hard-light":(n,t)=>an(n,t),"soft-light":(n,t)=>{if(n<=.5)return t-(1-2*n)*t*(1-t);let e=t<=.25?((16*t-12)*t+4)*t:Math.sqrt(t);return t+(2*n-1)*(e-t)},difference:(n,t)=>Math.abs(n-t),exclusion:(n,t)=>n+t-2*n*t};function an(n,t){return n<=.5?t*2*n:Nt.screen(2*n-1,t)}function Z(n,t,e){return .3*n+.59*t+.11*e}function fe(n){let t=Z(n[0],n[1],n[2]),e=Math.min(n[0],n[1],n[2]),r=Math.max(n[0],n[1],n[2]),[o,s,i]=n;return e<0&&(o=t+(o-t)*t/(t-e),s=t+(s-t)*t/(t-e),i=t+(i-t)*t/(t-e)),r>1&&(o=t+(o-t)*(1-t)/(r-t),s=t+(s-t)*(1-t)/(r-t),i=t+(i-t)*(1-t)/(r-t)),[o,s,i]}function pt(n,t){let e=t-Z(n[0],n[1],n[2]);return fe([n[0]+e,n[1]+e,n[2]+e])}function cn(n){return Math.max(n[0],n[1],n[2])-Math.min(n[0],n[1],n[2])}function un(n,t){let e=[0,1,2].sort((a,c)=>n[a]-n[c]),r=[0,0,0],[o,s,i]=e;return n[i]>n[o]&&(r[s]=(n[s]-n[o])*t/(n[i]-n[o]),r[i]=t),r}var mn={hue:(n,t)=>pt(un(n,cn(t)),Z(t[0],t[1],t[2])),saturation:(n,t)=>pt(un(t,cn(n)),Z(t[0],t[1],t[2])),color:(n,t)=>pt(n,Z(t[0],t[1],t[2])),luminosity:(n,t)=>pt(t,Z(n[0],n[1],n[2]))};function hn(n){return n in Nt||n in mn||["source-over","source-in","source-out","source-atop","destination-over","destination-in","destination-out","destination-atop","xor","copy","lighter"].includes(n)}function st(n,t,e,r,o,s,i,a){let c=n[t]/255,u=n[t+1]/255,l=n[t+2]/255,m=n[t+3]/255,h,b,f,p;switch(a){case "source-over":h=e+c*(1-s),b=r+u*(1-s),f=o+l*(1-s),p=s+m*(1-s);break;case "copy":h=e,b=r,f=o,p=s;break;case "destination-over":h=e*(1-m)+c,b=r*(1-m)+u,f=o*(1-m)+l,p=s*(1-m)+m;break;case "source-in":h=e*m,b=r*m,f=o*m,p=s*m;break;case "destination-in":h=c*s,b=u*s,f=l*s,p=m*s;break;case "source-out":h=e*(1-m),b=r*(1-m),f=o*(1-m),p=s*(1-m);break;case "destination-out":h=c*(1-s),b=u*(1-s),f=l*(1-s),p=m*(1-s);break;case "source-atop":h=e*m+c*(1-s),b=r*m+u*(1-s),f=o*m+l*(1-s),p=m;break;case "destination-atop":h=e*(1-m)+c*s,b=r*(1-m)+u*s,f=o*(1-m)+l*s,p=s;break;case "xor":h=e*(1-m)+c*(1-s),b=r*(1-m)+u*(1-s),f=o*(1-m)+l*(1-s),p=s*(1-m)+m*(1-s);break;case "lighter":h=Math.min(1,e+c),b=Math.min(1,r+u),f=Math.min(1,o+l),p=Math.min(1,s+m);break;default:{p=s+m-s*m;let M=s*m,x=[s>0?e/s:0,s>0?r/s:0,s>0?o/s:0],E=[m>0?c/m:0,m>0?u/m:0,m>0?l/m:0],d,A=Nt[a];if(A)d=[A(x[0],E[0]),A(x[1],E[1]),A(x[2],E[2])];else {let R=mn[a];if(!R){st(n,t,e,r,o,s,i,"source-over");return}d=R(x,E);}h=e*(1-m)+c*(1-s)+M*d[0],b=r*(1-m)+u*(1-s)+M*d[1],f=o*(1-m)+l*(1-s)+M*d[2];}}i<1&&(h=c+(h-c)*i,b=u+(b-u)*i,f=l+(f-l)*i,p=m+(p-m)*i),n[t]=h*255,n[t+1]=b*255,n[t+2]=f*255,n[t+3]=p*255;}function fn(n,t){let e=Math.abs(n),r=Math.abs(t);if(e<r){let o=e;e=r,r=o;}return e+r/2}function dn(n,t){let e=fn(n[0]*t,n[1]*t),r=fn(n[2]*t,n[3]*t);return e<=1&&r<=1?(e+r)/2:null}function Mn(n,t,e,r,o,s,i,a){let c=i/3+2*n/3,u=a/3+2*t/3,l=n/3+2*i/3,m=t/3+2*a/3,h=Math.max(Math.abs(e-c),Math.abs(r-u),Math.abs(o-l),Math.abs(s-m)),b=1/8;for(let f=0;f<9;f++){if(h<b)return 1<<f;b*=4;}return 512}var Mt=32768;function bn(n,t){return Math.trunc(n*65536/t)}function xn(n,t){return n*t>>6}function En(n,t,e,r,o,s,i){let a=0,c=1,u=e-n,l=r-t,m=[[-u,n+1],[u,o+1-n],[-l,t+1],[l,s+1-t]];for(let[h,b]of m)if(h===0){if(b<0)return}else {let f=b/h;h<0?a=Math.max(a,f):c=Math.min(c,f);}a>c||Ft(Math.round((n+u*a)*64),Math.round((t+l*a)*64),Math.round((n+u*c)*64),Math.round((t+l*c)*64),i);}function Ft(n,t,e,r,o){if(Math.abs(e-n)>511*64||Math.abs(r-t)>511*64){let s=(n>>1)+(e>>1),i=(t>>1)+(r>>1);Ft(n,t,s,i,o),Ft(s,i,e,r,o);return}if(Math.abs(e-n)>Math.abs(r-t)){n>e&&([n,e]=[e,n],[t,r]=[r,t]);let s=n>>6,i=e+63>>6,a=t<<10,c=t===r?0:bn(r-t,e-n);a+=c*(32-(n&63))+32>>6,pn(s,i,a,c,e-n,n&63,e&63,(u,l,m,h)=>{m&&o(u,l-1,m),h&&o(u,l,h);});}else {if(n===e&&t===r)return;t>r&&([n,e]=[e,n],[t,r]=[r,t]);let s=t>>6,i=r+63>>6,a=n<<10,c=n===e?0:bn(e-n,r-t);a+=c*(32-(t&63))+32>>6,pn(s,i,a,c,r-t,t&63,r&63,(u,l,m,h)=>{m&&o(l-1,u,m),h&&o(l,u,h);});}}function pn(n,t,e,r,o,s,i,a){if(t<=n)return;let c,u;t-n===1?(c=o,u=0):(c=64-s,u=i);let l=(f,p,M)=>{p+=Mt;let x=p>>16,E=p>>8&255;return a(f,x,xn(255-E,M),xn(E,M)),p+r-Mt},m=l(n,e,c),h=n+1,b=t-h-(u>0?1:0);if(b>0){m+=Mt;for(let f=0;f<b;f++,h++){let p=m>>16,M=m>>8&255;a(h,p,255-M,M),m+=r;}m-=Mt;}u>0&&l(t-1,m,u);}var Q=1e-9;function gn(n){let t=[],e=[],r=n.pts;for(let o=0;o<r.length;o+=2){let s=t.length;s>=2&&Math.abs(t[s-2]-r[o])<Q&&Math.abs(t[s-1]-r[o+1])<Q||(t.push(r[o],r[o+1]),e.push(n.smooth[o>>1]??false));}if(n.closed&&t.length>=4){let o=t.length;Math.abs(t[o-2]-t[0])<Q&&Math.abs(t[o-1]-t[1])<Q&&(t.length-=2,e.length-=1);}return e[0]=false,{pts:t,smooth:e,closed:n.closed}}function Tn(n,t,e){let r=t.reduce((f,p)=>f+p,0);if(!(r>0))return [n];let o=n.pts,s=o.length>>1,i=n.closed?s:s-1;if(i<1)return [n];let a=e%r;a<0&&(a+=r);let c=0;for(;a>0&&a>=t[c];)a-=t[c],c=(c+1)%t.length;let u=t[c]-a,l=c%2===0,m=[],h=l?{pts:[o[0],o[1]],smooth:[false],closed:false}:null,b=l;for(let f=0;f<i;f++){let p=o[f*2],M=o[f*2+1],x=(f+1)%s,E=o[x*2],d=o[x*2+1],A=Math.hypot(E-p,d-M),R=0;for(;A-R>u;){R+=u;let g=R/A,S=p+(E-p)*g,y=M+(d-M)*g;l&&h?(h.pts.push(S,y),h.smooth.push(false),h.pts.length===4&&Math.abs(h.pts[0]-S)<Q&&Math.abs(h.pts[1]-y)<Q&&(h.pts.length=2,h.smooth.length=1,h.dir=[(E-p)/A,(d-M)/A]),m.push(h),h=null):h={pts:[S,y],smooth:[false],closed:false,dir:[(E-p)/A,(d-M)/A]},l=!l,c=(c+1)%t.length,u=t[c];}u-=A-R,l&&h&&(h.pts.push(E,d),h.smooth.push(x===0?false:n.smooth[x]));}if(l&&h){if(n.closed&&b&&m.length>0){let f=m.shift();h.pts.push(...f.pts.slice(2)),h.smooth.push(...f.smooth.slice(1));}m.push(h);}for(let f of m)f.pts.length>2&&delete f.dir;return m}function Ut(n,t,e,r,o,s,i){let a=Math.ceil(Math.abs(s)/i);for(let c=1;c<a;c++){let u=o+s*c/a;n.push(t+r*Math.cos(u),e+r*Math.sin(u));}}function be(n,t,e,r,o,s,i,a,c,u,l,m,h,b,f){let p=t+a*m,M=e+c*m,x=t+u*m,E=e+l*m,d=r*s+o*i,A=r*i-o*s;if(n.push(p,M),Math.abs(A)<1e-12&&d>0)return;if(!(a*s+c*i<0||Math.abs(A)<1e-12&&d<0)){n.push(t,e),n.push(x,E);return}if(h==="round"){let g=Math.atan2(c,a),S=Math.atan2(l,u)-g;for(;S<=-Math.PI;)S+=2*Math.PI;for(;S>Math.PI;)S-=2*Math.PI;Math.abs(A)<1e-12&&(S=Math.PI*Math.sign(a*o-c*r)),Ut(n,t,e,m,g,S,f);}else if(h==="miter"){let g=a*u+c*l,S=Math.sqrt(Math.max(0,(1+g)/2));if(S>1e-12&&1/S<=b){let y=a+u,P=c+l,T=Math.hypot(y,P);if(T>1e-12){let C=m/S;n.push(t+y/T*C,e+P/T*C);}}}n.push(x,E);}function xe(n,t,e,r){let o=t.lineWidth/2,s=n.pts,i=s.length>>1,a=t.lineCap;if(i===1){if(!r||n.closed||a==="butt")return [];let x=s[0],E=s[1],[d,A]=n.dir??[1,0];if(a==="round"){let S=[x+o,E];return Ut(S,x,E,o,0,2*Math.PI,e),[S]}let R=-A,g=d;return [[x+(d+R)*o,E+(A+g)*o,x+(-d+R)*o,E+(-A+g)*o,x+(-d-R)*o,E+(-A-g)*o,x+(d-R)*o,E+(A-g)*o]]}let c=n.closed?i:i-1,u=new Float64Array(c*2);for(let x=0;x<c;x++){let E=(x+1)%i,d=s[E*2]-s[x*2],A=s[E*2+1]-s[x*2+1],R=Math.hypot(d,A)||1;u[x*2]=d/R,u[x*2+1]=A/R;}let l=x=>{let E=[],d=n.closed?0:1,A=n.closed?i-1:i-2;n.closed||E.push(s[0]+x*u[1]*o,s[1]-x*u[0]*o);for(let R=d;R<=A;R++){let g=(R-1+c)%c,S=R%c,y=u[g*2],P=u[g*2+1],T=u[S*2],C=u[S*2+1],L=n.smooth[R]?"round":t.lineJoin;be(E,s[R*2],s[R*2+1],y,P,T,C,x*P,-x*y,x*C,-x*T,o,L,t.miterLimit,e);}if(!n.closed){let R=c-1;E.push(s[(i-1)*2]+x*u[R*2+1]*o,s[(i-1)*2+1]-x*u[R*2]*o);}return E},m=l(1),h=l(-1),b=x=>{let E=[];for(let d=x.length-2;d>=0;d-=2)E.push(x[d],x[d+1]);return E};if(n.closed)return [m,b(h)];let f=m.slice(),p=(x,E,d,A)=>{if(a==="square")f.push(x+(A+d)*o,E+(-d+A)*o),f.push(x+(-A+d)*o,E+(d+A)*o);else if(a==="round"){let R=Math.atan2(-d,A);Ut(f,x,E,o,R,Math.PI,e);}},M=i-1;return p(s[M*2],s[M*2+1],u[(c-1)*2],u[(c-1)*2+1]),f.push(...b(h)),p(s[0],s[1],-u[0],-u[1]),[f]}function Rn(n,t,e){let r=Y(t);if(!r)return [];let o=[];for(let s of n){let i={pts:new Array(s.pts.length),smooth:s.smooth,closed:s.closed};for(let u=0;u<s.pts.length;u+=2){let l=s.pts[u],m=s.pts[u+1];i.pts[u]=r[0]*l+r[2]*m+r[4],i.pts[u+1]=r[1]*l+r[3]*m+r[5];}let a=gn(i),c=e.lineDash.length>0?Tn(a,e.lineDash,e.lineDashOffset):[a];for(let u of c){let l=u.pts;for(let m=0;m<l.length;m+=2){let h=l[m],b=l[m+1];l[m]=t[0]*h+t[2]*b+t[4],l[m+1]=t[1]*h+t[3]*b+t[5];}o.push({pts:l,smooth:u.smooth,closed:u.closed});}}return o}function Dt(n,t,e,r){let o=Y(t);if(!o||!(e.lineWidth>0))return [];let s=Math.max(Math.hypot(t[0],t[1]),Math.hypot(t[2],t[3])),i=Math.max(1e-6,e.lineWidth/2*s),a=i<=r?Math.PI/2:Math.max(.05,2*Math.acos(1-r/i)),c=[];for(let u of n){let l={pts:new Array(u.pts.length),smooth:u.smooth,closed:u.closed};for(let f=0;f<u.pts.length;f+=2){let p=u.pts[f],M=u.pts[f+1];l.pts[f]=o[0]*p+o[2]*M+o[4],l.pts[f+1]=o[1]*p+o[3]*M+o[5];}let m=u.pts.length>=4,h=gn(l),b=e.lineDash.length>0?Tn(h,e.lineDash,e.lineDashOffset):[h];for(let f of b)for(let p of xe(f,e,a,m)){for(let M=0;M<p.length;M+=2){let x=p[M],E=p[M+1];p[M]=t[0]*x+t[2]*E+t[4],p[M+1]=t[1]*x+t[3]*E+t[5];}c.push(p);}}return c}var it=.05,kt=null;function pe(){if(kt)return kt;let n=Math.fround,t=n(1/255),e=new Uint8Array(256*256);for(let r=1;r<256;r++){let o=n(1/n(r*t));for(let s=0;s<256;s++){let i=n(n(n(s*t)*o)*255),a=Math.min(Math.max(i,0),255),c=Math.floor(a),u=a-c;e[r<<8|s]=u>.5||u===.5&&c%2===1?c+1:c;}}return kt=e,e}var z=class{constructor(t,e){this.unknown=null;this.textDraws=0;this.width=Math.max(1,Math.floor(t)),this.height=Math.max(1,Math.floor(e)),this.data=new Uint8ClampedArray(this.width*this.height*4),this.words=new Uint32Array(this.data.buffer),this.ctx=new at(this);}getContext(t){return this.ctx}get pixels(){return this.readRgba(0,0,this.width,this.height)}readRgba(t,e,r,o){let s=new Uint8ClampedArray(Math.max(0,r*o*4)),{width:i,height:a,data:c}=this;for(let u=0;u<o;u++){let l=e+u;if(!(l<0||l>=a))for(let m=0;m<r;m++){let h=t+m;if(h<0||h>=i)continue;let b=(l*i+h)*4,f=(u*r+m)*4,p=c[b+3];if(p===255)s[f]=c[b],s[f+1]=c[b+1],s[f+2]=c[b+2],s[f+3]=255;else if(p!==0){let M=pe(),x=p<<8;s[f]=M[x|c[b]],s[f+1]=M[x|c[b+1]],s[f+2]=M[x|c[b+2]],s[f+3]=p;}}}return s}unknownIn(t,e,r,o){let s=this.unknown;if(!s)return null;let i=null;for(let a=0;a<o;a++){let c=e+a;if(!(c<0||c>=this.height))for(let u=0;u<r;u++){let l=t+u;l>=0&&l<this.width&&s[c*this.width+l]&&(i??(i=new Uint8Array(r*o)),i[a*r+u]=1);}}return i}markUnknown(t,e=null){let r=e?e.box:{x0:0,y0:0,x1:this.width,y1:this.height};this.unknown??(this.unknown=new Uint8Array(this.width*this.height));let o=this.unknown;rt([t],"nonzero",r,(s,i,a)=>{for(let c=i;c<a;c++)(!e||j(e,c,s))&&(o[s*this.width+c]=1);});}};function Pr(n){return n instanceof z||n instanceof at}function j(n,t,e){let r=n.box;return t<r.x0||t>=r.x1||e<r.y0||e>=r.y1?0:n.mask?n.mask[(e-r.y0)*(r.x1-r.x0)+(t-r.x0)]:255}function Sn(n,t,e,r){let o=n[t*2]-n[e*2],s=n[t*2+1]-n[e*2+1],i=Math.hypot(o,s);i>0&&(n[t*2]+=o/i*r,n[t*2+1]+=s/i*r);}function de(n){let t=n.length>>1;if(t===5&&n[0]===n[8]&&n[1]===n[9]&&(t=4),t!==4)return null;let e=[n[0],n[2],n[4],n[6]],r=[n[1],n[3],n[5],n[7]];if(![...e,...r].every(Number.isInteger))return null;let o=r[0]===r[1]&&e[1]===e[2]&&r[2]===r[3]&&e[3]===e[0],s=e[0]===e[1]&&r[1]===r[2]&&e[2]===e[3]&&r[3]===r[0];return !o&&!s?null:{x0:Math.min(...e),y0:Math.min(...r),x1:Math.max(...e),y1:Math.max(...r)}}function Bt(n){if(n instanceof z)return {data:n.data,width:n.width,height:n.height};if(n instanceof at)return Bt(n.canvas);let t=n,e=null;if(t&&t.data instanceof Uint8ClampedArray&&typeof t.width=="number"&&typeof t.height=="number")e={data:t.data,width:t.width,height:t.height};else if(t&&typeof t.getContext=="function"&&typeof t.width=="number"&&typeof t.height=="number")try{let a=t.getContext("2d")?.getImageData?.(0,0,t.width,t.height);a&&(e={data:a.data,width:t.width,height:t.height});}catch{e=null;}if(!e||e.width<=0||e.height<=0)return null;let r=e.width*e.height*4;if(e.data.length<r)return null;let o=new Uint8ClampedArray(r),s=e.data;for(let i=0;i<r;i+=4){let a=s[i+3];if(a===255)o[i]=s[i],o[i+1]=s[i+1],o[i+2]=s[i+2],o[i+3]=255;else if(a!==0){let c=a/255;o[i]=s[i]*c,o[i+1]=s[i+1]*c,o[i+2]=s[i+2]*c,o[i+3]=a;}}return {data:o,width:e.width,height:e.height}}var at=class{constructor(t){this.state={transform:[..._t],fillStyle:"#000000",strokeStyle:"#000000",lineWidth:1,lineCap:"butt",lineJoin:"miter",miterLimit:10,lineDash:[],lineDashOffset:0,globalAlpha:1,gco:"source-over",font:"10px sans-serif",textAlign:"start",textBaseline:"alphabetic",imageSmoothingEnabled:true,imageSmoothingQuality:"low",clip:null};this.stack=[];this.path=new nt;this.flatCache=null;this.rowCache=null;this.px=new Float64Array(4);this.canvas=t;}get fillStyle(){return this.state.fillStyle}set fillStyle(t){this.acceptStyle(t)&&(this.state.fillStyle=t);}get strokeStyle(){return this.state.strokeStyle}set strokeStyle(t){this.acceptStyle(t)&&(this.state.strokeStyle=t);}acceptStyle(t){return typeof t=="string"&&dt(t)!==null||t instanceof H||t instanceof V}get lineWidth(){return this.state.lineWidth}set lineWidth(t){Number.isFinite(t)&&t>0&&(this.state.lineWidth=t);}get lineCap(){return this.state.lineCap}set lineCap(t){(t==="butt"||t==="round"||t==="square")&&(this.state.lineCap=t);}get lineJoin(){return this.state.lineJoin}set lineJoin(t){(t==="miter"||t==="round"||t==="bevel")&&(this.state.lineJoin=t);}get miterLimit(){return this.state.miterLimit}set miterLimit(t){Number.isFinite(t)&&t>0&&(this.state.miterLimit=t);}get lineDashOffset(){return this.state.lineDashOffset}set lineDashOffset(t){Number.isFinite(t)&&(this.state.lineDashOffset=t);}get globalAlpha(){return this.state.globalAlpha}set globalAlpha(t){Number.isFinite(t)&&t>=0&&t<=1&&(this.state.globalAlpha=t);}get globalCompositeOperation(){return this.state.gco}set globalCompositeOperation(t){hn(t)&&(this.state.gco=t);}get font(){return this.state.font}set font(t){this.state.font=t;}get textAlign(){return this.state.textAlign}set textAlign(t){this.state.textAlign=t;}get textBaseline(){return this.state.textBaseline}set textBaseline(t){this.state.textBaseline=t;}get imageSmoothingEnabled(){return this.state.imageSmoothingEnabled}set imageSmoothingEnabled(t){this.state.imageSmoothingEnabled=!!t;}get imageSmoothingQuality(){return this.state.imageSmoothingQuality}set imageSmoothingQuality(t){this.state.imageSmoothingQuality=t;}setLineDash(t){!Array.isArray(t)||t.some(e=>!Number.isFinite(e)||e<0)||(this.state.lineDash=t.length%2?[...t,...t]:[...t]);}getLineDash(){return [...this.state.lineDash]}save(){this.stack.push({...this.state,transform:[...this.state.transform],lineDash:[...this.state.lineDash]});}restore(){let t=this.stack.pop();t&&(this.state=t);}getTransform(){let[t,e,r,o,s,i]=this.state.transform;return {a:t,b:e,c:r,d:o,e:s,f:i}}setTransform(t,e,r,o,s,i){let a=typeof t=="object"?[t.a??1,t.b??0,t.c??0,t.d??1,t.e??0,t.f??0]:[t,e,r,o,s,i];a.every(Number.isFinite)&&(this.state.transform=a);}resetTransform(){this.state.transform=[..._t];}transform(t,e,r,o,s,i){[t,e,r,o,s,i].every(Number.isFinite)&&(this.state.transform=et(this.state.transform,[t,e,r,o,s,i]));}translate(t,e){this.transform(1,0,0,1,t,e);}scale(t,e){this.transform(t,0,0,e,0,0);}rotate(t){let e=Math.cos(t),r=Math.sin(t);this.transform(e,r,-r,e,0,0);}beginPath(){this.path.reset();}closePath(){this.path.closePath();}moveTo(t,e){this.path.moveTo(this.state.transform,t,e);}lineTo(t,e){this.path.lineTo(this.state.transform,t,e);}bezierCurveTo(t,e,r,o,s,i){this.path.bezierCurveTo(this.state.transform,t,e,r,o,s,i);}quadraticCurveTo(t,e,r,o){this.path.quadraticCurveTo(this.state.transform,t,e,r,o);}arc(t,e,r,o,s,i=false){this.path.arc(this.state.transform,t,e,r,o,s,i);}arcTo(t,e,r,o,s){this.path.arcTo(this.state.transform,t,e,r,o,s);}ellipse(t,e,r,o,s,i,a,c=false){this.path.ellipse(this.state.transform,t,e,r,o,s,i,a,c);}rect(t,e,r,o){this.path.rect(this.state.transform,t,e,r,o);}flattened(){let t=this.path.segs,e=this.flatCache;if(e&&e.segs===t&&e.length===t.length)return e.polys;let r=ft(t,it);return this.flatCache={segs:t,length:t.length,polys:r},this.rowCache=null,r}strokeParams(){let t=this.state;return {lineWidth:t.lineWidth,lineCap:t.lineCap,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset}}surfaceBounds(){let t=this.state.clip,e={x0:0,y0:0,x1:this.canvas.width,y1:this.canvas.height};return t&&(e.x0=Math.max(e.x0,t.box.x0),e.y0=Math.max(e.y0,t.box.y0),e.x1=Math.min(e.x1,t.box.x1),e.y1=Math.min(e.y1,t.box.y1)),e}paintRings(t,e,r){if(!r||t.length===0)return;let o=this.surfaceBounds();if(o.x1<=o.x0||o.y1<=o.y0)return;let s=this.state.gco;if(ln.has(s)){this.paintUnbounded(t,e,r,o);return}let i=this.state.globalAlpha;if(i<=0)return;let{data:a,width:c}=this.canvas,u=this.state.clip?.mask?this.state.clip:null,l=this.canvas.unknown,m=this.px,h=r.solid,b=h?null:r.shade,f=h?h[0]*i/255:0,p=h?h[1]*i/255:0,M=h?h[2]*i/255:0,x=h?h[3]*i/255:0;if(h&&x<=0&&(s==="source-over"||s==="destination-out"||s==="source-atop"||s==="lighter"||s==="xor"))return;let E=h!==void 0&&x>=1&&s==="source-over",d=E?this.canvas.words:null,A=h?nn(h[0],h[1],h[2],255):0;rt(t,e,o,(R,g,S,y)=>{let P=R*c;if(d&&y===255&&!u){d.fill(A,P+g,P+S),l&&l.fill(0,P+g,P+S);return}let T=(P+g)*4,C=P+g;for(let L=g;L<S;L++,T+=4,C++){let _=y;if(u&&(_=_*j(u,L,R)/255),_<=0)continue;let w=_>=255?1:_/255,I=f,D=p,N=M,X=x;if(b){if(!b(L,R,m))continue;I=m[0]*i/255,D=m[1]*i/255,N=m[2]*i/255,X=m[3]*i/255;}E&&w===1?(a[T]=h[0],a[T+1]=h[1],a[T+2]=h[2],a[T+3]=255):st(a,T,I,D,N,X,w,s),l&&l[C]&&w===1&&X>=.9999&&(s==="source-over"||s==="destination-out")&&(l[C]=0);}});}paintUnbounded(t,e,r,o){let s=o.x1-o.x0,i=o.y1-o.y0,a=new Uint8Array(s*i);rt(t,e,o,(p,M,x,E)=>{let d=(p-o.y0)*s-o.x0;a.fill(E,d+M,d+x);});let{data:c,width:u}=this.canvas,l=this.state.clip,m=this.canvas.unknown,h=this.state.globalAlpha,b=this.state.gco,f=this.px;for(let p=o.y0;p<o.y1;p++)for(let M=o.x0;M<o.x1;M++){let x=l?j(l,M,p)/255:1;if(x<=0)continue;let E=a[(p-o.y0)*s+(M-o.x0)]/255,d=0,A=0,R=0,g=0;if(E>0){r.solid?[d,A,R,g]=r.solid:r.shade(M,p,f)&&([d,A,R,g]=f);let y=E*h/255;d*=y,A*=y,R*=y,g*=y;}let S=p*u+M;st(c,S*4,d,A,R,g,x,b),m&&x>=1&&b==="copy"&&(m[S]=0);}}fill(t="nonzero"){let e=this.flattened();this.paintRings(e.map(r=>r.pts),t==="evenodd"?"evenodd":"nonzero",ot(this.state.fillStyle,this.state.transform,this.state.imageSmoothingEnabled));}stroke(){this.strokeSegs(this.path.segs,this.flattened());}strokeSegs(t,e){let r=ot(this.state.strokeStyle,this.state.transform,this.state.imageSmoothingEnabled);if(!r)return;let o=dn(this.state.transform,this.state.lineWidth);if(o===null){let l=Dt(e,this.state.transform,this.strokeParams(),it);this.paintRings(l,"nonzero",r);return}let s=Rn(ft(t,it,Mn),this.state.transform,this.strokeParams()),i=this.state.lineCap==="square"?.5:this.state.lineCap==="round"?Math.PI/8:0,{width:a,height:c}=this.canvas,u=this.hairlinePlotter(r,o);for(let l of s){let m=l.pts.slice(),h=m.length>>1;if(h<2)continue;i&&!l.closed&&(Sn(m,0,1,i),Sn(m,h-1,h-2,i));let b=l.closed?h:h-1;for(let f=0;f<b;f++){let p=(f+1)%h;En(m[f*2],m[f*2+1],m[p*2],m[p*2+1],a,c,u);}}}hairlinePlotter(t,e){let{data:r,width:o,height:s}=this.canvas,i=this.state.clip,a=this.state.gco,c=this.state.globalAlpha*Math.min(1,e),u=this.px;return (l,m,h)=>{if(l<0||m<0||l>=o||m>=s)return;let b=h/255;if(i&&(b*=j(i,l,m)/255),b<=0)return;let f,p,M,x;if(t.solid)[f,p,M,x]=t.solid;else {if(!t.shade(l,m,u))return;[f,p,M,x]=u;}let E=c/255;st(r,(m*o+l)*4,f*E,p*E,M*E,x*E,b,a);}}rectRing(t,e,r,o){let s=this.state.transform,i=[[t,e],[t+r,e],[t+r,e+o],[t,e+o]],a=[];for(let[c,u]of i)a.push(s[0]*c+s[2]*u+s[4],s[1]*c+s[3]*u+s[5]);return a}fillRect(t,e,r,o){![t,e,r,o].every(Number.isFinite)||r===0||o===0||this.paintRings([this.rectRing(t,e,r,o)],"nonzero",ot(this.state.fillStyle,this.state.transform,this.state.imageSmoothingEnabled));}strokeRect(t,e,r,o){if(![t,e,r,o].every(Number.isFinite))return;let s=new nt;s.rect(this.state.transform,t,e,r,o),this.strokeSegs(s.segs,ft(s.segs,it));}clearRect(t,e,r,o){if(![t,e,r,o].every(Number.isFinite)||r===0||o===0)return;let s={gco:this.state.gco,ga:this.state.globalAlpha};this.state.gco="destination-out",this.state.globalAlpha=1,this.paintRings([this.rectRing(t,e,r,o)],"nonzero",{solid:[0,0,0,255]}),this.state.gco=s.gco,this.state.globalAlpha=s.ga;}clip(t="nonzero"){let e=this.surfaceBounds(),r=this.state.clip,o=this.flattened().filter(u=>u.pts.length>=6).map(u=>u.pts),s={box:{x0:0,y0:0,x1:0,y1:0},mask:null},i=o.length===1?de(o[0]):null;if(i){let u={x0:Math.max(e.x0,i.x0),y0:Math.max(e.y0,i.y0),x1:Math.min(e.x1,i.x1),y1:Math.min(e.y1,i.y1)};if(u.x1<=u.x0||u.y1<=u.y0){this.state.clip=s;return}let l=null;if(r?.mask){let m=u.x1-u.x0;l=new Uint8Array(m*(u.y1-u.y0));for(let h=u.y0;h<u.y1;h++)for(let b=u.x0;b<u.x1;b++)l[(h-u.y0)*m+(b-u.x0)]=j(r,b,h);}this.state.clip={box:u,mask:l};return}let a=s,c=null;for(let u of o)for(let l=0;l+1<u.length;l+=2){let m=u[l],h=u[l+1];c??(c={x0:1/0,y0:1/0,x1:-1/0,y1:-1/0}),c.x0=Math.min(c.x0,m),c.y0=Math.min(c.y0,h),c.x1=Math.max(c.x1,m),c.y1=Math.max(c.y1,h);}if(c&&Number.isFinite(c.x0+c.x1+c.y0+c.y1)){let u={x0:Math.max(e.x0,Math.floor(c.x0)),y0:Math.max(e.y0,Math.floor(c.y0)),x1:Math.min(e.x1,Math.ceil(c.x1)),y1:Math.min(e.y1,Math.ceil(c.y1))};if(u.x1>u.x0&&u.y1>u.y0){let l=u.x1-u.x0,m=new Uint8Array(l*(u.y1-u.y0));rt(o,t==="evenodd"?"evenodd":"nonzero",u,(b,f,p,M)=>{let x=(b-u.y0)*l-u.x0;if(!r?.mask){m.fill(M,x+f,x+p);return}for(let E=f;E<p;E++)m[x+E]=Math.round(M*j(r,E,b)/255);})&&(a={box:u,mask:m});}}this.state.clip=a;}clipCoverage(t,e,r,o){let s=this.state.clip;if(!s)return null;let i=new Uint8Array(Math.max(0,r*o));for(let a=0;a<o;a++)for(let c=0;c<r;c++)i[a*r+c]=j(s,t+c,e+a);return i}isPointInPath(t,e,r="nonzero"){if(!Number.isFinite(t)||!Number.isFinite(e))return false;let o=this.flattened(),s=`${e}`,i=this.rowCache;if(!i||i.key!==s){let u=[],l=[];for(let f of o){let p=f.pts,M=p.length>>1;if(!(M<2))for(let x=0;x<M;x++){let E=x+1<M?x+1:0,d=p[x*2],A=p[x*2+1],R=p[E*2],g=p[E*2+1];(A<=e?g>e:g<=e)&&(u.push(d+(e-A)*(R-d)/(g-A)),l.push(g>A?1:-1));}}let m=u.map((f,p)=>p).sort((f,p)=>u[f]-u[p]),h=new Float64Array(m.length),b=new Int32Array(m.length+1);for(let f=0;f<m.length;f++)h[f]=u[m[f]];for(let f=m.length-1;f>=0;f--)b[f]=b[f+1]+l[m[f]];i={key:s,xs:h,suffixWinding:b,count:m.length},this.rowCache=i;}let a=0,c=i.count;for(;a<c;){let u=a+c>>1;i.xs[u]>t?c=u:a=u+1;}return r==="evenodd"?(i.count-a&1)===1:i.suffixWinding[a]!==0}isPointInStroke(t,e){let r=Dt(this.flattened(),this.state.transform,this.strokeParams(),it);return Qt(r.map(o=>({pts:o,smooth:[],closed:true})),t,e,"nonzero")}createLinearGradient(t,e,r,o){return new H("linear",[t,e,r,o])}createRadialGradient(t,e,r,o,s,i){if(r<0||i<0)throw new RangeError("The radius provided is negative");return new H("radial",[t,e,r,o,s,i])}createPattern(t,e){let r=Bt(t);if(!r)return null;let o=e==="repeat-x"||e==="repeat-y"||e==="no-repeat"?e:"repeat";return new V(r.data.slice(),r.width,r.height,o)}measureText(t){let e=It(this.state.font).size,r=Ot(String(t),e);return {width:r,actualBoundingBoxLeft:0,actualBoundingBoxRight:r,actualBoundingBoxAscent:e*.8,actualBoundingBoxDescent:e*.2,fontBoundingBoxAscent:e*.9,fontBoundingBoxDescent:e*.25}}fillText(t,e,r,o){this.recordText(t,e,r,o,this.state.fillStyle);}strokeText(t,e,r,o){this.recordText(t,e,r,o,this.state.strokeStyle);}recordText(t,e,r,o,s){let i=String(t??"");if(!i.trim()||![e,r].every(Number.isFinite)||this.state.globalAlpha<=0)return;let a=ot(s,this.state.transform,true);if(!a||a.solid&&a.solid[3]<=0)return;this.canvas.textDraws++;let c=tn(i,e,r,this.state.font,this.state.textAlign,this.state.textBaseline,o),u=this.state.transform,l=[];for(let[m,h]of [[c.x0,c.y0],[c.x1,c.y0],[c.x1,c.y1],[c.x0,c.y1]])l.push(u[0]*m+u[2]*h+u[4],u[1]*m+u[3]*h+u[5]);this.canvas.markUnknown(l,this.state.clip);}drawImage(t,...e){let r=Bt(t);if(!r)return;(t===this.canvas||t===this)&&(r={...r,data:r.data.slice()});let o=0,s=0,i=r.width,a=r.height,c,u,l,m;if(e.length>=8?[o,s,i,a,c,u,l,m]=e:e.length>=4?[c,u,l,m]=e:([c,u]=e,l=i,m=a),![o,s,i,a,c,u,l,m].every(Number.isFinite)||!i||!a||!l||!m)return;i<0&&(o+=i,i=-i),a<0&&(s+=a,a=-a),l<0&&(c+=l,l=-l),m<0&&(u+=m,m=-m);let h=l/i,b=m/a,f=Math.max(0,o),p=Math.max(0,s),M=Math.min(r.width,o+i),x=Math.min(r.height,s+a);if(M<=f||x<=p)return;c+=(f-o)*h,u+=(p-s)*b,o=f,s=p,i=M-f,a=x-p;let E=[h,0,0,b,c-o*h,u-s*b],d=et(this.state.transform,E),A=wt({data:r.data,width:r.width,height:r.height,wrapX:false,wrapY:false,minX:Math.floor(o),minY:Math.floor(s),maxX:Math.ceil(o+i),maxY:Math.ceil(s+a),transparentOutside:false,smooth:this.state.imageSmoothingEnabled},d),R=d,g=[];for(let[S,y]of [[o,s],[o+i,s],[o+i,s+a],[o,s+a]])g.push(R[0]*S+R[2]*y+R[4],R[1]*S+R[3]*y+R[5]);this.paintRings([g],"nonzero",A);}createImageData(t,e){let r=Math.abs(Math.floor(t))||1,o=Math.abs(Math.floor(e))||1;return {data:new Uint8ClampedArray(r*o*4),width:r,height:o}}getImageData(t,e,r,o){let s=Math.floor(t),i=Math.floor(e),a=Math.floor(r),c=Math.floor(o);return a<0&&(s+=a,a=-a),c<0&&(i+=c,c=-c),{data:this.canvas.readRgba(s,i,a,c),width:a,height:c,colorSpace:"srgb"}}putImageData(t,e,r,o=0,s=0,i=t.width,a=t.height){let{width:c,height:u,data:l}=this.canvas,m=this.canvas.unknown,h=Math.round(e),b=Math.round(r);i<0&&(o+=i,i=-i),a<0&&(s+=a,a=-a);let f=Math.max(0,Math.floor(o)),p=Math.max(0,Math.floor(s)),M=Math.min(t.width,Math.floor(o+i)),x=Math.min(t.height,Math.floor(s+a)),E=t.data;for(let d=p;d<x;d++){let A=b+d;if(!(A<0||A>=u))for(let R=f;R<M;R++){let g=h+R;if(g<0||g>=c)continue;let S=(d*t.width+R)*4,y=(A*c+g)*4,P=E[S+3];if(P===255)l[y]=E[S],l[y+1]=E[S+1],l[y+2]=E[S+2];else {let T=P/255;l[y]=E[S]*T,l[y+1]=E[S+1]*T,l[y+2]=E[S+2]*T;}l[y+3]=P,m&&(m[A*c+g]=0);}}}};function yn(n,t,e,r,o,s,i,a,c,u){let l=0,m=o-1,h=t,b=t+e;for(;h+1<b&&m>=0;){let f=n.getUint8(h),p=n.getUint8(h+1);if(h+=2,f===0)if(p===0)l=0,m--;else {if(p===1)break;if(p===2){if(h+1>=b)break;l+=n.getUint8(h),m-=n.getUint8(h+1),h+=2;}else {let M=p;if(i){let x=Math.ceil(M/2),E=0;for(let d=0;d<x&&h<b;d++){let A=n.getUint8(h++);for(let R=0;R<2&&E<M;R++){let g=R===0?A>>4&15:A&15;g<a.length&&l<r&&u(l,o-1-m,a[g][0],a[g][1],a[g][2],255),l++,E++;}}x&1&&h++;}else {for(let x=0;x<M&&h<b&&l<r;x++){let E=n.getUint8(h++);E<a.length&&u(l,o-1-m,a[E][0],a[E][1],a[E][2],255),l++;}M&1&&h++;}}}else if(i){let M=p>>4&15,x=p&15;for(let E=0;E<f&&l<r;E++){let d=(E&1)===0?M:x;d<a.length&&u(l,o-1-m,a[d][0],a[d][1],a[d][2],255),l++;}}else {let M=p,x=M<a.length?a[M]:[0,0,0];for(let E=0;E<f&&l<r;E++)u(l,o-1-m,x[0],x[1],x[2],255),l++;}}return ct(new Uint8ClampedArray(c.buffer,c.byteOffset,c.byteLength),r,o)}function Gt(n){if(n===0)return 0;let t=0,e=n;for(;(e&1)===0;)e>>>=1,t++;return t}var Me=3;function An(n,t,e,r,o){let s=0,i=0,a=0,c=0,u=0,l=0,m=1,h=1,b=1;if(r===Me){let f=t+e;if(f+12>n.byteLength)return null;s=n.getUint32(f,true),i=n.getUint32(f+4,true),a=n.getUint32(f+8,true),c=Gt(s),u=Gt(i),l=Gt(a),m=s>>>c||1,h=i>>>u||1,b=a>>>l||1;}else o===16&&(s=31744,i=992,a=31,c=10,u=5,l=0,m=31,h=31,b=31);return {rMask:s,gMask:i,bMask:a,rShift:c,gShift:u,bShift:l,rMax:m,gMax:h,bMax:b}}function Pn(n,t,e,r,o,s,i,a,c,u=false){let l=Math.floor((s*e+31)/32)*4,{rMask:m,gMask:h,bMask:b,rShift:f,gShift:p,bShift:M,rMax:x,gMax:E,bMax:d}=a;for(let A=0;A<r;A++){let R=o?A:r-1-A,g=t+R*l;if(!(g+l>n.byteLength))for(let S=0;S<e;S++){let y=(A*e+S)*4;if(s===1){let P=g+(S>>3),T=n.getUint8(P)>>7-(S&7)&1;T<i.length&&(c[y]=i[T][0],c[y+1]=i[T][1],c[y+2]=i[T][2]),c[y+3]=255;}else if(s===4){let P=g+(S>>1),T=(S&1)===0?n.getUint8(P)>>4&15:n.getUint8(P)&15;T<i.length&&(c[y]=i[T][0],c[y+1]=i[T][1],c[y+2]=i[T][2]),c[y+3]=255;}else if(s===8){let P=n.getUint8(g+S);P<i.length&&(c[y]=i[P][0],c[y+1]=i[P][1],c[y+2]=i[P][2]),c[y+3]=255;}else if(s===16){let P=n.getUint16(g+S*2,true);c[y]=Math.round(((P&m)>>>f)*255/x),c[y+1]=Math.round(((P&h)>>>p)*255/E),c[y+2]=Math.round(((P&b)>>>M)*255/d),c[y+3]=255;}else if(s===24){let P=g+S*3;c[y]=n.getUint8(P+2),c[y+1]=n.getUint8(P+1),c[y+2]=n.getUint8(P),c[y+3]=255;}else {let P=g+S*4,T=n.getUint8(P),C=n.getUint8(P+1),L=n.getUint8(P+2),_=n.getUint8(P+3);c[y]=L,c[y+1]=C,c[y+2]=T,c[y+3]=_===0&&!u?255:_;}}}}function Et(n,t,e,r,o,s=false){if(t<0||e<0||t+40>n.byteLength||e+r>n.byteLength)return null;let i=n.getUint32(t,true);if(i<40||t+i>n.byteLength)return null;let a=n.getInt32(t+4,true),c=n.getInt32(t+8,true),u=n.getUint16(t+12,true),l=n.getUint16(t+14,true),m=n.getUint32(t+16,true);if(u!==1||a<=0||c===0||a>8192||Math.abs(c)>8192)return null;let h=0,b=1,f=2,p=3;if(l!==1&&l!==4&&l!==8&&l!==16&&l!==24&&l!==32||m===b&&l!==8||m===f&&l!==4||m===p&&l!==16&&l!==32||m!==h&&m!==b&&m!==f&&m!==p)return null;let M=Math.abs(c),x=c<0,E=[];if(l<=8){let R=1<<l,g=n.getUint32(t+32,true)||R,S=Math.min(g,R),y=t+i,P=!!o&&o.length>0;if(y+S*(P?2:4)>n.byteLength)return null;for(let T=0;T<S;T++){if(P){let w=n.getUint16(y+T*2,true),I=o[w<o.length?w:0];E.push([I>>16&255,I>>8&255,I&255]);continue}let C=n.getUint8(y+T*4),L=n.getUint8(y+T*4+1),_=n.getUint8(y+T*4+2);E.push([_,L,C]);}}let d=An(n,t,i,m,l);if(!d)return null;let A=new Uint8ClampedArray(a*M*4);return m===b||m===f?yn(n,e,r,a,M,x,m===f,E,A,(g,S,y,P,T,C)=>{let L=(S*a+g)*4;A[L]=y,A[L+1]=P,A[L+2]=T,A[L+3]=C;}):(Pn(n,e,a,M,x,l,E,d,A,s),ct(A,a,M))}var Cn=[[0,0,0,255,0,0,0,0],[8,8,8,8,8,8,8,8],[128,64,32,16,8,4,2,1],[1,2,4,8,16,32,64,128],[8,8,8,255,8,8,8,8],[129,66,36,24,24,36,66,129]];function Ee(n,t,e){return ((Cn[n]??Cn[0])[e&7]>>7-(t&7)&1)===1}function gt(n){let t=/^#([0-9a-f]{6}|[0-9a-f]{3})$/i.exec(n.trim());if(!t)return 0;let e=t[1].length===3?t[1].replace(/./g,r=>r+r):t[1];return parseInt(e,16)}function ge(n,t,e){if(t+16>n.byteLength)return null;let r=n.getInt32(t+4,true),o=n.getInt32(t+8,true),s=n.getUint16(t+14,true),i=Math.abs(o);if(s!==1||r<=0||i===0||r>256||i>256)return null;let a=(r+31>>5)*4;if(e+a*i>n.byteLength)return null;let c=new Uint8Array(r*i);for(let u=0;u<i;u++){let l=o>0?i-1-u:u,m=e+u*a;for(let h=0;h<r;h++)c[l*r+h]=n.getUint8(m+(h>>3))>>7-(h&7)&1;}return {width:r,height:i,bits:c}}function Dr(n,t,e,r,o=null){if(e+24>n.byteLength)return null;let s=n.getUint32(e+8,true),i=n.getUint32(e+16,true),a=n.getUint32(e+20,true),c=t+s,u=t+i,l=c+16<=n.byteLength?n.getUint16(c+14,true):0;if(r||l===1){let f=ge(n,c,u);if(f&&r)return {kind:"mono",...f}}let m=Et(n,c,u,a,o);if(!m)return null;let h=new Uint32Array(m.width*m.height),b=m.data;for(let f=0;f<h.length;f++)h[f]=b[f*4]<<16|b[f*4+1]<<8|b[f*4+2];return {kind:"bitmap",width:m.width,height:m.height,rgb:h}}function Ln(n){if(n.brushStyle===1)return {kind:"none"};let t=n.brushPattern;if(!t)return {kind:"solid",rgb:gt(n.brushColor)};if(t.kind==="bitmap")return {kind:"tile",width:t.width,height:t.height,rgb:t.rgb};let e=gt(n.bkColor);if(t.kind==="hatch"){let s=gt(n.brushColor),i=new Uint32Array(64);for(let a=0;a<8;a++)for(let c=0;c<8;c++)i[a*8+c]=Ee(t.hatch,c,a)?s:e;return {kind:"tile",width:8,height:8,rgb:i}}let r=gt(n.textColor),o=new Uint32Array(t.width*t.height);for(let s=0;s<o.length;s++)o[s]=t.bits[s]?e:r;return {kind:"tile",width:t.width,height:t.height,rgb:o}}function kr(n,t,e,r,o){let s=((t-r)%n.width+n.width)%n.width,i=((e-o)%n.height+n.height)%n.height;return n.rgb[i*n.width+s]}function Gr(n){let t=[],e=0;for(let r=0;r<n.length;r++)t.push(e),e+=n[r];return t}function Xr(n){let t=0;for(let e of n)t+=e;return t}function $r(n,t,e,r){let o=n.slice();if(e===0||r<=0)return o;let s=0;for(let i=0;i<o.length&&i<t.length;i++){if(t[i]!==32)continue;let a=Math.round(s*e/r);s++;let c=Math.round(s*e/r);o[i]+=c-a;}return o}function Wr(n,t){return t==="center"?-n/2:t==="right"?-n:0}var Te=Math.PI/180;function Yr(n){let e=(n%3600+3600)%3600*Xt/3600,r=Math.floor(e),o=e-r,s=r*2*Math.PI/Xt,i=(r+1)*2*Math.PI/Xt;return o===0?{sin:Math.sin(s),cos:Math.cos(s)}:{sin:(1-o)*Math.sin(s)+o*Math.sin(i),cos:(1-o)*Math.cos(s)+o*Math.cos(i)}}var Xt=128;function Hr(n){return -(n/10)*Te}var Re=1.15;function _n(n){return n===0?0:n<0?-n:n/Re}var ut=(...n)=>{},q=(...n)=>{};var In=true;async function On(n){try{if(n[0]===255&&n[1]===216){let{decodeJpegPixels:t}=await import('./jpeg-decoder-VQUHLPAJ.js'),e=await t(n);return chunkSXBOBAYR_js.a(e.width,e.height)?{...e,data:new Uint8ClampedArray(e.data)}:null}if(n.length>=20&&n[0]===82&&n[1]===73&&n[2]===70&&n[3]===70&&n[8]===87&&n[9]===69&&n[10]===66&&n[11]===80){let{decodeWebp:t}=await import('./webp-decoder-MDSDJDEH.js');return t(n)}if(n.length>=13&&/^GIF8[79]a$/.test(String.fromCharCode(...n.subarray(0,6)))){let{decodeGif:t}=await import('./gif-decoder-UOU3U2ZO.js');return t(n)}if(n.length>=8&&(n[0]===73&&n[1]===73&&n[2]===42&&n[3]===0||n[0]===77&&n[1]===77&&n[2]===0&&n[3]===42)){let{decodeTiff:t}=await import('./tiff-decoder-PUQ7YZGC.js');return await t(n)}}catch{return null}return null}async function vn(){return import('@napi-rs/canvas')}var Yt=class{constructor(){this.data=new Int32Array(96);this.length=0;}add(t,e,r){if(r<=e)return;let o=this.length*3;if(o>0&&this.data[o-3]===t&&this.data[o-1]===e){this.data[o-1]=r;return}if(o+3>this.data.length){let s=new Int32Array(this.data.length*2);s.set(this.data),this.data=s;}this.data[o]=t,this.data[o+1]=e,this.data[o+2]=r,this.length++;}append(t){for(let e=0;e<t.length*3;e+=3)this.add(t.data[e],t.data[e+1],t.data[e+2]);}bounds(){if(this.length===0)return null;let t=1/0,e=1/0,r=-1/0,o=-1/0,s=this.data;for(let i=0;i<this.length*3;i+=3)s[i]<e&&(e=s[i]),s[i]+1>o&&(o=s[i]+1),s[i+1]<t&&(t=s[i+1]),s[i+2]>r&&(r=s[i+2]);return {x0:t,y0:e,x1:r,y1:o}}};function wn(n,t){return Math.floor(n/t)}function lt(n,t){return -Math.floor(-n/t)}function Se(n,t,e=new Yt,r=-1/0,o=1/0){let s=[],i=1/0,a=-1/0;for(let f of n){let p=f.length>>1;if(!(p<2))for(let M=0;M<p;M++){let x=M+1===p?0:M+1,E=f[M*2],d=f[M*2+1],A=f[x*2],R=f[x*2+1];if(d===R)continue;let g=R>d?1:-1,S=g>0?E:A,y=g>0?d:R,P=g>0?A:E,T=g>0?R:d,C=lt(y,16),L=lt(T,16);L<=C||(s.push([C,L,S,y,P-S,T-y,g]),C<i&&(i=C),L>a&&(a=L));}}if(s.length===0)return e;s.sort((f,p)=>f[0]-p[0]);let c=Math.max(i,Math.ceil(r)),u=Math.min(a,Math.floor(o)),l=[],m=0,h=[],b=[];for(;m<s.length&&s[m][1]<=c;)m++;for(let f=c;f<u;f++){for(;m<s.length&&s[m][0]<=f;)s[m][1]>f&&l.push(s[m]),m++;for(let x=l.length-1;x>=0;x--)(l[x][1]<=f||l[x][0]>f)&&l[x][1]<=f&&l.splice(x,1);h.length=0,b.length=0;let p=f*16;for(let x of l){if(x[0]>f)continue;let E=x[2]*x[5]+(p-x[3])*x[4];h.push(lt(E,x[5]*16)),b.push(x[6]);}let M=h.length;if(!(M<2)){for(let x=1;x<M;x++){let E=h[x],d=b[x],A=x-1;for(;A>=0&&h[A]>E;)h[A+1]=h[A],b[A+1]=b[A],A--;h[A+1]=E,b[A+1]=d;}if(t){let x=0,E=0;for(let d=0;d<M;d++){let A=x;x+=b[d],A===0&&x!==0?E=h[d]:A!==0&&x===0&&e.add(f,E,h[d]);}}else for(let x=0;x+1<M;x+=2)e.add(f,h[x],h[x+1]);}}return e}function ye(n,t){return Math.abs(n)!==Math.abs(t)?10:t>0?2:n>0?136:68}function Nn(n,t,e,r){let o=Math.abs(n)+Math.abs(t),s=8*e;if(o<s)return true;if(o>s)return false;let i;return n===0?i=t<0?1:2:t===0?i=n<0?4:8:n<0?i=t<0?16:64:i=t<0?32:128,(r&i)!==0}function Fn(n,t,e,r,o){let s=e-n,i=r-t;if(s===0&&i===0)return;let a=ye(s,i),c=Math.abs(s)>=Math.abs(i),u=c?n:t,l=c?t:n,m=c?e:r,h=c?r:e,b=m>u?1:-1,f=Math.abs(m-u),p=(h-l)*b,M=Math.abs(s)===Math.abs(i),x=Math.min(u,m),E=Math.max(u,m),d=(g,S,y)=>c?Nn(g,S,y,a):Nn(S,g,y,a),A=b>0?wn(x,16)-1:lt(E,16)+1,R=b>0?lt(E,16)+1:wn(x,16)-1;for(let g=A;b>0?g<=R:g>=R;g+=b){let S=g*16,y=l*f+(S-u)*p,P=y/f/16,T=Math.round(P);for(let C=T-1;C<=T+1;C++){let L=C*16,_=y-L*f,w=x-S,I=E-S,D;if(M){let N=p/f,X=_/f,B=Math.max(w,Math.min(0,I)),k=Math.max(w,Math.min(-X/N,I));D=d(2*B,2*(X+N*B),2)||d(2*k,2*(X+N*k),2)||d(B+k,2*X+N*(B+k),2);}else {let N=Math.max(w,Math.min(0,I));D=d(N*f,_+N*p,f);}D&&(d(m-S,h-L,1)||(c?o(g,C):o(C,g)));}}}var Un=10,$t=3,Bn=6*10912,Ae=Bn*8;function $(n,t){return Math.floor(n/2**t)}var yt=class{constructor(t,e,r,o){let s=2**Un;this.e0=t*s,this.e1=(o-t)*s,this.e2=6*(e-r-r+o)*s,this.e3=6*(t-e-e+r)*s;}lazyHalve(t){this.e2=$(this.e2+this.e3,1),this.e1=$(this.e1-$(this.e2,t),1);}steadyState(t){let e=2**$t;this.e0*=e,this.e1*=e;let r=t-$t;r<0?(this.e2*=2**-r,this.e3*=2**-r):(this.e2=$(this.e2,r),this.e3=$(this.e3,r));}halve(){this.e2=$(this.e2+this.e3,3),this.e1=$(this.e1-this.e2,1),this.e3=$(this.e3,2);}double(){this.e1+=this.e1+this.e2,this.e3*=4,this.e2=this.e2*8-this.e3;}step(){this.e0+=this.e1;let t=this.e2;this.e1+=t,this.e2+=t-this.e3,this.e3=t;}error(){return Math.max(Math.abs(this.e2),Math.abs(this.e3))}parentErrorDividedBy4(){return Math.max(Math.abs(this.e3),Math.abs(this.e2+this.e2-this.e3))}value(){let t=Un+$t;return $(this.e0+2**(t-1),t)}};function Gn(n,t,e,r,o,s,i,a,c,u=1){let l=Bn*u,m=Ae*u,h=new yt(n,e,o,i),b=new yt(t,r,s,a),f=1,p=0;for(;p<40&&(h.error()>l*2**p||b.error()>l*2**p);)p+=2,h.lazyHalve(p),b.lazyHalve(p),f*=2;h.steadyState(p),b.steadyState(p);for(let M=0;f>0&&M<1<<20;M++){for(Math.max(h.error(),b.error())>m&&(h.halve(),b.halve(),f*=2);f%2===0&&h.parentErrorDividedBy4()<=m/4&&b.parentErrorDividedBy4()<=m/4;)h.double(),b.double(),f/=2;f--,h.step(),b.step(),c.push(h.value(),b.value());}}var W=.5522847498307936;function At(n,t,e,r){return {ax:n,ay:t,exx:e-n,exy:0,eyx:0,eyy:r-t}}function Ht(n,t=false){if(!t)return $n(n,false);let{halfX:e,...r}=n,o=Xn(r),s=[];for(let a=o.length-2;a>=0;a-=2)s.push(o[a],o[a+1]);let i=Math.abs(r.exx)%2;if(s[18]+=i,s[6]-=i,e)for(let a of [0,1,2,3,4,5,12])s[2*a]++;return s}function Xn(n){return $n(n,true)}function $n(n,t){let e=(T,C)=>C?Math.ceil(T/2):Math.floor(T/2),r=T=>e(T,false),o=T=>e(T,true),s=T=>Math.floor(T/2)+Math.ceil(W*Math.ceil(T/2)),i=T=>Math.ceil(T/2)-Math.ceil(W*Math.ceil(T/2)),a=T=>e(T,false),c=T=>e(T,true),u=T=>Math.floor(T/2)-Math.floor(W*Math.floor(T/2)),l=T=>T-u(T),m=T=>T%2===0?Math.ceil(W*Math.floor(T/2)):Math.floor(W*Math.ceil(T/2)),h=t?T=>a(T)-m(T):u,b=t?T=>a(T)-m(T):u,f=t?T=>c(T)+m(T):l,p=t?T=>c(T)+m(T):l,M=()=>0,x=T=>T,{ax:E,ay:d,exx:A,exy:R,eyx:g,eyy:S}=n,y=[],P=(T,C)=>{y.push(E+T(A)+C(g),d+T(R)+C(S));};if(P(x,c),P(x,h),P(s,M),P(r,M),P(i,M),P(M,b),P(M,a),P(M,f),P(i,x),P(o,x),P(s,x),P(x,p),P(x,c),n.halfX)for(let T of [0,1,2,3,4,5,12])y[2*T]++;return y}function Pe(n,t,e,r){return Ht(At(n,t,e,r))}function Zr(n){let t=[n[0],n[1]];for(let e=2;e+5<n.length;e+=6)Gn(n[e-2],n[e-1],n[e],n[e+1],n[e+2],n[e+3],n[e+4],n[e+5],t);return t}function Qr(n,t,e,r,o,s,i=false,a=false,c=false,u){let l=e-n,m=r-t;if(u){let g=(y,P)=>Math.floor(Math.fround(y*P)+.5),S=c?Math.floor(l/2):Math.ceil(l/2);o=2*Math.min(g(S,u[0]),S),s=2*Math.min(g(a?Math.ceil(m/2):Math.floor(m/2),u[1]),a?Math.ceil(m/2):Math.floor(m/2));}let h=Math.min(Math.abs(o),l),b=Math.min(Math.abs(s),m);(h===0||b===0)&&(h=0,b=0);let f=i||a?Math.round(b/2):Math.floor(m/2)-Math.floor((m-b)/2),p=i?Math.round(e-h/2):Math.floor(e-h/2),M=e-p,x=a?Math.ceil(W*f):Math.floor(W*f),E=c?Math.floor(W*M):Math.ceil(W*M),d=[e,t+f,e,t+f-x,e-M+E,t,p,t],A=g=>n+e-g,R=g=>t+r-g;return [d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],A(d[6]),d[7],A(d[4]),d[5],A(d[2]),d[3],A(d[0]),d[1],A(d[0]),R(d[1]),A(d[2]),R(d[3]),A(d[4]),R(d[5]),A(d[6]),R(d[7]),d[6],R(d[7]),d[4],R(d[5]),d[2],R(d[3]),d[0],R(d[1])]}var zt=2*Math.PI/128,Tt=n=>J(n)[0],Rt=n=>J(n)[1];function Ce(n,t){let e=[],r=(a,c)=>{if(Math.abs(c-a)<90){e.push({from:a,to:c,first:true});return}let u=Math.min(a,c),l=Math.max(a,c),m=Math.floor(l/90)-Math.floor(u/90)+1,h=[];for(let f=Math.floor(u/90)+1;f*90<l;f++)h.push(f*90);c<a&&h.reverse();let b=[a,...h,c];for(;b.length-1<m;)b.push(c);for(let f=0;f+1<b.length;f++)e.push({from:b[f],to:b[f+1],first:f===0});},o=t<0?-1:1,s=Math.min(8,Math.trunc(Math.abs(t)/360)),i=n+t-o*s*360;r(n,i);for(let a=1;a<=s;a++)r(i+o*360*(a-1),n+o*360*a),r(n+o*360*a,i+o*360*a);return e}function to(n,t,e,r,o,s){let i=o*Math.PI/180,a=s*Math.PI/180,c=4/3*Math.tan((a-i)/4),u=n+e*Tt(i),l=t-r*Rt(i),m=n+e*Tt(a),h=t-r*Rt(a);return [u-c*e*Rt(i),l-c*r*Tt(i),m+c*e*Rt(a),h+c*r*Tt(a),m,h]}function no(n,t,e){let r=Math.min(n.ax,n.ax+n.exx),o=Math.min(n.ay,n.ay+n.eyy),s=Math.abs(n.exx),i=Math.abs(n.eyy),a=r+s/2,c=o+i/2,u=Pe(r,o,r+s,o+i),l=Xn(At(r,o,r+s,o+i)),m=t*Math.PI/180,h=Math.abs(e)<=3?[Math.cos(m),Math.sin(m)]:J(m),b=[Math.round(a+s/2*h[0]),Math.round(c-i/2*h[1])];for(let f of Ce(t,e)){let p=f.to-f.from;if(!f.first&&Math.abs(p)===90&&f.from%90===0){let E=(Math.min(f.from,f.to)/90%4+4)%4*6;p>0?b.push(u[E+2],u[E+3],u[E+4],u[E+5],u[E+6],u[E+7]):b.push(l[E+4],l[E+5],l[E+2],l[E+3],l[E],l[E+1]);continue}let M=Wn(f.from*Math.PI/180,f.to*Math.PI/180,Math.abs(e)<=3);for(let x=0;x<6;x+=2)b.push(Math.round(a+s/2*M.ctrl[x]),Math.round(c-i/2*M.ctrl[x+1]));}return b}var Le=3*Math.PI/180,St=(()=>{let n=[],t=[];for(let e=0;e<=129;e++)n.push(Math.fround(Math.cos(e*zt))),t.push(Math.fround(Math.sin(e*zt)));for(let e=0;e<=128;e+=32)n[e]=[1,0,-1,0,1][e/32],t[e]=[0,1,0,-1,0][e/32];return {cos:n,sin:t}})();function J(n){let t=n%(2*Math.PI);t<0&&(t+=2*Math.PI);let e=Math.fround(t/zt),r=Math.min(127,Math.floor(e)),o=e-r;return [St.cos[r]*(1-o)+St.cos[r+1]*o,St.sin[r]*(1-o)+St.sin[r+1]*o]}var Wt=Array.from({length:33},(n,t)=>Math.atan(t/32));function Dn(n){let t=n*32,e=Math.min(31,Math.floor(t));return Wt[e]+(Wt[e+1]-Wt[e])*(t-e)}function _e(n,t){let e=Math.abs(n),r=Math.abs(t);if(e===0&&r===0)return 0;let o=r<=e?Dn(Math.fround(r/e)):Math.PI/2-Dn(Math.fround(e/r));return n>=0?t>=0?o:2*Math.PI-o:t>=0?Math.PI-o:Math.PI+o}function Wn(n,t,e,r=1/0){let o=e?u=>[Math.cos(u),Math.sin(u)]:J,s=o(n),i=o(t);if(e&&6e-8*r/Math.abs(Math.sin(t-n))>.5){let u=Math.fround,l=[u(s[0]),u(s[1])],m=[u(i[0]),u(i[1])],h=u(u(l[0]*m[1])-u(l[1]*m[0]));if(h!==0){let b=[u(u(m[1]-l[1])/h),u(u(l[0]-m[0])/h)],f=u(J(Math.abs(t-n)/2)[0]),p=u(u(u(4/3)*f)/u(1+f));return {start:s,ctrl:[u(l[0]+u(p*u(b[0]-l[0]))),u(l[1]+u(p*u(b[1]-l[1]))),u(m[0]+u(p*u(b[0]-m[0]))),u(m[1]+u(p*u(b[1]-m[1]))),i[0],i[1]]}}}let a=s[0]*i[1]-s[1]*i[0],c;if(Math.abs(a)<1e-12)c=[s[0],s[1],i[0],i[1],i[0],i[1]];else {let u=[(i[1]-s[1])/a,(s[0]-i[0])/a],l=J(Math.abs(t-n)/2)[0],m=4/3*l/(1+l);c=[s[0]+m*(u[0]-s[0]),s[1]+m*(u[1]-s[1]),i[0]+m*(u[0]-i[0]),i[1]+m*(u[1]-i[1]),i[0],i[1]];}return {start:s,ctrl:c}}function eo(n,t,e,r,o,s,i,a,c,u=false,l=false,m=false){let h=e-n,b=r-t,f=Math.PI/2,p=Math.ceil(h/2),M=c?Math.ceil(b/2):Math.floor(b/2),x=n+Math.ceil(h/2),E=t+Math.ceil(b/2),d=(n+e)/2,A=(t+r)/2,R=(O,v)=>_e((O-d)/(h/2||1),-(v-A)/(b/2||1)),g=R(o,s),S=R(i,a),y=O=>c?(2*Math.PI-O)%(2*Math.PI):O,P=S!==g&&Math.abs(y(S)-y(g))<=Le,T=c?-1:1;if(T>0)for(;S<=g;)S+=2*Math.PI;else for(;S>=g;)S-=2*Math.PI;let C=(O,v)=>Math.fround(O*Math.fround(v)),L=(O,v)=>m?Math.round(x-C(Math.floor(h/2),O)):c&&u?Math.ceil(x+C(p,O)+.5-v):Math.round(x+C(p,O)+(u?1+v:0)),_=O=>Math.round(E-C(M,O)),w=m?At(e,t,n,r):At(n,t,e,r);u&&(w.halfX=true);let I=Ht(w);if(c){let O=Ht(w,true);for(let v=0;v<O.length;v+=2)I[O.length-2-v]=O[v],I[O.length-1-v]=O[v+1];}let D=P?[Math.cos(g),Math.sin(g)]:J(g),N=[L(D[0],D[1]),_(D[1])],X=O=>Math.abs(O/f-Math.round(O/f))<1e-9,B=O=>(Math.round(O/f)%4+4)%4;l&&X(g)&&(T>0?B(g)===1||B(g)===2:B(g)===2||B(g)===3)&&N.push(N[0],N[1],N[0],N[1],N[0],N[1]);let k=g;for(let O=0;O<8&&(T>0?k<S-1e-12:k>S+1e-12);O++){let v=T>0?Math.floor(k/f+1e-9)*f+f:Math.ceil(k/f-1e-9)*f-f,tt=Math.abs(k/f-Math.round(k/f))<1e-9,re=T>0?v>=S-1e-12:v<=S+1e-12,mt=(Math.round(k/f)%4+4)%4,ht=(Math.round(v/f)%4+4)%4;if(!(O===0&&(T>0?mt===0||mt===3:mt===0||mt===1)||re&&(T>0?ht===1||ht===2:ht===2||ht===3))&&tt&&(T>0?v<=S+1e-12:v>=S-1e-12)){let F=(Math.round(Math.min(k,v)/f)%4+4)%4*6;T>0?N.push(I[F+2],I[F+3],I[F+4],I[F+5],I[F+6],I[F+7]):N.push(I[F+4],I[F+5],I[F+2],I[F+3],I[F],I[F+1]),k=v;continue}let Vt=T>0?Math.min(v,S):Math.max(v,S),Lt=Wn(k,Vt,P,Math.max(p,M));for(let F=0;F<6;F+=2)N.push(L(Lt.ctrl[F],Lt.ctrl[F+1]),_(Lt.ctrl[F+1]));k=Vt;}if(l&&X(S)&&(T>0?B(S)===3||B(S)===0:B(S)===1||B(S)===0)){let O=J(S),v=L(O[0],O[1]),tt=_(O[1]);N.push(v,tt,v,tt,v,tt);}return N}var kn=class{constructor(){this.figures=[];this.getPath={pts:[],types:[]};this.current=null;}moveTo(t,e){this.current={pts:[t,e],closed:false},this.figures.push(this.current),this.log(t,e,6);}continueAt(t,e){let r=this.current;r&&r.pts[r.pts.length-2]===t&&r.pts[r.pts.length-1]===e||this.moveTo(t,e);}hasOpenFigure(){return this.current!==null}log(t,e,r){this.getPath.pts.push(t,e),this.getPath.types.push(r);}lineTo(t,e){if(!this.current){let r=this.lastPoint();this.moveTo(r?r[0]:t,r?r[1]:e);}this.current.pts.push(t,e),this.log(t,e,2);}bezierTo(t,e,r,o,s,i){if(!this.current){let c=this.lastPoint();this.moveTo(c?c[0]:t,c?c[1]:e);}let a=this.current.pts;this.flattenInto(a[a.length-2],a[a.length-1],t,e,r,o,s,i),this.log(t,e,4),this.log(r,o,4),this.log(s,i,4);}flattenInto(t,e,r,o,s,i,a,c){let u=this.current,l=u.pts.length/2-1;Gn(t,e,r,o,s,i,a,c,u.pts);let m=u.pts.length/2-2;if(m<=l){if(m===l){let p=u.pts.length;u.tangents??(u.tangents=new Map),u.tangentRoles??(u.tangentRoles=new Map),u.tangents.set(l,[u.pts[p-2]-u.pts[p-4],u.pts[p-1]-u.pts[p-3]]),u.tangentRoles.set(l,3);}return}let h=(p,M,x,E,d,A,R,g)=>x!==p||E!==M?[x-p,E-M]:d!==p||A!==M?[d-p,A-M]:R!==p||g!==M?[R-p,g-M]:null,b=h(t,e,r,o,s,i,a,c),f=h(s,i,a,c,a,c,a,c)??h(r,o,a,c,a,c,a,c)??h(t,e,a,c,a,c,a,c);u.curveSegs??(u.curveSegs=new Set);for(let p=l;p<=m;p++)u.curveSegs.add(p);u.tangents??(u.tangents=new Map),u.tangentRoles??(u.tangentRoles=new Map),b&&(u.tangents.set(l,b),u.tangentRoles.set(l,1)),f&&(u.tangents.set(m,f),u.tangentRoles.set(m,2));}addBeziers(t,e){e?this.moveTo(t[0],t[1]):this.lineTo(t[0],t[1]);for(let r=2;r+5<t.length;r+=6){this.flattenInto(t[r-2],t[r-1],t[r],t[r+1],t[r+2],t[r+3],t[r+4],t[r+5]);for(let o=r;o<r+6;o+=2)this.log(t[o],t[o+1],4);}}closeFigure(){if(this.current){this.current.closed=true,this.current=null;let t=this.getPath.types;t[t.length-1]|=1;}}append(t){for(let e of t.figures)this.figures.push({pts:e.pts.slice(),closed:e.closed,tangents:e.tangents&&new Map(e.tangents),tangentRoles:e.tangentRoles&&new Map(e.tangentRoles),curveSegs:e.curveSegs&&new Set(e.curveSegs),roundWiden:e.roundWiden});for(let e=0;e<t.getPath.types.length;e++)this.log(t.getPath.pts[2*e],t.getPath.pts[2*e+1],t.getPath.types[e]);this.current=null;}lastPoint(){let t=this.figures[this.figures.length-1];return t?t.closed?[t.pts[0],t.pts[1]]:[t.pts[t.pts.length-2],t.pts[t.pts.length-1]]:null}};function ro(n,t,e){return Se(n.figures.map(r=>r.pts),t,e)}function Yn(n,t){switch(n&15){case 1:return [18,6];case 2:return [3,3];case 3:return [9,6,3,6];case 4:return [9,3,3,3,3,3];case 7:return t&&t.length>0&&t.some(e=>e>0)?t.map(e=>Math.max(0,e)*3):null;case 8:return [1,1];default:return null}}function oo(n,t,e,r=1){let o=Math.max(t,1);switch(n&15){case 1:return [3*o,o];case 2:return [o,o];case 3:return [3*o,o,o,o];case 4:return [3*o,o,o,o,o,o];case 7:return e&&e.some(s=>s>0)?e.map(s=>Math.max(0,s)*r):null;default:return null}}function so(n){let t=n&15;return t>=1&&t<=4}function io(n,t,e,r,o={pos:0},s=true){let i=0;if(r)for(let c of r)i+=c;let a=(c,u)=>{if(!r||i===0){t.add(u,c,c+1);return}let l=o.pos%i;o.pos++;for(let m=0;m<r.length;m++){if(l<r[m]){m%2===0?t.add(u,c,c+1):e&&e.add(u,c,c+1);return}l-=r[m];}};n.figures.forEach((c,u)=>{u>0&&s&&(o.pos=0);let l=c.pts;for(let m=0;m+3<l.length;m+=2)Fn(l[m],l[m+1],l[m+2],l[m+3],a);if(c.closed&&l.length>=4){let m=l.length;(l[m-2]!==l[0]||l[m-1]!==l[1])&&Fn(l[m-2],l[m-1],l[0],l[1],a);}});}var U;async function To(){if(U!==void 0)return U;if(typeof OffscreenCanvas<"u"||typeof document<"u"||typeof process>"u"||!process.versions?.node)return U=null,U;try{U=await vn();}catch{U=null;}return U}var zn=false;function Jn(){return typeof OffscreenCanvas>"u"&&typeof document>"u"&&!U}var Vn=1;function He(n,t,e,r,o=Vn,s=8192){let i=Math.max(1,Math.min(o,4)),a=Math.round(n*i),c=Math.round(t*i),u=i,l=i;if(e&&a>e){let f=e/a;a=e,c=Math.round(c*f),u*=f,l*=f;}if(r&&c>r){let f=r/c;a=Math.round(a*f),c=r,u*=f,l*=f;}let m=Math.max(1,Math.floor(s)),h=Math.max(1,Math.min(a,m)),b=Math.max(1,Math.min(c,m));return (h!==a||b!==c)&&console.warn(`[emf-converter] Canvas size clamped from ${a}\xD7${c} to ${h}\xD7${b}. Output may lose detail.`),{w:h,h:b,scaleX:u,scaleY:l}}var Ct={willReadFrequently:true};function Ro(n,t,e,r,o=Vn,s=8192){let{w:i,h:a,scaleX:c,scaleY:u}=He(n,t,e,r,o,s);try{if(Jn()){ut(`createCanvas: using the software rasteriser ${i}\xD7${a}`);let l=new z(i,a);return {canvas:l,ctx:l.ctx,scaleX:c,scaleY:u}}if(typeof OffscreenCanvas<"u"){ut(`createCanvas: using OffscreenCanvas ${i}\xD7${a}, scale=(${c.toFixed(3)},${u.toFixed(3)})`);let l=new OffscreenCanvas(i,a),m=l.getContext("2d",Ct);return m?{canvas:l,ctx:m,scaleX:c,scaleY:u}:(q('createCanvas: OffscreenCanvas.getContext("2d") returned null'),null)}if(typeof document<"u"){ut(`createCanvas: using HTMLCanvasElement ${i}\xD7${a}, scale=(${c.toFixed(3)},${u.toFixed(3)})`);let l=document.createElement("canvas");l.width=i,l.height=a;let m=l.getContext("2d",Ct);return m?{canvas:l,ctx:m,scaleX:c,scaleY:u}:(q('createCanvas: HTMLCanvasElement.getContext("2d") returned null'),null)}if(U){ut(`createCanvas: using @napi-rs/canvas ${i}\xD7${a}, scale=(${c.toFixed(3)},${u.toFixed(3)})`);let l=U.createCanvas(i,a),m=l.getContext("2d");return m?{canvas:l,ctx:m,scaleX:c,scaleY:u}:(q('createCanvas: @napi-rs/canvas getContext("2d") returned null'),null)}return q("createCanvas: no OffscreenCanvas, no document, and no @napi-rs/canvas, cannot create canvas"),null}catch(l){return null}}function ze(n,t){if(n<=0||t<=0)return null;if(n=Math.max(1,Math.min(Math.floor(n),8192)),t=Math.max(1,Math.min(Math.floor(t),8192)),zn);if(typeof OffscreenCanvas<"u"){let r=new OffscreenCanvas(n,t),o=r.getContext("2d",Ct);return o?{canvas:r,ctx:o}:null}if(typeof document<"u"){let r=document.createElement("canvas");r.width=n,r.height=t;let o=r.getContext("2d",Ct);return o?{canvas:r,ctx:o}:null}if(U){let r=U.createCanvas(n,t),o=r.getContext("2d");return o?{canvas:r,ctx:o}:null}let e=new z(n,t);return {canvas:e,ctx:e.ctx}}function jn(n){switch(n){case 1:return {gco:"source-over",colorTransform:"black",exact:true};case 16:return {gco:"source-over",colorTransform:"white",exact:true};case 11:return {gco:"source-over",colorTransform:"skip",exact:true};case 4:return {gco:"source-over",colorTransform:"invert",exact:true};case 6:return {gco:"difference",colorTransform:"white",exact:true};case 7:case 5:return {gco:"difference",colorTransform:"none",exact:false};case 10:return {gco:"difference",colorTransform:"invert",exact:false};case 9:return {gco:"darken",colorTransform:"none",exact:false};case 3:case 2:return {gco:"darken",colorTransform:"invert",exact:false};case 15:case 14:return {gco:"lighten",colorTransform:"none",exact:false};case 12:case 8:return {gco:"lighten",colorTransform:"invert",exact:false};default:return {gco:"source-over",colorTransform:"none",exact:true}}}function qn(n,t){switch(t){case "invert":return en(n);case "black":return "#000000";case "white":return "#ffffff";case "skip":return "rgba(0,0,0,0)";default:return n}}function So(n,t){let e=jn(t.rop2);if(n.globalCompositeOperation=e.gco,t.penStyle===5){n.strokeStyle="rgba(0,0,0,0)",n.lineWidth=0;return}n.strokeStyle=qn(t.penColor,e.colorTransform),n.lineWidth=Math.max(t.penWidth,1),n.setLineDash(t.penWidth<=1?Yn(t.penStyle,t.penUserStyle)??[]:[]);}function yo(n,t){let e=jn(t.rop2);if(n.globalCompositeOperation=e.gco,Ln(t).kind==="none"){n.fillStyle="rgba(0,0,0,0)";return}n.fillStyle=qn(t.brushColor,e.colorTransform);}function Je(n){if(!n||n===400)return "";let t=Math.round(n/100)*100;return t===700?"bold":t>=100&&t<=900?String(t):n>=700?"bold":""}function Ve(n,t){let e=t?.[n.toLowerCase().trim()]??n;return /[\s,]/.test(e)&&!/^["']/.test(e)?`"${e}"`:e}function Kn(n,t=1){return Math.max(_n(n.fontHeight)*Math.abs(t||1),8)}function Ao(n,t,e=1){let r=t.fontItalic?"italic ":"",o=Je(t.fontWeight),s=o?`${o} `:"",i=Kn(t,e),a=Ve(t.fontFamily,t.fontFamilyMap),c=`${r}${s}${i}px ${a}`;n.font!==c&&(n.font=c);}function Po(n,t,e,r,o,s=1){if(!t.fontUnderline&&!t.fontStrikeOut)return;let i=Kn(t,s),a=Math.max(1,Math.round(i/14)),c=n.fillStyle;n.fillStyle=t.textColor,t.fontUnderline&&n.fillRect(e,r+Math.round(i*.12),o,a),t.fontStrikeOut&&n.fillRect(e,r-Math.round(i*.3),o,a),n.fillStyle=c;}function Co(n,t,e){if(e<=0)return "";let r=n.byteLength-t;if(r<=0)return "";let o=Math.min(e,Math.floor(r/2));if(o<=0)return "";let s;try{let a=new Uint8Array(n.buffer,n.byteOffset+t,o*2);s=new TextDecoder("utf-16le").decode(a);}catch{let a=[];for(let c=0;c<o;c++){let u=n.getUint16(t+c*2,true);if(u===0)return a.join("");a.push(String.fromCharCode(u));}return a.join("")}let i=s.indexOf("\0");return i===-1?s:s.slice(0,i)}function Lo(n){switch(n){case 0:return {kind:"brush",style:0,color:"#ffffff"};case 1:return {kind:"brush",style:0,color:"#c0c0c0"};case 2:return {kind:"brush",style:0,color:"#808080"};case 3:return {kind:"brush",style:0,color:"#404040"};case 4:return {kind:"brush",style:0,color:"#000000"};case 5:return {kind:"brush",style:1,color:"#000000"};case 6:return {kind:"pen",style:0,widthX:1,color:"#ffffff"};case 7:return {kind:"pen",style:0,widthX:1,color:"#000000"};case 8:return {kind:"pen",style:5,widthX:0,color:"#000000"};case 10:case 11:return {kind:"font",height:12,weight:400,italic:false,underline:false,strikeOut:false,family:"monospace"};case 12:case 13:case 14:case 17:return {kind:"font",height:12,weight:400,italic:false,underline:false,strikeOut:false,family:"sans-serif"};default:return null}}async function _o(n,t){let e=chunkGD73XQBZ_js.a(new Uint8Array(n));if(e==="unsupported")return null;if(Jn()){let s=await Hn(new Uint8Array(n));return s?{drawable:s,width:s.width,height:s.height,close:()=>{}}:null}if(!(e==="bundled"&&In)){if(U)try{let s=await U.loadImage(new Uint8Array(n));return {drawable:s,width:s.width,height:s.height,close:()=>{}}}catch{}else if(typeof createImageBitmap=="function")try{let s=t!==void 0?new Blob([n],{type:t}):new Blob([n]),i=await createImageBitmap(s);return {drawable:i,width:i.width,height:i.height,close:()=>i.close()}}catch{}}let r=await Hn(new Uint8Array(n)),o=r&&ze(r.width,r.height);return !r||!o?null:(je(o.ctx,ct(r.data,r.width,r.height),0,0),{drawable:o.canvas,width:r.width,height:r.height,close:()=>{}})}async function Hn(n){if(chunkEBIZSO4S_js.a(n))return chunkEBIZSO4S_js.c(n);if(n.length>=26&&n[0]===66&&n[1]===77){let t=new DataView(n.buffer,n.byteOffset,n.byteLength),e=t.getUint32(10,true),r=Et(t,14,e,t.byteLength-e);return r?{data:r.data,width:r.width,height:r.height}:null}return On(n)}function Io(n,t,e,r,o,s){n.drawImage.call(n,t,e,r,o,s);}function Oo(n,t,e,r,o){return n.getImageData.call(n,t,e,r,o)}function je(n,t,e,r){n.putImageData.call(n,t,e,r);}function vo(n,t,e){return n.createPattern.call(n,t,e)}function ct(n,t,e){if(typeof ImageData<"u")return new ImageData(n,t,e);if(U){let r=U.ImageData;return new r(n,t,e)}return {data:n,width:t,height:e,colorSpace:"srgb"}}var qe=Symbol("SvgContext");function Ke(n){return typeof n=="object"&&n!==null&&qe in n}function No(n){return !Ke(n)||n.canReadPixels}function Zn(n){return n.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F￾￿]/g,"").replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"\uFFFD").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Qn(n,t){t.push("<",n.tag);for(let e of Object.keys(n.attrs))t.push(" ",e,'="',Zn(String(n.attrs[e])),'"');if(n.text!==void 0){t.push(">",Zn(n.text),"</",n.tag,">");return}if(!n.children||n.children.length===0){t.push("/>");return}t.push(">");for(let e of n.children)Qn(e,t);t.push("</",n.tag,">");}function Ze(n){let t=[];return Qn(n,t),t.join("")}var K="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function Qe(n){let t=[];for(let r=0;r<n.length;r+=12288){let o=Math.min(n.length,r+12288),s="",i=r;for(;i+2<o;i+=3){let a=n[i]<<16|n[i+1]<<8|n[i+2];s+=K[a>>18]+K[a>>12&63]+K[a>>6&63]+K[a&63];}if(i<o){let a=n[i]<<16|(i+1<o?n[i+1]:0)<<8;s+=K[a>>18]+K[a>>12&63]+(i+1<o?K[a>>6&63]:"=")+"=";}t.push(s);}return t.join("")}function tr(n){if(typeof TextEncoder<"u")return new TextEncoder().encode(n);let t=[];for(let e of n){let r=e.codePointAt(0);r<128?t.push(r):r<2048?t.push(192|r>>6,128|r&63):r<65536?t.push(224|r>>12,128|r>>6&63,128|r&63):t.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|r&63);}return Uint8Array.from(t)}function nr(n){return `data:image/svg+xml;base64,${Qe(tr(n))}`}function Uo(n){return nr(Ze(n))}var er={class:"className","xml:space":"xmlSpace","xlink:href":"xlinkHref","xmlns:xlink":"xmlnsXlink"};function te(n){let t=er[n];return t||(n.startsWith("data-")||n.startsWith("aria-")?n:n.replace(/[-:]([a-z])/g,(e,r)=>r.toUpperCase()))}function ne(n){let t={};for(let e of n.split(";")){let r=e.indexOf(":");if(r<=0)continue;let o=e.slice(0,r).trim(),s=e.slice(r+1).trim();if(!o)continue;let i=o.startsWith("--")?o:o.replace(/-([a-z])/g,(a,c)=>c.toUpperCase());t[i]=s;}return t}function rr(n){let t={};for(let e of Object.keys(n)){let r=n[e];e==="style"?t.style=ne(String(r)):t[te(e)]=r;}return t}function Do(n,t,e){let r=0,o=(a,c)=>{let u={key:r++,...rr(a.attrs),...c};if(a.text!==void 0)return t(a.tag,u,a.text);let l=(a.children??[]).map(m=>o(m));return t(a.tag,u,...l)},{key:s,...i}=e??{};return o(n,i)}function Jt(n){return JSON.stringify(n)}function or(n,t){if(n==="style"){let e=ne(String(t));return `{{ ${Object.keys(e).map(o=>`${/^[a-zA-Z_$][\w$]*$/.test(o)?o:Jt(o)}: ${Jt(e[o])}`).join(", ")} }}`}return typeof t=="number"?Number.isFinite(t)?`{${t}}`:"{0}":/^[^"\\{}<>&\r\n]*$/.test(t)?`"${t}"`:`{${Jt(t)}}`}function sr(n){return `{${JSON.stringify(n)}}`}function ee(n,t,e,r){let o=" ".repeat(t),s=Object.keys(n.attrs).map(a=>`${te(a)}=${or(a,n.attrs[a])}`);r&&s.push("{...props}");let i=`${o}<${n.tag}${s.length?" "+s.join(" "):""}`;if(n.text!==void 0){e.push(`${i}>${sr(n.text)}</${n.tag}>`);return}if(!n.children||n.children.length===0){e.push(`${i} />`);return}e.push(`${i}>`);for(let a of n.children)ee(a,t+1,e,false);e.push(`${o}</${n.tag}>`);}function ko(n,t={}){let e=t.componentName??"Metafile";if(!/^[A-Z][A-Za-z0-9_$]*$/.test(e))throw new TypeError(`svgTreeToJsx: componentName must be a PascalCase identifier, got ${JSON.stringify(e)}`);let r=t.typescript??true,o=t.spreadProps??true,s=[];ee(n,2,s,o);let i=o?r?"props: SVGProps<SVGSVGElement>":"props":"";return [...r&&o?["import type { SVGProps } from 'react';",""]:[],`export function ${e}(${i}) {`," return (",...s," );","}","",`export default ${e};`,""].join(`
2
+ `)}exports.$=So;exports.A=Qr;exports.B=Ce;exports.C=to;exports.D=no;exports.E=eo;exports.F=kn;exports.G=ro;exports.H=Yn;exports.I=oo;exports.J=so;exports.K=io;exports.L=nt;exports.M=ft;exports.N=Qt;exports.O=It;exports.P=Ot;exports.Q=z;exports.R=Pr;exports.S=at;exports.T=To;exports.U=Jn;exports.V=Vn;exports.W=He;exports.X=Ro;exports.Y=ze;exports.Z=jn;exports._=qn;exports.a=nn;exports.aa=yo;exports.b=ur;exports.ba=Ve;exports.c=lr;exports.ca=Kn;exports.d=mr;exports.da=Ao;exports.e=Et;exports.ea=Po;exports.f=Ee;exports.fa=Co;exports.g=ge;exports.ga=Lo;exports.h=Dr;exports.ha=_o;exports.i=Ln;exports.ia=Hn;exports.j=kr;exports.ja=Io;exports.k=Gr;exports.ka=Oo;exports.l=Xr;exports.la=je;exports.m=$r;exports.ma=vo;exports.n=Wr;exports.na=ct;exports.o=Yr;exports.oa=qe;exports.p=Hr;exports.pa=Ke;exports.q=ut;exports.qa=No;exports.r=q;exports.ra=Ze;exports.s=Yt;exports.sa=Qe;exports.t=Se;exports.ta=nr;exports.u=Fn;exports.ua=Uo;exports.v=W;exports.va=Do;exports.w=At;exports.wa=ko;exports.x=Ht;exports.y=Pe;exports.z=Zr;
@@ -0,0 +1,2 @@
1
+ import {a as a$1,c}from'./chunk-L2UW73US.mjs';import {a}from'./chunk-T6E6K636.mjs';import {a as a$2}from'./chunk-75GGL2QB.mjs';var _t=[1,0,0,1,0,0];function et(n,t){return [n[0]*t[0]+n[2]*t[1],n[1]*t[0]+n[3]*t[1],n[0]*t[2]+n[2]*t[3],n[1]*t[2]+n[3]*t[3],n[0]*t[4]+n[2]*t[5]+n[4],n[1]*t[4]+n[3]*t[5]+n[5]]}function Y(n){let t=n[0]*n[3]-n[1]*n[2];return !t||!Number.isFinite(t)?null:[n[3]/t,-n[1]/t,-n[2]/t,n[0]/t,(n[2]*n[5]-n[3]*n[4])/t,(n[1]*n[4]-n[0]*n[5])/t]}var nt=class n{constructor(){this.segs=[];this.cur=null;this.start=null;}reset(){this.segs=[],this.cur=null,this.start=null;}moveDevice(t){this.segs.push({t:"M",x:t.x,y:t.y}),this.cur=t,this.start=t;}lineDevice(t){if(!this.cur){this.moveDevice(t);return}this.segs.push({t:"L",x:t.x,y:t.y}),this.cur=t;}static map(t,e,r){return {x:t[0]*e+t[2]*r+t[4],y:t[1]*e+t[3]*r+t[5]}}moveTo(t,e,r){Number.isFinite(e)&&Number.isFinite(r)&&this.moveDevice(n.map(t,e,r));}lineTo(t,e,r){Number.isFinite(e)&&Number.isFinite(r)&&this.lineDevice(n.map(t,e,r));}curveUser(t,e,r,o,s,i,a){let c=n.map(t,e,r),u=n.map(t,o,s),l=n.map(t,i,a);this.cur||this.moveDevice(c),this.segs.push({t:"C",x1:c.x,y1:c.y,x2:u.x,y2:u.y,x:l.x,y:l.y}),this.cur=l;}bezierCurveTo(t,e,r,o,s,i,a){[e,r,o,s,i,a].every(Number.isFinite)&&this.curveUser(t,e,r,o,s,i,a);}quadraticCurveTo(t,e,r,o,s){if(![e,r,o,s].every(Number.isFinite))return;let i=Y(t),a=this.cur&&i?{x:i[0]*this.cur.x+i[2]*this.cur.y+i[4],y:i[1]*this.cur.x+i[3]*this.cur.y+i[5]}:{x:e,y:r};this.curveUser(t,a.x+2/3*(e-a.x),a.y+2/3*(r-a.y),o+2/3*(e-o),s+2/3*(r-s),o,s);}closePath(){this.cur&&(this.segs.push({t:"Z"}),this.cur=this.start);}rect(t,e,r,o,s){[e,r,o,s].every(Number.isFinite)&&(this.moveDevice(n.map(t,e,r)),this.lineDevice(n.map(t,e+o,r)),this.lineDevice(n.map(t,e+o,r+s)),this.lineDevice(n.map(t,e,r+s)),this.segs.push({t:"Z"}),this.moveDevice(n.map(t,e,r)));}ellipseUser(t,e,r,o,s,i,a,c,u){let l=Math.PI*2,m=c-a;u?m=-m>=l?-l:-((-m%l+l)%l):m=m>=l?l:(m%l+l)%l;let h=Math.cos(i),b=Math.sin(i),f=A=>{let R=o*Math.cos(A),g=s*Math.sin(A);return {x:e+R*h-g*b,y:r+R*b+g*h}},p=A=>{let R=-o*Math.sin(A),g=s*Math.cos(A);return {x:R*h-g*b,y:R*b+g*h}},M=f(a);if(this.lineDevice(n.map(t,M.x,M.y)),m===0)return;let x=Math.max(1,Math.ceil(Math.abs(m)/(Math.PI/2)-1e-9)),E=m/x,d=4/3*Math.tan(E/4);for(let A=0;A<x;A++){let R=a+A*E,g=R+E,S=f(R),y=f(g),P=p(R),T=p(g);this.curveUser(t,S.x+d*P.x,S.y+d*P.y,y.x-d*T.x,y.y-d*T.y,y.x,y.y);}}ellipse(t,e,r,o,s,i,a,c,u=false){if(o<0||s<0)throw new RangeError("The radii provided are negative");[e,r,o,s,i,a,c].every(Number.isFinite)&&this.ellipseUser(t,e,r,o,s,i,a,c,u);}arc(t,e,r,o,s,i,a=false){if(o<0)throw new RangeError("The radius provided is negative");[e,r,o,s,i].every(Number.isFinite)&&this.ellipseUser(t,e,r,o,o,0,s,i,a);}arcTo(t,e,r,o,s,i){if(![e,r,o,s,i].every(Number.isFinite)||i<0)return;if(!this.cur){this.moveDevice(n.map(t,e,r));return}let a=Y(t);if(!a)return;let c=a[0]*this.cur.x+a[2]*this.cur.y+a[4],u=a[1]*this.cur.x+a[3]*this.cur.y+a[5],l=c-e,m=u-r,h=o-e,b=s-r,f=Math.hypot(l,m),p=Math.hypot(h,b),M=l*b-m*h;if(i===0||f===0||p===0||Math.abs(M)<1e-12*f*p){this.lineDevice(n.map(t,e,r));return}let x=l/f,E=m/f,d=h/p,A=b/p,R=Math.acos(Math.max(-1,Math.min(1,x*d+E*A))),g=i/Math.tan(R/2),S={x:e+x*g,y:r+E*g},y={x:e+d*g,y:r+A*g},P=x+d,T=E+A,C=Math.hypot(P,T),L=i/Math.sin(R/2),_={x:e+P/C*L,y:r+T/C*L},w=Math.atan2(S.y-_.y,S.x-_.x),D=Math.atan2(y.y-_.y,y.x-_.x)-w;for(;D>Math.PI;)D-=2*Math.PI;for(;D<=-Math.PI;)D+=2*Math.PI;this.ellipseUser(t,_.x,_.y,i,i,0,w,w+D,D<0);}};function ft(n,t,e){let r=[],o=null,s=0,i=0,a=0,c=0,u=(l,m)=>{let h={pts:[l,m],smooth:[false],closed:false};return r.push(h),h};for(let l of n)switch(l.t){case "M":o=u(l.x,l.y),s=a=l.x,i=c=l.y;break;case "L":o||(o=u(s,i)),o.pts.push(l.x,l.y),o.smooth.push(false),a=l.x,c=l.y;break;case "C":{o||(o=u(s,i));let m=Math.max(Math.abs(a-2*l.x1+l.x2),Math.abs(l.x1-2*l.x2+l.x)),h=Math.max(Math.abs(c-2*l.y1+l.y2),Math.abs(l.y1-2*l.y2+l.y)),b=Math.hypot(m,h),f=e?e(a,c,l.x1,l.y1,l.x2,l.y2,l.x,l.y):Math.max(1,Math.min(1e3,Math.ceil(Math.sqrt(.75*b/t))));for(let p=1;p<=f;p++){let M=p/f,x=1-M,E=x*x*x,d=3*x*x*M,A=3*x*M*M,R=M*M*M;o.pts.push(E*a+d*l.x1+A*l.x2+R*l.x,E*c+d*l.y1+A*l.y2+R*l.y),o.smooth.push(p<f);}a=l.x,c=l.y;break}case "Z":o&&(o.closed=true,o=null,a=s,c=i);break}return r}function Qt(n,t,e,r){let o=0,s=0;for(let i of n){let a=i.pts,c=a.length/2;if(!(c<2))for(let u=0;u<c;u++){let l=a[u*2],m=a[u*2+1],h=u+1<c?u+1:0,b=a[h*2],f=a[h*2+1];(m<=e?f>e:f<=e)&&l+(e-m)*(b-l)/(f-m)>t&&(s++,o+=f>m?1:-1);}}return r==="evenodd"?(s&1)===1:o!==0}function It(n){let t=/^\s*((?:(?:italic|oblique|normal|bold|bolder|lighter|small-caps|\d{3})\s+)*)([\d.]+)px\s+(.+)$/i.exec(n);if(!t)return {style:"",weight:"",size:10,family:"sans-serif"};let e=t[1].trim().split(/\s+/).filter(Boolean),r=e.find(s=>/^(italic|oblique)$/i.test(s))??"",o=e.find(s=>/^(bold|bolder|lighter|\d{3})$/i.test(s))??"";return {style:r,weight:o,size:parseFloat(t[2]),family:t[3].trim()}}function Ot(n,t){let e=0;for(let r of n)/[ilj.,;:'!|]/.test(r)?e+=.28:/[mwMW@]/.test(r)?e+=.83:/[A-Z0-9]/.test(r)?e+=.64:r===" "?e+=.28:r.charCodeAt(0)>11903?e+=1:e+=.52;return e*t}function tn(n,t,e,r,o,s,i){let a=It(r).size,c=Ot(n,a)*1.5+a;i!==void 0&&Number.isFinite(i)&&i>0&&(c=Math.min(c,i+a));let u=a*.3,l,m;o==="center"?(l=t-c/2,m=t+c/2):o==="right"||o==="end"?(l=t-c,m=t+u):(l=t-u,m=t+c);let h,b;switch(s){case "top":case "hanging":h=.3,b=1.5;break;case "middle":h=.9,b=.9;break;case "bottom":case "ideographic":h=1.5,b=.3;break;default:h=1.2,b=.5;}return {x0:l,y0:e-h*a,x1:m,y1:e+b*a}}var oe=new Uint8Array(new Uint32Array([1]).buffer)[0]===1;function nn(n,t,e,r){let o=Math.round(n)&255,s=Math.round(t)&255,i=Math.round(e)&255,a=Math.round(r)&255;return (oe?a<<24|i<<16|s<<8|o:o<<24|s<<16|i<<8|a)>>>0}function ur(n,t,e){let r=o=>o.toString(16).padStart(2,"0");return `#${r(n&255)}${r(t&255)}${r(e&255)}`}function lr(n){let t=(n>>>24&255)/255,e=n>>>16&255,r=n>>>8&255,o=n&255;return `rgba(${e},${r},${o},${t.toFixed(3)})`}function mr(n,t,e){let r=Math.min(1,Math.max(0,e)),o=(m,h)=>Math.round(m+(h-m)*r),s=n>>>24&255,i=t>>>24&255,a=o(n>>>16&255,t>>>16&255),c=o(n>>>8&255,t>>>8&255),u=o(n&255,t&255),l=o(s,i)/255;return `rgba(${a},${c},${u},${l.toFixed(3)})`}function en(n){let t=/^#([0-9a-f]{6})$/i.exec(n);if(t)return `#${(16777215^parseInt(t[1],16)).toString(16).padStart(6,"0")}`;let e=/^#([0-9a-f]{3})$/i.exec(n);if(e){let[o,s,i]=e[1].split("").map(c=>parseInt(c+c,16)),a=c=>(255-c).toString(16).padStart(2,"0");return `#${a(o)}${a(s)}${a(i)}`}let r=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+)\s*)?\)$/i.exec(n);if(r){let o=255-Math.min(255,parseInt(r[1],10)),s=255-Math.min(255,parseInt(r[2],10)),i=255-Math.min(255,parseInt(r[3],10));return r[4]!==void 0?`rgba(${o},${s},${i},${r[4]})`:`rgb(${o},${s},${i})`}return n}var vt=new Float64Array(0),rn=new Uint8Array(0),bt=[],G=new Float64Array(0);function se(n){if(G.length<n){let t=new Float64Array(Math.max(n,G.length*2,1024));t.set(G),G=t;}}function ie(n,t,e,r,o,s,i,a,c){if(i===c)return;let u=1;if(i>c){u=-1;let M=s;s=a,a=M,M=i,i=c,c=M;}let l=Math.max(0,i),m=Math.min(r,c);if(l>=m)return;let h=(M,x,E)=>{let d=M*e+x;n[d]+=E,t[d]||(t[d]=1,bt[M].push(x));},b=(a-s)/(c-i),f=Math.min(o,Math.max(0,s+(l-i)*b)),p=Math.ceil(m);for(let M=Math.floor(l);M<p;M++){let x=Math.min(M+1,m)-Math.max(M,l),E=f+b*x;E<0?E=0:E>o&&(E=o);let d=x*u,A=f<E?f:E,R=f<E?E:f,g=Math.floor(A),S=Math.ceil(R);if(S<=g+1){let y=.5*(f+E)-g;h(M,g,d-d*y),h(M,g+1,d*y);}else {let y=1/(R-A),P=A-g,T=.5*y*(1-P)*(1-P),C=R-S+1,L=.5*y*C*C;if(h(M,g,d*T),S===g+2)h(M,g+1,d*(1-T-L));else {let _=y*(1.5-P);h(M,g+1,d*(_-T));for(let I=g+2;I<S-1;I++)h(M,I,d*y);let w=_+(S-g-3)*y;h(M,S-1,d*(1-w-L));}h(M,S,d*L);}f=E;}}function ae(n,t){let e;if(t){let r=Math.abs(n);r-=2*Math.floor(r/2),e=r>1?2-r:r;}else e=Math.abs(n),e>1&&(e=1);return Math.round(e*255)}var ce=(n,t)=>n-t;function rt(n,t,e,r){let o=1/0,s=1/0,i=-1/0,a=-1/0;for(let R of n)for(let g=0;g+1<R.length;g+=2){let S=R[g],y=R[g+1];S<o&&(o=S),S>i&&(i=S),y<s&&(s=y),y>a&&(a=y);}if(!(o<=i)||!(s<=a)||!Number.isFinite(o+i+s+a))return null;let c=Math.max(e.x0,Math.floor(o)),u=Math.max(e.y0,Math.floor(s)),l=Math.min(e.x1,Math.ceil(i)),m=Math.min(e.y1,Math.ceil(a));if(l<=c||m<=u)return null;let h=l-c,b=0,f=(R,g,S,y)=>{g!==y&&(se((b+1)*4),G[b*4]=R,G[b*4+1]=g,G[b*4+2]=S,G[b*4+3]=y,b++);},p=(R,g,S,y)=>{if(!(g===y||Math.max(g,y)<=u||Math.min(g,y)>=m)&&!(R>=h&&S>=h)){if(R>h||S>h){let P=(h-R)/(S-R),T=g+(y-g)*P;R>h?(R=h,g=T):(S=h,y=T);}if(R<=0&&S<=0){f(0,g,0,y);return}if(R<0||S<0){let P=(0-R)/(S-R),T=g+(y-g)*P;R<0?(f(0,g,0,T),f(0,T,S,y)):(f(R,g,0,T),f(0,T,0,y));return}f(R,g,S,y);}};for(let R of n){let g=R.length>>1;if(!(g<2))for(let S=0;S<g;S++){let y=S+1<g?S+1:0;p(R[S*2]-c,R[S*2+1],R[y*2]-c,R[y*2+1]);}}if(b===0)return null;let M=h+2,x=Math.max(1,Math.min(m-u,Math.floor(1048576/M)));for(vt.length<x*M&&(vt=new Float64Array(x*M),rn=new Uint8Array(x*M));bt.length<x;)bt.push([]);let E=vt,d=rn,A=t==="evenodd";for(let R=u;R<m;R+=x){let g=Math.min(x,m-R);for(let S=0;S<b;S++){let y=S*4,P=G[y+1]-R,T=G[y+3]-R;P<=0&&T<=0||P>=g&&T>=g||ie(E,d,M,g,h,G[y],P,G[y+2],T);}for(let S=0;S<g;S++){let y=bt[S];if(y.length===0)continue;y.sort(ce);let P=S*M,T=R+S,C=0;for(let L=0;L<y.length;L++){let _=y[L];if(C+=E[P+_],E[P+_]=0,d[P+_]=0,_>=h)continue;let w=L+1<y.length?Math.min(y[L+1],h):h,I=ae(C,A);I&&r(T,c+_,c+w,I);}y.length=0;}}return {x0:c,y0:u,x1:l,y1:m}}var ue={black:0,white:16777215,red:16711680,lime:65280,green:32768,blue:255,yellow:16776960,cyan:65535,aqua:65535,magenta:16711935,fuchsia:16711935,gray:8421504,grey:8421504,silver:12632256,maroon:8388608,olive:8421376,teal:32896,navy:128,purple:8388736,orange:16753920,darkgray:11119017,darkgrey:11119017,lightgray:13882323,lightgrey:13882323,dimgray:6908265,dimgrey:6908265,whitesmoke:16119285,gainsboro:14474460},xt=new Map;function dt(n){let t=xt.get(n);if(t!==void 0)return t;let e=le(n.trim().toLowerCase());return xt.size>4096&&xt.clear(),xt.set(n,e),e}function le(n){if(n==="transparent")return [0,0,0,0];if(n[0]==="#"){let r=n.slice(1);if(!/^[0-9a-f]+$/.test(r))return null;if(r.length===3||r.length===4){let o=[...r].map(s=>parseInt(s+s,16));return [o[0],o[1],o[2],r.length===4?o[3]/255:1]}return r.length===6||r.length===8?[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16),r.length===8?parseInt(r.slice(6,8),16)/255:1]:null}let t=/^rgba?\(([^)]*)\)$/.exec(n);if(t){let r=t[1].split(/[\s,/]+/).filter(Boolean);if(r.length<3)return null;let o=a=>{let c=a.endsWith("%")?parseFloat(a)*255/100:parseFloat(a);return Math.max(0,Math.min(255,Math.round(c)))},s=r.length>3?r[3].endsWith("%")?parseFloat(r[3])/100:parseFloat(r[3]):1,i=[o(r[0]),o(r[1]),o(r[2])];return i.some(a=>!Number.isFinite(a))||!Number.isFinite(s)?null:[i[0],i[1],i[2],Math.max(0,Math.min(1,s))]}let e=ue[n];return e===void 0?null:[e>>16&255,e>>8&255,e&255,1]}var H=class{constructor(t,e){this.kind=t;this.coords=e;this.stops=[];this.sorted=null;}addColorStop(t,e){if(!(t>=0&&t<=1))throw new RangeError("Gradient stop offset out of range");let r=dt(e);if(!r)throw new SyntaxError(`Invalid colour: ${e}`);this.stops.push({offset:t,color:r}),this.sorted=null;}sortedStops(){return this.sorted||(this.sorted=this.stops.map((t,e)=>({s:t,i:e})).sort((t,e)=>t.s.offset-e.s.offset||t.i-e.i).map(t=>t.s)),this.sorted}},V=class{constructor(t,e,r,o){this.data=t;this.width=e;this.height=r;this.repetition=o;this.matrix=[1,0,0,1,0,0];}setTransform(t){let e=[t?.a??1,t?.b??0,t?.c??0,t?.d??1,t?.e??0,t?.f??0];e.every(Number.isFinite)&&(this.matrix=e);}};function on(n,t,e){let r,o=n.length;if(t<=n[0].offset)r=n[0].color;else if(t>=n[o-1].offset)r=n[o-1].color;else {let s=0,i=o-1;for(;i-s>1;){let h=s+i>>1;n[h].offset<=t?s=h:i=h;}let a=n[s],c=n[i],u=c.offset-a.offset,l=u>0?(t-a.offset)/u:1,m=a.color[3]+(c.color[3]-a.color[3])*l;e[0]=(a.color[0]+(c.color[0]-a.color[0])*l)*m,e[1]=(a.color[1]+(c.color[1]-a.color[1])*l)*m,e[2]=(a.color[2]+(c.color[2]-a.color[2])*l)*m,e[3]=m*255;return}e[0]=r[0]*r[3],e[1]=r[1]*r[3],e[2]=r[2]*r[3],e[3]=r[3]*255;}function me(n,t){let e=n.sortedStops(),r=Y(t);if(e.length===0||!r)return null;let o=n.coords;if(n.kind==="linear"){let[p,M,x,E]=o,d=x-p,A=E-M,R=d*d+A*A;return R>0?{shade(g,S,y){let P=g+.5,T=S+.5,C=r[0]*P+r[2]*T+r[4],L=r[1]*P+r[3]*T+r[5];return on(e,((C-p)*d+(L-M)*A)/R,y),true}}:null}let[s,i,a,c,u,l]=o;if(s===c&&i===u&&a===l)return null;let m=c-s,h=u-i,b=l-a,f=m*m+h*h-b*b;return {shade(p,M,x){let E=p+.5,d=M+.5,A=r[0]*E+r[2]*d+r[4]-s,R=r[1]*E+r[3]*d+r[5]-i,g=A*m+R*h+a*b,S=A*A+R*R-a*a,y;if(Math.abs(f)<1e-12){if(Math.abs(g)<1e-12||(y=S/(2*g),a+y*b<0))return false}else {let P=g*g-f*S;if(P<0)return false;let T=Math.sqrt(P),C=(g+T)/f,L=(g-T)/f,_=Math.max(C,L),w=Math.min(C,L);if(a+_*b>=0)y=_;else if(a+w*b>=0)y=w;else return false}return on(e,y,x),true}}}function sn(n,t){let e=n%t;return e<0?e+t:e}function he(n,t,e,r){if(n.transparentOutside&&(!n.wrapX&&(t<n.minX||t>=n.maxX)||!n.wrapY&&(e<n.minY||e>=n.maxY)))return false;let o=n.data,s=n.width,i=T=>n.wrapX?sn(T,s):Math.min(n.maxX-1,Math.max(n.minX,T)),a=T=>n.wrapY?sn(T,n.height):Math.min(n.maxY-1,Math.max(n.minY,T));if(!n.smooth){let T=(a(Math.floor(e))*s+i(Math.floor(t)))*4;return r[0]=o[T],r[1]=o[T+1],r[2]=o[T+2],r[3]=o[T+3],true}let c=t-.5,u=e-.5,l=Math.floor(c),m=Math.floor(u),h=c-l,b=u-m,f=i(l),p=i(l+1),M=a(m)*s,x=a(m+1)*s,E=(M+f)*4,d=(M+p)*4,A=(x+f)*4,R=(x+p)*4,g=(1-h)*(1-b),S=h*(1-b),y=(1-h)*b,P=h*b;for(let T=0;T<4;T++)r[T]=o[E+T]*g+o[d+T]*S+o[A+T]*y+o[R+T]*P;return true}function wt(n,t){let e=Y(t);return e?{shade(r,o,s){let i=r+.5,a=o+.5;return he(n,e[0]*i+e[2]*a+e[4],e[1]*i+e[3]*a+e[5],s)}}:null}function ot(n,t,e){if(typeof n=="string"){let r=dt(n);return r?{solid:[r[0]*r[3],r[1]*r[3],r[2]*r[3],r[3]*255]}:null}if(n instanceof H)return me(n,t);if(n instanceof V){let r=n.repetition,o=r==="repeat"||r==="repeat-x",s=r==="repeat"||r==="repeat-y";return wt({data:n.data,width:n.width,height:n.height,wrapX:o,wrapY:s,minX:0,minY:0,maxX:n.width,maxY:n.height,transparentOutside:true,smooth:e},et(t,n.matrix))}return null}var ln=new Set(["copy","source-in","source-out","destination-in","destination-atop"]),Nt={multiply:(n,t)=>n*t,screen:(n,t)=>n+t-n*t,overlay:(n,t)=>an(t,n),darken:(n,t)=>Math.min(n,t),lighten:(n,t)=>Math.max(n,t),"color-dodge":(n,t)=>t===0?0:n>=1?1:Math.min(1,t/(1-n)),"color-burn":(n,t)=>t>=1?1:n<=0?0:1-Math.min(1,(1-t)/n),"hard-light":(n,t)=>an(n,t),"soft-light":(n,t)=>{if(n<=.5)return t-(1-2*n)*t*(1-t);let e=t<=.25?((16*t-12)*t+4)*t:Math.sqrt(t);return t+(2*n-1)*(e-t)},difference:(n,t)=>Math.abs(n-t),exclusion:(n,t)=>n+t-2*n*t};function an(n,t){return n<=.5?t*2*n:Nt.screen(2*n-1,t)}function Z(n,t,e){return .3*n+.59*t+.11*e}function fe(n){let t=Z(n[0],n[1],n[2]),e=Math.min(n[0],n[1],n[2]),r=Math.max(n[0],n[1],n[2]),[o,s,i]=n;return e<0&&(o=t+(o-t)*t/(t-e),s=t+(s-t)*t/(t-e),i=t+(i-t)*t/(t-e)),r>1&&(o=t+(o-t)*(1-t)/(r-t),s=t+(s-t)*(1-t)/(r-t),i=t+(i-t)*(1-t)/(r-t)),[o,s,i]}function pt(n,t){let e=t-Z(n[0],n[1],n[2]);return fe([n[0]+e,n[1]+e,n[2]+e])}function cn(n){return Math.max(n[0],n[1],n[2])-Math.min(n[0],n[1],n[2])}function un(n,t){let e=[0,1,2].sort((a,c)=>n[a]-n[c]),r=[0,0,0],[o,s,i]=e;return n[i]>n[o]&&(r[s]=(n[s]-n[o])*t/(n[i]-n[o]),r[i]=t),r}var mn={hue:(n,t)=>pt(un(n,cn(t)),Z(t[0],t[1],t[2])),saturation:(n,t)=>pt(un(t,cn(n)),Z(t[0],t[1],t[2])),color:(n,t)=>pt(n,Z(t[0],t[1],t[2])),luminosity:(n,t)=>pt(t,Z(n[0],n[1],n[2]))};function hn(n){return n in Nt||n in mn||["source-over","source-in","source-out","source-atop","destination-over","destination-in","destination-out","destination-atop","xor","copy","lighter"].includes(n)}function st(n,t,e,r,o,s,i,a){let c=n[t]/255,u=n[t+1]/255,l=n[t+2]/255,m=n[t+3]/255,h,b,f,p;switch(a){case "source-over":h=e+c*(1-s),b=r+u*(1-s),f=o+l*(1-s),p=s+m*(1-s);break;case "copy":h=e,b=r,f=o,p=s;break;case "destination-over":h=e*(1-m)+c,b=r*(1-m)+u,f=o*(1-m)+l,p=s*(1-m)+m;break;case "source-in":h=e*m,b=r*m,f=o*m,p=s*m;break;case "destination-in":h=c*s,b=u*s,f=l*s,p=m*s;break;case "source-out":h=e*(1-m),b=r*(1-m),f=o*(1-m),p=s*(1-m);break;case "destination-out":h=c*(1-s),b=u*(1-s),f=l*(1-s),p=m*(1-s);break;case "source-atop":h=e*m+c*(1-s),b=r*m+u*(1-s),f=o*m+l*(1-s),p=m;break;case "destination-atop":h=e*(1-m)+c*s,b=r*(1-m)+u*s,f=o*(1-m)+l*s,p=s;break;case "xor":h=e*(1-m)+c*(1-s),b=r*(1-m)+u*(1-s),f=o*(1-m)+l*(1-s),p=s*(1-m)+m*(1-s);break;case "lighter":h=Math.min(1,e+c),b=Math.min(1,r+u),f=Math.min(1,o+l),p=Math.min(1,s+m);break;default:{p=s+m-s*m;let M=s*m,x=[s>0?e/s:0,s>0?r/s:0,s>0?o/s:0],E=[m>0?c/m:0,m>0?u/m:0,m>0?l/m:0],d,A=Nt[a];if(A)d=[A(x[0],E[0]),A(x[1],E[1]),A(x[2],E[2])];else {let R=mn[a];if(!R){st(n,t,e,r,o,s,i,"source-over");return}d=R(x,E);}h=e*(1-m)+c*(1-s)+M*d[0],b=r*(1-m)+u*(1-s)+M*d[1],f=o*(1-m)+l*(1-s)+M*d[2];}}i<1&&(h=c+(h-c)*i,b=u+(b-u)*i,f=l+(f-l)*i,p=m+(p-m)*i),n[t]=h*255,n[t+1]=b*255,n[t+2]=f*255,n[t+3]=p*255;}function fn(n,t){let e=Math.abs(n),r=Math.abs(t);if(e<r){let o=e;e=r,r=o;}return e+r/2}function dn(n,t){let e=fn(n[0]*t,n[1]*t),r=fn(n[2]*t,n[3]*t);return e<=1&&r<=1?(e+r)/2:null}function Mn(n,t,e,r,o,s,i,a){let c=i/3+2*n/3,u=a/3+2*t/3,l=n/3+2*i/3,m=t/3+2*a/3,h=Math.max(Math.abs(e-c),Math.abs(r-u),Math.abs(o-l),Math.abs(s-m)),b=1/8;for(let f=0;f<9;f++){if(h<b)return 1<<f;b*=4;}return 512}var Mt=32768;function bn(n,t){return Math.trunc(n*65536/t)}function xn(n,t){return n*t>>6}function En(n,t,e,r,o,s,i){let a=0,c=1,u=e-n,l=r-t,m=[[-u,n+1],[u,o+1-n],[-l,t+1],[l,s+1-t]];for(let[h,b]of m)if(h===0){if(b<0)return}else {let f=b/h;h<0?a=Math.max(a,f):c=Math.min(c,f);}a>c||Ft(Math.round((n+u*a)*64),Math.round((t+l*a)*64),Math.round((n+u*c)*64),Math.round((t+l*c)*64),i);}function Ft(n,t,e,r,o){if(Math.abs(e-n)>511*64||Math.abs(r-t)>511*64){let s=(n>>1)+(e>>1),i=(t>>1)+(r>>1);Ft(n,t,s,i,o),Ft(s,i,e,r,o);return}if(Math.abs(e-n)>Math.abs(r-t)){n>e&&([n,e]=[e,n],[t,r]=[r,t]);let s=n>>6,i=e+63>>6,a=t<<10,c=t===r?0:bn(r-t,e-n);a+=c*(32-(n&63))+32>>6,pn(s,i,a,c,e-n,n&63,e&63,(u,l,m,h)=>{m&&o(u,l-1,m),h&&o(u,l,h);});}else {if(n===e&&t===r)return;t>r&&([n,e]=[e,n],[t,r]=[r,t]);let s=t>>6,i=r+63>>6,a=n<<10,c=n===e?0:bn(e-n,r-t);a+=c*(32-(t&63))+32>>6,pn(s,i,a,c,r-t,t&63,r&63,(u,l,m,h)=>{m&&o(l-1,u,m),h&&o(l,u,h);});}}function pn(n,t,e,r,o,s,i,a){if(t<=n)return;let c,u;t-n===1?(c=o,u=0):(c=64-s,u=i);let l=(f,p,M)=>{p+=Mt;let x=p>>16,E=p>>8&255;return a(f,x,xn(255-E,M),xn(E,M)),p+r-Mt},m=l(n,e,c),h=n+1,b=t-h-(u>0?1:0);if(b>0){m+=Mt;for(let f=0;f<b;f++,h++){let p=m>>16,M=m>>8&255;a(h,p,255-M,M),m+=r;}m-=Mt;}u>0&&l(t-1,m,u);}var Q=1e-9;function gn(n){let t=[],e=[],r=n.pts;for(let o=0;o<r.length;o+=2){let s=t.length;s>=2&&Math.abs(t[s-2]-r[o])<Q&&Math.abs(t[s-1]-r[o+1])<Q||(t.push(r[o],r[o+1]),e.push(n.smooth[o>>1]??false));}if(n.closed&&t.length>=4){let o=t.length;Math.abs(t[o-2]-t[0])<Q&&Math.abs(t[o-1]-t[1])<Q&&(t.length-=2,e.length-=1);}return e[0]=false,{pts:t,smooth:e,closed:n.closed}}function Tn(n,t,e){let r=t.reduce((f,p)=>f+p,0);if(!(r>0))return [n];let o=n.pts,s=o.length>>1,i=n.closed?s:s-1;if(i<1)return [n];let a=e%r;a<0&&(a+=r);let c=0;for(;a>0&&a>=t[c];)a-=t[c],c=(c+1)%t.length;let u=t[c]-a,l=c%2===0,m=[],h=l?{pts:[o[0],o[1]],smooth:[false],closed:false}:null,b=l;for(let f=0;f<i;f++){let p=o[f*2],M=o[f*2+1],x=(f+1)%s,E=o[x*2],d=o[x*2+1],A=Math.hypot(E-p,d-M),R=0;for(;A-R>u;){R+=u;let g=R/A,S=p+(E-p)*g,y=M+(d-M)*g;l&&h?(h.pts.push(S,y),h.smooth.push(false),h.pts.length===4&&Math.abs(h.pts[0]-S)<Q&&Math.abs(h.pts[1]-y)<Q&&(h.pts.length=2,h.smooth.length=1,h.dir=[(E-p)/A,(d-M)/A]),m.push(h),h=null):h={pts:[S,y],smooth:[false],closed:false,dir:[(E-p)/A,(d-M)/A]},l=!l,c=(c+1)%t.length,u=t[c];}u-=A-R,l&&h&&(h.pts.push(E,d),h.smooth.push(x===0?false:n.smooth[x]));}if(l&&h){if(n.closed&&b&&m.length>0){let f=m.shift();h.pts.push(...f.pts.slice(2)),h.smooth.push(...f.smooth.slice(1));}m.push(h);}for(let f of m)f.pts.length>2&&delete f.dir;return m}function Ut(n,t,e,r,o,s,i){let a=Math.ceil(Math.abs(s)/i);for(let c=1;c<a;c++){let u=o+s*c/a;n.push(t+r*Math.cos(u),e+r*Math.sin(u));}}function be(n,t,e,r,o,s,i,a,c,u,l,m,h,b,f){let p=t+a*m,M=e+c*m,x=t+u*m,E=e+l*m,d=r*s+o*i,A=r*i-o*s;if(n.push(p,M),Math.abs(A)<1e-12&&d>0)return;if(!(a*s+c*i<0||Math.abs(A)<1e-12&&d<0)){n.push(t,e),n.push(x,E);return}if(h==="round"){let g=Math.atan2(c,a),S=Math.atan2(l,u)-g;for(;S<=-Math.PI;)S+=2*Math.PI;for(;S>Math.PI;)S-=2*Math.PI;Math.abs(A)<1e-12&&(S=Math.PI*Math.sign(a*o-c*r)),Ut(n,t,e,m,g,S,f);}else if(h==="miter"){let g=a*u+c*l,S=Math.sqrt(Math.max(0,(1+g)/2));if(S>1e-12&&1/S<=b){let y=a+u,P=c+l,T=Math.hypot(y,P);if(T>1e-12){let C=m/S;n.push(t+y/T*C,e+P/T*C);}}}n.push(x,E);}function xe(n,t,e,r){let o=t.lineWidth/2,s=n.pts,i=s.length>>1,a=t.lineCap;if(i===1){if(!r||n.closed||a==="butt")return [];let x=s[0],E=s[1],[d,A]=n.dir??[1,0];if(a==="round"){let S=[x+o,E];return Ut(S,x,E,o,0,2*Math.PI,e),[S]}let R=-A,g=d;return [[x+(d+R)*o,E+(A+g)*o,x+(-d+R)*o,E+(-A+g)*o,x+(-d-R)*o,E+(-A-g)*o,x+(d-R)*o,E+(A-g)*o]]}let c=n.closed?i:i-1,u=new Float64Array(c*2);for(let x=0;x<c;x++){let E=(x+1)%i,d=s[E*2]-s[x*2],A=s[E*2+1]-s[x*2+1],R=Math.hypot(d,A)||1;u[x*2]=d/R,u[x*2+1]=A/R;}let l=x=>{let E=[],d=n.closed?0:1,A=n.closed?i-1:i-2;n.closed||E.push(s[0]+x*u[1]*o,s[1]-x*u[0]*o);for(let R=d;R<=A;R++){let g=(R-1+c)%c,S=R%c,y=u[g*2],P=u[g*2+1],T=u[S*2],C=u[S*2+1],L=n.smooth[R]?"round":t.lineJoin;be(E,s[R*2],s[R*2+1],y,P,T,C,x*P,-x*y,x*C,-x*T,o,L,t.miterLimit,e);}if(!n.closed){let R=c-1;E.push(s[(i-1)*2]+x*u[R*2+1]*o,s[(i-1)*2+1]-x*u[R*2]*o);}return E},m=l(1),h=l(-1),b=x=>{let E=[];for(let d=x.length-2;d>=0;d-=2)E.push(x[d],x[d+1]);return E};if(n.closed)return [m,b(h)];let f=m.slice(),p=(x,E,d,A)=>{if(a==="square")f.push(x+(A+d)*o,E+(-d+A)*o),f.push(x+(-A+d)*o,E+(d+A)*o);else if(a==="round"){let R=Math.atan2(-d,A);Ut(f,x,E,o,R,Math.PI,e);}},M=i-1;return p(s[M*2],s[M*2+1],u[(c-1)*2],u[(c-1)*2+1]),f.push(...b(h)),p(s[0],s[1],-u[0],-u[1]),[f]}function Rn(n,t,e){let r=Y(t);if(!r)return [];let o=[];for(let s of n){let i={pts:new Array(s.pts.length),smooth:s.smooth,closed:s.closed};for(let u=0;u<s.pts.length;u+=2){let l=s.pts[u],m=s.pts[u+1];i.pts[u]=r[0]*l+r[2]*m+r[4],i.pts[u+1]=r[1]*l+r[3]*m+r[5];}let a=gn(i),c=e.lineDash.length>0?Tn(a,e.lineDash,e.lineDashOffset):[a];for(let u of c){let l=u.pts;for(let m=0;m<l.length;m+=2){let h=l[m],b=l[m+1];l[m]=t[0]*h+t[2]*b+t[4],l[m+1]=t[1]*h+t[3]*b+t[5];}o.push({pts:l,smooth:u.smooth,closed:u.closed});}}return o}function Dt(n,t,e,r){let o=Y(t);if(!o||!(e.lineWidth>0))return [];let s=Math.max(Math.hypot(t[0],t[1]),Math.hypot(t[2],t[3])),i=Math.max(1e-6,e.lineWidth/2*s),a=i<=r?Math.PI/2:Math.max(.05,2*Math.acos(1-r/i)),c=[];for(let u of n){let l={pts:new Array(u.pts.length),smooth:u.smooth,closed:u.closed};for(let f=0;f<u.pts.length;f+=2){let p=u.pts[f],M=u.pts[f+1];l.pts[f]=o[0]*p+o[2]*M+o[4],l.pts[f+1]=o[1]*p+o[3]*M+o[5];}let m=u.pts.length>=4,h=gn(l),b=e.lineDash.length>0?Tn(h,e.lineDash,e.lineDashOffset):[h];for(let f of b)for(let p of xe(f,e,a,m)){for(let M=0;M<p.length;M+=2){let x=p[M],E=p[M+1];p[M]=t[0]*x+t[2]*E+t[4],p[M+1]=t[1]*x+t[3]*E+t[5];}c.push(p);}}return c}var it=.05,kt=null;function pe(){if(kt)return kt;let n=Math.fround,t=n(1/255),e=new Uint8Array(256*256);for(let r=1;r<256;r++){let o=n(1/n(r*t));for(let s=0;s<256;s++){let i=n(n(n(s*t)*o)*255),a=Math.min(Math.max(i,0),255),c=Math.floor(a),u=a-c;e[r<<8|s]=u>.5||u===.5&&c%2===1?c+1:c;}}return kt=e,e}var z=class{constructor(t,e){this.unknown=null;this.textDraws=0;this.width=Math.max(1,Math.floor(t)),this.height=Math.max(1,Math.floor(e)),this.data=new Uint8ClampedArray(this.width*this.height*4),this.words=new Uint32Array(this.data.buffer),this.ctx=new at(this);}getContext(t){return this.ctx}get pixels(){return this.readRgba(0,0,this.width,this.height)}readRgba(t,e,r,o){let s=new Uint8ClampedArray(Math.max(0,r*o*4)),{width:i,height:a,data:c}=this;for(let u=0;u<o;u++){let l=e+u;if(!(l<0||l>=a))for(let m=0;m<r;m++){let h=t+m;if(h<0||h>=i)continue;let b=(l*i+h)*4,f=(u*r+m)*4,p=c[b+3];if(p===255)s[f]=c[b],s[f+1]=c[b+1],s[f+2]=c[b+2],s[f+3]=255;else if(p!==0){let M=pe(),x=p<<8;s[f]=M[x|c[b]],s[f+1]=M[x|c[b+1]],s[f+2]=M[x|c[b+2]],s[f+3]=p;}}}return s}unknownIn(t,e,r,o){let s=this.unknown;if(!s)return null;let i=null;for(let a=0;a<o;a++){let c=e+a;if(!(c<0||c>=this.height))for(let u=0;u<r;u++){let l=t+u;l>=0&&l<this.width&&s[c*this.width+l]&&(i??(i=new Uint8Array(r*o)),i[a*r+u]=1);}}return i}markUnknown(t,e=null){let r=e?e.box:{x0:0,y0:0,x1:this.width,y1:this.height};this.unknown??(this.unknown=new Uint8Array(this.width*this.height));let o=this.unknown;rt([t],"nonzero",r,(s,i,a)=>{for(let c=i;c<a;c++)(!e||j(e,c,s))&&(o[s*this.width+c]=1);});}};function Pr(n){return n instanceof z||n instanceof at}function j(n,t,e){let r=n.box;return t<r.x0||t>=r.x1||e<r.y0||e>=r.y1?0:n.mask?n.mask[(e-r.y0)*(r.x1-r.x0)+(t-r.x0)]:255}function Sn(n,t,e,r){let o=n[t*2]-n[e*2],s=n[t*2+1]-n[e*2+1],i=Math.hypot(o,s);i>0&&(n[t*2]+=o/i*r,n[t*2+1]+=s/i*r);}function de(n){let t=n.length>>1;if(t===5&&n[0]===n[8]&&n[1]===n[9]&&(t=4),t!==4)return null;let e=[n[0],n[2],n[4],n[6]],r=[n[1],n[3],n[5],n[7]];if(![...e,...r].every(Number.isInteger))return null;let o=r[0]===r[1]&&e[1]===e[2]&&r[2]===r[3]&&e[3]===e[0],s=e[0]===e[1]&&r[1]===r[2]&&e[2]===e[3]&&r[3]===r[0];return !o&&!s?null:{x0:Math.min(...e),y0:Math.min(...r),x1:Math.max(...e),y1:Math.max(...r)}}function Bt(n){if(n instanceof z)return {data:n.data,width:n.width,height:n.height};if(n instanceof at)return Bt(n.canvas);let t=n,e=null;if(t&&t.data instanceof Uint8ClampedArray&&typeof t.width=="number"&&typeof t.height=="number")e={data:t.data,width:t.width,height:t.height};else if(t&&typeof t.getContext=="function"&&typeof t.width=="number"&&typeof t.height=="number")try{let a=t.getContext("2d")?.getImageData?.(0,0,t.width,t.height);a&&(e={data:a.data,width:t.width,height:t.height});}catch{e=null;}if(!e||e.width<=0||e.height<=0)return null;let r=e.width*e.height*4;if(e.data.length<r)return null;let o=new Uint8ClampedArray(r),s=e.data;for(let i=0;i<r;i+=4){let a=s[i+3];if(a===255)o[i]=s[i],o[i+1]=s[i+1],o[i+2]=s[i+2],o[i+3]=255;else if(a!==0){let c=a/255;o[i]=s[i]*c,o[i+1]=s[i+1]*c,o[i+2]=s[i+2]*c,o[i+3]=a;}}return {data:o,width:e.width,height:e.height}}var at=class{constructor(t){this.state={transform:[..._t],fillStyle:"#000000",strokeStyle:"#000000",lineWidth:1,lineCap:"butt",lineJoin:"miter",miterLimit:10,lineDash:[],lineDashOffset:0,globalAlpha:1,gco:"source-over",font:"10px sans-serif",textAlign:"start",textBaseline:"alphabetic",imageSmoothingEnabled:true,imageSmoothingQuality:"low",clip:null};this.stack=[];this.path=new nt;this.flatCache=null;this.rowCache=null;this.px=new Float64Array(4);this.canvas=t;}get fillStyle(){return this.state.fillStyle}set fillStyle(t){this.acceptStyle(t)&&(this.state.fillStyle=t);}get strokeStyle(){return this.state.strokeStyle}set strokeStyle(t){this.acceptStyle(t)&&(this.state.strokeStyle=t);}acceptStyle(t){return typeof t=="string"&&dt(t)!==null||t instanceof H||t instanceof V}get lineWidth(){return this.state.lineWidth}set lineWidth(t){Number.isFinite(t)&&t>0&&(this.state.lineWidth=t);}get lineCap(){return this.state.lineCap}set lineCap(t){(t==="butt"||t==="round"||t==="square")&&(this.state.lineCap=t);}get lineJoin(){return this.state.lineJoin}set lineJoin(t){(t==="miter"||t==="round"||t==="bevel")&&(this.state.lineJoin=t);}get miterLimit(){return this.state.miterLimit}set miterLimit(t){Number.isFinite(t)&&t>0&&(this.state.miterLimit=t);}get lineDashOffset(){return this.state.lineDashOffset}set lineDashOffset(t){Number.isFinite(t)&&(this.state.lineDashOffset=t);}get globalAlpha(){return this.state.globalAlpha}set globalAlpha(t){Number.isFinite(t)&&t>=0&&t<=1&&(this.state.globalAlpha=t);}get globalCompositeOperation(){return this.state.gco}set globalCompositeOperation(t){hn(t)&&(this.state.gco=t);}get font(){return this.state.font}set font(t){this.state.font=t;}get textAlign(){return this.state.textAlign}set textAlign(t){this.state.textAlign=t;}get textBaseline(){return this.state.textBaseline}set textBaseline(t){this.state.textBaseline=t;}get imageSmoothingEnabled(){return this.state.imageSmoothingEnabled}set imageSmoothingEnabled(t){this.state.imageSmoothingEnabled=!!t;}get imageSmoothingQuality(){return this.state.imageSmoothingQuality}set imageSmoothingQuality(t){this.state.imageSmoothingQuality=t;}setLineDash(t){!Array.isArray(t)||t.some(e=>!Number.isFinite(e)||e<0)||(this.state.lineDash=t.length%2?[...t,...t]:[...t]);}getLineDash(){return [...this.state.lineDash]}save(){this.stack.push({...this.state,transform:[...this.state.transform],lineDash:[...this.state.lineDash]});}restore(){let t=this.stack.pop();t&&(this.state=t);}getTransform(){let[t,e,r,o,s,i]=this.state.transform;return {a:t,b:e,c:r,d:o,e:s,f:i}}setTransform(t,e,r,o,s,i){let a=typeof t=="object"?[t.a??1,t.b??0,t.c??0,t.d??1,t.e??0,t.f??0]:[t,e,r,o,s,i];a.every(Number.isFinite)&&(this.state.transform=a);}resetTransform(){this.state.transform=[..._t];}transform(t,e,r,o,s,i){[t,e,r,o,s,i].every(Number.isFinite)&&(this.state.transform=et(this.state.transform,[t,e,r,o,s,i]));}translate(t,e){this.transform(1,0,0,1,t,e);}scale(t,e){this.transform(t,0,0,e,0,0);}rotate(t){let e=Math.cos(t),r=Math.sin(t);this.transform(e,r,-r,e,0,0);}beginPath(){this.path.reset();}closePath(){this.path.closePath();}moveTo(t,e){this.path.moveTo(this.state.transform,t,e);}lineTo(t,e){this.path.lineTo(this.state.transform,t,e);}bezierCurveTo(t,e,r,o,s,i){this.path.bezierCurveTo(this.state.transform,t,e,r,o,s,i);}quadraticCurveTo(t,e,r,o){this.path.quadraticCurveTo(this.state.transform,t,e,r,o);}arc(t,e,r,o,s,i=false){this.path.arc(this.state.transform,t,e,r,o,s,i);}arcTo(t,e,r,o,s){this.path.arcTo(this.state.transform,t,e,r,o,s);}ellipse(t,e,r,o,s,i,a,c=false){this.path.ellipse(this.state.transform,t,e,r,o,s,i,a,c);}rect(t,e,r,o){this.path.rect(this.state.transform,t,e,r,o);}flattened(){let t=this.path.segs,e=this.flatCache;if(e&&e.segs===t&&e.length===t.length)return e.polys;let r=ft(t,it);return this.flatCache={segs:t,length:t.length,polys:r},this.rowCache=null,r}strokeParams(){let t=this.state;return {lineWidth:t.lineWidth,lineCap:t.lineCap,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset}}surfaceBounds(){let t=this.state.clip,e={x0:0,y0:0,x1:this.canvas.width,y1:this.canvas.height};return t&&(e.x0=Math.max(e.x0,t.box.x0),e.y0=Math.max(e.y0,t.box.y0),e.x1=Math.min(e.x1,t.box.x1),e.y1=Math.min(e.y1,t.box.y1)),e}paintRings(t,e,r){if(!r||t.length===0)return;let o=this.surfaceBounds();if(o.x1<=o.x0||o.y1<=o.y0)return;let s=this.state.gco;if(ln.has(s)){this.paintUnbounded(t,e,r,o);return}let i=this.state.globalAlpha;if(i<=0)return;let{data:a,width:c}=this.canvas,u=this.state.clip?.mask?this.state.clip:null,l=this.canvas.unknown,m=this.px,h=r.solid,b=h?null:r.shade,f=h?h[0]*i/255:0,p=h?h[1]*i/255:0,M=h?h[2]*i/255:0,x=h?h[3]*i/255:0;if(h&&x<=0&&(s==="source-over"||s==="destination-out"||s==="source-atop"||s==="lighter"||s==="xor"))return;let E=h!==void 0&&x>=1&&s==="source-over",d=E?this.canvas.words:null,A=h?nn(h[0],h[1],h[2],255):0;rt(t,e,o,(R,g,S,y)=>{let P=R*c;if(d&&y===255&&!u){d.fill(A,P+g,P+S),l&&l.fill(0,P+g,P+S);return}let T=(P+g)*4,C=P+g;for(let L=g;L<S;L++,T+=4,C++){let _=y;if(u&&(_=_*j(u,L,R)/255),_<=0)continue;let w=_>=255?1:_/255,I=f,D=p,N=M,X=x;if(b){if(!b(L,R,m))continue;I=m[0]*i/255,D=m[1]*i/255,N=m[2]*i/255,X=m[3]*i/255;}E&&w===1?(a[T]=h[0],a[T+1]=h[1],a[T+2]=h[2],a[T+3]=255):st(a,T,I,D,N,X,w,s),l&&l[C]&&w===1&&X>=.9999&&(s==="source-over"||s==="destination-out")&&(l[C]=0);}});}paintUnbounded(t,e,r,o){let s=o.x1-o.x0,i=o.y1-o.y0,a=new Uint8Array(s*i);rt(t,e,o,(p,M,x,E)=>{let d=(p-o.y0)*s-o.x0;a.fill(E,d+M,d+x);});let{data:c,width:u}=this.canvas,l=this.state.clip,m=this.canvas.unknown,h=this.state.globalAlpha,b=this.state.gco,f=this.px;for(let p=o.y0;p<o.y1;p++)for(let M=o.x0;M<o.x1;M++){let x=l?j(l,M,p)/255:1;if(x<=0)continue;let E=a[(p-o.y0)*s+(M-o.x0)]/255,d=0,A=0,R=0,g=0;if(E>0){r.solid?[d,A,R,g]=r.solid:r.shade(M,p,f)&&([d,A,R,g]=f);let y=E*h/255;d*=y,A*=y,R*=y,g*=y;}let S=p*u+M;st(c,S*4,d,A,R,g,x,b),m&&x>=1&&b==="copy"&&(m[S]=0);}}fill(t="nonzero"){let e=this.flattened();this.paintRings(e.map(r=>r.pts),t==="evenodd"?"evenodd":"nonzero",ot(this.state.fillStyle,this.state.transform,this.state.imageSmoothingEnabled));}stroke(){this.strokeSegs(this.path.segs,this.flattened());}strokeSegs(t,e){let r=ot(this.state.strokeStyle,this.state.transform,this.state.imageSmoothingEnabled);if(!r)return;let o=dn(this.state.transform,this.state.lineWidth);if(o===null){let l=Dt(e,this.state.transform,this.strokeParams(),it);this.paintRings(l,"nonzero",r);return}let s=Rn(ft(t,it,Mn),this.state.transform,this.strokeParams()),i=this.state.lineCap==="square"?.5:this.state.lineCap==="round"?Math.PI/8:0,{width:a,height:c}=this.canvas,u=this.hairlinePlotter(r,o);for(let l of s){let m=l.pts.slice(),h=m.length>>1;if(h<2)continue;i&&!l.closed&&(Sn(m,0,1,i),Sn(m,h-1,h-2,i));let b=l.closed?h:h-1;for(let f=0;f<b;f++){let p=(f+1)%h;En(m[f*2],m[f*2+1],m[p*2],m[p*2+1],a,c,u);}}}hairlinePlotter(t,e){let{data:r,width:o,height:s}=this.canvas,i=this.state.clip,a=this.state.gco,c=this.state.globalAlpha*Math.min(1,e),u=this.px;return (l,m,h)=>{if(l<0||m<0||l>=o||m>=s)return;let b=h/255;if(i&&(b*=j(i,l,m)/255),b<=0)return;let f,p,M,x;if(t.solid)[f,p,M,x]=t.solid;else {if(!t.shade(l,m,u))return;[f,p,M,x]=u;}let E=c/255;st(r,(m*o+l)*4,f*E,p*E,M*E,x*E,b,a);}}rectRing(t,e,r,o){let s=this.state.transform,i=[[t,e],[t+r,e],[t+r,e+o],[t,e+o]],a=[];for(let[c,u]of i)a.push(s[0]*c+s[2]*u+s[4],s[1]*c+s[3]*u+s[5]);return a}fillRect(t,e,r,o){![t,e,r,o].every(Number.isFinite)||r===0||o===0||this.paintRings([this.rectRing(t,e,r,o)],"nonzero",ot(this.state.fillStyle,this.state.transform,this.state.imageSmoothingEnabled));}strokeRect(t,e,r,o){if(![t,e,r,o].every(Number.isFinite))return;let s=new nt;s.rect(this.state.transform,t,e,r,o),this.strokeSegs(s.segs,ft(s.segs,it));}clearRect(t,e,r,o){if(![t,e,r,o].every(Number.isFinite)||r===0||o===0)return;let s={gco:this.state.gco,ga:this.state.globalAlpha};this.state.gco="destination-out",this.state.globalAlpha=1,this.paintRings([this.rectRing(t,e,r,o)],"nonzero",{solid:[0,0,0,255]}),this.state.gco=s.gco,this.state.globalAlpha=s.ga;}clip(t="nonzero"){let e=this.surfaceBounds(),r=this.state.clip,o=this.flattened().filter(u=>u.pts.length>=6).map(u=>u.pts),s={box:{x0:0,y0:0,x1:0,y1:0},mask:null},i=o.length===1?de(o[0]):null;if(i){let u={x0:Math.max(e.x0,i.x0),y0:Math.max(e.y0,i.y0),x1:Math.min(e.x1,i.x1),y1:Math.min(e.y1,i.y1)};if(u.x1<=u.x0||u.y1<=u.y0){this.state.clip=s;return}let l=null;if(r?.mask){let m=u.x1-u.x0;l=new Uint8Array(m*(u.y1-u.y0));for(let h=u.y0;h<u.y1;h++)for(let b=u.x0;b<u.x1;b++)l[(h-u.y0)*m+(b-u.x0)]=j(r,b,h);}this.state.clip={box:u,mask:l};return}let a=s,c=null;for(let u of o)for(let l=0;l+1<u.length;l+=2){let m=u[l],h=u[l+1];c??(c={x0:1/0,y0:1/0,x1:-1/0,y1:-1/0}),c.x0=Math.min(c.x0,m),c.y0=Math.min(c.y0,h),c.x1=Math.max(c.x1,m),c.y1=Math.max(c.y1,h);}if(c&&Number.isFinite(c.x0+c.x1+c.y0+c.y1)){let u={x0:Math.max(e.x0,Math.floor(c.x0)),y0:Math.max(e.y0,Math.floor(c.y0)),x1:Math.min(e.x1,Math.ceil(c.x1)),y1:Math.min(e.y1,Math.ceil(c.y1))};if(u.x1>u.x0&&u.y1>u.y0){let l=u.x1-u.x0,m=new Uint8Array(l*(u.y1-u.y0));rt(o,t==="evenodd"?"evenodd":"nonzero",u,(b,f,p,M)=>{let x=(b-u.y0)*l-u.x0;if(!r?.mask){m.fill(M,x+f,x+p);return}for(let E=f;E<p;E++)m[x+E]=Math.round(M*j(r,E,b)/255);})&&(a={box:u,mask:m});}}this.state.clip=a;}clipCoverage(t,e,r,o){let s=this.state.clip;if(!s)return null;let i=new Uint8Array(Math.max(0,r*o));for(let a=0;a<o;a++)for(let c=0;c<r;c++)i[a*r+c]=j(s,t+c,e+a);return i}isPointInPath(t,e,r="nonzero"){if(!Number.isFinite(t)||!Number.isFinite(e))return false;let o=this.flattened(),s=`${e}`,i=this.rowCache;if(!i||i.key!==s){let u=[],l=[];for(let f of o){let p=f.pts,M=p.length>>1;if(!(M<2))for(let x=0;x<M;x++){let E=x+1<M?x+1:0,d=p[x*2],A=p[x*2+1],R=p[E*2],g=p[E*2+1];(A<=e?g>e:g<=e)&&(u.push(d+(e-A)*(R-d)/(g-A)),l.push(g>A?1:-1));}}let m=u.map((f,p)=>p).sort((f,p)=>u[f]-u[p]),h=new Float64Array(m.length),b=new Int32Array(m.length+1);for(let f=0;f<m.length;f++)h[f]=u[m[f]];for(let f=m.length-1;f>=0;f--)b[f]=b[f+1]+l[m[f]];i={key:s,xs:h,suffixWinding:b,count:m.length},this.rowCache=i;}let a=0,c=i.count;for(;a<c;){let u=a+c>>1;i.xs[u]>t?c=u:a=u+1;}return r==="evenodd"?(i.count-a&1)===1:i.suffixWinding[a]!==0}isPointInStroke(t,e){let r=Dt(this.flattened(),this.state.transform,this.strokeParams(),it);return Qt(r.map(o=>({pts:o,smooth:[],closed:true})),t,e,"nonzero")}createLinearGradient(t,e,r,o){return new H("linear",[t,e,r,o])}createRadialGradient(t,e,r,o,s,i){if(r<0||i<0)throw new RangeError("The radius provided is negative");return new H("radial",[t,e,r,o,s,i])}createPattern(t,e){let r=Bt(t);if(!r)return null;let o=e==="repeat-x"||e==="repeat-y"||e==="no-repeat"?e:"repeat";return new V(r.data.slice(),r.width,r.height,o)}measureText(t){let e=It(this.state.font).size,r=Ot(String(t),e);return {width:r,actualBoundingBoxLeft:0,actualBoundingBoxRight:r,actualBoundingBoxAscent:e*.8,actualBoundingBoxDescent:e*.2,fontBoundingBoxAscent:e*.9,fontBoundingBoxDescent:e*.25}}fillText(t,e,r,o){this.recordText(t,e,r,o,this.state.fillStyle);}strokeText(t,e,r,o){this.recordText(t,e,r,o,this.state.strokeStyle);}recordText(t,e,r,o,s){let i=String(t??"");if(!i.trim()||![e,r].every(Number.isFinite)||this.state.globalAlpha<=0)return;let a=ot(s,this.state.transform,true);if(!a||a.solid&&a.solid[3]<=0)return;this.canvas.textDraws++;let c=tn(i,e,r,this.state.font,this.state.textAlign,this.state.textBaseline,o),u=this.state.transform,l=[];for(let[m,h]of [[c.x0,c.y0],[c.x1,c.y0],[c.x1,c.y1],[c.x0,c.y1]])l.push(u[0]*m+u[2]*h+u[4],u[1]*m+u[3]*h+u[5]);this.canvas.markUnknown(l,this.state.clip);}drawImage(t,...e){let r=Bt(t);if(!r)return;(t===this.canvas||t===this)&&(r={...r,data:r.data.slice()});let o=0,s=0,i=r.width,a=r.height,c,u,l,m;if(e.length>=8?[o,s,i,a,c,u,l,m]=e:e.length>=4?[c,u,l,m]=e:([c,u]=e,l=i,m=a),![o,s,i,a,c,u,l,m].every(Number.isFinite)||!i||!a||!l||!m)return;i<0&&(o+=i,i=-i),a<0&&(s+=a,a=-a),l<0&&(c+=l,l=-l),m<0&&(u+=m,m=-m);let h=l/i,b=m/a,f=Math.max(0,o),p=Math.max(0,s),M=Math.min(r.width,o+i),x=Math.min(r.height,s+a);if(M<=f||x<=p)return;c+=(f-o)*h,u+=(p-s)*b,o=f,s=p,i=M-f,a=x-p;let E=[h,0,0,b,c-o*h,u-s*b],d=et(this.state.transform,E),A=wt({data:r.data,width:r.width,height:r.height,wrapX:false,wrapY:false,minX:Math.floor(o),minY:Math.floor(s),maxX:Math.ceil(o+i),maxY:Math.ceil(s+a),transparentOutside:false,smooth:this.state.imageSmoothingEnabled},d),R=d,g=[];for(let[S,y]of [[o,s],[o+i,s],[o+i,s+a],[o,s+a]])g.push(R[0]*S+R[2]*y+R[4],R[1]*S+R[3]*y+R[5]);this.paintRings([g],"nonzero",A);}createImageData(t,e){let r=Math.abs(Math.floor(t))||1,o=Math.abs(Math.floor(e))||1;return {data:new Uint8ClampedArray(r*o*4),width:r,height:o}}getImageData(t,e,r,o){let s=Math.floor(t),i=Math.floor(e),a=Math.floor(r),c=Math.floor(o);return a<0&&(s+=a,a=-a),c<0&&(i+=c,c=-c),{data:this.canvas.readRgba(s,i,a,c),width:a,height:c,colorSpace:"srgb"}}putImageData(t,e,r,o=0,s=0,i=t.width,a=t.height){let{width:c,height:u,data:l}=this.canvas,m=this.canvas.unknown,h=Math.round(e),b=Math.round(r);i<0&&(o+=i,i=-i),a<0&&(s+=a,a=-a);let f=Math.max(0,Math.floor(o)),p=Math.max(0,Math.floor(s)),M=Math.min(t.width,Math.floor(o+i)),x=Math.min(t.height,Math.floor(s+a)),E=t.data;for(let d=p;d<x;d++){let A=b+d;if(!(A<0||A>=u))for(let R=f;R<M;R++){let g=h+R;if(g<0||g>=c)continue;let S=(d*t.width+R)*4,y=(A*c+g)*4,P=E[S+3];if(P===255)l[y]=E[S],l[y+1]=E[S+1],l[y+2]=E[S+2];else {let T=P/255;l[y]=E[S]*T,l[y+1]=E[S+1]*T,l[y+2]=E[S+2]*T;}l[y+3]=P,m&&(m[A*c+g]=0);}}}};function yn(n,t,e,r,o,s,i,a,c,u){let l=0,m=o-1,h=t,b=t+e;for(;h+1<b&&m>=0;){let f=n.getUint8(h),p=n.getUint8(h+1);if(h+=2,f===0)if(p===0)l=0,m--;else {if(p===1)break;if(p===2){if(h+1>=b)break;l+=n.getUint8(h),m-=n.getUint8(h+1),h+=2;}else {let M=p;if(i){let x=Math.ceil(M/2),E=0;for(let d=0;d<x&&h<b;d++){let A=n.getUint8(h++);for(let R=0;R<2&&E<M;R++){let g=R===0?A>>4&15:A&15;g<a.length&&l<r&&u(l,o-1-m,a[g][0],a[g][1],a[g][2],255),l++,E++;}}x&1&&h++;}else {for(let x=0;x<M&&h<b&&l<r;x++){let E=n.getUint8(h++);E<a.length&&u(l,o-1-m,a[E][0],a[E][1],a[E][2],255),l++;}M&1&&h++;}}}else if(i){let M=p>>4&15,x=p&15;for(let E=0;E<f&&l<r;E++){let d=(E&1)===0?M:x;d<a.length&&u(l,o-1-m,a[d][0],a[d][1],a[d][2],255),l++;}}else {let M=p,x=M<a.length?a[M]:[0,0,0];for(let E=0;E<f&&l<r;E++)u(l,o-1-m,x[0],x[1],x[2],255),l++;}}return ct(new Uint8ClampedArray(c.buffer,c.byteOffset,c.byteLength),r,o)}function Gt(n){if(n===0)return 0;let t=0,e=n;for(;(e&1)===0;)e>>>=1,t++;return t}var Me=3;function An(n,t,e,r,o){let s=0,i=0,a=0,c=0,u=0,l=0,m=1,h=1,b=1;if(r===Me){let f=t+e;if(f+12>n.byteLength)return null;s=n.getUint32(f,true),i=n.getUint32(f+4,true),a=n.getUint32(f+8,true),c=Gt(s),u=Gt(i),l=Gt(a),m=s>>>c||1,h=i>>>u||1,b=a>>>l||1;}else o===16&&(s=31744,i=992,a=31,c=10,u=5,l=0,m=31,h=31,b=31);return {rMask:s,gMask:i,bMask:a,rShift:c,gShift:u,bShift:l,rMax:m,gMax:h,bMax:b}}function Pn(n,t,e,r,o,s,i,a,c,u=false){let l=Math.floor((s*e+31)/32)*4,{rMask:m,gMask:h,bMask:b,rShift:f,gShift:p,bShift:M,rMax:x,gMax:E,bMax:d}=a;for(let A=0;A<r;A++){let R=o?A:r-1-A,g=t+R*l;if(!(g+l>n.byteLength))for(let S=0;S<e;S++){let y=(A*e+S)*4;if(s===1){let P=g+(S>>3),T=n.getUint8(P)>>7-(S&7)&1;T<i.length&&(c[y]=i[T][0],c[y+1]=i[T][1],c[y+2]=i[T][2]),c[y+3]=255;}else if(s===4){let P=g+(S>>1),T=(S&1)===0?n.getUint8(P)>>4&15:n.getUint8(P)&15;T<i.length&&(c[y]=i[T][0],c[y+1]=i[T][1],c[y+2]=i[T][2]),c[y+3]=255;}else if(s===8){let P=n.getUint8(g+S);P<i.length&&(c[y]=i[P][0],c[y+1]=i[P][1],c[y+2]=i[P][2]),c[y+3]=255;}else if(s===16){let P=n.getUint16(g+S*2,true);c[y]=Math.round(((P&m)>>>f)*255/x),c[y+1]=Math.round(((P&h)>>>p)*255/E),c[y+2]=Math.round(((P&b)>>>M)*255/d),c[y+3]=255;}else if(s===24){let P=g+S*3;c[y]=n.getUint8(P+2),c[y+1]=n.getUint8(P+1),c[y+2]=n.getUint8(P),c[y+3]=255;}else {let P=g+S*4,T=n.getUint8(P),C=n.getUint8(P+1),L=n.getUint8(P+2),_=n.getUint8(P+3);c[y]=L,c[y+1]=C,c[y+2]=T,c[y+3]=_===0&&!u?255:_;}}}}function Et(n,t,e,r,o,s=false){if(t<0||e<0||t+40>n.byteLength||e+r>n.byteLength)return null;let i=n.getUint32(t,true);if(i<40||t+i>n.byteLength)return null;let a=n.getInt32(t+4,true),c=n.getInt32(t+8,true),u=n.getUint16(t+12,true),l=n.getUint16(t+14,true),m=n.getUint32(t+16,true);if(u!==1||a<=0||c===0||a>8192||Math.abs(c)>8192)return null;let h=0,b=1,f=2,p=3;if(l!==1&&l!==4&&l!==8&&l!==16&&l!==24&&l!==32||m===b&&l!==8||m===f&&l!==4||m===p&&l!==16&&l!==32||m!==h&&m!==b&&m!==f&&m!==p)return null;let M=Math.abs(c),x=c<0,E=[];if(l<=8){let R=1<<l,g=n.getUint32(t+32,true)||R,S=Math.min(g,R),y=t+i,P=!!o&&o.length>0;if(y+S*(P?2:4)>n.byteLength)return null;for(let T=0;T<S;T++){if(P){let w=n.getUint16(y+T*2,true),I=o[w<o.length?w:0];E.push([I>>16&255,I>>8&255,I&255]);continue}let C=n.getUint8(y+T*4),L=n.getUint8(y+T*4+1),_=n.getUint8(y+T*4+2);E.push([_,L,C]);}}let d=An(n,t,i,m,l);if(!d)return null;let A=new Uint8ClampedArray(a*M*4);return m===b||m===f?yn(n,e,r,a,M,x,m===f,E,A,(g,S,y,P,T,C)=>{let L=(S*a+g)*4;A[L]=y,A[L+1]=P,A[L+2]=T,A[L+3]=C;}):(Pn(n,e,a,M,x,l,E,d,A,s),ct(A,a,M))}var Cn=[[0,0,0,255,0,0,0,0],[8,8,8,8,8,8,8,8],[128,64,32,16,8,4,2,1],[1,2,4,8,16,32,64,128],[8,8,8,255,8,8,8,8],[129,66,36,24,24,36,66,129]];function Ee(n,t,e){return ((Cn[n]??Cn[0])[e&7]>>7-(t&7)&1)===1}function gt(n){let t=/^#([0-9a-f]{6}|[0-9a-f]{3})$/i.exec(n.trim());if(!t)return 0;let e=t[1].length===3?t[1].replace(/./g,r=>r+r):t[1];return parseInt(e,16)}function ge(n,t,e){if(t+16>n.byteLength)return null;let r=n.getInt32(t+4,true),o=n.getInt32(t+8,true),s=n.getUint16(t+14,true),i=Math.abs(o);if(s!==1||r<=0||i===0||r>256||i>256)return null;let a=(r+31>>5)*4;if(e+a*i>n.byteLength)return null;let c=new Uint8Array(r*i);for(let u=0;u<i;u++){let l=o>0?i-1-u:u,m=e+u*a;for(let h=0;h<r;h++)c[l*r+h]=n.getUint8(m+(h>>3))>>7-(h&7)&1;}return {width:r,height:i,bits:c}}function Dr(n,t,e,r,o=null){if(e+24>n.byteLength)return null;let s=n.getUint32(e+8,true),i=n.getUint32(e+16,true),a=n.getUint32(e+20,true),c=t+s,u=t+i,l=c+16<=n.byteLength?n.getUint16(c+14,true):0;if(r||l===1){let f=ge(n,c,u);if(f&&r)return {kind:"mono",...f}}let m=Et(n,c,u,a,o);if(!m)return null;let h=new Uint32Array(m.width*m.height),b=m.data;for(let f=0;f<h.length;f++)h[f]=b[f*4]<<16|b[f*4+1]<<8|b[f*4+2];return {kind:"bitmap",width:m.width,height:m.height,rgb:h}}function Ln(n){if(n.brushStyle===1)return {kind:"none"};let t=n.brushPattern;if(!t)return {kind:"solid",rgb:gt(n.brushColor)};if(t.kind==="bitmap")return {kind:"tile",width:t.width,height:t.height,rgb:t.rgb};let e=gt(n.bkColor);if(t.kind==="hatch"){let s=gt(n.brushColor),i=new Uint32Array(64);for(let a=0;a<8;a++)for(let c=0;c<8;c++)i[a*8+c]=Ee(t.hatch,c,a)?s:e;return {kind:"tile",width:8,height:8,rgb:i}}let r=gt(n.textColor),o=new Uint32Array(t.width*t.height);for(let s=0;s<o.length;s++)o[s]=t.bits[s]?e:r;return {kind:"tile",width:t.width,height:t.height,rgb:o}}function kr(n,t,e,r,o){let s=((t-r)%n.width+n.width)%n.width,i=((e-o)%n.height+n.height)%n.height;return n.rgb[i*n.width+s]}function Gr(n){let t=[],e=0;for(let r=0;r<n.length;r++)t.push(e),e+=n[r];return t}function Xr(n){let t=0;for(let e of n)t+=e;return t}function $r(n,t,e,r){let o=n.slice();if(e===0||r<=0)return o;let s=0;for(let i=0;i<o.length&&i<t.length;i++){if(t[i]!==32)continue;let a=Math.round(s*e/r);s++;let c=Math.round(s*e/r);o[i]+=c-a;}return o}function Wr(n,t){return t==="center"?-n/2:t==="right"?-n:0}var Te=Math.PI/180;function Yr(n){let e=(n%3600+3600)%3600*Xt/3600,r=Math.floor(e),o=e-r,s=r*2*Math.PI/Xt,i=(r+1)*2*Math.PI/Xt;return o===0?{sin:Math.sin(s),cos:Math.cos(s)}:{sin:(1-o)*Math.sin(s)+o*Math.sin(i),cos:(1-o)*Math.cos(s)+o*Math.cos(i)}}var Xt=128;function Hr(n){return -(n/10)*Te}var Re=1.15;function _n(n){return n===0?0:n<0?-n:n/Re}var ut=(...n)=>{},q=(...n)=>{};var In=true;async function On(n){try{if(n[0]===255&&n[1]===216){let{decodeJpegPixels:t}=await import('./jpeg-decoder-TQ6AAYSY.mjs'),e=await t(n);return a$2(e.width,e.height)?{...e,data:new Uint8ClampedArray(e.data)}:null}if(n.length>=20&&n[0]===82&&n[1]===73&&n[2]===70&&n[3]===70&&n[8]===87&&n[9]===69&&n[10]===66&&n[11]===80){let{decodeWebp:t}=await import('./webp-decoder-DBVS75GU.mjs');return t(n)}if(n.length>=13&&/^GIF8[79]a$/.test(String.fromCharCode(...n.subarray(0,6)))){let{decodeGif:t}=await import('./gif-decoder-I2CNJCRR.mjs');return t(n)}if(n.length>=8&&(n[0]===73&&n[1]===73&&n[2]===42&&n[3]===0||n[0]===77&&n[1]===77&&n[2]===0&&n[3]===42)){let{decodeTiff:t}=await import('./tiff-decoder-VCS2FIXG.mjs');return await t(n)}}catch{return null}return null}async function vn(){return import('@napi-rs/canvas')}var Yt=class{constructor(){this.data=new Int32Array(96);this.length=0;}add(t,e,r){if(r<=e)return;let o=this.length*3;if(o>0&&this.data[o-3]===t&&this.data[o-1]===e){this.data[o-1]=r;return}if(o+3>this.data.length){let s=new Int32Array(this.data.length*2);s.set(this.data),this.data=s;}this.data[o]=t,this.data[o+1]=e,this.data[o+2]=r,this.length++;}append(t){for(let e=0;e<t.length*3;e+=3)this.add(t.data[e],t.data[e+1],t.data[e+2]);}bounds(){if(this.length===0)return null;let t=1/0,e=1/0,r=-1/0,o=-1/0,s=this.data;for(let i=0;i<this.length*3;i+=3)s[i]<e&&(e=s[i]),s[i]+1>o&&(o=s[i]+1),s[i+1]<t&&(t=s[i+1]),s[i+2]>r&&(r=s[i+2]);return {x0:t,y0:e,x1:r,y1:o}}};function wn(n,t){return Math.floor(n/t)}function lt(n,t){return -Math.floor(-n/t)}function Se(n,t,e=new Yt,r=-1/0,o=1/0){let s=[],i=1/0,a=-1/0;for(let f of n){let p=f.length>>1;if(!(p<2))for(let M=0;M<p;M++){let x=M+1===p?0:M+1,E=f[M*2],d=f[M*2+1],A=f[x*2],R=f[x*2+1];if(d===R)continue;let g=R>d?1:-1,S=g>0?E:A,y=g>0?d:R,P=g>0?A:E,T=g>0?R:d,C=lt(y,16),L=lt(T,16);L<=C||(s.push([C,L,S,y,P-S,T-y,g]),C<i&&(i=C),L>a&&(a=L));}}if(s.length===0)return e;s.sort((f,p)=>f[0]-p[0]);let c=Math.max(i,Math.ceil(r)),u=Math.min(a,Math.floor(o)),l=[],m=0,h=[],b=[];for(;m<s.length&&s[m][1]<=c;)m++;for(let f=c;f<u;f++){for(;m<s.length&&s[m][0]<=f;)s[m][1]>f&&l.push(s[m]),m++;for(let x=l.length-1;x>=0;x--)(l[x][1]<=f||l[x][0]>f)&&l[x][1]<=f&&l.splice(x,1);h.length=0,b.length=0;let p=f*16;for(let x of l){if(x[0]>f)continue;let E=x[2]*x[5]+(p-x[3])*x[4];h.push(lt(E,x[5]*16)),b.push(x[6]);}let M=h.length;if(!(M<2)){for(let x=1;x<M;x++){let E=h[x],d=b[x],A=x-1;for(;A>=0&&h[A]>E;)h[A+1]=h[A],b[A+1]=b[A],A--;h[A+1]=E,b[A+1]=d;}if(t){let x=0,E=0;for(let d=0;d<M;d++){let A=x;x+=b[d],A===0&&x!==0?E=h[d]:A!==0&&x===0&&e.add(f,E,h[d]);}}else for(let x=0;x+1<M;x+=2)e.add(f,h[x],h[x+1]);}}return e}function ye(n,t){return Math.abs(n)!==Math.abs(t)?10:t>0?2:n>0?136:68}function Nn(n,t,e,r){let o=Math.abs(n)+Math.abs(t),s=8*e;if(o<s)return true;if(o>s)return false;let i;return n===0?i=t<0?1:2:t===0?i=n<0?4:8:n<0?i=t<0?16:64:i=t<0?32:128,(r&i)!==0}function Fn(n,t,e,r,o){let s=e-n,i=r-t;if(s===0&&i===0)return;let a=ye(s,i),c=Math.abs(s)>=Math.abs(i),u=c?n:t,l=c?t:n,m=c?e:r,h=c?r:e,b=m>u?1:-1,f=Math.abs(m-u),p=(h-l)*b,M=Math.abs(s)===Math.abs(i),x=Math.min(u,m),E=Math.max(u,m),d=(g,S,y)=>c?Nn(g,S,y,a):Nn(S,g,y,a),A=b>0?wn(x,16)-1:lt(E,16)+1,R=b>0?lt(E,16)+1:wn(x,16)-1;for(let g=A;b>0?g<=R:g>=R;g+=b){let S=g*16,y=l*f+(S-u)*p,P=y/f/16,T=Math.round(P);for(let C=T-1;C<=T+1;C++){let L=C*16,_=y-L*f,w=x-S,I=E-S,D;if(M){let N=p/f,X=_/f,B=Math.max(w,Math.min(0,I)),k=Math.max(w,Math.min(-X/N,I));D=d(2*B,2*(X+N*B),2)||d(2*k,2*(X+N*k),2)||d(B+k,2*X+N*(B+k),2);}else {let N=Math.max(w,Math.min(0,I));D=d(N*f,_+N*p,f);}D&&(d(m-S,h-L,1)||(c?o(g,C):o(C,g)));}}}var Un=10,$t=3,Bn=6*10912,Ae=Bn*8;function $(n,t){return Math.floor(n/2**t)}var yt=class{constructor(t,e,r,o){let s=2**Un;this.e0=t*s,this.e1=(o-t)*s,this.e2=6*(e-r-r+o)*s,this.e3=6*(t-e-e+r)*s;}lazyHalve(t){this.e2=$(this.e2+this.e3,1),this.e1=$(this.e1-$(this.e2,t),1);}steadyState(t){let e=2**$t;this.e0*=e,this.e1*=e;let r=t-$t;r<0?(this.e2*=2**-r,this.e3*=2**-r):(this.e2=$(this.e2,r),this.e3=$(this.e3,r));}halve(){this.e2=$(this.e2+this.e3,3),this.e1=$(this.e1-this.e2,1),this.e3=$(this.e3,2);}double(){this.e1+=this.e1+this.e2,this.e3*=4,this.e2=this.e2*8-this.e3;}step(){this.e0+=this.e1;let t=this.e2;this.e1+=t,this.e2+=t-this.e3,this.e3=t;}error(){return Math.max(Math.abs(this.e2),Math.abs(this.e3))}parentErrorDividedBy4(){return Math.max(Math.abs(this.e3),Math.abs(this.e2+this.e2-this.e3))}value(){let t=Un+$t;return $(this.e0+2**(t-1),t)}};function Gn(n,t,e,r,o,s,i,a,c,u=1){let l=Bn*u,m=Ae*u,h=new yt(n,e,o,i),b=new yt(t,r,s,a),f=1,p=0;for(;p<40&&(h.error()>l*2**p||b.error()>l*2**p);)p+=2,h.lazyHalve(p),b.lazyHalve(p),f*=2;h.steadyState(p),b.steadyState(p);for(let M=0;f>0&&M<1<<20;M++){for(Math.max(h.error(),b.error())>m&&(h.halve(),b.halve(),f*=2);f%2===0&&h.parentErrorDividedBy4()<=m/4&&b.parentErrorDividedBy4()<=m/4;)h.double(),b.double(),f/=2;f--,h.step(),b.step(),c.push(h.value(),b.value());}}var W=.5522847498307936;function At(n,t,e,r){return {ax:n,ay:t,exx:e-n,exy:0,eyx:0,eyy:r-t}}function Ht(n,t=false){if(!t)return $n(n,false);let{halfX:e,...r}=n,o=Xn(r),s=[];for(let a=o.length-2;a>=0;a-=2)s.push(o[a],o[a+1]);let i=Math.abs(r.exx)%2;if(s[18]+=i,s[6]-=i,e)for(let a of [0,1,2,3,4,5,12])s[2*a]++;return s}function Xn(n){return $n(n,true)}function $n(n,t){let e=(T,C)=>C?Math.ceil(T/2):Math.floor(T/2),r=T=>e(T,false),o=T=>e(T,true),s=T=>Math.floor(T/2)+Math.ceil(W*Math.ceil(T/2)),i=T=>Math.ceil(T/2)-Math.ceil(W*Math.ceil(T/2)),a=T=>e(T,false),c=T=>e(T,true),u=T=>Math.floor(T/2)-Math.floor(W*Math.floor(T/2)),l=T=>T-u(T),m=T=>T%2===0?Math.ceil(W*Math.floor(T/2)):Math.floor(W*Math.ceil(T/2)),h=t?T=>a(T)-m(T):u,b=t?T=>a(T)-m(T):u,f=t?T=>c(T)+m(T):l,p=t?T=>c(T)+m(T):l,M=()=>0,x=T=>T,{ax:E,ay:d,exx:A,exy:R,eyx:g,eyy:S}=n,y=[],P=(T,C)=>{y.push(E+T(A)+C(g),d+T(R)+C(S));};if(P(x,c),P(x,h),P(s,M),P(r,M),P(i,M),P(M,b),P(M,a),P(M,f),P(i,x),P(o,x),P(s,x),P(x,p),P(x,c),n.halfX)for(let T of [0,1,2,3,4,5,12])y[2*T]++;return y}function Pe(n,t,e,r){return Ht(At(n,t,e,r))}function Zr(n){let t=[n[0],n[1]];for(let e=2;e+5<n.length;e+=6)Gn(n[e-2],n[e-1],n[e],n[e+1],n[e+2],n[e+3],n[e+4],n[e+5],t);return t}function Qr(n,t,e,r,o,s,i=false,a=false,c=false,u){let l=e-n,m=r-t;if(u){let g=(y,P)=>Math.floor(Math.fround(y*P)+.5),S=c?Math.floor(l/2):Math.ceil(l/2);o=2*Math.min(g(S,u[0]),S),s=2*Math.min(g(a?Math.ceil(m/2):Math.floor(m/2),u[1]),a?Math.ceil(m/2):Math.floor(m/2));}let h=Math.min(Math.abs(o),l),b=Math.min(Math.abs(s),m);(h===0||b===0)&&(h=0,b=0);let f=i||a?Math.round(b/2):Math.floor(m/2)-Math.floor((m-b)/2),p=i?Math.round(e-h/2):Math.floor(e-h/2),M=e-p,x=a?Math.ceil(W*f):Math.floor(W*f),E=c?Math.floor(W*M):Math.ceil(W*M),d=[e,t+f,e,t+f-x,e-M+E,t,p,t],A=g=>n+e-g,R=g=>t+r-g;return [d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],A(d[6]),d[7],A(d[4]),d[5],A(d[2]),d[3],A(d[0]),d[1],A(d[0]),R(d[1]),A(d[2]),R(d[3]),A(d[4]),R(d[5]),A(d[6]),R(d[7]),d[6],R(d[7]),d[4],R(d[5]),d[2],R(d[3]),d[0],R(d[1])]}var zt=2*Math.PI/128,Tt=n=>J(n)[0],Rt=n=>J(n)[1];function Ce(n,t){let e=[],r=(a,c)=>{if(Math.abs(c-a)<90){e.push({from:a,to:c,first:true});return}let u=Math.min(a,c),l=Math.max(a,c),m=Math.floor(l/90)-Math.floor(u/90)+1,h=[];for(let f=Math.floor(u/90)+1;f*90<l;f++)h.push(f*90);c<a&&h.reverse();let b=[a,...h,c];for(;b.length-1<m;)b.push(c);for(let f=0;f+1<b.length;f++)e.push({from:b[f],to:b[f+1],first:f===0});},o=t<0?-1:1,s=Math.min(8,Math.trunc(Math.abs(t)/360)),i=n+t-o*s*360;r(n,i);for(let a=1;a<=s;a++)r(i+o*360*(a-1),n+o*360*a),r(n+o*360*a,i+o*360*a);return e}function to(n,t,e,r,o,s){let i=o*Math.PI/180,a=s*Math.PI/180,c=4/3*Math.tan((a-i)/4),u=n+e*Tt(i),l=t-r*Rt(i),m=n+e*Tt(a),h=t-r*Rt(a);return [u-c*e*Rt(i),l-c*r*Tt(i),m+c*e*Rt(a),h+c*r*Tt(a),m,h]}function no(n,t,e){let r=Math.min(n.ax,n.ax+n.exx),o=Math.min(n.ay,n.ay+n.eyy),s=Math.abs(n.exx),i=Math.abs(n.eyy),a=r+s/2,c=o+i/2,u=Pe(r,o,r+s,o+i),l=Xn(At(r,o,r+s,o+i)),m=t*Math.PI/180,h=Math.abs(e)<=3?[Math.cos(m),Math.sin(m)]:J(m),b=[Math.round(a+s/2*h[0]),Math.round(c-i/2*h[1])];for(let f of Ce(t,e)){let p=f.to-f.from;if(!f.first&&Math.abs(p)===90&&f.from%90===0){let E=(Math.min(f.from,f.to)/90%4+4)%4*6;p>0?b.push(u[E+2],u[E+3],u[E+4],u[E+5],u[E+6],u[E+7]):b.push(l[E+4],l[E+5],l[E+2],l[E+3],l[E],l[E+1]);continue}let M=Wn(f.from*Math.PI/180,f.to*Math.PI/180,Math.abs(e)<=3);for(let x=0;x<6;x+=2)b.push(Math.round(a+s/2*M.ctrl[x]),Math.round(c-i/2*M.ctrl[x+1]));}return b}var Le=3*Math.PI/180,St=(()=>{let n=[],t=[];for(let e=0;e<=129;e++)n.push(Math.fround(Math.cos(e*zt))),t.push(Math.fround(Math.sin(e*zt)));for(let e=0;e<=128;e+=32)n[e]=[1,0,-1,0,1][e/32],t[e]=[0,1,0,-1,0][e/32];return {cos:n,sin:t}})();function J(n){let t=n%(2*Math.PI);t<0&&(t+=2*Math.PI);let e=Math.fround(t/zt),r=Math.min(127,Math.floor(e)),o=e-r;return [St.cos[r]*(1-o)+St.cos[r+1]*o,St.sin[r]*(1-o)+St.sin[r+1]*o]}var Wt=Array.from({length:33},(n,t)=>Math.atan(t/32));function Dn(n){let t=n*32,e=Math.min(31,Math.floor(t));return Wt[e]+(Wt[e+1]-Wt[e])*(t-e)}function _e(n,t){let e=Math.abs(n),r=Math.abs(t);if(e===0&&r===0)return 0;let o=r<=e?Dn(Math.fround(r/e)):Math.PI/2-Dn(Math.fround(e/r));return n>=0?t>=0?o:2*Math.PI-o:t>=0?Math.PI-o:Math.PI+o}function Wn(n,t,e,r=1/0){let o=e?u=>[Math.cos(u),Math.sin(u)]:J,s=o(n),i=o(t);if(e&&6e-8*r/Math.abs(Math.sin(t-n))>.5){let u=Math.fround,l=[u(s[0]),u(s[1])],m=[u(i[0]),u(i[1])],h=u(u(l[0]*m[1])-u(l[1]*m[0]));if(h!==0){let b=[u(u(m[1]-l[1])/h),u(u(l[0]-m[0])/h)],f=u(J(Math.abs(t-n)/2)[0]),p=u(u(u(4/3)*f)/u(1+f));return {start:s,ctrl:[u(l[0]+u(p*u(b[0]-l[0]))),u(l[1]+u(p*u(b[1]-l[1]))),u(m[0]+u(p*u(b[0]-m[0]))),u(m[1]+u(p*u(b[1]-m[1]))),i[0],i[1]]}}}let a=s[0]*i[1]-s[1]*i[0],c;if(Math.abs(a)<1e-12)c=[s[0],s[1],i[0],i[1],i[0],i[1]];else {let u=[(i[1]-s[1])/a,(s[0]-i[0])/a],l=J(Math.abs(t-n)/2)[0],m=4/3*l/(1+l);c=[s[0]+m*(u[0]-s[0]),s[1]+m*(u[1]-s[1]),i[0]+m*(u[0]-i[0]),i[1]+m*(u[1]-i[1]),i[0],i[1]];}return {start:s,ctrl:c}}function eo(n,t,e,r,o,s,i,a,c,u=false,l=false,m=false){let h=e-n,b=r-t,f=Math.PI/2,p=Math.ceil(h/2),M=c?Math.ceil(b/2):Math.floor(b/2),x=n+Math.ceil(h/2),E=t+Math.ceil(b/2),d=(n+e)/2,A=(t+r)/2,R=(O,v)=>_e((O-d)/(h/2||1),-(v-A)/(b/2||1)),g=R(o,s),S=R(i,a),y=O=>c?(2*Math.PI-O)%(2*Math.PI):O,P=S!==g&&Math.abs(y(S)-y(g))<=Le,T=c?-1:1;if(T>0)for(;S<=g;)S+=2*Math.PI;else for(;S>=g;)S-=2*Math.PI;let C=(O,v)=>Math.fround(O*Math.fround(v)),L=(O,v)=>m?Math.round(x-C(Math.floor(h/2),O)):c&&u?Math.ceil(x+C(p,O)+.5-v):Math.round(x+C(p,O)+(u?1+v:0)),_=O=>Math.round(E-C(M,O)),w=m?At(e,t,n,r):At(n,t,e,r);u&&(w.halfX=true);let I=Ht(w);if(c){let O=Ht(w,true);for(let v=0;v<O.length;v+=2)I[O.length-2-v]=O[v],I[O.length-1-v]=O[v+1];}let D=P?[Math.cos(g),Math.sin(g)]:J(g),N=[L(D[0],D[1]),_(D[1])],X=O=>Math.abs(O/f-Math.round(O/f))<1e-9,B=O=>(Math.round(O/f)%4+4)%4;l&&X(g)&&(T>0?B(g)===1||B(g)===2:B(g)===2||B(g)===3)&&N.push(N[0],N[1],N[0],N[1],N[0],N[1]);let k=g;for(let O=0;O<8&&(T>0?k<S-1e-12:k>S+1e-12);O++){let v=T>0?Math.floor(k/f+1e-9)*f+f:Math.ceil(k/f-1e-9)*f-f,tt=Math.abs(k/f-Math.round(k/f))<1e-9,re=T>0?v>=S-1e-12:v<=S+1e-12,mt=(Math.round(k/f)%4+4)%4,ht=(Math.round(v/f)%4+4)%4;if(!(O===0&&(T>0?mt===0||mt===3:mt===0||mt===1)||re&&(T>0?ht===1||ht===2:ht===2||ht===3))&&tt&&(T>0?v<=S+1e-12:v>=S-1e-12)){let F=(Math.round(Math.min(k,v)/f)%4+4)%4*6;T>0?N.push(I[F+2],I[F+3],I[F+4],I[F+5],I[F+6],I[F+7]):N.push(I[F+4],I[F+5],I[F+2],I[F+3],I[F],I[F+1]),k=v;continue}let Vt=T>0?Math.min(v,S):Math.max(v,S),Lt=Wn(k,Vt,P,Math.max(p,M));for(let F=0;F<6;F+=2)N.push(L(Lt.ctrl[F],Lt.ctrl[F+1]),_(Lt.ctrl[F+1]));k=Vt;}if(l&&X(S)&&(T>0?B(S)===3||B(S)===0:B(S)===1||B(S)===0)){let O=J(S),v=L(O[0],O[1]),tt=_(O[1]);N.push(v,tt,v,tt,v,tt);}return N}var kn=class{constructor(){this.figures=[];this.getPath={pts:[],types:[]};this.current=null;}moveTo(t,e){this.current={pts:[t,e],closed:false},this.figures.push(this.current),this.log(t,e,6);}continueAt(t,e){let r=this.current;r&&r.pts[r.pts.length-2]===t&&r.pts[r.pts.length-1]===e||this.moveTo(t,e);}hasOpenFigure(){return this.current!==null}log(t,e,r){this.getPath.pts.push(t,e),this.getPath.types.push(r);}lineTo(t,e){if(!this.current){let r=this.lastPoint();this.moveTo(r?r[0]:t,r?r[1]:e);}this.current.pts.push(t,e),this.log(t,e,2);}bezierTo(t,e,r,o,s,i){if(!this.current){let c=this.lastPoint();this.moveTo(c?c[0]:t,c?c[1]:e);}let a=this.current.pts;this.flattenInto(a[a.length-2],a[a.length-1],t,e,r,o,s,i),this.log(t,e,4),this.log(r,o,4),this.log(s,i,4);}flattenInto(t,e,r,o,s,i,a,c){let u=this.current,l=u.pts.length/2-1;Gn(t,e,r,o,s,i,a,c,u.pts);let m=u.pts.length/2-2;if(m<=l){if(m===l){let p=u.pts.length;u.tangents??(u.tangents=new Map),u.tangentRoles??(u.tangentRoles=new Map),u.tangents.set(l,[u.pts[p-2]-u.pts[p-4],u.pts[p-1]-u.pts[p-3]]),u.tangentRoles.set(l,3);}return}let h=(p,M,x,E,d,A,R,g)=>x!==p||E!==M?[x-p,E-M]:d!==p||A!==M?[d-p,A-M]:R!==p||g!==M?[R-p,g-M]:null,b=h(t,e,r,o,s,i,a,c),f=h(s,i,a,c,a,c,a,c)??h(r,o,a,c,a,c,a,c)??h(t,e,a,c,a,c,a,c);u.curveSegs??(u.curveSegs=new Set);for(let p=l;p<=m;p++)u.curveSegs.add(p);u.tangents??(u.tangents=new Map),u.tangentRoles??(u.tangentRoles=new Map),b&&(u.tangents.set(l,b),u.tangentRoles.set(l,1)),f&&(u.tangents.set(m,f),u.tangentRoles.set(m,2));}addBeziers(t,e){e?this.moveTo(t[0],t[1]):this.lineTo(t[0],t[1]);for(let r=2;r+5<t.length;r+=6){this.flattenInto(t[r-2],t[r-1],t[r],t[r+1],t[r+2],t[r+3],t[r+4],t[r+5]);for(let o=r;o<r+6;o+=2)this.log(t[o],t[o+1],4);}}closeFigure(){if(this.current){this.current.closed=true,this.current=null;let t=this.getPath.types;t[t.length-1]|=1;}}append(t){for(let e of t.figures)this.figures.push({pts:e.pts.slice(),closed:e.closed,tangents:e.tangents&&new Map(e.tangents),tangentRoles:e.tangentRoles&&new Map(e.tangentRoles),curveSegs:e.curveSegs&&new Set(e.curveSegs),roundWiden:e.roundWiden});for(let e=0;e<t.getPath.types.length;e++)this.log(t.getPath.pts[2*e],t.getPath.pts[2*e+1],t.getPath.types[e]);this.current=null;}lastPoint(){let t=this.figures[this.figures.length-1];return t?t.closed?[t.pts[0],t.pts[1]]:[t.pts[t.pts.length-2],t.pts[t.pts.length-1]]:null}};function ro(n,t,e){return Se(n.figures.map(r=>r.pts),t,e)}function Yn(n,t){switch(n&15){case 1:return [18,6];case 2:return [3,3];case 3:return [9,6,3,6];case 4:return [9,3,3,3,3,3];case 7:return t&&t.length>0&&t.some(e=>e>0)?t.map(e=>Math.max(0,e)*3):null;case 8:return [1,1];default:return null}}function oo(n,t,e,r=1){let o=Math.max(t,1);switch(n&15){case 1:return [3*o,o];case 2:return [o,o];case 3:return [3*o,o,o,o];case 4:return [3*o,o,o,o,o,o];case 7:return e&&e.some(s=>s>0)?e.map(s=>Math.max(0,s)*r):null;default:return null}}function so(n){let t=n&15;return t>=1&&t<=4}function io(n,t,e,r,o={pos:0},s=true){let i=0;if(r)for(let c of r)i+=c;let a=(c,u)=>{if(!r||i===0){t.add(u,c,c+1);return}let l=o.pos%i;o.pos++;for(let m=0;m<r.length;m++){if(l<r[m]){m%2===0?t.add(u,c,c+1):e&&e.add(u,c,c+1);return}l-=r[m];}};n.figures.forEach((c,u)=>{u>0&&s&&(o.pos=0);let l=c.pts;for(let m=0;m+3<l.length;m+=2)Fn(l[m],l[m+1],l[m+2],l[m+3],a);if(c.closed&&l.length>=4){let m=l.length;(l[m-2]!==l[0]||l[m-1]!==l[1])&&Fn(l[m-2],l[m-1],l[0],l[1],a);}});}var U;async function To(){if(U!==void 0)return U;if(typeof OffscreenCanvas<"u"||typeof document<"u"||typeof process>"u"||!process.versions?.node)return U=null,U;try{U=await vn();}catch{U=null;}return U}var zn=false;function Jn(){return typeof OffscreenCanvas>"u"&&typeof document>"u"&&!U}var Vn=1;function He(n,t,e,r,o=Vn,s=8192){let i=Math.max(1,Math.min(o,4)),a=Math.round(n*i),c=Math.round(t*i),u=i,l=i;if(e&&a>e){let f=e/a;a=e,c=Math.round(c*f),u*=f,l*=f;}if(r&&c>r){let f=r/c;a=Math.round(a*f),c=r,u*=f,l*=f;}let m=Math.max(1,Math.floor(s)),h=Math.max(1,Math.min(a,m)),b=Math.max(1,Math.min(c,m));return (h!==a||b!==c)&&console.warn(`[emf-converter] Canvas size clamped from ${a}\xD7${c} to ${h}\xD7${b}. Output may lose detail.`),{w:h,h:b,scaleX:u,scaleY:l}}var Ct={willReadFrequently:true};function Ro(n,t,e,r,o=Vn,s=8192){let{w:i,h:a,scaleX:c,scaleY:u}=He(n,t,e,r,o,s);try{if(Jn()){ut(`createCanvas: using the software rasteriser ${i}\xD7${a}`);let l=new z(i,a);return {canvas:l,ctx:l.ctx,scaleX:c,scaleY:u}}if(typeof OffscreenCanvas<"u"){ut(`createCanvas: using OffscreenCanvas ${i}\xD7${a}, scale=(${c.toFixed(3)},${u.toFixed(3)})`);let l=new OffscreenCanvas(i,a),m=l.getContext("2d",Ct);return m?{canvas:l,ctx:m,scaleX:c,scaleY:u}:(q('createCanvas: OffscreenCanvas.getContext("2d") returned null'),null)}if(typeof document<"u"){ut(`createCanvas: using HTMLCanvasElement ${i}\xD7${a}, scale=(${c.toFixed(3)},${u.toFixed(3)})`);let l=document.createElement("canvas");l.width=i,l.height=a;let m=l.getContext("2d",Ct);return m?{canvas:l,ctx:m,scaleX:c,scaleY:u}:(q('createCanvas: HTMLCanvasElement.getContext("2d") returned null'),null)}if(U){ut(`createCanvas: using @napi-rs/canvas ${i}\xD7${a}, scale=(${c.toFixed(3)},${u.toFixed(3)})`);let l=U.createCanvas(i,a),m=l.getContext("2d");return m?{canvas:l,ctx:m,scaleX:c,scaleY:u}:(q('createCanvas: @napi-rs/canvas getContext("2d") returned null'),null)}return q("createCanvas: no OffscreenCanvas, no document, and no @napi-rs/canvas, cannot create canvas"),null}catch(l){return null}}function ze(n,t){if(n<=0||t<=0)return null;if(n=Math.max(1,Math.min(Math.floor(n),8192)),t=Math.max(1,Math.min(Math.floor(t),8192)),zn);if(typeof OffscreenCanvas<"u"){let r=new OffscreenCanvas(n,t),o=r.getContext("2d",Ct);return o?{canvas:r,ctx:o}:null}if(typeof document<"u"){let r=document.createElement("canvas");r.width=n,r.height=t;let o=r.getContext("2d",Ct);return o?{canvas:r,ctx:o}:null}if(U){let r=U.createCanvas(n,t),o=r.getContext("2d");return o?{canvas:r,ctx:o}:null}let e=new z(n,t);return {canvas:e,ctx:e.ctx}}function jn(n){switch(n){case 1:return {gco:"source-over",colorTransform:"black",exact:true};case 16:return {gco:"source-over",colorTransform:"white",exact:true};case 11:return {gco:"source-over",colorTransform:"skip",exact:true};case 4:return {gco:"source-over",colorTransform:"invert",exact:true};case 6:return {gco:"difference",colorTransform:"white",exact:true};case 7:case 5:return {gco:"difference",colorTransform:"none",exact:false};case 10:return {gco:"difference",colorTransform:"invert",exact:false};case 9:return {gco:"darken",colorTransform:"none",exact:false};case 3:case 2:return {gco:"darken",colorTransform:"invert",exact:false};case 15:case 14:return {gco:"lighten",colorTransform:"none",exact:false};case 12:case 8:return {gco:"lighten",colorTransform:"invert",exact:false};default:return {gco:"source-over",colorTransform:"none",exact:true}}}function qn(n,t){switch(t){case "invert":return en(n);case "black":return "#000000";case "white":return "#ffffff";case "skip":return "rgba(0,0,0,0)";default:return n}}function So(n,t){let e=jn(t.rop2);if(n.globalCompositeOperation=e.gco,t.penStyle===5){n.strokeStyle="rgba(0,0,0,0)",n.lineWidth=0;return}n.strokeStyle=qn(t.penColor,e.colorTransform),n.lineWidth=Math.max(t.penWidth,1),n.setLineDash(t.penWidth<=1?Yn(t.penStyle,t.penUserStyle)??[]:[]);}function yo(n,t){let e=jn(t.rop2);if(n.globalCompositeOperation=e.gco,Ln(t).kind==="none"){n.fillStyle="rgba(0,0,0,0)";return}n.fillStyle=qn(t.brushColor,e.colorTransform);}function Je(n){if(!n||n===400)return "";let t=Math.round(n/100)*100;return t===700?"bold":t>=100&&t<=900?String(t):n>=700?"bold":""}function Ve(n,t){let e=t?.[n.toLowerCase().trim()]??n;return /[\s,]/.test(e)&&!/^["']/.test(e)?`"${e}"`:e}function Kn(n,t=1){return Math.max(_n(n.fontHeight)*Math.abs(t||1),8)}function Ao(n,t,e=1){let r=t.fontItalic?"italic ":"",o=Je(t.fontWeight),s=o?`${o} `:"",i=Kn(t,e),a=Ve(t.fontFamily,t.fontFamilyMap),c=`${r}${s}${i}px ${a}`;n.font!==c&&(n.font=c);}function Po(n,t,e,r,o,s=1){if(!t.fontUnderline&&!t.fontStrikeOut)return;let i=Kn(t,s),a=Math.max(1,Math.round(i/14)),c=n.fillStyle;n.fillStyle=t.textColor,t.fontUnderline&&n.fillRect(e,r+Math.round(i*.12),o,a),t.fontStrikeOut&&n.fillRect(e,r-Math.round(i*.3),o,a),n.fillStyle=c;}function Co(n,t,e){if(e<=0)return "";let r=n.byteLength-t;if(r<=0)return "";let o=Math.min(e,Math.floor(r/2));if(o<=0)return "";let s;try{let a=new Uint8Array(n.buffer,n.byteOffset+t,o*2);s=new TextDecoder("utf-16le").decode(a);}catch{let a=[];for(let c=0;c<o;c++){let u=n.getUint16(t+c*2,true);if(u===0)return a.join("");a.push(String.fromCharCode(u));}return a.join("")}let i=s.indexOf("\0");return i===-1?s:s.slice(0,i)}function Lo(n){switch(n){case 0:return {kind:"brush",style:0,color:"#ffffff"};case 1:return {kind:"brush",style:0,color:"#c0c0c0"};case 2:return {kind:"brush",style:0,color:"#808080"};case 3:return {kind:"brush",style:0,color:"#404040"};case 4:return {kind:"brush",style:0,color:"#000000"};case 5:return {kind:"brush",style:1,color:"#000000"};case 6:return {kind:"pen",style:0,widthX:1,color:"#ffffff"};case 7:return {kind:"pen",style:0,widthX:1,color:"#000000"};case 8:return {kind:"pen",style:5,widthX:0,color:"#000000"};case 10:case 11:return {kind:"font",height:12,weight:400,italic:false,underline:false,strikeOut:false,family:"monospace"};case 12:case 13:case 14:case 17:return {kind:"font",height:12,weight:400,italic:false,underline:false,strikeOut:false,family:"sans-serif"};default:return null}}async function _o(n,t){let e=a(new Uint8Array(n));if(e==="unsupported")return null;if(Jn()){let s=await Hn(new Uint8Array(n));return s?{drawable:s,width:s.width,height:s.height,close:()=>{}}:null}if(!(e==="bundled"&&In)){if(U)try{let s=await U.loadImage(new Uint8Array(n));return {drawable:s,width:s.width,height:s.height,close:()=>{}}}catch{}else if(typeof createImageBitmap=="function")try{let s=t!==void 0?new Blob([n],{type:t}):new Blob([n]),i=await createImageBitmap(s);return {drawable:i,width:i.width,height:i.height,close:()=>i.close()}}catch{}}let r=await Hn(new Uint8Array(n)),o=r&&ze(r.width,r.height);return !r||!o?null:(je(o.ctx,ct(r.data,r.width,r.height),0,0),{drawable:o.canvas,width:r.width,height:r.height,close:()=>{}})}async function Hn(n){if(a$1(n))return c(n);if(n.length>=26&&n[0]===66&&n[1]===77){let t=new DataView(n.buffer,n.byteOffset,n.byteLength),e=t.getUint32(10,true),r=Et(t,14,e,t.byteLength-e);return r?{data:r.data,width:r.width,height:r.height}:null}return On(n)}function Io(n,t,e,r,o,s){n.drawImage.call(n,t,e,r,o,s);}function Oo(n,t,e,r,o){return n.getImageData.call(n,t,e,r,o)}function je(n,t,e,r){n.putImageData.call(n,t,e,r);}function vo(n,t,e){return n.createPattern.call(n,t,e)}function ct(n,t,e){if(typeof ImageData<"u")return new ImageData(n,t,e);if(U){let r=U.ImageData;return new r(n,t,e)}return {data:n,width:t,height:e,colorSpace:"srgb"}}var qe=Symbol("SvgContext");function Ke(n){return typeof n=="object"&&n!==null&&qe in n}function No(n){return !Ke(n)||n.canReadPixels}function Zn(n){return n.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F￾￿]/g,"").replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"\uFFFD").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Qn(n,t){t.push("<",n.tag);for(let e of Object.keys(n.attrs))t.push(" ",e,'="',Zn(String(n.attrs[e])),'"');if(n.text!==void 0){t.push(">",Zn(n.text),"</",n.tag,">");return}if(!n.children||n.children.length===0){t.push("/>");return}t.push(">");for(let e of n.children)Qn(e,t);t.push("</",n.tag,">");}function Ze(n){let t=[];return Qn(n,t),t.join("")}var K="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function Qe(n){let t=[];for(let r=0;r<n.length;r+=12288){let o=Math.min(n.length,r+12288),s="",i=r;for(;i+2<o;i+=3){let a=n[i]<<16|n[i+1]<<8|n[i+2];s+=K[a>>18]+K[a>>12&63]+K[a>>6&63]+K[a&63];}if(i<o){let a=n[i]<<16|(i+1<o?n[i+1]:0)<<8;s+=K[a>>18]+K[a>>12&63]+(i+1<o?K[a>>6&63]:"=")+"=";}t.push(s);}return t.join("")}function tr(n){if(typeof TextEncoder<"u")return new TextEncoder().encode(n);let t=[];for(let e of n){let r=e.codePointAt(0);r<128?t.push(r):r<2048?t.push(192|r>>6,128|r&63):r<65536?t.push(224|r>>12,128|r>>6&63,128|r&63):t.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|r&63);}return Uint8Array.from(t)}function nr(n){return `data:image/svg+xml;base64,${Qe(tr(n))}`}function Uo(n){return nr(Ze(n))}var er={class:"className","xml:space":"xmlSpace","xlink:href":"xlinkHref","xmlns:xlink":"xmlnsXlink"};function te(n){let t=er[n];return t||(n.startsWith("data-")||n.startsWith("aria-")?n:n.replace(/[-:]([a-z])/g,(e,r)=>r.toUpperCase()))}function ne(n){let t={};for(let e of n.split(";")){let r=e.indexOf(":");if(r<=0)continue;let o=e.slice(0,r).trim(),s=e.slice(r+1).trim();if(!o)continue;let i=o.startsWith("--")?o:o.replace(/-([a-z])/g,(a,c)=>c.toUpperCase());t[i]=s;}return t}function rr(n){let t={};for(let e of Object.keys(n)){let r=n[e];e==="style"?t.style=ne(String(r)):t[te(e)]=r;}return t}function Do(n,t,e){let r=0,o=(a,c)=>{let u={key:r++,...rr(a.attrs),...c};if(a.text!==void 0)return t(a.tag,u,a.text);let l=(a.children??[]).map(m=>o(m));return t(a.tag,u,...l)},{key:s,...i}=e??{};return o(n,i)}function Jt(n){return JSON.stringify(n)}function or(n,t){if(n==="style"){let e=ne(String(t));return `{{ ${Object.keys(e).map(o=>`${/^[a-zA-Z_$][\w$]*$/.test(o)?o:Jt(o)}: ${Jt(e[o])}`).join(", ")} }}`}return typeof t=="number"?Number.isFinite(t)?`{${t}}`:"{0}":/^[^"\\{}<>&\r\n]*$/.test(t)?`"${t}"`:`{${Jt(t)}}`}function sr(n){return `{${JSON.stringify(n)}}`}function ee(n,t,e,r){let o=" ".repeat(t),s=Object.keys(n.attrs).map(a=>`${te(a)}=${or(a,n.attrs[a])}`);r&&s.push("{...props}");let i=`${o}<${n.tag}${s.length?" "+s.join(" "):""}`;if(n.text!==void 0){e.push(`${i}>${sr(n.text)}</${n.tag}>`);return}if(!n.children||n.children.length===0){e.push(`${i} />`);return}e.push(`${i}>`);for(let a of n.children)ee(a,t+1,e,false);e.push(`${o}</${n.tag}>`);}function ko(n,t={}){let e=t.componentName??"Metafile";if(!/^[A-Z][A-Za-z0-9_$]*$/.test(e))throw new TypeError(`svgTreeToJsx: componentName must be a PascalCase identifier, got ${JSON.stringify(e)}`);let r=t.typescript??true,o=t.spreadProps??true,s=[];ee(n,2,s,o);let i=o?r?"props: SVGProps<SVGSVGElement>":"props":"";return [...r&&o?["import type { SVGProps } from 'react';",""]:[],`export function ${e}(${i}) {`," return (",...s," );","}","",`export default ${e};`,""].join(`
2
+ `)}export{So as $,Qr as A,Ce as B,to as C,no as D,eo as E,kn as F,ro as G,Yn as H,oo as I,so as J,io as K,nt as L,ft as M,Qt as N,It as O,Ot as P,z as Q,Pr as R,at as S,To as T,Jn as U,Vn as V,He as W,Ro as X,ze as Y,jn as Z,qn as _,nn as a,yo as aa,ur as b,Ve as ba,lr as c,Kn as ca,mr as d,Ao as da,Et as e,Po as ea,Ee as f,Co as fa,ge as g,Lo as ga,Dr as h,_o as ha,Ln as i,Hn as ia,kr as j,Io as ja,Gr as k,Oo as ka,Xr as l,je as la,$r as m,vo as ma,Wr as n,ct as na,Yr as o,qe as oa,Hr as p,Ke as pa,ut as q,No as qa,q as r,Ze as ra,Yt as s,Qe as sa,Se as t,nr as ta,Fn as u,Uo as ua,W as v,Do as va,At as w,ko as wa,Ht as x,Pe as y,Zr as z};
@@ -1,2 +1,2 @@
1
- import {L,S,R,N as N$1,M,Q,Y,la,na,O,P as P$1,ka,sa,ja,oa}from'./chunk-H4QX7Q4T.mjs';export{P as estimateTextWidth,O as parseFont}from'./chunk-H4QX7Q4T.mjs';import {b}from'./chunk-AKFBI6HO.mjs';import'./chunk-6M4YGIQZ.mjs';import'./chunk-DOQZZ5LA.mjs';import'./chunk-PO4H7QFT.mjs';import'./chunk-VQRM3TC4.mjs';import'./chunk-GB3YMP7Z.mjs';var T=[1,0,0,1,0,0];function U(o,t){return [o[0]*t[0]+o[2]*t[1],o[1]*t[0]+o[3]*t[1],o[0]*t[2]+o[2]*t[3],o[1]*t[2]+o[3]*t[3],o[0]*t[4]+o[2]*t[5]+o[4],o[1]*t[4]+o[3]*t[5]+o[5]]}function et(o){let t=o[0]*o[3]-o[1]*o[2];return !t||!Number.isFinite(t)?null:[o[3]/t,-o[1]/t,-o[2]/t,o[0]/t,(o[2]*o[5]-o[3]*o[4])/t,(o[1]*o[4]-o[0]*o[5])/t]}function P(o){return o[0]===1&&o[1]===0&&o[2]===0&&o[3]===1&&o[4]===0&&o[5]===0}function c(o){if(!Number.isFinite(o))return "0";let t=Math.round(o*1e3)/1e3;return Object.is(t,-0)?"0":String(t)}function k(o){return `matrix(${o.map(c).join(" ")})`}function B(o){return Math.max(0,Math.min(255,Math.round(o))).toString(16).padStart(2,"0")}function it(o){let t=o.trim();if(t==="transparent")return {color:"#000000",alpha:0};let e=/^rgba?\(([^)]*)\)$/i.exec(t);if(e){let n=e[1].split(/[\s,/]+/).filter(Boolean),a=r=>r===void 0?0:r.endsWith("%")?parseFloat(r)*255/100:parseFloat(r),s=n.length>3?n[3].endsWith("%")?parseFloat(n[3])/100:parseFloat(n[3]):1;return {color:`#${B(a(n[0]))}${B(a(n[1]))}${B(a(n[2]))}`,alpha:Number.isFinite(s)?Math.max(0,Math.min(1,s)):1}}let i=/^#([0-9a-f]{6})([0-9a-f]{2})$/i.exec(t);return i?{color:`#${i[1].toLowerCase()}`,alpha:parseInt(i[2],16)/255}:{color:t.toLowerCase(),alpha:1}}function j(o){let t=o,e=typeof t.naturalWidth=="number"&&t.naturalWidth>0?t.naturalWidth:t.width,i=typeof t.naturalHeight=="number"&&t.naturalHeight>0?t.naturalHeight:t.height;return typeof e=="number"&&typeof i=="number"&&e>0&&i>0?{w:e,h:i}:null}function E(o){if(o instanceof $)return o.payload;if(o instanceof Q)return {kind:"rgba",data:o.pixels,width:o.width,height:o.height};let t=j(o);if(!t)return null;let e=o;if(e.data instanceof Uint8ClampedArray)return {kind:"rgba",data:e.data.slice(),width:t.w,height:t.h};try{if(typeof e.getContext=="function"){let n=e.getContext("2d");if(n&&typeof n.getImageData=="function")return {kind:"rgba",data:ka(n,0,0,t.w,t.h).data.slice(),width:t.w,height:t.h}}let i=Y(t.w,t.h);if(i&&!R(i.canvas))return ja(i.ctx,o,0,0,t.w,t.h),{kind:"rgba",data:ka(i.ctx,0,0,t.w,t.h).data.slice(),width:t.w,height:t.h}}catch{}return null}function lt(o,t,e,i,n){if(o.kind!=="rgba")return o;let a=Math.max(0,Math.floor(Math.min(t,t+i))),s=Math.max(0,Math.floor(Math.min(e,e+n))),r=Math.min(o.width,Math.ceil(Math.max(t,t+i))),h=Math.min(o.height,Math.ceil(Math.max(e,e+n))),l=r-a,u=h-s;if(l<=0||u<=0)return null;if(a===0&&s===0&&l===o.width&&u===o.height)return o;let d=new Uint8ClampedArray(l*u*4);for(let m=0;m<u;m++)d.set(o.data.subarray(((s+m)*o.width+a)*4,((s+m)*o.width+a+l)*4),m*l*4);return {kind:"rgba",data:d,width:l,height:u}}var $=class{constructor(t,e,i){this.payload=t,this.width=e,this.height=i;}},st=0,N=class{constructor(t,e,i){this.type=t;this.coords=e;this.real=i;this.uid=++st;this.stops=[];}addColorStop(t,e){if(!(t>=0&&t<=1))throw new RangeError("Gradient stop offset out of range");this.stops.push({offset:t,color:e}),this.real?.addColorStop(t,e);}},A=class{constructor(t,e,i,n,a,s){this.payload=t;this.width=e;this.height=i;this.repetition=n;this.real=a;this.pixelated=s;this.uid=++st;this.matrix=[...T];}setTransform(t){this.matrix=[t?.a??1,t?.b??0,t?.c??0,t?.d??1,t?.e??0,t?.f??0];try{this.real?.setTransform(t);}catch{}}};function W(o,t,e=2){let i=10**e,n="",a="",s="",r=0,h=0,l=0,u=0,d=(g,f)=>{let b=t?t[0]*g+t[2]*f+t[4]:g,y=t?t[1]*g+t[3]*f+t[5]:f;return [Math.round(b*i),Math.round(y*i)]},m=g=>{let f=(g/i).toFixed(e);f.includes(".")&&(f=f.replace(/0+$/,"").replace(/\.$/,"")),f=f.replace(/^(-?)0\./,"$1."),f==="-0"&&(f="0"),s&&!(f[0]==="-"||f[0]==="."&&s.includes("."))&&(n+=" "),n+=f,s=f;},w=g=>{(g!==a||g==="m")&&(n+=g,a=g,s="");};for(let g of o)switch(g.t){case "M":{let[f,b]=d(g.x,g.y);n===""?(n+="M",s="",m(f),m(b),a="M"):(w("m"),m(f-r),m(b-h),a="l"),r=l=f,h=u=b;break}case "L":{let[f,b]=d(g.x,g.y);w("l"),m(f-r),m(b-h),r=f,h=b;break}case "C":{let[f,b]=d(g.x1,g.y1),[y,v]=d(g.x2,g.y2),[p,S]=d(g.x,g.y);w("c"),m(f-r),m(b-h),m(y-r),m(v-h),m(p-r),m(S-h),r=p,h=S;break}case "Z":n+="z",a="z",s="",r=l,h=u;break}return n}function dt(o){let t=Math.sqrt(Math.abs(o[0]*o[3]-o[1]*o[2]))||1;return Math.max(2,Math.min(8,Math.ceil(2+Math.log10(t))))}var J=new Set(["multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]),at;at=oa;var nt=class{constructor(t,e,i={}){this[at]=true;this.nextId=0;this.stack=[];this.pb=new L;this.defs=[];this.defKeys=new Map;this.body=[];this.group=null;this.images=[];this.canvas={width:t,height:e,svgContext:this},this.shadow=i.shadow??null,this.imageResampling=i.imageResampling??"renderer",this.idPrefix=i.idPrefix??"emf-",this.state={transform:[...T],fillStyle:"#000000",strokeStyle:"#000000",lineWidth:1,lineDash:[],lineDashOffset:0,lineCap:"butt",lineJoin:"miter",miterLimit:10,globalAlpha:1,gco:"source-over",font:"10px sans-serif",textAlign:"start",textBaseline:"alphabetic",imageSmoothingEnabled:true,clipId:null};}get canReadPixels(){return this.shadow!==null}get softShadow(){return this.shadow instanceof S?this.shadow:null}shadowAccepts(t){return t instanceof $?false:this.softShadow!==null||!R(t)}unknownPixels(t,e,i,n){let a=this.softShadow;return a?a.canvas.unknownIn(t,e,i,n):null}blendPatch(t,e,i,n,a,s){let r=this.softShadow,h=t.slice();if(r){let u=r.clipCoverage(e,i,n,a);if(u)for(let d=0;d<n*a;d++)h[d*4+3]=h[d*4+3]*u[d]/255;r.save(),r.setTransform(1,0,0,1,0,0),r.globalAlpha=1,r.globalCompositeOperation=s,r.imageSmoothingEnabled=false,r.drawImage({data:t,width:n,height:a},e,i),r.restore();}let l=this.imageNode({kind:"rgba",data:h,width:n,height:a},e,i,n,a,true);J.has(s)&&(l.attrs.style=`${l.attrs.style};mix-blend-mode:${s}`),this.body.push(l),this.group=null;}id(t){return `${this.idPrefix}${t}${this.nextId++}`}get fillStyle(){return this.state.fillStyle}set fillStyle(t){(typeof t=="string"||t instanceof N||t instanceof A)&&(this.state.fillStyle=t,this.forwardPaint("fillStyle",t));}get strokeStyle(){return this.state.strokeStyle}set strokeStyle(t){(typeof t=="string"||t instanceof N||t instanceof A)&&(this.state.strokeStyle=t,this.forwardPaint("strokeStyle",t));}forwardPaint(t,e){if(!this.shadow)return;let i=typeof e=="string"?e:e.real;i&&(this.shadow[t]=i);}get lineWidth(){return this.state.lineWidth}set lineWidth(t){Number.isFinite(t)&&t>0&&(this.state.lineWidth=t,this.shadow&&(this.shadow.lineWidth=t));}get lineCap(){return this.state.lineCap}set lineCap(t){this.state.lineCap=t,this.shadow&&(this.shadow.lineCap=t);}get lineJoin(){return this.state.lineJoin}set lineJoin(t){this.state.lineJoin=t,this.shadow&&(this.shadow.lineJoin=t);}get miterLimit(){return this.state.miterLimit}set miterLimit(t){Number.isFinite(t)&&t>0&&(this.state.miterLimit=t,this.shadow&&(this.shadow.miterLimit=t));}get lineDashOffset(){return this.state.lineDashOffset}set lineDashOffset(t){Number.isFinite(t)&&(this.state.lineDashOffset=t,this.shadow&&(this.shadow.lineDashOffset=t));}get globalAlpha(){return this.state.globalAlpha}set globalAlpha(t){Number.isFinite(t)&&t>=0&&t<=1&&(this.state.globalAlpha=t,this.shadow&&(this.shadow.globalAlpha=t));}get globalCompositeOperation(){return this.state.gco}set globalCompositeOperation(t){this.state.gco=t,this.shadow&&(this.shadow.globalCompositeOperation=t);}get font(){return this.state.font}set font(t){this.state.font=t,this.shadow&&(this.shadow.font=t);}get textAlign(){return this.state.textAlign}set textAlign(t){this.state.textAlign=t,this.shadow&&(this.shadow.textAlign=t);}get textBaseline(){return this.state.textBaseline}set textBaseline(t){this.state.textBaseline=t,this.shadow&&(this.shadow.textBaseline=t);}get imageSmoothingEnabled(){return this.state.imageSmoothingEnabled}set imageSmoothingEnabled(t){this.state.imageSmoothingEnabled=t,this.shadow&&(this.shadow.imageSmoothingEnabled=t);}setLineDash(t){!Array.isArray(t)||t.some(e=>!Number.isFinite(e)||e<0)||(this.state.lineDash=t.length%2?[...t,...t]:[...t],this.shadow?.setLineDash(t));}getLineDash(){return [...this.state.lineDash]}save(){this.stack.push({...this.state,transform:[...this.state.transform],lineDash:[...this.state.lineDash]}),this.shadow?.save();}restore(){let t=this.stack.pop();t&&(this.state=t),this.shadow?.restore();}getTransform(){let[t,e,i,n,a,s]=this.state.transform;return {a:t,b:e,c:i,d:n,e:a,f:s}}setTransform(t,e,i,n,a,s){[t,e,i,n,a,s].every(Number.isFinite)&&(this.state.transform=[t,e,i,n,a,s]),this.shadow?.setTransform(t,e,i,n,a,s);}resetTransform(){this.setTransform(1,0,0,1,0,0);}transform(t,e,i,n,a,s){[t,e,i,n,a,s].every(Number.isFinite)&&(this.state.transform=U(this.state.transform,[t,e,i,n,a,s])),this.shadow?.transform(t,e,i,n,a,s);}translate(t,e){this.transform(1,0,0,1,t,e);}scale(t,e){this.transform(t,0,0,e,0,0);}rotate(t){let e=Math.cos(t),i=Math.sin(t);this.transform(e,i,-i,e,0,0);}get path(){return this.pb.segs}map(t,e){let i=this.state.transform;return {x:i[0]*t+i[2]*e+i[4],y:i[1]*t+i[3]*e+i[5]}}beginPath(){this.pb.reset(),this.shadow?.beginPath();}moveTo(t,e){this.pb.moveTo(this.state.transform,t,e),this.shadow?.moveTo(t,e);}lineTo(t,e){this.pb.lineTo(this.state.transform,t,e),this.shadow?.lineTo(t,e);}bezierCurveTo(t,e,i,n,a,s){this.pb.bezierCurveTo(this.state.transform,t,e,i,n,a,s),this.shadow?.bezierCurveTo(t,e,i,n,a,s);}quadraticCurveTo(t,e,i,n){this.pb.quadraticCurveTo(this.state.transform,t,e,i,n),this.shadow?.quadraticCurveTo(t,e,i,n);}closePath(){this.pb.closePath(),this.shadow?.closePath();}rect(t,e,i,n){this.pb.rect(this.state.transform,t,e,i,n),this.shadow?.rect(t,e,i,n);}ellipse(t,e,i,n,a,s,r,h=false){this.pb.ellipse(this.state.transform,t,e,i,n,a,s,r,h),this.shadow?.ellipse(t,e,i,n,a,s,r,h);}arc(t,e,i,n,a,s=false){this.pb.arc(this.state.transform,t,e,i,n,a,s),this.shadow?.arc(t,e,i,n,a,s);}arcTo(t,e,i,n,a){this.shadow?.arcTo(t,e,i,n,a),this.pb.arcTo(this.state.transform,t,e,i,n,a);}isPointInPath(t,e,i="nonzero"){return this.shadow&&typeof this.shadow.isPointInPath=="function"?this.shadow.isPointInPath(t,e,i):N$1(M(this.path,.05),t,e,i)}emit(t){let e=this.state.clipId;if(!e){this.body.push(t),this.group=null;return}(!this.group||this.group.clipId!==e||this.body[this.body.length-1]!==this.group.node)&&(this.group={node:{tag:"g",attrs:{"clip-path":`url(#${e})`},children:[]},clipId:e},this.body.push(this.group.node)),this.group.node.children.push(t);}blendStyle(t){J.has(this.state.gco)&&(t.style=`mix-blend-mode:${this.state.gco}`);}define(t,e,i){let n=this.defKeys.get(t);if(n)return n;let a=this.id(e);return this.defKeys.set(t,a),this.defs.push(i(a)),a}resolvePaint(t,e){let i=this.state.globalAlpha;if(typeof t=="string"){let s=it(t),r=s.alpha*i;return r<=0?null:{value:s.color,opacity:r}}if(i<=0)return null;if(t instanceof N){if(t.stops.length===0)return null;let s=`g${t.uid}:${t.stops.length}:${e.join(",")}`;return {value:`url(#${this.define(s,"g",h=>this.gradientNode(t,h,e))})`,opacity:i}}let n=`p${t.uid}:${t.matrix.join(",")}:${e.join(",")}`;return {value:`url(#${this.define(n,"p",s=>this.patternNode(t,s,e))})`,opacity:i}}gradientNode(t,e,i){let n=t.coords,a=t.type==="linear"?{id:e,gradientUnits:"userSpaceOnUse",x1:c(n[0]),y1:c(n[1]),x2:c(n[2]),y2:c(n[3])}:{id:e,gradientUnits:"userSpaceOnUse",fx:c(n[0]),fy:c(n[1]),fr:c(n[2]),cx:c(n[3]),cy:c(n[4]),r:c(n[5])};P(i)||(a.gradientTransform=k(i));let s=[...t.stops].map((l,u)=>({...l,i:u})).sort((l,u)=>l.offset-u.offset||l.i-u.i),r=s.map(l=>l.offset);if(t.type==="linear"){let l=i[0]*(n[2]-n[0])+i[2]*(n[3]-n[1]),u=i[1]*(n[2]-n[0])+i[3]*(n[3]-n[1]),d=i[0]*n[0]+i[2]*n[1]+i[4],m=i[1]*n[0]+i[3]*n[1]+i[5],w=Math.hypot(l,u),g=w>0&&Math.abs(u)<1e-9*w,f=w>0&&Math.abs(l)<1e-9*w;if(g||f){let b=g?d:m,y=g?l:u;for(let v=1;v<s.length;v++){let p=s[v].offset;if(Math.abs(p-s[v-1].offset)>1e-9||p<=0||p>=1)continue;let S=b+p*y,x=Math.round(S-.5)+.5,C=S-x;if(Math.abs(C)>=.1)continue;let M=y>0?C>=0:C<0,q=(x+(M===y>0?.25:-0.25)-b)/y,ot=v>=2?r[v-2]:0,ht=v+1<s.length?s[v+1].offset:1,X=Math.min(Math.max(q,ot),ht);r[v-1]=X,r[v]=X;}}}let h=s.map((l,u)=>{let d=it(l.color),m={offset:String(Math.round(r[u]*1e6)/1e6),"stop-color":d.color};return d.alpha<1&&(m["stop-opacity"]=c(d.alpha)),{tag:"stop",attrs:m}});return {tag:t.type==="linear"?"linearGradient":"radialGradient",attrs:a,children:h}}patternNode(t,e,i){let n=U(i,t.matrix),a=t.width,s=t.height,r=et(n);if(r){let{width:m,height:w}=this.canvas;for(let[g,f]of [[0,0],[m,0],[0,w],[m,w]])a=Math.max(a,Math.abs(r[0]*g+r[2]*f+r[4])),s=Math.max(s,Math.abs(r[1]*g+r[3]*f+r[5]));}let h=t.repetition==="repeat"||t.repetition==="repeat-x"?t.width:Math.ceil(2*(a+t.width)+1),l=t.repetition==="repeat"||t.repetition==="repeat-y"?t.height:Math.ceil(2*(s+t.height)+1),u={id:e,patternUnits:"userSpaceOnUse",width:c(h),height:c(l)};P(n)||(u.patternTransform=k(n));let d=this.imageNode(t.payload,0,0,t.width,t.height,t.pixelated);return {tag:"pattern",attrs:u,children:[d]}}imageNode(t,e,i,n,a,s){let r={x:c(e),y:c(i),width:c(n),height:c(a),preserveAspectRatio:"none"};s&&(r["image-rendering"]="optimizeSpeed",r.style="image-rendering:pixelated");let h={tag:"image",attrs:r};return this.images.push({node:h,payload:t}),h}fillPath(t,e){if(t.length===0)return;let i=this.resolvePaint(this.state.fillStyle,this.state.transform);if(!i)return;let n={d:W(t,null),fill:i.value};i.opacity<1&&(n["fill-opacity"]=c(i.opacity)),e==="evenodd"&&(n["fill-rule"]="evenodd"),this.blendStyle(n),this.emit({tag:"path",attrs:n});}strokePath(t){if(t.length===0)return;let e=this.state.transform,i=et(e);if(!i)return;let n=this.resolvePaint(this.state.strokeStyle,T);if(!n)return;let a=this.state,s={d:W(t,P(e)?null:i,P(e)?2:dt(e)),fill:"none",stroke:n.value};n.opacity<1&&(s["stroke-opacity"]=c(n.opacity)),a.lineWidth!==1&&(s["stroke-width"]=c(a.lineWidth)),a.lineCap!=="butt"&&(s["stroke-linecap"]=a.lineCap),a.lineJoin!=="miter"?s["stroke-linejoin"]=a.lineJoin:s["stroke-miterlimit"]=c(a.miterLimit),a.lineDash.length&&(s["stroke-dasharray"]=a.lineDash.map(c).join(" "),a.lineDashOffset&&(s["stroke-dashoffset"]=c(a.lineDashOffset))),P(e)||(s.transform=k(e)),this.blendStyle(s),this.emit({tag:"path",attrs:s});}fill(t="nonzero"){this.fillPath(this.path,t),this.shadow?.fill(t);}stroke(){this.strokePath(this.path),this.shadow?.stroke();}rectSegs(t,e,i,n){let a=[this.map(t,e),this.map(t+i,e),this.map(t+i,e+n),this.map(t,e+n)];return [{t:"M",x:a[0].x,y:a[0].y},{t:"L",x:a[1].x,y:a[1].y},{t:"L",x:a[2].x,y:a[2].y},{t:"L",x:a[3].x,y:a[3].y},{t:"Z"}]}fillRect(t,e,i,n){[t,e,i,n].every(Number.isFinite)&&i!==0&&n!==0&&this.fillPath(this.rectSegs(t,e,i,n),"nonzero"),this.shadow?.fillRect(t,e,i,n);}strokeRect(t,e,i,n){[t,e,i,n].every(Number.isFinite)&&this.strokePath(this.rectSegs(t,e,i,n)),this.shadow?.strokeRect(t,e,i,n);}clearRect(t,e,i,n){this.shadow?.clearRect(t,e,i,n);}clip(t="nonzero"){let e=this.state.clipId,i=this.id("c"),n={id:i},a={d:W(this.path,null)||"M0 0"};e&&(a["clip-path"]=`url(#${e})`),t==="evenodd"&&(a["clip-rule"]="evenodd"),this.defs.push({tag:"clipPath",attrs:n,children:[{tag:"path",attrs:a}]}),this.state.clipId=i,this.shadow?.clip(t);}createLinearGradient(t,e,i,n){let a=this.shadow?this.shadow.createLinearGradient(t,e,i,n):null;return new N("linear",[t,e,i,n],a)}createRadialGradient(t,e,i,n,a,s){let r=this.shadow?this.shadow.createRadialGradient(t,e,i,n,a,s):null;return new N("radial",[t,e,i,n,a,s],r)}createPattern(t,e){let i=E(t),n=j(t);if(!i||!n)return null;let a=null;if(this.shadow&&this.shadowAccepts(t))try{a=this.shadow.createPattern.call(this.shadow,t,e??"repeat");}catch{a=null;}return new A(i,n.w,n.h,e||"repeat",a,!this.state.imageSmoothingEnabled)}fillWithTile(t,e,i,n,a,s){let r=new A({kind:"rgba",data:t.rgba,width:t.width,height:t.height},t.width,t.height,"repeat",null,true);r.matrix=[n,0,0,a,e,i];let h=this.state.fillStyle,l=this.state.transform;if(this.state.fillStyle=r,this.state.transform=[...T],this.fillPath(this.path,s),this.state.fillStyle=h,this.state.transform=l,this.softShadow){let u=new Q(t.width,t.height);u.ctx.putImageData({data:t.rgba,width:t.width,height:t.height},0,0);let d=this.softShadow.createPattern(u,"repeat");if(d){d.setTransform({a:n,b:0,c:0,d:a,e,f:i});let m=this.softShadow;m.save(),m.setTransform(1,0,0,1,0,0),m.imageSmoothingEnabled=false,m.fillStyle=d,m.fill(s),m.restore();}}else if(this.shadow){let u=Y(t.width,t.height);if(u&&!R(u.canvas)){la(u.ctx,na(t.rgba,t.width,t.height),0,0);let d=this.shadow.createPattern.call(this.shadow,u.canvas,"repeat");d&&(d.setTransform({a:n,b:0,c:0,d:a,e,f:i}),this.shadow.save(),this.shadow.setTransform(1,0,0,1,0,0),this.shadow.fillStyle=d,this.shadow.fill(s),this.shadow.restore());}}}measureText(t){let e=O(this.state.font).size;return {width:P$1(t,e)}}fillText(t,e,i,n){if(this.shadow?.fillText(t,e,i,n),!t||![e,i].every(Number.isFinite))return;let a=this.resolvePaint(this.state.fillStyle,T);if(!a)return;let s=O(this.state.font),r={x:c(e),y:c(i)},h=this.state.transform;P(h)||(r.transform=k(h)),r["font-family"]=s.family,r["font-size"]=c(s.size),s.weight&&(r["font-weight"]=s.weight),s.style&&(r["font-style"]=s.style);let l={center:"middle",right:"end",end:"end"}[this.state.textAlign];l&&(r["text-anchor"]=l);let u={top:"text-before-edge",hanging:"hanging",middle:"central",bottom:"text-after-edge",ideographic:"ideographic"}[this.state.textBaseline];u&&(r["dominant-baseline"]=u),r.fill=a.value,a.opacity<1&&(r["fill-opacity"]=c(a.opacity)),n!==void 0&&Number.isFinite(n)&&n>0&&this.measureText(t).width>n&&(r.textLength=c(n),r.lengthAdjust="spacingAndGlyphs"),/^\s|\s$|\s\s/.test(t)&&(r["xml:space"]="preserve"),this.blendStyle(r),this.emit({tag:"text",attrs:r,text:t});}fillGlyphRun(t){if(!t.text||t.xs.length===0)return;let e=this.resolvePaint(t.fill,T);if(!e)return;let i={x:t.xs.map(c).join(" "),y:t.ys.every(a=>a===t.ys[0])?c(t.ys[0]):t.ys.map(c).join(" ")},n=t.matrix?[...t.matrix]:null;if(t.scaleX&&t.scaleX!==1){let a=[t.scaleX,0,0,1,0,0];n=n?U(n,a):a,i.x=t.xs.map(s=>c(s/t.scaleX)).join(" ");}n&&!P(n)&&(i.transform=k(n)),i["font-family"]=t.fontFamily,i["font-size"]=c(t.fontSize),t.fontWeight&&t.fontWeight!==400&&(i["font-weight"]=String(t.fontWeight)),t.italic&&(i["font-style"]="italic"),t.aliased&&(i["text-rendering"]="optimizeSpeed"),i.fill=e.value,e.opacity<1&&(i["fill-opacity"]=c(e.opacity)),i["xml:space"]="preserve",this.blendStyle(i),this.emit({tag:"text",attrs:i,text:t.text});}drawImage(t,...e){if(this.softShadow){let d=t instanceof $?t.payload.kind==="rgba"?{data:t.payload.data,width:t.payload.width,height:t.payload.height}:null:t;d&&this.softShadow.drawImage(d,...e);}else if(this.shadow&&this.shadowAccepts(t))try{this.shadow.drawImage.call(this.shadow,t,...e);}catch{}else this.shadow&&R(t)&&this.mirrorSoftwareDraw(t,e);let i=j(t);if(!i)return;let n,a,s,r,h;if(e.length>=8){let[d,m,w,g]=e;if([,,,,a,s,r,h]=e,t instanceof Q){let f=Math.max(0,Math.floor(Math.min(d,d+w))),b=Math.max(0,Math.floor(Math.min(m,m+g))),y=Math.min(t.width,Math.ceil(Math.max(d,d+w))),v=Math.min(t.height,Math.ceil(Math.max(m,m+g)));n=y>f&&v>b?{kind:"rgba",data:t.readRgba(f,b,y-f,v-b),width:y-f,height:v-b}:null;}else {let f=E(t);n=f&&lt(f,d,m,w,g);}if(!n)return}else {if(n=E(t),!n)return;e.length>=4?[a,s,r,h]=e:([a,s]=e,r=i.w,h=i.h);}if(![a,s,r,h].every(Number.isFinite)||r===0||h===0||this.state.globalAlpha<=0)return;let l=this.imageNode(n,a,s,r,h,!this.state.imageSmoothingEnabled),u=this.state.transform;P(u)||(l.attrs.transform=k(u)),this.state.globalAlpha<1&&(l.attrs.opacity=c(this.state.globalAlpha)),J.has(this.state.gco)&&(l.attrs.style=`${l.attrs.style?`${l.attrs.style};`:""}mix-blend-mode:${this.state.gco}`),this.emit(l);}mirrorSoftwareDraw(t,e){let i=Y(t.width,t.height);!i||R(i.canvas)||!this.shadow||(la(i.ctx,na(t.pixels.slice(),t.width,t.height),0,0),this.shadow.drawImage.call(this.shadow,i.canvas,...e));}getImageData(t,e,i,n){return this.shadow?ka(this.shadow,t,e,i,n):na(new Uint8ClampedArray(Math.max(0,i*n*4)),i,n)}putImageData(t,e,i){let n=Math.round(e),a=Math.round(i),{width:s,height:r,data:h}=t,l=this.shadow?ka(this.shadow,n,a,s,r).data:null,u=s,d=r,m=-1,w=-1,g=new Uint8Array(s*r);for(let p=0;p<r;p++){let S=a+p;if(!(S<0||S>=this.canvas.height))for(let x=0;x<s;x++){let C=n+x;if(C<0||C>=this.canvas.width)continue;let M=(p*s+x)*4;(l?h[M]!==l[M]||h[M+1]!==l[M+1]||h[M+2]!==l[M+2]||h[M+3]!==l[M+3]:h[M+3]!==0)&&(g[p*s+x]=1,x<u&&(u=x),x>m&&(m=x),p<d&&(d=p),p>w&&(w=p));}}if(this.shadow&&la(this.shadow,t,n,a),m<0)return;let f=m-u+1,b=w-d+1,y=new Uint8ClampedArray(f*b*4);for(let p=0;p<b;p++)for(let S=0;S<f;S++){let x=(d+p)*s+(u+S);if(!g[x])continue;let C=(p*f+S)*4;y[C]=h[x*4],y[C+1]=h[x*4+1],y[C+2]=h[x*4+2],y[C+3]=h[x*4+3];}let v=this.imageNode({kind:"rgba",data:y,width:f,height:b},n+u,a+d,f,b,true);this.body.push(v),this.group=null;}reserveSlot(t){let e=this.softShadow;e&&t&&t.length>=6&&e.canvas.markUnknown(t,null);let i={tag:"g",attrs:{},children:[]};return this.emit(i),i}fillSlot(t,e,i,n,a,s,r){let h=this.imageNode(e,n,a,s,r,false);P(i)||(h.attrs.transform=k(i)),t.children.push(h);}fillSlotCropped(t,e,i,n,a,s,r,h){let l=this.imageNode(e,0,0,n.w,n.h,false),u=a<=0&&s<=0&&a+r>=n.w&&s+h>=n.h,d={tag:"g",attrs:{},children:[l]};if(P(i)||(d.attrs.transform=k(i)),!u){let m=this.id("c");this.defs.push({tag:"clipPath",attrs:{id:m},children:[{tag:"rect",attrs:{x:c(a),y:c(s),width:c(r),height:c(h)}}]}),l.attrs["clip-path"]=`url(#${m})`;}t.children.push(d);}async toTree(t={}){let e=new Map;for(let r of this.images){let h=e.get(r.payload);h===void 0&&(h=await ut(r.payload),e.set(r.payload,h)),r.node.attrs.href=h;}let{width:i,height:n}=this.canvas,a={xmlns:"http://www.w3.org/2000/svg"};(t.includeSize??true)&&(a.width=i,a.height=n),a.viewBox=`0 0 ${i} ${n}`,a.style="isolation:isolate";let s=[];this.defs.length&&s.push({tag:"defs",attrs:{},children:this.defs});for(let r of rt(this.body))s.push(r);return {tag:"svg",attrs:a,children:s}}};function rt(o){return o.filter(t=>t.tag==="g"&&t.children?(t.children=rt(t.children),t.children.length>0):true)}async function ut(o){switch(o.kind){case "url":return o.url;case "encoded":return `data:${o.mime};base64,${sa(o.bytes)}`;case "rgba":return `data:image/png;base64,${sa(await b(o.data,o.width,o.height))}`}}
1
+ import {L,S,R,N as N$1,M,Q,Y,la,na,O,P as P$1,ka,sa,ja,oa}from'./chunk-BLVH37HL.mjs';export{P as estimateTextWidth,O as parseFont}from'./chunk-BLVH37HL.mjs';import {b}from'./chunk-6TAYDPWF.mjs';import'./chunk-T4UGEB7S.mjs';import'./chunk-L2UW73US.mjs';import'./chunk-T6E6K636.mjs';import'./chunk-75GGL2QB.mjs';import'./chunk-YXNQU7W4.mjs';var T=[1,0,0,1,0,0];function U(o,t){return [o[0]*t[0]+o[2]*t[1],o[1]*t[0]+o[3]*t[1],o[0]*t[2]+o[2]*t[3],o[1]*t[2]+o[3]*t[3],o[0]*t[4]+o[2]*t[5]+o[4],o[1]*t[4]+o[3]*t[5]+o[5]]}function et(o){let t=o[0]*o[3]-o[1]*o[2];return !t||!Number.isFinite(t)?null:[o[3]/t,-o[1]/t,-o[2]/t,o[0]/t,(o[2]*o[5]-o[3]*o[4])/t,(o[1]*o[4]-o[0]*o[5])/t]}function P(o){return o[0]===1&&o[1]===0&&o[2]===0&&o[3]===1&&o[4]===0&&o[5]===0}function c(o){if(!Number.isFinite(o))return "0";let t=Math.round(o*1e3)/1e3;return Object.is(t,-0)?"0":String(t)}function k(o){return `matrix(${o.map(c).join(" ")})`}function B(o){return Math.max(0,Math.min(255,Math.round(o))).toString(16).padStart(2,"0")}function it(o){let t=o.trim();if(t==="transparent")return {color:"#000000",alpha:0};let e=/^rgba?\(([^)]*)\)$/i.exec(t);if(e){let n=e[1].split(/[\s,/]+/).filter(Boolean),a=r=>r===void 0?0:r.endsWith("%")?parseFloat(r)*255/100:parseFloat(r),s=n.length>3?n[3].endsWith("%")?parseFloat(n[3])/100:parseFloat(n[3]):1;return {color:`#${B(a(n[0]))}${B(a(n[1]))}${B(a(n[2]))}`,alpha:Number.isFinite(s)?Math.max(0,Math.min(1,s)):1}}let i=/^#([0-9a-f]{6})([0-9a-f]{2})$/i.exec(t);return i?{color:`#${i[1].toLowerCase()}`,alpha:parseInt(i[2],16)/255}:{color:t.toLowerCase(),alpha:1}}function j(o){let t=o,e=typeof t.naturalWidth=="number"&&t.naturalWidth>0?t.naturalWidth:t.width,i=typeof t.naturalHeight=="number"&&t.naturalHeight>0?t.naturalHeight:t.height;return typeof e=="number"&&typeof i=="number"&&e>0&&i>0?{w:e,h:i}:null}function E(o){if(o instanceof $)return o.payload;if(o instanceof Q)return {kind:"rgba",data:o.pixels,width:o.width,height:o.height};let t=j(o);if(!t)return null;let e=o;if(e.data instanceof Uint8ClampedArray)return {kind:"rgba",data:e.data.slice(),width:t.w,height:t.h};try{if(typeof e.getContext=="function"){let n=e.getContext("2d");if(n&&typeof n.getImageData=="function")return {kind:"rgba",data:ka(n,0,0,t.w,t.h).data.slice(),width:t.w,height:t.h}}let i=Y(t.w,t.h);if(i&&!R(i.canvas))return ja(i.ctx,o,0,0,t.w,t.h),{kind:"rgba",data:ka(i.ctx,0,0,t.w,t.h).data.slice(),width:t.w,height:t.h}}catch{}return null}function lt(o,t,e,i,n){if(o.kind!=="rgba")return o;let a=Math.max(0,Math.floor(Math.min(t,t+i))),s=Math.max(0,Math.floor(Math.min(e,e+n))),r=Math.min(o.width,Math.ceil(Math.max(t,t+i))),h=Math.min(o.height,Math.ceil(Math.max(e,e+n))),l=r-a,u=h-s;if(l<=0||u<=0)return null;if(a===0&&s===0&&l===o.width&&u===o.height)return o;let d=new Uint8ClampedArray(l*u*4);for(let m=0;m<u;m++)d.set(o.data.subarray(((s+m)*o.width+a)*4,((s+m)*o.width+a+l)*4),m*l*4);return {kind:"rgba",data:d,width:l,height:u}}var $=class{constructor(t,e,i){this.payload=t,this.width=e,this.height=i;}},st=0,N=class{constructor(t,e,i){this.type=t;this.coords=e;this.real=i;this.uid=++st;this.stops=[];}addColorStop(t,e){if(!(t>=0&&t<=1))throw new RangeError("Gradient stop offset out of range");this.stops.push({offset:t,color:e}),this.real?.addColorStop(t,e);}},A=class{constructor(t,e,i,n,a,s){this.payload=t;this.width=e;this.height=i;this.repetition=n;this.real=a;this.pixelated=s;this.uid=++st;this.matrix=[...T];}setTransform(t){this.matrix=[t?.a??1,t?.b??0,t?.c??0,t?.d??1,t?.e??0,t?.f??0];try{this.real?.setTransform(t);}catch{}}};function W(o,t,e=2){let i=10**e,n="",a="",s="",r=0,h=0,l=0,u=0,d=(g,f)=>{let b=t?t[0]*g+t[2]*f+t[4]:g,y=t?t[1]*g+t[3]*f+t[5]:f;return [Math.round(b*i),Math.round(y*i)]},m=g=>{let f=(g/i).toFixed(e);f.includes(".")&&(f=f.replace(/0+$/,"").replace(/\.$/,"")),f=f.replace(/^(-?)0\./,"$1."),f==="-0"&&(f="0"),s&&!(f[0]==="-"||f[0]==="."&&s.includes("."))&&(n+=" "),n+=f,s=f;},w=g=>{(g!==a||g==="m")&&(n+=g,a=g,s="");};for(let g of o)switch(g.t){case "M":{let[f,b]=d(g.x,g.y);n===""?(n+="M",s="",m(f),m(b),a="M"):(w("m"),m(f-r),m(b-h),a="l"),r=l=f,h=u=b;break}case "L":{let[f,b]=d(g.x,g.y);w("l"),m(f-r),m(b-h),r=f,h=b;break}case "C":{let[f,b]=d(g.x1,g.y1),[y,v]=d(g.x2,g.y2),[p,S]=d(g.x,g.y);w("c"),m(f-r),m(b-h),m(y-r),m(v-h),m(p-r),m(S-h),r=p,h=S;break}case "Z":n+="z",a="z",s="",r=l,h=u;break}return n}function dt(o){let t=Math.sqrt(Math.abs(o[0]*o[3]-o[1]*o[2]))||1;return Math.max(2,Math.min(8,Math.ceil(2+Math.log10(t))))}var J=new Set(["multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]),at;at=oa;var nt=class{constructor(t,e,i={}){this[at]=true;this.nextId=0;this.stack=[];this.pb=new L;this.defs=[];this.defKeys=new Map;this.body=[];this.group=null;this.images=[];this.canvas={width:t,height:e,svgContext:this},this.shadow=i.shadow??null,this.imageResampling=i.imageResampling??"renderer",this.idPrefix=i.idPrefix??"emf-",this.state={transform:[...T],fillStyle:"#000000",strokeStyle:"#000000",lineWidth:1,lineDash:[],lineDashOffset:0,lineCap:"butt",lineJoin:"miter",miterLimit:10,globalAlpha:1,gco:"source-over",font:"10px sans-serif",textAlign:"start",textBaseline:"alphabetic",imageSmoothingEnabled:true,clipId:null};}get canReadPixels(){return this.shadow!==null}get softShadow(){return this.shadow instanceof S?this.shadow:null}shadowAccepts(t){return t instanceof $?false:this.softShadow!==null||!R(t)}unknownPixels(t,e,i,n){let a=this.softShadow;return a?a.canvas.unknownIn(t,e,i,n):null}blendPatch(t,e,i,n,a,s){let r=this.softShadow,h=t.slice();if(r){let u=r.clipCoverage(e,i,n,a);if(u)for(let d=0;d<n*a;d++)h[d*4+3]=h[d*4+3]*u[d]/255;r.save(),r.setTransform(1,0,0,1,0,0),r.globalAlpha=1,r.globalCompositeOperation=s,r.imageSmoothingEnabled=false,r.drawImage({data:t,width:n,height:a},e,i),r.restore();}let l=this.imageNode({kind:"rgba",data:h,width:n,height:a},e,i,n,a,true);J.has(s)&&(l.attrs.style=`${l.attrs.style};mix-blend-mode:${s}`),this.body.push(l),this.group=null;}id(t){return `${this.idPrefix}${t}${this.nextId++}`}get fillStyle(){return this.state.fillStyle}set fillStyle(t){(typeof t=="string"||t instanceof N||t instanceof A)&&(this.state.fillStyle=t,this.forwardPaint("fillStyle",t));}get strokeStyle(){return this.state.strokeStyle}set strokeStyle(t){(typeof t=="string"||t instanceof N||t instanceof A)&&(this.state.strokeStyle=t,this.forwardPaint("strokeStyle",t));}forwardPaint(t,e){if(!this.shadow)return;let i=typeof e=="string"?e:e.real;i&&(this.shadow[t]=i);}get lineWidth(){return this.state.lineWidth}set lineWidth(t){Number.isFinite(t)&&t>0&&(this.state.lineWidth=t,this.shadow&&(this.shadow.lineWidth=t));}get lineCap(){return this.state.lineCap}set lineCap(t){this.state.lineCap=t,this.shadow&&(this.shadow.lineCap=t);}get lineJoin(){return this.state.lineJoin}set lineJoin(t){this.state.lineJoin=t,this.shadow&&(this.shadow.lineJoin=t);}get miterLimit(){return this.state.miterLimit}set miterLimit(t){Number.isFinite(t)&&t>0&&(this.state.miterLimit=t,this.shadow&&(this.shadow.miterLimit=t));}get lineDashOffset(){return this.state.lineDashOffset}set lineDashOffset(t){Number.isFinite(t)&&(this.state.lineDashOffset=t,this.shadow&&(this.shadow.lineDashOffset=t));}get globalAlpha(){return this.state.globalAlpha}set globalAlpha(t){Number.isFinite(t)&&t>=0&&t<=1&&(this.state.globalAlpha=t,this.shadow&&(this.shadow.globalAlpha=t));}get globalCompositeOperation(){return this.state.gco}set globalCompositeOperation(t){this.state.gco=t,this.shadow&&(this.shadow.globalCompositeOperation=t);}get font(){return this.state.font}set font(t){this.state.font=t,this.shadow&&(this.shadow.font=t);}get textAlign(){return this.state.textAlign}set textAlign(t){this.state.textAlign=t,this.shadow&&(this.shadow.textAlign=t);}get textBaseline(){return this.state.textBaseline}set textBaseline(t){this.state.textBaseline=t,this.shadow&&(this.shadow.textBaseline=t);}get imageSmoothingEnabled(){return this.state.imageSmoothingEnabled}set imageSmoothingEnabled(t){this.state.imageSmoothingEnabled=t,this.shadow&&(this.shadow.imageSmoothingEnabled=t);}setLineDash(t){!Array.isArray(t)||t.some(e=>!Number.isFinite(e)||e<0)||(this.state.lineDash=t.length%2?[...t,...t]:[...t],this.shadow?.setLineDash(t));}getLineDash(){return [...this.state.lineDash]}save(){this.stack.push({...this.state,transform:[...this.state.transform],lineDash:[...this.state.lineDash]}),this.shadow?.save();}restore(){let t=this.stack.pop();t&&(this.state=t),this.shadow?.restore();}getTransform(){let[t,e,i,n,a,s]=this.state.transform;return {a:t,b:e,c:i,d:n,e:a,f:s}}setTransform(t,e,i,n,a,s){[t,e,i,n,a,s].every(Number.isFinite)&&(this.state.transform=[t,e,i,n,a,s]),this.shadow?.setTransform(t,e,i,n,a,s);}resetTransform(){this.setTransform(1,0,0,1,0,0);}transform(t,e,i,n,a,s){[t,e,i,n,a,s].every(Number.isFinite)&&(this.state.transform=U(this.state.transform,[t,e,i,n,a,s])),this.shadow?.transform(t,e,i,n,a,s);}translate(t,e){this.transform(1,0,0,1,t,e);}scale(t,e){this.transform(t,0,0,e,0,0);}rotate(t){let e=Math.cos(t),i=Math.sin(t);this.transform(e,i,-i,e,0,0);}get path(){return this.pb.segs}map(t,e){let i=this.state.transform;return {x:i[0]*t+i[2]*e+i[4],y:i[1]*t+i[3]*e+i[5]}}beginPath(){this.pb.reset(),this.shadow?.beginPath();}moveTo(t,e){this.pb.moveTo(this.state.transform,t,e),this.shadow?.moveTo(t,e);}lineTo(t,e){this.pb.lineTo(this.state.transform,t,e),this.shadow?.lineTo(t,e);}bezierCurveTo(t,e,i,n,a,s){this.pb.bezierCurveTo(this.state.transform,t,e,i,n,a,s),this.shadow?.bezierCurveTo(t,e,i,n,a,s);}quadraticCurveTo(t,e,i,n){this.pb.quadraticCurveTo(this.state.transform,t,e,i,n),this.shadow?.quadraticCurveTo(t,e,i,n);}closePath(){this.pb.closePath(),this.shadow?.closePath();}rect(t,e,i,n){this.pb.rect(this.state.transform,t,e,i,n),this.shadow?.rect(t,e,i,n);}ellipse(t,e,i,n,a,s,r,h=false){this.pb.ellipse(this.state.transform,t,e,i,n,a,s,r,h),this.shadow?.ellipse(t,e,i,n,a,s,r,h);}arc(t,e,i,n,a,s=false){this.pb.arc(this.state.transform,t,e,i,n,a,s),this.shadow?.arc(t,e,i,n,a,s);}arcTo(t,e,i,n,a){this.shadow?.arcTo(t,e,i,n,a),this.pb.arcTo(this.state.transform,t,e,i,n,a);}isPointInPath(t,e,i="nonzero"){return this.shadow&&typeof this.shadow.isPointInPath=="function"?this.shadow.isPointInPath(t,e,i):N$1(M(this.path,.05),t,e,i)}emit(t){let e=this.state.clipId;if(!e){this.body.push(t),this.group=null;return}(!this.group||this.group.clipId!==e||this.body[this.body.length-1]!==this.group.node)&&(this.group={node:{tag:"g",attrs:{"clip-path":`url(#${e})`},children:[]},clipId:e},this.body.push(this.group.node)),this.group.node.children.push(t);}blendStyle(t){J.has(this.state.gco)&&(t.style=`mix-blend-mode:${this.state.gco}`);}define(t,e,i){let n=this.defKeys.get(t);if(n)return n;let a=this.id(e);return this.defKeys.set(t,a),this.defs.push(i(a)),a}resolvePaint(t,e){let i=this.state.globalAlpha;if(typeof t=="string"){let s=it(t),r=s.alpha*i;return r<=0?null:{value:s.color,opacity:r}}if(i<=0)return null;if(t instanceof N){if(t.stops.length===0)return null;let s=`g${t.uid}:${t.stops.length}:${e.join(",")}`;return {value:`url(#${this.define(s,"g",h=>this.gradientNode(t,h,e))})`,opacity:i}}let n=`p${t.uid}:${t.matrix.join(",")}:${e.join(",")}`;return {value:`url(#${this.define(n,"p",s=>this.patternNode(t,s,e))})`,opacity:i}}gradientNode(t,e,i){let n=t.coords,a=t.type==="linear"?{id:e,gradientUnits:"userSpaceOnUse",x1:c(n[0]),y1:c(n[1]),x2:c(n[2]),y2:c(n[3])}:{id:e,gradientUnits:"userSpaceOnUse",fx:c(n[0]),fy:c(n[1]),fr:c(n[2]),cx:c(n[3]),cy:c(n[4]),r:c(n[5])};P(i)||(a.gradientTransform=k(i));let s=[...t.stops].map((l,u)=>({...l,i:u})).sort((l,u)=>l.offset-u.offset||l.i-u.i),r=s.map(l=>l.offset);if(t.type==="linear"){let l=i[0]*(n[2]-n[0])+i[2]*(n[3]-n[1]),u=i[1]*(n[2]-n[0])+i[3]*(n[3]-n[1]),d=i[0]*n[0]+i[2]*n[1]+i[4],m=i[1]*n[0]+i[3]*n[1]+i[5],w=Math.hypot(l,u),g=w>0&&Math.abs(u)<1e-9*w,f=w>0&&Math.abs(l)<1e-9*w;if(g||f){let b=g?d:m,y=g?l:u;for(let v=1;v<s.length;v++){let p=s[v].offset;if(Math.abs(p-s[v-1].offset)>1e-9||p<=0||p>=1)continue;let S=b+p*y,x=Math.round(S-.5)+.5,C=S-x;if(Math.abs(C)>=.1)continue;let M=y>0?C>=0:C<0,q=(x+(M===y>0?.25:-0.25)-b)/y,ot=v>=2?r[v-2]:0,ht=v+1<s.length?s[v+1].offset:1,X=Math.min(Math.max(q,ot),ht);r[v-1]=X,r[v]=X;}}}let h=s.map((l,u)=>{let d=it(l.color),m={offset:String(Math.round(r[u]*1e6)/1e6),"stop-color":d.color};return d.alpha<1&&(m["stop-opacity"]=c(d.alpha)),{tag:"stop",attrs:m}});return {tag:t.type==="linear"?"linearGradient":"radialGradient",attrs:a,children:h}}patternNode(t,e,i){let n=U(i,t.matrix),a=t.width,s=t.height,r=et(n);if(r){let{width:m,height:w}=this.canvas;for(let[g,f]of [[0,0],[m,0],[0,w],[m,w]])a=Math.max(a,Math.abs(r[0]*g+r[2]*f+r[4])),s=Math.max(s,Math.abs(r[1]*g+r[3]*f+r[5]));}let h=t.repetition==="repeat"||t.repetition==="repeat-x"?t.width:Math.ceil(2*(a+t.width)+1),l=t.repetition==="repeat"||t.repetition==="repeat-y"?t.height:Math.ceil(2*(s+t.height)+1),u={id:e,patternUnits:"userSpaceOnUse",width:c(h),height:c(l)};P(n)||(u.patternTransform=k(n));let d=this.imageNode(t.payload,0,0,t.width,t.height,t.pixelated);return {tag:"pattern",attrs:u,children:[d]}}imageNode(t,e,i,n,a,s){let r={x:c(e),y:c(i),width:c(n),height:c(a),preserveAspectRatio:"none"};s&&(r["image-rendering"]="optimizeSpeed",r.style="image-rendering:pixelated");let h={tag:"image",attrs:r};return this.images.push({node:h,payload:t}),h}fillPath(t,e){if(t.length===0)return;let i=this.resolvePaint(this.state.fillStyle,this.state.transform);if(!i)return;let n={d:W(t,null),fill:i.value};i.opacity<1&&(n["fill-opacity"]=c(i.opacity)),e==="evenodd"&&(n["fill-rule"]="evenodd"),this.blendStyle(n),this.emit({tag:"path",attrs:n});}strokePath(t){if(t.length===0)return;let e=this.state.transform,i=et(e);if(!i)return;let n=this.resolvePaint(this.state.strokeStyle,T);if(!n)return;let a=this.state,s={d:W(t,P(e)?null:i,P(e)?2:dt(e)),fill:"none",stroke:n.value};n.opacity<1&&(s["stroke-opacity"]=c(n.opacity)),a.lineWidth!==1&&(s["stroke-width"]=c(a.lineWidth)),a.lineCap!=="butt"&&(s["stroke-linecap"]=a.lineCap),a.lineJoin!=="miter"?s["stroke-linejoin"]=a.lineJoin:s["stroke-miterlimit"]=c(a.miterLimit),a.lineDash.length&&(s["stroke-dasharray"]=a.lineDash.map(c).join(" "),a.lineDashOffset&&(s["stroke-dashoffset"]=c(a.lineDashOffset))),P(e)||(s.transform=k(e)),this.blendStyle(s),this.emit({tag:"path",attrs:s});}fill(t="nonzero"){this.fillPath(this.path,t),this.shadow?.fill(t);}stroke(){this.strokePath(this.path),this.shadow?.stroke();}rectSegs(t,e,i,n){let a=[this.map(t,e),this.map(t+i,e),this.map(t+i,e+n),this.map(t,e+n)];return [{t:"M",x:a[0].x,y:a[0].y},{t:"L",x:a[1].x,y:a[1].y},{t:"L",x:a[2].x,y:a[2].y},{t:"L",x:a[3].x,y:a[3].y},{t:"Z"}]}fillRect(t,e,i,n){[t,e,i,n].every(Number.isFinite)&&i!==0&&n!==0&&this.fillPath(this.rectSegs(t,e,i,n),"nonzero"),this.shadow?.fillRect(t,e,i,n);}strokeRect(t,e,i,n){[t,e,i,n].every(Number.isFinite)&&this.strokePath(this.rectSegs(t,e,i,n)),this.shadow?.strokeRect(t,e,i,n);}clearRect(t,e,i,n){this.shadow?.clearRect(t,e,i,n);}clip(t="nonzero"){let e=this.state.clipId,i=this.id("c"),n={id:i},a={d:W(this.path,null)||"M0 0"};e&&(a["clip-path"]=`url(#${e})`),t==="evenodd"&&(a["clip-rule"]="evenodd"),this.defs.push({tag:"clipPath",attrs:n,children:[{tag:"path",attrs:a}]}),this.state.clipId=i,this.shadow?.clip(t);}createLinearGradient(t,e,i,n){let a=this.shadow?this.shadow.createLinearGradient(t,e,i,n):null;return new N("linear",[t,e,i,n],a)}createRadialGradient(t,e,i,n,a,s){let r=this.shadow?this.shadow.createRadialGradient(t,e,i,n,a,s):null;return new N("radial",[t,e,i,n,a,s],r)}createPattern(t,e){let i=E(t),n=j(t);if(!i||!n)return null;let a=null;if(this.shadow&&this.shadowAccepts(t))try{a=this.shadow.createPattern.call(this.shadow,t,e??"repeat");}catch{a=null;}return new A(i,n.w,n.h,e||"repeat",a,!this.state.imageSmoothingEnabled)}fillWithTile(t,e,i,n,a,s){let r=new A({kind:"rgba",data:t.rgba,width:t.width,height:t.height},t.width,t.height,"repeat",null,true);r.matrix=[n,0,0,a,e,i];let h=this.state.fillStyle,l=this.state.transform;if(this.state.fillStyle=r,this.state.transform=[...T],this.fillPath(this.path,s),this.state.fillStyle=h,this.state.transform=l,this.softShadow){let u=new Q(t.width,t.height);u.ctx.putImageData({data:t.rgba,width:t.width,height:t.height},0,0);let d=this.softShadow.createPattern(u,"repeat");if(d){d.setTransform({a:n,b:0,c:0,d:a,e,f:i});let m=this.softShadow;m.save(),m.setTransform(1,0,0,1,0,0),m.imageSmoothingEnabled=false,m.fillStyle=d,m.fill(s),m.restore();}}else if(this.shadow){let u=Y(t.width,t.height);if(u&&!R(u.canvas)){la(u.ctx,na(t.rgba,t.width,t.height),0,0);let d=this.shadow.createPattern.call(this.shadow,u.canvas,"repeat");d&&(d.setTransform({a:n,b:0,c:0,d:a,e,f:i}),this.shadow.save(),this.shadow.setTransform(1,0,0,1,0,0),this.shadow.fillStyle=d,this.shadow.fill(s),this.shadow.restore());}}}measureText(t){let e=O(this.state.font).size;return {width:P$1(t,e)}}fillText(t,e,i,n){if(this.shadow?.fillText(t,e,i,n),!t||![e,i].every(Number.isFinite))return;let a=this.resolvePaint(this.state.fillStyle,T);if(!a)return;let s=O(this.state.font),r={x:c(e),y:c(i)},h=this.state.transform;P(h)||(r.transform=k(h)),r["font-family"]=s.family,r["font-size"]=c(s.size),s.weight&&(r["font-weight"]=s.weight),s.style&&(r["font-style"]=s.style);let l={center:"middle",right:"end",end:"end"}[this.state.textAlign];l&&(r["text-anchor"]=l);let u={top:"text-before-edge",hanging:"hanging",middle:"central",bottom:"text-after-edge",ideographic:"ideographic"}[this.state.textBaseline];u&&(r["dominant-baseline"]=u),r.fill=a.value,a.opacity<1&&(r["fill-opacity"]=c(a.opacity)),n!==void 0&&Number.isFinite(n)&&n>0&&this.measureText(t).width>n&&(r.textLength=c(n),r.lengthAdjust="spacingAndGlyphs"),/^\s|\s$|\s\s/.test(t)&&(r["xml:space"]="preserve"),this.blendStyle(r),this.emit({tag:"text",attrs:r,text:t});}fillGlyphRun(t){if(!t.text||t.xs.length===0)return;let e=this.resolvePaint(t.fill,T);if(!e)return;let i={x:t.xs.map(c).join(" "),y:t.ys.every(a=>a===t.ys[0])?c(t.ys[0]):t.ys.map(c).join(" ")},n=t.matrix?[...t.matrix]:null;if(t.scaleX&&t.scaleX!==1){let a=[t.scaleX,0,0,1,0,0];n=n?U(n,a):a,i.x=t.xs.map(s=>c(s/t.scaleX)).join(" ");}n&&!P(n)&&(i.transform=k(n)),i["font-family"]=t.fontFamily,i["font-size"]=c(t.fontSize),t.fontWeight&&t.fontWeight!==400&&(i["font-weight"]=String(t.fontWeight)),t.italic&&(i["font-style"]="italic"),t.aliased&&(i["text-rendering"]="optimizeSpeed"),i.fill=e.value,e.opacity<1&&(i["fill-opacity"]=c(e.opacity)),i["xml:space"]="preserve",this.blendStyle(i),this.emit({tag:"text",attrs:i,text:t.text});}drawImage(t,...e){if(this.softShadow){let d=t instanceof $?t.payload.kind==="rgba"?{data:t.payload.data,width:t.payload.width,height:t.payload.height}:null:t;d&&this.softShadow.drawImage(d,...e);}else if(this.shadow&&this.shadowAccepts(t))try{this.shadow.drawImage.call(this.shadow,t,...e);}catch{}else this.shadow&&R(t)&&this.mirrorSoftwareDraw(t,e);let i=j(t);if(!i)return;let n,a,s,r,h;if(e.length>=8){let[d,m,w,g]=e;if([,,,,a,s,r,h]=e,t instanceof Q){let f=Math.max(0,Math.floor(Math.min(d,d+w))),b=Math.max(0,Math.floor(Math.min(m,m+g))),y=Math.min(t.width,Math.ceil(Math.max(d,d+w))),v=Math.min(t.height,Math.ceil(Math.max(m,m+g)));n=y>f&&v>b?{kind:"rgba",data:t.readRgba(f,b,y-f,v-b),width:y-f,height:v-b}:null;}else {let f=E(t);n=f&&lt(f,d,m,w,g);}if(!n)return}else {if(n=E(t),!n)return;e.length>=4?[a,s,r,h]=e:([a,s]=e,r=i.w,h=i.h);}if(![a,s,r,h].every(Number.isFinite)||r===0||h===0||this.state.globalAlpha<=0)return;let l=this.imageNode(n,a,s,r,h,!this.state.imageSmoothingEnabled),u=this.state.transform;P(u)||(l.attrs.transform=k(u)),this.state.globalAlpha<1&&(l.attrs.opacity=c(this.state.globalAlpha)),J.has(this.state.gco)&&(l.attrs.style=`${l.attrs.style?`${l.attrs.style};`:""}mix-blend-mode:${this.state.gco}`),this.emit(l);}mirrorSoftwareDraw(t,e){let i=Y(t.width,t.height);!i||R(i.canvas)||!this.shadow||(la(i.ctx,na(t.pixels.slice(),t.width,t.height),0,0),this.shadow.drawImage.call(this.shadow,i.canvas,...e));}getImageData(t,e,i,n){return this.shadow?ka(this.shadow,t,e,i,n):na(new Uint8ClampedArray(Math.max(0,i*n*4)),i,n)}putImageData(t,e,i){let n=Math.round(e),a=Math.round(i),{width:s,height:r,data:h}=t,l=this.shadow?ka(this.shadow,n,a,s,r).data:null,u=s,d=r,m=-1,w=-1,g=new Uint8Array(s*r);for(let p=0;p<r;p++){let S=a+p;if(!(S<0||S>=this.canvas.height))for(let x=0;x<s;x++){let C=n+x;if(C<0||C>=this.canvas.width)continue;let M=(p*s+x)*4;(l?h[M]!==l[M]||h[M+1]!==l[M+1]||h[M+2]!==l[M+2]||h[M+3]!==l[M+3]:h[M+3]!==0)&&(g[p*s+x]=1,x<u&&(u=x),x>m&&(m=x),p<d&&(d=p),p>w&&(w=p));}}if(this.shadow&&la(this.shadow,t,n,a),m<0)return;let f=m-u+1,b=w-d+1,y=new Uint8ClampedArray(f*b*4);for(let p=0;p<b;p++)for(let S=0;S<f;S++){let x=(d+p)*s+(u+S);if(!g[x])continue;let C=(p*f+S)*4;y[C]=h[x*4],y[C+1]=h[x*4+1],y[C+2]=h[x*4+2],y[C+3]=h[x*4+3];}let v=this.imageNode({kind:"rgba",data:y,width:f,height:b},n+u,a+d,f,b,true);this.body.push(v),this.group=null;}reserveSlot(t){let e=this.softShadow;e&&t&&t.length>=6&&e.canvas.markUnknown(t,null);let i={tag:"g",attrs:{},children:[]};return this.emit(i),i}fillSlot(t,e,i,n,a,s,r){let h=this.imageNode(e,n,a,s,r,false);P(i)||(h.attrs.transform=k(i)),t.children.push(h);}fillSlotCropped(t,e,i,n,a,s,r,h){let l=this.imageNode(e,0,0,n.w,n.h,false),u=a<=0&&s<=0&&a+r>=n.w&&s+h>=n.h,d={tag:"g",attrs:{},children:[l]};if(P(i)||(d.attrs.transform=k(i)),!u){let m=this.id("c");this.defs.push({tag:"clipPath",attrs:{id:m},children:[{tag:"rect",attrs:{x:c(a),y:c(s),width:c(r),height:c(h)}}]}),l.attrs["clip-path"]=`url(#${m})`;}t.children.push(d);}async toTree(t={}){let e=new Map;for(let r of this.images){let h=e.get(r.payload);h===void 0&&(h=await ut(r.payload),e.set(r.payload,h)),r.node.attrs.href=h;}let{width:i,height:n}=this.canvas,a={xmlns:"http://www.w3.org/2000/svg"};(t.includeSize??true)&&(a.width=i,a.height=n),a.viewBox=`0 0 ${i} ${n}`,a.style="isolation:isolate";let s=[];this.defs.length&&s.push({tag:"defs",attrs:{},children:this.defs});for(let r of rt(this.body))s.push(r);return {tag:"svg",attrs:a,children:s}}};function rt(o){return o.filter(t=>t.tag==="g"&&t.children?(t.children=rt(t.children),t.children.length>0):true)}async function ut(o){switch(o.kind){case "url":return o.url;case "encoded":return `data:${o.mime};base64,${sa(o.bytes)}`;case "rgba":return `data:image/png;base64,${sa(await b(o.data,o.width,o.height))}`}}
2
2
  export{nt as SvgContext,N as SvgGradient,$ as SvgImageSource,A as SvgPattern,c as fmt,it as parseCssColor};