instrument-legacy.29c3baea.js 138 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. !function(){function t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function e(e){for(var i=1;i<arguments.length;i++){var n=null!=arguments[i]?arguments[i]:{};i%2?t(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function r(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=p(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0,n=function(){};return{s:n,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return o=t.done,t},e:function(t){s=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function n(){return n="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var i=a(t,e);if(i){var n=Object.getOwnPropertyDescriptor(i,e);return n.get?n.get.call(arguments.length<3?t:r):n.value}},n.apply(this,arguments)}function a(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=f(t)););return t}function o(t){return function(t){if(Array.isArray(t))return m(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||p(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&u(t,e)}function u(t,e){return u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},u(t,e)}function l(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,i=f(t);if(e){var n=f(this).constructor;r=Reflect.construct(i,arguments,n)}else r=i.apply(this,arguments);return h(this,r)}}function h(t,e){if(e&&("object"===w(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return c(t)}function c(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}function g(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function y(t,e,r){return e&&v(t.prototype,e),r&&v(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function d(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var i,n,a=[],o=!0,s=!1;try{for(r=r.call(t);!(o=(i=r.next()).done)&&(a.push(i.value),!e||a.length!==e);o=!0);}catch(u){s=!0,n=u}finally{try{o||null==r.return||r.return()}finally{if(s)throw n}}return a}(t,e)||p(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(t,e){if(t){if("string"==typeof t)return m(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?m(t,e):void 0}}function m(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r<e;r++)i[r]=t[r];return i}function x(t,e,r,i,n,a,o){try{var s=t[a](o),u=s.value}catch(l){return void r(l)}s.done?e(u):Promise.resolve(u).then(i,n)}function b(t){return function(){var e=this,r=arguments;return new Promise((function(i,n){var a=t.apply(e,r);function o(t){x(a,i,n,o,s,"next",t)}function s(t){x(a,i,n,o,s,"throw",t)}o(void 0)}))}}function w(t){return w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},w(t)}System.register(["./ResizeObserver.es-legacy.9ef5ac8c.js"],(function(t){"use strict";var a;return{setters:[function(t){a=t.b6}],execute:function(){var u={"Acoustic Grand Piano":"大钢琴","Bright Acoustic Piano":"明亮的钢琴","Electric Grand Piano":"电钢琴","Rhodes Piano":"柔和的电钢琴","Chorused Piano":"加合唱效果的电钢琴",Harpsichord:"羽管键琴",Clavichord:"科拉维科特琴",Celesta:"钢片琴","Music box":"八音盒",Vibraphone:"颤音琴",Marimba:"马林巴",Xylophone:"木琴","Tubular Bells":"管钟",Dulcimer:"大扬琴","Hammond Organ":"击杆风琴","Percussive Organ":"打击式风琴","Rock Organ":"摇滚风琴","Church Organ":"教堂风琴","Reed Organ":"簧管风琴",Accordian:"手风琴",Harmonica:"口琴","Tango Accordian":"探戈手风琴","Acoustic Guitar":"钢弦吉他","Electric Guitar":"闷音电吉他","Overdriven Guitar":"加驱动效果的电吉他","Distortion Guitar":"加失真效果的电吉他","Guitar Harmonics":"吉他和音","Acoustic Bass":"大贝司","Electric Bass":"电贝司","Fretless Bass":"无品贝司","Slap Bass":"掌击","Synth Bass":"电子合成",Violin:"小提琴",Viola:"中提琴",Cello:"大提琴",Contrabass:"低音大提琴","Tremolo Strings":"弦乐群颤音音色","Pizzicato Strings":"弦乐群拨弦音色","Orchestral Harp":"竖琴",Timpani:"定音鼓","String Ensemble":"弦乐合奏音色","Synth Strings":"合成弦乐合奏音色","Choir Aahs":"人声合唱","Voice Oohs":"人声","Synth Voice":"合成人声","Orchestra Hit":"管弦乐敲击齐奏",Trumpet:"小号",Trombone:"长号",Tuba:"大号","Muted Trumpet":"加弱音器小号","French Horn":"法国号","Brass Section":"铜管组","Synth Brass":"合成铜管音色","Soprano Sax":"高音萨克斯风","Alto Sax":"中音萨克斯风","Tenor Sax":"次中音萨克斯风","Baritone Sax":"低音萨克斯风",Oboe:"双簧管","English Horn":"英国管",Bassoon:"巴松",Clarinet:"单簧管",Piccolo:"短笛",Flute:"长笛",Recorder:"竖笛","Pan Flute":"排箫","Bottle Blow":"瓶木管",Whistle:"口哨声",Ocarina:"奥卡雷那",Lead:"合成主音","Lead lead":"合成主音","Pad age":"合成音色",Pad:"合成音色",FX:"合成效果 科幻",Sitar:"西塔尔",Banjo:"班卓琴",Shamisen:"三昧线",Koto:"十三弦筝",Kalimba:"卡林巴",Bagpipe:"风笛",Fiddle:"民族提琴",Shanai:"山奈","Tinkle Bell":"叮当铃",Agogo:"阿哥哥铃","Steel Drums":"钢鼓","Taiko Drum":"太鼓","Melodic Tom":"通通鼓","Synth Drum":"合成鼓","Reverse Cymbal":"铜钹","Guitar Fret Noise":"吉他换把杂音","Breath Noise":"呼吸声",Seashore:"海浪声","Bird Tweet":"鸟鸣","Telephone Ring":"电话铃",Helicopter:"直升机",Applause:"鼓掌声",Gunshot:"枪声","Acoustic Bass Drum":"大鼓","Bass Drum":"大鼓","Side Stick":"小鼓鼓边","Acoustic Snare":"小鼓","Hand Clap":"拍手","Electric Snare":"小鼓","Low Floor Tom":"低音鼓","Closed Hi-Hat":"闭合钹","High Floor Tom":"低音鼓","Pedal Hi-Hat":"脚踏钹","Low Tom":"中音鼓","Open Hi-Hat":"强音钹","Low-Mid Tom":"中音鼓","Hi Mid Tom":"高音鼓","Crash Cymbal":"强音钹","High Tom":"高音鼓","Ride Cymbal":"打点钹","Chinese Cymbal":"钹","Ride Bell":"圆铃",Tambourine:"铃鼓","Splash Cymbal":"小钹铜钹",Cowbell:"牛铃","Vibra-Slap":"颤音器","Hi Bongo":"高音邦加鼓","Low Bongo":"低音邦加鼓","Mute Hi Conga":"弱音高音康加鼓","Open Hi Conga":"强音高音康加鼓","Low Conga":"低音康加鼓","High Timbale":"高音天巴鼓","Low Timbale":"低音天巴鼓","High Agogo":"高音阿哥哥","Low Agogo":"低音阿哥哥",Cabasa:"串珠",Maracas:"沙铃","Short Whistle":"短口哨","Long Whistle":"长口哨","Short Guiro":"短刮壶","Long Guiro":"长刮壶",Claves:"梆子","Hi Wood Block":"高音木块","Low Wood Block":"低音木块","Mute Triangle":"弱音三角铁","Open Triangle":"强音三角铁","Hulusi flute":"葫芦丝",Melodica:"口风琴","Snare Drum":"小军鼓",Cymbal:"镲",Cymbals:"镲","Horn in F":"圆号",Triangle:"三角铁",Vibrato:"颤音琴","Suspend Cymbal":"吊镲","Tom-Toms":"嗵嗵鼓",Bell:"铃铛",Bells:"铃铛","Alto Clarinet":"中音单簧管","Soprano Saxophone":"高音萨克斯风","Alto Saxophone":"中音萨克斯风","Tenor Saxophone":"次中音萨克斯风","Baritone Saxophone":"低音萨克斯风",Cornet:"短号",Euphonium:"上低音号","crash cymbals":"对镲","Suspend cymbals":"吊镲",Castanets:"响板"},v=(t("g",(function(t){for(var e=t.replace(/ /g," ").toLocaleLowerCase(),r=Object.keys(u),i=0;i<r.length;i++){if(r[i].replace(/ /g," ").toLocaleLowerCase()===e)return u[r[i]]||""}for(var n=0;n<r.length;n++){var a=r[n].replace(/ /g," ").toLocaleLowerCase();if(e.includes(a))return u[r[n]]||""}return""})),{exports:{}}),p={exports:{}};(function(){var t,e,r,i,n,a;"undefined"!=typeof performance&&null!==performance&&performance.now?p.exports=function(){return performance.now()}:"undefined"!=typeof process&&null!==process&&process.hrtime?(p.exports=function(){return(t()-n)/1e6},e=process.hrtime,i=(t=function(){var t;return 1e9*(t=e())[0]+t[1]})(),a=1e9*process.uptime(),n=i-a):Date.now?(p.exports=function(){return Date.now()-r},r=Date.now()):(p.exports=function(){return(new Date).getTime()-r},r=(new Date).getTime())}).call(a);for(var m=p.exports,x="undefined"==typeof window?a:window,S=["moz","webkit"],k="AnimationFrame",T=x["request"+k],A=x["cancel"+k]||x["cancelRequest"+k],C=0;!T&&C<S.length;C++)T=x[S[C]+"Request"+k],A=x[S[C]+"Cancel"+k]||x[S[C]+"CancelRequest"+k];if(!T||!A){var O=0,P=0,E=[];T=function(t){if(0===E.length){var e=m(),r=Math.max(0,16.666666666666668-(e-O));O=r+e,setTimeout((function(){var t=E.slice(0);E.length=0;for(var e=0;e<t.length;e++)if(!t[e].cancelled)try{t[e].callback(O)}catch(r){setTimeout((function(){throw r}),0)}}),Math.round(r))}return E.push({handle:++P,callback:t,cancelled:!1}),P},A=function(t){for(var e=0;e<E.length;e++)E[e].handle===t&&(E[e].cancelled=!0)}}v.exports=function(t){return T.call(x,t)},v.exports.cancel=function(){A.apply(x,arguments)},v.exports.polyfill=function(t){t||(t=x),t.requestAnimationFrame=T,t.cancelAnimationFrame=A};var N=v.exports,M=function(t){this.ok=!1,this.alpha=1,"#"==t.charAt(0)&&(t=t.substr(1,6)),t=(t=t.replace(/ /g,"")).toLowerCase();var e={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};t=e[t]||t;for(var r=[{re:/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*((?:\d?\.)?\d)\)$/,example:["rgba(123, 234, 45, 0.8)","rgba(255,234,245,1.0)"],process:function(t){return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3]),parseFloat(t[4])]}},{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(t){return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]}},{re:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,example:["#00ff00","336699"],process:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,example:["#fb0","f0f"],process:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}}],i=0;i<r.length;i++){var n=r[i].re,a=r[i].process,o=n.exec(t);if(o){var s=a(o);this.r=s[0],this.g=s[1],this.b=s[2],s.length>3&&(this.alpha=s[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),r=this.b.toString(16);return 1==t.length&&(t="0"+t),1==e.length&&(e="0"+e),1==r.length&&(r="0"+r),"#"+t+e+r},this.getHelpXML=function(){for(var t=new Array,i=0;i<r.length;i++)for(var n=r[i].example,a=0;a<n.length;a++)t[t.length]=n[a];for(var o in e)t[t.length]=o;var s=document.createElement("ul");s.setAttribute("id","rgbcolor-examples");for(i=0;i<t.length;i++)try{var u=document.createElement("li"),l=new RGBColor(t[i]),h=document.createElement("div");h.style.cssText="margin: 3px; border: 1px solid black; background:"+l.toHex()+"; color:"+l.toHex(),h.appendChild(document.createTextNode("test"));var c=document.createTextNode(" "+t[i]+" -> "+l.toRGB()+" -> "+l.toHex());u.appendChild(h),u.appendChild(c),s.appendChild(u)}catch(f){}return s}},V=function(t,e){return(V=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)};function _(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}V(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function R(t,e){var r=t[0],i=t[1];return[r*Math.cos(e)-i*Math.sin(e),r*Math.sin(e)+i*Math.cos(e)]}function I(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var r=0;r<t.length;r++)if("number"!=typeof t[r])throw new Error("assertNumbers arguments["+r+"] is not a number. "+w(t[r])+" == typeof "+t[r]);return!0}var L=Math.PI;function B(t,e,r){t.lArcFlag=0===t.lArcFlag?0:1,t.sweepFlag=0===t.sweepFlag?0:1;var i=t.rX,n=t.rY,a=t.x,o=t.y;i=Math.abs(t.rX),n=Math.abs(t.rY);var s=R([(e-a)/2,(r-o)/2],-t.xRot/180*L),u=s[0],l=s[1],h=Math.pow(u,2)/Math.pow(i,2)+Math.pow(l,2)/Math.pow(n,2);1<h&&(i*=Math.sqrt(h),n*=Math.sqrt(h)),t.rX=i,t.rY=n;var c=Math.pow(i,2)*Math.pow(l,2)+Math.pow(n,2)*Math.pow(u,2),f=(t.lArcFlag!==t.sweepFlag?1:-1)*Math.sqrt(Math.max(0,(Math.pow(i,2)*Math.pow(n,2)-c)/c)),g=i*l/n*f,v=-n*u/i*f,y=R([g,v],t.xRot/180*L);t.cX=y[0]+(e+a)/2,t.cY=y[1]+(r+o)/2,t.phi1=Math.atan2((l-v)/n,(u-g)/i),t.phi2=Math.atan2((-l-v)/n,(-u-g)/i),0===t.sweepFlag&&t.phi2>t.phi1&&(t.phi2-=2*L),1===t.sweepFlag&&t.phi2<t.phi1&&(t.phi2+=2*L),t.phi1*=180/L,t.phi2*=180/L}function D(t,e,r){I(t,e,r);var i=t*t+e*e-r*r;if(0>i)return[];if(0===i)return[[t*r/(t*t+e*e),e*r/(t*t+e*e)]];var n=Math.sqrt(i);return[[(t*r+e*n)/(t*t+e*e),(e*r-t*n)/(t*t+e*e)],[(t*r-e*n)/(t*t+e*e),(e*r+t*n)/(t*t+e*e)]]}var H,z=Math.PI/180;function F(t,e,r){return(1-r)*t+r*e}function U(t,e,r,i){return t+Math.cos(i/180*L)*e+Math.sin(i/180*L)*r}function X(t,e,r,i){var n=1e-6,a=e-t,o=r-e,s=3*a+3*(i-r)-6*o,u=6*(o-a),l=3*a;return Math.abs(s)<n?[-l/u]:function(t,e,r){void 0===r&&(r=1e-6);var i=t*t/4-e;if(i<-r)return[];if(i<=r)return[-t/2];var n=Math.sqrt(i);return[-t/2-n,-t/2+n]}(u/s,l/s,n)}function Y(t,e,r,i,n){var a=1-n;return t*(a*a*a)+e*(3*a*a*n)+r*(3*a*n*n)+i*(n*n*n)}!function(t){function e(){return n((function(t,e,r){return t.relative&&(void 0!==t.x1&&(t.x1+=e),void 0!==t.y1&&(t.y1+=r),void 0!==t.x2&&(t.x2+=e),void 0!==t.y2&&(t.y2+=r),void 0!==t.x&&(t.x+=e),void 0!==t.y&&(t.y+=r),t.relative=!1),t}))}function r(){var t=NaN,e=NaN,r=NaN,i=NaN;return n((function(n,a,o){return n.type&$.SMOOTH_CURVE_TO&&(n.type=$.CURVE_TO,t=isNaN(t)?a:t,e=isNaN(e)?o:e,n.x1=n.relative?a-t:2*a-t,n.y1=n.relative?o-e:2*o-e),n.type&$.CURVE_TO?(t=n.relative?a+n.x2:n.x2,e=n.relative?o+n.y2:n.y2):(t=NaN,e=NaN),n.type&$.SMOOTH_QUAD_TO&&(n.type=$.QUAD_TO,r=isNaN(r)?a:r,i=isNaN(i)?o:i,n.x1=n.relative?a-r:2*a-r,n.y1=n.relative?o-i:2*o-i),n.type&$.QUAD_TO?(r=n.relative?a+n.x1:n.x1,i=n.relative?o+n.y1:n.y1):(r=NaN,i=NaN),n}))}function i(){var t=NaN,e=NaN;return n((function(r,i,n){if(r.type&$.SMOOTH_QUAD_TO&&(r.type=$.QUAD_TO,t=isNaN(t)?i:t,e=isNaN(e)?n:e,r.x1=r.relative?i-t:2*i-t,r.y1=r.relative?n-e:2*n-e),r.type&$.QUAD_TO){t=r.relative?i+r.x1:r.x1,e=r.relative?n+r.y1:r.y1;var a=r.x1,o=r.y1;r.type=$.CURVE_TO,r.x1=((r.relative?0:i)+2*a)/3,r.y1=((r.relative?0:n)+2*o)/3,r.x2=(r.x+2*a)/3,r.y2=(r.y+2*o)/3}else t=NaN,e=NaN;return r}))}function n(t){var e=0,r=0,i=NaN,n=NaN;return function(a){if(isNaN(i)&&!(a.type&$.MOVE_TO))throw new Error("path must start with moveto");var o=t(a,e,r,i,n);return a.type&$.CLOSE_PATH&&(e=i,r=n),void 0!==a.x&&(e=a.relative?e+a.x:a.x),void 0!==a.y&&(r=a.relative?r+a.y:a.y),a.type&$.MOVE_TO&&(i=e,n=r),o}}function a(t,e,r,i,a,o){return I(t,e,r,i,a,o),n((function(n,s,u,l){var h=n.x1,c=n.x2,f=n.relative&&!isNaN(l),g=void 0!==n.x?n.x:f?0:s,v=void 0!==n.y?n.y:f?0:u;function y(t){return t*t}n.type&$.HORIZ_LINE_TO&&0!==e&&(n.type=$.LINE_TO,n.y=n.relative?0:u),n.type&$.VERT_LINE_TO&&0!==r&&(n.type=$.LINE_TO,n.x=n.relative?0:s),void 0!==n.x&&(n.x=n.x*t+v*r+(f?0:a)),void 0!==n.y&&(n.y=g*e+n.y*i+(f?0:o)),void 0!==n.x1&&(n.x1=n.x1*t+n.y1*r+(f?0:a)),void 0!==n.y1&&(n.y1=h*e+n.y1*i+(f?0:o)),void 0!==n.x2&&(n.x2=n.x2*t+n.y2*r+(f?0:a)),void 0!==n.y2&&(n.y2=c*e+n.y2*i+(f?0:o));var d=t*i-e*r;if(void 0!==n.xRot&&(1!==t||0!==e||0!==r||1!==i))if(0===d)delete n.rX,delete n.rY,delete n.xRot,delete n.lArcFlag,delete n.sweepFlag,n.type=$.LINE_TO;else{var p=n.xRot*Math.PI/180,m=Math.sin(p),x=Math.cos(p),b=1/y(n.rX),w=1/y(n.rY),S=y(x)*b+y(m)*w,k=2*m*x*(b-w),T=y(m)*b+y(x)*w,A=S*i*i-k*e*i+T*e*e,C=k*(t*i+e*r)-2*(S*r*i+T*t*e),O=S*r*r-k*t*r+T*t*t,P=(Math.atan2(C,A-O)+Math.PI)%Math.PI/2,E=Math.sin(P),N=Math.cos(P);n.rX=Math.abs(d)/Math.sqrt(A*y(N)+C*E*N+O*y(E)),n.rY=Math.abs(d)/Math.sqrt(A*y(E)-C*E*N+O*y(N)),n.xRot=180*P/Math.PI}return void 0!==n.sweepFlag&&0>d&&(n.sweepFlag=+!n.sweepFlag),n}))}t.ROUND=function(t){function e(e){return Math.round(e*t)/t}return void 0===t&&(t=1e13),I(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 n((function(t,e,r){return t.relative||(void 0!==t.x1&&(t.x1-=e),void 0!==t.y1&&(t.y1-=r),void 0!==t.x2&&(t.x2-=e),void 0!==t.y2&&(t.y2-=r),void 0!==t.x&&(t.x-=e),void 0!==t.y&&(t.y-=r),t.relative=!0),t}))},t.NORMALIZE_HVZ=function(t,e,r){return void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===r&&(r=!0),n((function(i,n,a,o,s){if(isNaN(o)&&!(i.type&$.MOVE_TO))throw new Error("path must start with moveto");return e&&i.type&$.HORIZ_LINE_TO&&(i.type=$.LINE_TO,i.y=i.relative?0:a),r&&i.type&$.VERT_LINE_TO&&(i.type=$.LINE_TO,i.x=i.relative?0:n),t&&i.type&$.CLOSE_PATH&&(i.type=$.LINE_TO,i.x=i.relative?o-n:o,i.y=i.relative?s-a:s),i.type&$.ARC&&(0===i.rX||0===i.rY)&&(i.type=$.LINE_TO,delete i.rX,delete i.rY,delete i.xRot,delete i.lArcFlag,delete i.sweepFlag),i}))},t.NORMALIZE_ST=r,t.QT_TO_C=i,t.INFO=n,t.SANITIZE=function(t){void 0===t&&(t=0),I(t);var e=NaN,r=NaN,i=NaN,a=NaN;return n((function(n,o,s,u,l){var h=Math.abs,c=!1,f=0,g=0;if(n.type&$.SMOOTH_CURVE_TO&&(f=isNaN(e)?0:o-e,g=isNaN(r)?0:s-r),n.type&($.CURVE_TO|$.SMOOTH_CURVE_TO)?(e=n.relative?o+n.x2:n.x2,r=n.relative?s+n.y2:n.y2):(e=NaN,r=NaN),n.type&$.SMOOTH_QUAD_TO?(i=isNaN(i)?o:2*o-i,a=isNaN(a)?s:2*s-a):n.type&$.QUAD_TO?(i=n.relative?o+n.x1:n.x1,a=n.relative?s+n.y1:n.y2):(i=NaN,a=NaN),n.type&$.LINE_COMMANDS||n.type&$.ARC&&(0===n.rX||0===n.rY||!n.lArcFlag)||n.type&$.CURVE_TO||n.type&$.SMOOTH_CURVE_TO||n.type&$.QUAD_TO||n.type&$.SMOOTH_QUAD_TO){var v=void 0===n.x?0:n.relative?n.x:n.x-o,y=void 0===n.y?0:n.relative?n.y:n.y-s;f=isNaN(i)?void 0===n.x1?f:n.relative?n.x:n.x1-o:i-o,g=isNaN(a)?void 0===n.y1?g:n.relative?n.y:n.y1-s:a-s;var d=void 0===n.x2?0:n.relative?n.x:n.x2-o,p=void 0===n.y2?0:n.relative?n.y:n.y2-s;h(v)<=t&&h(y)<=t&&h(f)<=t&&h(g)<=t&&h(d)<=t&&h(p)<=t&&(c=!0)}return n.type&$.CLOSE_PATH&&h(o-u)<=t&&h(s-l)<=t&&(c=!0),c?[]:n}))},t.MATRIX=a,t.ROTATE=function(t,e,r){void 0===e&&(e=0),void 0===r&&(r=0),I(t,e,r);var i=Math.sin(t),n=Math.cos(t);return a(n,i,-i,n,e-e*n+r*i,r-e*i-r*n)},t.TRANSLATE=function(t,e){return void 0===e&&(e=0),I(t,e),a(1,0,0,1,t,e)},t.SCALE=function(t,e){return void 0===e&&(e=t),I(t,e),a(t,0,0,e,0,0)},t.SKEW_X=function(t){return I(t),a(1,0,Math.atan(t),1,0,0)},t.SKEW_Y=function(t){return I(t),a(1,Math.atan(t),0,1,0,0)},t.X_AXIS_SYMMETRY=function(t){return void 0===t&&(t=0),I(t),a(-1,0,0,1,t,0)},t.Y_AXIS_SYMMETRY=function(t){return void 0===t&&(t=0),I(t),a(1,0,0,-1,0,t)},t.A_TO_C=function(){return n((function(t,e,r){return $.ARC===t.type?function(t,e,r){var i,n,a,o;t.cX||B(t,e,r);for(var s=Math.min(t.phi1,t.phi2),u=Math.max(t.phi1,t.phi2)-s,l=Math.ceil(u/90),h=new Array(l),c=e,f=r,g=0;g<l;g++){var v=F(t.phi1,t.phi2,g/l),y=F(t.phi1,t.phi2,(g+1)/l),d=y-v,p=4/3*Math.tan(d*z/4),m=[Math.cos(v*z)-p*Math.sin(v*z),Math.sin(v*z)+p*Math.cos(v*z)],x=m[0],b=m[1],w=[Math.cos(y*z),Math.sin(y*z)],S=w[0],k=w[1],T=[S+p*Math.sin(y*z),k-p*Math.cos(y*z)],A=T[0],C=T[1];h[g]={relative:t.relative,type:$.CURVE_TO};var O=function(e,r){var i=R([e*t.rX,r*t.rY],t.xRot),n=i[0],a=i[1];return[t.cX+n,t.cY+a]};i=O(x,b),h[g].x1=i[0],h[g].y1=i[1],n=O(A,C),h[g].x2=n[0],h[g].y2=n[1],a=O(S,k),h[g].x=a[0],h[g].y=a[1],t.relative&&(h[g].x1-=c,h[g].y1-=f,h[g].x2-=c,h[g].y2-=f,h[g].x-=c,h[g].y-=f),c=(o=[h[g].x,h[g].y])[0],f=o[1]}return h}(t,t.relative?0:e,t.relative?0:r):t}))},t.ANNOTATE_ARCS=function(){return n((function(t,e,r){return t.relative&&(e=0,r=0),$.ARC===t.type&&B(t,e,r),t}))},t.CLONE=function(){return function(t){var e={};for(var r in t)e[r]=t[r];return e}},t.CALCULATE_BOUNDS=function(){var t=e(),a=i(),o=r(),s=n((function(e,r,i){var n=o(a(t(function(t){var e={};for(var r in t)e[r]=t[r];return e}(e))));function u(t){t>s.maxX&&(s.maxX=t),t<s.minX&&(s.minX=t)}function l(t){t>s.maxY&&(s.maxY=t),t<s.minY&&(s.minY=t)}if(n.type&$.DRAWING_COMMANDS&&(u(r),l(i)),n.type&$.HORIZ_LINE_TO&&u(n.x),n.type&$.VERT_LINE_TO&&l(n.y),n.type&$.LINE_TO&&(u(n.x),l(n.y)),n.type&$.CURVE_TO){u(n.x),l(n.y);for(var h=0,c=X(r,n.x1,n.x2,n.x);h<c.length;h++)0<(O=c[h])&&1>O&&u(Y(r,n.x1,n.x2,n.x,O));for(var f=0,g=X(i,n.y1,n.y2,n.y);f<g.length;f++)0<(O=g[f])&&1>O&&l(Y(i,n.y1,n.y2,n.y,O))}if(n.type&$.ARC){u(n.x),l(n.y),B(n,r,i);for(var v=n.xRot/180*Math.PI,y=Math.cos(v)*n.rX,d=Math.sin(v)*n.rX,p=-Math.sin(v)*n.rY,m=Math.cos(v)*n.rY,x=n.phi1<n.phi2?[n.phi1,n.phi2]:-180>n.phi2?[n.phi2+360,n.phi1+360]:[n.phi2,n.phi1],b=x[0],w=x[1],S=function(t){var e=t[0],r=t[1],i=180*Math.atan2(r,e)/Math.PI;return i<b?i+360:i},k=0,T=D(p,-y,0).map(S);k<T.length;k++)(O=T[k])>b&&O<w&&u(U(n.cX,y,p,O));for(var A=0,C=D(m,-d,0).map(S);A<C.length;A++){var O;(O=C[A])>b&&O<w&&l(U(n.cY,d,m,O))}}return e}));return s.minX=1/0,s.maxX=-1/0,s.minY=1/0,s.maxY=-1/0,s}}(H||(H={}));var q,j=function(){function t(){}return t.prototype.round=function(t){return this.transform(H.ROUND(t))},t.prototype.toAbs=function(){return this.transform(H.TO_ABS())},t.prototype.toRel=function(){return this.transform(H.TO_REL())},t.prototype.normalizeHVZ=function(t,e,r){return this.transform(H.NORMALIZE_HVZ(t,e,r))},t.prototype.normalizeST=function(){return this.transform(H.NORMALIZE_ST())},t.prototype.qtToC=function(){return this.transform(H.QT_TO_C())},t.prototype.aToC=function(){return this.transform(H.A_TO_C())},t.prototype.sanitize=function(t){return this.transform(H.SANITIZE(t))},t.prototype.translate=function(t,e){return this.transform(H.TRANSLATE(t,e))},t.prototype.scale=function(t,e){return this.transform(H.SCALE(t,e))},t.prototype.rotate=function(t,e,r){return this.transform(H.ROTATE(t,e,r))},t.prototype.matrix=function(t,e,r,i,n,a){return this.transform(H.MATRIX(t,e,r,i,n,a))},t.prototype.skewX=function(t){return this.transform(H.SKEW_X(t))},t.prototype.skewY=function(t){return this.transform(H.SKEW_Y(t))},t.prototype.xSymmetry=function(t){return this.transform(H.X_AXIS_SYMMETRY(t))},t.prototype.ySymmetry=function(t){return this.transform(H.Y_AXIS_SYMMETRY(t))},t.prototype.annotateArcs=function(){return this.transform(H.ANNOTATE_ARCS())},t}(),W=function(t){return" "===t||"\t"===t||"\r"===t||"\n"===t},Q=function(t){return"0".charCodeAt(0)<=t.charCodeAt(0)&&t.charCodeAt(0)<="9".charCodeAt(0)},G=function(t){function e(){var e=t.call(this)||this;return e.curNumber="",e.curCommandType=-1,e.curCommandRelative=!1,e.canParseCommandOrComma=!0,e.curNumberHasExp=!1,e.curNumberHasExpDigits=!1,e.curNumberHasDecimal=!1,e.curArgs=[],e}return _(e,t),e.prototype.finish=function(t){if(void 0===t&&(t=[]),this.parse(" ",t),0!==this.curArgs.length||!this.canParseCommandOrComma)throw new SyntaxError("Unterminated command at the path end.");return t},e.prototype.parse=function(t,e){var r=this;void 0===e&&(e=[]);for(var i=function(t){e.push(t),r.curArgs.length=0,r.canParseCommandOrComma=!0},n=0;n<t.length;n++){var a=t[n],o=!(this.curCommandType!==$.ARC||3!==this.curArgs.length&&4!==this.curArgs.length||1!==this.curNumber.length||"0"!==this.curNumber&&"1"!==this.curNumber),s=Q(a)&&("0"===this.curNumber&&"0"===a||o);if(!Q(a)||s)if("e"!==a&&"E"!==a)if("-"!==a&&"+"!==a||!this.curNumberHasExp||this.curNumberHasExpDigits)if("."!==a||this.curNumberHasExp||this.curNumberHasDecimal||o){if(this.curNumber&&-1!==this.curCommandType){var u=Number(this.curNumber);if(isNaN(u))throw new SyntaxError("Invalid number ending at "+n);if(this.curCommandType===$.ARC)if(0===this.curArgs.length||1===this.curArgs.length){if(0>u)throw new SyntaxError('Expected positive number, got "'+u+'" at index "'+n+'"')}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 "'+n+'"');this.curArgs.push(u),this.curArgs.length===Z[this.curCommandType]&&($.HORIZ_LINE_TO===this.curCommandType?i({type:$.HORIZ_LINE_TO,relative:this.curCommandRelative,x:u}):$.VERT_LINE_TO===this.curCommandType?i({type:$.VERT_LINE_TO,relative:this.curCommandRelative,y:u}):this.curCommandType===$.MOVE_TO||this.curCommandType===$.LINE_TO||this.curCommandType===$.SMOOTH_QUAD_TO?(i({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?i({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?i({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?i({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&&i({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(a))if(","===a&&this.canParseCommandOrComma)this.canParseCommandOrComma=!1;else if("+"!==a&&"-"!==a&&"."!==a)if(s)this.curNumber=a,this.curNumberHasDecimal=!1;else{if(0!==this.curArgs.length)throw new SyntaxError("Unterminated command at index "+n+".");if(!this.canParseCommandOrComma)throw new SyntaxError('Unexpected character "'+a+'" at index '+n+". Command cannot follow comma");if(this.canParseCommandOrComma=!1,"z"!==a&&"Z"!==a)if("h"===a||"H"===a)this.curCommandType=$.HORIZ_LINE_TO,this.curCommandRelative="h"===a;else if("v"===a||"V"===a)this.curCommandType=$.VERT_LINE_TO,this.curCommandRelative="v"===a;else if("m"===a||"M"===a)this.curCommandType=$.MOVE_TO,this.curCommandRelative="m"===a;else if("l"===a||"L"===a)this.curCommandType=$.LINE_TO,this.curCommandRelative="l"===a;else if("c"===a||"C"===a)this.curCommandType=$.CURVE_TO,this.curCommandRelative="c"===a;else if("s"===a||"S"===a)this.curCommandType=$.SMOOTH_CURVE_TO,this.curCommandRelative="s"===a;else if("q"===a||"Q"===a)this.curCommandType=$.QUAD_TO,this.curCommandRelative="q"===a;else if("t"===a||"T"===a)this.curCommandType=$.SMOOTH_QUAD_TO,this.curCommandRelative="t"===a;else{if("a"!==a&&"A"!==a)throw new SyntaxError('Unexpected character "'+a+'" at index '+n+".");this.curCommandType=$.ARC,this.curCommandRelative="a"===a}else e.push({type:$.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1}else this.curNumber=a,this.curNumberHasDecimal="."===a}else this.curNumber+=a,this.curNumberHasDecimal=!0;else this.curNumber+=a;else this.curNumber+=a,this.curNumberHasExp=!0;else this.curNumber+=a,this.curNumberHasExpDigits=this.curNumberHasExp}return e},e.prototype.transform=function(t){return Object.create(this,{parse:{value:function(e,r){void 0===r&&(r=[]);for(var i=0,n=Object.getPrototypeOf(this).parse.call(this,e);i<n.length;i++){var a=n[i],o=t(a);Array.isArray(o)?r.push.apply(r,o):r.push(o)}return r}}})},e}(j),$=function(t){function e(r){var i=t.call(this)||this;return i.commands="string"==typeof r?e.parse(r):r,i}return _(e,t),e.prototype.encode=function(){return e.encode(this.commands)},e.prototype.getBounds=function(){var t=H.CALCULATE_BOUNDS();return this.transform(t),t},e.prototype.transform=function(t){for(var e=[],r=0,i=this.commands;r<i.length;r++){var n=t(i[r]);Array.isArray(n)?e.push.apply(e,n):e.push(n)}return this.commands=e,this},e.encode=function(t){return function(t){var e="";Array.isArray(t)||(t=[t]);for(var r=0;r<t.length;r++){var i=t[r];if(i.type===$.CLOSE_PATH)e+="z";else if(i.type===$.HORIZ_LINE_TO)e+=(i.relative?"h":"H")+i.x;else if(i.type===$.VERT_LINE_TO)e+=(i.relative?"v":"V")+i.y;else if(i.type===$.MOVE_TO)e+=(i.relative?"m":"M")+i.x+" "+i.y;else if(i.type===$.LINE_TO)e+=(i.relative?"l":"L")+i.x+" "+i.y;else if(i.type===$.CURVE_TO)e+=(i.relative?"c":"C")+i.x1+" "+i.y1+" "+i.x2+" "+i.y2+" "+i.x+" "+i.y;else if(i.type===$.SMOOTH_CURVE_TO)e+=(i.relative?"s":"S")+i.x2+" "+i.y2+" "+i.x+" "+i.y;else if(i.type===$.QUAD_TO)e+=(i.relative?"q":"Q")+i.x1+" "+i.y1+" "+i.x+" "+i.y;else if(i.type===$.SMOOTH_QUAD_TO)e+=(i.relative?"t":"T")+i.x+" "+i.y;else{if(i.type!==$.ARC)throw new Error('Unexpected command type "'+i.type+'" at index '+r+".");e+=(i.relative?"a":"A")+i.rX+" "+i.rY+" "+i.xRot+" "+ +i.lArcFlag+" "+ +i.sweepFlag+" "+i.x+" "+i.y}}return e}(t)},e.parse=function(t){var e=new G,r=[];return e.parse(t,r),e.finish(r),r},e.CLOSE_PATH=1,e.MOVE_TO=2,e.HORIZ_LINE_TO=4,e.VERT_LINE_TO=8,e.LINE_TO=16,e.CURVE_TO=32,e.SMOOTH_CURVE_TO=64,e.QUAD_TO=128,e.SMOOTH_QUAD_TO=256,e.ARC=512,e.LINE_COMMANDS=e.LINE_TO|e.HORIZ_LINE_TO|e.VERT_LINE_TO,e.DRAWING_COMMANDS=e.HORIZ_LINE_TO|e.VERT_LINE_TO|e.LINE_TO|e.CURVE_TO|e.SMOOTH_CURVE_TO|e.QUAD_TO|e.SMOOTH_QUAD_TO|e.ARC,e}(j),Z=((q={})[$.MOVE_TO]=2,q[$.LINE_TO]=2,q[$.HORIZ_LINE_TO]=1,q[$.VERT_LINE_TO]=1,q[$.CLOSE_PATH]=0,q[$.QUAD_TO]=4,q[$.SMOOTH_QUAD_TO]=2,q[$.CURVE_TO]=6,q[$.SMOOTH_CURVE_TO]=4,q[$.ARC]=7,q);function K(t){return K="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},K(t)}
  2. /**
  3. * StackBlur - a fast almost Gaussian Blur For Canvas
  4. *
  5. * In case you find this class useful - especially in commercial projects -
  6. * I am not totally unhappy for a small donation to my PayPal account
  7. * mario@quasimondo.de
  8. *
  9. * Or support me on flattr:
  10. * {@link https://flattr.com/thing/72791/StackBlur-a-fast-almost-Gaussian-Blur-Effect-for-CanvasJavascript}.
  11. *
  12. * @module StackBlur
  13. * @author Mario Klingemann
  14. * Contact: mario@quasimondo.com
  15. * Website: {@link http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html}
  16. * Twitter: @quasimondo
  17. *
  18. * @copyright (c) 2010 Mario Klingemann
  19. *
  20. * Permission is hereby granted, free of charge, to any person
  21. * obtaining a copy of this software and associated documentation
  22. * files (the "Software"), to deal in the Software without
  23. * restriction, including without limitation the rights to use,
  24. * copy, modify, merge, publish, distribute, sublicense, and/or sell
  25. * copies of the Software, and to permit persons to whom the
  26. * Software is furnished to do so, subject to the following
  27. * conditions:
  28. *
  29. * The above copyright notice and this permission notice shall be
  30. * included in all copies or substantial portions of the Software.
  31. *
  32. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  33. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  34. * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  35. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  36. * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  37. * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  38. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  39. * OTHER DEALINGS IN THE SOFTWARE.
  40. */
  41. var J=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],tt=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function et(t,e,r,i,n,a){if(!(isNaN(a)||a<1)){a|=0;var o=function(t,e,r,i,n){if("string"==typeof t&&(t=document.getElementById(t)),!t||"object"!==K(t)||!("getContext"in t))throw new TypeError("Expecting canvas with `getContext` method in processCanvasRGB(A) calls!");var a=t.getContext("2d");try{return a.getImageData(e,r,i,n)}catch(o){throw new Error("unable to access image data: "+o)}}(t,e,r,i,n);o=function(t,e,r,i,n,a){for(var o,s=t.data,u=2*a+1,l=i-1,h=n-1,c=a+1,f=c*(c+1)/2,g=new rt,v=g,y=1;y<u;y++)v=v.next=new rt,y===c&&(o=v);v.next=g;for(var d=null,p=null,m=0,x=0,b=J[a],w=tt[a],S=0;S<n;S++){v=g;for(var k=s[x],T=s[x+1],A=s[x+2],C=s[x+3],O=0;O<c;O++)v.r=k,v.g=T,v.b=A,v.a=C,v=v.next;for(var P=0,E=0,N=0,M=0,V=c*k,_=c*T,R=c*A,I=c*C,L=f*k,B=f*T,D=f*A,H=f*C,z=1;z<c;z++){var F=x+((l<z?l:z)<<2),U=s[F],X=s[F+1],Y=s[F+2],q=s[F+3],j=c-z;L+=(v.r=U)*j,B+=(v.g=X)*j,D+=(v.b=Y)*j,H+=(v.a=q)*j,P+=U,E+=X,N+=Y,M+=q,v=v.next}d=g,p=o;for(var W=0;W<i;W++){var Q=H*b>>w;if(s[x+3]=Q,0!==Q){var G=255/Q;s[x]=(L*b>>w)*G,s[x+1]=(B*b>>w)*G,s[x+2]=(D*b>>w)*G}else s[x]=s[x+1]=s[x+2]=0;L-=V,B-=_,D-=R,H-=I,V-=d.r,_-=d.g,R-=d.b,I-=d.a;var $=W+a+1;$=m+($<l?$:l)<<2,L+=P+=d.r=s[$],B+=E+=d.g=s[$+1],D+=N+=d.b=s[$+2],H+=M+=d.a=s[$+3],d=d.next;var Z=p,K=Z.r,et=Z.g,it=Z.b,nt=Z.a;V+=K,_+=et,R+=it,I+=nt,P-=K,E-=et,N-=it,M-=nt,p=p.next,x+=4}m+=i}for(var at=0;at<i;at++){var ot=s[x=at<<2],st=s[x+1],ut=s[x+2],lt=s[x+3],ht=c*ot,ct=c*st,ft=c*ut,gt=c*lt,vt=f*ot,yt=f*st,dt=f*ut,pt=f*lt;v=g;for(var mt=0;mt<c;mt++)v.r=ot,v.g=st,v.b=ut,v.a=lt,v=v.next;for(var xt=i,bt=0,wt=0,St=0,kt=0,Tt=1;Tt<=a;Tt++){x=xt+at<<2;var At=c-Tt;vt+=(v.r=ot=s[x])*At,yt+=(v.g=st=s[x+1])*At,dt+=(v.b=ut=s[x+2])*At,pt+=(v.a=lt=s[x+3])*At,kt+=ot,bt+=st,wt+=ut,St+=lt,v=v.next,Tt<h&&(xt+=i)}x=at,d=g,p=o;for(var Ct=0;Ct<n;Ct++){var Ot=x<<2;s[Ot+3]=lt=pt*b>>w,lt>0?(lt=255/lt,s[Ot]=(vt*b>>w)*lt,s[Ot+1]=(yt*b>>w)*lt,s[Ot+2]=(dt*b>>w)*lt):s[Ot]=s[Ot+1]=s[Ot+2]=0,vt-=ht,yt-=ct,dt-=ft,pt-=gt,ht-=d.r,ct-=d.g,ft-=d.b,gt-=d.a,Ot=at+((Ot=Ct+c)<h?Ot:h)*i<<2,vt+=kt+=d.r=s[Ot],yt+=bt+=d.g=s[Ot+1],dt+=wt+=d.b=s[Ot+2],pt+=St+=d.a=s[Ot+3],d=d.next,ht+=ot=p.r,ct+=st=p.g,ft+=ut=p.b,gt+=lt=p.a,kt-=ot,bt-=st,wt-=ut,St-=lt,p=p.next,x+=i}}return t}(o,0,0,i,n,a),t.getContext("2d").putImageData(o,e,r)}}var rt=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.r=0,this.g=0,this.b=0,this.a=0,this.next=null};var it=Object.freeze({__proto__:null,offscreen:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.DOMParser,r={window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:e,createCanvas:function(t,e){return new OffscreenCanvas(t,e)},createImage:function(t){return b(regeneratorRuntime.mark((function e(){var r,i,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(t);case 2:return r=e.sent,e.next=5,r.blob();case 5:return i=e.sent,e.next=8,createImageBitmap(i);case 8:return n=e.sent,e.abrupt("return",n);case 10:case"end":return e.stop()}}),e)})))()}};return void 0===globalThis.DOMParser&&void 0!==e||Reflect.deleteProperty(r,"DOMParser"),r},node:function(t){var e=t.DOMParser,r=t.canvas;return{window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:e,fetch:t.fetch,createCanvas:r.createCanvas,createImage:r.loadImage}}});function nt(t){return t.replace(/(?!\u3000)\s+/gm," ")}function at(t){var e=t.match(/-?(\d+(?:\.\d*(?:[eE][+-]?\d+)?)?|\.\d+)(?=\D|$)/gm);return e?e.map(parseFloat):[]}var ot=/^[A-Z-]+$/;function st(t){return ot.test(t)?t.toLowerCase():t}function ut(t){var e=/url\(('([^']+)'|"([^"]+)"|([^'")]+))\)/.exec(t);return e&&(e[2]||e[3]||e[4])||""}var lt=/(\[[^\]]+\])/g,ht=/(#[^\s+>~.[:]+)/g,ct=/(\.[^\s+>~.[:]+)/g,ft=/(::[^\s+>~.[:]+|:first-line|:first-letter|:before|:after)/gi,gt=/(:[\w-]+\([^)]*\))/gi,vt=/(:[^\s+>~.[:]+)/g,yt=/([^\s+>~.[:]+)/g;function dt(t,e){var r=e.exec(t);return r?[t.replace(e," "),r.length]:[t,0]}var pt=1e-8;function mt(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2))}function xt(t,e){return(t[0]*e[0]+t[1]*e[1])/(mt(t)*mt(e))}function bt(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos(xt(t,e))}function wt(t){return t*t*t}function St(t){return 3*t*t*(1-t)}function kt(t){return 3*t*(1-t)*(1-t)}function Tt(t){return(1-t)*(1-t)*(1-t)}function At(t){return t*t}function Ct(t){return 2*t*(1-t)}function Ot(t){return(1-t)*(1-t)}var Pt=function(){function t(e,r,i){g(this,t),this.document=e,this.name=r,this.value=i,this.isNormalizedColor=!1}return y(t,[{key:"split",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:" ",r=this.document,i=this.name;return nt(this.getString()).trim().split(e).map((function(e){return new t(r,i,e)}))}},{key:"hasValue",value:function(t){var e=this.value;return null!==e&&""!==e&&(t||0!==e)&&void 0!==e}},{key:"isString",value:function(t){var e=this.value,r="string"==typeof e;return r&&t?t.test(e):r}},{key:"isUrlDefinition",value:function(){return this.isString(/^url\(/)}},{key:"isPixels",value:function(){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}}},{key:"setValue",value:function(t){return this.value=t,this}},{key:"getValue",value:function(t){return void 0===t||this.hasValue()?this.value:t}},{key:"getNumber",value:function(t){if(!this.hasValue())return void 0===t?0:parseFloat(t);var e=this.value,r=parseFloat(e);return this.isString(/%$/)&&(r/=100),r}},{key:"getString",value:function(t){return void 0===t||this.hasValue()?void 0===this.value?"":String(this.value):String(t)}},{key:"getColor",value:function(t){var e=this.getString(t);return this.isNormalizedColor||(this.isNormalizedColor=!0,e=function(t){if(!t.startsWith("rgb"))return t;var e=3;return t.replace(/\d+(\.\d+)?/g,(function(t,r){return e--&&r?String(Math.round(parseFloat(t))):t}))}(e),this.value=e),e}},{key:"getDpi",value:function(){return 96}},{key:"getRem",value:function(){return this.document.rootEmSize}},{key:"getEm",value:function(){return this.document.emSize}},{key:"getUnits",value:function(){return this.getString().replace(/[0-9.-]/g,"")}},{key:"getPixels",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.hasValue())return 0;var r="boolean"==typeof t?[void 0,t]:[t],i=d(r,2),n=i[0],a=i[1],o=this.document.screen.viewPort;switch(!0){case this.isString(/vmin$/):return this.getNumber()/100*Math.min(o.computeSize("x"),o.computeSize("y"));case this.isString(/vmax$/):return this.getNumber()/100*Math.max(o.computeSize("x"),o.computeSize("y"));case this.isString(/vw$/):return this.getNumber()/100*o.computeSize("x");case this.isString(/vh$/):return this.getNumber()/100*o.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(/%$/)&&a:return this.getNumber()*this.getEm();case this.isString(/%$/):return this.getNumber()*o.computeSize(n);default:var s=this.getNumber();return e&&s<1?s*o.computeSize(n):s}}},{key:"getMilliseconds",value:function(){return this.hasValue()?this.isString(/ms$/)?this.getNumber():1e3*this.getNumber():0}},{key:"getRadians",value:function(){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)}}},{key:"getDefinition",value:function(){var t=this.getString(),e=/#([^)'"]+)/.exec(t),r=(null==e?void 0:e[1])||t;return this.document.definitions[r]}},{key:"getFillStyleDefinition",value:function(t,e){var r=this.getDefinition();if(!r)return null;if("function"==typeof r.createGradient&&"getBoundingBox"in t)return r.createGradient(this.document.ctx,t,e);if("function"==typeof r.createPattern){if(r.getHrefAttribute().hasValue()){var i=r.getAttribute("patternTransform");(r=r.getHrefAttribute().getDefinition())&&i.hasValue()&&r.getAttribute("patternTransform",!0).setValue(i.value)}if(r)return r.createPattern(this.document.ctx,t,e)}return null}},{key:"getTextBaseline",value:function(){if(!this.hasValue())return null;var e=this.getString();return t.textBaselineMapping[e]||null}},{key:"addOpacity",value:function(e){for(var r=this.getColor(),i=r.length,n=0,a=0;a<i&&(","===r[a]&&n++,3!==n);a++);if(e.hasValue()&&this.isString()&&3!==n){var o=new M(r);o.ok&&(o.alpha=e.getNumber(),r=o.toRGBA())}return new t(this.document,this.name,r)}}],[{key:"empty",value:function(e){return new t(e,"EMPTY","")}}]),t}();Pt.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"};var Et=function(){function t(){g(this,t),this.viewPorts=[]}return y(t,[{key:"clear",value:function(){this.viewPorts=[]}},{key:"setCurrent",value:function(t,e){this.viewPorts.push({width:t,height:e})}},{key:"removeCurrent",value:function(){this.viewPorts.pop()}},{key:"getRoot",value:function(){var t=d(this.viewPorts,1)[0];return t||Nt()}},{key:"getCurrent",value:function(){var t=this.viewPorts,e=t[t.length-1];return e||Nt()}},{key:"width",get:function(){return this.getCurrent().width}},{key:"height",get:function(){return this.getCurrent().height}},{key:"computeSize",value:function(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)}}]),t}();function Nt(){return{width:Et.DEFAULT_VIEWPORT_WIDTH,height:Et.DEFAULT_VIEWPORT_HEIGHT}}Et.DEFAULT_VIEWPORT_WIDTH=800,Et.DEFAULT_VIEWPORT_HEIGHT=600;var Mt=function(){function t(e,r){g(this,t),this.x=e,this.y=r}return y(t,[{key:"angleTo",value:function(t){return Math.atan2(t.y-this.y,t.x-this.x)}},{key:"applyTransform",value:function(t){var e=this.x,r=this.y,i=e*t[0]+r*t[2]+t[4],n=e*t[1]+r*t[3]+t[5];this.x=i,this.y=n}}],[{key:"parse",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=at(e),n=d(i,2),a=n[0],o=void 0===a?r:a,s=n[1],u=void 0===s?r:s;return new t(o,u)}},{key:"parseScale",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=at(e),n=d(i,2),a=n[0],o=void 0===a?r:a,s=n[1],u=void 0===s?o:s;return new t(o,u)}},{key:"parsePath",value:function(e){for(var r=at(e),i=r.length,n=[],a=0;a<i;a+=2)n.push(new t(r[a],r[a+1]));return n}}]),t}(),Vt=function(){function t(e){g(this,t),this.screen=e,this.working=!1,this.events=[],this.eventElements=[],this.onClick=this.onClick.bind(this),this.onMouseMove=this.onMouseMove.bind(this)}return y(t,[{key:"isWorking",value:function(){return this.working}},{key:"start",value:function(){if(!this.working){var t=this.screen,e=this.onClick,r=this.onMouseMove,i=t.ctx.canvas;i.onclick=e,i.onmousemove=r,this.working=!0}}},{key:"stop",value:function(){if(this.working){var t=this.screen.ctx.canvas;this.working=!1,t.onclick=null,t.onmousemove=null}}},{key:"hasEvents",value:function(){return this.working&&this.events.length>0}},{key:"runEvents",value:function(){if(this.working){var t,e=this.screen,r=this.events,i=this.eventElements,n=e.ctx.canvas.style;n&&(n.cursor=""),r.forEach((function(e,r){var n=e.run;for(t=i[r];t;)n(t),t=t.parent})),this.events=[],this.eventElements=[]}}},{key:"checkPath",value:function(t,e){if(this.working&&e){var r=this.events,i=this.eventElements;r.forEach((function(r,n){var a=r.x,o=r.y;!i[n]&&e.isPointInPath&&e.isPointInPath(a,o)&&(i[n]=t)}))}}},{key:"checkBoundingBox",value:function(t,e){if(this.working&&e){var r=this.events,i=this.eventElements;r.forEach((function(r,n){var a=r.x,o=r.y;!i[n]&&e.isPointInBox(a,o)&&(i[n]=t)}))}}},{key:"mapXY",value:function(t,e){for(var r=this.screen,i=r.window,n=r.ctx,a=new Mt(t,e),o=n.canvas;o;)a.x-=o.offsetLeft,a.y-=o.offsetTop,o=o.offsetParent;return(null==i?void 0:i.scrollX)&&(a.x+=i.scrollX),(null==i?void 0:i.scrollY)&&(a.y+=i.scrollY),a}},{key:"onClick",value:function(t){var e=this.mapXY(t.clientX,t.clientY),r=e.x,i=e.y;this.events.push({type:"onclick",x:r,y:i,run:function(t){t.onClick&&t.onClick()}})}},{key:"onMouseMove",value:function(t){var e=this.mapXY(t.clientX,t.clientY),r=e.x,i=e.y;this.events.push({type:"onmousemove",x:r,y:i,run:function(t){t.onMouseMove&&t.onMouseMove()}})}}]),t}(),_t="undefined"!=typeof window?window:null,Rt="undefined"!=typeof fetch?fetch.bind(void 0):void 0,It=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.fetch,n=void 0===i?Rt:i,a=r.window,o=void 0===a?_t:a;if(g(this,t),this.ctx=e,this.viewPort=new Et,this.mouse=new Vt(this),this.animations=[],this.waits=[],this.frameDuration=0,this.isReadyLock=!1,this.isFirstRender=!0,this.intervalId=null,this.window=o,!n)throw new Error("Can't find 'fetch' in 'globalThis', please provide it via options");this.fetch=n}return y(t,[{key:"wait",value:function(t){this.waits.push(t)}},{key:"ready",value:function(){return this.readyPromise?this.readyPromise:Promise.resolve()}},{key:"isReady",value:function(){if(this.isReadyLock)return!0;var t=this.waits.every((function(t){return t()}));return t&&(this.waits=[],this.resolveReady&&this.resolveReady()),this.isReadyLock=t,t}},{key:"setDefaults",value:function(t){t.strokeStyle="rgba(0,0,0,0)",t.lineCap="butt",t.lineJoin="miter",t.miterLimit=4}},{key:"setViewBox",value:function(t){var e=t.document,r=t.ctx,i=t.aspectRatio,n=t.width,a=t.desiredWidth,o=t.height,s=t.desiredHeight,u=t.minX,l=void 0===u?0:u,h=t.minY,c=void 0===h?0:h,f=t.refX,g=t.refY,v=t.clip,y=void 0!==v&&v,p=t.clipX,m=void 0===p?0:p,x=t.clipY,b=void 0===x?0:x,w=d(nt(i).replace(/^defer\s/,"").split(" "),2),S=w[0]||"xMidYMid",k=w[1]||"meet",T=n/a,A=o/s,C=Math.min(T,A),O=Math.max(T,A),P=a,E=s;"meet"===k&&(P*=C,E*=C),"slice"===k&&(P*=O,E*=O);var N=new Pt(e,"refX",f),M=new Pt(e,"refY",g),V=N.hasValue()&&M.hasValue();if(V&&r.translate(-C*N.getPixels("x"),-C*M.getPixels("y")),y){var _=C*m,R=C*b;r.beginPath(),r.moveTo(_,R),r.lineTo(n,R),r.lineTo(n,o),r.lineTo(_,o),r.closePath(),r.clip()}if(!V){var I="meet"===k&&C===A,L="slice"===k&&O===A,B="meet"===k&&C===T,D="slice"===k&&O===T;S.startsWith("xMid")&&(I||L)&&r.translate(n/2-P/2,0),S.endsWith("YMid")&&(B||D)&&r.translate(0,o/2-E/2),S.startsWith("xMax")&&(I||L)&&r.translate(n-P,0),S.endsWith("YMax")&&(B||D)&&r.translate(0,o-E)}switch(!0){case"none"===S:r.scale(T,A);break;case"meet"===k:r.scale(C,C);break;case"slice"===k:r.scale(O,O)}r.translate(-l,-c)}},{key:"start",value:function(e){var r=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=i.enableRedraw,a=void 0!==n&&n,o=i.ignoreMouse,s=void 0!==o&&o,u=i.ignoreAnimation,l=void 0!==u&&u,h=i.ignoreDimensions,c=void 0!==h&&h,f=i.ignoreClear,g=void 0!==f&&f,v=i.forceRedraw,y=i.scaleWidth,d=i.scaleHeight,p=i.offsetX,m=i.offsetY,x=this.mouse,b=1e3/t.FRAMERATE;if(this.isReadyLock=!1,this.frameDuration=b,this.readyPromise=new Promise((function(t){r.resolveReady=t})),this.isReady()&&this.render(e,c,g,y,d,p,m),a){var w=Date.now(),S=w,k=0,T=function t(){w=Date.now(),(k=w-S)>=b&&(S=w-k%b,r.shouldUpdate(l,v)&&(r.render(e,c,g,y,d,p,m),x.runEvents())),r.intervalId=N(t)};s||x.start(),this.intervalId=N(T)}}},{key:"stop",value:function(){this.intervalId&&(N.cancel(this.intervalId),this.intervalId=null),this.mouse.stop()}},{key:"shouldUpdate",value:function(t,e){if(!t){var r=this.frameDuration,i=this.animations.reduce((function(t,e){return e.update(r)||t}),!1);if(i)return!0}return!("function"!=typeof e||!e())||(!(this.isReadyLock||!this.isReady())||!!this.mouse.hasEvents())}},{key:"render",value:function(t,e,r,i,n,a,o){var s=this.viewPort,u=this.ctx,l=this.isFirstRender,h=u.canvas;s.clear(),h.width&&h.height&&s.setCurrent(h.width,h.height);var c=t.getStyle("width"),f=t.getStyle("height");!e&&(l||"number"!=typeof i&&"number"!=typeof n)&&(c.hasValue()&&(h.width=c.getPixels("x"),h.style&&(h.style.width="".concat(h.width,"px"))),f.hasValue()&&(h.height=f.getPixels("y"),h.style&&(h.style.height="".concat(h.height,"px"))));var g=h.clientWidth||h.width,v=h.clientHeight||h.height;if(e&&c.hasValue()&&f.hasValue()&&(g=c.getPixels("x"),v=f.getPixels("y")),s.setCurrent(g,v),"number"==typeof a&&t.getAttribute("x",!0).setValue(a),"number"==typeof o&&t.getAttribute("y",!0).setValue(o),"number"==typeof i||"number"==typeof n){var y=at(t.getAttribute("viewBox").getString()),d=0,p=0;if("number"==typeof i){var m=t.getStyle("width");m.hasValue()?d=m.getPixels("x")/i:y[2]&&!isNaN(y[2])&&(d=y[2]/i)}if("number"==typeof n){var x=t.getStyle("height");x.hasValue()?p=x.getPixels("y")/n:y[3]&&!isNaN(y[3])&&(p=y[3]/n)}d||(d=p),p||(p=d),t.getAttribute("width",!0).setValue(i),t.getAttribute("height",!0).setValue(n);var b=t.getStyle("transform",!0,!0);b.setValue("".concat(b.getString()," scale(").concat(1/d,", ").concat(1/p,")"))}r||u.clearRect(0,0,g,v),t.render(u),l&&(this.isFirstRender=!1)}}]),t}();It.defaultWindow=_t,It.defaultFetch=Rt,It.FRAMERATE=30,It.MAX_VIRTUAL_PIXELS=3e4;var Lt=It.defaultFetch,Bt="undefined"!=typeof DOMParser?DOMParser:void 0,Dt=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.fetch,i=void 0===r?Lt:r,n=e.DOMParser,a=void 0===n?Bt:n;if(g(this,t),!i)throw new Error("Can't find 'fetch' in 'globalThis', please provide it via options");if(!a)throw new Error("Can't find 'DOMParser' in 'globalThis', please provide it via options");this.fetch=i,this.DOMParser=a}var e,r;return y(t,[{key:"parse",value:(r=b(regeneratorRuntime.mark((function t(e){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e.startsWith("<")){t.next=2;break}return t.abrupt("return",this.parseFromString(e));case 2:return t.abrupt("return",this.load(e));case 3:case"end":return t.stop()}}),t,this)}))),function(t){return r.apply(this,arguments)})},{key:"parseFromString",value:function(t){var e=new this.DOMParser;try{return this.checkDocument(e.parseFromString(t,"image/svg+xml"))}catch(r){return this.checkDocument(e.parseFromString(t,"text/xml"))}}},{key:"checkDocument",value:function(t){var e=t.getElementsByTagName("parsererror")[0];if(e)throw new Error(e.textContent||"Unknown parse error");return t}},{key:"load",value:(e=b(regeneratorRuntime.mark((function t(e){var r,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.fetch(e);case 2:return r=t.sent,t.next=5,r.text();case 5:return i=t.sent,t.abrupt("return",this.parseFromString(i));case 7:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})}]),t}(),Ht=function(){function t(e,r){g(this,t),this.type="translate",this.point=Mt.parse(r)}return y(t,[{key:"apply",value:function(t){var e=this.point,r=e.x,i=e.y;t.translate(r||0,i||0)}},{key:"unapply",value:function(t){var e=this.point,r=e.x,i=e.y;t.translate(-1*r||0,-1*i||0)}},{key:"applyToPoint",value:function(t){var e=this.point,r=e.x,i=e.y;t.applyTransform([1,0,0,1,r||0,i||0])}}]),t}(),zt=function(){function t(e,r,i){g(this,t),this.type="rotate";var n=at(r);this.angle=new Pt(e,"angle",n[0]),this.originX=i[0],this.originY=i[1],this.cx=n[1]||0,this.cy=n[2]||0}return y(t,[{key:"apply",value:function(t){var e=this.cx,r=this.cy,i=this.originX,n=this.originY,a=this.angle,o=e+i.getPixels("x"),s=r+n.getPixels("y");t.translate(o,s),t.rotate(a.getRadians()),t.translate(-o,-s)}},{key:"unapply",value:function(t){var e=this.cx,r=this.cy,i=this.originX,n=this.originY,a=this.angle,o=e+i.getPixels("x"),s=r+n.getPixels("y");t.translate(o,s),t.rotate(-1*a.getRadians()),t.translate(-o,-s)}},{key:"applyToPoint",value:function(t){var e=this.cx,r=this.cy,i=this.angle.getRadians();t.applyTransform([1,0,0,1,e||0,r||0]),t.applyTransform([Math.cos(i),Math.sin(i),-Math.sin(i),Math.cos(i),0,0]),t.applyTransform([1,0,0,1,-e||0,-r||0])}}]),t}(),Ft=function(){function t(e,r,i){g(this,t),this.type="scale";var n=Mt.parseScale(r);0!==n.x&&0!==n.y||(n.x=pt,n.y=pt),this.scale=n,this.originX=i[0],this.originY=i[1]}return y(t,[{key:"apply",value:function(t){var e=this.scale,r=e.x,i=e.y,n=this.originX,a=this.originY,o=n.getPixels("x"),s=a.getPixels("y");t.translate(o,s),t.scale(r,i||r),t.translate(-o,-s)}},{key:"unapply",value:function(t){var e=this.scale,r=e.x,i=e.y,n=this.originX,a=this.originY,o=n.getPixels("x"),s=a.getPixels("y");t.translate(o,s),t.scale(1/r,1/i||r),t.translate(-o,-s)}},{key:"applyToPoint",value:function(t){var e=this.scale,r=e.x,i=e.y;t.applyTransform([r||0,0,0,i||0,0,0])}}]),t}(),Ut=function(){function t(e,r,i){var n;g(this,t),this.type="matrix",this.matrix=[(n=at(r))[0]||0,n[1]||0,n[2]||0,n[3]||0,n[4]||0,n[5]||0],this.originX=i[0],this.originY=i[1]}return y(t,[{key:"apply",value:function(t){var e=this.originX,r=this.originY,i=this.matrix,n=e.getPixels("x"),a=r.getPixels("y");t.translate(n,a),t.transform(i[0],i[1],i[2],i[3],i[4],i[5]),t.translate(-n,-a)}},{key:"unapply",value:function(t){var e=this.originX,r=this.originY,i=this.matrix,n=i[0],a=i[2],o=i[4],s=i[1],u=i[3],l=i[5],h=1/(n*(1*u-0*l)-a*(1*s-0*l)+o*(0*s-0*u)),c=e.getPixels("x"),f=r.getPixels("y");t.translate(c,f),t.transform(h*(1*u-0*l),h*(0*l-1*s),h*(0*o-1*a),h*(1*n-0*o),h*(a*l-o*u),h*(o*s-n*l)),t.translate(-c,-f)}},{key:"applyToPoint",value:function(t){t.applyTransform(this.matrix)}}]),t}(),Xt=function(t){s(r,t);var e=l(r);function r(t,i,n){var a;return g(this,r),(a=e.call(this,t,i,n)).type="skew",a.angle=new Pt(t,"angle",i),a}return y(r)}(Ut),Yt=function(t){s(r,t);var e=l(r);function r(t,i,n){var a;return g(this,r),(a=e.call(this,t,i,n)).type="skewX",a.matrix=[1,0,Math.tan(a.angle.getRadians()),1,0,0],a}return y(r)}(Xt),qt=function(t){s(r,t);var e=l(r);function r(t,i,n){var a;return g(this,r),(a=e.call(this,t,i,n)).type="skewY",a.matrix=[1,Math.tan(a.angle.getRadians()),0,1,0,0],a}return y(r)}(Xt);var jt=function(){function t(e,r,i){var n=this;g(this,t),this.document=e,this.transforms=[],nt(r).trim().replace(/\)([a-zA-Z])/g,") $1").replace(/\)(\s?,\s?)/g,") ").split(/\s(?=[a-z])/).forEach((function(e){if("none"!==e){var r=function(t){var e=d(t.split("("),2),r=e[0],i=void 0===r?"":r,n=e[1],a=void 0===n?"":n;return[i.trim(),a.trim().replace(")","")]}(e),a=d(r,2),o=a[0],s=a[1],u=t.transformTypes[o];u&&n.transforms.push(new u(n.document,s,i))}}))}return y(t,[{key:"apply",value:function(t){this.transforms.forEach((function(e){return e.apply(t)}))}},{key:"unapply",value:function(t){this.transforms.forEach((function(e){return e.unapply(t)}))}},{key:"applyToPoint",value:function(t){this.transforms.forEach((function(e){return e.applyToPoint(t)}))}}],[{key:"fromElement",value:function(e,r){var i=r.getStyle("transform",!1,!0);if(i.hasValue()){var n=d(r.getStyle("transform-origin",!1,!0).split(),2),a=n[0],o=n[1],s=void 0===o?a:o;if(a&&s){var u=[a,s];return new t(e,i.getString(),u)}}return null}}]),t}();jt.transformTypes={translate:Ht,rotate:zt,scale:Ft,matrix:Ut,skewX:Yt,skewY:qt};var Wt=function(){function t(e,r){var i=this,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(g(this,t),this.document=e,this.node=r,this.captureTextNodes=n,this.type="",this.attributes={},this.styles={},this.stylesSpecificity={},this.animationFrozen=!1,this.animationFrozenValue="",this.parent=null,this.children=[],r&&1===r.nodeType){if(Array.from(r.attributes).forEach((function(t){var r=st(t.nodeName);i.attributes[r]=new Pt(e,r,t.value)})),this.addStylesFromStyleDefinition(),this.getAttribute("style").hasValue()){var a=this.getAttribute("style").getString().split(";").map((function(t){return t.trim()}));a.forEach((function(t){if(t){var r=t.split(":").map((function(t){return t.trim()})),n=d(r,2),a=n[0],o=n[1];a&&(i.styles[a]=new Pt(e,a,o))}}))}var o=e.definitions,s=this.getAttribute("id");s.hasValue()&&(o[s.getString()]||(o[s.getString()]=this)),Array.from(r.childNodes).forEach((function(t){if(1===t.nodeType)i.addChild(t);else if(n&&(3===t.nodeType||4===t.nodeType)){var r=e.createTextNode(t);r.getText().length>0&&i.addChild(r)}}))}}return y(t,[{key:"getAttribute",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.attributes[t];if(!r&&e){var i=new Pt(this.document,t,"");return this.attributes[t]=i,i}return r||Pt.empty(this.document)}},{key:"getHrefAttribute",value:function(){var t;for(var e in this.attributes)if("href"===e||e.endsWith(":href")){t=this.attributes[e];break}return t||Pt.empty(this.document)}},{key:"getStyle",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=this.styles[t];if(i)return i;var n=this.getAttribute(t);if(n.hasValue())return this.styles[t]=n,n;if(!r){var a=this.parent;if(a){var o=a.getStyle(t);if(o.hasValue())return o}}if(e){var s=new Pt(this.document,t,"");return this.styles[t]=s,s}return Pt.empty(this.document)}},{key:"render",value:function(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 r=this.getStyle("filter").getDefinition();r&&(this.applyEffects(t),r.apply(t,this))}else this.setContext(t),this.renderChildren(t),this.clearContext(t);t.restore()}}},{key:"setContext",value:function(t){}},{key:"applyEffects",value:function(t){var e=jt.fromElement(this.document,this);e&&e.apply(t);var r=this.getStyle("clip-path",!1,!0);if(r.hasValue()){var i=r.getDefinition();i&&i.apply(t)}}},{key:"clearContext",value:function(t){}},{key:"renderChildren",value:function(t){this.children.forEach((function(e){e.render(t)}))}},{key:"addChild",value:function(e){var r=e instanceof t?e:this.document.createElement(e);r.parent=this,t.ignoreChildTypes.includes(r.type)||this.children.push(r)}},{key:"matchesSelector",value:function(t){var e,r=this.node;if("function"==typeof r.matches)return r.matches(t);var i=null===(e=r.getAttribute)||void 0===e?void 0:e.call(r,"class");return!(!i||""===i)&&i.split(" ").some((function(e){return".".concat(e)===t}))}},{key:"addStylesFromStyleDefinition",value:function(){var t,e=this.document,r=e.styles,i=e.stylesSpecificity;for(var n in r)if(!n.startsWith("@")&&this.matchesSelector(n)){var a=r[n],o=i[n];if(a)for(var s in a){var u=this.stylesSpecificity[s];void 0===u&&(u="000"),o&&o>=u&&((t=a[s])&&(this.styles[s]=t),this.stylesSpecificity[s]=o)}}}},{key:"removeStyles",value:function(t,e){return e.reduce((function(e,r){var i=t.getStyle(r);if(!i.hasValue())return e;var n=i.getString();return i.setValue(""),[].concat(o(e),[[r,n]])}),[])}},{key:"restoreStyles",value:function(t,e){e.forEach((function(e){var r=d(e,2),i=r[0],n=r[1];t.getStyle(i,!0).setValue(n)}))}},{key:"isFirstChild",value:function(){var t;return 0===(null===(t=this.parent)||void 0===t?void 0:t.children.indexOf(this))}}]),t}();Wt.ignoreChildTypes=["title"];var Qt=function(t){s(r,t);var e=l(r);function r(t,i,n){return g(this,r),e.call(this,t,i,n)}return y(r)}(Wt);function Gt(t){var e=t.trim();return/^('|")/.test(e)?e:'"'.concat(e,'"')}function $t(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 Zt(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:""}}var Kt=function(){function t(e,r,i,n,a,o){g(this,t);var s=o?"string"==typeof o?t.parse(o):o:{};this.fontFamily=a||s.fontFamily,this.fontSize=n||s.fontSize,this.fontStyle=e||s.fontStyle,this.fontWeight=i||s.fontWeight,this.fontVariant=r||s.fontVariant}return y(t,[{key:"toString",value:function(){return[$t(this.fontStyle),this.fontVariant,Zt(this.fontWeight),this.fontSize,(t=this.fontFamily,"undefined"==typeof process?t:t.trim().split(",").map(Gt).join(","))].join(" ").trim();var t}}],[{key:"parse",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0,i="",n="",a="",o="",s="",u=nt(e).trim().split(" "),l={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1};return u.forEach((function(e){switch(!0){case!l.fontStyle&&t.styles.includes(e):"inherit"!==e&&(i=e),l.fontStyle=!0;break;case!l.fontVariant&&t.variants.includes(e):"inherit"!==e&&(n=e),l.fontStyle=!0,l.fontVariant=!0;break;case!l.fontWeight&&t.weights.includes(e):"inherit"!==e&&(a=e),l.fontStyle=!0,l.fontVariant=!0,l.fontWeight=!0;break;case!l.fontSize:"inherit"!==e&&(o=e.split("/")[0]||""),l.fontStyle=!0,l.fontVariant=!0,l.fontWeight=!0,l.fontSize=!0;break;default:"inherit"!==e&&(s+=e)}})),new t(i,n,a,o,s,r)}}]),t}();Kt.styles="normal|italic|oblique|inherit",Kt.variants="normal|small-caps|inherit",Kt.weights="normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit";var Jt=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.NaN,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.NaN,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Number.NaN,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.NaN;g(this,t),this.x1=e,this.y1=r,this.x2=i,this.y2=n,this.addPoint(e,r),this.addPoint(i,n)}return y(t,[{key:"x",get:function(){return this.x1}},{key:"y",get:function(){return this.y1}},{key:"width",get:function(){return this.x2-this.x1}},{key:"height",get:function(){return this.y2-this.y1}},{key:"addPoint",value:function(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))}},{key:"addX",value:function(t){this.addPoint(t,0)}},{key:"addY",value:function(t){this.addPoint(0,t)}},{key:"addBoundingBox",value:function(t){if(t){var e=t.x1,r=t.y1,i=t.x2,n=t.y2;this.addPoint(e,r),this.addPoint(i,n)}}},{key:"sumCubic",value:function(t,e,r,i,n){return Math.pow(1-t,3)*e+3*Math.pow(1-t,2)*t*r+3*(1-t)*Math.pow(t,2)*i+Math.pow(t,3)*n}},{key:"bezierCurveAdd",value:function(t,e,r,i,n){var a=6*e-12*r+6*i,o=-3*e+9*r-9*i+3*n,s=3*r-3*e;if(0!==o){var u=Math.pow(a,2)-4*s*o;if(!(u<0)){var l=(-a+Math.sqrt(u))/(2*o);0<l&&l<1&&(t?this.addX(this.sumCubic(l,e,r,i,n)):this.addY(this.sumCubic(l,e,r,i,n)));var h=(-a-Math.sqrt(u))/(2*o);0<h&&h<1&&(t?this.addX(this.sumCubic(h,e,r,i,n)):this.addY(this.sumCubic(h,e,r,i,n)))}}else{if(0===a)return;var c=-s/a;0<c&&c<1&&(t?this.addX(this.sumCubic(c,e,r,i,n)):this.addY(this.sumCubic(c,e,r,i,n)))}}},{key:"addBezierCurve",value:function(t,e,r,i,n,a,o,s){this.addPoint(t,e),this.addPoint(o,s),this.bezierCurveAdd(!0,t,r,n,o),this.bezierCurveAdd(!1,e,i,a,s)}},{key:"addQuadraticCurve",value:function(t,e,r,i,n,a){var o=t+2/3*(r-t),s=e+2/3*(i-e),u=o+1/3*(n-t),l=s+1/3*(a-e);this.addBezierCurve(t,e,o,u,s,l,n,a)}},{key:"isPointInBox",value:function(t,e){var r=this.x1,i=this.y1,n=this.x2,a=this.y2;return r<=t&&t<=n&&i<=e&&e<=a}}]),t}(),te=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];return(t=e.call.apply(e,[this].concat(n))).modifiedEmSizeStack=!1,t}return y(r,[{key:"calculateOpacity",value:function(){for(var t=1,e=this;e;){var r=e.getStyle("opacity",!1,!0);r.hasValue(!0)&&(t*=r.getNumber()),e=e.parent}return t}},{key:"setContext",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e){var r=this.getStyle("fill"),i=this.getStyle("fill-opacity"),n=this.getStyle("stroke"),a=this.getStyle("stroke-opacity");if(r.isUrlDefinition()){var o=r.getFillStyleDefinition(this,i);o&&(t.fillStyle=o)}else if(r.hasValue()){"currentColor"===r.getString()&&r.setValue(this.getStyle("color").getColor());var s=r.getColor();"inherit"!==s&&(t.fillStyle="none"===s?"rgba(0,0,0,0)":s)}if(i.hasValue()){var u=new Pt(this.document,"fill",t.fillStyle).addOpacity(i).getColor();t.fillStyle=u}if(n.isUrlDefinition()){var l=n.getFillStyleDefinition(this,a);l&&(t.strokeStyle=l)}else if(n.hasValue()){"currentColor"===n.getString()&&n.setValue(this.getStyle("color").getColor());var h=n.getString();"inherit"!==h&&(t.strokeStyle="none"===h?"rgba(0,0,0,0)":h)}if(a.hasValue()){var c=new Pt(this.document,"stroke",t.strokeStyle).addOpacity(a).getString();t.strokeStyle=c}var f=this.getStyle("stroke-width");if(f.hasValue()){var g=f.getPixels();t.lineWidth=g||pt}var v=this.getStyle("stroke-linecap"),y=this.getStyle("stroke-linejoin"),d=this.getStyle("stroke-miterlimit"),p=this.getStyle("stroke-dasharray"),m=this.getStyle("stroke-dashoffset");if(v.hasValue()&&(t.lineCap=v.getString()),y.hasValue()&&(t.lineJoin=y.getString()),d.hasValue()&&(t.miterLimit=d.getNumber()),p.hasValue()&&"none"!==p.getString()){var x=at(p.getString());void 0!==t.setLineDash?t.setLineDash(x):void 0!==t.webkitLineDash?t.webkitLineDash=x:void 0===t.mozDash||1===x.length&&0===x[0]||(t.mozDash=x);var b=m.getPixels();void 0!==t.lineDashOffset?t.lineDashOffset=b:void 0!==t.webkitLineDashOffset?t.webkitLineDashOffset=b:void 0!==t.mozDashOffset&&(t.mozDashOffset=b)}}if(this.modifiedEmSizeStack=!1,void 0!==t.font){var w=this.getStyle("font"),S=this.getStyle("font-style"),k=this.getStyle("font-variant"),T=this.getStyle("font-weight"),A=this.getStyle("font-size"),C=this.getStyle("font-family"),O=new Kt(S.getString(),k.getString(),T.getString(),A.hasValue()?"".concat(A.getPixels(!0),"px"):"",C.getString(),Kt.parse(w.getString(),t.font));S.setValue(O.fontStyle),k.setValue(O.fontVariant),T.setValue(O.fontWeight),A.setValue(O.fontSize),C.setValue(O.fontFamily),t.font=O.toString(),A.isPixels()&&(this.document.emSize=A.getPixels(),this.modifiedEmSizeStack=!0)}e||(this.applyEffects(t),t.globalAlpha=this.calculateOpacity())}},{key:"clearContext",value:function(t){n(f(r.prototype),"clearContext",this).call(this,t),this.modifiedEmSizeStack&&this.document.popEmSize()}}]),r}(Wt),ee=function(t){s(r,t);var e=l(r);function r(t,i,n){var a;return g(this,r),(a=e.call(this,t,i,(this instanceof r?this.constructor:void 0)===r||n)).type="text",a.x=0,a.y=0,a.leafTexts=[],a.textChunkStart=0,a.minX=Number.POSITIVE_INFINITY,a.maxX=Number.NEGATIVE_INFINITY,a.measureCache=-1,a}return y(r,[{key:"setContext",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(f(r.prototype),"setContext",this).call(this,t,e);var i=this.getStyle("dominant-baseline").getTextBaseline()||this.getStyle("alignment-baseline").getTextBaseline();i&&(t.textBaseline=i)}},{key:"initializeCoordinates",value:function(){this.x=0,this.y=0,this.leafTexts=[],this.textChunkStart=0,this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY}},{key:"getBoundingBox",value:function(t){var e=this;if("text"!==this.type)return this.getTElementBoundingBox(t);this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(t);var r=null;return this.children.forEach((function(i,n){var a=e.getChildBoundingBox(t,e,e,n);r?r.addBoundingBox(a):r=a})),r}},{key:"getFontSize",value:function(){var t=this.document,e=this.parent,r=Kt.parse(t.ctx.font).fontSize;return e.getStyle("font-size").getNumber(r)}},{key:"getTElementBoundingBox",value:function(t){var e=this.getFontSize();return new Jt(this.x,this.y-e,this.x+this.measureText(t),this.y)}},{key:"getGlyph",value:function(t,e,r){var i,n=e[r];if(t.isArabic){var a,o=e.length,s=e[r-1],u=e[r+1],l="isolated";(0===r||" "===s)&&r<o-1&&" "!==u&&(l="terminal"),r>0&&" "!==s&&r<o-1&&" "!==u&&(l="medial"),r>0&&" "!==s&&(r===o-1||" "===u)&&(l="initial"),i=(null===(a=t.arabicGlyphs[n])||void 0===a?void 0:a[l])||t.glyphs[n]}else i=t.glyphs[n];return i||(i=t.missingGlyph),i}},{key:"getText",value:function(){return""}},{key:"getTextFromNode",value:function(t){var e=t||this.node,r=Array.from(e.parentNode.childNodes),i=r.indexOf(e),n=r.length-1,a=nt(e.textContent||"");return 0===i&&(a=a.replace(/^[\n \t]+/,"")),i===n&&(a=function(t){return t.replace(/[\n \t]+$/,"")}(a)),a}},{key:"renderChildren",value:function(t){var e=this;if("text"===this.type){this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(t),this.children.forEach((function(r,i){e.renderChild(t,e,e,i)}));var r=this.document.screen.mouse;r.isWorking()&&r.checkBoundingBox(this,this.getBoundingBox(t))}else this.renderTElementChildren(t)}},{key:"renderTElementChildren",value:function(t){var e=this.document,r=this.parent,i=this.getText(),n=r.getStyle("font-family").getDefinition();if(n)for(var a=n.fontFace.unitsPerEm,o=Kt.parse(e.ctx.font),s=r.getStyle("font-size").getNumber(o.fontSize),u=r.getStyle("font-style").getString(o.fontStyle),l=s/a,h=n.isRTL?i.split("").reverse().join(""):i,c=at(r.getAttribute("dx").getString()),f=h.length,g=0;g<f;g++){var v=this.getGlyph(n,h,g);t.translate(this.x,this.y),t.scale(l,-l);var y=t.lineWidth;t.lineWidth=t.lineWidth*a/s,"italic"===u&&t.transform(1,0,.4,1,0,0),v.render(t),"italic"===u&&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+=s*(v.horizAdvX||n.horizAdvX)/a,void 0===c[g]||isNaN(c[g])||(this.x+=c[g])}else{var d=this.x,p=this.y;t.fillStyle&&t.fillText(i,d,p),t.strokeStyle&&t.strokeText(i,d,p)}}},{key:"applyAnchoring",value:function(){if(!(this.textChunkStart>=this.leafTexts.length)){var t=this.leafTexts[this.textChunkStart],e=t.getStyle("text-anchor").getString("start"),r=0;r="start"===e?t.x-this.minX:"end"===e?t.x-this.maxX:t.x-(this.minX+this.maxX)/2;for(var i=this.textChunkStart;i<this.leafTexts.length;i++)this.leafTexts[i].x+=r;this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.textChunkStart=this.leafTexts.length}}},{key:"adjustChildCoordinatesRecursive",value:function(t){var e=this;this.children.forEach((function(r,i){e.adjustChildCoordinatesRecursiveCore(t,e,e,i)})),this.applyAnchoring()}},{key:"adjustChildCoordinatesRecursiveCore",value:function(t,e,r,i){var n=r.children[i];n.children.length>0?n.children.forEach((function(r,i){e.adjustChildCoordinatesRecursiveCore(t,e,n,i)})):this.adjustChildCoordinates(t,e,r,i)}},{key:"adjustChildCoordinates",value:function(t,e,r,i){var n=r.children[i];if("function"!=typeof n.measureText)return n;t.save(),n.setContext(t,!0);var a=n.getAttribute("x"),o=n.getAttribute("y"),s=n.getAttribute("dx"),u=n.getAttribute("dy"),l=n.getStyle("font-family").getDefinition(),h=Boolean(null==l?void 0:l.isRTL);0===i&&(a.hasValue()||a.setValue(n.getInheritedAttribute("x")),o.hasValue()||o.setValue(n.getInheritedAttribute("y")),s.hasValue()||s.setValue(n.getInheritedAttribute("dx")),u.hasValue()||u.setValue(n.getInheritedAttribute("dy")));var c=n.measureText(t);return h&&(e.x-=c),a.hasValue()?(e.applyAnchoring(),n.x=a.getPixels("x"),s.hasValue()&&(n.x+=s.getPixels("x"))):(s.hasValue()&&(e.x+=s.getPixels("x")),n.x=e.x),e.x=n.x,h||(e.x+=c),o.hasValue()?(n.y=o.getPixels("y"),u.hasValue()&&(n.y+=u.getPixels("y"))):(u.hasValue()&&(e.y+=u.getPixels("y")),n.y=e.y),e.y=n.y,e.leafTexts.push(n),e.minX=Math.min(e.minX,n.x,n.x+c),e.maxX=Math.max(e.maxX,n.x,n.x+c),n.clearContext(t),t.restore(),n}},{key:"getChildBoundingBox",value:function(t,e,r,i){var n=r.children[i];if("function"!=typeof n.getBoundingBox)return null;var a=n.getBoundingBox(t);return a&&n.children.forEach((function(r,i){var o=e.getChildBoundingBox(t,e,n,i);a.addBoundingBox(o)})),a}},{key:"renderChild",value:function(t,e,r,i){var n=r.children[i];n.render(t),n.children.forEach((function(r,i){e.renderChild(t,e,n,i)}))}},{key:"measureText",value:function(t){var e=this.measureCache;if(~e)return e;var r=this.getText(),i=this.measureTargetText(t,r);return this.measureCache=i,i}},{key:"measureTargetText",value:function(t,e){if(!e.length)return 0;var r=this.parent,i=r.getStyle("font-family").getDefinition();if(i){for(var n=this.getFontSize(),a=i.isRTL?e.split("").reverse().join(""):e,o=at(r.getAttribute("dx").getString()),s=a.length,u=0,l=0;l<s;l++){u+=(this.getGlyph(i,a,l).horizAdvX||i.horizAdvX)*n/i.fontFace.unitsPerEm,void 0===o[l]||isNaN(o[l])||(u+=o[l])}return u}if(!t.measureText)return 10*e.length;t.save(),this.setContext(t,!0);var h=t.measureText(e).width;return this.clearContext(t),t.restore(),h}},{key:"getInheritedAttribute",value:function(t){for(var e=this;e instanceof r&&e.isFirstChild()&&e.parent;){var i=e.parent.getAttribute(t);if(i.hasValue(!0))return i.getString("0");e=e.parent}return null}}]),r}(te),re=function(t){s(r,t);var e=l(r);function r(t,i,n){var a;return g(this,r),(a=e.call(this,t,i,(this instanceof r?this.constructor:void 0)===r||n)).type="tspan",a.text=a.children.length>0?"":a.getTextFromNode(),a}return y(r,[{key:"getText",value:function(){return this.text}}]),r}(ee),ie=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];return(t=e.call.apply(e,[this].concat(n))).type="textNode",t}return y(r)}(re),ne=function(t){s(r,t);var e=l(r);function r(t){var i;return g(this,r),(i=e.call(this,t.replace(/([+\-.])\s+/gm,"$1").replace(/[^MmZzLlHhVvCcSsQqTtAae\d\s.,+-].*/g,""))).control=new Mt(0,0),i.start=new Mt(0,0),i.current=new Mt(0,0),i.command=null,i.commands=i.commands,i.i=-1,i.previousCommand=null,i.points=[],i.angles=[],i}return y(r,[{key:"reset",value:function(){this.i=-1,this.command=null,this.previousCommand=null,this.start=new Mt(0,0),this.control=new Mt(0,0),this.current=new Mt(0,0),this.points=[],this.angles=[]}},{key:"isEnd",value:function(){return this.i>=this.commands.length-1}},{key:"next",value:function(){var t=this.commands[++this.i];return this.previousCommand=this.command,this.command=t,t}},{key:"getPoint",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"x",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"y",r=new Mt(this.command[t],this.command[e]);return this.makeAbsolute(r)}},{key:"getAsControlPoint",value:function(t,e){var r=this.getPoint(t,e);return this.control=r,r}},{key:"getAsCurrentPoint",value:function(t,e){var r=this.getPoint(t,e);return this.current=r,r}},{key:"getReflectedControlPoint",value:function(){var t=this.previousCommand.type;if(t!==$.CURVE_TO&&t!==$.SMOOTH_CURVE_TO&&t!==$.QUAD_TO&&t!==$.SMOOTH_QUAD_TO)return this.current;var e=this.current,r=e.x,i=e.y,n=this.control,a=n.x,o=n.y;return new Mt(2*r-a,2*i-o)}},{key:"makeAbsolute",value:function(t){if(this.command.relative){var e=this.current,r=e.x,i=e.y;t.x+=r,t.y+=i}return t}},{key:"addMarker",value:function(t,e,r){var i=this.points,n=this.angles;r&&n.length>0&&!n[n.length-1]&&(n[n.length-1]=i[i.length-1].angleTo(r)),this.addMarkerAngle(t,e?e.angleTo(t):null)}},{key:"addMarkerAngle",value:function(t,e){this.points.push(t),this.angles.push(e)}},{key:"getMarkerPoints",value:function(){return this.points}},{key:"getMarkerAngles",value:function(){for(var t=this.angles,e=t.length,r=0;r<e;r++)if(!t[r])for(var i=r+1;i<e;i++)if(t[i]){t[r]=t[i];break}return t}}]),r}($),ae=function(t){s(r,t);var e=l(r);function r(t,i,n){var a;return g(this,r),(a=e.call(this,t,i,n)).type="path",a.pathParser=new ne(a.getAttribute("d").getString()),a}return y(r,[{key:"path",value:function(t){var e=this.pathParser,r=new Jt;for(e.reset(),t&&t.beginPath();!e.isEnd();)switch(e.next().type){case ne.MOVE_TO:this.pathM(t,r);break;case ne.LINE_TO:this.pathL(t,r);break;case ne.HORIZ_LINE_TO:this.pathH(t,r);break;case ne.VERT_LINE_TO:this.pathV(t,r);break;case ne.CURVE_TO:this.pathC(t,r);break;case ne.SMOOTH_CURVE_TO:this.pathS(t,r);break;case ne.QUAD_TO:this.pathQ(t,r);break;case ne.SMOOTH_QUAD_TO:this.pathT(t,r);break;case ne.ARC:this.pathA(t,r);break;case ne.CLOSE_PATH:this.pathZ(t,r)}return r}},{key:"getBoundingBox",value:function(t){return this.path()}},{key:"getMarkers",value:function(){var t=this.pathParser,e=t.getMarkerPoints(),r=t.getMarkerAngles(),i=e.map((function(t,e){return[t,r[e]]}));return i}},{key:"renderChildren",value:function(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 r=this.getMarkers();if(r){var i=r.length-1,n=this.getStyle("marker-start"),a=this.getStyle("marker-mid"),o=this.getStyle("marker-end");if(n.isUrlDefinition()){var s=n.getDefinition(),u=d(r[0],2),l=u[0],h=u[1];s.render(t,l,h)}if(a.isUrlDefinition())for(var c=a.getDefinition(),f=1;f<i;f++){var g=d(r[f],2),v=g[0],y=g[1];c.render(t,v,y)}if(o.isUrlDefinition()){var p=o.getDefinition(),m=d(r[i],2),x=m[0],b=m[1];p.render(t,x,b)}}}},{key:"pathM",value:function(t,e){var i=this.pathParser,n=r.pathM(i).point,a=n.x,o=n.y;i.addMarker(n),e.addPoint(a,o),t&&t.moveTo(a,o)}},{key:"pathL",value:function(t,e){var i=this.pathParser,n=r.pathL(i),a=n.current,o=n.point,s=o.x,u=o.y;i.addMarker(o,a),e.addPoint(s,u),t&&t.lineTo(s,u)}},{key:"pathH",value:function(t,e){var i=this.pathParser,n=r.pathH(i),a=n.current,o=n.point,s=o.x,u=o.y;i.addMarker(o,a),e.addPoint(s,u),t&&t.lineTo(s,u)}},{key:"pathV",value:function(t,e){var i=this.pathParser,n=r.pathV(i),a=n.current,o=n.point,s=o.x,u=o.y;i.addMarker(o,a),e.addPoint(s,u),t&&t.lineTo(s,u)}},{key:"pathC",value:function(t,e){var i=this.pathParser,n=r.pathC(i),a=n.current,o=n.point,s=n.controlPoint,u=n.currentPoint;i.addMarker(u,s,o),e.addBezierCurve(a.x,a.y,o.x,o.y,s.x,s.y,u.x,u.y),t&&t.bezierCurveTo(o.x,o.y,s.x,s.y,u.x,u.y)}},{key:"pathS",value:function(t,e){var i=this.pathParser,n=r.pathS(i),a=n.current,o=n.point,s=n.controlPoint,u=n.currentPoint;i.addMarker(u,s,o),e.addBezierCurve(a.x,a.y,o.x,o.y,s.x,s.y,u.x,u.y),t&&t.bezierCurveTo(o.x,o.y,s.x,s.y,u.x,u.y)}},{key:"pathQ",value:function(t,e){var i=this.pathParser,n=r.pathQ(i),a=n.current,o=n.controlPoint,s=n.currentPoint;i.addMarker(s,o,o),e.addQuadraticCurve(a.x,a.y,o.x,o.y,s.x,s.y),t&&t.quadraticCurveTo(o.x,o.y,s.x,s.y)}},{key:"pathT",value:function(t,e){var i=this.pathParser,n=r.pathT(i),a=n.current,o=n.controlPoint,s=n.currentPoint;i.addMarker(s,o,o),e.addQuadraticCurve(a.x,a.y,o.x,o.y,s.x,s.y),t&&t.quadraticCurveTo(o.x,o.y,s.x,s.y)}},{key:"pathA",value:function(t,e){var i=this.pathParser,n=r.pathA(i),a=n.currentPoint,o=n.rX,s=n.rY,u=n.sweepFlag,l=n.xAxisRotation,h=n.centp,c=n.a1,f=n.ad,g=1-u?1:-1,v=c+g*(f/2),y=new Mt(h.x+o*Math.cos(v),h.y+s*Math.sin(v));if(i.addMarkerAngle(y,v-g*Math.PI/2),i.addMarkerAngle(a,v-g*Math.PI),e.addPoint(a.x,a.y),t&&!isNaN(c)&&!isNaN(f)){var d=o>s?o:s,p=o>s?1:o/s,m=o>s?s/o:1;t.translate(h.x,h.y),t.rotate(l),t.scale(p,m),t.arc(0,0,d,c,c+f,Boolean(1-u)),t.scale(1/p,1/m),t.rotate(-l),t.translate(-h.x,-h.y)}}},{key:"pathZ",value:function(t,e){r.pathZ(this.pathParser),t&&e.x1!==e.x2&&e.y1!==e.y2&&t.closePath()}}],[{key:"pathM",value:function(t){var e=t.getAsCurrentPoint();return t.start=t.current,{point:e}}},{key:"pathL",value:function(t){return{current:t.current,point:t.getAsCurrentPoint()}}},{key:"pathH",value:function(t){var e=t.current,r=t.command,i=new Mt((r.relative?e.x:0)+r.x,e.y);return t.current=i,{current:e,point:i}}},{key:"pathV",value:function(t){var e=t.current,r=t.command,i=new Mt(e.x,(r.relative?e.y:0)+r.y);return t.current=i,{current:e,point:i}}},{key:"pathC",value:function(t){return{current:t.current,point:t.getPoint("x1","y1"),controlPoint:t.getAsControlPoint("x2","y2"),currentPoint:t.getAsCurrentPoint()}}},{key:"pathS",value:function(t){return{current:t.current,point:t.getReflectedControlPoint(),controlPoint:t.getAsControlPoint("x2","y2"),currentPoint:t.getAsCurrentPoint()}}},{key:"pathQ",value:function(t){return{current:t.current,controlPoint:t.getAsControlPoint("x1","y1"),currentPoint:t.getAsCurrentPoint()}}},{key:"pathT",value:function(t){var e=t.current,r=t.getReflectedControlPoint();return t.control=r,{current:e,controlPoint:r,currentPoint:t.getAsCurrentPoint()}}},{key:"pathA",value:function(t){var e=t.current,r=t.command,i=r.rX,n=r.rY,a=r.xRot,o=r.lArcFlag,s=r.sweepFlag,u=a*(Math.PI/180),l=t.getAsCurrentPoint(),h=new Mt(Math.cos(u)*(e.x-l.x)/2+Math.sin(u)*(e.y-l.y)/2,-Math.sin(u)*(e.x-l.x)/2+Math.cos(u)*(e.y-l.y)/2),c=Math.pow(h.x,2)/Math.pow(i,2)+Math.pow(h.y,2)/Math.pow(n,2);c>1&&(i*=Math.sqrt(c),n*=Math.sqrt(c));var f=(o===s?-1:1)*Math.sqrt((Math.pow(i,2)*Math.pow(n,2)-Math.pow(i,2)*Math.pow(h.y,2)-Math.pow(n,2)*Math.pow(h.x,2))/(Math.pow(i,2)*Math.pow(h.y,2)+Math.pow(n,2)*Math.pow(h.x,2)));isNaN(f)&&(f=0);var g=new Mt(f*i*h.y/n,f*-n*h.x/i),v=new Mt((e.x+l.x)/2+Math.cos(u)*g.x-Math.sin(u)*g.y,(e.y+l.y)/2+Math.sin(u)*g.x+Math.cos(u)*g.y),y=bt([1,0],[(h.x-g.x)/i,(h.y-g.y)/n]),d=[(h.x-g.x)/i,(h.y-g.y)/n],p=[(-h.x-g.x)/i,(-h.y-g.y)/n],m=bt(d,p);return xt(d,p)<=-1&&(m=Math.PI),xt(d,p)>=1&&(m=0),{currentPoint:l,rX:i,rY:n,sweepFlag:s,xAxisRotation:u,centp:v,a1:y,ad:m}}},{key:"pathZ",value:function(t){t.current=t.start}}]),r}(te),oe=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];return(t=e.call.apply(e,[this].concat(n))).type="svg",t.root=!1,t}return y(r,[{key:"setContext",value:function(t){var e,i=this.document,a=i.screen,o=i.window,s=t.canvas;if(a.setDefaults(t),"style"in s&&void 0!==t.font&&o&&void 0!==o.getComputedStyle){t.font=o.getComputedStyle(s).getPropertyValue("font");var u=new Pt(i,"fontSize",Kt.parse(t.font).fontSize);u.hasValue()&&(i.rootEmSize=u.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 l=a.viewPort,h=l.width,c=l.height;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 g=this.getAttribute("refX"),v=this.getAttribute("refY"),y=this.getAttribute("viewBox"),d=y.hasValue()?at(y.getString()):null,p=!this.root&&"visible"!==this.getStyle("overflow").getValue("hidden"),m=0,x=0,b=0,w=0;d&&(m=d[0],x=d[1]),this.root||(h=this.getStyle("width").getPixels("x"),c=this.getStyle("height").getPixels("y"),"marker"===this.type&&(b=m,w=x,m=0,x=0)),a.viewPort.setCurrent(h,c),!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%"),n(f(r.prototype),"setContext",this).call(this,t),t.translate(this.getAttribute("x").getPixels("x"),this.getAttribute("y").getPixels("y")),d&&(h=d[2],c=d[3]),i.setViewBox({ctx:t,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:a.viewPort.width,desiredWidth:h,height:a.viewPort.height,desiredHeight:c,minX:m,minY:x,refX:g.getValue(),refY:v.getValue(),clip:p,clipX:b,clipY:w}),d&&(a.viewPort.removeCurrent(),a.viewPort.setCurrent(h,c))}},{key:"clearContext",value:function(t){n(f(r.prototype),"clearContext",this).call(this,t),this.document.screen.viewPort.removeCurrent()}},{key:"resize",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=this.getAttribute("width",!0),n=this.getAttribute("height",!0),a=this.getAttribute("viewBox"),o=this.getAttribute("style"),s=i.getNumber(0),u=n.getNumber(0);if(r)if("string"==typeof r)this.getAttribute("preserveAspectRatio",!0).setValue(r);else{var l=this.getAttribute("preserveAspectRatio");l.hasValue()&&l.setValue(l.getString().replace(/^\s*(\S.*\S)\s*$/,"$1"))}if(i.setValue(t),n.setValue(e),a.hasValue()||a.setValue("0 0 ".concat(s||t," ").concat(u||e)),o.hasValue()){var h=this.getStyle("width"),c=this.getStyle("height");h.hasValue()&&h.setValue("".concat(t,"px")),c.hasValue()&&c.setValue("".concat(e,"px"))}}}]),r}(te),se=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];return(t=e.call.apply(e,[this].concat(n))).type="rect",t}return y(r,[{key:"path",value:function(t){var e=this.getAttribute("x").getPixels("x"),r=this.getAttribute("y").getPixels("y"),i=this.getStyle("width",!1,!0).getPixels("x"),n=this.getStyle("height",!1,!0).getPixels("y"),a=this.getAttribute("rx"),o=this.getAttribute("ry"),s=a.getPixels("x"),u=o.getPixels("y");if(a.hasValue()&&!o.hasValue()&&(u=s),o.hasValue()&&!a.hasValue()&&(s=u),s=Math.min(s,i/2),u=Math.min(u,n/2),t){var l=(Math.sqrt(2)-1)/3*4;t.beginPath(),n>0&&i>0&&(t.moveTo(e+s,r),t.lineTo(e+i-s,r),t.bezierCurveTo(e+i-s+l*s,r,e+i,r+u-l*u,e+i,r+u),t.lineTo(e+i,r+n-u),t.bezierCurveTo(e+i,r+n-u+l*u,e+i-s+l*s,r+n,e+i-s,r+n),t.lineTo(e+s,r+n),t.bezierCurveTo(e+s-l*s,r+n,e,r+n-u+l*u,e,r+n-u),t.lineTo(e,r+u),t.bezierCurveTo(e,r+u-l*u,e+s-l*s,r,e+s,r),t.closePath())}return new Jt(e,r,e+i,r+n)}},{key:"getMarkers",value:function(){return null}}]),r}(ae),ue=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];return(t=e.call.apply(e,[this].concat(n))).type="circle",t}return y(r,[{key:"path",value:function(t){var e=this.getAttribute("cx").getPixels("x"),r=this.getAttribute("cy").getPixels("y"),i=this.getAttribute("r").getPixels();return t&&i>0&&(t.beginPath(),t.arc(e,r,i,0,2*Math.PI,!1),t.closePath()),new Jt(e-i,r-i,e+i,r+i)}},{key:"getMarkers",value:function(){return null}}]),r}(ae),le=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];return(t=e.call.apply(e,[this].concat(n))).type="ellipse",t}return y(r,[{key:"path",value:function(t){var e=(Math.sqrt(2)-1)/3*4,r=this.getAttribute("rx").getPixels("x"),i=this.getAttribute("ry").getPixels("y"),n=this.getAttribute("cx").getPixels("x"),a=this.getAttribute("cy").getPixels("y");return t&&r>0&&i>0&&(t.beginPath(),t.moveTo(n+r,a),t.bezierCurveTo(n+r,a+e*i,n+e*r,a+i,n,a+i),t.bezierCurveTo(n-e*r,a+i,n-r,a+e*i,n-r,a),t.bezierCurveTo(n-r,a-e*i,n-e*r,a-i,n,a-i),t.bezierCurveTo(n+e*r,a-i,n+r,a-e*i,n+r,a),t.closePath()),new Jt(n-r,a-i,n+r,a+i)}},{key:"getMarkers",value:function(){return null}}]),r}(ae),he=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];return(t=e.call.apply(e,[this].concat(n))).type="line",t}return y(r,[{key:"getPoints",value:function(){return[new Mt(this.getAttribute("x1").getPixels("x"),this.getAttribute("y1").getPixels("y")),new Mt(this.getAttribute("x2").getPixels("x"),this.getAttribute("y2").getPixels("y"))]}},{key:"path",value:function(t){var e=d(this.getPoints(),2),r=e[0],i=r.x,n=r.y,a=e[1],o=a.x,s=a.y;return t&&(t.beginPath(),t.moveTo(i,n),t.lineTo(o,s)),new Jt(i,n,o,s)}},{key:"getMarkers",value:function(){var t=d(this.getPoints(),2),e=t[0],r=t[1],i=e.angleTo(r);return[[e,i],[r,i]]}}]),r}(ae),ce=function(t){s(r,t);var e=l(r);function r(t,i,n){var a;return g(this,r),(a=e.call(this,t,i,n)).type="polyline",a.points=[],a.points=Mt.parsePath(a.getAttribute("points").getString()),a}return y(r,[{key:"path",value:function(t){var e=this.points,r=d(e,1)[0],i=r.x,n=r.y,a=new Jt(i,n);return t&&(t.beginPath(),t.moveTo(i,n)),e.forEach((function(e){var r=e.x,i=e.y;a.addPoint(r,i),t&&t.lineTo(r,i)})),a}},{key:"getMarkers",value:function(){var t=this.points,e=t.length-1,r=[];return t.forEach((function(i,n){n!==e&&r.push([i,i.angleTo(t[n+1])])})),r.length>0&&r.push([t[t.length-1],r[r.length-1][1]]),r}}]),r}(ae),fe=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];return(t=e.call.apply(e,[this].concat(n))).type="polygon",t}return y(r,[{key:"path",value:function(t){var e=n(f(r.prototype),"path",this).call(this,t),i=d(this.points,1)[0],a=i.x,o=i.y;return t&&(t.lineTo(a,o),t.closePath()),e}}]),r}(ce),ge=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];return(t=e.call.apply(e,[this].concat(n))).type="pattern",t}return y(r,[{key:"createPattern",value:function(t,e,r){var i=this.getStyle("width").getPixels("x",!0),n=this.getStyle("height").getPixels("y",!0),a=new oe(this.document,null);a.attributes.viewBox=new Pt(this.document,"viewBox",this.getAttribute("viewBox").getValue()),a.attributes.width=new Pt(this.document,"width","".concat(i,"px")),a.attributes.height=new Pt(this.document,"height","".concat(n,"px")),a.attributes.transform=new Pt(this.document,"transform",this.getAttribute("patternTransform").getValue()),a.children=this.children;var o=this.document.createCanvas(i,n),s=o.getContext("2d"),u=this.getAttribute("x"),l=this.getAttribute("y");u.hasValue()&&l.hasValue()&&s.translate(u.getPixels("x",!0),l.getPixels("y",!0)),r.hasValue()?this.styles["fill-opacity"]=r:Reflect.deleteProperty(this.styles,"fill-opacity");for(var h=-1;h<=1;h++)for(var c=-1;c<=1;c++)s.save(),a.attributes.x=new Pt(this.document,"x",h*o.width),a.attributes.y=new Pt(this.document,"y",c*o.height),a.render(s),s.restore();return t.createPattern(o,"repeat")}}]),r}(Wt),ve=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];return(t=e.call.apply(e,[this].concat(n))).type="marker",t}return y(r,[{key:"render",value:function(t,e,r){if(e){var i=e.x,n=e.y,a=this.getAttribute("orient").getString("auto"),o=this.getAttribute("markerUnits").getString("strokeWidth");t.translate(i,n),"auto"===a&&t.rotate(r),"strokeWidth"===o&&t.scale(t.lineWidth,t.lineWidth),t.save();var s=new oe(this.document);s.type=this.type,s.attributes.viewBox=new Pt(this.document,"viewBox",this.getAttribute("viewBox").getValue()),s.attributes.refX=new Pt(this.document,"refX",this.getAttribute("refX").getValue()),s.attributes.refY=new Pt(this.document,"refY",this.getAttribute("refY").getValue()),s.attributes.width=new Pt(this.document,"width",this.getAttribute("markerWidth").getValue()),s.attributes.height=new Pt(this.document,"height",this.getAttribute("markerHeight").getValue()),s.attributes.overflow=new Pt(this.document,"overflow",this.getAttribute("overflow").getValue()),s.attributes.fill=new Pt(this.document,"fill",this.getAttribute("fill").getColor("black")),s.attributes.stroke=new Pt(this.document,"stroke",this.getAttribute("stroke").getValue("none")),s.children=this.children,s.render(t),t.restore(),"strokeWidth"===o&&t.scale(1/t.lineWidth,1/t.lineWidth),"auto"===a&&t.rotate(-r),t.translate(-i,-n)}}}]),r}(Wt),ye=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];return(t=e.call.apply(e,[this].concat(n))).type="defs",t}return y(r,[{key:"render",value:function(){}}]),r}(Wt),de=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];return(t=e.call.apply(e,[this].concat(n))).type="g",t}return y(r,[{key:"getBoundingBox",value:function(t){var e=new Jt;return this.children.forEach((function(r){e.addBoundingBox(r.getBoundingBox(t))})),e}}]),r}(te),pe=function(t){s(r,t);var e=l(r);function r(t,i,n){var a;g(this,r),(a=e.call(this,t,i,n)).attributesToInherit=["gradientUnits"],a.stops=[];var o=c(a),s=o.stops;return o.children.forEach((function(t){"stop"===t.type&&s.push(t)})),a}return y(r,[{key:"getGradientUnits",value:function(){return this.getAttribute("gradientUnits").getString("objectBoundingBox")}},{key:"createGradient",value:function(t,e,r){var i=this,n=this;this.getHrefAttribute().hasValue()&&(n=this.getHrefAttribute().getDefinition(),this.inheritStopContainer(n));var a=n.stops,o=this.getGradient(t,e);if(!o)return this.addParentOpacity(r,a[a.length-1].color);if(a.forEach((function(t){o.addColorStop(t.offset,i.addParentOpacity(r,t.color))})),this.getAttribute("gradientTransform").hasValue()){var s=this.document,u=It.MAX_VIRTUAL_PIXELS,l=s.screen.viewPort.getRoot(),h=new se(s);h.attributes.x=new Pt(s,"x",-u/3),h.attributes.y=new Pt(s,"y",-u/3),h.attributes.width=new Pt(s,"width",u),h.attributes.height=new Pt(s,"height",u);var c=new de(s);c.attributes.transform=new Pt(s,"transform",this.getAttribute("gradientTransform").getValue()),c.children=[h];var f=new oe(s);f.attributes.x=new Pt(s,"x",0),f.attributes.y=new Pt(s,"y",0),f.attributes.width=new Pt(s,"width",l.width),f.attributes.height=new Pt(s,"height",l.height),f.children=[c];var g=s.createCanvas(l.width,l.height),v=g.getContext("2d");return v.fillStyle=o,f.render(v),v.createPattern(g,"no-repeat")}return o}},{key:"inheritStopContainer",value:function(t){var e=this;this.attributesToInherit.forEach((function(r){!e.getAttribute(r).hasValue()&&t.getAttribute(r).hasValue()&&e.getAttribute(r,!0).setValue(t.getAttribute(r).getValue())}))}},{key:"addParentOpacity",value:function(t,e){return t.hasValue()?new Pt(this.document,"color",e).addOpacity(t).getColor():e}}]),r}(Wt),me=function(t){s(r,t);var e=l(r);function r(t,i,n){var a;return g(this,r),(a=e.call(this,t,i,n)).type="linearGradient",a.attributesToInherit.push("x1","y1","x2","y2"),a}return y(r,[{key:"getGradient",value:function(t,e){var r="objectBoundingBox"===this.getGradientUnits(),i=r?e.getBoundingBox(t):null;if(r&&!i)return null;this.getAttribute("x1").hasValue()||this.getAttribute("y1").hasValue()||this.getAttribute("x2").hasValue()||this.getAttribute("y2").hasValue()||(this.getAttribute("x1",!0).setValue(0),this.getAttribute("y1",!0).setValue(0),this.getAttribute("x2",!0).setValue(1),this.getAttribute("y2",!0).setValue(0));var n=r?i.x+i.width*this.getAttribute("x1").getNumber():this.getAttribute("x1").getPixels("x"),a=r?i.y+i.height*this.getAttribute("y1").getNumber():this.getAttribute("y1").getPixels("y"),o=r?i.x+i.width*this.getAttribute("x2").getNumber():this.getAttribute("x2").getPixels("x"),s=r?i.y+i.height*this.getAttribute("y2").getNumber():this.getAttribute("y2").getPixels("y");return n===o&&a===s?null:t.createLinearGradient(n,a,o,s)}}]),r}(pe),xe=function(t){s(r,t);var e=l(r);function r(t,i,n){var a;return g(this,r),(a=e.call(this,t,i,n)).type="radialGradient",a.attributesToInherit.push("cx","cy","r","fx","fy","fr"),a}return y(r,[{key:"getGradient",value:function(t,e){var r="objectBoundingBox"===this.getGradientUnits(),i=e.getBoundingBox(t);if(r&&!i)return null;this.getAttribute("cx").hasValue()||this.getAttribute("cx",!0).setValue("50%"),this.getAttribute("cy").hasValue()||this.getAttribute("cy",!0).setValue("50%"),this.getAttribute("r").hasValue()||this.getAttribute("r",!0).setValue("50%");var n=r?i.x+i.width*this.getAttribute("cx").getNumber():this.getAttribute("cx").getPixels("x"),a=r?i.y+i.height*this.getAttribute("cy").getNumber():this.getAttribute("cy").getPixels("y"),o=n,s=a;this.getAttribute("fx").hasValue()&&(o=r?i.x+i.width*this.getAttribute("fx").getNumber():this.getAttribute("fx").getPixels("x")),this.getAttribute("fy").hasValue()&&(s=r?i.y+i.height*this.getAttribute("fy").getNumber():this.getAttribute("fy").getPixels("y"));var u=r?(i.width+i.height)/2*this.getAttribute("r").getNumber():this.getAttribute("r").getPixels(),l=this.getAttribute("fr").getPixels();return t.createRadialGradient(o,s,l,n,a,u)}}]),r}(pe),be=function(t){s(r,t);var e=l(r);function r(t,i,n){var a;g(this,r),(a=e.call(this,t,i,n)).type="stop";var o=Math.max(0,Math.min(1,a.getAttribute("offset").getNumber())),s=a.getStyle("stop-opacity"),u=a.getStyle("stop-color",!0);return""===u.getString()&&u.setValue("#000"),s.hasValue()&&(u=u.addOpacity(s)),a.offset=o,a.color=u.getColor(),a}return y(r)}(Wt),we=function(t){s(r,t);var e=l(r);function r(t,i,n){var a;g(this,r),(a=e.call(this,t,i,n)).type="animate",a.duration=0,a.initialUnits="",a.removed=!1,a.frozen=!1,t.screen.animations.push(c(a)),a.begin=a.getAttribute("begin").getMilliseconds(),a.maxDuration=a.begin+a.getAttribute("dur").getMilliseconds(),a.from=a.getAttribute("from"),a.to=a.getAttribute("to"),a.values=new Pt(t,"values",null);var o=a.getAttribute("values");return o.hasValue()&&a.values.setValue(o.getString().split(";")),a}return y(r,[{key:"getProperty",value:function(){var t=this.getAttribute("attributeType").getString(),e=this.getAttribute("attributeName").getString();return"CSS"===t?this.parent.getStyle(e,!0):this.parent.getAttribute(e,!0)}},{key:"calcValue",value:function(){var t=this.initialUnits,e=this.getProgress(),r=e.progress,i=e.from,n=e.to,a=i.getNumber()+(n.getNumber()-i.getNumber())*r;return"%"===t&&(a*=100),"".concat(a).concat(t)}},{key:"update",value:function(t){var e=this.parent,r=this.getProperty();if(this.initialValue||(this.initialValue=r.getString(),this.initialUnits=r.getUnits()),this.duration>this.maxDuration){var i=this.getAttribute("fill").getString("remove");if("indefinite"===this.getAttribute("repeatCount").getString()||"indefinite"===this.getAttribute("repeatDur").getString())this.duration=0;else if("freeze"!==i||this.frozen){if("remove"===i&&!this.removed)return this.removed=!0,e&&r&&r.setValue(e.animationFrozen?e.animationFrozenValue:this.initialValue),!0}else this.frozen=!0,e&&r&&(e.animationFrozen=!0,e.animationFrozenValue=r.getString());return!1}this.duration+=t;var n=!1;if(this.begin<this.duration){var a=this.calcValue(),o=this.getAttribute("type");if(o.hasValue()){var s=o.getString();a="".concat(s,"(").concat(a,")")}r.setValue(a),n=!0}return n}},{key:"getProgress",value:function(){var t,e,r=this.document,i=this.values,n=(this.duration-this.begin)/(this.maxDuration-this.begin);if(i.hasValue()){var a,o=n*(i.getValue().length-1),s=Math.floor(o),u=Math.ceil(o);a=i.getValue()[s],t=new Pt(r,"from",a?parseFloat(a):0),a=i.getValue()[u],e=new Pt(r,"to",a?parseFloat(a):0),n=(o-s)/(u-s)}else t=this.from,e=this.to;return{progress:n,from:t,to:e}}}]),r}(Wt),Se=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];return(t=e.call.apply(e,[this].concat(n))).type="animateColor",t}return y(r,[{key:"calcValue",value:function(){var t=this.getProgress(),e=t.progress,r=t.from,i=t.to,n=new M(r.getColor()),a=new M(i.getColor());if(n.ok&&a.ok){var o=n.r+(a.r-n.r)*e,s=n.g+(a.g-n.g)*e,u=n.b+(a.b-n.b)*e;return"rgb(".concat(Math.floor(o),", ").concat(Math.floor(s),", ").concat(Math.floor(u),")")}return this.getAttribute("from").getColor()}}]),r}(we),ke=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];return(t=e.call.apply(e,[this].concat(n))).type="animateTransform",t}return y(r,[{key:"calcValue",value:function(){var t=this.getProgress(),e=t.progress,r=t.from,i=t.to,n=at(r.getString()),a=at(i.getString()),o=n.map((function(t,r){return t+(a[r]-t)*e})).join(" ");return o}}]),r}(we),Te=function(t){s(r,t);var e=l(r);function r(t,i,n){var a;return g(this,r),(a=e.call(this,t,i,n)).type="font-face",a.ascent=a.getAttribute("ascent").getNumber(),a.descent=a.getAttribute("descent").getNumber(),a.unitsPerEm=a.getAttribute("units-per-em").getNumber(),a}return y(r)}(Wt),Ae=function(t){s(r,t);var e=l(r);function r(t,i,n){var a;return g(this,r),(a=e.call(this,t,i,n)).type="glyph",a.horizAdvX=a.getAttribute("horiz-adv-x").getNumber(),a.unicode=a.getAttribute("unicode").getString(),a.arabicForm=a.getAttribute("arabic-form").getString(),a}return y(r)}(ae),Ce=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];return(t=e.call.apply(e,[this].concat(n))).type="missing-glyph",t.horizAdvX=0,t}return y(r)}(Ae),Oe=function(t){s(n,t);var e=l(n);function n(t,a,o){var s;g(this,n),(s=e.call(this,t,a,o)).type="font",s.isArabic=!1,s.glyphs={},s.arabicGlyphs={},s.isRTL=!1,s.horizAdvX=s.getAttribute("horiz-adv-x").getNumber();var u,l=t.definitions,h=i(c(s).children);try{for(h.s();!(u=h.n()).done;){var f=u.value;if(f instanceof Te){s.fontFace=f;var v=f.getStyle("font-family");v.hasValue()&&(l[v.getString()]=c(s))}else if(f instanceof Ce)s.missingGlyph=f;else if(f instanceof Ae)if(f.arabicForm){s.isRTL=!0,s.isArabic=!0;var y=s.arabicGlyphs[f.unicode];void 0===y?s.arabicGlyphs[f.unicode]=r({},f.arabicForm,f):y[f.arabicForm]=f}else s.glyphs[f.unicode]=f}}catch(d){h.e(d)}finally{h.f()}return s}return y(n,[{key:"render",value:function(){}}]),n}(Wt),Pe=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];return(t=e.call.apply(e,[this].concat(n))).type="tref",t}return y(r,[{key:"getText",value:function(){var t=this.getHrefAttribute().getDefinition();if(t){var e=t.children[0];if(e)return e.getText()}return""}}]),r}(ee),Ee=function(t){s(r,t);var e=l(r);function r(t,i,n){var a;g(this,r),(a=e.call(this,t,i,n)).type="a";var o=i.childNodes,s=o[0],u=o.length>0&&Array.from(o).every((function(t){return 3===t.nodeType}));return a.hasText=u,a.text=u?a.getTextFromNode(s):"",a}return y(r,[{key:"getText",value:function(){return this.text}},{key:"renderChildren",value:function(t){if(this.hasText){n(f(r.prototype),"renderChildren",this).call(this,t);var e=this.document,i=this.x,a=this.y,o=e.screen.mouse,s=new Pt(e,"fontSize",Kt.parse(e.ctx.font).fontSize);o.isWorking()&&o.checkBoundingBox(this,new Jt(i,a-s.getPixels("y"),i+this.measureText(t),a))}else if(this.children.length>0){var u=new de(this.document);u.children=this.children,u.parent=this,u.render(t)}}},{key:"onClick",value:function(){var t=this.document.window;t&&t.open(this.getHrefAttribute().getString())}},{key:"onMouseMove",value:function(){this.document.ctx.canvas.style.cursor="pointer"}}]),r}(ee),Ne=function(t){s(n,t);var r=l(n);function n(t,e,i){var a;g(this,n),(a=r.call(this,t,e,i)).type="textPath",a.textWidth=0,a.textHeight=0,a.pathLength=-1,a.glyphInfo=null,a.letterSpacingCache=[],a.measuresCache=new Map([["",0]]);var o=a.getHrefAttribute().getDefinition();return a.text=a.getTextFromNode(),a.dataArray=a.parsePathData(o),a}return y(n,[{key:"getText",value:function(){return this.text}},{key:"path",value:function(t){var e=this.dataArray;t&&t.beginPath(),e.forEach((function(e){var r=e.type,i=e.points;switch(r){case ne.LINE_TO:t&&t.lineTo(i[0],i[1]);break;case ne.MOVE_TO:t&&t.moveTo(i[0],i[1]);break;case ne.CURVE_TO:t&&t.bezierCurveTo(i[0],i[1],i[2],i[3],i[4],i[5]);break;case ne.QUAD_TO:t&&t.quadraticCurveTo(i[0],i[1],i[2],i[3]);break;case ne.ARC:var n=d(i,8),a=n[0],o=n[1],s=n[2],u=n[3],l=n[4],h=n[5],c=n[6],f=n[7],g=s>u?s:u,v=s>u?1:s/u,y=s>u?u/s:1;t&&(t.translate(a,o),t.rotate(c),t.scale(v,y),t.arc(0,0,g,l,l+h,Boolean(1-f)),t.scale(1/v,1/y),t.rotate(-c),t.translate(-a,-o));break;case ne.CLOSE_PATH:t&&t.closePath()}}))}},{key:"renderChildren",value:function(t){this.setTextData(t),t.save();var e=this.parent.getStyle("text-decoration").getString(),r=this.getFontSize(),i=this.glyphInfo,n=t.fillStyle;"underline"===e&&t.beginPath(),i.forEach((function(i,n){var a=i.p0,o=i.p1,s=i.rotation,u=i.text;t.save(),t.translate(a.x,a.y),t.rotate(s),t.fillStyle&&t.fillText(u,0,0),t.strokeStyle&&t.strokeText(u,0,0),t.restore(),"underline"===e&&(0===n&&t.moveTo(a.x,a.y+r/8),t.lineTo(o.x,o.y+r/5))})),"underline"===e&&(t.lineWidth=r/20,t.strokeStyle=n,t.stroke(),t.closePath()),t.restore()}},{key:"getLetterSpacingAt",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.letterSpacingCache[t]||0}},{key:"findSegmentToFitChar",value:function(t,r,i,n,a,o,s,u,l){var h=o,c=this.measureText(t,u);" "===u&&"justify"===r&&i<n&&(c+=(n-i)/a),l>-1&&(h+=this.getLetterSpacingAt(l));var f=this.textHeight/20,g=this.getEquidistantPointOnPath(h,f,0),v=this.getEquidistantPointOnPath(h+c,f,0),y={p0:g,p1:v},d=g&&v?Math.atan2(v.y-g.y,v.x-g.x):0;if(s){var p=Math.cos(Math.PI/2+d)*s,m=Math.cos(-d)*s;y.p0=e(e({},g),{},{x:g.x+p,y:g.y+m}),y.p1=e(e({},v),{},{x:v.x+p,y:v.y+m})}return{offset:h+=c,segment:y,rotation:d}}},{key:"measureText",value:function(t,e){var r=this.measuresCache,i=e||this.getText();if(r.has(i))return r.get(i);var n=this.measureTargetText(t,i);return r.set(i,n),n}},{key:"setTextData",value:function(t){var e=this;if(!this.glyphInfo){var r=this.getText(),i=r.split(""),n=r.split(" ").length-1,a=this.parent.getAttribute("dx").split().map((function(t){return t.getPixels("x")})),o=this.parent.getAttribute("dy").getPixels("y"),s=this.parent.getStyle("text-anchor").getString("start"),u=this.getStyle("letter-spacing"),l=this.parent.getStyle("letter-spacing"),h=0;u.hasValue()&&"inherit"!==u.getValue()?u.hasValue()&&"initial"!==u.getValue()&&"unset"!==u.getValue()&&(h=u.getPixels()):h=l.getPixels();var c=[],f=r.length;this.letterSpacingCache=c;for(var g=0;g<f;g++)c.push(void 0!==a[g]?a[g]:h);var v=c.reduce((function(t,e,r){return 0===r?0:t+e||0}),0),y=this.measureText(t),d=Math.max(y+v,0);this.textWidth=y,this.textHeight=this.getFontSize(),this.glyphInfo=[];var p=this.getPathLength(),m=this.getStyle("startOffset").getNumber(0)*p,x=0;"middle"!==s&&"center"!==s||(x=-d/2),"end"!==s&&"right"!==s||(x=-d),x+=m,i.forEach((function(r,a){var u=e.findSegmentToFitChar(t,s,d,p,n,x,o,r,a),l=u.offset,h=u.segment,c=u.rotation;x=l,h.p0&&h.p1&&e.glyphInfo.push({text:i[a],p0:h.p0,p1:h.p1,rotation:c})}))}}},{key:"parsePathData",value:function(t){if(this.pathLength=-1,!t)return[];var e=[],r=t.pathParser;for(r.reset();!r.isEnd();){var i=r.current,n=i?i.x:0,a=i?i.y:0,o=r.next(),s=o.type,u=[];switch(o.type){case ne.MOVE_TO:this.pathM(r,u);break;case ne.LINE_TO:s=this.pathL(r,u);break;case ne.HORIZ_LINE_TO:s=this.pathH(r,u);break;case ne.VERT_LINE_TO:s=this.pathV(r,u);break;case ne.CURVE_TO:this.pathC(r,u);break;case ne.SMOOTH_CURVE_TO:s=this.pathS(r,u);break;case ne.QUAD_TO:this.pathQ(r,u);break;case ne.SMOOTH_QUAD_TO:s=this.pathT(r,u);break;case ne.ARC:u=this.pathA(r);break;case ne.CLOSE_PATH:ae.pathZ(r)}o.type!==ne.CLOSE_PATH?e.push({type:s,points:u,start:{x:n,y:a},pathLength:this.calcLength(n,a,s,u)}):e.push({type:ne.CLOSE_PATH,points:[],pathLength:0})}return e}},{key:"pathM",value:function(t,e){var r=ae.pathM(t).point,i=r.x,n=r.y;e.push(i,n)}},{key:"pathL",value:function(t,e){var r=ae.pathL(t).point,i=r.x,n=r.y;return e.push(i,n),ne.LINE_TO}},{key:"pathH",value:function(t,e){var r=ae.pathH(t).point,i=r.x,n=r.y;return e.push(i,n),ne.LINE_TO}},{key:"pathV",value:function(t,e){var r=ae.pathV(t).point,i=r.x,n=r.y;return e.push(i,n),ne.LINE_TO}},{key:"pathC",value:function(t,e){var r=ae.pathC(t),i=r.point,n=r.controlPoint,a=r.currentPoint;e.push(i.x,i.y,n.x,n.y,a.x,a.y)}},{key:"pathS",value:function(t,e){var r=ae.pathS(t),i=r.point,n=r.controlPoint,a=r.currentPoint;return e.push(i.x,i.y,n.x,n.y,a.x,a.y),ne.CURVE_TO}},{key:"pathQ",value:function(t,e){var r=ae.pathQ(t),i=r.controlPoint,n=r.currentPoint;e.push(i.x,i.y,n.x,n.y)}},{key:"pathT",value:function(t,e){var r=ae.pathT(t),i=r.controlPoint,n=r.currentPoint;return e.push(i.x,i.y,n.x,n.y),ne.QUAD_TO}},{key:"pathA",value:function(t){var e=ae.pathA(t),r=e.rX,i=e.rY,n=e.sweepFlag,a=e.xAxisRotation,o=e.centp,s=e.a1,u=e.ad;return 0===n&&u>0&&(u-=2*Math.PI),1===n&&u<0&&(u+=2*Math.PI),[o.x,o.y,r,i,s,u,a,n]}},{key:"calcLength",value:function(t,e,r,i){var n=0,a=null,o=null,s=0;switch(r){case ne.LINE_TO:return this.getLineLength(t,e,i[0],i[1]);case ne.CURVE_TO:for(n=0,a=this.getPointOnCubicBezier(0,t,e,i[0],i[1],i[2],i[3],i[4],i[5]),s=.01;s<=1;s+=.01)o=this.getPointOnCubicBezier(s,t,e,i[0],i[1],i[2],i[3],i[4],i[5]),n+=this.getLineLength(a.x,a.y,o.x,o.y),a=o;return n;case ne.QUAD_TO:for(n=0,a=this.getPointOnQuadraticBezier(0,t,e,i[0],i[1],i[2],i[3]),s=.01;s<=1;s+=.01)o=this.getPointOnQuadraticBezier(s,t,e,i[0],i[1],i[2],i[3]),n+=this.getLineLength(a.x,a.y,o.x,o.y),a=o;return n;case ne.ARC:n=0;var u=i[4],l=i[5],h=i[4]+l,c=Math.PI/180;if(Math.abs(u-h)<c&&(c=Math.abs(u-h)),a=this.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],u,0),l<0)for(s=u-c;s>h;s-=c)o=this.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],s,0),n+=this.getLineLength(a.x,a.y,o.x,o.y),a=o;else for(s=u+c;s<h;s+=c)o=this.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],s,0),n+=this.getLineLength(a.x,a.y,o.x,o.y),a=o;return o=this.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],h,0),n+=this.getLineLength(a.x,a.y,o.x,o.y)}return 0}},{key:"getPointOnLine",value:function(t,e,r,i,n){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:e,o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r,s=(n-r)/(i-e+pt),u=Math.sqrt(t*t/(1+s*s));i<e&&(u*=-1);var l=s*u,h=null;if(i===e)h={x:a,y:o+l};else if((o-r)/(a-e+pt)===s)h={x:a+u,y:o+l};else{var c=0,f=0,g=this.getLineLength(e,r,i,n);if(g<pt)return null;var v=(a-e)*(i-e)+(o-r)*(n-r);c=e+(v/=g*g)*(i-e),f=r+v*(n-r);var y=this.getLineLength(a,o,c,f),d=Math.sqrt(t*t-y*y);u=Math.sqrt(d*d/(1+s*s)),i<e&&(u*=-1),h={x:c+u,y:f+(l=s*u)}}return h}},{key:"getPointOnPath",value:function(t){var e=this.getPathLength(),r=0,n=null;if(t<-5e-5||t-5e-5>e)return null;var a,o=i(this.dataArray);try{for(o.s();!(a=o.n()).done;){var s=a.value;if(!s||!(s.pathLength<5e-5||r+s.pathLength+5e-5<t)){var u=t-r,l=0;switch(s.type){case ne.LINE_TO:n=this.getPointOnLine(u,s.start.x,s.start.y,s.points[0],s.points[1],s.start.x,s.start.y);break;case ne.ARC:var h=s.points[4],c=s.points[5],f=s.points[4]+c;if(l=h+u/s.pathLength*c,c<0&&l<f||c>=0&&l>f)break;n=this.getPointOnEllipticalArc(s.points[0],s.points[1],s.points[2],s.points[3],l,s.points[6]);break;case ne.CURVE_TO:(l=u/s.pathLength)>1&&(l=1),n=this.getPointOnCubicBezier(l,s.start.x,s.start.y,s.points[0],s.points[1],s.points[2],s.points[3],s.points[4],s.points[5]);break;case ne.QUAD_TO:(l=u/s.pathLength)>1&&(l=1),n=this.getPointOnQuadraticBezier(l,s.start.x,s.start.y,s.points[0],s.points[1],s.points[2],s.points[3])}if(n)return n;break}r+=s.pathLength}}catch(g){o.e(g)}finally{o.f()}return null}},{key:"getLineLength",value:function(t,e,r,i){return Math.sqrt((r-t)*(r-t)+(i-e)*(i-e))}},{key:"getPathLength",value:function(){return-1===this.pathLength&&(this.pathLength=this.dataArray.reduce((function(t,e){return e.pathLength>0?t+e.pathLength:t}),0)),this.pathLength}},{key:"getPointOnCubicBezier",value:function(t,e,r,i,n,a,o,s,u){return{x:s*wt(t)+a*St(t)+i*kt(t)+e*Tt(t),y:u*wt(t)+o*St(t)+n*kt(t)+r*Tt(t)}}},{key:"getPointOnQuadraticBezier",value:function(t,e,r,i,n,a,o){return{x:a*At(t)+i*Ct(t)+e*Ot(t),y:o*At(t)+n*Ct(t)+r*Ot(t)}}},{key:"getPointOnEllipticalArc",value:function(t,e,r,i,n,a){var o=Math.cos(a),s=Math.sin(a),u=r*Math.cos(n),l=i*Math.sin(n);return{x:t+(u*o-l*s),y:e+(u*s+l*o)}}},{key:"buildEquidistantCache",value:function(t,e){var r=this.getPathLength(),i=e||.25,n=t||r/100;if(!this.equidistantCache||this.equidistantCache.step!==n||this.equidistantCache.precision!==i){this.equidistantCache={step:n,precision:i,points:[]};for(var a=0,o=0;o<=r;o+=i){var s=this.getPointOnPath(o),u=this.getPointOnPath(o+i);s&&u&&((a+=this.getLineLength(s.x,s.y,u.x,u.y))>=n&&(this.equidistantCache.points.push({x:s.x,y:s.y,distance:o}),a-=n))}}}},{key:"getEquidistantPointOnPath",value:function(t,e,r){if(this.buildEquidistantCache(e,r),t<0||t-this.getPathLength()>5e-5)return null;var i=Math.round(t/this.getPathLength()*(this.equidistantCache.points.length-1));return this.equidistantCache.points[i]||null}}]),n}(ee),Me=/^\s*data:(([^/,;]+\/[^/,;]+)(?:;([^,;=]+=[^,;=]+))?)?(?:;(base64))?,(.*)$/i,Ve=function(t){s(n,t);var e,r,i=l(n);function n(t,e,r){var a;g(this,n),(a=i.call(this,t,e,r)).type="image",a.loaded=!1;var o=a.getHrefAttribute().getString();if(!o)return h(a);var s=o.endsWith(".svg")||/^\s*data:image\/svg\+xml/i.test(o);return t.images.push(c(a)),s?a.loadSvg(o):a.loadImage(o),a}return y(n,[{key:"loadImage",value:(r=b(regeneratorRuntime.mark((function t(e){var r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.document.createImage(e);case 3:r=t.sent,this.image=r,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),console.error('Error while loading image "'.concat(e,'":'),t.t0);case 10:this.loaded=!0;case 11:case"end":return t.stop()}}),t,this,[[0,7]])}))),function(t){return r.apply(this,arguments)})},{key:"loadSvg",value:(e=b(regeneratorRuntime.mark((function t(e){var r,i,n,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(r=Me.exec(e))){t.next=6;break}(i=r[5])&&("base64"===r[4]?this.image=atob(i):this.image=decodeURIComponent(i)),t.next=19;break;case 6:return t.prev=6,t.next=9,this.document.fetch(e);case 9:return n=t.sent,t.next=12,n.text();case 12:a=t.sent,this.image=a,t.next=19;break;case 16:t.prev=16,t.t0=t.catch(6),console.error('Error while loading image "'.concat(e,'":'),t.t0);case 19:this.loaded=!0;case 20:case"end":return t.stop()}}),t,this,[[6,16]])}))),function(t){return e.apply(this,arguments)})},{key:"renderChildren",value:function(t){var e=this.document,r=this.image,i=this.loaded,n=this.getAttribute("x").getPixels("x"),a=this.getAttribute("y").getPixels("y"),o=this.getStyle("width").getPixels("x"),s=this.getStyle("height").getPixels("y");if(i&&r&&o&&s){if(t.save(),t.translate(n,a),"string"==typeof r){var u=e.canvg.forkString(t,r,{ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:0,offsetY:0,scaleWidth:o,scaleHeight:s}),l=u.document.documentElement;l&&(l.parent=this),u.render()}else e.setViewBox({ctx:t,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:o,desiredWidth:r.width,height:s,desiredHeight:r.height}),this.loaded&&("complete"in r&&!r.complete||t.drawImage(r,0,0));t.restore()}}},{key:"getBoundingBox",value:function(){var t=this.getAttribute("x").getPixels("x"),e=this.getAttribute("y").getPixels("y"),r=this.getStyle("width").getPixels("x"),i=this.getStyle("height").getPixels("y");return new Jt(t,e,t+r,e+i)}}]),n}(te),_e=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];return(t=e.call.apply(e,[this].concat(n))).type="symbol",t}return y(r,[{key:"render",value:function(t){}}]),r}(te),Re=function(){function t(e){g(this,t),this.document=e,this.loaded=!1,e.fonts.push(this)}var e;return y(t,[{key:"load",value:(e=b(regeneratorRuntime.mark((function t(e,r){var i,n,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,i=this.document,t.next=4,i.canvg.parser.load(r);case 4:n=t.sent,a=n.getElementsByTagName("font"),Array.from(a).forEach((function(t){var r=i.createElement(t);i.definitions[e]=r})),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(0),console.error('Error while loading font "'.concat(r,'":'),t.t0);case 12:this.loaded=!0;case 13:case"end":return t.stop()}}),t,this,[[0,9]])}))),function(t,r){return e.apply(this,arguments)})}]),t}(),Ie=function(t){s(r,t);var e=l(r);function r(t,i,n){var a;g(this,r),(a=e.call(this,t,i,n)).type="style";var o=nt(Array.from(i.childNodes).map((function(t){return t.textContent})).join("").replace(/(\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm,"").replace(/@import.*;/g,""));return o.split("}").forEach((function(e){var r=e.trim();if(r){var i=r.split("{"),n=i[0].split(","),a=i[1].split(";");n.forEach((function(e){var r=e.trim();if(r){var i=t.styles[r]||{};if(a.forEach((function(e){var r=e.indexOf(":"),n=e.substr(0,r).trim(),a=e.substr(r+1,e.length-r).trim();n&&a&&(i[n]=new Pt(t,n,a))})),t.styles[r]=i,t.stylesSpecificity[r]=function(t){var e=[0,0,0],r=t.replace(/:not\(([^)]*)\)/g," $1 ").replace(/{[\s\S]*/gm," "),i=0,n=d(dt(r,lt),2);r=n[0],i=n[1],e[1]+=i;var a=d(dt(r,ht),2);r=a[0],i=a[1],e[0]+=i;var o=d(dt(r,ct),2);r=o[0],i=o[1],e[1]+=i;var s=d(dt(r,ft),2);r=s[0],i=s[1],e[2]+=i;var u=d(dt(r,gt),2);r=u[0],i=u[1],e[1]+=i;var l=d(dt(r,vt),2);r=l[0],i=l[1],e[1]+=i;var h=d(dt(r=r.replace(/[*\s+>~]/g," ").replace(/[#.]/g," "),yt),2);return r=h[0],i=h[1],e[2]+=i,e.join("")}(r),"@font-face"===r){var n=i["font-family"].getString().replace(/"|'/g,"");i.src.getString().split(",").forEach((function(e){if(e.indexOf('format("svg")')>0){var r=ut(e);r&&new Re(t).load(n,r)}}))}}}))}})),a}return y(r)}(Wt);Ie.parseExternalUrl=ut;var Le=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];return(t=e.call.apply(e,[this].concat(n))).type="use",t}return y(r,[{key:"setContext",value:function(t){n(f(r.prototype),"setContext",this).call(this,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"))}},{key:"path",value:function(t){var e=this.element;e&&e.path(t)}},{key:"renderChildren",value:function(t){var e=this.document,r=this.element;if(r){var i=r;if("symbol"===r.type&&((i=new oe(e)).attributes.viewBox=new Pt(e,"viewBox",r.getAttribute("viewBox").getString()),i.attributes.preserveAspectRatio=new Pt(e,"preserveAspectRatio",r.getAttribute("preserveAspectRatio").getString()),i.attributes.overflow=new Pt(e,"overflow",r.getAttribute("overflow").getString()),i.children=r.children,r.styles.opacity=new Pt(e,"opacity",this.calculateOpacity())),"svg"===i.type){var n=this.getStyle("width",!1,!0),a=this.getStyle("height",!1,!0);n.hasValue()&&(i.attributes.width=new Pt(e,"width",n.getString())),a.hasValue()&&(i.attributes.height=new Pt(e,"height",a.getString()))}var o=i.parent;i.parent=this,i.render(t),i.parent=o}}},{key:"getBoundingBox",value:function(t){var e=this.element;return e?e.getBoundingBox(t):null}},{key:"elementTransform",value:function(){var t=this.document,e=this.element;return e?jt.fromElement(t,e):null}},{key:"element",get:function(){return this.cachedElement||(this.cachedElement=this.getHrefAttribute().getDefinition()),this.cachedElement}}]),r}(te);function Be(t,e,r,i,n,a){return t[r*i*4+4*e+a]}function De(t,e,r,i,n,a,o){t[r*i*4+4*e+a]=o}function He(t,e,r){return t[e]*r}function ze(t,e,r,i){return e+Math.cos(t)*r+Math.sin(t)*i}var Fe=function(t){s(r,t);var e=l(r);function r(t,i,n){var a;g(this,r),(a=e.call(this,t,i,n)).type="feColorMatrix";var o=at(a.getAttribute("values").getString());switch(a.getAttribute("type").getString("matrix")){case"saturate":var s=o[0];o=[.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 u=o[0]*Math.PI/180;o=[ze(u,.213,.787,-.213),ze(u,.715,-.715,-.715),ze(u,.072,-.072,.928),0,0,ze(u,.213,-.213,.143),ze(u,.715,.285,.14),ze(u,.072,-.072,-.283),0,0,ze(u,.213,-.213,-.787),ze(u,.715,-.715,.715),ze(u,.072,.928,.072),0,0,0,0,0,1,0,0,0,0,0,1];break;case"luminanceToAlpha":o=[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]}return a.matrix=o,a.includeOpacity=a.getAttribute("includeOpacity").hasValue(),a}return y(r,[{key:"apply",value:function(t,e,r,i,n){for(var a=this.includeOpacity,o=this.matrix,s=t.getImageData(0,0,i,n),u=0;u<n;u++)for(var l=0;l<i;l++){var h=Be(s.data,l,u,i,0,0),c=Be(s.data,l,u,i,0,1),f=Be(s.data,l,u,i,0,2),g=Be(s.data,l,u,i,0,3),v=He(o,0,h)+He(o,1,c)+He(o,2,f)+He(o,3,g)+He(o,4,1),y=He(o,5,h)+He(o,6,c)+He(o,7,f)+He(o,8,g)+He(o,9,1),d=He(o,10,h)+He(o,11,c)+He(o,12,f)+He(o,13,g)+He(o,14,1),p=He(o,15,h)+He(o,16,c)+He(o,17,f)+He(o,18,g)+He(o,19,1);a&&(v=0,y=0,d=0,p*=g/255),De(s.data,l,u,i,0,0,v),De(s.data,l,u,i,0,1,y),De(s.data,l,u,i,0,2,d),De(s.data,l,u,i,0,3,p)}t.clearRect(0,0,i,n),t.putImageData(s,0,0)}}]),r}(Wt),Ue=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];return(t=e.call.apply(e,[this].concat(n))).type="mask",t}return y(r,[{key:"apply",value:function(t,e){var i=this.document,n=this.getAttribute("x").getPixels("x"),a=this.getAttribute("y").getPixels("y"),o=this.getStyle("width").getPixels("x"),s=this.getStyle("height").getPixels("y");if(!o&&!s){var u=new Jt;this.children.forEach((function(e){u.addBoundingBox(e.getBoundingBox(t))})),n=Math.floor(u.x1),a=Math.floor(u.y1),o=Math.floor(u.width),s=Math.floor(u.height)}var l=this.removeStyles(e,r.ignoreStyles),h=i.createCanvas(n+o,a+s),c=h.getContext("2d");i.screen.setDefaults(c),this.renderChildren(c),new Fe(i,{nodeType:1,childNodes:[],attributes:[{nodeName:"type",value:"luminanceToAlpha"},{nodeName:"includeOpacity",value:"true"}]}).apply(c,0,0,n+o,a+s);var f=i.createCanvas(n+o,a+s),g=f.getContext("2d");i.screen.setDefaults(g),e.render(g),g.globalCompositeOperation="destination-in",g.fillStyle=c.createPattern(h,"no-repeat"),g.fillRect(0,0,n+o,a+s),t.fillStyle=g.createPattern(f,"no-repeat"),t.fillRect(0,0,n+o,a+s),this.restoreStyles(e,l)}},{key:"render",value:function(t){}}]),r}(Wt);Ue.ignoreStyles=["mask","transform","clip-path"];var Xe=function(){},Ye=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];return(t=e.call.apply(e,[this].concat(n))).type="clipPath",t}return y(r,[{key:"apply",value:function(t){var e=this.document,r=Reflect.getPrototypeOf(t),i=t.beginPath,n=t.closePath;r&&(r.beginPath=Xe,r.closePath=Xe),Reflect.apply(i,t,[]),this.children.forEach((function(i){if("path"in i){var a="elementTransform"in i?i.elementTransform():null;a||(a=jt.fromElement(e,i)),a&&a.apply(t),i.path(t),r&&(r.closePath=n),a&&a.unapply(t)}})),Reflect.apply(n,t,[]),t.clip(),r&&(r.beginPath=i,r.closePath=n)}},{key:"render",value:function(t){}}]),r}(Wt),qe=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];return(t=e.call.apply(e,[this].concat(n))).type="filter",t}return y(r,[{key:"apply",value:function(t,e){var i=this.document,n=this.children,a="getBoundingBox"in e?e.getBoundingBox(t):null;if(a){var o=0,s=0;n.forEach((function(t){var e=t.extraFilterDistance||0;o=Math.max(o,e),s=Math.max(s,e)}));var u=Math.floor(a.width),l=Math.floor(a.height),h=u+2*o,c=l+2*s;if(!(h<1||c<1)){var f=Math.floor(a.x),g=Math.floor(a.y),v=this.removeStyles(e,r.ignoreStyles),y=i.createCanvas(h,c),d=y.getContext("2d");i.screen.setDefaults(d),d.translate(-f+o,-g+s),e.render(d),n.forEach((function(t){"function"==typeof t.apply&&t.apply(d,0,0,h,c)})),t.drawImage(y,0,0,h,c,f-o,g-s,h,c),this.restoreStyles(e,v)}}}},{key:"render",value:function(t){}}]),r}(Wt);qe.ignoreStyles=["filter","transform","clip-path"];var je=function(t){s(r,t);var e=l(r);function r(t,i,n){var a;return g(this,r),(a=e.call(this,t,i,n)).type="feDropShadow",a.addStylesFromStyleDefinition(),a}return y(r,[{key:"apply",value:function(t,e,r,i,n){}}]),r}(Wt),We=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];return(t=e.call.apply(e,[this].concat(n))).type="feMorphology",t}return y(r,[{key:"apply",value:function(t,e,r,i,n){}}]),r}(Wt),Qe=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];return(t=e.call.apply(e,[this].concat(n))).type="feComposite",t}return y(r,[{key:"apply",value:function(t,e,r,i,n){}}]),r}(Wt),Ge=function(t){s(r,t);var e=l(r);function r(t,i,n){var a;return g(this,r),(a=e.call(this,t,i,n)).type="feGaussianBlur",a.blurRadius=Math.floor(a.getAttribute("stdDeviation").getNumber()),a.extraFilterDistance=a.blurRadius,a}return y(r,[{key:"apply",value:function(t,e,r,i,n){var a=this.document,o=this.blurRadius,s=a.window?a.window.document.body:null,u=t.canvas;u.id=a.getUniqueId(),s&&(u.style.display="none",s.appendChild(u)),et(u,e,r,i,n,o),s&&s.removeChild(u)}}]),r}(Wt),$e=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];return(t=e.call.apply(e,[this].concat(n))).type="title",t}return y(r)}(Wt),Ze=function(t){s(r,t);var e=l(r);function r(){var t;g(this,r);for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];return(t=e.call.apply(e,[this].concat(n))).type="desc",t}return y(r)}(Wt),Ke={svg:oe,rect:se,circle:ue,ellipse:le,line:he,polyline:ce,polygon:fe,path:ae,pattern:ge,marker:ve,defs:ye,linearGradient:me,radialGradient:xe,stop:be,animate:we,animateColor:Se,animateTransform:ke,font:Oe,"font-face":Te,"missing-glyph":Ce,glyph:Ae,text:ee,tspan:re,tref:Pe,a:Ee,textPath:Ne,image:Ve,g:de,symbol:_e,style:Ie,use:Le,mask:Ue,clipPath:Ye,filter:qe,feDropShadow:je,feMorphology:We,feComposite:Qe,feColorMatrix:Fe,feGaussianBlur:Ge,title:$e,desc:Ze};function Je(){return Je=b(regeneratorRuntime.mark((function t(e){var r,i,n=arguments;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=n.length>1&&void 0!==n[1]&&n[1],i=document.createElement("img"),r&&(i.crossOrigin="Anonymous"),t.abrupt("return",new Promise((function(t,r){i.onload=function(){t(i)},i.onerror=function(t,e,i,n,a){r(a)},i.src=e})));case 4:case"end":return t.stop()}}),t)}))),Je.apply(this,arguments)}var tr=function(){function t(e){var r=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=i.rootEmSize,a=void 0===n?12:n,o=i.emSize,s=void 0===o?12:o,u=i.createCanvas,l=void 0===u?t.createCanvas:u,h=i.createImage,c=void 0===h?t.createImage:h,f=i.anonymousCrossOrigin;g(this,t),this.canvg=e,this.definitions={},this.styles={},this.stylesSpecificity={},this.images=[],this.fonts=[],this.emSizeStack=[],this.uniqueId=0,this.screen=e.screen,this.rootEmSize=a,this.emSize=s,this.createCanvas=l,this.createImage=this.bindCreateImage(c,f),this.screen.wait((function(){return r.isImagesLoaded()})),this.screen.wait((function(){return r.isFontsLoaded()}))}return y(t,[{key:"bindCreateImage",value:function(t,e){return"boolean"==typeof e?function(r,i){return t(r,"boolean"==typeof i?i:e)}:t}},{key:"window",get:function(){return this.screen.window}},{key:"fetch",get:function(){return this.screen.fetch}},{key:"ctx",get:function(){return this.screen.ctx}},{key:"emSize",get:function(){var t=this.emSizeStack;return t[t.length-1]||12},set:function(t){this.emSizeStack.push(t)}},{key:"popEmSize",value:function(){this.emSizeStack.pop()}},{key:"getUniqueId",value:function(){return"canvg".concat(++this.uniqueId)}},{key:"isImagesLoaded",value:function(){return this.images.every((function(t){return t.loaded}))}},{key:"isFontsLoaded",value:function(){return this.fonts.every((function(t){return t.loaded}))}},{key:"createDocumentElement",value:function(t){var e=this.createElement(t.documentElement);return e.root=!0,e.addStylesFromStyleDefinition(),this.documentElement=e,e}},{key:"createElement",value:function(e){var r=e.nodeName.replace(/^[^:]+:/,""),i=t.elementTypes[r];return i?new i(this,e):new Qt(this,e)}},{key:"createTextNode",value:function(t){return new ie(this,t)}},{key:"setViewBox",value:function(t){this.screen.setViewBox(e({document:this},t))}}]),t}();tr.createCanvas=function(t,e){var r=document.createElement("canvas");return r.width=t,r.height=e,r},tr.createImage=function(t){return Je.apply(this,arguments)},tr.elementTypes=Ke;var er=function(){function t(e,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};g(this,t),this.parser=new Dt(i),this.screen=new It(e,i),this.options=i;var n=new tr(this,i),a=n.createDocumentElement(r);this.document=n,this.documentElement=a}var r,i;return y(t,[{key:"fork",value:function(r,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.from(r,i,e(e({},this.options),n))}},{key:"forkString",value:function(r,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.fromString(r,i,e(e({},this.options),n))}},{key:"ready",value:function(){return this.screen.ready()}},{key:"isReady",value:function(){return this.screen.isReady()}},{key:"render",value:(i=b(regeneratorRuntime.mark((function t(){var r,i=arguments;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=i.length>0&&void 0!==i[0]?i[0]:{},this.start(e({enableRedraw:!0,ignoreAnimation:!0,ignoreMouse:!0},r)),t.next=4,this.ready();case 4:this.stop();case 5:case"end":return t.stop()}}),t,this)}))),function(){return i.apply(this,arguments)})},{key:"start",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=this.documentElement,i=this.screen,n=this.options;i.start(r,e(e({enableRedraw:!0},n),t))}},{key:"stop",value:function(){this.screen.stop()}},{key:"resize",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.documentElement.resize(t,e,r)}}],[{key:"from",value:(r=b(regeneratorRuntime.mark((function e(r,i){var n,a,o,s=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s.length>2&&void 0!==s[2]?s[2]:{},a=new Dt(n),e.next=4,a.parse(i);case 4:return o=e.sent,e.abrupt("return",new t(r,o,n));case 6:case"end":return e.stop()}}),e)}))),function(t,e){return r.apply(this,arguments)})},{key:"fromString",value:function(e,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=new Dt(i),a=n.parseFromString(r);return new t(e,a,i)}}]),t}();window.OffscreenCanvas||(window.OffscreenCanvas=y((function t(e,r){var i=this;return g(this,t),this.canvas=document.createElement("canvas"),this.canvas.width=e,this.canvas.height=r,this.canvas.convertToBlob=function(){return new Promise((function(t){i.canvas.toBlob(t)}))},this.canvas})));var rr=it.offscreen(),ir=function(t){return new Promise((function(e,r){var i=new FileReader;i.onloadend=function(){return e(i.result)},i.readAsDataURL(t)}))},nr=null,ar=(t("s",function(){var t=b(regeneratorRuntime.mark((function t(e,r,i){var n,a,o,s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return nr||(nr=new OffscreenCanvas(r,i)),n=nr.getContext("2d"),t.next=4,er.fromString(n,e,rr);case 4:return(a=t.sent).resize(2*r,2*i,"xMidYMid meet"),t.next=8,a.start();case 8:return t.next=10,nr.convertToBlob();case 10:return o=t.sent,t.next=13,ir(o);case 13:return s=t.sent,n.clearRect(0,0,nr.width,nr.height),t.next=17,a.stop();case 17:return a=null,t.abrupt("return",s);case 19:case"end":return t.stop()}}),t)})));return function(e,r,i){return t.apply(this,arguments)}}()),t("f",(function(t){if(!t)return"";var e,r=(new DOMParser).parseFromString(t,"text/xml"),n=-1,a=-1,o=i(r.getElementsByTagName("measure"));try{for(o.s();!(e=o.n()).done;){var s,u=e.value;-1===n&&u.getElementsByTagName("beats").length&&(n=parseInt(u.getElementsByTagName("beats")[0].textContent||"4")),-1===a&&u.getElementsByTagName("beat-type").length&&(a=parseInt(u.getElementsByTagName("beat-type")[0].textContent||"4"));var l=parseInt((null===(s=u.getElementsByTagName("divisions")[0])||void 0===s?void 0:s.textContent)||"256");if(0===u.getElementsByTagName("note").length){var h,c=null===(h=u.getElementsByTagName("forward")[0])||void 0===h?void 0:h.getElementsByTagName("duration")[0];c&&(c.textContent="0"),u.innerHTML=u.innerHTML+'\n <note>\n <rest measure="yes"/>\n <duration>'.concat(l*n,"</duration>\n <voice>1</voice>\n <type>whole</type>\n </note>")}}}catch(f){o.e(f)}finally{o.f()}return(new XMLSerializer).serializeToString(r)})),t("o",(function(t,e){var r,n,a,s;if(!t)return"";var u=(new DOMParser).parseFromString(t,"text/xml"),l=(null===(r=u.getElementsByTagName("part-list"))||void 0===r||null===(n=r[0])||void 0===n?void 0:n.getElementsByTagName("score-part"))||[],h=Array.from(l).map((function(t){var e;return(null===(e=t.getElementsByTagName("part-name"))||void 0===e?void 0:e[0].textContent)||""})),c=u.getElementsByTagName("part"),f=c[0],g=o(f.getElementsByTagName("measure")),v=o(f.getElementsByTagName("metronome"));o(f.getElementsByTagName("words")),o(f.getElementsByTagName("coda")),o(f.getElementsByTagName("rehearsal")),"COMMON"===(null===(a=h[0])||void 0===a||null===(s=a.toLocaleUpperCase)||void 0===s?void 0:s.call(a))&&(e++,h.shift());var y=l[e];if(y){var d=y.getAttribute("id");Array.from(c).forEach((function(t){var e;if(t&&t.getAttribute("id")!==d)null===(e=t.parentNode)||void 0===e||e.removeChild(t);else if(t&&"P1"!==t.getAttribute("id")){for(var r={},n=0;n<v.length;n++){var a,s,u=v[n],l=null===(a=u.parentElement)||void 0===a||null===(s=a.parentElement)||void 0===s?void 0:s.parentElement;if(l)r[g.indexOf(l)]=u}Object.values(r).forEach((function(e){var r,i=null===(r=e.parentElement)||void 0===r?void 0:r.parentElement,n=null==i?void 0:i.parentElement,a=o((null==n?void 0:n.childNodes)||[]),s=i?a.indexOf(i):-1;if(n&&s>-1){var u=g.indexOf(n),l=t.getElementsByTagName("measure")[u];or(i,n,l)}}))}if(t&&t.getAttribute("id")===d){var h,c,f=t.getElementsByTagName("barline"),y=null===(h=f[f.length-1])||void 0===h?void 0:h.parentElement;if("barline"!==(null==y||null===(c=y.lastElementChild)||void 0===c?void 0:c.tagName)){var p,m=i((null==y?void 0:y.children)||[]);try{for(m.s();!(p=m.n()).done;){var x=p.value;if("barline"===x.tagName){null==y||y.appendChild(x);break}}}catch(b){m.e(b)}finally{m.f()}}}})),Array.from(l).forEach((function(t){var e;t&&t.getAttribute("id")!==d&&(null===(e=t.parentNode)||void 0===e||e.removeChild(t))}));var p=u.getElementsByTagName("note");Array.from(p).forEach((function(t,e){var r=t.getElementsByTagName("grace");r&&r.length}))}return(new XMLSerializer).serializeToString(ar(u))})),function(t){if(!t)return t;var e=t.querySelectorAll("grace");if(!e.length)return t;var r,n=function t(e){return e.querySelector("grace")?t(null==e?void 0:e.nextElementSibling):e},a=i(e);try{for(a.s();!(r=a.n()).done;){var o,s=r.value,u=null===(o=s.parentElement)||void 0===o?void 0:o.querySelector("notations");if(u&&u.querySelectorAll("slur").length>1){var l,h=n(null===(l=s.parentElement)||void 0===l?void 0:l.nextElementSibling);if(h&&h.querySelectorAll("slur").length>0){var c,f,g=Array.from((null===(c=h.querySelector("notations"))||void 0===c?void 0:c.children)||[]).map((function(t){return t.getAttribute("number")})),v=i(u.querySelectorAll("slur"));try{for(v.s();!(f=v.n()).done;){var y,d=f.value;if(!g.includes(d.getAttribute("number")))null===(y=h.querySelector("notations"))||void 0===y||y.appendChild(d)}}catch(p){v.e(p)}finally{v.f()}}}}}catch(p){a.e(p)}finally{a.f()}return t}),or=function(t,e,r){var i=0;if(e){for(var n=0;n<e.childNodes.length;n++){var a=e.childNodes[n];if("note"===a.nodeName&&i++,a===t)break}if(0===i&&r)r.insertBefore(t,r.childNodes[0]);else if(r&&r.childNodes.length>0){var o=0,s=Array.from(r.childNodes).filter((function(t){return"note"===t.nodeName})),u=s[s.length-1];if(i>=s.length&&u)return void r.insertBefore(t,r.childNodes[Array.from(r.childNodes).indexOf(u)]);for(var l=0;l<s.length;l++){var h=s[l];if("note"===h.nodeName&&(o+=1)===i){r.insertBefore(t,h);break}}}}};t("a",(function(t){var e,r={showSpeed:!0,parsedXML:t},n=(new DOMParser).parseFromString(t,"text/xml"),a=i(n.getElementsByTagName("words"));try{for(a.s();!(e=a.n()).done;){var o,s,u=e.value;u&&"隐藏速度"===(null===(o=u.textContent)||void 0===o?void 0:o.trim())&&(r.showSpeed=!1,u.textContent=""),u&&"@"===(null===(s=u.textContent)||void 0===s?void 0:s.trim())&&(u.textContent="segno")}}catch(l){a.e(l)}finally{a.f()}return r.parsedXML=(new XMLSerializer).serializeToString(n),r}))}}}))}();