123456789101112131415 |
- import{bZ as qe,d as hs,g as ls,n as cs,bc as re,c as us,m as fs,Z as gs,f as ne,ai as ds,as as ps,$ as ys}from"./index-369af630.js";var pt={},ms={get exports(){return pt},set exports(l){pt=l}},ce={},_t={get exports(){return ce},set exports(l){ce=l}};(function(){var l,t,e,s,i,r;typeof performance<"u"&&performance!==null&&performance.now?_t.exports=function(){return performance.now()}:typeof process<"u"&&process!==null&&process.hrtime?(_t.exports=function(){return(l()-i)/1e6},t=process.hrtime,l=function(){var o;return o=t(),o[0]*1e9+o[1]},s=l(),r=process.uptime()*1e9,i=s-r):Date.now?(_t.exports=function(){return Date.now()-e},e=Date.now()):(_t.exports=function(){return new Date().getTime()-e},e=new Date().getTime())}).call(qe);var xs=ce,it=typeof window>"u"?qe:window,zt=["moz","webkit"],St="AnimationFrame",At=it["request"+St],Et=it["cancel"+St]||it["cancelRequest"+St];for(var Ct=0;!At&&Ct<zt.length;Ct++)At=it[zt[Ct]+"Request"+St],Et=it[zt[Ct]+"Cancel"+St]||it[zt[Ct]+"CancelRequest"+St];if(!At||!Et){var oe=0,Ee=0,gt=[],bs=1e3/60;At=function(l){if(gt.length===0){var t=xs(),e=Math.max(0,bs-(t-oe));oe=e+t,setTimeout(function(){var s=gt.slice(0);gt.length=0;for(var i=0;i<s.length;i++)if(!s[i].cancelled)try{s[i].callback(oe)}catch(r){setTimeout(function(){throw r},0)}},Math.round(e))}return gt.push({handle:++Ee,callback:l,cancelled:!1}),Ee},Et=function(l){for(var t=0;t<gt.length;t++)gt[t].handle===l&&(gt[t].cancelled=!0)}}ms.exports=function(l){return At.call(it,l)};pt.cancel=function(){Et.apply(it,arguments)};pt.polyfill=function(l){l||(l=it),l.requestAnimationFrame=At,l.cancelAnimationFrame=Et};var ue=function(l){this.ok=!1,this.alpha=1,l.charAt(0)=="#"&&(l=l.substr(1,6)),l=l.replace(/ /g,""),l=l.toLowerCase();var t={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};l=t[l]||l;for(var e=[{re:/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*((?:\d?\.)?\d)\)$/,example:["rgba(123, 234, 45, 0.8)","rgba(255,234,245,1.0)"],process:function(a){return[parseInt(a[1]),parseInt(a[2]),parseInt(a[3]),parseFloat(a[4])]}},{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(a){return[parseInt(a[1]),parseInt(a[2]),parseInt(a[3])]}},{re:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,example:["#00ff00","336699"],process:function(a){return[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16)]}},{re:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,example:["#fb0","f0f"],process:function(a){return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)]}}],s=0;s<e.length;s++){var i=e[s].re,r=e[s].process,o=i.exec(l);if(o){var n=r(o);this.r=n[0],this.g=n[1],this.b=n[2],n.length>3&&(this.alpha=n[3]),this.ok=!0}}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.alpha=this.alpha<0?0:this.alpha>1||isNaN(this.alpha)?1:this.alpha,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toRGBA=function(){return"rgba("+this.r+", "+this.g+", "+this.b+", "+this.alpha+")"},this.toHex=function(){var a=this.r.toString(16),h=this.g.toString(16),c=this.b.toString(16);return a.length==1&&(a="0"+a),h.length==1&&(h="0"+h),c.length==1&&(c="0"+c),"#"+a+h+c},this.getHelpXML=function(){for(var a=new Array,h=0;h<e.length;h++)for(var c=e[h].example,f=0;f<c.length;f++)a[a.length]=c[f];for(var g in t)a[a.length]=g;var u=document.createElement("ul");u.setAttribute("id","rgbcolor-examples");for(var h=0;h<a.length;h++)try{var d=document.createElement("li"),p=new RGBColor(a[h]),m=document.createElement("div");m.style.cssText="margin: 3px; border: 1px solid black; background:"+p.toHex()+"; color:"+p.toHex(),m.appendChild(document.createTextNode("test"));var x=document.createTextNode(" "+a[h]+" -> "+p.toRGB()+" -> "+p.toHex());d.appendChild(m),d.appendChild(x),u.appendChild(d)}catch(b){}return u}};/*! *****************************************************************************
- Copyright (c) Microsoft Corporation.
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted.
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
- ***************************************************************************** */var Qe=function(l,t){return(Qe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,s){e.__proto__=s}||function(e,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(e[i]=s[i])})(l,t)};function Ge(l,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=l}Qe(l,t),l.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function vs(l){var t="";Array.isArray(l)||(l=[l]);for(var e=0;e<l.length;e++){var s=l[e];if(s.type===y.CLOSE_PATH)t+="z";else if(s.type===y.HORIZ_LINE_TO)t+=(s.relative?"h":"H")+s.x;else if(s.type===y.VERT_LINE_TO)t+=(s.relative?"v":"V")+s.y;else if(s.type===y.MOVE_TO)t+=(s.relative?"m":"M")+s.x+" "+s.y;else if(s.type===y.LINE_TO)t+=(s.relative?"l":"L")+s.x+" "+s.y;else if(s.type===y.CURVE_TO)t+=(s.relative?"c":"C")+s.x1+" "+s.y1+" "+s.x2+" "+s.y2+" "+s.x+" "+s.y;else if(s.type===y.SMOOTH_CURVE_TO)t+=(s.relative?"s":"S")+s.x2+" "+s.y2+" "+s.x+" "+s.y;else if(s.type===y.QUAD_TO)t+=(s.relative?"q":"Q")+s.x1+" "+s.y1+" "+s.x+" "+s.y;else if(s.type===y.SMOOTH_QUAD_TO)t+=(s.relative?"t":"T")+s.x+" "+s.y;else{if(s.type!==y.ARC)throw new Error('Unexpected command type "'+s.type+'" at index '+e+".");t+=(s.relative?"a":"A")+s.rX+" "+s.rY+" "+s.xRot+" "+ +s.lArcFlag+" "+ +s.sweepFlag+" "+s.x+" "+s.y}}return t}function fe(l,t){var e=l[0],s=l[1];return[e*Math.cos(t)-s*Math.sin(t),e*Math.sin(t)+s*Math.cos(t)]}function K(){for(var l=[],t=0;t<arguments.length;t++)l[t]=arguments[t];for(var e=0;e<l.length;e++)if(typeof l[e]!="number")throw new Error("assertNumbers arguments["+e+"] is not a number. "+typeof l[e]+" == typeof "+l[e]);return!0}var ot=Math.PI;function ae(l,t,e){l.lArcFlag=l.lArcFlag===0?0:1,l.sweepFlag=l.sweepFlag===0?0:1;var s=l.rX,i=l.rY,r=l.x,o=l.y;s=Math.abs(l.rX),i=Math.abs(l.rY);var n=fe([(t-r)/2,(e-o)/2],-l.xRot/180*ot),a=n[0],h=n[1],c=Math.pow(a,2)/Math.pow(s,2)+Math.pow(h,2)/Math.pow(i,2);1<c&&(s*=Math.sqrt(c),i*=Math.sqrt(c)),l.rX=s,l.rY=i;var f=Math.pow(s,2)*Math.pow(h,2)+Math.pow(i,2)*Math.pow(a,2),g=(l.lArcFlag!==l.sweepFlag?1:-1)*Math.sqrt(Math.max(0,(Math.pow(s,2)*Math.pow(i,2)-f)/f)),u=s*h/i*g,d=-i*a/s*g,p=fe([u,d],l.xRot/180*ot);l.cX=p[0]+(t+r)/2,l.cY=p[1]+(e+o)/2,l.phi1=Math.atan2((h-d)/i,(a-u)/s),l.phi2=Math.atan2((-h-d)/i,(-a-u)/s),l.sweepFlag===0&&l.phi2>l.phi1&&(l.phi2-=2*ot),l.sweepFlag===1&&l.phi2<l.phi1&&(l.phi2+=2*ot),l.phi1*=180/ot,l.phi2*=180/ot}function Pe(l,t,e){K(l,t,e);var s=l*l+t*t-e*e;if(0>s)return[];if(s===0)return[[l*e/(l*l+t*t),t*e/(l*l+t*t)]];var i=Math.sqrt(s);return[[(l*e+t*i)/(l*l+t*t),(t*e-l*i)/(l*l+t*t)],[(l*e-t*i)/(l*l+t*t),(t*e+l*i)/(l*l+t*t)]]}var D,et=Math.PI/180;function Me(l,t,e){return(1-e)*l+e*t}function Ne(l,t,e,s){return l+Math.cos(s/180*ot)*t+Math.sin(s/180*ot)*e}function Oe(l,t,e,s){var i=1e-6,r=t-l,o=e-t,n=3*r+3*(s-e)-6*o,a=6*(o-r),h=3*r;return Math.abs(n)<i?[-h/a]:function(c,f,g){g===void 0&&(g=1e-6);var u=c*c/4-f;if(u<-g)return[];if(u<=g)return[-c/2];var d=Math.sqrt(u);return[-c/2-d,-c/2+d]}(a/n,h/n,i)}function Ve(l,t,e,s,i){var r=1-i;return l*(r*r*r)+t*(3*r*r*i)+e*(3*r*i*i)+s*(i*i*i)}(function(l){function t(){return i(function(n,a,h){return n.relative&&(n.x1!==void 0&&(n.x1+=a),n.y1!==void 0&&(n.y1+=h),n.x2!==void 0&&(n.x2+=a),n.y2!==void 0&&(n.y2+=h),n.x!==void 0&&(n.x+=a),n.y!==void 0&&(n.y+=h),n.relative=!1),n})}function e(){var n=NaN,a=NaN,h=NaN,c=NaN;return i(function(f,g,u){return f.type&y.SMOOTH_CURVE_TO&&(f.type=y.CURVE_TO,n=isNaN(n)?g:n,a=isNaN(a)?u:a,f.x1=f.relative?g-n:2*g-n,f.y1=f.relative?u-a:2*u-a),f.type&y.CURVE_TO?(n=f.relative?g+f.x2:f.x2,a=f.relative?u+f.y2:f.y2):(n=NaN,a=NaN),f.type&y.SMOOTH_QUAD_TO&&(f.type=y.QUAD_TO,h=isNaN(h)?g:h,c=isNaN(c)?u:c,f.x1=f.relative?g-h:2*g-h,f.y1=f.relative?u-c:2*u-c),f.type&y.QUAD_TO?(h=f.relative?g+f.x1:f.x1,c=f.relative?u+f.y1:f.y1):(h=NaN,c=NaN),f})}function s(){var n=NaN,a=NaN;return i(function(h,c,f){if(h.type&y.SMOOTH_QUAD_TO&&(h.type=y.QUAD_TO,n=isNaN(n)?c:n,a=isNaN(a)?f:a,h.x1=h.relative?c-n:2*c-n,h.y1=h.relative?f-a:2*f-a),h.type&y.QUAD_TO){n=h.relative?c+h.x1:h.x1,a=h.relative?f+h.y1:h.y1;var g=h.x1,u=h.y1;h.type=y.CURVE_TO,h.x1=((h.relative?0:c)+2*g)/3,h.y1=((h.relative?0:f)+2*u)/3,h.x2=(h.x+2*g)/3,h.y2=(h.y+2*u)/3}else n=NaN,a=NaN;return h})}function i(n){var a=0,h=0,c=NaN,f=NaN;return function(g){if(isNaN(c)&&!(g.type&y.MOVE_TO))throw new Error("path must start with moveto");var u=n(g,a,h,c,f);return g.type&y.CLOSE_PATH&&(a=c,h=f),g.x!==void 0&&(a=g.relative?a+g.x:g.x),g.y!==void 0&&(h=g.relative?h+g.y:g.y),g.type&y.MOVE_TO&&(c=a,f=h),u}}function r(n,a,h,c,f,g){return K(n,a,h,c,f,g),i(function(u,d,p,m){var x=u.x1,T=u.x2,b=u.relative&&!isNaN(m),v=u.x!==void 0?u.x:b?0:d,E=u.y!==void 0?u.y:b?0:p;function C(Z){return Z*Z}u.type&y.HORIZ_LINE_TO&&a!==0&&(u.type=y.LINE_TO,u.y=u.relative?0:p),u.type&y.VERT_LINE_TO&&h!==0&&(u.type=y.LINE_TO,u.x=u.relative?0:d),u.x!==void 0&&(u.x=u.x*n+E*h+(b?0:f)),u.y!==void 0&&(u.y=v*a+u.y*c+(b?0:g)),u.x1!==void 0&&(u.x1=u.x1*n+u.y1*h+(b?0:f)),u.y1!==void 0&&(u.y1=x*a+u.y1*c+(b?0:g)),u.x2!==void 0&&(u.x2=u.x2*n+u.y2*h+(b?0:f)),u.y2!==void 0&&(u.y2=T*a+u.y2*c+(b?0:g));var A=n*c-a*h;if(u.xRot!==void 0&&(n!==1||a!==0||h!==0||c!==1))if(A===0)delete u.rX,delete u.rY,delete u.xRot,delete u.lArcFlag,delete u.sweepFlag,u.type=y.LINE_TO;else{var N=u.xRot*Math.PI/180,R=Math.sin(N),z=Math.cos(N),F=1/C(u.rX),_=1/C(u.rY),X=C(z)*F+C(R)*_,B=2*R*z*(F-_),L=C(R)*F+C(z)*_,H=X*c*c-B*a*c+L*a*a,U=B*(n*c+a*h)-2*(X*h*c+L*n*a),G=X*h*h-B*n*h+L*n*n,k=(Math.atan2(U,H-G)+Math.PI)%Math.PI/2,O=Math.sin(k),Y=Math.cos(k);u.rX=Math.abs(A)/Math.sqrt(H*C(Y)+U*O*Y+G*C(O)),u.rY=Math.abs(A)/Math.sqrt(H*C(O)-U*O*Y+G*C(Y)),u.xRot=180*k/Math.PI}return u.sweepFlag!==void 0&&0>A&&(u.sweepFlag=+!u.sweepFlag),u})}function o(){return function(n){var a={};for(var h in n)a[h]=n[h];return a}}l.ROUND=function(n){function a(h){return Math.round(h*n)/n}return n===void 0&&(n=1e13),K(n),function(h){return h.x1!==void 0&&(h.x1=a(h.x1)),h.y1!==void 0&&(h.y1=a(h.y1)),h.x2!==void 0&&(h.x2=a(h.x2)),h.y2!==void 0&&(h.y2=a(h.y2)),h.x!==void 0&&(h.x=a(h.x)),h.y!==void 0&&(h.y=a(h.y)),h.rX!==void 0&&(h.rX=a(h.rX)),h.rY!==void 0&&(h.rY=a(h.rY)),h}},l.TO_ABS=t,l.TO_REL=function(){return i(function(n,a,h){return n.relative||(n.x1!==void 0&&(n.x1-=a),n.y1!==void 0&&(n.y1-=h),n.x2!==void 0&&(n.x2-=a),n.y2!==void 0&&(n.y2-=h),n.x!==void 0&&(n.x-=a),n.y!==void 0&&(n.y-=h),n.relative=!0),n})},l.NORMALIZE_HVZ=function(n,a,h){return n===void 0&&(n=!0),a===void 0&&(a=!0),h===void 0&&(h=!0),i(function(c,f,g,u,d){if(isNaN(u)&&!(c.type&y.MOVE_TO))throw new Error("path must start with moveto");return a&&c.type&y.HORIZ_LINE_TO&&(c.type=y.LINE_TO,c.y=c.relative?0:g),h&&c.type&y.VERT_LINE_TO&&(c.type=y.LINE_TO,c.x=c.relative?0:f),n&&c.type&y.CLOSE_PATH&&(c.type=y.LINE_TO,c.x=c.relative?u-f:u,c.y=c.relative?d-g:d),c.type&y.ARC&&(c.rX===0||c.rY===0)&&(c.type=y.LINE_TO,delete c.rX,delete c.rY,delete c.xRot,delete c.lArcFlag,delete c.sweepFlag),c})},l.NORMALIZE_ST=e,l.QT_TO_C=s,l.INFO=i,l.SANITIZE=function(n){n===void 0&&(n=0),K(n);var a=NaN,h=NaN,c=NaN,f=NaN;return i(function(g,u,d,p,m){var x=Math.abs,T=!1,b=0,v=0;if(g.type&y.SMOOTH_CURVE_TO&&(b=isNaN(a)?0:u-a,v=isNaN(h)?0:d-h),g.type&(y.CURVE_TO|y.SMOOTH_CURVE_TO)?(a=g.relative?u+g.x2:g.x2,h=g.relative?d+g.y2:g.y2):(a=NaN,h=NaN),g.type&y.SMOOTH_QUAD_TO?(c=isNaN(c)?u:2*u-c,f=isNaN(f)?d:2*d-f):g.type&y.QUAD_TO?(c=g.relative?u+g.x1:g.x1,f=g.relative?d+g.y1:g.y2):(c=NaN,f=NaN),g.type&y.LINE_COMMANDS||g.type&y.ARC&&(g.rX===0||g.rY===0||!g.lArcFlag)||g.type&y.CURVE_TO||g.type&y.SMOOTH_CURVE_TO||g.type&y.QUAD_TO||g.type&y.SMOOTH_QUAD_TO){var E=g.x===void 0?0:g.relative?g.x:g.x-u,C=g.y===void 0?0:g.relative?g.y:g.y-d;b=isNaN(c)?g.x1===void 0?b:g.relative?g.x:g.x1-u:c-u,v=isNaN(f)?g.y1===void 0?v:g.relative?g.y:g.y1-d:f-d;var A=g.x2===void 0?0:g.relative?g.x:g.x2-u,N=g.y2===void 0?0:g.relative?g.y:g.y2-d;x(E)<=n&&x(C)<=n&&x(b)<=n&&x(v)<=n&&x(A)<=n&&x(N)<=n&&(T=!0)}return g.type&y.CLOSE_PATH&&x(u-p)<=n&&x(d-m)<=n&&(T=!0),T?[]:g})},l.MATRIX=r,l.ROTATE=function(n,a,h){a===void 0&&(a=0),h===void 0&&(h=0),K(n,a,h);var c=Math.sin(n),f=Math.cos(n);return r(f,c,-c,f,a-a*f+h*c,h-a*c-h*f)},l.TRANSLATE=function(n,a){return a===void 0&&(a=0),K(n,a),r(1,0,0,1,n,a)},l.SCALE=function(n,a){return a===void 0&&(a=n),K(n,a),r(n,0,0,a,0,0)},l.SKEW_X=function(n){return K(n),r(1,0,Math.atan(n),1,0,0)},l.SKEW_Y=function(n){return K(n),r(1,Math.atan(n),0,1,0,0)},l.X_AXIS_SYMMETRY=function(n){return n===void 0&&(n=0),K(n),r(-1,0,0,1,n,0)},l.Y_AXIS_SYMMETRY=function(n){return n===void 0&&(n=0),K(n),r(1,0,0,-1,0,n)},l.A_TO_C=function(){return i(function(n,a,h){return y.ARC===n.type?function(c,f,g){var u,d,p,m;c.cX||ae(c,f,g);for(var x=Math.min(c.phi1,c.phi2),T=Math.max(c.phi1,c.phi2)-x,b=Math.ceil(T/90),v=new Array(b),E=f,C=g,A=0;A<b;A++){var N=Me(c.phi1,c.phi2,A/b),R=Me(c.phi1,c.phi2,(A+1)/b),z=R-N,F=4/3*Math.tan(z*et/4),_=[Math.cos(N*et)-F*Math.sin(N*et),Math.sin(N*et)+F*Math.cos(N*et)],X=_[0],B=_[1],L=[Math.cos(R*et),Math.sin(R*et)],H=L[0],U=L[1],G=[H+F*Math.sin(R*et),U-F*Math.cos(R*et)],k=G[0],O=G[1];v[A]={relative:c.relative,type:y.CURVE_TO};var Y=function(Z,tt){var nt=fe([Z*c.rX,tt*c.rY],c.xRot),xt=nt[0],Nt=nt[1];return[c.cX+xt,c.cY+Nt]};u=Y(X,B),v[A].x1=u[0],v[A].y1=u[1],d=Y(k,O),v[A].x2=d[0],v[A].y2=d[1],p=Y(H,U),v[A].x=p[0],v[A].y=p[1],c.relative&&(v[A].x1-=E,v[A].y1-=C,v[A].x2-=E,v[A].y2-=C,v[A].x-=E,v[A].y-=C),E=(m=[v[A].x,v[A].y])[0],C=m[1]}return v}(n,n.relative?0:a,n.relative?0:h):n})},l.ANNOTATE_ARCS=function(){return i(function(n,a,h){return n.relative&&(a=0,h=0),y.ARC===n.type&&ae(n,a,h),n})},l.CLONE=o,l.CALCULATE_BOUNDS=function(){var n=function(g){var u={};for(var d in g)u[d]=g[d];return u},a=t(),h=s(),c=e(),f=i(function(g,u,d){var p=c(h(a(n(g))));function m(O){O>f.maxX&&(f.maxX=O),O<f.minX&&(f.minX=O)}function x(O){O>f.maxY&&(f.maxY=O),O<f.minY&&(f.minY=O)}if(p.type&y.DRAWING_COMMANDS&&(m(u),x(d)),p.type&y.HORIZ_LINE_TO&&m(p.x),p.type&y.VERT_LINE_TO&&x(p.y),p.type&y.LINE_TO&&(m(p.x),x(p.y)),p.type&y.CURVE_TO){m(p.x),x(p.y);for(var T=0,b=Oe(u,p.x1,p.x2,p.x);T<b.length;T++)0<(k=b[T])&&1>k&&m(Ve(u,p.x1,p.x2,p.x,k));for(var v=0,E=Oe(d,p.y1,p.y2,p.y);v<E.length;v++)0<(k=E[v])&&1>k&&x(Ve(d,p.y1,p.y2,p.y,k))}if(p.type&y.ARC){m(p.x),x(p.y),ae(p,u,d);for(var C=p.xRot/180*Math.PI,A=Math.cos(C)*p.rX,N=Math.sin(C)*p.rX,R=-Math.sin(C)*p.rY,z=Math.cos(C)*p.rY,F=p.phi1<p.phi2?[p.phi1,p.phi2]:-180>p.phi2?[p.phi2+360,p.phi1+360]:[p.phi2,p.phi1],_=F[0],X=F[1],B=function(O){var Y=O[0],Z=O[1],tt=180*Math.atan2(Z,Y)/Math.PI;return tt<_?tt+360:tt},L=0,H=Pe(R,-A,0).map(B);L<H.length;L++)(k=H[L])>_&&k<X&&m(Ne(p.cX,A,R,k));for(var U=0,G=Pe(z,-N,0).map(B);U<G.length;U++){var k;(k=G[U])>_&&k<X&&x(Ne(p.cY,N,z,k))}}return g});return f.minX=1/0,f.maxX=-1/0,f.minY=1/0,f.maxY=-1/0,f}})(D||(D={}));var j,$e=function(){function l(){}return l.prototype.round=function(t){return this.transform(D.ROUND(t))},l.prototype.toAbs=function(){return this.transform(D.TO_ABS())},l.prototype.toRel=function(){return this.transform(D.TO_REL())},l.prototype.normalizeHVZ=function(t,e,s){return this.transform(D.NORMALIZE_HVZ(t,e,s))},l.prototype.normalizeST=function(){return this.transform(D.NORMALIZE_ST())},l.prototype.qtToC=function(){return this.transform(D.QT_TO_C())},l.prototype.aToC=function(){return this.transform(D.A_TO_C())},l.prototype.sanitize=function(t){return this.transform(D.SANITIZE(t))},l.prototype.translate=function(t,e){return this.transform(D.TRANSLATE(t,e))},l.prototype.scale=function(t,e){return this.transform(D.SCALE(t,e))},l.prototype.rotate=function(t,e,s){return this.transform(D.ROTATE(t,e,s))},l.prototype.matrix=function(t,e,s,i,r,o){return this.transform(D.MATRIX(t,e,s,i,r,o))},l.prototype.skewX=function(t){return this.transform(D.SKEW_X(t))},l.prototype.skewY=function(t){return this.transform(D.SKEW_Y(t))},l.prototype.xSymmetry=function(t){return this.transform(D.X_AXIS_SYMMETRY(t))},l.prototype.ySymmetry=function(t){return this.transform(D.Y_AXIS_SYMMETRY(t))},l.prototype.annotateArcs=function(){return this.transform(D.ANNOTATE_ARCS())},l}(),Ss=function(l){return l===" "||l===" "||l==="\r"||l===`
- `},ke=function(l){return"0".charCodeAt(0)<=l.charCodeAt(0)&&l.charCodeAt(0)<="9".charCodeAt(0)},Ts=function(l){function t(){var e=l.call(this)||this;return e.curNumber="",e.curCommandType=-1,e.curCommandRelative=!1,e.canParseCommandOrComma=!0,e.curNumberHasExp=!1,e.curNumberHasExpDigits=!1,e.curNumberHasDecimal=!1,e.curArgs=[],e}return Ge(t,l),t.prototype.finish=function(e){if(e===void 0&&(e=[]),this.parse(" ",e),this.curArgs.length!==0||!this.canParseCommandOrComma)throw new SyntaxError("Unterminated command at the path end.");return e},t.prototype.parse=function(e,s){var i=this;s===void 0&&(s=[]);for(var r=function(f){s.push(f),i.curArgs.length=0,i.canParseCommandOrComma=!0},o=0;o<e.length;o++){var n=e[o],a=!(this.curCommandType!==y.ARC||this.curArgs.length!==3&&this.curArgs.length!==4||this.curNumber.length!==1||this.curNumber!=="0"&&this.curNumber!=="1"),h=ke(n)&&(this.curNumber==="0"&&n==="0"||a);if(!ke(n)||h)if(n!=="e"&&n!=="E")if(n!=="-"&&n!=="+"||!this.curNumberHasExp||this.curNumberHasExpDigits)if(n!=="."||this.curNumberHasExp||this.curNumberHasDecimal||a){if(this.curNumber&&this.curCommandType!==-1){var c=Number(this.curNumber);if(isNaN(c))throw new SyntaxError("Invalid number ending at "+o);if(this.curCommandType===y.ARC){if(this.curArgs.length===0||this.curArgs.length===1){if(0>c)throw new SyntaxError('Expected positive number, got "'+c+'" at index "'+o+'"')}else if((this.curArgs.length===3||this.curArgs.length===4)&&this.curNumber!=="0"&&this.curNumber!=="1")throw new SyntaxError('Expected a flag, got "'+this.curNumber+'" at index "'+o+'"')}this.curArgs.push(c),this.curArgs.length===As[this.curCommandType]&&(y.HORIZ_LINE_TO===this.curCommandType?r({type:y.HORIZ_LINE_TO,relative:this.curCommandRelative,x:c}):y.VERT_LINE_TO===this.curCommandType?r({type:y.VERT_LINE_TO,relative:this.curCommandRelative,y:c}):this.curCommandType===y.MOVE_TO||this.curCommandType===y.LINE_TO||this.curCommandType===y.SMOOTH_QUAD_TO?(r({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),y.MOVE_TO===this.curCommandType&&(this.curCommandType=y.LINE_TO)):this.curCommandType===y.CURVE_TO?r({type:y.CURVE_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x2:this.curArgs[2],y2:this.curArgs[3],x:this.curArgs[4],y:this.curArgs[5]}):this.curCommandType===y.SMOOTH_CURVE_TO?r({type:y.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===y.QUAD_TO?r({type:y.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===y.ARC&&r({type:y.ARC,relative:this.curCommandRelative,rX:this.curArgs[0],rY:this.curArgs[1],xRot:this.curArgs[2],lArcFlag:this.curArgs[3],sweepFlag:this.curArgs[4],x:this.curArgs[5],y:this.curArgs[6]})),this.curNumber="",this.curNumberHasExpDigits=!1,this.curNumberHasExp=!1,this.curNumberHasDecimal=!1,this.canParseCommandOrComma=!0}if(!Ss(n))if(n===","&&this.canParseCommandOrComma)this.canParseCommandOrComma=!1;else if(n!=="+"&&n!=="-"&&n!==".")if(h)this.curNumber=n,this.curNumberHasDecimal=!1;else{if(this.curArgs.length!==0)throw new SyntaxError("Unterminated command at index "+o+".");if(!this.canParseCommandOrComma)throw new SyntaxError('Unexpected character "'+n+'" at index '+o+". Command cannot follow comma");if(this.canParseCommandOrComma=!1,n!=="z"&&n!=="Z")if(n==="h"||n==="H")this.curCommandType=y.HORIZ_LINE_TO,this.curCommandRelative=n==="h";else if(n==="v"||n==="V")this.curCommandType=y.VERT_LINE_TO,this.curCommandRelative=n==="v";else if(n==="m"||n==="M")this.curCommandType=y.MOVE_TO,this.curCommandRelative=n==="m";else if(n==="l"||n==="L")this.curCommandType=y.LINE_TO,this.curCommandRelative=n==="l";else if(n==="c"||n==="C")this.curCommandType=y.CURVE_TO,this.curCommandRelative=n==="c";else if(n==="s"||n==="S")this.curCommandType=y.SMOOTH_CURVE_TO,this.curCommandRelative=n==="s";else if(n==="q"||n==="Q")this.curCommandType=y.QUAD_TO,this.curCommandRelative=n==="q";else if(n==="t"||n==="T")this.curCommandType=y.SMOOTH_QUAD_TO,this.curCommandRelative=n==="t";else{if(n!=="a"&&n!=="A")throw new SyntaxError('Unexpected character "'+n+'" at index '+o+".");this.curCommandType=y.ARC,this.curCommandRelative=n==="a"}else s.push({type:y.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1}else this.curNumber=n,this.curNumberHasDecimal=n==="."}else this.curNumber+=n,this.curNumberHasDecimal=!0;else this.curNumber+=n;else this.curNumber+=n,this.curNumberHasExp=!0;else this.curNumber+=n,this.curNumberHasExpDigits=this.curNumberHasExp}return s},t.prototype.transform=function(e){return Object.create(this,{parse:{value:function(s,i){i===void 0&&(i=[]);for(var r=0,o=Object.getPrototypeOf(this).parse.call(this,s);r<o.length;r++){var n=o[r],a=e(n);Array.isArray(a)?i.push.apply(i,a):i.push(a)}return i}}})},t}($e),y=function(l){function t(e){var s=l.call(this)||this;return s.commands=typeof e=="string"?t.parse(e):e,s}return Ge(t,l),t.prototype.encode=function(){return t.encode(this.commands)},t.prototype.getBounds=function(){var e=D.CALCULATE_BOUNDS();return this.transform(e),e},t.prototype.transform=function(e){for(var s=[],i=0,r=this.commands;i<r.length;i++){var o=e(r[i]);Array.isArray(o)?s.push.apply(s,o):s.push(o)}return this.commands=s,this},t.encode=function(e){return vs(e)},t.parse=function(e){var s=new Ts,i=[];return s.parse(e,i),s.finish(i),i},t.CLOSE_PATH=1,t.MOVE_TO=2,t.HORIZ_LINE_TO=4,t.VERT_LINE_TO=8,t.LINE_TO=16,t.CURVE_TO=32,t.SMOOTH_CURVE_TO=64,t.QUAD_TO=128,t.SMOOTH_QUAD_TO=256,t.ARC=512,t.LINE_COMMANDS=t.LINE_TO|t.HORIZ_LINE_TO|t.VERT_LINE_TO,t.DRAWING_COMMANDS=t.HORIZ_LINE_TO|t.VERT_LINE_TO|t.LINE_TO|t.CURVE_TO|t.SMOOTH_CURVE_TO|t.QUAD_TO|t.SMOOTH_QUAD_TO|t.ARC,t}($e),As=((j={})[y.MOVE_TO]=2,j[y.LINE_TO]=2,j[y.HORIZ_LINE_TO]=1,j[y.VERT_LINE_TO]=1,j[y.CLOSE_PATH]=0,j[y.QUAD_TO]=4,j[y.SMOOTH_QUAD_TO]=2,j[y.CURVE_TO]=6,j[y.SMOOTH_CURVE_TO]=4,j[y.ARC]=7,j);function Xt(l){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Xt=function(t){return typeof t}:Xt=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xt(l)}function ws(l,t){if(!(l instanceof t))throw new TypeError("Cannot call a class as a function")}var Cs=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],Es=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function Ps(l,t,e,s,i){if(typeof l=="string"&&(l=document.getElementById(l)),!l||Xt(l)!=="object"||!("getContext"in l))throw new TypeError("Expecting canvas with `getContext` method in processCanvasRGB(A) calls!");var r=l.getContext("2d");try{return r.getImageData(t,e,s,i)}catch(o){throw new Error("unable to access image data: "+o)}}function Ms(l,t,e,s,i,r){if(!(isNaN(r)||r<1)){r|=0;var o=Ps(l,t,e,s,i);o=Ns(o,t,e,s,i,r),l.getContext("2d").putImageData(o,t,e)}}function Ns(l,t,e,s,i,r){for(var o=l.data,n=2*r+1,a=s-1,h=i-1,c=r+1,f=c*(c+1)/2,g=new Re,u=g,d,p=1;p<n;p++)u=u.next=new Re,p===c&&(d=u);u.next=g;for(var m=null,x=null,T=0,b=0,v=Cs[r],E=Es[r],C=0;C<i;C++){u=g;for(var A=o[b],N=o[b+1],R=o[b+2],z=o[b+3],F=0;F<c;F++)u.r=A,u.g=N,u.b=R,u.a=z,u=u.next;for(var _=0,X=0,B=0,L=0,H=c*A,U=c*N,G=c*R,k=c*z,O=f*A,Y=f*N,Z=f*R,tt=f*z,nt=1;nt<c;nt++){var xt=b+((a<nt?a:nt)<<2),Nt=o[xt],me=o[xt+1],xe=o[xt+2],be=o[xt+3],Ot=c-nt;O+=(u.r=Nt)*Ot,Y+=(u.g=me)*Ot,Z+=(u.b=xe)*Ot,tt+=(u.a=be)*Ot,_+=Nt,X+=me,B+=xe,L+=be,u=u.next}m=g,x=d;for(var qt=0;qt<s;qt++){var Qt=tt*v>>E;if(o[b+3]=Qt,Qt!==0){var Gt=255/Qt;o[b]=(O*v>>E)*Gt,o[b+1]=(Y*v>>E)*Gt,o[b+2]=(Z*v>>E)*Gt}else o[b]=o[b+1]=o[b+2]=0;O-=H,Y-=U,Z-=G,tt-=k,H-=m.r,U-=m.g,G-=m.b,k-=m.a;var lt=qt+r+1;lt=T+(lt<a?lt:a)<<2,_+=m.r=o[lt],X+=m.g=o[lt+1],B+=m.b=o[lt+2],L+=m.a=o[lt+3],O+=_,Y+=X,Z+=B,tt+=L,m=m.next;var Vt=x,ve=Vt.r,Se=Vt.g,Te=Vt.b,Ae=Vt.a;H+=ve,U+=Se,G+=Te,k+=Ae,_-=ve,X-=Se,B-=Te,L-=Ae,x=x.next,b+=4}T+=s}for(var bt=0;bt<s;bt++){b=bt<<2;var ct=o[b],ut=o[b+1],ft=o[b+2],q=o[b+3],$t=c*ct,Zt=c*ut,jt=c*ft,Kt=c*q,kt=f*ct,Rt=f*ut,Lt=f*ft,It=f*q;u=g;for(var we=0;we<c;we++)u.r=ct,u.g=ut,u.b=ft,u.a=q,u=u.next;for(var Ce=s,Jt=0,te=0,ee=0,se=0,Dt=1;Dt<=r;Dt++){b=Ce+bt<<2;var Bt=c-Dt;kt+=(u.r=ct=o[b])*Bt,Rt+=(u.g=ut=o[b+1])*Bt,Lt+=(u.b=ft=o[b+2])*Bt,It+=(u.a=q=o[b+3])*Bt,se+=ct,Jt+=ut,te+=ft,ee+=q,u=u.next,Dt<h&&(Ce+=s)}b=bt,m=g,x=d;for(var ie=0;ie<i;ie++){var Q=b<<2;o[Q+3]=q=It*v>>E,q>0?(q=255/q,o[Q]=(kt*v>>E)*q,o[Q+1]=(Rt*v>>E)*q,o[Q+2]=(Lt*v>>E)*q):o[Q]=o[Q+1]=o[Q+2]=0,kt-=$t,Rt-=Zt,Lt-=jt,It-=Kt,$t-=m.r,Zt-=m.g,jt-=m.b,Kt-=m.a,Q=bt+((Q=ie+c)<h?Q:h)*s<<2,kt+=se+=m.r=o[Q],Rt+=Jt+=m.g=o[Q+1],Lt+=te+=m.b=o[Q+2],It+=ee+=m.a=o[Q+3],m=m.next,$t+=ct=x.r,Zt+=ut=x.g,jt+=ft=x.b,Kt+=q=x.a,se-=ct,Jt-=ut,te-=ft,ee-=q,x=x.next,b+=s}}return l}var Re=function l(){ws(this,l),this.r=0,this.g=0,this.b=0,this.a=0,this.next=null};function wt(l){return l.replace(/(?!\u3000)\s+/gm," ")}function Os(l){return l.replace(/^[\n \t]+/,"")}function Vs(l){return l.replace(/[\n \t]+$/,"")}function $(l){const t=l.match(/-?(\d+(?:\.\d*(?:[eE][+-]?\d+)?)?|\.\d+)(?=\D|$)/gm);return t?t.map(parseFloat):[]}function ks(l){const t=$(l);return[t[0]||0,t[1]||0,t[2]||0,t[3]||0,t[4]||0,t[5]||0]}const Rs=/^[A-Z-]+$/;function Ls(l){return Rs.test(l)?l.toLowerCase():l}function Ze(l){const t=/url\(('([^']+)'|"([^"]+)"|([^'")]+))\)/.exec(l);return t&&(t[2]||t[3]||t[4])||""}function Is(l){if(!l.startsWith("rgb"))return l;let t=3;return l.replace(/\d+(\.\d+)?/g,(s,i)=>t--&&i?String(Math.round(parseFloat(s))):s)}const Ds=/(\[[^\]]+\])/g,Bs=/(#[^\s+>~.[:]+)/g,_s=/(\.[^\s+>~.[:]+)/g,zs=/(::[^\s+>~.[:]+|:first-line|:first-letter|:before|:after)/gi,Fs=/(:[\w-]+\([^)]*\))/gi,Us=/(:[^\s+>~.[:]+)/g,Xs=/([^\s+>~.[:]+)/g;function dt(l,t){const e=t.exec(l);return e?[l.replace(t," "),e.length]:[l,0]}function Hs(l){const t=[0,0,0];let e=l.replace(/:not\(([^)]*)\)/g," $1 ").replace(/{[\s\S]*/gm," "),s=0;return[e,s]=dt(e,Ds),t[1]+=s,[e,s]=dt(e,Bs),t[0]+=s,[e,s]=dt(e,_s),t[1]+=s,[e,s]=dt(e,zs),t[2]+=s,[e,s]=dt(e,Fs),t[1]+=s,[e,s]=dt(e,Us),t[1]+=s,e=e.replace(/[*\s+>~]/g," ").replace(/[#.]/g," "),[e,s]=dt(e,Xs),t[2]+=s,t.join("")}const Tt=1e-8;function Le(l){return Math.sqrt(Math.pow(l[0],2)+Math.pow(l[1],2))}function ge(l,t){return(l[0]*t[0]+l[1]*t[1])/(Le(l)*Le(t))}function Ie(l,t){return(l[0]*t[1]<l[1]*t[0]?-1:1)*Math.acos(ge(l,t))}function De(l){return l*l*l}function Be(l){return 3*l*l*(1-l)}function _e(l){return 3*l*(1-l)*(1-l)}function ze(l){return(1-l)*(1-l)*(1-l)}function Fe(l){return l*l}function Ue(l){return 2*l*(1-l)}function Xe(l){return(1-l)*(1-l)}class S{static empty(t){return new S(t,"EMPTY","")}split(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:" ";const{document:e,name:s}=this;return wt(this.getString()).trim().split(t).map(i=>new S(e,s,i))}hasValue(t){const e=this.value;return e!==null&&e!==""&&(t||e!==0)&&typeof e<"u"}isString(t){const{value:e}=this,s=typeof e=="string";return!s||!t?s:t.test(e)}isUrlDefinition(){return this.isString(/^url\(/)}isPixels(){if(!this.hasValue())return!1;const t=this.getString();switch(!0){case t.endsWith("px"):case/^[0-9]+$/.test(t):return!0;default:return!1}}setValue(t){return this.value=t,this}getValue(t){return typeof t>"u"||this.hasValue()?this.value:t}getNumber(t){if(!this.hasValue())return typeof t>"u"?0:parseFloat(t);const{value:e}=this;let s=parseFloat(e);return this.isString(/%$/)&&(s/=100),s}getString(t){return typeof t>"u"||this.hasValue()?typeof this.value>"u"?"":String(this.value):String(t)}getColor(t){let e=this.getString(t);return this.isNormalizedColor||(this.isNormalizedColor=!0,e=Is(e),this.value=e),e}getDpi(){return 96}getRem(){return this.document.rootEmSize}getEm(){return this.document.emSize}getUnits(){return this.getString().replace(/[0-9.-]/g,"")}getPixels(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(!this.hasValue())return 0;const[s,i]=typeof t=="boolean"?[void 0,t]:[t],{viewPort:r}=this.document.screen;switch(!0){case this.isString(/vmin$/):return this.getNumber()/100*Math.min(r.computeSize("x"),r.computeSize("y"));case this.isString(/vmax$/):return this.getNumber()/100*Math.max(r.computeSize("x"),r.computeSize("y"));case this.isString(/vw$/):return this.getNumber()/100*r.computeSize("x");case this.isString(/vh$/):return this.getNumber()/100*r.computeSize("y");case this.isString(/rem$/):return this.getNumber()*this.getRem();case this.isString(/em$/):return this.getNumber()*this.getEm();case this.isString(/ex$/):return this.getNumber()*this.getEm()/2;case this.isString(/px$/):return this.getNumber();case this.isString(/pt$/):return this.getNumber()*this.getDpi()*(1/72);case this.isString(/pc$/):return this.getNumber()*15;case this.isString(/cm$/):return this.getNumber()*this.getDpi()/2.54;case this.isString(/mm$/):return this.getNumber()*this.getDpi()/25.4;case this.isString(/in$/):return this.getNumber()*this.getDpi();case(this.isString(/%$/)&&i):return this.getNumber()*this.getEm();case this.isString(/%$/):return this.getNumber()*r.computeSize(s);default:{const o=this.getNumber();return e&&o<1?o*r.computeSize(s):o}}}getMilliseconds(){return this.hasValue()?this.isString(/ms$/)?this.getNumber():this.getNumber()*1e3:0}getRadians(){if(!this.hasValue())return 0;switch(!0){case this.isString(/deg$/):return this.getNumber()*(Math.PI/180);case this.isString(/grad$/):return this.getNumber()*(Math.PI/200);case this.isString(/rad$/):return this.getNumber();default:return this.getNumber()*(Math.PI/180)}}getDefinition(){const t=this.getString(),e=/#([^)'"]+)/.exec(t),s=(e==null?void 0:e[1])||t;return this.document.definitions[s]}getFillStyleDefinition(t,e){let s=this.getDefinition();if(!s)return null;if(typeof s.createGradient=="function"&&"getBoundingBox"in t)return s.createGradient(this.document.ctx,t,e);if(typeof s.createPattern=="function"){if(s.getHrefAttribute().hasValue()){const i=s.getAttribute("patternTransform");s=s.getHrefAttribute().getDefinition(),s&&i.hasValue()&&s.getAttribute("patternTransform",!0).setValue(i.value)}if(s)return s.createPattern(this.document.ctx,t,e)}return null}getTextBaseline(){if(!this.hasValue())return null;const t=this.getString();return S.textBaselineMapping[t]||null}addOpacity(t){let e=this.getColor();const s=e.length;let i=0;for(let r=0;r<s&&(e[r]===","&&i++,i!==3);r++);if(t.hasValue()&&this.isString()&&i!==3){const r=new ue(e);r.ok&&(r.alpha=t.getNumber(),e=r.toRGBA())}return new S(this.document,this.name,e)}constructor(t,e,s){this.document=t,this.name=e,this.value=s,this.isNormalizedColor=!1}}S.textBaselineMapping={baseline:"alphabetic","before-edge":"top","text-before-edge":"top",middle:"middle",central:"middle","after-edge":"bottom","text-after-edge":"bottom",ideographic:"ideographic",alphabetic:"alphabetic",hanging:"hanging",mathematical:"alphabetic"};class Pt{clear(){this.viewPorts=[]}setCurrent(t,e){this.viewPorts.push({width:t,height:e})}removeCurrent(){this.viewPorts.pop()}getRoot(){const[t]=this.viewPorts;return t||He()}getCurrent(){const{viewPorts:t}=this,e=t[t.length-1];return e||He()}get width(){return this.getCurrent().width}get height(){return this.getCurrent().height}computeSize(t){return typeof t=="number"?t:t==="x"?this.width:t==="y"?this.height:Math.sqrt(Math.pow(this.width,2)+Math.pow(this.height,2))/Math.sqrt(2)}constructor(){this.viewPorts=[]}}Pt.DEFAULT_VIEWPORT_WIDTH=800;Pt.DEFAULT_VIEWPORT_HEIGHT=600;function He(){return{width:Pt.DEFAULT_VIEWPORT_WIDTH,height:Pt.DEFAULT_VIEWPORT_HEIGHT}}class V{static parse(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;const[s=e,i=e]=$(t);return new V(s,i)}static parseScale(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;const[s=e,i=s]=$(t);return new V(s,i)}static parsePath(t){const e=$(t),s=e.length,i=[];for(let r=0;r<s;r+=2)i.push(new V(e[r],e[r+1]));return i}angleTo(t){return Math.atan2(t.y-this.y,t.x-this.x)}applyTransform(t){const{x:e,y:s}=this,i=e*t[0]+s*t[2]+t[4],r=e*t[1]+s*t[3]+t[5];this.x=i,this.y=r}constructor(t,e){this.x=t,this.y=e}}class Ys{isWorking(){return this.working}start(){if(this.working)return;const{screen:t,onClick:e,onMouseMove:s}=this,i=t.ctx.canvas;i.onclick=e,i.onmousemove=s,this.working=!0}stop(){if(!this.working)return;const t=this.screen.ctx.canvas;this.working=!1,t.onclick=null,t.onmousemove=null}hasEvents(){return this.working&&this.events.length>0}runEvents(){if(!this.working)return;const{screen:t,events:e,eventElements:s}=this,{style:i}=t.ctx.canvas;let r;i&&(i.cursor=""),e.forEach((o,n)=>{let{run:a}=o;for(r=s[n];r;)a(r),r=r.parent}),this.events=[],this.eventElements=[]}checkPath(t,e){if(!this.working||!e)return;const{events:s,eventElements:i}=this;s.forEach((r,o)=>{let{x:n,y:a}=r;!i[o]&&e.isPointInPath&&e.isPointInPath(n,a)&&(i[o]=t)})}checkBoundingBox(t,e){if(!this.working||!e)return;const{events:s,eventElements:i}=this;s.forEach((r,o)=>{let{x:n,y:a}=r;!i[o]&&e.isPointInBox(n,a)&&(i[o]=t)})}mapXY(t,e){const{window:s,ctx:i}=this.screen,r=new V(t,e);let o=i.canvas;for(;o;)r.x-=o.offsetLeft,r.y-=o.offsetTop,o=o.offsetParent;return s!=null&&s.scrollX&&(r.x+=s.scrollX),s!=null&&s.scrollY&&(r.y+=s.scrollY),r}onClick(t){const{x:e,y:s}=this.mapXY(t.clientX,t.clientY);this.events.push({type:"onclick",x:e,y:s,run(i){i.onClick&&i.onClick()}})}onMouseMove(t){const{x:e,y:s}=this.mapXY(t.clientX,t.clientY);this.events.push({type:"onmousemove",x:e,y:s,run(i){i.onMouseMove&&i.onMouseMove()}})}constructor(t){this.screen=t,this.working=!1,this.events=[],this.eventElements=[],this.onClick=this.onClick.bind(this),this.onMouseMove=this.onMouseMove.bind(this)}}const je=typeof window<"u"?window:null,Ke=typeof fetch<"u"?fetch.bind(void 0):void 0;class rt{wait(t){this.waits.push(t)}ready(){return this.readyPromise?this.readyPromise:Promise.resolve()}isReady(){if(this.isReadyLock)return!0;const t=this.waits.every(e=>e());return t&&(this.waits=[],this.resolveReady&&this.resolveReady()),this.isReadyLock=t,t}setDefaults(t){t.strokeStyle="rgba(0,0,0,0)",t.lineCap="butt",t.lineJoin="miter",t.miterLimit=4}setViewBox(t){let{document:e,ctx:s,aspectRatio:i,width:r,desiredWidth:o,height:n,desiredHeight:a,minX:h=0,minY:c=0,refX:f,refY:g,clip:u=!1,clipX:d=0,clipY:p=0}=t;const m=wt(i).replace(/^defer\s/,""),[x,T]=m.split(" "),b=x||"xMidYMid",v=T||"meet",E=r/o,C=n/a,A=Math.min(E,C),N=Math.max(E,C);let R=o,z=a;v==="meet"&&(R*=A,z*=A),v==="slice"&&(R*=N,z*=N);const F=new S(e,"refX",f),_=new S(e,"refY",g),X=F.hasValue()&&_.hasValue();if(X&&s.translate(-A*F.getPixels("x"),-A*_.getPixels("y")),u){const B=A*d,L=A*p;s.beginPath(),s.moveTo(B,L),s.lineTo(r,L),s.lineTo(r,n),s.lineTo(B,n),s.closePath(),s.clip()}if(!X){const B=v==="meet"&&A===C,L=v==="slice"&&N===C,H=v==="meet"&&A===E,U=v==="slice"&&N===E;b.startsWith("xMid")&&(B||L)&&s.translate(r/2-R/2,0),b.endsWith("YMid")&&(H||U)&&s.translate(0,n/2-z/2),b.startsWith("xMax")&&(B||L)&&s.translate(r-R,0),b.endsWith("YMax")&&(H||U)&&s.translate(0,n-z)}switch(!0){case b==="none":s.scale(E,C);break;case v==="meet":s.scale(A,A);break;case v==="slice":s.scale(N,N);break}s.translate(-h,-c)}start(t){let{enableRedraw:e=!1,ignoreMouse:s=!1,ignoreAnimation:i=!1,ignoreDimensions:r=!1,ignoreClear:o=!1,forceRedraw:n,scaleWidth:a,scaleHeight:h,offsetX:c,offsetY:f}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{mouse:g}=this,u=1e3/rt.FRAMERATE;if(this.isReadyLock=!1,this.frameDuration=u,this.readyPromise=new Promise(T=>{this.resolveReady=T}),this.isReady()&&this.render(t,r,o,a,h,c,f),!e)return;let d=Date.now(),p=d,m=0;const x=()=>{d=Date.now(),m=d-p,m>=u&&(p=d-m%u,this.shouldUpdate(i,n)&&(this.render(t,r,o,a,h,c,f),g.runEvents())),this.intervalId=pt(x)};s||g.start(),this.intervalId=pt(x)}stop(){this.intervalId&&(pt.cancel(this.intervalId),this.intervalId=null),this.mouse.stop()}shouldUpdate(t,e){if(!t){const{frameDuration:s}=this;if(this.animations.reduce((r,o)=>o.update(s)||r,!1))return!0}return!!(typeof e=="function"&&e()||!this.isReadyLock&&this.isReady()||this.mouse.hasEvents())}render(t,e,s,i,r,o,n){const{viewPort:a,ctx:h,isFirstRender:c}=this,f=h.canvas;a.clear(),f.width&&f.height&&a.setCurrent(f.width,f.height);const g=t.getStyle("width"),u=t.getStyle("height");!e&&(c||typeof i!="number"&&typeof r!="number")&&(g.hasValue()&&(f.width=g.getPixels("x"),f.style&&(f.style.width="".concat(f.width,"px"))),u.hasValue()&&(f.height=u.getPixels("y"),f.style&&(f.style.height="".concat(f.height,"px"))));let d=f.clientWidth||f.width,p=f.clientHeight||f.height;if(e&&g.hasValue()&&u.hasValue()&&(d=g.getPixels("x"),p=u.getPixels("y")),a.setCurrent(d,p),typeof o=="number"&&t.getAttribute("x",!0).setValue(o),typeof n=="number"&&t.getAttribute("y",!0).setValue(n),typeof i=="number"||typeof r=="number"){const m=$(t.getAttribute("viewBox").getString());let x=0,T=0;if(typeof i=="number"){const v=t.getStyle("width");v.hasValue()?x=v.getPixels("x")/i:m[2]&&!isNaN(m[2])&&(x=m[2]/i)}if(typeof r=="number"){const v=t.getStyle("height");v.hasValue()?T=v.getPixels("y")/r:m[3]&&!isNaN(m[3])&&(T=m[3]/r)}x||(x=T),T||(T=x),t.getAttribute("width",!0).setValue(i),t.getAttribute("height",!0).setValue(r);const b=t.getStyle("transform",!0,!0);b.setValue("".concat(b.getString()," scale(").concat(1/x,", ").concat(1/T,")"))}s||h.clearRect(0,0,d,p),t.render(h),c&&(this.isFirstRender=!1)}constructor(t,{fetch:e=Ke,window:s=je}={}){if(this.ctx=t,this.viewPort=new Pt,this.mouse=new Ys(this),this.animations=[],this.waits=[],this.frameDuration=0,this.isReadyLock=!1,this.isFirstRender=!0,this.intervalId=null,this.window=s,!e)throw new Error("Can't find 'fetch' in 'globalThis', please provide it via options");this.fetch=e}}rt.defaultWindow=je;rt.defaultFetch=Ke;rt.FRAMERATE=30;rt.MAX_VIRTUAL_PIXELS=3e4;const{defaultFetch:Ws}=rt,qs=typeof DOMParser<"u"?DOMParser:void 0;class he{async parse(t){return t.startsWith("<")?this.parseFromString(t):this.load(t)}parseFromString(t){const e=new this.DOMParser;try{return this.checkDocument(e.parseFromString(t,"image/svg+xml"))}catch(s){return this.checkDocument(e.parseFromString(t,"text/xml"))}}checkDocument(t){const e=t.getElementsByTagName("parsererror")[0];if(e)throw new Error(e.textContent||"Unknown parse error");return t}async load(t){const s=await(await this.fetch(t)).text();return this.parseFromString(s)}constructor({fetch:t=Ws,DOMParser:e=qs}={}){if(!t)throw new Error("Can't find 'fetch' in 'globalThis', please provide it via options");if(!e)throw new Error("Can't find 'DOMParser' in 'globalThis', please provide it via options");this.fetch=t,this.DOMParser=e}}class Qs{apply(t){const{x:e,y:s}=this.point;t.translate(e||0,s||0)}unapply(t){const{x:e,y:s}=this.point;t.translate(-1*e||0,-1*s||0)}applyToPoint(t){const{x:e,y:s}=this.point;t.applyTransform([1,0,0,1,e||0,s||0])}constructor(t,e){this.type="translate",this.point=V.parse(e)}}class Gs{apply(t){const{cx:e,cy:s,originX:i,originY:r,angle:o}=this,n=e+i.getPixels("x"),a=s+r.getPixels("y");t.translate(n,a),t.rotate(o.getRadians()),t.translate(-n,-a)}unapply(t){const{cx:e,cy:s,originX:i,originY:r,angle:o}=this,n=e+i.getPixels("x"),a=s+r.getPixels("y");t.translate(n,a),t.rotate(-1*o.getRadians()),t.translate(-n,-a)}applyToPoint(t){const{cx:e,cy:s,angle:i}=this,r=i.getRadians();t.applyTransform([1,0,0,1,e||0,s||0]),t.applyTransform([Math.cos(r),Math.sin(r),-Math.sin(r),Math.cos(r),0,0]),t.applyTransform([1,0,0,1,-e||0,-s||0])}constructor(t,e,s){this.type="rotate";const i=$(e);this.angle=new S(t,"angle",i[0]),this.originX=s[0],this.originY=s[1],this.cx=i[1]||0,this.cy=i[2]||0}}class $s{apply(t){const{scale:{x:e,y:s},originX:i,originY:r}=this,o=i.getPixels("x"),n=r.getPixels("y");t.translate(o,n),t.scale(e,s||e),t.translate(-o,-n)}unapply(t){const{scale:{x:e,y:s},originX:i,originY:r}=this,o=i.getPixels("x"),n=r.getPixels("y");t.translate(o,n),t.scale(1/e,1/s||e),t.translate(-o,-n)}applyToPoint(t){const{x:e,y:s}=this.scale;t.applyTransform([e||0,0,0,s||0,0,0])}constructor(t,e,s){this.type="scale";const i=V.parseScale(e);(i.x===0||i.y===0)&&(i.x=Tt,i.y=Tt),this.scale=i,this.originX=s[0],this.originY=s[1]}}class Je{apply(t){const{originX:e,originY:s,matrix:i}=this,r=e.getPixels("x"),o=s.getPixels("y");t.translate(r,o),t.transform(i[0],i[1],i[2],i[3],i[4],i[5]),t.translate(-r,-o)}unapply(t){const{originX:e,originY:s,matrix:i}=this,r=i[0],o=i[2],n=i[4],a=i[1],h=i[3],c=i[5],f=0,g=0,u=1,d=1/(r*(h*u-c*g)-o*(a*u-c*f)+n*(a*g-h*f)),p=e.getPixels("x"),m=s.getPixels("y");t.translate(p,m),t.transform(d*(h*u-c*g),d*(c*f-a*u),d*(n*g-o*u),d*(r*u-n*f),d*(o*c-n*h),d*(n*a-r*c)),t.translate(-p,-m)}applyToPoint(t){t.applyTransform(this.matrix)}constructor(t,e,s){this.type="matrix",this.matrix=ks(e),this.originX=s[0],this.originY=s[1]}}class ts extends Je{constructor(t,e,s){super(t,e,s),this.type="skew",this.angle=new S(t,"angle",e)}}class Zs extends ts{constructor(t,e,s){super(t,e,s),this.type="skewX",this.matrix=[1,0,Math.tan(this.angle.getRadians()),1,0,0]}}class js extends ts{constructor(t,e,s){super(t,e,s),this.type="skewY",this.matrix=[1,Math.tan(this.angle.getRadians()),0,1,0,0]}}function Ks(l){return wt(l).trim().replace(/\)([a-zA-Z])/g,") $1").replace(/\)(\s?,\s?)/g,") ").split(/\s(?=[a-z])/)}function Js(l){const[t="",e=""]=l.split("(");return[t.trim(),e.trim().replace(")","")]}class yt{static fromElement(t,e){const s=e.getStyle("transform",!1,!0);if(s.hasValue()){const[i,r=i]=e.getStyle("transform-origin",!1,!0).split();if(i&&r){const o=[i,r];return new yt(t,s.getString(),o)}}return null}apply(t){this.transforms.forEach(e=>e.apply(t))}unapply(t){this.transforms.forEach(e=>e.unapply(t))}applyToPoint(t){this.transforms.forEach(e=>e.applyToPoint(t))}constructor(t,e,s){this.document=t,this.transforms=[],Ks(e).forEach(r=>{if(r==="none")return;const[o,n]=Js(r),a=yt.transformTypes[o];a&&this.transforms.push(new a(this.document,n,s))})}}yt.transformTypes={translate:Qs,rotate:Gs,scale:$s,matrix:Je,skewX:Zs,skewY:js};class M{getAttribute(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const s=this.attributes[t];if(!s&&e){const i=new S(this.document,t,"");return this.attributes[t]=i,i}return s||S.empty(this.document)}getHrefAttribute(){let t;for(const e in this.attributes)if(e==="href"||e.endsWith(":href")){t=this.attributes[e];break}return t||S.empty(this.document)}getStyle(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const i=this.styles[t];if(i)return i;const r=this.getAttribute(t);if(r.hasValue())return this.styles[t]=r,r;if(!s){const{parent:o}=this;if(o){const n=o.getStyle(t);if(n.hasValue())return n}}if(e){const o=new S(this.document,t,"");return this.styles[t]=o,o}return S.empty(this.document)}render(t){if(!(this.getStyle("display").getString()==="none"||this.getStyle("visibility").getString()==="hidden")){if(t.save(),this.getStyle("mask").hasValue()){const e=this.getStyle("mask").getDefinition();e&&(this.applyEffects(t),e.apply(t,this))}else if(this.getStyle("filter").getValue("none")!=="none"){const e=this.getStyle("filter").getDefinition();e&&(this.applyEffects(t),e.apply(t,this))}else this.setContext(t),this.renderChildren(t),this.clearContext(t);t.restore()}}setContext(t){}applyEffects(t){const e=yt.fromElement(this.document,this);e&&e.apply(t);const s=this.getStyle("clip-path",!1,!0);if(s.hasValue()){const i=s.getDefinition();i&&i.apply(t)}}clearContext(t){}renderChildren(t){this.children.forEach(e=>{e.render(t)})}addChild(t){const e=t instanceof M?t:this.document.createElement(t);e.parent=this,M.ignoreChildTypes.includes(e.type)||this.children.push(e)}matchesSelector(t){var e;const{node:s}=this;if(typeof s.matches=="function")return s.matches(t);const i=(e=s.getAttribute)===null||e===void 0?void 0:e.call(s,"class");return!i||i===""?!1:i.split(" ").some(r=>".".concat(r)===t)}addStylesFromStyleDefinition(){const{styles:t,stylesSpecificity:e}=this.document;let s;for(const i in t)if(!i.startsWith("@")&&this.matchesSelector(i)){const r=t[i],o=e[i];if(r)for(const n in r){let a=this.stylesSpecificity[n];typeof a>"u"&&(a="000"),o&&o>=a&&(s=r[n],s&&(this.styles[n]=s),this.stylesSpecificity[n]=o)}}}removeStyles(t,e){return e.reduce((i,r)=>{const o=t.getStyle(r);if(!o.hasValue())return i;const n=o.getString();return o.setValue(""),[...i,[r,n]]},[])}restoreStyles(t,e){e.forEach(s=>{let[i,r]=s;t.getStyle(i,!0).setValue(r)})}isFirstChild(){var t;return((t=this.parent)===null||t===void 0?void 0:t.children.indexOf(this))===0}constructor(t,e,s=!1){if(this.document=t,this.node=e,this.captureTextNodes=s,this.type="",this.attributes={},this.styles={},this.stylesSpecificity={},this.animationFrozen=!1,this.animationFrozenValue="",this.parent=null,this.children=[],!e||e.nodeType!==1)return;Array.from(e.attributes).forEach(o=>{const n=Ls(o.nodeName);this.attributes[n]=new S(t,n,o.value)}),this.addStylesFromStyleDefinition(),this.getAttribute("style").hasValue()&&this.getAttribute("style").getString().split(";").map(n=>n.trim()).forEach(n=>{if(!n)return;const[a,h]=n.split(":").map(c=>c.trim());a&&(this.styles[a]=new S(t,a,h))});const{definitions:i}=t,r=this.getAttribute("id");r.hasValue()&&(i[r.getString()]||(i[r.getString()]=this)),Array.from(e.childNodes).forEach(o=>{if(o.nodeType===1)this.addChild(o);else if(s&&(o.nodeType===3||o.nodeType===4)){const n=t.createTextNode(o);n.getText().length>0&&this.addChild(n)}})}}M.ignoreChildTypes=["title"];class ti extends M{constructor(t,e,s){super(t,e,s)}}function ei(l){const t=l.trim();return/^('|")/.test(t)?t:'"'.concat(t,'"')}function si(l){return typeof process>"u"?l:l.trim().split(",").map(ei).join(",")}function ii(l){if(!l)return"";const t=l.trim().toLowerCase();switch(t){case"normal":case"italic":case"oblique":case"inherit":case"initial":case"unset":return t;default:return/^oblique\s+(-|)\d+deg$/.test(t)?t:""}}function ri(l){if(!l)return"";const t=l.trim().toLowerCase();switch(t){case"normal":case"bold":case"lighter":case"bolder":case"inherit":case"initial":case"unset":return t;default:return/^[\d.]+$/.test(t)?t:""}}class W{static parse(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",e=arguments.length>1?arguments[1]:void 0,s="",i="",r="",o="",n="";const a=wt(t).trim().split(" "),h={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1};return a.forEach(c=>{switch(!0){case(!h.fontStyle&&W.styles.includes(c)):c!=="inherit"&&(s=c),h.fontStyle=!0;break;case(!h.fontVariant&&W.variants.includes(c)):c!=="inherit"&&(i=c),h.fontStyle=!0,h.fontVariant=!0;break;case(!h.fontWeight&&W.weights.includes(c)):c!=="inherit"&&(r=c),h.fontStyle=!0,h.fontVariant=!0,h.fontWeight=!0;break;case!h.fontSize:c!=="inherit"&&(o=c.split("/")[0]||""),h.fontStyle=!0,h.fontVariant=!0,h.fontWeight=!0,h.fontSize=!0;break;default:c!=="inherit"&&(n+=c)}}),new W(s,i,r,o,n,e)}toString(){return[ii(this.fontStyle),this.fontVariant,ri(this.fontWeight),this.fontSize,si(this.fontFamily)].join(" ").trim()}constructor(t,e,s,i,r,o){const n=o?typeof o=="string"?W.parse(o):o:{};this.fontFamily=r||n.fontFamily,this.fontSize=i||n.fontSize,this.fontStyle=t||n.fontStyle,this.fontWeight=s||n.fontWeight,this.fontVariant=e||n.fontVariant}}W.styles="normal|italic|oblique|inherit";W.variants="normal|small-caps|inherit";W.weights="normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit";class J{get x(){return this.x1}get y(){return this.y1}get width(){return this.x2-this.x1}get height(){return this.y2-this.y1}addPoint(t,e){typeof t<"u"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=t,this.x2=t),t<this.x1&&(this.x1=t),t>this.x2&&(this.x2=t)),typeof e<"u"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),e<this.y1&&(this.y1=e),e>this.y2&&(this.y2=e))}addX(t){this.addPoint(t,0)}addY(t){this.addPoint(0,t)}addBoundingBox(t){if(!t)return;const{x1:e,y1:s,x2:i,y2:r}=t;this.addPoint(e,s),this.addPoint(i,r)}sumCubic(t,e,s,i,r){return Math.pow(1-t,3)*e+3*Math.pow(1-t,2)*t*s+3*(1-t)*Math.pow(t,2)*i+Math.pow(t,3)*r}bezierCurveAdd(t,e,s,i,r){const o=6*e-12*s+6*i,n=-3*e+9*s-9*i+3*r,a=3*s-3*e;if(n===0){if(o===0)return;const g=-a/o;0<g&&g<1&&(t?this.addX(this.sumCubic(g,e,s,i,r)):this.addY(this.sumCubic(g,e,s,i,r)));return}const h=Math.pow(o,2)-4*a*n;if(h<0)return;const c=(-o+Math.sqrt(h))/(2*n);0<c&&c<1&&(t?this.addX(this.sumCubic(c,e,s,i,r)):this.addY(this.sumCubic(c,e,s,i,r)));const f=(-o-Math.sqrt(h))/(2*n);0<f&&f<1&&(t?this.addX(this.sumCubic(f,e,s,i,r)):this.addY(this.sumCubic(f,e,s,i,r)))}addBezierCurve(t,e,s,i,r,o,n,a){this.addPoint(t,e),this.addPoint(n,a),this.bezierCurveAdd(!0,t,s,r,n),this.bezierCurveAdd(!1,e,i,o,a)}addQuadraticCurve(t,e,s,i,r,o){const n=t+.6666666666666666*(s-t),a=e+2/3*(i-e),h=n+1/3*(r-t),c=a+1/3*(o-e);this.addBezierCurve(t,e,n,h,a,c,r,o)}isPointInBox(t,e){const{x1:s,y1:i,x2:r,y2:o}=this;return s<=t&&t<=r&&i<=e&&e<=o}constructor(t=Number.NaN,e=Number.NaN,s=Number.NaN,i=Number.NaN){this.x1=t,this.y1=e,this.x2=s,this.y2=i,this.addPoint(t,e),this.addPoint(s,i)}}class mt extends M{calculateOpacity(){let t=1,e=this;for(;e;){const s=e.getStyle("opacity",!1,!0);s.hasValue(!0)&&(t*=s.getNumber()),e=e.parent}return t}setContext(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(!e){const s=this.getStyle("fill"),i=this.getStyle("fill-opacity"),r=this.getStyle("stroke"),o=this.getStyle("stroke-opacity");if(s.isUrlDefinition()){const u=s.getFillStyleDefinition(this,i);u&&(t.fillStyle=u)}else if(s.hasValue()){s.getString()==="currentColor"&&s.setValue(this.getStyle("color").getColor());const u=s.getColor();u!=="inherit"&&(t.fillStyle=u==="none"?"rgba(0,0,0,0)":u)}if(i.hasValue()){const u=new S(this.document,"fill",t.fillStyle).addOpacity(i).getColor();t.fillStyle=u}if(r.isUrlDefinition()){const u=r.getFillStyleDefinition(this,o);u&&(t.strokeStyle=u)}else if(r.hasValue()){r.getString()==="currentColor"&&r.setValue(this.getStyle("color").getColor());const u=r.getString();u!=="inherit"&&(t.strokeStyle=u==="none"?"rgba(0,0,0,0)":u)}if(o.hasValue()){const u=new S(this.document,"stroke",t.strokeStyle).addOpacity(o).getString();t.strokeStyle=u}const n=this.getStyle("stroke-width");if(n.hasValue()){const u=n.getPixels();t.lineWidth=u||Tt}const a=this.getStyle("stroke-linecap"),h=this.getStyle("stroke-linejoin"),c=this.getStyle("stroke-miterlimit"),f=this.getStyle("stroke-dasharray"),g=this.getStyle("stroke-dashoffset");if(a.hasValue()&&(t.lineCap=a.getString()),h.hasValue()&&(t.lineJoin=h.getString()),c.hasValue()&&(t.miterLimit=c.getNumber()),f.hasValue()&&f.getString()!=="none"){const u=$(f.getString());typeof t.setLineDash<"u"?t.setLineDash(u):typeof t.webkitLineDash<"u"?t.webkitLineDash=u:typeof t.mozDash<"u"&&!(u.length===1&&u[0]===0)&&(t.mozDash=u);const d=g.getPixels();typeof t.lineDashOffset<"u"?t.lineDashOffset=d:typeof t.webkitLineDashOffset<"u"?t.webkitLineDashOffset=d:typeof t.mozDashOffset<"u"&&(t.mozDashOffset=d)}}if(this.modifiedEmSizeStack=!1,typeof t.font<"u"){const s=this.getStyle("font"),i=this.getStyle("font-style"),r=this.getStyle("font-variant"),o=this.getStyle("font-weight"),n=this.getStyle("font-size"),a=this.getStyle("font-family"),h=new W(i.getString(),r.getString(),o.getString(),n.hasValue()?"".concat(n.getPixels(!0),"px"):"",a.getString(),W.parse(s.getString(),t.font));i.setValue(h.fontStyle),r.setValue(h.fontVariant),o.setValue(h.fontWeight),n.setValue(h.fontSize),a.setValue(h.fontFamily),t.font=h.toString(),n.isPixels()&&(this.document.emSize=n.getPixels(),this.modifiedEmSizeStack=!0)}e||(this.applyEffects(t),t.globalAlpha=this.calculateOpacity())}clearContext(t){super.clearContext(t),this.modifiedEmSizeStack&&this.document.popEmSize()}constructor(...t){super(...t),this.modifiedEmSizeStack=!1}}class ht extends mt{setContext(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;super.setContext(t,e);const s=this.getStyle("dominant-baseline").getTextBaseline()||this.getStyle("alignment-baseline").getTextBaseline();s&&(t.textBaseline=s)}initializeCoordinates(){this.x=0,this.y=0,this.leafTexts=[],this.textChunkStart=0,this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY}getBoundingBox(t){if(this.type!=="text")return this.getTElementBoundingBox(t);this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(t);let e=null;return this.children.forEach((s,i)=>{const r=this.getChildBoundingBox(t,this,this,i);e?e.addBoundingBox(r):e=r}),e}getFontSize(){const{document:t,parent:e}=this,s=W.parse(t.ctx.font).fontSize;return e.getStyle("font-size").getNumber(s)}getTElementBoundingBox(t){const e=this.getFontSize();return new J(this.x,this.y-e,this.x+this.measureText(t),this.y)}getGlyph(t,e,s){const i=e[s];let r;if(t.isArabic){var o;const n=e.length,a=e[s-1],h=e[s+1];let c="isolated";(s===0||a===" ")&&s<n-1&&h!==" "&&(c="terminal"),s>0&&a!==" "&&s<n-1&&h!==" "&&(c="medial"),s>0&&a!==" "&&(s===n-1||h===" ")&&(c="initial"),r=((o=t.arabicGlyphs[i])===null||o===void 0?void 0:o[c])||t.glyphs[i]}else r=t.glyphs[i];return r||(r=t.missingGlyph),r}getText(){return""}getTextFromNode(t){const e=t||this.node,s=Array.from(e.parentNode.childNodes),i=s.indexOf(e),r=s.length-1;let o=wt(e.textContent||"");return i===0&&(o=Os(o)),i===r&&(o=Vs(o)),o}renderChildren(t){if(this.type!=="text"){this.renderTElementChildren(t);return}this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(t),this.children.forEach((s,i)=>{this.renderChild(t,this,this,i)});const{mouse:e}=this.document.screen;e.isWorking()&&e.checkBoundingBox(this,this.getBoundingBox(t))}renderTElementChildren(t){const{document:e,parent:s}=this,i=this.getText(),r=s.getStyle("font-family").getDefinition();if(r){const{unitsPerEm:a}=r.fontFace,h=W.parse(e.ctx.font),c=s.getStyle("font-size").getNumber(h.fontSize),f=s.getStyle("font-style").getString(h.fontStyle),g=c/a,u=r.isRTL?i.split("").reverse().join(""):i,d=$(s.getAttribute("dx").getString()),p=u.length;for(let m=0;m<p;m++){const x=this.getGlyph(r,u,m);t.translate(this.x,this.y),t.scale(g,-g);const T=t.lineWidth;t.lineWidth=t.lineWidth*a/c,f==="italic"&&t.transform(1,0,.4,1,0,0),x.render(t),f==="italic"&&t.transform(1,0,-.4,1,0,0),t.lineWidth=T,t.scale(1/g,-1/g),t.translate(-this.x,-this.y),this.x+=c*(x.horizAdvX||r.horizAdvX)/a,typeof d[m]<"u"&&!isNaN(d[m])&&(this.x+=d[m])}return}const{x:o,y:n}=this;t.fillStyle&&t.fillText(i,o,n),t.strokeStyle&&t.strokeText(i,o,n)}applyAnchoring(){if(this.textChunkStart>=this.leafTexts.length)return;const t=this.leafTexts[this.textChunkStart],e=t.getStyle("text-anchor").getString("start"),s=!1;let i=0;e==="start"&&!s||e==="end"&&s?i=t.x-this.minX:e==="end"&&!s||e==="start"&&s?i=t.x-this.maxX:i=t.x-(this.minX+this.maxX)/2;for(let r=this.textChunkStart;r<this.leafTexts.length;r++)this.leafTexts[r].x+=i;this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.textChunkStart=this.leafTexts.length}adjustChildCoordinatesRecursive(t){this.children.forEach((e,s)=>{this.adjustChildCoordinatesRecursiveCore(t,this,this,s)}),this.applyAnchoring()}adjustChildCoordinatesRecursiveCore(t,e,s,i){const r=s.children[i];r.children.length>0?r.children.forEach((o,n)=>{e.adjustChildCoordinatesRecursiveCore(t,e,r,n)}):this.adjustChildCoordinates(t,e,s,i)}adjustChildCoordinates(t,e,s,i){const r=s.children[i];if(typeof r.measureText!="function")return r;t.save(),r.setContext(t,!0);const o=r.getAttribute("x"),n=r.getAttribute("y"),a=r.getAttribute("dx"),h=r.getAttribute("dy"),c=r.getStyle("font-family").getDefinition(),f=!!(c!=null&&c.isRTL);i===0&&(o.hasValue()||o.setValue(r.getInheritedAttribute("x")),n.hasValue()||n.setValue(r.getInheritedAttribute("y")),a.hasValue()||a.setValue(r.getInheritedAttribute("dx")),h.hasValue()||h.setValue(r.getInheritedAttribute("dy")));const g=r.measureText(t);return f&&(e.x-=g),o.hasValue()?(e.applyAnchoring(),r.x=o.getPixels("x"),a.hasValue()&&(r.x+=a.getPixels("x"))):(a.hasValue()&&(e.x+=a.getPixels("x")),r.x=e.x),e.x=r.x,f||(e.x+=g),n.hasValue()?(r.y=n.getPixels("y"),h.hasValue()&&(r.y+=h.getPixels("y"))):(h.hasValue()&&(e.y+=h.getPixels("y")),r.y=e.y),e.y=r.y,e.leafTexts.push(r),e.minX=Math.min(e.minX,r.x,r.x+g),e.maxX=Math.max(e.maxX,r.x,r.x+g),r.clearContext(t),t.restore(),r}getChildBoundingBox(t,e,s,i){const r=s.children[i];if(typeof r.getBoundingBox!="function")return null;const o=r.getBoundingBox(t);return o&&r.children.forEach((n,a)=>{const h=e.getChildBoundingBox(t,e,r,a);o.addBoundingBox(h)}),o}renderChild(t,e,s,i){const r=s.children[i];r.render(t),r.children.forEach((o,n)=>{e.renderChild(t,e,r,n)})}measureText(t){const{measureCache:e}=this;if(~e)return e;const s=this.getText(),i=this.measureTargetText(t,s);return this.measureCache=i,i}measureTargetText(t,e){if(!e.length)return 0;const{parent:s}=this,i=s.getStyle("font-family").getDefinition();if(i){const o=this.getFontSize(),n=i.isRTL?e.split("").reverse().join(""):e,a=$(s.getAttribute("dx").getString()),h=n.length;let c=0;for(let f=0;f<h;f++){const g=this.getGlyph(i,n,f);c+=(g.horizAdvX||i.horizAdvX)*o/i.fontFace.unitsPerEm,typeof a[f]<"u"&&!isNaN(a[f])&&(c+=a[f])}return c}if(!t.measureText)return e.length*10;t.save(),this.setContext(t,!0);const{width:r}=t.measureText(e);return this.clearContext(t),t.restore(),r}getInheritedAttribute(t){let e=this;for(;e instanceof ht&&e.isFirstChild()&&e.parent;){const s=e.parent.getAttribute(t);if(s.hasValue(!0))return s.getString("0");e=e.parent}return null}constructor(t,e,s){super(t,e,new.target===ht?!0:s),this.type="text",this.x=0,this.y=0,this.leafTexts=[],this.textChunkStart=0,this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.measureCache=-1}}class Ht extends ht{getText(){return this.text}constructor(t,e,s){super(t,e,new.target===Ht?!0:s),this.type="tspan",this.text=this.children.length>0?"":this.getTextFromNode()}}class ni extends Ht{constructor(...t){super(...t),this.type="textNode"}}class w extends y{reset(){this.i=-1,this.command=null,this.previousCommand=null,this.start=new V(0,0),this.control=new V(0,0),this.current=new V(0,0),this.points=[],this.angles=[]}isEnd(){const{i:t,commands:e}=this;return t>=e.length-1}next(){const t=this.commands[++this.i];return this.previousCommand=this.command,this.command=t,t}getPoint(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"x",e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"y";const s=new V(this.command[t],this.command[e]);return this.makeAbsolute(s)}getAsControlPoint(t,e){const s=this.getPoint(t,e);return this.control=s,s}getAsCurrentPoint(t,e){const s=this.getPoint(t,e);return this.current=s,s}getReflectedControlPoint(){const t=this.previousCommand.type;if(t!==y.CURVE_TO&&t!==y.SMOOTH_CURVE_TO&&t!==y.QUAD_TO&&t!==y.SMOOTH_QUAD_TO)return this.current;const{current:{x:e,y:s},control:{x:i,y:r}}=this;return new V(2*e-i,2*s-r)}makeAbsolute(t){if(this.command.relative){const{x:e,y:s}=this.current;t.x+=e,t.y+=s}return t}addMarker(t,e,s){const{points:i,angles:r}=this;s&&r.length>0&&!r[r.length-1]&&(r[r.length-1]=i[i.length-1].angleTo(s)),this.addMarkerAngle(t,e?e.angleTo(t):null)}addMarkerAngle(t,e){this.points.push(t),this.angles.push(e)}getMarkerPoints(){return this.points}getMarkerAngles(){const{angles:t}=this,e=t.length;for(let s=0;s<e;s++)if(!t[s]){for(let i=s+1;i<e;i++)if(t[i]){t[s]=t[i];break}}return t}constructor(t){super(t.replace(/([+\-.])\s+/gm,"$1").replace(/[^MmZzLlHhVvCcSsQqTtAae\d\s.,+-].*/g,"")),this.control=new V(0,0),this.start=new V(0,0),this.current=new V(0,0),this.command=null,this.commands=this.commands,this.i=-1,this.previousCommand=null,this.points=[],this.angles=[]}}class P extends mt{path(t){const{pathParser:e}=this,s=new J;for(e.reset(),t&&t.beginPath();!e.isEnd();)switch(e.next().type){case w.MOVE_TO:this.pathM(t,s);break;case w.LINE_TO:this.pathL(t,s);break;case w.HORIZ_LINE_TO:this.pathH(t,s);break;case w.VERT_LINE_TO:this.pathV(t,s);break;case w.CURVE_TO:this.pathC(t,s);break;case w.SMOOTH_CURVE_TO:this.pathS(t,s);break;case w.QUAD_TO:this.pathQ(t,s);break;case w.SMOOTH_QUAD_TO:this.pathT(t,s);break;case w.ARC:this.pathA(t,s);break;case w.CLOSE_PATH:this.pathZ(t,s);break}return s}getBoundingBox(t){return this.path()}getMarkers(){const{pathParser:t}=this,e=t.getMarkerPoints(),s=t.getMarkerAngles();return e.map((r,o)=>[r,s[o]])}renderChildren(t){this.path(t),this.document.screen.mouse.checkPath(this,t);const e=this.getStyle("fill-rule");t.fillStyle!==""&&(e.getString("inherit")!=="inherit"?t.fill(e.getString()):t.fill()),t.strokeStyle!==""&&(this.getAttribute("vector-effect").getString()==="non-scaling-stroke"?(t.save(),t.setTransform(1,0,0,1,0,0),t.stroke(),t.restore()):t.stroke());const s=this.getMarkers();if(s){const i=s.length-1,r=this.getStyle("marker-start"),o=this.getStyle("marker-mid"),n=this.getStyle("marker-end");if(r.isUrlDefinition()){const a=r.getDefinition(),[h,c]=s[0];a.render(t,h,c)}if(o.isUrlDefinition()){const a=o.getDefinition();for(let h=1;h<i;h++){const[c,f]=s[h];a.render(t,c,f)}}if(n.isUrlDefinition()){const a=n.getDefinition(),[h,c]=s[i];a.render(t,h,c)}}}static pathM(t){const e=t.getAsCurrentPoint();return t.start=t.current,{point:e}}pathM(t,e){const{pathParser:s}=this,{point:i}=P.pathM(s),{x:r,y:o}=i;s.addMarker(i),e.addPoint(r,o),t&&t.moveTo(r,o)}static pathL(t){const{current:e}=t,s=t.getAsCurrentPoint();return{current:e,point:s}}pathL(t,e){const{pathParser:s}=this,{current:i,point:r}=P.pathL(s),{x:o,y:n}=r;s.addMarker(r,i),e.addPoint(o,n),t&&t.lineTo(o,n)}static pathH(t){const{current:e,command:s}=t,i=new V((s.relative?e.x:0)+s.x,e.y);return t.current=i,{current:e,point:i}}pathH(t,e){const{pathParser:s}=this,{current:i,point:r}=P.pathH(s),{x:o,y:n}=r;s.addMarker(r,i),e.addPoint(o,n),t&&t.lineTo(o,n)}static pathV(t){const{current:e,command:s}=t,i=new V(e.x,(s.relative?e.y:0)+s.y);return t.current=i,{current:e,point:i}}pathV(t,e){const{pathParser:s}=this,{current:i,point:r}=P.pathV(s),{x:o,y:n}=r;s.addMarker(r,i),e.addPoint(o,n),t&&t.lineTo(o,n)}static pathC(t){const{current:e}=t,s=t.getPoint("x1","y1"),i=t.getAsControlPoint("x2","y2"),r=t.getAsCurrentPoint();return{current:e,point:s,controlPoint:i,currentPoint:r}}pathC(t,e){const{pathParser:s}=this,{current:i,point:r,controlPoint:o,currentPoint:n}=P.pathC(s);s.addMarker(n,o,r),e.addBezierCurve(i.x,i.y,r.x,r.y,o.x,o.y,n.x,n.y),t&&t.bezierCurveTo(r.x,r.y,o.x,o.y,n.x,n.y)}static pathS(t){const{current:e}=t,s=t.getReflectedControlPoint(),i=t.getAsControlPoint("x2","y2"),r=t.getAsCurrentPoint();return{current:e,point:s,controlPoint:i,currentPoint:r}}pathS(t,e){const{pathParser:s}=this,{current:i,point:r,controlPoint:o,currentPoint:n}=P.pathS(s);s.addMarker(n,o,r),e.addBezierCurve(i.x,i.y,r.x,r.y,o.x,o.y,n.x,n.y),t&&t.bezierCurveTo(r.x,r.y,o.x,o.y,n.x,n.y)}static pathQ(t){const{current:e}=t,s=t.getAsControlPoint("x1","y1"),i=t.getAsCurrentPoint();return{current:e,controlPoint:s,currentPoint:i}}pathQ(t,e){const{pathParser:s}=this,{current:i,controlPoint:r,currentPoint:o}=P.pathQ(s);s.addMarker(o,r,r),e.addQuadraticCurve(i.x,i.y,r.x,r.y,o.x,o.y),t&&t.quadraticCurveTo(r.x,r.y,o.x,o.y)}static pathT(t){const{current:e}=t,s=t.getReflectedControlPoint();t.control=s;const i=t.getAsCurrentPoint();return{current:e,controlPoint:s,currentPoint:i}}pathT(t,e){const{pathParser:s}=this,{current:i,controlPoint:r,currentPoint:o}=P.pathT(s);s.addMarker(o,r,r),e.addQuadraticCurve(i.x,i.y,r.x,r.y,o.x,o.y),t&&t.quadraticCurveTo(r.x,r.y,o.x,o.y)}static pathA(t){const{current:e,command:s}=t;let{rX:i,rY:r,xRot:o,lArcFlag:n,sweepFlag:a}=s;const h=o*(Math.PI/180),c=t.getAsCurrentPoint(),f=new V(Math.cos(h)*(e.x-c.x)/2+Math.sin(h)*(e.y-c.y)/2,-Math.sin(h)*(e.x-c.x)/2+Math.cos(h)*(e.y-c.y)/2),g=Math.pow(f.x,2)/Math.pow(i,2)+Math.pow(f.y,2)/Math.pow(r,2);g>1&&(i*=Math.sqrt(g),r*=Math.sqrt(g));let u=(n===a?-1:1)*Math.sqrt((Math.pow(i,2)*Math.pow(r,2)-Math.pow(i,2)*Math.pow(f.y,2)-Math.pow(r,2)*Math.pow(f.x,2))/(Math.pow(i,2)*Math.pow(f.y,2)+Math.pow(r,2)*Math.pow(f.x,2)));isNaN(u)&&(u=0);const d=new V(u*i*f.y/r,u*-r*f.x/i),p=new V((e.x+c.x)/2+Math.cos(h)*d.x-Math.sin(h)*d.y,(e.y+c.y)/2+Math.sin(h)*d.x+Math.cos(h)*d.y),m=Ie([1,0],[(f.x-d.x)/i,(f.y-d.y)/r]),x=[(f.x-d.x)/i,(f.y-d.y)/r],T=[(-f.x-d.x)/i,(-f.y-d.y)/r];let b=Ie(x,T);return ge(x,T)<=-1&&(b=Math.PI),ge(x,T)>=1&&(b=0),{currentPoint:c,rX:i,rY:r,sweepFlag:a,xAxisRotation:h,centp:p,a1:m,ad:b}}pathA(t,e){const{pathParser:s}=this,{currentPoint:i,rX:r,rY:o,sweepFlag:n,xAxisRotation:a,centp:h,a1:c,ad:f}=P.pathA(s),g=1-n?1:-1,u=c+g*(f/2),d=new V(h.x+r*Math.cos(u),h.y+o*Math.sin(u));if(s.addMarkerAngle(d,u-g*Math.PI/2),s.addMarkerAngle(i,u-g*Math.PI),e.addPoint(i.x,i.y),t&&!isNaN(c)&&!isNaN(f)){const p=r>o?r:o,m=r>o?1:r/o,x=r>o?o/r:1;t.translate(h.x,h.y),t.rotate(a),t.scale(m,x),t.arc(0,0,p,c,c+f,!!(1-n)),t.scale(1/m,1/x),t.rotate(-a),t.translate(-h.x,-h.y)}}static pathZ(t){t.current=t.start}pathZ(t,e){P.pathZ(this.pathParser),t&&e.x1!==e.x2&&e.y1!==e.y2&&t.closePath()}constructor(t,e,s){super(t,e,s),this.type="path",this.pathParser=new w(this.getAttribute("d").getString())}}class Mt extends mt{setContext(t){var e;const{document:s}=this,{screen:i,window:r}=s,o=t.canvas;if(i.setDefaults(t),"style"in o&&typeof t.font<"u"&&r&&typeof r.getComputedStyle<"u"){t.font=r.getComputedStyle(o).getPropertyValue("font");const T=new S(s,"fontSize",W.parse(t.font).fontSize);T.hasValue()&&(s.rootEmSize=T.getPixels("y"),s.emSize=s.rootEmSize)}this.getAttribute("x").hasValue()||this.getAttribute("x",!0).setValue(0),this.getAttribute("y").hasValue()||this.getAttribute("y",!0).setValue(0);let{width:n,height:a}=i.viewPort;this.getStyle("width").hasValue()||this.getStyle("width",!0).setValue("100%"),this.getStyle("height").hasValue()||this.getStyle("height",!0).setValue("100%"),this.getStyle("color").hasValue()||this.getStyle("color",!0).setValue("black");const h=this.getAttribute("refX"),c=this.getAttribute("refY"),f=this.getAttribute("viewBox"),g=f.hasValue()?$(f.getString()):null,u=!this.root&&this.getStyle("overflow").getValue("hidden")!=="visible";let d=0,p=0,m=0,x=0;g&&(d=g[0],p=g[1]),this.root||(n=this.getStyle("width").getPixels("x"),a=this.getStyle("height").getPixels("y"),this.type==="marker"&&(m=d,x=p,d=0,p=0)),i.viewPort.setCurrent(n,a),this.node&&(!this.parent||((e=this.node.parentNode)===null||e===void 0?void 0:e.nodeName)==="foreignObject")&&this.getStyle("transform",!1,!0).hasValue()&&!this.getStyle("transform-origin",!1,!0).hasValue()&&this.getStyle("transform-origin",!0,!0).setValue("50% 50%"),super.setContext(t),t.translate(this.getAttribute("x").getPixels("x"),this.getAttribute("y").getPixels("y")),g&&(n=g[2],a=g[3]),s.setViewBox({ctx:t,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:i.viewPort.width,desiredWidth:n,height:i.viewPort.height,desiredHeight:a,minX:d,minY:p,refX:h.getValue(),refY:c.getValue(),clip:u,clipX:m,clipY:x}),g&&(i.viewPort.removeCurrent(),i.viewPort.setCurrent(n,a))}clearContext(t){super.clearContext(t),this.document.screen.viewPort.removeCurrent()}resize(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const i=this.getAttribute("width",!0),r=this.getAttribute("height",!0),o=this.getAttribute("viewBox"),n=this.getAttribute("style"),a=i.getNumber(0),h=r.getNumber(0);if(s)if(typeof s=="string")this.getAttribute("preserveAspectRatio",!0).setValue(s);else{const c=this.getAttribute("preserveAspectRatio");c.hasValue()&&c.setValue(c.getString().replace(/^\s*(\S.*\S)\s*$/,"$1"))}if(i.setValue(t),r.setValue(e),o.hasValue()||o.setValue("0 0 ".concat(a||t," ").concat(h||e)),n.hasValue()){const c=this.getStyle("width"),f=this.getStyle("height");c.hasValue()&&c.setValue("".concat(t,"px")),f.hasValue()&&f.setValue("".concat(e,"px"))}}constructor(...t){super(...t),this.type="svg",this.root=!1}}class es extends P{path(t){const e=this.getAttribute("x").getPixels("x"),s=this.getAttribute("y").getPixels("y"),i=this.getStyle("width",!1,!0).getPixels("x"),r=this.getStyle("height",!1,!0).getPixels("y"),o=this.getAttribute("rx"),n=this.getAttribute("ry");let a=o.getPixels("x"),h=n.getPixels("y");if(o.hasValue()&&!n.hasValue()&&(h=a),n.hasValue()&&!o.hasValue()&&(a=h),a=Math.min(a,i/2),h=Math.min(h,r/2),t){const c=4*((Math.sqrt(2)-1)/3);t.beginPath(),r>0&&i>0&&(t.moveTo(e+a,s),t.lineTo(e+i-a,s),t.bezierCurveTo(e+i-a+c*a,s,e+i,s+h-c*h,e+i,s+h),t.lineTo(e+i,s+r-h),t.bezierCurveTo(e+i,s+r-h+c*h,e+i-a+c*a,s+r,e+i-a,s+r),t.lineTo(e+a,s+r),t.bezierCurveTo(e+a-c*a,s+r,e,s+r-h+c*h,e,s+r-h),t.lineTo(e,s+h),t.bezierCurveTo(e,s+h-c*h,e+a-c*a,s,e+a,s),t.closePath())}return new J(e,s,e+i,s+r)}getMarkers(){return null}constructor(...t){super(...t),this.type="rect"}}class oi extends P{path(t){const e=this.getAttribute("cx").getPixels("x"),s=this.getAttribute("cy").getPixels("y"),i=this.getAttribute("r").getPixels();return t&&i>0&&(t.beginPath(),t.arc(e,s,i,0,Math.PI*2,!1),t.closePath()),new J(e-i,s-i,e+i,s+i)}getMarkers(){return null}constructor(...t){super(...t),this.type="circle"}}class ai extends P{path(t){const e=4*((Math.sqrt(2)-1)/3),s=this.getAttribute("rx").getPixels("x"),i=this.getAttribute("ry").getPixels("y"),r=this.getAttribute("cx").getPixels("x"),o=this.getAttribute("cy").getPixels("y");return t&&s>0&&i>0&&(t.beginPath(),t.moveTo(r+s,o),t.bezierCurveTo(r+s,o+e*i,r+e*s,o+i,r,o+i),t.bezierCurveTo(r-e*s,o+i,r-s,o+e*i,r-s,o),t.bezierCurveTo(r-s,o-e*i,r-e*s,o-i,r,o-i),t.bezierCurveTo(r+e*s,o-i,r+s,o-e*i,r+s,o),t.closePath()),new J(r-s,o-i,r+s,o+i)}getMarkers(){return null}constructor(...t){super(...t),this.type="ellipse"}}class hi extends P{getPoints(){return[new V(this.getAttribute("x1").getPixels("x"),this.getAttribute("y1").getPixels("y")),new V(this.getAttribute("x2").getPixels("x"),this.getAttribute("y2").getPixels("y"))]}path(t){const[{x:e,y:s},{x:i,y:r}]=this.getPoints();return t&&(t.beginPath(),t.moveTo(e,s),t.lineTo(i,r)),new J(e,s,i,r)}getMarkers(){const[t,e]=this.getPoints(),s=t.angleTo(e);return[[t,s],[e,s]]}constructor(...t){super(...t),this.type="line"}}class ss extends P{path(t){const{points:e}=this,[{x:s,y:i}]=e,r=new J(s,i);return t&&(t.beginPath(),t.moveTo(s,i)),e.forEach(o=>{let{x:n,y:a}=o;r.addPoint(n,a),t&&t.lineTo(n,a)}),r}getMarkers(){const{points:t}=this,e=t.length-1,s=[];return t.forEach((i,r)=>{r!==e&&s.push([i,i.angleTo(t[r+1])])}),s.length>0&&s.push([t[t.length-1],s[s.length-1][1]]),s}constructor(t,e,s){super(t,e,s),this.type="polyline",this.points=[],this.points=V.parsePath(this.getAttribute("points").getString())}}class li extends ss{path(t){const e=super.path(t),[{x:s,y:i}]=this.points;return t&&(t.lineTo(s,i),t.closePath()),e}constructor(...t){super(...t),this.type="polygon"}}class ci extends M{createPattern(t,e,s){const i=this.getStyle("width").getPixels("x",!0),r=this.getStyle("height").getPixels("y",!0),o=new Mt(this.document,null);o.attributes.viewBox=new S(this.document,"viewBox",this.getAttribute("viewBox").getValue()),o.attributes.width=new S(this.document,"width","".concat(i,"px")),o.attributes.height=new S(this.document,"height","".concat(r,"px")),o.attributes.transform=new S(this.document,"transform",this.getAttribute("patternTransform").getValue()),o.children=this.children;const n=this.document.createCanvas(i,r),a=n.getContext("2d"),h=this.getAttribute("x"),c=this.getAttribute("y");h.hasValue()&&c.hasValue()&&a.translate(h.getPixels("x",!0),c.getPixels("y",!0)),s.hasValue()?this.styles["fill-opacity"]=s:Reflect.deleteProperty(this.styles,"fill-opacity");for(let g=-1;g<=1;g++)for(let u=-1;u<=1;u++)a.save(),o.attributes.x=new S(this.document,"x",g*n.width),o.attributes.y=new S(this.document,"y",u*n.height),o.render(a),a.restore();return t.createPattern(n,"repeat")}constructor(...t){super(...t),this.type="pattern"}}class ui extends M{render(t,e,s){if(!e)return;const{x:i,y:r}=e,o=this.getAttribute("orient").getString("auto"),n=this.getAttribute("markerUnits").getString("strokeWidth");t.translate(i,r),o==="auto"&&t.rotate(s),n==="strokeWidth"&&t.scale(t.lineWidth,t.lineWidth),t.save();const a=new Mt(this.document);a.type=this.type,a.attributes.viewBox=new S(this.document,"viewBox",this.getAttribute("viewBox").getValue()),a.attributes.refX=new S(this.document,"refX",this.getAttribute("refX").getValue()),a.attributes.refY=new S(this.document,"refY",this.getAttribute("refY").getValue()),a.attributes.width=new S(this.document,"width",this.getAttribute("markerWidth").getValue()),a.attributes.height=new S(this.document,"height",this.getAttribute("markerHeight").getValue()),a.attributes.overflow=new S(this.document,"overflow",this.getAttribute("overflow").getValue()),a.attributes.fill=new S(this.document,"fill",this.getAttribute("fill").getColor("black")),a.attributes.stroke=new S(this.document,"stroke",this.getAttribute("stroke").getValue("none")),a.children=this.children,a.render(t),t.restore(),n==="strokeWidth"&&t.scale(1/t.lineWidth,1/t.lineWidth),o==="auto"&&t.rotate(-s),t.translate(-i,-r)}constructor(...t){super(...t),this.type="marker"}}class fi extends M{render(){}constructor(...t){super(...t),this.type="defs"}}class de extends mt{getBoundingBox(t){const e=new J;return this.children.forEach(s=>{e.addBoundingBox(s.getBoundingBox(t))}),e}constructor(...t){super(...t),this.type="g"}}class is extends M{getGradientUnits(){return this.getAttribute("gradientUnits").getString("objectBoundingBox")}createGradient(t,e,s){let i=this;this.getHrefAttribute().hasValue()&&(i=this.getHrefAttribute().getDefinition(),this.inheritStopContainer(i));const{stops:r}=i,o=this.getGradient(t,e);if(!o)return this.addParentOpacity(s,r[r.length-1].color);if(r.forEach(n=>{o.addColorStop(n.offset,this.addParentOpacity(s,n.color))}),this.getAttribute("gradientTransform").hasValue()){const{document:n}=this,{MAX_VIRTUAL_PIXELS:a}=rt,{viewPort:h}=n.screen,c=h.getRoot(),f=new es(n);f.attributes.x=new S(n,"x",-a/3),f.attributes.y=new S(n,"y",-a/3),f.attributes.width=new S(n,"width",a),f.attributes.height=new S(n,"height",a);const g=new de(n);g.attributes.transform=new S(n,"transform",this.getAttribute("gradientTransform").getValue()),g.children=[f];const u=new Mt(n);u.attributes.x=new S(n,"x",0),u.attributes.y=new S(n,"y",0),u.attributes.width=new S(n,"width",c.width),u.attributes.height=new S(n,"height",c.height),u.children=[g];const d=n.createCanvas(c.width,c.height),p=d.getContext("2d");return p.fillStyle=o,u.render(p),p.createPattern(d,"no-repeat")}return o}inheritStopContainer(t){this.attributesToInherit.forEach(e=>{!this.getAttribute(e).hasValue()&&t.getAttribute(e).hasValue()&&this.getAttribute(e,!0).setValue(t.getAttribute(e).getValue())})}addParentOpacity(t,e){return t.hasValue()?new S(this.document,"color",e).addOpacity(t).getColor():e}constructor(t,e,s){super(t,e,s),this.attributesToInherit=["gradientUnits"],this.stops=[];const{stops:i,children:r}=this;r.forEach(o=>{o.type==="stop"&&i.push(o)})}}class gi extends is{getGradient(t,e){const s=this.getGradientUnits()==="objectBoundingBox",i=s?e.getBoundingBox(t):null;if(s&&!i)return null;!this.getAttribute("x1").hasValue()&&!this.getAttribute("y1").hasValue()&&!this.getAttribute("x2").hasValue()&&!this.getAttribute("y2").hasValue()&&(this.getAttribute("x1",!0).setValue(0),this.getAttribute("y1",!0).setValue(0),this.getAttribute("x2",!0).setValue(1),this.getAttribute("y2",!0).setValue(0));const r=s?i.x+i.width*this.getAttribute("x1").getNumber():this.getAttribute("x1").getPixels("x"),o=s?i.y+i.height*this.getAttribute("y1").getNumber():this.getAttribute("y1").getPixels("y"),n=s?i.x+i.width*this.getAttribute("x2").getNumber():this.getAttribute("x2").getPixels("x"),a=s?i.y+i.height*this.getAttribute("y2").getNumber():this.getAttribute("y2").getPixels("y");return r===n&&o===a?null:t.createLinearGradient(r,o,n,a)}constructor(t,e,s){super(t,e,s),this.type="linearGradient",this.attributesToInherit.push("x1","y1","x2","y2")}}class di extends is{getGradient(t,e){const s=this.getGradientUnits()==="objectBoundingBox",i=e.getBoundingBox(t);if(s&&!i)return null;this.getAttribute("cx").hasValue()||this.getAttribute("cx",!0).setValue("50%"),this.getAttribute("cy").hasValue()||this.getAttribute("cy",!0).setValue("50%"),this.getAttribute("r").hasValue()||this.getAttribute("r",!0).setValue("50%");const r=s?i.x+i.width*this.getAttribute("cx").getNumber():this.getAttribute("cx").getPixels("x"),o=s?i.y+i.height*this.getAttribute("cy").getNumber():this.getAttribute("cy").getPixels("y");let n=r,a=o;this.getAttribute("fx").hasValue()&&(n=s?i.x+i.width*this.getAttribute("fx").getNumber():this.getAttribute("fx").getPixels("x")),this.getAttribute("fy").hasValue()&&(a=s?i.y+i.height*this.getAttribute("fy").getNumber():this.getAttribute("fy").getPixels("y"));const h=s?(i.width+i.height)/2*this.getAttribute("r").getNumber():this.getAttribute("r").getPixels(),c=this.getAttribute("fr").getPixels();return t.createRadialGradient(n,a,c,r,o,h)}constructor(t,e,s){super(t,e,s),this.type="radialGradient",this.attributesToInherit.push("cx","cy","r","fx","fy","fr")}}class pi extends M{constructor(t,e,s){super(t,e,s),this.type="stop";const i=Math.max(0,Math.min(1,this.getAttribute("offset").getNumber())),r=this.getStyle("stop-opacity");let o=this.getStyle("stop-color",!0);o.getString()===""&&o.setValue("#000"),r.hasValue()&&(o=o.addOpacity(r)),this.offset=i,this.color=o.getColor()}}class pe extends M{getProperty(){const t=this.getAttribute("attributeType").getString(),e=this.getAttribute("attributeName").getString();return t==="CSS"?this.parent.getStyle(e,!0):this.parent.getAttribute(e,!0)}calcValue(){const{initialUnits:t}=this,{progress:e,from:s,to:i}=this.getProgress();let r=s.getNumber()+(i.getNumber()-s.getNumber())*e;return t==="%"&&(r*=100),"".concat(r).concat(t)}update(t){const{parent:e}=this,s=this.getProperty();if(this.initialValue||(this.initialValue=s.getString(),this.initialUnits=s.getUnits()),this.duration>this.maxDuration){const r=this.getAttribute("fill").getString("remove");if(this.getAttribute("repeatCount").getString()==="indefinite"||this.getAttribute("repeatDur").getString()==="indefinite")this.duration=0;else if(r==="freeze"&&!this.frozen)this.frozen=!0,e&&s&&(e.animationFrozen=!0,e.animationFrozenValue=s.getString());else if(r==="remove"&&!this.removed)return this.removed=!0,e&&s&&s.setValue(e.animationFrozen?e.animationFrozenValue:this.initialValue),!0;return!1}this.duration+=t;let i=!1;if(this.begin<this.duration){let r=this.calcValue();const o=this.getAttribute("type");if(o.hasValue()){const n=o.getString();r="".concat(n,"(").concat(r,")")}s.setValue(r),i=!0}return i}getProgress(){const{document:t,values:e}=this;let s=(this.duration-this.begin)/(this.maxDuration-this.begin),i,r;if(e.hasValue()){const o=s*(e.getValue().length-1),n=Math.floor(o),a=Math.ceil(o);let h;h=e.getValue()[n],i=new S(t,"from",h?parseFloat(h):0),h=e.getValue()[a],r=new S(t,"to",h?parseFloat(h):0),s=(o-n)/(a-n)}else i=this.from,r=this.to;return{progress:s,from:i,to:r}}constructor(t,e,s){super(t,e,s),this.type="animate",this.duration=0,this.initialUnits="",this.removed=!1,this.frozen=!1,t.screen.animations.push(this),this.begin=this.getAttribute("begin").getMilliseconds(),this.maxDuration=this.begin+this.getAttribute("dur").getMilliseconds(),this.from=this.getAttribute("from"),this.to=this.getAttribute("to"),this.values=new S(t,"values",null);const i=this.getAttribute("values");i.hasValue()&&this.values.setValue(i.getString().split(";"))}}class yi extends pe{calcValue(){const{progress:t,from:e,to:s}=this.getProgress(),i=new ue(e.getColor()),r=new ue(s.getColor());if(i.ok&&r.ok){const o=i.r+(r.r-i.r)*t,n=i.g+(r.g-i.g)*t,a=i.b+(r.b-i.b)*t;return"rgb(".concat(Math.floor(o),", ").concat(Math.floor(n),", ").concat(Math.floor(a),")")}return this.getAttribute("from").getColor()}constructor(...t){super(...t),this.type="animateColor"}}class mi extends pe{calcValue(){const{progress:t,from:e,to:s}=this.getProgress(),i=$(e.getString()),r=$(s.getString());return i.map((n,a)=>{const h=r[a];return n+(h-n)*t}).join(" ")}constructor(...t){super(...t),this.type="animateTransform"}}class rs extends M{constructor(t,e,s){super(t,e,s),this.type="font-face",this.ascent=this.getAttribute("ascent").getNumber(),this.descent=this.getAttribute("descent").getNumber(),this.unitsPerEm=this.getAttribute("units-per-em").getNumber()}}class ye extends P{constructor(t,e,s){super(t,e,s),this.type="glyph",this.horizAdvX=this.getAttribute("horiz-adv-x").getNumber(),this.unicode=this.getAttribute("unicode").getString(),this.arabicForm=this.getAttribute("arabic-form").getString()}}class ns extends ye{constructor(...t){super(...t),this.type="missing-glyph",this.horizAdvX=0}}class xi extends M{render(){}constructor(t,e,s){super(t,e,s),this.type="font",this.isArabic=!1,this.glyphs={},this.arabicGlyphs={},this.isRTL=!1,this.horizAdvX=this.getAttribute("horiz-adv-x").getNumber();const{definitions:i}=t,{children:r}=this;for(const o of r)if(o instanceof rs){this.fontFace=o;const n=o.getStyle("font-family");n.hasValue()&&(i[n.getString()]=this)}else if(o instanceof ns)this.missingGlyph=o;else if(o instanceof ye)if(o.arabicForm){this.isRTL=!0,this.isArabic=!0;const n=this.arabicGlyphs[o.unicode];typeof n>"u"?this.arabicGlyphs[o.unicode]={[o.arabicForm]:o}:n[o.arabicForm]=o}else this.glyphs[o.unicode]=o}}class bi extends ht{getText(){const t=this.getHrefAttribute().getDefinition();if(t){const e=t.children[0];if(e)return e.getText()}return""}constructor(...t){super(...t),this.type="tref"}}class vi extends ht{getText(){return this.text}renderChildren(t){if(this.hasText){super.renderChildren(t);const{document:e,x:s,y:i}=this,{mouse:r}=e.screen,o=new S(e,"fontSize",W.parse(e.ctx.font).fontSize);r.isWorking()&&r.checkBoundingBox(this,new J(s,i-o.getPixels("y"),s+this.measureText(t),i))}else if(this.children.length>0){const e=new de(this.document);e.children=this.children,e.parent=this,e.render(t)}}onClick(){const{window:t}=this.document;t&&t.open(this.getHrefAttribute().getString())}onMouseMove(){const t=this.document.ctx;t.canvas.style.cursor="pointer"}constructor(t,e,s){super(t,e,s),this.type="a";const{childNodes:i}=e,r=i[0],o=i.length>0&&Array.from(i).every(n=>n.nodeType===3);this.hasText=o,this.text=o?this.getTextFromNode(r):""}}class Si extends ht{getText(){return this.text}path(t){const{dataArray:e}=this;t&&t.beginPath(),e.forEach(s=>{let{type:i,points:r}=s;switch(i){case w.LINE_TO:t&&t.lineTo(r[0],r[1]);break;case w.MOVE_TO:t&&t.moveTo(r[0],r[1]);break;case w.CURVE_TO:t&&t.bezierCurveTo(r[0],r[1],r[2],r[3],r[4],r[5]);break;case w.QUAD_TO:t&&t.quadraticCurveTo(r[0],r[1],r[2],r[3]);break;case w.ARC:{const[o,n,a,h,c,f,g,u]=r,d=a>h?a:h,p=a>h?1:a/h,m=a>h?h/a:1;t&&(t.translate(o,n),t.rotate(g),t.scale(p,m),t.arc(0,0,d,c,c+f,!!(1-u)),t.scale(1/p,1/m),t.rotate(-g),t.translate(-o,-n));break}case w.CLOSE_PATH:t&&t.closePath();break}})}renderChildren(t){this.setTextData(t),t.save();const e=this.parent.getStyle("text-decoration").getString(),s=this.getFontSize(),{glyphInfo:i}=this,r=t.fillStyle;e==="underline"&&t.beginPath(),i.forEach((o,n)=>{const{p0:a,p1:h,rotation:c,text:f}=o;t.save(),t.translate(a.x,a.y),t.rotate(c),t.fillStyle&&t.fillText(f,0,0),t.strokeStyle&&t.strokeText(f,0,0),t.restore(),e==="underline"&&(n===0&&t.moveTo(a.x,a.y+s/8),t.lineTo(h.x,h.y+s/5))}),e==="underline"&&(t.lineWidth=s/20,t.strokeStyle=r,t.stroke(),t.closePath()),t.restore()}getLetterSpacingAt(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return this.letterSpacingCache[t]||0}findSegmentToFitChar(t,e,s,i,r,o,n,a,h){let c=o,f=this.measureText(t,a);a===" "&&e==="justify"&&s<i&&(f+=(i-s)/r),h>-1&&(c+=this.getLetterSpacingAt(h));const g=this.textHeight/20,u=this.getEquidistantPointOnPath(c,g,0),d=this.getEquidistantPointOnPath(c+f,g,0),p={p0:u,p1:d},m=u&&d?Math.atan2(d.y-u.y,d.x-u.x):0;if(n){const x=Math.cos(Math.PI/2+m)*n,T=Math.cos(-m)*n;p.p0={...u,x:u.x+x,y:u.y+T},p.p1={...d,x:d.x+x,y:d.y+T}}return c+=f,{offset:c,segment:p,rotation:m}}measureText(t,e){const{measuresCache:s}=this,i=e||this.getText();if(s.has(i))return s.get(i);const r=this.measureTargetText(t,i);return s.set(i,r),r}setTextData(t){if(this.glyphInfo)return;const e=this.getText(),s=e.split(""),i=e.split(" ").length-1,r=this.parent.getAttribute("dx").split().map(b=>b.getPixels("x")),o=this.parent.getAttribute("dy").getPixels("y"),n=this.parent.getStyle("text-anchor").getString("start"),a=this.getStyle("letter-spacing"),h=this.parent.getStyle("letter-spacing");let c=0;!a.hasValue()||a.getValue()==="inherit"?c=h.getPixels():a.hasValue()&&a.getValue()!=="initial"&&a.getValue()!=="unset"&&(c=a.getPixels());const f=[],g=e.length;this.letterSpacingCache=f;for(let b=0;b<g;b++)f.push(typeof r[b]<"u"?r[b]:c);const u=f.reduce((b,v,E)=>E===0?0:b+v||0,0),d=this.measureText(t),p=Math.max(d+u,0);this.textWidth=d,this.textHeight=this.getFontSize(),this.glyphInfo=[];const m=this.getPathLength(),x=this.getStyle("startOffset").getNumber(0)*m;let T=0;(n==="middle"||n==="center")&&(T=-p/2),(n==="end"||n==="right")&&(T=-p),T+=x,s.forEach((b,v)=>{const{offset:E,segment:C,rotation:A}=this.findSegmentToFitChar(t,n,p,m,i,T,o,b,v);T=E,!(!C.p0||!C.p1)&&this.glyphInfo.push({text:s[v],p0:C.p0,p1:C.p1,rotation:A})})}parsePathData(t){if(this.pathLength=-1,!t)return[];const e=[],{pathParser:s}=t;for(s.reset();!s.isEnd();){const{current:i}=s,r=i?i.x:0,o=i?i.y:0,n=s.next();let a=n.type,h=[];switch(n.type){case w.MOVE_TO:this.pathM(s,h);break;case w.LINE_TO:a=this.pathL(s,h);break;case w.HORIZ_LINE_TO:a=this.pathH(s,h);break;case w.VERT_LINE_TO:a=this.pathV(s,h);break;case w.CURVE_TO:this.pathC(s,h);break;case w.SMOOTH_CURVE_TO:a=this.pathS(s,h);break;case w.QUAD_TO:this.pathQ(s,h);break;case w.SMOOTH_QUAD_TO:a=this.pathT(s,h);break;case w.ARC:h=this.pathA(s);break;case w.CLOSE_PATH:P.pathZ(s);break}n.type!==w.CLOSE_PATH?e.push({type:a,points:h,start:{x:r,y:o},pathLength:this.calcLength(r,o,a,h)}):e.push({type:w.CLOSE_PATH,points:[],pathLength:0})}return e}pathM(t,e){const{x:s,y:i}=P.pathM(t).point;e.push(s,i)}pathL(t,e){const{x:s,y:i}=P.pathL(t).point;return e.push(s,i),w.LINE_TO}pathH(t,e){const{x:s,y:i}=P.pathH(t).point;return e.push(s,i),w.LINE_TO}pathV(t,e){const{x:s,y:i}=P.pathV(t).point;return e.push(s,i),w.LINE_TO}pathC(t,e){const{point:s,controlPoint:i,currentPoint:r}=P.pathC(t);e.push(s.x,s.y,i.x,i.y,r.x,r.y)}pathS(t,e){const{point:s,controlPoint:i,currentPoint:r}=P.pathS(t);return e.push(s.x,s.y,i.x,i.y,r.x,r.y),w.CURVE_TO}pathQ(t,e){const{controlPoint:s,currentPoint:i}=P.pathQ(t);e.push(s.x,s.y,i.x,i.y)}pathT(t,e){const{controlPoint:s,currentPoint:i}=P.pathT(t);return e.push(s.x,s.y,i.x,i.y),w.QUAD_TO}pathA(t){let{rX:e,rY:s,sweepFlag:i,xAxisRotation:r,centp:o,a1:n,ad:a}=P.pathA(t);return i===0&&a>0&&(a-=2*Math.PI),i===1&&a<0&&(a+=2*Math.PI),[o.x,o.y,e,s,n,a,r,i]}calcLength(t,e,s,i){let r=0,o=null,n=null,a=0;switch(s){case w.LINE_TO:return this.getLineLength(t,e,i[0],i[1]);case w.CURVE_TO:for(r=0,o=this.getPointOnCubicBezier(0,t,e,i[0],i[1],i[2],i[3],i[4],i[5]),a=.01;a<=1;a+=.01)n=this.getPointOnCubicBezier(a,t,e,i[0],i[1],i[2],i[3],i[4],i[5]),r+=this.getLineLength(o.x,o.y,n.x,n.y),o=n;return r;case w.QUAD_TO:for(r=0,o=this.getPointOnQuadraticBezier(0,t,e,i[0],i[1],i[2],i[3]),a=.01;a<=1;a+=.01)n=this.getPointOnQuadraticBezier(a,t,e,i[0],i[1],i[2],i[3]),r+=this.getLineLength(o.x,o.y,n.x,n.y),o=n;return r;case w.ARC:{r=0;const h=i[4],c=i[5],f=i[4]+c;let g=Math.PI/180;if(Math.abs(h-f)<g&&(g=Math.abs(h-f)),o=this.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],h,0),c<0)for(a=h-g;a>f;a-=g)n=this.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],a,0),r+=this.getLineLength(o.x,o.y,n.x,n.y),o=n;else for(a=h+g;a<f;a+=g)n=this.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],a,0),r+=this.getLineLength(o.x,o.y,n.x,n.y),o=n;return n=this.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],f,0),r+=this.getLineLength(o.x,o.y,n.x,n.y),r}}return 0}getPointOnLine(t,e,s,i,r){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:e,n=arguments.length>6&&arguments[6]!==void 0?arguments[6]:s;const a=(r-s)/(i-e+Tt);let h=Math.sqrt(t*t/(1+a*a));i<e&&(h*=-1);let c=a*h,f=null;if(i===e)f={x:o,y:n+c};else if((n-s)/(o-e+Tt)===a)f={x:o+h,y:n+c};else{let g=0,u=0;const d=this.getLineLength(e,s,i,r);if(d<Tt)return null;let p=(o-e)*(i-e)+(n-s)*(r-s);p/=d*d,g=e+p*(i-e),u=s+p*(r-s);const m=this.getLineLength(o,n,g,u),x=Math.sqrt(t*t-m*m);h=Math.sqrt(x*x/(1+a*a)),i<e&&(h*=-1),c=a*h,f={x:g+h,y:u+c}}return f}getPointOnPath(t){const e=this.getPathLength();let s=0,i=null;if(t<-5e-5||t-5e-5>e)return null;const{dataArray:r}=this;for(const o of r){if(o&&(o.pathLength<5e-5||s+o.pathLength+5e-5<t)){s+=o.pathLength;continue}const n=t-s;let a=0;switch(o.type){case w.LINE_TO:i=this.getPointOnLine(n,o.start.x,o.start.y,o.points[0],o.points[1],o.start.x,o.start.y);break;case w.ARC:{const h=o.points[4],c=o.points[5],f=o.points[4]+c;if(a=h+n/o.pathLength*c,c<0&&a<f||c>=0&&a>f)break;i=this.getPointOnEllipticalArc(o.points[0],o.points[1],o.points[2],o.points[3],a,o.points[6]);break}case w.CURVE_TO:a=n/o.pathLength,a>1&&(a=1),i=this.getPointOnCubicBezier(a,o.start.x,o.start.y,o.points[0],o.points[1],o.points[2],o.points[3],o.points[4],o.points[5]);break;case w.QUAD_TO:a=n/o.pathLength,a>1&&(a=1),i=this.getPointOnQuadraticBezier(a,o.start.x,o.start.y,o.points[0],o.points[1],o.points[2],o.points[3]);break}if(i)return i;break}return null}getLineLength(t,e,s,i){return Math.sqrt((s-t)*(s-t)+(i-e)*(i-e))}getPathLength(){return this.pathLength===-1&&(this.pathLength=this.dataArray.reduce((t,e)=>e.pathLength>0?t+e.pathLength:t,0)),this.pathLength}getPointOnCubicBezier(t,e,s,i,r,o,n,a,h){const c=a*De(t)+o*Be(t)+i*_e(t)+e*ze(t),f=h*De(t)+n*Be(t)+r*_e(t)+s*ze(t);return{x:c,y:f}}getPointOnQuadraticBezier(t,e,s,i,r,o,n){const a=o*Fe(t)+i*Ue(t)+e*Xe(t),h=n*Fe(t)+r*Ue(t)+s*Xe(t);return{x:a,y:h}}getPointOnEllipticalArc(t,e,s,i,r,o){const n=Math.cos(o),a=Math.sin(o),h={x:s*Math.cos(r),y:i*Math.sin(r)};return{x:t+(h.x*n-h.y*a),y:e+(h.x*a+h.y*n)}}buildEquidistantCache(t,e){const s=this.getPathLength(),i=e||.25,r=t||s/100;if(!this.equidistantCache||this.equidistantCache.step!==r||this.equidistantCache.precision!==i){this.equidistantCache={step:r,precision:i,points:[]};let o=0;for(let n=0;n<=s;n+=i){const a=this.getPointOnPath(n),h=this.getPointOnPath(n+i);!a||!h||(o+=this.getLineLength(a.x,a.y,h.x,h.y),o>=r&&(this.equidistantCache.points.push({x:a.x,y:a.y,distance:n}),o-=r))}}}getEquidistantPointOnPath(t,e,s){if(this.buildEquidistantCache(e,s),t<0||t-this.getPathLength()>5e-5)return null;const i=Math.round(t/this.getPathLength()*(this.equidistantCache.points.length-1));return this.equidistantCache.points[i]||null}constructor(t,e,s){super(t,e,s),this.type="textPath",this.textWidth=0,this.textHeight=0,this.pathLength=-1,this.glyphInfo=null,this.letterSpacingCache=[],this.measuresCache=new Map([["",0]]);const i=this.getHrefAttribute().getDefinition();this.text=this.getTextFromNode(),this.dataArray=this.parsePathData(i)}}const Ti=/^\s*data:(([^/,;]+\/[^/,;]+)(?:;([^,;=]+=[^,;=]+))?)?(?:;(base64))?,(.*)$/i;class Ai extends mt{async loadImage(t){try{const e=await this.document.createImage(t);this.image=e}catch(e){console.error('Error while loading image "'.concat(t,'":'),e)}this.loaded=!0}async loadSvg(t){const e=Ti.exec(t);if(e){const s=e[5];s&&(e[4]==="base64"?this.image=atob(s):this.image=decodeURIComponent(s))}else try{const i=await(await this.document.fetch(t)).text();this.image=i}catch(s){console.error('Error while loading image "'.concat(t,'":'),s)}this.loaded=!0}renderChildren(t){const{document:e,image:s,loaded:i}=this,r=this.getAttribute("x").getPixels("x"),o=this.getAttribute("y").getPixels("y"),n=this.getStyle("width").getPixels("x"),a=this.getStyle("height").getPixels("y");if(!(!i||!s||!n||!a)){if(t.save(),t.translate(r,o),typeof s=="string"){const h=e.canvg.forkString(t,s,{ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:0,offsetY:0,scaleWidth:n,scaleHeight:a}),{documentElement:c}=h.document;c&&(c.parent=this),h.render()}else e.setViewBox({ctx:t,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:n,desiredWidth:s.width,height:a,desiredHeight:s.height}),this.loaded&&(!("complete"in s)||s.complete)&&t.drawImage(s,0,0);t.restore()}}getBoundingBox(){const t=this.getAttribute("x").getPixels("x"),e=this.getAttribute("y").getPixels("y"),s=this.getStyle("width").getPixels("x"),i=this.getStyle("height").getPixels("y");return new J(t,e,t+s,e+i)}constructor(t,e,s){super(t,e,s),this.type="image",this.loaded=!1;const i=this.getHrefAttribute().getString();if(!i)return;const r=i.endsWith(".svg")||/^\s*data:image\/svg\+xml/i.test(i);t.images.push(this),r?this.loadSvg(i):this.loadImage(i)}}class wi extends mt{render(t){}constructor(...t){super(...t),this.type="symbol"}}class Ci{async load(t,e){try{const{document:s}=this,r=(await s.canvg.parser.load(e)).getElementsByTagName("font");Array.from(r).forEach(o=>{const n=s.createElement(o);s.definitions[t]=n})}catch(s){console.error('Error while loading font "'.concat(e,'":'),s)}this.loaded=!0}constructor(t){this.document=t,this.loaded=!1,t.fonts.push(this)}}class os extends M{constructor(t,e,s){super(t,e,s),this.type="style",wt(Array.from(e.childNodes).map(o=>o.textContent).join("").replace(/(\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm,"").replace(/@import.*;/g,"")).split("}").forEach(o=>{const n=o.trim();if(!n)return;const a=n.split("{"),h=a[0].split(","),c=a[1].split(";");h.forEach(f=>{const g=f.trim();if(!g)return;const u=t.styles[g]||{};if(c.forEach(d=>{const p=d.indexOf(":"),m=d.substr(0,p).trim(),x=d.substr(p+1,d.length-p).trim();m&&x&&(u[m]=new S(t,m,x))}),t.styles[g]=u,t.stylesSpecificity[g]=Hs(g),g==="@font-face"){const d=u["font-family"].getString().replace(/"|'/g,"");u.src.getString().split(",").forEach(m=>{if(m.indexOf('format("svg")')>0){const x=Ze(m);x&&new Ci(t).load(d,x)}})}})})}}os.parseExternalUrl=Ze;class Ei extends mt{setContext(t){super.setContext(t);const e=this.getAttribute("x"),s=this.getAttribute("y");e.hasValue()&&t.translate(e.getPixels("x"),0),s.hasValue()&&t.translate(0,s.getPixels("y"))}path(t){const{element:e}=this;e&&e.path(t)}renderChildren(t){const{document:e,element:s}=this;if(s){let i=s;if(s.type==="symbol"&&(i=new Mt(e),i.attributes.viewBox=new S(e,"viewBox",s.getAttribute("viewBox").getString()),i.attributes.preserveAspectRatio=new S(e,"preserveAspectRatio",s.getAttribute("preserveAspectRatio").getString()),i.attributes.overflow=new S(e,"overflow",s.getAttribute("overflow").getString()),i.children=s.children,s.styles.opacity=new S(e,"opacity",this.calculateOpacity())),i.type==="svg"){const o=this.getStyle("width",!1,!0),n=this.getStyle("height",!1,!0);o.hasValue()&&(i.attributes.width=new S(e,"width",o.getString())),n.hasValue()&&(i.attributes.height=new S(e,"height",n.getString()))}const r=i.parent;i.parent=this,i.render(t),i.parent=r}}getBoundingBox(t){const{element:e}=this;return e?e.getBoundingBox(t):null}elementTransform(){const{document:t,element:e}=this;return e?yt.fromElement(t,e):null}get element(){return this.cachedElement||(this.cachedElement=this.getHrefAttribute().getDefinition()),this.cachedElement}constructor(...t){super(...t),this.type="use"}}function Ft(l,t,e,s,i,r){return l[e*s*4+t*4+r]}function Ut(l,t,e,s,i,r,o){l[e*s*4+t*4+r]=o}function I(l,t,e){return l[t]*e}function st(l,t,e,s){return t+Math.cos(l)*e+Math.sin(l)*s}class as extends M{apply(t,e,s,i,r){const{includeOpacity:o,matrix:n}=this,a=t.getImageData(0,0,i,r);for(let h=0;h<r;h++)for(let c=0;c<i;c++){const f=Ft(a.data,c,h,i,r,0),g=Ft(a.data,c,h,i,r,1),u=Ft(a.data,c,h,i,r,2),d=Ft(a.data,c,h,i,r,3);let p=I(n,0,f)+I(n,1,g)+I(n,2,u)+I(n,3,d)+I(n,4,1),m=I(n,5,f)+I(n,6,g)+I(n,7,u)+I(n,8,d)+I(n,9,1),x=I(n,10,f)+I(n,11,g)+I(n,12,u)+I(n,13,d)+I(n,14,1),T=I(n,15,f)+I(n,16,g)+I(n,17,u)+I(n,18,d)+I(n,19,1);o&&(p=0,m=0,x=0,T*=d/255),Ut(a.data,c,h,i,r,0,p),Ut(a.data,c,h,i,r,1,m),Ut(a.data,c,h,i,r,2,x),Ut(a.data,c,h,i,r,3,T)}t.clearRect(0,0,i,r),t.putImageData(a,0,0)}constructor(t,e,s){super(t,e,s),this.type="feColorMatrix";let i=$(this.getAttribute("values").getString());switch(this.getAttribute("type").getString("matrix")){case"saturate":{const r=i[0];i=[.213+.787*r,.715-.715*r,.072-.072*r,0,0,.213-.213*r,.715+.285*r,.072-.072*r,0,0,.213-.213*r,.715-.715*r,.072+.928*r,0,0,0,0,0,1,0,0,0,0,0,1];break}case"hueRotate":{const r=i[0]*Math.PI/180;i=[st(r,.213,.787,-.213),st(r,.715,-.715,-.715),st(r,.072,-.072,.928),0,0,st(r,.213,-.213,.143),st(r,.715,.285,.14),st(r,.072,-.072,-.283),0,0,st(r,.213,-.213,-.787),st(r,.715,-.715,.715),st(r,.072,.928,.072),0,0,0,0,0,1,0,0,0,0,0,1];break}case"luminanceToAlpha":i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,.2125,.7154,.0721,0,0,0,0,0,0,1];break}this.matrix=i,this.includeOpacity=this.getAttribute("includeOpacity").hasValue()}}class Yt extends M{apply(t,e){const{document:s}=this;let i=this.getAttribute("x").getPixels("x"),r=this.getAttribute("y").getPixels("y"),o=this.getStyle("width").getPixels("x"),n=this.getStyle("height").getPixels("y");if(!o&&!n){const u=new J;this.children.forEach(d=>{u.addBoundingBox(d.getBoundingBox(t))}),i=Math.floor(u.x1),r=Math.floor(u.y1),o=Math.floor(u.width),n=Math.floor(u.height)}const a=this.removeStyles(e,Yt.ignoreStyles),h=s.createCanvas(i+o,r+n),c=h.getContext("2d");s.screen.setDefaults(c),this.renderChildren(c),new as(s,{nodeType:1,childNodes:[],attributes:[{nodeName:"type",value:"luminanceToAlpha"},{nodeName:"includeOpacity",value:"true"}]}).apply(c,0,0,i+o,r+n);const f=s.createCanvas(i+o,r+n),g=f.getContext("2d");s.screen.setDefaults(g),e.render(g),g.globalCompositeOperation="destination-in",g.fillStyle=c.createPattern(h,"no-repeat"),g.fillRect(0,0,i+o,r+n),t.fillStyle=g.createPattern(f,"no-repeat"),t.fillRect(0,0,i+o,r+n),this.restoreStyles(e,a)}render(t){}constructor(...t){super(...t),this.type="mask"}}Yt.ignoreStyles=["mask","transform","clip-path"];const Ye=()=>{};class Pi extends M{apply(t){const{document:e}=this,s=Reflect.getPrototypeOf(t),{beginPath:i,closePath:r}=t;s&&(s.beginPath=Ye,s.closePath=Ye),Reflect.apply(i,t,[]),this.children.forEach(o=>{if(!("path"in o))return;let n="elementTransform"in o?o.elementTransform():null;n||(n=yt.fromElement(e,o)),n&&n.apply(t),o.path(t),s&&(s.closePath=r),n&&n.unapply(t)}),Reflect.apply(r,t,[]),t.clip(),s&&(s.beginPath=i,s.closePath=r)}render(t){}constructor(...t){super(...t),this.type="clipPath"}}class Wt extends M{apply(t,e){const{document:s,children:i}=this,r="getBoundingBox"in e?e.getBoundingBox(t):null;if(!r)return;let o=0,n=0;i.forEach(x=>{const T=x.extraFilterDistance||0;o=Math.max(o,T),n=Math.max(n,T)});const a=Math.floor(r.width),h=Math.floor(r.height),c=a+2*o,f=h+2*n;if(c<1||f<1)return;const g=Math.floor(r.x),u=Math.floor(r.y),d=this.removeStyles(e,Wt.ignoreStyles),p=s.createCanvas(c,f),m=p.getContext("2d");s.screen.setDefaults(m),m.translate(-g+o,-u+n),e.render(m),i.forEach(x=>{typeof x.apply=="function"&&x.apply(m,0,0,c,f)}),t.drawImage(p,0,0,c,f,g-o,u-n,c,f),this.restoreStyles(e,d)}render(t){}constructor(...t){super(...t),this.type="filter"}}Wt.ignoreStyles=["filter","transform","clip-path"];class Mi extends M{apply(t,e,s,i,r){}constructor(t,e,s){super(t,e,s),this.type="feDropShadow",this.addStylesFromStyleDefinition()}}class Ni extends M{apply(t,e,s,i,r){}constructor(...t){super(...t),this.type="feMorphology"}}class Oi extends M{apply(t,e,s,i,r){}constructor(...t){super(...t),this.type="feComposite"}}class Vi extends M{apply(t,e,s,i,r){const{document:o,blurRadius:n}=this,a=o.window?o.window.document.body:null,h=t.canvas;h.id=o.getUniqueId(),a&&(h.style.display="none",a.appendChild(h)),Ms(h,e,s,i,r,n),a&&a.removeChild(h)}constructor(t,e,s){super(t,e,s),this.type="feGaussianBlur",this.blurRadius=Math.floor(this.getAttribute("stdDeviation").getNumber()),this.extraFilterDistance=this.blurRadius}}class ki extends M{constructor(...t){super(...t),this.type="title"}}class Ri extends M{constructor(...t){super(...t),this.type="desc"}}const Li={svg:Mt,rect:es,circle:oi,ellipse:ai,line:hi,polyline:ss,polygon:li,path:P,pattern:ci,marker:ui,defs:fi,linearGradient:gi,radialGradient:di,stop:pi,animate:pe,animateColor:yi,animateTransform:mi,font:xi,"font-face":rs,"missing-glyph":ns,glyph:ye,text:ht,tspan:Ht,tref:bi,a:vi,textPath:Si,image:Ai,g:de,symbol:wi,style:os,use:Ei,mask:Yt,clipPath:Pi,filter:Wt,feDropShadow:Mi,feMorphology:Ni,feComposite:Oi,feColorMatrix:as,feGaussianBlur:Vi,title:ki,desc:Ri};function Ii(l,t){const e=document.createElement("canvas");return e.width=l,e.height=t,e}async function Di(l){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const e=document.createElement("img");return t&&(e.crossOrigin="Anonymous"),new Promise((s,i)=>{e.onload=()=>{s(e)},e.onerror=(r,o,n,a,h)=>{i(h)},e.src=l})}const le=12;class at{bindCreateImage(t,e){return typeof e=="boolean"?(s,i)=>t(s,typeof i=="boolean"?i:e):t}get window(){return this.screen.window}get fetch(){return this.screen.fetch}get ctx(){return this.screen.ctx}get emSize(){const{emSizeStack:t}=this;return t[t.length-1]||le}set emSize(t){const{emSizeStack:e}=this;e.push(t)}popEmSize(){const{emSizeStack:t}=this;t.pop()}getUniqueId(){return"canvg".concat(++this.uniqueId)}isImagesLoaded(){return this.images.every(t=>t.loaded)}isFontsLoaded(){return this.fonts.every(t=>t.loaded)}createDocumentElement(t){const e=this.createElement(t.documentElement);return e.root=!0,e.addStylesFromStyleDefinition(),this.documentElement=e,e}createElement(t){const e=t.nodeName.replace(/^[^:]+:/,""),s=at.elementTypes[e];return s?new s(this,t):new ti(this,t)}createTextNode(t){return new ni(this,t)}setViewBox(t){this.screen.setViewBox({document:this,...t})}constructor(t,{rootEmSize:e=le,emSize:s=le,createCanvas:i=at.createCanvas,createImage:r=at.createImage,anonymousCrossOrigin:o}={}){this.canvg=t,this.definitions={},this.styles={},this.stylesSpecificity={},this.images=[],this.fonts=[],this.emSizeStack=[],this.uniqueId=0,this.screen=t.screen,this.rootEmSize=e,this.emSize=s,this.createCanvas=i,this.createImage=this.bindCreateImage(r,o),this.screen.wait(()=>this.isImagesLoaded()),this.screen.wait(()=>this.isFontsLoaded())}}at.createCanvas=Ii;at.createImage=Di;at.elementTypes=Li;class vt{static async from(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=await new he(s).parse(e);return new vt(t,r,s)}static fromString(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=new he(s).parseFromString(e);return new vt(t,r,s)}fork(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return vt.from(t,e,{...this.options,...s})}forkString(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return vt.fromString(t,e,{...this.options,...s})}ready(){return this.screen.ready()}isReady(){return this.screen.isReady()}async render(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.start({enableRedraw:!0,ignoreAnimation:!0,ignoreMouse:!0,...t}),await this.ready(),this.stop()}start(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{documentElement:e,screen:s,options:i}=this;s.start(e,{enableRedraw:!0,...i,...t})}stop(){this.screen.stop()}resize(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.documentElement.resize(t,e,s)}constructor(t,e,s={}){this.parser=new he(s),this.screen=new rt(t,s),this.options=s;const i=new at(this,s),r=i.createDocumentElement(e);this.document=i,this.documentElement=r}}const Bi=l=>{const t=document.createElement("canvas"),e=t.getContext("2d");return e&&vt.fromString(e,l).start(),t},_i="_skeleton_vtlsh_1",zi="_detail_vtlsh_12",Fi="_container_vtlsh_20",We={skeleton:_i,detail:zi,container:Fi},Xi=hs({name:"music-list",setup(){const l=ls(),t="productRenderType",e=cs({isLoading:!0,isProductLoading:!1,step:0,product:[{state:!1,name:"五线谱",type:re.staff,base64:""},{state:!1,name:"首调",type:re.firstTone,base64:""},{state:!1,name:"固定调",type:re.fixedTone,base64:""}]});us(()=>{window.appName="colexiu",fs.xmlUrl=l.xmlUrl,sessionStorage.setItem(t,e.product[e.step].type),gs({message:"生成中",duration:0}),setTimeout(()=>{e.isLoading=!1},500)});const s=async()=>{var r;e.product[e.step].state=!0,e.product[e.step].base64=await i();try{console.log(JSON.parse(JSON.stringify(e.product)),e.step)}catch(o){}if(e.step+=1,e.step!==e.product.length){sessionStorage.setItem(t,e.product[e.step].type),ps(()=>{e.isLoading=!0,setTimeout(()=>{e.isLoading=!1},500)});return}ys(),console.log(e.product),(r=window.parent)==null||r.postMessage({api:"webApi_renderSvg",product:JSON.stringify(e.product)},"*")},i=()=>new Promise(r=>{setTimeout(async()=>{var o;try{const n=(o=document.getElementById("osmdSvgPage1"))==null?void 0:o.cloneNode(!0);if(!n){r("");return}const a=n.width.animVal.value,h=n.height.animVal.value,c=document.createElementNS("http://www.w3.org/2000/svg","rect");c.setAttribute("x","0"),c.setAttribute("y","0"),c.setAttribute("width",`${a*2}`),c.setAttribute("height",`${h*2}`),c.setAttribute("fill","#fff"),n.prepend(c);const g=Bi(n.outerHTML).toDataURL("image/png",1);r(g)}catch(n){r("")}},500)});return()=>ne("div",{class:We.detail},[ne("div",{id:"scrollContainer",class:[We.container,"hideCursor"]},[!e.isLoading&&ne(ds,{renderTypeKey:t,showSelection:!1,onRendered:s},null)])])}});export{Xi as default};
|