import{c as Qe,d as ls,g as cs,r as us,E as ne,o as fs,s as gt,a as gs,b as oe,M as ds,m as ps,n as ys,e as ms}from"./instrument-7f07a0c2.js";const xs="_skeleton_vtlsh_1",bs="_detail_vtlsh_12",vs="_container_vtlsh_20",Pe={skeleton:xs,detail:bs,container:vs};var yt={},Ss={get exports(){return yt},set exports(l){yt=l}},ue={},zt={get exports(){return ue},set exports(l){ue=l}};(function(){var l,t,e,s,i,r;typeof performance<"u"&&performance!==null&&performance.now?zt.exports=function(){return performance.now()}:typeof process<"u"&&process!==null&&process.hrtime?(zt.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?(zt.exports=function(){return Date.now()-e},e=Date.now()):(zt.exports=function(){return new Date().getTime()-e},e=new Date().getTime())}).call(Qe);var Ts=ue,it=typeof window>"u"?Qe:window,Ft=["moz","webkit"],Tt="AnimationFrame",wt=it["request"+Tt],Pt=it["cancel"+Tt]||it["cancelRequest"+Tt];for(var Et=0;!wt&&Et3&&(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 "+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 Ge=function(l,t){return(Ge=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 $e(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}Ge(l,t),l.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function ws(l){var t="";Array.isArray(l)||(l=[l]);for(var e=0;el.phi1&&(l.phi2-=2*ot),l.sweepFlag===1&&l.phi2s)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 Oe(l,t,e){return(1-e)*l+e*t}function Ve(l,t,e,s){return l+Math.cos(s/180*ot)*t+Math.sin(s/180*ot)*e}function ke(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)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||he(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;Af.maxX&&(f.maxX=O),Of.maxY&&(f.maxY=O),Ok&&m(Re(u,p.x1,p.x2,p.x,k));for(var v=0,E=ke(d,p.y1,p.y2,p.y);vk&&x(Re(d,p.y1,p.y2,p.y,k))}if(p.type&y.ARC){m(p.x),x(p.y),he(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.phi1p.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=Ne(R,-A,0).map(B);L_&&k_&&kc)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===Ps[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(!Cs(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>E;if(o[b+3]=Gt,Gt!==0){var $t=255/Gt;o[b]=(O*v>>E)*$t,o[b+1]=(Y*v>>E)*$t,o[b+2]=(Z*v>>E)*$t}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>E,q>0?(q=255/q,o[Q]=(Rt*v>>E)*q,o[Q+1]=(Lt*v>>E)*q,o[Q+2]=(It*v>>E)*q):o[Q]=o[Q+1]=o[Q+2]=0,Rt-=Zt,Lt-=jt,It-=Kt,Dt-=Jt,Zt-=m.r,jt-=m.g,Kt-=m.b,Jt-=m.a,Q=vt+((Q=re+c)t--&&i?String(Math.round(parseFloat(s))):s)}const Fs=/(\[[^\]]+\])/g,Us=/(#[^\s+>~.[:]+)/g,Xs=/(\.[^\s+>~.[:]+)/g,Hs=/(::[^\s+>~.[:]+|:first-line|:first-letter|:before|:after)/gi,Ys=/(:[\w-]+\([^)]*\))/gi,Ws=/(:[^\s+>~.[:]+)/g,qs=/([^\s+>~.[:]+)/g;function pt(l,t){const e=t.exec(l);return e?[l.replace(t," "),e.length]:[l,0]}function Qs(l){const t=[0,0,0];let e=l.replace(/:not\(([^)]*)\)/g," $1 ").replace(/{[\s\S]*/gm," "),s=0;return[e,s]=pt(e,Fs),t[1]+=s,[e,s]=pt(e,Us),t[0]+=s,[e,s]=pt(e,Xs),t[1]+=s,[e,s]=pt(e,Hs),t[2]+=s,[e,s]=pt(e,Ys),t[1]+=s,[e,s]=pt(e,Ws),t[1]+=s,e=e.replace(/[*\s+>~]/g," ").replace(/[#.]/g," "),[e,s]=pt(e,qs),t[2]+=s,t.join("")}const At=1e-8;function De(l){return Math.sqrt(Math.pow(l[0],2)+Math.pow(l[1],2))}function de(l,t){return(l[0]*t[0]+l[1]*t[1])/(De(l)*De(t))}function Be(l,t){return(l[0]*t[1]0&&arguments[0]!==void 0?arguments[0]:" ";const{document:e,name:s}=this;return Ct(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=zs(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;r1&&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;r0}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 Ke=typeof window<"u"?window:null,Je=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=Ct(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=yt(x)};s||g.start(),this.intervalId=yt(x)}stop(){this.intervalId&&(yt.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=Je,window:s=Ke}={}){if(this.ctx=t,this.viewPort=new Mt,this.mouse=new Gs(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=Ke;rt.defaultFetch=Je;rt.FRAMERATE=30;rt.MAX_VIRTUAL_PIXELS=3e4;const{defaultFetch:$s}=rt,Zs=typeof DOMParser<"u"?DOMParser:void 0;class le{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=$s,DOMParser:e=Zs}={}){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 js{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 Ks{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 Js{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=At,i.y=At),this.scale=i,this.originX=s[0],this.originY=s[1]}}class ts{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=Ds(e),this.originX=s[0],this.originY=s[1]}}class es extends ts{constructor(t,e,s){super(t,e,s),this.type="skew",this.angle=new S(t,"angle",e)}}class ti extends es{constructor(t,e,s){super(t,e,s),this.type="skewX",this.matrix=[1,0,Math.tan(this.angle.getRadians()),1,0,0]}}class ei extends es{constructor(t,e,s){super(t,e,s),this.type="skewY",this.matrix=[1,Math.tan(this.angle.getRadians()),0,1,0,0]}}function si(l){return Ct(l).trim().replace(/\)([a-zA-Z])/g,") $1").replace(/\)(\s?,\s?)/g,") ").split(/\s(?=[a-z])/)}function ii(l){const[t="",e=""]=l.split("(");return[t.trim(),e.trim().replace(")","")]}class mt{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 mt(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=[],si(e).forEach(r=>{if(r==="none")return;const[o,n]=ii(r),a=mt.transformTypes[o];a&&this.transforms.push(new a(this.document,n,s))})}}mt.transformTypes={translate:js,rotate:Ks,scale:Js,matrix:ts,skewX:ti,skewY:ei};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=mt.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=_s(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 ri extends M{constructor(t,e,s){super(t,e,s)}}function ni(l){const t=l.trim();return/^('|")/.test(t)?t:'"'.concat(t,'"')}function oi(l){return typeof process>"u"?l:l.trim().split(",").map(ni).join(",")}function ai(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 hi(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=Ct(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[ai(this.fontStyle),this.fontVariant,hi(this.fontWeight),this.fontSize,oi(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),tthis.x2&&(this.x2=t)),typeof e<"u"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),ethis.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;01&&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||At}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 xt{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===" ")&&s0&&a!==" "&&s0&&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=Ct(e.textContent||"");return i===0&&(o=Ls(o)),i===r&&(o=Is(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=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.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;f0?"":this.getTextFromNode()}}class li extends Yt{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[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;h1&&(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=Be([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=Be(x,T);return de(x,T)<=-1&&(b=Math.PI),de(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 Nt extends xt{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 ss 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 ci 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 ui 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 fi 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 is 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 gi extends is{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 di extends M{createPattern(t,e,s){const i=this.getStyle("width").getPixels("x",!0),r=this.getStyle("height").getPixels("y",!0),o=new Nt(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 pi 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 Nt(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 yi extends M{render(){}constructor(...t){super(...t),this.type="defs"}}class pe extends xt{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 rs 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 ss(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 pe(n);g.attributes.transform=new S(n,"transform",this.getAttribute("gradientTransform").getValue()),g.children=[f];const u=new Nt(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 mi extends rs{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 xi extends rs{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 bi 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 ye 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{const h=r[a];return n+(h-n)*t}).join(" ")}constructor(...t){super(...t),this.type="animateTransform"}}class ns 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 me 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 os extends me{constructor(...t){super(...t),this.type="missing-glyph",this.horizAdvX=0}}class Ti 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 ns){this.fontFace=o;const n=o.getStyle("font-family");n.hasValue()&&(i[n.getString()]=this)}else if(o instanceof os)this.missingGlyph=o;else if(o instanceof me)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 Ai 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 wi 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 pe(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 Ci 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-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;bE===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)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;a5&&arguments[5]!==void 0?arguments[5]:e,n=arguments.length>6&&arguments[6]!==void 0?arguments[6]:s;const a=(r-s)/(i-e+At);let h=Math.sqrt(t*t/(1+a*a));ie)return null;const{dataArray:r}=this;for(const o of r){if(o&&(o.pathLength<5e-5||s+o.pathLength+5e-5=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*_e(t)+o*ze(t)+i*Fe(t)+e*Ue(t),f=h*_e(t)+n*ze(t)+r*Fe(t)+s*Ue(t);return{x:c,y:f}}getPointOnQuadraticBezier(t,e,s,i,r,o,n){const a=o*Xe(t)+i*He(t)+e*Ye(t),h=n*Xe(t)+r*He(t)+s*Ye(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 Ei=/^\s*data:(([^/,;]+\/[^/,;]+)(?:;([^,;=]+=[^,;=]+))?)?(?:;(base64))?,(.*)$/i;class Pi extends xt{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=Ei.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 Mi extends xt{render(t){}constructor(...t){super(...t),this.type="symbol"}}class Ni{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 as extends M{constructor(t,e,s){super(t,e,s),this.type="style",Ct(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]=Qs(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=je(m);x&&new Ni(t).load(d,x)}})}})})}}as.parseExternalUrl=je;class Oi extends xt{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 Nt(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?mt.fromElement(t,e):null}get element(){return this.cachedElement||(this.cachedElement=this.getHrefAttribute().getDefinition()),this.cachedElement}constructor(...t){super(...t),this.type="use"}}function Ut(l,t,e,s,i,r){return l[e*s*4+t*4+r]}function Xt(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 hs 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{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,Wt.ignoreStyles),h=s.createCanvas(i+o,r+n),c=h.getContext("2d");s.screen.setDefaults(c),this.renderChildren(c),new hs(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"}}Wt.ignoreStyles=["mask","transform","clip-path"];const qe=()=>{};class Vi extends M{apply(t){const{document:e}=this,s=Reflect.getPrototypeOf(t),{beginPath:i,closePath:r}=t;s&&(s.beginPath=qe,s.closePath=qe),Reflect.apply(i,t,[]),this.children.forEach(o=>{if(!("path"in o))return;let n="elementTransform"in o?o.elementTransform():null;n||(n=mt.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 qt 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,qt.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"}}qt.ignoreStyles=["filter","transform","clip-path"];class ki extends M{apply(t,e,s,i,r){}constructor(t,e,s){super(t,e,s),this.type="feDropShadow",this.addStylesFromStyleDefinition()}}class Ri extends M{apply(t,e,s,i,r){}constructor(...t){super(...t),this.type="feMorphology"}}class Li extends M{apply(t,e,s,i,r){}constructor(...t){super(...t),this.type="feComposite"}}class Ii 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)),ks(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 Di extends M{constructor(...t){super(...t),this.type="title"}}class Bi extends M{constructor(...t){super(...t),this.type="desc"}}const _i={svg:Nt,rect:ss,circle:ci,ellipse:ui,line:fi,polyline:is,polygon:gi,path:P,pattern:di,marker:pi,defs:yi,linearGradient:mi,radialGradient:xi,stop:bi,animate:ye,animateColor:vi,animateTransform:Si,font:Ti,"font-face":ns,"missing-glyph":os,glyph:me,text:ht,tspan:Yt,tref:Ai,a:wi,textPath:Ci,image:Pi,g:pe,symbol:Mi,style:as,use:Oi,mask:Wt,clipPath:Vi,filter:qt,feDropShadow:ki,feMorphology:Ri,feComposite:Li,feColorMatrix:hs,feGaussianBlur:Ii,title:Di,desc:Bi};function zi(l,t){const e=document.createElement("canvas");return e.width=l,e.height=t,e}async function Fi(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 ce=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]||ce}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 ri(this,t)}createTextNode(t){return new li(this,t)}setViewBox(t){this.screen.setViewBox({document:this,...t})}constructor(t,{rootEmSize:e=ce,emSize:s=ce,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=zi;at.createImage=Fi;at.elementTypes=_i;class St{static async from(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=await new le(s).parse(e);return new St(t,r,s)}static fromString(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=new le(s).parseFromString(e);return new St(t,r,s)}fork(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return St.from(t,e,{...this.options,...s})}forkString(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return St.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 le(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 Ui=l=>{const t=document.createElement("canvas"),e=t.getContext("2d");return e&&St.fromString(e,l).start(),t},Hi=ls({name:"transfer-to-img",setup(){const l=cs(),t="productRenderType",e=us({isLoading:!0,isProductLoading:!1,step:0,product:[{state:!1,name:"五线谱",type:ne.staff,base64:""},{state:!1,name:"首调",type:ne.firstTone,base64:""},{state:!1,name:"固定调",type:ne.fixedTone,base64:""}],isSpecialXml:!1});fs(()=>{window.appName="colexiu",gt.isSingleLine=!1,gt.isCreateImg=!0,gt.isEvxml=!0,gt.xmlUrl=decodeURIComponent(l.xmlUrl),["https://oss.dayaedu.com/MECMP/1715332965751.xml","https://oss.dayaedu.com/MECMP/1715326622946.xml"].includes(gt.xmlUrl)&&(e.isSpecialXml=!0),sessionStorage.setItem(t,e.product[e.step].type),gt.musicRenderType=e.product[e.step].type,gs({message:"生成中",duration:0}),setTimeout(()=>{e.isLoading=!1},500)});const s=async()=>{var r;document.getElementById("scrollContainer")&&ps(e.isSpecialXml),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),gt.musicRenderType=e.product[e.step].type,ys(()=>{e.isLoading=!0,setTimeout(()=>{e.isLoading=!1},500)});return}ms(),console.log(e.product,123456),(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=Ui(n.outerHTML).toDataURL("image/png",1);r(g)}catch(n){r("")}},500)});return()=>oe("div",{class:Pe.detail},[oe("div",{id:"scrollContainer",class:[Pe.container,"hideCursor"]},[!e.isLoading&&oe(ds,{renderTypeKey:t,showSelection:!1,onRendered:s},null)])])}});export{Hi as default};