(self.ldBronxApp=self.ldBronxApp||[]).push([[2018],{29895:(t,e,i)=>{"use strict";i.d(e,{Uw:()=>l,dV:()=>o,fo:()=>h});const r=(t=>t.CapacitorPlatforms=(t=>{const e=new Map;e.set("web",{name:"web"});const i=t.CapacitorPlatforms||{currentPlatform:{name:"web"},platforms:e};return i.addPlatform=(t,e)=>{i.platforms.set(t,e)},i.setPlatform=t=>{i.platforms.has(t)&&(i.currentPlatform=i.platforms.get(t))},i})(t))("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==i.g?i.g:{});r.addPlatform,r.setPlatform;var s;!function(t){t.Unimplemented="UNIMPLEMENTED",t.Unavailable="UNAVAILABLE"}(s||(s={}));class n extends Error{constructor(t,e){super(t),this.message=t,this.code=e}}const a=t=>{var e,i,r,a,o;const h=t.CapacitorCustomPlatform||null,l=t.Capacitor||{},u=l.Plugins=l.Plugins||{},c=t.CapacitorPlatforms,g=(null===(e=null==c?void 0:c.currentPlatform)||void 0===e?void 0:e.getPlatform)||(()=>null!==h?h.name:(t=>{var e,i;return(null==t?void 0:t.androidBridge)?"android":(null===(i=null===(e=null==t?void 0:t.webkit)||void 0===e?void 0:e.messageHandlers)||void 0===i?void 0:i.bridge)?"ios":"web"})(t)),d=(null===(i=null==c?void 0:c.currentPlatform)||void 0===i?void 0:i.isNativePlatform)||(()=>"web"!==g()),p=(null===(r=null==c?void 0:c.currentPlatform)||void 0===r?void 0:r.isPluginAvailable)||(t=>{const e=y.get(t);return!!(null==e?void 0:e.platforms.has(g()))||!!f(t)}),f=(null===(a=null==c?void 0:c.currentPlatform)||void 0===a?void 0:a.getPluginHeader)||(t=>{var e;return null===(e=l.PluginHeaders)||void 0===e?void 0:e.find((e=>e.name===t))}),y=new Map,m=(null===(o=null==c?void 0:c.currentPlatform)||void 0===o?void 0:o.registerPlugin)||((t,e={})=>{const i=y.get(t);if(i)return console.warn(`Capacitor plugin "${t}" already registered. Cannot register plugins twice.`),i.proxy;const r=g(),a=f(t);let o;const c=i=>{let u;const c=(...c)=>{const g=(async()=>(!o&&r in e?o=o="function"==typeof e[r]?await e[r]():e[r]:null!==h&&!o&&"web"in e&&(o=o="function"==typeof e.web?await e.web():e.web),o))().then((e=>{const o=((e,i)=>{var o,h;if(!a){if(e)return null===(h=e[i])||void 0===h?void 0:h.bind(e);throw new n(`"${t}" plugin is not implemented on ${r}`,s.Unimplemented)}{const r=null==a?void 0:a.methods.find((t=>i===t.name));if(r)return"promise"===r.rtype?e=>l.nativePromise(t,i.toString(),e):(e,r)=>l.nativeCallback(t,i.toString(),e,r);if(e)return null===(o=e[i])||void 0===o?void 0:o.bind(e)}})(e,i);if(o){const t=o(...c);return u=null==t?void 0:t.remove,t}throw new n(`"${t}.${i}()" is not implemented on ${r}`,s.Unimplemented)}));return"addListener"===i&&(g.remove=async()=>u()),g};return c.toString=()=>`${i.toString()}() { [capacitor code] }`,Object.defineProperty(c,"name",{value:i,writable:!1,configurable:!1}),c},d=c("addListener"),p=c("removeListener"),m=(t,e)=>{const i=d({eventName:t},e),r=async()=>{const r=await i;p({eventName:t,callbackId:r},e)},s=new Promise((t=>i.then((()=>t({remove:r})))));return s.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await r()},s},v=new Proxy({},{get(t,e){switch(e){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return a?m:d;case"removeListener":return p;default:return c(e)}}});return u[t]=v,y.set(t,{name:t,proxy:v,platforms:new Set([...Object.keys(e),...a?[r]:[]])}),v});return l.convertFileSrc||(l.convertFileSrc=t=>t),l.getPlatform=g,l.handleError=e=>t.console.error(e),l.isNativePlatform=d,l.isPluginAvailable=p,l.pluginMethodNoop=(t,e,i)=>Promise.reject(`${i} does not have an implementation of "${e}".`),l.registerPlugin=m,l.Exception=n,l.DEBUG=!!l.DEBUG,l.isLoggingEnabled=!!l.isLoggingEnabled,l.platform=l.getPlatform(),l.isNative=l.isNativePlatform(),l},o=(t=>t.Capacitor=a(t))("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==i.g?i.g:{}),h=o.registerPlugin;o.Plugins;class l{constructor(t){this.listeners={},this.windowListeners={},t&&(console.warn(`Capacitor WebPlugin "${t.name}" config object was deprecated in v3 and will be removed in v4.`),this.config=t)}addListener(t,e){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(e);const i=this.windowListeners[t];i&&!i.registered&&this.addWindowListener(i);const r=async()=>this.removeListener(t,e),s=Promise.resolve({remove:r});return Object.defineProperty(s,"remove",{value:async()=>{console.warn("Using addListener() without 'await' is deprecated."),await r()}}),s}async removeAllListeners(){this.listeners={};for(const t in this.windowListeners)this.removeWindowListener(this.windowListeners[t]);this.windowListeners={}}notifyListeners(t,e){const i=this.listeners[t];i&&i.forEach((t=>t(e)))}hasListeners(t){return!!this.listeners[t].length}registerWindowListener(t,e){this.windowListeners[e]={registered:!1,windowEventName:t,pluginEventName:e,handler:t=>{this.notifyListeners(e,t)}}}unimplemented(t="not implemented"){return new o.Exception(t,s.Unimplemented)}unavailable(t="not available"){return new o.Exception(t,s.Unavailable)}async removeListener(t,e){const i=this.listeners[t];if(!i)return;const r=i.indexOf(e);this.listeners[t].splice(r,1),this.listeners[t].length||this.removeWindowListener(this.windowListeners[t])}addWindowListener(t){window.addEventListener(t.windowEventName,t.handler),t.registered=!0}removeWindowListener(t){t&&(window.removeEventListener(t.windowEventName,t.handler),t.registered=!1)}}},21924:(t,e,i)=>{"use strict";var r=i(40210),s=i(55559),n=s(r("String.prototype.indexOf"));t.exports=function(t,e){var i=r(t,!!e);return"function"==typeof i&&n(t,".prototype.")>-1?s(i):i}},55559:(t,e,i)=>{"use strict";var r=i(58612),s=i(40210),n=i(67771),a=s("%TypeError%"),o=s("%Function.prototype.apply%"),h=s("%Function.prototype.call%"),l=s("%Reflect.apply%",!0)||r.call(h,o),u=s("%Object.defineProperty%",!0),c=s("%Math.max%");if(u)try{u({},"a",{value:1})}catch(t){u=null}t.exports=function(t){if("function"!=typeof t)throw new a("a function is required");var e=l(r,h,arguments);return n(e,1+c(0,t.length-(arguments.length-1)),!0)};var g=function(){return l(r,o,arguments)};u?u(t.exports,"apply",{value:g}):t.exports.apply=g},31807:t=>{var e=!("undefined"==typeof window||!window.document||!window.document.createElement);t.exports=e},15790:(t,e)=>{"use strict";e.E=function(){var t=[],e=t;function i(){e===t&&(e=t.slice())}return{listen:function(t){if("function"!=typeof t)throw new Error("Expected listener to be a function.");var r=!0;return i(),e.push(t),function(){if(r){r=!1,i();var s=e.indexOf(t);e.splice(s,1)}}},emit:function(){for(var i=t=e,r=0;r<i.length;r++)i[r].apply(i,arguments)}}}},40487:t=>{var e={utf8:{stringToBytes:function(t){return e.bin.stringToBytes(unescape(encodeURIComponent(t)))},bytesToString:function(t){return decodeURIComponent(escape(e.bin.bytesToString(t)))}},bin:{stringToBytes:function(t){for(var e=[],i=0;i<t.length;i++)e.push(255&t.charCodeAt(i));return e},bytesToString:function(t){for(var e=[],i=0;i<t.length;i++)e.push(String.fromCharCode(t[i]));return e.join("")}}};t.exports=e},71027:(t,e,i)=>{var r=i(89509).Buffer,s=i(42830).Transform,n=i(32553).s;function a(t){s.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}i(35717)(a,s),a.prototype.update=function(t,e,i){"string"==typeof t&&(t=r.from(t,e));var s=this._update(t);return this.hashMode?this:(i&&(s=this._toString(s,i)),s)},a.prototype.setAutoPadding=function(){},a.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},a.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},a.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},a.prototype._transform=function(t,e,i){var r;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){r=t}finally{i(r)}},a.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},a.prototype._finalOrDigest=function(t){var e=this.__final()||r.alloc(0);return t&&(e=this._toString(e,t,!0)),e},a.prototype._toString=function(t,e,i){if(this._decoder||(this._decoder=new n(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var r=this._decoder.write(t);return i&&(r+=this._decoder.end()),r},t.exports=a},34668:(t,e,i)=>{"use strict";i.r(e),i.d(e,{AElement:()=>_t,AnimateColorElement:()=>Lt,AnimateElement:()=>Nt,AnimateTransformElement:()=>Bt,BoundingBox:()=>lt,CB1:()=>N,CB2:()=>L,CB3:()=>B,CB4:()=>D,Canvg:()=>ye,CircleElement:()=>xt,ClipPathElement:()=>ie,DefsElement:()=>Tt,DescElement:()=>le,Document:()=>de,Element:()=>rt,EllipseElement:()=>bt,FeColorMatrixElement:()=>Kt,FeCompositeElement:()=>ae,FeDropShadowElement:()=>se,FeGaussianBlurElement:()=>oe,FeMorphologyElement:()=>ne,FilterElement:()=>re,Font:()=>ht,FontElement:()=>Dt,FontFaceElement:()=>zt,GElement:()=>Et,GlyphElement:()=>dt,GradientElement:()=>Vt,ImageElement:()=>Wt,LineElement:()=>wt,LinearGradientElement:()=>Mt,MarkerElement:()=>Ct,MaskElement:()=>te,Matrix:()=>J,MissingGlyphElement:()=>It,Mouse:()=>X,PSEUDO_ZERO:()=>V,Parser:()=>q,PathElement:()=>gt,PathParser:()=>ut,PatternElement:()=>At,Point:()=>U,PolygonElement:()=>St,PolylineElement:()=>Pt,Property:()=>_,QB1:()=>z,QB2:()=>I,QB3:()=>R,RadialGradientElement:()=>Ot,RectElement:()=>vt,RenderedElement:()=>ct,Rotate:()=>Q,SVGElement:()=>mt,SVGFontLoader:()=>Ht,Scale:()=>Z,Screen:()=>Y,Skew:()=>K,SkewX:()=>tt,SkewY:()=>et,StopElement:()=>kt,StyleElement:()=>$t,SymbolElement:()=>Yt,TRefElement:()=>Rt,TSpanElement:()=>ft,TextElement:()=>pt,TextPathElement:()=>Xt,TitleElement:()=>he,Transform:()=>it,Translate:()=>G,UnknownElement:()=>st,UseElement:()=>qt,ViewPort:()=>F,compressSpaces:()=>c,default:()=>ye,getSelectorSpecificity:()=>E,normalizeAttributeName:()=>y,normalizeColor:()=>v,parseExternalUrl:()=>m,presets:()=>u,toNumbers:()=>p,trimLeft:()=>g,trimRight:()=>d,vectorMagnitude:()=>M,vectorsAngle:()=>k,vectorsRatio:()=>O});i(73964);var r=i(15861),s=(i(22462),i(57267),i(268),i(752),i(76265),i(4942)),n=(i(11390),i(2918),i(9873),i(54087)),a=(i(28436),i(26131)),o=(i(37826),i(43843),i(79174),i(35851)),h=(i(12826),i(62449)),l=i(34155);var u=Object.freeze({__proto__:null,offscreen:function(){var{DOMParser:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e={window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:t,createCanvas:(t,e)=>new OffscreenCanvas(t,e),createImage:t=>(0,r.Z)((function*(){var e=yield fetch(t),i=yield e.blob();return yield createImageBitmap(i)}))()};return"undefined"==typeof DOMParser&&void 0!==t||Reflect.deleteProperty(e,"DOMParser"),e},node:function(t){var{DOMParser:e,canvas:i,fetch:r}=t;return{window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:e,fetch:r,createCanvas:i.createCanvas,createImage:i.loadImage}}});function c(t){return t.replace(/(?!\u3000)\s+/gm," ")}function g(t){return t.replace(/^[\n \t]+/,"")}function d(t){return t.replace(/[\n \t]+$/,"")}function p(t){return((t||"").match(/-?(\d+(?:\.\d*(?:[eE][+-]?\d+)?)?|\.\d+)(?=\D|$)/gm)||[]).map(parseFloat)}var f=/^[A-Z-]+$/;function y(t){return f.test(t)?t.toLowerCase():t}function m(t){var e=/url\(('([^']+)'|"([^"]+)"|([^'")]+))\)/.exec(t)||[];return e[2]||e[3]||e[4]}function v(t){if(!t.startsWith("rgb"))return t;var e=3;return t.replace(/\d+(\.\d+)?/g,((t,i)=>e--&&i?String(Math.round(parseFloat(t))):t))}var x=/(\[[^\]]+\])/g,b=/(#[^\s+>~.[:]+)/g,w=/(\.[^\s+>~.[:]+)/g,P=/(::[^\s+>~.[:]+|:first-line|:first-letter|:before|:after)/gi,S=/(:[\w-]+\([^)]*\))/gi,A=/(:[^\s+>~.[:]+)/g,C=/([^\s+>~.[:]+)/g;function T(t,e){var i=e.exec(t);return i?[t.replace(e," "),i.length]:[t,0]}function E(t){var e=[0,0,0],i=t.replace(/:not\(([^)]*)\)/g,"     $1 ").replace(/{[\s\S]*/gm," "),r=0;return[i,r]=T(i,x),e[1]+=r,[i,r]=T(i,b),e[0]+=r,[i,r]=T(i,w),e[1]+=r,[i,r]=T(i,P),e[2]+=r,[i,r]=T(i,S),e[1]+=r,[i,r]=T(i,A),e[1]+=r,i=i.replace(/[*\s+>~]/g," ").replace(/[#.]/g," "),[i,r]=T(i,C),e[2]+=r,e.join("")}var V=1e-8;function M(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2))}function O(t,e){return(t[0]*e[0]+t[1]*e[1])/(M(t)*M(e))}function k(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos(O(t,e))}function N(t){return t*t*t}function L(t){return 3*t*t*(1-t)}function B(t){return 3*t*(1-t)*(1-t)}function D(t){return(1-t)*(1-t)*(1-t)}function z(t){return t*t}function I(t){return 2*t*(1-t)}function R(t){return(1-t)*(1-t)}class _{constructor(t,e,i){this.document=t,this.name=e,this.value=i,this.isNormalizedColor=!1}static empty(t){return new _(t,"EMPTY","")}split(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:" ",{document:e,name:i}=this;return c(this.getString()).trim().split(t).map((t=>new _(e,i,t)))}hasValue(t){var{value:e}=this;return null!==e&&""!==e&&(t||0!==e)&&void 0!==e}isString(t){var{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;var 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);var{value:e}=this,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){var e=this.getString(t);return this.isNormalizedColor||(this.isNormalizedColor=!0,e=v(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){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.hasValue())return 0;var[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:var n=this.getNumber();return e&&n<1?n*s.computeSize(i):n}}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(){var t=this.getString(),e=/#([^)'"]+)/.exec(t);return e&&(e=e[1]),e||(e=t),this.document.definitions[e]}getFillStyleDefinition(t,e){var i=this.getDefinition();if(!i)return null;if("function"==typeof i.createGradient)return i.createGradient(this.document.ctx,t,e);if("function"==typeof i.createPattern){if(i.getHrefAttribute().hasValue()){var r=i.getAttribute("patternTransform");i=i.getHrefAttribute().getDefinition(),r.hasValue()&&i.getAttribute("patternTransform",!0).setValue(r.value)}return i.createPattern(this.document.ctx,t,e)}return null}getTextBaseline(){return this.hasValue()?_.textBaselineMapping[this.getString()]:null}addOpacity(t){for(var e=this.getColor(),i=e.length,r=0,s=0;s<i&&(","===e[s]&&r++,3!==r);s++);if(t.hasValue()&&this.isString()&&3!==r){var n=new a(e);n.ok&&(n.alpha=t.getNumber(),e=n.toRGBA())}return new _(this.document,this.name,e)}}_.textBaselineMapping={baseline:"alphabetic","before-edge":"top","text-before-edge":"top",middle:"middle",central:"middle","after-edge":"bottom","text-after-edge":"bottom",ideographic:"ideographic",alphabetic:"alphabetic",hanging:"hanging",mathematical:"alphabetic"};class F{constructor(){this.viewPorts=[]}clear(){this.viewPorts=[]}setCurrent(t,e){this.viewPorts.push({width:t,height:e})}removeCurrent(){this.viewPorts.pop()}getCurrent(){var{viewPorts:t}=this;return t[t.length-1]}get width(){return this.getCurrent().width}get height(){return this.getCurrent().height}computeSize(t){return"number"==typeof t?t:"x"===t?this.width:"y"===t?this.height:Math.sqrt(Math.pow(this.width,2)+Math.pow(this.height,2))/Math.sqrt(2)}}class U{constructor(t,e){this.x=t,this.y=e}static parse(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,[i=e,r=e]=p(t);return new U(i,r)}static parseScale(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,[i=e,r=i]=p(t);return new U(i,r)}static parsePath(t){for(var e=p(t),i=e.length,r=[],s=0;s<i;s+=2)r.push(new U(e[s],e[s+1]));return r}angleTo(t){return Math.atan2(t.y-this.y,t.x-this.x)}applyTransform(t){var{x:e,y:i}=this,r=e*t[0]+i*t[2]+t[4],s=e*t[1]+i*t[3]+t[5];this.x=r,this.y=s}}class X{constructor(t){this.screen=t,this.working=!1,this.events=[],this.eventElements=[],this.onClick=this.onClick.bind(this),this.onMouseMove=this.onMouseMove.bind(this)}isWorking(){return this.working}start(){if(!this.working){var{screen:t,onClick:e,onMouseMove:i}=this,r=t.ctx.canvas;r.onclick=e,r.onmousemove=i,this.working=!0}}stop(){if(this.working){var t=this.screen.ctx.canvas;this.working=!1,t.onclick=null,t.onmousemove=null}}hasEvents(){return this.working&&this.events.length>0}runEvents(){if(this.working){var{screen:t,events:e,eventElements:i}=this,{style:r}=t.ctx.canvas;r&&(r.cursor=""),e.forEach(((t,e)=>{for(var{run:r}=t,s=i[e];s;)r(s),s=s.parent})),this.events=[],this.eventElements=[]}}checkPath(t,e){if(this.working&&e){var{events:i,eventElements:r}=this;i.forEach(((i,s)=>{var{x:n,y:a}=i;!r[s]&&e.isPointInPath&&e.isPointInPath(n,a)&&(r[s]=t)}))}}checkBoundingBox(t,e){if(this.working&&e){var{events:i,eventElements:r}=this;i.forEach(((i,s)=>{var{x:n,y:a}=i;!r[s]&&e.isPointInBox(n,a)&&(r[s]=t)}))}}mapXY(t,e){for(var{window:i,ctx:r}=this.screen,s=new U(t,e),n=r.canvas;n;)s.x-=n.offsetLeft,s.y-=n.offsetTop,n=n.offsetParent;return i.scrollX&&(s.x+=i.scrollX),i.scrollY&&(s.y+=i.scrollY),s}onClick(t){var{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){var{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()}})}}var j="undefined"!=typeof window?window:null,W="undefined"!=typeof fetch?fetch.bind(void 0):null;class Y{constructor(t){var{fetch:e=W,window:i=j}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.ctx=t,this.FRAMERATE=30,this.MAX_VIRTUAL_PIXELS=3e4,this.CLIENT_WIDTH=800,this.CLIENT_HEIGHT=600,this.viewPort=new F,this.mouse=new X(this),this.animations=[],this.waits=[],this.frameDuration=0,this.isReadyLock=!1,this.isFirstRender=!0,this.intervalId=null,this.window=i,this.fetch=e}wait(t){this.waits.push(t)}ready(){return this.readyPromise?this.readyPromise:Promise.resolve()}isReady(){if(this.isReadyLock)return!0;var 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){var{document:e,ctx:i,aspectRatio:r,width:s,desiredWidth:n,height:a,desiredHeight:o,minX:h=0,minY:l=0,refX:u,refY:g,clip:d=!1,clipX:p=0,clipY:f=0}=t,y=c(r).replace(/^defer\s/,""),[m,v]=y.split(" "),x=m||"xMidYMid",b=v||"meet",w=s/n,P=a/o,S=Math.min(w,P),A=Math.max(w,P),C=n,T=o;"meet"===b&&(C*=S,T*=S),"slice"===b&&(C*=A,T*=A);var E=new _(e,"refX",u),V=new _(e,"refY",g),M=E.hasValue()&&V.hasValue();if(M&&i.translate(-S*E.getPixels("x"),-S*V.getPixels("y")),d){var O=S*p,k=S*f;i.beginPath(),i.moveTo(O,k),i.lineTo(s,k),i.lineTo(s,a),i.lineTo(O,a),i.closePath(),i.clip()}if(!M){var N="meet"===b&&S===P,L="slice"===b&&A===P,B="meet"===b&&S===w,D="slice"===b&&A===w;x.startsWith("xMid")&&(N||L)&&i.translate(s/2-C/2,0),x.endsWith("YMid")&&(B||D)&&i.translate(0,a/2-T/2),x.startsWith("xMax")&&(N||L)&&i.translate(s-C,0),x.endsWith("YMax")&&(B||D)&&i.translate(0,a-T)}switch(!0){case"none"===x:i.scale(w,P);break;case"meet"===b:i.scale(S,S);break;case"slice"===b:i.scale(A,A)}i.translate(-h,-l)}start(t){var{enableRedraw:e=!1,ignoreMouse:i=!1,ignoreAnimation:r=!1,ignoreDimensions:s=!1,ignoreClear:a=!1,forceRedraw:o,scaleWidth:h,scaleHeight:l,offsetX:u,offsetY:c}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{FRAMERATE:g,mouse:d}=this,p=1e3/g;if(this.frameDuration=p,this.readyPromise=new Promise((t=>{this.resolveReady=t})),this.isReady()&&this.render(t,s,a,h,l,u,c),e){var f=Date.now(),y=f,m=0,v=()=>{f=Date.now(),(m=f-y)>=p&&(y=f-m%p,this.shouldUpdate(r,o)&&(this.render(t,s,a,h,l,u,c),d.runEvents())),this.intervalId=n(v)};i||d.start(),this.intervalId=n(v)}}stop(){this.intervalId&&(n.cancel(this.intervalId),this.intervalId=null),this.mouse.stop()}shouldUpdate(t,e){if(!t){var{frameDuration:i}=this;if(this.animations.reduce(((t,e)=>e.update(i)||t),!1))return!0}return!("function"!=typeof e||!e())||(!(this.isReadyLock||!this.isReady())||!!this.mouse.hasEvents())}render(t,e,i,r,s,n,a){var{CLIENT_WIDTH:o,CLIENT_HEIGHT:h,viewPort:l,ctx:u,isFirstRender:c}=this,g=u.canvas;l.clear(),g.width&&g.height?l.setCurrent(g.width,g.height):l.setCurrent(o,h);var d=t.getStyle("width"),f=t.getStyle("height");!e&&(c||"number"!=typeof r&&"number"!=typeof s)&&(d.hasValue()&&(g.width=d.getPixels("x"),g.style&&(g.style.width="".concat(g.width,"px"))),f.hasValue()&&(g.height=f.getPixels("y"),g.style&&(g.style.height="".concat(g.height,"px"))));var y=g.clientWidth||g.width,m=g.clientHeight||g.height;if(e&&d.hasValue()&&f.hasValue()&&(y=d.getPixels("x"),m=f.getPixels("y")),l.setCurrent(y,m),"number"==typeof n&&t.getAttribute("x",!0).setValue(n),"number"==typeof a&&t.getAttribute("y",!0).setValue(a),"number"==typeof r||"number"==typeof s){var v=p(t.getAttribute("viewBox").getString()),x=0,b=0;if("number"==typeof r){var w=t.getStyle("width");w.hasValue()?x=w.getPixels("x")/r:isNaN(v[2])||(x=v[2]/r)}if("number"==typeof s){var P=t.getStyle("height");P.hasValue()?b=P.getPixels("y")/s:isNaN(v[3])||(b=v[3]/s)}x||(x=b),b||(b=x),t.getAttribute("width",!0).setValue(r),t.getAttribute("height",!0).setValue(s);var S=t.getStyle("transform",!0,!0);S.setValue("".concat(S.getString()," scale(").concat(1/x,", ").concat(1/b,")"))}i||u.clearRect(0,0,y,m),t.render(u),c&&(this.isFirstRender=!1)}}Y.defaultWindow=j,Y.defaultFetch=W;var{defaultFetch:H}=Y,$="undefined"!=typeof DOMParser?DOMParser:null;class q{constructor(){var{fetch:t=H,DOMParser:e=$}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.fetch=t,this.DOMParser=e}parse(t){var e=this;return(0,r.Z)((function*(){return t.startsWith("<")?e.parseFromString(t):e.load(t)}))()}parseFromString(t){var 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){var e=t.getElementsByTagName("parsererror")[0];if(e)throw new Error(e.textContent);return t}load(t){var e=this;return(0,r.Z)((function*(){var i=yield e.fetch(t),r=yield i.text();return e.parseFromString(r)}))()}}class G{constructor(t,e){this.type="translate",this.point=null,this.point=U.parse(e)}apply(t){var{x:e,y:i}=this.point;t.translate(e||0,i||0)}unapply(t){var{x:e,y:i}=this.point;t.translate(-1*e||0,-1*i||0)}applyToPoint(t){var{x:e,y:i}=this.point;t.applyTransform([1,0,0,1,e||0,i||0])}}class Q{constructor(t,e,i){this.type="rotate",this.angle=null,this.originX=null,this.originY=null,this.cx=0,this.cy=0;var r=p(e);this.angle=new _(t,"angle",r[0]),this.originX=i[0],this.originY=i[1],this.cx=r[1]||0,this.cy=r[2]||0}apply(t){var{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){var{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){var{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])}}class Z{constructor(t,e,i){this.type="scale",this.scale=null,this.originX=null,this.originY=null;var r=U.parseScale(e);0!==r.x&&0!==r.y||(r.x=V,r.y=V),this.scale=r,this.originX=i[0],this.originY=i[1]}apply(t){var{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){var{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){var{x:e,y:i}=this.scale;t.applyTransform([e||0,0,0,i||0,0,0])}}class J{constructor(t,e,i){this.type="matrix",this.matrix=[],this.originX=null,this.originY=null,this.matrix=p(e),this.originX=i[0],this.originY=i[1]}apply(t){var{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){var{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],u=1/(s*(1*h-0*l)-n*(1*o-0*l)+a*(0*o-0*h)),c=e.getPixels("x"),g=i.getPixels("y");t.translate(c,g),t.transform(u*(1*h-0*l),u*(0*l-1*o),u*(0*a-1*n),u*(1*s-0*a),u*(n*l-a*h),u*(a*o-s*l)),t.translate(-c,-g)}applyToPoint(t){t.applyTransform(this.matrix)}}class K extends J{constructor(t,e,i){super(t,e,i),this.type="skew",this.angle=null,this.angle=new _(t,"angle",e)}}class tt extends K{constructor(t,e,i){super(t,e,i),this.type="skewX",this.matrix=[1,0,Math.tan(this.angle.getRadians()),1,0,0]}}class et extends K{constructor(t,e,i){super(t,e,i),this.type="skewY",this.matrix=[1,Math.tan(this.angle.getRadians()),0,1,0,0]}}class it{constructor(t,e,i){this.document=t,this.transforms=[];var r=function(t){return c(t).trim().replace(/\)([a-zA-Z])/g,") $1").replace(/\)(\s?,\s?)/g,") ").split(/\s(?=[a-z])/)}(e);r.forEach((t=>{if("none"!==t){var[e,r]=function(t){var[e,i]=t.split("(");return[e.trim(),i.trim().replace(")","")]}(t),s=it.transformTypes[e];void 0!==s&&this.transforms.push(new s(this.document,r,i))}}))}static fromElement(t,e){var i=e.getStyle("transform",!1,!0),[r,s=r]=e.getStyle("transform-origin",!1,!0).split(),n=[r,s];return i.hasValue()?new it(t,i.getString(),n):null}apply(t){for(var{transforms:e}=this,i=e.length,r=0;r<i;r++)e[r].apply(t)}unapply(t){for(var{transforms:e}=this,i=e.length-1;i>=0;i--)e[i].unapply(t)}applyToPoint(t){for(var{transforms:e}=this,i=e.length,r=0;r<i;r++)e[r].applyToPoint(t)}}it.transformTypes={translate:G,rotate:Q,scale:Z,matrix:J,skewX:tt,skewY:et};class rt{constructor(t,e){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.document=t,this.node=e,this.captureTextNodes=i,this.attributes={},this.styles={},this.stylesSpecificity={},this.animationFrozen=!1,this.animationFrozenValue="",this.parent=null,this.children=[],e&&1===e.nodeType){if(Array.from(e.attributes).forEach((e=>{var i=y(e.nodeName);this.attributes[i]=new _(t,i,e.value)})),this.addStylesFromStyleDefinition(),this.getAttribute("style").hasValue())this.getAttribute("style").getString().split(";").map((t=>t.trim())).forEach((e=>{if(e){var[i,r]=e.split(":").map((t=>t.trim()));this.styles[i]=new _(t,i,r)}}));var{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)){var r=t.createTextNode(e);r.getText().length>0&&this.addChild(r)}}))}}getAttribute(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.attributes[t];if(!i&&e){var r=new _(this.document,t,"");return this.attributes[t]=r,r}return i||_.empty(this.document)}getHrefAttribute(){for(var t in this.attributes)if("href"===t||t.endsWith(":href"))return this.attributes[t];return _.empty(this.document)}getStyle(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.styles[t];if(r)return r;var s=this.getAttribute(t);if(null!=s&&s.hasValue())return this.styles[t]=s,s;if(!i){var{parent:n}=this;if(n){var a=n.getStyle(t);if(null!=a&&a.hasValue())return a}}if(e){var o=new _(this.document,t,"");return this.styles[t]=o,o}return r||_.empty(this.document)}render(t){if("none"!==this.getStyle("display").getString()&&"hidden"!==this.getStyle("visibility").getString()){if(t.save(),this.getStyle("mask").hasValue()){var e=this.getStyle("mask").getDefinition();e&&(this.applyEffects(t),e.apply(t,this))}else if("none"!==this.getStyle("filter").getValue("none")){var i=this.getStyle("filter").getDefinition();i&&(this.applyEffects(t),i.apply(t,this))}else this.setContext(t),this.renderChildren(t),this.clearContext(t);t.restore()}}setContext(t){}applyEffects(t){var e=it.fromElement(this.document,this);e&&e.apply(t);var i=this.getStyle("clip-path",!1,!0);if(i.hasValue()){var r=i.getDefinition();r&&r.apply(t)}}clearContext(t){}renderChildren(t){this.children.forEach((e=>{e.render(t)}))}addChild(t){var e=t instanceof rt?t:this.document.createElement(t);e.parent=this,rt.ignoreChildTypes.includes(e.type)||this.children.push(e)}matchesSelector(t){var e,{node:i}=this;if("function"==typeof i.matches)return i.matches(t);var 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(){var{styles:t,stylesSpecificity:e}=this.document;for(var i in t)if(!i.startsWith("@")&&this.matchesSelector(i)){var r=t[i],s=e[i];if(r)for(var n in r){var a=this.stylesSpecificity[n];void 0===a&&(a="000"),s>=a&&(this.styles[n]=r[n],this.stylesSpecificity[n]=s)}}}removeStyles(t,e){return e.reduce(((e,i)=>{var r=t.getStyle(i);if(!r.hasValue())return e;var s=r.getString();return r.setValue(""),[...e,[i,s]]}),[])}restoreStyles(t,e){e.forEach((e=>{var[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))}}rt.ignoreChildTypes=["title"];class st extends rt{constructor(t,e,i){super(t,e,i)}}function nt(t){var e=t.trim();return/^('|")/.test(e)?e:'"'.concat(e,'"')}function at(t){if(!t)return"";var 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 ot(t){if(!t)return"";var 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 ht{constructor(t,e,i,r,s,n){var a=n?"string"==typeof n?ht.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}static parse(){var t=arguments.length>1?arguments[1]:void 0,e="",i="",r="",s="",n="",a=c(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&&ht.styles.includes(t):"inherit"!==t&&(e=t),o.fontStyle=!0;break;case!o.fontVariant&&ht.variants.includes(t):"inherit"!==t&&(i=t),o.fontStyle=!0,o.fontVariant=!0;break;case!o.fontWeight&&ht.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("/")),o.fontStyle=!0,o.fontVariant=!0,o.fontWeight=!0,o.fontSize=!0;break;default:"inherit"!==t&&(n+=t)}})),new ht(e,i,r,s,n,t)}toString(){return[at(this.fontStyle),this.fontVariant,ot(this.fontWeight),this.fontSize,(t=this.fontFamily,void 0===l?t:t.trim().split(",").map(nt).join(","))].join(" ").trim();var t}}ht.styles="normal|italic|oblique|inherit",ht.variants="normal|small-caps|inherit",ht.weights="normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit";class lt{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.NaN,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.NaN,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Number.NaN,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.NaN;this.x1=t,this.y1=e,this.x2=i,this.y2=r,this.addPoint(t,e),this.addPoint(i,r)}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),t<this.x1&&(this.x1=t),t>this.x2&&(this.x2=t)),void 0!==e&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),e<this.y1&&(this.y1=e),e>this.y2&&(this.y2=e))}addX(t){this.addPoint(t,null)}addY(t){this.addPoint(null,t)}addBoundingBox(t){if(t){var{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){var n=6*e-12*i+6*r,a=-3*e+9*i-9*r+3*s,o=3*i-3*e;if(0!==a){var h=Math.pow(n,2)-4*o*a;if(!(h<0)){var l=(-n+Math.sqrt(h))/(2*a);0<l&&l<1&&(t?this.addX(this.sumCubic(l,e,i,r,s)):this.addY(this.sumCubic(l,e,i,r,s)));var u=(-n-Math.sqrt(h))/(2*a);0<u&&u<1&&(t?this.addX(this.sumCubic(u,e,i,r,s)):this.addY(this.sumCubic(u,e,i,r,s)))}}else{if(0===n)return;var c=-o/n;0<c&&c<1&&(t?this.addX(this.sumCubic(c,e,i,r,s)):this.addY(this.sumCubic(c,e,i,r,s)))}}addBezierCurve(t,e,i,r,s,n,a,o){this.addPoint(t,e),this.addPoint(a,o),this.bezierCurveAdd(!0,t,i,s,a),this.bezierCurveAdd(!1,e,r,n,o)}addQuadraticCurve(t,e,i,r,s,n){var a=t+2/3*(i-t),o=e+2/3*(r-e),h=a+1/3*(s-t),l=o+1/3*(n-e);this.addBezierCurve(t,e,a,h,o,l,s,n)}isPointInBox(t,e){var{x1:i,y1:r,x2:s,y2:n}=this;return i<=t&&t<=s&&r<=e&&e<=n}}class ut extends o.OU{constructor(t){super(t.replace(/([+\-.])\s+/gm,"$1").replace(/[^MmZzLlHhVvCcSsQqTtAae\d\s.,+-].*/g,"")),this.control=null,this.start=null,this.current=null,this.command=null,this.commands=this.commands,this.i=-1,this.previousCommand=null,this.points=[],this.angles=[]}reset(){this.i=-1,this.command=null,this.previousCommand=null,this.start=new U(0,0),this.control=new U(0,0),this.current=new U(0,0),this.points=[],this.angles=[]}isEnd(){var{i:t,commands:e}=this;return t>=e.length-1}next(){var t=this.commands[++this.i];return this.previousCommand=this.command,this.command=t,t}getPoint(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"x",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"y",i=new U(this.command[t],this.command[e]);return this.makeAbsolute(i)}getAsControlPoint(t,e){var i=this.getPoint(t,e);return this.control=i,i}getAsCurrentPoint(t,e){var i=this.getPoint(t,e);return this.current=i,i}getReflectedControlPoint(){var t=this.previousCommand.type;if(t!==o.OU.CURVE_TO&&t!==o.OU.SMOOTH_CURVE_TO&&t!==o.OU.QUAD_TO&&t!==o.OU.SMOOTH_QUAD_TO)return this.current;var{current:{x:e,y:i},control:{x:r,y:s}}=this;return new U(2*e-r,2*i-s)}makeAbsolute(t){if(this.command.relative){var{x:e,y:i}=this.current;t.x+=e,t.y+=i}return t}addMarker(t,e,i){var{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(){for(var{angles:t}=this,e=t.length,i=0;i<e;i++)if(!t[i])for(var r=i+1;r<e;r++)if(t[r]){t[i]=t[r];break}return t}}class ct extends rt{constructor(){super(...arguments),this.modifiedEmSizeStack=!1}calculateOpacity(){for(var t=1,e=this;e;){var i=e.getStyle("opacity",!1,!0);i.hasValue(!0)&&(t*=i.getNumber()),e=e.parent}return t}setContext(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e){var i=this.getStyle("fill"),r=this.getStyle("fill-opacity"),s=this.getStyle("stroke"),n=this.getStyle("stroke-opacity");if(i.isUrlDefinition()){var a=i.getFillStyleDefinition(this,r);a&&(t.fillStyle=a)}else if(i.hasValue()){"currentColor"===i.getString()&&i.setValue(this.getStyle("color").getColor());var o=i.getColor();"inherit"!==o&&(t.fillStyle="none"===o?"rgba(0,0,0,0)":o)}if(r.hasValue()){var h=new _(this.document,"fill",t.fillStyle).addOpacity(r).getColor();t.fillStyle=h}if(s.isUrlDefinition()){var l=s.getFillStyleDefinition(this,n);l&&(t.strokeStyle=l)}else if(s.hasValue()){"currentColor"===s.getString()&&s.setValue(this.getStyle("color").getColor());var u=s.getString();"inherit"!==u&&(t.strokeStyle="none"===u?"rgba(0,0,0,0)":u)}if(n.hasValue()){var c=new _(this.document,"stroke",t.strokeStyle).addOpacity(n).getString();t.strokeStyle=c}var g=this.getStyle("stroke-width");if(g.hasValue()){var d=g.getPixels();t.lineWidth=d||V}var f=this.getStyle("stroke-linecap"),y=this.getStyle("stroke-linejoin"),m=this.getStyle("stroke-miterlimit"),v=this.getStyle("stroke-dasharray"),x=this.getStyle("stroke-dashoffset");if(f.hasValue()&&(t.lineCap=f.getString()),y.hasValue()&&(t.lineJoin=y.getString()),m.hasValue()&&(t.miterLimit=m.getNumber()),v.hasValue()&&"none"!==v.getString()){var b=p(v.getString());void 0!==t.setLineDash?t.setLineDash(b):void 0!==t.webkitLineDash?t.webkitLineDash=b:void 0===t.mozDash||1===b.length&&0===b[0]||(t.mozDash=b);var w=x.getPixels();void 0!==t.lineDashOffset?t.lineDashOffset=w:void 0!==t.webkitLineDashOffset?t.webkitLineDashOffset=w:void 0!==t.mozDashOffset&&(t.mozDashOffset=w)}}if(this.modifiedEmSizeStack=!1,void 0!==t.font){var P=this.getStyle("font"),S=this.getStyle("font-style"),A=this.getStyle("font-variant"),C=this.getStyle("font-weight"),T=this.getStyle("font-size"),E=this.getStyle("font-family"),M=new ht(S.getString(),A.getString(),C.getString(),T.hasValue()?"".concat(T.getPixels(!0),"px"):"",E.getString(),ht.parse(P.getString(),t.font));S.setValue(M.fontStyle),A.setValue(M.fontVariant),C.setValue(M.fontWeight),T.setValue(M.fontSize),E.setValue(M.fontFamily),t.font=M.toString(),T.isPixels()&&(this.document.emSize=T.getPixels(),this.modifiedEmSizeStack=!0)}e||(this.applyEffects(t),t.globalAlpha=this.calculateOpacity())}clearContext(t){super.clearContext(t),this.modifiedEmSizeStack&&this.document.popEmSize()}}class gt extends ct{constructor(t,e,i){super(t,e,i),this.type="path",this.pathParser=null,this.pathParser=new ut(this.getAttribute("d").getString())}path(t){var{pathParser:e}=this,i=new lt;for(e.reset(),t&&t.beginPath();!e.isEnd();)switch(e.next().type){case ut.MOVE_TO:this.pathM(t,i);break;case ut.LINE_TO:this.pathL(t,i);break;case ut.HORIZ_LINE_TO:this.pathH(t,i);break;case ut.VERT_LINE_TO:this.pathV(t,i);break;case ut.CURVE_TO:this.pathC(t,i);break;case ut.SMOOTH_CURVE_TO:this.pathS(t,i);break;case ut.QUAD_TO:this.pathQ(t,i);break;case ut.SMOOTH_QUAD_TO:this.pathT(t,i);break;case ut.ARC:this.pathA(t,i);break;case ut.CLOSE_PATH:this.pathZ(t,i)}return i}getBoundingBox(t){return this.path()}getMarkers(){var{pathParser:t}=this,e=t.getMarkerPoints(),i=t.getMarkerAngles();return e.map(((t,e)=>[t,i[e]]))}renderChildren(t){this.path(t),this.document.screen.mouse.checkPath(this,t);var 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());var i=this.getMarkers();if(i){var r=i.length-1,s=this.getStyle("marker-start"),n=this.getStyle("marker-mid"),a=this.getStyle("marker-end");if(s.isUrlDefinition()){var o=s.getDefinition(),[h,l]=i[0];o.render(t,h,l)}if(n.isUrlDefinition())for(var u=n.getDefinition(),c=1;c<r;c++){var[g,d]=i[c];u.render(t,g,d)}if(a.isUrlDefinition()){var p=a.getDefinition(),[f,y]=i[r];p.render(t,f,y)}}}static pathM(t){var e=t.getAsCurrentPoint();return t.start=t.current,{point:e}}pathM(t,e){var{pathParser:i}=this,{point:r}=gt.pathM(i),{x:s,y:n}=r;i.addMarker(r),e.addPoint(s,n),t&&t.moveTo(s,n)}static pathL(t){var{current:e}=t;return{current:e,point:t.getAsCurrentPoint()}}pathL(t,e){var{pathParser:i}=this,{current:r,point:s}=gt.pathL(i),{x:n,y:a}=s;i.addMarker(s,r),e.addPoint(n,a),t&&t.lineTo(n,a)}static pathH(t){var{current:e,command:i}=t,r=new U((i.relative?e.x:0)+i.x,e.y);return t.current=r,{current:e,point:r}}pathH(t,e){var{pathParser:i}=this,{current:r,point:s}=gt.pathH(i),{x:n,y:a}=s;i.addMarker(s,r),e.addPoint(n,a),t&&t.lineTo(n,a)}static pathV(t){var{current:e,command:i}=t,r=new U(e.x,(i.relative?e.y:0)+i.y);return t.current=r,{current:e,point:r}}pathV(t,e){var{pathParser:i}=this,{current:r,point:s}=gt.pathV(i),{x:n,y:a}=s;i.addMarker(s,r),e.addPoint(n,a),t&&t.lineTo(n,a)}static pathC(t){var{current:e}=t;return{current:e,point:t.getPoint("x1","y1"),controlPoint:t.getAsControlPoint("x2","y2"),currentPoint:t.getAsCurrentPoint()}}pathC(t,e){var{pathParser:i}=this,{current:r,point:s,controlPoint:n,currentPoint:a}=gt.pathC(i);i.addMarker(a,n,s),e.addBezierCurve(r.x,r.y,s.x,s.y,n.x,n.y,a.x,a.y),t&&t.bezierCurveTo(s.x,s.y,n.x,n.y,a.x,a.y)}static pathS(t){var{current:e}=t;return{current:e,point:t.getReflectedControlPoint(),controlPoint:t.getAsControlPoint("x2","y2"),currentPoint:t.getAsCurrentPoint()}}pathS(t,e){var{pathParser:i}=this,{current:r,point:s,controlPoint:n,currentPoint:a}=gt.pathS(i);i.addMarker(a,n,s),e.addBezierCurve(r.x,r.y,s.x,s.y,n.x,n.y,a.x,a.y),t&&t.bezierCurveTo(s.x,s.y,n.x,n.y,a.x,a.y)}static pathQ(t){var{current:e}=t;return{current:e,controlPoint:t.getAsControlPoint("x1","y1"),currentPoint:t.getAsCurrentPoint()}}pathQ(t,e){var{pathParser:i}=this,{current:r,controlPoint:s,currentPoint:n}=gt.pathQ(i);i.addMarker(n,s,s),e.addQuadraticCurve(r.x,r.y,s.x,s.y,n.x,n.y),t&&t.quadraticCurveTo(s.x,s.y,n.x,n.y)}static pathT(t){var{current:e}=t,i=t.getReflectedControlPoint();return t.control=i,{current:e,controlPoint:i,currentPoint:t.getAsCurrentPoint()}}pathT(t,e){var{pathParser:i}=this,{current:r,controlPoint:s,currentPoint:n}=gt.pathT(i);i.addMarker(n,s,s),e.addQuadraticCurve(r.x,r.y,s.x,s.y,n.x,n.y),t&&t.quadraticCurveTo(s.x,s.y,n.x,n.y)}static pathA(t){var{current:e,command:i}=t,{rX:r,rY:s,xRot:n,lArcFlag:a,sweepFlag:o}=i,h=n*(Math.PI/180),l=t.getAsCurrentPoint(),u=new U(Math.cos(h)*(e.x-l.x)/2+Math.sin(h)*(e.y-l.y)/2,-Math.sin(h)*(e.x-l.x)/2+Math.cos(h)*(e.y-l.y)/2),c=Math.pow(u.x,2)/Math.pow(r,2)+Math.pow(u.y,2)/Math.pow(s,2);c>1&&(r*=Math.sqrt(c),s*=Math.sqrt(c));var g=(a===o?-1:1)*Math.sqrt((Math.pow(r,2)*Math.pow(s,2)-Math.pow(r,2)*Math.pow(u.y,2)-Math.pow(s,2)*Math.pow(u.x,2))/(Math.pow(r,2)*Math.pow(u.y,2)+Math.pow(s,2)*Math.pow(u.x,2)));isNaN(g)&&(g=0);var d=new U(g*r*u.y/s,g*-s*u.x/r),p=new U((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=k([1,0],[(u.x-d.x)/r,(u.y-d.y)/s]),y=[(u.x-d.x)/r,(u.y-d.y)/s],m=[(-u.x-d.x)/r,(-u.y-d.y)/s],v=k(y,m);return O(y,m)<=-1&&(v=Math.PI),O(y,m)>=1&&(v=0),{currentPoint:l,rX:r,rY:s,sweepFlag:o,xAxisRotation:h,centp:p,a1:f,ad:v}}pathA(t,e){var{pathParser:i}=this,{currentPoint:r,rX:s,rY:n,sweepFlag:a,xAxisRotation:o,centp:h,a1:l,ad:u}=gt.pathA(i),c=1-a?1:-1,g=l+c*(u/2),d=new U(h.x+s*Math.cos(g),h.y+n*Math.sin(g));if(i.addMarkerAngle(d,g-c*Math.PI/2),i.addMarkerAngle(r,g-c*Math.PI),e.addPoint(r.x,r.y),t&&!isNaN(l)&&!isNaN(u)){var p=s>n?s:n,f=s>n?1:s/n,y=s>n?n/s:1;t.translate(h.x,h.y),t.rotate(o),t.scale(f,y),t.arc(0,0,p,l,l+u,Boolean(1-a)),t.scale(1/f,1/y),t.rotate(-o),t.translate(-h.x,-h.y)}}static pathZ(t){t.current=t.start}pathZ(t,e){gt.pathZ(this.pathParser),t&&e.x1!==e.x2&&e.y1!==e.y2&&t.closePath()}}class dt extends gt{constructor(t,e,i){super(t,e,i),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 pt extends ct{constructor(t,e,i){super(t,e,new.target===pt||i),this.type="text",this.x=0,this.y=0,this.measureCache=-1}setContext(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];super.setContext(t,e);var 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);var e=null;return this.children.forEach(((i,r)=>{var s=this.getChildBoundingBox(t,this,this,r);e?e.addBoundingBox(s):e=s})),e}getFontSize(){var{document:t,parent:e}=this,i=ht.parse(t.ctx.font).fontSize;return e.getStyle("font-size").getNumber(i)}getTElementBoundingBox(t){var e=this.getFontSize();return new lt(this.x,this.y-e,this.x+this.measureText(t),this.y)}getGlyph(t,e,i){var r=e[i],s=null;if(t.isArabic){var n=e.length,a=e[i-1],o=e[i+1],h="isolated";if((0===i||" "===a)&&i<n-1&&" "!==o&&(h="terminal"),i>0&&" "!==a&&i<n-1&&" "!==o&&(h="medial"),i>0&&" "!==a&&(i===n-1||" "===o)&&(h="initial"),void 0!==t.glyphs[r]){var l=t.glyphs[r];s=l instanceof dt?l:l[h]}}else s=t.glyphs[r];return s||(s=t.missingGlyph),s}getText(){return""}getTextFromNode(t){var e=t||this.node,i=Array.from(e.parentNode.childNodes),r=i.indexOf(e),s=i.length-1,n=c(e.textContent||"");return 0===r&&(n=g(n)),r===s&&(n=d(n)),n}renderChildren(t){if("text"===this.type){this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(t),this.children.forEach(((e,i)=>{this.renderChild(t,this,this,i)}));var{mouse:e}=this.document.screen;e.isWorking()&&e.checkBoundingBox(this,this.getBoundingBox(t))}else this.renderTElementChildren(t)}renderTElementChildren(t){var{document:e,parent:i}=this,r=this.getText(),s=i.getStyle("font-family").getDefinition();if(s)for(var{unitsPerEm:n}=s.fontFace,a=ht.parse(e.ctx.font),o=i.getStyle("font-size").getNumber(a.fontSize),h=i.getStyle("font-style").getString(a.fontStyle),l=o/n,u=s.isRTL?r.split("").reverse().join(""):r,c=p(i.getAttribute("dx").getString()),g=u.length,d=0;d<g;d++){var f=this.getGlyph(s,u,d);t.translate(this.x,this.y),t.scale(l,-l);var y=t.lineWidth;t.lineWidth=t.lineWidth*n/o,"italic"===h&&t.transform(1,0,.4,1,0,0),f.render(t),"italic"===h&&t.transform(1,0,-.4,1,0,0),t.lineWidth=y,t.scale(1/l,-1/l),t.translate(-this.x,-this.y),this.x+=o*(f.horizAdvX||s.horizAdvX)/n,void 0===c[d]||isNaN(c[d])||(this.x+=c[d])}else{var{x:m,y:v}=this;t.fillStyle&&t.fillText(r,m,v),t.strokeStyle&&t.strokeText(r,m,v)}}applyAnchoring(){if(!(this.textChunkStart>=this.leafTexts.length)){var t=this.leafTexts[this.textChunkStart],e=t.getStyle("text-anchor").getString("start"),i=0;i="start"===e?t.x-this.minX:"end"===e?t.x-this.maxX:t.x-(this.minX+this.maxX)/2;for(var r=this.textChunkStart;r<this.leafTexts.length;r++)this.leafTexts[r].x+=i;this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.textChunkStart=this.leafTexts.length}}adjustChildCoordinatesRecursive(t){this.children.forEach(((e,i)=>{this.adjustChildCoordinatesRecursiveCore(t,this,this,i)})),this.applyAnchoring()}adjustChildCoordinatesRecursiveCore(t,e,i,r){var 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){var s=i.children[r];if("function"!=typeof s.measureText)return s;t.save(),s.setContext(t,!0);var n=s.getAttribute("x"),a=s.getAttribute("y"),o=s.getAttribute("dx"),h=s.getAttribute("dy"),l=s.getStyle("font-family").getDefinition(),u=Boolean(l)&&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")));var c=s.measureText(t);return u&&(e.x-=c),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,u||(e.x+=c),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+c),e.maxX=Math.max(e.maxX,s.x,s.x+c),s.clearContext(t),t.restore(),s}getChildBoundingBox(t,e,i,r){var s=i.children[r];if("function"!=typeof s.getBoundingBox)return null;var n=s.getBoundingBox(t);return n?(s.children.forEach(((i,r)=>{var a=e.getChildBoundingBox(t,e,s,r);n.addBoundingBox(a)})),n):null}renderChild(t,e,i,r){var s=i.children[r];s.render(t),s.children.forEach(((i,r)=>{e.renderChild(t,e,s,r)}))}measureText(t){var{measureCache:e}=this;if(~e)return e;var i=this.getText(),r=this.measureTargetText(t,i);return this.measureCache=r,r}measureTargetText(t,e){if(!e.length)return 0;var{parent:i}=this,r=i.getStyle("font-family").getDefinition();if(r){for(var s=this.getFontSize(),n=r.isRTL?e.split("").reverse().join(""):e,a=p(i.getAttribute("dx").getString()),o=n.length,h=0,l=0;l<o;l++){h+=(this.getGlyph(r,n,l).horizAdvX||r.horizAdvX)*s/r.fontFace.unitsPerEm,void 0===a[l]||isNaN(a[l])||(h+=a[l])}return h}if(!t.measureText)return 10*e.length;t.save(),this.setContext(t,!0);var{width:u}=t.measureText(e);return this.clearContext(t),t.restore(),u}getInheritedAttribute(t){for(var e=this;e instanceof pt&&e.isFirstChild();){var i=e.parent.getAttribute(t);if(i.hasValue(!0))return i.getValue("0");e=e.parent}return null}}class ft extends pt{constructor(t,e,i){super(t,e,new.target===ft||i),this.type="tspan",this.text=this.children.length>0?"":this.getTextFromNode()}getText(){return this.text}}class yt extends ft{constructor(){super(...arguments),this.type="textNode"}}class mt extends ct{constructor(){super(...arguments),this.type="svg",this.root=!1}setContext(t){var e,{document:i}=this,{screen:r,window:s}=i,n=t.canvas;if(r.setDefaults(t),n.style&&void 0!==t.font&&s&&void 0!==s.getComputedStyle){t.font=s.getComputedStyle(n).getPropertyValue("font");var a=new _(i,"fontSize",ht.parse(t.font).fontSize);a.hasValue()&&(i.rootEmSize=a.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);var{width:o,height:h}=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");var l=this.getAttribute("refX"),u=this.getAttribute("refY"),c=this.getAttribute("viewBox"),g=c.hasValue()?p(c.getString()):null,d=!this.root&&"visible"!==this.getStyle("overflow").getValue("hidden"),f=0,y=0,m=0,v=0;g&&(f=g[0],y=g[1]),this.root||(o=this.getStyle("width").getPixels("x"),h=this.getStyle("height").getPixels("y"),"marker"===this.type&&(m=f,v=y,f=0,y=0)),r.viewPort.setCurrent(o,h),!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")),g&&(o=g[2],h=g[3]),i.setViewBox({ctx:t,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:r.viewPort.width,desiredWidth:o,height:r.viewPort.height,desiredHeight:h,minX:f,minY:y,refX:l.getValue(),refY:u.getValue(),clip:d,clipX:m,clipY:v}),g&&(r.viewPort.removeCurrent(),r.viewPort.setCurrent(o,h))}clearContext(t){super.clearContext(t),this.document.screen.viewPort.removeCurrent()}resize(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],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{var l=this.getAttribute("preserveAspectRatio");l.hasValue()&&l.setValue(l.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()){var u=this.getStyle("width"),c=this.getStyle("height");u.hasValue()&&u.setValue("".concat(t,"px")),c.hasValue()&&c.setValue("".concat(e,"px"))}}}class vt extends gt{constructor(){super(...arguments),this.type="rect"}path(t){var 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"),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){var l=(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+l*o,i,e+r,i+h-l*h,e+r,i+h),t.lineTo(e+r,i+s-h),t.bezierCurveTo(e+r,i+s-h+l*h,e+r-o+l*o,i+s,e+r-o,i+s),t.lineTo(e+o,i+s),t.bezierCurveTo(e+o-l*o,i+s,e,i+s-h+l*h,e,i+s-h),t.lineTo(e,i+h),t.bezierCurveTo(e,i+h-l*h,e+o-l*o,i,e+o,i),t.closePath())}return new lt(e,i,e+r,i+s)}getMarkers(){return null}}class xt extends gt{constructor(){super(...arguments),this.type="circle"}path(t){var 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 lt(e-r,i-r,e+r,i+r)}getMarkers(){return null}}class bt extends gt{constructor(){super(...arguments),this.type="ellipse"}path(t){var 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 lt(s-i,n-r,s+i,n+r)}getMarkers(){return null}}class wt extends gt{constructor(){super(...arguments),this.type="line"}getPoints(){return[new U(this.getAttribute("x1").getPixels("x"),this.getAttribute("y1").getPixels("y")),new U(this.getAttribute("x2").getPixels("x"),this.getAttribute("y2").getPixels("y"))]}path(t){var[{x:e,y:i},{x:r,y:s}]=this.getPoints();return t&&(t.beginPath(),t.moveTo(e,i),t.lineTo(r,s)),new lt(e,i,r,s)}getMarkers(){var[t,e]=this.getPoints(),i=t.angleTo(e);return[[t,i],[e,i]]}}class Pt extends gt{constructor(t,e,i){super(t,e,i),this.type="polyline",this.points=[],this.points=U.parsePath(this.getAttribute("points").getString())}path(t){var{points:e}=this,[{x:i,y:r}]=e,s=new lt(i,r);return t&&(t.beginPath(),t.moveTo(i,r)),e.forEach((e=>{var{x:i,y:r}=e;s.addPoint(i,r),t&&t.lineTo(i,r)})),s}getMarkers(){var{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}}class St extends Pt{constructor(){super(...arguments),this.type="polygon"}path(t){var e=super.path(t),[{x:i,y:r}]=this.points;return t&&(t.lineTo(i,r),t.closePath()),e}}class At extends rt{constructor(){super(...arguments),this.type="pattern"}createPattern(t,e,i){var r=this.getStyle("width").getPixels("x",!0),s=this.getStyle("height").getPixels("y",!0),n=new mt(this.document,null);n.attributes.viewBox=new _(this.document,"viewBox",this.getAttribute("viewBox").getValue()),n.attributes.width=new _(this.document,"width","".concat(r,"px")),n.attributes.height=new _(this.document,"height","".concat(s,"px")),n.attributes.transform=new _(this.document,"transform",this.getAttribute("patternTransform").getValue()),n.children=this.children;var 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(var u=-1;u<=1;u++)for(var c=-1;c<=1;c++)o.save(),n.attributes.x=new _(this.document,"x",u*a.width),n.attributes.y=new _(this.document,"y",c*a.height),n.render(o),o.restore();return t.createPattern(a,"repeat")}}class Ct extends rt{constructor(){super(...arguments),this.type="marker"}render(t,e,i){if(e){var{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();var o=new mt(this.document,null);o.type=this.type,o.attributes.viewBox=new _(this.document,"viewBox",this.getAttribute("viewBox").getValue()),o.attributes.refX=new _(this.document,"refX",this.getAttribute("refX").getValue()),o.attributes.refY=new _(this.document,"refY",this.getAttribute("refY").getValue()),o.attributes.width=new _(this.document,"width",this.getAttribute("markerWidth").getValue()),o.attributes.height=new _(this.document,"height",this.getAttribute("markerHeight").getValue()),o.attributes.overflow=new _(this.document,"overflow",this.getAttribute("overflow").getValue()),o.attributes.fill=new _(this.document,"fill",this.getAttribute("fill").getColor("black")),o.attributes.stroke=new _(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)}}}class Tt extends rt{constructor(){super(...arguments),this.type="defs"}render(){}}class Et extends ct{constructor(){super(...arguments),this.type="g"}getBoundingBox(t){var e=new lt;return this.children.forEach((i=>{e.addBoundingBox(i.getBoundingBox(t))})),e}}class Vt extends rt{constructor(t,e,i){super(t,e,i),this.attributesToInherit=["gradientUnits"],this.stops=[];var{stops:r,children:s}=this;s.forEach((t=>{"stop"===t.type&&r.push(t)}))}getGradientUnits(){return this.getAttribute("gradientUnits").getString("objectBoundingBox")}createGradient(t,e,i){var r=this;this.getHrefAttribute().hasValue()&&(r=this.getHrefAttribute().getDefinition(),this.inheritStopContainer(r));var{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()){var{document:a}=this,{MAX_VIRTUAL_PIXELS:o,viewPort:h}=a.screen,[l]=h.viewPorts,u=new vt(a,null);u.attributes.x=new _(a,"x",-o/3),u.attributes.y=new _(a,"y",-o/3),u.attributes.width=new _(a,"width",o),u.attributes.height=new _(a,"height",o);var c=new Et(a,null);c.attributes.transform=new _(a,"transform",this.getAttribute("gradientTransform").getValue()),c.children=[u];var g=new mt(a,null);g.attributes.x=new _(a,"x",0),g.attributes.y=new _(a,"y",0),g.attributes.width=new _(a,"width",l.width),g.attributes.height=new _(a,"height",l.height),g.children=[c];var d=a.createCanvas(l.width,l.height),p=d.getContext("2d");return p.fillStyle=n,g.render(p),p.createPattern(d,"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 _(this.document,"color",e).addOpacity(t).getColor():e}}class Mt extends Vt{constructor(t,e,i){super(t,e,i),this.type="linearGradient",this.attributesToInherit.push("x1","y1","x2","y2")}getGradient(t,e){var 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));var 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)}}class Ot extends Vt{constructor(t,e,i){super(t,e,i),this.type="radialGradient",this.attributesToInherit.push("cx","cy","r","fx","fy","fr")}getGradient(t,e){var 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%");var 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"),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"));var 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)}}class kt extends rt{constructor(t,e,i){super(t,e,i),this.type="stop";var r=Math.max(0,Math.min(1,this.getAttribute("offset").getNumber())),s=this.getStyle("stop-opacity"),n=this.getStyle("stop-color",!0);""===n.getString()&&n.setValue("#000"),s.hasValue()&&(n=n.addOpacity(s)),this.offset=r,this.color=n.getColor()}}class Nt extends rt{constructor(t,e,i){super(t,e,i),this.type="animate",this.duration=0,this.initialValue=null,this.initialUnits="",this.removed=!1,this.frozen=!1,t.screen.animations.push(this),this.begin=this.getAttribute("begin").getMilliseconds(),this.maxDuration=this.begin+this.getAttribute("dur").getMilliseconds(),this.from=this.getAttribute("from"),this.to=this.getAttribute("to"),this.values=new _(t,"values",null);var r=this.getAttribute("values");r.hasValue()&&this.values.setValue(r.getString().split(";"))}getProperty(){var t=this.getAttribute("attributeType").getString(),e=this.getAttribute("attributeName").getString();return"CSS"===t?this.parent.getStyle(e,!0):this.parent.getAttribute(e,!0)}calcValue(){var{initialUnits:t}=this,{progress:e,from:i,to:r}=this.getProgress(),s=i.getNumber()+(r.getNumber()-i.getNumber())*e;return"%"===t&&(s*=100),"".concat(s).concat(t)}update(t){var{parent:e}=this,i=this.getProperty();if(this.initialValue||(this.initialValue=i.getString(),this.initialUnits=i.getUnits()),this.duration>this.maxDuration){var r=this.getAttribute("fill").getString("remove");if("indefinite"===this.getAttribute("repeatCount").getString()||"indefinite"===this.getAttribute("repeatDur").getString())this.duration=0;else if("freeze"!==r||this.frozen){if("remove"===r&&!this.removed)return this.removed=!0,i.setValue(e.animationFrozen?e.animationFrozenValue:this.initialValue),!0}else this.frozen=!0,e.animationFrozen=!0,e.animationFrozenValue=i.getString();return!1}this.duration+=t;var s=!1;if(this.begin<this.duration){var n=this.calcValue(),a=this.getAttribute("type");if(a.hasValue()){var o=a.getString();n="".concat(o,"(").concat(n,")")}i.setValue(n),s=!0}return s}getProgress(){var{document:t,values:e}=this,i={progress:(this.duration-this.begin)/(this.maxDuration-this.begin)};if(e.hasValue()){var r=i.progress*(e.getValue().length-1),s=Math.floor(r),n=Math.ceil(r);i.from=new _(t,"from",parseFloat(e.getValue()[s])),i.to=new _(t,"to",parseFloat(e.getValue()[n])),i.progress=(r-s)/(n-s)}else i.from=this.from,i.to=this.to;return i}}class Lt extends Nt{constructor(){super(...arguments),this.type="animateColor"}calcValue(){var{progress:t,from:e,to:i}=this.getProgress(),r=new a(e.getColor()),s=new a(i.getColor());if(r.ok&&s.ok){var n=r.r+(s.r-r.r)*t,o=r.g+(s.g-r.g)*t,h=r.b+(s.b-r.b)*t;return"rgb(".concat(Math.floor(n),", ").concat(Math.floor(o),", ").concat(Math.floor(h),")")}return this.getAttribute("from").getColor()}}class Bt extends Nt{constructor(){super(...arguments),this.type="animateTransform"}calcValue(){var{progress:t,from:e,to:i}=this.getProgress(),r=p(e.getString()),s=p(i.getString()),n=r.map(((e,i)=>e+(s[i]-e)*t)).join(" ");return n}}class Dt extends rt{constructor(t,e,i){super(t,e,i),this.type="font",this.glyphs={},this.horizAdvX=this.getAttribute("horiz-adv-x").getNumber();var{definitions:r}=t,{children:s}=this;for(var n of s)switch(n.type){case"font-face":this.fontFace=n;var a=n.getStyle("font-family");a.hasValue()&&(r[a.getString()]=this);break;case"missing-glyph":this.missingGlyph=n;break;case"glyph":var o=n;o.arabicForm?(this.isRTL=!0,this.isArabic=!0,void 0===this.glyphs[o.unicode]&&(this.glyphs[o.unicode]={}),this.glyphs[o.unicode][o.arabicForm]=o):this.glyphs[o.unicode]=o}}render(){}}class zt extends rt{constructor(t,e,i){super(t,e,i),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 It extends gt{constructor(){super(...arguments),this.type="missing-glyph",this.horizAdvX=0}}class Rt extends pt{constructor(){super(...arguments),this.type="tref"}getText(){var t=this.getHrefAttribute().getDefinition();if(t){var e=t.children[0];if(e)return e.getText()}return""}}class _t extends pt{constructor(t,e,i){super(t,e,i),this.type="a";var{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):""}getText(){return this.text}renderChildren(t){if(this.hasText){super.renderChildren(t);var{document:e,x:i,y:r}=this,{mouse:s}=e.screen,n=new _(e,"fontSize",ht.parse(e.ctx.font).fontSize);s.isWorking()&&s.checkBoundingBox(this,new lt(i,r-n.getPixels("y"),i+this.measureText(t),r))}else if(this.children.length>0){var a=new Et(this.document,null);a.children=this.children,a.parent=this,a.render(t)}}onClick(){var{window:t}=this.document;t&&t.open(this.getHrefAttribute().getString())}onMouseMove(){this.document.ctx.canvas.style.cursor="pointer"}}function Ft(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,r)}return i}function Ut(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Ft(Object(i),!0).forEach((function(e){(0,s.Z)(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Ft(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}class Xt extends pt{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]]);var r=this.getHrefAttribute().getDefinition();this.text=this.getTextFromNode(),this.dataArray=this.parsePathData(r)}getText(){return this.text}path(t){var{dataArray:e}=this;t&&t.beginPath(),e.forEach((e=>{var{type:i,points:r}=e;switch(i){case ut.LINE_TO:t&&t.lineTo(r[0],r[1]);break;case ut.MOVE_TO:t&&t.moveTo(r[0],r[1]);break;case ut.CURVE_TO:t&&t.bezierCurveTo(r[0],r[1],r[2],r[3],r[4],r[5]);break;case ut.QUAD_TO:t&&t.quadraticCurveTo(r[0],r[1],r[2],r[3]);break;case ut.ARC:var[s,n,a,o,h,l,u,c]=r,g=a>o?a:o,d=a>o?1:a/o,p=a>o?o/a:1;t&&(t.translate(s,n),t.rotate(u),t.scale(d,p),t.arc(0,0,g,h,h+l,Boolean(1-c)),t.scale(1/d,1/p),t.rotate(-u),t.translate(-s,-n));break;case ut.CLOSE_PATH:t&&t.closePath()}}))}renderChildren(t){this.setTextData(t),t.save();var e=this.parent.getStyle("text-decoration").getString(),i=this.getFontSize(),{glyphInfo:r}=this,s=t.fillStyle;"underline"===e&&t.beginPath(),r.forEach(((r,s)=>{var{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(){var 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){var l=n,u=this.measureText(t,o);" "===o&&"justify"===e&&i<r&&(u+=(r-i)/s),h>-1&&(l+=this.getLetterSpacingAt(h));var c=this.textHeight/20,g=this.getEquidistantPointOnPath(l,c,0),d=this.getEquidistantPointOnPath(l+u,c,0),p={p0:g,p1:d},f=g&&d?Math.atan2(d.y-g.y,d.x-g.x):0;if(a){var y=Math.cos(Math.PI/2+f)*a,m=Math.cos(-f)*a;p.p0=Ut(Ut({},g),{},{x:g.x+y,y:g.y+m}),p.p1=Ut(Ut({},d),{},{x:d.x+y,y:d.y+m})}return{offset:l+=u,segment:p,rotation:f}}measureText(t,e){var{measuresCache:i}=this,r=e||this.getText();if(i.has(r))return i.get(r);var s=this.measureTargetText(t,r);return i.set(r,s),s}setTextData(t){if(!this.glyphInfo){var 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"),l=0;o.hasValue()&&"inherit"!==o.getValue()?o.hasValue()&&"initial"!==o.getValue()&&"unset"!==o.getValue()&&(l=o.getPixels()):l=h.getPixels();var u=[],c=e.length;this.letterSpacingCache=u;for(var g=0;g<c;g++)u.push(void 0!==s[g]?s[g]:l);var d=u.reduce(((t,e,i)=>0===i?0:t+e||0),0),p=this.measureText(t),f=Math.max(p+d,0);this.textWidth=p,this.textHeight=this.getFontSize(),this.glyphInfo=[];var y=this.getPathLength(),m=this.getStyle("startOffset").getNumber(0)*y,v=0;"middle"!==a&&"center"!==a||(v=-f/2),"end"!==a&&"right"!==a||(v=-f),v+=m,i.forEach(((e,s)=>{var{offset:o,segment:h,rotation:l}=this.findSegmentToFitChar(t,a,f,y,r,v,n,e,s);v=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[];var e=[],{pathParser:i}=t;for(i.reset();!i.isEnd();){var{current:r}=i,s=r?r.x:0,n=r?r.y:0,a=i.next(),o=a.type,h=[];switch(a.type){case ut.MOVE_TO:this.pathM(i,h);break;case ut.LINE_TO:o=this.pathL(i,h);break;case ut.HORIZ_LINE_TO:o=this.pathH(i,h);break;case ut.VERT_LINE_TO:o=this.pathV(i,h);break;case ut.CURVE_TO:this.pathC(i,h);break;case ut.SMOOTH_CURVE_TO:o=this.pathS(i,h);break;case ut.QUAD_TO:this.pathQ(i,h);break;case ut.SMOOTH_QUAD_TO:o=this.pathT(i,h);break;case ut.ARC:h=this.pathA(i);break;case ut.CLOSE_PATH:gt.pathZ(i)}a.type!==ut.CLOSE_PATH?e.push({type:o,points:h,start:{x:s,y:n},pathLength:this.calcLength(s,n,o,h)}):e.push({type:ut.CLOSE_PATH,points:[],pathLength:0})}return e}pathM(t,e){var{x:i,y:r}=gt.pathM(t).point;e.push(i,r)}pathL(t,e){var{x:i,y:r}=gt.pathL(t).point;return e.push(i,r),ut.LINE_TO}pathH(t,e){var{x:i,y:r}=gt.pathH(t).point;return e.push(i,r),ut.LINE_TO}pathV(t,e){var{x:i,y:r}=gt.pathV(t).point;return e.push(i,r),ut.LINE_TO}pathC(t,e){var{point:i,controlPoint:r,currentPoint:s}=gt.pathC(t);e.push(i.x,i.y,r.x,r.y,s.x,s.y)}pathS(t,e){var{point:i,controlPoint:r,currentPoint:s}=gt.pathS(t);return e.push(i.x,i.y,r.x,r.y,s.x,s.y),ut.CURVE_TO}pathQ(t,e){var{controlPoint:i,currentPoint:r}=gt.pathQ(t);e.push(i.x,i.y,r.x,r.y)}pathT(t,e){var{controlPoint:i,currentPoint:r}=gt.pathT(t);return e.push(i.x,i.y,r.x,r.y),ut.QUAD_TO}pathA(t){var{rX:e,rY:i,sweepFlag:r,xAxisRotation:s,centp:n,a1:a,ad:o}=gt.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){var s=0,n=null,a=null,o=0;switch(i){case ut.LINE_TO:return this.getLineLength(t,e,r[0],r[1]);case ut.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 ut.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 ut.ARC:s=0;var h=r[4],l=r[5],u=r[4]+l,c=Math.PI/180;if(Math.abs(h-u)<c&&(c=Math.abs(h-u)),n=this.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],h,0),l<0)for(o=h-c;o>u;o-=c)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=h+c;o<u;o+=c)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;return a=this.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],u,0),s+=this.getLineLength(n.x,n.y,a.x,a.y)}return 0}getPointOnLine(t,e,i,r,s){var n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:e,a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:i,o=(s-i)/(r-e+V),h=Math.sqrt(t*t/(1+o*o));r<e&&(h*=-1);var l=o*h,u=null;if(r===e)u={x:n,y:a+l};else if((a-i)/(n-e+V)===o)u={x:n+h,y:a+l};else{var c,g,d=this.getLineLength(e,i,r,s);if(d<V)return null;var p=(n-e)*(r-e)+(a-i)*(s-i);c=e+(p/=d*d)*(r-e),g=i+p*(s-i);var f=this.getLineLength(n,a,c,g),y=Math.sqrt(t*t-f*f);h=Math.sqrt(y*y/(1+o*o)),r<e&&(h*=-1),u={x:c+h,y:g+(l=o*h)}}return u}getPointOnPath(t){var e=this.getPathLength(),i=0,r=null;if(t<-5e-5||t-5e-5>e)return null;var{dataArray:s}=this;for(var n of s){if(!n||!(n.pathLength<5e-5||i+n.pathLength+5e-5<t)){var a=t-i,o=0;switch(n.type){case ut.LINE_TO:r=this.getPointOnLine(a,n.start.x,n.start.y,n.points[0],n.points[1],n.start.x,n.start.y);break;case ut.ARC:var h=n.points[4],l=n.points[5],u=n.points[4]+l;if(o=h+a/n.pathLength*l,l<0&&o<u||l>=0&&o>u)break;r=this.getPointOnEllipticalArc(n.points[0],n.points[1],n.points[2],n.points[3],o,n.points[6]);break;case ut.CURVE_TO:(o=a/n.pathLength)>1&&(o=1),r=this.getPointOnCubicBezier(o,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 ut.QUAD_TO:(o=a/n.pathLength)>1&&(o=1),r=this.getPointOnQuadraticBezier(o,n.start.x,n.start.y,n.points[0],n.points[1],n.points[2],n.points[3])}if(r)return r;break}i+=n.pathLength}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*N(t)+n*L(t)+r*B(t)+e*D(t),y:h*N(t)+a*L(t)+s*B(t)+i*D(t)}}getPointOnQuadraticBezier(t,e,i,r,s,n,a){return{x:n*z(t)+r*I(t)+e*R(t),y:a*z(t)+s*I(t)+i*R(t)}}getPointOnEllipticalArc(t,e,i,r,s,n){var 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){var 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:[]};for(var n=0,a=0;a<=i;a+=r){var o=this.getPointOnPath(a),h=this.getPointOnPath(a+r);o&&h&&((n+=this.getLineLength(o.x,o.y,h.x,h.y))>=s&&(this.equidistantCache.points.push({x:o.x,y:o.y,distance:a}),n-=s))}}}getEquidistantPointOnPath(t,e,i){if(this.buildEquidistantCache(e,i),t<0||t-this.getPathLength()>5e-5)return null;var r=Math.round(t/this.getPathLength()*(this.equidistantCache.points.length-1));return this.equidistantCache.points[r]||null}}var jt=/^\s*data:(([^/,;]+\/[^/,;]+)(?:;([^,;=]+=[^,;=]+))?)?(?:;(base64))?,(.*)$/i;class Wt extends ct{constructor(t,e,i){super(t,e,i),this.type="image",this.loaded=!1;var r=this.getHrefAttribute().getString();if(r){var s=r.endsWith(".svg")||/^\s*data:image\/svg\+xml/i.test(r);t.images.push(this),s?this.loadSvg(r):this.loadImage(r),this.isSvg=s}}loadImage(t){var e=this;return(0,r.Z)((function*(){try{var i=yield e.document.createImage(t);e.image=i}catch(e){console.error('Error while loading image "'.concat(t,'":'),e)}e.loaded=!0}))()}loadSvg(t){var e=this;return(0,r.Z)((function*(){var i=jt.exec(t);if(i){var r=i[5];"base64"===i[4]?e.image=atob(r):e.image=decodeURIComponent(r)}else try{var s=yield e.document.fetch(t),n=yield s.text();e.image=n}catch(e){console.error('Error while loading image "'.concat(t,'":'),e)}e.loaded=!0}))()}renderChildren(t){var{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),this.isSvg){var h=e.canvg.forkString(t,this.image,{ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:0,offsetY:0,scaleWidth:a,scaleHeight:o});h.document.documentElement.parent=this,h.render()}else{var l=this.image;e.setViewBox({ctx:t,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:a,desiredWidth:l.width,height:o,desiredHeight:l.height}),this.loaded&&(void 0===l.complete||l.complete)&&t.drawImage(l,0,0)}t.restore()}}getBoundingBox(){var 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 lt(t,e,t+i,e+r)}}class Yt extends ct{constructor(){super(...arguments),this.type="symbol"}render(t){}}class Ht{constructor(t){this.document=t,this.loaded=!1,t.fonts.push(this)}load(t,e){var i=this;return(0,r.Z)((function*(){try{var{document:r}=i,s=(yield r.canvg.parser.load(e)).getElementsByTagName("font");Array.from(s).forEach((e=>{var i=r.createElement(e);r.definitions[t]=i}))}catch(t){console.error('Error while loading font "'.concat(e,'":'),t)}i.loaded=!0}))()}}class $t extends rt{constructor(t,e,i){super(t,e,i),this.type="style",c(Array.from(e.childNodes).map((t=>t.textContent)).join("").replace(/(\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm,"").replace(/@import.*;/g,"")).split("}").forEach((e=>{var i=e.trim();if(i){var r=i.split("{"),s=r[0].split(","),n=r[1].split(";");s.forEach((e=>{var i=e.trim();if(i){var r=t.styles[i]||{};if(n.forEach((e=>{var i=e.indexOf(":"),s=e.substr(0,i).trim(),n=e.substr(i+1,e.length-i).trim();s&&n&&(r[s]=new _(t,s,n))})),t.styles[i]=r,t.stylesSpecificity[i]=E(i),"@font-face"===i){var s=r["font-family"].getString().replace(/"|'/g,"");r.src.getString().split(",").forEach((e=>{if(e.indexOf('format("svg")')>0){var i=m(e);i&&new Ht(t).load(s,i)}}))}}}))}}))}}$t.parseExternalUrl=m;class qt extends ct{constructor(){super(...arguments),this.type="use"}setContext(t){super.setContext(t);var 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){var{element:e}=this;e&&e.path(t)}renderChildren(t){var{document:e,element:i}=this;if(i){var r=i;if("symbol"===i.type&&((r=new mt(e,null)).attributes.viewBox=new _(e,"viewBox",i.getAttribute("viewBox").getString()),r.attributes.preserveAspectRatio=new _(e,"preserveAspectRatio",i.getAttribute("preserveAspectRatio").getString()),r.attributes.overflow=new _(e,"overflow",i.getAttribute("overflow").getString()),r.children=i.children,i.styles.opacity=new _(e,"opacity",this.calculateOpacity())),"svg"===r.type){var s=this.getStyle("width",!1,!0),n=this.getStyle("height",!1,!0);s.hasValue()&&(r.attributes.width=new _(e,"width",s.getString())),n.hasValue()&&(r.attributes.height=new _(e,"height",n.getString()))}var a=r.parent;r.parent=this,r.render(t),r.parent=a}}getBoundingBox(t){var{element:e}=this;return e?e.getBoundingBox(t):null}elementTransform(){var{document:t,element:e}=this;return it.fromElement(t,e)}get element(){return this.cachedElement||(this.cachedElement=this.getHrefAttribute().getDefinition()),this.cachedElement}}function Gt(t,e,i,r,s,n){return t[i*r*4+4*e+n]}function Qt(t,e,i,r,s,n,a){t[i*r*4+4*e+n]=a}function Zt(t,e,i){return t[e]*i}function Jt(t,e,i,r){return e+Math.cos(t)*i+Math.sin(t)*r}class Kt extends rt{constructor(t,e,i){super(t,e,i),this.type="feColorMatrix";var r=p(this.getAttribute("values").getString());switch(this.getAttribute("type").getString("matrix")){case"saturate":var s=r[0];r=[.213+.787*s,.715-.715*s,.072-.072*s,0,0,.213-.213*s,.715+.285*s,.072-.072*s,0,0,.213-.213*s,.715-.715*s,.072+.928*s,0,0,0,0,0,1,0,0,0,0,0,1];break;case"hueRotate":var n=r[0]*Math.PI/180;r=[Jt(n,.213,.787,-.213),Jt(n,.715,-.715,-.715),Jt(n,.072,-.072,.928),0,0,Jt(n,.213,-.213,.143),Jt(n,.715,.285,.14),Jt(n,.072,-.072,-.283),0,0,Jt(n,.213,-.213,-.787),Jt(n,.715,-.715,.715),Jt(n,.072,.928,.072),0,0,0,0,0,1,0,0,0,0,0,1];break;case"luminanceToAlpha":r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,.2125,.7154,.0721,0,0,0,0,0,0,1]}this.matrix=r,this.includeOpacity=this.getAttribute("includeOpacity").hasValue()}apply(t,e,i,r,s){for(var{includeOpacity:n,matrix:a}=this,o=t.getImageData(0,0,r,s),h=0;h<s;h++)for(var l=0;l<r;l++){var u=Gt(o.data,l,h,r,0,0),c=Gt(o.data,l,h,r,0,1),g=Gt(o.data,l,h,r,0,2),d=Gt(o.data,l,h,r,0,3),p=Zt(a,0,u)+Zt(a,1,c)+Zt(a,2,g)+Zt(a,3,d)+Zt(a,4,1),f=Zt(a,5,u)+Zt(a,6,c)+Zt(a,7,g)+Zt(a,8,d)+Zt(a,9,1),y=Zt(a,10,u)+Zt(a,11,c)+Zt(a,12,g)+Zt(a,13,d)+Zt(a,14,1),m=Zt(a,15,u)+Zt(a,16,c)+Zt(a,17,g)+Zt(a,18,d)+Zt(a,19,1);n&&(p=0,f=0,y=0,m*=d/255),Qt(o.data,l,h,r,0,0,p),Qt(o.data,l,h,r,0,1,f),Qt(o.data,l,h,r,0,2,y),Qt(o.data,l,h,r,0,3,m)}t.clearRect(0,0,r,s),t.putImageData(o,0,0)}}class te extends rt{constructor(){super(...arguments),this.type="mask"}apply(t,e){var{document:i}=this,r=this.getAttribute("x").getPixels("x"),s=this.getAttribute("y").getPixels("y"),n=this.getStyle("width").getPixels("x"),a=this.getStyle("height").getPixels("y");if(!n&&!a){var o=new lt;this.children.forEach((e=>{o.addBoundingBox(e.getBoundingBox(t))})),r=Math.floor(o.x1),s=Math.floor(o.y1),n=Math.floor(o.width),a=Math.floor(o.height)}var h=this.removeStyles(e,te.ignoreStyles),l=i.createCanvas(r+n,s+a),u=l.getContext("2d");i.screen.setDefaults(u),this.renderChildren(u),new Kt(i,{nodeType:1,childNodes:[],attributes:[{nodeName:"type",value:"luminanceToAlpha"},{nodeName:"includeOpacity",value:"true"}]}).apply(u,0,0,r+n,s+a);var c=i.createCanvas(r+n,s+a),g=c.getContext("2d");i.screen.setDefaults(g),e.render(g),g.globalCompositeOperation="destination-in",g.fillStyle=u.createPattern(l,"no-repeat"),g.fillRect(0,0,r+n,s+a),t.fillStyle=g.createPattern(c,"no-repeat"),t.fillRect(0,0,r+n,s+a),this.restoreStyles(e,h)}render(t){}}te.ignoreStyles=["mask","transform","clip-path"];var ee=()=>{};class ie extends rt{constructor(){super(...arguments),this.type="clipPath"}apply(t){var{document:e}=this,i=Reflect.getPrototypeOf(t),{beginPath:r,closePath:s}=t;i&&(i.beginPath=ee,i.closePath=ee),Reflect.apply(r,t,[]),this.children.forEach((r=>{if(void 0!==r.path){var n=void 0!==r.elementTransform?r.elementTransform():null;n||(n=it.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){}}class re extends rt{constructor(){super(...arguments),this.type="filter"}apply(t,e){var{document:i,children:r}=this,s=e.getBoundingBox(t);if(s){var n=0,a=0;r.forEach((t=>{var e=t.extraFilterDistance||0;n=Math.max(n,e),a=Math.max(a,e)}));var o=Math.floor(s.width),h=Math.floor(s.height),l=o+2*n,u=h+2*a;if(!(l<1||u<1)){var c=Math.floor(s.x),g=Math.floor(s.y),d=this.removeStyles(e,re.ignoreStyles),p=i.createCanvas(l,u),f=p.getContext("2d");i.screen.setDefaults(f),f.translate(-c+n,-g+a),e.render(f),r.forEach((t=>{"function"==typeof t.apply&&t.apply(f,0,0,l,u)})),t.drawImage(p,0,0,l,u,c-n,g-a,l,u),this.restoreStyles(e,d)}}}render(t){}}re.ignoreStyles=["filter","transform","clip-path"];class se extends rt{constructor(t,e,i){super(t,e,i),this.type="feDropShadow",this.addStylesFromStyleDefinition()}apply(t,e,i,r,s){}}class ne extends rt{constructor(){super(...arguments),this.type="feMorphology"}apply(t,e,i,r,s){}}class ae extends rt{constructor(){super(...arguments),this.type="feComposite"}apply(t,e,i,r,s){}}class oe extends rt{constructor(t,e,i){super(t,e,i),this.type="feGaussianBlur",this.blurRadius=Math.floor(this.getAttribute("stdDeviation").getNumber()),this.extraFilterDistance=this.blurRadius}apply(t,e,i,r,s){var{document:n,blurRadius:a}=this,o=n.window?n.window.document.body:null,l=t.canvas;l.id=n.getUniqueId(),o&&(l.style.display="none",o.appendChild(l)),(0,h.vR)(l,e,i,r,s,a),o&&o.removeChild(l)}}class he extends rt{constructor(){super(...arguments),this.type="title"}}class le extends rt{constructor(){super(...arguments),this.type="desc"}}var ue={svg:mt,rect:vt,circle:xt,ellipse:bt,line:wt,polyline:Pt,polygon:St,path:gt,pattern:At,marker:Ct,defs:Tt,linearGradient:Mt,radialGradient:Ot,stop:kt,animate:Nt,animateColor:Lt,animateTransform:Bt,font:Dt,"font-face":zt,"missing-glyph":It,glyph:dt,text:pt,tspan:ft,tref:Rt,a:_t,textPath:Xt,image:Wt,g:Et,symbol:Yt,style:$t,use:qt,mask:te,clipPath:ie,filter:re,feDropShadow:se,feMorphology:ne,feComposite:ae,feColorMatrix:Kt,feGaussianBlur:oe,title:he,desc:le};function ce(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,r)}return i}function ge(){return ge=(0,r.Z)((function*(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],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}))})),ge.apply(this,arguments)}class de{constructor(t){var{rootEmSize:e=12,emSize:i=12,createCanvas:r=de.createCanvas,createImage:s=de.createImage,anonymousCrossOrigin:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};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.bind(this)),this.screen.wait(this.isFontsLoaded.bind(this))}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(){var{emSizeStack:t}=this;return t[t.length-1]}set emSize(t){var{emSizeStack:e}=this;e.push(t)}popEmSize(){var{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){var e=this.createElement(t.documentElement);return e.root=!0,e.addStylesFromStyleDefinition(),this.documentElement=e,e}createElement(t){var e=t.nodeName.replace(/^[^:]+:/,""),i=de.elementTypes[e];return void 0!==i?new i(this,t):new st(this,t)}createTextNode(t){return new yt(this,t)}setViewBox(t){this.screen.setViewBox(function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?ce(Object(i),!0).forEach((function(e){(0,s.Z)(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ce(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}({document:this},t))}}function pe(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,r)}return i}function fe(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?pe(Object(i),!0).forEach((function(e){(0,s.Z)(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):pe(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}de.createCanvas=function(t,e){var i=document.createElement("canvas");return i.width=t,i.height=e,i},de.createImage=function(t){return ge.apply(this,arguments)},de.elementTypes=ue;class ye{constructor(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.parser=new q(i),this.screen=new Y(t,i),this.options=i;var r=new de(this,i),s=r.createDocumentElement(e);this.document=r,this.documentElement=s}static from(t,e){var i=arguments;return(0,r.Z)((function*(){var r=i.length>2&&void 0!==i[2]?i[2]:{},s=new q(r),n=yield s.parse(e);return new ye(t,n,r)}))()}static fromString(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=new q(i).parseFromString(e);return new ye(t,r,i)}fork(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return ye.from(t,e,fe(fe({},this.options),i))}forkString(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return ye.fromString(t,e,fe(fe({},this.options),i))}ready(){return this.screen.ready()}isReady(){return this.screen.isReady()}render(){var t=arguments,e=this;return(0,r.Z)((function*(){var i=t.length>0&&void 0!==t[0]?t[0]:{};e.start(fe({enableRedraw:!0,ignoreAnimation:!0,ignoreMouse:!0},i)),yield e.ready(),e.stop()}))()}start(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{documentElement:e,screen:i,options:r}=this;i.start(e,fe(fe({enableRedraw:!0},r),t))}stop(){this.screen.stop()}resize(t){var 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)}}}}]);