123456789101112131415161718192021 |
- import{b6 as We}from"./ResizeObserver.es.f28023e0.js";const ne={"Acoustic Grand Piano":"\u5927\u94A2\u7434","Bright Acoustic Piano":"\u660E\u4EAE\u7684\u94A2\u7434","Electric Grand Piano":"\u7535\u94A2\u7434","Rhodes Piano":"\u67D4\u548C\u7684\u7535\u94A2\u7434","Chorused Piano":"\u52A0\u5408\u5531\u6548\u679C\u7684\u7535\u94A2\u7434",Harpsichord:"\u7FBD\u7BA1\u952E\u7434",Clavichord:"\u79D1\u62C9\u7EF4\u79D1\u7279\u7434",Celesta:"\u94A2\u7247\u7434","Music box":"\u516B\u97F3\u76D2",Vibraphone:"\u98A4\u97F3\u7434",Marimba:"\u9A6C\u6797\u5DF4",Xylophone:"\u6728\u7434","Tubular Bells":"\u7BA1\u949F",Dulcimer:"\u5927\u626C\u7434","Hammond Organ":"\u51FB\u6746\u98CE\u7434","Percussive Organ":"\u6253\u51FB\u5F0F\u98CE\u7434","Rock Organ":"\u6447\u6EDA\u98CE\u7434","Church Organ":"\u6559\u5802\u98CE\u7434","Reed Organ":"\u7C27\u7BA1\u98CE\u7434",Accordian:"\u624B\u98CE\u7434",Harmonica:"\u53E3\u7434","Tango Accordian":"\u63A2\u6208\u624B\u98CE\u7434","Acoustic Guitar":"\u94A2\u5F26\u5409\u4ED6","Electric Guitar":"\u95F7\u97F3\u7535\u5409\u4ED6","Overdriven Guitar":"\u52A0\u9A71\u52A8\u6548\u679C\u7684\u7535\u5409\u4ED6","Distortion Guitar":"\u52A0\u5931\u771F\u6548\u679C\u7684\u7535\u5409\u4ED6","Guitar Harmonics":"\u5409\u4ED6\u548C\u97F3","Acoustic Bass":"\u5927\u8D1D\u53F8","Electric Bass":"\u7535\u8D1D\u53F8","Fretless Bass":"\u65E0\u54C1\u8D1D\u53F8","Slap Bass":"\u638C\u51FB","Synth Bass":"\u7535\u5B50\u5408\u6210",Violin:"\u5C0F\u63D0\u7434",Viola:"\u4E2D\u63D0\u7434",Cello:"\u5927\u63D0\u7434",Contrabass:"\u4F4E\u97F3\u5927\u63D0\u7434","Tremolo Strings":"\u5F26\u4E50\u7FA4\u98A4\u97F3\u97F3\u8272","Pizzicato Strings":"\u5F26\u4E50\u7FA4\u62E8\u5F26\u97F3\u8272","Orchestral Harp":"\u7AD6\u7434",Timpani:"\u5B9A\u97F3\u9F13","String Ensemble":"\u5F26\u4E50\u5408\u594F\u97F3\u8272","Synth Strings":"\u5408\u6210\u5F26\u4E50\u5408\u594F\u97F3\u8272","Choir Aahs":"\u4EBA\u58F0\u5408\u5531","Voice Oohs":"\u4EBA\u58F0","Synth Voice":"\u5408\u6210\u4EBA\u58F0","Orchestra Hit":"\u7BA1\u5F26\u4E50\u6572\u51FB\u9F50\u594F",Trumpet:"\u5C0F\u53F7",Trombone:"\u957F\u53F7",Tuba:"\u5927\u53F7","Muted Trumpet":"\u52A0\u5F31\u97F3\u5668\u5C0F\u53F7","French Horn":"\u6CD5\u56FD\u53F7","Brass Section":"\u94DC\u7BA1\u7EC4","Synth Brass":"\u5408\u6210\u94DC\u7BA1\u97F3\u8272","Soprano Sax":"\u9AD8\u97F3\u8428\u514B\u65AF\u98CE","Alto Sax":"\u4E2D\u97F3\u8428\u514B\u65AF\u98CE","Tenor Sax":"\u6B21\u4E2D\u97F3\u8428\u514B\u65AF\u98CE","Baritone Sax":"\u4F4E\u97F3\u8428\u514B\u65AF\u98CE",Oboe:"\u53CC\u7C27\u7BA1","English Horn":"\u82F1\u56FD\u7BA1",Bassoon:"\u5DF4\u677E",Clarinet:"\u5355\u7C27\u7BA1",Piccolo:"\u77ED\u7B1B",Flute:"\u957F\u7B1B",Recorder:"\u7AD6\u7B1B","Pan Flute":"\u6392\u7BAB","Bottle Blow":"\u74F6\u6728\u7BA1",Whistle:"\u53E3\u54E8\u58F0",Ocarina:"\u5965\u5361\u96F7\u90A3",Lead:"\u5408\u6210\u4E3B\u97F3","Lead lead":"\u5408\u6210\u4E3B\u97F3","Pad age":"\u5408\u6210\u97F3\u8272",Pad:"\u5408\u6210\u97F3\u8272",FX:"\u5408\u6210\u6548\u679C \u79D1\u5E7B",Sitar:"\u897F\u5854\u5C14",Banjo:"\u73ED\u5353\u7434",Shamisen:"\u4E09\u6627\u7EBF",Koto:"\u5341\u4E09\u5F26\u7B5D",Kalimba:"\u5361\u6797\u5DF4",Bagpipe:"\u98CE\u7B1B",Fiddle:"\u6C11\u65CF\u63D0\u7434",Shanai:"\u5C71\u5948","Tinkle Bell":"\u53EE\u5F53\u94C3",Agogo:"\u963F\u54E5\u54E5\u94C3","Steel Drums":"\u94A2\u9F13","Taiko Drum":"\u592A\u9F13","Melodic Tom":"\u901A\u901A\u9F13","Synth Drum":"\u5408\u6210\u9F13","Reverse Cymbal":"\u94DC\u94B9","Guitar Fret Noise":"\u5409\u4ED6\u6362\u628A\u6742\u97F3","Breath Noise":"\u547C\u5438\u58F0",Seashore:"\u6D77\u6D6A\u58F0","Bird Tweet":"\u9E1F\u9E23","Telephone Ring":"\u7535\u8BDD\u94C3",Helicopter:"\u76F4\u5347\u673A",Applause:"\u9F13\u638C\u58F0",Gunshot:"\u67AA\u58F0","Acoustic Bass Drum":"\u5927\u9F13","Bass Drum":"\u5927\u9F13","Side Stick":"\u5C0F\u9F13\u9F13\u8FB9","Acoustic Snare":"\u5C0F\u9F13","Hand Clap":"\u62CD\u624B","Electric Snare":"\u5C0F\u9F13","Low Floor Tom":"\u4F4E\u97F3\u9F13","Closed Hi-Hat":"\u95ED\u5408\u94B9","High Floor Tom":"\u4F4E\u97F3\u9F13","Pedal Hi-Hat":"\u811A\u8E0F\u94B9","Low Tom":"\u4E2D\u97F3\u9F13","Open Hi-Hat":"\u5F3A\u97F3\u94B9","Low-Mid Tom":"\u4E2D\u97F3\u9F13","Hi Mid Tom":"\u9AD8\u97F3\u9F13","Crash Cymbal":"\u5F3A\u97F3\u94B9","High Tom":"\u9AD8\u97F3\u9F13","Ride Cymbal":"\u6253\u70B9\u94B9","Chinese Cymbal":"\u94B9","Ride Bell":"\u5706\u94C3",Tambourine:"\u94C3\u9F13","Splash Cymbal":"\u5C0F\u94B9\u94DC\u94B9",Cowbell:"\u725B\u94C3","Vibra-Slap":"\u98A4\u97F3\u5668","Hi Bongo":"\u9AD8\u97F3\u90A6\u52A0\u9F13","Low Bongo":"\u4F4E\u97F3\u90A6\u52A0\u9F13","Mute Hi Conga":"\u5F31\u97F3\u9AD8\u97F3\u5EB7\u52A0\u9F13","Open Hi Conga":"\u5F3A\u97F3\u9AD8\u97F3\u5EB7\u52A0\u9F13","Low Conga":"\u4F4E\u97F3\u5EB7\u52A0\u9F13","High Timbale":"\u9AD8\u97F3\u5929\u5DF4\u9F13","Low Timbale":"\u4F4E\u97F3\u5929\u5DF4\u9F13","High Agogo":"\u9AD8\u97F3\u963F\u54E5\u54E5","Low Agogo":"\u4F4E\u97F3\u963F\u54E5\u54E5",Cabasa:"\u4E32\u73E0",Maracas:"\u6C99\u94C3","Short Whistle":"\u77ED\u53E3\u54E8","Long Whistle":"\u957F\u53E3\u54E8","Short Guiro":"\u77ED\u522E\u58F6","Long Guiro":"\u957F\u522E\u58F6",Claves:"\u6886\u5B50","Hi Wood Block":"\u9AD8\u97F3\u6728\u5757","Low Wood Block":"\u4F4E\u97F3\u6728\u5757","Mute Triangle":"\u5F31\u97F3\u4E09\u89D2\u94C1","Open Triangle":"\u5F3A\u97F3\u4E09\u89D2\u94C1","Hulusi flute":"\u846B\u82A6\u4E1D",Melodica:"\u53E3\u98CE\u7434","Snare Drum":"\u5C0F\u519B\u9F13",Cymbal:"\u9572",Cymbals:"\u9572","Horn in F":"\u5706\u53F7",Triangle:"\u4E09\u89D2\u94C1",Vibrato:"\u98A4\u97F3\u7434","Suspend Cymbal":"\u540A\u9572","Tom-Toms":"\u55F5\u55F5\u9F13",Bell:"\u94C3\u94DB",Bells:"\u94C3\u94DB","Alto Clarinet":"\u4E2D\u97F3\u5355\u7C27\u7BA1","Soprano Saxophone":"\u9AD8\u97F3\u8428\u514B\u65AF\u98CE","Alto Saxophone":"\u4E2D\u97F3\u8428\u514B\u65AF\u98CE","Tenor Saxophone":"\u6B21\u4E2D\u97F3\u8428\u514B\u65AF\u98CE","Baritone Saxophone":"\u4F4E\u97F3\u8428\u514B\u65AF\u98CE",Cornet:"\u77ED\u53F7",Euphonium:"\u4E0A\u4F4E\u97F3\u53F7","crash cymbals":"\u5BF9\u9572","Suspend cymbals":"\u540A\u9572",Castanets:"\u54CD\u677F"},ks=l=>{const t=l.replace(/ /g," ").toLocaleLowerCase(),e=Object.keys(ne);for(let i=0;i<e.length;i++)if(e[i].replace(/ /g," ").toLocaleLowerCase()===t)return ne[e[i]]||"";for(let i=0;i<e.length;i++){const s=e[i].replace(/ /g," ").toLocaleLowerCase();if(t.includes(s))return ne[e[i]]||""}return""};var Xt={exports:{}},wt={exports:{}};(function(){var l,t,e,i,s,r;typeof performance!="undefined"&&performance!==null&&performance.now?wt.exports=function(){return performance.now()}:typeof process!="undefined"&&process!==null&&process.hrtime?(wt.exports=function(){return(l()-s)/1e6},t=process.hrtime,l=function(){var o;return o=t(),o[0]*1e9+o[1]},i=l(),r=process.uptime()*1e9,s=i-r):Date.now?(wt.exports=function(){return Date.now()-e},e=Date.now()):(wt.exports=function(){return new Date().getTime()-e},e=new Date().getTime())}).call(We);var ai=wt.exports,st=typeof window=="undefined"?We:window,_t=["moz","webkit"],At="AnimationFrame",St=st["request"+At],Nt=st["cancel"+At]||st["cancelRequest"+At];for(var Et=0;!St&&Et<_t.length;Et++)St=st[_t[Et]+"Request"+At],Nt=st[_t[Et]+"Cancel"+At]||st[_t[Et]+"CancelRequest"+At];if(!St||!Nt){var oe=0,we=0,gt=[],ui=1e3/60;St=function(l){if(gt.length===0){var t=ai(),e=Math.max(0,ui-(t-oe));oe=e+t,setTimeout(function(){var i=gt.slice(0);gt.length=0;for(var s=0;s<i.length;s++)if(!i[s].cancelled)try{i[s].callback(oe)}catch(r){setTimeout(function(){throw r},0)}},Math.round(e))}return gt.push({handle:++we,callback:l,cancelled:!1}),we},Nt=function(l){for(var t=0;t<gt.length;t++)gt[t].handle===l&&(gt[t].cancelled=!0)}}Xt.exports=function(l){return St.call(st,l)};Xt.exports.cancel=function(){Nt.apply(st,arguments)};Xt.exports.polyfill=function(l){l||(l=st),l.requestAnimationFrame=St,l.cancelAnimationFrame=Nt};var ae=Xt.exports,ce=function(l){this.ok=!1,this.alpha=1,l.charAt(0)=="#"&&(l=l.substr(1,6)),l=l.replace(/ /g,""),l=l.toLowerCase();var t={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};l=t[l]||l;for(var e=[{re:/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*((?:\d?\.)?\d)\)$/,example:["rgba(123, 234, 45, 0.8)","rgba(255,234,245,1.0)"],process:function(a){return[parseInt(a[1]),parseInt(a[2]),parseInt(a[3]),parseFloat(a[4])]}},{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(a){return[parseInt(a[1]),parseInt(a[2]),parseInt(a[3])]}},{re:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,example:["#00ff00","336699"],process:function(a){return[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16)]}},{re:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,example:["#fb0","f0f"],process:function(a){return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)]}}],i=0;i<e.length;i++){var s=e[i].re,r=e[i].process,o=s.exec(l);if(o){var n=r(o);this.r=n[0],this.g=n[1],this.b=n[2],n.length>3&&(this.alpha=n[3]),this.ok=!0}}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.alpha=this.alpha<0?0:this.alpha>1||isNaN(this.alpha)?1:this.alpha,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toRGBA=function(){return"rgba("+this.r+", "+this.g+", "+this.b+", "+this.alpha+")"},this.toHex=function(){var a=this.r.toString(16),u=this.g.toString(16),h=this.b.toString(16);return a.length==1&&(a="0"+a),u.length==1&&(u="0"+u),h.length==1&&(h="0"+h),"#"+a+u+h},this.getHelpXML=function(){for(var a=new Array,u=0;u<e.length;u++)for(var h=e[u].example,f=0;f<h.length;f++)a[a.length]=h[f];for(var g in t)a[a.length]=g;var c=document.createElement("ul");c.setAttribute("id","rgbcolor-examples");for(var u=0;u<a.length;u++)try{var d=document.createElement("li"),m=new RGBColor(a[u]),p=document.createElement("div");p.style.cssText="margin: 3px; border: 1px solid black; background:"+m.toHex()+"; color:"+m.toHex(),p.appendChild(document.createTextNode("test"));var x=document.createTextNode(" "+a[u]+" -> "+m.toRGB()+" -> "+m.toHex());d.appendChild(p),d.appendChild(x),c.appendChild(d)}catch{}return c}};/*! *****************************************************************************
- Copyright (c) Microsoft Corporation.
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted.
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
- ***************************************************************************** */var qe=function(l,t){return(qe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,i){e.__proto__=i}||function(e,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s])})(l,t)};function Ge(l,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=l}qe(l,t),l.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function li(l){var t="";Array.isArray(l)||(l=[l]);for(var e=0;e<l.length;e++){var i=l[e];if(i.type===y.CLOSE_PATH)t+="z";else if(i.type===y.HORIZ_LINE_TO)t+=(i.relative?"h":"H")+i.x;else if(i.type===y.VERT_LINE_TO)t+=(i.relative?"v":"V")+i.y;else if(i.type===y.MOVE_TO)t+=(i.relative?"m":"M")+i.x+" "+i.y;else if(i.type===y.LINE_TO)t+=(i.relative?"l":"L")+i.x+" "+i.y;else if(i.type===y.CURVE_TO)t+=(i.relative?"c":"C")+i.x1+" "+i.y1+" "+i.x2+" "+i.y2+" "+i.x+" "+i.y;else if(i.type===y.SMOOTH_CURVE_TO)t+=(i.relative?"s":"S")+i.x2+" "+i.y2+" "+i.x+" "+i.y;else if(i.type===y.QUAD_TO)t+=(i.relative?"q":"Q")+i.x1+" "+i.y1+" "+i.x+" "+i.y;else if(i.type===y.SMOOTH_QUAD_TO)t+=(i.relative?"t":"T")+i.x+" "+i.y;else{if(i.type!==y.ARC)throw new Error('Unexpected command type "'+i.type+'" at index '+e+".");t+=(i.relative?"a":"A")+i.rX+" "+i.rY+" "+i.xRot+" "+ +i.lArcFlag+" "+ +i.sweepFlag+" "+i.x+" "+i.y}}return t}function fe(l,t){var e=l[0],i=l[1];return[e*Math.cos(t)-i*Math.sin(t),e*Math.sin(t)+i*Math.cos(t)]}function K(){for(var l=[],t=0;t<arguments.length;t++)l[t]=arguments[t];for(var e=0;e<l.length;e++)if(typeof l[e]!="number")throw new Error("assertNumbers arguments["+e+"] is not a number. "+typeof l[e]+" == typeof "+l[e]);return!0}var ot=Math.PI;function ue(l,t,e){l.lArcFlag=l.lArcFlag===0?0:1,l.sweepFlag=l.sweepFlag===0?0:1;var i=l.rX,s=l.rY,r=l.x,o=l.y;i=Math.abs(l.rX),s=Math.abs(l.rY);var n=fe([(t-r)/2,(e-o)/2],-l.xRot/180*ot),a=n[0],u=n[1],h=Math.pow(a,2)/Math.pow(i,2)+Math.pow(u,2)/Math.pow(s,2);1<h&&(i*=Math.sqrt(h),s*=Math.sqrt(h)),l.rX=i,l.rY=s;var f=Math.pow(i,2)*Math.pow(u,2)+Math.pow(s,2)*Math.pow(a,2),g=(l.lArcFlag!==l.sweepFlag?1:-1)*Math.sqrt(Math.max(0,(Math.pow(i,2)*Math.pow(s,2)-f)/f)),c=i*u/s*g,d=-s*a/i*g,m=fe([c,d],l.xRot/180*ot);l.cX=m[0]+(t+r)/2,l.cY=m[1]+(e+o)/2,l.phi1=Math.atan2((u-d)/s,(a-c)/i),l.phi2=Math.atan2((-u-d)/s,(-a-c)/i),l.sweepFlag===0&&l.phi2>l.phi1&&(l.phi2-=2*ot),l.sweepFlag===1&&l.phi2<l.phi1&&(l.phi2+=2*ot),l.phi1*=180/ot,l.phi2*=180/ot}function Ne(l,t,e){K(l,t,e);var i=l*l+t*t-e*e;if(0>i)return[];if(i===0)return[[l*e/(l*l+t*t),t*e/(l*l+t*t)]];var s=Math.sqrt(i);return[[(l*e+t*s)/(l*l+t*t),(t*e-l*s)/(l*l+t*t)],[(l*e-t*s)/(l*l+t*t),(t*e+l*s)/(l*l+t*t)]]}var _,et=Math.PI/180;function Pe(l,t,e){return(1-e)*l+e*t}function Me(l,t,e,i){return l+Math.cos(i/180*ot)*t+Math.sin(i/180*ot)*e}function Fe(l,t,e,i){var s=1e-6,r=t-l,o=e-t,n=3*r+3*(i-e)-6*o,a=6*(o-r),u=3*r;return Math.abs(n)<s?[-u/a]:function(h,f,g){g===void 0&&(g=1e-6);var c=h*h/4-f;if(c<-g)return[];if(c<=g)return[-h/2];var d=Math.sqrt(c);return[-h/2-d,-h/2+d]}(a/n,u/n,s)}function Oe(l,t,e,i,s){var r=1-s;return l*(r*r*r)+t*(3*r*r*s)+e*(3*r*s*s)+i*(s*s*s)}(function(l){function t(){return s(function(n,a,u){return n.relative&&(n.x1!==void 0&&(n.x1+=a),n.y1!==void 0&&(n.y1+=u),n.x2!==void 0&&(n.x2+=a),n.y2!==void 0&&(n.y2+=u),n.x!==void 0&&(n.x+=a),n.y!==void 0&&(n.y+=u),n.relative=!1),n})}function e(){var n=NaN,a=NaN,u=NaN,h=NaN;return s(function(f,g,c){return f.type&y.SMOOTH_CURVE_TO&&(f.type=y.CURVE_TO,n=isNaN(n)?g:n,a=isNaN(a)?c:a,f.x1=f.relative?g-n:2*g-n,f.y1=f.relative?c-a:2*c-a),f.type&y.CURVE_TO?(n=f.relative?g+f.x2:f.x2,a=f.relative?c+f.y2:f.y2):(n=NaN,a=NaN),f.type&y.SMOOTH_QUAD_TO&&(f.type=y.QUAD_TO,u=isNaN(u)?g:u,h=isNaN(h)?c:h,f.x1=f.relative?g-u:2*g-u,f.y1=f.relative?c-h:2*c-h),f.type&y.QUAD_TO?(u=f.relative?g+f.x1:f.x1,h=f.relative?c+f.y1:f.y1):(u=NaN,h=NaN),f})}function i(){var n=NaN,a=NaN;return s(function(u,h,f){if(u.type&y.SMOOTH_QUAD_TO&&(u.type=y.QUAD_TO,n=isNaN(n)?h:n,a=isNaN(a)?f:a,u.x1=u.relative?h-n:2*h-n,u.y1=u.relative?f-a:2*f-a),u.type&y.QUAD_TO){n=u.relative?h+u.x1:u.x1,a=u.relative?f+u.y1:u.y1;var g=u.x1,c=u.y1;u.type=y.CURVE_TO,u.x1=((u.relative?0:h)+2*g)/3,u.y1=((u.relative?0:f)+2*c)/3,u.x2=(u.x+2*g)/3,u.y2=(u.y+2*c)/3}else n=NaN,a=NaN;return u})}function s(n){var a=0,u=0,h=NaN,f=NaN;return function(g){if(isNaN(h)&&!(g.type&y.MOVE_TO))throw new Error("path must start with moveto");var c=n(g,a,u,h,f);return g.type&y.CLOSE_PATH&&(a=h,u=f),g.x!==void 0&&(a=g.relative?a+g.x:g.x),g.y!==void 0&&(u=g.relative?u+g.y:g.y),g.type&y.MOVE_TO&&(h=a,f=u),c}}function r(n,a,u,h,f,g){return K(n,a,u,h,f,g),s(function(c,d,m,p){var x=c.x1,C=c.x2,b=c.relative&&!isNaN(p),A=c.x!==void 0?c.x:b?0:d,P=c.y!==void 0?c.y:b?0:m;function T(Z){return Z*Z}c.type&y.HORIZ_LINE_TO&&a!==0&&(c.type=y.LINE_TO,c.y=c.relative?0:m),c.type&y.VERT_LINE_TO&&u!==0&&(c.type=y.LINE_TO,c.x=c.relative?0:d),c.x!==void 0&&(c.x=c.x*n+P*u+(b?0:f)),c.y!==void 0&&(c.y=A*a+c.y*h+(b?0:g)),c.x1!==void 0&&(c.x1=c.x1*n+c.y1*u+(b?0:f)),c.y1!==void 0&&(c.y1=x*a+c.y1*h+(b?0:g)),c.x2!==void 0&&(c.x2=c.x2*n+c.y2*u+(b?0:f)),c.y2!==void 0&&(c.y2=C*a+c.y2*h+(b?0:g));var v=n*h-a*u;if(c.xRot!==void 0&&(n!==1||a!==0||u!==0||h!==1))if(v===0)delete c.rX,delete c.rY,delete c.xRot,delete c.lArcFlag,delete c.sweepFlag,c.type=y.LINE_TO;else{var w=c.xRot*Math.PI/180,N=Math.sin(w),k=Math.cos(w),z=1/T(c.rX),D=1/T(c.rY),H=T(k)*z+T(N)*D,R=2*N*k*(z-D),L=T(N)*z+T(k)*D,X=H*h*h-R*a*h+L*a*a,U=R*(n*h+a*u)-2*(H*u*h+L*n*a),Q=H*u*u-R*n*u+L*n*n,B=(Math.atan2(U,X-Q)+Math.PI)%Math.PI/2,O=Math.sin(B),Y=Math.cos(B);c.rX=Math.abs(v)/Math.sqrt(X*T(Y)+U*O*Y+Q*T(O)),c.rY=Math.abs(v)/Math.sqrt(X*T(O)-U*O*Y+Q*T(Y)),c.xRot=180*B/Math.PI}return c.sweepFlag!==void 0&&0>v&&(c.sweepFlag=+!c.sweepFlag),c})}function o(){return function(n){var a={};for(var u in n)a[u]=n[u];return a}}l.ROUND=function(n){function a(u){return Math.round(u*n)/n}return n===void 0&&(n=1e13),K(n),function(u){return u.x1!==void 0&&(u.x1=a(u.x1)),u.y1!==void 0&&(u.y1=a(u.y1)),u.x2!==void 0&&(u.x2=a(u.x2)),u.y2!==void 0&&(u.y2=a(u.y2)),u.x!==void 0&&(u.x=a(u.x)),u.y!==void 0&&(u.y=a(u.y)),u.rX!==void 0&&(u.rX=a(u.rX)),u.rY!==void 0&&(u.rY=a(u.rY)),u}},l.TO_ABS=t,l.TO_REL=function(){return s(function(n,a,u){return n.relative||(n.x1!==void 0&&(n.x1-=a),n.y1!==void 0&&(n.y1-=u),n.x2!==void 0&&(n.x2-=a),n.y2!==void 0&&(n.y2-=u),n.x!==void 0&&(n.x-=a),n.y!==void 0&&(n.y-=u),n.relative=!0),n})},l.NORMALIZE_HVZ=function(n,a,u){return n===void 0&&(n=!0),a===void 0&&(a=!0),u===void 0&&(u=!0),s(function(h,f,g,c,d){if(isNaN(c)&&!(h.type&y.MOVE_TO))throw new Error("path must start with moveto");return a&&h.type&y.HORIZ_LINE_TO&&(h.type=y.LINE_TO,h.y=h.relative?0:g),u&&h.type&y.VERT_LINE_TO&&(h.type=y.LINE_TO,h.x=h.relative?0:f),n&&h.type&y.CLOSE_PATH&&(h.type=y.LINE_TO,h.x=h.relative?c-f:c,h.y=h.relative?d-g:d),h.type&y.ARC&&(h.rX===0||h.rY===0)&&(h.type=y.LINE_TO,delete h.rX,delete h.rY,delete h.xRot,delete h.lArcFlag,delete h.sweepFlag),h})},l.NORMALIZE_ST=e,l.QT_TO_C=i,l.INFO=s,l.SANITIZE=function(n){n===void 0&&(n=0),K(n);var a=NaN,u=NaN,h=NaN,f=NaN;return s(function(g,c,d,m,p){var x=Math.abs,C=!1,b=0,A=0;if(g.type&y.SMOOTH_CURVE_TO&&(b=isNaN(a)?0:c-a,A=isNaN(u)?0:d-u),g.type&(y.CURVE_TO|y.SMOOTH_CURVE_TO)?(a=g.relative?c+g.x2:g.x2,u=g.relative?d+g.y2:g.y2):(a=NaN,u=NaN),g.type&y.SMOOTH_QUAD_TO?(h=isNaN(h)?c:2*c-h,f=isNaN(f)?d:2*d-f):g.type&y.QUAD_TO?(h=g.relative?c+g.x1:g.x1,f=g.relative?d+g.y1:g.y2):(h=NaN,f=NaN),g.type&y.LINE_COMMANDS||g.type&y.ARC&&(g.rX===0||g.rY===0||!g.lArcFlag)||g.type&y.CURVE_TO||g.type&y.SMOOTH_CURVE_TO||g.type&y.QUAD_TO||g.type&y.SMOOTH_QUAD_TO){var P=g.x===void 0?0:g.relative?g.x:g.x-c,T=g.y===void 0?0:g.relative?g.y:g.y-d;b=isNaN(h)?g.x1===void 0?b:g.relative?g.x:g.x1-c:h-c,A=isNaN(f)?g.y1===void 0?A:g.relative?g.y:g.y1-d:f-d;var v=g.x2===void 0?0:g.relative?g.x:g.x2-c,w=g.y2===void 0?0:g.relative?g.y:g.y2-d;x(P)<=n&&x(T)<=n&&x(b)<=n&&x(A)<=n&&x(v)<=n&&x(w)<=n&&(C=!0)}return g.type&y.CLOSE_PATH&&x(c-m)<=n&&x(d-p)<=n&&(C=!0),C?[]:g})},l.MATRIX=r,l.ROTATE=function(n,a,u){a===void 0&&(a=0),u===void 0&&(u=0),K(n,a,u);var h=Math.sin(n),f=Math.cos(n);return r(f,h,-h,f,a-a*f+u*h,u-a*h-u*f)},l.TRANSLATE=function(n,a){return a===void 0&&(a=0),K(n,a),r(1,0,0,1,n,a)},l.SCALE=function(n,a){return a===void 0&&(a=n),K(n,a),r(n,0,0,a,0,0)},l.SKEW_X=function(n){return K(n),r(1,0,Math.atan(n),1,0,0)},l.SKEW_Y=function(n){return K(n),r(1,Math.atan(n),0,1,0,0)},l.X_AXIS_SYMMETRY=function(n){return n===void 0&&(n=0),K(n),r(-1,0,0,1,n,0)},l.Y_AXIS_SYMMETRY=function(n){return n===void 0&&(n=0),K(n),r(1,0,0,-1,0,n)},l.A_TO_C=function(){return s(function(n,a,u){return y.ARC===n.type?function(h,f,g){var c,d,m,p;h.cX||ue(h,f,g);for(var x=Math.min(h.phi1,h.phi2),C=Math.max(h.phi1,h.phi2)-x,b=Math.ceil(C/90),A=new Array(b),P=f,T=g,v=0;v<b;v++){var w=Pe(h.phi1,h.phi2,v/b),N=Pe(h.phi1,h.phi2,(v+1)/b),k=N-w,z=4/3*Math.tan(k*et/4),D=[Math.cos(w*et)-z*Math.sin(w*et),Math.sin(w*et)+z*Math.cos(w*et)],H=D[0],R=D[1],L=[Math.cos(N*et),Math.sin(N*et)],X=L[0],U=L[1],Q=[X+z*Math.sin(N*et),U-z*Math.cos(N*et)],B=Q[0],O=Q[1];A[v]={relative:h.relative,type:y.CURVE_TO};var Y=function(Z,tt){var nt=fe([Z*h.rX,tt*h.rY],h.xRot),yt=nt[0],Ft=nt[1];return[h.cX+yt,h.cY+Ft]};c=Y(H,R),A[v].x1=c[0],A[v].y1=c[1],d=Y(B,O),A[v].x2=d[0],A[v].y2=d[1],m=Y(X,U),A[v].x=m[0],A[v].y=m[1],h.relative&&(A[v].x1-=P,A[v].y1-=T,A[v].x2-=P,A[v].y2-=T,A[v].x-=P,A[v].y-=T),P=(p=[A[v].x,A[v].y])[0],T=p[1]}return A}(n,n.relative?0:a,n.relative?0:u):n})},l.ANNOTATE_ARCS=function(){return s(function(n,a,u){return n.relative&&(a=0,u=0),y.ARC===n.type&&ue(n,a,u),n})},l.CLONE=o,l.CALCULATE_BOUNDS=function(){var n=function(g){var c={};for(var d in g)c[d]=g[d];return c},a=t(),u=i(),h=e(),f=s(function(g,c,d){var m=h(u(a(n(g))));function p(O){O>f.maxX&&(f.maxX=O),O<f.minX&&(f.minX=O)}function x(O){O>f.maxY&&(f.maxY=O),O<f.minY&&(f.minY=O)}if(m.type&y.DRAWING_COMMANDS&&(p(c),x(d)),m.type&y.HORIZ_LINE_TO&&p(m.x),m.type&y.VERT_LINE_TO&&x(m.y),m.type&y.LINE_TO&&(p(m.x),x(m.y)),m.type&y.CURVE_TO){p(m.x),x(m.y);for(var C=0,b=Fe(c,m.x1,m.x2,m.x);C<b.length;C++)0<(B=b[C])&&1>B&&p(Oe(c,m.x1,m.x2,m.x,B));for(var A=0,P=Fe(d,m.y1,m.y2,m.y);A<P.length;A++)0<(B=P[A])&&1>B&&x(Oe(d,m.y1,m.y2,m.y,B))}if(m.type&y.ARC){p(m.x),x(m.y),ue(m,c,d);for(var T=m.xRot/180*Math.PI,v=Math.cos(T)*m.rX,w=Math.sin(T)*m.rX,N=-Math.sin(T)*m.rY,k=Math.cos(T)*m.rY,z=m.phi1<m.phi2?[m.phi1,m.phi2]:-180>m.phi2?[m.phi2+360,m.phi1+360]:[m.phi2,m.phi1],D=z[0],H=z[1],R=function(O){var Y=O[0],Z=O[1],tt=180*Math.atan2(Z,Y)/Math.PI;return tt<D?tt+360:tt},L=0,X=Ne(N,-v,0).map(R);L<X.length;L++)(B=X[L])>D&&B<H&&p(Me(m.cX,v,N,B));for(var U=0,Q=Ne(k,-w,0).map(R);U<Q.length;U++){var B;(B=Q[U])>D&&B<H&&x(Me(m.cY,w,k,B))}}return g});return f.minX=1/0,f.maxX=-1/0,f.minY=1/0,f.maxY=-1/0,f}})(_||(_={}));var j,Qe=function(){function l(){}return l.prototype.round=function(t){return this.transform(_.ROUND(t))},l.prototype.toAbs=function(){return this.transform(_.TO_ABS())},l.prototype.toRel=function(){return this.transform(_.TO_REL())},l.prototype.normalizeHVZ=function(t,e,i){return this.transform(_.NORMALIZE_HVZ(t,e,i))},l.prototype.normalizeST=function(){return this.transform(_.NORMALIZE_ST())},l.prototype.qtToC=function(){return this.transform(_.QT_TO_C())},l.prototype.aToC=function(){return this.transform(_.A_TO_C())},l.prototype.sanitize=function(t){return this.transform(_.SANITIZE(t))},l.prototype.translate=function(t,e){return this.transform(_.TRANSLATE(t,e))},l.prototype.scale=function(t,e){return this.transform(_.SCALE(t,e))},l.prototype.rotate=function(t,e,i){return this.transform(_.ROTATE(t,e,i))},l.prototype.matrix=function(t,e,i,s,r,o){return this.transform(_.MATRIX(t,e,i,s,r,o))},l.prototype.skewX=function(t){return this.transform(_.SKEW_X(t))},l.prototype.skewY=function(t){return this.transform(_.SKEW_Y(t))},l.prototype.xSymmetry=function(t){return this.transform(_.X_AXIS_SYMMETRY(t))},l.prototype.ySymmetry=function(t){return this.transform(_.Y_AXIS_SYMMETRY(t))},l.prototype.annotateArcs=function(){return this.transform(_.ANNOTATE_ARCS())},l}(),hi=function(l){return l===" "||l===" "||l==="\r"||l===`
- `},Ve=function(l){return"0".charCodeAt(0)<=l.charCodeAt(0)&&l.charCodeAt(0)<="9".charCodeAt(0)},ci=function(l){function t(){var e=l.call(this)||this;return e.curNumber="",e.curCommandType=-1,e.curCommandRelative=!1,e.canParseCommandOrComma=!0,e.curNumberHasExp=!1,e.curNumberHasExpDigits=!1,e.curNumberHasDecimal=!1,e.curArgs=[],e}return Ge(t,l),t.prototype.finish=function(e){if(e===void 0&&(e=[]),this.parse(" ",e),this.curArgs.length!==0||!this.canParseCommandOrComma)throw new SyntaxError("Unterminated command at the path end.");return e},t.prototype.parse=function(e,i){var s=this;i===void 0&&(i=[]);for(var r=function(f){i.push(f),s.curArgs.length=0,s.canParseCommandOrComma=!0},o=0;o<e.length;o++){var n=e[o],a=!(this.curCommandType!==y.ARC||this.curArgs.length!==3&&this.curArgs.length!==4||this.curNumber.length!==1||this.curNumber!=="0"&&this.curNumber!=="1"),u=Ve(n)&&(this.curNumber==="0"&&n==="0"||a);if(!Ve(n)||u)if(n!=="e"&&n!=="E")if(n!=="-"&&n!=="+"||!this.curNumberHasExp||this.curNumberHasExpDigits)if(n!=="."||this.curNumberHasExp||this.curNumberHasDecimal||a){if(this.curNumber&&this.curCommandType!==-1){var h=Number(this.curNumber);if(isNaN(h))throw new SyntaxError("Invalid number ending at "+o);if(this.curCommandType===y.ARC){if(this.curArgs.length===0||this.curArgs.length===1){if(0>h)throw new SyntaxError('Expected positive number, got "'+h+'" at index "'+o+'"')}else if((this.curArgs.length===3||this.curArgs.length===4)&&this.curNumber!=="0"&&this.curNumber!=="1")throw new SyntaxError('Expected a flag, got "'+this.curNumber+'" at index "'+o+'"')}this.curArgs.push(h),this.curArgs.length===fi[this.curCommandType]&&(y.HORIZ_LINE_TO===this.curCommandType?r({type:y.HORIZ_LINE_TO,relative:this.curCommandRelative,x:h}):y.VERT_LINE_TO===this.curCommandType?r({type:y.VERT_LINE_TO,relative:this.curCommandRelative,y:h}):this.curCommandType===y.MOVE_TO||this.curCommandType===y.LINE_TO||this.curCommandType===y.SMOOTH_QUAD_TO?(r({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),y.MOVE_TO===this.curCommandType&&(this.curCommandType=y.LINE_TO)):this.curCommandType===y.CURVE_TO?r({type:y.CURVE_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x2:this.curArgs[2],y2:this.curArgs[3],x:this.curArgs[4],y:this.curArgs[5]}):this.curCommandType===y.SMOOTH_CURVE_TO?r({type:y.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===y.QUAD_TO?r({type:y.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===y.ARC&&r({type:y.ARC,relative:this.curCommandRelative,rX:this.curArgs[0],rY:this.curArgs[1],xRot:this.curArgs[2],lArcFlag:this.curArgs[3],sweepFlag:this.curArgs[4],x:this.curArgs[5],y:this.curArgs[6]})),this.curNumber="",this.curNumberHasExpDigits=!1,this.curNumberHasExp=!1,this.curNumberHasDecimal=!1,this.canParseCommandOrComma=!0}if(!hi(n))if(n===","&&this.canParseCommandOrComma)this.canParseCommandOrComma=!1;else if(n!=="+"&&n!=="-"&&n!==".")if(u)this.curNumber=n,this.curNumberHasDecimal=!1;else{if(this.curArgs.length!==0)throw new SyntaxError("Unterminated command at index "+o+".");if(!this.canParseCommandOrComma)throw new SyntaxError('Unexpected character "'+n+'" at index '+o+". Command cannot follow comma");if(this.canParseCommandOrComma=!1,n!=="z"&&n!=="Z")if(n==="h"||n==="H")this.curCommandType=y.HORIZ_LINE_TO,this.curCommandRelative=n==="h";else if(n==="v"||n==="V")this.curCommandType=y.VERT_LINE_TO,this.curCommandRelative=n==="v";else if(n==="m"||n==="M")this.curCommandType=y.MOVE_TO,this.curCommandRelative=n==="m";else if(n==="l"||n==="L")this.curCommandType=y.LINE_TO,this.curCommandRelative=n==="l";else if(n==="c"||n==="C")this.curCommandType=y.CURVE_TO,this.curCommandRelative=n==="c";else if(n==="s"||n==="S")this.curCommandType=y.SMOOTH_CURVE_TO,this.curCommandRelative=n==="s";else if(n==="q"||n==="Q")this.curCommandType=y.QUAD_TO,this.curCommandRelative=n==="q";else if(n==="t"||n==="T")this.curCommandType=y.SMOOTH_QUAD_TO,this.curCommandRelative=n==="t";else{if(n!=="a"&&n!=="A")throw new SyntaxError('Unexpected character "'+n+'" at index '+o+".");this.curCommandType=y.ARC,this.curCommandRelative=n==="a"}else i.push({type:y.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1}else this.curNumber=n,this.curNumberHasDecimal=n==="."}else this.curNumber+=n,this.curNumberHasDecimal=!0;else this.curNumber+=n;else this.curNumber+=n,this.curNumberHasExp=!0;else this.curNumber+=n,this.curNumberHasExpDigits=this.curNumberHasExp}return i},t.prototype.transform=function(e){return Object.create(this,{parse:{value:function(i,s){s===void 0&&(s=[]);for(var r=0,o=Object.getPrototypeOf(this).parse.call(this,i);r<o.length;r++){var n=o[r],a=e(n);Array.isArray(a)?s.push.apply(s,a):s.push(a)}return s}}})},t}(Qe),y=function(l){function t(e){var i=l.call(this)||this;return i.commands=typeof e=="string"?t.parse(e):e,i}return Ge(t,l),t.prototype.encode=function(){return t.encode(this.commands)},t.prototype.getBounds=function(){var e=_.CALCULATE_BOUNDS();return this.transform(e),e},t.prototype.transform=function(e){for(var i=[],s=0,r=this.commands;s<r.length;s++){var o=e(r[s]);Array.isArray(o)?i.push.apply(i,o):i.push(o)}return this.commands=i,this},t.encode=function(e){return li(e)},t.parse=function(e){var i=new ci,s=[];return i.parse(e,s),i.finish(s),s},t.CLOSE_PATH=1,t.MOVE_TO=2,t.HORIZ_LINE_TO=4,t.VERT_LINE_TO=8,t.LINE_TO=16,t.CURVE_TO=32,t.SMOOTH_CURVE_TO=64,t.QUAD_TO=128,t.SMOOTH_QUAD_TO=256,t.ARC=512,t.LINE_COMMANDS=t.LINE_TO|t.HORIZ_LINE_TO|t.VERT_LINE_TO,t.DRAWING_COMMANDS=t.HORIZ_LINE_TO|t.VERT_LINE_TO|t.LINE_TO|t.CURVE_TO|t.SMOOTH_CURVE_TO|t.QUAD_TO|t.SMOOTH_QUAD_TO|t.ARC,t}(Qe),fi=((j={})[y.MOVE_TO]=2,j[y.LINE_TO]=2,j[y.HORIZ_LINE_TO]=1,j[y.VERT_LINE_TO]=1,j[y.CLOSE_PATH]=0,j[y.QUAD_TO]=4,j[y.SMOOTH_QUAD_TO]=2,j[y.CURVE_TO]=6,j[y.SMOOTH_CURVE_TO]=4,j[y.ARC]=7,j);function Ut(l){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ut=function(t){return typeof t}:Ut=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ut(l)}function gi(l,t){if(!(l instanceof t))throw new TypeError("Cannot call a class as a function")}var di=[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],mi=[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 pi(l,t,e,i,s){if(typeof l=="string"&&(l=document.getElementById(l)),!l||Ut(l)!=="object"||!("getContext"in l))throw new TypeError("Expecting canvas with `getContext` method in processCanvasRGB(A) calls!");var r=l.getContext("2d");try{return r.getImageData(t,e,i,s)}catch(o){throw new Error("unable to access image data: "+o)}}function yi(l,t,e,i,s,r){if(!(isNaN(r)||r<1)){r|=0;var o=pi(l,t,e,i,s);o=xi(o,t,e,i,s,r),l.getContext("2d").putImageData(o,t,e)}}function xi(l,t,e,i,s,r){for(var o=l.data,n=2*r+1,a=i-1,u=s-1,h=r+1,f=h*(h+1)/2,g=new Be,c=g,d,m=1;m<n;m++)c=c.next=new Be,m===h&&(d=c);c.next=g;for(var p=null,x=null,C=0,b=0,A=di[r],P=mi[r],T=0;T<s;T++){c=g;for(var v=o[b],w=o[b+1],N=o[b+2],k=o[b+3],z=0;z<h;z++)c.r=v,c.g=w,c.b=N,c.a=k,c=c.next;for(var D=0,H=0,R=0,L=0,X=h*v,U=h*w,Q=h*N,B=h*k,O=f*v,Y=f*w,Z=f*N,tt=f*k,nt=1;nt<h;nt++){var yt=b+((a<nt?a:nt)<<2),Ft=o[yt],ye=o[yt+1],xe=o[yt+2],be=o[yt+3],Ot=h-nt;O+=(c.r=Ft)*Ot,Y+=(c.g=ye)*Ot,Z+=(c.b=xe)*Ot,tt+=(c.a=be)*Ot,D+=Ft,H+=ye,R+=xe,L+=be,c=c.next}p=g,x=d;for(var Gt=0;Gt<i;Gt++){var Qt=tt*A>>P;if(o[b+3]=Qt,Qt!==0){var $t=255/Qt;o[b]=(O*A>>P)*$t,o[b+1]=(Y*A>>P)*$t,o[b+2]=(Z*A>>P)*$t}else o[b]=o[b+1]=o[b+2]=0;O-=X,Y-=U,Z-=Q,tt-=B,X-=p.r,U-=p.g,Q-=p.b,B-=p.a;var lt=Gt+r+1;lt=C+(lt<a?lt:a)<<2,D+=p.r=o[lt],H+=p.g=o[lt+1],R+=p.b=o[lt+2],L+=p.a=o[lt+3],O+=D,Y+=H,Z+=R,tt+=L,p=p.next;var Vt=x,ve=Vt.r,Ae=Vt.g,Ce=Vt.b,Se=Vt.a;X+=ve,U+=Ae,Q+=Ce,B+=Se,D-=ve,H-=Ae,R-=Ce,L-=Se,x=x.next,b+=4}C+=i}for(var xt=0;xt<i;xt++){b=xt<<2;var ht=o[b],ct=o[b+1],ft=o[b+2],q=o[b+3],Zt=h*ht,jt=h*ct,Kt=h*ft,Jt=h*q,Bt=f*ht,kt=f*ct,Dt=f*ft,Rt=f*q;c=g;for(var Te=0;Te<h;Te++)c.r=ht,c.g=ct,c.b=ft,c.a=q,c=c.next;for(var Ee=i,te=0,ee=0,ie=0,se=0,Lt=1;Lt<=r;Lt++){b=Ee+xt<<2;var It=h-Lt;Bt+=(c.r=ht=o[b])*It,kt+=(c.g=ct=o[b+1])*It,Dt+=(c.b=ft=o[b+2])*It,Rt+=(c.a=q=o[b+3])*It,se+=ht,te+=ct,ee+=ft,ie+=q,c=c.next,Lt<u&&(Ee+=i)}b=xt,p=g,x=d;for(var re=0;re<s;re++){var G=b<<2;o[G+3]=q=Rt*A>>P,q>0?(q=255/q,o[G]=(Bt*A>>P)*q,o[G+1]=(kt*A>>P)*q,o[G+2]=(Dt*A>>P)*q):o[G]=o[G+1]=o[G+2]=0,Bt-=Zt,kt-=jt,Dt-=Kt,Rt-=Jt,Zt-=p.r,jt-=p.g,Kt-=p.b,Jt-=p.a,G=xt+((G=re+h)<u?G:u)*i<<2,Bt+=se+=p.r=o[G],kt+=te+=p.g=o[G+1],Dt+=ee+=p.b=o[G+2],Rt+=ie+=p.a=o[G+3],p=p.next,Zt+=ht=x.r,jt+=ct=x.g,Kt+=ft=x.b,Jt+=q=x.a,se-=ht,te-=ct,ee-=ft,ie-=q,x=x.next,b+=i}}return l}var Be=function l(){gi(this,l),this.r=0,this.g=0,this.b=0,this.a=0,this.next=null};function bi(){let{DOMParser:l}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const t={window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:l,createCanvas(e,i){return new OffscreenCanvas(e,i)},async createImage(e){const s=await(await fetch(e)).blob();return await createImageBitmap(s)}};return(typeof globalThis.DOMParser!="undefined"||typeof l=="undefined")&&Reflect.deleteProperty(t,"DOMParser"),t}function vi(l){let{DOMParser:t,canvas:e,fetch:i}=l;return{window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:t,fetch:i,createCanvas:e.createCanvas,createImage:e.loadImage}}var Ai=Object.freeze({__proto__:null,offscreen:bi,node:vi});function Tt(l){return l.replace(/(?!\u3000)\s+/gm," ")}function Ci(l){return l.replace(/^[\n \t]+/,"")}function Si(l){return l.replace(/[\n \t]+$/,"")}function $(l){const t=l.match(/-?(\d+(?:\.\d*(?:[eE][+-]?\d+)?)?|\.\d+)(?=\D|$)/gm);return t?t.map(parseFloat):[]}function Ti(l){const t=$(l);return[t[0]||0,t[1]||0,t[2]||0,t[3]||0,t[4]||0,t[5]||0]}const Ei=/^[A-Z-]+$/;function wi(l){return Ei.test(l)?l.toLowerCase():l}function $e(l){const t=/url\(('([^']+)'|"([^"]+)"|([^'")]+))\)/.exec(l);return t&&(t[2]||t[3]||t[4])||""}function Ni(l){if(!l.startsWith("rgb"))return l;let t=3;return l.replace(/\d+(\.\d+)?/g,(i,s)=>t--&&s?String(Math.round(parseFloat(i))):i)}const Pi=/(\[[^\]]+\])/g,Mi=/(#[^\s+>~.[:]+)/g,Fi=/(\.[^\s+>~.[:]+)/g,Oi=/(::[^\s+>~.[:]+|:first-line|:first-letter|:before|:after)/gi,Vi=/(:[\w-]+\([^)]*\))/gi,Bi=/(:[^\s+>~.[:]+)/g,ki=/([^\s+>~.[:]+)/g;function dt(l,t){const e=t.exec(l);return e?[l.replace(t," "),e.length]:[l,0]}function Di(l){const t=[0,0,0];let e=l.replace(/:not\(([^)]*)\)/g," $1 ").replace(/{[\s\S]*/gm," "),i=0;return[e,i]=dt(e,Pi),t[1]+=i,[e,i]=dt(e,Mi),t[0]+=i,[e,i]=dt(e,Fi),t[1]+=i,[e,i]=dt(e,Oi),t[2]+=i,[e,i]=dt(e,Vi),t[1]+=i,[e,i]=dt(e,Bi),t[1]+=i,e=e.replace(/[*\s+>~]/g," ").replace(/[#.]/g," "),[e,i]=dt(e,ki),t[2]+=i,t.join("")}const Ct=1e-8;function ke(l){return Math.sqrt(Math.pow(l[0],2)+Math.pow(l[1],2))}function ge(l,t){return(l[0]*t[0]+l[1]*t[1])/(ke(l)*ke(t))}function De(l,t){return(l[0]*t[1]<l[1]*t[0]?-1:1)*Math.acos(ge(l,t))}function Re(l){return l*l*l}function Le(l){return 3*l*l*(1-l)}function Ie(l){return 3*l*(1-l)*(1-l)}function _e(l){return(1-l)*(1-l)*(1-l)}function ze(l){return l*l}function He(l){return 2*l*(1-l)}function Ue(l){return(1-l)*(1-l)}class S{static empty(t){return new S(t,"EMPTY","")}split(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:" ";const{document:e,name:i}=this;return Tt(this.getString()).trim().split(t).map(s=>new S(e,i,s))}hasValue(t){const e=this.value;return e!==null&&e!==""&&(t||e!==0)&&typeof e!="undefined"}isString(t){const{value:e}=this,i=typeof e=="string";return!i||!t?i:t.test(e)}isUrlDefinition(){return this.isString(/^url\(/)}isPixels(){if(!this.hasValue())return!1;const t=this.getString();switch(!0){case t.endsWith("px"):case/^[0-9]+$/.test(t):return!0;default:return!1}}setValue(t){return this.value=t,this}getValue(t){return typeof t=="undefined"||this.hasValue()?this.value:t}getNumber(t){if(!this.hasValue())return typeof t=="undefined"?0:parseFloat(t);const{value:e}=this;let i=parseFloat(e);return this.isString(/%$/)&&(i/=100),i}getString(t){return typeof t=="undefined"||this.hasValue()?typeof this.value=="undefined"?"":String(this.value):String(t)}getColor(t){let e=this.getString(t);return this.isNormalizedColor||(this.isNormalizedColor=!0,e=Ni(e),this.value=e),e}getDpi(){return 96}getRem(){return this.document.rootEmSize}getEm(){return this.document.emSize}getUnits(){return this.getString().replace(/[0-9.-]/g,"")}getPixels(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(!this.hasValue())return 0;const[i,s]=typeof t=="boolean"?[void 0,t]:[t],{viewPort:r}=this.document.screen;switch(!0){case this.isString(/vmin$/):return this.getNumber()/100*Math.min(r.computeSize("x"),r.computeSize("y"));case this.isString(/vmax$/):return this.getNumber()/100*Math.max(r.computeSize("x"),r.computeSize("y"));case this.isString(/vw$/):return this.getNumber()/100*r.computeSize("x");case this.isString(/vh$/):return this.getNumber()/100*r.computeSize("y");case this.isString(/rem$/):return this.getNumber()*this.getRem();case this.isString(/em$/):return this.getNumber()*this.getEm();case this.isString(/ex$/):return this.getNumber()*this.getEm()/2;case this.isString(/px$/):return this.getNumber();case this.isString(/pt$/):return this.getNumber()*this.getDpi()*(1/72);case this.isString(/pc$/):return this.getNumber()*15;case this.isString(/cm$/):return this.getNumber()*this.getDpi()/2.54;case this.isString(/mm$/):return this.getNumber()*this.getDpi()/25.4;case this.isString(/in$/):return this.getNumber()*this.getDpi();case(this.isString(/%$/)&&s):return this.getNumber()*this.getEm();case this.isString(/%$/):return this.getNumber()*r.computeSize(i);default:{const o=this.getNumber();return e&&o<1?o*r.computeSize(i):o}}}getMilliseconds(){return this.hasValue()?this.isString(/ms$/)?this.getNumber():this.getNumber()*1e3:0}getRadians(){if(!this.hasValue())return 0;switch(!0){case this.isString(/deg$/):return this.getNumber()*(Math.PI/180);case this.isString(/grad$/):return this.getNumber()*(Math.PI/200);case this.isString(/rad$/):return this.getNumber();default:return this.getNumber()*(Math.PI/180)}}getDefinition(){const t=this.getString(),e=/#([^)'"]+)/.exec(t),i=(e==null?void 0:e[1])||t;return this.document.definitions[i]}getFillStyleDefinition(t,e){let i=this.getDefinition();if(!i)return null;if(typeof i.createGradient=="function"&&"getBoundingBox"in t)return i.createGradient(this.document.ctx,t,e);if(typeof i.createPattern=="function"){if(i.getHrefAttribute().hasValue()){const s=i.getAttribute("patternTransform");i=i.getHrefAttribute().getDefinition(),i&&s.hasValue()&&i.getAttribute("patternTransform",!0).setValue(s.value)}if(i)return i.createPattern(this.document.ctx,t,e)}return null}getTextBaseline(){if(!this.hasValue())return null;const t=this.getString();return S.textBaselineMapping[t]||null}addOpacity(t){let e=this.getColor();const i=e.length;let s=0;for(let r=0;r<i&&(e[r]===","&&s++,s!==3);r++);if(t.hasValue()&&this.isString()&&s!==3){const r=new ce(e);r.ok&&(r.alpha=t.getNumber(),e=r.toRGBA())}return new S(this.document,this.name,e)}constructor(t,e,i){this.document=t,this.name=e,this.value=i,this.isNormalizedColor=!1}}S.textBaselineMapping={baseline:"alphabetic","before-edge":"top","text-before-edge":"top",middle:"middle",central:"middle","after-edge":"bottom","text-after-edge":"bottom",ideographic:"ideographic",alphabetic:"alphabetic",hanging:"hanging",mathematical:"alphabetic"};class Pt{clear(){this.viewPorts=[]}setCurrent(t,e){this.viewPorts.push({width:t,height:e})}removeCurrent(){this.viewPorts.pop()}getRoot(){const[t]=this.viewPorts;return t||Xe()}getCurrent(){const{viewPorts:t}=this,e=t[t.length-1];return e||Xe()}get width(){return this.getCurrent().width}get height(){return this.getCurrent().height}computeSize(t){return typeof t=="number"?t:t==="x"?this.width:t==="y"?this.height:Math.sqrt(Math.pow(this.width,2)+Math.pow(this.height,2))/Math.sqrt(2)}constructor(){this.viewPorts=[]}}Pt.DEFAULT_VIEWPORT_WIDTH=800;Pt.DEFAULT_VIEWPORT_HEIGHT=600;function Xe(){return{width:Pt.DEFAULT_VIEWPORT_WIDTH,height:Pt.DEFAULT_VIEWPORT_HEIGHT}}class V{static parse(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;const[i=e,s=e]=$(t);return new V(i,s)}static parseScale(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;const[i=e,s=i]=$(t);return new V(i,s)}static parsePath(t){const e=$(t),i=e.length,s=[];for(let r=0;r<i;r+=2)s.push(new V(e[r],e[r+1]));return s}angleTo(t){return Math.atan2(t.y-this.y,t.x-this.x)}applyTransform(t){const{x:e,y:i}=this,s=e*t[0]+i*t[2]+t[4],r=e*t[1]+i*t[3]+t[5];this.x=s,this.y=r}constructor(t,e){this.x=t,this.y=e}}class Ri{isWorking(){return this.working}start(){if(this.working)return;const{screen:t,onClick:e,onMouseMove:i}=this,s=t.ctx.canvas;s.onclick=e,s.onmousemove=i,this.working=!0}stop(){if(!this.working)return;const t=this.screen.ctx.canvas;this.working=!1,t.onclick=null,t.onmousemove=null}hasEvents(){return this.working&&this.events.length>0}runEvents(){if(!this.working)return;const{screen:t,events:e,eventElements:i}=this,{style:s}=t.ctx.canvas;let r;s&&(s.cursor=""),e.forEach((o,n)=>{let{run:a}=o;for(r=i[n];r;)a(r),r=r.parent}),this.events=[],this.eventElements=[]}checkPath(t,e){if(!this.working||!e)return;const{events:i,eventElements:s}=this;i.forEach((r,o)=>{let{x:n,y:a}=r;!s[o]&&e.isPointInPath&&e.isPointInPath(n,a)&&(s[o]=t)})}checkBoundingBox(t,e){if(!this.working||!e)return;const{events:i,eventElements:s}=this;i.forEach((r,o)=>{let{x:n,y:a}=r;!s[o]&&e.isPointInBox(n,a)&&(s[o]=t)})}mapXY(t,e){const{window:i,ctx:s}=this.screen,r=new V(t,e);let o=s.canvas;for(;o;)r.x-=o.offsetLeft,r.y-=o.offsetTop,o=o.offsetParent;return i!=null&&i.scrollX&&(r.x+=i.scrollX),i!=null&&i.scrollY&&(r.y+=i.scrollY),r}onClick(t){const{x:e,y:i}=this.mapXY(t.clientX,t.clientY);this.events.push({type:"onclick",x:e,y:i,run(s){s.onClick&&s.onClick()}})}onMouseMove(t){const{x:e,y:i}=this.mapXY(t.clientX,t.clientY);this.events.push({type:"onmousemove",x:e,y:i,run(s){s.onMouseMove&&s.onMouseMove()}})}constructor(t){this.screen=t,this.working=!1,this.events=[],this.eventElements=[],this.onClick=this.onClick.bind(this),this.onMouseMove=this.onMouseMove.bind(this)}}const Ze=typeof window!="undefined"?window:null,je=typeof fetch!="undefined"?fetch.bind(void 0):void 0;class rt{wait(t){this.waits.push(t)}ready(){return this.readyPromise?this.readyPromise:Promise.resolve()}isReady(){if(this.isReadyLock)return!0;const t=this.waits.every(e=>e());return t&&(this.waits=[],this.resolveReady&&this.resolveReady()),this.isReadyLock=t,t}setDefaults(t){t.strokeStyle="rgba(0,0,0,0)",t.lineCap="butt",t.lineJoin="miter",t.miterLimit=4}setViewBox(t){let{document:e,ctx:i,aspectRatio:s,width:r,desiredWidth:o,height:n,desiredHeight:a,minX:u=0,minY:h=0,refX:f,refY:g,clip:c=!1,clipX:d=0,clipY:m=0}=t;const p=Tt(s).replace(/^defer\s/,""),[x,C]=p.split(" "),b=x||"xMidYMid",A=C||"meet",P=r/o,T=n/a,v=Math.min(P,T),w=Math.max(P,T);let N=o,k=a;A==="meet"&&(N*=v,k*=v),A==="slice"&&(N*=w,k*=w);const z=new S(e,"refX",f),D=new S(e,"refY",g),H=z.hasValue()&&D.hasValue();if(H&&i.translate(-v*z.getPixels("x"),-v*D.getPixels("y")),c){const R=v*d,L=v*m;i.beginPath(),i.moveTo(R,L),i.lineTo(r,L),i.lineTo(r,n),i.lineTo(R,n),i.closePath(),i.clip()}if(!H){const R=A==="meet"&&v===T,L=A==="slice"&&w===T,X=A==="meet"&&v===P,U=A==="slice"&&w===P;b.startsWith("xMid")&&(R||L)&&i.translate(r/2-N/2,0),b.endsWith("YMid")&&(X||U)&&i.translate(0,n/2-k/2),b.startsWith("xMax")&&(R||L)&&i.translate(r-N,0),b.endsWith("YMax")&&(X||U)&&i.translate(0,n-k)}switch(!0){case b==="none":i.scale(P,T);break;case A==="meet":i.scale(v,v);break;case A==="slice":i.scale(w,w);break}i.translate(-u,-h)}start(t){let{enableRedraw:e=!1,ignoreMouse:i=!1,ignoreAnimation:s=!1,ignoreDimensions:r=!1,ignoreClear:o=!1,forceRedraw:n,scaleWidth:a,scaleHeight:u,offsetX:h,offsetY:f}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{mouse:g}=this,c=1e3/rt.FRAMERATE;if(this.isReadyLock=!1,this.frameDuration=c,this.readyPromise=new Promise(C=>{this.resolveReady=C}),this.isReady()&&this.render(t,r,o,a,u,h,f),!e)return;let d=Date.now(),m=d,p=0;const x=()=>{d=Date.now(),p=d-m,p>=c&&(m=d-p%c,this.shouldUpdate(s,n)&&(this.render(t,r,o,a,u,h,f),g.runEvents())),this.intervalId=ae(x)};i||g.start(),this.intervalId=ae(x)}stop(){this.intervalId&&(ae.cancel(this.intervalId),this.intervalId=null),this.mouse.stop()}shouldUpdate(t,e){if(!t){const{frameDuration:i}=this;if(this.animations.reduce((r,o)=>o.update(i)||r,!1))return!0}return!!(typeof e=="function"&&e()||!this.isReadyLock&&this.isReady()||this.mouse.hasEvents())}render(t,e,i,s,r,o,n){const{viewPort:a,ctx:u,isFirstRender:h}=this,f=u.canvas;a.clear(),f.width&&f.height&&a.setCurrent(f.width,f.height);const g=t.getStyle("width"),c=t.getStyle("height");!e&&(h||typeof s!="number"&&typeof r!="number")&&(g.hasValue()&&(f.width=g.getPixels("x"),f.style&&(f.style.width="".concat(f.width,"px"))),c.hasValue()&&(f.height=c.getPixels("y"),f.style&&(f.style.height="".concat(f.height,"px"))));let d=f.clientWidth||f.width,m=f.clientHeight||f.height;if(e&&g.hasValue()&&c.hasValue()&&(d=g.getPixels("x"),m=c.getPixels("y")),a.setCurrent(d,m),typeof o=="number"&&t.getAttribute("x",!0).setValue(o),typeof n=="number"&&t.getAttribute("y",!0).setValue(n),typeof s=="number"||typeof r=="number"){const p=$(t.getAttribute("viewBox").getString());let x=0,C=0;if(typeof s=="number"){const A=t.getStyle("width");A.hasValue()?x=A.getPixels("x")/s:p[2]&&!isNaN(p[2])&&(x=p[2]/s)}if(typeof r=="number"){const A=t.getStyle("height");A.hasValue()?C=A.getPixels("y")/r:p[3]&&!isNaN(p[3])&&(C=p[3]/r)}x||(x=C),C||(C=x),t.getAttribute("width",!0).setValue(s),t.getAttribute("height",!0).setValue(r);const b=t.getStyle("transform",!0,!0);b.setValue("".concat(b.getString()," scale(").concat(1/x,", ").concat(1/C,")"))}i||u.clearRect(0,0,d,m),t.render(u),h&&(this.isFirstRender=!1)}constructor(t,{fetch:e=je,window:i=Ze}={}){if(this.ctx=t,this.viewPort=new Pt,this.mouse=new Ri(this),this.animations=[],this.waits=[],this.frameDuration=0,this.isReadyLock=!1,this.isFirstRender=!0,this.intervalId=null,this.window=i,!e)throw new Error("Can't find 'fetch' in 'globalThis', please provide it via options");this.fetch=e}}rt.defaultWindow=Ze;rt.defaultFetch=je;rt.FRAMERATE=30;rt.MAX_VIRTUAL_PIXELS=3e4;const{defaultFetch:Li}=rt,Ii=typeof DOMParser!="undefined"?DOMParser:void 0;class le{async parse(t){return t.startsWith("<")?this.parseFromString(t):this.load(t)}parseFromString(t){const e=new this.DOMParser;try{return this.checkDocument(e.parseFromString(t,"image/svg+xml"))}catch{return this.checkDocument(e.parseFromString(t,"text/xml"))}}checkDocument(t){const e=t.getElementsByTagName("parsererror")[0];if(e)throw new Error(e.textContent||"Unknown parse error");return t}async load(t){const i=await(await this.fetch(t)).text();return this.parseFromString(i)}constructor({fetch:t=Li,DOMParser:e=Ii}={}){if(!t)throw new Error("Can't find 'fetch' in 'globalThis', please provide it via options");if(!e)throw new Error("Can't find 'DOMParser' in 'globalThis', please provide it via options");this.fetch=t,this.DOMParser=e}}class _i{apply(t){const{x:e,y:i}=this.point;t.translate(e||0,i||0)}unapply(t){const{x:e,y:i}=this.point;t.translate(-1*e||0,-1*i||0)}applyToPoint(t){const{x:e,y:i}=this.point;t.applyTransform([1,0,0,1,e||0,i||0])}constructor(t,e){this.type="translate",this.point=V.parse(e)}}class zi{apply(t){const{cx:e,cy:i,originX:s,originY:r,angle:o}=this,n=e+s.getPixels("x"),a=i+r.getPixels("y");t.translate(n,a),t.rotate(o.getRadians()),t.translate(-n,-a)}unapply(t){const{cx:e,cy:i,originX:s,originY:r,angle:o}=this,n=e+s.getPixels("x"),a=i+r.getPixels("y");t.translate(n,a),t.rotate(-1*o.getRadians()),t.translate(-n,-a)}applyToPoint(t){const{cx:e,cy:i,angle:s}=this,r=s.getRadians();t.applyTransform([1,0,0,1,e||0,i||0]),t.applyTransform([Math.cos(r),Math.sin(r),-Math.sin(r),Math.cos(r),0,0]),t.applyTransform([1,0,0,1,-e||0,-i||0])}constructor(t,e,i){this.type="rotate";const s=$(e);this.angle=new S(t,"angle",s[0]),this.originX=i[0],this.originY=i[1],this.cx=s[1]||0,this.cy=s[2]||0}}class Hi{apply(t){const{scale:{x:e,y:i},originX:s,originY:r}=this,o=s.getPixels("x"),n=r.getPixels("y");t.translate(o,n),t.scale(e,i||e),t.translate(-o,-n)}unapply(t){const{scale:{x:e,y:i},originX:s,originY:r}=this,o=s.getPixels("x"),n=r.getPixels("y");t.translate(o,n),t.scale(1/e,1/i||e),t.translate(-o,-n)}applyToPoint(t){const{x:e,y:i}=this.scale;t.applyTransform([e||0,0,0,i||0,0,0])}constructor(t,e,i){this.type="scale";const s=V.parseScale(e);(s.x===0||s.y===0)&&(s.x=Ct,s.y=Ct),this.scale=s,this.originX=i[0],this.originY=i[1]}}class Ke{apply(t){const{originX:e,originY:i,matrix:s}=this,r=e.getPixels("x"),o=i.getPixels("y");t.translate(r,o),t.transform(s[0],s[1],s[2],s[3],s[4],s[5]),t.translate(-r,-o)}unapply(t){const{originX:e,originY:i,matrix:s}=this,r=s[0],o=s[2],n=s[4],a=s[1],u=s[3],h=s[5],f=0,g=0,c=1,d=1/(r*(u*c-h*g)-o*(a*c-h*f)+n*(a*g-u*f)),m=e.getPixels("x"),p=i.getPixels("y");t.translate(m,p),t.transform(d*(u*c-h*g),d*(h*f-a*c),d*(n*g-o*c),d*(r*c-n*f),d*(o*h-n*u),d*(n*a-r*h)),t.translate(-m,-p)}applyToPoint(t){t.applyTransform(this.matrix)}constructor(t,e,i){this.type="matrix",this.matrix=Ti(e),this.originX=i[0],this.originY=i[1]}}class Je extends Ke{constructor(t,e,i){super(t,e,i),this.type="skew",this.angle=new S(t,"angle",e)}}class Ui extends Je{constructor(t,e,i){super(t,e,i),this.type="skewX",this.matrix=[1,0,Math.tan(this.angle.getRadians()),1,0,0]}}class Xi extends Je{constructor(t,e,i){super(t,e,i),this.type="skewY",this.matrix=[1,Math.tan(this.angle.getRadians()),0,1,0,0]}}function Yi(l){return Tt(l).trim().replace(/\)([a-zA-Z])/g,") $1").replace(/\)(\s?,\s?)/g,") ").split(/\s(?=[a-z])/)}function Wi(l){const[t="",e=""]=l.split("(");return[t.trim(),e.trim().replace(")","")]}class mt{static fromElement(t,e){const i=e.getStyle("transform",!1,!0);if(i.hasValue()){const[s,r=s]=e.getStyle("transform-origin",!1,!0).split();if(s&&r){const o=[s,r];return new mt(t,i.getString(),o)}}return null}apply(t){this.transforms.forEach(e=>e.apply(t))}unapply(t){this.transforms.forEach(e=>e.unapply(t))}applyToPoint(t){this.transforms.forEach(e=>e.applyToPoint(t))}constructor(t,e,i){this.document=t,this.transforms=[],Yi(e).forEach(r=>{if(r==="none")return;const[o,n]=Wi(r),a=mt.transformTypes[o];a&&this.transforms.push(new a(this.document,n,i))})}}mt.transformTypes={translate:_i,rotate:zi,scale:Hi,matrix:Ke,skewX:Ui,skewY:Xi};class F{getAttribute(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const i=this.attributes[t];if(!i&&e){const s=new S(this.document,t,"");return this.attributes[t]=s,s}return i||S.empty(this.document)}getHrefAttribute(){let t;for(const e in this.attributes)if(e==="href"||e.endsWith(":href")){t=this.attributes[e];break}return t||S.empty(this.document)}getStyle(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const s=this.styles[t];if(s)return s;const r=this.getAttribute(t);if(r.hasValue())return this.styles[t]=r,r;if(!i){const{parent:o}=this;if(o){const n=o.getStyle(t);if(n.hasValue())return n}}if(e){const o=new S(this.document,t,"");return this.styles[t]=o,o}return S.empty(this.document)}render(t){if(!(this.getStyle("display").getString()==="none"||this.getStyle("visibility").getString()==="hidden")){if(t.save(),this.getStyle("mask").hasValue()){const e=this.getStyle("mask").getDefinition();e&&(this.applyEffects(t),e.apply(t,this))}else if(this.getStyle("filter").getValue("none")!=="none"){const e=this.getStyle("filter").getDefinition();e&&(this.applyEffects(t),e.apply(t,this))}else this.setContext(t),this.renderChildren(t),this.clearContext(t);t.restore()}}setContext(t){}applyEffects(t){const e=mt.fromElement(this.document,this);e&&e.apply(t);const i=this.getStyle("clip-path",!1,!0);if(i.hasValue()){const s=i.getDefinition();s&&s.apply(t)}}clearContext(t){}renderChildren(t){this.children.forEach(e=>{e.render(t)})}addChild(t){const e=t instanceof F?t:this.document.createElement(t);e.parent=this,F.ignoreChildTypes.includes(e.type)||this.children.push(e)}matchesSelector(t){var e;const{node:i}=this;if(typeof i.matches=="function")return i.matches(t);const s=(e=i.getAttribute)===null||e===void 0?void 0:e.call(i,"class");return!s||s===""?!1:s.split(" ").some(r=>".".concat(r)===t)}addStylesFromStyleDefinition(){const{styles:t,stylesSpecificity:e}=this.document;let i;for(const s in t)if(!s.startsWith("@")&&this.matchesSelector(s)){const r=t[s],o=e[s];if(r)for(const n in r){let a=this.stylesSpecificity[n];typeof a=="undefined"&&(a="000"),o&&o>=a&&(i=r[n],i&&(this.styles[n]=i),this.stylesSpecificity[n]=o)}}}removeStyles(t,e){return e.reduce((s,r)=>{const o=t.getStyle(r);if(!o.hasValue())return s;const n=o.getString();return o.setValue(""),[...s,[r,n]]},[])}restoreStyles(t,e){e.forEach(i=>{let[s,r]=i;t.getStyle(s,!0).setValue(r)})}isFirstChild(){var t;return((t=this.parent)===null||t===void 0?void 0:t.children.indexOf(this))===0}constructor(t,e,i=!1){if(this.document=t,this.node=e,this.captureTextNodes=i,this.type="",this.attributes={},this.styles={},this.stylesSpecificity={},this.animationFrozen=!1,this.animationFrozenValue="",this.parent=null,this.children=[],!e||e.nodeType!==1)return;Array.from(e.attributes).forEach(o=>{const n=wi(o.nodeName);this.attributes[n]=new S(t,n,o.value)}),this.addStylesFromStyleDefinition(),this.getAttribute("style").hasValue()&&this.getAttribute("style").getString().split(";").map(n=>n.trim()).forEach(n=>{if(!n)return;const[a,u]=n.split(":").map(h=>h.trim());a&&(this.styles[a]=new S(t,a,u))});const{definitions:s}=t,r=this.getAttribute("id");r.hasValue()&&(s[r.getString()]||(s[r.getString()]=this)),Array.from(e.childNodes).forEach(o=>{if(o.nodeType===1)this.addChild(o);else if(i&&(o.nodeType===3||o.nodeType===4)){const n=t.createTextNode(o);n.getText().length>0&&this.addChild(n)}})}}F.ignoreChildTypes=["title"];class qi extends F{constructor(t,e,i){super(t,e,i)}}function Gi(l){const t=l.trim();return/^('|")/.test(t)?t:'"'.concat(t,'"')}function Qi(l){return typeof process=="undefined"?l:l.trim().split(",").map(Gi).join(",")}function $i(l){if(!l)return"";const t=l.trim().toLowerCase();switch(t){case"normal":case"italic":case"oblique":case"inherit":case"initial":case"unset":return t;default:return/^oblique\s+(-|)\d+deg$/.test(t)?t:""}}function Zi(l){if(!l)return"";const t=l.trim().toLowerCase();switch(t){case"normal":case"bold":case"lighter":case"bolder":case"inherit":case"initial":case"unset":return t;default:return/^[\d.]+$/.test(t)?t:""}}class W{static parse(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",e=arguments.length>1?arguments[1]:void 0,i="",s="",r="",o="",n="";const a=Tt(t).trim().split(" "),u={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1};return a.forEach(h=>{switch(!0){case(!u.fontStyle&&W.styles.includes(h)):h!=="inherit"&&(i=h),u.fontStyle=!0;break;case(!u.fontVariant&&W.variants.includes(h)):h!=="inherit"&&(s=h),u.fontStyle=!0,u.fontVariant=!0;break;case(!u.fontWeight&&W.weights.includes(h)):h!=="inherit"&&(r=h),u.fontStyle=!0,u.fontVariant=!0,u.fontWeight=!0;break;case!u.fontSize:h!=="inherit"&&(o=h.split("/")[0]||""),u.fontStyle=!0,u.fontVariant=!0,u.fontWeight=!0,u.fontSize=!0;break;default:h!=="inherit"&&(n+=h)}}),new W(i,s,r,o,n,e)}toString(){return[$i(this.fontStyle),this.fontVariant,Zi(this.fontWeight),this.fontSize,Qi(this.fontFamily)].join(" ").trim()}constructor(t,e,i,s,r,o){const n=o?typeof o=="string"?W.parse(o):o:{};this.fontFamily=r||n.fontFamily,this.fontSize=s||n.fontSize,this.fontStyle=t||n.fontStyle,this.fontWeight=i||n.fontWeight,this.fontVariant=e||n.fontVariant}}W.styles="normal|italic|oblique|inherit";W.variants="normal|small-caps|inherit";W.weights="normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit";class J{get x(){return this.x1}get y(){return this.y1}get width(){return this.x2-this.x1}get height(){return this.y2-this.y1}addPoint(t,e){typeof t!="undefined"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=t,this.x2=t),t<this.x1&&(this.x1=t),t>this.x2&&(this.x2=t)),typeof e!="undefined"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),e<this.y1&&(this.y1=e),e>this.y2&&(this.y2=e))}addX(t){this.addPoint(t,0)}addY(t){this.addPoint(0,t)}addBoundingBox(t){if(!t)return;const{x1:e,y1:i,x2:s,y2:r}=t;this.addPoint(e,i),this.addPoint(s,r)}sumCubic(t,e,i,s,r){return Math.pow(1-t,3)*e+3*Math.pow(1-t,2)*t*i+3*(1-t)*Math.pow(t,2)*s+Math.pow(t,3)*r}bezierCurveAdd(t,e,i,s,r){const o=6*e-12*i+6*s,n=-3*e+9*i-9*s+3*r,a=3*i-3*e;if(n===0){if(o===0)return;const g=-a/o;0<g&&g<1&&(t?this.addX(this.sumCubic(g,e,i,s,r)):this.addY(this.sumCubic(g,e,i,s,r)));return}const u=Math.pow(o,2)-4*a*n;if(u<0)return;const h=(-o+Math.sqrt(u))/(2*n);0<h&&h<1&&(t?this.addX(this.sumCubic(h,e,i,s,r)):this.addY(this.sumCubic(h,e,i,s,r)));const f=(-o-Math.sqrt(u))/(2*n);0<f&&f<1&&(t?this.addX(this.sumCubic(f,e,i,s,r)):this.addY(this.sumCubic(f,e,i,s,r)))}addBezierCurve(t,e,i,s,r,o,n,a){this.addPoint(t,e),this.addPoint(n,a),this.bezierCurveAdd(!0,t,i,r,n),this.bezierCurveAdd(!1,e,s,o,a)}addQuadraticCurve(t,e,i,s,r,o){const n=t+.6666666666666666*(i-t),a=e+2/3*(s-e),u=n+1/3*(r-t),h=a+1/3*(o-e);this.addBezierCurve(t,e,n,u,a,h,r,o)}isPointInBox(t,e){const{x1:i,y1:s,x2:r,y2:o}=this;return i<=t&&t<=r&&s<=e&&e<=o}constructor(t=Number.NaN,e=Number.NaN,i=Number.NaN,s=Number.NaN){this.x1=t,this.y1=e,this.x2=i,this.y2=s,this.addPoint(t,e),this.addPoint(i,s)}}class pt extends F{calculateOpacity(){let t=1,e=this;for(;e;){const i=e.getStyle("opacity",!1,!0);i.hasValue(!0)&&(t*=i.getNumber()),e=e.parent}return t}setContext(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(!e){const i=this.getStyle("fill"),s=this.getStyle("fill-opacity"),r=this.getStyle("stroke"),o=this.getStyle("stroke-opacity");if(i.isUrlDefinition()){const c=i.getFillStyleDefinition(this,s);c&&(t.fillStyle=c)}else if(i.hasValue()){i.getString()==="currentColor"&&i.setValue(this.getStyle("color").getColor());const c=i.getColor();c!=="inherit"&&(t.fillStyle=c==="none"?"rgba(0,0,0,0)":c)}if(s.hasValue()){const c=new S(this.document,"fill",t.fillStyle).addOpacity(s).getColor();t.fillStyle=c}if(r.isUrlDefinition()){const c=r.getFillStyleDefinition(this,o);c&&(t.strokeStyle=c)}else if(r.hasValue()){r.getString()==="currentColor"&&r.setValue(this.getStyle("color").getColor());const c=r.getString();c!=="inherit"&&(t.strokeStyle=c==="none"?"rgba(0,0,0,0)":c)}if(o.hasValue()){const c=new S(this.document,"stroke",t.strokeStyle).addOpacity(o).getString();t.strokeStyle=c}const n=this.getStyle("stroke-width");if(n.hasValue()){const c=n.getPixels();t.lineWidth=c||Ct}const a=this.getStyle("stroke-linecap"),u=this.getStyle("stroke-linejoin"),h=this.getStyle("stroke-miterlimit"),f=this.getStyle("stroke-dasharray"),g=this.getStyle("stroke-dashoffset");if(a.hasValue()&&(t.lineCap=a.getString()),u.hasValue()&&(t.lineJoin=u.getString()),h.hasValue()&&(t.miterLimit=h.getNumber()),f.hasValue()&&f.getString()!=="none"){const c=$(f.getString());typeof t.setLineDash!="undefined"?t.setLineDash(c):typeof t.webkitLineDash!="undefined"?t.webkitLineDash=c:typeof t.mozDash!="undefined"&&!(c.length===1&&c[0]===0)&&(t.mozDash=c);const d=g.getPixels();typeof t.lineDashOffset!="undefined"?t.lineDashOffset=d:typeof t.webkitLineDashOffset!="undefined"?t.webkitLineDashOffset=d:typeof t.mozDashOffset!="undefined"&&(t.mozDashOffset=d)}}if(this.modifiedEmSizeStack=!1,typeof t.font!="undefined"){const i=this.getStyle("font"),s=this.getStyle("font-style"),r=this.getStyle("font-variant"),o=this.getStyle("font-weight"),n=this.getStyle("font-size"),a=this.getStyle("font-family"),u=new W(s.getString(),r.getString(),o.getString(),n.hasValue()?"".concat(n.getPixels(!0),"px"):"",a.getString(),W.parse(i.getString(),t.font));s.setValue(u.fontStyle),r.setValue(u.fontVariant),o.setValue(u.fontWeight),n.setValue(u.fontSize),a.setValue(u.fontFamily),t.font=u.toString(),n.isPixels()&&(this.document.emSize=n.getPixels(),this.modifiedEmSizeStack=!0)}e||(this.applyEffects(t),t.globalAlpha=this.calculateOpacity())}clearContext(t){super.clearContext(t),this.modifiedEmSizeStack&&this.document.popEmSize()}constructor(...t){super(...t),this.modifiedEmSizeStack=!1}}class ut extends pt{setContext(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;super.setContext(t,e);const i=this.getStyle("dominant-baseline").getTextBaseline()||this.getStyle("alignment-baseline").getTextBaseline();i&&(t.textBaseline=i)}initializeCoordinates(){this.x=0,this.y=0,this.leafTexts=[],this.textChunkStart=0,this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY}getBoundingBox(t){if(this.type!=="text")return this.getTElementBoundingBox(t);this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(t);let e=null;return this.children.forEach((i,s)=>{const r=this.getChildBoundingBox(t,this,this,s);e?e.addBoundingBox(r):e=r}),e}getFontSize(){const{document:t,parent:e}=this,i=W.parse(t.ctx.font).fontSize;return e.getStyle("font-size").getNumber(i)}getTElementBoundingBox(t){const e=this.getFontSize();return new J(this.x,this.y-e,this.x+this.measureText(t),this.y)}getGlyph(t,e,i){const s=e[i];let r;if(t.isArabic){var o;const n=e.length,a=e[i-1],u=e[i+1];let h="isolated";(i===0||a===" ")&&i<n-1&&u!==" "&&(h="terminal"),i>0&&a!==" "&&i<n-1&&u!==" "&&(h="medial"),i>0&&a!==" "&&(i===n-1||u===" ")&&(h="initial"),r=((o=t.arabicGlyphs[s])===null||o===void 0?void 0:o[h])||t.glyphs[s]}else r=t.glyphs[s];return r||(r=t.missingGlyph),r}getText(){return""}getTextFromNode(t){const e=t||this.node,i=Array.from(e.parentNode.childNodes),s=i.indexOf(e),r=i.length-1;let o=Tt(e.textContent||"");return s===0&&(o=Ci(o)),s===r&&(o=Si(o)),o}renderChildren(t){if(this.type!=="text"){this.renderTElementChildren(t);return}this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(t),this.children.forEach((i,s)=>{this.renderChild(t,this,this,s)});const{mouse:e}=this.document.screen;e.isWorking()&&e.checkBoundingBox(this,this.getBoundingBox(t))}renderTElementChildren(t){const{document:e,parent:i}=this,s=this.getText(),r=i.getStyle("font-family").getDefinition();if(r){const{unitsPerEm:a}=r.fontFace,u=W.parse(e.ctx.font),h=i.getStyle("font-size").getNumber(u.fontSize),f=i.getStyle("font-style").getString(u.fontStyle),g=h/a,c=r.isRTL?s.split("").reverse().join(""):s,d=$(i.getAttribute("dx").getString()),m=c.length;for(let p=0;p<m;p++){const x=this.getGlyph(r,c,p);t.translate(this.x,this.y),t.scale(g,-g);const C=t.lineWidth;t.lineWidth=t.lineWidth*a/h,f==="italic"&&t.transform(1,0,.4,1,0,0),x.render(t),f==="italic"&&t.transform(1,0,-.4,1,0,0),t.lineWidth=C,t.scale(1/g,-1/g),t.translate(-this.x,-this.y),this.x+=h*(x.horizAdvX||r.horizAdvX)/a,typeof d[p]!="undefined"&&!isNaN(d[p])&&(this.x+=d[p])}return}const{x:o,y:n}=this;t.fillStyle&&t.fillText(s,o,n),t.strokeStyle&&t.strokeText(s,o,n)}applyAnchoring(){if(this.textChunkStart>=this.leafTexts.length)return;const t=this.leafTexts[this.textChunkStart],e=t.getStyle("text-anchor").getString("start"),i=!1;let s=0;e==="start"&&!i||e==="end"&&i?s=t.x-this.minX:e==="end"&&!i||e==="start"&&i?s=t.x-this.maxX:s=t.x-(this.minX+this.maxX)/2;for(let r=this.textChunkStart;r<this.leafTexts.length;r++)this.leafTexts[r].x+=s;this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.textChunkStart=this.leafTexts.length}adjustChildCoordinatesRecursive(t){this.children.forEach((e,i)=>{this.adjustChildCoordinatesRecursiveCore(t,this,this,i)}),this.applyAnchoring()}adjustChildCoordinatesRecursiveCore(t,e,i,s){const r=i.children[s];r.children.length>0?r.children.forEach((o,n)=>{e.adjustChildCoordinatesRecursiveCore(t,e,r,n)}):this.adjustChildCoordinates(t,e,i,s)}adjustChildCoordinates(t,e,i,s){const r=i.children[s];if(typeof r.measureText!="function")return r;t.save(),r.setContext(t,!0);const o=r.getAttribute("x"),n=r.getAttribute("y"),a=r.getAttribute("dx"),u=r.getAttribute("dy"),h=r.getStyle("font-family").getDefinition(),f=Boolean(h==null?void 0:h.isRTL);s===0&&(o.hasValue()||o.setValue(r.getInheritedAttribute("x")),n.hasValue()||n.setValue(r.getInheritedAttribute("y")),a.hasValue()||a.setValue(r.getInheritedAttribute("dx")),u.hasValue()||u.setValue(r.getInheritedAttribute("dy")));const g=r.measureText(t);return f&&(e.x-=g),o.hasValue()?(e.applyAnchoring(),r.x=o.getPixels("x"),a.hasValue()&&(r.x+=a.getPixels("x"))):(a.hasValue()&&(e.x+=a.getPixels("x")),r.x=e.x),e.x=r.x,f||(e.x+=g),n.hasValue()?(r.y=n.getPixels("y"),u.hasValue()&&(r.y+=u.getPixels("y"))):(u.hasValue()&&(e.y+=u.getPixels("y")),r.y=e.y),e.y=r.y,e.leafTexts.push(r),e.minX=Math.min(e.minX,r.x,r.x+g),e.maxX=Math.max(e.maxX,r.x,r.x+g),r.clearContext(t),t.restore(),r}getChildBoundingBox(t,e,i,s){const r=i.children[s];if(typeof r.getBoundingBox!="function")return null;const o=r.getBoundingBox(t);return o&&r.children.forEach((n,a)=>{const u=e.getChildBoundingBox(t,e,r,a);o.addBoundingBox(u)}),o}renderChild(t,e,i,s){const r=i.children[s];r.render(t),r.children.forEach((o,n)=>{e.renderChild(t,e,r,n)})}measureText(t){const{measureCache:e}=this;if(~e)return e;const i=this.getText(),s=this.measureTargetText(t,i);return this.measureCache=s,s}measureTargetText(t,e){if(!e.length)return 0;const{parent:i}=this,s=i.getStyle("font-family").getDefinition();if(s){const o=this.getFontSize(),n=s.isRTL?e.split("").reverse().join(""):e,a=$(i.getAttribute("dx").getString()),u=n.length;let h=0;for(let f=0;f<u;f++)h+=(this.getGlyph(s,n,f).horizAdvX||s.horizAdvX)*o/s.fontFace.unitsPerEm,typeof a[f]!="undefined"&&!isNaN(a[f])&&(h+=a[f]);return h}if(!t.measureText)return e.length*10;t.save(),this.setContext(t,!0);const{width:r}=t.measureText(e);return this.clearContext(t),t.restore(),r}getInheritedAttribute(t){let e=this;for(;e instanceof ut&&e.isFirstChild()&&e.parent;){const i=e.parent.getAttribute(t);if(i.hasValue(!0))return i.getString("0");e=e.parent}return null}constructor(t,e,i){super(t,e,new.target===ut?!0:i),this.type="text",this.x=0,this.y=0,this.leafTexts=[],this.textChunkStart=0,this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.measureCache=-1}}class Yt extends ut{getText(){return this.text}constructor(t,e,i){super(t,e,new.target===Yt?!0:i),this.type="tspan",this.text=this.children.length>0?"":this.getTextFromNode()}}class ji extends Yt{constructor(...t){super(...t),this.type="textNode"}}class E extends y{reset(){this.i=-1,this.command=null,this.previousCommand=null,this.start=new V(0,0),this.control=new V(0,0),this.current=new V(0,0),this.points=[],this.angles=[]}isEnd(){const{i:t,commands:e}=this;return t>=e.length-1}next(){const t=this.commands[++this.i];return this.previousCommand=this.command,this.command=t,t}getPoint(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"x",e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"y";const i=new V(this.command[t],this.command[e]);return this.makeAbsolute(i)}getAsControlPoint(t,e){const i=this.getPoint(t,e);return this.control=i,i}getAsCurrentPoint(t,e){const i=this.getPoint(t,e);return this.current=i,i}getReflectedControlPoint(){const t=this.previousCommand.type;if(t!==y.CURVE_TO&&t!==y.SMOOTH_CURVE_TO&&t!==y.QUAD_TO&&t!==y.SMOOTH_QUAD_TO)return this.current;const{current:{x:e,y:i},control:{x:s,y:r}}=this;return new V(2*e-s,2*i-r)}makeAbsolute(t){if(this.command.relative){const{x:e,y:i}=this.current;t.x+=e,t.y+=i}return t}addMarker(t,e,i){const{points:s,angles:r}=this;i&&r.length>0&&!r[r.length-1]&&(r[r.length-1]=s[s.length-1].angleTo(i)),this.addMarkerAngle(t,e?e.angleTo(t):null)}addMarkerAngle(t,e){this.points.push(t),this.angles.push(e)}getMarkerPoints(){return this.points}getMarkerAngles(){const{angles:t}=this,e=t.length;for(let i=0;i<e;i++)if(!t[i]){for(let s=i+1;s<e;s++)if(t[s]){t[i]=t[s];break}}return t}constructor(t){super(t.replace(/([+\-.])\s+/gm,"$1").replace(/[^MmZzLlHhVvCcSsQqTtAae\d\s.,+-].*/g,"")),this.control=new V(0,0),this.start=new V(0,0),this.current=new V(0,0),this.command=null,this.commands=this.commands,this.i=-1,this.previousCommand=null,this.points=[],this.angles=[]}}class M extends pt{path(t){const{pathParser:e}=this,i=new J;for(e.reset(),t&&t.beginPath();!e.isEnd();)switch(e.next().type){case E.MOVE_TO:this.pathM(t,i);break;case E.LINE_TO:this.pathL(t,i);break;case E.HORIZ_LINE_TO:this.pathH(t,i);break;case E.VERT_LINE_TO:this.pathV(t,i);break;case E.CURVE_TO:this.pathC(t,i);break;case E.SMOOTH_CURVE_TO:this.pathS(t,i);break;case E.QUAD_TO:this.pathQ(t,i);break;case E.SMOOTH_QUAD_TO:this.pathT(t,i);break;case E.ARC:this.pathA(t,i);break;case E.CLOSE_PATH:this.pathZ(t,i);break}return i}getBoundingBox(t){return this.path()}getMarkers(){const{pathParser:t}=this,e=t.getMarkerPoints(),i=t.getMarkerAngles();return e.map((r,o)=>[r,i[o]])}renderChildren(t){this.path(t),this.document.screen.mouse.checkPath(this,t);const e=this.getStyle("fill-rule");t.fillStyle!==""&&(e.getString("inherit")!=="inherit"?t.fill(e.getString()):t.fill()),t.strokeStyle!==""&&(this.getAttribute("vector-effect").getString()==="non-scaling-stroke"?(t.save(),t.setTransform(1,0,0,1,0,0),t.stroke(),t.restore()):t.stroke());const i=this.getMarkers();if(i){const s=i.length-1,r=this.getStyle("marker-start"),o=this.getStyle("marker-mid"),n=this.getStyle("marker-end");if(r.isUrlDefinition()){const a=r.getDefinition(),[u,h]=i[0];a.render(t,u,h)}if(o.isUrlDefinition()){const a=o.getDefinition();for(let u=1;u<s;u++){const[h,f]=i[u];a.render(t,h,f)}}if(n.isUrlDefinition()){const a=n.getDefinition(),[u,h]=i[s];a.render(t,u,h)}}}static pathM(t){const e=t.getAsCurrentPoint();return t.start=t.current,{point:e}}pathM(t,e){const{pathParser:i}=this,{point:s}=M.pathM(i),{x:r,y:o}=s;i.addMarker(s),e.addPoint(r,o),t&&t.moveTo(r,o)}static pathL(t){const{current:e}=t,i=t.getAsCurrentPoint();return{current:e,point:i}}pathL(t,e){const{pathParser:i}=this,{current:s,point:r}=M.pathL(i),{x:o,y:n}=r;i.addMarker(r,s),e.addPoint(o,n),t&&t.lineTo(o,n)}static pathH(t){const{current:e,command:i}=t,s=new V((i.relative?e.x:0)+i.x,e.y);return t.current=s,{current:e,point:s}}pathH(t,e){const{pathParser:i}=this,{current:s,point:r}=M.pathH(i),{x:o,y:n}=r;i.addMarker(r,s),e.addPoint(o,n),t&&t.lineTo(o,n)}static pathV(t){const{current:e,command:i}=t,s=new V(e.x,(i.relative?e.y:0)+i.y);return t.current=s,{current:e,point:s}}pathV(t,e){const{pathParser:i}=this,{current:s,point:r}=M.pathV(i),{x:o,y:n}=r;i.addMarker(r,s),e.addPoint(o,n),t&&t.lineTo(o,n)}static pathC(t){const{current:e}=t,i=t.getPoint("x1","y1"),s=t.getAsControlPoint("x2","y2"),r=t.getAsCurrentPoint();return{current:e,point:i,controlPoint:s,currentPoint:r}}pathC(t,e){const{pathParser:i}=this,{current:s,point:r,controlPoint:o,currentPoint:n}=M.pathC(i);i.addMarker(n,o,r),e.addBezierCurve(s.x,s.y,r.x,r.y,o.x,o.y,n.x,n.y),t&&t.bezierCurveTo(r.x,r.y,o.x,o.y,n.x,n.y)}static pathS(t){const{current:e}=t,i=t.getReflectedControlPoint(),s=t.getAsControlPoint("x2","y2"),r=t.getAsCurrentPoint();return{current:e,point:i,controlPoint:s,currentPoint:r}}pathS(t,e){const{pathParser:i}=this,{current:s,point:r,controlPoint:o,currentPoint:n}=M.pathS(i);i.addMarker(n,o,r),e.addBezierCurve(s.x,s.y,r.x,r.y,o.x,o.y,n.x,n.y),t&&t.bezierCurveTo(r.x,r.y,o.x,o.y,n.x,n.y)}static pathQ(t){const{current:e}=t,i=t.getAsControlPoint("x1","y1"),s=t.getAsCurrentPoint();return{current:e,controlPoint:i,currentPoint:s}}pathQ(t,e){const{pathParser:i}=this,{current:s,controlPoint:r,currentPoint:o}=M.pathQ(i);i.addMarker(o,r,r),e.addQuadraticCurve(s.x,s.y,r.x,r.y,o.x,o.y),t&&t.quadraticCurveTo(r.x,r.y,o.x,o.y)}static pathT(t){const{current:e}=t,i=t.getReflectedControlPoint();t.control=i;const s=t.getAsCurrentPoint();return{current:e,controlPoint:i,currentPoint:s}}pathT(t,e){const{pathParser:i}=this,{current:s,controlPoint:r,currentPoint:o}=M.pathT(i);i.addMarker(o,r,r),e.addQuadraticCurve(s.x,s.y,r.x,r.y,o.x,o.y),t&&t.quadraticCurveTo(r.x,r.y,o.x,o.y)}static pathA(t){const{current:e,command:i}=t;let{rX:s,rY:r,xRot:o,lArcFlag:n,sweepFlag:a}=i;const u=o*(Math.PI/180),h=t.getAsCurrentPoint(),f=new V(Math.cos(u)*(e.x-h.x)/2+Math.sin(u)*(e.y-h.y)/2,-Math.sin(u)*(e.x-h.x)/2+Math.cos(u)*(e.y-h.y)/2),g=Math.pow(f.x,2)/Math.pow(s,2)+Math.pow(f.y,2)/Math.pow(r,2);g>1&&(s*=Math.sqrt(g),r*=Math.sqrt(g));let c=(n===a?-1:1)*Math.sqrt((Math.pow(s,2)*Math.pow(r,2)-Math.pow(s,2)*Math.pow(f.y,2)-Math.pow(r,2)*Math.pow(f.x,2))/(Math.pow(s,2)*Math.pow(f.y,2)+Math.pow(r,2)*Math.pow(f.x,2)));isNaN(c)&&(c=0);const d=new V(c*s*f.y/r,c*-r*f.x/s),m=new V((e.x+h.x)/2+Math.cos(u)*d.x-Math.sin(u)*d.y,(e.y+h.y)/2+Math.sin(u)*d.x+Math.cos(u)*d.y),p=De([1,0],[(f.x-d.x)/s,(f.y-d.y)/r]),x=[(f.x-d.x)/s,(f.y-d.y)/r],C=[(-f.x-d.x)/s,(-f.y-d.y)/r];let b=De(x,C);return ge(x,C)<=-1&&(b=Math.PI),ge(x,C)>=1&&(b=0),{currentPoint:h,rX:s,rY:r,sweepFlag:a,xAxisRotation:u,centp:m,a1:p,ad:b}}pathA(t,e){const{pathParser:i}=this,{currentPoint:s,rX:r,rY:o,sweepFlag:n,xAxisRotation:a,centp:u,a1:h,ad:f}=M.pathA(i),g=1-n?1:-1,c=h+g*(f/2),d=new V(u.x+r*Math.cos(c),u.y+o*Math.sin(c));if(i.addMarkerAngle(d,c-g*Math.PI/2),i.addMarkerAngle(s,c-g*Math.PI),e.addPoint(s.x,s.y),t&&!isNaN(h)&&!isNaN(f)){const m=r>o?r:o,p=r>o?1:r/o,x=r>o?o/r:1;t.translate(u.x,u.y),t.rotate(a),t.scale(p,x),t.arc(0,0,m,h,h+f,Boolean(1-n)),t.scale(1/p,1/x),t.rotate(-a),t.translate(-u.x,-u.y)}}static pathZ(t){t.current=t.start}pathZ(t,e){M.pathZ(this.pathParser),t&&e.x1!==e.x2&&e.y1!==e.y2&&t.closePath()}constructor(t,e,i){super(t,e,i),this.type="path",this.pathParser=new E(this.getAttribute("d").getString())}}class Mt extends pt{setContext(t){var e;const{document:i}=this,{screen:s,window:r}=i,o=t.canvas;if(s.setDefaults(t),"style"in o&&typeof t.font!="undefined"&&r&&typeof r.getComputedStyle!="undefined"){t.font=r.getComputedStyle(o).getPropertyValue("font");const C=new S(i,"fontSize",W.parse(t.font).fontSize);C.hasValue()&&(i.rootEmSize=C.getPixels("y"),i.emSize=i.rootEmSize)}this.getAttribute("x").hasValue()||this.getAttribute("x",!0).setValue(0),this.getAttribute("y").hasValue()||this.getAttribute("y",!0).setValue(0);let{width:n,height:a}=s.viewPort;this.getStyle("width").hasValue()||this.getStyle("width",!0).setValue("100%"),this.getStyle("height").hasValue()||this.getStyle("height",!0).setValue("100%"),this.getStyle("color").hasValue()||this.getStyle("color",!0).setValue("black");const u=this.getAttribute("refX"),h=this.getAttribute("refY"),f=this.getAttribute("viewBox"),g=f.hasValue()?$(f.getString()):null,c=!this.root&&this.getStyle("overflow").getValue("hidden")!=="visible";let d=0,m=0,p=0,x=0;g&&(d=g[0],m=g[1]),this.root||(n=this.getStyle("width").getPixels("x"),a=this.getStyle("height").getPixels("y"),this.type==="marker"&&(p=d,x=m,d=0,m=0)),s.viewPort.setCurrent(n,a),this.node&&(!this.parent||((e=this.node.parentNode)===null||e===void 0?void 0:e.nodeName)==="foreignObject")&&this.getStyle("transform",!1,!0).hasValue()&&!this.getStyle("transform-origin",!1,!0).hasValue()&&this.getStyle("transform-origin",!0,!0).setValue("50% 50%"),super.setContext(t),t.translate(this.getAttribute("x").getPixels("x"),this.getAttribute("y").getPixels("y")),g&&(n=g[2],a=g[3]),i.setViewBox({ctx:t,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:s.viewPort.width,desiredWidth:n,height:s.viewPort.height,desiredHeight:a,minX:d,minY:m,refX:u.getValue(),refY:h.getValue(),clip:c,clipX:p,clipY:x}),g&&(s.viewPort.removeCurrent(),s.viewPort.setCurrent(n,a))}clearContext(t){super.clearContext(t),this.document.screen.viewPort.removeCurrent()}resize(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const s=this.getAttribute("width",!0),r=this.getAttribute("height",!0),o=this.getAttribute("viewBox"),n=this.getAttribute("style"),a=s.getNumber(0),u=r.getNumber(0);if(i)if(typeof i=="string")this.getAttribute("preserveAspectRatio",!0).setValue(i);else{const h=this.getAttribute("preserveAspectRatio");h.hasValue()&&h.setValue(h.getString().replace(/^\s*(\S.*\S)\s*$/,"$1"))}if(s.setValue(t),r.setValue(e),o.hasValue()||o.setValue("0 0 ".concat(a||t," ").concat(u||e)),n.hasValue()){const h=this.getStyle("width"),f=this.getStyle("height");h.hasValue()&&h.setValue("".concat(t,"px")),f.hasValue()&&f.setValue("".concat(e,"px"))}}constructor(...t){super(...t),this.type="svg",this.root=!1}}class ti extends M{path(t){const e=this.getAttribute("x").getPixels("x"),i=this.getAttribute("y").getPixels("y"),s=this.getStyle("width",!1,!0).getPixels("x"),r=this.getStyle("height",!1,!0).getPixels("y"),o=this.getAttribute("rx"),n=this.getAttribute("ry");let a=o.getPixels("x"),u=n.getPixels("y");if(o.hasValue()&&!n.hasValue()&&(u=a),n.hasValue()&&!o.hasValue()&&(a=u),a=Math.min(a,s/2),u=Math.min(u,r/2),t){const h=4*((Math.sqrt(2)-1)/3);t.beginPath(),r>0&&s>0&&(t.moveTo(e+a,i),t.lineTo(e+s-a,i),t.bezierCurveTo(e+s-a+h*a,i,e+s,i+u-h*u,e+s,i+u),t.lineTo(e+s,i+r-u),t.bezierCurveTo(e+s,i+r-u+h*u,e+s-a+h*a,i+r,e+s-a,i+r),t.lineTo(e+a,i+r),t.bezierCurveTo(e+a-h*a,i+r,e,i+r-u+h*u,e,i+r-u),t.lineTo(e,i+u),t.bezierCurveTo(e,i+u-h*u,e+a-h*a,i,e+a,i),t.closePath())}return new J(e,i,e+s,i+r)}getMarkers(){return null}constructor(...t){super(...t),this.type="rect"}}class Ki extends M{path(t){const e=this.getAttribute("cx").getPixels("x"),i=this.getAttribute("cy").getPixels("y"),s=this.getAttribute("r").getPixels();return t&&s>0&&(t.beginPath(),t.arc(e,i,s,0,Math.PI*2,!1),t.closePath()),new J(e-s,i-s,e+s,i+s)}getMarkers(){return null}constructor(...t){super(...t),this.type="circle"}}class Ji extends M{path(t){const e=4*((Math.sqrt(2)-1)/3),i=this.getAttribute("rx").getPixels("x"),s=this.getAttribute("ry").getPixels("y"),r=this.getAttribute("cx").getPixels("x"),o=this.getAttribute("cy").getPixels("y");return t&&i>0&&s>0&&(t.beginPath(),t.moveTo(r+i,o),t.bezierCurveTo(r+i,o+e*s,r+e*i,o+s,r,o+s),t.bezierCurveTo(r-e*i,o+s,r-i,o+e*s,r-i,o),t.bezierCurveTo(r-i,o-e*s,r-e*i,o-s,r,o-s),t.bezierCurveTo(r+e*i,o-s,r+i,o-e*s,r+i,o),t.closePath()),new J(r-i,o-s,r+i,o+s)}getMarkers(){return null}constructor(...t){super(...t),this.type="ellipse"}}class ts extends M{getPoints(){return[new V(this.getAttribute("x1").getPixels("x"),this.getAttribute("y1").getPixels("y")),new V(this.getAttribute("x2").getPixels("x"),this.getAttribute("y2").getPixels("y"))]}path(t){const[{x:e,y:i},{x:s,y:r}]=this.getPoints();return t&&(t.beginPath(),t.moveTo(e,i),t.lineTo(s,r)),new J(e,i,s,r)}getMarkers(){const[t,e]=this.getPoints(),i=t.angleTo(e);return[[t,i],[e,i]]}constructor(...t){super(...t),this.type="line"}}class ei extends M{path(t){const{points:e}=this,[{x:i,y:s}]=e,r=new J(i,s);return t&&(t.beginPath(),t.moveTo(i,s)),e.forEach(o=>{let{x:n,y:a}=o;r.addPoint(n,a),t&&t.lineTo(n,a)}),r}getMarkers(){const{points:t}=this,e=t.length-1,i=[];return t.forEach((s,r)=>{r!==e&&i.push([s,s.angleTo(t[r+1])])}),i.length>0&&i.push([t[t.length-1],i[i.length-1][1]]),i}constructor(t,e,i){super(t,e,i),this.type="polyline",this.points=[],this.points=V.parsePath(this.getAttribute("points").getString())}}class es extends ei{path(t){const e=super.path(t),[{x:i,y:s}]=this.points;return t&&(t.lineTo(i,s),t.closePath()),e}constructor(...t){super(...t),this.type="polygon"}}class is extends F{createPattern(t,e,i){const s=this.getStyle("width").getPixels("x",!0),r=this.getStyle("height").getPixels("y",!0),o=new Mt(this.document,null);o.attributes.viewBox=new S(this.document,"viewBox",this.getAttribute("viewBox").getValue()),o.attributes.width=new S(this.document,"width","".concat(s,"px")),o.attributes.height=new S(this.document,"height","".concat(r,"px")),o.attributes.transform=new S(this.document,"transform",this.getAttribute("patternTransform").getValue()),o.children=this.children;const n=this.document.createCanvas(s,r),a=n.getContext("2d"),u=this.getAttribute("x"),h=this.getAttribute("y");u.hasValue()&&h.hasValue()&&a.translate(u.getPixels("x",!0),h.getPixels("y",!0)),i.hasValue()?this.styles["fill-opacity"]=i:Reflect.deleteProperty(this.styles,"fill-opacity");for(let g=-1;g<=1;g++)for(let c=-1;c<=1;c++)a.save(),o.attributes.x=new S(this.document,"x",g*n.width),o.attributes.y=new S(this.document,"y",c*n.height),o.render(a),a.restore();return t.createPattern(n,"repeat")}constructor(...t){super(...t),this.type="pattern"}}class ss extends F{render(t,e,i){if(!e)return;const{x:s,y:r}=e,o=this.getAttribute("orient").getString("auto"),n=this.getAttribute("markerUnits").getString("strokeWidth");t.translate(s,r),o==="auto"&&t.rotate(i),n==="strokeWidth"&&t.scale(t.lineWidth,t.lineWidth),t.save();const a=new Mt(this.document);a.type=this.type,a.attributes.viewBox=new S(this.document,"viewBox",this.getAttribute("viewBox").getValue()),a.attributes.refX=new S(this.document,"refX",this.getAttribute("refX").getValue()),a.attributes.refY=new S(this.document,"refY",this.getAttribute("refY").getValue()),a.attributes.width=new S(this.document,"width",this.getAttribute("markerWidth").getValue()),a.attributes.height=new S(this.document,"height",this.getAttribute("markerHeight").getValue()),a.attributes.overflow=new S(this.document,"overflow",this.getAttribute("overflow").getValue()),a.attributes.fill=new S(this.document,"fill",this.getAttribute("fill").getColor("black")),a.attributes.stroke=new S(this.document,"stroke",this.getAttribute("stroke").getValue("none")),a.children=this.children,a.render(t),t.restore(),n==="strokeWidth"&&t.scale(1/t.lineWidth,1/t.lineWidth),o==="auto"&&t.rotate(-i),t.translate(-s,-r)}constructor(...t){super(...t),this.type="marker"}}class rs extends F{render(){}constructor(...t){super(...t),this.type="defs"}}class de extends pt{getBoundingBox(t){const e=new J;return this.children.forEach(i=>{e.addBoundingBox(i.getBoundingBox(t))}),e}constructor(...t){super(...t),this.type="g"}}class ii extends F{getGradientUnits(){return this.getAttribute("gradientUnits").getString("objectBoundingBox")}createGradient(t,e,i){let s=this;this.getHrefAttribute().hasValue()&&(s=this.getHrefAttribute().getDefinition(),this.inheritStopContainer(s));const{stops:r}=s,o=this.getGradient(t,e);if(!o)return this.addParentOpacity(i,r[r.length-1].color);if(r.forEach(n=>{o.addColorStop(n.offset,this.addParentOpacity(i,n.color))}),this.getAttribute("gradientTransform").hasValue()){const{document:n}=this,{MAX_VIRTUAL_PIXELS:a}=rt,{viewPort:u}=n.screen,h=u.getRoot(),f=new ti(n);f.attributes.x=new S(n,"x",-a/3),f.attributes.y=new S(n,"y",-a/3),f.attributes.width=new S(n,"width",a),f.attributes.height=new S(n,"height",a);const g=new de(n);g.attributes.transform=new S(n,"transform",this.getAttribute("gradientTransform").getValue()),g.children=[f];const c=new Mt(n);c.attributes.x=new S(n,"x",0),c.attributes.y=new S(n,"y",0),c.attributes.width=new S(n,"width",h.width),c.attributes.height=new S(n,"height",h.height),c.children=[g];const d=n.createCanvas(h.width,h.height),m=d.getContext("2d");return m.fillStyle=o,c.render(m),m.createPattern(d,"no-repeat")}return o}inheritStopContainer(t){this.attributesToInherit.forEach(e=>{!this.getAttribute(e).hasValue()&&t.getAttribute(e).hasValue()&&this.getAttribute(e,!0).setValue(t.getAttribute(e).getValue())})}addParentOpacity(t,e){return t.hasValue()?new S(this.document,"color",e).addOpacity(t).getColor():e}constructor(t,e,i){super(t,e,i),this.attributesToInherit=["gradientUnits"],this.stops=[];const{stops:s,children:r}=this;r.forEach(o=>{o.type==="stop"&&s.push(o)})}}class ns extends ii{getGradient(t,e){const i=this.getGradientUnits()==="objectBoundingBox",s=i?e.getBoundingBox(t):null;if(i&&!s)return null;!this.getAttribute("x1").hasValue()&&!this.getAttribute("y1").hasValue()&&!this.getAttribute("x2").hasValue()&&!this.getAttribute("y2").hasValue()&&(this.getAttribute("x1",!0).setValue(0),this.getAttribute("y1",!0).setValue(0),this.getAttribute("x2",!0).setValue(1),this.getAttribute("y2",!0).setValue(0));const r=i?s.x+s.width*this.getAttribute("x1").getNumber():this.getAttribute("x1").getPixels("x"),o=i?s.y+s.height*this.getAttribute("y1").getNumber():this.getAttribute("y1").getPixels("y"),n=i?s.x+s.width*this.getAttribute("x2").getNumber():this.getAttribute("x2").getPixels("x"),a=i?s.y+s.height*this.getAttribute("y2").getNumber():this.getAttribute("y2").getPixels("y");return r===n&&o===a?null:t.createLinearGradient(r,o,n,a)}constructor(t,e,i){super(t,e,i),this.type="linearGradient",this.attributesToInherit.push("x1","y1","x2","y2")}}class os extends ii{getGradient(t,e){const i=this.getGradientUnits()==="objectBoundingBox",s=e.getBoundingBox(t);if(i&&!s)return null;this.getAttribute("cx").hasValue()||this.getAttribute("cx",!0).setValue("50%"),this.getAttribute("cy").hasValue()||this.getAttribute("cy",!0).setValue("50%"),this.getAttribute("r").hasValue()||this.getAttribute("r",!0).setValue("50%");const r=i?s.x+s.width*this.getAttribute("cx").getNumber():this.getAttribute("cx").getPixels("x"),o=i?s.y+s.height*this.getAttribute("cy").getNumber():this.getAttribute("cy").getPixels("y");let n=r,a=o;this.getAttribute("fx").hasValue()&&(n=i?s.x+s.width*this.getAttribute("fx").getNumber():this.getAttribute("fx").getPixels("x")),this.getAttribute("fy").hasValue()&&(a=i?s.y+s.height*this.getAttribute("fy").getNumber():this.getAttribute("fy").getPixels("y"));const u=i?(s.width+s.height)/2*this.getAttribute("r").getNumber():this.getAttribute("r").getPixels(),h=this.getAttribute("fr").getPixels();return t.createRadialGradient(n,a,h,r,o,u)}constructor(t,e,i){super(t,e,i),this.type="radialGradient",this.attributesToInherit.push("cx","cy","r","fx","fy","fr")}}class as extends F{constructor(t,e,i){super(t,e,i),this.type="stop";const s=Math.max(0,Math.min(1,this.getAttribute("offset").getNumber())),r=this.getStyle("stop-opacity");let o=this.getStyle("stop-color",!0);o.getString()===""&&o.setValue("#000"),r.hasValue()&&(o=o.addOpacity(r)),this.offset=s,this.color=o.getColor()}}class me extends F{getProperty(){const t=this.getAttribute("attributeType").getString(),e=this.getAttribute("attributeName").getString();return t==="CSS"?this.parent.getStyle(e,!0):this.parent.getAttribute(e,!0)}calcValue(){const{initialUnits:t}=this,{progress:e,from:i,to:s}=this.getProgress();let r=i.getNumber()+(s.getNumber()-i.getNumber())*e;return t==="%"&&(r*=100),"".concat(r).concat(t)}update(t){const{parent:e}=this,i=this.getProperty();if(this.initialValue||(this.initialValue=i.getString(),this.initialUnits=i.getUnits()),this.duration>this.maxDuration){const r=this.getAttribute("fill").getString("remove");if(this.getAttribute("repeatCount").getString()==="indefinite"||this.getAttribute("repeatDur").getString()==="indefinite")this.duration=0;else if(r==="freeze"&&!this.frozen)this.frozen=!0,e&&i&&(e.animationFrozen=!0,e.animationFrozenValue=i.getString());else if(r==="remove"&&!this.removed)return this.removed=!0,e&&i&&i.setValue(e.animationFrozen?e.animationFrozenValue:this.initialValue),!0;return!1}this.duration+=t;let s=!1;if(this.begin<this.duration){let r=this.calcValue();const o=this.getAttribute("type");if(o.hasValue()){const n=o.getString();r="".concat(n,"(").concat(r,")")}i.setValue(r),s=!0}return s}getProgress(){const{document:t,values:e}=this;let i=(this.duration-this.begin)/(this.maxDuration-this.begin),s,r;if(e.hasValue()){const o=i*(e.getValue().length-1),n=Math.floor(o),a=Math.ceil(o);let u;u=e.getValue()[n],s=new S(t,"from",u?parseFloat(u):0),u=e.getValue()[a],r=new S(t,"to",u?parseFloat(u):0),i=(o-n)/(a-n)}else s=this.from,r=this.to;return{progress:i,from:s,to:r}}constructor(t,e,i){super(t,e,i),this.type="animate",this.duration=0,this.initialUnits="",this.removed=!1,this.frozen=!1,t.screen.animations.push(this),this.begin=this.getAttribute("begin").getMilliseconds(),this.maxDuration=this.begin+this.getAttribute("dur").getMilliseconds(),this.from=this.getAttribute("from"),this.to=this.getAttribute("to"),this.values=new S(t,"values",null);const s=this.getAttribute("values");s.hasValue()&&this.values.setValue(s.getString().split(";"))}}class us extends me{calcValue(){const{progress:t,from:e,to:i}=this.getProgress(),s=new ce(e.getColor()),r=new ce(i.getColor());if(s.ok&&r.ok){const o=s.r+(r.r-s.r)*t,n=s.g+(r.g-s.g)*t,a=s.b+(r.b-s.b)*t;return"rgb(".concat(Math.floor(o),", ").concat(Math.floor(n),", ").concat(Math.floor(a),")")}return this.getAttribute("from").getColor()}constructor(...t){super(...t),this.type="animateColor"}}class ls extends me{calcValue(){const{progress:t,from:e,to:i}=this.getProgress(),s=$(e.getString()),r=$(i.getString());return s.map((n,a)=>{const u=r[a];return n+(u-n)*t}).join(" ")}constructor(...t){super(...t),this.type="animateTransform"}}class si extends F{constructor(t,e,i){super(t,e,i),this.type="font-face",this.ascent=this.getAttribute("ascent").getNumber(),this.descent=this.getAttribute("descent").getNumber(),this.unitsPerEm=this.getAttribute("units-per-em").getNumber()}}class pe extends M{constructor(t,e,i){super(t,e,i),this.type="glyph",this.horizAdvX=this.getAttribute("horiz-adv-x").getNumber(),this.unicode=this.getAttribute("unicode").getString(),this.arabicForm=this.getAttribute("arabic-form").getString()}}class ri extends pe{constructor(...t){super(...t),this.type="missing-glyph",this.horizAdvX=0}}class hs extends F{render(){}constructor(t,e,i){super(t,e,i),this.type="font",this.isArabic=!1,this.glyphs={},this.arabicGlyphs={},this.isRTL=!1,this.horizAdvX=this.getAttribute("horiz-adv-x").getNumber();const{definitions:s}=t,{children:r}=this;for(const o of r)if(o instanceof si){this.fontFace=o;const n=o.getStyle("font-family");n.hasValue()&&(s[n.getString()]=this)}else if(o instanceof ri)this.missingGlyph=o;else if(o instanceof pe)if(o.arabicForm){this.isRTL=!0,this.isArabic=!0;const n=this.arabicGlyphs[o.unicode];typeof n=="undefined"?this.arabicGlyphs[o.unicode]={[o.arabicForm]:o}:n[o.arabicForm]=o}else this.glyphs[o.unicode]=o}}class cs extends ut{getText(){const t=this.getHrefAttribute().getDefinition();if(t){const e=t.children[0];if(e)return e.getText()}return""}constructor(...t){super(...t),this.type="tref"}}class fs extends ut{getText(){return this.text}renderChildren(t){if(this.hasText){super.renderChildren(t);const{document:e,x:i,y:s}=this,{mouse:r}=e.screen,o=new S(e,"fontSize",W.parse(e.ctx.font).fontSize);r.isWorking()&&r.checkBoundingBox(this,new J(i,s-o.getPixels("y"),i+this.measureText(t),s))}else if(this.children.length>0){const e=new de(this.document);e.children=this.children,e.parent=this,e.render(t)}}onClick(){const{window:t}=this.document;t&&t.open(this.getHrefAttribute().getString())}onMouseMove(){const t=this.document.ctx;t.canvas.style.cursor="pointer"}constructor(t,e,i){super(t,e,i),this.type="a";const{childNodes:s}=e,r=s[0],o=s.length>0&&Array.from(s).every(n=>n.nodeType===3);this.hasText=o,this.text=o?this.getTextFromNode(r):""}}class gs extends ut{getText(){return this.text}path(t){const{dataArray:e}=this;t&&t.beginPath(),e.forEach(i=>{let{type:s,points:r}=i;switch(s){case E.LINE_TO:t&&t.lineTo(r[0],r[1]);break;case E.MOVE_TO:t&&t.moveTo(r[0],r[1]);break;case E.CURVE_TO:t&&t.bezierCurveTo(r[0],r[1],r[2],r[3],r[4],r[5]);break;case E.QUAD_TO:t&&t.quadraticCurveTo(r[0],r[1],r[2],r[3]);break;case E.ARC:{const[o,n,a,u,h,f,g,c]=r,d=a>u?a:u,m=a>u?1:a/u,p=a>u?u/a:1;t&&(t.translate(o,n),t.rotate(g),t.scale(m,p),t.arc(0,0,d,h,h+f,Boolean(1-c)),t.scale(1/m,1/p),t.rotate(-g),t.translate(-o,-n));break}case E.CLOSE_PATH:t&&t.closePath();break}})}renderChildren(t){this.setTextData(t),t.save();const e=this.parent.getStyle("text-decoration").getString(),i=this.getFontSize(),{glyphInfo:s}=this,r=t.fillStyle;e==="underline"&&t.beginPath(),s.forEach((o,n)=>{const{p0:a,p1:u,rotation:h,text:f}=o;t.save(),t.translate(a.x,a.y),t.rotate(h),t.fillStyle&&t.fillText(f,0,0),t.strokeStyle&&t.strokeText(f,0,0),t.restore(),e==="underline"&&(n===0&&t.moveTo(a.x,a.y+i/8),t.lineTo(u.x,u.y+i/5))}),e==="underline"&&(t.lineWidth=i/20,t.strokeStyle=r,t.stroke(),t.closePath()),t.restore()}getLetterSpacingAt(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return this.letterSpacingCache[t]||0}findSegmentToFitChar(t,e,i,s,r,o,n,a,u){let h=o,f=this.measureText(t,a);a===" "&&e==="justify"&&i<s&&(f+=(s-i)/r),u>-1&&(h+=this.getLetterSpacingAt(u));const g=this.textHeight/20,c=this.getEquidistantPointOnPath(h,g,0),d=this.getEquidistantPointOnPath(h+f,g,0),m={p0:c,p1:d},p=c&&d?Math.atan2(d.y-c.y,d.x-c.x):0;if(n){const x=Math.cos(Math.PI/2+p)*n,C=Math.cos(-p)*n;m.p0={...c,x:c.x+x,y:c.y+C},m.p1={...d,x:d.x+x,y:d.y+C}}return h+=f,{offset:h,segment:m,rotation:p}}measureText(t,e){const{measuresCache:i}=this,s=e||this.getText();if(i.has(s))return i.get(s);const r=this.measureTargetText(t,s);return i.set(s,r),r}setTextData(t){if(this.glyphInfo)return;const e=this.getText(),i=e.split(""),s=e.split(" ").length-1,r=this.parent.getAttribute("dx").split().map(b=>b.getPixels("x")),o=this.parent.getAttribute("dy").getPixels("y"),n=this.parent.getStyle("text-anchor").getString("start"),a=this.getStyle("letter-spacing"),u=this.parent.getStyle("letter-spacing");let h=0;!a.hasValue()||a.getValue()==="inherit"?h=u.getPixels():a.hasValue()&&a.getValue()!=="initial"&&a.getValue()!=="unset"&&(h=a.getPixels());const f=[],g=e.length;this.letterSpacingCache=f;for(let b=0;b<g;b++)f.push(typeof r[b]!="undefined"?r[b]:h);const c=f.reduce((b,A,P)=>P===0?0:b+A||0,0),d=this.measureText(t),m=Math.max(d+c,0);this.textWidth=d,this.textHeight=this.getFontSize(),this.glyphInfo=[];const p=this.getPathLength(),x=this.getStyle("startOffset").getNumber(0)*p;let C=0;(n==="middle"||n==="center")&&(C=-m/2),(n==="end"||n==="right")&&(C=-m),C+=x,i.forEach((b,A)=>{const{offset:P,segment:T,rotation:v}=this.findSegmentToFitChar(t,n,m,p,s,C,o,b,A);C=P,!(!T.p0||!T.p1)&&this.glyphInfo.push({text:i[A],p0:T.p0,p1:T.p1,rotation:v})})}parsePathData(t){if(this.pathLength=-1,!t)return[];const e=[],{pathParser:i}=t;for(i.reset();!i.isEnd();){const{current:s}=i,r=s?s.x:0,o=s?s.y:0,n=i.next();let a=n.type,u=[];switch(n.type){case E.MOVE_TO:this.pathM(i,u);break;case E.LINE_TO:a=this.pathL(i,u);break;case E.HORIZ_LINE_TO:a=this.pathH(i,u);break;case E.VERT_LINE_TO:a=this.pathV(i,u);break;case E.CURVE_TO:this.pathC(i,u);break;case E.SMOOTH_CURVE_TO:a=this.pathS(i,u);break;case E.QUAD_TO:this.pathQ(i,u);break;case E.SMOOTH_QUAD_TO:a=this.pathT(i,u);break;case E.ARC:u=this.pathA(i);break;case E.CLOSE_PATH:M.pathZ(i);break}n.type!==E.CLOSE_PATH?e.push({type:a,points:u,start:{x:r,y:o},pathLength:this.calcLength(r,o,a,u)}):e.push({type:E.CLOSE_PATH,points:[],pathLength:0})}return e}pathM(t,e){const{x:i,y:s}=M.pathM(t).point;e.push(i,s)}pathL(t,e){const{x:i,y:s}=M.pathL(t).point;return e.push(i,s),E.LINE_TO}pathH(t,e){const{x:i,y:s}=M.pathH(t).point;return e.push(i,s),E.LINE_TO}pathV(t,e){const{x:i,y:s}=M.pathV(t).point;return e.push(i,s),E.LINE_TO}pathC(t,e){const{point:i,controlPoint:s,currentPoint:r}=M.pathC(t);e.push(i.x,i.y,s.x,s.y,r.x,r.y)}pathS(t,e){const{point:i,controlPoint:s,currentPoint:r}=M.pathS(t);return e.push(i.x,i.y,s.x,s.y,r.x,r.y),E.CURVE_TO}pathQ(t,e){const{controlPoint:i,currentPoint:s}=M.pathQ(t);e.push(i.x,i.y,s.x,s.y)}pathT(t,e){const{controlPoint:i,currentPoint:s}=M.pathT(t);return e.push(i.x,i.y,s.x,s.y),E.QUAD_TO}pathA(t){let{rX:e,rY:i,sweepFlag:s,xAxisRotation:r,centp:o,a1:n,ad:a}=M.pathA(t);return s===0&&a>0&&(a-=2*Math.PI),s===1&&a<0&&(a+=2*Math.PI),[o.x,o.y,e,i,n,a,r,s]}calcLength(t,e,i,s){let r=0,o=null,n=null,a=0;switch(i){case E.LINE_TO:return this.getLineLength(t,e,s[0],s[1]);case E.CURVE_TO:for(r=0,o=this.getPointOnCubicBezier(0,t,e,s[0],s[1],s[2],s[3],s[4],s[5]),a=.01;a<=1;a+=.01)n=this.getPointOnCubicBezier(a,t,e,s[0],s[1],s[2],s[3],s[4],s[5]),r+=this.getLineLength(o.x,o.y,n.x,n.y),o=n;return r;case E.QUAD_TO:for(r=0,o=this.getPointOnQuadraticBezier(0,t,e,s[0],s[1],s[2],s[3]),a=.01;a<=1;a+=.01)n=this.getPointOnQuadraticBezier(a,t,e,s[0],s[1],s[2],s[3]),r+=this.getLineLength(o.x,o.y,n.x,n.y),o=n;return r;case E.ARC:{r=0;const u=s[4],h=s[5],f=s[4]+h;let g=Math.PI/180;if(Math.abs(u-f)<g&&(g=Math.abs(u-f)),o=this.getPointOnEllipticalArc(s[0],s[1],s[2],s[3],u,0),h<0)for(a=u-g;a>f;a-=g)n=this.getPointOnEllipticalArc(s[0],s[1],s[2],s[3],a,0),r+=this.getLineLength(o.x,o.y,n.x,n.y),o=n;else for(a=u+g;a<f;a+=g)n=this.getPointOnEllipticalArc(s[0],s[1],s[2],s[3],a,0),r+=this.getLineLength(o.x,o.y,n.x,n.y),o=n;return n=this.getPointOnEllipticalArc(s[0],s[1],s[2],s[3],f,0),r+=this.getLineLength(o.x,o.y,n.x,n.y),r}}return 0}getPointOnLine(t,e,i,s,r){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:e,n=arguments.length>6&&arguments[6]!==void 0?arguments[6]:i;const a=(r-i)/(s-e+Ct);let u=Math.sqrt(t*t/(1+a*a));s<e&&(u*=-1);let h=a*u,f=null;if(s===e)f={x:o,y:n+h};else if((n-i)/(o-e+Ct)===a)f={x:o+u,y:n+h};else{let g=0,c=0;const d=this.getLineLength(e,i,s,r);if(d<Ct)return null;let m=(o-e)*(s-e)+(n-i)*(r-i);m/=d*d,g=e+m*(s-e),c=i+m*(r-i);const p=this.getLineLength(o,n,g,c),x=Math.sqrt(t*t-p*p);u=Math.sqrt(x*x/(1+a*a)),s<e&&(u*=-1),h=a*u,f={x:g+u,y:c+h}}return f}getPointOnPath(t){const e=this.getPathLength();let i=0,s=null;if(t<-5e-5||t-5e-5>e)return null;const{dataArray:r}=this;for(const o of r){if(o&&(o.pathLength<5e-5||i+o.pathLength+5e-5<t)){i+=o.pathLength;continue}const n=t-i;let a=0;switch(o.type){case E.LINE_TO:s=this.getPointOnLine(n,o.start.x,o.start.y,o.points[0],o.points[1],o.start.x,o.start.y);break;case E.ARC:{const u=o.points[4],h=o.points[5],f=o.points[4]+h;if(a=u+n/o.pathLength*h,h<0&&a<f||h>=0&&a>f)break;s=this.getPointOnEllipticalArc(o.points[0],o.points[1],o.points[2],o.points[3],a,o.points[6]);break}case E.CURVE_TO:a=n/o.pathLength,a>1&&(a=1),s=this.getPointOnCubicBezier(a,o.start.x,o.start.y,o.points[0],o.points[1],o.points[2],o.points[3],o.points[4],o.points[5]);break;case E.QUAD_TO:a=n/o.pathLength,a>1&&(a=1),s=this.getPointOnQuadraticBezier(a,o.start.x,o.start.y,o.points[0],o.points[1],o.points[2],o.points[3]);break}if(s)return s;break}return null}getLineLength(t,e,i,s){return Math.sqrt((i-t)*(i-t)+(s-e)*(s-e))}getPathLength(){return this.pathLength===-1&&(this.pathLength=this.dataArray.reduce((t,e)=>e.pathLength>0?t+e.pathLength:t,0)),this.pathLength}getPointOnCubicBezier(t,e,i,s,r,o,n,a,u){const h=a*Re(t)+o*Le(t)+s*Ie(t)+e*_e(t),f=u*Re(t)+n*Le(t)+r*Ie(t)+i*_e(t);return{x:h,y:f}}getPointOnQuadraticBezier(t,e,i,s,r,o,n){const a=o*ze(t)+s*He(t)+e*Ue(t),u=n*ze(t)+r*He(t)+i*Ue(t);return{x:a,y:u}}getPointOnEllipticalArc(t,e,i,s,r,o){const n=Math.cos(o),a=Math.sin(o),u={x:i*Math.cos(r),y:s*Math.sin(r)};return{x:t+(u.x*n-u.y*a),y:e+(u.x*a+u.y*n)}}buildEquidistantCache(t,e){const i=this.getPathLength(),s=e||.25,r=t||i/100;if(!this.equidistantCache||this.equidistantCache.step!==r||this.equidistantCache.precision!==s){this.equidistantCache={step:r,precision:s,points:[]};let o=0;for(let n=0;n<=i;n+=s){const a=this.getPointOnPath(n),u=this.getPointOnPath(n+s);!a||!u||(o+=this.getLineLength(a.x,a.y,u.x,u.y),o>=r&&(this.equidistantCache.points.push({x:a.x,y:a.y,distance:n}),o-=r))}}}getEquidistantPointOnPath(t,e,i){if(this.buildEquidistantCache(e,i),t<0||t-this.getPathLength()>5e-5)return null;const s=Math.round(t/this.getPathLength()*(this.equidistantCache.points.length-1));return this.equidistantCache.points[s]||null}constructor(t,e,i){super(t,e,i),this.type="textPath",this.textWidth=0,this.textHeight=0,this.pathLength=-1,this.glyphInfo=null,this.letterSpacingCache=[],this.measuresCache=new Map([["",0]]);const s=this.getHrefAttribute().getDefinition();this.text=this.getTextFromNode(),this.dataArray=this.parsePathData(s)}}const ds=/^\s*data:(([^/,;]+\/[^/,;]+)(?:;([^,;=]+=[^,;=]+))?)?(?:;(base64))?,(.*)$/i;class ms extends pt{async loadImage(t){try{const e=await this.document.createImage(t);this.image=e}catch(e){console.error('Error while loading image "'.concat(t,'":'),e)}this.loaded=!0}async loadSvg(t){const e=ds.exec(t);if(e){const i=e[5];i&&(e[4]==="base64"?this.image=atob(i):this.image=decodeURIComponent(i))}else try{const s=await(await this.document.fetch(t)).text();this.image=s}catch(i){console.error('Error while loading image "'.concat(t,'":'),i)}this.loaded=!0}renderChildren(t){const{document:e,image:i,loaded:s}=this,r=this.getAttribute("x").getPixels("x"),o=this.getAttribute("y").getPixels("y"),n=this.getStyle("width").getPixels("x"),a=this.getStyle("height").getPixels("y");if(!(!s||!i||!n||!a)){if(t.save(),t.translate(r,o),typeof i=="string"){const u=e.canvg.forkString(t,i,{ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:0,offsetY:0,scaleWidth:n,scaleHeight:a}),{documentElement:h}=u.document;h&&(h.parent=this),u.render()}else e.setViewBox({ctx:t,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:n,desiredWidth:i.width,height:a,desiredHeight:i.height}),this.loaded&&(!("complete"in i)||i.complete)&&t.drawImage(i,0,0);t.restore()}}getBoundingBox(){const t=this.getAttribute("x").getPixels("x"),e=this.getAttribute("y").getPixels("y"),i=this.getStyle("width").getPixels("x"),s=this.getStyle("height").getPixels("y");return new J(t,e,t+i,e+s)}constructor(t,e,i){super(t,e,i),this.type="image",this.loaded=!1;const s=this.getHrefAttribute().getString();if(!s)return;const r=s.endsWith(".svg")||/^\s*data:image\/svg\+xml/i.test(s);t.images.push(this),r?this.loadSvg(s):this.loadImage(s)}}class ps extends pt{render(t){}constructor(...t){super(...t),this.type="symbol"}}class ys{async load(t,e){try{const{document:i}=this,r=(await i.canvg.parser.load(e)).getElementsByTagName("font");Array.from(r).forEach(o=>{const n=i.createElement(o);i.definitions[t]=n})}catch(i){console.error('Error while loading font "'.concat(e,'":'),i)}this.loaded=!0}constructor(t){this.document=t,this.loaded=!1,t.fonts.push(this)}}class ni extends F{constructor(t,e,i){super(t,e,i),this.type="style",Tt(Array.from(e.childNodes).map(o=>o.textContent).join("").replace(/(\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm,"").replace(/@import.*;/g,"")).split("}").forEach(o=>{const n=o.trim();if(!n)return;const a=n.split("{"),u=a[0].split(","),h=a[1].split(";");u.forEach(f=>{const g=f.trim();if(!g)return;const c=t.styles[g]||{};if(h.forEach(d=>{const m=d.indexOf(":"),p=d.substr(0,m).trim(),x=d.substr(m+1,d.length-m).trim();p&&x&&(c[p]=new S(t,p,x))}),t.styles[g]=c,t.stylesSpecificity[g]=Di(g),g==="@font-face"){const d=c["font-family"].getString().replace(/"|'/g,"");c.src.getString().split(",").forEach(p=>{if(p.indexOf('format("svg")')>0){const x=$e(p);x&&new ys(t).load(d,x)}})}})})}}ni.parseExternalUrl=$e;class xs extends pt{setContext(t){super.setContext(t);const e=this.getAttribute("x"),i=this.getAttribute("y");e.hasValue()&&t.translate(e.getPixels("x"),0),i.hasValue()&&t.translate(0,i.getPixels("y"))}path(t){const{element:e}=this;e&&e.path(t)}renderChildren(t){const{document:e,element:i}=this;if(i){let s=i;if(i.type==="symbol"&&(s=new Mt(e),s.attributes.viewBox=new S(e,"viewBox",i.getAttribute("viewBox").getString()),s.attributes.preserveAspectRatio=new S(e,"preserveAspectRatio",i.getAttribute("preserveAspectRatio").getString()),s.attributes.overflow=new S(e,"overflow",i.getAttribute("overflow").getString()),s.children=i.children,i.styles.opacity=new S(e,"opacity",this.calculateOpacity())),s.type==="svg"){const o=this.getStyle("width",!1,!0),n=this.getStyle("height",!1,!0);o.hasValue()&&(s.attributes.width=new S(e,"width",o.getString())),n.hasValue()&&(s.attributes.height=new S(e,"height",n.getString()))}const r=s.parent;s.parent=this,s.render(t),s.parent=r}}getBoundingBox(t){const{element:e}=this;return e?e.getBoundingBox(t):null}elementTransform(){const{document:t,element:e}=this;return e?mt.fromElement(t,e):null}get element(){return this.cachedElement||(this.cachedElement=this.getHrefAttribute().getDefinition()),this.cachedElement}constructor(...t){super(...t),this.type="use"}}function zt(l,t,e,i,s,r){return l[e*i*4+t*4+r]}function Ht(l,t,e,i,s,r,o){l[e*i*4+t*4+r]=o}function I(l,t,e){return l[t]*e}function it(l,t,e,i){return t+Math.cos(l)*e+Math.sin(l)*i}class oi extends F{apply(t,e,i,s,r){const{includeOpacity:o,matrix:n}=this,a=t.getImageData(0,0,s,r);for(let u=0;u<r;u++)for(let h=0;h<s;h++){const f=zt(a.data,h,u,s,r,0),g=zt(a.data,h,u,s,r,1),c=zt(a.data,h,u,s,r,2),d=zt(a.data,h,u,s,r,3);let m=I(n,0,f)+I(n,1,g)+I(n,2,c)+I(n,3,d)+I(n,4,1),p=I(n,5,f)+I(n,6,g)+I(n,7,c)+I(n,8,d)+I(n,9,1),x=I(n,10,f)+I(n,11,g)+I(n,12,c)+I(n,13,d)+I(n,14,1),C=I(n,15,f)+I(n,16,g)+I(n,17,c)+I(n,18,d)+I(n,19,1);o&&(m=0,p=0,x=0,C*=d/255),Ht(a.data,h,u,s,r,0,m),Ht(a.data,h,u,s,r,1,p),Ht(a.data,h,u,s,r,2,x),Ht(a.data,h,u,s,r,3,C)}t.clearRect(0,0,s,r),t.putImageData(a,0,0)}constructor(t,e,i){super(t,e,i),this.type="feColorMatrix";let s=$(this.getAttribute("values").getString());switch(this.getAttribute("type").getString("matrix")){case"saturate":{const r=s[0];s=[.213+.787*r,.715-.715*r,.072-.072*r,0,0,.213-.213*r,.715+.285*r,.072-.072*r,0,0,.213-.213*r,.715-.715*r,.072+.928*r,0,0,0,0,0,1,0,0,0,0,0,1];break}case"hueRotate":{const r=s[0]*Math.PI/180;s=[it(r,.213,.787,-.213),it(r,.715,-.715,-.715),it(r,.072,-.072,.928),0,0,it(r,.213,-.213,.143),it(r,.715,.285,.14),it(r,.072,-.072,-.283),0,0,it(r,.213,-.213,-.787),it(r,.715,-.715,.715),it(r,.072,.928,.072),0,0,0,0,0,1,0,0,0,0,0,1];break}case"luminanceToAlpha":s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,.2125,.7154,.0721,0,0,0,0,0,0,1];break}this.matrix=s,this.includeOpacity=this.getAttribute("includeOpacity").hasValue()}}class Wt extends F{apply(t,e){const{document:i}=this;let s=this.getAttribute("x").getPixels("x"),r=this.getAttribute("y").getPixels("y"),o=this.getStyle("width").getPixels("x"),n=this.getStyle("height").getPixels("y");if(!o&&!n){const c=new J;this.children.forEach(d=>{c.addBoundingBox(d.getBoundingBox(t))}),s=Math.floor(c.x1),r=Math.floor(c.y1),o=Math.floor(c.width),n=Math.floor(c.height)}const a=this.removeStyles(e,Wt.ignoreStyles),u=i.createCanvas(s+o,r+n),h=u.getContext("2d");i.screen.setDefaults(h),this.renderChildren(h),new oi(i,{nodeType:1,childNodes:[],attributes:[{nodeName:"type",value:"luminanceToAlpha"},{nodeName:"includeOpacity",value:"true"}]}).apply(h,0,0,s+o,r+n);const f=i.createCanvas(s+o,r+n),g=f.getContext("2d");i.screen.setDefaults(g),e.render(g),g.globalCompositeOperation="destination-in",g.fillStyle=h.createPattern(u,"no-repeat"),g.fillRect(0,0,s+o,r+n),t.fillStyle=g.createPattern(f,"no-repeat"),t.fillRect(0,0,s+o,r+n),this.restoreStyles(e,a)}render(t){}constructor(...t){super(...t),this.type="mask"}}Wt.ignoreStyles=["mask","transform","clip-path"];const Ye=()=>{};class bs extends F{apply(t){const{document:e}=this,i=Reflect.getPrototypeOf(t),{beginPath:s,closePath:r}=t;i&&(i.beginPath=Ye,i.closePath=Ye),Reflect.apply(s,t,[]),this.children.forEach(o=>{if(!("path"in o))return;let n="elementTransform"in o?o.elementTransform():null;n||(n=mt.fromElement(e,o)),n&&n.apply(t),o.path(t),i&&(i.closePath=r),n&&n.unapply(t)}),Reflect.apply(r,t,[]),t.clip(),i&&(i.beginPath=s,i.closePath=r)}render(t){}constructor(...t){super(...t),this.type="clipPath"}}class qt extends F{apply(t,e){const{document:i,children:s}=this,r="getBoundingBox"in e?e.getBoundingBox(t):null;if(!r)return;let o=0,n=0;s.forEach(x=>{const C=x.extraFilterDistance||0;o=Math.max(o,C),n=Math.max(n,C)});const a=Math.floor(r.width),u=Math.floor(r.height),h=a+2*o,f=u+2*n;if(h<1||f<1)return;const g=Math.floor(r.x),c=Math.floor(r.y),d=this.removeStyles(e,qt.ignoreStyles),m=i.createCanvas(h,f),p=m.getContext("2d");i.screen.setDefaults(p),p.translate(-g+o,-c+n),e.render(p),s.forEach(x=>{typeof x.apply=="function"&&x.apply(p,0,0,h,f)}),t.drawImage(m,0,0,h,f,g-o,c-n,h,f),this.restoreStyles(e,d)}render(t){}constructor(...t){super(...t),this.type="filter"}}qt.ignoreStyles=["filter","transform","clip-path"];class vs extends F{apply(t,e,i,s,r){}constructor(t,e,i){super(t,e,i),this.type="feDropShadow",this.addStylesFromStyleDefinition()}}class As extends F{apply(t,e,i,s,r){}constructor(...t){super(...t),this.type="feMorphology"}}class Cs extends F{apply(t,e,i,s,r){}constructor(...t){super(...t),this.type="feComposite"}}class Ss extends F{apply(t,e,i,s,r){const{document:o,blurRadius:n}=this,a=o.window?o.window.document.body:null,u=t.canvas;u.id=o.getUniqueId(),a&&(u.style.display="none",a.appendChild(u)),yi(u,e,i,s,r,n),a&&a.removeChild(u)}constructor(t,e,i){super(t,e,i),this.type="feGaussianBlur",this.blurRadius=Math.floor(this.getAttribute("stdDeviation").getNumber()),this.extraFilterDistance=this.blurRadius}}class Ts extends F{constructor(...t){super(...t),this.type="title"}}class Es extends F{constructor(...t){super(...t),this.type="desc"}}const ws={svg:Mt,rect:ti,circle:Ki,ellipse:Ji,line:ts,polyline:ei,polygon:es,path:M,pattern:is,marker:ss,defs:rs,linearGradient:ns,radialGradient:os,stop:as,animate:me,animateColor:us,animateTransform:ls,font:hs,"font-face":si,"missing-glyph":ri,glyph:pe,text:ut,tspan:Yt,tref:cs,a:fs,textPath:gs,image:ms,g:de,symbol:ps,style:ni,use:xs,mask:Wt,clipPath:bs,filter:qt,feDropShadow:vs,feMorphology:As,feComposite:Cs,feColorMatrix:oi,feGaussianBlur:Ss,title:Ts,desc:Es};function Ns(l,t){const e=document.createElement("canvas");return e.width=l,e.height=t,e}async function Ps(l){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const e=document.createElement("img");return t&&(e.crossOrigin="Anonymous"),new Promise((i,s)=>{e.onload=()=>{i(e)},e.onerror=(r,o,n,a,u)=>{s(u)},e.src=l})}const he=12;class at{bindCreateImage(t,e){return typeof e=="boolean"?(i,s)=>t(i,typeof s=="boolean"?s:e):t}get window(){return this.screen.window}get fetch(){return this.screen.fetch}get ctx(){return this.screen.ctx}get emSize(){const{emSizeStack:t}=this;return t[t.length-1]||he}set emSize(t){const{emSizeStack:e}=this;e.push(t)}popEmSize(){const{emSizeStack:t}=this;t.pop()}getUniqueId(){return"canvg".concat(++this.uniqueId)}isImagesLoaded(){return this.images.every(t=>t.loaded)}isFontsLoaded(){return this.fonts.every(t=>t.loaded)}createDocumentElement(t){const e=this.createElement(t.documentElement);return e.root=!0,e.addStylesFromStyleDefinition(),this.documentElement=e,e}createElement(t){const e=t.nodeName.replace(/^[^:]+:/,""),i=at.elementTypes[e];return i?new i(this,t):new qi(this,t)}createTextNode(t){return new ji(this,t)}setViewBox(t){this.screen.setViewBox({document:this,...t})}constructor(t,{rootEmSize:e=he,emSize:i=he,createCanvas:s=at.createCanvas,createImage:r=at.createImage,anonymousCrossOrigin:o}={}){this.canvg=t,this.definitions={},this.styles={},this.stylesSpecificity={},this.images=[],this.fonts=[],this.emSizeStack=[],this.uniqueId=0,this.screen=t.screen,this.rootEmSize=e,this.emSize=i,this.createCanvas=s,this.createImage=this.bindCreateImage(r,o),this.screen.wait(()=>this.isImagesLoaded()),this.screen.wait(()=>this.isFontsLoaded())}}at.createCanvas=Ns;at.createImage=Ps;at.elementTypes=ws;class vt{static async from(t,e){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=await new le(i).parse(e);return new vt(t,r,i)}static fromString(t,e){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=new le(i).parseFromString(e);return new vt(t,r,i)}fork(t,e){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return vt.from(t,e,{...this.options,...i})}forkString(t,e){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return vt.fromString(t,e,{...this.options,...i})}ready(){return this.screen.ready()}isReady(){return this.screen.isReady()}async render(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.start({enableRedraw:!0,ignoreAnimation:!0,ignoreMouse:!0,...t}),await this.ready(),this.stop()}start(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{documentElement:e,screen:i,options:s}=this;i.start(e,{enableRedraw:!0,...s,...t})}stop(){this.screen.stop()}resize(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.documentElement.resize(t,e,i)}constructor(t,e,i={}){this.parser=new le(i),this.screen=new rt(t,i),this.options=i;const s=new at(this,i),r=s.createDocumentElement(e);this.document=s,this.documentElement=r}}window.OffscreenCanvas||(window.OffscreenCanvas=class{constructor(t,e){return this.canvas=document.createElement("canvas"),this.canvas.width=t,this.canvas.height=e,this.canvas.convertToBlob=()=>new Promise(i=>{this.canvas.toBlob(i)}),this.canvas}});const Ms=Ai.offscreen(),Fs=l=>new Promise((t,e)=>{const i=new FileReader;i.onloadend=()=>t(i.result),i.readAsDataURL(l)});let bt=null;const Rs=async(l,t,e)=>{bt||(bt=new OffscreenCanvas(t,e));const i=bt.getContext("2d");let s=await vt.fromString(i,l,Ms);s.resize(t*2,e*2,"xMidYMid meet"),await s.start();const r=await bt.convertToBlob(),o=await Fs(r);return i.clearRect(0,0,bt.width,bt.height),await s.stop(),s=null,o},Ls=l=>{var r,o;if(!l)return"";const t=new DOMParser().parseFromString(l,"text/xml"),e=t.getElementsByTagName("measure");let i=-1,s=-1;for(const n of e){i===-1&&n.getElementsByTagName("beats").length&&(i=parseInt(n.getElementsByTagName("beats")[0].textContent||"4")),s===-1&&n.getElementsByTagName("beat-type").length&&(s=parseInt(n.getElementsByTagName("beat-type")[0].textContent||"4"));const a=parseInt(((r=n.getElementsByTagName("divisions")[0])==null?void 0:r.textContent)||"256");if(n.getElementsByTagName("note").length===0){const u=(o=n.getElementsByTagName("forward")[0])==null?void 0:o.getElementsByTagName("duration")[0];u&&(u.textContent="0"),n.innerHTML=n.innerHTML+`
- <note>
- <rest measure="yes"/>
- <duration>${a*i}</duration>
- <voice>1</voice>
- <type>whole</type>
- </note>`}}return new XMLSerializer().serializeToString(t)},Is=(l,t)=>{var h,f,g,c;if(!l)return"";const e=new DOMParser().parseFromString(l,"text/xml"),i=((f=(h=e.getElementsByTagName("part-list"))==null?void 0:h[0])==null?void 0:f.getElementsByTagName("score-part"))||[],s=Array.from(i).map(d=>{var m;return((m=d.getElementsByTagName("part-name"))==null?void 0:m[0].textContent)||""}),r=e.getElementsByTagName("part"),o=r[0],n=[...o.getElementsByTagName("measure")],a=[...o.getElementsByTagName("metronome")];[...o.getElementsByTagName("words")],[...o.getElementsByTagName("coda")],[...o.getElementsByTagName("rehearsal")],((c=(g=s[0])==null?void 0:g.toLocaleUpperCase)==null?void 0:c.call(g))==="COMMON"&&(t++,s.shift());const u=i[t];if(u){const d=u.getAttribute("id");Array.from(r).forEach(p=>{var x,C,b,A,P;if(p&&p.getAttribute("id")!==d)(x=p.parentNode)==null||x.removeChild(p);else if(p&&p.getAttribute("id")!=="P1"){const T={};for(let v=0;v<a.length;v++){const w=a[v],N=(b=(C=w.parentElement)==null?void 0:C.parentElement)==null?void 0:b.parentElement;if(N){const k=n.indexOf(N);T[k]=w}}Object.values(T).forEach(v=>{var D;const w=(D=v.parentElement)==null?void 0:D.parentElement,N=w==null?void 0:w.parentElement,k=[...(N==null?void 0:N.childNodes)||[]],z=w?k.indexOf(w):-1;if(N&&z>-1){const H=n.indexOf(N),R=p.getElementsByTagName("measure")[H];Vs(w,N,R)}})}if(p&&p.getAttribute("id")===d){const T=p.getElementsByTagName("barline"),v=(A=T[T.length-1])==null?void 0:A.parentElement;if(((P=v==null?void 0:v.lastElementChild)==null?void 0:P.tagName)!=="barline"){const w=(v==null?void 0:v.children)||[];for(const N of w)if(N.tagName==="barline"){v==null||v.appendChild(N);break}}}}),Array.from(i).forEach(p=>{var x;p&&p.getAttribute("id")!==d&&((x=p.parentNode)==null||x.removeChild(p))});const m=e.getElementsByTagName("note");Array.from(m).forEach((p,x)=>{const C=p.getElementsByTagName("grace");C&&C.length})}return new XMLSerializer().serializeToString(Os(e))},Os=l=>{var i,s,r,o;if(!l)return l;const t=l.querySelectorAll("grace");if(!t.length)return l;const e=n=>n.querySelector("grace")?e(n==null?void 0:n.nextElementSibling):n;for(const n of t){const a=(i=n.parentElement)==null?void 0:i.querySelector("notations");if(a&&a.querySelectorAll("slur").length>1){const u=e((s=n.parentElement)==null?void 0:s.nextElementSibling);if(u&&u.querySelectorAll("slur").length>0){const h=Array.from(((r=u.querySelector("notations"))==null?void 0:r.children)||[]).map(g=>g.getAttribute("number")),f=a.querySelectorAll("slur");for(const g of f)h.includes(g.getAttribute("number"))||(o=u.querySelector("notations"))==null||o.appendChild(g)}}}return l},Vs=(l,t,e)=>{let i=0;if(!!t){for(let s=0;s<t.childNodes.length;s++){const r=t.childNodes[s];if(r.nodeName==="note"&&i++,r===l)break}if(i===0&&e){e.insertBefore(l,e.childNodes[0]);return}if(e&&e.childNodes.length>0){let s=0;const r=Array.from(e.childNodes).filter(n=>n.nodeName==="note"),o=r[r.length-1];if(i>=r.length&&o){e.insertBefore(l,e.childNodes[Array.from(e.childNodes).indexOf(o)]);return}for(let n=0;n<r.length;n++){const a=r[n];if(a.nodeName==="note"&&(s=s+1,s===i)){e.insertBefore(l,a);break}}}}},_s=l=>{var s,r;const t={showSpeed:!0,parsedXML:l},e=new DOMParser().parseFromString(l,"text/xml"),i=e.getElementsByTagName("words");for(const o of i)o&&((s=o.textContent)==null?void 0:s.trim())==="\u9690\u85CF\u901F\u5EA6"&&(t.showSpeed=!1,o.textContent=""),o&&((r=o.textContent)==null?void 0:r.trim())==="@"&&(o.textContent="segno");return t.parsedXML=new XMLSerializer().serializeToString(e),t};export{_s as a,Ls as f,ks as g,Is as o,Rs as s};
|