System.register(["./index-legacy-262ec9e7.js"],(function(t,e){"use strict";var i,r,s,n,a,o,h,l,c,u,g,d,p,f=document.createElement("style");return f.textContent="._skeleton_vtlsh_1{position:fixed;left:0;top:0;width:100vw;height:100vh;padding:.53333rem .8rem;background-color:#fff;z-index:1000;--van-skeleton-paragraph-height: .8rem}._detail_vtlsh_12{width:100vw;height:100vh;overflow:hidden;overflow-y:auto;--header-height: 1.65333rem;background:var(--container-background)}._detail_vtlsh_12 ._container_vtlsh_20{margin:0 .26667rem;border-radius:.26667rem}._detail_vtlsh_12 #musicAndSelection{overflow:initial!important;height:initial!important;max-height:initial!important}\n",document.head.appendChild(f),{setters:[t=>{i=t.bO,r=t.d,s=t.g,n=t.n,a=t.bP,o=t.c,h=t.m,l=t.a8,c=t.h,u=t.at,g=t.bQ,d=t.aE,p=t.aa}],execute:function(){const e="_detail_vtlsh_12",f="_container_vtlsh_20";var y={},m={get exports(){return y},set exports(t){y=t}},x={},b={get exports(){return x},set exports(t){x=t}};(function(){var t,e,i,r,s,n;"undefined"!=typeof performance&&null!==performance&&performance.now?b.exports=function(){return performance.now()}:"undefined"!=typeof process&&null!==process&&process.hrtime?(b.exports=function(){return(t()-s)/1e6},e=process.hrtime,r=(t=function(){var t;return 1e9*(t=e())[0]+t[1]})(),n=1e9*process.uptime(),s=r-n):Date.now?(b.exports=function(){return Date.now()-i},i=Date.now()):(b.exports=function(){return(new Date).getTime()-i},i=(new Date).getTime())}).call(i);for(var v=x,w="undefined"==typeof window?i:window,S=["moz","webkit"],T="AnimationFrame",A=w["request"+T],C=w["cancel"+T]||w["cancelRequest"+T],P=0;!A&&P3&&(this.alpha=o[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 t=this.r.toString(16),e=this.g.toString(16),i=this.b.toString(16);return 1==t.length&&(t="0"+t),1==e.length&&(e="0"+e),1==i.length&&(i="0"+i),"#"+t+e+i},this.getHelpXML=function(){for(var t=new Array,r=0;r "+l.toRGB()+" -> "+l.toHex());h.appendChild(c),h.appendChild(u),o.appendChild(h)}catch(g){}return o}},_=function(t,e){return(_=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(t,e)}; /*! ***************************************************************************** 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. ***************************************************************************** */function V(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}_(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function R(t,e){var i=t[0],r=t[1];return[i*Math.cos(e)-r*Math.sin(e),i*Math.sin(e)+r*Math.cos(e)]}function k(){for(var t=[],e=0;et.phi1&&(t.phi2-=2*I),1===t.sweepFlag&&t.phi2r)return[];if(0===r)return[[t*i/(t*t+e*e),e*i/(t*t+e*e)]];var s=Math.sqrt(r);return[[(t*i+e*s)/(t*t+e*e),(e*i-t*s)/(t*t+e*e)],[(t*i-e*s)/(t*t+e*e),(e*i+t*s)/(t*t+e*e)]]}var B,z=Math.PI/180;function U(t,e,i){return(1-i)*t+i*e}function H(t,e,i,r){return t+Math.cos(r/180*I)*e+Math.sin(r/180*I)*i}function F(t,e,i,r){var s=1e-6,n=e-t,a=i-e,o=3*n+3*(r-i)-6*a,h=6*(a-n),l=3*n;return Math.abs(o)y&&(s.sweepFlag=+!s.sweepFlag),s}))}t.ROUND=function(t){function e(e){return Math.round(e*t)/t}return void 0===t&&(t=1e13),k(t),function(t){return void 0!==t.x1&&(t.x1=e(t.x1)),void 0!==t.y1&&(t.y1=e(t.y1)),void 0!==t.x2&&(t.x2=e(t.x2)),void 0!==t.y2&&(t.y2=e(t.y2)),void 0!==t.x&&(t.x=e(t.x)),void 0!==t.y&&(t.y=e(t.y)),void 0!==t.rX&&(t.rX=e(t.rX)),void 0!==t.rY&&(t.rY=e(t.rY)),t}},t.TO_ABS=e,t.TO_REL=function(){return s((function(t,e,i){return t.relative||(void 0!==t.x1&&(t.x1-=e),void 0!==t.y1&&(t.y1-=i),void 0!==t.x2&&(t.x2-=e),void 0!==t.y2&&(t.y2-=i),void 0!==t.x&&(t.x-=e),void 0!==t.y&&(t.y-=i),t.relative=!0),t}))},t.NORMALIZE_HVZ=function(t,e,i){return void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===i&&(i=!0),s((function(r,s,n,a,o){if(isNaN(a)&&!(r.type&$.MOVE_TO))throw new Error("path must start with moveto");return e&&r.type&$.HORIZ_LINE_TO&&(r.type=$.LINE_TO,r.y=r.relative?0:n),i&&r.type&$.VERT_LINE_TO&&(r.type=$.LINE_TO,r.x=r.relative?0:s),t&&r.type&$.CLOSE_PATH&&(r.type=$.LINE_TO,r.x=r.relative?a-s:a,r.y=r.relative?o-n:o),r.type&$.ARC&&(0===r.rX||0===r.rY)&&(r.type=$.LINE_TO,delete r.rX,delete r.rY,delete r.xRot,delete r.lArcFlag,delete r.sweepFlag),r}))},t.NORMALIZE_ST=i,t.QT_TO_C=r,t.INFO=s,t.SANITIZE=function(t){void 0===t&&(t=0),k(t);var e=NaN,i=NaN,r=NaN,n=NaN;return s((function(s,a,o,h,l){var c=Math.abs,u=!1,g=0,d=0;if(s.type&$.SMOOTH_CURVE_TO&&(g=isNaN(e)?0:a-e,d=isNaN(i)?0:o-i),s.type&($.CURVE_TO|$.SMOOTH_CURVE_TO)?(e=s.relative?a+s.x2:s.x2,i=s.relative?o+s.y2:s.y2):(e=NaN,i=NaN),s.type&$.SMOOTH_QUAD_TO?(r=isNaN(r)?a:2*a-r,n=isNaN(n)?o:2*o-n):s.type&$.QUAD_TO?(r=s.relative?a+s.x1:s.x1,n=s.relative?o+s.y1:s.y2):(r=NaN,n=NaN),s.type&$.LINE_COMMANDS||s.type&$.ARC&&(0===s.rX||0===s.rY||!s.lArcFlag)||s.type&$.CURVE_TO||s.type&$.SMOOTH_CURVE_TO||s.type&$.QUAD_TO||s.type&$.SMOOTH_QUAD_TO){var p=void 0===s.x?0:s.relative?s.x:s.x-a,f=void 0===s.y?0:s.relative?s.y:s.y-o;g=isNaN(r)?void 0===s.x1?g:s.relative?s.x:s.x1-a:r-a,d=isNaN(n)?void 0===s.y1?d:s.relative?s.y:s.y1-o:n-o;var y=void 0===s.x2?0:s.relative?s.x:s.x2-a,m=void 0===s.y2?0:s.relative?s.y:s.y2-o;c(p)<=t&&c(f)<=t&&c(g)<=t&&c(d)<=t&&c(y)<=t&&c(m)<=t&&(u=!0)}return s.type&$.CLOSE_PATH&&c(a-h)<=t&&c(o-l)<=t&&(u=!0),u?[]:s}))},t.MATRIX=n,t.ROTATE=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0),k(t,e,i);var r=Math.sin(t),s=Math.cos(t);return n(s,r,-r,s,e-e*s+i*r,i-e*r-i*s)},t.TRANSLATE=function(t,e){return void 0===e&&(e=0),k(t,e),n(1,0,0,1,t,e)},t.SCALE=function(t,e){return void 0===e&&(e=t),k(t,e),n(t,0,0,e,0,0)},t.SKEW_X=function(t){return k(t),n(1,0,Math.atan(t),1,0,0)},t.SKEW_Y=function(t){return k(t),n(1,Math.atan(t),0,1,0,0)},t.X_AXIS_SYMMETRY=function(t){return void 0===t&&(t=0),k(t),n(-1,0,0,1,t,0)},t.Y_AXIS_SYMMETRY=function(t){return void 0===t&&(t=0),k(t),n(1,0,0,-1,0,t)},t.A_TO_C=function(){return s((function(t,e,i){return $.ARC===t.type?function(t,e,i){var r,s,n,a;t.cX||L(t,e,i);for(var o=Math.min(t.phi1,t.phi2),h=Math.max(t.phi1,t.phi2)-o,l=Math.ceil(h/90),c=new Array(l),u=e,g=i,d=0;do.maxX&&(o.maxX=t),to.maxY&&(o.maxY=t),tE&&h(X(i,s.x1,s.x2,s.x,E));for(var g=0,d=F(r,s.y1,s.y2,s.y);gE&&l(X(r,s.y1,s.y2,s.y,E))}if(s.type&$.ARC){h(s.x),l(s.y),L(s,i,r);for(var p=s.xRot/180*Math.PI,f=Math.cos(p)*s.rX,y=Math.sin(p)*s.rX,m=-Math.sin(p)*s.rY,x=Math.cos(p)*s.rY,b=s.phi1s.phi2?[s.phi2+360,s.phi1+360]:[s.phi2,s.phi1],v=b[0],w=b[1],S=function(t){var e=t[0],i=t[1],r=180*Math.atan2(i,e)/Math.PI;return rv&&Ev&&Eh)throw new SyntaxError('Expected positive number, got "'+h+'" at index "'+s+'"')}else if((3===this.curArgs.length||4===this.curArgs.length)&&"0"!==this.curNumber&&"1"!==this.curNumber)throw new SyntaxError('Expected a flag, got "'+this.curNumber+'" at index "'+s+'"');this.curArgs.push(h),this.curArgs.length===Z[this.curCommandType]&&($.HORIZ_LINE_TO===this.curCommandType?r({type:$.HORIZ_LINE_TO,relative:this.curCommandRelative,x:h}):$.VERT_LINE_TO===this.curCommandType?r({type:$.VERT_LINE_TO,relative:this.curCommandRelative,y:h}):this.curCommandType===$.MOVE_TO||this.curCommandType===$.LINE_TO||this.curCommandType===$.SMOOTH_QUAD_TO?(r({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),$.MOVE_TO===this.curCommandType&&(this.curCommandType=$.LINE_TO)):this.curCommandType===$.CURVE_TO?r({type:$.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===$.SMOOTH_CURVE_TO?r({type:$.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===$.QUAD_TO?r({type:$.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===$.ARC&&r({type:$.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(!W(n))if(","===n&&this.canParseCommandOrComma)this.canParseCommandOrComma=!1;else if("+"!==n&&"-"!==n&&"."!==n)if(o)this.curNumber=n,this.curNumberHasDecimal=!1;else{if(0!==this.curArgs.length)throw new SyntaxError("Unterminated command at index "+s+".");if(!this.canParseCommandOrComma)throw new SyntaxError('Unexpected character "'+n+'" at index '+s+". Command cannot follow comma");if(this.canParseCommandOrComma=!1,"z"!==n&&"Z"!==n)if("h"===n||"H"===n)this.curCommandType=$.HORIZ_LINE_TO,this.curCommandRelative="h"===n;else if("v"===n||"V"===n)this.curCommandType=$.VERT_LINE_TO,this.curCommandRelative="v"===n;else if("m"===n||"M"===n)this.curCommandType=$.MOVE_TO,this.curCommandRelative="m"===n;else if("l"===n||"L"===n)this.curCommandType=$.LINE_TO,this.curCommandRelative="l"===n;else if("c"===n||"C"===n)this.curCommandType=$.CURVE_TO,this.curCommandRelative="c"===n;else if("s"===n||"S"===n)this.curCommandType=$.SMOOTH_CURVE_TO,this.curCommandRelative="s"===n;else if("q"===n||"Q"===n)this.curCommandType=$.QUAD_TO,this.curCommandRelative="q"===n;else if("t"===n||"T"===n)this.curCommandType=$.SMOOTH_QUAD_TO,this.curCommandRelative="t"===n;else{if("a"!==n&&"A"!==n)throw new SyntaxError('Unexpected character "'+n+'" at index '+s+".");this.curCommandType=$.ARC,this.curCommandRelative="a"===n}else e.push({type:$.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 e},e.prototype.transform=function(t){return Object.create(this,{parse:{value:function(e,i){void 0===i&&(i=[]);for(var r=0,s=Object.getPrototypeOf(this).parse.call(this,e);r>w;if(o[b+3]=G,0!==G){var $=255/G;o[b]=(L*v>>w)*$,o[b+1]=(D*v>>w)*$,o[b+2]=(B*v>>w)*$}else o[b]=o[b+1]=o[b+2]=0;L-=V,D-=R,B-=k,z-=I,V-=y.r,R-=y.g,k-=y.b,I-=y.a;var Z=Q+n+1;Z=x+(Z>w,lt>0?(lt=255/lt,o[Et]=(pt*v>>w)*lt,o[Et+1]=(ft*v>>w)*lt,o[Et+2]=(yt*v>>w)*lt):o[Et]=o[Et+1]=o[Et+2]=0,pt-=ct,ft-=ut,yt-=gt,mt-=dt,ct-=y.r,ut-=y.g,gt-=y.b,dt-=y.a,Et=nt+((Et=Pt+u)~.[:]+)/g,ht=/(\.[^\s+>~.[:]+)/g,lt=/(::[^\s+>~.[:]+|:first-line|:first-letter|:before|:after)/gi,ct=/(:[\w-]+\([^)]*\))/gi,ut=/(:[^\s+>~.[:]+)/g,gt=/([^\s+>~.[:]+)/g;function dt(t,e){const i=e.exec(t);return i?[t.replace(e," "),i.length]:[t,0]}const pt=1e-8;function ft(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2))}function yt(t,e){return(t[0]*e[0]+t[1]*e[1])/(ft(t)*ft(e))}function mt(t,e){return(t[0]*e[1]0&&void 0!==arguments[0]?arguments[0]:" ";const{document:e,name:i}=this;return it(this.getString()).trim().split(t).map((t=>new Ct(e,i,t)))}hasValue(t){const e=this.value;return null!==e&&""!==e&&(t||0!==e)&&void 0!==e}isString(t){const{value:e}=this,i="string"==typeof e;return i&&t?t.test(e):i}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 void 0===t||this.hasValue()?this.value:t}getNumber(t){if(!this.hasValue())return void 0===t?0:parseFloat(t);const{value:e}=this;let i=parseFloat(e);return this.isString(/%$/)&&(i/=100),i}getString(t){return void 0===t||this.hasValue()?void 0===this.value?"":String(this.value):String(t)}getColor(t){let e=this.getString(t);return this.isNormalizedColor||(this.isNormalizedColor=!0,e=function(t){if(!t.startsWith("rgb"))return t;let e=3;return t.replace(/\d+(\.\d+)?/g,((t,i)=>e--&&i?String(Math.round(parseFloat(t))):t))}(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&&void 0!==arguments[1]&&arguments[1];if(!this.hasValue())return 0;const[i,r]="boolean"==typeof t?[void 0,t]:[t],{viewPort:s}=this.document.screen;switch(!0){case this.isString(/vmin$/):return this.getNumber()/100*Math.min(s.computeSize("x"),s.computeSize("y"));case this.isString(/vmax$/):return this.getNumber()/100*Math.max(s.computeSize("x"),s.computeSize("y"));case this.isString(/vw$/):return this.getNumber()/100*s.computeSize("x");case this.isString(/vh$/):return this.getNumber()/100*s.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 15*this.getNumber();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(/%$/)&&r:return this.getNumber()*this.getEm();case this.isString(/%$/):return this.getNumber()*s.computeSize(i);default:{const t=this.getNumber();return e&&t<1?t*s.computeSize(i):t}}}getMilliseconds(){return this.hasValue()?this.isString(/ms$/)?this.getNumber():1e3*this.getNumber():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),i=(null==e?void 0:e[1])||t;return this.document.definitions[i]}getFillStyleDefinition(t,e){let i=this.getDefinition();if(!i)return null;if("function"==typeof i.createGradient&&"getBoundingBox"in t)return i.createGradient(this.document.ctx,t,e);if("function"==typeof i.createPattern){if(i.getHrefAttribute().hasValue()){const t=i.getAttribute("patternTransform");i=i.getHrefAttribute().getDefinition(),i&&t.hasValue()&&i.getAttribute("patternTransform",!0).setValue(t.value)}if(i)return i.createPattern(this.document.ctx,t,e)}return null}getTextBaseline(){if(!this.hasValue())return null;const t=this.getString();return Ct.textBaselineMapping[t]||null}addOpacity(t){let e=this.getColor();const i=e.length;let r=0;for(let s=0;s1&&void 0!==arguments[1]?arguments[1]:0;const[i=e,r=e]=rt(t);return new Nt(i,r)}static parseScale(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const[i=e,r=i]=rt(t);return new Nt(i,r)}static parsePath(t){const e=rt(t),i=e.length,r=[];for(let s=0;s0}runEvents(){if(!this.working)return;const{screen:t,events:e,eventElements:i}=this,{style:r}=t.ctx.canvas;let s;r&&(r.cursor=""),e.forEach(((t,e)=>{let{run:r}=t;for(s=i[e];s;)r(s),s=s.parent})),this.events=[],this.eventElements=[]}checkPath(t,e){if(!this.working||!e)return;const{events:i,eventElements:r}=this;i.forEach(((i,s)=>{let{x:n,y:a}=i;!r[s]&&e.isPointInPath&&e.isPointInPath(n,a)&&(r[s]=t)}))}checkBoundingBox(t,e){if(!this.working||!e)return;const{events:i,eventElements:r}=this;i.forEach(((i,s)=>{let{x:n,y:a}=i;!r[s]&&e.isPointInBox(n,a)&&(r[s]=t)}))}mapXY(t,e){const{window:i,ctx:r}=this.screen,s=new Nt(t,e);let n=r.canvas;for(;n;)s.x-=n.offsetLeft,s.y-=n.offsetTop,n=n.offsetParent;return(null==i?void 0:i.scrollX)&&(s.x+=i.scrollX),(null==i?void 0:i.scrollY)&&(s.y+=i.scrollY),s}onClick(t){const{x:e,y:i}=this.mapXY(t.clientX,t.clientY);this.events.push({type:"onclick",x:e,y:i,run(t){t.onClick&&t.onClick()}})}onMouseMove(t){const{x:e,y:i}=this.mapXY(t.clientX,t.clientY);this.events.push({type:"onmousemove",x:e,y:i,run(t){t.onMouseMove&&t.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 Mt="undefined"!=typeof window?window:null,_t="undefined"!=typeof fetch?fetch.bind(void 0):void 0;class Vt{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((t=>t()));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:i,aspectRatio:r,width:s,desiredWidth:n,height:a,desiredHeight:o,minX:h=0,minY:l=0,refX:c,refY:u,clip:g=!1,clipX:d=0,clipY:p=0}=t;const f=it(r).replace(/^defer\s/,""),[y,m]=f.split(" "),x=y||"xMidYMid",b=m||"meet",v=s/n,w=a/o,S=Math.min(v,w),T=Math.max(v,w);let A=n,C=o;"meet"===b&&(A*=S,C*=S),"slice"===b&&(A*=T,C*=T);const P=new Ct(e,"refX",c),E=new Ct(e,"refY",u),N=P.hasValue()&&E.hasValue();if(N&&i.translate(-S*P.getPixels("x"),-S*E.getPixels("y")),g){const t=S*d,e=S*p;i.beginPath(),i.moveTo(t,e),i.lineTo(s,e),i.lineTo(s,a),i.lineTo(t,a),i.closePath(),i.clip()}if(!N){const t="meet"===b&&S===w,e="slice"===b&&T===w,r="meet"===b&&S===v,n="slice"===b&&T===v;x.startsWith("xMid")&&(t||e)&&i.translate(s/2-A/2,0),x.endsWith("YMid")&&(r||n)&&i.translate(0,a/2-C/2),x.startsWith("xMax")&&(t||e)&&i.translate(s-A,0),x.endsWith("YMax")&&(r||n)&&i.translate(0,a-C)}switch(!0){case"none"===x:i.scale(v,w);break;case"meet"===b:i.scale(S,S);break;case"slice"===b:i.scale(T,T)}i.translate(-h,-l)}start(t){let{enableRedraw:e=!1,ignoreMouse:i=!1,ignoreAnimation:r=!1,ignoreDimensions:s=!1,ignoreClear:n=!1,forceRedraw:a,scaleWidth:o,scaleHeight:h,offsetX:l,offsetY:c}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{mouse:u}=this,g=1e3/Vt.FRAMERATE;if(this.isReadyLock=!1,this.frameDuration=g,this.readyPromise=new Promise((t=>{this.resolveReady=t})),this.isReady()&&this.render(t,s,n,o,h,l,c),!e)return;let d=Date.now(),p=d,f=0;const m=()=>{d=Date.now(),f=d-p,f>=g&&(p=d-f%g,this.shouldUpdate(r,a)&&(this.render(t,s,n,o,h,l,c),u.runEvents())),this.intervalId=y(m)};i||u.start(),this.intervalId=y(m)}stop(){this.intervalId&&(y.cancel(this.intervalId),this.intervalId=null),this.mouse.stop()}shouldUpdate(t,e){if(!t){const{frameDuration:t}=this;if(this.animations.reduce(((e,i)=>i.update(t)||e),!1))return!0}return!("function"!=typeof e||!e())||!(this.isReadyLock||!this.isReady())||!!this.mouse.hasEvents()}render(t,e,i,r,s,n,a){const{viewPort:o,ctx:h,isFirstRender:l}=this,c=h.canvas;o.clear(),c.width&&c.height&&o.setCurrent(c.width,c.height);const u=t.getStyle("width"),g=t.getStyle("height");!e&&(l||"number"!=typeof r&&"number"!=typeof s)&&(u.hasValue()&&(c.width=u.getPixels("x"),c.style&&(c.style.width="".concat(c.width,"px"))),g.hasValue()&&(c.height=g.getPixels("y"),c.style&&(c.style.height="".concat(c.height,"px"))));let d=c.clientWidth||c.width,p=c.clientHeight||c.height;if(e&&u.hasValue()&&g.hasValue()&&(d=u.getPixels("x"),p=g.getPixels("y")),o.setCurrent(d,p),"number"==typeof n&&t.getAttribute("x",!0).setValue(n),"number"==typeof a&&t.getAttribute("y",!0).setValue(a),"number"==typeof r||"number"==typeof s){const e=rt(t.getAttribute("viewBox").getString());let i=0,n=0;if("number"==typeof r){const s=t.getStyle("width");s.hasValue()?i=s.getPixels("x")/r:e[2]&&!isNaN(e[2])&&(i=e[2]/r)}if("number"==typeof s){const i=t.getStyle("height");i.hasValue()?n=i.getPixels("y")/s:e[3]&&!isNaN(e[3])&&(n=e[3]/s)}i||(i=n),n||(n=i),t.getAttribute("width",!0).setValue(r),t.getAttribute("height",!0).setValue(s);const a=t.getStyle("transform",!0,!0);a.setValue("".concat(a.getString()," scale(").concat(1/i,", ").concat(1/n,")"))}i||h.clearRect(0,0,d,p),t.render(h),l&&(this.isFirstRender=!1)}constructor(t,{fetch:e=_t,window:i=Mt}={}){if(this.ctx=t,this.viewPort=new Pt,this.mouse=new Ot(this),this.animations=[],this.waits=[],this.frameDuration=0,this.isReadyLock=!1,this.isFirstRender=!0,this.intervalId=null,this.window=i,!e)throw new Error("Can't find 'fetch' in 'globalThis', please provide it via options");this.fetch=e}}Vt.defaultWindow=Mt,Vt.defaultFetch=_t,Vt.FRAMERATE=30,Vt.MAX_VIRTUAL_PIXELS=3e4;const{defaultFetch:Rt}=Vt,kt="undefined"!=typeof DOMParser?DOMParser:void 0;class It{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(i){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 e=await this.fetch(t),i=await e.text();return this.parseFromString(i)}constructor({fetch:t=Rt,DOMParser:e=kt}={}){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 Lt{apply(t){const{originX:e,originY:i,matrix:r}=this,s=e.getPixels("x"),n=i.getPixels("y");t.translate(s,n),t.transform(r[0],r[1],r[2],r[3],r[4],r[5]),t.translate(-s,-n)}unapply(t){const{originX:e,originY:i,matrix:r}=this,s=r[0],n=r[2],a=r[4],o=r[1],h=r[3],l=r[5],c=1/(s*(1*h-0*l)-n*(1*o-0*l)+a*(0*o-0*h)),u=e.getPixels("x"),g=i.getPixels("y");t.translate(u,g),t.transform(c*(1*h-0*l),c*(0*l-1*o),c*(0*a-1*n),c*(1*s-0*a),c*(n*l-a*h),c*(a*o-s*l)),t.translate(-u,-g)}applyToPoint(t){t.applyTransform(this.matrix)}constructor(t,e,i){this.type="matrix",this.matrix=function(t){const e=rt(t);return[e[0]||0,e[1]||0,e[2]||0,e[3]||0,e[4]||0,e[5]||0]}(e),this.originX=i[0],this.originY=i[1]}}class Dt extends Lt{constructor(t,e,i){super(t,e,i),this.type="skew",this.angle=new Ct(t,"angle",e)}}class Bt{static fromElement(t,e){const i=e.getStyle("transform",!1,!0);if(i.hasValue()){const[r,s=r]=e.getStyle("transform-origin",!1,!0).split();if(r&&s){const e=[r,s];return new Bt(t,i.getString(),e)}}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,i){this.document=t,this.transforms=[],it(e).trim().replace(/\)([a-zA-Z])/g,") $1").replace(/\)(\s?,\s?)/g,") ").split(/\s(?=[a-z])/).forEach((t=>{if("none"===t)return;const[e,r]=function(t){const[e="",i=""]=t.split("(");return[e.trim(),i.trim().replace(")","")]}(t),s=Bt.transformTypes[e];s&&this.transforms.push(new s(this.document,r,i))}))}}Bt.transformTypes={translate:class{apply(t){const{x:e,y:i}=this.point;t.translate(e||0,i||0)}unapply(t){const{x:e,y:i}=this.point;t.translate(-1*e||0,-1*i||0)}applyToPoint(t){const{x:e,y:i}=this.point;t.applyTransform([1,0,0,1,e||0,i||0])}constructor(t,e){this.type="translate",this.point=Nt.parse(e)}},rotate:class{apply(t){const{cx:e,cy:i,originX:r,originY:s,angle:n}=this,a=e+r.getPixels("x"),o=i+s.getPixels("y");t.translate(a,o),t.rotate(n.getRadians()),t.translate(-a,-o)}unapply(t){const{cx:e,cy:i,originX:r,originY:s,angle:n}=this,a=e+r.getPixels("x"),o=i+s.getPixels("y");t.translate(a,o),t.rotate(-1*n.getRadians()),t.translate(-a,-o)}applyToPoint(t){const{cx:e,cy:i,angle:r}=this,s=r.getRadians();t.applyTransform([1,0,0,1,e||0,i||0]),t.applyTransform([Math.cos(s),Math.sin(s),-Math.sin(s),Math.cos(s),0,0]),t.applyTransform([1,0,0,1,-e||0,-i||0])}constructor(t,e,i){this.type="rotate";const r=rt(e);this.angle=new Ct(t,"angle",r[0]),this.originX=i[0],this.originY=i[1],this.cx=r[1]||0,this.cy=r[2]||0}},scale:class{apply(t){const{scale:{x:e,y:i},originX:r,originY:s}=this,n=r.getPixels("x"),a=s.getPixels("y");t.translate(n,a),t.scale(e,i||e),t.translate(-n,-a)}unapply(t){const{scale:{x:e,y:i},originX:r,originY:s}=this,n=r.getPixels("x"),a=s.getPixels("y");t.translate(n,a),t.scale(1/e,1/i||e),t.translate(-n,-a)}applyToPoint(t){const{x:e,y:i}=this.scale;t.applyTransform([e||0,0,0,i||0,0,0])}constructor(t,e,i){this.type="scale";const r=Nt.parseScale(e);0!==r.x&&0!==r.y||(r.x=pt,r.y=pt),this.scale=r,this.originX=i[0],this.originY=i[1]}},matrix:Lt,skewX:class extends Dt{constructor(t,e,i){super(t,e,i),this.type="skewX",this.matrix=[1,0,Math.tan(this.angle.getRadians()),1,0,0]}},skewY:class extends Dt{constructor(t,e,i){super(t,e,i),this.type="skewY",this.matrix=[1,Math.tan(this.angle.getRadians()),0,1,0,0]}}};class zt{getAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=this.attributes[t];if(!i&&e){const e=new Ct(this.document,t,"");return this.attributes[t]=e,e}return i||Ct.empty(this.document)}getHrefAttribute(){let t;for(const e in this.attributes)if("href"===e||e.endsWith(":href")){t=this.attributes[e];break}return t||Ct.empty(this.document)}getStyle(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=this.styles[t];if(r)return r;const s=this.getAttribute(t);if(s.hasValue())return this.styles[t]=s,s;if(!i){const{parent:e}=this;if(e){const i=e.getStyle(t);if(i.hasValue())return i}}if(e){const e=new Ct(this.document,t,"");return this.styles[t]=e,e}return Ct.empty(this.document)}render(t){if("none"!==this.getStyle("display").getString()&&"hidden"!==this.getStyle("visibility").getString()){if(t.save(),this.getStyle("mask").hasValue()){const e=this.getStyle("mask").getDefinition();e&&(this.applyEffects(t),e.apply(t,this))}else if("none"!==this.getStyle("filter").getValue("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=Bt.fromElement(this.document,this);e&&e.apply(t);const i=this.getStyle("clip-path",!1,!0);if(i.hasValue()){const e=i.getDefinition();e&&e.apply(t)}}clearContext(t){}renderChildren(t){this.children.forEach((e=>{e.render(t)}))}addChild(t){const e=t instanceof zt?t:this.document.createElement(t);e.parent=this,zt.ignoreChildTypes.includes(e.type)||this.children.push(e)}matchesSelector(t){var e;const{node:i}=this;if("function"==typeof i.matches)return i.matches(t);const r=null===(e=i.getAttribute)||void 0===e?void 0:e.call(i,"class");return!(!r||""===r)&&r.split(" ").some((e=>".".concat(e)===t))}addStylesFromStyleDefinition(){const{styles:t,stylesSpecificity:e}=this.document;let i;for(const r in t)if(!r.startsWith("@")&&this.matchesSelector(r)){const s=t[r],n=e[r];if(s)for(const t in s){let e=this.stylesSpecificity[t];void 0===e&&(e="000"),n&&n>=e&&(i=s[t],i&&(this.styles[t]=i),this.stylesSpecificity[t]=n)}}}removeStyles(t,e){return e.reduce(((e,i)=>{const r=t.getStyle(i);if(!r.hasValue())return e;const s=r.getString();return r.setValue(""),[...e,[i,s]]}),[])}restoreStyles(t,e){e.forEach((e=>{let[i,r]=e;t.getStyle(i,!0).setValue(r)}))}isFirstChild(){var t;return 0===(null===(t=this.parent)||void 0===t?void 0:t.children.indexOf(this))}constructor(t,e,i=!1){if(this.document=t,this.node=e,this.captureTextNodes=i,this.type="",this.attributes={},this.styles={},this.stylesSpecificity={},this.animationFrozen=!1,this.animationFrozenValue="",this.parent=null,this.children=[],!e||1!==e.nodeType)return;if(Array.from(e.attributes).forEach((e=>{const i=(r=e.nodeName,st.test(r)?r.toLowerCase():r);var r;this.attributes[i]=new Ct(t,i,e.value)})),this.addStylesFromStyleDefinition(),this.getAttribute("style").hasValue()){const e=this.getAttribute("style").getString().split(";").map((t=>t.trim()));e.forEach((e=>{if(!e)return;const[i,r]=e.split(":").map((t=>t.trim()));i&&(this.styles[i]=new Ct(t,i,r))}))}const{definitions:r}=t,s=this.getAttribute("id");s.hasValue()&&(r[s.getString()]||(r[s.getString()]=this)),Array.from(e.childNodes).forEach((e=>{if(1===e.nodeType)this.addChild(e);else if(i&&(3===e.nodeType||4===e.nodeType)){const i=t.createTextNode(e);i.getText().length>0&&this.addChild(i)}}))}}zt.ignoreChildTypes=["title"];class Ut extends zt{constructor(t,e,i){super(t,e,i)}}function Ht(t){const e=t.trim();return/^('|")/.test(e)?e:'"'.concat(e,'"')}function Ft(t){if(!t)return"";const e=t.trim().toLowerCase();switch(e){case"normal":case"italic":case"oblique":case"inherit":case"initial":case"unset":return e;default:return/^oblique\s+(-|)\d+deg$/.test(e)?e:""}}function Xt(t){if(!t)return"";const e=t.trim().toLowerCase();switch(e){case"normal":case"bold":case"lighter":case"bolder":case"inherit":case"initial":case"unset":return e;default:return/^[\d.]+$/.test(e)?e:""}}class Yt{static parse(){let t=arguments.length>1?arguments[1]:void 0,e="",i="",r="",s="",n="";const a=it(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").trim().split(" "),o={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1};return a.forEach((t=>{switch(!0){case!o.fontStyle&&Yt.styles.includes(t):"inherit"!==t&&(e=t),o.fontStyle=!0;break;case!o.fontVariant&&Yt.variants.includes(t):"inherit"!==t&&(i=t),o.fontStyle=!0,o.fontVariant=!0;break;case!o.fontWeight&&Yt.weights.includes(t):"inherit"!==t&&(r=t),o.fontStyle=!0,o.fontVariant=!0,o.fontWeight=!0;break;case!o.fontSize:"inherit"!==t&&(s=t.split("/")[0]||""),o.fontStyle=!0,o.fontVariant=!0,o.fontWeight=!0,o.fontSize=!0;break;default:"inherit"!==t&&(n+=t)}})),new Yt(e,i,r,s,n,t)}toString(){return[Ft(this.fontStyle),this.fontVariant,Xt(this.fontWeight),this.fontSize,(t=this.fontFamily,"undefined"==typeof process?t:t.trim().split(",").map(Ht).join(","))].join(" ").trim();var t}constructor(t,e,i,r,s,n){const a=n?"string"==typeof n?Yt.parse(n):n:{};this.fontFamily=s||a.fontFamily,this.fontSize=r||a.fontSize,this.fontStyle=t||a.fontStyle,this.fontWeight=i||a.fontWeight,this.fontVariant=e||a.fontVariant}}Yt.styles="normal|italic|oblique|inherit",Yt.variants="normal|small-caps|inherit",Yt.weights="normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit";class qt{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){void 0!==t&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=t,this.x2=t),tthis.x2&&(this.x2=t)),void 0!==e&&((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:i,x2:r,y2:s}=t;this.addPoint(e,i),this.addPoint(r,s)}sumCubic(t,e,i,r,s){return Math.pow(1-t,3)*e+3*Math.pow(1-t,2)*t*i+3*(1-t)*Math.pow(t,2)*r+Math.pow(t,3)*s}bezierCurveAdd(t,e,i,r,s){const n=6*e-12*i+6*r,a=-3*e+9*i-9*r+3*s,o=3*i-3*e;if(0===a){if(0===n)return;const a=-o/n;return void(01&&void 0!==arguments[1]&&arguments[1];if(!e){const e=this.getStyle("fill"),i=this.getStyle("fill-opacity"),r=this.getStyle("stroke"),s=this.getStyle("stroke-opacity");if(e.isUrlDefinition()){const r=e.getFillStyleDefinition(this,i);r&&(t.fillStyle=r)}else if(e.hasValue()){"currentColor"===e.getString()&&e.setValue(this.getStyle("color").getColor());const i=e.getColor();"inherit"!==i&&(t.fillStyle="none"===i?"rgba(0,0,0,0)":i)}if(i.hasValue()){const e=new Ct(this.document,"fill",t.fillStyle).addOpacity(i).getColor();t.fillStyle=e}if(r.isUrlDefinition()){const e=r.getFillStyleDefinition(this,s);e&&(t.strokeStyle=e)}else if(r.hasValue()){"currentColor"===r.getString()&&r.setValue(this.getStyle("color").getColor());const e=r.getString();"inherit"!==e&&(t.strokeStyle="none"===e?"rgba(0,0,0,0)":e)}if(s.hasValue()){const e=new Ct(this.document,"stroke",t.strokeStyle).addOpacity(s).getString();t.strokeStyle=e}const n=this.getStyle("stroke-width");if(n.hasValue()){const e=n.getPixels();t.lineWidth=e||pt}const a=this.getStyle("stroke-linecap"),o=this.getStyle("stroke-linejoin"),h=this.getStyle("stroke-miterlimit"),l=this.getStyle("stroke-dasharray"),c=this.getStyle("stroke-dashoffset");if(a.hasValue()&&(t.lineCap=a.getString()),o.hasValue()&&(t.lineJoin=o.getString()),h.hasValue()&&(t.miterLimit=h.getNumber()),l.hasValue()&&"none"!==l.getString()){const e=rt(l.getString());void 0!==t.setLineDash?t.setLineDash(e):void 0!==t.webkitLineDash?t.webkitLineDash=e:void 0===t.mozDash||1===e.length&&0===e[0]||(t.mozDash=e);const i=c.getPixels();void 0!==t.lineDashOffset?t.lineDashOffset=i:void 0!==t.webkitLineDashOffset?t.webkitLineDashOffset=i:void 0!==t.mozDashOffset&&(t.mozDashOffset=i)}}if(this.modifiedEmSizeStack=!1,void 0!==t.font){const e=this.getStyle("font"),i=this.getStyle("font-style"),r=this.getStyle("font-variant"),s=this.getStyle("font-weight"),n=this.getStyle("font-size"),a=this.getStyle("font-family"),o=new Yt(i.getString(),r.getString(),s.getString(),n.hasValue()?"".concat(n.getPixels(!0),"px"):"",a.getString(),Yt.parse(e.getString(),t.font));i.setValue(o.fontStyle),r.setValue(o.fontVariant),s.setValue(o.fontWeight),n.setValue(o.fontSize),a.setValue(o.fontFamily),t.font=o.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 Qt extends Wt{setContext(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];super.setContext(t,e);const i=this.getStyle("dominant-baseline").getTextBaseline()||this.getStyle("alignment-baseline").getTextBaseline();i&&(t.textBaseline=i)}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("text"!==this.type)return this.getTElementBoundingBox(t);this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(t);let e=null;return this.children.forEach(((i,r)=>{const s=this.getChildBoundingBox(t,this,this,r);e?e.addBoundingBox(s):e=s})),e}getFontSize(){const{document:t,parent:e}=this,i=Yt.parse(t.ctx.font).fontSize;return e.getStyle("font-size").getNumber(i)}getTElementBoundingBox(t){const e=this.getFontSize();return new qt(this.x,this.y-e,this.x+this.measureText(t),this.y)}getGlyph(t,e,i){const r=e[i];let s;if(t.isArabic){var n;const a=e.length,o=e[i-1],h=e[i+1];let l="isolated";(0===i||" "===o)&&i0&&" "!==o&&i0&&" "!==o&&(i===a-1||" "===h)&&(l="initial"),s=(null===(n=t.arabicGlyphs[r])||void 0===n?void 0:n[l])||t.glyphs[r]}else s=t.glyphs[r];return s||(s=t.missingGlyph),s}getText(){return""}getTextFromNode(t){const e=t||this.node,i=Array.from(e.parentNode.childNodes),r=i.indexOf(e),s=i.length-1;let n=it(e.textContent||"");return 0===r&&(n=n.replace(/^[\n \t]+/,"")),r===s&&(n=function(t){return t.replace(/[\n \t]+$/,"")}(n)),n}renderChildren(t){if("text"!==this.type)return void this.renderTElementChildren(t);this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(t),this.children.forEach(((e,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:i}=this,r=this.getText(),s=i.getStyle("font-family").getDefinition();if(s){const{unitsPerEm:n}=s.fontFace,a=Yt.parse(e.ctx.font),o=i.getStyle("font-size").getNumber(a.fontSize),h=i.getStyle("font-style").getString(a.fontStyle),l=o/n,c=s.isRTL?r.split("").reverse().join(""):r,u=rt(i.getAttribute("dx").getString()),g=c.length;for(let e=0;e=this.leafTexts.length)return;const t=this.leafTexts[this.textChunkStart],e=t.getStyle("text-anchor").getString("start");let i=0;i="start"===e?t.x-this.minX:"end"===e?t.x-this.maxX:t.x-(this.minX+this.maxX)/2;for(let r=this.textChunkStart;r{this.adjustChildCoordinatesRecursiveCore(t,this,this,i)})),this.applyAnchoring()}adjustChildCoordinatesRecursiveCore(t,e,i,r){const s=i.children[r];s.children.length>0?s.children.forEach(((i,r)=>{e.adjustChildCoordinatesRecursiveCore(t,e,s,r)})):this.adjustChildCoordinates(t,e,i,r)}adjustChildCoordinates(t,e,i,r){const s=i.children[r];if("function"!=typeof s.measureText)return s;t.save(),s.setContext(t,!0);const n=s.getAttribute("x"),a=s.getAttribute("y"),o=s.getAttribute("dx"),h=s.getAttribute("dy"),l=s.getStyle("font-family").getDefinition(),c=Boolean(null==l?void 0:l.isRTL);0===r&&(n.hasValue()||n.setValue(s.getInheritedAttribute("x")),a.hasValue()||a.setValue(s.getInheritedAttribute("y")),o.hasValue()||o.setValue(s.getInheritedAttribute("dx")),h.hasValue()||h.setValue(s.getInheritedAttribute("dy")));const u=s.measureText(t);return c&&(e.x-=u),n.hasValue()?(e.applyAnchoring(),s.x=n.getPixels("x"),o.hasValue()&&(s.x+=o.getPixels("x"))):(o.hasValue()&&(e.x+=o.getPixels("x")),s.x=e.x),e.x=s.x,c||(e.x+=u),a.hasValue()?(s.y=a.getPixels("y"),h.hasValue()&&(s.y+=h.getPixels("y"))):(h.hasValue()&&(e.y+=h.getPixels("y")),s.y=e.y),e.y=s.y,e.leafTexts.push(s),e.minX=Math.min(e.minX,s.x,s.x+u),e.maxX=Math.max(e.maxX,s.x,s.x+u),s.clearContext(t),t.restore(),s}getChildBoundingBox(t,e,i,r){const s=i.children[r];if("function"!=typeof s.getBoundingBox)return null;const n=s.getBoundingBox(t);return n&&s.children.forEach(((i,r)=>{const a=e.getChildBoundingBox(t,e,s,r);n.addBoundingBox(a)})),n}renderChild(t,e,i,r){const s=i.children[r];s.render(t),s.children.forEach(((i,r)=>{e.renderChild(t,e,s,r)}))}measureText(t){const{measureCache:e}=this;if(~e)return e;const i=this.getText(),r=this.measureTargetText(t,i);return this.measureCache=r,r}measureTargetText(t,e){if(!e.length)return 0;const{parent:i}=this,r=i.getStyle("font-family").getDefinition();if(r){const t=this.getFontSize(),s=r.isRTL?e.split("").reverse().join(""):e,n=rt(i.getAttribute("dx").getString()),a=s.length;let o=0;for(let e=0;e0?"":this.getTextFromNode()}}class $t extends Gt{constructor(...t){super(...t),this.type="textNode"}}class Zt extends ${reset(){this.i=-1,this.command=null,this.previousCommand=null,this.start=new Nt(0,0),this.control=new Nt(0,0),this.current=new Nt(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&&void 0!==arguments[0]?arguments[0]:"x",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"y";const i=new Nt(this.command[t],this.command[e]);return this.makeAbsolute(i)}getAsControlPoint(t,e){const i=this.getPoint(t,e);return this.control=i,i}getAsCurrentPoint(t,e){const i=this.getPoint(t,e);return this.current=i,i}getReflectedControlPoint(){const t=this.previousCommand.type;if(t!==$.CURVE_TO&&t!==$.SMOOTH_CURVE_TO&&t!==$.QUAD_TO&&t!==$.SMOOTH_QUAD_TO)return this.current;const{current:{x:e,y:i},control:{x:r,y:s}}=this;return new Nt(2*e-r,2*i-s)}makeAbsolute(t){if(this.command.relative){const{x:e,y:i}=this.current;t.x+=e,t.y+=i}return t}addMarker(t,e,i){const{points:r,angles:s}=this;i&&s.length>0&&!s[s.length-1]&&(s[s.length-1]=r[r.length-1].angleTo(i)),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 i=0;i[t,i[e]]));return r}renderChildren(t){this.path(t),this.document.screen.mouse.checkPath(this,t);const e=this.getStyle("fill-rule");""!==t.fillStyle&&("inherit"!==e.getString("inherit")?t.fill(e.getString()):t.fill()),""!==t.strokeStyle&&("non-scaling-stroke"===this.getAttribute("vector-effect").getString()?(t.save(),t.setTransform(1,0,0,1,0,0),t.stroke(),t.restore()):t.stroke());const i=this.getMarkers();if(i){const e=i.length-1,r=this.getStyle("marker-start"),s=this.getStyle("marker-mid"),n=this.getStyle("marker-end");if(r.isUrlDefinition()){const e=r.getDefinition(),[s,n]=i[0];e.render(t,s,n)}if(s.isUrlDefinition()){const r=s.getDefinition();for(let s=1;s1&&(r*=Math.sqrt(u),s*=Math.sqrt(u));let g=(a===o?-1:1)*Math.sqrt((Math.pow(r,2)*Math.pow(s,2)-Math.pow(r,2)*Math.pow(c.y,2)-Math.pow(s,2)*Math.pow(c.x,2))/(Math.pow(r,2)*Math.pow(c.y,2)+Math.pow(s,2)*Math.pow(c.x,2)));isNaN(g)&&(g=0);const d=new Nt(g*r*c.y/s,g*-s*c.x/r),p=new Nt((e.x+l.x)/2+Math.cos(h)*d.x-Math.sin(h)*d.y,(e.y+l.y)/2+Math.sin(h)*d.x+Math.cos(h)*d.y),f=mt([1,0],[(c.x-d.x)/r,(c.y-d.y)/s]),y=[(c.x-d.x)/r,(c.y-d.y)/s],m=[(-c.x-d.x)/r,(-c.y-d.y)/s];let x=mt(y,m);return yt(y,m)<=-1&&(x=Math.PI),yt(y,m)>=1&&(x=0),{currentPoint:l,rX:r,rY:s,sweepFlag:o,xAxisRotation:h,centp:p,a1:f,ad:x}}pathA(t,e){const{pathParser:i}=this,{currentPoint:r,rX:s,rY:n,sweepFlag:a,xAxisRotation:o,centp:h,a1:l,ad:c}=jt.pathA(i),u=1-a?1:-1,g=l+u*(c/2),d=new Nt(h.x+s*Math.cos(g),h.y+n*Math.sin(g));if(i.addMarkerAngle(d,g-u*Math.PI/2),i.addMarkerAngle(r,g-u*Math.PI),e.addPoint(r.x,r.y),t&&!isNaN(l)&&!isNaN(c)){const e=s>n?s:n,i=s>n?1:s/n,r=s>n?n/s:1;t.translate(h.x,h.y),t.rotate(o),t.scale(i,r),t.arc(0,0,e,l,l+c,Boolean(1-a)),t.scale(1/i,1/r),t.rotate(-o),t.translate(-h.x,-h.y)}}static pathZ(t){t.current=t.start}pathZ(t,e){jt.pathZ(this.pathParser),t&&e.x1!==e.x2&&e.y1!==e.y2&&t.closePath()}constructor(t,e,i){super(t,e,i),this.type="path",this.pathParser=new Zt(this.getAttribute("d").getString())}}class Jt extends Wt{setContext(t){var e;const{document:i}=this,{screen:r,window:s}=i,n=t.canvas;if(r.setDefaults(t),"style"in n&&void 0!==t.font&&s&&void 0!==s.getComputedStyle){t.font=s.getComputedStyle(n).getPropertyValue("font");const e=new Ct(i,"fontSize",Yt.parse(t.font).fontSize);e.hasValue()&&(i.rootEmSize=e.getPixels("y"),i.emSize=i.rootEmSize)}this.getAttribute("x").hasValue()||this.getAttribute("x",!0).setValue(0),this.getAttribute("y").hasValue()||this.getAttribute("y",!0).setValue(0);let{width:a,height:o}=r.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"),l=this.getAttribute("refY"),c=this.getAttribute("viewBox"),u=c.hasValue()?rt(c.getString()):null,g=!this.root&&"visible"!==this.getStyle("overflow").getValue("hidden");let d=0,p=0,f=0,y=0;u&&(d=u[0],p=u[1]),this.root||(a=this.getStyle("width").getPixels("x"),o=this.getStyle("height").getPixels("y"),"marker"===this.type&&(f=d,y=p,d=0,p=0)),r.viewPort.setCurrent(a,o),!this.node||this.parent&&"foreignObject"!==(null===(e=this.node.parentNode)||void 0===e?void 0:e.nodeName)||!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")),u&&(a=u[2],o=u[3]),i.setViewBox({ctx:t,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:r.viewPort.width,desiredWidth:a,height:r.viewPort.height,desiredHeight:o,minX:d,minY:p,refX:h.getValue(),refY:l.getValue(),clip:g,clipX:f,clipY:y}),u&&(r.viewPort.removeCurrent(),r.viewPort.setCurrent(a,o))}clearContext(t){super.clearContext(t),this.document.screen.viewPort.removeCurrent()}resize(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=this.getAttribute("width",!0),s=this.getAttribute("height",!0),n=this.getAttribute("viewBox"),a=this.getAttribute("style"),o=r.getNumber(0),h=s.getNumber(0);if(i)if("string"==typeof i)this.getAttribute("preserveAspectRatio",!0).setValue(i);else{const t=this.getAttribute("preserveAspectRatio");t.hasValue()&&t.setValue(t.getString().replace(/^\s*(\S.*\S)\s*$/,"$1"))}if(r.setValue(t),s.setValue(e),n.hasValue()||n.setValue("0 0 ".concat(o||t," ").concat(h||e)),a.hasValue()){const i=this.getStyle("width"),r=this.getStyle("height");i.hasValue()&&i.setValue("".concat(t,"px")),r.hasValue()&&r.setValue("".concat(e,"px"))}}constructor(...t){super(...t),this.type="svg",this.root=!1}}class Kt extends jt{path(t){const e=this.getAttribute("x").getPixels("x"),i=this.getAttribute("y").getPixels("y"),r=this.getStyle("width",!1,!0).getPixels("x"),s=this.getStyle("height",!1,!0).getPixels("y"),n=this.getAttribute("rx"),a=this.getAttribute("ry");let o=n.getPixels("x"),h=a.getPixels("y");if(n.hasValue()&&!a.hasValue()&&(h=o),a.hasValue()&&!n.hasValue()&&(o=h),o=Math.min(o,r/2),h=Math.min(h,s/2),t){const n=(Math.sqrt(2)-1)/3*4;t.beginPath(),s>0&&r>0&&(t.moveTo(e+o,i),t.lineTo(e+r-o,i),t.bezierCurveTo(e+r-o+n*o,i,e+r,i+h-n*h,e+r,i+h),t.lineTo(e+r,i+s-h),t.bezierCurveTo(e+r,i+s-h+n*h,e+r-o+n*o,i+s,e+r-o,i+s),t.lineTo(e+o,i+s),t.bezierCurveTo(e+o-n*o,i+s,e,i+s-h+n*h,e,i+s-h),t.lineTo(e,i+h),t.bezierCurveTo(e,i+h-n*h,e+o-n*o,i,e+o,i),t.closePath())}return new qt(e,i,e+r,i+s)}getMarkers(){return null}constructor(...t){super(...t),this.type="rect"}}class te extends jt{path(t){const{points:e}=this,[{x:i,y:r}]=e,s=new qt(i,r);return t&&(t.beginPath(),t.moveTo(i,r)),e.forEach((e=>{let{x:i,y:r}=e;s.addPoint(i,r),t&&t.lineTo(i,r)})),s}getMarkers(){const{points:t}=this,e=t.length-1,i=[];return t.forEach(((r,s)=>{s!==e&&i.push([r,r.angleTo(t[s+1])])})),i.length>0&&i.push([t[t.length-1],i[i.length-1][1]]),i}constructor(t,e,i){super(t,e,i),this.type="polyline",this.points=[],this.points=Nt.parsePath(this.getAttribute("points").getString())}}class ee extends Wt{getBoundingBox(t){const e=new qt;return this.children.forEach((i=>{e.addBoundingBox(i.getBoundingBox(t))})),e}constructor(...t){super(...t),this.type="g"}}class ie extends zt{getGradientUnits(){return this.getAttribute("gradientUnits").getString("objectBoundingBox")}createGradient(t,e,i){let r=this;this.getHrefAttribute().hasValue()&&(r=this.getHrefAttribute().getDefinition(),this.inheritStopContainer(r));const{stops:s}=r,n=this.getGradient(t,e);if(!n)return this.addParentOpacity(i,s[s.length-1].color);if(s.forEach((t=>{n.addColorStop(t.offset,this.addParentOpacity(i,t.color))})),this.getAttribute("gradientTransform").hasValue()){const{document:t}=this,{MAX_VIRTUAL_PIXELS:e}=Vt,{viewPort:i}=t.screen,r=i.getRoot(),s=new Kt(t);s.attributes.x=new Ct(t,"x",-e/3),s.attributes.y=new Ct(t,"y",-e/3),s.attributes.width=new Ct(t,"width",e),s.attributes.height=new Ct(t,"height",e);const a=new ee(t);a.attributes.transform=new Ct(t,"transform",this.getAttribute("gradientTransform").getValue()),a.children=[s];const o=new Jt(t);o.attributes.x=new Ct(t,"x",0),o.attributes.y=new Ct(t,"y",0),o.attributes.width=new Ct(t,"width",r.width),o.attributes.height=new Ct(t,"height",r.height),o.children=[a];const h=t.createCanvas(r.width,r.height),l=h.getContext("2d");return l.fillStyle=n,o.render(l),l.createPattern(h,"no-repeat")}return n}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 Ct(this.document,"color",e).addOpacity(t).getColor():e}constructor(t,e,i){super(t,e,i),this.attributesToInherit=["gradientUnits"],this.stops=[];const{stops:r,children:s}=this;s.forEach((t=>{"stop"===t.type&&r.push(t)}))}}class re extends zt{getProperty(){const t=this.getAttribute("attributeType").getString(),e=this.getAttribute("attributeName").getString();return"CSS"===t?this.parent.getStyle(e,!0):this.parent.getAttribute(e,!0)}calcValue(){const{initialUnits:t}=this,{progress:e,from:i,to:r}=this.getProgress();let s=i.getNumber()+(r.getNumber()-i.getNumber())*e;return"%"===t&&(s*=100),"".concat(s).concat(t)}update(t){const{parent:e}=this,i=this.getProperty();if(this.initialValue||(this.initialValue=i.getString(),this.initialUnits=i.getUnits()),this.duration>this.maxDuration){const t=this.getAttribute("fill").getString("remove");if("indefinite"===this.getAttribute("repeatCount").getString()||"indefinite"===this.getAttribute("repeatDur").getString())this.duration=0;else if("freeze"!==t||this.frozen){if("remove"===t&&!this.removed)return this.removed=!0,e&&i&&i.setValue(e.animationFrozen?e.animationFrozenValue:this.initialValue),!0}else this.frozen=!0,e&&i&&(e.animationFrozen=!0,e.animationFrozenValue=i.getString());return!1}this.duration+=t;let r=!1;if(this.begin{const r=i.createElement(e);i.definitions[t]=r}))}catch(i){console.error('Error while loading font "'.concat(e,'":'),i)}this.loaded=!0}constructor(t){this.document=t,this.loaded=!1,t.fonts.push(this)}}class le extends zt{constructor(t,e,i){super(t,e,i),this.type="style";const r=it(Array.from(e.childNodes).map((t=>t.textContent)).join("").replace(/(\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm,"").replace(/@import.*;/g,""));r.split("}").forEach((e=>{const i=e.trim();if(!i)return;const r=i.split("{"),s=r[0].split(","),n=r[1].split(";");s.forEach((e=>{const i=e.trim();if(!i)return;const r=t.styles[i]||{};if(n.forEach((e=>{const i=e.indexOf(":"),s=e.substr(0,i).trim(),n=e.substr(i+1,e.length-i).trim();s&&n&&(r[s]=new Ct(t,s,n))})),t.styles[i]=r,t.stylesSpecificity[i]=function(t){const e=[0,0,0];let i=t.replace(/:not\(([^)]*)\)/g," $1 ").replace(/{[\s\S]*/gm," "),r=0;return[i,r]=dt(i,at),e[1]+=r,[i,r]=dt(i,ot),e[0]+=r,[i,r]=dt(i,ht),e[1]+=r,[i,r]=dt(i,lt),e[2]+=r,[i,r]=dt(i,ct),e[1]+=r,[i,r]=dt(i,ut),e[1]+=r,i=i.replace(/[*\s+>~]/g," ").replace(/[#.]/g," "),[i,r]=dt(i,gt),e[2]+=r,e.join("")}(i),"@font-face"===i){const e=r["font-family"].getString().replace(/"|'/g,"");r.src.getString().split(",").forEach((i=>{if(i.indexOf('format("svg")')>0){const r=nt(i);r&&new he(t).load(e,r)}}))}}))}))}}function ce(t,e,i,r,s,n){return t[i*r*4+4*e+n]}function ue(t,e,i,r,s,n,a){t[i*r*4+4*e+n]=a}function ge(t,e,i){return t[e]*i}function de(t,e,i,r){return e+Math.cos(t)*i+Math.sin(t)*r}le.parseExternalUrl=nt;class pe extends zt{apply(t,e,i,r,s){const{includeOpacity:n,matrix:a}=this,o=t.getImageData(0,0,r,s);for(let h=0;h{e.addBoundingBox(i.getBoundingBox(t))})),r=Math.floor(e.x1),s=Math.floor(e.y1),n=Math.floor(e.width),a=Math.floor(e.height)}const o=this.removeStyles(e,fe.ignoreStyles),h=i.createCanvas(r+n,s+a),l=h.getContext("2d");i.screen.setDefaults(l),this.renderChildren(l),new pe(i,{nodeType:1,childNodes:[],attributes:[{nodeName:"type",value:"luminanceToAlpha"},{nodeName:"includeOpacity",value:"true"}]}).apply(l,0,0,r+n,s+a);const c=i.createCanvas(r+n,s+a),u=c.getContext("2d");i.screen.setDefaults(u),e.render(u),u.globalCompositeOperation="destination-in",u.fillStyle=l.createPattern(h,"no-repeat"),u.fillRect(0,0,r+n,s+a),t.fillStyle=u.createPattern(c,"no-repeat"),t.fillRect(0,0,r+n,s+a),this.restoreStyles(e,o)}render(t){}constructor(...t){super(...t),this.type="mask"}}fe.ignoreStyles=["mask","transform","clip-path"];const ye=()=>{};class me extends zt{apply(t,e){const{document:i,children:r}=this,s="getBoundingBox"in e?e.getBoundingBox(t):null;if(!s)return;let n=0,a=0;r.forEach((t=>{const e=t.extraFilterDistance||0;n=Math.max(n,e),a=Math.max(a,e)}));const o=Math.floor(s.width),h=Math.floor(s.height),l=o+2*n,c=h+2*a;if(l<1||c<1)return;const u=Math.floor(s.x),g=Math.floor(s.y),d=this.removeStyles(e,me.ignoreStyles),p=i.createCanvas(l,c),f=p.getContext("2d");i.screen.setDefaults(f),f.translate(-u+n,-g+a),e.render(f),r.forEach((t=>{"function"==typeof t.apply&&t.apply(f,0,0,l,c)})),t.drawImage(p,0,0,l,c,u-n,g-a,l,c),this.restoreStyles(e,d)}render(t){}constructor(...t){super(...t),this.type="filter"}}me.ignoreStyles=["filter","transform","clip-path"];const xe={svg:Jt,rect:Kt,circle:class extends jt{path(t){const e=this.getAttribute("cx").getPixels("x"),i=this.getAttribute("cy").getPixels("y"),r=this.getAttribute("r").getPixels();return t&&r>0&&(t.beginPath(),t.arc(e,i,r,0,2*Math.PI,!1),t.closePath()),new qt(e-r,i-r,e+r,i+r)}getMarkers(){return null}constructor(...t){super(...t),this.type="circle"}},ellipse:class extends jt{path(t){const e=(Math.sqrt(2)-1)/3*4,i=this.getAttribute("rx").getPixels("x"),r=this.getAttribute("ry").getPixels("y"),s=this.getAttribute("cx").getPixels("x"),n=this.getAttribute("cy").getPixels("y");return t&&i>0&&r>0&&(t.beginPath(),t.moveTo(s+i,n),t.bezierCurveTo(s+i,n+e*r,s+e*i,n+r,s,n+r),t.bezierCurveTo(s-e*i,n+r,s-i,n+e*r,s-i,n),t.bezierCurveTo(s-i,n-e*r,s-e*i,n-r,s,n-r),t.bezierCurveTo(s+e*i,n-r,s+i,n-e*r,s+i,n),t.closePath()),new qt(s-i,n-r,s+i,n+r)}getMarkers(){return null}constructor(...t){super(...t),this.type="ellipse"}},line:class extends jt{getPoints(){return[new Nt(this.getAttribute("x1").getPixels("x"),this.getAttribute("y1").getPixels("y")),new Nt(this.getAttribute("x2").getPixels("x"),this.getAttribute("y2").getPixels("y"))]}path(t){const[{x:e,y:i},{x:r,y:s}]=this.getPoints();return t&&(t.beginPath(),t.moveTo(e,i),t.lineTo(r,s)),new qt(e,i,r,s)}getMarkers(){const[t,e]=this.getPoints(),i=t.angleTo(e);return[[t,i],[e,i]]}constructor(...t){super(...t),this.type="line"}},polyline:te,polygon:class extends te{path(t){const e=super.path(t),[{x:i,y:r}]=this.points;return t&&(t.lineTo(i,r),t.closePath()),e}constructor(...t){super(...t),this.type="polygon"}},path:jt,pattern:class extends zt{createPattern(t,e,i){const r=this.getStyle("width").getPixels("x",!0),s=this.getStyle("height").getPixels("y",!0),n=new Jt(this.document,null);n.attributes.viewBox=new Ct(this.document,"viewBox",this.getAttribute("viewBox").getValue()),n.attributes.width=new Ct(this.document,"width","".concat(r,"px")),n.attributes.height=new Ct(this.document,"height","".concat(s,"px")),n.attributes.transform=new Ct(this.document,"transform",this.getAttribute("patternTransform").getValue()),n.children=this.children;const a=this.document.createCanvas(r,s),o=a.getContext("2d"),h=this.getAttribute("x"),l=this.getAttribute("y");h.hasValue()&&l.hasValue()&&o.translate(h.getPixels("x",!0),l.getPixels("y",!0)),i.hasValue()?this.styles["fill-opacity"]=i:Reflect.deleteProperty(this.styles,"fill-opacity");for(let c=-1;c<=1;c++)for(let t=-1;t<=1;t++)o.save(),n.attributes.x=new Ct(this.document,"x",c*a.width),n.attributes.y=new Ct(this.document,"y",t*a.height),n.render(o),o.restore();return t.createPattern(a,"repeat")}constructor(...t){super(...t),this.type="pattern"}},marker:class extends zt{render(t,e,i){if(!e)return;const{x:r,y:s}=e,n=this.getAttribute("orient").getString("auto"),a=this.getAttribute("markerUnits").getString("strokeWidth");t.translate(r,s),"auto"===n&&t.rotate(i),"strokeWidth"===a&&t.scale(t.lineWidth,t.lineWidth),t.save();const o=new Jt(this.document);o.type=this.type,o.attributes.viewBox=new Ct(this.document,"viewBox",this.getAttribute("viewBox").getValue()),o.attributes.refX=new Ct(this.document,"refX",this.getAttribute("refX").getValue()),o.attributes.refY=new Ct(this.document,"refY",this.getAttribute("refY").getValue()),o.attributes.width=new Ct(this.document,"width",this.getAttribute("markerWidth").getValue()),o.attributes.height=new Ct(this.document,"height",this.getAttribute("markerHeight").getValue()),o.attributes.overflow=new Ct(this.document,"overflow",this.getAttribute("overflow").getValue()),o.attributes.fill=new Ct(this.document,"fill",this.getAttribute("fill").getColor("black")),o.attributes.stroke=new Ct(this.document,"stroke",this.getAttribute("stroke").getValue("none")),o.children=this.children,o.render(t),t.restore(),"strokeWidth"===a&&t.scale(1/t.lineWidth,1/t.lineWidth),"auto"===n&&t.rotate(-i),t.translate(-r,-s)}constructor(...t){super(...t),this.type="marker"}},defs:class extends zt{render(){}constructor(...t){super(...t),this.type="defs"}},linearGradient:class extends ie{getGradient(t,e){const i="objectBoundingBox"===this.getGradientUnits(),r=i?e.getBoundingBox(t):null;if(i&&!r)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 s=i?r.x+r.width*this.getAttribute("x1").getNumber():this.getAttribute("x1").getPixels("x"),n=i?r.y+r.height*this.getAttribute("y1").getNumber():this.getAttribute("y1").getPixels("y"),a=i?r.x+r.width*this.getAttribute("x2").getNumber():this.getAttribute("x2").getPixels("x"),o=i?r.y+r.height*this.getAttribute("y2").getNumber():this.getAttribute("y2").getPixels("y");return s===a&&n===o?null:t.createLinearGradient(s,n,a,o)}constructor(t,e,i){super(t,e,i),this.type="linearGradient",this.attributesToInherit.push("x1","y1","x2","y2")}},radialGradient:class extends ie{getGradient(t,e){const i="objectBoundingBox"===this.getGradientUnits(),r=e.getBoundingBox(t);if(i&&!r)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 s=i?r.x+r.width*this.getAttribute("cx").getNumber():this.getAttribute("cx").getPixels("x"),n=i?r.y+r.height*this.getAttribute("cy").getNumber():this.getAttribute("cy").getPixels("y");let a=s,o=n;this.getAttribute("fx").hasValue()&&(a=i?r.x+r.width*this.getAttribute("fx").getNumber():this.getAttribute("fx").getPixels("x")),this.getAttribute("fy").hasValue()&&(o=i?r.y+r.height*this.getAttribute("fy").getNumber():this.getAttribute("fy").getPixels("y"));const h=i?(r.width+r.height)/2*this.getAttribute("r").getNumber():this.getAttribute("r").getPixels(),l=this.getAttribute("fr").getPixels();return t.createRadialGradient(a,o,l,s,n,h)}constructor(t,e,i){super(t,e,i),this.type="radialGradient",this.attributesToInherit.push("cx","cy","r","fx","fy","fr")}},stop:class extends zt{constructor(t,e,i){super(t,e,i),this.type="stop";const r=Math.max(0,Math.min(1,this.getAttribute("offset").getNumber())),s=this.getStyle("stop-opacity");let n=this.getStyle("stop-color",!0);""===n.getString()&&n.setValue("#000"),s.hasValue()&&(n=n.addOpacity(s)),this.offset=r,this.color=n.getColor()}},animate:re,animateColor:class extends re{calcValue(){const{progress:t,from:e,to:i}=this.getProgress(),r=new M(e.getColor()),s=new M(i.getColor());if(r.ok&&s.ok){const e=r.r+(s.r-r.r)*t,i=r.g+(s.g-r.g)*t,n=r.b+(s.b-r.b)*t;return"rgb(".concat(Math.floor(e),", ").concat(Math.floor(i),", ").concat(Math.floor(n),")")}return this.getAttribute("from").getColor()}constructor(...t){super(...t),this.type="animateColor"}},animateTransform:class extends re{calcValue(){const{progress:t,from:e,to:i}=this.getProgress(),r=rt(e.getString()),s=rt(i.getString()),n=r.map(((e,i)=>e+(s[i]-e)*t)).join(" ");return n}constructor(...t){super(...t),this.type="animateTransform"}},font:class extends zt{render(){}constructor(t,e,i){super(t,e,i),this.type="font",this.isArabic=!1,this.glyphs={},this.arabicGlyphs={},this.isRTL=!1,this.horizAdvX=this.getAttribute("horiz-adv-x").getNumber();const{definitions:r}=t,{children:s}=this;for(const n of s)if(n instanceof se){this.fontFace=n;const t=n.getStyle("font-family");t.hasValue()&&(r[t.getString()]=this)}else if(n instanceof ae)this.missingGlyph=n;else if(n instanceof ne)if(n.arabicForm){this.isRTL=!0,this.isArabic=!0;const t=this.arabicGlyphs[n.unicode];void 0===t?this.arabicGlyphs[n.unicode]={[n.arabicForm]:n}:t[n.arabicForm]=n}else this.glyphs[n.unicode]=n}},"font-face":se,"missing-glyph":ae,glyph:ne,text:Qt,tspan:Gt,tref:class extends Qt{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"}},a:class extends Qt{getText(){return this.text}renderChildren(t){if(this.hasText){super.renderChildren(t);const{document:e,x:i,y:r}=this,{mouse:s}=e.screen,n=new Ct(e,"fontSize",Yt.parse(e.ctx.font).fontSize);s.isWorking()&&s.checkBoundingBox(this,new qt(i,r-n.getPixels("y"),i+this.measureText(t),r))}else if(this.children.length>0){const e=new ee(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(){this.document.ctx.canvas.style.cursor="pointer"}constructor(t,e,i){super(t,e,i),this.type="a";const{childNodes:r}=e,s=r[0],n=r.length>0&&Array.from(r).every((t=>3===t.nodeType));this.hasText=n,this.text=n?this.getTextFromNode(s):""}},textPath:class extends Qt{getText(){return this.text}path(t){const{dataArray:e}=this;t&&t.beginPath(),e.forEach((e=>{let{type:i,points:r}=e;switch(i){case Zt.LINE_TO:t&&t.lineTo(r[0],r[1]);break;case Zt.MOVE_TO:t&&t.moveTo(r[0],r[1]);break;case Zt.CURVE_TO:t&&t.bezierCurveTo(r[0],r[1],r[2],r[3],r[4],r[5]);break;case Zt.QUAD_TO:t&&t.quadraticCurveTo(r[0],r[1],r[2],r[3]);break;case Zt.ARC:{const[e,i,s,n,a,o,h,l]=r,c=s>n?s:n,u=s>n?1:s/n,g=s>n?n/s:1;t&&(t.translate(e,i),t.rotate(h),t.scale(u,g),t.arc(0,0,c,a,a+o,Boolean(1-l)),t.scale(1/u,1/g),t.rotate(-h),t.translate(-e,-i));break}case Zt.CLOSE_PATH:t&&t.closePath()}}))}renderChildren(t){this.setTextData(t),t.save();const e=this.parent.getStyle("text-decoration").getString(),i=this.getFontSize(),{glyphInfo:r}=this,s=t.fillStyle;"underline"===e&&t.beginPath(),r.forEach(((r,s)=>{const{p0:n,p1:a,rotation:o,text:h}=r;t.save(),t.translate(n.x,n.y),t.rotate(o),t.fillStyle&&t.fillText(h,0,0),t.strokeStyle&&t.strokeText(h,0,0),t.restore(),"underline"===e&&(0===s&&t.moveTo(n.x,n.y+i/8),t.lineTo(a.x,a.y+i/5))})),"underline"===e&&(t.lineWidth=i/20,t.strokeStyle=s,t.stroke(),t.closePath()),t.restore()}getLetterSpacingAt(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.letterSpacingCache[t]||0}findSegmentToFitChar(t,e,i,r,s,n,a,o,h){let l=n,c=this.measureText(t,o);" "===o&&"justify"===e&&i-1&&(l+=this.getLetterSpacingAt(h));const u=this.textHeight/20,g=this.getEquidistantPointOnPath(l,u,0),d=this.getEquidistantPointOnPath(l+c,u,0),p={p0:g,p1:d},f=g&&d?Math.atan2(d.y-g.y,d.x-g.x):0;if(a){const t=Math.cos(Math.PI/2+f)*a,e=Math.cos(-f)*a;p.p0={...g,x:g.x+t,y:g.y+e},p.p1={...d,x:d.x+t,y:d.y+e}}return l+=c,{offset:l,segment:p,rotation:f}}measureText(t,e){const{measuresCache:i}=this,r=e||this.getText();if(i.has(r))return i.get(r);const s=this.measureTargetText(t,r);return i.set(r,s),s}setTextData(t){if(this.glyphInfo)return;const e=this.getText(),i=e.split(""),r=e.split(" ").length-1,s=this.parent.getAttribute("dx").split().map((t=>t.getPixels("x"))),n=this.parent.getAttribute("dy").getPixels("y"),a=this.parent.getStyle("text-anchor").getString("start"),o=this.getStyle("letter-spacing"),h=this.parent.getStyle("letter-spacing");let l=0;o.hasValue()&&"inherit"!==o.getValue()?o.hasValue()&&"initial"!==o.getValue()&&"unset"!==o.getValue()&&(l=o.getPixels()):l=h.getPixels();const c=[],u=e.length;this.letterSpacingCache=c;for(let x=0;x0===i?0:t+e||0),0),d=this.measureText(t),p=Math.max(d+g,0);this.textWidth=d,this.textHeight=this.getFontSize(),this.glyphInfo=[];const f=this.getPathLength(),y=this.getStyle("startOffset").getNumber(0)*f;let m=0;"middle"!==a&&"center"!==a||(m=-p/2),"end"!==a&&"right"!==a||(m=-p),m+=y,i.forEach(((e,s)=>{const{offset:o,segment:h,rotation:l}=this.findSegmentToFitChar(t,a,p,f,r,m,n,e,s);m=o,h.p0&&h.p1&&this.glyphInfo.push({text:i[s],p0:h.p0,p1:h.p1,rotation:l})}))}parsePathData(t){if(this.pathLength=-1,!t)return[];const e=[],{pathParser:i}=t;for(i.reset();!i.isEnd();){const{current:t}=i,r=t?t.x:0,s=t?t.y:0,n=i.next();let a=n.type,o=[];switch(n.type){case Zt.MOVE_TO:this.pathM(i,o);break;case Zt.LINE_TO:a=this.pathL(i,o);break;case Zt.HORIZ_LINE_TO:a=this.pathH(i,o);break;case Zt.VERT_LINE_TO:a=this.pathV(i,o);break;case Zt.CURVE_TO:this.pathC(i,o);break;case Zt.SMOOTH_CURVE_TO:a=this.pathS(i,o);break;case Zt.QUAD_TO:this.pathQ(i,o);break;case Zt.SMOOTH_QUAD_TO:a=this.pathT(i,o);break;case Zt.ARC:o=this.pathA(i);break;case Zt.CLOSE_PATH:jt.pathZ(i)}n.type!==Zt.CLOSE_PATH?e.push({type:a,points:o,start:{x:r,y:s},pathLength:this.calcLength(r,s,a,o)}):e.push({type:Zt.CLOSE_PATH,points:[],pathLength:0})}return e}pathM(t,e){const{x:i,y:r}=jt.pathM(t).point;e.push(i,r)}pathL(t,e){const{x:i,y:r}=jt.pathL(t).point;return e.push(i,r),Zt.LINE_TO}pathH(t,e){const{x:i,y:r}=jt.pathH(t).point;return e.push(i,r),Zt.LINE_TO}pathV(t,e){const{x:i,y:r}=jt.pathV(t).point;return e.push(i,r),Zt.LINE_TO}pathC(t,e){const{point:i,controlPoint:r,currentPoint:s}=jt.pathC(t);e.push(i.x,i.y,r.x,r.y,s.x,s.y)}pathS(t,e){const{point:i,controlPoint:r,currentPoint:s}=jt.pathS(t);return e.push(i.x,i.y,r.x,r.y,s.x,s.y),Zt.CURVE_TO}pathQ(t,e){const{controlPoint:i,currentPoint:r}=jt.pathQ(t);e.push(i.x,i.y,r.x,r.y)}pathT(t,e){const{controlPoint:i,currentPoint:r}=jt.pathT(t);return e.push(i.x,i.y,r.x,r.y),Zt.QUAD_TO}pathA(t){let{rX:e,rY:i,sweepFlag:r,xAxisRotation:s,centp:n,a1:a,ad:o}=jt.pathA(t);return 0===r&&o>0&&(o-=2*Math.PI),1===r&&o<0&&(o+=2*Math.PI),[n.x,n.y,e,i,a,o,s,r]}calcLength(t,e,i,r){let s=0,n=null,a=null,o=0;switch(i){case Zt.LINE_TO:return this.getLineLength(t,e,r[0],r[1]);case Zt.CURVE_TO:for(s=0,n=this.getPointOnCubicBezier(0,t,e,r[0],r[1],r[2],r[3],r[4],r[5]),o=.01;o<=1;o+=.01)a=this.getPointOnCubicBezier(o,t,e,r[0],r[1],r[2],r[3],r[4],r[5]),s+=this.getLineLength(n.x,n.y,a.x,a.y),n=a;return s;case Zt.QUAD_TO:for(s=0,n=this.getPointOnQuadraticBezier(0,t,e,r[0],r[1],r[2],r[3]),o=.01;o<=1;o+=.01)a=this.getPointOnQuadraticBezier(o,t,e,r[0],r[1],r[2],r[3]),s+=this.getLineLength(n.x,n.y,a.x,a.y),n=a;return s;case Zt.ARC:{s=0;const t=r[4],e=r[5],i=r[4]+e;let h=Math.PI/180;if(Math.abs(t-i)i;o-=h)a=this.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],o,0),s+=this.getLineLength(n.x,n.y,a.x,a.y),n=a;else for(o=t+h;o5&&void 0!==arguments[5]?arguments[5]:e,a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:i;const o=(s-i)/(r-e+pt);let h=Math.sqrt(t*t/(1+o*o));re)return null;const{dataArray:s}=this;for(const n of s){if(n&&(n.pathLength<5e-5||i+n.pathLength+5e-5=0&&s>a)break;r=this.getPointOnEllipticalArc(n.points[0],n.points[1],n.points[2],n.points[3],s,n.points[6]);break}case Zt.CURVE_TO:s=e/n.pathLength,s>1&&(s=1),r=this.getPointOnCubicBezier(s,n.start.x,n.start.y,n.points[0],n.points[1],n.points[2],n.points[3],n.points[4],n.points[5]);break;case Zt.QUAD_TO:s=e/n.pathLength,s>1&&(s=1),r=this.getPointOnQuadraticBezier(s,n.start.x,n.start.y,n.points[0],n.points[1],n.points[2],n.points[3])}if(r)return r;break}return null}getLineLength(t,e,i,r){return Math.sqrt((i-t)*(i-t)+(r-e)*(r-e))}getPathLength(){return-1===this.pathLength&&(this.pathLength=this.dataArray.reduce(((t,e)=>e.pathLength>0?t+e.pathLength:t),0)),this.pathLength}getPointOnCubicBezier(t,e,i,r,s,n,a,o,h){return{x:o*xt(t)+n*bt(t)+r*vt(t)+e*wt(t),y:h*xt(t)+a*bt(t)+s*vt(t)+i*wt(t)}}getPointOnQuadraticBezier(t,e,i,r,s,n,a){return{x:n*St(t)+r*Tt(t)+e*At(t),y:a*St(t)+s*Tt(t)+i*At(t)}}getPointOnEllipticalArc(t,e,i,r,s,n){const a=Math.cos(n),o=Math.sin(n),h=i*Math.cos(s),l=r*Math.sin(s);return{x:t+(h*a-l*o),y:e+(h*o+l*a)}}buildEquidistantCache(t,e){const i=this.getPathLength(),r=e||.25,s=t||i/100;if(!this.equidistantCache||this.equidistantCache.step!==s||this.equidistantCache.precision!==r){this.equidistantCache={step:s,precision:r,points:[]};let t=0;for(let e=0;e<=i;e+=r){const i=this.getPointOnPath(e),n=this.getPointOnPath(e+r);i&&n&&(t+=this.getLineLength(i.x,i.y,n.x,n.y),t>=s&&(this.equidistantCache.points.push({x:i.x,y:i.y,distance:e}),t-=s))}}}getEquidistantPointOnPath(t,e,i){if(this.buildEquidistantCache(e,i),t<0||t-this.getPathLength()>5e-5)return null;const r=Math.round(t/this.getPathLength()*(this.equidistantCache.points.length-1));return this.equidistantCache.points[r]||null}constructor(t,e,i){super(t,e,i),this.type="textPath",this.textWidth=0,this.textHeight=0,this.pathLength=-1,this.glyphInfo=null,this.letterSpacingCache=[],this.measuresCache=new Map([["",0]]);const r=this.getHrefAttribute().getDefinition();this.text=this.getTextFromNode(),this.dataArray=this.parsePathData(r)}},image:class extends Wt{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=oe.exec(t);if(e){const t=e[5];t&&("base64"===e[4]?this.image=atob(t):this.image=decodeURIComponent(t))}else try{const e=await this.document.fetch(t),i=await e.text();this.image=i}catch(i){console.error('Error while loading image "'.concat(t,'":'),i)}this.loaded=!0}renderChildren(t){const{document:e,image:i,loaded:r}=this,s=this.getAttribute("x").getPixels("x"),n=this.getAttribute("y").getPixels("y"),a=this.getStyle("width").getPixels("x"),o=this.getStyle("height").getPixels("y");if(r&&i&&a&&o){if(t.save(),t.translate(s,n),"string"==typeof i){const r=e.canvg.forkString(t,i,{ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:0,offsetY:0,scaleWidth:a,scaleHeight:o}),{documentElement:s}=r.document;s&&(s.parent=this),r.render()}else e.setViewBox({ctx:t,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:a,desiredWidth:i.width,height:o,desiredHeight:i.height}),this.loaded&&("complete"in i&&!i.complete||t.drawImage(i,0,0));t.restore()}}getBoundingBox(){const t=this.getAttribute("x").getPixels("x"),e=this.getAttribute("y").getPixels("y"),i=this.getStyle("width").getPixels("x"),r=this.getStyle("height").getPixels("y");return new qt(t,e,t+i,e+r)}constructor(t,e,i){super(t,e,i),this.type="image",this.loaded=!1;const r=this.getHrefAttribute().getString();if(!r)return;const s=r.endsWith(".svg")||/^\s*data:image\/svg\+xml/i.test(r);t.images.push(this),s?this.loadSvg(r):this.loadImage(r)}},g:ee,symbol:class extends Wt{render(t){}constructor(...t){super(...t),this.type="symbol"}},style:le,use:class extends Wt{setContext(t){super.setContext(t);const e=this.getAttribute("x"),i=this.getAttribute("y");e.hasValue()&&t.translate(e.getPixels("x"),0),i.hasValue()&&t.translate(0,i.getPixels("y"))}path(t){const{element:e}=this;e&&e.path(t)}renderChildren(t){const{document:e,element:i}=this;if(i){let r=i;if("symbol"===i.type&&(r=new Jt(e),r.attributes.viewBox=new Ct(e,"viewBox",i.getAttribute("viewBox").getString()),r.attributes.preserveAspectRatio=new Ct(e,"preserveAspectRatio",i.getAttribute("preserveAspectRatio").getString()),r.attributes.overflow=new Ct(e,"overflow",i.getAttribute("overflow").getString()),r.children=i.children,i.styles.opacity=new Ct(e,"opacity",this.calculateOpacity())),"svg"===r.type){const t=this.getStyle("width",!1,!0),i=this.getStyle("height",!1,!0);t.hasValue()&&(r.attributes.width=new Ct(e,"width",t.getString())),i.hasValue()&&(r.attributes.height=new Ct(e,"height",i.getString()))}const s=r.parent;r.parent=this,r.render(t),r.parent=s}}getBoundingBox(t){const{element:e}=this;return e?e.getBoundingBox(t):null}elementTransform(){const{document:t,element:e}=this;return e?Bt.fromElement(t,e):null}get element(){return this.cachedElement||(this.cachedElement=this.getHrefAttribute().getDefinition()),this.cachedElement}constructor(...t){super(...t),this.type="use"}},mask:fe,clipPath:class extends zt{apply(t){const{document:e}=this,i=Reflect.getPrototypeOf(t),{beginPath:r,closePath:s}=t;i&&(i.beginPath=ye,i.closePath=ye),Reflect.apply(r,t,[]),this.children.forEach((r=>{if(!("path"in r))return;let n="elementTransform"in r?r.elementTransform():null;n||(n=Bt.fromElement(e,r)),n&&n.apply(t),r.path(t),i&&(i.closePath=s),n&&n.unapply(t)})),Reflect.apply(s,t,[]),t.clip(),i&&(i.beginPath=r,i.closePath=s)}render(t){}constructor(...t){super(...t),this.type="clipPath"}},filter:me,feDropShadow:class extends zt{apply(t,e,i,r,s){}constructor(t,e,i){super(t,e,i),this.type="feDropShadow",this.addStylesFromStyleDefinition()}},feMorphology:class extends zt{apply(t,e,i,r,s){}constructor(...t){super(...t),this.type="feMorphology"}},feComposite:class extends zt{apply(t,e,i,r,s){}constructor(...t){super(...t),this.type="feComposite"}},feColorMatrix:pe,feGaussianBlur:class extends zt{apply(t,e,i,r,s){const{document:n,blurRadius:a}=this,o=n.window?n.window.document.body:null,h=t.canvas;h.id=n.getUniqueId(),o&&(h.style.display="none",o.appendChild(h)),tt(h,e,i,r,s,a),o&&o.removeChild(h)}constructor(t,e,i){super(t,e,i),this.type="feGaussianBlur",this.blurRadius=Math.floor(this.getAttribute("stdDeviation").getNumber()),this.extraFilterDistance=this.blurRadius}},title:class extends zt{constructor(...t){super(...t),this.type="title"}},desc:class extends zt{constructor(...t){super(...t),this.type="desc"}}};class be{bindCreateImage(t,e){return"boolean"==typeof e?(i,r)=>t(i,"boolean"==typeof r?r: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]||12}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(/^[^:]+:/,""),i=be.elementTypes[e];return i?new i(this,t):new Ut(this,t)}createTextNode(t){return new $t(this,t)}setViewBox(t){this.screen.setViewBox({document:this,...t})}constructor(t,{rootEmSize:e=12,emSize:i=12,createCanvas:r=be.createCanvas,createImage:s=be.createImage,anonymousCrossOrigin:n}={}){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=i,this.createCanvas=r,this.createImage=this.bindCreateImage(s,n),this.screen.wait((()=>this.isImagesLoaded())),this.screen.wait((()=>this.isFontsLoaded()))}}be.createCanvas=function(t,e){const i=document.createElement("canvas");return i.width=t,i.height=e,i},be.createImage=async function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");return e&&(i.crossOrigin="Anonymous"),new Promise(((e,r)=>{i.onload=()=>{e(i)},i.onerror=(t,e,i,s,n)=>{r(n)},i.src=t}))},be.elementTypes=xe;class ve{static async from(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new It(i),s=await r.parse(e);return new ve(t,s,i)}static fromString(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new It(i).parseFromString(e);return new ve(t,r,i)}fork(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return ve.from(t,e,{...this.options,...i})}forkString(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return ve.fromString(t,e,{...this.options,...i})}ready(){return this.screen.ready()}isReady(){return this.screen.isReady()}async render(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.start({enableRedraw:!0,ignoreAnimation:!0,ignoreMouse:!0,...t}),await this.ready(),this.stop()}start(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{documentElement:e,screen:i,options:r}=this;i.start(e,{enableRedraw:!0,...r,...t})}stop(){this.screen.stop()}resize(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.documentElement.resize(t,e,i)}constructor(t,e,i={}){this.parser=new It(i),this.screen=new Vt(t,i),this.options=i;const r=new be(this,i),s=r.createDocumentElement(e);this.document=r,this.documentElement=s}}t("default",r({name:"transfer-to-img",setup(){const t=s(),i="productRenderType",r=n({isLoading:!0,isProductLoading:!1,step:0,product:[{state:!1,name:"五线谱",type:a.staff,base64:""},{state:!1,name:"首调",type:a.firstTone,base64:""},{state:!1,name:"固定调",type:a.fixedTone,base64:""}],isSpecialXml:!1});o((()=>{window.appName="colexiu",h.isSingleLine=!1,h.isCreateImg=!0,h.isEvxml=!0,h.xmlUrl=decodeURIComponent(t.xmlUrl),["https://oss.dayaedu.com/MECMP/1715332965751.xml","https://oss.dayaedu.com/MECMP/1715326622946.xml"].includes(h.xmlUrl)&&(r.isSpecialXml=!0),sessionStorage.setItem(i,r.product[r.step].type),h.musicRenderType=r.product[r.step].type,l({message:"生成中",duration:0}),setTimeout((()=>{r.isLoading=!1}),500)}));const y=async()=>{var t;document.getElementById("scrollContainer")&&g(r.isSpecialXml),r.product[r.step].state=!0,r.product[r.step].base64=await m();try{console.log(JSON.parse(JSON.stringify(r.product)),r.step)}catch(e){}if(r.step+=1,r.step!==r.product.length)return sessionStorage.setItem(i,r.product[r.step].type),h.musicRenderType=r.product[r.step].type,void d((()=>{r.isLoading=!0,setTimeout((()=>{r.isLoading=!1}),500)}));p(),console.log(r.product,123456),null===(t=window.parent)||void 0===t||t.postMessage({api:"webApi_renderSvg",product:JSON.stringify(r.product)},"*")},m=()=>new Promise((t=>{setTimeout((async()=>{try{var e;const i=null===(e=document.getElementById("osmdSvgPage1"))||void 0===e?void 0:e.cloneNode(!0);if(!i)return void t("");const r=i.width.animVal.value,s=i.height.animVal.value,n=document.createElementNS("http://www.w3.org/2000/svg","rect");n.setAttribute("x","0"),n.setAttribute("y","0"),n.setAttribute("width",""+2*r),n.setAttribute("height",""+2*s),n.setAttribute("fill","#fff"),i.prepend(n);const a=(t=>{const e=document.createElement("canvas"),i=e.getContext("2d");return i?(ve.fromString(i,t).start(),e):e})(i.outerHTML),o=a.toDataURL("image/png",1);t(o)}catch(i){t("")}}),500)}));return()=>c("div",{class:e},[c("div",{id:"scrollContainer",class:[f,"hideCursor"]},[!r.isLoading&&c(u,{renderTypeKey:i,showSelection:!1,onRendered:y},null)])])}}))}}}));